@abyss-project/reflex 6.4.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 (232) hide show
  1. package/dist/api/code-environment.api.d.ts +2 -0
  2. package/dist/api/code-environment.api.js +7 -0
  3. package/dist/api/code-environment.api.js.map +1 -0
  4. package/dist/api/index.d.ts +2 -0
  5. package/dist/api/index.js +2 -0
  6. package/dist/api/index.js.map +1 -1
  7. package/dist/api/service-template.api.d.ts +2 -0
  8. package/dist/api/service-template.api.js +7 -0
  9. package/dist/api/service-template.api.js.map +1 -0
  10. package/dist/code/index.d.ts +1 -0
  11. package/dist/code/index.js +18 -0
  12. package/dist/code/index.js.map +1 -0
  13. package/dist/code/reflex-code-declarations.d.ts +1 -0
  14. package/dist/code/reflex-code-declarations.js +644 -0
  15. package/dist/code/reflex-code-declarations.js.map +1 -0
  16. package/dist/index.d.ts +9 -0
  17. package/dist/index.js +9 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/types/enum/index.d.ts +4 -0
  20. package/dist/types/enum/index.js +4 -0
  21. package/dist/types/enum/index.js.map +1 -1
  22. package/dist/types/enum/reflex-code-diagnostic-category.enum.d.ts +6 -0
  23. package/dist/types/enum/reflex-code-diagnostic-category.enum.js +11 -0
  24. package/dist/types/enum/reflex-code-diagnostic-category.enum.js.map +1 -0
  25. package/dist/types/enum/reflex-error-code.enum.d.ts +1 -0
  26. package/dist/types/enum/reflex-error-code.enum.js +1 -0
  27. package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
  28. package/dist/types/enum/service-template-follow-up-kind.enum.d.ts +10 -0
  29. package/dist/types/enum/service-template-follow-up-kind.enum.js +15 -0
  30. package/dist/types/enum/service-template-follow-up-kind.enum.js.map +1 -0
  31. package/dist/types/enum/service-template-id.enum.d.ts +10 -0
  32. package/dist/types/enum/service-template-id.enum.js +15 -0
  33. package/dist/types/enum/service-template-id.enum.js.map +1 -0
  34. package/dist/types/enum/service-template-parameter-kind.enum.d.ts +4 -0
  35. package/dist/types/enum/service-template-parameter-kind.enum.js +9 -0
  36. package/dist/types/enum/service-template-parameter-kind.enum.js.map +1 -0
  37. package/dist/types/enum/trigger-access-mode.enum.d.ts +2 -1
  38. package/dist/types/enum/trigger-access-mode.enum.js +1 -0
  39. package/dist/types/enum/trigger-access-mode.enum.js.map +1 -1
  40. package/dist/types/interface/api/requests/code-environment.request.d.ts +3 -0
  41. package/dist/types/interface/api/requests/code-environment.request.js +3 -0
  42. package/dist/types/interface/api/requests/code-environment.request.js.map +1 -0
  43. package/dist/types/interface/api/requests/index.d.ts +2 -0
  44. package/dist/types/interface/api/requests/index.js +2 -0
  45. package/dist/types/interface/api/requests/index.js.map +1 -1
  46. package/dist/types/interface/api/requests/service-template.request.d.ts +3 -0
  47. package/dist/types/interface/api/requests/service-template.request.js +3 -0
  48. package/dist/types/interface/api/requests/service-template.request.js.map +1 -0
  49. package/dist/types/interface/api/requests/service.request.d.ts +2 -1
  50. package/dist/types/interface/api/responses/code-environment.response.d.ts +6 -0
  51. package/dist/types/interface/api/responses/code-environment.response.js +3 -0
  52. package/dist/types/interface/api/responses/code-environment.response.js.map +1 -0
  53. package/dist/types/interface/api/responses/index.d.ts +2 -0
  54. package/dist/types/interface/api/responses/index.js +2 -0
  55. package/dist/types/interface/api/responses/index.js.map +1 -1
  56. package/dist/types/interface/api/responses/service-template.response.d.ts +6 -0
  57. package/dist/types/interface/api/responses/service-template.response.js +3 -0
  58. package/dist/types/interface/api/responses/service-template.response.js.map +1 -0
  59. package/dist/types/interface/models/index.d.ts +3 -0
  60. package/dist/types/interface/models/index.js +3 -0
  61. package/dist/types/interface/models/index.js.map +1 -1
  62. package/dist/types/interface/models/reflex-code-diagnostic.model.d.ts +10 -0
  63. package/dist/types/interface/models/reflex-code-diagnostic.model.js +5 -0
  64. package/dist/types/interface/models/reflex-code-diagnostic.model.js.map +1 -0
  65. package/dist/types/interface/models/reflex-code-environment.model.d.ts +9 -0
  66. package/dist/types/interface/models/reflex-code-environment.model.js +3 -0
  67. package/dist/types/interface/models/reflex-code-environment.model.js.map +1 -0
  68. package/dist/types/interface/models/reflex-service-template.model.d.ts +33 -0
  69. package/dist/types/interface/models/reflex-service-template.model.js +3 -0
  70. package/dist/types/interface/models/reflex-service-template.model.js.map +1 -0
  71. package/package.json +1 -1
  72. package/src/api/application-run-settings.api.test.ts +62 -62
  73. package/src/api/code-environment.api.ts +15 -0
  74. package/src/api/function-run.api.ts +53 -53
  75. package/src/api/function-settings.api.ts +96 -96
  76. package/src/api/function.api.test.ts +346 -346
  77. package/src/api/index.ts +2 -0
  78. package/src/api/service-route.api.ts +74 -74
  79. package/src/api/service-template.api.test.ts +41 -0
  80. package/src/api/service-template.api.ts +12 -0
  81. package/src/api/service.api.test.ts +220 -220
  82. package/src/api/storage-surplus.admin.api.test.ts +66 -66
  83. package/src/api/storage-surplus.admin.api.ts +45 -45
  84. package/src/code/index.ts +1 -0
  85. package/src/code/reflex-code-declarations.ts +646 -0
  86. package/src/index.ts +497 -480
  87. package/src/types/enum/access-grant-status.enum.ts +12 -12
  88. package/src/types/enum/access-kind.enum.ts +7 -7
  89. package/src/types/enum/access-request-status.enum.ts +11 -11
  90. package/src/types/enum/bot-event-block-reason.enum.ts +7 -7
  91. package/src/types/enum/completion-delivery-status.enum.ts +9 -9
  92. package/src/types/enum/configuration-read-as.enum.ts +5 -5
  93. package/src/types/enum/discord-activity-type.enum.ts +9 -9
  94. package/src/types/enum/discord-channel-type.enum.ts +11 -11
  95. package/src/types/enum/discord-component-kind.enum.ts +7 -7
  96. package/src/types/enum/discord-event-drop-reason.enum.ts +13 -13
  97. package/src/types/enum/discord-event-filter-name.enum.ts +11 -11
  98. package/src/types/enum/discord-event-status.enum.ts +13 -13
  99. package/src/types/enum/discord-event-type.enum.ts +7 -7
  100. package/src/types/enum/discord-gateway-failure-code.enum.ts +11 -11
  101. package/src/types/enum/discord-gateway-state.enum.ts +11 -11
  102. package/src/types/enum/discord-locale.enum.ts +35 -35
  103. package/src/types/enum/discord-option-type.enum.ts +12 -12
  104. package/src/types/enum/discord-presence-status.enum.ts +8 -8
  105. package/src/types/enum/discord-sync-status.enum.ts +6 -6
  106. package/src/types/enum/discord-token-state.enum.ts +11 -11
  107. package/src/types/enum/execution-mode.enum.ts +9 -9
  108. package/src/types/enum/execution-profile.enum.ts +20 -20
  109. package/src/types/enum/execution-settings-source.enum.ts +9 -9
  110. package/src/types/enum/health-status.enum.ts +4 -4
  111. package/src/types/enum/index.ts +55 -51
  112. package/src/types/enum/insights-period.enum.ts +8 -8
  113. package/src/types/enum/log-cap-mode.enum.ts +6 -6
  114. package/src/types/enum/log-drop-cause.enum.ts +8 -8
  115. package/src/types/enum/reflex-alert-metric.enum.ts +5 -5
  116. package/src/types/enum/reflex-alert-notification-state.enum.ts +6 -6
  117. package/src/types/enum/reflex-alert-scope.enum.ts +6 -6
  118. package/src/types/enum/reflex-code-diagnostic-category.enum.ts +11 -0
  119. package/src/types/enum/reflex-error-code.enum.ts +93 -88
  120. package/src/types/enum/route-method.enum.ts +9 -9
  121. package/src/types/enum/run-log-level.enum.ts +6 -6
  122. package/src/types/enum/run-mode.enum.ts +11 -11
  123. package/src/types/enum/run-status.enum.ts +16 -16
  124. package/src/types/enum/run-step-status.enum.ts +7 -7
  125. package/src/types/enum/schedule-sync-status.enum.ts +6 -6
  126. package/src/types/enum/scheduled-run-failure-code.enum.ts +14 -14
  127. package/src/types/enum/scheduled-run-origin.enum.ts +5 -5
  128. package/src/types/enum/scheduled-run-status.enum.ts +17 -17
  129. package/src/types/enum/service-block-reason.enum.ts +13 -13
  130. package/src/types/enum/service-deployment-action.enum.ts +11 -11
  131. package/src/types/enum/service-deployment-status.enum.ts +5 -5
  132. package/src/types/enum/service-template-follow-up-kind.enum.ts +19 -0
  133. package/src/types/enum/service-template-id.enum.ts +19 -0
  134. package/src/types/enum/service-template-parameter-kind.enum.ts +7 -0
  135. package/src/types/enum/service-type.enum.ts +9 -9
  136. package/src/types/enum/service-version-change-kind.enum.ts +6 -6
  137. package/src/types/enum/trace-effect-type.enum.ts +12 -12
  138. package/src/types/enum/trigger-access-mode.enum.ts +4 -0
  139. package/src/types/enum/trigger-kind.enum.ts +8 -8
  140. package/src/types/enum/vault-value-source.enum.ts +12 -12
  141. package/src/types/enum/vault-visibility.enum.ts +5 -5
  142. package/src/types/index.ts +2 -2
  143. package/src/types/interface/api/index.ts +3 -3
  144. package/src/types/interface/api/requests/alert-rule.request.ts +53 -53
  145. package/src/types/interface/api/requests/application-insights.request.ts +18 -18
  146. package/src/types/interface/api/requests/application-run-settings.request.ts +13 -13
  147. package/src/types/interface/api/requests/code-environment.request.ts +3 -0
  148. package/src/types/interface/api/requests/function-access.request.ts +51 -51
  149. package/src/types/interface/api/requests/function-run.request.ts +42 -42
  150. package/src/types/interface/api/requests/function-settings.request.ts +50 -50
  151. package/src/types/interface/api/requests/function-template.request.ts +29 -29
  152. package/src/types/interface/api/requests/function-test.request.ts +44 -44
  153. package/src/types/interface/api/requests/function-version.request.ts +38 -38
  154. package/src/types/interface/api/requests/function.request.ts +36 -36
  155. package/src/types/interface/api/requests/index.ts +27 -25
  156. package/src/types/interface/api/requests/route-stats.request.ts +22 -22
  157. package/src/types/interface/api/requests/service-completion-webhook.request.ts +11 -11
  158. package/src/types/interface/api/requests/service-configuration.request.ts +4 -4
  159. package/src/types/interface/api/requests/service-consumer.request.ts +51 -51
  160. package/src/types/interface/api/requests/service-deployment.request.ts +49 -49
  161. package/src/types/interface/api/requests/service-discord-event.request.ts +68 -68
  162. package/src/types/interface/api/requests/service-insights.request.ts +31 -31
  163. package/src/types/interface/api/requests/service-limits.request.ts +28 -28
  164. package/src/types/interface/api/requests/service-openapi.request.ts +10 -10
  165. package/src/types/interface/api/requests/service-route.request.ts +52 -52
  166. package/src/types/interface/api/requests/service-task.request.ts +80 -80
  167. package/src/types/interface/api/requests/service-template.request.ts +3 -0
  168. package/src/types/interface/api/requests/service-version.request.ts +24 -24
  169. package/src/types/interface/api/requests/service.request.ts +54 -48
  170. package/src/types/interface/api/requests/storage-surplus.admin.request.ts +12 -12
  171. package/src/types/interface/api/response.ts +4 -4
  172. package/src/types/interface/api/responses/alert-rule.response.ts +24 -24
  173. package/src/types/interface/api/responses/application-insights.response.ts +11 -11
  174. package/src/types/interface/api/responses/application-run-settings.response.ts +8 -8
  175. package/src/types/interface/api/responses/code-environment.response.ts +7 -0
  176. package/src/types/interface/api/responses/function-access.response.ts +45 -45
  177. package/src/types/interface/api/responses/function-run.response.ts +23 -23
  178. package/src/types/interface/api/responses/function-settings.response.ts +57 -57
  179. package/src/types/interface/api/responses/function-template.response.ts +21 -21
  180. package/src/types/interface/api/responses/function-test.response.ts +19 -19
  181. package/src/types/interface/api/responses/function-version.response.ts +42 -42
  182. package/src/types/interface/api/responses/function.response.ts +25 -25
  183. package/src/types/interface/api/responses/index.ts +27 -25
  184. package/src/types/interface/api/responses/route-stats.response.ts +15 -15
  185. package/src/types/interface/api/responses/service-completion-webhook.response.ts +13 -13
  186. package/src/types/interface/api/responses/service-configuration.response.ts +8 -8
  187. package/src/types/interface/api/responses/service-consumer.response.ts +33 -33
  188. package/src/types/interface/api/responses/service-deployment.response.ts +32 -32
  189. package/src/types/interface/api/responses/service-discord-event.response.ts +24 -24
  190. package/src/types/interface/api/responses/service-discord.response.ts +110 -110
  191. package/src/types/interface/api/responses/service-insights.response.ts +11 -11
  192. package/src/types/interface/api/responses/service-limits.response.ts +13 -13
  193. package/src/types/interface/api/responses/service-openapi.response.ts +7 -7
  194. package/src/types/interface/api/responses/service-route.response.ts +2 -2
  195. package/src/types/interface/api/responses/service-task.response.ts +57 -57
  196. package/src/types/interface/api/responses/service-template.response.ts +8 -0
  197. package/src/types/interface/api/responses/service-version.response.ts +112 -112
  198. package/src/types/interface/api/responses/service.response.ts +31 -31
  199. package/src/types/interface/api/responses/storage-surplus.admin.response.ts +10 -10
  200. package/src/types/interface/health.response.ts +7 -7
  201. package/src/types/interface/index.ts +3 -3
  202. package/src/types/interface/models/index.ts +32 -29
  203. package/src/types/interface/models/reflex-access-grant.model.ts +14 -14
  204. package/src/types/interface/models/reflex-access-request.model.ts +15 -15
  205. package/src/types/interface/models/reflex-alert-rule.model.ts +56 -56
  206. package/src/types/interface/models/reflex-bot-limits.model.ts +53 -53
  207. package/src/types/interface/models/reflex-code-diagnostic.model.ts +15 -0
  208. package/src/types/interface/models/reflex-code-environment.model.ts +17 -0
  209. package/src/types/interface/models/reflex-completion-webhook.model.ts +111 -111
  210. package/src/types/interface/models/reflex-consumer.model.ts +50 -50
  211. package/src/types/interface/models/reflex-definition.model.ts +31 -31
  212. package/src/types/interface/models/reflex-discord-event-log.model.ts +58 -58
  213. package/src/types/interface/models/reflex-discord-event.model.ts +79 -79
  214. package/src/types/interface/models/reflex-execution-settings.model.ts +57 -57
  215. package/src/types/interface/models/reflex-function-template.model.ts +18 -18
  216. package/src/types/interface/models/reflex-function-version.model.ts +19 -19
  217. package/src/types/interface/models/reflex-function.model.ts +30 -30
  218. package/src/types/interface/models/reflex-insights.model.ts +215 -215
  219. package/src/types/interface/models/reflex-route-contract.model.ts +46 -46
  220. package/src/types/interface/models/reflex-route.model.ts +23 -23
  221. package/src/types/interface/models/reflex-run-retention.model.ts +24 -24
  222. package/src/types/interface/models/reflex-run-settings.model.ts +39 -39
  223. package/src/types/interface/models/reflex-run.model.ts +309 -309
  224. package/src/types/interface/models/reflex-service-configuration.model.ts +22 -22
  225. package/src/types/interface/models/reflex-service-deployment.model.ts +48 -48
  226. package/src/types/interface/models/reflex-service-limits.model.ts +92 -92
  227. package/src/types/interface/models/reflex-service-template.model.ts +55 -0
  228. package/src/types/interface/models/reflex-service-version.model.ts +64 -64
  229. package/src/types/interface/models/reflex-service.model.ts +47 -47
  230. package/src/types/interface/models/reflex-step-stats.model.ts +35 -35
  231. package/src/types/interface/models/reflex-storage-surplus.model.ts +23 -23
  232. package/src/types/interface/models/reflex-task.model.ts +97 -97
@@ -1,215 +1,215 @@
1
- import { InsightsPeriod } from '../../enum';
2
- import type { TriggerKind } from '../../enum';
3
-
4
- /** The width of one point of a dashboard, by period. */
5
- export const REFLEX_INSIGHTS_PERIOD_STEP_SECONDS: Record<InsightsPeriod, number> = {
6
- [InsightsPeriod.HOUR_1]: 60,
7
- [InsightsPeriod.HOURS_24]: 300,
8
- [InsightsPeriod.DAYS_7]: 3600,
9
- [InsightsPeriod.DAYS_30]: 21600,
10
- [InsightsPeriod.DAYS_90]: 86400,
11
- };
12
-
13
- /** Upper bounds, in thousandths of a credit, of the cost histogram buckets; one open bucket follows (10 in all). */
14
- export const REFLEX_COST_HISTOGRAM_UPPER_BOUNDS = [
15
- 10, 25, 50, 100, 250, 500, 1000, 2500, 5000,
16
- ] as const;
17
-
18
- /**
19
- * Upper bounds, in milliseconds, of the duration histogram buckets of the run rollups; one open bucket follows
20
- * (15 in all).
21
- */
22
- export const DURATION_HISTOGRAM_BOUNDS_MS = [
23
- 10, 25, 50, 100, 200, 300, 500, 750, 1000, 1500, 2500, 5000, 10000, 30000,
24
- ] as const;
25
-
26
- /** A trigger is labeled heavy past this multiple of the median cost per run of the Service. */
27
- export const REFLEX_HEAVY_TRIGGER_FACTOR = 5;
28
-
29
- /** A value over the period and over the one just before it; `previous` is null without data before. */
30
- export interface IReflexInsightsTile {
31
- value: number;
32
- previous: number | null;
33
- }
34
-
35
- export interface IReflexInsightsTiles {
36
- runs: IReflexInsightsTile;
37
- failed: IReflexInsightsTile;
38
- cpuMs: IReflexInsightsTile;
39
- heapPeakBytesMax: IReflexInsightsTile;
40
- netBytes: IReflexInsightsTile;
41
- costMillicredits: IReflexInsightsTile;
42
- }
43
-
44
- /** One point of the series; `at` is the start of its step. */
45
- export interface IReflexInsightsPoint {
46
- at: Date;
47
- runs: number;
48
- failed: number;
49
- durationMsSum: number;
50
- cpuMsSum: number;
51
- netInBytes: number;
52
- netOutBytes: number;
53
- costMillicredits: number;
54
- /** Mean cost of a run, in thousandths of a credit; null when no run. */
55
- costMeanMillicredits: number | null;
56
- /** 95th percentile of the cost of a run: upper bound of the histogram bucket holding it; null when no run. */
57
- costP95Millicredits: number | null;
58
- }
59
-
60
- /** Runs of one kind of trigger, over the period. */
61
- export interface IReflexInsightsKindShare {
62
- kind: TriggerKind;
63
- runs: number;
64
- failed: number;
65
- }
66
-
67
- /** One row of the ranking of the triggers. */
68
- export interface IReflexInsightsRankingRow {
69
- kind: TriggerKind;
70
- triggerId: string;
71
- /** `/name`, `METHOD path`, a prefix or a name; null when the trigger was deleted. */
72
- label: string | null;
73
- runs: number;
74
- failed: number;
75
- costMillicreditsTotal: number;
76
- costMillicreditsPerRun: number;
77
- cpuMsMean: number;
78
- durationMsMean: number;
79
- /** Cost per run past `REFLEX_HEAVY_TRIGGER_FACTOR` times the median of the Service. */
80
- heavy: boolean;
81
- }
82
-
83
- /** The dashboard of a Service or of a function. */
84
- export interface IReflexInsights {
85
- period: InsightsPeriod;
86
- from: Date;
87
- to: Date;
88
- stepSeconds: number;
89
- tiles: IReflexInsightsTiles;
90
- series: IReflexInsightsPoint[];
91
- byKind: IReflexInsightsKindShare[];
92
- /** Top 10 of the triggers, by total credits; the screen sorts the rows it holds. */
93
- ranking: IReflexInsightsRankingRow[];
94
- }
95
-
96
- /** Events received by the Gateway in one step, with the reason of each one it did not keep. */
97
- export interface IReflexEventInsightsPoint {
98
- at: Date;
99
- received: number;
100
- queued: number;
101
- executed: number;
102
- failed: number;
103
- duplicates: number;
104
- filtered: number;
105
- droppedRate: number;
106
- droppedMonthlyCap: number;
107
- droppedCredits: number;
108
- expired: number;
109
- /** Events rejected by each filter, by filter name. */
110
- filteredBy: Record<string, number>;
111
- }
112
-
113
- /** The dashboard of the events of a bot. */
114
- export interface IReflexEventInsights {
115
- period: InsightsPeriod;
116
- from: Date;
117
- to: Date;
118
- stepSeconds: number;
119
- series: IReflexEventInsightsPoint[];
120
- /** The rate of the bot, for the rate line. */
121
- eventsPerMinute: number;
122
- peakPerMinute: number;
123
- minutesAtCap: number;
124
- /** Credits of the month and the spend of the month against the cap. */
125
- creditsMonthMillicredits: number;
126
- spendCents: number;
127
- monthlySpendCapCents: number;
128
- }
129
-
130
- /**
131
- * A percentile of a duration read on a histogram: the upper bound of the bucket holding it. `open` when it falls in
132
- * the open bucket: the duration is then past `upperBoundMs` (the last bound), shown "> 30 s".
133
- */
134
- export interface IReflexDurationPercentile {
135
- upperBoundMs: number;
136
- open: boolean;
137
- }
138
-
139
- /** The requests of a route or a Service by class of HTTP status. */
140
- export interface IReflexHttpClasses {
141
- http2xx: number;
142
- http3xx: number;
143
- http4xx: number;
144
- http5xx: number;
145
- }
146
-
147
- /** One point of the short series of a route. */
148
- export interface IReflexRouteStatsPoint {
149
- at: Date;
150
- runs: number;
151
- failed: number;
152
- }
153
-
154
- /** One row of the statistics of the routes of a Service. */
155
- export interface IReflexRouteStatsRow extends IReflexHttpClasses {
156
- routeId: string;
157
- /** `METHOD path`; null when the route was deleted. */
158
- label: string | null;
159
- runs: number;
160
- failed: number;
161
- /** Null when no run of the period has a duration in the histogram. */
162
- p50: IReflexDurationPercentile | null;
163
- p95: IReflexDurationPercentile | null;
164
- p99: IReflexDurationPercentile | null;
165
- series: IReflexRouteStatsPoint[];
166
- }
167
-
168
- /** One point of the dashboard of a route. */
169
- export interface IReflexRouteInsightsPoint extends IReflexHttpClasses {
170
- at: Date;
171
- runs: number;
172
- failed: number;
173
- p50: IReflexDurationPercentile | null;
174
- p95: IReflexDurationPercentile | null;
175
- p99: IReflexDurationPercentile | null;
176
- }
177
-
178
- /** The dashboard of a route. */
179
- export interface IReflexRouteInsights {
180
- period: InsightsPeriod;
181
- from: Date;
182
- to: Date;
183
- stepSeconds: number;
184
- series: IReflexRouteInsightsPoint[];
185
- }
186
-
187
- /** Runs of one Service over the period. */
188
- export interface IReflexApplicationServiceShare {
189
- serviceId: string;
190
- runs: number;
191
- failed: number;
192
- costMillicredits: number;
193
- }
194
-
195
- /** The overview of an application: every Service together. */
196
- export interface IReflexApplicationInsights {
197
- period: InsightsPeriod;
198
- from: Date;
199
- to: Date;
200
- stepSeconds: number;
201
- tiles: IReflexInsightsTiles;
202
- series: IReflexInsightsPoint[];
203
- byService: IReflexApplicationServiceShare[];
204
- /** Top 10 of the triggers of the application, by total credits. */
205
- ranking: IReflexInsightsRankingRow[];
206
- }
207
-
208
- /** One day of the calendar of an application. */
209
- export interface IReflexCalendarDay {
210
- /** The day in UTC, `YYYY-MM-DD`. */
211
- day: string;
212
- runs: number;
213
- failed: number;
214
- millicredits: number;
215
- }
1
+ import { InsightsPeriod } from '../../enum';
2
+ import type { TriggerKind } from '../../enum';
3
+
4
+ /** The width of one point of a dashboard, by period. */
5
+ export const REFLEX_INSIGHTS_PERIOD_STEP_SECONDS: Record<InsightsPeriod, number> = {
6
+ [InsightsPeriod.HOUR_1]: 60,
7
+ [InsightsPeriod.HOURS_24]: 300,
8
+ [InsightsPeriod.DAYS_7]: 3600,
9
+ [InsightsPeriod.DAYS_30]: 21600,
10
+ [InsightsPeriod.DAYS_90]: 86400,
11
+ };
12
+
13
+ /** Upper bounds, in thousandths of a credit, of the cost histogram buckets; one open bucket follows (10 in all). */
14
+ export const REFLEX_COST_HISTOGRAM_UPPER_BOUNDS = [
15
+ 10, 25, 50, 100, 250, 500, 1000, 2500, 5000,
16
+ ] as const;
17
+
18
+ /**
19
+ * Upper bounds, in milliseconds, of the duration histogram buckets of the run rollups; one open bucket follows
20
+ * (15 in all).
21
+ */
22
+ export const DURATION_HISTOGRAM_BOUNDS_MS = [
23
+ 10, 25, 50, 100, 200, 300, 500, 750, 1000, 1500, 2500, 5000, 10000, 30000,
24
+ ] as const;
25
+
26
+ /** A trigger is labeled heavy past this multiple of the median cost per run of the Service. */
27
+ export const REFLEX_HEAVY_TRIGGER_FACTOR = 5;
28
+
29
+ /** A value over the period and over the one just before it; `previous` is null without data before. */
30
+ export interface IReflexInsightsTile {
31
+ value: number;
32
+ previous: number | null;
33
+ }
34
+
35
+ export interface IReflexInsightsTiles {
36
+ runs: IReflexInsightsTile;
37
+ failed: IReflexInsightsTile;
38
+ cpuMs: IReflexInsightsTile;
39
+ heapPeakBytesMax: IReflexInsightsTile;
40
+ netBytes: IReflexInsightsTile;
41
+ costMillicredits: IReflexInsightsTile;
42
+ }
43
+
44
+ /** One point of the series; `at` is the start of its step. */
45
+ export interface IReflexInsightsPoint {
46
+ at: Date;
47
+ runs: number;
48
+ failed: number;
49
+ durationMsSum: number;
50
+ cpuMsSum: number;
51
+ netInBytes: number;
52
+ netOutBytes: number;
53
+ costMillicredits: number;
54
+ /** Mean cost of a run, in thousandths of a credit; null when no run. */
55
+ costMeanMillicredits: number | null;
56
+ /** 95th percentile of the cost of a run: upper bound of the histogram bucket holding it; null when no run. */
57
+ costP95Millicredits: number | null;
58
+ }
59
+
60
+ /** Runs of one kind of trigger, over the period. */
61
+ export interface IReflexInsightsKindShare {
62
+ kind: TriggerKind;
63
+ runs: number;
64
+ failed: number;
65
+ }
66
+
67
+ /** One row of the ranking of the triggers. */
68
+ export interface IReflexInsightsRankingRow {
69
+ kind: TriggerKind;
70
+ triggerId: string;
71
+ /** `/name`, `METHOD path`, a prefix or a name; null when the trigger was deleted. */
72
+ label: string | null;
73
+ runs: number;
74
+ failed: number;
75
+ costMillicreditsTotal: number;
76
+ costMillicreditsPerRun: number;
77
+ cpuMsMean: number;
78
+ durationMsMean: number;
79
+ /** Cost per run past `REFLEX_HEAVY_TRIGGER_FACTOR` times the median of the Service. */
80
+ heavy: boolean;
81
+ }
82
+
83
+ /** The dashboard of a Service or of a function. */
84
+ export interface IReflexInsights {
85
+ period: InsightsPeriod;
86
+ from: Date;
87
+ to: Date;
88
+ stepSeconds: number;
89
+ tiles: IReflexInsightsTiles;
90
+ series: IReflexInsightsPoint[];
91
+ byKind: IReflexInsightsKindShare[];
92
+ /** Top 10 of the triggers, by total credits; the screen sorts the rows it holds. */
93
+ ranking: IReflexInsightsRankingRow[];
94
+ }
95
+
96
+ /** Events received by the Gateway in one step, with the reason of each one it did not keep. */
97
+ export interface IReflexEventInsightsPoint {
98
+ at: Date;
99
+ received: number;
100
+ queued: number;
101
+ executed: number;
102
+ failed: number;
103
+ duplicates: number;
104
+ filtered: number;
105
+ droppedRate: number;
106
+ droppedMonthlyCap: number;
107
+ droppedCredits: number;
108
+ expired: number;
109
+ /** Events rejected by each filter, by filter name. */
110
+ filteredBy: Record<string, number>;
111
+ }
112
+
113
+ /** The dashboard of the events of a bot. */
114
+ export interface IReflexEventInsights {
115
+ period: InsightsPeriod;
116
+ from: Date;
117
+ to: Date;
118
+ stepSeconds: number;
119
+ series: IReflexEventInsightsPoint[];
120
+ /** The rate of the bot, for the rate line. */
121
+ eventsPerMinute: number;
122
+ peakPerMinute: number;
123
+ minutesAtCap: number;
124
+ /** Credits of the month and the spend of the month against the cap. */
125
+ creditsMonthMillicredits: number;
126
+ spendCents: number;
127
+ monthlySpendCapCents: number;
128
+ }
129
+
130
+ /**
131
+ * A percentile of a duration read on a histogram: the upper bound of the bucket holding it. `open` when it falls in
132
+ * the open bucket: the duration is then past `upperBoundMs` (the last bound), shown "> 30 s".
133
+ */
134
+ export interface IReflexDurationPercentile {
135
+ upperBoundMs: number;
136
+ open: boolean;
137
+ }
138
+
139
+ /** The requests of a route or a Service by class of HTTP status. */
140
+ export interface IReflexHttpClasses {
141
+ http2xx: number;
142
+ http3xx: number;
143
+ http4xx: number;
144
+ http5xx: number;
145
+ }
146
+
147
+ /** One point of the short series of a route. */
148
+ export interface IReflexRouteStatsPoint {
149
+ at: Date;
150
+ runs: number;
151
+ failed: number;
152
+ }
153
+
154
+ /** One row of the statistics of the routes of a Service. */
155
+ export interface IReflexRouteStatsRow extends IReflexHttpClasses {
156
+ routeId: string;
157
+ /** `METHOD path`; null when the route was deleted. */
158
+ label: string | null;
159
+ runs: number;
160
+ failed: number;
161
+ /** Null when no run of the period has a duration in the histogram. */
162
+ p50: IReflexDurationPercentile | null;
163
+ p95: IReflexDurationPercentile | null;
164
+ p99: IReflexDurationPercentile | null;
165
+ series: IReflexRouteStatsPoint[];
166
+ }
167
+
168
+ /** One point of the dashboard of a route. */
169
+ export interface IReflexRouteInsightsPoint extends IReflexHttpClasses {
170
+ at: Date;
171
+ runs: number;
172
+ failed: number;
173
+ p50: IReflexDurationPercentile | null;
174
+ p95: IReflexDurationPercentile | null;
175
+ p99: IReflexDurationPercentile | null;
176
+ }
177
+
178
+ /** The dashboard of a route. */
179
+ export interface IReflexRouteInsights {
180
+ period: InsightsPeriod;
181
+ from: Date;
182
+ to: Date;
183
+ stepSeconds: number;
184
+ series: IReflexRouteInsightsPoint[];
185
+ }
186
+
187
+ /** Runs of one Service over the period. */
188
+ export interface IReflexApplicationServiceShare {
189
+ serviceId: string;
190
+ runs: number;
191
+ failed: number;
192
+ costMillicredits: number;
193
+ }
194
+
195
+ /** The overview of an application: every Service together. */
196
+ export interface IReflexApplicationInsights {
197
+ period: InsightsPeriod;
198
+ from: Date;
199
+ to: Date;
200
+ stepSeconds: number;
201
+ tiles: IReflexInsightsTiles;
202
+ series: IReflexInsightsPoint[];
203
+ byService: IReflexApplicationServiceShare[];
204
+ /** Top 10 of the triggers of the application, by total credits. */
205
+ ranking: IReflexInsightsRankingRow[];
206
+ }
207
+
208
+ /** One day of the calendar of an application. */
209
+ export interface IReflexCalendarDay {
210
+ /** The day in UTC, `YYYY-MM-DD`. */
211
+ day: string;
212
+ runs: number;
213
+ failed: number;
214
+ millicredits: number;
215
+ }
@@ -1,46 +1,46 @@
1
- /**
2
- * A JSON Schema of the 2020-12 dialect. Only internal references (`#/$defs/...`) are accepted; `$id`,
3
- * `$dynamicRef` and a `$schema` of another dialect are refused.
4
- */
5
- export interface IReflexJsonSchema {
6
- [keyword: string]: unknown;
7
- }
8
-
9
- /**
10
- * What a route accepts and answers. The edge validates `requestBody` and `query` before anything runs
11
- * (`422 REQUEST_INVALID`); `responses` only document the route, and the Tester warns on a response out of them.
12
- * Frozen by the version of the Service.
13
- */
14
- export interface IReflexRouteContract {
15
- /** The body of the request. */
16
- requestBody?: IReflexJsonSchema;
17
- /** The query of the request: an `object` schema whose every property is a `string` schema. */
18
- query?: IReflexJsonSchema;
19
- /** One schema per HTTP status, keyed `"100"` to `"599"`. */
20
- responses?: Record<string, IReflexJsonSchema>;
21
- /** `REFLEX_CONTRACT_LIMITS.descriptionMaxLength` characters at most. */
22
- description?: string;
23
- }
24
-
25
- /** One fault of a contract (`CONTRACT_INVALID`) or of a request against it (`REQUEST_INVALID`). */
26
- export interface IReflexContractError {
27
- /** JSON pointer of the fault, `/items/0/name` for example; empty for the root. */
28
- path: string;
29
- message: string;
30
- }
31
-
32
- /** Bounds of a contract, checked by the API when the route is saved. */
33
- export const REFLEX_CONTRACT_LIMITS = {
34
- /** Bytes of the UTF-8 JSON of the whole contract. */
35
- maxBytes: 32_768,
36
- /** Nesting levels of a schema. */
37
- maxDepth: 32,
38
- /** Characters of a `pattern`, or of a key of `patternProperties`. */
39
- patternMaxLength: 256,
40
- descriptionMaxLength: 500,
41
- /** Faults a refusal returns, at most. */
42
- maxErrors: 20,
43
- /** Bounds of the keys of `responses`. */
44
- statusMin: 100,
45
- statusMax: 599,
46
- } as const;
1
+ /**
2
+ * A JSON Schema of the 2020-12 dialect. Only internal references (`#/$defs/...`) are accepted; `$id`,
3
+ * `$dynamicRef` and a `$schema` of another dialect are refused.
4
+ */
5
+ export interface IReflexJsonSchema {
6
+ [keyword: string]: unknown;
7
+ }
8
+
9
+ /**
10
+ * What a route accepts and answers. The edge validates `requestBody` and `query` before anything runs
11
+ * (`422 REQUEST_INVALID`); `responses` only document the route, and the Tester warns on a response out of them.
12
+ * Frozen by the version of the Service.
13
+ */
14
+ export interface IReflexRouteContract {
15
+ /** The body of the request. */
16
+ requestBody?: IReflexJsonSchema;
17
+ /** The query of the request: an `object` schema whose every property is a `string` schema. */
18
+ query?: IReflexJsonSchema;
19
+ /** One schema per HTTP status, keyed `"100"` to `"599"`. */
20
+ responses?: Record<string, IReflexJsonSchema>;
21
+ /** `REFLEX_CONTRACT_LIMITS.descriptionMaxLength` characters at most. */
22
+ description?: string;
23
+ }
24
+
25
+ /** One fault of a contract (`CONTRACT_INVALID`) or of a request against it (`REQUEST_INVALID`). */
26
+ export interface IReflexContractError {
27
+ /** JSON pointer of the fault, `/items/0/name` for example; empty for the root. */
28
+ path: string;
29
+ message: string;
30
+ }
31
+
32
+ /** Bounds of a contract, checked by the API when the route is saved. */
33
+ export const REFLEX_CONTRACT_LIMITS = {
34
+ /** Bytes of the UTF-8 JSON of the whole contract. */
35
+ maxBytes: 32_768,
36
+ /** Nesting levels of a schema. */
37
+ maxDepth: 32,
38
+ /** Characters of a `pattern`, or of a key of `patternProperties`. */
39
+ patternMaxLength: 256,
40
+ descriptionMaxLength: 500,
41
+ /** Faults a refusal returns, at most. */
42
+ maxErrors: 20,
43
+ /** Bounds of the keys of `responses`. */
44
+ statusMin: 100,
45
+ statusMax: 599,
46
+ } as const;
@@ -1,23 +1,23 @@
1
- import type { RouteMethod, TriggerAccessMode } from '../../enum';
2
- import type { IReflexRouteContract } from './reflex-route-contract.model';
3
-
4
- /**
5
- * A route of the draft of a Service: callable only once a version that holds it is in service in the
6
- * environment. Never carries the signing secret: it is shown once, when created or rotated. An `API_KEY` route
7
- * is called with the key of a consumer (`IReflexConsumer`).
8
- */
9
- export interface IReflexRoute {
10
- id: string;
11
- serviceId: string;
12
- /** A function of the same Service. */
13
- functionId: string;
14
- method: RouteMethod;
15
- /** Segments of `[a-z0-9._~-]` or `:param` joined by `/`, without leading or trailing slash; 20 at most. */
16
- path: string;
17
- accessMode: TriggerAccessMode;
18
- /** What the route accepts and answers; null for a route without contract, which the edge does not validate. */
19
- contract: IReflexRouteContract | null;
20
- createdByUserId: string;
21
- createdAt: Date;
22
- updatedAt: Date;
23
- }
1
+ import type { RouteMethod, TriggerAccessMode } from '../../enum';
2
+ import type { IReflexRouteContract } from './reflex-route-contract.model';
3
+
4
+ /**
5
+ * A route of the draft of a Service: callable only once a version that holds it is in service in the
6
+ * environment. Never carries the signing secret: it is shown once, when created or rotated. An `API_KEY` route
7
+ * is called with the key of a consumer (`IReflexConsumer`).
8
+ */
9
+ export interface IReflexRoute {
10
+ id: string;
11
+ serviceId: string;
12
+ /** A function of the same Service. */
13
+ functionId: string;
14
+ method: RouteMethod;
15
+ /** Segments of `[a-z0-9._~-]` or `:param` joined by `/`, without leading or trailing slash; 20 at most. */
16
+ path: string;
17
+ accessMode: TriggerAccessMode;
18
+ /** What the route accepts and answers; null for a route without contract, which the edge does not validate. */
19
+ contract: IReflexRouteContract | null;
20
+ createdByUserId: string;
21
+ createdAt: Date;
22
+ updatedAt: Date;
23
+ }
@@ -1,24 +1,24 @@
1
- /**
2
- * The retention tiers of the runs a customer may choose, in days (AbyssReflex L3a, #893). The plan's retention is
3
- * the default; a tier is chosen per application, and per function over it. Same list as the database CHECKs.
4
- */
5
- export const REFLEX_RUN_RETENTION_TIER_DAYS = [3, 7, 15, 30, 90, 180, 365] as const;
6
-
7
- /** Bounds of the number of versions the purge keeps, per function and per Service. */
8
- export const REFLEX_VERSIONS_KEPT = { default: 20, min: 5, max: 100 } as const;
9
-
10
- /** The detail of a run (detail, steps, log lines) moves to the archive past this age, in days, when its tier allows it. */
11
- export const REFLEX_RUN_ARCHIVE_AFTER_DAYS = 30;
12
-
13
- /** The runs of a tier under this number of days are never archived: they are purged before they would be. */
14
- export const REFLEX_RUN_ARCHIVE_MIN_TIER_DAYS = 90;
15
-
16
- /** The run retention of a function: its own tier, the one it inherits, and how many versions are kept. */
17
- export interface IReflexFunctionRunRetention {
18
- /** The tier of the function itself, one of `REFLEX_RUN_RETENTION_TIER_DAYS`; null follows the application. */
19
- runRetentionDays: number | null;
20
- /** The tier the function follows when it has none: the application's, else null for the plan's retention. Read only. */
21
- inheritedDays: number | null;
22
- /** How many versions of the function the purge keeps, `REFLEX_VERSIONS_KEPT.min` to `REFLEX_VERSIONS_KEPT.max`. */
23
- versionsKept: number;
24
- }
1
+ /**
2
+ * The retention tiers of the runs a customer may choose, in days (AbyssReflex L3a, #893). The plan's retention is
3
+ * the default; a tier is chosen per application, and per function over it. Same list as the database CHECKs.
4
+ */
5
+ export const REFLEX_RUN_RETENTION_TIER_DAYS = [3, 7, 15, 30, 90, 180, 365] as const;
6
+
7
+ /** Bounds of the number of versions the purge keeps, per function and per Service. */
8
+ export const REFLEX_VERSIONS_KEPT = { default: 20, min: 5, max: 100 } as const;
9
+
10
+ /** The detail of a run (detail, steps, log lines) moves to the archive past this age, in days, when its tier allows it. */
11
+ export const REFLEX_RUN_ARCHIVE_AFTER_DAYS = 30;
12
+
13
+ /** The runs of a tier under this number of days are never archived: they are purged before they would be. */
14
+ export const REFLEX_RUN_ARCHIVE_MIN_TIER_DAYS = 90;
15
+
16
+ /** The run retention of a function: its own tier, the one it inherits, and how many versions are kept. */
17
+ export interface IReflexFunctionRunRetention {
18
+ /** The tier of the function itself, one of `REFLEX_RUN_RETENTION_TIER_DAYS`; null follows the application. */
19
+ runRetentionDays: number | null;
20
+ /** The tier the function follows when it has none: the application's, else null for the plan's retention. Read only. */
21
+ inheritedDays: number | null;
22
+ /** How many versions of the function the purge keeps, `REFLEX_VERSIONS_KEPT.min` to `REFLEX_VERSIONS_KEPT.max`. */
23
+ versionsKept: number;
24
+ }