@netlify/blobs
Advanced tools
Comparing version
@@ -73,2 +73,8 @@ declare global { | ||
declare const regions: { | ||
'us-east-1': boolean; | ||
'us-east-2': boolean; | ||
}; | ||
type Region = keyof typeof regions; | ||
interface BaseStoreOptions { | ||
@@ -189,7 +195,6 @@ client: Client; | ||
type ExperimentalRegion = 'auto' | 'context'; | ||
interface GetDeployStoreOptions extends Partial<ClientOptions> { | ||
deployID?: string; | ||
name?: string; | ||
experimentalRegion?: ExperimentalRegion; | ||
region?: Region; | ||
} | ||
@@ -196,0 +201,0 @@ /** |
@@ -5,2 +5,3 @@ import { | ||
MissingBlobsEnvironmentError, | ||
REGION_AUTO, | ||
base64Decode, | ||
@@ -12,3 +13,3 @@ collectIterator, | ||
setEnvironmentContext | ||
} from "./chunk-SGXOM2EY.js"; | ||
} from "./chunk-GUEW34CP.js"; | ||
@@ -281,16 +282,13 @@ // src/lambda_compat.ts | ||
const clientOptions = getClientOptions(options, context); | ||
if (options.experimentalRegion === "context") { | ||
if (!context.primaryRegion) { | ||
throw new Error( | ||
'The Netlify Blobs client was initialized with `experimentalRegion: "context"` but there is no region configured in the environment' | ||
); | ||
if (!clientOptions.region) { | ||
if (clientOptions.edgeURL || clientOptions.uncachedEdgeURL) { | ||
if (!context.primaryRegion) { | ||
throw new Error( | ||
"When accessing a deploy store, the Netlify Blobs client needs to be configured with a region, and one was not found in the environment. To manually set the region, set the `region` property in the `getDeployStore` options." | ||
); | ||
} | ||
clientOptions.region = context.primaryRegion; | ||
} else { | ||
clientOptions.region = REGION_AUTO; | ||
} | ||
clientOptions.region = context.primaryRegion; | ||
} else if (options.experimentalRegion === "auto") { | ||
if (clientOptions.edgeURL) { | ||
throw new Error( | ||
'The Netlify Blobs client was initialized with `experimentalRegion: "auto"` which is not compatible with the `edgeURL` property; consider using `apiURL` instead' | ||
); | ||
} | ||
clientOptions.region = options.experimentalRegion; | ||
} | ||
@@ -297,0 +295,0 @@ const client = new Client(clientOptions); |
@@ -7,3 +7,3 @@ import { | ||
isNodeError | ||
} from "./chunk-SGXOM2EY.js"; | ||
} from "./chunk-GUEW34CP.js"; | ||
@@ -10,0 +10,0 @@ // src/server.ts |
{ | ||
"name": "@netlify/blobs", | ||
"version": "7.4.0", | ||
"version": "8.0.0", | ||
"description": "A JavaScript client for the Netlify Blob Store", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
114968
0.85%2619
1.39%