@clairejs/server 3.16.6 → 3.16.7

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,7 +1,8 @@
1
1
  ## Change Log
2
2
 
3
- #### 3.16.6:
3
+ #### 3.16.7:
4
4
 
5
+ - refactor aws s3 file service
5
6
  - do not throw when fail to clean up in ModelRepository
6
7
  - fix file controllers
7
8
  - fix socket authentication, fix http error code in response
@@ -9,6 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  };
10
10
  import { AbstractLogger, LogContext } from "@clairejs/core";
11
11
  import aws from "aws-sdk";
12
+ import { FileOperation } from "../../common/FileOperation";
12
13
  import { AbstractFileService } from "../AbstractFileService";
13
14
  let S3FileService = class S3FileService extends AbstractFileService {
14
15
  config;
@@ -53,7 +54,7 @@ let S3FileService = class S3FileService extends AbstractFileService {
53
54
  getSinglePresignedUrl(_operation, objectKey) {
54
55
  return this.cloudfrontSigner.getSignedUrl({
55
56
  url: `${this.config.CLOUD_FRONT_PUBLIC_DOMAIN}/${objectKey}`,
56
- expires: Date.now() + 3600000,
57
+ expires: this.config.PRESIGNED_URL_EXPIRATION_S * 1000
57
58
  });
58
59
  }
59
60
  async copySingleObject(fromObjectKey, toObjectKey) {
@@ -82,14 +83,10 @@ let S3FileService = class S3FileService extends AbstractFileService {
82
83
  }
83
84
  }
84
85
  getSingleAccessUrl(objectKey, isPublic) {
85
- const url = `${this.config.CLOUD_FRONT_PUBLIC_DOMAIN}/${objectKey}`;
86
86
  if (isPublic) {
87
- return url;
87
+ return `${this.config.CLOUD_FRONT_PUBLIC_DOMAIN}/${objectKey}`;
88
88
  }
89
- return this.cloudfrontSigner.getSignedUrl({
90
- url,
91
- expires: Date.now() + this.config.PRESIGNED_URL_EXPIRATION_S * 1000,
92
- });
89
+ return this.getSinglePresignedUrl(FileOperation.GET, objectKey);
93
90
  }
94
91
  async removeSingleObject(objectKey) {
95
92
  await this.s3Client
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clairejs/server",
3
- "version": "3.16.6",
3
+ "version": "3.16.7",
4
4
  "description": "Claire server NodeJs framework written in Typescript.",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",