From 7ad1b7c380ba5607035149c95ac69fbd403e2bd8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 24 Dec 2023 04:59:21 +0000 Subject: chore: autopublish 2023-12-24T04:59:21Z --- .../workbox-v4.3.1/workbox-background-sync.dev.js | 822 ---------- .../workbox-background-sync.dev.js.map | 1 - .../workbox-v4.3.1/workbox-background-sync.prod.js | 2 - .../workbox-background-sync.prod.js.map | 1 - .../workbox-v4.3.1/workbox-broadcast-update.dev.js | 496 ------ .../workbox-broadcast-update.dev.js.map | 1 - .../workbox-broadcast-update.prod.js | 2 - .../workbox-broadcast-update.prod.js.map | 1 - .../workbox-cacheable-response.dev.js | 200 --- .../workbox-cacheable-response.dev.js.map | 1 - .../workbox-cacheable-response.prod.js | 2 - .../workbox-cacheable-response.prod.js.map | 1 - public/workbox-v4.3.1/workbox-core.dev.js | 1712 -------------------- public/workbox-v4.3.1/workbox-core.dev.js.map | 1 - public/workbox-v4.3.1/workbox-core.prod.js | 2 - public/workbox-v4.3.1/workbox-core.prod.js.map | 1 - public/workbox-v4.3.1/workbox-expiration.dev.js | 652 -------- .../workbox-v4.3.1/workbox-expiration.dev.js.map | 1 - public/workbox-v4.3.1/workbox-expiration.prod.js | 2 - .../workbox-v4.3.1/workbox-expiration.prod.js.map | 1 - .../workbox-navigation-preload.dev.js | 110 -- .../workbox-navigation-preload.dev.js.map | 1 - .../workbox-navigation-preload.prod.js | 2 - .../workbox-navigation-preload.prod.js.map | 1 - public/workbox-v4.3.1/workbox-offline-ga.dev.js | 243 --- .../workbox-v4.3.1/workbox-offline-ga.dev.js.map | 1 - public/workbox-v4.3.1/workbox-offline-ga.prod.js | 2 - .../workbox-v4.3.1/workbox-offline-ga.prod.js.map | 1 - public/workbox-v4.3.1/workbox-precaching.dev.js | 989 ----------- .../workbox-v4.3.1/workbox-precaching.dev.js.map | 1 - public/workbox-v4.3.1/workbox-precaching.prod.js | 2 - .../workbox-v4.3.1/workbox-precaching.prod.js.map | 1 - .../workbox-v4.3.1/workbox-range-requests.dev.js | 268 --- .../workbox-range-requests.dev.js.map | 1 - .../workbox-v4.3.1/workbox-range-requests.prod.js | 2 - .../workbox-range-requests.prod.js.map | 1 - public/workbox-v4.3.1/workbox-routing.dev.js | 1020 ------------ public/workbox-v4.3.1/workbox-routing.dev.js.map | 1 - public/workbox-v4.3.1/workbox-routing.prod.js | 2 - public/workbox-v4.3.1/workbox-routing.prod.js.map | 1 - public/workbox-v4.3.1/workbox-strategies.dev.js | 1138 ------------- .../workbox-v4.3.1/workbox-strategies.dev.js.map | 1 - public/workbox-v4.3.1/workbox-strategies.prod.js | 2 - .../workbox-v4.3.1/workbox-strategies.prod.js.map | 1 - public/workbox-v4.3.1/workbox-streams.dev.js | 337 ---- public/workbox-v4.3.1/workbox-streams.dev.js.map | 1 - public/workbox-v4.3.1/workbox-streams.prod.js | 2 - public/workbox-v4.3.1/workbox-streams.prod.js.map | 1 - public/workbox-v4.3.1/workbox-sw.js | 2 - public/workbox-v4.3.1/workbox-sw.js.map | 1 - public/workbox-v4.3.1/workbox-window.dev.es5.mjs | 885 ---------- .../workbox-v4.3.1/workbox-window.dev.es5.mjs.map | 1 - public/workbox-v4.3.1/workbox-window.dev.mjs | 751 --------- public/workbox-v4.3.1/workbox-window.dev.mjs.map | 1 - public/workbox-v4.3.1/workbox-window.dev.umd.js | 896 ---------- .../workbox-v4.3.1/workbox-window.dev.umd.js.map | 1 - public/workbox-v4.3.1/workbox-window.prod.es5.mjs | 2 - .../workbox-v4.3.1/workbox-window.prod.es5.mjs.map | 1 - public/workbox-v4.3.1/workbox-window.prod.mjs | 2 - public/workbox-v4.3.1/workbox-window.prod.mjs.map | 1 - public/workbox-v4.3.1/workbox-window.prod.umd.js | 2 - .../workbox-v4.3.1/workbox-window.prod.umd.js.map | 1 - 62 files changed, 10582 deletions(-) delete mode 100644 public/workbox-v4.3.1/workbox-background-sync.dev.js delete mode 100644 public/workbox-v4.3.1/workbox-background-sync.dev.js.map delete mode 100644 public/workbox-v4.3.1/workbox-background-sync.prod.js delete mode 100644 public/workbox-v4.3.1/workbox-background-sync.prod.js.map delete mode 100644 public/workbox-v4.3.1/workbox-broadcast-update.dev.js delete mode 100644 public/workbox-v4.3.1/workbox-broadcast-update.dev.js.map delete mode 100644 public/workbox-v4.3.1/workbox-broadcast-update.prod.js delete mode 100644 public/workbox-v4.3.1/workbox-broadcast-update.prod.js.map delete mode 100644 public/workbox-v4.3.1/workbox-cacheable-response.dev.js delete mode 100644 public/workbox-v4.3.1/workbox-cacheable-response.dev.js.map delete mode 100644 public/workbox-v4.3.1/workbox-cacheable-response.prod.js delete mode 100644 public/workbox-v4.3.1/workbox-cacheable-response.prod.js.map delete mode 100644 public/workbox-v4.3.1/workbox-core.dev.js delete mode 100644 public/workbox-v4.3.1/workbox-core.dev.js.map delete mode 100644 public/workbox-v4.3.1/workbox-core.prod.js delete mode 100644 public/workbox-v4.3.1/workbox-core.prod.js.map delete mode 100644 public/workbox-v4.3.1/workbox-expiration.dev.js delete mode 100644 public/workbox-v4.3.1/workbox-expiration.dev.js.map delete mode 100644 public/workbox-v4.3.1/workbox-expiration.prod.js delete mode 100644 public/workbox-v4.3.1/workbox-expiration.prod.js.map delete mode 100644 public/workbox-v4.3.1/workbox-navigation-preload.dev.js delete mode 100644 public/workbox-v4.3.1/workbox-navigation-preload.dev.js.map delete mode 100644 public/workbox-v4.3.1/workbox-navigation-preload.prod.js delete mode 100644 public/workbox-v4.3.1/workbox-navigation-preload.prod.js.map delete mode 100644 public/workbox-v4.3.1/workbox-offline-ga.dev.js delete mode 100644 public/workbox-v4.3.1/workbox-offline-ga.dev.js.map delete mode 100644 public/workbox-v4.3.1/workbox-offline-ga.prod.js delete mode 100644 public/workbox-v4.3.1/workbox-offline-ga.prod.js.map delete mode 100644 public/workbox-v4.3.1/workbox-precaching.dev.js delete mode 100644 public/workbox-v4.3.1/workbox-precaching.dev.js.map delete mode 100644 public/workbox-v4.3.1/workbox-precaching.prod.js delete mode 100644 public/workbox-v4.3.1/workbox-precaching.prod.js.map delete mode 100644 public/workbox-v4.3.1/workbox-range-requests.dev.js delete mode 100644 public/workbox-v4.3.1/workbox-range-requests.dev.js.map delete mode 100644 public/workbox-v4.3.1/workbox-range-requests.prod.js delete mode 100644 public/workbox-v4.3.1/workbox-range-requests.prod.js.map delete mode 100644 public/workbox-v4.3.1/workbox-routing.dev.js delete mode 100644 public/workbox-v4.3.1/workbox-routing.dev.js.map delete mode 100644 public/workbox-v4.3.1/workbox-routing.prod.js delete mode 100644 public/workbox-v4.3.1/workbox-routing.prod.js.map delete mode 100644 public/workbox-v4.3.1/workbox-strategies.dev.js delete mode 100644 public/workbox-v4.3.1/workbox-strategies.dev.js.map delete mode 100644 public/workbox-v4.3.1/workbox-strategies.prod.js delete mode 100644 public/workbox-v4.3.1/workbox-strategies.prod.js.map delete mode 100644 public/workbox-v4.3.1/workbox-streams.dev.js delete mode 100644 public/workbox-v4.3.1/workbox-streams.dev.js.map delete mode 100644 public/workbox-v4.3.1/workbox-streams.prod.js delete mode 100644 public/workbox-v4.3.1/workbox-streams.prod.js.map delete mode 100644 public/workbox-v4.3.1/workbox-sw.js delete mode 100644 public/workbox-v4.3.1/workbox-sw.js.map delete mode 100644 public/workbox-v4.3.1/workbox-window.dev.es5.mjs delete mode 100644 public/workbox-v4.3.1/workbox-window.dev.es5.mjs.map delete mode 100644 public/workbox-v4.3.1/workbox-window.dev.mjs delete mode 100644 public/workbox-v4.3.1/workbox-window.dev.mjs.map delete mode 100644 public/workbox-v4.3.1/workbox-window.dev.umd.js delete mode 100644 public/workbox-v4.3.1/workbox-window.dev.umd.js.map delete mode 100644 public/workbox-v4.3.1/workbox-window.prod.es5.mjs delete mode 100644 public/workbox-v4.3.1/workbox-window.prod.es5.mjs.map delete mode 100644 public/workbox-v4.3.1/workbox-window.prod.mjs delete mode 100644 public/workbox-v4.3.1/workbox-window.prod.mjs.map delete mode 100644 public/workbox-v4.3.1/workbox-window.prod.umd.js delete mode 100644 public/workbox-v4.3.1/workbox-window.prod.umd.js.map (limited to 'public/workbox-v4.3.1') diff --git a/public/workbox-v4.3.1/workbox-background-sync.dev.js b/public/workbox-v4.3.1/workbox-background-sync.dev.js deleted file mode 100644 index 1a3eddc..0000000 --- a/public/workbox-v4.3.1/workbox-background-sync.dev.js +++ /dev/null @@ -1,822 +0,0 @@ -this.workbox = this.workbox || {}; -this.workbox.backgroundSync = (function (exports, WorkboxError_mjs, logger_mjs, assert_mjs, getFriendlyURL_mjs, DBWrapper_mjs) { - 'use strict'; - - try { - self['workbox:background-sync:4.3.1'] && _(); - } catch (e) {} // eslint-disable-line - - /* - Copyright 2018 Google LLC - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. - */ - const DB_VERSION = 3; - const DB_NAME = 'workbox-background-sync'; - const OBJECT_STORE_NAME = 'requests'; - const INDEXED_PROP = 'queueName'; - /** - * A class to manage storing requests from a Queue in IndexedbDB, - * indexed by their queue name for easier access. - * - * @private - */ - - class QueueStore { - /** - * Associates this instance with a Queue instance, so entries added can be - * identified by their queue name. - * - * @param {string} queueName - * @private - */ - constructor(queueName) { - this._queueName = queueName; - this._db = new DBWrapper_mjs.DBWrapper(DB_NAME, DB_VERSION, { - onupgradeneeded: this._upgradeDb - }); - } - /** - * Append an entry last in the queue. - * - * @param {Object} entry - * @param {Object} entry.requestData - * @param {number} [entry.timestamp] - * @param {Object} [entry.metadata] - * @private - */ - - - async pushEntry(entry) { - { - assert_mjs.assert.isType(entry, 'object', { - moduleName: 'workbox-background-sync', - className: 'QueueStore', - funcName: 'pushEntry', - paramName: 'entry' - }); - assert_mjs.assert.isType(entry.requestData, 'object', { - moduleName: 'workbox-background-sync', - className: 'QueueStore', - funcName: 'pushEntry', - paramName: 'entry.requestData' - }); - } // Don't specify an ID since one is automatically generated. - - - delete entry.id; - entry.queueName = this._queueName; - await this._db.add(OBJECT_STORE_NAME, entry); - } - /** - * Preppend an entry first in the queue. - * - * @param {Object} entry - * @param {Object} entry.requestData - * @param {number} [entry.timestamp] - * @param {Object} [entry.metadata] - * @private - */ - - - async unshiftEntry(entry) { - { - assert_mjs.assert.isType(entry, 'object', { - moduleName: 'workbox-background-sync', - className: 'QueueStore', - funcName: 'unshiftEntry', - paramName: 'entry' - }); - assert_mjs.assert.isType(entry.requestData, 'object', { - moduleName: 'workbox-background-sync', - className: 'QueueStore', - funcName: 'unshiftEntry', - paramName: 'entry.requestData' - }); - } - - const [firstEntry] = await this._db.getAllMatching(OBJECT_STORE_NAME, { - count: 1 - }); - - if (firstEntry) { - // Pick an ID one less than the lowest ID in the object store. - entry.id = firstEntry.id - 1; - } else { - // Otherwise let the auto-incrementor assign the ID. - delete entry.id; - } - - entry.queueName = this._queueName; - await this._db.add(OBJECT_STORE_NAME, entry); - } - /** - * Removes and returns the last entry in the queue matching the `queueName`. - * - * @return {Promise} - * @private - */ - - - async popEntry() { - return this._removeEntry({ - direction: 'prev' - }); - } - /** - * Removes and returns the first entry in the queue matching the `queueName`. - * - * @return {Promise} - * @private - */ - - - async shiftEntry() { - return this._removeEntry({ - direction: 'next' - }); - } - /** - * Returns all entries in the store matching the `queueName`. - * - * @param {Object} options See workbox.backgroundSync.Queue~getAll} - * @return {Promise>} - * @private - */ - - - async getAll() { - return await this._db.getAllMatching(OBJECT_STORE_NAME, { - index: INDEXED_PROP, - query: IDBKeyRange.only(this._queueName) - }); - } - /** - * Deletes the entry for the given ID. - * - * WARNING: this method does not ensure the deleted enry belongs to this - * queue (i.e. matches the `queueName`). But this limitation is acceptable - * as this class is not publicly exposed. An additional check would make - * this method slower than it needs to be. - * - * @private - * @param {number} id - */ - - - async deleteEntry(id) { - await this._db.delete(OBJECT_STORE_NAME, id); - } - /** - * Removes and returns the first or last entry in the queue (based on the - * `direction` argument) matching the `queueName`. - * - * @return {Promise} - * @private - */ - - - async _removeEntry({ - direction - }) { - const [entry] = await this._db.getAllMatching(OBJECT_STORE_NAME, { - direction, - index: INDEXED_PROP, - query: IDBKeyRange.only(this._queueName), - count: 1 - }); - - if (entry) { - await this.deleteEntry(entry.id); - return entry; - } - } - /** - * Upgrades the database given an `upgradeneeded` event. - * - * @param {Event} event - * @private - */ - - - _upgradeDb(event) { - const db = event.target.result; - - if (event.oldVersion > 0 && event.oldVersion < DB_VERSION) { - if (db.objectStoreNames.contains(OBJECT_STORE_NAME)) { - db.deleteObjectStore(OBJECT_STORE_NAME); - } - } - - const objStore = db.createObjectStore(OBJECT_STORE_NAME, { - autoIncrement: true, - keyPath: 'id' - }); - objStore.createIndex(INDEXED_PROP, INDEXED_PROP, { - unique: false - }); - } - - } - - /* - Copyright 2018 Google LLC - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. - */ - const serializableProperties = ['method', 'referrer', 'referrerPolicy', 'mode', 'credentials', 'cache', 'redirect', 'integrity', 'keepalive']; - /** - * A class to make it easier to serialize and de-serialize requests so they - * can be stored in IndexedDB. - * - * @private - */ - - class StorableRequest { - /** - * Converts a Request object to a plain object that can be structured - * cloned or JSON-stringified. - * - * @param {Request} request - * @return {Promise} - * - * @private - */ - static async fromRequest(request) { - const requestData = { - url: request.url, - headers: {} - }; // Set the body if present. - - if (request.method !== 'GET') { - // Use ArrayBuffer to support non-text request bodies. - // NOTE: we can't use Blobs becuse Safari doesn't support storing - // Blobs in IndexedDB in some cases: - // https://github.com/dfahlander/Dexie.js/issues/618#issuecomment-398348457 - requestData.body = await request.clone().arrayBuffer(); - } // Convert the headers from an iterable to an object. - - - for (const [key, value] of request.headers.entries()) { - requestData.headers[key] = value; - } // Add all other serializable request properties - - - for (const prop of serializableProperties) { - if (request[prop] !== undefined) { - requestData[prop] = request[prop]; - } - } - - return new StorableRequest(requestData); - } - /** - * Accepts an object of request data that can be used to construct a - * `Request` but can also be stored in IndexedDB. - * - * @param {Object} requestData An object of request data that includes the - * `url` plus any relevant properties of - * [requestInit]{@link https://fetch.spec.whatwg.org/#requestinit}. - * @private - */ - - - constructor(requestData) { - { - assert_mjs.assert.isType(requestData, 'object', { - moduleName: 'workbox-background-sync', - className: 'StorableRequest', - funcName: 'constructor', - paramName: 'requestData' - }); - assert_mjs.assert.isType(requestData.url, 'string', { - moduleName: 'workbox-background-sync', - className: 'StorableRequest', - funcName: 'constructor', - paramName: 'requestData.url' - }); - } // If the request's mode is `navigate`, convert it to `same-origin` since - // navigation requests can't be constructed via script. - - - if (requestData.mode === 'navigate') { - requestData.mode = 'same-origin'; - } - - this._requestData = requestData; - } - /** - * Returns a deep clone of the instances `_requestData` object. - * - * @return {Object} - * - * @private - */ - - - toObject() { - const requestData = Object.assign({}, this._requestData); - requestData.headers = Object.assign({}, this._requestData.headers); - - if (requestData.body) { - requestData.body = requestData.body.slice(0); - } - - return requestData; - } - /** - * Converts this instance to a Request. - * - * @return {Request} - * - * @private - */ - - - toRequest() { - return new Request(this._requestData.url, this._requestData); - } - /** - * Creates and returns a deep clone of the instance. - * - * @return {StorableRequest} - * - * @private - */ - - - clone() { - return new StorableRequest(this.toObject()); - } - - } - - /* - Copyright 2018 Google LLC - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. - */ - const TAG_PREFIX = 'workbox-background-sync'; - const MAX_RETENTION_TIME = 60 * 24 * 7; // 7 days in minutes - - const queueNames = new Set(); - /** - * A class to manage storing failed requests in IndexedDB and retrying them - * later. All parts of the storing and replaying process are observable via - * callbacks. - * - * @memberof workbox.backgroundSync - */ - - class Queue { - /** - * Creates an instance of Queue with the given options - * - * @param {string} name The unique name for this queue. This name must be - * unique as it's used to register sync events and store requests - * in IndexedDB specific to this instance. An error will be thrown if - * a duplicate name is detected. - * @param {Object} [options] - * @param {Function} [options.onSync] A function that gets invoked whenever - * the 'sync' event fires. The function is invoked with an object - * containing the `queue` property (referencing this instance), and you - * can use the callback to customize the replay behavior of the queue. - * When not set the `replayRequests()` method is called. - * Note: if the replay fails after a sync event, make sure you throw an - * error, so the browser knows to retry the sync event later. - * @param {number} [options.maxRetentionTime=7 days] The amount of time (in - * minutes) a request may be retried. After this amount of time has - * passed, the request will be deleted from the queue. - */ - constructor(name, { - onSync, - maxRetentionTime - } = {}) { - // Ensure the store name is not already being used - if (queueNames.has(name)) { - throw new WorkboxError_mjs.WorkboxError('duplicate-queue-name', { - name - }); - } else { - queueNames.add(name); - } - - this._name = name; - this._onSync = onSync || this.replayRequests; - this._maxRetentionTime = maxRetentionTime || MAX_RETENTION_TIME; - this._queueStore = new QueueStore(this._name); - - this._addSyncListener(); - } - /** - * @return {string} - */ - - - get name() { - return this._name; - } - /** - * Stores the passed request in IndexedDB (with its timestamp and any - * metadata) at the end of the queue. - * - * @param {Object} entry - * @param {Request} entry.request The request to store in the queue. - * @param {Object} [entry.metadata] Any metadata you want associated with the - * stored request. When requests are replayed you'll have access to this - * metadata object in case you need to modify the request beforehand. - * @param {number} [entry.timestamp] The timestamp (Epoch time in - * milliseconds) when the request was first added to the queue. This is - * used along with `maxRetentionTime` to remove outdated requests. In - * general you don't need to set this value, as it's automatically set - * for you (defaulting to `Date.now()`), but you can update it if you - * don't want particular requests to expire. - */ - - - async pushRequest(entry) { - { - assert_mjs.assert.isType(entry, 'object', { - moduleName: 'workbox-background-sync', - className: 'Queue', - funcName: 'pushRequest', - paramName: 'entry' - }); - assert_mjs.assert.isInstance(entry.request, Request, { - moduleName: 'workbox-background-sync', - className: 'Queue', - funcName: 'pushRequest', - paramName: 'entry.request' - }); - } - - await this._addRequest(entry, 'push'); - } - /** - * Stores the passed request in IndexedDB (with its timestamp and any - * metadata) at the beginning of the queue. - * - * @param {Object} entry - * @param {Request} entry.request The request to store in the queue. - * @param {Object} [entry.metadata] Any metadata you want associated with the - * stored request. When requests are replayed you'll have access to this - * metadata object in case you need to modify the request beforehand. - * @param {number} [entry.timestamp] The timestamp (Epoch time in - * milliseconds) when the request was first added to the queue. This is - * used along with `maxRetentionTime` to remove outdated requests. In - * general you don't need to set this value, as it's automatically set - * for you (defaulting to `Date.now()`), but you can update it if you - * don't want particular requests to expire. - */ - - - async unshiftRequest(entry) { - { - assert_mjs.assert.isType(entry, 'object', { - moduleName: 'workbox-background-sync', - className: 'Queue', - funcName: 'unshiftRequest', - paramName: 'entry' - }); - assert_mjs.assert.isInstance(entry.request, Request, { - moduleName: 'workbox-background-sync', - className: 'Queue', - funcName: 'unshiftRequest', - paramName: 'entry.request' - }); - } - - await this._addRequest(entry, 'unshift'); - } - /** - * Removes and returns the last request in the queue (along with its - * timestamp and any metadata). The returned object takes the form: - * `{request, timestamp, metadata}`. - * - * @return {Promise} - */ - - - async popRequest() { - return this._removeRequest('pop'); - } - /** - * Removes and returns the first request in the queue (along with its - * timestamp and any metadata). The returned object takes the form: - * `{request, timestamp, metadata}`. - * - * @return {Promise} - */ - - - async shiftRequest() { - return this._removeRequest('shift'); - } - /** - * Returns all the entries that have not expired (per `maxRetentionTime`). - * Any expired entries are removed from the queue. - * - * @return {Promise>} - */ - - - async getAll() { - const allEntries = await this._queueStore.getAll(); - const now = Date.now(); - const unexpiredEntries = []; - - for (const entry of allEntries) { - // Ignore requests older than maxRetentionTime. Call this function - // recursively until an unexpired request is found. - const maxRetentionTimeInMs = this._maxRetentionTime * 60 * 1000; - - if (now - entry.timestamp > maxRetentionTimeInMs) { - await this._queueStore.deleteEntry(entry.id); - } else { - unexpiredEntries.push(convertEntry(entry)); - } - } - - return unexpiredEntries; - } - /** - * Adds the entry to the QueueStore and registers for a sync event. - * - * @param {Object} entry - * @param {Request} entry.request - * @param {Object} [entry.metadata] - * @param {number} [entry.timestamp=Date.now()] - * @param {string} operation ('push' or 'unshift') - * @private - */ - - - async _addRequest({ - request, - metadata, - timestamp = Date.now() - }, operation) { - const storableRequest = await StorableRequest.fromRequest(request.clone()); - const entry = { - requestData: storableRequest.toObject(), - timestamp - }; // Only include metadata if it's present. - - if (metadata) { - entry.metadata = metadata; - } - - await this._queueStore[`${operation}Entry`](entry); - - { - logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(request.url)}' has ` + `been added to background sync queue '${this._name}'.`); - } // Don't register for a sync if we're in the middle of a sync. Instead, - // we wait until the sync is complete and call register if - // `this._requestsAddedDuringSync` is true. - - - if (this._syncInProgress) { - this._requestsAddedDuringSync = true; - } else { - await this.registerSync(); - } - } - /** - * Removes and returns the first or last (depending on `operation`) entry - * from the QueueStore that's not older than the `maxRetentionTime`. - * - * @param {string} operation ('pop' or 'shift') - * @return {Object|undefined} - * @private - */ - - - async _removeRequest(operation) { - const now = Date.now(); - const entry = await this._queueStore[`${operation}Entry`](); - - if (entry) { - // Ignore requests older than maxRetentionTime. Call this function - // recursively until an unexpired request is found. - const maxRetentionTimeInMs = this._maxRetentionTime * 60 * 1000; - - if (now - entry.timestamp > maxRetentionTimeInMs) { - return this._removeRequest(operation); - } - - return convertEntry(entry); - } - } - /** - * Loops through each request in the queue and attempts to re-fetch it. - * If any request fails to re-fetch, it's put back in the same position in - * the queue (which registers a retry for the next sync event). - */ - - - async replayRequests() { - let entry; - - while (entry = await this.shiftRequest()) { - try { - await fetch(entry.request.clone()); - - { - logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(entry.request.url)}'` + `has been replayed in queue '${this._name}'`); - } - } catch (error) { - await this.unshiftRequest(entry); - - { - logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(entry.request.url)}'` + `failed to replay, putting it back in queue '${this._name}'`); - } - - throw new WorkboxError_mjs.WorkboxError('queue-replay-failed', { - name: this._name - }); - } - } - - { - logger_mjs.logger.log(`All requests in queue '${this.name}' have successfully ` + `replayed; the queue is now empty!`); - } - } - /** - * Registers a sync event with a tag unique to this instance. - */ - - - async registerSync() { - if ('sync' in registration) { - try { - await registration.sync.register(`${TAG_PREFIX}:${this._name}`); - } catch (err) { - // This means the registration failed for some reason, possibly due to - // the user disabling it. - { - logger_mjs.logger.warn(`Unable to register sync event for '${this._name}'.`, err); - } - } - } - } - /** - * In sync-supporting browsers, this adds a listener for the sync event. - * In non-sync-supporting browsers, this will retry the queue on service - * worker startup. - * - * @private - */ - - - _addSyncListener() { - if ('sync' in registration) { - self.addEventListener('sync', event => { - if (event.tag === `${TAG_PREFIX}:${this._name}`) { - { - logger_mjs.logger.log(`Background sync for tag '${event.tag}'` + `has been received`); - } - - const syncComplete = async () => { - this._syncInProgress = true; - let syncError; - - try { - await this._onSync({ - queue: this - }); - } catch (error) { - syncError = error; // Rethrow the error. Note: the logic in the finally clause - // will run before this gets rethrown. - - throw syncError; - } finally { - // New items may have been added to the queue during the sync, - // so we need to register for a new sync if that's happened... - // Unless there was an error during the sync, in which - // case the browser will automatically retry later, as long - // as `event.lastChance` is not true. - if (this._requestsAddedDuringSync && !(syncError && !event.lastChance)) { - await this.registerSync(); - } - - this._syncInProgress = false; - this._requestsAddedDuringSync = false; - } - }; - - event.waitUntil(syncComplete()); - } - }); - } else { - { - logger_mjs.logger.log(`Background sync replaying without background sync event`); - } // If the browser doesn't support background sync, retry - // every time the service worker starts up as a fallback. - - - this._onSync({ - queue: this - }); - } - } - /** - * Returns the set of queue names. This is primarily used to reset the list - * of queue names in tests. - * - * @return {Set} - * - * @private - */ - - - static get _queueNames() { - return queueNames; - } - - } - /** - * Converts a QueueStore entry into the format exposed by Queue. This entails - * converting the request data into a real request and omitting the `id` and - * `queueName` properties. - * - * @param {Object} queueStoreEntry - * @return {Object} - * @private - */ - - - const convertEntry = queueStoreEntry => { - const queueEntry = { - request: new StorableRequest(queueStoreEntry.requestData).toRequest(), - timestamp: queueStoreEntry.timestamp - }; - - if (queueStoreEntry.metadata) { - queueEntry.metadata = queueStoreEntry.metadata; - } - - return queueEntry; - }; - - /* - Copyright 2018 Google LLC - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. - */ - /** - * A class implementing the `fetchDidFail` lifecycle callback. This makes it - * easier to add failed requests to a background sync Queue. - * - * @memberof workbox.backgroundSync - */ - - class Plugin { - /** - * @param {...*} queueArgs Args to forward to the composed Queue instance. - * See the [Queue]{@link workbox.backgroundSync.Queue} documentation for - * parameter details. - */ - constructor(...queueArgs) { - this._queue = new Queue(...queueArgs); - this.fetchDidFail = this.fetchDidFail.bind(this); - } - /** - * @param {Object} options - * @param {Request} options.request - * @private - */ - - - async fetchDidFail({ - request - }) { - await this._queue.pushRequest({ - request - }); - } - - } - - /* - Copyright 2018 Google LLC - - Use of this source code is governed by an MIT-style - license that can be found in the LICENSE file or at - https://opensource.org/licenses/MIT. - */ - - exports.Queue = Queue; - exports.Plugin = Plugin; - - return exports; - -}({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private)); -//# sourceMappingURL=workbox-background-sync.dev.js.map diff --git a/public/workbox-v4.3.1/workbox-background-sync.dev.js.map b/public/workbox-v4.3.1/workbox-background-sync.dev.js.map deleted file mode 100644 index 8d8cfc0..0000000 --- a/public/workbox-v4.3.1/workbox-background-sync.dev.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"workbox-background-sync.dev.js","sources":["../_version.mjs","../lib/QueueStore.mjs","../lib/StorableRequest.mjs","../Queue.mjs","../Plugin.mjs","../index.mjs"],"sourcesContent":["try{self['workbox:background-sync:4.3.1']&&_()}catch(e){}// eslint-disable-line","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {assert} from 'workbox-core/_private/assert.mjs';\nimport {DBWrapper} from 'workbox-core/_private/DBWrapper.mjs';\nimport '../_version.mjs';\n\n\nconst DB_VERSION = 3;\nconst DB_NAME = 'workbox-background-sync';\nconst OBJECT_STORE_NAME = 'requests';\nconst INDEXED_PROP = 'queueName';\n\n/**\n * A class to manage storing requests from a Queue in IndexedbDB,\n * indexed by their queue name for easier access.\n *\n * @private\n */\nexport class QueueStore {\n /**\n * Associates this instance with a Queue instance, so entries added can be\n * identified by their queue name.\n *\n * @param {string} queueName\n * @private\n */\n constructor(queueName) {\n this._queueName = queueName;\n this._db = new DBWrapper(DB_NAME, DB_VERSION, {\n onupgradeneeded: this._upgradeDb,\n });\n }\n\n /**\n * Append an entry last in the queue.\n *\n * @param {Object} entry\n * @param {Object} entry.requestData\n * @param {number} [entry.timestamp]\n * @param {Object} [entry.metadata]\n * @private\n */\n async pushEntry(entry) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(entry, 'object', {\n moduleName: 'workbox-background-sync',\n className: 'QueueStore',\n funcName: 'pushEntry',\n paramName: 'entry',\n });\n assert.isType(entry.requestData, 'object', {\n moduleName: 'workbox-background-sync',\n className: 'QueueStore',\n funcName: 'pushEntry',\n paramName: 'entry.requestData',\n });\n }\n\n // Don't specify an ID since one is automatically generated.\n delete entry.id;\n entry.queueName = this._queueName;\n\n await this._db.add(OBJECT_STORE_NAME, entry);\n }\n\n /**\n * Preppend an entry first in the queue.\n *\n * @param {Object} entry\n * @param {Object} entry.requestData\n * @param {number} [entry.timestamp]\n * @param {Object} [entry.metadata]\n * @private\n */\n async unshiftEntry(entry) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(entry, 'object', {\n moduleName: 'workbox-background-sync',\n className: 'QueueStore',\n funcName: 'unshiftEntry',\n paramName: 'entry',\n });\n assert.isType(entry.requestData, 'object', {\n moduleName: 'workbox-background-sync',\n className: 'QueueStore',\n funcName: 'unshiftEntry',\n paramName: 'entry.requestData',\n });\n }\n\n const [firstEntry] = await this._db.getAllMatching(OBJECT_STORE_NAME, {\n count: 1,\n });\n\n if (firstEntry) {\n // Pick an ID one less than the lowest ID in the object store.\n entry.id = firstEntry.id - 1;\n } else {\n // Otherwise let the auto-incrementor assign the ID.\n delete entry.id;\n }\n entry.queueName = this._queueName;\n\n await this._db.add(OBJECT_STORE_NAME, entry);\n }\n\n /**\n * Removes and returns the last entry in the queue matching the `queueName`.\n *\n * @return {Promise}\n * @private\n */\n async popEntry() {\n return this._removeEntry({direction: 'prev'});\n }\n\n /**\n * Removes and returns the first entry in the queue matching the `queueName`.\n *\n * @return {Promise}\n * @private\n */\n async shiftEntry() {\n return this._removeEntry({direction: 'next'});\n }\n\n /**\n * Returns all entries in the store matching the `queueName`.\n *\n * @param {Object} options See workbox.backgroundSync.Queue~getAll}\n * @return {Promise>}\n * @private\n */\n async getAll() {\n return await this._db.getAllMatching(OBJECT_STORE_NAME, {\n index: INDEXED_PROP,\n query: IDBKeyRange.only(this._queueName),\n });\n }\n\n /**\n * Deletes the entry for the given ID.\n *\n * WARNING: this method does not ensure the deleted enry belongs to this\n * queue (i.e. matches the `queueName`). But this limitation is acceptable\n * as this class is not publicly exposed. An additional check would make\n * this method slower than it needs to be.\n *\n * @private\n * @param {number} id\n */\n async deleteEntry(id) {\n await this._db.delete(OBJECT_STORE_NAME, id);\n }\n\n /**\n * Removes and returns the first or last entry in the queue (based on the\n * `direction` argument) matching the `queueName`.\n *\n * @return {Promise}\n * @private\n */\n async _removeEntry({direction}) {\n const [entry] = await this._db.getAllMatching(OBJECT_STORE_NAME, {\n direction,\n index: INDEXED_PROP,\n query: IDBKeyRange.only(this._queueName),\n count: 1,\n });\n\n if (entry) {\n await this.deleteEntry(entry.id);\n return entry;\n }\n }\n\n /**\n * Upgrades the database given an `upgradeneeded` event.\n *\n * @param {Event} event\n * @private\n */\n _upgradeDb(event) {\n const db = event.target.result;\n\n if (event.oldVersion > 0 && event.oldVersion < DB_VERSION) {\n if (db.objectStoreNames.contains(OBJECT_STORE_NAME)) {\n db.deleteObjectStore(OBJECT_STORE_NAME);\n }\n }\n\n const objStore = db.createObjectStore(OBJECT_STORE_NAME, {\n autoIncrement: true,\n keyPath: 'id',\n });\n objStore.createIndex(INDEXED_PROP, INDEXED_PROP, {unique: false});\n }\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {assert} from 'workbox-core/_private/assert.mjs';\nimport '../_version.mjs';\n\n\nconst serializableProperties = [\n 'method',\n 'referrer',\n 'referrerPolicy',\n 'mode',\n 'credentials',\n 'cache',\n 'redirect',\n 'integrity',\n 'keepalive',\n];\n\n\n/**\n * A class to make it easier to serialize and de-serialize requests so they\n * can be stored in IndexedDB.\n *\n * @private\n */\nclass StorableRequest {\n /**\n * Converts a Request object to a plain object that can be structured\n * cloned or JSON-stringified.\n *\n * @param {Request} request\n * @return {Promise}\n *\n * @private\n */\n static async fromRequest(request) {\n const requestData = {\n url: request.url,\n headers: {},\n };\n\n // Set the body if present.\n if (request.method !== 'GET') {\n // Use ArrayBuffer to support non-text request bodies.\n // NOTE: we can't use Blobs becuse Safari doesn't support storing\n // Blobs in IndexedDB in some cases:\n // https://github.com/dfahlander/Dexie.js/issues/618#issuecomment-398348457\n requestData.body = await request.clone().arrayBuffer();\n }\n\n // Convert the headers from an iterable to an object.\n for (const [key, value] of request.headers.entries()) {\n requestData.headers[key] = value;\n }\n\n // Add all other serializable request properties\n for (const prop of serializableProperties) {\n if (request[prop] !== undefined) {\n requestData[prop] = request[prop];\n }\n }\n\n return new StorableRequest(requestData);\n }\n\n /**\n * Accepts an object of request data that can be used to construct a\n * `Request` but can also be stored in IndexedDB.\n *\n * @param {Object} requestData An object of request data that includes the\n * `url` plus any relevant properties of\n * [requestInit]{@link https://fetch.spec.whatwg.org/#requestinit}.\n * @private\n */\n constructor(requestData) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(requestData, 'object', {\n moduleName: 'workbox-background-sync',\n className: 'StorableRequest',\n funcName: 'constructor',\n paramName: 'requestData',\n });\n assert.isType(requestData.url, 'string', {\n moduleName: 'workbox-background-sync',\n className: 'StorableRequest',\n funcName: 'constructor',\n paramName: 'requestData.url',\n });\n }\n\n // If the request's mode is `navigate`, convert it to `same-origin` since\n // navigation requests can't be constructed via script.\n if (requestData.mode === 'navigate') {\n requestData.mode = 'same-origin';\n }\n\n this._requestData = requestData;\n }\n\n /**\n * Returns a deep clone of the instances `_requestData` object.\n *\n * @return {Object}\n *\n * @private\n */\n toObject() {\n const requestData = Object.assign({}, this._requestData);\n requestData.headers = Object.assign({}, this._requestData.headers);\n if (requestData.body) {\n requestData.body = requestData.body.slice(0);\n }\n\n return requestData;\n }\n\n /**\n * Converts this instance to a Request.\n *\n * @return {Request}\n *\n * @private\n */\n toRequest() {\n return new Request(this._requestData.url, this._requestData);\n }\n\n /**\n * Creates and returns a deep clone of the instance.\n *\n * @return {StorableRequest}\n *\n * @private\n */\n clone() {\n return new StorableRequest(this.toObject());\n }\n}\n\nexport {StorableRequest};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {WorkboxError} from 'workbox-core/_private/WorkboxError.mjs';\nimport {logger} from 'workbox-core/_private/logger.mjs';\nimport {assert} from 'workbox-core/_private/assert.mjs';\nimport {getFriendlyURL} from 'workbox-core/_private/getFriendlyURL.mjs';\nimport {QueueStore} from './lib/QueueStore.mjs';\nimport {StorableRequest} from './lib/StorableRequest.mjs';\nimport './_version.mjs';\n\n\nconst TAG_PREFIX = 'workbox-background-sync';\nconst MAX_RETENTION_TIME = 60 * 24 * 7; // 7 days in minutes\n\nconst queueNames = new Set();\n\n/**\n * A class to manage storing failed requests in IndexedDB and retrying them\n * later. All parts of the storing and replaying process are observable via\n * callbacks.\n *\n * @memberof workbox.backgroundSync\n */\nclass Queue {\n /**\n * Creates an instance of Queue with the given options\n *\n * @param {string} name The unique name for this queue. This name must be\n * unique as it's used to register sync events and store requests\n * in IndexedDB specific to this instance. An error will be thrown if\n * a duplicate name is detected.\n * @param {Object} [options]\n * @param {Function} [options.onSync] A function that gets invoked whenever\n * the 'sync' event fires. The function is invoked with an object\n * containing the `queue` property (referencing this instance), and you\n * can use the callback to customize the replay behavior of the queue.\n * When not set the `replayRequests()` method is called.\n * Note: if the replay fails after a sync event, make sure you throw an\n * error, so the browser knows to retry the sync event later.\n * @param {number} [options.maxRetentionTime=7 days] The amount of time (in\n * minutes) a request may be retried. After this amount of time has\n * passed, the request will be deleted from the queue.\n */\n constructor(name, {onSync, maxRetentionTime} = {}) {\n // Ensure the store name is not already being used\n if (queueNames.has(name)) {\n throw new WorkboxError('duplicate-queue-name', {name});\n } else {\n queueNames.add(name);\n }\n\n this._name = name;\n this._onSync = onSync || this.replayRequests;\n this._maxRetentionTime = maxRetentionTime || MAX_RETENTION_TIME;\n this._queueStore = new QueueStore(this._name);\n\n this._addSyncListener();\n }\n\n /**\n * @return {string}\n */\n get name() {\n return this._name;\n }\n\n /**\n * Stores the passed request in IndexedDB (with its timestamp and any\n * metadata) at the end of the queue.\n *\n * @param {Object} entry\n * @param {Request} entry.request The request to store in the queue.\n * @param {Object} [entry.metadata] Any metadata you want associated with the\n * stored request. When requests are replayed you'll have access to this\n * metadata object in case you need to modify the request beforehand.\n * @param {number} [entry.timestamp] The timestamp (Epoch time in\n * milliseconds) when the request was first added to the queue. This is\n * used along with `maxRetentionTime` to remove outdated requests. In\n * general you don't need to set this value, as it's automatically set\n * for you (defaulting to `Date.now()`), but you can update it if you\n * don't want particular requests to expire.\n */\n async pushRequest(entry) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(entry, 'object', {\n moduleName: 'workbox-background-sync',\n className: 'Queue',\n funcName: 'pushRequest',\n paramName: 'entry',\n });\n assert.isInstance(entry.request, Request, {\n moduleName: 'workbox-background-sync',\n className: 'Queue',\n funcName: 'pushRequest',\n paramName: 'entry.request',\n });\n }\n\n await this._addRequest(entry, 'push');\n }\n\n /**\n * Stores the passed request in IndexedDB (with its timestamp and any\n * metadata) at the beginning of the queue.\n *\n * @param {Object} entry\n * @param {Request} entry.request The request to store in the queue.\n * @param {Object} [entry.metadata] Any metadata you want associated with the\n * stored request. When requests are replayed you'll have access to this\n * metadata object in case you need to modify the request beforehand.\n * @param {number} [entry.timestamp] The timestamp (Epoch time in\n * milliseconds) when the request was first added to the queue. This is\n * used along with `maxRetentionTime` to remove outdated requests. In\n * general you don't need to set this value, as it's automatically set\n * for you (defaulting to `Date.now()`), but you can update it if you\n * don't want particular requests to expire.\n */\n async unshiftRequest(entry) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(entry, 'object', {\n moduleName: 'workbox-background-sync',\n className: 'Queue',\n funcName: 'unshiftRequest',\n paramName: 'entry',\n });\n assert.isInstance(entry.request, Request, {\n moduleName: 'workbox-background-sync',\n className: 'Queue',\n funcName: 'unshiftRequest',\n paramName: 'entry.request',\n });\n }\n\n await this._addRequest(entry, 'unshift');\n }\n\n /**\n * Removes and returns the last request in the queue (along with its\n * timestamp and any metadata). The returned object takes the form:\n * `{request, timestamp, metadata}`.\n *\n * @return {Promise}\n */\n async popRequest() {\n return this._removeRequest('pop');\n }\n\n /**\n * Removes and returns the first request in the queue (along with its\n * timestamp and any metadata). The returned object takes the form:\n * `{request, timestamp, metadata}`.\n *\n * @return {Promise}\n */\n async shiftRequest() {\n return this._removeRequest('shift');\n }\n\n /**\n * Returns all the entries that have not expired (per `maxRetentionTime`).\n * Any expired entries are removed from the queue.\n *\n * @return {Promise>}\n */\n async getAll() {\n const allEntries = await this._queueStore.getAll();\n const now = Date.now();\n\n const unexpiredEntries = [];\n for (const entry of allEntries) {\n // Ignore requests older than maxRetentionTime. Call this function\n // recursively until an unexpired request is found.\n const maxRetentionTimeInMs = this._maxRetentionTime * 60 * 1000;\n if (now - entry.timestamp > maxRetentionTimeInMs) {\n await this._queueStore.deleteEntry(entry.id);\n } else {\n unexpiredEntries.push(convertEntry(entry));\n }\n }\n\n return unexpiredEntries;\n }\n\n\n /**\n * Adds the entry to the QueueStore and registers for a sync event.\n *\n * @param {Object} entry\n * @param {Request} entry.request\n * @param {Object} [entry.metadata]\n * @param {number} [entry.timestamp=Date.now()]\n * @param {string} operation ('push' or 'unshift')\n * @private\n */\n async _addRequest(\n {request, metadata, timestamp = Date.now()}, operation) {\n const storableRequest = await StorableRequest.fromRequest(request.clone());\n const entry = {\n requestData: storableRequest.toObject(),\n timestamp,\n };\n\n // Only include metadata if it's present.\n if (metadata) {\n entry.metadata = metadata;\n }\n\n await this._queueStore[`${operation}Entry`](entry);\n\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Request for '${getFriendlyURL(request.url)}' has ` +\n `been added to background sync queue '${this._name}'.`);\n }\n\n // Don't register for a sync if we're in the middle of a sync. Instead,\n // we wait until the sync is complete and call register if\n // `this._requestsAddedDuringSync` is true.\n if (this._syncInProgress) {\n this._requestsAddedDuringSync = true;\n } else {\n await this.registerSync();\n }\n }\n\n /**\n * Removes and returns the first or last (depending on `operation`) entry\n * from the QueueStore that's not older than the `maxRetentionTime`.\n *\n * @param {string} operation ('pop' or 'shift')\n * @return {Object|undefined}\n * @private\n */\n async _removeRequest(operation) {\n const now = Date.now();\n const entry = await this._queueStore[`${operation}Entry`]();\n\n if (entry) {\n // Ignore requests older than maxRetentionTime. Call this function\n // recursively until an unexpired request is found.\n const maxRetentionTimeInMs = this._maxRetentionTime * 60 * 1000;\n if (now - entry.timestamp > maxRetentionTimeInMs) {\n return this._removeRequest(operation);\n }\n\n return convertEntry(entry);\n }\n }\n\n /**\n * Loops through each request in the queue and attempts to re-fetch it.\n * If any request fails to re-fetch, it's put back in the same position in\n * the queue (which registers a retry for the next sync event).\n */\n async replayRequests() {\n let entry;\n while (entry = await this.shiftRequest()) {\n try {\n await fetch(entry.request.clone());\n\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Request for '${getFriendlyURL(entry.request.url)}'` +\n `has been replayed in queue '${this._name}'`);\n }\n } catch (error) {\n await this.unshiftRequest(entry);\n\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Request for '${getFriendlyURL(entry.request.url)}'` +\n `failed to replay, putting it back in queue '${this._name}'`);\n }\n throw new WorkboxError('queue-replay-failed', {name: this._name});\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`All requests in queue '${this.name}' have successfully ` +\n `replayed; the queue is now empty!`);\n }\n }\n\n /**\n * Registers a sync event with a tag unique to this instance.\n */\n async registerSync() {\n if ('sync' in registration) {\n try {\n await registration.sync.register(`${TAG_PREFIX}:${this._name}`);\n } catch (err) {\n // This means the registration failed for some reason, possibly due to\n // the user disabling it.\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(\n `Unable to register sync event for '${this._name}'.`, err);\n }\n }\n }\n }\n\n /**\n * In sync-supporting browsers, this adds a listener for the sync event.\n * In non-sync-supporting browsers, this will retry the queue on service\n * worker startup.\n *\n * @private\n */\n _addSyncListener() {\n if ('sync' in registration) {\n self.addEventListener('sync', (event) => {\n if (event.tag === `${TAG_PREFIX}:${this._name}`) {\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Background sync for tag '${event.tag}'` +\n `has been received`);\n }\n\n const syncComplete = async () => {\n this._syncInProgress = true;\n\n let syncError;\n try {\n await this._onSync({queue: this});\n } catch (error) {\n syncError = error;\n\n // Rethrow the error. Note: the logic in the finally clause\n // will run before this gets rethrown.\n throw syncError;\n } finally {\n // New items may have been added to the queue during the sync,\n // so we need to register for a new sync if that's happened...\n // Unless there was an error during the sync, in which\n // case the browser will automatically retry later, as long\n // as `event.lastChance` is not true.\n if (this._requestsAddedDuringSync &&\n !(syncError && !event.lastChance)) {\n await this.registerSync();\n }\n\n this._syncInProgress = false;\n this._requestsAddedDuringSync = false;\n }\n };\n event.waitUntil(syncComplete());\n }\n });\n } else {\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Background sync replaying without background sync event`);\n }\n // If the browser doesn't support background sync, retry\n // every time the service worker starts up as a fallback.\n this._onSync({queue: this});\n }\n }\n\n /**\n * Returns the set of queue names. This is primarily used to reset the list\n * of queue names in tests.\n *\n * @return {Set}\n *\n * @private\n */\n static get _queueNames() {\n return queueNames;\n }\n}\n\n\n/**\n * Converts a QueueStore entry into the format exposed by Queue. This entails\n * converting the request data into a real request and omitting the `id` and\n * `queueName` properties.\n *\n * @param {Object} queueStoreEntry\n * @return {Object}\n * @private\n */\nconst convertEntry = (queueStoreEntry) => {\n const queueEntry = {\n request: new StorableRequest(queueStoreEntry.requestData).toRequest(),\n timestamp: queueStoreEntry.timestamp,\n };\n if (queueStoreEntry.metadata) {\n queueEntry.metadata = queueStoreEntry.metadata;\n }\n return queueEntry;\n};\n\nexport {Queue};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {Queue} from './Queue.mjs';\nimport './_version.mjs';\n\n/**\n * A class implementing the `fetchDidFail` lifecycle callback. This makes it\n * easier to add failed requests to a background sync Queue.\n *\n * @memberof workbox.backgroundSync\n */\nclass Plugin {\n /**\n * @param {...*} queueArgs Args to forward to the composed Queue instance.\n * See the [Queue]{@link workbox.backgroundSync.Queue} documentation for\n * parameter details.\n */\n constructor(...queueArgs) {\n this._queue = new Queue(...queueArgs);\n this.fetchDidFail = this.fetchDidFail.bind(this);\n }\n\n /**\n * @param {Object} options\n * @param {Request} options.request\n * @private\n */\n async fetchDidFail({request}) {\n await this._queue.pushRequest({request});\n }\n}\n\nexport {Plugin};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {Queue} from './Queue.mjs';\nimport {Plugin} from './Plugin.mjs';\nimport './_version.mjs';\n\n\n/**\n * @namespace workbox.backgroundSync\n */\n\nexport {\n Queue,\n Plugin,\n};\n"],"names":["self","_","e","DB_VERSION","DB_NAME","OBJECT_STORE_NAME","INDEXED_PROP","QueueStore","constructor","queueName","_queueName","_db","DBWrapper","onupgradeneeded","_upgradeDb","pushEntry","entry","assert","isType","moduleName","className","funcName","paramName","requestData","id","add","unshiftEntry","firstEntry","getAllMatching","count","popEntry","_removeEntry","direction","shiftEntry","getAll","index","query","IDBKeyRange","only","deleteEntry","delete","event","db","target","result","oldVersion","objectStoreNames","contains","deleteObjectStore","objStore","createObjectStore","autoIncrement","keyPath","createIndex","unique","serializableProperties","StorableRequest","fromRequest","request","url","headers","method","body","clone","arrayBuffer","key","value","entries","prop","undefined","mode","_requestData","toObject","Object","assign","slice","toRequest","Request","TAG_PREFIX","MAX_RETENTION_TIME","queueNames","Set","Queue","name","onSync","maxRetentionTime","has","WorkboxError","_name","_onSync","replayRequests","_maxRetentionTime","_queueStore","_addSyncListener","pushRequest","isInstance","_addRequest","unshiftRequest","popRequest","_removeRequest","shiftRequest","allEntries","now","Date","unexpiredEntries","maxRetentionTimeInMs","timestamp","push","convertEntry","metadata","operation","storableRequest","logger","log","getFriendlyURL","_syncInProgress","_requestsAddedDuringSync","registerSync","fetch","error","registration","sync","register","err","warn","addEventListener","tag","syncComplete","syncError","queue","lastChance","waitUntil","_queueNames","queueStoreEntry","queueEntry","Plugin","queueArgs","_queue","fetchDidFail","bind"],"mappings":";;;;EAAA,IAAG;EAACA,EAAAA,IAAI,CAAC,+BAAD,CAAJ,IAAuCC,CAAC,EAAxC;EAA2C,CAA/C,CAA+C,OAAMC,CAAN,EAAQ;;ECAvD;;;;;;;AAQA,EAKA,MAAMC,UAAU,GAAG,CAAnB;EACA,MAAMC,OAAO,GAAG,yBAAhB;EACA,MAAMC,iBAAiB,GAAG,UAA1B;EACA,MAAMC,YAAY,GAAG,WAArB;EAEA;;;;;;;AAMA,EAAO,MAAMC,UAAN,CAAiB;EACtB;;;;;;;EAOAC,EAAAA,WAAW,CAACC,SAAD,EAAY;EACrB,SAAKC,UAAL,GAAkBD,SAAlB;EACA,SAAKE,GAAL,GAAW,IAAIC,uBAAJ,CAAcR,OAAd,EAAuBD,UAAvB,EAAmC;EAC5CU,MAAAA,eAAe,EAAE,KAAKC;EADsB,KAAnC,CAAX;EAGD;EAED;;;;;;;;;;;EASA,QAAMC,SAAN,CAAgBC,KAAhB,EAAuB;EACrB,IAA2C;EACzCC,MAAAA,iBAAM,CAACC,MAAP,CAAcF,KAAd,EAAqB,QAArB,EAA+B;EAC7BG,QAAAA,UAAU,EAAE,yBADiB;EAE7BC,QAAAA,SAAS,EAAE,YAFkB;EAG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