@clairejs/server 3.16.7 → 3.16.9

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  ## Change Log
2
2
 
3
- #### 3.16.7:
3
+ #### 3.16.9:
4
4
 
5
- - refactor aws s3 file service
5
+ - fix aws s3 file service
6
6
  - do not throw when fail to clean up in ModelRepository
7
7
  - fix file controllers
8
8
  - fix socket authentication, fix http error code in response
@@ -7,7 +7,7 @@ export interface S3FileServiceConfig {
7
7
  PRESIGNED_URL_EXPIRATION_S: number;
8
8
  CLOUD_FRONT_PUBLIC_DOMAIN: string;
9
9
  CLOUD_FRONT_PUBLIC_KEY_ID: string;
10
- CLOUD_FRONT_PRIVATE_KEY_BASE64: string;
10
+ CLOUD_FRONT_PRIVATE_KEY: string;
11
11
  }
12
12
  export declare class S3FileService extends AbstractFileService {
13
13
  protected readonly config: S3FileServiceConfig;
@@ -24,7 +24,7 @@ let S3FileService = class S3FileService extends AbstractFileService {
24
24
  signatureVersion: "v4",
25
25
  region: this.config.S3_BUCKET_REGION,
26
26
  });
27
- this.cloudfrontSigner = new aws.CloudFront.Signer(this.config.CLOUD_FRONT_PUBLIC_KEY_ID, Buffer.from(this.config.CLOUD_FRONT_PRIVATE_KEY_BASE64, "base64").toString());
27
+ this.cloudfrontSigner = new aws.CloudFront.Signer(this.config.CLOUD_FRONT_PUBLIC_KEY_ID, this.config.CLOUD_FRONT_PRIVATE_KEY);
28
28
  }
29
29
  async getFileSize(objectKeys) {
30
30
  return await Promise.all(objectKeys.map((uri) => this.getSingleFileSize(uri)));
@@ -54,7 +54,7 @@ let S3FileService = class S3FileService extends AbstractFileService {
54
54
  getSinglePresignedUrl(_operation, objectKey) {
55
55
  return this.cloudfrontSigner.getSignedUrl({
56
56
  url: `${this.config.CLOUD_FRONT_PUBLIC_DOMAIN}/${objectKey}`,
57
- expires: this.config.PRESIGNED_URL_EXPIRATION_S * 1000
57
+ expires: Date.now() + this.config.PRESIGNED_URL_EXPIRATION_S * 1000
58
58
  });
59
59
  }
60
60
  async copySingleObject(fromObjectKey, toObjectKey) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clairejs/server",
3
- "version": "3.16.7",
3
+ "version": "3.16.9",
4
4
  "description": "Claire server NodeJs framework written in Typescript.",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",