@abyss-project/reflex 5.2.0 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/service-task.api.d.ts +10 -0
- package/dist/api/service-task.api.js +26 -0
- package/dist/api/service-task.api.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/types/enum/index.d.ts +4 -0
- package/dist/types/enum/index.js +4 -0
- package/dist/types/enum/index.js.map +1 -1
- package/dist/types/enum/reflex-error-code.enum.d.ts +2 -1
- package/dist/types/enum/reflex-error-code.enum.js +1 -0
- package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
- package/dist/types/enum/schedule-sync-status.enum.d.ts +5 -0
- package/dist/types/enum/schedule-sync-status.enum.js +10 -0
- package/dist/types/enum/schedule-sync-status.enum.js.map +1 -0
- package/dist/types/enum/scheduled-run-failure-code.enum.d.ts +4 -0
- package/dist/types/enum/scheduled-run-failure-code.enum.js +9 -0
- package/dist/types/enum/scheduled-run-failure-code.enum.js.map +1 -0
- package/dist/types/enum/scheduled-run-origin.enum.d.ts +4 -0
- package/dist/types/enum/scheduled-run-origin.enum.js +9 -0
- package/dist/types/enum/scheduled-run-origin.enum.js.map +1 -0
- package/dist/types/enum/scheduled-run-status.enum.d.ts +9 -0
- package/dist/types/enum/scheduled-run-status.enum.js +14 -0
- package/dist/types/enum/scheduled-run-status.enum.js.map +1 -0
- package/dist/types/interface/api/requests/function-run.request.d.ts +2 -0
- package/dist/types/interface/api/requests/function-test.request.d.ts +4 -0
- package/dist/types/interface/api/requests/index.d.ts +1 -0
- package/dist/types/interface/api/requests/index.js +1 -0
- package/dist/types/interface/api/requests/index.js.map +1 -1
- package/dist/types/interface/api/requests/service-task.request.d.ts +64 -0
- package/dist/types/interface/api/requests/service-task.request.js +3 -0
- package/dist/types/interface/api/requests/service-task.request.js.map +1 -0
- package/dist/types/interface/api/responses/index.d.ts +1 -0
- package/dist/types/interface/api/responses/index.js +1 -0
- package/dist/types/interface/api/responses/index.js.map +1 -1
- package/dist/types/interface/api/responses/service-task.response.d.ts +36 -0
- package/dist/types/interface/api/responses/service-task.response.js +3 -0
- package/dist/types/interface/api/responses/service-task.response.js.map +1 -0
- package/dist/types/interface/api/responses/service-version.response.d.ts +9 -1
- package/dist/types/interface/models/index.d.ts +1 -0
- package/dist/types/interface/models/index.js +1 -0
- package/dist/types/interface/models/index.js.map +1 -1
- package/dist/types/interface/models/reflex-run.model.d.ts +3 -1
- package/dist/types/interface/models/reflex-service-deployment.model.d.ts +4 -1
- package/dist/types/interface/models/reflex-service-version.model.d.ts +2 -0
- package/dist/types/interface/models/reflex-task.model.d.ts +48 -0
- package/dist/types/interface/models/reflex-task.model.js +16 -0
- package/dist/types/interface/models/reflex-task.model.js.map +1 -0
- package/package.json +1 -1
- package/src/api/function-access.api.ts +36 -36
- package/src/api/function-run.api.ts +38 -38
- package/src/api/function-settings.api.ts +59 -59
- package/src/api/function-test.api.ts +34 -34
- package/src/api/function-version.api.ts +48 -48
- package/src/api/function.api.test.ts +249 -249
- package/src/api/function.api.ts +62 -62
- package/src/api/health.api.ts +10 -10
- package/src/api/index.ts +14 -13
- package/src/api/service-configuration.api.ts +16 -16
- package/src/api/service-deployment.api.ts +79 -79
- package/src/api/service-discord.api.test.ts +170 -170
- package/src/api/service-discord.api.ts +203 -203
- package/src/api/service-route.api.ts +72 -72
- package/src/api/service-task.api.test.ts +140 -0
- package/src/api/service-task.api.ts +141 -0
- package/src/api/service-version.api.ts +54 -54
- package/src/api/service.api.test.ts +215 -215
- package/src/api/service.api.ts +55 -55
- package/src/index.ts +34 -0
- package/src/types/enum/index.ts +33 -29
- package/src/types/enum/reflex-error-code.enum.ts +2 -0
- package/src/types/enum/schedule-sync-status.enum.ts +6 -0
- package/src/types/enum/scheduled-run-failure-code.enum.ts +10 -0
- package/src/types/enum/scheduled-run-origin.enum.ts +5 -0
- package/src/types/enum/scheduled-run-status.enum.ts +17 -0
- package/src/types/interface/api/requests/function-run.request.ts +4 -0
- package/src/types/interface/api/requests/function-test.request.ts +16 -1
- package/src/types/interface/api/requests/index.ts +1 -0
- package/src/types/interface/api/requests/service-task.request.ts +80 -0
- package/src/types/interface/api/requests/service-version.request.ts +24 -24
- package/src/types/interface/api/responses/index.ts +1 -0
- package/src/types/interface/api/responses/service-task.response.ts +57 -0
- package/src/types/interface/api/responses/service-version.response.ts +91 -73
- package/src/types/interface/models/index.ts +1 -0
- package/src/types/interface/models/reflex-run.model.ts +7 -1
- package/src/types/interface/models/reflex-service-deployment.model.ts +6 -0
- package/src/types/interface/models/reflex-service-version.model.ts +3 -0
- package/src/types/interface/models/reflex-task.model.ts +97 -0
|
@@ -1,203 +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;
|
|
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;
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { AbyssReflexCore } from '..';
|
|
2
|
-
import type {
|
|
3
|
-
ICreateServiceRouteBody,
|
|
4
|
-
ICreateServiceRouteParams,
|
|
5
|
-
ICreateServiceRouteResponse,
|
|
6
|
-
IDeleteServiceRouteParams,
|
|
7
|
-
IDeleteServiceRouteResponse,
|
|
8
|
-
IListServiceRouteParams,
|
|
9
|
-
IListServiceRouteResponse,
|
|
10
|
-
IRotateServiceRouteParams,
|
|
11
|
-
IRotateServiceRouteResponse,
|
|
12
|
-
IUpdateServiceRouteBody,
|
|
13
|
-
IUpdateServiceRouteParams,
|
|
14
|
-
IUpdateServiceRouteResponse,
|
|
15
|
-
} from '../types';
|
|
16
|
-
|
|
17
|
-
const routeUrl = (params: { applicationId: string; serviceId: string }): string =>
|
|
18
|
-
`api/service/${params.applicationId}/${params.serviceId}/route`;
|
|
19
|
-
|
|
20
|
-
/** `GET .../route`: the routes of the draft, by path then method. Needs REFLEX_READ. */
|
|
21
|
-
export const listServiceRoute = async (
|
|
22
|
-
params: IListServiceRouteParams,
|
|
23
|
-
): Promise<IListServiceRouteResponse> =>
|
|
24
|
-
(await AbyssReflexCore.axios.get<IListServiceRouteResponse>(routeUrl(params))).data;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* `POST .../route`: a route of the draft, served once a version holding it is in service. The key or
|
|
28
|
-
* signing secret comes back once. `409 ROUTE_CONFLICT` when it would hide another route. Needs
|
|
29
|
-
* REFLEX_FUNCTION_UPDATE.
|
|
30
|
-
*/
|
|
31
|
-
export const createServiceRoute = async (
|
|
32
|
-
params: ICreateServiceRouteParams,
|
|
33
|
-
body: ICreateServiceRouteBody,
|
|
34
|
-
): Promise<ICreateServiceRouteResponse> =>
|
|
35
|
-
(await AbyssReflexCore.axios.post<ICreateServiceRouteResponse>(routeUrl(params), body)).data;
|
|
36
|
-
|
|
37
|
-
/** `PATCH .../route/:routeId`: changes the route in the draft. Needs REFLEX_FUNCTION_UPDATE. */
|
|
38
|
-
export const updateServiceRoute = async (
|
|
39
|
-
params: IUpdateServiceRouteParams,
|
|
40
|
-
body: IUpdateServiceRouteBody,
|
|
41
|
-
): Promise<IUpdateServiceRouteResponse> =>
|
|
42
|
-
(
|
|
43
|
-
await AbyssReflexCore.axios.patch<IUpdateServiceRouteResponse>(
|
|
44
|
-
`${routeUrl(params)}/${params.routeId}`,
|
|
45
|
-
body,
|
|
46
|
-
)
|
|
47
|
-
).data;
|
|
48
|
-
|
|
49
|
-
/** `DELETE .../route/:routeId`: takes the route out of the draft. Needs REFLEX_FUNCTION_UPDATE. */
|
|
50
|
-
export const deleteServiceRoute = async (
|
|
51
|
-
params: IDeleteServiceRouteParams,
|
|
52
|
-
): Promise<IDeleteServiceRouteResponse> =>
|
|
53
|
-
(
|
|
54
|
-
await AbyssReflexCore.axios.delete<IDeleteServiceRouteResponse>(
|
|
55
|
-
`${routeUrl(params)}/${params.routeId}`,
|
|
56
|
-
)
|
|
57
|
-
).data;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* `POST .../route/:routeId/rotate`: a new key or signing secret, shown once, served at once wherever the
|
|
61
|
-
* route is in service. Needs REFLEX_PUBLISH, and REFLEX_PUBLISH_PRODUCTION when a production
|
|
62
|
-
* environment serves the route.
|
|
63
|
-
*/
|
|
64
|
-
export const rotateServiceRoute = async (
|
|
65
|
-
params: IRotateServiceRouteParams,
|
|
66
|
-
): Promise<IRotateServiceRouteResponse> =>
|
|
67
|
-
(
|
|
68
|
-
await AbyssReflexCore.axios.post<IRotateServiceRouteResponse>(
|
|
69
|
-
`${routeUrl(params)}/${params.routeId}/rotate`,
|
|
70
|
-
{},
|
|
71
|
-
)
|
|
72
|
-
).data;
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type {
|
|
3
|
+
ICreateServiceRouteBody,
|
|
4
|
+
ICreateServiceRouteParams,
|
|
5
|
+
ICreateServiceRouteResponse,
|
|
6
|
+
IDeleteServiceRouteParams,
|
|
7
|
+
IDeleteServiceRouteResponse,
|
|
8
|
+
IListServiceRouteParams,
|
|
9
|
+
IListServiceRouteResponse,
|
|
10
|
+
IRotateServiceRouteParams,
|
|
11
|
+
IRotateServiceRouteResponse,
|
|
12
|
+
IUpdateServiceRouteBody,
|
|
13
|
+
IUpdateServiceRouteParams,
|
|
14
|
+
IUpdateServiceRouteResponse,
|
|
15
|
+
} from '../types';
|
|
16
|
+
|
|
17
|
+
const routeUrl = (params: { applicationId: string; serviceId: string }): string =>
|
|
18
|
+
`api/service/${params.applicationId}/${params.serviceId}/route`;
|
|
19
|
+
|
|
20
|
+
/** `GET .../route`: the routes of the draft, by path then method. Needs REFLEX_READ. */
|
|
21
|
+
export const listServiceRoute = async (
|
|
22
|
+
params: IListServiceRouteParams,
|
|
23
|
+
): Promise<IListServiceRouteResponse> =>
|
|
24
|
+
(await AbyssReflexCore.axios.get<IListServiceRouteResponse>(routeUrl(params))).data;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* `POST .../route`: a route of the draft, served once a version holding it is in service. The key or
|
|
28
|
+
* signing secret comes back once. `409 ROUTE_CONFLICT` when it would hide another route. Needs
|
|
29
|
+
* REFLEX_FUNCTION_UPDATE.
|
|
30
|
+
*/
|
|
31
|
+
export const createServiceRoute = async (
|
|
32
|
+
params: ICreateServiceRouteParams,
|
|
33
|
+
body: ICreateServiceRouteBody,
|
|
34
|
+
): Promise<ICreateServiceRouteResponse> =>
|
|
35
|
+
(await AbyssReflexCore.axios.post<ICreateServiceRouteResponse>(routeUrl(params), body)).data;
|
|
36
|
+
|
|
37
|
+
/** `PATCH .../route/:routeId`: changes the route in the draft. Needs REFLEX_FUNCTION_UPDATE. */
|
|
38
|
+
export const updateServiceRoute = async (
|
|
39
|
+
params: IUpdateServiceRouteParams,
|
|
40
|
+
body: IUpdateServiceRouteBody,
|
|
41
|
+
): Promise<IUpdateServiceRouteResponse> =>
|
|
42
|
+
(
|
|
43
|
+
await AbyssReflexCore.axios.patch<IUpdateServiceRouteResponse>(
|
|
44
|
+
`${routeUrl(params)}/${params.routeId}`,
|
|
45
|
+
body,
|
|
46
|
+
)
|
|
47
|
+
).data;
|
|
48
|
+
|
|
49
|
+
/** `DELETE .../route/:routeId`: takes the route out of the draft. Needs REFLEX_FUNCTION_UPDATE. */
|
|
50
|
+
export const deleteServiceRoute = async (
|
|
51
|
+
params: IDeleteServiceRouteParams,
|
|
52
|
+
): Promise<IDeleteServiceRouteResponse> =>
|
|
53
|
+
(
|
|
54
|
+
await AbyssReflexCore.axios.delete<IDeleteServiceRouteResponse>(
|
|
55
|
+
`${routeUrl(params)}/${params.routeId}`,
|
|
56
|
+
)
|
|
57
|
+
).data;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* `POST .../route/:routeId/rotate`: a new key or signing secret, shown once, served at once wherever the
|
|
61
|
+
* route is in service. Needs REFLEX_PUBLISH, and REFLEX_PUBLISH_PRODUCTION when a production
|
|
62
|
+
* environment serves the route.
|
|
63
|
+
*/
|
|
64
|
+
export const rotateServiceRoute = async (
|
|
65
|
+
params: IRotateServiceRouteParams,
|
|
66
|
+
): Promise<IRotateServiceRouteResponse> =>
|
|
67
|
+
(
|
|
68
|
+
await AbyssReflexCore.axios.post<IRotateServiceRouteResponse>(
|
|
69
|
+
`${routeUrl(params)}/${params.routeId}/rotate`,
|
|
70
|
+
{},
|
|
71
|
+
)
|
|
72
|
+
).data;
|