@treasuredata/tdx 2026.10.1 → 2026.10.2

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 (281) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-journey-command.js +1 -1
  12. package/dist/commands/cas-segment-command.js +1 -1
  13. package/dist/commands/chat-command.js +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-statusline-command.js +1 -1
  16. package/dist/commands/codex-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/delivery-command.js +1 -1
  21. package/dist/commands/describe.js +1 -1
  22. package/dist/commands/engage-always-on-campaign-pull-command.js +1 -1
  23. package/dist/commands/engage-always-on-campaign-push-command.js +1 -1
  24. package/dist/commands/engage-always-on-campaign-validate-command.js +1 -1
  25. package/dist/commands/engage-campaign-pull-command.js +1 -1
  26. package/dist/commands/engage-campaign-push-command.js +1 -1
  27. package/dist/commands/engage-campaign-readiness-command.js +1 -1
  28. package/dist/commands/engage-campaign-validate-command.js +1 -1
  29. package/dist/commands/engage-command.js +1 -1
  30. package/dist/commands/engage-in-browser-message-command.js +1 -1
  31. package/dist/commands/engage-landing-page-command.js +1 -1
  32. package/dist/commands/engage-template-pull-command.js +1 -1
  33. package/dist/commands/engage-template-push-command.js +1 -1
  34. package/dist/commands/engage-template-validate-command.js +1 -1
  35. package/dist/commands/engage-workspace-assignment-command.js +1 -1
  36. package/dist/commands/job-command.js +1 -1
  37. package/dist/commands/journey-command.js +1 -1
  38. package/dist/commands/journey-validate-command.js +1 -1
  39. package/dist/commands/llm-command.js +1 -1
  40. package/dist/commands/mcp-command.js +1 -1
  41. package/dist/commands/opencode-command.js +1 -1
  42. package/dist/commands/p13n-command.js +1 -1
  43. package/dist/commands/parent-segment-command.js +1 -1
  44. package/dist/commands/policy-command.js +1 -1
  45. package/dist/commands/profile-command.js +1 -1
  46. package/dist/commands/profiles-command.js +1 -1
  47. package/dist/commands/query-command.js +1 -1
  48. package/dist/commands/schedule-command.js +1 -1
  49. package/dist/commands/segment-command.js +1 -1
  50. package/dist/commands/segment-create-command.js +1 -1
  51. package/dist/commands/segment-fields-command.js +1 -1
  52. package/dist/commands/segment-move-command.js +1 -1
  53. package/dist/commands/segment-pull-command.js +1 -1
  54. package/dist/commands/segment-push-command.js +1 -1
  55. package/dist/commands/segment-update-command.js +1 -1
  56. package/dist/commands/segment-use-command.js +1 -1
  57. package/dist/commands/segment-validate-command.js +1 -1
  58. package/dist/commands/segments.js +1 -1
  59. package/dist/commands/show.js +1 -1
  60. package/dist/commands/status-command.js +1 -1
  61. package/dist/commands/table-deleted.js +1 -1
  62. package/dist/commands/tables.js +1 -1
  63. package/dist/commands/unset-command.js +1 -1
  64. package/dist/commands/upgrade-command.d.ts +8 -0
  65. package/dist/commands/upgrade-command.d.ts.map +1 -1
  66. package/dist/commands/upgrade-command.js +1 -1
  67. package/dist/commands/upgrade-command.js.map +1 -1
  68. package/dist/commands/usage-command.js +1 -1
  69. package/dist/commands/use-command.js +1 -1
  70. package/dist/commands/user-command.js +1 -1
  71. package/dist/commands/work-command.js +1 -1
  72. package/dist/commands/workflow-command.js +1 -1
  73. package/dist/core/auth.js +1 -1
  74. package/dist/core/command-output.js +1 -1
  75. package/dist/core/config.js +1 -1
  76. package/dist/core/connection-cache.js +1 -1
  77. package/dist/core/constants.js +1 -1
  78. package/dist/core/credential-cache.js +1 -1
  79. package/dist/core/global-context.js +1 -1
  80. package/dist/core/keychain.js +1 -1
  81. package/dist/core/oauth-keychain.js +1 -1
  82. package/dist/core/oauth.js +1 -1
  83. package/dist/core/profile.js +1 -1
  84. package/dist/core/project-config.js +1 -1
  85. package/dist/core/session.js +1 -1
  86. package/dist/core/site-mismatch.js +1 -1
  87. package/dist/core/user-cache.js +1 -1
  88. package/dist/core/version.js +1 -1
  89. package/dist/index.js +1 -1
  90. package/dist/mcp/server.js +1 -1
  91. package/dist/mcp/tools/index.js +1 -1
  92. package/dist/mcp/tools/tdx-run.js +1 -1
  93. package/dist/mcp/tools/tdx-search.js +1 -1
  94. package/dist/mcp/tools/work-create-item.js +1 -1
  95. package/dist/mcp/utils.js +1 -1
  96. package/dist/proxy/claude-usage-tracker.js +1 -1
  97. package/dist/proxy/passthrough-server.js +1 -1
  98. package/dist/proxy/sse-usage-parser.js +1 -1
  99. package/dist/sdk/agent/agent-config.js +1 -1
  100. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  101. package/dist/sdk/agent/agent-yaml.js +1 -1
  102. package/dist/sdk/agent/test/evaluator.js +1 -1
  103. package/dist/sdk/agent/test/executor.js +1 -1
  104. package/dist/sdk/agent/test/index.js +1 -1
  105. package/dist/sdk/agent/test/output.js +1 -1
  106. package/dist/sdk/agent/test/parser.js +1 -1
  107. package/dist/sdk/agent/tool-target-registry.js +1 -1
  108. package/dist/sdk/api.js +1 -1
  109. package/dist/sdk/auth-token.js +1 -1
  110. package/dist/sdk/cas/audience-context.js +1 -1
  111. package/dist/sdk/cas/cas-api-client.js +1 -1
  112. package/dist/sdk/cas/cas-audience-schema.js +1 -1
  113. package/dist/sdk/cas/cas-audience-validator.js +1 -1
  114. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  115. package/dist/sdk/cas/cas-segment-schema.js +1 -1
  116. package/dist/sdk/cas/cas-segment-validator.js +1 -1
  117. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  118. package/dist/sdk/cas/index.js +1 -1
  119. package/dist/sdk/cas/pull-workflow.js +1 -1
  120. package/dist/sdk/cas/push-workflow.js +1 -1
  121. package/dist/sdk/cas/validate-files.js +1 -1
  122. package/dist/sdk/client/cdp-api-client.js +1 -1
  123. package/dist/sdk/client/delivery-api-client.js +1 -1
  124. package/dist/sdk/client/endpoints.js +1 -1
  125. package/dist/sdk/client/engage-api-client.js +1 -1
  126. package/dist/sdk/client/http-client.js +1 -1
  127. package/dist/sdk/client/llm-api-client.js +1 -1
  128. package/dist/sdk/client/oauth-refresh.js +1 -1
  129. package/dist/sdk/client/p13n-studio-api-client.js +1 -1
  130. package/dist/sdk/client/rate-limiter.js +1 -1
  131. package/dist/sdk/client/td-api-client.js +1 -1
  132. package/dist/sdk/client/trino-api-client.js +1 -1
  133. package/dist/sdk/client/workflow-client.js +1 -1
  134. package/dist/sdk/connection-validator.js +1 -1
  135. package/dist/sdk/connection.js +1 -1
  136. package/dist/sdk/delivery.js +1 -1
  137. package/dist/sdk/engage/always-on-campaign-pull.js +1 -1
  138. package/dist/sdk/engage/always-on-campaign-push.js +1 -1
  139. package/dist/sdk/engage/always-on-campaign-validator.js +1 -1
  140. package/dist/sdk/engage/always-on-campaign-yaml.js +1 -1
  141. package/dist/sdk/engage/campaign-pull.js +1 -1
  142. package/dist/sdk/engage/campaign-push.js +1 -1
  143. package/dist/sdk/engage/campaign-readiness-workflow.js +1 -1
  144. package/dist/sdk/engage/campaign-readiness.js +1 -1
  145. package/dist/sdk/engage/campaign-validator.js +1 -1
  146. package/dist/sdk/engage/campaign-yaml.js +1 -1
  147. package/dist/sdk/engage/in-browser-message-pull.js +1 -1
  148. package/dist/sdk/engage/in-browser-message-push.js +1 -1
  149. package/dist/sdk/engage/in-browser-message-validator.js +1 -1
  150. package/dist/sdk/engage/in-browser-message-yaml.js +1 -1
  151. package/dist/sdk/engage/landing-page-init.js +1 -1
  152. package/dist/sdk/engage/landing-page-public-asset.js +1 -1
  153. package/dist/sdk/engage/landing-page-pull.js +1 -1
  154. package/dist/sdk/engage/landing-page-push.js +1 -1
  155. package/dist/sdk/engage/landing-page-static-site.js +1 -1
  156. package/dist/sdk/engage/landing-page-validator.js +1 -1
  157. package/dist/sdk/engage/landing-page-workspace.js +1 -1
  158. package/dist/sdk/engage/landing-page-yaml.js +1 -1
  159. package/dist/sdk/engage/list-campaign-schema.js +1 -1
  160. package/dist/sdk/engage/list-campaign-yaml.js +1 -1
  161. package/dist/sdk/engage/template-pull.js +1 -1
  162. package/dist/sdk/engage/template-push.js +1 -1
  163. package/dist/sdk/engage/template-validator.js +1 -1
  164. package/dist/sdk/engage/template-yaml.js +1 -1
  165. package/dist/sdk/engage/types/always-on-campaign-schema.js +1 -1
  166. package/dist/sdk/engage/types/campaign-def.js +1 -1
  167. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  168. package/dist/sdk/engage/types/in-browser-message-schema.js +1 -1
  169. package/dist/sdk/engage/types/landing-page-schema.js +1 -1
  170. package/dist/sdk/engage/types/template-schema.js +1 -1
  171. package/dist/sdk/engage/workspace-assignments.js +1 -1
  172. package/dist/sdk/engage.js +1 -1
  173. package/dist/sdk/errors.js +1 -1
  174. package/dist/sdk/index.js +1 -1
  175. package/dist/sdk/io/index.js +1 -1
  176. package/dist/sdk/io/node-filesystem.js +1 -1
  177. package/dist/sdk/job.js +1 -1
  178. package/dist/sdk/journey.js +1 -1
  179. package/dist/sdk/llm/chat-cache.js +1 -1
  180. package/dist/sdk/llm/codex-usage.js +1 -1
  181. package/dist/sdk/llm/index.js +1 -1
  182. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  183. package/dist/sdk/llm/model-factors.js +1 -1
  184. package/dist/sdk/llm/user-settings.js +1 -1
  185. package/dist/sdk/llm/work-models.js +1 -1
  186. package/dist/sdk/p13n-studio-errors.js +1 -1
  187. package/dist/sdk/p13n-studio.js +1 -1
  188. package/dist/sdk/personalization.js +1 -1
  189. package/dist/sdk/policy.js +1 -1
  190. package/dist/sdk/query/deleted-table-validation.js +1 -1
  191. package/dist/sdk/query/index.js +1 -1
  192. package/dist/sdk/query/sql-parser.js +1 -1
  193. package/dist/sdk/realtime.js +1 -1
  194. package/dist/sdk/schedule.js +1 -1
  195. package/dist/sdk/segment/audience-context.js +1 -1
  196. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  197. package/dist/sdk/segment/fields-display.js +1 -1
  198. package/dist/sdk/segment/file-discovery.js +1 -1
  199. package/dist/sdk/segment/journey-utils.js +1 -1
  200. package/dist/sdk/segment/journey-validator.js +1 -1
  201. package/dist/sdk/segment/journey-yaml.js +1 -1
  202. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  203. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  204. package/dist/sdk/segment/pull-workflow.js +1 -1
  205. package/dist/sdk/segment/push-recovery.js +1 -1
  206. package/dist/sdk/segment/push-workflow.js +1 -1
  207. package/dist/sdk/segment/resolution-context.js +1 -1
  208. package/dist/sdk/segment/segment-path-parser.js +1 -1
  209. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  210. package/dist/sdk/segment/segment-validator.js +1 -1
  211. package/dist/sdk/segment/target-resolution.js +1 -1
  212. package/dist/sdk/segment/tdx-config.js +1 -1
  213. package/dist/sdk/segment/types/activation-schema.js +1 -1
  214. package/dist/sdk/segment/types/journey-def.js +1 -1
  215. package/dist/sdk/segment/types/journey-schema.js +1 -1
  216. package/dist/sdk/segment/types/segment-def.js +1 -1
  217. package/dist/sdk/segment/types/segment-schema.js +1 -1
  218. package/dist/sdk/segment/validate-files.js +1 -1
  219. package/dist/sdk/segment/yaml-validator.js +1 -1
  220. package/dist/sdk/segment.js +1 -1
  221. package/dist/sdk/types/index.js +1 -1
  222. package/dist/sdk/types/progress.js +1 -1
  223. package/dist/sdk/types/workspace.js +1 -1
  224. package/dist/sdk/user.js +1 -1
  225. package/dist/sdk/util/format-detector.js +1 -1
  226. package/dist/sdk/util/formatters.js +1 -1
  227. package/dist/sdk/util/index.js +1 -1
  228. package/dist/sdk/util/paginate.js +1 -1
  229. package/dist/sdk/util/tree-formatter.js +1 -1
  230. package/dist/sdk/util/tree-search.js +1 -1
  231. package/dist/sdk/workflow/archive-validation.js +1 -1
  232. package/dist/sdk/workflow/clone-workflow.js +1 -1
  233. package/dist/sdk/workflow/index.js +1 -1
  234. package/dist/sdk/workflow/pull-workflow.js +1 -1
  235. package/dist/sdk/workflow/push-workflow.js +1 -1
  236. package/dist/sdk/workflow/task-graph.js +1 -1
  237. package/dist/sdk/workflow/tdx-config.js +1 -1
  238. package/dist/sdk/workflow/workflow-utils.js +1 -1
  239. package/dist/sdk/workspace/access-tracker.js +1 -1
  240. package/dist/sdk/workspace/frontmatter.js +1 -1
  241. package/dist/sdk/workspace/git.js +1 -1
  242. package/dist/sdk/workspace/index.js +1 -1
  243. package/dist/sdk/workspace/templates.js +1 -1
  244. package/dist/sdk/workspace/weekly.js +1 -1
  245. package/dist/sdk/workspace/wikilinks.js +1 -1
  246. package/dist/test-utils/command-runner.js +1 -1
  247. package/dist/test-utils/factories.js +1 -1
  248. package/dist/test-utils/fixtures.js +1 -1
  249. package/dist/test-utils/http-mock.js +1 -1
  250. package/dist/test-utils/index.js +1 -1
  251. package/dist/utils/async.js +1 -1
  252. package/dist/utils/claude-code-state.js +1 -1
  253. package/dist/utils/colors.js +1 -1
  254. package/dist/utils/diff.js +1 -1
  255. package/dist/utils/file-permissions.js +1 -1
  256. package/dist/utils/file-reader.js +1 -1
  257. package/dist/utils/github-releases.js +1 -1
  258. package/dist/utils/global-cache.js +1 -1
  259. package/dist/utils/json-loader.js +1 -1
  260. package/dist/utils/local-cache.js +1 -1
  261. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  262. package/dist/utils/logger/formatters/index.js +1 -1
  263. package/dist/utils/logger/handlers/console-handler.js +1 -1
  264. package/dist/utils/logger/handlers/file-handler.js +1 -1
  265. package/dist/utils/logger/handlers/index.js +1 -1
  266. package/dist/utils/logger/handlers/null-handler.js +1 -1
  267. package/dist/utils/logger/index.js +1 -1
  268. package/dist/utils/logger/logger.js +1 -1
  269. package/dist/utils/logger/types.js +1 -1
  270. package/dist/utils/option-validation.js +1 -1
  271. package/dist/utils/process.js +1 -1
  272. package/dist/utils/prompt.js +1 -1
  273. package/dist/utils/proxy-fetch.js +1 -1
  274. package/dist/utils/spinner.js +1 -1
  275. package/dist/utils/sse-parser.js +1 -1
  276. package/dist/utils/string-utils.js +1 -1
  277. package/dist/utils/table-ref-parser.js +1 -1
  278. package/dist/utils/td-user.js +1 -1
  279. package/dist/utils/tdx-logger.js +1 -1
  280. package/dist/utils/version-check.js +1 -1
  281. package/package.json +1 -1
@@ -1 +1 @@
1
- const a42_0x3fb101=a42_0x3323;(function(_0x91e821,_0x22e8f1){const _0x90bfbb=a42_0x3323,_0x7d2d77=_0x91e821();while(!![]){try{const _0x4dc8b3=-parseInt(_0x90bfbb(0x1e4))/0x1*(-parseInt(_0x90bfbb(0x1fe))/0x2)+-parseInt(_0x90bfbb(0x208))/0x3+parseInt(_0x90bfbb(0x20f))/0x4*(-parseInt(_0x90bfbb(0x1f1))/0x5)+parseInt(_0x90bfbb(0x218))/0x6+parseInt(_0x90bfbb(0x1f3))/0x7+-parseInt(_0x90bfbb(0x203))/0x8+parseInt(_0x90bfbb(0x1ea))/0x9*(parseInt(_0x90bfbb(0x1ef))/0xa);if(_0x4dc8b3===_0x22e8f1)break;else _0x7d2d77['push'](_0x7d2d77['shift']());}catch(_0x615fd8){_0x7d2d77['push'](_0x7d2d77['shift']());}}}(a42_0x3cf7,0x529dd));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a42_0x1dff43 from'chalk';function a42_0x3cf7(){const _0x417b28=['validate','policy\x20list','Fetching\x20permissions...','1301949wKclDa','policies','getCurrent','log','listPolicies','10uZBpGj','getPolicyUsers','20310Wubdsw','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','2484062gAfzyw','getPolicyPermissions','all','(ID:\x20','join','verbose','name','bold','📋\x20Assigned\x20Policies','\x20polic','Account\x20Owner','4qyhBbX','entries','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','length','map','2424088WsWHIg','error','policy\x20show','No\x20policies\x20found','data','1038672RwcWFr','padEnd','Fetching\x20policy...','email','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','\x20\x20•\x20','user','200OgBGCV','account_id','Listing\x20policies...','\x20\x20\x20','policy','🔑\x20Effective\x20Permissions','dim','execute','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','458694JqtROe','description','Administrator','ies','\x20\x20No\x20permissions','permissions','context',',\x20user_id:','args','307378IrMXVd','getMyPermissions','\x20—\x20'];a42_0x3cf7=function(){return _0x417b28;};return a42_0x3cf7();}export class PolicyCommand extends BaseCommand{[a42_0x3fb101(0x1f9)]='policy';[a42_0x3fb101(0x219)]=a42_0x3fb101(0x1f2);async[a42_0x3fb101(0x216)](_0x367a83){const _0x1fa921=a42_0x3fb101,{options:_0xe27d4c,tdx:_0x699cdb}=_0x367a83,_0x4f54ea=await withSpinner(_0x1fa921(0x1e9),async()=>{const _0x5a54c8=_0x1fa921,[_0x4ff15c,_0x5bfa44]=await Promise['all']([_0x699cdb[_0x5a54c8(0x20e)][_0x5a54c8(0x1ec)](),_0x699cdb['policy'][_0x5a54c8(0x1e5)]()]);return{'userInfo':_0x4ff15c,'permissions':_0x5bfa44};},{'verbose':_0xe27d4c[_0x1fa921(0x1f8)]}),{userInfo:_0x5e2201,permissions:_0x1c22b3}=_0x4f54ea[_0x1fa921(0x207)];if(isStructuredFormat(_0xe27d4c))return await handleSingleObjectOutput(_0x1c22b3,_0xe27d4c),0x0;const _0x10e2ee=_0x5e2201['account_owner']?_0x1fa921(0x1fd):_0x5e2201['administrator']?_0x1fa921(0x21a):'Member';console[_0x1fa921(0x1ed)]('\x0a'+a42_0x1dff43['bold']('👤')+'\x20'+a42_0x1dff43[_0x1fa921(0x1fa)](_0x5e2201['name'])+'\x20'+a42_0x1dff43['dim']('('+_0x5e2201['email']+')')+_0x1fa921(0x1e6)+_0x10e2ee),console[_0x1fa921(0x1ed)](a42_0x1dff43[_0x1fa921(0x215)]('\x20\x20\x20'+_0x699cdb[_0x1fa921(0x1e1)]['site']+':'+_0x5e2201[_0x1fa921(0x210)]+_0x1fa921(0x1e2)+_0x5e2201['id']));const _0x45f199=_0x1c22b3[_0x1fa921(0x1eb)];console[_0x1fa921(0x1ed)]('\x0a'+a42_0x1dff43[_0x1fa921(0x1fa)](_0x1fa921(0x1fb))+'\x20('+_0x45f199[_0x1fa921(0x201)]+'):');if(_0x45f199[_0x1fa921(0x201)]===0x0)console[_0x1fa921(0x1ed)](a42_0x1dff43['dim']('\x20\x20No\x20policies\x20assigned'));else for(const _0x185b11 of _0x45f199){console[_0x1fa921(0x1ed)]('\x20\x20•\x20'+_0x185b11[_0x1fa921(0x1f9)]);}return printPermissionsMap(_0x1c22b3['permissions']),console[_0x1fa921(0x1ed)](),0x0;}}function a42_0x3323(_0x3e4712,_0x173ca2){_0x3e4712=_0x3e4712-0x1e0;const _0x3cf7d2=a42_0x3cf7();let _0x33233d=_0x3cf7d2[_0x3e4712];return _0x33233d;}export class PolicyListCommand extends BaseCommand{[a42_0x3fb101(0x1f9)]=a42_0x3fb101(0x1e8);[a42_0x3fb101(0x219)]=a42_0x3fb101(0x217);async[a42_0x3fb101(0x216)](_0x46ce23){const _0x2a1747=a42_0x3fb101,{options:_0x35514b,tdx:_0x4d41f0}=_0x46ce23,_0x14a82c=await withSpinner(_0x2a1747(0x211),()=>_0x4d41f0[_0x2a1747(0x213)][_0x2a1747(0x1ee)](),{'verbose':_0x35514b[_0x2a1747(0x1f8)]}),_0x2ead13=_0x14a82c[_0x2a1747(0x207)];console[_0x2a1747(0x204)]('✔\x20Found\x20'+_0x2ead13['length']+_0x2a1747(0x1fc)+(_0x2ead13[_0x2a1747(0x201)]!==0x1?_0x2a1747(0x21b):'y'));if(isStructuredFormat(_0x35514b))return await handleSDKOutput(_0x2ead13,_0x35514b),0x0;if(_0x2ead13[_0x2a1747(0x201)]===0x0)console['log'](a42_0x1dff43[_0x2a1747(0x215)](_0x2a1747(0x206)));else for(const _0x2e3871 of _0x2ead13){const _0x127a6d=_0x2e3871[_0x2a1747(0x219)]?a42_0x1dff43[_0x2a1747(0x215)](_0x2a1747(0x1e6)+_0x2e3871[_0x2a1747(0x219)]):'';console[_0x2a1747(0x1ed)](_0x2a1747(0x20d)+_0x2e3871[_0x2a1747(0x1f9)]+_0x127a6d);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a42_0x3fb101(0x1f9)]=a42_0x3fb101(0x205);[a42_0x3fb101(0x219)]=a42_0x3fb101(0x20c);[a42_0x3fb101(0x1e7)](_0x418e57){const _0x3db698=a42_0x3fb101;if(_0x418e57[_0x3db698(0x1e3)][_0x3db698(0x201)]===0x0)return _0x3db698(0x200);return undefined;}async[a42_0x3fb101(0x216)](_0x1243b6){const _0x353685=a42_0x3fb101,{options:_0x2cd7fc,tdx:_0x5e4897}=_0x1243b6,_0x1f073d=_0x1243b6[_0x353685(0x1e3)][0x0],_0x3764be=await withSpinner(_0x353685(0x20a),async()=>{const _0x47cf6a=_0x353685,_0x15decc=await _0x5e4897['policy']['getPolicy'](_0x1f073d),[_0x4e3144,_0x106c24]=await Promise[_0x47cf6a(0x1f5)]([_0x5e4897['policy'][_0x47cf6a(0x1f4)](_0x15decc['id']),_0x5e4897[_0x47cf6a(0x213)][_0x47cf6a(0x1f0)](_0x15decc['id'])]);return{'policy':_0x15decc,'perms':_0x4e3144,'users':_0x106c24};},{'verbose':_0x2cd7fc[_0x353685(0x1f8)]}),{policy:_0x585559,perms:_0x15a94d,users:_0x1da97f}=_0x3764be[_0x353685(0x207)];if(isStructuredFormat(_0x2cd7fc))return await handleSingleObjectOutput({..._0x585559,'permissions':_0x15a94d[_0x353685(0x1e0)],'users':_0x1da97f},_0x2cd7fc),0x0;console[_0x353685(0x1ed)]('\x0a'+a42_0x1dff43['bold']('📋')+'\x20'+a42_0x1dff43['bold'](_0x585559[_0x353685(0x1f9)])+'\x20'+a42_0x1dff43[_0x353685(0x215)](_0x353685(0x1f6)+_0x585559['id']+')'));_0x585559[_0x353685(0x219)]&&console[_0x353685(0x1ed)](_0x353685(0x212)+a42_0x1dff43[_0x353685(0x215)](_0x585559[_0x353685(0x219)]));console[_0x353685(0x1ed)](_0x353685(0x212)+_0x1da97f['length']+'\x20user'+(_0x1da97f[_0x353685(0x201)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x15a94d[_0x353685(0x1e0)]);if(_0x1da97f['length']>0x0){console[_0x353685(0x1ed)]('\x0a'+a42_0x1dff43[_0x353685(0x1fa)]('👥\x20Assigned\x20Users')+':');for(const _0x3c4289 of _0x1da97f){const _0x63d224=_0x3c4289['email']&&_0x3c4289[_0x353685(0x20b)]!==_0x3c4289[_0x353685(0x1f9)]?a42_0x1dff43[_0x353685(0x215)]('\x20<'+_0x3c4289[_0x353685(0x20b)]+'>'):'';console[_0x353685(0x1ed)]('\x20\x20•\x20'+_0x3c4289['name']+_0x63d224);}}return console[_0x353685(0x1ed)](),0x0;}}function printPermissionsMap(_0x2a30fe){const _0x38bfdc=a42_0x3fb101,_0x73c4fb=Object[_0x38bfdc(0x1ff)](_0x2a30fe);console[_0x38bfdc(0x1ed)]('\x0a'+a42_0x1dff43['bold'](_0x38bfdc(0x214))+':');if(_0x73c4fb['length']===0x0){console[_0x38bfdc(0x1ed)](a42_0x1dff43['dim'](_0x38bfdc(0x21c)));return;}const _0x20526c=Math['max'](..._0x73c4fb[_0x38bfdc(0x202)](([_0x1e5208])=>_0x1e5208[_0x38bfdc(0x201)]));for(const [_0x920727,_0x2fa4b6]of _0x73c4fb){const _0x47abe7=formatOperations(_0x2fa4b6);console[_0x38bfdc(0x1ed)]('\x20\x20'+_0x920727[_0x38bfdc(0x209)](_0x20526c+0x2)+_0x47abe7);}}function formatOperations(_0x2cf21b){const _0x527f93=a42_0x3fb101,_0x4a43c0=[...new Set(_0x2cf21b['map'](_0x5a2d24=>_0x5a2d24['operation']))];return _0x4a43c0[_0x527f93(0x1f7)](',\x20');}
1
+ const a42_0x6a2363=a42_0x32f6;(function(_0x2c0827,_0x3e47bb){const _0x2be45d=a42_0x32f6,_0x9c68ac=_0x2c0827();while(!![]){try{const _0x1f78c0=parseInt(_0x2be45d(0x1dd))/0x1*(parseInt(_0x2be45d(0x1ee))/0x2)+-parseInt(_0x2be45d(0x1ff))/0x3+-parseInt(_0x2be45d(0x1ea))/0x4*(-parseInt(_0x2be45d(0x207))/0x5)+parseInt(_0x2be45d(0x1fb))/0x6+parseInt(_0x2be45d(0x1f6))/0x7+-parseInt(_0x2be45d(0x1e9))/0x8*(parseInt(_0x2be45d(0x1e7))/0x9)+parseInt(_0x2be45d(0x1f2))/0xa*(parseInt(_0x2be45d(0x1d7))/0xb);if(_0x1f78c0===_0x3e47bb)break;else _0x9c68ac['push'](_0x9c68ac['shift']());}catch(_0x5c8766){_0x9c68ac['push'](_0x9c68ac['shift']());}}}(a42_0x96b0,0xd41c8));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a42_0x32f17e from'chalk';export class PolicyCommand extends BaseCommand{['name']='policy';[a42_0x6a2363(0x20b)]=a42_0x6a2363(0x201);async[a42_0x6a2363(0x1ef)](_0x180a16){const _0x4adc8e=a42_0x6a2363,{options:_0x3f368,tdx:_0x7f8583}=_0x180a16,_0x480d9c=await withSpinner('Fetching\x20permissions...',async()=>{const _0x19e6a5=a42_0x32f6,[_0x36a3e2,_0x20bfeb]=await Promise['all']([_0x7f8583['user']['getCurrent'](),_0x7f8583[_0x19e6a5(0x200)][_0x19e6a5(0x1d1)]()]);return{'userInfo':_0x36a3e2,'permissions':_0x20bfeb};},{'verbose':_0x3f368[_0x4adc8e(0x202)]}),{userInfo:_0x103ce3,permissions:_0x22dfcf}=_0x480d9c[_0x4adc8e(0x1d9)];if(isStructuredFormat(_0x3f368))return await handleSingleObjectOutput(_0x22dfcf,_0x3f368),0x0;const _0x3df291=_0x103ce3['account_owner']?_0x4adc8e(0x1ec):_0x103ce3[_0x4adc8e(0x1e2)]?'Administrator':_0x4adc8e(0x1d0);console[_0x4adc8e(0x1eb)]('\x0a'+a42_0x32f17e['bold']('👤')+'\x20'+a42_0x32f17e[_0x4adc8e(0x204)](_0x103ce3[_0x4adc8e(0x1fa)])+'\x20'+a42_0x32f17e['dim']('('+_0x103ce3[_0x4adc8e(0x1f8)]+')')+'\x20—\x20'+_0x3df291),console[_0x4adc8e(0x1eb)](a42_0x32f17e[_0x4adc8e(0x1e0)](_0x4adc8e(0x1f4)+_0x7f8583[_0x4adc8e(0x1ce)]['site']+':'+_0x103ce3[_0x4adc8e(0x1ed)]+_0x4adc8e(0x1df)+_0x103ce3['id']));const _0x2420a4=_0x22dfcf[_0x4adc8e(0x205)];console[_0x4adc8e(0x1eb)]('\x0a'+a42_0x32f17e['bold'](_0x4adc8e(0x1f1))+'\x20('+_0x2420a4[_0x4adc8e(0x1e4)]+'):');if(_0x2420a4[_0x4adc8e(0x1e4)]===0x0)console[_0x4adc8e(0x1eb)](a42_0x32f17e[_0x4adc8e(0x1e0)](_0x4adc8e(0x1cd)));else for(const _0x53be1d of _0x2420a4){console[_0x4adc8e(0x1eb)](_0x4adc8e(0x208)+_0x53be1d[_0x4adc8e(0x1fa)]);}return printPermissionsMap(_0x22dfcf[_0x4adc8e(0x20a)]),console['log'](),0x0;}}function a42_0x96b0(){const _0x131220=['execute','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','📋\x20Assigned\x20Policies','16070jpUnar','operation','\x20\x20\x20','Listing\x20policies...','133861ybRHWm','Fetching\x20policy...','email','max','name','2276700AXEgcV','listPolicies','\x20user','No\x20policies\x20found','4543878zFCnnB','policy','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','verbose','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','bold','policies','\x20assigned','5eBACrC','\x20\x20•\x20','\x20\x20No\x20permissions','permissions','description','join','all','\x20\x20No\x20policies\x20assigned','context','error','Member','getMyPermissions','validate','🔑\x20Effective\x20Permissions','policy\x20list','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','getPolicyUsers','9119JRhAuI','\x20polic','data','entries','args','\x20—\x20','1yxRpBC','getPolicyPermissions',',\x20user_id:','dim','map','administrator','(ID:\x20','length','ies','policy\x20show','9NbWFVE','✔\x20Found\x20','6095256hUroYS','379996GClvRB','log','Account\x20Owner','account_id','2639132YZkvlU'];a42_0x96b0=function(){return _0x131220;};return a42_0x96b0();}export class PolicyListCommand extends BaseCommand{[a42_0x6a2363(0x1fa)]=a42_0x6a2363(0x1d4);[a42_0x6a2363(0x20b)]=a42_0x6a2363(0x1f0);async['execute'](_0x4dcb75){const _0x4a9ca9=a42_0x6a2363,{options:_0x368dec,tdx:_0x39a6f7}=_0x4dcb75,_0x5a6b06=await withSpinner(_0x4a9ca9(0x1f5),()=>_0x39a6f7['policy'][_0x4a9ca9(0x1fc)](),{'verbose':_0x368dec[_0x4a9ca9(0x202)]}),_0x564091=_0x5a6b06[_0x4a9ca9(0x1d9)];console[_0x4a9ca9(0x1cf)](_0x4a9ca9(0x1e8)+_0x564091['length']+_0x4a9ca9(0x1d8)+(_0x564091[_0x4a9ca9(0x1e4)]!==0x1?_0x4a9ca9(0x1e5):'y'));if(isStructuredFormat(_0x368dec))return await handleSDKOutput(_0x564091,_0x368dec),0x0;if(_0x564091[_0x4a9ca9(0x1e4)]===0x0)console['log'](a42_0x32f17e[_0x4a9ca9(0x1e0)](_0x4a9ca9(0x1fe)));else for(const _0x17aaf4 of _0x564091){const _0x20b0d4=_0x17aaf4[_0x4a9ca9(0x20b)]?a42_0x32f17e[_0x4a9ca9(0x1e0)](_0x4a9ca9(0x1dc)+_0x17aaf4[_0x4a9ca9(0x20b)]):'';console['log'](_0x4a9ca9(0x208)+_0x17aaf4[_0x4a9ca9(0x1fa)]+_0x20b0d4);}return 0x0;}}function a42_0x32f6(_0x2ad822,_0x3a021d){_0x2ad822=_0x2ad822-0x1cc;const _0x96b030=a42_0x96b0();let _0x32f6d6=_0x96b030[_0x2ad822];return _0x32f6d6;}export class PolicyShowCommand extends BaseCommand{[a42_0x6a2363(0x1fa)]=a42_0x6a2363(0x1e6);[a42_0x6a2363(0x20b)]=a42_0x6a2363(0x1d5);[a42_0x6a2363(0x1d2)](_0x371c17){const _0x138d04=a42_0x6a2363;if(_0x371c17['args']['length']===0x0)return _0x138d04(0x203);return undefined;}async[a42_0x6a2363(0x1ef)](_0x52ae53){const _0x71586c=a42_0x6a2363,{options:_0x48fea3,tdx:_0x36d0c4}=_0x52ae53,_0x1870ed=_0x52ae53[_0x71586c(0x1db)][0x0],_0x510375=await withSpinner(_0x71586c(0x1f7),async()=>{const _0x37cef7=_0x71586c,_0x1f8ed3=await _0x36d0c4[_0x37cef7(0x200)]['getPolicy'](_0x1870ed),[_0x3277c3,_0x1a810f]=await Promise[_0x37cef7(0x1cc)]([_0x36d0c4[_0x37cef7(0x200)][_0x37cef7(0x1de)](_0x1f8ed3['id']),_0x36d0c4[_0x37cef7(0x200)][_0x37cef7(0x1d6)](_0x1f8ed3['id'])]);return{'policy':_0x1f8ed3,'perms':_0x3277c3,'users':_0x1a810f};},{'verbose':_0x48fea3[_0x71586c(0x202)]}),{policy:_0x1badcc,perms:_0x4c2c0c,users:_0x232739}=_0x510375[_0x71586c(0x1d9)];if(isStructuredFormat(_0x48fea3))return await handleSingleObjectOutput({..._0x1badcc,'permissions':_0x4c2c0c[_0x71586c(0x20a)],'users':_0x232739},_0x48fea3),0x0;console[_0x71586c(0x1eb)]('\x0a'+a42_0x32f17e['bold']('📋')+'\x20'+a42_0x32f17e[_0x71586c(0x204)](_0x1badcc['name'])+'\x20'+a42_0x32f17e['dim'](_0x71586c(0x1e3)+_0x1badcc['id']+')'));_0x1badcc[_0x71586c(0x20b)]&&console['log'](_0x71586c(0x1f4)+a42_0x32f17e[_0x71586c(0x1e0)](_0x1badcc[_0x71586c(0x20b)]));console[_0x71586c(0x1eb)](_0x71586c(0x1f4)+_0x232739['length']+_0x71586c(0x1fd)+(_0x232739['length']!==0x1?'s':'')+_0x71586c(0x206)),printPermissionsMap(_0x4c2c0c['permissions']);if(_0x232739['length']>0x0){console[_0x71586c(0x1eb)]('\x0a'+a42_0x32f17e['bold']('👥\x20Assigned\x20Users')+':');for(const _0x621c3 of _0x232739){const _0x202e7d=_0x621c3['email']&&_0x621c3[_0x71586c(0x1f8)]!==_0x621c3['name']?a42_0x32f17e[_0x71586c(0x1e0)]('\x20<'+_0x621c3[_0x71586c(0x1f8)]+'>'):'';console[_0x71586c(0x1eb)](_0x71586c(0x208)+_0x621c3[_0x71586c(0x1fa)]+_0x202e7d);}}return console[_0x71586c(0x1eb)](),0x0;}}function printPermissionsMap(_0x5c64c2){const _0xa2e7c1=a42_0x6a2363,_0x202553=Object[_0xa2e7c1(0x1da)](_0x5c64c2);console[_0xa2e7c1(0x1eb)]('\x0a'+a42_0x32f17e[_0xa2e7c1(0x204)](_0xa2e7c1(0x1d3))+':');if(_0x202553[_0xa2e7c1(0x1e4)]===0x0){console['log'](a42_0x32f17e[_0xa2e7c1(0x1e0)](_0xa2e7c1(0x209)));return;}const _0x26bd95=Math[_0xa2e7c1(0x1f9)](..._0x202553['map'](([_0x12e736])=>_0x12e736[_0xa2e7c1(0x1e4)]));for(const [_0xda06db,_0x156a5d]of _0x202553){const _0x34ffac=formatOperations(_0x156a5d);console['log']('\x20\x20'+_0xda06db['padEnd'](_0x26bd95+0x2)+_0x34ffac);}}function formatOperations(_0xeadbba){const _0x419833=a42_0x6a2363,_0x55cd29=[...new Set(_0xeadbba[_0x419833(0x1e1)](_0x2e3def=>_0x2e3def[_0x419833(0x1f3)]))];return _0x55cd29[_0x419833(0x20c)](',\x20');}
@@ -1 +1 @@
1
- const a43_0x40cf8d=a43_0x2a67;(function(_0x79155f,_0x34599d){const _0x199e0c=a43_0x2a67,_0x3de84c=_0x79155f();while(!![]){try{const _0x181a02=parseInt(_0x199e0c(0x150))/0x1*(-parseInt(_0x199e0c(0x133))/0x2)+-parseInt(_0x199e0c(0xfd))/0x3+parseInt(_0x199e0c(0x124))/0x4+-parseInt(_0x199e0c(0x14f))/0x5+-parseInt(_0x199e0c(0x12b))/0x6*(parseInt(_0x199e0c(0x147))/0x7)+-parseInt(_0x199e0c(0x145))/0x8*(-parseInt(_0x199e0c(0x14a))/0x9)+parseInt(_0x199e0c(0x12e))/0xa*(parseInt(_0x199e0c(0x14d))/0xb);if(_0x181a02===_0x34599d)break;else _0x3de84c['push'](_0x3de84c['shift']());}catch(_0x3ef96d){_0x3de84c['push'](_0x3de84c['shift']());}}}(a43_0x28c9,0x49ba8));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a43_0x1b7a94 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a43_0xf4ac7e from'prompts';import a43_0x327aae from'chalk';function validateProfileName(_0x5defd6,_0x5d4689){const _0x2b50dd=a43_0x2a67;if(!_0x5defd6||!_0x5defd6[_0x2b50dd(0x146)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x21dfff=_0x5defd6[_0x2b50dd(0x146)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x21dfff))return _0x2b50dd(0xf0);if(!_0x5d4689?.['skipExistsCheck']&&profileExists(_0x21dfff))return _0x2b50dd(0x132)+_0x21dfff+_0x2b50dd(0x12d)+_0x21dfff+'\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.';return!![];}async function deleteProfileAndCredentials(_0x2925cd){const _0xf83a5c=a43_0x2a67;removeProfileFromUserConfig(_0x2925cd);const _0x1fcbb4=await isKeychainAvailable();_0x1fcbb4&&await Promise[_0xf83a5c(0x152)]([deleteKeychainAPIKey(_0x2925cd),deleteOAuthTokens(_0x2925cd)]);}function a43_0x2a67(_0x4c359f,_0x33e095){_0x4c359f=_0x4c359f-0xeb;const _0x28c96e=a43_0x28c9();let _0x2a676d=_0x28c96e[_0x4c359f];return _0x2a676d;}export class ProfileCreateCommand extends BaseCommand{['name']=a43_0x40cf8d(0xf8);['description']=a43_0x40cf8d(0x126);async[a43_0x40cf8d(0x120)](_0x3d0c19){const _0xad693f=a43_0x40cf8d,{options:_0x526ccc,args:_0x1d78b0}=_0x3d0c19,_0x1d17e2=!!_0x526ccc[_0xad693f(0x138)];console[_0xad693f(0xf1)](a43_0x327aae[_0xad693f(0x153)](_0xad693f(0x131)));let _0x2ab323;if(_0x1d78b0['length']>0x0&&_0x1d78b0[0x0]){const _0x26985f=_0x1d78b0[0x0][_0xad693f(0x146)]();_0x1d17e2&&profileExists(_0x26985f)&&(await deleteProfileAndCredentials(_0x26985f),console[_0xad693f(0xf1)]('Removed\x20existing\x20profile\x20\x27'+_0x26985f+'\x27'));const _0x2bcfb4=validateProfileName(_0x26985f);if(_0x2bcfb4!==!![])return console[_0xad693f(0x140)](a43_0x327aae['red'](_0x2bcfb4)),0x1;_0x2ab323=_0x26985f;}else{const _0x4ce9a2=await a43_0xf4ac7e({'type':'text','name':_0xad693f(0x11d),'message':_0xad693f(0x142),'validate':_0x5961f0=>validateProfileName(_0x5961f0,{'skipExistsCheck':_0x1d17e2})});if(!_0x4ce9a2[_0xad693f(0x11d)])return console[_0xad693f(0xf1)]('\x0aSetup\x20cancelled'),0x1;_0x2ab323=_0x4ce9a2[_0xad693f(0x11d)][_0xad693f(0x146)](),_0x1d17e2&&profileExists(_0x2ab323)&&(await deleteProfileAndCredentials(_0x2ab323),console[_0xad693f(0xf1)](_0xad693f(0x11a)+_0x2ab323+'\x27'));}const _0x36f29d=await a43_0xf4ac7e({'type':'text','name':_0xad693f(0x111),'message':_0xad693f(0xf9)}),_0x596931=_0x36f29d[_0xad693f(0x111)]?.[_0xad693f(0x146)]()||undefined,_0x542d0f=_0x526ccc[_0xad693f(0x13e)]||_0xad693f(0x13b),_0x581898=await promptSiteSelection(_0x542d0f,_0x2ab323,_0xad693f(0x14b));if(!_0x581898)return 0x1;const _0x54c8c5=resolveSite(_0x581898),_0x1463f2=await promptAuthMethod();if(!_0x1463f2)return console[_0xad693f(0xf1)](_0xad693f(0x13f)),0x1;if(_0x1463f2===_0xad693f(0x14c)){if(_0x596931){const _0x42dc98={'site':_0x54c8c5,'description':_0x596931};saveProfileToUserConfig(_0x2ab323,_0x42dc98);}const {accountName:_0x48848a}=_0x526ccc;return await runOAuthLoginFlow(_0x54c8c5,_0x2ab323,_0x526ccc['logLevel']??LogLevel['ERROR'],{'accountName':_0x48848a}),0x0;}console['log'](_0xad693f(0x107)+_0x54c8c5),console['log'](_0xad693f(0x10f)),console['log']('\x20\x20'+getConsoleUrl(_0x54c8c5,_0xad693f(0x14e)));const _0x5d1a2b=await a43_0xf4ac7e({'type':_0xad693f(0xed),'name':_0xad693f(0x127),'message':_0xad693f(0x125),'validate':_0x118a6c=>{const _0x4b273b=_0xad693f;if(!_0x118a6c||!_0x118a6c[_0x4b273b(0x146)]())return _0x4b273b(0x113);return!![];}});if(!_0x5d1a2b['apiKey'])return console[_0xad693f(0xf1)](_0xad693f(0x13f)),0x1;const _0xc1d59f=_0x5d1a2b[_0xad693f(0x127)];console[_0xad693f(0xf1)](_0xad693f(0xef));try{const _0x211d38=TDX[_0xad693f(0x109)]({'site':_0x54c8c5,'apiKey':_0xc1d59f[_0xad693f(0x146)](),'logLevel':_0x526ccc[_0xad693f(0x118)]??LogLevel[_0xad693f(0x105)]}),_0x5d8cb6=await _0x211d38[_0xad693f(0x116)][_0xad693f(0xee)]();console[_0xad693f(0xf1)](a43_0x327aae[_0xad693f(0x130)]('✓')+_0xad693f(0x143)+_0x5d8cb6[_0xad693f(0xf7)]+')');const _0x5221de=await isKeychainAvailable();_0x5221de?(await saveAPIKeyAsync(_0xc1d59f['trim'](),_0x54c8c5,_0x2ab323),console[_0xad693f(0xf1)](a43_0x327aae['green']('✓')+_0xad693f(0x134)+_0x2ab323+')')):(console[_0xad693f(0x141)](a43_0x327aae[_0xad693f(0xfb)](_0xad693f(0xfc))),console[_0xad693f(0x141)](a43_0x327aae[_0xad693f(0xfb)](_0xad693f(0x11b))));const _0x4fa466={'site':_0x54c8c5,..._0x596931&&{'description':_0x596931}};return saveProfileToUserConfig(_0x2ab323,_0x4fa466),console['log'](a43_0x327aae[_0xad693f(0x130)]('✓')+'\x20Profile\x20\x27'+_0x2ab323+'\x27\x20created'),console[_0xad693f(0xf1)](),console[_0xad693f(0xf1)](_0xad693f(0xf3)),console[_0xad693f(0xf1)](_0xad693f(0x112)+_0x2ab323+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log']('\x20\x20tdx\x20--profile\x20'+_0x2ab323+_0xad693f(0x10e)),0x0;}catch(_0x405358){if(_0x405358 instanceof HTTPClientError&&_0x405358['status']===0x191)return printAuthError(_0x405358),0x1;return console['error'](a43_0x327aae[_0xad693f(0x11e)](_0xad693f(0x13a)+(_0x405358 instanceof Error?_0x405358[_0xad693f(0x123)]:String(_0x405358)))),console['error'](_0xad693f(0x110)),0x1;}}}function a43_0x28c9(){const _0xa88711=['\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','7230cbZOsz','Default\x20profile\x20set\x20to:\x20','green','tdx:\x20profile\x20create','Profile\x20\x27','939286CsOFXl','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Unknown\x20key\x20\x27','dim','\x20\x20-\x20','force','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','✗\x20Validation\x20failed:\x20','us01','\x0aAvailable\x20profiles:','tdx:\x20profile\x20delete','site','\x0aSetup\x20cancelled','error','warn','Enter\x20profile\x20name:','\x20API\x20key\x20is\x20valid\x20(User:\x20','status','258744AUrhUw','trim','707tUMLcw','\x27\x20updated:\x20','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','153pfPvOU','Setup\x20cancelled','oauth','8723IDNuuQ','/app/mp/ak','1040455pmZEVf','1sLNYKH','Delete\x20a\x20profile','all','bold','\x20--default\x27\x20to\x20save\x20permanently','tdx:\x20profile\x20set','\x0aOperation\x20cancelled','(session:\x20','password','getUserInfo','Validating\x20API\x20key...','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','log','config','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','profile','Set\x20a\x20profile\x20configuration\x20value','join','email','profile:create','Enter\x20description\x20(optional):','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','yellow','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','473319cPTzOQ','session','\x20Profile\x20\x27','includes','parent_segment','\x0aSaved\x20to:\x20','Site\x20was\x20not\x20changed.','profile:use','ERROR','VALID_KEYS','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','database','create','length','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Operation\x20cancelled','name','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','You\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','description','\x20\x20tdx\x20--profile\x20','API\x20key\x20cannot\x20be\x20empty','\x27\x20does\x20not\x20exist.','confirm','jobs','profile:delete','logLevel','Changing\x20site\x20to\x20\x27','Removed\x20existing\x20profile\x20\x27','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x20API\x20key\x20saved\x20to\x20system\x20keychain','profileName','red','\x27\x20requires\x20API\x20key\x20validation.','execute','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','validate','message','140136IQVTBV','Enter\x20your\x20TD\x20API\x20key:','Create\x20a\x20new\x20profile','apiKey','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x20\x20(no\x20profiles\x20found)','profile:set','1230zUolNr','\x27.\x0a\x0aValid\x20keys:\x20'];a43_0x28c9=function(){return _0xa88711;};return a43_0x28c9();}export class ProfileDeleteCommand extends BaseCommand{[a43_0x40cf8d(0x10d)]=a43_0x40cf8d(0x117);[a43_0x40cf8d(0x111)]=a43_0x40cf8d(0x151);['validate'](_0x5f3cf6){const _0x564565=a43_0x40cf8d,{args:_0x7f60f9}=_0x5f3cf6;if(_0x7f60f9[_0x564565(0x10a)]===0x0)return _0x564565(0xfa);return undefined;}async[a43_0x40cf8d(0x120)](_0x4d106e){const _0x3b5210=a43_0x40cf8d,{args:_0x5327df}=_0x4d106e,_0x9d363e=_0x5327df[0x0];console[_0x3b5210(0xf1)](a43_0x327aae['bold'](_0x3b5210(0x13d)));if(!profileExists(_0x9d363e)){console[_0x3b5210(0x140)](a43_0x327aae[_0x3b5210(0x11e)](_0x3b5210(0x132)+_0x9d363e+_0x3b5210(0x114))),console[_0x3b5210(0xf1)](_0x3b5210(0x13c));const _0x393cb6=listProfiles();if(_0x393cb6[_0x3b5210(0x10a)]===0x0)console[_0x3b5210(0xf1)](_0x3b5210(0x129));else for(const _0xb6e949 of _0x393cb6){console[_0x3b5210(0xf1)](_0x3b5210(0x137)+_0xb6e949[_0x3b5210(0x10d)]);}return 0x1;}const _0x277f83=await a43_0xf4ac7e({'type':_0x3b5210(0x115),'name':_0x3b5210(0x115),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x9d363e+'\x27?','initial':![]});if(!_0x277f83[_0x3b5210(0x115)])return console[_0x3b5210(0xf1)]('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x9d363e),console[_0x3b5210(0xf1)](a43_0x327aae[_0x3b5210(0x130)]('✓')+_0x3b5210(0xff)+_0x9d363e+'\x27\x20deleted');}catch(_0x1cd087){return console[_0x3b5210(0x140)](a43_0x327aae[_0x3b5210(0x11e)]('Failed\x20to\x20delete\x20profile:\x20'+(_0x1cd087 instanceof Error?_0x1cd087[_0x3b5210(0x123)]:String(_0x1cd087)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a43_0x40cf8d(0x12a);['description']=a43_0x40cf8d(0xf5);static [a43_0x40cf8d(0x106)]=[a43_0x40cf8d(0x13e),a43_0x40cf8d(0x108),a43_0x40cf8d(0x101),'llm_project','llm_agent',a43_0x40cf8d(0x111)];[a43_0x40cf8d(0x122)](_0x915b93){const _0xf791b=a43_0x40cf8d,{args:_0x1f6d72,options:_0x284c8c}=_0x915b93,_0x1c32db=_0x284c8c[_0xf791b(0xf4)]||getActiveProfile();if(!_0x1c32db)return _0xf791b(0x139);if(_0x1f6d72['length']===0x0)return _0xf791b(0x121)+ProfileSetCommand['VALID_KEYS'][_0xf791b(0xf6)](',\x20');const _0x1874c5=_0x1f6d72[0x0];if(!_0x1874c5[_0xf791b(0x100)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0xf791b(0x106)][_0xf791b(0xf6)](',\x20');const [_0x2f89e0]=_0x1874c5['split']('=',0x2);if(!ProfileSetCommand[_0xf791b(0x106)][_0xf791b(0x100)](_0x2f89e0))return _0xf791b(0x135)+_0x2f89e0+_0xf791b(0x12c)+ProfileSetCommand[_0xf791b(0x106)][_0xf791b(0xf6)](',\x20');return undefined;}async[a43_0x40cf8d(0x120)](_0xb93a02){const _0x2e0722=a43_0x40cf8d,{args:_0x53de68,options:_0x33a693}=_0xb93a02,_0x13306a=_0x33a693[_0x2e0722(0xf4)]||getActiveProfile(),[_0x4c1324,..._0x5953ac]=_0x53de68[0x0]['split']('='),_0x32d222=_0x5953ac[_0x2e0722(0xf6)]('=');console['log'](a43_0x327aae['bold'](_0x2e0722(0x155)));if(!profileExists(_0x13306a)){const _0x376123=await a43_0xf4ac7e({'type':'confirm','name':'create','message':'Profile\x20\x27'+_0x13306a+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x376123[_0x2e0722(0x109)])return console['log'](_0x2e0722(0x10c)),0x1;}const _0x4dc224=loadProfile(_0x13306a),_0x2fc167=_0x4dc224?.[_0x2e0722(0xf2)]||{};if(_0x4c1324==='site'){const _0x360995=resolveSite(_0x32d222);console['log'](_0x2e0722(0x119)+_0x360995+_0x2e0722(0x11f)),console[_0x2e0722(0xf1)](_0x2e0722(0x10b)),console[_0x2e0722(0xf1)]('\x20\x20'+getConsoleUrl(_0x360995,_0x2e0722(0x14e)));const _0x55e042=await a43_0xf4ac7e({'type':_0x2e0722(0xed),'name':_0x2e0722(0x127),'message':_0x2e0722(0x128),'validate':_0x18d946=>{const _0x17347a=_0x2e0722;if(!_0x18d946||!_0x18d946[_0x17347a(0x146)]())return _0x17347a(0x113);return!![];}});if(!_0x55e042[_0x2e0722(0x127)])return console[_0x2e0722(0xf1)](_0x2e0722(0xeb)),0x1;console[_0x2e0722(0xf1)](_0x2e0722(0xef));try{const _0x1fa835=TDX[_0x2e0722(0x109)]({'site':_0x360995,'apiKey':_0x55e042[_0x2e0722(0x127)][_0x2e0722(0x146)](),'logLevel':_0x33a693[_0x2e0722(0x118)]??LogLevel[_0x2e0722(0x105)]}),_0x36c054=await _0x1fa835['jobs'][_0x2e0722(0xee)]();console['log'](a43_0x327aae['green']('✓')+_0x2e0722(0x143)+_0x36c054[_0x2e0722(0xf7)]+')');const _0x3d63d8=await isKeychainAvailable();_0x3d63d8?(await saveAPIKeyAsync(_0x55e042['apiKey'][_0x2e0722(0x146)](),_0x360995,_0x13306a),console[_0x2e0722(0xf1)](a43_0x327aae[_0x2e0722(0x130)]('✓')+_0x2e0722(0x11c))):console[_0x2e0722(0x141)](a43_0x327aae[_0x2e0722(0xfb)](_0x2e0722(0xfc))),_0x2fc167['site']=_0x360995;}catch(_0x59a821){if(_0x59a821 instanceof HTTPClientError&&_0x59a821[_0x2e0722(0x144)]===0x191)return printAuthError(_0x59a821),0x1;return console[_0x2e0722(0x140)](a43_0x327aae[_0x2e0722(0x11e)](_0x2e0722(0x13a)+(_0x59a821 instanceof Error?_0x59a821[_0x2e0722(0x123)]:String(_0x59a821)))),console['error'](_0x2e0722(0x103)),0x1;}}else _0x2fc167[_0x4c1324]=_0x32d222||undefined;return saveProfileToUserConfig(_0x13306a,_0x2fc167),console[_0x2e0722(0xf1)](a43_0x327aae[_0x2e0722(0x130)]('✓')+'\x20Profile\x20\x27'+_0x13306a+_0x2e0722(0x148)+_0x4c1324+'='+(_0x32d222||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a43_0x40cf8d(0x10d)]=a43_0x40cf8d(0x104);[a43_0x40cf8d(0x111)]='Set\x20session\x20profile';[a43_0x40cf8d(0x122)](_0x32867f){const _0x59e945=a43_0x40cf8d,{args:_0x31e346}=_0x32867f;if(_0x31e346[_0x59e945(0x10a)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a43_0x40cf8d(0x120)](_0x1a154d){const _0x2c674a=a43_0x40cf8d,{args:_0x387fee,options:_0x1ad666}=_0x1a154d,_0x1219cc=_0x387fee[0x0],_0x102e28=_0x1ad666['default'];cleanExpiredSessions();if(!profileExists(_0x1219cc)){console[_0x2c674a(0x140)](a43_0x327aae[_0x2c674a(0x11e)](_0x2c674a(0x132)+_0x1219cc+'\x27\x20does\x20not\x20exist.')),console[_0x2c674a(0xf1)](_0x2c674a(0x13c));const _0x239b66=listProfiles();if(_0x239b66[_0x2c674a(0x10a)]===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x338ded of _0x239b66){console[_0x2c674a(0xf1)](_0x2c674a(0x137)+_0x338ded[_0x2c674a(0x10d)]);}return 0x1;}if(_0x102e28){const _0x47fd4e=a43_0x1b7a94[_0x2c674a(0xf6)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x1219cc),console[_0x2c674a(0xf1)](_0x2c674a(0x12f)+a43_0x327aae['green'](_0x1219cc)),console[_0x2c674a(0xf1)](a43_0x327aae['dim'](_0x2c674a(0x102)+_0x47fd4e)),0x0;}const _0x225712=getSessionID(_0x1ad666[_0x2c674a(0xfe)]);return saveSessionContext({'profile':_0x1219cc},_0x1ad666[_0x2c674a(0xfe)]),console[_0x2c674a(0xf1)]('Session\x20profile\x20set\x20to:\x20'+a43_0x327aae[_0x2c674a(0x130)](_0x1219cc)+'\x20'+a43_0x327aae['dim'](_0x2c674a(0xec)+_0x225712+')')),console['log'](a43_0x327aae[_0x2c674a(0x136)](_0x2c674a(0x149)+_0x1219cc+_0x2c674a(0x154))),0x0;}}
1
+ const a43_0x44b7f7=a43_0x3f4b;(function(_0x1d4c7c,_0x2356c6){const _0x4c7418=a43_0x3f4b,_0x5a3eaa=_0x1d4c7c();while(!![]){try{const _0x52dea=parseInt(_0x4c7418(0xbc))/0x1*(parseInt(_0x4c7418(0x96))/0x2)+parseInt(_0x4c7418(0xc8))/0x3+-parseInt(_0x4c7418(0x89))/0x4*(parseInt(_0x4c7418(0xea))/0x5)+parseInt(_0x4c7418(0x9a))/0x6+-parseInt(_0x4c7418(0xd4))/0x7*(-parseInt(_0x4c7418(0xdd))/0x8)+-parseInt(_0x4c7418(0x9d))/0x9+-parseInt(_0x4c7418(0xd8))/0xa*(-parseInt(_0x4c7418(0xb3))/0xb);if(_0x52dea===_0x2356c6)break;else _0x5a3eaa['push'](_0x5a3eaa['shift']());}catch(_0x2a7d47){_0x5a3eaa['push'](_0x5a3eaa['shift']());}}}(a43_0x5376,0x8149a));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a43_0x42eafa from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a43_0x5376(){const _0x403b81=['Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','(session:\x20','7689240jBWijM','length','Set\x20a\x20profile\x20configuration\x20value','message','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','red','\x0aSaved\x20to:\x20','force','Default\x20profile\x20set\x20to:\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','ERROR','\x27.\x0a\x0aValid\x20keys:\x20','profile:use','jobs','Failed\x20to\x20delete\x20profile:\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','tdx:\x20profile\x20set','trim','email','apiKey','124102rkHOsF','parent_segment','profileName','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','llm_agent','warn','\x20\x20(no\x20profiles\x20found)','Profile\x20name\x20cannot\x20be\x20empty','join','3yAwjig','VALID_KEYS','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','\x0aAvailable\x20profiles:','default','confirm','green','includes','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','oauth','\x0aOperation\x20cancelled','getUserInfo','2517384ctZeLR','database','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Profile\x20\x27','(cleared)','text','create','test','\x20\x20tdx\x20--profile\x20','\x27\x20deleted','Session\x20profile\x20set\x20to:\x20','Delete\x20a\x20profile','42sdXGWQ','config','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','yellow','80MQlILJ','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','API\x20key\x20cannot\x20be\x20empty','\x27\x20requires\x20API\x20key\x20validation.','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','18872oCjfbV','Changing\x20site\x20to\x20\x27','profile','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','error','name','split','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','log','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','password','execute','Removed\x20existing\x20profile\x20\x27','5gAjsoE','✗\x20Validation\x20failed:\x20','Create\x20a\x20new\x20profile','validate','tdx:\x20profile\x20delete','bold','\x20API\x20key\x20saved\x20to\x20system\x20keychain','description','profile:create','skipExistsCheck','\x20\x20-\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20--default\x27\x20to\x20save\x20permanently','\x20Profile\x20\x27','tdx.json','session','3457676EWMbcw','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x27\x20does\x20not\x20exist.','Removal\x20cancelled','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','dim','site','status','Operation\x20cancelled','logLevel','Unknown\x20key\x20\x27','\x27\x20updated:\x20','\x0aSetup\x20cancelled','290426MRudPh','You\x20can\x20find\x20your\x20API\x20key\x20at:','profile:set','tdx:\x20profile\x20create','5214984JDzvZt'];a43_0x5376=function(){return _0x403b81;};return a43_0x5376();}import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a43_0x3f4b(_0xf36fd7,_0x45f71){_0xf36fd7=_0xf36fd7-0x81;const _0x537634=a43_0x5376();let _0x3f4b8e=_0x537634[_0xf36fd7];return _0x3f4b8e;}import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a43_0x2ffee2 from'prompts';import a43_0x1df0a0 from'chalk';function validateProfileName(_0x254dfa,_0x2ffa8d){const _0xe414ac=a43_0x3f4b;if(!_0x254dfa||!_0x254dfa[_0xe414ac(0xb0)]())return _0xe414ac(0xba);const _0x2d5b3e=_0x254dfa[_0xe414ac(0xb0)]();if(!/^[a-zA-Z0-9_-]+$/[_0xe414ac(0xcf)](_0x2d5b3e))return _0xe414ac(0xa7);if(!_0x2ffa8d?.[_0xe414ac(0x82)]&&profileExists(_0x2d5b3e))return _0xe414ac(0xcb)+_0x2d5b3e+_0xe414ac(0xe4)+_0x2d5b3e+_0xe414ac(0xc4);return!![];}async function deleteProfileAndCredentials(_0x138f18){removeProfileFromUserConfig(_0x138f18);const _0x4e2488=await isKeychainAvailable();_0x4e2488&&await Promise['all']([deleteKeychainAPIKey(_0x138f18),deleteOAuthTokens(_0x138f18)]);}export class ProfileCreateCommand extends BaseCommand{[a43_0x44b7f7(0xe2)]=a43_0x44b7f7(0x81);[a43_0x44b7f7(0xf1)]=a43_0x44b7f7(0xec);async[a43_0x44b7f7(0xe8)](_0x26ffab){const _0x1df0ce=a43_0x44b7f7,{options:_0x509c55,args:_0x359933}=_0x26ffab,_0x473981=!!_0x509c55[_0x1df0ce(0xa5)];console['log'](a43_0x1df0a0['bold'](_0x1df0ce(0x99)));let _0x2b095c;if(_0x359933[_0x1df0ce(0x9e)]>0x0&&_0x359933[0x0]){const _0x5e7092=_0x359933[0x0][_0x1df0ce(0xb0)]();_0x473981&&profileExists(_0x5e7092)&&(await deleteProfileAndCredentials(_0x5e7092),console[_0x1df0ce(0xe5)](_0x1df0ce(0xe9)+_0x5e7092+'\x27'));const _0x1304df=validateProfileName(_0x5e7092);if(_0x1304df!==!![])return console[_0x1df0ce(0xe1)](a43_0x1df0a0[_0x1df0ce(0xa3)](_0x1304df)),0x1;_0x2b095c=_0x5e7092;}else{const _0x59a063=await a43_0x2ffee2({'type':_0x1df0ce(0xcd),'name':_0x1df0ce(0xb5),'message':'Enter\x20profile\x20name:','validate':_0x111b6c=>validateProfileName(_0x111b6c,{'skipExistsCheck':_0x473981})});if(!_0x59a063[_0x1df0ce(0xb5)])return console[_0x1df0ce(0xe5)](_0x1df0ce(0x95)),0x1;_0x2b095c=_0x59a063[_0x1df0ce(0xb5)][_0x1df0ce(0xb0)](),_0x473981&&profileExists(_0x2b095c)&&(await deleteProfileAndCredentials(_0x2b095c),console[_0x1df0ce(0xe5)]('Removed\x20existing\x20profile\x20\x27'+_0x2b095c+'\x27'));}const _0x2bd6ac=await a43_0x2ffee2({'type':_0x1df0ce(0xcd),'name':_0x1df0ce(0xf1),'message':'Enter\x20description\x20(optional):'}),_0xa51c06=_0x2bd6ac[_0x1df0ce(0xf1)]?.[_0x1df0ce(0xb0)]()||undefined,_0x4a92d9=_0x509c55[_0x1df0ce(0x8f)]||'us01',_0x888d89=await promptSiteSelection(_0x4a92d9,_0x2b095c,'Setup\x20cancelled');if(!_0x888d89)return 0x1;const _0x4069b3=resolveSite(_0x888d89),_0x252b1d=await promptAuthMethod();if(!_0x252b1d)return console[_0x1df0ce(0xe5)](_0x1df0ce(0x95)),0x1;if(_0x252b1d===_0x1df0ce(0xc5)){if(_0xa51c06){const _0x6c5a92={'site':_0x4069b3,'description':_0xa51c06};saveProfileToUserConfig(_0x2b095c,_0x6c5a92);}const {accountName:_0x4e0509}=_0x509c55;return await runOAuthLoginFlow(_0x4069b3,_0x2b095c,_0x509c55['logLevel']??LogLevel[_0x1df0ce(0xa9)],{'accountName':_0x4e0509}),0x0;}console[_0x1df0ce(0xe5)](_0x1df0ce(0xa2)+_0x4069b3),console['log'](_0x1df0ce(0x97)),console[_0x1df0ce(0xe5)]('\x20\x20'+getConsoleUrl(_0x4069b3,'/app/mp/ak'));const _0x3a63a7=await a43_0x2ffee2({'type':_0x1df0ce(0xe7),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0xb2d9bc=>{const _0x3e9c9d=_0x1df0ce;if(!_0xb2d9bc||!_0xb2d9bc[_0x3e9c9d(0xb0)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x3a63a7[_0x1df0ce(0xb2)])return console[_0x1df0ce(0xe5)](_0x1df0ce(0x95)),0x1;const _0x4ce515=_0x3a63a7[_0x1df0ce(0xb2)];console[_0x1df0ce(0xe5)]('Validating\x20API\x20key...');try{const _0x137556=TDX['create']({'site':_0x4069b3,'apiKey':_0x4ce515[_0x1df0ce(0xb0)](),'logLevel':_0x509c55[_0x1df0ce(0x92)]??LogLevel[_0x1df0ce(0xa9)]}),_0x4f5017=await _0x137556[_0x1df0ce(0xac)]['getUserInfo']();console['log'](a43_0x1df0a0['green']('✓')+_0x1df0ce(0x84)+_0x4f5017['email']+')');const _0x4bf9a1=await isKeychainAvailable();_0x4bf9a1?(await saveAPIKeyAsync(_0x4ce515[_0x1df0ce(0xb0)](),_0x4069b3,_0x2b095c),console[_0x1df0ce(0xe5)](a43_0x1df0a0[_0x1df0ce(0xc2)]('✓')+_0x1df0ce(0xca)+_0x2b095c+')')):(console['warn'](a43_0x1df0a0['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x1df0ce(0xb8)](a43_0x1df0a0[_0x1df0ce(0xd7)](_0x1df0ce(0xe6))));const _0xd5a354={'site':_0x4069b3,..._0xa51c06&&{'description':_0xa51c06}};return saveProfileToUserConfig(_0x2b095c,_0xd5a354),console[_0x1df0ce(0xe5)](a43_0x1df0a0[_0x1df0ce(0xc2)]('✓')+_0x1df0ce(0x86)+_0x2b095c+'\x27\x20created'),console[_0x1df0ce(0xe5)](),console[_0x1df0ce(0xe5)](_0x1df0ce(0xd9)),console['log']('\x20\x20tdx\x20--profile\x20'+_0x2b095c+_0x1df0ce(0x8d)),console[_0x1df0ce(0xe5)](_0x1df0ce(0xd0)+_0x2b095c+_0x1df0ce(0xa8)),0x0;}catch(_0x352591){if(_0x352591 instanceof HTTPClientError&&_0x352591['status']===0x191)return printAuthError(_0x352591),0x1;return console[_0x1df0ce(0xe1)](a43_0x1df0a0['red'](_0x1df0ce(0xeb)+(_0x352591 instanceof Error?_0x352591[_0x1df0ce(0xa0)]:String(_0x352591)))),console[_0x1df0ce(0xe1)](_0x1df0ce(0xa1)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a43_0x44b7f7(0xe2)]='profile:delete';[a43_0x44b7f7(0xf1)]=a43_0x44b7f7(0xd3);[a43_0x44b7f7(0xed)](_0x12b454){const _0x56b870=a43_0x44b7f7,{args:_0x29b82c}=_0x12b454;if(_0x29b82c[_0x56b870(0x9e)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async['execute'](_0x3a0584){const _0x4829ab=a43_0x44b7f7,{args:_0x3df1b3}=_0x3a0584,_0x35506b=_0x3df1b3[0x0];console[_0x4829ab(0xe5)](a43_0x1df0a0[_0x4829ab(0xef)](_0x4829ab(0xee)));if(!profileExists(_0x35506b)){console[_0x4829ab(0xe1)](a43_0x1df0a0[_0x4829ab(0xa3)](_0x4829ab(0xcb)+_0x35506b+_0x4829ab(0x8b))),console['log'](_0x4829ab(0xbf));const _0x18696e=listProfiles();if(_0x18696e[_0x4829ab(0x9e)]===0x0)console['log'](_0x4829ab(0xb9));else for(const _0xe175d9 of _0x18696e){console[_0x4829ab(0xe5)]('\x20\x20-\x20'+_0xe175d9['name']);}return 0x1;}const _0x417921=await a43_0x2ffee2({'type':_0x4829ab(0xc1),'name':_0x4829ab(0xc1),'message':_0x4829ab(0xd6)+_0x35506b+'\x27?','initial':![]});if(!_0x417921[_0x4829ab(0xc1)])return console[_0x4829ab(0xe5)](_0x4829ab(0x8c)),0x0;try{await deleteProfileAndCredentials(_0x35506b),console[_0x4829ab(0xe5)](a43_0x1df0a0['green']('✓')+_0x4829ab(0x86)+_0x35506b+_0x4829ab(0xd1));}catch(_0x956789){return console[_0x4829ab(0xe1)](a43_0x1df0a0[_0x4829ab(0xa3)](_0x4829ab(0xad)+(_0x956789 instanceof Error?_0x956789[_0x4829ab(0xa0)]:String(_0x956789)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a43_0x44b7f7(0xe2)]=a43_0x44b7f7(0x98);[a43_0x44b7f7(0xf1)]=a43_0x44b7f7(0x9f);static ['VALID_KEYS']=['site',a43_0x44b7f7(0xc9),a43_0x44b7f7(0xb4),'llm_project',a43_0x44b7f7(0xb7),a43_0x44b7f7(0xf1)];[a43_0x44b7f7(0xed)](_0x132742){const _0x29eb60=a43_0x44b7f7,{args:_0x5b5f00,options:_0x3650f3}=_0x132742,_0x48a07b=_0x3650f3['profile']||getActiveProfile();if(!_0x48a07b)return _0x29eb60(0xbe);if(_0x5b5f00[_0x29eb60(0x9e)]===0x0)return _0x29eb60(0xae)+ProfileSetCommand[_0x29eb60(0xbd)]['join'](',\x20');const _0x201fba=_0x5b5f00[0x0];if(!_0x201fba[_0x29eb60(0xc3)]('='))return _0x29eb60(0xdc)+ProfileSetCommand[_0x29eb60(0xbd)]['join'](',\x20');const [_0x2c2229]=_0x201fba[_0x29eb60(0xe3)]('=',0x2);if(!ProfileSetCommand[_0x29eb60(0xbd)]['includes'](_0x2c2229))return _0x29eb60(0x93)+_0x2c2229+_0x29eb60(0xaa)+ProfileSetCommand[_0x29eb60(0xbd)]['join'](',\x20');return undefined;}async['execute'](_0x1b3da3){const _0x57e50f=a43_0x44b7f7,{args:_0x237bf8,options:_0x3c84f7}=_0x1b3da3,_0x30a928=_0x3c84f7[_0x57e50f(0xdf)]||getActiveProfile(),[_0x5d9417,..._0x2adf84]=_0x237bf8[0x0][_0x57e50f(0xe3)]('='),_0x28a33c=_0x2adf84[_0x57e50f(0xbb)]('=');console[_0x57e50f(0xe5)](a43_0x1df0a0[_0x57e50f(0xef)](_0x57e50f(0xaf)));if(!profileExists(_0x30a928)){const _0x2edfbe=await a43_0x2ffee2({'type':_0x57e50f(0xc1),'name':_0x57e50f(0xce),'message':'Profile\x20\x27'+_0x30a928+_0x57e50f(0x8a),'initial':!![]});if(!_0x2edfbe[_0x57e50f(0xce)])return console[_0x57e50f(0xe5)](_0x57e50f(0x91)),0x1;}const _0x2fa94e=loadProfile(_0x30a928),_0x25e800=_0x2fa94e?.[_0x57e50f(0xd5)]||{};if(_0x5d9417===_0x57e50f(0x8f)){const _0x3b52b1=resolveSite(_0x28a33c);console[_0x57e50f(0xe5)](_0x57e50f(0xde)+_0x3b52b1+_0x57e50f(0xdb)),console[_0x57e50f(0xe5)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x57e50f(0xe5)]('\x20\x20'+getConsoleUrl(_0x3b52b1,'/app/mp/ak'));const _0x24d47b=await a43_0x2ffee2({'type':_0x57e50f(0xe7),'name':_0x57e50f(0xb2),'message':_0x57e50f(0x9b),'validate':_0x478db4=>{const _0x523625=_0x57e50f;if(!_0x478db4||!_0x478db4[_0x523625(0xb0)]())return _0x523625(0xda);return!![];}});if(!_0x24d47b['apiKey'])return console[_0x57e50f(0xe5)](_0x57e50f(0xc6)),0x1;console[_0x57e50f(0xe5)]('Validating\x20API\x20key...');try{const _0x16d884=TDX[_0x57e50f(0xce)]({'site':_0x3b52b1,'apiKey':_0x24d47b[_0x57e50f(0xb2)][_0x57e50f(0xb0)](),'logLevel':_0x3c84f7[_0x57e50f(0x92)]??LogLevel[_0x57e50f(0xa9)]}),_0x490f27=await _0x16d884['jobs'][_0x57e50f(0xc7)]();console[_0x57e50f(0xe5)](a43_0x1df0a0[_0x57e50f(0xc2)]('✓')+_0x57e50f(0x84)+_0x490f27[_0x57e50f(0xb1)]+')');const _0x213f41=await isKeychainAvailable();_0x213f41?(await saveAPIKeyAsync(_0x24d47b[_0x57e50f(0xb2)][_0x57e50f(0xb0)](),_0x3b52b1,_0x30a928),console[_0x57e50f(0xe5)](a43_0x1df0a0[_0x57e50f(0xc2)]('✓')+_0x57e50f(0xf0))):console[_0x57e50f(0xb8)](a43_0x1df0a0[_0x57e50f(0xd7)](_0x57e50f(0xb6))),_0x25e800['site']=_0x3b52b1;}catch(_0x3a9f9f){if(_0x3a9f9f instanceof HTTPClientError&&_0x3a9f9f[_0x57e50f(0x90)]===0x191)return printAuthError(_0x3a9f9f),0x1;return console['error'](a43_0x1df0a0[_0x57e50f(0xa3)](_0x57e50f(0xeb)+(_0x3a9f9f instanceof Error?_0x3a9f9f['message']:String(_0x3a9f9f)))),console[_0x57e50f(0xe1)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x25e800[_0x5d9417]=_0x28a33c||undefined;return saveProfileToUserConfig(_0x30a928,_0x25e800),console[_0x57e50f(0xe5)](a43_0x1df0a0[_0x57e50f(0xc2)]('✓')+'\x20Profile\x20\x27'+_0x30a928+_0x57e50f(0x94)+_0x5d9417+'='+(_0x28a33c||_0x57e50f(0xcc))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a43_0x44b7f7(0xe2)]=a43_0x44b7f7(0xab);[a43_0x44b7f7(0xf1)]='Set\x20session\x20profile';[a43_0x44b7f7(0xed)](_0x2e228a){const _0x5da81a=a43_0x44b7f7,{args:_0x3b4b16}=_0x2e228a;if(_0x3b4b16[_0x5da81a(0x9e)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a43_0x44b7f7(0xe8)](_0x4e7a0c){const _0x40b421=a43_0x44b7f7,{args:_0x307235,options:_0x1bb965}=_0x4e7a0c,_0x1ad3d1=_0x307235[0x0],_0x46de7b=_0x1bb965[_0x40b421(0xc0)];cleanExpiredSessions();if(!profileExists(_0x1ad3d1)){console[_0x40b421(0xe1)](a43_0x1df0a0['red'](_0x40b421(0xcb)+_0x1ad3d1+_0x40b421(0x8b))),console['log']('\x0aAvailable\x20profiles:');const _0x23a8e9=listProfiles();if(_0x23a8e9['length']===0x0)console[_0x40b421(0xe5)](_0x40b421(0xb9));else for(const _0x45944a of _0x23a8e9){console[_0x40b421(0xe5)](_0x40b421(0x83)+_0x45944a[_0x40b421(0xe2)]);}return 0x1;}if(_0x46de7b){const _0x25c61e=a43_0x42eafa[_0x40b421(0xbb)](getConfigDir(),_0x40b421(0x87));return saveActiveProfileToUserConfig(_0x1ad3d1),console['log'](_0x40b421(0xa6)+a43_0x1df0a0[_0x40b421(0xc2)](_0x1ad3d1)),console[_0x40b421(0xe5)](a43_0x1df0a0[_0x40b421(0x8e)](_0x40b421(0xa4)+_0x25c61e)),0x0;}const _0x4ba3c9=getSessionID(_0x1bb965[_0x40b421(0x88)]);return saveSessionContext({'profile':_0x1ad3d1},_0x1bb965[_0x40b421(0x88)]),console[_0x40b421(0xe5)](_0x40b421(0xd2)+a43_0x1df0a0[_0x40b421(0xc2)](_0x1ad3d1)+'\x20'+a43_0x1df0a0[_0x40b421(0x8e)](_0x40b421(0x9c)+_0x4ba3c9+')')),console[_0x40b421(0xe5)](a43_0x1df0a0[_0x40b421(0x8e)](_0x40b421(0xe0)+_0x1ad3d1+_0x40b421(0x85))),0x0;}}
@@ -1 +1 @@
1
- const a44_0xa11ee1=a44_0x58a8;(function(_0x52b3b7,_0x1dac1e){const _0x42977f=a44_0x58a8,_0x5e584f=_0x52b3b7();while(!![]){try{const _0x265e48=-parseInt(_0x42977f(0x11f))/0x1+-parseInt(_0x42977f(0x130))/0x2*(parseInt(_0x42977f(0x124))/0x3)+parseInt(_0x42977f(0x12c))/0x4*(parseInt(_0x42977f(0x121))/0x5)+parseInt(_0x42977f(0x134))/0x6+-parseInt(_0x42977f(0x12d))/0x7*(parseInt(_0x42977f(0x12e))/0x8)+-parseInt(_0x42977f(0x136))/0x9*(parseInt(_0x42977f(0x120))/0xa)+parseInt(_0x42977f(0x131))/0xb;if(_0x265e48===_0x1dac1e)break;else _0x5e584f['push'](_0x5e584f['shift']());}catch(_0x1577a0){_0x5e584f['push'](_0x5e584f['shift']());}}}(a44_0x216e,0x76190));import{BaseCommand}from'./command.js';function a44_0x216e(){const _0x17a709=['\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','112573IiDZtS','1148900itibZV','3697695TSpnIT','green','length','84KaZMJO','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','List\x20all\x20available\x20profiles','config','map','log','scope','👤\x20','4VbQcAz','5210107Gdvrax','8JGWupc','dim','53624GLbPnk','10803122QqPBND','profiles','name','2907522kRRtpE','site','9wuvTlG','error','execute','description','Error:\x20'];a44_0x216e=function(){return _0x17a709;};return a44_0x216e();}import{listProfiles,getActiveProfile,getProfileParams,isLegacyStudioProfile}from'../core/profile.js';function a44_0x58a8(_0x228cc8,_0x324ad7){_0x228cc8=_0x228cc8-0x11f;const _0x216e75=a44_0x216e();let _0x58a86a=_0x216e75[_0x228cc8];return _0x58a86a;}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a44_0x3841c9 from'chalk';export class ProfilesCommand extends BaseCommand{[a44_0xa11ee1(0x133)]=a44_0xa11ee1(0x132);[a44_0xa11ee1(0x139)]=a44_0xa11ee1(0x126);async[a44_0xa11ee1(0x138)](_0x231885){const _0xe729aa=a44_0xa11ee1,{options:_0x1e943a}=_0x231885;try{const _0x55aa2a=listProfiles()['filter'](_0x74bc6=>!isLegacyStudioProfile(_0x74bc6[_0xe729aa(0x133)])),_0x31c93e=getActiveProfile();if(_0x55aa2a[_0xe729aa(0x123)]===0x0)return console['log'](_0xe729aa(0x125)),console['log'](_0xe729aa(0x13b)),console[_0xe729aa(0x129)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x5d3702=_0x55aa2a[_0xe729aa(0x128)](_0x4e49ca=>{const _0x2b65ef=_0xe729aa,_0x2f08d8=_0x4e49ca[_0x2b65ef(0x133)]===_0x31c93e,_0x213b27=getProfileParams(_0x4e49ca[_0x2b65ef(0x127)]);return{'name':_0x4e49ca[_0x2b65ef(0x133)],'active':_0x2f08d8,'scope':_0x4e49ca[_0x2b65ef(0x12a)],'description':_0x4e49ca[_0x2b65ef(0x127)]['description']||'','params':_0x213b27};});if(isStructuredFormat(_0x1e943a))await handleSDKOutput(_0x5d3702,_0x1e943a);else for(const _0x780e97 of _0x55aa2a){const _0xfb0d25=_0x780e97['name']===_0x31c93e?a44_0x3841c9[_0xe729aa(0x122)]('\x20✓'):'',_0x32e123=_0x780e97['config'][_0xe729aa(0x135)]?a44_0x3841c9[_0xe729aa(0x12f)]('\x20'+_0x780e97[_0xe729aa(0x127)]['site']):'',_0xf2b56=_0x780e97['config'][_0xe729aa(0x139)]?a44_0x3841c9[_0xe729aa(0x12f)]('\x20\x20'+_0x780e97[_0xe729aa(0x127)][_0xe729aa(0x139)]):'';console[_0xe729aa(0x129)](_0xe729aa(0x12b)+_0x780e97[_0xe729aa(0x133)]+_0xfb0d25+_0x32e123+_0xf2b56);}return 0x0;}catch(_0x28da96){return _0x28da96 instanceof Error&&console[_0xe729aa(0x137)](_0xe729aa(0x13a)+_0x28da96['message']),0x1;}}}
1
+ const a44_0x3b53d6=a44_0x1fe9;(function(_0x46a79c,_0x5af3b1){const _0x3c68de=a44_0x1fe9,_0x5526f3=_0x46a79c();while(!![]){try{const _0x1d444f=parseInt(_0x3c68de(0xca))/0x1*(-parseInt(_0x3c68de(0xd2))/0x2)+parseInt(_0x3c68de(0xc3))/0x3*(parseInt(_0x3c68de(0xc6))/0x4)+parseInt(_0x3c68de(0xd7))/0x5*(parseInt(_0x3c68de(0xdf))/0x6)+-parseInt(_0x3c68de(0xd3))/0x7+parseInt(_0x3c68de(0xd9))/0x8*(parseInt(_0x3c68de(0xd5))/0x9)+parseInt(_0x3c68de(0xda))/0xa*(parseInt(_0x3c68de(0xc7))/0xb)+-parseInt(_0x3c68de(0xd1))/0xc;if(_0x1d444f===_0x5af3b1)break;else _0x5526f3['push'](_0x5526f3['shift']());}catch(_0x319d4b){_0x5526f3['push'](_0x5526f3['shift']());}}}(a44_0x51b9,0x7244d));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams,isLegacyStudioProfile}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a44_0x51b9(){const _0xdf21c6=['log','25686GWefCu','name','18FODzHL','List\x20all\x20available\x20profiles','description','259412ECwLbJ','407QJegVM','config','scope','5uYkiIR','Error:\x20','\x20\x20Global:\x20~/.config/tdx/tdx.json','message','error','green','dim','12567816VAZwnY','23118mIkzjS','2806111KPDtgt','execute','9GLPRaM','site','90PgkhCG','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','5838256BwYiBm','210290ZyVEIb','👤\x20','profiles','length'];a44_0x51b9=function(){return _0xdf21c6;};return a44_0x51b9();}function a44_0x1fe9(_0x24aa81,_0x3617b5){_0x24aa81=_0x24aa81-0xc2;const _0x51b92d=a44_0x51b9();let _0x1fe9a8=_0x51b92d[_0x24aa81];return _0x1fe9a8;}import a44_0x44d373 from'chalk';export class ProfilesCommand extends BaseCommand{['name']=a44_0x3b53d6(0xdc);[a44_0x3b53d6(0xc5)]=a44_0x3b53d6(0xc4);async[a44_0x3b53d6(0xd4)](_0x2a7433){const _0x1bfd8d=a44_0x3b53d6,{options:_0x29759b}=_0x2a7433;try{const _0x29f948=listProfiles()['filter'](_0x903649=>!isLegacyStudioProfile(_0x903649[_0x1bfd8d(0xc2)])),_0x4c7fbc=getActiveProfile();if(_0x29f948[_0x1bfd8d(0xdd)]===0x0)return console['log'](_0x1bfd8d(0xd8)),console[_0x1bfd8d(0xde)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x1bfd8d(0xde)](_0x1bfd8d(0xcc)),0x0;const _0x4c2360=_0x29f948['map'](_0x57c87a=>{const _0x855da0=_0x1bfd8d,_0x3b10ba=_0x57c87a[_0x855da0(0xc2)]===_0x4c7fbc,_0x4baa40=getProfileParams(_0x57c87a['config']);return{'name':_0x57c87a[_0x855da0(0xc2)],'active':_0x3b10ba,'scope':_0x57c87a[_0x855da0(0xc9)],'description':_0x57c87a[_0x855da0(0xc8)][_0x855da0(0xc5)]||'','params':_0x4baa40};});if(isStructuredFormat(_0x29759b))await handleSDKOutput(_0x4c2360,_0x29759b);else for(const _0x25e47f of _0x29f948){const _0xe0af66=_0x25e47f[_0x1bfd8d(0xc2)]===_0x4c7fbc?a44_0x44d373[_0x1bfd8d(0xcf)]('\x20✓'):'',_0x2c500e=_0x25e47f[_0x1bfd8d(0xc8)][_0x1bfd8d(0xd6)]?a44_0x44d373[_0x1bfd8d(0xd0)]('\x20'+_0x25e47f[_0x1bfd8d(0xc8)][_0x1bfd8d(0xd6)]):'',_0x229e8d=_0x25e47f[_0x1bfd8d(0xc8)][_0x1bfd8d(0xc5)]?a44_0x44d373['dim']('\x20\x20'+_0x25e47f[_0x1bfd8d(0xc8)]['description']):'';console[_0x1bfd8d(0xde)](_0x1bfd8d(0xdb)+_0x25e47f[_0x1bfd8d(0xc2)]+_0xe0af66+_0x2c500e+_0x229e8d);}return 0x0;}catch(_0x9e5fa2){return _0x9e5fa2 instanceof Error&&console[_0x1bfd8d(0xce)](_0x1bfd8d(0xcb)+_0x9e5fa2[_0x1bfd8d(0xcd)]),0x1;}}}
@@ -1 +1 @@
1
- const a45_0x1e4405=a45_0x2666;(function(_0x12807f,_0x5a6cf3){const _0x34d0cd=a45_0x2666,_0x41faa6=_0x12807f();while(!![]){try{const _0x510ab5=parseInt(_0x34d0cd(0x140))/0x1*(parseInt(_0x34d0cd(0x12e))/0x2)+-parseInt(_0x34d0cd(0x122))/0x3*(parseInt(_0x34d0cd(0x150))/0x4)+-parseInt(_0x34d0cd(0x129))/0x5*(-parseInt(_0x34d0cd(0x12d))/0x6)+parseInt(_0x34d0cd(0x14a))/0x7*(parseInt(_0x34d0cd(0x13e))/0x8)+-parseInt(_0x34d0cd(0x148))/0x9*(parseInt(_0x34d0cd(0x125))/0xa)+parseInt(_0x34d0cd(0x14c))/0xb*(-parseInt(_0x34d0cd(0x12f))/0xc)+parseInt(_0x34d0cd(0x13d))/0xd;if(_0x510ab5===_0x5a6cf3)break;else _0x41faa6['push'](_0x41faa6['shift']());}catch(_0x365e0f){_0x41faa6['push'](_0x41faa6['shift']());}}}(a45_0x4cd1,0x1f422));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';function a45_0x2666(_0x17ac2c,_0x93ed){_0x17ac2c=_0x17ac2c-0x121;const _0x4cd12e=a45_0x4cd1();let _0x266601=_0x4cd12e[_0x17ac2c];return _0x266601;}import{writeFileSync}from'fs';function a45_0x4cd1(){const _0x146459=['Executing\x20statement\x20','Query\x20completed:\x20Processed\x20','jobId','file','output','database','No\x20SQL\x20provided','state','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','verbose','in\x20','\x20[Job\x20ID:\x20','6430320ndHjmJ','4728fOXLFA','data','12755joJpuS','query','totalSplits','description','options','\x0aAll\x20results\x20saved\x20to\x20','setExtra','error','1377UDINEu','SQL:\x20','168tSLvoh','originalMessage','869xTDjsB','Statement\x20','message','Site:\x20','4GGMmmc','length','Schema:\x20','processedRows','join','site','\x20rows\x20','Catalog:\x20','stats','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','659787jLBsAf','\x20-\x20','name','3980XlHXEA','Executing\x20query\x20[','setPhase','\x20splits','89455krXdTG','catalog','execute','...','18rrpVAk','14PjIems','36900nToKWp','elapsedTimeMillis'];a45_0x4cd1=function(){return _0x146459;};return a45_0x4cd1();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a45_0x1e4405(0x124)]=a45_0x1e4405(0x141);[a45_0x1e4405(0x143)]='Run\x20Trino\x20queries\x20(streaming)';async['execute'](_0x11d6c5){const _0x256f09=a45_0x1e4405,{options:_0x405217,args:_0x4b1450,tdx:_0x260297}=_0x11d6c5,_0x2b9101={..._0x405217,'limitStructuredFormats':!![]},_0x2dc644=_0x4b1450[0x0],_0x1168a2=_0x405217[_0x256f09(0x134)];let _0xcdcd49;try{if(_0x1168a2)_0xcdcd49=readSqlStatementsFromFile(_0x1168a2);else{if(_0x2dc644==='-')_0xcdcd49=await readSqlStatementsFromStdin();else{if(_0x2dc644&&isSqlFilePath(_0x2dc644))_0xcdcd49=readSqlStatementsFromFile(_0x2dc644);else{if(_0x2dc644)_0xcdcd49=splitSqlStatements(_0x2dc644);else throw new Error(_0x256f09(0x137));}}}}catch(_0x4461dd){return console[_0x256f09(0x147)]('Error:\x20'+_0x4461dd[_0x256f09(0x14e)]),0x1;}const _0x70918e=_0x405217[_0x256f09(0x136)]||'information_schema',_0x463437=_0x405217[_0x256f09(0x12a)];try{const _0x2137ee=[],_0x3764aa=!!_0x405217[_0x256f09(0x135)];for(let _0x25c5ec=0x0;_0x25c5ec<_0xcdcd49[_0x256f09(0x151)];_0x25c5ec++){const _0x4ae955=_0xcdcd49[_0x25c5ec],_0x246288=_0x25c5ec+0x1,_0x37ac5c=_0xcdcd49['length'],_0x103324=_0x37ac5c>0x1;_0x405217[_0x256f09(0x13a)]&&(console[_0x256f09(0x147)]('\x0a'+(_0x103324?_0x256f09(0x14d)+_0x246288+'/'+_0x37ac5c+':':'')),console[_0x256f09(0x147)](_0x256f09(0x14f)+_0x405217[_0x256f09(0x155)]),console[_0x256f09(0x147)](_0x256f09(0x157)+(_0x463437||'td')),console[_0x256f09(0x147)](_0x256f09(0x152)+_0x70918e),console['error'](_0x256f09(0x149)+_0x4ae955));const _0x18f4ca=_0x103324?_0x256f09(0x131)+_0x246288+'/'+_0x37ac5c+_0x256f09(0x12c):'Executing\x20query...';try{const _0x46c765=await withProgressSpinner(_0x18f4ca,async _0x1269de=>{const _0x43b7b1=_0x256f09,_0x539e91=await _0x260297[_0x43b7b1(0x141)][_0x43b7b1(0x12b)](_0x4ae955,{'catalog':_0x463437,'schema':_0x70918e,'onJobId':_0x3f5dd9=>{_0x1269de['setJobId'](_0x3f5dd9);},'onProgress':_0x4f33eb=>{const _0x26da1d=_0x43b7b1;_0x1269de[_0x26da1d(0x127)](_0x26da1d(0x126)+_0x4f33eb[_0x26da1d(0x138)]+']'),_0x1269de[_0x26da1d(0x146)](formatRows(_0x4f33eb['processedRows'])+_0x26da1d(0x156)+_0x4f33eb['completedSplits']+'/'+_0x4f33eb[_0x26da1d(0x142)]+_0x26da1d(0x128));}});return _0x539e91;},{'verbose':_0x405217[_0x256f09(0x13a)]}),_0xe65e43=_0x46c765[_0x256f09(0x13f)],_0x2381b5=_0xe65e43[_0x256f09(0x133)]?_0x256f09(0x13c)+_0xe65e43['jobId']+']':'',_0x545afe=_0x103324?_0x256f09(0x14d)+_0x246288+'/'+_0x37ac5c+_0x256f09(0x123):'';console['error']('✔\x20'+_0x545afe+_0x256f09(0x132)+formatRows(_0xe65e43[_0x256f09(0x158)][_0x256f09(0x153)])+_0x256f09(0x156)+(_0x256f09(0x13b)+formatElapsed(_0xe65e43[_0x256f09(0x158)][_0x256f09(0x130)])+_0x2381b5));if(_0x103324&&_0x3764aa){const _0x41d54d=resolveOutputOptions(_0x2b9101),_0x24c779=await formatQueryOutput(_0xe65e43,_0x41d54d);_0x2137ee['push'](_0x24c779);}else await handleQueryOutput(_0xe65e43,_0x2b9101);}catch(_0x838d5e){const _0x2fb8f5=_0x103324?'Statement\x20'+_0x246288+'/'+_0x37ac5c+':\x0a':'',_0x2b8c00=_0x838d5e instanceof SDKError?_0x838d5e[_0x256f09(0x14b)]:_0x838d5e[_0x256f09(0x14e)];return console['error'](''+_0x2fb8f5+_0x2b8c00),0x1;}}if(_0xcdcd49[_0x256f09(0x151)]>0x1&&_0x3764aa&&_0x2137ee[_0x256f09(0x151)]>0x0){const _0x1cb743=_0x2137ee[_0x256f09(0x154)]('\x0a');writeFileSync(_0x405217[_0x256f09(0x135)],_0x1cb743),console[_0x256f09(0x147)](_0x256f09(0x145)+_0x405217[_0x256f09(0x135)]);}return 0x0;}catch(_0x1df0b7){throw _0x1df0b7;}}['validate'](_0x448c1b){const _0x4b5814=a45_0x1e4405,_0x220738=_0x448c1b['args'][0x0],_0x53eea4=_0x448c1b[_0x4b5814(0x144)]['file'];if(!_0x220738&&!_0x53eea4)return _0x4b5814(0x139);if(_0x220738&&_0x53eea4)return _0x4b5814(0x121);return undefined;}}
1
+ const a45_0x57909f=a45_0x5634;(function(_0x2ef88d,_0x198168){const _0x511897=a45_0x5634,_0x1061a7=_0x2ef88d();while(!![]){try{const _0x4a784a=-parseInt(_0x511897(0x89))/0x1+parseInt(_0x511897(0xa3))/0x2+-parseInt(_0x511897(0x9a))/0x3+parseInt(_0x511897(0xa7))/0x4+-parseInt(_0x511897(0x90))/0x5*(parseInt(_0x511897(0x7f))/0x6)+-parseInt(_0x511897(0xa0))/0x7*(parseInt(_0x511897(0x85))/0x8)+parseInt(_0x511897(0x92))/0x9;if(_0x4a784a===_0x198168)break;else _0x1061a7['push'](_0x1061a7['shift']());}catch(_0x27b99b){_0x1061a7['push'](_0x1061a7['shift']());}}}(a45_0x871b,0xcf4db));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a45_0x871b(){const _0xd4805a=['5468216cSbeSf','originalMessage','\x0aAll\x20results\x20saved\x20to\x20','\x20rows\x20','\x20splits','execute','completedSplits','validate','in\x20','args','2730138ztfYmP','jobId','state','setJobId','stats','processedRows','8xkWmFf','elapsedTimeMillis','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','error','138537AfCbIk','\x20[Job\x20ID:\x20','\x20-\x20','description','Executing\x20statement\x20','Query\x20completed:\x20Processed\x20','data','5iXDofC','output','1924731ViBMzU','setPhase','site','catalog','Site:\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Schema:\x20','Catalog:\x20','1275051dTpTHi','query','Statement\x20','message','verbose','file','8774626WwvqHg','setExtra','SQL:\x20','3080594GeupnB','length','push','join'];a45_0x871b=function(){return _0xd4805a;};return a45_0x871b();}function a45_0x5634(_0x366ca0,_0x58237d){_0x366ca0=_0x366ca0-0x7d;const _0x871b3f=a45_0x871b();let _0x563452=_0x871b3f[_0x366ca0];return _0x563452;}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']='query';[a45_0x57909f(0x8c)]='Run\x20Trino\x20queries\x20(streaming)';async[a45_0x57909f(0xac)](_0x24b645){const _0x5aaf7d=a45_0x57909f,{options:_0x85e241,args:_0x181897,tdx:_0x4e52b}=_0x24b645,_0x505f86={..._0x85e241,'limitStructuredFormats':!![]},_0x5c5df0=_0x181897[0x0],_0x627095=_0x85e241[_0x5aaf7d(0x9f)];let _0x38d160;try{if(_0x627095)_0x38d160=readSqlStatementsFromFile(_0x627095);else{if(_0x5c5df0==='-')_0x38d160=await readSqlStatementsFromStdin();else{if(_0x5c5df0&&isSqlFilePath(_0x5c5df0))_0x38d160=readSqlStatementsFromFile(_0x5c5df0);else{if(_0x5c5df0)_0x38d160=splitSqlStatements(_0x5c5df0);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x533f0f){return console['error']('Error:\x20'+_0x533f0f[_0x5aaf7d(0x9d)]),0x1;}const _0x287b54=_0x85e241['database']||'information_schema',_0x327159=_0x85e241[_0x5aaf7d(0x95)];try{const _0x24b56d=[],_0x167af0=!!_0x85e241[_0x5aaf7d(0x91)];for(let _0x2d6d6b=0x0;_0x2d6d6b<_0x38d160[_0x5aaf7d(0xa4)];_0x2d6d6b++){const _0x47929a=_0x38d160[_0x2d6d6b],_0x529635=_0x2d6d6b+0x1,_0x4d3234=_0x38d160['length'],_0x487b63=_0x4d3234>0x1;_0x85e241[_0x5aaf7d(0x9e)]&&(console['error']('\x0a'+(_0x487b63?_0x5aaf7d(0x9c)+_0x529635+'/'+_0x4d3234+':':'')),console[_0x5aaf7d(0x88)](_0x5aaf7d(0x96)+_0x85e241[_0x5aaf7d(0x94)]),console[_0x5aaf7d(0x88)](_0x5aaf7d(0x99)+(_0x327159||'td')),console[_0x5aaf7d(0x88)](_0x5aaf7d(0x98)+_0x287b54),console[_0x5aaf7d(0x88)](_0x5aaf7d(0xa2)+_0x47929a));const _0x357954=_0x487b63?_0x5aaf7d(0x8d)+_0x529635+'/'+_0x4d3234+'...':'Executing\x20query...';try{const _0x3e574e=await withProgressSpinner(_0x357954,async _0x371528=>{const _0x49a2ed=_0x5aaf7d,_0x2ad222=await _0x4e52b[_0x49a2ed(0x9b)][_0x49a2ed(0xac)](_0x47929a,{'catalog':_0x327159,'schema':_0x287b54,'onJobId':_0x3a97e4=>{const _0x2e8473=_0x49a2ed;_0x371528[_0x2e8473(0x82)](_0x3a97e4);},'onProgress':_0x3bad86=>{const _0x51e5ce=_0x49a2ed;_0x371528[_0x51e5ce(0x93)]('Executing\x20query\x20['+_0x3bad86[_0x51e5ce(0x81)]+']'),_0x371528[_0x51e5ce(0xa1)](formatRows(_0x3bad86[_0x51e5ce(0x84)])+_0x51e5ce(0xaa)+_0x3bad86[_0x51e5ce(0xad)]+'/'+_0x3bad86['totalSplits']+_0x51e5ce(0xab));}});return _0x2ad222;},{'verbose':_0x85e241[_0x5aaf7d(0x9e)]}),_0x5641f7=_0x3e574e[_0x5aaf7d(0x8f)],_0x7374ec=_0x5641f7['jobId']?_0x5aaf7d(0x8a)+_0x5641f7[_0x5aaf7d(0x80)]+']':'',_0x22d107=_0x487b63?_0x5aaf7d(0x9c)+_0x529635+'/'+_0x4d3234+_0x5aaf7d(0x8b):'';console[_0x5aaf7d(0x88)]('✔\x20'+_0x22d107+_0x5aaf7d(0x8e)+formatRows(_0x5641f7[_0x5aaf7d(0x83)]['processedRows'])+_0x5aaf7d(0xaa)+(_0x5aaf7d(0x7d)+formatElapsed(_0x5641f7['stats'][_0x5aaf7d(0x86)])+_0x7374ec));if(_0x487b63&&_0x167af0){const _0x1b8db7=resolveOutputOptions(_0x505f86),_0x169186=await formatQueryOutput(_0x5641f7,_0x1b8db7);_0x24b56d[_0x5aaf7d(0xa5)](_0x169186);}else await handleQueryOutput(_0x5641f7,_0x505f86);}catch(_0x306244){const _0x1f3731=_0x487b63?_0x5aaf7d(0x9c)+_0x529635+'/'+_0x4d3234+':\x0a':'',_0x1aaccf=_0x306244 instanceof SDKError?_0x306244[_0x5aaf7d(0xa8)]:_0x306244[_0x5aaf7d(0x9d)];return console['error'](''+_0x1f3731+_0x1aaccf),0x1;}}if(_0x38d160[_0x5aaf7d(0xa4)]>0x1&&_0x167af0&&_0x24b56d[_0x5aaf7d(0xa4)]>0x0){const _0x52a19a=_0x24b56d[_0x5aaf7d(0xa6)]('\x0a');writeFileSync(_0x85e241[_0x5aaf7d(0x91)],_0x52a19a),console[_0x5aaf7d(0x88)](_0x5aaf7d(0xa9)+_0x85e241[_0x5aaf7d(0x91)]);}return 0x0;}catch(_0x3ba0ae){throw _0x3ba0ae;}}[a45_0x57909f(0xae)](_0x4ed44b){const _0x276e31=a45_0x57909f,_0x5db70c=_0x4ed44b[_0x276e31(0x7e)][0x0],_0x422037=_0x4ed44b['options'][_0x276e31(0x9f)];if(!_0x5db70c&&!_0x422037)return _0x276e31(0x87);if(_0x5db70c&&_0x422037)return _0x276e31(0x97);return undefined;}}
@@ -1 +1 @@
1
- const a46_0x1b85d9=a46_0xd06c;(function(_0x40c281,_0x3ab721){const _0x2c30d9=a46_0xd06c,_0x57ac8a=_0x40c281();while(!![]){try{const _0x5e2c8f=-parseInt(_0x2c30d9(0x17a))/0x1+-parseInt(_0x2c30d9(0x19e))/0x2*(parseInt(_0x2c30d9(0x189))/0x3)+parseInt(_0x2c30d9(0x180))/0x4*(parseInt(_0x2c30d9(0x18c))/0x5)+parseInt(_0x2c30d9(0x18a))/0x6+parseInt(_0x2c30d9(0x1ca))/0x7*(-parseInt(_0x2c30d9(0x19d))/0x8)+parseInt(_0x2c30d9(0x1cb))/0x9+parseInt(_0x2c30d9(0x1b7))/0xa*(parseInt(_0x2c30d9(0x1a4))/0xb);if(_0x5e2c8f===_0x3ab721)break;else _0x57ac8a['push'](_0x57ac8a['shift']());}catch(_0x5f4e95){_0x57ac8a['push'](_0x57ac8a['shift']());}}}(a46_0x4fe9,0xb8915));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 a46_0x4fe9(){const _0x2e2577=['success','json','timezone','queries','verbose','schedule:delete','cyan','padEnd','never','\x20(use\x20--limit\x20to\x20see\x20more)','schedule:list','Creating\x20schedule:\x20','\x22...','getTime','schedule:show','\x20\x20→\x20','data','pagination','Query\x20file\x20is\x20empty','d\x20ago','schedule:update','964688TPNVIp','query','yes','\x20(showing\x20','updated_at','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','8bgXBLc','\x20\x20Num:\x20','job_id','in\x20','time_zone','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','📅\x20','Update\x20a\x20scheduled\x20query','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','3aHWyof','3293016YXMNzH','Searching\x20scheduled\x20queries\x20matching\x20\x22','439235GTOfrq','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','trino','delay','ended_at','end_at','history','repeat','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','database','length','\x20\x20Time:\x20','map','\x20execution','user_name','round','update','24176HowOjo','1852062WzhiQN','type','jsonl','next_run_at','retry_limit','executing_user_id','77SSxBFj','status','Show\x20schedule\x20execution\x20history','\x20created','max','\x20job','Cancelled','utf-8','file','schedule:run','validate','Failed\x20to\x20read\x20file:\x20','join','nextRun','Creating\x20schedule...','Getting\x20schedule\x20details...','scheduled_at','INVALID_ARGUMENT','site','1063830rWOFPz','engine_version','statusIcon','toLocaleDateString','trim','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','time','Deleting\x20schedule...','schedules','engineVersion','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','/app/queries/editor?queryId=','listQueries','...','args','\x20scheduled\x20quer','\x20\x20Job\x20ID:\x20','retryLimit','execute','280AyAdwN','11685393wUbjyW','Schedule\x20created:\x20','count','options','\x20\x20Cron:\x20','create','table','lastRun','Schedule\x20deleted:\x20','abs','delete','from','format','Delete\x20a\x20scheduled\x20query','result','start_at','soon','name','run','num','schedule:create','show','Updating\x20schedule:\x20','ies','priority','description','Getting\x20schedule\x20history...','created_at','last_job','error','green','cron','red','just\x20now','Schedule\x20updated:\x20','Found\x20','tsv'];a46_0x4fe9=function(){return _0x2e2577;};return a46_0x4fe9();}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 a46_0x2bf7b6 from'chalk';function formatRelativeTime(_0x3e9187){const _0xb444ac=a46_0xd06c,_0x13105b=new Date(_0x3e9187),_0x405b61=new Date(),_0x19944d=_0x13105b[_0xb444ac(0x172)]()-_0x405b61[_0xb444ac(0x172)](),_0x3e181c=Math[_0xb444ac(0x1d4)](_0x19944d)/0x3e8,_0x49fcb1=_0x19944d<0x0;if(_0x3e181c<0x3c)return _0x49fcb1?_0xb444ac(0x161):_0xb444ac(0x1db);else{if(_0x3e181c<0xe10){const _0x1a8085=Math['round'](_0x3e181c/0x3c);return _0x49fcb1?_0x1a8085+'m\x20ago':_0xb444ac(0x183)+_0x1a8085+'m';}else{if(_0x3e181c<0x15180){const _0x1ddc76=Math[_0xb444ac(0x19b)](_0x3e181c/0xe10);return _0x49fcb1?_0x1ddc76+'h\x20ago':_0xb444ac(0x183)+_0x1ddc76+'h';}else{if(_0x3e181c<0x93a80){const _0xe40570=Math[_0xb444ac(0x19b)](_0x3e181c/0x15180);return _0x49fcb1?_0xe40570+_0xb444ac(0x178):_0xb444ac(0x183)+_0xe40570+'d';}else return _0x13105b[_0xb444ac(0x1ba)]();}}}}export class ScheduleListCommand extends BaseCommand{[a46_0x1b85d9(0x1dc)]=a46_0x1b85d9(0x16f);['description']='List\x20scheduled\x20queries';async[a46_0x1b85d9(0x1c9)](_0x54d7a5){const _0x1d483a=a46_0x1b85d9,{options:_0x4b0b9f,args:_0x313010,tdx:_0x40a25f}=_0x54d7a5,_0x44363d=resolveLimit(_0x4b0b9f['limit'],DEFAULT_DISPLAY_LIMIT),_0x23f642=_0x313010[0x0],_0x4c2788=_0x23f642?_0x1d483a(0x18b)+_0x23f642+_0x1d483a(0x171):'Listing\x20scheduled\x20queries...',_0xf3e01a=await withSpinner(_0x4c2788,()=>_0x40a25f[_0x1d483a(0x1bf)][_0x1d483a(0x1c3)]({'limit':_0x44363d,'scheduled':!![],'pattern':_0x23f642}),{'verbose':_0x4b0b9f[_0x1d483a(0x169)]}),_0x445d04=_0xf3e01a[_0x1d483a(0x175)][_0x1d483a(0x168)],_0x53e55c=_0xf3e01a['data'][_0x1d483a(0x176)]['has_next_page'],_0x581b00=_0x23f642?'\x20matching\x20\x22'+_0x23f642+'\x22':'';_0x53e55c?console[_0x1d483a(0x1e8)]('Showing\x20first\x20'+_0x445d04[_0x1d483a(0x196)]+'\x20schedules'+_0x581b00+_0x1d483a(0x16e)):console['error']('Found\x20'+_0x445d04[_0x1d483a(0x196)]+_0x1d483a(0x1c6)+(_0x445d04[_0x1d483a(0x196)]!==0x1?_0x1d483a(0x1e2):'y')+_0x581b00);if(_0x4b0b9f[_0x1d483a(0x1d7)]===_0x1d483a(0x166)||_0x4b0b9f['format']===_0x1d483a(0x1a0)||_0x4b0b9f[_0x1d483a(0x1d7)]===_0x1d483a(0x1d1)||_0x4b0b9f[_0x1d483a(0x1d7)]===_0x1d483a(0x164)){const _0x1f4c1c=_0x445d04[_0x1d483a(0x198)](_0x4125cc=>({'id':_0x4125cc['id'],'name':_0x4125cc['name'],'cron':_0x4125cc[_0x1d483a(0x1ea)],'database':_0x4125cc['database']?.['name'],'type':_0x4125cc[_0x1d483a(0x19f)],'timezone':_0x4125cc[_0x1d483a(0x184)],'user_name':_0x4125cc['user']?.['name'],'updated_at':_0x4125cc[_0x1d483a(0x17e)],'next_run_at':_0x4125cc[_0x1d483a(0x1a1)],'last_job_status':_0x4125cc[_0x1d483a(0x1e7)]?.[_0x1d483a(0x1a5)]}));await handleSDKOutput(_0x1f4c1c,_0x4b0b9f);}else{if(_0x445d04[_0x1d483a(0x196)]===0x0)console['log']('No\x20scheduled\x20queries\x20found');else{const _0x85897=_0x4b0b9f[_0x1d483a(0x1b6)],_0xc94148=_0x445d04[_0x1d483a(0x198)](_0x2820ef=>{const _0x153c05=_0x1d483a,_0x4a83a9=_0x2820ef[_0x153c05(0x1e7)]?.[_0x153c05(0x1a5)]?_0x2820ef[_0x153c05(0x1e7)][_0x153c05(0x1a5)]===_0x153c05(0x165)?'✓':'✗':'-',_0x41ed55=_0x2820ef['last_job']?.[_0x153c05(0x190)]?formatRelativeTime(_0x2820ef[_0x153c05(0x1e7)]['ended_at']):_0x153c05(0x16d),_0x4ab866=_0x2820ef[_0x153c05(0x1a1)]?formatRelativeTime(_0x2820ef[_0x153c05(0x1a1)]):'-',_0x981561=_0x2820ef[_0x153c05(0x1ea)]||'',_0x13d098=_0x2820ef[_0x153c05(0x1dc)]||'(unnamed)',_0xd73a38=getConsoleUrl(_0x85897,_0x153c05(0x1c2)+_0x2820ef['id']);return{'statusIcon':_0x4a83a9,'lastRun':_0x41ed55,'nextRun':_0x4ab866,'cron':_0x981561,'name':_0x13d098,'queryUrl':_0xd73a38,'status':_0x2820ef['last_job']?.[_0x153c05(0x1a5)]};}),_0x82d6af=Math[_0x1d483a(0x1a8)](..._0xc94148['map'](_0x498299=>_0x498299[_0x1d483a(0x1d2)][_0x1d483a(0x196)])),_0x289878=Math[_0x1d483a(0x1a8)](..._0xc94148['map'](_0x328dd4=>_0x328dd4['nextRun'][_0x1d483a(0x196)])),_0x414ecb=Math['max'](..._0xc94148[_0x1d483a(0x198)](_0x25588f=>_0x25588f[_0x1d483a(0x1ea)][_0x1d483a(0x196)])),_0x10c197=_0xc94148[_0x1d483a(0x198)](_0x23c476=>{const _0x21f9ac=_0x1d483a,_0x2bcab0=_0x23c476['status']==='success'?a46_0x2bf7b6[_0x21f9ac(0x1e9)](_0x23c476['statusIcon']):_0x23c476[_0x21f9ac(0x1a5)]===_0x21f9ac(0x1e8)?a46_0x2bf7b6[_0x21f9ac(0x1eb)](_0x23c476[_0x21f9ac(0x1b9)]):a46_0x2bf7b6['dim'](_0x23c476[_0x21f9ac(0x1b9)]),_0x3be493=_0x23c476[_0x21f9ac(0x1d2)][_0x21f9ac(0x16c)](_0x82d6af),_0x2f4ca4=_0x23c476[_0x21f9ac(0x1b1)][_0x21f9ac(0x16c)](_0x289878),_0x2e4ea1=_0x23c476[_0x21f9ac(0x1ea)]?a46_0x2bf7b6[_0x21f9ac(0x16b)](_0x23c476['cron']['padEnd'](_0x414ecb)):'\x20'[_0x21f9ac(0x193)](_0x414ecb),_0x28eea1=hyperlink(_0x23c476[_0x21f9ac(0x1dc)],_0x23c476['queryUrl']);return _0x21f9ac(0x186)+_0x2bcab0+'\x20'+_0x3be493+_0x21f9ac(0x174)+_0x2f4ca4+'\x20\x20'+_0x2e4ea1+'\x20\x20'+_0x28eea1;});await writeOutput(_0x10c197[_0x1d483a(0x1b0)]('\x0a'),_0x4b0b9f['output'],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a46_0x1b85d9(0x1dc)]=a46_0x1b85d9(0x173);[a46_0x1b85d9(0x1e4)]='Show\x20schedule\x20details';[a46_0x1b85d9(0x1ae)](_0x129300){const _0x4225eb=a46_0x1b85d9,_0x54efc6=_0x129300['args'][0x0];if(!_0x54efc6)return _0x4225eb(0x188);return undefined;}async[a46_0x1b85d9(0x1c9)](_0xb3795c){const _0x397632=a46_0x1b85d9,{options:_0xddf741,args:_0xd1730d,tdx:_0x22a4d8}=_0xb3795c,_0x220777=_0xd1730d[0x0],_0x3dd3d4=await withSpinner(_0x397632(0x1b3),()=>_0x22a4d8[_0x397632(0x1bf)][_0x397632(0x1e0)](_0x220777),{'verbose':_0xddf741[_0x397632(0x169)]}),_0xe02b89=_0x3dd3d4['data'],_0x5072b3={'name':_0xe02b89['name'],'cron':_0xe02b89['cron'],'database':_0xe02b89[_0x397632(0x195)],'type':_0xe02b89[_0x397632(0x19f)],'timezone':_0xe02b89[_0x397632(0x167)],'user_name':_0xe02b89[_0x397632(0x19a)],'created_at':_0xe02b89[_0x397632(0x1e6)],'engine_version':_0xe02b89[_0x397632(0x1b8)],'executing_user_id':_0xe02b89[_0x397632(0x1a3)],'query':_0xe02b89[_0x397632(0x17b)],'delay':_0xe02b89[_0x397632(0x18f)],'priority':_0xe02b89['priority'],'retry_limit':_0xe02b89[_0x397632(0x1a2)],..._0xe02b89[_0x397632(0x1d9)]&&{'result':_0xe02b89[_0x397632(0x1d9)]}};return await handleSingleObjectOutput(_0x5072b3,_0xddf741),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a46_0x1b85d9(0x1dc)]=a46_0x1b85d9(0x1df);[a46_0x1b85d9(0x1e4)]='Create\x20a\x20scheduled\x20query';['validate'](_0x5514f4){const _0x388b44=a46_0x1b85d9,_0x5d50a4=_0x5514f4[_0x388b44(0x1c5)][0x0];if(!_0x5d50a4)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x4bcb3e=_0x5514f4[_0x388b44(0x1ce)];if(!_0x4bcb3e['database'])return _0x388b44(0x185);return undefined;}async[a46_0x1b85d9(0x1c9)](_0x5d7325){const _0x4ca21a=a46_0x1b85d9,{options:_0x54cd22,args:_0x212628,tdx:_0x4bc879}=_0x5d7325,_0x177743=_0x212628[0x0],_0x3892dc=_0x54cd22,_0x5ad188=_0x3892dc[_0x4ca21a(0x195)],_0x586c67=_0x3892dc[_0x4ca21a(0x1ac)],_0x254a3c=_0x3892dc[_0x4ca21a(0x19f)]||_0x4ca21a(0x18e);let _0x412ee7;try{_0x412ee7=readFileSync(_0x586c67,_0x4ca21a(0x1ab))[_0x4ca21a(0x1bb)]();}catch(_0x585c88){throw new SDKError(ErrorCode[_0x4ca21a(0x1b5)],_0x4ca21a(0x1af)+_0x586c67,_0x585c88 instanceof Error?_0x585c88:undefined);}if(!_0x412ee7)throw new SDKError(ErrorCode[_0x4ca21a(0x1b5)],_0x4ca21a(0x177));const _0x78e95f={'database':_0x5ad188,'query':_0x412ee7,'type':_0x254a3c};if(_0x3892dc['cron'])_0x78e95f[_0x4ca21a(0x1ea)]=_0x3892dc[_0x4ca21a(0x1ea)];if(_0x3892dc[_0x4ca21a(0x167)])_0x78e95f['timezone']=_0x3892dc['timezone'];if(_0x3892dc[_0x4ca21a(0x18f)]!==undefined)_0x78e95f[_0x4ca21a(0x18f)]=Number(_0x3892dc[_0x4ca21a(0x18f)]);if(_0x3892dc[_0x4ca21a(0x1e3)]!==undefined)_0x78e95f['priority']=Number(_0x3892dc[_0x4ca21a(0x1e3)]);if(_0x3892dc[_0x4ca21a(0x1c8)]!==undefined)_0x78e95f['retry_limit']=Number(_0x3892dc[_0x4ca21a(0x1c8)]);if(_0x3892dc[_0x4ca21a(0x1c0)])_0x78e95f[_0x4ca21a(0x1b8)]=_0x3892dc['engineVersion'];if(_0x3892dc[_0x4ca21a(0x1d9)])_0x78e95f[_0x4ca21a(0x1d9)]=_0x3892dc[_0x4ca21a(0x1d9)];if(_0x54cd22[_0x4ca21a(0x169)]){console[_0x4ca21a(0x1e8)](_0x4ca21a(0x170)+_0x177743),console[_0x4ca21a(0x1e8)]('\x20\x20Database:\x20'+_0x5ad188),console[_0x4ca21a(0x1e8)]('\x20\x20Type:\x20'+_0x254a3c);if(_0x78e95f[_0x4ca21a(0x1ea)])console['error'](_0x4ca21a(0x1cf)+_0x78e95f['cron']);if(_0x78e95f[_0x4ca21a(0x167)])console['error']('\x20\x20Timezone:\x20'+_0x78e95f[_0x4ca21a(0x167)]);}const _0x463dcc=await withSpinner(_0x4ca21a(0x1b2),()=>_0x4bc879['schedules'][_0x4ca21a(0x1d0)](_0x177743,_0x78e95f),{'verbose':_0x54cd22[_0x4ca21a(0x169)]});return console[_0x4ca21a(0x1e8)](_0x4ca21a(0x1cc)+_0x463dcc[_0x4ca21a(0x175)][_0x4ca21a(0x1dc)]),await handleSingleObjectOutput(_0x463dcc[_0x4ca21a(0x175)],_0x54cd22),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a46_0x1b85d9(0x179);[a46_0x1b85d9(0x1e4)]=a46_0x1b85d9(0x187);['validate'](_0x405bf5){const _0x49901c=a46_0x1b85d9,_0x272dbd=_0x405bf5[_0x49901c(0x1c5)][0x0];if(!_0x272dbd)return _0x49901c(0x194);return undefined;}async[a46_0x1b85d9(0x1c9)](_0x4c85e7){const _0x297148=a46_0x1b85d9,{options:_0x49854a,args:_0x55a1c8,tdx:_0x351b3c}=_0x4c85e7,_0x2476b6=_0x55a1c8[0x0],_0x28a435=_0x49854a,_0x270759={};if(_0x28a435[_0x297148(0x195)])_0x270759['database']=_0x28a435[_0x297148(0x195)];if(_0x28a435[_0x297148(0x19f)])_0x270759['type']=_0x28a435[_0x297148(0x19f)];if(_0x28a435[_0x297148(0x1ea)])_0x270759[_0x297148(0x1ea)]=_0x28a435[_0x297148(0x1ea)];if(_0x28a435[_0x297148(0x167)])_0x270759[_0x297148(0x167)]=_0x28a435[_0x297148(0x167)];if(_0x28a435[_0x297148(0x18f)]!==undefined)_0x270759[_0x297148(0x18f)]=Number(_0x28a435[_0x297148(0x18f)]);if(_0x28a435[_0x297148(0x1e3)]!==undefined)_0x270759[_0x297148(0x1e3)]=Number(_0x28a435[_0x297148(0x1e3)]);if(_0x28a435[_0x297148(0x1c8)]!==undefined)_0x270759[_0x297148(0x1a2)]=Number(_0x28a435[_0x297148(0x1c8)]);if(_0x28a435[_0x297148(0x1c0)])_0x270759[_0x297148(0x1b8)]=_0x28a435['engineVersion'];if(_0x28a435[_0x297148(0x1d9)])_0x270759[_0x297148(0x1d9)]=_0x28a435[_0x297148(0x1d9)];if(_0x28a435[_0x297148(0x1ac)])try{_0x270759[_0x297148(0x17b)]=readFileSync(_0x28a435[_0x297148(0x1ac)],'utf-8')[_0x297148(0x1bb)]();}catch(_0xa04367){throw new SDKError(ErrorCode[_0x297148(0x1b5)],'Failed\x20to\x20read\x20file:\x20'+_0x28a435[_0x297148(0x1ac)],_0xa04367 instanceof Error?_0xa04367:undefined);}if(Object['keys'](_0x270759)[_0x297148(0x196)]===0x0)throw new SDKError(ErrorCode[_0x297148(0x1b5)],_0x297148(0x1c1));if(_0x49854a[_0x297148(0x169)]){console['error'](_0x297148(0x1e1)+_0x2476b6);for(const [_0x55328e,_0x13b606]of Object['entries'](_0x270759)){_0x55328e===_0x297148(0x17b)?console['error']('\x20\x20'+_0x55328e+':\x20'+_0x13b606['substring'](0x0,0x32)+_0x297148(0x1c4)):console['error']('\x20\x20'+_0x55328e+':\x20'+_0x13b606);}}const _0x4c4ec7=await withSpinner('Updating\x20schedule...',()=>_0x351b3c[_0x297148(0x1bf)][_0x297148(0x19c)](_0x2476b6,_0x270759),{'verbose':_0x49854a[_0x297148(0x169)]});return console['error'](_0x297148(0x162)+_0x4c4ec7[_0x297148(0x175)][_0x297148(0x1dc)]),await handleSingleObjectOutput(_0x4c4ec7[_0x297148(0x175)],_0x49854a),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a46_0x1b85d9(0x1dc)]=a46_0x1b85d9(0x16a);['description']=a46_0x1b85d9(0x1d8);[a46_0x1b85d9(0x1ae)](_0x1cab7c){const _0x3b22ee=a46_0x1b85d9,_0x2d566b=_0x1cab7c[_0x3b22ee(0x1c5)][0x0];if(!_0x2d566b)return _0x3b22ee(0x17f);return undefined;}async[a46_0x1b85d9(0x1c9)](_0x81143d){const _0x2353e0=a46_0x1b85d9,{options:_0x4a4c4a,args:_0x5222af,tdx:_0x4645e7}=_0x81143d,_0x352148=_0x5222af[0x0];if(!_0x4a4c4a[_0x2353e0(0x17c)]){const _0xfd1cf=await confirm(_0x2353e0(0x18d)+_0x352148+'\x22?');if(!_0xfd1cf)return console[_0x2353e0(0x1e8)](_0x2353e0(0x1aa)),0x0;}const _0x5c2bf3=await withSpinner(_0x2353e0(0x1be),()=>_0x4645e7[_0x2353e0(0x1bf)][_0x2353e0(0x1d5)](_0x352148),{'verbose':_0x4a4c4a['verbose']});return console['error'](_0x2353e0(0x1d3)+_0x5c2bf3[_0x2353e0(0x175)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a46_0x1b85d9(0x1dc)]=a46_0x1b85d9(0x1ad);[a46_0x1b85d9(0x1e4)]='Run\x20a\x20scheduled\x20query\x20immediately';[a46_0x1b85d9(0x1ae)](_0x438248){const _0x400d9d=a46_0x1b85d9,_0x195f07=_0x438248[_0x400d9d(0x1c5)][0x0];if(!_0x195f07)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a46_0x1b85d9(0x1c9)](_0x56f97a){const _0x3eed28=a46_0x1b85d9,{options:_0x50eb7e,args:_0x5f33ba,tdx:_0x268355}=_0x56f97a,_0x339c90=_0x5f33ba[0x0],_0x19d1e7=_0x50eb7e,_0x123589=_0x19d1e7[_0x3eed28(0x1bd)],_0x4da36f=_0x19d1e7[_0x3eed28(0x1de)]!==undefined?Number(_0x19d1e7['num']):undefined;if(_0x50eb7e[_0x3eed28(0x169)]){console['error']('Running\x20schedule:\x20'+_0x339c90);if(_0x123589)console[_0x3eed28(0x1e8)](_0x3eed28(0x197)+_0x123589);if(_0x4da36f)console[_0x3eed28(0x1e8)](_0x3eed28(0x181)+_0x4da36f);}const _0x196fa7=await withSpinner('Running\x20schedule...',()=>_0x268355['schedules'][_0x3eed28(0x1dd)](_0x339c90,{'time':_0x123589,'num':_0x4da36f}),{'verbose':_0x50eb7e[_0x3eed28(0x169)]}),_0x48ed51=_0x196fa7[_0x3eed28(0x175)]['jobs'];console[_0x3eed28(0x1e8)]('Schedule\x20run\x20submitted:\x20'+_0x48ed51[_0x3eed28(0x196)]+_0x3eed28(0x1a9)+(_0x48ed51[_0x3eed28(0x196)]!==0x1?'s':'')+_0x3eed28(0x1a7));for(const _0x2ee047 of _0x48ed51){console['error'](_0x3eed28(0x1c7)+_0x2ee047[_0x3eed28(0x182)]);}return await handleSDKOutput(_0x48ed51,_0x50eb7e),0x0;}}function a46_0xd06c(_0x1a3e3a,_0x339b28){_0x1a3e3a=_0x1a3e3a-0x161;const _0x4fe96e=a46_0x4fe9();let _0xd06ceb=_0x4fe96e[_0x1a3e3a];return _0xd06ceb;}export class ScheduleHistoryCommand extends BaseCommand{[a46_0x1b85d9(0x1dc)]='schedule:history';[a46_0x1b85d9(0x1e4)]=a46_0x1b85d9(0x1a6);['validate'](_0x2f06d7){const _0x14cd64=a46_0x1b85d9,_0x2b2d4d=_0x2f06d7['args'][0x0];if(!_0x2b2d4d)return _0x14cd64(0x1bc);return undefined;}async[a46_0x1b85d9(0x1c9)](_0x1341bf){const _0x1e4e0f=a46_0x1b85d9,{options:_0x59f3ac,args:_0x558e1a,tdx:_0x37b190}=_0x1341bf,_0x14986b=_0x558e1a[0x0],_0x215b50=_0x59f3ac,_0x1f3198=_0x215b50[_0x1e4e0f(0x1d6)]!==undefined?Number(_0x215b50[_0x1e4e0f(0x1d6)]):undefined,_0x47b07f=_0x215b50['to']!==undefined?Number(_0x215b50['to']):undefined,_0x415da0=await withSpinner(_0x1e4e0f(0x1e5),()=>_0x37b190['schedules'][_0x1e4e0f(0x192)](_0x14986b,{'from':_0x1f3198,'to':_0x47b07f}),{'verbose':_0x59f3ac['verbose']}),_0x12a3ca=_0x415da0['data'];console['error'](_0x1e4e0f(0x163)+_0x12a3ca[_0x1e4e0f(0x1cd)]+_0x1e4e0f(0x199)+(_0x12a3ca[_0x1e4e0f(0x1cd)]!==0x1?'s':'')+_0x1e4e0f(0x17d)+_0x12a3ca['from']+'-'+_0x12a3ca['to']+')');const _0x28eec0=_0x12a3ca[_0x1e4e0f(0x192)][_0x1e4e0f(0x198)](_0x22a76d=>({'job_id':_0x22a76d[_0x1e4e0f(0x182)],'type':_0x22a76d[_0x1e4e0f(0x19f)],'status':_0x22a76d[_0x1e4e0f(0x1a5)],'scheduled_at':_0x22a76d[_0x1e4e0f(0x1b4)],'created_at':_0x22a76d[_0x1e4e0f(0x1e6)],'start_at':_0x22a76d[_0x1e4e0f(0x1da)],'end_at':_0x22a76d[_0x1e4e0f(0x191)]}));return await handleSDKOutput(_0x28eec0,_0x59f3ac),0x0;}}
1
+ const a46_0x3a34ef=a46_0x3182;(function(_0xbaa56c,_0x1d0b37){const _0x22863f=a46_0x3182,_0x423f41=_0xbaa56c();while(!![]){try{const _0x36812f=parseInt(_0x22863f(0x1f0))/0x1+parseInt(_0x22863f(0x1e4))/0x2*(-parseInt(_0x22863f(0x1e5))/0x3)+-parseInt(_0x22863f(0x1a7))/0x4+-parseInt(_0x22863f(0x199))/0x5*(parseInt(_0x22863f(0x1c3))/0x6)+parseInt(_0x22863f(0x1b0))/0x7*(parseInt(_0x22863f(0x181))/0x8)+-parseInt(_0x22863f(0x1da))/0x9+-parseInt(_0x22863f(0x1d1))/0xa*(-parseInt(_0x22863f(0x18a))/0xb);if(_0x36812f===_0x1d0b37)break;else _0x423f41['push'](_0x423f41['shift']());}catch(_0xb370a0){_0x423f41['push'](_0x423f41['shift']());}}}(a46_0x43bf,0x5156a));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 a46_0x3a9a98 from'chalk';function formatRelativeTime(_0x1865f7){const _0x178fbf=a46_0x3182,_0xde437b=new Date(_0x1865f7),_0x4a17a0=new Date(),_0x2fa4ff=_0xde437b[_0x178fbf(0x1d2)]()-_0x4a17a0[_0x178fbf(0x1d2)](),_0x3f7c5c=Math[_0x178fbf(0x1fc)](_0x2fa4ff)/0x3e8,_0x207b2d=_0x2fa4ff<0x0;if(_0x3f7c5c<0x3c)return _0x207b2d?_0x178fbf(0x187):_0x178fbf(0x19d);else{if(_0x3f7c5c<0xe10){const _0x59fe66=Math[_0x178fbf(0x1db)](_0x3f7c5c/0x3c);return _0x207b2d?_0x59fe66+'m\x20ago':_0x178fbf(0x1b3)+_0x59fe66+'m';}else{if(_0x3f7c5c<0x15180){const _0x2eda2c=Math[_0x178fbf(0x1db)](_0x3f7c5c/0xe10);return _0x207b2d?_0x2eda2c+_0x178fbf(0x1bc):_0x178fbf(0x1b3)+_0x2eda2c+'h';}else{if(_0x3f7c5c<0x93a80){const _0x4e7348=Math['round'](_0x3f7c5c/0x15180);return _0x207b2d?_0x4e7348+'d\x20ago':_0x178fbf(0x1b3)+_0x4e7348+'d';}else return _0xde437b['toLocaleDateString']();}}}}function a46_0x43bf(){const _0x5f097d=['Deleting\x20schedule...','listQueries','Running\x20schedule...','\x20\x20Database:\x20','Update\x20a\x20scheduled\x20query','from','next_run_at','46635WuzeLU','Schedule\x20run\x20submitted:\x20','engineVersion','name','soon','\x20\x20Job\x20ID:\x20','result','history','retry_limit','max','create','Showing\x20first\x20','...','data','233732wmYMYj','retryLimit','error','map','queries','substring','Creating\x20schedule:\x20','lastRun','executing_user_id','49SqXRsM','Run\x20a\x20scheduled\x20query\x20immediately','query','in\x20','keys','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','execute','never','timezone','\x20\x20Num:\x20','jsonl','Found\x20','h\x20ago','trino','schedules','site','Schedule\x20created:\x20','num','has_next_page','354fNdEGb','\x20scheduled\x20quer','status','cyan','Schedule\x20deleted:\x20','updated_at','/app/queries/editor?queryId=','\x20\x20→\x20','📅\x20','last_job','\x20\x20Type:\x20','scheduled_at','schedule:create','count','10RvwlHy','getTime','statusIcon','(unnamed)','show','Updating\x20schedule:\x20','success','\x20schedules','\x20\x20Timezone:\x20','5974956cJwORE','round','verbose','schedule:run','Failed\x20to\x20read\x20file:\x20','Delete\x20a\x20scheduled\x20query','schedule:list','time_zone','format','\x20execution','682nvtCgH','1101XabLcv','update','\x20(showing\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','args','ies','file','Cancelled','red','INVALID_ARGUMENT','List\x20scheduled\x20queries','492147TjuAWb','tsv','ended_at','Creating\x20schedule...','description','table','Updating\x20schedule...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','nextRun','database','Searching\x20scheduled\x20queries\x20matching\x20\x22','Listing\x20scheduled\x20queries...','abs','length','options','validate','user_name','\x20(use\x20--limit\x20to\x20see\x20more)','utf-8','Running\x20schedule:\x20','priority','Show\x20schedule\x20details','output','schedule:delete','378872pHZKJu','padEnd','engine_version','created_at','trim','yes','just\x20now','log','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','9979849opAtDm','delay','json','type','schedule:show','\x20job','\x20\x20Cron:\x20','cron'];a46_0x43bf=function(){return _0x5f097d;};return a46_0x43bf();}export class ScheduleListCommand extends BaseCommand{[a46_0x3a34ef(0x19c)]=a46_0x3a34ef(0x1e0);[a46_0x3a34ef(0x1f4)]=a46_0x3a34ef(0x1ef);async[a46_0x3a34ef(0x1b6)](_0x24c6be){const _0x8a177a=a46_0x3a34ef,{options:_0x12eb86,args:_0x2a17bf,tdx:_0x3ced39}=_0x24c6be,_0x21d182=resolveLimit(_0x12eb86['limit'],DEFAULT_DISPLAY_LIMIT),_0x218170=_0x2a17bf[0x0],_0xe8a9ee=_0x218170?_0x8a177a(0x1fa)+_0x218170+'\x22...':_0x8a177a(0x1fb),_0x3eaa98=await withSpinner(_0xe8a9ee,()=>_0x3ced39[_0x8a177a(0x1be)][_0x8a177a(0x193)]({'limit':_0x21d182,'scheduled':!![],'pattern':_0x218170}),{'verbose':_0x12eb86[_0x8a177a(0x1dc)]}),_0x272b24=_0x3eaa98[_0x8a177a(0x1a6)][_0x8a177a(0x1ab)],_0x4da6bf=_0x3eaa98[_0x8a177a(0x1a6)]['pagination'][_0x8a177a(0x1c2)],_0x49fc33=_0x218170?'\x20matching\x20\x22'+_0x218170+'\x22':'';_0x4da6bf?console[_0x8a177a(0x1a9)](_0x8a177a(0x1a4)+_0x272b24[_0x8a177a(0x1fd)]+_0x8a177a(0x1d8)+_0x49fc33+_0x8a177a(0x201)):console[_0x8a177a(0x1a9)](_0x8a177a(0x1bb)+_0x272b24[_0x8a177a(0x1fd)]+_0x8a177a(0x1c4)+(_0x272b24['length']!==0x1?_0x8a177a(0x1ea):'y')+_0x49fc33);if(_0x12eb86[_0x8a177a(0x1e2)]===_0x8a177a(0x18c)||_0x12eb86[_0x8a177a(0x1e2)]===_0x8a177a(0x1ba)||_0x12eb86[_0x8a177a(0x1e2)]===_0x8a177a(0x1f5)||_0x12eb86[_0x8a177a(0x1e2)]===_0x8a177a(0x1f1)){const _0xdde265=_0x272b24['map'](_0x14df74=>({'id':_0x14df74['id'],'name':_0x14df74[_0x8a177a(0x19c)],'cron':_0x14df74[_0x8a177a(0x191)],'database':_0x14df74['database']?.[_0x8a177a(0x19c)],'type':_0x14df74[_0x8a177a(0x18d)],'timezone':_0x14df74[_0x8a177a(0x1e1)],'user_name':_0x14df74['user']?.[_0x8a177a(0x19c)],'updated_at':_0x14df74[_0x8a177a(0x1c8)],'next_run_at':_0x14df74[_0x8a177a(0x198)],'last_job_status':_0x14df74[_0x8a177a(0x1cc)]?.[_0x8a177a(0x1c5)]}));await handleSDKOutput(_0xdde265,_0x12eb86);}else{if(_0x272b24[_0x8a177a(0x1fd)]===0x0)console[_0x8a177a(0x188)]('No\x20scheduled\x20queries\x20found');else{const _0x3a4afe=_0x12eb86[_0x8a177a(0x1bf)],_0x42c53e=_0x272b24[_0x8a177a(0x1aa)](_0x179e03=>{const _0x374751=_0x8a177a,_0x5c1e45=_0x179e03[_0x374751(0x1cc)]?.[_0x374751(0x1c5)]?_0x179e03[_0x374751(0x1cc)]['status']===_0x374751(0x1d7)?'✓':'✗':'-',_0x241ca0=_0x179e03[_0x374751(0x1cc)]?.[_0x374751(0x1f2)]?formatRelativeTime(_0x179e03[_0x374751(0x1cc)]['ended_at']):_0x374751(0x1b7),_0x38d254=_0x179e03[_0x374751(0x198)]?formatRelativeTime(_0x179e03['next_run_at']):'-',_0x4c8e2a=_0x179e03[_0x374751(0x191)]||'',_0x3641ba=_0x179e03[_0x374751(0x19c)]||_0x374751(0x1d4),_0x3a9fdc=getConsoleUrl(_0x3a4afe,_0x374751(0x1c9)+_0x179e03['id']);return{'statusIcon':_0x5c1e45,'lastRun':_0x241ca0,'nextRun':_0x38d254,'cron':_0x4c8e2a,'name':_0x3641ba,'queryUrl':_0x3a9fdc,'status':_0x179e03[_0x374751(0x1cc)]?.[_0x374751(0x1c5)]};}),_0x1113e9=Math['max'](..._0x42c53e[_0x8a177a(0x1aa)](_0x5ccfca=>_0x5ccfca[_0x8a177a(0x1ae)][_0x8a177a(0x1fd)])),_0xd511d6=Math[_0x8a177a(0x1a2)](..._0x42c53e[_0x8a177a(0x1aa)](_0x506f3f=>_0x506f3f['nextRun']['length'])),_0x51f8d0=Math[_0x8a177a(0x1a2)](..._0x42c53e[_0x8a177a(0x1aa)](_0x39fce7=>_0x39fce7[_0x8a177a(0x191)][_0x8a177a(0x1fd)])),_0x57c8ff=_0x42c53e[_0x8a177a(0x1aa)](_0x31e5cb=>{const _0x204711=_0x8a177a,_0x26bddd=_0x31e5cb[_0x204711(0x1c5)]===_0x204711(0x1d7)?a46_0x3a9a98['green'](_0x31e5cb[_0x204711(0x1d3)]):_0x31e5cb[_0x204711(0x1c5)]==='error'?a46_0x3a9a98[_0x204711(0x1ed)](_0x31e5cb[_0x204711(0x1d3)]):a46_0x3a9a98['dim'](_0x31e5cb[_0x204711(0x1d3)]),_0x332fc9=_0x31e5cb['lastRun']['padEnd'](_0x1113e9),_0x16c2d0=_0x31e5cb[_0x204711(0x1f8)][_0x204711(0x182)](_0xd511d6),_0x2c6fa7=_0x31e5cb[_0x204711(0x191)]?a46_0x3a9a98[_0x204711(0x1c6)](_0x31e5cb[_0x204711(0x191)]['padEnd'](_0x51f8d0)):'\x20'['repeat'](_0x51f8d0),_0x230b04=hyperlink(_0x31e5cb[_0x204711(0x19c)],_0x31e5cb['queryUrl']);return _0x204711(0x1cb)+_0x26bddd+'\x20'+_0x332fc9+_0x204711(0x1ca)+_0x16c2d0+'\x20\x20'+_0x2c6fa7+'\x20\x20'+_0x230b04;});await writeOutput(_0x57c8ff['join']('\x0a'),_0x12eb86[_0x8a177a(0x206)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a46_0x3a34ef(0x19c)]=a46_0x3a34ef(0x18e);['description']=a46_0x3a34ef(0x205);['validate'](_0x467637){const _0x572f82=a46_0x3a34ef,_0x4dc7c4=_0x467637[_0x572f82(0x1e9)][0x0];if(!_0x4dc7c4)return _0x572f82(0x1e8);return undefined;}async[a46_0x3a34ef(0x1b6)](_0x5ce739){const _0x471624=a46_0x3a34ef,{options:_0x2ca4b8,args:_0x521635,tdx:_0xe608d1}=_0x5ce739,_0x75947f=_0x521635[0x0],_0x37f880=await withSpinner('Getting\x20schedule\x20details...',()=>_0xe608d1[_0x471624(0x1be)][_0x471624(0x1d5)](_0x75947f),{'verbose':_0x2ca4b8[_0x471624(0x1dc)]}),_0x249996=_0x37f880[_0x471624(0x1a6)],_0x417c59={'name':_0x249996[_0x471624(0x19c)],'cron':_0x249996[_0x471624(0x191)],'database':_0x249996[_0x471624(0x1f9)],'type':_0x249996['type'],'timezone':_0x249996['timezone'],'user_name':_0x249996[_0x471624(0x200)],'created_at':_0x249996[_0x471624(0x184)],'engine_version':_0x249996[_0x471624(0x183)],'executing_user_id':_0x249996[_0x471624(0x1af)],'query':_0x249996['query'],'delay':_0x249996[_0x471624(0x18b)],'priority':_0x249996[_0x471624(0x204)],'retry_limit':_0x249996[_0x471624(0x1a1)],..._0x249996[_0x471624(0x19f)]&&{'result':_0x249996[_0x471624(0x19f)]}};return await handleSingleObjectOutput(_0x417c59,_0x2ca4b8),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a46_0x3a34ef(0x19c)]=a46_0x3a34ef(0x1cf);[a46_0x3a34ef(0x1f4)]='Create\x20a\x20scheduled\x20query';['validate'](_0x28e4af){const _0x36877e=a46_0x3a34ef,_0x3715af=_0x28e4af[_0x36877e(0x1e9)][0x0];if(!_0x3715af)return _0x36877e(0x1b5);const _0x576b53=_0x28e4af[_0x36877e(0x1fe)];if(!_0x576b53[_0x36877e(0x1f9)])return _0x36877e(0x189);return undefined;}async[a46_0x3a34ef(0x1b6)](_0x29149d){const _0x4c14be=a46_0x3a34ef,{options:_0x40180a,args:_0x36e827,tdx:_0x50df00}=_0x29149d,_0x3aeb91=_0x36e827[0x0],_0x103322=_0x40180a,_0x260741=_0x103322[_0x4c14be(0x1f9)],_0x558fa2=_0x103322['file'],_0x528350=_0x103322[_0x4c14be(0x18d)]||_0x4c14be(0x1bd);let _0x40854b;try{_0x40854b=readFileSync(_0x558fa2,_0x4c14be(0x202))[_0x4c14be(0x185)]();}catch(_0x39a5b1){throw new SDKError(ErrorCode[_0x4c14be(0x1ee)],_0x4c14be(0x1de)+_0x558fa2,_0x39a5b1 instanceof Error?_0x39a5b1:undefined);}if(!_0x40854b)throw new SDKError(ErrorCode[_0x4c14be(0x1ee)],'Query\x20file\x20is\x20empty');const _0x36551c={'database':_0x260741,'query':_0x40854b,'type':_0x528350};if(_0x103322['cron'])_0x36551c[_0x4c14be(0x191)]=_0x103322[_0x4c14be(0x191)];if(_0x103322[_0x4c14be(0x1b8)])_0x36551c[_0x4c14be(0x1b8)]=_0x103322[_0x4c14be(0x1b8)];if(_0x103322['delay']!==undefined)_0x36551c['delay']=Number(_0x103322[_0x4c14be(0x18b)]);if(_0x103322[_0x4c14be(0x204)]!==undefined)_0x36551c[_0x4c14be(0x204)]=Number(_0x103322[_0x4c14be(0x204)]);if(_0x103322[_0x4c14be(0x1a8)]!==undefined)_0x36551c[_0x4c14be(0x1a1)]=Number(_0x103322['retryLimit']);if(_0x103322[_0x4c14be(0x19b)])_0x36551c['engine_version']=_0x103322[_0x4c14be(0x19b)];if(_0x103322[_0x4c14be(0x19f)])_0x36551c[_0x4c14be(0x19f)]=_0x103322[_0x4c14be(0x19f)];if(_0x40180a[_0x4c14be(0x1dc)]){console[_0x4c14be(0x1a9)](_0x4c14be(0x1ad)+_0x3aeb91),console['error'](_0x4c14be(0x195)+_0x260741),console[_0x4c14be(0x1a9)](_0x4c14be(0x1cd)+_0x528350);if(_0x36551c[_0x4c14be(0x191)])console[_0x4c14be(0x1a9)](_0x4c14be(0x190)+_0x36551c[_0x4c14be(0x191)]);if(_0x36551c[_0x4c14be(0x1b8)])console[_0x4c14be(0x1a9)](_0x4c14be(0x1d9)+_0x36551c['timezone']);}const _0x2a69d1=await withSpinner(_0x4c14be(0x1f3),()=>_0x50df00[_0x4c14be(0x1be)][_0x4c14be(0x1a3)](_0x3aeb91,_0x36551c),{'verbose':_0x40180a[_0x4c14be(0x1dc)]});return console[_0x4c14be(0x1a9)](_0x4c14be(0x1c0)+_0x2a69d1[_0x4c14be(0x1a6)][_0x4c14be(0x19c)]),await handleSingleObjectOutput(_0x2a69d1['data'],_0x40180a),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a46_0x3a34ef(0x19c)]='schedule:update';[a46_0x3a34ef(0x1f4)]=a46_0x3a34ef(0x196);['validate'](_0x29b8c1){const _0x48a19f=a46_0x3a34ef,_0x1c0d7c=_0x29b8c1[_0x48a19f(0x1e9)][0x0];if(!_0x1c0d7c)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a46_0x3a34ef(0x1b6)](_0x539f39){const _0x30a23f=a46_0x3a34ef,{options:_0x230a75,args:_0x10d1d6,tdx:_0x123b8f}=_0x539f39,_0x4b803a=_0x10d1d6[0x0],_0x363993=_0x230a75,_0x5b8b00={};if(_0x363993[_0x30a23f(0x1f9)])_0x5b8b00['database']=_0x363993[_0x30a23f(0x1f9)];if(_0x363993[_0x30a23f(0x18d)])_0x5b8b00[_0x30a23f(0x18d)]=_0x363993[_0x30a23f(0x18d)];if(_0x363993[_0x30a23f(0x191)])_0x5b8b00[_0x30a23f(0x191)]=_0x363993[_0x30a23f(0x191)];if(_0x363993[_0x30a23f(0x1b8)])_0x5b8b00[_0x30a23f(0x1b8)]=_0x363993[_0x30a23f(0x1b8)];if(_0x363993[_0x30a23f(0x18b)]!==undefined)_0x5b8b00[_0x30a23f(0x18b)]=Number(_0x363993[_0x30a23f(0x18b)]);if(_0x363993[_0x30a23f(0x204)]!==undefined)_0x5b8b00[_0x30a23f(0x204)]=Number(_0x363993[_0x30a23f(0x204)]);if(_0x363993['retryLimit']!==undefined)_0x5b8b00['retry_limit']=Number(_0x363993['retryLimit']);if(_0x363993[_0x30a23f(0x19b)])_0x5b8b00[_0x30a23f(0x183)]=_0x363993[_0x30a23f(0x19b)];if(_0x363993['result'])_0x5b8b00['result']=_0x363993[_0x30a23f(0x19f)];if(_0x363993[_0x30a23f(0x1eb)])try{_0x5b8b00['query']=readFileSync(_0x363993[_0x30a23f(0x1eb)],'utf-8')[_0x30a23f(0x185)]();}catch(_0x955920){throw new SDKError(ErrorCode[_0x30a23f(0x1ee)],_0x30a23f(0x1de)+_0x363993[_0x30a23f(0x1eb)],_0x955920 instanceof Error?_0x955920:undefined);}if(Object[_0x30a23f(0x1b4)](_0x5b8b00)[_0x30a23f(0x1fd)]===0x0)throw new SDKError(ErrorCode[_0x30a23f(0x1ee)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x230a75[_0x30a23f(0x1dc)]){console['error'](_0x30a23f(0x1d6)+_0x4b803a);for(const [_0x56502a,_0x4187b8]of Object['entries'](_0x5b8b00)){_0x56502a===_0x30a23f(0x1b2)?console[_0x30a23f(0x1a9)]('\x20\x20'+_0x56502a+':\x20'+_0x4187b8[_0x30a23f(0x1ac)](0x0,0x32)+_0x30a23f(0x1a5)):console[_0x30a23f(0x1a9)]('\x20\x20'+_0x56502a+':\x20'+_0x4187b8);}}const _0x213e25=await withSpinner(_0x30a23f(0x1f6),()=>_0x123b8f['schedules'][_0x30a23f(0x1e6)](_0x4b803a,_0x5b8b00),{'verbose':_0x230a75[_0x30a23f(0x1dc)]});return console[_0x30a23f(0x1a9)]('Schedule\x20updated:\x20'+_0x213e25[_0x30a23f(0x1a6)][_0x30a23f(0x19c)]),await handleSingleObjectOutput(_0x213e25['data'],_0x230a75),0x0;}}function a46_0x3182(_0x1c1fc8,_0x2ec8ca){_0x1c1fc8=_0x1c1fc8-0x181;const _0x43bf48=a46_0x43bf();let _0x31828b=_0x43bf48[_0x1c1fc8];return _0x31828b;}export class ScheduleDeleteCommand extends BaseCommand{[a46_0x3a34ef(0x19c)]=a46_0x3a34ef(0x207);['description']=a46_0x3a34ef(0x1df);[a46_0x3a34ef(0x1ff)](_0x362ba8){const _0x323051=a46_0x3a34ef,_0x33fe96=_0x362ba8[_0x323051(0x1e9)][0x0];if(!_0x33fe96)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async['execute'](_0x4c7988){const _0x5d510a=a46_0x3a34ef,{options:_0x1265f5,args:_0xc7df59,tdx:_0x3f9a3f}=_0x4c7988,_0x359c53=_0xc7df59[0x0];if(!_0x1265f5[_0x5d510a(0x186)]){const _0x1368bf=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x359c53+'\x22?');if(!_0x1368bf)return console[_0x5d510a(0x1a9)](_0x5d510a(0x1ec)),0x0;}const _0x3fc44c=await withSpinner(_0x5d510a(0x192),()=>_0x3f9a3f[_0x5d510a(0x1be)]['delete'](_0x359c53),{'verbose':_0x1265f5[_0x5d510a(0x1dc)]});return console[_0x5d510a(0x1a9)](_0x5d510a(0x1c7)+_0x3fc44c[_0x5d510a(0x1a6)][_0x5d510a(0x19c)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{['name']=a46_0x3a34ef(0x1dd);[a46_0x3a34ef(0x1f4)]=a46_0x3a34ef(0x1b1);[a46_0x3a34ef(0x1ff)](_0x2bbbf1){const _0x5e97ef=a46_0x3a34ef,_0x1a0bce=_0x2bbbf1[_0x5e97ef(0x1e9)][0x0];if(!_0x1a0bce)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a46_0x3a34ef(0x1b6)](_0x12fe7b){const _0x2eeb61=a46_0x3a34ef,{options:_0xab711c,args:_0x2ed945,tdx:_0x1bb548}=_0x12fe7b,_0x2cf38e=_0x2ed945[0x0],_0x1e606d=_0xab711c,_0x25627e=_0x1e606d['time'],_0x1dae14=_0x1e606d[_0x2eeb61(0x1c1)]!==undefined?Number(_0x1e606d[_0x2eeb61(0x1c1)]):undefined;if(_0xab711c['verbose']){console[_0x2eeb61(0x1a9)](_0x2eeb61(0x203)+_0x2cf38e);if(_0x25627e)console['error']('\x20\x20Time:\x20'+_0x25627e);if(_0x1dae14)console[_0x2eeb61(0x1a9)](_0x2eeb61(0x1b9)+_0x1dae14);}const _0x209eba=await withSpinner(_0x2eeb61(0x194),()=>_0x1bb548[_0x2eeb61(0x1be)]['run'](_0x2cf38e,{'time':_0x25627e,'num':_0x1dae14}),{'verbose':_0xab711c[_0x2eeb61(0x1dc)]}),_0x4880ce=_0x209eba[_0x2eeb61(0x1a6)]['jobs'];console[_0x2eeb61(0x1a9)](_0x2eeb61(0x19a)+_0x4880ce[_0x2eeb61(0x1fd)]+_0x2eeb61(0x18f)+(_0x4880ce['length']!==0x1?'s':'')+'\x20created');for(const _0x17f370 of _0x4880ce){console[_0x2eeb61(0x1a9)](_0x2eeb61(0x19e)+_0x17f370['job_id']);}return await handleSDKOutput(_0x4880ce,_0xab711c),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a46_0x3a34ef(0x19c)]='schedule:history';['description']='Show\x20schedule\x20execution\x20history';[a46_0x3a34ef(0x1ff)](_0x4741b7){const _0x310965=a46_0x3a34ef,_0x3391a8=_0x4741b7[_0x310965(0x1e9)][0x0];if(!_0x3391a8)return _0x310965(0x1f7);return undefined;}async[a46_0x3a34ef(0x1b6)](_0x5ba3bc){const _0x1f4edb=a46_0x3a34ef,{options:_0x200204,args:_0x15d7a2,tdx:_0x509d02}=_0x5ba3bc,_0xf727cc=_0x15d7a2[0x0],_0xf8f612=_0x200204,_0x47968c=_0xf8f612['from']!==undefined?Number(_0xf8f612[_0x1f4edb(0x197)]):undefined,_0x299512=_0xf8f612['to']!==undefined?Number(_0xf8f612['to']):undefined,_0x307665=await withSpinner('Getting\x20schedule\x20history...',()=>_0x509d02[_0x1f4edb(0x1be)]['history'](_0xf727cc,{'from':_0x47968c,'to':_0x299512}),{'verbose':_0x200204[_0x1f4edb(0x1dc)]}),_0x18c276=_0x307665[_0x1f4edb(0x1a6)];console['error'](_0x1f4edb(0x1bb)+_0x18c276[_0x1f4edb(0x1d0)]+_0x1f4edb(0x1e3)+(_0x18c276[_0x1f4edb(0x1d0)]!==0x1?'s':'')+_0x1f4edb(0x1e7)+_0x18c276[_0x1f4edb(0x197)]+'-'+_0x18c276['to']+')');const _0xe12452=_0x18c276[_0x1f4edb(0x1a0)][_0x1f4edb(0x1aa)](_0x178862=>({'job_id':_0x178862['job_id'],'type':_0x178862['type'],'status':_0x178862['status'],'scheduled_at':_0x178862[_0x1f4edb(0x1ce)],'created_at':_0x178862['created_at'],'start_at':_0x178862['start_at'],'end_at':_0x178862['end_at']}));return await handleSDKOutput(_0xe12452,_0x200204),0x0;}}
@@ -1 +1 @@
1
- const a47_0x3d5352=a47_0x5e8c;(function(_0x3b8aa0,_0x5d1d4f){const _0x6bd7ae=a47_0x5e8c,_0x56c8e0=_0x3b8aa0();while(!![]){try{const _0xad73ac=parseInt(_0x6bd7ae(0x22b))/0x1*(parseInt(_0x6bd7ae(0x257))/0x2)+-parseInt(_0x6bd7ae(0x274))/0x3+parseInt(_0x6bd7ae(0x1f5))/0x4+-parseInt(_0x6bd7ae(0x1cd))/0x5*(-parseInt(_0x6bd7ae(0x1fd))/0x6)+parseInt(_0x6bd7ae(0x203))/0x7*(parseInt(_0x6bd7ae(0x1fb))/0x8)+-parseInt(_0x6bd7ae(0x278))/0x9*(parseInt(_0x6bd7ae(0x223))/0xa)+-parseInt(_0x6bd7ae(0x237))/0xb;if(_0xad73ac===_0x5d1d4f)break;else _0x56c8e0['push'](_0x56c8e0['shift']());}catch(_0x4c376e){_0x56c8e0['push'](_0x56c8e0['shift']());}}}(a47_0x59f8,0xf0ae9));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';function a47_0x5e8c(_0x40ad90,_0x2c079b){_0x40ad90=_0x40ad90-0x1cc;const _0x59f838=a47_0x59f8();let _0x5e8c97=_0x59f838[_0x40ad90];return _0x5e8c97;}import{openBrowser}from'../utils/process.js';import a47_0x155c19 from'chalk';async function resolveSegmentTarget(_0x2c43d5,_0x10251c,_0x319723){const _0x49256a=a47_0x5e8c;if(isYamlFilePath(_0x2c43d5))try{const _0x1c038f=await resolveYamlFilePath(_0x2c43d5);return _0x319723&&(console[_0x49256a(0x24a)](_0x49256a(0x1fa)+_0x2c43d5),console[_0x49256a(0x24a)](_0x49256a(0x218)+_0x1c038f[_0x49256a(0x1e5)]),console['error'](_0x49256a(0x25f)+_0x1c038f[_0x49256a(0x222)]),console[_0x49256a(0x24a)](_0x49256a(0x265)+(_0x1c038f[_0x49256a(0x234)]||_0x49256a(0x1ec))),console[_0x49256a(0x24a)](_0x49256a(0x227)+_0x1c038f[_0x49256a(0x23a)])),_0x1c038f[_0x49256a(0x23a)];}catch(_0x39566b){throw new SDKError(ErrorCode[_0x49256a(0x26b)],_0x49256a(0x26d)+_0x39566b[_0x49256a(0x1eb)]);}if(!_0x10251c)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x49256a(0x267));return _0x10251c+'/'+_0x2c43d5;}export class SegmentDescribeCommand extends BaseCommand{[a47_0x3d5352(0x251)]=a47_0x3d5352(0x205);[a47_0x3d5352(0x1fe)]=a47_0x3d5352(0x20c);async['execute'](_0x3cc896){const _0x2b84b1=a47_0x3d5352,{options:_0x5b7271,args:_0x8bf607,tdx:_0x2da902}=_0x3cc896,_0x58850d=_0x8bf607[0x0],_0x435db6=!_0x58850d&&!!_0x5b7271[_0x2b84b1(0x1e5)],_0x18717b=_0x58850d||_0x5b7271[_0x2b84b1(0x1e5)];if(!_0x18717b)return console[_0x2b84b1(0x24a)](_0x2b84b1(0x200)),console[_0x2b84b1(0x24a)](_0x2b84b1(0x1e6)),console[_0x2b84b1(0x24a)](_0x2b84b1(0x1f2)),console['error'](_0x2b84b1(0x1e4)),console[_0x2b84b1(0x24a)](_0x2b84b1(0x1d4)),console['error'](_0x2b84b1(0x252)),console[_0x2b84b1(0x24a)](_0x2b84b1(0x211)),0x1;try{const _0x4c9425=_0x5b7271[_0x2b84b1(0x264)];let _0x543989=_0x18717b;!_0x435db6&&_0x4c9425&&!_0x18717b[_0x2b84b1(0x247)]('/')&&(_0x543989=_0x4c9425+'/'+_0x18717b,_0x5b7271[_0x2b84b1(0x22c)]&&console['error'](_0x2b84b1(0x1f1)+_0x543989));const _0x233a30=await withSpinner(_0x2b84b1(0x1e0)+_0x543989+_0x2b84b1(0x24c),()=>_0x2da902[_0x2b84b1(0x26f)][_0x2b84b1(0x263)](_0x543989),{'verbose':_0x5b7271[_0x2b84b1(0x22c)]}),_0x40f437=_0x233a30[_0x2b84b1(0x1ce)];_0x5b7271[_0x2b84b1(0x22c)]&&(console['error'](_0x2b84b1(0x231)+_0x40f437['type']),console[_0x2b84b1(0x24a)](_0x2b84b1(0x254)+_0x40f437['parentId']),_0x40f437[_0x2b84b1(0x1dd)]&&console['error'](_0x2b84b1(0x26e)+_0x40f437['folderId']),_0x40f437[_0x2b84b1(0x1e3)]&&console[_0x2b84b1(0x24a)](_0x2b84b1(0x1d1)+_0x40f437[_0x2b84b1(0x1e3)]));if(_0x40f437['type']===_0x2b84b1(0x249)){const _0x221d77=await withSpinner(_0x2b84b1(0x235),()=>_0x2da902[_0x2b84b1(0x26f)]['getParent'](_0x40f437[_0x2b84b1(0x1f8)]),{'verbose':_0x5b7271['verbose']});await handleSingleObjectOutput(_0x221d77[_0x2b84b1(0x1ce)],_0x5b7271);}else{if(_0x40f437['type']===_0x2b84b1(0x215)){if(!_0x40f437[_0x2b84b1(0x1dd)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x2b84b1(0x1f6));const _0x3486ef=await withSpinner(_0x2b84b1(0x1d8),()=>_0x2da902[_0x2b84b1(0x26f)][_0x2b84b1(0x238)](_0x40f437[_0x2b84b1(0x1dd)]),{'verbose':_0x5b7271[_0x2b84b1(0x22c)]});await handleSingleObjectOutput(_0x3486ef[_0x2b84b1(0x1ce)],_0x5b7271);}else{if(_0x40f437[_0x2b84b1(0x272)]===_0x2b84b1(0x26f)){if(!_0x40f437[_0x2b84b1(0x1e3)])throw new SDKError(ErrorCode[_0x2b84b1(0x216)],_0x2b84b1(0x229));const _0x40bcf3=await withSpinner('Fetching\x20segment\x20details...',()=>_0x2da902[_0x2b84b1(0x26f)]['getSegment'](_0x40f437[_0x2b84b1(0x1f8)],_0x40f437[_0x2b84b1(0x1e3)]),{'verbose':_0x5b7271[_0x2b84b1(0x22c)]});await handleSingleObjectOutput(_0x40bcf3[_0x2b84b1(0x1ce)],_0x5b7271);}}}return 0x0;}catch(_0x45a83f){if(_0x45a83f instanceof SDKError)return console[_0x2b84b1(0x24a)](_0x2b84b1(0x25c)+_0x45a83f[_0x2b84b1(0x1eb)]),_0x45a83f[_0x2b84b1(0x232)]&&console['error'](_0x2b84b1(0x1f7)+_0x45a83f[_0x2b84b1(0x232)]),0x1;throw _0x45a83f;}}}export class SegmentShowCommand extends BaseCommand{[a47_0x3d5352(0x251)]='segment:show';[a47_0x3d5352(0x1fe)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0xcdbb47){const _0x3b0163=a47_0x3d5352,{options:_0x3da05d,args:_0x4f39a7,tdx:_0x326a07}=_0xcdbb47,_0x5b21d0=_0x4f39a7[0x0];if(!_0x5b21d0)return console[_0x3b0163(0x24a)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x3b0163(0x24a)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x3b0163(0x24a)](_0x3b0163(0x1d2)),console[_0x3b0163(0x24a)](_0x3b0163(0x1f2)),console['error']('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x3b0163(0x24a)](_0x3b0163(0x21b)),0x1;try{const _0x3b6c3b=_0x3da05d[_0x3b0163(0x1e5)],_0x44244a=await resolveSegmentTarget(_0x5b21d0,_0x3b6c3b,_0x3da05d[_0x3b0163(0x22c)]);_0x3da05d['verbose']&&console[_0x3b0163(0x24a)](_0x3b0163(0x236)+_0x44244a);const _0x111398=await withSpinner(_0x3b0163(0x220)+_0x5b21d0+_0x3b0163(0x24c),()=>_0x326a07[_0x3b0163(0x26f)][_0x3b0163(0x263)](_0x44244a),{'verbose':_0x3da05d[_0x3b0163(0x22c)]}),_0x5a83a2=_0x111398['data'];_0x3da05d[_0x3b0163(0x22c)]&&(console[_0x3b0163(0x24a)](_0x3b0163(0x231)+_0x5a83a2[_0x3b0163(0x272)]),console[_0x3b0163(0x24a)]('Parent\x20ID:\x20'+_0x5a83a2[_0x3b0163(0x1f8)]));if(_0x5a83a2[_0x3b0163(0x272)]===_0x3b0163(0x215))return console[_0x3b0163(0x24a)](_0x3b0163(0x248)),console[_0x3b0163(0x24a)](_0x3b0163(0x20e)),0x1;if(_0x5a83a2[_0x3b0163(0x272)]===_0x3b0163(0x249))return console['error']('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x3b0163(0x20b)),0x1;if(!_0x5a83a2['segmentId'])throw new SDKError(ErrorCode[_0x3b0163(0x216)],_0x3b0163(0x229));const _0x3128f5=await withSpinner(_0x3b0163(0x23c),()=>_0x326a07[_0x3b0163(0x26f)][_0x3b0163(0x260)](_0x5a83a2[_0x3b0163(0x1f8)],_0x5a83a2[_0x3b0163(0x1e3)]),{'verbose':_0x3da05d[_0x3b0163(0x22c)]});let _0x1e9393=_0x3128f5[_0x3b0163(0x1ce)];const _0x142b3d=resolveLimit(_0x3da05d[_0x3b0163(0x241)],DEFAULT_DISPLAY_LIMIT),_0x29031b=/\bLIMIT\s+\d+/i[_0x3b0163(0x25b)](_0x1e9393);!_0x29031b&&(_0x1e9393=_0x1e9393['trim']()[_0x3b0163(0x1ed)](/;+$/,''),_0x1e9393=_0x3b0163(0x240)+_0x1e9393+_0x3b0163(0x250)+_0x142b3d);_0x3da05d['verbose']&&console['error'](_0x3b0163(0x21a)+_0x1e9393);const _0x3610ff=await withProgressSpinner(_0x3b0163(0x1e9),async _0x2f74a7=>{const _0x29d7e1=_0x3b0163,_0x4dc9fb=await _0x326a07['query'][_0x29d7e1(0x259)](_0x1e9393,{'catalog':'td','schema':_0x29d7e1(0x1f0),'onJobId':_0x1fdb68=>{const _0x4aa890=_0x29d7e1;_0x2f74a7[_0x4aa890(0x20f)](_0x1fdb68);}});return _0x4dc9fb;},{'verbose':_0x3da05d[_0x3b0163(0x22c)]}),_0x179af4=_0x3610ff[_0x3b0163(0x1ce)],_0x50e450=_0x179af4[_0x3b0163(0x1d0)]?_0x3b0163(0x25a)+_0x179af4[_0x3b0163(0x1d0)]+']':'';return console[_0x3b0163(0x24a)](_0x3b0163(0x24e)+_0x179af4['stats'][_0x3b0163(0x210)]['toLocaleString']()+_0x3b0163(0x21f)+('in\x20'+formatElapsed(_0x179af4[_0x3b0163(0x1de)][_0x3b0163(0x1db)])+_0x50e450)),await handleQueryOutput(_0x179af4,_0x3da05d),0x0;}catch(_0x255316){if(_0x255316 instanceof SDKError)return console[_0x3b0163(0x24a)](_0x3b0163(0x23e)+_0x255316['code']+']'),console[_0x3b0163(0x24a)]('\x0a'+_0x255316[_0x3b0163(0x1eb)]),0x1;throw _0x255316;}}}export class SegmentFolderListCommand extends BaseCommand{['name']='segment:folder:list';[a47_0x3d5352(0x1fe)]=a47_0x3d5352(0x1cf);async[a47_0x3d5352(0x259)](_0x416f20){const _0x4e63e4=a47_0x3d5352,{options:_0x29359f,args:_0x2451a2,tdx:_0x5c1451}=_0x416f20;if(_0x2451a2[_0x4e63e4(0x21c)]===0x0)return console[_0x4e63e4(0x24a)](_0x4e63e4(0x1da)),console[_0x4e63e4(0x24a)](_0x4e63e4(0x271)),0x1;const _0x34b737=_0x2451a2[0x0];try{_0x29359f['verbose']&&(console['error'](_0x4e63e4(0x22d)+_0x29359f['site']),console[_0x4e63e4(0x24a)](_0x4e63e4(0x224)+_0x34b737));const _0x55c705=await withSpinner(_0x4e63e4(0x1d7)+_0x34b737+_0x4e63e4(0x24c),()=>_0x5c1451['segment']['resolveParentId'](_0x34b737),{'verbose':_0x29359f['verbose']}),_0x4e7a57=_0x55c705[_0x4e63e4(0x1ce)];_0x29359f[_0x4e63e4(0x22c)]&&console['error'](_0x4e63e4(0x1e8)+_0x4e7a57);const _0x38f982=await withSpinner(_0x4e63e4(0x1d5)+_0x34b737+'\x27...',()=>_0x5c1451[_0x4e63e4(0x26f)][_0x4e63e4(0x22e)](_0x4e7a57),{'verbose':_0x29359f[_0x4e63e4(0x22c)]}),_0x443d93=_0x38f982['data'];return console[_0x4e63e4(0x24a)]('✔\x20Found\x20'+_0x443d93['length']+_0x4e63e4(0x1cc)+(_0x443d93[_0x4e63e4(0x21c)]!==0x1?'s':'')),await handleSDKOutput(_0x443d93,_0x29359f),0x0;}catch(_0x1b8506){if(_0x1b8506 instanceof SDKError)return console['error'](_0x4e63e4(0x25c)+_0x1b8506[_0x4e63e4(0x1eb)]),_0x1b8506[_0x4e63e4(0x232)]&&console[_0x4e63e4(0x24a)]('\x20\x20Cause:\x20'+_0x1b8506['cause']),0x1;throw _0x1b8506;}}}export class SegmentFolderShowCommand extends BaseCommand{[a47_0x3d5352(0x251)]=a47_0x3d5352(0x1ff);[a47_0x3d5352(0x1fe)]=a47_0x3d5352(0x221);async[a47_0x3d5352(0x259)](_0x2c5c2f){const _0xc0e57c=a47_0x3d5352,{options:_0x5dfb2c,args:_0x4242c3,tdx:_0x2112b9}=_0x2c5c2f;if(_0x4242c3[_0xc0e57c(0x21c)]===0x0)return console[_0xc0e57c(0x24a)]('Error:\x20Folder\x20reference\x20is\x20required'),console['error']('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x32cf7b,childId:_0x3a82ce}=parseSegmentRef(_0x4242c3[0x0]);_0x5dfb2c[_0xc0e57c(0x22c)]&&(console[_0xc0e57c(0x24a)](_0xc0e57c(0x22d)+_0x5dfb2c[_0xc0e57c(0x201)]),console[_0xc0e57c(0x24a)](_0xc0e57c(0x224)+_0x32cf7b),_0x3a82ce&&console[_0xc0e57c(0x24a)](_0xc0e57c(0x242)+_0x3a82ce));if(!_0x3a82ce)return console[_0xc0e57c(0x24a)](_0xc0e57c(0x1df)),0x1;const _0x2032d6=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x32cf7b+_0xc0e57c(0x24c),()=>_0x2112b9[_0xc0e57c(0x26f)][_0xc0e57c(0x219)](_0x32cf7b),{'verbose':_0x5dfb2c[_0xc0e57c(0x22c)]}),_0x84787d=_0x2032d6[_0xc0e57c(0x1ce)];_0x5dfb2c[_0xc0e57c(0x22c)]&&console[_0xc0e57c(0x24a)](_0xc0e57c(0x1e8)+_0x84787d);const _0x1674f9=await withSpinner(_0xc0e57c(0x1ee)+_0x3a82ce+_0xc0e57c(0x24c),()=>_0x2112b9[_0xc0e57c(0x26f)][_0xc0e57c(0x266)](_0x84787d,_0x3a82ce),{'verbose':_0x5dfb2c['verbose']}),_0x4b31ef=_0x1674f9[_0xc0e57c(0x1ce)];_0x5dfb2c[_0xc0e57c(0x22c)]&&console[_0xc0e57c(0x24a)](_0xc0e57c(0x217)+_0x4b31ef);const _0x33d7e0=await withSpinner(_0xc0e57c(0x230)+_0x3a82ce+'\x27...',()=>_0x2112b9[_0xc0e57c(0x26f)][_0xc0e57c(0x238)](_0x4b31ef),{'verbose':_0x5dfb2c[_0xc0e57c(0x22c)]});return await handleSDKOutput([_0x33d7e0[_0xc0e57c(0x1ce)]],_0x5dfb2c),0x0;}catch(_0x162588){if(_0x162588 instanceof SDKError)return console['error'](_0xc0e57c(0x25c)+_0x162588[_0xc0e57c(0x1eb)]),_0x162588['cause']&&console[_0xc0e57c(0x24a)](_0xc0e57c(0x1f7)+_0x162588[_0xc0e57c(0x232)]),0x1;throw _0x162588;}}}export class SegmentSQLCommand extends BaseCommand{[a47_0x3d5352(0x251)]=a47_0x3d5352(0x226);[a47_0x3d5352(0x1fe)]=a47_0x3d5352(0x244);async[a47_0x3d5352(0x259)](_0x3552f3){const _0x4f05e3=a47_0x3d5352,{options:_0x46027c,args:_0x216919}=_0x3552f3,_0x43c1e4=_0x46027c,_0x590808=_0x43c1e4[_0x4f05e3(0x246)],_0x3e3c67=_0x216919[0x0];if(!_0x3e3c67&&!_0x590808)return console[_0x4f05e3(0x24a)](a47_0x155c19[_0x4f05e3(0x213)]('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console[_0x4f05e3(0x24a)](_0x4f05e3(0x276)),console[_0x4f05e3(0x24a)](_0x4f05e3(0x1e2)),console[_0x4f05e3(0x24a)](_0x4f05e3(0x253)),console[_0x4f05e3(0x24a)](_0x4f05e3(0x1f2)),console[_0x4f05e3(0x24a)](_0x4f05e3(0x1dc)),console[_0x4f05e3(0x24a)](_0x4f05e3(0x22f)),0x1;if(_0x3e3c67&&_0x590808)return console[_0x4f05e3(0x24a)](a47_0x155c19['red'](_0x4f05e3(0x212))),0x1;try{let _0x2243f9;if(_0x590808)_0x2243f9=await this[_0x4f05e3(0x1f9)](_0x590808,_0x3552f3);else{if(isYamlFilePath(_0x3e3c67))return console[_0x4f05e3(0x24a)](a47_0x155c19[_0x4f05e3(0x213)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x4f05e3(0x24a)](_0x4f05e3(0x1ef)+_0x3e3c67),0x1;else _0x2243f9=await this[_0x4f05e3(0x233)](_0x3e3c67,_0x3552f3);}return _0x46027c[_0x4f05e3(0x239)]===_0x4f05e3(0x273)||_0x46027c['format']===_0x4f05e3(0x20d)?await handleSDKOutput([{'sql':_0x2243f9}],_0x46027c):console[_0x4f05e3(0x23f)](_0x2243f9),0x0;}catch(_0x382e4e){if(_0x382e4e instanceof SDKError)return console['error'](_0x4f05e3(0x25c)+_0x382e4e[_0x4f05e3(0x1eb)]),_0x382e4e[_0x4f05e3(0x232)]&&console[_0x4f05e3(0x24a)](_0x4f05e3(0x1f7)+_0x382e4e[_0x4f05e3(0x232)]),0x1;throw _0x382e4e;}}async['getSQLFromYamlFile'](_0x1d1235,_0x460d8f){const _0x5c1fa9=a47_0x3d5352,{options:_0x3ee237,tdx:_0x4bc1c3}=_0x460d8f;let _0x5120f0;try{_0x5120f0=await resolveYamlFilePath(_0x1d1235);}catch(_0x31fcf8){throw new SDKError(ErrorCode[_0x5c1fa9(0x26b)],_0x5c1fa9(0x26d)+_0x31fcf8[_0x5c1fa9(0x1eb)]);}_0x3ee237[_0x5c1fa9(0x22c)]&&console['error'](_0x5c1fa9(0x275)+_0x5120f0[_0x5c1fa9(0x1e5)]+'/'+_0x5120f0['segmentName']);const _0x1a46b2=await withSpinner(_0x5c1fa9(0x277),()=>_0x4bc1c3[_0x5c1fa9(0x26f)][_0x5c1fa9(0x207)](_0x5120f0[_0x5c1fa9(0x1d6)],_0x5120f0[_0x5c1fa9(0x1e5)],_0x5120f0[_0x5c1fa9(0x222)]),{'verbose':_0x3ee237[_0x5c1fa9(0x22c)]});return _0x1a46b2[_0x5c1fa9(0x1ce)];}async[a47_0x3d5352(0x233)](_0x2dd27e,_0x20046b){const _0x37138c=a47_0x3d5352,{options:_0x259b88,tdx:_0x4bd666}=_0x20046b,_0x921f5c=_0x259b88['parentSegment'],_0x310f47=await resolveSegmentTarget(_0x2dd27e,_0x921f5c,_0x259b88[_0x37138c(0x22c)]);_0x259b88[_0x37138c(0x22c)]&&console[_0x37138c(0x24a)](_0x37138c(0x236)+_0x310f47);const _0x43ca99=await withSpinner(_0x37138c(0x220)+_0x2dd27e+'\x27...',()=>_0x4bd666[_0x37138c(0x26f)][_0x37138c(0x263)](_0x310f47),{'verbose':_0x259b88[_0x37138c(0x22c)]}),_0x5b5f58=_0x43ca99[_0x37138c(0x1ce)];_0x259b88[_0x37138c(0x22c)]&&(console[_0x37138c(0x24a)](_0x37138c(0x231)+_0x5b5f58[_0x37138c(0x272)]),console['error']('Parent\x20ID:\x20'+_0x5b5f58[_0x37138c(0x1f8)]));if(_0x5b5f58[_0x37138c(0x272)]===_0x37138c(0x215))throw new SDKError(ErrorCode[_0x37138c(0x26b)],_0x37138c(0x209));if(_0x5b5f58[_0x37138c(0x272)]==='parent')throw new SDKError(ErrorCode[_0x37138c(0x26b)],_0x37138c(0x255));if(!_0x5b5f58[_0x37138c(0x1e3)])throw new SDKError(ErrorCode[_0x37138c(0x216)],_0x37138c(0x229));const _0x58eefe=await withSpinner(_0x37138c(0x23c),()=>_0x4bd666[_0x37138c(0x26f)][_0x37138c(0x260)](_0x5b5f58[_0x37138c(0x1f8)],_0x5b5f58['segmentId']),{'verbose':_0x259b88[_0x37138c(0x22c)]});return _0x58eefe[_0x37138c(0x1ce)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a47_0x3d5352(0x251)]='segment:folder:create';[a47_0x3d5352(0x1fe)]=a47_0x3d5352(0x228);async['execute'](_0x50516b){const _0x2d2181=a47_0x3d5352,{options:_0x462e1c,args:_0x39555a,tdx:_0x598bbd}=_0x50516b,_0x407a6f=_0x462e1c;if(_0x39555a['length']<0x2)return console[_0x2d2181(0x24a)](_0x2d2181(0x25e)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x2f2e64=_0x39555a[0x0],_0x2f2760=_0x39555a[0x1];_0x407a6f[_0x2d2181(0x22c)]&&(console['error'](_0x2d2181(0x22d)+_0x407a6f[_0x2d2181(0x201)]),console['error']('Parent\x20segment:\x20'+_0x2f2e64),console[_0x2d2181(0x24a)](_0x2d2181(0x242)+_0x2f2760));let _0x43ad11;if(_0x407a6f['parentFolder']){const _0x2844b4=_0x407a6f[_0x2d2181(0x206)],_0x306b5f=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2f2e64+_0x2d2181(0x24c),()=>_0x598bbd[_0x2d2181(0x26f)][_0x2d2181(0x219)](_0x2f2e64),{'verbose':_0x407a6f['verbose']}),_0x9e391=_0x306b5f[_0x2d2181(0x1ce)],_0x4748c5=await withSpinner(_0x2d2181(0x1f4)+_0x2844b4+'\x27...',()=>_0x598bbd[_0x2d2181(0x26f)][_0x2d2181(0x266)](_0x9e391,_0x2844b4),{'verbose':_0x407a6f[_0x2d2181(0x22c)]});_0x43ad11=_0x4748c5[_0x2d2181(0x1ce)],_0x407a6f[_0x2d2181(0x22c)]&&console[_0x2d2181(0x24a)](_0x2d2181(0x21e)+_0x43ad11);}const _0x495017={'name':_0x2f2760,'description':_0x407a6f[_0x2d2181(0x1fe)],'parentFolderId':_0x43ad11},_0x1790c5=await withSpinner(_0x2d2181(0x1fc)+_0x2f2760+_0x2d2181(0x24c),()=>_0x598bbd[_0x2d2181(0x26f)]['createFolder'](_0x2f2e64,_0x495017),{'verbose':_0x407a6f['verbose']}),_0x4c8dc2=_0x1790c5[_0x2d2181(0x1ce)];return console['error'](_0x2d2181(0x256)+_0x4c8dc2['name']+'\x27\x20with\x20ID:\x20'+_0x4c8dc2['id']),await handleSDKOutput([_0x4c8dc2],_0x407a6f),0x0;}}function a47_0x59f8(){const _0x444296=['4KsEzbb','verbose','Site:\x20','listFolders','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Fetching\x20folder\x20\x27','Resolved\x20type:\x20','cause','getSQLFromServerSegment','folderPath','Fetching\x20parent\x20segment\x20details...','Target\x20path:\x20','36965236KkfZCW','getFolder','format','fullPath','Use:\x20tdx\x20ps\x20desc','Fetching\x20SQL\x20for\x20segment...','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','✖\x20Query\x20failed\x20[','log','SELECT\x20*\x20FROM\x20(\x0a','limit','Folder\x20name:\x20','Fetching\x20segment\x20details...','Get\x20SQL\x20query\x20for\x20child\x20segment','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','path','includes','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','parent','error','segment:desc','\x27...','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','name','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Parent\x20ID:\x20','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','✔\x20Created\x20folder\x20\x27','848280UsEtUu','/e/','execute','\x20[Job\x20ID:\x20','test','Error:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20Segment\x20name:\x20','getSegmentSQL','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','resolvePathToResource','segmentPath','\x20\x20Folder\x20path:\x20','resolveFolderId','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','getSegment','Usage:\x20tdx\x20sg\x20desc\x20<name>','Show\x20child\x20segment\x20schema\x20(column\x20types)','INVALID_ARGUMENT','green','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Folder\x20ID:\x20','segment','SEGMENT_FOLDER_NOT_FOUND','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','type','json','3508152IuroEY','Resolved:\x20','Usage:','Fetching\x20SQL\x20from\x20rule...','2601hkuXHO','\x20folder','185Qmrkon','data','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','jobId','Segment\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','cyan','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Listing\x20folders\x20for\x20parent\x20\x27','content','Resolving\x20parent\x20segment\x20\x27','Fetching\x20folder\x20details...','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Error:\x20Parent\x20segment\x20name\x20is\x20required','elapsedTimeMillis','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','folderId','stats','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Resolving\x20path\x20\x27','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','segmentId','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','parentSegment','Usage:\x20tdx\x20segment\x20describe\x20<path>','Options:','Resolved\x20parent\x20ID:\x20','Executing\x20segment\x20query...','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','message','(root)','replace','Resolving\x20folder\x20\x27','\x20\x20tdx\x20sg\x20sql\x20--path\x20','information_schema','Resolved\x20relative\x20path\x20to:\x20','Examples:','web','Resolving\x20parent\x20folder\x20\x27','4015140vHJpSo','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20Cause:\x20','parentId','getSQLFromYamlFile','Resolved\x20YAML\x20file:\x20','36520ouCrcc','Creating\x20folder\x20\x27','309774xUakaF','description','segment:folder:show','Error:\x20Path\x20or\x20name\x20is\x20required','site','segment:view','2786Deybzp','\x20Opening\x20','segment:describe','parentFolder','getSegmentSQLFromYaml','Show\x20folder\x20or\x20child\x20segment\x20details','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Use:\x20tdx\x20ps\x20show','Show\x20segment\x20or\x20folder\x20details','jsonl','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','setJobId','processedRows','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','red','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','folder','SEGMENT_NOT_FOUND','Resolved\x20folder\x20ID:\x20','\x20\x20Parent\x20segment:\x20','resolveParentId','SQL\x20query:\x0a','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','length','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Resolved\x20parent\x20folder\x20ID:\x20','\x20rows\x20','Resolving\x20\x27','Show\x20segment\x20folder\x20details','segmentName','31550mqzAne','Parent\x20name:\x20','Use:\x20tdx\x20ps\x20view','segment:sql','\x20\x20Full\x20path:\x20','Create\x20segment\x20folder\x20for\x20organization','Segment\x20ID\x20missing\x20from\x20resolved\x20path','/app/ps/'];a47_0x59f8=function(){return _0x444296;};return a47_0x59f8();}export class SegmentViewCommand extends BaseCommand{[a47_0x3d5352(0x251)]=a47_0x3d5352(0x202);['description']=a47_0x3d5352(0x208);async[a47_0x3d5352(0x259)](_0x2c6fd6){const _0x2687ed=a47_0x3d5352,{options:_0x2d349e,args:_0x49b1d7,tdx:_0x4c5f25}=_0x2c6fd6,_0x837921=_0x49b1d7[0x0];if(!_0x837921)return console[_0x2687ed(0x24a)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x2687ed(0x24a)](_0x2687ed(0x23d)),console[_0x2687ed(0x24a)](_0x2687ed(0x24f)),console[_0x2687ed(0x24a)](_0x2687ed(0x1e7)),console[_0x2687ed(0x24a)](_0x2687ed(0x25d)),console[_0x2687ed(0x24a)](_0x2687ed(0x1f2)),console[_0x2687ed(0x24a)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x2687ed(0x24a)](_0x2687ed(0x262)),console[_0x2687ed(0x24a)](_0x2687ed(0x21d)),console[_0x2687ed(0x24a)](_0x2687ed(0x1ea)),0x1;try{const _0x1d8d01=_0x2d349e[_0x2687ed(0x1e5)],_0x3da73e=await resolveSegmentTarget(_0x837921,_0x1d8d01,_0x2d349e[_0x2687ed(0x22c)]);_0x2d349e[_0x2687ed(0x22c)]&&console['error'](_0x2687ed(0x236)+_0x3da73e);const _0xbca35=await withSpinner(_0x2687ed(0x220)+_0x837921+_0x2687ed(0x24c),()=>_0x4c5f25[_0x2687ed(0x26f)][_0x2687ed(0x263)](_0x3da73e),{'verbose':_0x2d349e[_0x2687ed(0x22c)]}),_0x196423=_0xbca35[_0x2687ed(0x1ce)];_0x2d349e[_0x2687ed(0x22c)]&&(console['error'](_0x2687ed(0x231)+_0x196423['type']),console[_0x2687ed(0x24a)](_0x2687ed(0x254)+_0x196423['parentId']),_0x196423['folderId']&&console[_0x2687ed(0x24a)]('Folder\x20ID:\x20'+_0x196423[_0x2687ed(0x1dd)]),_0x196423[_0x2687ed(0x1e3)]&&console['error'](_0x2687ed(0x1d1)+_0x196423['segmentId']));if(_0x2d349e[_0x2687ed(0x1f3)]){if(_0x196423[_0x2687ed(0x272)]===_0x2687ed(0x215))return console[_0x2687ed(0x24a)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x196423['type']===_0x2687ed(0x249))return console[_0x2687ed(0x24a)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x2687ed(0x24a)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x196423[_0x2687ed(0x1e3)])throw new SDKError(ErrorCode[_0x2687ed(0x216)],_0x2687ed(0x229));const _0x5e8e2c=getConsoleNextUrl(_0x2d349e[_0x2687ed(0x201)],_0x2687ed(0x22a)+_0x196423[_0x2687ed(0x1f8)]+'/e/'+_0x196423[_0x2687ed(0x1e3)]);return console[_0x2687ed(0x24a)](a47_0x155c19[_0x2687ed(0x26c)]('✔')+_0x2687ed(0x204)+a47_0x155c19[_0x2687ed(0x1d3)](_0x5e8e2c)),openBrowser(_0x5e8e2c),0x0;}if(_0x196423['type']===_0x2687ed(0x215)){if(!_0x196423[_0x2687ed(0x1dd)])throw new SDKError(ErrorCode[_0x2687ed(0x270)],_0x2687ed(0x1f6));const _0x4ebc28=await withSpinner('Fetching\x20folder\x20details...',()=>_0x4c5f25[_0x2687ed(0x26f)][_0x2687ed(0x238)](_0x196423[_0x2687ed(0x1dd)]),{'verbose':_0x2d349e['verbose']});await handleSingleObjectOutput(_0x4ebc28[_0x2687ed(0x1ce)],_0x2d349e);}else{if(_0x196423[_0x2687ed(0x272)]===_0x2687ed(0x26f)){if(!_0x196423[_0x2687ed(0x1e3)])throw new SDKError(ErrorCode[_0x2687ed(0x216)],_0x2687ed(0x229));const _0x1f3c01=await withSpinner(_0x2687ed(0x243),()=>_0x4c5f25[_0x2687ed(0x26f)][_0x2687ed(0x268)](_0x196423[_0x2687ed(0x1f8)],_0x196423[_0x2687ed(0x1e3)]),{'verbose':_0x2d349e[_0x2687ed(0x22c)]}),_0x57ce94=getConsoleNextUrl(_0x2d349e[_0x2687ed(0x201)],_0x2687ed(0x22a)+_0x196423[_0x2687ed(0x1f8)]+_0x2687ed(0x258)+_0x196423[_0x2687ed(0x1e3)]),_0x3c639f=_0x1f3c01['data'];_0x3c639f['url']=_0x57ce94,await handleSingleObjectOutput(_0x3c639f,_0x2d349e);}else return console[_0x2687ed(0x24a)](_0x2687ed(0x214)),console[_0x2687ed(0x24a)](_0x2687ed(0x225)),0x1;}return 0x0;}catch(_0x31be5e){if(_0x31be5e instanceof SDKError)return console['error'](_0x2687ed(0x25c)+_0x31be5e['message']),_0x31be5e[_0x2687ed(0x232)]&&console['error'](_0x2687ed(0x1f7)+_0x31be5e[_0x2687ed(0x232)]),0x1;throw _0x31be5e;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a47_0x3d5352(0x24b);[a47_0x3d5352(0x1fe)]=a47_0x3d5352(0x26a);async[a47_0x3d5352(0x259)](_0x845c9){const _0x4db101=a47_0x3d5352,{options:_0x589f30,args:_0x33db53,tdx:_0x18eada}=_0x845c9,_0x4f2546=_0x33db53[0x0];if(!_0x4f2546)return console['error'](_0x4db101(0x20a)),console[_0x4db101(0x24a)](_0x4db101(0x269)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x4db101(0x24a)](_0x4db101(0x1f2)),console['error'](_0x4db101(0x1d9)),console[_0x4db101(0x24a)](_0x4db101(0x1e1)),0x1;try{const _0x3cac8e=_0x589f30['parentSegment'],_0x5144a3=await resolveSegmentTarget(_0x4f2546,_0x3cac8e,_0x589f30[_0x4db101(0x22c)]);_0x589f30[_0x4db101(0x22c)]&&console['error'](_0x4db101(0x236)+_0x5144a3);const _0x2bb3be=await withSpinner(_0x4db101(0x220)+_0x4f2546+_0x4db101(0x24c),()=>_0x18eada[_0x4db101(0x26f)]['resolvePathToResource'](_0x5144a3),{'verbose':_0x589f30[_0x4db101(0x22c)]}),_0x4d29d8=_0x2bb3be[_0x4db101(0x1ce)];_0x589f30[_0x4db101(0x22c)]&&(console[_0x4db101(0x24a)](_0x4db101(0x231)+_0x4d29d8[_0x4db101(0x272)]),console['error'](_0x4db101(0x254)+_0x4d29d8[_0x4db101(0x1f8)]));if(_0x4d29d8['type']==='folder')return console[_0x4db101(0x24a)](_0x4db101(0x245)),console['error'](_0x4db101(0x24d)),0x1;if(_0x4d29d8['type']===_0x4db101(0x249))return console[_0x4db101(0x24a)](_0x4db101(0x261)),console[_0x4db101(0x24a)](_0x4db101(0x23b)),0x1;if(!_0x4d29d8[_0x4db101(0x1e3)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4db101(0x229));const _0x369b5b=await withSpinner(_0x4db101(0x23c),()=>_0x18eada[_0x4db101(0x26f)][_0x4db101(0x260)](_0x4d29d8[_0x4db101(0x1f8)],_0x4d29d8[_0x4db101(0x1e3)]),{'verbose':_0x589f30[_0x4db101(0x22c)]}),_0x3544ad=_0x369b5b[_0x4db101(0x1ce)],_0x12ec22=await executeSchemaQuery(_0x3544ad,_0x18eada,_0x589f30);return await handleQueryOutput(_0x12ec22,_0x589f30),0x0;}catch(_0x5d89a8){if(_0x5d89a8 instanceof SDKError)return console[_0x4db101(0x24a)]('Error:\x20'+_0x5d89a8[_0x4db101(0x1eb)]),_0x5d89a8['cause']&&console[_0x4db101(0x24a)](_0x4db101(0x1f7)+_0x5d89a8[_0x4db101(0x232)]),0x1;throw _0x5d89a8;}}}
1
+ const a47_0x5179c2=a47_0x522a;(function(_0x2f282e,_0x2030da){const _0x4b996b=a47_0x522a,_0x1a89a3=_0x2f282e();while(!![]){try{const _0x34e938=-parseInt(_0x4b996b(0x1f9))/0x1+parseInt(_0x4b996b(0x1d0))/0x2+parseInt(_0x4b996b(0x232))/0x3+-parseInt(_0x4b996b(0x240))/0x4+parseInt(_0x4b996b(0x1e7))/0x5+-parseInt(_0x4b996b(0x25f))/0x6+parseInt(_0x4b996b(0x253))/0x7;if(_0x34e938===_0x2030da)break;else _0x1a89a3['push'](_0x1a89a3['shift']());}catch(_0x79e705){_0x1a89a3['push'](_0x1a89a3['shift']());}}}(a47_0x252a,0xc902e));function a47_0x252a(){const _0x413f21=['Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','5546184KmSjly','Resolving\x20\x27','Executing\x20segment\x20query...','SEGMENT_FOLDER_NOT_FOUND','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Segment\x20ID:\x20','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Examples:','length','Site:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Resolving\x20path\x20\x27','content','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20folder','parentId','folderPath','5777338QurHFv','\x20rows\x20','toLocaleString','Use:\x20tdx\x20ps\x20show','red','getParent','Fetching\x20folder\x20details...','Fetching\x20SQL\x20for\x20segment...','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','segment:folder:list','resolvePathToResource','url','969396eEzhWa','getSQLFromServerSegment','name','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Fetching\x20folder\x20\x27','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','parentSegment','segment','getSQLFromYamlFile','Usage:\x20tdx\x20sg\x20show\x20<name>','getSegmentSQLFromYaml','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20\x20Cause:\x20','segment:show','Error:\x20','jobId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','segment:folder:create','2905936QQVOqP','getSegmentSQL','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20[Job\x20ID:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','setJobId','INVALID_ARGUMENT','format','processedRows','getFolder','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Folder\x20name:\x20','Target\x20path:\x20','Options:','error','Fetching\x20SQL\x20from\x20rule...','stats','Resolved\x20type:\x20','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','/e/','Create\x20segment\x20folder\x20for\x20organization','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','4259510waFsto','Resolved\x20folder\x20ID:\x20','Show\x20segment\x20or\x20folder\x20details','json','Fetching\x20segment\x20details...','trim','Show\x20folder\x20or\x20child\x20segment\x20details','Resolved\x20parent\x20folder\x20ID:\x20','parent','web','SQL\x20query:\x0a','Creating\x20folder\x20\x27','Resolved\x20YAML\x20file:\x20','Fetching\x20parent\x20segment\x20details...','code','segmentId','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','1368398TIvLWF','Listing\x20folders\x20for\x20parent\x20\x27','in\x20','verbose','segmentPath','cause','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','✔\x20Query\x20completed:\x20Processed\x20','getSegment','query','Resolved\x20parent\x20ID:\x20','Parent\x20segment:\x20','segment:describe','Use:\x20tdx\x20ps\x20view','listFolders','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','SEGMENT_NOT_FOUND','description','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Folder\x20ID\x20missing\x20from\x20resolved\x20path','folder','includes','replace','message','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Resolving\x20parent\x20segment\x20\x27','Show\x20segment\x20folder\x20details','information_schema','Resolved\x20relative\x20path\x20to:\x20','segment:view','(root)','SELECT\x20*\x20FROM\x20(\x0a','type','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Folder\x20ID:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Resolved:\x20','data','Error:\x20Path\x20or\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','resolveFolderId','site','path','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Parent\x20name:\x20','segment:desc','createFolder','fullPath','folderId','green','segment:folder:show','1828944SkncwP','Parent\x20ID:\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','jsonl','execute','✔\x20Found\x20','✖\x20Query\x20failed\x20[','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x27...','segmentName','Segment\x20ID\x20missing\x20from\x20resolved\x20path','test'];a47_0x252a=function(){return _0x413f21;};return a47_0x252a();}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a47_0x522a(_0x2df0e6,_0x21e3ab){_0x2df0e6=_0x2df0e6-0x1c1;const _0x252a6a=a47_0x252a();let _0x522a52=_0x252a6a[_0x2df0e6];return _0x522a52;}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 a47_0x428333 from'chalk';async function resolveSegmentTarget(_0x3bc848,_0x1e71de,_0x22f169){const _0x77caa6=a47_0x522a;if(isYamlFilePath(_0x3bc848))try{const _0x32dbc1=await resolveYamlFilePath(_0x3bc848);return _0x22f169&&(console[_0x77caa6(0x1df)](_0x77caa6(0x1f3)+_0x3bc848),console['error']('\x20\x20Parent\x20segment:\x20'+_0x32dbc1[_0x77caa6(0x1c2)]),console[_0x77caa6(0x1df)]('\x20\x20Segment\x20name:\x20'+_0x32dbc1[_0x77caa6(0x23b)]),console['error']('\x20\x20Folder\x20path:\x20'+(_0x32dbc1[_0x77caa6(0x252)]||_0x77caa6(0x21d))),console['error']('\x20\x20Full\x20path:\x20'+_0x32dbc1['fullPath'])),_0x32dbc1[_0x77caa6(0x22e)];}catch(_0x38769d){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x77caa6(0x23e)+_0x38769d[_0x77caa6(0x214)]);}if(!_0x1e71de)throw new SDKError(ErrorCode[_0x77caa6(0x1d7)],_0x77caa6(0x262));return _0x1e71de+'/'+_0x3bc848;}export class SegmentDescribeCommand extends BaseCommand{['name']=a47_0x5179c2(0x205);[a47_0x5179c2(0x20b)]=a47_0x5179c2(0x1e9);async[a47_0x5179c2(0x236)](_0x2e3ae3){const _0x9ccc40=a47_0x5179c2,{options:_0x561383,args:_0x1f1e26,tdx:_0xb85571}=_0x2e3ae3,_0x51a6a1=_0x1f1e26[0x0],_0x4035be=!_0x51a6a1&&!!_0x561383[_0x9ccc40(0x1c2)],_0x26752e=_0x51a6a1||_0x561383[_0x9ccc40(0x1c2)];if(!_0x26752e)return console[_0x9ccc40(0x1df)](_0x9ccc40(0x225)),console[_0x9ccc40(0x1df)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x9ccc40(0x1df)](_0x9ccc40(0x248)),console[_0x9ccc40(0x1df)](_0x9ccc40(0x222)),console[_0x9ccc40(0x1df)](_0x9ccc40(0x22a)),console[_0x9ccc40(0x1df)](_0x9ccc40(0x20e)),console[_0x9ccc40(0x1df)](_0x9ccc40(0x209)),0x1;try{const _0x48b7de=_0x561383[_0x9ccc40(0x1fd)];let _0x3cc78f=_0x26752e;!_0x4035be&&_0x48b7de&&!_0x26752e[_0x9ccc40(0x212)]('/')&&(_0x3cc78f=_0x48b7de+'/'+_0x26752e,_0x561383[_0x9ccc40(0x1fc)]&&console['error'](_0x9ccc40(0x21b)+_0x3cc78f));const _0x99124c=await withSpinner(_0x9ccc40(0x24c)+_0x3cc78f+_0x9ccc40(0x23a),()=>_0xb85571['segment'][_0x9ccc40(0x25d)](_0x3cc78f),{'verbose':_0x561383['verbose']}),_0x304feb=_0x99124c[_0x9ccc40(0x224)];_0x561383[_0x9ccc40(0x1fc)]&&(console[_0x9ccc40(0x1df)]('Resolved\x20type:\x20'+_0x304feb[_0x9ccc40(0x21f)]),console[_0x9ccc40(0x1df)]('Parent\x20ID:\x20'+_0x304feb['parentId']),_0x304feb[_0x9ccc40(0x22f)]&&console[_0x9ccc40(0x1df)](_0x9ccc40(0x221)+_0x304feb[_0x9ccc40(0x22f)]),_0x304feb[_0x9ccc40(0x1f6)]&&console['error'](_0x9ccc40(0x246)+_0x304feb[_0x9ccc40(0x1f6)]));if(_0x304feb['type']===_0x9ccc40(0x1ef)){const _0x3937a4=await withSpinner(_0x9ccc40(0x1f4),()=>_0xb85571[_0x9ccc40(0x1c3)][_0x9ccc40(0x258)](_0x304feb[_0x9ccc40(0x251)]),{'verbose':_0x561383[_0x9ccc40(0x1fc)]});await handleSingleObjectOutput(_0x3937a4[_0x9ccc40(0x224)],_0x561383);}else{if(_0x304feb[_0x9ccc40(0x21f)]===_0x9ccc40(0x211)){if(!_0x304feb[_0x9ccc40(0x22f)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x9ccc40(0x210));const _0x596cc4=await withSpinner(_0x9ccc40(0x259),()=>_0xb85571[_0x9ccc40(0x1c3)][_0x9ccc40(0x1da)](_0x304feb[_0x9ccc40(0x22f)]),{'verbose':_0x561383[_0x9ccc40(0x1fc)]});await handleSingleObjectOutput(_0x596cc4[_0x9ccc40(0x224)],_0x561383);}else{if(_0x304feb[_0x9ccc40(0x21f)]===_0x9ccc40(0x1c3)){if(!_0x304feb[_0x9ccc40(0x1f6)])throw new SDKError(ErrorCode[_0x9ccc40(0x20a)],_0x9ccc40(0x23c));const _0x1a2375=await withSpinner(_0x9ccc40(0x1eb),()=>_0xb85571[_0x9ccc40(0x1c3)][_0x9ccc40(0x201)](_0x304feb[_0x9ccc40(0x251)],_0x304feb['segmentId']),{'verbose':_0x561383['verbose']});await handleSingleObjectOutput(_0x1a2375[_0x9ccc40(0x224)],_0x561383);}}}return 0x0;}catch(_0xda8aad){if(_0xda8aad instanceof SDKError)return console['error'](_0x9ccc40(0x1ca)+_0xda8aad['message']),_0xda8aad[_0x9ccc40(0x1fe)]&&console[_0x9ccc40(0x1df)](_0x9ccc40(0x1c8)+_0xda8aad[_0x9ccc40(0x1fe)]),0x1;throw _0xda8aad;}}}export class SegmentShowCommand extends BaseCommand{[a47_0x5179c2(0x261)]=a47_0x5179c2(0x1c9);[a47_0x5179c2(0x20b)]=a47_0x5179c2(0x25b);async[a47_0x5179c2(0x236)](_0x536e3d){const _0x4eb180=a47_0x5179c2,{options:_0x74350,args:_0x103bff,tdx:_0x3178b6}=_0x536e3d,_0x4158cb=_0x103bff[0x0];if(!_0x4158cb)return console[_0x4eb180(0x1df)](_0x4eb180(0x1d4)),console['error'](_0x4eb180(0x1c5)),console[_0x4eb180(0x1df)](_0x4eb180(0x24e)),console['error'](_0x4eb180(0x248)),console['error'](_0x4eb180(0x1c1)),console[_0x4eb180(0x1df)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x145d6a=_0x74350[_0x4eb180(0x1c2)],_0xec7d17=await resolveSegmentTarget(_0x4158cb,_0x145d6a,_0x74350[_0x4eb180(0x1fc)]);_0x74350[_0x4eb180(0x1fc)]&&console['error'](_0x4eb180(0x1dd)+_0xec7d17);const _0x470204=await withSpinner(_0x4eb180(0x241)+_0x4158cb+_0x4eb180(0x23a),()=>_0x3178b6[_0x4eb180(0x1c3)][_0x4eb180(0x25d)](_0xec7d17),{'verbose':_0x74350[_0x4eb180(0x1fc)]}),_0x27bebd=_0x470204['data'];_0x74350['verbose']&&(console[_0x4eb180(0x1df)](_0x4eb180(0x1e2)+_0x27bebd[_0x4eb180(0x21f)]),console[_0x4eb180(0x1df)]('Parent\x20ID:\x20'+_0x27bebd[_0x4eb180(0x251)]));if(_0x27bebd[_0x4eb180(0x21f)]===_0x4eb180(0x211))return console[_0x4eb180(0x1df)](_0x4eb180(0x208)),console[_0x4eb180(0x1df)](_0x4eb180(0x217)),0x1;if(_0x27bebd[_0x4eb180(0x21f)]===_0x4eb180(0x1ef))return console[_0x4eb180(0x1df)](_0x4eb180(0x1f8)),console[_0x4eb180(0x1df)](_0x4eb180(0x256)),0x1;if(!_0x27bebd['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4eb180(0x23c));const _0xae6fa7=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x3178b6[_0x4eb180(0x1c3)][_0x4eb180(0x1d1)](_0x27bebd['parentId'],_0x27bebd[_0x4eb180(0x1f6)]),{'verbose':_0x74350[_0x4eb180(0x1fc)]});let _0x56eb0f=_0xae6fa7[_0x4eb180(0x224)];const _0x48ab41=resolveLimit(_0x74350['limit'],DEFAULT_DISPLAY_LIMIT),_0x219961=/\bLIMIT\s+\d+/i[_0x4eb180(0x23d)](_0x56eb0f);!_0x219961&&(_0x56eb0f=_0x56eb0f[_0x4eb180(0x1ec)]()[_0x4eb180(0x213)](/;+$/,''),_0x56eb0f=_0x4eb180(0x21e)+_0x56eb0f+_0x4eb180(0x1cd)+_0x48ab41);_0x74350[_0x4eb180(0x1fc)]&&console[_0x4eb180(0x1df)](_0x4eb180(0x1f1)+_0x56eb0f);const _0x1c9c38=await withProgressSpinner(_0x4eb180(0x242),async _0x14cffd=>{const _0x7e5c31=_0x4eb180,_0xf234f3=await _0x3178b6[_0x7e5c31(0x202)][_0x7e5c31(0x236)](_0x56eb0f,{'catalog':'td','schema':_0x7e5c31(0x21a),'onJobId':_0x58af75=>{const _0x3ae4ec=_0x7e5c31;_0x14cffd[_0x3ae4ec(0x1d6)](_0x58af75);}});return _0xf234f3;},{'verbose':_0x74350[_0x4eb180(0x1fc)]}),_0x303eba=_0x1c9c38[_0x4eb180(0x224)],_0x4d9bef=_0x303eba[_0x4eb180(0x1cb)]?_0x4eb180(0x1d3)+_0x303eba[_0x4eb180(0x1cb)]+']':'';return console['error'](_0x4eb180(0x200)+_0x303eba[_0x4eb180(0x1e1)][_0x4eb180(0x1d9)][_0x4eb180(0x255)]()+_0x4eb180(0x254)+(_0x4eb180(0x1fb)+formatElapsed(_0x303eba[_0x4eb180(0x1e1)]['elapsedTimeMillis'])+_0x4d9bef)),await handleQueryOutput(_0x303eba,_0x74350),0x0;}catch(_0x8847a2){if(_0x8847a2 instanceof SDKError)return console['error'](_0x4eb180(0x238)+_0x8847a2[_0x4eb180(0x1f5)]+']'),console[_0x4eb180(0x1df)]('\x0a'+_0x8847a2[_0x4eb180(0x214)]),0x1;throw _0x8847a2;}}}export class SegmentFolderListCommand extends BaseCommand{[a47_0x5179c2(0x261)]=a47_0x5179c2(0x25c);[a47_0x5179c2(0x20b)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a47_0x5179c2(0x236)](_0x154435){const _0x4a9ee7=a47_0x5179c2,{options:_0x1cf1d8,args:_0x49f097,tdx:_0x54dfe7}=_0x154435;if(_0x49f097[_0x4a9ee7(0x249)]===0x0)return console[_0x4a9ee7(0x1df)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x4a9ee7(0x1df)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x2f907c=_0x49f097[0x0];try{_0x1cf1d8['verbose']&&(console[_0x4a9ee7(0x1df)](_0x4a9ee7(0x24a)+_0x1cf1d8[_0x4a9ee7(0x228)]),console['error']('Parent\x20name:\x20'+_0x2f907c));const _0x178344=await withSpinner(_0x4a9ee7(0x218)+_0x2f907c+_0x4a9ee7(0x23a),()=>_0x54dfe7['segment']['resolveParentId'](_0x2f907c),{'verbose':_0x1cf1d8['verbose']}),_0x100bdd=_0x178344['data'];_0x1cf1d8['verbose']&&console[_0x4a9ee7(0x1df)](_0x4a9ee7(0x203)+_0x100bdd);const _0x1aae7a=await withSpinner(_0x4a9ee7(0x1fa)+_0x2f907c+_0x4a9ee7(0x23a),()=>_0x54dfe7['segment'][_0x4a9ee7(0x207)](_0x100bdd),{'verbose':_0x1cf1d8[_0x4a9ee7(0x1fc)]}),_0x1b15be=_0x1aae7a[_0x4a9ee7(0x224)];return console['error'](_0x4a9ee7(0x237)+_0x1b15be[_0x4a9ee7(0x249)]+_0x4a9ee7(0x250)+(_0x1b15be['length']!==0x1?'s':'')),await handleSDKOutput(_0x1b15be,_0x1cf1d8),0x0;}catch(_0x12dbf4){if(_0x12dbf4 instanceof SDKError)return console[_0x4a9ee7(0x1df)](_0x4a9ee7(0x1ca)+_0x12dbf4[_0x4a9ee7(0x214)]),_0x12dbf4[_0x4a9ee7(0x1fe)]&&console[_0x4a9ee7(0x1df)](_0x4a9ee7(0x1c8)+_0x12dbf4['cause']),0x1;throw _0x12dbf4;}}}export class SegmentFolderShowCommand extends BaseCommand{[a47_0x5179c2(0x261)]=a47_0x5179c2(0x231);[a47_0x5179c2(0x20b)]=a47_0x5179c2(0x219);async[a47_0x5179c2(0x236)](_0x145ed2){const _0x4dd580=a47_0x5179c2,{options:_0x5d3f88,args:_0x907857,tdx:_0x28a583}=_0x145ed2;if(_0x907857[_0x4dd580(0x249)]===0x0)return console[_0x4dd580(0x1df)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x4dd580(0x1df)](_0x4dd580(0x24b)),0x1;try{const {parentId:_0x7014f5,childId:_0x1f5caf}=parseSegmentRef(_0x907857[0x0]);_0x5d3f88['verbose']&&(console[_0x4dd580(0x1df)](_0x4dd580(0x24a)+_0x5d3f88[_0x4dd580(0x228)]),console[_0x4dd580(0x1df)](_0x4dd580(0x22b)+_0x7014f5),_0x1f5caf&&console['error']('Folder\x20name:\x20'+_0x1f5caf));if(!_0x1f5caf)return console[_0x4dd580(0x1df)](_0x4dd580(0x20f)),0x1;const _0x537008=await withSpinner(_0x4dd580(0x218)+_0x7014f5+'\x27...',()=>_0x28a583[_0x4dd580(0x1c3)]['resolveParentId'](_0x7014f5),{'verbose':_0x5d3f88[_0x4dd580(0x1fc)]}),_0x5f5111=_0x537008[_0x4dd580(0x224)];_0x5d3f88[_0x4dd580(0x1fc)]&&console['error'](_0x4dd580(0x203)+_0x5f5111);const _0x289e09=await withSpinner('Resolving\x20folder\x20\x27'+_0x1f5caf+_0x4dd580(0x23a),()=>_0x28a583['segment'][_0x4dd580(0x227)](_0x5f5111,_0x1f5caf),{'verbose':_0x5d3f88[_0x4dd580(0x1fc)]}),_0xfa952c=_0x289e09[_0x4dd580(0x224)];_0x5d3f88[_0x4dd580(0x1fc)]&&console[_0x4dd580(0x1df)](_0x4dd580(0x1e8)+_0xfa952c);const _0x9fa1c8=await withSpinner(_0x4dd580(0x263)+_0x1f5caf+_0x4dd580(0x23a),()=>_0x28a583[_0x4dd580(0x1c3)][_0x4dd580(0x1da)](_0xfa952c),{'verbose':_0x5d3f88[_0x4dd580(0x1fc)]});return await handleSDKOutput([_0x9fa1c8['data']],_0x5d3f88),0x0;}catch(_0x4ac335){if(_0x4ac335 instanceof SDKError)return console[_0x4dd580(0x1df)](_0x4dd580(0x1ca)+_0x4ac335[_0x4dd580(0x214)]),_0x4ac335[_0x4dd580(0x1fe)]&&console['error'](_0x4dd580(0x1c8)+_0x4ac335[_0x4dd580(0x1fe)]),0x1;throw _0x4ac335;}}}export class SegmentSQLCommand extends BaseCommand{[a47_0x5179c2(0x261)]='segment:sql';[a47_0x5179c2(0x20b)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a47_0x5179c2(0x236)](_0x41fbda){const _0x4a32ce=a47_0x5179c2,{options:_0x283ff6,args:_0x4e3137}=_0x41fbda,_0xf4f249=_0x283ff6,_0x4c051a=_0xf4f249[_0x4a32ce(0x229)],_0x34d4d2=_0x4e3137[0x0];if(!_0x34d4d2&&!_0x4c051a)return console[_0x4a32ce(0x1df)](a47_0x428333[_0x4a32ce(0x257)](_0x4a32ce(0x1d5))),console[_0x4a32ce(0x1df)]('Usage:'),console[_0x4a32ce(0x1df)](_0x4a32ce(0x20c)),console[_0x4a32ce(0x1df)](_0x4a32ce(0x245)),console[_0x4a32ce(0x1df)](_0x4a32ce(0x248)),console[_0x4a32ce(0x1df)](_0x4a32ce(0x1e6)),console['error'](_0x4a32ce(0x1db)),0x1;if(_0x34d4d2&&_0x4c051a)return console[_0x4a32ce(0x1df)](a47_0x428333['red'](_0x4a32ce(0x247))),0x1;try{let _0x4cf30c;if(_0x4c051a)_0x4cf30c=await this[_0x4a32ce(0x1c4)](_0x4c051a,_0x41fbda);else{if(isYamlFilePath(_0x34d4d2))return console[_0x4a32ce(0x1df)](a47_0x428333[_0x4a32ce(0x257)](_0x4a32ce(0x1e3))),console['error']('\x20\x20tdx\x20sg\x20sql\x20--path\x20'+_0x34d4d2),0x1;else _0x4cf30c=await this['getSQLFromServerSegment'](_0x34d4d2,_0x41fbda);}return _0x283ff6[_0x4a32ce(0x1d8)]===_0x4a32ce(0x1ea)||_0x283ff6[_0x4a32ce(0x1d8)]===_0x4a32ce(0x235)?await handleSDKOutput([{'sql':_0x4cf30c}],_0x283ff6):console['log'](_0x4cf30c),0x0;}catch(_0x4b753b){if(_0x4b753b instanceof SDKError)return console[_0x4a32ce(0x1df)](_0x4a32ce(0x1ca)+_0x4b753b[_0x4a32ce(0x214)]),_0x4b753b[_0x4a32ce(0x1fe)]&&console[_0x4a32ce(0x1df)](_0x4a32ce(0x1c8)+_0x4b753b[_0x4a32ce(0x1fe)]),0x1;throw _0x4b753b;}}async[a47_0x5179c2(0x1c4)](_0x5b1dce,_0x1e8f7e){const _0x5a782b=a47_0x5179c2,{options:_0x55b551,tdx:_0x35b77e}=_0x1e8f7e;let _0x14e1e8;try{_0x14e1e8=await resolveYamlFilePath(_0x5b1dce);}catch(_0x539b62){throw new SDKError(ErrorCode[_0x5a782b(0x1d7)],_0x5a782b(0x23e)+_0x539b62[_0x5a782b(0x214)]);}_0x55b551[_0x5a782b(0x1fc)]&&console['error'](_0x5a782b(0x223)+_0x14e1e8[_0x5a782b(0x1c2)]+'/'+_0x14e1e8[_0x5a782b(0x23b)]);const _0x382482=await withSpinner(_0x5a782b(0x1e0),()=>_0x35b77e[_0x5a782b(0x1c3)][_0x5a782b(0x1c6)](_0x14e1e8[_0x5a782b(0x24d)],_0x14e1e8['parentSegment'],_0x14e1e8[_0x5a782b(0x23b)]),{'verbose':_0x55b551[_0x5a782b(0x1fc)]});return _0x382482['data'];}async[a47_0x5179c2(0x260)](_0x38fc87,_0x2dc7f9){const _0x4f0e82=a47_0x5179c2,{options:_0x390bc6,tdx:_0xbd429f}=_0x2dc7f9,_0x3ca616=_0x390bc6[_0x4f0e82(0x1c2)],_0x5006c5=await resolveSegmentTarget(_0x38fc87,_0x3ca616,_0x390bc6['verbose']);_0x390bc6[_0x4f0e82(0x1fc)]&&console[_0x4f0e82(0x1df)]('Target\x20path:\x20'+_0x5006c5);const _0x353571=await withSpinner('Resolving\x20\x27'+_0x38fc87+_0x4f0e82(0x23a),()=>_0xbd429f['segment']['resolvePathToResource'](_0x5006c5),{'verbose':_0x390bc6[_0x4f0e82(0x1fc)]}),_0x19b7b7=_0x353571[_0x4f0e82(0x224)];_0x390bc6['verbose']&&(console[_0x4f0e82(0x1df)](_0x4f0e82(0x1e2)+_0x19b7b7[_0x4f0e82(0x21f)]),console[_0x4f0e82(0x1df)](_0x4f0e82(0x233)+_0x19b7b7[_0x4f0e82(0x251)]));if(_0x19b7b7[_0x4f0e82(0x21f)]===_0x4f0e82(0x211))throw new SDKError(ErrorCode[_0x4f0e82(0x1d7)],_0x4f0e82(0x220));if(_0x19b7b7['type']==='parent')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4f0e82(0x1ce));if(!_0x19b7b7[_0x4f0e82(0x1f6)])throw new SDKError(ErrorCode[_0x4f0e82(0x20a)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x270f20=await withSpinner(_0x4f0e82(0x25a),()=>_0xbd429f[_0x4f0e82(0x1c3)]['getSegmentSQL'](_0x19b7b7['parentId'],_0x19b7b7[_0x4f0e82(0x1f6)]),{'verbose':_0x390bc6[_0x4f0e82(0x1fc)]});return _0x270f20[_0x4f0e82(0x224)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a47_0x5179c2(0x261)]=a47_0x5179c2(0x1cf);[a47_0x5179c2(0x20b)]=a47_0x5179c2(0x1e5);async[a47_0x5179c2(0x236)](_0x44a285){const _0x5aa972=a47_0x5179c2,{options:_0x48f292,args:_0x5abc61,tdx:_0x58cfba}=_0x44a285,_0x11460e=_0x48f292;if(_0x5abc61[_0x5aa972(0x249)]<0x2)return console['error'](_0x5aa972(0x24f)),console[_0x5aa972(0x1df)](_0x5aa972(0x226)),0x1;const _0x42c3e0=_0x5abc61[0x0],_0x38c291=_0x5abc61[0x1];_0x11460e[_0x5aa972(0x1fc)]&&(console[_0x5aa972(0x1df)](_0x5aa972(0x24a)+_0x11460e[_0x5aa972(0x228)]),console[_0x5aa972(0x1df)](_0x5aa972(0x204)+_0x42c3e0),console[_0x5aa972(0x1df)](_0x5aa972(0x1dc)+_0x38c291));let _0x1cc3ee;if(_0x11460e['parentFolder']){const _0x372e15=_0x11460e['parentFolder'],_0x339e28=await withSpinner(_0x5aa972(0x218)+_0x42c3e0+_0x5aa972(0x23a),()=>_0x58cfba[_0x5aa972(0x1c3)]['resolveParentId'](_0x42c3e0),{'verbose':_0x11460e[_0x5aa972(0x1fc)]}),_0x56ee76=_0x339e28['data'],_0xd60f81=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x372e15+'\x27...',()=>_0x58cfba[_0x5aa972(0x1c3)][_0x5aa972(0x227)](_0x56ee76,_0x372e15),{'verbose':_0x11460e[_0x5aa972(0x1fc)]});_0x1cc3ee=_0xd60f81['data'],_0x11460e['verbose']&&console[_0x5aa972(0x1df)](_0x5aa972(0x1ee)+_0x1cc3ee);}const _0x5b5ce7={'name':_0x38c291,'description':_0x11460e['description'],'parentFolderId':_0x1cc3ee},_0x5de178=await withSpinner(_0x5aa972(0x1f2)+_0x38c291+'\x27...',()=>_0x58cfba['segment'][_0x5aa972(0x22d)](_0x42c3e0,_0x5b5ce7),{'verbose':_0x11460e[_0x5aa972(0x1fc)]}),_0x1a0627=_0x5de178[_0x5aa972(0x224)];return console['error']('✔\x20Created\x20folder\x20\x27'+_0x1a0627[_0x5aa972(0x261)]+'\x27\x20with\x20ID:\x20'+_0x1a0627['id']),await handleSDKOutput([_0x1a0627],_0x11460e),0x0;}}export class SegmentViewCommand extends BaseCommand{[a47_0x5179c2(0x261)]=a47_0x5179c2(0x21c);[a47_0x5179c2(0x20b)]=a47_0x5179c2(0x1ed);async[a47_0x5179c2(0x236)](_0x4aa9fd){const _0x103a3d=a47_0x5179c2,{options:_0x328771,args:_0x1cec92,tdx:_0x1978ab}=_0x4aa9fd,_0x22cbb5=_0x1cec92[0x0];if(!_0x22cbb5)return console[_0x103a3d(0x1df)](_0x103a3d(0x23f)),console[_0x103a3d(0x1df)](_0x103a3d(0x244)),console[_0x103a3d(0x1df)](_0x103a3d(0x1cc)),console[_0x103a3d(0x1df)](_0x103a3d(0x1de)),console['error'](_0x103a3d(0x1d2)),console[_0x103a3d(0x1df)](_0x103a3d(0x248)),console[_0x103a3d(0x1df)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console['error'](_0x103a3d(0x1ff)),console['error'](_0x103a3d(0x20d)),console['error'](_0x103a3d(0x234)),0x1;try{const _0x23253a=_0x328771[_0x103a3d(0x1c2)],_0x4d44cd=await resolveSegmentTarget(_0x22cbb5,_0x23253a,_0x328771['verbose']);_0x328771['verbose']&&console[_0x103a3d(0x1df)](_0x103a3d(0x1dd)+_0x4d44cd);const _0x5c0dde=await withSpinner(_0x103a3d(0x241)+_0x22cbb5+_0x103a3d(0x23a),()=>_0x1978ab[_0x103a3d(0x1c3)]['resolvePathToResource'](_0x4d44cd),{'verbose':_0x328771[_0x103a3d(0x1fc)]}),_0x387f1a=_0x5c0dde[_0x103a3d(0x224)];_0x328771[_0x103a3d(0x1fc)]&&(console[_0x103a3d(0x1df)](_0x103a3d(0x1e2)+_0x387f1a[_0x103a3d(0x21f)]),console['error']('Parent\x20ID:\x20'+_0x387f1a['parentId']),_0x387f1a['folderId']&&console['error'](_0x103a3d(0x221)+_0x387f1a[_0x103a3d(0x22f)]),_0x387f1a[_0x103a3d(0x1f6)]&&console['error'](_0x103a3d(0x246)+_0x387f1a[_0x103a3d(0x1f6)]));if(_0x328771[_0x103a3d(0x1f0)]){if(_0x387f1a[_0x103a3d(0x21f)]===_0x103a3d(0x211))return console[_0x103a3d(0x1df)](_0x103a3d(0x215)),0x1;if(_0x387f1a[_0x103a3d(0x21f)]===_0x103a3d(0x1ef))return console[_0x103a3d(0x1df)](_0x103a3d(0x1f7)),console['error']('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x387f1a[_0x103a3d(0x1f6)])throw new SDKError(ErrorCode[_0x103a3d(0x20a)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x14ac01=getConsoleNextUrl(_0x328771[_0x103a3d(0x228)],'/app/ps/'+_0x387f1a[_0x103a3d(0x251)]+_0x103a3d(0x1e4)+_0x387f1a[_0x103a3d(0x1f6)]);return console['error'](a47_0x428333[_0x103a3d(0x230)]('✔')+'\x20Opening\x20'+a47_0x428333['cyan'](_0x14ac01)),openBrowser(_0x14ac01),0x0;}if(_0x387f1a[_0x103a3d(0x21f)]===_0x103a3d(0x211)){if(!_0x387f1a['folderId'])throw new SDKError(ErrorCode[_0x103a3d(0x243)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x569fed=await withSpinner(_0x103a3d(0x259),()=>_0x1978ab[_0x103a3d(0x1c3)][_0x103a3d(0x1da)](_0x387f1a[_0x103a3d(0x22f)]),{'verbose':_0x328771[_0x103a3d(0x1fc)]});await handleSingleObjectOutput(_0x569fed[_0x103a3d(0x224)],_0x328771);}else{if(_0x387f1a[_0x103a3d(0x21f)]===_0x103a3d(0x1c3)){if(!_0x387f1a['segmentId'])throw new SDKError(ErrorCode[_0x103a3d(0x20a)],_0x103a3d(0x23c));const _0x406c6f=await withSpinner(_0x103a3d(0x1eb),()=>_0x1978ab[_0x103a3d(0x1c3)]['getSegment'](_0x387f1a[_0x103a3d(0x251)],_0x387f1a['segmentId']),{'verbose':_0x328771[_0x103a3d(0x1fc)]}),_0x76a532=getConsoleNextUrl(_0x328771[_0x103a3d(0x228)],'/app/ps/'+_0x387f1a[_0x103a3d(0x251)]+_0x103a3d(0x1e4)+_0x387f1a[_0x103a3d(0x1f6)]),_0x26c9d2=_0x406c6f[_0x103a3d(0x224)];_0x26c9d2[_0x103a3d(0x25e)]=_0x76a532,await handleSingleObjectOutput(_0x26c9d2,_0x328771);}else return console[_0x103a3d(0x1df)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console['error'](_0x103a3d(0x206)),0x1;}return 0x0;}catch(_0x1ea56f){if(_0x1ea56f instanceof SDKError)return console['error']('Error:\x20'+_0x1ea56f[_0x103a3d(0x214)]),_0x1ea56f[_0x103a3d(0x1fe)]&&console[_0x103a3d(0x1df)](_0x103a3d(0x1c8)+_0x1ea56f[_0x103a3d(0x1fe)]),0x1;throw _0x1ea56f;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a47_0x5179c2(0x22c);[a47_0x5179c2(0x20b)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a47_0x5179c2(0x236)](_0x32f99d){const _0x2c9341=a47_0x5179c2,{options:_0x5d176e,args:_0x5c0081,tdx:_0x6485dd}=_0x32f99d,_0x2ccf7c=_0x5c0081[0x0];if(!_0x2ccf7c)return console['error'](_0x2c9341(0x1d4)),console[_0x2c9341(0x1df)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x2c9341(0x1df)](_0x2c9341(0x216)),console['error'](_0x2c9341(0x248)),console[_0x2c9341(0x1df)](_0x2c9341(0x1c7)),console[_0x2c9341(0x1df)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0xf56693=_0x5d176e[_0x2c9341(0x1c2)],_0x4c3665=await resolveSegmentTarget(_0x2ccf7c,_0xf56693,_0x5d176e['verbose']);_0x5d176e[_0x2c9341(0x1fc)]&&console['error'](_0x2c9341(0x1dd)+_0x4c3665);const _0x19a474=await withSpinner(_0x2c9341(0x241)+_0x2ccf7c+_0x2c9341(0x23a),()=>_0x6485dd[_0x2c9341(0x1c3)][_0x2c9341(0x25d)](_0x4c3665),{'verbose':_0x5d176e[_0x2c9341(0x1fc)]}),_0xedbf37=_0x19a474['data'];_0x5d176e[_0x2c9341(0x1fc)]&&(console[_0x2c9341(0x1df)]('Resolved\x20type:\x20'+_0xedbf37['type']),console[_0x2c9341(0x1df)](_0x2c9341(0x233)+_0xedbf37[_0x2c9341(0x251)]));if(_0xedbf37[_0x2c9341(0x21f)]===_0x2c9341(0x211))return console[_0x2c9341(0x1df)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x2c9341(0x1df)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0xedbf37['type']===_0x2c9341(0x1ef))return console['error'](_0x2c9341(0x239)),console['error']('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0xedbf37[_0x2c9341(0x1f6)])throw new SDKError(ErrorCode[_0x2c9341(0x20a)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3fbd4d=await withSpinner(_0x2c9341(0x25a),()=>_0x6485dd[_0x2c9341(0x1c3)][_0x2c9341(0x1d1)](_0xedbf37[_0x2c9341(0x251)],_0xedbf37['segmentId']),{'verbose':_0x5d176e[_0x2c9341(0x1fc)]}),_0x1e7076=_0x3fbd4d[_0x2c9341(0x224)],_0x149a0b=await executeSchemaQuery(_0x1e7076,_0x6485dd,_0x5d176e);return await handleQueryOutput(_0x149a0b,_0x5d176e),0x0;}catch(_0x5b2e8e){if(_0x5b2e8e instanceof SDKError)return console[_0x2c9341(0x1df)]('Error:\x20'+_0x5b2e8e['message']),_0x5b2e8e[_0x2c9341(0x1fe)]&&console['error'](_0x2c9341(0x1c8)+_0x5b2e8e[_0x2c9341(0x1fe)]),0x1;throw _0x5b2e8e;}}}
@@ -1 +1 @@
1
- const a48_0xebedd2=a48_0x5a10;(function(_0xe04b1b,_0xfa7371){const _0x5e1e1d=a48_0x5a10,_0x43ba17=_0xe04b1b();while(!![]){try{const _0xfcb06e=-parseInt(_0x5e1e1d(0x107))/0x1*(parseInt(_0x5e1e1d(0xed))/0x2)+parseInt(_0x5e1e1d(0xec))/0x3+-parseInt(_0x5e1e1d(0xf7))/0x4*(-parseInt(_0x5e1e1d(0xdc))/0x5)+parseInt(_0x5e1e1d(0xf6))/0x6*(-parseInt(_0x5e1e1d(0xdd))/0x7)+parseInt(_0x5e1e1d(0xfb))/0x8+-parseInt(_0x5e1e1d(0xe6))/0x9*(-parseInt(_0x5e1e1d(0x103))/0xa)+-parseInt(_0x5e1e1d(0xd7))/0xb*(parseInt(_0x5e1e1d(0x102))/0xc);if(_0xfcb06e===_0xfa7371)break;else _0x43ba17['push'](_0x43ba17['shift']());}catch(_0x2de37f){_0x43ba17['push'](_0x43ba17['shift']());}}}(a48_0x2267,0xa45eb));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a48_0x2267(){const _0x3b9b1c=['data','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Target\x20path:\x20','name','\x27...','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','329136fBwYVP','2180IJSEPz','kind','description','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','9131360ndJatL','rule','resolvePathToResource','folder','Resolving\x20folder\x20path\x20\x27','site','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','168zGTmKG','20kmwxEd','Parent:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Resolved\x20folder\x20ID:\x20','941753wtEmlP','type','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','segment','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x20\x20\x20Path:\x20','Resolved\x20relative\x20path\x20to:\x20','includes','length','808797yJefXl','error','segments','segmentPath','Creating\x20segment\x20\x27','2510CMzQqB','98IjhXPr','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','folderId','\x27\x20with\x20ID:\x20','segment:create','Resolving\x20folder\x20\x27','yellow','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Resolving\x20parent\x20segment\x20\x27','4259853FJtprI','noCountPopulation','resolveFolderId','verbose','✔\x20Created\x20segment\x20\x27','Create\x20child\x20segment\x20with\x20filtering\x20rules','3152190uSNGLH','2TnTWjs','resolveParentId','Parent\x20path:\x20'];a48_0x2267=function(){return _0x3b9b1c;};return a48_0x2267();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a48_0x5dd0e3 from'chalk';function a48_0x5a10(_0x458ce1,_0x1a56c5){_0x458ce1=_0x458ce1-0xd2;const _0x226777=a48_0x2267();let _0x5a1017=_0x226777[_0x458ce1];return _0x5a1017;}export class SegmentCreateCommand extends BaseCommand{[a48_0xebedd2(0xf3)]=a48_0xebedd2(0xe1);[a48_0xebedd2(0xf9)]=a48_0xebedd2(0xeb);async['execute'](_0x5e4bcf){const _0x3c250c=a48_0xebedd2;console[_0x3c250c(0xd8)](a48_0x5dd0e3[_0x3c250c(0xe3)](_0x3c250c(0xd2))),console[_0x3c250c(0xd8)](a48_0x5dd0e3[_0x3c250c(0xe3)](_0x3c250c(0xde)));const {options:_0x10ad5f,args:_0x2be030,tdx:_0x5e205b}=_0x5e4bcf,_0x248cb1=_0x10ad5f;if(_0x2be030[_0x3c250c(0xd6)]===0x0)return console[_0x3c250c(0xd8)](_0x3c250c(0x101)),console[_0x3c250c(0xd8)](_0x3c250c(0xfa)),console[_0x3c250c(0xd8)]('Examples:'),console[_0x3c250c(0xd8)](_0x3c250c(0xe4)),console[_0x3c250c(0xd8)](_0x3c250c(0x105)),console[_0x3c250c(0xd8)](_0x3c250c(0xf1)),0x1;const _0xf404=_0x2be030[0x0],_0x24ab98=_0x10ad5f[_0x3c250c(0xda)];let _0x4536f2=_0xf404;_0x24ab98&&!_0xf404[_0x3c250c(0xd5)]('/')&&(_0x4536f2=_0x24ab98+'/'+_0xf404,_0x248cb1[_0x3c250c(0xe9)]&&console['error'](_0x3c250c(0xd4)+_0x4536f2));const _0x10e60f=parsePath(_0x4536f2);if(_0x10e60f['segments'][_0x3c250c(0xd6)]<0x2)return console[_0x3c250c(0xd8)](_0x3c250c(0x109)),console[_0x3c250c(0xd8)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x1d64b6=_0x10e60f[_0x3c250c(0xd9)][0x0],_0x256f7f=getBaseName(_0x4536f2),_0x181d40=getParentPath(_0x4536f2);_0x248cb1['verbose']&&(console[_0x3c250c(0xd8)]('Site:\x20'+_0x248cb1[_0x3c250c(0x100)]),console[_0x3c250c(0xd8)](_0x3c250c(0xf2)+_0x4536f2),console['error'](_0x3c250c(0x104)+_0x1d64b6),console[_0x3c250c(0xd8)]('Segment\x20name:\x20'+_0x256f7f),console[_0x3c250c(0xd8)](_0x3c250c(0xef)+_0x181d40));const _0x50c09d=await withSpinner(_0x3c250c(0xe5)+_0x1d64b6+_0x3c250c(0xf4),()=>_0x5e205b[_0x3c250c(0x10a)][_0x3c250c(0xee)](_0x1d64b6),{'verbose':_0x248cb1[_0x3c250c(0xe9)]}),_0x2a7e2f=_0x50c09d[_0x3c250c(0xf0)];let _0x56dc92;if(_0x10e60f[_0x3c250c(0xd9)][_0x3c250c(0xd6)]>0x2){const _0x53051c=await withSpinner(_0x3c250c(0xff)+_0x181d40+'\x27...',()=>_0x5e205b[_0x3c250c(0x10a)][_0x3c250c(0xfd)](_0x181d40),{'verbose':_0x248cb1[_0x3c250c(0xe9)]}),_0x378044=_0x53051c[_0x3c250c(0xf0)];if(_0x378044[_0x3c250c(0x108)]!==_0x3c250c(0xfe)&&_0x378044[_0x3c250c(0x108)]!=='parent')return console[_0x3c250c(0xd8)](_0x3c250c(0xf5)),0x1;_0x56dc92=_0x378044[_0x3c250c(0xdf)];}else{if(_0x248cb1['folder']){const _0x2ed1f3=await withSpinner(_0x3c250c(0xe2)+_0x248cb1[_0x3c250c(0xfe)]+_0x3c250c(0xf4),()=>_0x5e205b[_0x3c250c(0x10a)][_0x3c250c(0xe8)](_0x2a7e2f,_0x248cb1['folder']),{'verbose':_0x248cb1[_0x3c250c(0xe9)]});_0x56dc92=_0x2ed1f3[_0x3c250c(0xf0)];}}_0x248cb1[_0x3c250c(0xe9)]&&_0x56dc92&&console[_0x3c250c(0xd8)](_0x3c250c(0x106)+_0x56dc92);const _0x586302=await loadJSONFromOptions(_0x248cb1[_0x3c250c(0xfc)],_0x248cb1['ruleFile']),_0x4a6f4b={'name':_0x256f7f,'description':_0x248cb1[_0x3c250c(0xf9)],'rule':_0x586302,'kind':_0x248cb1[_0x3c250c(0xf8)]!==undefined?parseInt(_0x248cb1[_0x3c250c(0xf8)],0xa):undefined,'isVisible':_0x248cb1['invisible']?![]:undefined,'segmentFolderId':_0x56dc92,'countPopulation':_0x248cb1[_0x3c250c(0xe7)]?![]:undefined},_0x3ca9b2=await withSpinner(_0x3c250c(0xdb)+_0x256f7f+_0x3c250c(0xf4),()=>_0x5e205b[_0x3c250c(0x10a)]['createSegment'](_0x2a7e2f,_0x4a6f4b),{'verbose':_0x248cb1[_0x3c250c(0xe9)]}),_0x4af1c3=_0x3ca9b2['data'];return console[_0x3c250c(0xd8)](_0x3c250c(0xea)+_0x4af1c3['name']+_0x3c250c(0xe0)+_0x4af1c3['id']),_0x4536f2!==_0xf404&&console['error'](_0x3c250c(0xd3)+_0x4536f2),await handleSDKOutput([_0x4af1c3],_0x248cb1),0x0;}}
1
+ const a48_0xddd034=a48_0x1e91;(function(_0x2f643c,_0x16d6e7){const _0x1ecfa3=a48_0x1e91,_0x42afe8=_0x2f643c();while(!![]){try{const _0x3ed1a4=-parseInt(_0x1ecfa3(0xb3))/0x1+parseInt(_0x1ecfa3(0xd8))/0x2*(parseInt(_0x1ecfa3(0xb8))/0x3)+-parseInt(_0x1ecfa3(0xda))/0x4+-parseInt(_0x1ecfa3(0xc2))/0x5*(-parseInt(_0x1ecfa3(0xdc))/0x6)+parseInt(_0x1ecfa3(0xc8))/0x7+parseInt(_0x1ecfa3(0xae))/0x8+-parseInt(_0x1ecfa3(0xb5))/0x9;if(_0x3ed1a4===_0x16d6e7)break;else _0x42afe8['push'](_0x42afe8['shift']());}catch(_0x2f705a){_0x42afe8['push'](_0x42afe8['shift']());}}}(a48_0x1f2f,0xc507e));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a48_0x1e91(_0x1f3b28,_0x225b7f){_0x1f3b28=_0x1f3b28-0xaa;const _0x1f2f0a=a48_0x1f2f();let _0x1e9178=_0x1f2f0a[_0x1f3b28];return _0x1e9178;}import{withSpinner}from'../utils/spinner.js';function a48_0x1f2f(){const _0x497fbf=['length','5985048CwzWEz','Resolving\x20folder\x20\x27','1524bhBRTD','Creating\x20segment\x20\x27','site','verbose','Examples:','5016736AXEYxO','Resolved\x20folder\x20ID:\x20','folderId','noCountPopulation','segments','1362411xqnqrh','segment','5736672hbNCgK','createSegment','Target\x20path:\x20','3386034XvVZGt','resolveFolderId','rule','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','error','name','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Site:\x20','Segment\x20name:\x20','26935jOeaxj','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','data','Parent\x20path:\x20','Resolving\x20folder\x20path\x20\x27','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','8253357ENYmdy','folder','description','\x27...','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Create\x20child\x20segment\x20with\x20filtering\x20rules','includes','Resolved\x20relative\x20path\x20to:\x20','kind','\x27\x20with\x20ID:\x20','execute','\x20\x20\x20Path:\x20','resolvePathToResource','ruleFile','segment:create','type','2BcVjZd'];a48_0x1f2f=function(){return _0x497fbf;};return a48_0x1f2f();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a48_0x3491c7 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a48_0xddd034(0xbd)]=a48_0xddd034(0xd6);[a48_0xddd034(0xca)]=a48_0xddd034(0xcd);async[a48_0xddd034(0xd2)](_0x25dd54){const _0x5e81a9=a48_0xddd034;console[_0x5e81a9(0xbc)](a48_0x3491c7['yellow'](_0x5e81a9(0xc3))),console[_0x5e81a9(0xbc)](a48_0x3491c7['yellow']('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x2a913d,args:_0x5629a2,tdx:_0x4eb1c5}=_0x25dd54,_0x24af15=_0x2a913d;if(_0x5629a2[_0x5e81a9(0xd9)]===0x0)return console[_0x5e81a9(0xbc)](_0x5e81a9(0xbb)),console[_0x5e81a9(0xbc)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x5e81a9(0xbc)](_0x5e81a9(0xad)),console[_0x5e81a9(0xbc)](_0x5e81a9(0xbe)),console[_0x5e81a9(0xbc)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x5e81a9(0xbc)](_0x5e81a9(0xbf)),0x1;const _0x312d19=_0x5629a2[0x0],_0x509b24=_0x2a913d['segmentPath'];let _0x4d56ea=_0x312d19;_0x509b24&&!_0x312d19[_0x5e81a9(0xce)]('/')&&(_0x4d56ea=_0x509b24+'/'+_0x312d19,_0x24af15['verbose']&&console['error'](_0x5e81a9(0xcf)+_0x4d56ea));const _0x1b8c6d=parsePath(_0x4d56ea);if(_0x1b8c6d[_0x5e81a9(0xb2)][_0x5e81a9(0xd9)]<0x2)return console[_0x5e81a9(0xbc)](_0x5e81a9(0xc7)),console[_0x5e81a9(0xbc)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x198253=_0x1b8c6d[_0x5e81a9(0xb2)][0x0],_0x367588=getBaseName(_0x4d56ea),_0xc501e1=getParentPath(_0x4d56ea);_0x24af15[_0x5e81a9(0xac)]&&(console[_0x5e81a9(0xbc)](_0x5e81a9(0xc0)+_0x24af15[_0x5e81a9(0xab)]),console[_0x5e81a9(0xbc)](_0x5e81a9(0xb7)+_0x4d56ea),console[_0x5e81a9(0xbc)]('Parent:\x20'+_0x198253),console['error'](_0x5e81a9(0xc1)+_0x367588),console['error'](_0x5e81a9(0xc5)+_0xc501e1));const _0x5c4356=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x198253+_0x5e81a9(0xcb),()=>_0x4eb1c5[_0x5e81a9(0xb4)]['resolveParentId'](_0x198253),{'verbose':_0x24af15[_0x5e81a9(0xac)]}),_0x71a6f9=_0x5c4356[_0x5e81a9(0xc4)];let _0x215906;if(_0x1b8c6d[_0x5e81a9(0xb2)][_0x5e81a9(0xd9)]>0x2){const _0xbfb15a=await withSpinner(_0x5e81a9(0xc6)+_0xc501e1+_0x5e81a9(0xcb),()=>_0x4eb1c5[_0x5e81a9(0xb4)][_0x5e81a9(0xd4)](_0xc501e1),{'verbose':_0x24af15[_0x5e81a9(0xac)]}),_0x4c2a33=_0xbfb15a['data'];if(_0x4c2a33['type']!==_0x5e81a9(0xc9)&&_0x4c2a33[_0x5e81a9(0xd7)]!=='parent')return console[_0x5e81a9(0xbc)](_0x5e81a9(0xcc)),0x1;_0x215906=_0x4c2a33[_0x5e81a9(0xb0)];}else{if(_0x24af15[_0x5e81a9(0xc9)]){const _0x31461b=await withSpinner(_0x5e81a9(0xdb)+_0x24af15[_0x5e81a9(0xc9)]+_0x5e81a9(0xcb),()=>_0x4eb1c5[_0x5e81a9(0xb4)][_0x5e81a9(0xb9)](_0x71a6f9,_0x24af15[_0x5e81a9(0xc9)]),{'verbose':_0x24af15['verbose']});_0x215906=_0x31461b[_0x5e81a9(0xc4)];}}_0x24af15[_0x5e81a9(0xac)]&&_0x215906&&console[_0x5e81a9(0xbc)](_0x5e81a9(0xaf)+_0x215906);const _0x12d5c8=await loadJSONFromOptions(_0x24af15[_0x5e81a9(0xba)],_0x24af15[_0x5e81a9(0xd5)]),_0x3a5e89={'name':_0x367588,'description':_0x24af15[_0x5e81a9(0xca)],'rule':_0x12d5c8,'kind':_0x24af15[_0x5e81a9(0xd0)]!==undefined?parseInt(_0x24af15['kind'],0xa):undefined,'isVisible':_0x24af15['invisible']?![]:undefined,'segmentFolderId':_0x215906,'countPopulation':_0x24af15[_0x5e81a9(0xb1)]?![]:undefined},_0x1cd8bd=await withSpinner(_0x5e81a9(0xaa)+_0x367588+_0x5e81a9(0xcb),()=>_0x4eb1c5['segment'][_0x5e81a9(0xb6)](_0x71a6f9,_0x3a5e89),{'verbose':_0x24af15[_0x5e81a9(0xac)]}),_0x5ee151=_0x1cd8bd['data'];return console[_0x5e81a9(0xbc)]('✔\x20Created\x20segment\x20\x27'+_0x5ee151[_0x5e81a9(0xbd)]+_0x5e81a9(0xd1)+_0x5ee151['id']),_0x4d56ea!==_0x312d19&&console[_0x5e81a9(0xbc)](_0x5e81a9(0xd3)+_0x4d56ea),await handleSDKOutput([_0x5ee151],_0x24af15),0x0;}}