@abyss-project/reflex 5.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.
- package/dist/types/enum/discord-activity-type.enum.d.ts +7 -0
- package/dist/types/enum/discord-activity-type.enum.js +12 -0
- package/dist/types/enum/discord-activity-type.enum.js.map +1 -0
- package/dist/types/enum/discord-gateway-failure-code.enum.d.ts +5 -0
- package/dist/types/enum/discord-gateway-failure-code.enum.js +10 -0
- package/dist/types/enum/discord-gateway-failure-code.enum.js.map +1 -0
- package/dist/types/enum/discord-gateway-state.enum.d.ts +6 -0
- package/dist/types/enum/discord-gateway-state.enum.js +11 -0
- package/dist/types/enum/discord-gateway-state.enum.js.map +1 -0
- package/dist/types/enum/discord-presence-status.enum.d.ts +5 -0
- package/dist/types/enum/discord-presence-status.enum.js +10 -0
- package/dist/types/enum/discord-presence-status.enum.js.map +1 -0
- 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/interface/api/requests/service-discord.request.d.ts +4 -1
- package/dist/types/interface/models/reflex-discord.model.d.ts +14 -1
- package/dist/types/interface/models/reflex-discord.model.js.map +1 -1
- package/package.json +15 -10
- package/src/api/service-discord.api.test.ts +170 -170
- package/src/api/service-discord.api.ts +203 -203
- package/src/index.ts +235 -235
- package/src/types/enum/access-grant-status.enum.ts +12 -12
- package/src/types/enum/access-kind.enum.ts +7 -7
- package/src/types/enum/configuration-read-as.enum.ts +5 -5
- package/src/types/enum/discord-activity-type.enum.ts +9 -0
- package/src/types/enum/discord-gateway-failure-code.enum.ts +9 -0
- package/src/types/enum/discord-gateway-state.enum.ts +11 -0
- package/src/types/enum/discord-presence-status.enum.ts +8 -0
- package/src/types/enum/execution-mode.enum.ts +9 -9
- package/src/types/enum/execution-profile.enum.ts +20 -20
- package/src/types/enum/execution-settings-source.enum.ts +9 -9
- package/src/types/enum/health-status.enum.ts +4 -4
- package/src/types/enum/index.ts +29 -25
- package/src/types/enum/reflex-error-code.enum.ts +37 -37
- package/src/types/enum/route-method.enum.ts +9 -9
- package/src/types/enum/run-log-level.enum.ts +6 -6
- package/src/types/enum/run-mode.enum.ts +11 -11
- package/src/types/enum/run-status.enum.ts +11 -11
- package/src/types/enum/run-step-status.enum.ts +7 -7
- package/src/types/enum/service-deployment-action.enum.ts +11 -11
- package/src/types/enum/service-deployment-status.enum.ts +5 -5
- package/src/types/enum/service-type.enum.ts +9 -9
- package/src/types/enum/service-version-change-kind.enum.ts +6 -6
- package/src/types/enum/trace-effect-type.enum.ts +12 -12
- package/src/types/enum/trigger-access-mode.enum.ts +12 -12
- package/src/types/enum/vault-value-source.enum.ts +12 -12
- package/src/types/enum/vault-visibility.enum.ts +5 -5
- package/src/types/index.ts +2 -2
- package/src/types/interface/api/index.ts +3 -3
- package/src/types/interface/api/requests/function-access.request.ts +25 -25
- package/src/types/interface/api/requests/function-run.request.ts +26 -26
- package/src/types/interface/api/requests/function-settings.request.ts +27 -27
- package/src/types/interface/api/requests/function-test.request.ts +24 -24
- package/src/types/interface/api/requests/function-version.request.ts +20 -20
- package/src/types/interface/api/requests/function.request.ts +36 -36
- package/src/types/interface/api/requests/index.ts +12 -12
- package/src/types/interface/api/requests/service-configuration.request.ts +4 -4
- package/src/types/interface/api/requests/service-deployment.request.ts +49 -49
- package/src/types/interface/api/requests/service-discord.request.ts +11 -1
- package/src/types/interface/api/requests/service-route.request.ts +44 -44
- package/src/types/interface/api/requests/service-version.request.ts +19 -19
- package/src/types/interface/api/requests/service.request.ts +46 -46
- package/src/types/interface/api/response.ts +4 -4
- package/src/types/interface/api/responses/function-access.response.ts +17 -17
- package/src/types/interface/api/responses/function-run.response.ts +18 -18
- package/src/types/interface/api/responses/function-settings.response.ts +36 -36
- package/src/types/interface/api/responses/function-test.response.ts +12 -12
- package/src/types/interface/api/responses/function-version.response.ts +31 -31
- package/src/types/interface/api/responses/function.response.ts +25 -25
- package/src/types/interface/api/responses/index.ts +12 -12
- package/src/types/interface/api/responses/service-configuration.response.ts +8 -8
- package/src/types/interface/api/responses/service-deployment.response.ts +32 -32
- package/src/types/interface/api/responses/service-route.response.ts +31 -31
- package/src/types/interface/api/responses/service.response.ts +31 -31
- package/src/types/interface/health.response.ts +7 -7
- package/src/types/interface/index.ts +3 -3
- package/src/types/interface/models/index.ts +14 -14
- package/src/types/interface/models/reflex-access-grant.model.ts +14 -14
- package/src/types/interface/models/reflex-definition.model.ts +31 -31
- package/src/types/interface/models/reflex-discord.model.ts +30 -1
- package/src/types/interface/models/reflex-execution-settings.model.ts +50 -50
- package/src/types/interface/models/reflex-function-version.model.ts +14 -14
- package/src/types/interface/models/reflex-function.model.ts +16 -16
- package/src/types/interface/models/reflex-price-list.model.ts +20 -20
- package/src/types/interface/models/reflex-route.model.ts +19 -19
- package/src/types/interface/models/reflex-service-configuration.model.ts +22 -22
- package/src/types/interface/models/reflex-service-deployment.model.ts +40 -40
- package/src/types/interface/models/reflex-service-version.model.ts +55 -55
- package/src/types/interface/models/reflex-service.model.ts +45 -45
- package/src/types/interface/models/reflex-step-stats.model.ts +35 -35
package/src/index.ts
CHANGED
|
@@ -1,235 +1,235 @@
|
|
|
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
|
-
export * from './api';
|
|
17
|
-
export * from './types';
|
|
18
|
-
|
|
19
|
-
const DEFAULT_BASE_URL = 'https://reflex-api.abyss-project.fr/';
|
|
20
|
-
|
|
21
|
-
type CoreConfig = {
|
|
22
|
-
baseURL?: string;
|
|
23
|
-
/** The session token of the member (`Authorization: Bearer`). Every route but `health` needs it. */
|
|
24
|
-
token?: string;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
type AbyssReflexCoreSDK = {
|
|
28
|
-
/** `GET /health` — status of the database and Redis behind the API. */
|
|
29
|
-
health: typeof healthApi.health;
|
|
30
|
-
function: {
|
|
31
|
-
list: typeof functionApi.listFunction;
|
|
32
|
-
create: typeof functionApi.createFunction;
|
|
33
|
-
get: typeof functionApi.getFunction;
|
|
34
|
-
update: typeof functionApi.updateFunction;
|
|
35
|
-
delete: typeof functionApi.deleteFunction;
|
|
36
|
-
access: {
|
|
37
|
-
list: typeof functionAccessApi.listFunctionAccess;
|
|
38
|
-
grant: typeof functionAccessApi.grantFunctionAccess;
|
|
39
|
-
revoke: typeof functionAccessApi.revokeFunctionAccess;
|
|
40
|
-
};
|
|
41
|
-
test: {
|
|
42
|
-
simulate: typeof functionTestApi.simulateFunction;
|
|
43
|
-
dryRun: typeof functionTestApi.dryRunFunction;
|
|
44
|
-
};
|
|
45
|
-
version: {
|
|
46
|
-
list: typeof functionVersionApi.listFunctionVersion;
|
|
47
|
-
get: typeof functionVersionApi.getFunctionVersion;
|
|
48
|
-
stepStats: typeof functionVersionApi.getFunctionVersionStepStats;
|
|
49
|
-
};
|
|
50
|
-
run: {
|
|
51
|
-
list: typeof functionRunApi.listFunctionRun;
|
|
52
|
-
get: typeof functionRunApi.getFunctionRun;
|
|
53
|
-
state: typeof functionRunApi.getFunctionRunState;
|
|
54
|
-
};
|
|
55
|
-
settings: {
|
|
56
|
-
get: typeof functionSettingsApi.getFunctionSettings;
|
|
57
|
-
setDefault: typeof functionSettingsApi.setFunctionDefaultSettings;
|
|
58
|
-
setEnvironment: typeof functionSettingsApi.setFunctionEnvironmentSettings;
|
|
59
|
-
removeEnvironment: typeof functionSettingsApi.removeFunctionEnvironmentSettings;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
/** Services: the unit versioned, put in service and paused as one (`/api/service/:applicationId/...`). */
|
|
63
|
-
service: {
|
|
64
|
-
list: typeof serviceApi.listService;
|
|
65
|
-
create: typeof serviceApi.createService;
|
|
66
|
-
get: typeof serviceApi.getService;
|
|
67
|
-
update: typeof serviceApi.updateService;
|
|
68
|
-
delete: typeof serviceApi.deleteService;
|
|
69
|
-
route: {
|
|
70
|
-
list: typeof serviceRouteApi.listServiceRoute;
|
|
71
|
-
create: typeof serviceRouteApi.createServiceRoute;
|
|
72
|
-
update: typeof serviceRouteApi.updateServiceRoute;
|
|
73
|
-
delete: typeof serviceRouteApi.deleteServiceRoute;
|
|
74
|
-
rotate: typeof serviceRouteApi.rotateServiceRoute;
|
|
75
|
-
};
|
|
76
|
-
version: {
|
|
77
|
-
list: typeof serviceVersionApi.listServiceVersion;
|
|
78
|
-
create: typeof serviceVersionApi.createServiceVersion;
|
|
79
|
-
get: typeof serviceVersionApi.getServiceVersion;
|
|
80
|
-
};
|
|
81
|
-
deployment: {
|
|
82
|
-
list: typeof serviceDeploymentApi.listServiceDeployment;
|
|
83
|
-
goLive: typeof serviceDeploymentApi.goLiveService;
|
|
84
|
-
rollback: typeof serviceDeploymentApi.rollbackService;
|
|
85
|
-
pause: typeof serviceDeploymentApi.pauseService;
|
|
86
|
-
resume: typeof serviceDeploymentApi.resumeService;
|
|
87
|
-
};
|
|
88
|
-
configuration: {
|
|
89
|
-
list: typeof serviceConfigurationApi.listServiceConfiguration;
|
|
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
|
-
};
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
export class AbyssReflexCore {
|
|
118
|
-
private static config: CoreConfig = {
|
|
119
|
-
baseURL: DEFAULT_BASE_URL,
|
|
120
|
-
};
|
|
121
|
-
static axios = axios.create({
|
|
122
|
-
baseURL: DEFAULT_BASE_URL,
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
private static _sdk: AbyssReflexCoreSDK | null = null;
|
|
126
|
-
|
|
127
|
-
public static get sdk(): AbyssReflexCoreSDK {
|
|
128
|
-
if (!AbyssReflexCore._sdk) {
|
|
129
|
-
AbyssReflexCore._sdk = {
|
|
130
|
-
health: healthApi.health,
|
|
131
|
-
function: {
|
|
132
|
-
list: functionApi.listFunction,
|
|
133
|
-
create: functionApi.createFunction,
|
|
134
|
-
get: functionApi.getFunction,
|
|
135
|
-
update: functionApi.updateFunction,
|
|
136
|
-
delete: functionApi.deleteFunction,
|
|
137
|
-
access: {
|
|
138
|
-
list: functionAccessApi.listFunctionAccess,
|
|
139
|
-
grant: functionAccessApi.grantFunctionAccess,
|
|
140
|
-
revoke: functionAccessApi.revokeFunctionAccess,
|
|
141
|
-
},
|
|
142
|
-
test: {
|
|
143
|
-
simulate: functionTestApi.simulateFunction,
|
|
144
|
-
dryRun: functionTestApi.dryRunFunction,
|
|
145
|
-
},
|
|
146
|
-
version: {
|
|
147
|
-
list: functionVersionApi.listFunctionVersion,
|
|
148
|
-
get: functionVersionApi.getFunctionVersion,
|
|
149
|
-
stepStats: functionVersionApi.getFunctionVersionStepStats,
|
|
150
|
-
},
|
|
151
|
-
run: {
|
|
152
|
-
list: functionRunApi.listFunctionRun,
|
|
153
|
-
get: functionRunApi.getFunctionRun,
|
|
154
|
-
state: functionRunApi.getFunctionRunState,
|
|
155
|
-
},
|
|
156
|
-
settings: {
|
|
157
|
-
get: functionSettingsApi.getFunctionSettings,
|
|
158
|
-
setDefault: functionSettingsApi.setFunctionDefaultSettings,
|
|
159
|
-
setEnvironment: functionSettingsApi.setFunctionEnvironmentSettings,
|
|
160
|
-
removeEnvironment: functionSettingsApi.removeFunctionEnvironmentSettings,
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
service: {
|
|
164
|
-
list: serviceApi.listService,
|
|
165
|
-
create: serviceApi.createService,
|
|
166
|
-
get: serviceApi.getService,
|
|
167
|
-
update: serviceApi.updateService,
|
|
168
|
-
delete: serviceApi.deleteService,
|
|
169
|
-
route: {
|
|
170
|
-
list: serviceRouteApi.listServiceRoute,
|
|
171
|
-
create: serviceRouteApi.createServiceRoute,
|
|
172
|
-
update: serviceRouteApi.updateServiceRoute,
|
|
173
|
-
delete: serviceRouteApi.deleteServiceRoute,
|
|
174
|
-
rotate: serviceRouteApi.rotateServiceRoute,
|
|
175
|
-
},
|
|
176
|
-
version: {
|
|
177
|
-
list: serviceVersionApi.listServiceVersion,
|
|
178
|
-
create: serviceVersionApi.createServiceVersion,
|
|
179
|
-
get: serviceVersionApi.getServiceVersion,
|
|
180
|
-
},
|
|
181
|
-
deployment: {
|
|
182
|
-
list: serviceDeploymentApi.listServiceDeployment,
|
|
183
|
-
goLive: serviceDeploymentApi.goLiveService,
|
|
184
|
-
rollback: serviceDeploymentApi.rollbackService,
|
|
185
|
-
pause: serviceDeploymentApi.pauseService,
|
|
186
|
-
resume: serviceDeploymentApi.resumeService,
|
|
187
|
-
},
|
|
188
|
-
configuration: {
|
|
189
|
-
list: serviceConfigurationApi.listServiceConfiguration,
|
|
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
|
-
},
|
|
212
|
-
},
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
return AbyssReflexCore._sdk;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
public static setConfig(config: CoreConfig): void {
|
|
219
|
-
AbyssReflexCore._sdk = null;
|
|
220
|
-
|
|
221
|
-
AbyssReflexCore.config = { ...AbyssReflexCore.config, ...config };
|
|
222
|
-
|
|
223
|
-
if (config.baseURL) {
|
|
224
|
-
AbyssReflexCore.axios.defaults.baseURL = config.baseURL;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (config.token) {
|
|
228
|
-
AbyssReflexCore.axios.defaults.headers.common.Authorization = `Bearer ${config.token}`;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
public static getConfig(): CoreConfig {
|
|
233
|
-
return AbyssReflexCore.config;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
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
|
+
export * from './api';
|
|
17
|
+
export * from './types';
|
|
18
|
+
|
|
19
|
+
const DEFAULT_BASE_URL = 'https://reflex-api.abyss-project.fr/';
|
|
20
|
+
|
|
21
|
+
type CoreConfig = {
|
|
22
|
+
baseURL?: string;
|
|
23
|
+
/** The session token of the member (`Authorization: Bearer`). Every route but `health` needs it. */
|
|
24
|
+
token?: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type AbyssReflexCoreSDK = {
|
|
28
|
+
/** `GET /health` — status of the database and Redis behind the API. */
|
|
29
|
+
health: typeof healthApi.health;
|
|
30
|
+
function: {
|
|
31
|
+
list: typeof functionApi.listFunction;
|
|
32
|
+
create: typeof functionApi.createFunction;
|
|
33
|
+
get: typeof functionApi.getFunction;
|
|
34
|
+
update: typeof functionApi.updateFunction;
|
|
35
|
+
delete: typeof functionApi.deleteFunction;
|
|
36
|
+
access: {
|
|
37
|
+
list: typeof functionAccessApi.listFunctionAccess;
|
|
38
|
+
grant: typeof functionAccessApi.grantFunctionAccess;
|
|
39
|
+
revoke: typeof functionAccessApi.revokeFunctionAccess;
|
|
40
|
+
};
|
|
41
|
+
test: {
|
|
42
|
+
simulate: typeof functionTestApi.simulateFunction;
|
|
43
|
+
dryRun: typeof functionTestApi.dryRunFunction;
|
|
44
|
+
};
|
|
45
|
+
version: {
|
|
46
|
+
list: typeof functionVersionApi.listFunctionVersion;
|
|
47
|
+
get: typeof functionVersionApi.getFunctionVersion;
|
|
48
|
+
stepStats: typeof functionVersionApi.getFunctionVersionStepStats;
|
|
49
|
+
};
|
|
50
|
+
run: {
|
|
51
|
+
list: typeof functionRunApi.listFunctionRun;
|
|
52
|
+
get: typeof functionRunApi.getFunctionRun;
|
|
53
|
+
state: typeof functionRunApi.getFunctionRunState;
|
|
54
|
+
};
|
|
55
|
+
settings: {
|
|
56
|
+
get: typeof functionSettingsApi.getFunctionSettings;
|
|
57
|
+
setDefault: typeof functionSettingsApi.setFunctionDefaultSettings;
|
|
58
|
+
setEnvironment: typeof functionSettingsApi.setFunctionEnvironmentSettings;
|
|
59
|
+
removeEnvironment: typeof functionSettingsApi.removeFunctionEnvironmentSettings;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
/** Services: the unit versioned, put in service and paused as one (`/api/service/:applicationId/...`). */
|
|
63
|
+
service: {
|
|
64
|
+
list: typeof serviceApi.listService;
|
|
65
|
+
create: typeof serviceApi.createService;
|
|
66
|
+
get: typeof serviceApi.getService;
|
|
67
|
+
update: typeof serviceApi.updateService;
|
|
68
|
+
delete: typeof serviceApi.deleteService;
|
|
69
|
+
route: {
|
|
70
|
+
list: typeof serviceRouteApi.listServiceRoute;
|
|
71
|
+
create: typeof serviceRouteApi.createServiceRoute;
|
|
72
|
+
update: typeof serviceRouteApi.updateServiceRoute;
|
|
73
|
+
delete: typeof serviceRouteApi.deleteServiceRoute;
|
|
74
|
+
rotate: typeof serviceRouteApi.rotateServiceRoute;
|
|
75
|
+
};
|
|
76
|
+
version: {
|
|
77
|
+
list: typeof serviceVersionApi.listServiceVersion;
|
|
78
|
+
create: typeof serviceVersionApi.createServiceVersion;
|
|
79
|
+
get: typeof serviceVersionApi.getServiceVersion;
|
|
80
|
+
};
|
|
81
|
+
deployment: {
|
|
82
|
+
list: typeof serviceDeploymentApi.listServiceDeployment;
|
|
83
|
+
goLive: typeof serviceDeploymentApi.goLiveService;
|
|
84
|
+
rollback: typeof serviceDeploymentApi.rollbackService;
|
|
85
|
+
pause: typeof serviceDeploymentApi.pauseService;
|
|
86
|
+
resume: typeof serviceDeploymentApi.resumeService;
|
|
87
|
+
};
|
|
88
|
+
configuration: {
|
|
89
|
+
list: typeof serviceConfigurationApi.listServiceConfiguration;
|
|
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
|
+
};
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export class AbyssReflexCore {
|
|
118
|
+
private static config: CoreConfig = {
|
|
119
|
+
baseURL: DEFAULT_BASE_URL,
|
|
120
|
+
};
|
|
121
|
+
static axios = axios.create({
|
|
122
|
+
baseURL: DEFAULT_BASE_URL,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
private static _sdk: AbyssReflexCoreSDK | null = null;
|
|
126
|
+
|
|
127
|
+
public static get sdk(): AbyssReflexCoreSDK {
|
|
128
|
+
if (!AbyssReflexCore._sdk) {
|
|
129
|
+
AbyssReflexCore._sdk = {
|
|
130
|
+
health: healthApi.health,
|
|
131
|
+
function: {
|
|
132
|
+
list: functionApi.listFunction,
|
|
133
|
+
create: functionApi.createFunction,
|
|
134
|
+
get: functionApi.getFunction,
|
|
135
|
+
update: functionApi.updateFunction,
|
|
136
|
+
delete: functionApi.deleteFunction,
|
|
137
|
+
access: {
|
|
138
|
+
list: functionAccessApi.listFunctionAccess,
|
|
139
|
+
grant: functionAccessApi.grantFunctionAccess,
|
|
140
|
+
revoke: functionAccessApi.revokeFunctionAccess,
|
|
141
|
+
},
|
|
142
|
+
test: {
|
|
143
|
+
simulate: functionTestApi.simulateFunction,
|
|
144
|
+
dryRun: functionTestApi.dryRunFunction,
|
|
145
|
+
},
|
|
146
|
+
version: {
|
|
147
|
+
list: functionVersionApi.listFunctionVersion,
|
|
148
|
+
get: functionVersionApi.getFunctionVersion,
|
|
149
|
+
stepStats: functionVersionApi.getFunctionVersionStepStats,
|
|
150
|
+
},
|
|
151
|
+
run: {
|
|
152
|
+
list: functionRunApi.listFunctionRun,
|
|
153
|
+
get: functionRunApi.getFunctionRun,
|
|
154
|
+
state: functionRunApi.getFunctionRunState,
|
|
155
|
+
},
|
|
156
|
+
settings: {
|
|
157
|
+
get: functionSettingsApi.getFunctionSettings,
|
|
158
|
+
setDefault: functionSettingsApi.setFunctionDefaultSettings,
|
|
159
|
+
setEnvironment: functionSettingsApi.setFunctionEnvironmentSettings,
|
|
160
|
+
removeEnvironment: functionSettingsApi.removeFunctionEnvironmentSettings,
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
service: {
|
|
164
|
+
list: serviceApi.listService,
|
|
165
|
+
create: serviceApi.createService,
|
|
166
|
+
get: serviceApi.getService,
|
|
167
|
+
update: serviceApi.updateService,
|
|
168
|
+
delete: serviceApi.deleteService,
|
|
169
|
+
route: {
|
|
170
|
+
list: serviceRouteApi.listServiceRoute,
|
|
171
|
+
create: serviceRouteApi.createServiceRoute,
|
|
172
|
+
update: serviceRouteApi.updateServiceRoute,
|
|
173
|
+
delete: serviceRouteApi.deleteServiceRoute,
|
|
174
|
+
rotate: serviceRouteApi.rotateServiceRoute,
|
|
175
|
+
},
|
|
176
|
+
version: {
|
|
177
|
+
list: serviceVersionApi.listServiceVersion,
|
|
178
|
+
create: serviceVersionApi.createServiceVersion,
|
|
179
|
+
get: serviceVersionApi.getServiceVersion,
|
|
180
|
+
},
|
|
181
|
+
deployment: {
|
|
182
|
+
list: serviceDeploymentApi.listServiceDeployment,
|
|
183
|
+
goLive: serviceDeploymentApi.goLiveService,
|
|
184
|
+
rollback: serviceDeploymentApi.rollbackService,
|
|
185
|
+
pause: serviceDeploymentApi.pauseService,
|
|
186
|
+
resume: serviceDeploymentApi.resumeService,
|
|
187
|
+
},
|
|
188
|
+
configuration: {
|
|
189
|
+
list: serviceConfigurationApi.listServiceConfiguration,
|
|
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
|
+
},
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
return AbyssReflexCore._sdk;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
public static setConfig(config: CoreConfig): void {
|
|
219
|
+
AbyssReflexCore._sdk = null;
|
|
220
|
+
|
|
221
|
+
AbyssReflexCore.config = { ...AbyssReflexCore.config, ...config };
|
|
222
|
+
|
|
223
|
+
if (config.baseURL) {
|
|
224
|
+
AbyssReflexCore.axios.defaults.baseURL = config.baseURL;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (config.token) {
|
|
228
|
+
AbyssReflexCore.axios.defaults.headers.common.Authorization = `Bearer ${config.token}`;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
public static getConfig(): CoreConfig {
|
|
233
|
+
return AbyssReflexCore.config;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** How a function reads a vault key: `config.NAME` (a VISIBLE entry) or `secrets.NAME` (a SECRET entry). */
|
|
2
|
-
export enum ConfigurationReadAs {
|
|
3
|
-
CONFIG = 'config',
|
|
4
|
-
SECRETS = 'secrets',
|
|
5
|
-
}
|
|
1
|
+
/** How a function reads a vault key: `config.NAME` (a VISIBLE entry) or `secrets.NAME` (a SECRET entry). */
|
|
2
|
+
export enum ConfigurationReadAs {
|
|
3
|
+
CONFIG = 'config',
|
|
4
|
+
SECRETS = 'secrets',
|
|
5
|
+
}
|
|
@@ -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,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
|
+
}
|
|
@@ -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
|
+
}
|