@serwist/strategies
Advanced tools
Comparing version 9.0.0-preview.3 to 9.0.0-preview.4
import { Strategy } from "./Strategy.js"; | ||
import type { StrategyHandler } from "./StrategyHandler.js"; | ||
/** | ||
* An implementation of a [cache first](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#cache-first-falling-back-to-network) | ||
* An implementation of the [cache first](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#cache-first-falling-back-to-network) | ||
* request strategy. | ||
@@ -14,3 +14,3 @@ * | ||
*/ | ||
declare class CacheFirst extends Strategy { | ||
export declare class CacheFirst extends Strategy { | ||
/** | ||
@@ -24,3 +24,2 @@ * @private | ||
} | ||
export { CacheFirst }; | ||
//# sourceMappingURL=CacheFirst.d.ts.map |
import { Strategy } from "./Strategy.js"; | ||
import type { StrategyHandler } from "./StrategyHandler.js"; | ||
/** | ||
* An implementation of a [cache only](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#cache-only) | ||
* An implementation of the [cache only](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#cache-only) | ||
* request strategy. | ||
@@ -11,3 +11,3 @@ * | ||
*/ | ||
declare class CacheOnly extends Strategy { | ||
export declare class CacheOnly extends Strategy { | ||
/** | ||
@@ -21,3 +21,2 @@ * @private | ||
} | ||
export { CacheOnly }; | ||
//# sourceMappingURL=CacheOnly.d.ts.map |
@@ -10,17 +10,16 @@ import type { StrategyOptions } from "./Strategy.js"; | ||
} | ||
/** | ||
* An implementation of a [network first](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#network-first-falling-back-to-cache) | ||
* request strategy. | ||
* | ||
* By default, this strategy will cache responses with a 200 status code as | ||
* well as [opaque responses](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses). | ||
* Opaque responses are are cross-origin requests where the response doesn't | ||
* support [CORS](https://enable-cors.org/). | ||
* | ||
* If the network request fails, and there is no cache match, this will throw | ||
* a `SerwistError` exception. | ||
*/ | ||
export declare class NetworkFirst extends Strategy { | ||
private readonly _networkTimeoutSeconds; | ||
/** | ||
* An implementation of the [network first](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#network-first-falling-back-to-cache) | ||
* request strategy. | ||
* | ||
* By default, this strategy will cache responses with a 200 status code as | ||
* well as [opaque responses](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses). | ||
* Opaque responses are are cross-origin requests where the response doesn't | ||
* support [CORS](https://enable-cors.org/). | ||
* | ||
* If the network request fails, and there is no cache match, this will throw | ||
* a `SerwistError` exception. | ||
* | ||
* @param options | ||
@@ -27,0 +26,0 @@ * This option can be used to combat |
import type { StrategyOptions } from "./Strategy.js"; | ||
import { Strategy } from "./Strategy.js"; | ||
import type { StrategyHandler } from "./StrategyHandler.js"; | ||
interface NetworkOnlyOptions extends Omit<StrategyOptions, "cacheName" | "matchOptions"> { | ||
export interface NetworkOnlyOptions extends Omit<StrategyOptions, "cacheName" | "matchOptions"> { | ||
/** | ||
@@ -10,13 +10,12 @@ * If set, any network requests that fail to respond within the timeout will result in a network error. | ||
} | ||
/** | ||
* An implementation of a [network only](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#network-only) | ||
* request strategy. | ||
* | ||
* This class is useful if you want to take advantage of any Serwist plugin. | ||
* | ||
* If the network request fails, this will throw a `SerwistError` exception. | ||
*/ | ||
declare class NetworkOnly extends Strategy { | ||
export declare class NetworkOnly extends Strategy { | ||
private readonly _networkTimeoutSeconds; | ||
/** | ||
* An implementation of the [network only](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#network-only) | ||
* request strategy. | ||
* | ||
* This class is useful if you want to take advantage of any Serwist plugin. | ||
* | ||
* If the network request fails, this will throw a `SerwistError` exception. | ||
* | ||
* @param options | ||
@@ -33,4 +32,2 @@ */ | ||
} | ||
export { NetworkOnly }; | ||
export type { NetworkOnlyOptions }; | ||
//# sourceMappingURL=NetworkOnly.d.ts.map |
import type { StrategyOptions } from "./Strategy.js"; | ||
import { Strategy } from "./Strategy.js"; | ||
import type { StrategyHandler } from "./StrategyHandler.js"; | ||
/** | ||
* An implementation of a | ||
* [stale-while-revalidate](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#stale-while-revalidate) | ||
* request strategy. | ||
* | ||
* Resources are requested from both the cache and the network in parallel. | ||
* The strategy will respond with the cached version if available, otherwise | ||
* wait for the network response. The cache is updated with the network response | ||
* with each successful request. | ||
* | ||
* By default, this strategy will cache responses with a 200 status code as | ||
* well as [opaque responses](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses). | ||
* Opaque responses are cross-origin requests where the response doesn't | ||
* support [CORS](https://enable-cors.org/). | ||
* | ||
* If the network request fails, and there is no cache match, this will throw | ||
* a `SerwistError` exception. | ||
*/ | ||
declare class StaleWhileRevalidate extends Strategy { | ||
/** | ||
* An implementation of the | ||
* [stale-while-revalidate](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#stale-while-revalidate) | ||
* request strategy. | ||
* | ||
* Resources are requested from both the cache and the network in parallel. | ||
* The strategy will respond with the cached version if available, otherwise | ||
* wait for the network response. The cache is updated with the network response | ||
* with each successful request. | ||
* | ||
* By default, this strategy will cache responses with a 200 status code as | ||
* well as [opaque responses](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses). | ||
* Opaque responses are cross-origin requests where the response doesn't | ||
* support [CORS](https://enable-cors.org/). | ||
* | ||
* If the network request fails, and there is no cache match, this will throw | ||
* a `SerwistError` exception. | ||
* | ||
* @param options | ||
@@ -25,0 +24,0 @@ */ |
{ | ||
"name": "@serwist/strategies", | ||
"version": "9.0.0-preview.3", | ||
"version": "9.0.0-preview.4", | ||
"type": "module", | ||
@@ -33,3 +33,3 @@ "description": "A service worker helper library implementing common caching strategies.", | ||
"dependencies": { | ||
"@serwist/core": "9.0.0-preview.3" | ||
"@serwist/core": "9.0.0-preview.4" | ||
}, | ||
@@ -39,3 +39,3 @@ "devDependencies": { | ||
"typescript": "5.4.0-dev.20240206", | ||
"@serwist/constants": "9.0.0-preview.3" | ||
"@serwist/constants": "9.0.0-preview.4" | ||
}, | ||
@@ -42,0 +42,0 @@ "peerDependencies": { |
@@ -16,3 +16,3 @@ /* | ||
/** | ||
* An implementation of a [cache first](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#cache-first-falling-back-to-network) | ||
* An implementation of the [cache first](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#cache-first-falling-back-to-network) | ||
* request strategy. | ||
@@ -27,3 +27,3 @@ * | ||
*/ | ||
class CacheFirst extends Strategy { | ||
export class CacheFirst extends Strategy { | ||
/** | ||
@@ -90,3 +90,1 @@ * @private | ||
} | ||
export { CacheFirst }; |
@@ -16,3 +16,3 @@ /* | ||
/** | ||
* An implementation of a [cache only](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#cache-only) | ||
* An implementation of the [cache only](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#cache-only) | ||
* request strategy. | ||
@@ -24,3 +24,3 @@ * | ||
*/ | ||
class CacheOnly extends Strategy { | ||
export class CacheOnly extends Strategy { | ||
/** | ||
@@ -61,3 +61,1 @@ * @private | ||
} | ||
export { CacheOnly }; |
@@ -24,14 +24,2 @@ /* | ||
/** | ||
* An implementation of a [network first](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#network-first-falling-back-to-cache) | ||
* request strategy. | ||
* | ||
* By default, this strategy will cache responses with a 200 status code as | ||
* well as [opaque responses](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses). | ||
* Opaque responses are are cross-origin requests where the response doesn't | ||
* support [CORS](https://enable-cors.org/). | ||
* | ||
* If the network request fails, and there is no cache match, this will throw | ||
* a `SerwistError` exception. | ||
*/ | ||
export class NetworkFirst extends Strategy { | ||
@@ -41,2 +29,13 @@ private readonly _networkTimeoutSeconds: number; | ||
/** | ||
* An implementation of the [network first](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#network-first-falling-back-to-cache) | ||
* request strategy. | ||
* | ||
* By default, this strategy will cache responses with a 200 status code as | ||
* well as [opaque responses](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses). | ||
* Opaque responses are are cross-origin requests where the response doesn't | ||
* support [CORS](https://enable-cors.org/). | ||
* | ||
* If the network request fails, and there is no cache match, this will throw | ||
* a `SerwistError` exception. | ||
* | ||
* @param options | ||
@@ -43,0 +42,0 @@ * This option can be used to combat |
@@ -16,3 +16,3 @@ /* | ||
interface NetworkOnlyOptions extends Omit<StrategyOptions, "cacheName" | "matchOptions"> { | ||
export interface NetworkOnlyOptions extends Omit<StrategyOptions, "cacheName" | "matchOptions"> { | ||
/** | ||
@@ -24,14 +24,13 @@ * If set, any network requests that fail to respond within the timeout will result in a network error. | ||
/** | ||
* An implementation of a [network only](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#network-only) | ||
* request strategy. | ||
* | ||
* This class is useful if you want to take advantage of any Serwist plugin. | ||
* | ||
* If the network request fails, this will throw a `SerwistError` exception. | ||
*/ | ||
class NetworkOnly extends Strategy { | ||
export class NetworkOnly extends Strategy { | ||
private readonly _networkTimeoutSeconds: number; | ||
/** | ||
* An implementation of the [network only](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#network-only) | ||
* request strategy. | ||
* | ||
* This class is useful if you want to take advantage of any Serwist plugin. | ||
* | ||
* If the network request fails, this will throw a `SerwistError` exception. | ||
* | ||
* @param options | ||
@@ -99,4 +98,1 @@ */ | ||
} | ||
export { NetworkOnly }; | ||
export type { NetworkOnlyOptions }; |
@@ -17,22 +17,21 @@ /* | ||
/** | ||
* An implementation of a | ||
* [stale-while-revalidate](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#stale-while-revalidate) | ||
* request strategy. | ||
* | ||
* Resources are requested from both the cache and the network in parallel. | ||
* The strategy will respond with the cached version if available, otherwise | ||
* wait for the network response. The cache is updated with the network response | ||
* with each successful request. | ||
* | ||
* By default, this strategy will cache responses with a 200 status code as | ||
* well as [opaque responses](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses). | ||
* Opaque responses are cross-origin requests where the response doesn't | ||
* support [CORS](https://enable-cors.org/). | ||
* | ||
* If the network request fails, and there is no cache match, this will throw | ||
* a `SerwistError` exception. | ||
*/ | ||
class StaleWhileRevalidate extends Strategy { | ||
/** | ||
* An implementation of the | ||
* [stale-while-revalidate](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#stale-while-revalidate) | ||
* request strategy. | ||
* | ||
* Resources are requested from both the cache and the network in parallel. | ||
* The strategy will respond with the cached version if available, otherwise | ||
* wait for the network response. The cache is updated with the network response | ||
* with each successful request. | ||
* | ||
* By default, this strategy will cache responses with a 200 status code as | ||
* well as [opaque responses](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses). | ||
* Opaque responses are cross-origin requests where the response doesn't | ||
* support [CORS](https://enable-cors.org/). | ||
* | ||
* If the network request fails, and there is no cache match, this will throw | ||
* a `SerwistError` exception. | ||
* | ||
* @param options | ||
@@ -39,0 +38,0 @@ */ |
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
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
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
103126
2417
+ Added@serwist/core@9.0.0-preview.4(transitive)
- Removed@serwist/core@9.0.0-preview.3(transitive)