@vercel/edge-config
Advanced tools
Comparing version 1.2.1 to 1.3.0-133ee006-20240813114930
@@ -6,3 +6,3 @@ // src/index.ts | ||
var name = "@vercel/edge-config"; | ||
var version = "1.2.1"; | ||
var version = "1.3.0-133ee006-20240813114930"; | ||
@@ -327,4 +327,5 @@ // src/utils/tracing.ts | ||
return trace( | ||
() => { | ||
if (!shouldUseDevelopmentCache) return Promise.resolve(null); | ||
(localOptions) => { | ||
if ((localOptions == null ? void 0 : localOptions.consistentRead) || !shouldUseDevelopmentCache) | ||
return Promise.resolve(null); | ||
if (!latestRequest) { | ||
@@ -373,3 +374,7 @@ latestRequest = fetchWithCachedResponse( | ||
} | ||
async function getLocalEdgeConfig(connection) { | ||
function addConsistentReadHeader(headers) { | ||
headers.set("x-edge-config-min-updated-at", `${Number.MAX_SAFE_INTEGER}`); | ||
} | ||
async function getLocalEdgeConfig(connection, options) { | ||
if (options == null ? void 0 : options.consistentRead) return null; | ||
const edgeConfig = await getPrivateEdgeConfig(connection) || await getFileSystemEdgeConfig(connection); | ||
@@ -415,4 +420,4 @@ return edgeConfig; | ||
get: trace( | ||
async function get2(key) { | ||
const localEdgeConfig = await getInMemoryEdgeConfig() || await getLocalEdgeConfig(connection); | ||
async function get2(key, localOptions) { | ||
const localEdgeConfig = await getInMemoryEdgeConfig(localOptions) || await getLocalEdgeConfig(connection, localOptions); | ||
assertIsKey(key); | ||
@@ -423,6 +428,9 @@ if (isEmptyKey(key)) return void 0; | ||
} | ||
const localHeaders = new Headers(headers); | ||
if (localOptions == null ? void 0 : localOptions.consistentRead) | ||
addConsistentReadHeader(localHeaders); | ||
return fetchWithCachedResponse( | ||
`${baseUrl}/item/${key}?version=${version2}`, | ||
{ | ||
headers: new Headers(headers), | ||
headers: localHeaders, | ||
cache: fetchCache | ||
@@ -446,4 +454,4 @@ } | ||
has: trace( | ||
async function has2(key) { | ||
const localEdgeConfig = await getInMemoryEdgeConfig() || await getLocalEdgeConfig(connection); | ||
async function has2(key, localOptions) { | ||
const localEdgeConfig = await getInMemoryEdgeConfig(localOptions) || await getLocalEdgeConfig(connection, localOptions); | ||
assertIsKey(key); | ||
@@ -454,5 +462,8 @@ if (isEmptyKey(key)) return false; | ||
} | ||
const localHeaders = new Headers(headers); | ||
if (localOptions == null ? void 0 : localOptions.consistentRead) | ||
addConsistentReadHeader(localHeaders); | ||
return fetch(`${baseUrl}/item/${key}?version=${version2}`, { | ||
method: "HEAD", | ||
headers: new Headers(headers), | ||
headers: localHeaders, | ||
cache: fetchCache | ||
@@ -472,4 +483,4 @@ }).then((res) => { | ||
getAll: trace( | ||
async function getAll2(keys) { | ||
const localEdgeConfig = await getInMemoryEdgeConfig() || await getLocalEdgeConfig(connection); | ||
async function getAll2(keys, localOptions) { | ||
const localEdgeConfig = await getInMemoryEdgeConfig(localOptions) || await getLocalEdgeConfig(connection, localOptions); | ||
if (localEdgeConfig) { | ||
@@ -487,6 +498,9 @@ if (keys === void 0) { | ||
if (search === "") return Promise.resolve({}); | ||
const localHeaders = new Headers(headers); | ||
if (localOptions == null ? void 0 : localOptions.consistentRead) | ||
addConsistentReadHeader(localHeaders); | ||
return fetchWithCachedResponse( | ||
`${baseUrl}/items?version=${version2}${search === null ? "" : `&${search}`}`, | ||
{ | ||
headers: new Headers(headers), | ||
headers: localHeaders, | ||
cache: fetchCache | ||
@@ -508,11 +522,14 @@ } | ||
digest: trace( | ||
async function digest2() { | ||
const localEdgeConfig = await getInMemoryEdgeConfig() || await getLocalEdgeConfig(connection); | ||
async function digest2(localOptions) { | ||
const localEdgeConfig = await getInMemoryEdgeConfig(localOptions) || await getLocalEdgeConfig(connection, localOptions); | ||
if (localEdgeConfig) { | ||
return Promise.resolve(localEdgeConfig.digest); | ||
} | ||
const localHeaders = new Headers(headers); | ||
if (localOptions == null ? void 0 : localOptions.consistentRead) | ||
addConsistentReadHeader(localHeaders); | ||
return fetchWithCachedResponse( | ||
`${baseUrl}/digest?version=${version2}`, | ||
{ | ||
headers: new Headers(headers), | ||
headers: localHeaders, | ||
cache: fetchCache | ||
@@ -519,0 +536,0 @@ } |
{ | ||
"name": "@vercel/edge-config", | ||
"version": "1.2.1", | ||
"version": "1.3.0-133ee006-20240813114930", | ||
"description": "Ultra-low latency data at the edge", | ||
@@ -5,0 +5,0 @@ "homepage": "https://vercel.com", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
173855
1308
1