@twin.org/engine-server-types 0.0.2-next.17 → 0.0.2-next.19
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 +78 -162
- package/dist/esm/index.mjs +79 -163
- 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/docs/changelog.md +30 -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/package.json +11 -3
package/dist/cjs/index.cjs
CHANGED
|
@@ -32,18 +32,12 @@ const AuthenticationComponentType = {
|
|
|
32
32
|
* @param engineCore The engine core.
|
|
33
33
|
* @param context The context for the engine.
|
|
34
34
|
* @param instanceConfig The instance config.
|
|
35
|
-
* @
|
|
36
|
-
* @returns The name of the instance created.
|
|
37
|
-
* @throws GeneralError if the component type is unknown.
|
|
35
|
+
* @returns The instance created and the factory for it.
|
|
38
36
|
*/
|
|
39
|
-
async function initialiseAuthenticationComponent(engineCore, context, instanceConfig
|
|
40
|
-
engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
|
|
41
|
-
element: `Authentication Component: ${instanceConfig.type}`
|
|
42
|
-
}));
|
|
43
|
-
const type = instanceConfig.type;
|
|
37
|
+
async function initialiseAuthenticationComponent(engineCore, context, instanceConfig) {
|
|
44
38
|
let component;
|
|
45
39
|
let instanceType;
|
|
46
|
-
if (type === AuthenticationComponentType.EntityStorage) {
|
|
40
|
+
if (instanceConfig.type === AuthenticationComponentType.EntityStorage) {
|
|
47
41
|
apiAuthEntityStorageService.initSchema();
|
|
48
42
|
engineTypes.initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.userEntityStorageType, "AuthenticationUser");
|
|
49
43
|
component = new apiAuthEntityStorageService.EntityStorageAuthenticationService({
|
|
@@ -51,25 +45,17 @@ async function initialiseAuthenticationComponent(engineCore, context, instanceCo
|
|
|
51
45
|
authenticationAdminServiceType: engineCore.getRegisteredInstanceType("authenticationAdminComponent"),
|
|
52
46
|
...instanceConfig.options
|
|
53
47
|
});
|
|
54
|
-
instanceType =
|
|
48
|
+
instanceType = "entity-storage-authentication-service";
|
|
55
49
|
}
|
|
56
|
-
else if (type === AuthenticationComponentType.RestClient) {
|
|
50
|
+
else if (instanceConfig.type === AuthenticationComponentType.RestClient) {
|
|
57
51
|
component = new apiAuthEntityStorageRestClient.EntityStorageAuthenticationClient(instanceConfig.options);
|
|
58
|
-
instanceType =
|
|
52
|
+
instanceType = "entity-storage-authentication-client";
|
|
59
53
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
const finalInstanceType = overrideInstanceType ?? instanceType;
|
|
67
|
-
context.componentInstances.push({
|
|
68
|
-
instanceType: finalInstanceType,
|
|
69
|
-
component
|
|
70
|
-
});
|
|
71
|
-
core.ComponentFactory.register(finalInstanceType, () => component);
|
|
72
|
-
return finalInstanceType;
|
|
54
|
+
return {
|
|
55
|
+
component,
|
|
56
|
+
instanceType,
|
|
57
|
+
factory: core.ComponentFactory
|
|
58
|
+
};
|
|
73
59
|
}
|
|
74
60
|
|
|
75
61
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -90,38 +76,24 @@ const AuthenticationAdminComponentType = {
|
|
|
90
76
|
* @param engineCore The engine core.
|
|
91
77
|
* @param context The context for the engine.
|
|
92
78
|
* @param instanceConfig The instance config.
|
|
93
|
-
* @
|
|
94
|
-
* @returns The name of the instance created.
|
|
95
|
-
* @throws GeneralError if the component type is unknown.
|
|
79
|
+
* @returns The instance created and the factory for it.
|
|
96
80
|
*/
|
|
97
|
-
async function initialiseAuthenticationAdminComponent(engineCore, context, instanceConfig
|
|
98
|
-
engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
|
|
99
|
-
element: `Authentication Admin Component: ${instanceConfig.type}`
|
|
100
|
-
}));
|
|
101
|
-
const type = instanceConfig.type;
|
|
81
|
+
async function initialiseAuthenticationAdminComponent(engineCore, context, instanceConfig) {
|
|
102
82
|
let component;
|
|
103
83
|
let instanceType;
|
|
104
|
-
if (type === AuthenticationAdminComponentType.EntityStorage) {
|
|
84
|
+
if (instanceConfig.type === AuthenticationAdminComponentType.EntityStorage) {
|
|
105
85
|
apiAuthEntityStorageService.initSchema();
|
|
106
86
|
engineTypes.initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.userEntityStorageType, "AuthenticationUser");
|
|
107
87
|
component = new apiAuthEntityStorageService.EntityStorageAuthenticationAdminService({
|
|
108
88
|
...instanceConfig.options
|
|
109
89
|
});
|
|
110
|
-
instanceType =
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
throw new core.GeneralError("engineCore", "componentUnknownType", {
|
|
114
|
-
type,
|
|
115
|
-
componentType: "authenticationAdminComponent"
|
|
116
|
-
});
|
|
90
|
+
instanceType = "entity-storage-authentication-admin-service";
|
|
117
91
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
instanceType
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
core.ComponentFactory.register(finalInstanceType, () => component);
|
|
124
|
-
return finalInstanceType;
|
|
92
|
+
return {
|
|
93
|
+
component,
|
|
94
|
+
instanceType,
|
|
95
|
+
factory: core.ComponentFactory
|
|
96
|
+
};
|
|
125
97
|
}
|
|
126
98
|
|
|
127
99
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -146,38 +118,24 @@ const InformationComponentType = {
|
|
|
146
118
|
* @param engineCore The engine core.
|
|
147
119
|
* @param context The context for the engine.
|
|
148
120
|
* @param instanceConfig The instance config.
|
|
149
|
-
* @
|
|
150
|
-
* @returns The name of the instance created.
|
|
151
|
-
* @throws GeneralError if the component type is unknown.
|
|
121
|
+
* @returns The instance created and the factory for it.
|
|
152
122
|
*/
|
|
153
|
-
async function initialiseInformationComponent(engineCore, context, instanceConfig
|
|
154
|
-
engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
|
|
155
|
-
element: `Information Component: ${instanceConfig.type}`
|
|
156
|
-
}));
|
|
157
|
-
const type = instanceConfig.type;
|
|
123
|
+
async function initialiseInformationComponent(engineCore, context, instanceConfig) {
|
|
158
124
|
let component;
|
|
159
125
|
let instanceType;
|
|
160
|
-
if (type === InformationComponentType.Service) {
|
|
126
|
+
if (instanceConfig.type === InformationComponentType.Service) {
|
|
161
127
|
component = new apiService.InformationService(instanceConfig.options);
|
|
162
|
-
instanceType =
|
|
128
|
+
instanceType = "information-service";
|
|
163
129
|
}
|
|
164
|
-
else if (type === InformationComponentType.RestClient) {
|
|
130
|
+
else if (instanceConfig.type === InformationComponentType.RestClient) {
|
|
165
131
|
component = new apiRestClient.InformationClient(instanceConfig.options);
|
|
166
|
-
instanceType =
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
throw new core.GeneralError("engineCore", "componentUnknownType", {
|
|
170
|
-
type,
|
|
171
|
-
componentType: "informationComponent"
|
|
172
|
-
});
|
|
132
|
+
instanceType = "information-client";
|
|
173
133
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
instanceType
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
core.ComponentFactory.register(finalInstanceType, () => component);
|
|
180
|
-
return finalInstanceType;
|
|
134
|
+
return {
|
|
135
|
+
component,
|
|
136
|
+
instanceType,
|
|
137
|
+
factory: core.ComponentFactory
|
|
138
|
+
};
|
|
181
139
|
}
|
|
182
140
|
|
|
183
141
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -200,34 +158,20 @@ const MimeTypeProcessorType = {
|
|
|
200
158
|
* @param engineCore The engine core.
|
|
201
159
|
* @param context The context for the engine.
|
|
202
160
|
* @param instanceConfig The instance config.
|
|
203
|
-
* @
|
|
204
|
-
* @returns The name of the instance created.
|
|
205
|
-
* @throws GeneralError if the component type is unknown.
|
|
161
|
+
* @returns The instance created and the factory for it.
|
|
206
162
|
*/
|
|
207
|
-
async function initialiseMimeTypeProcessorComponent(engineCore, context, instanceConfig
|
|
208
|
-
engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
|
|
209
|
-
element: `Mime Type Processor: ${instanceConfig.type}`
|
|
210
|
-
}));
|
|
211
|
-
const type = instanceConfig.type;
|
|
163
|
+
async function initialiseMimeTypeProcessorComponent(engineCore, context, instanceConfig) {
|
|
212
164
|
let component;
|
|
213
165
|
let instanceType;
|
|
214
|
-
if (type === MimeTypeProcessorType.Jwt) {
|
|
166
|
+
if (instanceConfig.type === MimeTypeProcessorType.Jwt) {
|
|
215
167
|
component = new apiProcessors.JwtMimeTypeProcessor();
|
|
216
|
-
instanceType =
|
|
168
|
+
instanceType = "jwt-mime-type-processor";
|
|
217
169
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
const finalInstanceType = overrideInstanceType ?? instanceType;
|
|
225
|
-
context.componentInstances.push({
|
|
226
|
-
instanceType: finalInstanceType,
|
|
227
|
-
component
|
|
228
|
-
});
|
|
229
|
-
apiModels.MimeTypeProcessorFactory.register(finalInstanceType, () => component);
|
|
230
|
-
return finalInstanceType;
|
|
170
|
+
return {
|
|
171
|
+
component,
|
|
172
|
+
instanceType,
|
|
173
|
+
factory: apiModels.MimeTypeProcessorFactory
|
|
174
|
+
};
|
|
231
175
|
}
|
|
232
176
|
|
|
233
177
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -270,27 +214,21 @@ const RestRouteProcessorType = {
|
|
|
270
214
|
* @param engineCore The engine core.
|
|
271
215
|
* @param context The context for the engine.
|
|
272
216
|
* @param instanceConfig The instance config.
|
|
273
|
-
* @
|
|
274
|
-
* @returns The name of the instance created.
|
|
275
|
-
* @throws GeneralError if the component type is unknown.
|
|
217
|
+
* @returns The instance created and the factory for it.
|
|
276
218
|
*/
|
|
277
|
-
async function initialiseRestRouteProcessorComponent(engineCore, context, instanceConfig
|
|
278
|
-
engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
|
|
279
|
-
element: `REST Route Processor: ${instanceConfig.type}`
|
|
280
|
-
}));
|
|
281
|
-
const type = instanceConfig.type;
|
|
219
|
+
async function initialiseRestRouteProcessorComponent(engineCore, context, instanceConfig) {
|
|
282
220
|
let component;
|
|
283
221
|
let instanceType;
|
|
284
|
-
if (type === RestRouteProcessorType.AuthHeader) {
|
|
222
|
+
if (instanceConfig.type === RestRouteProcessorType.AuthHeader) {
|
|
285
223
|
component = new apiAuthEntityStorageService.AuthHeaderProcessor({
|
|
286
224
|
vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
|
|
287
225
|
config: {
|
|
288
226
|
...instanceConfig.options?.config
|
|
289
227
|
}
|
|
290
228
|
});
|
|
291
|
-
instanceType =
|
|
229
|
+
instanceType = "auth-header-processor";
|
|
292
230
|
}
|
|
293
|
-
else if (type === RestRouteProcessorType.AuthVerifiableCredential) {
|
|
231
|
+
else if (instanceConfig.type === RestRouteProcessorType.AuthVerifiableCredential) {
|
|
294
232
|
component = new identityAuthentication.VerifiableCredentialAuthenticationProcessor({
|
|
295
233
|
identityConnectorType: engineCore.getRegisteredInstanceType("identityConnector"),
|
|
296
234
|
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
@@ -298,42 +236,34 @@ async function initialiseRestRouteProcessorComponent(engineCore, context, instan
|
|
|
298
236
|
...instanceConfig.options?.config
|
|
299
237
|
}
|
|
300
238
|
});
|
|
301
|
-
instanceType =
|
|
239
|
+
instanceType = "verifiable-credential-authentication-processor";
|
|
302
240
|
}
|
|
303
|
-
else if (type === RestRouteProcessorType.Logging) {
|
|
241
|
+
else if (instanceConfig.type === RestRouteProcessorType.Logging) {
|
|
304
242
|
component = new apiProcessors.LoggingProcessor({
|
|
305
243
|
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
306
244
|
config: {
|
|
307
245
|
...instanceConfig.options?.config
|
|
308
246
|
}
|
|
309
247
|
});
|
|
310
|
-
instanceType =
|
|
248
|
+
instanceType = "logging-processor";
|
|
311
249
|
}
|
|
312
|
-
else if (type === RestRouteProcessorType.NodeIdentity) {
|
|
250
|
+
else if (instanceConfig.type === RestRouteProcessorType.NodeIdentity) {
|
|
313
251
|
component = new apiProcessors.NodeIdentityProcessor();
|
|
314
|
-
instanceType =
|
|
252
|
+
instanceType = "node-identity-processor";
|
|
315
253
|
}
|
|
316
|
-
else if (type === RestRouteProcessorType.StaticUserIdentity) {
|
|
254
|
+
else if (instanceConfig.type === RestRouteProcessorType.StaticUserIdentity) {
|
|
317
255
|
component = new apiProcessors.StaticUserIdentityProcessor(instanceConfig.options);
|
|
318
|
-
instanceType =
|
|
256
|
+
instanceType = "static-user-identity-processor";
|
|
319
257
|
}
|
|
320
|
-
else if (type === RestRouteProcessorType.RestRoute) {
|
|
258
|
+
else if (instanceConfig.type === RestRouteProcessorType.RestRoute) {
|
|
321
259
|
component = new apiProcessors.RestRouteProcessor(instanceConfig.options);
|
|
322
|
-
instanceType =
|
|
323
|
-
}
|
|
324
|
-
else {
|
|
325
|
-
throw new core.GeneralError("engineCore", "componentUnknownType", {
|
|
326
|
-
type,
|
|
327
|
-
componentType: "restRouteProcessorComponent"
|
|
328
|
-
});
|
|
260
|
+
instanceType = "rest-route-processor";
|
|
329
261
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
instanceType
|
|
333
|
-
|
|
334
|
-
}
|
|
335
|
-
apiModels.RestRouteProcessorFactory.register(finalInstanceType, () => component);
|
|
336
|
-
return finalInstanceType;
|
|
262
|
+
return {
|
|
263
|
+
component,
|
|
264
|
+
instanceType,
|
|
265
|
+
factory: apiModels.RestRouteProcessorFactory
|
|
266
|
+
};
|
|
337
267
|
}
|
|
338
268
|
|
|
339
269
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -376,27 +306,21 @@ const SocketRouteProcessorType = {
|
|
|
376
306
|
* @param engineCore The engine core.
|
|
377
307
|
* @param context The context for the engine.
|
|
378
308
|
* @param instanceConfig The instance config.
|
|
379
|
-
* @
|
|
380
|
-
* @returns The name of the instance created.
|
|
381
|
-
* @throws GeneralError if the component type is unknown.
|
|
309
|
+
* @returns The instance created and the factory for it.
|
|
382
310
|
*/
|
|
383
|
-
async function initialiseSocketRouteProcessorComponent(engineCore, context, instanceConfig
|
|
384
|
-
engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
|
|
385
|
-
element: `Socket Route Processor: ${instanceConfig.type}`
|
|
386
|
-
}));
|
|
387
|
-
const type = instanceConfig.type;
|
|
311
|
+
async function initialiseSocketRouteProcessorComponent(engineCore, context, instanceConfig) {
|
|
388
312
|
let component;
|
|
389
313
|
let instanceType;
|
|
390
|
-
if (type === SocketRouteProcessorType.AuthHeader) {
|
|
314
|
+
if (instanceConfig.type === SocketRouteProcessorType.AuthHeader) {
|
|
391
315
|
component = new apiAuthEntityStorageService.AuthHeaderProcessor({
|
|
392
316
|
vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
|
|
393
317
|
config: {
|
|
394
318
|
...instanceConfig.options?.config
|
|
395
319
|
}
|
|
396
320
|
});
|
|
397
|
-
instanceType =
|
|
321
|
+
instanceType = "auth-header-processor";
|
|
398
322
|
}
|
|
399
|
-
else if (type === SocketRouteProcessorType.AuthVerifiableCredential) {
|
|
323
|
+
else if (instanceConfig.type === SocketRouteProcessorType.AuthVerifiableCredential) {
|
|
400
324
|
component = new identityAuthentication.VerifiableCredentialAuthenticationProcessor({
|
|
401
325
|
identityConnectorType: engineCore.getRegisteredInstanceType("identityConnector"),
|
|
402
326
|
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
@@ -404,42 +328,34 @@ async function initialiseSocketRouteProcessorComponent(engineCore, context, inst
|
|
|
404
328
|
...instanceConfig.options?.config
|
|
405
329
|
}
|
|
406
330
|
});
|
|
407
|
-
instanceType =
|
|
331
|
+
instanceType = "verifiable-credential-authentication-processor";
|
|
408
332
|
}
|
|
409
|
-
else if (type === SocketRouteProcessorType.Logging) {
|
|
333
|
+
else if (instanceConfig.type === SocketRouteProcessorType.Logging) {
|
|
410
334
|
component = new apiProcessors.LoggingProcessor({
|
|
411
335
|
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
412
336
|
config: {
|
|
413
337
|
...instanceConfig.options?.config
|
|
414
338
|
}
|
|
415
339
|
});
|
|
416
|
-
instanceType =
|
|
340
|
+
instanceType = "logging-processor";
|
|
417
341
|
}
|
|
418
|
-
else if (type === SocketRouteProcessorType.NodeIdentity) {
|
|
342
|
+
else if (instanceConfig.type === SocketRouteProcessorType.NodeIdentity) {
|
|
419
343
|
component = new apiProcessors.NodeIdentityProcessor();
|
|
420
|
-
instanceType =
|
|
344
|
+
instanceType = "node-identity-processor";
|
|
421
345
|
}
|
|
422
|
-
else if (type === SocketRouteProcessorType.StaticUserIdentity) {
|
|
346
|
+
else if (instanceConfig.type === SocketRouteProcessorType.StaticUserIdentity) {
|
|
423
347
|
component = new apiProcessors.StaticUserIdentityProcessor(instanceConfig.options);
|
|
424
|
-
instanceType =
|
|
348
|
+
instanceType = "static-user-identity-processor";
|
|
425
349
|
}
|
|
426
|
-
else if (type === SocketRouteProcessorType.SocketRoute) {
|
|
350
|
+
else if (instanceConfig.type === SocketRouteProcessorType.SocketRoute) {
|
|
427
351
|
component = new apiProcessors.SocketRouteProcessor(instanceConfig.options);
|
|
428
|
-
instanceType =
|
|
429
|
-
}
|
|
430
|
-
else {
|
|
431
|
-
throw new core.GeneralError("engineCore", "componentUnknownType", {
|
|
432
|
-
type,
|
|
433
|
-
componentType: "socketRouteProcessorComponent"
|
|
434
|
-
});
|
|
352
|
+
instanceType = "socket-route-processor";
|
|
435
353
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
instanceType
|
|
439
|
-
|
|
440
|
-
}
|
|
441
|
-
apiModels.SocketRouteProcessorFactory.register(finalInstanceType, () => component);
|
|
442
|
-
return finalInstanceType;
|
|
354
|
+
return {
|
|
355
|
+
component,
|
|
356
|
+
instanceType,
|
|
357
|
+
factory: apiModels.SocketRouteProcessorFactory
|
|
358
|
+
};
|
|
443
359
|
}
|
|
444
360
|
|
|
445
361
|
exports.AuthenticationAdminComponentType = AuthenticationAdminComponentType;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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';
|
|
@@ -30,18 +30,12 @@ const AuthenticationComponentType = {
|
|
|
30
30
|
* @param engineCore The engine core.
|
|
31
31
|
* @param context The context for the engine.
|
|
32
32
|
* @param instanceConfig The instance config.
|
|
33
|
-
* @
|
|
34
|
-
* @returns The name of the instance created.
|
|
35
|
-
* @throws GeneralError if the component type is unknown.
|
|
33
|
+
* @returns The instance created and the factory for it.
|
|
36
34
|
*/
|
|
37
|
-
async function initialiseAuthenticationComponent(engineCore, context, instanceConfig
|
|
38
|
-
engineCore.logInfo(I18n.formatMessage("engineCore.configuring", {
|
|
39
|
-
element: `Authentication Component: ${instanceConfig.type}`
|
|
40
|
-
}));
|
|
41
|
-
const type = instanceConfig.type;
|
|
35
|
+
async function initialiseAuthenticationComponent(engineCore, context, instanceConfig) {
|
|
42
36
|
let component;
|
|
43
37
|
let instanceType;
|
|
44
|
-
if (type === AuthenticationComponentType.EntityStorage) {
|
|
38
|
+
if (instanceConfig.type === AuthenticationComponentType.EntityStorage) {
|
|
45
39
|
initSchema();
|
|
46
40
|
initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.userEntityStorageType, "AuthenticationUser");
|
|
47
41
|
component = new EntityStorageAuthenticationService({
|
|
@@ -49,25 +43,17 @@ async function initialiseAuthenticationComponent(engineCore, context, instanceCo
|
|
|
49
43
|
authenticationAdminServiceType: engineCore.getRegisteredInstanceType("authenticationAdminComponent"),
|
|
50
44
|
...instanceConfig.options
|
|
51
45
|
});
|
|
52
|
-
instanceType =
|
|
46
|
+
instanceType = "entity-storage-authentication-service";
|
|
53
47
|
}
|
|
54
|
-
else if (type === AuthenticationComponentType.RestClient) {
|
|
48
|
+
else if (instanceConfig.type === AuthenticationComponentType.RestClient) {
|
|
55
49
|
component = new EntityStorageAuthenticationClient(instanceConfig.options);
|
|
56
|
-
instanceType =
|
|
50
|
+
instanceType = "entity-storage-authentication-client";
|
|
57
51
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
const finalInstanceType = overrideInstanceType ?? instanceType;
|
|
65
|
-
context.componentInstances.push({
|
|
66
|
-
instanceType: finalInstanceType,
|
|
67
|
-
component
|
|
68
|
-
});
|
|
69
|
-
ComponentFactory.register(finalInstanceType, () => component);
|
|
70
|
-
return finalInstanceType;
|
|
52
|
+
return {
|
|
53
|
+
component,
|
|
54
|
+
instanceType,
|
|
55
|
+
factory: ComponentFactory
|
|
56
|
+
};
|
|
71
57
|
}
|
|
72
58
|
|
|
73
59
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -88,38 +74,24 @@ const AuthenticationAdminComponentType = {
|
|
|
88
74
|
* @param engineCore The engine core.
|
|
89
75
|
* @param context The context for the engine.
|
|
90
76
|
* @param instanceConfig The instance config.
|
|
91
|
-
* @
|
|
92
|
-
* @returns The name of the instance created.
|
|
93
|
-
* @throws GeneralError if the component type is unknown.
|
|
77
|
+
* @returns The instance created and the factory for it.
|
|
94
78
|
*/
|
|
95
|
-
async function initialiseAuthenticationAdminComponent(engineCore, context, instanceConfig
|
|
96
|
-
engineCore.logInfo(I18n.formatMessage("engineCore.configuring", {
|
|
97
|
-
element: `Authentication Admin Component: ${instanceConfig.type}`
|
|
98
|
-
}));
|
|
99
|
-
const type = instanceConfig.type;
|
|
79
|
+
async function initialiseAuthenticationAdminComponent(engineCore, context, instanceConfig) {
|
|
100
80
|
let component;
|
|
101
81
|
let instanceType;
|
|
102
|
-
if (type === AuthenticationAdminComponentType.EntityStorage) {
|
|
82
|
+
if (instanceConfig.type === AuthenticationAdminComponentType.EntityStorage) {
|
|
103
83
|
initSchema();
|
|
104
84
|
initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.userEntityStorageType, "AuthenticationUser");
|
|
105
85
|
component = new EntityStorageAuthenticationAdminService({
|
|
106
86
|
...instanceConfig.options
|
|
107
87
|
});
|
|
108
|
-
instanceType =
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
throw new GeneralError("engineCore", "componentUnknownType", {
|
|
112
|
-
type,
|
|
113
|
-
componentType: "authenticationAdminComponent"
|
|
114
|
-
});
|
|
88
|
+
instanceType = "entity-storage-authentication-admin-service";
|
|
115
89
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
instanceType
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
ComponentFactory.register(finalInstanceType, () => component);
|
|
122
|
-
return finalInstanceType;
|
|
90
|
+
return {
|
|
91
|
+
component,
|
|
92
|
+
instanceType,
|
|
93
|
+
factory: ComponentFactory
|
|
94
|
+
};
|
|
123
95
|
}
|
|
124
96
|
|
|
125
97
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -144,38 +116,24 @@ const InformationComponentType = {
|
|
|
144
116
|
* @param engineCore The engine core.
|
|
145
117
|
* @param context The context for the engine.
|
|
146
118
|
* @param instanceConfig The instance config.
|
|
147
|
-
* @
|
|
148
|
-
* @returns The name of the instance created.
|
|
149
|
-
* @throws GeneralError if the component type is unknown.
|
|
119
|
+
* @returns The instance created and the factory for it.
|
|
150
120
|
*/
|
|
151
|
-
async function initialiseInformationComponent(engineCore, context, instanceConfig
|
|
152
|
-
engineCore.logInfo(I18n.formatMessage("engineCore.configuring", {
|
|
153
|
-
element: `Information Component: ${instanceConfig.type}`
|
|
154
|
-
}));
|
|
155
|
-
const type = instanceConfig.type;
|
|
121
|
+
async function initialiseInformationComponent(engineCore, context, instanceConfig) {
|
|
156
122
|
let component;
|
|
157
123
|
let instanceType;
|
|
158
|
-
if (type === InformationComponentType.Service) {
|
|
124
|
+
if (instanceConfig.type === InformationComponentType.Service) {
|
|
159
125
|
component = new InformationService(instanceConfig.options);
|
|
160
|
-
instanceType =
|
|
126
|
+
instanceType = "information-service";
|
|
161
127
|
}
|
|
162
|
-
else if (type === InformationComponentType.RestClient) {
|
|
128
|
+
else if (instanceConfig.type === InformationComponentType.RestClient) {
|
|
163
129
|
component = new InformationClient(instanceConfig.options);
|
|
164
|
-
instanceType =
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
throw new GeneralError("engineCore", "componentUnknownType", {
|
|
168
|
-
type,
|
|
169
|
-
componentType: "informationComponent"
|
|
170
|
-
});
|
|
130
|
+
instanceType = "information-client";
|
|
171
131
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
instanceType
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
ComponentFactory.register(finalInstanceType, () => component);
|
|
178
|
-
return finalInstanceType;
|
|
132
|
+
return {
|
|
133
|
+
component,
|
|
134
|
+
instanceType,
|
|
135
|
+
factory: ComponentFactory
|
|
136
|
+
};
|
|
179
137
|
}
|
|
180
138
|
|
|
181
139
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -198,34 +156,20 @@ const MimeTypeProcessorType = {
|
|
|
198
156
|
* @param engineCore The engine core.
|
|
199
157
|
* @param context The context for the engine.
|
|
200
158
|
* @param instanceConfig The instance config.
|
|
201
|
-
* @
|
|
202
|
-
* @returns The name of the instance created.
|
|
203
|
-
* @throws GeneralError if the component type is unknown.
|
|
159
|
+
* @returns The instance created and the factory for it.
|
|
204
160
|
*/
|
|
205
|
-
async function initialiseMimeTypeProcessorComponent(engineCore, context, instanceConfig
|
|
206
|
-
engineCore.logInfo(I18n.formatMessage("engineCore.configuring", {
|
|
207
|
-
element: `Mime Type Processor: ${instanceConfig.type}`
|
|
208
|
-
}));
|
|
209
|
-
const type = instanceConfig.type;
|
|
161
|
+
async function initialiseMimeTypeProcessorComponent(engineCore, context, instanceConfig) {
|
|
210
162
|
let component;
|
|
211
163
|
let instanceType;
|
|
212
|
-
if (type === MimeTypeProcessorType.Jwt) {
|
|
164
|
+
if (instanceConfig.type === MimeTypeProcessorType.Jwt) {
|
|
213
165
|
component = new JwtMimeTypeProcessor();
|
|
214
|
-
instanceType =
|
|
166
|
+
instanceType = "jwt-mime-type-processor";
|
|
215
167
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
const finalInstanceType = overrideInstanceType ?? instanceType;
|
|
223
|
-
context.componentInstances.push({
|
|
224
|
-
instanceType: finalInstanceType,
|
|
225
|
-
component
|
|
226
|
-
});
|
|
227
|
-
MimeTypeProcessorFactory.register(finalInstanceType, () => component);
|
|
228
|
-
return finalInstanceType;
|
|
168
|
+
return {
|
|
169
|
+
component,
|
|
170
|
+
instanceType,
|
|
171
|
+
factory: MimeTypeProcessorFactory
|
|
172
|
+
};
|
|
229
173
|
}
|
|
230
174
|
|
|
231
175
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -268,27 +212,21 @@ const RestRouteProcessorType = {
|
|
|
268
212
|
* @param engineCore The engine core.
|
|
269
213
|
* @param context The context for the engine.
|
|
270
214
|
* @param instanceConfig The instance config.
|
|
271
|
-
* @
|
|
272
|
-
* @returns The name of the instance created.
|
|
273
|
-
* @throws GeneralError if the component type is unknown.
|
|
215
|
+
* @returns The instance created and the factory for it.
|
|
274
216
|
*/
|
|
275
|
-
async function initialiseRestRouteProcessorComponent(engineCore, context, instanceConfig
|
|
276
|
-
engineCore.logInfo(I18n.formatMessage("engineCore.configuring", {
|
|
277
|
-
element: `REST Route Processor: ${instanceConfig.type}`
|
|
278
|
-
}));
|
|
279
|
-
const type = instanceConfig.type;
|
|
217
|
+
async function initialiseRestRouteProcessorComponent(engineCore, context, instanceConfig) {
|
|
280
218
|
let component;
|
|
281
219
|
let instanceType;
|
|
282
|
-
if (type === RestRouteProcessorType.AuthHeader) {
|
|
220
|
+
if (instanceConfig.type === RestRouteProcessorType.AuthHeader) {
|
|
283
221
|
component = new AuthHeaderProcessor({
|
|
284
222
|
vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
|
|
285
223
|
config: {
|
|
286
224
|
...instanceConfig.options?.config
|
|
287
225
|
}
|
|
288
226
|
});
|
|
289
|
-
instanceType =
|
|
227
|
+
instanceType = "auth-header-processor";
|
|
290
228
|
}
|
|
291
|
-
else if (type === RestRouteProcessorType.AuthVerifiableCredential) {
|
|
229
|
+
else if (instanceConfig.type === RestRouteProcessorType.AuthVerifiableCredential) {
|
|
292
230
|
component = new VerifiableCredentialAuthenticationProcessor({
|
|
293
231
|
identityConnectorType: engineCore.getRegisteredInstanceType("identityConnector"),
|
|
294
232
|
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
@@ -296,42 +234,34 @@ async function initialiseRestRouteProcessorComponent(engineCore, context, instan
|
|
|
296
234
|
...instanceConfig.options?.config
|
|
297
235
|
}
|
|
298
236
|
});
|
|
299
|
-
instanceType =
|
|
237
|
+
instanceType = "verifiable-credential-authentication-processor";
|
|
300
238
|
}
|
|
301
|
-
else if (type === RestRouteProcessorType.Logging) {
|
|
239
|
+
else if (instanceConfig.type === RestRouteProcessorType.Logging) {
|
|
302
240
|
component = new LoggingProcessor({
|
|
303
241
|
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
304
242
|
config: {
|
|
305
243
|
...instanceConfig.options?.config
|
|
306
244
|
}
|
|
307
245
|
});
|
|
308
|
-
instanceType =
|
|
246
|
+
instanceType = "logging-processor";
|
|
309
247
|
}
|
|
310
|
-
else if (type === RestRouteProcessorType.NodeIdentity) {
|
|
248
|
+
else if (instanceConfig.type === RestRouteProcessorType.NodeIdentity) {
|
|
311
249
|
component = new NodeIdentityProcessor();
|
|
312
|
-
instanceType =
|
|
250
|
+
instanceType = "node-identity-processor";
|
|
313
251
|
}
|
|
314
|
-
else if (type === RestRouteProcessorType.StaticUserIdentity) {
|
|
252
|
+
else if (instanceConfig.type === RestRouteProcessorType.StaticUserIdentity) {
|
|
315
253
|
component = new StaticUserIdentityProcessor(instanceConfig.options);
|
|
316
|
-
instanceType =
|
|
254
|
+
instanceType = "static-user-identity-processor";
|
|
317
255
|
}
|
|
318
|
-
else if (type === RestRouteProcessorType.RestRoute) {
|
|
256
|
+
else if (instanceConfig.type === RestRouteProcessorType.RestRoute) {
|
|
319
257
|
component = new RestRouteProcessor(instanceConfig.options);
|
|
320
|
-
instanceType =
|
|
321
|
-
}
|
|
322
|
-
else {
|
|
323
|
-
throw new GeneralError("engineCore", "componentUnknownType", {
|
|
324
|
-
type,
|
|
325
|
-
componentType: "restRouteProcessorComponent"
|
|
326
|
-
});
|
|
258
|
+
instanceType = "rest-route-processor";
|
|
327
259
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
instanceType
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
RestRouteProcessorFactory.register(finalInstanceType, () => component);
|
|
334
|
-
return finalInstanceType;
|
|
260
|
+
return {
|
|
261
|
+
component,
|
|
262
|
+
instanceType,
|
|
263
|
+
factory: RestRouteProcessorFactory
|
|
264
|
+
};
|
|
335
265
|
}
|
|
336
266
|
|
|
337
267
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -374,27 +304,21 @@ const SocketRouteProcessorType = {
|
|
|
374
304
|
* @param engineCore The engine core.
|
|
375
305
|
* @param context The context for the engine.
|
|
376
306
|
* @param instanceConfig The instance config.
|
|
377
|
-
* @
|
|
378
|
-
* @returns The name of the instance created.
|
|
379
|
-
* @throws GeneralError if the component type is unknown.
|
|
307
|
+
* @returns The instance created and the factory for it.
|
|
380
308
|
*/
|
|
381
|
-
async function initialiseSocketRouteProcessorComponent(engineCore, context, instanceConfig
|
|
382
|
-
engineCore.logInfo(I18n.formatMessage("engineCore.configuring", {
|
|
383
|
-
element: `Socket Route Processor: ${instanceConfig.type}`
|
|
384
|
-
}));
|
|
385
|
-
const type = instanceConfig.type;
|
|
309
|
+
async function initialiseSocketRouteProcessorComponent(engineCore, context, instanceConfig) {
|
|
386
310
|
let component;
|
|
387
311
|
let instanceType;
|
|
388
|
-
if (type === SocketRouteProcessorType.AuthHeader) {
|
|
312
|
+
if (instanceConfig.type === SocketRouteProcessorType.AuthHeader) {
|
|
389
313
|
component = new AuthHeaderProcessor({
|
|
390
314
|
vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
|
|
391
315
|
config: {
|
|
392
316
|
...instanceConfig.options?.config
|
|
393
317
|
}
|
|
394
318
|
});
|
|
395
|
-
instanceType =
|
|
319
|
+
instanceType = "auth-header-processor";
|
|
396
320
|
}
|
|
397
|
-
else if (type === SocketRouteProcessorType.AuthVerifiableCredential) {
|
|
321
|
+
else if (instanceConfig.type === SocketRouteProcessorType.AuthVerifiableCredential) {
|
|
398
322
|
component = new VerifiableCredentialAuthenticationProcessor({
|
|
399
323
|
identityConnectorType: engineCore.getRegisteredInstanceType("identityConnector"),
|
|
400
324
|
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
@@ -402,42 +326,34 @@ async function initialiseSocketRouteProcessorComponent(engineCore, context, inst
|
|
|
402
326
|
...instanceConfig.options?.config
|
|
403
327
|
}
|
|
404
328
|
});
|
|
405
|
-
instanceType =
|
|
329
|
+
instanceType = "verifiable-credential-authentication-processor";
|
|
406
330
|
}
|
|
407
|
-
else if (type === SocketRouteProcessorType.Logging) {
|
|
331
|
+
else if (instanceConfig.type === SocketRouteProcessorType.Logging) {
|
|
408
332
|
component = new LoggingProcessor({
|
|
409
333
|
loggingComponentType: engineCore.getRegisteredInstanceType("loggingComponent"),
|
|
410
334
|
config: {
|
|
411
335
|
...instanceConfig.options?.config
|
|
412
336
|
}
|
|
413
337
|
});
|
|
414
|
-
instanceType =
|
|
338
|
+
instanceType = "logging-processor";
|
|
415
339
|
}
|
|
416
|
-
else if (type === SocketRouteProcessorType.NodeIdentity) {
|
|
340
|
+
else if (instanceConfig.type === SocketRouteProcessorType.NodeIdentity) {
|
|
417
341
|
component = new NodeIdentityProcessor();
|
|
418
|
-
instanceType =
|
|
342
|
+
instanceType = "node-identity-processor";
|
|
419
343
|
}
|
|
420
|
-
else if (type === SocketRouteProcessorType.StaticUserIdentity) {
|
|
344
|
+
else if (instanceConfig.type === SocketRouteProcessorType.StaticUserIdentity) {
|
|
421
345
|
component = new StaticUserIdentityProcessor(instanceConfig.options);
|
|
422
|
-
instanceType =
|
|
346
|
+
instanceType = "static-user-identity-processor";
|
|
423
347
|
}
|
|
424
|
-
else if (type === SocketRouteProcessorType.SocketRoute) {
|
|
348
|
+
else if (instanceConfig.type === SocketRouteProcessorType.SocketRoute) {
|
|
425
349
|
component = new SocketRouteProcessor(instanceConfig.options);
|
|
426
|
-
instanceType =
|
|
427
|
-
}
|
|
428
|
-
else {
|
|
429
|
-
throw new GeneralError("engineCore", "componentUnknownType", {
|
|
430
|
-
type,
|
|
431
|
-
componentType: "socketRouteProcessorComponent"
|
|
432
|
-
});
|
|
350
|
+
instanceType = "socket-route-processor";
|
|
433
351
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
instanceType
|
|
437
|
-
|
|
438
|
-
}
|
|
439
|
-
SocketRouteProcessorFactory.register(finalInstanceType, () => component);
|
|
440
|
-
return finalInstanceType;
|
|
352
|
+
return {
|
|
353
|
+
component,
|
|
354
|
+
instanceType,
|
|
355
|
+
factory: SocketRouteProcessorFactory
|
|
356
|
+
};
|
|
441
357
|
}
|
|
442
358
|
|
|
443
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
|
+
}>;
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @twin.org/engine-server-types - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.2-next.19](https://github.com/twinfoundation/engine/compare/engine-server-types-v0.0.2-next.18...engine-server-types-v0.0.2-next.19) (2025-10-02)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* simplify config building ([732c871](https://github.com/twinfoundation/engine/commit/732c871c5aca236759168f4bc15aeffd98a330a8))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/engine-models bumped from 0.0.2-next.18 to 0.0.2-next.19
|
|
16
|
+
* @twin.org/engine-types bumped from 0.0.2-next.18 to 0.0.2-next.19
|
|
17
|
+
|
|
18
|
+
## [0.0.2-next.18](https://github.com/twinfoundation/engine/compare/engine-server-types-v0.0.2-next.17...engine-server-types-v0.0.2-next.18) (2025-09-29)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* upgrade framework components ([efd52e8](https://github.com/twinfoundation/engine/commit/efd52e80564fff29c3897bfa09b6305b3a322812))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Dependencies
|
|
27
|
+
|
|
28
|
+
* The following workspace dependencies were updated
|
|
29
|
+
* dependencies
|
|
30
|
+
* @twin.org/engine-models bumped from 0.0.2-next.17 to 0.0.2-next.18
|
|
31
|
+
* @twin.org/engine-types bumped from 0.0.2-next.17 to 0.0.2-next.18
|
|
32
|
+
|
|
3
33
|
## [0.0.2-next.17](https://github.com/twinfoundation/engine/compare/engine-server-types-v0.0.2-next.16...engine-server-types-v0.0.2-next.17) (2025-09-26)
|
|
4
34
|
|
|
5
35
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Function: initialiseAuthenticationAdminComponent()
|
|
2
2
|
|
|
3
|
-
> **initialiseAuthenticationAdminComponent**(`engineCore`, `context`, `instanceConfig
|
|
3
|
+
> **initialiseAuthenticationAdminComponent**(`engineCore`, `context`, `instanceConfig`): `Promise`\<\{ `instanceType?`: `string`; `factory?`: `Factory`\<`IComponent`\>; `component?`: `IComponent`; \}\>
|
|
4
4
|
|
|
5
5
|
Initialise the authentication admin.
|
|
6
6
|
|
|
@@ -24,18 +24,8 @@ The context for the engine.
|
|
|
24
24
|
|
|
25
25
|
The instance config.
|
|
26
26
|
|
|
27
|
-
### overrideInstanceType?
|
|
28
|
-
|
|
29
|
-
`string`
|
|
30
|
-
|
|
31
|
-
The instance type to override the default.
|
|
32
|
-
|
|
33
27
|
## Returns
|
|
34
28
|
|
|
35
|
-
`Promise`\<`
|
|
36
|
-
|
|
37
|
-
The name of the instance created.
|
|
38
|
-
|
|
39
|
-
## Throws
|
|
29
|
+
`Promise`\<\{ `instanceType?`: `string`; `factory?`: `Factory`\<`IComponent`\>; `component?`: `IComponent`; \}\>
|
|
40
30
|
|
|
41
|
-
|
|
31
|
+
The instance created and the factory for it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Function: initialiseAuthenticationComponent()
|
|
2
2
|
|
|
3
|
-
> **initialiseAuthenticationComponent**(`engineCore`, `context`, `instanceConfig
|
|
3
|
+
> **initialiseAuthenticationComponent**(`engineCore`, `context`, `instanceConfig`): `Promise`\<\{ `instanceType?`: `string`; `factory?`: `Factory`\<`IComponent`\>; `component?`: `IComponent`; \}\>
|
|
4
4
|
|
|
5
5
|
Initialise the authentication.
|
|
6
6
|
|
|
@@ -24,18 +24,8 @@ The context for the engine.
|
|
|
24
24
|
|
|
25
25
|
The instance config.
|
|
26
26
|
|
|
27
|
-
### overrideInstanceType?
|
|
28
|
-
|
|
29
|
-
`string`
|
|
30
|
-
|
|
31
|
-
The instance type to override the default.
|
|
32
|
-
|
|
33
27
|
## Returns
|
|
34
28
|
|
|
35
|
-
`Promise`\<`
|
|
36
|
-
|
|
37
|
-
The name of the instance created.
|
|
38
|
-
|
|
39
|
-
## Throws
|
|
29
|
+
`Promise`\<\{ `instanceType?`: `string`; `factory?`: `Factory`\<`IComponent`\>; `component?`: `IComponent`; \}\>
|
|
40
30
|
|
|
41
|
-
|
|
31
|
+
The instance created and the factory for it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Function: initialiseInformationComponent()
|
|
2
2
|
|
|
3
|
-
> **initialiseInformationComponent**(`engineCore`, `context`, `instanceConfig
|
|
3
|
+
> **initialiseInformationComponent**(`engineCore`, `context`, `instanceConfig`): `Promise`\<\{ `instanceType?`: `string`; `factory?`: `Factory`\<`IComponent`\>; `component?`: `IComponent`; \}\>
|
|
4
4
|
|
|
5
5
|
Initialise the information component.
|
|
6
6
|
|
|
@@ -24,18 +24,8 @@ The context for the engine.
|
|
|
24
24
|
|
|
25
25
|
The instance config.
|
|
26
26
|
|
|
27
|
-
### overrideInstanceType?
|
|
28
|
-
|
|
29
|
-
`string`
|
|
30
|
-
|
|
31
|
-
The instance type to override the default.
|
|
32
|
-
|
|
33
27
|
## Returns
|
|
34
28
|
|
|
35
|
-
`Promise`\<`
|
|
36
|
-
|
|
37
|
-
The name of the instance created.
|
|
38
|
-
|
|
39
|
-
## Throws
|
|
29
|
+
`Promise`\<\{ `instanceType?`: `string`; `factory?`: `Factory`\<`IComponent`\>; `component?`: `IComponent`; \}\>
|
|
40
30
|
|
|
41
|
-
|
|
31
|
+
The instance created and the factory for it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Function: initialiseMimeTypeProcessorComponent()
|
|
2
2
|
|
|
3
|
-
> **initialiseMimeTypeProcessorComponent**(`engineCore`, `context`, `instanceConfig
|
|
3
|
+
> **initialiseMimeTypeProcessorComponent**(`engineCore`, `context`, `instanceConfig`): `Promise`\<\{ `instanceType?`: `string`; `factory?`: `Factory`\<`IMimeTypeProcessor`\>; `component?`: `IComponent`; \}\>
|
|
4
4
|
|
|
5
5
|
Initialise the mime type processor.
|
|
6
6
|
|
|
@@ -24,18 +24,8 @@ The context for the engine.
|
|
|
24
24
|
|
|
25
25
|
The instance config.
|
|
26
26
|
|
|
27
|
-
### overrideInstanceType?
|
|
28
|
-
|
|
29
|
-
`string`
|
|
30
|
-
|
|
31
|
-
The instance type to override the default.
|
|
32
|
-
|
|
33
27
|
## Returns
|
|
34
28
|
|
|
35
|
-
`Promise`\<`
|
|
36
|
-
|
|
37
|
-
The name of the instance created.
|
|
38
|
-
|
|
39
|
-
## Throws
|
|
29
|
+
`Promise`\<\{ `instanceType?`: `string`; `factory?`: `Factory`\<`IMimeTypeProcessor`\>; `component?`: `IComponent`; \}\>
|
|
40
30
|
|
|
41
|
-
|
|
31
|
+
The instance created and the factory for it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Function: initialiseRestRouteProcessorComponent()
|
|
2
2
|
|
|
3
|
-
> **initialiseRestRouteProcessorComponent**(`engineCore`, `context`, `instanceConfig
|
|
3
|
+
> **initialiseRestRouteProcessorComponent**(`engineCore`, `context`, `instanceConfig`): `Promise`\<\{ `instanceType?`: `string`; `factory?`: `Factory`\<`IRestRouteProcessor`\>; `component?`: `IComponent`; \}\>
|
|
4
4
|
|
|
5
5
|
Initialise the rest route processor.
|
|
6
6
|
|
|
@@ -24,18 +24,8 @@ The context for the engine.
|
|
|
24
24
|
|
|
25
25
|
The instance config.
|
|
26
26
|
|
|
27
|
-
### overrideInstanceType?
|
|
28
|
-
|
|
29
|
-
`string`
|
|
30
|
-
|
|
31
|
-
The instance type to override the default.
|
|
32
|
-
|
|
33
27
|
## Returns
|
|
34
28
|
|
|
35
|
-
`Promise`\<`
|
|
36
|
-
|
|
37
|
-
The name of the instance created.
|
|
38
|
-
|
|
39
|
-
## Throws
|
|
29
|
+
`Promise`\<\{ `instanceType?`: `string`; `factory?`: `Factory`\<`IRestRouteProcessor`\>; `component?`: `IComponent`; \}\>
|
|
40
30
|
|
|
41
|
-
|
|
31
|
+
The instance created and the factory for it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Function: initialiseSocketRouteProcessorComponent()
|
|
2
2
|
|
|
3
|
-
> **initialiseSocketRouteProcessorComponent**(`engineCore`, `context`, `instanceConfig
|
|
3
|
+
> **initialiseSocketRouteProcessorComponent**(`engineCore`, `context`, `instanceConfig`): `Promise`\<\{ `instanceType?`: `string`; `factory?`: `Factory`\<`ISocketRouteProcessor`\>; `component?`: `IComponent`; \}\>
|
|
4
4
|
|
|
5
5
|
Initialise the socket route processor.
|
|
6
6
|
|
|
@@ -24,18 +24,8 @@ The context for the engine.
|
|
|
24
24
|
|
|
25
25
|
The instance config.
|
|
26
26
|
|
|
27
|
-
### overrideInstanceType?
|
|
28
|
-
|
|
29
|
-
`string`
|
|
30
|
-
|
|
31
|
-
The instance type to override the default.
|
|
32
|
-
|
|
33
27
|
## Returns
|
|
34
28
|
|
|
35
|
-
`Promise`\<`
|
|
36
|
-
|
|
37
|
-
The name of the instance created.
|
|
38
|
-
|
|
39
|
-
## Throws
|
|
29
|
+
`Promise`\<\{ `instanceType?`: `string`; `factory?`: `Factory`\<`ISocketRouteProcessor`\>; `component?`: `IComponent`; \}\>
|
|
40
30
|
|
|
41
|
-
|
|
31
|
+
The instance created and the factory for it.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/engine-server-types",
|
|
3
|
-
"version": "0.0.2-next.
|
|
3
|
+
"version": "0.0.2-next.19",
|
|
4
4
|
"description": "Server types to use in an engine server.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"@twin.org/api-server-fastify": "next",
|
|
24
24
|
"@twin.org/api-service": "next",
|
|
25
25
|
"@twin.org/core": "next",
|
|
26
|
-
"@twin.org/engine-models": "0.0.2-next.
|
|
27
|
-
"@twin.org/engine-types": "0.0.2-next.
|
|
26
|
+
"@twin.org/engine-models": "0.0.2-next.19",
|
|
27
|
+
"@twin.org/engine-types": "0.0.2-next.19",
|
|
28
28
|
"@twin.org/entity": "next",
|
|
29
29
|
"@twin.org/identity-authentication": "next",
|
|
30
30
|
"@twin.org/nameof": "next"
|
|
@@ -46,5 +46,13 @@
|
|
|
46
46
|
"dist/types",
|
|
47
47
|
"locales",
|
|
48
48
|
"docs"
|
|
49
|
+
],
|
|
50
|
+
"keywords": [
|
|
51
|
+
"twin",
|
|
52
|
+
"trade",
|
|
53
|
+
"iota",
|
|
54
|
+
"framework",
|
|
55
|
+
"blockchain",
|
|
56
|
+
"engine"
|
|
49
57
|
]
|
|
50
58
|
}
|