@abyss-project/reflex 5.9.0 → 5.11.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/.prettierrc +5 -5
- package/README.md +15 -15
- package/dist/api/function-access.api.d.ts +5 -1
- package/dist/api/function-access.api.js +9 -1
- package/dist/api/function-access.api.js.map +1 -1
- package/dist/api/function-template.api.d.ts +5 -0
- package/dist/api/function-template.api.js +15 -0
- package/dist/api/function-template.api.js.map +1 -0
- package/dist/api/function-version.api.d.ts +3 -2
- package/dist/api/function-version.api.js +6 -2
- package/dist/api/function-version.api.js.map +1 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/types/enum/access-request-status.enum.d.ts +5 -0
- package/dist/types/enum/access-request-status.enum.js +10 -0
- package/dist/types/enum/access-request-status.enum.js.map +1 -0
- package/dist/types/enum/index.d.ts +2 -0
- package/dist/types/enum/index.js +2 -0
- package/dist/types/enum/index.js.map +1 -1
- package/dist/types/enum/log-drop-cause.enum.d.ts +4 -0
- package/dist/types/enum/log-drop-cause.enum.js +9 -0
- package/dist/types/enum/log-drop-cause.enum.js.map +1 -0
- package/dist/types/interface/api/requests/function-access.request.d.ts +21 -0
- package/dist/types/interface/api/requests/function-template.request.d.ts +23 -0
- package/dist/types/interface/api/requests/function-template.request.js +3 -0
- package/dist/types/interface/api/requests/function-template.request.js.map +1 -0
- package/dist/types/interface/api/requests/function-version.request.d.ts +12 -0
- package/dist/types/interface/api/requests/index.d.ts +1 -0
- package/dist/types/interface/api/requests/index.js +1 -0
- package/dist/types/interface/api/requests/index.js.map +1 -1
- package/dist/types/interface/api/responses/function-access.response.d.ts +21 -1
- package/dist/types/interface/api/responses/function-settings.response.d.ts +1 -0
- package/dist/types/interface/api/responses/function-template.response.d.ts +16 -0
- package/dist/types/interface/api/responses/function-template.response.js +3 -0
- package/dist/types/interface/api/responses/function-template.response.js.map +1 -0
- package/dist/types/interface/api/responses/function-version.response.d.ts +7 -2
- package/dist/types/interface/api/responses/index.d.ts +1 -0
- package/dist/types/interface/api/responses/index.js +1 -0
- package/dist/types/interface/api/responses/index.js.map +1 -1
- package/dist/types/interface/models/index.d.ts +2 -0
- package/dist/types/interface/models/index.js +2 -0
- package/dist/types/interface/models/index.js.map +1 -1
- package/dist/types/interface/models/reflex-access-request.model.d.ts +13 -0
- package/dist/types/interface/models/reflex-access-request.model.js +3 -0
- package/dist/types/interface/models/reflex-access-request.model.js.map +1 -0
- package/dist/types/interface/models/reflex-function-template.model.d.ts +13 -0
- package/dist/types/interface/models/reflex-function-template.model.js +3 -0
- package/dist/types/interface/models/reflex-function-template.model.js.map +1 -0
- package/dist/types/interface/models/reflex-function-version.model.d.ts +3 -0
- package/dist/types/interface/models/reflex-function.model.d.ts +9 -0
- package/dist/types/interface/models/reflex-run.model.d.ts +2 -1
- package/dist/types/interface/models/reflex-run.model.js.map +1 -1
- package/jest.config.ts +11 -11
- package/package.json +10 -15
- 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 +51 -51
- package/src/api/application-run-settings.api.ts +30 -30
- package/src/api/function-access.api.ts +52 -1
- 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 +38 -38
- package/src/api/function-settings.api.ts +74 -74
- package/src/api/function-template.api.test.ts +72 -0
- package/src/api/function-template.api.ts +52 -0
- package/src/api/function-test.api.ts +34 -34
- package/src/api/function-version.api.ts +20 -2
- package/src/api/function.api.test.ts +47 -6
- package/src/api/function.api.ts +62 -62
- package/src/api/health.api.ts +10 -10
- package/src/api/index.ts +1 -0
- package/src/api/route-stats.api.test.ts +45 -45
- package/src/api/route-stats.api.ts +36 -36
- package/src/api/service-configuration.api.ts +16 -16
- 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 +197 -197
- package/src/api/service-discord.api.ts +241 -241
- package/src/api/service-insights.api.test.ts +36 -36
- package/src/api/service-insights.api.ts +42 -42
- package/src/api/service-route.api.ts +72 -72
- 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 +215 -215
- 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 +87 -87
- package/src/index.ts +24 -0
- 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/access-grant-status.enum.ts +12 -12
- package/src/types/enum/access-kind.enum.ts +7 -7
- package/src/types/enum/access-request-status.enum.ts +11 -0
- package/src/types/enum/bot-event-block-reason.enum.ts +7 -7
- package/src/types/enum/configuration-read-as.enum.ts +5 -5
- package/src/types/enum/discord-activity-type.enum.ts +9 -9
- package/src/types/enum/discord-channel-type.enum.ts +11 -11
- package/src/types/enum/discord-component-kind.enum.ts +7 -7
- package/src/types/enum/discord-event-drop-reason.enum.ts +13 -13
- package/src/types/enum/discord-event-filter-name.enum.ts +11 -11
- package/src/types/enum/discord-event-status.enum.ts +13 -13
- package/src/types/enum/discord-event-type.enum.ts +7 -7
- package/src/types/enum/discord-gateway-failure-code.enum.ts +11 -11
- package/src/types/enum/discord-gateway-state.enum.ts +11 -11
- package/src/types/enum/discord-host-action.enum.ts +35 -35
- package/src/types/enum/discord-locale.enum.ts +35 -35
- package/src/types/enum/discord-option-type.enum.ts +12 -12
- package/src/types/enum/discord-presence-status.enum.ts +8 -8
- package/src/types/enum/discord-sync-status.enum.ts +6 -6
- package/src/types/enum/discord-token-state.enum.ts +11 -11
- package/src/types/enum/execution-mode.enum.ts +9 -9
- package/src/types/enum/execution-profile.enum.ts +20 -20
- package/src/types/enum/execution-settings-source.enum.ts +9 -9
- package/src/types/enum/health-status.enum.ts +4 -4
- package/src/types/enum/index.ts +2 -0
- package/src/types/enum/insights-period.enum.ts +8 -8
- package/src/types/enum/log-cap-mode.enum.ts +6 -6
- package/src/types/enum/log-drop-cause.enum.ts +8 -0
- package/src/types/enum/reflex-alert-metric.enum.ts +5 -5
- package/src/types/enum/reflex-alert-notification-state.enum.ts +6 -6
- package/src/types/enum/reflex-alert-scope.enum.ts +6 -6
- package/src/types/enum/reflex-error-code.enum.ts +43 -43
- package/src/types/enum/route-method.enum.ts +9 -9
- package/src/types/enum/run-log-level.enum.ts +6 -6
- package/src/types/enum/run-mode.enum.ts +11 -11
- package/src/types/enum/run-status.enum.ts +11 -11
- package/src/types/enum/run-step-status.enum.ts +7 -7
- package/src/types/enum/schedule-sync-status.enum.ts +6 -6
- package/src/types/enum/scheduled-run-failure-code.enum.ts +12 -12
- package/src/types/enum/scheduled-run-origin.enum.ts +5 -5
- package/src/types/enum/scheduled-run-status.enum.ts +17 -17
- package/src/types/enum/service-deployment-action.enum.ts +11 -11
- package/src/types/enum/service-deployment-status.enum.ts +5 -5
- package/src/types/enum/service-type.enum.ts +9 -9
- package/src/types/enum/service-version-change-kind.enum.ts +6 -6
- package/src/types/enum/trace-effect-type.enum.ts +12 -12
- package/src/types/enum/trigger-access-mode.enum.ts +12 -12
- package/src/types/enum/trigger-kind.enum.ts +8 -8
- package/src/types/enum/vault-value-source.enum.ts +12 -12
- package/src/types/enum/vault-visibility.enum.ts +5 -5
- package/src/types/index.ts +2 -2
- package/src/types/interface/api/index.ts +3 -3
- package/src/types/interface/api/requests/function-access.request.ts +26 -0
- package/src/types/interface/api/requests/function-template.request.ts +29 -0
- package/src/types/interface/api/requests/function-version.request.ts +18 -0
- package/src/types/interface/api/requests/index.ts +1 -0
- package/src/types/interface/api/response.ts +4 -4
- package/src/types/interface/api/responses/function-access.response.ts +29 -1
- package/src/types/interface/api/responses/function-settings.response.ts +2 -0
- package/src/types/interface/api/responses/function-template.response.ts +21 -0
- package/src/types/interface/api/responses/function-version.response.ts +12 -1
- package/src/types/interface/api/responses/index.ts +1 -0
- package/src/types/interface/health.response.ts +7 -7
- package/src/types/interface/index.ts +3 -3
- package/src/types/interface/models/index.ts +2 -0
- package/src/types/interface/models/reflex-access-request.model.ts +15 -0
- package/src/types/interface/models/reflex-function-template.model.ts +18 -0
- package/src/types/interface/models/reflex-function-version.model.ts +5 -0
- package/src/types/interface/models/reflex-function.model.ts +14 -0
- package/src/types/interface/models/reflex-run.model.ts +6 -3
- package/tsconfig.check.json +15 -15
- package/tsconfig.json +35 -35
|
@@ -0,0 +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,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;
|
|
@@ -6,6 +6,9 @@ import type {
|
|
|
6
6
|
IGetFunctionVersionStepStatsQuery,
|
|
7
7
|
IGetFunctionVersionStepStatsResponse,
|
|
8
8
|
IListFunctionVersionParams,
|
|
9
|
+
IListFunctionVersionQuery,
|
|
10
|
+
IOpenFunctionVersionParams,
|
|
11
|
+
IOpenFunctionVersionResponse,
|
|
9
12
|
IListFunctionVersionResponse,
|
|
10
13
|
} from '../types';
|
|
11
14
|
|
|
@@ -13,13 +16,18 @@ const versionUrl = (params: { applicationId: string; functionId: string }): stri
|
|
|
13
16
|
`api/function/${params.applicationId}/${params.functionId}/version`;
|
|
14
17
|
|
|
15
18
|
/**
|
|
16
|
-
* `GET .../version`: the frozen versions, newest first. Needs REFLEX_READ. A version of the function's
|
|
19
|
+
* `GET .../version`: the frozen versions, newest first, one page of those matching the filters. Needs REFLEX_READ. A version of the function's
|
|
17
20
|
* Service publishes its draft when it changed (`service.version.create`).
|
|
18
21
|
*/
|
|
19
22
|
export const listFunctionVersion = async (
|
|
20
23
|
params: IListFunctionVersionParams,
|
|
24
|
+
query: IListFunctionVersionQuery = {},
|
|
21
25
|
): Promise<IListFunctionVersionResponse> =>
|
|
22
|
-
(
|
|
26
|
+
(
|
|
27
|
+
await AbyssReflexCore.axios.get<IListFunctionVersionResponse>(versionUrl(params), {
|
|
28
|
+
params: query,
|
|
29
|
+
})
|
|
30
|
+
).data;
|
|
23
31
|
|
|
24
32
|
/** `GET .../version/:versionId`. Needs REFLEX_READ. */
|
|
25
33
|
export const getFunctionVersion = async (
|
|
@@ -46,3 +54,13 @@ export const getFunctionVersionStepStats = async (
|
|
|
46
54
|
{ params: query },
|
|
47
55
|
)
|
|
48
56
|
).data;
|
|
57
|
+
|
|
58
|
+
/** `POST .../version/:versionId/open`: replaces the draft with the definition of the version and records it as the base of the draft. Needs REFLEX_FUNCTION_UPDATE. */
|
|
59
|
+
export const openFunctionVersion = async (
|
|
60
|
+
params: IOpenFunctionVersionParams,
|
|
61
|
+
): Promise<IOpenFunctionVersionResponse> =>
|
|
62
|
+
(
|
|
63
|
+
await AbyssReflexCore.axios.post<IOpenFunctionVersionResponse>(
|
|
64
|
+
`${versionUrl(params)}/${params.versionId}/open`,
|
|
65
|
+
)
|
|
66
|
+
).data;
|
|
@@ -87,6 +87,53 @@ const calls: Call[] = [
|
|
|
87
87
|
url: `${BASE}/access/g-1`,
|
|
88
88
|
run: () => sdk().access.revoke({ applicationId: APP, functionId: FN, grantId: 'g-1' }),
|
|
89
89
|
},
|
|
90
|
+
{
|
|
91
|
+
label: 'access.grantAll',
|
|
92
|
+
method: 'post',
|
|
93
|
+
url: `${BASE}/access/grant-all`,
|
|
94
|
+
run: () => sdk().access.grantAll({ applicationId: APP, functionId: FN }),
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
label: 'access.request',
|
|
98
|
+
method: 'post',
|
|
99
|
+
url: `${BASE}/access/request`,
|
|
100
|
+
body: { declaration: { kind: 'HOST_ACTION', action: 'store.get' } },
|
|
101
|
+
run: () =>
|
|
102
|
+
sdk().access.request(
|
|
103
|
+
{ applicationId: APP, functionId: FN },
|
|
104
|
+
{ declaration: { kind: 'HOST_ACTION', action: 'store.get' } as never },
|
|
105
|
+
),
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
label: 'access.grantRequest',
|
|
109
|
+
method: 'post',
|
|
110
|
+
url: `${BASE}/access/request/q-1/grant`,
|
|
111
|
+
run: () => sdk().access.grantRequest({ applicationId: APP, functionId: FN, requestId: 'q-1' }),
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
label: 'access.dismissRequest',
|
|
115
|
+
method: 'post',
|
|
116
|
+
url: `${BASE}/access/request/q-1/dismiss`,
|
|
117
|
+
run: () =>
|
|
118
|
+
sdk().access.dismissRequest({ applicationId: APP, functionId: FN, requestId: 'q-1' }),
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
label: 'version.list',
|
|
122
|
+
method: 'get',
|
|
123
|
+
url: `${BASE}/version`,
|
|
124
|
+
params: { page: 2, limit: 20, number: 3, publishedByUserId: 'u-1', deployed: true },
|
|
125
|
+
run: () =>
|
|
126
|
+
sdk().version.list(
|
|
127
|
+
{ applicationId: APP, functionId: FN },
|
|
128
|
+
{ page: 2, limit: 20, number: 3, publishedByUserId: 'u-1', deployed: true },
|
|
129
|
+
),
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
label: 'version.open',
|
|
133
|
+
method: 'post',
|
|
134
|
+
url: `${BASE}/version/v-1/open`,
|
|
135
|
+
run: () => sdk().version.open({ applicationId: APP, functionId: FN, versionId: 'v-1' }),
|
|
136
|
+
},
|
|
90
137
|
{
|
|
91
138
|
label: 'test.simulate',
|
|
92
139
|
method: 'post',
|
|
@@ -105,12 +152,6 @@ const calls: Call[] = [
|
|
|
105
152
|
body: { environmentId: 'e-1' },
|
|
106
153
|
run: () => sdk().test.dryRun({ applicationId: APP, functionId: FN }, { environmentId: 'e-1' }),
|
|
107
154
|
},
|
|
108
|
-
{
|
|
109
|
-
label: 'version.list',
|
|
110
|
-
method: 'get',
|
|
111
|
-
url: `${BASE}/version`,
|
|
112
|
-
run: () => sdk().version.list({ applicationId: APP, functionId: FN }),
|
|
113
|
-
},
|
|
114
155
|
{
|
|
115
156
|
label: 'version.get',
|
|
116
157
|
method: 'get',
|
package/src/api/function.api.ts
CHANGED
|
@@ -1,62 +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;
|
|
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;
|
package/src/api/health.api.ts
CHANGED
|
@@ -1,10 +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;
|
|
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
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { AxiosAdapter, InternalAxiosRequestConfig } from 'axios';
|
|
2
|
-
import { AbyssReflexCore, InsightsPeriod } from '..';
|
|
3
|
-
|
|
4
|
-
const adapter = jest.fn<ReturnType<AxiosAdapter>, [InternalAxiosRequestConfig]>(async (config) => ({
|
|
5
|
-
data: { data: {} },
|
|
6
|
-
status: 200,
|
|
7
|
-
statusText: '',
|
|
8
|
-
headers: {},
|
|
9
|
-
config,
|
|
10
|
-
}));
|
|
11
|
-
|
|
12
|
-
beforeAll(() => {
|
|
13
|
-
AbyssReflexCore.setConfig({ baseURL: 'http://reflex.test/', token: 'session-token' });
|
|
14
|
-
AbyssReflexCore.axios.defaults.adapter = adapter;
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
beforeEach(() => adapter.mockClear());
|
|
18
|
-
|
|
19
|
-
const QUERY = { environmentId: 'e-1', period: InsightsPeriod.HOURS_24 };
|
|
20
|
-
|
|
21
|
-
describe('AbyssReflexCore route statistics routes', () => {
|
|
22
|
-
it('routeStats.list calls GET .../route-stats with the environment and the period', async () => {
|
|
23
|
-
await AbyssReflexCore.sdk.service.routeStats.list(
|
|
24
|
-
{ applicationId: 'app-1', serviceId: 'svc-1' },
|
|
25
|
-
QUERY,
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
const config = adapter.mock.calls[0][0];
|
|
29
|
-
expect(config.method).toBe('get');
|
|
30
|
-
expect(config.url).toBe('api/service/app-1/svc-1/route-stats');
|
|
31
|
-
expect(config.params).toEqual({ environmentId: 'e-1', period: '24h' });
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('routeStats.insights calls GET .../route/:routeId/insights', async () => {
|
|
35
|
-
await AbyssReflexCore.sdk.service.routeStats.insights(
|
|
36
|
-
{ applicationId: 'app-1', serviceId: 'svc-1', routeId: 'r-1' },
|
|
37
|
-
QUERY,
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
const config = adapter.mock.calls[0][0];
|
|
41
|
-
expect(config.method).toBe('get');
|
|
42
|
-
expect(config.url).toBe('api/service/app-1/svc-1/route/r-1/insights');
|
|
43
|
-
expect(config.params).toEqual({ environmentId: 'e-1', period: '24h' });
|
|
44
|
-
});
|
|
45
|
-
});
|
|
1
|
+
import { AxiosAdapter, InternalAxiosRequestConfig } from 'axios';
|
|
2
|
+
import { AbyssReflexCore, InsightsPeriod } from '..';
|
|
3
|
+
|
|
4
|
+
const adapter = jest.fn<ReturnType<AxiosAdapter>, [InternalAxiosRequestConfig]>(async (config) => ({
|
|
5
|
+
data: { data: {} },
|
|
6
|
+
status: 200,
|
|
7
|
+
statusText: '',
|
|
8
|
+
headers: {},
|
|
9
|
+
config,
|
|
10
|
+
}));
|
|
11
|
+
|
|
12
|
+
beforeAll(() => {
|
|
13
|
+
AbyssReflexCore.setConfig({ baseURL: 'http://reflex.test/', token: 'session-token' });
|
|
14
|
+
AbyssReflexCore.axios.defaults.adapter = adapter;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
beforeEach(() => adapter.mockClear());
|
|
18
|
+
|
|
19
|
+
const QUERY = { environmentId: 'e-1', period: InsightsPeriod.HOURS_24 };
|
|
20
|
+
|
|
21
|
+
describe('AbyssReflexCore route statistics routes', () => {
|
|
22
|
+
it('routeStats.list calls GET .../route-stats with the environment and the period', async () => {
|
|
23
|
+
await AbyssReflexCore.sdk.service.routeStats.list(
|
|
24
|
+
{ applicationId: 'app-1', serviceId: 'svc-1' },
|
|
25
|
+
QUERY,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const config = adapter.mock.calls[0][0];
|
|
29
|
+
expect(config.method).toBe('get');
|
|
30
|
+
expect(config.url).toBe('api/service/app-1/svc-1/route-stats');
|
|
31
|
+
expect(config.params).toEqual({ environmentId: 'e-1', period: '24h' });
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('routeStats.insights calls GET .../route/:routeId/insights', async () => {
|
|
35
|
+
await AbyssReflexCore.sdk.service.routeStats.insights(
|
|
36
|
+
{ applicationId: 'app-1', serviceId: 'svc-1', routeId: 'r-1' },
|
|
37
|
+
QUERY,
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const config = adapter.mock.calls[0][0];
|
|
41
|
+
expect(config.method).toBe('get');
|
|
42
|
+
expect(config.url).toBe('api/service/app-1/svc-1/route/r-1/insights');
|
|
43
|
+
expect(config.params).toEqual({ environmentId: 'e-1', period: '24h' });
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { AbyssReflexCore } from '..';
|
|
2
|
-
import type {
|
|
3
|
-
IGetRouteInsightsParams,
|
|
4
|
-
IGetRouteInsightsQuery,
|
|
5
|
-
IGetRouteInsightsResponse,
|
|
6
|
-
IGetServiceRouteStatsParams,
|
|
7
|
-
IGetServiceRouteStatsQuery,
|
|
8
|
-
IGetServiceRouteStatsResponse,
|
|
9
|
-
} from '../types';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* `GET .../route-stats`: every route of a Service over a period: runs, failures, p50, p95, p99, HTTP classes and
|
|
13
|
-
* a short series. Needs REFLEX_READ.
|
|
14
|
-
*/
|
|
15
|
-
export const getServiceRouteStats = async (
|
|
16
|
-
params: IGetServiceRouteStatsParams,
|
|
17
|
-
query: IGetServiceRouteStatsQuery,
|
|
18
|
-
): Promise<IGetServiceRouteStatsResponse> =>
|
|
19
|
-
(
|
|
20
|
-
await AbyssReflexCore.axios.get<IGetServiceRouteStatsResponse>(
|
|
21
|
-
`api/service/${params.applicationId}/${params.serviceId}/route-stats`,
|
|
22
|
-
{ params: query },
|
|
23
|
-
)
|
|
24
|
-
).data;
|
|
25
|
-
|
|
26
|
-
/** `GET .../route/:routeId/insights`: runs, HTTP classes and percentiles of one route, step by step. Needs REFLEX_READ. */
|
|
27
|
-
export const getRouteInsights = async (
|
|
28
|
-
params: IGetRouteInsightsParams,
|
|
29
|
-
query: IGetRouteInsightsQuery,
|
|
30
|
-
): Promise<IGetRouteInsightsResponse> =>
|
|
31
|
-
(
|
|
32
|
-
await AbyssReflexCore.axios.get<IGetRouteInsightsResponse>(
|
|
33
|
-
`api/service/${params.applicationId}/${params.serviceId}/route/${params.routeId}/insights`,
|
|
34
|
-
{ params: query },
|
|
35
|
-
)
|
|
36
|
-
).data;
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type {
|
|
3
|
+
IGetRouteInsightsParams,
|
|
4
|
+
IGetRouteInsightsQuery,
|
|
5
|
+
IGetRouteInsightsResponse,
|
|
6
|
+
IGetServiceRouteStatsParams,
|
|
7
|
+
IGetServiceRouteStatsQuery,
|
|
8
|
+
IGetServiceRouteStatsResponse,
|
|
9
|
+
} from '../types';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* `GET .../route-stats`: every route of a Service over a period: runs, failures, p50, p95, p99, HTTP classes and
|
|
13
|
+
* a short series. Needs REFLEX_READ.
|
|
14
|
+
*/
|
|
15
|
+
export const getServiceRouteStats = async (
|
|
16
|
+
params: IGetServiceRouteStatsParams,
|
|
17
|
+
query: IGetServiceRouteStatsQuery,
|
|
18
|
+
): Promise<IGetServiceRouteStatsResponse> =>
|
|
19
|
+
(
|
|
20
|
+
await AbyssReflexCore.axios.get<IGetServiceRouteStatsResponse>(
|
|
21
|
+
`api/service/${params.applicationId}/${params.serviceId}/route-stats`,
|
|
22
|
+
{ params: query },
|
|
23
|
+
)
|
|
24
|
+
).data;
|
|
25
|
+
|
|
26
|
+
/** `GET .../route/:routeId/insights`: runs, HTTP classes and percentiles of one route, step by step. Needs REFLEX_READ. */
|
|
27
|
+
export const getRouteInsights = async (
|
|
28
|
+
params: IGetRouteInsightsParams,
|
|
29
|
+
query: IGetRouteInsightsQuery,
|
|
30
|
+
): Promise<IGetRouteInsightsResponse> =>
|
|
31
|
+
(
|
|
32
|
+
await AbyssReflexCore.axios.get<IGetRouteInsightsResponse>(
|
|
33
|
+
`api/service/${params.applicationId}/${params.serviceId}/route/${params.routeId}/insights`,
|
|
34
|
+
{ params: query },
|
|
35
|
+
)
|
|
36
|
+
).data;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { AbyssReflexCore } from '..';
|
|
2
|
-
import type { IListServiceConfigurationParams, IListServiceConfigurationResponse } from '../types';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* `GET .../configuration`: per key the functions of the Service read (draft and versions in service),
|
|
6
|
-
* and per environment of the application, where the Console vault gets its value from; never a value.
|
|
7
|
-
* Needs REFLEX_READ, and SECRET_READ on the project (Console re-checks it).
|
|
8
|
-
*/
|
|
9
|
-
export const listServiceConfiguration = async (
|
|
10
|
-
params: IListServiceConfigurationParams,
|
|
11
|
-
): Promise<IListServiceConfigurationResponse> =>
|
|
12
|
-
(
|
|
13
|
-
await AbyssReflexCore.axios.get<IListServiceConfigurationResponse>(
|
|
14
|
-
`api/service/${params.applicationId}/${params.serviceId}/configuration`,
|
|
15
|
-
)
|
|
16
|
-
).data;
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type { IListServiceConfigurationParams, IListServiceConfigurationResponse } from '../types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `GET .../configuration`: per key the functions of the Service read (draft and versions in service),
|
|
6
|
+
* and per environment of the application, where the Console vault gets its value from; never a value.
|
|
7
|
+
* Needs REFLEX_READ, and SECRET_READ on the project (Console re-checks it).
|
|
8
|
+
*/
|
|
9
|
+
export const listServiceConfiguration = async (
|
|
10
|
+
params: IListServiceConfigurationParams,
|
|
11
|
+
): Promise<IListServiceConfigurationResponse> =>
|
|
12
|
+
(
|
|
13
|
+
await AbyssReflexCore.axios.get<IListServiceConfigurationResponse>(
|
|
14
|
+
`api/service/${params.applicationId}/${params.serviceId}/configuration`,
|
|
15
|
+
)
|
|
16
|
+
).data;
|