@abyss-project/reflex 5.8.1 → 5.9.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/alert-rule.api.d.ts +5 -0
- package/dist/api/alert-rule.api.js +16 -0
- package/dist/api/alert-rule.api.js.map +1 -0
- package/dist/api/application-insights.api.d.ts +3 -0
- package/dist/api/application-insights.api.js +12 -0
- package/dist/api/application-insights.api.js.map +1 -0
- package/dist/api/application-run-settings.api.d.ts +3 -0
- package/dist/api/application-run-settings.api.js +11 -0
- package/dist/api/application-run-settings.api.js.map +1 -0
- package/dist/api/function-settings.api.d.ts +2 -1
- package/dist/api/function-settings.api.js +3 -1
- package/dist/api/function-settings.api.js.map +1 -1
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.js +4 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/route-stats.api.d.ts +3 -0
- package/dist/api/route-stats.api.js +9 -0
- package/dist/api/route-stats.api.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/dist/insights/index.d.ts +1 -0
- package/dist/insights/index.js +18 -0
- package/dist/insights/index.js.map +1 -0
- package/dist/insights/percentiles.d.ts +2 -0
- package/dist/insights/percentiles.js +28 -0
- package/dist/insights/percentiles.js.map +1 -0
- package/dist/types/enum/index.d.ts +4 -0
- package/dist/types/enum/index.js +4 -0
- package/dist/types/enum/index.js.map +1 -1
- package/dist/types/enum/log-cap-mode.enum.d.ts +5 -0
- package/dist/types/enum/log-cap-mode.enum.js +10 -0
- package/dist/types/enum/log-cap-mode.enum.js.map +1 -0
- package/dist/types/enum/reflex-alert-metric.enum.d.ts +4 -0
- package/dist/types/enum/reflex-alert-metric.enum.js +9 -0
- package/dist/types/enum/reflex-alert-metric.enum.js.map +1 -0
- package/dist/types/enum/reflex-alert-notification-state.enum.d.ts +5 -0
- package/dist/types/enum/reflex-alert-notification-state.enum.js +10 -0
- package/dist/types/enum/reflex-alert-notification-state.enum.js.map +1 -0
- package/dist/types/enum/reflex-alert-scope.enum.d.ts +5 -0
- package/dist/types/enum/reflex-alert-scope.enum.js +10 -0
- package/dist/types/enum/reflex-alert-scope.enum.js.map +1 -0
- package/dist/types/interface/api/requests/alert-rule.request.d.ts +38 -0
- package/dist/types/interface/api/requests/alert-rule.request.js +3 -0
- package/dist/types/interface/api/requests/alert-rule.request.js.map +1 -0
- package/dist/types/interface/api/requests/application-insights.request.d.ts +14 -0
- package/dist/types/interface/api/requests/application-insights.request.js +3 -0
- package/dist/types/interface/api/requests/application-insights.request.js.map +1 -0
- package/dist/types/interface/api/requests/application-run-settings.request.d.ts +9 -0
- package/dist/types/interface/api/requests/application-run-settings.request.js +3 -0
- package/dist/types/interface/api/requests/application-run-settings.request.js.map +1 -0
- package/dist/types/interface/api/requests/function-settings.request.d.ts +6 -1
- package/dist/types/interface/api/requests/index.d.ts +4 -0
- package/dist/types/interface/api/requests/index.js +4 -0
- package/dist/types/interface/api/requests/index.js.map +1 -1
- package/dist/types/interface/api/requests/route-stats.request.d.ts +18 -0
- package/dist/types/interface/api/requests/route-stats.request.js +3 -0
- package/dist/types/interface/api/requests/route-stats.request.js.map +1 -0
- package/dist/types/interface/api/responses/alert-rule.response.d.ts +17 -0
- package/dist/types/interface/api/responses/alert-rule.response.js +3 -0
- package/dist/types/interface/api/responses/alert-rule.response.js.map +1 -0
- package/dist/types/interface/api/responses/application-insights.response.d.ts +8 -0
- package/dist/types/interface/api/responses/application-insights.response.js +3 -0
- package/dist/types/interface/api/responses/application-insights.response.js.map +1 -0
- package/dist/types/interface/api/responses/application-run-settings.response.d.ts +6 -0
- package/dist/types/interface/api/responses/application-run-settings.response.js +3 -0
- package/dist/types/interface/api/responses/application-run-settings.response.js.map +1 -0
- package/dist/types/interface/api/responses/function-settings.response.d.ts +3 -1
- package/dist/types/interface/api/responses/index.d.ts +4 -0
- package/dist/types/interface/api/responses/index.js +4 -0
- package/dist/types/interface/api/responses/index.js.map +1 -1
- package/dist/types/interface/api/responses/route-stats.response.d.ts +12 -0
- package/dist/types/interface/api/responses/route-stats.response.js +3 -0
- package/dist/types/interface/api/responses/route-stats.response.js.map +1 -0
- 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-alert-rule.model.d.ts +55 -0
- package/dist/types/interface/models/reflex-alert-rule.model.js +15 -0
- package/dist/types/interface/models/reflex-alert-rule.model.js.map +1 -0
- package/dist/types/interface/models/reflex-insights.model.d.ts +63 -0
- package/dist/types/interface/models/reflex-insights.model.js +4 -1
- package/dist/types/interface/models/reflex-insights.model.js.map +1 -1
- package/dist/types/interface/models/reflex-run-settings.model.d.ts +19 -0
- package/dist/types/interface/models/reflex-run-settings.model.js +9 -0
- package/dist/types/interface/models/reflex-run-settings.model.js.map +1 -0
- package/dist/types/interface/models/reflex-run.model.d.ts +40 -3
- package/dist/types/interface/models/reflex-run.model.js +9 -0
- package/dist/types/interface/models/reflex-run.model.js.map +1 -1
- package/jest.config.ts +11 -11
- package/package.json +15 -10
- package/src/api/alert-rule.api.test.ts +72 -0
- package/src/api/alert-rule.api.ts +57 -0
- package/src/api/application-insights.api.test.ts +42 -0
- package/src/api/application-insights.api.ts +38 -0
- package/src/api/application-run-settings.api.test.ts +51 -0
- package/src/api/application-run-settings.api.ts +30 -0
- package/src/api/function-access.api.ts +36 -36
- 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 -59
- package/src/api/function-test.api.ts +34 -34
- package/src/api/function-version.api.ts +48 -48
- package/src/api/function.api.test.ts +249 -249
- package/src/api/function.api.ts +62 -62
- package/src/api/health.api.ts +10 -10
- package/src/api/index.ts +21 -17
- package/src/api/route-stats.api.test.ts +45 -0
- package/src/api/route-stats.api.ts +36 -0
- 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 -75
- package/src/index.ts +371 -317
- package/src/insights/index.ts +1 -0
- package/src/insights/percentiles.test.ts +75 -0
- package/src/insights/percentiles.ts +37 -0
- 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/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-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-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 +44 -40
- package/src/types/enum/insights-period.enum.ts +8 -8
- package/src/types/enum/log-cap-mode.enum.ts +6 -0
- package/src/types/enum/reflex-alert-metric.enum.ts +5 -0
- package/src/types/enum/reflex-alert-notification-state.enum.ts +6 -0
- package/src/types/enum/reflex-alert-scope.enum.ts +6 -0
- 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/alert-rule.request.ts +53 -0
- package/src/types/interface/api/requests/application-insights.request.ts +18 -0
- package/src/types/interface/api/requests/application-run-settings.request.ts +11 -0
- package/src/types/interface/api/requests/function-access.request.ts +25 -25
- package/src/types/interface/api/requests/function-run.request.ts +30 -30
- package/src/types/interface/api/requests/function-settings.request.ts +34 -27
- package/src/types/interface/api/requests/function-test.request.ts +39 -39
- package/src/types/interface/api/requests/function-version.request.ts +20 -20
- package/src/types/interface/api/requests/function.request.ts +36 -36
- package/src/types/interface/api/requests/index.ts +19 -15
- package/src/types/interface/api/requests/route-stats.request.ts +22 -0
- package/src/types/interface/api/requests/service-configuration.request.ts +4 -4
- package/src/types/interface/api/requests/service-deployment.request.ts +49 -49
- package/src/types/interface/api/requests/service-discord-event.request.ts +68 -68
- package/src/types/interface/api/requests/service-discord.request.ts +173 -173
- package/src/types/interface/api/requests/service-insights.request.ts +31 -31
- package/src/types/interface/api/requests/service-route.request.ts +44 -44
- package/src/types/interface/api/requests/service-task.request.ts +80 -80
- package/src/types/interface/api/requests/service-version.request.ts +24 -24
- package/src/types/interface/api/requests/service.request.ts +46 -46
- package/src/types/interface/api/response.ts +4 -4
- package/src/types/interface/api/responses/alert-rule.response.ts +24 -0
- package/src/types/interface/api/responses/application-insights.response.ts +11 -0
- package/src/types/interface/api/responses/application-run-settings.response.ts +8 -0
- package/src/types/interface/api/responses/function-access.response.ts +17 -17
- package/src/types/interface/api/responses/function-run.response.ts +18 -18
- package/src/types/interface/api/responses/function-settings.response.ts +40 -36
- package/src/types/interface/api/responses/function-test.response.ts +12 -12
- package/src/types/interface/api/responses/function-version.response.ts +31 -31
- package/src/types/interface/api/responses/function.response.ts +25 -25
- package/src/types/interface/api/responses/index.ts +19 -15
- package/src/types/interface/api/responses/route-stats.response.ts +15 -0
- package/src/types/interface/api/responses/service-configuration.response.ts +8 -8
- package/src/types/interface/api/responses/service-deployment.response.ts +32 -32
- package/src/types/interface/api/responses/service-discord-event.response.ts +24 -24
- package/src/types/interface/api/responses/service-discord.response.ts +122 -122
- package/src/types/interface/api/responses/service-insights.response.ts +11 -11
- package/src/types/interface/api/responses/service-route.response.ts +31 -31
- package/src/types/interface/api/responses/service-task.response.ts +57 -57
- package/src/types/interface/api/responses/service-version.response.ts +106 -106
- package/src/types/interface/api/responses/service.response.ts +31 -31
- package/src/types/interface/health.response.ts +7 -7
- package/src/types/interface/index.ts +3 -3
- package/src/types/interface/models/index.ts +21 -19
- package/src/types/interface/models/reflex-access-grant.model.ts +14 -14
- package/src/types/interface/models/reflex-alert-rule.model.ts +56 -0
- package/src/types/interface/models/reflex-bot-limits.model.ts +92 -92
- package/src/types/interface/models/reflex-definition.model.ts +31 -31
- package/src/types/interface/models/reflex-discord-event-log.model.ts +58 -58
- package/src/types/interface/models/reflex-discord-event.model.ts +79 -79
- package/src/types/interface/models/reflex-execution-settings.model.ts +50 -50
- package/src/types/interface/models/reflex-function-version.model.ts +14 -14
- package/src/types/interface/models/reflex-function.model.ts +16 -16
- package/src/types/interface/models/reflex-insights.model.ts +215 -120
- package/src/types/interface/models/reflex-price-list.model.ts +20 -20
- package/src/types/interface/models/reflex-route.model.ts +19 -19
- package/src/types/interface/models/reflex-run-settings.model.ts +28 -0
- package/src/types/interface/models/reflex-run.model.ts +250 -186
- package/src/types/interface/models/reflex-service-configuration.model.ts +22 -22
- package/src/types/interface/models/reflex-service-deployment.model.ts +46 -46
- package/src/types/interface/models/reflex-service-version.model.ts +61 -61
- package/src/types/interface/models/reflex-service.model.ts +45 -45
- package/src/types/interface/models/reflex-step-stats.model.ts +35 -35
- package/src/types/interface/models/reflex-task.model.ts +97 -97
- package/tsconfig.check.json +15 -15
- package/tsconfig.json +35 -35
|
@@ -1,59 +1,74 @@
|
|
|
1
|
-
import { AbyssReflexCore } from '..';
|
|
2
|
-
import type {
|
|
3
|
-
IGetFunctionSettingsParams,
|
|
4
|
-
IGetFunctionSettingsResponse,
|
|
5
|
-
IRemoveFunctionEnvironmentSettingsParams,
|
|
6
|
-
IRemoveFunctionEnvironmentSettingsResponse,
|
|
7
|
-
ISetFunctionDefaultSettingsBody,
|
|
8
|
-
ISetFunctionDefaultSettingsParams,
|
|
9
|
-
ISetFunctionDefaultSettingsResponse,
|
|
10
|
-
ISetFunctionEnvironmentSettingsBody,
|
|
11
|
-
ISetFunctionEnvironmentSettingsParams,
|
|
12
|
-
ISetFunctionEnvironmentSettingsResponse,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type {
|
|
3
|
+
IGetFunctionSettingsParams,
|
|
4
|
+
IGetFunctionSettingsResponse,
|
|
5
|
+
IRemoveFunctionEnvironmentSettingsParams,
|
|
6
|
+
IRemoveFunctionEnvironmentSettingsResponse,
|
|
7
|
+
ISetFunctionDefaultSettingsBody,
|
|
8
|
+
ISetFunctionDefaultSettingsParams,
|
|
9
|
+
ISetFunctionDefaultSettingsResponse,
|
|
10
|
+
ISetFunctionEnvironmentSettingsBody,
|
|
11
|
+
ISetFunctionEnvironmentSettingsParams,
|
|
12
|
+
ISetFunctionEnvironmentSettingsResponse,
|
|
13
|
+
ISetFunctionLogCapBody,
|
|
14
|
+
ISetFunctionLogCapParams,
|
|
15
|
+
ISetFunctionLogCapResponse,
|
|
16
|
+
} from '../types';
|
|
17
|
+
|
|
18
|
+
const settingsUrl = (params: { applicationId: string; functionId: string }): string =>
|
|
19
|
+
`api/function/${params.applicationId}/${params.functionId}/settings`;
|
|
20
|
+
|
|
21
|
+
/** `GET .../settings`: the default, the overrides, and what each environment runs with. Needs REFLEX_READ. */
|
|
22
|
+
export const getFunctionSettings = async (
|
|
23
|
+
params: IGetFunctionSettingsParams,
|
|
24
|
+
): Promise<IGetFunctionSettingsResponse> =>
|
|
25
|
+
(await AbyssReflexCore.axios.get<IGetFunctionSettingsResponse>(settingsUrl(params))).data;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* `PUT .../settings`: sets the default of every environment without an override, applied at once where the
|
|
29
|
+
* function runs. Needs REFLEX_FUNCTION_UPDATE, and REFLEX_PUBLISH_PRODUCTION when the default applies to a
|
|
30
|
+
* production environment where the function runs.
|
|
31
|
+
*/
|
|
32
|
+
export const setFunctionDefaultSettings = async (
|
|
33
|
+
params: ISetFunctionDefaultSettingsParams,
|
|
34
|
+
body: ISetFunctionDefaultSettingsBody,
|
|
35
|
+
): Promise<ISetFunctionDefaultSettingsResponse> =>
|
|
36
|
+
(await AbyssReflexCore.axios.put<ISetFunctionDefaultSettingsResponse>(settingsUrl(params), body))
|
|
37
|
+
.data;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* `PUT .../settings/:environmentId`: sets the override of one environment. Needs REFLEX_FUNCTION_UPDATE, and
|
|
41
|
+
* REFLEX_PUBLISH_PRODUCTION for a production environment.
|
|
42
|
+
*/
|
|
43
|
+
export const setFunctionEnvironmentSettings = async (
|
|
44
|
+
params: ISetFunctionEnvironmentSettingsParams,
|
|
45
|
+
body: ISetFunctionEnvironmentSettingsBody,
|
|
46
|
+
): Promise<ISetFunctionEnvironmentSettingsResponse> =>
|
|
47
|
+
(
|
|
48
|
+
await AbyssReflexCore.axios.put<ISetFunctionEnvironmentSettingsResponse>(
|
|
49
|
+
`${settingsUrl(params)}/${params.environmentId}`,
|
|
50
|
+
body,
|
|
51
|
+
)
|
|
52
|
+
).data;
|
|
53
|
+
|
|
54
|
+
/** `DELETE .../settings/:environmentId`: the environment falls back on the default. Same rights as setting it. */
|
|
55
|
+
export const removeFunctionEnvironmentSettings = async (
|
|
56
|
+
params: IRemoveFunctionEnvironmentSettingsParams,
|
|
57
|
+
): Promise<IRemoveFunctionEnvironmentSettingsResponse> =>
|
|
58
|
+
(
|
|
59
|
+
await AbyssReflexCore.axios.delete<IRemoveFunctionEnvironmentSettingsResponse>(
|
|
60
|
+
`${settingsUrl(params)}/${params.environmentId}`,
|
|
61
|
+
)
|
|
62
|
+
).data;
|
|
63
|
+
|
|
64
|
+
/** `PUT .../log-cap`: sets the log cap of the function (inherit, none, or a number of lines). Needs REFLEX_FUNCTION_UPDATE. */
|
|
65
|
+
export const setFunctionLogCap = async (
|
|
66
|
+
params: ISetFunctionLogCapParams,
|
|
67
|
+
body: ISetFunctionLogCapBody,
|
|
68
|
+
): Promise<ISetFunctionLogCapResponse> =>
|
|
69
|
+
(
|
|
70
|
+
await AbyssReflexCore.axios.put<ISetFunctionLogCapResponse>(
|
|
71
|
+
`api/function/${params.applicationId}/${params.functionId}/log-cap`,
|
|
72
|
+
body,
|
|
73
|
+
)
|
|
74
|
+
).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;
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { AbyssReflexCore } from '..';
|
|
2
|
-
import type {
|
|
3
|
-
IGetFunctionVersionParams,
|
|
4
|
-
IGetFunctionVersionResponse,
|
|
5
|
-
IGetFunctionVersionStepStatsParams,
|
|
6
|
-
IGetFunctionVersionStepStatsQuery,
|
|
7
|
-
IGetFunctionVersionStepStatsResponse,
|
|
8
|
-
IListFunctionVersionParams,
|
|
9
|
-
IListFunctionVersionResponse,
|
|
10
|
-
} from '../types';
|
|
11
|
-
|
|
12
|
-
const versionUrl = (params: { applicationId: string; functionId: string }): string =>
|
|
13
|
-
`api/function/${params.applicationId}/${params.functionId}/version`;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* `GET .../version`: the frozen versions, newest first. Needs REFLEX_READ. A version of the function's
|
|
17
|
-
* Service publishes its draft when it changed (`service.version.create`).
|
|
18
|
-
*/
|
|
19
|
-
export const listFunctionVersion = async (
|
|
20
|
-
params: IListFunctionVersionParams,
|
|
21
|
-
): Promise<IListFunctionVersionResponse> =>
|
|
22
|
-
(await AbyssReflexCore.axios.get<IListFunctionVersionResponse>(versionUrl(params))).data;
|
|
23
|
-
|
|
24
|
-
/** `GET .../version/:versionId`. Needs REFLEX_READ. */
|
|
25
|
-
export const getFunctionVersion = async (
|
|
26
|
-
params: IGetFunctionVersionParams,
|
|
27
|
-
): Promise<IGetFunctionVersionResponse> =>
|
|
28
|
-
(
|
|
29
|
-
await AbyssReflexCore.axios.get<IGetFunctionVersionResponse>(
|
|
30
|
-
`${versionUrl(params)}/${params.versionId}`,
|
|
31
|
-
)
|
|
32
|
-
).data;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* `GET .../version/:versionId/step-stats`: per step, over the retention window, the executions, the median
|
|
36
|
-
* and p95 of duration, CPU, heap peak and cost, and the share of the cost; interrupted executions left
|
|
37
|
-
* out. With `environmentId`, also the p99 heap peak per step of the version running there. Needs REFLEX_LOG_READ.
|
|
38
|
-
*/
|
|
39
|
-
export const getFunctionVersionStepStats = async (
|
|
40
|
-
params: IGetFunctionVersionStepStatsParams,
|
|
41
|
-
query: IGetFunctionVersionStepStatsQuery = {},
|
|
42
|
-
): Promise<IGetFunctionVersionStepStatsResponse> =>
|
|
43
|
-
(
|
|
44
|
-
await AbyssReflexCore.axios.get<IGetFunctionVersionStepStatsResponse>(
|
|
45
|
-
`${versionUrl(params)}/${params.versionId}/step-stats`,
|
|
46
|
-
{ params: query },
|
|
47
|
-
)
|
|
48
|
-
).data;
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type {
|
|
3
|
+
IGetFunctionVersionParams,
|
|
4
|
+
IGetFunctionVersionResponse,
|
|
5
|
+
IGetFunctionVersionStepStatsParams,
|
|
6
|
+
IGetFunctionVersionStepStatsQuery,
|
|
7
|
+
IGetFunctionVersionStepStatsResponse,
|
|
8
|
+
IListFunctionVersionParams,
|
|
9
|
+
IListFunctionVersionResponse,
|
|
10
|
+
} from '../types';
|
|
11
|
+
|
|
12
|
+
const versionUrl = (params: { applicationId: string; functionId: string }): string =>
|
|
13
|
+
`api/function/${params.applicationId}/${params.functionId}/version`;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* `GET .../version`: the frozen versions, newest first. Needs REFLEX_READ. A version of the function's
|
|
17
|
+
* Service publishes its draft when it changed (`service.version.create`).
|
|
18
|
+
*/
|
|
19
|
+
export const listFunctionVersion = async (
|
|
20
|
+
params: IListFunctionVersionParams,
|
|
21
|
+
): Promise<IListFunctionVersionResponse> =>
|
|
22
|
+
(await AbyssReflexCore.axios.get<IListFunctionVersionResponse>(versionUrl(params))).data;
|
|
23
|
+
|
|
24
|
+
/** `GET .../version/:versionId`. Needs REFLEX_READ. */
|
|
25
|
+
export const getFunctionVersion = async (
|
|
26
|
+
params: IGetFunctionVersionParams,
|
|
27
|
+
): Promise<IGetFunctionVersionResponse> =>
|
|
28
|
+
(
|
|
29
|
+
await AbyssReflexCore.axios.get<IGetFunctionVersionResponse>(
|
|
30
|
+
`${versionUrl(params)}/${params.versionId}`,
|
|
31
|
+
)
|
|
32
|
+
).data;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* `GET .../version/:versionId/step-stats`: per step, over the retention window, the executions, the median
|
|
36
|
+
* and p95 of duration, CPU, heap peak and cost, and the share of the cost; interrupted executions left
|
|
37
|
+
* out. With `environmentId`, also the p99 heap peak per step of the version running there. Needs REFLEX_LOG_READ.
|
|
38
|
+
*/
|
|
39
|
+
export const getFunctionVersionStepStats = async (
|
|
40
|
+
params: IGetFunctionVersionStepStatsParams,
|
|
41
|
+
query: IGetFunctionVersionStepStatsQuery = {},
|
|
42
|
+
): Promise<IGetFunctionVersionStepStatsResponse> =>
|
|
43
|
+
(
|
|
44
|
+
await AbyssReflexCore.axios.get<IGetFunctionVersionStepStatsResponse>(
|
|
45
|
+
`${versionUrl(params)}/${params.versionId}/step-stats`,
|
|
46
|
+
{ params: query },
|
|
47
|
+
)
|
|
48
|
+
).data;
|