@twin.org/entity-storage-connector-memory 0.0.3-next.6 → 0.0.3-next.7
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/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Entity Storage Connector Memory
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package provides an in-memory backend suited to local development, automated testing and short-lived workloads. It is designed to work with the wider storage ecosystem so applications can keep behaviour consistent across connectors and environments.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
package/docs/changelog.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.3-next.7](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-memory-v0.0.3-next.6...entity-storage-connector-memory-v0.0.3-next.7) (2026-03-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* adding tests and fixes for dot notation ([#76](https://github.com/twinfoundation/entity-storage/issues/76)) ([3879337](https://github.com/twinfoundation/entity-storage/commit/387933797e33543e4d8b2d49b8beeb792512a4ff))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/entity-storage-models bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
2
16
|
|
|
3
17
|
## [0.0.3-next.6](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-memory-v0.0.3-next.5...entity-storage-connector-memory-v0.0.3-next.6) (2026-01-21)
|
|
4
18
|
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,78 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Entity Storage Connector Memory Examples
|
|
2
|
+
|
|
3
|
+
Use these snippets to perform fast in-memory storage operations during development and unit testing.
|
|
4
|
+
|
|
5
|
+
## MemoryEntityStorageConnector
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { MemoryEntityStorageConnector } from '@twin.org/entity-storage-connector-memory';
|
|
9
|
+
import {
|
|
10
|
+
ComparisonOperator,
|
|
11
|
+
LogicalOperator,
|
|
12
|
+
SortDirection,
|
|
13
|
+
type EntityCondition
|
|
14
|
+
} from '@twin.org/entity';
|
|
15
|
+
|
|
16
|
+
interface Profile {
|
|
17
|
+
id: string;
|
|
18
|
+
email: string;
|
|
19
|
+
status: 'active' | 'inactive';
|
|
20
|
+
createdAt: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const connector = new MemoryEntityStorageConnector<Profile>({
|
|
24
|
+
entitySchema: 'Profile',
|
|
25
|
+
partitionContextIds: ['tenantId']
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const className = connector.className();
|
|
29
|
+
const schema = connector.getSchema();
|
|
30
|
+
|
|
31
|
+
await connector.set({
|
|
32
|
+
id: 'profile-1',
|
|
33
|
+
email: 'ada@example.com',
|
|
34
|
+
status: 'active',
|
|
35
|
+
createdAt: '2026-03-09T10:30:00.000Z'
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const byPrimaryKey = await connector.get('profile-1');
|
|
39
|
+
const bySecondaryIndex = await connector.get('ada@example.com', 'email');
|
|
40
|
+
|
|
41
|
+
const activeCondition: EntityCondition<Profile> = {
|
|
42
|
+
logicalOperator: LogicalOperator.And,
|
|
43
|
+
conditions: [
|
|
44
|
+
{
|
|
45
|
+
property: 'status',
|
|
46
|
+
comparison: ComparisonOperator.Equals,
|
|
47
|
+
value: 'active'
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const result = await connector.query(
|
|
53
|
+
activeCondition,
|
|
54
|
+
[{ property: 'createdAt', sortDirection: SortDirection.Descending }],
|
|
55
|
+
['id', 'email', 'status'],
|
|
56
|
+
undefined,
|
|
57
|
+
25
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
await connector.remove('profile-1');
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { MemoryEntityStorageConnector } from '@twin.org/entity-storage-connector-memory';
|
|
65
|
+
|
|
66
|
+
interface Profile {
|
|
67
|
+
id: string;
|
|
68
|
+
email: string;
|
|
69
|
+
status: 'active' | 'inactive';
|
|
70
|
+
createdAt: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const connector = new MemoryEntityStorageConnector<Profile>({
|
|
74
|
+
entitySchema: 'Profile'
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const store = connector.getStore();
|
|
78
|
+
```
|
|
@@ -34,7 +34,7 @@ The options for the connector.
|
|
|
34
34
|
|
|
35
35
|
## Properties
|
|
36
36
|
|
|
37
|
-
### CLASS\_NAME
|
|
37
|
+
### CLASS\_NAME {#class_name}
|
|
38
38
|
|
|
39
39
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
40
40
|
|
|
@@ -42,7 +42,7 @@ Runtime name for the class.
|
|
|
42
42
|
|
|
43
43
|
## Methods
|
|
44
44
|
|
|
45
|
-
### className()
|
|
45
|
+
### className() {#classname}
|
|
46
46
|
|
|
47
47
|
> **className**(): `string`
|
|
48
48
|
|
|
@@ -60,7 +60,7 @@ The class name of the component.
|
|
|
60
60
|
|
|
61
61
|
***
|
|
62
62
|
|
|
63
|
-
### getSchema()
|
|
63
|
+
### getSchema() {#getschema}
|
|
64
64
|
|
|
65
65
|
> **getSchema**(): `IEntitySchema`
|
|
66
66
|
|
|
@@ -78,7 +78,7 @@ The schema for the entities.
|
|
|
78
78
|
|
|
79
79
|
***
|
|
80
80
|
|
|
81
|
-
### get()
|
|
81
|
+
### get() {#get}
|
|
82
82
|
|
|
83
83
|
> **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`T` \| `undefined`\>
|
|
84
84
|
|
|
@@ -116,7 +116,7 @@ The object if it can be found or undefined.
|
|
|
116
116
|
|
|
117
117
|
***
|
|
118
118
|
|
|
119
|
-
### set()
|
|
119
|
+
### set() {#set}
|
|
120
120
|
|
|
121
121
|
> **set**(`entity`, `conditions?`): `Promise`\<`void`\>
|
|
122
122
|
|
|
@@ -148,7 +148,7 @@ The id of the entity.
|
|
|
148
148
|
|
|
149
149
|
***
|
|
150
150
|
|
|
151
|
-
### remove()
|
|
151
|
+
### remove() {#remove}
|
|
152
152
|
|
|
153
153
|
> **remove**(`id`, `conditions?`): `Promise`\<`void`\>
|
|
154
154
|
|
|
@@ -180,7 +180,7 @@ Nothing.
|
|
|
180
180
|
|
|
181
181
|
***
|
|
182
182
|
|
|
183
|
-
### query()
|
|
183
|
+
### query() {#query}
|
|
184
184
|
|
|
185
185
|
> **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
186
186
|
|
|
@@ -231,7 +231,7 @@ and a cursor which can be used to request more entities.
|
|
|
231
231
|
|
|
232
232
|
***
|
|
233
233
|
|
|
234
|
-
### getStore()
|
|
234
|
+
### getStore() {#getstore}
|
|
235
235
|
|
|
236
236
|
> **getStore**(): `T`[]
|
|
237
237
|
|
|
@@ -4,7 +4,7 @@ Options for the Memory Entity Storage Connector constructor.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### entitySchema
|
|
7
|
+
### entitySchema {#entityschema}
|
|
8
8
|
|
|
9
9
|
> **entitySchema**: `string`
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ The schema for the entity.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### partitionContextIds?
|
|
15
|
+
### partitionContextIds? {#partitioncontextids}
|
|
16
16
|
|
|
17
17
|
> `optional` **partitionContextIds**: `string`[]
|
|
18
18
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-connector-memory",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.7",
|
|
4
|
+
"description": "In-memory connector for local development, testing and short-lived workloads.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/twinfoundation/entity-storage.git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@twin.org/context": "next",
|
|
18
18
|
"@twin.org/core": "next",
|
|
19
19
|
"@twin.org/entity": "next",
|
|
20
|
-
"@twin.org/entity-storage-models": "0.0.3-next.
|
|
20
|
+
"@twin.org/entity-storage-models": "0.0.3-next.7",
|
|
21
21
|
"@twin.org/nameof": "next"
|
|
22
22
|
},
|
|
23
23
|
"main": "./dist/es/index.js",
|