@travetto/model-dynamodb 3.0.0-rc.1 → 3.0.0-rc.11
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 +4 -4
- package/{index.ts → __index__.ts} +0 -0
- package/package.json +17 -7
- package/src/config.ts +1 -1
- package/src/service.ts +4 -3
- package/support/service.dynamodb.ts +4 -4
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!-- This file was generated by @travetto/doc and should not be modified directly -->
|
|
2
|
-
<!-- Please modify https://github.com/travetto/travetto/tree/main/module/model-dynamodb/
|
|
2
|
+
<!-- Please modify https://github.com/travetto/travetto/tree/main/module/model-dynamodb/DOC.ts and execute "npx trv doc" to rebuild -->
|
|
3
3
|
# DynamoDB Model Support
|
|
4
4
|
## DynamoDB backing for the travetto model module.
|
|
5
5
|
|
|
@@ -39,7 +39,7 @@ export class Init {
|
|
|
39
39
|
|
|
40
40
|
**Code: Structure of DynamoDBModelConfig**
|
|
41
41
|
```typescript
|
|
42
|
-
import
|
|
42
|
+
import type dynamodb from '@aws-sdk/client-dynamodb';
|
|
43
43
|
|
|
44
44
|
import { Config } from '@travetto/config';
|
|
45
45
|
import { Field } from '@travetto/schema';
|
|
@@ -55,5 +55,5 @@ export class DynamoDBModelConfig {
|
|
|
55
55
|
}
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
Additionally, you can see that the class is registered with the [@Config](https://github.com/travetto/travetto/tree/main/module/config/src/decorator.ts#
|
|
59
|
-
standard [Configuration](https://github.com/travetto/travetto/tree/main/module/config#readme "
|
|
58
|
+
Additionally, you can see that the class is registered with the [@Config](https://github.com/travetto/travetto/tree/main/module/config/src/decorator.ts#L13) annotation, and so these values can be overridden using the
|
|
59
|
+
standard [Configuration](https://github.com/travetto/travetto/tree/main/module/config#readme "Configuration support")resolution paths.
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-dynamodb",
|
|
3
|
-
"
|
|
4
|
-
"version": "3.0.0-rc.1",
|
|
3
|
+
"version": "3.0.0-rc.11",
|
|
5
4
|
"description": "DynamoDB backing for the travetto model module.",
|
|
6
5
|
"keywords": [
|
|
7
6
|
"typescript",
|
|
@@ -16,19 +15,30 @@
|
|
|
16
15
|
"name": "Travetto Framework"
|
|
17
16
|
},
|
|
18
17
|
"files": [
|
|
19
|
-
"
|
|
18
|
+
"__index__.ts",
|
|
20
19
|
"src",
|
|
21
20
|
"support"
|
|
22
21
|
],
|
|
23
|
-
"main": "
|
|
22
|
+
"main": "__index__.ts",
|
|
24
23
|
"repository": {
|
|
25
24
|
"url": "https://github.com/travetto/travetto.git",
|
|
26
25
|
"directory": "module/model-dynamodb"
|
|
27
26
|
},
|
|
28
27
|
"dependencies": {
|
|
29
|
-
"@aws-sdk/client-dynamodb": "^3.
|
|
30
|
-
"@travetto/config": "^3.0.0-rc.
|
|
31
|
-
"@travetto/model": "^3.0.0-rc.
|
|
28
|
+
"@aws-sdk/client-dynamodb": "^3.262.0",
|
|
29
|
+
"@travetto/config": "^3.0.0-rc.11",
|
|
30
|
+
"@travetto/model": "^3.0.0-rc.11"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@travetto/command": "^3.0.0-rc.8"
|
|
34
|
+
},
|
|
35
|
+
"peerDependenciesMeta": {
|
|
36
|
+
"@travetto/command": {
|
|
37
|
+
"optional": true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"travetto": {
|
|
41
|
+
"displayName": "DynamoDB Model Support"
|
|
32
42
|
},
|
|
33
43
|
"publishConfig": {
|
|
34
44
|
"access": "public"
|
package/src/config.ts
CHANGED
package/src/service.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as dynamodb from '@aws-sdk/client-dynamodb';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { ShutdownManager, type Class } from '@travetto/base';
|
|
4
4
|
import { DeepPartial } from '@travetto/schema';
|
|
5
5
|
import { Injectable } from '@travetto/di';
|
|
6
6
|
import {
|
|
@@ -13,6 +13,7 @@ import { ModelCrudUtil } from '@travetto/model/src/internal/service/crud';
|
|
|
13
13
|
import { ModelExpiryUtil } from '@travetto/model/src/internal/service/expiry';
|
|
14
14
|
import { ModelIndexedUtil } from '@travetto/model/src/internal/service/indexed';
|
|
15
15
|
import { ModelStorageUtil } from '@travetto/model/src/internal/service/storage';
|
|
16
|
+
import { ModelUtil } from '@travetto/model/src/internal/util';
|
|
16
17
|
|
|
17
18
|
import { DynamoDBModelConfig } from './config';
|
|
18
19
|
|
|
@@ -186,7 +187,7 @@ export class DynamoDBModelService implements ModelCrudSupport, ModelExpirySuppor
|
|
|
186
187
|
async postConstruct(): Promise<void> {
|
|
187
188
|
this.client = new dynamodb.DynamoDB({ ...this.config.client });
|
|
188
189
|
await ModelStorageUtil.registerModelChangeListener(this);
|
|
189
|
-
ShutdownManager.onShutdown(this
|
|
190
|
+
ShutdownManager.onShutdown(this, () => this.client.destroy());
|
|
190
191
|
}
|
|
191
192
|
|
|
192
193
|
// Storage
|
|
@@ -269,7 +270,7 @@ export class DynamoDBModelService implements ModelCrudSupport, ModelExpirySuppor
|
|
|
269
270
|
|
|
270
271
|
// Crud
|
|
271
272
|
uuid(): string {
|
|
272
|
-
return
|
|
273
|
+
return ModelUtil.uuid();
|
|
273
274
|
}
|
|
274
275
|
|
|
275
276
|
async get<T extends ModelType>(cls: Class<T>, id: string): Promise<T> {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import { Env } from '@travetto/base';
|
|
2
|
+
import type { CommandService } from '@travetto/command';
|
|
3
3
|
|
|
4
|
-
const version =
|
|
4
|
+
const version = Env.get('DYNAMODB_VERSION', '1.20.0');
|
|
5
5
|
|
|
6
|
-
export const service:
|
|
6
|
+
export const service: CommandService = {
|
|
7
7
|
name: 'dynamodb',
|
|
8
8
|
version,
|
|
9
9
|
port: 8000,
|