@twin.org/entity-storage-connector-dynamodb 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 +7 -12
- package/docs/changelog.md +17 -1
- package/docs/examples.md +96 -1
- package/docs/reference/classes/DynamoDbEntityStorageConnector.md +9 -9
- package/docs/reference/interfaces/IDynamoDbEntityStorageConnectorConfig.md +7 -13
- package/docs/reference/interfaces/IDynamoDbEntityStorageConnectorConstructorOptions.md +4 -4
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Entity Storage Connector DynamoDB
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package provides an Amazon DynamoDB backend for managed NoSQL storage in cloud-native deployments. 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
|
|
|
@@ -8,18 +8,13 @@ Entity Storage connector implementation using Dynamo DB storage.
|
|
|
8
8
|
npm install @twin.org/entity-storage-connector-dynamodb
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Docker
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
To perform testing of this component it may be necessary to launch a local instance to communicate with.
|
|
14
14
|
|
|
15
|
-
```
|
|
16
|
-
docker
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Afterwards you can run the tests as follows:
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
|
-
npm run test
|
|
15
|
+
```shell
|
|
16
|
+
docker pull amazon/dynamodb-local:latest
|
|
17
|
+
docker run -d --name twin-entity-storage-dynamodb -p 10000:8000 amazon/dynamodb-local:latest
|
|
23
18
|
```
|
|
24
19
|
|
|
25
20
|
## Examples
|
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-dynamodb-v0.0.3-next.6...entity-storage-connector-dynamodb-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-dynamodb-v0.0.3-next.5...entity-storage-connector-dynamodb-v0.0.3-next.6) (2026-01-21)
|
|
4
20
|
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,96 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Entity Storage Connector DynamoDB Examples
|
|
2
|
+
|
|
3
|
+
These examples show a complete flow from connector setup through reads, writes, filtered queries, and table maintenance tasks.
|
|
4
|
+
|
|
5
|
+
## DynamoDbEntityStorageConnector
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import {
|
|
9
|
+
DynamoDbEntityStorageConnector,
|
|
10
|
+
type IDynamoDbEntityStorageConnectorConstructorOptions
|
|
11
|
+
} from '@twin.org/entity-storage-connector-dynamodb';
|
|
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: IDynamoDbEntityStorageConnectorConstructorOptions = {
|
|
27
|
+
entitySchema: 'Profile',
|
|
28
|
+
config: {
|
|
29
|
+
region: 'eu-west-1',
|
|
30
|
+
authMode: 'credentials',
|
|
31
|
+
accessKeyId: 'local-access-key',
|
|
32
|
+
secretAccessKey: 'local-secret-key',
|
|
33
|
+
tableName: 'profiles',
|
|
34
|
+
endpoint: 'http://localhost:10000'
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const connector = new DynamoDbEntityStorageConnector<Profile>(options);
|
|
39
|
+
await connector.bootstrap();
|
|
40
|
+
|
|
41
|
+
const className = connector.className();
|
|
42
|
+
const schema = connector.getSchema();
|
|
43
|
+
|
|
44
|
+
await connector.set({
|
|
45
|
+
id: 'profile-1',
|
|
46
|
+
email: 'ada@example.com',
|
|
47
|
+
status: 'active',
|
|
48
|
+
createdAt: '2026-03-09T10:30:00.000Z'
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const byPrimaryKey = await connector.get('profile-1');
|
|
52
|
+
const bySecondaryIndex = await connector.get('ada@example.com', 'email');
|
|
53
|
+
|
|
54
|
+
const activeCondition: EntityCondition<Profile> = {
|
|
55
|
+
logicalOperator: LogicalOperator.And,
|
|
56
|
+
conditions: [
|
|
57
|
+
{
|
|
58
|
+
property: 'status',
|
|
59
|
+
comparison: ComparisonOperator.Equals,
|
|
60
|
+
value: 'active'
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const result = await connector.query(
|
|
66
|
+
activeCondition,
|
|
67
|
+
[{ property: 'createdAt', sortDirection: SortDirection.Descending }],
|
|
68
|
+
['id', 'email', 'status'],
|
|
69
|
+
undefined,
|
|
70
|
+
25
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
await connector.remove('profile-1');
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { DynamoDbEntityStorageConnector } from '@twin.org/entity-storage-connector-dynamodb';
|
|
78
|
+
|
|
79
|
+
interface Profile {
|
|
80
|
+
id: string;
|
|
81
|
+
email: string;
|
|
82
|
+
status: 'active' | 'inactive';
|
|
83
|
+
createdAt: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const connector = new DynamoDbEntityStorageConnector<Profile>({
|
|
87
|
+
entitySchema: 'Profile',
|
|
88
|
+
config: {
|
|
89
|
+
region: 'eu-west-1',
|
|
90
|
+
authMode: 'pod',
|
|
91
|
+
tableName: 'profiles'
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
await connector.bootstrap('logging');
|
|
96
|
+
```
|
|
@@ -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
|
-
### bootstrap()
|
|
81
|
+
### bootstrap() {#bootstrap}
|
|
82
82
|
|
|
83
83
|
> **bootstrap**(`nodeLoggingComponentType?`): `Promise`\<`boolean`\>
|
|
84
84
|
|
|
@@ -104,7 +104,7 @@ True if the bootstrapping process was successful.
|
|
|
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
|
|
|
@@ -257,7 +257,7 @@ and a cursor which can be used to request more entities.
|
|
|
257
257
|
|
|
258
258
|
***
|
|
259
259
|
|
|
260
|
-
### tableDelete()
|
|
260
|
+
### tableDelete() {#tabledelete}
|
|
261
261
|
|
|
262
262
|
> **tableDelete**(): `Promise`\<`void`\>
|
|
263
263
|
|
|
@@ -4,7 +4,7 @@ Configuration for the Dynamo DB Entity Storage Connector.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### region
|
|
7
|
+
### region {#region}
|
|
8
8
|
|
|
9
9
|
> **region**: `string`
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ The region for the AWS connection.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### authMode?
|
|
15
|
+
### authMode? {#authmode}
|
|
16
16
|
|
|
17
17
|
> `optional` **authMode**: `"credentials"` \| `"pod"`
|
|
18
18
|
|
|
@@ -20,15 +20,9 @@ The authentication mode.
|
|
|
20
20
|
- "credentials": Use access key ID and secret access key.
|
|
21
21
|
- "pod": Use IAM role attached to the pod (e.g., in EKS).
|
|
22
22
|
|
|
23
|
-
#### Default
|
|
24
|
-
|
|
25
|
-
```ts
|
|
26
|
-
credentials
|
|
27
|
-
```
|
|
28
|
-
|
|
29
23
|
***
|
|
30
24
|
|
|
31
|
-
### accessKeyId?
|
|
25
|
+
### accessKeyId? {#accesskeyid}
|
|
32
26
|
|
|
33
27
|
> `optional` **accessKeyId**: `string`
|
|
34
28
|
|
|
@@ -36,7 +30,7 @@ The AWS access key ID.
|
|
|
36
30
|
|
|
37
31
|
***
|
|
38
32
|
|
|
39
|
-
### secretAccessKey?
|
|
33
|
+
### secretAccessKey? {#secretaccesskey}
|
|
40
34
|
|
|
41
35
|
> `optional` **secretAccessKey**: `string`
|
|
42
36
|
|
|
@@ -44,7 +38,7 @@ The AWS secret access key.
|
|
|
44
38
|
|
|
45
39
|
***
|
|
46
40
|
|
|
47
|
-
### tableName
|
|
41
|
+
### tableName {#tablename}
|
|
48
42
|
|
|
49
43
|
> **tableName**: `string`
|
|
50
44
|
|
|
@@ -52,7 +46,7 @@ The name of the table for the storage.
|
|
|
52
46
|
|
|
53
47
|
***
|
|
54
48
|
|
|
55
|
-
### endpoint?
|
|
49
|
+
### endpoint? {#endpoint}
|
|
56
50
|
|
|
57
51
|
> `optional` **endpoint**: `string`
|
|
58
52
|
|
|
@@ -60,7 +54,7 @@ AWS endpoint, not usually required but could be used for local DynamoDB instance
|
|
|
60
54
|
|
|
61
55
|
***
|
|
62
56
|
|
|
63
|
-
### connectionTimeoutMs?
|
|
57
|
+
### connectionTimeoutMs? {#connectiontimeoutms}
|
|
64
58
|
|
|
65
59
|
> `optional` **connectionTimeoutMs**: `number`
|
|
66
60
|
|
|
@@ -4,7 +4,7 @@ Options for the Dynamo DB 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
|
|
|
@@ -20,7 +20,7 @@ The keys to use from the context ids to create partitions.
|
|
|
20
20
|
|
|
21
21
|
***
|
|
22
22
|
|
|
23
|
-
### loggingComponentType?
|
|
23
|
+
### loggingComponentType? {#loggingcomponenttype}
|
|
24
24
|
|
|
25
25
|
> `optional` **loggingComponentType**: `string`
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ The type of logging component to use, defaults to no logging.
|
|
|
28
28
|
|
|
29
29
|
***
|
|
30
30
|
|
|
31
|
-
### config
|
|
31
|
+
### config {#config}
|
|
32
32
|
|
|
33
33
|
> **config**: [`IDynamoDbEntityStorageConnectorConfig`](IDynamoDbEntityStorageConnectorConfig.md)
|
|
34
34
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-connector-dynamodb",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.7",
|
|
4
|
+
"description": "Amazon DynamoDB connector for managed NoSQL persistence.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/twinfoundation/entity-storage.git",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@aws-sdk/client-dynamodb": "3.
|
|
18
|
-
"@aws-sdk/lib-dynamodb": "3.
|
|
19
|
-
"@aws-sdk/util-dynamodb": "3.
|
|
17
|
+
"@aws-sdk/client-dynamodb": "3.1008",
|
|
18
|
+
"@aws-sdk/lib-dynamodb": "3.1008",
|
|
19
|
+
"@aws-sdk/util-dynamodb": "3.996",
|
|
20
20
|
"@twin.org/context": "next",
|
|
21
21
|
"@twin.org/core": "next",
|
|
22
22
|
"@twin.org/entity": "next",
|
|
23
|
-
"@twin.org/entity-storage-models": "0.0.3-next.
|
|
23
|
+
"@twin.org/entity-storage-models": "0.0.3-next.7",
|
|
24
24
|
"@twin.org/logging-models": "next",
|
|
25
25
|
"@twin.org/nameof": "next"
|
|
26
26
|
},
|