@clairejs/server 3.16.17 → 3.16.18
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 +2 -1
- package/dist/services/AbstractFileService.d.ts +1 -1
- package/dist/services/implementations/LocalFileService.d.ts +1 -1
- package/dist/services/implementations/LocalFileService.js +1 -1
- package/dist/services/implementations/S3FileService.d.ts +1 -1
- package/dist/services/implementations/S3FileService.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@ import { FileOperation } from "../common/FileOperation";
|
|
|
2
2
|
import { GetUploadUrlResponseBody } from "../controllers/dto/upload";
|
|
3
3
|
export declare abstract class AbstractFileService {
|
|
4
4
|
abstract getFileSize(objectKeys: string[]): Promise<number[]>;
|
|
5
|
-
abstract getAccessUrls(uris: string[], isPublic: boolean): Promise<string[]>;
|
|
5
|
+
abstract getAccessUrls(uris: (string | undefined)[], isPublic: boolean): Promise<string[]>;
|
|
6
6
|
abstract getPresignedUrl(operation: FileOperation, uris: string[]): Promise<string[]>;
|
|
7
7
|
abstract moveObject(uris: {
|
|
8
8
|
fromURI: string;
|
|
@@ -4,7 +4,7 @@ export declare class LocalFileService extends AbstractFileService {
|
|
|
4
4
|
protected readonly fileServerUrl: string;
|
|
5
5
|
constructor(fileServerUrl: string);
|
|
6
6
|
getFileSize(objectKeys: string[]): Promise<number[]>;
|
|
7
|
-
getAccessUrls(uris: string[], _isPublic: boolean): Promise<string[]>;
|
|
7
|
+
getAccessUrls(uris: (string | undefined)[], _isPublic: boolean): Promise<string[]>;
|
|
8
8
|
getPresignedUrl(operation: FileOperation, uris: string[]): Promise<string[]>;
|
|
9
9
|
moveObject(uris: {
|
|
10
10
|
fromURI: string;
|
|
@@ -15,7 +15,7 @@ export class LocalFileService extends AbstractFileService {
|
|
|
15
15
|
return fileInfo;
|
|
16
16
|
}
|
|
17
17
|
async getAccessUrls(uris, _isPublic) {
|
|
18
|
-
return uris.map((key) => `${this.fileServerUrl}/${key}`);
|
|
18
|
+
return uris.map((key) => (key ? `${this.fileServerUrl}/${key}` : ""));
|
|
19
19
|
}
|
|
20
20
|
async getPresignedUrl(operation, uris) {
|
|
21
21
|
if (operation === FileOperation.GET) {
|
|
@@ -16,7 +16,7 @@ export declare class S3FileService extends AbstractFileService {
|
|
|
16
16
|
private readonly cloudfrontSigner;
|
|
17
17
|
constructor(config: S3FileServiceConfig, logger: AbstractLogger);
|
|
18
18
|
getFileSize(objectKeys: string[]): Promise<number[]>;
|
|
19
|
-
getAccessUrls(uris: string[], isPublic: boolean): Promise<string[]>;
|
|
19
|
+
getAccessUrls(uris: (string | undefined)[], isPublic: boolean): Promise<string[]>;
|
|
20
20
|
getPresignedUrl(operation: FileOperation, uris: string[]): Promise<string[]>;
|
|
21
21
|
moveObject(uris: {
|
|
22
22
|
fromURI: string;
|
|
@@ -30,7 +30,7 @@ let S3FileService = class S3FileService extends AbstractFileService {
|
|
|
30
30
|
return await Promise.all(objectKeys.map((uri) => this.getSingleFileSize(uri)));
|
|
31
31
|
}
|
|
32
32
|
async getAccessUrls(uris, isPublic) {
|
|
33
|
-
return uris.map((uri) => this.getSingleAccessUrl(uri, isPublic));
|
|
33
|
+
return uris.map((uri) => (uri ? this.getSingleAccessUrl(uri, isPublic) : ""));
|
|
34
34
|
}
|
|
35
35
|
async getPresignedUrl(operation, uris) {
|
|
36
36
|
return uris.map((uri) => this.getSinglePresignedUrl(operation, 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: Date.now() + 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) {
|