@twin.org/entity-storage-connector-dynamodb 0.0.1-next.8 → 0.0.1
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 +192 -109
- package/dist/esm/index.mjs +192 -109
- package/dist/types/dynamoDbEntityStorageConnector.d.ts +18 -13
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/IDynamoDbEntityStorageConnectorConstructorOptions.d.ts +18 -0
- package/docs/changelog.md +106 -1
- package/docs/reference/classes/DynamoDbEntityStorageConnector.md +65 -47
- package/docs/reference/index.md +1 -0
- package/docs/reference/interfaces/IDynamoDbEntityStorageConnectorConstructorOptions.md +27 -0
- package/package.json +12 -12
|
@@ -4,7 +4,9 @@ Class for performing entity storage operations using Dynamo DB.
|
|
|
4
4
|
|
|
5
5
|
## Type Parameters
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### T
|
|
8
|
+
|
|
9
|
+
`T` = `unknown`
|
|
8
10
|
|
|
9
11
|
## Implements
|
|
10
12
|
|
|
@@ -12,33 +14,23 @@ Class for performing entity storage operations using Dynamo DB.
|
|
|
12
14
|
|
|
13
15
|
## Constructors
|
|
14
16
|
|
|
15
|
-
###
|
|
17
|
+
### Constructor
|
|
16
18
|
|
|
17
|
-
> **new DynamoDbEntityStorageConnector**\<`T`\>(`options`):
|
|
19
|
+
> **new DynamoDbEntityStorageConnector**\<`T`\>(`options`): `DynamoDbEntityStorageConnector`\<`T`\>
|
|
18
20
|
|
|
19
21
|
Create a new instance of DynamoDbEntityStorageConnector.
|
|
20
22
|
|
|
21
23
|
#### Parameters
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
The options for the connector.
|
|
26
|
-
|
|
27
|
-
• **options.entitySchema**: `string`
|
|
28
|
-
|
|
29
|
-
The schema for the entity.
|
|
25
|
+
##### options
|
|
30
26
|
|
|
31
|
-
|
|
27
|
+
[`IDynamoDbEntityStorageConnectorConstructorOptions`](../interfaces/IDynamoDbEntityStorageConnectorConstructorOptions.md)
|
|
32
28
|
|
|
33
|
-
The
|
|
34
|
-
|
|
35
|
-
• **options.config**: [`IDynamoDbEntityStorageConnectorConfig`](../interfaces/IDynamoDbEntityStorageConnectorConfig.md)
|
|
36
|
-
|
|
37
|
-
The configuration for the connector.
|
|
29
|
+
The options for the connector.
|
|
38
30
|
|
|
39
31
|
#### Returns
|
|
40
32
|
|
|
41
|
-
|
|
33
|
+
`DynamoDbEntityStorageConnector`\<`T`\>
|
|
42
34
|
|
|
43
35
|
## Properties
|
|
44
36
|
|
|
@@ -56,13 +48,15 @@ Runtime name for the class.
|
|
|
56
48
|
|
|
57
49
|
### bootstrap()
|
|
58
50
|
|
|
59
|
-
> **bootstrap**(`nodeLoggingConnectorType
|
|
51
|
+
> **bootstrap**(`nodeLoggingConnectorType?`): `Promise`\<`boolean`\>
|
|
60
52
|
|
|
61
53
|
Bootstrap the component by creating and initializing any resources it needs.
|
|
62
54
|
|
|
63
55
|
#### Parameters
|
|
64
56
|
|
|
65
|
-
|
|
57
|
+
##### nodeLoggingConnectorType?
|
|
58
|
+
|
|
59
|
+
`string`
|
|
66
60
|
|
|
67
61
|
The node logging connector type, defaults to "node-logging".
|
|
68
62
|
|
|
@@ -80,13 +74,13 @@ True if the bootstrapping process was successful.
|
|
|
80
74
|
|
|
81
75
|
### getSchema()
|
|
82
76
|
|
|
83
|
-
> **getSchema**(): `IEntitySchema
|
|
77
|
+
> **getSchema**(): `IEntitySchema`
|
|
84
78
|
|
|
85
79
|
Get the schema for the entities.
|
|
86
80
|
|
|
87
81
|
#### Returns
|
|
88
82
|
|
|
89
|
-
`IEntitySchema
|
|
83
|
+
`IEntitySchema`
|
|
90
84
|
|
|
91
85
|
The schema for the entities.
|
|
92
86
|
|
|
@@ -98,20 +92,30 @@ The schema for the entities.
|
|
|
98
92
|
|
|
99
93
|
### get()
|
|
100
94
|
|
|
101
|
-
> **get**(`id`, `secondaryIndex
|
|
95
|
+
> **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`undefined` \| `T`\>
|
|
102
96
|
|
|
103
97
|
Get an entity.
|
|
104
98
|
|
|
105
99
|
#### Parameters
|
|
106
100
|
|
|
107
|
-
|
|
101
|
+
##### id
|
|
102
|
+
|
|
103
|
+
`string`
|
|
108
104
|
|
|
109
105
|
The id of the entity to get, or the index value if secondaryIndex is set.
|
|
110
106
|
|
|
111
|
-
|
|
107
|
+
##### secondaryIndex?
|
|
108
|
+
|
|
109
|
+
keyof `T`
|
|
112
110
|
|
|
113
111
|
Get the item using a secondary index.
|
|
114
112
|
|
|
113
|
+
##### conditions?
|
|
114
|
+
|
|
115
|
+
`object`[]
|
|
116
|
+
|
|
117
|
+
The optional conditions to match for the entities.
|
|
118
|
+
|
|
115
119
|
#### Returns
|
|
116
120
|
|
|
117
121
|
`Promise`\<`undefined` \| `T`\>
|
|
@@ -126,16 +130,24 @@ The object if it can be found or undefined.
|
|
|
126
130
|
|
|
127
131
|
### set()
|
|
128
132
|
|
|
129
|
-
> **set**(`entity`): `Promise`\<`void`\>
|
|
133
|
+
> **set**(`entity`, `conditions?`): `Promise`\<`void`\>
|
|
130
134
|
|
|
131
135
|
Set an entity.
|
|
132
136
|
|
|
133
137
|
#### Parameters
|
|
134
138
|
|
|
135
|
-
|
|
139
|
+
##### entity
|
|
140
|
+
|
|
141
|
+
`T`
|
|
136
142
|
|
|
137
143
|
The entity to set.
|
|
138
144
|
|
|
145
|
+
##### conditions?
|
|
146
|
+
|
|
147
|
+
`object`[]
|
|
148
|
+
|
|
149
|
+
The optional conditions to match for the entities.
|
|
150
|
+
|
|
139
151
|
#### Returns
|
|
140
152
|
|
|
141
153
|
`Promise`\<`void`\>
|
|
@@ -150,16 +162,24 @@ The id of the entity.
|
|
|
150
162
|
|
|
151
163
|
### remove()
|
|
152
164
|
|
|
153
|
-
> **remove**(`id`): `Promise`\<`void`\>
|
|
165
|
+
> **remove**(`id`, `conditions?`): `Promise`\<`void`\>
|
|
154
166
|
|
|
155
167
|
Remove the entity.
|
|
156
168
|
|
|
157
169
|
#### Parameters
|
|
158
170
|
|
|
159
|
-
|
|
171
|
+
##### id
|
|
172
|
+
|
|
173
|
+
`string`
|
|
160
174
|
|
|
161
175
|
The id of the entity to remove.
|
|
162
176
|
|
|
177
|
+
##### conditions?
|
|
178
|
+
|
|
179
|
+
`object`[]
|
|
180
|
+
|
|
181
|
+
The optional conditions to match for the entities.
|
|
182
|
+
|
|
163
183
|
#### Returns
|
|
164
184
|
|
|
165
185
|
`Promise`\<`void`\>
|
|
@@ -174,51 +194,49 @@ Nothing.
|
|
|
174
194
|
|
|
175
195
|
### query()
|
|
176
196
|
|
|
177
|
-
> **query**(`conditions
|
|
197
|
+
> **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `pageSize?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
178
198
|
|
|
179
199
|
Find all the entities which match the conditions.
|
|
180
200
|
|
|
181
201
|
#### Parameters
|
|
182
202
|
|
|
183
|
-
|
|
203
|
+
##### conditions?
|
|
204
|
+
|
|
205
|
+
`EntityCondition`\<`T`\>
|
|
184
206
|
|
|
185
207
|
The conditions to match for the entities.
|
|
186
208
|
|
|
187
|
-
|
|
209
|
+
##### sortProperties?
|
|
210
|
+
|
|
211
|
+
`object`[]
|
|
188
212
|
|
|
189
213
|
The optional sort order.
|
|
190
214
|
|
|
191
|
-
|
|
215
|
+
##### properties?
|
|
216
|
+
|
|
217
|
+
keyof `T`[]
|
|
192
218
|
|
|
193
219
|
The optional properties to return, defaults to all.
|
|
194
220
|
|
|
195
|
-
|
|
221
|
+
##### cursor?
|
|
222
|
+
|
|
223
|
+
`string`
|
|
196
224
|
|
|
197
225
|
The cursor to request the next page of entities.
|
|
198
226
|
|
|
199
|
-
|
|
227
|
+
##### pageSize?
|
|
228
|
+
|
|
229
|
+
`number`
|
|
200
230
|
|
|
201
231
|
The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
|
202
232
|
|
|
203
233
|
#### Returns
|
|
204
234
|
|
|
205
|
-
`Promise`\<`
|
|
235
|
+
`Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
206
236
|
|
|
207
237
|
All the entities for the storage matching the conditions,
|
|
208
238
|
and a cursor which can be used to request more entities.
|
|
209
239
|
|
|
210
|
-
##### entities
|
|
211
|
-
|
|
212
|
-
> **entities**: `Partial`\<`T`\>[]
|
|
213
|
-
|
|
214
|
-
The entities, which can be partial if a limited keys list was provided.
|
|
215
|
-
|
|
216
|
-
##### cursor?
|
|
217
|
-
|
|
218
|
-
> `optional` **cursor**: `string`
|
|
219
|
-
|
|
220
|
-
An optional cursor, when defined can be used to call find to get more entities.
|
|
221
|
-
|
|
222
240
|
#### Implementation of
|
|
223
241
|
|
|
224
242
|
`IEntityStorageConnector.query`
|
package/docs/reference/index.md
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Interface: IDynamoDbEntityStorageConnectorConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the Dynamo DB Entity Storage Connector constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### entitySchema
|
|
8
|
+
|
|
9
|
+
> **entitySchema**: `string`
|
|
10
|
+
|
|
11
|
+
The schema for the entity
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### loggingConnectorType?
|
|
16
|
+
|
|
17
|
+
> `optional` **loggingConnectorType**: `string`
|
|
18
|
+
|
|
19
|
+
The type of logging connector to use, defaults to no logging.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### config
|
|
24
|
+
|
|
25
|
+
> **config**: [`IDynamoDbEntityStorageConnectorConfig`](IDynamoDbEntityStorageConnectorConfig.md)
|
|
26
|
+
|
|
27
|
+
The configuration for the connector.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-connector-dynamodb",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "Entity Storage connector implementation using DynamoDb storage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,25 +14,25 @@
|
|
|
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.
|
|
20
|
-
"@twin.org/core": "
|
|
21
|
-
"@twin.org/entity": "
|
|
22
|
-
"@twin.org/entity-storage-models": "0.0.1
|
|
23
|
-
"@twin.org/logging-models": "
|
|
24
|
-
"@twin.org/nameof": "
|
|
17
|
+
"@aws-sdk/client-dynamodb": "3.828",
|
|
18
|
+
"@aws-sdk/lib-dynamodb": "3.828",
|
|
19
|
+
"@aws-sdk/util-dynamodb": "3.828",
|
|
20
|
+
"@twin.org/core": "^0.0.1",
|
|
21
|
+
"@twin.org/entity": "^0.0.1",
|
|
22
|
+
"@twin.org/entity-storage-models": "^0.0.1",
|
|
23
|
+
"@twin.org/logging-models": "^0.0.1",
|
|
24
|
+
"@twin.org/nameof": "^0.0.1"
|
|
25
25
|
},
|
|
26
26
|
"main": "./dist/cjs/index.cjs",
|
|
27
27
|
"module": "./dist/esm/index.mjs",
|
|
28
28
|
"types": "./dist/types/index.d.ts",
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
|
+
"types": "./dist/types/index.d.ts",
|
|
31
32
|
"require": "./dist/cjs/index.cjs",
|
|
32
|
-
"import": "./dist/esm/index.mjs"
|
|
33
|
-
"types": "./dist/types/index.d.ts"
|
|
33
|
+
"import": "./dist/esm/index.mjs"
|
|
34
34
|
},
|
|
35
|
-
"./locales": "./locales"
|
|
35
|
+
"./locales/*.json": "./locales/*.json"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"dist/cjs",
|