@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.
- package/.eslintrc.js +32 -0
- package/.prettierrc +5 -0
- package/README.md +15 -3
- package/dist/api/function-access.api.d.ts +4 -0
- package/dist/api/function-access.api.js +12 -0
- package/dist/api/function-access.api.js.map +1 -0
- package/dist/api/function-promotion.api.d.ts +4 -0
- package/dist/api/function-promotion.api.js +12 -0
- package/dist/api/function-promotion.api.js.map +1 -0
- package/dist/api/function-run.api.d.ts +4 -0
- package/dist/api/function-run.api.js +14 -0
- package/dist/api/function-run.api.js.map +1 -0
- package/dist/api/function-settings.api.d.ts +5 -0
- package/dist/api/function-settings.api.js +15 -0
- package/dist/api/function-settings.api.js.map +1 -0
- package/dist/api/function-test.api.d.ts +3 -0
- package/dist/api/function-test.api.js +12 -0
- package/dist/api/function-test.api.js.map +1 -0
- package/dist/api/function-trigger.api.d.ts +5 -0
- package/dist/api/function-trigger.api.js +14 -0
- package/dist/api/function-trigger.api.js.map +1 -0
- package/dist/api/function-version.api.d.ts +5 -0
- package/dist/api/function-version.api.js +14 -0
- package/dist/api/function-version.api.js.map +1 -0
- package/dist/api/function.api.d.ts +6 -0
- package/dist/api/function.api.js +16 -0
- package/dist/api/function.api.js.map +1 -0
- package/dist/api/health.api.d.ts +2 -0
- package/dist/api/health.api.js +7 -0
- package/dist/api/health.api.js.map +1 -0
- package/dist/api/index.d.ts +9 -0
- package/dist/api/index.js +26 -0
- package/dist/api/index.js.map +1 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +131 -0
- package/dist/index.js.map +1 -0
- package/dist/types/enum/access-grant-status.enum.d.ts +5 -0
- package/dist/types/enum/access-grant-status.enum.js +10 -0
- package/dist/types/enum/access-grant-status.enum.js.map +1 -0
- package/dist/types/enum/access-kind.enum.d.ts +4 -0
- package/dist/types/enum/access-kind.enum.js +9 -0
- package/dist/types/enum/access-kind.enum.js.map +1 -0
- package/dist/types/enum/execution-mode.enum.d.ts +4 -0
- package/dist/types/enum/execution-mode.enum.js +9 -0
- package/dist/types/enum/execution-mode.enum.js.map +1 -0
- package/dist/types/enum/execution-profile.enum.d.ts +8 -0
- package/dist/types/enum/execution-profile.enum.js +19 -0
- package/dist/types/enum/execution-profile.enum.js.map +1 -0
- package/dist/types/enum/execution-settings-source.enum.d.ts +5 -0
- package/dist/types/enum/execution-settings-source.enum.js +10 -0
- package/dist/types/enum/execution-settings-source.enum.js.map +1 -0
- package/dist/types/enum/health-status.enum.d.ts +4 -0
- package/dist/types/enum/health-status.enum.js +9 -0
- package/dist/types/enum/health-status.enum.js.map +1 -0
- package/dist/types/enum/index.d.ts +14 -0
- package/dist/types/enum/index.js +31 -0
- package/dist/types/enum/index.js.map +1 -0
- package/dist/types/enum/reflex-error-code.enum.d.ts +10 -0
- package/dist/types/enum/reflex-error-code.enum.js +15 -0
- package/dist/types/enum/reflex-error-code.enum.js.map +1 -0
- package/dist/types/enum/run-log-level.enum.d.ts +5 -0
- package/dist/types/enum/run-log-level.enum.js +10 -0
- package/dist/types/enum/run-log-level.enum.js.map +1 -0
- package/dist/types/enum/run-mode.enum.d.ts +5 -0
- package/dist/types/enum/run-mode.enum.js +10 -0
- package/dist/types/enum/run-mode.enum.js.map +1 -0
- package/dist/types/enum/run-status.enum.d.ts +6 -0
- package/dist/types/enum/run-status.enum.js +11 -0
- package/dist/types/enum/run-status.enum.js.map +1 -0
- package/dist/types/enum/run-step-status.enum.d.ts +5 -0
- package/dist/types/enum/run-step-status.enum.js +10 -0
- package/dist/types/enum/run-step-status.enum.js.map +1 -0
- package/dist/types/enum/trace-effect-type.enum.d.ts +5 -0
- package/dist/types/enum/trace-effect-type.enum.js +10 -0
- package/dist/types/enum/trace-effect-type.enum.js.map +1 -0
- package/dist/types/enum/trigger-access-mode.enum.d.ts +5 -0
- package/dist/types/enum/trigger-access-mode.enum.js +10 -0
- package/dist/types/enum/trigger-access-mode.enum.js.map +1 -0
- package/dist/types/enum/trigger-type.enum.d.ts +3 -0
- package/dist/types/enum/trigger-type.enum.js +8 -0
- package/dist/types/enum/trigger-type.enum.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/interface/api/index.d.ts +3 -0
- package/dist/types/interface/api/index.js +20 -0
- package/dist/types/interface/api/index.js.map +1 -0
- package/dist/types/interface/api/requests/function-access.request.d.ts +17 -0
- package/dist/types/interface/api/requests/function-access.request.js +3 -0
- package/dist/types/interface/api/requests/function-access.request.js.map +1 -0
- package/dist/types/interface/api/requests/function-promotion.request.d.ts +20 -0
- package/dist/types/interface/api/requests/function-promotion.request.js +3 -0
- package/dist/types/interface/api/requests/function-promotion.request.js.map +1 -0
- package/dist/types/interface/api/requests/function-run.request.d.ts +20 -0
- package/dist/types/interface/api/requests/function-run.request.js +3 -0
- package/dist/types/interface/api/requests/function-run.request.js.map +1 -0
- package/dist/types/interface/api/requests/function-settings.request.d.ts +21 -0
- package/dist/types/interface/api/requests/function-settings.request.js +3 -0
- package/dist/types/interface/api/requests/function-settings.request.js.map +1 -0
- package/dist/types/interface/api/requests/function-test.request.d.ts +14 -0
- package/dist/types/interface/api/requests/function-test.request.js +3 -0
- package/dist/types/interface/api/requests/function-test.request.js.map +1 -0
- package/dist/types/interface/api/requests/function-trigger.request.d.ts +23 -0
- package/dist/types/interface/api/requests/function-trigger.request.js +3 -0
- package/dist/types/interface/api/requests/function-trigger.request.js.map +1 -0
- package/dist/types/interface/api/requests/function-version.request.d.ts +21 -0
- package/dist/types/interface/api/requests/function-version.request.js +3 -0
- package/dist/types/interface/api/requests/function-version.request.js.map +1 -0
- package/dist/types/interface/api/requests/function.request.d.ts +27 -0
- package/dist/types/interface/api/requests/function.request.js +3 -0
- package/dist/types/interface/api/requests/function.request.js.map +1 -0
- package/dist/types/interface/api/requests/index.d.ts +8 -0
- package/dist/types/interface/api/requests/index.js +25 -0
- package/dist/types/interface/api/requests/index.js.map +1 -0
- package/dist/types/interface/api/response.d.ts +3 -0
- package/dist/types/interface/api/response.js +3 -0
- package/dist/types/interface/api/response.js.map +1 -0
- package/dist/types/interface/api/responses/function-access.response.d.ts +14 -0
- package/dist/types/interface/api/responses/function-access.response.js +3 -0
- package/dist/types/interface/api/responses/function-access.response.js.map +1 -0
- package/dist/types/interface/api/responses/function-promotion.response.d.ts +14 -0
- package/dist/types/interface/api/responses/function-promotion.response.js +3 -0
- package/dist/types/interface/api/responses/function-promotion.response.js.map +1 -0
- package/dist/types/interface/api/responses/function-run.response.d.ts +14 -0
- package/dist/types/interface/api/responses/function-run.response.js +3 -0
- package/dist/types/interface/api/responses/function-run.response.js.map +1 -0
- package/dist/types/interface/api/responses/function-settings.response.d.ts +19 -0
- package/dist/types/interface/api/responses/function-settings.response.js +3 -0
- package/dist/types/interface/api/responses/function-settings.response.js.map +1 -0
- package/dist/types/interface/api/responses/function-test.response.d.ts +10 -0
- package/dist/types/interface/api/responses/function-test.response.js +3 -0
- package/dist/types/interface/api/responses/function-test.response.js.map +1 -0
- package/dist/types/interface/api/responses/function-trigger.response.d.ts +18 -0
- package/dist/types/interface/api/responses/function-trigger.response.js +3 -0
- package/dist/types/interface/api/responses/function-trigger.response.js.map +1 -0
- package/dist/types/interface/api/responses/function-version.response.d.ts +23 -0
- package/dist/types/interface/api/responses/function-version.response.js +3 -0
- package/dist/types/interface/api/responses/function-version.response.js.map +1 -0
- package/dist/types/interface/api/responses/function.response.d.ts +20 -0
- package/dist/types/interface/api/responses/function.response.js +3 -0
- package/dist/types/interface/api/responses/function.response.js.map +1 -0
- package/dist/types/interface/api/responses/index.d.ts +8 -0
- package/dist/types/interface/api/responses/index.js +25 -0
- package/dist/types/interface/api/responses/index.js.map +1 -0
- package/dist/types/interface/health.response.d.ts +5 -0
- package/dist/types/interface/health.response.js +3 -0
- package/dist/types/interface/health.response.js.map +1 -0
- package/dist/types/interface/index.d.ts +3 -0
- package/dist/types/interface/index.js +20 -0
- package/dist/types/interface/index.js.map +1 -0
- package/dist/types/interface/models/index.d.ts +9 -0
- package/dist/types/interface/models/index.js +26 -0
- package/dist/types/interface/models/index.js.map +1 -0
- package/dist/types/interface/models/reflex-access-grant.model.d.ts +13 -0
- package/dist/types/interface/models/reflex-access-grant.model.js +3 -0
- package/dist/types/interface/models/reflex-access-grant.model.js.map +1 -0
- package/dist/types/interface/models/reflex-definition.model.d.ts +15 -0
- package/dist/types/interface/models/reflex-definition.model.js +3 -0
- package/dist/types/interface/models/reflex-definition.model.js.map +1 -0
- package/dist/types/interface/models/reflex-environment-pointer.model.d.ts +13 -0
- package/dist/types/interface/models/reflex-environment-pointer.model.js +3 -0
- package/dist/types/interface/models/reflex-environment-pointer.model.js.map +1 -0
- package/dist/types/interface/models/reflex-execution-settings.model.d.ts +36 -0
- package/dist/types/interface/models/reflex-execution-settings.model.js +16 -0
- package/dist/types/interface/models/reflex-execution-settings.model.js.map +1 -0
- package/dist/types/interface/models/reflex-function-version.model.d.ts +10 -0
- package/dist/types/interface/models/reflex-function-version.model.js +3 -0
- package/dist/types/interface/models/reflex-function-version.model.js.map +1 -0
- package/dist/types/interface/models/reflex-function.model.d.ts +12 -0
- package/dist/types/interface/models/reflex-function.model.js +3 -0
- package/dist/types/interface/models/reflex-function.model.js.map +1 -0
- package/dist/types/interface/models/reflex-run.model.d.ts +97 -0
- package/dist/types/interface/models/reflex-run.model.js +3 -0
- package/dist/types/interface/models/reflex-run.model.js.map +1 -0
- package/dist/types/interface/models/reflex-step-stats.model.d.ts +22 -0
- package/dist/types/interface/models/reflex-step-stats.model.js +3 -0
- package/dist/types/interface/models/reflex-step-stats.model.js.map +1 -0
- package/dist/types/interface/models/reflex-trigger.model.d.ts +13 -0
- package/dist/types/interface/models/reflex-trigger.model.js +3 -0
- package/dist/types/interface/models/reflex-trigger.model.js.map +1 -0
- package/jest.config.ts +11 -0
- package/package.json +41 -3
- package/src/api/function-access.api.ts +36 -0
- package/src/api/function-promotion.api.ts +42 -0
- package/src/api/function-run.api.ts +38 -0
- package/src/api/function-settings.api.ts +59 -0
- package/src/api/function-test.api.ts +33 -0
- package/src/api/function-trigger.api.ts +52 -0
- package/src/api/function-version.api.ts +56 -0
- package/src/api/function.api.test.ts +301 -0
- package/src/api/function.api.ts +62 -0
- package/src/api/health.api.ts +10 -0
- package/src/api/index.ts +9 -0
- package/src/index.test.ts +50 -0
- package/src/index.ts +152 -0
- package/src/types/enum/access-grant-status.enum.ts +12 -0
- package/src/types/enum/access-kind.enum.ts +7 -0
- package/src/types/enum/execution-mode.enum.ts +9 -0
- package/src/types/enum/execution-profile.enum.ts +20 -0
- package/src/types/enum/execution-settings-source.enum.ts +9 -0
- package/src/types/enum/health-status.enum.ts +4 -0
- package/src/types/enum/index.ts +14 -0
- package/src/types/enum/reflex-error-code.enum.ts +19 -0
- package/src/types/enum/run-log-level.enum.ts +6 -0
- package/src/types/enum/run-mode.enum.ts +11 -0
- package/src/types/enum/run-status.enum.ts +11 -0
- package/src/types/enum/run-step-status.enum.ts +7 -0
- package/src/types/enum/trace-effect-type.enum.ts +12 -0
- package/src/types/enum/trigger-access-mode.enum.ts +12 -0
- package/src/types/enum/trigger-type.enum.ts +4 -0
- package/src/types/index.ts +2 -0
- package/src/types/interface/api/index.ts +3 -0
- package/src/types/interface/api/requests/function-access.request.ts +25 -0
- package/src/types/interface/api/requests/function-promotion.request.ts +25 -0
- package/src/types/interface/api/requests/function-run.request.ts +26 -0
- package/src/types/interface/api/requests/function-settings.request.ts +27 -0
- package/src/types/interface/api/requests/function-test.request.ts +19 -0
- package/src/types/interface/api/requests/function-trigger.request.ts +28 -0
- package/src/types/interface/api/requests/function-version.request.ts +25 -0
- package/src/types/interface/api/requests/function.request.ts +34 -0
- package/src/types/interface/api/requests/index.ts +8 -0
- package/src/types/interface/api/response.ts +4 -0
- package/src/types/interface/api/responses/function-access.response.ts +17 -0
- package/src/types/interface/api/responses/function-promotion.response.ts +18 -0
- package/src/types/interface/api/responses/function-run.response.ts +18 -0
- package/src/types/interface/api/responses/function-settings.response.ts +33 -0
- package/src/types/interface/api/responses/function-test.response.ts +12 -0
- package/src/types/interface/api/responses/function-trigger.response.ts +24 -0
- package/src/types/interface/api/responses/function-version.response.ts +36 -0
- package/src/types/interface/api/responses/function.response.ts +25 -0
- package/src/types/interface/api/responses/index.ts +8 -0
- package/src/types/interface/health.response.ts +7 -0
- package/src/types/interface/index.ts +3 -0
- package/src/types/interface/models/index.ts +9 -0
- package/src/types/interface/models/reflex-access-grant.model.ts +14 -0
- package/src/types/interface/models/reflex-definition.model.ts +23 -0
- package/src/types/interface/models/reflex-environment-pointer.model.ts +18 -0
- package/src/types/interface/models/reflex-execution-settings.model.ts +53 -0
- package/src/types/interface/models/reflex-function-version.model.ts +14 -0
- package/src/types/interface/models/reflex-function.model.ts +14 -0
- package/src/types/interface/models/reflex-run.model.ts +159 -0
- package/src/types/interface/models/reflex-step-stats.model.ts +35 -0
- package/src/types/interface/models/reflex-trigger.model.ts +17 -0
- package/tsconfig.check.json +15 -0
- package/tsconfig.json +35 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { AxiosAdapter, InternalAxiosRequestConfig } from 'axios';
|
|
2
|
+
import {
|
|
3
|
+
AbyssReflexCore,
|
|
4
|
+
DEFAULT_REFLEX_EXECUTION_SETTINGS,
|
|
5
|
+
EXECUTION_PROFILE_MEMORY_MB,
|
|
6
|
+
ExecutionMode,
|
|
7
|
+
ExecutionProfile,
|
|
8
|
+
REFLEX_EXECUTION_SETTINGS_LIMITS,
|
|
9
|
+
} from '..';
|
|
10
|
+
|
|
11
|
+
const APP = 'app-1';
|
|
12
|
+
const FN = 'fn-1';
|
|
13
|
+
const BASE = `api/function/${APP}/${FN}`;
|
|
14
|
+
const SETTINGS = {
|
|
15
|
+
profile: ExecutionProfile.L,
|
|
16
|
+
guaranteedCpu: true,
|
|
17
|
+
responseTimeoutMs: 10_000,
|
|
18
|
+
maxDurationMs: 600_000,
|
|
19
|
+
mode: ExecutionMode.ASYNC,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
interface Call {
|
|
23
|
+
label: string;
|
|
24
|
+
method: string;
|
|
25
|
+
url: string;
|
|
26
|
+
body?: unknown;
|
|
27
|
+
params?: unknown;
|
|
28
|
+
run: () => Promise<unknown>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const sdk = () => AbyssReflexCore.sdk.function;
|
|
32
|
+
|
|
33
|
+
const calls: Call[] = [
|
|
34
|
+
{
|
|
35
|
+
label: 'list',
|
|
36
|
+
method: 'get',
|
|
37
|
+
url: `api/function/${APP}`,
|
|
38
|
+
run: () => sdk().list({ applicationId: APP }),
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: 'create',
|
|
42
|
+
method: 'post',
|
|
43
|
+
url: `api/function/${APP}`,
|
|
44
|
+
body: { name: 'hello' },
|
|
45
|
+
run: () => sdk().create({ applicationId: APP }, { name: 'hello' }),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: 'get',
|
|
49
|
+
method: 'get',
|
|
50
|
+
url: BASE,
|
|
51
|
+
run: () => sdk().get({ applicationId: APP, functionId: FN }),
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: 'update',
|
|
55
|
+
method: 'put',
|
|
56
|
+
url: BASE,
|
|
57
|
+
body: { name: 'renamed' },
|
|
58
|
+
run: () => sdk().update({ applicationId: APP, functionId: FN }, { name: 'renamed' }),
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: 'delete',
|
|
62
|
+
method: 'delete',
|
|
63
|
+
url: BASE,
|
|
64
|
+
run: () => sdk().delete({ applicationId: APP, functionId: FN }),
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
label: 'access.list',
|
|
68
|
+
method: 'get',
|
|
69
|
+
url: `${BASE}/access`,
|
|
70
|
+
run: () => sdk().access.list({ applicationId: APP, functionId: FN }),
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
label: 'access.grant',
|
|
74
|
+
method: 'post',
|
|
75
|
+
url: `${BASE}/access`,
|
|
76
|
+
body: { declaration: { kind: 'HOST_ACTION', action: 'store.get' } },
|
|
77
|
+
run: () =>
|
|
78
|
+
sdk().access.grant(
|
|
79
|
+
{ applicationId: APP, functionId: FN },
|
|
80
|
+
{ declaration: { kind: 'HOST_ACTION', action: 'store.get' } as never },
|
|
81
|
+
),
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
label: 'access.revoke',
|
|
85
|
+
method: 'delete',
|
|
86
|
+
url: `${BASE}/access/g-1`,
|
|
87
|
+
run: () => sdk().access.revoke({ applicationId: APP, functionId: FN, grantId: 'g-1' }),
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
label: 'test.simulate',
|
|
91
|
+
method: 'post',
|
|
92
|
+
url: `${BASE}/test/simulate`,
|
|
93
|
+
body: { input: { a: 1 } },
|
|
94
|
+
run: () => sdk().test.simulate({ applicationId: APP, functionId: FN }, { input: { a: 1 } }),
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
label: 'test.dryRun',
|
|
98
|
+
method: 'post',
|
|
99
|
+
url: `${BASE}/test/dry-run`,
|
|
100
|
+
body: {},
|
|
101
|
+
run: () => sdk().test.dryRun({ applicationId: APP, functionId: FN }),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
label: 'version.list',
|
|
105
|
+
method: 'get',
|
|
106
|
+
url: `${BASE}/version`,
|
|
107
|
+
run: () => sdk().version.list({ applicationId: APP, functionId: FN }),
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
label: 'version.publish',
|
|
111
|
+
method: 'post',
|
|
112
|
+
url: `${BASE}/version`,
|
|
113
|
+
body: {},
|
|
114
|
+
run: () => sdk().version.publish({ applicationId: APP, functionId: FN }),
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
label: 'version.get',
|
|
118
|
+
method: 'get',
|
|
119
|
+
url: `${BASE}/version/v-1`,
|
|
120
|
+
run: () => sdk().version.get({ applicationId: APP, functionId: FN, versionId: 'v-1' }),
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
label: 'promotion.list',
|
|
124
|
+
method: 'get',
|
|
125
|
+
url: `${BASE}/promotion`,
|
|
126
|
+
run: () => sdk().promotion.list({ applicationId: APP, functionId: FN }),
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
label: 'promotion.promote',
|
|
130
|
+
method: 'post',
|
|
131
|
+
url: `${BASE}/promotion`,
|
|
132
|
+
body: { versionId: 'v-1', environmentId: 'e-1' },
|
|
133
|
+
run: () =>
|
|
134
|
+
sdk().promotion.promote(
|
|
135
|
+
{ applicationId: APP, functionId: FN },
|
|
136
|
+
{ versionId: 'v-1', environmentId: 'e-1' },
|
|
137
|
+
),
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
label: 'promotion.rollback',
|
|
141
|
+
method: 'post',
|
|
142
|
+
url: `${BASE}/promotion/rollback`,
|
|
143
|
+
body: { environmentId: 'e-1' },
|
|
144
|
+
run: () =>
|
|
145
|
+
sdk().promotion.rollback({ applicationId: APP, functionId: FN }, { environmentId: 'e-1' }),
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
label: 'trigger.list',
|
|
149
|
+
method: 'get',
|
|
150
|
+
url: `${BASE}/trigger`,
|
|
151
|
+
run: () => sdk().trigger.list({ applicationId: APP, functionId: FN }),
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
label: 'trigger.create',
|
|
155
|
+
method: 'post',
|
|
156
|
+
url: `${BASE}/trigger`,
|
|
157
|
+
body: { path: 'hello', accessMode: 'PUBLIC' },
|
|
158
|
+
run: () =>
|
|
159
|
+
sdk().trigger.create(
|
|
160
|
+
{ applicationId: APP, functionId: FN },
|
|
161
|
+
{ path: 'hello', accessMode: 'PUBLIC' as never },
|
|
162
|
+
),
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
label: 'trigger.rotate',
|
|
166
|
+
method: 'post',
|
|
167
|
+
url: `${BASE}/trigger/t-1/rotate`,
|
|
168
|
+
body: {},
|
|
169
|
+
run: () => sdk().trigger.rotate({ applicationId: APP, functionId: FN, triggerId: 't-1' }),
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
label: 'trigger.delete',
|
|
173
|
+
method: 'delete',
|
|
174
|
+
url: `${BASE}/trigger/t-1`,
|
|
175
|
+
run: () => sdk().trigger.delete({ applicationId: APP, functionId: FN, triggerId: 't-1' }),
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
label: 'run.list',
|
|
179
|
+
method: 'get',
|
|
180
|
+
url: `${BASE}/run`,
|
|
181
|
+
params: { limit: 5 },
|
|
182
|
+
run: () => sdk().run.list({ applicationId: APP, functionId: FN }, { limit: 5 }),
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
label: 'run.get',
|
|
186
|
+
method: 'get',
|
|
187
|
+
url: `${BASE}/run/r-1`,
|
|
188
|
+
run: () => sdk().run.get({ applicationId: APP, functionId: FN, runId: 'r-1' }),
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
label: 'run.state',
|
|
192
|
+
method: 'get',
|
|
193
|
+
url: `${BASE}/run/r-1/state`,
|
|
194
|
+
run: () => sdk().run.state({ applicationId: APP, functionId: FN, runId: 'r-1' }),
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
label: 'version.stepStats',
|
|
198
|
+
method: 'get',
|
|
199
|
+
url: `${BASE}/version/v-1/step-stats`,
|
|
200
|
+
params: { environmentId: 'e-1' },
|
|
201
|
+
run: () =>
|
|
202
|
+
sdk().version.stepStats(
|
|
203
|
+
{ applicationId: APP, functionId: FN, versionId: 'v-1' },
|
|
204
|
+
{ environmentId: 'e-1' },
|
|
205
|
+
),
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
label: 'settings.get',
|
|
209
|
+
method: 'get',
|
|
210
|
+
url: `${BASE}/settings`,
|
|
211
|
+
run: () => sdk().settings.get({ applicationId: APP, functionId: FN }),
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
label: 'settings.setDefault',
|
|
215
|
+
method: 'put',
|
|
216
|
+
url: `${BASE}/settings`,
|
|
217
|
+
body: SETTINGS,
|
|
218
|
+
run: () => sdk().settings.setDefault({ applicationId: APP, functionId: FN }, SETTINGS),
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
label: 'settings.setEnvironment',
|
|
222
|
+
method: 'put',
|
|
223
|
+
url: `${BASE}/settings/e-1`,
|
|
224
|
+
body: SETTINGS,
|
|
225
|
+
run: () =>
|
|
226
|
+
sdk().settings.setEnvironment(
|
|
227
|
+
{ applicationId: APP, functionId: FN, environmentId: 'e-1' },
|
|
228
|
+
SETTINGS,
|
|
229
|
+
),
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
label: 'settings.removeEnvironment',
|
|
233
|
+
method: 'delete',
|
|
234
|
+
url: `${BASE}/settings/e-1`,
|
|
235
|
+
run: () =>
|
|
236
|
+
sdk().settings.removeEnvironment({
|
|
237
|
+
applicationId: APP,
|
|
238
|
+
functionId: FN,
|
|
239
|
+
environmentId: 'e-1',
|
|
240
|
+
}),
|
|
241
|
+
},
|
|
242
|
+
];
|
|
243
|
+
|
|
244
|
+
describe('AbyssReflexCore function routes', () => {
|
|
245
|
+
const adapter = jest.fn<ReturnType<AxiosAdapter>, [InternalAxiosRequestConfig]>(
|
|
246
|
+
async (config) => ({ data: { data: {} }, status: 200, statusText: '', headers: {}, config }),
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
beforeAll(() => {
|
|
250
|
+
AbyssReflexCore.setConfig({ baseURL: 'http://reflex.test/', token: 'session-token' });
|
|
251
|
+
AbyssReflexCore.axios.defaults.adapter = adapter;
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
beforeEach(() => adapter.mockClear());
|
|
255
|
+
|
|
256
|
+
it.each(calls)('$label calls $method $url', async (call) => {
|
|
257
|
+
await call.run();
|
|
258
|
+
|
|
259
|
+
const config = adapter.mock.calls[0][0];
|
|
260
|
+
expect(config.method).toBe(call.method);
|
|
261
|
+
expect(config.url).toBe(call.url);
|
|
262
|
+
expect(config.baseURL).toBe('http://reflex.test/');
|
|
263
|
+
expect(config.params).toEqual(call.params);
|
|
264
|
+
if (call.body !== undefined) {
|
|
265
|
+
expect(JSON.parse(config.data)).toEqual(call.body);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
it('sends the session token of the member as a bearer token', async () => {
|
|
270
|
+
await calls[0].run();
|
|
271
|
+
|
|
272
|
+
expect(adapter.mock.calls[0][0].headers.get('Authorization')).toBe('Bearer session-token');
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
it('exposes no route twice', () => {
|
|
276
|
+
expect(new Set(calls.map((call) => `${call.method} ${call.url}`)).size).toBe(calls.length);
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
describe('execution settings constants', () => {
|
|
281
|
+
it('give each profile its memory, S to XXL doubling from 128 MB', () => {
|
|
282
|
+
expect(Object.values(ExecutionProfile)).toEqual(['S', 'M', 'L', 'XL', 'XXL']);
|
|
283
|
+
expect(Object.values(ExecutionProfile).map((p) => EXECUTION_PROFILE_MEMORY_MB[p])).toEqual([
|
|
284
|
+
128, 256, 512, 1024, 2048,
|
|
285
|
+
]);
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
it('default to S, shared CPU, 30 s, 30 s and SYNC, within the bounds', () => {
|
|
289
|
+
expect(DEFAULT_REFLEX_EXECUTION_SETTINGS).toEqual({
|
|
290
|
+
profile: ExecutionProfile.S,
|
|
291
|
+
guaranteedCpu: false,
|
|
292
|
+
responseTimeoutMs: 30_000,
|
|
293
|
+
maxDurationMs: 30_000,
|
|
294
|
+
mode: ExecutionMode.SYNC,
|
|
295
|
+
});
|
|
296
|
+
expect(REFLEX_EXECUTION_SETTINGS_LIMITS).toEqual({
|
|
297
|
+
responseTimeoutMs: { min: 1_000, max: 100_000 },
|
|
298
|
+
maxDurationMs: { min: 1_000, max: 3_600_000 },
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type {
|
|
3
|
+
ICreateFunctionBody,
|
|
4
|
+
ICreateFunctionParams,
|
|
5
|
+
ICreateFunctionResponse,
|
|
6
|
+
IDeleteFunctionParams,
|
|
7
|
+
IDeleteFunctionResponse,
|
|
8
|
+
IGetFunctionParams,
|
|
9
|
+
IGetFunctionResponse,
|
|
10
|
+
IListFunctionParams,
|
|
11
|
+
IListFunctionResponse,
|
|
12
|
+
IUpdateFunctionBody,
|
|
13
|
+
IUpdateFunctionParams,
|
|
14
|
+
IUpdateFunctionResponse,
|
|
15
|
+
} from '../types';
|
|
16
|
+
|
|
17
|
+
/** `GET /api/function/:applicationId`: needs REFLEX_READ. */
|
|
18
|
+
export const listFunction = async (params: IListFunctionParams): Promise<IListFunctionResponse> =>
|
|
19
|
+
(await AbyssReflexCore.axios.get<IListFunctionResponse>(`api/function/${params.applicationId}`))
|
|
20
|
+
.data;
|
|
21
|
+
|
|
22
|
+
/** `POST /api/function/:applicationId`: needs REFLEX_FUNCTION_CREATE. A definition that breaks the format is a `400` naming the path of each fault. */
|
|
23
|
+
export const createFunction = async (
|
|
24
|
+
params: ICreateFunctionParams,
|
|
25
|
+
body: ICreateFunctionBody,
|
|
26
|
+
): Promise<ICreateFunctionResponse> =>
|
|
27
|
+
(
|
|
28
|
+
await AbyssReflexCore.axios.post<ICreateFunctionResponse>(
|
|
29
|
+
`api/function/${params.applicationId}`,
|
|
30
|
+
body,
|
|
31
|
+
)
|
|
32
|
+
).data;
|
|
33
|
+
|
|
34
|
+
/** `GET /api/function/:applicationId/:functionId`: needs REFLEX_READ. */
|
|
35
|
+
export const getFunction = async (params: IGetFunctionParams): Promise<IGetFunctionResponse> =>
|
|
36
|
+
(
|
|
37
|
+
await AbyssReflexCore.axios.get<IGetFunctionResponse>(
|
|
38
|
+
`api/function/${params.applicationId}/${params.functionId}`,
|
|
39
|
+
)
|
|
40
|
+
).data;
|
|
41
|
+
|
|
42
|
+
/** `PUT /api/function/:applicationId/:functionId`: needs REFLEX_FUNCTION_UPDATE. */
|
|
43
|
+
export const updateFunction = async (
|
|
44
|
+
params: IUpdateFunctionParams,
|
|
45
|
+
body: IUpdateFunctionBody,
|
|
46
|
+
): Promise<IUpdateFunctionResponse> =>
|
|
47
|
+
(
|
|
48
|
+
await AbyssReflexCore.axios.put<IUpdateFunctionResponse>(
|
|
49
|
+
`api/function/${params.applicationId}/${params.functionId}`,
|
|
50
|
+
body,
|
|
51
|
+
)
|
|
52
|
+
).data;
|
|
53
|
+
|
|
54
|
+
/** `DELETE /api/function/:applicationId/:functionId`: needs REFLEX_FUNCTION_DELETE. Takes the function off every environment. */
|
|
55
|
+
export const deleteFunction = async (
|
|
56
|
+
params: IDeleteFunctionParams,
|
|
57
|
+
): Promise<IDeleteFunctionResponse> =>
|
|
58
|
+
(
|
|
59
|
+
await AbyssReflexCore.axios.delete<IDeleteFunctionResponse>(
|
|
60
|
+
`api/function/${params.applicationId}/${params.functionId}`,
|
|
61
|
+
)
|
|
62
|
+
).data;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type { IHealthResponse } from '../types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `GET /health` — status of the database and Redis behind the API. Resolves on `200`; a `503`
|
|
6
|
+
* (a component down) rejects as an axios error whose `response.data` is the same
|
|
7
|
+
* {@link IHealthResponse}, naming the component that failed.
|
|
8
|
+
*/
|
|
9
|
+
export const health = async (): Promise<IHealthResponse> =>
|
|
10
|
+
(await AbyssReflexCore.axios.get<IHealthResponse>('health')).data;
|
package/src/api/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './health.api';
|
|
2
|
+
export * from './function.api';
|
|
3
|
+
export * from './function-access.api';
|
|
4
|
+
export * from './function-test.api';
|
|
5
|
+
export * from './function-version.api';
|
|
6
|
+
export * from './function-promotion.api';
|
|
7
|
+
export * from './function-trigger.api';
|
|
8
|
+
export * from './function-run.api';
|
|
9
|
+
export * from './function-settings.api';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { AxiosAdapter, AxiosError, InternalAxiosRequestConfig } from 'axios';
|
|
2
|
+
import { AbyssReflexCore, HealthStatus, IHealthResponse } from '.';
|
|
3
|
+
|
|
4
|
+
const answer =
|
|
5
|
+
(status: number, data: IHealthResponse): AxiosAdapter =>
|
|
6
|
+
async (config: InternalAxiosRequestConfig) => {
|
|
7
|
+
const response = { data, status, statusText: '', headers: {}, config };
|
|
8
|
+
if (status >= 400) {
|
|
9
|
+
throw new AxiosError('failed', 'ERR_BAD_RESPONSE', config, null, response);
|
|
10
|
+
}
|
|
11
|
+
return response;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
describe('AbyssReflexCore', () => {
|
|
15
|
+
it('points at the production API until setConfig says otherwise', () => {
|
|
16
|
+
expect(AbyssReflexCore.getConfig().baseURL).toBe('https://reflex-api.abyss-project.fr/');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('setConfig changes the base URL of the axios instance', () => {
|
|
20
|
+
AbyssReflexCore.setConfig({ baseURL: 'http://localhost:10141/' });
|
|
21
|
+
expect(AbyssReflexCore.axios.defaults.baseURL).toBe('http://localhost:10141/');
|
|
22
|
+
expect(AbyssReflexCore.getConfig().baseURL).toBe('http://localhost:10141/');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('health() calls GET /health on the configured URL and returns the typed body', async () => {
|
|
26
|
+
const adapter = jest.fn(answer(200, { database: HealthStatus.UP, redis: HealthStatus.UP }));
|
|
27
|
+
AbyssReflexCore.setConfig({ baseURL: 'http://reflex.test/' });
|
|
28
|
+
AbyssReflexCore.axios.defaults.adapter = adapter;
|
|
29
|
+
|
|
30
|
+
const body = await AbyssReflexCore.sdk.health();
|
|
31
|
+
|
|
32
|
+
expect(body).toEqual({ database: 'up', redis: 'up' });
|
|
33
|
+
const config = adapter.mock.calls[0][0];
|
|
34
|
+
expect(config.method).toBe('get');
|
|
35
|
+
expect(config.url).toBe('health');
|
|
36
|
+
expect(config.baseURL).toBe('http://reflex.test/');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('health() rejects on a 503 and the error carries the component that is down', async () => {
|
|
40
|
+
AbyssReflexCore.axios.defaults.adapter = answer(503, {
|
|
41
|
+
database: HealthStatus.DOWN,
|
|
42
|
+
redis: HealthStatus.UP,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const error = await AbyssReflexCore.sdk.health().catch((e: AxiosError<IHealthResponse>) => e);
|
|
46
|
+
|
|
47
|
+
expect((error as AxiosError<IHealthResponse>).response?.status).toBe(503);
|
|
48
|
+
expect((error as AxiosError<IHealthResponse>).response?.data.database).toBe(HealthStatus.DOWN);
|
|
49
|
+
});
|
|
50
|
+
});
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import * as healthApi from './api/health.api';
|
|
3
|
+
import * as functionApi from './api/function.api';
|
|
4
|
+
import * as functionAccessApi from './api/function-access.api';
|
|
5
|
+
import * as functionTestApi from './api/function-test.api';
|
|
6
|
+
import * as functionVersionApi from './api/function-version.api';
|
|
7
|
+
import * as functionPromotionApi from './api/function-promotion.api';
|
|
8
|
+
import * as functionTriggerApi from './api/function-trigger.api';
|
|
9
|
+
import * as functionRunApi from './api/function-run.api';
|
|
10
|
+
import * as functionSettingsApi from './api/function-settings.api';
|
|
11
|
+
|
|
12
|
+
export * from './api';
|
|
13
|
+
export * from './types';
|
|
14
|
+
|
|
15
|
+
const DEFAULT_BASE_URL = 'https://reflex-api.abyss-project.fr/';
|
|
16
|
+
|
|
17
|
+
type CoreConfig = {
|
|
18
|
+
baseURL?: string;
|
|
19
|
+
/** The session token of the member (`Authorization: Bearer`). Every route but `health` needs it. */
|
|
20
|
+
token?: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type AbyssReflexCoreSDK = {
|
|
24
|
+
/** `GET /health` — status of the database and Redis behind the API. */
|
|
25
|
+
health: typeof healthApi.health;
|
|
26
|
+
function: {
|
|
27
|
+
list: typeof functionApi.listFunction;
|
|
28
|
+
create: typeof functionApi.createFunction;
|
|
29
|
+
get: typeof functionApi.getFunction;
|
|
30
|
+
update: typeof functionApi.updateFunction;
|
|
31
|
+
delete: typeof functionApi.deleteFunction;
|
|
32
|
+
access: {
|
|
33
|
+
list: typeof functionAccessApi.listFunctionAccess;
|
|
34
|
+
grant: typeof functionAccessApi.grantFunctionAccess;
|
|
35
|
+
revoke: typeof functionAccessApi.revokeFunctionAccess;
|
|
36
|
+
};
|
|
37
|
+
test: {
|
|
38
|
+
simulate: typeof functionTestApi.simulateFunction;
|
|
39
|
+
dryRun: typeof functionTestApi.dryRunFunction;
|
|
40
|
+
};
|
|
41
|
+
version: {
|
|
42
|
+
list: typeof functionVersionApi.listFunctionVersion;
|
|
43
|
+
publish: typeof functionVersionApi.publishFunctionVersion;
|
|
44
|
+
get: typeof functionVersionApi.getFunctionVersion;
|
|
45
|
+
stepStats: typeof functionVersionApi.getFunctionVersionStepStats;
|
|
46
|
+
};
|
|
47
|
+
promotion: {
|
|
48
|
+
list: typeof functionPromotionApi.listFunctionPromotion;
|
|
49
|
+
promote: typeof functionPromotionApi.promoteFunction;
|
|
50
|
+
rollback: typeof functionPromotionApi.rollbackFunction;
|
|
51
|
+
};
|
|
52
|
+
trigger: {
|
|
53
|
+
list: typeof functionTriggerApi.listFunctionTrigger;
|
|
54
|
+
create: typeof functionTriggerApi.createFunctionTrigger;
|
|
55
|
+
rotate: typeof functionTriggerApi.rotateFunctionTrigger;
|
|
56
|
+
delete: typeof functionTriggerApi.deleteFunctionTrigger;
|
|
57
|
+
};
|
|
58
|
+
run: {
|
|
59
|
+
list: typeof functionRunApi.listFunctionRun;
|
|
60
|
+
get: typeof functionRunApi.getFunctionRun;
|
|
61
|
+
state: typeof functionRunApi.getFunctionRunState;
|
|
62
|
+
};
|
|
63
|
+
settings: {
|
|
64
|
+
get: typeof functionSettingsApi.getFunctionSettings;
|
|
65
|
+
setDefault: typeof functionSettingsApi.setFunctionDefaultSettings;
|
|
66
|
+
setEnvironment: typeof functionSettingsApi.setFunctionEnvironmentSettings;
|
|
67
|
+
removeEnvironment: typeof functionSettingsApi.removeFunctionEnvironmentSettings;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export class AbyssReflexCore {
|
|
73
|
+
private static config: CoreConfig = {
|
|
74
|
+
baseURL: DEFAULT_BASE_URL,
|
|
75
|
+
};
|
|
76
|
+
static axios = axios.create({
|
|
77
|
+
baseURL: DEFAULT_BASE_URL,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
private static _sdk: AbyssReflexCoreSDK | null = null;
|
|
81
|
+
|
|
82
|
+
public static get sdk(): AbyssReflexCoreSDK {
|
|
83
|
+
if (!AbyssReflexCore._sdk) {
|
|
84
|
+
AbyssReflexCore._sdk = {
|
|
85
|
+
health: healthApi.health,
|
|
86
|
+
function: {
|
|
87
|
+
list: functionApi.listFunction,
|
|
88
|
+
create: functionApi.createFunction,
|
|
89
|
+
get: functionApi.getFunction,
|
|
90
|
+
update: functionApi.updateFunction,
|
|
91
|
+
delete: functionApi.deleteFunction,
|
|
92
|
+
access: {
|
|
93
|
+
list: functionAccessApi.listFunctionAccess,
|
|
94
|
+
grant: functionAccessApi.grantFunctionAccess,
|
|
95
|
+
revoke: functionAccessApi.revokeFunctionAccess,
|
|
96
|
+
},
|
|
97
|
+
test: {
|
|
98
|
+
simulate: functionTestApi.simulateFunction,
|
|
99
|
+
dryRun: functionTestApi.dryRunFunction,
|
|
100
|
+
},
|
|
101
|
+
version: {
|
|
102
|
+
list: functionVersionApi.listFunctionVersion,
|
|
103
|
+
publish: functionVersionApi.publishFunctionVersion,
|
|
104
|
+
get: functionVersionApi.getFunctionVersion,
|
|
105
|
+
stepStats: functionVersionApi.getFunctionVersionStepStats,
|
|
106
|
+
},
|
|
107
|
+
promotion: {
|
|
108
|
+
list: functionPromotionApi.listFunctionPromotion,
|
|
109
|
+
promote: functionPromotionApi.promoteFunction,
|
|
110
|
+
rollback: functionPromotionApi.rollbackFunction,
|
|
111
|
+
},
|
|
112
|
+
trigger: {
|
|
113
|
+
list: functionTriggerApi.listFunctionTrigger,
|
|
114
|
+
create: functionTriggerApi.createFunctionTrigger,
|
|
115
|
+
rotate: functionTriggerApi.rotateFunctionTrigger,
|
|
116
|
+
delete: functionTriggerApi.deleteFunctionTrigger,
|
|
117
|
+
},
|
|
118
|
+
run: {
|
|
119
|
+
list: functionRunApi.listFunctionRun,
|
|
120
|
+
get: functionRunApi.getFunctionRun,
|
|
121
|
+
state: functionRunApi.getFunctionRunState,
|
|
122
|
+
},
|
|
123
|
+
settings: {
|
|
124
|
+
get: functionSettingsApi.getFunctionSettings,
|
|
125
|
+
setDefault: functionSettingsApi.setFunctionDefaultSettings,
|
|
126
|
+
setEnvironment: functionSettingsApi.setFunctionEnvironmentSettings,
|
|
127
|
+
removeEnvironment: functionSettingsApi.removeFunctionEnvironmentSettings,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
return AbyssReflexCore._sdk;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
public static setConfig(config: CoreConfig): void {
|
|
136
|
+
AbyssReflexCore._sdk = null;
|
|
137
|
+
|
|
138
|
+
AbyssReflexCore.config = { ...AbyssReflexCore.config, ...config };
|
|
139
|
+
|
|
140
|
+
if (config.baseURL) {
|
|
141
|
+
AbyssReflexCore.axios.defaults.baseURL = config.baseURL;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (config.token) {
|
|
145
|
+
AbyssReflexCore.axios.defaults.headers.common.Authorization = `Bearer ${config.token}`;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
public static getConfig(): CoreConfig {
|
|
150
|
+
return AbyssReflexCore.config;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State of an access granted to a function.
|
|
3
|
+
* - ACTIVE: the grantor still holds the right the access needs.
|
|
4
|
+
* - SUSPENDED: a publication found the grantor without that right. Publishing is refused
|
|
5
|
+
* (`GRANT_SUSPENDED`) until the access is revoked and granted again; what is already promoted keeps running.
|
|
6
|
+
* - REVOKED: withdrawn on purpose; the row stays as the journal.
|
|
7
|
+
*/
|
|
8
|
+
export enum AccessGrantStatus {
|
|
9
|
+
ACTIVE = 'ACTIVE',
|
|
10
|
+
SUSPENDED = 'SUSPENDED',
|
|
11
|
+
REVOKED = 'REVOKED',
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** The kinds of access a definition declares and a member grants (the format of @abyss-project/runtime). */
|
|
2
|
+
export enum ReflexAccessKind {
|
|
3
|
+
/** Outbound HTTP to a list of host names (exact, or `*.domain` for any sub-domain). */
|
|
4
|
+
HTTP = 'HTTP',
|
|
5
|
+
/** One action of the host catalog (`store.get`, `store.set`, `store.increment`, `secret.get`, `http.respond`). */
|
|
6
|
+
HOST_ACTION = 'HOST_ACTION',
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How an HTTP trigger answers its caller.
|
|
3
|
+
* - SYNC: the caller waits for the Respond step, or gets 504 past the response timeout.
|
|
4
|
+
* - ASYNC: the caller gets `202 {executionId}` before the execution starts, and reads its state.
|
|
5
|
+
*/
|
|
6
|
+
export enum ExecutionMode {
|
|
7
|
+
SYNC = 'SYNC',
|
|
8
|
+
ASYNC = 'ASYNC',
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory of the isolate an execution runs in (ADR-0239). The CPU part of the cost grows with the
|
|
3
|
+
* profile: S x1, M x1.05, L x1.10, XL x1.20, XXL x1.35.
|
|
4
|
+
*/
|
|
5
|
+
export enum ExecutionProfile {
|
|
6
|
+
S = 'S',
|
|
7
|
+
M = 'M',
|
|
8
|
+
L = 'L',
|
|
9
|
+
XL = 'XL',
|
|
10
|
+
XXL = 'XXL',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Memory limit of each profile, in MB (1 GB = 1024 MB). */
|
|
14
|
+
export const EXECUTION_PROFILE_MEMORY_MB: Readonly<Record<ExecutionProfile, number>> = {
|
|
15
|
+
[ExecutionProfile.S]: 128,
|
|
16
|
+
[ExecutionProfile.M]: 256,
|
|
17
|
+
[ExecutionProfile.L]: 512,
|
|
18
|
+
[ExecutionProfile.XL]: 1024,
|
|
19
|
+
[ExecutionProfile.XXL]: 2048,
|
|
20
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Where the effective settings of an environment come from. */
|
|
2
|
+
export enum ExecutionSettingsSource {
|
|
3
|
+
/** The override of this environment. */
|
|
4
|
+
ENVIRONMENT = 'ENVIRONMENT',
|
|
5
|
+
/** The default of the function, for every environment without an override. */
|
|
6
|
+
DEFAULT = 'DEFAULT',
|
|
7
|
+
/** Nothing is set: the built-in defaults. */
|
|
8
|
+
BUILT_IN = 'BUILT_IN',
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './health-status.enum';
|
|
2
|
+
export * from './trigger-type.enum';
|
|
3
|
+
export * from './trigger-access-mode.enum';
|
|
4
|
+
export * from './access-grant-status.enum';
|
|
5
|
+
export * from './run-mode.enum';
|
|
6
|
+
export * from './run-status.enum';
|
|
7
|
+
export * from './trace-effect-type.enum';
|
|
8
|
+
export * from './reflex-error-code.enum';
|
|
9
|
+
export * from './access-kind.enum';
|
|
10
|
+
export * from './execution-profile.enum';
|
|
11
|
+
export * from './execution-mode.enum';
|
|
12
|
+
export * from './execution-settings-source.enum';
|
|
13
|
+
export * from './run-step-status.enum';
|
|
14
|
+
export * from './run-log-level.enum';
|