@payloadcms/storage-vercel-blob 3.85.0 → 3.85.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"VercelBlobClientUploadHandler.d.ts","sourceRoot":"","sources":["../../src/client/VercelBlobClientUploadHandler.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,kCAAkC,GAAG;IAC/C,eAAe,EAAE,OAAO,CAAA;IACxB,oBAAoB,EAAE,OAAO,CAAA;CAC9B,CAAA;AASD,eAAO,MAAM,6BAA6B;;;;;;;aAMpB,OAAO,aAmCzB,CAAA"}
1
+ {"version":3,"file":"VercelBlobClientUploadHandler.d.ts","sourceRoot":"","sources":["../../src/client/VercelBlobClientUploadHandler.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,kCAAkC,GAAG;IAC/C,eAAe,EAAE,OAAO,CAAA;IACxB,oBAAoB,EAAE,OAAO,CAAA;CAC9B,CAAA;AASD,eAAO,MAAM,6BAA6B;;;;;;;aAQpC,OAAO,aAiCT,CAAA"}
@@ -1,6 +1,5 @@
1
1
  'use client';
2
- import { createClientUploadHandler } from '@payloadcms/plugin-cloud-storage/client';
3
- import { getFileKey } from '@payloadcms/plugin-cloud-storage/utilities';
2
+ import { createClientUploadHandler, getFileKey } from '@payloadcms/plugin-cloud-storage/client';
4
3
  import { upload } from '@vercel/blob/client';
5
4
  import { formatAdminURL } from 'payload/shared';
6
5
  /** Last path segment only (POSIX), for keys like `folder/sub/file.png`. */ function posixBasename(key) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client/VercelBlobClientUploadHandler.ts"],"sourcesContent":["'use client'\nimport { createClientUploadHandler } from '@payloadcms/plugin-cloud-storage/client'\nimport { getFileKey } from '@payloadcms/plugin-cloud-storage/utilities'\nimport { upload } from '@vercel/blob/client'\nimport { formatAdminURL } from 'payload/shared'\n\nexport type VercelBlobClientUploadHandlerExtra = {\n addRandomSuffix: boolean\n useCompositePrefixes: boolean\n}\n\n/** Last path segment only (POSIX), for keys like `folder/sub/file.png`. */\nfunction posixBasename(key: string): string {\n const normalized = key.replace(/^\\/+/, '')\n const lastSlash = normalized.lastIndexOf('/')\n return lastSlash === -1 ? normalized : normalized.slice(lastSlash + 1)\n}\n\nexport const VercelBlobClientUploadHandler =\n createClientUploadHandler<VercelBlobClientUploadHandlerExtra>({\n handler: async ({\n apiRoute,\n collectionSlug,\n docPrefix,\n extra: { addRandomSuffix, useCompositePrefixes = false },\n file,\n prefix,\n serverHandlerPath,\n serverURL,\n updateFilename,\n }) => {\n const endpointRoute = formatAdminURL({\n apiRoute,\n path: serverHandlerPath,\n serverURL,\n })\n const { fileKey: pathname, sanitizedDocPrefix } = getFileKey({\n collectionPrefix: prefix,\n docPrefix,\n filename: file.name,\n useCompositePrefixes,\n })\n\n // upload the file directly to Vercel Blob using the signed URL\n const result = await upload(pathname, file, {\n access: 'public',\n clientPayload: collectionSlug,\n contentType: file.type,\n handleUploadUrl: endpointRoute,\n })\n\n // Match server uploadFile: document `filename` is basename only; prefixes are separate.\n if (addRandomSuffix) {\n const pathname = result.pathname.replace(/^\\/+/, '')\n updateFilename(decodeURIComponent(posixBasename(pathname)))\n }\n\n return { prefix: sanitizedDocPrefix }\n },\n })\n"],"names":["createClientUploadHandler","getFileKey","upload","formatAdminURL","posixBasename","key","normalized","replace","lastSlash","lastIndexOf","slice","VercelBlobClientUploadHandler","handler","apiRoute","collectionSlug","docPrefix","extra","addRandomSuffix","useCompositePrefixes","file","prefix","serverHandlerPath","serverURL","updateFilename","endpointRoute","path","fileKey","pathname","sanitizedDocPrefix","collectionPrefix","filename","name","result","access","clientPayload","contentType","type","handleUploadUrl","decodeURIComponent"],"mappings":"AAAA;AACA,SAASA,yBAAyB,QAAQ,0CAAyC;AACnF,SAASC,UAAU,QAAQ,6CAA4C;AACvE,SAASC,MAAM,QAAQ,sBAAqB;AAC5C,SAASC,cAAc,QAAQ,iBAAgB;AAO/C,yEAAyE,GACzE,SAASC,cAAcC,GAAW;IAChC,MAAMC,aAAaD,IAAIE,OAAO,CAAC,QAAQ;IACvC,MAAMC,YAAYF,WAAWG,WAAW,CAAC;IACzC,OAAOD,cAAc,CAAC,IAAIF,aAAaA,WAAWI,KAAK,CAACF,YAAY;AACtE;AAEA,OAAO,MAAMG,gCACXX,0BAA8D;IAC5DY,SAAS,OAAO,EACdC,QAAQ,EACRC,cAAc,EACdC,SAAS,EACTC,OAAO,EAAEC,eAAe,EAAEC,uBAAuB,KAAK,EAAE,EACxDC,IAAI,EACJC,MAAM,EACNC,iBAAiB,EACjBC,SAAS,EACTC,cAAc,EACf;QACC,MAAMC,gBAAgBrB,eAAe;YACnCU;YACAY,MAAMJ;YACNC;QACF;QACA,MAAM,EAAEI,SAASC,QAAQ,EAAEC,kBAAkB,EAAE,GAAG3B,WAAW;YAC3D4B,kBAAkBT;YAClBL;YACAe,UAAUX,KAAKY,IAAI;YACnBb;QACF;QAEA,+DAA+D;QAC/D,MAAMc,SAAS,MAAM9B,OAAOyB,UAAUR,MAAM;YAC1Cc,QAAQ;YACRC,eAAepB;YACfqB,aAAahB,KAAKiB,IAAI;YACtBC,iBAAiBb;QACnB;QAEA,wFAAwF;QACxF,IAAIP,iBAAiB;YACnB,MAAMU,WAAWK,OAAOL,QAAQ,CAACpB,OAAO,CAAC,QAAQ;YACjDgB,eAAee,mBAAmBlC,cAAcuB;QAClD;QAEA,OAAO;YAAEP,QAAQQ;QAAmB;IACtC;AACF,GAAE"}
1
+ {"version":3,"sources":["../../src/client/VercelBlobClientUploadHandler.ts"],"sourcesContent":["'use client'\nimport { createClientUploadHandler, getFileKey } from '@payloadcms/plugin-cloud-storage/client'\nimport { upload } from '@vercel/blob/client'\nimport { formatAdminURL } from 'payload/shared'\n\nexport type VercelBlobClientUploadHandlerExtra = {\n addRandomSuffix: boolean\n useCompositePrefixes: boolean\n}\n\n/** Last path segment only (POSIX), for keys like `folder/sub/file.png`. */\nfunction posixBasename(key: string): string {\n const normalized = key.replace(/^\\/+/, '')\n const lastSlash = normalized.lastIndexOf('/')\n return lastSlash === -1 ? normalized : normalized.slice(lastSlash + 1)\n}\n\nexport const VercelBlobClientUploadHandler =\n createClientUploadHandler<VercelBlobClientUploadHandlerExtra>({\n handler: async ({\n apiRoute,\n collectionSlug,\n docPrefix,\n extra: { addRandomSuffix, useCompositePrefixes = false },\n file,\n prefix,\n serverHandlerPath,\n serverURL,\n updateFilename,\n }) => {\n const endpointRoute = formatAdminURL({\n apiRoute,\n path: serverHandlerPath,\n serverURL,\n })\n const { fileKey: pathname, sanitizedDocPrefix } = getFileKey({\n collectionPrefix: prefix,\n docPrefix,\n filename: file.name,\n useCompositePrefixes,\n })\n\n // upload the file directly to Vercel Blob using the signed URL\n const result = await upload(pathname, file, {\n access: 'public',\n clientPayload: collectionSlug,\n contentType: file.type,\n handleUploadUrl: endpointRoute,\n })\n\n // Match server uploadFile: document `filename` is basename only; prefixes are separate.\n if (addRandomSuffix) {\n const pathname = result.pathname.replace(/^\\/+/, '')\n updateFilename(decodeURIComponent(posixBasename(pathname)))\n }\n\n return { prefix: sanitizedDocPrefix }\n },\n })\n"],"names":["createClientUploadHandler","getFileKey","upload","formatAdminURL","posixBasename","key","normalized","replace","lastSlash","lastIndexOf","slice","VercelBlobClientUploadHandler","handler","apiRoute","collectionSlug","docPrefix","extra","addRandomSuffix","useCompositePrefixes","file","prefix","serverHandlerPath","serverURL","updateFilename","endpointRoute","path","fileKey","pathname","sanitizedDocPrefix","collectionPrefix","filename","name","result","access","clientPayload","contentType","type","handleUploadUrl","decodeURIComponent"],"mappings":"AAAA;AACA,SAASA,yBAAyB,EAAEC,UAAU,QAAQ,0CAAyC;AAC/F,SAASC,MAAM,QAAQ,sBAAqB;AAC5C,SAASC,cAAc,QAAQ,iBAAgB;AAO/C,yEAAyE,GACzE,SAASC,cAAcC,GAAW;IAChC,MAAMC,aAAaD,IAAIE,OAAO,CAAC,QAAQ;IACvC,MAAMC,YAAYF,WAAWG,WAAW,CAAC;IACzC,OAAOD,cAAc,CAAC,IAAIF,aAAaA,WAAWI,KAAK,CAACF,YAAY;AACtE;AAEA,OAAO,MAAMG,gCACXX,0BAA8D;IAC5DY,SAAS,OAAO,EACdC,QAAQ,EACRC,cAAc,EACdC,SAAS,EACTC,OAAO,EAAEC,eAAe,EAAEC,uBAAuB,KAAK,EAAE,EACxDC,IAAI,EACJC,MAAM,EACNC,iBAAiB,EACjBC,SAAS,EACTC,cAAc,EACf;QACC,MAAMC,gBAAgBrB,eAAe;YACnCU;YACAY,MAAMJ;YACNC;QACF;QACA,MAAM,EAAEI,SAASC,QAAQ,EAAEC,kBAAkB,EAAE,GAAG3B,WAAW;YAC3D4B,kBAAkBT;YAClBL;YACAe,UAAUX,KAAKY,IAAI;YACnBb;QACF;QAEA,+DAA+D;QAC/D,MAAMc,SAAS,MAAM9B,OAAOyB,UAAUR,MAAM;YAC1Cc,QAAQ;YACRC,eAAepB;YACfqB,aAAahB,KAAKiB,IAAI;YACtBC,iBAAiBb;QACnB;QAEA,wFAAwF;QACxF,IAAIP,iBAAiB;YACnB,MAAMU,WAAWK,OAAOL,QAAQ,CAACpB,OAAO,CAAC,QAAQ;YACjDgB,eAAee,mBAAmBlC,cAAcuB;QAClD;QAEA,OAAO;YAAEP,QAAQQ;QAAmB;IACtC;AACF,GAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/storage-vercel-blob",
3
- "version": "3.85.0",
3
+ "version": "3.85.2",
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": "3.85.0"
41
+ "@payloadcms/plugin-cloud-storage": "3.85.2"
42
42
  },
43
43
  "devDependencies": {
44
- "payload": "3.85.0"
44
+ "payload": "3.85.2"
45
45
  },
46
46
  "peerDependencies": {
47
- "payload": "3.85.0"
47
+ "payload": "3.85.2"
48
48
  },
49
49
  "engines": {
50
50
  "node": "^18.20.2 || >=20.9.0"