Socket
Socket
Sign inDemoInstall

workbox-core

Package Overview
Dependencies
Maintainers
4
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workbox-core - npm Package Compare versions

Comparing version 5.0.0-alpha.0 to 5.0.0-alpha.1

_private.d.ts

2837

build/workbox-core.dev.js
this.workbox = this.workbox || {};
this.workbox.core = (function (exports) {
'use strict';
'use strict';
try {
self['workbox:core:5.0.0-alpha.0'] && _();
} catch (e) {} // eslint-disable-line
// @ts-ignore
try {
self['workbox:core:5.0.0-alpha.1'] && _();
} catch (e) {}
/*
Copyright 2019 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 logger = (() => {
let inGroup = false;
const methodToColorMap = {
debug: `#7f8c8d`,
// Gray
log: `#2ecc71`,
// Green
warn: `#f39c12`,
// Yellow
error: `#c0392b`,
// Red
groupCollapsed: `#3498db`,
// Blue
groupEnd: null // No colored prefix on groupEnd
/*
Copyright 2019 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 logger = (() => {
let inGroup = false;
const methodToColorMap = {
debug: `#7f8c8d`,
log: `#2ecc71`,
warn: `#f39c12`,
error: `#c0392b`,
groupCollapsed: `#3498db`,
groupEnd: null
};
};
const print = function (method, args) {
if (method === 'groupCollapsed') {
// Safari doesn't print all console.groupCollapsed() arguments:
// https://bugs.webkit.org/show_bug.cgi?id=182754
if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
console[method](...args);
return;
}
}
const print = function (method, args) {
if (method === 'groupCollapsed') {
// Safari doesn't print all console.groupCollapsed() arguments:
// https://bugs.webkit.org/show_bug.cgi?id=182754
if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
console[method](...args);
return;
const styles = [`background: ${methodToColorMap[method]}`, `border-radius: 0.5em`, `color: white`, `font-weight: bold`, `padding: 2px 0.5em`]; // When in a group, the workbox prefix is not displayed.
const logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];
console[method](...logPrefix, ...args);
if (method === 'groupCollapsed') {
inGroup = true;
}
}
const styles = [`background: ${methodToColorMap[method]}`, `border-radius: 0.5em`, `color: white`, `font-weight: bold`, `padding: 2px 0.5em`]; // When in a group, the workbox prefix is not displayed.
if (method === 'groupEnd') {
inGroup = false;
}
};
const logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];
console[method](...logPrefix, ...args);
const api = {};
const loggerMethods = Object.keys(methodToColorMap);
if (method === 'groupCollapsed') {
inGroup = true;
}
for (const key of loggerMethods) {
const method = key;
if (method === 'groupEnd') {
inGroup = false;
api[method] = (...args) => {
print(method, args);
};
}
};
const api = {};
return api;
})();
for (const method of Object.keys(methodToColorMap)) {
api[method] = (...args) => {
print(method, args);
};
}
/*
Copyright 2018 Google LLC
return api;
})();
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 messages = {
'invalid-value': ({
paramName,
validValueDescription,
value
}) => {
if (!paramName || !validValueDescription) {
throw new Error(`Unexpected input to 'invalid-value' error.`);
}
/*
Copyright 2018 Google LLC
return `The '${paramName}' parameter was given a value with an ` + `unexpected value. ${validValueDescription} Received a value of ` + `${JSON.stringify(value)}.`;
},
'not-in-sw': ({
moduleName
}) => {
if (!moduleName) {
throw new Error(`Unexpected input to 'not-in-sw' error.`);
}
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 messages = {
'invalid-value': ({
paramName,
validValueDescription,
value
}) => {
if (!paramName || !validValueDescription) {
throw new Error(`Unexpected input to 'invalid-value' error.`);
}
return `The '${moduleName}' must be used in a service worker.`;
},
'not-an-array': ({
moduleName,
className,
funcName,
paramName
}) => {
if (!moduleName || !className || !funcName || !paramName) {
throw new Error(`Unexpected input to 'not-an-array' error.`);
}
return `The '${paramName}' parameter was given a value with an ` + `unexpected value. ${validValueDescription} Received a value of ` + `${JSON.stringify(value)}.`;
},
'not-in-sw': ({
moduleName
}) => {
if (!moduleName) {
throw new Error(`Unexpected input to 'not-in-sw' error.`);
}
return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className}.${funcName}()' must be an array.`;
},
'incorrect-type': ({
expectedType,
paramName,
moduleName,
className,
funcName
}) => {
if (!expectedType || !paramName || !moduleName || !funcName) {
throw new Error(`Unexpected input to 'incorrect-type' error.`);
}
return `The '${moduleName}' must be used in a service worker.`;
},
'not-an-array': ({
moduleName,
className,
funcName,
paramName
}) => {
if (!moduleName || !className || !funcName || !paramName) {
throw new Error(`Unexpected input to 'not-an-array' error.`);
}
return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className ? className + '.' : ''}` + `${funcName}()' must be of type ${expectedType}.`;
},
'incorrect-class': ({
expectedClass,
paramName,
moduleName,
className,
funcName,
isReturnValueProblem
}) => {
if (!expectedClass || !moduleName || !funcName) {
throw new Error(`Unexpected input to 'incorrect-class' error.`);
}
return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className}.${funcName}()' must be an array.`;
},
'incorrect-type': ({
expectedType,
paramName,
moduleName,
className,
funcName
}) => {
if (!expectedType || !paramName || !moduleName || !funcName) {
throw new Error(`Unexpected input to 'incorrect-type' error.`);
}
if (isReturnValueProblem) {
return `The return value from ` + `'${moduleName}.${className ? className + '.' : ''}${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;
}
return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className ? className + '.' : ''}` + `${funcName}()' must be of type ${expectedType}.`;
},
'incorrect-class': ({
expectedClass,
paramName,
moduleName,
className,
funcName,
isReturnValueProblem
}) => {
if (!expectedClass || !moduleName || !funcName) {
throw new Error(`Unexpected input to 'incorrect-class' error.`);
}
return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className ? className + '.' : ''}${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;
},
'missing-a-method': ({
expectedMethod,
paramName,
moduleName,
className,
funcName
}) => {
if (!expectedMethod || !paramName || !moduleName || !className || !funcName) {
throw new Error(`Unexpected input to 'missing-a-method' error.`);
}
if (isReturnValueProblem) {
return `The return value from ` + `'${moduleName}.${className ? className + '.' : ''}${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;
}
return `${moduleName}.${className}.${funcName}() expected the ` + `'${paramName}' parameter to expose a '${expectedMethod}' method.`;
},
'add-to-cache-list-unexpected-type': ({
entry
}) => {
return `An unexpected entry was passed to ` + `'workbox-precaching.PrecacheController.addToCacheList()' The entry ` + `'${JSON.stringify(entry)}' isn't supported. You must supply an array of ` + `strings with one or more characters, objects with a url property or ` + `Request objects.`;
},
'add-to-cache-list-conflicting-entries': ({
firstEntry,
secondEntry
}) => {
if (!firstEntry || !secondEntry) {
throw new Error(`Unexpected input to ` + `'add-to-cache-list-duplicate-entries' error.`);
}
return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className ? className + '.' : ''}${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;
},
'missing-a-method': ({
expectedMethod,
paramName,
moduleName,
className,
funcName
}) => {
if (!expectedMethod || !paramName || !moduleName || !className || !funcName) {
throw new Error(`Unexpected input to 'missing-a-method' error.`);
}
return `Two of the entries passed to ` + `'workbox-precaching.PrecacheController.addToCacheList()' had the URL ` + `${firstEntry._entryId} but different revision details. Workbox is ` + `is unable to cache and version the asset correctly. Please remove one ` + `of the entries.`;
},
'plugin-error-request-will-fetch': ({
thrownError
}) => {
if (!thrownError) {
throw new Error(`Unexpected input to ` + `'plugin-error-request-will-fetch', error.`);
}
return `${moduleName}.${className}.${funcName}() expected the ` + `'${paramName}' parameter to expose a '${expectedMethod}' method.`;
},
'add-to-cache-list-unexpected-type': ({
entry
}) => {
return `An unexpected entry was passed to ` + `'workbox-precaching.PrecacheController.addToCacheList()' The entry ` + `'${JSON.stringify(entry)}' isn't supported. You must supply an array of ` + `strings with one or more characters, objects with a url property or ` + `Request objects.`;
},
'add-to-cache-list-conflicting-entries': ({
firstEntry,
secondEntry
}) => {
if (!firstEntry || !secondEntry) {
throw new Error(`Unexpected input to ` + `'add-to-cache-list-duplicate-entries' error.`);
}
return `An error was thrown by a plugins 'requestWillFetch()' method. ` + `The thrown error message was: '${thrownError.message}'.`;
},
'invalid-cache-name': ({
cacheNameId,
value
}) => {
if (!cacheNameId) {
throw new Error(`Expected a 'cacheNameId' for error 'invalid-cache-name'`);
}
return `Two of the entries passed to ` + `'workbox-precaching.PrecacheController.addToCacheList()' had the URL ` + `${firstEntry._entryId} but different revision details. Workbox is ` + `is unable to cache and version the asset correctly. Please remove one ` + `of the entries.`;
},
'plugin-error-request-will-fetch': ({
thrownError
}) => {
if (!thrownError) {
throw new Error(`Unexpected input to ` + `'plugin-error-request-will-fetch', error.`);
}
return `You must provide a name containing at least one character for ` + `setCacheDeatils({${cacheNameId}: '...'}). Received a value of ` + `'${JSON.stringify(value)}'`;
},
'unregister-route-but-not-found-with-method': ({
method
}) => {
if (!method) {
throw new Error(`Unexpected input to ` + `'unregister-route-but-not-found-with-method' error.`);
}
return `An error was thrown by a plugins 'requestWillFetch()' method. ` + `The thrown error message was: '${thrownError.message}'.`;
},
'invalid-cache-name': ({
cacheNameId,
value
}) => {
if (!cacheNameId) {
throw new Error(`Expected a 'cacheNameId' for error 'invalid-cache-name'`);
}
return `The route you're trying to unregister was not previously ` + `registered for the method type '${method}'.`;
},
'unregister-route-route-not-registered': () => {
return `The route you're trying to unregister was not previously ` + `registered.`;
},
'queue-replay-failed': ({
name
}) => {
return `Replaying the background sync queue '${name}' failed.`;
},
'duplicate-queue-name': ({
name
}) => {
return `The Queue name '${name}' is already being used. ` + `All instances of backgroundSync.Queue must be given unique names.`;
},
'expired-test-without-max-age': ({
methodName,
paramName
}) => {
return `The '${methodName}()' method can only be used when the ` + `'${paramName}' is used in the constructor.`;
},
'unsupported-route-type': ({
moduleName,
className,
funcName,
paramName
}) => {
return `The supplied '${paramName}' parameter was an unsupported type. ` + `Please check the docs for ${moduleName}.${className}.${funcName} for ` + `valid input types.`;
},
'not-array-of-class': ({
value,
expectedClass,
moduleName,
className,
funcName,
paramName
}) => {
return `The supplied '${paramName}' parameter must be an array of ` + `'${expectedClass}' objects. Received '${JSON.stringify(value)},'. ` + `Please check the call to ${moduleName}.${className}.${funcName}() ` + `to fix the issue.`;
},
'max-entries-or-age-required': ({
moduleName,
className,
funcName
}) => {
return `You must define either config.maxEntries or config.maxAgeSeconds` + `in ${moduleName}.${className}.${funcName}`;
},
'statuses-or-headers-required': ({
moduleName,
className,
funcName
}) => {
return `You must define either config.statuses or config.headers` + `in ${moduleName}.${className}.${funcName}`;
},
'invalid-string': ({
moduleName,
funcName,
paramName
}) => {
if (!paramName || !moduleName || !funcName) {
throw new Error(`Unexpected input to 'invalid-string' error.`);
}
return `You must provide a name containing at least one character for ` + `setCacheDeatils({${cacheNameId}: '...'}). Received a value of ` + `'${JSON.stringify(value)}'`;
},
'unregister-route-but-not-found-with-method': ({
method
}) => {
if (!method) {
throw new Error(`Unexpected input to ` + `'unregister-route-but-not-found-with-method' error.`);
}
return `When using strings, the '${paramName}' parameter must start with ` + `'http' (for cross-origin matches) or '/' (for same-origin matches). ` + `Please see the docs for ${moduleName}.${funcName}() for ` + `more info.`;
},
'channel-name-required': () => {
return `You must provide a channelName to construct a ` + `BroadcastCacheUpdate instance.`;
},
'invalid-responses-are-same-args': () => {
return `The arguments passed into responsesAreSame() appear to be ` + `invalid. Please ensure valid Responses are used.`;
},
'expire-custom-caches-only': () => {
return `You must provide a 'cacheName' property when using the ` + `expiration plugin with a runtime caching strategy.`;
},
'unit-must-be-bytes': ({
normalizedRangeHeader
}) => {
if (!normalizedRangeHeader) {
throw new Error(`Unexpected input to 'unit-must-be-bytes' error.`);
}
return `The route you're trying to unregister was not previously ` + `registered for the method type '${method}'.`;
},
'unregister-route-route-not-registered': () => {
return `The route you're trying to unregister was not previously ` + `registered.`;
},
'queue-replay-failed': ({
name
}) => {
return `Replaying the background sync queue '${name}' failed.`;
},
'duplicate-queue-name': ({
name
}) => {
return `The Queue name '${name}' is already being used. ` + `All instances of backgroundSync.Queue must be given unique names.`;
},
'expired-test-without-max-age': ({
methodName,
paramName
}) => {
return `The '${methodName}()' method can only be used when the ` + `'${paramName}' is used in the constructor.`;
},
'unsupported-route-type': ({
moduleName,
className,
funcName,
paramName
}) => {
return `The supplied '${paramName}' parameter was an unsupported type. ` + `Please check the docs for ${moduleName}.${className}.${funcName} for ` + `valid input types.`;
},
'not-array-of-class': ({
value,
expectedClass,
moduleName,
className,
funcName,
paramName
}) => {
return `The supplied '${paramName}' parameter must be an array of ` + `'${expectedClass}' objects. Received '${JSON.stringify(value)},'. ` + `Please check the call to ${moduleName}.${className}.${funcName}() ` + `to fix the issue.`;
},
'max-entries-or-age-required': ({
moduleName,
className,
funcName
}) => {
return `You must define either config.maxEntries or config.maxAgeSeconds` + `in ${moduleName}.${className}.${funcName}`;
},
'statuses-or-headers-required': ({
moduleName,
className,
funcName
}) => {
return `You must define either config.statuses or config.headers` + `in ${moduleName}.${className}.${funcName}`;
},
'invalid-string': ({
moduleName,
className,
funcName,
paramName
}) => {
if (!paramName || !moduleName || !funcName) {
throw new Error(`Unexpected input to 'invalid-string' error.`);
}
return `The 'unit' portion of the Range header must be set to 'bytes'. ` + `The Range header provided was "${normalizedRangeHeader}"`;
},
'single-range-only': ({
normalizedRangeHeader
}) => {
if (!normalizedRangeHeader) {
throw new Error(`Unexpected input to 'single-range-only' error.`);
}
return `When using strings, the '${paramName}' parameter must start with ` + `'http' (for cross-origin matches) or '/' (for same-origin matches). ` + `Please see the docs for ${moduleName}.${funcName}() for ` + `more info.`;
},
'channel-name-required': () => {
return `You must provide a channelName to construct a ` + `BroadcastCacheUpdate instance.`;
},
'invalid-responses-are-same-args': () => {
return `The arguments passed into responsesAreSame() appear to be ` + `invalid. Please ensure valid Responses are used.`;
},
'expire-custom-caches-only': () => {
return `You must provide a 'cacheName' property when using the ` + `expiration plugin with a runtime caching strategy.`;
},
'unit-must-be-bytes': ({
normalizedRangeHeader
}) => {
if (!normalizedRangeHeader) {
throw new Error(`Unexpected input to 'unit-must-be-bytes' error.`);
}
return `Multiple ranges are not supported. Please use a single start ` + `value, and optional end value. The Range header provided was ` + `"${normalizedRangeHeader}"`;
},
'invalid-range-values': ({
normalizedRangeHeader
}) => {
if (!normalizedRangeHeader) {
throw new Error(`Unexpected input to 'invalid-range-values' error.`);
}
return `The 'unit' portion of the Range header must be set to 'bytes'. ` + `The Range header provided was "${normalizedRangeHeader}"`;
},
'single-range-only': ({
normalizedRangeHeader
}) => {
if (!normalizedRangeHeader) {
throw new Error(`Unexpected input to 'single-range-only' error.`);
}
return `The Range header is missing both start and end values. At least ` + `one of those values is needed. The Range header provided was ` + `"${normalizedRangeHeader}"`;
},
'no-range-header': () => {
return `No Range header was found in the Request provided.`;
},
'range-not-satisfiable': ({
size,
start,
end
}) => {
return `The start (${start}) and end (${end}) values in the Range are ` + `not satisfiable by the cached response, which is ${size} bytes.`;
},
'attempt-to-cache-non-get-request': ({
url,
method
}) => {
return `Unable to cache '${url}' because it is a '${method}' request and ` + `only 'GET' requests can be cached.`;
},
'cache-put-with-no-response': ({
url
}) => {
return `There was an attempt to cache '${url}' but the response was not ` + `defined.`;
},
'no-response': ({
url,
error
}) => {
let message = `The strategy could not generate a response for '${url}'.`;
return `Multiple ranges are not supported. Please use a single start ` + `value, and optional end value. The Range header provided was ` + `"${normalizedRangeHeader}"`;
},
'invalid-range-values': ({
normalizedRangeHeader
}) => {
if (!normalizedRangeHeader) {
throw new Error(`Unexpected input to 'invalid-range-values' error.`);
}
if (error) {
message += ` The underlying error is ${error}.`;
}
return `The Range header is missing both start and end values. At least ` + `one of those values is needed. The Range header provided was ` + `"${normalizedRangeHeader}"`;
},
'no-range-header': () => {
return `No Range header was found in the Request provided.`;
},
'range-not-satisfiable': ({
size,
start,
end
}) => {
return `The start (${start}) and end (${end}) values in the Range are ` + `not satisfiable by the cached response, which is ${size} bytes.`;
},
'attempt-to-cache-non-get-request': ({
url,
method
}) => {
return `Unable to cache '${url}' because it is a '${method}' request and ` + `only 'GET' requests can be cached.`;
},
'cache-put-with-no-response': ({
url
}) => {
return `There was an attempt to cache '${url}' but the response was not ` + `defined.`;
},
'no-response': ({
url,
error
}) => {
let message = `The strategy could not generate a response for '${url}'.`;
if (error) {
message += ` The underlying error is ${error}.`;
return message;
},
'bad-precaching-response': ({
url,
status
}) => {
return `The precaching request for '${url}' failed with an HTTP ` + `status of ${status}.`;
}
};
return message;
},
'bad-precaching-response': ({
url,
status
}) => {
return `The precaching request for '${url}' failed with an HTTP ` + `status of ${status}.`;
}
};
/*
Copyright 2018 Google LLC
/*
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.
*/
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 generatorFunction = (code, details = {}) => {
const message = messages[code];
const generatorFunction = (code, ...args) => {
const message = messages[code];
if (!message) {
throw new Error(`Unable to find message for code '${code}'.`);
}
if (!message) {
throw new Error(`Unable to find message for code '${code}'.`);
}
return message(details);
};
return message(...args);
};
const messageGenerator = generatorFunction;
const messageGenerator = generatorFunction;
/*
Copyright 2018 Google LLC
/*
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.
*/
/**
* Workbox errors should be thrown with this class.
* This allows use to ensure the type easily in tests,
* helps developers identify errors from workbox
* easily and allows use to optimise error
* messages correctly.
*
* @private
*/
class WorkboxError extends Error {
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.
*/
/**
* Workbox errors should be thrown with this class.
* This allows use to ensure the type easily in tests,
* helps developers identify errors from workbox
* easily and allows use to optimise error
* messages correctly.
*
* @param {string} errorCode The error code that
* identifies this particular error.
* @param {Object=} details Any relevant arguments
* that will help developers identify issues should
* be added as a key on the context object.
* @private
*/
constructor(errorCode, details) {
let message = messageGenerator(errorCode, details);
super(message);
this.name = errorCode;
this.details = details;
}
}
class WorkboxError extends Error {
/**
*
* @param {string} errorCode The error code that
* identifies this particular error.
* @param {Object=} details Any relevant arguments
* that will help developers identify issues should
* be added as a key on the context object.
*/
constructor(errorCode, details) {
let message = messageGenerator(errorCode, details);
super(message);
this.name = errorCode;
this.details = details;
}
/*
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.
*/
/*
* This method returns true if the current context is a service worker.
*/
/*
Copyright 2018 Google LLC
const isSWEnv = moduleName => {
if (!('ServiceWorkerGlobalScope' in self)) {
throw new WorkboxError('not-in-sw', {
moduleName
});
}
};
/*
* This method throws if the supplied value is not an array.
* The destructed values are required to produce a meaningful error for users.
* The destructed and restructured object is so it's clear what is
* needed.
*/
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.
*/
/*
* This method returns true if the current context is a service worker.
*/
const isSWEnv = moduleName => {
if (!('ServiceWorkerGlobalScope' in self)) {
throw new WorkboxError('not-in-sw', {
moduleName
});
}
};
/*
* This method throws if the supplied value is not an array.
* The destructed values are required to produce a meaningful error for users.
* The destructed and restructured object is so it's clear what is
* needed.
*/
const isArray = (value, {
moduleName,
className,
funcName,
paramName
}) => {
if (!Array.isArray(value)) {
throw new WorkboxError('not-an-array', {
moduleName,
className,
funcName,
paramName
});
}
};
const hasMethod = (object, expectedMethod, {
moduleName,
className,
funcName,
paramName
}) => {
const type = typeof object[expectedMethod];
const isArray = (value, details) => {
if (!Array.isArray(value)) {
throw new WorkboxError('not-an-array', details);
}
};
if (type !== 'function') {
throw new WorkboxError('missing-a-method', {
paramName,
expectedMethod,
moduleName,
className,
funcName
});
}
};
const hasMethod = (object, expectedMethod, details) => {
const type = typeof object[expectedMethod];
const isType = (object, expectedType, {
moduleName,
className,
funcName,
paramName
}) => {
if (typeof object !== expectedType) {
throw new WorkboxError('incorrect-type', {
paramName,
expectedType,
moduleName,
className,
funcName
});
}
};
if (type !== 'function') {
details.expectedMethod = expectedMethod;
throw new WorkboxError('missing-a-method', details);
}
};
const isInstance = (object, expectedClass, {
moduleName,
className,
funcName,
paramName,
isReturnValueProblem
}) => {
if (!(object instanceof expectedClass)) {
throw new WorkboxError('incorrect-class', {
paramName,
expectedClass,
moduleName,
className,
funcName,
isReturnValueProblem
});
}
};
const isType = (object, expectedType, details) => {
if (typeof object !== expectedType) {
details.expectedType = expectedType;
throw new WorkboxError('incorrect-type', details);
}
};
const isOneOf = (value, validValues, {
paramName
}) => {
if (!validValues.includes(value)) {
throw new WorkboxError('invalid-value', {
paramName,
value,
validValueDescription: `Valid values are ${JSON.stringify(validValues)}.`
});
}
};
const isInstance = (object, expectedClass, details) => {
if (!(object instanceof expectedClass)) {
details.expectedClass = expectedClass;
throw new WorkboxError('incorrect-class', details);
}
};
const isArrayOfClass = (value, expectedClass, {
moduleName,
className,
funcName,
paramName
}) => {
const error = new WorkboxError('not-array-of-class', {
value,
expectedClass,
moduleName,
className,
funcName,
paramName
});
const isOneOf = (value, validValues, details) => {
if (!validValues.includes(value)) {
details.validValueDescription = `Valid values are ${JSON.stringify(validValues)}.`;
throw new WorkboxError('invalid-value', details);
}
};
if (!Array.isArray(value)) {
throw error;
}
const isArrayOfClass = (value, expectedClass, details) => {
const error = new WorkboxError('not-array-of-class', details);
for (let item of value) {
if (!(item instanceof expectedClass)) {
if (!Array.isArray(value)) {
throw error;
}
}
};
const finalAssertExports = {
hasMethod,
isArray,
isInstance,
isOneOf,
isSWEnv,
isType,
isArrayOfClass
};
for (let item of value) {
if (!(item instanceof expectedClass)) {
throw error;
}
}
};
/*
Copyright 2018 Google LLC
const finalAssertExports = {
hasMethod,
isArray,
isInstance,
isOneOf,
isSWEnv,
isType,
isArrayOfClass
};
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.
*/
/*
Copyright 2018 Google LLC
const quotaErrorCallbacks = new Set();
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.
*/
/*
Copyright 2019 Google LLC
const quotaErrorCallbacks = new Set();
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.
*/
/**
* Adds a function to the set of quotaErrorCallbacks that will be executed if
* there's a quota error.
*
* @param {Function} callback
* @memberof workbox.core
*/
/*
Copyright 2019 Google LLC
function registerQuotaErrorCallback(callback) {
{
finalAssertExports.isType(callback, 'function', {
moduleName: 'workbox-core',
funcName: 'register',
paramName: 'callback'
});
}
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.
*/
/**
* Adds a function to the set of quotaErrorCallbacks that will be executed if
* there's a quota error.
*
* @param {Function} callback
* @memberof workbox.core
*/
quotaErrorCallbacks.add(callback);
function registerQuotaErrorCallback(callback) {
{
finalAssertExports.isType(callback, 'function', {
moduleName: 'workbox-core',
funcName: 'register',
paramName: 'callback'
});
}
{
logger.log('Registered a callback to respond to quota errors.', callback);
quotaErrorCallbacks.add(callback);
{
logger.log('Registered a callback to respond to quota errors.', callback);
}
}
}
/*
Copyright 2018 Google LLC
/*
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 _cacheNameDetails = {
googleAnalytics: 'googleAnalytics',
precache: 'precache-v2',
prefix: 'workbox',
runtime: 'runtime',
suffix: self.registration.scope
};
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 _cacheNameDetails = {
googleAnalytics: 'googleAnalytics',
precache: 'precache-v2',
prefix: 'workbox',
runtime: 'runtime',
suffix: registration.scope
};
const _createCacheName = cacheName => {
return [_cacheNameDetails.prefix, cacheName, _cacheNameDetails.suffix].filter(value => value.length > 0).join('-');
};
const _createCacheName = cacheName => {
return [_cacheNameDetails.prefix, cacheName, _cacheNameDetails.suffix].filter(value => value && value.length > 0).join('-');
};
const cacheNames = {
updateDetails: details => {
Object.keys(_cacheNameDetails).forEach(key => {
if (typeof details[key] !== 'undefined') {
_cacheNameDetails[key] = details[key];
}
});
},
getGoogleAnalyticsName: userCacheName => {
return userCacheName || _createCacheName(_cacheNameDetails.googleAnalytics);
},
getPrecacheName: userCacheName => {
return userCacheName || _createCacheName(_cacheNameDetails.precache);
},
getPrefix: () => {
return _cacheNameDetails.prefix;
},
getRuntimeName: userCacheName => {
return userCacheName || _createCacheName(_cacheNameDetails.runtime);
},
getSuffix: () => {
return _cacheNameDetails.suffix;
}
};
const eachCacheNameDetail = fn => {
for (const key of Object.keys(_cacheNameDetails)) {
fn(key);
}
};
/*
Copyright 2018 Google LLC
const cacheNames = {
updateDetails: details => {
eachCacheNameDetail(key => {
if (typeof details[key] === 'string') {
_cacheNameDetails[key] = details[key];
}
});
},
getGoogleAnalyticsName: userCacheName => {
return userCacheName || _createCacheName(_cacheNameDetails.googleAnalytics);
},
getPrecacheName: userCacheName => {
return userCacheName || _createCacheName(_cacheNameDetails.precache);
},
getPrefix: () => {
return _cacheNameDetails.prefix;
},
getRuntimeName: userCacheName => {
return userCacheName || _createCacheName(_cacheNameDetails.runtime);
},
getSuffix: () => {
return _cacheNameDetails.suffix;
}
};
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.
*/
/*
Copyright 2018 Google LLC
const getFriendlyURL = url => {
const urlObj = new URL(url, location);
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.
*/
if (urlObj.origin === location.origin) {
return urlObj.pathname;
}
const getFriendlyURL = url => {
const urlObj = new URL(String(url), location.href);
return urlObj.href;
};
if (urlObj.origin === location.origin) {
return urlObj.pathname;
}
/*
Copyright 2018 Google LLC
return urlObj.href;
};
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.
*/
/**
* Runs all of the callback functions, one at a time sequentially, in the order
* in which they were registered.
*
* @memberof workbox.core
* @private
*/
/*
Copyright 2018 Google LLC
async function executeQuotaErrorCallbacks() {
{
logger.log(`About to run ${quotaErrorCallbacks.size} ` + `callbacks to clean up caches.`);
}
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.
*/
/**
* Runs all of the callback functions, one at a time sequentially, in the order
* in which they were registered.
*
* @memberof workbox.core
* @private
*/
for (const callback of quotaErrorCallbacks) {
await callback();
async function executeQuotaErrorCallbacks() {
{
logger.log(callback, 'is complete.');
logger.log(`About to run ${quotaErrorCallbacks.size} ` + `callbacks to clean up caches.`);
}
}
{
logger.log('Finished running callbacks.');
}
}
for (const callback of quotaErrorCallbacks) {
await callback();
/*
Copyright 2018 Google LLC
{
logger.log(callback, 'is complete.');
}
}
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 pluginEvents = {
CACHE_DID_UPDATE: 'cacheDidUpdate',
CACHE_KEY_WILL_BE_USED: 'cacheKeyWillBeUsed',
CACHE_WILL_UPDATE: 'cacheWillUpdate',
CACHED_RESPONSE_WILL_BE_USED: 'cachedResponseWillBeUsed',
FETCH_DID_FAIL: 'fetchDidFail',
FETCH_DID_SUCCEED: 'fetchDidSucceed',
REQUEST_WILL_FETCH: 'requestWillFetch'
};
{
logger.log('Finished running callbacks.');
}
}
/*
Copyright 2018 Google LLC
/*
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 pluginUtils = {
filter: (plugins, callbackName) => {
return plugins.filter(plugin => callbackName in plugin);
}
};
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 pluginUtils = {
filter: (plugins, callbackName) => {
return plugins.filter(plugin => callbackName in plugin);
}
};
/*
Copyright 2018 Google LLC
/*
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.
*/
/**
* Wrapper around cache.put().
*
* Will call `cacheDidUpdate` on plugins if the cache was updated, using
* `matchOptions` when determining what the old entry is.
*
* @param {Object} options
* @param {string} options.cacheName
* @param {Request} options.request
* @param {Response} options.response
* @param {Event} [options.event]
* @param {Array<Object>} [options.plugins=[]]
* @param {Object} [options.matchOptions]
*
* @private
* @memberof module:workbox-core
*/
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.
*/
/**
* Wrapper around cache.put().
*
* Will call `cacheDidUpdate` on plugins if the cache was updated, using
* `matchOptions` when determining what the old entry is.
*
* @param {Object} options
* @param {string} options.cacheName
* @param {Request} options.request
* @param {Response} options.response
* @param {Event} [options.event]
* @param {Array<Object>} [options.plugins=[]]
* @param {Object} [options.matchOptions]
*
* @private
* @memberof module:workbox-core
*/
const putWrapper = async ({
cacheName,
request,
response,
event,
plugins = [],
matchOptions
} = {}) => {
{
if (request.method && request.method !== 'GET') {
throw new WorkboxError('attempt-to-cache-non-get-request', {
url: getFriendlyURL(request.url),
method: request.method
});
}
}
const effectiveRequest = await _getEffectiveRequest({
plugins,
const putWrapper = async ({
cacheName,
request,
mode: 'write'
});
if (!response) {
response,
event,
plugins = [],
matchOptions
}) => {
{
logger.error(`Cannot cache non-existent response for ` + `'${getFriendlyURL(effectiveRequest.url)}'.`);
if (request.method && request.method !== 'GET') {
throw new WorkboxError('attempt-to-cache-non-get-request', {
url: getFriendlyURL(request.url),
method: request.method
});
}
}
throw new WorkboxError('cache-put-with-no-response', {
url: getFriendlyURL(effectiveRequest.url)
const effectiveRequest = await _getEffectiveRequest({
plugins,
request,
mode: 'write'
});
}
let responseToCache = await _isResponseSafeToCache({
event,
plugins,
response,
request: effectiveRequest
});
if (!response) {
{
logger.error(`Cannot cache non-existent response for ` + `'${getFriendlyURL(effectiveRequest.url)}'.`);
}
if (!responseToCache) {
{
logger.debug(`Response '${getFriendlyURL(effectiveRequest.url)}' will ` + `not be cached.`, responseToCache);
throw new WorkboxError('cache-put-with-no-response', {
url: getFriendlyURL(effectiveRequest.url)
});
}
return;
}
let responseToCache = await _isResponseSafeToCache({
event,
plugins,
response,
request: effectiveRequest
});
const cache = await caches.open(cacheName);
const updatePlugins = pluginUtils.filter(plugins, pluginEvents.CACHE_DID_UPDATE);
let oldResponse = updatePlugins.length > 0 ? await matchWrapper({
cacheName,
matchOptions,
request: effectiveRequest
}) : null;
if (!responseToCache) {
{
logger.debug(`Response '${getFriendlyURL(effectiveRequest.url)}' will ` + `not be cached.`, responseToCache);
}
{
logger.debug(`Updating the '${cacheName}' cache with a new Response for ` + `${getFriendlyURL(effectiveRequest.url)}.`);
}
try {
await cache.put(effectiveRequest, responseToCache);
} catch (error) {
// See https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-QuotaExceededError
if (error.name === 'QuotaExceededError') {
await executeQuotaErrorCallbacks();
return;
}
throw error;
}
for (let plugin of updatePlugins) {
await plugin[pluginEvents.CACHE_DID_UPDATE].call(plugin, {
const cache = await caches.open(cacheName);
const updatePlugins = pluginUtils.filter(plugins, "cacheDidUpdate"
/* CACHE_DID_UPDATE */
);
let oldResponse = updatePlugins.length > 0 ? await matchWrapper({
cacheName,
event,
oldResponse,
newResponse: responseToCache,
matchOptions,
request: effectiveRequest
});
}
};
/**
* This is a wrapper around cache.match().
*
* @param {Object} options
* @param {string} options.cacheName Name of the cache to match against.
* @param {Request} options.request The Request that will be used to look up
* cache entries.
* @param {Event} [options.event] The event that propted the action.
* @param {Object} [options.matchOptions] Options passed to cache.match().
* @param {Array<Object>} [options.plugins=[]] Array of plugins.
* @return {Response} A cached response if available.
*
* @private
* @memberof module:workbox-core
*/
}) : null;
{
logger.debug(`Updating the '${cacheName}' cache with a new Response for ` + `${getFriendlyURL(effectiveRequest.url)}.`);
}
const matchWrapper = async ({
cacheName,
request,
event,
matchOptions,
plugins = []
}) => {
const cache = await caches.open(cacheName);
const effectiveRequest = await _getEffectiveRequest({
plugins,
request,
mode: 'read'
});
let cachedResponse = await cache.match(effectiveRequest, matchOptions);
try {
await cache.put(effectiveRequest, responseToCache);
} catch (error) {
// See https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-QuotaExceededError
if (error.name === 'QuotaExceededError') {
await executeQuotaErrorCallbacks();
}
{
if (cachedResponse) {
logger.debug(`Found a cached response in '${cacheName}'.`);
} else {
logger.debug(`No cached response found in '${cacheName}'.`);
throw error;
}
}
for (const plugin of plugins) {
if (pluginEvents.CACHED_RESPONSE_WILL_BE_USED in plugin) {
cachedResponse = await plugin[pluginEvents.CACHED_RESPONSE_WILL_BE_USED].call(plugin, {
for (let plugin of updatePlugins) {
await plugin["cacheDidUpdate"
/* CACHE_DID_UPDATE */
].call(plugin, {
cacheName,
event,
matchOptions,
cachedResponse,
oldResponse,
newResponse: responseToCache,
request: effectiveRequest
});
}
};
/**
* This is a wrapper around cache.match().
*
* @param {Object} options
* @param {string} options.cacheName Name of the cache to match against.
* @param {Request} options.request The Request that will be used to look up
* cache entries.
* @param {Event} [options.event] The event that propted the action.
* @param {Object} [options.matchOptions] Options passed to cache.match().
* @param {Array<Object>} [options.plugins=[]] Array of plugins.
* @return {Response} A cached response if available.
*
* @private
* @memberof module:workbox-core
*/
{
if (cachedResponse) {
finalAssertExports.isInstance(cachedResponse, Response, {
moduleName: 'Plugin',
funcName: pluginEvents.CACHED_RESPONSE_WILL_BE_USED,
isReturnValueProblem: true
});
const matchWrapper = async ({
cacheName,
request,
event,
matchOptions,
plugins = []
}) => {
const cache = await caches.open(cacheName);
const effectiveRequest = await _getEffectiveRequest({
plugins,
request,
mode: 'read'
});
let cachedResponse = await cache.match(effectiveRequest, matchOptions);
{
if (cachedResponse) {
logger.debug(`Found a cached response in '${cacheName}'.`);
} else {
logger.debug(`No cached response found in '${cacheName}'.`);
}
}
for (const plugin of plugins) {
if ("cachedResponseWillBeUsed"
/* CACHED_RESPONSE_WILL_BE_USED */
in plugin) {
const pluginMethod = plugin["cachedResponseWillBeUsed"
/* CACHED_RESPONSE_WILL_BE_USED */
];
cachedResponse = await pluginMethod.call(plugin, {
cacheName,
event,
matchOptions,
cachedResponse,
request: effectiveRequest
});
{
if (cachedResponse) {
finalAssertExports.isInstance(cachedResponse, Response, {
moduleName: 'Plugin',
funcName: "cachedResponseWillBeUsed"
/* CACHED_RESPONSE_WILL_BE_USED */
,
isReturnValueProblem: true
});
}
}
}
}
}
return cachedResponse;
};
/**
* This method will call cacheWillUpdate on the available plugins (or use
* status === 200) to determine if the Response is safe and valid to cache.
*
* @param {Object} options
* @param {Request} options.request
* @param {Response} options.response
* @param {Event} [options.event]
* @param {Array<Object>} [options.plugins=[]]
* @return {Promise<Response>}
*
* @private
* @memberof module:workbox-core
*/
return cachedResponse;
};
/**
* This method will call cacheWillUpdate on the available plugins (or use
* status === 200) to determine if the Response is safe and valid to cache.
*
* @param {Object} options
* @param {Request} options.request
* @param {Response} options.response
* @param {Event} [options.event]
* @param {Array<Object>} [options.plugins=[]]
* @return {Promise<Response>}
*
* @private
* @memberof module:workbox-core
*/
const _isResponseSafeToCache = async ({
request,
response,
event,
plugins
}) => {
let responseToCache = response;
let pluginsUsed = false;
const _isResponseSafeToCache = async ({
request,
response,
event,
plugins = []
}) => {
let responseToCache = response;
let pluginsUsed = false;
for (let plugin of plugins) {
if (pluginEvents.CACHE_WILL_UPDATE in plugin) {
pluginsUsed = true;
responseToCache = await plugin[pluginEvents.CACHE_WILL_UPDATE].call(plugin, {
request,
response: responseToCache,
event
});
for (let plugin of plugins) {
if ("cacheWillUpdate"
/* CACHE_WILL_UPDATE */
in plugin) {
pluginsUsed = true;
const pluginMethod = plugin["cacheWillUpdate"
/* CACHE_WILL_UPDATE */
];
responseToCache = await pluginMethod.call(plugin, {
request,
response: responseToCache,
event
});
{
if (responseToCache) {
finalAssertExports.isInstance(responseToCache, Response, {
moduleName: 'Plugin',
funcName: pluginEvents.CACHE_WILL_UPDATE,
isReturnValueProblem: true
});
{
if (responseToCache) {
finalAssertExports.isInstance(responseToCache, Response, {
moduleName: 'Plugin',
funcName: "cacheWillUpdate"
/* CACHE_WILL_UPDATE */
,
isReturnValueProblem: true
});
}
}
}
if (!responseToCache) {
break;
if (!responseToCache) {
break;
}
}
}
}
if (!pluginsUsed) {
{
if (!responseToCache.status === 200) {
if (responseToCache.status === 0) {
logger.warn(`The response for '${request.url}' is an opaque ` + `response. The caching strategy that you're using will not ` + `cache opaque responses by default.`);
} else {
logger.debug(`The response for '${request.url}' returned ` + `a status code of '${response.status}' and won't be cached as a ` + `result.`);
if (!pluginsUsed) {
{
if (responseToCache) {
if (responseToCache.status !== 200) {
if (responseToCache.status === 0) {
logger.warn(`The response for '${request.url}' is an opaque ` + `response. The caching strategy that you're using will not ` + `cache opaque responses by default.`);
} else {
logger.debug(`The response for '${request.url}' returned ` + `a status code of '${response.status}' and won't be cached as a ` + `result.`);
}
}
}
}
responseToCache = responseToCache && responseToCache.status === 200 ? responseToCache : undefined;
}
responseToCache = responseToCache.status === 200 ? responseToCache : null;
}
return responseToCache ? responseToCache : null;
};
/**
* Checks the list of plugins for the cacheKeyWillBeUsed callback, and
* executes any of those callbacks found in sequence. The final `Request` object
* returned by the last plugin is treated as the cache key for cache reads
* and/or writes.
*
* @param {Object} options
* @param {Request} options.request
* @param {string} options.mode
* @param {Array<Object>} [options.plugins=[]]
* @return {Promise<Request>}
*
* @private
* @memberof module:workbox-core
*/
return responseToCache ? responseToCache : null;
};
/**
* Checks the list of plugins for the cacheKeyWillBeUsed callback, and
* executes any of those callbacks found in sequence. The final `Request` object
* returned by the last plugin is treated as the cache key for cache reads
* and/or writes.
*
* @param {Object} options
* @param {Request} options.request
* @param {string} options.mode
* @param {Array<Object>} [options.plugins=[]]
* @return {Promise<Request>}
*
* @private
* @memberof module:workbox-core
*/
const _getEffectiveRequest = async ({
request,
mode,
plugins = []
}) => {
const cacheKeyWillBeUsedPlugins = pluginUtils.filter(plugins, "cacheKeyWillBeUsed"
/* CACHE_KEY_WILL_BE_USED */
);
let effectiveRequest = request;
const _getEffectiveRequest = async ({
request,
mode,
plugins
}) => {
const cacheKeyWillBeUsedPlugins = pluginUtils.filter(plugins, pluginEvents.CACHE_KEY_WILL_BE_USED);
let effectiveRequest = request;
for (const plugin of cacheKeyWillBeUsedPlugins) {
effectiveRequest = await plugin["cacheKeyWillBeUsed"
/* CACHE_KEY_WILL_BE_USED */
].call(plugin, {
mode,
request: effectiveRequest
});
for (const plugin of cacheKeyWillBeUsedPlugins) {
effectiveRequest = await plugin[pluginEvents.CACHE_KEY_WILL_BE_USED].call(plugin, {
mode,
request: effectiveRequest
});
if (typeof effectiveRequest === 'string') {
effectiveRequest = new Request(effectiveRequest);
}
if (typeof effectiveRequest === 'string') {
effectiveRequest = new Request(effectiveRequest);
{
finalAssertExports.isInstance(effectiveRequest, Request, {
moduleName: 'Plugin',
funcName: "cacheKeyWillBeUsed"
/* CACHE_KEY_WILL_BE_USED */
,
isReturnValueProblem: true
});
}
}
{
finalAssertExports.isInstance(effectiveRequest, Request, {
moduleName: 'Plugin',
funcName: pluginEvents.CACHE_KEY_WILL_BE_USED,
isReturnValueProblem: true
});
}
}
return effectiveRequest;
};
return effectiveRequest;
};
const cacheWrapper = {
put: putWrapper,
match: matchWrapper
};
const cacheWrapper = {
put: putWrapper,
match: matchWrapper
};
/*
Copyright 2018 Google LLC
/*
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 that wraps common IndexedDB functionality in a promise-based API.
* It exposes all the underlying power and functionality of IndexedDB, but
* wraps the most commonly used features in a way that's much simpler to use.
*
* @private
*/
class DBWrapper {
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.
*/
/**
* @param {string} name
* @param {number} version
* @param {Object=} [callback]
* @param {!Function} [callbacks.onupgradeneeded]
* @param {!Function} [callbacks.onversionchange] Defaults to
* DBWrapper.prototype._onversionchange when not specified.
* @private
*/
constructor(name, version, {
onupgradeneeded,
onversionchange = this._onversionchange
} = {}) {
this._name = name;
this._version = version;
this._onupgradeneeded = onupgradeneeded;
this._onversionchange = onversionchange; // If this is null, it means the database isn't open.
this._db = null;
}
/**
* Returns the IDBDatabase instance (not normally needed).
* A class that wraps common IndexedDB functionality in a promise-based API.
* It exposes all the underlying power and functionality of IndexedDB, but
* wraps the most commonly used features in a way that's much simpler to use.
*

@@ -1030,684 +956,697 @@ * @private

class DBWrapper {
/**
* @param {string} name
* @param {number} version
* @param {Object=} [callback]
* @param {!Function} [callbacks.onupgradeneeded]
* @param {!Function} [callbacks.onversionchange] Defaults to
* DBWrapper.prototype._onversionchange when not specified.
* @private
*/
constructor(name, version, {
onupgradeneeded,
onversionchange
} = {}) {
this._db = null;
this._name = name;
this._version = version;
this._onupgradeneeded = onupgradeneeded;
get db() {
return this._db;
}
/**
* Opens a connected to an IDBDatabase, invokes any onupgradedneeded
* callback, and added an onversionchange callback to the database.
*
* @return {IDBDatabase}
* @private
*/
this._onversionchange = onversionchange || (() => this.close());
}
/**
* Returns the IDBDatabase instance (not normally needed).
* @return {IDBDatabase|undefined}
*
* @private
*/
async open() {
if (this._db) return;
this._db = await new Promise((resolve, reject) => {
// This flag is flipped to true if the timeout callback runs prior
// to the request failing or succeeding. Note: we use a timeout instead
// of an onblocked handler since there are cases where onblocked will
// never never run. A timeout better handles all possible scenarios:
// https://github.com/w3c/IndexedDB/issues/223
let openRequestTimedOut = false;
setTimeout(() => {
openRequestTimedOut = true;
reject(new Error('The open request was blocked and timed out'));
}, this.OPEN_TIMEOUT);
const openRequest = indexedDB.open(this._name, this._version);
get db() {
return this._db;
}
/**
* Opens a connected to an IDBDatabase, invokes any onupgradedneeded
* callback, and added an onversionchange callback to the database.
*
* @return {IDBDatabase}
* @private
*/
openRequest.onerror = () => reject(openRequest.error);
openRequest.onupgradeneeded = evt => {
if (openRequestTimedOut) {
openRequest.transaction.abort();
evt.target.result.close();
} else if (this._onupgradeneeded) {
this._onupgradeneeded(evt);
}
};
async open() {
if (this._db) return;
this._db = await new Promise((resolve, reject) => {
// This flag is flipped to true if the timeout callback runs prior
// to the request failing or succeeding. Note: we use a timeout instead
// of an onblocked handler since there are cases where onblocked will
// never never run. A timeout better handles all possible scenarios:
// https://github.com/w3c/IndexedDB/issues/223
let openRequestTimedOut = false;
setTimeout(() => {
openRequestTimedOut = true;
reject(new Error('The open request was blocked and timed out'));
}, this.OPEN_TIMEOUT);
const openRequest = indexedDB.open(this._name, this._version);
openRequest.onsuccess = ({
target
}) => {
const db = target.result;
openRequest.onerror = () => reject(openRequest.error);
if (openRequestTimedOut) {
db.close();
} else {
db.onversionchange = this._onversionchange.bind(this);
resolve(db);
}
};
});
return this;
}
/**
* Polyfills the native `getKey()` method. Note, this is overridden at
* runtime if the browser supports the native method.
*
* @param {string} storeName
* @param {*} query
* @return {Array}
* @private
*/
openRequest.onupgradeneeded = evt => {
if (openRequestTimedOut) {
openRequest.transaction.abort();
openRequest.result.close();
} else if (typeof this._onupgradeneeded === 'function') {
this._onupgradeneeded(evt);
}
};
openRequest.onsuccess = () => {
const db = openRequest.result;
async getKey(storeName, query) {
return (await this.getAllKeys(storeName, query, 1))[0];
}
/**
* Polyfills the native `getAll()` method. Note, this is overridden at
* runtime if the browser supports the native method.
*
* @param {string} storeName
* @param {*} query
* @param {number} count
* @return {Array}
* @private
*/
if (openRequestTimedOut) {
db.close();
} else {
db.onversionchange = this._onversionchange.bind(this);
resolve(db);
}
};
});
return this;
}
/**
* Polyfills the native `getKey()` method. Note, this is overridden at
* runtime if the browser supports the native method.
*
* @param {string} storeName
* @param {*} query
* @return {Array}
* @private
*/
async getAll(storeName, query, count) {
return await this.getAllMatching(storeName, {
query,
count
});
}
/**
* Polyfills the native `getAllKeys()` method. Note, this is overridden at
* runtime if the browser supports the native method.
*
* @param {string} storeName
* @param {*} query
* @param {number} count
* @return {Array}
* @private
*/
async getKey(storeName, query) {
return (await this.getAllKeys(storeName, query, 1))[0];
}
/**
* Polyfills the native `getAll()` method. Note, this is overridden at
* runtime if the browser supports the native method.
*
* @param {string} storeName
* @param {*} query
* @param {number} count
* @return {Array}
* @private
*/
async getAllKeys(storeName, query, count) {
return (await this.getAllMatching(storeName, {
query,
count,
includeKeys: true
})).map(({
key
}) => key);
}
/**
* Supports flexible lookup in an object store by specifying an index,
* query, direction, and count. This method returns an array of objects
* with the signature .
*
* @param {string} storeName
* @param {Object} [opts]
* @param {string} [opts.index] The index to use (if specified).
* @param {*} [opts.query]
* @param {IDBCursorDirection} [opts.direction]
* @param {number} [opts.count] The max number of results to return.
* @param {boolean} [opts.includeKeys] When true, the structure of the
* returned objects is changed from an array of values to an array of
* objects in the form {key, primaryKey, value}.
* @return {Array}
* @private
*/
async getAll(storeName, query, count) {
return await this.getAllMatching(storeName, {
query,
count
});
}
/**
* Polyfills the native `getAllKeys()` method. Note, this is overridden at
* runtime if the browser supports the native method.
*
* @param {string} storeName
* @param {*} query
* @param {number} count
* @return {Array}
* @private
*/
async getAllMatching(storeName, {
index,
query = null,
// IE errors if query === `undefined`.
direction = 'next',
count,
includeKeys
} = {}) {
return await this.transaction([storeName], 'readonly', (txn, done) => {
const store = txn.objectStore(storeName);
const target = index ? store.index(index) : store;
const results = [];
async getAllKeys(storeName, query, count) {
const entries = await this.getAllMatching(storeName, {
query,
count,
includeKeys: true
});
return entries.map(entry => entry.key);
}
/**
* Supports flexible lookup in an object store by specifying an index,
* query, direction, and count. This method returns an array of objects
* with the signature .
*
* @param {string} storeName
* @param {Object} [opts]
* @param {string} [opts.index] The index to use (if specified).
* @param {*} [opts.query]
* @param {IDBCursorDirection} [opts.direction]
* @param {number} [opts.count] The max number of results to return.
* @param {boolean} [opts.includeKeys] When true, the structure of the
* returned objects is changed from an array of values to an array of
* objects in the form {key, primaryKey, value}.
* @return {Array}
* @private
*/
target.openCursor(query, direction).onsuccess = ({
target
}) => {
const cursor = target.result;
if (cursor) {
const {
primaryKey,
key,
value
} = cursor;
results.push(includeKeys ? {
primaryKey,
key,
value
} : value);
async getAllMatching(storeName, {
index,
query = null,
// IE/Edge errors if query === `undefined`.
direction = 'next',
count,
includeKeys = false
} = {}) {
return await this.transaction([storeName], 'readonly', (txn, done) => {
const store = txn.objectStore(storeName);
const target = index ? store.index(index) : store;
const results = [];
const request = target.openCursor(query, direction);
if (count && results.length >= count) {
request.onsuccess = () => {
const cursor = request.result;
if (cursor) {
results.push(includeKeys ? cursor : cursor.value);
if (count && results.length >= count) {
done(results);
} else {
cursor.continue();
}
} else {
done(results);
} else {
cursor.continue();
}
} else {
done(results);
}
};
});
}
/**
* Accepts a list of stores, a transaction type, and a callback and
* performs a transaction. A promise is returned that resolves to whatever
* value the callback chooses. The callback holds all the transaction logic
* and is invoked with two arguments:
* 1. The IDBTransaction object
* 2. A `done` function, that's used to resolve the promise when
* when the transaction is done, if passed a value, the promise is
* resolved to that value.
*
* @param {Array<string>} storeNames An array of object store names
* involved in the transaction.
* @param {string} type Can be `readonly` or `readwrite`.
* @param {!Function} callback
* @return {*} The result of the transaction ran by the callback.
* @private
*/
};
});
}
/**
* Accepts a list of stores, a transaction type, and a callback and
* performs a transaction. A promise is returned that resolves to whatever
* value the callback chooses. The callback holds all the transaction logic
* and is invoked with two arguments:
* 1. The IDBTransaction object
* 2. A `done` function, that's used to resolve the promise when
* when the transaction is done, if passed a value, the promise is
* resolved to that value.
*
* @param {Array<string>} storeNames An array of object store names
* involved in the transaction.
* @param {string} type Can be `readonly` or `readwrite`.
* @param {!Function} callback
* @return {*} The result of the transaction ran by the callback.
* @private
*/
async transaction(storeNames, type, callback) {
await this.open();
return await new Promise((resolve, reject) => {
const txn = this._db.transaction(storeNames, type);
async transaction(storeNames, type, callback) {
await this.open();
return await new Promise((resolve, reject) => {
const txn = this._db.transaction(storeNames, type);
txn.onabort = ({
target
}) => reject(target.error);
txn.onabort = () => reject(txn.error);
txn.oncomplete = () => resolve();
txn.oncomplete = () => resolve();
callback(txn, value => resolve(value));
});
}
/**
* Delegates async to a native IDBObjectStore method.
*
* @param {string} method The method name.
* @param {string} storeName The object store name.
* @param {string} type Can be `readonly` or `readwrite`.
* @param {...*} args The list of args to pass to the native method.
* @return {*} The result of the transaction.
* @private
*/
callback(txn, value => resolve(value));
});
}
/**
* Delegates async to a native IDBObjectStore method.
*
* @param {string} method The method name.
* @param {string} storeName The object store name.
* @param {string} type Can be `readonly` or `readwrite`.
* @param {...*} args The list of args to pass to the native method.
* @return {*} The result of the transaction.
* @private
*/
async _call(method, storeName, type, ...args) {
const callback = (txn, done) => {
txn.objectStore(storeName)[method](...args).onsuccess = ({
target
}) => {
done(target.result);
async _call(method, storeName, type, ...args) {
const callback = (txn, done) => {
const objStore = txn.objectStore(storeName);
const request = objStore[method].apply(objStore, args);
request.onsuccess = () => done(request.result);
};
};
return await this.transaction([storeName], type, callback);
}
/**
* The default onversionchange handler, which closes the database so other
* connections can open without being blocked.
*
* @private
*/
return await this.transaction([storeName], type, callback);
}
/**
* Closes the connection opened by `DBWrapper.open()`. Generally this method
* doesn't need to be called since:
* 1. It's usually better to keep a connection open since opening
* a new connection is somewhat slow.
* 2. Connections are automatically closed when the reference is
* garbage collected.
* The primary use case for needing to close a connection is when another
* reference (typically in another tab) needs to upgrade it and would be
* blocked by the current, open connection.
*
* @private
*/
_onversionchange() {
this.close();
}
/**
* Closes the connection opened by `DBWrapper.open()`. Generally this method
* doesn't need to be called since:
* 1. It's usually better to keep a connection open since opening
* a new connection is somewhat slow.
* 2. Connections are automatically closed when the reference is
* garbage collected.
* The primary use case for needing to close a connection is when another
* reference (typically in another tab) needs to upgrade it and would be
* blocked by the current, open connection.
*
* @private
*/
close() {
if (this._db) {
this._db.close();
this._db = null;
}
}
close() {
if (this._db) {
this._db.close();
} // Exposed on the prototype to let users modify the default timeout on a
// per-instance or global basis.
this._db = null;
DBWrapper.prototype.OPEN_TIMEOUT = 2000; // Wrap native IDBObjectStore methods according to their mode.
const methodsToWrap = {
readonly: ['get', 'count', 'getKey', 'getAll', 'getAllKeys'],
readwrite: ['add', 'put', 'clear', 'delete']
};
for (const [mode, methods] of Object.entries(methodsToWrap)) {
for (const method of methods) {
if (method in IDBObjectStore.prototype) {
// Don't use arrow functions here since we're outside of the class.
DBWrapper.prototype[method] = async function (storeName, ...args) {
return await this._call(method, storeName, mode, ...args);
};
}
}
}
} // Exposed to let users modify the default timeout on a per-instance
// or global basis.
/*
Copyright 2018 Google LLC
DBWrapper.prototype.OPEN_TIMEOUT = 2000; // Wrap native IDBObjectStore methods according to their mode.
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.
*/
/**
* The Deferred class composes Promises in a way that allows for them to be
* resolved or rejected from outside the constructor. In most cases promises
* should be used directly, but Deferreds can be necessary when the logic to
* resolve a promise must be separate.
*
* @private
*/
const methodsToWrap = {
'readonly': ['get', 'count', 'getKey', 'getAll', 'getAllKeys'],
'readwrite': ['add', 'put', 'clear', 'delete']
};
class Deferred {
/**
* Creates a promise and exposes its resolve and reject functions as methods.
*/
constructor() {
this.promise = new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});
}
for (const [mode, methods] of Object.entries(methodsToWrap)) {
for (const method of methods) {
if (method in IDBObjectStore.prototype) {
// Don't use arrow functions here since we're outside of the class.
DBWrapper.prototype[method] = async function (storeName, ...args) {
return await this._call(method, storeName, mode, ...args);
};
}
}
}
/*
Copyright 2018 Google LLC
/*
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.
*/
/**
* The Deferred class composes Promises in a way that allows for them to be
* resolved or rejected from outside the constructor. In most cases promises
* should be used directly, but Deferreds can be necessary when the logic to
* resolve a promise must be separate.
*
* @private
*/
class Deferred {
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.
*/
/**
* Creates a promise and exposes its resolve and reject functions as methods.
* Deletes the database.
* Note: this is exported separately from the DBWrapper module because most
* usages of IndexedDB in workbox dont need deleting, and this way it can be
* reused in tests to delete databases without creating DBWrapper instances.
*
* @param {string} name The database name.
* @private
*/
constructor() {
this.promise = new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});
}
}
const deleteDatabase = async name => {
await new Promise((resolve, reject) => {
const request = indexedDB.deleteDatabase(name);
/*
Copyright 2018 Google LLC
request.onerror = () => {
reject(request.error);
};
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.
*/
/**
* Deletes the database.
* Note: this is exported separately from the DBWrapper module because most
* usages of IndexedDB in workbox dont need deleting, and this way it can be
* reused in tests to delete databases without creating DBWrapper instances.
*
* @param {string} name The database name.
* @private
*/
request.onblocked = () => {
reject(new Error('Delete blocked'));
};
const deleteDatabase = async name => {
await new Promise((resolve, reject) => {
const request = indexedDB.deleteDatabase(name);
request.onsuccess = () => {
resolve();
};
});
};
request.onerror = ({
target
}) => {
reject(target.error);
};
/*
Copyright 2018 Google LLC
request.onblocked = () => {
reject(new Error('Delete blocked'));
};
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.
*/
/**
* Wrapper around the fetch API.
*
* Will call requestWillFetch on available plugins.
*
* @param {Object} options
* @param {Request|string} options.request
* @param {Object} [options.fetchOptions]
* @param {Event} [options.event]
* @param {Array<Object>} [options.plugins=[]]
* @return {Promise<Response>}
*
* @private
* @memberof module:workbox-core
*/
request.onsuccess = () => {
resolve();
};
});
};
const wrappedFetch = async ({
request,
fetchOptions,
event,
plugins = []
}) => {
if (typeof request === 'string') {
request = new Request(request);
} // We *should* be able to call `await event.preloadResponse` even if it's
// undefined, but for some reason, doing so leads to errors in our Node unit
// tests. To work around that, explicitly check preloadResponse's value first.
/*
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.
*/
/**
* Wrapper around the fetch API.
*
* Will call requestWillFetch on available plugins.
*
* @param {Object} options
* @param {Request|string} options.request
* @param {Object} [options.fetchOptions]
* @param {Event} [options.event]
* @param {Array<Object>} [options.plugins=[]]
* @return {Promise<Response>}
*
* @private
* @memberof module:workbox-core
*/
if (event instanceof FetchEvent && event.preloadResponse) {
const possiblePreloadResponse = await event.preloadResponse;
const wrappedFetch = async ({
request,
fetchOptions,
event,
plugins = []
}) => {
// We *should* be able to call `await event.preloadResponse` even if it's
// undefined, but for some reason, doing so leads to errors in our Node unit
// tests. To work around that, explicitly check preloadResponse's value first.
if (event && event.preloadResponse) {
const possiblePreloadResponse = await event.preloadResponse;
if (possiblePreloadResponse) {
{
logger.log(`Using a preloaded navigation response for ` + `'${getFriendlyURL(request.url)}'`);
}
if (possiblePreloadResponse) {
{
logger.log(`Using a preloaded navigation response for ` + `'${getFriendlyURL(request.url)}'`);
return possiblePreloadResponse;
}
}
return possiblePreloadResponse;
{
finalAssertExports.isInstance(request, Request, {
paramName: 'request',
expectedClass: Request,
moduleName: 'workbox-core',
className: 'fetchWrapper',
funcName: 'wrappedFetch'
});
}
}
if (typeof request === 'string') {
request = new Request(request);
}
const failedFetchPlugins = pluginUtils.filter(plugins, "fetchDidFail"
/* FETCH_DID_FAIL */
); // If there is a fetchDidFail plugin, we need to save a clone of the
// original request before it's either modified by a requestWillFetch
// plugin or before the original request's body is consumed via fetch().
{
finalAssertExports.isInstance(request, Request, {
paramName: request,
expectedClass: 'Request',
moduleName: 'workbox-core',
className: 'fetchWrapper',
funcName: 'wrappedFetch'
});
}
const originalRequest = failedFetchPlugins.length > 0 ? request.clone() : null;
const failedFetchPlugins = pluginUtils.filter(plugins, pluginEvents.FETCH_DID_FAIL); // If there is a fetchDidFail plugin, we need to save a clone of the
// original request before it's either modified by a requestWillFetch
// plugin or before the original request's body is consumed via fetch().
try {
for (let plugin of plugins) {
if ("requestWillFetch"
/* REQUEST_WILL_FETCH */
in plugin) {
const pluginMethod = plugin["requestWillFetch"
/* REQUEST_WILL_FETCH */
];
const requestClone = request.clone();
request = await pluginMethod.call(plugin, {
request: requestClone,
event
});
const originalRequest = failedFetchPlugins.length > 0 ? request.clone() : null;
try {
for (let plugin of plugins) {
if (pluginEvents.REQUEST_WILL_FETCH in plugin) {
request = await plugin[pluginEvents.REQUEST_WILL_FETCH].call(plugin, {
request: request.clone(),
event
});
{
if (request) {
finalAssertExports.isInstance(request, Request, {
moduleName: 'Plugin',
funcName: pluginEvents.CACHED_RESPONSE_WILL_BE_USED,
isReturnValueProblem: true
});
if ("dev" !== 'production') {
if (request) {
finalAssertExports.isInstance(request, Request, {
moduleName: 'Plugin',
funcName: "cachedResponseWillBeUsed"
/* CACHED_RESPONSE_WILL_BE_USED */
,
isReturnValueProblem: true
});
}
}
}
}
}
} catch (err) {
throw new WorkboxError('plugin-error-request-will-fetch', {
thrownError: err
});
} // The request can be altered by plugins with `requestWillFetch` making
// the original request (Most likely from a `fetch` event) to be different
// to the Request we make. Pass both to `fetchDidFail` to aid debugging.
} catch (err) {
throw new WorkboxError('plugin-error-request-will-fetch', {
thrownError: err
});
} // The request can be altered by plugins with `requestWillFetch` making
// the original request (Most likely from a `fetch` event) to be different
// to the Request we make. Pass both to `fetchDidFail` to aid debugging.
let pluginFilteredRequest = request.clone();
let pluginFilteredRequest = request.clone();
try {
let fetchResponse; // See https://github.com/GoogleChrome/workbox/issues/1796
try {
let fetchResponse; // See https://github.com/GoogleChrome/workbox/issues/1796
if (request.mode === 'navigate') {
fetchResponse = await fetch(request);
} else {
fetchResponse = await fetch(request, fetchOptions);
}
if (request.mode === 'navigate') {
fetchResponse = await fetch(request);
} else {
fetchResponse = await fetch(request, fetchOptions);
}
{
logger.debug(`Network request for ` + `'${getFriendlyURL(request.url)}' returned a response with ` + `status '${fetchResponse.status}'.`);
}
if ("dev" !== 'production') {
logger.debug(`Network request for ` + `'${getFriendlyURL(request.url)}' returned a response with ` + `status '${fetchResponse.status}'.`);
}
for (const plugin of plugins) {
if (pluginEvents.FETCH_DID_SUCCEED in plugin) {
fetchResponse = await plugin[pluginEvents.FETCH_DID_SUCCEED].call(plugin, {
event,
request: pluginFilteredRequest,
response: fetchResponse
});
for (const plugin of plugins) {
if ("fetchDidSucceed"
/* FETCH_DID_SUCCEED */
in plugin) {
fetchResponse = await plugin["fetchDidSucceed"
/* FETCH_DID_SUCCEED */
].call(plugin, {
event,
request: pluginFilteredRequest,
response: fetchResponse
});
{
if (fetchResponse) {
finalAssertExports.isInstance(fetchResponse, Response, {
moduleName: 'Plugin',
funcName: pluginEvents.FETCH_DID_SUCCEED,
isReturnValueProblem: true
});
if ("dev" !== 'production') {
if (fetchResponse) {
finalAssertExports.isInstance(fetchResponse, Response, {
moduleName: 'Plugin',
funcName: "fetchDidSucceed"
/* FETCH_DID_SUCCEED */
,
isReturnValueProblem: true
});
}
}
}
}
}
return fetchResponse;
} catch (error) {
{
logger.error(`Network request for ` + `'${getFriendlyURL(request.url)}' threw an error.`, error);
}
return fetchResponse;
} catch (error) {
{
logger.error(`Network request for ` + `'${getFriendlyURL(request.url)}' threw an error.`, error);
}
for (const plugin of failedFetchPlugins) {
await plugin[pluginEvents.FETCH_DID_FAIL].call(plugin, {
error,
event,
originalRequest: originalRequest.clone(),
request: pluginFilteredRequest.clone()
});
for (const plugin of failedFetchPlugins) {
await plugin["fetchDidFail"
/* FETCH_DID_FAIL */
].call(plugin, {
error,
event,
originalRequest: originalRequest.clone(),
request: pluginFilteredRequest.clone()
});
}
throw error;
}
};
throw error;
}
};
const fetchWrapper = {
fetch: wrappedFetch
};
const fetchWrapper = {
fetch: wrappedFetch
};
/*
Copyright 2018 Google LLC
/*
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.
*/
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.
*/
var _private = /*#__PURE__*/Object.freeze({
assert: finalAssertExports,
cacheNames: cacheNames,
cacheWrapper: cacheWrapper,
DBWrapper: DBWrapper,
Deferred: Deferred,
deleteDatabase: deleteDatabase,
executeQuotaErrorCallbacks: executeQuotaErrorCallbacks,
fetchWrapper: fetchWrapper,
getFriendlyURL: getFriendlyURL,
logger: logger,
WorkboxError: WorkboxError
});
var _private = /*#__PURE__*/Object.freeze({
assert: finalAssertExports,
cacheNames: cacheNames,
cacheWrapper: cacheWrapper,
DBWrapper: DBWrapper,
Deferred: Deferred,
deleteDatabase: deleteDatabase,
executeQuotaErrorCallbacks: executeQuotaErrorCallbacks,
fetchWrapper: fetchWrapper,
getFriendlyURL: getFriendlyURL,
logger: logger,
WorkboxError: WorkboxError
});
/*
Copyright 2019 Google LLC
/*
Copyright 2019 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.
*/
/**
* Claim any currently available clients once the service worker
* becomes active. This is normally used in conjunction with `skipWaiting()`.
*
* @alias workbox.core.clientsClaim
*/
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.
*/
/**
* Claim any currently available clients once the service worker
* becomes active. This is normally used in conjunction with `skipWaiting()`.
*
* @alias workbox.core.clientsClaim
*/
const clientsClaim = () => {
addEventListener('activate', () => self.clients.claim());
};
const clientsClaim = () => {
addEventListener('activate', () => clients.claim());
};
/*
Copyright 2019 Google LLC
/*
Copyright 2019 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.
*/
/**
* Get the current cache names and prefix/suffix used by Workbox.
*
* `cacheNames.precache` is used for precached assets,
* `cacheNames.googleAnalytics` is used by `workbox-google-analytics` to
* store `analytics.js`, and `cacheNames.runtime` is used for everything else.
*
* `cacheNames.prefix` can be used to retrieve just the current prefix value.
* `cacheNames.suffix` can be used to retrieve just the current suffix value.
*
* @return {Object} An object with `precache`, `runtime`, `prefix`, and
* `googleAnalytics` properties.
*
* @alias workbox.core.cacheNames
*/
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.
*/
/**
* Get the current cache names and prefix/suffix used by Workbox.
*
* `cacheNames.precache` is used for precached assets,
* `cacheNames.googleAnalytics` is used by `workbox-google-analytics` to
* store `analytics.js`, and `cacheNames.runtime` is used for everything else.
*
* `cacheNames.prefix` can be used to retrieve just the current prefix value.
* `cacheNames.suffix` can be used to retrieve just the current suffix value.
*
* @return {Object} An object with `precache`, `runtime`, `prefix`, and
* `googleAnalytics` properties.
*
* @alias workbox.core.cacheNames
*/
const cacheNames$1 = {
get googleAnalytics() {
return cacheNames.getGoogleAnalyticsName();
},
const cacheNames$1 = {
get googleAnalytics() {
return cacheNames.getGoogleAnalyticsName();
},
get precache() {
return cacheNames.getPrecacheName();
},
get precache() {
return cacheNames.getPrecacheName();
},
get prefix() {
return cacheNames.getPrefix();
},
get prefix() {
return cacheNames.getPrefix();
},
get runtime() {
return cacheNames.getRuntimeName();
},
get runtime() {
return cacheNames.getRuntimeName();
},
get suffix() {
return cacheNames.getSuffix();
}
get suffix() {
return cacheNames.getSuffix();
}
};
};
/*
Copyright 2019 Google LLC
/*
Copyright 2019 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.
*/
/**
* Modifies the default cache names used by the Workbox packages.
* Cache names are generated as `<prefix>-<Cache Name>-<suffix>`.
*
* @param {Object} details
* @param {Object} [details.prefix] The string to add to the beginning of
* the precache and runtime cache names.
* @param {Object} [details.suffix] The string to add to the end of
* the precache and runtime cache names.
* @param {Object} [details.precache] The cache name to use for precache
* caching.
* @param {Object} [details.runtime] The cache name to use for runtime caching.
* @param {Object} [details.googleAnalytics] The cache name to use for
* `workbox-google-analytics` caching.
*
* @alias workbox.core.setCacheNameDetails
*/
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.
*/
/**
* Modifies the default cache names used by the Workbox packages.
* Cache names are generated as `<prefix>-<Cache Name>-<suffix>`.
*
* @param {Object} details
* @param {Object} [details.prefix] The string to add to the beginning of
* the precache and runtime cache names.
* @param {Object} [details.suffix] The string to add to the end of
* the precache and runtime cache names.
* @param {Object} [details.precache] The cache name to use for precache
* caching.
* @param {Object} [details.runtime] The cache name to use for runtime caching.
* @param {Object} [details.googleAnalytics] The cache name to use for
* `workbox-google-analytics` caching.
*
* @alias workbox.core.setCacheNameDetails
*/
const setCacheNameDetails = details => {
{
Object.keys(details).forEach(key => {
finalAssertExports.isType(details[key], 'string', {
moduleName: 'workbox-core',
funcName: 'setCacheNameDetails',
paramName: `details.${key}`
const setCacheNameDetails = details => {
{
Object.keys(details).forEach(key => {
finalAssertExports.isType(details[key], 'string', {
moduleName: 'workbox-core',
funcName: 'setCacheNameDetails',
paramName: `details.${key}`
});
});
});
if ('precache' in details && details.precache.length === 0) {
throw new WorkboxError('invalid-cache-name', {
cacheNameId: 'precache',
value: details.precache
});
}
if ('precache' in details && details.precache.length === 0) {
throw new WorkboxError('invalid-cache-name', {
cacheNameId: 'precache',
value: details.precache
});
}
if ('runtime' in details && details.runtime.length === 0) {
throw new WorkboxError('invalid-cache-name', {
cacheNameId: 'runtime',
value: details.runtime
});
}
if ('runtime' in details && details.runtime.length === 0) {
throw new WorkboxError('invalid-cache-name', {
cacheNameId: 'runtime',
value: details.runtime
});
}
if ('googleAnalytics' in details && details.googleAnalytics.length === 0) {
throw new WorkboxError('invalid-cache-name', {
cacheNameId: 'googleAnalytics',
value: details.googleAnalytics
});
if ('googleAnalytics' in details && details.googleAnalytics.length === 0) {
throw new WorkboxError('invalid-cache-name', {
cacheNameId: 'googleAnalytics',
value: details.googleAnalytics
});
}
}
}
cacheNames.updateDetails(details);
};
cacheNames.updateDetails(details);
};
/*
Copyright 2019 Google LLC
/*
Copyright 2019 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.
*/
/**
* Force a service worker to become active, instead of waiting. This is
* normally used in conjunction with `clientsClaim()`.
*
* @alias workbox.core.skipWaiting
*/
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.
*/
/**
* Force a service worker to become active, instead of waiting. This is
* normally used in conjunction with `clientsClaim()`.
*
* @alias workbox.core.skipWaiting
*/
const skipWaiting = () => {
// We need to explicitly call `self.skipWaiting()` here because we're
// shadowing `skipWaiting` with this local function.
addEventListener('install', () => self.skipWaiting());
};
const skipWaiting = () => {
// We need to explicitly call `self.skipWaiting()` here because we're
// shadowing `skipWaiting` with this local function.
addEventListener('install', () => self.skipWaiting());
};
/*
Copyright 2018 Google LLC
/*
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.
*/
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.
*/
try {
self.workbox.v = self.workbox.v || {};
} catch (errer) {} // NOOP
exports._private = _private;
exports.cacheNames = cacheNames$1;
exports.clientsClaim = clientsClaim;
exports.registerQuotaErrorCallback = registerQuotaErrorCallback;
exports.setCacheNameDetails = setCacheNameDetails;
exports.skipWaiting = skipWaiting;
exports._private = _private;
exports.clientsClaim = clientsClaim;
exports.cacheNames = cacheNames$1;
exports.registerQuotaErrorCallback = registerQuotaErrorCallback;
exports.setCacheNameDetails = setCacheNameDetails;
exports.skipWaiting = skipWaiting;
return exports;
return exports;
}({}));
//# sourceMappingURL=workbox-core.dev.js.map

@@ -1,2 +0,2 @@

this.workbox=this.workbox||{},this.workbox.core=function(e){"use strict";try{self["workbox:core:5.0.0-alpha.0"]&&_()}catch(e){}const t=(e,...t)=>{let n=e;return t.length>0&&(n+=` :: ${JSON.stringify(t)}`),n};class n extends Error{constructor(e,n){super(t(e,n)),this.name=e,this.details=n}}const s=new Set;const r={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:self.registration.scope},a=e=>[r.prefix,e,r.suffix].filter(e=>e.length>0).join("-"),i={updateDetails:e=>{Object.keys(r).forEach(t=>{void 0!==e[t]&&(r[t]=e[t])})},getGoogleAnalyticsName:e=>e||a(r.googleAnalytics),getPrecacheName:e=>e||a(r.precache),getPrefix:()=>r.prefix,getRuntimeName:e=>e||a(r.runtime),getSuffix:()=>r.suffix},c=e=>{const t=new URL(e,location);return t.origin===location.origin?t.pathname:t.href};async function o(){for(const e of s)await e()}const l="cacheDidUpdate",u="cacheKeyWillBeUsed",h="cacheWillUpdate",f="cachedResponseWillBeUsed",w="fetchDidFail",g="fetchDidSucceed",d="requestWillFetch",p=(e,t)=>e.filter(e=>t in e),y=async({cacheName:e,request:t,event:n,matchOptions:s,plugins:r=[]})=>{const a=await caches.open(e),i=await q({plugins:r,request:t,mode:"read"});let c=await a.match(i,s);for(const t of r)f in t&&(c=await t[f].call(t,{cacheName:e,event:n,matchOptions:s,cachedResponse:c,request:i}));return c},m=async({request:e,response:t,event:n,plugins:s})=>{let r=t,a=!1;for(let t of s)if(h in t&&(a=!0,!(r=await t[h].call(t,{request:e,response:r,event:n}))))break;return a||(r=200===r.status?r:null),r||null},q=async({request:e,mode:t,plugins:n})=>{const s=p(n,u);let r=e;for(const e of s)"string"==typeof(r=await e[u].call(e,{mode:t,request:r}))&&(r=new Request(r));return r},v={put:async({cacheName:e,request:t,response:s,event:r,plugins:a=[],matchOptions:i}={})=>{const u=await q({plugins:a,request:t,mode:"write"});if(!s)throw new n("cache-put-with-no-response",{url:c(u.url)});let h=await m({event:r,plugins:a,response:s,request:u});if(!h)return;const f=await caches.open(e),w=p(a,l);let g=w.length>0?await y({cacheName:e,matchOptions:i,request:u}):null;try{await f.put(u,h)}catch(e){throw"QuotaExceededError"===e.name&&await o(),e}for(let t of w)await t[l].call(t,{cacheName:e,event:r,oldResponse:g,newResponse:h,request:u})},match:y};class x{constructor(e,t,{onupgradeneeded:n,onversionchange:s=this.t}={}){this.s=e,this.i=t,this.o=n,this.t=s,this.l=null}get db(){return this.l}async open(){if(!this.l)return this.l=await new Promise((e,t)=>{let n=!1;setTimeout(()=>{n=!0,t(new Error("The open request was blocked and timed out"))},this.OPEN_TIMEOUT);const s=indexedDB.open(this.s,this.i);s.onerror=(()=>t(s.error)),s.onupgradeneeded=(e=>{n?(s.transaction.abort(),e.target.result.close()):this.o&&this.o(e)}),s.onsuccess=(({target:t})=>{const s=t.result;n?s.close():(s.onversionchange=this.t.bind(this),e(s))})}),this}async getKey(e,t){return(await this.getAllKeys(e,t,1))[0]}async getAll(e,t,n){return await this.getAllMatching(e,{query:t,count:n})}async getAllKeys(e,t,n){return(await this.getAllMatching(e,{query:t,count:n,includeKeys:!0})).map(({key:e})=>e)}async getAllMatching(e,{index:t,query:n=null,direction:s="next",count:r,includeKeys:a}={}){return await this.transaction([e],"readonly",(i,c)=>{const o=i.objectStore(e),l=t?o.index(t):o,u=[];l.openCursor(n,s).onsuccess=(({target:e})=>{const t=e.result;if(t){const{primaryKey:e,key:n,value:s}=t;u.push(a?{primaryKey:e,key:n,value:s}:s),r&&u.length>=r?c(u):t.continue()}else c(u)})})}async transaction(e,t,n){return await this.open(),await new Promise((s,r)=>{const a=this.l.transaction(e,t);a.onabort=(({target:e})=>r(e.error)),a.oncomplete=(()=>s()),n(a,e=>s(e))})}async u(e,t,n,...s){return await this.transaction([t],n,(n,r)=>{n.objectStore(t)[e](...s).onsuccess=(({target:e})=>{r(e.result)})})}t(){this.close()}close(){this.l&&(this.l.close(),this.l=null)}}x.prototype.OPEN_TIMEOUT=2e3;const b={readonly:["get","count","getKey","getAll","getAllKeys"],readwrite:["add","put","clear","delete"]};for(const[e,t]of Object.entries(b))for(const n of t)n in IDBObjectStore.prototype&&(x.prototype[n]=async function(t,...s){return await this.u(n,t,e,...s)});const D={fetch:async({request:e,fetchOptions:t,event:s,plugins:r=[]})=>{if(s&&s.preloadResponse){const e=await s.preloadResponse;if(e)return e}"string"==typeof e&&(e=new Request(e));const a=p(r,w),i=a.length>0?e.clone():null;try{for(let t of r)d in t&&(e=await t[d].call(t,{request:e.clone(),event:s}))}catch(e){throw new n("plugin-error-request-will-fetch",{thrownError:e})}let c=e.clone();try{let n;n="navigate"===e.mode?await fetch(e):await fetch(e,t);for(const e of r)g in e&&(n=await e[g].call(e,{event:s,request:c,response:n}));return n}catch(e){for(const t of a)await t[w].call(t,{error:e,event:s,originalRequest:i.clone(),request:c.clone()});throw e}}};var E=Object.freeze({assert:null,cacheNames:i,cacheWrapper:v,DBWrapper:x,Deferred:class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}},deleteDatabase:async e=>{await new Promise((t,n)=>{const s=indexedDB.deleteDatabase(e);s.onerror=(({target:e})=>{n(e.error)}),s.onblocked=(()=>{n(new Error("Delete blocked"))}),s.onsuccess=(()=>{t()})})},executeQuotaErrorCallbacks:o,fetchWrapper:D,getFriendlyURL:c,logger:null,WorkboxError:n});const N={get googleAnalytics(){return i.getGoogleAnalyticsName()},get precache(){return i.getPrecacheName()},get prefix(){return i.getPrefix()},get runtime(){return i.getRuntimeName()},get suffix(){return i.getSuffix()}};try{self.workbox.v=self.workbox.v||{}}catch(e){}return e._private=E,e.clientsClaim=(()=>{addEventListener("activate",()=>clients.claim())}),e.cacheNames=N,e.registerQuotaErrorCallback=function(e){s.add(e)},e.setCacheNameDetails=(e=>{i.updateDetails(e)}),e.skipWaiting=(()=>{addEventListener("install",()=>self.skipWaiting())}),e}({});
this.workbox=this.workbox||{},this.workbox.core=function(e){"use strict";try{self["workbox:core:5.0.0-alpha.1"]&&_()}catch(e){}const t=(e,...t)=>{let n=e;return t.length>0&&(n+=` :: ${JSON.stringify(t)}`),n};class n extends Error{constructor(e,n){super(t(e,n)),this.name=e,this.details=n}}const s=new Set;const r={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:registration.scope},a=e=>[r.prefix,e,r.suffix].filter(e=>e&&e.length>0).join("-"),i={updateDetails:e=>{(e=>{for(const t of Object.keys(r))e(t)})(t=>{"string"==typeof e[t]&&(r[t]=e[t])})},getGoogleAnalyticsName:e=>e||a(r.googleAnalytics),getPrecacheName:e=>e||a(r.precache),getPrefix:()=>r.prefix,getRuntimeName:e=>e||a(r.runtime),getSuffix:()=>r.suffix},c=e=>{const t=new URL(String(e),location.href);return t.origin===location.origin?t.pathname:t.href};async function o(){for(const e of s)await e()}const u=(e,t)=>e.filter(e=>t in e),l=async({cacheName:e,request:t,event:n,matchOptions:s,plugins:r=[]})=>{const a=await caches.open(e),i=await f({plugins:r,request:t,mode:"read"});let c=await a.match(i,s);for(const t of r)if("cachedResponseWillBeUsed"in t){const r=t.cachedResponseWillBeUsed;c=await r.call(t,{cacheName:e,event:n,matchOptions:s,cachedResponse:c,request:i})}return c},h=async({request:e,response:t,event:n,plugins:s=[]})=>{let r=t,a=!1;for(let t of s)if("cacheWillUpdate"in t){a=!0;const s=t.cacheWillUpdate;if(!(r=await s.call(t,{request:e,response:r,event:n})))break}return a||(r=r&&200===r.status?r:void 0),r||null},f=async({request:e,mode:t,plugins:n=[]})=>{const s=u(n,"cacheKeyWillBeUsed");let r=e;for(const e of s)"string"==typeof(r=await e.cacheKeyWillBeUsed.call(e,{mode:t,request:r}))&&(r=new Request(r));return r},w={put:async({cacheName:e,request:t,response:s,event:r,plugins:a=[],matchOptions:i})=>{const w=await f({plugins:a,request:t,mode:"write"});if(!s)throw new n("cache-put-with-no-response",{url:c(w.url)});let d=await h({event:r,plugins:a,response:s,request:w});if(!d)return;const p=await caches.open(e),g=u(a,"cacheDidUpdate");let y=g.length>0?await l({cacheName:e,matchOptions:i,request:w}):null;try{await p.put(w,d)}catch(e){throw"QuotaExceededError"===e.name&&await o(),e}for(let t of g)await t.cacheDidUpdate.call(t,{cacheName:e,event:r,oldResponse:y,newResponse:d,request:w})},match:l};class d{constructor(e,t,{onupgradeneeded:n,onversionchange:s}={}){this.t=null,this.s=e,this.i=t,this.o=n,this.u=s||(()=>this.close())}get db(){return this.t}async open(){if(!this.t)return this.t=await new Promise((e,t)=>{let n=!1;setTimeout(()=>{n=!0,t(new Error("The open request was blocked and timed out"))},this.OPEN_TIMEOUT);const s=indexedDB.open(this.s,this.i);s.onerror=(()=>t(s.error)),s.onupgradeneeded=(e=>{n?(s.transaction.abort(),s.result.close()):"function"==typeof this.o&&this.o(e)}),s.onsuccess=(()=>{const t=s.result;n?t.close():(t.onversionchange=this.u.bind(this),e(t))})}),this}async getKey(e,t){return(await this.getAllKeys(e,t,1))[0]}async getAll(e,t,n){return await this.getAllMatching(e,{query:t,count:n})}async getAllKeys(e,t,n){return(await this.getAllMatching(e,{query:t,count:n,includeKeys:!0})).map(e=>e.key)}async getAllMatching(e,{index:t,query:n=null,direction:s="next",count:r,includeKeys:a=!1}={}){return await this.transaction([e],"readonly",(i,c)=>{const o=i.objectStore(e),u=t?o.index(t):o,l=[],h=u.openCursor(n,s);h.onsuccess=(()=>{const e=h.result;e?(l.push(a?e:e.value),r&&l.length>=r?c(l):e.continue()):c(l)})})}async transaction(e,t,n){return await this.open(),await new Promise((s,r)=>{const a=this.t.transaction(e,t);a.onabort=(()=>r(a.error)),a.oncomplete=(()=>s()),n(a,e=>s(e))})}async l(e,t,n,...s){return await this.transaction([t],n,(n,r)=>{const a=n.objectStore(t),i=a[e].apply(a,s);i.onsuccess=(()=>r(i.result))})}close(){this.t&&(this.t.close(),this.t=null)}}d.prototype.OPEN_TIMEOUT=2e3;const p={readonly:["get","count","getKey","getAll","getAllKeys"],readwrite:["add","put","clear","delete"]};for(const[e,t]of Object.entries(p))for(const n of t)n in IDBObjectStore.prototype&&(d.prototype[n]=async function(t,...s){return await this.l(n,t,e,...s)});const g={fetch:async({request:e,fetchOptions:t,event:s,plugins:r=[]})=>{if("string"==typeof e&&(e=new Request(e)),s instanceof FetchEvent&&s.preloadResponse){const e=await s.preloadResponse;if(e)return e}const a=u(r,"fetchDidFail"),i=a.length>0?e.clone():null;try{for(let t of r)if("requestWillFetch"in t){const n=t.requestWillFetch,r=e.clone();e=await n.call(t,{request:r,event:s})}}catch(e){throw new n("plugin-error-request-will-fetch",{thrownError:e})}let c=e.clone();try{let n;n="navigate"===e.mode?await fetch(e):await fetch(e,t);for(const e of r)"fetchDidSucceed"in e&&(n=await e.fetchDidSucceed.call(e,{event:s,request:c,response:n}));return n}catch(e){for(const t of a)await t.fetchDidFail.call(t,{error:e,event:s,originalRequest:i.clone(),request:c.clone()});throw e}}};var y=Object.freeze({assert:null,cacheNames:i,cacheWrapper:w,DBWrapper:d,Deferred:class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}},deleteDatabase:async e=>{await new Promise((t,n)=>{const s=indexedDB.deleteDatabase(e);s.onerror=(()=>{n(s.error)}),s.onblocked=(()=>{n(new Error("Delete blocked"))}),s.onsuccess=(()=>{t()})})},executeQuotaErrorCallbacks:o,fetchWrapper:g,getFriendlyURL:c,logger:null,WorkboxError:n});const m={get googleAnalytics(){return i.getGoogleAnalyticsName()},get precache(){return i.getPrecacheName()},get prefix(){return i.getPrefix()},get runtime(){return i.getRuntimeName()},get suffix(){return i.getSuffix()}};return e._private=y,e.cacheNames=m,e.clientsClaim=(()=>{addEventListener("activate",()=>self.clients.claim())}),e.registerQuotaErrorCallback=function(e){s.add(e)},e.setCacheNameDetails=(e=>{i.updateDetails(e)}),e.skipWaiting=(()=>{addEventListener("install",()=>self.skipWaiting())}),e}({});
//# sourceMappingURL=workbox-core.prod.js.map
{
"name": "workbox-core",
"version": "5.0.0-alpha.0",
"version": "5.0.0-alpha.1",
"license": "MIT",

@@ -25,5 +25,6 @@ "author": "Google's Web DevRel Team",

},
"main": "build/workbox-core.prod.js",
"main": "index.js",
"module": "index.mjs",
"gitHead": "7f231c04023669bc42d5a939d1359b0867e2efda"
"types": "index.d.ts",
"gitHead": "20d2110ddace710a46af06addd4977cae08f5942"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc