@twin.org/engine-models 0.0.1 → 0.0.2-next.10

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.
@@ -25,6 +25,21 @@ export interface IEngineCore<C extends IEngineCoreConfig = IEngineCoreConfig, S
25
25
  * @returns Nothing.
26
26
  */
27
27
  stop(): Promise<void>;
28
+ /**
29
+ * Is the engine started.
30
+ * @returns True if the engine is started.
31
+ */
32
+ isStarted(): boolean;
33
+ /**
34
+ * Is this the primary engine instance.
35
+ * @returns True if the engine is the primary instance.
36
+ */
37
+ isPrimary(): boolean;
38
+ /**
39
+ * Is this engine instance a clone.
40
+ * @returns True if the engine instance is a clone.
41
+ */
42
+ isClone(): boolean;
28
43
  /**
29
44
  * Log info.
30
45
  * @param message The message to log.
@@ -46,12 +61,30 @@ export interface IEngineCore<C extends IEngineCoreConfig = IEngineCoreConfig, S
46
61
  */
47
62
  getState(): S;
48
63
  /**
49
- * Get the types for the component.
50
- * @returns The default types.
64
+ * Get all the registered instances.
65
+ * @returns The registered instances.
51
66
  */
52
- getDefaultTypes(): {
53
- [type: string]: string;
67
+ getRegisteredInstances(): {
68
+ [name: string]: {
69
+ type: string;
70
+ features?: string[];
71
+ }[];
54
72
  };
73
+ /**
74
+ * Get the registered instance type for the component/connector.
75
+ * @param componentConnectorType The type of the component/connector.
76
+ * @param features The requested features of the component, if not specified the default entry will be retrieved.
77
+ * @returns The instance type matching the criteria if one is registered.
78
+ * @throws If a matching instance was not found.
79
+ */
80
+ getRegisteredInstanceType(componentConnectorType: string, features?: string[]): string;
81
+ /**
82
+ * Get the registered instance type for the component/connector.
83
+ * @param componentConnectorType The type of the component/connector.
84
+ * @param features The requested features of the component, if not specified the default entry will be retrieved.
85
+ * @returns The instance type matching the criteria if one is registered.
86
+ */
87
+ getRegisteredInstanceTypeOptional(componentConnectorType: string, features?: string[]): string | undefined;
55
88
  /**
56
89
  * Get the data required to create a clone of the engine.
57
90
  * @returns The clone data.
@@ -18,10 +18,14 @@ export interface IEngineCoreContext<C extends IEngineCoreConfig = IEngineCoreCon
18
18
  */
19
19
  stateDirty: boolean;
20
20
  /**
21
- * The default types to use when components don't have custom types.
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
- defaultTypes: {
24
- [type: string]: string;
24
+ registeredInstances: {
25
+ [name: string]: {
26
+ type: string;
27
+ features?: string[];
28
+ }[];
25
29
  };
26
30
  /**
27
31
  * The components.
@@ -6,12 +6,4 @@ export interface IEngineState {
6
6
  * The identity for the node.
7
7
  */
8
8
  nodeIdentity?: string;
9
- /**
10
- * The component states.
11
- */
12
- componentStates: {
13
- [component: string]: {
14
- [id: string]: unknown;
15
- };
16
- };
17
9
  }
@@ -8,4 +8,5 @@ export type IEngineCoreTypeConfig<T extends IEngineCoreTypeBaseConfig = {
8
8
  [id: string]: unknown;
9
9
  overrideInstanceType?: string;
10
10
  isDefault?: boolean;
11
+ features?: string[];
11
12
  };
package/docs/changelog.md CHANGED
@@ -1,5 +1,79 @@
1
1
  # @twin.org/engine-models - Changelog
2
2
 
3
+ ## [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)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **engine-models:** Synchronize repo versions
9
+
10
+ ## [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)
11
+
12
+
13
+ ### Features
14
+
15
+ * add isPrimary and isClone methods ([a7c63e9](https://github.com/twinfoundation/engine/commit/a7c63e97f54c95b104cc81e66d3fa42c6607bdc1))
16
+
17
+ ## [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)
18
+
19
+
20
+ ### Miscellaneous Chores
21
+
22
+ * **engine-models:** Synchronize repo versions
23
+
24
+ ## [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)
25
+
26
+
27
+ ### Features
28
+
29
+ * remove unused component states ([d56d648](https://github.com/twinfoundation/engine/commit/d56d6486119ea8b8501a33f9e3a3101a08b826ed))
30
+
31
+ ## [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)
32
+
33
+
34
+ ### Features
35
+
36
+ * update framework core ([acc0f8d](https://github.com/twinfoundation/engine/commit/acc0f8d455a4b8ec47f1da643139fa0f07775fa6))
37
+
38
+ ## [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)
39
+
40
+
41
+ ### Features
42
+
43
+ * add synchronised storage support ([5142e34](https://github.com/twinfoundation/engine/commit/5142e3488f09195cf9f48a9c6c6d1014231a4c2c))
44
+
45
+ ## [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)
46
+
47
+
48
+ ### Miscellaneous Chores
49
+
50
+ * **engine-models:** Synchronize repo versions
51
+
52
+ ## [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)
53
+
54
+
55
+ ### Miscellaneous Chores
56
+
57
+ * **engine-models:** Synchronize repo versions
58
+
59
+ ## [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)
60
+
61
+
62
+ ### Miscellaneous Chores
63
+
64
+ * **engine-models:** Synchronize repo versions
65
+
66
+ ## [0.0.2-next.1](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.0...engine-models-v0.0.2-next.1) (2025-07-11)
67
+
68
+
69
+ ### Features
70
+
71
+ * add auth admin component ([201cd06](https://github.com/twinfoundation/engine/commit/201cd061be83afccb5a6b06856ffe7cf8db7d6b3))
72
+ * add mimeTypeProcessors and disableNodeIdentity ([bb7e81e](https://github.com/twinfoundation/engine/commit/bb7e81e2036fe042068a5645ec59b22e20d33aad))
73
+ * remove bootstrapped components, component should manage their own state ([5c7e9e4](https://github.com/twinfoundation/engine/commit/5c7e9e419ef26933e49c9c5a21a20a8961244e7f))
74
+ * update dependencies ([97c9f64](https://github.com/twinfoundation/engine/commit/97c9f64b6ef096963bcc5de338a2a9e99bdc1a11))
75
+ * use shared store mechanism ([#2](https://github.com/twinfoundation/engine/issues/2)) ([9eed8d7](https://github.com/twinfoundation/engine/commit/9eed8d7766388479b42f03e2542fe761f2156408))
76
+
3
77
  ## 0.0.1 (2025-07-11)
4
78
 
5
79
 
@@ -80,6 +80,48 @@ Nothing.
80
80
 
81
81
  ***
82
82
 
83
+ ### isStarted()
84
+
85
+ > **isStarted**(): `boolean`
86
+
87
+ Is the engine started.
88
+
89
+ #### Returns
90
+
91
+ `boolean`
92
+
93
+ True if the engine is started.
94
+
95
+ ***
96
+
97
+ ### isPrimary()
98
+
99
+ > **isPrimary**(): `boolean`
100
+
101
+ Is this the primary engine instance.
102
+
103
+ #### Returns
104
+
105
+ `boolean`
106
+
107
+ True if the engine is the primary instance.
108
+
109
+ ***
110
+
111
+ ### isClone()
112
+
113
+ > **isClone**(): `boolean`
114
+
115
+ Is this engine instance a clone.
116
+
117
+ #### Returns
118
+
119
+ `boolean`
120
+
121
+ True if the engine instance is a clone.
122
+
123
+ ***
124
+
83
125
  ### logInfo()
84
126
 
85
127
  > **logInfo**(`message`): `void`
@@ -148,17 +190,77 @@ The state of the engine.
148
190
 
149
191
  ***
150
192
 
151
- ### getDefaultTypes()
193
+ ### getRegisteredInstances()
152
194
 
153
- > **getDefaultTypes**(): `object`
195
+ > **getRegisteredInstances**(): `object`
154
196
 
155
- Get the types for the component.
197
+ Get all the registered instances.
156
198
 
157
199
  #### Returns
158
200
 
159
201
  `object`
160
202
 
161
- The default types.
203
+ The registered instances.
204
+
205
+ ***
206
+
207
+ ### getRegisteredInstanceType()
208
+
209
+ > **getRegisteredInstanceType**(`componentConnectorType`, `features?`): `string`
210
+
211
+ Get the registered instance type for the component/connector.
212
+
213
+ #### Parameters
214
+
215
+ ##### componentConnectorType
216
+
217
+ `string`
218
+
219
+ The type of the component/connector.
220
+
221
+ ##### features?
222
+
223
+ `string`[]
224
+
225
+ The requested features of the component, if not specified the default entry will be retrieved.
226
+
227
+ #### Returns
228
+
229
+ `string`
230
+
231
+ The instance type matching the criteria if one is registered.
232
+
233
+ #### Throws
234
+
235
+ If a matching instance was not found.
236
+
237
+ ***
238
+
239
+ ### getRegisteredInstanceTypeOptional()
240
+
241
+ > **getRegisteredInstanceTypeOptional**(`componentConnectorType`, `features?`): `undefined` \| `string`
242
+
243
+ Get the registered instance type for the component/connector.
244
+
245
+ #### Parameters
246
+
247
+ ##### componentConnectorType
248
+
249
+ `string`
250
+
251
+ The type of the component/connector.
252
+
253
+ ##### features?
254
+
255
+ `string`[]
256
+
257
+ The requested features of the component, if not specified the default entry will be retrieved.
258
+
259
+ #### Returns
260
+
261
+ `undefined` \| `string`
262
+
263
+ The instance type matching the criteria if one is registered.
162
264
 
163
265
  ***
164
266
 
@@ -38,15 +38,16 @@ The state dirty flag, which flags that the state needs saving.
38
38
 
39
39
  ***
40
40
 
41
- ### defaultTypes
41
+ ### registeredInstances
42
42
 
43
- > **defaultTypes**: `object`
43
+ > **registeredInstances**: `object`
44
44
 
45
- The default types to use when components don't have custom types.
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
- \[`type`: `string`\]: `string`
50
+ \[`name`: `string`\]: `object`[]
50
51
 
51
52
  ***
52
53
 
@@ -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`
@@ -14,6 +14,10 @@ Configuration for the engine core type.
14
14
 
15
15
  > `optional` **isDefault**: `boolean`
16
16
 
17
+ ### features?
18
+
19
+ > `optional` **features**: `string`[]
20
+
17
21
  ## Type Parameters
18
22
 
19
23
  ### T
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/engine-models",
3
- "version": "0.0.1",
3
+ "version": "0.0.2-next.10",
4
4
  "description": "Models which define the structure of the engine.",
5
5
  "repository": {
6
6
  "type": "git",