@abyss-project/reflex 6.0.3 → 6.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/.eslintrc.js +32 -32
  2. package/.prettierrc +5 -5
  3. package/README.md +15 -15
  4. package/dist/types/interface/models/reflex-completion-webhook.model.d.ts +9 -0
  5. package/dist/types/interface/models/reflex-completion-webhook.model.js +10 -1
  6. package/dist/types/interface/models/reflex-completion-webhook.model.js.map +1 -1
  7. package/dist/types/interface/models/reflex-service-limits.model.d.ts +5 -2
  8. package/jest.config.ts +11 -11
  9. package/package.json +1 -1
  10. package/src/api/alert-rule.api.test.ts +72 -72
  11. package/src/api/alert-rule.api.ts +57 -57
  12. package/src/api/application-insights.api.test.ts +42 -42
  13. package/src/api/application-insights.api.ts +38 -38
  14. package/src/api/application-run-settings.api.test.ts +51 -51
  15. package/src/api/application-run-settings.api.ts +30 -30
  16. package/src/api/function-access.api.ts +87 -87
  17. package/src/api/function-insights.api.test.ts +27 -27
  18. package/src/api/function-insights.api.ts +18 -18
  19. package/src/api/function-run.api.ts +38 -38
  20. package/src/api/function-settings.api.ts +74 -74
  21. package/src/api/function-template.api.test.ts +72 -72
  22. package/src/api/function-template.api.ts +52 -52
  23. package/src/api/function-test.api.ts +34 -34
  24. package/src/api/function-version.api.ts +66 -66
  25. package/src/api/function.api.ts +62 -62
  26. package/src/api/health.api.ts +10 -10
  27. package/src/api/route-stats.api.test.ts +45 -45
  28. package/src/api/route-stats.api.ts +36 -36
  29. package/src/api/service-completion-webhook.api.test.ts +10 -0
  30. package/src/api/service-configuration.api.ts +16 -16
  31. package/src/api/service-deployment.api.ts +79 -79
  32. package/src/api/service-discord-event.api.test.ts +106 -106
  33. package/src/api/service-discord-event.api.ts +78 -78
  34. package/src/api/service-insights.api.test.ts +36 -36
  35. package/src/api/service-insights.api.ts +42 -42
  36. package/src/api/service-task.api.test.ts +140 -140
  37. package/src/api/service-task.api.ts +141 -141
  38. package/src/api/service-version.api.ts +54 -54
  39. package/src/api/service.api.test.ts +215 -215
  40. package/src/api/service.api.ts +55 -55
  41. package/src/discord/discord-event-filter-cases.ts +261 -261
  42. package/src/discord/discord-event-filters.test.ts +91 -91
  43. package/src/discord/discord-event-filters.ts +95 -95
  44. package/src/discord/discord-event-intents.test.ts +112 -112
  45. package/src/discord/discord-event-intents.ts +55 -55
  46. package/src/discord/index.ts +3 -3
  47. package/src/insights/index.ts +1 -1
  48. package/src/insights/percentiles.test.ts +75 -75
  49. package/src/insights/percentiles.ts +37 -37
  50. package/src/types/enum/access-grant-status.enum.ts +12 -12
  51. package/src/types/enum/access-kind.enum.ts +7 -7
  52. package/src/types/enum/access-request-status.enum.ts +11 -11
  53. package/src/types/enum/bot-event-block-reason.enum.ts +7 -7
  54. package/src/types/enum/configuration-read-as.enum.ts +5 -5
  55. package/src/types/enum/discord-activity-type.enum.ts +9 -9
  56. package/src/types/enum/discord-channel-type.enum.ts +11 -11
  57. package/src/types/enum/discord-component-kind.enum.ts +7 -7
  58. package/src/types/enum/discord-event-drop-reason.enum.ts +13 -13
  59. package/src/types/enum/discord-event-filter-name.enum.ts +11 -11
  60. package/src/types/enum/discord-event-status.enum.ts +13 -13
  61. package/src/types/enum/discord-event-type.enum.ts +7 -7
  62. package/src/types/enum/discord-gateway-failure-code.enum.ts +11 -11
  63. package/src/types/enum/discord-gateway-state.enum.ts +11 -11
  64. package/src/types/enum/discord-host-action.enum.ts +35 -35
  65. package/src/types/enum/discord-locale.enum.ts +35 -35
  66. package/src/types/enum/discord-option-type.enum.ts +12 -12
  67. package/src/types/enum/discord-presence-status.enum.ts +8 -8
  68. package/src/types/enum/discord-sync-status.enum.ts +6 -6
  69. package/src/types/enum/discord-token-state.enum.ts +11 -11
  70. package/src/types/enum/execution-mode.enum.ts +9 -9
  71. package/src/types/enum/execution-profile.enum.ts +20 -20
  72. package/src/types/enum/execution-settings-source.enum.ts +9 -9
  73. package/src/types/enum/health-status.enum.ts +4 -4
  74. package/src/types/enum/insights-period.enum.ts +8 -8
  75. package/src/types/enum/log-cap-mode.enum.ts +6 -6
  76. package/src/types/enum/log-drop-cause.enum.ts +8 -8
  77. package/src/types/enum/reflex-alert-metric.enum.ts +5 -5
  78. package/src/types/enum/reflex-alert-notification-state.enum.ts +6 -6
  79. package/src/types/enum/reflex-alert-scope.enum.ts +6 -6
  80. package/src/types/enum/route-method.enum.ts +9 -9
  81. package/src/types/enum/run-log-level.enum.ts +6 -6
  82. package/src/types/enum/run-mode.enum.ts +11 -11
  83. package/src/types/enum/run-step-status.enum.ts +7 -7
  84. package/src/types/enum/schedule-sync-status.enum.ts +6 -6
  85. package/src/types/enum/scheduled-run-origin.enum.ts +5 -5
  86. package/src/types/enum/scheduled-run-status.enum.ts +17 -17
  87. package/src/types/enum/service-deployment-action.enum.ts +11 -11
  88. package/src/types/enum/service-deployment-status.enum.ts +5 -5
  89. package/src/types/enum/service-type.enum.ts +9 -9
  90. package/src/types/enum/service-version-change-kind.enum.ts +6 -6
  91. package/src/types/enum/trace-effect-type.enum.ts +12 -12
  92. package/src/types/enum/trigger-access-mode.enum.ts +12 -12
  93. package/src/types/enum/trigger-kind.enum.ts +8 -8
  94. package/src/types/enum/vault-value-source.enum.ts +12 -12
  95. package/src/types/enum/vault-visibility.enum.ts +5 -5
  96. package/src/types/index.ts +2 -2
  97. package/src/types/interface/api/index.ts +3 -3
  98. package/src/types/interface/api/requests/alert-rule.request.ts +53 -53
  99. package/src/types/interface/api/requests/application-insights.request.ts +18 -18
  100. package/src/types/interface/api/requests/application-run-settings.request.ts +11 -11
  101. package/src/types/interface/api/requests/function-access.request.ts +51 -51
  102. package/src/types/interface/api/requests/function-settings.request.ts +34 -34
  103. package/src/types/interface/api/requests/function-template.request.ts +29 -29
  104. package/src/types/interface/api/requests/function-version.request.ts +38 -38
  105. package/src/types/interface/api/requests/function.request.ts +36 -36
  106. package/src/types/interface/api/requests/route-stats.request.ts +22 -22
  107. package/src/types/interface/api/requests/service-configuration.request.ts +4 -4
  108. package/src/types/interface/api/requests/service-deployment.request.ts +49 -49
  109. package/src/types/interface/api/requests/service-discord-event.request.ts +68 -68
  110. package/src/types/interface/api/requests/service-insights.request.ts +31 -31
  111. package/src/types/interface/api/requests/service-task.request.ts +80 -80
  112. package/src/types/interface/api/requests/service-version.request.ts +24 -24
  113. package/src/types/interface/api/requests/service.request.ts +46 -46
  114. package/src/types/interface/api/response.ts +4 -4
  115. package/src/types/interface/api/responses/alert-rule.response.ts +24 -24
  116. package/src/types/interface/api/responses/application-insights.response.ts +11 -11
  117. package/src/types/interface/api/responses/application-run-settings.response.ts +8 -8
  118. package/src/types/interface/api/responses/function-access.response.ts +45 -45
  119. package/src/types/interface/api/responses/function-run.response.ts +18 -18
  120. package/src/types/interface/api/responses/function-template.response.ts +21 -21
  121. package/src/types/interface/api/responses/function-version.response.ts +42 -42
  122. package/src/types/interface/api/responses/function.response.ts +25 -25
  123. package/src/types/interface/api/responses/route-stats.response.ts +15 -15
  124. package/src/types/interface/api/responses/service-configuration.response.ts +8 -8
  125. package/src/types/interface/api/responses/service-deployment.response.ts +32 -32
  126. package/src/types/interface/api/responses/service-discord-event.response.ts +24 -24
  127. package/src/types/interface/api/responses/service-insights.response.ts +11 -11
  128. package/src/types/interface/api/responses/service-task.response.ts +57 -57
  129. package/src/types/interface/api/responses/service-version.response.ts +112 -112
  130. package/src/types/interface/api/responses/service.response.ts +31 -31
  131. package/src/types/interface/health.response.ts +7 -7
  132. package/src/types/interface/index.ts +3 -3
  133. package/src/types/interface/models/reflex-access-grant.model.ts +14 -14
  134. package/src/types/interface/models/reflex-access-request.model.ts +15 -15
  135. package/src/types/interface/models/reflex-alert-rule.model.ts +56 -56
  136. package/src/types/interface/models/reflex-completion-webhook.model.ts +26 -0
  137. package/src/types/interface/models/reflex-definition.model.ts +31 -31
  138. package/src/types/interface/models/reflex-discord-event-log.model.ts +58 -58
  139. package/src/types/interface/models/reflex-discord-event.model.ts +79 -79
  140. package/src/types/interface/models/reflex-discord.model.ts +196 -196
  141. package/src/types/interface/models/reflex-function-template.model.ts +18 -18
  142. package/src/types/interface/models/reflex-function-version.model.ts +19 -19
  143. package/src/types/interface/models/reflex-function.model.ts +30 -30
  144. package/src/types/interface/models/reflex-insights.model.ts +215 -215
  145. package/src/types/interface/models/reflex-price-list.model.ts +20 -20
  146. package/src/types/interface/models/reflex-run-settings.model.ts +28 -28
  147. package/src/types/interface/models/reflex-service-configuration.model.ts +22 -22
  148. package/src/types/interface/models/reflex-service-deployment.model.ts +46 -46
  149. package/src/types/interface/models/reflex-service-limits.model.ts +17 -8
  150. package/src/types/interface/models/reflex-service.model.ts +45 -45
  151. package/src/types/interface/models/reflex-step-stats.model.ts +35 -35
  152. package/src/types/interface/models/reflex-task.model.ts +97 -97
  153. package/tsconfig.check.json +15 -15
  154. package/tsconfig.json +35 -35
@@ -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;
@@ -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;
@@ -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;
@@ -4,6 +4,7 @@ import {
4
4
  COMPLETION_DELIVERY_ID_HEADER,
5
5
  CompletionDeliveryStatus,
6
6
  DEFAULT_REFLEX_EXECUTION_SETTINGS,
7
+ REFLEX_COMPLETION_DELIVERY_ERRORS,
7
8
  REFLEX_COMPLETION_WEBHOOK_LIMITS,
8
9
  RESERVED_EXECUTIONS_SEGMENT,
9
10
  RunStatus,
@@ -76,6 +77,15 @@ describe('AbyssReflexCore completion webhook routes', () => {
76
77
  outputMaxBytes: 65_536,
77
78
  });
78
79
  expect(COMPLETION_DELIVERY_ID_HEADER).toBe('x-abyss-delivery-id');
80
+ expect(REFLEX_COMPLETION_DELIVERY_ERRORS).toEqual({
81
+ refusedAddress: 'The URL is not https, or reaches an address the edge may not reach',
82
+ noSigningSecret: 'No signing secret for the Service in the environment',
83
+ invalidUrl: 'The URL is not valid',
84
+ receiverTimeoutPrefix: 'The receiver did not answer within',
85
+ requestFailedPrefix: 'The request failed',
86
+ httpPrefix: 'HTTP',
87
+ redirectsNotFollowed: 'redirects are not followed',
88
+ });
79
89
  expect(RESERVED_EXECUTIONS_SEGMENT).toBe('_executions');
80
90
  expect(Object.values(CompletionDeliveryStatus)).toEqual(['PENDING', 'DELIVERED', 'FAILED']);
81
91
  expect(RunStatus.REFUSED).toBe('REFUSED');
@@ -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;
@@ -1,79 +1,79 @@
1
- import { AbyssReflexCore } from '..';
2
- import type {
3
- IGoLiveServiceBody,
4
- IGoLiveServiceParams,
5
- IGoLiveServiceResponse,
6
- IListServiceDeploymentParams,
7
- IListServiceDeploymentQuery,
8
- IListServiceDeploymentResponse,
9
- IPauseServiceBody,
10
- IPauseServiceParams,
11
- IPauseServiceResponse,
12
- IResumeServiceBody,
13
- IResumeServiceParams,
14
- IResumeServiceResponse,
15
- IRollbackServiceBody,
16
- IRollbackServiceParams,
17
- IRollbackServiceResponse,
18
- } from '../types';
19
-
20
- const deploymentUrl = (params: { applicationId: string; serviceId: string }): string =>
21
- `api/service/${params.applicationId}/${params.serviceId}/deployment`;
22
-
23
- /** `GET .../deployment`: the current deployment per environment and a page of the history. Needs REFLEX_READ. */
24
- export const listServiceDeployment = async (
25
- params: IListServiceDeploymentParams,
26
- query: IListServiceDeploymentQuery = {},
27
- ): Promise<IListServiceDeploymentResponse> =>
28
- (
29
- await AbyssReflexCore.axios.get<IListServiceDeploymentResponse>(deploymentUrl(params), {
30
- params: query,
31
- })
32
- ).data;
33
-
34
- /**
35
- * `POST .../deployment/go-live`: puts a version in service in an environment, in one transaction. Needs
36
- * REFLEX_PUBLISH, and REFLEX_PUBLISH_PRODUCTION in a production environment.
37
- */
38
- export const goLiveService = async (
39
- params: IGoLiveServiceParams,
40
- body: IGoLiveServiceBody,
41
- ): Promise<IGoLiveServiceResponse> =>
42
- (
43
- await AbyssReflexCore.axios.post<IGoLiveServiceResponse>(
44
- `${deploymentUrl(params)}/go-live`,
45
- body,
46
- )
47
- ).data;
48
-
49
- /** `POST .../deployment/rollback`: puts back the version of a deployment of the history. Rights as go-live. */
50
- export const rollbackService = async (
51
- params: IRollbackServiceParams,
52
- body: IRollbackServiceBody,
53
- ): Promise<IRollbackServiceResponse> =>
54
- (
55
- await AbyssReflexCore.axios.post<IRollbackServiceResponse>(
56
- `${deploymentUrl(params)}/rollback`,
57
- body,
58
- )
59
- ).data;
60
-
61
- /** `POST .../deployment/pause`: every call answers `503 SERVICE_PAUSED`. Rights as go-live. */
62
- export const pauseService = async (
63
- params: IPauseServiceParams,
64
- body: IPauseServiceBody,
65
- ): Promise<IPauseServiceResponse> =>
66
- (await AbyssReflexCore.axios.post<IPauseServiceResponse>(`${deploymentUrl(params)}/pause`, body))
67
- .data;
68
-
69
- /** `POST .../deployment/resume`: the paused version answers again. Rights as go-live. */
70
- export const resumeService = async (
71
- params: IResumeServiceParams,
72
- body: IResumeServiceBody,
73
- ): Promise<IResumeServiceResponse> =>
74
- (
75
- await AbyssReflexCore.axios.post<IResumeServiceResponse>(
76
- `${deploymentUrl(params)}/resume`,
77
- body,
78
- )
79
- ).data;
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ IGoLiveServiceBody,
4
+ IGoLiveServiceParams,
5
+ IGoLiveServiceResponse,
6
+ IListServiceDeploymentParams,
7
+ IListServiceDeploymentQuery,
8
+ IListServiceDeploymentResponse,
9
+ IPauseServiceBody,
10
+ IPauseServiceParams,
11
+ IPauseServiceResponse,
12
+ IResumeServiceBody,
13
+ IResumeServiceParams,
14
+ IResumeServiceResponse,
15
+ IRollbackServiceBody,
16
+ IRollbackServiceParams,
17
+ IRollbackServiceResponse,
18
+ } from '../types';
19
+
20
+ const deploymentUrl = (params: { applicationId: string; serviceId: string }): string =>
21
+ `api/service/${params.applicationId}/${params.serviceId}/deployment`;
22
+
23
+ /** `GET .../deployment`: the current deployment per environment and a page of the history. Needs REFLEX_READ. */
24
+ export const listServiceDeployment = async (
25
+ params: IListServiceDeploymentParams,
26
+ query: IListServiceDeploymentQuery = {},
27
+ ): Promise<IListServiceDeploymentResponse> =>
28
+ (
29
+ await AbyssReflexCore.axios.get<IListServiceDeploymentResponse>(deploymentUrl(params), {
30
+ params: query,
31
+ })
32
+ ).data;
33
+
34
+ /**
35
+ * `POST .../deployment/go-live`: puts a version in service in an environment, in one transaction. Needs
36
+ * REFLEX_PUBLISH, and REFLEX_PUBLISH_PRODUCTION in a production environment.
37
+ */
38
+ export const goLiveService = async (
39
+ params: IGoLiveServiceParams,
40
+ body: IGoLiveServiceBody,
41
+ ): Promise<IGoLiveServiceResponse> =>
42
+ (
43
+ await AbyssReflexCore.axios.post<IGoLiveServiceResponse>(
44
+ `${deploymentUrl(params)}/go-live`,
45
+ body,
46
+ )
47
+ ).data;
48
+
49
+ /** `POST .../deployment/rollback`: puts back the version of a deployment of the history. Rights as go-live. */
50
+ export const rollbackService = async (
51
+ params: IRollbackServiceParams,
52
+ body: IRollbackServiceBody,
53
+ ): Promise<IRollbackServiceResponse> =>
54
+ (
55
+ await AbyssReflexCore.axios.post<IRollbackServiceResponse>(
56
+ `${deploymentUrl(params)}/rollback`,
57
+ body,
58
+ )
59
+ ).data;
60
+
61
+ /** `POST .../deployment/pause`: every call answers `503 SERVICE_PAUSED`. Rights as go-live. */
62
+ export const pauseService = async (
63
+ params: IPauseServiceParams,
64
+ body: IPauseServiceBody,
65
+ ): Promise<IPauseServiceResponse> =>
66
+ (await AbyssReflexCore.axios.post<IPauseServiceResponse>(`${deploymentUrl(params)}/pause`, body))
67
+ .data;
68
+
69
+ /** `POST .../deployment/resume`: the paused version answers again. Rights as go-live. */
70
+ export const resumeService = async (
71
+ params: IResumeServiceParams,
72
+ body: IResumeServiceBody,
73
+ ): Promise<IResumeServiceResponse> =>
74
+ (
75
+ await AbyssReflexCore.axios.post<IResumeServiceResponse>(
76
+ `${deploymentUrl(params)}/resume`,
77
+ body,
78
+ )
79
+ ).data;