@abyss-project/reflex 5.2.0 → 5.3.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 +9 -0
- package/dist/api/service-task.api.js +24 -0
- package/dist/api/service-task.api.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/types/enum/index.d.ts +2 -0
- package/dist/types/enum/index.js +2 -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-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/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 +54 -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 +31 -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 +35 -0
- package/dist/types/interface/models/reflex-task.model.js +15 -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 +124 -0
- package/src/api/service-task.api.ts +122 -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 +264 -237
- package/src/types/enum/index.ts +2 -0
- 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-origin.enum.ts +5 -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 +66 -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 +48 -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 +61 -0
package/src/index.ts
CHANGED
|
@@ -1,237 +1,264 @@
|
|
|
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 functionTestApi from './api/function-test.api';
|
|
6
|
-
import * as functionVersionApi from './api/function-version.api';
|
|
7
|
-
import * as functionRunApi from './api/function-run.api';
|
|
8
|
-
import * as functionSettingsApi from './api/function-settings.api';
|
|
9
|
-
import * as serviceApi from './api/service.api';
|
|
10
|
-
import * as serviceRouteApi from './api/service-route.api';
|
|
11
|
-
import * as serviceVersionApi from './api/service-version.api';
|
|
12
|
-
import * as serviceDeploymentApi from './api/service-deployment.api';
|
|
13
|
-
import * as serviceConfigurationApi from './api/service-configuration.api';
|
|
14
|
-
import * as serviceDiscordApi from './api/service-discord.api';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export * from './
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
token
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
health
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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 functionTestApi from './api/function-test.api';
|
|
6
|
+
import * as functionVersionApi from './api/function-version.api';
|
|
7
|
+
import * as functionRunApi from './api/function-run.api';
|
|
8
|
+
import * as functionSettingsApi from './api/function-settings.api';
|
|
9
|
+
import * as serviceApi from './api/service.api';
|
|
10
|
+
import * as serviceRouteApi from './api/service-route.api';
|
|
11
|
+
import * as serviceVersionApi from './api/service-version.api';
|
|
12
|
+
import * as serviceDeploymentApi from './api/service-deployment.api';
|
|
13
|
+
import * as serviceConfigurationApi from './api/service-configuration.api';
|
|
14
|
+
import * as serviceDiscordApi from './api/service-discord.api';
|
|
15
|
+
import * as serviceTaskApi from './api/service-task.api';
|
|
16
|
+
|
|
17
|
+
export * from './api';
|
|
18
|
+
export * from './types';
|
|
19
|
+
|
|
20
|
+
const DEFAULT_BASE_URL = 'https://reflex-api.abyss-project.fr/';
|
|
21
|
+
|
|
22
|
+
type CoreConfig = {
|
|
23
|
+
baseURL?: string;
|
|
24
|
+
/** The session token of the member (`Authorization: Bearer`). Every route but `health` needs it. */
|
|
25
|
+
token?: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type AbyssReflexCoreSDK = {
|
|
29
|
+
/** `GET /health` — status of the database and Redis behind the API. */
|
|
30
|
+
health: typeof healthApi.health;
|
|
31
|
+
function: {
|
|
32
|
+
list: typeof functionApi.listFunction;
|
|
33
|
+
create: typeof functionApi.createFunction;
|
|
34
|
+
get: typeof functionApi.getFunction;
|
|
35
|
+
update: typeof functionApi.updateFunction;
|
|
36
|
+
delete: typeof functionApi.deleteFunction;
|
|
37
|
+
access: {
|
|
38
|
+
list: typeof functionAccessApi.listFunctionAccess;
|
|
39
|
+
grant: typeof functionAccessApi.grantFunctionAccess;
|
|
40
|
+
revoke: typeof functionAccessApi.revokeFunctionAccess;
|
|
41
|
+
};
|
|
42
|
+
test: {
|
|
43
|
+
simulate: typeof functionTestApi.simulateFunction;
|
|
44
|
+
dryRun: typeof functionTestApi.dryRunFunction;
|
|
45
|
+
};
|
|
46
|
+
version: {
|
|
47
|
+
list: typeof functionVersionApi.listFunctionVersion;
|
|
48
|
+
get: typeof functionVersionApi.getFunctionVersion;
|
|
49
|
+
stepStats: typeof functionVersionApi.getFunctionVersionStepStats;
|
|
50
|
+
};
|
|
51
|
+
run: {
|
|
52
|
+
list: typeof functionRunApi.listFunctionRun;
|
|
53
|
+
get: typeof functionRunApi.getFunctionRun;
|
|
54
|
+
state: typeof functionRunApi.getFunctionRunState;
|
|
55
|
+
};
|
|
56
|
+
settings: {
|
|
57
|
+
get: typeof functionSettingsApi.getFunctionSettings;
|
|
58
|
+
setDefault: typeof functionSettingsApi.setFunctionDefaultSettings;
|
|
59
|
+
setEnvironment: typeof functionSettingsApi.setFunctionEnvironmentSettings;
|
|
60
|
+
removeEnvironment: typeof functionSettingsApi.removeFunctionEnvironmentSettings;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
/** Services: the unit versioned, put in service and paused as one (`/api/service/:applicationId/...`). */
|
|
64
|
+
service: {
|
|
65
|
+
list: typeof serviceApi.listService;
|
|
66
|
+
create: typeof serviceApi.createService;
|
|
67
|
+
get: typeof serviceApi.getService;
|
|
68
|
+
update: typeof serviceApi.updateService;
|
|
69
|
+
delete: typeof serviceApi.deleteService;
|
|
70
|
+
route: {
|
|
71
|
+
list: typeof serviceRouteApi.listServiceRoute;
|
|
72
|
+
create: typeof serviceRouteApi.createServiceRoute;
|
|
73
|
+
update: typeof serviceRouteApi.updateServiceRoute;
|
|
74
|
+
delete: typeof serviceRouteApi.deleteServiceRoute;
|
|
75
|
+
rotate: typeof serviceRouteApi.rotateServiceRoute;
|
|
76
|
+
};
|
|
77
|
+
version: {
|
|
78
|
+
list: typeof serviceVersionApi.listServiceVersion;
|
|
79
|
+
create: typeof serviceVersionApi.createServiceVersion;
|
|
80
|
+
get: typeof serviceVersionApi.getServiceVersion;
|
|
81
|
+
draftStatus: typeof serviceVersionApi.getServiceVersionDraftStatus;
|
|
82
|
+
};
|
|
83
|
+
deployment: {
|
|
84
|
+
list: typeof serviceDeploymentApi.listServiceDeployment;
|
|
85
|
+
goLive: typeof serviceDeploymentApi.goLiveService;
|
|
86
|
+
rollback: typeof serviceDeploymentApi.rollbackService;
|
|
87
|
+
pause: typeof serviceDeploymentApi.pauseService;
|
|
88
|
+
resume: typeof serviceDeploymentApi.resumeService;
|
|
89
|
+
};
|
|
90
|
+
configuration: {
|
|
91
|
+
list: typeof serviceConfigurationApi.listServiceConfiguration;
|
|
92
|
+
};
|
|
93
|
+
/** A Discord bot Service: its commands and components, its connection, the push to Discord. */
|
|
94
|
+
discord: {
|
|
95
|
+
command: {
|
|
96
|
+
list: typeof serviceDiscordApi.listServiceDiscordCommand;
|
|
97
|
+
create: typeof serviceDiscordApi.createServiceDiscordCommand;
|
|
98
|
+
update: typeof serviceDiscordApi.updateServiceDiscordCommand;
|
|
99
|
+
delete: typeof serviceDiscordApi.deleteServiceDiscordCommand;
|
|
100
|
+
};
|
|
101
|
+
component: {
|
|
102
|
+
list: typeof serviceDiscordApi.listServiceDiscordComponent;
|
|
103
|
+
create: typeof serviceDiscordApi.createServiceDiscordComponent;
|
|
104
|
+
update: typeof serviceDiscordApi.updateServiceDiscordComponent;
|
|
105
|
+
delete: typeof serviceDiscordApi.deleteServiceDiscordComponent;
|
|
106
|
+
};
|
|
107
|
+
connection: {
|
|
108
|
+
get: typeof serviceDiscordApi.getServiceDiscordConnection;
|
|
109
|
+
setTokenSecret: typeof serviceDiscordApi.setServiceDiscordTokenSecret;
|
|
110
|
+
setEnvironment: typeof serviceDiscordApi.setServiceDiscordEnvironment;
|
|
111
|
+
check: typeof serviceDiscordApi.checkServiceDiscordConnection;
|
|
112
|
+
};
|
|
113
|
+
/** Pushes the interactions address and the commands to Discord again. */
|
|
114
|
+
sync: typeof serviceDiscordApi.retryServiceDiscordSync;
|
|
115
|
+
};
|
|
116
|
+
/** The tasks of the Service (cron and delayed runs), their delayed runs, the synchronization with Flow. */
|
|
117
|
+
task: {
|
|
118
|
+
list: typeof serviceTaskApi.listServiceTask;
|
|
119
|
+
create: typeof serviceTaskApi.createServiceTask;
|
|
120
|
+
update: typeof serviceTaskApi.updateServiceTask;
|
|
121
|
+
delete: typeof serviceTaskApi.deleteServiceTask;
|
|
122
|
+
testRun: typeof serviceTaskApi.testRunServiceTask;
|
|
123
|
+
delayedRun: {
|
|
124
|
+
list: typeof serviceTaskApi.listServiceDelayedRun;
|
|
125
|
+
cancel: typeof serviceTaskApi.cancelServiceDelayedRun;
|
|
126
|
+
};
|
|
127
|
+
/** Synchronizes the cron tasks of the version in service with Flow again. */
|
|
128
|
+
sync: typeof serviceTaskApi.retryServiceScheduleSync;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export class AbyssReflexCore {
|
|
134
|
+
private static config: CoreConfig = {
|
|
135
|
+
baseURL: DEFAULT_BASE_URL,
|
|
136
|
+
};
|
|
137
|
+
static axios = axios.create({
|
|
138
|
+
baseURL: DEFAULT_BASE_URL,
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
private static _sdk: AbyssReflexCoreSDK | null = null;
|
|
142
|
+
|
|
143
|
+
public static get sdk(): AbyssReflexCoreSDK {
|
|
144
|
+
if (!AbyssReflexCore._sdk) {
|
|
145
|
+
AbyssReflexCore._sdk = {
|
|
146
|
+
health: healthApi.health,
|
|
147
|
+
function: {
|
|
148
|
+
list: functionApi.listFunction,
|
|
149
|
+
create: functionApi.createFunction,
|
|
150
|
+
get: functionApi.getFunction,
|
|
151
|
+
update: functionApi.updateFunction,
|
|
152
|
+
delete: functionApi.deleteFunction,
|
|
153
|
+
access: {
|
|
154
|
+
list: functionAccessApi.listFunctionAccess,
|
|
155
|
+
grant: functionAccessApi.grantFunctionAccess,
|
|
156
|
+
revoke: functionAccessApi.revokeFunctionAccess,
|
|
157
|
+
},
|
|
158
|
+
test: {
|
|
159
|
+
simulate: functionTestApi.simulateFunction,
|
|
160
|
+
dryRun: functionTestApi.dryRunFunction,
|
|
161
|
+
},
|
|
162
|
+
version: {
|
|
163
|
+
list: functionVersionApi.listFunctionVersion,
|
|
164
|
+
get: functionVersionApi.getFunctionVersion,
|
|
165
|
+
stepStats: functionVersionApi.getFunctionVersionStepStats,
|
|
166
|
+
},
|
|
167
|
+
run: {
|
|
168
|
+
list: functionRunApi.listFunctionRun,
|
|
169
|
+
get: functionRunApi.getFunctionRun,
|
|
170
|
+
state: functionRunApi.getFunctionRunState,
|
|
171
|
+
},
|
|
172
|
+
settings: {
|
|
173
|
+
get: functionSettingsApi.getFunctionSettings,
|
|
174
|
+
setDefault: functionSettingsApi.setFunctionDefaultSettings,
|
|
175
|
+
setEnvironment: functionSettingsApi.setFunctionEnvironmentSettings,
|
|
176
|
+
removeEnvironment: functionSettingsApi.removeFunctionEnvironmentSettings,
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
service: {
|
|
180
|
+
list: serviceApi.listService,
|
|
181
|
+
create: serviceApi.createService,
|
|
182
|
+
get: serviceApi.getService,
|
|
183
|
+
update: serviceApi.updateService,
|
|
184
|
+
delete: serviceApi.deleteService,
|
|
185
|
+
route: {
|
|
186
|
+
list: serviceRouteApi.listServiceRoute,
|
|
187
|
+
create: serviceRouteApi.createServiceRoute,
|
|
188
|
+
update: serviceRouteApi.updateServiceRoute,
|
|
189
|
+
delete: serviceRouteApi.deleteServiceRoute,
|
|
190
|
+
rotate: serviceRouteApi.rotateServiceRoute,
|
|
191
|
+
},
|
|
192
|
+
version: {
|
|
193
|
+
list: serviceVersionApi.listServiceVersion,
|
|
194
|
+
create: serviceVersionApi.createServiceVersion,
|
|
195
|
+
get: serviceVersionApi.getServiceVersion,
|
|
196
|
+
draftStatus: serviceVersionApi.getServiceVersionDraftStatus,
|
|
197
|
+
},
|
|
198
|
+
deployment: {
|
|
199
|
+
list: serviceDeploymentApi.listServiceDeployment,
|
|
200
|
+
goLive: serviceDeploymentApi.goLiveService,
|
|
201
|
+
rollback: serviceDeploymentApi.rollbackService,
|
|
202
|
+
pause: serviceDeploymentApi.pauseService,
|
|
203
|
+
resume: serviceDeploymentApi.resumeService,
|
|
204
|
+
},
|
|
205
|
+
configuration: {
|
|
206
|
+
list: serviceConfigurationApi.listServiceConfiguration,
|
|
207
|
+
},
|
|
208
|
+
discord: {
|
|
209
|
+
command: {
|
|
210
|
+
list: serviceDiscordApi.listServiceDiscordCommand,
|
|
211
|
+
create: serviceDiscordApi.createServiceDiscordCommand,
|
|
212
|
+
update: serviceDiscordApi.updateServiceDiscordCommand,
|
|
213
|
+
delete: serviceDiscordApi.deleteServiceDiscordCommand,
|
|
214
|
+
},
|
|
215
|
+
component: {
|
|
216
|
+
list: serviceDiscordApi.listServiceDiscordComponent,
|
|
217
|
+
create: serviceDiscordApi.createServiceDiscordComponent,
|
|
218
|
+
update: serviceDiscordApi.updateServiceDiscordComponent,
|
|
219
|
+
delete: serviceDiscordApi.deleteServiceDiscordComponent,
|
|
220
|
+
},
|
|
221
|
+
connection: {
|
|
222
|
+
get: serviceDiscordApi.getServiceDiscordConnection,
|
|
223
|
+
setTokenSecret: serviceDiscordApi.setServiceDiscordTokenSecret,
|
|
224
|
+
setEnvironment: serviceDiscordApi.setServiceDiscordEnvironment,
|
|
225
|
+
check: serviceDiscordApi.checkServiceDiscordConnection,
|
|
226
|
+
},
|
|
227
|
+
sync: serviceDiscordApi.retryServiceDiscordSync,
|
|
228
|
+
},
|
|
229
|
+
task: {
|
|
230
|
+
list: serviceTaskApi.listServiceTask,
|
|
231
|
+
create: serviceTaskApi.createServiceTask,
|
|
232
|
+
update: serviceTaskApi.updateServiceTask,
|
|
233
|
+
delete: serviceTaskApi.deleteServiceTask,
|
|
234
|
+
testRun: serviceTaskApi.testRunServiceTask,
|
|
235
|
+
delayedRun: {
|
|
236
|
+
list: serviceTaskApi.listServiceDelayedRun,
|
|
237
|
+
cancel: serviceTaskApi.cancelServiceDelayedRun,
|
|
238
|
+
},
|
|
239
|
+
sync: serviceTaskApi.retryServiceScheduleSync,
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
return AbyssReflexCore._sdk;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
public static setConfig(config: CoreConfig): void {
|
|
248
|
+
AbyssReflexCore._sdk = null;
|
|
249
|
+
|
|
250
|
+
AbyssReflexCore.config = { ...AbyssReflexCore.config, ...config };
|
|
251
|
+
|
|
252
|
+
if (config.baseURL) {
|
|
253
|
+
AbyssReflexCore.axios.defaults.baseURL = config.baseURL;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (config.token) {
|
|
257
|
+
AbyssReflexCore.axios.defaults.headers.common.Authorization = `Bearer ${config.token}`;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
public static getConfig(): CoreConfig {
|
|
262
|
+
return AbyssReflexCore.config;
|
|
263
|
+
}
|
|
264
|
+
}
|
package/src/types/enum/index.ts
CHANGED
|
@@ -27,3 +27,5 @@ export * from './discord-presence-status.enum';
|
|
|
27
27
|
export * from './discord-activity-type.enum';
|
|
28
28
|
export * from './discord-gateway-state.enum';
|
|
29
29
|
export * from './discord-gateway-failure-code.enum';
|
|
30
|
+
export * from './schedule-sync-status.enum';
|
|
31
|
+
export * from './scheduled-run-origin.enum';
|
|
@@ -34,4 +34,6 @@ export enum ReflexErrorCode {
|
|
|
34
34
|
DISCORD_COMPONENT_PREFIX_CONFLICT = 'DISCORD_COMPONENT_PREFIX_CONFLICT',
|
|
35
35
|
/** 400: the field does not exist for this type of Service (CORS or rate limit on a Discord bot). */
|
|
36
36
|
SERVICE_TYPE_FIELD_REFUSED = 'SERVICE_TYPE_FIELD_REFUSED',
|
|
37
|
+
/** 400: a route path cannot start with `_abyss`, the segment the edge keeps for its own addresses (ticks of the cron tasks). */
|
|
38
|
+
ROUTE_SEGMENT_RESERVED = 'ROUTE_SEGMENT_RESERVED',
|
|
37
39
|
}
|
|
@@ -10,6 +10,10 @@ export interface IListFunctionRunQuery {
|
|
|
10
10
|
limit?: number;
|
|
11
11
|
/** Runs skipped, newest first; 0 by default. */
|
|
12
12
|
offset?: number;
|
|
13
|
+
/** Only the live runs this task started (a tick of its cron or a delayed run); test runs have no task. */
|
|
14
|
+
taskId?: string;
|
|
15
|
+
/** Only the runs of this environment of the application (abyss-main's id). */
|
|
16
|
+
environmentId?: string;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
export interface IGetFunctionRunParams {
|
|
@@ -10,15 +10,30 @@ export interface IReflexHttpStub {
|
|
|
10
10
|
body?: unknown;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* The answer a `discord.*` call of a step gets in a test; nothing reaches Discord. Without a stub the
|
|
15
|
+
* call gets a simulated answer of the shape the edge returns (`{ id }` of a message, a member, a channel...).
|
|
16
|
+
*/
|
|
17
|
+
export interface IReflexDiscordStub {
|
|
18
|
+
/** What the call returns: `null` for `getMember` reads as a user who is not a member. */
|
|
19
|
+
response: unknown;
|
|
20
|
+
}
|
|
21
|
+
|
|
13
22
|
export interface ISimulateFunctionBody {
|
|
14
23
|
/**
|
|
15
24
|
* The environment of the application the run takes place in (abyss-main's id): a dry run reads its
|
|
16
25
|
* Store, the run is measured with its effective settings and recorded with it.
|
|
17
26
|
*/
|
|
18
27
|
environmentId: string;
|
|
19
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* The event the function receives, as the edge builds it: `{method, path, query, headers, body}`, or the
|
|
30
|
+
* input of a run of a task (`ScheduledRunInput` of `@abyss-project/runtime`, `kind` SCHEDULE or DELAYED),
|
|
31
|
+
* which no interaction started: `discord.reply`, `update`, `showModal` and `followUp` then reject with `NO_INTERACTION`.
|
|
32
|
+
*/
|
|
20
33
|
input?: unknown;
|
|
21
34
|
/** Simulated responses of HTTP steps, by step id. */
|
|
22
35
|
httpStubs?: Record<string, IReflexHttpStub>;
|
|
36
|
+
/** Answers of the `discord.*` calls of a step, by step id (a Discord bot Service only). */
|
|
37
|
+
discordStubs?: Record<string, IReflexDiscordStub>;
|
|
23
38
|
}
|
|
24
39
|
export type IDryRunFunctionBody = ISimulateFunctionBody;
|