@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
|
@@ -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:
|
|
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
|
|
87
|
+
return `${this.config.CLOUD_FRONT_PUBLIC_DOMAIN}/${objectKey}`;
|
|
88
88
|
}
|
|
89
|
-
return this.
|
|
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
|