@twin.org/entity-storage-connector-dynamodb 0.0.3-next.13 → 0.0.3-next.14
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 +1 -2
- package/dist/es/dynamoDbEntityStorageConnector.js +319 -58
- package/dist/es/dynamoDbEntityStorageConnector.js.map +1 -1
- package/dist/es/models/IDynamoDbEntityStorageConnectorConfig.js.map +1 -1
- package/dist/types/dynamoDbEntityStorageConnector.d.ts +32 -3
- package/dist/types/models/IDynamoDbEntityStorageConnectorConfig.d.ts +5 -0
- package/docs/changelog.md +21 -0
- package/docs/reference/classes/DynamoDbEntityStorageConnector.md +161 -15
- package/docs/reference/interfaces/IDynamoDbEntityStorageConnectorConfig.md +9 -0
- package/locales/en.json +3 -1
- package/package.json +4 -4
|
@@ -10,7 +10,7 @@ Class for performing entity storage operations using Dynamo DB.
|
|
|
10
10
|
|
|
11
11
|
## Implements
|
|
12
12
|
|
|
13
|
-
- `
|
|
13
|
+
- `IEntityStorageMigrationConnector`\<`T`\>
|
|
14
14
|
|
|
15
15
|
## Constructors
|
|
16
16
|
|
|
@@ -56,7 +56,7 @@ The class name of the component.
|
|
|
56
56
|
|
|
57
57
|
#### Implementation of
|
|
58
58
|
|
|
59
|
-
`
|
|
59
|
+
`IEntityStorageMigrationConnector.className`
|
|
60
60
|
|
|
61
61
|
***
|
|
62
62
|
|
|
@@ -74,7 +74,7 @@ The health status of the component.
|
|
|
74
74
|
|
|
75
75
|
#### Implementation of
|
|
76
76
|
|
|
77
|
-
`
|
|
77
|
+
`IEntityStorageMigrationConnector.health`
|
|
78
78
|
|
|
79
79
|
***
|
|
80
80
|
|
|
@@ -92,7 +92,7 @@ The schema for the entities.
|
|
|
92
92
|
|
|
93
93
|
#### Implementation of
|
|
94
94
|
|
|
95
|
-
`
|
|
95
|
+
`IEntityStorageMigrationConnector.getSchema`
|
|
96
96
|
|
|
97
97
|
***
|
|
98
98
|
|
|
@@ -118,7 +118,7 @@ True if the bootstrapping process was successful.
|
|
|
118
118
|
|
|
119
119
|
#### Implementation of
|
|
120
120
|
|
|
121
|
-
`
|
|
121
|
+
`IEntityStorageMigrationConnector.bootstrap`
|
|
122
122
|
|
|
123
123
|
***
|
|
124
124
|
|
|
@@ -156,7 +156,7 @@ The object if it can be found or undefined.
|
|
|
156
156
|
|
|
157
157
|
#### Implementation of
|
|
158
158
|
|
|
159
|
-
`
|
|
159
|
+
`IEntityStorageMigrationConnector.get`
|
|
160
160
|
|
|
161
161
|
***
|
|
162
162
|
|
|
@@ -188,7 +188,7 @@ The id of the entity.
|
|
|
188
188
|
|
|
189
189
|
#### Implementation of
|
|
190
190
|
|
|
191
|
-
`
|
|
191
|
+
`IEntityStorageMigrationConnector.set`
|
|
192
192
|
|
|
193
193
|
***
|
|
194
194
|
|
|
@@ -214,7 +214,7 @@ Nothing.
|
|
|
214
214
|
|
|
215
215
|
#### Implementation of
|
|
216
216
|
|
|
217
|
-
`
|
|
217
|
+
`IEntityStorageMigrationConnector.setBatch`
|
|
218
218
|
|
|
219
219
|
***
|
|
220
220
|
|
|
@@ -232,7 +232,7 @@ Nothing.
|
|
|
232
232
|
|
|
233
233
|
#### Implementation of
|
|
234
234
|
|
|
235
|
-
`
|
|
235
|
+
`IEntityStorageMigrationConnector.empty`
|
|
236
236
|
|
|
237
237
|
***
|
|
238
238
|
|
|
@@ -264,7 +264,7 @@ Nothing.
|
|
|
264
264
|
|
|
265
265
|
#### Implementation of
|
|
266
266
|
|
|
267
|
-
`
|
|
267
|
+
`IEntityStorageMigrationConnector.remove`
|
|
268
268
|
|
|
269
269
|
***
|
|
270
270
|
|
|
@@ -290,7 +290,7 @@ Nothing.
|
|
|
290
290
|
|
|
291
291
|
#### Implementation of
|
|
292
292
|
|
|
293
|
-
`
|
|
293
|
+
`IEntityStorageMigrationConnector.removeBatch`
|
|
294
294
|
|
|
295
295
|
***
|
|
296
296
|
|
|
@@ -316,7 +316,7 @@ True if the teardown process was successful.
|
|
|
316
316
|
|
|
317
317
|
#### Implementation of
|
|
318
318
|
|
|
319
|
-
`
|
|
319
|
+
`IEntityStorageMigrationConnector.teardown`
|
|
320
320
|
|
|
321
321
|
***
|
|
322
322
|
|
|
@@ -367,16 +367,24 @@ and a cursor which can be used to request more entities.
|
|
|
367
367
|
|
|
368
368
|
#### Implementation of
|
|
369
369
|
|
|
370
|
-
`
|
|
370
|
+
`IEntityStorageMigrationConnector.query`
|
|
371
371
|
|
|
372
372
|
***
|
|
373
373
|
|
|
374
374
|
### count() {#count}
|
|
375
375
|
|
|
376
|
-
> **count**(): `Promise`\<`number`\>
|
|
376
|
+
> **count**(`conditions?`): `Promise`\<`number`\>
|
|
377
377
|
|
|
378
378
|
Count all the entities which match the conditions.
|
|
379
379
|
|
|
380
|
+
#### Parameters
|
|
381
|
+
|
|
382
|
+
##### conditions?
|
|
383
|
+
|
|
384
|
+
`EntityCondition`\<`T`\>
|
|
385
|
+
|
|
386
|
+
The optional conditions to match for the entities.
|
|
387
|
+
|
|
380
388
|
#### Returns
|
|
381
389
|
|
|
382
390
|
`Promise`\<`number`\>
|
|
@@ -385,4 +393,142 @@ The total count of entities in the storage.
|
|
|
385
393
|
|
|
386
394
|
#### Implementation of
|
|
387
395
|
|
|
388
|
-
`
|
|
396
|
+
`IEntityStorageMigrationConnector.count`
|
|
397
|
+
|
|
398
|
+
***
|
|
399
|
+
|
|
400
|
+
### getPartitionContextIds() {#getpartitioncontextids}
|
|
401
|
+
|
|
402
|
+
> **getPartitionContextIds**(): `Promise`\<`IContextIds`[]\>
|
|
403
|
+
|
|
404
|
+
Get a unique list of all the context ids from the storage.
|
|
405
|
+
|
|
406
|
+
#### Returns
|
|
407
|
+
|
|
408
|
+
`Promise`\<`IContextIds`[]\>
|
|
409
|
+
|
|
410
|
+
The list of unique context ids.
|
|
411
|
+
|
|
412
|
+
#### Implementation of
|
|
413
|
+
|
|
414
|
+
`IEntityStorageMigrationConnector.getPartitionContextIds`
|
|
415
|
+
|
|
416
|
+
***
|
|
417
|
+
|
|
418
|
+
### createTargetConnector() {#createtargetconnector}
|
|
419
|
+
|
|
420
|
+
> **createTargetConnector**\<`U`\>(`newEntitySchema`): `Promise`\<`IEntityStorageConnector`\<`U`\>\>
|
|
421
|
+
|
|
422
|
+
Create the target connector for performing the migration it will use a temporary storage location.
|
|
423
|
+
|
|
424
|
+
#### Type Parameters
|
|
425
|
+
|
|
426
|
+
##### U
|
|
427
|
+
|
|
428
|
+
`U`
|
|
429
|
+
|
|
430
|
+
#### Parameters
|
|
431
|
+
|
|
432
|
+
##### newEntitySchema
|
|
433
|
+
|
|
434
|
+
`string`
|
|
435
|
+
|
|
436
|
+
The name of the new entity schema to create the connector for.
|
|
437
|
+
|
|
438
|
+
#### Returns
|
|
439
|
+
|
|
440
|
+
`Promise`\<`IEntityStorageConnector`\<`U`\>\>
|
|
441
|
+
|
|
442
|
+
Connector for performing the migration.
|
|
443
|
+
|
|
444
|
+
#### Implementation of
|
|
445
|
+
|
|
446
|
+
`IEntityStorageMigrationConnector.createTargetConnector`
|
|
447
|
+
|
|
448
|
+
***
|
|
449
|
+
|
|
450
|
+
### finalizeMigration() {#finalizemigration}
|
|
451
|
+
|
|
452
|
+
> **finalizeMigration**\<`U`\>(`targetConnector`, `options?`, `loggingComponentType?`): `Promise`\<`DynamoDbEntityStorageConnector`\<`U`\>\>
|
|
453
|
+
|
|
454
|
+
Finalize the migration by tearing down the old connector and replacing it with the new one.
|
|
455
|
+
|
|
456
|
+
#### Type Parameters
|
|
457
|
+
|
|
458
|
+
##### U
|
|
459
|
+
|
|
460
|
+
`U`
|
|
461
|
+
|
|
462
|
+
#### Parameters
|
|
463
|
+
|
|
464
|
+
##### targetConnector
|
|
465
|
+
|
|
466
|
+
`DynamoDbEntityStorageConnector`\<`U`\>
|
|
467
|
+
|
|
468
|
+
The target connector to finalize the migration with.
|
|
469
|
+
|
|
470
|
+
##### options?
|
|
471
|
+
|
|
472
|
+
`IMigrationOptions`\<`T`, `U`\>
|
|
473
|
+
|
|
474
|
+
The options to control how the migration is finalized.
|
|
475
|
+
|
|
476
|
+
##### loggingComponentType?
|
|
477
|
+
|
|
478
|
+
`string`
|
|
479
|
+
|
|
480
|
+
The logging component type to use for logging during the migration finalization.
|
|
481
|
+
|
|
482
|
+
#### Returns
|
|
483
|
+
|
|
484
|
+
`Promise`\<`DynamoDbEntityStorageConnector`\<`U`\>\>
|
|
485
|
+
|
|
486
|
+
A promise that resolves when the migration is finalized.
|
|
487
|
+
|
|
488
|
+
#### Implementation of
|
|
489
|
+
|
|
490
|
+
`IEntityStorageMigrationConnector.finalizeMigration`
|
|
491
|
+
|
|
492
|
+
***
|
|
493
|
+
|
|
494
|
+
### cleanupMigration() {#cleanupmigration}
|
|
495
|
+
|
|
496
|
+
> **cleanupMigration**\<`U`\>(`targetConnector`, `options?`, `loggingComponentType?`): `Promise`\<`void`\>
|
|
497
|
+
|
|
498
|
+
Cleanup the migration if a migration fails or needs to be aborted.
|
|
499
|
+
|
|
500
|
+
#### Type Parameters
|
|
501
|
+
|
|
502
|
+
##### U
|
|
503
|
+
|
|
504
|
+
`U`
|
|
505
|
+
|
|
506
|
+
#### Parameters
|
|
507
|
+
|
|
508
|
+
##### targetConnector
|
|
509
|
+
|
|
510
|
+
`IEntityStorageConnector`\<`U`\> \| `undefined`
|
|
511
|
+
|
|
512
|
+
The target connector to cleanup the migration with.
|
|
513
|
+
|
|
514
|
+
##### options?
|
|
515
|
+
|
|
516
|
+
`IMigrationOptions`\<`T`, `U`\>
|
|
517
|
+
|
|
518
|
+
The options to control how the migration is cleaned up.
|
|
519
|
+
|
|
520
|
+
##### loggingComponentType?
|
|
521
|
+
|
|
522
|
+
`string`
|
|
523
|
+
|
|
524
|
+
The optional component type to use for logging the migration progress.
|
|
525
|
+
|
|
526
|
+
#### Returns
|
|
527
|
+
|
|
528
|
+
`Promise`\<`void`\>
|
|
529
|
+
|
|
530
|
+
A promise that resolves when the migration is cleaned up.
|
|
531
|
+
|
|
532
|
+
#### Implementation of
|
|
533
|
+
|
|
534
|
+
`IEntityStorageMigrationConnector.cleanupMigration`
|
|
@@ -65,3 +65,12 @@ AWS endpoint, not usually required but could be used for local DynamoDB instance
|
|
|
65
65
|
> `optional` **connectionTimeoutMs?**: `number`
|
|
66
66
|
|
|
67
67
|
The connection timeout in milliseconds.
|
|
68
|
+
|
|
69
|
+
***
|
|
70
|
+
|
|
71
|
+
### maxAttempts? {#maxattempts}
|
|
72
|
+
|
|
73
|
+
> `optional` **maxAttempts?**: `number`
|
|
74
|
+
|
|
75
|
+
Maximum number of attempts for each SDK request (1 = no retries).
|
|
76
|
+
Defaults to the AWS SDK default (3).
|
package/locales/en.json
CHANGED
|
@@ -21,11 +21,13 @@
|
|
|
21
21
|
"sortSingle": "You can only sort by a single property",
|
|
22
22
|
"sortNotIndexed": "The property \"{property}\" is not indexed and cannot be used for sorting",
|
|
23
23
|
"propertyNotFound": "The property \"{property}\" was not found on the entity schema",
|
|
24
|
+
"getPartitionContextIdsFailed": "Unable to get partition context ids",
|
|
24
25
|
"setBatchFailed": "Unable to set batch of entities",
|
|
25
26
|
"removeBatchFailed": "Unable to remove batch of entities",
|
|
26
27
|
"emptyFailed": "Unable to empty entity storage",
|
|
27
28
|
"countFailed": "Unable to count entities",
|
|
28
|
-
"teardownFailed": "Unable to teardown entity storage"
|
|
29
|
+
"teardownFailed": "Unable to teardown entity storage",
|
|
30
|
+
"finalizeMigrationFailedBootstrap": "Finalizing migration failed during bootstrap phase"
|
|
29
31
|
}
|
|
30
32
|
},
|
|
31
33
|
"health": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-connector-dynamodb",
|
|
3
|
-
"version": "0.0.3-next.
|
|
3
|
+
"version": "0.0.3-next.14",
|
|
4
4
|
"description": "Amazon DynamoDB connector for managed NoSQL persistence.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "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.
|
|
17
|
+
"@aws-sdk/client-dynamodb": "3.1049",
|
|
18
|
+
"@aws-sdk/lib-dynamodb": "3.1049",
|
|
19
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.14",
|
|
24
24
|
"@twin.org/logging-models": "next",
|
|
25
25
|
"@twin.org/nameof": "next"
|
|
26
26
|
},
|