@abyss-project/reflex 5.8.1 → 5.10.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 (255) hide show
  1. package/.eslintrc.js +32 -32
  2. package/.prettierrc +5 -5
  3. package/README.md +15 -15
  4. package/dist/api/alert-rule.api.d.ts +5 -0
  5. package/dist/api/alert-rule.api.js +16 -0
  6. package/dist/api/alert-rule.api.js.map +1 -0
  7. package/dist/api/application-insights.api.d.ts +3 -0
  8. package/dist/api/application-insights.api.js +12 -0
  9. package/dist/api/application-insights.api.js.map +1 -0
  10. package/dist/api/application-run-settings.api.d.ts +3 -0
  11. package/dist/api/application-run-settings.api.js +11 -0
  12. package/dist/api/application-run-settings.api.js.map +1 -0
  13. package/dist/api/function-settings.api.d.ts +2 -1
  14. package/dist/api/function-settings.api.js +3 -1
  15. package/dist/api/function-settings.api.js.map +1 -1
  16. package/dist/api/index.d.ts +4 -0
  17. package/dist/api/index.js +4 -0
  18. package/dist/api/index.js.map +1 -1
  19. package/dist/api/route-stats.api.d.ts +3 -0
  20. package/dist/api/route-stats.api.js +9 -0
  21. package/dist/api/route-stats.api.js.map +1 -0
  22. package/dist/index.d.ts +28 -0
  23. package/dist/index.js +28 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/insights/index.d.ts +1 -0
  26. package/dist/insights/index.js +18 -0
  27. package/dist/insights/index.js.map +1 -0
  28. package/dist/insights/percentiles.d.ts +2 -0
  29. package/dist/insights/percentiles.js +28 -0
  30. package/dist/insights/percentiles.js.map +1 -0
  31. package/dist/types/enum/index.d.ts +5 -0
  32. package/dist/types/enum/index.js +5 -0
  33. package/dist/types/enum/index.js.map +1 -1
  34. package/dist/types/enum/log-cap-mode.enum.d.ts +5 -0
  35. package/dist/types/enum/log-cap-mode.enum.js +10 -0
  36. package/dist/types/enum/log-cap-mode.enum.js.map +1 -0
  37. package/dist/types/enum/log-drop-cause.enum.d.ts +4 -0
  38. package/dist/types/enum/log-drop-cause.enum.js +9 -0
  39. package/dist/types/enum/log-drop-cause.enum.js.map +1 -0
  40. package/dist/types/enum/reflex-alert-metric.enum.d.ts +4 -0
  41. package/dist/types/enum/reflex-alert-metric.enum.js +9 -0
  42. package/dist/types/enum/reflex-alert-metric.enum.js.map +1 -0
  43. package/dist/types/enum/reflex-alert-notification-state.enum.d.ts +5 -0
  44. package/dist/types/enum/reflex-alert-notification-state.enum.js +10 -0
  45. package/dist/types/enum/reflex-alert-notification-state.enum.js.map +1 -0
  46. package/dist/types/enum/reflex-alert-scope.enum.d.ts +5 -0
  47. package/dist/types/enum/reflex-alert-scope.enum.js +10 -0
  48. package/dist/types/enum/reflex-alert-scope.enum.js.map +1 -0
  49. package/dist/types/interface/api/requests/alert-rule.request.d.ts +38 -0
  50. package/dist/types/interface/api/requests/alert-rule.request.js +3 -0
  51. package/dist/types/interface/api/requests/alert-rule.request.js.map +1 -0
  52. package/dist/types/interface/api/requests/application-insights.request.d.ts +14 -0
  53. package/dist/types/interface/api/requests/application-insights.request.js +3 -0
  54. package/dist/types/interface/api/requests/application-insights.request.js.map +1 -0
  55. package/dist/types/interface/api/requests/application-run-settings.request.d.ts +9 -0
  56. package/dist/types/interface/api/requests/application-run-settings.request.js +3 -0
  57. package/dist/types/interface/api/requests/application-run-settings.request.js.map +1 -0
  58. package/dist/types/interface/api/requests/function-settings.request.d.ts +6 -1
  59. package/dist/types/interface/api/requests/index.d.ts +4 -0
  60. package/dist/types/interface/api/requests/index.js +4 -0
  61. package/dist/types/interface/api/requests/index.js.map +1 -1
  62. package/dist/types/interface/api/requests/route-stats.request.d.ts +18 -0
  63. package/dist/types/interface/api/requests/route-stats.request.js +3 -0
  64. package/dist/types/interface/api/requests/route-stats.request.js.map +1 -0
  65. package/dist/types/interface/api/responses/alert-rule.response.d.ts +17 -0
  66. package/dist/types/interface/api/responses/alert-rule.response.js +3 -0
  67. package/dist/types/interface/api/responses/alert-rule.response.js.map +1 -0
  68. package/dist/types/interface/api/responses/application-insights.response.d.ts +8 -0
  69. package/dist/types/interface/api/responses/application-insights.response.js +3 -0
  70. package/dist/types/interface/api/responses/application-insights.response.js.map +1 -0
  71. package/dist/types/interface/api/responses/application-run-settings.response.d.ts +6 -0
  72. package/dist/types/interface/api/responses/application-run-settings.response.js +3 -0
  73. package/dist/types/interface/api/responses/application-run-settings.response.js.map +1 -0
  74. package/dist/types/interface/api/responses/function-settings.response.d.ts +4 -1
  75. package/dist/types/interface/api/responses/index.d.ts +4 -0
  76. package/dist/types/interface/api/responses/index.js +4 -0
  77. package/dist/types/interface/api/responses/index.js.map +1 -1
  78. package/dist/types/interface/api/responses/route-stats.response.d.ts +12 -0
  79. package/dist/types/interface/api/responses/route-stats.response.js +3 -0
  80. package/dist/types/interface/api/responses/route-stats.response.js.map +1 -0
  81. package/dist/types/interface/models/index.d.ts +2 -0
  82. package/dist/types/interface/models/index.js +2 -0
  83. package/dist/types/interface/models/index.js.map +1 -1
  84. package/dist/types/interface/models/reflex-alert-rule.model.d.ts +55 -0
  85. package/dist/types/interface/models/reflex-alert-rule.model.js +15 -0
  86. package/dist/types/interface/models/reflex-alert-rule.model.js.map +1 -0
  87. package/dist/types/interface/models/reflex-insights.model.d.ts +63 -0
  88. package/dist/types/interface/models/reflex-insights.model.js +4 -1
  89. package/dist/types/interface/models/reflex-insights.model.js.map +1 -1
  90. package/dist/types/interface/models/reflex-run-settings.model.d.ts +19 -0
  91. package/dist/types/interface/models/reflex-run-settings.model.js +9 -0
  92. package/dist/types/interface/models/reflex-run-settings.model.js.map +1 -0
  93. package/dist/types/interface/models/reflex-run.model.d.ts +42 -4
  94. package/dist/types/interface/models/reflex-run.model.js +9 -0
  95. package/dist/types/interface/models/reflex-run.model.js.map +1 -1
  96. package/jest.config.ts +11 -11
  97. package/package.json +15 -10
  98. package/src/api/alert-rule.api.test.ts +72 -0
  99. package/src/api/alert-rule.api.ts +57 -0
  100. package/src/api/application-insights.api.test.ts +42 -0
  101. package/src/api/application-insights.api.ts +38 -0
  102. package/src/api/application-run-settings.api.test.ts +51 -0
  103. package/src/api/application-run-settings.api.ts +30 -0
  104. package/src/api/function-access.api.ts +36 -36
  105. package/src/api/function-insights.api.test.ts +27 -27
  106. package/src/api/function-insights.api.ts +18 -18
  107. package/src/api/function-run.api.ts +38 -38
  108. package/src/api/function-settings.api.ts +74 -59
  109. package/src/api/function-test.api.ts +34 -34
  110. package/src/api/function-version.api.ts +48 -48
  111. package/src/api/function.api.test.ts +249 -249
  112. package/src/api/function.api.ts +62 -62
  113. package/src/api/health.api.ts +10 -10
  114. package/src/api/index.ts +21 -17
  115. package/src/api/route-stats.api.test.ts +45 -0
  116. package/src/api/route-stats.api.ts +36 -0
  117. package/src/api/service-configuration.api.ts +16 -16
  118. package/src/api/service-deployment.api.ts +79 -79
  119. package/src/api/service-discord-event.api.test.ts +106 -106
  120. package/src/api/service-discord-event.api.ts +78 -78
  121. package/src/api/service-discord.api.test.ts +197 -197
  122. package/src/api/service-discord.api.ts +241 -241
  123. package/src/api/service-insights.api.test.ts +36 -36
  124. package/src/api/service-insights.api.ts +42 -42
  125. package/src/api/service-route.api.ts +72 -72
  126. package/src/api/service-task.api.test.ts +140 -140
  127. package/src/api/service-task.api.ts +141 -141
  128. package/src/api/service-version.api.ts +54 -54
  129. package/src/api/service.api.test.ts +215 -215
  130. package/src/api/service.api.ts +55 -55
  131. package/src/discord/discord-event-filter-cases.ts +261 -261
  132. package/src/discord/discord-event-filters.test.ts +91 -91
  133. package/src/discord/discord-event-filters.ts +95 -95
  134. package/src/discord/discord-event-intents.test.ts +112 -112
  135. package/src/discord/discord-event-intents.ts +55 -55
  136. package/src/discord/index.ts +3 -3
  137. package/src/index.test.ts +87 -75
  138. package/src/index.ts +371 -317
  139. package/src/insights/index.ts +1 -0
  140. package/src/insights/percentiles.test.ts +75 -0
  141. package/src/insights/percentiles.ts +37 -0
  142. package/src/types/enum/access-grant-status.enum.ts +12 -12
  143. package/src/types/enum/access-kind.enum.ts +7 -7
  144. package/src/types/enum/bot-event-block-reason.enum.ts +7 -7
  145. package/src/types/enum/configuration-read-as.enum.ts +5 -5
  146. package/src/types/enum/discord-activity-type.enum.ts +9 -9
  147. package/src/types/enum/discord-component-kind.enum.ts +7 -7
  148. package/src/types/enum/discord-event-drop-reason.enum.ts +13 -13
  149. package/src/types/enum/discord-event-filter-name.enum.ts +11 -11
  150. package/src/types/enum/discord-event-status.enum.ts +13 -13
  151. package/src/types/enum/discord-event-type.enum.ts +7 -7
  152. package/src/types/enum/discord-gateway-failure-code.enum.ts +11 -11
  153. package/src/types/enum/discord-gateway-state.enum.ts +11 -11
  154. package/src/types/enum/discord-option-type.enum.ts +12 -12
  155. package/src/types/enum/discord-presence-status.enum.ts +8 -8
  156. package/src/types/enum/discord-sync-status.enum.ts +6 -6
  157. package/src/types/enum/discord-token-state.enum.ts +11 -11
  158. package/src/types/enum/execution-mode.enum.ts +9 -9
  159. package/src/types/enum/execution-profile.enum.ts +20 -20
  160. package/src/types/enum/execution-settings-source.enum.ts +9 -9
  161. package/src/types/enum/health-status.enum.ts +4 -4
  162. package/src/types/enum/index.ts +45 -40
  163. package/src/types/enum/insights-period.enum.ts +8 -8
  164. package/src/types/enum/log-cap-mode.enum.ts +6 -0
  165. package/src/types/enum/log-drop-cause.enum.ts +8 -0
  166. package/src/types/enum/reflex-alert-metric.enum.ts +5 -0
  167. package/src/types/enum/reflex-alert-notification-state.enum.ts +6 -0
  168. package/src/types/enum/reflex-alert-scope.enum.ts +6 -0
  169. package/src/types/enum/reflex-error-code.enum.ts +43 -43
  170. package/src/types/enum/route-method.enum.ts +9 -9
  171. package/src/types/enum/run-log-level.enum.ts +6 -6
  172. package/src/types/enum/run-mode.enum.ts +11 -11
  173. package/src/types/enum/run-status.enum.ts +11 -11
  174. package/src/types/enum/run-step-status.enum.ts +7 -7
  175. package/src/types/enum/schedule-sync-status.enum.ts +6 -6
  176. package/src/types/enum/scheduled-run-failure-code.enum.ts +12 -12
  177. package/src/types/enum/scheduled-run-origin.enum.ts +5 -5
  178. package/src/types/enum/scheduled-run-status.enum.ts +17 -17
  179. package/src/types/enum/service-deployment-action.enum.ts +11 -11
  180. package/src/types/enum/service-deployment-status.enum.ts +5 -5
  181. package/src/types/enum/service-type.enum.ts +9 -9
  182. package/src/types/enum/service-version-change-kind.enum.ts +6 -6
  183. package/src/types/enum/trace-effect-type.enum.ts +12 -12
  184. package/src/types/enum/trigger-access-mode.enum.ts +12 -12
  185. package/src/types/enum/trigger-kind.enum.ts +8 -8
  186. package/src/types/enum/vault-value-source.enum.ts +12 -12
  187. package/src/types/enum/vault-visibility.enum.ts +5 -5
  188. package/src/types/index.ts +2 -2
  189. package/src/types/interface/api/index.ts +3 -3
  190. package/src/types/interface/api/requests/alert-rule.request.ts +53 -0
  191. package/src/types/interface/api/requests/application-insights.request.ts +18 -0
  192. package/src/types/interface/api/requests/application-run-settings.request.ts +11 -0
  193. package/src/types/interface/api/requests/function-access.request.ts +25 -25
  194. package/src/types/interface/api/requests/function-run.request.ts +30 -30
  195. package/src/types/interface/api/requests/function-settings.request.ts +34 -27
  196. package/src/types/interface/api/requests/function-test.request.ts +39 -39
  197. package/src/types/interface/api/requests/function-version.request.ts +20 -20
  198. package/src/types/interface/api/requests/function.request.ts +36 -36
  199. package/src/types/interface/api/requests/index.ts +19 -15
  200. package/src/types/interface/api/requests/route-stats.request.ts +22 -0
  201. package/src/types/interface/api/requests/service-configuration.request.ts +4 -4
  202. package/src/types/interface/api/requests/service-deployment.request.ts +49 -49
  203. package/src/types/interface/api/requests/service-discord-event.request.ts +68 -68
  204. package/src/types/interface/api/requests/service-discord.request.ts +173 -173
  205. package/src/types/interface/api/requests/service-insights.request.ts +31 -31
  206. package/src/types/interface/api/requests/service-route.request.ts +44 -44
  207. package/src/types/interface/api/requests/service-task.request.ts +80 -80
  208. package/src/types/interface/api/requests/service-version.request.ts +24 -24
  209. package/src/types/interface/api/requests/service.request.ts +46 -46
  210. package/src/types/interface/api/response.ts +4 -4
  211. package/src/types/interface/api/responses/alert-rule.response.ts +24 -0
  212. package/src/types/interface/api/responses/application-insights.response.ts +11 -0
  213. package/src/types/interface/api/responses/application-run-settings.response.ts +8 -0
  214. package/src/types/interface/api/responses/function-access.response.ts +17 -17
  215. package/src/types/interface/api/responses/function-run.response.ts +18 -18
  216. package/src/types/interface/api/responses/function-settings.response.ts +42 -36
  217. package/src/types/interface/api/responses/function-test.response.ts +12 -12
  218. package/src/types/interface/api/responses/function-version.response.ts +31 -31
  219. package/src/types/interface/api/responses/function.response.ts +25 -25
  220. package/src/types/interface/api/responses/index.ts +19 -15
  221. package/src/types/interface/api/responses/route-stats.response.ts +15 -0
  222. package/src/types/interface/api/responses/service-configuration.response.ts +8 -8
  223. package/src/types/interface/api/responses/service-deployment.response.ts +32 -32
  224. package/src/types/interface/api/responses/service-discord-event.response.ts +24 -24
  225. package/src/types/interface/api/responses/service-discord.response.ts +122 -122
  226. package/src/types/interface/api/responses/service-insights.response.ts +11 -11
  227. package/src/types/interface/api/responses/service-route.response.ts +31 -31
  228. package/src/types/interface/api/responses/service-task.response.ts +57 -57
  229. package/src/types/interface/api/responses/service-version.response.ts +106 -106
  230. package/src/types/interface/api/responses/service.response.ts +31 -31
  231. package/src/types/interface/health.response.ts +7 -7
  232. package/src/types/interface/index.ts +3 -3
  233. package/src/types/interface/models/index.ts +21 -19
  234. package/src/types/interface/models/reflex-access-grant.model.ts +14 -14
  235. package/src/types/interface/models/reflex-alert-rule.model.ts +56 -0
  236. package/src/types/interface/models/reflex-bot-limits.model.ts +92 -92
  237. package/src/types/interface/models/reflex-definition.model.ts +31 -31
  238. package/src/types/interface/models/reflex-discord-event-log.model.ts +58 -58
  239. package/src/types/interface/models/reflex-discord-event.model.ts +79 -79
  240. package/src/types/interface/models/reflex-execution-settings.model.ts +50 -50
  241. package/src/types/interface/models/reflex-function-version.model.ts +14 -14
  242. package/src/types/interface/models/reflex-function.model.ts +16 -16
  243. package/src/types/interface/models/reflex-insights.model.ts +215 -120
  244. package/src/types/interface/models/reflex-price-list.model.ts +20 -20
  245. package/src/types/interface/models/reflex-route.model.ts +19 -19
  246. package/src/types/interface/models/reflex-run-settings.model.ts +28 -0
  247. package/src/types/interface/models/reflex-run.model.ts +253 -186
  248. package/src/types/interface/models/reflex-service-configuration.model.ts +22 -22
  249. package/src/types/interface/models/reflex-service-deployment.model.ts +46 -46
  250. package/src/types/interface/models/reflex-service-version.model.ts +61 -61
  251. package/src/types/interface/models/reflex-service.model.ts +45 -45
  252. package/src/types/interface/models/reflex-step-stats.model.ts +35 -35
  253. package/src/types/interface/models/reflex-task.model.ts +97 -97
  254. package/tsconfig.check.json +15 -15
  255. package/tsconfig.json +35 -35
@@ -1,186 +1,253 @@
1
- import type {
2
- ExecutionMode,
3
- ExecutionProfile,
4
- RunLogLevel,
5
- RunMode,
6
- RunStatus,
7
- RunStepStatus,
8
- ScheduledRunOrigin,
9
- TraceEffectType,
10
- } from '../../enum';
11
-
12
- export interface IReflexTraceError {
13
- code: string;
14
- message: string;
15
- }
16
-
17
- /**
18
- * One call the run made to the host, in the order they were served. `recorded` is true when the effect
19
- * was recorded instead of executed (a stubbed HTTP call, a Store write kept aside, a wait not waited).
20
- */
21
- export interface IReflexTraceEntry {
22
- stepId: string;
23
- type: TraceEffectType;
24
- /** The host action, for a HOST effect. */
25
- action?: string;
26
- request?: unknown;
27
- response?: unknown;
28
- error?: IReflexTraceError;
29
- recorded: boolean;
30
- }
31
-
32
- /** What the RESPOND step (or `abyss.respond`) built: the response the caller of the route would get. */
33
- export interface IReflexTraceResponse {
34
- status: number;
35
- headers: Record<string, string>;
36
- body: unknown;
37
- }
38
-
39
- /**
40
- * Bounded: past 100 entries, or a value of more than 4 KB, the trace is cut and says so (`truncated`).
41
- * Every secret value the run was given or read is masked (`***`).
42
- */
43
- export interface IReflexRunTrace {
44
- entries: IReflexTraceEntry[];
45
- outcome: {
46
- status: RunStatus;
47
- output?: unknown;
48
- error?: IReflexTraceError & { stepId?: string };
49
- };
50
- response?: IReflexTraceResponse;
51
- truncated: boolean;
52
- }
53
-
54
- export interface IReflexRun {
55
- id: string;
56
- functionId: string;
57
- versionId: string | null;
58
- /**
59
- * The environment the run took place in: the promoted version's for a LIVE run, the one named in the
60
- * request for a test run. Null only for a test run recorded before test runs named an environment.
61
- */
62
- environmentId: string | null;
63
- mode: RunMode;
64
- status: RunStatus;
65
- durationMs: number;
66
- /** The effects of a test run; null for a LIVE run, which records no trace (nothing of the caller is kept). */
67
- trace: IReflexRunTrace | null;
68
- /** The route that started a LIVE run; null for a test run and for a run a Discord command or component started. */
69
- routeId: string | null;
70
- /** The Discord command that started a LIVE run; null otherwise. */
71
- commandId: string | null;
72
- /** The Discord component that started a LIVE run; null otherwise. */
73
- componentId: string | null;
74
- /** The task that started a LIVE run, by a tick of its cron or a delayed run; null otherwise. */
75
- taskId: string | null;
76
- /** The event trigger that started a LIVE run; null otherwise. */
77
- eventTriggerId: string | null;
78
- /**
79
- * Monitor trace id of the run (32 hex characters; for an event, the id of its inbox row without dashes, the same
80
- * at every attempt); null when the run was not sent to Monitor (non-bot Service, HTTP route).
81
- */
82
- traceId: string | null;
83
- /** How the task started the run: RECURRING for a tick of its cron, DELAYED for a delayed run; null when no task did. */
84
- scheduledRunOrigin: ScheduledRunOrigin | null;
85
- /**
86
- * What started the run, for a screen: `METHOD path` for a route, `/name` for a command, the custom id
87
- * prefix for a component, the name for a task or an event trigger. Null for a test run, and when the route, command,
88
- * component, task or event trigger was deleted.
89
- */
90
- originLabel: string | null;
91
- /** The HTTP status the caller of a LIVE run got; null for a test run. */
92
- httpStatus: number | null;
93
- /** The code of the error a failed LIVE run answered (FUNCTION_FAILED, FUNCTION_TIMEOUT, RUNNER_UNAVAILABLE, RUNNER_SATURATED, INTERNAL_ERROR); null otherwise, an interrupted run included. */
94
- errorCode: string | null;
95
- /** The execution mode of the function when a LIVE run started; null for a test run. */
96
- executionMode: ExecutionMode | null;
97
- /** When the caller of a LIVE run got its answer; null for a test run, or before any answer. */
98
- responseSentAt: Date | null;
99
- /**
100
- * What the run consumed and cost: measured by the runner for a live run and for a test run (with the
101
- * function's effective settings in the run's environment, and the network of its stubs); null for a running execution, or a run
102
- * recorded before the measures.
103
- */
104
- metrics: IReflexRunMetrics | null;
105
- createdByUserId: string | null;
106
- createdAt: Date;
107
- }
108
-
109
- /** What a live execution consumed, and what it costs (ADR-0244). */
110
- export interface IReflexRunMetrics {
111
- /** The profile it ran with, and the memory that profile allocates. */
112
- profile: ExecutionProfile;
113
- memoryLimitMb: number;
114
- /** Measured by the runner in the isolate. */
115
- cpuMs: number;
116
- heapPeakBytes: number;
117
- /** Measured by the host: bytes sent and received by `fetch`, plus the answer sent to the caller. */
118
- netOutBytes: number;
119
- netInBytes: number;
120
- httpCalls: number;
121
- storeWrites: number;
122
- /** In thousandths of a credit; 0 for an interrupted execution, which is offered. */
123
- costMillicredits: number;
124
- }
125
-
126
- /** What one step of a run consumed; its cost is its share of the run's, the fixed price aside. */
127
- export interface IReflexRunStep {
128
- /** 0 for the first step that ran. */
129
- position: number;
130
- stepId: string;
131
- status: RunStepStatus;
132
- durationMs: number;
133
- cpuMs: number;
134
- heapPeakBytes: number;
135
- netOutBytes: number;
136
- netInBytes: number;
137
- httpCalls: number;
138
- storeWrites: number;
139
- costMillicredits: number;
140
- }
141
-
142
- /**
143
- * One log line a run wrote: a LOG step, `abyss.log.*` or `console.*`. Secrets masked (`***`); a message
144
- * is cut at 2048 characters, and data whose JSON is longer becomes `{ truncated: true, preview }`. At most
145
- * 100 lines per run are kept; `IReflexRunDetail.droppedLogLines` counts the others.
146
- */
147
- export interface IReflexRunLog {
148
- /** 0 for the first line. */
149
- position: number;
150
- /** The step that wrote it. */
151
- stepId: string;
152
- level: RunLogLevel;
153
- message: string;
154
- /** The value given with the message; null when none was. */
155
- data: unknown;
156
- loggedAt: Date;
157
- }
158
-
159
- /**
160
- * One run with the steps it ran and the lines it logged, in order. Both are empty for a run recorded
161
- * before the measures (and the steps for a running execution).
162
- */
163
- export interface IReflexRunDetail extends IReflexRun {
164
- steps: IReflexRunStep[];
165
- logs: IReflexRunLog[];
166
- /** The log lines written past the 100 kept in `logs`; 0 when none was dropped. */
167
- droppedLogLines: number;
168
- }
169
-
170
- /** The state of a live execution, read by its id (the `executionId` an async route answers with). */
171
- export interface IReflexExecutionState {
172
- id: string;
173
- status: RunStatus;
174
- executionMode: ExecutionMode;
175
- startedAt: Date;
176
- /** When the caller got its answer; for an async execution, the 202. */
177
- responseSentAt: Date | null;
178
- /** Null while it runs. */
179
- finishedAt: Date | null;
180
- /** The status the caller got. */
181
- httpStatus: number;
182
- /** Set when the execution failed. */
183
- errorCode: string | null;
184
- /** Null while it runs, or for an execution recorded before the measures. */
185
- costMillicredits: number | null;
186
- }
1
+ import type {
2
+ ExecutionMode,
3
+ ExecutionProfile,
4
+ LogDropCause,
5
+ RunLogLevel,
6
+ RunMode,
7
+ RunStatus,
8
+ RunStepStatus,
9
+ ScheduledRunOrigin,
10
+ TraceEffectType,
11
+ } from '../../enum';
12
+
13
+ export interface IReflexTraceError {
14
+ code: string;
15
+ message: string;
16
+ }
17
+
18
+ /** Where the code of a step failed: the step and the line and column of its source. */
19
+ export interface IReflexRunErrorLocation {
20
+ stepId: string;
21
+ line: number;
22
+ column: number;
23
+ }
24
+
25
+ /** The error of a run: where it failed (`stepId`, `line`, `column`) and the frames of the client code, when known. */
26
+ export interface IReflexTraceOutcomeError extends IReflexTraceError {
27
+ stepId?: string;
28
+ line?: number;
29
+ column?: number;
30
+ /** Frames of the client code only, `step:<id>:<line>:<column>`, masked. */
31
+ stack?: string;
32
+ }
33
+
34
+ /** The HTTP request a route received, masked. */
35
+ export interface IReflexTraceRequest {
36
+ method: string;
37
+ path: string;
38
+ query: Record<string, string | string[]>;
39
+ headers: Record<string, string>;
40
+ body: unknown;
41
+ }
42
+
43
+ /** What one step that succeeded returned; `outputTruncated` when the runner cut its output. */
44
+ export interface IReflexTraceStep {
45
+ stepId: string;
46
+ output?: unknown;
47
+ outputTruncated: boolean;
48
+ }
49
+
50
+ /** Bounds of the detail a LIVE run keeps, in bytes of the UTF-8 JSON after masking (the budget is spent in this order). */
51
+ export const REFLEX_RUN_DETAIL_LIMITS = {
52
+ /** The whole detail. */
53
+ totalBytes: 65_536,
54
+ /** The error: message and stack. */
55
+ errorBytes: 4_096,
56
+ /** The request without its body: method, path, query, headers. */
57
+ requestMetaBytes: 8_192,
58
+ /** The body of the request, or the input of the run. */
59
+ requestBodyBytes: 16_384,
60
+ /** The response, or the output of the run. */
61
+ responseBytes: 16_384,
62
+ /** One step output or one effect, until the rest of the budget is spent. */
63
+ entryBytes: 4_096,
64
+ } as const;
65
+
66
+ /**
67
+ * One call the run made to the host, in the order they were served. `recorded` is true when the effect
68
+ * was recorded instead of executed (a stubbed HTTP call, a Store write kept aside, a wait not waited).
69
+ */
70
+ export interface IReflexTraceEntry {
71
+ stepId: string;
72
+ type: TraceEffectType;
73
+ /** The host action, for a HOST effect. */
74
+ action?: string;
75
+ request?: unknown;
76
+ response?: unknown;
77
+ error?: IReflexTraceError;
78
+ recorded: boolean;
79
+ }
80
+
81
+ /** What the RESPOND step (or `abyss.respond`) built: the response the caller of the route would get. */
82
+ export interface IReflexTraceResponse {
83
+ status: number;
84
+ headers: Record<string, string>;
85
+ body: unknown;
86
+ }
87
+
88
+ /**
89
+ * Bounded: past 100 entries, or a value of more than 4 KB, the trace is cut and says so (`truncated`); a LIVE run
90
+ * keeps at most `REFLEX_RUN_DETAIL_LIMITS.totalBytes`. Every secret value the run was given or read is masked (`***`).
91
+ */
92
+ export interface IReflexRunTrace {
93
+ /** The HTTP request, for a run a route started. */
94
+ request?: IReflexTraceRequest;
95
+ /** The payload the function received, for a run a command, a component, a task, a delayed run or an event started. */
96
+ input?: unknown;
97
+ entries: IReflexTraceEntry[];
98
+ /** The output of each step that succeeded, in order. */
99
+ steps?: IReflexTraceStep[];
100
+ outcome: {
101
+ status: RunStatus;
102
+ output?: unknown;
103
+ error?: IReflexTraceOutcomeError;
104
+ };
105
+ response?: IReflexTraceResponse;
106
+ truncated: boolean;
107
+ /** Paths of the fields that were cut, for example `request.body` or `entries[3].response`. */
108
+ truncatedFields: string[];
109
+ }
110
+
111
+ export interface IReflexRun {
112
+ id: string;
113
+ functionId: string;
114
+ versionId: string | null;
115
+ /**
116
+ * The environment the run took place in: the promoted version's for a LIVE run, the one named in the
117
+ * request for a test run. Null only for a test run recorded before test runs named an environment.
118
+ */
119
+ environmentId: string | null;
120
+ mode: RunMode;
121
+ status: RunStatus;
122
+ durationMs: number;
123
+ /** The effects of a test run; null for a LIVE run, which records no trace (nothing of the caller is kept). */
124
+ trace: IReflexRunTrace | null;
125
+ /** The route that started a LIVE run; null for a test run and for a run a Discord command or component started. */
126
+ routeId: string | null;
127
+ /** The Discord command that started a LIVE run; null otherwise. */
128
+ commandId: string | null;
129
+ /** The Discord component that started a LIVE run; null otherwise. */
130
+ componentId: string | null;
131
+ /** The task that started a LIVE run, by a tick of its cron or a delayed run; null otherwise. */
132
+ taskId: string | null;
133
+ /** The event trigger that started a LIVE run; null otherwise. */
134
+ eventTriggerId: string | null;
135
+ /**
136
+ * Monitor trace id of the run (32 hex characters; for an event, the id of its inbox row without dashes, the same
137
+ * at every attempt); null when the run was not sent to Monitor (non-bot Service, HTTP route).
138
+ */
139
+ traceId: string | null;
140
+ /** How the task started the run: RECURRING for a tick of its cron, DELAYED for a delayed run; null when no task did. */
141
+ scheduledRunOrigin: ScheduledRunOrigin | null;
142
+ /**
143
+ * What started the run, for a screen: `METHOD path` for a route, `/name` for a command, the custom id
144
+ * prefix for a component, the name for a task or an event trigger. Null for a test run, and when the route, command,
145
+ * component, task or event trigger was deleted.
146
+ */
147
+ originLabel: string | null;
148
+ /** The HTTP status the caller of a LIVE run got; null for a test run. */
149
+ httpStatus: number | null;
150
+ /** The code of the error a failed LIVE run answered (FUNCTION_FAILED, FUNCTION_TIMEOUT, RUNNER_UNAVAILABLE, RUNNER_SATURATED, INTERNAL_ERROR); null otherwise, an interrupted run included. */
151
+ errorCode: string | null;
152
+ /** The message of the error of a failed run, masked, 2048 characters at most; null when none was kept. */
153
+ errorMessage: string | null;
154
+ /** Where the code of a step failed; null when the error is not one of client code, or none was kept. */
155
+ errorLocation: IReflexRunErrorLocation | null;
156
+ /** The browser session (Monitor RUM) that sent the request; null when none. */
157
+ rumSessionId: string | null;
158
+ /** Whether the application sends its runs to Monitor. */
159
+ monitorActivated: boolean;
160
+ /** The execution mode of the function when a LIVE run started; null for a test run. */
161
+ executionMode: ExecutionMode | null;
162
+ /** When the caller of a LIVE run got its answer; null for a test run, or before any answer. */
163
+ responseSentAt: Date | null;
164
+ /**
165
+ * What the run consumed and cost: measured by the runner for a live run and for a test run (with the
166
+ * function's effective settings in the run's environment, and the network of its stubs); null for a running execution, or a run
167
+ * recorded before the measures.
168
+ */
169
+ metrics: IReflexRunMetrics | null;
170
+ createdByUserId: string | null;
171
+ createdAt: Date;
172
+ }
173
+
174
+ /** What a live execution consumed, and what it costs (ADR-0244). */
175
+ export interface IReflexRunMetrics {
176
+ /** The profile it ran with, and the memory that profile allocates. */
177
+ profile: ExecutionProfile;
178
+ memoryLimitMb: number;
179
+ /** Measured by the runner in the isolate. */
180
+ cpuMs: number;
181
+ heapPeakBytes: number;
182
+ /** Measured by the host: bytes sent and received by `fetch`, plus the answer sent to the caller. */
183
+ netOutBytes: number;
184
+ netInBytes: number;
185
+ httpCalls: number;
186
+ storeWrites: number;
187
+ /** In thousandths of a credit; 0 for an interrupted execution, which is offered. */
188
+ costMillicredits: number;
189
+ }
190
+
191
+ /** What one step of a run consumed; its cost is its share of the run's, the fixed price aside. */
192
+ export interface IReflexRunStep {
193
+ /** 0 for the first step that ran. */
194
+ position: number;
195
+ stepId: string;
196
+ status: RunStepStatus;
197
+ durationMs: number;
198
+ cpuMs: number;
199
+ heapPeakBytes: number;
200
+ netOutBytes: number;
201
+ netInBytes: number;
202
+ httpCalls: number;
203
+ storeWrites: number;
204
+ costMillicredits: number;
205
+ }
206
+
207
+ /**
208
+ * One log line a run wrote: a LOG step, `abyss.log.*` or `console.*`. Secrets masked (`***`); a message
209
+ * is cut at 2048 characters, and data whose JSON is longer becomes `{ truncated: true, preview }`. The lines
210
+ * past the cap in force or the technical bound are not kept; `IReflexRunDetail.droppedLogLines` counts them.
211
+ */
212
+ export interface IReflexRunLog {
213
+ /** 0 for the first line. */
214
+ position: number;
215
+ /** The step that wrote it. */
216
+ stepId: string;
217
+ level: RunLogLevel;
218
+ message: string;
219
+ /** The value given with the message; null when none was. */
220
+ data: unknown;
221
+ loggedAt: Date;
222
+ }
223
+
224
+ /**
225
+ * One run with the steps it ran and the lines it logged, in order. Both are empty for a run recorded
226
+ * before the measures (and the steps for a running execution).
227
+ */
228
+ export interface IReflexRunDetail extends IReflexRun {
229
+ steps: IReflexRunStep[];
230
+ logs: IReflexRunLog[];
231
+ /** The log lines written and not kept in `logs`; 0 when none was dropped. */
232
+ droppedLogLines: number;
233
+ /** Why lines were dropped; null when none was. */
234
+ droppedLogCause: LogDropCause | null;
235
+ }
236
+
237
+ /** The state of a live execution, read by its id (the `executionId` an async route answers with). */
238
+ export interface IReflexExecutionState {
239
+ id: string;
240
+ status: RunStatus;
241
+ executionMode: ExecutionMode;
242
+ startedAt: Date;
243
+ /** When the caller got its answer; for an async execution, the 202. */
244
+ responseSentAt: Date | null;
245
+ /** Null while it runs. */
246
+ finishedAt: Date | null;
247
+ /** The status the caller got. */
248
+ httpStatus: number;
249
+ /** Set when the execution failed. */
250
+ errorCode: string | null;
251
+ /** Null while it runs, or for an execution recorded before the measures. */
252
+ costMillicredits: number | null;
253
+ }
@@ -1,22 +1,22 @@
1
- import type { ConfigurationReadAs, VaultValueSource, VaultVisibility } from '../../enum';
2
-
3
- /**
4
- * A key the functions of a Service read (its draft and its versions in service), and what the Console
5
- * vault gives it in each environment of the application. Never a value.
6
- */
7
- export interface IReflexServiceConfigurationEntry {
8
- key: string;
9
- /** `config` for `config.KEY` / `{{ config.KEY }}`, `secrets` for `secrets.KEY` / `{{ secrets.KEY }}`. */
10
- readAs: ConfigurationReadAs;
11
- /** The Console vault entry of that key in the project; null when there is none. */
12
- secretId: string | null;
13
- /** The visibility of that entry; null when there is none. */
14
- visibility: VaultVisibility | null;
15
- /**
16
- * True when the entry cannot answer this read: a `config` key bound to a SECRET entry, or a `secrets`
17
- * key bound to a VISIBLE one. Every source is then ABSENT, the key never resolves.
18
- */
19
- mismatch: boolean;
20
- /** By environment id of the application. */
21
- sources: Record<string, VaultValueSource>;
22
- }
1
+ import type { ConfigurationReadAs, VaultValueSource, VaultVisibility } from '../../enum';
2
+
3
+ /**
4
+ * A key the functions of a Service read (its draft and its versions in service), and what the Console
5
+ * vault gives it in each environment of the application. Never a value.
6
+ */
7
+ export interface IReflexServiceConfigurationEntry {
8
+ key: string;
9
+ /** `config` for `config.KEY` / `{{ config.KEY }}`, `secrets` for `secrets.KEY` / `{{ secrets.KEY }}`. */
10
+ readAs: ConfigurationReadAs;
11
+ /** The Console vault entry of that key in the project; null when there is none. */
12
+ secretId: string | null;
13
+ /** The visibility of that entry; null when there is none. */
14
+ visibility: VaultVisibility | null;
15
+ /**
16
+ * True when the entry cannot answer this read: a `config` key bound to a SECRET entry, or a `secrets`
17
+ * key bound to a VISIBLE one. Every source is then ABSENT, the key never resolves.
18
+ */
19
+ mismatch: boolean;
20
+ /** By environment id of the application. */
21
+ sources: Record<string, VaultValueSource>;
22
+ }
@@ -1,46 +1,46 @@
1
- import type {
2
- DiscordSyncStatus,
3
- ScheduleSyncStatus,
4
- ServiceDeploymentAction,
5
- ServiceDeploymentStatus,
6
- } from '../../enum';
7
- import type { IReflexAccessDeclaration } from './reflex-definition.model';
8
-
9
- /** The accesses granted to one member function when the gesture was made: what the execution plane holds. */
10
- export interface IReflexServiceDeploymentGrant {
11
- functionId: string;
12
- grants: IReflexAccessDeclaration[];
13
- }
14
-
15
- /**
16
- * One gesture on the Service in an environment of the application. The `isCurrent` row is what runs (or
17
- * is paused) there; the others are the history a rollback reads.
18
- */
19
- export interface IReflexServiceDeployment {
20
- id: string;
21
- serviceId: string;
22
- /** The environment of the application (abyss-main's id). */
23
- environmentId: string;
24
- /** The name of that environment, second segment of the address. */
25
- environmentSlug: string;
26
- serviceVersionId: string;
27
- serviceVersionNumber: number;
28
- action: ServiceDeploymentAction;
29
- status: ServiceDeploymentStatus;
30
- grants: IReflexServiceDeploymentGrant[];
31
- /** Push of the interactions address and the commands to Discord; null for a Service that is not a Discord bot. */
32
- discordSync: DiscordSyncStatus | null;
33
- /** Code and message of the Discord refusal when `discordSync` is FAILED (500 characters at most). */
34
- discordSyncError: string | null;
35
- discordSyncedAt: Date | null;
36
- /** Synchronization of the cron tasks of the version with Flow; null when the version has no cron task. */
37
- scheduleSync: ScheduleSyncStatus | null;
38
- /** Code and message of the failure when `scheduleSync` is FAILED (500 characters at most). */
39
- scheduleSyncError: string | null;
40
- scheduleSyncedAt: Date | null;
41
- /** The bot was paused by the plan quota (ADR-0277), not by a member: only those resume with the plan. */
42
- pausedForQuota: boolean;
43
- isCurrent: boolean;
44
- byUserId: string;
45
- at: Date;
46
- }
1
+ import type {
2
+ DiscordSyncStatus,
3
+ ScheduleSyncStatus,
4
+ ServiceDeploymentAction,
5
+ ServiceDeploymentStatus,
6
+ } from '../../enum';
7
+ import type { IReflexAccessDeclaration } from './reflex-definition.model';
8
+
9
+ /** The accesses granted to one member function when the gesture was made: what the execution plane holds. */
10
+ export interface IReflexServiceDeploymentGrant {
11
+ functionId: string;
12
+ grants: IReflexAccessDeclaration[];
13
+ }
14
+
15
+ /**
16
+ * One gesture on the Service in an environment of the application. The `isCurrent` row is what runs (or
17
+ * is paused) there; the others are the history a rollback reads.
18
+ */
19
+ export interface IReflexServiceDeployment {
20
+ id: string;
21
+ serviceId: string;
22
+ /** The environment of the application (abyss-main's id). */
23
+ environmentId: string;
24
+ /** The name of that environment, second segment of the address. */
25
+ environmentSlug: string;
26
+ serviceVersionId: string;
27
+ serviceVersionNumber: number;
28
+ action: ServiceDeploymentAction;
29
+ status: ServiceDeploymentStatus;
30
+ grants: IReflexServiceDeploymentGrant[];
31
+ /** Push of the interactions address and the commands to Discord; null for a Service that is not a Discord bot. */
32
+ discordSync: DiscordSyncStatus | null;
33
+ /** Code and message of the Discord refusal when `discordSync` is FAILED (500 characters at most). */
34
+ discordSyncError: string | null;
35
+ discordSyncedAt: Date | null;
36
+ /** Synchronization of the cron tasks of the version with Flow; null when the version has no cron task. */
37
+ scheduleSync: ScheduleSyncStatus | null;
38
+ /** Code and message of the failure when `scheduleSync` is FAILED (500 characters at most). */
39
+ scheduleSyncError: string | null;
40
+ scheduleSyncedAt: Date | null;
41
+ /** The bot was paused by the plan quota (ADR-0277), not by a member: only those resume with the plan. */
42
+ pausedForQuota: boolean;
43
+ isCurrent: boolean;
44
+ byUserId: string;
45
+ at: Date;
46
+ }