@twin.org/entity-storage-service 0.0.2-next.9 → 0.0.3-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.
Files changed (31) hide show
  1. package/dist/es/entityStorageRoutes.js +227 -0
  2. package/dist/es/entityStorageRoutes.js.map +1 -0
  3. package/dist/es/entityStorageService.js +122 -0
  4. package/dist/es/entityStorageService.js.map +1 -0
  5. package/dist/es/index.js +9 -0
  6. package/dist/es/index.js.map +1 -0
  7. package/dist/es/models/IEntityStorageRoutesExamples.js +2 -0
  8. package/dist/es/models/IEntityStorageRoutesExamples.js.map +1 -0
  9. package/dist/es/models/IEntityStorageServiceConfig.js +4 -0
  10. package/dist/es/models/IEntityStorageServiceConfig.js.map +1 -0
  11. package/dist/es/models/IEntityStorageServiceConstructorOptions.js +2 -0
  12. package/dist/es/models/IEntityStorageServiceConstructorOptions.js.map +1 -0
  13. package/dist/es/restEntryPoints.js +15 -0
  14. package/dist/es/restEntryPoints.js.map +1 -0
  15. package/dist/types/entityStorageRoutes.d.ts +1 -1
  16. package/dist/types/entityStorageService.d.ts +13 -12
  17. package/dist/types/index.d.ts +6 -6
  18. package/dist/types/models/IEntityStorageServiceConfig.d.ts +5 -0
  19. package/dist/types/models/IEntityStorageServiceConstructorOptions.d.ts +2 -2
  20. package/docs/changelog.md +45 -0
  21. package/docs/open-api/spec.json +14 -279
  22. package/docs/reference/classes/EntityStorageService.md +24 -34
  23. package/docs/reference/index.md +1 -1
  24. package/docs/reference/interfaces/IEntityStorageServiceConfig.md +3 -0
  25. package/docs/reference/interfaces/IEntityStorageServiceConstructorOptions.md +1 -1
  26. package/locales/en.json +1 -1
  27. package/package.json +11 -9
  28. package/dist/cjs/index.cjs +0 -421
  29. package/dist/esm/index.mjs +0 -412
  30. package/dist/types/models/IEntityStorageConfig.d.ts +0 -10
  31. package/docs/reference/interfaces/IEntityStorageConfig.md +0 -17
@@ -53,62 +53,12 @@
53
53
  }
54
54
  },
55
55
  "responses": {
56
- "204": {
57
- "description": "The rest request ended in success with no data."
58
- },
59
- "400": {
60
- "description": "The server cannot process the request, see the content for more details.",
61
- "content": {
62
- "application/json": {
63
- "schema": {
64
- "$ref": "#/components/schemas/Error"
65
- },
66
- "examples": {
67
- "exampleResponse": {
68
- "value": {
69
- "name": "GeneralError",
70
- "message": "component.error",
71
- "properties": {
72
- "foo": "bar"
73
- }
74
- }
75
- }
76
- }
77
- }
78
- }
79
- },
80
- "401": {
81
- "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
82
- "content": {
83
- "application/json": {
84
- "schema": {
85
- "$ref": "#/components/schemas/Error"
86
- },
87
- "examples": {
88
- "exampleResponse": {
89
- "value": {
90
- "name": "UnauthorizedError",
91
- "message": "component.error"
92
- }
93
- }
94
- }
95
- }
96
- }
97
- },
98
- "500": {
99
- "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
56
+ "200": {
57
+ "description": "The rest request ended in success with no data.",
100
58
  "content": {
101
- "application/json": {
59
+ "text/plain": {
102
60
  "schema": {
103
- "$ref": "#/components/schemas/Error"
104
- },
105
- "examples": {
106
- "exampleResponse": {
107
- "value": {
108
- "name": "InternalServerError",
109
- "message": "component.error"
110
- }
111
- }
61
+ "$ref": "#/components/schemas/NoContentResponse"
112
62
  }
113
63
  }
114
64
  }
@@ -159,15 +109,12 @@
159
109
  }
160
110
  },
161
111
  {
162
- "name": "pageSize",
163
- "description": "The number of entries to return per page.",
112
+ "name": "limit",
113
+ "description": "Limit the number of entities to return.",
164
114
  "in": "query",
165
115
  "required": false,
166
116
  "schema": {
167
- "type": [
168
- "number",
169
- "string"
170
- ]
117
+ "type": "string"
171
118
  }
172
119
  },
173
120
  {
@@ -207,63 +154,6 @@
207
154
  }
208
155
  }
209
156
  }
210
- },
211
- "400": {
212
- "description": "The server cannot process the request, see the content for more details.",
213
- "content": {
214
- "application/json": {
215
- "schema": {
216
- "$ref": "#/components/schemas/Error"
217
- },
218
- "examples": {
219
- "exampleResponse": {
220
- "value": {
221
- "name": "GeneralError",
222
- "message": "component.error",
223
- "properties": {
224
- "foo": "bar"
225
- }
226
- }
227
- }
228
- }
229
- }
230
- }
231
- },
232
- "401": {
233
- "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
234
- "content": {
235
- "application/json": {
236
- "schema": {
237
- "$ref": "#/components/schemas/Error"
238
- },
239
- "examples": {
240
- "exampleResponse": {
241
- "value": {
242
- "name": "UnauthorizedError",
243
- "message": "component.error"
244
- }
245
- }
246
- }
247
- }
248
- }
249
- },
250
- "500": {
251
- "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
252
- "content": {
253
- "application/json": {
254
- "schema": {
255
- "$ref": "#/components/schemas/Error"
256
- },
257
- "examples": {
258
- "exampleResponse": {
259
- "value": {
260
- "name": "InternalServerError",
261
- "message": "component.error"
262
- }
263
- }
264
- }
265
- }
266
- }
267
157
  }
268
158
  }
269
159
  }
@@ -304,97 +194,11 @@
304
194
  ],
305
195
  "responses": {
306
196
  "200": {
307
- "description": "Get an entry from entity storage.",
308
- "content": {
309
- "application/json": {
310
- "schema": {
311
- "$ref": "#/components/schemas/EntityStorageGetResponse"
312
- },
313
- "examples": {
314
- "entityStorageGetResponseExample": {
315
- "value": {
316
- "id": "12345",
317
- "name": "My Item"
318
- }
319
- }
320
- }
321
- }
322
- }
323
- },
324
- "400": {
325
- "description": "The server cannot process the request, see the content for more details.",
326
- "content": {
327
- "application/json": {
328
- "schema": {
329
- "$ref": "#/components/schemas/Error"
330
- },
331
- "examples": {
332
- "exampleResponse": {
333
- "value": {
334
- "name": "GeneralError",
335
- "message": "component.error",
336
- "properties": {
337
- "foo": "bar"
338
- }
339
- }
340
- }
341
- }
342
- }
343
- }
344
- },
345
- "401": {
346
- "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
347
- "content": {
348
- "application/json": {
349
- "schema": {
350
- "$ref": "#/components/schemas/Error"
351
- },
352
- "examples": {
353
- "exampleResponse": {
354
- "value": {
355
- "name": "UnauthorizedError",
356
- "message": "component.error"
357
- }
358
- }
359
- }
360
- }
361
- }
362
- },
363
- "404": {
364
197
  "description": "The resource you tried to access does not exist, see the content for more details.",
365
198
  "content": {
366
199
  "application/json": {
367
200
  "schema": {
368
201
  "$ref": "#/components/schemas/NotFoundResponse"
369
- },
370
- "examples": {
371
- "exampleResponse": {
372
- "value": {
373
- "name": "NotFoundError",
374
- "message": "component.error",
375
- "properties": {
376
- "notFoundId": "1"
377
- }
378
- }
379
- }
380
- }
381
- }
382
- }
383
- },
384
- "500": {
385
- "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
386
- "content": {
387
- "application/json": {
388
- "schema": {
389
- "$ref": "#/components/schemas/Error"
390
- },
391
- "examples": {
392
- "exampleResponse": {
393
- "value": {
394
- "name": "InternalServerError",
395
- "message": "component.error"
396
- }
397
- }
398
202
  }
399
203
  }
400
204
  }
@@ -426,83 +230,17 @@
426
230
  }
427
231
  ],
428
232
  "responses": {
429
- "204": {
430
- "description": "The rest request ended in success with no data."
431
- },
432
- "400": {
433
- "description": "The server cannot process the request, see the content for more details.",
434
- "content": {
435
- "application/json": {
436
- "schema": {
437
- "$ref": "#/components/schemas/Error"
438
- },
439
- "examples": {
440
- "exampleResponse": {
441
- "value": {
442
- "name": "GeneralError",
443
- "message": "component.error",
444
- "properties": {
445
- "foo": "bar"
446
- }
447
- }
448
- }
449
- }
450
- }
451
- }
452
- },
453
- "401": {
454
- "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
455
- "content": {
456
- "application/json": {
457
- "schema": {
458
- "$ref": "#/components/schemas/Error"
459
- },
460
- "examples": {
461
- "exampleResponse": {
462
- "value": {
463
- "name": "UnauthorizedError",
464
- "message": "component.error"
465
- }
466
- }
467
- }
468
- }
469
- }
470
- },
471
- "404": {
233
+ "200": {
472
234
  "description": "The resource you tried to access does not exist, see the content for more details.",
473
235
  "content": {
474
- "application/json": {
236
+ "text/plain": {
475
237
  "schema": {
476
- "$ref": "#/components/schemas/NotFoundResponse"
477
- },
478
- "examples": {
479
- "exampleResponse": {
480
- "value": {
481
- "name": "NotFoundError",
482
- "message": "component.error",
483
- "properties": {
484
- "notFoundId": "1"
485
- }
486
- }
487
- }
238
+ "$ref": "#/components/schemas/NoContentResponse"
488
239
  }
489
- }
490
- }
491
- },
492
- "500": {
493
- "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
494
- "content": {
240
+ },
495
241
  "application/json": {
496
242
  "schema": {
497
- "$ref": "#/components/schemas/Error"
498
- },
499
- "examples": {
500
- "exampleResponse": {
501
- "value": {
502
- "name": "InternalServerError",
503
- "message": "component.error"
504
- }
505
- }
243
+ "$ref": "#/components/schemas/NotFoundResponse"
506
244
  }
507
245
  }
508
246
  }
@@ -521,11 +259,8 @@
521
259
  "properties": {
522
260
  "entities": {
523
261
  "type": "array",
524
- "items": false,
525
- "description": "The entities from the query.",
526
- "prefixItems": [
527
- {}
528
- ]
262
+ "items": {},
263
+ "description": "The entities from the query."
529
264
  },
530
265
  "cursor": {
531
266
  "type": "string",
@@ -36,19 +36,33 @@ The dependencies for the entity storage service.
36
36
 
37
37
  ### 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()
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
63
  ### set()
50
64
 
51
- > **set**(`entity`, `userIdentity?`): `Promise`\<`void`\>
65
+ > **set**(`entity`): `Promise`\<`void`\>
52
66
 
53
67
  Set an entity.
54
68
 
@@ -60,12 +74,6 @@ Set an entity.
60
74
 
61
75
  The entity to set.
62
76
 
63
- ##### userIdentity?
64
-
65
- `string`
66
-
67
- The user identity to use with storage operations.
68
-
69
77
  #### Returns
70
78
 
71
79
  `Promise`\<`void`\>
@@ -80,7 +88,7 @@ The id of the entity.
80
88
 
81
89
  ### get()
82
90
 
83
- > **get**(`id`, `secondaryIndex?`, `userIdentity?`): `Promise`\<`undefined` \| `T`\>
91
+ > **get**(`id`, `secondaryIndex?`): `Promise`\<`T` \| `undefined`\>
84
92
 
85
93
  Get an entity.
86
94
 
@@ -98,15 +106,9 @@ keyof `T`
98
106
 
99
107
  Get the item using a secondary index.
100
108
 
101
- ##### userIdentity?
102
-
103
- `string`
104
-
105
- The user identity to use with storage operations.
106
-
107
109
  #### Returns
108
110
 
109
- `Promise`\<`undefined` \| `T`\>
111
+ `Promise`\<`T` \| `undefined`\>
110
112
 
111
113
  The object if it can be found or undefined.
112
114
 
@@ -118,7 +120,7 @@ The object if it can be found or undefined.
118
120
 
119
121
  ### remove()
120
122
 
121
- > **remove**(`id`, `userIdentity?`): `Promise`\<`void`\>
123
+ > **remove**(`id`): `Promise`\<`void`\>
122
124
 
123
125
  Remove the entity.
124
126
 
@@ -130,12 +132,6 @@ Remove the entity.
130
132
 
131
133
  The id of the entity to remove.
132
134
 
133
- ##### userIdentity?
134
-
135
- `string`
136
-
137
- The user identity to use with storage operations.
138
-
139
135
  #### Returns
140
136
 
141
137
  `Promise`\<`void`\>
@@ -150,7 +146,7 @@ Nothing.
150
146
 
151
147
  ### query()
152
148
 
153
- > **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `pageSize?`, `userIdentity?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
149
+ > **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
154
150
 
155
151
  Query all the entities which match the conditions.
156
152
 
@@ -184,20 +180,14 @@ The optional properties to return, defaults to all.
184
180
 
185
181
  `string`
186
182
 
187
- The cursor to request the next page of entities.
183
+ The cursor to request the next chunk of entities.
188
184
 
189
- ##### pageSize?
185
+ ##### limit?
190
186
 
191
187
  `number`
192
188
 
193
189
  The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
194
190
 
195
- ##### userIdentity?
196
-
197
- `string`
198
-
199
- The user identity to use with storage operations.
200
-
201
191
  #### Returns
202
192
 
203
193
  `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
@@ -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
@@ -0,0 +1,3 @@
1
+ # Interface: IEntityStorageServiceConfig
2
+
3
+ Configuration for the entity storage service.
@@ -14,6 +14,6 @@ The type of the entity storage.
14
14
 
15
15
  ### 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,7 @@
1
1
  {
2
2
  "error": {
3
3
  "entityStorageService": {
4
- "entityNotFound": "Could not find entity with id \"{id}\""
4
+ "entityNotFound": "Could not find entity with id \"{notFoundId}\""
5
5
  }
6
6
  }
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/entity-storage-service",
3
- "version": "0.0.2-next.9",
3
+ "version": "0.0.3-next.1",
4
4
  "description": "Entity Storage contract implementation and REST endpoint definitions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -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.1",
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/twinfoundation/entity-storage/issues"
57
+ },
58
+ "homepage": "https://twindev.org"
57
59
  }