serwist 9.5.7 → 9.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/Route-wAAof_Tq.d.ts +36 -0
- package/dist/chunks/Route-wAAof_Tq.d.ts.map +1 -0
- package/dist/chunks/cacheNames-DZwJpopB.d.ts +35 -0
- package/dist/chunks/cacheNames-DZwJpopB.d.ts.map +1 -0
- package/dist/chunks/index.internal-Dxj9Ni9X.js +65 -0
- package/dist/chunks/index.internal-Dxj9Ni9X.js.map +1 -0
- package/dist/chunks/printInstallDetails-c9A08ZVZ.js +2026 -0
- package/dist/chunks/printInstallDetails-c9A08ZVZ.js.map +1 -0
- package/dist/chunks/types-CKER0KBv.d.ts +786 -0
- package/dist/chunks/types-CKER0KBv.d.ts.map +1 -0
- package/dist/chunks/waitUntil-BHDx3Rgo.js +486 -0
- package/dist/chunks/waitUntil-BHDx3Rgo.js.map +1 -0
- package/dist/index.d.mts +1525 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.internal.d.mts +337 -0
- package/dist/index.internal.d.mts.map +1 -0
- package/dist/index.internal.mjs +3 -0
- package/dist/index.legacy.d.mts +892 -0
- package/dist/index.legacy.d.mts.map +1 -0
- package/dist/index.legacy.mjs +1162 -0
- package/dist/index.legacy.mjs.map +1 -0
- package/dist/index.mjs +1847 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +16 -17
- package/dist/NavigationRoute.d.ts +0 -56
- package/dist/NavigationRoute.d.ts.map +0 -1
- package/dist/PrecacheRoute.d.ts +0 -16
- package/dist/PrecacheRoute.d.ts.map +0 -1
- package/dist/RegExpRoute.d.ts +0 -24
- package/dist/RegExpRoute.d.ts.map +0 -1
- package/dist/Route.d.ts +0 -33
- package/dist/Route.d.ts.map +0 -1
- package/dist/Serwist.d.ts +0 -299
- package/dist/Serwist.d.ts.map +0 -1
- package/dist/cacheNames.d.ts +0 -20
- package/dist/cacheNames.d.ts.map +0 -1
- package/dist/chunks/printInstallDetails.js +0 -1575
- package/dist/chunks/resultingClientExists.js +0 -32
- package/dist/chunks/waitUntil.js +0 -449
- package/dist/constants.d.ts +0 -15
- package/dist/constants.d.ts.map +0 -1
- package/dist/copyResponse.d.ts +0 -18
- package/dist/copyResponse.d.ts.map +0 -1
- package/dist/disableDevLogs.d.ts +0 -7
- package/dist/disableDevLogs.d.ts.map +0 -1
- package/dist/index.d.ts +0 -50
- package/dist/index.d.ts.map +0 -1
- package/dist/index.internal.d.ts +0 -18
- package/dist/index.internal.d.ts.map +0 -1
- package/dist/index.internal.js +0 -23
- package/dist/index.js +0 -1533
- package/dist/index.legacy.d.ts +0 -28
- package/dist/index.legacy.d.ts.map +0 -1
- package/dist/index.legacy.js +0 -790
- package/dist/legacy/PrecacheController.d.ts +0 -145
- package/dist/legacy/PrecacheController.d.ts.map +0 -1
- package/dist/legacy/PrecacheFallbackPlugin.d.ts +0 -61
- package/dist/legacy/PrecacheFallbackPlugin.d.ts.map +0 -1
- package/dist/legacy/PrecacheRoute.d.ts +0 -19
- package/dist/legacy/PrecacheRoute.d.ts.map +0 -1
- package/dist/legacy/Router.d.ts +0 -151
- package/dist/legacy/Router.d.ts.map +0 -1
- package/dist/legacy/addPlugins.d.ts +0 -9
- package/dist/legacy/addPlugins.d.ts.map +0 -1
- package/dist/legacy/addRoute.d.ts +0 -14
- package/dist/legacy/addRoute.d.ts.map +0 -1
- package/dist/legacy/constants.d.ts +0 -10
- package/dist/legacy/constants.d.ts.map +0 -1
- package/dist/legacy/createHandlerBoundToURL.d.ts +0 -17
- package/dist/legacy/createHandlerBoundToURL.d.ts.map +0 -1
- package/dist/legacy/fallbacks.d.ts +0 -59
- package/dist/legacy/fallbacks.d.ts.map +0 -1
- package/dist/legacy/getCacheKeyForURL.d.ts +0 -20
- package/dist/legacy/getCacheKeyForURL.d.ts.map +0 -1
- package/dist/legacy/handlePrecaching.d.ts +0 -54
- package/dist/legacy/handlePrecaching.d.ts.map +0 -1
- package/dist/legacy/initializeGoogleAnalytics.d.ts +0 -38
- package/dist/legacy/initializeGoogleAnalytics.d.ts.map +0 -1
- package/dist/legacy/installSerwist.d.ts +0 -81
- package/dist/legacy/installSerwist.d.ts.map +0 -1
- package/dist/legacy/matchPrecache.d.ts +0 -15
- package/dist/legacy/matchPrecache.d.ts.map +0 -1
- package/dist/legacy/precache.d.ts +0 -20
- package/dist/legacy/precache.d.ts.map +0 -1
- package/dist/legacy/precacheAndRoute.d.ts +0 -14
- package/dist/legacy/precacheAndRoute.d.ts.map +0 -1
- package/dist/legacy/registerRoute.d.ts +0 -16
- package/dist/legacy/registerRoute.d.ts.map +0 -1
- package/dist/legacy/registerRuntimeCaching.d.ts +0 -11
- package/dist/legacy/registerRuntimeCaching.d.ts.map +0 -1
- package/dist/legacy/setCatchHandler.d.ts +0 -10
- package/dist/legacy/setCatchHandler.d.ts.map +0 -1
- package/dist/legacy/setDefaultHandler.d.ts +0 -13
- package/dist/legacy/setDefaultHandler.d.ts.map +0 -1
- package/dist/legacy/singletonPrecacheController.d.ts +0 -34
- package/dist/legacy/singletonPrecacheController.d.ts.map +0 -1
- package/dist/legacy/singletonRouter.d.ts +0 -41
- package/dist/legacy/singletonRouter.d.ts.map +0 -1
- package/dist/legacy/unregisterRoute.d.ts +0 -9
- package/dist/legacy/unregisterRoute.d.ts.map +0 -1
- package/dist/legacy/utils/PrecacheCacheKeyPlugin.d.ts +0 -16
- package/dist/legacy/utils/PrecacheCacheKeyPlugin.d.ts.map +0 -1
- package/dist/legacy/utils/getCacheKeyForURL.d.ts +0 -14
- package/dist/legacy/utils/getCacheKeyForURL.d.ts.map +0 -1
- package/dist/lib/backgroundSync/BackgroundSyncPlugin.d.ts +0 -23
- package/dist/lib/backgroundSync/BackgroundSyncPlugin.d.ts.map +0 -1
- package/dist/lib/backgroundSync/BackgroundSyncQueue.d.ts +0 -182
- package/dist/lib/backgroundSync/BackgroundSyncQueue.d.ts.map +0 -1
- package/dist/lib/backgroundSync/BackgroundSyncQueueDb.d.ts +0 -90
- package/dist/lib/backgroundSync/BackgroundSyncQueueDb.d.ts.map +0 -1
- package/dist/lib/backgroundSync/BackgroundSyncQueueStore.d.ts +0 -75
- package/dist/lib/backgroundSync/BackgroundSyncQueueStore.d.ts.map +0 -1
- package/dist/lib/backgroundSync/StorableRequest.d.ts +0 -51
- package/dist/lib/backgroundSync/StorableRequest.d.ts.map +0 -1
- package/dist/lib/broadcastUpdate/BroadcastCacheUpdate.d.ts +0 -44
- package/dist/lib/broadcastUpdate/BroadcastCacheUpdate.d.ts.map +0 -1
- package/dist/lib/broadcastUpdate/BroadcastUpdatePlugin.d.ts +0 -24
- package/dist/lib/broadcastUpdate/BroadcastUpdatePlugin.d.ts.map +0 -1
- package/dist/lib/broadcastUpdate/constants.d.ts +0 -5
- package/dist/lib/broadcastUpdate/constants.d.ts.map +0 -1
- package/dist/lib/broadcastUpdate/responsesAreSame.d.ts +0 -11
- package/dist/lib/broadcastUpdate/responsesAreSame.d.ts.map +0 -1
- package/dist/lib/broadcastUpdate/types.d.ts +0 -35
- package/dist/lib/broadcastUpdate/types.d.ts.map +0 -1
- package/dist/lib/cacheableResponse/CacheableResponse.d.ts +0 -40
- package/dist/lib/cacheableResponse/CacheableResponse.d.ts.map +0 -1
- package/dist/lib/cacheableResponse/CacheableResponsePlugin.d.ts +0 -27
- package/dist/lib/cacheableResponse/CacheableResponsePlugin.d.ts.map +0 -1
- package/dist/lib/expiration/CacheExpiration.d.ts +0 -66
- package/dist/lib/expiration/CacheExpiration.d.ts.map +0 -1
- package/dist/lib/expiration/ExpirationPlugin.d.ts +0 -116
- package/dist/lib/expiration/ExpirationPlugin.d.ts.map +0 -1
- package/dist/lib/expiration/models/CacheTimestampsModel.d.ts +0 -73
- package/dist/lib/expiration/models/CacheTimestampsModel.d.ts.map +0 -1
- package/dist/lib/googleAnalytics/constants.d.ts +0 -10
- package/dist/lib/googleAnalytics/constants.d.ts.map +0 -1
- package/dist/lib/googleAnalytics/initializeGoogleAnalytics.d.ts +0 -30
- package/dist/lib/googleAnalytics/initializeGoogleAnalytics.d.ts.map +0 -1
- package/dist/lib/precaching/PrecacheFallbackPlugin.d.ts +0 -49
- package/dist/lib/precaching/PrecacheFallbackPlugin.d.ts.map +0 -1
- package/dist/lib/rangeRequests/RangeRequestsPlugin.d.ts +0 -18
- package/dist/lib/rangeRequests/RangeRequestsPlugin.d.ts.map +0 -1
- package/dist/lib/rangeRequests/createPartialResponse.d.ts +0 -18
- package/dist/lib/rangeRequests/createPartialResponse.d.ts.map +0 -1
- package/dist/lib/rangeRequests/utils/calculateEffectiveBoundaries.d.ts +0 -14
- package/dist/lib/rangeRequests/utils/calculateEffectiveBoundaries.d.ts.map +0 -1
- package/dist/lib/rangeRequests/utils/parseRangeHeader.d.ts +0 -12
- package/dist/lib/rangeRequests/utils/parseRangeHeader.d.ts.map +0 -1
- package/dist/lib/strategies/CacheFirst.d.ts +0 -23
- package/dist/lib/strategies/CacheFirst.d.ts.map +0 -1
- package/dist/lib/strategies/CacheOnly.d.ts +0 -20
- package/dist/lib/strategies/CacheOnly.d.ts.map +0 -1
- package/dist/lib/strategies/NetworkFirst.d.ts +0 -61
- package/dist/lib/strategies/NetworkFirst.d.ts.map +0 -1
- package/dist/lib/strategies/NetworkOnly.d.ts +0 -32
- package/dist/lib/strategies/NetworkOnly.d.ts.map +0 -1
- package/dist/lib/strategies/PrecacheStrategy.d.ts +0 -69
- package/dist/lib/strategies/PrecacheStrategy.d.ts.map +0 -1
- package/dist/lib/strategies/StaleWhileRevalidate.d.ts +0 -35
- package/dist/lib/strategies/StaleWhileRevalidate.d.ts.map +0 -1
- package/dist/lib/strategies/Strategy.d.ts +0 -81
- package/dist/lib/strategies/Strategy.d.ts.map +0 -1
- package/dist/lib/strategies/StrategyHandler.d.ts +0 -190
- package/dist/lib/strategies/StrategyHandler.d.ts.map +0 -1
- package/dist/lib/strategies/plugins/cacheOkAndOpaquePlugin.d.ts +0 -3
- package/dist/lib/strategies/plugins/cacheOkAndOpaquePlugin.d.ts.map +0 -1
- package/dist/lib/strategies/utils/messages.d.ts +0 -5
- package/dist/lib/strategies/utils/messages.d.ts.map +0 -1
- package/dist/models/messages/messageGenerator.d.ts +0 -4
- package/dist/models/messages/messageGenerator.d.ts.map +0 -1
- package/dist/models/messages/messages.d.ts +0 -44
- package/dist/models/messages/messages.d.ts.map +0 -1
- package/dist/models/pluginEvents.d.ts +0 -10
- package/dist/models/pluginEvents.d.ts.map +0 -1
- package/dist/models/quotaErrorCallbacks.d.ts +0 -3
- package/dist/models/quotaErrorCallbacks.d.ts.map +0 -1
- package/dist/navigationPreload.d.ts +0 -24
- package/dist/navigationPreload.d.ts.map +0 -1
- package/dist/registerQuotaErrorCallback.d.ts +0 -8
- package/dist/registerQuotaErrorCallback.d.ts.map +0 -1
- package/dist/setCacheNameDetails.d.ts +0 -9
- package/dist/setCacheNameDetails.d.ts.map +0 -1
- package/dist/types.d.ts +0 -445
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/Deferred.d.ts +0 -19
- package/dist/utils/Deferred.d.ts.map +0 -1
- package/dist/utils/PrecacheCacheKeyPlugin.d.ts +0 -16
- package/dist/utils/PrecacheCacheKeyPlugin.d.ts.map +0 -1
- package/dist/utils/PrecacheInstallReportPlugin.d.ts +0 -14
- package/dist/utils/PrecacheInstallReportPlugin.d.ts.map +0 -1
- package/dist/utils/SerwistError.d.ts +0 -24
- package/dist/utils/SerwistError.d.ts.map +0 -1
- package/dist/utils/assert.d.ts +0 -11
- package/dist/utils/assert.d.ts.map +0 -1
- package/dist/utils/cacheMatchIgnoreParams.d.ts +0 -15
- package/dist/utils/cacheMatchIgnoreParams.d.ts.map +0 -1
- package/dist/utils/cacheNames.d.ts +0 -40
- package/dist/utils/cacheNames.d.ts.map +0 -1
- package/dist/utils/canConstructReadableStream.d.ts +0 -12
- package/dist/utils/canConstructReadableStream.d.ts.map +0 -1
- package/dist/utils/canConstructResponseFromBodyStream.d.ts +0 -11
- package/dist/utils/canConstructResponseFromBodyStream.d.ts.map +0 -1
- package/dist/utils/cleanupOutdatedCaches.d.ts +0 -6
- package/dist/utils/cleanupOutdatedCaches.d.ts.map +0 -1
- package/dist/utils/clientsClaim.d.ts +0 -6
- package/dist/utils/clientsClaim.d.ts.map +0 -1
- package/dist/utils/createCacheKey.d.ts +0 -16
- package/dist/utils/createCacheKey.d.ts.map +0 -1
- package/dist/utils/deleteOutdatedCaches.d.ts +0 -18
- package/dist/utils/deleteOutdatedCaches.d.ts.map +0 -1
- package/dist/utils/dontWaitFor.d.ts +0 -7
- package/dist/utils/dontWaitFor.d.ts.map +0 -1
- package/dist/utils/executeQuotaErrorCallbacks.d.ts +0 -8
- package/dist/utils/executeQuotaErrorCallbacks.d.ts.map +0 -1
- package/dist/utils/generateURLVariations.d.ts +0 -12
- package/dist/utils/generateURLVariations.d.ts.map +0 -1
- package/dist/utils/getFriendlyURL.d.ts +0 -3
- package/dist/utils/getFriendlyURL.d.ts.map +0 -1
- package/dist/utils/logger.d.ts +0 -24
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/normalizeHandler.d.ts +0 -10
- package/dist/utils/normalizeHandler.d.ts.map +0 -1
- package/dist/utils/parsePrecacheOptions.d.ts +0 -26
- package/dist/utils/parsePrecacheOptions.d.ts.map +0 -1
- package/dist/utils/parseRoute.d.ts +0 -16
- package/dist/utils/parseRoute.d.ts.map +0 -1
- package/dist/utils/pluginUtils.d.ts +0 -5
- package/dist/utils/pluginUtils.d.ts.map +0 -1
- package/dist/utils/printCleanupDetails.d.ts +0 -6
- package/dist/utils/printCleanupDetails.d.ts.map +0 -1
- package/dist/utils/printInstallDetails.d.ts +0 -7
- package/dist/utils/printInstallDetails.d.ts.map +0 -1
- package/dist/utils/removeIgnoredSearchParams.d.ts +0 -12
- package/dist/utils/removeIgnoredSearchParams.d.ts.map +0 -1
- package/dist/utils/resultingClientExists.d.ts +0 -12
- package/dist/utils/resultingClientExists.d.ts.map +0 -1
- package/dist/utils/timeout.d.ts +0 -10
- package/dist/utils/timeout.d.ts.map +0 -1
- package/dist/utils/waitUntil.d.ts +0 -11
- package/dist/utils/waitUntil.d.ts.map +0 -1
- package/dist/utils/welcome.d.ts +0 -2
- package/dist/utils/welcome.d.ts.map +0 -1
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { RequestData } from "./StorableRequest.js";
|
|
2
|
-
export interface UnidentifiedQueueStoreEntry {
|
|
3
|
-
requestData: RequestData;
|
|
4
|
-
timestamp: number;
|
|
5
|
-
id?: number;
|
|
6
|
-
queueName?: string;
|
|
7
|
-
metadata?: Record<string, unknown>;
|
|
8
|
-
}
|
|
9
|
-
export interface BackgroundSyncQueueStoreEntry extends UnidentifiedQueueStoreEntry {
|
|
10
|
-
id: number;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* A class to interact directly an IndexedDB created specifically to save and
|
|
14
|
-
* retrieve QueueStoreEntries. This class encapsulates all the schema details
|
|
15
|
-
* to store the representation of a Queue.
|
|
16
|
-
*
|
|
17
|
-
* @private
|
|
18
|
-
*/
|
|
19
|
-
export declare class BackgroundSyncQueueDb {
|
|
20
|
-
private _db;
|
|
21
|
-
/**
|
|
22
|
-
* Add QueueStoreEntry to underlying db.
|
|
23
|
-
*
|
|
24
|
-
* @param entry
|
|
25
|
-
*/
|
|
26
|
-
addEntry(entry: UnidentifiedQueueStoreEntry): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Returns the first entry id in the ObjectStore.
|
|
29
|
-
*
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
getFirstEntryId(): Promise<number | undefined>;
|
|
33
|
-
/**
|
|
34
|
-
* Get all the entries filtered by index
|
|
35
|
-
*
|
|
36
|
-
* @param queueName
|
|
37
|
-
* @returns
|
|
38
|
-
*/
|
|
39
|
-
getAllEntriesByQueueName(queueName: string): Promise<BackgroundSyncQueueStoreEntry[]>;
|
|
40
|
-
/**
|
|
41
|
-
* Returns the number of entries filtered by index
|
|
42
|
-
*
|
|
43
|
-
* @param queueName
|
|
44
|
-
* @returns
|
|
45
|
-
*/
|
|
46
|
-
getEntryCountByQueueName(queueName: string): Promise<number>;
|
|
47
|
-
/**
|
|
48
|
-
* Deletes a single entry by id.
|
|
49
|
-
*
|
|
50
|
-
* @param id the id of the entry to be deleted
|
|
51
|
-
*/
|
|
52
|
-
deleteEntry(id: number): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
* @param queueName
|
|
56
|
-
* @returns
|
|
57
|
-
*/
|
|
58
|
-
getFirstEntryByQueueName(queueName: string): Promise<BackgroundSyncQueueStoreEntry | undefined>;
|
|
59
|
-
/**
|
|
60
|
-
*
|
|
61
|
-
* @param queueName
|
|
62
|
-
* @returns
|
|
63
|
-
*/
|
|
64
|
-
getLastEntryByQueueName(queueName: string): Promise<BackgroundSyncQueueStoreEntry | undefined>;
|
|
65
|
-
/**
|
|
66
|
-
* Returns either the first or the last entries, depending on direction.
|
|
67
|
-
* Filtered by index.
|
|
68
|
-
*
|
|
69
|
-
* @param direction
|
|
70
|
-
* @param query
|
|
71
|
-
* @returns
|
|
72
|
-
* @private
|
|
73
|
-
*/
|
|
74
|
-
getEndEntryFromIndex(query: IDBKeyRange, direction: IDBCursorDirection): Promise<BackgroundSyncQueueStoreEntry | undefined>;
|
|
75
|
-
/**
|
|
76
|
-
* Returns an open connection to the database.
|
|
77
|
-
*
|
|
78
|
-
* @private
|
|
79
|
-
*/
|
|
80
|
-
private getDb;
|
|
81
|
-
/**
|
|
82
|
-
* Upgrades QueueDB
|
|
83
|
-
*
|
|
84
|
-
* @param db
|
|
85
|
-
* @param oldVersion
|
|
86
|
-
* @private
|
|
87
|
-
*/
|
|
88
|
-
private _upgradeDb;
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=BackgroundSyncQueueDb.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BackgroundSyncQueueDb.d.ts","sourceRoot":"","sources":["../../../src/lib/backgroundSync/BackgroundSyncQueueDb.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAexD,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,6BAA8B,SAAQ,2BAA2B;IAChF,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;GAMG;AAEH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,GAAG,CAA0D;IAErE;;;;OAIG;IACG,QAAQ,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;IASjE;;;;OAIG;IACG,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAMpD;;;;;OAKG;IACG,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,6BAA6B,EAAE,CAAC;IAM3F;;;;;OAKG;IACG,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAKlE;;;;OAIG;IACG,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK5C;;;;OAIG;IACG,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,6BAA6B,GAAG,SAAS,CAAC;IAIrG;;;;OAIG;IACG,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,6BAA6B,GAAG,SAAS,CAAC;IAIpG;;;;;;;;OAQG;IACG,oBAAoB,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAAC,6BAA6B,GAAG,SAAS,CAAC;IAOjI;;;;OAIG;YACW,KAAK;IASnB;;;;;;OAMG;IACH,OAAO,CAAC,UAAU;CAanB"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type { BackgroundSyncQueueStoreEntry, UnidentifiedQueueStoreEntry } from "./BackgroundSyncQueueDb.js";
|
|
2
|
-
/**
|
|
3
|
-
* A class to manage storing requests from a Queue in IndexedDB,
|
|
4
|
-
* indexed by their queue name for easier access.
|
|
5
|
-
*
|
|
6
|
-
* Most developers will not need to access this class directly;
|
|
7
|
-
* it is exposed for advanced use cases.
|
|
8
|
-
*/
|
|
9
|
-
export declare class BackgroundSyncQueueStore {
|
|
10
|
-
private readonly _queueName;
|
|
11
|
-
private readonly _queueDb;
|
|
12
|
-
/**
|
|
13
|
-
* Associates this instance with a Queue instance, so entries added can be
|
|
14
|
-
* identified by their queue name.
|
|
15
|
-
*
|
|
16
|
-
* @param queueName
|
|
17
|
-
*/
|
|
18
|
-
constructor(queueName: string);
|
|
19
|
-
/**
|
|
20
|
-
* Append an entry last in the queue.
|
|
21
|
-
*
|
|
22
|
-
* @param entry
|
|
23
|
-
*/
|
|
24
|
-
pushEntry(entry: UnidentifiedQueueStoreEntry): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* Prepend an entry first in the queue.
|
|
27
|
-
*
|
|
28
|
-
* @param entry
|
|
29
|
-
*/
|
|
30
|
-
unshiftEntry(entry: UnidentifiedQueueStoreEntry): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Removes and returns the last entry in the queue matching the `queueName`.
|
|
33
|
-
*
|
|
34
|
-
* @returns
|
|
35
|
-
*/
|
|
36
|
-
popEntry(): Promise<BackgroundSyncQueueStoreEntry | undefined>;
|
|
37
|
-
/**
|
|
38
|
-
* Removes and returns the first entry in the queue matching the `queueName`.
|
|
39
|
-
*
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
|
-
shiftEntry(): Promise<BackgroundSyncQueueStoreEntry | undefined>;
|
|
43
|
-
/**
|
|
44
|
-
* Returns all entries in the store matching the `queueName`.
|
|
45
|
-
*
|
|
46
|
-
* @returns
|
|
47
|
-
*/
|
|
48
|
-
getAll(): Promise<BackgroundSyncQueueStoreEntry[]>;
|
|
49
|
-
/**
|
|
50
|
-
* Returns the number of entries in the store matching the `queueName`.
|
|
51
|
-
*
|
|
52
|
-
* @returns
|
|
53
|
-
*/
|
|
54
|
-
size(): Promise<number>;
|
|
55
|
-
/**
|
|
56
|
-
* Deletes the entry for the given ID.
|
|
57
|
-
*
|
|
58
|
-
* WARNING: this method does not ensure the deleted entry belongs to this
|
|
59
|
-
* queue (i.e. matches the `queueName`). But this limitation is acceptable
|
|
60
|
-
* as this class is not publicly exposed. An additional check would make
|
|
61
|
-
* this method slower than it needs to be.
|
|
62
|
-
*
|
|
63
|
-
* @param id
|
|
64
|
-
*/
|
|
65
|
-
deleteEntry(id: number): Promise<void>;
|
|
66
|
-
/**
|
|
67
|
-
* Removes and returns the first or last entry in the queue (based on the
|
|
68
|
-
* `direction` argument) matching the `queueName`.
|
|
69
|
-
*
|
|
70
|
-
* @returns
|
|
71
|
-
* @private
|
|
72
|
-
*/
|
|
73
|
-
_removeEntry(entry?: BackgroundSyncQueueStoreEntry): Promise<BackgroundSyncQueueStoreEntry | undefined>;
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=BackgroundSyncQueueStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BackgroundSyncQueueStore.d.ts","sourceRoot":"","sources":["../../../src/lib/backgroundSync/BackgroundSyncQueueStore.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,6BAA6B,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAG7G;;;;;;GAMG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwB;IAEjD;;;;;OAKG;gBACS,SAAS,EAAE,MAAM;IAK7B;;;;OAIG;IACG,SAAS,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBlE;;;;OAIG;IACG,YAAY,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BrE;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,6BAA6B,GAAG,SAAS,CAAC;IAIpE;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,6BAA6B,GAAG,SAAS,CAAC;IAItE;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,6BAA6B,EAAE,CAAC;IAIxD;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAI7B;;;;;;;;;OASG;IACG,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5C;;;;;;OAMG;IACG,YAAY,CAAC,KAAK,CAAC,EAAE,6BAA6B,GAAG,OAAO,CAAC,6BAA6B,GAAG,SAAS,CAAC;CAM9G"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { MapLikeObject } from "../../types.js";
|
|
2
|
-
export interface RequestData extends MapLikeObject {
|
|
3
|
-
url: string;
|
|
4
|
-
headers: MapLikeObject;
|
|
5
|
-
body?: ArrayBuffer;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* A class to make it easier to serialize and de-serialize requests so they
|
|
9
|
-
* can be stored in IndexedDB.
|
|
10
|
-
*
|
|
11
|
-
* Most developers will not need to access this class directly;
|
|
12
|
-
* it is exposed for advanced use cases.
|
|
13
|
-
*/
|
|
14
|
-
export declare class StorableRequest {
|
|
15
|
-
private readonly _requestData;
|
|
16
|
-
/**
|
|
17
|
-
* Converts a Request object to a plain object that can be structured
|
|
18
|
-
* cloned or stringified to JSON.
|
|
19
|
-
*
|
|
20
|
-
* @param request
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
23
|
-
static fromRequest(request: Request): Promise<StorableRequest>;
|
|
24
|
-
/**
|
|
25
|
-
* Accepts an object of request data that can be used to construct a
|
|
26
|
-
* `Request` object but can also be stored in IndexedDB.
|
|
27
|
-
*
|
|
28
|
-
* @param requestData An object of request data that includes the `url` plus any relevant property of
|
|
29
|
-
* [`requestInit`](https://fetch.spec.whatwg.org/#requestinit).
|
|
30
|
-
*/
|
|
31
|
-
constructor(requestData: RequestData);
|
|
32
|
-
/**
|
|
33
|
-
* Returns a deep clone of the instance's `requestData` object.
|
|
34
|
-
*
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
toObject(): RequestData;
|
|
38
|
-
/**
|
|
39
|
-
* Converts this instance to a Request.
|
|
40
|
-
*
|
|
41
|
-
* @returns
|
|
42
|
-
*/
|
|
43
|
-
toRequest(): Request;
|
|
44
|
-
/**
|
|
45
|
-
* Creates and returns a deep clone of the instance.
|
|
46
|
-
*
|
|
47
|
-
* @returns
|
|
48
|
-
*/
|
|
49
|
-
clone(): StorableRequest;
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=StorableRequest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StorableRequest.d.ts","sourceRoot":"","sources":["../../../src/lib/backgroundSync/StorableRequest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAiBpD,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,aAAa,CAAC;IACvB,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED;;;;;;GAMG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAE3C;;;;;;OAMG;WACU,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC;IA6BpE;;;;;;OAMG;gBACS,WAAW,EAAE,WAAW;IAyBpC;;;;OAIG;IACH,QAAQ,IAAI,WAAW;IAUvB;;;;OAIG;IACH,SAAS,IAAI,OAAO;IAIpB;;;;OAIG;IACH,KAAK,IAAI,eAAe;CAGzB"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { CacheDidUpdateCallbackParam } from "../../types.js";
|
|
2
|
-
import type { BroadcastCacheUpdateOptions } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* A class that uses the `postMessage()` API to inform any open windows/tabs when
|
|
5
|
-
* a cached response has been updated.
|
|
6
|
-
*
|
|
7
|
-
* For efficiency's sake, the underlying response bodies are not compared;
|
|
8
|
-
* only specific response headers are checked.
|
|
9
|
-
*/
|
|
10
|
-
export declare class BroadcastCacheUpdate {
|
|
11
|
-
private readonly _headersToCheck;
|
|
12
|
-
private readonly _generatePayload;
|
|
13
|
-
private readonly _notifyAllClients;
|
|
14
|
-
/**
|
|
15
|
-
* Construct an instance of `BroadcastCacheUpdate`.
|
|
16
|
-
*
|
|
17
|
-
* @param options
|
|
18
|
-
*/
|
|
19
|
-
constructor({ generatePayload, headersToCheck, notifyAllClients }?: BroadcastCacheUpdateOptions);
|
|
20
|
-
/**
|
|
21
|
-
* Compares two responses and sends a message (via `postMessage()`) to all window clients if the
|
|
22
|
-
* responses differ. Neither of the Responses can be opaque.
|
|
23
|
-
*
|
|
24
|
-
* The message that's posted has the following format (where `payload` can
|
|
25
|
-
* be customized via the `generatePayload` option the instance is created
|
|
26
|
-
* with):
|
|
27
|
-
*
|
|
28
|
-
* ```
|
|
29
|
-
* {
|
|
30
|
-
* type: 'CACHE_UPDATED',
|
|
31
|
-
* meta: 'workbox-broadcast-update',
|
|
32
|
-
* payload: {
|
|
33
|
-
* cacheName: 'the-cache-name',
|
|
34
|
-
* updatedURL: 'https://example.com/'
|
|
35
|
-
* }
|
|
36
|
-
* }
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @param options
|
|
40
|
-
* @returns Resolves once the update is sent.
|
|
41
|
-
*/
|
|
42
|
-
notifyIfUpdated(options: CacheDidUpdateCallbackParam): Promise<void>;
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=BroadcastCacheUpdate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BroadcastCacheUpdate.d.ts","sourceRoot":"","sources":["../../../src/lib/broadcastUpdate/BroadcastCacheUpdate.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAYlE,OAAO,KAAK,EAAE,2BAA2B,EAAiE,MAAM,YAAY,CAAC;AAuB7H;;;;;;GAMG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAW;IAC3C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA4B;IAC7D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAU;IAE5C;;;;OAIG;gBACS,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAE,2BAAgC;IAMnG;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,eAAe,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;CA4E3E"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { CacheDidUpdateCallbackParam, SerwistPlugin } from "../../types.js";
|
|
2
|
-
import type { BroadcastCacheUpdateOptions } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* A class implementing the `cacheDidUpdate` lifecycle callback. It will automatically
|
|
5
|
-
* broadcast a message whenever a cached response is updated.
|
|
6
|
-
*/
|
|
7
|
-
export declare class BroadcastUpdatePlugin implements SerwistPlugin {
|
|
8
|
-
private readonly _broadcastUpdate;
|
|
9
|
-
/**
|
|
10
|
-
* Construct a {@linkcode BroadcastCacheUpdate} instance with
|
|
11
|
-
* the passed options and calls its {@linkcode BroadcastCacheUpdate.notifyIfUpdated}
|
|
12
|
-
* method whenever the plugin's {@linkcode BroadcastUpdatePlugin.cacheDidUpdate} callback
|
|
13
|
-
* is invoked.
|
|
14
|
-
*
|
|
15
|
-
* @param options
|
|
16
|
-
*/
|
|
17
|
-
constructor(options?: BroadcastCacheUpdateOptions);
|
|
18
|
-
/**
|
|
19
|
-
* @private
|
|
20
|
-
* @param options The input object to this function.
|
|
21
|
-
*/
|
|
22
|
-
cacheDidUpdate(options: CacheDidUpdateCallbackParam): void;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=BroadcastUpdatePlugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BroadcastUpdatePlugin.d.ts","sourceRoot":"","sources":["../../../src/lib/broadcastUpdate/BroadcastUpdatePlugin.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEjF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAE9D;;;GAGG;AACH,qBAAa,qBAAsB,YAAW,aAAa;IACzD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAuB;IAExD;;;;;;;OAOG;gBACS,OAAO,CAAC,EAAE,2BAA2B;IAIjD;;;OAGG;IACH,cAAc,CAAC,OAAO,EAAE,2BAA2B;CAGpD"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const BROADCAST_UPDATE_MESSAGE_TYPE = "CACHE_UPDATED";
|
|
2
|
-
export declare const BROADCAST_UPDATE_MESSAGE_META = "serwist-broadcast-update";
|
|
3
|
-
export declare const BROADCAST_UPDATE_DEFAULT_NOTIFY = true;
|
|
4
|
-
export declare const BROADCAST_UPDATE_DEFAULT_HEADERS: string[];
|
|
5
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/broadcastUpdate/constants.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,6BAA6B,kBAAkB,CAAC;AAC7D,eAAO,MAAM,6BAA6B,6BAA6B,CAAC;AACxE,eAAO,MAAM,+BAA+B,OAAO,CAAC;AACpD,eAAO,MAAM,gCAAgC,UAA8C,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Given two responses, compares several header values to see if they are
|
|
3
|
-
* the same or not.
|
|
4
|
-
*
|
|
5
|
-
* @param firstResponse The first response.
|
|
6
|
-
* @param secondResponse The second response.
|
|
7
|
-
* @param headersToCheck A list of headers to check.
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
export declare const responsesAreSame: (firstResponse: Response, secondResponse: Response, headersToCheck: string[]) => boolean;
|
|
11
|
-
//# sourceMappingURL=responsesAreSame.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"responsesAreSame.d.ts","sourceRoot":"","sources":["../../../src/lib/broadcastUpdate/responsesAreSame.ts"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAAI,eAAe,QAAQ,EAAE,gBAAgB,QAAQ,EAAE,gBAAgB,MAAM,EAAE,KAAG,OA4B9G,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { CacheDidUpdateCallbackParam } from "../../types.js";
|
|
2
|
-
import type { BROADCAST_UPDATE_MESSAGE_META, BROADCAST_UPDATE_MESSAGE_TYPE } from "./constants.js";
|
|
3
|
-
export interface BroadcastCacheUpdateOptions {
|
|
4
|
-
/**
|
|
5
|
-
* A list of headers that will be used to determine whether the responses
|
|
6
|
-
* differ.
|
|
7
|
-
*
|
|
8
|
-
* @default
|
|
9
|
-
* ['content-length', 'etag', 'last-modified']`
|
|
10
|
-
*/
|
|
11
|
-
headersToCheck?: string[];
|
|
12
|
-
/**
|
|
13
|
-
* A function whose return value
|
|
14
|
-
* will be used as the `payload` field in any cache update messages sent
|
|
15
|
-
* to the window clients.
|
|
16
|
-
* @param options
|
|
17
|
-
* @returns
|
|
18
|
-
*/
|
|
19
|
-
generatePayload?: (options: CacheDidUpdateCallbackParam) => Record<string, any>;
|
|
20
|
-
/**
|
|
21
|
-
* If `true` (the default) then all open clients will receive a message. If `false`,
|
|
22
|
-
* then only the client that make the original request will be notified of the update.
|
|
23
|
-
*
|
|
24
|
-
* @default true
|
|
25
|
-
*/
|
|
26
|
-
notifyAllClients?: boolean;
|
|
27
|
-
}
|
|
28
|
-
export type BroadcastPayload = Record<string, any>;
|
|
29
|
-
export type BroadcastPayloadGenerator = (options: CacheDidUpdateCallbackParam) => BroadcastPayload;
|
|
30
|
-
export interface BroadcastMessage {
|
|
31
|
-
type: typeof BROADCAST_UPDATE_MESSAGE_TYPE;
|
|
32
|
-
meta: typeof BROADCAST_UPDATE_MESSAGE_META;
|
|
33
|
-
payload: BroadcastPayload;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/broadcastUpdate/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,6BAA6B,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAEnG,MAAM,WAAW,2BAA2B;IAC1C;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,2BAA2B,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChF;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAEnD,MAAM,MAAM,yBAAyB,GAAG,CAAC,OAAO,EAAE,2BAA2B,KAAK,gBAAgB,CAAC;AAEnG,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,6BAA6B,CAAC;IAC3C,IAAI,EAAE,OAAO,6BAA6B,CAAC;IAC3C,OAAO,EAAE,gBAAgB,CAAC;CAC3B"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export interface CacheableResponseOptions {
|
|
2
|
-
/**
|
|
3
|
-
* One or more HTTP status codes that a response can have to be considered cacheable.
|
|
4
|
-
*/
|
|
5
|
-
statuses?: number[];
|
|
6
|
-
/**
|
|
7
|
-
* A mapping of header names and expected values that a response can have and be
|
|
8
|
-
* considered cacheable. If multiple headers are provided, only one needs to be present.
|
|
9
|
-
*/
|
|
10
|
-
headers?: HeadersInit;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Allows you to set up rules determining what status codes and/or headers need
|
|
14
|
-
* to be present in order for a [response](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
|
15
|
-
* to be considered cacheable.
|
|
16
|
-
*/
|
|
17
|
-
export declare class CacheableResponse {
|
|
18
|
-
private readonly _statuses?;
|
|
19
|
-
private readonly _headers?;
|
|
20
|
-
/**
|
|
21
|
-
* To construct a new `CacheableResponse` instance you must provide at least
|
|
22
|
-
* one of the `config` properties.
|
|
23
|
-
*
|
|
24
|
-
* If both `statuses` and `headers` are specified, then both conditions must
|
|
25
|
-
* be met for the response to be considered cacheable.
|
|
26
|
-
*
|
|
27
|
-
* @param config
|
|
28
|
-
*/
|
|
29
|
-
constructor(config?: CacheableResponseOptions);
|
|
30
|
-
/**
|
|
31
|
-
* Checks a response to see whether it's cacheable or not.
|
|
32
|
-
*
|
|
33
|
-
* @param response The response whose cacheability is being
|
|
34
|
-
* checked.
|
|
35
|
-
* @returns `true` if the response is cacheable, and `false`
|
|
36
|
-
* otherwise.
|
|
37
|
-
*/
|
|
38
|
-
isResponseCacheable(response: Response): boolean;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=CacheableResponse.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CacheableResponse.d.ts","sourceRoot":"","sources":["../../../src/lib/cacheableResponse/CacheableResponse.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAuC;IAClE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAU;IAEpC;;;;;;;;OAQG;gBACS,MAAM,GAAE,wBAA6B;IAmCjD;;;;;;;OAOG;IACH,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO;CAyDjD"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { SerwistPlugin } from "../../types.js";
|
|
2
|
-
import type { CacheableResponseOptions } from "./CacheableResponse.js";
|
|
3
|
-
/**
|
|
4
|
-
* A class implementing the `cacheWillUpdate` lifecycle callback. This makes it
|
|
5
|
-
* easier to add in cacheability checks to requests made via Serwist's built-in
|
|
6
|
-
* strategies.
|
|
7
|
-
*/
|
|
8
|
-
export declare class CacheableResponsePlugin implements SerwistPlugin {
|
|
9
|
-
private readonly _cacheableResponse;
|
|
10
|
-
/**
|
|
11
|
-
* To construct a new `CacheableResponsePlugin` instance you must provide at
|
|
12
|
-
* least one of the `config` properties.
|
|
13
|
-
*
|
|
14
|
-
* If both `statuses` and `headers` are specified, then both conditions must
|
|
15
|
-
* be met for the response to be considered cacheable.
|
|
16
|
-
*
|
|
17
|
-
* @param config
|
|
18
|
-
*/
|
|
19
|
-
constructor(config: CacheableResponseOptions);
|
|
20
|
-
/**
|
|
21
|
-
* @param options
|
|
22
|
-
* @returns
|
|
23
|
-
* @private
|
|
24
|
-
*/
|
|
25
|
-
cacheWillUpdate: SerwistPlugin["cacheWillUpdate"];
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=CacheableResponsePlugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CacheableResponsePlugin.d.ts","sourceRoot":"","sources":["../../../src/lib/cacheableResponse/CacheableResponsePlugin.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGvE;;;;GAIG;AACH,qBAAa,uBAAwB,YAAW,aAAa;IAC3D,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAoB;IAEvD;;;;;;;;OAQG;gBACS,MAAM,EAAE,wBAAwB;IAI5C;;;;OAIG;IACH,eAAe,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAK/C;CACH"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
interface CacheExpirationConfig {
|
|
2
|
-
/**
|
|
3
|
-
* The maximum number of entries to cache. Entries used least recently will
|
|
4
|
-
* be removed as the maximum is reached.
|
|
5
|
-
*/
|
|
6
|
-
maxEntries?: number;
|
|
7
|
-
/**
|
|
8
|
-
* The maximum age of an entry before it's treated as stale and removed.
|
|
9
|
-
*/
|
|
10
|
-
maxAgeSeconds?: number;
|
|
11
|
-
/**
|
|
12
|
-
* The [`CacheQueryOptions`](https://developer.mozilla.org/en-US/docs/Web/API/Cache/delete#Parameters)
|
|
13
|
-
* that will be used when calling `delete()` on the cache.
|
|
14
|
-
*/
|
|
15
|
-
matchOptions?: CacheQueryOptions;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Allows you to expires cached responses based on age or maximum number of entries.
|
|
19
|
-
* @see https://serwist.pages.dev/docs/serwist/core/cache-expiration
|
|
20
|
-
*/
|
|
21
|
-
export declare class CacheExpiration {
|
|
22
|
-
private _isRunning;
|
|
23
|
-
private _rerunRequested;
|
|
24
|
-
private readonly _maxEntries?;
|
|
25
|
-
private readonly _maxAgeSeconds?;
|
|
26
|
-
private readonly _matchOptions?;
|
|
27
|
-
private readonly _cacheName;
|
|
28
|
-
private readonly _timestampModel;
|
|
29
|
-
/**
|
|
30
|
-
* To construct a new `CacheExpiration` instance you must provide at least
|
|
31
|
-
* one of the `config` properties.
|
|
32
|
-
*
|
|
33
|
-
* @param cacheName Name of the cache to apply restrictions to.
|
|
34
|
-
* @param config
|
|
35
|
-
*/
|
|
36
|
-
constructor(cacheName: string, config?: CacheExpirationConfig);
|
|
37
|
-
/**
|
|
38
|
-
* Expires entries for the given cache and given criteria.
|
|
39
|
-
*/
|
|
40
|
-
expireEntries(): Promise<void>;
|
|
41
|
-
/**
|
|
42
|
-
* Updates the timestamp for the given URL, allowing it to be correctly
|
|
43
|
-
* tracked by the class.
|
|
44
|
-
*
|
|
45
|
-
* @param url
|
|
46
|
-
*/
|
|
47
|
-
updateTimestamp(url: string): Promise<void>;
|
|
48
|
-
/**
|
|
49
|
-
* Checks if a URL has expired or not before it's used.
|
|
50
|
-
*
|
|
51
|
-
* This looks the timestamp up in IndexedDB and can be slow.
|
|
52
|
-
*
|
|
53
|
-
* Note: This method does not remove an expired entry, call
|
|
54
|
-
* `expireEntries()` to remove such entries instead.
|
|
55
|
-
*
|
|
56
|
-
* @param url
|
|
57
|
-
* @returns
|
|
58
|
-
*/
|
|
59
|
-
isURLExpired(url: string): Promise<boolean>;
|
|
60
|
-
/**
|
|
61
|
-
* Removes the IndexedDB used to keep track of cache expiration metadata.
|
|
62
|
-
*/
|
|
63
|
-
delete(): Promise<void>;
|
|
64
|
-
}
|
|
65
|
-
export {};
|
|
66
|
-
//# sourceMappingURL=CacheExpiration.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CacheExpiration.d.ts","sourceRoot":"","sources":["../../../src/lib/expiration/CacheExpiration.ts"],"names":[],"mappings":"AAaA,UAAU,qBAAqB;IAC7B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAClC;AAED;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAoB;IACnD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAuB;IAEvD;;;;;;OAMG;gBACS,SAAS,EAAE,MAAM,EAAE,MAAM,GAAE,qBAA0B;IA2CjE;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IA0CpC;;;;;OAKG;IACG,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAajD;;;;;;;;;;OAUG;IACG,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAejD;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAM9B"}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import type { CacheDidUpdateCallbackParam, CachedResponseWillBeUsedCallbackParam, SerwistPlugin } from "../../types.js";
|
|
2
|
-
export interface ExpirationPluginOptions {
|
|
3
|
-
/**
|
|
4
|
-
* The maximum number of entries to cache. Entries used (if `maxAgeFrom` is
|
|
5
|
-
* `"last-used"`) or fetched from the network (if `maxAgeFrom` is `"last-fetched"`)
|
|
6
|
-
* least recently will be removed as the maximum is reached.
|
|
7
|
-
*/
|
|
8
|
-
maxEntries?: number;
|
|
9
|
-
/**
|
|
10
|
-
* The maximum number of seconds before an entry is treated as stale and removed.
|
|
11
|
-
*/
|
|
12
|
-
maxAgeSeconds?: number;
|
|
13
|
-
/**
|
|
14
|
-
* Determines whether `maxAgeSeconds` should be calculated from when an
|
|
15
|
-
* entry was last fetched or when it was last used.
|
|
16
|
-
*
|
|
17
|
-
* @default "last-fetched"
|
|
18
|
-
*/
|
|
19
|
-
maxAgeFrom?: "last-fetched" | "last-used";
|
|
20
|
-
/**
|
|
21
|
-
* The [`CacheQueryOptions`](https://developer.mozilla.org/en-US/docs/Web/API/Cache/delete#Parameters)
|
|
22
|
-
* that will be used when calling `delete()` on the cache.
|
|
23
|
-
*/
|
|
24
|
-
matchOptions?: CacheQueryOptions;
|
|
25
|
-
/**
|
|
26
|
-
* Whether to opt this cache into automatic deletion if the available storage quota has been exceeded.
|
|
27
|
-
*/
|
|
28
|
-
purgeOnQuotaError?: boolean;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* This plugin can be used in a {@linkcode Strategy} to regularly enforce a
|
|
32
|
-
* limit on the age and/or the number of cached requests.
|
|
33
|
-
*
|
|
34
|
-
* It can only be used with {@linkcode Strategy} instances that have a custom `cacheName` property set.
|
|
35
|
-
* In other words, it can't be used to expire entries in strategies that use the default runtime
|
|
36
|
-
* cache name.
|
|
37
|
-
*
|
|
38
|
-
* Whenever a cached response is used or updated, this plugin will look
|
|
39
|
-
* at the associated cache and remove any old or extra responses.
|
|
40
|
-
*
|
|
41
|
-
* When using `maxAgeSeconds`, responses may be used *once* after expiring
|
|
42
|
-
* because the expiration clean up will not have occurred until *after* the
|
|
43
|
-
* cached response has been used. If the response has a "Date" header, then a lightweight expiration
|
|
44
|
-
* check is performed, and the response will not be used immediately.
|
|
45
|
-
*
|
|
46
|
-
* When using `maxEntries`, the least recently requested entry will be removed
|
|
47
|
-
* from the cache.
|
|
48
|
-
*
|
|
49
|
-
* @see https://serwist.pages.dev/docs/serwist/runtime-caching/plugins/expiration-plugin
|
|
50
|
-
*/
|
|
51
|
-
export declare class ExpirationPlugin implements SerwistPlugin {
|
|
52
|
-
private readonly _config;
|
|
53
|
-
private _cacheExpirations;
|
|
54
|
-
/**
|
|
55
|
-
* @param config
|
|
56
|
-
*/
|
|
57
|
-
constructor(config?: ExpirationPluginOptions);
|
|
58
|
-
/**
|
|
59
|
-
* A simple helper method to return a CacheExpiration instance for a given
|
|
60
|
-
* cache name.
|
|
61
|
-
*
|
|
62
|
-
* @param cacheName
|
|
63
|
-
* @returns
|
|
64
|
-
* @private
|
|
65
|
-
*/
|
|
66
|
-
private _getCacheExpiration;
|
|
67
|
-
/**
|
|
68
|
-
* A lifecycle callback that will be triggered automatically when a
|
|
69
|
-
* response is about to be returned from a [`Cache`](https://developer.mozilla.org/en-US/docs/Web/API/Cache).
|
|
70
|
-
* It allows the response to be inspected for freshness and
|
|
71
|
-
* prevents it from being used if the response's `Date` header value is
|
|
72
|
-
* older than the configured `maxAgeSeconds`.
|
|
73
|
-
*
|
|
74
|
-
* @param options
|
|
75
|
-
* @returns `cachedResponse` if it is fresh and `null` if it is stale or
|
|
76
|
-
* not available.
|
|
77
|
-
* @private
|
|
78
|
-
*/
|
|
79
|
-
cachedResponseWillBeUsed({ event, cacheName, request, cachedResponse }: CachedResponseWillBeUsedCallbackParam): Response | null;
|
|
80
|
-
/**
|
|
81
|
-
* @param cachedResponse
|
|
82
|
-
* @returns
|
|
83
|
-
* @private
|
|
84
|
-
*/
|
|
85
|
-
private _isResponseDateFresh;
|
|
86
|
-
/**
|
|
87
|
-
* Extracts the `Date` header and parse it into an useful value.
|
|
88
|
-
*
|
|
89
|
-
* @param cachedResponse
|
|
90
|
-
* @returns
|
|
91
|
-
* @private
|
|
92
|
-
*/
|
|
93
|
-
private _getDateHeaderTimestamp;
|
|
94
|
-
/**
|
|
95
|
-
* A lifecycle callback that will be triggered automatically when an entry is added
|
|
96
|
-
* to a cache.
|
|
97
|
-
*
|
|
98
|
-
* @param options
|
|
99
|
-
* @private
|
|
100
|
-
*/
|
|
101
|
-
cacheDidUpdate({ cacheName, request }: CacheDidUpdateCallbackParam): Promise<void>;
|
|
102
|
-
/**
|
|
103
|
-
* Deletes the underlying `Cache` instance associated with this instance and the metadata
|
|
104
|
-
* from IndexedDB used to keep track of expiration details for each `Cache` instance.
|
|
105
|
-
*
|
|
106
|
-
* When using cache expiration, calling this method is preferable to calling
|
|
107
|
-
* `caches.delete()` directly, since this will ensure that the IndexedDB
|
|
108
|
-
* metadata is also cleanly removed and that open IndexedDB instances are deleted.
|
|
109
|
-
*
|
|
110
|
-
* Note that if you're *not* using cache expiration for a given cache, calling
|
|
111
|
-
* `caches.delete()` and passing in the cache's name should be sufficient.
|
|
112
|
-
* There is no Serwist-specific method needed for cleanup in that case.
|
|
113
|
-
*/
|
|
114
|
-
deleteCacheAndMetadata(): Promise<void>;
|
|
115
|
-
}
|
|
116
|
-
//# sourceMappingURL=ExpirationPlugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpirationPlugin.d.ts","sourceRoot":"","sources":["../../../src/lib/expiration/ExpirationPlugin.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,2BAA2B,EAAE,qCAAqC,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AASxH,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,cAAc,GAAG,WAAW,CAAC;IAC1C;;;OAGG;IACH,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,gBAAiB,YAAW,aAAa;IACpD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0B;IAClD,OAAO,CAAC,iBAAiB,CAA+B;IAExD;;OAEG;gBACS,MAAM,GAAE,uBAA4B;IAkDhD;;;;;;;OAOG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;;;;;;;;;;OAWG;IACH,wBAAwB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,qCAAqC;IAqC7G;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAwB5B;;;;;;OAMG;IACH,OAAO,CAAC,uBAAuB;IAkB/B;;;;;;OAMG;IACG,cAAc,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,2BAA2B;IAqBxE;;;;;;;;;;;OAWG;IACG,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;CAW9C"}
|