@twin.org/engine-server-types 0.0.2-next.2 → 0.0.2-next.20
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/cjs/index.cjs +109 -164
- package/dist/esm/index.mjs +110 -165
- package/dist/types/components/authentication.d.ts +7 -4
- package/dist/types/components/authenticationAdmin.d.ts +7 -4
- package/dist/types/components/information.d.ts +7 -4
- package/dist/types/components/mimeTypeProcessor.d.ts +8 -4
- package/dist/types/components/restRouteProcessor.d.ts +9 -5
- package/dist/types/components/socketRouteProcessor.d.ts +8 -4
- package/dist/types/models/config/restRouteProcessorConfig.d.ts +4 -0
- package/dist/types/models/config/socketRouteProcessorConfig.d.ts +4 -0
- package/dist/types/models/types/restRouteProcessorType.d.ts +4 -0
- package/dist/types/models/types/socketRouteProcessorType.d.ts +4 -0
- package/docs/changelog.md +270 -0
- package/docs/reference/functions/initialiseAuthenticationAdminComponent.md +3 -13
- package/docs/reference/functions/initialiseAuthenticationComponent.md +3 -13
- package/docs/reference/functions/initialiseInformationComponent.md +3 -13
- package/docs/reference/functions/initialiseMimeTypeProcessorComponent.md +3 -13
- package/docs/reference/functions/initialiseRestRouteProcessorComponent.md +3 -13
- package/docs/reference/functions/initialiseSocketRouteProcessorComponent.md +3 -13
- package/docs/reference/interfaces/IEngineServerConfig.md +1 -1
- package/docs/reference/type-aliases/RestRouteProcessorConfig.md +1 -1
- package/docs/reference/type-aliases/SocketRouteProcessorConfig.md +1 -1
- package/docs/reference/variables/AuthenticationAdminComponentType.md +1 -1
- package/docs/reference/variables/AuthenticationComponentType.md +1 -1
- package/docs/reference/variables/InformationComponentType.md +1 -1
- package/docs/reference/variables/MimeTypeProcessorType.md +1 -1
- package/docs/reference/variables/RestRouteProcessorType.md +7 -1
- package/docs/reference/variables/SocketRouteProcessorType.md +7 -1
- package/package.json +12 -3
package/dist/esm/index.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { EntityStorageAuthenticationClient } from '@twin.org/api-auth-entity-storage-rest-client';
|
|
2
2
|
import { initSchema, EntityStorageAuthenticationService, EntityStorageAuthenticationAdminService, AuthHeaderProcessor } from '@twin.org/api-auth-entity-storage-service';
|
|
3
|
-
import {
|
|
3
|
+
import { ComponentFactory } from '@twin.org/core';
|
|
4
4
|
import { initialiseEntityStorageConnector } from '@twin.org/engine-types';
|
|
5
5
|
import { InformationClient } from '@twin.org/api-rest-client';
|
|
6
6
|
import { InformationService } from '@twin.org/api-service';
|
|
7
7
|
import { MimeTypeProcessorFactory, RestRouteProcessorFactory, SocketRouteProcessorFactory } from '@twin.org/api-models';
|
|
8
8
|
import { JwtMimeTypeProcessor, LoggingProcessor, NodeIdentityProcessor, StaticUserIdentityProcessor, RestRouteProcessor, SocketRouteProcessor } from '@twin.org/api-processors';
|
|
9
|
+
import { VerifiableCredentialAuthenticationProcessor } from '@twin.org/identity-authentication';
|
|
9
10
|
|
|
10
11
|
// Copyright 2024 IOTA Stiftung.
|
|
11
12
|
// SPDX-License-Identifier: Apache-2.0.
|
|
@@ -29,44 +30,30 @@ const AuthenticationComponentType = {
|
|
|
29
30
|
* @param engineCore The engine core.
|
|
30
31
|
* @param context The context for the engine.
|
|
31
32
|
* @param instanceConfig The instance config.
|
|
32
|
-
* @
|
|
33
|
-
* @returns The name of the instance created.
|
|
34
|
-
* @throws GeneralError if the component type is unknown.
|
|
33
|
+
* @returns The instance created and the factory for it.
|
|
35
34
|
*/
|
|
36
|
-
function initialiseAuthenticationComponent(engineCore, context, instanceConfig
|
|
37
|
-
engineCore.logInfo(I18n.formatMessage("engineCore.configuring", {
|
|
38
|
-
element: `Authentication Component: ${instanceConfig.type}`
|
|
39
|
-
}));
|
|
40
|
-
const type = instanceConfig.type;
|
|
35
|
+
async function initialiseAuthenticationComponent(engineCore, context, instanceConfig) {
|
|
41
36
|
let component;
|
|
42
37
|
let instanceType;
|
|
43
|
-
if (type === AuthenticationComponentType.EntityStorage) {
|
|
38
|
+
if (instanceConfig.type === AuthenticationComponentType.EntityStorage) {
|
|
44
39
|
initSchema();
|
|
45
40
|
initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.userEntityStorageType, "AuthenticationUser");
|
|
46
41
|
component = new EntityStorageAuthenticationService({
|
|
47
|
-
vaultConnectorType:
|
|
48
|
-
authenticationAdminServiceType:
|
|
42
|
+
vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
|
|
43
|
+
authenticationAdminServiceType: engineCore.getRegisteredInstanceType("authenticationAdminComponent"),
|
|
49
44
|
...instanceConfig.options
|
|
50
45
|
});
|
|
51
|
-
instanceType =
|
|
46
|
+
instanceType = "entity-storage-authentication-service";
|
|
52
47
|
}
|
|
53
|
-
else if (type === AuthenticationComponentType.RestClient) {
|
|
48
|
+
else if (instanceConfig.type === AuthenticationComponentType.RestClient) {
|
|
54
49
|
component = new EntityStorageAuthenticationClient(instanceConfig.options);
|
|
55
|
-
instanceType =
|
|
50
|
+
instanceType = "entity-storage-authentication-client";
|
|
56
51
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
const finalInstanceType = overrideInstanceType ?? instanceType;
|
|
64
|
-
context.componentInstances.push({
|
|
65
|
-
instanceType: finalInstanceType,
|
|
66
|
-
component
|
|
67
|
-
});
|
|
68
|
-
ComponentFactory.register(finalInstanceType, () => component);
|
|
69
|
-
return finalInstanceType;
|
|
52
|
+
return {
|
|
53
|
+
component,
|
|
54
|
+
instanceType,
|
|
55
|
+
factory: ComponentFactory
|
|
56
|
+
};
|
|
70
57
|
}
|
|
71
58
|
|
|
72
59
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -87,38 +74,24 @@ const AuthenticationAdminComponentType = {
|
|
|
87
74
|
* @param engineCore The engine core.
|
|
88
75
|
* @param context The context for the engine.
|
|
89
76
|
* @param instanceConfig The instance config.
|
|
90
|
-
* @
|
|
91
|
-
* @returns The name of the instance created.
|
|
92
|
-
* @throws GeneralError if the component type is unknown.
|
|
77
|
+
* @returns The instance created and the factory for it.
|
|
93
78
|
*/
|
|
94
|
-
function initialiseAuthenticationAdminComponent(engineCore, context, instanceConfig
|
|
95
|
-
engineCore.logInfo(I18n.formatMessage("engineCore.configuring", {
|
|
96
|
-
element: `Authentication Admin Component: ${instanceConfig.type}`
|
|
97
|
-
}));
|
|
98
|
-
const type = instanceConfig.type;
|
|
79
|
+
async function initialiseAuthenticationAdminComponent(engineCore, context, instanceConfig) {
|
|
99
80
|
let component;
|
|
100
81
|
let instanceType;
|
|
101
|
-
if (type === AuthenticationAdminComponentType.EntityStorage) {
|
|
82
|
+
if (instanceConfig.type === AuthenticationAdminComponentType.EntityStorage) {
|
|
102
83
|
initSchema();
|
|
103
84
|
initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.userEntityStorageType, "AuthenticationUser");
|
|
104
85
|
component = new EntityStorageAuthenticationAdminService({
|
|
105
86
|
...instanceConfig.options
|
|
106
87
|
});
|
|
107
|
-
instanceType =
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
throw new GeneralError("engineCore", "componentUnknownType", {
|
|
111
|
-
type,
|
|
112
|
-
componentType: "authenticationAdminComponent"
|
|
113
|
-
});
|
|
88
|
+
instanceType = "entity-storage-authentication-admin-service";
|
|
114
89
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
instanceType
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
ComponentFactory.register(finalInstanceType, () => component);
|
|
121
|
-
return finalInstanceType;
|
|
90
|
+
return {
|
|
91
|
+
component,
|
|
92
|
+
instanceType,
|
|
93
|
+
factory: ComponentFactory
|
|
94
|
+
};
|
|
122
95
|
}
|
|
123
96
|
|
|
124
97
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -143,38 +116,24 @@ const InformationComponentType = {
|
|
|
143
116
|
* @param engineCore The engine core.
|
|
144
117
|
* @param context The context for the engine.
|
|
145
118
|
* @param instanceConfig The instance config.
|
|
146
|
-
* @
|
|
147
|
-
* @returns The name of the instance created.
|
|
148
|
-
* @throws GeneralError if the component type is unknown.
|
|
119
|
+
* @returns The instance created and the factory for it.
|
|
149
120
|
*/
|
|
150
|
-
function initialiseInformationComponent(engineCore, context, instanceConfig
|
|
151
|
-
engineCore.logInfo(I18n.formatMessage("engineCore.configuring", {
|
|
152
|
-
element: `Information Component: ${instanceConfig.type}`
|
|
153
|
-
}));
|
|
154
|
-
const type = instanceConfig.type;
|
|
121
|
+
async function initialiseInformationComponent(engineCore, context, instanceConfig) {
|
|
155
122
|
let component;
|
|
156
123
|
let instanceType;
|
|
157
|
-
if (type === InformationComponentType.Service) {
|
|
124
|
+
if (instanceConfig.type === InformationComponentType.Service) {
|
|
158
125
|
component = new InformationService(instanceConfig.options);
|
|
159
|
-
instanceType =
|
|
126
|
+
instanceType = "information-service";
|
|
160
127
|
}
|
|
161
|
-
else if (type === InformationComponentType.RestClient) {
|
|
128
|
+
else if (instanceConfig.type === InformationComponentType.RestClient) {
|
|
162
129
|
component = new InformationClient(instanceConfig.options);
|
|
163
|
-
instanceType =
|
|
130
|
+
instanceType = "information-client";
|
|
164
131
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
const finalInstanceType = overrideInstanceType ?? instanceType;
|
|
172
|
-
context.componentInstances.push({
|
|
173
|
-
instanceType: finalInstanceType,
|
|
174
|
-
component
|
|
175
|
-
});
|
|
176
|
-
ComponentFactory.register(finalInstanceType, () => component);
|
|
177
|
-
return finalInstanceType;
|
|
132
|
+
return {
|
|
133
|
+
component,
|
|
134
|
+
instanceType,
|
|
135
|
+
factory: ComponentFactory
|
|
136
|
+
};
|
|
178
137
|
}
|
|
179
138
|
|
|
180
139
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -197,34 +156,20 @@ const MimeTypeProcessorType = {
|
|
|
197
156
|
* @param engineCore The engine core.
|
|
198
157
|
* @param context The context for the engine.
|
|
199
158
|
* @param instanceConfig The instance config.
|
|
200
|
-
* @
|
|
201
|
-
* @returns The name of the instance created.
|
|
202
|
-
* @throws GeneralError if the component type is unknown.
|
|
159
|
+
* @returns The instance created and the factory for it.
|
|
203
160
|
*/
|
|
204
|
-
function initialiseMimeTypeProcessorComponent(engineCore, context, instanceConfig
|
|
205
|
-
engineCore.logInfo(I18n.formatMessage("engineCore.configuring", {
|
|
206
|
-
element: `Mime Type Processor: ${instanceConfig.type}`
|
|
207
|
-
}));
|
|
208
|
-
const type = instanceConfig.type;
|
|
161
|
+
async function initialiseMimeTypeProcessorComponent(engineCore, context, instanceConfig) {
|
|
209
162
|
let component;
|
|
210
163
|
let instanceType;
|
|
211
|
-
if (type === MimeTypeProcessorType.Jwt) {
|
|
164
|
+
if (instanceConfig.type === MimeTypeProcessorType.Jwt) {
|
|
212
165
|
component = new JwtMimeTypeProcessor();
|
|
213
|
-
instanceType =
|
|
166
|
+
instanceType = "jwt-mime-type-processor";
|
|
214
167
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
const finalInstanceType = overrideInstanceType ?? instanceType;
|
|
222
|
-
context.componentInstances.push({
|
|
223
|
-
instanceType: finalInstanceType,
|
|
224
|
-
component
|
|
225
|
-
});
|
|
226
|
-
MimeTypeProcessorFactory.register(finalInstanceType, () => component);
|
|
227
|
-
return finalInstanceType;
|
|
168
|
+
return {
|
|
169
|
+
component,
|
|
170
|
+
instanceType,
|
|
171
|
+
factory: MimeTypeProcessorFactory
|
|
172
|
+
};
|
|
228
173
|
}
|
|
229
174
|
|
|
230
175
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -238,6 +183,10 @@ const RestRouteProcessorType = {
|
|
|
238
183
|
* Auth header.
|
|
239
184
|
*/
|
|
240
185
|
AuthHeader: "auth-header",
|
|
186
|
+
/**
|
|
187
|
+
* Auth verifiable credential.
|
|
188
|
+
*/
|
|
189
|
+
AuthVerifiableCredential: "auth-verifiable-credential",
|
|
241
190
|
/**
|
|
242
191
|
* Logging.
|
|
243
192
|
*/
|
|
@@ -263,60 +212,56 @@ const RestRouteProcessorType = {
|
|
|
263
212
|
* @param engineCore The engine core.
|
|
264
213
|
* @param context The context for the engine.
|
|
265
214
|
* @param instanceConfig The instance config.
|
|
266
|
-
* @
|
|
267
|
-
* @returns The name of the instance created.
|
|
268
|
-
* @throws GeneralError if the component type is unknown.
|
|
215
|
+
* @returns The instance created and the factory for it.
|
|
269
216
|
*/
|
|
270
|
-
function initialiseRestRouteProcessorComponent(engineCore, context, instanceConfig
|
|
271
|
-
engineCore.logInfo(I18n.formatMessage("engineCore.configuring", {
|
|
272
|
-
element: `REST Route Processor: ${instanceConfig.type}`
|
|
273
|
-
}));
|
|
274
|
-
const type = instanceConfig.type;
|
|
217
|
+
async function initialiseRestRouteProcessorComponent(engineCore, context, instanceConfig) {
|
|
275
218
|
let component;
|
|
276
219
|
let instanceType;
|
|
277
|
-
if (type === RestRouteProcessorType.AuthHeader) {
|
|
220
|
+
if (instanceConfig.type === RestRouteProcessorType.AuthHeader) {
|
|
278
221
|
component = new AuthHeaderProcessor({
|
|
279
|
-
vaultConnectorType:
|
|
222
|
+
vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
|
|
223
|
+
config: {
|
|
224
|
+
...instanceConfig.options?.config
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
instanceType = "auth-header-processor";
|
|
228
|
+
}
|
|
229
|
+
else if (instanceConfig.type === RestRouteProcessorType.AuthVerifiableCredential) {
|
|
230
|
+
component = new VerifiableCredentialAuthenticationProcessor({
|
|
231
|
+
identityConnectorType: engineCore.getRegisteredInstanceType("identityConnector"),
|
|
232
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
280
233
|
config: {
|
|
281
234
|
...instanceConfig.options?.config
|
|
282
235
|
}
|
|
283
236
|
});
|
|
284
|
-
instanceType =
|
|
237
|
+
instanceType = "verifiable-credential-authentication-processor";
|
|
285
238
|
}
|
|
286
|
-
else if (type === RestRouteProcessorType.Logging) {
|
|
239
|
+
else if (instanceConfig.type === RestRouteProcessorType.Logging) {
|
|
287
240
|
component = new LoggingProcessor({
|
|
288
|
-
|
|
241
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
289
242
|
config: {
|
|
290
243
|
...instanceConfig.options?.config
|
|
291
244
|
}
|
|
292
245
|
});
|
|
293
|
-
instanceType =
|
|
246
|
+
instanceType = "logging-processor";
|
|
294
247
|
}
|
|
295
|
-
else if (type === RestRouteProcessorType.NodeIdentity) {
|
|
248
|
+
else if (instanceConfig.type === RestRouteProcessorType.NodeIdentity) {
|
|
296
249
|
component = new NodeIdentityProcessor();
|
|
297
|
-
instanceType =
|
|
250
|
+
instanceType = "node-identity-processor";
|
|
298
251
|
}
|
|
299
|
-
else if (type === RestRouteProcessorType.StaticUserIdentity) {
|
|
252
|
+
else if (instanceConfig.type === RestRouteProcessorType.StaticUserIdentity) {
|
|
300
253
|
component = new StaticUserIdentityProcessor(instanceConfig.options);
|
|
301
|
-
instanceType =
|
|
254
|
+
instanceType = "static-user-identity-processor";
|
|
302
255
|
}
|
|
303
|
-
else if (type === RestRouteProcessorType.RestRoute) {
|
|
256
|
+
else if (instanceConfig.type === RestRouteProcessorType.RestRoute) {
|
|
304
257
|
component = new RestRouteProcessor(instanceConfig.options);
|
|
305
|
-
instanceType =
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
throw new GeneralError("engineCore", "componentUnknownType", {
|
|
309
|
-
type,
|
|
310
|
-
componentType: "restRouteProcessorComponent"
|
|
311
|
-
});
|
|
258
|
+
instanceType = "rest-route-processor";
|
|
312
259
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
instanceType
|
|
316
|
-
|
|
317
|
-
}
|
|
318
|
-
RestRouteProcessorFactory.register(finalInstanceType, () => component);
|
|
319
|
-
return finalInstanceType;
|
|
260
|
+
return {
|
|
261
|
+
component,
|
|
262
|
+
instanceType,
|
|
263
|
+
factory: RestRouteProcessorFactory
|
|
264
|
+
};
|
|
320
265
|
}
|
|
321
266
|
|
|
322
267
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -330,6 +275,10 @@ const SocketRouteProcessorType = {
|
|
|
330
275
|
* Auth header.
|
|
331
276
|
*/
|
|
332
277
|
AuthHeader: "auth-header",
|
|
278
|
+
/**
|
|
279
|
+
* Auth verifiable credential.
|
|
280
|
+
*/
|
|
281
|
+
AuthVerifiableCredential: "auth-verifiable-credential",
|
|
333
282
|
/**
|
|
334
283
|
* Logging.
|
|
335
284
|
*/
|
|
@@ -355,60 +304,56 @@ const SocketRouteProcessorType = {
|
|
|
355
304
|
* @param engineCore The engine core.
|
|
356
305
|
* @param context The context for the engine.
|
|
357
306
|
* @param instanceConfig The instance config.
|
|
358
|
-
* @
|
|
359
|
-
* @returns The name of the instance created.
|
|
360
|
-
* @throws GeneralError if the component type is unknown.
|
|
307
|
+
* @returns The instance created and the factory for it.
|
|
361
308
|
*/
|
|
362
|
-
function initialiseSocketRouteProcessorComponent(engineCore, context, instanceConfig
|
|
363
|
-
engineCore.logInfo(I18n.formatMessage("engineCore.configuring", {
|
|
364
|
-
element: `Socket Route Processor: ${instanceConfig.type}`
|
|
365
|
-
}));
|
|
366
|
-
const type = instanceConfig.type;
|
|
309
|
+
async function initialiseSocketRouteProcessorComponent(engineCore, context, instanceConfig) {
|
|
367
310
|
let component;
|
|
368
311
|
let instanceType;
|
|
369
|
-
if (type === SocketRouteProcessorType.AuthHeader) {
|
|
312
|
+
if (instanceConfig.type === SocketRouteProcessorType.AuthHeader) {
|
|
370
313
|
component = new AuthHeaderProcessor({
|
|
371
|
-
vaultConnectorType:
|
|
314
|
+
vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
|
|
372
315
|
config: {
|
|
373
316
|
...instanceConfig.options?.config
|
|
374
317
|
}
|
|
375
318
|
});
|
|
376
|
-
instanceType =
|
|
319
|
+
instanceType = "auth-header-processor";
|
|
377
320
|
}
|
|
378
|
-
else if (type === SocketRouteProcessorType.
|
|
321
|
+
else if (instanceConfig.type === SocketRouteProcessorType.AuthVerifiableCredential) {
|
|
322
|
+
component = new VerifiableCredentialAuthenticationProcessor({
|
|
323
|
+
identityConnectorType: engineCore.getRegisteredInstanceType("identityConnector"),
|
|
324
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
325
|
+
config: {
|
|
326
|
+
...instanceConfig.options?.config
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
instanceType = "verifiable-credential-authentication-processor";
|
|
330
|
+
}
|
|
331
|
+
else if (instanceConfig.type === SocketRouteProcessorType.Logging) {
|
|
379
332
|
component = new LoggingProcessor({
|
|
380
|
-
|
|
333
|
+
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
381
334
|
config: {
|
|
382
335
|
...instanceConfig.options?.config
|
|
383
336
|
}
|
|
384
337
|
});
|
|
385
|
-
instanceType =
|
|
338
|
+
instanceType = "logging-processor";
|
|
386
339
|
}
|
|
387
|
-
else if (type === SocketRouteProcessorType.NodeIdentity) {
|
|
340
|
+
else if (instanceConfig.type === SocketRouteProcessorType.NodeIdentity) {
|
|
388
341
|
component = new NodeIdentityProcessor();
|
|
389
|
-
instanceType =
|
|
342
|
+
instanceType = "node-identity-processor";
|
|
390
343
|
}
|
|
391
|
-
else if (type === SocketRouteProcessorType.StaticUserIdentity) {
|
|
344
|
+
else if (instanceConfig.type === SocketRouteProcessorType.StaticUserIdentity) {
|
|
392
345
|
component = new StaticUserIdentityProcessor(instanceConfig.options);
|
|
393
|
-
instanceType =
|
|
346
|
+
instanceType = "static-user-identity-processor";
|
|
394
347
|
}
|
|
395
|
-
else if (type === SocketRouteProcessorType.SocketRoute) {
|
|
348
|
+
else if (instanceConfig.type === SocketRouteProcessorType.SocketRoute) {
|
|
396
349
|
component = new SocketRouteProcessor(instanceConfig.options);
|
|
397
|
-
instanceType =
|
|
398
|
-
}
|
|
399
|
-
else {
|
|
400
|
-
throw new GeneralError("engineCore", "componentUnknownType", {
|
|
401
|
-
type,
|
|
402
|
-
componentType: "socketRouteProcessorComponent"
|
|
403
|
-
});
|
|
350
|
+
instanceType = "socket-route-processor";
|
|
404
351
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
instanceType
|
|
408
|
-
|
|
409
|
-
}
|
|
410
|
-
SocketRouteProcessorFactory.register(finalInstanceType, () => component);
|
|
411
|
-
return finalInstanceType;
|
|
352
|
+
return {
|
|
353
|
+
component,
|
|
354
|
+
instanceType,
|
|
355
|
+
factory: SocketRouteProcessorFactory
|
|
356
|
+
};
|
|
412
357
|
}
|
|
413
358
|
|
|
414
359
|
export { AuthenticationAdminComponentType, AuthenticationComponentType, InformationComponentType, MimeTypeProcessorType, RestRouteProcessorType, SocketRouteProcessorType, initialiseAuthenticationAdminComponent, initialiseAuthenticationComponent, initialiseInformationComponent, initialiseMimeTypeProcessorComponent, initialiseRestRouteProcessorComponent, initialiseSocketRouteProcessorComponent };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ComponentFactory, type IComponent } from "@twin.org/core";
|
|
1
2
|
import type { IEngineCore, IEngineCoreContext } from "@twin.org/engine-models";
|
|
2
3
|
import type { AuthenticationComponentConfig } from "../models/config/authenticationComponentConfig";
|
|
3
4
|
import type { IEngineServerConfig } from "../models/IEngineServerConfig";
|
|
@@ -6,8 +7,10 @@ import type { IEngineServerConfig } from "../models/IEngineServerConfig";
|
|
|
6
7
|
* @param engineCore The engine core.
|
|
7
8
|
* @param context The context for the engine.
|
|
8
9
|
* @param instanceConfig The instance config.
|
|
9
|
-
* @
|
|
10
|
-
* @returns The name of the instance created.
|
|
11
|
-
* @throws GeneralError if the component type is unknown.
|
|
10
|
+
* @returns The instance created and the factory for it.
|
|
12
11
|
*/
|
|
13
|
-
export declare function initialiseAuthenticationComponent(engineCore: IEngineCore<IEngineServerConfig>, context: IEngineCoreContext<IEngineServerConfig>, instanceConfig: AuthenticationComponentConfig
|
|
12
|
+
export declare function initialiseAuthenticationComponent(engineCore: IEngineCore<IEngineServerConfig>, context: IEngineCoreContext<IEngineServerConfig>, instanceConfig: AuthenticationComponentConfig): Promise<{
|
|
13
|
+
instanceType?: string;
|
|
14
|
+
factory?: typeof ComponentFactory;
|
|
15
|
+
component?: IComponent;
|
|
16
|
+
}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ComponentFactory, type IComponent } from "@twin.org/core";
|
|
1
2
|
import type { IEngineCore, IEngineCoreContext } from "@twin.org/engine-models";
|
|
2
3
|
import type { AuthenticationAdminComponentConfig } from "../models/config/authenticationAdminComponentConfig";
|
|
3
4
|
import type { IEngineServerConfig } from "../models/IEngineServerConfig";
|
|
@@ -6,8 +7,10 @@ import type { IEngineServerConfig } from "../models/IEngineServerConfig";
|
|
|
6
7
|
* @param engineCore The engine core.
|
|
7
8
|
* @param context The context for the engine.
|
|
8
9
|
* @param instanceConfig The instance config.
|
|
9
|
-
* @
|
|
10
|
-
* @returns The name of the instance created.
|
|
11
|
-
* @throws GeneralError if the component type is unknown.
|
|
10
|
+
* @returns The instance created and the factory for it.
|
|
12
11
|
*/
|
|
13
|
-
export declare function initialiseAuthenticationAdminComponent(engineCore: IEngineCore<IEngineServerConfig>, context: IEngineCoreContext<IEngineServerConfig>, instanceConfig: AuthenticationAdminComponentConfig
|
|
12
|
+
export declare function initialiseAuthenticationAdminComponent(engineCore: IEngineCore<IEngineServerConfig>, context: IEngineCoreContext<IEngineServerConfig>, instanceConfig: AuthenticationAdminComponentConfig): Promise<{
|
|
13
|
+
instanceType?: string;
|
|
14
|
+
factory?: typeof ComponentFactory;
|
|
15
|
+
component?: IComponent;
|
|
16
|
+
}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ComponentFactory, type IComponent } from "@twin.org/core";
|
|
1
2
|
import type { IEngineCore, IEngineCoreContext } from "@twin.org/engine-models";
|
|
2
3
|
import type { InformationComponentConfig } from "../models/config/informationComponentConfig";
|
|
3
4
|
import type { IEngineServerConfig } from "../models/IEngineServerConfig";
|
|
@@ -6,8 +7,10 @@ import type { IEngineServerConfig } from "../models/IEngineServerConfig";
|
|
|
6
7
|
* @param engineCore The engine core.
|
|
7
8
|
* @param context The context for the engine.
|
|
8
9
|
* @param instanceConfig The instance config.
|
|
9
|
-
* @
|
|
10
|
-
* @returns The name of the instance created.
|
|
11
|
-
* @throws GeneralError if the component type is unknown.
|
|
10
|
+
* @returns The instance created and the factory for it.
|
|
12
11
|
*/
|
|
13
|
-
export declare function initialiseInformationComponent(engineCore: IEngineCore<IEngineServerConfig>, context: IEngineCoreContext<IEngineServerConfig>, instanceConfig: InformationComponentConfig
|
|
12
|
+
export declare function initialiseInformationComponent(engineCore: IEngineCore<IEngineServerConfig>, context: IEngineCoreContext<IEngineServerConfig>, instanceConfig: InformationComponentConfig): Promise<{
|
|
13
|
+
instanceType?: string;
|
|
14
|
+
factory?: typeof ComponentFactory;
|
|
15
|
+
component?: IComponent;
|
|
16
|
+
}>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { MimeTypeProcessorFactory } from "@twin.org/api-models";
|
|
2
|
+
import type { IComponent } from "@twin.org/core";
|
|
1
3
|
import type { IEngineCore, IEngineCoreContext } from "@twin.org/engine-models";
|
|
2
4
|
import type { MimeTypeProcessorConfig } from "../models/config/mimeTypeProcessorConfig";
|
|
3
5
|
import type { IEngineServerConfig } from "../models/IEngineServerConfig";
|
|
@@ -6,8 +8,10 @@ import type { IEngineServerConfig } from "../models/IEngineServerConfig";
|
|
|
6
8
|
* @param engineCore The engine core.
|
|
7
9
|
* @param context The context for the engine.
|
|
8
10
|
* @param instanceConfig The instance config.
|
|
9
|
-
* @
|
|
10
|
-
* @returns The name of the instance created.
|
|
11
|
-
* @throws GeneralError if the component type is unknown.
|
|
11
|
+
* @returns The instance created and the factory for it.
|
|
12
12
|
*/
|
|
13
|
-
export declare function initialiseMimeTypeProcessorComponent(engineCore: IEngineCore<IEngineServerConfig>, context: IEngineCoreContext<IEngineServerConfig>, instanceConfig: MimeTypeProcessorConfig
|
|
13
|
+
export declare function initialiseMimeTypeProcessorComponent(engineCore: IEngineCore<IEngineServerConfig>, context: IEngineCoreContext<IEngineServerConfig>, instanceConfig: MimeTypeProcessorConfig): Promise<{
|
|
14
|
+
instanceType?: string;
|
|
15
|
+
factory?: typeof MimeTypeProcessorFactory;
|
|
16
|
+
component?: IComponent;
|
|
17
|
+
}>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RestRouteProcessorFactory } from "@twin.org/api-models";
|
|
2
|
+
import type { IComponent } from "@twin.org/core";
|
|
3
|
+
import type { IEngineCore, IEngineCoreContext } from "@twin.org/engine-models";
|
|
2
4
|
import type { RestRouteProcessorConfig } from "../models/config/restRouteProcessorConfig";
|
|
3
5
|
import type { IEngineServerConfig } from "../models/IEngineServerConfig";
|
|
4
6
|
/**
|
|
@@ -6,8 +8,10 @@ import type { IEngineServerConfig } from "../models/IEngineServerConfig";
|
|
|
6
8
|
* @param engineCore The engine core.
|
|
7
9
|
* @param context The context for the engine.
|
|
8
10
|
* @param instanceConfig The instance config.
|
|
9
|
-
* @
|
|
10
|
-
* @returns The name of the instance created.
|
|
11
|
-
* @throws GeneralError if the component type is unknown.
|
|
11
|
+
* @returns The instance created and the factory for it.
|
|
12
12
|
*/
|
|
13
|
-
export declare function initialiseRestRouteProcessorComponent(engineCore: IEngineCore<IEngineServerConfig>, context: IEngineCoreContext<IEngineServerConfig>, instanceConfig: RestRouteProcessorConfig
|
|
13
|
+
export declare function initialiseRestRouteProcessorComponent(engineCore: IEngineCore<IEngineServerConfig>, context: IEngineCoreContext<IEngineServerConfig>, instanceConfig: RestRouteProcessorConfig): Promise<{
|
|
14
|
+
instanceType?: string;
|
|
15
|
+
factory?: typeof RestRouteProcessorFactory;
|
|
16
|
+
component?: IComponent;
|
|
17
|
+
}>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { SocketRouteProcessorFactory } from "@twin.org/api-models";
|
|
2
|
+
import type { IComponent } from "@twin.org/core";
|
|
1
3
|
import type { IEngineCore, IEngineCoreContext } from "@twin.org/engine-models";
|
|
2
4
|
import type { SocketRouteProcessorConfig } from "../models/config/socketRouteProcessorConfig";
|
|
3
5
|
import type { IEngineServerConfig } from "../models/IEngineServerConfig";
|
|
@@ -6,8 +8,10 @@ import type { IEngineServerConfig } from "../models/IEngineServerConfig";
|
|
|
6
8
|
* @param engineCore The engine core.
|
|
7
9
|
* @param context The context for the engine.
|
|
8
10
|
* @param instanceConfig The instance config.
|
|
9
|
-
* @
|
|
10
|
-
* @returns The name of the instance created.
|
|
11
|
-
* @throws GeneralError if the component type is unknown.
|
|
11
|
+
* @returns The instance created and the factory for it.
|
|
12
12
|
*/
|
|
13
|
-
export declare function initialiseSocketRouteProcessorComponent(engineCore: IEngineCore<IEngineServerConfig>, context: IEngineCoreContext<IEngineServerConfig>, instanceConfig: SocketRouteProcessorConfig
|
|
13
|
+
export declare function initialiseSocketRouteProcessorComponent(engineCore: IEngineCore<IEngineServerConfig>, context: IEngineCoreContext<IEngineServerConfig>, instanceConfig: SocketRouteProcessorConfig): Promise<{
|
|
14
|
+
instanceType?: string;
|
|
15
|
+
factory?: typeof SocketRouteProcessorFactory;
|
|
16
|
+
component?: IComponent;
|
|
17
|
+
}>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IAuthHeaderProcessorConstructorOptions } from "@twin.org/api-auth-entity-storage-service";
|
|
2
2
|
import type { ILoggingProcessorConstructorOptions, IRestRouteProcessorConstructorOptions, IStaticUserIdentityProcessorConstructorOptions } from "@twin.org/api-processors";
|
|
3
|
+
import type { IVerifiableCredentialAuthenticationProcessorConstructorOptions } from "@twin.org/identity-authentication";
|
|
3
4
|
import type { RestRouteProcessorType } from "../types/restRouteProcessorType";
|
|
4
5
|
/**
|
|
5
6
|
* REST route processor config types.
|
|
@@ -7,6 +8,9 @@ import type { RestRouteProcessorType } from "../types/restRouteProcessorType";
|
|
|
7
8
|
export type RestRouteProcessorConfig = {
|
|
8
9
|
type: typeof RestRouteProcessorType.AuthHeader;
|
|
9
10
|
options?: IAuthHeaderProcessorConstructorOptions;
|
|
11
|
+
} | {
|
|
12
|
+
type: typeof RestRouteProcessorType.AuthVerifiableCredential;
|
|
13
|
+
options?: IVerifiableCredentialAuthenticationProcessorConstructorOptions;
|
|
10
14
|
} | {
|
|
11
15
|
type: typeof RestRouteProcessorType.Logging;
|
|
12
16
|
options?: ILoggingProcessorConstructorOptions;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IAuthHeaderProcessorConstructorOptions } from "@twin.org/api-auth-entity-storage-service";
|
|
2
2
|
import type { ILoggingProcessorConstructorOptions, ISocketRouteProcessorConstructorOptions, IStaticUserIdentityProcessorConstructorOptions } from "@twin.org/api-processors";
|
|
3
|
+
import type { IVerifiableCredentialAuthenticationProcessorConstructorOptions } from "@twin.org/identity-authentication";
|
|
3
4
|
import type { SocketRouteProcessorType } from "../types/socketRouteProcessorType";
|
|
4
5
|
/**
|
|
5
6
|
* Socket route processor config types.
|
|
@@ -7,6 +8,9 @@ import type { SocketRouteProcessorType } from "../types/socketRouteProcessorType
|
|
|
7
8
|
export type SocketRouteProcessorConfig = {
|
|
8
9
|
type: typeof SocketRouteProcessorType.AuthHeader;
|
|
9
10
|
options?: IAuthHeaderProcessorConstructorOptions;
|
|
11
|
+
} | {
|
|
12
|
+
type: typeof SocketRouteProcessorType.AuthVerifiableCredential;
|
|
13
|
+
options?: IVerifiableCredentialAuthenticationProcessorConstructorOptions;
|
|
10
14
|
} | {
|
|
11
15
|
type: typeof SocketRouteProcessorType.Logging;
|
|
12
16
|
options?: ILoggingProcessorConstructorOptions;
|