@abyss-project/reflex 6.3.0 → 6.5.0

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 (317) hide show
  1. package/.eslintrc.js +32 -32
  2. package/README.md +15 -15
  3. package/dist/api/code-environment.api.d.ts +2 -0
  4. package/dist/api/code-environment.api.js +7 -0
  5. package/dist/api/code-environment.api.js.map +1 -0
  6. package/dist/api/function-run.api.d.ts +2 -1
  7. package/dist/api/function-run.api.js +3 -1
  8. package/dist/api/function-run.api.js.map +1 -1
  9. package/dist/api/function-settings.api.d.ts +3 -1
  10. package/dist/api/function-settings.api.js +7 -1
  11. package/dist/api/function-settings.api.js.map +1 -1
  12. package/dist/api/index.d.ts +3 -0
  13. package/dist/api/index.js +3 -0
  14. package/dist/api/index.js.map +1 -1
  15. package/dist/api/service-template.api.d.ts +2 -0
  16. package/dist/api/service-template.api.js +7 -0
  17. package/dist/api/service-template.api.js.map +1 -0
  18. package/dist/api/storage-surplus.admin.api.d.ts +5 -0
  19. package/dist/api/storage-surplus.admin.api.js +17 -0
  20. package/dist/api/storage-surplus.admin.api.js.map +1 -0
  21. package/dist/code/index.d.ts +1 -0
  22. package/dist/code/index.js +18 -0
  23. package/dist/code/index.js.map +1 -0
  24. package/dist/code/reflex-code-declarations.d.ts +1 -0
  25. package/dist/code/reflex-code-declarations.js +644 -0
  26. package/dist/code/reflex-code-declarations.js.map +1 -0
  27. package/dist/index.d.ts +25 -0
  28. package/dist/index.js +28 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/types/enum/index.d.ts +4 -0
  31. package/dist/types/enum/index.js +4 -0
  32. package/dist/types/enum/index.js.map +1 -1
  33. package/dist/types/enum/reflex-code-diagnostic-category.enum.d.ts +6 -0
  34. package/dist/types/enum/reflex-code-diagnostic-category.enum.js +11 -0
  35. package/dist/types/enum/reflex-code-diagnostic-category.enum.js.map +1 -0
  36. package/dist/types/enum/reflex-error-code.enum.d.ts +5 -1
  37. package/dist/types/enum/reflex-error-code.enum.js +4 -0
  38. package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
  39. package/dist/types/enum/service-template-follow-up-kind.enum.d.ts +10 -0
  40. package/dist/types/enum/service-template-follow-up-kind.enum.js +15 -0
  41. package/dist/types/enum/service-template-follow-up-kind.enum.js.map +1 -0
  42. package/dist/types/enum/service-template-id.enum.d.ts +10 -0
  43. package/dist/types/enum/service-template-id.enum.js +15 -0
  44. package/dist/types/enum/service-template-id.enum.js.map +1 -0
  45. package/dist/types/enum/service-template-parameter-kind.enum.d.ts +4 -0
  46. package/dist/types/enum/service-template-parameter-kind.enum.js +9 -0
  47. package/dist/types/enum/service-template-parameter-kind.enum.js.map +1 -0
  48. package/dist/types/enum/trigger-access-mode.enum.d.ts +2 -1
  49. package/dist/types/enum/trigger-access-mode.enum.js +1 -0
  50. package/dist/types/enum/trigger-access-mode.enum.js.map +1 -1
  51. package/dist/types/interface/api/requests/application-run-settings.request.d.ts +1 -0
  52. package/dist/types/interface/api/requests/code-environment.request.d.ts +3 -0
  53. package/dist/types/interface/api/requests/code-environment.request.js +3 -0
  54. package/dist/types/interface/api/requests/code-environment.request.js.map +1 -0
  55. package/dist/types/interface/api/requests/function-run.request.d.ts +8 -0
  56. package/dist/types/interface/api/requests/function-settings.request.d.ts +12 -0
  57. package/dist/types/interface/api/requests/index.d.ts +3 -0
  58. package/dist/types/interface/api/requests/index.js +3 -0
  59. package/dist/types/interface/api/requests/index.js.map +1 -1
  60. package/dist/types/interface/api/requests/service-template.request.d.ts +3 -0
  61. package/dist/types/interface/api/requests/service-template.request.js +3 -0
  62. package/dist/types/interface/api/requests/service-template.request.js.map +1 -0
  63. package/dist/types/interface/api/requests/service.request.d.ts +3 -1
  64. package/dist/types/interface/api/requests/storage-surplus.admin.request.d.ts +8 -0
  65. package/dist/types/interface/api/requests/storage-surplus.admin.request.js +3 -0
  66. package/dist/types/interface/api/requests/storage-surplus.admin.request.js.map +1 -0
  67. package/dist/types/interface/api/responses/code-environment.response.d.ts +6 -0
  68. package/dist/types/interface/api/responses/code-environment.response.js +3 -0
  69. package/dist/types/interface/api/responses/code-environment.response.js.map +1 -0
  70. package/dist/types/interface/api/responses/function-run.response.d.ts +4 -0
  71. package/dist/types/interface/api/responses/function-settings.response.d.ts +5 -1
  72. package/dist/types/interface/api/responses/index.d.ts +3 -0
  73. package/dist/types/interface/api/responses/index.js +3 -0
  74. package/dist/types/interface/api/responses/index.js.map +1 -1
  75. package/dist/types/interface/api/responses/service-template.response.d.ts +6 -0
  76. package/dist/types/interface/api/responses/service-template.response.js +3 -0
  77. package/dist/types/interface/api/responses/service-template.response.js.map +1 -0
  78. package/dist/types/interface/api/responses/storage-surplus.admin.response.d.ts +8 -0
  79. package/dist/types/interface/api/responses/storage-surplus.admin.response.js +3 -0
  80. package/dist/types/interface/api/responses/storage-surplus.admin.response.js.map +1 -0
  81. package/dist/types/interface/models/index.d.ts +5 -0
  82. package/dist/types/interface/models/index.js +5 -0
  83. package/dist/types/interface/models/index.js.map +1 -1
  84. package/dist/types/interface/models/reflex-code-diagnostic.model.d.ts +10 -0
  85. package/dist/types/interface/models/reflex-code-diagnostic.model.js +5 -0
  86. package/dist/types/interface/models/reflex-code-diagnostic.model.js.map +1 -0
  87. package/dist/types/interface/models/reflex-code-environment.model.d.ts +9 -0
  88. package/dist/types/interface/models/reflex-code-environment.model.js +3 -0
  89. package/dist/types/interface/models/reflex-code-environment.model.js.map +1 -0
  90. package/dist/types/interface/models/reflex-run-retention.model.d.ts +13 -0
  91. package/dist/types/interface/models/reflex-run-retention.model.js +8 -0
  92. package/dist/types/interface/models/reflex-run-retention.model.js.map +1 -0
  93. package/dist/types/interface/models/reflex-run-settings.model.d.ts +4 -0
  94. package/dist/types/interface/models/reflex-run.model.d.ts +5 -0
  95. package/dist/types/interface/models/reflex-service-deployment.model.d.ts +2 -2
  96. package/dist/types/interface/models/reflex-service-template.model.d.ts +33 -0
  97. package/dist/types/interface/models/reflex-service-template.model.js +3 -0
  98. package/dist/types/interface/models/reflex-service-template.model.js.map +1 -0
  99. package/dist/types/interface/models/reflex-service.model.d.ts +1 -0
  100. package/dist/types/interface/models/reflex-storage-surplus.model.d.ts +11 -0
  101. package/dist/types/interface/models/reflex-storage-surplus.model.js +3 -0
  102. package/dist/types/interface/models/reflex-storage-surplus.model.js.map +1 -0
  103. package/jest.config.ts +11 -11
  104. package/package.json +1 -1
  105. package/src/api/alert-rule.api.test.ts +72 -72
  106. package/src/api/alert-rule.api.ts +57 -57
  107. package/src/api/application-insights.api.test.ts +42 -42
  108. package/src/api/application-insights.api.ts +38 -38
  109. package/src/api/application-run-settings.api.test.ts +62 -51
  110. package/src/api/application-run-settings.api.ts +30 -30
  111. package/src/api/code-environment.api.ts +15 -0
  112. package/src/api/function-access.api.ts +87 -87
  113. package/src/api/function-insights.api.test.ts +27 -27
  114. package/src/api/function-insights.api.ts +18 -18
  115. package/src/api/function-run.api.ts +53 -38
  116. package/src/api/function-settings.api.ts +96 -74
  117. package/src/api/function-template.api.test.ts +72 -72
  118. package/src/api/function-template.api.ts +52 -52
  119. package/src/api/function-test.api.ts +34 -34
  120. package/src/api/function-version.api.ts +66 -66
  121. package/src/api/function.api.test.ts +346 -291
  122. package/src/api/function.api.ts +62 -62
  123. package/src/api/health.api.ts +10 -10
  124. package/src/api/index.ts +29 -26
  125. package/src/api/route-stats.api.test.ts +45 -45
  126. package/src/api/route-stats.api.ts +36 -36
  127. package/src/api/service-completion-webhook.api.test.ts +97 -97
  128. package/src/api/service-completion-webhook.api.ts +39 -39
  129. package/src/api/service-configuration.api.ts +16 -16
  130. package/src/api/service-consumer.api.test.ts +104 -104
  131. package/src/api/service-consumer.api.ts +90 -90
  132. package/src/api/service-deployment.api.ts +79 -79
  133. package/src/api/service-discord-event.api.test.ts +106 -106
  134. package/src/api/service-discord-event.api.ts +78 -78
  135. package/src/api/service-discord.api.test.ts +178 -178
  136. package/src/api/service-discord.api.ts +222 -222
  137. package/src/api/service-insights.api.test.ts +36 -36
  138. package/src/api/service-insights.api.ts +42 -42
  139. package/src/api/service-limits.api.test.ts +100 -100
  140. package/src/api/service-limits.api.ts +37 -37
  141. package/src/api/service-openapi.api.test.ts +52 -52
  142. package/src/api/service-openapi.api.ts +21 -21
  143. package/src/api/service-route.api.ts +2 -2
  144. package/src/api/service-task.api.test.ts +140 -140
  145. package/src/api/service-task.api.ts +141 -141
  146. package/src/api/service-template.api.test.ts +41 -0
  147. package/src/api/service-template.api.ts +12 -0
  148. package/src/api/service-version.api.ts +54 -54
  149. package/src/api/service.api.test.ts +220 -215
  150. package/src/api/service.api.ts +55 -55
  151. package/src/api/storage-surplus.admin.api.test.ts +66 -0
  152. package/src/api/storage-surplus.admin.api.ts +45 -0
  153. package/src/code/index.ts +1 -0
  154. package/src/code/reflex-code-declarations.ts +646 -0
  155. package/src/discord/discord-event-filter-cases.ts +261 -261
  156. package/src/discord/discord-event-filters.test.ts +91 -91
  157. package/src/discord/discord-event-filters.ts +95 -95
  158. package/src/discord/discord-event-intents.test.ts +112 -112
  159. package/src/discord/discord-event-intents.ts +55 -55
  160. package/src/discord/index.ts +3 -3
  161. package/src/index.test.ts +104 -104
  162. package/src/index.ts +497 -438
  163. package/src/insights/index.ts +1 -1
  164. package/src/insights/percentiles.test.ts +75 -75
  165. package/src/insights/percentiles.ts +37 -37
  166. package/src/types/enum/access-grant-status.enum.ts +12 -12
  167. package/src/types/enum/access-kind.enum.ts +7 -7
  168. package/src/types/enum/access-request-status.enum.ts +11 -11
  169. package/src/types/enum/bot-event-block-reason.enum.ts +7 -7
  170. package/src/types/enum/completion-delivery-status.enum.ts +9 -9
  171. package/src/types/enum/configuration-read-as.enum.ts +5 -5
  172. package/src/types/enum/discord-activity-type.enum.ts +9 -9
  173. package/src/types/enum/discord-channel-type.enum.ts +11 -11
  174. package/src/types/enum/discord-component-kind.enum.ts +7 -7
  175. package/src/types/enum/discord-event-drop-reason.enum.ts +13 -13
  176. package/src/types/enum/discord-event-filter-name.enum.ts +11 -11
  177. package/src/types/enum/discord-event-status.enum.ts +13 -13
  178. package/src/types/enum/discord-event-type.enum.ts +7 -7
  179. package/src/types/enum/discord-gateway-failure-code.enum.ts +11 -11
  180. package/src/types/enum/discord-gateway-state.enum.ts +11 -11
  181. package/src/types/enum/discord-host-action.enum.ts +37 -37
  182. package/src/types/enum/discord-locale.enum.ts +35 -35
  183. package/src/types/enum/discord-option-type.enum.ts +12 -12
  184. package/src/types/enum/discord-presence-status.enum.ts +8 -8
  185. package/src/types/enum/discord-sync-status.enum.ts +6 -6
  186. package/src/types/enum/discord-token-state.enum.ts +11 -11
  187. package/src/types/enum/execution-mode.enum.ts +9 -9
  188. package/src/types/enum/execution-profile.enum.ts +20 -20
  189. package/src/types/enum/execution-settings-source.enum.ts +9 -9
  190. package/src/types/enum/health-status.enum.ts +4 -4
  191. package/src/types/enum/index.ts +55 -51
  192. package/src/types/enum/insights-period.enum.ts +8 -8
  193. package/src/types/enum/log-cap-mode.enum.ts +6 -6
  194. package/src/types/enum/log-drop-cause.enum.ts +8 -8
  195. package/src/types/enum/reflex-alert-metric.enum.ts +5 -5
  196. package/src/types/enum/reflex-alert-notification-state.enum.ts +6 -6
  197. package/src/types/enum/reflex-alert-scope.enum.ts +6 -6
  198. package/src/types/enum/reflex-code-diagnostic-category.enum.ts +11 -0
  199. package/src/types/enum/reflex-error-code.enum.ts +93 -72
  200. package/src/types/enum/route-method.enum.ts +9 -9
  201. package/src/types/enum/run-log-level.enum.ts +6 -6
  202. package/src/types/enum/run-mode.enum.ts +11 -11
  203. package/src/types/enum/run-status.enum.ts +16 -16
  204. package/src/types/enum/run-step-status.enum.ts +7 -7
  205. package/src/types/enum/schedule-sync-status.enum.ts +6 -6
  206. package/src/types/enum/scheduled-run-failure-code.enum.ts +14 -14
  207. package/src/types/enum/scheduled-run-origin.enum.ts +5 -5
  208. package/src/types/enum/scheduled-run-status.enum.ts +17 -17
  209. package/src/types/enum/service-block-reason.enum.ts +13 -13
  210. package/src/types/enum/service-deployment-action.enum.ts +11 -11
  211. package/src/types/enum/service-deployment-status.enum.ts +5 -5
  212. package/src/types/enum/service-template-follow-up-kind.enum.ts +19 -0
  213. package/src/types/enum/service-template-id.enum.ts +19 -0
  214. package/src/types/enum/service-template-parameter-kind.enum.ts +7 -0
  215. package/src/types/enum/service-type.enum.ts +9 -9
  216. package/src/types/enum/service-version-change-kind.enum.ts +6 -6
  217. package/src/types/enum/trace-effect-type.enum.ts +12 -12
  218. package/src/types/enum/trigger-access-mode.enum.ts +4 -0
  219. package/src/types/enum/trigger-kind.enum.ts +8 -8
  220. package/src/types/enum/vault-value-source.enum.ts +12 -12
  221. package/src/types/enum/vault-visibility.enum.ts +5 -5
  222. package/src/types/index.ts +2 -2
  223. package/src/types/interface/api/index.ts +3 -3
  224. package/src/types/interface/api/requests/alert-rule.request.ts +53 -53
  225. package/src/types/interface/api/requests/application-insights.request.ts +18 -18
  226. package/src/types/interface/api/requests/application-run-settings.request.ts +13 -11
  227. package/src/types/interface/api/requests/code-environment.request.ts +3 -0
  228. package/src/types/interface/api/requests/function-access.request.ts +51 -51
  229. package/src/types/interface/api/requests/function-run.request.ts +42 -32
  230. package/src/types/interface/api/requests/function-settings.request.ts +50 -34
  231. package/src/types/interface/api/requests/function-template.request.ts +29 -29
  232. package/src/types/interface/api/requests/function-test.request.ts +44 -44
  233. package/src/types/interface/api/requests/function-version.request.ts +38 -38
  234. package/src/types/interface/api/requests/function.request.ts +36 -36
  235. package/src/types/interface/api/requests/index.ts +27 -24
  236. package/src/types/interface/api/requests/route-stats.request.ts +22 -22
  237. package/src/types/interface/api/requests/service-completion-webhook.request.ts +11 -11
  238. package/src/types/interface/api/requests/service-configuration.request.ts +4 -4
  239. package/src/types/interface/api/requests/service-consumer.request.ts +51 -51
  240. package/src/types/interface/api/requests/service-deployment.request.ts +49 -49
  241. package/src/types/interface/api/requests/service-discord-event.request.ts +68 -68
  242. package/src/types/interface/api/requests/service-discord.request.ts +155 -155
  243. package/src/types/interface/api/requests/service-insights.request.ts +31 -31
  244. package/src/types/interface/api/requests/service-limits.request.ts +28 -28
  245. package/src/types/interface/api/requests/service-openapi.request.ts +10 -10
  246. package/src/types/interface/api/requests/service-route.request.ts +52 -52
  247. package/src/types/interface/api/requests/service-task.request.ts +80 -80
  248. package/src/types/interface/api/requests/service-template.request.ts +3 -0
  249. package/src/types/interface/api/requests/service-version.request.ts +24 -24
  250. package/src/types/interface/api/requests/service.request.ts +54 -46
  251. package/src/types/interface/api/requests/storage-surplus.admin.request.ts +12 -0
  252. package/src/types/interface/api/response.ts +4 -4
  253. package/src/types/interface/api/responses/alert-rule.response.ts +24 -24
  254. package/src/types/interface/api/responses/application-insights.response.ts +11 -11
  255. package/src/types/interface/api/responses/application-run-settings.response.ts +8 -8
  256. package/src/types/interface/api/responses/code-environment.response.ts +7 -0
  257. package/src/types/interface/api/responses/function-access.response.ts +45 -45
  258. package/src/types/interface/api/responses/function-run.response.ts +23 -18
  259. package/src/types/interface/api/responses/function-settings.response.ts +57 -50
  260. package/src/types/interface/api/responses/function-template.response.ts +21 -21
  261. package/src/types/interface/api/responses/function-test.response.ts +19 -19
  262. package/src/types/interface/api/responses/function-version.response.ts +42 -42
  263. package/src/types/interface/api/responses/function.response.ts +25 -25
  264. package/src/types/interface/api/responses/index.ts +27 -24
  265. package/src/types/interface/api/responses/route-stats.response.ts +15 -15
  266. package/src/types/interface/api/responses/service-completion-webhook.response.ts +13 -13
  267. package/src/types/interface/api/responses/service-configuration.response.ts +8 -8
  268. package/src/types/interface/api/responses/service-consumer.response.ts +33 -33
  269. package/src/types/interface/api/responses/service-deployment.response.ts +32 -32
  270. package/src/types/interface/api/responses/service-discord-event.response.ts +24 -24
  271. package/src/types/interface/api/responses/service-discord.response.ts +110 -110
  272. package/src/types/interface/api/responses/service-insights.response.ts +11 -11
  273. package/src/types/interface/api/responses/service-limits.response.ts +13 -13
  274. package/src/types/interface/api/responses/service-openapi.response.ts +7 -7
  275. package/src/types/interface/api/responses/service-route.response.ts +2 -2
  276. package/src/types/interface/api/responses/service-task.response.ts +57 -57
  277. package/src/types/interface/api/responses/service-template.response.ts +8 -0
  278. package/src/types/interface/api/responses/service-version.response.ts +112 -112
  279. package/src/types/interface/api/responses/service.response.ts +31 -31
  280. package/src/types/interface/api/responses/storage-surplus.admin.response.ts +10 -0
  281. package/src/types/interface/health.response.ts +7 -7
  282. package/src/types/interface/index.ts +3 -3
  283. package/src/types/interface/models/index.ts +32 -27
  284. package/src/types/interface/models/reflex-access-grant.model.ts +14 -14
  285. package/src/types/interface/models/reflex-access-request.model.ts +15 -15
  286. package/src/types/interface/models/reflex-alert-rule.model.ts +56 -56
  287. package/src/types/interface/models/reflex-bot-limits.model.ts +53 -53
  288. package/src/types/interface/models/reflex-code-diagnostic.model.ts +15 -0
  289. package/src/types/interface/models/reflex-code-environment.model.ts +17 -0
  290. package/src/types/interface/models/reflex-completion-webhook.model.ts +111 -111
  291. package/src/types/interface/models/reflex-consumer.model.ts +50 -50
  292. package/src/types/interface/models/reflex-definition.model.ts +31 -31
  293. package/src/types/interface/models/reflex-discord-event-log.model.ts +58 -58
  294. package/src/types/interface/models/reflex-discord-event.model.ts +79 -79
  295. package/src/types/interface/models/reflex-discord.model.ts +208 -208
  296. package/src/types/interface/models/reflex-execution-settings.model.ts +57 -57
  297. package/src/types/interface/models/reflex-function-template.model.ts +18 -18
  298. package/src/types/interface/models/reflex-function-version.model.ts +19 -19
  299. package/src/types/interface/models/reflex-function.model.ts +30 -30
  300. package/src/types/interface/models/reflex-insights.model.ts +215 -215
  301. package/src/types/interface/models/reflex-price-list.model.ts +22 -22
  302. package/src/types/interface/models/reflex-route-contract.model.ts +46 -46
  303. package/src/types/interface/models/reflex-route.model.ts +23 -23
  304. package/src/types/interface/models/reflex-run-retention.model.ts +24 -0
  305. package/src/types/interface/models/reflex-run-settings.model.ts +39 -28
  306. package/src/types/interface/models/reflex-run.model.ts +309 -299
  307. package/src/types/interface/models/reflex-service-configuration.model.ts +22 -22
  308. package/src/types/interface/models/reflex-service-deployment.model.ts +48 -46
  309. package/src/types/interface/models/reflex-service-limits.model.ts +92 -92
  310. package/src/types/interface/models/reflex-service-template.model.ts +55 -0
  311. package/src/types/interface/models/reflex-service-version.model.ts +64 -64
  312. package/src/types/interface/models/reflex-service.model.ts +47 -45
  313. package/src/types/interface/models/reflex-step-stats.model.ts +35 -35
  314. package/src/types/interface/models/reflex-storage-surplus.model.ts +23 -0
  315. package/src/types/interface/models/reflex-task.model.ts +97 -97
  316. package/tsconfig.check.json +15 -15
  317. package/tsconfig.json +35 -35
@@ -1,38 +1,38 @@
1
- import { AbyssReflexCore } from '..';
2
- import type {
3
- IGetApplicationCalendarParams,
4
- IGetApplicationCalendarQuery,
5
- IGetApplicationCalendarResponse,
6
- IGetApplicationInsightsParams,
7
- IGetApplicationInsightsQuery,
8
- IGetApplicationInsightsResponse,
9
- } from '../types';
10
-
11
- const insightsUrl = (params: { applicationId: string }): string =>
12
- `api/application/${params.applicationId}/insights`;
13
-
14
- /**
15
- * `GET .../insights`: the overview of an application in one environment over a period: tiles, series, share by
16
- * Service, ranking of the triggers. Needs REFLEX_READ.
17
- */
18
- export const getApplicationInsights = async (
19
- params: IGetApplicationInsightsParams,
20
- query: IGetApplicationInsightsQuery,
21
- ): Promise<IGetApplicationInsightsResponse> =>
22
- (
23
- await AbyssReflexCore.axios.get<IGetApplicationInsightsResponse>(insightsUrl(params), {
24
- params: query,
25
- })
26
- ).data;
27
-
28
- /** `GET .../insights/calendar`: runs, failures and credits of each of the last 365 days. Needs REFLEX_READ. */
29
- export const getApplicationCalendar = async (
30
- params: IGetApplicationCalendarParams,
31
- query: IGetApplicationCalendarQuery,
32
- ): Promise<IGetApplicationCalendarResponse> =>
33
- (
34
- await AbyssReflexCore.axios.get<IGetApplicationCalendarResponse>(
35
- `${insightsUrl(params)}/calendar`,
36
- { params: query },
37
- )
38
- ).data;
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ IGetApplicationCalendarParams,
4
+ IGetApplicationCalendarQuery,
5
+ IGetApplicationCalendarResponse,
6
+ IGetApplicationInsightsParams,
7
+ IGetApplicationInsightsQuery,
8
+ IGetApplicationInsightsResponse,
9
+ } from '../types';
10
+
11
+ const insightsUrl = (params: { applicationId: string }): string =>
12
+ `api/application/${params.applicationId}/insights`;
13
+
14
+ /**
15
+ * `GET .../insights`: the overview of an application in one environment over a period: tiles, series, share by
16
+ * Service, ranking of the triggers. Needs REFLEX_READ.
17
+ */
18
+ export const getApplicationInsights = async (
19
+ params: IGetApplicationInsightsParams,
20
+ query: IGetApplicationInsightsQuery,
21
+ ): Promise<IGetApplicationInsightsResponse> =>
22
+ (
23
+ await AbyssReflexCore.axios.get<IGetApplicationInsightsResponse>(insightsUrl(params), {
24
+ params: query,
25
+ })
26
+ ).data;
27
+
28
+ /** `GET .../insights/calendar`: runs, failures and credits of each of the last 365 days. Needs REFLEX_READ. */
29
+ export const getApplicationCalendar = async (
30
+ params: IGetApplicationCalendarParams,
31
+ query: IGetApplicationCalendarQuery,
32
+ ): Promise<IGetApplicationCalendarResponse> =>
33
+ (
34
+ await AbyssReflexCore.axios.get<IGetApplicationCalendarResponse>(
35
+ `${insightsUrl(params)}/calendar`,
36
+ { params: query },
37
+ )
38
+ ).data;
@@ -1,51 +1,62 @@
1
- import { AxiosAdapter, InternalAxiosRequestConfig } from 'axios';
2
- import { AbyssReflexCore, LogCapMode } from '..';
3
-
4
- const adapter = jest.fn<ReturnType<AxiosAdapter>, [InternalAxiosRequestConfig]>(async (config) => ({
5
- data: { data: {} },
6
- status: 200,
7
- statusText: '',
8
- headers: {},
9
- config,
10
- }));
11
-
12
- beforeAll(() => {
13
- AbyssReflexCore.setConfig({ baseURL: 'http://reflex.test/', token: 'session-token' });
14
- AbyssReflexCore.axios.defaults.adapter = adapter;
15
- });
16
-
17
- beforeEach(() => adapter.mockClear());
18
-
19
- describe('AbyssReflexCore application run settings routes', () => {
20
- it('runSettings.get calls GET .../run-settings', async () => {
21
- await AbyssReflexCore.sdk.application.runSettings.get({ applicationId: 'app-1' });
22
-
23
- const config = adapter.mock.calls[0][0];
24
- expect(config.method).toBe('get');
25
- expect(config.url).toBe('api/application/app-1/run-settings');
26
- });
27
-
28
- it('runSettings.set calls PUT .../run-settings with the cap', async () => {
29
- await AbyssReflexCore.sdk.application.runSettings.set(
30
- { applicationId: 'app-1' },
31
- { maxLogLinesPerRun: 500 },
32
- );
33
-
34
- const config = adapter.mock.calls[0][0];
35
- expect(config.method).toBe('put');
36
- expect(config.url).toBe('api/application/app-1/run-settings');
37
- expect(JSON.parse(config.data)).toEqual({ maxLogLinesPerRun: 500 });
38
- });
39
-
40
- it('logCap.set calls PUT .../log-cap of the function', async () => {
41
- await AbyssReflexCore.sdk.function.logCap.set(
42
- { applicationId: 'app-1', functionId: 'fn-1' },
43
- { mode: LogCapMode.LIMIT, lines: 50 },
44
- );
45
-
46
- const config = adapter.mock.calls[0][0];
47
- expect(config.method).toBe('put');
48
- expect(config.url).toBe('api/function/app-1/fn-1/log-cap');
49
- expect(JSON.parse(config.data)).toEqual({ mode: 'LIMIT', lines: 50 });
50
- });
51
- });
1
+ import { AxiosAdapter, InternalAxiosRequestConfig } from 'axios';
2
+ import { AbyssReflexCore, LogCapMode } from '..';
3
+
4
+ const adapter = jest.fn<ReturnType<AxiosAdapter>, [InternalAxiosRequestConfig]>(async (config) => ({
5
+ data: { data: {} },
6
+ status: 200,
7
+ statusText: '',
8
+ headers: {},
9
+ config,
10
+ }));
11
+
12
+ beforeAll(() => {
13
+ AbyssReflexCore.setConfig({ baseURL: 'http://reflex.test/', token: 'session-token' });
14
+ AbyssReflexCore.axios.defaults.adapter = adapter;
15
+ });
16
+
17
+ beforeEach(() => adapter.mockClear());
18
+
19
+ describe('AbyssReflexCore application run settings routes', () => {
20
+ it('runSettings.get calls GET .../run-settings', async () => {
21
+ await AbyssReflexCore.sdk.application.runSettings.get({ applicationId: 'app-1' });
22
+
23
+ const config = adapter.mock.calls[0][0];
24
+ expect(config.method).toBe('get');
25
+ expect(config.url).toBe('api/application/app-1/run-settings');
26
+ });
27
+
28
+ it('runSettings.set calls PUT .../run-settings with the cap', async () => {
29
+ await AbyssReflexCore.sdk.application.runSettings.set(
30
+ { applicationId: 'app-1' },
31
+ { maxLogLinesPerRun: 500 },
32
+ );
33
+
34
+ const config = adapter.mock.calls[0][0];
35
+ expect(config.method).toBe('put');
36
+ expect(config.url).toBe('api/application/app-1/run-settings');
37
+ expect(JSON.parse(config.data)).toEqual({ maxLogLinesPerRun: 500 });
38
+ });
39
+
40
+ it('runSettings.set carries the retention tier of the runs', async () => {
41
+ await AbyssReflexCore.sdk.application.runSettings.set(
42
+ { applicationId: 'app-1' },
43
+ { maxLogLinesPerRun: null, runRetentionDays: 90 },
44
+ );
45
+
46
+ const config = adapter.mock.calls[0][0];
47
+ expect(config.method).toBe('put');
48
+ expect(JSON.parse(config.data)).toEqual({ maxLogLinesPerRun: null, runRetentionDays: 90 });
49
+ });
50
+
51
+ it('logCap.set calls PUT .../log-cap of the function', async () => {
52
+ await AbyssReflexCore.sdk.function.logCap.set(
53
+ { applicationId: 'app-1', functionId: 'fn-1' },
54
+ { mode: LogCapMode.LIMIT, lines: 50 },
55
+ );
56
+
57
+ const config = adapter.mock.calls[0][0];
58
+ expect(config.method).toBe('put');
59
+ expect(config.url).toBe('api/function/app-1/fn-1/log-cap');
60
+ expect(JSON.parse(config.data)).toEqual({ mode: 'LIMIT', lines: 50 });
61
+ });
62
+ });
@@ -1,30 +1,30 @@
1
- import { AbyssReflexCore } from '..';
2
- import type {
3
- IGetApplicationRunSettingsParams,
4
- IGetApplicationRunSettingsResponse,
5
- ISetApplicationRunSettingsBody,
6
- ISetApplicationRunSettingsParams,
7
- ISetApplicationRunSettingsResponse,
8
- } from '../types';
9
-
10
- const runSettingsUrl = (params: { applicationId: string }): string =>
11
- `api/application/${params.applicationId}/run-settings`;
12
-
13
- /** `GET .../run-settings`: the log cap, the effective retention and whether Monitor is activated. Needs REFLEX_READ. */
14
- export const getApplicationRunSettings = async (
15
- params: IGetApplicationRunSettingsParams,
16
- ): Promise<IGetApplicationRunSettingsResponse> =>
17
- (await AbyssReflexCore.axios.get<IGetApplicationRunSettingsResponse>(runSettingsUrl(params)))
18
- .data;
19
-
20
- /** `PUT .../run-settings`: sets the log cap of the application. Needs REFLEX_FUNCTION_UPDATE. */
21
- export const setApplicationRunSettings = async (
22
- params: ISetApplicationRunSettingsParams,
23
- body: ISetApplicationRunSettingsBody,
24
- ): Promise<ISetApplicationRunSettingsResponse> =>
25
- (
26
- await AbyssReflexCore.axios.put<ISetApplicationRunSettingsResponse>(
27
- runSettingsUrl(params),
28
- body,
29
- )
30
- ).data;
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ IGetApplicationRunSettingsParams,
4
+ IGetApplicationRunSettingsResponse,
5
+ ISetApplicationRunSettingsBody,
6
+ ISetApplicationRunSettingsParams,
7
+ ISetApplicationRunSettingsResponse,
8
+ } from '../types';
9
+
10
+ const runSettingsUrl = (params: { applicationId: string }): string =>
11
+ `api/application/${params.applicationId}/run-settings`;
12
+
13
+ /** `GET .../run-settings`: the log cap, the effective retention and whether Monitor is activated. Needs REFLEX_READ. */
14
+ export const getApplicationRunSettings = async (
15
+ params: IGetApplicationRunSettingsParams,
16
+ ): Promise<IGetApplicationRunSettingsResponse> =>
17
+ (await AbyssReflexCore.axios.get<IGetApplicationRunSettingsResponse>(runSettingsUrl(params)))
18
+ .data;
19
+
20
+ /** `PUT .../run-settings`: sets the log cap of the application. Needs REFLEX_FUNCTION_UPDATE. */
21
+ export const setApplicationRunSettings = async (
22
+ params: ISetApplicationRunSettingsParams,
23
+ body: ISetApplicationRunSettingsBody,
24
+ ): Promise<ISetApplicationRunSettingsResponse> =>
25
+ (
26
+ await AbyssReflexCore.axios.put<ISetApplicationRunSettingsResponse>(
27
+ runSettingsUrl(params),
28
+ body,
29
+ )
30
+ ).data;
@@ -0,0 +1,15 @@
1
+ import { AbyssReflexCore } from '..';
2
+ import type { IGetCodeEnvironmentParams, IGetCodeEnvironmentResponse } from '../types';
3
+
4
+ /**
5
+ * `GET /api/code-environment/:applicationId`: the libraries, declarations and library types a TypeScript CODE step
6
+ * is checked against. Sent with an `ETag`: the answer only changes with the API. Needs REFLEX_READ.
7
+ */
8
+ export const getCodeEnvironment = async (
9
+ params: IGetCodeEnvironmentParams,
10
+ ): Promise<IGetCodeEnvironmentResponse> =>
11
+ (
12
+ await AbyssReflexCore.axios.get<IGetCodeEnvironmentResponse>(
13
+ `api/code-environment/${params.applicationId}`,
14
+ )
15
+ ).data;
@@ -1,87 +1,87 @@
1
- import { AbyssReflexCore } from '..';
2
- import type {
3
- IDismissFunctionAccessRequestParams,
4
- IDismissFunctionAccessRequestResponse,
5
- IGrantAllFunctionAccessParams,
6
- IGrantAllFunctionAccessResponse,
7
- IGrantFunctionAccessRequestParams,
8
- IGrantFunctionAccessRequestResponse,
9
- IRequestFunctionAccessBody,
10
- IRequestFunctionAccessParams,
11
- IRequestFunctionAccessResponse,
12
- IGrantFunctionAccessBody,
13
- IGrantFunctionAccessParams,
14
- IGrantFunctionAccessResponse,
15
- IListFunctionAccessParams,
16
- IListFunctionAccessResponse,
17
- IRevokeFunctionAccessParams,
18
- IRevokeFunctionAccessResponse,
19
- } from '../types';
20
-
21
- const accessUrl = (params: { applicationId: string; functionId: string }): string =>
22
- `api/function/${params.applicationId}/${params.functionId}/access`;
23
-
24
- /** `GET .../access`: every access granted to the function, revoked ones included (the journal), its requests and the declaration keys the caller may grant. Needs REFLEX_READ. */
25
- export const listFunctionAccess = async (
26
- params: IListFunctionAccessParams,
27
- ): Promise<IListFunctionAccessResponse> =>
28
- (await AbyssReflexCore.axios.get<IListFunctionAccessResponse>(accessUrl(params))).data;
29
-
30
- /** `POST .../access`: grants an access the draft declares. The caller must hold the right it needs (`403` otherwise). */
31
- export const grantFunctionAccess = async (
32
- params: IGrantFunctionAccessParams,
33
- body: IGrantFunctionAccessBody,
34
- ): Promise<IGrantFunctionAccessResponse> =>
35
- (await AbyssReflexCore.axios.post<IGrantFunctionAccessResponse>(accessUrl(params), body)).data;
36
-
37
- /** `DELETE .../access/:grantId`: withdraws the access, at once, from what is already promoted. Needs REFLEX_FUNCTION_UPDATE. */
38
- export const revokeFunctionAccess = async (
39
- params: IRevokeFunctionAccessParams,
40
- ): Promise<IRevokeFunctionAccessResponse> =>
41
- (
42
- await AbyssReflexCore.axios.delete<IRevokeFunctionAccessResponse>(
43
- `${accessUrl(params)}/${params.grantId}`,
44
- )
45
- ).data;
46
-
47
- /** `POST .../access/grant-all`: grants every declaration of the saved draft the caller may grant and files a pending request for the rest. Needs REFLEX_READ; each grant needs the right of its declaration. */
48
- export const grantAllFunctionAccess = async (
49
- params: IGrantAllFunctionAccessParams,
50
- ): Promise<IGrantAllFunctionAccessResponse> =>
51
- (
52
- await AbyssReflexCore.axios.post<IGrantAllFunctionAccessResponse>(
53
- `${accessUrl(params)}/grant-all`,
54
- )
55
- ).data;
56
-
57
- /** `POST .../access/request`: asks for an access the saved draft declares (`409 ACCESS_NOT_DECLARED` otherwise). Needs REFLEX_READ. */
58
- export const requestFunctionAccess = async (
59
- params: IRequestFunctionAccessParams,
60
- body: IRequestFunctionAccessBody,
61
- ): Promise<IRequestFunctionAccessResponse> =>
62
- (
63
- await AbyssReflexCore.axios.post<IRequestFunctionAccessResponse>(
64
- `${accessUrl(params)}/request`,
65
- body,
66
- )
67
- ).data;
68
-
69
- /** `POST .../access/request/:requestId/grant`: grants the access of a pending request. The caller must hold the right the access needs. */
70
- export const grantFunctionAccessRequest = async (
71
- params: IGrantFunctionAccessRequestParams,
72
- ): Promise<IGrantFunctionAccessRequestResponse> =>
73
- (
74
- await AbyssReflexCore.axios.post<IGrantFunctionAccessRequestResponse>(
75
- `${accessUrl(params)}/request/${params.requestId}/grant`,
76
- )
77
- ).data;
78
-
79
- /** `POST .../access/request/:requestId/dismiss`: sets a pending request aside. The caller must hold the right the access needs. */
80
- export const dismissFunctionAccessRequest = async (
81
- params: IDismissFunctionAccessRequestParams,
82
- ): Promise<IDismissFunctionAccessRequestResponse> =>
83
- (
84
- await AbyssReflexCore.axios.post<IDismissFunctionAccessRequestResponse>(
85
- `${accessUrl(params)}/request/${params.requestId}/dismiss`,
86
- )
87
- ).data;
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ IDismissFunctionAccessRequestParams,
4
+ IDismissFunctionAccessRequestResponse,
5
+ IGrantAllFunctionAccessParams,
6
+ IGrantAllFunctionAccessResponse,
7
+ IGrantFunctionAccessRequestParams,
8
+ IGrantFunctionAccessRequestResponse,
9
+ IRequestFunctionAccessBody,
10
+ IRequestFunctionAccessParams,
11
+ IRequestFunctionAccessResponse,
12
+ IGrantFunctionAccessBody,
13
+ IGrantFunctionAccessParams,
14
+ IGrantFunctionAccessResponse,
15
+ IListFunctionAccessParams,
16
+ IListFunctionAccessResponse,
17
+ IRevokeFunctionAccessParams,
18
+ IRevokeFunctionAccessResponse,
19
+ } from '../types';
20
+
21
+ const accessUrl = (params: { applicationId: string; functionId: string }): string =>
22
+ `api/function/${params.applicationId}/${params.functionId}/access`;
23
+
24
+ /** `GET .../access`: every access granted to the function, revoked ones included (the journal), its requests and the declaration keys the caller may grant. Needs REFLEX_READ. */
25
+ export const listFunctionAccess = async (
26
+ params: IListFunctionAccessParams,
27
+ ): Promise<IListFunctionAccessResponse> =>
28
+ (await AbyssReflexCore.axios.get<IListFunctionAccessResponse>(accessUrl(params))).data;
29
+
30
+ /** `POST .../access`: grants an access the draft declares. The caller must hold the right it needs (`403` otherwise). */
31
+ export const grantFunctionAccess = async (
32
+ params: IGrantFunctionAccessParams,
33
+ body: IGrantFunctionAccessBody,
34
+ ): Promise<IGrantFunctionAccessResponse> =>
35
+ (await AbyssReflexCore.axios.post<IGrantFunctionAccessResponse>(accessUrl(params), body)).data;
36
+
37
+ /** `DELETE .../access/:grantId`: withdraws the access, at once, from what is already promoted. Needs REFLEX_FUNCTION_UPDATE. */
38
+ export const revokeFunctionAccess = async (
39
+ params: IRevokeFunctionAccessParams,
40
+ ): Promise<IRevokeFunctionAccessResponse> =>
41
+ (
42
+ await AbyssReflexCore.axios.delete<IRevokeFunctionAccessResponse>(
43
+ `${accessUrl(params)}/${params.grantId}`,
44
+ )
45
+ ).data;
46
+
47
+ /** `POST .../access/grant-all`: grants every declaration of the saved draft the caller may grant and files a pending request for the rest. Needs REFLEX_READ; each grant needs the right of its declaration. */
48
+ export const grantAllFunctionAccess = async (
49
+ params: IGrantAllFunctionAccessParams,
50
+ ): Promise<IGrantAllFunctionAccessResponse> =>
51
+ (
52
+ await AbyssReflexCore.axios.post<IGrantAllFunctionAccessResponse>(
53
+ `${accessUrl(params)}/grant-all`,
54
+ )
55
+ ).data;
56
+
57
+ /** `POST .../access/request`: asks for an access the saved draft declares (`409 ACCESS_NOT_DECLARED` otherwise). Needs REFLEX_READ. */
58
+ export const requestFunctionAccess = async (
59
+ params: IRequestFunctionAccessParams,
60
+ body: IRequestFunctionAccessBody,
61
+ ): Promise<IRequestFunctionAccessResponse> =>
62
+ (
63
+ await AbyssReflexCore.axios.post<IRequestFunctionAccessResponse>(
64
+ `${accessUrl(params)}/request`,
65
+ body,
66
+ )
67
+ ).data;
68
+
69
+ /** `POST .../access/request/:requestId/grant`: grants the access of a pending request. The caller must hold the right the access needs. */
70
+ export const grantFunctionAccessRequest = async (
71
+ params: IGrantFunctionAccessRequestParams,
72
+ ): Promise<IGrantFunctionAccessRequestResponse> =>
73
+ (
74
+ await AbyssReflexCore.axios.post<IGrantFunctionAccessRequestResponse>(
75
+ `${accessUrl(params)}/request/${params.requestId}/grant`,
76
+ )
77
+ ).data;
78
+
79
+ /** `POST .../access/request/:requestId/dismiss`: sets a pending request aside. The caller must hold the right the access needs. */
80
+ export const dismissFunctionAccessRequest = async (
81
+ params: IDismissFunctionAccessRequestParams,
82
+ ): Promise<IDismissFunctionAccessRequestResponse> =>
83
+ (
84
+ await AbyssReflexCore.axios.post<IDismissFunctionAccessRequestResponse>(
85
+ `${accessUrl(params)}/request/${params.requestId}/dismiss`,
86
+ )
87
+ ).data;
@@ -1,27 +1,27 @@
1
- import { AxiosAdapter, InternalAxiosRequestConfig } from 'axios';
2
- import { AbyssReflexCore, InsightsPeriod } from '..';
3
-
4
- describe('AbyssReflexCore function insights route', () => {
5
- const adapter = jest.fn<ReturnType<AxiosAdapter>, [InternalAxiosRequestConfig]>(
6
- async (config) => ({ data: { data: {} }, status: 200, statusText: '', headers: {}, config }),
7
- );
8
-
9
- beforeAll(() => {
10
- AbyssReflexCore.setConfig({ baseURL: 'http://reflex.test/', token: 'session-token' });
11
- AbyssReflexCore.axios.defaults.adapter = adapter;
12
- });
13
-
14
- beforeEach(() => adapter.mockClear());
15
-
16
- it('insights.get calls GET /api/function/:applicationId/:functionId/insights', async () => {
17
- await AbyssReflexCore.sdk.function.insights.get(
18
- { applicationId: 'app-1', functionId: 'fn-1' },
19
- { environmentId: 'e-1', period: InsightsPeriod.HOURS_24 },
20
- );
21
-
22
- const config = adapter.mock.calls[0][0];
23
- expect(config.method).toBe('get');
24
- expect(config.url).toBe('api/function/app-1/fn-1/insights');
25
- expect(config.params).toEqual({ environmentId: 'e-1', period: '24h' });
26
- });
27
- });
1
+ import { AxiosAdapter, InternalAxiosRequestConfig } from 'axios';
2
+ import { AbyssReflexCore, InsightsPeriod } from '..';
3
+
4
+ describe('AbyssReflexCore function insights route', () => {
5
+ const adapter = jest.fn<ReturnType<AxiosAdapter>, [InternalAxiosRequestConfig]>(
6
+ async (config) => ({ data: { data: {} }, status: 200, statusText: '', headers: {}, config }),
7
+ );
8
+
9
+ beforeAll(() => {
10
+ AbyssReflexCore.setConfig({ baseURL: 'http://reflex.test/', token: 'session-token' });
11
+ AbyssReflexCore.axios.defaults.adapter = adapter;
12
+ });
13
+
14
+ beforeEach(() => adapter.mockClear());
15
+
16
+ it('insights.get calls GET /api/function/:applicationId/:functionId/insights', async () => {
17
+ await AbyssReflexCore.sdk.function.insights.get(
18
+ { applicationId: 'app-1', functionId: 'fn-1' },
19
+ { environmentId: 'e-1', period: InsightsPeriod.HOURS_24 },
20
+ );
21
+
22
+ const config = adapter.mock.calls[0][0];
23
+ expect(config.method).toBe('get');
24
+ expect(config.url).toBe('api/function/app-1/fn-1/insights');
25
+ expect(config.params).toEqual({ environmentId: 'e-1', period: '24h' });
26
+ });
27
+ });
@@ -1,18 +1,18 @@
1
- import { AbyssReflexCore } from '..';
2
- import type {
3
- IGetFunctionInsightsParams,
4
- IGetFunctionInsightsQuery,
5
- IGetFunctionInsightsResponse,
6
- } from '../types';
7
-
8
- /** `GET .../function/:applicationId/:functionId/insights`: the dashboard of a function, same shape as a Service's. Needs REFLEX_LOG_READ. */
9
- export const getFunctionInsights = async (
10
- params: IGetFunctionInsightsParams,
11
- query: IGetFunctionInsightsQuery,
12
- ): Promise<IGetFunctionInsightsResponse> =>
13
- (
14
- await AbyssReflexCore.axios.get<IGetFunctionInsightsResponse>(
15
- `api/function/${params.applicationId}/${params.functionId}/insights`,
16
- { params: query },
17
- )
18
- ).data;
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ IGetFunctionInsightsParams,
4
+ IGetFunctionInsightsQuery,
5
+ IGetFunctionInsightsResponse,
6
+ } from '../types';
7
+
8
+ /** `GET .../function/:applicationId/:functionId/insights`: the dashboard of a function, same shape as a Service's. Needs REFLEX_LOG_READ. */
9
+ export const getFunctionInsights = async (
10
+ params: IGetFunctionInsightsParams,
11
+ query: IGetFunctionInsightsQuery,
12
+ ): Promise<IGetFunctionInsightsResponse> =>
13
+ (
14
+ await AbyssReflexCore.axios.get<IGetFunctionInsightsResponse>(
15
+ `api/function/${params.applicationId}/${params.functionId}/insights`,
16
+ { params: query },
17
+ )
18
+ ).data;
@@ -1,38 +1,53 @@
1
- import { AbyssReflexCore } from '..';
2
- import type {
3
- IGetFunctionRunParams,
4
- IGetFunctionRunResponse,
5
- IGetFunctionRunStateParams,
6
- IGetFunctionRunStateResponse,
7
- IListFunctionRunParams,
8
- IListFunctionRunQuery,
9
- IListFunctionRunResponse,
10
- } from '../types';
11
-
12
- const runUrl = (params: { applicationId: string; functionId: string }): string =>
13
- `api/function/${params.applicationId}/${params.functionId}/run`;
14
-
15
- /** `GET .../run`: the test runs (kept: the last 10, then 7 days) and the live executions of the edge (7 days), merged, newest first, paged by `limit`/`offset`. Needs REFLEX_LOG_READ. */
16
- export const listFunctionRun = async (
17
- params: IListFunctionRunParams,
18
- query: IListFunctionRunQuery = {},
19
- ): Promise<IListFunctionRunResponse> =>
20
- (await AbyssReflexCore.axios.get<IListFunctionRunResponse>(runUrl(params), { params: query }))
21
- .data;
22
-
23
- /** `GET .../run/:runId`: one run; a live one with its measures and its steps. Needs REFLEX_LOG_READ. */
24
- export const getFunctionRun = async (
25
- params: IGetFunctionRunParams,
26
- ): Promise<IGetFunctionRunResponse> =>
27
- (await AbyssReflexCore.axios.get<IGetFunctionRunResponse>(`${runUrl(params)}/${params.runId}`))
28
- .data;
29
-
30
- /** `GET .../run/:runId/state`: the state of a live execution, the one an async route answered with. Needs REFLEX_LOG_READ. */
31
- export const getFunctionRunState = async (
32
- params: IGetFunctionRunStateParams,
33
- ): Promise<IGetFunctionRunStateResponse> =>
34
- (
35
- await AbyssReflexCore.axios.get<IGetFunctionRunStateResponse>(
36
- `${runUrl(params)}/${params.runId}/state`,
37
- )
38
- ).data;
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ IGetFunctionRunParams,
4
+ IGetFunctionRunResponse,
5
+ IGetFunctionRunStateParams,
6
+ IGetFunctionRunStateResponse,
7
+ IListFunctionRunParams,
8
+ IListFunctionRunQuery,
9
+ IListFunctionRunResponse,
10
+ ISetFunctionRunFavoriteBody,
11
+ ISetFunctionRunFavoriteParams,
12
+ ISetFunctionRunFavoriteResponse,
13
+ } from '../types';
14
+
15
+ const runUrl = (params: { applicationId: string; functionId: string }): string =>
16
+ `api/function/${params.applicationId}/${params.functionId}/run`;
17
+
18
+ /** `GET .../run`: the test runs (kept: the last 10, then 7 days) and the live executions of the edge (7 days), merged, newest first, paged by `limit`/`offset`. Needs REFLEX_LOG_READ. */
19
+ export const listFunctionRun = async (
20
+ params: IListFunctionRunParams,
21
+ query: IListFunctionRunQuery = {},
22
+ ): Promise<IListFunctionRunResponse> =>
23
+ (await AbyssReflexCore.axios.get<IListFunctionRunResponse>(runUrl(params), { params: query }))
24
+ .data;
25
+
26
+ /** `GET .../run/:runId`: one run; a live one with its measures and its steps. Needs REFLEX_LOG_READ. */
27
+ export const getFunctionRun = async (
28
+ params: IGetFunctionRunParams,
29
+ ): Promise<IGetFunctionRunResponse> =>
30
+ (await AbyssReflexCore.axios.get<IGetFunctionRunResponse>(`${runUrl(params)}/${params.runId}`))
31
+ .data;
32
+
33
+ /** `GET .../run/:runId/state`: the state of a live execution, the one an async route answered with. Needs REFLEX_LOG_READ. */
34
+ export const getFunctionRunState = async (
35
+ params: IGetFunctionRunStateParams,
36
+ ): Promise<IGetFunctionRunStateResponse> =>
37
+ (
38
+ await AbyssReflexCore.axios.get<IGetFunctionRunStateResponse>(
39
+ `${runUrl(params)}/${params.runId}/state`,
40
+ )
41
+ ).data;
42
+
43
+ /** `PUT .../run/:runId/favorite`: marks a run as a favorite (never purged) or not. Needs REFLEX_FUNCTION_UPDATE. */
44
+ export const setFunctionRunFavorite = async (
45
+ params: ISetFunctionRunFavoriteParams,
46
+ body: ISetFunctionRunFavoriteBody,
47
+ ): Promise<ISetFunctionRunFavoriteResponse> =>
48
+ (
49
+ await AbyssReflexCore.axios.put<ISetFunctionRunFavoriteResponse>(
50
+ `${runUrl(params)}/${params.runId}/favorite`,
51
+ body,
52
+ )
53
+ ).data;