@abyss-project/reflex 6.2.0 → 6.3.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 -32
- package/README.md +15 -15
- package/dist/api/function-run.api.d.ts +1 -2
- package/dist/api/function-run.api.js +1 -3
- package/dist/api/function-run.api.js.map +1 -1
- package/dist/api/function-settings.api.d.ts +1 -3
- package/dist/api/function-settings.api.js +1 -7
- package/dist/api/function-settings.api.js.map +1 -1
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.js +0 -1
- package/dist/api/index.js.map +1 -1
- package/dist/index.d.ts +0 -16
- package/dist/index.js +1 -19
- package/dist/index.js.map +1 -1
- package/dist/types/enum/discord-host-action.enum.d.ts +3 -1
- package/dist/types/enum/discord-host-action.enum.js +2 -0
- package/dist/types/enum/discord-host-action.enum.js.map +1 -1
- package/dist/types/enum/reflex-error-code.enum.d.ts +1 -4
- package/dist/types/enum/reflex-error-code.enum.js +0 -3
- package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
- package/dist/types/interface/api/requests/application-run-settings.request.d.ts +0 -1
- package/dist/types/interface/api/requests/function-run.request.d.ts +0 -8
- package/dist/types/interface/api/requests/function-settings.request.d.ts +0 -12
- package/dist/types/interface/api/requests/index.d.ts +0 -1
- package/dist/types/interface/api/requests/index.js +0 -1
- package/dist/types/interface/api/requests/index.js.map +1 -1
- package/dist/types/interface/api/requests/service-discord.request.d.ts +1 -0
- package/dist/types/interface/api/requests/service.request.d.ts +0 -1
- package/dist/types/interface/api/responses/function-run.response.d.ts +0 -4
- package/dist/types/interface/api/responses/function-settings.response.d.ts +1 -5
- package/dist/types/interface/api/responses/index.d.ts +0 -1
- package/dist/types/interface/api/responses/index.js +0 -1
- package/dist/types/interface/api/responses/index.js.map +1 -1
- package/dist/types/interface/models/index.d.ts +0 -2
- package/dist/types/interface/models/index.js +0 -2
- package/dist/types/interface/models/index.js.map +1 -1
- package/dist/types/interface/models/reflex-discord.model.d.ts +5 -0
- package/dist/types/interface/models/reflex-discord.model.js +2 -0
- package/dist/types/interface/models/reflex-discord.model.js.map +1 -1
- package/dist/types/interface/models/reflex-price-list.model.d.ts +1 -0
- package/dist/types/interface/models/reflex-run-settings.model.d.ts +0 -4
- package/dist/types/interface/models/reflex-run.model.d.ts +0 -5
- package/dist/types/interface/models/reflex-service-deployment.model.d.ts +2 -2
- package/dist/types/interface/models/reflex-service.model.d.ts +0 -1
- package/jest.config.ts +11 -11
- package/package.json +1 -1
- package/src/api/alert-rule.api.test.ts +72 -72
- package/src/api/alert-rule.api.ts +57 -57
- package/src/api/application-insights.api.test.ts +42 -42
- package/src/api/application-insights.api.ts +38 -38
- package/src/api/application-run-settings.api.test.ts +0 -11
- package/src/api/application-run-settings.api.ts +30 -30
- package/src/api/function-access.api.ts +87 -87
- package/src/api/function-insights.api.test.ts +27 -27
- package/src/api/function-insights.api.ts +18 -18
- package/src/api/function-run.api.ts +0 -15
- package/src/api/function-settings.api.ts +0 -22
- package/src/api/function-template.api.test.ts +72 -72
- package/src/api/function-template.api.ts +52 -52
- package/src/api/function-test.api.ts +34 -34
- package/src/api/function-version.api.ts +66 -66
- package/src/api/function.api.test.ts +0 -55
- package/src/api/function.api.ts +62 -62
- package/src/api/health.api.ts +10 -10
- package/src/api/index.ts +26 -27
- package/src/api/route-stats.api.test.ts +45 -45
- package/src/api/route-stats.api.ts +36 -36
- package/src/api/service-completion-webhook.api.test.ts +97 -97
- package/src/api/service-completion-webhook.api.ts +39 -39
- package/src/api/service-configuration.api.ts +16 -16
- package/src/api/service-consumer.api.test.ts +104 -104
- package/src/api/service-consumer.api.ts +90 -90
- package/src/api/service-deployment.api.ts +79 -79
- package/src/api/service-discord-event.api.test.ts +106 -106
- package/src/api/service-discord-event.api.ts +78 -78
- package/src/api/service-discord.api.test.ts +178 -178
- package/src/api/service-discord.api.ts +222 -222
- package/src/api/service-insights.api.test.ts +36 -36
- package/src/api/service-insights.api.ts +42 -42
- package/src/api/service-limits.api.test.ts +100 -100
- package/src/api/service-limits.api.ts +37 -37
- package/src/api/service-openapi.api.test.ts +52 -52
- package/src/api/service-openapi.api.ts +21 -21
- package/src/api/service-route.api.ts +74 -74
- package/src/api/service-task.api.test.ts +140 -140
- package/src/api/service-task.api.ts +141 -141
- package/src/api/service-version.api.ts +54 -54
- package/src/api/service.api.test.ts +1 -6
- package/src/api/service.api.ts +55 -55
- package/src/discord/discord-event-filter-cases.ts +261 -261
- package/src/discord/discord-event-filters.test.ts +91 -91
- package/src/discord/discord-event-filters.ts +95 -95
- package/src/discord/discord-event-intents.test.ts +112 -112
- package/src/discord/discord-event-intents.ts +55 -55
- package/src/discord/index.ts +3 -3
- package/src/index.test.ts +104 -104
- package/src/index.ts +0 -42
- package/src/insights/index.ts +1 -1
- package/src/insights/percentiles.test.ts +75 -75
- package/src/insights/percentiles.ts +37 -37
- package/src/types/enum/discord-host-action.enum.ts +2 -0
- package/src/types/enum/reflex-error-code.enum.ts +0 -16
- package/src/types/interface/api/requests/application-run-settings.request.ts +0 -2
- package/src/types/interface/api/requests/function-run.request.ts +0 -10
- package/src/types/interface/api/requests/function-settings.request.ts +0 -16
- package/src/types/interface/api/requests/index.ts +0 -1
- package/src/types/interface/api/requests/service-discord.request.ts +6 -0
- package/src/types/interface/api/requests/service.request.ts +0 -2
- package/src/types/interface/api/responses/function-run.response.ts +0 -5
- package/src/types/interface/api/responses/function-settings.response.ts +0 -7
- package/src/types/interface/api/responses/index.ts +0 -1
- package/src/types/interface/models/index.ts +0 -2
- package/src/types/interface/models/reflex-discord.model.ts +12 -0
- package/src/types/interface/models/reflex-price-list.model.ts +2 -0
- package/src/types/interface/models/reflex-run-settings.model.ts +0 -11
- package/src/types/interface/models/reflex-run.model.ts +0 -10
- package/src/types/interface/models/reflex-service-deployment.model.ts +2 -4
- package/src/types/interface/models/reflex-service.model.ts +0 -2
- package/tsconfig.check.json +15 -15
- package/tsconfig.json +35 -35
- package/dist/api/storage-surplus.admin.api.d.ts +0 -5
- package/dist/api/storage-surplus.admin.api.js +0 -17
- package/dist/api/storage-surplus.admin.api.js.map +0 -1
- package/dist/types/interface/api/requests/storage-surplus.admin.request.d.ts +0 -8
- package/dist/types/interface/api/requests/storage-surplus.admin.request.js +0 -3
- package/dist/types/interface/api/requests/storage-surplus.admin.request.js.map +0 -1
- package/dist/types/interface/api/responses/storage-surplus.admin.response.d.ts +0 -8
- package/dist/types/interface/api/responses/storage-surplus.admin.response.js +0 -3
- package/dist/types/interface/api/responses/storage-surplus.admin.response.js.map +0 -1
- package/dist/types/interface/models/reflex-run-retention.model.d.ts +0 -13
- package/dist/types/interface/models/reflex-run-retention.model.js +0 -8
- package/dist/types/interface/models/reflex-run-retention.model.js.map +0 -1
- package/dist/types/interface/models/reflex-storage-surplus.model.d.ts +0 -11
- package/dist/types/interface/models/reflex-storage-surplus.model.js +0 -3
- package/dist/types/interface/models/reflex-storage-surplus.model.js.map +0 -1
- package/src/api/storage-surplus.admin.api.test.ts +0 -66
- package/src/api/storage-surplus.admin.api.ts +0 -45
- package/src/types/interface/api/requests/storage-surplus.admin.request.ts +0 -12
- package/src/types/interface/api/responses/storage-surplus.admin.response.ts +0 -10
- package/src/types/interface/models/reflex-run-retention.model.ts +0 -24
- package/src/types/interface/models/reflex-storage-surplus.model.ts +0 -23
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import { AbyssReflexCore } from '..';
|
|
2
|
-
import type {
|
|
3
|
-
IDismissFunctionAccessRequestParams,
|
|
4
|
-
IDismissFunctionAccessRequestResponse,
|
|
5
|
-
IGrantAllFunctionAccessParams,
|
|
6
|
-
IGrantAllFunctionAccessResponse,
|
|
7
|
-
IGrantFunctionAccessRequestParams,
|
|
8
|
-
IGrantFunctionAccessRequestResponse,
|
|
9
|
-
IRequestFunctionAccessBody,
|
|
10
|
-
IRequestFunctionAccessParams,
|
|
11
|
-
IRequestFunctionAccessResponse,
|
|
12
|
-
IGrantFunctionAccessBody,
|
|
13
|
-
IGrantFunctionAccessParams,
|
|
14
|
-
IGrantFunctionAccessResponse,
|
|
15
|
-
IListFunctionAccessParams,
|
|
16
|
-
IListFunctionAccessResponse,
|
|
17
|
-
IRevokeFunctionAccessParams,
|
|
18
|
-
IRevokeFunctionAccessResponse,
|
|
19
|
-
} from '../types';
|
|
20
|
-
|
|
21
|
-
const accessUrl = (params: { applicationId: string; functionId: string }): string =>
|
|
22
|
-
`api/function/${params.applicationId}/${params.functionId}/access`;
|
|
23
|
-
|
|
24
|
-
/** `GET .../access`: every access granted to the function, revoked ones included (the journal), its requests and the declaration keys the caller may grant. Needs REFLEX_READ. */
|
|
25
|
-
export const listFunctionAccess = async (
|
|
26
|
-
params: IListFunctionAccessParams,
|
|
27
|
-
): Promise<IListFunctionAccessResponse> =>
|
|
28
|
-
(await AbyssReflexCore.axios.get<IListFunctionAccessResponse>(accessUrl(params))).data;
|
|
29
|
-
|
|
30
|
-
/** `POST .../access`: grants an access the draft declares. The caller must hold the right it needs (`403` otherwise). */
|
|
31
|
-
export const grantFunctionAccess = async (
|
|
32
|
-
params: IGrantFunctionAccessParams,
|
|
33
|
-
body: IGrantFunctionAccessBody,
|
|
34
|
-
): Promise<IGrantFunctionAccessResponse> =>
|
|
35
|
-
(await AbyssReflexCore.axios.post<IGrantFunctionAccessResponse>(accessUrl(params), body)).data;
|
|
36
|
-
|
|
37
|
-
/** `DELETE .../access/:grantId`: withdraws the access, at once, from what is already promoted. Needs REFLEX_FUNCTION_UPDATE. */
|
|
38
|
-
export const revokeFunctionAccess = async (
|
|
39
|
-
params: IRevokeFunctionAccessParams,
|
|
40
|
-
): Promise<IRevokeFunctionAccessResponse> =>
|
|
41
|
-
(
|
|
42
|
-
await AbyssReflexCore.axios.delete<IRevokeFunctionAccessResponse>(
|
|
43
|
-
`${accessUrl(params)}/${params.grantId}`,
|
|
44
|
-
)
|
|
45
|
-
).data;
|
|
46
|
-
|
|
47
|
-
/** `POST .../access/grant-all`: grants every declaration of the saved draft the caller may grant and files a pending request for the rest. Needs REFLEX_READ; each grant needs the right of its declaration. */
|
|
48
|
-
export const grantAllFunctionAccess = async (
|
|
49
|
-
params: IGrantAllFunctionAccessParams,
|
|
50
|
-
): Promise<IGrantAllFunctionAccessResponse> =>
|
|
51
|
-
(
|
|
52
|
-
await AbyssReflexCore.axios.post<IGrantAllFunctionAccessResponse>(
|
|
53
|
-
`${accessUrl(params)}/grant-all`,
|
|
54
|
-
)
|
|
55
|
-
).data;
|
|
56
|
-
|
|
57
|
-
/** `POST .../access/request`: asks for an access the saved draft declares (`409 ACCESS_NOT_DECLARED` otherwise). Needs REFLEX_READ. */
|
|
58
|
-
export const requestFunctionAccess = async (
|
|
59
|
-
params: IRequestFunctionAccessParams,
|
|
60
|
-
body: IRequestFunctionAccessBody,
|
|
61
|
-
): Promise<IRequestFunctionAccessResponse> =>
|
|
62
|
-
(
|
|
63
|
-
await AbyssReflexCore.axios.post<IRequestFunctionAccessResponse>(
|
|
64
|
-
`${accessUrl(params)}/request`,
|
|
65
|
-
body,
|
|
66
|
-
)
|
|
67
|
-
).data;
|
|
68
|
-
|
|
69
|
-
/** `POST .../access/request/:requestId/grant`: grants the access of a pending request. The caller must hold the right the access needs. */
|
|
70
|
-
export const grantFunctionAccessRequest = async (
|
|
71
|
-
params: IGrantFunctionAccessRequestParams,
|
|
72
|
-
): Promise<IGrantFunctionAccessRequestResponse> =>
|
|
73
|
-
(
|
|
74
|
-
await AbyssReflexCore.axios.post<IGrantFunctionAccessRequestResponse>(
|
|
75
|
-
`${accessUrl(params)}/request/${params.requestId}/grant`,
|
|
76
|
-
)
|
|
77
|
-
).data;
|
|
78
|
-
|
|
79
|
-
/** `POST .../access/request/:requestId/dismiss`: sets a pending request aside. The caller must hold the right the access needs. */
|
|
80
|
-
export const dismissFunctionAccessRequest = async (
|
|
81
|
-
params: IDismissFunctionAccessRequestParams,
|
|
82
|
-
): Promise<IDismissFunctionAccessRequestResponse> =>
|
|
83
|
-
(
|
|
84
|
-
await AbyssReflexCore.axios.post<IDismissFunctionAccessRequestResponse>(
|
|
85
|
-
`${accessUrl(params)}/request/${params.requestId}/dismiss`,
|
|
86
|
-
)
|
|
87
|
-
).data;
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type {
|
|
3
|
+
IDismissFunctionAccessRequestParams,
|
|
4
|
+
IDismissFunctionAccessRequestResponse,
|
|
5
|
+
IGrantAllFunctionAccessParams,
|
|
6
|
+
IGrantAllFunctionAccessResponse,
|
|
7
|
+
IGrantFunctionAccessRequestParams,
|
|
8
|
+
IGrantFunctionAccessRequestResponse,
|
|
9
|
+
IRequestFunctionAccessBody,
|
|
10
|
+
IRequestFunctionAccessParams,
|
|
11
|
+
IRequestFunctionAccessResponse,
|
|
12
|
+
IGrantFunctionAccessBody,
|
|
13
|
+
IGrantFunctionAccessParams,
|
|
14
|
+
IGrantFunctionAccessResponse,
|
|
15
|
+
IListFunctionAccessParams,
|
|
16
|
+
IListFunctionAccessResponse,
|
|
17
|
+
IRevokeFunctionAccessParams,
|
|
18
|
+
IRevokeFunctionAccessResponse,
|
|
19
|
+
} from '../types';
|
|
20
|
+
|
|
21
|
+
const accessUrl = (params: { applicationId: string; functionId: string }): string =>
|
|
22
|
+
`api/function/${params.applicationId}/${params.functionId}/access`;
|
|
23
|
+
|
|
24
|
+
/** `GET .../access`: every access granted to the function, revoked ones included (the journal), its requests and the declaration keys the caller may grant. Needs REFLEX_READ. */
|
|
25
|
+
export const listFunctionAccess = async (
|
|
26
|
+
params: IListFunctionAccessParams,
|
|
27
|
+
): Promise<IListFunctionAccessResponse> =>
|
|
28
|
+
(await AbyssReflexCore.axios.get<IListFunctionAccessResponse>(accessUrl(params))).data;
|
|
29
|
+
|
|
30
|
+
/** `POST .../access`: grants an access the draft declares. The caller must hold the right it needs (`403` otherwise). */
|
|
31
|
+
export const grantFunctionAccess = async (
|
|
32
|
+
params: IGrantFunctionAccessParams,
|
|
33
|
+
body: IGrantFunctionAccessBody,
|
|
34
|
+
): Promise<IGrantFunctionAccessResponse> =>
|
|
35
|
+
(await AbyssReflexCore.axios.post<IGrantFunctionAccessResponse>(accessUrl(params), body)).data;
|
|
36
|
+
|
|
37
|
+
/** `DELETE .../access/:grantId`: withdraws the access, at once, from what is already promoted. Needs REFLEX_FUNCTION_UPDATE. */
|
|
38
|
+
export const revokeFunctionAccess = async (
|
|
39
|
+
params: IRevokeFunctionAccessParams,
|
|
40
|
+
): Promise<IRevokeFunctionAccessResponse> =>
|
|
41
|
+
(
|
|
42
|
+
await AbyssReflexCore.axios.delete<IRevokeFunctionAccessResponse>(
|
|
43
|
+
`${accessUrl(params)}/${params.grantId}`,
|
|
44
|
+
)
|
|
45
|
+
).data;
|
|
46
|
+
|
|
47
|
+
/** `POST .../access/grant-all`: grants every declaration of the saved draft the caller may grant and files a pending request for the rest. Needs REFLEX_READ; each grant needs the right of its declaration. */
|
|
48
|
+
export const grantAllFunctionAccess = async (
|
|
49
|
+
params: IGrantAllFunctionAccessParams,
|
|
50
|
+
): Promise<IGrantAllFunctionAccessResponse> =>
|
|
51
|
+
(
|
|
52
|
+
await AbyssReflexCore.axios.post<IGrantAllFunctionAccessResponse>(
|
|
53
|
+
`${accessUrl(params)}/grant-all`,
|
|
54
|
+
)
|
|
55
|
+
).data;
|
|
56
|
+
|
|
57
|
+
/** `POST .../access/request`: asks for an access the saved draft declares (`409 ACCESS_NOT_DECLARED` otherwise). Needs REFLEX_READ. */
|
|
58
|
+
export const requestFunctionAccess = async (
|
|
59
|
+
params: IRequestFunctionAccessParams,
|
|
60
|
+
body: IRequestFunctionAccessBody,
|
|
61
|
+
): Promise<IRequestFunctionAccessResponse> =>
|
|
62
|
+
(
|
|
63
|
+
await AbyssReflexCore.axios.post<IRequestFunctionAccessResponse>(
|
|
64
|
+
`${accessUrl(params)}/request`,
|
|
65
|
+
body,
|
|
66
|
+
)
|
|
67
|
+
).data;
|
|
68
|
+
|
|
69
|
+
/** `POST .../access/request/:requestId/grant`: grants the access of a pending request. The caller must hold the right the access needs. */
|
|
70
|
+
export const grantFunctionAccessRequest = async (
|
|
71
|
+
params: IGrantFunctionAccessRequestParams,
|
|
72
|
+
): Promise<IGrantFunctionAccessRequestResponse> =>
|
|
73
|
+
(
|
|
74
|
+
await AbyssReflexCore.axios.post<IGrantFunctionAccessRequestResponse>(
|
|
75
|
+
`${accessUrl(params)}/request/${params.requestId}/grant`,
|
|
76
|
+
)
|
|
77
|
+
).data;
|
|
78
|
+
|
|
79
|
+
/** `POST .../access/request/:requestId/dismiss`: sets a pending request aside. The caller must hold the right the access needs. */
|
|
80
|
+
export const dismissFunctionAccessRequest = async (
|
|
81
|
+
params: IDismissFunctionAccessRequestParams,
|
|
82
|
+
): Promise<IDismissFunctionAccessRequestResponse> =>
|
|
83
|
+
(
|
|
84
|
+
await AbyssReflexCore.axios.post<IDismissFunctionAccessRequestResponse>(
|
|
85
|
+
`${accessUrl(params)}/request/${params.requestId}/dismiss`,
|
|
86
|
+
)
|
|
87
|
+
).data;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { AxiosAdapter, InternalAxiosRequestConfig } from 'axios';
|
|
2
|
-
import { AbyssReflexCore, InsightsPeriod } from '..';
|
|
3
|
-
|
|
4
|
-
describe('AbyssReflexCore function insights route', () => {
|
|
5
|
-
const adapter = jest.fn<ReturnType<AxiosAdapter>, [InternalAxiosRequestConfig]>(
|
|
6
|
-
async (config) => ({ data: { data: {} }, status: 200, statusText: '', headers: {}, config }),
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
beforeAll(() => {
|
|
10
|
-
AbyssReflexCore.setConfig({ baseURL: 'http://reflex.test/', token: 'session-token' });
|
|
11
|
-
AbyssReflexCore.axios.defaults.adapter = adapter;
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
beforeEach(() => adapter.mockClear());
|
|
15
|
-
|
|
16
|
-
it('insights.get calls GET /api/function/:applicationId/:functionId/insights', async () => {
|
|
17
|
-
await AbyssReflexCore.sdk.function.insights.get(
|
|
18
|
-
{ applicationId: 'app-1', functionId: 'fn-1' },
|
|
19
|
-
{ environmentId: 'e-1', period: InsightsPeriod.HOURS_24 },
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const config = adapter.mock.calls[0][0];
|
|
23
|
-
expect(config.method).toBe('get');
|
|
24
|
-
expect(config.url).toBe('api/function/app-1/fn-1/insights');
|
|
25
|
-
expect(config.params).toEqual({ environmentId: 'e-1', period: '24h' });
|
|
26
|
-
});
|
|
27
|
-
});
|
|
1
|
+
import { AxiosAdapter, InternalAxiosRequestConfig } from 'axios';
|
|
2
|
+
import { AbyssReflexCore, InsightsPeriod } from '..';
|
|
3
|
+
|
|
4
|
+
describe('AbyssReflexCore function insights route', () => {
|
|
5
|
+
const adapter = jest.fn<ReturnType<AxiosAdapter>, [InternalAxiosRequestConfig]>(
|
|
6
|
+
async (config) => ({ data: { data: {} }, status: 200, statusText: '', headers: {}, config }),
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
AbyssReflexCore.setConfig({ baseURL: 'http://reflex.test/', token: 'session-token' });
|
|
11
|
+
AbyssReflexCore.axios.defaults.adapter = adapter;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
beforeEach(() => adapter.mockClear());
|
|
15
|
+
|
|
16
|
+
it('insights.get calls GET /api/function/:applicationId/:functionId/insights', async () => {
|
|
17
|
+
await AbyssReflexCore.sdk.function.insights.get(
|
|
18
|
+
{ applicationId: 'app-1', functionId: 'fn-1' },
|
|
19
|
+
{ environmentId: 'e-1', period: InsightsPeriod.HOURS_24 },
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const config = adapter.mock.calls[0][0];
|
|
23
|
+
expect(config.method).toBe('get');
|
|
24
|
+
expect(config.url).toBe('api/function/app-1/fn-1/insights');
|
|
25
|
+
expect(config.params).toEqual({ environmentId: 'e-1', period: '24h' });
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { AbyssReflexCore } from '..';
|
|
2
|
-
import type {
|
|
3
|
-
IGetFunctionInsightsParams,
|
|
4
|
-
IGetFunctionInsightsQuery,
|
|
5
|
-
IGetFunctionInsightsResponse,
|
|
6
|
-
} from '../types';
|
|
7
|
-
|
|
8
|
-
/** `GET .../function/:applicationId/:functionId/insights`: the dashboard of a function, same shape as a Service's. Needs REFLEX_LOG_READ. */
|
|
9
|
-
export const getFunctionInsights = async (
|
|
10
|
-
params: IGetFunctionInsightsParams,
|
|
11
|
-
query: IGetFunctionInsightsQuery,
|
|
12
|
-
): Promise<IGetFunctionInsightsResponse> =>
|
|
13
|
-
(
|
|
14
|
-
await AbyssReflexCore.axios.get<IGetFunctionInsightsResponse>(
|
|
15
|
-
`api/function/${params.applicationId}/${params.functionId}/insights`,
|
|
16
|
-
{ params: query },
|
|
17
|
-
)
|
|
18
|
-
).data;
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type {
|
|
3
|
+
IGetFunctionInsightsParams,
|
|
4
|
+
IGetFunctionInsightsQuery,
|
|
5
|
+
IGetFunctionInsightsResponse,
|
|
6
|
+
} from '../types';
|
|
7
|
+
|
|
8
|
+
/** `GET .../function/:applicationId/:functionId/insights`: the dashboard of a function, same shape as a Service's. Needs REFLEX_LOG_READ. */
|
|
9
|
+
export const getFunctionInsights = async (
|
|
10
|
+
params: IGetFunctionInsightsParams,
|
|
11
|
+
query: IGetFunctionInsightsQuery,
|
|
12
|
+
): Promise<IGetFunctionInsightsResponse> =>
|
|
13
|
+
(
|
|
14
|
+
await AbyssReflexCore.axios.get<IGetFunctionInsightsResponse>(
|
|
15
|
+
`api/function/${params.applicationId}/${params.functionId}/insights`,
|
|
16
|
+
{ params: query },
|
|
17
|
+
)
|
|
18
|
+
).data;
|
|
@@ -7,9 +7,6 @@ import type {
|
|
|
7
7
|
IListFunctionRunParams,
|
|
8
8
|
IListFunctionRunQuery,
|
|
9
9
|
IListFunctionRunResponse,
|
|
10
|
-
ISetFunctionRunFavoriteBody,
|
|
11
|
-
ISetFunctionRunFavoriteParams,
|
|
12
|
-
ISetFunctionRunFavoriteResponse,
|
|
13
10
|
} from '../types';
|
|
14
11
|
|
|
15
12
|
const runUrl = (params: { applicationId: string; functionId: string }): string =>
|
|
@@ -39,15 +36,3 @@ export const getFunctionRunState = async (
|
|
|
39
36
|
`${runUrl(params)}/${params.runId}/state`,
|
|
40
37
|
)
|
|
41
38
|
).data;
|
|
42
|
-
|
|
43
|
-
/** `PUT .../run/:runId/favorite`: marks a run as a favorite (never purged) or not. Needs REFLEX_FUNCTION_UPDATE. */
|
|
44
|
-
export const setFunctionRunFavorite = async (
|
|
45
|
-
params: ISetFunctionRunFavoriteParams,
|
|
46
|
-
body: ISetFunctionRunFavoriteBody,
|
|
47
|
-
): Promise<ISetFunctionRunFavoriteResponse> =>
|
|
48
|
-
(
|
|
49
|
-
await AbyssReflexCore.axios.put<ISetFunctionRunFavoriteResponse>(
|
|
50
|
-
`${runUrl(params)}/${params.runId}/favorite`,
|
|
51
|
-
body,
|
|
52
|
-
)
|
|
53
|
-
).data;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { AbyssReflexCore } from '..';
|
|
2
2
|
import type {
|
|
3
|
-
IGetFunctionRunRetentionParams,
|
|
4
|
-
IGetFunctionRunRetentionResponse,
|
|
5
3
|
IGetFunctionSettingsParams,
|
|
6
4
|
IGetFunctionSettingsResponse,
|
|
7
5
|
IRemoveFunctionEnvironmentSettingsParams,
|
|
@@ -15,9 +13,6 @@ import type {
|
|
|
15
13
|
ISetFunctionLogCapBody,
|
|
16
14
|
ISetFunctionLogCapParams,
|
|
17
15
|
ISetFunctionLogCapResponse,
|
|
18
|
-
ISetFunctionRunRetentionBody,
|
|
19
|
-
ISetFunctionRunRetentionParams,
|
|
20
|
-
ISetFunctionRunRetentionResponse,
|
|
21
16
|
} from '../types';
|
|
22
17
|
|
|
23
18
|
const settingsUrl = (params: { applicationId: string; functionId: string }): string =>
|
|
@@ -77,20 +72,3 @@ export const setFunctionLogCap = async (
|
|
|
77
72
|
body,
|
|
78
73
|
)
|
|
79
74
|
).data;
|
|
80
|
-
|
|
81
|
-
const runRetentionUrl = (params: { applicationId: string; functionId: string }): string =>
|
|
82
|
-
`api/function/${params.applicationId}/${params.functionId}/run-retention`;
|
|
83
|
-
|
|
84
|
-
/** `GET .../run-retention`: the retention tier of the function, the one it inherits and the versions kept. Needs REFLEX_READ. */
|
|
85
|
-
export const getFunctionRunRetention = async (
|
|
86
|
-
params: IGetFunctionRunRetentionParams,
|
|
87
|
-
): Promise<IGetFunctionRunRetentionResponse> =>
|
|
88
|
-
(await AbyssReflexCore.axios.get<IGetFunctionRunRetentionResponse>(runRetentionUrl(params))).data;
|
|
89
|
-
|
|
90
|
-
/** `PUT .../run-retention`: sets the retention tier and the versions kept of the function. Needs REFLEX_FUNCTION_UPDATE. */
|
|
91
|
-
export const setFunctionRunRetention = async (
|
|
92
|
-
params: ISetFunctionRunRetentionParams,
|
|
93
|
-
body: ISetFunctionRunRetentionBody,
|
|
94
|
-
): Promise<ISetFunctionRunRetentionResponse> =>
|
|
95
|
-
(await AbyssReflexCore.axios.put<ISetFunctionRunRetentionResponse>(runRetentionUrl(params), body))
|
|
96
|
-
.data;
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { AxiosAdapter, InternalAxiosRequestConfig } from 'axios';
|
|
2
|
-
import { AbyssReflexCore } from '..';
|
|
3
|
-
|
|
4
|
-
const APP = 'app-1';
|
|
5
|
-
const BASE = `api/function-template/${APP}`;
|
|
6
|
-
|
|
7
|
-
interface Call {
|
|
8
|
-
label: string;
|
|
9
|
-
method: string;
|
|
10
|
-
url: string;
|
|
11
|
-
body?: unknown;
|
|
12
|
-
run: () => Promise<unknown>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const sdk = () => AbyssReflexCore.sdk.functionTemplate;
|
|
16
|
-
|
|
17
|
-
const calls: Call[] = [
|
|
18
|
-
{ label: 'list', method: 'get', url: BASE, run: () => sdk().list({ applicationId: APP }) },
|
|
19
|
-
{
|
|
20
|
-
label: 'create',
|
|
21
|
-
method: 'post',
|
|
22
|
-
url: BASE,
|
|
23
|
-
body: { name: 'Hook', description: 'A webhook', functionId: 'fn-1' },
|
|
24
|
-
run: () =>
|
|
25
|
-
sdk().create(
|
|
26
|
-
{ applicationId: APP },
|
|
27
|
-
{ name: 'Hook', description: 'A webhook', functionId: 'fn-1' },
|
|
28
|
-
),
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
label: 'update',
|
|
32
|
-
method: 'patch',
|
|
33
|
-
url: `${BASE}/t-1`,
|
|
34
|
-
body: { name: 'Renamed' },
|
|
35
|
-
run: () => sdk().update({ applicationId: APP, templateId: 't-1' }, { name: 'Renamed' }),
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
label: 'delete',
|
|
39
|
-
method: 'delete',
|
|
40
|
-
url: `${BASE}/t-1`,
|
|
41
|
-
run: () => sdk().delete({ applicationId: APP, templateId: 't-1' }),
|
|
42
|
-
},
|
|
43
|
-
];
|
|
44
|
-
|
|
45
|
-
describe('AbyssReflexCore function template routes', () => {
|
|
46
|
-
const adapter = jest.fn<ReturnType<AxiosAdapter>, [InternalAxiosRequestConfig]>(
|
|
47
|
-
async (config) => ({ data: { data: {} }, status: 200, statusText: '', headers: {}, config }),
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
beforeAll(() => {
|
|
51
|
-
AbyssReflexCore.setConfig({ baseURL: 'http://reflex.test/', token: 'session-token' });
|
|
52
|
-
AbyssReflexCore.axios.defaults.adapter = adapter;
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
beforeEach(() => adapter.mockClear());
|
|
56
|
-
|
|
57
|
-
it.each(calls)('$label calls $method $url', async (call) => {
|
|
58
|
-
await call.run();
|
|
59
|
-
|
|
60
|
-
const config = adapter.mock.calls[0][0];
|
|
61
|
-
expect(config.method).toBe(call.method);
|
|
62
|
-
expect(config.url).toBe(call.url);
|
|
63
|
-
expect(config.baseURL).toBe('http://reflex.test/');
|
|
64
|
-
if (call.body !== undefined) {
|
|
65
|
-
expect(JSON.parse(config.data)).toEqual(call.body);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('exposes no route twice', () => {
|
|
70
|
-
expect(new Set(calls.map((call) => `${call.method} ${call.url}`)).size).toBe(calls.length);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
1
|
+
import { AxiosAdapter, InternalAxiosRequestConfig } from 'axios';
|
|
2
|
+
import { AbyssReflexCore } from '..';
|
|
3
|
+
|
|
4
|
+
const APP = 'app-1';
|
|
5
|
+
const BASE = `api/function-template/${APP}`;
|
|
6
|
+
|
|
7
|
+
interface Call {
|
|
8
|
+
label: string;
|
|
9
|
+
method: string;
|
|
10
|
+
url: string;
|
|
11
|
+
body?: unknown;
|
|
12
|
+
run: () => Promise<unknown>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const sdk = () => AbyssReflexCore.sdk.functionTemplate;
|
|
16
|
+
|
|
17
|
+
const calls: Call[] = [
|
|
18
|
+
{ label: 'list', method: 'get', url: BASE, run: () => sdk().list({ applicationId: APP }) },
|
|
19
|
+
{
|
|
20
|
+
label: 'create',
|
|
21
|
+
method: 'post',
|
|
22
|
+
url: BASE,
|
|
23
|
+
body: { name: 'Hook', description: 'A webhook', functionId: 'fn-1' },
|
|
24
|
+
run: () =>
|
|
25
|
+
sdk().create(
|
|
26
|
+
{ applicationId: APP },
|
|
27
|
+
{ name: 'Hook', description: 'A webhook', functionId: 'fn-1' },
|
|
28
|
+
),
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: 'update',
|
|
32
|
+
method: 'patch',
|
|
33
|
+
url: `${BASE}/t-1`,
|
|
34
|
+
body: { name: 'Renamed' },
|
|
35
|
+
run: () => sdk().update({ applicationId: APP, templateId: 't-1' }, { name: 'Renamed' }),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: 'delete',
|
|
39
|
+
method: 'delete',
|
|
40
|
+
url: `${BASE}/t-1`,
|
|
41
|
+
run: () => sdk().delete({ applicationId: APP, templateId: 't-1' }),
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
describe('AbyssReflexCore function template routes', () => {
|
|
46
|
+
const adapter = jest.fn<ReturnType<AxiosAdapter>, [InternalAxiosRequestConfig]>(
|
|
47
|
+
async (config) => ({ data: { data: {} }, status: 200, statusText: '', headers: {}, config }),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
beforeAll(() => {
|
|
51
|
+
AbyssReflexCore.setConfig({ baseURL: 'http://reflex.test/', token: 'session-token' });
|
|
52
|
+
AbyssReflexCore.axios.defaults.adapter = adapter;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
beforeEach(() => adapter.mockClear());
|
|
56
|
+
|
|
57
|
+
it.each(calls)('$label calls $method $url', async (call) => {
|
|
58
|
+
await call.run();
|
|
59
|
+
|
|
60
|
+
const config = adapter.mock.calls[0][0];
|
|
61
|
+
expect(config.method).toBe(call.method);
|
|
62
|
+
expect(config.url).toBe(call.url);
|
|
63
|
+
expect(config.baseURL).toBe('http://reflex.test/');
|
|
64
|
+
if (call.body !== undefined) {
|
|
65
|
+
expect(JSON.parse(config.data)).toEqual(call.body);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('exposes no route twice', () => {
|
|
70
|
+
expect(new Set(calls.map((call) => `${call.method} ${call.url}`)).size).toBe(calls.length);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { AbyssReflexCore } from '..';
|
|
2
|
-
import type {
|
|
3
|
-
ICreateFunctionTemplateBody,
|
|
4
|
-
ICreateFunctionTemplateParams,
|
|
5
|
-
ICreateFunctionTemplateResponse,
|
|
6
|
-
IDeleteFunctionTemplateParams,
|
|
7
|
-
IDeleteFunctionTemplateResponse,
|
|
8
|
-
IListFunctionTemplateParams,
|
|
9
|
-
IListFunctionTemplateResponse,
|
|
10
|
-
IUpdateFunctionTemplateBody,
|
|
11
|
-
IUpdateFunctionTemplateParams,
|
|
12
|
-
IUpdateFunctionTemplateResponse,
|
|
13
|
-
} from '../types';
|
|
14
|
-
|
|
15
|
-
const templateUrl = (params: { applicationId: string }): string =>
|
|
16
|
-
`api/function-template/${params.applicationId}`;
|
|
17
|
-
|
|
18
|
-
/** `GET /api/function-template/:applicationId`: the templates of the application, sorted by name. Needs REFLEX_READ. */
|
|
19
|
-
export const listFunctionTemplate = async (
|
|
20
|
-
params: IListFunctionTemplateParams,
|
|
21
|
-
): Promise<IListFunctionTemplateResponse> =>
|
|
22
|
-
(await AbyssReflexCore.axios.get<IListFunctionTemplateResponse>(templateUrl(params))).data;
|
|
23
|
-
|
|
24
|
-
/** `POST /api/function-template/:applicationId`: saves the saved draft of a function as a template (`409` when the name is taken). Needs REFLEX_FUNCTION_CREATE. */
|
|
25
|
-
export const createFunctionTemplate = async (
|
|
26
|
-
params: ICreateFunctionTemplateParams,
|
|
27
|
-
body: ICreateFunctionTemplateBody,
|
|
28
|
-
): Promise<ICreateFunctionTemplateResponse> =>
|
|
29
|
-
(await AbyssReflexCore.axios.post<ICreateFunctionTemplateResponse>(templateUrl(params), body))
|
|
30
|
-
.data;
|
|
31
|
-
|
|
32
|
-
/** `PATCH /api/function-template/:applicationId/:templateId`: renames or re-describes the template. Needs REFLEX_FUNCTION_UPDATE. */
|
|
33
|
-
export const updateFunctionTemplate = async (
|
|
34
|
-
params: IUpdateFunctionTemplateParams,
|
|
35
|
-
body: IUpdateFunctionTemplateBody,
|
|
36
|
-
): Promise<IUpdateFunctionTemplateResponse> =>
|
|
37
|
-
(
|
|
38
|
-
await AbyssReflexCore.axios.patch<IUpdateFunctionTemplateResponse>(
|
|
39
|
-
`${templateUrl(params)}/${params.templateId}`,
|
|
40
|
-
body,
|
|
41
|
-
)
|
|
42
|
-
).data;
|
|
43
|
-
|
|
44
|
-
/** `DELETE /api/function-template/:applicationId/:templateId`. Needs REFLEX_FUNCTION_UPDATE. */
|
|
45
|
-
export const deleteFunctionTemplate = async (
|
|
46
|
-
params: IDeleteFunctionTemplateParams,
|
|
47
|
-
): Promise<IDeleteFunctionTemplateResponse> =>
|
|
48
|
-
(
|
|
49
|
-
await AbyssReflexCore.axios.delete<IDeleteFunctionTemplateResponse>(
|
|
50
|
-
`${templateUrl(params)}/${params.templateId}`,
|
|
51
|
-
)
|
|
52
|
-
).data;
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type {
|
|
3
|
+
ICreateFunctionTemplateBody,
|
|
4
|
+
ICreateFunctionTemplateParams,
|
|
5
|
+
ICreateFunctionTemplateResponse,
|
|
6
|
+
IDeleteFunctionTemplateParams,
|
|
7
|
+
IDeleteFunctionTemplateResponse,
|
|
8
|
+
IListFunctionTemplateParams,
|
|
9
|
+
IListFunctionTemplateResponse,
|
|
10
|
+
IUpdateFunctionTemplateBody,
|
|
11
|
+
IUpdateFunctionTemplateParams,
|
|
12
|
+
IUpdateFunctionTemplateResponse,
|
|
13
|
+
} from '../types';
|
|
14
|
+
|
|
15
|
+
const templateUrl = (params: { applicationId: string }): string =>
|
|
16
|
+
`api/function-template/${params.applicationId}`;
|
|
17
|
+
|
|
18
|
+
/** `GET /api/function-template/:applicationId`: the templates of the application, sorted by name. Needs REFLEX_READ. */
|
|
19
|
+
export const listFunctionTemplate = async (
|
|
20
|
+
params: IListFunctionTemplateParams,
|
|
21
|
+
): Promise<IListFunctionTemplateResponse> =>
|
|
22
|
+
(await AbyssReflexCore.axios.get<IListFunctionTemplateResponse>(templateUrl(params))).data;
|
|
23
|
+
|
|
24
|
+
/** `POST /api/function-template/:applicationId`: saves the saved draft of a function as a template (`409` when the name is taken). Needs REFLEX_FUNCTION_CREATE. */
|
|
25
|
+
export const createFunctionTemplate = async (
|
|
26
|
+
params: ICreateFunctionTemplateParams,
|
|
27
|
+
body: ICreateFunctionTemplateBody,
|
|
28
|
+
): Promise<ICreateFunctionTemplateResponse> =>
|
|
29
|
+
(await AbyssReflexCore.axios.post<ICreateFunctionTemplateResponse>(templateUrl(params), body))
|
|
30
|
+
.data;
|
|
31
|
+
|
|
32
|
+
/** `PATCH /api/function-template/:applicationId/:templateId`: renames or re-describes the template. Needs REFLEX_FUNCTION_UPDATE. */
|
|
33
|
+
export const updateFunctionTemplate = async (
|
|
34
|
+
params: IUpdateFunctionTemplateParams,
|
|
35
|
+
body: IUpdateFunctionTemplateBody,
|
|
36
|
+
): Promise<IUpdateFunctionTemplateResponse> =>
|
|
37
|
+
(
|
|
38
|
+
await AbyssReflexCore.axios.patch<IUpdateFunctionTemplateResponse>(
|
|
39
|
+
`${templateUrl(params)}/${params.templateId}`,
|
|
40
|
+
body,
|
|
41
|
+
)
|
|
42
|
+
).data;
|
|
43
|
+
|
|
44
|
+
/** `DELETE /api/function-template/:applicationId/:templateId`. Needs REFLEX_FUNCTION_UPDATE. */
|
|
45
|
+
export const deleteFunctionTemplate = async (
|
|
46
|
+
params: IDeleteFunctionTemplateParams,
|
|
47
|
+
): Promise<IDeleteFunctionTemplateResponse> =>
|
|
48
|
+
(
|
|
49
|
+
await AbyssReflexCore.axios.delete<IDeleteFunctionTemplateResponse>(
|
|
50
|
+
`${templateUrl(params)}/${params.templateId}`,
|
|
51
|
+
)
|
|
52
|
+
).data;
|
|
@@ -1,34 +1,34 @@
|
|
|
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, in the environment `body.environmentId`.
|
|
15
|
-
* Nothing is executed: HTTP steps get the stub they are given, the Store is a scratch copy thrown away.
|
|
16
|
-
* Needs REFLEX_TEST_RUN.
|
|
17
|
-
*/
|
|
18
|
-
export const simulateFunction = async (
|
|
19
|
-
params: IFunctionTestParams,
|
|
20
|
-
body: ISimulateFunctionBody,
|
|
21
|
-
): Promise<ISimulateFunctionResponse> =>
|
|
22
|
-
(await AbyssReflexCore.axios.post<ISimulateFunctionResponse>(`${testUrl(params)}/simulate`, body))
|
|
23
|
-
.data;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* `POST .../test/dry-run`: like a simulation, but the Store of the environment `body.environmentId` is
|
|
27
|
-
* read for real; writes are recorded and not done. Needs REFLEX_TEST_RUN.
|
|
28
|
-
*/
|
|
29
|
-
export const dryRunFunction = async (
|
|
30
|
-
params: IFunctionTestParams,
|
|
31
|
-
body: IDryRunFunctionBody,
|
|
32
|
-
): Promise<IDryRunFunctionResponse> =>
|
|
33
|
-
(await AbyssReflexCore.axios.post<IDryRunFunctionResponse>(`${testUrl(params)}/dry-run`, body))
|
|
34
|
-
.data;
|
|
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, in the environment `body.environmentId`.
|
|
15
|
+
* Nothing is executed: HTTP steps get the stub they are given, the Store is a scratch copy thrown away.
|
|
16
|
+
* Needs REFLEX_TEST_RUN.
|
|
17
|
+
*/
|
|
18
|
+
export const simulateFunction = async (
|
|
19
|
+
params: IFunctionTestParams,
|
|
20
|
+
body: ISimulateFunctionBody,
|
|
21
|
+
): Promise<ISimulateFunctionResponse> =>
|
|
22
|
+
(await AbyssReflexCore.axios.post<ISimulateFunctionResponse>(`${testUrl(params)}/simulate`, body))
|
|
23
|
+
.data;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* `POST .../test/dry-run`: like a simulation, but the Store of the environment `body.environmentId` is
|
|
27
|
+
* read for real; writes are recorded and not done. Needs REFLEX_TEST_RUN.
|
|
28
|
+
*/
|
|
29
|
+
export const dryRunFunction = async (
|
|
30
|
+
params: IFunctionTestParams,
|
|
31
|
+
body: IDryRunFunctionBody,
|
|
32
|
+
): Promise<IDryRunFunctionResponse> =>
|
|
33
|
+
(await AbyssReflexCore.axios.post<IDryRunFunctionResponse>(`${testUrl(params)}/dry-run`, body))
|
|
34
|
+
.data;
|