@abyss-project/reflex 6.3.0 → 6.6.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 (123) hide show
  1. package/.prettierrc +5 -5
  2. package/dist/api/function-run.api.d.ts +3 -1
  3. package/dist/api/function-run.api.js +5 -1
  4. package/dist/api/function-run.api.js.map +1 -1
  5. package/dist/api/function-settings.api.d.ts +3 -1
  6. package/dist/api/function-settings.api.js +7 -1
  7. package/dist/api/function-settings.api.js.map +1 -1
  8. package/dist/api/index.d.ts +1 -0
  9. package/dist/api/index.js +1 -0
  10. package/dist/api/index.js.map +1 -1
  11. package/dist/api/storage-surplus.admin.api.d.ts +5 -0
  12. package/dist/api/storage-surplus.admin.api.js +17 -0
  13. package/dist/api/storage-surplus.admin.api.js.map +1 -0
  14. package/dist/discord/discord-command-tree.d.ts +5 -0
  15. package/dist/discord/discord-command-tree.js +38 -0
  16. package/dist/discord/discord-command-tree.js.map +1 -0
  17. package/dist/discord/discord-event-filter-cases.js +27 -11
  18. package/dist/discord/discord-event-filter-cases.js.map +1 -1
  19. package/dist/discord/discord-event-filters.js +7 -3
  20. package/dist/discord/discord-event-filters.js.map +1 -1
  21. package/dist/discord/discord-event-intents.d.ts +8 -2
  22. package/dist/discord/discord-event-intents.js +13 -2
  23. package/dist/discord/discord-event-intents.js.map +1 -1
  24. package/dist/discord/index.d.ts +1 -0
  25. package/dist/discord/index.js +1 -0
  26. package/dist/discord/index.js.map +1 -1
  27. package/dist/index.d.ts +17 -0
  28. package/dist/index.js +20 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/types/enum/discord-command-node-type.enum.d.ts +5 -0
  31. package/dist/types/enum/discord-command-node-type.enum.js +10 -0
  32. package/dist/types/enum/discord-command-node-type.enum.js.map +1 -0
  33. package/dist/types/enum/discord-command-type.enum.d.ts +5 -0
  34. package/dist/types/enum/discord-command-type.enum.js +10 -0
  35. package/dist/types/enum/discord-command-type.enum.js.map +1 -0
  36. package/dist/types/enum/discord-event-type.enum.d.ts +3 -1
  37. package/dist/types/enum/discord-event-type.enum.js +2 -0
  38. package/dist/types/enum/discord-event-type.enum.js.map +1 -1
  39. package/dist/types/enum/index.d.ts +2 -0
  40. package/dist/types/enum/index.js +2 -0
  41. package/dist/types/enum/index.js.map +1 -1
  42. package/dist/types/enum/reflex-error-code.enum.d.ts +14 -1
  43. package/dist/types/enum/reflex-error-code.enum.js +13 -0
  44. package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
  45. package/dist/types/interface/api/requests/application-run-settings.request.d.ts +1 -0
  46. package/dist/types/interface/api/requests/function-run.request.d.ts +16 -0
  47. package/dist/types/interface/api/requests/function-settings.request.d.ts +12 -0
  48. package/dist/types/interface/api/requests/index.d.ts +1 -0
  49. package/dist/types/interface/api/requests/index.js +1 -0
  50. package/dist/types/interface/api/requests/index.js.map +1 -1
  51. package/dist/types/interface/api/requests/service-discord.request.d.ts +7 -3
  52. package/dist/types/interface/api/requests/service.request.d.ts +1 -0
  53. package/dist/types/interface/api/requests/storage-surplus.admin.request.d.ts +8 -0
  54. package/dist/types/interface/api/requests/storage-surplus.admin.request.js +3 -0
  55. package/dist/types/interface/api/requests/storage-surplus.admin.request.js.map +1 -0
  56. package/dist/types/interface/api/responses/function-run.response.d.ts +12 -0
  57. package/dist/types/interface/api/responses/function-settings.response.d.ts +5 -1
  58. package/dist/types/interface/api/responses/index.d.ts +1 -0
  59. package/dist/types/interface/api/responses/index.js +1 -0
  60. package/dist/types/interface/api/responses/index.js.map +1 -1
  61. package/dist/types/interface/api/responses/storage-surplus.admin.response.d.ts +8 -0
  62. package/dist/types/interface/api/responses/storage-surplus.admin.response.js +3 -0
  63. package/dist/types/interface/api/responses/storage-surplus.admin.response.js.map +1 -0
  64. package/dist/types/interface/models/index.d.ts +2 -0
  65. package/dist/types/interface/models/index.js +2 -0
  66. package/dist/types/interface/models/index.js.map +1 -1
  67. package/dist/types/interface/models/reflex-discord.model.d.ts +18 -2
  68. package/dist/types/interface/models/reflex-discord.model.js +4 -0
  69. package/dist/types/interface/models/reflex-discord.model.js.map +1 -1
  70. package/dist/types/interface/models/reflex-run-retention.model.d.ts +13 -0
  71. package/dist/types/interface/models/reflex-run-retention.model.js +8 -0
  72. package/dist/types/interface/models/reflex-run-retention.model.js.map +1 -0
  73. package/dist/types/interface/models/reflex-run-settings.model.d.ts +4 -0
  74. package/dist/types/interface/models/reflex-run.model.d.ts +9 -0
  75. package/dist/types/interface/models/reflex-run.model.js +4 -1
  76. package/dist/types/interface/models/reflex-run.model.js.map +1 -1
  77. package/dist/types/interface/models/reflex-service-deployment.model.d.ts +2 -2
  78. package/dist/types/interface/models/reflex-service.model.d.ts +1 -0
  79. package/dist/types/interface/models/reflex-storage-surplus.model.d.ts +11 -0
  80. package/dist/types/interface/models/reflex-storage-surplus.model.js +3 -0
  81. package/dist/types/interface/models/reflex-storage-surplus.model.js.map +1 -0
  82. package/package.json +1 -1
  83. package/src/api/application-run-settings.api.test.ts +62 -51
  84. package/src/api/function-run.api.ts +34 -0
  85. package/src/api/function-settings.api.ts +96 -74
  86. package/src/api/function.api.test.ts +346 -291
  87. package/src/api/index.ts +27 -26
  88. package/src/api/service.api.test.ts +220 -215
  89. package/src/api/storage-surplus.admin.api.test.ts +66 -0
  90. package/src/api/storage-surplus.admin.api.ts +45 -0
  91. package/src/discord/discord-command-tree.test.ts +47 -0
  92. package/src/discord/discord-command-tree.ts +60 -0
  93. package/src/discord/discord-event-filter-cases.ts +54 -16
  94. package/src/discord/discord-event-filters.test.ts +33 -4
  95. package/src/discord/discord-event-filters.ts +13 -5
  96. package/src/discord/discord-event-intents.test.ts +27 -0
  97. package/src/discord/discord-event-intents.ts +31 -6
  98. package/src/discord/index.ts +1 -0
  99. package/src/index.ts +44 -0
  100. package/src/types/enum/discord-command-node-type.enum.ts +10 -0
  101. package/src/types/enum/discord-command-type.enum.ts +9 -0
  102. package/src/types/enum/discord-event-type.enum.ts +4 -0
  103. package/src/types/enum/index.ts +2 -0
  104. package/src/types/enum/reflex-error-code.enum.ts +112 -73
  105. package/src/types/interface/api/requests/application-run-settings.request.ts +13 -11
  106. package/src/types/interface/api/requests/function-run.request.ts +53 -32
  107. package/src/types/interface/api/requests/function-settings.request.ts +50 -34
  108. package/src/types/interface/api/requests/index.ts +25 -24
  109. package/src/types/interface/api/requests/service-discord.request.ts +19 -6
  110. package/src/types/interface/api/requests/service.request.ts +48 -46
  111. package/src/types/interface/api/requests/storage-surplus.admin.request.ts +12 -0
  112. package/src/types/interface/api/responses/function-run.response.ts +35 -18
  113. package/src/types/interface/api/responses/function-settings.response.ts +57 -50
  114. package/src/types/interface/api/responses/index.ts +25 -24
  115. package/src/types/interface/api/responses/storage-surplus.admin.response.ts +10 -0
  116. package/src/types/interface/models/index.ts +29 -27
  117. package/src/types/interface/models/reflex-discord.model.ts +45 -4
  118. package/src/types/interface/models/reflex-run-retention.model.ts +24 -0
  119. package/src/types/interface/models/reflex-run-settings.model.ts +39 -28
  120. package/src/types/interface/models/reflex-run.model.ts +317 -299
  121. package/src/types/interface/models/reflex-service-deployment.model.ts +48 -46
  122. package/src/types/interface/models/reflex-service.model.ts +47 -45
  123. package/src/types/interface/models/reflex-storage-surplus.model.ts +23 -0
@@ -1,51 +1,62 @@
1
- import { AxiosAdapter, InternalAxiosRequestConfig } from 'axios';
2
- import { AbyssReflexCore, LogCapMode } 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
- describe('AbyssReflexCore application run settings routes', () => {
20
- it('runSettings.get calls GET .../run-settings', async () => {
21
- await AbyssReflexCore.sdk.application.runSettings.get({ applicationId: 'app-1' });
22
-
23
- const config = adapter.mock.calls[0][0];
24
- expect(config.method).toBe('get');
25
- expect(config.url).toBe('api/application/app-1/run-settings');
26
- });
27
-
28
- it('runSettings.set calls PUT .../run-settings with the cap', async () => {
29
- await AbyssReflexCore.sdk.application.runSettings.set(
30
- { applicationId: 'app-1' },
31
- { maxLogLinesPerRun: 500 },
32
- );
33
-
34
- const config = adapter.mock.calls[0][0];
35
- expect(config.method).toBe('put');
36
- expect(config.url).toBe('api/application/app-1/run-settings');
37
- expect(JSON.parse(config.data)).toEqual({ maxLogLinesPerRun: 500 });
38
- });
39
-
40
- it('logCap.set calls PUT .../log-cap of the function', async () => {
41
- await AbyssReflexCore.sdk.function.logCap.set(
42
- { applicationId: 'app-1', functionId: 'fn-1' },
43
- { mode: LogCapMode.LIMIT, lines: 50 },
44
- );
45
-
46
- const config = adapter.mock.calls[0][0];
47
- expect(config.method).toBe('put');
48
- expect(config.url).toBe('api/function/app-1/fn-1/log-cap');
49
- expect(JSON.parse(config.data)).toEqual({ mode: 'LIMIT', lines: 50 });
50
- });
51
- });
1
+ import { AxiosAdapter, InternalAxiosRequestConfig } from 'axios';
2
+ import { AbyssReflexCore, LogCapMode } 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
+ describe('AbyssReflexCore application run settings routes', () => {
20
+ it('runSettings.get calls GET .../run-settings', async () => {
21
+ await AbyssReflexCore.sdk.application.runSettings.get({ applicationId: 'app-1' });
22
+
23
+ const config = adapter.mock.calls[0][0];
24
+ expect(config.method).toBe('get');
25
+ expect(config.url).toBe('api/application/app-1/run-settings');
26
+ });
27
+
28
+ it('runSettings.set calls PUT .../run-settings with the cap', async () => {
29
+ await AbyssReflexCore.sdk.application.runSettings.set(
30
+ { applicationId: 'app-1' },
31
+ { maxLogLinesPerRun: 500 },
32
+ );
33
+
34
+ const config = adapter.mock.calls[0][0];
35
+ expect(config.method).toBe('put');
36
+ expect(config.url).toBe('api/application/app-1/run-settings');
37
+ expect(JSON.parse(config.data)).toEqual({ maxLogLinesPerRun: 500 });
38
+ });
39
+
40
+ it('runSettings.set carries the retention tier of the runs', async () => {
41
+ await AbyssReflexCore.sdk.application.runSettings.set(
42
+ { applicationId: 'app-1' },
43
+ { maxLogLinesPerRun: null, runRetentionDays: 90 },
44
+ );
45
+
46
+ const config = adapter.mock.calls[0][0];
47
+ expect(config.method).toBe('put');
48
+ expect(JSON.parse(config.data)).toEqual({ maxLogLinesPerRun: null, runRetentionDays: 90 });
49
+ });
50
+
51
+ it('logCap.set calls PUT .../log-cap of the function', async () => {
52
+ await AbyssReflexCore.sdk.function.logCap.set(
53
+ { applicationId: 'app-1', functionId: 'fn-1' },
54
+ { mode: LogCapMode.LIMIT, lines: 50 },
55
+ );
56
+
57
+ const config = adapter.mock.calls[0][0];
58
+ expect(config.method).toBe('put');
59
+ expect(config.url).toBe('api/function/app-1/fn-1/log-cap');
60
+ expect(JSON.parse(config.data)).toEqual({ mode: 'LIMIT', lines: 50 });
61
+ });
62
+ });
@@ -7,6 +7,12 @@ import type {
7
7
  IListFunctionRunParams,
8
8
  IListFunctionRunQuery,
9
9
  IListFunctionRunResponse,
10
+ IReplayFunctionRunBody,
11
+ IReplayFunctionRunParams,
12
+ IReplayFunctionRunResponse,
13
+ ISetFunctionRunFavoriteBody,
14
+ ISetFunctionRunFavoriteParams,
15
+ ISetFunctionRunFavoriteResponse,
10
16
  } from '../types';
11
17
 
12
18
  const runUrl = (params: { applicationId: string; functionId: string }): string =>
@@ -27,6 +33,22 @@ export const getFunctionRun = async (
27
33
  (await AbyssReflexCore.axios.get<IGetFunctionRunResponse>(`${runUrl(params)}/${params.runId}`))
28
34
  .data;
29
35
 
36
+ /**
37
+ * `POST .../run/:runId/replay`: replays a live run of a Discord event trigger from its kept input. `DRY_RUN` needs
38
+ * REFLEX_LOG_READ and REFLEX_TEST_RUN; `LIVE` needs REFLEX_LOG_READ and REFLEX_PUBLISH (REFLEX_PUBLISH_PRODUCTION in
39
+ * production), at most `REFLEX_REPLAY_LIMITS.liveReplaysPerMinute` per bot and environment.
40
+ */
41
+ export const replayFunctionRun = async (
42
+ params: IReplayFunctionRunParams,
43
+ body: IReplayFunctionRunBody,
44
+ ): Promise<IReplayFunctionRunResponse> =>
45
+ (
46
+ await AbyssReflexCore.axios.post<IReplayFunctionRunResponse>(
47
+ `${runUrl(params)}/${params.runId}/replay`,
48
+ body,
49
+ )
50
+ ).data;
51
+
30
52
  /** `GET .../run/:runId/state`: the state of a live execution, the one an async route answered with. Needs REFLEX_LOG_READ. */
31
53
  export const getFunctionRunState = async (
32
54
  params: IGetFunctionRunStateParams,
@@ -36,3 +58,15 @@ export const getFunctionRunState = async (
36
58
  `${runUrl(params)}/${params.runId}/state`,
37
59
  )
38
60
  ).data;
61
+
62
+ /** `PUT .../run/:runId/favorite`: marks a run as a favorite (never purged) or not. Needs REFLEX_FUNCTION_UPDATE. */
63
+ export const setFunctionRunFavorite = async (
64
+ params: ISetFunctionRunFavoriteParams,
65
+ body: ISetFunctionRunFavoriteBody,
66
+ ): Promise<ISetFunctionRunFavoriteResponse> =>
67
+ (
68
+ await AbyssReflexCore.axios.put<ISetFunctionRunFavoriteResponse>(
69
+ `${runUrl(params)}/${params.runId}/favorite`,
70
+ body,
71
+ )
72
+ ).data;
@@ -1,74 +1,96 @@
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
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ IGetFunctionRunRetentionParams,
4
+ IGetFunctionRunRetentionResponse,
5
+ IGetFunctionSettingsParams,
6
+ IGetFunctionSettingsResponse,
7
+ IRemoveFunctionEnvironmentSettingsParams,
8
+ IRemoveFunctionEnvironmentSettingsResponse,
9
+ ISetFunctionDefaultSettingsBody,
10
+ ISetFunctionDefaultSettingsParams,
11
+ ISetFunctionDefaultSettingsResponse,
12
+ ISetFunctionEnvironmentSettingsBody,
13
+ ISetFunctionEnvironmentSettingsParams,
14
+ ISetFunctionEnvironmentSettingsResponse,
15
+ ISetFunctionLogCapBody,
16
+ ISetFunctionLogCapParams,
17
+ ISetFunctionLogCapResponse,
18
+ ISetFunctionRunRetentionBody,
19
+ ISetFunctionRunRetentionParams,
20
+ ISetFunctionRunRetentionResponse,
21
+ } from '../types';
22
+
23
+ const settingsUrl = (params: { applicationId: string; functionId: string }): string =>
24
+ `api/function/${params.applicationId}/${params.functionId}/settings`;
25
+
26
+ /** `GET .../settings`: the default, the overrides, and what each environment runs with. Needs REFLEX_READ. */
27
+ export const getFunctionSettings = async (
28
+ params: IGetFunctionSettingsParams,
29
+ ): Promise<IGetFunctionSettingsResponse> =>
30
+ (await AbyssReflexCore.axios.get<IGetFunctionSettingsResponse>(settingsUrl(params))).data;
31
+
32
+ /**
33
+ * `PUT .../settings`: sets the default of every environment without an override, applied at once where the
34
+ * function runs. Needs REFLEX_FUNCTION_UPDATE, and REFLEX_PUBLISH_PRODUCTION when the default applies to a
35
+ * production environment where the function runs.
36
+ */
37
+ export const setFunctionDefaultSettings = async (
38
+ params: ISetFunctionDefaultSettingsParams,
39
+ body: ISetFunctionDefaultSettingsBody,
40
+ ): Promise<ISetFunctionDefaultSettingsResponse> =>
41
+ (await AbyssReflexCore.axios.put<ISetFunctionDefaultSettingsResponse>(settingsUrl(params), body))
42
+ .data;
43
+
44
+ /**
45
+ * `PUT .../settings/:environmentId`: sets the override of one environment. Needs REFLEX_FUNCTION_UPDATE, and
46
+ * REFLEX_PUBLISH_PRODUCTION for a production environment.
47
+ */
48
+ export const setFunctionEnvironmentSettings = async (
49
+ params: ISetFunctionEnvironmentSettingsParams,
50
+ body: ISetFunctionEnvironmentSettingsBody,
51
+ ): Promise<ISetFunctionEnvironmentSettingsResponse> =>
52
+ (
53
+ await AbyssReflexCore.axios.put<ISetFunctionEnvironmentSettingsResponse>(
54
+ `${settingsUrl(params)}/${params.environmentId}`,
55
+ body,
56
+ )
57
+ ).data;
58
+
59
+ /** `DELETE .../settings/:environmentId`: the environment falls back on the default. Same rights as setting it. */
60
+ export const removeFunctionEnvironmentSettings = async (
61
+ params: IRemoveFunctionEnvironmentSettingsParams,
62
+ ): Promise<IRemoveFunctionEnvironmentSettingsResponse> =>
63
+ (
64
+ await AbyssReflexCore.axios.delete<IRemoveFunctionEnvironmentSettingsResponse>(
65
+ `${settingsUrl(params)}/${params.environmentId}`,
66
+ )
67
+ ).data;
68
+
69
+ /** `PUT .../log-cap`: sets the log cap of the function (inherit, none, or a number of lines). Needs REFLEX_FUNCTION_UPDATE. */
70
+ export const setFunctionLogCap = async (
71
+ params: ISetFunctionLogCapParams,
72
+ body: ISetFunctionLogCapBody,
73
+ ): Promise<ISetFunctionLogCapResponse> =>
74
+ (
75
+ await AbyssReflexCore.axios.put<ISetFunctionLogCapResponse>(
76
+ `api/function/${params.applicationId}/${params.functionId}/log-cap`,
77
+ body,
78
+ )
79
+ ).data;
80
+
81
+ const runRetentionUrl = (params: { applicationId: string; functionId: string }): string =>
82
+ `api/function/${params.applicationId}/${params.functionId}/run-retention`;
83
+
84
+ /** `GET .../run-retention`: the retention tier of the function, the one it inherits and the versions kept. Needs REFLEX_READ. */
85
+ export const getFunctionRunRetention = async (
86
+ params: IGetFunctionRunRetentionParams,
87
+ ): Promise<IGetFunctionRunRetentionResponse> =>
88
+ (await AbyssReflexCore.axios.get<IGetFunctionRunRetentionResponse>(runRetentionUrl(params))).data;
89
+
90
+ /** `PUT .../run-retention`: sets the retention tier and the versions kept of the function. Needs REFLEX_FUNCTION_UPDATE. */
91
+ export const setFunctionRunRetention = async (
92
+ params: ISetFunctionRunRetentionParams,
93
+ body: ISetFunctionRunRetentionBody,
94
+ ): Promise<ISetFunctionRunRetentionResponse> =>
95
+ (await AbyssReflexCore.axios.put<ISetFunctionRunRetentionResponse>(runRetentionUrl(params), body))
96
+ .data;