@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
@@ -67,7 +67,7 @@
67
67
  "exampleResponse": {
68
68
  "value": {
69
69
  "name": "GeneralError",
70
- "message": "component.error",
70
+ "message": "errorMessage",
71
71
  "properties": {
72
72
  "foo": "bar"
73
73
  }
@@ -88,7 +88,7 @@
88
88
  "exampleResponse": {
89
89
  "value": {
90
90
  "name": "UnauthorizedError",
91
- "message": "component.error"
91
+ "message": "errorMessage"
92
92
  }
93
93
  }
94
94
  }
@@ -106,7 +106,92 @@
106
106
  "exampleResponse": {
107
107
  "value": {
108
108
  "name": "InternalServerError",
109
- "message": "component.error"
109
+ "message": "errorMessage"
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ },
118
+ "delete": {
119
+ "operationId": "entityStorageEmpty",
120
+ "summary": "Remove all entries from entity storage.",
121
+ "tags": [
122
+ "EntityStorage"
123
+ ],
124
+ "security": [
125
+ {
126
+ "jwtBearerAuthScheme": []
127
+ }
128
+ ],
129
+ "requestBody": {
130
+ "description": "Remove all entries from entity storage.",
131
+ "required": true,
132
+ "content": {
133
+ "text/plain": {
134
+ "schema": {
135
+ "$ref": "#/components/schemas/EntityStorageEmptyRequest"
136
+ }
137
+ }
138
+ }
139
+ },
140
+ "responses": {
141
+ "204": {
142
+ "description": "The rest request ended in success with no data."
143
+ },
144
+ "400": {
145
+ "description": "The server cannot process the request, see the content for more details.",
146
+ "content": {
147
+ "application/json": {
148
+ "schema": {
149
+ "$ref": "#/components/schemas/Error"
150
+ },
151
+ "examples": {
152
+ "exampleResponse": {
153
+ "value": {
154
+ "name": "GeneralError",
155
+ "message": "errorMessage",
156
+ "properties": {
157
+ "foo": "bar"
158
+ }
159
+ }
160
+ }
161
+ }
162
+ }
163
+ }
164
+ },
165
+ "401": {
166
+ "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
167
+ "content": {
168
+ "application/json": {
169
+ "schema": {
170
+ "$ref": "#/components/schemas/Error"
171
+ },
172
+ "examples": {
173
+ "exampleResponse": {
174
+ "value": {
175
+ "name": "UnauthorizedError",
176
+ "message": "errorMessage"
177
+ }
178
+ }
179
+ }
180
+ }
181
+ }
182
+ },
183
+ "500": {
184
+ "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
185
+ "content": {
186
+ "application/json": {
187
+ "schema": {
188
+ "$ref": "#/components/schemas/Error"
189
+ },
190
+ "examples": {
191
+ "exampleResponse": {
192
+ "value": {
193
+ "name": "InternalServerError",
194
+ "message": "errorMessage"
110
195
  }
111
196
  }
112
197
  }
@@ -159,15 +244,12 @@
159
244
  }
160
245
  },
161
246
  {
162
- "name": "pageSize",
163
- "description": "The number of entries to return per page.",
247
+ "name": "limit",
248
+ "description": "Limit the number of entities to return.",
164
249
  "in": "query",
165
250
  "required": false,
166
251
  "schema": {
167
- "type": [
168
- "number",
169
- "string"
170
- ]
252
+ "type": "string"
171
253
  }
172
254
  },
173
255
  {
@@ -219,7 +301,7 @@
219
301
  "exampleResponse": {
220
302
  "value": {
221
303
  "name": "GeneralError",
222
- "message": "component.error",
304
+ "message": "errorMessage",
223
305
  "properties": {
224
306
  "foo": "bar"
225
307
  }
@@ -240,7 +322,7 @@
240
322
  "exampleResponse": {
241
323
  "value": {
242
324
  "name": "UnauthorizedError",
243
- "message": "component.error"
325
+ "message": "errorMessage"
244
326
  }
245
327
  }
246
328
  }
@@ -258,7 +340,201 @@
258
340
  "exampleResponse": {
259
341
  "value": {
260
342
  "name": "InternalServerError",
261
- "message": "component.error"
343
+ "message": "errorMessage"
344
+ }
345
+ }
346
+ }
347
+ }
348
+ }
349
+ }
350
+ }
351
+ }
352
+ },
353
+ "/entity-storage/batch": {
354
+ "post": {
355
+ "operationId": "entityStorageSetBatch",
356
+ "summary": "Set multiple entries in entity storage.",
357
+ "tags": [
358
+ "EntityStorage"
359
+ ],
360
+ "security": [
361
+ {
362
+ "jwtBearerAuthScheme": []
363
+ }
364
+ ],
365
+ "requestBody": {
366
+ "description": "Set multiple entries in entity storage.",
367
+ "required": true,
368
+ "content": {
369
+ "application/json": {
370
+ "schema": {
371
+ "$ref": "#/components/schemas/EntityStorageSetBatchRequest"
372
+ },
373
+ "examples": {
374
+ "entityStorageSetBatchRequestExample": {
375
+ "value": [
376
+ {
377
+ "id": "12345",
378
+ "name": "My Item"
379
+ },
380
+ {
381
+ "id": "67890",
382
+ "name": "My Other Item"
383
+ }
384
+ ]
385
+ }
386
+ }
387
+ }
388
+ }
389
+ },
390
+ "responses": {
391
+ "204": {
392
+ "description": "The rest request ended in success with no data."
393
+ },
394
+ "400": {
395
+ "description": "The server cannot process the request, see the content for more details.",
396
+ "content": {
397
+ "application/json": {
398
+ "schema": {
399
+ "$ref": "#/components/schemas/Error"
400
+ },
401
+ "examples": {
402
+ "exampleResponse": {
403
+ "value": {
404
+ "name": "GeneralError",
405
+ "message": "errorMessage",
406
+ "properties": {
407
+ "foo": "bar"
408
+ }
409
+ }
410
+ }
411
+ }
412
+ }
413
+ }
414
+ },
415
+ "401": {
416
+ "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
417
+ "content": {
418
+ "application/json": {
419
+ "schema": {
420
+ "$ref": "#/components/schemas/Error"
421
+ },
422
+ "examples": {
423
+ "exampleResponse": {
424
+ "value": {
425
+ "name": "UnauthorizedError",
426
+ "message": "errorMessage"
427
+ }
428
+ }
429
+ }
430
+ }
431
+ }
432
+ },
433
+ "500": {
434
+ "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
435
+ "content": {
436
+ "application/json": {
437
+ "schema": {
438
+ "$ref": "#/components/schemas/Error"
439
+ },
440
+ "examples": {
441
+ "exampleResponse": {
442
+ "value": {
443
+ "name": "InternalServerError",
444
+ "message": "errorMessage"
445
+ }
446
+ }
447
+ }
448
+ }
449
+ }
450
+ }
451
+ }
452
+ },
453
+ "delete": {
454
+ "operationId": "entityStorageRemoveBatch",
455
+ "summary": "Remove multiple entries from entity storage by id.",
456
+ "tags": [
457
+ "EntityStorage"
458
+ ],
459
+ "security": [
460
+ {
461
+ "jwtBearerAuthScheme": []
462
+ }
463
+ ],
464
+ "requestBody": {
465
+ "description": "Remove multiple entries from entity storage by id.",
466
+ "required": true,
467
+ "content": {
468
+ "application/json": {
469
+ "schema": {
470
+ "$ref": "#/components/schemas/EntityStorageRemoveBatchRequest"
471
+ },
472
+ "examples": {
473
+ "entityStorageRemoveBatchRequestExample": {
474
+ "value": [
475
+ "12345",
476
+ "67890"
477
+ ]
478
+ }
479
+ }
480
+ }
481
+ }
482
+ },
483
+ "responses": {
484
+ "204": {
485
+ "description": "The rest request ended in success with no data."
486
+ },
487
+ "400": {
488
+ "description": "The server cannot process the request, see the content for more details.",
489
+ "content": {
490
+ "application/json": {
491
+ "schema": {
492
+ "$ref": "#/components/schemas/Error"
493
+ },
494
+ "examples": {
495
+ "exampleResponse": {
496
+ "value": {
497
+ "name": "GeneralError",
498
+ "message": "errorMessage",
499
+ "properties": {
500
+ "foo": "bar"
501
+ }
502
+ }
503
+ }
504
+ }
505
+ }
506
+ }
507
+ },
508
+ "401": {
509
+ "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
510
+ "content": {
511
+ "application/json": {
512
+ "schema": {
513
+ "$ref": "#/components/schemas/Error"
514
+ },
515
+ "examples": {
516
+ "exampleResponse": {
517
+ "value": {
518
+ "name": "UnauthorizedError",
519
+ "message": "errorMessage"
520
+ }
521
+ }
522
+ }
523
+ }
524
+ }
525
+ },
526
+ "500": {
527
+ "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
528
+ "content": {
529
+ "application/json": {
530
+ "schema": {
531
+ "$ref": "#/components/schemas/Error"
532
+ },
533
+ "examples": {
534
+ "exampleResponse": {
535
+ "value": {
536
+ "name": "InternalServerError",
537
+ "message": "errorMessage"
262
538
  }
263
539
  }
264
540
  }
@@ -332,7 +608,7 @@
332
608
  "exampleResponse": {
333
609
  "value": {
334
610
  "name": "GeneralError",
335
- "message": "component.error",
611
+ "message": "errorMessage",
336
612
  "properties": {
337
613
  "foo": "bar"
338
614
  }
@@ -353,7 +629,7 @@
353
629
  "exampleResponse": {
354
630
  "value": {
355
631
  "name": "UnauthorizedError",
356
- "message": "component.error"
632
+ "message": "errorMessage"
357
633
  }
358
634
  }
359
635
  }
@@ -371,7 +647,7 @@
371
647
  "exampleResponse": {
372
648
  "value": {
373
649
  "name": "NotFoundError",
374
- "message": "component.error",
650
+ "message": "errorMessage",
375
651
  "properties": {
376
652
  "notFoundId": "1"
377
653
  }
@@ -392,7 +668,7 @@
392
668
  "exampleResponse": {
393
669
  "value": {
394
670
  "name": "InternalServerError",
395
- "message": "component.error"
671
+ "message": "errorMessage"
396
672
  }
397
673
  }
398
674
  }
@@ -440,7 +716,7 @@
440
716
  "exampleResponse": {
441
717
  "value": {
442
718
  "name": "GeneralError",
443
- "message": "component.error",
719
+ "message": "errorMessage",
444
720
  "properties": {
445
721
  "foo": "bar"
446
722
  }
@@ -461,7 +737,7 @@
461
737
  "exampleResponse": {
462
738
  "value": {
463
739
  "name": "UnauthorizedError",
464
- "message": "component.error"
740
+ "message": "errorMessage"
465
741
  }
466
742
  }
467
743
  }
@@ -479,7 +755,7 @@
479
755
  "exampleResponse": {
480
756
  "value": {
481
757
  "name": "NotFoundError",
482
- "message": "component.error",
758
+ "message": "errorMessage",
483
759
  "properties": {
484
760
  "notFoundId": "1"
485
761
  }
@@ -500,7 +776,108 @@
500
776
  "exampleResponse": {
501
777
  "value": {
502
778
  "name": "InternalServerError",
503
- "message": "component.error"
779
+ "message": "errorMessage"
780
+ }
781
+ }
782
+ }
783
+ }
784
+ }
785
+ }
786
+ }
787
+ }
788
+ },
789
+ "/entity-storage/count": {
790
+ "get": {
791
+ "operationId": "entityStorageCount",
792
+ "summary": "Count entries in entity storage.",
793
+ "tags": [
794
+ "EntityStorage"
795
+ ],
796
+ "security": [
797
+ {
798
+ "jwtBearerAuthScheme": []
799
+ }
800
+ ],
801
+ "requestBody": {
802
+ "description": "Count the entries in entity storage.",
803
+ "required": true,
804
+ "content": {
805
+ "text/plain": {
806
+ "schema": {
807
+ "$ref": "#/components/schemas/EntityStorageCountRequest"
808
+ }
809
+ }
810
+ }
811
+ },
812
+ "responses": {
813
+ "200": {
814
+ "description": "The response for counting entries in entity storage.",
815
+ "content": {
816
+ "application/json": {
817
+ "schema": {
818
+ "$ref": "#/components/schemas/EntityStorageCountResponse"
819
+ },
820
+ "examples": {
821
+ "entityStorageCountResponseExample": {
822
+ "value": {
823
+ "count": 1
824
+ }
825
+ }
826
+ }
827
+ }
828
+ }
829
+ },
830
+ "400": {
831
+ "description": "The server cannot process the request, see the content for more details.",
832
+ "content": {
833
+ "application/json": {
834
+ "schema": {
835
+ "$ref": "#/components/schemas/Error"
836
+ },
837
+ "examples": {
838
+ "exampleResponse": {
839
+ "value": {
840
+ "name": "GeneralError",
841
+ "message": "errorMessage",
842
+ "properties": {
843
+ "foo": "bar"
844
+ }
845
+ }
846
+ }
847
+ }
848
+ }
849
+ }
850
+ },
851
+ "401": {
852
+ "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
853
+ "content": {
854
+ "application/json": {
855
+ "schema": {
856
+ "$ref": "#/components/schemas/Error"
857
+ },
858
+ "examples": {
859
+ "exampleResponse": {
860
+ "value": {
861
+ "name": "UnauthorizedError",
862
+ "message": "errorMessage"
863
+ }
864
+ }
865
+ }
866
+ }
867
+ }
868
+ },
869
+ "500": {
870
+ "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
871
+ "content": {
872
+ "application/json": {
873
+ "schema": {
874
+ "$ref": "#/components/schemas/Error"
875
+ },
876
+ "examples": {
877
+ "exampleResponse": {
878
+ "value": {
879
+ "name": "InternalServerError",
880
+ "message": "errorMessage"
504
881
  }
505
882
  }
506
883
  }
@@ -513,6 +890,27 @@
513
890
  },
514
891
  "components": {
515
892
  "schemas": {
893
+ "EntityStorageCountRequest": {
894
+ "description": "Count the entries in entity storage.",
895
+ "type": "object"
896
+ },
897
+ "EntityStorageCountResponse": {
898
+ "type": "object",
899
+ "properties": {
900
+ "count": {
901
+ "type": "number",
902
+ "description": "The total count of entities."
903
+ }
904
+ },
905
+ "required": [
906
+ "count"
907
+ ],
908
+ "description": "The body of the response."
909
+ },
910
+ "EntityStorageEmptyRequest": {
911
+ "description": "Remove all entries from entity storage.",
912
+ "type": "object"
913
+ },
516
914
  "EntityStorageGetResponse": {
517
915
  "description": "The data for the requested entity."
518
916
  },
@@ -521,11 +919,8 @@
521
919
  "properties": {
522
920
  "entities": {
523
921
  "type": "array",
524
- "items": false,
525
- "description": "The entities from the query.",
526
- "prefixItems": [
527
- {}
528
- ]
922
+ "items": {},
923
+ "description": "The entities from the query."
529
924
  },
530
925
  "cursor": {
531
926
  "type": "string",
@@ -535,13 +930,25 @@
535
930
  "required": [
536
931
  "entities"
537
932
  ],
538
- "additionalProperties": false,
539
933
  "description": "The list of entries from the query."
540
934
  },
935
+ "EntityStorageRemoveBatchRequest": {
936
+ "type": "array",
937
+ "items": {
938
+ "type": "string"
939
+ },
940
+ "description": "The ids of the entities to remove."
941
+ },
942
+ "EntityStorageSetBatchRequest": {
943
+ "type": "array",
944
+ "items": {},
945
+ "description": "The entities to set."
946
+ },
541
947
  "EntityStorageSetRequest": {
542
948
  "description": "The data to be used in the entity."
543
949
  },
544
950
  "Error": {
951
+ "description": "Model to describe serialized error.",
545
952
  "type": "object",
546
953
  "properties": {
547
954
  "name": {
@@ -550,7 +957,7 @@
550
957
  },
551
958
  "message": {
552
959
  "type": "string",
553
- "description": "The message for the error."
960
+ "description": "The message for the error as an i18n key."
554
961
  },
555
962
  "source": {
556
963
  "type": "string",
@@ -572,63 +979,35 @@
572
979
  "required": [
573
980
  "name",
574
981
  "message"
575
- ],
576
- "additionalProperties": false,
577
- "description": "Model to describe serialized error."
982
+ ]
578
983
  },
579
984
  "NotFoundResponse": {
580
985
  "type": "object",
581
- "additionalProperties": false,
582
986
  "properties": {
583
987
  "notFoundId": {
584
988
  "type": "string",
585
989
  "description": "The id if the item that was not found."
586
- },
587
- "name": {
588
- "type": "string",
589
- "description": "The name for the error."
590
- },
591
- "message": {
592
- "type": "string",
593
- "description": "The message for the error."
594
- },
595
- "source": {
596
- "type": "string",
597
- "description": "The source of the error."
598
- },
599
- "properties": {
600
- "type": "object",
601
- "additionalProperties": {},
602
- "description": "Any additional information for the error."
603
- },
604
- "stack": {
605
- "type": "string",
606
- "description": "The stack trace for the error."
607
- },
608
- "cause": {
609
- "$ref": "#/components/schemas/Error"
610
990
  }
611
991
  },
612
- "required": [
613
- "message",
614
- "name"
992
+ "allOf": [
993
+ {
994
+ "$ref": "#/components/schemas/Error"
995
+ }
615
996
  ],
616
997
  "description": "The body which contains the error."
617
998
  },
618
999
  "SortDirection": {
1000
+ "description": "The sort directions.",
619
1001
  "anyOf": [
620
1002
  {
621
- "type": "string",
622
1003
  "const": "asc",
623
1004
  "description": "Ascending."
624
1005
  },
625
1006
  {
626
- "type": "string",
627
1007
  "const": "desc",
628
1008
  "description": "Descending."
629
1009
  }
630
- ],
631
- "description": "The sort directions."
1010
+ ]
632
1011
  }
633
1012
  },
634
1013
  "securitySchemes": {