@twin.org/entity-storage-service 0.0.3-next.2 → 0.0.3-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/README.md +2 -2
- package/dist/es/entityStorageRoutes.js +176 -4
- package/dist/es/entityStorageRoutes.js.map +1 -1
- package/dist/es/entityStorageService.js +44 -49
- package/dist/es/entityStorageService.js.map +1 -1
- package/dist/es/models/IEntityStorageRoutesExamples.js.map +1 -1
- package/dist/types/entityStorageRoutes.d.ts +33 -1
- package/dist/types/entityStorageService.d.ts +38 -3
- package/dist/types/models/IEntityStorageRoutesExamples.d.ts +8 -1
- package/docs/changelog.md +401 -46
- package/docs/examples.md +77 -1
- package/docs/open-api/spec.json +447 -37
- package/docs/reference/classes/EntityStorageService.md +123 -9
- package/docs/reference/functions/entityStorageCount.md +31 -0
- package/docs/reference/functions/entityStorageEmpty.md +31 -0
- package/docs/reference/functions/entityStorageRemoveBatch.md +31 -0
- package/docs/reference/functions/entityStorageSetBatch.md +31 -0
- package/docs/reference/index.md +4 -0
- package/docs/reference/interfaces/IEntityStorageRoutesExamples.md +24 -8
- package/docs/reference/interfaces/IEntityStorageServiceConstructorOptions.md +3 -3
- package/locales/en.json +1 -7
- package/package.json +5 -5
|
@@ -34,7 +34,7 @@ The dependencies for the entity storage service.
|
|
|
34
34
|
|
|
35
35
|
## Properties
|
|
36
36
|
|
|
37
|
-
### CLASS\_NAME
|
|
37
|
+
### CLASS\_NAME {#class_name}
|
|
38
38
|
|
|
39
39
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
40
40
|
|
|
@@ -42,7 +42,7 @@ Runtime name for the class.
|
|
|
42
42
|
|
|
43
43
|
## Methods
|
|
44
44
|
|
|
45
|
-
### className()
|
|
45
|
+
### className() {#classname}
|
|
46
46
|
|
|
47
47
|
> **className**(): `string`
|
|
48
48
|
|
|
@@ -60,9 +60,9 @@ The class name of the component.
|
|
|
60
60
|
|
|
61
61
|
***
|
|
62
62
|
|
|
63
|
-
### set()
|
|
63
|
+
### set() {#set}
|
|
64
64
|
|
|
65
|
-
> **set**(`entity`): `Promise`\<`void`\>
|
|
65
|
+
> **set**(`entity`, `conditions?`): `Promise`\<`void`\>
|
|
66
66
|
|
|
67
67
|
Set an entity.
|
|
68
68
|
|
|
@@ -74,6 +74,12 @@ Set an entity.
|
|
|
74
74
|
|
|
75
75
|
The entity to set.
|
|
76
76
|
|
|
77
|
+
##### conditions?
|
|
78
|
+
|
|
79
|
+
`object`[]
|
|
80
|
+
|
|
81
|
+
The optional conditions to match for the entities.
|
|
82
|
+
|
|
77
83
|
#### Returns
|
|
78
84
|
|
|
79
85
|
`Promise`\<`void`\>
|
|
@@ -86,9 +92,35 @@ The id of the entity.
|
|
|
86
92
|
|
|
87
93
|
***
|
|
88
94
|
|
|
89
|
-
###
|
|
95
|
+
### setBatch() {#setbatch}
|
|
96
|
+
|
|
97
|
+
> **setBatch**(`entities`): `Promise`\<`void`\>
|
|
98
|
+
|
|
99
|
+
Set multiple entities in a batch.
|
|
100
|
+
|
|
101
|
+
#### Parameters
|
|
102
|
+
|
|
103
|
+
##### entities
|
|
104
|
+
|
|
105
|
+
`T`[]
|
|
106
|
+
|
|
107
|
+
The entities to set.
|
|
108
|
+
|
|
109
|
+
#### Returns
|
|
110
|
+
|
|
111
|
+
`Promise`\<`void`\>
|
|
112
|
+
|
|
113
|
+
Nothing.
|
|
114
|
+
|
|
115
|
+
#### Implementation of
|
|
116
|
+
|
|
117
|
+
`IEntityStorageComponent.setBatch`
|
|
118
|
+
|
|
119
|
+
***
|
|
120
|
+
|
|
121
|
+
### get() {#get}
|
|
90
122
|
|
|
91
|
-
> **get**(`id`, `secondaryIndex?`): `Promise`\<`T` \| `undefined`\>
|
|
123
|
+
> **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`T` \| `undefined`\>
|
|
92
124
|
|
|
93
125
|
Get an entity.
|
|
94
126
|
|
|
@@ -106,6 +138,12 @@ keyof `T`
|
|
|
106
138
|
|
|
107
139
|
Get the item using a secondary index.
|
|
108
140
|
|
|
141
|
+
##### conditions?
|
|
142
|
+
|
|
143
|
+
`object`[]
|
|
144
|
+
|
|
145
|
+
The optional conditions to match for the entities.
|
|
146
|
+
|
|
109
147
|
#### Returns
|
|
110
148
|
|
|
111
149
|
`Promise`\<`T` \| `undefined`\>
|
|
@@ -118,9 +156,9 @@ The object if it can be found or undefined.
|
|
|
118
156
|
|
|
119
157
|
***
|
|
120
158
|
|
|
121
|
-
### remove()
|
|
159
|
+
### remove() {#remove}
|
|
122
160
|
|
|
123
|
-
> **remove**(`id`): `Promise`\<`void`\>
|
|
161
|
+
> **remove**(`id`, `conditions?`): `Promise`\<`void`\>
|
|
124
162
|
|
|
125
163
|
Remove the entity.
|
|
126
164
|
|
|
@@ -132,6 +170,12 @@ Remove the entity.
|
|
|
132
170
|
|
|
133
171
|
The id of the entity to remove.
|
|
134
172
|
|
|
173
|
+
##### conditions?
|
|
174
|
+
|
|
175
|
+
`object`[]
|
|
176
|
+
|
|
177
|
+
The optional conditions to match for the entities.
|
|
178
|
+
|
|
135
179
|
#### Returns
|
|
136
180
|
|
|
137
181
|
`Promise`\<`void`\>
|
|
@@ -144,7 +188,77 @@ Nothing.
|
|
|
144
188
|
|
|
145
189
|
***
|
|
146
190
|
|
|
147
|
-
###
|
|
191
|
+
### removeBatch() {#removebatch}
|
|
192
|
+
|
|
193
|
+
> **removeBatch**(`ids`): `Promise`\<`void`\>
|
|
194
|
+
|
|
195
|
+
Remove multiple entities by id.
|
|
196
|
+
|
|
197
|
+
#### Parameters
|
|
198
|
+
|
|
199
|
+
##### ids
|
|
200
|
+
|
|
201
|
+
`string`[]
|
|
202
|
+
|
|
203
|
+
The ids of the entities to remove.
|
|
204
|
+
|
|
205
|
+
#### Returns
|
|
206
|
+
|
|
207
|
+
`Promise`\<`void`\>
|
|
208
|
+
|
|
209
|
+
Nothing.
|
|
210
|
+
|
|
211
|
+
#### Implementation of
|
|
212
|
+
|
|
213
|
+
`IEntityStorageComponent.removeBatch`
|
|
214
|
+
|
|
215
|
+
***
|
|
216
|
+
|
|
217
|
+
### empty() {#empty}
|
|
218
|
+
|
|
219
|
+
> **empty**(): `Promise`\<`void`\>
|
|
220
|
+
|
|
221
|
+
Remove all entities from the storage.
|
|
222
|
+
|
|
223
|
+
#### Returns
|
|
224
|
+
|
|
225
|
+
`Promise`\<`void`\>
|
|
226
|
+
|
|
227
|
+
Nothing.
|
|
228
|
+
|
|
229
|
+
#### Implementation of
|
|
230
|
+
|
|
231
|
+
`IEntityStorageComponent.empty`
|
|
232
|
+
|
|
233
|
+
***
|
|
234
|
+
|
|
235
|
+
### count() {#count}
|
|
236
|
+
|
|
237
|
+
> **count**(`conditions?`): `Promise`\<`number`\>
|
|
238
|
+
|
|
239
|
+
Count all the entities which match the conditions.
|
|
240
|
+
|
|
241
|
+
#### Parameters
|
|
242
|
+
|
|
243
|
+
##### conditions?
|
|
244
|
+
|
|
245
|
+
`EntityCondition`\<`T`\>
|
|
246
|
+
|
|
247
|
+
The optional conditions to match for the entities.
|
|
248
|
+
|
|
249
|
+
#### Returns
|
|
250
|
+
|
|
251
|
+
`Promise`\<`number`\>
|
|
252
|
+
|
|
253
|
+
The total count of entities in the storage.
|
|
254
|
+
|
|
255
|
+
#### Implementation of
|
|
256
|
+
|
|
257
|
+
`IEntityStorageComponent.count`
|
|
258
|
+
|
|
259
|
+
***
|
|
260
|
+
|
|
261
|
+
### query() {#query}
|
|
148
262
|
|
|
149
263
|
> **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
150
264
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: entityStorageCount()
|
|
2
|
+
|
|
3
|
+
> **entityStorageCount**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IEntityStorageCountResponse`\>
|
|
4
|
+
|
|
5
|
+
Count the entries in entity storage.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
12
|
+
|
|
13
|
+
The request context for the API.
|
|
14
|
+
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The name of the component to use in the routes.
|
|
20
|
+
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`IEntityStorageCountRequest`
|
|
24
|
+
|
|
25
|
+
The request.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`IEntityStorageCountResponse`\>
|
|
30
|
+
|
|
31
|
+
The response object with additional http response properties.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: entityStorageEmpty()
|
|
2
|
+
|
|
3
|
+
> **entityStorageEmpty**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
|
|
4
|
+
|
|
5
|
+
Remove all entries from entity storage.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
12
|
+
|
|
13
|
+
The request context for the API.
|
|
14
|
+
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The name of the component to use in the routes.
|
|
20
|
+
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`IEntityStorageEmptyRequest`
|
|
24
|
+
|
|
25
|
+
The request.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`INoContentResponse`\>
|
|
30
|
+
|
|
31
|
+
The response object with additional http response properties.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: entityStorageRemoveBatch()
|
|
2
|
+
|
|
3
|
+
> **entityStorageRemoveBatch**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
|
|
4
|
+
|
|
5
|
+
Remove multiple entries from entity storage by id.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
12
|
+
|
|
13
|
+
The request context for the API.
|
|
14
|
+
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The name of the component to use in the routes.
|
|
20
|
+
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`IEntityStorageRemoveBatchRequest`
|
|
24
|
+
|
|
25
|
+
The request.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`INoContentResponse`\>
|
|
30
|
+
|
|
31
|
+
The response object with additional http response properties.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: entityStorageSetBatch()
|
|
2
|
+
|
|
3
|
+
> **entityStorageSetBatch**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
|
|
4
|
+
|
|
5
|
+
Set multiple entries in entity storage.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
12
|
+
|
|
13
|
+
The request context for the API.
|
|
14
|
+
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The name of the component to use in the routes.
|
|
20
|
+
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`IEntityStorageSetBatchRequest`
|
|
24
|
+
|
|
25
|
+
The request.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`INoContentResponse`\>
|
|
30
|
+
|
|
31
|
+
The response object with additional http response properties.
|
package/docs/reference/index.md
CHANGED
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
|
|
20
20
|
- [generateRestRoutesEntityStorage](functions/generateRestRoutesEntityStorage.md)
|
|
21
21
|
- [entityStorageSet](functions/entityStorageSet.md)
|
|
22
|
+
- [entityStorageSetBatch](functions/entityStorageSetBatch.md)
|
|
23
|
+
- [entityStorageEmpty](functions/entityStorageEmpty.md)
|
|
22
24
|
- [entityStorageGet](functions/entityStorageGet.md)
|
|
23
25
|
- [entityStorageRemove](functions/entityStorageRemove.md)
|
|
24
26
|
- [entityStorageList](functions/entityStorageList.md)
|
|
27
|
+
- [entityStorageCount](functions/entityStorageCount.md)
|
|
28
|
+
- [entityStorageRemoveBatch](functions/entityStorageRemoveBatch.md)
|
|
@@ -4,9 +4,9 @@ Examples for the entity storage routes.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### set?
|
|
7
|
+
### set? {#set}
|
|
8
8
|
|
|
9
|
-
> `optional` **set
|
|
9
|
+
> `optional` **set?**: `object`
|
|
10
10
|
|
|
11
11
|
Examples for the set route.
|
|
12
12
|
|
|
@@ -16,9 +16,9 @@ Examples for the set route.
|
|
|
16
16
|
|
|
17
17
|
***
|
|
18
18
|
|
|
19
|
-
### get?
|
|
19
|
+
### get? {#get}
|
|
20
20
|
|
|
21
|
-
> `optional` **get
|
|
21
|
+
> `optional` **get?**: `object`
|
|
22
22
|
|
|
23
23
|
Examples for the get route.
|
|
24
24
|
|
|
@@ -32,9 +32,9 @@ Examples for the get route.
|
|
|
32
32
|
|
|
33
33
|
***
|
|
34
34
|
|
|
35
|
-
### remove?
|
|
35
|
+
### remove? {#remove}
|
|
36
36
|
|
|
37
|
-
> `optional` **remove
|
|
37
|
+
> `optional` **remove?**: `object`
|
|
38
38
|
|
|
39
39
|
Examples for the remove route.
|
|
40
40
|
|
|
@@ -44,9 +44,9 @@ Examples for the remove route.
|
|
|
44
44
|
|
|
45
45
|
***
|
|
46
46
|
|
|
47
|
-
### list?
|
|
47
|
+
### list? {#list}
|
|
48
48
|
|
|
49
|
-
> `optional` **list
|
|
49
|
+
> `optional` **list?**: `object`
|
|
50
50
|
|
|
51
51
|
Examples for the list route.
|
|
52
52
|
|
|
@@ -57,3 +57,19 @@ Examples for the list route.
|
|
|
57
57
|
#### responseExamples
|
|
58
58
|
|
|
59
59
|
> **responseExamples**: `IRestRouteResponseExample`\<`IEntityStorageListResponse`\>[]
|
|
60
|
+
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
### count? {#count}
|
|
64
|
+
|
|
65
|
+
> `optional` **count?**: `object`
|
|
66
|
+
|
|
67
|
+
Examples for the count route.
|
|
68
|
+
|
|
69
|
+
#### requestExamples
|
|
70
|
+
|
|
71
|
+
> **requestExamples**: `IRestRouteRequestExample`\<`IEntityStorageCountRequest`\>[]
|
|
72
|
+
|
|
73
|
+
#### responseExamples
|
|
74
|
+
|
|
75
|
+
> **responseExamples**: `IRestRouteResponseExample`\<`IEntityStorageCountResponse`\>[]
|
|
@@ -4,7 +4,7 @@ Options for the Entity Storage Service constructor.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### entityStorageType
|
|
7
|
+
### entityStorageType {#entitystoragetype}
|
|
8
8
|
|
|
9
9
|
> **entityStorageType**: `string`
|
|
10
10
|
|
|
@@ -12,8 +12,8 @@ The type of the entity storage.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### config?
|
|
15
|
+
### config? {#config}
|
|
16
16
|
|
|
17
|
-
> `optional` **config
|
|
17
|
+
> `optional` **config?**: [`IEntityStorageServiceConfig`](IEntityStorageServiceConfig.md)
|
|
18
18
|
|
|
19
19
|
The configuration for the service.
|
package/locales/en.json
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-service",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.21",
|
|
4
|
+
"description": "Service layer exposing storage contracts and REST endpoint definitions.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
7
|
+
"url": "git+https://github.com/iotaledger/twin-entity-storage.git",
|
|
8
8
|
"directory": "packages/entity-storage-service"
|
|
9
9
|
},
|
|
10
10
|
"author": "martyn.janes@iota.org",
|
|
@@ -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.3-next.
|
|
20
|
+
"@twin.org/entity-storage-models": "0.0.3-next.21",
|
|
21
21
|
"@twin.org/nameof": "next",
|
|
22
22
|
"@twin.org/web": "next"
|
|
23
23
|
},
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"business-logic"
|
|
54
54
|
],
|
|
55
55
|
"bugs": {
|
|
56
|
-
"url": "git+https://github.com/
|
|
56
|
+
"url": "git+https://github.com/iotaledger/twin-entity-storage/issues"
|
|
57
57
|
},
|
|
58
58
|
"homepage": "https://twindev.org"
|
|
59
59
|
}
|