@twin.org/engine-models 0.0.2-next.2 → 0.0.2-next.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/IEngineCore.d.ts +44 -6
- package/dist/types/models/IEngineCoreClone.d.ts +0 -6
- package/dist/types/models/IEngineCoreContext.d.ts +7 -3
- package/dist/types/models/IEngineServer.d.ts +2 -5
- package/dist/types/models/IEngineState.d.ts +0 -8
- package/dist/types/models/config/IEngineCoreTypeConfig.d.ts +27 -4
- package/dist/types/models/config/IEngineModuleConfig.d.ts +30 -0
- package/dist/types/models/engineTypeInitialiser.d.ts +19 -1
- package/docs/changelog.md +127 -0
- package/docs/reference/index.md +2 -0
- package/docs/reference/interfaces/EngineTypeInitialiserReturn.md +27 -0
- package/docs/reference/interfaces/IEngineCore.md +129 -11
- package/docs/reference/interfaces/IEngineCoreClone.md +0 -12
- package/docs/reference/interfaces/IEngineCoreContext.md +5 -4
- package/docs/reference/interfaces/IEngineModuleConfig.md +59 -0
- package/docs/reference/interfaces/IEngineServer.md +2 -14
- package/docs/reference/interfaces/IEngineState.md +0 -12
- package/docs/reference/type-aliases/EngineTypeInitialiser.md +2 -6
- package/docs/reference/type-aliases/IEngineCoreTypeConfig.md +36 -2
- package/package.json +12 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./factories/engineServerFactory";
|
|
|
3
3
|
export * from "./models/config/IEngineCoreConfig";
|
|
4
4
|
export * from "./models/config/IEngineCoreTypeBaseConfig";
|
|
5
5
|
export * from "./models/config/IEngineCoreTypeConfig";
|
|
6
|
+
export * from "./models/config/IEngineModuleConfig";
|
|
6
7
|
export * from "./models/engineTypeInitialiser";
|
|
7
8
|
export * from "./models/IEngineCore";
|
|
8
9
|
export * from "./models/IEngineCoreClone";
|
|
@@ -10,11 +10,16 @@ export interface IEngineCore<C extends IEngineCoreConfig = IEngineCoreConfig, S
|
|
|
10
10
|
/**
|
|
11
11
|
* Add a type initialiser.
|
|
12
12
|
* @param type The type to add the initialiser for.
|
|
13
|
-
* @param typeConfig The type config.
|
|
14
13
|
* @param module The name of the module which contains the initialiser method.
|
|
15
14
|
* @param method The name of the method to call.
|
|
16
15
|
*/
|
|
17
|
-
addTypeInitialiser(type: string,
|
|
16
|
+
addTypeInitialiser(type: string, module: string, method: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* Get the type config for a specific type.
|
|
19
|
+
* @param type The type to get the config for.
|
|
20
|
+
* @returns The type config or undefined if not found.
|
|
21
|
+
*/
|
|
22
|
+
getTypeConfig(type: string): IEngineCoreTypeConfig[] | undefined;
|
|
18
23
|
/**
|
|
19
24
|
* Start the engine core.
|
|
20
25
|
* @returns True if the start was successful.
|
|
@@ -25,6 +30,21 @@ export interface IEngineCore<C extends IEngineCoreConfig = IEngineCoreConfig, S
|
|
|
25
30
|
* @returns Nothing.
|
|
26
31
|
*/
|
|
27
32
|
stop(): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Is the engine started.
|
|
35
|
+
* @returns True if the engine is started.
|
|
36
|
+
*/
|
|
37
|
+
isStarted(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Is this the primary engine instance.
|
|
40
|
+
* @returns True if the engine is the primary instance.
|
|
41
|
+
*/
|
|
42
|
+
isPrimary(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Is this engine instance a clone.
|
|
45
|
+
* @returns True if the engine instance is a clone.
|
|
46
|
+
*/
|
|
47
|
+
isClone(): boolean;
|
|
28
48
|
/**
|
|
29
49
|
* Log info.
|
|
30
50
|
* @param message The message to log.
|
|
@@ -46,12 +66,30 @@ export interface IEngineCore<C extends IEngineCoreConfig = IEngineCoreConfig, S
|
|
|
46
66
|
*/
|
|
47
67
|
getState(): S;
|
|
48
68
|
/**
|
|
49
|
-
* Get the
|
|
50
|
-
* @returns The
|
|
69
|
+
* Get all the registered instances.
|
|
70
|
+
* @returns The registered instances.
|
|
51
71
|
*/
|
|
52
|
-
|
|
53
|
-
[
|
|
72
|
+
getRegisteredInstances(): {
|
|
73
|
+
[name: string]: {
|
|
74
|
+
type: string;
|
|
75
|
+
features?: string[];
|
|
76
|
+
}[];
|
|
54
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* Get the registered instance type for the component/connector.
|
|
80
|
+
* @param componentConnectorType The type of the component/connector.
|
|
81
|
+
* @param features The requested features of the component, if not specified the default entry will be retrieved.
|
|
82
|
+
* @returns The instance type matching the criteria if one is registered.
|
|
83
|
+
* @throws If a matching instance was not found.
|
|
84
|
+
*/
|
|
85
|
+
getRegisteredInstanceType(componentConnectorType: string, features?: string[]): string;
|
|
86
|
+
/**
|
|
87
|
+
* Get the registered instance type for the component/connector.
|
|
88
|
+
* @param componentConnectorType The type of the component/connector.
|
|
89
|
+
* @param features The requested features of the component, if not specified the default entry will be retrieved.
|
|
90
|
+
* @returns The instance type matching the criteria if one is registered.
|
|
91
|
+
*/
|
|
92
|
+
getRegisteredInstanceTypeOptional(componentConnectorType: string, features?: string[]): string | undefined;
|
|
55
93
|
/**
|
|
56
94
|
* Get the data required to create a clone of the engine.
|
|
57
95
|
* @returns The clone data.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { IEntitySchema } from "@twin.org/entity";
|
|
2
2
|
import type { IEngineCoreConfig } from "./config/IEngineCoreConfig";
|
|
3
|
-
import type { IEngineCoreTypeConfig } from "./config/IEngineCoreTypeConfig";
|
|
4
3
|
import type { IEngineState } from "./IEngineState";
|
|
5
4
|
/**
|
|
6
5
|
* Interface describing the data required to clone an engine.
|
|
@@ -19,7 +18,6 @@ export interface IEngineCoreClone<C extends IEngineCoreConfig = IEngineCoreConfi
|
|
|
19
18
|
*/
|
|
20
19
|
typeInitialisers: {
|
|
21
20
|
type: string;
|
|
22
|
-
typeConfig: IEngineCoreTypeConfig[];
|
|
23
21
|
module: string;
|
|
24
22
|
method: string;
|
|
25
23
|
}[];
|
|
@@ -29,8 +27,4 @@ export interface IEngineCoreClone<C extends IEngineCoreConfig = IEngineCoreConfi
|
|
|
29
27
|
entitySchemas: {
|
|
30
28
|
[schema: string]: IEntitySchema;
|
|
31
29
|
};
|
|
32
|
-
/**
|
|
33
|
-
* The logger type name.
|
|
34
|
-
*/
|
|
35
|
-
loggerTypeName: string;
|
|
36
30
|
}
|
|
@@ -18,10 +18,14 @@ export interface IEngineCoreContext<C extends IEngineCoreConfig = IEngineCoreCon
|
|
|
18
18
|
*/
|
|
19
19
|
stateDirty: boolean;
|
|
20
20
|
/**
|
|
21
|
-
* The
|
|
21
|
+
* The registered instances to use when components don't have custom types.
|
|
22
|
+
* The default entry will be the first in the list.
|
|
22
23
|
*/
|
|
23
|
-
|
|
24
|
-
[
|
|
24
|
+
registeredInstances: {
|
|
25
|
+
[name: string]: {
|
|
26
|
+
type: string;
|
|
27
|
+
features?: string[];
|
|
28
|
+
}[];
|
|
25
29
|
};
|
|
26
30
|
/**
|
|
27
31
|
* The components.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { IEngineCoreTypeConfig } from "./config/IEngineCoreTypeConfig";
|
|
2
1
|
/**
|
|
3
2
|
* Interface describing the engine server methods.
|
|
4
3
|
*/
|
|
@@ -6,19 +5,17 @@ export interface IEngineServer {
|
|
|
6
5
|
/**
|
|
7
6
|
* Add a REST route generator.
|
|
8
7
|
* @param type The type to add the generator for.
|
|
9
|
-
* @param typeConfig The type config.
|
|
10
8
|
* @param module The module containing the generator.
|
|
11
9
|
* @param method The method to call on the module.
|
|
12
10
|
*/
|
|
13
|
-
addRestRouteGenerator(type: string,
|
|
11
|
+
addRestRouteGenerator(type: string, module: string, method: string): void;
|
|
14
12
|
/**
|
|
15
13
|
* Add a socket route generator.
|
|
16
14
|
* @param type The type to add the generator for.
|
|
17
|
-
* @param typeConfig The type config.
|
|
18
15
|
* @param module The module containing the generator.
|
|
19
16
|
* @param method The method to call on the module.
|
|
20
17
|
*/
|
|
21
|
-
addSocketRouteGenerator(type: string,
|
|
18
|
+
addSocketRouteGenerator(type: string, module: string, method: string): void;
|
|
22
19
|
/**
|
|
23
20
|
* Start the engine server.
|
|
24
21
|
* @returns True if the start was successful.
|
|
@@ -2,10 +2,33 @@ import type { IEngineCoreTypeBaseConfig } from "./IEngineCoreTypeBaseConfig";
|
|
|
2
2
|
/**
|
|
3
3
|
* Configuration for the engine core type.
|
|
4
4
|
*/
|
|
5
|
-
export type IEngineCoreTypeConfig<T extends IEngineCoreTypeBaseConfig = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export type IEngineCoreTypeConfig<T extends IEngineCoreTypeBaseConfig = IEngineCoreTypeBaseConfig> = T & {
|
|
6
|
+
/**
|
|
7
|
+
* The instance type to override with.
|
|
8
|
+
*/
|
|
9
9
|
overrideInstanceType?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Whether this is the default instance.
|
|
12
|
+
*/
|
|
10
13
|
isDefault?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The features supported by this instance.
|
|
16
|
+
*/
|
|
17
|
+
features?: string[];
|
|
18
|
+
/**
|
|
19
|
+
* The path for the REST API.
|
|
20
|
+
*/
|
|
21
|
+
restPath?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The options for the REST API route generation.
|
|
24
|
+
*/
|
|
25
|
+
restOptions?: unknown;
|
|
26
|
+
/**
|
|
27
|
+
* The path for the socket API.
|
|
28
|
+
*/
|
|
29
|
+
socketPath?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The options for the socket API route generation.
|
|
32
|
+
*/
|
|
33
|
+
socketOptions?: unknown;
|
|
11
34
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for an engine module.
|
|
3
|
+
*/
|
|
4
|
+
export interface IEngineModuleConfig {
|
|
5
|
+
/**
|
|
6
|
+
* The unique identifier for the module.
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* The module that implements the additional component.
|
|
11
|
+
*/
|
|
12
|
+
moduleName: string;
|
|
13
|
+
/**
|
|
14
|
+
* The class name of the additional component.
|
|
15
|
+
*/
|
|
16
|
+
className: string;
|
|
17
|
+
/**
|
|
18
|
+
* Additional dependencies required by the component.
|
|
19
|
+
*/
|
|
20
|
+
dependencies?: {
|
|
21
|
+
propertyName: string;
|
|
22
|
+
componentName: string;
|
|
23
|
+
features?: string[];
|
|
24
|
+
isOptional?: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
/**
|
|
27
|
+
* Additional configuration for the component.
|
|
28
|
+
*/
|
|
29
|
+
config?: unknown;
|
|
30
|
+
}
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
+
import type { Factory, IComponent } from "@twin.org/core";
|
|
1
2
|
import type { IEngineCoreTypeBaseConfig } from "./config/IEngineCoreTypeBaseConfig";
|
|
2
3
|
import type { IEngineCore } from "./IEngineCore";
|
|
3
4
|
import type { IEngineCoreContext } from "./IEngineCoreContext";
|
|
4
5
|
/**
|
|
5
6
|
* Method definition for the engine type initialiser.
|
|
6
7
|
*/
|
|
7
|
-
export type EngineTypeInitialiser<T extends IEngineCoreTypeBaseConfig = IEngineCoreTypeBaseConfig> = (engineCore: IEngineCore, context: IEngineCoreContext, instanceConfig: T
|
|
8
|
+
export type EngineTypeInitialiser<T extends IEngineCoreTypeBaseConfig = IEngineCoreTypeBaseConfig> = (engineCore: IEngineCore, context: IEngineCoreContext, instanceConfig: T) => Promise<EngineTypeInitialiserReturn>;
|
|
9
|
+
/**
|
|
10
|
+
* Engine type initialiser return type.
|
|
11
|
+
*/
|
|
12
|
+
export interface EngineTypeInitialiserReturn {
|
|
13
|
+
/**
|
|
14
|
+
* The instance type created.
|
|
15
|
+
*/
|
|
16
|
+
instanceType?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The factory to store the instance in.
|
|
19
|
+
*/
|
|
20
|
+
factory?: Factory<unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* The component created.
|
|
23
|
+
*/
|
|
24
|
+
component?: IComponent;
|
|
25
|
+
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,132 @@
|
|
|
1
1
|
# @twin.org/engine-models - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.2-next.20](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.19...engine-models-v0.0.2-next.20) (2025-10-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* standardised engine logging naming ([0dbf857](https://github.com/twinfoundation/engine/commit/0dbf857587641f86ddf010143519d0e8333489ff))
|
|
9
|
+
|
|
10
|
+
## [0.0.2-next.19](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.18...engine-models-v0.0.2-next.19) (2025-10-02)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* simplify config building ([732c871](https://github.com/twinfoundation/engine/commit/732c871c5aca236759168f4bc15aeffd98a330a8))
|
|
16
|
+
|
|
17
|
+
## [0.0.2-next.18](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.17...engine-models-v0.0.2-next.18) (2025-09-29)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* upgrade framework components ([efd52e8](https://github.com/twinfoundation/engine/commit/efd52e80564fff29c3897bfa09b6305b3a322812))
|
|
23
|
+
|
|
24
|
+
## [0.0.2-next.17](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.16...engine-models-v0.0.2-next.17) (2025-09-26)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* add engine type helper for config lookups ([a20a398](https://github.com/twinfoundation/engine/commit/a20a3987016c48351178ab8410bc05b0fba0f2c1))
|
|
30
|
+
* add REST options for route construction ([4adf0af](https://github.com/twinfoundation/engine/commit/4adf0af8a03689a4dbdf67e8527d6db0d2c5d59d))
|
|
31
|
+
|
|
32
|
+
## [0.0.2-next.16](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.15...engine-models-v0.0.2-next.16) (2025-09-25)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
* add engine type helper for config lookups ([7d5eeef](https://github.com/twinfoundation/engine/commit/7d5eeefd3e7b9daab1ba20e2fb6b1ebfec178aec))
|
|
38
|
+
|
|
39
|
+
## [0.0.2-next.15](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.14...engine-models-v0.0.2-next.15) (2025-09-24)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Miscellaneous Chores
|
|
43
|
+
|
|
44
|
+
* **engine-models:** Synchronize repo versions
|
|
45
|
+
|
|
46
|
+
## [0.0.2-next.14](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.13...engine-models-v0.0.2-next.14) (2025-09-19)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Miscellaneous Chores
|
|
50
|
+
|
|
51
|
+
* **engine-models:** Synchronize repo versions
|
|
52
|
+
|
|
53
|
+
## [0.0.2-next.13](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.12...engine-models-v0.0.2-next.13) (2025-09-08)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Miscellaneous Chores
|
|
57
|
+
|
|
58
|
+
* **engine-models:** Synchronize repo versions
|
|
59
|
+
|
|
60
|
+
## [0.0.2-next.12](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.11...engine-models-v0.0.2-next.12) (2025-09-05)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Features
|
|
64
|
+
|
|
65
|
+
* add rights management negotiation ([84ef46b](https://github.com/twinfoundation/engine/commit/84ef46bff110611a19512793425c8c873ee2a590))
|
|
66
|
+
|
|
67
|
+
## [0.0.2-next.11](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.10...engine-models-v0.0.2-next.11) (2025-08-29)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Features
|
|
71
|
+
|
|
72
|
+
* eslint migration to flat config ([6b978da](https://github.com/twinfoundation/engine/commit/6b978daf777a615d7758b63c3df57d5a376f6dfb))
|
|
73
|
+
|
|
74
|
+
## [0.0.2-next.10](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.9...engine-models-v0.0.2-next.10) (2025-08-26)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### Miscellaneous Chores
|
|
78
|
+
|
|
79
|
+
* **engine-models:** Synchronize repo versions
|
|
80
|
+
|
|
81
|
+
## [0.0.2-next.9](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.8...engine-models-v0.0.2-next.9) (2025-08-25)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
### Features
|
|
85
|
+
|
|
86
|
+
* add isPrimary and isClone methods ([a7c63e9](https://github.com/twinfoundation/engine/commit/a7c63e97f54c95b104cc81e66d3fa42c6607bdc1))
|
|
87
|
+
|
|
88
|
+
## [0.0.2-next.8](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.7...engine-models-v0.0.2-next.8) (2025-08-22)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### Miscellaneous Chores
|
|
92
|
+
|
|
93
|
+
* **engine-models:** Synchronize repo versions
|
|
94
|
+
|
|
95
|
+
## [0.0.2-next.7](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.6...engine-models-v0.0.2-next.7) (2025-08-22)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
### Features
|
|
99
|
+
|
|
100
|
+
* remove unused component states ([d56d648](https://github.com/twinfoundation/engine/commit/d56d6486119ea8b8501a33f9e3a3101a08b826ed))
|
|
101
|
+
|
|
102
|
+
## [0.0.2-next.6](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.5...engine-models-v0.0.2-next.6) (2025-08-21)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
### Features
|
|
106
|
+
|
|
107
|
+
* update framework core ([acc0f8d](https://github.com/twinfoundation/engine/commit/acc0f8d455a4b8ec47f1da643139fa0f07775fa6))
|
|
108
|
+
|
|
109
|
+
## [0.0.2-next.5](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.4...engine-models-v0.0.2-next.5) (2025-08-14)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
### Features
|
|
113
|
+
|
|
114
|
+
* add synchronised storage support ([5142e34](https://github.com/twinfoundation/engine/commit/5142e3488f09195cf9f48a9c6c6d1014231a4c2c))
|
|
115
|
+
|
|
116
|
+
## [0.0.2-next.4](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.3...engine-models-v0.0.2-next.4) (2025-07-25)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
### Miscellaneous Chores
|
|
120
|
+
|
|
121
|
+
* **engine-models:** Synchronize repo versions
|
|
122
|
+
|
|
123
|
+
## [0.0.2-next.3](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.2...engine-models-v0.0.2-next.3) (2025-07-24)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
### Miscellaneous Chores
|
|
127
|
+
|
|
128
|
+
* **engine-models:** Synchronize repo versions
|
|
129
|
+
|
|
3
130
|
## [0.0.2-next.2](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.1...engine-models-v0.0.2-next.2) (2025-07-21)
|
|
4
131
|
|
|
5
132
|
|
package/docs/reference/index.md
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
- [IEngineStateStorage](interfaces/IEngineStateStorage.md)
|
|
11
11
|
- [IEngineCoreConfig](interfaces/IEngineCoreConfig.md)
|
|
12
12
|
- [IEngineCoreTypeBaseConfig](interfaces/IEngineCoreTypeBaseConfig.md)
|
|
13
|
+
- [IEngineModuleConfig](interfaces/IEngineModuleConfig.md)
|
|
14
|
+
- [EngineTypeInitialiserReturn](interfaces/EngineTypeInitialiserReturn.md)
|
|
13
15
|
|
|
14
16
|
## Type Aliases
|
|
15
17
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Interface: EngineTypeInitialiserReturn
|
|
2
|
+
|
|
3
|
+
Engine type initialiser return type.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### instanceType?
|
|
8
|
+
|
|
9
|
+
> `optional` **instanceType**: `string`
|
|
10
|
+
|
|
11
|
+
The instance type created.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### factory?
|
|
16
|
+
|
|
17
|
+
> `optional` **factory**: `Factory`\<`unknown`\>
|
|
18
|
+
|
|
19
|
+
The factory to store the instance in.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### component?
|
|
24
|
+
|
|
25
|
+
> `optional` **component**: `IComponent`
|
|
26
|
+
|
|
27
|
+
The component created.
|
|
@@ -16,7 +16,7 @@ Interface describing the engine core methods.
|
|
|
16
16
|
|
|
17
17
|
### addTypeInitialiser()
|
|
18
18
|
|
|
19
|
-
> **addTypeInitialiser**(`type`, `
|
|
19
|
+
> **addTypeInitialiser**(`type`, `module`, `method`): `void`
|
|
20
20
|
|
|
21
21
|
Add a type initialiser.
|
|
22
22
|
|
|
@@ -28,12 +28,6 @@ Add a type initialiser.
|
|
|
28
28
|
|
|
29
29
|
The type to add the initialiser for.
|
|
30
30
|
|
|
31
|
-
##### typeConfig
|
|
32
|
-
|
|
33
|
-
The type config.
|
|
34
|
-
|
|
35
|
-
`undefined` | [`IEngineCoreTypeConfig`](../type-aliases/IEngineCoreTypeConfig.md)[]
|
|
36
|
-
|
|
37
31
|
##### module
|
|
38
32
|
|
|
39
33
|
`string`
|
|
@@ -52,6 +46,28 @@ The name of the method to call.
|
|
|
52
46
|
|
|
53
47
|
***
|
|
54
48
|
|
|
49
|
+
### getTypeConfig()
|
|
50
|
+
|
|
51
|
+
> **getTypeConfig**(`type`): `undefined` \| [`IEngineCoreTypeConfig`](../type-aliases/IEngineCoreTypeConfig.md)[]
|
|
52
|
+
|
|
53
|
+
Get the type config for a specific type.
|
|
54
|
+
|
|
55
|
+
#### Parameters
|
|
56
|
+
|
|
57
|
+
##### type
|
|
58
|
+
|
|
59
|
+
`string`
|
|
60
|
+
|
|
61
|
+
The type to get the config for.
|
|
62
|
+
|
|
63
|
+
#### Returns
|
|
64
|
+
|
|
65
|
+
`undefined` \| [`IEngineCoreTypeConfig`](../type-aliases/IEngineCoreTypeConfig.md)[]
|
|
66
|
+
|
|
67
|
+
The type config or undefined if not found.
|
|
68
|
+
|
|
69
|
+
***
|
|
70
|
+
|
|
55
71
|
### start()
|
|
56
72
|
|
|
57
73
|
> **start**(): `Promise`\<`boolean`\>
|
|
@@ -80,6 +96,48 @@ Nothing.
|
|
|
80
96
|
|
|
81
97
|
***
|
|
82
98
|
|
|
99
|
+
### isStarted()
|
|
100
|
+
|
|
101
|
+
> **isStarted**(): `boolean`
|
|
102
|
+
|
|
103
|
+
Is the engine started.
|
|
104
|
+
|
|
105
|
+
#### Returns
|
|
106
|
+
|
|
107
|
+
`boolean`
|
|
108
|
+
|
|
109
|
+
True if the engine is started.
|
|
110
|
+
|
|
111
|
+
***
|
|
112
|
+
|
|
113
|
+
### isPrimary()
|
|
114
|
+
|
|
115
|
+
> **isPrimary**(): `boolean`
|
|
116
|
+
|
|
117
|
+
Is this the primary engine instance.
|
|
118
|
+
|
|
119
|
+
#### Returns
|
|
120
|
+
|
|
121
|
+
`boolean`
|
|
122
|
+
|
|
123
|
+
True if the engine is the primary instance.
|
|
124
|
+
|
|
125
|
+
***
|
|
126
|
+
|
|
127
|
+
### isClone()
|
|
128
|
+
|
|
129
|
+
> **isClone**(): `boolean`
|
|
130
|
+
|
|
131
|
+
Is this engine instance a clone.
|
|
132
|
+
|
|
133
|
+
#### Returns
|
|
134
|
+
|
|
135
|
+
`boolean`
|
|
136
|
+
|
|
137
|
+
True if the engine instance is a clone.
|
|
138
|
+
|
|
139
|
+
***
|
|
140
|
+
|
|
83
141
|
### logInfo()
|
|
84
142
|
|
|
85
143
|
> **logInfo**(`message`): `void`
|
|
@@ -148,17 +206,77 @@ The state of the engine.
|
|
|
148
206
|
|
|
149
207
|
***
|
|
150
208
|
|
|
151
|
-
###
|
|
209
|
+
### getRegisteredInstances()
|
|
152
210
|
|
|
153
|
-
> **
|
|
211
|
+
> **getRegisteredInstances**(): `object`
|
|
154
212
|
|
|
155
|
-
Get the
|
|
213
|
+
Get all the registered instances.
|
|
156
214
|
|
|
157
215
|
#### Returns
|
|
158
216
|
|
|
159
217
|
`object`
|
|
160
218
|
|
|
161
|
-
The
|
|
219
|
+
The registered instances.
|
|
220
|
+
|
|
221
|
+
***
|
|
222
|
+
|
|
223
|
+
### getRegisteredInstanceType()
|
|
224
|
+
|
|
225
|
+
> **getRegisteredInstanceType**(`componentConnectorType`, `features?`): `string`
|
|
226
|
+
|
|
227
|
+
Get the registered instance type for the component/connector.
|
|
228
|
+
|
|
229
|
+
#### Parameters
|
|
230
|
+
|
|
231
|
+
##### componentConnectorType
|
|
232
|
+
|
|
233
|
+
`string`
|
|
234
|
+
|
|
235
|
+
The type of the component/connector.
|
|
236
|
+
|
|
237
|
+
##### features?
|
|
238
|
+
|
|
239
|
+
`string`[]
|
|
240
|
+
|
|
241
|
+
The requested features of the component, if not specified the default entry will be retrieved.
|
|
242
|
+
|
|
243
|
+
#### Returns
|
|
244
|
+
|
|
245
|
+
`string`
|
|
246
|
+
|
|
247
|
+
The instance type matching the criteria if one is registered.
|
|
248
|
+
|
|
249
|
+
#### Throws
|
|
250
|
+
|
|
251
|
+
If a matching instance was not found.
|
|
252
|
+
|
|
253
|
+
***
|
|
254
|
+
|
|
255
|
+
### getRegisteredInstanceTypeOptional()
|
|
256
|
+
|
|
257
|
+
> **getRegisteredInstanceTypeOptional**(`componentConnectorType`, `features?`): `undefined` \| `string`
|
|
258
|
+
|
|
259
|
+
Get the registered instance type for the component/connector.
|
|
260
|
+
|
|
261
|
+
#### Parameters
|
|
262
|
+
|
|
263
|
+
##### componentConnectorType
|
|
264
|
+
|
|
265
|
+
`string`
|
|
266
|
+
|
|
267
|
+
The type of the component/connector.
|
|
268
|
+
|
|
269
|
+
##### features?
|
|
270
|
+
|
|
271
|
+
`string`[]
|
|
272
|
+
|
|
273
|
+
The requested features of the component, if not specified the default entry will be retrieved.
|
|
274
|
+
|
|
275
|
+
#### Returns
|
|
276
|
+
|
|
277
|
+
`undefined` \| `string`
|
|
278
|
+
|
|
279
|
+
The instance type matching the criteria if one is registered.
|
|
162
280
|
|
|
163
281
|
***
|
|
164
282
|
|
|
@@ -40,10 +40,6 @@ The type initialisers for the engine.
|
|
|
40
40
|
|
|
41
41
|
> **type**: `string`
|
|
42
42
|
|
|
43
|
-
#### typeConfig
|
|
44
|
-
|
|
45
|
-
> **typeConfig**: [`IEngineCoreTypeConfig`](../type-aliases/IEngineCoreTypeConfig.md)[]
|
|
46
|
-
|
|
47
43
|
#### module
|
|
48
44
|
|
|
49
45
|
> **module**: `string`
|
|
@@ -63,11 +59,3 @@ The entity schemas for the engine.
|
|
|
63
59
|
#### Index Signature
|
|
64
60
|
|
|
65
61
|
\[`schema`: `string`\]: `IEntitySchema`\<`unknown`\>
|
|
66
|
-
|
|
67
|
-
***
|
|
68
|
-
|
|
69
|
-
### loggerTypeName
|
|
70
|
-
|
|
71
|
-
> **loggerTypeName**: `string`
|
|
72
|
-
|
|
73
|
-
The logger type name.
|
|
@@ -38,15 +38,16 @@ The state dirty flag, which flags that the state needs saving.
|
|
|
38
38
|
|
|
39
39
|
***
|
|
40
40
|
|
|
41
|
-
###
|
|
41
|
+
### registeredInstances
|
|
42
42
|
|
|
43
|
-
> **
|
|
43
|
+
> **registeredInstances**: `object`
|
|
44
44
|
|
|
45
|
-
The
|
|
45
|
+
The registered instances to use when components don't have custom types.
|
|
46
|
+
The default entry will be the first in the list.
|
|
46
47
|
|
|
47
48
|
#### Index Signature
|
|
48
49
|
|
|
49
|
-
\[`
|
|
50
|
+
\[`name`: `string`\]: `object`[]
|
|
50
51
|
|
|
51
52
|
***
|
|
52
53
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Interface: IEngineModuleConfig
|
|
2
|
+
|
|
3
|
+
Configuration for an engine module.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### id
|
|
8
|
+
|
|
9
|
+
> **id**: `string`
|
|
10
|
+
|
|
11
|
+
The unique identifier for the module.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### moduleName
|
|
16
|
+
|
|
17
|
+
> **moduleName**: `string`
|
|
18
|
+
|
|
19
|
+
The module that implements the additional component.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### className
|
|
24
|
+
|
|
25
|
+
> **className**: `string`
|
|
26
|
+
|
|
27
|
+
The class name of the additional component.
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### dependencies?
|
|
32
|
+
|
|
33
|
+
> `optional` **dependencies**: `object`[]
|
|
34
|
+
|
|
35
|
+
Additional dependencies required by the component.
|
|
36
|
+
|
|
37
|
+
#### propertyName
|
|
38
|
+
|
|
39
|
+
> **propertyName**: `string`
|
|
40
|
+
|
|
41
|
+
#### componentName
|
|
42
|
+
|
|
43
|
+
> **componentName**: `string`
|
|
44
|
+
|
|
45
|
+
#### features?
|
|
46
|
+
|
|
47
|
+
> `optional` **features**: `string`[]
|
|
48
|
+
|
|
49
|
+
#### isOptional?
|
|
50
|
+
|
|
51
|
+
> `optional` **isOptional**: `boolean`
|
|
52
|
+
|
|
53
|
+
***
|
|
54
|
+
|
|
55
|
+
### config?
|
|
56
|
+
|
|
57
|
+
> `optional` **config**: `unknown`
|
|
58
|
+
|
|
59
|
+
Additional configuration for the component.
|
|
@@ -6,7 +6,7 @@ Interface describing the engine server methods.
|
|
|
6
6
|
|
|
7
7
|
### addRestRouteGenerator()
|
|
8
8
|
|
|
9
|
-
> **addRestRouteGenerator**(`type`, `
|
|
9
|
+
> **addRestRouteGenerator**(`type`, `module`, `method`): `void`
|
|
10
10
|
|
|
11
11
|
Add a REST route generator.
|
|
12
12
|
|
|
@@ -18,12 +18,6 @@ Add a REST route generator.
|
|
|
18
18
|
|
|
19
19
|
The type to add the generator for.
|
|
20
20
|
|
|
21
|
-
##### typeConfig
|
|
22
|
-
|
|
23
|
-
The type config.
|
|
24
|
-
|
|
25
|
-
`undefined` | [`IEngineCoreTypeConfig`](../type-aliases/IEngineCoreTypeConfig.md)[]
|
|
26
|
-
|
|
27
21
|
##### module
|
|
28
22
|
|
|
29
23
|
`string`
|
|
@@ -44,7 +38,7 @@ The method to call on the module.
|
|
|
44
38
|
|
|
45
39
|
### addSocketRouteGenerator()
|
|
46
40
|
|
|
47
|
-
> **addSocketRouteGenerator**(`type`, `
|
|
41
|
+
> **addSocketRouteGenerator**(`type`, `module`, `method`): `void`
|
|
48
42
|
|
|
49
43
|
Add a socket route generator.
|
|
50
44
|
|
|
@@ -56,12 +50,6 @@ Add a socket route generator.
|
|
|
56
50
|
|
|
57
51
|
The type to add the generator for.
|
|
58
52
|
|
|
59
|
-
##### typeConfig
|
|
60
|
-
|
|
61
|
-
The type config.
|
|
62
|
-
|
|
63
|
-
`undefined` | [`IEngineCoreTypeConfig`](../type-aliases/IEngineCoreTypeConfig.md)[]
|
|
64
|
-
|
|
65
53
|
##### module
|
|
66
54
|
|
|
67
55
|
`string`
|
|
@@ -9,15 +9,3 @@ The state of the engine.
|
|
|
9
9
|
> `optional` **nodeIdentity**: `string`
|
|
10
10
|
|
|
11
11
|
The identity for the node.
|
|
12
|
-
|
|
13
|
-
***
|
|
14
|
-
|
|
15
|
-
### componentStates
|
|
16
|
-
|
|
17
|
-
> **componentStates**: `object`
|
|
18
|
-
|
|
19
|
-
The component states.
|
|
20
|
-
|
|
21
|
-
#### Index Signature
|
|
22
|
-
|
|
23
|
-
\[`component`: `string`\]: `object`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Type Alias: EngineTypeInitialiser()\<T\>
|
|
2
2
|
|
|
3
|
-
> **EngineTypeInitialiser**\<`T`\> = (`engineCore`, `context`, `instanceConfig
|
|
3
|
+
> **EngineTypeInitialiser**\<`T`\> = (`engineCore`, `context`, `instanceConfig`) => `Promise`\<[`EngineTypeInitialiserReturn`](../interfaces/EngineTypeInitialiserReturn.md)\>
|
|
4
4
|
|
|
5
5
|
Method definition for the engine type initialiser.
|
|
6
6
|
|
|
@@ -24,10 +24,6 @@ Method definition for the engine type initialiser.
|
|
|
24
24
|
|
|
25
25
|
`T`
|
|
26
26
|
|
|
27
|
-
### overrideInstanceType?
|
|
28
|
-
|
|
29
|
-
`string`
|
|
30
|
-
|
|
31
27
|
## Returns
|
|
32
28
|
|
|
33
|
-
`
|
|
29
|
+
`Promise`\<[`EngineTypeInitialiserReturn`](../interfaces/EngineTypeInitialiserReturn.md)\>
|
|
@@ -4,18 +4,52 @@
|
|
|
4
4
|
|
|
5
5
|
Configuration for the engine core type.
|
|
6
6
|
|
|
7
|
-
## Type
|
|
7
|
+
## Type Declaration
|
|
8
8
|
|
|
9
9
|
### overrideInstanceType?
|
|
10
10
|
|
|
11
11
|
> `optional` **overrideInstanceType**: `string`
|
|
12
12
|
|
|
13
|
+
The instance type to override with.
|
|
14
|
+
|
|
13
15
|
### isDefault?
|
|
14
16
|
|
|
15
17
|
> `optional` **isDefault**: `boolean`
|
|
16
18
|
|
|
19
|
+
Whether this is the default instance.
|
|
20
|
+
|
|
21
|
+
### features?
|
|
22
|
+
|
|
23
|
+
> `optional` **features**: `string`[]
|
|
24
|
+
|
|
25
|
+
The features supported by this instance.
|
|
26
|
+
|
|
27
|
+
### restPath?
|
|
28
|
+
|
|
29
|
+
> `optional` **restPath**: `string`
|
|
30
|
+
|
|
31
|
+
The path for the REST API.
|
|
32
|
+
|
|
33
|
+
### restOptions?
|
|
34
|
+
|
|
35
|
+
> `optional` **restOptions**: `unknown`
|
|
36
|
+
|
|
37
|
+
The options for the REST API route generation.
|
|
38
|
+
|
|
39
|
+
### socketPath?
|
|
40
|
+
|
|
41
|
+
> `optional` **socketPath**: `string`
|
|
42
|
+
|
|
43
|
+
The path for the socket API.
|
|
44
|
+
|
|
45
|
+
### socketOptions?
|
|
46
|
+
|
|
47
|
+
> `optional` **socketOptions**: `unknown`
|
|
48
|
+
|
|
49
|
+
The options for the socket API route generation.
|
|
50
|
+
|
|
17
51
|
## Type Parameters
|
|
18
52
|
|
|
19
53
|
### T
|
|
20
54
|
|
|
21
|
-
`T` *extends* [`IEngineCoreTypeBaseConfig`](../interfaces/IEngineCoreTypeBaseConfig.md) =
|
|
55
|
+
`T` *extends* [`IEngineCoreTypeBaseConfig`](../interfaces/IEngineCoreTypeBaseConfig.md) = [`IEngineCoreTypeBaseConfig`](../interfaces/IEngineCoreTypeBaseConfig.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/engine-models",
|
|
3
|
-
"version": "0.0.2-next.
|
|
3
|
+
"version": "0.0.2-next.20",
|
|
4
4
|
"description": "Models which define the structure of the engine.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,5 +34,16 @@
|
|
|
34
34
|
"dist/types",
|
|
35
35
|
"locales",
|
|
36
36
|
"docs"
|
|
37
|
+
],
|
|
38
|
+
"keywords": [
|
|
39
|
+
"twin",
|
|
40
|
+
"trade",
|
|
41
|
+
"iota",
|
|
42
|
+
"framework",
|
|
43
|
+
"blockchain",
|
|
44
|
+
"engine",
|
|
45
|
+
"models",
|
|
46
|
+
"types",
|
|
47
|
+
"schemas"
|
|
37
48
|
]
|
|
38
49
|
}
|