@opensaas/stack-storage-vercel 0.29.0 → 0.31.0
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +57 -0
- package/README.md +72 -4
- package/dist/index.d.ts +64 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +149 -33
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +189 -39
- package/tests/vercel-blob-provider.test.ts +514 -93
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# @opensaas/stack-storage-vercel
|
|
2
2
|
|
|
3
|
+
## 0.31.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#777](https://github.com/OpenSaasAU/stack/pull/777) [`7098878`](https://github.com/OpenSaasAU/stack/commit/70988788afc311906d7541c23f68e3b04e472b63) Thanks [@borisno2](https://github.com/borisno2)! - Honour `public: false` with real private-blob support. Uploads now map `public: false` to `access: 'private'` (previously ignored); `download()` reads both public and private blobs through `@vercel/blob`'s authorized `get()` path instead of a plain `fetch(url)`, and rejects with a descriptive "File not found" error for a missing blob instead of an unrelated failure; a new `getSignedUrl(filename, expiresIn?)` returns a time-limited signed URL for serving private files through developer-controlled routes.
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
storage: {
|
|
11
|
+
documents: vercelBlobStorage({
|
|
12
|
+
token: process.env.BLOB_READ_WRITE_TOKEN,
|
|
13
|
+
public: false,
|
|
14
|
+
}),
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const provider = createStorageProvider(config, 'documents')
|
|
18
|
+
const signedUrl = await provider.getSignedUrl('report.pdf', 3600)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This also bumps the `@vercel/blob` dependency from `^2.3.1` to `^2.6.1`, which adds the `issueSignedToken`/`presignUrl` APIs `getSignedUrl()` relies on.
|
|
22
|
+
|
|
23
|
+
- [#786](https://github.com/OpenSaasAU/stack/pull/786) [`7cd3eb4`](https://github.com/OpenSaasAU/stack/commit/7cd3eb49d0f9515a26984e096c1d3bc4b9dab530) Thanks [@borisno2](https://github.com/borisno2)! - Add `allowOverwrite` config option to `vercelBlobStorage`. The Vercel Blob API rejects uploads to an existing pathname unless this is sent, which made stable-filename replace workflows (`generateUniqueFilenames: false`, e.g. a field with `cleanupOnReplace`) throw "blob already exists". `allowOverwrite` now defaults to `true` when `generateUniqueFilenames` is `false`, and `false` otherwise; an explicit setting always wins.
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
vercelBlobStorage({
|
|
27
|
+
token: process.env.BLOB_READ_WRITE_TOKEN,
|
|
28
|
+
generateUniqueFilenames: false,
|
|
29
|
+
allowOverwrite: false, // opt back into reject-on-overwrite with stable names
|
|
30
|
+
})
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- [#778](https://github.com/OpenSaasAU/stack/pull/778) [`5f8fd73`](https://github.com/OpenSaasAU/stack/commit/5f8fd731d30d040438d4447c54052d97d0ec2f73) Thanks [@borisno2](https://github.com/borisno2)! - Add Vercel OIDC authentication support to the Vercel Blob storage provider
|
|
34
|
+
|
|
35
|
+
The provider no longer requires a static read-write token. New `storeId` and `oidcToken` config options enable Vercel OIDC auth — the `@vercel/blob` SDK exchanges the deployment's `VERCEL_OIDC_TOKEN` for blob credentials automatically:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
storage: {
|
|
39
|
+
uploads: vercelBlobStorage({
|
|
40
|
+
storeId: process.env.BLOB_STORE_ID, // or omit and just set BLOB_STORE_ID
|
|
41
|
+
pathPrefix: 'uploads',
|
|
42
|
+
}),
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Credential precedence (resolved by the SDK on every call): explicit `token` → OIDC token (`oidcToken` or `VERCEL_OIDC_TOKEN`) plus store id (`storeId` or `BLOB_STORE_ID`) → `BLOB_READ_WRITE_TOKEN` environment variable.
|
|
47
|
+
|
|
48
|
+
The constructor no longer throws when no static token is configured — previously this blocked OIDC-authenticated deployments before the SDK's credential resolution could run. When no credentials are available at all, the SDK now throws a descriptive error on the first storage operation instead. Requires `@vercel/blob` 2.4.1+ (dependency floor bumped from 2.3.1).
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- [#779](https://github.com/OpenSaasAU/stack/pull/779) [`4a1d9be`](https://github.com/OpenSaasAU/stack/commit/4a1d9be5aee15691e0d8a7c5b3d16c802e62bc84) Thanks [@borisno2](https://github.com/borisno2)! - Fix `getUrl()` returning a fabricated host that never resolves. It now derives the store ID from the configured token/store ID (the same way the SDK does internally) and embeds it along with the access mode, matching the real URL the SDK returns at upload time. A token that doesn't yield a store ID now throws a descriptive error instead of producing a silently wrong URL.
|
|
53
|
+
|
|
54
|
+
- [#792](https://github.com/OpenSaasAU/stack/pull/792) [`fe1ed5c`](https://github.com/OpenSaasAU/stack/commit/fe1ed5cd2226ea59b2b0b15e4c5f89379c98df2e) Thanks [@borisno2](https://github.com/borisno2)! - Fix unique filename generation to use `path.extname` semantics (matching the local provider) so extension-less originals no longer get the whole name appended, and pass through an explicit `cacheControlMaxAge: 0` instead of dropping it.
|
|
55
|
+
|
|
56
|
+
- [#776](https://github.com/OpenSaasAU/stack/pull/776) [`030d540`](https://github.com/OpenSaasAU/stack/commit/030d540cfb1fc4495da5177cda0bc1915c0cb354) Thanks [@borisno2](https://github.com/borisno2)! - Fix `delete()`/`download()` for `@vercel/blob` v2, which rejects `head()` with `BlobNotFoundError` for missing blobs instead of resolving `null`. `delete()` of a missing blob is now a no-op and no longer round-trips through `head()`.
|
|
57
|
+
|
|
58
|
+
## 0.30.0
|
|
59
|
+
|
|
3
60
|
## 0.29.0
|
|
4
61
|
|
|
5
62
|
## 0.28.0
|
package/README.md
CHANGED
|
@@ -37,19 +37,47 @@ export default config({
|
|
|
37
37
|
|
|
38
38
|
```typescript
|
|
39
39
|
vercelBlobStorage({
|
|
40
|
-
// Optional - Authentication
|
|
41
|
-
token?: string //
|
|
40
|
+
// Optional - Authentication (see "Authentication" below)
|
|
41
|
+
token?: string // Static read-write token (or use BLOB_READ_WRITE_TOKEN env var)
|
|
42
|
+
storeId?: string // Blob store id for Vercel OIDC auth (or use BLOB_STORE_ID env var)
|
|
43
|
+
oidcToken?: string // Explicit OIDC token (or use VERCEL_OIDC_TOKEN env var)
|
|
42
44
|
|
|
43
45
|
// Optional - Storage options
|
|
44
46
|
pathPrefix?: string // Prefix for all files (e.g., 'avatars/')
|
|
45
47
|
generateUniqueFilenames?: boolean // Generate unique filenames (default: true)
|
|
48
|
+
allowOverwrite?: boolean // Allow overwriting an existing blob at the same pathname
|
|
49
|
+
// (default: true when generateUniqueFilenames is false, false otherwise)
|
|
46
50
|
public?: boolean // Make files publicly accessible (default: true)
|
|
47
51
|
cacheControl?: string // Cache control header (default: 'public, max-age=31536000, immutable')
|
|
48
52
|
})
|
|
49
53
|
```
|
|
50
54
|
|
|
55
|
+
### Overwriting existing files
|
|
56
|
+
|
|
57
|
+
The Vercel Blob API rejects uploads to an existing pathname unless `allowOverwrite`
|
|
58
|
+
is sent. With `generateUniqueFilenames: false` (stable filenames), the provider
|
|
59
|
+
defaults `allowOverwrite` to `true` since re-uploading to the same pathname is
|
|
60
|
+
the expected replace workflow (e.g. a field configured with `cleanupOnReplace`).
|
|
61
|
+
With generated filenames, collisions aren't expected, so it's left at the API's
|
|
62
|
+
default of rejecting overwrites. Set `allowOverwrite` explicitly to override
|
|
63
|
+
either default.
|
|
64
|
+
|
|
65
|
+
## Authentication
|
|
66
|
+
|
|
67
|
+
Credentials are resolved by the `@vercel/blob` SDK on every call, in this order:
|
|
68
|
+
|
|
69
|
+
1. An explicit `token` (static read-write token)
|
|
70
|
+
2. Vercel OIDC: an OIDC token (`oidcToken` or `VERCEL_OIDC_TOKEN`) plus a store
|
|
71
|
+
id (`storeId` or `BLOB_STORE_ID`)
|
|
72
|
+
3. The `BLOB_READ_WRITE_TOKEN` environment variable
|
|
73
|
+
|
|
74
|
+
If none are available, the SDK throws a descriptive error on the first storage
|
|
75
|
+
operation. OIDC auth requires `@vercel/blob` 2.4.1 or later.
|
|
76
|
+
|
|
51
77
|
## Setup
|
|
52
78
|
|
|
79
|
+
### Option A: Static read-write token
|
|
80
|
+
|
|
53
81
|
1. Create a Vercel Blob store in your Vercel project dashboard
|
|
54
82
|
|
|
55
83
|
2. Get your Blob token from the Vercel dashboard
|
|
@@ -60,6 +88,31 @@ vercelBlobStorage({
|
|
|
60
88
|
BLOB_READ_WRITE_TOKEN=vercel_blob_rw_...
|
|
61
89
|
```
|
|
62
90
|
|
|
91
|
+
### Option B: Vercel OIDC (no static token)
|
|
92
|
+
|
|
93
|
+
1. Create a Vercel Blob store in your Vercel project dashboard
|
|
94
|
+
|
|
95
|
+
2. Enable OIDC federation for your Vercel project
|
|
96
|
+
|
|
97
|
+
3. Provide the blob store id — either set the environment variable:
|
|
98
|
+
|
|
99
|
+
```env
|
|
100
|
+
BLOB_STORE_ID=store_...
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
or pass it in config:
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
avatars: vercelBlobStorage({
|
|
107
|
+
storeId: process.env.BLOB_STORE_ID,
|
|
108
|
+
pathPrefix: 'avatars',
|
|
109
|
+
})
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
On Vercel, the deployment's `VERCEL_OIDC_TOKEN` is exchanged for blob
|
|
113
|
+
credentials automatically — no long-lived token to manage. For local
|
|
114
|
+
development, `vercel env pull` provides a short-lived OIDC token.
|
|
115
|
+
|
|
63
116
|
## Examples
|
|
64
117
|
|
|
65
118
|
### Basic Configuration
|
|
@@ -82,6 +135,15 @@ avatars: vercelBlobStorage({
|
|
|
82
135
|
})
|
|
83
136
|
```
|
|
84
137
|
|
|
138
|
+
### Vercel OIDC (No Static Token)
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
avatars: vercelBlobStorage({
|
|
142
|
+
storeId: process.env.BLOB_STORE_ID,
|
|
143
|
+
pathPrefix: 'avatars',
|
|
144
|
+
})
|
|
145
|
+
```
|
|
146
|
+
|
|
85
147
|
### Private Files
|
|
86
148
|
|
|
87
149
|
```typescript
|
|
@@ -91,6 +153,8 @@ documents: vercelBlobStorage({
|
|
|
91
153
|
})
|
|
92
154
|
```
|
|
93
155
|
|
|
156
|
+
Private blobs aren't fetchable via their plain URL — `provider.download(filename)` and `provider.getSignedUrl(filename, expiresIn)` read them through `@vercel/blob`'s authorized read path instead, so serve them through a developer-controlled route (or a signed URL) rather than linking `url`/`metadata.downloadUrl` directly. See the [storage docs](https://stack.opensaas.au/how-to/storage#private-file-access) for the serving pattern.
|
|
157
|
+
|
|
94
158
|
### Custom Cache Control
|
|
95
159
|
|
|
96
160
|
```typescript
|
|
@@ -126,17 +190,21 @@ Vercel Blob URLs are stable and won't change once uploaded, making them safe to
|
|
|
126
190
|
|
|
127
191
|
## Environment Variables
|
|
128
192
|
|
|
129
|
-
|
|
193
|
+
One of the following authentication setups is required:
|
|
130
194
|
|
|
131
195
|
```env
|
|
196
|
+
# Static token auth
|
|
132
197
|
BLOB_READ_WRITE_TOKEN=vercel_blob_rw_...
|
|
198
|
+
|
|
199
|
+
# OR OIDC auth (VERCEL_OIDC_TOKEN is provided by Vercel automatically)
|
|
200
|
+
BLOB_STORE_ID=store_...
|
|
133
201
|
```
|
|
134
202
|
|
|
135
203
|
## Deployment
|
|
136
204
|
|
|
137
205
|
When deploying to Vercel:
|
|
138
206
|
|
|
139
|
-
1. The `BLOB_READ_WRITE_TOKEN` is automatically available in the Vercel environment
|
|
207
|
+
1. The `BLOB_READ_WRITE_TOKEN` (static token auth) or `VERCEL_OIDC_TOKEN` (OIDC auth) is automatically available in the Vercel environment
|
|
140
208
|
2. No additional configuration needed
|
|
141
209
|
3. Files are stored in Vercel's blob storage
|
|
142
210
|
4. Global CDN distribution is automatic
|
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,31 @@ import type { StorageProvider, UploadOptions, UploadResult } from '@opensaas/sta
|
|
|
4
4
|
*/
|
|
5
5
|
export interface VercelBlobStorageConfig {
|
|
6
6
|
type: 'vercel-blob';
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Vercel Blob read-write token (can also be set via BLOB_READ_WRITE_TOKEN env var).
|
|
9
|
+
* Optional when using Vercel OIDC auth (`storeId`/`BLOB_STORE_ID`).
|
|
10
|
+
*/
|
|
8
11
|
token?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Blob store id for Vercel OIDC auth (overrides the BLOB_STORE_ID env var).
|
|
14
|
+
* When an OIDC token is available (VERCEL_OIDC_TOKEN or `oidcToken`) and a
|
|
15
|
+
* store id is set, no static read-write token is needed.
|
|
16
|
+
*/
|
|
17
|
+
storeId?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Explicit Vercel OIDC token (overrides the VERCEL_OIDC_TOKEN env var).
|
|
20
|
+
* Requires `storeId` or BLOB_STORE_ID.
|
|
21
|
+
*/
|
|
22
|
+
oidcToken?: string;
|
|
9
23
|
/** Whether to generate unique filenames (default: true) */
|
|
10
24
|
generateUniqueFilenames?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to allow overwriting an existing blob at the same pathname.
|
|
27
|
+
* The Blob API rejects overwrites unless this is sent. Defaults to `true`
|
|
28
|
+
* when `generateUniqueFilenames` is `false` (stable filenames imply replace
|
|
29
|
+
* semantics), and `false` otherwise. An explicit setting always wins.
|
|
30
|
+
*/
|
|
31
|
+
allowOverwrite?: boolean;
|
|
11
32
|
/** Path prefix for all uploaded files */
|
|
12
33
|
pathPrefix?: string;
|
|
13
34
|
/** Whether files should be publicly accessible (default: true) */
|
|
@@ -23,6 +44,12 @@ export interface VercelBlobStorageConfig {
|
|
|
23
44
|
export declare class VercelBlobStorageProvider implements StorageProvider {
|
|
24
45
|
private config;
|
|
25
46
|
constructor(config: VercelBlobStorageConfig);
|
|
47
|
+
/**
|
|
48
|
+
* Credential options passed to every SDK call. The SDK's precedence is:
|
|
49
|
+
* explicit `token` → OIDC token + store id → BLOB_READ_WRITE_TOKEN env var;
|
|
50
|
+
* it throws a descriptive error when none of these are available.
|
|
51
|
+
*/
|
|
52
|
+
private authOptions;
|
|
26
53
|
/**
|
|
27
54
|
* Generates a unique filename if configured
|
|
28
55
|
*/
|
|
@@ -31,16 +58,41 @@ export declare class VercelBlobStorageProvider implements StorageProvider {
|
|
|
31
58
|
* Gets the full pathname for a file including path prefix
|
|
32
59
|
*/
|
|
33
60
|
private getFullPath;
|
|
61
|
+
/**
|
|
62
|
+
* Resolves whether uploads may overwrite an existing blob at the same
|
|
63
|
+
* pathname. An explicit `allowOverwrite` always wins; otherwise stable
|
|
64
|
+
* filenames (`generateUniqueFilenames: false`) imply replace semantics and
|
|
65
|
+
* default to `true`. With generated filenames collisions aren't expected,
|
|
66
|
+
* so the key is left unset and the Blob API's own reject-by-default
|
|
67
|
+
* behavior applies.
|
|
68
|
+
*/
|
|
69
|
+
private resolveAllowOverwrite;
|
|
70
|
+
/**
|
|
71
|
+
* Resolves the blob access level for this provider instance.
|
|
72
|
+
* `public` is a provider-wide config setting, so every blob uploaded
|
|
73
|
+
* (and later read) through this instance uses the same access level.
|
|
74
|
+
*/
|
|
75
|
+
private getAccess;
|
|
76
|
+
/**
|
|
77
|
+
* Resolves the Vercel Blob store ID used to construct blob URLs, mirroring
|
|
78
|
+
* the SDK's own credential precedence: an explicit read-write token wins
|
|
79
|
+
* (its embedded store ID is authoritative), otherwise an explicit/env store
|
|
80
|
+
* ID is used, otherwise the store ID is parsed from the env read-write
|
|
81
|
+
* token.
|
|
82
|
+
*/
|
|
83
|
+
private resolveStoreId;
|
|
34
84
|
upload(file: Buffer | Uint8Array, filename: string, options?: UploadOptions): Promise<UploadResult>;
|
|
35
85
|
download(filename: string): Promise<Buffer>;
|
|
36
86
|
delete(filename: string): Promise<void>;
|
|
37
87
|
getUrl(filename: string): string;
|
|
88
|
+
getSignedUrl(filename: string, expiresIn?: number): Promise<string>;
|
|
38
89
|
}
|
|
39
90
|
/**
|
|
40
91
|
* Creates a Vercel Blob storage configuration
|
|
41
92
|
*
|
|
42
93
|
* @example
|
|
43
94
|
* ```typescript
|
|
95
|
+
* // Static read-write token
|
|
44
96
|
* const config = config({
|
|
45
97
|
* storage: {
|
|
46
98
|
* avatars: vercelBlobStorage({
|
|
@@ -49,6 +101,17 @@ export declare class VercelBlobStorageProvider implements StorageProvider {
|
|
|
49
101
|
* }),
|
|
50
102
|
* },
|
|
51
103
|
* })
|
|
104
|
+
*
|
|
105
|
+
* // Vercel OIDC auth — no static token; the SDK resolves credentials from
|
|
106
|
+
* // VERCEL_OIDC_TOKEN plus the store id (config.storeId or BLOB_STORE_ID env)
|
|
107
|
+
* const config = config({
|
|
108
|
+
* storage: {
|
|
109
|
+
* avatars: vercelBlobStorage({
|
|
110
|
+
* storeId: process.env.BLOB_STORE_ID,
|
|
111
|
+
* pathPrefix: 'avatars',
|
|
112
|
+
* }),
|
|
113
|
+
* },
|
|
114
|
+
* })
|
|
52
115
|
* ```
|
|
53
116
|
*/
|
|
54
117
|
export declare function vercelBlobStorage(config: Omit<VercelBlobStorageConfig, 'type'>): VercelBlobStorageConfig;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAoB3F;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,aAAa,CAAA;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG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ED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,IAAI,CAAC,uBAAuB,EAAE,MAAM,CAAC,GAC5C,uBAAuB,CAOzB"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
import { put, del,
|
|
1
|
+
import { put, del, get, issueSignedToken, presignUrl, BlobNotFoundError } from '@vercel/blob';
|
|
2
2
|
import { randomBytes } from 'node:crypto';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
/**
|
|
5
|
+
* Derives the store ID embedded in a Vercel Blob read-write token
|
|
6
|
+
* (`vercel_blob_rw_<storeId>_<secret>`), the same way `@vercel/blob` derives
|
|
7
|
+
* it internally to build blob URLs. This format is undocumented and not a
|
|
8
|
+
* stable public API — it's parity with the SDK's internal parsing, not a
|
|
9
|
+
* contract Vercel guarantees. Returns `''` if the token doesn't match the
|
|
10
|
+
* expected shape.
|
|
11
|
+
*/
|
|
12
|
+
function parseStoreIdFromToken(token) {
|
|
13
|
+
const segments = token.split('_');
|
|
14
|
+
return segments.length >= 4 ? segments[3] : '';
|
|
15
|
+
}
|
|
16
|
+
/** Strips the `store_` prefix some store ID values are given with. */
|
|
17
|
+
function normalizeStoreId(storeId) {
|
|
18
|
+
return storeId.startsWith('store_') ? storeId.slice('store_'.length) : storeId;
|
|
19
|
+
}
|
|
3
20
|
/**
|
|
4
21
|
* Vercel Blob storage provider
|
|
5
22
|
*/
|
|
@@ -7,10 +24,25 @@ export class VercelBlobStorageProvider {
|
|
|
7
24
|
config;
|
|
8
25
|
constructor(config) {
|
|
9
26
|
this.config = config;
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
27
|
+
// Credential resolution is delegated to the @vercel/blob SDK at call time.
|
|
28
|
+
// Eagerly requiring a static token here would break Vercel OIDC auth, where
|
|
29
|
+
// no token/BLOB_READ_WRITE_TOKEN exists and the SDK resolves credentials
|
|
30
|
+
// from VERCEL_OIDC_TOKEN (or the request context) plus storeId/BLOB_STORE_ID.
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Credential options passed to every SDK call. The SDK's precedence is:
|
|
34
|
+
* explicit `token` → OIDC token + store id → BLOB_READ_WRITE_TOKEN env var;
|
|
35
|
+
* it throws a descriptive error when none of these are available.
|
|
36
|
+
*/
|
|
37
|
+
authOptions() {
|
|
38
|
+
const auth = {};
|
|
39
|
+
if (this.config.token)
|
|
40
|
+
auth.token = this.config.token;
|
|
41
|
+
if (this.config.storeId)
|
|
42
|
+
auth.storeId = this.config.storeId;
|
|
43
|
+
if (this.config.oidcToken)
|
|
44
|
+
auth.oidcToken = this.config.oidcToken;
|
|
45
|
+
return auth;
|
|
14
46
|
}
|
|
15
47
|
/**
|
|
16
48
|
* Generates a unique filename if configured
|
|
@@ -19,7 +51,7 @@ export class VercelBlobStorageProvider {
|
|
|
19
51
|
if (this.config.generateUniqueFilenames === false) {
|
|
20
52
|
return originalFilename;
|
|
21
53
|
}
|
|
22
|
-
const ext =
|
|
54
|
+
const ext = path.extname(originalFilename);
|
|
23
55
|
const uniqueId = randomBytes(16).toString('hex');
|
|
24
56
|
const timestamp = Date.now();
|
|
25
57
|
return `${timestamp}-${uniqueId}${ext}`;
|
|
@@ -33,6 +65,60 @@ export class VercelBlobStorageProvider {
|
|
|
33
65
|
}
|
|
34
66
|
return filename;
|
|
35
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Resolves whether uploads may overwrite an existing blob at the same
|
|
70
|
+
* pathname. An explicit `allowOverwrite` always wins; otherwise stable
|
|
71
|
+
* filenames (`generateUniqueFilenames: false`) imply replace semantics and
|
|
72
|
+
* default to `true`. With generated filenames collisions aren't expected,
|
|
73
|
+
* so the key is left unset and the Blob API's own reject-by-default
|
|
74
|
+
* behavior applies.
|
|
75
|
+
*/
|
|
76
|
+
resolveAllowOverwrite() {
|
|
77
|
+
if (this.config.allowOverwrite !== undefined) {
|
|
78
|
+
return this.config.allowOverwrite;
|
|
79
|
+
}
|
|
80
|
+
return this.config.generateUniqueFilenames === false ? true : undefined;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Resolves the blob access level for this provider instance.
|
|
84
|
+
* `public` is a provider-wide config setting, so every blob uploaded
|
|
85
|
+
* (and later read) through this instance uses the same access level.
|
|
86
|
+
*/
|
|
87
|
+
getAccess() {
|
|
88
|
+
return this.config.public !== false ? 'public' : 'private';
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Resolves the Vercel Blob store ID used to construct blob URLs, mirroring
|
|
92
|
+
* the SDK's own credential precedence: an explicit read-write token wins
|
|
93
|
+
* (its embedded store ID is authoritative), otherwise an explicit/env store
|
|
94
|
+
* ID is used, otherwise the store ID is parsed from the env read-write
|
|
95
|
+
* token.
|
|
96
|
+
*/
|
|
97
|
+
resolveStoreId() {
|
|
98
|
+
const token = this.config.token ?? process.env.BLOB_READ_WRITE_TOKEN?.trim();
|
|
99
|
+
if (this.config.token) {
|
|
100
|
+
const storeId = parseStoreIdFromToken(this.config.token);
|
|
101
|
+
if (!storeId) {
|
|
102
|
+
throw new Error('Cannot determine the Vercel Blob store ID: the configured `token` does not match the ' +
|
|
103
|
+
'expected "vercel_blob_rw_<storeId>_<secret>" format. Pass `storeId` explicitly to construct blob URLs.');
|
|
104
|
+
}
|
|
105
|
+
return storeId;
|
|
106
|
+
}
|
|
107
|
+
const storeId = this.config.storeId?.trim() || process.env.BLOB_STORE_ID?.trim();
|
|
108
|
+
if (storeId) {
|
|
109
|
+
return normalizeStoreId(storeId);
|
|
110
|
+
}
|
|
111
|
+
if (token) {
|
|
112
|
+
const parsedStoreId = parseStoreIdFromToken(token);
|
|
113
|
+
if (!parsedStoreId) {
|
|
114
|
+
throw new Error('Cannot determine the Vercel Blob store ID: BLOB_READ_WRITE_TOKEN does not match the ' +
|
|
115
|
+
'expected "vercel_blob_rw_<storeId>_<secret>" format. Pass `storeId` explicitly to construct blob URLs.');
|
|
116
|
+
}
|
|
117
|
+
return parsedStoreId;
|
|
118
|
+
}
|
|
119
|
+
throw new Error('Cannot determine the Vercel Blob store ID: configure `token`, `storeId`, BLOB_STORE_ID, or ' +
|
|
120
|
+
'BLOB_READ_WRITE_TOKEN to construct blob URLs.');
|
|
121
|
+
}
|
|
36
122
|
async upload(file, filename, options) {
|
|
37
123
|
const generatedFilename = this.generateFilename(filename);
|
|
38
124
|
const pathname = this.getFullPath(generatedFilename);
|
|
@@ -40,16 +126,17 @@ export class VercelBlobStorageProvider {
|
|
|
40
126
|
const buffer = Buffer.isBuffer(file) ? file : Buffer.from(file);
|
|
41
127
|
// Upload to Vercel Blob
|
|
42
128
|
const uploadOptions = {
|
|
43
|
-
access:
|
|
44
|
-
token: this.config.token,
|
|
129
|
+
access: this.getAccess(),
|
|
45
130
|
contentType: options?.contentType,
|
|
131
|
+
...this.authOptions(),
|
|
46
132
|
};
|
|
47
|
-
if (this.config.
|
|
48
|
-
uploadOptions.access = 'public';
|
|
49
|
-
}
|
|
50
|
-
if (this.config.cacheControlMaxAge) {
|
|
133
|
+
if (this.config.cacheControlMaxAge !== undefined) {
|
|
51
134
|
uploadOptions.cacheControlMaxAge = this.config.cacheControlMaxAge;
|
|
52
135
|
}
|
|
136
|
+
const allowOverwrite = this.resolveAllowOverwrite();
|
|
137
|
+
if (allowOverwrite !== undefined) {
|
|
138
|
+
uploadOptions.allowOverwrite = allowOverwrite;
|
|
139
|
+
}
|
|
53
140
|
const blob = await put(pathname, buffer, uploadOptions);
|
|
54
141
|
return {
|
|
55
142
|
filename: generatedFilename,
|
|
@@ -65,38 +152,55 @@ export class VercelBlobStorageProvider {
|
|
|
65
152
|
}
|
|
66
153
|
async download(filename) {
|
|
67
154
|
const pathname = this.getFullPath(filename);
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
155
|
+
// Fetch the blob content through the SDK's authorized read path. This
|
|
156
|
+
// works for both public and private blobs (private blobs cannot be
|
|
157
|
+
// read via a plain `fetch(url)`, since the request needs a bearer
|
|
158
|
+
// token) and resolves `null` for a missing blob instead of throwing.
|
|
159
|
+
const result = await get(pathname, {
|
|
160
|
+
access: this.getAccess(),
|
|
161
|
+
...this.authOptions(),
|
|
71
162
|
});
|
|
72
|
-
if (!
|
|
163
|
+
if (!result) {
|
|
73
164
|
throw new Error(`File not found: ${filename}`);
|
|
74
165
|
}
|
|
75
|
-
|
|
76
|
-
const response = await fetch(metadata.url);
|
|
77
|
-
if (!response.ok) {
|
|
78
|
-
throw new Error(`Failed to download file: ${response.statusText}`);
|
|
79
|
-
}
|
|
80
|
-
const arrayBuffer = await response.arrayBuffer();
|
|
166
|
+
const arrayBuffer = await new Response(result.stream).arrayBuffer();
|
|
81
167
|
return Buffer.from(arrayBuffer);
|
|
82
168
|
}
|
|
83
169
|
async delete(filename) {
|
|
84
170
|
const pathname = this.getFullPath(filename);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
});
|
|
171
|
+
try {
|
|
172
|
+
await del(pathname, this.authOptions());
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
if (!(error instanceof BlobNotFoundError)) {
|
|
176
|
+
throw error;
|
|
177
|
+
}
|
|
93
178
|
}
|
|
94
179
|
}
|
|
95
180
|
getUrl(filename) {
|
|
96
|
-
// For Vercel Blob, we need to have uploaded the file first to get the URL
|
|
97
|
-
// This method is less useful for Vercel Blob, but we provide a pathname
|
|
98
181
|
const pathname = this.getFullPath(filename);
|
|
99
|
-
|
|
182
|
+
const storeId = this.resolveStoreId();
|
|
183
|
+
return `https://${storeId}.${this.getAccess()}.blob.vercel-storage.com/${pathname}`;
|
|
184
|
+
}
|
|
185
|
+
async getSignedUrl(filename, expiresIn = 3600) {
|
|
186
|
+
const pathname = this.getFullPath(filename);
|
|
187
|
+
const validUntil = Date.now() + expiresIn * 1000;
|
|
188
|
+
const signedToken = await issueSignedToken({
|
|
189
|
+
pathname,
|
|
190
|
+
operations: ['get'],
|
|
191
|
+
validUntil,
|
|
192
|
+
...this.authOptions(),
|
|
193
|
+
});
|
|
194
|
+
const { presignedUrl } = await presignUrl({
|
|
195
|
+
delegationToken: signedToken.delegationToken,
|
|
196
|
+
clientSigningToken: signedToken.clientSigningToken,
|
|
197
|
+
}, {
|
|
198
|
+
operation: 'get',
|
|
199
|
+
pathname,
|
|
200
|
+
validUntil,
|
|
201
|
+
access: this.getAccess(),
|
|
202
|
+
});
|
|
203
|
+
return presignedUrl;
|
|
100
204
|
}
|
|
101
205
|
}
|
|
102
206
|
/**
|
|
@@ -104,6 +208,7 @@ export class VercelBlobStorageProvider {
|
|
|
104
208
|
*
|
|
105
209
|
* @example
|
|
106
210
|
* ```typescript
|
|
211
|
+
* // Static read-write token
|
|
107
212
|
* const config = config({
|
|
108
213
|
* storage: {
|
|
109
214
|
* avatars: vercelBlobStorage({
|
|
@@ -112,6 +217,17 @@ export class VercelBlobStorageProvider {
|
|
|
112
217
|
* }),
|
|
113
218
|
* },
|
|
114
219
|
* })
|
|
220
|
+
*
|
|
221
|
+
* // Vercel OIDC auth — no static token; the SDK resolves credentials from
|
|
222
|
+
* // VERCEL_OIDC_TOKEN plus the store id (config.storeId or BLOB_STORE_ID env)
|
|
223
|
+
* const config = config({
|
|
224
|
+
* storage: {
|
|
225
|
+
* avatars: vercelBlobStorage({
|
|
226
|
+
* storeId: process.env.BLOB_STORE_ID,
|
|
227
|
+
* pathPrefix: 'avatars',
|
|
228
|
+
* }),
|
|
229
|
+
* },
|
|
230
|
+
* })
|
|
115
231
|
* ```
|
|
116
232
|
*/
|
|
117
233
|
export function vercelBlobStorage(config) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"index.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YAAY,EAAE,GAAG,MAAM,UAAU,CACvC;YACE,eAAe,EAAE,WAAW,CAAC,eAAe;YAC5C,kBAAkB,EAAE,WAAW,CAAC,kBAAkB;SACnD,EACD;YACE,SAAS,EAAE,KAAK;YAChB,QAAQ;YACR,UAAU;YACV,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE;SACzB,CACF,CAAA;QAED,OAAO,YAAY,CAAA;IACrB,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAA6C;IAE7C,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,uBAAuB,EAAE,IAAI;QAC7B,MAAM,EAAE,IAAI;QACZ,GAAG,MAAM;KACV,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensaas/stack-storage-vercel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "Vercel Blob storage provider for OpenSaas Stack file uploads",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"main": "./dist/index.js",
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@vercel/blob": "^2.
|
|
15
|
+
"@vercel/blob": "^2.6.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "^26.1.1",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@vitest/coverage-v8": "^4.1.10",
|
|
21
21
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
22
22
|
"vitest": "^4.1.10",
|
|
23
|
-
"@opensaas/stack-storage": "0.
|
|
23
|
+
"@opensaas/stack-storage": "0.31.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@opensaas/stack-storage": "^0"
|