@twin.org/entity-storage-connector-memory 0.0.1-next.14 → 0.0.1-next.16
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 -1
- package/dist/esm/index.mjs +0 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/memoryEntityStorageConnector.d.ts +2 -4
- package/dist/types/models/IMemoryEntityStorageConnectorConstructorOptions.d.ts +9 -0
- package/docs/changelog.md +1 -1
- package/docs/reference/classes/MemoryEntityStorageConnector.md +43 -33
- package/docs/reference/index.md +4 -0
- package/docs/reference/interfaces/IMemoryEntityStorageConnectorConstructorOptions.md +11 -0
- package/package.json +4 -4
package/dist/cjs/index.cjs
CHANGED
@@ -36,7 +36,6 @@ class MemoryEntityStorageConnector {
|
|
36
36
|
/**
|
37
37
|
* Create a new instance of MemoryEntityStorageConnector.
|
38
38
|
* @param options The options for the connector.
|
39
|
-
* @param options.entitySchema The schema for the entity.
|
40
39
|
*/
|
41
40
|
constructor(options) {
|
42
41
|
core.Guards.object(this.CLASS_NAME, "options", options);
|
package/dist/esm/index.mjs
CHANGED
@@ -34,7 +34,6 @@ class MemoryEntityStorageConnector {
|
|
34
34
|
/**
|
35
35
|
* Create a new instance of MemoryEntityStorageConnector.
|
36
36
|
* @param options The options for the connector.
|
37
|
-
* @param options.entitySchema The schema for the entity.
|
38
37
|
*/
|
39
38
|
constructor(options) {
|
40
39
|
Guards.object(this.CLASS_NAME, "options", options);
|
package/dist/types/index.d.ts
CHANGED
@@ -1,5 +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 { IMemoryEntityStorageConnectorConstructorOptions } from "./models/IMemoryEntityStorageConnectorConstructorOptions";
|
3
4
|
/**
|
4
5
|
* Class for performing entity storage operations in-memory.
|
5
6
|
*/
|
@@ -11,11 +12,8 @@ export declare class MemoryEntityStorageConnector<T = unknown> implements IEntit
|
|
11
12
|
/**
|
12
13
|
* Create a new instance of MemoryEntityStorageConnector.
|
13
14
|
* @param options The options for the connector.
|
14
|
-
* @param options.entitySchema The schema for the entity.
|
15
15
|
*/
|
16
|
-
constructor(options:
|
17
|
-
entitySchema: string;
|
18
|
-
});
|
16
|
+
constructor(options: IMemoryEntityStorageConnectorConstructorOptions);
|
19
17
|
/**
|
20
18
|
* Get the schema for the entities.
|
21
19
|
* @returns The schema for the entities.
|
package/docs/changelog.md
CHANGED
@@ -20,13 +20,11 @@ Create a new instance of MemoryEntityStorageConnector.
|
|
20
20
|
|
21
21
|
#### Parameters
|
22
22
|
|
23
|
-
|
23
|
+
##### options
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
• **options.entitySchema**: `string`
|
25
|
+
[`IMemoryEntityStorageConnectorConstructorOptions`](../interfaces/IMemoryEntityStorageConnectorConstructorOptions.md)
|
28
26
|
|
29
|
-
The
|
27
|
+
The options for the connector.
|
30
28
|
|
31
29
|
#### Returns
|
32
30
|
|
@@ -48,13 +46,13 @@ Runtime name for the class.
|
|
48
46
|
|
49
47
|
### getSchema()
|
50
48
|
|
51
|
-
> **getSchema**(): `IEntitySchema
|
49
|
+
> **getSchema**(): `IEntitySchema`
|
52
50
|
|
53
51
|
Get the schema for the entities.
|
54
52
|
|
55
53
|
#### Returns
|
56
54
|
|
57
|
-
`IEntitySchema
|
55
|
+
`IEntitySchema`
|
58
56
|
|
59
57
|
The schema for the entities.
|
60
58
|
|
@@ -72,15 +70,21 @@ Get an entity.
|
|
72
70
|
|
73
71
|
#### Parameters
|
74
72
|
|
75
|
-
|
73
|
+
##### id
|
74
|
+
|
75
|
+
`string`
|
76
76
|
|
77
77
|
The id of the entity to get, or the index value if secondaryIndex is set.
|
78
78
|
|
79
|
-
|
79
|
+
##### secondaryIndex?
|
80
|
+
|
81
|
+
keyof `T`
|
80
82
|
|
81
83
|
Get the item using a secondary index.
|
82
84
|
|
83
|
-
|
85
|
+
##### conditions?
|
86
|
+
|
87
|
+
`object`[]
|
84
88
|
|
85
89
|
The optional conditions to match for the entities.
|
86
90
|
|
@@ -104,11 +108,15 @@ Set an entity.
|
|
104
108
|
|
105
109
|
#### Parameters
|
106
110
|
|
107
|
-
|
111
|
+
##### entity
|
112
|
+
|
113
|
+
`T`
|
108
114
|
|
109
115
|
The entity to set.
|
110
116
|
|
111
|
-
|
117
|
+
##### conditions?
|
118
|
+
|
119
|
+
`object`[]
|
112
120
|
|
113
121
|
The optional conditions to match for the entities.
|
114
122
|
|
@@ -132,11 +140,15 @@ Remove the entity.
|
|
132
140
|
|
133
141
|
#### Parameters
|
134
142
|
|
135
|
-
|
143
|
+
##### id
|
144
|
+
|
145
|
+
`string`
|
136
146
|
|
137
147
|
The id of the entity to remove.
|
138
148
|
|
139
|
-
|
149
|
+
##### conditions?
|
150
|
+
|
151
|
+
`object`[]
|
140
152
|
|
141
153
|
The optional conditions to match for the entities.
|
142
154
|
|
@@ -154,51 +166,49 @@ Nothing.
|
|
154
166
|
|
155
167
|
### query()
|
156
168
|
|
157
|
-
> **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<`
|
169
|
+
> **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor`: `string`; \}\>
|
158
170
|
|
159
171
|
Find all the entities which match the conditions.
|
160
172
|
|
161
173
|
#### Parameters
|
162
174
|
|
163
|
-
|
175
|
+
##### conditions?
|
176
|
+
|
177
|
+
`EntityCondition`\<`T`\>
|
164
178
|
|
165
179
|
The conditions to match for the entities.
|
166
180
|
|
167
|
-
|
181
|
+
##### sortProperties?
|
182
|
+
|
183
|
+
`object`[]
|
168
184
|
|
169
185
|
The optional sort order.
|
170
186
|
|
171
|
-
|
187
|
+
##### properties?
|
188
|
+
|
189
|
+
keyof `T`[]
|
172
190
|
|
173
191
|
The optional properties to return, defaults to all.
|
174
192
|
|
175
|
-
|
193
|
+
##### cursor?
|
194
|
+
|
195
|
+
`string`
|
176
196
|
|
177
197
|
The cursor to request the next page of entities.
|
178
198
|
|
179
|
-
|
199
|
+
##### pageSize?
|
200
|
+
|
201
|
+
`number`
|
180
202
|
|
181
203
|
The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
182
204
|
|
183
205
|
#### Returns
|
184
206
|
|
185
|
-
`Promise`\<`
|
207
|
+
`Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor`: `string`; \}\>
|
186
208
|
|
187
209
|
All the entities for the storage matching the conditions,
|
188
210
|
and a cursor which can be used to request more entities.
|
189
211
|
|
190
|
-
##### entities
|
191
|
-
|
192
|
-
> **entities**: `Partial`\<`T`\>[]
|
193
|
-
|
194
|
-
The entities, which can be partial if a limited keys list was provided.
|
195
|
-
|
196
|
-
##### cursor?
|
197
|
-
|
198
|
-
> `optional` **cursor**: `string`
|
199
|
-
|
200
|
-
An optional cursor, when defined can be used to call find to get more entities.
|
201
|
-
|
202
212
|
#### Implementation of
|
203
213
|
|
204
214
|
`IEntityStorageConnector.query`
|
package/docs/reference/index.md
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@twin.org/entity-storage-connector-memory",
|
3
|
-
"version": "0.0.1-next.
|
3
|
+
"version": "0.0.1-next.16",
|
4
4
|
"description": "Entity Storage connector implementation using in-memory 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.16",
|
20
20
|
"@twin.org/nameof": "next"
|
21
21
|
},
|
22
22
|
"main": "./dist/cjs/index.cjs",
|
@@ -24,9 +24,9 @@
|
|
24
24
|
"types": "./dist/types/index.d.ts",
|
25
25
|
"exports": {
|
26
26
|
".": {
|
27
|
+
"types": "./dist/types/index.d.ts",
|
27
28
|
"require": "./dist/cjs/index.cjs",
|
28
|
-
"import": "./dist/esm/index.mjs"
|
29
|
-
"types": "./dist/types/index.d.ts"
|
29
|
+
"import": "./dist/esm/index.mjs"
|
30
30
|
},
|
31
31
|
"./locales/*.json": "./locales/*.json"
|
32
32
|
},
|