@twin.org/entity-storage-connector-file 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 +2 -2
- package/docs/changelog.md +17 -1
- package/docs/examples.md +69 -1
- package/docs/reference/classes/FileEntityStorageConnector.md +8 -8
- package/docs/reference/interfaces/IFileEntityStorageConnectorConfig.md +1 -1
- package/docs/reference/interfaces/IFileEntityStorageConnectorConstructorOptions.md +3 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Entity Storage Connector File
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package provides a file-backed backend for persisting entities on local or mounted disks in straightforward environments. 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,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.3-next.7](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-file-v0.0.3-next.6...entity-storage-connector-file-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
|
|
16
|
+
* devDependencies
|
|
17
|
+
* @twin.org/entity-storage-connector-memory bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
2
18
|
|
|
3
19
|
## [0.0.3-next.6](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-file-v0.0.3-next.5...entity-storage-connector-file-v0.0.3-next.6) (2026-01-21)
|
|
4
20
|
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,69 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Entity Storage Connector File Examples
|
|
2
|
+
|
|
3
|
+
Use this page to see local-file storage workflows for bootstrapping, entity lifecycle operations, and filtered querying.
|
|
4
|
+
|
|
5
|
+
## FileEntityStorageConnector
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import {
|
|
9
|
+
FileEntityStorageConnector,
|
|
10
|
+
type IFileEntityStorageConnectorConstructorOptions
|
|
11
|
+
} from '@twin.org/entity-storage-connector-file';
|
|
12
|
+
import {
|
|
13
|
+
ComparisonOperator,
|
|
14
|
+
LogicalOperator,
|
|
15
|
+
SortDirection,
|
|
16
|
+
type EntityCondition
|
|
17
|
+
} from '@twin.org/entity';
|
|
18
|
+
|
|
19
|
+
interface Profile {
|
|
20
|
+
id: string;
|
|
21
|
+
email: string;
|
|
22
|
+
status: 'active' | 'inactive';
|
|
23
|
+
createdAt: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const options: IFileEntityStorageConnectorConstructorOptions = {
|
|
27
|
+
entitySchema: 'Profile',
|
|
28
|
+
config: {
|
|
29
|
+
directory: './data/profiles'
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const connector = new FileEntityStorageConnector<Profile>(options);
|
|
34
|
+
await connector.bootstrap();
|
|
35
|
+
|
|
36
|
+
const className = connector.className();
|
|
37
|
+
const schema = connector.getSchema();
|
|
38
|
+
|
|
39
|
+
await connector.set({
|
|
40
|
+
id: 'profile-1',
|
|
41
|
+
email: 'ada@example.com',
|
|
42
|
+
status: 'active',
|
|
43
|
+
createdAt: '2026-03-09T10:30:00.000Z'
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const byPrimaryKey = await connector.get('profile-1');
|
|
47
|
+
const bySecondaryIndex = await connector.get('ada@example.com', 'email');
|
|
48
|
+
|
|
49
|
+
const activeCondition: EntityCondition<Profile> = {
|
|
50
|
+
logicalOperator: LogicalOperator.And,
|
|
51
|
+
conditions: [
|
|
52
|
+
{
|
|
53
|
+
property: 'status',
|
|
54
|
+
comparison: ComparisonOperator.Equals,
|
|
55
|
+
value: 'active'
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const result = await connector.query(
|
|
61
|
+
activeCondition,
|
|
62
|
+
[{ property: 'createdAt', sortDirection: SortDirection.Descending }],
|
|
63
|
+
['id', 'email', 'status'],
|
|
64
|
+
undefined,
|
|
65
|
+
25
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
await connector.remove('profile-1');
|
|
69
|
+
```
|
|
@@ -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
|
-
### bootstrap()
|
|
45
|
+
### bootstrap() {#bootstrap}
|
|
46
46
|
|
|
47
47
|
> **bootstrap**(`nodeLoggingComponentType?`): `Promise`\<`boolean`\>
|
|
48
48
|
|
|
@@ -68,7 +68,7 @@ True if the bootstrapping process was successful.
|
|
|
68
68
|
|
|
69
69
|
***
|
|
70
70
|
|
|
71
|
-
### className()
|
|
71
|
+
### className() {#classname}
|
|
72
72
|
|
|
73
73
|
> **className**(): `string`
|
|
74
74
|
|
|
@@ -86,7 +86,7 @@ The class name of the component.
|
|
|
86
86
|
|
|
87
87
|
***
|
|
88
88
|
|
|
89
|
-
### getSchema()
|
|
89
|
+
### getSchema() {#getschema}
|
|
90
90
|
|
|
91
91
|
> **getSchema**(): `IEntitySchema`
|
|
92
92
|
|
|
@@ -104,7 +104,7 @@ The schema for the entities.
|
|
|
104
104
|
|
|
105
105
|
***
|
|
106
106
|
|
|
107
|
-
### get()
|
|
107
|
+
### get() {#get}
|
|
108
108
|
|
|
109
109
|
> **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`T` \| `undefined`\>
|
|
110
110
|
|
|
@@ -142,7 +142,7 @@ The object if it can be found or undefined.
|
|
|
142
142
|
|
|
143
143
|
***
|
|
144
144
|
|
|
145
|
-
### set()
|
|
145
|
+
### set() {#set}
|
|
146
146
|
|
|
147
147
|
> **set**(`entity`, `conditions?`): `Promise`\<`void`\>
|
|
148
148
|
|
|
@@ -174,7 +174,7 @@ The id of the entity.
|
|
|
174
174
|
|
|
175
175
|
***
|
|
176
176
|
|
|
177
|
-
### remove()
|
|
177
|
+
### remove() {#remove}
|
|
178
178
|
|
|
179
179
|
> **remove**(`id`, `conditions?`): `Promise`\<`void`\>
|
|
180
180
|
|
|
@@ -206,7 +206,7 @@ Nothing.
|
|
|
206
206
|
|
|
207
207
|
***
|
|
208
208
|
|
|
209
|
-
### query()
|
|
209
|
+
### query() {#query}
|
|
210
210
|
|
|
211
211
|
> **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
212
212
|
|
|
@@ -4,7 +4,7 @@ Options for the File 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 name of the entity schema.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### partitionContextIds?
|
|
15
|
+
### partitionContextIds? {#partitioncontextids}
|
|
16
16
|
|
|
17
17
|
> `optional` **partitionContextIds**: `string`[]
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ The keys to use from the context ids to create partitions.
|
|
|
20
20
|
|
|
21
21
|
***
|
|
22
22
|
|
|
23
|
-
### config
|
|
23
|
+
### config {#config}
|
|
24
24
|
|
|
25
25
|
> **config**: [`IFileEntityStorageConnectorConfig`](IFileEntityStorageConnectorConfig.md)
|
|
26
26
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-connector-file",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.7",
|
|
4
|
+
"description": "File-based connector that stores entities on disk for straightforward deployments.",
|
|
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/logging-models": "next",
|
|
22
22
|
"@twin.org/nameof": "next"
|
|
23
23
|
},
|