@abyss-project/reflex 4.0.0 → 5.0.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-discord.api.d.ts +14 -0
- package/dist/api/service-discord.api.js +38 -0
- package/dist/api/service-discord.api.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/types/enum/discord-component-kind.enum.d.ts +4 -0
- package/dist/types/enum/discord-component-kind.enum.js +9 -0
- package/dist/types/enum/discord-component-kind.enum.js.map +1 -0
- package/dist/types/enum/discord-option-type.enum.d.ts +11 -0
- package/dist/types/enum/discord-option-type.enum.js +16 -0
- package/dist/types/enum/discord-option-type.enum.js.map +1 -0
- package/dist/types/enum/discord-sync-status.enum.d.ts +5 -0
- package/dist/types/enum/discord-sync-status.enum.js +10 -0
- package/dist/types/enum/discord-sync-status.enum.js.map +1 -0
- package/dist/types/enum/discord-token-state.enum.d.ts +6 -0
- package/dist/types/enum/discord-token-state.enum.js +11 -0
- package/dist/types/enum/discord-token-state.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/enum/reflex-error-code.enum.d.ts +7 -1
- package/dist/types/enum/reflex-error-code.enum.js +6 -0
- package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
- package/dist/types/enum/service-type.enum.d.ts +2 -1
- package/dist/types/enum/service-type.enum.js +1 -0
- package/dist/types/enum/service-type.enum.js.map +1 -1
- 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-discord.request.d.ts +94 -0
- package/dist/types/interface/api/requests/service-discord.request.js +3 -0
- package/dist/types/interface/api/requests/service-discord.request.js.map +1 -0
- package/dist/types/interface/api/requests/service.request.d.ts +2 -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-discord.response.d.ts +50 -0
- package/dist/types/interface/api/responses/service-discord.response.js +3 -0
- package/dist/types/interface/api/responses/service-discord.response.js.map +1 -0
- package/dist/types/interface/api/responses/service-version.response.d.ts +15 -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-discord.model.d.ts +69 -0
- package/dist/types/interface/models/reflex-discord.model.js +13 -0
- package/dist/types/interface/models/reflex-discord.model.js.map +1 -0
- package/dist/types/interface/models/reflex-run.model.d.ts +3 -0
- package/dist/types/interface/models/reflex-service-deployment.model.d.ts +5 -1
- package/dist/types/interface/models/reflex-service-version.model.d.ts +6 -0
- package/dist/types/interface/models/reflex-service.model.d.ts +1 -0
- package/package.json +1 -1
- package/src/api/index.ts +13 -12
- package/src/api/service-configuration.api.ts +16 -16
- package/src/api/service-discord.api.test.ts +170 -0
- package/src/api/service-discord.api.ts +203 -0
- package/src/index.ts +235 -190
- package/src/types/enum/configuration-read-as.enum.ts +5 -5
- package/src/types/enum/discord-component-kind.enum.ts +7 -0
- package/src/types/enum/discord-option-type.enum.ts +12 -0
- package/src/types/enum/discord-sync-status.enum.ts +6 -0
- package/src/types/enum/discord-token-state.enum.ts +11 -0
- package/src/types/enum/index.ts +25 -21
- package/src/types/enum/reflex-error-code.enum.ts +12 -0
- package/src/types/enum/service-type.enum.ts +2 -0
- package/src/types/enum/vault-value-source.enum.ts +12 -12
- package/src/types/enum/vault-visibility.enum.ts +5 -5
- package/src/types/interface/api/requests/index.ts +12 -11
- package/src/types/interface/api/requests/service-configuration.request.ts +4 -4
- package/src/types/interface/api/requests/service-discord.request.ts +118 -0
- package/src/types/interface/api/requests/service.request.ts +8 -1
- package/src/types/interface/api/responses/index.ts +12 -11
- package/src/types/interface/api/responses/service-configuration.response.ts +8 -8
- package/src/types/interface/api/responses/service-discord.response.ts +72 -0
- package/src/types/interface/api/responses/service-version.response.ts +62 -33
- package/src/types/interface/models/index.ts +14 -13
- package/src/types/interface/models/reflex-discord.model.ts +117 -0
- package/src/types/interface/models/reflex-run.model.ts +173 -164
- package/src/types/interface/models/reflex-service-configuration.model.ts +22 -22
- package/src/types/interface/models/reflex-service-deployment.model.ts +12 -1
- package/src/types/interface/models/reflex-service-version.model.ts +12 -0
- package/src/types/interface/models/reflex-service.model.ts +2 -0
package/src/index.ts
CHANGED
|
@@ -1,190 +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
|
-
|
|
15
|
-
|
|
16
|
-
export * from './
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
token
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
health
|
|
29
|
-
|
|
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
|
-
}
|
|
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,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,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,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,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
|
+
}
|
package/src/types/enum/index.ts
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
export * from './health-status.enum';
|
|
2
|
-
export * from './trigger-access-mode.enum';
|
|
3
|
-
export * from './access-grant-status.enum';
|
|
4
|
-
export * from './run-mode.enum';
|
|
5
|
-
export * from './run-status.enum';
|
|
6
|
-
export * from './trace-effect-type.enum';
|
|
7
|
-
export * from './reflex-error-code.enum';
|
|
8
|
-
export * from './access-kind.enum';
|
|
9
|
-
export * from './execution-profile.enum';
|
|
10
|
-
export * from './execution-mode.enum';
|
|
11
|
-
export * from './execution-settings-source.enum';
|
|
12
|
-
export * from './run-step-status.enum';
|
|
13
|
-
export * from './run-log-level.enum';
|
|
14
|
-
export * from './service-type.enum';
|
|
15
|
-
export * from './route-method.enum';
|
|
16
|
-
export * from './service-deployment-action.enum';
|
|
17
|
-
export * from './service-deployment-status.enum';
|
|
18
|
-
export * from './vault-value-source.enum';
|
|
19
|
-
export * from './vault-visibility.enum';
|
|
20
|
-
export * from './configuration-read-as.enum';
|
|
21
|
-
export * from './service-version-change-kind.enum';
|
|
1
|
+
export * from './health-status.enum';
|
|
2
|
+
export * from './trigger-access-mode.enum';
|
|
3
|
+
export * from './access-grant-status.enum';
|
|
4
|
+
export * from './run-mode.enum';
|
|
5
|
+
export * from './run-status.enum';
|
|
6
|
+
export * from './trace-effect-type.enum';
|
|
7
|
+
export * from './reflex-error-code.enum';
|
|
8
|
+
export * from './access-kind.enum';
|
|
9
|
+
export * from './execution-profile.enum';
|
|
10
|
+
export * from './execution-mode.enum';
|
|
11
|
+
export * from './execution-settings-source.enum';
|
|
12
|
+
export * from './run-step-status.enum';
|
|
13
|
+
export * from './run-log-level.enum';
|
|
14
|
+
export * from './service-type.enum';
|
|
15
|
+
export * from './route-method.enum';
|
|
16
|
+
export * from './service-deployment-action.enum';
|
|
17
|
+
export * from './service-deployment-status.enum';
|
|
18
|
+
export * from './vault-value-source.enum';
|
|
19
|
+
export * from './vault-visibility.enum';
|
|
20
|
+
export * from './configuration-read-as.enum';
|
|
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';
|
|
@@ -22,4 +22,16 @@ export enum ReflexErrorCode {
|
|
|
22
22
|
ROUTE_CONFLICT = 'ROUTE_CONFLICT',
|
|
23
23
|
/** 409: the Service has not changed since its last version. */
|
|
24
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',
|
|
25
37
|
}
|
|
@@ -4,4 +4,6 @@ export enum ServiceType {
|
|
|
4
4
|
HTTP_API = 'HTTP_API',
|
|
5
5
|
/** Functions, each at a path, answering every method (routes of method `ANY` only). */
|
|
6
6
|
FUNCTIONS = 'FUNCTIONS',
|
|
7
|
+
/** A Discord bot: commands and components, each calling one function of the Service. No routes. */
|
|
8
|
+
DISCORD_BOT = 'DISCORD_BOT',
|
|
7
9
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Where the value a Console vault entry gives to an environment comes from, in the order of the
|
|
3
|
-
* resolution: the value of the environment, the entry's default value, the value of the entry's default
|
|
4
|
-
* environment, or nothing (the entry is absent for the environment). Mirrors Console's enum of the
|
|
5
|
-
* same name, so the SDK needs no dependency on it.
|
|
6
|
-
*/
|
|
7
|
-
export enum VaultValueSource {
|
|
8
|
-
ENVIRONMENT = 'ENVIRONMENT',
|
|
9
|
-
DEFAULT = 'DEFAULT',
|
|
10
|
-
DEFAULT_ENVIRONMENT = 'DEFAULT_ENVIRONMENT',
|
|
11
|
-
ABSENT = 'ABSENT',
|
|
12
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Where the value a Console vault entry gives to an environment comes from, in the order of the
|
|
3
|
+
* resolution: the value of the environment, the entry's default value, the value of the entry's default
|
|
4
|
+
* environment, or nothing (the entry is absent for the environment). Mirrors Console's enum of the
|
|
5
|
+
* same name, so the SDK needs no dependency on it.
|
|
6
|
+
*/
|
|
7
|
+
export enum VaultValueSource {
|
|
8
|
+
ENVIRONMENT = 'ENVIRONMENT',
|
|
9
|
+
DEFAULT = 'DEFAULT',
|
|
10
|
+
DEFAULT_ENVIRONMENT = 'DEFAULT_ENVIRONMENT',
|
|
11
|
+
ABSENT = 'ABSENT',
|
|
12
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** Whether a Console vault entry hides its value. Mirrors Console's `SecretVisibility`. */
|
|
2
|
-
export enum VaultVisibility {
|
|
3
|
-
SECRET = 'SECRET',
|
|
4
|
-
VISIBLE = 'VISIBLE',
|
|
5
|
-
}
|
|
1
|
+
/** Whether a Console vault entry hides its value. Mirrors Console's `SecretVisibility`. */
|
|
2
|
+
export enum VaultVisibility {
|
|
3
|
+
SECRET = 'SECRET',
|
|
4
|
+
VISIBLE = 'VISIBLE',
|
|
5
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
export * from './function.request';
|
|
2
|
-
export * from './function-access.request';
|
|
3
|
-
export * from './function-test.request';
|
|
4
|
-
export * from './function-version.request';
|
|
5
|
-
export * from './function-run.request';
|
|
6
|
-
export * from './function-settings.request';
|
|
7
|
-
export * from './service.request';
|
|
8
|
-
export * from './service-route.request';
|
|
9
|
-
export * from './service-version.request';
|
|
10
|
-
export * from './service-deployment.request';
|
|
11
|
-
export * from './service-configuration.request';
|
|
1
|
+
export * from './function.request';
|
|
2
|
+
export * from './function-access.request';
|
|
3
|
+
export * from './function-test.request';
|
|
4
|
+
export * from './function-version.request';
|
|
5
|
+
export * from './function-run.request';
|
|
6
|
+
export * from './function-settings.request';
|
|
7
|
+
export * from './service.request';
|
|
8
|
+
export * from './service-route.request';
|
|
9
|
+
export * from './service-version.request';
|
|
10
|
+
export * from './service-deployment.request';
|
|
11
|
+
export * from './service-configuration.request';
|
|
12
|
+
export * from './service-discord.request';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface IListServiceConfigurationParams {
|
|
2
|
-
applicationId: string;
|
|
3
|
-
serviceId: string;
|
|
4
|
-
}
|
|
1
|
+
export interface IListServiceConfigurationParams {
|
|
2
|
+
applicationId: string;
|
|
3
|
+
serviceId: string;
|
|
4
|
+
}
|