@twin.org/entity-storage-service 0.0.2-next.9 → 0.0.3-next.10

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.
Files changed (39) hide show
  1. package/README.md +2 -2
  2. package/dist/es/entityStorageRoutes.js +399 -0
  3. package/dist/es/entityStorageRoutes.js.map +1 -0
  4. package/dist/es/entityStorageService.js +113 -0
  5. package/dist/es/entityStorageService.js.map +1 -0
  6. package/dist/es/index.js +9 -0
  7. package/dist/es/index.js.map +1 -0
  8. package/dist/es/models/IEntityStorageRoutesExamples.js +2 -0
  9. package/dist/es/models/IEntityStorageRoutesExamples.js.map +1 -0
  10. package/dist/es/models/IEntityStorageServiceConfig.js +4 -0
  11. package/dist/es/models/IEntityStorageServiceConfig.js.map +1 -0
  12. package/dist/es/models/IEntityStorageServiceConstructorOptions.js +2 -0
  13. package/dist/es/models/IEntityStorageServiceConstructorOptions.js.map +1 -0
  14. package/dist/es/restEntryPoints.js +15 -0
  15. package/dist/es/restEntryPoints.js.map +1 -0
  16. package/dist/types/entityStorageRoutes.d.ts +34 -2
  17. package/dist/types/entityStorageService.d.ts +35 -12
  18. package/dist/types/index.d.ts +6 -6
  19. package/dist/types/models/IEntityStorageRoutesExamples.d.ts +8 -1
  20. package/dist/types/models/IEntityStorageServiceConfig.d.ts +5 -0
  21. package/dist/types/models/IEntityStorageServiceConstructorOptions.d.ts +2 -2
  22. package/docs/changelog.md +220 -31
  23. package/docs/examples.md +77 -1
  24. package/docs/open-api/spec.json +441 -62
  25. package/docs/reference/classes/EntityStorageService.md +114 -36
  26. package/docs/reference/functions/entityStorageCount.md +31 -0
  27. package/docs/reference/functions/entityStorageEmpty.md +31 -0
  28. package/docs/reference/functions/entityStorageRemoveBatch.md +31 -0
  29. package/docs/reference/functions/entityStorageSetBatch.md +31 -0
  30. package/docs/reference/index.md +5 -1
  31. package/docs/reference/interfaces/IEntityStorageRoutesExamples.md +24 -8
  32. package/docs/reference/interfaces/IEntityStorageServiceConfig.md +3 -0
  33. package/docs/reference/interfaces/IEntityStorageServiceConstructorOptions.md +3 -3
  34. package/locales/en.json +1 -7
  35. package/package.json +13 -11
  36. package/dist/cjs/index.cjs +0 -421
  37. package/dist/esm/index.mjs +0 -412
  38. package/dist/types/models/IEntityStorageConfig.d.ts +0 -10
  39. package/docs/reference/interfaces/IEntityStorageConfig.md +0 -17
@@ -34,21 +34,35 @@ 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
- > `readonly` **CLASS\_NAME**: `string`
39
+ > `readonly` `static` **CLASS\_NAME**: `string`
40
40
 
41
41
  Runtime name for the class.
42
42
 
43
+ ## Methods
44
+
45
+ ### className() {#classname}
46
+
47
+ > **className**(): `string`
48
+
49
+ Returns the class name of the component.
50
+
51
+ #### Returns
52
+
53
+ `string`
54
+
55
+ The class name of the component.
56
+
43
57
  #### Implementation of
44
58
 
45
- `IEntityStorageComponent.CLASS_NAME`
59
+ `IEntityStorageComponent.className`
46
60
 
47
- ## Methods
61
+ ***
48
62
 
49
- ### set()
63
+ ### set() {#set}
50
64
 
51
- > **set**(`entity`, `userIdentity?`): `Promise`\<`void`\>
65
+ > **set**(`entity`): `Promise`\<`void`\>
52
66
 
53
67
  Set an entity.
54
68
 
@@ -60,27 +74,47 @@ Set an entity.
60
74
 
61
75
  The entity to set.
62
76
 
63
- ##### userIdentity?
77
+ #### Returns
64
78
 
65
- `string`
79
+ `Promise`\<`void`\>
80
+
81
+ The id of the entity.
66
82
 
67
- The user identity to use with storage operations.
83
+ #### Implementation of
84
+
85
+ `IEntityStorageComponent.set`
86
+
87
+ ***
88
+
89
+ ### setBatch() {#setbatch}
90
+
91
+ > **setBatch**(`entities`): `Promise`\<`void`\>
92
+
93
+ Set multiple entities in a batch.
94
+
95
+ #### Parameters
96
+
97
+ ##### entities
98
+
99
+ `T`[]
100
+
101
+ The entities to set.
68
102
 
69
103
  #### Returns
70
104
 
71
105
  `Promise`\<`void`\>
72
106
 
73
- The id of the entity.
107
+ Nothing.
74
108
 
75
109
  #### Implementation of
76
110
 
77
- `IEntityStorageComponent.set`
111
+ `IEntityStorageComponent.setBatch`
78
112
 
79
113
  ***
80
114
 
81
- ### get()
115
+ ### get() {#get}
82
116
 
83
- > **get**(`id`, `secondaryIndex?`, `userIdentity?`): `Promise`\<`undefined` \| `T`\>
117
+ > **get**(`id`, `secondaryIndex?`): `Promise`\<`T` \| `undefined`\>
84
118
 
85
119
  Get an entity.
86
120
 
@@ -98,15 +132,9 @@ keyof `T`
98
132
 
99
133
  Get the item using a secondary index.
100
134
 
101
- ##### userIdentity?
102
-
103
- `string`
104
-
105
- The user identity to use with storage operations.
106
-
107
135
  #### Returns
108
136
 
109
- `Promise`\<`undefined` \| `T`\>
137
+ `Promise`\<`T` \| `undefined`\>
110
138
 
111
139
  The object if it can be found or undefined.
112
140
 
@@ -116,9 +144,9 @@ The object if it can be found or undefined.
116
144
 
117
145
  ***
118
146
 
119
- ### remove()
147
+ ### remove() {#remove}
120
148
 
121
- > **remove**(`id`, `userIdentity?`): `Promise`\<`void`\>
149
+ > **remove**(`id`): `Promise`\<`void`\>
122
150
 
123
151
  Remove the entity.
124
152
 
@@ -130,11 +158,31 @@ Remove the entity.
130
158
 
131
159
  The id of the entity to remove.
132
160
 
133
- ##### userIdentity?
161
+ #### Returns
162
+
163
+ `Promise`\<`void`\>
134
164
 
135
- `string`
165
+ Nothing.
166
+
167
+ #### Implementation of
168
+
169
+ `IEntityStorageComponent.remove`
170
+
171
+ ***
172
+
173
+ ### removeBatch() {#removebatch}
174
+
175
+ > **removeBatch**(`ids`): `Promise`\<`void`\>
176
+
177
+ Remove multiple entities by id.
178
+
179
+ #### Parameters
180
+
181
+ ##### ids
136
182
 
137
- The user identity to use with storage operations.
183
+ `string`[]
184
+
185
+ The ids of the entities to remove.
138
186
 
139
187
  #### Returns
140
188
 
@@ -144,13 +192,49 @@ Nothing.
144
192
 
145
193
  #### Implementation of
146
194
 
147
- `IEntityStorageComponent.remove`
195
+ `IEntityStorageComponent.removeBatch`
148
196
 
149
197
  ***
150
198
 
151
- ### query()
199
+ ### empty() {#empty}
200
+
201
+ > **empty**(): `Promise`\<`void`\>
202
+
203
+ Remove all entities from the storage.
204
+
205
+ #### Returns
152
206
 
153
- > **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `pageSize?`, `userIdentity?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
207
+ `Promise`\<`void`\>
208
+
209
+ Nothing.
210
+
211
+ #### Implementation of
212
+
213
+ `IEntityStorageComponent.empty`
214
+
215
+ ***
216
+
217
+ ### count() {#count}
218
+
219
+ > **count**(): `Promise`\<`number`\>
220
+
221
+ Count all the entities which match the conditions.
222
+
223
+ #### Returns
224
+
225
+ `Promise`\<`number`\>
226
+
227
+ The total count of entities in the storage.
228
+
229
+ #### Implementation of
230
+
231
+ `IEntityStorageComponent.count`
232
+
233
+ ***
234
+
235
+ ### query() {#query}
236
+
237
+ > **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
154
238
 
155
239
  Query all the entities which match the conditions.
156
240
 
@@ -184,20 +268,14 @@ The optional properties to return, defaults to all.
184
268
 
185
269
  `string`
186
270
 
187
- The cursor to request the next page of entities.
271
+ The cursor to request the next chunk of entities.
188
272
 
189
- ##### pageSize?
273
+ ##### limit?
190
274
 
191
275
  `number`
192
276
 
193
277
  The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
194
278
 
195
- ##### userIdentity?
196
-
197
- `string`
198
-
199
- The user identity to use with storage operations.
200
-
201
279
  #### Returns
202
280
 
203
281
  `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
@@ -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.
@@ -6,8 +6,8 @@
6
6
 
7
7
  ## Interfaces
8
8
 
9
- - [IEntityStorageConfig](interfaces/IEntityStorageConfig.md)
10
9
  - [IEntityStorageRoutesExamples](interfaces/IEntityStorageRoutesExamples.md)
10
+ - [IEntityStorageServiceConfig](interfaces/IEntityStorageServiceConfig.md)
11
11
  - [IEntityStorageServiceConstructorOptions](interfaces/IEntityStorageServiceConstructorOptions.md)
12
12
 
13
13
  ## Variables
@@ -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**: `object`
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**: `object`
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**: `object`
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**: `object`
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`\>[]
@@ -0,0 +1,3 @@
1
+ # Interface: IEntityStorageServiceConfig
2
+
3
+ Configuration for the entity storage service.
@@ -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**: [`IEntityStorageConfig`](IEntityStorageConfig.md)
17
+ > `optional` **config?**: [`IEntityStorageServiceConfig`](IEntityStorageServiceConfig.md)
18
18
 
19
19
  The configuration for the service.
package/locales/en.json CHANGED
@@ -1,7 +1 @@
1
- {
2
- "error": {
3
- "entityStorageService": {
4
- "entityNotFound": "Could not find entity with id \"{id}\""
5
- }
6
- }
7
- }
1
+ {}
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@twin.org/entity-storage-service",
3
- "version": "0.0.2-next.9",
4
- "description": "Entity Storage contract implementation and REST endpoint definitions",
3
+ "version": "0.0.3-next.10",
4
+ "description": "Service layer exposing storage contracts and REST endpoint definitions.",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/twinfoundation/entity-storage.git",
7
+ "url": "git+https://github.com/iotaledger/entity-storage.git",
8
8
  "directory": "packages/entity-storage-service"
9
9
  },
10
10
  "author": "martyn.janes@iota.org",
@@ -17,24 +17,22 @@
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.2-next.9",
20
+ "@twin.org/entity-storage-models": "0.0.3-next.10",
21
21
  "@twin.org/nameof": "next",
22
22
  "@twin.org/web": "next"
23
23
  },
24
- "main": "./dist/cjs/index.cjs",
25
- "module": "./dist/esm/index.mjs",
24
+ "main": "./dist/es/index.js",
26
25
  "types": "./dist/types/index.d.ts",
27
26
  "exports": {
28
27
  ".": {
29
28
  "types": "./dist/types/index.d.ts",
30
- "require": "./dist/cjs/index.cjs",
31
- "import": "./dist/esm/index.mjs"
29
+ "import": "./dist/es/index.js",
30
+ "default": "./dist/es/index.js"
32
31
  },
33
32
  "./locales/*.json": "./locales/*.json"
34
33
  },
35
34
  "files": [
36
- "dist/cjs",
37
- "dist/esm",
35
+ "dist/es",
38
36
  "dist/types",
39
37
  "locales",
40
38
  "docs"
@@ -53,5 +51,9 @@
53
51
  "service",
54
52
  "microservice",
55
53
  "business-logic"
56
- ]
54
+ ],
55
+ "bugs": {
56
+ "url": "git+https://github.com/iotaledger/entity-storage/issues"
57
+ },
58
+ "homepage": "https://twindev.org"
57
59
  }