@twin.org/entity-storage-models 0.0.1-next.7 → 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): Promise<void>;
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): Promise<T | undefined>;
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): Promise<void>;
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.
@@ -11,7 +11,7 @@ export interface IEntityStorageListRequest {
11
11
  */
12
12
  conditions?: string;
13
13
  /**
14
- * The sort property array as JSON serialization of {property,direction}[].
14
+ * The sort property array as JSON serialization of property,direction.
15
15
  */
16
16
  sortProperties?: string;
17
17
  /**
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/entity-storage-models - Changelog
2
2
 
3
- ## v0.0.1-next.7
3
+ ## v0.0.1-next.9
4
4
 
5
5
  - Initial Release
@@ -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`\>
@@ -20,7 +20,7 @@ The condition for the query as JSON version of EntityCondition type.
20
20
 
21
21
  > `optional` **sortProperties**: `string`
22
22
 
23
- The sort property array as JSON serialization of {property,direction}[].
23
+ The sort property array as JSON serialization of property,direction.
24
24
 
25
25
  #### properties?
26
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/entity-storage-models",
3
- "version": "0.0.1-next.7",
3
+ "version": "0.0.1-next.9",
4
4
  "description": "Models which define the structure of the entity storage contracts and connectors",
5
5
  "repository": {
6
6
  "type": "git",