@twin.org/entity-storage-connector-file 0.0.1-next.14 → 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.
- package/dist/cjs/index.cjs +0 -2
- package/dist/esm/index.mjs +0 -2
- package/dist/types/fileEntityStorageConnector.d.ts +2 -7
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/IFileEntityStorageConnectorConstructorOptions.d.ts +14 -0
- package/docs/changelog.md +1 -1
- package/docs/reference/classes/FileEntityStorageConnector.md +46 -38
- package/docs/reference/index.md +1 -0
- package/docs/reference/interfaces/IFileEntityStorageConnectorConstructorOptions.md +19 -0
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -39,8 +39,6 @@ class FileEntityStorageConnector {
|
|
|
39
39
|
/**
|
|
40
40
|
* Create a new instance of FileEntityStorageConnector.
|
|
41
41
|
* @param options The options for the connector.
|
|
42
|
-
* @param options.entitySchema The name of the entity schema.
|
|
43
|
-
* @param options.config The configuration for the connector.
|
|
44
42
|
*/
|
|
45
43
|
constructor(options) {
|
|
46
44
|
core.Guards.object(this.CLASS_NAME, "options", options);
|
package/dist/esm/index.mjs
CHANGED
|
@@ -37,8 +37,6 @@ class FileEntityStorageConnector {
|
|
|
37
37
|
/**
|
|
38
38
|
* Create a new instance of FileEntityStorageConnector.
|
|
39
39
|
* @param options The options for the connector.
|
|
40
|
-
* @param options.entitySchema The name of the entity schema.
|
|
41
|
-
* @param options.config The configuration for the connector.
|
|
42
40
|
*/
|
|
43
41
|
constructor(options) {
|
|
44
42
|
Guards.object(this.CLASS_NAME, "options", options);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type EntityCondition, type IEntitySchema, type SortDirection } from "@twin.org/entity";
|
|
2
2
|
import type { IEntityStorageConnector } from "@twin.org/entity-storage-models";
|
|
3
|
-
import type {
|
|
3
|
+
import type { IFileEntityStorageConnectorConstructorOptions } from "./models/IFileEntityStorageConnectorConstructorOptions";
|
|
4
4
|
/**
|
|
5
5
|
* Class for performing entity storage operations in file.
|
|
6
6
|
*/
|
|
@@ -12,13 +12,8 @@ export declare class FileEntityStorageConnector<T = unknown> implements IEntityS
|
|
|
12
12
|
/**
|
|
13
13
|
* Create a new instance of FileEntityStorageConnector.
|
|
14
14
|
* @param options The options for the connector.
|
|
15
|
-
* @param options.entitySchema The name of the entity schema.
|
|
16
|
-
* @param options.config The configuration for the connector.
|
|
17
15
|
*/
|
|
18
|
-
constructor(options:
|
|
19
|
-
entitySchema: string;
|
|
20
|
-
config: IFileEntityStorageConnectorConfig;
|
|
21
|
-
});
|
|
16
|
+
constructor(options: IFileEntityStorageConnectorConstructorOptions);
|
|
22
17
|
/**
|
|
23
18
|
* Bootstrap the connector by creating and initializing any resources it needs.
|
|
24
19
|
* @param nodeLoggingConnectorType The node logging connector type, defaults to "node-logging".
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IFileEntityStorageConnectorConfig } from "./IFileEntityStorageConnectorConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the File Entity Storage Connector constructor.
|
|
4
|
+
*/
|
|
5
|
+
export interface IFileEntityStorageConnectorConstructorOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The name of the entity schema.
|
|
8
|
+
*/
|
|
9
|
+
entitySchema: string;
|
|
10
|
+
/**
|
|
11
|
+
* The configuration for the connector.
|
|
12
|
+
*/
|
|
13
|
+
config: IFileEntityStorageConnectorConfig;
|
|
14
|
+
}
|
package/docs/changelog.md
CHANGED
|
@@ -20,17 +20,11 @@ Create a new instance of FileEntityStorageConnector.
|
|
|
20
20
|
|
|
21
21
|
#### Parameters
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
##### options
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
• **options.entitySchema**: `string`
|
|
28
|
-
|
|
29
|
-
The name of the entity schema.
|
|
30
|
-
|
|
31
|
-
• **options.config**: [`IFileEntityStorageConnectorConfig`](../interfaces/IFileEntityStorageConnectorConfig.md)
|
|
25
|
+
[`IFileEntityStorageConnectorConstructorOptions`](../interfaces/IFileEntityStorageConnectorConstructorOptions.md)
|
|
32
26
|
|
|
33
|
-
The
|
|
27
|
+
The options for the connector.
|
|
34
28
|
|
|
35
29
|
#### Returns
|
|
36
30
|
|
|
@@ -58,7 +52,9 @@ Bootstrap the connector by creating and initializing any resources it needs.
|
|
|
58
52
|
|
|
59
53
|
#### Parameters
|
|
60
54
|
|
|
61
|
-
|
|
55
|
+
##### nodeLoggingConnectorType?
|
|
56
|
+
|
|
57
|
+
`string`
|
|
62
58
|
|
|
63
59
|
The node logging connector type, defaults to "node-logging".
|
|
64
60
|
|
|
@@ -76,13 +72,13 @@ True if the bootstrapping process was successful.
|
|
|
76
72
|
|
|
77
73
|
### getSchema()
|
|
78
74
|
|
|
79
|
-
> **getSchema**(): `IEntitySchema
|
|
75
|
+
> **getSchema**(): `IEntitySchema`
|
|
80
76
|
|
|
81
77
|
Get the schema for the entities.
|
|
82
78
|
|
|
83
79
|
#### Returns
|
|
84
80
|
|
|
85
|
-
`IEntitySchema
|
|
81
|
+
`IEntitySchema`
|
|
86
82
|
|
|
87
83
|
The schema for the entities.
|
|
88
84
|
|
|
@@ -100,15 +96,21 @@ Get an entity.
|
|
|
100
96
|
|
|
101
97
|
#### Parameters
|
|
102
98
|
|
|
103
|
-
|
|
99
|
+
##### id
|
|
100
|
+
|
|
101
|
+
`string`
|
|
104
102
|
|
|
105
103
|
The id of the entity to get, or the index value if secondaryIndex is set.
|
|
106
104
|
|
|
107
|
-
|
|
105
|
+
##### secondaryIndex?
|
|
106
|
+
|
|
107
|
+
keyof `T`
|
|
108
108
|
|
|
109
109
|
Get the item using a secondary index.
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
##### conditions?
|
|
112
|
+
|
|
113
|
+
`object`[]
|
|
112
114
|
|
|
113
115
|
The optional conditions to match for the entities.
|
|
114
116
|
|
|
@@ -132,11 +134,15 @@ Set an entity.
|
|
|
132
134
|
|
|
133
135
|
#### Parameters
|
|
134
136
|
|
|
135
|
-
|
|
137
|
+
##### entity
|
|
138
|
+
|
|
139
|
+
`T`
|
|
136
140
|
|
|
137
141
|
The entity to set.
|
|
138
142
|
|
|
139
|
-
|
|
143
|
+
##### conditions?
|
|
144
|
+
|
|
145
|
+
`object`[]
|
|
140
146
|
|
|
141
147
|
The optional conditions to match for the entities.
|
|
142
148
|
|
|
@@ -160,11 +166,15 @@ Remove the entity.
|
|
|
160
166
|
|
|
161
167
|
#### Parameters
|
|
162
168
|
|
|
163
|
-
|
|
169
|
+
##### id
|
|
170
|
+
|
|
171
|
+
`string`
|
|
164
172
|
|
|
165
173
|
The id of the entity to remove.
|
|
166
174
|
|
|
167
|
-
|
|
175
|
+
##### conditions?
|
|
176
|
+
|
|
177
|
+
`object`[]
|
|
168
178
|
|
|
169
179
|
The optional conditions to match for the entities.
|
|
170
180
|
|
|
@@ -182,51 +192,49 @@ Nothing.
|
|
|
182
192
|
|
|
183
193
|
### query()
|
|
184
194
|
|
|
185
|
-
> **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<`
|
|
195
|
+
> **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor`: `string`; \}\>
|
|
186
196
|
|
|
187
197
|
Find all the entities which match the conditions.
|
|
188
198
|
|
|
189
199
|
#### Parameters
|
|
190
200
|
|
|
191
|
-
|
|
201
|
+
##### conditions?
|
|
202
|
+
|
|
203
|
+
`EntityCondition`\<`T`\>
|
|
192
204
|
|
|
193
205
|
The conditions to match for the entities.
|
|
194
206
|
|
|
195
|
-
|
|
207
|
+
##### sortProperties?
|
|
208
|
+
|
|
209
|
+
`object`[]
|
|
196
210
|
|
|
197
211
|
The optional sort order.
|
|
198
212
|
|
|
199
|
-
|
|
213
|
+
##### properties?
|
|
214
|
+
|
|
215
|
+
keyof `T`[]
|
|
200
216
|
|
|
201
217
|
The optional properties to return, defaults to all.
|
|
202
218
|
|
|
203
|
-
|
|
219
|
+
##### cursor?
|
|
220
|
+
|
|
221
|
+
`string`
|
|
204
222
|
|
|
205
223
|
The cursor to request the next page of entities.
|
|
206
224
|
|
|
207
|
-
|
|
225
|
+
##### pageSize?
|
|
226
|
+
|
|
227
|
+
`number`
|
|
208
228
|
|
|
209
229
|
The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
|
210
230
|
|
|
211
231
|
#### Returns
|
|
212
232
|
|
|
213
|
-
`Promise`\<`
|
|
233
|
+
`Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor`: `string`; \}\>
|
|
214
234
|
|
|
215
235
|
All the entities for the storage matching the conditions,
|
|
216
236
|
and a cursor which can be used to request more entities.
|
|
217
237
|
|
|
218
|
-
##### entities
|
|
219
|
-
|
|
220
|
-
> **entities**: `Partial`\<`T`\>[]
|
|
221
|
-
|
|
222
|
-
The entities, which can be partial if a limited keys list was provided.
|
|
223
|
-
|
|
224
|
-
##### cursor?
|
|
225
|
-
|
|
226
|
-
> `optional` **cursor**: `string`
|
|
227
|
-
|
|
228
|
-
An optional cursor, when defined can be used to call find to get more entities.
|
|
229
|
-
|
|
230
238
|
#### Implementation of
|
|
231
239
|
|
|
232
240
|
`IEntityStorageConnector.query`
|
package/docs/reference/index.md
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Interface: IFileEntityStorageConnectorConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the File Entity Storage Connector constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### entitySchema
|
|
8
|
+
|
|
9
|
+
> **entitySchema**: `string`
|
|
10
|
+
|
|
11
|
+
The name of the entity schema.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### config
|
|
16
|
+
|
|
17
|
+
> **config**: [`IFileEntityStorageConnectorConfig`](IFileEntityStorageConnectorConfig.md)
|
|
18
|
+
|
|
19
|
+
The configuration for the connector.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-connector-file",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.15",
|
|
4
4
|
"description": "Entity Storage connector implementation using file storage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@twin.org/core": "next",
|
|
18
18
|
"@twin.org/entity": "next",
|
|
19
|
-
"@twin.org/entity-storage-models": "0.0.1-next.
|
|
19
|
+
"@twin.org/entity-storage-models": "0.0.1-next.15",
|
|
20
20
|
"@twin.org/logging-models": "next",
|
|
21
21
|
"@twin.org/nameof": "next"
|
|
22
22
|
},
|