@twin.org/engine-models 0.0.1-next.1 → 0.0.1-next.2
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/factories/engineCoreFactory.d.ts +1 -1
- package/dist/types/models/IEngineCore.d.ts +2 -2
- package/dist/types/models/IEngineCoreContext.d.ts +2 -2
- package/dist/types/models/IEngineStateStorage.d.ts +3 -3
- package/docs/changelog.md +1 -1
- package/docs/reference/interfaces/IEngineCore.md +7 -3
- package/docs/reference/interfaces/IEngineCoreContext.md +6 -2
- package/docs/reference/interfaces/IEngineStateStorage.md +10 -6
- package/docs/reference/variables/EngineCoreFactory.md +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import type { IEngineState } from "./IEngineState";
|
|
|
7
7
|
/**
|
|
8
8
|
* Interface describing the engine core methods.
|
|
9
9
|
*/
|
|
10
|
-
export interface IEngineCore {
|
|
10
|
+
export interface IEngineCore<S extends IEngineState = IEngineState> {
|
|
11
11
|
/**
|
|
12
12
|
* Add a type initialiser.
|
|
13
13
|
* @param type The type to add the initialiser for.
|
|
@@ -44,7 +44,7 @@ export interface IEngineCore {
|
|
|
44
44
|
* Get the state of the engine.
|
|
45
45
|
* @returns The state of the engine.
|
|
46
46
|
*/
|
|
47
|
-
getState():
|
|
47
|
+
getState(): S;
|
|
48
48
|
/**
|
|
49
49
|
* Get the types for the component.
|
|
50
50
|
* @returns The default types.
|
|
@@ -4,7 +4,7 @@ import type { IEngineState } from "./IEngineState";
|
|
|
4
4
|
/**
|
|
5
5
|
* The context for the engine core.
|
|
6
6
|
*/
|
|
7
|
-
export interface IEngineCoreContext {
|
|
7
|
+
export interface IEngineCoreContext<S extends IEngineState = IEngineState> {
|
|
8
8
|
/**
|
|
9
9
|
* The engine core config.
|
|
10
10
|
*/
|
|
@@ -12,7 +12,7 @@ export interface IEngineCoreContext {
|
|
|
12
12
|
/**
|
|
13
13
|
* The engine core state.
|
|
14
14
|
*/
|
|
15
|
-
state:
|
|
15
|
+
state: S;
|
|
16
16
|
/**
|
|
17
17
|
* The state dirty flag, which flags that the state needs saving.
|
|
18
18
|
*/
|
|
@@ -3,18 +3,18 @@ import type { IEngineState } from "./IEngineState";
|
|
|
3
3
|
/**
|
|
4
4
|
* Definition of state storage for engine.
|
|
5
5
|
*/
|
|
6
|
-
export interface IEngineStateStorage {
|
|
6
|
+
export interface IEngineStateStorage<S extends IEngineState = IEngineState> {
|
|
7
7
|
/**
|
|
8
8
|
* Method for loading the state.
|
|
9
9
|
* @param engineCore The engine core to load the state for.
|
|
10
10
|
* @returns The state of the engine or undefined if it doesn't exist.
|
|
11
11
|
*/
|
|
12
|
-
load(engineCore: IEngineCore): Promise<
|
|
12
|
+
load(engineCore: IEngineCore): Promise<S | undefined>;
|
|
13
13
|
/**
|
|
14
14
|
* Method for saving the state.
|
|
15
15
|
* @param engineCore The engine core to save the state for.
|
|
16
16
|
* @param state The state of the engine to save.
|
|
17
17
|
* @returns Nothing.
|
|
18
18
|
*/
|
|
19
|
-
save(engineCore: IEngineCore, state:
|
|
19
|
+
save(engineCore: IEngineCore, state: S): Promise<void>;
|
|
20
20
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
# Interface: IEngineCore
|
|
1
|
+
# Interface: IEngineCore\<S\>
|
|
2
2
|
|
|
3
3
|
Interface describing the engine core methods.
|
|
4
4
|
|
|
5
|
+
## Type Parameters
|
|
6
|
+
|
|
7
|
+
• **S** *extends* [`IEngineState`](IEngineState.md) = [`IEngineState`](IEngineState.md)
|
|
8
|
+
|
|
5
9
|
## Methods
|
|
6
10
|
|
|
7
11
|
### addTypeInitialiser()
|
|
@@ -114,13 +118,13 @@ The config for the engine.
|
|
|
114
118
|
|
|
115
119
|
### getState()
|
|
116
120
|
|
|
117
|
-
> **getState**():
|
|
121
|
+
> **getState**(): `S`
|
|
118
122
|
|
|
119
123
|
Get the state of the engine.
|
|
120
124
|
|
|
121
125
|
#### Returns
|
|
122
126
|
|
|
123
|
-
|
|
127
|
+
`S`
|
|
124
128
|
|
|
125
129
|
The state of the engine.
|
|
126
130
|
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
# Interface: IEngineCoreContext
|
|
1
|
+
# Interface: IEngineCoreContext\<S\>
|
|
2
2
|
|
|
3
3
|
The context for the engine core.
|
|
4
4
|
|
|
5
|
+
## Type Parameters
|
|
6
|
+
|
|
7
|
+
• **S** *extends* [`IEngineState`](IEngineState.md) = [`IEngineState`](IEngineState.md)
|
|
8
|
+
|
|
5
9
|
## Properties
|
|
6
10
|
|
|
7
11
|
### config
|
|
@@ -14,7 +18,7 @@ The engine core config.
|
|
|
14
18
|
|
|
15
19
|
### state
|
|
16
20
|
|
|
17
|
-
> **state**:
|
|
21
|
+
> **state**: `S`
|
|
18
22
|
|
|
19
23
|
The engine core state.
|
|
20
24
|
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
# Interface: IEngineStateStorage
|
|
1
|
+
# Interface: IEngineStateStorage\<S\>
|
|
2
2
|
|
|
3
3
|
Definition of state storage for engine.
|
|
4
4
|
|
|
5
|
+
## Type Parameters
|
|
6
|
+
|
|
7
|
+
• **S** *extends* [`IEngineState`](IEngineState.md) = [`IEngineState`](IEngineState.md)
|
|
8
|
+
|
|
5
9
|
## Methods
|
|
6
10
|
|
|
7
11
|
### load()
|
|
8
12
|
|
|
9
|
-
> **load**(`engineCore`): `Promise`\<`undefined` \|
|
|
13
|
+
> **load**(`engineCore`): `Promise`\<`undefined` \| `S`\>
|
|
10
14
|
|
|
11
15
|
Method for loading the state.
|
|
12
16
|
|
|
13
17
|
#### Parameters
|
|
14
18
|
|
|
15
|
-
• **engineCore**: [`IEngineCore`](IEngineCore.md)
|
|
19
|
+
• **engineCore**: [`IEngineCore`](IEngineCore.md)\<[`IEngineState`](IEngineState.md)\>
|
|
16
20
|
|
|
17
21
|
The engine core to load the state for.
|
|
18
22
|
|
|
19
23
|
#### Returns
|
|
20
24
|
|
|
21
|
-
`Promise`\<`undefined` \|
|
|
25
|
+
`Promise`\<`undefined` \| `S`\>
|
|
22
26
|
|
|
23
27
|
The state of the engine or undefined if it doesn't exist.
|
|
24
28
|
|
|
@@ -32,11 +36,11 @@ Method for saving the state.
|
|
|
32
36
|
|
|
33
37
|
#### Parameters
|
|
34
38
|
|
|
35
|
-
• **engineCore**: [`IEngineCore`](IEngineCore.md)
|
|
39
|
+
• **engineCore**: [`IEngineCore`](IEngineCore.md)\<[`IEngineState`](IEngineState.md)\>
|
|
36
40
|
|
|
37
41
|
The engine core to save the state for.
|
|
38
42
|
|
|
39
|
-
• **state**:
|
|
43
|
+
• **state**: `S`
|
|
40
44
|
|
|
41
45
|
The state of the engine to save.
|
|
42
46
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Variable: EngineCoreFactory
|
|
2
2
|
|
|
3
|
-
> `const` **EngineCoreFactory**: `Factory`\<[`IEngineCore`](../interfaces/IEngineCore.md)
|
|
3
|
+
> `const` **EngineCoreFactory**: `Factory`\<[`IEngineCore`](../interfaces/IEngineCore.md)\<[`IEngineState`](../interfaces/IEngineState.md)\>\>
|
|
4
4
|
|
|
5
5
|
Factory for creating engine cores.
|