@travetto/model-s3 8.0.0-alpha.0 → 8.0.0-alpha.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/README.md +3 -2
- package/package.json +7 -7
- package/src/config.ts +3 -1
- package/src/service.ts +3 -2
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ export class Init {
|
|
|
37
37
|
}
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
where the [S3ModelConfig](https://github.com/travetto/travetto/tree/main/module/model-s3/src/config.ts#
|
|
40
|
+
where the [S3ModelConfig](https://github.com/travetto/travetto/tree/main/module/model-s3/src/config.ts#L13) is defined by:
|
|
41
41
|
|
|
42
42
|
**Code: Structure of S3ModelConfig**
|
|
43
43
|
```typescript
|
|
@@ -74,7 +74,8 @@ export class S3ModelConfig {
|
|
|
74
74
|
/**
|
|
75
75
|
* Produces the s3 config from the provide details, post construction
|
|
76
76
|
*/
|
|
77
|
-
|
|
77
|
+
@PostConstruct()
|
|
78
|
+
async finalizeConfig(): Promise<void> {
|
|
78
79
|
if (!Runtime.production) {
|
|
79
80
|
this.endpoint ??= 'http://localhost:4566'; // From docker
|
|
80
81
|
this.bucket ??= 'app';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-s3",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "S3 backing for the travetto model module.",
|
|
6
6
|
"keywords": [
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"directory": "module/model-s3"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aws-sdk/client-s3": "^3.
|
|
30
|
-
"@aws-sdk/credential-provider-ini": "^3.972.
|
|
31
|
-
"@aws-sdk/s3-request-presigner": "^3.
|
|
32
|
-
"@travetto/config": "^8.0.0-alpha.
|
|
33
|
-
"@travetto/model": "^8.0.0-alpha.
|
|
29
|
+
"@aws-sdk/client-s3": "^3.1004.0",
|
|
30
|
+
"@aws-sdk/credential-provider-ini": "^3.972.17",
|
|
31
|
+
"@aws-sdk/s3-request-presigner": "^3.1004.0",
|
|
32
|
+
"@travetto/config": "^8.0.0-alpha.1",
|
|
33
|
+
"@travetto/model": "^8.0.0-alpha.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@travetto/cli": "^8.0.0-alpha.
|
|
36
|
+
"@travetto/cli": "^8.0.0-alpha.1"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|
|
39
39
|
"@travetto/cli": {
|
package/src/config.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type s3 from '@aws-sdk/client-s3';
|
|
|
4
4
|
import { Config, EnvVar } from '@travetto/config';
|
|
5
5
|
import { Required } from '@travetto/schema';
|
|
6
6
|
import { Runtime } from '@travetto/runtime';
|
|
7
|
+
import { PostConstruct } from '@travetto/di';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* S3 Support as an Asset Source
|
|
@@ -41,7 +42,8 @@ export class S3ModelConfig {
|
|
|
41
42
|
/**
|
|
42
43
|
* Produces the s3 config from the provide details, post construction
|
|
43
44
|
*/
|
|
44
|
-
|
|
45
|
+
@PostConstruct()
|
|
46
|
+
async finalizeConfig(): Promise<void> {
|
|
45
47
|
if (!Runtime.production) {
|
|
46
48
|
this.endpoint ??= 'http://localhost:4566'; // From docker
|
|
47
49
|
this.bucket ??= 'app';
|
package/src/service.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
type ModelCrudSupport, type ModelStorageSupport, type ModelType, ModelRegistryIndex, ExistsError, NotFoundError, type OptionalId,
|
|
10
10
|
type ModelBlobSupport, type ModelExpirySupport, ModelCrudUtil, ModelExpiryUtil, ModelStorageUtil
|
|
11
11
|
} from '@travetto/model';
|
|
12
|
-
import { Injectable } from '@travetto/di';
|
|
12
|
+
import { Injectable, PostConstruct } from '@travetto/di';
|
|
13
13
|
import {
|
|
14
14
|
type Class, RuntimeError, castTo, asFull, type BinaryMetadata, type ByteRange, type BinaryType,
|
|
15
15
|
BinaryUtil, type TimeSpan, TimeUtil, type BinaryArray, CodecUtil, BinaryMetadataUtil, TypedObject, JSONUtil
|
|
@@ -178,7 +178,8 @@ export class S3ModelService implements ModelCrudSupport, ModelBlobSupport, Model
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
@PostConstruct()
|
|
182
|
+
async initializeClient(): Promise<void> {
|
|
182
183
|
this.client = new S3({
|
|
183
184
|
...this.config.config,
|
|
184
185
|
...('requestHandler' in this.config.config ? {
|