@twin.org/entity-storage-models 0.0.1-next.8 → 0.0.1-next.9
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.
@@ -12,22 +12,34 @@ export interface IEntityStorageConnector<T = unknown> extends IComponent {
|
|
12
12
|
/**
|
13
13
|
* Set an entity.
|
14
14
|
* @param entity The entity to set.
|
15
|
+
* @param conditions The optional conditions to match for the entities.
|
15
16
|
* @returns The id of the entity.
|
16
17
|
*/
|
17
|
-
set(entity: T
|
18
|
+
set(entity: T, conditions?: {
|
19
|
+
property: keyof T;
|
20
|
+
value: unknown;
|
21
|
+
}[]): Promise<void>;
|
18
22
|
/**
|
19
23
|
* Get an entity.
|
20
24
|
* @param id The id of the entity to get, or the index value if secondaryIndex is set.
|
21
25
|
* @param secondaryIndex Get the item using a secondary index.
|
26
|
+
* @param conditions The optional conditions to match for the entities.
|
22
27
|
* @returns The object if it can be found or undefined.
|
23
28
|
*/
|
24
|
-
get(id: string, secondaryIndex?: keyof T
|
29
|
+
get(id: string, secondaryIndex?: keyof T, conditions?: {
|
30
|
+
property: keyof T;
|
31
|
+
value: unknown;
|
32
|
+
}[]): Promise<T | undefined>;
|
25
33
|
/**
|
26
34
|
* Remove the entity.
|
27
35
|
* @param id The id of the entity to remove.
|
36
|
+
* @param conditions The optional conditions to match for the entities.
|
28
37
|
* @returns Nothing.
|
29
38
|
*/
|
30
|
-
remove(id: string
|
39
|
+
remove(id: string, conditions?: {
|
40
|
+
property: keyof T;
|
41
|
+
value: unknown;
|
42
|
+
}[]): Promise<void>;
|
31
43
|
/**
|
32
44
|
* Query all the entities which match the conditions.
|
33
45
|
* @param conditions The conditions to match for the entities.
|
package/docs/changelog.md
CHANGED
@@ -28,7 +28,7 @@ The schema for the entities.
|
|
28
28
|
|
29
29
|
### set()
|
30
30
|
|
31
|
-
> **set**(`entity`): `Promise`\<`void`\>
|
31
|
+
> **set**(`entity`, `conditions`?): `Promise`\<`void`\>
|
32
32
|
|
33
33
|
Set an entity.
|
34
34
|
|
@@ -38,6 +38,10 @@ Set an entity.
|
|
38
38
|
|
39
39
|
The entity to set.
|
40
40
|
|
41
|
+
• **conditions?**: `object`[]
|
42
|
+
|
43
|
+
The optional conditions to match for the entities.
|
44
|
+
|
41
45
|
#### Returns
|
42
46
|
|
43
47
|
`Promise`\<`void`\>
|
@@ -48,7 +52,7 @@ The id of the entity.
|
|
48
52
|
|
49
53
|
### get()
|
50
54
|
|
51
|
-
> **get**(`id`, `secondaryIndex`?): `Promise`\<`undefined` \| `T`\>
|
55
|
+
> **get**(`id`, `secondaryIndex`?, `conditions`?): `Promise`\<`undefined` \| `T`\>
|
52
56
|
|
53
57
|
Get an entity.
|
54
58
|
|
@@ -62,6 +66,10 @@ The id of the entity to get, or the index value if secondaryIndex is set.
|
|
62
66
|
|
63
67
|
Get the item using a secondary index.
|
64
68
|
|
69
|
+
• **conditions?**: `object`[]
|
70
|
+
|
71
|
+
The optional conditions to match for the entities.
|
72
|
+
|
65
73
|
#### Returns
|
66
74
|
|
67
75
|
`Promise`\<`undefined` \| `T`\>
|
@@ -72,7 +80,7 @@ The object if it can be found or undefined.
|
|
72
80
|
|
73
81
|
### remove()
|
74
82
|
|
75
|
-
> **remove**(`id`): `Promise`\<`void`\>
|
83
|
+
> **remove**(`id`, `conditions`?): `Promise`\<`void`\>
|
76
84
|
|
77
85
|
Remove the entity.
|
78
86
|
|
@@ -82,6 +90,10 @@ Remove the entity.
|
|
82
90
|
|
83
91
|
The id of the entity to remove.
|
84
92
|
|
93
|
+
• **conditions?**: `object`[]
|
94
|
+
|
95
|
+
The optional conditions to match for the entities.
|
96
|
+
|
85
97
|
#### Returns
|
86
98
|
|
87
99
|
`Promise`\<`void`\>
|
package/package.json
CHANGED