@abyss-project/reflex 4.0.0 → 5.1.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 (142) hide show
  1. package/dist/api/index.d.ts +1 -0
  2. package/dist/api/index.js +1 -0
  3. package/dist/api/index.js.map +1 -1
  4. package/dist/api/service-discord.api.d.ts +14 -0
  5. package/dist/api/service-discord.api.js +38 -0
  6. package/dist/api/service-discord.api.js.map +1 -0
  7. package/dist/index.d.ts +22 -0
  8. package/dist/index.js +22 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/types/enum/discord-activity-type.enum.d.ts +7 -0
  11. package/dist/types/enum/discord-activity-type.enum.js +12 -0
  12. package/dist/types/enum/discord-activity-type.enum.js.map +1 -0
  13. package/dist/types/enum/discord-component-kind.enum.d.ts +4 -0
  14. package/dist/types/enum/discord-component-kind.enum.js +9 -0
  15. package/dist/types/enum/discord-component-kind.enum.js.map +1 -0
  16. package/dist/types/enum/discord-gateway-failure-code.enum.d.ts +5 -0
  17. package/dist/types/enum/discord-gateway-failure-code.enum.js +10 -0
  18. package/dist/types/enum/discord-gateway-failure-code.enum.js.map +1 -0
  19. package/dist/types/enum/discord-gateway-state.enum.d.ts +6 -0
  20. package/dist/types/enum/discord-gateway-state.enum.js +11 -0
  21. package/dist/types/enum/discord-gateway-state.enum.js.map +1 -0
  22. package/dist/types/enum/discord-option-type.enum.d.ts +11 -0
  23. package/dist/types/enum/discord-option-type.enum.js +16 -0
  24. package/dist/types/enum/discord-option-type.enum.js.map +1 -0
  25. package/dist/types/enum/discord-presence-status.enum.d.ts +5 -0
  26. package/dist/types/enum/discord-presence-status.enum.js +10 -0
  27. package/dist/types/enum/discord-presence-status.enum.js.map +1 -0
  28. package/dist/types/enum/discord-sync-status.enum.d.ts +5 -0
  29. package/dist/types/enum/discord-sync-status.enum.js +10 -0
  30. package/dist/types/enum/discord-sync-status.enum.js.map +1 -0
  31. package/dist/types/enum/discord-token-state.enum.d.ts +6 -0
  32. package/dist/types/enum/discord-token-state.enum.js +11 -0
  33. package/dist/types/enum/discord-token-state.enum.js.map +1 -0
  34. package/dist/types/enum/index.d.ts +8 -0
  35. package/dist/types/enum/index.js +8 -0
  36. package/dist/types/enum/index.js.map +1 -1
  37. package/dist/types/enum/reflex-error-code.enum.d.ts +7 -1
  38. package/dist/types/enum/reflex-error-code.enum.js +6 -0
  39. package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
  40. package/dist/types/enum/service-type.enum.d.ts +2 -1
  41. package/dist/types/enum/service-type.enum.js +1 -0
  42. package/dist/types/enum/service-type.enum.js.map +1 -1
  43. package/dist/types/interface/api/requests/index.d.ts +1 -0
  44. package/dist/types/interface/api/requests/index.js +1 -0
  45. package/dist/types/interface/api/requests/index.js.map +1 -1
  46. package/dist/types/interface/api/requests/service-discord.request.d.ts +97 -0
  47. package/dist/types/interface/api/requests/service-discord.request.js +3 -0
  48. package/dist/types/interface/api/requests/service-discord.request.js.map +1 -0
  49. package/dist/types/interface/api/requests/service.request.d.ts +2 -0
  50. package/dist/types/interface/api/responses/index.d.ts +1 -0
  51. package/dist/types/interface/api/responses/index.js +1 -0
  52. package/dist/types/interface/api/responses/index.js.map +1 -1
  53. package/dist/types/interface/api/responses/service-discord.response.d.ts +50 -0
  54. package/dist/types/interface/api/responses/service-discord.response.js +3 -0
  55. package/dist/types/interface/api/responses/service-discord.response.js.map +1 -0
  56. package/dist/types/interface/api/responses/service-version.response.d.ts +15 -1
  57. package/dist/types/interface/models/index.d.ts +1 -0
  58. package/dist/types/interface/models/index.js +1 -0
  59. package/dist/types/interface/models/index.js.map +1 -1
  60. package/dist/types/interface/models/reflex-discord.model.d.ts +82 -0
  61. package/dist/types/interface/models/reflex-discord.model.js +13 -0
  62. package/dist/types/interface/models/reflex-discord.model.js.map +1 -0
  63. package/dist/types/interface/models/reflex-run.model.d.ts +3 -0
  64. package/dist/types/interface/models/reflex-service-deployment.model.d.ts +5 -1
  65. package/dist/types/interface/models/reflex-service-version.model.d.ts +6 -0
  66. package/dist/types/interface/models/reflex-service.model.d.ts +1 -0
  67. package/package.json +15 -10
  68. package/src/api/index.ts +13 -12
  69. package/src/api/service-configuration.api.ts +16 -16
  70. package/src/api/service-discord.api.test.ts +170 -0
  71. package/src/api/service-discord.api.ts +203 -0
  72. package/src/index.ts +45 -0
  73. package/src/types/enum/access-grant-status.enum.ts +12 -12
  74. package/src/types/enum/access-kind.enum.ts +7 -7
  75. package/src/types/enum/discord-activity-type.enum.ts +9 -0
  76. package/src/types/enum/discord-component-kind.enum.ts +7 -0
  77. package/src/types/enum/discord-gateway-failure-code.enum.ts +9 -0
  78. package/src/types/enum/discord-gateway-state.enum.ts +11 -0
  79. package/src/types/enum/discord-option-type.enum.ts +12 -0
  80. package/src/types/enum/discord-presence-status.enum.ts +8 -0
  81. package/src/types/enum/discord-sync-status.enum.ts +6 -0
  82. package/src/types/enum/discord-token-state.enum.ts +11 -0
  83. package/src/types/enum/execution-mode.enum.ts +9 -9
  84. package/src/types/enum/execution-profile.enum.ts +20 -20
  85. package/src/types/enum/execution-settings-source.enum.ts +9 -9
  86. package/src/types/enum/health-status.enum.ts +4 -4
  87. package/src/types/enum/index.ts +8 -0
  88. package/src/types/enum/reflex-error-code.enum.ts +37 -25
  89. package/src/types/enum/route-method.enum.ts +9 -9
  90. package/src/types/enum/run-log-level.enum.ts +6 -6
  91. package/src/types/enum/run-mode.enum.ts +11 -11
  92. package/src/types/enum/run-status.enum.ts +11 -11
  93. package/src/types/enum/run-step-status.enum.ts +7 -7
  94. package/src/types/enum/service-deployment-action.enum.ts +11 -11
  95. package/src/types/enum/service-deployment-status.enum.ts +5 -5
  96. package/src/types/enum/service-type.enum.ts +9 -7
  97. package/src/types/enum/service-version-change-kind.enum.ts +6 -6
  98. package/src/types/enum/trace-effect-type.enum.ts +12 -12
  99. package/src/types/enum/trigger-access-mode.enum.ts +12 -12
  100. package/src/types/index.ts +2 -2
  101. package/src/types/interface/api/index.ts +3 -3
  102. package/src/types/interface/api/requests/function-access.request.ts +25 -25
  103. package/src/types/interface/api/requests/function-run.request.ts +26 -26
  104. package/src/types/interface/api/requests/function-settings.request.ts +27 -27
  105. package/src/types/interface/api/requests/function-test.request.ts +24 -24
  106. package/src/types/interface/api/requests/function-version.request.ts +20 -20
  107. package/src/types/interface/api/requests/function.request.ts +36 -36
  108. package/src/types/interface/api/requests/index.ts +1 -0
  109. package/src/types/interface/api/requests/service-deployment.request.ts +49 -49
  110. package/src/types/interface/api/requests/service-discord.request.ts +128 -0
  111. package/src/types/interface/api/requests/service-route.request.ts +44 -44
  112. package/src/types/interface/api/requests/service-version.request.ts +19 -19
  113. package/src/types/interface/api/requests/service.request.ts +46 -39
  114. package/src/types/interface/api/response.ts +4 -4
  115. package/src/types/interface/api/responses/function-access.response.ts +17 -17
  116. package/src/types/interface/api/responses/function-run.response.ts +18 -18
  117. package/src/types/interface/api/responses/function-settings.response.ts +36 -36
  118. package/src/types/interface/api/responses/function-test.response.ts +12 -12
  119. package/src/types/interface/api/responses/function-version.response.ts +31 -31
  120. package/src/types/interface/api/responses/function.response.ts +25 -25
  121. package/src/types/interface/api/responses/index.ts +1 -0
  122. package/src/types/interface/api/responses/service-deployment.response.ts +32 -32
  123. package/src/types/interface/api/responses/service-discord.response.ts +72 -0
  124. package/src/types/interface/api/responses/service-route.response.ts +31 -31
  125. package/src/types/interface/api/responses/service-version.response.ts +62 -33
  126. package/src/types/interface/api/responses/service.response.ts +31 -31
  127. package/src/types/interface/health.response.ts +7 -7
  128. package/src/types/interface/index.ts +3 -3
  129. package/src/types/interface/models/index.ts +1 -0
  130. package/src/types/interface/models/reflex-access-grant.model.ts +14 -14
  131. package/src/types/interface/models/reflex-definition.model.ts +31 -31
  132. package/src/types/interface/models/reflex-discord.model.ts +146 -0
  133. package/src/types/interface/models/reflex-execution-settings.model.ts +50 -50
  134. package/src/types/interface/models/reflex-function-version.model.ts +14 -14
  135. package/src/types/interface/models/reflex-function.model.ts +16 -16
  136. package/src/types/interface/models/reflex-price-list.model.ts +20 -20
  137. package/src/types/interface/models/reflex-route.model.ts +19 -19
  138. package/src/types/interface/models/reflex-run.model.ts +173 -164
  139. package/src/types/interface/models/reflex-service-deployment.model.ts +40 -29
  140. package/src/types/interface/models/reflex-service-version.model.ts +55 -43
  141. package/src/types/interface/models/reflex-service.model.ts +45 -43
  142. package/src/types/interface/models/reflex-step-stats.model.ts +35 -35
@@ -0,0 +1,203 @@
1
+ import { AbyssReflexCore } from '..';
2
+ import type {
3
+ ICheckServiceDiscordConnectionParams,
4
+ ICheckServiceDiscordConnectionResponse,
5
+ ICreateServiceDiscordCommandBody,
6
+ ICreateServiceDiscordCommandParams,
7
+ ICreateServiceDiscordCommandResponse,
8
+ ICreateServiceDiscordComponentBody,
9
+ ICreateServiceDiscordComponentParams,
10
+ ICreateServiceDiscordComponentResponse,
11
+ IDeleteServiceDiscordCommandParams,
12
+ IDeleteServiceDiscordCommandResponse,
13
+ IDeleteServiceDiscordComponentParams,
14
+ IDeleteServiceDiscordComponentResponse,
15
+ IGetServiceDiscordConnectionParams,
16
+ IGetServiceDiscordConnectionResponse,
17
+ IListServiceDiscordCommandParams,
18
+ IListServiceDiscordCommandResponse,
19
+ IListServiceDiscordComponentParams,
20
+ IListServiceDiscordComponentResponse,
21
+ IRetryServiceDiscordSyncParams,
22
+ IRetryServiceDiscordSyncResponse,
23
+ ISetServiceDiscordEnvironmentBody,
24
+ ISetServiceDiscordEnvironmentParams,
25
+ ISetServiceDiscordEnvironmentResponse,
26
+ ISetServiceDiscordTokenSecretBody,
27
+ ISetServiceDiscordTokenSecretParams,
28
+ ISetServiceDiscordTokenSecretResponse,
29
+ IUpdateServiceDiscordCommandBody,
30
+ IUpdateServiceDiscordCommandParams,
31
+ IUpdateServiceDiscordCommandResponse,
32
+ IUpdateServiceDiscordComponentBody,
33
+ IUpdateServiceDiscordComponentParams,
34
+ IUpdateServiceDiscordComponentResponse,
35
+ } from '../types';
36
+
37
+ const serviceUrl = (params: { applicationId: string; serviceId: string }): string =>
38
+ `api/service/${params.applicationId}/${params.serviceId}`;
39
+
40
+ const commandUrl = (params: { applicationId: string; serviceId: string }): string =>
41
+ `${serviceUrl(params)}/discord/command`;
42
+
43
+ const componentUrl = (params: { applicationId: string; serviceId: string }): string =>
44
+ `${serviceUrl(params)}/discord/component`;
45
+
46
+ const connectionUrl = (params: { applicationId: string; serviceId: string }): string =>
47
+ `${serviceUrl(params)}/discord/connection`;
48
+
49
+ /** `GET .../discord/command`: the commands of the draft of a Discord bot, by name. Needs REFLEX_READ. */
50
+ export const listServiceDiscordCommand = async (
51
+ params: IListServiceDiscordCommandParams,
52
+ ): Promise<IListServiceDiscordCommandResponse> =>
53
+ (await AbyssReflexCore.axios.get<IListServiceDiscordCommandResponse>(commandUrl(params))).data;
54
+
55
+ /**
56
+ * `POST .../discord/command`: a command of the draft, pushed to Discord once a version holding it is in
57
+ * service. `409 DISCORD_COMMAND_CONFLICT` when the name is taken. Needs REFLEX_FUNCTION_UPDATE.
58
+ */
59
+ export const createServiceDiscordCommand = async (
60
+ params: ICreateServiceDiscordCommandParams,
61
+ body: ICreateServiceDiscordCommandBody,
62
+ ): Promise<ICreateServiceDiscordCommandResponse> =>
63
+ (await AbyssReflexCore.axios.post<ICreateServiceDiscordCommandResponse>(commandUrl(params), body))
64
+ .data;
65
+
66
+ /** `PATCH .../discord/command/:commandId`: changes the command in the draft. Needs REFLEX_FUNCTION_UPDATE. */
67
+ export const updateServiceDiscordCommand = async (
68
+ params: IUpdateServiceDiscordCommandParams,
69
+ body: IUpdateServiceDiscordCommandBody,
70
+ ): Promise<IUpdateServiceDiscordCommandResponse> =>
71
+ (
72
+ await AbyssReflexCore.axios.patch<IUpdateServiceDiscordCommandResponse>(
73
+ `${commandUrl(params)}/${params.commandId}`,
74
+ body,
75
+ )
76
+ ).data;
77
+
78
+ /** `DELETE .../discord/command/:commandId`: takes the command out of the draft. Needs REFLEX_FUNCTION_UPDATE. */
79
+ export const deleteServiceDiscordCommand = async (
80
+ params: IDeleteServiceDiscordCommandParams,
81
+ ): Promise<IDeleteServiceDiscordCommandResponse> =>
82
+ (
83
+ await AbyssReflexCore.axios.delete<IDeleteServiceDiscordCommandResponse>(
84
+ `${commandUrl(params)}/${params.commandId}`,
85
+ )
86
+ ).data;
87
+
88
+ /** `GET .../discord/component`: the components of the draft of a Discord bot, by prefix. Needs REFLEX_READ. */
89
+ export const listServiceDiscordComponent = async (
90
+ params: IListServiceDiscordComponentParams,
91
+ ): Promise<IListServiceDiscordComponentResponse> =>
92
+ (await AbyssReflexCore.axios.get<IListServiceDiscordComponentResponse>(componentUrl(params)))
93
+ .data;
94
+
95
+ /**
96
+ * `POST .../discord/component`: a button, menu or form prefix of the draft. `409
97
+ * DISCORD_COMPONENT_PREFIX_CONFLICT` when it equals, starts or is started by another prefix. Needs
98
+ * REFLEX_FUNCTION_UPDATE.
99
+ */
100
+ export const createServiceDiscordComponent = async (
101
+ params: ICreateServiceDiscordComponentParams,
102
+ body: ICreateServiceDiscordComponentBody,
103
+ ): Promise<ICreateServiceDiscordComponentResponse> =>
104
+ (
105
+ await AbyssReflexCore.axios.post<ICreateServiceDiscordComponentResponse>(
106
+ componentUrl(params),
107
+ body,
108
+ )
109
+ ).data;
110
+
111
+ /** `PATCH .../discord/component/:componentId`: changes the component in the draft. Needs REFLEX_FUNCTION_UPDATE. */
112
+ export const updateServiceDiscordComponent = async (
113
+ params: IUpdateServiceDiscordComponentParams,
114
+ body: IUpdateServiceDiscordComponentBody,
115
+ ): Promise<IUpdateServiceDiscordComponentResponse> =>
116
+ (
117
+ await AbyssReflexCore.axios.patch<IUpdateServiceDiscordComponentResponse>(
118
+ `${componentUrl(params)}/${params.componentId}`,
119
+ body,
120
+ )
121
+ ).data;
122
+
123
+ /** `DELETE .../discord/component/:componentId`: takes the component out of the draft. Needs REFLEX_FUNCTION_UPDATE. */
124
+ export const deleteServiceDiscordComponent = async (
125
+ params: IDeleteServiceDiscordComponentParams,
126
+ ): Promise<IDeleteServiceDiscordComponentResponse> =>
127
+ (
128
+ await AbyssReflexCore.axios.delete<IDeleteServiceDiscordComponentResponse>(
129
+ `${componentUrl(params)}/${params.componentId}`,
130
+ )
131
+ ).data;
132
+
133
+ /**
134
+ * `GET .../discord/connection`: the Vault entry of the token and, per environment of the application,
135
+ * the bot as last checked, the state of its token, the test server, the interactions address and the
136
+ * invitation link. Never the token. Needs REFLEX_READ.
137
+ */
138
+ export const getServiceDiscordConnection = async (
139
+ params: IGetServiceDiscordConnectionParams,
140
+ ): Promise<IGetServiceDiscordConnectionResponse> =>
141
+ (await AbyssReflexCore.axios.get<IGetServiceDiscordConnectionResponse>(connectionUrl(params)))
142
+ .data;
143
+
144
+ /**
145
+ * `PUT .../discord/connection`: chooses the Vault entry that holds the bot token. The environments in
146
+ * service read it again at once. Needs REFLEX_BOT_MANAGE.
147
+ */
148
+ export const setServiceDiscordTokenSecret = async (
149
+ params: ISetServiceDiscordTokenSecretParams,
150
+ body: ISetServiceDiscordTokenSecretBody,
151
+ ): Promise<ISetServiceDiscordTokenSecretResponse> =>
152
+ (
153
+ await AbyssReflexCore.axios.put<ISetServiceDiscordTokenSecretResponse>(
154
+ connectionUrl(params),
155
+ body,
156
+ )
157
+ ).data;
158
+
159
+ /**
160
+ * `PUT .../discord/connection/:environmentId`: the test server and the invitation permissions of one
161
+ * environment. A new test server is pushed at once where the bot is in service. Needs
162
+ * REFLEX_BOT_MANAGE.
163
+ */
164
+ export const setServiceDiscordEnvironment = async (
165
+ params: ISetServiceDiscordEnvironmentParams,
166
+ body: ISetServiceDiscordEnvironmentBody,
167
+ ): Promise<ISetServiceDiscordEnvironmentResponse> =>
168
+ (
169
+ await AbyssReflexCore.axios.put<ISetServiceDiscordEnvironmentResponse>(
170
+ `${connectionUrl(params)}/${params.environmentId}`,
171
+ body,
172
+ )
173
+ ).data;
174
+
175
+ /**
176
+ * `POST .../discord/connection/:environmentId/check`: reads the token of the environment from the Vault
177
+ * and asks Discord about it; answers the environment row, whatever the state of the token (`VALID`,
178
+ * `REJECTED`, `MISSING`). Needs REFLEX_BOT_MANAGE.
179
+ */
180
+ export const checkServiceDiscordConnection = async (
181
+ params: ICheckServiceDiscordConnectionParams,
182
+ ): Promise<ICheckServiceDiscordConnectionResponse> =>
183
+ (
184
+ await AbyssReflexCore.axios.post<ICheckServiceDiscordConnectionResponse>(
185
+ `${connectionUrl(params)}/${params.environmentId}/check`,
186
+ {},
187
+ )
188
+ ).data;
189
+
190
+ /**
191
+ * `POST .../deployment/:environmentId/discord-sync`: pushes the interactions address and the commands to
192
+ * Discord again for the version in service, without a new version. Needs REFLEX_PUBLISH, and
193
+ * REFLEX_PUBLISH_PRODUCTION in a production environment.
194
+ */
195
+ export const retryServiceDiscordSync = async (
196
+ params: IRetryServiceDiscordSyncParams,
197
+ ): Promise<IRetryServiceDiscordSyncResponse> =>
198
+ (
199
+ await AbyssReflexCore.axios.post<IRetryServiceDiscordSyncResponse>(
200
+ `${serviceUrl(params)}/deployment/${params.environmentId}/discord-sync`,
201
+ {},
202
+ )
203
+ ).data;
package/src/index.ts CHANGED
@@ -11,6 +11,7 @@ import * as serviceRouteApi from './api/service-route.api';
11
11
  import * as serviceVersionApi from './api/service-version.api';
12
12
  import * as serviceDeploymentApi from './api/service-deployment.api';
13
13
  import * as serviceConfigurationApi from './api/service-configuration.api';
14
+ import * as serviceDiscordApi from './api/service-discord.api';
14
15
 
15
16
  export * from './api';
16
17
  export * from './types';
@@ -87,6 +88,29 @@ type AbyssReflexCoreSDK = {
87
88
  configuration: {
88
89
  list: typeof serviceConfigurationApi.listServiceConfiguration;
89
90
  };
91
+ /** A Discord bot Service: its commands and components, its connection, the push to Discord. */
92
+ discord: {
93
+ command: {
94
+ list: typeof serviceDiscordApi.listServiceDiscordCommand;
95
+ create: typeof serviceDiscordApi.createServiceDiscordCommand;
96
+ update: typeof serviceDiscordApi.updateServiceDiscordCommand;
97
+ delete: typeof serviceDiscordApi.deleteServiceDiscordCommand;
98
+ };
99
+ component: {
100
+ list: typeof serviceDiscordApi.listServiceDiscordComponent;
101
+ create: typeof serviceDiscordApi.createServiceDiscordComponent;
102
+ update: typeof serviceDiscordApi.updateServiceDiscordComponent;
103
+ delete: typeof serviceDiscordApi.deleteServiceDiscordComponent;
104
+ };
105
+ connection: {
106
+ get: typeof serviceDiscordApi.getServiceDiscordConnection;
107
+ setTokenSecret: typeof serviceDiscordApi.setServiceDiscordTokenSecret;
108
+ setEnvironment: typeof serviceDiscordApi.setServiceDiscordEnvironment;
109
+ check: typeof serviceDiscordApi.checkServiceDiscordConnection;
110
+ };
111
+ /** Pushes the interactions address and the commands to Discord again. */
112
+ sync: typeof serviceDiscordApi.retryServiceDiscordSync;
113
+ };
90
114
  };
91
115
  };
92
116
 
@@ -164,6 +188,27 @@ export class AbyssReflexCore {
164
188
  configuration: {
165
189
  list: serviceConfigurationApi.listServiceConfiguration,
166
190
  },
191
+ discord: {
192
+ command: {
193
+ list: serviceDiscordApi.listServiceDiscordCommand,
194
+ create: serviceDiscordApi.createServiceDiscordCommand,
195
+ update: serviceDiscordApi.updateServiceDiscordCommand,
196
+ delete: serviceDiscordApi.deleteServiceDiscordCommand,
197
+ },
198
+ component: {
199
+ list: serviceDiscordApi.listServiceDiscordComponent,
200
+ create: serviceDiscordApi.createServiceDiscordComponent,
201
+ update: serviceDiscordApi.updateServiceDiscordComponent,
202
+ delete: serviceDiscordApi.deleteServiceDiscordComponent,
203
+ },
204
+ connection: {
205
+ get: serviceDiscordApi.getServiceDiscordConnection,
206
+ setTokenSecret: serviceDiscordApi.setServiceDiscordTokenSecret,
207
+ setEnvironment: serviceDiscordApi.setServiceDiscordEnvironment,
208
+ check: serviceDiscordApi.checkServiceDiscordConnection,
209
+ },
210
+ sync: serviceDiscordApi.retryServiceDiscordSync,
211
+ },
167
212
  },
168
213
  };
169
214
  }
@@ -1,12 +1,12 @@
1
- /**
2
- * State of an access granted to a function.
3
- * - ACTIVE: the grantor still holds the right the access needs.
4
- * - SUSPENDED: a publication found the grantor without that right. Publishing is refused
5
- * (`GRANT_SUSPENDED`) until the access is revoked and granted again; what is already promoted keeps running.
6
- * - REVOKED: withdrawn on purpose; the row stays as the journal.
7
- */
8
- export enum AccessGrantStatus {
9
- ACTIVE = 'ACTIVE',
10
- SUSPENDED = 'SUSPENDED',
11
- REVOKED = 'REVOKED',
12
- }
1
+ /**
2
+ * State of an access granted to a function.
3
+ * - ACTIVE: the grantor still holds the right the access needs.
4
+ * - SUSPENDED: a publication found the grantor without that right. Publishing is refused
5
+ * (`GRANT_SUSPENDED`) until the access is revoked and granted again; what is already promoted keeps running.
6
+ * - REVOKED: withdrawn on purpose; the row stays as the journal.
7
+ */
8
+ export enum AccessGrantStatus {
9
+ ACTIVE = 'ACTIVE',
10
+ SUSPENDED = 'SUSPENDED',
11
+ REVOKED = 'REVOKED',
12
+ }
@@ -1,7 +1,7 @@
1
- /** The kinds of access a definition declares and a member grants (the format of @abyss-project/runtime). */
2
- export enum ReflexAccessKind {
3
- /** Outbound HTTP to a list of host names (exact, or `*.domain` for any sub-domain). */
4
- HTTP = 'HTTP',
5
- /** One action of the host catalog (`store.get`, `store.set`, `store.increment`, `secret.get`, `http.respond`). */
6
- HOST_ACTION = 'HOST_ACTION',
7
- }
1
+ /** The kinds of access a definition declares and a member grants (the format of @abyss-project/runtime). */
2
+ export enum ReflexAccessKind {
3
+ /** Outbound HTTP to a list of host names (exact, or `*.domain` for any sub-domain). */
4
+ HTTP = 'HTTP',
5
+ /** One action of the host catalog (`store.get`, `store.set`, `store.increment`, `secret.get`, `http.respond`). */
6
+ HOST_ACTION = 'HOST_ACTION',
7
+ }
@@ -0,0 +1,9 @@
1
+ /** What the activity of a Discord bot says it does ("Playing", "Listening to", "Watching", "Competing in", or a free text). */
2
+ export enum DiscordActivityType {
3
+ PLAYING = 'PLAYING',
4
+ LISTENING = 'LISTENING',
5
+ WATCHING = 'WATCHING',
6
+ COMPETING = 'COMPETING',
7
+ /** The text alone, shown as it is written. */
8
+ CUSTOM = 'CUSTOM',
9
+ }
@@ -0,0 +1,7 @@
1
+ /** What a component prefix of a Discord bot routes. */
2
+ export enum DiscordComponentKind {
3
+ /** A button or a select menu: interactions of type MESSAGE_COMPONENT. */
4
+ BUTTON_OR_SELECT = 'BUTTON_OR_SELECT',
5
+ /** A form: interactions of type MODAL_SUBMIT. */
6
+ MODAL = 'MODAL',
7
+ }
@@ -0,0 +1,9 @@
1
+ /** Why a Gateway connection is `FAILED`. */
2
+ export enum DiscordGatewayFailureCode {
3
+ /** Discord rejected the token (close code 4004). */
4
+ TOKEN_REJECTED = 'TOKEN_REJECTED',
5
+ /** The bot spent its identifications of the UTC day. */
6
+ IDENTIFY_BUDGET = 'IDENTIFY_BUDGET',
7
+ /** Discord refused the connection (close codes 4010 to 4014: invalid shard, sharding required, invalid or disallowed intents). */
8
+ DISCORD_REFUSED = 'DISCORD_REFUSED',
9
+ }
@@ -0,0 +1,11 @@
1
+ /** The state of the Gateway connection that keeps a Discord bot online in one environment. */
2
+ export enum DiscordGatewayState {
3
+ /** Connecting, identifying or resuming. */
4
+ CONNECTING = 'CONNECTING',
5
+ /** Connected: the bot is online. */
6
+ CONNECTED = 'CONNECTED',
7
+ /** No connection: the bot is paused or out of service, or the connection is between two owners. */
8
+ DISCONNECTED = 'DISCONNECTED',
9
+ /** The connection cannot be kept; `DiscordGatewayFailureCode` says why. */
10
+ FAILED = 'FAILED',
11
+ }
@@ -0,0 +1,12 @@
1
+ /** Type of an option of a Discord command (same names as the options Discord documents). */
2
+ export enum DiscordOptionType {
3
+ STRING = 'STRING',
4
+ INTEGER = 'INTEGER',
5
+ NUMBER = 'NUMBER',
6
+ BOOLEAN = 'BOOLEAN',
7
+ USER = 'USER',
8
+ CHANNEL = 'CHANNEL',
9
+ ROLE = 'ROLE',
10
+ MENTIONABLE = 'MENTIONABLE',
11
+ ATTACHMENT = 'ATTACHMENT',
12
+ }
@@ -0,0 +1,8 @@
1
+ /** The status a Discord bot shows while connected to the Gateway. */
2
+ export enum DiscordPresenceStatus {
3
+ ONLINE = 'ONLINE',
4
+ /** Away. */
5
+ IDLE = 'IDLE',
6
+ /** Do not disturb. */
7
+ DND = 'DND',
8
+ }
@@ -0,0 +1,6 @@
1
+ /** State of the push of the interactions address and the commands to Discord, per environment. */
2
+ export enum DiscordSyncStatus {
3
+ PENDING = 'PENDING',
4
+ SYNCED = 'SYNCED',
5
+ FAILED = 'FAILED',
6
+ }
@@ -0,0 +1,11 @@
1
+ /** What Reflex knows of the bot token of an environment. */
2
+ export enum DiscordTokenState {
3
+ /** Discord accepted the token at the last check. */
4
+ VALID = 'VALID',
5
+ /** Discord answered 401 to the token. */
6
+ REJECTED = 'REJECTED',
7
+ /** The Vault entry has no value in this environment. */
8
+ MISSING = 'MISSING',
9
+ /** The token has not been checked yet. */
10
+ UNCHECKED = 'UNCHECKED',
11
+ }
@@ -1,9 +1,9 @@
1
- /**
2
- * How a route answers its caller.
3
- * - SYNC: the caller waits for the Respond step, or gets 504 past the response timeout.
4
- * - ASYNC: the caller gets `202 {executionId}` before the execution starts, and reads its state.
5
- */
6
- export enum ExecutionMode {
7
- SYNC = 'SYNC',
8
- ASYNC = 'ASYNC',
9
- }
1
+ /**
2
+ * How a route answers its caller.
3
+ * - SYNC: the caller waits for the Respond step, or gets 504 past the response timeout.
4
+ * - ASYNC: the caller gets `202 {executionId}` before the execution starts, and reads its state.
5
+ */
6
+ export enum ExecutionMode {
7
+ SYNC = 'SYNC',
8
+ ASYNC = 'ASYNC',
9
+ }
@@ -1,20 +1,20 @@
1
- /**
2
- * Memory of the isolate an execution runs in (ADR-0244). The CPU part of the cost grows with the
3
- * profile: S x1, M x1.05, L x1.10, XL x1.20, XXL x1.35.
4
- */
5
- export enum ExecutionProfile {
6
- S = 'S',
7
- M = 'M',
8
- L = 'L',
9
- XL = 'XL',
10
- XXL = 'XXL',
11
- }
12
-
13
- /** Memory limit of each profile, in MB (1 GB = 1024 MB). */
14
- export const EXECUTION_PROFILE_MEMORY_MB: Readonly<Record<ExecutionProfile, number>> = {
15
- [ExecutionProfile.S]: 128,
16
- [ExecutionProfile.M]: 256,
17
- [ExecutionProfile.L]: 512,
18
- [ExecutionProfile.XL]: 1024,
19
- [ExecutionProfile.XXL]: 2048,
20
- };
1
+ /**
2
+ * Memory of the isolate an execution runs in (ADR-0244). The CPU part of the cost grows with the
3
+ * profile: S x1, M x1.05, L x1.10, XL x1.20, XXL x1.35.
4
+ */
5
+ export enum ExecutionProfile {
6
+ S = 'S',
7
+ M = 'M',
8
+ L = 'L',
9
+ XL = 'XL',
10
+ XXL = 'XXL',
11
+ }
12
+
13
+ /** Memory limit of each profile, in MB (1 GB = 1024 MB). */
14
+ export const EXECUTION_PROFILE_MEMORY_MB: Readonly<Record<ExecutionProfile, number>> = {
15
+ [ExecutionProfile.S]: 128,
16
+ [ExecutionProfile.M]: 256,
17
+ [ExecutionProfile.L]: 512,
18
+ [ExecutionProfile.XL]: 1024,
19
+ [ExecutionProfile.XXL]: 2048,
20
+ };
@@ -1,9 +1,9 @@
1
- /** Where the effective settings of an environment come from. */
2
- export enum ExecutionSettingsSource {
3
- /** The override of this environment. */
4
- ENVIRONMENT = 'ENVIRONMENT',
5
- /** The default of the function, for every environment without an override. */
6
- DEFAULT = 'DEFAULT',
7
- /** Nothing is set: the built-in defaults. */
8
- BUILT_IN = 'BUILT_IN',
9
- }
1
+ /** Where the effective settings of an environment come from. */
2
+ export enum ExecutionSettingsSource {
3
+ /** The override of this environment. */
4
+ ENVIRONMENT = 'ENVIRONMENT',
5
+ /** The default of the function, for every environment without an override. */
6
+ DEFAULT = 'DEFAULT',
7
+ /** Nothing is set: the built-in defaults. */
8
+ BUILT_IN = 'BUILT_IN',
9
+ }
@@ -1,4 +1,4 @@
1
- export enum HealthStatus {
2
- UP = 'up',
3
- DOWN = 'down',
4
- }
1
+ export enum HealthStatus {
2
+ UP = 'up',
3
+ DOWN = 'down',
4
+ }
@@ -19,3 +19,11 @@ export * from './vault-value-source.enum';
19
19
  export * from './vault-visibility.enum';
20
20
  export * from './configuration-read-as.enum';
21
21
  export * from './service-version-change-kind.enum';
22
+ export * from './discord-option-type.enum';
23
+ export * from './discord-component-kind.enum';
24
+ export * from './discord-sync-status.enum';
25
+ export * from './discord-token-state.enum';
26
+ export * from './discord-presence-status.enum';
27
+ export * from './discord-activity-type.enum';
28
+ export * from './discord-gateway-state.enum';
29
+ export * from './discord-gateway-failure-code.enum';
@@ -1,25 +1,37 @@
1
- /** `error.code` of the refusals a client acts on. */
2
- export enum ReflexErrorCode {
3
- /** 400: the definition does not match the format; `error.details` holds the path of each fault. */
4
- INVALID_DEFINITION = 'INVALID_DEFINITION',
5
- /** 409: an access granted to the function is suspended; revoke it and grant it again. */
6
- GRANT_SUSPENDED = 'GRANT_SUSPENDED',
7
- /** 409: the function has no frozen version of its own draft yet, or none to go back to. */
8
- NO_VERSION = 'NO_VERSION',
9
- /** 409: the access to grant is not declared by the draft of the function. */
10
- ACCESS_NOT_DECLARED = 'ACCESS_NOT_DECLARED',
11
- /** 404: the environment is not one of the application's environments (abyss-main). */
12
- ENVIRONMENT_NOT_FOUND = 'ENVIRONMENT_NOT_FOUND',
13
- /** 409: a name, a path or an access already exists. */
14
- ALREADY_EXISTS = 'ALREADY_EXISTS',
15
- /** 403: the function is promoted in a production environment and the member lacks REFLEX_PUBLISH_PRODUCTION. */
16
- PUBLISH_PRODUCTION_REQUIRED = 'PUBLISH_PRODUCTION_REQUIRED',
17
- /** 503 (edge): the Service is paused in this environment; nothing ran, nothing is billed. */
18
- SERVICE_PAUSED = 'SERVICE_PAUSED',
19
- /** 429: the caller went past the limit; `Retry-After` and `RateLimit-*` say when to come back. */
20
- RATE_LIMIT_EXCEEDED = 'RATE_LIMIT_EXCEEDED',
21
- /** 409: the route would hide another one of the Service (same method, paths equal but for their parameters). */
22
- ROUTE_CONFLICT = 'ROUTE_CONFLICT',
23
- /** 409: the Service has not changed since its last version. */
24
- VERSION_UNCHANGED = 'VERSION_UNCHANGED',
25
- }
1
+ /** `error.code` of the refusals a client acts on. */
2
+ export enum ReflexErrorCode {
3
+ /** 400: the definition does not match the format; `error.details` holds the path of each fault. */
4
+ INVALID_DEFINITION = 'INVALID_DEFINITION',
5
+ /** 409: an access granted to the function is suspended; revoke it and grant it again. */
6
+ GRANT_SUSPENDED = 'GRANT_SUSPENDED',
7
+ /** 409: the function has no frozen version of its own draft yet, or none to go back to. */
8
+ NO_VERSION = 'NO_VERSION',
9
+ /** 409: the access to grant is not declared by the draft of the function. */
10
+ ACCESS_NOT_DECLARED = 'ACCESS_NOT_DECLARED',
11
+ /** 404: the environment is not one of the application's environments (abyss-main). */
12
+ ENVIRONMENT_NOT_FOUND = 'ENVIRONMENT_NOT_FOUND',
13
+ /** 409: a name, a path or an access already exists. */
14
+ ALREADY_EXISTS = 'ALREADY_EXISTS',
15
+ /** 403: the function is promoted in a production environment and the member lacks REFLEX_PUBLISH_PRODUCTION. */
16
+ PUBLISH_PRODUCTION_REQUIRED = 'PUBLISH_PRODUCTION_REQUIRED',
17
+ /** 503 (edge): the Service is paused in this environment; nothing ran, nothing is billed. */
18
+ SERVICE_PAUSED = 'SERVICE_PAUSED',
19
+ /** 429: the caller went past the limit; `Retry-After` and `RateLimit-*` say when to come back. */
20
+ RATE_LIMIT_EXCEEDED = 'RATE_LIMIT_EXCEEDED',
21
+ /** 409: the route would hide another one of the Service (same method, paths equal but for their parameters). */
22
+ ROUTE_CONFLICT = 'ROUTE_CONFLICT',
23
+ /** 409: the Service has not changed since its last version. */
24
+ VERSION_UNCHANGED = 'VERSION_UNCHANGED',
25
+ /** 409: the Discord bot token has no value in this environment's Vault entry. */
26
+ DISCORD_TOKEN_MISSING = 'DISCORD_TOKEN_MISSING',
27
+ /** 409: Discord refused the bot token (401). */
28
+ DISCORD_TOKEN_REJECTED = 'DISCORD_TOKEN_REJECTED',
29
+ /** 409: a non-production environment needs a test server before a Discord bot goes live there. */
30
+ DISCORD_TEST_GUILD_REQUIRED = 'DISCORD_TEST_GUILD_REQUIRED',
31
+ /** 409: a command of that name already exists in the Service. */
32
+ DISCORD_COMMAND_CONFLICT = 'DISCORD_COMMAND_CONFLICT',
33
+ /** 409: the component prefix equals, starts or is started by another prefix of the Service. */
34
+ DISCORD_COMPONENT_PREFIX_CONFLICT = 'DISCORD_COMPONENT_PREFIX_CONFLICT',
35
+ /** 400: the field does not exist for this type of Service (CORS or rate limit on a Discord bot). */
36
+ SERVICE_TYPE_FIELD_REFUSED = 'SERVICE_TYPE_FIELD_REFUSED',
37
+ }
@@ -1,9 +1,9 @@
1
- /** The HTTP method a route answers. `ANY` answers every method; a `FUNCTIONS` Service only has `ANY` routes. */
2
- export enum RouteMethod {
3
- GET = 'GET',
4
- POST = 'POST',
5
- PUT = 'PUT',
6
- PATCH = 'PATCH',
7
- DELETE = 'DELETE',
8
- ANY = 'ANY',
9
- }
1
+ /** The HTTP method a route answers. `ANY` answers every method; a `FUNCTIONS` Service only has `ANY` routes. */
2
+ export enum RouteMethod {
3
+ GET = 'GET',
4
+ POST = 'POST',
5
+ PUT = 'PUT',
6
+ PATCH = 'PATCH',
7
+ DELETE = 'DELETE',
8
+ ANY = 'ANY',
9
+ }
@@ -1,6 +1,6 @@
1
- /** The level of a log line an execution wrote (LOG step, `abyss.log.*`, `console.*`). */
2
- export enum RunLogLevel {
3
- INFO = 'info',
4
- WARN = 'warn',
5
- ERROR = 'error',
6
- }
1
+ /** The level of a log line an execution wrote (LOG step, `abyss.log.*`, `console.*`). */
2
+ export enum RunLogLevel {
3
+ INFO = 'info',
4
+ WARN = 'warn',
5
+ ERROR = 'error',
6
+ }
@@ -1,11 +1,11 @@
1
- /**
2
- * How a run was made.
3
- * - SIMULATION: nothing is executed, effects are recorded, the Store is a scratch copy thrown away.
4
- * - DRY_RUN: Store reads are real, writes are recorded and not executed.
5
- * - LIVE: an execution of the edge on a promoted version.
6
- */
7
- export enum RunMode {
8
- SIMULATION = 'SIMULATION',
9
- DRY_RUN = 'DRY_RUN',
10
- LIVE = 'LIVE',
11
- }
1
+ /**
2
+ * How a run was made.
3
+ * - SIMULATION: nothing is executed, effects are recorded, the Store is a scratch copy thrown away.
4
+ * - DRY_RUN: Store reads are real, writes are recorded and not executed.
5
+ * - LIVE: an execution of the edge on a promoted version.
6
+ */
7
+ export enum RunMode {
8
+ SIMULATION = 'SIMULATION',
9
+ DRY_RUN = 'DRY_RUN',
10
+ LIVE = 'LIVE',
11
+ }
@@ -1,11 +1,11 @@
1
- export enum RunStatus {
2
- /** A live execution accepted and not finished yet (an async caller reads it by its id). */
3
- RUNNING = 'RUNNING',
4
- SUCCEEDED = 'SUCCEEDED',
5
- FAILED = 'FAILED',
6
- /**
7
- * A live execution stopped by the end of a pod of the edge or of the runner: offered (cost 0), kept in
8
- * the journal with its measures up to the interruption, left out of every statistic.
9
- */
10
- INTERRUPTED = 'INTERRUPTED',
11
- }
1
+ export enum RunStatus {
2
+ /** A live execution accepted and not finished yet (an async caller reads it by its id). */
3
+ RUNNING = 'RUNNING',
4
+ SUCCEEDED = 'SUCCEEDED',
5
+ FAILED = 'FAILED',
6
+ /**
7
+ * A live execution stopped by the end of a pod of the edge or of the runner: offered (cost 0), kept in
8
+ * the journal with its measures up to the interruption, left out of every statistic.
9
+ */
10
+ INTERRUPTED = 'INTERRUPTED',
11
+ }