@twin.org/engine-server-types 0.0.1 → 0.0.2-next.2

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.
Files changed (24) hide show
  1. package/dist/cjs/index.cjs +88 -15
  2. package/dist/esm/index.mjs +89 -18
  3. package/dist/types/components/authentication.d.ts +1 -1
  4. package/dist/types/components/authenticationAdmin.d.ts +13 -0
  5. package/dist/types/index.d.ts +3 -0
  6. package/dist/types/models/IEngineServerConfig.d.ts +5 -0
  7. package/dist/types/models/config/authenticationAdminComponentConfig.d.ts +9 -0
  8. package/dist/types/models/config/authenticationComponentConfig.d.ts +4 -0
  9. package/dist/types/models/config/informationComponentConfig.d.ts +4 -0
  10. package/dist/types/models/types/authenticationAdminComponentType.d.ts +13 -0
  11. package/dist/types/models/types/authenticationComponentType.d.ts +4 -0
  12. package/dist/types/models/types/informationComponentType.d.ts +4 -0
  13. package/docs/changelog.md +37 -0
  14. package/docs/reference/functions/initialiseAuthenticationAdminComponent.md +41 -0
  15. package/docs/reference/index.md +4 -0
  16. package/docs/reference/interfaces/IEngineServerConfig.md +6 -0
  17. package/docs/reference/type-aliases/AuthenticationAdminComponentConfig.md +17 -0
  18. package/docs/reference/type-aliases/AuthenticationAdminComponentType.md +5 -0
  19. package/docs/reference/type-aliases/AuthenticationComponentConfig.md +1 -13
  20. package/docs/reference/type-aliases/InformationComponentConfig.md +1 -13
  21. package/docs/reference/variables/AuthenticationAdminComponentType.md +13 -0
  22. package/docs/reference/variables/AuthenticationComponentType.md +6 -0
  23. package/docs/reference/variables/InformationComponentType.md +6 -0
  24. package/package.json +5 -3
@@ -1,8 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ var apiAuthEntityStorageRestClient = require('@twin.org/api-auth-entity-storage-rest-client');
3
4
  var apiAuthEntityStorageService = require('@twin.org/api-auth-entity-storage-service');
4
5
  var core = require('@twin.org/core');
5
6
  var engineTypes = require('@twin.org/engine-types');
7
+ var apiRestClient = require('@twin.org/api-rest-client');
6
8
  var apiService = require('@twin.org/api-service');
7
9
  var apiModels = require('@twin.org/api-models');
8
10
  var apiProcessors = require('@twin.org/api-processors');
@@ -17,7 +19,11 @@ const AuthenticationComponentType = {
17
19
  /**
18
20
  * Entity storage.
19
21
  */
20
- EntityStorage: "entity-storage"
22
+ EntityStorage: "entity-storage",
23
+ /**
24
+ * REST client.
25
+ */
26
+ RestClient: "rest-client"
21
27
  };
22
28
 
23
29
  /**
@@ -41,9 +47,14 @@ function initialiseAuthenticationComponent(engineCore, context, instanceConfig,
41
47
  engineTypes.initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.userEntityStorageType, "AuthenticationUser");
42
48
  component = new apiAuthEntityStorageService.EntityStorageAuthenticationService({
43
49
  vaultConnectorType: context.defaultTypes.vaultConnector,
50
+ authenticationAdminServiceType: context.defaultTypes.authenticationAdminComponent,
44
51
  ...instanceConfig.options
45
52
  });
46
- instanceType = apiAuthEntityStorageService.EntityStorageAuthenticationService.NAMESPACE;
53
+ instanceType = core.StringHelper.kebabCase("EntityStorageAuthenticationService");
54
+ }
55
+ else if (type === AuthenticationComponentType.RestClient) {
56
+ component = new apiAuthEntityStorageRestClient.EntityStorageAuthenticationClient(instanceConfig.options);
57
+ instanceType = core.StringHelper.kebabCase("EntityStorageAuthenticationClient");
47
58
  }
48
59
  else {
49
60
  throw new core.GeneralError("engineCore", "componentUnknownType", {
@@ -60,6 +71,58 @@ function initialiseAuthenticationComponent(engineCore, context, instanceConfig,
60
71
  return finalInstanceType;
61
72
  }
62
73
 
74
+ // Copyright 2024 IOTA Stiftung.
75
+ // SPDX-License-Identifier: Apache-2.0.
76
+ /**
77
+ * Authentication admin component types.
78
+ */
79
+ // eslint-disable-next-line @typescript-eslint/naming-convention
80
+ const AuthenticationAdminComponentType = {
81
+ /**
82
+ * Entity storage.
83
+ */
84
+ EntityStorage: "entity-storage"
85
+ };
86
+
87
+ /**
88
+ * Initialise the authentication admin.
89
+ * @param engineCore The engine core.
90
+ * @param context The context for the engine.
91
+ * @param instanceConfig The instance config.
92
+ * @param overrideInstanceType The instance type to override the default.
93
+ * @returns The name of the instance created.
94
+ * @throws GeneralError if the component type is unknown.
95
+ */
96
+ function initialiseAuthenticationAdminComponent(engineCore, context, instanceConfig, overrideInstanceType) {
97
+ engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
98
+ element: `Authentication Admin Component: ${instanceConfig.type}`
99
+ }));
100
+ const type = instanceConfig.type;
101
+ let component;
102
+ let instanceType;
103
+ if (type === AuthenticationAdminComponentType.EntityStorage) {
104
+ apiAuthEntityStorageService.initSchema();
105
+ engineTypes.initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.userEntityStorageType, "AuthenticationUser");
106
+ component = new apiAuthEntityStorageService.EntityStorageAuthenticationAdminService({
107
+ ...instanceConfig.options
108
+ });
109
+ instanceType = core.StringHelper.kebabCase("EntityStorageAuthenticationAdminService");
110
+ }
111
+ else {
112
+ throw new core.GeneralError("engineCore", "componentUnknownType", {
113
+ type,
114
+ componentType: "authenticationAdminComponent"
115
+ });
116
+ }
117
+ const finalInstanceType = overrideInstanceType ?? instanceType;
118
+ context.componentInstances.push({
119
+ instanceType: finalInstanceType,
120
+ component
121
+ });
122
+ core.ComponentFactory.register(finalInstanceType, () => component);
123
+ return finalInstanceType;
124
+ }
125
+
63
126
  // Copyright 2024 IOTA Stiftung.
64
127
  // SPDX-License-Identifier: Apache-2.0.
65
128
  /**
@@ -70,7 +133,11 @@ const InformationComponentType = {
70
133
  /**
71
134
  * Service.
72
135
  */
73
- Service: "service"
136
+ Service: "service",
137
+ /**
138
+ * REST client.
139
+ */
140
+ RestClient: "rest-client"
74
141
  };
75
142
 
76
143
  /**
@@ -91,7 +158,11 @@ function initialiseInformationComponent(engineCore, context, instanceConfig, ove
91
158
  let instanceType;
92
159
  if (type === InformationComponentType.Service) {
93
160
  component = new apiService.InformationService(instanceConfig.options);
94
- instanceType = apiService.InformationService.NAMESPACE;
161
+ instanceType = core.StringHelper.kebabCase("InformationService");
162
+ }
163
+ else if (type === InformationComponentType.RestClient) {
164
+ component = new apiRestClient.InformationClient(instanceConfig.options);
165
+ instanceType = core.StringHelper.kebabCase("InformationClient");
95
166
  }
96
167
  else {
97
168
  throw new core.GeneralError("engineCore", "componentUnknownType", {
@@ -141,7 +212,7 @@ function initialiseMimeTypeProcessorComponent(engineCore, context, instanceConfi
141
212
  let instanceType;
142
213
  if (type === MimeTypeProcessorType.Jwt) {
143
214
  component = new apiProcessors.JwtMimeTypeProcessor();
144
- instanceType = apiProcessors.JwtMimeTypeProcessor.NAMESPACE;
215
+ instanceType = core.StringHelper.kebabCase("JwtMimeTypeProcessor");
145
216
  }
146
217
  else {
147
218
  throw new core.GeneralError("engineCore", "componentUnknownType", {
@@ -212,7 +283,7 @@ function initialiseRestRouteProcessorComponent(engineCore, context, instanceConf
212
283
  ...instanceConfig.options?.config
213
284
  }
214
285
  });
215
- instanceType = apiAuthEntityStorageService.AuthHeaderProcessor.NAMESPACE;
286
+ instanceType = core.StringHelper.kebabCase("AuthHeaderProcessor");
216
287
  }
217
288
  else if (type === RestRouteProcessorType.Logging) {
218
289
  component = new apiProcessors.LoggingProcessor({
@@ -221,19 +292,19 @@ function initialiseRestRouteProcessorComponent(engineCore, context, instanceConf
221
292
  ...instanceConfig.options?.config
222
293
  }
223
294
  });
224
- instanceType = apiProcessors.LoggingProcessor.NAMESPACE;
295
+ instanceType = core.StringHelper.kebabCase("LoggingProcessor");
225
296
  }
226
297
  else if (type === RestRouteProcessorType.NodeIdentity) {
227
298
  component = new apiProcessors.NodeIdentityProcessor();
228
- instanceType = apiProcessors.NodeIdentityProcessor.NAMESPACE;
299
+ instanceType = core.StringHelper.kebabCase("NodeIdentityProcessor");
229
300
  }
230
301
  else if (type === RestRouteProcessorType.StaticUserIdentity) {
231
302
  component = new apiProcessors.StaticUserIdentityProcessor(instanceConfig.options);
232
- instanceType = apiProcessors.StaticUserIdentityProcessor.NAMESPACE;
303
+ instanceType = core.StringHelper.kebabCase("StaticUserIdentityProcessor");
233
304
  }
234
305
  else if (type === RestRouteProcessorType.RestRoute) {
235
306
  component = new apiProcessors.RestRouteProcessor(instanceConfig.options);
236
- instanceType = apiProcessors.RestRouteProcessor.NAMESPACE;
307
+ instanceType = core.StringHelper.kebabCase("RestRouteProcessor");
237
308
  }
238
309
  else {
239
310
  throw new core.GeneralError("engineCore", "componentUnknownType", {
@@ -304,7 +375,7 @@ function initialiseSocketRouteProcessorComponent(engineCore, context, instanceCo
304
375
  ...instanceConfig.options?.config
305
376
  }
306
377
  });
307
- instanceType = apiAuthEntityStorageService.AuthHeaderProcessor.NAMESPACE;
378
+ instanceType = core.StringHelper.kebabCase("AuthHeaderProcessor");
308
379
  }
309
380
  else if (type === SocketRouteProcessorType.Logging) {
310
381
  component = new apiProcessors.LoggingProcessor({
@@ -313,19 +384,19 @@ function initialiseSocketRouteProcessorComponent(engineCore, context, instanceCo
313
384
  ...instanceConfig.options?.config
314
385
  }
315
386
  });
316
- instanceType = apiProcessors.LoggingProcessor.NAMESPACE;
387
+ instanceType = core.StringHelper.kebabCase("LoggingProcessor");
317
388
  }
318
389
  else if (type === SocketRouteProcessorType.NodeIdentity) {
319
390
  component = new apiProcessors.NodeIdentityProcessor();
320
- instanceType = apiProcessors.NodeIdentityProcessor.NAMESPACE;
391
+ instanceType = core.StringHelper.kebabCase("NodeIdentityProcessor");
321
392
  }
322
393
  else if (type === SocketRouteProcessorType.StaticUserIdentity) {
323
394
  component = new apiProcessors.StaticUserIdentityProcessor(instanceConfig.options);
324
- instanceType = apiProcessors.StaticUserIdentityProcessor.NAMESPACE;
395
+ instanceType = core.StringHelper.kebabCase("StaticUserIdentityProcessor");
325
396
  }
326
397
  else if (type === SocketRouteProcessorType.SocketRoute) {
327
398
  component = new apiProcessors.SocketRouteProcessor(instanceConfig.options);
328
- instanceType = apiProcessors.SocketRouteProcessor.NAMESPACE;
399
+ instanceType = core.StringHelper.kebabCase("SocketRouteProcessor");
329
400
  }
330
401
  else {
331
402
  throw new core.GeneralError("engineCore", "componentUnknownType", {
@@ -342,11 +413,13 @@ function initialiseSocketRouteProcessorComponent(engineCore, context, instanceCo
342
413
  return finalInstanceType;
343
414
  }
344
415
 
416
+ exports.AuthenticationAdminComponentType = AuthenticationAdminComponentType;
345
417
  exports.AuthenticationComponentType = AuthenticationComponentType;
346
418
  exports.InformationComponentType = InformationComponentType;
347
419
  exports.MimeTypeProcessorType = MimeTypeProcessorType;
348
420
  exports.RestRouteProcessorType = RestRouteProcessorType;
349
421
  exports.SocketRouteProcessorType = SocketRouteProcessorType;
422
+ exports.initialiseAuthenticationAdminComponent = initialiseAuthenticationAdminComponent;
350
423
  exports.initialiseAuthenticationComponent = initialiseAuthenticationComponent;
351
424
  exports.initialiseInformationComponent = initialiseInformationComponent;
352
425
  exports.initialiseMimeTypeProcessorComponent = initialiseMimeTypeProcessorComponent;
@@ -1,6 +1,8 @@
1
- import { initSchema, EntityStorageAuthenticationService, AuthHeaderProcessor } from '@twin.org/api-auth-entity-storage-service';
2
- import { I18n, GeneralError, ComponentFactory } from '@twin.org/core';
1
+ import { EntityStorageAuthenticationClient } from '@twin.org/api-auth-entity-storage-rest-client';
2
+ import { initSchema, EntityStorageAuthenticationService, EntityStorageAuthenticationAdminService, AuthHeaderProcessor } from '@twin.org/api-auth-entity-storage-service';
3
+ import { I18n, StringHelper, GeneralError, ComponentFactory } from '@twin.org/core';
3
4
  import { initialiseEntityStorageConnector } from '@twin.org/engine-types';
5
+ import { InformationClient } from '@twin.org/api-rest-client';
4
6
  import { InformationService } from '@twin.org/api-service';
5
7
  import { MimeTypeProcessorFactory, RestRouteProcessorFactory, SocketRouteProcessorFactory } from '@twin.org/api-models';
6
8
  import { JwtMimeTypeProcessor, LoggingProcessor, NodeIdentityProcessor, StaticUserIdentityProcessor, RestRouteProcessor, SocketRouteProcessor } from '@twin.org/api-processors';
@@ -15,7 +17,11 @@ const AuthenticationComponentType = {
15
17
  /**
16
18
  * Entity storage.
17
19
  */
18
- EntityStorage: "entity-storage"
20
+ EntityStorage: "entity-storage",
21
+ /**
22
+ * REST client.
23
+ */
24
+ RestClient: "rest-client"
19
25
  };
20
26
 
21
27
  /**
@@ -39,9 +45,14 @@ function initialiseAuthenticationComponent(engineCore, context, instanceConfig,
39
45
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.userEntityStorageType, "AuthenticationUser");
40
46
  component = new EntityStorageAuthenticationService({
41
47
  vaultConnectorType: context.defaultTypes.vaultConnector,
48
+ authenticationAdminServiceType: context.defaultTypes.authenticationAdminComponent,
42
49
  ...instanceConfig.options
43
50
  });
44
- instanceType = EntityStorageAuthenticationService.NAMESPACE;
51
+ instanceType = StringHelper.kebabCase("EntityStorageAuthenticationService");
52
+ }
53
+ else if (type === AuthenticationComponentType.RestClient) {
54
+ component = new EntityStorageAuthenticationClient(instanceConfig.options);
55
+ instanceType = StringHelper.kebabCase("EntityStorageAuthenticationClient");
45
56
  }
46
57
  else {
47
58
  throw new GeneralError("engineCore", "componentUnknownType", {
@@ -58,6 +69,58 @@ function initialiseAuthenticationComponent(engineCore, context, instanceConfig,
58
69
  return finalInstanceType;
59
70
  }
60
71
 
72
+ // Copyright 2024 IOTA Stiftung.
73
+ // SPDX-License-Identifier: Apache-2.0.
74
+ /**
75
+ * Authentication admin component types.
76
+ */
77
+ // eslint-disable-next-line @typescript-eslint/naming-convention
78
+ const AuthenticationAdminComponentType = {
79
+ /**
80
+ * Entity storage.
81
+ */
82
+ EntityStorage: "entity-storage"
83
+ };
84
+
85
+ /**
86
+ * Initialise the authentication admin.
87
+ * @param engineCore The engine core.
88
+ * @param context The context for the engine.
89
+ * @param instanceConfig The instance config.
90
+ * @param overrideInstanceType The instance type to override the default.
91
+ * @returns The name of the instance created.
92
+ * @throws GeneralError if the component type is unknown.
93
+ */
94
+ function initialiseAuthenticationAdminComponent(engineCore, context, instanceConfig, overrideInstanceType) {
95
+ engineCore.logInfo(I18n.formatMessage("engineCore.configuring", {
96
+ element: `Authentication Admin Component: ${instanceConfig.type}`
97
+ }));
98
+ const type = instanceConfig.type;
99
+ let component;
100
+ let instanceType;
101
+ if (type === AuthenticationAdminComponentType.EntityStorage) {
102
+ initSchema();
103
+ initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.userEntityStorageType, "AuthenticationUser");
104
+ component = new EntityStorageAuthenticationAdminService({
105
+ ...instanceConfig.options
106
+ });
107
+ instanceType = StringHelper.kebabCase("EntityStorageAuthenticationAdminService");
108
+ }
109
+ else {
110
+ throw new GeneralError("engineCore", "componentUnknownType", {
111
+ type,
112
+ componentType: "authenticationAdminComponent"
113
+ });
114
+ }
115
+ const finalInstanceType = overrideInstanceType ?? instanceType;
116
+ context.componentInstances.push({
117
+ instanceType: finalInstanceType,
118
+ component
119
+ });
120
+ ComponentFactory.register(finalInstanceType, () => component);
121
+ return finalInstanceType;
122
+ }
123
+
61
124
  // Copyright 2024 IOTA Stiftung.
62
125
  // SPDX-License-Identifier: Apache-2.0.
63
126
  /**
@@ -68,7 +131,11 @@ const InformationComponentType = {
68
131
  /**
69
132
  * Service.
70
133
  */
71
- Service: "service"
134
+ Service: "service",
135
+ /**
136
+ * REST client.
137
+ */
138
+ RestClient: "rest-client"
72
139
  };
73
140
 
74
141
  /**
@@ -89,7 +156,11 @@ function initialiseInformationComponent(engineCore, context, instanceConfig, ove
89
156
  let instanceType;
90
157
  if (type === InformationComponentType.Service) {
91
158
  component = new InformationService(instanceConfig.options);
92
- instanceType = InformationService.NAMESPACE;
159
+ instanceType = StringHelper.kebabCase("InformationService");
160
+ }
161
+ else if (type === InformationComponentType.RestClient) {
162
+ component = new InformationClient(instanceConfig.options);
163
+ instanceType = StringHelper.kebabCase("InformationClient");
93
164
  }
94
165
  else {
95
166
  throw new GeneralError("engineCore", "componentUnknownType", {
@@ -139,7 +210,7 @@ function initialiseMimeTypeProcessorComponent(engineCore, context, instanceConfi
139
210
  let instanceType;
140
211
  if (type === MimeTypeProcessorType.Jwt) {
141
212
  component = new JwtMimeTypeProcessor();
142
- instanceType = JwtMimeTypeProcessor.NAMESPACE;
213
+ instanceType = StringHelper.kebabCase("JwtMimeTypeProcessor");
143
214
  }
144
215
  else {
145
216
  throw new GeneralError("engineCore", "componentUnknownType", {
@@ -210,7 +281,7 @@ function initialiseRestRouteProcessorComponent(engineCore, context, instanceConf
210
281
  ...instanceConfig.options?.config
211
282
  }
212
283
  });
213
- instanceType = AuthHeaderProcessor.NAMESPACE;
284
+ instanceType = StringHelper.kebabCase("AuthHeaderProcessor");
214
285
  }
215
286
  else if (type === RestRouteProcessorType.Logging) {
216
287
  component = new LoggingProcessor({
@@ -219,19 +290,19 @@ function initialiseRestRouteProcessorComponent(engineCore, context, instanceConf
219
290
  ...instanceConfig.options?.config
220
291
  }
221
292
  });
222
- instanceType = LoggingProcessor.NAMESPACE;
293
+ instanceType = StringHelper.kebabCase("LoggingProcessor");
223
294
  }
224
295
  else if (type === RestRouteProcessorType.NodeIdentity) {
225
296
  component = new NodeIdentityProcessor();
226
- instanceType = NodeIdentityProcessor.NAMESPACE;
297
+ instanceType = StringHelper.kebabCase("NodeIdentityProcessor");
227
298
  }
228
299
  else if (type === RestRouteProcessorType.StaticUserIdentity) {
229
300
  component = new StaticUserIdentityProcessor(instanceConfig.options);
230
- instanceType = StaticUserIdentityProcessor.NAMESPACE;
301
+ instanceType = StringHelper.kebabCase("StaticUserIdentityProcessor");
231
302
  }
232
303
  else if (type === RestRouteProcessorType.RestRoute) {
233
304
  component = new RestRouteProcessor(instanceConfig.options);
234
- instanceType = RestRouteProcessor.NAMESPACE;
305
+ instanceType = StringHelper.kebabCase("RestRouteProcessor");
235
306
  }
236
307
  else {
237
308
  throw new GeneralError("engineCore", "componentUnknownType", {
@@ -302,7 +373,7 @@ function initialiseSocketRouteProcessorComponent(engineCore, context, instanceCo
302
373
  ...instanceConfig.options?.config
303
374
  }
304
375
  });
305
- instanceType = AuthHeaderProcessor.NAMESPACE;
376
+ instanceType = StringHelper.kebabCase("AuthHeaderProcessor");
306
377
  }
307
378
  else if (type === SocketRouteProcessorType.Logging) {
308
379
  component = new LoggingProcessor({
@@ -311,19 +382,19 @@ function initialiseSocketRouteProcessorComponent(engineCore, context, instanceCo
311
382
  ...instanceConfig.options?.config
312
383
  }
313
384
  });
314
- instanceType = LoggingProcessor.NAMESPACE;
385
+ instanceType = StringHelper.kebabCase("LoggingProcessor");
315
386
  }
316
387
  else if (type === SocketRouteProcessorType.NodeIdentity) {
317
388
  component = new NodeIdentityProcessor();
318
- instanceType = NodeIdentityProcessor.NAMESPACE;
389
+ instanceType = StringHelper.kebabCase("NodeIdentityProcessor");
319
390
  }
320
391
  else if (type === SocketRouteProcessorType.StaticUserIdentity) {
321
392
  component = new StaticUserIdentityProcessor(instanceConfig.options);
322
- instanceType = StaticUserIdentityProcessor.NAMESPACE;
393
+ instanceType = StringHelper.kebabCase("StaticUserIdentityProcessor");
323
394
  }
324
395
  else if (type === SocketRouteProcessorType.SocketRoute) {
325
396
  component = new SocketRouteProcessor(instanceConfig.options);
326
- instanceType = SocketRouteProcessor.NAMESPACE;
397
+ instanceType = StringHelper.kebabCase("SocketRouteProcessor");
327
398
  }
328
399
  else {
329
400
  throw new GeneralError("engineCore", "componentUnknownType", {
@@ -340,4 +411,4 @@ function initialiseSocketRouteProcessorComponent(engineCore, context, instanceCo
340
411
  return finalInstanceType;
341
412
  }
342
413
 
343
- export { AuthenticationComponentType, InformationComponentType, MimeTypeProcessorType, RestRouteProcessorType, SocketRouteProcessorType, initialiseAuthenticationComponent, initialiseInformationComponent, initialiseMimeTypeProcessorComponent, initialiseRestRouteProcessorComponent, initialiseSocketRouteProcessorComponent };
414
+ export { AuthenticationAdminComponentType, AuthenticationComponentType, InformationComponentType, MimeTypeProcessorType, RestRouteProcessorType, SocketRouteProcessorType, initialiseAuthenticationAdminComponent, initialiseAuthenticationComponent, initialiseInformationComponent, initialiseMimeTypeProcessorComponent, initialiseRestRouteProcessorComponent, initialiseSocketRouteProcessorComponent };
@@ -1,4 +1,4 @@
1
- import type { IEngineCoreContext, IEngineCore } from "@twin.org/engine-models";
1
+ import type { IEngineCore, IEngineCoreContext } from "@twin.org/engine-models";
2
2
  import type { AuthenticationComponentConfig } from "../models/config/authenticationComponentConfig";
3
3
  import type { IEngineServerConfig } from "../models/IEngineServerConfig";
4
4
  /**
@@ -0,0 +1,13 @@
1
+ import type { IEngineCore, IEngineCoreContext } from "@twin.org/engine-models";
2
+ import type { AuthenticationAdminComponentConfig } from "../models/config/authenticationAdminComponentConfig";
3
+ import type { IEngineServerConfig } from "../models/IEngineServerConfig";
4
+ /**
5
+ * Initialise the authentication admin.
6
+ * @param engineCore The engine core.
7
+ * @param context The context for the engine.
8
+ * @param instanceConfig The instance config.
9
+ * @param overrideInstanceType The instance type to override the default.
10
+ * @returns The name of the instance created.
11
+ * @throws GeneralError if the component type is unknown.
12
+ */
13
+ export declare function initialiseAuthenticationAdminComponent(engineCore: IEngineCore<IEngineServerConfig>, context: IEngineCoreContext<IEngineServerConfig>, instanceConfig: AuthenticationAdminComponentConfig, overrideInstanceType?: string): string | undefined;
@@ -1,14 +1,17 @@
1
1
  export * from "./components/authentication";
2
+ export * from "./components/authenticationAdmin";
2
3
  export * from "./components/information";
3
4
  export * from "./components/mimeTypeProcessor";
4
5
  export * from "./components/restRouteProcessor";
5
6
  export * from "./components/socketRouteProcessor";
7
+ export * from "./models/config/authenticationAdminComponentConfig";
6
8
  export * from "./models/config/authenticationComponentConfig";
7
9
  export * from "./models/config/informationComponentConfig";
8
10
  export * from "./models/config/mimeTypeProcessorConfig";
9
11
  export * from "./models/config/restRouteProcessorConfig";
10
12
  export * from "./models/config/socketRouteProcessorConfig";
11
13
  export * from "./models/IEngineServerConfig";
14
+ export * from "./models/types/authenticationAdminComponentType";
12
15
  export * from "./models/types/authenticationComponentType";
13
16
  export * from "./models/types/informationComponentType";
14
17
  export * from "./models/types/mimeTypeProcessorType";
@@ -1,6 +1,7 @@
1
1
  import type { IWebServerOptions } from "@twin.org/api-models";
2
2
  import type { IEngineCoreTypeConfig } from "@twin.org/engine-models";
3
3
  import type { IEngineConfig } from "@twin.org/engine-types";
4
+ import type { AuthenticationAdminComponentConfig } from "./config/authenticationAdminComponentConfig";
4
5
  import type { AuthenticationComponentConfig } from "./config/authenticationComponentConfig";
5
6
  import type { InformationComponentConfig } from "./config/informationComponentConfig";
6
7
  import type { MimeTypeProcessorConfig } from "./config/mimeTypeProcessorConfig";
@@ -39,5 +40,9 @@ export interface IEngineServerConfig extends IEngineConfig {
39
40
  * Authentication component options which can be overridden by individual components by specifying types other than default..
40
41
  */
41
42
  authenticationComponent?: IEngineCoreTypeConfig<AuthenticationComponentConfig>[];
43
+ /**
44
+ * Authentication admin component options which can be overridden by individual components by specifying types other than default..
45
+ */
46
+ authenticationAdminComponent?: IEngineCoreTypeConfig<AuthenticationAdminComponentConfig>[];
42
47
  };
43
48
  }
@@ -0,0 +1,9 @@
1
+ import type { IEntityStorageAuthenticationAdminServiceConstructorOptions } from "@twin.org/api-auth-entity-storage-service";
2
+ import type { AuthenticationAdminComponentType } from "../types/authenticationAdminComponentType";
3
+ /**
4
+ * Authentication admin component config types.
5
+ */
6
+ export type AuthenticationAdminComponentConfig = {
7
+ type: typeof AuthenticationAdminComponentType.EntityStorage;
8
+ options?: IEntityStorageAuthenticationAdminServiceConstructorOptions;
9
+ };
@@ -1,4 +1,5 @@
1
1
  import type { IEntityStorageAuthenticationServiceConstructorOptions } from "@twin.org/api-auth-entity-storage-service";
2
+ import type { IBaseRestClientConfig } from "@twin.org/api-models";
2
3
  import type { AuthenticationComponentType } from "../types/authenticationComponentType";
3
4
  /**
4
5
  * Authentication component config types.
@@ -6,4 +7,7 @@ import type { AuthenticationComponentType } from "../types/authenticationCompone
6
7
  export type AuthenticationComponentConfig = {
7
8
  type: typeof AuthenticationComponentType.EntityStorage;
8
9
  options?: IEntityStorageAuthenticationServiceConstructorOptions;
10
+ } | {
11
+ type: typeof AuthenticationComponentType.RestClient;
12
+ options: IBaseRestClientConfig;
9
13
  };
@@ -1,3 +1,4 @@
1
+ import type { IBaseRestClientConfig } from "@twin.org/api-models";
1
2
  import type { IInformationServiceConstructorOptions } from "@twin.org/api-service";
2
3
  import type { InformationComponentType } from "../types/informationComponentType";
3
4
  /**
@@ -6,4 +7,7 @@ import type { InformationComponentType } from "../types/informationComponentType
6
7
  export type InformationComponentConfig = {
7
8
  type: typeof InformationComponentType.Service;
8
9
  options: IInformationServiceConstructorOptions;
10
+ } | {
11
+ type: typeof InformationComponentType.RestClient;
12
+ options: IBaseRestClientConfig;
9
13
  };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Authentication admin component types.
3
+ */
4
+ export declare const AuthenticationAdminComponentType: {
5
+ /**
6
+ * Entity storage.
7
+ */
8
+ readonly EntityStorage: "entity-storage";
9
+ };
10
+ /**
11
+ * Authentication admin component types.
12
+ */
13
+ export type AuthenticationAdminComponentType = (typeof AuthenticationAdminComponentType)[keyof typeof AuthenticationAdminComponentType];
@@ -6,6 +6,10 @@ export declare const AuthenticationComponentType: {
6
6
  * Entity storage.
7
7
  */
8
8
  readonly EntityStorage: "entity-storage";
9
+ /**
10
+ * REST client.
11
+ */
12
+ readonly RestClient: "rest-client";
9
13
  };
10
14
  /**
11
15
  * Authentication component types.
@@ -6,6 +6,10 @@ export declare const InformationComponentType: {
6
6
  * Service.
7
7
  */
8
8
  readonly Service: "service";
9
+ /**
10
+ * REST client.
11
+ */
12
+ readonly RestClient: "rest-client";
9
13
  };
10
14
  /**
11
15
  * Information component types.
package/docs/changelog.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @twin.org/engine-server-types - Changelog
2
2
 
3
+ ## [0.0.2-next.2](https://github.com/twinfoundation/engine/compare/engine-server-types-v0.0.2-next.1...engine-server-types-v0.0.2-next.2) (2025-07-21)
4
+
5
+
6
+ ### Features
7
+
8
+ * add rest clients as components ([c6f956a](https://github.com/twinfoundation/engine/commit/c6f956afe4fc22cd552174539c92a109448dc242))
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.1 to 0.0.2-next.2
16
+ * @twin.org/engine-types bumped from 0.0.2-next.1 to 0.0.2-next.2
17
+
18
+ ## [0.0.2-next.1](https://github.com/twinfoundation/engine/compare/engine-server-types-v0.0.2-next.0...engine-server-types-v0.0.2-next.1) (2025-07-11)
19
+
20
+
21
+ ### Features
22
+
23
+ * add auth admin component ([201cd06](https://github.com/twinfoundation/engine/commit/201cd061be83afccb5a6b06856ffe7cf8db7d6b3))
24
+ * add federated catalogue ([1b15dd0](https://github.com/twinfoundation/engine/commit/1b15dd059a11446457651c411a73145fab37f025))
25
+ * add mimeTypeProcessors and disableNodeIdentity ([bb7e81e](https://github.com/twinfoundation/engine/commit/bb7e81e2036fe042068a5645ec59b22e20d33aad))
26
+ * add task scheduler ([0951107](https://github.com/twinfoundation/engine/commit/09511073ad042194a45206303f0ef31d8d6af5db))
27
+ * modifying the engine to run the new services ([#10](https://github.com/twinfoundation/engine/issues/10)) ([6f7141f](https://github.com/twinfoundation/engine/commit/6f7141fe0a6d05c725066b274bcc18b5490e580b))
28
+ * switch to devDeps ([32832ac](https://github.com/twinfoundation/engine/commit/32832acd934e1e5569474281a527c9b118d30732))
29
+ * update dependencies ([97c9f64](https://github.com/twinfoundation/engine/commit/97c9f64b6ef096963bcc5de338a2a9e99bdc1a11))
30
+ * use shared store mechanism ([#2](https://github.com/twinfoundation/engine/issues/2)) ([9eed8d7](https://github.com/twinfoundation/engine/commit/9eed8d7766388479b42f03e2542fe761f2156408))
31
+
32
+
33
+ ### Dependencies
34
+
35
+ * The following workspace dependencies were updated
36
+ * dependencies
37
+ * @twin.org/engine-models bumped from 0.0.2-next.0 to 0.0.2-next.1
38
+ * @twin.org/engine-types bumped from 0.0.2-next.0 to 0.0.2-next.1
39
+
3
40
  ## 0.0.1 (2025-07-11)
4
41
 
5
42
 
@@ -0,0 +1,41 @@
1
+ # Function: initialiseAuthenticationAdminComponent()
2
+
3
+ > **initialiseAuthenticationAdminComponent**(`engineCore`, `context`, `instanceConfig`, `overrideInstanceType?`): `undefined` \| `string`
4
+
5
+ Initialise the authentication admin.
6
+
7
+ ## Parameters
8
+
9
+ ### engineCore
10
+
11
+ `IEngineCore`\<[`IEngineServerConfig`](../interfaces/IEngineServerConfig.md)\>
12
+
13
+ The engine core.
14
+
15
+ ### context
16
+
17
+ `IEngineCoreContext`\<[`IEngineServerConfig`](../interfaces/IEngineServerConfig.md)\>
18
+
19
+ The context for the engine.
20
+
21
+ ### instanceConfig
22
+
23
+ [`AuthenticationAdminComponentConfig`](../type-aliases/AuthenticationAdminComponentConfig.md)
24
+
25
+ The instance config.
26
+
27
+ ### overrideInstanceType?
28
+
29
+ `string`
30
+
31
+ The instance type to override the default.
32
+
33
+ ## Returns
34
+
35
+ `undefined` \| `string`
36
+
37
+ The name of the instance created.
38
+
39
+ ## Throws
40
+
41
+ GeneralError if the component type is unknown.
@@ -6,11 +6,13 @@
6
6
 
7
7
  ## Type Aliases
8
8
 
9
+ - [AuthenticationAdminComponentConfig](type-aliases/AuthenticationAdminComponentConfig.md)
9
10
  - [AuthenticationComponentConfig](type-aliases/AuthenticationComponentConfig.md)
10
11
  - [InformationComponentConfig](type-aliases/InformationComponentConfig.md)
11
12
  - [MimeTypeProcessorConfig](type-aliases/MimeTypeProcessorConfig.md)
12
13
  - [RestRouteProcessorConfig](type-aliases/RestRouteProcessorConfig.md)
13
14
  - [SocketRouteProcessorConfig](type-aliases/SocketRouteProcessorConfig.md)
15
+ - [AuthenticationAdminComponentType](type-aliases/AuthenticationAdminComponentType.md)
14
16
  - [AuthenticationComponentType](type-aliases/AuthenticationComponentType.md)
15
17
  - [InformationComponentType](type-aliases/InformationComponentType.md)
16
18
  - [MimeTypeProcessorType](type-aliases/MimeTypeProcessorType.md)
@@ -19,6 +21,7 @@
19
21
 
20
22
  ## Variables
21
23
 
24
+ - [AuthenticationAdminComponentType](variables/AuthenticationAdminComponentType.md)
22
25
  - [AuthenticationComponentType](variables/AuthenticationComponentType.md)
23
26
  - [InformationComponentType](variables/InformationComponentType.md)
24
27
  - [MimeTypeProcessorType](variables/MimeTypeProcessorType.md)
@@ -28,6 +31,7 @@
28
31
  ## Functions
29
32
 
30
33
  - [initialiseAuthenticationComponent](functions/initialiseAuthenticationComponent.md)
34
+ - [initialiseAuthenticationAdminComponent](functions/initialiseAuthenticationAdminComponent.md)
31
35
  - [initialiseInformationComponent](functions/initialiseInformationComponent.md)
32
36
  - [initialiseMimeTypeProcessorComponent](functions/initialiseMimeTypeProcessorComponent.md)
33
37
  - [initialiseRestRouteProcessorComponent](functions/initialiseRestRouteProcessorComponent.md)
@@ -54,6 +54,12 @@ Mime type processors options which can be overridden by individual components by
54
54
 
55
55
  Authentication component options which can be overridden by individual components by specifying types other than default..
56
56
 
57
+ ##### authenticationAdminComponent?
58
+
59
+ > `optional` **authenticationAdminComponent**: `IEngineCoreTypeConfig`\<[`AuthenticationAdminComponentConfig`](../type-aliases/AuthenticationAdminComponentConfig.md)\>[]
60
+
61
+ Authentication admin component options which can be overridden by individual components by specifying types other than default..
62
+
57
63
  #### Overrides
58
64
 
59
65
  `IEngineConfig.types`
@@ -0,0 +1,17 @@
1
+ # Type Alias: AuthenticationAdminComponentConfig
2
+
3
+ > **AuthenticationAdminComponentConfig** = `object`
4
+
5
+ Authentication admin component config types.
6
+
7
+ ## Properties
8
+
9
+ ### type
10
+
11
+ > **type**: *typeof* [`EntityStorage`](../variables/AuthenticationAdminComponentType.md#entitystorage)
12
+
13
+ ***
14
+
15
+ ### options?
16
+
17
+ > `optional` **options**: `IEntityStorageAuthenticationAdminServiceConstructorOptions`
@@ -0,0 +1,5 @@
1
+ # Type Alias: AuthenticationAdminComponentType
2
+
3
+ > **AuthenticationAdminComponentType** = *typeof* [`AuthenticationAdminComponentType`](../variables/AuthenticationAdminComponentType.md)\[keyof *typeof* [`AuthenticationAdminComponentType`](../variables/AuthenticationAdminComponentType.md)\]
4
+
5
+ Authentication admin component types.
@@ -1,17 +1,5 @@
1
1
  # Type Alias: AuthenticationComponentConfig
2
2
 
3
- > **AuthenticationComponentConfig** = `object`
3
+ > **AuthenticationComponentConfig** = \{ `type`: *typeof* [`EntityStorage`](../variables/AuthenticationComponentType.md#entitystorage); `options?`: `IEntityStorageAuthenticationServiceConstructorOptions`; \} \| \{ `type`: *typeof* [`RestClient`](../variables/AuthenticationComponentType.md#restclient); `options`: `IBaseRestClientConfig`; \}
4
4
 
5
5
  Authentication component config types.
6
-
7
- ## Properties
8
-
9
- ### type
10
-
11
- > **type**: *typeof* [`EntityStorage`](../variables/AuthenticationComponentType.md#entitystorage)
12
-
13
- ***
14
-
15
- ### options?
16
-
17
- > `optional` **options**: `IEntityStorageAuthenticationServiceConstructorOptions`
@@ -1,17 +1,5 @@
1
1
  # Type Alias: InformationComponentConfig
2
2
 
3
- > **InformationComponentConfig** = `object`
3
+ > **InformationComponentConfig** = \{ `type`: *typeof* [`Service`](../variables/InformationComponentType.md#service); `options`: `IInformationServiceConstructorOptions`; \} \| \{ `type`: *typeof* [`RestClient`](../variables/InformationComponentType.md#restclient); `options`: `IBaseRestClientConfig`; \}
4
4
 
5
5
  Information component config types.
6
-
7
- ## Properties
8
-
9
- ### type
10
-
11
- > **type**: *typeof* [`Service`](../variables/InformationComponentType.md#service)
12
-
13
- ***
14
-
15
- ### options
16
-
17
- > **options**: `IInformationServiceConstructorOptions`
@@ -0,0 +1,13 @@
1
+ # Variable: AuthenticationAdminComponentType
2
+
3
+ > `const` **AuthenticationAdminComponentType**: `object`
4
+
5
+ Authentication admin component types.
6
+
7
+ ## Type declaration
8
+
9
+ ### EntityStorage
10
+
11
+ > `readonly` **EntityStorage**: `"entity-storage"` = `"entity-storage"`
12
+
13
+ Entity storage.
@@ -11,3 +11,9 @@ Authentication component types.
11
11
  > `readonly` **EntityStorage**: `"entity-storage"` = `"entity-storage"`
12
12
 
13
13
  Entity storage.
14
+
15
+ ### RestClient
16
+
17
+ > `readonly` **RestClient**: `"rest-client"` = `"rest-client"`
18
+
19
+ REST client.
@@ -11,3 +11,9 @@ Information component types.
11
11
  > `readonly` **Service**: `"service"` = `"service"`
12
12
 
13
13
  Service.
14
+
15
+ ### RestClient
16
+
17
+ > `readonly` **RestClient**: `"rest-client"` = `"rest-client"`
18
+
19
+ REST client.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/engine-server-types",
3
- "version": "0.0.1",
3
+ "version": "0.0.2-next.2",
4
4
  "description": "Server types to use in an engine server.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,15 +14,17 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
+ "@twin.org/api-auth-entity-storage-rest-client": "next",
17
18
  "@twin.org/api-auth-entity-storage-service": "next",
18
19
  "@twin.org/api-core": "next",
19
20
  "@twin.org/api-models": "next",
20
21
  "@twin.org/api-processors": "next",
22
+ "@twin.org/api-rest-client": "next",
21
23
  "@twin.org/api-server-fastify": "next",
22
24
  "@twin.org/api-service": "next",
23
25
  "@twin.org/core": "next",
24
- "@twin.org/engine-models": "0.0.1",
25
- "@twin.org/engine-types": "0.0.1",
26
+ "@twin.org/engine-models": "0.0.2-next.2",
27
+ "@twin.org/engine-types": "0.0.2-next.2",
26
28
  "@twin.org/entity": "next",
27
29
  "@twin.org/nameof": "next"
28
30
  },