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

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.
@@ -41,6 +41,7 @@ function initialiseAuthenticationComponent(engineCore, context, instanceConfig,
41
41
  engineTypes.initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.userEntityStorageType, "AuthenticationUser");
42
42
  component = new apiAuthEntityStorageService.EntityStorageAuthenticationService({
43
43
  vaultConnectorType: context.defaultTypes.vaultConnector,
44
+ authenticationAdminServiceType: context.defaultTypes.authenticationAdminComponent,
44
45
  ...instanceConfig.options
45
46
  });
46
47
  instanceType = apiAuthEntityStorageService.EntityStorageAuthenticationService.NAMESPACE;
@@ -60,6 +61,58 @@ function initialiseAuthenticationComponent(engineCore, context, instanceConfig,
60
61
  return finalInstanceType;
61
62
  }
62
63
 
64
+ // Copyright 2024 IOTA Stiftung.
65
+ // SPDX-License-Identifier: Apache-2.0.
66
+ /**
67
+ * Authentication admin component types.
68
+ */
69
+ // eslint-disable-next-line @typescript-eslint/naming-convention
70
+ const AuthenticationAdminComponentType = {
71
+ /**
72
+ * Entity storage.
73
+ */
74
+ EntityStorage: "entity-storage"
75
+ };
76
+
77
+ /**
78
+ * Initialise the authentication admin.
79
+ * @param engineCore The engine core.
80
+ * @param context The context for the engine.
81
+ * @param instanceConfig The instance config.
82
+ * @param overrideInstanceType The instance type to override the default.
83
+ * @returns The name of the instance created.
84
+ * @throws GeneralError if the component type is unknown.
85
+ */
86
+ function initialiseAuthenticationAdminComponent(engineCore, context, instanceConfig, overrideInstanceType) {
87
+ engineCore.logInfo(core.I18n.formatMessage("engineCore.configuring", {
88
+ element: `Authentication Admin Component: ${instanceConfig.type}`
89
+ }));
90
+ const type = instanceConfig.type;
91
+ let component;
92
+ let instanceType;
93
+ if (type === AuthenticationAdminComponentType.EntityStorage) {
94
+ apiAuthEntityStorageService.initSchema();
95
+ engineTypes.initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.userEntityStorageType, "AuthenticationUser");
96
+ component = new apiAuthEntityStorageService.EntityStorageAuthenticationAdminService({
97
+ ...instanceConfig.options
98
+ });
99
+ instanceType = apiAuthEntityStorageService.EntityStorageAuthenticationAdminService.NAMESPACE;
100
+ }
101
+ else {
102
+ throw new core.GeneralError("engineCore", "componentUnknownType", {
103
+ type,
104
+ componentType: "authenticationAdminComponent"
105
+ });
106
+ }
107
+ const finalInstanceType = overrideInstanceType ?? instanceType;
108
+ context.componentInstances.push({
109
+ instanceType: finalInstanceType,
110
+ component
111
+ });
112
+ core.ComponentFactory.register(finalInstanceType, () => component);
113
+ return finalInstanceType;
114
+ }
115
+
63
116
  // Copyright 2024 IOTA Stiftung.
64
117
  // SPDX-License-Identifier: Apache-2.0.
65
118
  /**
@@ -342,11 +395,13 @@ function initialiseSocketRouteProcessorComponent(engineCore, context, instanceCo
342
395
  return finalInstanceType;
343
396
  }
344
397
 
398
+ exports.AuthenticationAdminComponentType = AuthenticationAdminComponentType;
345
399
  exports.AuthenticationComponentType = AuthenticationComponentType;
346
400
  exports.InformationComponentType = InformationComponentType;
347
401
  exports.MimeTypeProcessorType = MimeTypeProcessorType;
348
402
  exports.RestRouteProcessorType = RestRouteProcessorType;
349
403
  exports.SocketRouteProcessorType = SocketRouteProcessorType;
404
+ exports.initialiseAuthenticationAdminComponent = initialiseAuthenticationAdminComponent;
350
405
  exports.initialiseAuthenticationComponent = initialiseAuthenticationComponent;
351
406
  exports.initialiseInformationComponent = initialiseInformationComponent;
352
407
  exports.initialiseMimeTypeProcessorComponent = initialiseMimeTypeProcessorComponent;
@@ -1,4 +1,4 @@
1
- import { initSchema, EntityStorageAuthenticationService, AuthHeaderProcessor } from '@twin.org/api-auth-entity-storage-service';
1
+ import { initSchema, EntityStorageAuthenticationService, EntityStorageAuthenticationAdminService, AuthHeaderProcessor } from '@twin.org/api-auth-entity-storage-service';
2
2
  import { I18n, GeneralError, ComponentFactory } from '@twin.org/core';
3
3
  import { initialiseEntityStorageConnector } from '@twin.org/engine-types';
4
4
  import { InformationService } from '@twin.org/api-service';
@@ -39,6 +39,7 @@ function initialiseAuthenticationComponent(engineCore, context, instanceConfig,
39
39
  initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.userEntityStorageType, "AuthenticationUser");
40
40
  component = new EntityStorageAuthenticationService({
41
41
  vaultConnectorType: context.defaultTypes.vaultConnector,
42
+ authenticationAdminServiceType: context.defaultTypes.authenticationAdminComponent,
42
43
  ...instanceConfig.options
43
44
  });
44
45
  instanceType = EntityStorageAuthenticationService.NAMESPACE;
@@ -58,6 +59,58 @@ function initialiseAuthenticationComponent(engineCore, context, instanceConfig,
58
59
  return finalInstanceType;
59
60
  }
60
61
 
62
+ // Copyright 2024 IOTA Stiftung.
63
+ // SPDX-License-Identifier: Apache-2.0.
64
+ /**
65
+ * Authentication admin component types.
66
+ */
67
+ // eslint-disable-next-line @typescript-eslint/naming-convention
68
+ const AuthenticationAdminComponentType = {
69
+ /**
70
+ * Entity storage.
71
+ */
72
+ EntityStorage: "entity-storage"
73
+ };
74
+
75
+ /**
76
+ * Initialise the authentication admin.
77
+ * @param engineCore The engine core.
78
+ * @param context The context for the engine.
79
+ * @param instanceConfig The instance config.
80
+ * @param overrideInstanceType The instance type to override the default.
81
+ * @returns The name of the instance created.
82
+ * @throws GeneralError if the component type is unknown.
83
+ */
84
+ function initialiseAuthenticationAdminComponent(engineCore, context, instanceConfig, overrideInstanceType) {
85
+ engineCore.logInfo(I18n.formatMessage("engineCore.configuring", {
86
+ element: `Authentication Admin Component: ${instanceConfig.type}`
87
+ }));
88
+ const type = instanceConfig.type;
89
+ let component;
90
+ let instanceType;
91
+ if (type === AuthenticationAdminComponentType.EntityStorage) {
92
+ initSchema();
93
+ initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.userEntityStorageType, "AuthenticationUser");
94
+ component = new EntityStorageAuthenticationAdminService({
95
+ ...instanceConfig.options
96
+ });
97
+ instanceType = EntityStorageAuthenticationAdminService.NAMESPACE;
98
+ }
99
+ else {
100
+ throw new GeneralError("engineCore", "componentUnknownType", {
101
+ type,
102
+ componentType: "authenticationAdminComponent"
103
+ });
104
+ }
105
+ const finalInstanceType = overrideInstanceType ?? instanceType;
106
+ context.componentInstances.push({
107
+ instanceType: finalInstanceType,
108
+ component
109
+ });
110
+ ComponentFactory.register(finalInstanceType, () => component);
111
+ return finalInstanceType;
112
+ }
113
+
61
114
  // Copyright 2024 IOTA Stiftung.
62
115
  // SPDX-License-Identifier: Apache-2.0.
63
116
  /**
@@ -340,4 +393,4 @@ function initialiseSocketRouteProcessorComponent(engineCore, context, instanceCo
340
393
  return finalInstanceType;
341
394
  }
342
395
 
343
- export { AuthenticationComponentType, InformationComponentType, MimeTypeProcessorType, RestRouteProcessorType, SocketRouteProcessorType, initialiseAuthenticationComponent, initialiseInformationComponent, initialiseMimeTypeProcessorComponent, initialiseRestRouteProcessorComponent, initialiseSocketRouteProcessorComponent };
396
+ export { AuthenticationAdminComponentType, AuthenticationComponentType, InformationComponentType, MimeTypeProcessorType, RestRouteProcessorType, SocketRouteProcessorType, initialiseAuthenticationAdminComponent, initialiseAuthenticationComponent, initialiseInformationComponent, initialiseMimeTypeProcessorComponent, initialiseRestRouteProcessorComponent, initialiseSocketRouteProcessorComponent };
@@ -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
+ };
@@ -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];
package/docs/changelog.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @twin.org/engine-server-types - Changelog
2
2
 
3
+ ## [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)
4
+
5
+
6
+ ### Features
7
+
8
+ * add auth admin component ([201cd06](https://github.com/twinfoundation/engine/commit/201cd061be83afccb5a6b06856ffe7cf8db7d6b3))
9
+ * add federated catalogue ([1b15dd0](https://github.com/twinfoundation/engine/commit/1b15dd059a11446457651c411a73145fab37f025))
10
+ * add mimeTypeProcessors and disableNodeIdentity ([bb7e81e](https://github.com/twinfoundation/engine/commit/bb7e81e2036fe042068a5645ec59b22e20d33aad))
11
+ * add task scheduler ([0951107](https://github.com/twinfoundation/engine/commit/09511073ad042194a45206303f0ef31d8d6af5db))
12
+ * modifying the engine to run the new services ([#10](https://github.com/twinfoundation/engine/issues/10)) ([6f7141f](https://github.com/twinfoundation/engine/commit/6f7141fe0a6d05c725066b274bcc18b5490e580b))
13
+ * switch to devDeps ([32832ac](https://github.com/twinfoundation/engine/commit/32832acd934e1e5569474281a527c9b118d30732))
14
+ * update dependencies ([97c9f64](https://github.com/twinfoundation/engine/commit/97c9f64b6ef096963bcc5de338a2a9e99bdc1a11))
15
+ * use shared store mechanism ([#2](https://github.com/twinfoundation/engine/issues/2)) ([9eed8d7](https://github.com/twinfoundation/engine/commit/9eed8d7766388479b42f03e2542fe761f2156408))
16
+
17
+
18
+ ### Dependencies
19
+
20
+ * The following workspace dependencies were updated
21
+ * dependencies
22
+ * @twin.org/engine-models bumped from 0.0.2-next.0 to 0.0.2-next.1
23
+ * @twin.org/engine-types bumped from 0.0.2-next.0 to 0.0.2-next.1
24
+
3
25
  ## 0.0.1 (2025-07-11)
4
26
 
5
27
 
@@ -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.
@@ -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.
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.1",
4
4
  "description": "Server types to use in an engine server.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,8 +21,8 @@
21
21
  "@twin.org/api-server-fastify": "next",
22
22
  "@twin.org/api-service": "next",
23
23
  "@twin.org/core": "next",
24
- "@twin.org/engine-models": "0.0.1",
25
- "@twin.org/engine-types": "0.0.1",
24
+ "@twin.org/engine-models": "0.0.2-next.1",
25
+ "@twin.org/engine-types": "0.0.2-next.1",
26
26
  "@twin.org/entity": "next",
27
27
  "@twin.org/nameof": "next"
28
28
  },