@payloadcms/storage-r2 4.0.0-internal.38b7f1d → 4.0.0-internal.c2b57ce
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/dist/client/R2ClientUploadHandler.d.ts +1 -1
- package/dist/client/R2ClientUploadHandler.d.ts.map +1 -1
- package/dist/handleMultiPartUpload.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +53 -49
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { R2StorageClientUploadHandlerParams } from '../types.js';
|
|
2
2
|
export declare const R2ClientUploadHandler: ({ children, collectionSlug, enabled, extra, prefix, serverHandlerPath, }: {
|
|
3
3
|
children: import("react").ReactNode;
|
|
4
|
-
collectionSlug: import("
|
|
4
|
+
collectionSlug: import("payload").UploadCollectionSlug;
|
|
5
5
|
enabled?: boolean;
|
|
6
6
|
extra: R2StorageClientUploadHandlerParams;
|
|
7
7
|
prefix?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"R2ClientUploadHandler.d.ts","sourceRoot":"","sources":["../../src/client/R2ClientUploadHandler.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAGV,kCAAkC,EAGnC,MAAM,aAAa,CAAA;AAEpB,eAAO,MAAM,qBAAqB;;;;;;;
|
|
1
|
+
{"version":3,"file":"R2ClientUploadHandler.d.ts","sourceRoot":"","sources":["../../src/client/R2ClientUploadHandler.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAGV,kCAAkC,EAGnC,MAAM,aAAa,CAAA;AAEpB,eAAO,MAAM,qBAAqB;;;;;;;iCAyFhC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleMultiPartUpload.d.ts","sourceRoot":"","sources":["../src/handleMultiPartUpload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAK7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAyC,MAAM,YAAY,CAAA;AAEjF,KAAK,IAAI,GAAG;IACV,MAAM,CAAC,EAAE,mBAAmB,CAAA;IAC5B,MAAM,EAAE,QAAQ,CAAA;IAChB,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAA;IAC5C,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B,CAAA;AAGD,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"handleMultiPartUpload.d.ts","sourceRoot":"","sources":["../src/handleMultiPartUpload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAK7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAyC,MAAM,YAAY,CAAA;AAEjF,KAAK,IAAI,GAAG;IACV,MAAM,CAAC,EAAE,mBAAmB,CAAA;IAC5B,MAAM,EAAE,QAAQ,CAAA;IAChB,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAA;IAC5C,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B,CAAA;AAGD,eAAO,MAAM,wBAAwB,GAClC,uDAA+D,IAAI,KAAG,cA+EtE,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ClientUploadsConfig, CollectionOptions } from '@payloadcms/plugin-cloud-storage/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { StorageAdapter, UploadCollectionSlug } from 'payload';
|
|
3
3
|
import type { R2Bucket } from './types.js';
|
|
4
4
|
export interface R2StorageOptions {
|
|
5
5
|
/**
|
|
@@ -37,7 +37,7 @@ export interface R2StorageOptions {
|
|
|
37
37
|
*/
|
|
38
38
|
useCompositePrefixes?: boolean;
|
|
39
39
|
}
|
|
40
|
-
type
|
|
41
|
-
export declare const r2Storage:
|
|
40
|
+
type R2StorageFactory = (r2StorageArgs: R2StorageOptions) => StorageAdapter;
|
|
41
|
+
export declare const r2Storage: R2StorageFactory;
|
|
42
42
|
export {};
|
|
43
43
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EAEnB,iBAAiB,EAClB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EAEnB,iBAAiB,EAClB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EAAU,cAAc,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAK3E,OAAO,KAAK,EAAE,QAAQ,EAAsC,MAAM,YAAY,CAAA;AAK9E,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAE5B,MAAM,EAAE,QAAQ,CAAA;IAChB;;OAEG;IACH,aAAa,CAAC,EAAE,mBAAmB,CAAA;IACnC;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;IAC7F,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;;;;;;;;OAYG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED,KAAK,gBAAgB,GAAG,CAAC,aAAa,EAAE,gBAAgB,KAAK,cAAc,CAAA;AAE3E,eAAO,MAAM,SAAS,EAAE,gBA4EtB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -2,58 +2,62 @@ import { cloudStoragePlugin } from '@payloadcms/plugin-cloud-storage';
|
|
|
2
2
|
import { initClientUploads } from '@payloadcms/plugin-cloud-storage/utilities';
|
|
3
3
|
import { createR2Adapter } from './adapter.js';
|
|
4
4
|
import { getHandleMultiPartUpload } from './handleMultiPartUpload.js';
|
|
5
|
-
export const r2Storage = (r2StorageOptions)=>(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
11
|
-
const isPluginDisabled = r2StorageOptions.enabled === false;
|
|
12
|
-
initClientUploads({
|
|
13
|
-
clientHandler: '@payloadcms/storage-r2/client#R2ClientUploadHandler',
|
|
14
|
-
collections: r2StorageOptions.collections,
|
|
15
|
-
config: incomingConfig,
|
|
16
|
-
enabled: !isPluginDisabled && Boolean(r2StorageOptions.clientUploads),
|
|
17
|
-
serverHandler: getHandleMultiPartUpload({
|
|
18
|
-
access: typeof r2StorageOptions.clientUploads === 'object' ? r2StorageOptions.clientUploads.access : undefined,
|
|
5
|
+
export const r2Storage = (r2StorageOptions)=>({
|
|
6
|
+
name: 'r2',
|
|
7
|
+
collections: Object.keys(r2StorageOptions.collections),
|
|
8
|
+
init: (incomingConfig)=>{
|
|
9
|
+
const adapter = createR2Adapter({
|
|
19
10
|
bucket: r2StorageOptions.bucket,
|
|
11
|
+
clientUploads: r2StorageOptions.clientUploads,
|
|
12
|
+
useCompositePrefixes: r2StorageOptions.useCompositePrefixes
|
|
13
|
+
});
|
|
14
|
+
const isPluginDisabled = r2StorageOptions.enabled === false;
|
|
15
|
+
initClientUploads({
|
|
16
|
+
clientHandler: '@payloadcms/storage-r2/client#R2ClientUploadHandler',
|
|
20
17
|
collections: r2StorageOptions.collections,
|
|
18
|
+
config: incomingConfig,
|
|
19
|
+
enabled: !isPluginDisabled && Boolean(r2StorageOptions.clientUploads),
|
|
20
|
+
serverHandler: getHandleMultiPartUpload({
|
|
21
|
+
access: typeof r2StorageOptions.clientUploads === 'object' ? r2StorageOptions.clientUploads.access : undefined,
|
|
22
|
+
bucket: r2StorageOptions.bucket,
|
|
23
|
+
collections: r2StorageOptions.collections,
|
|
24
|
+
useCompositePrefixes: r2StorageOptions.useCompositePrefixes
|
|
25
|
+
}),
|
|
26
|
+
serverHandlerPath: '/storage-r2-multi-part-upload'
|
|
27
|
+
});
|
|
28
|
+
if (isPluginDisabled) {
|
|
29
|
+
return incomingConfig;
|
|
30
|
+
}
|
|
31
|
+
// Add adapter to each collection option object
|
|
32
|
+
const collectionsWithAdapter = Object.entries(r2StorageOptions.collections).reduce((acc, [slug, collOptions])=>({
|
|
33
|
+
...acc,
|
|
34
|
+
[slug]: {
|
|
35
|
+
...collOptions === true ? {} : collOptions,
|
|
36
|
+
adapter
|
|
37
|
+
}
|
|
38
|
+
}), {});
|
|
39
|
+
// Set disableLocalStorage: true for collections specified in the plugin options
|
|
40
|
+
const config = {
|
|
41
|
+
...incomingConfig,
|
|
42
|
+
collections: (incomingConfig.collections || []).map((collection)=>{
|
|
43
|
+
if (!collectionsWithAdapter[collection.slug]) {
|
|
44
|
+
return collection;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
...collection,
|
|
48
|
+
upload: {
|
|
49
|
+
...typeof collection.upload === 'object' ? collection.upload : {},
|
|
50
|
+
disableLocalStorage: true
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
})
|
|
54
|
+
};
|
|
55
|
+
return cloudStoragePlugin({
|
|
56
|
+
alwaysInsertFields: r2StorageOptions.alwaysInsertFields,
|
|
57
|
+
collections: collectionsWithAdapter,
|
|
21
58
|
useCompositePrefixes: r2StorageOptions.useCompositePrefixes
|
|
22
|
-
})
|
|
23
|
-
serverHandlerPath: '/storage-r2-multi-part-upload'
|
|
24
|
-
});
|
|
25
|
-
if (isPluginDisabled) {
|
|
26
|
-
return incomingConfig;
|
|
59
|
+
})(config);
|
|
27
60
|
}
|
|
28
|
-
|
|
29
|
-
const collectionsWithAdapter = Object.entries(r2StorageOptions.collections).reduce((acc, [slug, collOptions])=>({
|
|
30
|
-
...acc,
|
|
31
|
-
[slug]: {
|
|
32
|
-
...collOptions === true ? {} : collOptions,
|
|
33
|
-
adapter
|
|
34
|
-
}
|
|
35
|
-
}), {});
|
|
36
|
-
// Set disableLocalStorage: true for collections specified in the plugin options
|
|
37
|
-
const config = {
|
|
38
|
-
...incomingConfig,
|
|
39
|
-
collections: (incomingConfig.collections || []).map((collection)=>{
|
|
40
|
-
if (!collectionsWithAdapter[collection.slug]) {
|
|
41
|
-
return collection;
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
...collection,
|
|
45
|
-
upload: {
|
|
46
|
-
...typeof collection.upload === 'object' ? collection.upload : {},
|
|
47
|
-
disableLocalStorage: true
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
})
|
|
51
|
-
};
|
|
52
|
-
return cloudStoragePlugin({
|
|
53
|
-
alwaysInsertFields: r2StorageOptions.alwaysInsertFields,
|
|
54
|
-
collections: collectionsWithAdapter,
|
|
55
|
-
useCompositePrefixes: r2StorageOptions.useCompositePrefixes
|
|
56
|
-
})(config);
|
|
57
|
-
};
|
|
61
|
+
});
|
|
58
62
|
|
|
59
63
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {\n ClientUploadsConfig,\n PluginOptions as CloudStoragePluginOptions,\n CollectionOptions,\n} from '@payloadcms/plugin-cloud-storage/types'\nimport type { Config,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {\n ClientUploadsConfig,\n PluginOptions as CloudStoragePluginOptions,\n CollectionOptions,\n} from '@payloadcms/plugin-cloud-storage/types'\nimport type { Config, StorageAdapter, UploadCollectionSlug } from 'payload'\n\nimport { cloudStoragePlugin } from '@payloadcms/plugin-cloud-storage'\nimport { initClientUploads } from '@payloadcms/plugin-cloud-storage/utilities'\n\nimport type { R2Bucket, R2StorageClientUploadHandlerParams } from './types.js'\n\nimport { createR2Adapter } from './adapter.js'\nimport { getHandleMultiPartUpload } from './handleMultiPartUpload.js'\n\nexport interface R2StorageOptions {\n /**\n * When enabled, fields (like the prefix field) will always be inserted into\n * the collection schema regardless of whether the plugin is enabled. This\n * ensures a consistent schema across all environments.\n *\n * This will be enabled by default in Payload v4.\n *\n * @default false\n */\n alwaysInsertFields?: boolean\n\n bucket: R2Bucket\n /**\n * Do uploads directly on the client, to bypass limits on Cloudflare/Vercel.\n */\n clientUploads?: ClientUploadsConfig\n /**\n * Collection options to apply the R2 adapter to.\n */\n collections: Partial<Record<UploadCollectionSlug, Omit<CollectionOptions, 'adapter'> | true>>\n enabled?: boolean\n /**\n * When true, the collection-level prefix and document-level prefix are combined\n * (compositional). When false (default), document prefix overrides collection\n * prefix entirely.\n *\n * Example:\n * - collection prefix: `collection-prefix/`\n * - document prefix: `document-prefix/`\n * - resulting prefix with useCompositePrefixes=true: `collection-prefix/document-prefix/`\n * - resulting prefix with useCompositePrefixes=false: `document-prefix/`\n *\n * @default false\n */\n useCompositePrefixes?: boolean\n}\n\ntype R2StorageFactory = (r2StorageArgs: R2StorageOptions) => StorageAdapter\n\nexport const r2Storage: R2StorageFactory = (\n r2StorageOptions: R2StorageOptions,\n): StorageAdapter => ({\n name: 'r2',\n collections: Object.keys(r2StorageOptions.collections),\n init: (incomingConfig: Config): Config => {\n const adapter = createR2Adapter({\n bucket: r2StorageOptions.bucket,\n clientUploads: r2StorageOptions.clientUploads,\n useCompositePrefixes: r2StorageOptions.useCompositePrefixes,\n })\n\n const isPluginDisabled = r2StorageOptions.enabled === false\n\n initClientUploads<\n R2StorageClientUploadHandlerParams,\n R2StorageOptions['collections'][keyof R2StorageOptions['collections']]\n >({\n clientHandler: '@payloadcms/storage-r2/client#R2ClientUploadHandler',\n collections: r2StorageOptions.collections,\n config: incomingConfig,\n enabled: !isPluginDisabled && Boolean(r2StorageOptions.clientUploads),\n serverHandler: getHandleMultiPartUpload({\n access:\n typeof r2StorageOptions.clientUploads === 'object'\n ? r2StorageOptions.clientUploads.access\n : undefined,\n bucket: r2StorageOptions.bucket,\n collections: r2StorageOptions.collections,\n useCompositePrefixes: r2StorageOptions.useCompositePrefixes,\n }),\n serverHandlerPath: '/storage-r2-multi-part-upload',\n })\n\n if (isPluginDisabled) {\n return incomingConfig\n }\n\n // Add adapter to each collection option object\n const collectionsWithAdapter: CloudStoragePluginOptions['collections'] = Object.entries(\n r2StorageOptions.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 // Set disableLocalStorage: true for collections specified in the plugin options\n const config = {\n ...incomingConfig,\n collections: (incomingConfig.collections || []).map((collection) => {\n if (!collectionsWithAdapter[collection.slug]) {\n return collection\n }\n\n return {\n ...collection,\n upload: {\n ...(typeof collection.upload === 'object' ? collection.upload : {}),\n disableLocalStorage: true,\n },\n }\n }),\n }\n\n return cloudStoragePlugin({\n alwaysInsertFields: r2StorageOptions.alwaysInsertFields,\n collections: collectionsWithAdapter,\n useCompositePrefixes: r2StorageOptions.useCompositePrefixes,\n })(config)\n },\n})\n"],"names":["cloudStoragePlugin","initClientUploads","createR2Adapter","getHandleMultiPartUpload","r2Storage","r2StorageOptions","name","collections","Object","keys","init","incomingConfig","adapter","bucket","clientUploads","useCompositePrefixes","isPluginDisabled","enabled","clientHandler","config","Boolean","serverHandler","access","undefined","serverHandlerPath","collectionsWithAdapter","entries","reduce","acc","slug","collOptions","map","collection","upload","disableLocalStorage","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AAACI,CAAAA,eAAeJ,WAAW,IAAI,EAAE,AAAD,EAAGwB,GAAG,CAAC,CAACC;oBACnD,IAAI,CAACP,sBAAsB,CAACO,WAAWH,IAAI,CAAC,EAAE;wBAC5C,OAAOG;oBACT;oBAEA,OAAO;wBACL,GAAGA,UAAU;wBACbC,QAAQ;4BACN,GAAI,OAAOD,WAAWC,MAAM,KAAK,WAAWD,WAAWC,MAAM,GAAG,CAAC,CAAC;4BAClEC,qBAAqB;wBACvB;oBACF;gBACF;YACF;YAEA,OAAOlC,mBAAmB;gBACxBmC,oBAAoB9B,iBAAiB8B,kBAAkB;gBACvD5B,aAAakB;gBACbV,sBAAsBV,iBAAiBU,oBAAoB;YAC7D,GAAGI;QACL;IACF,CAAA,EAAE"}
|
package/dist/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* R2Range is sourced from Cloudflare so it cannot drift; other types are our own
|
|
4
4
|
* so Node's Blob/Buffer/Headers are accepted and we avoid strict Workers-only types.
|
|
5
5
|
*/
|
|
6
|
-
import type { R2Range } from '@cloudflare/workers-types/2023-07-01';
|
|
6
|
+
import type { R2Range } from '@cloudflare/workers-types/2023-07-01/index.js';
|
|
7
7
|
export type { R2Range };
|
|
8
8
|
export interface R2GetOptions {
|
|
9
9
|
[key: string]: any;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAA;AAE5E,YAAY,EAAE,OAAO,EAAE,CAAA;AAEvB,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,GA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CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["/**\n * R2 API types compatible with both Node (Miniflare) and Cloudflare Workers.\n * R2Range is sourced from Cloudflare so it cannot drift; other types are our own\n * so Node's Blob/Buffer/Headers are accepted and we avoid strict Workers-only types.\n */\nimport type { R2Range } from '@cloudflare/workers-types/2023-07-01'\n\nexport type { R2Range }\n\nexport interface R2GetOptions {\n [key: string]: any\n onlyIf?: any | Headers\n range?: R2Range\n}\n\nexport interface R2Bucket {\n createMultipartUpload(key: string, options?: any): Promise<R2MultipartUpload>\n delete(keys: string | string[]): Promise<void>\n get(key: string, options?: R2GetOptions): Promise<null | R2ObjectBody>\n head(key: string): Promise<null | R2Object>\n list(options?: any): Promise<any>\n put(\n key: string,\n value: ArrayBuffer | ArrayBufferView | Blob | null | ReadableStream | string,\n options?: any,\n ): Promise<any>\n resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload\n}\n\ninterface R2HTTPMetadata {\n cacheControl?: string\n cacheExpiry?: Date\n contentDisposition?: string\n contentEncoding?: string\n contentLanguage?: string\n contentType?: string\n}\n\nexport interface R2Object {\n readonly etag: string\n readonly httpMetadata?: R2HTTPMetadata\n readonly key: string\n readonly size: number\n writeHttpMetadata(headers: Headers): void\n}\n\nexport interface R2ObjectBody extends R2Object {\n get body(): ReadableStream\n}\n\nexport interface R2MultipartUpload {\n abort(): Promise<void>\n complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>\n readonly key: string\n readonly uploadId: string\n uploadPart(\n partNumber: number,\n value: (ArrayBuffer | ArrayBufferView) | Blob | ReadableStream | string,\n options?: any,\n ): Promise<R2UploadedPart>\n}\n\nexport interface R2UploadedPart {\n etag: string\n partNumber: number\n}\n\nexport interface R2StorageClientUploadContext {\n key: string\n prefix: string\n}\nexport type R2StorageClientUploadHandlerParams = {\n chunkSize?: number\n}\n\nexport type R2StorageMultipartUploadHandlerParams = {\n collection: string\n docPrefix?: string\n fileName: string\n fileType: string\n multipartId?: string\n multipartKey?: string\n multipartNumber?: string\n}\n"],"names":[],"mappings":"AAAA;;;;CAIC,GAuED,WAQC"}
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["/**\n * R2 API types compatible with both Node (Miniflare) and Cloudflare Workers.\n * R2Range is sourced from Cloudflare so it cannot drift; other types are our own\n * so Node's Blob/Buffer/Headers are accepted and we avoid strict Workers-only types.\n */\nimport type { R2Range } from '@cloudflare/workers-types/2023-07-01/index.js'\n\nexport type { R2Range }\n\nexport interface R2GetOptions {\n [key: string]: any\n onlyIf?: any | Headers\n range?: R2Range\n}\n\nexport interface R2Bucket {\n createMultipartUpload(key: string, options?: any): Promise<R2MultipartUpload>\n delete(keys: string | string[]): Promise<void>\n get(key: string, options?: R2GetOptions): Promise<null | R2ObjectBody>\n head(key: string): Promise<null | R2Object>\n list(options?: any): Promise<any>\n put(\n key: string,\n value: ArrayBuffer | ArrayBufferView | Blob | null | ReadableStream | string,\n options?: any,\n ): Promise<any>\n resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload\n}\n\ninterface R2HTTPMetadata {\n cacheControl?: string\n cacheExpiry?: Date\n contentDisposition?: string\n contentEncoding?: string\n contentLanguage?: string\n contentType?: string\n}\n\nexport interface R2Object {\n readonly etag: string\n readonly httpMetadata?: R2HTTPMetadata\n readonly key: string\n readonly size: number\n writeHttpMetadata(headers: Headers): void\n}\n\nexport interface R2ObjectBody extends R2Object {\n get body(): ReadableStream\n}\n\nexport interface R2MultipartUpload {\n abort(): Promise<void>\n complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>\n readonly key: string\n readonly uploadId: string\n uploadPart(\n partNumber: number,\n value: (ArrayBuffer | ArrayBufferView) | Blob | ReadableStream | string,\n options?: any,\n ): Promise<R2UploadedPart>\n}\n\nexport interface R2UploadedPart {\n etag: string\n partNumber: number\n}\n\nexport interface R2StorageClientUploadContext {\n key: string\n prefix: string\n}\nexport type R2StorageClientUploadHandlerParams = {\n chunkSize?: number\n}\n\nexport type R2StorageMultipartUploadHandlerParams = {\n collection: string\n docPrefix?: string\n fileName: string\n fileType: string\n multipartId?: string\n multipartKey?: string\n multipartNumber?: string\n}\n"],"names":[],"mappings":"AAAA;;;;CAIC,GAuED,WAQC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/storage-r2",
|
|
3
|
-
"version": "4.0.0-internal.
|
|
3
|
+
"version": "4.0.0-internal.c2b57ce",
|
|
4
4
|
"description": "Payload storage adapter for Cloudflare R2",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@payloadcms/plugin-cloud-storage": "4.0.0-internal.
|
|
40
|
+
"@payloadcms/plugin-cloud-storage": "4.0.0-internal.c2b57ce"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@cloudflare/workers-types": "4.20260218.0",
|
|
44
|
-
"payload": "4.0.0-internal.
|
|
44
|
+
"payload": "4.0.0-internal.c2b57ce"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"payload": "4.0.0-internal.
|
|
47
|
+
"payload": "4.0.0-internal.c2b57ce"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
50
50
|
"node": ">=24.15.0"
|