@twin.org/entity-storage-models 0.0.1-next.2 → 0.0.1-next.21
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/index.d.ts +7 -0
- package/dist/types/models/IEntityStorageComponent.d.ts +55 -0
- package/dist/types/models/IEntityStorageConnector.d.ts +25 -8
- package/dist/types/models/api/IEntityStorageGetRequest.d.ts +23 -0
- package/dist/types/models/api/IEntityStorageGetResponse.d.ts +9 -0
- package/dist/types/models/api/IEntityStorageListRequest.d.ts +35 -0
- package/dist/types/models/api/IEntityStorageListResponse.d.ts +18 -0
- package/dist/types/models/api/IEntityStorageRemoveRequest.d.ts +14 -0
- package/dist/types/models/api/IEntityStorageSetRequest.d.ts +9 -0
- package/docs/changelog.md +1 -1
- package/docs/reference/index.md +7 -0
- package/docs/reference/interfaces/IEntityStorageComponent.md +184 -0
- package/docs/reference/interfaces/IEntityStorageConnector.md +75 -37
- package/docs/reference/interfaces/IEntityStorageGetRequest.md +31 -0
- package/docs/reference/interfaces/IEntityStorageGetResponse.md +11 -0
- package/docs/reference/interfaces/IEntityStorageListRequest.md +47 -0
- package/docs/reference/interfaces/IEntityStorageListResponse.md +23 -0
- package/docs/reference/interfaces/IEntityStorageRemoveRequest.md +17 -0
- package/docs/reference/interfaces/IEntityStorageSetRequest.md +11 -0
- package/docs/reference/variables/EntityStorageConnectorFactory.md +1 -1
- package/package.json +4 -30
package/dist/types/index.d.ts
CHANGED
@@ -1,2 +1,9 @@
|
|
1
1
|
export * from "./factories/entityStorageConnectorFactory";
|
2
|
+
export * from "./models/api/IEntityStorageGetRequest";
|
3
|
+
export * from "./models/api/IEntityStorageGetResponse";
|
4
|
+
export * from "./models/api/IEntityStorageListRequest";
|
5
|
+
export * from "./models/api/IEntityStorageListResponse";
|
6
|
+
export * from "./models/api/IEntityStorageRemoveRequest";
|
7
|
+
export * from "./models/api/IEntityStorageSetRequest";
|
8
|
+
export * from "./models/IEntityStorageComponent";
|
2
9
|
export * from "./models/IEntityStorageConnector";
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import type { IComponent } from "@twin.org/core";
|
2
|
+
import type { EntityCondition, SortDirection } from "@twin.org/entity";
|
3
|
+
/**
|
4
|
+
* Interface describing an entity storage component.
|
5
|
+
*/
|
6
|
+
export interface IEntityStorageComponent<T = unknown> extends IComponent {
|
7
|
+
/**
|
8
|
+
* Set an entity.
|
9
|
+
* @param entity The entity to set.
|
10
|
+
* @param userIdentity The user identity to use with storage operations.
|
11
|
+
* @param nodeIdentity The node identity to use with storage operations.
|
12
|
+
* @returns The id of the entity.
|
13
|
+
*/
|
14
|
+
set(entity: T, userIdentity?: string, nodeIdentity?: string): Promise<void>;
|
15
|
+
/**
|
16
|
+
* Get an entity.
|
17
|
+
* @param id The id of the entity to get, or the index value if secondaryIndex is set.
|
18
|
+
* @param secondaryIndex Get the item using a secondary index.
|
19
|
+
* @param userIdentity The user identity to use with storage operations.
|
20
|
+
* @param nodeIdentity The node identity to use with storage operations.
|
21
|
+
* @returns The object if it can be found or undefined.
|
22
|
+
*/
|
23
|
+
get(id: string, secondaryIndex?: keyof T, userIdentity?: string, nodeIdentity?: string): Promise<T | undefined>;
|
24
|
+
/**
|
25
|
+
* Remove the entity.
|
26
|
+
* @param id The id of the entity to remove.
|
27
|
+
* @param userIdentity The user identity to use with storage operations.
|
28
|
+
* @param nodeIdentity The node identity to use with storage operations.
|
29
|
+
* @returns Nothing.
|
30
|
+
*/
|
31
|
+
remove(id: string, userIdentity?: string, nodeIdentity?: string): Promise<void>;
|
32
|
+
/**
|
33
|
+
* Query all the entities which match the conditions.
|
34
|
+
* @param conditions The conditions to match for the entities.
|
35
|
+
* @param orderBy The order for the results.
|
36
|
+
* @param orderByDirection The direction for the order, defaults to ascending.
|
37
|
+
* @param properties The optional properties to return, defaults to all.
|
38
|
+
* @param cursor The cursor to request the next page of entities.
|
39
|
+
* @param pageSize The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
40
|
+
* @param userIdentity The user identity to use with storage operations.
|
41
|
+
* @param nodeIdentity The node identity to use with storage operations.
|
42
|
+
* @returns All the entities for the storage matching the conditions,
|
43
|
+
* and a cursor which can be used to request more entities.
|
44
|
+
*/
|
45
|
+
query(conditions?: EntityCondition<T>, orderBy?: keyof T, orderByDirection?: SortDirection, properties?: (keyof T)[], cursor?: string, pageSize?: number, userIdentity?: string, nodeIdentity?: string): Promise<{
|
46
|
+
/**
|
47
|
+
* The entities, which can be partial if a limited keys list was provided.
|
48
|
+
*/
|
49
|
+
entities: Partial<T>[];
|
50
|
+
/**
|
51
|
+
* An optional cursor, when defined can be used to call find to get more entities.
|
52
|
+
*/
|
53
|
+
cursor?: string;
|
54
|
+
}>;
|
55
|
+
}
|
@@ -1,28 +1,45 @@
|
|
1
1
|
import type { IComponent } from "@twin.org/core";
|
2
|
-
import type { EntityCondition, SortDirection } from "@twin.org/entity";
|
2
|
+
import type { EntityCondition, IEntitySchema, SortDirection } from "@twin.org/entity";
|
3
3
|
/**
|
4
4
|
* Interface describing an entity storage connector.
|
5
5
|
*/
|
6
6
|
export interface IEntityStorageConnector<T = unknown> extends IComponent {
|
7
7
|
/**
|
8
|
-
* Get
|
9
|
-
* @
|
10
|
-
* @param secondaryIndex Get the item using a secondary index.
|
11
|
-
* @returns The object if it can be found or undefined.
|
8
|
+
* Get the schema for the entities.
|
9
|
+
* @returns The schema for the entities.
|
12
10
|
*/
|
13
|
-
|
11
|
+
getSchema(): IEntitySchema;
|
14
12
|
/**
|
15
13
|
* Set an entity.
|
16
14
|
* @param entity The entity to set.
|
15
|
+
* @param conditions The optional conditions to match for the entities.
|
17
16
|
* @returns The id of the entity.
|
18
17
|
*/
|
19
|
-
set(entity: T
|
18
|
+
set(entity: T, conditions?: {
|
19
|
+
property: keyof T;
|
20
|
+
value: unknown;
|
21
|
+
}[]): Promise<void>;
|
22
|
+
/**
|
23
|
+
* Get an entity.
|
24
|
+
* @param id The id of the entity to get, or the index value if secondaryIndex is set.
|
25
|
+
* @param secondaryIndex Get the item using a secondary index.
|
26
|
+
* @param conditions The optional conditions to match for the entities.
|
27
|
+
* @returns The object if it can be found or undefined.
|
28
|
+
*/
|
29
|
+
get(id: string, secondaryIndex?: keyof T, conditions?: {
|
30
|
+
property: keyof T;
|
31
|
+
value: unknown;
|
32
|
+
}[]): Promise<T | undefined>;
|
20
33
|
/**
|
21
34
|
* Remove the entity.
|
22
35
|
* @param id The id of the entity to remove.
|
36
|
+
* @param conditions The optional conditions to match for the entities.
|
23
37
|
* @returns Nothing.
|
24
38
|
*/
|
25
|
-
remove(id: string
|
39
|
+
remove(id: string, conditions?: {
|
40
|
+
property: keyof T;
|
41
|
+
value: unknown;
|
42
|
+
}[]): Promise<void>;
|
26
43
|
/**
|
27
44
|
* Query all the entities which match the conditions.
|
28
45
|
* @param conditions The conditions to match for the entities.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/**
|
2
|
+
* Get an entry from entity storage.
|
3
|
+
*/
|
4
|
+
export interface IEntityStorageGetRequest {
|
5
|
+
/**
|
6
|
+
* The parameters from the path.
|
7
|
+
*/
|
8
|
+
pathParams: {
|
9
|
+
/**
|
10
|
+
* The id of the entity to get.
|
11
|
+
*/
|
12
|
+
id: string;
|
13
|
+
};
|
14
|
+
/**
|
15
|
+
* The query parameters.
|
16
|
+
*/
|
17
|
+
query?: {
|
18
|
+
/**
|
19
|
+
* The secondary index to query with the id.
|
20
|
+
*/
|
21
|
+
secondaryIndex?: string;
|
22
|
+
};
|
23
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import type { SortDirection } from "@twin.org/entity";
|
2
|
+
/**
|
3
|
+
* Query the entries from entity storage.
|
4
|
+
*/
|
5
|
+
export interface IEntityStorageListRequest {
|
6
|
+
/**
|
7
|
+
* The parameters from the query.
|
8
|
+
*/
|
9
|
+
query?: {
|
10
|
+
/**
|
11
|
+
* The condition for the query as JSON version of EntityCondition type.
|
12
|
+
*/
|
13
|
+
conditions?: string;
|
14
|
+
/**
|
15
|
+
* The order property for the results.
|
16
|
+
*/
|
17
|
+
orderBy?: string;
|
18
|
+
/**
|
19
|
+
* The direction for the order, defaults to desc.
|
20
|
+
*/
|
21
|
+
orderByDirection?: SortDirection;
|
22
|
+
/**
|
23
|
+
* The properties to return in the response as a comma separated list, by default returns all properties.
|
24
|
+
*/
|
25
|
+
properties?: string;
|
26
|
+
/**
|
27
|
+
* The number of entries to return per page.
|
28
|
+
*/
|
29
|
+
pageSize?: number;
|
30
|
+
/**
|
31
|
+
* The cursor to get next chunk of data, returned in previous response.
|
32
|
+
*/
|
33
|
+
cursor?: string;
|
34
|
+
};
|
35
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/**
|
2
|
+
* Response to getting the list of entries from a query.
|
3
|
+
*/
|
4
|
+
export interface IEntityStorageListResponse {
|
5
|
+
/**
|
6
|
+
* The list of entries from the query.
|
7
|
+
*/
|
8
|
+
body: {
|
9
|
+
/**
|
10
|
+
* The entities from the query.
|
11
|
+
*/
|
12
|
+
entities: unknown[];
|
13
|
+
/**
|
14
|
+
* The cursor for the next page.
|
15
|
+
*/
|
16
|
+
cursor?: string;
|
17
|
+
};
|
18
|
+
}
|
package/docs/changelog.md
CHANGED
package/docs/reference/index.md
CHANGED
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
## Interfaces
|
4
4
|
|
5
|
+
- [IEntityStorageComponent](interfaces/IEntityStorageComponent.md)
|
5
6
|
- [IEntityStorageConnector](interfaces/IEntityStorageConnector.md)
|
7
|
+
- [IEntityStorageGetRequest](interfaces/IEntityStorageGetRequest.md)
|
8
|
+
- [IEntityStorageGetResponse](interfaces/IEntityStorageGetResponse.md)
|
9
|
+
- [IEntityStorageListRequest](interfaces/IEntityStorageListRequest.md)
|
10
|
+
- [IEntityStorageListResponse](interfaces/IEntityStorageListResponse.md)
|
11
|
+
- [IEntityStorageRemoveRequest](interfaces/IEntityStorageRemoveRequest.md)
|
12
|
+
- [IEntityStorageSetRequest](interfaces/IEntityStorageSetRequest.md)
|
6
13
|
|
7
14
|
## Variables
|
8
15
|
|
@@ -0,0 +1,184 @@
|
|
1
|
+
# Interface: IEntityStorageComponent\<T\>
|
2
|
+
|
3
|
+
Interface describing an entity storage component.
|
4
|
+
|
5
|
+
## Extends
|
6
|
+
|
7
|
+
- `IComponent`
|
8
|
+
|
9
|
+
## Type Parameters
|
10
|
+
|
11
|
+
• **T** = `unknown`
|
12
|
+
|
13
|
+
## Methods
|
14
|
+
|
15
|
+
### set()
|
16
|
+
|
17
|
+
> **set**(`entity`, `userIdentity`?, `nodeIdentity`?): `Promise`\<`void`\>
|
18
|
+
|
19
|
+
Set an entity.
|
20
|
+
|
21
|
+
#### Parameters
|
22
|
+
|
23
|
+
##### entity
|
24
|
+
|
25
|
+
`T`
|
26
|
+
|
27
|
+
The entity to set.
|
28
|
+
|
29
|
+
##### userIdentity?
|
30
|
+
|
31
|
+
`string`
|
32
|
+
|
33
|
+
The user identity to use with storage operations.
|
34
|
+
|
35
|
+
##### nodeIdentity?
|
36
|
+
|
37
|
+
`string`
|
38
|
+
|
39
|
+
The node identity to use with storage operations.
|
40
|
+
|
41
|
+
#### Returns
|
42
|
+
|
43
|
+
`Promise`\<`void`\>
|
44
|
+
|
45
|
+
The id of the entity.
|
46
|
+
|
47
|
+
***
|
48
|
+
|
49
|
+
### get()
|
50
|
+
|
51
|
+
> **get**(`id`, `secondaryIndex`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<`undefined` \| `T`\>
|
52
|
+
|
53
|
+
Get an entity.
|
54
|
+
|
55
|
+
#### Parameters
|
56
|
+
|
57
|
+
##### id
|
58
|
+
|
59
|
+
`string`
|
60
|
+
|
61
|
+
The id of the entity to get, or the index value if secondaryIndex is set.
|
62
|
+
|
63
|
+
##### secondaryIndex?
|
64
|
+
|
65
|
+
keyof `T`
|
66
|
+
|
67
|
+
Get the item using a secondary index.
|
68
|
+
|
69
|
+
##### userIdentity?
|
70
|
+
|
71
|
+
`string`
|
72
|
+
|
73
|
+
The user identity to use with storage operations.
|
74
|
+
|
75
|
+
##### nodeIdentity?
|
76
|
+
|
77
|
+
`string`
|
78
|
+
|
79
|
+
The node identity to use with storage operations.
|
80
|
+
|
81
|
+
#### Returns
|
82
|
+
|
83
|
+
`Promise`\<`undefined` \| `T`\>
|
84
|
+
|
85
|
+
The object if it can be found or undefined.
|
86
|
+
|
87
|
+
***
|
88
|
+
|
89
|
+
### remove()
|
90
|
+
|
91
|
+
> **remove**(`id`, `userIdentity`?, `nodeIdentity`?): `Promise`\<`void`\>
|
92
|
+
|
93
|
+
Remove the entity.
|
94
|
+
|
95
|
+
#### Parameters
|
96
|
+
|
97
|
+
##### id
|
98
|
+
|
99
|
+
`string`
|
100
|
+
|
101
|
+
The id of the entity to remove.
|
102
|
+
|
103
|
+
##### userIdentity?
|
104
|
+
|
105
|
+
`string`
|
106
|
+
|
107
|
+
The user identity to use with storage operations.
|
108
|
+
|
109
|
+
##### nodeIdentity?
|
110
|
+
|
111
|
+
`string`
|
112
|
+
|
113
|
+
The node identity to use with storage operations.
|
114
|
+
|
115
|
+
#### Returns
|
116
|
+
|
117
|
+
`Promise`\<`void`\>
|
118
|
+
|
119
|
+
Nothing.
|
120
|
+
|
121
|
+
***
|
122
|
+
|
123
|
+
### query()
|
124
|
+
|
125
|
+
> **query**(`conditions`?, `orderBy`?, `orderByDirection`?, `properties`?, `cursor`?, `pageSize`?, `userIdentity`?, `nodeIdentity`?): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor`: `string`; \}\>
|
126
|
+
|
127
|
+
Query all the entities which match the conditions.
|
128
|
+
|
129
|
+
#### Parameters
|
130
|
+
|
131
|
+
##### conditions?
|
132
|
+
|
133
|
+
`EntityCondition`\<`T`\>
|
134
|
+
|
135
|
+
The conditions to match for the entities.
|
136
|
+
|
137
|
+
##### orderBy?
|
138
|
+
|
139
|
+
keyof `T`
|
140
|
+
|
141
|
+
The order for the results.
|
142
|
+
|
143
|
+
##### orderByDirection?
|
144
|
+
|
145
|
+
`SortDirection`
|
146
|
+
|
147
|
+
The direction for the order, defaults to ascending.
|
148
|
+
|
149
|
+
##### properties?
|
150
|
+
|
151
|
+
keyof `T`[]
|
152
|
+
|
153
|
+
The optional properties to return, defaults to all.
|
154
|
+
|
155
|
+
##### cursor?
|
156
|
+
|
157
|
+
`string`
|
158
|
+
|
159
|
+
The cursor to request the next page of entities.
|
160
|
+
|
161
|
+
##### pageSize?
|
162
|
+
|
163
|
+
`number`
|
164
|
+
|
165
|
+
The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
166
|
+
|
167
|
+
##### userIdentity?
|
168
|
+
|
169
|
+
`string`
|
170
|
+
|
171
|
+
The user identity to use with storage operations.
|
172
|
+
|
173
|
+
##### nodeIdentity?
|
174
|
+
|
175
|
+
`string`
|
176
|
+
|
177
|
+
The node identity to use with storage operations.
|
178
|
+
|
179
|
+
#### Returns
|
180
|
+
|
181
|
+
`Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor`: `string`; \}\>
|
182
|
+
|
183
|
+
All the entities for the storage matching the conditions,
|
184
|
+
and a cursor which can be used to request more entities.
|
@@ -12,62 +12,102 @@ Interface describing an entity storage connector.
|
|
12
12
|
|
13
13
|
## Methods
|
14
14
|
|
15
|
-
###
|
15
|
+
### getSchema()
|
16
16
|
|
17
|
-
> **
|
17
|
+
> **getSchema**(): `IEntitySchema`
|
18
18
|
|
19
|
-
Get
|
19
|
+
Get the schema for the entities.
|
20
|
+
|
21
|
+
#### Returns
|
22
|
+
|
23
|
+
`IEntitySchema`
|
24
|
+
|
25
|
+
The schema for the entities.
|
26
|
+
|
27
|
+
***
|
28
|
+
|
29
|
+
### set()
|
30
|
+
|
31
|
+
> **set**(`entity`, `conditions`?): `Promise`\<`void`\>
|
32
|
+
|
33
|
+
Set an entity.
|
20
34
|
|
21
35
|
#### Parameters
|
22
36
|
|
23
|
-
|
37
|
+
##### entity
|
24
38
|
|
25
|
-
|
39
|
+
`T`
|
26
40
|
|
27
|
-
|
41
|
+
The entity to set.
|
28
42
|
|
29
|
-
|
43
|
+
##### conditions?
|
44
|
+
|
45
|
+
`object`[]
|
46
|
+
|
47
|
+
The optional conditions to match for the entities.
|
30
48
|
|
31
49
|
#### Returns
|
32
50
|
|
33
|
-
`Promise`\<`
|
51
|
+
`Promise`\<`void`\>
|
34
52
|
|
35
|
-
The
|
53
|
+
The id of the entity.
|
36
54
|
|
37
55
|
***
|
38
56
|
|
39
|
-
###
|
57
|
+
### get()
|
40
58
|
|
41
|
-
> **
|
59
|
+
> **get**(`id`, `secondaryIndex`?, `conditions`?): `Promise`\<`undefined` \| `T`\>
|
42
60
|
|
43
|
-
|
61
|
+
Get an entity.
|
44
62
|
|
45
63
|
#### Parameters
|
46
64
|
|
47
|
-
|
65
|
+
##### id
|
48
66
|
|
49
|
-
|
67
|
+
`string`
|
68
|
+
|
69
|
+
The id of the entity to get, or the index value if secondaryIndex is set.
|
70
|
+
|
71
|
+
##### secondaryIndex?
|
72
|
+
|
73
|
+
keyof `T`
|
74
|
+
|
75
|
+
Get the item using a secondary index.
|
76
|
+
|
77
|
+
##### conditions?
|
78
|
+
|
79
|
+
`object`[]
|
80
|
+
|
81
|
+
The optional conditions to match for the entities.
|
50
82
|
|
51
83
|
#### Returns
|
52
84
|
|
53
|
-
`Promise`\<`
|
85
|
+
`Promise`\<`undefined` \| `T`\>
|
54
86
|
|
55
|
-
The
|
87
|
+
The object if it can be found or undefined.
|
56
88
|
|
57
89
|
***
|
58
90
|
|
59
91
|
### remove()
|
60
92
|
|
61
|
-
> **remove**(`id`): `Promise`\<`void`\>
|
93
|
+
> **remove**(`id`, `conditions`?): `Promise`\<`void`\>
|
62
94
|
|
63
95
|
Remove the entity.
|
64
96
|
|
65
97
|
#### Parameters
|
66
98
|
|
67
|
-
|
99
|
+
##### id
|
100
|
+
|
101
|
+
`string`
|
68
102
|
|
69
103
|
The id of the entity to remove.
|
70
104
|
|
105
|
+
##### conditions?
|
106
|
+
|
107
|
+
`object`[]
|
108
|
+
|
109
|
+
The optional conditions to match for the entities.
|
110
|
+
|
71
111
|
#### Returns
|
72
112
|
|
73
113
|
`Promise`\<`void`\>
|
@@ -78,47 +118,45 @@ Nothing.
|
|
78
118
|
|
79
119
|
### query()
|
80
120
|
|
81
|
-
> **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<`
|
121
|
+
> **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor`: `string`; \}\>
|
82
122
|
|
83
123
|
Query all the entities which match the conditions.
|
84
124
|
|
85
125
|
#### Parameters
|
86
126
|
|
87
|
-
|
127
|
+
##### conditions?
|
128
|
+
|
129
|
+
`EntityCondition`\<`T`\>
|
88
130
|
|
89
131
|
The conditions to match for the entities.
|
90
132
|
|
91
|
-
|
133
|
+
##### sortProperties?
|
134
|
+
|
135
|
+
`object`[]
|
92
136
|
|
93
137
|
The optional sort order.
|
94
138
|
|
95
|
-
|
139
|
+
##### properties?
|
140
|
+
|
141
|
+
keyof `T`[]
|
96
142
|
|
97
143
|
The optional properties to return, defaults to all.
|
98
144
|
|
99
|
-
|
145
|
+
##### cursor?
|
146
|
+
|
147
|
+
`string`
|
100
148
|
|
101
149
|
The cursor to request the next page of entities.
|
102
150
|
|
103
|
-
|
151
|
+
##### pageSize?
|
152
|
+
|
153
|
+
`number`
|
104
154
|
|
105
155
|
The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
106
156
|
|
107
157
|
#### Returns
|
108
158
|
|
109
|
-
`Promise`\<`
|
159
|
+
`Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor`: `string`; \}\>
|
110
160
|
|
111
161
|
All the entities for the storage matching the conditions,
|
112
162
|
and a cursor which can be used to request more entities.
|
113
|
-
|
114
|
-
##### entities
|
115
|
-
|
116
|
-
> **entities**: `Partial`\<`T`\>[]
|
117
|
-
|
118
|
-
The entities, which can be partial if a limited keys list was provided.
|
119
|
-
|
120
|
-
##### cursor?
|
121
|
-
|
122
|
-
> `optional` **cursor**: `string`
|
123
|
-
|
124
|
-
An optional cursor, when defined can be used to call find to get more entities.
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Interface: IEntityStorageGetRequest
|
2
|
+
|
3
|
+
Get an entry from entity storage.
|
4
|
+
|
5
|
+
## Properties
|
6
|
+
|
7
|
+
### pathParams
|
8
|
+
|
9
|
+
> **pathParams**: `object`
|
10
|
+
|
11
|
+
The parameters from the path.
|
12
|
+
|
13
|
+
#### id
|
14
|
+
|
15
|
+
> **id**: `string`
|
16
|
+
|
17
|
+
The id of the entity to get.
|
18
|
+
|
19
|
+
***
|
20
|
+
|
21
|
+
### query?
|
22
|
+
|
23
|
+
> `optional` **query**: `object`
|
24
|
+
|
25
|
+
The query parameters.
|
26
|
+
|
27
|
+
#### secondaryIndex?
|
28
|
+
|
29
|
+
> `optional` **secondaryIndex**: `string`
|
30
|
+
|
31
|
+
The secondary index to query with the id.
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Interface: IEntityStorageListRequest
|
2
|
+
|
3
|
+
Query the entries from entity storage.
|
4
|
+
|
5
|
+
## Properties
|
6
|
+
|
7
|
+
### query?
|
8
|
+
|
9
|
+
> `optional` **query**: `object`
|
10
|
+
|
11
|
+
The parameters from the query.
|
12
|
+
|
13
|
+
#### conditions?
|
14
|
+
|
15
|
+
> `optional` **conditions**: `string`
|
16
|
+
|
17
|
+
The condition for the query as JSON version of EntityCondition type.
|
18
|
+
|
19
|
+
#### orderBy?
|
20
|
+
|
21
|
+
> `optional` **orderBy**: `string`
|
22
|
+
|
23
|
+
The order property for the results.
|
24
|
+
|
25
|
+
#### orderByDirection?
|
26
|
+
|
27
|
+
> `optional` **orderByDirection**: `SortDirection`
|
28
|
+
|
29
|
+
The direction for the order, defaults to desc.
|
30
|
+
|
31
|
+
#### properties?
|
32
|
+
|
33
|
+
> `optional` **properties**: `string`
|
34
|
+
|
35
|
+
The properties to return in the response as a comma separated list, by default returns all properties.
|
36
|
+
|
37
|
+
#### pageSize?
|
38
|
+
|
39
|
+
> `optional` **pageSize**: `number`
|
40
|
+
|
41
|
+
The number of entries to return per page.
|
42
|
+
|
43
|
+
#### cursor?
|
44
|
+
|
45
|
+
> `optional` **cursor**: `string`
|
46
|
+
|
47
|
+
The cursor to get next chunk of data, returned in previous response.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Interface: IEntityStorageListResponse
|
2
|
+
|
3
|
+
Response to getting the list of entries from a query.
|
4
|
+
|
5
|
+
## Properties
|
6
|
+
|
7
|
+
### body
|
8
|
+
|
9
|
+
> **body**: `object`
|
10
|
+
|
11
|
+
The list of entries from the query.
|
12
|
+
|
13
|
+
#### entities
|
14
|
+
|
15
|
+
> **entities**: `unknown`[]
|
16
|
+
|
17
|
+
The entities from the query.
|
18
|
+
|
19
|
+
#### cursor?
|
20
|
+
|
21
|
+
> `optional` **cursor**: `string`
|
22
|
+
|
23
|
+
The cursor for the next page.
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Interface: IEntityStorageRemoveRequest
|
2
|
+
|
3
|
+
Remove an entry from entity storage.
|
4
|
+
|
5
|
+
## Properties
|
6
|
+
|
7
|
+
### pathParams
|
8
|
+
|
9
|
+
> **pathParams**: `object`
|
10
|
+
|
11
|
+
The parameters from the path.
|
12
|
+
|
13
|
+
#### id
|
14
|
+
|
15
|
+
> **id**: `string`
|
16
|
+
|
17
|
+
The id of the entity to remove.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Variable: EntityStorageConnectorFactory
|
2
2
|
|
3
|
-
> `const` **EntityStorageConnectorFactory**: `Factory`\<[`IEntityStorageConnector`](../interfaces/IEntityStorageConnector.md)
|
3
|
+
> `const` **EntityStorageConnectorFactory**: `Factory`\<[`IEntityStorageConnector`](../interfaces/IEntityStorageConnector.md)\>
|
4
4
|
|
5
5
|
Factory for creating entity storage connectors.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@twin.org/entity-storage-models",
|
3
|
-
"version": "0.0.1-next.
|
3
|
+
"version": "0.0.1-next.21",
|
4
4
|
"description": "Models which define the structure of the entity storage contracts and connectors",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -13,47 +13,21 @@
|
|
13
13
|
"engines": {
|
14
14
|
"node": ">=20.0.0"
|
15
15
|
},
|
16
|
-
"scripts": {
|
17
|
-
"clean": "rimraf dist coverage docs/reference",
|
18
|
-
"build": "tspc",
|
19
|
-
"test": "vitest --run --config ./vitest.config.ts --no-cache",
|
20
|
-
"coverage": "vitest --run --coverage --config ./vitest.config.ts --no-cache",
|
21
|
-
"bundle:esm": "rollup --config rollup.config.mjs --environment MODULE:esm",
|
22
|
-
"bundle:cjs": "rollup --config rollup.config.mjs --environment MODULE:cjs",
|
23
|
-
"bundle": "npm run bundle:esm && npm run bundle:cjs",
|
24
|
-
"docs:clean": "rimraf docs/reference",
|
25
|
-
"docs:generate": "typedoc",
|
26
|
-
"docs": "npm run docs:clean && npm run docs:generate",
|
27
|
-
"dist": "npm run clean && npm run build && npm run test && npm run bundle && npm run docs"
|
28
|
-
},
|
29
16
|
"dependencies": {
|
30
17
|
"@twin.org/core": "next",
|
31
18
|
"@twin.org/entity": "next",
|
32
19
|
"@twin.org/nameof": "next"
|
33
20
|
},
|
34
|
-
"devDependencies": {
|
35
|
-
"@twin.org/nameof-transformer": "next",
|
36
|
-
"@vitest/coverage-v8": "2.1.1",
|
37
|
-
"copyfiles": "2.4.1",
|
38
|
-
"rimraf": "6.0.1",
|
39
|
-
"rollup": "4.21.3",
|
40
|
-
"rollup-plugin-typescript2": "0.36.0",
|
41
|
-
"ts-patch": "3.2.1",
|
42
|
-
"typedoc": "0.26.7",
|
43
|
-
"typedoc-plugin-markdown": "4.2.7",
|
44
|
-
"typescript": "5.6.2",
|
45
|
-
"vitest": "2.1.1"
|
46
|
-
},
|
47
21
|
"main": "./dist/cjs/index.cjs",
|
48
22
|
"module": "./dist/esm/index.mjs",
|
49
23
|
"types": "./dist/types/index.d.ts",
|
50
24
|
"exports": {
|
51
25
|
".": {
|
26
|
+
"types": "./dist/types/index.d.ts",
|
52
27
|
"require": "./dist/cjs/index.cjs",
|
53
|
-
"import": "./dist/esm/index.mjs"
|
54
|
-
"types": "./dist/types/index.d.ts"
|
28
|
+
"import": "./dist/esm/index.mjs"
|
55
29
|
},
|
56
|
-
"./locales": "./locales"
|
30
|
+
"./locales/*.json": "./locales/*.json"
|
57
31
|
},
|
58
32
|
"files": [
|
59
33
|
"dist/cjs",
|