@twin.org/engine-models 0.0.3-next.3 → 0.0.3-next.31
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/README.md +1 -1
- package/dist/es/models/IEngineCore.js.map +1 -1
- package/dist/es/models/IEngineCoreClone.js.map +1 -1
- package/dist/es/models/IEngineServer.js.map +1 -1
- package/dist/es/models/config/IEngineCoreTypeConfig.js.map +1 -1
- package/dist/es/models/engineTypeInitialiser.js.map +1 -1
- package/dist/types/models/IEngineCore.d.ts +11 -4
- package/dist/types/models/IEngineCoreClone.d.ts +4 -1
- package/dist/types/models/IEngineServer.d.ts +2 -2
- package/dist/types/models/config/IEngineCoreTypeConfig.d.ts +4 -0
- package/dist/types/models/engineTypeInitialiser.d.ts +6 -6
- package/docs/changelog.md +255 -1
- package/docs/examples.md +52 -1
- package/docs/reference/interfaces/EngineTypeInitialiserReturn.md +28 -8
- package/docs/reference/interfaces/IEngineCore.md +63 -31
- package/docs/reference/interfaces/IEngineCoreClone.md +14 -6
- package/docs/reference/interfaces/IEngineCoreConfig.md +6 -6
- package/docs/reference/interfaces/IEngineCoreContext.md +5 -5
- package/docs/reference/interfaces/IEngineCoreTypeBaseConfig.md +3 -3
- package/docs/reference/interfaces/IEngineModuleConfig.md +9 -9
- package/docs/reference/interfaces/IEngineServer.md +7 -7
- package/docs/reference/interfaces/IEngineStateStorage.md +4 -4
- package/docs/reference/type-aliases/EngineTypeInitialiser.md +7 -3
- package/docs/reference/type-aliases/IEngineCoreTypeConfig.md +13 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TWIN Engine Models
|
|
2
2
|
|
|
3
|
-
Models
|
|
3
|
+
Engine Models defines shared contracts and factories used to compose runtime behaviour across the repository. It provides stable interfaces for core and server implementations so packages can interoperate with a clear and predictable structure.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IEngineCore.js","sourceRoot":"","sources":["../../../src/models/IEngineCore.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IContextIds } from \"@twin.org/context\";\nimport type { IError } from \"@twin.org/core\";\nimport type { IEngineCoreConfig } from \"./config/IEngineCoreConfig.js\";\nimport type { IEngineCoreTypeConfig } from \"./config/IEngineCoreTypeConfig.js\";\nimport type { IEngineCoreClone } from \"./IEngineCoreClone.js\";\nimport type { IEngineState } from \"./IEngineState.js\";\n\n/**\n * Interface describing the engine core methods.\n */\nexport interface IEngineCore<\n\tC extends IEngineCoreConfig = IEngineCoreConfig,\n\tS extends IEngineState = IEngineState\n> {\n\t/**\n\t * Add a type initialiser.\n\t * @param type The type to add the initialiser for.\n\t * @param module The name of the module which contains the initialiser method.\n\t * @param method The name of the method to call.\n\t */\n\taddTypeInitialiser(type: string, module: string, method: string): void;\n\n\t/**\n\t * Get the type config for a specific type.\n\t * @param type The type to get the config for.\n\t * @returns The type config or undefined if not found.\n\t */\n\tgetTypeConfig(type: string): IEngineCoreTypeConfig[] | undefined;\n\n\t/**\n\t * Add a context ID key to the engine.\n\t * @param key The context ID key.\n\t */\n\taddContextIdKey(key: string): void;\n\n\t/**\n\t * Get the context ID keys for the engine.\n\t * @returns The context IDs keys.\n\t */\n\tgetContextIdKeys(): string[];\n\n\t/**\n\t * Add a context ID to the engine.\n\t * @param key The context ID key.\n\t * @param value The context ID value.\n\t */\n\taddContextId(key: string, value: string): void;\n\n\t/**\n\t * Get the context IDs for the engine.\n\t * @returns The context IDs or undefined if none are set.\n\t */\n\tgetContextIds(): IContextIds | undefined;\n\n\t/**\n\t * Start the engine core.\n\t * @
|
|
1
|
+
{"version":3,"file":"IEngineCore.js","sourceRoot":"","sources":["../../../src/models/IEngineCore.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IContextIds } from \"@twin.org/context\";\nimport type { IError } from \"@twin.org/core\";\nimport type { IEngineCoreConfig } from \"./config/IEngineCoreConfig.js\";\nimport type { IEngineCoreTypeConfig } from \"./config/IEngineCoreTypeConfig.js\";\nimport type { IEngineCoreClone } from \"./IEngineCoreClone.js\";\nimport type { IEngineState } from \"./IEngineState.js\";\n\n/**\n * Interface describing the engine core methods.\n */\nexport interface IEngineCore<\n\tC extends IEngineCoreConfig = IEngineCoreConfig,\n\tS extends IEngineState = IEngineState\n> {\n\t/**\n\t * Add a type initialiser.\n\t * @param type The type to add the initialiser for.\n\t * @param module The name of the module which contains the initialiser method.\n\t * @param method The name of the method to call.\n\t */\n\taddTypeInitialiser(type: string, module: string, method: string): void;\n\n\t/**\n\t * Get the type config for a specific type.\n\t * @param type The type to get the config for.\n\t * @returns The type config or undefined if not found.\n\t */\n\tgetTypeConfig(type: string): IEngineCoreTypeConfig[] | undefined;\n\n\t/**\n\t * Add a context ID key to the engine.\n\t * @param key The context ID key.\n\t * @param componentFeatures The component features for the context ID handler.\n\t */\n\taddContextIdKey(key: string, componentFeatures: string[]): void;\n\n\t/**\n\t * Get the context ID keys for the engine.\n\t * @returns The context IDs keys.\n\t */\n\tgetContextIdKeys(): string[];\n\n\t/**\n\t * Add a context ID to the engine.\n\t * @param key The context ID key.\n\t * @param value The context ID value.\n\t */\n\taddContextId(key: string, value: string): void;\n\n\t/**\n\t * Get the context IDs for the engine.\n\t * @returns The context IDs or undefined if none are set.\n\t */\n\tgetContextIds(): IContextIds | undefined;\n\n\t/**\n\t * Start the engine core.\n\t * @param skipComponentStart Should the component start be skipped.\n\t * @returns Nothing.\n\t */\n\tstart(skipComponentStart?: boolean): Promise<void>;\n\n\t/**\n\t * Stop the engine core.\n\t * @returns Nothing.\n\t */\n\tstop(): Promise<void>;\n\n\t/**\n\t * Is the engine started.\n\t * @returns True if the engine is started.\n\t */\n\tisStarted(): boolean;\n\n\t/**\n\t * Is this the primary engine instance.\n\t * @returns True if the engine is the primary instance.\n\t */\n\tisPrimary(): boolean;\n\n\t/**\n\t * Is this engine instance a clone.\n\t * @returns True if the engine instance is a clone.\n\t */\n\tisClone(): boolean;\n\n\t/**\n\t * Log info.\n\t * @param message The message to log.\n\t */\n\tlogInfo(message: string): void;\n\n\t/**\n\t * Log error.\n\t * @param error The error to log.\n\t */\n\tlogError(error: IError): void;\n\n\t/**\n\t * Get the config for the engine.\n\t * @returns The config for the engine.\n\t */\n\tgetConfig(): C;\n\n\t/**\n\t * Get the state of the engine.\n\t * @returns The state of the engine.\n\t */\n\tgetState(): S;\n\n\t/**\n\t * Set the state to dirty so it gets saved.\n\t */\n\tsetStateDirty(): void;\n\n\t/**\n\t * Get all the registered instances.\n\t * @returns The registered instances.\n\t */\n\tgetRegisteredInstances(): {\n\t\t[name: string]: {\n\t\t\ttype: string;\n\t\t\tfeatures?: string[];\n\t\t}[];\n\t};\n\n\t/**\n\t * Get the registered instance type for the component/connector.\n\t * @param componentConnectorType The type of the component/connector.\n\t * @param features The requested features of the component, if not specified the default entry will be retrieved.\n\t * @returns The instance type matching the criteria if one is registered.\n\t * @throws If a matching instance was not found.\n\t */\n\tgetRegisteredInstanceType(componentConnectorType: string, features?: string[]): string;\n\n\t/**\n\t * Get the registered instance type for the component/connector.\n\t * @param componentConnectorType The type of the component/connector.\n\t * @param features The requested features of the component, if not specified the default entry will be retrieved.\n\t * @returns The instance type matching the criteria if one is registered.\n\t */\n\tgetRegisteredInstanceTypeOptional(\n\t\tcomponentConnectorType: string,\n\t\tfeatures?: string[]\n\t): string | undefined;\n\n\t/**\n\t * Get the data required to create a clone of the engine.\n\t * @returns The clone data.\n\t */\n\tgetCloneData(): IEngineCoreClone<C, S>;\n\n\t/**\n\t * Populate the engine from the clone data.\n\t * @param cloneData The clone data to populate from.\n\t * @param contextIds The context IDs to use for the clone.\n\t * @param silent Should the clone be silent.\n\t */\n\tpopulateClone(\n\t\tcloneData: IEngineCoreClone<C, S>,\n\t\tcontextIds?: IContextIds,\n\t\tsilent?: boolean\n\t): void;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IEngineCoreClone.js","sourceRoot":"","sources":["../../../src/models/IEngineCoreClone.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IEntitySchema } from \"@twin.org/entity\";\nimport type { IEngineCoreConfig } from \"./config/IEngineCoreConfig.js\";\nimport type { IEngineState } from \"./IEngineState.js\";\n\n/**\n * Interface describing the data required to clone an engine.\n */\nexport interface IEngineCoreClone<\n\tC extends IEngineCoreConfig = IEngineCoreConfig,\n\tS extends IEngineState = IEngineState\n> {\n\t/**\n\t * The config for the engine.\n\t */\n\tconfig: C;\n\n\t/**\n\t * The state of the engine.\n\t */\n\tstate: S;\n\n\t/**\n\t * The type initialisers for the engine.\n\t */\n\ttypeInitialisers: {\n\t\ttype: string;\n\t\tmodule: string;\n\t\tmethod: string;\n\t}[];\n\n\t/**\n\t * The entity schemas for the engine.\n\t */\n\tentitySchemas: { [schema: string]: IEntitySchema };\n\n\t/**\n\t * The context ID keys.\n\t */\n\tcontextIdKeys: string[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IEngineCoreClone.js","sourceRoot":"","sources":["../../../src/models/IEngineCoreClone.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IEntitySchema } from \"@twin.org/entity\";\nimport type { IEngineCoreConfig } from \"./config/IEngineCoreConfig.js\";\nimport type { IEngineState } from \"./IEngineState.js\";\n\n/**\n * Interface describing the data required to clone an engine.\n */\nexport interface IEngineCoreClone<\n\tC extends IEngineCoreConfig = IEngineCoreConfig,\n\tS extends IEngineState = IEngineState\n> {\n\t/**\n\t * The config for the engine.\n\t */\n\tconfig: C;\n\n\t/**\n\t * The state of the engine.\n\t */\n\tstate: S;\n\n\t/**\n\t * The type initialisers for the engine.\n\t */\n\ttypeInitialisers: {\n\t\ttype: string;\n\t\tmodule: string;\n\t\tmethod: string;\n\t}[];\n\n\t/**\n\t * The entity schemas for the engine.\n\t */\n\tentitySchemas: { [schema: string]: IEntitySchema };\n\n\t/**\n\t * The context ID keys.\n\t */\n\tcontextIdKeys: { key: string; componentFeatures: string[] }[];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IEngineServer.js","sourceRoot":"","sources":["../../../src/models/IEngineServer.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Interface describing the engine server methods.\n */\nexport interface IEngineServer {\n\t/**\n\t * Add a REST route generator.\n\t * @param type The type to add the generator for.\n\t * @param module The module containing the generator.\n\t * @param method The method to call on the module.\n\t */\n\taddRestRouteGenerator(type: string, module: string, method: string): void;\n\n\t/**\n\t * Add a socket route generator.\n\t * @param type The type to add the generator for.\n\t * @param module The module containing the generator.\n\t * @param method The method to call on the module.\n\t */\n\taddSocketRouteGenerator(type: string, module: string, method: string): void;\n\n\t/**\n\t * Start the engine server.\n\t * @returns
|
|
1
|
+
{"version":3,"file":"IEngineServer.js","sourceRoot":"","sources":["../../../src/models/IEngineServer.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Interface describing the engine server methods.\n */\nexport interface IEngineServer {\n\t/**\n\t * Add a REST route generator.\n\t * @param type The type to add the generator for.\n\t * @param module The module containing the generator.\n\t * @param method The method to call on the module.\n\t */\n\taddRestRouteGenerator(type: string, module: string, method: string): void;\n\n\t/**\n\t * Add a socket route generator.\n\t * @param type The type to add the generator for.\n\t * @param module The module containing the generator.\n\t * @param method The method to call on the module.\n\t */\n\taddSocketRouteGenerator(type: string, module: string, method: string): void;\n\n\t/**\n\t * Start the engine server.\n\t * @returns Nothing.\n\t */\n\tstart(): Promise<void>;\n\n\t/**\n\t * Stop the engine server.\n\t * @returns Nothing.\n\t */\n\tstop(): Promise<void>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IEngineCoreTypeConfig.js","sourceRoot":"","sources":["../../../../src/models/config/IEngineCoreTypeConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IEngineCoreTypeBaseConfig } from \"./IEngineCoreTypeBaseConfig.js\";\n\n/**\n * Configuration for the engine core type.\n */\nexport type IEngineCoreTypeConfig<T extends IEngineCoreTypeBaseConfig = IEngineCoreTypeBaseConfig> =\n\tT & {\n\t\t/**\n\t\t * The instance type to override with.\n\t\t */\n\t\toverrideInstanceType?: string;\n\n\t\t/**\n\t\t * Whether this is the default instance.\n\t\t */\n\t\tisDefault?: boolean;\n\n\t\t/**\n\t\t * The features supported by this instance.\n\t\t */\n\t\tfeatures?: string[];\n\n\t\t/**\n\t\t * The path for the REST API.\n\t\t */\n\t\trestPath?: string;\n\n\t\t/**\n\t\t * The options for the REST API route generation.\n\t\t */\n\t\trestOptions?: unknown;\n\n\t\t/**\n\t\t * The path for the socket API.\n\t\t */\n\t\tsocketPath?: string;\n\n\t\t/**\n\t\t * The options for the socket API route generation.\n\t\t */\n\t\tsocketOptions?: unknown;\n\t};\n"]}
|
|
1
|
+
{"version":3,"file":"IEngineCoreTypeConfig.js","sourceRoot":"","sources":["../../../../src/models/config/IEngineCoreTypeConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IEngineCoreTypeBaseConfig } from \"./IEngineCoreTypeBaseConfig.js\";\n\n/**\n * Configuration for the engine core type.\n */\nexport type IEngineCoreTypeConfig<T extends IEngineCoreTypeBaseConfig = IEngineCoreTypeBaseConfig> =\n\tT & {\n\t\t/**\n\t\t * The instance type to override with.\n\t\t */\n\t\toverrideInstanceType?: string;\n\n\t\t/**\n\t\t * Whether this is the default instance.\n\t\t */\n\t\tisDefault?: boolean;\n\n\t\t/**\n\t\t * Whether this is a multi-instance component.\n\t\t */\n\t\tisMultiInstance?: boolean;\n\n\t\t/**\n\t\t * The features supported by this instance.\n\t\t */\n\t\tfeatures?: string[];\n\n\t\t/**\n\t\t * The path for the REST API.\n\t\t */\n\t\trestPath?: string;\n\n\t\t/**\n\t\t * The options for the REST API route generation.\n\t\t */\n\t\trestOptions?: unknown;\n\n\t\t/**\n\t\t * The path for the socket API.\n\t\t */\n\t\tsocketPath?: string;\n\n\t\t/**\n\t\t * The options for the socket API route generation.\n\t\t */\n\t\tsocketOptions?: unknown;\n\t};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engineTypeInitialiser.js","sourceRoot":"","sources":["../../../src/models/engineTypeInitialiser.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { Factory, IComponent } from \"@twin.org/core\";\nimport type { IEngineCoreTypeBaseConfig } from \"./config/IEngineCoreTypeBaseConfig.js\";\nimport type { IEngineCore } from \"./IEngineCore.js\";\nimport type { IEngineCoreContext } from \"./IEngineCoreContext.js\";\n\n/**\n * Method definition for the engine type initialiser.\n */\nexport type EngineTypeInitialiser
|
|
1
|
+
{"version":3,"file":"engineTypeInitialiser.js","sourceRoot":"","sources":["../../../src/models/engineTypeInitialiser.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { Factory, IComponent } from \"@twin.org/core\";\nimport type { IEngineCoreTypeBaseConfig } from \"./config/IEngineCoreTypeBaseConfig.js\";\nimport type { IEngineCore } from \"./IEngineCore.js\";\nimport type { IEngineCoreContext } from \"./IEngineCoreContext.js\";\n\n/**\n * Method definition for the engine type initialiser.\n */\nexport type EngineTypeInitialiser<\n\tT extends IEngineCoreTypeBaseConfig = IEngineCoreTypeBaseConfig,\n\tF = Factory<unknown>\n> = (\n\tengineCore: IEngineCore,\n\tcontext: IEngineCoreContext,\n\tinstanceConfig: T\n) => EngineTypeInitialiserReturn<T, F>;\n\n/**\n * Engine type initialiser return type.\n */\nexport interface EngineTypeInitialiserReturn<\n\tT extends IEngineCoreTypeBaseConfig = IEngineCoreTypeBaseConfig,\n\tF = Factory<unknown>\n> {\n\t/**\n\t * The instance type created.\n\t */\n\tinstanceTypeName?: string;\n\n\t/**\n\t * The factory to store the instance in.\n\t */\n\tfactory?: F;\n\n\t/**\n\t * Create a new component.\n\t */\n\tcreateComponent?: (additionalConfig: T) => IComponent;\n}\n"]}
|
|
@@ -24,8 +24,9 @@ export interface IEngineCore<C extends IEngineCoreConfig = IEngineCoreConfig, S
|
|
|
24
24
|
/**
|
|
25
25
|
* Add a context ID key to the engine.
|
|
26
26
|
* @param key The context ID key.
|
|
27
|
+
* @param componentFeatures The component features for the context ID handler.
|
|
27
28
|
*/
|
|
28
|
-
addContextIdKey(key: string): void;
|
|
29
|
+
addContextIdKey(key: string, componentFeatures: string[]): void;
|
|
29
30
|
/**
|
|
30
31
|
* Get the context ID keys for the engine.
|
|
31
32
|
* @returns The context IDs keys.
|
|
@@ -44,9 +45,10 @@ export interface IEngineCore<C extends IEngineCoreConfig = IEngineCoreConfig, S
|
|
|
44
45
|
getContextIds(): IContextIds | undefined;
|
|
45
46
|
/**
|
|
46
47
|
* Start the engine core.
|
|
47
|
-
* @
|
|
48
|
+
* @param skipComponentStart Should the component start be skipped.
|
|
49
|
+
* @returns Nothing.
|
|
48
50
|
*/
|
|
49
|
-
start(): Promise<
|
|
51
|
+
start(skipComponentStart?: boolean): Promise<void>;
|
|
50
52
|
/**
|
|
51
53
|
* Stop the engine core.
|
|
52
54
|
* @returns Nothing.
|
|
@@ -87,6 +89,10 @@ export interface IEngineCore<C extends IEngineCoreConfig = IEngineCoreConfig, S
|
|
|
87
89
|
* @returns The state of the engine.
|
|
88
90
|
*/
|
|
89
91
|
getState(): S;
|
|
92
|
+
/**
|
|
93
|
+
* Set the state to dirty so it gets saved.
|
|
94
|
+
*/
|
|
95
|
+
setStateDirty(): void;
|
|
90
96
|
/**
|
|
91
97
|
* Get all the registered instances.
|
|
92
98
|
* @returns The registered instances.
|
|
@@ -120,7 +126,8 @@ export interface IEngineCore<C extends IEngineCoreConfig = IEngineCoreConfig, S
|
|
|
120
126
|
/**
|
|
121
127
|
* Populate the engine from the clone data.
|
|
122
128
|
* @param cloneData The clone data to populate from.
|
|
129
|
+
* @param contextIds The context IDs to use for the clone.
|
|
123
130
|
* @param silent Should the clone be silent.
|
|
124
131
|
*/
|
|
125
|
-
populateClone(cloneData: IEngineCoreClone<C, S>, silent?: boolean): void;
|
|
132
|
+
populateClone(cloneData: IEngineCoreClone<C, S>, contextIds?: IContextIds, silent?: boolean): void;
|
|
126
133
|
}
|
|
@@ -18,9 +18,9 @@ export interface IEngineServer {
|
|
|
18
18
|
addSocketRouteGenerator(type: string, module: string, method: string): void;
|
|
19
19
|
/**
|
|
20
20
|
* Start the engine server.
|
|
21
|
-
* @returns
|
|
21
|
+
* @returns Nothing.
|
|
22
22
|
*/
|
|
23
|
-
start(): Promise<
|
|
23
|
+
start(): Promise<void>;
|
|
24
24
|
/**
|
|
25
25
|
* Stop the engine server.
|
|
26
26
|
* @returns Nothing.
|
|
@@ -11,6 +11,10 @@ export type IEngineCoreTypeConfig<T extends IEngineCoreTypeBaseConfig = IEngineC
|
|
|
11
11
|
* Whether this is the default instance.
|
|
12
12
|
*/
|
|
13
13
|
isDefault?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether this is a multi-instance component.
|
|
16
|
+
*/
|
|
17
|
+
isMultiInstance?: boolean;
|
|
14
18
|
/**
|
|
15
19
|
* The features supported by this instance.
|
|
16
20
|
*/
|
|
@@ -5,21 +5,21 @@ import type { IEngineCoreContext } from "./IEngineCoreContext.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* Method definition for the engine type initialiser.
|
|
7
7
|
*/
|
|
8
|
-
export type EngineTypeInitialiser<T extends IEngineCoreTypeBaseConfig = IEngineCoreTypeBaseConfig
|
|
8
|
+
export type EngineTypeInitialiser<T extends IEngineCoreTypeBaseConfig = IEngineCoreTypeBaseConfig, F = Factory<unknown>> = (engineCore: IEngineCore, context: IEngineCoreContext, instanceConfig: T) => EngineTypeInitialiserReturn<T, F>;
|
|
9
9
|
/**
|
|
10
10
|
* Engine type initialiser return type.
|
|
11
11
|
*/
|
|
12
|
-
export interface EngineTypeInitialiserReturn {
|
|
12
|
+
export interface EngineTypeInitialiserReturn<T extends IEngineCoreTypeBaseConfig = IEngineCoreTypeBaseConfig, F = Factory<unknown>> {
|
|
13
13
|
/**
|
|
14
14
|
* The instance type created.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
instanceTypeName?: string;
|
|
17
17
|
/**
|
|
18
18
|
* The factory to store the instance in.
|
|
19
19
|
*/
|
|
20
|
-
factory?:
|
|
20
|
+
factory?: F;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Create a new component.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
createComponent?: (additionalConfig: T) => IComponent;
|
|
25
25
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,4 +1,258 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.3-next.31](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.30...engine-models-v0.0.3-next.31) (2026-04-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **engine-models:** Synchronize repo versions
|
|
9
|
+
|
|
10
|
+
## [0.0.3-next.30](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.29...engine-models-v0.0.3-next.30) (2026-04-16)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Miscellaneous Chores
|
|
14
|
+
|
|
15
|
+
* **engine-models:** Synchronize repo versions
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.29](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.28...engine-models-v0.0.3-next.29) (2026-04-14)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Miscellaneous Chores
|
|
21
|
+
|
|
22
|
+
* **engine-models:** Synchronize repo versions
|
|
23
|
+
|
|
24
|
+
## [0.0.3-next.28](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.27...engine-models-v0.0.3-next.28) (2026-04-10)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Miscellaneous Chores
|
|
28
|
+
|
|
29
|
+
* **engine-models:** Synchronize repo versions
|
|
30
|
+
|
|
31
|
+
## [0.0.3-next.27](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.26...engine-models-v0.0.3-next.27) (2026-03-20)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* update dependencies ([e6ebe42](https://github.com/twinfoundation/engine/commit/e6ebe42b9d61066227ad8b45dae14c8f8615b760))
|
|
37
|
+
|
|
38
|
+
## [0.0.3-next.26](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.25...engine-models-v0.0.3-next.26) (2026-03-05)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Miscellaneous Chores
|
|
42
|
+
|
|
43
|
+
* **engine-models:** Synchronize repo versions
|
|
44
|
+
|
|
45
|
+
## [0.0.3-next.25](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.24...engine-models-v0.0.3-next.25) (2026-03-02)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Miscellaneous Chores
|
|
49
|
+
|
|
50
|
+
* **engine-models:** Synchronize repo versions
|
|
51
|
+
|
|
52
|
+
## [0.0.3-next.24](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.23...engine-models-v0.0.3-next.24) (2026-02-26)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Miscellaneous Chores
|
|
56
|
+
|
|
57
|
+
* **engine-models:** Synchronize repo versions
|
|
58
|
+
|
|
59
|
+
## [0.0.3-next.23](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.22...engine-models-v0.0.3-next.23) (2026-02-23)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Features
|
|
63
|
+
|
|
64
|
+
* add auth admin component ([201cd06](https://github.com/twinfoundation/engine/commit/201cd061be83afccb5a6b06856ffe7cf8db7d6b3))
|
|
65
|
+
* add context id features ([#51](https://github.com/twinfoundation/engine/issues/51)) ([eaef180](https://github.com/twinfoundation/engine/commit/eaef1807397a907bc7655ef1545a151a710ca2f1))
|
|
66
|
+
* add engine type helper for config lookups ([a20a398](https://github.com/twinfoundation/engine/commit/a20a3987016c48351178ab8410bc05b0fba0f2c1))
|
|
67
|
+
* add engine type helper for config lookups ([7d5eeef](https://github.com/twinfoundation/engine/commit/7d5eeefd3e7b9daab1ba20e2fb6b1ebfec178aec))
|
|
68
|
+
* add isPrimary and isClone methods ([a7c63e9](https://github.com/twinfoundation/engine/commit/a7c63e97f54c95b104cc81e66d3fa42c6607bdc1))
|
|
69
|
+
* add mimeTypeProcessors and disableNodeIdentity ([bb7e81e](https://github.com/twinfoundation/engine/commit/bb7e81e2036fe042068a5645ec59b22e20d33aad))
|
|
70
|
+
* add REST options for route construction ([4adf0af](https://github.com/twinfoundation/engine/commit/4adf0af8a03689a4dbdf67e8527d6db0d2c5d59d))
|
|
71
|
+
* add rights management negotiation ([84ef46b](https://github.com/twinfoundation/engine/commit/84ef46bff110611a19512793425c8c873ee2a590))
|
|
72
|
+
* add skipComponentStart flag ([#62](https://github.com/twinfoundation/engine/issues/62)) ([07e90af](https://github.com/twinfoundation/engine/commit/07e90afa4ba1baaa79c0c6f0f45200d781801534))
|
|
73
|
+
* add synchronised storage support ([5142e34](https://github.com/twinfoundation/engine/commit/5142e3488f09195cf9f48a9c6c6d1014231a4c2c))
|
|
74
|
+
* add validate-locales ([b92ea09](https://github.com/twinfoundation/engine/commit/b92ea09dbcfe35225271a51f24d231f59e2d363e))
|
|
75
|
+
* close already started components on startup error ([a55a117](https://github.com/twinfoundation/engine/commit/a55a117a508998288c8ae804e732fc6085cb22fa))
|
|
76
|
+
* context id handlers repopulated after engine clone ([9712e32](https://github.com/twinfoundation/engine/commit/9712e328f4607f5b2c82355c394c61bde0ee39bf))
|
|
77
|
+
* eslint migration to flat config ([6b978da](https://github.com/twinfoundation/engine/commit/6b978daf777a615d7758b63c3df57d5a376f6dfb))
|
|
78
|
+
* improve startup error handling ([#65](https://github.com/twinfoundation/engine/issues/65)) ([5b2d1c5](https://github.com/twinfoundation/engine/commit/5b2d1c539cf5484afa85e294d6d6c18f24ef8274))
|
|
79
|
+
* maintain isDefault flag for registered instances ([2ac5bee](https://github.com/twinfoundation/engine/commit/2ac5bee094bef42b396cc82b0d18bb6aebe27352))
|
|
80
|
+
* multi instance component support ([#83](https://github.com/twinfoundation/engine/issues/83)) ([6012b50](https://github.com/twinfoundation/engine/commit/6012b50959df5af893f05516d42eea2e0800b31a))
|
|
81
|
+
* remove bootstrapped components, component should manage their own state ([5c7e9e4](https://github.com/twinfoundation/engine/commit/5c7e9e419ef26933e49c9c5a21a20a8961244e7f))
|
|
82
|
+
* remove unused component states ([d56d648](https://github.com/twinfoundation/engine/commit/d56d6486119ea8b8501a33f9e3a3101a08b826ed))
|
|
83
|
+
* simplify config building ([732c871](https://github.com/twinfoundation/engine/commit/732c871c5aca236759168f4bc15aeffd98a330a8))
|
|
84
|
+
* standardised engine logging naming ([0dbf857](https://github.com/twinfoundation/engine/commit/0dbf857587641f86ddf010143519d0e8333489ff))
|
|
85
|
+
* update dependencies ([97c9f64](https://github.com/twinfoundation/engine/commit/97c9f64b6ef096963bcc5de338a2a9e99bdc1a11))
|
|
86
|
+
* update framework core ([acc0f8d](https://github.com/twinfoundation/engine/commit/acc0f8d455a4b8ec47f1da643139fa0f07775fa6))
|
|
87
|
+
* upgrade framework components ([efd52e8](https://github.com/twinfoundation/engine/commit/efd52e80564fff29c3897bfa09b6305b3a322812))
|
|
88
|
+
* use shared store mechanism ([#2](https://github.com/twinfoundation/engine/issues/2)) ([9eed8d7](https://github.com/twinfoundation/engine/commit/9eed8d7766388479b42f03e2542fe761f2156408))
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### Bug Fixes
|
|
92
|
+
|
|
93
|
+
* make sure stop is called even if start is not implemented ([ece2b9d](https://github.com/twinfoundation/engine/commit/ece2b9de5c6dff2b5ccf2a3115c1a7328a330125))
|
|
94
|
+
* pass contextIds to populateClone ([#79](https://github.com/twinfoundation/engine/issues/79)) ([b22f1bb](https://github.com/twinfoundation/engine/commit/b22f1bbf0319069914e316d27de4c2a8623421cf))
|
|
95
|
+
|
|
96
|
+
## [0.0.3-next.22](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.21...engine-models-v0.0.3-next.22) (2026-02-23)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
### Miscellaneous Chores
|
|
100
|
+
|
|
101
|
+
* **engine-models:** Synchronize repo versions
|
|
102
|
+
|
|
103
|
+
## [0.0.3-next.21](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.20...engine-models-v0.0.3-next.21) (2026-02-13)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### Features
|
|
107
|
+
|
|
108
|
+
* multi instance component support ([#83](https://github.com/twinfoundation/engine/issues/83)) ([6012b50](https://github.com/twinfoundation/engine/commit/6012b50959df5af893f05516d42eea2e0800b31a))
|
|
109
|
+
|
|
110
|
+
## [0.0.3-next.20](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.19...engine-models-v0.0.3-next.20) (2026-02-06)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
### Miscellaneous Chores
|
|
114
|
+
|
|
115
|
+
* **engine-models:** Synchronize repo versions
|
|
116
|
+
|
|
117
|
+
## [0.0.3-next.19](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.18...engine-models-v0.0.3-next.19) (2026-02-05)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
### Bug Fixes
|
|
121
|
+
|
|
122
|
+
* pass contextIds to populateClone ([#79](https://github.com/twinfoundation/engine/issues/79)) ([b22f1bb](https://github.com/twinfoundation/engine/commit/b22f1bbf0319069914e316d27de4c2a8623421cf))
|
|
123
|
+
|
|
124
|
+
## [0.0.3-next.18](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.17...engine-models-v0.0.3-next.18) (2026-02-04)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### Miscellaneous Chores
|
|
128
|
+
|
|
129
|
+
* **engine-models:** Synchronize repo versions
|
|
130
|
+
|
|
131
|
+
## [0.0.3-next.17](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.16...engine-models-v0.0.3-next.17) (2026-02-02)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
### Miscellaneous Chores
|
|
135
|
+
|
|
136
|
+
* **engine-models:** Synchronize repo versions
|
|
137
|
+
|
|
138
|
+
## [0.0.3-next.16](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.15...engine-models-v0.0.3-next.16) (2026-01-28)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
### Miscellaneous Chores
|
|
142
|
+
|
|
143
|
+
* **engine-models:** Synchronize repo versions
|
|
144
|
+
|
|
145
|
+
## [0.0.3-next.15](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.14...engine-models-v0.0.3-next.15) (2026-01-26)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
### Miscellaneous Chores
|
|
149
|
+
|
|
150
|
+
* **engine-models:** Synchronize repo versions
|
|
151
|
+
|
|
152
|
+
## [0.0.3-next.14](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.13...engine-models-v0.0.3-next.14) (2026-01-19)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
### Features
|
|
156
|
+
|
|
157
|
+
* add auth admin component ([201cd06](https://github.com/twinfoundation/engine/commit/201cd061be83afccb5a6b06856ffe7cf8db7d6b3))
|
|
158
|
+
* add context id features ([#51](https://github.com/twinfoundation/engine/issues/51)) ([eaef180](https://github.com/twinfoundation/engine/commit/eaef1807397a907bc7655ef1545a151a710ca2f1))
|
|
159
|
+
* add engine type helper for config lookups ([a20a398](https://github.com/twinfoundation/engine/commit/a20a3987016c48351178ab8410bc05b0fba0f2c1))
|
|
160
|
+
* add engine type helper for config lookups ([7d5eeef](https://github.com/twinfoundation/engine/commit/7d5eeefd3e7b9daab1ba20e2fb6b1ebfec178aec))
|
|
161
|
+
* add isPrimary and isClone methods ([a7c63e9](https://github.com/twinfoundation/engine/commit/a7c63e97f54c95b104cc81e66d3fa42c6607bdc1))
|
|
162
|
+
* add mimeTypeProcessors and disableNodeIdentity ([bb7e81e](https://github.com/twinfoundation/engine/commit/bb7e81e2036fe042068a5645ec59b22e20d33aad))
|
|
163
|
+
* add REST options for route construction ([4adf0af](https://github.com/twinfoundation/engine/commit/4adf0af8a03689a4dbdf67e8527d6db0d2c5d59d))
|
|
164
|
+
* add rights management negotiation ([84ef46b](https://github.com/twinfoundation/engine/commit/84ef46bff110611a19512793425c8c873ee2a590))
|
|
165
|
+
* add skipComponentStart flag ([#62](https://github.com/twinfoundation/engine/issues/62)) ([07e90af](https://github.com/twinfoundation/engine/commit/07e90afa4ba1baaa79c0c6f0f45200d781801534))
|
|
166
|
+
* add synchronised storage support ([5142e34](https://github.com/twinfoundation/engine/commit/5142e3488f09195cf9f48a9c6c6d1014231a4c2c))
|
|
167
|
+
* add validate-locales ([b92ea09](https://github.com/twinfoundation/engine/commit/b92ea09dbcfe35225271a51f24d231f59e2d363e))
|
|
168
|
+
* close already started components on startup error ([a55a117](https://github.com/twinfoundation/engine/commit/a55a117a508998288c8ae804e732fc6085cb22fa))
|
|
169
|
+
* context id handlers repopulated after engine clone ([9712e32](https://github.com/twinfoundation/engine/commit/9712e328f4607f5b2c82355c394c61bde0ee39bf))
|
|
170
|
+
* eslint migration to flat config ([6b978da](https://github.com/twinfoundation/engine/commit/6b978daf777a615d7758b63c3df57d5a376f6dfb))
|
|
171
|
+
* improve startup error handling ([#65](https://github.com/twinfoundation/engine/issues/65)) ([5b2d1c5](https://github.com/twinfoundation/engine/commit/5b2d1c539cf5484afa85e294d6d6c18f24ef8274))
|
|
172
|
+
* maintain isDefault flag for registered instances ([2ac5bee](https://github.com/twinfoundation/engine/commit/2ac5bee094bef42b396cc82b0d18bb6aebe27352))
|
|
173
|
+
* remove bootstrapped components, component should manage their own state ([5c7e9e4](https://github.com/twinfoundation/engine/commit/5c7e9e419ef26933e49c9c5a21a20a8961244e7f))
|
|
174
|
+
* remove unused component states ([d56d648](https://github.com/twinfoundation/engine/commit/d56d6486119ea8b8501a33f9e3a3101a08b826ed))
|
|
175
|
+
* simplify config building ([732c871](https://github.com/twinfoundation/engine/commit/732c871c5aca236759168f4bc15aeffd98a330a8))
|
|
176
|
+
* standardised engine logging naming ([0dbf857](https://github.com/twinfoundation/engine/commit/0dbf857587641f86ddf010143519d0e8333489ff))
|
|
177
|
+
* update dependencies ([97c9f64](https://github.com/twinfoundation/engine/commit/97c9f64b6ef096963bcc5de338a2a9e99bdc1a11))
|
|
178
|
+
* update framework core ([acc0f8d](https://github.com/twinfoundation/engine/commit/acc0f8d455a4b8ec47f1da643139fa0f07775fa6))
|
|
179
|
+
* upgrade framework components ([efd52e8](https://github.com/twinfoundation/engine/commit/efd52e80564fff29c3897bfa09b6305b3a322812))
|
|
180
|
+
* use shared store mechanism ([#2](https://github.com/twinfoundation/engine/issues/2)) ([9eed8d7](https://github.com/twinfoundation/engine/commit/9eed8d7766388479b42f03e2542fe761f2156408))
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
### Bug Fixes
|
|
184
|
+
|
|
185
|
+
* make sure stop is called even if start is not implemented ([ece2b9d](https://github.com/twinfoundation/engine/commit/ece2b9de5c6dff2b5ccf2a3115c1a7328a330125))
|
|
186
|
+
|
|
187
|
+
## [0.0.3-next.13](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.12...engine-models-v0.0.3-next.13) (2026-01-19)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
### Miscellaneous Chores
|
|
191
|
+
|
|
192
|
+
* **engine-models:** Synchronize repo versions
|
|
193
|
+
|
|
194
|
+
## [0.0.3-next.12](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.11...engine-models-v0.0.3-next.12) (2026-01-19)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
### Features
|
|
198
|
+
|
|
199
|
+
* improve startup error handling ([#65](https://github.com/twinfoundation/engine/issues/65)) ([5b2d1c5](https://github.com/twinfoundation/engine/commit/5b2d1c539cf5484afa85e294d6d6c18f24ef8274))
|
|
200
|
+
|
|
201
|
+
## [0.0.3-next.11](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.10...engine-models-v0.0.3-next.11) (2026-01-16)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
### Miscellaneous Chores
|
|
205
|
+
|
|
206
|
+
* **engine-models:** Synchronize repo versions
|
|
207
|
+
|
|
208
|
+
## [0.0.3-next.10](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.9...engine-models-v0.0.3-next.10) (2026-01-13)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
### Features
|
|
212
|
+
|
|
213
|
+
* add skipComponentStart flag ([#62](https://github.com/twinfoundation/engine/issues/62)) ([07e90af](https://github.com/twinfoundation/engine/commit/07e90afa4ba1baaa79c0c6f0f45200d781801534))
|
|
214
|
+
|
|
215
|
+
## [0.0.3-next.9](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.8...engine-models-v0.0.3-next.9) (2026-01-07)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
### Miscellaneous Chores
|
|
219
|
+
|
|
220
|
+
* **engine-models:** Synchronize repo versions
|
|
221
|
+
|
|
222
|
+
## [0.0.3-next.8](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.7...engine-models-v0.0.3-next.8) (2026-01-06)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
### Miscellaneous Chores
|
|
226
|
+
|
|
227
|
+
* **engine-models:** Synchronize repo versions
|
|
228
|
+
|
|
229
|
+
## [0.0.3-next.7](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.6...engine-models-v0.0.3-next.7) (2025-12-04)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
### Miscellaneous Chores
|
|
233
|
+
|
|
234
|
+
* **engine-models:** Synchronize repo versions
|
|
235
|
+
|
|
236
|
+
## [0.0.3-next.6](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.5...engine-models-v0.0.3-next.6) (2025-11-28)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
### Miscellaneous Chores
|
|
240
|
+
|
|
241
|
+
* **engine-models:** Synchronize repo versions
|
|
242
|
+
|
|
243
|
+
## [0.0.3-next.5](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.4...engine-models-v0.0.3-next.5) (2025-11-20)
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
### Miscellaneous Chores
|
|
247
|
+
|
|
248
|
+
* **engine-models:** Synchronize repo versions
|
|
249
|
+
|
|
250
|
+
## [0.0.3-next.4](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.3...engine-models-v0.0.3-next.4) (2025-11-20)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
### Features
|
|
254
|
+
|
|
255
|
+
* context id handlers repopulated after engine clone ([9712e32](https://github.com/twinfoundation/engine/commit/9712e328f4607f5b2c82355c394c61bde0ee39bf))
|
|
2
256
|
|
|
3
257
|
## [0.0.3-next.3](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.2...engine-models-v0.0.3-next.3) (2025-11-14)
|
|
4
258
|
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,52 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Engine Models Examples
|
|
2
|
+
|
|
3
|
+
These examples show how to register factories and define strongly typed contracts for core and server integrations.
|
|
4
|
+
|
|
5
|
+
## EngineCoreFactory and EngineServerFactory
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { EngineCoreFactory, EngineServerFactory } from '@twin.org/engine-models';
|
|
9
|
+
import { EngineCore } from '@twin.org/engine-core';
|
|
10
|
+
import { EngineServer } from '@twin.org/engine-server';
|
|
11
|
+
|
|
12
|
+
EngineCoreFactory.register(
|
|
13
|
+
'default',
|
|
14
|
+
() => new EngineCore({ config: { debug: false, silent: true, types: {} }, skipBootstrap: true })
|
|
15
|
+
);
|
|
16
|
+
EngineServerFactory.register(
|
|
17
|
+
'default',
|
|
18
|
+
() => new EngineServer({ engineCore: EngineCoreFactory.get('default') })
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const core = EngineCoreFactory.get('default');
|
|
22
|
+
const server = EngineServerFactory.get('default');
|
|
23
|
+
|
|
24
|
+
console.log(core.isStarted()); // false
|
|
25
|
+
console.log(server.getRestRoutes().length); // 0
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## IEngineCoreConfig and IEngineCoreTypeConfig
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import type { IEngineCoreConfig, IEngineCoreTypeConfig } from '@twin.org/engine-models';
|
|
32
|
+
|
|
33
|
+
const loggingConnectorConfig: IEngineCoreTypeConfig<{ config: { prettyPrint: boolean } }> = {
|
|
34
|
+
type: 'console',
|
|
35
|
+
isDefault: true,
|
|
36
|
+
options: {
|
|
37
|
+
config: {
|
|
38
|
+
prettyPrint: true
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const coreConfig: IEngineCoreConfig = {
|
|
44
|
+
debug: true,
|
|
45
|
+
silent: false,
|
|
46
|
+
types: {
|
|
47
|
+
loggingConnector: [loggingConnectorConfig]
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
console.log(coreConfig.types.loggingConnector?.[0].type); // "console"
|
|
52
|
+
```
|
|
@@ -1,27 +1,47 @@
|
|
|
1
|
-
# Interface: EngineTypeInitialiserReturn
|
|
1
|
+
# Interface: EngineTypeInitialiserReturn\<T, F\>
|
|
2
2
|
|
|
3
3
|
Engine type initialiser return type.
|
|
4
4
|
|
|
5
|
+
## Type Parameters
|
|
6
|
+
|
|
7
|
+
### T
|
|
8
|
+
|
|
9
|
+
`T` *extends* [`IEngineCoreTypeBaseConfig`](IEngineCoreTypeBaseConfig.md) = [`IEngineCoreTypeBaseConfig`](IEngineCoreTypeBaseConfig.md)
|
|
10
|
+
|
|
11
|
+
### F
|
|
12
|
+
|
|
13
|
+
`F` = `Factory`\<`unknown`\>
|
|
14
|
+
|
|
5
15
|
## Properties
|
|
6
16
|
|
|
7
|
-
###
|
|
17
|
+
### instanceTypeName? {#instancetypename}
|
|
8
18
|
|
|
9
|
-
> `optional` **
|
|
19
|
+
> `optional` **instanceTypeName?**: `string`
|
|
10
20
|
|
|
11
21
|
The instance type created.
|
|
12
22
|
|
|
13
23
|
***
|
|
14
24
|
|
|
15
|
-
### factory?
|
|
25
|
+
### factory? {#factory}
|
|
16
26
|
|
|
17
|
-
> `optional` **factory
|
|
27
|
+
> `optional` **factory?**: `F`
|
|
18
28
|
|
|
19
29
|
The factory to store the instance in.
|
|
20
30
|
|
|
21
31
|
***
|
|
22
32
|
|
|
23
|
-
###
|
|
33
|
+
### createComponent? {#createcomponent}
|
|
34
|
+
|
|
35
|
+
> `optional` **createComponent?**: (`additionalConfig`) => `IComponent`
|
|
36
|
+
|
|
37
|
+
Create a new component.
|
|
38
|
+
|
|
39
|
+
#### Parameters
|
|
40
|
+
|
|
41
|
+
##### additionalConfig
|
|
42
|
+
|
|
43
|
+
`T`
|
|
24
44
|
|
|
25
|
-
|
|
45
|
+
#### Returns
|
|
26
46
|
|
|
27
|
-
|
|
47
|
+
`IComponent`
|
|
@@ -14,7 +14,7 @@ Interface describing the engine core methods.
|
|
|
14
14
|
|
|
15
15
|
## Methods
|
|
16
16
|
|
|
17
|
-
### addTypeInitialiser()
|
|
17
|
+
### addTypeInitialiser() {#addtypeinitialiser}
|
|
18
18
|
|
|
19
19
|
> **addTypeInitialiser**(`type`, `module`, `method`): `void`
|
|
20
20
|
|
|
@@ -46,9 +46,9 @@ The name of the method to call.
|
|
|
46
46
|
|
|
47
47
|
***
|
|
48
48
|
|
|
49
|
-
### getTypeConfig()
|
|
49
|
+
### getTypeConfig() {#gettypeconfig}
|
|
50
50
|
|
|
51
|
-
> **getTypeConfig**(`type`):
|
|
51
|
+
> **getTypeConfig**(`type`): [`IEngineCoreTypeConfig`](../type-aliases/IEngineCoreTypeConfig.md)[] \| `undefined`
|
|
52
52
|
|
|
53
53
|
Get the type config for a specific type.
|
|
54
54
|
|
|
@@ -62,15 +62,15 @@ The type to get the config for.
|
|
|
62
62
|
|
|
63
63
|
#### Returns
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
[`IEngineCoreTypeConfig`](../type-aliases/IEngineCoreTypeConfig.md)[] \| `undefined`
|
|
66
66
|
|
|
67
67
|
The type config or undefined if not found.
|
|
68
68
|
|
|
69
69
|
***
|
|
70
70
|
|
|
71
|
-
### addContextIdKey()
|
|
71
|
+
### addContextIdKey() {#addcontextidkey}
|
|
72
72
|
|
|
73
|
-
> **addContextIdKey**(`key`): `void`
|
|
73
|
+
> **addContextIdKey**(`key`, `componentFeatures`): `void`
|
|
74
74
|
|
|
75
75
|
Add a context ID key to the engine.
|
|
76
76
|
|
|
@@ -82,13 +82,19 @@ Add a context ID key to the engine.
|
|
|
82
82
|
|
|
83
83
|
The context ID key.
|
|
84
84
|
|
|
85
|
+
##### componentFeatures
|
|
86
|
+
|
|
87
|
+
`string`[]
|
|
88
|
+
|
|
89
|
+
The component features for the context ID handler.
|
|
90
|
+
|
|
85
91
|
#### Returns
|
|
86
92
|
|
|
87
93
|
`void`
|
|
88
94
|
|
|
89
95
|
***
|
|
90
96
|
|
|
91
|
-
### getContextIdKeys()
|
|
97
|
+
### getContextIdKeys() {#getcontextidkeys}
|
|
92
98
|
|
|
93
99
|
> **getContextIdKeys**(): `string`[]
|
|
94
100
|
|
|
@@ -102,7 +108,7 @@ The context IDs keys.
|
|
|
102
108
|
|
|
103
109
|
***
|
|
104
110
|
|
|
105
|
-
### addContextId()
|
|
111
|
+
### addContextId() {#addcontextid}
|
|
106
112
|
|
|
107
113
|
> **addContextId**(`key`, `value`): `void`
|
|
108
114
|
|
|
@@ -128,35 +134,43 @@ The context ID value.
|
|
|
128
134
|
|
|
129
135
|
***
|
|
130
136
|
|
|
131
|
-
### getContextIds()
|
|
137
|
+
### getContextIds() {#getcontextids}
|
|
132
138
|
|
|
133
|
-
> **getContextIds**(): `
|
|
139
|
+
> **getContextIds**(): `IContextIds` \| `undefined`
|
|
134
140
|
|
|
135
141
|
Get the context IDs for the engine.
|
|
136
142
|
|
|
137
143
|
#### Returns
|
|
138
144
|
|
|
139
|
-
`
|
|
145
|
+
`IContextIds` \| `undefined`
|
|
140
146
|
|
|
141
147
|
The context IDs or undefined if none are set.
|
|
142
148
|
|
|
143
149
|
***
|
|
144
150
|
|
|
145
|
-
### start()
|
|
151
|
+
### start() {#start}
|
|
146
152
|
|
|
147
|
-
> **start**(): `Promise`\<`
|
|
153
|
+
> **start**(`skipComponentStart?`): `Promise`\<`void`\>
|
|
148
154
|
|
|
149
155
|
Start the engine core.
|
|
150
156
|
|
|
157
|
+
#### Parameters
|
|
158
|
+
|
|
159
|
+
##### skipComponentStart?
|
|
160
|
+
|
|
161
|
+
`boolean`
|
|
162
|
+
|
|
163
|
+
Should the component start be skipped.
|
|
164
|
+
|
|
151
165
|
#### Returns
|
|
152
166
|
|
|
153
|
-
`Promise`\<`
|
|
167
|
+
`Promise`\<`void`\>
|
|
154
168
|
|
|
155
|
-
|
|
169
|
+
Nothing.
|
|
156
170
|
|
|
157
171
|
***
|
|
158
172
|
|
|
159
|
-
### stop()
|
|
173
|
+
### stop() {#stop}
|
|
160
174
|
|
|
161
175
|
> **stop**(): `Promise`\<`void`\>
|
|
162
176
|
|
|
@@ -170,7 +184,7 @@ Nothing.
|
|
|
170
184
|
|
|
171
185
|
***
|
|
172
186
|
|
|
173
|
-
### isStarted()
|
|
187
|
+
### isStarted() {#isstarted}
|
|
174
188
|
|
|
175
189
|
> **isStarted**(): `boolean`
|
|
176
190
|
|
|
@@ -184,7 +198,7 @@ True if the engine is started.
|
|
|
184
198
|
|
|
185
199
|
***
|
|
186
200
|
|
|
187
|
-
### isPrimary()
|
|
201
|
+
### isPrimary() {#isprimary}
|
|
188
202
|
|
|
189
203
|
> **isPrimary**(): `boolean`
|
|
190
204
|
|
|
@@ -198,7 +212,7 @@ True if the engine is the primary instance.
|
|
|
198
212
|
|
|
199
213
|
***
|
|
200
214
|
|
|
201
|
-
### isClone()
|
|
215
|
+
### isClone() {#isclone}
|
|
202
216
|
|
|
203
217
|
> **isClone**(): `boolean`
|
|
204
218
|
|
|
@@ -212,7 +226,7 @@ True if the engine instance is a clone.
|
|
|
212
226
|
|
|
213
227
|
***
|
|
214
228
|
|
|
215
|
-
### logInfo()
|
|
229
|
+
### logInfo() {#loginfo}
|
|
216
230
|
|
|
217
231
|
> **logInfo**(`message`): `void`
|
|
218
232
|
|
|
@@ -232,7 +246,7 @@ The message to log.
|
|
|
232
246
|
|
|
233
247
|
***
|
|
234
248
|
|
|
235
|
-
### logError()
|
|
249
|
+
### logError() {#logerror}
|
|
236
250
|
|
|
237
251
|
> **logError**(`error`): `void`
|
|
238
252
|
|
|
@@ -252,7 +266,7 @@ The error to log.
|
|
|
252
266
|
|
|
253
267
|
***
|
|
254
268
|
|
|
255
|
-
### getConfig()
|
|
269
|
+
### getConfig() {#getconfig}
|
|
256
270
|
|
|
257
271
|
> **getConfig**(): `C`
|
|
258
272
|
|
|
@@ -266,7 +280,7 @@ The config for the engine.
|
|
|
266
280
|
|
|
267
281
|
***
|
|
268
282
|
|
|
269
|
-
### getState()
|
|
283
|
+
### getState() {#getstate}
|
|
270
284
|
|
|
271
285
|
> **getState**(): `S`
|
|
272
286
|
|
|
@@ -280,7 +294,19 @@ The state of the engine.
|
|
|
280
294
|
|
|
281
295
|
***
|
|
282
296
|
|
|
283
|
-
###
|
|
297
|
+
### setStateDirty() {#setstatedirty}
|
|
298
|
+
|
|
299
|
+
> **setStateDirty**(): `void`
|
|
300
|
+
|
|
301
|
+
Set the state to dirty so it gets saved.
|
|
302
|
+
|
|
303
|
+
#### Returns
|
|
304
|
+
|
|
305
|
+
`void`
|
|
306
|
+
|
|
307
|
+
***
|
|
308
|
+
|
|
309
|
+
### getRegisteredInstances() {#getregisteredinstances}
|
|
284
310
|
|
|
285
311
|
> **getRegisteredInstances**(): `object`
|
|
286
312
|
|
|
@@ -294,7 +320,7 @@ The registered instances.
|
|
|
294
320
|
|
|
295
321
|
***
|
|
296
322
|
|
|
297
|
-
### getRegisteredInstanceType()
|
|
323
|
+
### getRegisteredInstanceType() {#getregisteredinstancetype}
|
|
298
324
|
|
|
299
325
|
> **getRegisteredInstanceType**(`componentConnectorType`, `features?`): `string`
|
|
300
326
|
|
|
@@ -326,9 +352,9 @@ If a matching instance was not found.
|
|
|
326
352
|
|
|
327
353
|
***
|
|
328
354
|
|
|
329
|
-
### getRegisteredInstanceTypeOptional()
|
|
355
|
+
### getRegisteredInstanceTypeOptional() {#getregisteredinstancetypeoptional}
|
|
330
356
|
|
|
331
|
-
> **getRegisteredInstanceTypeOptional**(`componentConnectorType`, `features?`): `
|
|
357
|
+
> **getRegisteredInstanceTypeOptional**(`componentConnectorType`, `features?`): `string` \| `undefined`
|
|
332
358
|
|
|
333
359
|
Get the registered instance type for the component/connector.
|
|
334
360
|
|
|
@@ -348,13 +374,13 @@ The requested features of the component, if not specified the default entry will
|
|
|
348
374
|
|
|
349
375
|
#### Returns
|
|
350
376
|
|
|
351
|
-
`
|
|
377
|
+
`string` \| `undefined`
|
|
352
378
|
|
|
353
379
|
The instance type matching the criteria if one is registered.
|
|
354
380
|
|
|
355
381
|
***
|
|
356
382
|
|
|
357
|
-
### getCloneData()
|
|
383
|
+
### getCloneData() {#getclonedata}
|
|
358
384
|
|
|
359
385
|
> **getCloneData**(): [`IEngineCoreClone`](IEngineCoreClone.md)\<`C`, `S`\>
|
|
360
386
|
|
|
@@ -368,9 +394,9 @@ The clone data.
|
|
|
368
394
|
|
|
369
395
|
***
|
|
370
396
|
|
|
371
|
-
### populateClone()
|
|
397
|
+
### populateClone() {#populateclone}
|
|
372
398
|
|
|
373
|
-
> **populateClone**(`cloneData`, `silent?`): `void`
|
|
399
|
+
> **populateClone**(`cloneData`, `contextIds?`, `silent?`): `void`
|
|
374
400
|
|
|
375
401
|
Populate the engine from the clone data.
|
|
376
402
|
|
|
@@ -382,6 +408,12 @@ Populate the engine from the clone data.
|
|
|
382
408
|
|
|
383
409
|
The clone data to populate from.
|
|
384
410
|
|
|
411
|
+
##### contextIds?
|
|
412
|
+
|
|
413
|
+
`IContextIds`
|
|
414
|
+
|
|
415
|
+
The context IDs to use for the clone.
|
|
416
|
+
|
|
385
417
|
##### silent?
|
|
386
418
|
|
|
387
419
|
`boolean`
|
|
@@ -14,7 +14,7 @@ Interface describing the data required to clone an engine.
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
-
### config
|
|
17
|
+
### config {#config}
|
|
18
18
|
|
|
19
19
|
> **config**: `C`
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ The config for the engine.
|
|
|
22
22
|
|
|
23
23
|
***
|
|
24
24
|
|
|
25
|
-
### state
|
|
25
|
+
### state {#state}
|
|
26
26
|
|
|
27
27
|
> **state**: `S`
|
|
28
28
|
|
|
@@ -30,7 +30,7 @@ The state of the engine.
|
|
|
30
30
|
|
|
31
31
|
***
|
|
32
32
|
|
|
33
|
-
### typeInitialisers
|
|
33
|
+
### typeInitialisers {#typeinitialisers}
|
|
34
34
|
|
|
35
35
|
> **typeInitialisers**: `object`[]
|
|
36
36
|
|
|
@@ -50,7 +50,7 @@ The type initialisers for the engine.
|
|
|
50
50
|
|
|
51
51
|
***
|
|
52
52
|
|
|
53
|
-
### entitySchemas
|
|
53
|
+
### entitySchemas {#entityschemas}
|
|
54
54
|
|
|
55
55
|
> **entitySchemas**: `object`
|
|
56
56
|
|
|
@@ -62,8 +62,16 @@ The entity schemas for the engine.
|
|
|
62
62
|
|
|
63
63
|
***
|
|
64
64
|
|
|
65
|
-
### contextIdKeys
|
|
65
|
+
### contextIdKeys {#contextidkeys}
|
|
66
66
|
|
|
67
|
-
> **contextIdKeys**: `
|
|
67
|
+
> **contextIdKeys**: `object`[]
|
|
68
68
|
|
|
69
69
|
The context ID keys.
|
|
70
|
+
|
|
71
|
+
#### key
|
|
72
|
+
|
|
73
|
+
> **key**: `string`
|
|
74
|
+
|
|
75
|
+
#### componentFeatures
|
|
76
|
+
|
|
77
|
+
> **componentFeatures**: `string`[]
|
|
@@ -4,9 +4,9 @@ Configuration for the engine core.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### debug?
|
|
7
|
+
### debug? {#debug}
|
|
8
8
|
|
|
9
|
-
> `optional` **debug
|
|
9
|
+
> `optional` **debug?**: `boolean`
|
|
10
10
|
|
|
11
11
|
Start the engine in debug mode.
|
|
12
12
|
|
|
@@ -18,9 +18,9 @@ false
|
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
21
|
-
### silent?
|
|
21
|
+
### silent? {#silent}
|
|
22
22
|
|
|
23
|
-
> `optional` **silent
|
|
23
|
+
> `optional` **silent?**: `boolean`
|
|
24
24
|
|
|
25
25
|
Disable output to the console.
|
|
26
26
|
|
|
@@ -32,7 +32,7 @@ false
|
|
|
32
32
|
|
|
33
33
|
***
|
|
34
34
|
|
|
35
|
-
### types
|
|
35
|
+
### types {#types}
|
|
36
36
|
|
|
37
37
|
> **types**: `object`
|
|
38
38
|
|
|
@@ -40,4 +40,4 @@ The types to initialise in the engine.
|
|
|
40
40
|
|
|
41
41
|
#### Index Signature
|
|
42
42
|
|
|
43
|
-
\[`type`: `string`\]:
|
|
43
|
+
\[`type`: `string`\]: [`IEngineCoreTypeConfig`](../type-aliases/IEngineCoreTypeConfig.md)[] \| `undefined`
|
|
@@ -14,7 +14,7 @@ The context for the engine core.
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
-
### config
|
|
17
|
+
### config {#config}
|
|
18
18
|
|
|
19
19
|
> **config**: `C`
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ The engine core config.
|
|
|
22
22
|
|
|
23
23
|
***
|
|
24
24
|
|
|
25
|
-
### state
|
|
25
|
+
### state {#state}
|
|
26
26
|
|
|
27
27
|
> **state**: `S`
|
|
28
28
|
|
|
@@ -30,7 +30,7 @@ The engine core state.
|
|
|
30
30
|
|
|
31
31
|
***
|
|
32
32
|
|
|
33
|
-
### stateDirty
|
|
33
|
+
### stateDirty {#statedirty}
|
|
34
34
|
|
|
35
35
|
> **stateDirty**: `boolean`
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ The state dirty flag, which flags that the state needs saving.
|
|
|
38
38
|
|
|
39
39
|
***
|
|
40
40
|
|
|
41
|
-
### registeredInstances
|
|
41
|
+
### registeredInstances {#registeredinstances}
|
|
42
42
|
|
|
43
43
|
> **registeredInstances**: `object`
|
|
44
44
|
|
|
@@ -51,7 +51,7 @@ The default entry will be the first in the list.
|
|
|
51
51
|
|
|
52
52
|
***
|
|
53
53
|
|
|
54
|
-
### componentInstances
|
|
54
|
+
### componentInstances {#componentinstances}
|
|
55
55
|
|
|
56
56
|
> **componentInstances**: `object`[]
|
|
57
57
|
|
|
@@ -10,7 +10,7 @@ Configuration for the engine core type base.
|
|
|
10
10
|
|
|
11
11
|
## Properties
|
|
12
12
|
|
|
13
|
-
### type
|
|
13
|
+
### type {#type}
|
|
14
14
|
|
|
15
15
|
> **type**: `string`
|
|
16
16
|
|
|
@@ -18,8 +18,8 @@ The type of the instance.
|
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
21
|
-
### options?
|
|
21
|
+
### options? {#options}
|
|
22
22
|
|
|
23
|
-
> `optional` **options
|
|
23
|
+
> `optional` **options?**: `T`
|
|
24
24
|
|
|
25
25
|
The options for the instance.
|
|
@@ -4,7 +4,7 @@ Configuration for an engine module.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### id
|
|
7
|
+
### id {#id}
|
|
8
8
|
|
|
9
9
|
> **id**: `string`
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ The unique identifier for the module.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### moduleName
|
|
15
|
+
### moduleName {#modulename}
|
|
16
16
|
|
|
17
17
|
> **moduleName**: `string`
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ The module that implements the additional component.
|
|
|
20
20
|
|
|
21
21
|
***
|
|
22
22
|
|
|
23
|
-
### className
|
|
23
|
+
### className {#classname}
|
|
24
24
|
|
|
25
25
|
> **className**: `string`
|
|
26
26
|
|
|
@@ -28,9 +28,9 @@ The class name of the additional component.
|
|
|
28
28
|
|
|
29
29
|
***
|
|
30
30
|
|
|
31
|
-
### dependencies?
|
|
31
|
+
### dependencies? {#dependencies}
|
|
32
32
|
|
|
33
|
-
> `optional` **dependencies
|
|
33
|
+
> `optional` **dependencies?**: `object`[]
|
|
34
34
|
|
|
35
35
|
Additional dependencies required by the component.
|
|
36
36
|
|
|
@@ -44,16 +44,16 @@ Additional dependencies required by the component.
|
|
|
44
44
|
|
|
45
45
|
#### features?
|
|
46
46
|
|
|
47
|
-
> `optional` **features
|
|
47
|
+
> `optional` **features?**: `string`[]
|
|
48
48
|
|
|
49
49
|
#### isOptional?
|
|
50
50
|
|
|
51
|
-
> `optional` **isOptional
|
|
51
|
+
> `optional` **isOptional?**: `boolean`
|
|
52
52
|
|
|
53
53
|
***
|
|
54
54
|
|
|
55
|
-
### config?
|
|
55
|
+
### config? {#config}
|
|
56
56
|
|
|
57
|
-
> `optional` **config
|
|
57
|
+
> `optional` **config?**: `unknown`
|
|
58
58
|
|
|
59
59
|
Additional configuration for the component.
|
|
@@ -4,7 +4,7 @@ Interface describing the engine server methods.
|
|
|
4
4
|
|
|
5
5
|
## Methods
|
|
6
6
|
|
|
7
|
-
### addRestRouteGenerator()
|
|
7
|
+
### addRestRouteGenerator() {#addrestroutegenerator}
|
|
8
8
|
|
|
9
9
|
> **addRestRouteGenerator**(`type`, `module`, `method`): `void`
|
|
10
10
|
|
|
@@ -36,7 +36,7 @@ The method to call on the module.
|
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
39
|
-
### addSocketRouteGenerator()
|
|
39
|
+
### addSocketRouteGenerator() {#addsocketroutegenerator}
|
|
40
40
|
|
|
41
41
|
> **addSocketRouteGenerator**(`type`, `module`, `method`): `void`
|
|
42
42
|
|
|
@@ -68,21 +68,21 @@ The method to call on the module.
|
|
|
68
68
|
|
|
69
69
|
***
|
|
70
70
|
|
|
71
|
-
### start()
|
|
71
|
+
### start() {#start}
|
|
72
72
|
|
|
73
|
-
> **start**(): `Promise`\<`
|
|
73
|
+
> **start**(): `Promise`\<`void`\>
|
|
74
74
|
|
|
75
75
|
Start the engine server.
|
|
76
76
|
|
|
77
77
|
#### Returns
|
|
78
78
|
|
|
79
|
-
`Promise`\<`
|
|
79
|
+
`Promise`\<`void`\>
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
Nothing.
|
|
82
82
|
|
|
83
83
|
***
|
|
84
84
|
|
|
85
|
-
### stop()
|
|
85
|
+
### stop() {#stop}
|
|
86
86
|
|
|
87
87
|
> **stop**(): `Promise`\<`void`\>
|
|
88
88
|
|
|
@@ -10,9 +10,9 @@ Definition of state storage for engine.
|
|
|
10
10
|
|
|
11
11
|
## Methods
|
|
12
12
|
|
|
13
|
-
### load()
|
|
13
|
+
### load() {#load}
|
|
14
14
|
|
|
15
|
-
> **load**(`engineCore`): `Promise`\<`
|
|
15
|
+
> **load**(`engineCore`): `Promise`\<`S` \| `undefined`\>
|
|
16
16
|
|
|
17
17
|
Method for loading the state.
|
|
18
18
|
|
|
@@ -26,13 +26,13 @@ The engine core to load the state for.
|
|
|
26
26
|
|
|
27
27
|
#### Returns
|
|
28
28
|
|
|
29
|
-
`Promise`\<`
|
|
29
|
+
`Promise`\<`S` \| `undefined`\>
|
|
30
30
|
|
|
31
31
|
The state of the engine or undefined if it doesn't exist.
|
|
32
32
|
|
|
33
33
|
***
|
|
34
34
|
|
|
35
|
-
### save()
|
|
35
|
+
### save() {#save}
|
|
36
36
|
|
|
37
37
|
> **save**(`engineCore`, `state`): `Promise`\<`void`\>
|
|
38
38
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Type Alias: EngineTypeInitialiser
|
|
1
|
+
# Type Alias: EngineTypeInitialiser\<T, F\>
|
|
2
2
|
|
|
3
|
-
> **EngineTypeInitialiser**\<`T`\> = (`engineCore`, `context`, `instanceConfig`) =>
|
|
3
|
+
> **EngineTypeInitialiser**\<`T`, `F`\> = (`engineCore`, `context`, `instanceConfig`) => [`EngineTypeInitialiserReturn`](../interfaces/EngineTypeInitialiserReturn.md)\<`T`, `F`\>
|
|
4
4
|
|
|
5
5
|
Method definition for the engine type initialiser.
|
|
6
6
|
|
|
@@ -10,6 +10,10 @@ Method definition for the engine type initialiser.
|
|
|
10
10
|
|
|
11
11
|
`T` *extends* [`IEngineCoreTypeBaseConfig`](../interfaces/IEngineCoreTypeBaseConfig.md) = [`IEngineCoreTypeBaseConfig`](../interfaces/IEngineCoreTypeBaseConfig.md)
|
|
12
12
|
|
|
13
|
+
### F
|
|
14
|
+
|
|
15
|
+
`F` = `Factory`\<`unknown`\>
|
|
16
|
+
|
|
13
17
|
## Parameters
|
|
14
18
|
|
|
15
19
|
### engineCore
|
|
@@ -26,4 +30,4 @@ Method definition for the engine type initialiser.
|
|
|
26
30
|
|
|
27
31
|
## Returns
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
[`EngineTypeInitialiserReturn`](../interfaces/EngineTypeInitialiserReturn.md)\<`T`, `F`\>
|
|
@@ -8,43 +8,49 @@ Configuration for the engine core type.
|
|
|
8
8
|
|
|
9
9
|
### overrideInstanceType?
|
|
10
10
|
|
|
11
|
-
> `optional` **overrideInstanceType
|
|
11
|
+
> `optional` **overrideInstanceType?**: `string`
|
|
12
12
|
|
|
13
13
|
The instance type to override with.
|
|
14
14
|
|
|
15
15
|
### isDefault?
|
|
16
16
|
|
|
17
|
-
> `optional` **isDefault
|
|
17
|
+
> `optional` **isDefault?**: `boolean`
|
|
18
18
|
|
|
19
19
|
Whether this is the default instance.
|
|
20
20
|
|
|
21
|
+
### isMultiInstance?
|
|
22
|
+
|
|
23
|
+
> `optional` **isMultiInstance?**: `boolean`
|
|
24
|
+
|
|
25
|
+
Whether this is a multi-instance component.
|
|
26
|
+
|
|
21
27
|
### features?
|
|
22
28
|
|
|
23
|
-
> `optional` **features
|
|
29
|
+
> `optional` **features?**: `string`[]
|
|
24
30
|
|
|
25
31
|
The features supported by this instance.
|
|
26
32
|
|
|
27
33
|
### restPath?
|
|
28
34
|
|
|
29
|
-
> `optional` **restPath
|
|
35
|
+
> `optional` **restPath?**: `string`
|
|
30
36
|
|
|
31
37
|
The path for the REST API.
|
|
32
38
|
|
|
33
39
|
### restOptions?
|
|
34
40
|
|
|
35
|
-
> `optional` **restOptions
|
|
41
|
+
> `optional` **restOptions?**: `unknown`
|
|
36
42
|
|
|
37
43
|
The options for the REST API route generation.
|
|
38
44
|
|
|
39
45
|
### socketPath?
|
|
40
46
|
|
|
41
|
-
> `optional` **socketPath
|
|
47
|
+
> `optional` **socketPath?**: `string`
|
|
42
48
|
|
|
43
49
|
The path for the socket API.
|
|
44
50
|
|
|
45
51
|
### socketOptions?
|
|
46
52
|
|
|
47
|
-
> `optional` **socketOptions
|
|
53
|
+
> `optional` **socketOptions?**: `unknown`
|
|
48
54
|
|
|
49
55
|
The options for the socket API route generation.
|
|
50
56
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/engine-models",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.31",
|
|
4
|
+
"description": "Shared contracts and factory interfaces for composing engine core and server implementations.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/twinfoundation/engine.git",
|