@abyss-project/reflex 0.0.0-stage → 1.1.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 (245) hide show
  1. package/.eslintrc.js +32 -0
  2. package/.prettierrc +5 -0
  3. package/README.md +15 -3
  4. package/dist/api/function-access.api.d.ts +4 -0
  5. package/dist/api/function-access.api.js +12 -0
  6. package/dist/api/function-access.api.js.map +1 -0
  7. package/dist/api/function-promotion.api.d.ts +4 -0
  8. package/dist/api/function-promotion.api.js +12 -0
  9. package/dist/api/function-promotion.api.js.map +1 -0
  10. package/dist/api/function-run.api.d.ts +4 -0
  11. package/dist/api/function-run.api.js +14 -0
  12. package/dist/api/function-run.api.js.map +1 -0
  13. package/dist/api/function-settings.api.d.ts +5 -0
  14. package/dist/api/function-settings.api.js +15 -0
  15. package/dist/api/function-settings.api.js.map +1 -0
  16. package/dist/api/function-test.api.d.ts +3 -0
  17. package/dist/api/function-test.api.js +12 -0
  18. package/dist/api/function-test.api.js.map +1 -0
  19. package/dist/api/function-trigger.api.d.ts +5 -0
  20. package/dist/api/function-trigger.api.js +14 -0
  21. package/dist/api/function-trigger.api.js.map +1 -0
  22. package/dist/api/function-version.api.d.ts +5 -0
  23. package/dist/api/function-version.api.js +14 -0
  24. package/dist/api/function-version.api.js.map +1 -0
  25. package/dist/api/function.api.d.ts +6 -0
  26. package/dist/api/function.api.js +16 -0
  27. package/dist/api/function.api.js.map +1 -0
  28. package/dist/api/health.api.d.ts +2 -0
  29. package/dist/api/health.api.js +7 -0
  30. package/dist/api/health.api.js.map +1 -0
  31. package/dist/api/index.d.ts +9 -0
  32. package/dist/api/index.js +26 -0
  33. package/dist/api/index.js.map +1 -0
  34. package/dist/index.d.ts +70 -0
  35. package/dist/index.js +131 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/types/enum/access-grant-status.enum.d.ts +5 -0
  38. package/dist/types/enum/access-grant-status.enum.js +10 -0
  39. package/dist/types/enum/access-grant-status.enum.js.map +1 -0
  40. package/dist/types/enum/access-kind.enum.d.ts +4 -0
  41. package/dist/types/enum/access-kind.enum.js +9 -0
  42. package/dist/types/enum/access-kind.enum.js.map +1 -0
  43. package/dist/types/enum/execution-mode.enum.d.ts +4 -0
  44. package/dist/types/enum/execution-mode.enum.js +9 -0
  45. package/dist/types/enum/execution-mode.enum.js.map +1 -0
  46. package/dist/types/enum/execution-profile.enum.d.ts +8 -0
  47. package/dist/types/enum/execution-profile.enum.js +19 -0
  48. package/dist/types/enum/execution-profile.enum.js.map +1 -0
  49. package/dist/types/enum/execution-settings-source.enum.d.ts +5 -0
  50. package/dist/types/enum/execution-settings-source.enum.js +10 -0
  51. package/dist/types/enum/execution-settings-source.enum.js.map +1 -0
  52. package/dist/types/enum/health-status.enum.d.ts +4 -0
  53. package/dist/types/enum/health-status.enum.js +9 -0
  54. package/dist/types/enum/health-status.enum.js.map +1 -0
  55. package/dist/types/enum/index.d.ts +14 -0
  56. package/dist/types/enum/index.js +31 -0
  57. package/dist/types/enum/index.js.map +1 -0
  58. package/dist/types/enum/reflex-error-code.enum.d.ts +10 -0
  59. package/dist/types/enum/reflex-error-code.enum.js +15 -0
  60. package/dist/types/enum/reflex-error-code.enum.js.map +1 -0
  61. package/dist/types/enum/run-log-level.enum.d.ts +5 -0
  62. package/dist/types/enum/run-log-level.enum.js +10 -0
  63. package/dist/types/enum/run-log-level.enum.js.map +1 -0
  64. package/dist/types/enum/run-mode.enum.d.ts +5 -0
  65. package/dist/types/enum/run-mode.enum.js +10 -0
  66. package/dist/types/enum/run-mode.enum.js.map +1 -0
  67. package/dist/types/enum/run-status.enum.d.ts +6 -0
  68. package/dist/types/enum/run-status.enum.js +11 -0
  69. package/dist/types/enum/run-status.enum.js.map +1 -0
  70. package/dist/types/enum/run-step-status.enum.d.ts +5 -0
  71. package/dist/types/enum/run-step-status.enum.js +10 -0
  72. package/dist/types/enum/run-step-status.enum.js.map +1 -0
  73. package/dist/types/enum/trace-effect-type.enum.d.ts +5 -0
  74. package/dist/types/enum/trace-effect-type.enum.js +10 -0
  75. package/dist/types/enum/trace-effect-type.enum.js.map +1 -0
  76. package/dist/types/enum/trigger-access-mode.enum.d.ts +5 -0
  77. package/dist/types/enum/trigger-access-mode.enum.js +10 -0
  78. package/dist/types/enum/trigger-access-mode.enum.js.map +1 -0
  79. package/dist/types/enum/trigger-type.enum.d.ts +3 -0
  80. package/dist/types/enum/trigger-type.enum.js +8 -0
  81. package/dist/types/enum/trigger-type.enum.js.map +1 -0
  82. package/dist/types/index.d.ts +2 -0
  83. package/dist/types/index.js +19 -0
  84. package/dist/types/index.js.map +1 -0
  85. package/dist/types/interface/api/index.d.ts +3 -0
  86. package/dist/types/interface/api/index.js +20 -0
  87. package/dist/types/interface/api/index.js.map +1 -0
  88. package/dist/types/interface/api/requests/function-access.request.d.ts +17 -0
  89. package/dist/types/interface/api/requests/function-access.request.js +3 -0
  90. package/dist/types/interface/api/requests/function-access.request.js.map +1 -0
  91. package/dist/types/interface/api/requests/function-promotion.request.d.ts +20 -0
  92. package/dist/types/interface/api/requests/function-promotion.request.js +3 -0
  93. package/dist/types/interface/api/requests/function-promotion.request.js.map +1 -0
  94. package/dist/types/interface/api/requests/function-run.request.d.ts +20 -0
  95. package/dist/types/interface/api/requests/function-run.request.js +3 -0
  96. package/dist/types/interface/api/requests/function-run.request.js.map +1 -0
  97. package/dist/types/interface/api/requests/function-settings.request.d.ts +21 -0
  98. package/dist/types/interface/api/requests/function-settings.request.js +3 -0
  99. package/dist/types/interface/api/requests/function-settings.request.js.map +1 -0
  100. package/dist/types/interface/api/requests/function-test.request.d.ts +14 -0
  101. package/dist/types/interface/api/requests/function-test.request.js +3 -0
  102. package/dist/types/interface/api/requests/function-test.request.js.map +1 -0
  103. package/dist/types/interface/api/requests/function-trigger.request.d.ts +23 -0
  104. package/dist/types/interface/api/requests/function-trigger.request.js +3 -0
  105. package/dist/types/interface/api/requests/function-trigger.request.js.map +1 -0
  106. package/dist/types/interface/api/requests/function-version.request.d.ts +21 -0
  107. package/dist/types/interface/api/requests/function-version.request.js +3 -0
  108. package/dist/types/interface/api/requests/function-version.request.js.map +1 -0
  109. package/dist/types/interface/api/requests/function.request.d.ts +27 -0
  110. package/dist/types/interface/api/requests/function.request.js +3 -0
  111. package/dist/types/interface/api/requests/function.request.js.map +1 -0
  112. package/dist/types/interface/api/requests/index.d.ts +8 -0
  113. package/dist/types/interface/api/requests/index.js +25 -0
  114. package/dist/types/interface/api/requests/index.js.map +1 -0
  115. package/dist/types/interface/api/response.d.ts +3 -0
  116. package/dist/types/interface/api/response.js +3 -0
  117. package/dist/types/interface/api/response.js.map +1 -0
  118. package/dist/types/interface/api/responses/function-access.response.d.ts +14 -0
  119. package/dist/types/interface/api/responses/function-access.response.js +3 -0
  120. package/dist/types/interface/api/responses/function-access.response.js.map +1 -0
  121. package/dist/types/interface/api/responses/function-promotion.response.d.ts +14 -0
  122. package/dist/types/interface/api/responses/function-promotion.response.js +3 -0
  123. package/dist/types/interface/api/responses/function-promotion.response.js.map +1 -0
  124. package/dist/types/interface/api/responses/function-run.response.d.ts +14 -0
  125. package/dist/types/interface/api/responses/function-run.response.js +3 -0
  126. package/dist/types/interface/api/responses/function-run.response.js.map +1 -0
  127. package/dist/types/interface/api/responses/function-settings.response.d.ts +19 -0
  128. package/dist/types/interface/api/responses/function-settings.response.js +3 -0
  129. package/dist/types/interface/api/responses/function-settings.response.js.map +1 -0
  130. package/dist/types/interface/api/responses/function-test.response.d.ts +10 -0
  131. package/dist/types/interface/api/responses/function-test.response.js +3 -0
  132. package/dist/types/interface/api/responses/function-test.response.js.map +1 -0
  133. package/dist/types/interface/api/responses/function-trigger.response.d.ts +18 -0
  134. package/dist/types/interface/api/responses/function-trigger.response.js +3 -0
  135. package/dist/types/interface/api/responses/function-trigger.response.js.map +1 -0
  136. package/dist/types/interface/api/responses/function-version.response.d.ts +23 -0
  137. package/dist/types/interface/api/responses/function-version.response.js +3 -0
  138. package/dist/types/interface/api/responses/function-version.response.js.map +1 -0
  139. package/dist/types/interface/api/responses/function.response.d.ts +20 -0
  140. package/dist/types/interface/api/responses/function.response.js +3 -0
  141. package/dist/types/interface/api/responses/function.response.js.map +1 -0
  142. package/dist/types/interface/api/responses/index.d.ts +8 -0
  143. package/dist/types/interface/api/responses/index.js +25 -0
  144. package/dist/types/interface/api/responses/index.js.map +1 -0
  145. package/dist/types/interface/health.response.d.ts +5 -0
  146. package/dist/types/interface/health.response.js +3 -0
  147. package/dist/types/interface/health.response.js.map +1 -0
  148. package/dist/types/interface/index.d.ts +3 -0
  149. package/dist/types/interface/index.js +20 -0
  150. package/dist/types/interface/index.js.map +1 -0
  151. package/dist/types/interface/models/index.d.ts +9 -0
  152. package/dist/types/interface/models/index.js +26 -0
  153. package/dist/types/interface/models/index.js.map +1 -0
  154. package/dist/types/interface/models/reflex-access-grant.model.d.ts +13 -0
  155. package/dist/types/interface/models/reflex-access-grant.model.js +3 -0
  156. package/dist/types/interface/models/reflex-access-grant.model.js.map +1 -0
  157. package/dist/types/interface/models/reflex-definition.model.d.ts +15 -0
  158. package/dist/types/interface/models/reflex-definition.model.js +3 -0
  159. package/dist/types/interface/models/reflex-definition.model.js.map +1 -0
  160. package/dist/types/interface/models/reflex-environment-pointer.model.d.ts +13 -0
  161. package/dist/types/interface/models/reflex-environment-pointer.model.js +3 -0
  162. package/dist/types/interface/models/reflex-environment-pointer.model.js.map +1 -0
  163. package/dist/types/interface/models/reflex-execution-settings.model.d.ts +36 -0
  164. package/dist/types/interface/models/reflex-execution-settings.model.js +16 -0
  165. package/dist/types/interface/models/reflex-execution-settings.model.js.map +1 -0
  166. package/dist/types/interface/models/reflex-function-version.model.d.ts +10 -0
  167. package/dist/types/interface/models/reflex-function-version.model.js +3 -0
  168. package/dist/types/interface/models/reflex-function-version.model.js.map +1 -0
  169. package/dist/types/interface/models/reflex-function.model.d.ts +12 -0
  170. package/dist/types/interface/models/reflex-function.model.js +3 -0
  171. package/dist/types/interface/models/reflex-function.model.js.map +1 -0
  172. package/dist/types/interface/models/reflex-run.model.d.ts +97 -0
  173. package/dist/types/interface/models/reflex-run.model.js +3 -0
  174. package/dist/types/interface/models/reflex-run.model.js.map +1 -0
  175. package/dist/types/interface/models/reflex-step-stats.model.d.ts +22 -0
  176. package/dist/types/interface/models/reflex-step-stats.model.js +3 -0
  177. package/dist/types/interface/models/reflex-step-stats.model.js.map +1 -0
  178. package/dist/types/interface/models/reflex-trigger.model.d.ts +13 -0
  179. package/dist/types/interface/models/reflex-trigger.model.js +3 -0
  180. package/dist/types/interface/models/reflex-trigger.model.js.map +1 -0
  181. package/jest.config.ts +11 -0
  182. package/package.json +41 -3
  183. package/src/api/function-access.api.ts +36 -0
  184. package/src/api/function-promotion.api.ts +42 -0
  185. package/src/api/function-run.api.ts +38 -0
  186. package/src/api/function-settings.api.ts +59 -0
  187. package/src/api/function-test.api.ts +33 -0
  188. package/src/api/function-trigger.api.ts +52 -0
  189. package/src/api/function-version.api.ts +56 -0
  190. package/src/api/function.api.test.ts +301 -0
  191. package/src/api/function.api.ts +62 -0
  192. package/src/api/health.api.ts +10 -0
  193. package/src/api/index.ts +9 -0
  194. package/src/index.test.ts +50 -0
  195. package/src/index.ts +152 -0
  196. package/src/types/enum/access-grant-status.enum.ts +12 -0
  197. package/src/types/enum/access-kind.enum.ts +7 -0
  198. package/src/types/enum/execution-mode.enum.ts +9 -0
  199. package/src/types/enum/execution-profile.enum.ts +20 -0
  200. package/src/types/enum/execution-settings-source.enum.ts +9 -0
  201. package/src/types/enum/health-status.enum.ts +4 -0
  202. package/src/types/enum/index.ts +14 -0
  203. package/src/types/enum/reflex-error-code.enum.ts +19 -0
  204. package/src/types/enum/run-log-level.enum.ts +6 -0
  205. package/src/types/enum/run-mode.enum.ts +11 -0
  206. package/src/types/enum/run-status.enum.ts +11 -0
  207. package/src/types/enum/run-step-status.enum.ts +7 -0
  208. package/src/types/enum/trace-effect-type.enum.ts +12 -0
  209. package/src/types/enum/trigger-access-mode.enum.ts +12 -0
  210. package/src/types/enum/trigger-type.enum.ts +4 -0
  211. package/src/types/index.ts +2 -0
  212. package/src/types/interface/api/index.ts +3 -0
  213. package/src/types/interface/api/requests/function-access.request.ts +25 -0
  214. package/src/types/interface/api/requests/function-promotion.request.ts +25 -0
  215. package/src/types/interface/api/requests/function-run.request.ts +26 -0
  216. package/src/types/interface/api/requests/function-settings.request.ts +27 -0
  217. package/src/types/interface/api/requests/function-test.request.ts +19 -0
  218. package/src/types/interface/api/requests/function-trigger.request.ts +28 -0
  219. package/src/types/interface/api/requests/function-version.request.ts +25 -0
  220. package/src/types/interface/api/requests/function.request.ts +34 -0
  221. package/src/types/interface/api/requests/index.ts +8 -0
  222. package/src/types/interface/api/response.ts +4 -0
  223. package/src/types/interface/api/responses/function-access.response.ts +17 -0
  224. package/src/types/interface/api/responses/function-promotion.response.ts +18 -0
  225. package/src/types/interface/api/responses/function-run.response.ts +18 -0
  226. package/src/types/interface/api/responses/function-settings.response.ts +33 -0
  227. package/src/types/interface/api/responses/function-test.response.ts +12 -0
  228. package/src/types/interface/api/responses/function-trigger.response.ts +24 -0
  229. package/src/types/interface/api/responses/function-version.response.ts +36 -0
  230. package/src/types/interface/api/responses/function.response.ts +25 -0
  231. package/src/types/interface/api/responses/index.ts +8 -0
  232. package/src/types/interface/health.response.ts +7 -0
  233. package/src/types/interface/index.ts +3 -0
  234. package/src/types/interface/models/index.ts +9 -0
  235. package/src/types/interface/models/reflex-access-grant.model.ts +14 -0
  236. package/src/types/interface/models/reflex-definition.model.ts +23 -0
  237. package/src/types/interface/models/reflex-environment-pointer.model.ts +18 -0
  238. package/src/types/interface/models/reflex-execution-settings.model.ts +53 -0
  239. package/src/types/interface/models/reflex-function-version.model.ts +14 -0
  240. package/src/types/interface/models/reflex-function.model.ts +14 -0
  241. package/src/types/interface/models/reflex-run.model.ts +159 -0
  242. package/src/types/interface/models/reflex-step-stats.model.ts +35 -0
  243. package/src/types/interface/models/reflex-trigger.model.ts +17 -0
  244. package/tsconfig.check.json +15 -0
  245. package/tsconfig.json +35 -0
@@ -0,0 +1,97 @@
1
+ import type { ExecutionMode, ExecutionProfile, RunLogLevel, RunMode, RunStatus, RunStepStatus, TraceEffectType } from '../../enum';
2
+ export interface IReflexTraceError {
3
+ code: string;
4
+ message: string;
5
+ }
6
+ export interface IReflexTraceEntry {
7
+ stepId: string;
8
+ type: TraceEffectType;
9
+ action?: string;
10
+ request?: unknown;
11
+ response?: unknown;
12
+ error?: IReflexTraceError;
13
+ recorded: boolean;
14
+ }
15
+ export interface IReflexTraceResponse {
16
+ status: number;
17
+ headers: Record<string, string>;
18
+ body: unknown;
19
+ }
20
+ export interface IReflexRunTrace {
21
+ entries: IReflexTraceEntry[];
22
+ outcome: {
23
+ status: RunStatus;
24
+ output?: unknown;
25
+ error?: IReflexTraceError & {
26
+ stepId?: string;
27
+ };
28
+ };
29
+ response?: IReflexTraceResponse;
30
+ truncated: boolean;
31
+ }
32
+ export interface IReflexRun {
33
+ id: string;
34
+ functionId: string;
35
+ versionId: string | null;
36
+ environmentId: string | null;
37
+ mode: RunMode;
38
+ status: RunStatus;
39
+ durationMs: number;
40
+ trace: IReflexRunTrace | null;
41
+ triggerId: string | null;
42
+ httpStatus: number | null;
43
+ errorCode: string | null;
44
+ executionMode: ExecutionMode | null;
45
+ responseSentAt: Date | null;
46
+ metrics: IReflexRunMetrics | null;
47
+ createdByUserId: string | null;
48
+ createdAt: Date;
49
+ }
50
+ export interface IReflexRunMetrics {
51
+ profile: ExecutionProfile;
52
+ memoryLimitMb: number;
53
+ guaranteedCpu: boolean;
54
+ cpuMs: number;
55
+ heapPeakBytes: number;
56
+ netOutBytes: number;
57
+ netInBytes: number;
58
+ httpCalls: number;
59
+ storeWrites: number;
60
+ costMillicredits: number;
61
+ }
62
+ export interface IReflexRunStep {
63
+ position: number;
64
+ stepId: string;
65
+ status: RunStepStatus;
66
+ durationMs: number;
67
+ cpuMs: number;
68
+ heapPeakBytes: number;
69
+ netOutBytes: number;
70
+ netInBytes: number;
71
+ httpCalls: number;
72
+ storeWrites: number;
73
+ costMillicredits: number;
74
+ }
75
+ export interface IReflexRunLog {
76
+ position: number;
77
+ stepId: string;
78
+ level: RunLogLevel;
79
+ message: string;
80
+ data: unknown;
81
+ loggedAt: Date;
82
+ }
83
+ export interface IReflexRunDetail extends IReflexRun {
84
+ steps: IReflexRunStep[];
85
+ logs: IReflexRunLog[];
86
+ }
87
+ export interface IReflexExecutionState {
88
+ id: string;
89
+ status: RunStatus;
90
+ executionMode: ExecutionMode;
91
+ startedAt: Date;
92
+ responseSentAt: Date | null;
93
+ finishedAt: Date | null;
94
+ httpStatus: number;
95
+ errorCode: string | null;
96
+ costMillicredits: number | null;
97
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=reflex-run.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflex-run.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-run.model.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ export interface IReflexPercentiles {
2
+ median: number;
3
+ p95: number;
4
+ }
5
+ export interface IReflexStepStats {
6
+ stepId: string;
7
+ executions: number;
8
+ durationMs: IReflexPercentiles;
9
+ cpuMs: IReflexPercentiles;
10
+ heapPeakBytes: IReflexPercentiles;
11
+ costMillicredits: IReflexPercentiles;
12
+ heapPeakP99Bytes: number;
13
+ costShare: number | null;
14
+ }
15
+ export interface IReflexStepHeapPeak {
16
+ stepId: string;
17
+ heapPeakP99Bytes: number;
18
+ }
19
+ export interface IReflexRunningVersionHeapPeaks {
20
+ versionId: string;
21
+ steps: IReflexStepHeapPeak[];
22
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=reflex-step-stats.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflex-step-stats.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-step-stats.model.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import type { TriggerAccessMode, TriggerType } from '../../enum';
2
+ export interface IReflexTrigger {
3
+ id: string;
4
+ functionId: string;
5
+ applicationId: string;
6
+ applicationSlug: string;
7
+ type: TriggerType;
8
+ path: string;
9
+ accessMode: TriggerAccessMode;
10
+ createdByUserId: string;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=reflex-trigger.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflex-trigger.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-trigger.model.ts"],"names":[],"mappings":""}
package/jest.config.ts ADDED
@@ -0,0 +1,11 @@
1
+ import type { Config } from '@jest/types';
2
+
3
+ const config: Config.InitialOptions = {
4
+ testEnvironment: 'node',
5
+ transform: {
6
+ '^.+\\.tsx?$': ['ts-jest', { isolatedModules: true }],
7
+ },
8
+ modulePathIgnorePatterns: ['dist'],
9
+ };
10
+
11
+ export default config;
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "@abyss-project/reflex",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.1.0",
4
+ "description": "Core package to interact with AbyssReflex",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://gitlab.com/abyss-group/abyss-reflex.git"
10
+ },
11
+ "keywords": [],
12
+ "author": "scylla",
13
+ "license": "ISC",
14
+ "engines": {
15
+ "node": ">=19.8"
16
+ },
17
+ "dependencies": {
18
+ "axios": "^1.6.0"
19
+ },
20
+ "devDependencies": {
21
+ "@jest/types": "^29.6.0",
22
+ "@types/jest": "^29.5.5",
23
+ "@types/node": "^20.11.0",
24
+ "@typescript-eslint/eslint-plugin": "8.71.0",
25
+ "@typescript-eslint/parser": "8.71.0",
26
+ "eslint": "^8.57.1",
27
+ "eslint-config-prettier": "^8.3.0",
28
+ "eslint-plugin-filenames-simple": "^0.7.0",
29
+ "eslint-plugin-prettier": "^3.4.0",
30
+ "jest": "^29.7.0",
31
+ "prettier": "2.3.1",
32
+ "ts-jest": "^29.1.0",
33
+ "ts-node": "^10.4.0",
34
+ "typescript": "5.9.3"
35
+ },
36
+ "scripts": {
37
+ "lint": "eslint \"{src,apps,libs,test,core}/**/*.ts\" --fix",
38
+ "lint:check": "eslint \"{src,apps,libs,test,core}/**/*.ts\" --max-warnings 0",
39
+ "tsc": "tsc",
40
+ "build": "tsc",
41
+ "test": "jest",
42
+ "dev": "tsc --watch"
43
+ }
6
44
  }
@@ -0,0 +1,36 @@
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ IGrantFunctionAccessBody,
4
+ IGrantFunctionAccessParams,
5
+ IGrantFunctionAccessResponse,
6
+ IListFunctionAccessParams,
7
+ IListFunctionAccessResponse,
8
+ IRevokeFunctionAccessParams,
9
+ IRevokeFunctionAccessResponse,
10
+ } from '../types';
11
+
12
+ const accessUrl = (params: { applicationId: string; functionId: string }): string =>
13
+ `api/function/${params.applicationId}/${params.functionId}/access`;
14
+
15
+ /** `GET .../access`: every access granted to the function, revoked ones included (the journal). Needs REFLEX_READ. */
16
+ export const listFunctionAccess = async (
17
+ params: IListFunctionAccessParams,
18
+ ): Promise<IListFunctionAccessResponse> =>
19
+ (await AbyssReflexCore.axios.get<IListFunctionAccessResponse>(accessUrl(params))).data;
20
+
21
+ /** `POST .../access`: grants an access the draft declares. The caller must hold the right it needs (`403` otherwise). */
22
+ export const grantFunctionAccess = async (
23
+ params: IGrantFunctionAccessParams,
24
+ body: IGrantFunctionAccessBody,
25
+ ): Promise<IGrantFunctionAccessResponse> =>
26
+ (await AbyssReflexCore.axios.post<IGrantFunctionAccessResponse>(accessUrl(params), body)).data;
27
+
28
+ /** `DELETE .../access/:grantId`: withdraws the access, at once, from what is already promoted. Needs REFLEX_FUNCTION_UPDATE. */
29
+ export const revokeFunctionAccess = async (
30
+ params: IRevokeFunctionAccessParams,
31
+ ): Promise<IRevokeFunctionAccessResponse> =>
32
+ (
33
+ await AbyssReflexCore.axios.delete<IRevokeFunctionAccessResponse>(
34
+ `${accessUrl(params)}/${params.grantId}`,
35
+ )
36
+ ).data;
@@ -0,0 +1,42 @@
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ IListFunctionPromotionParams,
4
+ IListFunctionPromotionResponse,
5
+ IPromoteFunctionBody,
6
+ IPromoteFunctionParams,
7
+ IPromoteFunctionResponse,
8
+ IRollbackFunctionBody,
9
+ IRollbackFunctionParams,
10
+ IRollbackFunctionResponse,
11
+ } from '../types';
12
+
13
+ const promotionUrl = (params: { applicationId: string; functionId: string }): string =>
14
+ `api/function/${params.applicationId}/${params.functionId}/promotion`;
15
+
16
+ /** `GET .../promotion`: where each version runs, and the history a rollback reads. Needs REFLEX_READ. */
17
+ export const listFunctionPromotion = async (
18
+ params: IListFunctionPromotionParams,
19
+ ): Promise<IListFunctionPromotionResponse> =>
20
+ (await AbyssReflexCore.axios.get<IListFunctionPromotionResponse>(promotionUrl(params))).data;
21
+
22
+ /**
23
+ * `POST .../promotion`: runs a version in a Monitor environment (copies it, its accesses and its secrets to
24
+ * the execution plane). Needs REFLEX_PUBLISH, and REFLEX_PUBLISH_PRODUCTION for a PRODUCTION environment.
25
+ */
26
+ export const promoteFunction = async (
27
+ params: IPromoteFunctionParams,
28
+ body: IPromoteFunctionBody,
29
+ ): Promise<IPromoteFunctionResponse> =>
30
+ (await AbyssReflexCore.axios.post<IPromoteFunctionResponse>(promotionUrl(params), body)).data;
31
+
32
+ /** `POST .../promotion/rollback`: moves the environment back to a version it ran before. Same rights as a promotion. */
33
+ export const rollbackFunction = async (
34
+ params: IRollbackFunctionParams,
35
+ body: IRollbackFunctionBody,
36
+ ): Promise<IRollbackFunctionResponse> =>
37
+ (
38
+ await AbyssReflexCore.axios.post<IRollbackFunctionResponse>(
39
+ `${promotionUrl(params)}/rollback`,
40
+ body,
41
+ )
42
+ ).data;
@@ -0,0 +1,38 @@
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ IGetFunctionRunParams,
4
+ IGetFunctionRunResponse,
5
+ IGetFunctionRunStateParams,
6
+ IGetFunctionRunStateResponse,
7
+ IListFunctionRunParams,
8
+ IListFunctionRunQuery,
9
+ IListFunctionRunResponse,
10
+ } from '../types';
11
+
12
+ const runUrl = (params: { applicationId: string; functionId: string }): string =>
13
+ `api/function/${params.applicationId}/${params.functionId}/run`;
14
+
15
+ /** `GET .../run`: the test runs (kept: the last 10, then 7 days) and the live executions of the edge (7 days), merged, newest first, paged by `limit`/`offset`. Needs REFLEX_LOG_READ. */
16
+ export const listFunctionRun = async (
17
+ params: IListFunctionRunParams,
18
+ query: IListFunctionRunQuery = {},
19
+ ): Promise<IListFunctionRunResponse> =>
20
+ (await AbyssReflexCore.axios.get<IListFunctionRunResponse>(runUrl(params), { params: query }))
21
+ .data;
22
+
23
+ /** `GET .../run/:runId`: one run; a live one with its measures and its steps. Needs REFLEX_LOG_READ. */
24
+ export const getFunctionRun = async (
25
+ params: IGetFunctionRunParams,
26
+ ): Promise<IGetFunctionRunResponse> =>
27
+ (await AbyssReflexCore.axios.get<IGetFunctionRunResponse>(`${runUrl(params)}/${params.runId}`))
28
+ .data;
29
+
30
+ /** `GET .../run/:runId/state`: the state of a live execution, the one an async trigger answered with. Needs REFLEX_LOG_READ. */
31
+ export const getFunctionRunState = async (
32
+ params: IGetFunctionRunStateParams,
33
+ ): Promise<IGetFunctionRunStateResponse> =>
34
+ (
35
+ await AbyssReflexCore.axios.get<IGetFunctionRunStateResponse>(
36
+ `${runUrl(params)}/${params.runId}/state`,
37
+ )
38
+ ).data;
@@ -0,0 +1,59 @@
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ IGetFunctionSettingsParams,
4
+ IGetFunctionSettingsResponse,
5
+ IRemoveFunctionEnvironmentSettingsParams,
6
+ IRemoveFunctionEnvironmentSettingsResponse,
7
+ ISetFunctionDefaultSettingsBody,
8
+ ISetFunctionDefaultSettingsParams,
9
+ ISetFunctionDefaultSettingsResponse,
10
+ ISetFunctionEnvironmentSettingsBody,
11
+ ISetFunctionEnvironmentSettingsParams,
12
+ ISetFunctionEnvironmentSettingsResponse,
13
+ } from '../types';
14
+
15
+ const settingsUrl = (params: { applicationId: string; functionId: string }): string =>
16
+ `api/function/${params.applicationId}/${params.functionId}/settings`;
17
+
18
+ /** `GET .../settings`: the default, the overrides, and what each environment runs with. Needs REFLEX_READ. */
19
+ export const getFunctionSettings = async (
20
+ params: IGetFunctionSettingsParams,
21
+ ): Promise<IGetFunctionSettingsResponse> =>
22
+ (await AbyssReflexCore.axios.get<IGetFunctionSettingsResponse>(settingsUrl(params))).data;
23
+
24
+ /**
25
+ * `PUT .../settings`: sets the default of every environment without an override, applied at once where the
26
+ * function runs. Needs REFLEX_FUNCTION_UPDATE, and REFLEX_PUBLISH_PRODUCTION when the default applies to a
27
+ * production environment where the function runs.
28
+ */
29
+ export const setFunctionDefaultSettings = async (
30
+ params: ISetFunctionDefaultSettingsParams,
31
+ body: ISetFunctionDefaultSettingsBody,
32
+ ): Promise<ISetFunctionDefaultSettingsResponse> =>
33
+ (await AbyssReflexCore.axios.put<ISetFunctionDefaultSettingsResponse>(settingsUrl(params), body))
34
+ .data;
35
+
36
+ /**
37
+ * `PUT .../settings/:environmentId`: sets the override of one environment. Needs REFLEX_FUNCTION_UPDATE, and
38
+ * REFLEX_PUBLISH_PRODUCTION for a production environment.
39
+ */
40
+ export const setFunctionEnvironmentSettings = async (
41
+ params: ISetFunctionEnvironmentSettingsParams,
42
+ body: ISetFunctionEnvironmentSettingsBody,
43
+ ): Promise<ISetFunctionEnvironmentSettingsResponse> =>
44
+ (
45
+ await AbyssReflexCore.axios.put<ISetFunctionEnvironmentSettingsResponse>(
46
+ `${settingsUrl(params)}/${params.environmentId}`,
47
+ body,
48
+ )
49
+ ).data;
50
+
51
+ /** `DELETE .../settings/:environmentId`: the environment falls back on the default. Same rights as setting it. */
52
+ export const removeFunctionEnvironmentSettings = async (
53
+ params: IRemoveFunctionEnvironmentSettingsParams,
54
+ ): Promise<IRemoveFunctionEnvironmentSettingsResponse> =>
55
+ (
56
+ await AbyssReflexCore.axios.delete<IRemoveFunctionEnvironmentSettingsResponse>(
57
+ `${settingsUrl(params)}/${params.environmentId}`,
58
+ )
59
+ ).data;
@@ -0,0 +1,33 @@
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ IDryRunFunctionBody,
4
+ IDryRunFunctionResponse,
5
+ IFunctionTestParams,
6
+ ISimulateFunctionBody,
7
+ ISimulateFunctionResponse,
8
+ } from '../types';
9
+
10
+ const testUrl = (params: IFunctionTestParams): string =>
11
+ `api/function/${params.applicationId}/${params.functionId}/test`;
12
+
13
+ /**
14
+ * `POST .../test/simulate`: runs the draft on a made-up event. Nothing is executed: HTTP steps get the
15
+ * stub they are given, the Store is a scratch copy thrown away. Needs REFLEX_TEST_RUN.
16
+ */
17
+ export const simulateFunction = async (
18
+ params: IFunctionTestParams,
19
+ body: ISimulateFunctionBody = {},
20
+ ): Promise<ISimulateFunctionResponse> =>
21
+ (await AbyssReflexCore.axios.post<ISimulateFunctionResponse>(`${testUrl(params)}/simulate`, body))
22
+ .data;
23
+
24
+ /**
25
+ * `POST .../test/dry-run`: like a simulation, but the Store is read for real; writes are recorded and not
26
+ * done. Needs REFLEX_TEST_RUN.
27
+ */
28
+ export const dryRunFunction = async (
29
+ params: IFunctionTestParams,
30
+ body: IDryRunFunctionBody = {},
31
+ ): Promise<IDryRunFunctionResponse> =>
32
+ (await AbyssReflexCore.axios.post<IDryRunFunctionResponse>(`${testUrl(params)}/dry-run`, body))
33
+ .data;
@@ -0,0 +1,52 @@
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ ICreateFunctionTriggerBody,
4
+ ICreateFunctionTriggerParams,
5
+ ICreateFunctionTriggerResponse,
6
+ IDeleteFunctionTriggerParams,
7
+ IDeleteFunctionTriggerResponse,
8
+ IListFunctionTriggerParams,
9
+ IListFunctionTriggerResponse,
10
+ IRotateFunctionTriggerParams,
11
+ IRotateFunctionTriggerResponse,
12
+ } from '../types';
13
+
14
+ const triggerUrl = (params: { applicationId: string; functionId: string }): string =>
15
+ `api/function/${params.applicationId}/${params.functionId}/trigger`;
16
+
17
+ /** `GET .../trigger`: the HTTP triggers of the function. Needs REFLEX_READ. */
18
+ export const listFunctionTrigger = async (
19
+ params: IListFunctionTriggerParams,
20
+ ): Promise<IListFunctionTriggerResponse> =>
21
+ (await AbyssReflexCore.axios.get<IListFunctionTriggerResponse>(triggerUrl(params))).data;
22
+
23
+ /**
24
+ * `POST .../trigger`: adds an HTTP trigger. The key or the signing secret comes back ONCE in `secret`.
25
+ * Needs REFLEX_FUNCTION_UPDATE.
26
+ */
27
+ export const createFunctionTrigger = async (
28
+ params: ICreateFunctionTriggerParams,
29
+ body: ICreateFunctionTriggerBody,
30
+ ): Promise<ICreateFunctionTriggerResponse> =>
31
+ (await AbyssReflexCore.axios.post<ICreateFunctionTriggerResponse>(triggerUrl(params), body)).data;
32
+
33
+ /** `POST .../trigger/:triggerId/rotate`: a new key or signing secret, shown ONCE; the old one stops at once. */
34
+ export const rotateFunctionTrigger = async (
35
+ params: IRotateFunctionTriggerParams,
36
+ ): Promise<IRotateFunctionTriggerResponse> =>
37
+ (
38
+ await AbyssReflexCore.axios.post<IRotateFunctionTriggerResponse>(
39
+ `${triggerUrl(params)}/${params.triggerId}/rotate`,
40
+ {},
41
+ )
42
+ ).data;
43
+
44
+ /** `DELETE .../trigger/:triggerId`: the address answers `404` from then on. Needs REFLEX_FUNCTION_UPDATE. */
45
+ export const deleteFunctionTrigger = async (
46
+ params: IDeleteFunctionTriggerParams,
47
+ ): Promise<IDeleteFunctionTriggerResponse> =>
48
+ (
49
+ await AbyssReflexCore.axios.delete<IDeleteFunctionTriggerResponse>(
50
+ `${triggerUrl(params)}/${params.triggerId}`,
51
+ )
52
+ ).data;
@@ -0,0 +1,56 @@
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ IGetFunctionVersionParams,
4
+ IGetFunctionVersionResponse,
5
+ IGetFunctionVersionStepStatsParams,
6
+ IGetFunctionVersionStepStatsQuery,
7
+ IGetFunctionVersionStepStatsResponse,
8
+ IListFunctionVersionParams,
9
+ IListFunctionVersionResponse,
10
+ IPublishFunctionVersionParams,
11
+ IPublishFunctionVersionResponse,
12
+ } from '../types';
13
+
14
+ const versionUrl = (params: { applicationId: string; functionId: string }): string =>
15
+ `api/function/${params.applicationId}/${params.functionId}/version`;
16
+
17
+ /** `GET .../version`: the frozen versions, newest first. Needs REFLEX_READ. */
18
+ export const listFunctionVersion = async (
19
+ params: IListFunctionVersionParams,
20
+ ): Promise<IListFunctionVersionResponse> =>
21
+ (await AbyssReflexCore.axios.get<IListFunctionVersionResponse>(versionUrl(params))).data;
22
+
23
+ /**
24
+ * `POST .../version`: freezes the draft as the next version (SHA-256 of the definition). Refused with
25
+ * `409 GRANT_SUSPENDED` when an access was granted by a member who lost the right since. Needs REFLEX_PUBLISH.
26
+ */
27
+ export const publishFunctionVersion = async (
28
+ params: IPublishFunctionVersionParams,
29
+ ): Promise<IPublishFunctionVersionResponse> =>
30
+ (await AbyssReflexCore.axios.post<IPublishFunctionVersionResponse>(versionUrl(params), {})).data;
31
+
32
+ /** `GET .../version/:versionId`. Needs REFLEX_READ. */
33
+ export const getFunctionVersion = async (
34
+ params: IGetFunctionVersionParams,
35
+ ): Promise<IGetFunctionVersionResponse> =>
36
+ (
37
+ await AbyssReflexCore.axios.get<IGetFunctionVersionResponse>(
38
+ `${versionUrl(params)}/${params.versionId}`,
39
+ )
40
+ ).data;
41
+
42
+ /**
43
+ * `GET .../version/:versionId/step-stats`: per step, over the retention window, the executions, the median
44
+ * and p95 of duration, CPU, heap peak and cost, and the share of the cost; interrupted executions left
45
+ * out. With `environmentId`, also the p99 heap peak per step of the version running there. Needs REFLEX_LOG_READ.
46
+ */
47
+ export const getFunctionVersionStepStats = async (
48
+ params: IGetFunctionVersionStepStatsParams,
49
+ query: IGetFunctionVersionStepStatsQuery = {},
50
+ ): Promise<IGetFunctionVersionStepStatsResponse> =>
51
+ (
52
+ await AbyssReflexCore.axios.get<IGetFunctionVersionStepStatsResponse>(
53
+ `${versionUrl(params)}/${params.versionId}/step-stats`,
54
+ { params: query },
55
+ )
56
+ ).data;