@twin.org/entity-storage-connector-dynamodb 0.0.2-next.9 → 0.0.3-next.10
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/dist/{esm/index.mjs → es/dynamoDbEntityStorageConnector.js} +314 -80
- package/dist/es/dynamoDbEntityStorageConnector.js.map +1 -0
- package/dist/es/index.js +6 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IDynamoDbEntityStorageConnectorConfig.js +4 -0
- package/dist/es/models/IDynamoDbEntityStorageConnectorConfig.js.map +1 -0
- package/dist/es/models/IDynamoDbEntityStorageConnectorConstructorOptions.js +2 -0
- package/dist/es/models/IDynamoDbEntityStorageConnectorConstructorOptions.js.map +1 -0
- package/dist/types/dynamoDbEntityStorageConnector.d.ts +46 -12
- package/dist/types/index.d.ts +3 -3
- package/dist/types/models/IDynamoDbEntityStorageConnectorConfig.d.ts +5 -1
- package/dist/types/models/IDynamoDbEntityStorageConnectorConstructorOptions.d.ts +5 -1
- package/docs/changelog.md +230 -36
- package/docs/examples.md +96 -1
- package/docs/reference/classes/DynamoDbEntityStorageConnector.md +162 -30
- package/docs/reference/interfaces/IDynamoDbEntityStorageConnectorConfig.md +19 -11
- package/docs/reference/interfaces/IDynamoDbEntityStorageConnectorConstructorOptions.md +12 -4
- package/locales/en.json +16 -2
- package/package.json +17 -14
- package/dist/cjs/index.cjs +0 -751
|
@@ -34,45 +34,51 @@ The options for the connector.
|
|
|
34
34
|
|
|
35
35
|
## Properties
|
|
36
36
|
|
|
37
|
-
### CLASS\_NAME
|
|
37
|
+
### CLASS\_NAME {#class_name}
|
|
38
38
|
|
|
39
|
-
> `readonly` **CLASS\_NAME**: `string`
|
|
39
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
40
40
|
|
|
41
41
|
Runtime name for the class.
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
## Methods
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
### className() {#classname}
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
> **className**(): `string`
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Returns the class name of the component.
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
#### Returns
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
`string`
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
The class name of the component.
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
#### Implementation of
|
|
58
58
|
|
|
59
|
-
`
|
|
59
|
+
`IEntityStorageConnector.className`
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
### health() {#health}
|
|
64
|
+
|
|
65
|
+
> **health**(): `Promise`\<`IHealth`[]\>
|
|
66
|
+
|
|
67
|
+
Returns the health status of the component.
|
|
62
68
|
|
|
63
69
|
#### Returns
|
|
64
70
|
|
|
65
|
-
`Promise`\<`
|
|
71
|
+
`Promise`\<`IHealth`[]\>
|
|
66
72
|
|
|
67
|
-
|
|
73
|
+
The health status of the component.
|
|
68
74
|
|
|
69
75
|
#### Implementation of
|
|
70
76
|
|
|
71
|
-
`IEntityStorageConnector.
|
|
77
|
+
`IEntityStorageConnector.health`
|
|
72
78
|
|
|
73
79
|
***
|
|
74
80
|
|
|
75
|
-
### getSchema()
|
|
81
|
+
### getSchema() {#getschema}
|
|
76
82
|
|
|
77
83
|
> **getSchema**(): `IEntitySchema`
|
|
78
84
|
|
|
@@ -90,9 +96,35 @@ The schema for the entities.
|
|
|
90
96
|
|
|
91
97
|
***
|
|
92
98
|
|
|
93
|
-
###
|
|
99
|
+
### bootstrap() {#bootstrap}
|
|
100
|
+
|
|
101
|
+
> **bootstrap**(`nodeLoggingComponentType?`): `Promise`\<`boolean`\>
|
|
102
|
+
|
|
103
|
+
Bootstrap the component by creating and initializing any resources it needs.
|
|
94
104
|
|
|
95
|
-
|
|
105
|
+
#### Parameters
|
|
106
|
+
|
|
107
|
+
##### nodeLoggingComponentType?
|
|
108
|
+
|
|
109
|
+
`string`
|
|
110
|
+
|
|
111
|
+
The node logging component type.
|
|
112
|
+
|
|
113
|
+
#### Returns
|
|
114
|
+
|
|
115
|
+
`Promise`\<`boolean`\>
|
|
116
|
+
|
|
117
|
+
True if the bootstrapping process was successful.
|
|
118
|
+
|
|
119
|
+
#### Implementation of
|
|
120
|
+
|
|
121
|
+
`IEntityStorageConnector.bootstrap`
|
|
122
|
+
|
|
123
|
+
***
|
|
124
|
+
|
|
125
|
+
### get() {#get}
|
|
126
|
+
|
|
127
|
+
> **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`T` \| `undefined`\>
|
|
96
128
|
|
|
97
129
|
Get an entity.
|
|
98
130
|
|
|
@@ -118,7 +150,7 @@ The optional conditions to match for the entities.
|
|
|
118
150
|
|
|
119
151
|
#### Returns
|
|
120
152
|
|
|
121
|
-
`Promise`\<`
|
|
153
|
+
`Promise`\<`T` \| `undefined`\>
|
|
122
154
|
|
|
123
155
|
The object if it can be found or undefined.
|
|
124
156
|
|
|
@@ -128,7 +160,7 @@ The object if it can be found or undefined.
|
|
|
128
160
|
|
|
129
161
|
***
|
|
130
162
|
|
|
131
|
-
### set()
|
|
163
|
+
### set() {#set}
|
|
132
164
|
|
|
133
165
|
> **set**(`entity`, `conditions?`): `Promise`\<`void`\>
|
|
134
166
|
|
|
@@ -160,7 +192,51 @@ The id of the entity.
|
|
|
160
192
|
|
|
161
193
|
***
|
|
162
194
|
|
|
163
|
-
###
|
|
195
|
+
### setBatch() {#setbatch}
|
|
196
|
+
|
|
197
|
+
> **setBatch**(`entities`): `Promise`\<`void`\>
|
|
198
|
+
|
|
199
|
+
Set multiple entities in a batch.
|
|
200
|
+
|
|
201
|
+
#### Parameters
|
|
202
|
+
|
|
203
|
+
##### entities
|
|
204
|
+
|
|
205
|
+
`T`[]
|
|
206
|
+
|
|
207
|
+
The entities to set.
|
|
208
|
+
|
|
209
|
+
#### Returns
|
|
210
|
+
|
|
211
|
+
`Promise`\<`void`\>
|
|
212
|
+
|
|
213
|
+
Nothing.
|
|
214
|
+
|
|
215
|
+
#### Implementation of
|
|
216
|
+
|
|
217
|
+
`IEntityStorageConnector.setBatch`
|
|
218
|
+
|
|
219
|
+
***
|
|
220
|
+
|
|
221
|
+
### empty() {#empty}
|
|
222
|
+
|
|
223
|
+
> **empty**(): `Promise`\<`void`\>
|
|
224
|
+
|
|
225
|
+
Empty the entity storage.
|
|
226
|
+
|
|
227
|
+
#### Returns
|
|
228
|
+
|
|
229
|
+
`Promise`\<`void`\>
|
|
230
|
+
|
|
231
|
+
Nothing.
|
|
232
|
+
|
|
233
|
+
#### Implementation of
|
|
234
|
+
|
|
235
|
+
`IEntityStorageConnector.empty`
|
|
236
|
+
|
|
237
|
+
***
|
|
238
|
+
|
|
239
|
+
### remove() {#remove}
|
|
164
240
|
|
|
165
241
|
> **remove**(`id`, `conditions?`): `Promise`\<`void`\>
|
|
166
242
|
|
|
@@ -192,9 +268,61 @@ Nothing.
|
|
|
192
268
|
|
|
193
269
|
***
|
|
194
270
|
|
|
195
|
-
###
|
|
271
|
+
### removeBatch() {#removebatch}
|
|
272
|
+
|
|
273
|
+
> **removeBatch**(`ids`): `Promise`\<`void`\>
|
|
274
|
+
|
|
275
|
+
Remove multiple entities by their IDs in a batch.
|
|
276
|
+
|
|
277
|
+
#### Parameters
|
|
278
|
+
|
|
279
|
+
##### ids
|
|
280
|
+
|
|
281
|
+
`string`[]
|
|
282
|
+
|
|
283
|
+
The ids of the entities to remove.
|
|
284
|
+
|
|
285
|
+
#### Returns
|
|
286
|
+
|
|
287
|
+
`Promise`\<`void`\>
|
|
288
|
+
|
|
289
|
+
Nothing.
|
|
290
|
+
|
|
291
|
+
#### Implementation of
|
|
196
292
|
|
|
197
|
-
|
|
293
|
+
`IEntityStorageConnector.removeBatch`
|
|
294
|
+
|
|
295
|
+
***
|
|
296
|
+
|
|
297
|
+
### teardown() {#teardown}
|
|
298
|
+
|
|
299
|
+
> **teardown**(`nodeLoggingComponentType?`): `Promise`\<`boolean`\>
|
|
300
|
+
|
|
301
|
+
Teardown the entity storage by deleting the underlying table.
|
|
302
|
+
|
|
303
|
+
#### Parameters
|
|
304
|
+
|
|
305
|
+
##### nodeLoggingComponentType?
|
|
306
|
+
|
|
307
|
+
`string`
|
|
308
|
+
|
|
309
|
+
The node logging component type.
|
|
310
|
+
|
|
311
|
+
#### Returns
|
|
312
|
+
|
|
313
|
+
`Promise`\<`boolean`\>
|
|
314
|
+
|
|
315
|
+
True if the teardown process was successful.
|
|
316
|
+
|
|
317
|
+
#### Implementation of
|
|
318
|
+
|
|
319
|
+
`IEntityStorageConnector.teardown`
|
|
320
|
+
|
|
321
|
+
***
|
|
322
|
+
|
|
323
|
+
### query() {#query}
|
|
324
|
+
|
|
325
|
+
> **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
198
326
|
|
|
199
327
|
Find all the entities which match the conditions.
|
|
200
328
|
|
|
@@ -222,9 +350,9 @@ The optional properties to return, defaults to all.
|
|
|
222
350
|
|
|
223
351
|
`string`
|
|
224
352
|
|
|
225
|
-
The cursor to request the next
|
|
353
|
+
The cursor to request the next chunk of entities.
|
|
226
354
|
|
|
227
|
-
#####
|
|
355
|
+
##### limit?
|
|
228
356
|
|
|
229
357
|
`number`
|
|
230
358
|
|
|
@@ -243,14 +371,18 @@ and a cursor which can be used to request more entities.
|
|
|
243
371
|
|
|
244
372
|
***
|
|
245
373
|
|
|
246
|
-
###
|
|
374
|
+
### count() {#count}
|
|
247
375
|
|
|
248
|
-
> **
|
|
376
|
+
> **count**(): `Promise`\<`number`\>
|
|
249
377
|
|
|
250
|
-
|
|
378
|
+
Count all the entities which match the conditions.
|
|
251
379
|
|
|
252
380
|
#### Returns
|
|
253
381
|
|
|
254
|
-
`Promise`\<`
|
|
382
|
+
`Promise`\<`number`\>
|
|
255
383
|
|
|
256
|
-
|
|
384
|
+
The total count of entities in the storage.
|
|
385
|
+
|
|
386
|
+
#### Implementation of
|
|
387
|
+
|
|
388
|
+
`IEntityStorageConnector.count`
|
|
@@ -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,9 +12,9 @@ The region for the AWS connection.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### authMode?
|
|
15
|
+
### authMode? {#authmode}
|
|
16
16
|
|
|
17
|
-
> `optional` **authMode
|
|
17
|
+
> `optional` **authMode?**: `"credentials"` \| `"pod"`
|
|
18
18
|
|
|
19
19
|
The authentication mode.
|
|
20
20
|
- "credentials": Use access key ID and secret access key.
|
|
@@ -28,23 +28,23 @@ credentials
|
|
|
28
28
|
|
|
29
29
|
***
|
|
30
30
|
|
|
31
|
-
### accessKeyId?
|
|
31
|
+
### accessKeyId? {#accesskeyid}
|
|
32
32
|
|
|
33
|
-
> `optional` **accessKeyId
|
|
33
|
+
> `optional` **accessKeyId?**: `string`
|
|
34
34
|
|
|
35
35
|
The AWS access key ID.
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
39
|
-
### secretAccessKey?
|
|
39
|
+
### secretAccessKey? {#secretaccesskey}
|
|
40
40
|
|
|
41
|
-
> `optional` **secretAccessKey
|
|
41
|
+
> `optional` **secretAccessKey?**: `string`
|
|
42
42
|
|
|
43
43
|
The AWS secret access key.
|
|
44
44
|
|
|
45
45
|
***
|
|
46
46
|
|
|
47
|
-
### tableName
|
|
47
|
+
### tableName {#tablename}
|
|
48
48
|
|
|
49
49
|
> **tableName**: `string`
|
|
50
50
|
|
|
@@ -52,8 +52,16 @@ The name of the table for the storage.
|
|
|
52
52
|
|
|
53
53
|
***
|
|
54
54
|
|
|
55
|
-
### endpoint?
|
|
55
|
+
### endpoint? {#endpoint}
|
|
56
56
|
|
|
57
|
-
> `optional` **endpoint
|
|
57
|
+
> `optional` **endpoint?**: `string`
|
|
58
58
|
|
|
59
|
-
AWS endpoint, not usually required but could be used for local DynamoDB instance e.g. http://localhost:
|
|
59
|
+
AWS endpoint, not usually required but could be used for local DynamoDB instance e.g. http://localhost:10000.
|
|
60
|
+
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
### connectionTimeoutMs? {#connectiontimeoutms}
|
|
64
|
+
|
|
65
|
+
> `optional` **connectionTimeoutMs?**: `number`
|
|
66
|
+
|
|
67
|
+
The connection timeout in milliseconds.
|
|
@@ -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,15 +12,23 @@ The schema for the entity
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
###
|
|
15
|
+
### partitionContextIds? {#partitioncontextids}
|
|
16
16
|
|
|
17
|
-
> `optional` **
|
|
17
|
+
> `optional` **partitionContextIds?**: `string`[]
|
|
18
|
+
|
|
19
|
+
The keys to use from the context ids to create partitions.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### loggingComponentType? {#loggingcomponenttype}
|
|
24
|
+
|
|
25
|
+
> `optional` **loggingComponentType?**: `string`
|
|
18
26
|
|
|
19
27
|
The type of logging component to use, defaults to no logging.
|
|
20
28
|
|
|
21
29
|
***
|
|
22
30
|
|
|
23
|
-
### config
|
|
31
|
+
### config {#config}
|
|
24
32
|
|
|
25
33
|
> **config**: [`IDynamoDbEntityStorageConnectorConfig`](IDynamoDbEntityStorageConnectorConfig.md)
|
|
26
34
|
|
package/locales/en.json
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
"dynamoDbEntityStorageConnector": {
|
|
4
4
|
"tableCreating": "Creating table \"{tableName}\"",
|
|
5
5
|
"tableCreated": "Created table \"{tableName}\"",
|
|
6
|
-
"tableExists": "Skipping create table \"{tableName}\" as it already exists"
|
|
6
|
+
"tableExists": "Skipping create table \"{tableName}\" as it already exists",
|
|
7
|
+
"tableDeleting": "Deleting table \"{tableName}\"",
|
|
8
|
+
"tableDeleted": "Table \"{tableName}\" deleted"
|
|
7
9
|
}
|
|
8
10
|
},
|
|
9
11
|
"error": {
|
|
@@ -17,7 +19,19 @@
|
|
|
17
19
|
"comparisonNotSupported": "Comparison operator \"{comparison}\" is not supported",
|
|
18
20
|
"conditionalNotSupported": "Conditional operator \"{operator}\" is not supported",
|
|
19
21
|
"sortSingle": "You can only sort by a single property",
|
|
20
|
-
"sortNotIndexed": "The property \"{property}\" is not indexed and cannot be used for sorting"
|
|
22
|
+
"sortNotIndexed": "The property \"{property}\" is not indexed and cannot be used for sorting",
|
|
23
|
+
"propertyNotFound": "The property \"{property}\" was not found on the entity schema",
|
|
24
|
+
"setBatchFailed": "Unable to set batch of entities",
|
|
25
|
+
"removeBatchFailed": "Unable to remove batch of entities",
|
|
26
|
+
"emptyFailed": "Unable to empty entity storage",
|
|
27
|
+
"countFailed": "Unable to count entities",
|
|
28
|
+
"teardownFailed": "Unable to teardown entity storage"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"health": {
|
|
32
|
+
"dynamoDbEntityStorageConnector": {
|
|
33
|
+
"healthDescription": "Checks if the DynamoDB connection is available",
|
|
34
|
+
"connectionFailed": "Failed to connect to DynamoDB"
|
|
21
35
|
}
|
|
22
36
|
}
|
|
23
37
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-connector-dynamodb",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.10",
|
|
4
|
+
"description": "Amazon DynamoDB connector for managed NoSQL persistence.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
7
|
+
"url": "git+https://github.com/iotaledger/entity-storage.git",
|
|
8
8
|
"directory": "packages/entity-storage-connector-dynamodb"
|
|
9
9
|
},
|
|
10
10
|
"author": "martyn.janes@iota.org",
|
|
@@ -14,29 +14,28 @@
|
|
|
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.1017",
|
|
18
|
+
"@aws-sdk/lib-dynamodb": "3.1017",
|
|
19
|
+
"@aws-sdk/util-dynamodb": "3.996",
|
|
20
|
+
"@twin.org/context": "next",
|
|
20
21
|
"@twin.org/core": "next",
|
|
21
22
|
"@twin.org/entity": "next",
|
|
22
|
-
"@twin.org/entity-storage-models": "0.0.
|
|
23
|
+
"@twin.org/entity-storage-models": "0.0.3-next.10",
|
|
23
24
|
"@twin.org/logging-models": "next",
|
|
24
25
|
"@twin.org/nameof": "next"
|
|
25
26
|
},
|
|
26
|
-
"main": "./dist/
|
|
27
|
-
"module": "./dist/esm/index.mjs",
|
|
27
|
+
"main": "./dist/es/index.js",
|
|
28
28
|
"types": "./dist/types/index.d.ts",
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
31
|
"types": "./dist/types/index.d.ts",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
32
|
+
"import": "./dist/es/index.js",
|
|
33
|
+
"default": "./dist/es/index.js"
|
|
34
34
|
},
|
|
35
35
|
"./locales/*.json": "./locales/*.json"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
|
-
"dist/
|
|
39
|
-
"dist/esm",
|
|
38
|
+
"dist/es",
|
|
40
39
|
"dist/types",
|
|
41
40
|
"locales",
|
|
42
41
|
"docs"
|
|
@@ -55,5 +54,9 @@
|
|
|
55
54
|
"connector",
|
|
56
55
|
"adapter",
|
|
57
56
|
"integration"
|
|
58
|
-
]
|
|
57
|
+
],
|
|
58
|
+
"bugs": {
|
|
59
|
+
"url": "git+https://github.com/iotaledger/entity-storage/issues"
|
|
60
|
+
},
|
|
61
|
+
"homepage": "https://twindev.org"
|
|
59
62
|
}
|