@abyss-project/reflex 6.3.0 → 6.4.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.
Files changed (133) hide show
  1. package/.eslintrc.js +32 -32
  2. package/README.md +15 -15
  3. package/dist/api/function-run.api.d.ts +2 -1
  4. package/dist/api/function-run.api.js +3 -1
  5. package/dist/api/function-run.api.js.map +1 -1
  6. package/dist/api/function-settings.api.d.ts +3 -1
  7. package/dist/api/function-settings.api.js +7 -1
  8. package/dist/api/function-settings.api.js.map +1 -1
  9. package/dist/api/index.d.ts +1 -0
  10. package/dist/api/index.js +1 -0
  11. package/dist/api/index.js.map +1 -1
  12. package/dist/api/storage-surplus.admin.api.d.ts +5 -0
  13. package/dist/api/storage-surplus.admin.api.js +17 -0
  14. package/dist/api/storage-surplus.admin.api.js.map +1 -0
  15. package/dist/index.d.ts +16 -0
  16. package/dist/index.js +19 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/types/enum/reflex-error-code.enum.d.ts +4 -1
  19. package/dist/types/enum/reflex-error-code.enum.js +3 -0
  20. package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
  21. package/dist/types/interface/api/requests/application-run-settings.request.d.ts +1 -0
  22. package/dist/types/interface/api/requests/function-run.request.d.ts +8 -0
  23. package/dist/types/interface/api/requests/function-settings.request.d.ts +12 -0
  24. package/dist/types/interface/api/requests/index.d.ts +1 -0
  25. package/dist/types/interface/api/requests/index.js +1 -0
  26. package/dist/types/interface/api/requests/index.js.map +1 -1
  27. package/dist/types/interface/api/requests/service.request.d.ts +1 -0
  28. package/dist/types/interface/api/requests/storage-surplus.admin.request.d.ts +8 -0
  29. package/dist/types/interface/api/requests/storage-surplus.admin.request.js +3 -0
  30. package/dist/types/interface/api/requests/storage-surplus.admin.request.js.map +1 -0
  31. package/dist/types/interface/api/responses/function-run.response.d.ts +4 -0
  32. package/dist/types/interface/api/responses/function-settings.response.d.ts +5 -1
  33. package/dist/types/interface/api/responses/index.d.ts +1 -0
  34. package/dist/types/interface/api/responses/index.js +1 -0
  35. package/dist/types/interface/api/responses/index.js.map +1 -1
  36. package/dist/types/interface/api/responses/storage-surplus.admin.response.d.ts +8 -0
  37. package/dist/types/interface/api/responses/storage-surplus.admin.response.js +3 -0
  38. package/dist/types/interface/api/responses/storage-surplus.admin.response.js.map +1 -0
  39. package/dist/types/interface/models/index.d.ts +2 -0
  40. package/dist/types/interface/models/index.js +2 -0
  41. package/dist/types/interface/models/index.js.map +1 -1
  42. package/dist/types/interface/models/reflex-run-retention.model.d.ts +13 -0
  43. package/dist/types/interface/models/reflex-run-retention.model.js +8 -0
  44. package/dist/types/interface/models/reflex-run-retention.model.js.map +1 -0
  45. package/dist/types/interface/models/reflex-run-settings.model.d.ts +4 -0
  46. package/dist/types/interface/models/reflex-run.model.d.ts +5 -0
  47. package/dist/types/interface/models/reflex-service-deployment.model.d.ts +2 -2
  48. package/dist/types/interface/models/reflex-service.model.d.ts +1 -0
  49. package/dist/types/interface/models/reflex-storage-surplus.model.d.ts +11 -0
  50. package/dist/types/interface/models/reflex-storage-surplus.model.js +3 -0
  51. package/dist/types/interface/models/reflex-storage-surplus.model.js.map +1 -0
  52. package/jest.config.ts +11 -11
  53. package/package.json +1 -1
  54. package/src/api/alert-rule.api.test.ts +72 -72
  55. package/src/api/alert-rule.api.ts +57 -57
  56. package/src/api/application-insights.api.test.ts +42 -42
  57. package/src/api/application-insights.api.ts +38 -38
  58. package/src/api/application-run-settings.api.test.ts +11 -0
  59. package/src/api/application-run-settings.api.ts +30 -30
  60. package/src/api/function-access.api.ts +87 -87
  61. package/src/api/function-insights.api.test.ts +27 -27
  62. package/src/api/function-insights.api.ts +18 -18
  63. package/src/api/function-run.api.ts +15 -0
  64. package/src/api/function-settings.api.ts +22 -0
  65. package/src/api/function-template.api.test.ts +72 -72
  66. package/src/api/function-template.api.ts +52 -52
  67. package/src/api/function-test.api.ts +34 -34
  68. package/src/api/function-version.api.ts +66 -66
  69. package/src/api/function.api.test.ts +55 -0
  70. package/src/api/function.api.ts +62 -62
  71. package/src/api/health.api.ts +10 -10
  72. package/src/api/index.ts +27 -26
  73. package/src/api/route-stats.api.test.ts +45 -45
  74. package/src/api/route-stats.api.ts +36 -36
  75. package/src/api/service-completion-webhook.api.test.ts +97 -97
  76. package/src/api/service-completion-webhook.api.ts +39 -39
  77. package/src/api/service-configuration.api.ts +16 -16
  78. package/src/api/service-consumer.api.test.ts +104 -104
  79. package/src/api/service-consumer.api.ts +90 -90
  80. package/src/api/service-deployment.api.ts +79 -79
  81. package/src/api/service-discord-event.api.test.ts +106 -106
  82. package/src/api/service-discord-event.api.ts +78 -78
  83. package/src/api/service-discord.api.test.ts +178 -178
  84. package/src/api/service-discord.api.ts +222 -222
  85. package/src/api/service-insights.api.test.ts +36 -36
  86. package/src/api/service-insights.api.ts +42 -42
  87. package/src/api/service-limits.api.test.ts +100 -100
  88. package/src/api/service-limits.api.ts +37 -37
  89. package/src/api/service-openapi.api.test.ts +52 -52
  90. package/src/api/service-openapi.api.ts +21 -21
  91. package/src/api/service-route.api.ts +74 -74
  92. package/src/api/service-task.api.test.ts +140 -140
  93. package/src/api/service-task.api.ts +141 -141
  94. package/src/api/service-version.api.ts +54 -54
  95. package/src/api/service.api.test.ts +6 -1
  96. package/src/api/service.api.ts +55 -55
  97. package/src/api/storage-surplus.admin.api.test.ts +66 -0
  98. package/src/api/storage-surplus.admin.api.ts +45 -0
  99. package/src/discord/discord-event-filter-cases.ts +261 -261
  100. package/src/discord/discord-event-filters.test.ts +91 -91
  101. package/src/discord/discord-event-filters.ts +95 -95
  102. package/src/discord/discord-event-intents.test.ts +112 -112
  103. package/src/discord/discord-event-intents.ts +55 -55
  104. package/src/discord/index.ts +3 -3
  105. package/src/index.test.ts +104 -104
  106. package/src/index.ts +42 -0
  107. package/src/insights/index.ts +1 -1
  108. package/src/insights/percentiles.test.ts +75 -75
  109. package/src/insights/percentiles.ts +37 -37
  110. package/src/types/enum/discord-host-action.enum.ts +37 -37
  111. package/src/types/enum/reflex-error-code.enum.ts +16 -0
  112. package/src/types/interface/api/requests/application-run-settings.request.ts +2 -0
  113. package/src/types/interface/api/requests/function-run.request.ts +10 -0
  114. package/src/types/interface/api/requests/function-settings.request.ts +16 -0
  115. package/src/types/interface/api/requests/index.ts +1 -0
  116. package/src/types/interface/api/requests/service-discord.request.ts +155 -155
  117. package/src/types/interface/api/requests/service.request.ts +2 -0
  118. package/src/types/interface/api/requests/storage-surplus.admin.request.ts +12 -0
  119. package/src/types/interface/api/responses/function-run.response.ts +5 -0
  120. package/src/types/interface/api/responses/function-settings.response.ts +7 -0
  121. package/src/types/interface/api/responses/index.ts +1 -0
  122. package/src/types/interface/api/responses/storage-surplus.admin.response.ts +10 -0
  123. package/src/types/interface/models/index.ts +2 -0
  124. package/src/types/interface/models/reflex-discord.model.ts +208 -208
  125. package/src/types/interface/models/reflex-price-list.model.ts +22 -22
  126. package/src/types/interface/models/reflex-run-retention.model.ts +24 -0
  127. package/src/types/interface/models/reflex-run-settings.model.ts +11 -0
  128. package/src/types/interface/models/reflex-run.model.ts +10 -0
  129. package/src/types/interface/models/reflex-service-deployment.model.ts +4 -2
  130. package/src/types/interface/models/reflex-service.model.ts +2 -0
  131. package/src/types/interface/models/reflex-storage-surplus.model.ts +23 -0
  132. package/tsconfig.check.json +15 -15
  133. package/tsconfig.json +35 -35
@@ -1,54 +1,54 @@
1
- import { AbyssReflexCore } from '..';
2
- import type {
3
- ICreateServiceVersionBody,
4
- ICreateServiceVersionParams,
5
- ICreateServiceVersionResponse,
6
- IGetServiceVersionDraftStatusParams,
7
- IGetServiceVersionDraftStatusResponse,
8
- IGetServiceVersionParams,
9
- IGetServiceVersionResponse,
10
- IListServiceVersionParams,
11
- IListServiceVersionResponse,
12
- } from '../types';
13
-
14
- const versionUrl = (params: { applicationId: string; serviceId: string }): string =>
15
- `api/service/${params.applicationId}/${params.serviceId}/version`;
16
-
17
- /** `GET .../version`: the versions of the Service, newest first. Needs REFLEX_READ. */
18
- export const listServiceVersion = async (
19
- params: IListServiceVersionParams,
20
- ): Promise<IListServiceVersionResponse> =>
21
- (await AbyssReflexCore.axios.get<IListServiceVersionResponse>(versionUrl(params))).data;
22
-
23
- /**
24
- * `POST .../version`: publishes the drafts that changed and freezes the routes, the function versions,
25
- * the CORS and the rate limit. `409 VERSION_UNCHANGED` when nothing changed. Needs REFLEX_PUBLISH.
26
- */
27
- export const createServiceVersion = async (
28
- params: ICreateServiceVersionParams,
29
- body: ICreateServiceVersionBody = {},
30
- ): Promise<ICreateServiceVersionResponse> =>
31
- (await AbyssReflexCore.axios.post<ICreateServiceVersionResponse>(versionUrl(params), body)).data;
32
-
33
- /**
34
- * `GET .../version/draft-status`: how many functions of the Service a version created now would freeze
35
- * differently from the last Service version (`changedFunctions`). Needs REFLEX_READ.
36
- */
37
- export const getServiceVersionDraftStatus = async (
38
- params: IGetServiceVersionDraftStatusParams,
39
- ): Promise<IGetServiceVersionDraftStatusResponse> =>
40
- (
41
- await AbyssReflexCore.axios.get<IGetServiceVersionDraftStatusResponse>(
42
- `${versionUrl(params)}/draft-status`,
43
- )
44
- ).data;
45
-
46
- /** `GET .../version/:versionId`: the snapshot and the route changes since the version before. Needs REFLEX_READ. */
47
- export const getServiceVersion = async (
48
- params: IGetServiceVersionParams,
49
- ): Promise<IGetServiceVersionResponse> =>
50
- (
51
- await AbyssReflexCore.axios.get<IGetServiceVersionResponse>(
52
- `${versionUrl(params)}/${params.versionId}`,
53
- )
54
- ).data;
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ ICreateServiceVersionBody,
4
+ ICreateServiceVersionParams,
5
+ ICreateServiceVersionResponse,
6
+ IGetServiceVersionDraftStatusParams,
7
+ IGetServiceVersionDraftStatusResponse,
8
+ IGetServiceVersionParams,
9
+ IGetServiceVersionResponse,
10
+ IListServiceVersionParams,
11
+ IListServiceVersionResponse,
12
+ } from '../types';
13
+
14
+ const versionUrl = (params: { applicationId: string; serviceId: string }): string =>
15
+ `api/service/${params.applicationId}/${params.serviceId}/version`;
16
+
17
+ /** `GET .../version`: the versions of the Service, newest first. Needs REFLEX_READ. */
18
+ export const listServiceVersion = async (
19
+ params: IListServiceVersionParams,
20
+ ): Promise<IListServiceVersionResponse> =>
21
+ (await AbyssReflexCore.axios.get<IListServiceVersionResponse>(versionUrl(params))).data;
22
+
23
+ /**
24
+ * `POST .../version`: publishes the drafts that changed and freezes the routes, the function versions,
25
+ * the CORS and the rate limit. `409 VERSION_UNCHANGED` when nothing changed. Needs REFLEX_PUBLISH.
26
+ */
27
+ export const createServiceVersion = async (
28
+ params: ICreateServiceVersionParams,
29
+ body: ICreateServiceVersionBody = {},
30
+ ): Promise<ICreateServiceVersionResponse> =>
31
+ (await AbyssReflexCore.axios.post<ICreateServiceVersionResponse>(versionUrl(params), body)).data;
32
+
33
+ /**
34
+ * `GET .../version/draft-status`: how many functions of the Service a version created now would freeze
35
+ * differently from the last Service version (`changedFunctions`). Needs REFLEX_READ.
36
+ */
37
+ export const getServiceVersionDraftStatus = async (
38
+ params: IGetServiceVersionDraftStatusParams,
39
+ ): Promise<IGetServiceVersionDraftStatusResponse> =>
40
+ (
41
+ await AbyssReflexCore.axios.get<IGetServiceVersionDraftStatusResponse>(
42
+ `${versionUrl(params)}/draft-status`,
43
+ )
44
+ ).data;
45
+
46
+ /** `GET .../version/:versionId`: the snapshot and the route changes since the version before. Needs REFLEX_READ. */
47
+ export const getServiceVersion = async (
48
+ params: IGetServiceVersionParams,
49
+ ): Promise<IGetServiceVersionResponse> =>
50
+ (
51
+ await AbyssReflexCore.axios.get<IGetServiceVersionResponse>(
52
+ `${versionUrl(params)}/${params.versionId}`,
53
+ )
54
+ ).data;
@@ -46,11 +46,16 @@ const calls: Call[] = [
46
46
  label: 'update',
47
47
  method: 'patch',
48
48
  url: BASE,
49
- body: { cors: { allowedOrigins: ['https://shop.example'] }, rateLimitPerIpPerMinute: 120 },
49
+ body: {
50
+ cors: { allowedOrigins: ['https://shop.example'] },
51
+ rateLimitPerIpPerMinute: 120,
52
+ versionsKept: 40,
53
+ },
50
54
  run: () =>
51
55
  sdk().update(SERVICE, {
52
56
  cors: { allowedOrigins: ['https://shop.example'] },
53
57
  rateLimitPerIpPerMinute: 120,
58
+ versionsKept: 40,
54
59
  }),
55
60
  },
56
61
  { label: 'delete', method: 'delete', url: BASE, run: () => sdk().delete(SERVICE) },
@@ -1,55 +1,55 @@
1
- import { AbyssReflexCore } from '..';
2
- import type {
3
- ICreateServiceBody,
4
- ICreateServiceParams,
5
- ICreateServiceResponse,
6
- IDeleteServiceParams,
7
- IDeleteServiceResponse,
8
- IGetServiceParams,
9
- IGetServiceResponse,
10
- IListServiceParams,
11
- IListServiceResponse,
12
- IUpdateServiceBody,
13
- IUpdateServiceParams,
14
- IUpdateServiceResponse,
15
- } from '../types';
16
-
17
- const serviceListUrl = (params: { applicationId: string }): string =>
18
- `api/service/${params.applicationId}`;
19
-
20
- const serviceUrl = (params: { applicationId: string; serviceId: string }): string =>
21
- `${serviceListUrl(params)}/${params.serviceId}`;
22
-
23
- /** `GET /service/:applicationId`: the Services, each with its current deployment per environment. Needs REFLEX_READ. */
24
- export const listService = async (params: IListServiceParams): Promise<IListServiceResponse> =>
25
- (await AbyssReflexCore.axios.get<IListServiceResponse>(serviceListUrl(params))).data;
26
-
27
- /**
28
- * `POST /service/:applicationId`: a Service of a name, a slug (immutable, third segment of the address)
29
- * and a type. `409 ALREADY_EXISTS` when the name or the slug is taken. Needs REFLEX_FUNCTION_CREATE.
30
- */
31
- export const createService = async (
32
- params: ICreateServiceParams,
33
- body: ICreateServiceBody,
34
- ): Promise<ICreateServiceResponse> =>
35
- (await AbyssReflexCore.axios.post<ICreateServiceResponse>(serviceListUrl(params), body)).data;
36
-
37
- /** `GET .../:serviceId`. Needs REFLEX_READ. */
38
- export const getService = async (params: IGetServiceParams): Promise<IGetServiceResponse> =>
39
- (await AbyssReflexCore.axios.get<IGetServiceResponse>(serviceUrl(params))).data;
40
-
41
- /**
42
- * `PATCH .../:serviceId`: the name, and the draft of the CORS and of the rate limit, frozen by the next
43
- * version. Needs REFLEX_FUNCTION_UPDATE.
44
- */
45
- export const updateService = async (
46
- params: IUpdateServiceParams,
47
- body: IUpdateServiceBody,
48
- ): Promise<IUpdateServiceResponse> =>
49
- (await AbyssReflexCore.axios.patch<IUpdateServiceResponse>(serviceUrl(params), body)).data;
50
-
51
- /** `DELETE .../:serviceId`: the Service, its functions, routes, versions and deployments. Needs REFLEX_FUNCTION_DELETE. */
52
- export const deleteService = async (
53
- params: IDeleteServiceParams,
54
- ): Promise<IDeleteServiceResponse> =>
55
- (await AbyssReflexCore.axios.delete<IDeleteServiceResponse>(serviceUrl(params))).data;
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ ICreateServiceBody,
4
+ ICreateServiceParams,
5
+ ICreateServiceResponse,
6
+ IDeleteServiceParams,
7
+ IDeleteServiceResponse,
8
+ IGetServiceParams,
9
+ IGetServiceResponse,
10
+ IListServiceParams,
11
+ IListServiceResponse,
12
+ IUpdateServiceBody,
13
+ IUpdateServiceParams,
14
+ IUpdateServiceResponse,
15
+ } from '../types';
16
+
17
+ const serviceListUrl = (params: { applicationId: string }): string =>
18
+ `api/service/${params.applicationId}`;
19
+
20
+ const serviceUrl = (params: { applicationId: string; serviceId: string }): string =>
21
+ `${serviceListUrl(params)}/${params.serviceId}`;
22
+
23
+ /** `GET /service/:applicationId`: the Services, each with its current deployment per environment. Needs REFLEX_READ. */
24
+ export const listService = async (params: IListServiceParams): Promise<IListServiceResponse> =>
25
+ (await AbyssReflexCore.axios.get<IListServiceResponse>(serviceListUrl(params))).data;
26
+
27
+ /**
28
+ * `POST /service/:applicationId`: a Service of a name, a slug (immutable, third segment of the address)
29
+ * and a type. `409 ALREADY_EXISTS` when the name or the slug is taken. Needs REFLEX_FUNCTION_CREATE.
30
+ */
31
+ export const createService = async (
32
+ params: ICreateServiceParams,
33
+ body: ICreateServiceBody,
34
+ ): Promise<ICreateServiceResponse> =>
35
+ (await AbyssReflexCore.axios.post<ICreateServiceResponse>(serviceListUrl(params), body)).data;
36
+
37
+ /** `GET .../:serviceId`. Needs REFLEX_READ. */
38
+ export const getService = async (params: IGetServiceParams): Promise<IGetServiceResponse> =>
39
+ (await AbyssReflexCore.axios.get<IGetServiceResponse>(serviceUrl(params))).data;
40
+
41
+ /**
42
+ * `PATCH .../:serviceId`: the name, and the draft of the CORS and of the rate limit, frozen by the next
43
+ * version. Needs REFLEX_FUNCTION_UPDATE.
44
+ */
45
+ export const updateService = async (
46
+ params: IUpdateServiceParams,
47
+ body: IUpdateServiceBody,
48
+ ): Promise<IUpdateServiceResponse> =>
49
+ (await AbyssReflexCore.axios.patch<IUpdateServiceResponse>(serviceUrl(params), body)).data;
50
+
51
+ /** `DELETE .../:serviceId`: the Service, its functions, routes, versions and deployments. Needs REFLEX_FUNCTION_DELETE. */
52
+ export const deleteService = async (
53
+ params: IDeleteServiceParams,
54
+ ): Promise<IDeleteServiceResponse> =>
55
+ (await AbyssReflexCore.axios.delete<IDeleteServiceResponse>(serviceUrl(params))).data;
@@ -0,0 +1,66 @@
1
+ import { AxiosAdapter, InternalAxiosRequestConfig } from 'axios';
2
+ import { ADMIN_TOKEN_HEADER, AbyssReflexCore, ReflexErrorCode } from '..';
3
+
4
+ const OWNER = { organizationId: 'org-1' };
5
+ const BODY = { owner: OWNER, itemIds: ['day-1'] };
6
+ const BASE = 'storage-surplus/admin';
7
+
8
+ const surplus = () => AbyssReflexCore.sdk.storageSurplus.admin;
9
+
10
+ describe('AbyssReflexCore storage surplus routes (day 90 of abyss-main)', () => {
11
+ const adapter = jest.fn<ReturnType<AxiosAdapter>, [InternalAxiosRequestConfig]>(
12
+ async (config) => ({
13
+ data: { data: { items: [] } },
14
+ status: 200,
15
+ statusText: '',
16
+ headers: {},
17
+ config,
18
+ }),
19
+ );
20
+
21
+ beforeAll(() => {
22
+ AbyssReflexCore.setConfig({ baseURL: 'http://reflex.test/', adminToken: 'mesh-admin-token' });
23
+ AbyssReflexCore.axios.defaults.adapter = adapter;
24
+ });
25
+
26
+ beforeEach(() => adapter.mockClear());
27
+
28
+ it.each([
29
+ [
30
+ 'listArchivable',
31
+ `${BASE}/archivable`,
32
+ { owner: OWNER },
33
+ () => surplus().listArchivable({ owner: OWNER }),
34
+ ],
35
+ ['archive', `${BASE}/archive`, BODY, () => surplus().archive(BODY)],
36
+ [
37
+ 'listArchives',
38
+ `${BASE}/archives`,
39
+ { owner: OWNER },
40
+ () => surplus().listArchives({ owner: OWNER }),
41
+ ],
42
+ ['deleteArchives', `${BASE}/delete-archives`, BODY, () => surplus().deleteArchives(BODY)],
43
+ ])('%s posts to %s with the body and the admin token', async (_label, url, body, run) => {
44
+ const answer = await run();
45
+
46
+ const config = adapter.mock.calls[0][0];
47
+ expect(config.method).toBe('post');
48
+ expect(config.url).toBe(url);
49
+ expect(config.baseURL).toBe('http://reflex.test/');
50
+ expect(JSON.parse(config.data)).toEqual(body);
51
+ expect(config.headers.get(ADMIN_TOKEN_HEADER)).toBe('mesh-admin-token');
52
+ expect(answer).toEqual({ data: { items: [] } });
53
+ });
54
+
55
+ it('names the header of the mesh admin token', () => {
56
+ expect(ADMIN_TOKEN_HEADER).toBe('abyss-admin-token');
57
+ });
58
+
59
+ it('names the refusal of a publication past the storage quota', () => {
60
+ expect(ReflexErrorCode.STORAGE_PUBLISH_REFUSED).toBe('STORAGE_PUBLISH_REFUSED');
61
+ });
62
+
63
+ it('names the 404 of a run whose archive was deleted', () => {
64
+ expect(ReflexErrorCode.ARCHIVE_DELETED).toBe('ARCHIVE_DELETED');
65
+ });
66
+ });
@@ -0,0 +1,45 @@
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ IApplyStorageSurplusAdminBody,
4
+ IApplyStorageSurplusAdminResponse,
5
+ IListStorageSurplusAdminBody,
6
+ IListStorageSurplusAdminResponse,
7
+ } from '../types';
8
+
9
+ const BASE = 'storage-surplus/admin';
10
+
11
+ /**
12
+ * `POST /storage-surplus/admin/archivable`: the days of runs of an organization that can move to the archive now. For
13
+ * abyss-main only: behind the admin token (`setConfig({ adminToken })`). AbyssReflex lists nothing for the surplus of
14
+ * the ONLINE quota (its runs are not in it): the answer is always empty.
15
+ */
16
+ export const listArchivableStorageSurplusAdmin = async (
17
+ body: IListStorageSurplusAdminBody,
18
+ ): Promise<IListStorageSurplusAdminResponse> =>
19
+ (await AbyssReflexCore.axios.post<IListStorageSurplusAdminResponse>(`${BASE}/archivable`, body))
20
+ .data;
21
+
22
+ /** `POST /storage-surplus/admin/archive`: moves the given days to the archive; idempotent. Admin token. */
23
+ export const archiveStorageSurplusAdmin = async (
24
+ body: IApplyStorageSurplusAdminBody,
25
+ ): Promise<IApplyStorageSurplusAdminResponse> =>
26
+ (await AbyssReflexCore.axios.post<IApplyStorageSurplusAdminResponse>(`${BASE}/archive`, body))
27
+ .data;
28
+
29
+ /** `POST /storage-surplus/admin/archives`: the archived days of the organization, the oldest first. Admin token. */
30
+ export const listArchivesStorageSurplusAdmin = async (
31
+ body: IListStorageSurplusAdminBody,
32
+ ): Promise<IListStorageSurplusAdminResponse> =>
33
+ (await AbyssReflexCore.axios.post<IListStorageSurplusAdminResponse>(`${BASE}/archives`, body))
34
+ .data;
35
+
36
+ /** `POST /storage-surplus/admin/delete-archives`: deletes the given archived days for good; idempotent. Admin token. */
37
+ export const deleteArchivesStorageSurplusAdmin = async (
38
+ body: IApplyStorageSurplusAdminBody,
39
+ ): Promise<IApplyStorageSurplusAdminResponse> =>
40
+ (
41
+ await AbyssReflexCore.axios.post<IApplyStorageSurplusAdminResponse>(
42
+ `${BASE}/delete-archives`,
43
+ body,
44
+ )
45
+ ).data;