@twin.org/entity-storage-service 0.0.1-next.13 → 0.0.1-next.15

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