@payloadcms/storage-vercel-blob 4.0.0-internal.b8e7c89 → 4.0.0-internal.bf4bcce

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.
Files changed (41) hide show
  1. package/README.md +10 -8
  2. package/dist/adapter.d.ts +3 -1
  3. package/dist/adapter.d.ts.map +1 -1
  4. package/dist/adapter.js +68 -26
  5. package/dist/adapter.js.map +1 -1
  6. package/dist/authorizeFileOverwrite.d.ts +16 -0
  7. package/dist/authorizeFileOverwrite.d.ts.map +1 -0
  8. package/dist/authorizeFileOverwrite.js +117 -0
  9. package/dist/authorizeFileOverwrite.js.map +1 -0
  10. package/dist/client/VercelBlobClientUploadHandler.d.ts.map +1 -1
  11. package/dist/client/VercelBlobClientUploadHandler.js +3 -9
  12. package/dist/client/VercelBlobClientUploadHandler.js.map +1 -1
  13. package/dist/copyFile.d.ts +12 -0
  14. package/dist/copyFile.d.ts.map +1 -0
  15. package/dist/copyFile.js +86 -0
  16. package/dist/copyFile.js.map +1 -0
  17. package/dist/deleteFile.d.ts +2 -5
  18. package/dist/deleteFile.d.ts.map +1 -1
  19. package/dist/deleteFile.js +3 -10
  20. package/dist/deleteFile.js.map +1 -1
  21. package/dist/generateURL.d.ts +1 -0
  22. package/dist/generateURL.d.ts.map +1 -1
  23. package/dist/generateURL.js +13 -9
  24. package/dist/generateURL.js.map +1 -1
  25. package/dist/getCollectionSources.d.ts +20 -0
  26. package/dist/getCollectionSources.d.ts.map +1 -0
  27. package/dist/getCollectionSources.js +27 -0
  28. package/dist/getCollectionSources.js.map +1 -0
  29. package/dist/getFile.d.ts +4 -3
  30. package/dist/getFile.d.ts.map +1 -1
  31. package/dist/getFile.js +20 -12
  32. package/dist/getFile.js.map +1 -1
  33. package/dist/index.d.ts +10 -18
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +33 -22
  36. package/dist/index.js.map +1 -1
  37. package/dist/uploadFile.d.ts +2 -5
  38. package/dist/uploadFile.d.ts.map +1 -1
  39. package/dist/uploadFile.js +2 -9
  40. package/dist/uploadFile.js.map +1 -1
  41. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/deleteFile.ts"],"sourcesContent":["import { del } from '@vercel/blob'\n\nimport { generateURL } from './generateURL.js'\n\ninterface DeleteFileArgs {\n baseUrl: string\n collectionPrefix?: string\n docPrefix: string\n filename: string\n token: string\n useCompositePrefixes?: boolean\n}\n\nexport async function deleteFile({\n baseUrl,\n collectionPrefix = '',\n docPrefix,\n filename,\n token,\n useCompositePrefixes = false,\n}: DeleteFileArgs): Promise<void> {\n const fileUrl = generateURL({\n baseUrl,\n collectionPrefix,\n filename,\n prefix: docPrefix,\n useCompositePrefixes,\n })\n\n await del(fileUrl, { token })\n}\n"],"names":["del","generateURL","deleteFile","baseUrl","collectionPrefix","docPrefix","filename","token","useCompositePrefixes","fileUrl","prefix"],"mappings":"AAAA,SAASA,GAAG,QAAQ,eAAc;AAElC,SAASC,WAAW,QAAQ,mBAAkB;AAW9C,OAAO,eAAeC,WAAW,EAC/BC,OAAO,EACPC,mBAAmB,EAAE,EACrBC,SAAS,EACTC,QAAQ,EACRC,KAAK,EACLC,uBAAuB,KAAK,EACb;IACf,MAAMC,UAAUR,YAAY;QAC1BE;QACAC;QACAE;QACAI,QAAQL;QACRG;IACF;IAEA,MAAMR,IAAIS,SAAS;QAAEF;IAAM;AAC7B"}
1
+ {"version":3,"sources":["../src/deleteFile.ts"],"sourcesContent":["import { del } from '@vercel/blob'\n\nimport { buildBlobUrl } from './generateURL.js'\n\ninterface DeleteFileArgs {\n baseUrl: string\n storageFilePath: string\n token: string\n}\n\nexport async function deleteFile({\n baseUrl,\n storageFilePath,\n token,\n}: DeleteFileArgs): Promise<void> {\n await del(buildBlobUrl(baseUrl, storageFilePath), { token })\n}\n"],"names":["del","buildBlobUrl","deleteFile","baseUrl","storageFilePath","token"],"mappings":"AAAA,SAASA,GAAG,QAAQ,eAAc;AAElC,SAASC,YAAY,QAAQ,mBAAkB;AAQ/C,OAAO,eAAeC,WAAW,EAC/BC,OAAO,EACPC,eAAe,EACfC,KAAK,EACU;IACf,MAAML,IAAIC,aAAaE,SAASC,kBAAkB;QAAEC;IAAM;AAC5D"}
@@ -5,6 +5,7 @@ interface GenerateURLArgs {
5
5
  prefix: string;
6
6
  useCompositePrefixes?: boolean;
7
7
  }
8
+ export declare function buildBlobUrl(baseUrl: string, storageFilePath: string): string;
8
9
  export declare function generateURL({ baseUrl, collectionPrefix, filename, prefix, useCompositePrefixes, }: GenerateURLArgs): string;
9
10
  export {};
10
11
  //# sourceMappingURL=generateURL.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateURL.d.ts","sourceRoot":"","sources":["../src/generateURL.ts"],"names":[],"mappings":"AAGA,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,gBAAqB,EACrB,QAAQ,EACR,MAAM,EACN,oBAA4B,GAC7B,EAAE,eAAe,GAAG,MAAM,CAgB1B"}
1
+ {"version":3,"file":"generateURL.d.ts","sourceRoot":"","sources":["../src/generateURL.ts"],"names":[],"mappings":"AAGA,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAGD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAU7E;AAED,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,gBAAqB,EACrB,QAAQ,EACR,MAAM,EACN,oBAA4B,GAC7B,EAAE,eAAe,GAAG,MAAM,CAS1B"}
@@ -1,19 +1,23 @@
1
- import { getFileKey } from '@payloadcms/plugin-cloud-storage/utilities';
1
+ import { buildStoragePathData } from '@payloadcms/plugin-cloud-storage/utilities';
2
2
  import path from 'path';
3
+ // Builds the public blob URL for a storage path, URL-encoding only the filename segment.
4
+ export function buildBlobUrl(baseUrl, storageFilePath) {
5
+ // example: "my-collection/my-doc/my file.jpg" -> "my-collection/my-doc"
6
+ const dir = path.posix.dirname(storageFilePath);
7
+ // example: "my file.jpg" -> "my%20file.jpg"
8
+ const encodedFilename = encodeURIComponent(path.posix.basename(storageFilePath));
9
+ // example: "my-collection/my-doc/my%20file.jpg"
10
+ const storageFilePathWithEncodedFilename = dir === '.' ? encodedFilename : path.posix.join(dir, encodedFilename);
11
+ return `${baseUrl}/${storageFilePathWithEncodedFilename}`;
12
+ }
3
13
  export function generateURL({ baseUrl, collectionPrefix = '', filename, prefix, useCompositePrefixes = false }) {
4
- const { fileKey: fileKeyWithPrefix } = getFileKey({
14
+ const { storageFilePath } = buildStoragePathData({
5
15
  collectionPrefix,
6
16
  docPrefix: prefix,
7
17
  filename,
8
18
  useCompositePrefixes
9
19
  });
10
- // example: "my-collection/my-doc/my file.jpg" -> "my-collection/my-doc"
11
- const dir = path.posix.dirname(fileKeyWithPrefix);
12
- // example: "my file.jpg" -> "my%20file.jpg"
13
- const encodedFilename = encodeURIComponent(path.posix.basename(fileKeyWithPrefix));
14
- // example: "my-collection/my-doc/my%20file.jpg"
15
- const fileKeyWithEncodedFilename = dir === '.' ? encodedFilename : path.posix.join(dir, encodedFilename);
16
- return `${baseUrl}/${fileKeyWithEncodedFilename}`;
20
+ return buildBlobUrl(baseUrl, storageFilePath);
17
21
  }
18
22
 
19
23
  //# sourceMappingURL=generateURL.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/generateURL.ts"],"sourcesContent":["import { getFileKey } from '@payloadcms/plugin-cloud-storage/utilities'\nimport path from 'path'\n\ninterface GenerateURLArgs {\n baseUrl: string\n collectionPrefix?: string\n filename: string\n prefix: string\n useCompositePrefixes?: boolean\n}\n\nexport function generateURL({\n baseUrl,\n collectionPrefix = '',\n filename,\n prefix,\n useCompositePrefixes = false,\n}: GenerateURLArgs): string {\n const { fileKey: fileKeyWithPrefix } = getFileKey({\n collectionPrefix,\n docPrefix: prefix,\n filename,\n useCompositePrefixes,\n })\n // example: \"my-collection/my-doc/my file.jpg\" -> \"my-collection/my-doc\"\n const dir = path.posix.dirname(fileKeyWithPrefix)\n // example: \"my file.jpg\" -> \"my%20file.jpg\"\n const encodedFilename = encodeURIComponent(path.posix.basename(fileKeyWithPrefix))\n // example: \"my-collection/my-doc/my%20file.jpg\"\n const fileKeyWithEncodedFilename =\n dir === '.' ? encodedFilename : path.posix.join(dir, encodedFilename)\n\n return `${baseUrl}/${fileKeyWithEncodedFilename}`\n}\n"],"names":["getFileKey","path","generateURL","baseUrl","collectionPrefix","filename","prefix","useCompositePrefixes","fileKey","fileKeyWithPrefix","docPrefix","dir","posix","dirname","encodedFilename","encodeURIComponent","basename","fileKeyWithEncodedFilename","join"],"mappings":"AAAA,SAASA,UAAU,QAAQ,6CAA4C;AACvE,OAAOC,UAAU,OAAM;AAUvB,OAAO,SAASC,YAAY,EAC1BC,OAAO,EACPC,mBAAmB,EAAE,EACrBC,QAAQ,EACRC,MAAM,EACNC,uBAAuB,KAAK,EACZ;IAChB,MAAM,EAAEC,SAASC,iBAAiB,EAAE,GAAGT,WAAW;QAChDI;QACAM,WAAWJ;QACXD;QACAE;IACF;IACA,wEAAwE;IACxE,MAAMI,MAAMV,KAAKW,KAAK,CAACC,OAAO,CAACJ;IAC/B,4CAA4C;IAC5C,MAAMK,kBAAkBC,mBAAmBd,KAAKW,KAAK,CAACI,QAAQ,CAACP;IAC/D,gDAAgD;IAChD,MAAMQ,6BACJN,QAAQ,MAAMG,kBAAkBb,KAAKW,KAAK,CAACM,IAAI,CAACP,KAAKG;IAEvD,OAAO,GAAGX,QAAQ,CAAC,EAAEc,4BAA4B;AACnD"}
1
+ {"version":3,"sources":["../src/generateURL.ts"],"sourcesContent":["import { buildStoragePathData } from '@payloadcms/plugin-cloud-storage/utilities'\nimport path from 'path'\n\ninterface GenerateURLArgs {\n baseUrl: string\n collectionPrefix?: string\n filename: string\n prefix: string\n useCompositePrefixes?: boolean\n}\n\n// Builds the public blob URL for a storage path, URL-encoding only the filename segment.\nexport function buildBlobUrl(baseUrl: string, storageFilePath: string): string {\n // example: \"my-collection/my-doc/my file.jpg\" -> \"my-collection/my-doc\"\n const dir = path.posix.dirname(storageFilePath)\n // example: \"my file.jpg\" -> \"my%20file.jpg\"\n const encodedFilename = encodeURIComponent(path.posix.basename(storageFilePath))\n // example: \"my-collection/my-doc/my%20file.jpg\"\n const storageFilePathWithEncodedFilename =\n dir === '.' ? encodedFilename : path.posix.join(dir, encodedFilename)\n\n return `${baseUrl}/${storageFilePathWithEncodedFilename}`\n}\n\nexport function generateURL({\n baseUrl,\n collectionPrefix = '',\n filename,\n prefix,\n useCompositePrefixes = false,\n}: GenerateURLArgs): string {\n const { storageFilePath } = buildStoragePathData({\n collectionPrefix,\n docPrefix: prefix,\n filename,\n useCompositePrefixes,\n })\n\n return buildBlobUrl(baseUrl, storageFilePath)\n}\n"],"names":["buildStoragePathData","path","buildBlobUrl","baseUrl","storageFilePath","dir","posix","dirname","encodedFilename","encodeURIComponent","basename","storageFilePathWithEncodedFilename","join","generateURL","collectionPrefix","filename","prefix","useCompositePrefixes","docPrefix"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,6CAA4C;AACjF,OAAOC,UAAU,OAAM;AAUvB,yFAAyF;AACzF,OAAO,SAASC,aAAaC,OAAe,EAAEC,eAAuB;IACnE,wEAAwE;IACxE,MAAMC,MAAMJ,KAAKK,KAAK,CAACC,OAAO,CAACH;IAC/B,4CAA4C;IAC5C,MAAMI,kBAAkBC,mBAAmBR,KAAKK,KAAK,CAACI,QAAQ,CAACN;IAC/D,gDAAgD;IAChD,MAAMO,qCACJN,QAAQ,MAAMG,kBAAkBP,KAAKK,KAAK,CAACM,IAAI,CAACP,KAAKG;IAEvD,OAAO,GAAGL,QAAQ,CAAC,EAAEQ,oCAAoC;AAC3D;AAEA,OAAO,SAASE,YAAY,EAC1BV,OAAO,EACPW,mBAAmB,EAAE,EACrBC,QAAQ,EACRC,MAAM,EACNC,uBAAuB,KAAK,EACZ;IAChB,MAAM,EAAEb,eAAe,EAAE,GAAGJ,qBAAqB;QAC/Cc;QACAI,WAAWF;QACXD;QACAE;IACF;IAEA,OAAOf,aAAaC,SAASC;AAC/B"}
@@ -0,0 +1,20 @@
1
+ import type { StorageAdapter } from 'payload';
2
+ import type { VercelBlobCollectionSource } from './authorizeFileOverwrite.js';
3
+ type VercelBlobStorageMetadata = {
4
+ collections: Record<string, {
5
+ prefix?: string;
6
+ } | true | undefined>;
7
+ enabled: boolean;
8
+ storeId?: string;
9
+ useCompositePrefixes: boolean;
10
+ };
11
+ export declare const vercelBlobStorageMetadata: unique symbol;
12
+ export type InternalVercelBlobStorageAdapter = {
13
+ [vercelBlobStorageMetadata]: VercelBlobStorageMetadata;
14
+ } & StorageAdapter;
15
+ export declare const getCollectionSources: ({ currentAdapter, storageAdapters, }: {
16
+ currentAdapter: InternalVercelBlobStorageAdapter;
17
+ storageAdapters?: StorageAdapter[];
18
+ }) => VercelBlobCollectionSource[];
19
+ export {};
20
+ //# sourceMappingURL=getCollectionSources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCollectionSources.d.ts","sourceRoot":"","sources":["../src/getCollectionSources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAA;AAE7E,KAAK,yBAAyB,GAAG;IAC/B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;IACnE,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,oBAAoB,EAAE,OAAO,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,yBAAyB,eAAsC,CAAA;AAE5E,MAAM,MAAM,gCAAgC,GAAG;IAC7C,CAAC,yBAAyB,CAAC,EAAE,yBAAyB,CAAA;CACvD,GAAG,cAAc,CAAA;AAMlB,eAAO,MAAM,oBAAoB,yCAG9B;IACD,cAAc,EAAE,gCAAgC,CAAA;IAChD,eAAe,CAAC,EAAE,cAAc,EAAE,CAAA;CACnC,KAAG,0BAA0B,EAoB7B,CAAA"}
@@ -0,0 +1,27 @@
1
+ export const vercelBlobStorageMetadata = Symbol('vercelBlobStorageMetadata');
2
+ const isInternalVercelBlobStorageAdapter = (adapter)=>vercelBlobStorageMetadata in adapter;
3
+ export const getCollectionSources = ({ currentAdapter, storageAdapters = [] })=>{
4
+ const currentMetadata = currentAdapter[vercelBlobStorageMetadata];
5
+ const adapters = new Set([
6
+ currentAdapter,
7
+ ...storageAdapters
8
+ ]);
9
+ return [
10
+ ...adapters
11
+ ].flatMap((adapter)=>{
12
+ if (!isInternalVercelBlobStorageAdapter(adapter)) {
13
+ return [];
14
+ }
15
+ const metadata = adapter[vercelBlobStorageMetadata];
16
+ if (!metadata.enabled || metadata.storeId !== currentMetadata.storeId) {
17
+ return [];
18
+ }
19
+ return Object.entries(metadata.collections).map(([collectionSlug, options])=>({
20
+ collectionPrefix: options === true ? '' : options?.prefix || '',
21
+ collectionSlug,
22
+ useCompositePrefixes: metadata.useCompositePrefixes
23
+ }));
24
+ });
25
+ };
26
+
27
+ //# sourceMappingURL=getCollectionSources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/getCollectionSources.ts"],"sourcesContent":["import type { StorageAdapter } from 'payload'\n\nimport type { VercelBlobCollectionSource } from './authorizeFileOverwrite.js'\n\ntype VercelBlobStorageMetadata = {\n collections: Record<string, { prefix?: string } | true | undefined>\n enabled: boolean\n storeId?: string\n useCompositePrefixes: boolean\n}\n\nexport const vercelBlobStorageMetadata = Symbol('vercelBlobStorageMetadata')\n\nexport type InternalVercelBlobStorageAdapter = {\n [vercelBlobStorageMetadata]: VercelBlobStorageMetadata\n} & StorageAdapter\n\nconst isInternalVercelBlobStorageAdapter = (\n adapter: StorageAdapter,\n): adapter is InternalVercelBlobStorageAdapter => vercelBlobStorageMetadata in adapter\n\nexport const getCollectionSources = ({\n currentAdapter,\n storageAdapters = [],\n}: {\n currentAdapter: InternalVercelBlobStorageAdapter\n storageAdapters?: StorageAdapter[]\n}): VercelBlobCollectionSource[] => {\n const currentMetadata = currentAdapter[vercelBlobStorageMetadata]\n const adapters = new Set([currentAdapter, ...storageAdapters])\n\n return [...adapters].flatMap((adapter) => {\n if (!isInternalVercelBlobStorageAdapter(adapter)) {\n return []\n }\n\n const metadata = adapter[vercelBlobStorageMetadata]\n if (!metadata.enabled || metadata.storeId !== currentMetadata.storeId) {\n return []\n }\n\n return Object.entries(metadata.collections).map(([collectionSlug, options]) => ({\n collectionPrefix: options === true ? '' : options?.prefix || '',\n collectionSlug,\n useCompositePrefixes: metadata.useCompositePrefixes,\n }))\n })\n}\n"],"names":["vercelBlobStorageMetadata","Symbol","isInternalVercelBlobStorageAdapter","adapter","getCollectionSources","currentAdapter","storageAdapters","currentMetadata","adapters","Set","flatMap","metadata","enabled","storeId","Object","entries","collections","map","collectionSlug","options","collectionPrefix","prefix","useCompositePrefixes"],"mappings":"AAWA,OAAO,MAAMA,4BAA4BC,OAAO,6BAA4B;AAM5E,MAAMC,qCAAqC,CACzCC,UACgDH,6BAA6BG;AAE/E,OAAO,MAAMC,uBAAuB,CAAC,EACnCC,cAAc,EACdC,kBAAkB,EAAE,EAIrB;IACC,MAAMC,kBAAkBF,cAAc,CAACL,0BAA0B;IACjE,MAAMQ,WAAW,IAAIC,IAAI;QAACJ;WAAmBC;KAAgB;IAE7D,OAAO;WAAIE;KAAS,CAACE,OAAO,CAAC,CAACP;QAC5B,IAAI,CAACD,mCAAmCC,UAAU;YAChD,OAAO,EAAE;QACX;QAEA,MAAMQ,WAAWR,OAAO,CAACH,0BAA0B;QACnD,IAAI,CAACW,SAASC,OAAO,IAAID,SAASE,OAAO,KAAKN,gBAAgBM,OAAO,EAAE;YACrE,OAAO,EAAE;QACX;QAEA,OAAOC,OAAOC,OAAO,CAACJ,SAASK,WAAW,EAAEC,GAAG,CAAC,CAAC,CAACC,gBAAgBC,QAAQ,GAAM,CAAA;gBAC9EC,kBAAkBD,YAAY,OAAO,KAAKA,SAASE,UAAU;gBAC7DH;gBACAI,sBAAsBX,SAASW,oBAAoB;YACrD,CAAA;IACF;AACF,EAAC"}
package/dist/getFile.d.ts CHANGED
@@ -1,17 +1,18 @@
1
- import type { CollectionConfig, PayloadRequest } from 'payload';
1
+ import type { CollectionConfig, FileHandlerOperation, PayloadRequest, TypeWithID } from 'payload';
2
2
  interface GetFileArgs {
3
3
  baseUrl: string;
4
4
  cacheControlMaxAge: number;
5
5
  collection: CollectionConfig;
6
6
  collectionPrefix?: string;
7
+ doc?: TypeWithID;
7
8
  filename: string;
8
9
  incomingHeaders?: Headers;
9
- prefixQueryParam?: string;
10
+ operation?: FileHandlerOperation;
10
11
  req: PayloadRequest;
11
12
  token: string;
12
13
  uploadReference?: unknown;
13
14
  useCompositePrefixes?: boolean;
14
15
  }
15
- export declare function getFile({ baseUrl, cacheControlMaxAge, collection, collectionPrefix, filename, incomingHeaders, prefixQueryParam, req, token, uploadReference, useCompositePrefixes, }: GetFileArgs): Promise<Response>;
16
+ export declare function getFile({ baseUrl, cacheControlMaxAge, collection, collectionPrefix, doc, filename, incomingHeaders, operation, req, token, uploadReference, useCompositePrefixes, }: GetFileArgs): Promise<Response>;
16
17
  export {};
17
18
  //# sourceMappingURL=getFile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getFile.d.ts","sourceRoot":"","sources":["../src/getFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAQ/D,UAAU,WAAW;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,kBAAkB,EAAE,MAAM,CAAA;IAC1B,UAAU,EAAE,gBAAgB,CAAA;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,GAAG,EAAE,cAAc,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED,wBAAsB,OAAO,CAAC,EAC5B,OAAO,EACP,kBAAkB,EAClB,UAAU,EACV,gBAAqB,EACrB,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,GAAG,EACH,KAAK,EACL,eAAe,EACf,oBAA4B,GAC7B,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CA8FjC"}
1
+ {"version":3,"file":"getFile.d.ts","sourceRoot":"","sources":["../src/getFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAQjG,UAAU,WAAW;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,kBAAkB,EAAE,MAAM,CAAA;IAC1B,UAAU,EAAE,gBAAgB,CAAA;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,GAAG,CAAC,EAAE,UAAU,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,SAAS,CAAC,EAAE,oBAAoB,CAAA;IAChC,GAAG,EAAE,cAAc,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED,wBAAsB,OAAO,CAAC,EAC5B,OAAO,EACP,kBAAkB,EAClB,UAAU,EACV,gBAAqB,EACrB,GAAG,EACH,QAAQ,EACR,eAAe,EACf,SAAkB,EAClB,GAAG,EACH,KAAK,EACL,eAAe,EACf,oBAA4B,GAC7B,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAsGjC"}
package/dist/getFile.js CHANGED
@@ -1,15 +1,18 @@
1
1
  import { getFilePrefix as getDocPrefix } from '@payloadcms/plugin-cloud-storage/utilities';
2
2
  import { BlobNotFoundError, head } from '@vercel/blob';
3
- import { getRangeRequestInfo } from 'payload/internal';
3
+ import { getRangeRequestInfo, isXmlMimeType, uploadContentSecurityPolicy } from 'payload/internal';
4
4
  import { generateURL } from './generateURL.js';
5
- export async function getFile({ baseUrl, cacheControlMaxAge, collection, collectionPrefix = '', filename, incomingHeaders, prefixQueryParam, req, token, uploadReference, useCompositePrefixes = false }) {
5
+ export async function getFile({ baseUrl, cacheControlMaxAge, collection, collectionPrefix = '', doc, filename, incomingHeaders, operation = 'read', req, token, uploadReference, useCompositePrefixes = false }) {
6
+ const isTransformSource = operation === 'transform';
6
7
  try {
7
8
  const docPrefix = await getDocPrefix({
8
9
  collection,
10
+ collectionPrefix,
11
+ doc,
9
12
  filename,
10
- prefixQueryParam,
11
13
  req,
12
- uploadReference
14
+ uploadReference,
15
+ useCompositePrefixes
13
16
  });
14
17
  const fileUrl = generateURL({
15
18
  baseUrl,
@@ -26,8 +29,7 @@ export async function getFile({ baseUrl, cacheControlMaxAge, collection, collect
26
29
  const uploadedAtString = uploadedAt.toISOString();
27
30
  const fileKeyForETag = fileUrl.replace(`${baseUrl}/`, '');
28
31
  const ETag = `"${fileKeyForETag}-${uploadedAtString}"`;
29
- // Handle range request
30
- const rangeHeader = req.headers.get('range');
32
+ const rangeHeader = isTransformSource ? null : req.headers.get('range');
31
33
  const rangeResult = getRangeRequestInfo({
32
34
  fileSize: size,
33
35
  rangeHeader
@@ -39,7 +41,6 @@ export async function getFile({ baseUrl, cacheControlMaxAge, collection, collect
39
41
  });
40
42
  }
41
43
  let headers = new Headers(incomingHeaders);
42
- // Add range-related headers from the result
43
44
  for (const [key, value] of Object.entries(rangeResult.headers)){
44
45
  headers.append(key, value);
45
46
  }
@@ -47,16 +48,16 @@ export async function getFile({ baseUrl, cacheControlMaxAge, collection, collect
47
48
  headers.append('Content-Disposition', contentDisposition);
48
49
  headers.append('Content-Type', contentType);
49
50
  headers.append('ETag', ETag);
50
- // Add Content-Security-Policy header for SVG files to prevent executable code
51
- if (contentType === 'image/svg+xml') {
52
- headers.append('Content-Security-Policy', "script-src 'none'");
51
+ // Apply a restrictive policy to XML-family responses served through Payload.
52
+ if (isXmlMimeType(contentType)) {
53
+ headers.append('Content-Security-Policy', uploadContentSecurityPolicy);
53
54
  }
54
- if (collection.upload && typeof collection.upload === 'object' && typeof collection.upload.modifyResponseHeaders === 'function') {
55
+ if (!isTransformSource && collection.upload && typeof collection.upload === 'object' && typeof collection.upload.modifyResponseHeaders === 'function') {
55
56
  headers = collection.upload.modifyResponseHeaders({
56
57
  headers
57
58
  }) || headers;
58
59
  }
59
- if (etagFromHeaders && etagFromHeaders === ETag) {
60
+ if (!isTransformSource && etagFromHeaders && etagFromHeaders === ETag) {
60
61
  return new Response(null, {
61
62
  headers,
62
63
  status: 304
@@ -72,6 +73,13 @@ export async function getFile({ baseUrl, cacheControlMaxAge, collection, collect
72
73
  }
73
74
  });
74
75
  if (!response.ok || !response.body) {
76
+ // A transformer needs the real failure status; masking it as 204 is only safe for a plain download.
77
+ if (isTransformSource) {
78
+ return new Response(null, {
79
+ status: response.status,
80
+ statusText: response.statusText
81
+ });
82
+ }
75
83
  return new Response(null, {
76
84
  status: 204,
77
85
  statusText: 'No Content'
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/getFile.ts"],"sourcesContent":["import type { CollectionConfig, PayloadRequest } from 'payload'\n\nimport { getFilePrefix as getDocPrefix } from '@payloadcms/plugin-cloud-storage/utilities'\nimport { BlobNotFoundError, head } from '@vercel/blob'\nimport { getRangeRequestInfo } from 'payload/internal'\n\nimport { generateURL } from './generateURL.js'\n\ninterface GetFileArgs {\n baseUrl: string\n cacheControlMaxAge: number\n collection: CollectionConfig\n collectionPrefix?: string\n filename: string\n incomingHeaders?: Headers\n prefixQueryParam?: string\n req: PayloadRequest\n token: string\n uploadReference?: unknown\n useCompositePrefixes?: boolean\n}\n\nexport async function getFile({\n baseUrl,\n cacheControlMaxAge,\n collection,\n collectionPrefix = '',\n filename,\n incomingHeaders,\n prefixQueryParam,\n req,\n token,\n uploadReference,\n useCompositePrefixes = false,\n}: GetFileArgs): Promise<Response> {\n try {\n const docPrefix = await getDocPrefix({\n collection,\n filename,\n prefixQueryParam,\n req,\n uploadReference,\n })\n\n const fileUrl = generateURL({\n baseUrl,\n collectionPrefix,\n filename,\n prefix: docPrefix,\n useCompositePrefixes,\n })\n const etagFromHeaders = req.headers.get('etag') || req.headers.get('if-none-match')\n const blobMetadata = await head(fileUrl, { token })\n const { contentDisposition, contentType, size, uploadedAt } = blobMetadata\n const uploadedAtString = uploadedAt.toISOString()\n const fileKeyForETag = fileUrl.replace(`${baseUrl}/`, '')\n const ETag = `\"${fileKeyForETag}-${uploadedAtString}\"`\n\n // Handle range request\n const rangeHeader = req.headers.get('range')\n const rangeResult = getRangeRequestInfo({ fileSize: size, rangeHeader })\n\n if (rangeResult.type === 'invalid') {\n return new Response(null, {\n headers: new Headers(rangeResult.headers),\n status: rangeResult.status,\n })\n }\n\n let headers = new Headers(incomingHeaders)\n\n // Add range-related headers from the result\n for (const [key, value] of Object.entries(rangeResult.headers)) {\n headers.append(key, value)\n }\n\n headers.append('Cache-Control', `public, max-age=${cacheControlMaxAge}`)\n headers.append('Content-Disposition', contentDisposition)\n headers.append('Content-Type', contentType)\n headers.append('ETag', ETag)\n\n // Add Content-Security-Policy header for SVG files to prevent executable code\n if (contentType === 'image/svg+xml') {\n headers.append('Content-Security-Policy', \"script-src 'none'\")\n }\n\n if (\n collection.upload &&\n typeof collection.upload === 'object' &&\n typeof collection.upload.modifyResponseHeaders === 'function'\n ) {\n headers = collection.upload.modifyResponseHeaders({ headers }) || headers\n }\n\n if (etagFromHeaders && etagFromHeaders === ETag) {\n return new Response(null, {\n headers,\n status: 304,\n })\n }\n\n const response = await fetch(`${fileUrl}?${uploadedAtString}`, {\n headers: {\n 'Cache-Control': 'no-store, no-cache, must-revalidate',\n Pragma: 'no-cache',\n ...(rangeResult.type === 'partial' && {\n Range: `bytes=${rangeResult.rangeStart}-${rangeResult.rangeEnd}`,\n }),\n },\n })\n\n if (!response.ok || !response.body) {\n return new Response(null, { status: 204, statusText: 'No Content' })\n }\n\n headers.append('Last-Modified', uploadedAtString)\n\n return new Response(response.body, {\n headers,\n status: rangeResult.status,\n })\n } catch (err: unknown) {\n if (err instanceof BlobNotFoundError) {\n return new Response(null, { status: 404, statusText: 'Not Found' })\n }\n req.payload.logger.error({ err, msg: 'Unexpected error in staticHandler' })\n return new Response('Internal Server Error', { status: 500 })\n }\n}\n"],"names":["getFilePrefix","getDocPrefix","BlobNotFoundError","head","getRangeRequestInfo","generateURL","getFile","baseUrl","cacheControlMaxAge","collection","collectionPrefix","filename","incomingHeaders","prefixQueryParam","req","token","uploadReference","useCompositePrefixes","docPrefix","fileUrl","prefix","etagFromHeaders","headers","get","blobMetadata","contentDisposition","contentType","size","uploadedAt","uploadedAtString","toISOString","fileKeyForETag","replace","ETag","rangeHeader","rangeResult","fileSize","type","Response","Headers","status","key","value","Object","entries","append","upload","modifyResponseHeaders","response","fetch","Pragma","Range","rangeStart","rangeEnd","ok","body","statusText","err","payload","logger","error","msg"],"mappings":"AAEA,SAASA,iBAAiBC,YAAY,QAAQ,6CAA4C;AAC1F,SAASC,iBAAiB,EAAEC,IAAI,QAAQ,eA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ACrB,IAAIA,eAAevD,mBAAmB;YACpC,OAAO,IAAIoC,SAAS,MAAM;gBAAEE,QAAQ;gBAAKgB,YAAY;YAAY;QACnE;QACA1C,IAAI4C,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC;YAAEH;YAAKI,KAAK;QAAoC;QACzE,OAAO,IAAIvB,SAAS,yBAAyB;YAAEE,QAAQ;QAAI;IAC7D;AACF"}
1
+ {"version":3,"sources":["../src/getFile.ts"],"sourcesContent":["import type { CollectionConfig, FileHandlerOperation, PayloadRequest, TypeWithID } from 'payload'\n\nimport { getFilePrefix as getDocPrefix } from '@payloadcms/plugin-cloud-storage/utilities'\nimport { BlobNotFoundError, head } from '@vercel/blob'\nimport { getRangeRequestInfo, isXmlMimeType, uploadContentSecurityPolicy } from 'payload/internal'\n\nimport { generateURL } from './generateURL.js'\n\ninterface GetFileArgs {\n baseUrl: string\n cacheControlMaxAge: number\n collection: CollectionConfig\n collectionPrefix?: string\n doc?: TypeWithID\n filename: string\n incomingHeaders?: Headers\n operation?: FileHandlerOperation\n req: PayloadRequest\n token: string\n uploadReference?: unknown\n useCompositePrefixes?: boolean\n}\n\nexport async function getFile({\n baseUrl,\n cacheControlMaxAge,\n collection,\n collectionPrefix = '',\n doc,\n filename,\n incomingHeaders,\n operation = 'read',\n req,\n token,\n uploadReference,\n useCompositePrefixes = false,\n}: GetFileArgs): Promise<Response> {\n const isTransformSource = operation === 'transform'\n\n try {\n const docPrefix = await getDocPrefix({\n collection,\n collectionPrefix,\n doc,\n filename,\n req,\n uploadReference,\n useCompositePrefixes,\n })\n\n const fileUrl = generateURL({\n baseUrl,\n collectionPrefix,\n filename,\n prefix: docPrefix,\n useCompositePrefixes,\n })\n const etagFromHeaders = req.headers.get('etag') || req.headers.get('if-none-match')\n const blobMetadata = await head(fileUrl, { token })\n const { contentDisposition, contentType, size, uploadedAt } = blobMetadata\n const uploadedAtString = uploadedAt.toISOString()\n const fileKeyForETag = fileUrl.replace(`${baseUrl}/`, '')\n const ETag = `\"${fileKeyForETag}-${uploadedAtString}\"`\n\n const rangeHeader = isTransformSource ? null : req.headers.get('range')\n const rangeResult = getRangeRequestInfo({ fileSize: size, rangeHeader })\n\n if (rangeResult.type === 'invalid') {\n return new Response(null, {\n headers: new Headers(rangeResult.headers),\n status: rangeResult.status,\n })\n }\n\n let headers = new Headers(incomingHeaders)\n\n for (const [key, value] of Object.entries(rangeResult.headers)) {\n headers.append(key, value)\n }\n\n headers.append('Cache-Control', `public, max-age=${cacheControlMaxAge}`)\n headers.append('Content-Disposition', contentDisposition)\n headers.append('Content-Type', contentType)\n headers.append('ETag', ETag)\n\n // Apply a restrictive policy to XML-family responses served through Payload.\n if (isXmlMimeType(contentType)) {\n headers.append('Content-Security-Policy', uploadContentSecurityPolicy)\n }\n\n if (\n !isTransformSource &&\n collection.upload &&\n typeof collection.upload === 'object' &&\n typeof collection.upload.modifyResponseHeaders === 'function'\n ) {\n headers = collection.upload.modifyResponseHeaders({ headers }) || headers\n }\n\n if (!isTransformSource && etagFromHeaders && etagFromHeaders === ETag) {\n return new Response(null, {\n headers,\n status: 304,\n })\n }\n\n const response = await fetch(`${fileUrl}?${uploadedAtString}`, {\n headers: {\n 'Cache-Control': 'no-store, no-cache, must-revalidate',\n Pragma: 'no-cache',\n ...(rangeResult.type === 'partial' && {\n Range: `bytes=${rangeResult.rangeStart}-${rangeResult.rangeEnd}`,\n }),\n },\n })\n\n if (!response.ok || !response.body) {\n // A transformer needs the real failure status; masking it as 204 is only safe for a plain download.\n if (isTransformSource) {\n return new Response(null, { status: response.status, statusText: response.statusText })\n }\n\n return new Response(null, { status: 204, statusText: 'No Content' })\n }\n\n headers.append('Last-Modified', uploadedAtString)\n\n return new Response(response.body, {\n headers,\n status: rangeResult.status,\n })\n } catch (err: unknown) {\n if (err instanceof BlobNotFoundError) {\n return new Response(null, { status: 404, statusText: 'Not Found' })\n }\n req.payload.logger.error({ err, msg: 'Unexpected error in staticHandler' })\n return new Response('Internal Server Error', { status: 500 })\n }\n}\n"],"names":["getFilePrefix","getDocPrefix","BlobNotFoundError","head","getRangeRequestInfo","isXmlMimeType","uploadContentSecurityPolicy","generateURL","getFile","baseUrl","cacheControlMaxAge","collection","collectionPrefix","doc","filename","incomingHeaders","operation","req","token","uploadReference","useCompositePrefixes","isTransformSource","docPrefix","fileUrl","prefix","etagFromHeaders","headers","get","blobMetadata","contentDisposition","contentType","size","uploadedAt","uploadedAtString","toISOString","fileKeyForETag","replace","ETag","rangeHeader","rangeResult","fileSize","type","Response","Headers","status","key","value","Object","entries","append","upload","modifyResponseHeaders","response","fetch","Pragma","Range","rangeStart","rangeEnd","ok","body","statusText","err","payload","logger","error","msg"],"mappings":"AAEA,SAASA,iBAAiBC,YAAY,QAAQ,6CAA4C;AAC1F,SAASC,iBAAiB,EAAEC,IAAI,QAAQ,eAAc;AACtD,SAASC,mBAAmB,EAAEC,aAAa,EAAEC,2BAA2B,QAAQ,mBAAkB;AAElG,SAASC,WAAW,QAAQ,mBAAkB;AAiB9C,OAAO,eAAeC,QAAQ,EAC5BC,OAAO,EACPC,kBAAkB,EAClBC,UAAU,EACVC,mBAAmB,EAAE,EACrBC,GAAG,EACHC,QAAQ,EACRC,eAAe,EACfC,YAAY,MAAM,EAClBC,GAAG,EACHC,KAAK,EACLC,eAAe,EACfC,uBAAuB,KAAK,EAChB;IACZ,MAAMC,oBAAoBL,cAAc;IAExC,IAAI;QACF,MAAMM,YAAY,MAAMrB,aAAa;YACnCU;YACAC;YACAC;YACAC;YACAG;YACAE;YACAC;QACF;QAEA,MAAMG,UAAUhB,YAAY;YAC1BE;YACAG;YACAE;YACAU,QAAQF;YACRF;QACF;QACA,MAAMK,kBAAkBR,IAAIS,OAAO,CAACC,GAAG,CAAC,WAAWV,IAAIS,OAAO,CAACC,GAAG,CAAC;QACnE,MAAMC,eAAe,MAAMzB,KAAKoB,SAAS;YAAEL;QAAM;QACjD,MAAM,EAAEW,kBAAkB,EAAEC,WAAW,EAAEC,IAAI,EAAEC,UA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AAS,MAAM;gBACxBhB;gBACAkB,QAAQ;YACV;QACF;QAEA,MAAMQ,WAAW,MAAMC,MAAM,GAAG9B,QAAQ,CAAC,EAAEU,kBAAkB,EAAE;YAC7DP,SAAS;gBACP,iBAAiB;gBACjB4B,QAAQ;gBACR,GAAIf,YAAYE,IAAI,KAAK,aAAa;oBACpCc,OAAO,CAAC,MAAM,EAAEhB,YAAYiB,UAAU,CAAC,CAAC,EAAEjB,YAAYkB,QAAQ,EAAE;gBAClE,CAAC;YACH;QACF;QAEA,IAAI,CAACL,SAASM,EAAE,IAAI,CAACN,SAASO,IAAI,EAAE;YAClC,oGAAoG;YACpG,IAAItC,mBAAmB;gBACrB,OAAO,IAAIqB,SAAS,MAAM;oBAAEE,QAAQQ,SAASR,MAAM;oBAAEgB,YAAYR,SAASQ,UAAU;gBAAC;YACvF;YAEA,OAAO,IAAIlB,SAAS,MAAM;gBAAEE,QAAQ;gBAAKgB,YAAY;YAAa;QACpE;QAEAlC,QAAQuB,MAAM,CAAC,iBAAiBhB;QAEhC,OAAO,IAAIS,SAASU,SAASO,IAAI,EAAE;YACjCjC;YACAkB,QAAQL,YAAYK,MAAM;QAC5B;IACF,EAAE,OAAOiB,KAAc;QACrB,IAAIA,eAAe3D,mBAAmB;YACpC,OAAO,IAAIwC,SAAS,MAAM;gBAAEE,QAAQ;gBAAKgB,YAAY;YAAY;QACnE;QACA3C,IAAI6C,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC;YAAEH;YAAKI,KAAK;QAAoC;QACzE,OAAO,IAAIvB,SAAS,yBAAyB;YAAEE,QAAQ;QAAI;IAC7D;AACF"}
package/dist/index.d.ts CHANGED
@@ -9,21 +9,12 @@ export type VercelBlobStorageOptions = {
9
9
  */
10
10
  access?: 'public';
11
11
  /**
12
- * Add a random suffix to the uploaded file name in Vercel Blob storage
12
+ * Must be false or omitted for enabled adapters with configured collections.
13
+ * Payload requires exact storage paths and allocates unique object folders.
13
14
  *
14
15
  * @default false
15
16
  */
16
17
  addRandomSuffix?: boolean;
17
- /**
18
- * When enabled, fields (like the prefix field) will always be inserted into
19
- * the collection schema regardless of whether the plugin is enabled. This
20
- * ensures a consistent schema across all environments.
21
- *
22
- * This will be enabled by default in Payload v4.
23
- *
24
- * @default false
25
- */
26
- alwaysInsertFields?: boolean;
27
18
  /**
28
19
  * Cache-Control max-age in seconds
29
20
  *
@@ -54,14 +45,15 @@ export type VercelBlobStorageOptions = {
54
45
  token: string | undefined;
55
46
  /**
56
47
  * When true, the collection-level prefix and document-level prefix are combined
57
- * (compositional). When false (default), document prefix overrides collection
58
- * prefix entirely.
48
+ * (compositional). When false (default), a document prefix already within the
49
+ * collection prefix is used as-is for new uploads; otherwise it is nested beneath it.
50
+ * Existing files retain their stored prefixes for reads, URLs, and cleanup.
59
51
  *
60
- * Example:
61
- * - collection prefix: `collection-prefix/`
62
- * - document prefix: `document-prefix/`
63
- * - resulting prefix with useCompositePrefixes=true: `collection-prefix/document-prefix/`
64
- * - resulting prefix with useCompositePrefixes=false: `document-prefix/`
52
+ * Example with a document prefix already contained by the collection prefix:
53
+ * - collection prefix: `uploads/`
54
+ * - document prefix: `uploads/documents/`
55
+ * - resulting prefix with useCompositePrefixes=true: `uploads/uploads/documents/`
56
+ * - resulting prefix with useCompositePrefixes=false: `uploads/documents/`
65
57
  *
66
58
  * @default false
67
59
  */
@@ -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,cAAc,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAM3E,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAA;IAEjB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IAEzB;;;;;;;;OAQG;IACH,kBAAkB,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;;;OAMG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IAEzB;;;;;;;;;;;;;OAaG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B,CAAA;AASD,KAAK,wBAAwB,GAAG,CAAC,qBAAqB,EAAE,wBAAwB,KAAK,cAAc,CAAA;AAEnG,eAAO,MAAM,iBAAiB,EAAE,wBA8G/B,CAAA"}
package/dist/index.js CHANGED
@@ -1,18 +1,19 @@
1
1
  import { cloudStoragePlugin } from '@payloadcms/plugin-cloud-storage';
2
2
  import { createVercelBlobAdapter } from './adapter.js';
3
+ import { getCollectionSources, vercelBlobStorageMetadata } from './getCollectionSources.js';
3
4
  const defaultUploadOptions = {
4
5
  access: 'public',
5
6
  addRandomSuffix: false,
6
7
  cacheControlMaxAge: 60 * 60 * 24 * 365,
7
8
  enabled: true
8
9
  };
9
- export const vercelBlobStorage = (options)=>({
10
+ export const vercelBlobStorage = (options)=>{
11
+ const storeId = options.token?.match(/^vercel_blob_rw_([a-z\d]+)_[a-z\d]+$/i)?.[1]?.toLowerCase();
12
+ const isPluginDisabled = options.enabled === false || !options.token;
13
+ const storageAdapter = {
10
14
  name: 'vercel-blob',
11
15
  collections: Object.keys(options.collections),
12
16
  init: (incomingConfig)=>{
13
- // Parse storeId from token
14
- const storeId = options.token?.match(/^vercel_blob_rw_([a-z\d]+)_[a-z\d]+$/i)?.[1]?.toLowerCase();
15
- const isPluginDisabled = options.enabled === false || !options.token;
16
17
  // Don't throw if the plugin is disabled
17
18
  if (!storeId && !isPluginDisabled) {
18
19
  throw new Error('Invalid token format for Vercel Blob adapter. Should be vercel_blob_rw_<store_id>_<random_string>.');
@@ -25,22 +26,21 @@ export const vercelBlobStorage = (options)=>({
25
26
  const baseUrl = process.env.STORAGE_VERCEL_BLOB_BASE_URL || `https://${storeId}.${optionsWithDefaults.access}.blob.vercel-storage.com`;
26
27
  // If the plugin is disabled or no token is provided, do not enable the plugin
27
28
  if (isPluginDisabled) {
28
- if (options.alwaysInsertFields) {
29
- const collectionsWithoutAdapter = Object.entries(options.collections).reduce((acc, [slug, collOptions])=>({
30
- ...acc,
31
- [slug]: {
32
- ...collOptions === true ? {} : collOptions,
33
- adapter: null
34
- }
35
- }), {});
36
- return cloudStoragePlugin({
37
- alwaysInsertFields: true,
38
- collections: collectionsWithoutAdapter,
39
- enabled: false,
40
- useCompositePrefixes: options.useCompositePrefixes
41
- })(incomingConfig);
42
- }
43
- return incomingConfig;
29
+ const collectionsWithoutAdapter = Object.entries(options.collections).reduce((acc, [slug, collOptions])=>({
30
+ ...acc,
31
+ [slug]: {
32
+ ...collOptions === true ? {} : collOptions,
33
+ adapter: null
34
+ }
35
+ }), {});
36
+ return cloudStoragePlugin({
37
+ collections: collectionsWithoutAdapter,
38
+ enabled: false,
39
+ useCompositePrefixes: options.useCompositePrefixes
40
+ })(incomingConfig);
41
+ }
42
+ if (options.addRandomSuffix && storageAdapter.collections.length > 0) {
43
+ throw new Error('Vercel Blob addRandomSuffix must be false. Payload requires exact storage paths and already allocates unique object folders.');
44
44
  }
45
45
  const adapter = createVercelBlobAdapter({
46
46
  access: optionsWithDefaults.access ?? 'public',
@@ -48,6 +48,10 @@ export const vercelBlobStorage = (options)=>({
48
48
  baseUrl,
49
49
  cacheControlMaxAge: optionsWithDefaults.cacheControlMaxAge ?? 60 * 60 * 24 * 365,
50
50
  clientUploads: optionsWithDefaults.clientUploads,
51
+ collectionSources: getCollectionSources({
52
+ currentAdapter: storageAdapter,
53
+ storageAdapters: incomingConfig.storage
54
+ }),
51
55
  token: options.token,
52
56
  useCompositePrefixes: options.useCompositePrefixes
53
57
  });
@@ -76,11 +80,18 @@ export const vercelBlobStorage = (options)=>({
76
80
  })
77
81
  };
78
82
  return cloudStoragePlugin({
79
- alwaysInsertFields: options.alwaysInsertFields,
80
83
  collections: collectionsWithAdapter,
81
84
  useCompositePrefixes: options.useCompositePrefixes
82
85
  })(config);
86
+ },
87
+ [vercelBlobStorageMetadata]: {
88
+ collections: options.collections,
89
+ enabled: !isPluginDisabled,
90
+ storeId,
91
+ useCompositePrefixes: Boolean(options.useCompositePrefixes)
83
92
  }
84
- });
93
+ };
94
+ return storageAdapter;
95
+ };
85
96
 
86
97
  //# 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, StorageAdapter, UploadCollectionSlug } from 'payload'\n\nimport { cloudStoragePlugin } from '@payloadcms/plugin-cloud-storage'\n\nimport { createVercelBlobAdapter } from './adapter.js'\n\nexport type VercelBlobStorageOptions = {\n /**\n * Access control level. Currently, only 'public' is supported.\n * Vercel plans on adding support for private blobs in the future.\n *\n * @default 'public'\n */\n access?: 'public'\n\n /**\n * Add a random suffix to the uploaded file name in Vercel Blob storage\n *\n * @default false\n */\n addRandomSuffix?: boolean\n\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 /**\n * Cache-Control max-age in seconds\n *\n * @default 365 * 24 * 60 * 60 // (1 Year)\n */\n cacheControlMaxAge?: number\n\n /**\n * Upload directly to Vercel Blob instead of through Payload.\n */\n clientUploads?: ClientUploadsConfig\n\n /**\n * Collections to apply the Vercel Blob adapter to\n */\n collections: Partial<Record<UploadCollectionSlug, Omit<CollectionOptions, 'adapter'> | true>>\n\n /**\n * Whether or not to enable the plugin\n *\n * Default: true\n */\n enabled?: boolean\n /**\n * Vercel Blob storage read/write token\n *\n * Usually process.env.BLOB_READ_WRITE_TOKEN set by Vercel\n *\n * If unset, the plugin will be disabled and will fallback to local storage\n */\n token: string | undefined\n\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\nconst defaultUploadOptions: Partial<VercelBlobStorageOptions> = {\n access: 'public',\n addRandomSuffix: false,\n cacheControlMaxAge: 60 * 60 * 24 * 365, // 1 year\n enabled: true,\n}\n\ntype VercelBlobStorageFactory = (vercelBlobStorageOpts: VercelBlobStorageOptions) => StorageAdapter\n\nexport const vercelBlobStorage: VercelBlobStorageFactory = (\n options: VercelBlobStorageOptions,\n): StorageAdapter => ({\n name: 'vercel-blob',\n collections: Object.keys(options.collections),\n init: (incomingConfig: Config): Config => {\n // Parse storeId from token\n const storeId = options.token\n ?.match(/^vercel_blob_rw_([a-z\\d]+)_[a-z\\d]+$/i)?.[1]\n ?.toLowerCase()\n\n const isPluginDisabled = options.enabled === false || !options.token\n\n // Don't throw if the plugin is disabled\n if (!storeId && !isPluginDisabled) {\n throw new Error(\n 'Invalid token format for Vercel Blob adapter. Should be vercel_blob_rw_<store_id>_<random_string>.',\n )\n }\n\n const optionsWithDefaults = {\n ...defaultUploadOptions,\n ...options,\n }\n\n // support overriding the base URL for emulator https://github.com/payloadcms/vercel-blob-emulator\n const baseUrl =\n process.env.STORAGE_VERCEL_BLOB_BASE_URL ||\n `https://${storeId}.${optionsWithDefaults.access}.blob.vercel-storage.com`\n\n // If the plugin is disabled or no token is provided, do not enable the plugin\n if (isPluginDisabled) {\n if (options.alwaysInsertFields) {\n const collectionsWithoutAdapter: CloudStoragePluginOptions['collections'] = Object.entries(\n options.collections,\n ).reduce(\n (acc, [slug, collOptions]) => ({\n ...acc,\n [slug]: { ...(collOptions === true ? {} : collOptions), adapter: null },\n }),\n {} as Record<string, CollectionOptions>,\n )\n return cloudStoragePlugin({\n alwaysInsertFields: true,\n collections: collectionsWithoutAdapter,\n enabled: false,\n useCompositePrefixes: options.useCompositePrefixes,\n })(incomingConfig)\n }\n return incomingConfig\n }\n\n const adapter = createVercelBlobAdapter({\n access: optionsWithDefaults.access ?? 'public',\n addRandomSuffix: optionsWithDefaults.addRandomSuffix,\n baseUrl,\n cacheControlMaxAge: optionsWithDefaults.cacheControlMaxAge ?? 60 * 60 * 24 * 365,\n clientUploads: optionsWithDefaults.clientUploads,\n token: options.token!,\n useCompositePrefixes: options.useCompositePrefixes,\n })\n\n // Add adapter to each collection option object\n const collectionsWithAdapter: CloudStoragePluginOptions['collections'] = Object.entries(\n options.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: options.alwaysInsertFields,\n collections: collectionsWithAdapter,\n useCompositePrefixes: options.useCompositePrefixes,\n })(config)\n },\n})\n"],"names":["cloudStoragePlugin","createVercelBlobAdapter","defaultUploadOptions","access","addRandomSuffix","cacheControlMaxAge","enabled","vercelBlobStorage","options","name","collections","Object","keys","init","incomingConfig","storeId","token","match","toLowerCase","isPluginDisabled","Error","optionsWithDefaults","baseUrl","process","env","STORAGE_VERCEL_BLOB_BASE_URL","alwaysInsertFields","collectionsWithoutAdapter","entries","reduce","acc","slug","collOptions","adapter","useCompositePrefixes","clientUploads","collectionsWithAdapter","config","map","collection","upload","disableLocalStorage"],"mappings":"AAOA,SAASA,kBAAkB,QAAQ,mCAAkC;AAErE,SAASC,uBAAuB,QAAQ,eAAc;AA6EtD,MAAMC,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lB,MAAM,IAAI;gBACtCC,iBAAiBiB,oBAAoBjB,eAAe;gBACpDkB;gBACAjB,oBAAoBgB,oBAAoBhB,kBAAkB,IAAI,KAAK,KAAK,KAAK;gBAC7E8B,eAAed,oBAAoBc,aAAa;gBAChDnB,OAAOR,QAAQQ,KAAK;gBACpBkB,sBAAsB1B,QAAQ0B,oBAAoB;YACpD;YAEA,+CAA+C;YAC/C,MAAME,yBAAmEzB,OAAOiB,OAAO,CACrFpB,QAAQE,WAAW,EACnBmB,MAAM,CACN,CAACC,KAAK,CAACC,MAAMC,YAAY,GAAM,CAAA;oBAC7B,GAAGF,GAAG;oBACN,CAACC,KAAK,EAAE;wBACN,GAAIC,gBAAgB,OAAO,CAAC,IAAIA,WAAW;wBAC3CC;oBACF;gBACF,CAAA,GACA,CAAC;YAGH,gFAAgF;YAChF,MAAMI,SAAS;gBACb,GAAGvB,cAAc;gBACjBJ,aAAa,AAACI,CAAAA,eAAeJ,WAAW,IAAI,EAAE,AAAD,EAAG4B,GAAG,CAAC,CAACC;oBACnD,IAAI,CAACH,sBAAsB,CAACG,WAAWR,IAAI,CAAC,EAAE;wBAC5C,OAAOQ;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,OAAOzC,mBAAmB;gBACxB0B,oBAAoBlB,QAAQkB,kBAAkB;gBAC9ChB,aAAa0B;gBACbF,sBAAsB1B,QAAQ0B,oBAAoB;YACpD,GAAGG;QACL;IACF,CAAA,EAAE"}
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'\n\nimport { createVercelBlobAdapter } from './adapter.js'\nimport {\n getCollectionSources,\n type InternalVercelBlobStorageAdapter,\n vercelBlobStorageMetadata,\n} from './getCollectionSources.js'\n\nexport type VercelBlobStorageOptions = {\n /**\n * Access control level. Currently, only 'public' is supported.\n * Vercel plans on adding support for private blobs in the future.\n *\n * @default 'public'\n */\n access?: 'public'\n\n /**\n * Must be false or omitted for enabled adapters with configured collections.\n * Payload requires exact storage paths and allocates unique object folders.\n *\n * @default false\n */\n addRandomSuffix?: boolean\n\n /**\n * Cache-Control max-age in seconds\n *\n * @default 365 * 24 * 60 * 60 // (1 Year)\n */\n cacheControlMaxAge?: number\n\n /**\n * Upload directly to Vercel Blob instead of through Payload.\n */\n clientUploads?: ClientUploadsConfig\n\n /**\n * Collections to apply the Vercel Blob adapter to\n */\n collections: Partial<Record<UploadCollectionSlug, Omit<CollectionOptions, 'adapter'> | true>>\n\n /**\n * Whether or not to enable the plugin\n *\n * Default: true\n */\n enabled?: boolean\n /**\n * Vercel Blob storage read/write token\n *\n * Usually process.env.BLOB_READ_WRITE_TOKEN set by Vercel\n *\n * If unset, the plugin will be disabled and will fallback to local storage\n */\n token: string | undefined\n\n /**\n * When true, the collection-level prefix and document-level prefix are combined\n * (compositional). When false (default), a document prefix already within the\n * collection prefix is used as-is for new uploads; otherwise it is nested beneath it.\n * Existing files retain their stored prefixes for reads, URLs, and cleanup.\n *\n * Example with a document prefix already contained by the collection prefix:\n * - collection prefix: `uploads/`\n * - document prefix: `uploads/documents/`\n * - resulting prefix with useCompositePrefixes=true: `uploads/uploads/documents/`\n * - resulting prefix with useCompositePrefixes=false: `uploads/documents/`\n *\n * @default false\n */\n useCompositePrefixes?: boolean\n}\n\nconst defaultUploadOptions: Partial<VercelBlobStorageOptions> = {\n access: 'public',\n addRandomSuffix: false,\n cacheControlMaxAge: 60 * 60 * 24 * 365, // 1 year\n enabled: true,\n}\n\ntype VercelBlobStorageFactory = (vercelBlobStorageOpts: VercelBlobStorageOptions) => StorageAdapter\n\nexport const vercelBlobStorage: VercelBlobStorageFactory = (\n options: VercelBlobStorageOptions,\n): StorageAdapter => {\n const storeId = options.token?.match(/^vercel_blob_rw_([a-z\\d]+)_[a-z\\d]+$/i)?.[1]?.toLowerCase()\n const isPluginDisabled = options.enabled === false || !options.token\n const storageAdapter: InternalVercelBlobStorageAdapter = {\n name: 'vercel-blob',\n collections: Object.keys(options.collections),\n init: (incomingConfig: Config): Config => {\n // Don't throw if the plugin is disabled\n if (!storeId && !isPluginDisabled) {\n throw new Error(\n 'Invalid token format for Vercel Blob adapter. Should be vercel_blob_rw_<store_id>_<random_string>.',\n )\n }\n\n const optionsWithDefaults = {\n ...defaultUploadOptions,\n ...options,\n }\n\n // support overriding the base URL for emulator https://github.com/payloadcms/vercel-blob-emulator\n const baseUrl =\n process.env.STORAGE_VERCEL_BLOB_BASE_URL ||\n `https://${storeId}.${optionsWithDefaults.access}.blob.vercel-storage.com`\n\n // If the plugin is disabled or no token is provided, do not enable the plugin\n if (isPluginDisabled) {\n const collectionsWithoutAdapter: CloudStoragePluginOptions['collections'] = Object.entries(\n options.collections,\n ).reduce(\n (acc, [slug, collOptions]) => ({\n ...acc,\n [slug]: { ...(collOptions === true ? {} : collOptions), adapter: null },\n }),\n {} as Record<string, CollectionOptions>,\n )\n return cloudStoragePlugin({\n collections: collectionsWithoutAdapter,\n enabled: false,\n useCompositePrefixes: options.useCompositePrefixes,\n })(incomingConfig)\n }\n\n if (options.addRandomSuffix && storageAdapter.collections.length > 0) {\n throw new Error(\n 'Vercel Blob addRandomSuffix must be false. Payload requires exact storage paths and already allocates unique object folders.',\n )\n }\n\n const adapter = createVercelBlobAdapter({\n access: optionsWithDefaults.access ?? 'public',\n addRandomSuffix: optionsWithDefaults.addRandomSuffix,\n baseUrl,\n cacheControlMaxAge: optionsWithDefaults.cacheControlMaxAge ?? 60 * 60 * 24 * 365,\n clientUploads: optionsWithDefaults.clientUploads,\n collectionSources: getCollectionSources({\n currentAdapter: storageAdapter,\n storageAdapters: incomingConfig.storage,\n }),\n token: options.token!,\n useCompositePrefixes: options.useCompositePrefixes,\n })\n\n // Add adapter to each collection option object\n const collectionsWithAdapter: CloudStoragePluginOptions['collections'] = Object.entries(\n options.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 collections: collectionsWithAdapter,\n useCompositePrefixes: options.useCompositePrefixes,\n })(config)\n },\n [vercelBlobStorageMetadata]: {\n collections: options.collections,\n enabled: !isPluginDisabled,\n storeId,\n useCompositePrefixes: Boolean(options.useCompositePrefixes),\n },\n }\n\n return storageAdapter\n}\n"],"names":["cloudStoragePlugin","createVercelBlobAdapter","getCollectionSources","vercelBlobStorageMetadata","defaultUploadOptions","access","addRandomSuffix","cacheControlMaxAge","enabled","vercelBlobStorage","options","storeId","token","match","toLowerCase","isPluginDisabled","storageAdapter","name","collections","Object","keys","init","incomingConfig","Error","optionsWithDefaults","baseUrl","process","env","STORAGE_VERCEL_BLOB_BASE_URL","collectionsWithoutAdapter","entries","reduce","acc","slug","collOptions","adapter","useCompositePrefixes","length","clientUploads","collectionSources","currentAdapter","storageAdapters","storage","collectionsWithAdapter","config","map","collection","upload","disableLocalStorage","Boolean"],"mappings":"AAOA,SAASA,kBAAkB,QAAQ,mCAAkC;AAErE,SAASC,uBAAuB,QAAQ,eAAc;AACtD,SACEC,oBAAoB,EAEpBC,yBAAyB,QACpB,4BAA2B;AAoElC,MAAMC,uBAA0D;IAC9DC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
@@ -3,16 +3,13 @@ interface UploadFileArgs {
3
3
  addRandomSuffix?: boolean;
4
4
  buffer: Buffer;
5
5
  cacheControlMaxAge?: number;
6
- collectionPrefix?: string;
7
- docPrefix?: string;
8
- filename: string;
9
6
  mimeType: string;
7
+ storageFilePath: string;
10
8
  token: string;
11
- useCompositePrefixes?: boolean;
12
9
  }
13
10
  interface UploadFileResult {
14
11
  filename?: string;
15
12
  }
16
- export declare function uploadFile({ access, addRandomSuffix, buffer, cacheControlMaxAge, collectionPrefix, docPrefix, filename, mimeType, token, useCompositePrefixes, }: UploadFileArgs): Promise<UploadFileResult>;
13
+ export declare function uploadFile({ access, addRandomSuffix, buffer, cacheControlMaxAge, mimeType, storageFilePath, token, }: UploadFileArgs): Promise<UploadFileResult>;
17
14
  export {};
18
15
  //# sourceMappingURL=uploadFile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uploadFile.d.ts","sourceRoot":"","sources":["../src/uploadFile.ts"],"names":[],"mappings":"AAIA,UAAU,cAAc;IACtB,MAAM,EAAE,QAAQ,CAAA;IAChB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED,UAAU,gBAAgB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,wBAAsB,UAAU,CAAC,EAC/B,MAAM,EACN,eAAe,EACf,MAAM,EACN,kBAAkB,EAClB,gBAAqB,EACrB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,oBAA4B,GAC7B,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAwB5C"}
1
+ {"version":3,"file":"uploadFile.d.ts","sourceRoot":"","sources":["../src/uploadFile.ts"],"names":[],"mappings":"AAGA,UAAU,cAAc;IACtB,MAAM,EAAE,QAAQ,CAAA;IAChB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,EAAE,MAAM,CAAA;IACvB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,UAAU,gBAAgB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,wBAAsB,UAAU,CAAC,EAC/B,MAAM,EACN,eAAe,EACf,MAAM,EACN,kBAAkB,EAClB,QAAQ,EACR,eAAe,EACf,KAAK,GACN,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAiB5C"}
@@ -1,14 +1,7 @@
1
- import { getFileKey } from '@payloadcms/plugin-cloud-storage/utilities';
2
1
  import { put } from '@vercel/blob';
3
2
  import path from 'path';
4
- export async function uploadFile({ access, addRandomSuffix, buffer, cacheControlMaxAge, collectionPrefix = '', docPrefix, filename, mimeType, token, useCompositePrefixes = false }) {
5
- const { fileKey } = getFileKey({
6
- collectionPrefix,
7
- docPrefix,
8
- filename,
9
- useCompositePrefixes
10
- });
11
- const result = await put(fileKey, buffer, {
3
+ export async function uploadFile({ access, addRandomSuffix, buffer, cacheControlMaxAge, mimeType, storageFilePath, token }) {
4
+ const result = await put(storageFilePath, buffer, {
12
5
  access,
13
6
  addRandomSuffix,
14
7
  allowOverwrite: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/uploadFile.ts"],"sourcesContent":["import { getFileKey } from '@payloadcms/plugin-cloud-storage/utilities'\nimport { put } from '@vercel/blob'\nimport path from 'path'\n\ninterface UploadFileArgs {\n access: 'public'\n addRandomSuffix?: boolean\n buffer: Buffer\n cacheControlMaxAge?: number\n collectionPrefix?: string\n docPrefix?: string\n filename: string\n mimeType: string\n token: string\n useCompositePrefixes?: boolean\n}\n\ninterface UploadFileResult {\n filename?: string\n}\n\nexport async function uploadFile({\n access,\n addRandomSuffix,\n buffer,\n cacheControlMaxAge,\n collectionPrefix = '',\n docPrefix,\n filename,\n mimeType,\n token,\n useCompositePrefixes = false,\n}: UploadFileArgs): Promise<UploadFileResult> {\n const { fileKey } = getFileKey({\n collectionPrefix,\n docPrefix,\n filename,\n useCompositePrefixes,\n })\n\n const result = await put(fileKey, buffer, {\n access,\n addRandomSuffix,\n allowOverwrite: true,\n cacheControlMaxAge,\n contentType: mimeType,\n token,\n })\n\n if (addRandomSuffix) {\n const pathname = result.pathname.replace(/^\\/+/, '')\n const basename = path.posix.basename(pathname)\n return { filename: decodeURIComponent(basename) }\n }\n\n return {}\n}\n"],"names":["getFileKey","put","path","uploadFile","access","addRandomSuffix","buffer","cacheControlMaxAge","collectionPrefix","docPrefix","filename","mimeType","token","useCompositePrefixes","fileKey","result","allowOverwrite","contentType","pathname","replace","basename","posix","decodeURIComponent"],"mappings":"AAAA,SAASA,UAAU,QAAQ,6CAA4C;AACvE,SAASC,GAAG,QAAQ,eAAc;AAClC,OAAOC,UAAU,OAAM;AAmBvB,OAAO,eAAeC,WAAW,EAC/BC,MAAM,EACNC,eAAe,EACfC,MAAM,EACNC,kBAAkB,EAClBC,mBAAmB,EAAE,EACrBC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,KAAK,EACLC,uBAAuB,KAAK,EACb;IACf,MAAM,EAAEC,OAAO,EAAE,GAAGd,WAAW;QAC7BQ;QACAC;QACAC;QACAG;IACF;IAEA,MAAME,SAAS,MAAMd,IAAIa,SAASR,QAAQ;QACxCF;QACAC;QACAW,gBAAgB;QAChBT;QACAU,aAAaN;QACbC;IACF;IAEA,IAAIP,iBAAiB;QACnB,MAAMa,WAAWH,OAAOG,QAAQ,CAACC,OAAO,CAAC,QAAQ;QACjD,MAAMC,WAAWlB,KAAKmB,KAAK,CAACD,QAAQ,CAACF;QACrC,OAAO;YAAER,UAAUY,mBAAmBF;QAAU;IAClD;IAEA,OAAO,CAAC;AACV"}
1
+ {"version":3,"sources":["../src/uploadFile.ts"],"sourcesContent":["import { put } from '@vercel/blob'\nimport path from 'path'\n\ninterface UploadFileArgs {\n access: 'public'\n addRandomSuffix?: boolean\n buffer: Buffer\n cacheControlMaxAge?: number\n mimeType: string\n storageFilePath: string\n token: string\n}\n\ninterface UploadFileResult {\n filename?: string\n}\n\nexport async function uploadFile({\n access,\n addRandomSuffix,\n buffer,\n cacheControlMaxAge,\n mimeType,\n storageFilePath,\n token,\n}: UploadFileArgs): Promise<UploadFileResult> {\n const result = await put(storageFilePath, buffer, {\n access,\n addRandomSuffix,\n allowOverwrite: true,\n cacheControlMaxAge,\n contentType: mimeType,\n token,\n })\n\n if (addRandomSuffix) {\n const pathname = result.pathname.replace(/^\\/+/, '')\n const basename = path.posix.basename(pathname)\n return { filename: decodeURIComponent(basename) }\n }\n\n return {}\n}\n"],"names":["put","path","uploadFile","access","addRandomSuffix","buffer","cacheControlMaxAge","mimeType","storageFilePath","token","result","allowOverwrite","contentType","pathname","replace","basename","posix","filename","decodeURIComponent"],"mappings":"AAAA,SAASA,GAAG,QAAQ,eAAc;AAClC,OAAOC,UAAU,OAAM;AAgBvB,OAAO,eAAeC,WAAW,EAC/BC,MAAM,EACNC,eAAe,EACfC,MAAM,EACNC,kBAAkB,EAClBC,QAAQ,EACRC,eAAe,EACfC,KAAK,EACU;IACf,MAAMC,SAAS,MAAMV,IAAIQ,iBAAiBH,QAAQ;QAChDF;QACAC;QACAO,gBAAgB;QAChBL;QACAM,aAAaL;QACbE;IACF;IAEA,IAAIL,iBAAiB;QACnB,MAAMS,WAAWH,OAAOG,QAAQ,CAACC,OAAO,CAAC,QAAQ;QACjD,MAAMC,WAAWd,KAAKe,KAAK,CAACD,QAAQ,CAACF;QACrC,OAAO;YAAEI,UAAUC,mBAAmBH;QAAU;IAClD;IAEA,OAAO,CAAC;AACV"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/storage-vercel-blob",
3
- "version": "4.0.0-internal.b8e7c89",
3
+ "version": "4.0.0-internal.bf4bcce",
4
4
  "description": "Payload storage adapter for Vercel Blob Storage",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -38,13 +38,13 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@vercel/blob": "2.3.1",
41
- "@payloadcms/plugin-cloud-storage": "4.0.0-internal.b8e7c89"
41
+ "@payloadcms/plugin-cloud-storage": "4.0.0-internal.bf4bcce"
42
42
  },
43
43
  "devDependencies": {
44
- "payload": "4.0.0-internal.b8e7c89"
44
+ "payload": "4.0.0-internal.bf4bcce"
45
45
  },
46
46
  "peerDependencies": {
47
- "payload": "4.0.0-internal.b8e7c89"
47
+ "payload": "4.0.0-internal.bf4bcce"
48
48
  },
49
49
  "engines": {
50
50
  "node": ">=24.15.0"