8000 refactor(netlify): support @netlify/blobs v8 and improve options types by serhalp · Pull Request #486 · unjs/unstorage · GitHub
[go: up one dir, main page]

Skip to content

refactor(netlify): support @netlify/blobs v8 and improve options types #486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore(deps): support @netlify/blobs v8
The peer dependency only specifies support for v6 and v7, but v8 works
just fine.

This adds v8 to the peer dependencies, bumps the dev dep to v8, updates
the tests (there's a new requirement that's specific to unusual use
cases like unstorage's tests, which are run outside of the Netlify
platform and the Netlify CLI), and adjust the driver types to ensure
compatibility with all supported versions.

See netlify/blobs#183.

I believe @netlify/blobs@8 will error in local dev when using
netlify-cli before 17.21.1. This doesn't seem like unstorage's problem
though, so I didn't do anything about that here.
  • Loading branch information
serhalp committed Sep 15, 2024
commit dda35d57a28f66f96a0482b61aafeec4f90398aa
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@azure/storage-blob": "^12.24.0",
"@capacitor/preferences": "^6.0.2",
"@cloudflare/workers-types": "^4.20240903.0",
"@netlify/blobs": "^7.4.0",
"@netlify/blobs": "^8.0.1",
"@planetscale/database": "^1.19.0",
"@types/ioredis-mock": "^8.2.5",
"@types/jsdom": "^21.1.7",
Expand Down Expand Up @@ -105,7 +105,7 @@
"@azure/keyvault-secrets": "^4.8.0",
"@azure/storage-blob": "^12.24.0",
"@capacitor/preferences": "^6.0.2",
"@netlify/blobs": "^6.5.0 || ^7.0.0",
"@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.0.0",
"@planetscale/database": "^1.19.0",
"@upstash/redis": "^1.34.0",
"@vercel/kv": "^1.0.1",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/drivers/netlify-blobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ export interface NetlifyDeployStoreOptions extends NetlifyBaseStoreOptions {
deployID?: string;
}

export interface NetlifyDeployStoreV8Options extends NetlifyDeployStoreOptions {
// TODO(serhalp) Export this type from @netlify/blobs instead
region?: "us-east-1" | "us-east-2";
}

export interface NetlifyNamedStoreOptions extends NetlifyBaseStoreOptions {
name: string;
deployScoped?: false;
}

export type NetlifyStoreOptions =
| NetlifyDeployStoreOptions
| NetlifyDeployStoreV8Options
| NetlifyNamedStoreOptions;

export default defineDriver((options: NetlifyStoreOptions) => {
Expand Down
2 changes: 2 additions & 0 deletions test/drivers/netlify-blobs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ describe("drivers: netlify-blobs", async () => {
token,
siteID,
deployID: "test",
// Usually defaulted via the environment; only required in a test environment like this
region: "us-east-1",
}),
});

Expand Down
0