@abyss-project/reflex 5.12.0 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/.eslintrc.js +32 -32
  2. package/.prettierrc +5 -5
  3. package/README.md +15 -15
  4. package/dist/api/index.d.ts +4 -0
  5. package/dist/api/index.js +4 -0
  6. package/dist/api/index.js.map +1 -1
  7. package/dist/api/service-completion-webhook.api.d.ts +3 -0
  8. package/dist/api/service-completion-webhook.api.js +10 -0
  9. package/dist/api/service-completion-webhook.api.js.map +1 -0
  10. package/dist/api/service-consumer.api.d.ts +7 -0
  11. package/dist/api/service-consumer.api.js +19 -0
  12. package/dist/api/service-consumer.api.js.map +1 -0
  13. package/dist/api/service-discord.api.d.ts +1 -2
  14. package/dist/api/service-discord.api.js +1 -3
  15. package/dist/api/service-discord.api.js.map +1 -1
  16. package/dist/api/service-limits.api.d.ts +3 -0
  17. package/dist/api/service-limits.api.js +10 -0
  18. package/dist/api/service-limits.api.js.map +1 -0
  19. package/dist/api/service-openapi.api.d.ts +2 -0
  20. package/dist/api/service-openapi.api.js +7 -0
  21. package/dist/api/service-openapi.api.js.map +1 -0
  22. package/dist/api/service-route.api.js.map +1 -1
  23. package/dist/index.d.ts +23 -1
  24. package/dist/index.js +23 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/types/enum/completion-delivery-status.enum.d.ts +5 -0
  27. package/dist/types/enum/completion-delivery-status.enum.js +10 -0
  28. package/dist/types/enum/completion-delivery-status.enum.js.map +1 -0
  29. package/dist/types/enum/index.d.ts +2 -0
  30. package/dist/types/enum/index.js +2 -0
  31. package/dist/types/enum/index.js.map +1 -1
  32. package/dist/types/enum/reflex-error-code.enum.d.ts +8 -1
  33. package/dist/types/enum/reflex-error-code.enum.js +7 -0
  34. package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
  35. package/dist/types/enum/run-status.enum.d.ts +2 -1
  36. package/dist/types/enum/run-status.enum.js +1 -0
  37. package/dist/types/enum/run-status.enum.js.map +1 -1
  38. package/dist/types/enum/scheduled-run-failure-code.enum.d.ts +2 -1
  39. package/dist/types/enum/scheduled-run-failure-code.enum.js +1 -0
  40. package/dist/types/enum/scheduled-run-failure-code.enum.js.map +1 -1
  41. package/dist/types/enum/service-block-reason.enum.d.ts +4 -0
  42. package/dist/types/enum/service-block-reason.enum.js +9 -0
  43. package/dist/types/enum/service-block-reason.enum.js.map +1 -0
  44. package/dist/types/interface/api/requests/function-run.request.d.ts +1 -0
  45. package/dist/types/interface/api/requests/function-test.request.d.ts +1 -0
  46. package/dist/types/interface/api/requests/index.d.ts +4 -0
  47. package/dist/types/interface/api/requests/index.js +4 -0
  48. package/dist/types/interface/api/requests/index.js.map +1 -1
  49. package/dist/types/interface/api/requests/service-completion-webhook.request.d.ts +9 -0
  50. package/dist/types/interface/api/requests/service-completion-webhook.request.js +3 -0
  51. package/dist/types/interface/api/requests/service-completion-webhook.request.js.map +1 -0
  52. package/dist/types/interface/api/requests/service-consumer.request.d.ts +41 -0
  53. package/dist/types/interface/api/requests/service-consumer.request.js +3 -0
  54. package/dist/types/interface/api/requests/service-consumer.request.js.map +1 -0
  55. package/dist/types/interface/api/requests/service-discord.request.d.ts +1 -14
  56. package/dist/types/interface/api/requests/service-limits.request.d.ts +18 -0
  57. package/dist/types/interface/api/requests/service-limits.request.js +3 -0
  58. package/dist/types/interface/api/requests/service-limits.request.js.map +1 -0
  59. package/dist/types/interface/api/requests/service-openapi.request.d.ts +8 -0
  60. package/dist/types/interface/api/requests/service-openapi.request.js +3 -0
  61. package/dist/types/interface/api/requests/service-openapi.request.js.map +1 -0
  62. package/dist/types/interface/api/requests/service-route.request.d.ts +3 -0
  63. package/dist/types/interface/api/responses/function-settings.response.d.ts +3 -1
  64. package/dist/types/interface/api/responses/function-test.response.d.ts +3 -1
  65. package/dist/types/interface/api/responses/index.d.ts +4 -0
  66. package/dist/types/interface/api/responses/index.js +4 -0
  67. package/dist/types/interface/api/responses/index.js.map +1 -1
  68. package/dist/types/interface/api/responses/service-completion-webhook.response.d.ts +8 -0
  69. package/dist/types/interface/api/responses/service-completion-webhook.response.js +3 -0
  70. package/dist/types/interface/api/responses/service-completion-webhook.response.js.map +1 -0
  71. package/dist/types/interface/api/responses/service-consumer.response.d.ts +25 -0
  72. package/dist/types/interface/api/responses/service-consumer.response.js +3 -0
  73. package/dist/types/interface/api/responses/service-consumer.response.js.map +1 -0
  74. package/dist/types/interface/api/responses/service-discord.response.d.ts +1 -9
  75. package/dist/types/interface/api/responses/service-limits.response.d.ts +10 -0
  76. package/dist/types/interface/api/responses/service-limits.response.js +3 -0
  77. package/dist/types/interface/api/responses/service-limits.response.js.map +1 -0
  78. package/dist/types/interface/api/responses/service-openapi.response.d.ts +5 -0
  79. package/dist/types/interface/api/responses/service-openapi.response.js +3 -0
  80. package/dist/types/interface/api/responses/service-openapi.response.js.map +1 -0
  81. package/dist/types/interface/models/index.d.ts +4 -0
  82. package/dist/types/interface/models/index.js +4 -0
  83. package/dist/types/interface/models/index.js.map +1 -1
  84. package/dist/types/interface/models/reflex-bot-limits.model.d.ts +0 -25
  85. package/dist/types/interface/models/reflex-bot-limits.model.js +8 -7
  86. package/dist/types/interface/models/reflex-bot-limits.model.js.map +1 -1
  87. package/dist/types/interface/models/reflex-completion-webhook.model.d.ts +48 -0
  88. package/dist/types/interface/models/reflex-completion-webhook.model.js +12 -0
  89. package/dist/types/interface/models/reflex-completion-webhook.model.js.map +1 -0
  90. package/dist/types/interface/models/reflex-consumer.model.d.ts +30 -0
  91. package/dist/types/interface/models/reflex-consumer.model.js +11 -0
  92. package/dist/types/interface/models/reflex-consumer.model.js.map +1 -0
  93. package/dist/types/interface/models/reflex-execution-settings.model.d.ts +1 -0
  94. package/dist/types/interface/models/reflex-execution-settings.model.js +1 -0
  95. package/dist/types/interface/models/reflex-execution-settings.model.js.map +1 -1
  96. package/dist/types/interface/models/reflex-route-contract.model.d.ts +22 -0
  97. package/dist/types/interface/models/reflex-route-contract.model.js +13 -0
  98. package/dist/types/interface/models/reflex-route-contract.model.js.map +1 -0
  99. package/dist/types/interface/models/reflex-route.model.d.ts +2 -0
  100. package/dist/types/interface/models/reflex-run.model.d.ts +22 -0
  101. package/dist/types/interface/models/reflex-run.model.js.map +1 -1
  102. package/dist/types/interface/models/reflex-service-limits.model.d.ts +41 -0
  103. package/dist/types/interface/models/reflex-service-limits.model.js +13 -0
  104. package/dist/types/interface/models/reflex-service-limits.model.js.map +1 -0
  105. package/dist/types/interface/models/reflex-service-version.model.d.ts +2 -0
  106. package/jest.config.ts +11 -11
  107. package/package.json +1 -1
  108. package/src/api/alert-rule.api.test.ts +72 -72
  109. package/src/api/alert-rule.api.ts +57 -57
  110. package/src/api/application-insights.api.test.ts +42 -42
  111. package/src/api/application-insights.api.ts +38 -38
  112. package/src/api/application-run-settings.api.test.ts +51 -51
  113. package/src/api/application-run-settings.api.ts +30 -30
  114. package/src/api/function-access.api.ts +87 -87
  115. package/src/api/function-insights.api.test.ts +27 -27
  116. package/src/api/function-insights.api.ts +18 -18
  117. package/src/api/function-run.api.ts +38 -38
  118. package/src/api/function-settings.api.ts +74 -74
  119. package/src/api/function-template.api.test.ts +72 -72
  120. package/src/api/function-template.api.ts +52 -52
  121. package/src/api/function-test.api.ts +34 -34
  122. package/src/api/function-version.api.ts +66 -66
  123. package/src/api/function.api.test.ts +2 -1
  124. package/src/api/function.api.ts +62 -62
  125. package/src/api/health.api.ts +10 -10
  126. package/src/api/index.ts +4 -0
  127. package/src/api/route-stats.api.test.ts +45 -45
  128. package/src/api/route-stats.api.ts +36 -36
  129. package/src/api/service-completion-webhook.api.test.ts +87 -0
  130. package/src/api/service-completion-webhook.api.ts +37 -0
  131. package/src/api/service-configuration.api.ts +16 -16
  132. package/src/api/service-consumer.api.test.ts +104 -0
  133. package/src/api/service-consumer.api.ts +88 -0
  134. package/src/api/service-deployment.api.ts +79 -79
  135. package/src/api/service-discord-event.api.test.ts +106 -106
  136. package/src/api/service-discord-event.api.ts +78 -78
  137. package/src/api/service-discord.api.test.ts +0 -19
  138. package/src/api/service-discord.api.ts +0 -19
  139. package/src/api/service-insights.api.test.ts +36 -36
  140. package/src/api/service-insights.api.ts +42 -42
  141. package/src/api/service-limits.api.test.ts +100 -0
  142. package/src/api/service-limits.api.ts +37 -0
  143. package/src/api/service-openapi.api.test.ts +52 -0
  144. package/src/api/service-openapi.api.ts +21 -0
  145. package/src/api/service-route.api.ts +8 -6
  146. package/src/api/service-task.api.test.ts +140 -140
  147. package/src/api/service-task.api.ts +141 -141
  148. package/src/api/service-version.api.ts +54 -54
  149. package/src/api/service.api.test.ts +215 -215
  150. package/src/api/service.api.ts +55 -55
  151. package/src/discord/discord-event-filter-cases.ts +261 -261
  152. package/src/discord/discord-event-filters.test.ts +91 -91
  153. package/src/discord/discord-event-filters.ts +95 -95
  154. package/src/discord/discord-event-intents.test.ts +112 -112
  155. package/src/discord/discord-event-intents.ts +55 -55
  156. package/src/discord/index.ts +3 -3
  157. package/src/index.test.ts +18 -1
  158. package/src/index.ts +46 -3
  159. package/src/insights/index.ts +1 -1
  160. package/src/insights/percentiles.test.ts +75 -75
  161. package/src/insights/percentiles.ts +37 -37
  162. package/src/types/enum/access-grant-status.enum.ts +12 -12
  163. package/src/types/enum/access-kind.enum.ts +7 -7
  164. package/src/types/enum/access-request-status.enum.ts +11 -11
  165. package/src/types/enum/bot-event-block-reason.enum.ts +7 -7
  166. package/src/types/enum/completion-delivery-status.enum.ts +9 -0
  167. package/src/types/enum/configuration-read-as.enum.ts +5 -5
  168. package/src/types/enum/discord-activity-type.enum.ts +9 -9
  169. package/src/types/enum/discord-channel-type.enum.ts +11 -11
  170. package/src/types/enum/discord-component-kind.enum.ts +7 -7
  171. package/src/types/enum/discord-event-drop-reason.enum.ts +13 -13
  172. package/src/types/enum/discord-event-filter-name.enum.ts +11 -11
  173. package/src/types/enum/discord-event-status.enum.ts +13 -13
  174. package/src/types/enum/discord-event-type.enum.ts +7 -7
  175. package/src/types/enum/discord-gateway-failure-code.enum.ts +11 -11
  176. package/src/types/enum/discord-gateway-state.enum.ts +11 -11
  177. package/src/types/enum/discord-host-action.enum.ts +35 -35
  178. package/src/types/enum/discord-locale.enum.ts +35 -35
  179. package/src/types/enum/discord-option-type.enum.ts +12 -12
  180. package/src/types/enum/discord-presence-status.enum.ts +8 -8
  181. package/src/types/enum/discord-sync-status.enum.ts +6 -6
  182. package/src/types/enum/discord-token-state.enum.ts +11 -11
  183. package/src/types/enum/execution-mode.enum.ts +9 -9
  184. package/src/types/enum/execution-profile.enum.ts +20 -20
  185. package/src/types/enum/execution-settings-source.enum.ts +9 -9
  186. package/src/types/enum/health-status.enum.ts +4 -4
  187. package/src/types/enum/index.ts +2 -0
  188. package/src/types/enum/insights-period.enum.ts +8 -8
  189. package/src/types/enum/log-cap-mode.enum.ts +6 -6
  190. package/src/types/enum/log-drop-cause.enum.ts +8 -8
  191. package/src/types/enum/reflex-alert-metric.enum.ts +5 -5
  192. package/src/types/enum/reflex-alert-notification-state.enum.ts +6 -6
  193. package/src/types/enum/reflex-alert-scope.enum.ts +6 -6
  194. package/src/types/enum/reflex-error-code.enum.ts +31 -1
  195. package/src/types/enum/route-method.enum.ts +9 -9
  196. package/src/types/enum/run-log-level.enum.ts +6 -6
  197. package/src/types/enum/run-mode.enum.ts +11 -11
  198. package/src/types/enum/run-status.enum.ts +5 -0
  199. package/src/types/enum/run-step-status.enum.ts +7 -7
  200. package/src/types/enum/schedule-sync-status.enum.ts +6 -6
  201. package/src/types/enum/scheduled-run-failure-code.enum.ts +3 -1
  202. package/src/types/enum/scheduled-run-origin.enum.ts +5 -5
  203. package/src/types/enum/scheduled-run-status.enum.ts +17 -17
  204. package/src/types/enum/service-block-reason.enum.ts +13 -0
  205. package/src/types/enum/service-deployment-action.enum.ts +11 -11
  206. package/src/types/enum/service-deployment-status.enum.ts +5 -5
  207. package/src/types/enum/service-type.enum.ts +9 -9
  208. package/src/types/enum/service-version-change-kind.enum.ts +6 -6
  209. package/src/types/enum/trace-effect-type.enum.ts +12 -12
  210. package/src/types/enum/trigger-access-mode.enum.ts +12 -12
  211. package/src/types/enum/trigger-kind.enum.ts +8 -8
  212. package/src/types/enum/vault-value-source.enum.ts +12 -12
  213. package/src/types/enum/vault-visibility.enum.ts +5 -5
  214. package/src/types/index.ts +2 -2
  215. package/src/types/interface/api/index.ts +3 -3
  216. package/src/types/interface/api/requests/alert-rule.request.ts +53 -53
  217. package/src/types/interface/api/requests/application-insights.request.ts +18 -18
  218. package/src/types/interface/api/requests/application-run-settings.request.ts +11 -11
  219. package/src/types/interface/api/requests/function-access.request.ts +51 -51
  220. package/src/types/interface/api/requests/function-run.request.ts +2 -0
  221. package/src/types/interface/api/requests/function-settings.request.ts +34 -34
  222. package/src/types/interface/api/requests/function-template.request.ts +29 -29
  223. package/src/types/interface/api/requests/function-test.request.ts +5 -0
  224. package/src/types/interface/api/requests/function-version.request.ts +38 -38
  225. package/src/types/interface/api/requests/function.request.ts +36 -36
  226. package/src/types/interface/api/requests/index.ts +4 -0
  227. package/src/types/interface/api/requests/route-stats.request.ts +22 -22
  228. package/src/types/interface/api/requests/service-completion-webhook.request.ts +11 -0
  229. package/src/types/interface/api/requests/service-configuration.request.ts +4 -4
  230. package/src/types/interface/api/requests/service-consumer.request.ts +51 -0
  231. package/src/types/interface/api/requests/service-deployment.request.ts +49 -49
  232. package/src/types/interface/api/requests/service-discord-event.request.ts +68 -68
  233. package/src/types/interface/api/requests/service-discord.request.ts +1 -25
  234. package/src/types/interface/api/requests/service-insights.request.ts +31 -31
  235. package/src/types/interface/api/requests/service-limits.request.ts +28 -0
  236. package/src/types/interface/api/requests/service-openapi.request.ts +10 -0
  237. package/src/types/interface/api/requests/service-route.request.ts +8 -0
  238. package/src/types/interface/api/requests/service-task.request.ts +80 -80
  239. package/src/types/interface/api/requests/service-version.request.ts +24 -24
  240. package/src/types/interface/api/requests/service.request.ts +46 -46
  241. package/src/types/interface/api/response.ts +4 -4
  242. package/src/types/interface/api/responses/alert-rule.response.ts +24 -24
  243. package/src/types/interface/api/responses/application-insights.response.ts +11 -11
  244. package/src/types/interface/api/responses/application-run-settings.response.ts +8 -8
  245. package/src/types/interface/api/responses/function-access.response.ts +45 -45
  246. package/src/types/interface/api/responses/function-run.response.ts +18 -18
  247. package/src/types/interface/api/responses/function-settings.response.ts +8 -0
  248. package/src/types/interface/api/responses/function-template.response.ts +21 -21
  249. package/src/types/interface/api/responses/function-test.response.ts +8 -1
  250. package/src/types/interface/api/responses/function-version.response.ts +42 -42
  251. package/src/types/interface/api/responses/function.response.ts +25 -25
  252. package/src/types/interface/api/responses/index.ts +4 -0
  253. package/src/types/interface/api/responses/route-stats.response.ts +15 -15
  254. package/src/types/interface/api/responses/service-completion-webhook.response.ts +13 -0
  255. package/src/types/interface/api/responses/service-configuration.response.ts +8 -8
  256. package/src/types/interface/api/responses/service-consumer.response.ts +33 -0
  257. package/src/types/interface/api/responses/service-deployment.response.ts +32 -32
  258. package/src/types/interface/api/responses/service-discord-event.response.ts +24 -24
  259. package/src/types/interface/api/responses/service-discord.response.ts +4 -16
  260. package/src/types/interface/api/responses/service-insights.response.ts +11 -11
  261. package/src/types/interface/api/responses/service-limits.response.ts +13 -0
  262. package/src/types/interface/api/responses/service-openapi.response.ts +7 -0
  263. package/src/types/interface/api/responses/service-route.response.ts +3 -3
  264. package/src/types/interface/api/responses/service-task.response.ts +57 -57
  265. package/src/types/interface/api/responses/service-version.response.ts +112 -112
  266. package/src/types/interface/api/responses/service.response.ts +31 -31
  267. package/src/types/interface/health.response.ts +7 -7
  268. package/src/types/interface/index.ts +3 -3
  269. package/src/types/interface/models/index.ts +4 -0
  270. package/src/types/interface/models/reflex-access-grant.model.ts +14 -14
  271. package/src/types/interface/models/reflex-access-request.model.ts +15 -15
  272. package/src/types/interface/models/reflex-alert-rule.model.ts +56 -56
  273. package/src/types/interface/models/reflex-bot-limits.model.ts +12 -51
  274. package/src/types/interface/models/reflex-completion-webhook.model.ts +85 -0
  275. package/src/types/interface/models/reflex-consumer.model.ts +50 -0
  276. package/src/types/interface/models/reflex-definition.model.ts +31 -31
  277. package/src/types/interface/models/reflex-discord-event-log.model.ts +58 -58
  278. package/src/types/interface/models/reflex-discord-event.model.ts +79 -79
  279. package/src/types/interface/models/reflex-discord.model.ts +196 -196
  280. package/src/types/interface/models/reflex-execution-settings.model.ts +7 -0
  281. package/src/types/interface/models/reflex-function-template.model.ts +18 -18
  282. package/src/types/interface/models/reflex-function-version.model.ts +19 -19
  283. package/src/types/interface/models/reflex-function.model.ts +30 -30
  284. package/src/types/interface/models/reflex-insights.model.ts +215 -215
  285. package/src/types/interface/models/reflex-price-list.model.ts +20 -20
  286. package/src/types/interface/models/reflex-route-contract.model.ts +46 -0
  287. package/src/types/interface/models/reflex-route.model.ts +5 -1
  288. package/src/types/interface/models/reflex-run-settings.model.ts +28 -28
  289. package/src/types/interface/models/reflex-run.model.ts +49 -3
  290. package/src/types/interface/models/reflex-service-configuration.model.ts +22 -22
  291. package/src/types/interface/models/reflex-service-deployment.model.ts +46 -46
  292. package/src/types/interface/models/reflex-service-limits.model.ts +73 -0
  293. package/src/types/interface/models/reflex-service-version.model.ts +3 -0
  294. package/src/types/interface/models/reflex-service.model.ts +45 -45
  295. package/src/types/interface/models/reflex-step-stats.model.ts +35 -35
  296. package/src/types/interface/models/reflex-task.model.ts +97 -97
  297. package/tsconfig.check.json +15 -15
  298. package/tsconfig.json +35 -35
@@ -1,55 +1,55 @@
1
- import { DiscordEventType } from '../types/enum';
2
- import type { IReflexDiscordEvent } from '../types/interface/models';
3
-
4
- /** The Gateway intents the Discord events need, as Discord numbers their bits. */
5
- export enum DiscordGatewayIntent {
6
- /** Member arrival and departure. Privileged. */
7
- GUILD_MEMBERS = 1 << 1,
8
- GUILD_MESSAGES = 1 << 9,
9
- GUILD_MESSAGE_REACTIONS = 1 << 10,
10
- /** The content of a message. Privileged. */
11
- MESSAGE_CONTENT = 1 << 15,
12
- }
13
-
14
- /** The intents Discord asks the bot owner to enable in the portal (and to have verified past 100 servers). */
15
- export const PRIVILEGED_DISCORD_GATEWAY_INTENTS: readonly DiscordGatewayIntent[] = [
16
- DiscordGatewayIntent.GUILD_MEMBERS,
17
- DiscordGatewayIntent.MESSAGE_CONTENT,
18
- ];
19
-
20
- /** The intent each event type needs by itself. `GUILDS` is never asked: the four events do not need its large packets. */
21
- export const DISCORD_EVENT_BASE_INTENT: Record<DiscordEventType, DiscordGatewayIntent> = {
22
- [DiscordEventType.GUILD_MEMBER_ADD]: DiscordGatewayIntent.GUILD_MEMBERS,
23
- [DiscordEventType.GUILD_MEMBER_REMOVE]: DiscordGatewayIntent.GUILD_MEMBERS,
24
- [DiscordEventType.MESSAGE_CREATE]: DiscordGatewayIntent.GUILD_MESSAGES,
25
- [DiscordEventType.MESSAGE_REACTION_ADD]: DiscordGatewayIntent.GUILD_MESSAGE_REACTIONS,
26
- };
27
-
28
- type IntentSource = Pick<IReflexDiscordEvent, 'eventType' | 'filters' | 'includeContent'>;
29
-
30
- /** True when the trigger reads the content of a message: it asks for it, or filters on a prefix. */
31
- const needsMessageContent = (event: IntentSource): boolean =>
32
- event.eventType === DiscordEventType.MESSAGE_CREATE &&
33
- (event.includeContent || (event.filters.contentPrefix ?? '') !== '');
34
-
35
- /** The intents one trigger needs. */
36
- const intentListOf = (event: IntentSource): DiscordGatewayIntent[] => {
37
- const intents = [DISCORD_EVENT_BASE_INTENT[event.eventType]];
38
- if (needsMessageContent(event)) {
39
- intents.push(DiscordGatewayIntent.MESSAGE_CONTENT);
40
- }
41
- return intents;
42
- };
43
-
44
- /** The `intents` of IDENTIFY for the triggers of a version: the union of their bits, 0 without a trigger. */
45
- export const intentsOf = (events: readonly IntentSource[]): number =>
46
- events.reduce(
47
- (bits, event) => intentListOf(event).reduce((acc, intent) => acc | intent, bits),
48
- 0,
49
- );
50
-
51
- /** The privileged intents the triggers need, in bit order, without duplicates. */
52
- export const privilegedIntentsOf = (events: readonly IntentSource[]): DiscordGatewayIntent[] => {
53
- const bits = intentsOf(events);
54
- return PRIVILEGED_DISCORD_GATEWAY_INTENTS.filter((intent) => (bits & intent) !== 0);
55
- };
1
+ import { DiscordEventType } from '../types/enum';
2
+ import type { IReflexDiscordEvent } from '../types/interface/models';
3
+
4
+ /** The Gateway intents the Discord events need, as Discord numbers their bits. */
5
+ export enum DiscordGatewayIntent {
6
+ /** Member arrival and departure. Privileged. */
7
+ GUILD_MEMBERS = 1 << 1,
8
+ GUILD_MESSAGES = 1 << 9,
9
+ GUILD_MESSAGE_REACTIONS = 1 << 10,
10
+ /** The content of a message. Privileged. */
11
+ MESSAGE_CONTENT = 1 << 15,
12
+ }
13
+
14
+ /** The intents Discord asks the bot owner to enable in the portal (and to have verified past 100 servers). */
15
+ export const PRIVILEGED_DISCORD_GATEWAY_INTENTS: readonly DiscordGatewayIntent[] = [
16
+ DiscordGatewayIntent.GUILD_MEMBERS,
17
+ DiscordGatewayIntent.MESSAGE_CONTENT,
18
+ ];
19
+
20
+ /** The intent each event type needs by itself. `GUILDS` is never asked: the four events do not need its large packets. */
21
+ export const DISCORD_EVENT_BASE_INTENT: Record<DiscordEventType, DiscordGatewayIntent> = {
22
+ [DiscordEventType.GUILD_MEMBER_ADD]: DiscordGatewayIntent.GUILD_MEMBERS,
23
+ [DiscordEventType.GUILD_MEMBER_REMOVE]: DiscordGatewayIntent.GUILD_MEMBERS,
24
+ [DiscordEventType.MESSAGE_CREATE]: DiscordGatewayIntent.GUILD_MESSAGES,
25
+ [DiscordEventType.MESSAGE_REACTION_ADD]: DiscordGatewayIntent.GUILD_MESSAGE_REACTIONS,
26
+ };
27
+
28
+ type IntentSource = Pick<IReflexDiscordEvent, 'eventType' | 'filters' | 'includeContent'>;
29
+
30
+ /** True when the trigger reads the content of a message: it asks for it, or filters on a prefix. */
31
+ const needsMessageContent = (event: IntentSource): boolean =>
32
+ event.eventType === DiscordEventType.MESSAGE_CREATE &&
33
+ (event.includeContent || (event.filters.contentPrefix ?? '') !== '');
34
+
35
+ /** The intents one trigger needs. */
36
+ const intentListOf = (event: IntentSource): DiscordGatewayIntent[] => {
37
+ const intents = [DISCORD_EVENT_BASE_INTENT[event.eventType]];
38
+ if (needsMessageContent(event)) {
39
+ intents.push(DiscordGatewayIntent.MESSAGE_CONTENT);
40
+ }
41
+ return intents;
42
+ };
43
+
44
+ /** The `intents` of IDENTIFY for the triggers of a version: the union of their bits, 0 without a trigger. */
45
+ export const intentsOf = (events: readonly IntentSource[]): number =>
46
+ events.reduce(
47
+ (bits, event) => intentListOf(event).reduce((acc, intent) => acc | intent, bits),
48
+ 0,
49
+ );
50
+
51
+ /** The privileged intents the triggers need, in bit order, without duplicates. */
52
+ export const privilegedIntentsOf = (events: readonly IntentSource[]): DiscordGatewayIntent[] => {
53
+ const bits = intentsOf(events);
54
+ return PRIVILEGED_DISCORD_GATEWAY_INTENTS.filter((intent) => (bits & intent) !== 0);
55
+ };
@@ -1,3 +1,3 @@
1
- export * from './discord-event-intents';
2
- export * from './discord-event-filters';
3
- export * from './discord-event-filter-cases';
1
+ export * from './discord-event-intents';
2
+ export * from './discord-event-filters';
3
+ export * from './discord-event-filter-cases';
package/src/index.test.ts CHANGED
@@ -70,7 +70,7 @@ describe('AbyssReflexCore facade of the Discord events', () => {
70
70
  expect(Object.keys(service.insights)).toEqual(['get', 'events']);
71
71
  expect(Object.keys(fn.insights)).toEqual(['get']);
72
72
  expect(service.discord.connection.setAllocation).toBeInstanceOf(Function);
73
- expect(service.discord.connection.setBotSettings).toBeInstanceOf(Function);
73
+ expect(Object.keys(service.discord.connection)).not.toContain('setBotSettings');
74
74
  });
75
75
  });
76
76
 
@@ -85,3 +85,20 @@ describe('AbyssReflexCore facade of the run understanding routes', () => {
85
85
  expect(Object.keys(fn.logCap)).toEqual(['set']);
86
86
  });
87
87
  });
88
+
89
+ describe('AbyssReflexCore facade of the contract, the consumers and the limits', () => {
90
+ it('exposes the consumer, OpenAPI, limits and completion webhook routes under short names', () => {
91
+ const { service } = AbyssReflexCore.sdk;
92
+ expect(Object.keys(service.consumer)).toEqual([
93
+ 'list',
94
+ 'create',
95
+ 'update',
96
+ 'delete',
97
+ 'createKey',
98
+ 'revokeKey',
99
+ ]);
100
+ expect(Object.keys(service.openapi)).toEqual(['get']);
101
+ expect(Object.keys(service.limits)).toEqual(['list', 'set']);
102
+ expect(Object.keys(service.completionWebhook)).toEqual(['get', 'rotateSecret']);
103
+ });
104
+ });
package/src/index.ts CHANGED
@@ -21,6 +21,10 @@ import * as applicationRunSettingsApi from './api/application-run-settings.api';
21
21
  import * as applicationInsightsApi from './api/application-insights.api';
22
22
  import * as alertRuleApi from './api/alert-rule.api';
23
23
  import * as routeStatsApi from './api/route-stats.api';
24
+ import * as serviceConsumerApi from './api/service-consumer.api';
25
+ import * as serviceOpenApiApi from './api/service-openapi.api';
26
+ import * as serviceLimitsApi from './api/service-limits.api';
27
+ import * as serviceCompletionWebhookApi from './api/service-completion-webhook.api';
24
28
 
25
29
  export * from './api';
26
30
  export * from './types';
@@ -178,8 +182,6 @@ type AbyssReflexCoreSDK = {
178
182
  setEnvironment: typeof serviceDiscordApi.setServiceDiscordEnvironment;
179
183
  /** The lots of the reserve of events per minute the bot holds in an environment. */
180
184
  setAllocation: typeof serviceDiscordApi.setServiceDiscordAllocation;
181
- /** Credit overage, monthly spend cap and alerts of the bot in an environment. */
182
- setBotSettings: typeof serviceDiscordApi.setServiceDiscordBotSettings;
183
185
  check: typeof serviceDiscordApi.checkServiceDiscordConnection;
184
186
  };
185
187
  /** Pushes the interactions address and the commands to Discord again. */
@@ -203,6 +205,29 @@ type AbyssReflexCoreSDK = {
203
205
  /** Synchronizes the cron tasks of the version in service with Flow again. */
204
206
  sync: typeof serviceTaskApi.retryServiceScheduleSync;
205
207
  };
208
+ /** Who calls the API_KEY routes of the Service, and their keys. */
209
+ consumer: {
210
+ list: typeof serviceConsumerApi.listServiceConsumer;
211
+ create: typeof serviceConsumerApi.createServiceConsumer;
212
+ update: typeof serviceConsumerApi.updateServiceConsumer;
213
+ delete: typeof serviceConsumerApi.deleteServiceConsumer;
214
+ createKey: typeof serviceConsumerApi.createServiceConsumerKey;
215
+ revokeKey: typeof serviceConsumerApi.revokeServiceConsumerKey;
216
+ };
217
+ /** The OpenAPI 3.1 document of the routes of a version or of the draft. */
218
+ openapi: {
219
+ get: typeof serviceOpenApiApi.getServiceOpenApi;
220
+ };
221
+ /** Credits, monthly spend cap, alerts and stop of the Service in each environment, whatever its type. */
222
+ limits: {
223
+ list: typeof serviceLimitsApi.listServiceLimits;
224
+ set: typeof serviceLimitsApi.setServiceLimits;
225
+ };
226
+ /** The signing secrets of the completion webhook of the async executions. */
227
+ completionWebhook: {
228
+ get: typeof serviceCompletionWebhookApi.getServiceCompletionWebhook;
229
+ rotateSecret: typeof serviceCompletionWebhookApi.rotateServiceCompletionWebhookSecret;
230
+ };
206
231
  };
207
232
  };
208
233
 
@@ -349,7 +374,6 @@ export class AbyssReflexCore {
349
374
  setTokenSecret: serviceDiscordApi.setServiceDiscordTokenSecret,
350
375
  setEnvironment: serviceDiscordApi.setServiceDiscordEnvironment,
351
376
  setAllocation: serviceDiscordApi.setServiceDiscordAllocation,
352
- setBotSettings: serviceDiscordApi.setServiceDiscordBotSettings,
353
377
  check: serviceDiscordApi.checkServiceDiscordConnection,
354
378
  },
355
379
  sync: serviceDiscordApi.retryServiceDiscordSync,
@@ -369,6 +393,25 @@ export class AbyssReflexCore {
369
393
  },
370
394
  sync: serviceTaskApi.retryServiceScheduleSync,
371
395
  },
396
+ consumer: {
397
+ list: serviceConsumerApi.listServiceConsumer,
398
+ create: serviceConsumerApi.createServiceConsumer,
399
+ update: serviceConsumerApi.updateServiceConsumer,
400
+ delete: serviceConsumerApi.deleteServiceConsumer,
401
+ createKey: serviceConsumerApi.createServiceConsumerKey,
402
+ revokeKey: serviceConsumerApi.revokeServiceConsumerKey,
403
+ },
404
+ openapi: {
405
+ get: serviceOpenApiApi.getServiceOpenApi,
406
+ },
407
+ limits: {
408
+ list: serviceLimitsApi.listServiceLimits,
409
+ set: serviceLimitsApi.setServiceLimits,
410
+ },
411
+ completionWebhook: {
412
+ get: serviceCompletionWebhookApi.getServiceCompletionWebhook,
413
+ rotateSecret: serviceCompletionWebhookApi.rotateServiceCompletionWebhookSecret,
414
+ },
372
415
  },
373
416
  };
374
417
  }
@@ -1 +1 @@
1
- export * from './percentiles';
1
+ export * from './percentiles';
@@ -1,75 +1,75 @@
1
- import { DURATION_HISTOGRAM_BOUNDS_MS } from '../types';
2
- import { percentileOfHistogram } from './percentiles';
3
-
4
- const emptyHistogram = (): number[] =>
5
- new Array<number>(DURATION_HISTOGRAM_BOUNDS_MS.length + 1).fill(0);
6
-
7
- describe('percentileOfHistogram', () => {
8
- it('reads p50, p95 and p99 at the upper bound of the bucket holding them', () => {
9
- const histogram = emptyHistogram();
10
- histogram[2] = 50; // <= 50 ms
11
- histogram[3] = 40; // <= 100 ms
12
- histogram[6] = 9; // <= 500 ms
13
- histogram[10] = 1; // <= 2500 ms
14
-
15
- expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.5)).toEqual({
16
- upperBoundMs: 50,
17
- open: false,
18
- });
19
- expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.95)).toEqual({
20
- upperBoundMs: 500,
21
- open: false,
22
- });
23
- expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.99)).toEqual({
24
- upperBoundMs: 500,
25
- open: false,
26
- });
27
- expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 1)).toEqual({
28
- upperBoundMs: 2500,
29
- open: false,
30
- });
31
- });
32
-
33
- it('answers the last bound with open set when the percentile falls in the open bucket', () => {
34
- const histogram = emptyHistogram();
35
- histogram[0] = 90;
36
- histogram[DURATION_HISTOGRAM_BOUNDS_MS.length] = 10;
37
-
38
- expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.5)).toEqual({
39
- upperBoundMs: 10,
40
- open: false,
41
- });
42
- expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.95)).toEqual({
43
- upperBoundMs: 30_000,
44
- open: true,
45
- });
46
- });
47
-
48
- it('answers null for an empty histogram', () => {
49
- expect(percentileOfHistogram(emptyHistogram(), DURATION_HISTOGRAM_BOUNDS_MS, 0.95)).toBeNull();
50
- });
51
-
52
- it('answers the bucket of a single run for every quantile', () => {
53
- const histogram = emptyHistogram();
54
- histogram[4] = 1;
55
-
56
- expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.5)).toEqual({
57
- upperBoundMs: 200,
58
- open: false,
59
- });
60
- expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.99)).toEqual({
61
- upperBoundMs: 200,
62
- open: false,
63
- });
64
- });
65
-
66
- it('rejects a histogram that does not match the bounds and a quantile out of range', () => {
67
- expect(() => percentileOfHistogram([1, 2], DURATION_HISTOGRAM_BOUNDS_MS, 0.5)).toThrow();
68
- expect(() =>
69
- percentileOfHistogram(emptyHistogram(), DURATION_HISTOGRAM_BOUNDS_MS, 0),
70
- ).toThrow();
71
- expect(() =>
72
- percentileOfHistogram(emptyHistogram(), DURATION_HISTOGRAM_BOUNDS_MS, 1.5),
73
- ).toThrow();
74
- });
75
- });
1
+ import { DURATION_HISTOGRAM_BOUNDS_MS } from '../types';
2
+ import { percentileOfHistogram } from './percentiles';
3
+
4
+ const emptyHistogram = (): number[] =>
5
+ new Array<number>(DURATION_HISTOGRAM_BOUNDS_MS.length + 1).fill(0);
6
+
7
+ describe('percentileOfHistogram', () => {
8
+ it('reads p50, p95 and p99 at the upper bound of the bucket holding them', () => {
9
+ const histogram = emptyHistogram();
10
+ histogram[2] = 50; // <= 50 ms
11
+ histogram[3] = 40; // <= 100 ms
12
+ histogram[6] = 9; // <= 500 ms
13
+ histogram[10] = 1; // <= 2500 ms
14
+
15
+ expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.5)).toEqual({
16
+ upperBoundMs: 50,
17
+ open: false,
18
+ });
19
+ expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.95)).toEqual({
20
+ upperBoundMs: 500,
21
+ open: false,
22
+ });
23
+ expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.99)).toEqual({
24
+ upperBoundMs: 500,
25
+ open: false,
26
+ });
27
+ expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 1)).toEqual({
28
+ upperBoundMs: 2500,
29
+ open: false,
30
+ });
31
+ });
32
+
33
+ it('answers the last bound with open set when the percentile falls in the open bucket', () => {
34
+ const histogram = emptyHistogram();
35
+ histogram[0] = 90;
36
+ histogram[DURATION_HISTOGRAM_BOUNDS_MS.length] = 10;
37
+
38
+ expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.5)).toEqual({
39
+ upperBoundMs: 10,
40
+ open: false,
41
+ });
42
+ expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.95)).toEqual({
43
+ upperBoundMs: 30_000,
44
+ open: true,
45
+ });
46
+ });
47
+
48
+ it('answers null for an empty histogram', () => {
49
+ expect(percentileOfHistogram(emptyHistogram(), DURATION_HISTOGRAM_BOUNDS_MS, 0.95)).toBeNull();
50
+ });
51
+
52
+ it('answers the bucket of a single run for every quantile', () => {
53
+ const histogram = emptyHistogram();
54
+ histogram[4] = 1;
55
+
56
+ expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.5)).toEqual({
57
+ upperBoundMs: 200,
58
+ open: false,
59
+ });
60
+ expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.99)).toEqual({
61
+ upperBoundMs: 200,
62
+ open: false,
63
+ });
64
+ });
65
+
66
+ it('rejects a histogram that does not match the bounds and a quantile out of range', () => {
67
+ expect(() => percentileOfHistogram([1, 2], DURATION_HISTOGRAM_BOUNDS_MS, 0.5)).toThrow();
68
+ expect(() =>
69
+ percentileOfHistogram(emptyHistogram(), DURATION_HISTOGRAM_BOUNDS_MS, 0),
70
+ ).toThrow();
71
+ expect(() =>
72
+ percentileOfHistogram(emptyHistogram(), DURATION_HISTOGRAM_BOUNDS_MS, 1.5),
73
+ ).toThrow();
74
+ });
75
+ });
@@ -1,37 +1,37 @@
1
- import type { IReflexDurationPercentile } from '../types';
2
-
3
- /**
4
- * Reads a percentile on a duration histogram: the upper bound of the bucket holding the `q` quantile (the
5
- * smallest bucket whose cumulative count reaches `ceil(q * total)`). The histogram has one bucket per bound plus
6
- * an open one; a percentile in the open bucket answers the last bound with `open` true. Null when the histogram
7
- * holds no run: the denominator is its own sum, never the number of runs.
8
- */
9
- export const percentileOfHistogram = (
10
- histogram: readonly number[],
11
- bounds: readonly number[],
12
- q: number,
13
- ): IReflexDurationPercentile | null => {
14
- if (bounds.length === 0 || histogram.length !== bounds.length + 1) {
15
- throw new Error(
16
- `A histogram needs one bucket per bound plus an open one: got ${histogram.length} buckets for ${bounds.length} bounds`,
17
- );
18
- }
19
- if (!(q > 0 && q <= 1)) {
20
- throw new Error(`A quantile is in ]0, 1]: got ${q}`);
21
- }
22
- const total = histogram.reduce((sum, count) => sum + count, 0);
23
- if (total === 0) {
24
- return null;
25
- }
26
- const rank = Math.max(1, Math.ceil(q * total));
27
- let cumulative = 0;
28
- for (let index = 0; index < histogram.length; index += 1) {
29
- cumulative += histogram[index];
30
- if (cumulative >= rank) {
31
- return index < bounds.length
32
- ? { upperBoundMs: bounds[index], open: false }
33
- : { upperBoundMs: bounds[bounds.length - 1], open: true };
34
- }
35
- }
36
- return { upperBoundMs: bounds[bounds.length - 1], open: true };
37
- };
1
+ import type { IReflexDurationPercentile } from '../types';
2
+
3
+ /**
4
+ * Reads a percentile on a duration histogram: the upper bound of the bucket holding the `q` quantile (the
5
+ * smallest bucket whose cumulative count reaches `ceil(q * total)`). The histogram has one bucket per bound plus
6
+ * an open one; a percentile in the open bucket answers the last bound with `open` true. Null when the histogram
7
+ * holds no run: the denominator is its own sum, never the number of runs.
8
+ */
9
+ export const percentileOfHistogram = (
10
+ histogram: readonly number[],
11
+ bounds: readonly number[],
12
+ q: number,
13
+ ): IReflexDurationPercentile | null => {
14
+ if (bounds.length === 0 || histogram.length !== bounds.length + 1) {
15
+ throw new Error(
16
+ `A histogram needs one bucket per bound plus an open one: got ${histogram.length} buckets for ${bounds.length} bounds`,
17
+ );
18
+ }
19
+ if (!(q > 0 && q <= 1)) {
20
+ throw new Error(`A quantile is in ]0, 1]: got ${q}`);
21
+ }
22
+ const total = histogram.reduce((sum, count) => sum + count, 0);
23
+ if (total === 0) {
24
+ return null;
25
+ }
26
+ const rank = Math.max(1, Math.ceil(q * total));
27
+ let cumulative = 0;
28
+ for (let index = 0; index < histogram.length; index += 1) {
29
+ cumulative += histogram[index];
30
+ if (cumulative >= rank) {
31
+ return index < bounds.length
32
+ ? { upperBoundMs: bounds[index], open: false }
33
+ : { upperBoundMs: bounds[bounds.length - 1], open: true };
34
+ }
35
+ }
36
+ return { upperBoundMs: bounds[bounds.length - 1], open: true };
37
+ };
@@ -1,12 +1,12 @@
1
- /**
2
- * State of an access granted to a function.
3
- * - ACTIVE: the grantor still holds the right the access needs.
4
- * - SUSPENDED: a publication found the grantor without that right. Publishing is refused
5
- * (`GRANT_SUSPENDED`) until the access is revoked and granted again; what is already promoted keeps running.
6
- * - REVOKED: withdrawn on purpose; the row stays as the journal.
7
- */
8
- export enum AccessGrantStatus {
9
- ACTIVE = 'ACTIVE',
10
- SUSPENDED = 'SUSPENDED',
11
- REVOKED = 'REVOKED',
12
- }
1
+ /**
2
+ * State of an access granted to a function.
3
+ * - ACTIVE: the grantor still holds the right the access needs.
4
+ * - SUSPENDED: a publication found the grantor without that right. Publishing is refused
5
+ * (`GRANT_SUSPENDED`) until the access is revoked and granted again; what is already promoted keeps running.
6
+ * - REVOKED: withdrawn on purpose; the row stays as the journal.
7
+ */
8
+ export enum AccessGrantStatus {
9
+ ACTIVE = 'ACTIVE',
10
+ SUSPENDED = 'SUSPENDED',
11
+ REVOKED = 'REVOKED',
12
+ }
@@ -1,7 +1,7 @@
1
- /** The kinds of access a definition declares and a member grants (the format of @abyss-project/runtime). */
2
- export enum ReflexAccessKind {
3
- /** Outbound HTTP to a list of host names (exact, or `*.domain` for any sub-domain). */
4
- HTTP = 'HTTP',
5
- /** One action of the host catalog (`store.get`, `store.set`, `store.increment`, `secret.get`, `http.respond`). */
6
- HOST_ACTION = 'HOST_ACTION',
7
- }
1
+ /** The kinds of access a definition declares and a member grants (the format of @abyss-project/runtime). */
2
+ export enum ReflexAccessKind {
3
+ /** Outbound HTTP to a list of host names (exact, or `*.domain` for any sub-domain). */
4
+ HTTP = 'HTTP',
5
+ /** One action of the host catalog (`store.get`, `store.set`, `store.increment`, `secret.get`, `http.respond`). */
6
+ HOST_ACTION = 'HOST_ACTION',
7
+ }
@@ -1,11 +1,11 @@
1
- /**
2
- * State of a request to grant an access a function declares.
3
- * - PENDING: waiting for a member who holds the right the access needs.
4
- * - GRANTED: the access was granted (by the request or by another gesture).
5
- * - DISMISSED: set aside by a member with the right, or because the draft no longer declares the access.
6
- */
7
- export enum AccessRequestStatus {
8
- PENDING = 'PENDING',
9
- GRANTED = 'GRANTED',
10
- DISMISSED = 'DISMISSED',
11
- }
1
+ /**
2
+ * State of a request to grant an access a function declares.
3
+ * - PENDING: waiting for a member who holds the right the access needs.
4
+ * - GRANTED: the access was granted (by the request or by another gesture).
5
+ * - DISMISSED: set aside by a member with the right, or because the draft no longer declares the access.
6
+ */
7
+ export enum AccessRequestStatus {
8
+ PENDING = 'PENDING',
9
+ GRANTED = 'GRANTED',
10
+ DISMISSED = 'DISMISSED',
11
+ }
@@ -1,7 +1,7 @@
1
- /** Why the events of a bot are rejected at the Gateway. */
2
- export enum BotEventBlockReason {
3
- /** The monthly spend cap of the bot is reached. */
4
- MONTHLY_CAP = 'MONTHLY_CAP',
5
- /** The credits of the organization are spent and the bot has no overage. */
6
- CREDITS_EXHAUSTED = 'CREDITS_EXHAUSTED',
7
- }
1
+ /** Why the events of a bot are rejected at the Gateway. */
2
+ export enum BotEventBlockReason {
3
+ /** The monthly spend cap of the bot is reached. */
4
+ MONTHLY_CAP = 'MONTHLY_CAP',
5
+ /** The credits of the organization are spent and the bot has no overage. */
6
+ CREDITS_EXHAUSTED = 'CREDITS_EXHAUSTED',
7
+ }
@@ -0,0 +1,9 @@
1
+ /** Where the completion webhook of an async execution stands. */
2
+ export enum CompletionDeliveryStatus {
3
+ /** Not sent yet, or waiting for its next attempt. */
4
+ PENDING = 'PENDING',
5
+ /** The receiver answered 2xx. */
6
+ DELIVERED = 'DELIVERED',
7
+ /** Given up: every attempt failed, or the receiver answered a status that is not retried. */
8
+ FAILED = 'FAILED',
9
+ }
@@ -1,5 +1,5 @@
1
- /** How a function reads a vault key: `config.NAME` (a VISIBLE entry) or `secrets.NAME` (a SECRET entry). */
2
- export enum ConfigurationReadAs {
3
- CONFIG = 'config',
4
- SECRETS = 'secrets',
5
- }
1
+ /** How a function reads a vault key: `config.NAME` (a VISIBLE entry) or `secrets.NAME` (a SECRET entry). */
2
+ export enum ConfigurationReadAs {
3
+ CONFIG = 'config',
4
+ SECRETS = 'secrets',
5
+ }
@@ -1,9 +1,9 @@
1
- /** What the activity of a Discord bot says it does ("Playing", "Listening to", "Watching", "Competing in", or a free text). */
2
- export enum DiscordActivityType {
3
- PLAYING = 'PLAYING',
4
- LISTENING = 'LISTENING',
5
- WATCHING = 'WATCHING',
6
- COMPETING = 'COMPETING',
7
- /** The text alone, shown as it is written. */
8
- CUSTOM = 'CUSTOM',
9
- }
1
+ /** What the activity of a Discord bot says it does ("Playing", "Listening to", "Watching", "Competing in", or a free text). */
2
+ export enum DiscordActivityType {
3
+ PLAYING = 'PLAYING',
4
+ LISTENING = 'LISTENING',
5
+ WATCHING = 'WATCHING',
6
+ COMPETING = 'COMPETING',
7
+ /** The text alone, shown as it is written. */
8
+ CUSTOM = 'CUSTOM',
9
+ }
@@ -1,11 +1,11 @@
1
- /**
2
- * Type of a Discord channel a CHANNEL option may be limited to (Discord's names; the API sends their
3
- * numbers). Same set as the runtime's `DiscordChannelType`, which a parity test keeps equal.
4
- */
5
- export enum DiscordChannelType {
6
- TEXT = 'TEXT',
7
- VOICE = 'VOICE',
8
- CATEGORY = 'CATEGORY',
9
- ANNOUNCEMENT = 'ANNOUNCEMENT',
10
- FORUM = 'FORUM',
11
- }
1
+ /**
2
+ * Type of a Discord channel a CHANNEL option may be limited to (Discord's names; the API sends their
3
+ * numbers). Same set as the runtime's `DiscordChannelType`, which a parity test keeps equal.
4
+ */
5
+ export enum DiscordChannelType {
6
+ TEXT = 'TEXT',
7
+ VOICE = 'VOICE',
8
+ CATEGORY = 'CATEGORY',
9
+ ANNOUNCEMENT = 'ANNOUNCEMENT',
10
+ FORUM = 'FORUM',
11
+ }
@@ -1,7 +1,7 @@
1
- /** What a component prefix of a Discord bot routes. */
2
- export enum DiscordComponentKind {
3
- /** A button or a select menu: interactions of type MESSAGE_COMPONENT. */
4
- BUTTON_OR_SELECT = 'BUTTON_OR_SELECT',
5
- /** A form: interactions of type MODAL_SUBMIT. */
6
- MODAL = 'MODAL',
7
- }
1
+ /** What a component prefix of a Discord bot routes. */
2
+ export enum DiscordComponentKind {
3
+ /** A button or a select menu: interactions of type MESSAGE_COMPONENT. */
4
+ BUTTON_OR_SELECT = 'BUTTON_OR_SELECT',
5
+ /** A form: interactions of type MODAL_SUBMIT. */
6
+ MODAL = 'MODAL',
7
+ }