@twin.org/entity-storage-service 0.0.1-next.9 → 0.0.2-next.1
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/cjs/index.cjs +7 -12
- package/dist/esm/index.mjs +8 -13
- package/dist/types/entityStorageService.d.ts +6 -13
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/IEntityStorageServiceConstructorOptions.d.ts +14 -0
- package/docs/changelog.md +128 -1
- package/docs/open-api/spec.json +641 -608
- package/docs/reference/classes/EntityStorageService.md +72 -48
- package/docs/reference/functions/entityStorageGet.md +9 -3
- package/docs/reference/functions/entityStorageList.md +9 -3
- package/docs/reference/functions/entityStorageRemove.md +9 -3
- package/docs/reference/functions/entityStorageSet.md +9 -3
- package/docs/reference/functions/generateRestRoutesEntityStorage.md +18 -8
- package/docs/reference/index.md +1 -0
- package/docs/reference/interfaces/IEntityStorageServiceConstructorOptions.md +19 -0
- package/package.json +5 -5
@@ -4,7 +4,9 @@ Class for performing entity service operations.
|
|
4
4
|
|
5
5
|
## Type Parameters
|
6
6
|
|
7
|
-
|
7
|
+
### T
|
8
|
+
|
9
|
+
`T` = `any`
|
8
10
|
|
9
11
|
## Implements
|
10
12
|
|
@@ -12,29 +14,23 @@ Class for performing entity service operations.
|
|
12
14
|
|
13
15
|
## Constructors
|
14
16
|
|
15
|
-
###
|
17
|
+
### Constructor
|
16
18
|
|
17
|
-
> **new EntityStorageService**\<`T`\>(`options`):
|
19
|
+
> **new EntityStorageService**\<`T`\>(`options`): `EntityStorageService`\<`T`\>
|
18
20
|
|
19
21
|
Create a new instance of EntityStorageService.
|
20
22
|
|
21
23
|
#### Parameters
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
The dependencies for the entity storage service.
|
26
|
-
|
27
|
-
• **options.entityStorageType**: `string`
|
28
|
-
|
29
|
-
The entity storage type.
|
25
|
+
##### options
|
30
26
|
|
31
|
-
|
27
|
+
[`IEntityStorageServiceConstructorOptions`](../interfaces/IEntityStorageServiceConstructorOptions.md)
|
32
28
|
|
33
|
-
The
|
29
|
+
The dependencies for the entity storage service.
|
34
30
|
|
35
31
|
#### Returns
|
36
32
|
|
37
|
-
|
33
|
+
`EntityStorageService`\<`T`\>
|
38
34
|
|
39
35
|
## Properties
|
40
36
|
|
@@ -52,21 +48,27 @@ Runtime name for the class.
|
|
52
48
|
|
53
49
|
### set()
|
54
50
|
|
55
|
-
> **set**(`entity`, `userIdentity
|
51
|
+
> **set**(`entity`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
|
56
52
|
|
57
53
|
Set an entity.
|
58
54
|
|
59
55
|
#### Parameters
|
60
56
|
|
61
|
-
|
57
|
+
##### entity
|
58
|
+
|
59
|
+
`T`
|
62
60
|
|
63
61
|
The entity to set.
|
64
62
|
|
65
|
-
|
63
|
+
##### userIdentity?
|
64
|
+
|
65
|
+
`string`
|
66
66
|
|
67
67
|
The user identity to use with storage operations.
|
68
68
|
|
69
|
-
|
69
|
+
##### nodeIdentity?
|
70
|
+
|
71
|
+
`string`
|
70
72
|
|
71
73
|
The node identity to use with storage operations.
|
72
74
|
|
@@ -84,25 +86,33 @@ The id of the entity.
|
|
84
86
|
|
85
87
|
### get()
|
86
88
|
|
87
|
-
> **get**(`id`, `secondaryIndex
|
89
|
+
> **get**(`id`, `secondaryIndex?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`undefined` \| `T`\>
|
88
90
|
|
89
91
|
Get an entity.
|
90
92
|
|
91
93
|
#### Parameters
|
92
94
|
|
93
|
-
|
95
|
+
##### id
|
96
|
+
|
97
|
+
`string`
|
94
98
|
|
95
99
|
The id of the entity to get, or the index value if secondaryIndex is set.
|
96
100
|
|
97
|
-
|
101
|
+
##### secondaryIndex?
|
102
|
+
|
103
|
+
keyof `T`
|
98
104
|
|
99
105
|
Get the item using a secondary index.
|
100
106
|
|
101
|
-
|
107
|
+
##### userIdentity?
|
108
|
+
|
109
|
+
`string`
|
102
110
|
|
103
111
|
The user identity to use with storage operations.
|
104
112
|
|
105
|
-
|
113
|
+
##### nodeIdentity?
|
114
|
+
|
115
|
+
`string`
|
106
116
|
|
107
117
|
The node identity to use with storage operations.
|
108
118
|
|
@@ -120,21 +130,27 @@ The object if it can be found or undefined.
|
|
120
130
|
|
121
131
|
### remove()
|
122
132
|
|
123
|
-
> **remove**(`id`, `userIdentity
|
133
|
+
> **remove**(`id`, `userIdentity?`, `nodeIdentity?`): `Promise`\<`void`\>
|
124
134
|
|
125
135
|
Remove the entity.
|
126
136
|
|
127
137
|
#### Parameters
|
128
138
|
|
129
|
-
|
139
|
+
##### id
|
140
|
+
|
141
|
+
`string`
|
130
142
|
|
131
143
|
The id of the entity to remove.
|
132
144
|
|
133
|
-
|
145
|
+
##### userIdentity?
|
146
|
+
|
147
|
+
`string`
|
134
148
|
|
135
149
|
The user identity to use with storage operations.
|
136
150
|
|
137
|
-
|
151
|
+
##### nodeIdentity?
|
152
|
+
|
153
|
+
`string`
|
138
154
|
|
139
155
|
The node identity to use with storage operations.
|
140
156
|
|
@@ -152,59 +168,67 @@ Nothing.
|
|
152
168
|
|
153
169
|
### query()
|
154
170
|
|
155
|
-
> **query**(`conditions
|
171
|
+
> **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `pageSize?`, `userIdentity?`, `nodeIdentity?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
156
172
|
|
157
173
|
Query all the entities which match the conditions.
|
158
174
|
|
159
175
|
#### Parameters
|
160
176
|
|
161
|
-
|
177
|
+
##### conditions?
|
178
|
+
|
179
|
+
`EntityCondition`\<`T`\>
|
162
180
|
|
163
181
|
The conditions to match for the entities.
|
164
182
|
|
165
|
-
|
183
|
+
##### orderBy?
|
166
184
|
|
167
|
-
|
185
|
+
keyof `T`
|
168
186
|
|
169
|
-
|
187
|
+
The order for the results.
|
188
|
+
|
189
|
+
##### orderByDirection?
|
190
|
+
|
191
|
+
`SortDirection`
|
192
|
+
|
193
|
+
The direction for the order, defaults to ascending.
|
194
|
+
|
195
|
+
##### properties?
|
196
|
+
|
197
|
+
keyof `T`[]
|
170
198
|
|
171
199
|
The optional properties to return, defaults to all.
|
172
200
|
|
173
|
-
|
201
|
+
##### cursor?
|
202
|
+
|
203
|
+
`string`
|
174
204
|
|
175
205
|
The cursor to request the next page of entities.
|
176
206
|
|
177
|
-
|
207
|
+
##### pageSize?
|
208
|
+
|
209
|
+
`number`
|
178
210
|
|
179
211
|
The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
180
212
|
|
181
|
-
|
213
|
+
##### userIdentity?
|
214
|
+
|
215
|
+
`string`
|
182
216
|
|
183
217
|
The user identity to use with storage operations.
|
184
218
|
|
185
|
-
|
219
|
+
##### nodeIdentity?
|
220
|
+
|
221
|
+
`string`
|
186
222
|
|
187
223
|
The node identity to use with storage operations.
|
188
224
|
|
189
225
|
#### Returns
|
190
226
|
|
191
|
-
`Promise`\<`
|
227
|
+
`Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
192
228
|
|
193
229
|
All the entities for the storage matching the conditions,
|
194
230
|
and a cursor which can be used to request more entities.
|
195
231
|
|
196
|
-
##### entities
|
197
|
-
|
198
|
-
> **entities**: `Partial`\<`T`\>[]
|
199
|
-
|
200
|
-
The entities, which can be partial if a limited keys list was provided.
|
201
|
-
|
202
|
-
##### cursor?
|
203
|
-
|
204
|
-
> `optional` **cursor**: `string`
|
205
|
-
|
206
|
-
An optional cursor, when defined can be used to call find to get more entities.
|
207
|
-
|
208
232
|
#### Implementation of
|
209
233
|
|
210
234
|
`IEntityStorageComponent.query`
|
@@ -6,15 +6,21 @@ Get the entry from entity storage.
|
|
6
6
|
|
7
7
|
## Parameters
|
8
8
|
|
9
|
-
|
9
|
+
### httpRequestContext
|
10
|
+
|
11
|
+
`IHttpRequestContext`
|
10
12
|
|
11
13
|
The request context for the API.
|
12
14
|
|
13
|
-
|
15
|
+
### componentName
|
16
|
+
|
17
|
+
`string`
|
14
18
|
|
15
19
|
The name of the component to use in the routes.
|
16
20
|
|
17
|
-
|
21
|
+
### request
|
22
|
+
|
23
|
+
`IEntityStorageGetRequest`
|
18
24
|
|
19
25
|
The request.
|
20
26
|
|
@@ -6,15 +6,21 @@ Query the entries from entity storage.
|
|
6
6
|
|
7
7
|
## Parameters
|
8
8
|
|
9
|
-
|
9
|
+
### httpRequestContext
|
10
|
+
|
11
|
+
`IHttpRequestContext`
|
10
12
|
|
11
13
|
The request context for the API.
|
12
14
|
|
13
|
-
|
15
|
+
### componentName
|
16
|
+
|
17
|
+
`string`
|
14
18
|
|
15
19
|
The name of the component to use in the routes.
|
16
20
|
|
17
|
-
|
21
|
+
### request
|
22
|
+
|
23
|
+
`IEntityStorageListRequest`
|
18
24
|
|
19
25
|
The request.
|
20
26
|
|
@@ -6,15 +6,21 @@ Remove the entry from entity storage.
|
|
6
6
|
|
7
7
|
## Parameters
|
8
8
|
|
9
|
-
|
9
|
+
### httpRequestContext
|
10
|
+
|
11
|
+
`IHttpRequestContext`
|
10
12
|
|
11
13
|
The request context for the API.
|
12
14
|
|
13
|
-
|
15
|
+
### componentName
|
16
|
+
|
17
|
+
`string`
|
14
18
|
|
15
19
|
The name of the component to use in the routes.
|
16
20
|
|
17
|
-
|
21
|
+
### request
|
22
|
+
|
23
|
+
`IEntityStorageRemoveRequest`
|
18
24
|
|
19
25
|
The request.
|
20
26
|
|
@@ -6,15 +6,21 @@ Set the entry in entity storage.
|
|
6
6
|
|
7
7
|
## Parameters
|
8
8
|
|
9
|
-
|
9
|
+
### httpRequestContext
|
10
|
+
|
11
|
+
`IHttpRequestContext`
|
10
12
|
|
11
13
|
The request context for the API.
|
12
14
|
|
13
|
-
|
15
|
+
### componentName
|
16
|
+
|
17
|
+
`string`
|
14
18
|
|
15
19
|
The name of the component to use in the routes.
|
16
20
|
|
17
|
-
|
21
|
+
### request
|
22
|
+
|
23
|
+
`IEntityStorageSetRequest`
|
18
24
|
|
19
25
|
The request.
|
20
26
|
|
@@ -1,37 +1,47 @@
|
|
1
1
|
# Function: generateRestRoutesEntityStorage()
|
2
2
|
|
3
|
-
> **generateRestRoutesEntityStorage**(`baseRouteName`, `componentName`, `options
|
3
|
+
> **generateRestRoutesEntityStorage**(`baseRouteName`, `componentName`, `options?`): `IRestRoute`\<`any`, `any`\>[]
|
4
4
|
|
5
5
|
The REST routes for entity storage.
|
6
6
|
|
7
7
|
## Parameters
|
8
8
|
|
9
|
-
|
9
|
+
### baseRouteName
|
10
|
+
|
11
|
+
`string`
|
10
12
|
|
11
13
|
Prefix to prepend to the paths.
|
12
14
|
|
13
|
-
|
15
|
+
### componentName
|
16
|
+
|
17
|
+
`string`
|
14
18
|
|
15
19
|
The name of the component to use in the routes stored in the ComponentFactory.
|
16
20
|
|
17
|
-
|
21
|
+
### options?
|
18
22
|
|
19
23
|
Additional options for the routes.
|
20
24
|
|
21
|
-
|
25
|
+
#### typeName?
|
26
|
+
|
27
|
+
`string`
|
22
28
|
|
23
29
|
Optional type name to use in the routes, defaults to Entity Storage.
|
24
30
|
|
25
|
-
|
31
|
+
#### tagName?
|
32
|
+
|
33
|
+
`string`
|
26
34
|
|
27
35
|
Optional name to use in OpenAPI spec for tag.
|
28
36
|
|
29
|
-
|
37
|
+
#### examples?
|
38
|
+
|
39
|
+
[`IEntityStorageRoutesExamples`](../interfaces/IEntityStorageRoutesExamples.md)
|
30
40
|
|
31
41
|
Optional examples to use in the routes.
|
32
42
|
|
33
43
|
## Returns
|
34
44
|
|
35
|
-
`IRestRoute`[]
|
45
|
+
`IRestRoute`\<`any`, `any`\>[]
|
36
46
|
|
37
47
|
The generated routes.
|
package/docs/reference/index.md
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
|
9
9
|
- [IEntityStorageConfig](interfaces/IEntityStorageConfig.md)
|
10
10
|
- [IEntityStorageRoutesExamples](interfaces/IEntityStorageRoutesExamples.md)
|
11
|
+
- [IEntityStorageServiceConstructorOptions](interfaces/IEntityStorageServiceConstructorOptions.md)
|
11
12
|
|
12
13
|
## Variables
|
13
14
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Interface: IEntityStorageServiceConstructorOptions
|
2
|
+
|
3
|
+
Options for the Entity Storage Service constructor.
|
4
|
+
|
5
|
+
## Properties
|
6
|
+
|
7
|
+
### entityStorageType
|
8
|
+
|
9
|
+
> **entityStorageType**: `string`
|
10
|
+
|
11
|
+
The type of the entity storage.
|
12
|
+
|
13
|
+
***
|
14
|
+
|
15
|
+
### config?
|
16
|
+
|
17
|
+
> `optional` **config**: [`IEntityStorageConfig`](IEntityStorageConfig.md)
|
18
|
+
|
19
|
+
The configuration for the service.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@twin.org/entity-storage-service",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.2-next.1",
|
4
4
|
"description": "Entity Storage contract implementation and REST endpoint definitions",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -17,7 +17,7 @@
|
|
17
17
|
"@twin.org/api-models": "next",
|
18
18
|
"@twin.org/core": "next",
|
19
19
|
"@twin.org/entity": "next",
|
20
|
-
"@twin.org/entity-storage-models": "0.0.
|
20
|
+
"@twin.org/entity-storage-models": "0.0.2-next.1",
|
21
21
|
"@twin.org/nameof": "next",
|
22
22
|
"@twin.org/web": "next"
|
23
23
|
},
|
@@ -26,11 +26,11 @@
|
|
26
26
|
"types": "./dist/types/index.d.ts",
|
27
27
|
"exports": {
|
28
28
|
".": {
|
29
|
+
"types": "./dist/types/index.d.ts",
|
29
30
|
"require": "./dist/cjs/index.cjs",
|
30
|
-
"import": "./dist/esm/index.mjs"
|
31
|
-
"types": "./dist/types/index.d.ts"
|
31
|
+
"import": "./dist/esm/index.mjs"
|
32
32
|
},
|
33
|
-
"./locales": "./locales"
|
33
|
+
"./locales/*.json": "./locales/*.json"
|
34
34
|
},
|
35
35
|
"files": [
|
36
36
|
"dist/cjs",
|