@payloadcms/storage-vercel-blob 4.0.0-internal.40de3ec → 4.0.0-internal.45cfa3d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2018-
|
|
3
|
+
Copyright (c) 2018-2026 Payload CMS, LLC <info@payloadcms.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VercelBlobClientUploadHandler.d.ts","sourceRoot":"","sources":["../../src/client/VercelBlobClientUploadHandler.ts"],"names":[],"mappings":"
|
|
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;;;;;;;iCAyCtC,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
|
|
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": "4.0.0-internal.
|
|
3
|
+
"version": "4.0.0-internal.45cfa3d",
|
|
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.
|
|
41
|
+
"@payloadcms/plugin-cloud-storage": "4.0.0-internal.45cfa3d"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"payload": "4.0.0-internal.
|
|
44
|
+
"payload": "4.0.0-internal.45cfa3d"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"payload": "4.0.0-internal.
|
|
47
|
+
"payload": "4.0.0-internal.45cfa3d"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
50
50
|
"node": ">=24.15.0"
|