@payloadcms/storage-s3 3.0.0-alpha.62
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/LICENSE.md +22 -0
- package/README.md +1 -0
- package/dist/generateURL.d.ts +9 -0
- package/dist/generateURL.d.ts.map +1 -0
- package/dist/generateURL.js +7 -0
- package/dist/generateURL.js.map +1 -0
- package/dist/handleDelete.d.ts +9 -0
- package/dist/handleDelete.d.ts.map +1 -0
- package/dist/handleDelete.js +11 -0
- package/dist/handleDelete.js.map +1 -0
- package/dist/handleUpload.d.ts +13 -0
- package/dist/handleUpload.d.ts.map +1 -0
- package/dist/handleUpload.js +37 -0
- package/dist/handleUpload.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/staticHandler.d.ts +11 -0
- package/dist/staticHandler.d.ts.map +1 -0
- package/dist/staticHandler.js +49 -0
- package/dist/staticHandler.js.map +1 -0
- package/package.json +47 -0
- package/src/index.ts +109 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018-2022 Payload CMS, LLC <info@payloadcms.com>
|
|
4
|
+
Portions Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Nodemailer Email Adapter
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as AWS from '@aws-sdk/client-s3';
|
|
2
|
+
import type { GenerateURL } from '@payloadcms/plugin-cloud-storage/types';
|
|
3
|
+
interface Args {
|
|
4
|
+
bucket: string;
|
|
5
|
+
config: AWS.S3ClientConfig;
|
|
6
|
+
}
|
|
7
|
+
export declare const getGenerateURL: ({ bucket, config: { endpoint } }: Args) => GenerateURL;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=generateURL.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateURL.d.ts","sourceRoot":"","sources":["../src/generateURL.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,oBAAoB,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AAIzE,UAAU,IAAI;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,GAAG,CAAC,cAAc,CAAA;CAC3B;AAED,eAAO,MAAM,cAAc,qCACU,IAAI,KAAG,WAIzC,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
export const getGenerateURL = ({ bucket, config: { endpoint } })=>({ filename, prefix = '' })=>{
|
|
3
|
+
const stringifiedEndpoint = typeof endpoint === 'string' ? endpoint : endpoint?.toString();
|
|
4
|
+
return `${stringifiedEndpoint}/${bucket}/${path.posix.join(prefix, filename)}`;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=generateURL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/generateURL.ts"],"sourcesContent":["import type * as AWS from '@aws-sdk/client-s3'\nimport type { GenerateURL } from '@payloadcms/plugin-cloud-storage/types'\n\nimport path from 'path'\n\ninterface Args {\n bucket: string\n config: AWS.S3ClientConfig\n}\n\nexport const getGenerateURL =\n ({ bucket, config: { endpoint } }: Args): GenerateURL =>\n ({ filename, prefix = '' }) => {\n const stringifiedEndpoint = typeof endpoint === 'string' ? endpoint : endpoint?.toString()\n return `${stringifiedEndpoint}/${bucket}/${path.posix.join(prefix, filename)}`\n }\n"],"names":["path","getGenerateURL","bucket","config","endpoint","filename","prefix","stringifiedEndpoint","toString","posix","join"],"rangeMappings":";;;;","mappings":"AAGA,OAAOA,UAAU,OAAM;AAOvB,OAAO,MAAMC,iBACX,CAAC,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,EAAQ,GACvC,CAAC,EAAEC,QAAQ,EAAEC,SAAS,EAAE,EAAE;QACxB,MAAMC,sBAAsB,OAAOH,aAAa,WAAWA,WAAWA,UAAUI;QAChF,OAAO,CAAC,EAAED,oBAAoB,CAAC,EAAEL,OAAO,CAAC,EAAEF,KAAKS,KAAK,CAACC,IAAI,CAACJ,QAAQD,UAAU,CAAC;IAChF,EAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as AWS from '@aws-sdk/client-s3';
|
|
2
|
+
import type { HandleDelete } from '@payloadcms/plugin-cloud-storage/types';
|
|
3
|
+
interface Args {
|
|
4
|
+
bucket: string;
|
|
5
|
+
getStorageClient: () => AWS.S3;
|
|
6
|
+
}
|
|
7
|
+
export declare const getHandleDelete: ({ bucket, getStorageClient }: Args) => HandleDelete;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=handleDelete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleDelete.d.ts","sourceRoot":"","sources":["../src/handleDelete.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,oBAAoB,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAI1E,UAAU,IAAI;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,gBAAgB,EAAE,MAAM,GAAG,CAAC,EAAE,CAAA;CAC/B;AAED,eAAO,MAAM,eAAe,iCAAkC,IAAI,KAAG,YAOpE,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
export const getHandleDelete = ({ bucket, getStorageClient })=>{
|
|
3
|
+
return async ({ doc: { prefix = '' }, filename })=>{
|
|
4
|
+
await getStorageClient().deleteObject({
|
|
5
|
+
Bucket: bucket,
|
|
6
|
+
Key: path.posix.join(prefix, filename)
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=handleDelete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/handleDelete.ts"],"sourcesContent":["import type * as AWS from '@aws-sdk/client-s3'\nimport type { HandleDelete } from '@payloadcms/plugin-cloud-storage/types'\n\nimport path from 'path'\n\ninterface Args {\n bucket: string\n getStorageClient: () => AWS.S3\n}\n\nexport const getHandleDelete = ({ bucket, getStorageClient }: Args): HandleDelete => {\n return async ({ doc: { prefix = '' }, filename }) => {\n await getStorageClient().deleteObject({\n Bucket: bucket,\n Key: path.posix.join(prefix, filename),\n })\n }\n}\n"],"names":["path","getHandleDelete","bucket","getStorageClient","doc","prefix","filename","deleteObject","Bucket","Key","posix","join"],"rangeMappings":";;;;;;;;","mappings":"AAGA,OAAOA,UAAU,OAAM;AAOvB,OAAO,MAAMC,kBAAkB,CAAC,EAAEC,MAAM,EAAEC,gBAAgB,EAAQ;IAChE,OAAO,OAAO,EAAEC,KAAK,EAAEC,SAAS,EAAE,EAAE,EAAEC,QAAQ,EAAE;QAC9C,MAAMH,mBAAmBI,YAAY,CAAC;YACpCC,QAAQN;YACRO,KAAKT,KAAKU,KAAK,CAACC,IAAI,CAACN,QAAQC;QAC/B;IACF;AACF,EAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type * as AWS from '@aws-sdk/client-s3';
|
|
2
|
+
import type { HandleUpload } from '@payloadcms/plugin-cloud-storage/types';
|
|
3
|
+
import type { CollectionConfig } from 'payload/types';
|
|
4
|
+
interface Args {
|
|
5
|
+
acl?: 'private' | 'public-read';
|
|
6
|
+
bucket: string;
|
|
7
|
+
collection: CollectionConfig;
|
|
8
|
+
getStorageClient: () => AWS.S3;
|
|
9
|
+
prefix?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const getHandleUpload: ({ acl, bucket, getStorageClient, prefix, }: Args) => HandleUpload;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=handleUpload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleUpload.d.ts","sourceRoot":"","sources":["../src/handleUpload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,oBAAoB,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAMrD,UAAU,IAAI;IACZ,GAAG,CAAC,EAAE,SAAS,GAAG,aAAa,CAAA;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,gBAAgB,CAAA;IAC5B,gBAAgB,EAAE,MAAM,GAAG,CAAC,EAAE,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAID,eAAO,MAAM,eAAe,+CAKzB,IAAI,KAAG,YAqCT,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Upload } from '@aws-sdk/lib-storage';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
const multipartThreshold = 1024 * 1024 * 50 // 50MB
|
|
5
|
+
;
|
|
6
|
+
export const getHandleUpload = ({ acl, bucket, getStorageClient, prefix = '' })=>{
|
|
7
|
+
return async ({ data, file })=>{
|
|
8
|
+
const fileKey = path.posix.join(data.prefix || prefix, file.filename);
|
|
9
|
+
const fileBufferOrStream = file.tempFilePath ? fs.createReadStream(file.tempFilePath) : file.buffer;
|
|
10
|
+
if (file.buffer.length > 0 && file.buffer.length < multipartThreshold) {
|
|
11
|
+
await getStorageClient().putObject({
|
|
12
|
+
ACL: acl,
|
|
13
|
+
Body: fileBufferOrStream,
|
|
14
|
+
Bucket: bucket,
|
|
15
|
+
ContentType: file.mimeType,
|
|
16
|
+
Key: fileKey
|
|
17
|
+
});
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
20
|
+
const parallelUploadS3 = new Upload({
|
|
21
|
+
client: getStorageClient(),
|
|
22
|
+
params: {
|
|
23
|
+
ACL: acl,
|
|
24
|
+
Body: fileBufferOrStream,
|
|
25
|
+
Bucket: bucket,
|
|
26
|
+
ContentType: file.mimeType,
|
|
27
|
+
Key: fileKey
|
|
28
|
+
},
|
|
29
|
+
partSize: multipartThreshold,
|
|
30
|
+
queueSize: 4
|
|
31
|
+
});
|
|
32
|
+
await parallelUploadS3.done();
|
|
33
|
+
return data;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=handleUpload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/handleUpload.ts"],"sourcesContent":["import type * as AWS from '@aws-sdk/client-s3'\nimport type { HandleUpload } from '@payloadcms/plugin-cloud-storage/types'\nimport type { CollectionConfig } from 'payload/types'\n\nimport { Upload } from '@aws-sdk/lib-storage'\nimport fs from 'fs'\nimport path from 'path'\n\ninterface Args {\n acl?: 'private' | 'public-read'\n bucket: string\n collection: CollectionConfig\n getStorageClient: () => AWS.S3\n prefix?: string\n}\n\nconst multipartThreshold = 1024 * 1024 * 50 // 50MB\n\nexport const getHandleUpload = ({\n acl,\n bucket,\n getStorageClient,\n prefix = '',\n}: Args): HandleUpload => {\n return async ({ data, file }) => {\n const fileKey = path.posix.join(data.prefix || prefix, file.filename)\n\n const fileBufferOrStream = file.tempFilePath\n ? fs.createReadStream(file.tempFilePath)\n : file.buffer\n\n if (file.buffer.length > 0 && file.buffer.length < multipartThreshold) {\n await getStorageClient().putObject({\n ACL: acl,\n Body: fileBufferOrStream,\n Bucket: bucket,\n ContentType: file.mimeType,\n Key: fileKey,\n })\n\n return data\n }\n\n const parallelUploadS3 = new Upload({\n client: getStorageClient(),\n params: {\n ACL: acl,\n Body: fileBufferOrStream,\n Bucket: bucket,\n ContentType: file.mimeType,\n Key: fileKey,\n },\n partSize: multipartThreshold,\n queueSize: 4,\n })\n\n await parallelUploadS3.done()\n\n return data\n }\n}\n"],"names":["Upload","fs","path","multipartThreshold","getHandleUpload","acl","bucket","getStorageClient","prefix","data","file","fileKey","posix","join","filename","fileBufferOrStream","tempFilePath","createReadStream","buffer","length","putObject","ACL","Body","Bucket","ContentType","mimeType","Key","parallelUploadS3","client","params","partSize","queueSize","done"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,MAAM,QAAQ,uBAAsB;AAC7C,OAAOC,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AAUvB,MAAMC,qBAAqB,OAAO,OAAO,GAAG,OAAO;;AAEnD,OAAO,MAAMC,kBAAkB,CAAC,EAC9BC,GAAG,EACHC,MAAM,EACNC,gBAAgB,EAChBC,SAAS,EAAE,EACN;IACL,OAAO,OAAO,EAAEC,IAAI,EAAEC,IAAI,EAAE;QAC1B,MAAMC,UAAUT,KAAKU,KAAK,CAACC,IAAI,CAACJ,KAAKD,MAAM,IAAIA,QAAQE,KAAKI,QAAQ;QAEpE,MAAMC,qBAAqBL,KAAKM,YAAY,GACxCf,GAAGgB,gBAAgB,CAACP,KAAKM,YAAY,IACrCN,KAAKQ,MAAM;QAEf,IAAIR,KAAKQ,MAAM,CAACC,MAAM,GAAG,KAAKT,KAAKQ,MAAM,CAACC,MAAM,GAAGhB,oBAAoB;YACrE,MAAMI,mBAAmBa,SAAS,CAAC;gBACjCC,KAAKhB;gBACLiB,MAAMP;gBACNQ,QAAQjB;gBACRkB,aAAad,KAAKe,QAAQ;gBAC1BC,KAAKf;YACP;YAEA,OAAOF;QACT;QAEA,MAAMkB,mBAAmB,IAAI3B,OAAO;YAClC4B,QAAQrB;YACRsB,QAAQ;gBACNR,KAAKhB;gBACLiB,MAAMP;gBACNQ,QAAQjB;gBACRkB,aAAad,KAAKe,QAAQ;gBAC1BC,KAAKf;YACP;YACAmB,UAAU3B;YACV4B,WAAW;QACb;QAEA,MAAMJ,iBAAiBK,IAAI;QAE3B,OAAOvB;IACT;AACF,EAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { CollectionOptions } from '@payloadcms/plugin-cloud-storage/types';
|
|
2
|
+
import type { Plugin } from 'payload/config';
|
|
3
|
+
import * as AWS from '@aws-sdk/client-s3';
|
|
4
|
+
export type S3StorageOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* Access control list for uploaded files.
|
|
7
|
+
*/
|
|
8
|
+
acl?: 'private' | 'public-read';
|
|
9
|
+
/**
|
|
10
|
+
* Bucket name to upload files to.
|
|
11
|
+
*
|
|
12
|
+
* Must follow [AWS S3 bucket naming conventions](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html).
|
|
13
|
+
*/
|
|
14
|
+
bucket: string;
|
|
15
|
+
/**
|
|
16
|
+
* Collection options to apply the S3 adapter to.
|
|
17
|
+
*/
|
|
18
|
+
collections: Record<string, Omit<CollectionOptions, 'adapter'> | true>;
|
|
19
|
+
/**
|
|
20
|
+
* AWS S3 client configuration. Highly dependent on your AWS setup.
|
|
21
|
+
*
|
|
22
|
+
* [AWS.S3ClientConfig Docs](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/interfaces/s3clientconfig.html)
|
|
23
|
+
*/
|
|
24
|
+
config: AWS.S3ClientConfig;
|
|
25
|
+
/**
|
|
26
|
+
* Whether or not to disable local storage
|
|
27
|
+
*
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
disableLocalStorage?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether or not to enable the plugin
|
|
33
|
+
*
|
|
34
|
+
* Default: true
|
|
35
|
+
*/
|
|
36
|
+
enabled?: boolean;
|
|
37
|
+
};
|
|
38
|
+
type S3StoragePlugin = (storageS3Args: S3StorageOptions) => Plugin;
|
|
39
|
+
export declare const s3Storage: S3StoragePlugin;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,iBAAiB,EAElB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAEpD,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAA;AAQzC,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IAEH,GAAG,CAAC,EAAE,SAAS,GAAG,aAAa,CAAA;IAC/B;;;;OAIG;IAEH,MAAM,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,CAAA;IACtE;;;;OAIG;IACH,MAAM,EAAE,GAAG,CAAC,cAAc,CAAA;IAE1B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAE7B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,eAAe,GAAG,CAAC,aAAa,EAAE,gBAAgB,KAAK,MAAM,CAAA;AAElE,eAAO,MAAM,SAAS,EAAE,eA0BrB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as AWS from '@aws-sdk/client-s3';
|
|
2
|
+
import { cloudStorage } from '@payloadcms/plugin-cloud-storage';
|
|
3
|
+
import { getGenerateURL } from './generateURL.js';
|
|
4
|
+
import { getHandleDelete } from './handleDelete.js';
|
|
5
|
+
import { getHandleUpload } from './handleUpload.js';
|
|
6
|
+
import { getHandler } from './staticHandler.js';
|
|
7
|
+
export const s3Storage = (s3StorageOptions)=>(incomingConfig)=>{
|
|
8
|
+
if (s3StorageOptions.enabled === false) {
|
|
9
|
+
return incomingConfig;
|
|
10
|
+
}
|
|
11
|
+
const adapter = s3StorageInternal(s3StorageOptions);
|
|
12
|
+
// Add adapter to each collection option object
|
|
13
|
+
const collectionsWithAdapter = Object.entries(s3StorageOptions.collections).reduce((acc, [slug, collOptions])=>({
|
|
14
|
+
...acc,
|
|
15
|
+
[slug]: {
|
|
16
|
+
...collOptions === true ? {} : collOptions,
|
|
17
|
+
adapter
|
|
18
|
+
}
|
|
19
|
+
}), {});
|
|
20
|
+
return cloudStorage({
|
|
21
|
+
collections: collectionsWithAdapter
|
|
22
|
+
})(incomingConfig);
|
|
23
|
+
};
|
|
24
|
+
function s3StorageInternal({ acl, bucket, config = {} }) {
|
|
25
|
+
return ({ collection, prefix })=>{
|
|
26
|
+
let storageClient = null;
|
|
27
|
+
const getStorageClient = ()=>{
|
|
28
|
+
if (storageClient) return storageClient;
|
|
29
|
+
storageClient = new AWS.S3(config);
|
|
30
|
+
return storageClient;
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
generateURL: getGenerateURL({
|
|
34
|
+
bucket,
|
|
35
|
+
config
|
|
36
|
+
}),
|
|
37
|
+
handleDelete: getHandleDelete({
|
|
38
|
+
bucket,
|
|
39
|
+
getStorageClient
|
|
40
|
+
}),
|
|
41
|
+
handleUpload: getHandleUpload({
|
|
42
|
+
acl,
|
|
43
|
+
bucket,
|
|
44
|
+
collection,
|
|
45
|
+
getStorageClient,
|
|
46
|
+
prefix
|
|
47
|
+
}),
|
|
48
|
+
staticHandler: getHandler({
|
|
49
|
+
bucket,
|
|
50
|
+
collection,
|
|
51
|
+
getStorageClient
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {\n Adapter,\n PluginOptions as CloudStoragePluginOptions,\n CollectionOptions,\n GeneratedAdapter,\n} from '@payloadcms/plugin-cloud-storage/types'\nimport type { Config, Plugin } from 'payload/config'\n\nimport * as AWS from '@aws-sdk/client-s3'\nimport { cloudStorage } from '@payloadcms/plugin-cloud-storage'\n\nimport { getGenerateURL } from './generateURL.js'\nimport { getHandleDelete } from './handleDelete.js'\nimport { getHandleUpload } from './handleUpload.js'\nimport { getHandler } from './staticHandler.js'\n\nexport type S3StorageOptions = {\n /**\n * Access control list for uploaded files.\n */\n\n acl?: 'private' | 'public-read'\n /**\n * Bucket name to upload files to.\n *\n * Must follow [AWS S3 bucket naming conventions](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html).\n */\n\n bucket: string\n\n /**\n * Collection options to apply the S3 adapter to.\n */\n collections: Record<string, Omit<CollectionOptions, 'adapter'> | true>\n /**\n * AWS S3 client configuration. Highly dependent on your AWS setup.\n *\n * [AWS.S3ClientConfig Docs](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/interfaces/s3clientconfig.html)\n */\n config: AWS.S3ClientConfig\n\n /**\n * Whether or not to disable local storage\n *\n * @default true\n */\n disableLocalStorage?: boolean\n\n /**\n * Whether or not to enable the plugin\n *\n * Default: true\n */\n enabled?: boolean\n}\n\ntype S3StoragePlugin = (storageS3Args: S3StorageOptions) => Plugin\n\nexport const s3Storage: S3StoragePlugin =\n (s3StorageOptions: S3StorageOptions) =>\n (incomingConfig: Config): Config => {\n if (s3StorageOptions.enabled === false) {\n return incomingConfig\n }\n\n const adapter = s3StorageInternal(s3StorageOptions)\n\n // Add adapter to each collection option object\n const collectionsWithAdapter: CloudStoragePluginOptions['collections'] = Object.entries(\n s3StorageOptions.collections,\n ).reduce(\n (acc, [slug, collOptions]) => ({\n ...acc,\n [slug]: {\n ...(collOptions === true ? {} : collOptions),\n adapter,\n },\n }),\n {} as Record<string, CollectionOptions>,\n )\n\n return cloudStorage({\n collections: collectionsWithAdapter,\n })(incomingConfig)\n }\n\nfunction s3StorageInternal({ acl, bucket, config = {} }: S3StorageOptions): Adapter {\n return ({ collection, prefix }): GeneratedAdapter => {\n let storageClient: AWS.S3 | null = null\n const getStorageClient: () => AWS.S3 = () => {\n if (storageClient) return storageClient\n storageClient = new AWS.S3(config)\n return storageClient\n }\n\n return {\n generateURL: getGenerateURL({ bucket, config }),\n handleDelete: getHandleDelete({ bucket, getStorageClient }),\n handleUpload: getHandleUpload({\n acl,\n bucket,\n collection,\n getStorageClient,\n prefix,\n }),\n staticHandler: getHandler({ bucket, collection, getStorageClient }),\n }\n }\n}\n"],"names":["AWS","cloudStorage","getGenerateURL","getHandleDelete","getHandleUpload","getHandler","s3Storage","s3StorageOptions","incomingConfig","enabled","adapter","s3StorageInternal","collectionsWithAdapter","Object","entries","collections","reduce","acc","slug","collOptions","acl","bucket","config","collection","prefix","storageClient","getStorageClient","S3","generateURL","handleDelete","handleUpload","staticHandler"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAQA,YAAYA,SAAS,qBAAoB;AACzC,SAASC,YAAY,QAAQ,mCAAkC;AAE/D,SAASC,cAAc,QAAQ,mBAAkB;AACjD,SAASC,eAAe,QAAQ,oBAAmB;AACnD,SAASC,eAAe,QAAQ,oBAAmB;AACnD,SAASC,UAAU,QAAQ,qBAAoB;AA4C/C,OAAO,MAAMC,YACX,CAACC,mBACD,CAACC;QACC,IAAID,iBAAiBE,OAAO,KAAK,OAAO;YACtC,OAAOD;QACT;QAEA,MAAME,UAAUC,kBAAkBJ;QAElC,+CAA+C;QAC/C,MAAMK,yBAAmEC,OAAOC,OAAO,CACrFP,iBAAiBQ,WAAW,EAC5BC,MAAM,CACN,CAACC,KAAK,CAACC,MAAMC,YAAY,GAAM,CAAA;gBAC7B,GAAGF,GAAG;gBACN,CAACC,KAAK,EAAE;oBACN,GAAIC,gBAAgB,OAAO,CAAC,IAAIA,WAAW;oBAC3CT;gBACF;YACF,CAAA,GACA,CAAC;QAGH,OAAOT,aAAa;YAClBc,aAAaH;QACf,GAAGJ;IACL,EAAC;AAEH,SAASG,kBAAkB,EAAES,GAAG,EAAEC,MAAM,EAAEC,SAAS,CAAC,CAAC,EAAoB;IACvE,OAAO,CAAC,EAAEC,UAAU,EAAEC,MAAM,EAAE;QAC5B,IAAIC,gBAA+B;QACnC,MAAMC,mBAAiC;YACrC,IAAID,eAAe,OAAOA;YAC1BA,gBAAgB,IAAIzB,IAAI2B,EAAE,CAACL;YAC3B,OAAOG;QACT;QAEA,OAAO;YACLG,aAAa1B,eAAe;gBAAEmB;gBAAQC;YAAO;YAC7CO,cAAc1B,gBAAgB;gBAAEkB;gBAAQK;YAAiB;YACzDI,cAAc1B,gBAAgB;gBAC5BgB;gBACAC;gBACAE;gBACAG;gBACAF;YACF;YACAO,eAAe1B,WAAW;gBAAEgB;gBAAQE;gBAAYG;YAAiB;QACnE;IACF;AACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as AWS from '@aws-sdk/client-s3';
|
|
2
|
+
import type { StaticHandler } from '@payloadcms/plugin-cloud-storage/types';
|
|
3
|
+
import type { CollectionConfig } from 'payload/types';
|
|
4
|
+
interface Args {
|
|
5
|
+
bucket: string;
|
|
6
|
+
collection: CollectionConfig;
|
|
7
|
+
getStorageClient: () => AWS.S3;
|
|
8
|
+
}
|
|
9
|
+
export declare const getHandler: ({ bucket, collection, getStorageClient }: Args) => StaticHandler;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=staticHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staticHandler.d.ts","sourceRoot":"","sources":["../src/staticHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,oBAAoB,CAAA;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAA;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAKrD,UAAU,IAAI;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,gBAAgB,CAAA;IAC5B,gBAAgB,EAAE,MAAM,GAAG,CAAC,EAAE,CAAA;CAC/B;AAYD,eAAO,MAAM,UAAU,6CAA8C,IAAI,KAAG,aA8B3E,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { getFilePrefix } from '@payloadcms/plugin-cloud-storage/utilities';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
// Convert a stream into a promise that resolves with a Buffer
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
+
const streamToBuffer = async (readableStream)=>{
|
|
6
|
+
const chunks = [];
|
|
7
|
+
for await (const chunk of readableStream){
|
|
8
|
+
chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk);
|
|
9
|
+
}
|
|
10
|
+
return Buffer.concat(chunks);
|
|
11
|
+
};
|
|
12
|
+
export const getHandler = ({ bucket, collection, getStorageClient })=>{
|
|
13
|
+
return async (req, { params: { filename } })=>{
|
|
14
|
+
try {
|
|
15
|
+
const prefix = await getFilePrefix({
|
|
16
|
+
collection,
|
|
17
|
+
filename,
|
|
18
|
+
req
|
|
19
|
+
});
|
|
20
|
+
const object = await getStorageClient().getObject({
|
|
21
|
+
Bucket: bucket,
|
|
22
|
+
Key: path.posix.join(prefix, filename)
|
|
23
|
+
});
|
|
24
|
+
if (!object.Body) {
|
|
25
|
+
return new Response(null, {
|
|
26
|
+
status: 404,
|
|
27
|
+
statusText: 'Not Found'
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const bodyBuffer = await streamToBuffer(object.Body);
|
|
31
|
+
return new Response(bodyBuffer, {
|
|
32
|
+
headers: new Headers({
|
|
33
|
+
'Accept-Ranges': String(object.AcceptRanges),
|
|
34
|
+
'Content-Length': String(object.ContentLength),
|
|
35
|
+
'Content-Type': String(object.ContentType),
|
|
36
|
+
ETag: String(object.ETag)
|
|
37
|
+
}),
|
|
38
|
+
status: 200
|
|
39
|
+
});
|
|
40
|
+
} catch (err) {
|
|
41
|
+
req.payload.logger.error(err);
|
|
42
|
+
return new Response('Internal Server Error', {
|
|
43
|
+
status: 500
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=staticHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/staticHandler.ts"],"sourcesContent":["import type * as AWS from '@aws-sdk/client-s3'\nimport type { StaticHandler } from '@payloadcms/plugin-cloud-storage/types'\nimport type { CollectionConfig } from 'payload/types'\n\nimport { getFilePrefix } from '@payloadcms/plugin-cloud-storage/utilities'\nimport path from 'path'\n\ninterface Args {\n bucket: string\n collection: CollectionConfig\n getStorageClient: () => AWS.S3\n}\n\n// Convert a stream into a promise that resolves with a Buffer\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst streamToBuffer = async (readableStream: any) => {\n const chunks = []\n for await (const chunk of readableStream) {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk)\n }\n return Buffer.concat(chunks)\n}\n\nexport const getHandler = ({ bucket, collection, getStorageClient }: Args): StaticHandler => {\n return async (req, { params: { filename } }) => {\n try {\n const prefix = await getFilePrefix({ collection, filename, req })\n\n const object = await getStorageClient().getObject({\n Bucket: bucket,\n Key: path.posix.join(prefix, filename),\n })\n\n if (!object.Body) {\n return new Response(null, { status: 404, statusText: 'Not Found' })\n }\n\n const bodyBuffer = await streamToBuffer(object.Body)\n\n return new Response(bodyBuffer, {\n headers: new Headers({\n 'Accept-Ranges': String(object.AcceptRanges),\n 'Content-Length': String(object.ContentLength),\n 'Content-Type': String(object.ContentType),\n ETag: String(object.ETag),\n }),\n status: 200,\n })\n } catch (err) {\n req.payload.logger.error(err)\n return new Response('Internal Server Error', { status: 500 })\n }\n }\n}\n"],"names":["getFilePrefix","path","streamToBuffer","readableStream","chunks","chunk","push","Buffer","from","concat","getHandler","bucket","collection","getStorageClient","req","params","filename","prefix","object","getObject","Bucket","Key","posix","join","Body","Response","status","statusText","bodyBuffer","headers","Headers","String","AcceptRanges","ContentLength","ContentType","ETag","err","payload","logger","error"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,aAAa,QAAQ,6CAA4C;AAC1E,OAAOC,UAAU,OAAM;AAQvB,8DAA8D;AAC9D,8DAA8D;AAC9D,MAAMC,iBAAiB,OAAOC;IAC5B,MAAMC,SAAS,EAAE;IACjB,WAAW,MAAMC,SAASF,eAAgB;QACxCC,OAAOE,IAAI,CAAC,OAAOD,UAAU,WAAWE,OAAOC,IAAI,CAACH,SAASA;IAC/D;IACA,OAAOE,OAAOE,MAAM,CAACL;AACvB;AAEA,OAAO,MAAMM,aAAa,CAAC,EAAEC,MAAM,EAAEC,UAAU,EAAEC,gBAAgB,EAAQ;IACvE,OAAO,OAAOC,KAAK,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,EAAE;QACzC,IAAI;YACF,MAAMC,SAAS,MAAMjB,cAAc;gBAAEY;gBAAYI;gBAAUF;YAAI;YAE/D,MAAMI,SAAS,MAAML,mBAAmBM,SAAS,CAAC;gBAChDC,QAAQT;gBACRU,KAAKpB,KAAKqB,KAAK,CAACC,IAAI,CAACN,QAAQD;YAC/B;YAEA,IAAI,CAACE,OAAOM,IAAI,EAAE;gBAChB,OAAO,IAAIC,SAAS,MAAM;oBAAEC,QAAQ;oBAAKC,YAAY;gBAAY;YACnE;YAEA,MAAMC,aAAa,MAAM1B,eAAegB,OAAOM,IAAI;YAEnD,OAAO,IAAIC,SAASG,YAAY;gBAC9BC,SAAS,IAAIC,QAAQ;oBACnB,iBAAiBC,OAAOb,OAAOc,YAAY;oBAC3C,kBAAkBD,OAAOb,OAAOe,aAAa;oBAC7C,gBAAgBF,OAAOb,OAAOgB,WAAW;oBACzCC,MAAMJ,OAAOb,OAAOiB,IAAI;gBAC1B;gBACAT,QAAQ;YACV;QACF,EAAE,OAAOU,KAAK;YACZtB,IAAIuB,OAAO,CAACC,MAAM,CAACC,KAAK,CAACH;YACzB,OAAO,IAAIX,SAAS,yBAAyB;gBAAEC,QAAQ;YAAI;QAC7D;IACF;AACF,EAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@payloadcms/storage-s3",
|
|
3
|
+
"version": "3.0.0-alpha.62",
|
|
4
|
+
"description": "Payload storage adapter for Amazon S3",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/payloadcms/payload.git",
|
|
8
|
+
"directory": "packages/storage-s3"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"homepage": "https://payloadcms.com",
|
|
12
|
+
"author": "Payload CMS, Inc.",
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"require": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@payloadcms/plugin-cloud-storage": "3.0.0-alpha.62"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@aws-sdk/client-s3": "^3.525.0",
|
|
28
|
+
"@aws-sdk/lib-storage": "^3.525.0",
|
|
29
|
+
"payload": "3.0.0-alpha.62"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"payload": "3.0.0-alpha.62"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=18.20.2"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "pnpm build:swc && pnpm build:types",
|
|
42
|
+
"build:swc": "swc ./src -d ./dist --config-file .swcrc",
|
|
43
|
+
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
44
|
+
"build:clean": "find . \\( -type d \\( -name build -o -name dist -o -name .cache \\) -o -type f -name tsconfig.tsbuildinfo \\) -exec rm -rf {} + && pnpm build",
|
|
45
|
+
"clean": "rimraf {dist,*.tsbuildinfo}"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Adapter,
|
|
3
|
+
PluginOptions as CloudStoragePluginOptions,
|
|
4
|
+
CollectionOptions,
|
|
5
|
+
GeneratedAdapter,
|
|
6
|
+
} from '@payloadcms/plugin-cloud-storage/types'
|
|
7
|
+
import type { Config, Plugin } from 'payload/config'
|
|
8
|
+
|
|
9
|
+
import * as AWS from '@aws-sdk/client-s3'
|
|
10
|
+
import { cloudStorage } from '@payloadcms/plugin-cloud-storage'
|
|
11
|
+
|
|
12
|
+
import { getGenerateURL } from './generateURL.js'
|
|
13
|
+
import { getHandleDelete } from './handleDelete.js'
|
|
14
|
+
import { getHandleUpload } from './handleUpload.js'
|
|
15
|
+
import { getHandler } from './staticHandler.js'
|
|
16
|
+
|
|
17
|
+
export type S3StorageOptions = {
|
|
18
|
+
/**
|
|
19
|
+
* Access control list for uploaded files.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
acl?: 'private' | 'public-read'
|
|
23
|
+
/**
|
|
24
|
+
* Bucket name to upload files to.
|
|
25
|
+
*
|
|
26
|
+
* Must follow [AWS S3 bucket naming conventions](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html).
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
bucket: string
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Collection options to apply the S3 adapter to.
|
|
33
|
+
*/
|
|
34
|
+
collections: Record<string, Omit<CollectionOptions, 'adapter'> | true>
|
|
35
|
+
/**
|
|
36
|
+
* AWS S3 client configuration. Highly dependent on your AWS setup.
|
|
37
|
+
*
|
|
38
|
+
* [AWS.S3ClientConfig Docs](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/interfaces/s3clientconfig.html)
|
|
39
|
+
*/
|
|
40
|
+
config: AWS.S3ClientConfig
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Whether or not to disable local storage
|
|
44
|
+
*
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
disableLocalStorage?: boolean
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Whether or not to enable the plugin
|
|
51
|
+
*
|
|
52
|
+
* Default: true
|
|
53
|
+
*/
|
|
54
|
+
enabled?: boolean
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
type S3StoragePlugin = (storageS3Args: S3StorageOptions) => Plugin
|
|
58
|
+
|
|
59
|
+
export const s3Storage: S3StoragePlugin =
|
|
60
|
+
(s3StorageOptions: S3StorageOptions) =>
|
|
61
|
+
(incomingConfig: Config): Config => {
|
|
62
|
+
if (s3StorageOptions.enabled === false) {
|
|
63
|
+
return incomingConfig
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const adapter = s3StorageInternal(s3StorageOptions)
|
|
67
|
+
|
|
68
|
+
// Add adapter to each collection option object
|
|
69
|
+
const collectionsWithAdapter: CloudStoragePluginOptions['collections'] = Object.entries(
|
|
70
|
+
s3StorageOptions.collections,
|
|
71
|
+
).reduce(
|
|
72
|
+
(acc, [slug, collOptions]) => ({
|
|
73
|
+
...acc,
|
|
74
|
+
[slug]: {
|
|
75
|
+
...(collOptions === true ? {} : collOptions),
|
|
76
|
+
adapter,
|
|
77
|
+
},
|
|
78
|
+
}),
|
|
79
|
+
{} as Record<string, CollectionOptions>,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
return cloudStorage({
|
|
83
|
+
collections: collectionsWithAdapter,
|
|
84
|
+
})(incomingConfig)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function s3StorageInternal({ acl, bucket, config = {} }: S3StorageOptions): Adapter {
|
|
88
|
+
return ({ collection, prefix }): GeneratedAdapter => {
|
|
89
|
+
let storageClient: AWS.S3 | null = null
|
|
90
|
+
const getStorageClient: () => AWS.S3 = () => {
|
|
91
|
+
if (storageClient) return storageClient
|
|
92
|
+
storageClient = new AWS.S3(config)
|
|
93
|
+
return storageClient
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
generateURL: getGenerateURL({ bucket, config }),
|
|
98
|
+
handleDelete: getHandleDelete({ bucket, getStorageClient }),
|
|
99
|
+
handleUpload: getHandleUpload({
|
|
100
|
+
acl,
|
|
101
|
+
bucket,
|
|
102
|
+
collection,
|
|
103
|
+
getStorageClient,
|
|
104
|
+
prefix,
|
|
105
|
+
}),
|
|
106
|
+
staticHandler: getHandler({ bucket, collection, getStorageClient }),
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|