@abyss-project/reflex 2.0.0 → 4.0.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 (197) hide show
  1. package/dist/api/function-version.api.d.ts +1 -2
  2. package/dist/api/function-version.api.js +1 -3
  3. package/dist/api/function-version.api.js.map +1 -1
  4. package/dist/api/index.d.ts +5 -2
  5. package/dist/api/index.js +5 -2
  6. package/dist/api/index.js.map +1 -1
  7. package/dist/api/service-configuration.api.d.ts +2 -0
  8. package/dist/api/service-configuration.api.js +7 -0
  9. package/dist/api/service-configuration.api.js.map +1 -0
  10. package/dist/api/service-deployment.api.d.ts +6 -0
  11. package/dist/api/service-deployment.api.js +19 -0
  12. package/dist/api/service-deployment.api.js.map +1 -0
  13. package/dist/api/service-route.api.d.ts +6 -0
  14. package/dist/api/service-route.api.js +16 -0
  15. package/dist/api/service-route.api.js.map +1 -0
  16. package/dist/api/service-version.api.d.ts +4 -0
  17. package/dist/api/service-version.api.js +12 -0
  18. package/dist/api/service-version.api.js.map +1 -0
  19. package/dist/api/service.api.d.ts +6 -0
  20. package/dist/api/service.api.js +17 -0
  21. package/dist/api/service.api.js.map +1 -0
  22. package/dist/index.d.ts +34 -14
  23. package/dist/index.js +34 -14
  24. package/dist/index.js.map +1 -1
  25. package/dist/types/enum/configuration-read-as.enum.d.ts +4 -0
  26. package/dist/types/enum/configuration-read-as.enum.js +9 -0
  27. package/dist/types/enum/configuration-read-as.enum.js.map +1 -0
  28. package/dist/types/enum/index.d.ts +8 -1
  29. package/dist/types/enum/index.js +8 -1
  30. package/dist/types/enum/index.js.map +1 -1
  31. package/dist/types/enum/reflex-error-code.enum.d.ts +5 -2
  32. package/dist/types/enum/reflex-error-code.enum.js +4 -1
  33. package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
  34. package/dist/types/enum/route-method.enum.d.ts +8 -0
  35. package/dist/types/enum/route-method.enum.js +13 -0
  36. package/dist/types/enum/route-method.enum.js.map +1 -0
  37. package/dist/types/enum/service-deployment-action.enum.d.ts +6 -0
  38. package/dist/types/enum/service-deployment-action.enum.js +11 -0
  39. package/dist/types/enum/service-deployment-action.enum.js.map +1 -0
  40. package/dist/types/enum/service-deployment-status.enum.d.ts +4 -0
  41. package/dist/types/enum/service-deployment-status.enum.js +9 -0
  42. package/dist/types/enum/service-deployment-status.enum.js.map +1 -0
  43. package/dist/types/enum/service-type.enum.d.ts +4 -0
  44. package/dist/types/enum/service-type.enum.js +9 -0
  45. package/dist/types/enum/service-type.enum.js.map +1 -0
  46. package/dist/types/enum/service-version-change-kind.enum.d.ts +5 -0
  47. package/dist/types/enum/service-version-change-kind.enum.js +10 -0
  48. package/dist/types/enum/service-version-change-kind.enum.js.map +1 -0
  49. package/dist/types/enum/vault-value-source.enum.d.ts +6 -0
  50. package/dist/types/enum/vault-value-source.enum.js +11 -0
  51. package/dist/types/enum/vault-value-source.enum.js.map +1 -0
  52. package/dist/types/enum/vault-visibility.enum.d.ts +4 -0
  53. package/dist/types/enum/vault-visibility.enum.js +9 -0
  54. package/dist/types/enum/vault-visibility.enum.js.map +1 -0
  55. package/dist/types/interface/api/requests/function-version.request.d.ts +0 -4
  56. package/dist/types/interface/api/requests/function.request.d.ts +1 -0
  57. package/dist/types/interface/api/requests/index.d.ts +5 -2
  58. package/dist/types/interface/api/requests/index.js +5 -2
  59. package/dist/types/interface/api/requests/index.js.map +1 -1
  60. package/dist/types/interface/api/requests/service-configuration.request.d.ts +4 -0
  61. package/dist/types/interface/api/requests/service-configuration.request.js +3 -0
  62. package/dist/types/interface/api/requests/service-configuration.request.js.map +1 -0
  63. package/dist/types/interface/api/requests/service-deployment.request.d.ts +39 -0
  64. package/dist/types/interface/api/requests/{function-promotion.request.js → service-deployment.request.js} +1 -1
  65. package/dist/types/interface/api/requests/service-deployment.request.js.map +1 -0
  66. package/dist/types/interface/api/requests/service-route.request.d.ts +36 -0
  67. package/dist/types/interface/api/requests/{function-trigger.request.js → service-route.request.js} +1 -1
  68. package/dist/types/interface/api/requests/service-route.request.js.map +1 -0
  69. package/dist/types/interface/api/requests/service-version.request.d.ts +16 -0
  70. package/dist/types/interface/api/{responses/function-trigger.response.js → requests/service-version.request.js} +1 -1
  71. package/dist/types/interface/api/requests/service-version.request.js.map +1 -0
  72. package/dist/types/interface/api/requests/service.request.d.ts +30 -0
  73. package/dist/types/interface/{models/reflex-trigger.model.js → api/requests/service.request.js} +1 -1
  74. package/dist/types/interface/api/requests/service.request.js.map +1 -0
  75. package/dist/types/interface/api/responses/function-version.response.d.ts +0 -4
  76. package/dist/types/interface/api/responses/index.d.ts +5 -2
  77. package/dist/types/interface/api/responses/index.js +5 -2
  78. package/dist/types/interface/api/responses/index.js.map +1 -1
  79. package/dist/types/interface/api/responses/service-configuration.response.d.ts +6 -0
  80. package/dist/types/interface/api/responses/service-configuration.response.js +3 -0
  81. package/dist/types/interface/api/responses/service-configuration.response.js.map +1 -0
  82. package/dist/types/interface/api/responses/service-deployment.response.d.ts +24 -0
  83. package/dist/types/interface/api/responses/{function-promotion.response.js → service-deployment.response.js} +1 -1
  84. package/dist/types/interface/api/responses/service-deployment.response.js.map +1 -0
  85. package/dist/types/interface/api/responses/service-route.response.d.ts +23 -0
  86. package/dist/types/interface/api/responses/service-route.response.js +3 -0
  87. package/dist/types/interface/api/responses/service-route.response.js.map +1 -0
  88. package/dist/types/interface/api/responses/service-version.response.d.ts +23 -0
  89. package/dist/types/interface/api/responses/service-version.response.js +3 -0
  90. package/dist/types/interface/api/responses/service-version.response.js.map +1 -0
  91. package/dist/types/interface/api/responses/service.response.d.ts +23 -0
  92. package/dist/types/interface/api/responses/service.response.js +3 -0
  93. package/dist/types/interface/api/responses/service.response.js.map +1 -0
  94. package/dist/types/interface/models/index.d.ts +5 -2
  95. package/dist/types/interface/models/index.js +5 -2
  96. package/dist/types/interface/models/index.js.map +1 -1
  97. package/dist/types/interface/models/reflex-function.model.d.ts +1 -0
  98. package/dist/types/interface/models/reflex-route.model.d.ts +12 -0
  99. package/dist/types/interface/models/reflex-route.model.js +3 -0
  100. package/dist/types/interface/models/reflex-route.model.js.map +1 -0
  101. package/dist/types/interface/models/reflex-run.model.d.ts +1 -1
  102. package/dist/types/interface/models/reflex-service-configuration.model.d.ts +9 -0
  103. package/dist/types/interface/models/reflex-service-configuration.model.js +3 -0
  104. package/dist/types/interface/models/reflex-service-configuration.model.js.map +1 -0
  105. package/dist/types/interface/models/reflex-service-deployment.model.d.ts +20 -0
  106. package/dist/types/interface/models/reflex-service-deployment.model.js +3 -0
  107. package/dist/types/interface/models/reflex-service-deployment.model.js.map +1 -0
  108. package/dist/types/interface/models/reflex-service-version.model.d.ts +30 -0
  109. package/dist/types/interface/models/reflex-service-version.model.js +3 -0
  110. package/dist/types/interface/models/reflex-service-version.model.js.map +1 -0
  111. package/dist/types/interface/models/reflex-service.model.d.ts +31 -0
  112. package/dist/types/interface/models/reflex-service.model.js +13 -0
  113. package/dist/types/interface/models/reflex-service.model.js.map +1 -0
  114. package/package.json +1 -1
  115. package/src/api/function-run.api.ts +1 -1
  116. package/src/api/function-test.api.ts +34 -34
  117. package/src/api/function-version.api.ts +4 -12
  118. package/src/api/function.api.test.ts +249 -311
  119. package/src/api/index.ts +12 -9
  120. package/src/api/service-configuration.api.ts +16 -0
  121. package/src/api/service-deployment.api.ts +79 -0
  122. package/src/api/service-route.api.ts +72 -0
  123. package/src/api/service-version.api.ts +39 -0
  124. package/src/api/service.api.test.ts +209 -0
  125. package/src/api/service.api.ts +55 -0
  126. package/src/index.ts +64 -26
  127. package/src/types/enum/configuration-read-as.enum.ts +5 -0
  128. package/src/types/enum/execution-mode.enum.ts +1 -1
  129. package/src/types/enum/index.ts +21 -14
  130. package/src/types/enum/reflex-error-code.enum.ts +25 -19
  131. package/src/types/enum/route-method.enum.ts +9 -0
  132. package/src/types/enum/service-deployment-action.enum.ts +11 -0
  133. package/src/types/enum/service-deployment-status.enum.ts +5 -0
  134. package/src/types/enum/service-type.enum.ts +7 -0
  135. package/src/types/enum/service-version-change-kind.enum.ts +6 -0
  136. package/src/types/enum/trigger-access-mode.enum.ts +1 -1
  137. package/src/types/enum/vault-value-source.enum.ts +12 -0
  138. package/src/types/enum/vault-visibility.enum.ts +5 -0
  139. package/src/types/interface/api/requests/function-run.request.ts +1 -1
  140. package/src/types/interface/api/requests/function-settings.request.ts +27 -27
  141. package/src/types/interface/api/requests/function-test.request.ts +24 -24
  142. package/src/types/interface/api/requests/function-version.request.ts +20 -25
  143. package/src/types/interface/api/requests/function.request.ts +2 -0
  144. package/src/types/interface/api/requests/index.ts +11 -8
  145. package/src/types/interface/api/requests/service-configuration.request.ts +4 -0
  146. package/src/types/interface/api/requests/service-deployment.request.ts +49 -0
  147. package/src/types/interface/api/requests/service-route.request.ts +44 -0
  148. package/src/types/interface/api/requests/service-version.request.ts +19 -0
  149. package/src/types/interface/api/requests/service.request.ts +39 -0
  150. package/src/types/interface/api/responses/function-settings.response.ts +36 -36
  151. package/src/types/interface/api/responses/function-version.response.ts +0 -5
  152. package/src/types/interface/api/responses/index.ts +11 -8
  153. package/src/types/interface/api/responses/service-configuration.response.ts +8 -0
  154. package/src/types/interface/api/responses/service-deployment.response.ts +32 -0
  155. package/src/types/interface/api/responses/service-route.response.ts +31 -0
  156. package/src/types/interface/api/responses/service-version.response.ts +33 -0
  157. package/src/types/interface/api/responses/service.response.ts +31 -0
  158. package/src/types/interface/models/index.ts +13 -10
  159. package/src/types/interface/models/reflex-execution-settings.model.ts +50 -50
  160. package/src/types/interface/models/reflex-function.model.ts +2 -0
  161. package/src/types/interface/models/reflex-route.model.ts +19 -0
  162. package/src/types/interface/models/reflex-run.model.ts +164 -164
  163. package/src/types/interface/models/reflex-service-configuration.model.ts +22 -0
  164. package/src/types/interface/models/reflex-service-deployment.model.ts +29 -0
  165. package/src/types/interface/models/reflex-service-version.model.ts +43 -0
  166. package/src/types/interface/models/reflex-service.model.ts +43 -0
  167. package/dist/api/function-promotion.api.d.ts +0 -4
  168. package/dist/api/function-promotion.api.js +0 -12
  169. package/dist/api/function-promotion.api.js.map +0 -1
  170. package/dist/api/function-trigger.api.d.ts +0 -5
  171. package/dist/api/function-trigger.api.js +0 -14
  172. package/dist/api/function-trigger.api.js.map +0 -1
  173. package/dist/types/enum/trigger-type.enum.d.ts +0 -3
  174. package/dist/types/enum/trigger-type.enum.js +0 -8
  175. package/dist/types/enum/trigger-type.enum.js.map +0 -1
  176. package/dist/types/interface/api/requests/function-promotion.request.d.ts +0 -20
  177. package/dist/types/interface/api/requests/function-promotion.request.js.map +0 -1
  178. package/dist/types/interface/api/requests/function-trigger.request.d.ts +0 -23
  179. package/dist/types/interface/api/requests/function-trigger.request.js.map +0 -1
  180. package/dist/types/interface/api/responses/function-promotion.response.d.ts +0 -14
  181. package/dist/types/interface/api/responses/function-promotion.response.js.map +0 -1
  182. package/dist/types/interface/api/responses/function-trigger.response.d.ts +0 -18
  183. package/dist/types/interface/api/responses/function-trigger.response.js.map +0 -1
  184. package/dist/types/interface/models/reflex-environment-pointer.model.d.ts +0 -13
  185. package/dist/types/interface/models/reflex-environment-pointer.model.js +0 -3
  186. package/dist/types/interface/models/reflex-environment-pointer.model.js.map +0 -1
  187. package/dist/types/interface/models/reflex-trigger.model.d.ts +0 -13
  188. package/dist/types/interface/models/reflex-trigger.model.js.map +0 -1
  189. package/src/api/function-promotion.api.ts +0 -42
  190. package/src/api/function-trigger.api.ts +0 -52
  191. package/src/types/enum/trigger-type.enum.ts +0 -4
  192. package/src/types/interface/api/requests/function-promotion.request.ts +0 -25
  193. package/src/types/interface/api/requests/function-trigger.request.ts +0 -28
  194. package/src/types/interface/api/responses/function-promotion.response.ts +0 -18
  195. package/src/types/interface/api/responses/function-trigger.response.ts +0 -24
  196. package/src/types/interface/models/reflex-environment-pointer.model.ts +0 -18
  197. package/src/types/interface/models/reflex-trigger.model.ts +0 -17
@@ -0,0 +1,31 @@
1
+ import type { IReflexRoute } from '../../models';
2
+ import type { IResponse } from '../response';
3
+
4
+ export interface IListServiceRouteData {
5
+ routes: IReflexRoute[];
6
+ }
7
+ export type IListServiceRouteResponse = IResponse<IListServiceRouteData>;
8
+
9
+ export interface ICreateServiceRouteData {
10
+ route: IReflexRoute;
11
+ /** The API key (API_KEY) or the signing secret (SIGNATURE), in clear, ONCE. `null` for PUBLIC. */
12
+ secret: string | null;
13
+ }
14
+ export type ICreateServiceRouteResponse = IResponse<ICreateServiceRouteData>;
15
+
16
+ export interface IUpdateServiceRouteData {
17
+ route: IReflexRoute;
18
+ /** A new key or signing secret, in clear, ONCE, when the change of `accessMode` needs one; `null` otherwise. */
19
+ secret: string | null;
20
+ }
21
+ export type IUpdateServiceRouteResponse = IResponse<IUpdateServiceRouteData>;
22
+
23
+ export type IDeleteServiceRouteData = Record<string, never>;
24
+ export type IDeleteServiceRouteResponse = IResponse<IDeleteServiceRouteData>;
25
+
26
+ export interface IRotateServiceRouteData {
27
+ route: IReflexRoute;
28
+ /** The new key or signing secret, in clear, ONCE; the previous one stops working at once. */
29
+ secret: string;
30
+ }
31
+ export type IRotateServiceRouteResponse = IResponse<IRotateServiceRouteData>;
@@ -0,0 +1,33 @@
1
+ import type { ServiceVersionChangeKind } from '../../../enum';
2
+ import type { IReflexServiceVersion, IReflexServiceVersionRoute } from '../../models';
3
+ import type { IResponse } from '../response';
4
+
5
+ /** How one route differs from the previous version, matched by route id. */
6
+ export interface IReflexServiceVersionRouteChange {
7
+ routeId: string;
8
+ kind: ServiceVersionChangeKind;
9
+ /** The route in the previous version; null when ADDED. */
10
+ before: IReflexServiceVersionRoute | null;
11
+ /** The route in this version; null when REMOVED. */
12
+ after: IReflexServiceVersionRoute | null;
13
+ }
14
+
15
+ export interface IListServiceVersionData {
16
+ /** Newest first. */
17
+ versions: IReflexServiceVersion[];
18
+ }
19
+ export type IListServiceVersionResponse = IResponse<IListServiceVersionData>;
20
+
21
+ export interface ICreateServiceVersionData {
22
+ version: IReflexServiceVersion;
23
+ }
24
+ export type ICreateServiceVersionResponse = IResponse<ICreateServiceVersionData>;
25
+
26
+ export interface IGetServiceVersionData {
27
+ version: IReflexServiceVersion;
28
+ /** The version just before; null for the first one. */
29
+ previousVersion: IReflexServiceVersion | null;
30
+ /** The routes added, removed or modified since `previousVersion` (every route is ADDED for the first one). */
31
+ routeChanges: IReflexServiceVersionRouteChange[];
32
+ }
33
+ export type IGetServiceVersionResponse = IResponse<IGetServiceVersionData>;
@@ -0,0 +1,31 @@
1
+ import type { IReflexService, IReflexServiceDeployment } from '../../models';
2
+ import type { IResponse } from '../response';
3
+
4
+ /** A Service with what runs in each environment of the application. */
5
+ export interface IReflexServiceListItem extends IReflexService {
6
+ /** The current deployment of each environment where the Service was ever put in service. */
7
+ currentDeployments: IReflexServiceDeployment[];
8
+ }
9
+
10
+ export interface IListServiceData {
11
+ services: IReflexServiceListItem[];
12
+ }
13
+ export type IListServiceResponse = IResponse<IListServiceData>;
14
+
15
+ export interface ICreateServiceData {
16
+ service: IReflexService;
17
+ }
18
+ export type ICreateServiceResponse = IResponse<ICreateServiceData>;
19
+
20
+ export interface IGetServiceData {
21
+ service: IReflexService;
22
+ }
23
+ export type IGetServiceResponse = IResponse<IGetServiceData>;
24
+
25
+ export interface IUpdateServiceData {
26
+ service: IReflexService;
27
+ }
28
+ export type IUpdateServiceResponse = IResponse<IUpdateServiceData>;
29
+
30
+ export type IDeleteServiceData = Record<string, never>;
31
+ export type IDeleteServiceResponse = IResponse<IDeleteServiceData>;
@@ -1,10 +1,13 @@
1
- export * from './reflex-definition.model';
2
- export * from './reflex-function.model';
3
- export * from './reflex-function-version.model';
4
- export * from './reflex-environment-pointer.model';
5
- export * from './reflex-trigger.model';
6
- export * from './reflex-access-grant.model';
7
- export * from './reflex-run.model';
8
- export * from './reflex-execution-settings.model';
9
- export * from './reflex-step-stats.model';
10
- export * from './reflex-price-list.model';
1
+ export * from './reflex-definition.model';
2
+ export * from './reflex-function.model';
3
+ export * from './reflex-function-version.model';
4
+ export * from './reflex-access-grant.model';
5
+ export * from './reflex-run.model';
6
+ export * from './reflex-execution-settings.model';
7
+ export * from './reflex-step-stats.model';
8
+ export * from './reflex-price-list.model';
9
+ export * from './reflex-service.model';
10
+ export * from './reflex-route.model';
11
+ export * from './reflex-service-version.model';
12
+ export * from './reflex-service-deployment.model';
13
+ export * from './reflex-service-configuration.model';
@@ -1,50 +1,50 @@
1
- import { ExecutionMode, ExecutionProfile } from '../../enum';
2
- import type { ExecutionSettingsSource } from '../../enum';
3
-
4
- /** The execution settings of a function in an environment. */
5
- export interface IReflexExecutionSettingsValues {
6
- profile: ExecutionProfile;
7
- /** Past this, a synchronous caller that got no answer receives 504 and the execution goes on. */
8
- responseTimeoutMs: number;
9
- /** Past this, the execution is stopped with TIMEOUT. */
10
- maxDurationMs: number;
11
- mode: ExecutionMode;
12
- }
13
-
14
- /** Bounds of the settings, in milliseconds. */
15
- export const REFLEX_EXECUTION_SETTINGS_LIMITS = {
16
- responseTimeoutMs: { min: 1_000, max: 100_000 },
17
- maxDurationMs: { min: 1_000, max: 3_600_000 },
18
- } as const;
19
-
20
- /** What a function runs with when nothing is set. */
21
- export const DEFAULT_REFLEX_EXECUTION_SETTINGS: Readonly<IReflexExecutionSettingsValues> = {
22
- profile: ExecutionProfile.S,
23
- responseTimeoutMs: 30_000,
24
- maxDurationMs: 30_000,
25
- mode: ExecutionMode.SYNC,
26
- };
27
-
28
- /** A row of settings: the default of the function (`environmentId` null) or the override of one environment. */
29
- export interface IReflexExecutionSettings extends IReflexExecutionSettingsValues {
30
- id: string;
31
- functionId: string;
32
- /** An environment of the application (abyss-main's id); null for the default of every environment. */
33
- environmentId: string | null;
34
- updatedByUserId: string;
35
- createdAt: Date;
36
- updatedAt: Date;
37
- }
38
-
39
- /** What one environment of the application runs with. */
40
- export interface IReflexEffectiveExecutionSettings {
41
- environmentId: string;
42
- /** The name of the environment (abyss-main), immutable. */
43
- environmentSlug: string;
44
- /** Changing what a production environment runs with needs REFLEX_PUBLISH_PRODUCTION. */
45
- isProduction: boolean;
46
- source: ExecutionSettingsSource;
47
- settings: IReflexExecutionSettingsValues;
48
- /** The version promoted in this environment, whose step statistics drive the profile warning; null when none. */
49
- runningVersionId: string | null;
50
- }
1
+ import { ExecutionMode, ExecutionProfile } from '../../enum';
2
+ import type { ExecutionSettingsSource } from '../../enum';
3
+
4
+ /** The execution settings of a function in an environment. */
5
+ export interface IReflexExecutionSettingsValues {
6
+ profile: ExecutionProfile;
7
+ /** Past this, a synchronous caller that got no answer receives 504 and the execution goes on. */
8
+ responseTimeoutMs: number;
9
+ /** Past this, the execution is stopped with TIMEOUT. */
10
+ maxDurationMs: number;
11
+ mode: ExecutionMode;
12
+ }
13
+
14
+ /** Bounds of the settings, in milliseconds. */
15
+ export const REFLEX_EXECUTION_SETTINGS_LIMITS = {
16
+ responseTimeoutMs: { min: 1_000, max: 100_000 },
17
+ maxDurationMs: { min: 1_000, max: 3_600_000 },
18
+ } as const;
19
+
20
+ /** What a function runs with when nothing is set. */
21
+ export const DEFAULT_REFLEX_EXECUTION_SETTINGS: Readonly<IReflexExecutionSettingsValues> = {
22
+ profile: ExecutionProfile.S,
23
+ responseTimeoutMs: 30_000,
24
+ maxDurationMs: 30_000,
25
+ mode: ExecutionMode.SYNC,
26
+ };
27
+
28
+ /** A row of settings: the default of the function (`environmentId` null) or the override of one environment. */
29
+ export interface IReflexExecutionSettings extends IReflexExecutionSettingsValues {
30
+ id: string;
31
+ functionId: string;
32
+ /** An environment of the application (abyss-main's id); null for the default of every environment. */
33
+ environmentId: string | null;
34
+ updatedByUserId: string;
35
+ createdAt: Date;
36
+ updatedAt: Date;
37
+ }
38
+
39
+ /** What one environment of the application runs with. */
40
+ export interface IReflexEffectiveExecutionSettings {
41
+ environmentId: string;
42
+ /** The name of the environment (abyss-main), immutable. */
43
+ environmentSlug: string;
44
+ /** Changing what a production environment runs with needs REFLEX_PUBLISH_PRODUCTION. */
45
+ isProduction: boolean;
46
+ source: ExecutionSettingsSource;
47
+ settings: IReflexExecutionSettingsValues;
48
+ /** The version promoted in this environment, whose step statistics drive the profile warning; null when none. */
49
+ runningVersionId: string | null;
50
+ }
@@ -3,6 +3,8 @@ import type { IReflexDefinition } from './reflex-definition.model';
3
3
  export interface IReflexFunction {
4
4
  id: string;
5
5
  applicationId: string;
6
+ /** The Service the function belongs to; deleting the Service deletes it. */
7
+ serviceId: string;
6
8
  projectId: string;
7
9
  name: string;
8
10
  /** The definition being edited; a publication freezes a copy of it. */
@@ -0,0 +1,19 @@
1
+ import type { RouteMethod, TriggerAccessMode } from '../../enum';
2
+
3
+ /**
4
+ * A route of the draft of a Service: callable only once a version that holds it is in service in the
5
+ * environment. Never carries the key or the signing secret: they are shown once, when created or rotated.
6
+ */
7
+ export interface IReflexRoute {
8
+ id: string;
9
+ serviceId: string;
10
+ /** A function of the same Service. */
11
+ functionId: string;
12
+ method: RouteMethod;
13
+ /** Segments of `[a-z0-9._~-]` or `:param` joined by `/`, without leading or trailing slash; 20 at most. */
14
+ path: string;
15
+ accessMode: TriggerAccessMode;
16
+ createdByUserId: string;
17
+ createdAt: Date;
18
+ updatedAt: Date;
19
+ }
@@ -1,164 +1,164 @@
1
- import type {
2
- ExecutionMode,
3
- ExecutionProfile,
4
- RunLogLevel,
5
- RunMode,
6
- RunStatus,
7
- RunStepStatus,
8
- TraceEffectType,
9
- } from '../../enum';
10
-
11
- export interface IReflexTraceError {
12
- code: string;
13
- message: string;
14
- }
15
-
16
- /**
17
- * One call the run made to the host, in the order they were served. `recorded` is true when the effect
18
- * was recorded instead of executed (a stubbed HTTP call, a Store write kept aside, a wait not waited).
19
- */
20
- export interface IReflexTraceEntry {
21
- stepId: string;
22
- type: TraceEffectType;
23
- /** The host action, for a HOST effect. */
24
- action?: string;
25
- request?: unknown;
26
- response?: unknown;
27
- error?: IReflexTraceError;
28
- recorded: boolean;
29
- }
30
-
31
- /** What the RESPOND step (or `abyss.respond`) built: the response the caller of the trigger would get. */
32
- export interface IReflexTraceResponse {
33
- status: number;
34
- headers: Record<string, string>;
35
- body: unknown;
36
- }
37
-
38
- /**
39
- * Bounded: past 100 entries, or a value of more than 4 KB, the trace is cut and says so (`truncated`).
40
- * Every secret value the run was given or read is masked (`***`).
41
- */
42
- export interface IReflexRunTrace {
43
- entries: IReflexTraceEntry[];
44
- outcome: {
45
- status: RunStatus;
46
- output?: unknown;
47
- error?: IReflexTraceError & { stepId?: string };
48
- };
49
- response?: IReflexTraceResponse;
50
- truncated: boolean;
51
- }
52
-
53
- export interface IReflexRun {
54
- id: string;
55
- functionId: string;
56
- versionId: string | null;
57
- /**
58
- * The environment the run took place in: the promoted version's for a LIVE run, the one named in the
59
- * request for a test run. Null only for a test run recorded before test runs named an environment.
60
- */
61
- environmentId: string | null;
62
- mode: RunMode;
63
- status: RunStatus;
64
- durationMs: number;
65
- /** The effects of a test run; null for a LIVE run, which records no trace (nothing of the caller is kept). */
66
- trace: IReflexRunTrace | null;
67
- /** The trigger that started a LIVE run; null for a test run. */
68
- triggerId: string | null;
69
- /** The HTTP status the caller of a LIVE run got; null for a test run. */
70
- httpStatus: number | null;
71
- /** 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. */
72
- errorCode: string | null;
73
- /** The mode of the trigger that started a LIVE run; null for a test run. */
74
- executionMode: ExecutionMode | null;
75
- /** When the caller of a LIVE run got its answer; null for a test run, or before any answer. */
76
- responseSentAt: Date | null;
77
- /**
78
- * What the run consumed and cost: measured by the runner for a live run and for a test run (with the
79
- * function's effective settings in the run's environment, and the network of its stubs); null for a running execution, or a run
80
- * recorded before the measures.
81
- */
82
- metrics: IReflexRunMetrics | null;
83
- createdByUserId: string | null;
84
- createdAt: Date;
85
- }
86
-
87
- /** What a live execution consumed, and what it costs (ADR-0244). */
88
- export interface IReflexRunMetrics {
89
- /** The profile it ran with, and the memory that profile allocates. */
90
- profile: ExecutionProfile;
91
- memoryLimitMb: number;
92
- /** Measured by the runner in the isolate. */
93
- cpuMs: number;
94
- heapPeakBytes: number;
95
- /** Measured by the host: bytes sent and received by `fetch`, plus the answer sent to the caller. */
96
- netOutBytes: number;
97
- netInBytes: number;
98
- httpCalls: number;
99
- storeWrites: number;
100
- /** In thousandths of a credit; 0 for an interrupted execution, which is offered. */
101
- costMillicredits: number;
102
- }
103
-
104
- /** What one step of a run consumed; its cost is its share of the run's, the fixed price aside. */
105
- export interface IReflexRunStep {
106
- /** 0 for the first step that ran. */
107
- position: number;
108
- stepId: string;
109
- status: RunStepStatus;
110
- durationMs: number;
111
- cpuMs: number;
112
- heapPeakBytes: number;
113
- netOutBytes: number;
114
- netInBytes: number;
115
- httpCalls: number;
116
- storeWrites: number;
117
- costMillicredits: number;
118
- }
119
-
120
- /**
121
- * One log line a run wrote: a LOG step, `abyss.log.*` or `console.*`. Secrets masked (`***`); a message
122
- * is cut at 2048 characters, and data whose JSON is longer becomes `{ truncated: true, preview }`. At most
123
- * 100 lines per run are kept; `IReflexRunDetail.droppedLogLines` counts the others.
124
- */
125
- export interface IReflexRunLog {
126
- /** 0 for the first line. */
127
- position: number;
128
- /** The step that wrote it. */
129
- stepId: string;
130
- level: RunLogLevel;
131
- message: string;
132
- /** The value given with the message; null when none was. */
133
- data: unknown;
134
- loggedAt: Date;
135
- }
136
-
137
- /**
138
- * One run with the steps it ran and the lines it logged, in order. Both are empty for a run recorded
139
- * before the measures (and the steps for a running execution).
140
- */
141
- export interface IReflexRunDetail extends IReflexRun {
142
- steps: IReflexRunStep[];
143
- logs: IReflexRunLog[];
144
- /** The log lines written past the 100 kept in `logs`; 0 when none was dropped. */
145
- droppedLogLines: number;
146
- }
147
-
148
- /** The state of a live execution, read by its id (the `executionId` an async trigger answers with). */
149
- export interface IReflexExecutionState {
150
- id: string;
151
- status: RunStatus;
152
- executionMode: ExecutionMode;
153
- startedAt: Date;
154
- /** When the caller got its answer; for an async execution, the 202. */
155
- responseSentAt: Date | null;
156
- /** Null while it runs. */
157
- finishedAt: Date | null;
158
- /** The status the caller got. */
159
- httpStatus: number;
160
- /** Set when the execution failed. */
161
- errorCode: string | null;
162
- /** Null while it runs, or for an execution recorded before the measures. */
163
- costMillicredits: number | null;
164
- }
1
+ import type {
2
+ ExecutionMode,
3
+ ExecutionProfile,
4
+ RunLogLevel,
5
+ RunMode,
6
+ RunStatus,
7
+ RunStepStatus,
8
+ TraceEffectType,
9
+ } from '../../enum';
10
+
11
+ export interface IReflexTraceError {
12
+ code: string;
13
+ message: string;
14
+ }
15
+
16
+ /**
17
+ * One call the run made to the host, in the order they were served. `recorded` is true when the effect
18
+ * was recorded instead of executed (a stubbed HTTP call, a Store write kept aside, a wait not waited).
19
+ */
20
+ export interface IReflexTraceEntry {
21
+ stepId: string;
22
+ type: TraceEffectType;
23
+ /** The host action, for a HOST effect. */
24
+ action?: string;
25
+ request?: unknown;
26
+ response?: unknown;
27
+ error?: IReflexTraceError;
28
+ recorded: boolean;
29
+ }
30
+
31
+ /** What the RESPOND step (or `abyss.respond`) built: the response the caller of the route would get. */
32
+ export interface IReflexTraceResponse {
33
+ status: number;
34
+ headers: Record<string, string>;
35
+ body: unknown;
36
+ }
37
+
38
+ /**
39
+ * Bounded: past 100 entries, or a value of more than 4 KB, the trace is cut and says so (`truncated`).
40
+ * Every secret value the run was given or read is masked (`***`).
41
+ */
42
+ export interface IReflexRunTrace {
43
+ entries: IReflexTraceEntry[];
44
+ outcome: {
45
+ status: RunStatus;
46
+ output?: unknown;
47
+ error?: IReflexTraceError & { stepId?: string };
48
+ };
49
+ response?: IReflexTraceResponse;
50
+ truncated: boolean;
51
+ }
52
+
53
+ export interface IReflexRun {
54
+ id: string;
55
+ functionId: string;
56
+ versionId: string | null;
57
+ /**
58
+ * The environment the run took place in: the promoted version's for a LIVE run, the one named in the
59
+ * request for a test run. Null only for a test run recorded before test runs named an environment.
60
+ */
61
+ environmentId: string | null;
62
+ mode: RunMode;
63
+ status: RunStatus;
64
+ durationMs: number;
65
+ /** The effects of a test run; null for a LIVE run, which records no trace (nothing of the caller is kept). */
66
+ trace: IReflexRunTrace | null;
67
+ /** The route that started a LIVE run; null for a test run. */
68
+ routeId: string | null;
69
+ /** The HTTP status the caller of a LIVE run got; null for a test run. */
70
+ httpStatus: number | null;
71
+ /** 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. */
72
+ errorCode: string | null;
73
+ /** The execution mode of the function when a LIVE run started; null for a test run. */
74
+ executionMode: ExecutionMode | null;
75
+ /** When the caller of a LIVE run got its answer; null for a test run, or before any answer. */
76
+ responseSentAt: Date | null;
77
+ /**
78
+ * What the run consumed and cost: measured by the runner for a live run and for a test run (with the
79
+ * function's effective settings in the run's environment, and the network of its stubs); null for a running execution, or a run
80
+ * recorded before the measures.
81
+ */
82
+ metrics: IReflexRunMetrics | null;
83
+ createdByUserId: string | null;
84
+ createdAt: Date;
85
+ }
86
+
87
+ /** What a live execution consumed, and what it costs (ADR-0244). */
88
+ export interface IReflexRunMetrics {
89
+ /** The profile it ran with, and the memory that profile allocates. */
90
+ profile: ExecutionProfile;
91
+ memoryLimitMb: number;
92
+ /** Measured by the runner in the isolate. */
93
+ cpuMs: number;
94
+ heapPeakBytes: number;
95
+ /** Measured by the host: bytes sent and received by `fetch`, plus the answer sent to the caller. */
96
+ netOutBytes: number;
97
+ netInBytes: number;
98
+ httpCalls: number;
99
+ storeWrites: number;
100
+ /** In thousandths of a credit; 0 for an interrupted execution, which is offered. */
101
+ costMillicredits: number;
102
+ }
103
+
104
+ /** What one step of a run consumed; its cost is its share of the run's, the fixed price aside. */
105
+ export interface IReflexRunStep {
106
+ /** 0 for the first step that ran. */
107
+ position: number;
108
+ stepId: string;
109
+ status: RunStepStatus;
110
+ durationMs: number;
111
+ cpuMs: number;
112
+ heapPeakBytes: number;
113
+ netOutBytes: number;
114
+ netInBytes: number;
115
+ httpCalls: number;
116
+ storeWrites: number;
117
+ costMillicredits: number;
118
+ }
119
+
120
+ /**
121
+ * One log line a run wrote: a LOG step, `abyss.log.*` or `console.*`. Secrets masked (`***`); a message
122
+ * is cut at 2048 characters, and data whose JSON is longer becomes `{ truncated: true, preview }`. At most
123
+ * 100 lines per run are kept; `IReflexRunDetail.droppedLogLines` counts the others.
124
+ */
125
+ export interface IReflexRunLog {
126
+ /** 0 for the first line. */
127
+ position: number;
128
+ /** The step that wrote it. */
129
+ stepId: string;
130
+ level: RunLogLevel;
131
+ message: string;
132
+ /** The value given with the message; null when none was. */
133
+ data: unknown;
134
+ loggedAt: Date;
135
+ }
136
+
137
+ /**
138
+ * One run with the steps it ran and the lines it logged, in order. Both are empty for a run recorded
139
+ * before the measures (and the steps for a running execution).
140
+ */
141
+ export interface IReflexRunDetail extends IReflexRun {
142
+ steps: IReflexRunStep[];
143
+ logs: IReflexRunLog[];
144
+ /** The log lines written past the 100 kept in `logs`; 0 when none was dropped. */
145
+ droppedLogLines: number;
146
+ }
147
+
148
+ /** The state of a live execution, read by its id (the `executionId` an async route answers with). */
149
+ export interface IReflexExecutionState {
150
+ id: string;
151
+ status: RunStatus;
152
+ executionMode: ExecutionMode;
153
+ startedAt: Date;
154
+ /** When the caller got its answer; for an async execution, the 202. */
155
+ responseSentAt: Date | null;
156
+ /** Null while it runs. */
157
+ finishedAt: Date | null;
158
+ /** The status the caller got. */
159
+ httpStatus: number;
160
+ /** Set when the execution failed. */
161
+ errorCode: string | null;
162
+ /** Null while it runs, or for an execution recorded before the measures. */
163
+ costMillicredits: number | null;
164
+ }
@@ -0,0 +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
+ }
@@ -0,0 +1,29 @@
1
+ import type { ServiceDeploymentAction, ServiceDeploymentStatus } from '../../enum';
2
+ import type { IReflexAccessDeclaration } from './reflex-definition.model';
3
+
4
+ /** The accesses granted to one member function when the gesture was made: what the execution plane holds. */
5
+ export interface IReflexServiceDeploymentGrant {
6
+ functionId: string;
7
+ grants: IReflexAccessDeclaration[];
8
+ }
9
+
10
+ /**
11
+ * One gesture on the Service in an environment of the application. The `isCurrent` row is what runs (or
12
+ * is paused) there; the others are the history a rollback reads.
13
+ */
14
+ export interface IReflexServiceDeployment {
15
+ id: string;
16
+ serviceId: string;
17
+ /** The environment of the application (abyss-main's id). */
18
+ environmentId: string;
19
+ /** The name of that environment, second segment of the address. */
20
+ environmentSlug: string;
21
+ serviceVersionId: string;
22
+ serviceVersionNumber: number;
23
+ action: ServiceDeploymentAction;
24
+ status: ServiceDeploymentStatus;
25
+ grants: IReflexServiceDeploymentGrant[];
26
+ isCurrent: boolean;
27
+ byUserId: string;
28
+ at: Date;
29
+ }