@twin.org/entity-storage-connector-memory 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.
@@ -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);
@@ -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);
@@ -1 +1,2 @@
1
1
  export * from "./memoryEntityStorageConnector";
2
+ export * from "./models/IMemoryEntityStorageConnectorConstructorOptions";
@@ -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.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Options for the Memory Entity Storage Connector constructor.
3
+ */
4
+ export interface IMemoryEntityStorageConnectorConstructorOptions {
5
+ /**
6
+ * The schema for the entity.
7
+ */
8
+ entitySchema: string;
9
+ }
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/entity-storage-connector-memory - Changelog
2
2
 
3
- ## v0.0.1-next.13
3
+ ## v0.0.1-next.15
4
4
 
5
5
  - Initial Release
@@ -20,13 +20,11 @@ Create a new instance of MemoryEntityStorageConnector.
20
20
 
21
21
  #### Parameters
22
22
 
23
- **options**
23
+ ##### options
24
24
 
25
- The options for the connector.
26
-
27
- • **options.entitySchema**: `string`
25
+ [`IMemoryEntityStorageConnectorConstructorOptions`](../interfaces/IMemoryEntityStorageConnectorConstructorOptions.md)
28
26
 
29
- The schema for the entity.
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`\<`unknown`\>
49
+ > **getSchema**(): `IEntitySchema`
52
50
 
53
51
  Get the schema for the entities.
54
52
 
55
53
  #### Returns
56
54
 
57
- `IEntitySchema`\<`unknown`\>
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
- **id**: `string`
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
- **secondaryIndex?**: keyof `T`
79
+ ##### secondaryIndex?
80
+
81
+ keyof `T`
80
82
 
81
83
  Get the item using a secondary index.
82
84
 
83
- **conditions?**: `object`[]
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
- **entity**: `T`
111
+ ##### entity
112
+
113
+ `T`
108
114
 
109
115
  The entity to set.
110
116
 
111
- **conditions?**: `object`[]
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
- **id**: `string`
143
+ ##### id
144
+
145
+ `string`
136
146
 
137
147
  The id of the entity to remove.
138
148
 
139
- **conditions?**: `object`[]
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`\<`object`\>
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
- **conditions?**: `EntityCondition`\<`T`\>
175
+ ##### conditions?
176
+
177
+ `EntityCondition`\<`T`\>
164
178
 
165
179
  The conditions to match for the entities.
166
180
 
167
- **sortProperties?**: `object`[]
181
+ ##### sortProperties?
182
+
183
+ `object`[]
168
184
 
169
185
  The optional sort order.
170
186
 
171
- **properties?**: keyof `T`[]
187
+ ##### properties?
188
+
189
+ keyof `T`[]
172
190
 
173
191
  The optional properties to return, defaults to all.
174
192
 
175
- **cursor?**: `string`
193
+ ##### cursor?
194
+
195
+ `string`
176
196
 
177
197
  The cursor to request the next page of entities.
178
198
 
179
- **pageSize?**: `number`
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`\<`object`\>
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`
@@ -3,3 +3,7 @@
3
3
  ## Classes
4
4
 
5
5
  - [MemoryEntityStorageConnector](classes/MemoryEntityStorageConnector.md)
6
+
7
+ ## Interfaces
8
+
9
+ - [IMemoryEntityStorageConnectorConstructorOptions](interfaces/IMemoryEntityStorageConnectorConstructorOptions.md)
@@ -0,0 +1,11 @@
1
+ # Interface: IMemoryEntityStorageConnectorConstructorOptions
2
+
3
+ Options for the Memory Entity Storage Connector constructor.
4
+
5
+ ## Properties
6
+
7
+ ### entitySchema
8
+
9
+ > **entitySchema**: `string`
10
+
11
+ The schema for the entity.
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.13",
3
+ "version": "0.0.1-next.15",
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.13",
19
+ "@twin.org/entity-storage-models": "0.0.1-next.15",
20
20
  "@twin.org/nameof": "next"
21
21
  },
22
22
  "main": "./dist/cjs/index.cjs",
@@ -28,7 +28,7 @@
28
28
  "import": "./dist/esm/index.mjs",
29
29
  "types": "./dist/types/index.d.ts"
30
30
  },
31
- "./locales": "./locales"
31
+ "./locales/*.json": "./locales/*.json"
32
32
  },
33
33
  "files": [
34
34
  "dist/cjs",