New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cf-workers-query

Package Overview
Dependencies
Maintainers
0
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cf-workers-query - npm Package Compare versions

Comparing version

to
0.5.4

22

CHANGELOG.md

@@ -0,1 +1,23 @@

## 0.5.4 (2024-09-02)
### 🩹 Fixes
- **cache-api:** use cache function everywhere ([42d5881](https://github.com/anymaniax/cf-workers-query/commit/42d5881))
### ❤️ Thank You
- Victor Bury
## 0.5.3 (2024-09-02)
### 🩹 Fixes
- **cache-api:** properly handle no caches api ([f49d13b](https://github.com/anymaniax/cf-workers-query/commit/f49d13b))
### ❤️ Thank You
- Victor Bury
## 0.5.2 (2024-09-02)

@@ -2,0 +24,0 @@

2

package.json
{
"name": "cf-workers-query",
"version": "0.5.2",
"version": "0.5.4",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Automatically cache and revalidate data in Cloudflare Workers. Using the Cache API and Execution Context",

@@ -5,14 +5,7 @@ export const CACHE_URL = 'INTERNAL_CF_WORKERS_QUERY_CACHE_HOSTNAME.local';

return {
open: async (cacheName) => {
return {
put: async (key, value) => {
return;
},
match: async (key) => {
return null;
},
delete: async (key) => {
return;
},
};
put: async (key, value) => {
return;
},
match: async (key) => {
return undefined;
}

@@ -37,3 +30,3 @@ };

const { raw = false } = options ?? {};
const cache = await caches.open(this.cacheName);
const cache = await getCache(this.cacheName);
const cacheKey = key instanceof URL ? key : this.buildCacheKey(key);

@@ -53,3 +46,3 @@ const response = await cache.match(cacheKey);

lastModified,
maxAge: !isNaN(maxAge) ? maxAge : 0,
maxAge: !isNaN(maxAge) ? maxAge : 0
};

@@ -62,3 +55,3 @@ }

async update(key, value, options) {
const cache = await caches.open(this.cacheName);
const cache = await getCache(this.cacheName);
const maxAge = options?.maxAge ?? this.maxAge;

@@ -75,3 +68,3 @@ const cacheKey = key instanceof URL ? key : this.buildCacheKey(key);

const response = new Response(JSON.stringify(value), {
headers,
headers
});

@@ -81,7 +74,7 @@ await cache.put(cacheKey, response);

async delete(key) {
const cache = await caches.open(this.cacheName);
const cache = await getCache(this.cacheName);
const response = new Response(null, {
headers: new Headers({
'cache-control': `max-age=0`,
}),
'cache-control': `max-age=0`
})
});

@@ -88,0 +81,0 @@ const cacheKey = key instanceof URL ? key : this.buildCacheKey(key);