@abyss-project/reflex 6.4.0 → 6.5.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 (232) hide show
  1. package/dist/api/code-environment.api.d.ts +2 -0
  2. package/dist/api/code-environment.api.js +7 -0
  3. package/dist/api/code-environment.api.js.map +1 -0
  4. package/dist/api/index.d.ts +2 -0
  5. package/dist/api/index.js +2 -0
  6. package/dist/api/index.js.map +1 -1
  7. package/dist/api/service-template.api.d.ts +2 -0
  8. package/dist/api/service-template.api.js +7 -0
  9. package/dist/api/service-template.api.js.map +1 -0
  10. package/dist/code/index.d.ts +1 -0
  11. package/dist/code/index.js +18 -0
  12. package/dist/code/index.js.map +1 -0
  13. package/dist/code/reflex-code-declarations.d.ts +1 -0
  14. package/dist/code/reflex-code-declarations.js +644 -0
  15. package/dist/code/reflex-code-declarations.js.map +1 -0
  16. package/dist/index.d.ts +9 -0
  17. package/dist/index.js +9 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/types/enum/index.d.ts +4 -0
  20. package/dist/types/enum/index.js +4 -0
  21. package/dist/types/enum/index.js.map +1 -1
  22. package/dist/types/enum/reflex-code-diagnostic-category.enum.d.ts +6 -0
  23. package/dist/types/enum/reflex-code-diagnostic-category.enum.js +11 -0
  24. package/dist/types/enum/reflex-code-diagnostic-category.enum.js.map +1 -0
  25. package/dist/types/enum/reflex-error-code.enum.d.ts +1 -0
  26. package/dist/types/enum/reflex-error-code.enum.js +1 -0
  27. package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
  28. package/dist/types/enum/service-template-follow-up-kind.enum.d.ts +10 -0
  29. package/dist/types/enum/service-template-follow-up-kind.enum.js +15 -0
  30. package/dist/types/enum/service-template-follow-up-kind.enum.js.map +1 -0
  31. package/dist/types/enum/service-template-id.enum.d.ts +10 -0
  32. package/dist/types/enum/service-template-id.enum.js +15 -0
  33. package/dist/types/enum/service-template-id.enum.js.map +1 -0
  34. package/dist/types/enum/service-template-parameter-kind.enum.d.ts +4 -0
  35. package/dist/types/enum/service-template-parameter-kind.enum.js +9 -0
  36. package/dist/types/enum/service-template-parameter-kind.enum.js.map +1 -0
  37. package/dist/types/enum/trigger-access-mode.enum.d.ts +2 -1
  38. package/dist/types/enum/trigger-access-mode.enum.js +1 -0
  39. package/dist/types/enum/trigger-access-mode.enum.js.map +1 -1
  40. package/dist/types/interface/api/requests/code-environment.request.d.ts +3 -0
  41. package/dist/types/interface/api/requests/code-environment.request.js +3 -0
  42. package/dist/types/interface/api/requests/code-environment.request.js.map +1 -0
  43. package/dist/types/interface/api/requests/index.d.ts +2 -0
  44. package/dist/types/interface/api/requests/index.js +2 -0
  45. package/dist/types/interface/api/requests/index.js.map +1 -1
  46. package/dist/types/interface/api/requests/service-template.request.d.ts +3 -0
  47. package/dist/types/interface/api/requests/service-template.request.js +3 -0
  48. package/dist/types/interface/api/requests/service-template.request.js.map +1 -0
  49. package/dist/types/interface/api/requests/service.request.d.ts +2 -1
  50. package/dist/types/interface/api/responses/code-environment.response.d.ts +6 -0
  51. package/dist/types/interface/api/responses/code-environment.response.js +3 -0
  52. package/dist/types/interface/api/responses/code-environment.response.js.map +1 -0
  53. package/dist/types/interface/api/responses/index.d.ts +2 -0
  54. package/dist/types/interface/api/responses/index.js +2 -0
  55. package/dist/types/interface/api/responses/index.js.map +1 -1
  56. package/dist/types/interface/api/responses/service-template.response.d.ts +6 -0
  57. package/dist/types/interface/api/responses/service-template.response.js +3 -0
  58. package/dist/types/interface/api/responses/service-template.response.js.map +1 -0
  59. package/dist/types/interface/models/index.d.ts +3 -0
  60. package/dist/types/interface/models/index.js +3 -0
  61. package/dist/types/interface/models/index.js.map +1 -1
  62. package/dist/types/interface/models/reflex-code-diagnostic.model.d.ts +10 -0
  63. package/dist/types/interface/models/reflex-code-diagnostic.model.js +5 -0
  64. package/dist/types/interface/models/reflex-code-diagnostic.model.js.map +1 -0
  65. package/dist/types/interface/models/reflex-code-environment.model.d.ts +9 -0
  66. package/dist/types/interface/models/reflex-code-environment.model.js +3 -0
  67. package/dist/types/interface/models/reflex-code-environment.model.js.map +1 -0
  68. package/dist/types/interface/models/reflex-service-template.model.d.ts +33 -0
  69. package/dist/types/interface/models/reflex-service-template.model.js +3 -0
  70. package/dist/types/interface/models/reflex-service-template.model.js.map +1 -0
  71. package/package.json +1 -1
  72. package/src/api/application-run-settings.api.test.ts +62 -62
  73. package/src/api/code-environment.api.ts +15 -0
  74. package/src/api/function-run.api.ts +53 -53
  75. package/src/api/function-settings.api.ts +96 -96
  76. package/src/api/function.api.test.ts +346 -346
  77. package/src/api/index.ts +2 -0
  78. package/src/api/service-route.api.ts +74 -74
  79. package/src/api/service-template.api.test.ts +41 -0
  80. package/src/api/service-template.api.ts +12 -0
  81. package/src/api/service.api.test.ts +220 -220
  82. package/src/api/storage-surplus.admin.api.test.ts +66 -66
  83. package/src/api/storage-surplus.admin.api.ts +45 -45
  84. package/src/code/index.ts +1 -0
  85. package/src/code/reflex-code-declarations.ts +646 -0
  86. package/src/index.ts +497 -480
  87. package/src/types/enum/access-grant-status.enum.ts +12 -12
  88. package/src/types/enum/access-kind.enum.ts +7 -7
  89. package/src/types/enum/access-request-status.enum.ts +11 -11
  90. package/src/types/enum/bot-event-block-reason.enum.ts +7 -7
  91. package/src/types/enum/completion-delivery-status.enum.ts +9 -9
  92. package/src/types/enum/configuration-read-as.enum.ts +5 -5
  93. package/src/types/enum/discord-activity-type.enum.ts +9 -9
  94. package/src/types/enum/discord-channel-type.enum.ts +11 -11
  95. package/src/types/enum/discord-component-kind.enum.ts +7 -7
  96. package/src/types/enum/discord-event-drop-reason.enum.ts +13 -13
  97. package/src/types/enum/discord-event-filter-name.enum.ts +11 -11
  98. package/src/types/enum/discord-event-status.enum.ts +13 -13
  99. package/src/types/enum/discord-event-type.enum.ts +7 -7
  100. package/src/types/enum/discord-gateway-failure-code.enum.ts +11 -11
  101. package/src/types/enum/discord-gateway-state.enum.ts +11 -11
  102. package/src/types/enum/discord-locale.enum.ts +35 -35
  103. package/src/types/enum/discord-option-type.enum.ts +12 -12
  104. package/src/types/enum/discord-presence-status.enum.ts +8 -8
  105. package/src/types/enum/discord-sync-status.enum.ts +6 -6
  106. package/src/types/enum/discord-token-state.enum.ts +11 -11
  107. package/src/types/enum/execution-mode.enum.ts +9 -9
  108. package/src/types/enum/execution-profile.enum.ts +20 -20
  109. package/src/types/enum/execution-settings-source.enum.ts +9 -9
  110. package/src/types/enum/health-status.enum.ts +4 -4
  111. package/src/types/enum/index.ts +55 -51
  112. package/src/types/enum/insights-period.enum.ts +8 -8
  113. package/src/types/enum/log-cap-mode.enum.ts +6 -6
  114. package/src/types/enum/log-drop-cause.enum.ts +8 -8
  115. package/src/types/enum/reflex-alert-metric.enum.ts +5 -5
  116. package/src/types/enum/reflex-alert-notification-state.enum.ts +6 -6
  117. package/src/types/enum/reflex-alert-scope.enum.ts +6 -6
  118. package/src/types/enum/reflex-code-diagnostic-category.enum.ts +11 -0
  119. package/src/types/enum/reflex-error-code.enum.ts +93 -88
  120. package/src/types/enum/route-method.enum.ts +9 -9
  121. package/src/types/enum/run-log-level.enum.ts +6 -6
  122. package/src/types/enum/run-mode.enum.ts +11 -11
  123. package/src/types/enum/run-status.enum.ts +16 -16
  124. package/src/types/enum/run-step-status.enum.ts +7 -7
  125. package/src/types/enum/schedule-sync-status.enum.ts +6 -6
  126. package/src/types/enum/scheduled-run-failure-code.enum.ts +14 -14
  127. package/src/types/enum/scheduled-run-origin.enum.ts +5 -5
  128. package/src/types/enum/scheduled-run-status.enum.ts +17 -17
  129. package/src/types/enum/service-block-reason.enum.ts +13 -13
  130. package/src/types/enum/service-deployment-action.enum.ts +11 -11
  131. package/src/types/enum/service-deployment-status.enum.ts +5 -5
  132. package/src/types/enum/service-template-follow-up-kind.enum.ts +19 -0
  133. package/src/types/enum/service-template-id.enum.ts +19 -0
  134. package/src/types/enum/service-template-parameter-kind.enum.ts +7 -0
  135. package/src/types/enum/service-type.enum.ts +9 -9
  136. package/src/types/enum/service-version-change-kind.enum.ts +6 -6
  137. package/src/types/enum/trace-effect-type.enum.ts +12 -12
  138. package/src/types/enum/trigger-access-mode.enum.ts +4 -0
  139. package/src/types/enum/trigger-kind.enum.ts +8 -8
  140. package/src/types/enum/vault-value-source.enum.ts +12 -12
  141. package/src/types/enum/vault-visibility.enum.ts +5 -5
  142. package/src/types/index.ts +2 -2
  143. package/src/types/interface/api/index.ts +3 -3
  144. package/src/types/interface/api/requests/alert-rule.request.ts +53 -53
  145. package/src/types/interface/api/requests/application-insights.request.ts +18 -18
  146. package/src/types/interface/api/requests/application-run-settings.request.ts +13 -13
  147. package/src/types/interface/api/requests/code-environment.request.ts +3 -0
  148. package/src/types/interface/api/requests/function-access.request.ts +51 -51
  149. package/src/types/interface/api/requests/function-run.request.ts +42 -42
  150. package/src/types/interface/api/requests/function-settings.request.ts +50 -50
  151. package/src/types/interface/api/requests/function-template.request.ts +29 -29
  152. package/src/types/interface/api/requests/function-test.request.ts +44 -44
  153. package/src/types/interface/api/requests/function-version.request.ts +38 -38
  154. package/src/types/interface/api/requests/function.request.ts +36 -36
  155. package/src/types/interface/api/requests/index.ts +27 -25
  156. package/src/types/interface/api/requests/route-stats.request.ts +22 -22
  157. package/src/types/interface/api/requests/service-completion-webhook.request.ts +11 -11
  158. package/src/types/interface/api/requests/service-configuration.request.ts +4 -4
  159. package/src/types/interface/api/requests/service-consumer.request.ts +51 -51
  160. package/src/types/interface/api/requests/service-deployment.request.ts +49 -49
  161. package/src/types/interface/api/requests/service-discord-event.request.ts +68 -68
  162. package/src/types/interface/api/requests/service-insights.request.ts +31 -31
  163. package/src/types/interface/api/requests/service-limits.request.ts +28 -28
  164. package/src/types/interface/api/requests/service-openapi.request.ts +10 -10
  165. package/src/types/interface/api/requests/service-route.request.ts +52 -52
  166. package/src/types/interface/api/requests/service-task.request.ts +80 -80
  167. package/src/types/interface/api/requests/service-template.request.ts +3 -0
  168. package/src/types/interface/api/requests/service-version.request.ts +24 -24
  169. package/src/types/interface/api/requests/service.request.ts +54 -48
  170. package/src/types/interface/api/requests/storage-surplus.admin.request.ts +12 -12
  171. package/src/types/interface/api/response.ts +4 -4
  172. package/src/types/interface/api/responses/alert-rule.response.ts +24 -24
  173. package/src/types/interface/api/responses/application-insights.response.ts +11 -11
  174. package/src/types/interface/api/responses/application-run-settings.response.ts +8 -8
  175. package/src/types/interface/api/responses/code-environment.response.ts +7 -0
  176. package/src/types/interface/api/responses/function-access.response.ts +45 -45
  177. package/src/types/interface/api/responses/function-run.response.ts +23 -23
  178. package/src/types/interface/api/responses/function-settings.response.ts +57 -57
  179. package/src/types/interface/api/responses/function-template.response.ts +21 -21
  180. package/src/types/interface/api/responses/function-test.response.ts +19 -19
  181. package/src/types/interface/api/responses/function-version.response.ts +42 -42
  182. package/src/types/interface/api/responses/function.response.ts +25 -25
  183. package/src/types/interface/api/responses/index.ts +27 -25
  184. package/src/types/interface/api/responses/route-stats.response.ts +15 -15
  185. package/src/types/interface/api/responses/service-completion-webhook.response.ts +13 -13
  186. package/src/types/interface/api/responses/service-configuration.response.ts +8 -8
  187. package/src/types/interface/api/responses/service-consumer.response.ts +33 -33
  188. package/src/types/interface/api/responses/service-deployment.response.ts +32 -32
  189. package/src/types/interface/api/responses/service-discord-event.response.ts +24 -24
  190. package/src/types/interface/api/responses/service-discord.response.ts +110 -110
  191. package/src/types/interface/api/responses/service-insights.response.ts +11 -11
  192. package/src/types/interface/api/responses/service-limits.response.ts +13 -13
  193. package/src/types/interface/api/responses/service-openapi.response.ts +7 -7
  194. package/src/types/interface/api/responses/service-route.response.ts +2 -2
  195. package/src/types/interface/api/responses/service-task.response.ts +57 -57
  196. package/src/types/interface/api/responses/service-template.response.ts +8 -0
  197. package/src/types/interface/api/responses/service-version.response.ts +112 -112
  198. package/src/types/interface/api/responses/service.response.ts +31 -31
  199. package/src/types/interface/api/responses/storage-surplus.admin.response.ts +10 -10
  200. package/src/types/interface/health.response.ts +7 -7
  201. package/src/types/interface/index.ts +3 -3
  202. package/src/types/interface/models/index.ts +32 -29
  203. package/src/types/interface/models/reflex-access-grant.model.ts +14 -14
  204. package/src/types/interface/models/reflex-access-request.model.ts +15 -15
  205. package/src/types/interface/models/reflex-alert-rule.model.ts +56 -56
  206. package/src/types/interface/models/reflex-bot-limits.model.ts +53 -53
  207. package/src/types/interface/models/reflex-code-diagnostic.model.ts +15 -0
  208. package/src/types/interface/models/reflex-code-environment.model.ts +17 -0
  209. package/src/types/interface/models/reflex-completion-webhook.model.ts +111 -111
  210. package/src/types/interface/models/reflex-consumer.model.ts +50 -50
  211. package/src/types/interface/models/reflex-definition.model.ts +31 -31
  212. package/src/types/interface/models/reflex-discord-event-log.model.ts +58 -58
  213. package/src/types/interface/models/reflex-discord-event.model.ts +79 -79
  214. package/src/types/interface/models/reflex-execution-settings.model.ts +57 -57
  215. package/src/types/interface/models/reflex-function-template.model.ts +18 -18
  216. package/src/types/interface/models/reflex-function-version.model.ts +19 -19
  217. package/src/types/interface/models/reflex-function.model.ts +30 -30
  218. package/src/types/interface/models/reflex-insights.model.ts +215 -215
  219. package/src/types/interface/models/reflex-route-contract.model.ts +46 -46
  220. package/src/types/interface/models/reflex-route.model.ts +23 -23
  221. package/src/types/interface/models/reflex-run-retention.model.ts +24 -24
  222. package/src/types/interface/models/reflex-run-settings.model.ts +39 -39
  223. package/src/types/interface/models/reflex-run.model.ts +309 -309
  224. package/src/types/interface/models/reflex-service-configuration.model.ts +22 -22
  225. package/src/types/interface/models/reflex-service-deployment.model.ts +48 -48
  226. package/src/types/interface/models/reflex-service-limits.model.ts +92 -92
  227. package/src/types/interface/models/reflex-service-template.model.ts +55 -0
  228. package/src/types/interface/models/reflex-service-version.model.ts +64 -64
  229. package/src/types/interface/models/reflex-service.model.ts +47 -47
  230. package/src/types/interface/models/reflex-step-stats.model.ts +35 -35
  231. package/src/types/interface/models/reflex-storage-surplus.model.ts +23 -23
  232. package/src/types/interface/models/reflex-task.model.ts +97 -97
package/src/index.ts CHANGED
@@ -1,480 +1,497 @@
1
- import axios from 'axios';
2
- import * as healthApi from './api/health.api';
3
- import * as functionApi from './api/function.api';
4
- import * as functionAccessApi from './api/function-access.api';
5
- import * as functionTemplateApi from './api/function-template.api';
6
- import * as functionTestApi from './api/function-test.api';
7
- import * as functionVersionApi from './api/function-version.api';
8
- import * as functionRunApi from './api/function-run.api';
9
- import * as functionSettingsApi from './api/function-settings.api';
10
- import * as serviceApi from './api/service.api';
11
- import * as serviceRouteApi from './api/service-route.api';
12
- import * as serviceVersionApi from './api/service-version.api';
13
- import * as serviceDeploymentApi from './api/service-deployment.api';
14
- import * as serviceConfigurationApi from './api/service-configuration.api';
15
- import * as serviceDiscordApi from './api/service-discord.api';
16
- import * as serviceDiscordEventApi from './api/service-discord-event.api';
17
- import * as serviceInsightsApi from './api/service-insights.api';
18
- import * as functionInsightsApi from './api/function-insights.api';
19
- import * as serviceTaskApi from './api/service-task.api';
20
- import * as applicationRunSettingsApi from './api/application-run-settings.api';
21
- import * as applicationInsightsApi from './api/application-insights.api';
22
- import * as alertRuleApi from './api/alert-rule.api';
23
- import * as routeStatsApi from './api/route-stats.api';
24
- import * as serviceConsumerApi from './api/service-consumer.api';
25
- import * as serviceOpenApiApi from './api/service-openapi.api';
26
- import * as serviceLimitsApi from './api/service-limits.api';
27
- import * as serviceCompletionWebhookApi from './api/service-completion-webhook.api';
28
- import * as storageSurplusAdminApi from './api/storage-surplus.admin.api';
29
-
30
- export * from './api';
31
- export * from './types';
32
- export * from './discord';
33
- export * from './insights';
34
-
35
- const DEFAULT_BASE_URL = 'https://reflex-api.abyss-project.fr/';
36
-
37
- /** The header of the service-to-service routes (`/storage-surplus/admin/*`): the admin token of the mesh. */
38
- export const ADMIN_TOKEN_HEADER = 'abyss-admin-token';
39
-
40
- type CoreConfig = {
41
- baseURL?: string;
42
- /** The session token of the member (`Authorization: Bearer`). Every route but `health` needs it. */
43
- token?: string;
44
- /** The admin token of the mesh (`abyss-admin-token`), for the routes abyss-main calls (`storageSurplus.admin`). */
45
- adminToken?: string;
46
- };
47
-
48
- type AbyssReflexCoreSDK = {
49
- /** `GET /health` — status of the database and Redis behind the API. */
50
- health: typeof healthApi.health;
51
- function: {
52
- list: typeof functionApi.listFunction;
53
- create: typeof functionApi.createFunction;
54
- get: typeof functionApi.getFunction;
55
- update: typeof functionApi.updateFunction;
56
- delete: typeof functionApi.deleteFunction;
57
- access: {
58
- list: typeof functionAccessApi.listFunctionAccess;
59
- grant: typeof functionAccessApi.grantFunctionAccess;
60
- revoke: typeof functionAccessApi.revokeFunctionAccess;
61
- grantAll: typeof functionAccessApi.grantAllFunctionAccess;
62
- request: typeof functionAccessApi.requestFunctionAccess;
63
- grantRequest: typeof functionAccessApi.grantFunctionAccessRequest;
64
- dismissRequest: typeof functionAccessApi.dismissFunctionAccessRequest;
65
- };
66
- test: {
67
- simulate: typeof functionTestApi.simulateFunction;
68
- dryRun: typeof functionTestApi.dryRunFunction;
69
- };
70
- version: {
71
- list: typeof functionVersionApi.listFunctionVersion;
72
- get: typeof functionVersionApi.getFunctionVersion;
73
- stepStats: typeof functionVersionApi.getFunctionVersionStepStats;
74
- open: typeof functionVersionApi.openFunctionVersion;
75
- };
76
- run: {
77
- list: typeof functionRunApi.listFunctionRun;
78
- get: typeof functionRunApi.getFunctionRun;
79
- state: typeof functionRunApi.getFunctionRunState;
80
- /** Marks a run as a favorite (never purged) or not. */
81
- favorite: typeof functionRunApi.setFunctionRunFavorite;
82
- };
83
- /** The dashboard of the function: tiles, series, ranking. */
84
- insights: {
85
- get: typeof functionInsightsApi.getFunctionInsights;
86
- };
87
- settings: {
88
- get: typeof functionSettingsApi.getFunctionSettings;
89
- setDefault: typeof functionSettingsApi.setFunctionDefaultSettings;
90
- setEnvironment: typeof functionSettingsApi.setFunctionEnvironmentSettings;
91
- removeEnvironment: typeof functionSettingsApi.removeFunctionEnvironmentSettings;
92
- };
93
- /** The log cap of the function: inherit the one of the application, none, or a number of lines. */
94
- logCap: {
95
- set: typeof functionSettingsApi.setFunctionLogCap;
96
- };
97
- /** The retention tier of the runs of the function and the number of versions kept. */
98
- runRetention: {
99
- get: typeof functionSettingsApi.getFunctionRunRetention;
100
- set: typeof functionSettingsApi.setFunctionRunRetention;
101
- };
102
- };
103
- /** Function templates of an application (`/api/function-template/:applicationId`). */
104
- functionTemplate: {
105
- list: typeof functionTemplateApi.listFunctionTemplate;
106
- create: typeof functionTemplateApi.createFunctionTemplate;
107
- update: typeof functionTemplateApi.updateFunctionTemplate;
108
- delete: typeof functionTemplateApi.deleteFunctionTemplate;
109
- };
110
- /** Applications: run settings, overview, calendar and alert rules (`/api/application/:applicationId/...`). */
111
- application: {
112
- runSettings: {
113
- get: typeof applicationRunSettingsApi.getApplicationRunSettings;
114
- set: typeof applicationRunSettingsApi.setApplicationRunSettings;
115
- };
116
- insights: {
117
- get: typeof applicationInsightsApi.getApplicationInsights;
118
- calendar: typeof applicationInsightsApi.getApplicationCalendar;
119
- };
120
- alertRule: {
121
- list: typeof alertRuleApi.listAlertRule;
122
- create: typeof alertRuleApi.createAlertRule;
123
- update: typeof alertRuleApi.updateAlertRule;
124
- delete: typeof alertRuleApi.deleteAlertRule;
125
- };
126
- };
127
- /** Services: the unit versioned, put in service and paused as one (`/api/service/:applicationId/...`). */
128
- service: {
129
- list: typeof serviceApi.listService;
130
- create: typeof serviceApi.createService;
131
- get: typeof serviceApi.getService;
132
- update: typeof serviceApi.updateService;
133
- delete: typeof serviceApi.deleteService;
134
- route: {
135
- list: typeof serviceRouteApi.listServiceRoute;
136
- create: typeof serviceRouteApi.createServiceRoute;
137
- update: typeof serviceRouteApi.updateServiceRoute;
138
- delete: typeof serviceRouteApi.deleteServiceRoute;
139
- rotate: typeof serviceRouteApi.rotateServiceRoute;
140
- };
141
- version: {
142
- list: typeof serviceVersionApi.listServiceVersion;
143
- create: typeof serviceVersionApi.createServiceVersion;
144
- get: typeof serviceVersionApi.getServiceVersion;
145
- draftStatus: typeof serviceVersionApi.getServiceVersionDraftStatus;
146
- };
147
- deployment: {
148
- list: typeof serviceDeploymentApi.listServiceDeployment;
149
- goLive: typeof serviceDeploymentApi.goLiveService;
150
- rollback: typeof serviceDeploymentApi.rollbackService;
151
- pause: typeof serviceDeploymentApi.pauseService;
152
- resume: typeof serviceDeploymentApi.resumeService;
153
- };
154
- configuration: {
155
- list: typeof serviceConfigurationApi.listServiceConfiguration;
156
- };
157
- /** The dashboards of the Service, and of the Discord events of a bot. */
158
- insights: {
159
- get: typeof serviceInsightsApi.getServiceInsights;
160
- events: typeof serviceInsightsApi.getServiceEventInsights;
161
- };
162
- /** The statistics of every route of the Service, and the dashboard of one route. */
163
- routeStats: {
164
- list: typeof routeStatsApi.getServiceRouteStats;
165
- insights: typeof routeStatsApi.getRouteInsights;
166
- };
167
- /** A Discord bot Service: its commands and components, its connection, the push to Discord. */
168
- discord: {
169
- command: {
170
- list: typeof serviceDiscordApi.listServiceDiscordCommand;
171
- create: typeof serviceDiscordApi.createServiceDiscordCommand;
172
- update: typeof serviceDiscordApi.updateServiceDiscordCommand;
173
- delete: typeof serviceDiscordApi.deleteServiceDiscordCommand;
174
- };
175
- component: {
176
- list: typeof serviceDiscordApi.listServiceDiscordComponent;
177
- create: typeof serviceDiscordApi.createServiceDiscordComponent;
178
- update: typeof serviceDiscordApi.updateServiceDiscordComponent;
179
- delete: typeof serviceDiscordApi.deleteServiceDiscordComponent;
180
- };
181
- /** The Discord event triggers of the draft (message, reaction, member arrival and departure). */
182
- event: {
183
- list: typeof serviceDiscordEventApi.listServiceDiscordEvent;
184
- create: typeof serviceDiscordEventApi.createServiceDiscordEvent;
185
- update: typeof serviceDiscordEventApi.updateServiceDiscordEvent;
186
- delete: typeof serviceDiscordEventApi.deleteServiceDiscordEvent;
187
- };
188
- /** The events of the bot in an environment: the retained ones and a sample of the dropped ones. */
189
- eventLog: {
190
- list: typeof serviceDiscordEventApi.listServiceDiscordEventLog;
191
- };
192
- connection: {
193
- get: typeof serviceDiscordApi.getServiceDiscordConnection;
194
- setTokenSecret: typeof serviceDiscordApi.setServiceDiscordTokenSecret;
195
- setEnvironment: typeof serviceDiscordApi.setServiceDiscordEnvironment;
196
- /** The lots of the reserve of events per minute the bot holds in an environment. */
197
- setAllocation: typeof serviceDiscordApi.setServiceDiscordAllocation;
198
- check: typeof serviceDiscordApi.checkServiceDiscordConnection;
199
- };
200
- /** Pushes the interactions address and the commands to Discord again. */
201
- sync: typeof serviceDiscordApi.retryServiceDiscordSync;
202
- };
203
- /** The tasks of the Service (cron and delayed runs), their delayed runs, the synchronization with Flow. */
204
- task: {
205
- list: typeof serviceTaskApi.listServiceTask;
206
- create: typeof serviceTaskApi.createServiceTask;
207
- update: typeof serviceTaskApi.updateServiceTask;
208
- delete: typeof serviceTaskApi.deleteServiceTask;
209
- testRun: typeof serviceTaskApi.testRunServiceTask;
210
- /** The history of a task in an environment: its runs of every status, those that ran nothing included. */
211
- scheduledRun: {
212
- list: typeof serviceTaskApi.listServiceTaskScheduledRun;
213
- };
214
- delayedRun: {
215
- list: typeof serviceTaskApi.listServiceDelayedRun;
216
- cancel: typeof serviceTaskApi.cancelServiceDelayedRun;
217
- };
218
- /** Synchronizes the cron tasks of the version in service with Flow again. */
219
- sync: typeof serviceTaskApi.retryServiceScheduleSync;
220
- };
221
- /** Who calls the API_KEY routes of the Service, and their keys. */
222
- consumer: {
223
- list: typeof serviceConsumerApi.listServiceConsumer;
224
- create: typeof serviceConsumerApi.createServiceConsumer;
225
- update: typeof serviceConsumerApi.updateServiceConsumer;
226
- delete: typeof serviceConsumerApi.deleteServiceConsumer;
227
- createKey: typeof serviceConsumerApi.createServiceConsumerKey;
228
- revokeKey: typeof serviceConsumerApi.revokeServiceConsumerKey;
229
- };
230
- /** The OpenAPI 3.1 document of the routes of a version or of the draft. */
231
- openapi: {
232
- get: typeof serviceOpenApiApi.getServiceOpenApi;
233
- };
234
- /** Credits, monthly spend cap, alerts and stop of the Service in each environment, whatever its type. */
235
- limits: {
236
- list: typeof serviceLimitsApi.listServiceLimits;
237
- set: typeof serviceLimitsApi.setServiceLimits;
238
- };
239
- /** The signing secrets of the completion webhook of the async executions. */
240
- completionWebhook: {
241
- get: typeof serviceCompletionWebhookApi.getServiceCompletionWebhook;
242
- rotateSecret: typeof serviceCompletionWebhookApi.rotateServiceCompletionWebhookSecret;
243
- };
244
- };
245
- /**
246
- * The day-90 contract of abyss-main's storage surplus, service-to-service (admin token). AbyssReflex has nothing to
247
- * archive for the ONLINE surplus: `listArchivable` is always empty; the archives of the runs are listed and deleted.
248
- */
249
- storageSurplus: {
250
- admin: {
251
- listArchivable: typeof storageSurplusAdminApi.listArchivableStorageSurplusAdmin;
252
- archive: typeof storageSurplusAdminApi.archiveStorageSurplusAdmin;
253
- listArchives: typeof storageSurplusAdminApi.listArchivesStorageSurplusAdmin;
254
- deleteArchives: typeof storageSurplusAdminApi.deleteArchivesStorageSurplusAdmin;
255
- };
256
- };
257
- };
258
-
259
- export class AbyssReflexCore {
260
- private static config: CoreConfig = {
261
- baseURL: DEFAULT_BASE_URL,
262
- };
263
- static axios = axios.create({
264
- baseURL: DEFAULT_BASE_URL,
265
- });
266
-
267
- private static _sdk: AbyssReflexCoreSDK | null = null;
268
-
269
- public static get sdk(): AbyssReflexCoreSDK {
270
- if (!AbyssReflexCore._sdk) {
271
- AbyssReflexCore._sdk = {
272
- health: healthApi.health,
273
- function: {
274
- list: functionApi.listFunction,
275
- create: functionApi.createFunction,
276
- get: functionApi.getFunction,
277
- update: functionApi.updateFunction,
278
- delete: functionApi.deleteFunction,
279
- access: {
280
- list: functionAccessApi.listFunctionAccess,
281
- grant: functionAccessApi.grantFunctionAccess,
282
- revoke: functionAccessApi.revokeFunctionAccess,
283
- grantAll: functionAccessApi.grantAllFunctionAccess,
284
- request: functionAccessApi.requestFunctionAccess,
285
- grantRequest: functionAccessApi.grantFunctionAccessRequest,
286
- dismissRequest: functionAccessApi.dismissFunctionAccessRequest,
287
- },
288
- test: {
289
- simulate: functionTestApi.simulateFunction,
290
- dryRun: functionTestApi.dryRunFunction,
291
- },
292
- version: {
293
- list: functionVersionApi.listFunctionVersion,
294
- get: functionVersionApi.getFunctionVersion,
295
- stepStats: functionVersionApi.getFunctionVersionStepStats,
296
- open: functionVersionApi.openFunctionVersion,
297
- },
298
- run: {
299
- list: functionRunApi.listFunctionRun,
300
- get: functionRunApi.getFunctionRun,
301
- state: functionRunApi.getFunctionRunState,
302
- favorite: functionRunApi.setFunctionRunFavorite,
303
- },
304
- insights: {
305
- get: functionInsightsApi.getFunctionInsights,
306
- },
307
- settings: {
308
- get: functionSettingsApi.getFunctionSettings,
309
- setDefault: functionSettingsApi.setFunctionDefaultSettings,
310
- setEnvironment: functionSettingsApi.setFunctionEnvironmentSettings,
311
- removeEnvironment: functionSettingsApi.removeFunctionEnvironmentSettings,
312
- },
313
- logCap: {
314
- set: functionSettingsApi.setFunctionLogCap,
315
- },
316
- runRetention: {
317
- get: functionSettingsApi.getFunctionRunRetention,
318
- set: functionSettingsApi.setFunctionRunRetention,
319
- },
320
- },
321
- functionTemplate: {
322
- list: functionTemplateApi.listFunctionTemplate,
323
- create: functionTemplateApi.createFunctionTemplate,
324
- update: functionTemplateApi.updateFunctionTemplate,
325
- delete: functionTemplateApi.deleteFunctionTemplate,
326
- },
327
- application: {
328
- runSettings: {
329
- get: applicationRunSettingsApi.getApplicationRunSettings,
330
- set: applicationRunSettingsApi.setApplicationRunSettings,
331
- },
332
- insights: {
333
- get: applicationInsightsApi.getApplicationInsights,
334
- calendar: applicationInsightsApi.getApplicationCalendar,
335
- },
336
- alertRule: {
337
- list: alertRuleApi.listAlertRule,
338
- create: alertRuleApi.createAlertRule,
339
- update: alertRuleApi.updateAlertRule,
340
- delete: alertRuleApi.deleteAlertRule,
341
- },
342
- },
343
- service: {
344
- list: serviceApi.listService,
345
- create: serviceApi.createService,
346
- get: serviceApi.getService,
347
- update: serviceApi.updateService,
348
- delete: serviceApi.deleteService,
349
- route: {
350
- list: serviceRouteApi.listServiceRoute,
351
- create: serviceRouteApi.createServiceRoute,
352
- update: serviceRouteApi.updateServiceRoute,
353
- delete: serviceRouteApi.deleteServiceRoute,
354
- rotate: serviceRouteApi.rotateServiceRoute,
355
- },
356
- version: {
357
- list: serviceVersionApi.listServiceVersion,
358
- create: serviceVersionApi.createServiceVersion,
359
- get: serviceVersionApi.getServiceVersion,
360
- draftStatus: serviceVersionApi.getServiceVersionDraftStatus,
361
- },
362
- deployment: {
363
- list: serviceDeploymentApi.listServiceDeployment,
364
- goLive: serviceDeploymentApi.goLiveService,
365
- rollback: serviceDeploymentApi.rollbackService,
366
- pause: serviceDeploymentApi.pauseService,
367
- resume: serviceDeploymentApi.resumeService,
368
- },
369
- configuration: {
370
- list: serviceConfigurationApi.listServiceConfiguration,
371
- },
372
- insights: {
373
- get: serviceInsightsApi.getServiceInsights,
374
- events: serviceInsightsApi.getServiceEventInsights,
375
- },
376
- routeStats: {
377
- list: routeStatsApi.getServiceRouteStats,
378
- insights: routeStatsApi.getRouteInsights,
379
- },
380
- discord: {
381
- command: {
382
- list: serviceDiscordApi.listServiceDiscordCommand,
383
- create: serviceDiscordApi.createServiceDiscordCommand,
384
- update: serviceDiscordApi.updateServiceDiscordCommand,
385
- delete: serviceDiscordApi.deleteServiceDiscordCommand,
386
- },
387
- component: {
388
- list: serviceDiscordApi.listServiceDiscordComponent,
389
- create: serviceDiscordApi.createServiceDiscordComponent,
390
- update: serviceDiscordApi.updateServiceDiscordComponent,
391
- delete: serviceDiscordApi.deleteServiceDiscordComponent,
392
- },
393
- event: {
394
- list: serviceDiscordEventApi.listServiceDiscordEvent,
395
- create: serviceDiscordEventApi.createServiceDiscordEvent,
396
- update: serviceDiscordEventApi.updateServiceDiscordEvent,
397
- delete: serviceDiscordEventApi.deleteServiceDiscordEvent,
398
- },
399
- eventLog: {
400
- list: serviceDiscordEventApi.listServiceDiscordEventLog,
401
- },
402
- connection: {
403
- get: serviceDiscordApi.getServiceDiscordConnection,
404
- setTokenSecret: serviceDiscordApi.setServiceDiscordTokenSecret,
405
- setEnvironment: serviceDiscordApi.setServiceDiscordEnvironment,
406
- setAllocation: serviceDiscordApi.setServiceDiscordAllocation,
407
- check: serviceDiscordApi.checkServiceDiscordConnection,
408
- },
409
- sync: serviceDiscordApi.retryServiceDiscordSync,
410
- },
411
- task: {
412
- list: serviceTaskApi.listServiceTask,
413
- create: serviceTaskApi.createServiceTask,
414
- update: serviceTaskApi.updateServiceTask,
415
- delete: serviceTaskApi.deleteServiceTask,
416
- testRun: serviceTaskApi.testRunServiceTask,
417
- scheduledRun: {
418
- list: serviceTaskApi.listServiceTaskScheduledRun,
419
- },
420
- delayedRun: {
421
- list: serviceTaskApi.listServiceDelayedRun,
422
- cancel: serviceTaskApi.cancelServiceDelayedRun,
423
- },
424
- sync: serviceTaskApi.retryServiceScheduleSync,
425
- },
426
- consumer: {
427
- list: serviceConsumerApi.listServiceConsumer,
428
- create: serviceConsumerApi.createServiceConsumer,
429
- update: serviceConsumerApi.updateServiceConsumer,
430
- delete: serviceConsumerApi.deleteServiceConsumer,
431
- createKey: serviceConsumerApi.createServiceConsumerKey,
432
- revokeKey: serviceConsumerApi.revokeServiceConsumerKey,
433
- },
434
- openapi: {
435
- get: serviceOpenApiApi.getServiceOpenApi,
436
- },
437
- limits: {
438
- list: serviceLimitsApi.listServiceLimits,
439
- set: serviceLimitsApi.setServiceLimits,
440
- },
441
- completionWebhook: {
442
- get: serviceCompletionWebhookApi.getServiceCompletionWebhook,
443
- rotateSecret: serviceCompletionWebhookApi.rotateServiceCompletionWebhookSecret,
444
- },
445
- },
446
- storageSurplus: {
447
- admin: {
448
- listArchivable: storageSurplusAdminApi.listArchivableStorageSurplusAdmin,
449
- archive: storageSurplusAdminApi.archiveStorageSurplusAdmin,
450
- listArchives: storageSurplusAdminApi.listArchivesStorageSurplusAdmin,
451
- deleteArchives: storageSurplusAdminApi.deleteArchivesStorageSurplusAdmin,
452
- },
453
- },
454
- };
455
- }
456
- return AbyssReflexCore._sdk;
457
- }
458
-
459
- public static setConfig(config: CoreConfig): void {
460
- AbyssReflexCore._sdk = null;
461
-
462
- AbyssReflexCore.config = { ...AbyssReflexCore.config, ...config };
463
-
464
- if (config.baseURL) {
465
- AbyssReflexCore.axios.defaults.baseURL = config.baseURL;
466
- }
467
-
468
- if (config.token) {
469
- AbyssReflexCore.axios.defaults.headers.common.Authorization = `Bearer ${config.token}`;
470
- }
471
-
472
- if (config.adminToken) {
473
- AbyssReflexCore.axios.defaults.headers.common[ADMIN_TOKEN_HEADER] = config.adminToken;
474
- }
475
- }
476
-
477
- public static getConfig(): CoreConfig {
478
- return AbyssReflexCore.config;
479
- }
480
- }
1
+ import axios from 'axios';
2
+ import * as healthApi from './api/health.api';
3
+ import * as functionApi from './api/function.api';
4
+ import * as functionAccessApi from './api/function-access.api';
5
+ import * as functionTemplateApi from './api/function-template.api';
6
+ import * as functionTestApi from './api/function-test.api';
7
+ import * as functionVersionApi from './api/function-version.api';
8
+ import * as functionRunApi from './api/function-run.api';
9
+ import * as functionSettingsApi from './api/function-settings.api';
10
+ import * as serviceApi from './api/service.api';
11
+ import * as serviceTemplateApi from './api/service-template.api';
12
+ import * as serviceRouteApi from './api/service-route.api';
13
+ import * as serviceVersionApi from './api/service-version.api';
14
+ import * as serviceDeploymentApi from './api/service-deployment.api';
15
+ import * as serviceConfigurationApi from './api/service-configuration.api';
16
+ import * as serviceDiscordApi from './api/service-discord.api';
17
+ import * as serviceDiscordEventApi from './api/service-discord-event.api';
18
+ import * as serviceInsightsApi from './api/service-insights.api';
19
+ import * as functionInsightsApi from './api/function-insights.api';
20
+ import * as serviceTaskApi from './api/service-task.api';
21
+ import * as applicationRunSettingsApi from './api/application-run-settings.api';
22
+ import * as applicationInsightsApi from './api/application-insights.api';
23
+ import * as alertRuleApi from './api/alert-rule.api';
24
+ import * as routeStatsApi from './api/route-stats.api';
25
+ import * as serviceConsumerApi from './api/service-consumer.api';
26
+ import * as serviceOpenApiApi from './api/service-openapi.api';
27
+ import * as serviceLimitsApi from './api/service-limits.api';
28
+ import * as serviceCompletionWebhookApi from './api/service-completion-webhook.api';
29
+ import * as codeEnvironmentApi from './api/code-environment.api';
30
+ import * as storageSurplusAdminApi from './api/storage-surplus.admin.api';
31
+
32
+ export * from './api';
33
+ export * from './types';
34
+ export * from './discord';
35
+ export * from './insights';
36
+ export * from './code';
37
+
38
+ const DEFAULT_BASE_URL = 'https://reflex-api.abyss-project.fr/';
39
+
40
+ /** The header of the service-to-service routes (`/storage-surplus/admin/*`): the admin token of the mesh. */
41
+ export const ADMIN_TOKEN_HEADER = 'abyss-admin-token';
42
+
43
+ type CoreConfig = {
44
+ baseURL?: string;
45
+ /** The session token of the member (`Authorization: Bearer`). Every route but `health` needs it. */
46
+ token?: string;
47
+ /** The admin token of the mesh (`abyss-admin-token`), for the routes abyss-main calls (`storageSurplus.admin`). */
48
+ adminToken?: string;
49
+ };
50
+
51
+ type AbyssReflexCoreSDK = {
52
+ /** `GET /health` — status of the database and Redis behind the API. */
53
+ health: typeof healthApi.health;
54
+ function: {
55
+ list: typeof functionApi.listFunction;
56
+ create: typeof functionApi.createFunction;
57
+ get: typeof functionApi.getFunction;
58
+ update: typeof functionApi.updateFunction;
59
+ delete: typeof functionApi.deleteFunction;
60
+ access: {
61
+ list: typeof functionAccessApi.listFunctionAccess;
62
+ grant: typeof functionAccessApi.grantFunctionAccess;
63
+ revoke: typeof functionAccessApi.revokeFunctionAccess;
64
+ grantAll: typeof functionAccessApi.grantAllFunctionAccess;
65
+ request: typeof functionAccessApi.requestFunctionAccess;
66
+ grantRequest: typeof functionAccessApi.grantFunctionAccessRequest;
67
+ dismissRequest: typeof functionAccessApi.dismissFunctionAccessRequest;
68
+ };
69
+ test: {
70
+ simulate: typeof functionTestApi.simulateFunction;
71
+ dryRun: typeof functionTestApi.dryRunFunction;
72
+ };
73
+ version: {
74
+ list: typeof functionVersionApi.listFunctionVersion;
75
+ get: typeof functionVersionApi.getFunctionVersion;
76
+ stepStats: typeof functionVersionApi.getFunctionVersionStepStats;
77
+ open: typeof functionVersionApi.openFunctionVersion;
78
+ };
79
+ run: {
80
+ list: typeof functionRunApi.listFunctionRun;
81
+ get: typeof functionRunApi.getFunctionRun;
82
+ state: typeof functionRunApi.getFunctionRunState;
83
+ /** Marks a run as a favorite (never purged) or not. */
84
+ favorite: typeof functionRunApi.setFunctionRunFavorite;
85
+ };
86
+ /** The dashboard of the function: tiles, series, ranking. */
87
+ insights: {
88
+ get: typeof functionInsightsApi.getFunctionInsights;
89
+ };
90
+ settings: {
91
+ get: typeof functionSettingsApi.getFunctionSettings;
92
+ setDefault: typeof functionSettingsApi.setFunctionDefaultSettings;
93
+ setEnvironment: typeof functionSettingsApi.setFunctionEnvironmentSettings;
94
+ removeEnvironment: typeof functionSettingsApi.removeFunctionEnvironmentSettings;
95
+ };
96
+ /** The log cap of the function: inherit the one of the application, none, or a number of lines. */
97
+ logCap: {
98
+ set: typeof functionSettingsApi.setFunctionLogCap;
99
+ };
100
+ /** The retention tier of the runs of the function and the number of versions kept. */
101
+ runRetention: {
102
+ get: typeof functionSettingsApi.getFunctionRunRetention;
103
+ set: typeof functionSettingsApi.setFunctionRunRetention;
104
+ };
105
+ };
106
+ /** Function templates of an application (`/api/function-template/:applicationId`). */
107
+ functionTemplate: {
108
+ list: typeof functionTemplateApi.listFunctionTemplate;
109
+ create: typeof functionTemplateApi.createFunctionTemplate;
110
+ update: typeof functionTemplateApi.updateFunctionTemplate;
111
+ delete: typeof functionTemplateApi.deleteFunctionTemplate;
112
+ };
113
+ /** Starter templates of a Service (`/api/service-template/:applicationId`). */
114
+ serviceTemplate: {
115
+ list: typeof serviceTemplateApi.listServiceTemplate;
116
+ };
117
+ /** The libraries and declarations a TypeScript CODE step is checked against (`/api/code-environment/:applicationId`). */
118
+ codeEnvironment: {
119
+ get: typeof codeEnvironmentApi.getCodeEnvironment;
120
+ };
121
+ /** Applications: run settings, overview, calendar and alert rules (`/api/application/:applicationId/...`). */
122
+ application: {
123
+ runSettings: {
124
+ get: typeof applicationRunSettingsApi.getApplicationRunSettings;
125
+ set: typeof applicationRunSettingsApi.setApplicationRunSettings;
126
+ };
127
+ insights: {
128
+ get: typeof applicationInsightsApi.getApplicationInsights;
129
+ calendar: typeof applicationInsightsApi.getApplicationCalendar;
130
+ };
131
+ alertRule: {
132
+ list: typeof alertRuleApi.listAlertRule;
133
+ create: typeof alertRuleApi.createAlertRule;
134
+ update: typeof alertRuleApi.updateAlertRule;
135
+ delete: typeof alertRuleApi.deleteAlertRule;
136
+ };
137
+ };
138
+ /** Services: the unit versioned, put in service and paused as one (`/api/service/:applicationId/...`). */
139
+ service: {
140
+ list: typeof serviceApi.listService;
141
+ create: typeof serviceApi.createService;
142
+ get: typeof serviceApi.getService;
143
+ update: typeof serviceApi.updateService;
144
+ delete: typeof serviceApi.deleteService;
145
+ route: {
146
+ list: typeof serviceRouteApi.listServiceRoute;
147
+ create: typeof serviceRouteApi.createServiceRoute;
148
+ update: typeof serviceRouteApi.updateServiceRoute;
149
+ delete: typeof serviceRouteApi.deleteServiceRoute;
150
+ rotate: typeof serviceRouteApi.rotateServiceRoute;
151
+ };
152
+ version: {
153
+ list: typeof serviceVersionApi.listServiceVersion;
154
+ create: typeof serviceVersionApi.createServiceVersion;
155
+ get: typeof serviceVersionApi.getServiceVersion;
156
+ draftStatus: typeof serviceVersionApi.getServiceVersionDraftStatus;
157
+ };
158
+ deployment: {
159
+ list: typeof serviceDeploymentApi.listServiceDeployment;
160
+ goLive: typeof serviceDeploymentApi.goLiveService;
161
+ rollback: typeof serviceDeploymentApi.rollbackService;
162
+ pause: typeof serviceDeploymentApi.pauseService;
163
+ resume: typeof serviceDeploymentApi.resumeService;
164
+ };
165
+ configuration: {
166
+ list: typeof serviceConfigurationApi.listServiceConfiguration;
167
+ };
168
+ /** The dashboards of the Service, and of the Discord events of a bot. */
169
+ insights: {
170
+ get: typeof serviceInsightsApi.getServiceInsights;
171
+ events: typeof serviceInsightsApi.getServiceEventInsights;
172
+ };
173
+ /** The statistics of every route of the Service, and the dashboard of one route. */
174
+ routeStats: {
175
+ list: typeof routeStatsApi.getServiceRouteStats;
176
+ insights: typeof routeStatsApi.getRouteInsights;
177
+ };
178
+ /** A Discord bot Service: its commands and components, its connection, the push to Discord. */
179
+ discord: {
180
+ command: {
181
+ list: typeof serviceDiscordApi.listServiceDiscordCommand;
182
+ create: typeof serviceDiscordApi.createServiceDiscordCommand;
183
+ update: typeof serviceDiscordApi.updateServiceDiscordCommand;
184
+ delete: typeof serviceDiscordApi.deleteServiceDiscordCommand;
185
+ };
186
+ component: {
187
+ list: typeof serviceDiscordApi.listServiceDiscordComponent;
188
+ create: typeof serviceDiscordApi.createServiceDiscordComponent;
189
+ update: typeof serviceDiscordApi.updateServiceDiscordComponent;
190
+ delete: typeof serviceDiscordApi.deleteServiceDiscordComponent;
191
+ };
192
+ /** The Discord event triggers of the draft (message, reaction, member arrival and departure). */
193
+ event: {
194
+ list: typeof serviceDiscordEventApi.listServiceDiscordEvent;
195
+ create: typeof serviceDiscordEventApi.createServiceDiscordEvent;
196
+ update: typeof serviceDiscordEventApi.updateServiceDiscordEvent;
197
+ delete: typeof serviceDiscordEventApi.deleteServiceDiscordEvent;
198
+ };
199
+ /** The events of the bot in an environment: the retained ones and a sample of the dropped ones. */
200
+ eventLog: {
201
+ list: typeof serviceDiscordEventApi.listServiceDiscordEventLog;
202
+ };
203
+ connection: {
204
+ get: typeof serviceDiscordApi.getServiceDiscordConnection;
205
+ setTokenSecret: typeof serviceDiscordApi.setServiceDiscordTokenSecret;
206
+ setEnvironment: typeof serviceDiscordApi.setServiceDiscordEnvironment;
207
+ /** The lots of the reserve of events per minute the bot holds in an environment. */
208
+ setAllocation: typeof serviceDiscordApi.setServiceDiscordAllocation;
209
+ check: typeof serviceDiscordApi.checkServiceDiscordConnection;
210
+ };
211
+ /** Pushes the interactions address and the commands to Discord again. */
212
+ sync: typeof serviceDiscordApi.retryServiceDiscordSync;
213
+ };
214
+ /** The tasks of the Service (cron and delayed runs), their delayed runs, the synchronization with Flow. */
215
+ task: {
216
+ list: typeof serviceTaskApi.listServiceTask;
217
+ create: typeof serviceTaskApi.createServiceTask;
218
+ update: typeof serviceTaskApi.updateServiceTask;
219
+ delete: typeof serviceTaskApi.deleteServiceTask;
220
+ testRun: typeof serviceTaskApi.testRunServiceTask;
221
+ /** The history of a task in an environment: its runs of every status, those that ran nothing included. */
222
+ scheduledRun: {
223
+ list: typeof serviceTaskApi.listServiceTaskScheduledRun;
224
+ };
225
+ delayedRun: {
226
+ list: typeof serviceTaskApi.listServiceDelayedRun;
227
+ cancel: typeof serviceTaskApi.cancelServiceDelayedRun;
228
+ };
229
+ /** Synchronizes the cron tasks of the version in service with Flow again. */
230
+ sync: typeof serviceTaskApi.retryServiceScheduleSync;
231
+ };
232
+ /** Who calls the API_KEY routes of the Service, and their keys. */
233
+ consumer: {
234
+ list: typeof serviceConsumerApi.listServiceConsumer;
235
+ create: typeof serviceConsumerApi.createServiceConsumer;
236
+ update: typeof serviceConsumerApi.updateServiceConsumer;
237
+ delete: typeof serviceConsumerApi.deleteServiceConsumer;
238
+ createKey: typeof serviceConsumerApi.createServiceConsumerKey;
239
+ revokeKey: typeof serviceConsumerApi.revokeServiceConsumerKey;
240
+ };
241
+ /** The OpenAPI 3.1 document of the routes of a version or of the draft. */
242
+ openapi: {
243
+ get: typeof serviceOpenApiApi.getServiceOpenApi;
244
+ };
245
+ /** Credits, monthly spend cap, alerts and stop of the Service in each environment, whatever its type. */
246
+ limits: {
247
+ list: typeof serviceLimitsApi.listServiceLimits;
248
+ set: typeof serviceLimitsApi.setServiceLimits;
249
+ };
250
+ /** The signing secrets of the completion webhook of the async executions. */
251
+ completionWebhook: {
252
+ get: typeof serviceCompletionWebhookApi.getServiceCompletionWebhook;
253
+ rotateSecret: typeof serviceCompletionWebhookApi.rotateServiceCompletionWebhookSecret;
254
+ };
255
+ };
256
+ /**
257
+ * The day-90 contract of abyss-main's storage surplus, service-to-service (admin token). AbyssReflex has nothing to
258
+ * archive for the ONLINE surplus: `listArchivable` is always empty; the archives of the runs are listed and deleted.
259
+ */
260
+ storageSurplus: {
261
+ admin: {
262
+ listArchivable: typeof storageSurplusAdminApi.listArchivableStorageSurplusAdmin;
263
+ archive: typeof storageSurplusAdminApi.archiveStorageSurplusAdmin;
264
+ listArchives: typeof storageSurplusAdminApi.listArchivesStorageSurplusAdmin;
265
+ deleteArchives: typeof storageSurplusAdminApi.deleteArchivesStorageSurplusAdmin;
266
+ };
267
+ };
268
+ };
269
+
270
+ export class AbyssReflexCore {
271
+ private static config: CoreConfig = {
272
+ baseURL: DEFAULT_BASE_URL,
273
+ };
274
+ static axios = axios.create({
275
+ baseURL: DEFAULT_BASE_URL,
276
+ });
277
+
278
+ private static _sdk: AbyssReflexCoreSDK | null = null;
279
+
280
+ public static get sdk(): AbyssReflexCoreSDK {
281
+ if (!AbyssReflexCore._sdk) {
282
+ AbyssReflexCore._sdk = {
283
+ health: healthApi.health,
284
+ function: {
285
+ list: functionApi.listFunction,
286
+ create: functionApi.createFunction,
287
+ get: functionApi.getFunction,
288
+ update: functionApi.updateFunction,
289
+ delete: functionApi.deleteFunction,
290
+ access: {
291
+ list: functionAccessApi.listFunctionAccess,
292
+ grant: functionAccessApi.grantFunctionAccess,
293
+ revoke: functionAccessApi.revokeFunctionAccess,
294
+ grantAll: functionAccessApi.grantAllFunctionAccess,
295
+ request: functionAccessApi.requestFunctionAccess,
296
+ grantRequest: functionAccessApi.grantFunctionAccessRequest,
297
+ dismissRequest: functionAccessApi.dismissFunctionAccessRequest,
298
+ },
299
+ test: {
300
+ simulate: functionTestApi.simulateFunction,
301
+ dryRun: functionTestApi.dryRunFunction,
302
+ },
303
+ version: {
304
+ list: functionVersionApi.listFunctionVersion,
305
+ get: functionVersionApi.getFunctionVersion,
306
+ stepStats: functionVersionApi.getFunctionVersionStepStats,
307
+ open: functionVersionApi.openFunctionVersion,
308
+ },
309
+ run: {
310
+ list: functionRunApi.listFunctionRun,
311
+ get: functionRunApi.getFunctionRun,
312
+ state: functionRunApi.getFunctionRunState,
313
+ favorite: functionRunApi.setFunctionRunFavorite,
314
+ },
315
+ insights: {
316
+ get: functionInsightsApi.getFunctionInsights,
317
+ },
318
+ settings: {
319
+ get: functionSettingsApi.getFunctionSettings,
320
+ setDefault: functionSettingsApi.setFunctionDefaultSettings,
321
+ setEnvironment: functionSettingsApi.setFunctionEnvironmentSettings,
322
+ removeEnvironment: functionSettingsApi.removeFunctionEnvironmentSettings,
323
+ },
324
+ logCap: {
325
+ set: functionSettingsApi.setFunctionLogCap,
326
+ },
327
+ runRetention: {
328
+ get: functionSettingsApi.getFunctionRunRetention,
329
+ set: functionSettingsApi.setFunctionRunRetention,
330
+ },
331
+ },
332
+ functionTemplate: {
333
+ list: functionTemplateApi.listFunctionTemplate,
334
+ create: functionTemplateApi.createFunctionTemplate,
335
+ update: functionTemplateApi.updateFunctionTemplate,
336
+ delete: functionTemplateApi.deleteFunctionTemplate,
337
+ },
338
+ serviceTemplate: {
339
+ list: serviceTemplateApi.listServiceTemplate,
340
+ },
341
+ codeEnvironment: {
342
+ get: codeEnvironmentApi.getCodeEnvironment,
343
+ },
344
+ application: {
345
+ runSettings: {
346
+ get: applicationRunSettingsApi.getApplicationRunSettings,
347
+ set: applicationRunSettingsApi.setApplicationRunSettings,
348
+ },
349
+ insights: {
350
+ get: applicationInsightsApi.getApplicationInsights,
351
+ calendar: applicationInsightsApi.getApplicationCalendar,
352
+ },
353
+ alertRule: {
354
+ list: alertRuleApi.listAlertRule,
355
+ create: alertRuleApi.createAlertRule,
356
+ update: alertRuleApi.updateAlertRule,
357
+ delete: alertRuleApi.deleteAlertRule,
358
+ },
359
+ },
360
+ service: {
361
+ list: serviceApi.listService,
362
+ create: serviceApi.createService,
363
+ get: serviceApi.getService,
364
+ update: serviceApi.updateService,
365
+ delete: serviceApi.deleteService,
366
+ route: {
367
+ list: serviceRouteApi.listServiceRoute,
368
+ create: serviceRouteApi.createServiceRoute,
369
+ update: serviceRouteApi.updateServiceRoute,
370
+ delete: serviceRouteApi.deleteServiceRoute,
371
+ rotate: serviceRouteApi.rotateServiceRoute,
372
+ },
373
+ version: {
374
+ list: serviceVersionApi.listServiceVersion,
375
+ create: serviceVersionApi.createServiceVersion,
376
+ get: serviceVersionApi.getServiceVersion,
377
+ draftStatus: serviceVersionApi.getServiceVersionDraftStatus,
378
+ },
379
+ deployment: {
380
+ list: serviceDeploymentApi.listServiceDeployment,
381
+ goLive: serviceDeploymentApi.goLiveService,
382
+ rollback: serviceDeploymentApi.rollbackService,
383
+ pause: serviceDeploymentApi.pauseService,
384
+ resume: serviceDeploymentApi.resumeService,
385
+ },
386
+ configuration: {
387
+ list: serviceConfigurationApi.listServiceConfiguration,
388
+ },
389
+ insights: {
390
+ get: serviceInsightsApi.getServiceInsights,
391
+ events: serviceInsightsApi.getServiceEventInsights,
392
+ },
393
+ routeStats: {
394
+ list: routeStatsApi.getServiceRouteStats,
395
+ insights: routeStatsApi.getRouteInsights,
396
+ },
397
+ discord: {
398
+ command: {
399
+ list: serviceDiscordApi.listServiceDiscordCommand,
400
+ create: serviceDiscordApi.createServiceDiscordCommand,
401
+ update: serviceDiscordApi.updateServiceDiscordCommand,
402
+ delete: serviceDiscordApi.deleteServiceDiscordCommand,
403
+ },
404
+ component: {
405
+ list: serviceDiscordApi.listServiceDiscordComponent,
406
+ create: serviceDiscordApi.createServiceDiscordComponent,
407
+ update: serviceDiscordApi.updateServiceDiscordComponent,
408
+ delete: serviceDiscordApi.deleteServiceDiscordComponent,
409
+ },
410
+ event: {
411
+ list: serviceDiscordEventApi.listServiceDiscordEvent,
412
+ create: serviceDiscordEventApi.createServiceDiscordEvent,
413
+ update: serviceDiscordEventApi.updateServiceDiscordEvent,
414
+ delete: serviceDiscordEventApi.deleteServiceDiscordEvent,
415
+ },
416
+ eventLog: {
417
+ list: serviceDiscordEventApi.listServiceDiscordEventLog,
418
+ },
419
+ connection: {
420
+ get: serviceDiscordApi.getServiceDiscordConnection,
421
+ setTokenSecret: serviceDiscordApi.setServiceDiscordTokenSecret,
422
+ setEnvironment: serviceDiscordApi.setServiceDiscordEnvironment,
423
+ setAllocation: serviceDiscordApi.setServiceDiscordAllocation,
424
+ check: serviceDiscordApi.checkServiceDiscordConnection,
425
+ },
426
+ sync: serviceDiscordApi.retryServiceDiscordSync,
427
+ },
428
+ task: {
429
+ list: serviceTaskApi.listServiceTask,
430
+ create: serviceTaskApi.createServiceTask,
431
+ update: serviceTaskApi.updateServiceTask,
432
+ delete: serviceTaskApi.deleteServiceTask,
433
+ testRun: serviceTaskApi.testRunServiceTask,
434
+ scheduledRun: {
435
+ list: serviceTaskApi.listServiceTaskScheduledRun,
436
+ },
437
+ delayedRun: {
438
+ list: serviceTaskApi.listServiceDelayedRun,
439
+ cancel: serviceTaskApi.cancelServiceDelayedRun,
440
+ },
441
+ sync: serviceTaskApi.retryServiceScheduleSync,
442
+ },
443
+ consumer: {
444
+ list: serviceConsumerApi.listServiceConsumer,
445
+ create: serviceConsumerApi.createServiceConsumer,
446
+ update: serviceConsumerApi.updateServiceConsumer,
447
+ delete: serviceConsumerApi.deleteServiceConsumer,
448
+ createKey: serviceConsumerApi.createServiceConsumerKey,
449
+ revokeKey: serviceConsumerApi.revokeServiceConsumerKey,
450
+ },
451
+ openapi: {
452
+ get: serviceOpenApiApi.getServiceOpenApi,
453
+ },
454
+ limits: {
455
+ list: serviceLimitsApi.listServiceLimits,
456
+ set: serviceLimitsApi.setServiceLimits,
457
+ },
458
+ completionWebhook: {
459
+ get: serviceCompletionWebhookApi.getServiceCompletionWebhook,
460
+ rotateSecret: serviceCompletionWebhookApi.rotateServiceCompletionWebhookSecret,
461
+ },
462
+ },
463
+ storageSurplus: {
464
+ admin: {
465
+ listArchivable: storageSurplusAdminApi.listArchivableStorageSurplusAdmin,
466
+ archive: storageSurplusAdminApi.archiveStorageSurplusAdmin,
467
+ listArchives: storageSurplusAdminApi.listArchivesStorageSurplusAdmin,
468
+ deleteArchives: storageSurplusAdminApi.deleteArchivesStorageSurplusAdmin,
469
+ },
470
+ },
471
+ };
472
+ }
473
+ return AbyssReflexCore._sdk;
474
+ }
475
+
476
+ public static setConfig(config: CoreConfig): void {
477
+ AbyssReflexCore._sdk = null;
478
+
479
+ AbyssReflexCore.config = { ...AbyssReflexCore.config, ...config };
480
+
481
+ if (config.baseURL) {
482
+ AbyssReflexCore.axios.defaults.baseURL = config.baseURL;
483
+ }
484
+
485
+ if (config.token) {
486
+ AbyssReflexCore.axios.defaults.headers.common.Authorization = `Bearer ${config.token}`;
487
+ }
488
+
489
+ if (config.adminToken) {
490
+ AbyssReflexCore.axios.defaults.headers.common[ADMIN_TOKEN_HEADER] = config.adminToken;
491
+ }
492
+ }
493
+
494
+ public static getConfig(): CoreConfig {
495
+ return AbyssReflexCore.config;
496
+ }
497
+ }