@synteq/cli 0.2.0 → 1.1.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 (433) hide show
  1. package/dist/api/client.d.ts +362 -5
  2. package/dist/api/client.js +559 -44
  3. package/dist/api/client.js.map +1 -1
  4. package/dist/api/factory.js +5 -2
  5. package/dist/api/factory.js.map +1 -1
  6. package/dist/api/types.d.ts +892 -3
  7. package/dist/apps-support/deploy.d.ts +197 -0
  8. package/dist/apps-support/deploy.js +639 -0
  9. package/dist/apps-support/deploy.js.map +1 -0
  10. package/dist/apps-support/dotenv.d.ts +67 -0
  11. package/dist/apps-support/dotenv.js +136 -0
  12. package/dist/apps-support/dotenv.js.map +1 -0
  13. package/dist/apps-support/env-rollout.d.ts +18 -0
  14. package/dist/apps-support/env-rollout.js +52 -0
  15. package/dist/apps-support/env-rollout.js.map +1 -0
  16. package/dist/apps-support/git.d.ts +14 -0
  17. package/dist/apps-support/git.js +25 -0
  18. package/dist/apps-support/git.js.map +1 -0
  19. package/dist/apps-support/link.d.ts +25 -0
  20. package/dist/apps-support/link.js +39 -0
  21. package/dist/apps-support/link.js.map +1 -0
  22. package/dist/apps-support/log-stream.d.ts +25 -0
  23. package/dist/apps-support/log-stream.js +85 -0
  24. package/dist/apps-support/log-stream.js.map +1 -0
  25. package/dist/apps-support/paid-app.d.ts +64 -0
  26. package/dist/apps-support/paid-app.js +195 -0
  27. package/dist/apps-support/paid-app.js.map +1 -0
  28. package/dist/apps-support/plans.d.ts +44 -0
  29. package/dist/apps-support/plans.js +43 -0
  30. package/dist/apps-support/plans.js.map +1 -0
  31. package/dist/apps-support/resolve.d.ts +10 -0
  32. package/dist/apps-support/resolve.js +53 -0
  33. package/dist/apps-support/resolve.js.map +1 -0
  34. package/dist/apps-support/time.d.ts +20 -0
  35. package/dist/apps-support/time.js +82 -0
  36. package/dist/apps-support/time.js.map +1 -0
  37. package/dist/auth/scope.js +4 -0
  38. package/dist/auth/scope.js.map +1 -1
  39. package/dist/auth/tokens.d.ts +3 -0
  40. package/dist/auth/tokens.js +6 -4
  41. package/dist/auth/tokens.js.map +1 -1
  42. package/dist/base/command.d.ts +35 -0
  43. package/dist/base/command.js +87 -4
  44. package/dist/base/command.js.map +1 -1
  45. package/dist/commands/agents.d.ts +10 -0
  46. package/dist/commands/agents.js +53 -0
  47. package/dist/commands/agents.js.map +1 -0
  48. package/dist/commands/api.d.ts +0 -1
  49. package/dist/commands/api.js +6 -5
  50. package/dist/commands/api.js.map +1 -1
  51. package/dist/commands/app/deployment/list.d.ts +14 -0
  52. package/dist/commands/app/deployment/list.js +45 -0
  53. package/dist/commands/app/deployment/list.js.map +1 -0
  54. package/dist/commands/app/deployment/rollback.d.ts +18 -0
  55. package/dist/commands/app/deployment/rollback.js +57 -0
  56. package/dist/commands/app/deployment/rollback.js.map +1 -0
  57. package/dist/commands/app/deployment/show.d.ts +26 -0
  58. package/dist/commands/app/deployment/show.js +98 -0
  59. package/dist/commands/app/deployment/show.js.map +1 -0
  60. package/dist/commands/app/domain/add.d.ts +17 -0
  61. package/dist/commands/app/domain/add.js +59 -0
  62. package/dist/commands/app/domain/add.js.map +1 -0
  63. package/dist/commands/app/domain/list.d.ts +14 -0
  64. package/dist/commands/app/domain/list.js +42 -0
  65. package/dist/commands/app/domain/list.js.map +1 -0
  66. package/dist/commands/app/domain/remove.d.ts +16 -0
  67. package/dist/commands/app/domain/remove.js +51 -0
  68. package/dist/commands/app/domain/remove.js.map +1 -0
  69. package/dist/commands/app/domain/verify.d.ts +15 -0
  70. package/dist/commands/app/domain/verify.js +39 -0
  71. package/dist/commands/app/domain/verify.js.map +1 -0
  72. package/dist/commands/app/env/add.d.ts +22 -0
  73. package/dist/commands/app/env/add.js +103 -0
  74. package/dist/commands/app/env/add.js.map +1 -0
  75. package/dist/commands/app/env/list.d.ts +17 -0
  76. package/dist/commands/app/env/list.js +40 -0
  77. package/dist/commands/app/env/list.js.map +1 -0
  78. package/dist/commands/app/env/reveal.d.ts +17 -0
  79. package/dist/commands/app/env/reveal.js +40 -0
  80. package/dist/commands/app/env/reveal.js.map +1 -0
  81. package/dist/commands/app/env/rm.d.ts +16 -0
  82. package/dist/commands/app/env/rm.js +48 -0
  83. package/dist/commands/app/env/rm.js.map +1 -0
  84. package/dist/commands/app/health.d.ts +14 -0
  85. package/dist/commands/app/health.js +40 -0
  86. package/dist/commands/app/health.js.map +1 -0
  87. package/dist/commands/app/index.d.ts +6 -0
  88. package/dist/commands/app/index.js +7 -0
  89. package/dist/commands/app/index.js.map +1 -0
  90. package/dist/commands/app/link.d.ts +22 -0
  91. package/dist/commands/app/link.js +31 -0
  92. package/dist/commands/app/link.js.map +1 -0
  93. package/dist/commands/app/logs.d.ts +25 -0
  94. package/dist/commands/app/logs.js +121 -0
  95. package/dist/commands/app/logs.js.map +1 -0
  96. package/dist/commands/app/metrics.d.ts +21 -0
  97. package/dist/commands/app/metrics.js +123 -0
  98. package/dist/commands/app/metrics.js.map +1 -0
  99. package/dist/commands/app/plan/change.d.ts +18 -0
  100. package/dist/commands/app/plan/change.js +79 -0
  101. package/dist/commands/app/plan/change.js.map +1 -0
  102. package/dist/commands/app/plan/show.d.ts +14 -0
  103. package/dist/commands/app/plan/show.js +40 -0
  104. package/dist/commands/app/plan/show.js.map +1 -0
  105. package/dist/commands/app/settings/set.d.ts +25 -0
  106. package/dist/commands/app/settings/set.js +96 -0
  107. package/dist/commands/app/settings/set.js.map +1 -0
  108. package/dist/commands/app/settings/show.d.ts +14 -0
  109. package/dist/commands/app/settings/show.js +48 -0
  110. package/dist/commands/app/settings/show.js.map +1 -0
  111. package/dist/commands/app/unlink.d.ts +8 -0
  112. package/dist/commands/app/unlink.js +25 -0
  113. package/dist/commands/app/unlink.js.map +1 -0
  114. package/dist/commands/apps/create.d.ts +26 -0
  115. package/dist/commands/apps/create.js +91 -0
  116. package/dist/commands/apps/create.js.map +1 -0
  117. package/dist/commands/apps/list.d.ts +17 -0
  118. package/dist/commands/apps/list.js +56 -0
  119. package/dist/commands/apps/list.js.map +1 -0
  120. package/dist/commands/baremetal/activity.d.ts +14 -0
  121. package/dist/commands/baremetal/activity.js +53 -0
  122. package/dist/commands/baremetal/activity.js.map +1 -0
  123. package/dist/commands/baremetal/bandwidth.d.ts +10 -0
  124. package/dist/commands/baremetal/bandwidth.js +86 -0
  125. package/dist/commands/baremetal/bandwidth.js.map +1 -0
  126. package/dist/commands/baremetal/console.d.ts +20 -0
  127. package/dist/commands/baremetal/console.js +72 -0
  128. package/dist/commands/baremetal/console.js.map +1 -0
  129. package/dist/commands/baremetal/details.d.ts +11 -0
  130. package/dist/commands/baremetal/details.js +116 -0
  131. package/dist/commands/baremetal/details.js.map +1 -0
  132. package/dist/commands/baremetal/index.d.ts +5 -0
  133. package/dist/commands/baremetal/index.js +6 -0
  134. package/dist/commands/baremetal/index.js.map +1 -0
  135. package/dist/commands/baremetal/install-password.d.ts +14 -0
  136. package/dist/commands/baremetal/install-password.js +80 -0
  137. package/dist/commands/baremetal/install-password.js.map +1 -0
  138. package/dist/commands/baremetal/list.d.ts +11 -0
  139. package/dist/commands/baremetal/list.js +59 -0
  140. package/dist/commands/baremetal/list.js.map +1 -0
  141. package/dist/commands/baremetal/order.d.ts +34 -0
  142. package/dist/commands/baremetal/order.js +394 -0
  143. package/dist/commands/baremetal/order.js.map +1 -0
  144. package/dist/commands/baremetal/power.d.ts +18 -0
  145. package/dist/commands/baremetal/power.js +168 -0
  146. package/dist/commands/baremetal/power.js.map +1 -0
  147. package/dist/commands/baremetal/reinstall.d.ts +21 -0
  148. package/dist/commands/baremetal/reinstall.js +168 -0
  149. package/dist/commands/baremetal/reinstall.js.map +1 -0
  150. package/dist/commands/config/profile/add.d.ts +11 -0
  151. package/dist/commands/config/profile/add.js +51 -0
  152. package/dist/commands/config/profile/add.js.map +1 -0
  153. package/dist/commands/config/profile/list.d.ts +7 -0
  154. package/dist/commands/config/profile/list.js +29 -0
  155. package/dist/commands/config/profile/list.js.map +1 -0
  156. package/dist/commands/config/profile/remove.d.ts +11 -0
  157. package/dist/commands/config/profile/remove.js +35 -0
  158. package/dist/commands/config/profile/remove.js.map +1 -0
  159. package/dist/commands/config/profile/use.d.ts +10 -0
  160. package/dist/commands/config/profile/use.js +44 -0
  161. package/dist/commands/config/profile/use.js.map +1 -0
  162. package/dist/commands/config/show.js +4 -1
  163. package/dist/commands/config/show.js.map +1 -1
  164. package/dist/commands/credits/add.js +2 -2
  165. package/dist/commands/credits/add.js.map +1 -1
  166. package/dist/commands/credits/index.js +5 -1
  167. package/dist/commands/credits/index.js.map +1 -1
  168. package/dist/commands/deploy.d.ts +51 -0
  169. package/dist/commands/deploy.js +515 -0
  170. package/dist/commands/deploy.js.map +1 -0
  171. package/dist/commands/function/create.d.ts +29 -0
  172. package/dist/commands/function/create.js +113 -0
  173. package/dist/commands/function/create.js.map +1 -0
  174. package/dist/commands/function/credits/add.d.ts +29 -0
  175. package/dist/commands/function/credits/add.js +209 -0
  176. package/dist/commands/function/credits/add.js.map +1 -0
  177. package/dist/commands/function/credits/auto-reload.d.ts +27 -0
  178. package/dist/commands/function/credits/auto-reload.js +107 -0
  179. package/dist/commands/function/credits/auto-reload.js.map +1 -0
  180. package/dist/commands/function/credits/index.d.ts +22 -0
  181. package/dist/commands/function/credits/index.js +80 -0
  182. package/dist/commands/function/credits/index.js.map +1 -0
  183. package/dist/commands/function/cron/add.d.ts +19 -0
  184. package/dist/commands/function/cron/add.js +74 -0
  185. package/dist/commands/function/cron/add.js.map +1 -0
  186. package/dist/commands/function/cron/list.d.ts +12 -0
  187. package/dist/commands/function/cron/list.js +55 -0
  188. package/dist/commands/function/cron/list.js.map +1 -0
  189. package/dist/commands/function/cron/rm.d.ts +17 -0
  190. package/dist/commands/function/cron/rm.js +73 -0
  191. package/dist/commands/function/cron/rm.js.map +1 -0
  192. package/dist/commands/function/cron/run.d.ts +16 -0
  193. package/dist/commands/function/cron/run.js +59 -0
  194. package/dist/commands/function/cron/run.js.map +1 -0
  195. package/dist/commands/function/cron/update.d.ts +21 -0
  196. package/dist/commands/function/cron/update.js +87 -0
  197. package/dist/commands/function/cron/update.js.map +1 -0
  198. package/dist/commands/function/delete.d.ts +23 -0
  199. package/dist/commands/function/delete.js +90 -0
  200. package/dist/commands/function/delete.js.map +1 -0
  201. package/dist/commands/function/deploy.d.ts +64 -0
  202. package/dist/commands/function/deploy.js +616 -0
  203. package/dist/commands/function/deploy.js.map +1 -0
  204. package/dist/commands/function/env/list.d.ts +12 -0
  205. package/dist/commands/function/env/list.js +46 -0
  206. package/dist/commands/function/env/list.js.map +1 -0
  207. package/dist/commands/function/env/reveal.d.ts +21 -0
  208. package/dist/commands/function/env/reveal.js +54 -0
  209. package/dist/commands/function/env/reveal.js.map +1 -0
  210. package/dist/commands/function/env/rm.d.ts +17 -0
  211. package/dist/commands/function/env/rm.js +62 -0
  212. package/dist/commands/function/env/rm.js.map +1 -0
  213. package/dist/commands/function/env/set.d.ts +28 -0
  214. package/dist/commands/function/env/set.js +124 -0
  215. package/dist/commands/function/env/set.js.map +1 -0
  216. package/dist/commands/function/index.d.ts +14 -0
  217. package/dist/commands/function/index.js +11 -0
  218. package/dist/commands/function/index.js.map +1 -0
  219. package/dist/commands/function/init.d.ts +48 -0
  220. package/dist/commands/function/init.js +277 -0
  221. package/dist/commands/function/init.js.map +1 -0
  222. package/dist/commands/function/invoke.d.ts +29 -0
  223. package/dist/commands/function/invoke.js +138 -0
  224. package/dist/commands/function/invoke.js.map +1 -0
  225. package/dist/commands/function/link.d.ts +23 -0
  226. package/dist/commands/function/link.js +80 -0
  227. package/dist/commands/function/link.js.map +1 -0
  228. package/dist/commands/function/list.d.ts +16 -0
  229. package/dist/commands/function/list.js +55 -0
  230. package/dist/commands/function/list.js.map +1 -0
  231. package/dist/commands/function/logs.d.ts +29 -0
  232. package/dist/commands/function/logs.js +171 -0
  233. package/dist/commands/function/logs.js.map +1 -0
  234. package/dist/commands/function/pause.d.ts +19 -0
  235. package/dist/commands/function/pause.js +50 -0
  236. package/dist/commands/function/pause.js.map +1 -0
  237. package/dist/commands/function/releases.d.ts +15 -0
  238. package/dist/commands/function/releases.js +62 -0
  239. package/dist/commands/function/releases.js.map +1 -0
  240. package/dist/commands/function/resume.d.ts +16 -0
  241. package/dist/commands/function/resume.js +47 -0
  242. package/dist/commands/function/resume.js.map +1 -0
  243. package/dist/commands/function/rollback.d.ts +18 -0
  244. package/dist/commands/function/rollback.js +69 -0
  245. package/dist/commands/function/rollback.js.map +1 -0
  246. package/dist/commands/function/settings/set.d.ts +23 -0
  247. package/dist/commands/function/settings/set.js +119 -0
  248. package/dist/commands/function/settings/set.js.map +1 -0
  249. package/dist/commands/function/show.d.ts +15 -0
  250. package/dist/commands/function/show.js +80 -0
  251. package/dist/commands/function/show.js.map +1 -0
  252. package/dist/commands/function/unlink.d.ts +9 -0
  253. package/dist/commands/function/unlink.js +34 -0
  254. package/dist/commands/function/unlink.js.map +1 -0
  255. package/dist/commands/link.d.ts +82 -0
  256. package/dist/commands/link.js +532 -0
  257. package/dist/commands/link.js.map +1 -0
  258. package/dist/commands/login.js +9 -0
  259. package/dist/commands/login.js.map +1 -1
  260. package/dist/commands/order.js +3 -1
  261. package/dist/commands/order.js.map +1 -1
  262. package/dist/commands/payments/methods/delete.js +2 -2
  263. package/dist/commands/payments/methods/delete.js.map +1 -1
  264. package/dist/commands/resources.js +50 -7
  265. package/dist/commands/resources.js.map +1 -1
  266. package/dist/commands/status.d.ts +12 -0
  267. package/dist/commands/status.js +71 -0
  268. package/dist/commands/status.js.map +1 -0
  269. package/dist/commands/storage/detach.js +1 -1
  270. package/dist/commands/storage/detach.js.map +1 -1
  271. package/dist/commands/storage/list.js +6 -2
  272. package/dist/commands/storage/list.js.map +1 -1
  273. package/dist/commands/storage/order.d.ts +2 -0
  274. package/dist/commands/storage/order.js +100 -18
  275. package/dist/commands/storage/order.js.map +1 -1
  276. package/dist/commands/storage/resize.js +19 -6
  277. package/dist/commands/storage/resize.js.map +1 -1
  278. package/dist/commands/tickets/create.d.ts +2 -0
  279. package/dist/commands/tickets/create.js +40 -1
  280. package/dist/commands/tickets/create.js.map +1 -1
  281. package/dist/commands/tickets/download.d.ts +18 -0
  282. package/dist/commands/tickets/download.js +138 -0
  283. package/dist/commands/tickets/download.js.map +1 -0
  284. package/dist/commands/tickets/list.js +13 -7
  285. package/dist/commands/tickets/list.js.map +1 -1
  286. package/dist/commands/tickets/reply.d.ts +2 -0
  287. package/dist/commands/tickets/reply.js +33 -4
  288. package/dist/commands/tickets/reply.js.map +1 -1
  289. package/dist/commands/vds/order.js +72 -7
  290. package/dist/commands/vds/order.js.map +1 -1
  291. package/dist/commands/vps/console.js +14 -6
  292. package/dist/commands/vps/console.js.map +1 -1
  293. package/dist/commands/vps/details.js +7 -1
  294. package/dist/commands/vps/details.js.map +1 -1
  295. package/dist/commands/vps/ip/add.js +76 -9
  296. package/dist/commands/vps/ip/add.js.map +1 -1
  297. package/dist/commands/vps/list.js +13 -4
  298. package/dist/commands/vps/list.js.map +1 -1
  299. package/dist/commands/vps/order.d.ts +19 -0
  300. package/dist/commands/vps/order.js +179 -23
  301. package/dist/commands/vps/order.js.map +1 -1
  302. package/dist/commands/vps/power.js +2 -2
  303. package/dist/commands/vps/power.js.map +1 -1
  304. package/dist/commands/vps/reinstall.js +2 -2
  305. package/dist/commands/vps/reinstall.js.map +1 -1
  306. package/dist/commands/vps/resize.js +36 -13
  307. package/dist/commands/vps/resize.js.map +1 -1
  308. package/dist/commands/whoami.d.ts +5 -0
  309. package/dist/commands/whoami.js +8 -3
  310. package/dist/commands/whoami.js.map +1 -1
  311. package/dist/config/paths.d.ts +1 -1
  312. package/dist/config/paths.js +6 -1
  313. package/dist/config/paths.js.map +1 -1
  314. package/dist/config/store.d.ts +58 -0
  315. package/dist/config/store.js +84 -2
  316. package/dist/config/store.js.map +1 -1
  317. package/dist/functions-support/credits.d.ts +64 -0
  318. package/dist/functions-support/credits.js +181 -0
  319. package/dist/functions-support/credits.js.map +1 -0
  320. package/dist/functions-support/cron.d.ts +17 -0
  321. package/dist/functions-support/cron.js +99 -0
  322. package/dist/functions-support/cron.js.map +1 -0
  323. package/dist/functions-support/env.d.ts +23 -0
  324. package/dist/functions-support/env.js +44 -0
  325. package/dist/functions-support/env.js.map +1 -0
  326. package/dist/functions-support/link.d.ts +25 -0
  327. package/dist/functions-support/link.js +51 -0
  328. package/dist/functions-support/link.js.map +1 -0
  329. package/dist/functions-support/poll.d.ts +40 -0
  330. package/dist/functions-support/poll.js +109 -0
  331. package/dist/functions-support/poll.js.map +1 -0
  332. package/dist/functions-support/resolve.d.ts +3 -0
  333. package/dist/functions-support/resolve.js +31 -0
  334. package/dist/functions-support/resolve.js.map +1 -0
  335. package/dist/functions-support/runtime.d.ts +30 -0
  336. package/dist/functions-support/runtime.js +52 -0
  337. package/dist/functions-support/runtime.js.map +1 -0
  338. package/dist/functions-support/source.d.ts +92 -0
  339. package/dist/functions-support/source.js +343 -0
  340. package/dist/functions-support/source.js.map +1 -0
  341. package/dist/help/scope-aware-help.js +10 -1
  342. package/dist/help/scope-aware-help.js.map +1 -1
  343. package/dist/tui/App.js +10 -25
  344. package/dist/tui/App.js.map +1 -1
  345. package/dist/tui/components/Menu.d.ts +3 -1
  346. package/dist/tui/components/Menu.js +7 -3
  347. package/dist/tui/components/Menu.js.map +1 -1
  348. package/dist/tui/router.d.ts +1 -1
  349. package/dist/tui/router.js.map +1 -1
  350. package/dist/tui/screens/Billing.js +56 -4
  351. package/dist/tui/screens/Billing.js.map +1 -1
  352. package/dist/tui/screens/Dashboard.js +8 -7
  353. package/dist/tui/screens/Dashboard.js.map +1 -1
  354. package/dist/tui/screens/Deploy.d.ts +2 -0
  355. package/dist/tui/screens/Deploy.js +912 -0
  356. package/dist/tui/screens/Deploy.js.map +1 -0
  357. package/dist/tui/screens/Order.js +359 -26
  358. package/dist/tui/screens/Order.js.map +1 -1
  359. package/dist/tui/screens/Resources.js +273 -31
  360. package/dist/tui/screens/Resources.js.map +1 -1
  361. package/dist/tui/screens/Tickets.js +18 -6
  362. package/dist/tui/screens/Tickets.js.map +1 -1
  363. package/dist/tui/screens/deployPreset.d.ts +20 -0
  364. package/dist/tui/screens/deployPreset.js +11 -0
  365. package/dist/tui/screens/deployPreset.js.map +1 -0
  366. package/dist/tui/screens/resources/AppDetail.d.ts +7 -0
  367. package/dist/tui/screens/resources/AppDetail.js +810 -0
  368. package/dist/tui/screens/resources/AppDetail.js.map +1 -0
  369. package/dist/tui/screens/resources/FunctionDetail.d.ts +7 -0
  370. package/dist/tui/screens/resources/FunctionDetail.js +751 -0
  371. package/dist/tui/screens/resources/FunctionDetail.js.map +1 -0
  372. package/dist/ui/attach.d.ts +15 -0
  373. package/dist/ui/attach.js +63 -0
  374. package/dist/ui/attach.js.map +1 -0
  375. package/dist/ui/baremetal-resolve.d.ts +10 -0
  376. package/dist/ui/baremetal-resolve.js +50 -0
  377. package/dist/ui/baremetal-resolve.js.map +1 -0
  378. package/dist/ui/confirm.js +1 -1
  379. package/dist/ui/confirm.js.map +1 -1
  380. package/dist/ui/cycle.d.ts +66 -0
  381. package/dist/ui/cycle.js +96 -0
  382. package/dist/ui/cycle.js.map +1 -0
  383. package/dist/ui/deploy-ui.d.ts +75 -0
  384. package/dist/ui/deploy-ui.js +243 -0
  385. package/dist/ui/deploy-ui.js.map +1 -0
  386. package/dist/ui/order-result.d.ts +4 -0
  387. package/dist/ui/order-result.js +32 -0
  388. package/dist/ui/order-result.js.map +1 -0
  389. package/dist/ui/payment-gate.d.ts +26 -0
  390. package/dist/ui/payment-gate.js +70 -0
  391. package/dist/ui/payment-gate.js.map +1 -0
  392. package/dist/ui/payment.js +10 -3
  393. package/dist/ui/payment.js.map +1 -1
  394. package/dist/ui/portal.d.ts +1 -1
  395. package/dist/ui/portal.js +7 -2
  396. package/dist/ui/portal.js.map +1 -1
  397. package/dist/ui/project-resolve.d.ts +25 -0
  398. package/dist/ui/project-resolve.js +31 -0
  399. package/dist/ui/project-resolve.js.map +1 -0
  400. package/dist/ui/render-mode.d.ts +5 -0
  401. package/dist/ui/render-mode.js +1 -1
  402. package/dist/ui/render-mode.js.map +1 -1
  403. package/dist/ui/resource-detail.js +0 -3
  404. package/dist/ui/resource-detail.js.map +1 -1
  405. package/dist/ui/resource-resolve.d.ts +9 -2
  406. package/dist/ui/resource-resolve.js +11 -4
  407. package/dist/ui/resource-resolve.js.map +1 -1
  408. package/dist/ui/spinner.d.ts +10 -1
  409. package/dist/ui/spinner.js +12 -3
  410. package/dist/ui/spinner.js.map +1 -1
  411. package/dist/ui/table.d.ts +7 -0
  412. package/dist/ui/table.js +11 -0
  413. package/dist/ui/table.js.map +1 -1
  414. package/dist/ui/tax.d.ts +10 -0
  415. package/dist/ui/tax.js +31 -0
  416. package/dist/ui/tax.js.map +1 -0
  417. package/dist/ui/ticket-resolve.d.ts +9 -1
  418. package/dist/ui/ticket-resolve.js +13 -2
  419. package/dist/ui/ticket-resolve.js.map +1 -1
  420. package/dist/ui/volume-resolve.js +4 -1
  421. package/dist/ui/volume-resolve.js.map +1 -1
  422. package/dist/ui/wait.d.ts +4 -0
  423. package/dist/ui/wait.js +7 -2
  424. package/dist/ui/wait.js.map +1 -1
  425. package/dist/ui/wizard.d.ts +2 -1
  426. package/dist/ui/wizard.js +1 -1
  427. package/dist/ui/wizard.js.map +1 -1
  428. package/dist/version-check-bin.js +2 -2
  429. package/dist/version-check-bin.js.map +1 -1
  430. package/dist/version-check.d.ts +5 -0
  431. package/dist/version-check.js +6 -1
  432. package/dist/version-check.js.map +1 -1
  433. package/package.json +53 -6
@@ -0,0 +1,113 @@
1
+ import { Args, Flags } from "@oclif/core";
2
+ import { BaseCommand } from "../../base/command.js";
3
+ import { statusColor, dim } from "../../ui/glyphs.js";
4
+ import { panel } from "../../ui/wizard.js";
5
+ import { withSpinner } from "../../ui/spinner.js";
6
+ import { RUNTIMES } from "../../functions-support/runtime.js";
7
+ /**
8
+ * `synteq function create` — create a serverless function in the active project.
9
+ *
10
+ * Backend: POST /functions. Placement takes exactly one of `region` or
11
+ * `locationId`, so `--region` and `--location` are mutually exclusive; with
12
+ * neither, the first row of GET /functions-locations is used. The plan
13
+ * defaults to the first tier GET /functions-plans returns.
14
+ */
15
+ export default class FunctionCreate extends BaseCommand {
16
+ static apiKeyScope = "none";
17
+ static description = "Create a serverless function in the active project.";
18
+ static examples = [
19
+ "<%= config.bin %> function create my-fn",
20
+ "<%= config.bin %> function create my-fn --runtime python312 --location dfw",
21
+ "<%= config.bin %> function create my-fn --plan starter --region us-central",
22
+ "<%= config.bin %> function create my-fn -o json # scriptable: prints the Fn row",
23
+ ];
24
+ static args = {
25
+ name: Args.string({
26
+ required: true,
27
+ description: "Function name — slugified into <name>.fn.synteq.app; unique within the project.",
28
+ }),
29
+ };
30
+ static flags = {
31
+ plan: Flags.string({
32
+ description: "Plan tier slug (default: the first tier `synteq function create` finds server-side).",
33
+ }),
34
+ region: Flags.string({
35
+ exclusive: ["location"],
36
+ description: "Region to run in, e.g. us-central (mutually exclusive with --location).",
37
+ }),
38
+ location: Flags.string({
39
+ exclusive: ["region"],
40
+ description: "Location code, e.g. dfw — resolved against the locations catalog (mutually exclusive with --region). Default: the first location.",
41
+ }),
42
+ runtime: Flags.string({
43
+ options: [...RUNTIMES],
44
+ default: "node22",
45
+ description: `Handler runtime: ${RUNTIMES.join(" or ")} (default: node22).`,
46
+ }),
47
+ project: Flags.string({
48
+ description: "Project id to create in (defaults to the active project).",
49
+ }),
50
+ };
51
+ async run() {
52
+ await this.initClients();
53
+ const { args, flags } = await this.parse(FunctionCreate);
54
+ try {
55
+ const body = {
56
+ name: args.name,
57
+ planTier: flags.plan ?? (await this.defaultPlan()),
58
+ runtime: flags.runtime,
59
+ };
60
+ if (flags.region) {
61
+ body.region = flags.region;
62
+ }
63
+ else {
64
+ const loc = await this.resolveLocation(flags.location);
65
+ if (loc)
66
+ body.locationId = loc;
67
+ }
68
+ const fn = await withSpinner(`Creating ${args.name}`, () => this.clients.api.functions.create(body, flags.project));
69
+ this.emit(fn, () => {
70
+ this.log(panel("Function created", [
71
+ ["Slug", fn.slug],
72
+ ["ID", fn.id],
73
+ ["Status", statusColor(fn.status)],
74
+ ["Runtime", fn.runtime],
75
+ ["Plan", fn.planTier],
76
+ ["Region", fn.region],
77
+ ["Hostname", fn.hostname],
78
+ ]));
79
+ this.log("");
80
+ this.log(`Deploy it: synteq function deploy --name ${fn.slug}`);
81
+ this.log(dim(` Or scaffold a handler here first: synteq function init ${fn.slug}`));
82
+ });
83
+ }
84
+ catch (err) {
85
+ this.fail(err);
86
+ }
87
+ }
88
+ /** The first plan the catalog offers — the backend has no "default" flag. */
89
+ async defaultPlan() {
90
+ const plans = await this.clients.api.functions.plans();
91
+ if (plans.length === 0) {
92
+ this.error("No function plans are available on this account.", { exit: 1 });
93
+ }
94
+ return plans[0].name;
95
+ }
96
+ /** A location code → its id, or the first location's id when none is given. */
97
+ async resolveLocation(code) {
98
+ const locations = await this.clients.api.functions.locations();
99
+ if (locations.length === 0) {
100
+ if (code)
101
+ this.error(`Unknown location "${code}" — no locations are available.`, { exit: 1 });
102
+ return undefined;
103
+ }
104
+ if (!code)
105
+ return locations[0].locationId;
106
+ const hit = locations.find((l) => l.code.toLowerCase() === code.toLowerCase());
107
+ if (!hit) {
108
+ this.error(`Unknown location "${code}". Available: ${locations.map((l) => l.code).join(", ")}.`, { exit: 1 });
109
+ }
110
+ return hit.locationId;
111
+ }
112
+ }
113
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/function/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C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AAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAC/E,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,IAAI,CAAC,KAAK,CACR,qBAAqB,IAAI,iBAAiB,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EACpF,EAAE,IAAI,EAAE,CAAC,EAAE,CACZ,CAAC;QACJ,CAAC;QACD,OAAO,GAAG,CAAC,UAAU,CAAC;IACxB,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { BaseCommand } from "../../../base/command.js";
2
+ /**
3
+ * `synteq function credits add` — buy run credits: price → confirm → charge,
4
+ * the `orderPaidApp` shape. The team pool has a quote route (tax included);
5
+ * a function's own pool does not, so its confirm line is the billing view's
6
+ * credit rate × runs, labelled an estimate with tax added at checkout.
7
+ *
8
+ * Backend: POST /functions/{id}/credits/purchase, or
9
+ * POST /functions-team-credits/quote + /functions-team-credits/purchase.
10
+ * The purchase mints a due-on-receipt invoice; the credits land when it
11
+ * settles (instantly for a card).
12
+ */
13
+ export default class FunctionCreditsAdd extends BaseCommand {
14
+ static apiKeyScope: string;
15
+ static description: string;
16
+ static examples: string[];
17
+ static args: {
18
+ target: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
19
+ };
20
+ static flags: {
21
+ name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
+ runs: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ pool: import("@oclif/core/interfaces").BooleanFlag<boolean>;
24
+ "payment-method": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
25
+ "apply-credits": import("@oclif/core/interfaces").BooleanFlag<boolean>;
26
+ yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
27
+ };
28
+ run(): Promise<void>;
29
+ }
@@ -0,0 +1,209 @@
1
+ import { Args, Flags } from "@oclif/core";
2
+ import open from "open";
3
+ import { BaseCommand } from "../../../base/command.js";
4
+ import { ApiError } from "../../../api/errors.js";
5
+ import { CreditsPaymentError, creditsChargeLine, money, num, pickCreditsMethod, resolveCreditsFunction, runs as runsText, poolByDefault } from "../../../functions-support/credits.js";
6
+ import { withSpinner } from "../../../ui/spinner.js";
7
+ import { confirmAction, isInteractive, panel, promptNumber, readBalance } from "../../../ui/wizard.js";
8
+ import { yesRequiredMessage } from "../../../ui/confirm.js";
9
+ import { dim, ok, statusColor } from "../../../ui/glyphs.js";
10
+ /**
11
+ * `synteq function credits add` — buy run credits: price → confirm → charge,
12
+ * the `orderPaidApp` shape. The team pool has a quote route (tax included);
13
+ * a function's own pool does not, so its confirm line is the billing view's
14
+ * credit rate × runs, labelled an estimate with tax added at checkout.
15
+ *
16
+ * Backend: POST /functions/{id}/credits/purchase, or
17
+ * POST /functions-team-credits/quote + /functions-team-credits/purchase.
18
+ * The purchase mints a due-on-receipt invoice; the credits land when it
19
+ * settles (instantly for a card).
20
+ */
21
+ export default class FunctionCreditsAdd extends BaseCommand {
22
+ static apiKeyScope = "none";
23
+ static description = [
24
+ "Buy run credits for a function (or the team pool) with a saved payment method.",
25
+ "",
26
+ "Prices the purchase, asks you to confirm the charge, then charges it. The",
27
+ "team pool's price is a quote with tax; a function's own pool is priced from",
28
+ "its credit rate (tax is added at checkout). Piped runs require --yes.",
29
+ ].join("\n");
30
+ static examples = [
31
+ "<%= config.bin %> function credits add --runs 100000 # linked function; pick a card, confirm",
32
+ "<%= config.bin %> function credits add --name my-fn --runs 100000 --payment-method 019e... --yes",
33
+ "<%= config.bin %> function credits add --pool --runs 1000000 --apply-credits",
34
+ "<%= config.bin %> function credits add --name my-fn --runs 100000 --yes -o json",
35
+ ];
36
+ static args = {
37
+ target: Args.string({ required: false, description: "Function slug or id (optional; default: the directory's linked function or --name)." }),
38
+ };
39
+ static flags = {
40
+ name: Flags.string({
41
+ description: "Function slug (or uuid) (default: this directory's linked function).",
42
+ exclusive: ["pool"],
43
+ }),
44
+ runs: Flags.integer({
45
+ min: 1,
46
+ description: "How many run credits to buy (a whole number; the plan may set a min, max and step — see `function credits`). Prompted on a TTY when omitted.",
47
+ }),
48
+ pool: Flags.boolean({
49
+ description: "Buy into the team pool instead of one function's credits.",
50
+ }),
51
+ "payment-method": Flags.string({
52
+ description: "Saved payment method id (full or a unique prefix, see `synteq payments methods list`) (default: the team's default method).",
53
+ }),
54
+ "apply-credits": Flags.boolean({
55
+ description: "Use the team's account credit balance first; the payment method pays the rest.",
56
+ }),
57
+ yes: Flags.boolean({
58
+ char: "y",
59
+ description: "Charge without confirming. Required when stdout is not a TTY.",
60
+ }),
61
+ };
62
+ async run() {
63
+ await this.initClients();
64
+ const { args, flags: rawFlags } = await this.parse(FunctionCreditsAdd);
65
+ const flags = { ...rawFlags, name: args.target ?? rawFlags.name };
66
+ try {
67
+ const interactive = isInteractive() && this.outputFormat === "table" && !flags.yes;
68
+ let runs = flags.runs;
69
+ if (runs === undefined) {
70
+ if (!interactive)
71
+ this.error("Provide --runs <N>: how many run credits to buy.", { exit: 1 });
72
+ runs = await promptNumber("How many run credits?", { min: 1 });
73
+ if (!Number.isInteger(runs))
74
+ this.error("Run credits come in whole runs.", { exit: 1 });
75
+ }
76
+ // 1. The price. A refused quote (off the purchase grid, no credits on
77
+ // this plan) is the answer, not a degraded estimate: say it and stop.
78
+ let fnId;
79
+ let target = "in the team pool";
80
+ let total;
81
+ let taxTotal = 0;
82
+ let taxLabel = "tax";
83
+ let currency = "USD";
84
+ let estimate = false;
85
+ const quotePool = async () => {
86
+ const q = await withSpinner("Pricing", () => this.clients.api.functions.quoteTeamCredits({ runs: runs })).catch((e) => {
87
+ if (e instanceof ApiError && e.status >= 400 && e.status < 500 && e.status !== 429) {
88
+ this.error(`Can't buy ${runs.toLocaleString("en-US")} run credits: ${e.detail}`, { exit: 1 });
89
+ }
90
+ throw e;
91
+ });
92
+ total = Number(q.total);
93
+ taxTotal = Number(q.tax ?? 0);
94
+ taxLabel = q.taxLabel ?? "tax";
95
+ currency = q.currency ?? "USD";
96
+ };
97
+ if (poolByDefault(this.clients, flags)) {
98
+ const team = await withSpinner("Loading the team pool", () => this.clients.api.functions.teamBilling());
99
+ if (!team.hasTeamPlan) {
100
+ this.error("This team has no team-level function plan — each function bills on its own. Pass --name <slug> instead of --pool.", { exit: 1 });
101
+ }
102
+ await quotePool();
103
+ }
104
+ else {
105
+ const { fn, clients } = await resolveCreditsFunction(this.clients, flags).catch((e) => {
106
+ if (e instanceof Error && !("status" in e))
107
+ this.error(e.message, { exit: 1 });
108
+ throw e;
109
+ });
110
+ this.clients = clients;
111
+ fnId = fn.id;
112
+ const billing = await withSpinner("Loading credits", () => this.clients.api.functions.billing(fn.id));
113
+ const rate = num(billing.creditRateUsd);
114
+ if (rate === null) {
115
+ this.error(`${fn.slug}'s plan doesn't sell run credits.`, { exit: 1 });
116
+ }
117
+ if (billing.source === "team") {
118
+ // A team-plan function's credits land in the team pool, priced at
119
+ // the pool's rate — exactly what the pool's quote route prices.
120
+ target = `on ${fn.slug} (they land in the team pool)`;
121
+ await quotePool();
122
+ }
123
+ else {
124
+ // No per-function quote route: rate × runs, tax at checkout.
125
+ target = `on ${fn.slug}`;
126
+ total = Math.round(rate * runs * 100) / 100;
127
+ estimate = true;
128
+ }
129
+ }
130
+ // 2. Account credit first, when the team has some and asked (or is asked).
131
+ const balance = await this.clients.api.billing.balance().catch(() => ({}));
132
+ const credit = readBalance(balance.credit);
133
+ let applyCredits = Boolean(flags["apply-credits"]);
134
+ if (!applyCredits && credit > 0 && interactive) {
135
+ applyCredits = await confirmAction(`Apply your credit balance (${money(credit)}) first?`, true);
136
+ }
137
+ const creditsApplied = applyCredits ? Math.min(credit, total) : 0;
138
+ // An estimate leaves tax out, so credit "covering" it can't be trusted:
139
+ // a card still backs the residual.
140
+ const coveredByCredit = applyCredits && !estimate && total > 0 && credit >= total;
141
+ // 3. A card the function_credits touchpoint may charge.
142
+ let method;
143
+ if (!coveredByCredit) {
144
+ method = await pickCreditsMethod(this.clients, {
145
+ paymentMethodId: flags["payment-method"],
146
+ interactive,
147
+ }).catch((e) => {
148
+ if (e instanceof CreditsPaymentError)
149
+ this.error(e.message, { exit: 1 });
150
+ throw e;
151
+ });
152
+ }
153
+ // 4. Confirm. A script passes --yes; a run nobody can answer must not
154
+ // charge silently.
155
+ const line = creditsChargeLine({
156
+ total: total, taxTotal, taxLabel, currency, estimate, runs, target, method, creditsApplied,
157
+ });
158
+ if (!flags.yes) {
159
+ if (!interactive) {
160
+ this.error(`${line.replace(/\?$/, ".")}\n${yesRequiredMessage("`function credits add`")}`, { exit: 1 });
161
+ }
162
+ if (!(await confirmAction(line, true))) {
163
+ this.log("Not charged.");
164
+ return;
165
+ }
166
+ }
167
+ else if (this.outputFormat === "table") {
168
+ this.log(dim(line.replace(/\?$/, ".")));
169
+ }
170
+ // 5. Charge.
171
+ const body = { runs };
172
+ if (method)
173
+ body.payment_method_id = method.id;
174
+ body.apply_credits = applyCredits;
175
+ const result = await withSpinner("Charging", () => fnId
176
+ ? this.clients.api.functions.purchaseCredits(fnId, body)
177
+ : this.clients.api.functions.purchaseTeamCredits(body));
178
+ this.emit(result, () => {
179
+ const amount = num(result.amountUsd);
180
+ this.log(panel("Run credits purchase", [
181
+ ["Status", statusColor(result.status)],
182
+ ["Runs", runsText(result.runs)],
183
+ ["Amount", amount !== null ? money(amount) : null],
184
+ ["Balance", result.creditBalance != null ? runsText(result.creditBalance) : null],
185
+ ["Invoice id", result.invoiceId],
186
+ ["Charge id", result.chargeId],
187
+ ["Provider", result.provider],
188
+ ["Checkout URL", result.checkoutUrl],
189
+ ]));
190
+ if (result.checkoutUrl) {
191
+ this.log(dim(" The credits land once the checkout is paid."));
192
+ }
193
+ else if (["paid", "succeeded", "success", "complete"].includes((result.status ?? "").toLowerCase())) {
194
+ this.log(ok(`Added ${runsText(result.runs)}.`));
195
+ }
196
+ });
197
+ if (result.checkoutUrl && process.stdout.isTTY) {
198
+ try {
199
+ await open(result.checkoutUrl);
200
+ }
201
+ catch { }
202
+ }
203
+ }
204
+ catch (err) {
205
+ this.fail(err);
206
+ }
207
+ }
208
+ }
209
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../../../src/commands/function/credits/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,EACL,GAAG,EACH,iBAAiB,EACjB,sBAAsB,EACtB,IAAI,IAAI,QAAQ,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG7D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,WAAW;IACzD,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,WAAW,GAAG;QACnB,gFAAgF;QAChF,EAAE;QACF,2EAA2E;QAC3E,6EAA6E;QAC7E,uEAAuE;KACxE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACb,MAAM,CAAC,Q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C;QACjB,CAAC;IACH,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { BaseCommand } from "../../../base/command.js";
2
+ /**
3
+ * `synteq function credits auto-reload` — arm, re-tune or disarm the credit
4
+ * standing order: when the balance drops below the threshold, buy `--runs`
5
+ * more on the team's default payment method.
6
+ *
7
+ * Backend: PUT /functions/{id}/credits/auto-reload (or the team pool's
8
+ * /functions-team-credits/auto-reload), then the billing view is re-read so
9
+ * what prints is the state the server now holds.
10
+ */
11
+ export default class FunctionCreditsAutoReload extends BaseCommand {
12
+ static apiKeyScope: string;
13
+ static description: string;
14
+ static examples: string[];
15
+ static args: {
16
+ target: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
17
+ };
18
+ static flags: {
19
+ name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ pool: import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
+ on: import("@oclif/core/interfaces").BooleanFlag<boolean>;
22
+ off: import("@oclif/core/interfaces").BooleanFlag<boolean>;
23
+ runs: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
+ threshold: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
25
+ };
26
+ run(): Promise<void>;
27
+ }
@@ -0,0 +1,107 @@
1
+ import { Args, Flags } from "@oclif/core";
2
+ import { BaseCommand } from "../../../base/command.js";
3
+ import { functionCreditRows, resolveCreditsFunction, teamCreditRows, poolByDefault } from "../../../functions-support/credits.js";
4
+ import { withSpinner } from "../../../ui/spinner.js";
5
+ import { panel } from "../../../ui/wizard.js";
6
+ import { ok } from "../../../ui/glyphs.js";
7
+ /**
8
+ * `synteq function credits auto-reload` — arm, re-tune or disarm the credit
9
+ * standing order: when the balance drops below the threshold, buy `--runs`
10
+ * more on the team's default payment method.
11
+ *
12
+ * Backend: PUT /functions/{id}/credits/auto-reload (or the team pool's
13
+ * /functions-team-credits/auto-reload), then the billing view is re-read so
14
+ * what prints is the state the server now holds.
15
+ */
16
+ export default class FunctionCreditsAutoReload extends BaseCommand {
17
+ static apiKeyScope = "none";
18
+ static description = [
19
+ "Turn run-credit auto-reload on or off for a function (or the team pool).",
20
+ "",
21
+ "--on --runs N buys N run credits whenever the balance drops below",
22
+ "--threshold (default: below one reload's worth). --off disarms it and",
23
+ "clears both numbers. A function on a team plan reloads the team pool.",
24
+ ].join("\n");
25
+ static examples = [
26
+ "<%= config.bin %> function credits auto-reload --on --runs 100000 # linked function",
27
+ "<%= config.bin %> function credits auto-reload --name my-fn --on --runs 100000 --threshold 20000",
28
+ "<%= config.bin %> function credits auto-reload --pool --off",
29
+ "<%= config.bin %> function credits auto-reload --name my-fn --off -o json",
30
+ ];
31
+ static args = {
32
+ target: Args.string({ required: false, description: "Function slug or id (optional; default: the directory's linked function or --name)." }),
33
+ };
34
+ static flags = {
35
+ name: Flags.string({
36
+ description: "Function slug (or uuid) (default: this directory's linked function).",
37
+ exclusive: ["pool"],
38
+ }),
39
+ pool: Flags.boolean({
40
+ description: "Set the team pool's auto-reload instead of one function's.",
41
+ }),
42
+ on: Flags.boolean({
43
+ description: "Arm auto-reload. Needs --runs.",
44
+ exclusive: ["off"],
45
+ }),
46
+ off: Flags.boolean({
47
+ description: "Disarm auto-reload (clears the reload size and threshold).",
48
+ exclusive: ["on", "runs", "threshold"],
49
+ }),
50
+ runs: Flags.integer({
51
+ min: 1,
52
+ description: "Run credits each reload buys (with --on; required to arm).",
53
+ }),
54
+ threshold: Flags.integer({
55
+ min: 1,
56
+ description: "Reload when the balance drops below this many runs (with --on; default: one reload's worth).",
57
+ }),
58
+ };
59
+ async run() {
60
+ await this.initClients();
61
+ const { args, flags: rawFlags } = await this.parse(FunctionCreditsAutoReload);
62
+ const flags = { ...rawFlags, name: args.target ?? rawFlags.name };
63
+ try {
64
+ if (!flags.on && !flags.off) {
65
+ this.error("Pass --on --runs <N> [--threshold <N>] to arm auto-reload, or --off to disarm it.", { exit: 1 });
66
+ }
67
+ if (flags.on && flags.runs === undefined) {
68
+ this.error("--on needs --runs <N>: how many run credits each reload buys.", { exit: 1 });
69
+ }
70
+ const body = flags.on
71
+ ? {
72
+ enabled: true,
73
+ runs: flags.runs,
74
+ ...(flags.threshold !== undefined ? { threshold_runs: flags.threshold } : {}),
75
+ }
76
+ : { enabled: false };
77
+ const verb = flags.on ? "Arming auto-reload" : "Turning auto-reload off";
78
+ if (poolByDefault(this.clients, flags)) {
79
+ await withSpinner(verb, () => this.clients.api.functions.setTeamCreditAutoReload(body));
80
+ const team = await this.clients.api.functions.teamBilling();
81
+ this.emit(team, () => {
82
+ this.log(ok(`Auto-reload ${flags.on ? "on" : "off"} for the team pool.`));
83
+ if (team.hasTeamPlan && team.plan)
84
+ this.log(panel("Team run credits", teamCreditRows(team)));
85
+ });
86
+ return;
87
+ }
88
+ const { fn, clients } = await resolveCreditsFunction(this.clients, flags).catch((e) => {
89
+ if (e instanceof Error && !("status" in e))
90
+ this.error(e.message, { exit: 1 });
91
+ throw e;
92
+ });
93
+ this.clients = clients;
94
+ await withSpinner(verb, () => this.clients.api.functions.setCreditAutoReload(fn.id, body));
95
+ const billing = await this.clients.api.functions.billing(fn.id);
96
+ this.emit(billing, () => {
97
+ const where = billing.source === "team" ? `${fn.slug}'s pool (the team pool)` : fn.slug;
98
+ this.log(ok(`Auto-reload ${flags.on ? "on" : "off"} for ${where}.`));
99
+ this.log(panel("Run credits", functionCreditRows(fn.slug, billing)));
100
+ });
101
+ }
102
+ catch (err) {
103
+ this.fail(err);
104
+ }
105
+ }
106
+ }
107
+ //# sourceMappingURL=auto-reload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-reload.js","sourceRoot":"","sources":["../../../../src/commands/function/credits/auto-reload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;A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AAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,mBAAmB,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;YAC3F,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YAChE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE;gBACtB,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,yBAAyB,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC;gBACxF,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,eAAe,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,KAAK,GAAG,CAAC,CAAC,CAAC;gBACrE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,EAAE,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;YACvE,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACjB,CAAC;IACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { BaseCommand } from "../../../base/command.js";
2
+ /**
3
+ * `synteq function credits` — a function's run credits: balance, plan,
4
+ * monthly grant, credit rate and the auto-reload standing order. `--pool`
5
+ * shows the team pool instead (every function without its own plan spends
6
+ * from it).
7
+ *
8
+ * Backend: GET /functions/{id}/billing, or GET /functions-team-billing.
9
+ */
10
+ export default class FunctionCredits extends BaseCommand {
11
+ static apiKeyScope: string;
12
+ static description: string;
13
+ static examples: string[];
14
+ static args: {
15
+ target: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
16
+ };
17
+ static flags: {
18
+ name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ pool: import("@oclif/core/interfaces").BooleanFlag<boolean>;
20
+ };
21
+ run(): Promise<void>;
22
+ }
@@ -0,0 +1,80 @@
1
+ import { Args, Flags } from "@oclif/core";
2
+ import { BaseCommand } from "../../../base/command.js";
3
+ import { functionCreditRows, resolveCreditsFunction, teamCreditRows, poolByDefault } from "../../../functions-support/credits.js";
4
+ import { withSpinner } from "../../../ui/spinner.js";
5
+ import { panel } from "../../../ui/wizard.js";
6
+ import { dim } from "../../../ui/glyphs.js";
7
+ /**
8
+ * `synteq function credits` — a function's run credits: balance, plan,
9
+ * monthly grant, credit rate and the auto-reload standing order. `--pool`
10
+ * shows the team pool instead (every function without its own plan spends
11
+ * from it).
12
+ *
13
+ * Backend: GET /functions/{id}/billing, or GET /functions-team-billing.
14
+ */
15
+ export default class FunctionCredits extends BaseCommand {
16
+ static apiKeyScope = "none";
17
+ static description = [
18
+ "Show a function's run credits: balance, plan, monthly grant, credit rate and auto-reload.",
19
+ "",
20
+ "Run credits pay for invocations on a credits plan. --pool shows the team",
21
+ "pool that every function without its own plan draws from. Buy more with",
22
+ "`function credits add`; keep the balance topped up with",
23
+ "`function credits auto-reload`.",
24
+ ].join("\n");
25
+ static examples = [
26
+ "<%= config.bin %> function credits # bare: this directory's linked function",
27
+ "<%= config.bin %> function credits --name my-fn",
28
+ "<%= config.bin %> function credits --pool # the team pool",
29
+ "<%= config.bin %> function credits --name my-fn -o json",
30
+ ];
31
+ static args = {
32
+ target: Args.string({ required: false, description: "Function slug or id (optional; default: the directory's linked function or --name)." }),
33
+ };
34
+ static flags = {
35
+ name: Flags.string({
36
+ description: "Function slug (or uuid) (default: this directory's linked function).",
37
+ exclusive: ["pool"],
38
+ }),
39
+ pool: Flags.boolean({
40
+ description: "Show the team pool instead of one function's credits.",
41
+ }),
42
+ };
43
+ async run() {
44
+ await this.initClients();
45
+ const { args, flags: rawFlags } = await this.parse(FunctionCredits);
46
+ const flags = { ...rawFlags, name: args.target ?? rawFlags.name };
47
+ try {
48
+ if (poolByDefault(this.clients, flags)) {
49
+ const team = await withSpinner("Loading the team pool", () => this.clients.api.functions.teamBilling());
50
+ this.emit(team, () => {
51
+ if (!team.hasTeamPlan || !team.plan) {
52
+ this.log("This team has no team-level function plan — each function bills on its own.");
53
+ this.log(dim(" See one: synteq function credits --name <slug>"));
54
+ return;
55
+ }
56
+ this.log(panel("Team run credits", teamCreditRows(team)));
57
+ });
58
+ return;
59
+ }
60
+ const { fn, clients } = await resolveCreditsFunction(this.clients, flags).catch((e) => {
61
+ if (e instanceof Error && !("status" in e))
62
+ this.error(e.message, { exit: 1 });
63
+ throw e;
64
+ });
65
+ this.clients = clients;
66
+ const billing = await withSpinner("Loading credits", () => this.clients.api.functions.billing(fn.id));
67
+ this.emit(billing, () => {
68
+ this.log(panel("Run credits", functionCreditRows(fn.slug, billing)));
69
+ if (billing.creditRateUsd == null) {
70
+ this.log("");
71
+ this.log(dim(" This function's plan doesn't sell run credits."));
72
+ }
73
+ });
74
+ }
75
+ catch (err) {
76
+ this.fail(err);
77
+ }
78
+ }
79
+ }
80
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/function/credits/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAClI,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5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