cf-workers-query
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -0,1 +1,12 @@ | ||
## 0.2.0 (2024-07-23) | ||
### 🚀 Features | ||
- **create-query:** throw on error ([205a60b](https://github.com/anymaniax/cf-workers-query/commit/205a60b)) | ||
### ❤️ Thank You | ||
- Victor Bury | ||
## 0.1.0 (2024-07-23) | ||
@@ -2,0 +13,0 @@ |
@@ -32,3 +32,10 @@ { | ||
} | ||
] | ||
], | ||
"release": { | ||
"changelog": { | ||
"workspaceChangelog": { | ||
"createRelease": "github" | ||
} | ||
} | ||
} | ||
} |
{ | ||
"name": "cf-workers-query", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Automatically cache and revalidate data in Cloudflare Workers. Using the Cache API and Execution Context", |
@@ -19,2 +19,3 @@ import { getCFExecutionContext } from './context'; | ||
cacheName?: string; | ||
throwOnError?: boolean; | ||
}; | ||
@@ -32,2 +33,3 @@ | ||
cacheName, | ||
throwOnError, | ||
}: CreateQuery<Data, Error>): Promise<{ | ||
@@ -88,2 +90,3 @@ data: Data | null; | ||
retryDelay, | ||
throwOnError, | ||
}); | ||
@@ -99,2 +102,6 @@ | ||
} catch (e) { | ||
if (throwOnError) { | ||
throw e; | ||
} | ||
return { data: null, error: e as Error, invalidate: () => undefined }; | ||
@@ -127,2 +134,3 @@ } | ||
retryDelay, | ||
throwOnError, | ||
}: { | ||
@@ -133,2 +141,3 @@ queryFn: () => Promise<Data>; | ||
retryDelay?: RetryDelay<Error>; | ||
throwOnError?: boolean; | ||
}): Promise<{ data: Data | null; error: Error | null }> => { | ||
@@ -158,4 +167,8 @@ try { | ||
if (throwOnError) { | ||
throw e; | ||
} | ||
return { data: null, error: e as Error }; | ||
} | ||
}; |
303781
417