@twin.org/engine-models 0.0.3-next.3 → 0.0.3-next.4

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.
@@ -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 * @returns True if the start was successful.\n\t */\n\tstart(): Promise<boolean>;\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 * 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 silent Should the clone be silent.\n\t */\n\tpopulateClone(cloneData: IEngineCoreClone<C, S>, silent?: boolean): void;\n}\n"]}
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 * @returns True if the start was successful.\n\t */\n\tstart(): Promise<boolean>;\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 * 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 silent Should the clone be silent.\n\t */\n\tpopulateClone(cloneData: IEngineCoreClone<C, S>, silent?: boolean): 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"]}
@@ -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.
@@ -30,5 +30,8 @@ export interface IEngineCoreClone<C extends IEngineCoreConfig = IEngineCoreConfi
30
30
  /**
31
31
  * The context ID keys.
32
32
  */
33
- contextIdKeys: string[];
33
+ contextIdKeys: {
34
+ key: string;
35
+ componentFeatures: string[];
36
+ }[];
34
37
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @twin.org/engine-models - Changelog
2
2
 
3
+ ## [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)
4
+
5
+
6
+ ### Features
7
+
8
+ * context id handlers repopulated after engine clone ([9712e32](https://github.com/twinfoundation/engine/commit/9712e328f4607f5b2c82355c394c61bde0ee39bf))
9
+
3
10
  ## [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
11
 
5
12
 
@@ -70,7 +70,7 @@ The type config or undefined if not found.
70
70
 
71
71
  ### 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,6 +82,12 @@ 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`
@@ -64,6 +64,14 @@ The entity schemas for the engine.
64
64
 
65
65
  ### contextIdKeys
66
66
 
67
- > **contextIdKeys**: `string`[]
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`[]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/engine-models",
3
- "version": "0.0.3-next.3",
3
+ "version": "0.0.3-next.4",
4
4
  "description": "Models which define the structure of the engine.",
5
5
  "repository": {
6
6
  "type": "git",