Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

workbox-core

Package Overview
Dependencies
Maintainers
4
Versions
85
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 3.0.0-beta.0 to 3.0.0-beta.1

_private/checkSWFileCacheHeaders.mjs

165

build/workbox-core.dev.js

@@ -43,3 +43,3 @@ /* eslint-disable */

try {
self.workbox.v['workbox:core:3.0.0-beta.0'] = 1;
self.workbox.v['workbox:core:3.0.0-beta.1'] = 1;
} catch (e) {} // eslint-disable-line

@@ -361,3 +361,3 @@

const exports$1 = {
const cacheNames = {
updateDetails: details => {

@@ -397,2 +397,6 @@ Object.keys(_cacheNameDetails).forEach(key => {

// Safari doesn't print all console.groupCollapsed() arguments.
// Related bug: https://bugs.webkit.org/show_bug.cgi?id=182754
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
const GREY = `#7f8c8d`;

@@ -420,3 +424,3 @@ const GREEN = `#2ecc71`;

if (!levelColor) {
if (!levelColor || keyName === 'groupCollapsed' && isSafari) {
console[keyName](...logArgs);

@@ -436,3 +440,3 @@ return;

const defaultExport$1 = {
const defaultExport = {
groupEnd,

@@ -445,4 +449,4 @@ unprefixed: {

const setupLogs = (keyName, color) => {
defaultExport$1[keyName] = (...args) => _print(keyName, args, color);
defaultExport$1.unprefixed[keyName] = (...args) => _print(keyName, args);
defaultExport[keyName] = (...args) => _print(keyName, args, color);
defaultExport.unprefixed[keyName] = (...args) => _print(keyName, args);
};

@@ -550,3 +554,3 @@

const finalExports$2 = {
const finalAssertExports = {
hasMethod,

@@ -577,3 +581,80 @@ isArray,

const MAX_AGE_REGEX = /max-age\s*=\s*(\d*)/g;
/**
* Logs a warning to the user recommending changing
* to max-age=0 or no-cache.
*
* @param {string} cacheControlHeader
*
* @private
*/
function showWarning(cacheControlHeader) {
const docsUrl = 'https://developers.google.com/web/tools/workbox/guides/service-worker-checklist#cache-control_of_your_service_worker_file';
defaultExport.warn(`You are setting a 'cache-control' header of ` + `'${cacheControlHeader}' on your service worker file. This should be ` + `set to 'max-age=0' or 'no-cache' to ensure the latest service worker ` + `is served to your users. Learn more here: ${docsUrl}`);
}
/**
* Checks for cache-control header on SW file and
* warns the developer if it exists with a value
* other than max-age=0 or no-cache.
*
* @private
*/
function checkSWFileCacheHeaders() {
// This is wrapped as an iife to allow async/await while making
// rollup exclude it in builds.
babelHelpers.asyncToGenerator(function* () {
try {
const swFile = self.location.href;
const response = yield fetch(swFile);
if (!response.ok) {
// Response failed so nothing we can check;
return;
}
if (!response.headers.has('cache-control')) {
// No cache control header.
return;
}
const cacheControlHeader = response.headers.get('cache-control');
const maxAgeResult = MAX_AGE_REGEX.exec(cacheControlHeader);
if (maxAgeResult) {
if (parseInt(maxAgeResult[1], 10) === 0) {
return;
}
}
if (cacheControlHeader.indexOf('no-cache') !== -1) {
return;
}
showWarning(cacheControlHeader);
} catch (err) {
// NOOP
}
})();
}
const finalCheckSWFileCacheHeaders = checkSWFileCacheHeaders;
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* This class is never exposed publicly. Inidividual methods are exposed

@@ -603,7 +684,11 @@ * using jsdoc alias commands.

const padding = ' ';
defaultExport$1.groupCollapsed('Welcome to Workbox!');
defaultExport$1.unprefixed.log(`📖 Read the guides and documentation\n` + `${padding}https://developers.google.com/web/tools/workbox/`);
defaultExport$1.unprefixed.log(`❓ Use the [workbox] tag on StackOverflow to ask questions\n` + `${padding}https://stackoverflow.com/questions/ask?tags=workbox`);
defaultExport$1.unprefixed.log(`🐛 Found a bug? Report it on GitHub\n` + `${padding}https://github.com/GoogleChrome/workbox/issues/new`);
defaultExport$1.groupEnd();
defaultExport.groupCollapsed('Welcome to Workbox!');
defaultExport.unprefixed.log(`📖 Read the guides and documentation\n` + `${padding}https://developers.google.com/web/tools/workbox/`);
defaultExport.unprefixed.log(`❓ Use the [workbox] tag on StackOverflow to ask questions\n` + `${padding}https://stackoverflow.com/questions/ask?tags=workbox`);
defaultExport.unprefixed.log(`🐛 Found a bug? Report it on GitHub\n` + `${padding}https://github.com/GoogleChrome/workbox/issues/new`);
defaultExport.groupEnd();
if (typeof finalCheckSWFileCacheHeaders === 'function') {
finalCheckSWFileCacheHeaders();
}
}

@@ -626,5 +711,5 @@ }

return {
googleAnalytics: exports$1.getGoogleAnalyticsName(),
precache: exports$1.getPrecacheName(),
runtime: exports$1.getRuntimeName()
googleAnalytics: cacheNames.getGoogleAnalyticsName(),
precache: cacheNames.getPrecacheName(),
runtime: cacheNames.getRuntimeName()
};

@@ -655,3 +740,3 @@ }

Object.keys(details).forEach(key => {
finalExports$2.isType(details[key], 'string', {
finalAssertExports.isType(details[key], 'string', {
moduleName: 'workbox-core',

@@ -686,3 +771,3 @@ className: 'WorkboxCore',

exports$1.updateDetails(details);
cacheNames.updateDetails(details);
}

@@ -711,3 +796,3 @@

{
finalExports$2.isType(newLevel, 'number', {
finalAssertExports.isType(newLevel, 'number', {
moduleName: 'workbox-core',

@@ -732,3 +817,3 @@ className: 'WorkboxCore',

var defaultExport = new WorkboxCore();
var defaultExport$1 = new WorkboxCore();

@@ -840,3 +925,3 @@ /*

{
defaultExport$1.debug(`Response '${getFriendlyURL(request.url)}' will not be ` + `cached.`, responseToCache);
defaultExport.debug(`Response '${getFriendlyURL(request.url)}' will not be ` + `cached.`, responseToCache);
}

@@ -853,3 +938,3 @@ return;

{
defaultExport$1.debug(`Updating the '${cacheName}' cache with a new Response for ` + `${getFriendlyURL(request.url)}.`);
defaultExport.debug(`Updating the '${cacheName}' cache with a new Response for ` + `${getFriendlyURL(request.url)}.`);
}

@@ -895,5 +980,5 @@

if (cachedResponse) {
defaultExport$1.debug(`Found a cached response in '${cacheName}'.`);
defaultExport.debug(`Found a cached response in '${cacheName}'.`);
} else {
defaultExport$1.debug(`No cached response found in '${cacheName}'.`);
defaultExport.debug(`No cached response found in '${cacheName}'.`);
}

@@ -911,3 +996,3 @@ }

if (cachedResponse) {
finalExports$2.isInstance(cachedResponse, Response, {
finalAssertExports.isInstance(cachedResponse, Response, {
moduleName: 'Plugin',

@@ -955,3 +1040,3 @@ funcName: pluginEvents.CACHED_RESPONSE_WILL_BE_USED,

if (responseToCache) {
finalExports$2.isInstance(responseToCache, Response, {
finalAssertExports.isInstance(responseToCache, Response, {
moduleName: 'Plugin',

@@ -974,5 +1059,5 @@ funcName: pluginEvents.CACHE_WILL_UPDATE,

if (responseToCache.status === 0) {
defaultExport$1.warn(`The response for '${request.url}' is an opaque ` + `response. The caching strategy that you're using will not ` + `cache opaque responses by default.`);
defaultExport.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 {
defaultExport$1.debug(`The response for '${request.url}' returned ` + `a status code of '${response.status}' and won't be cached as a ` + `result.`);
defaultExport.debug(`The response for '${request.url}' returned ` + `a status code of '${response.status}' and won't be cached as a ` + `result.`);
}

@@ -992,3 +1077,3 @@ }

const exports$2 = {
const cacheWrapper = {
put: putWrapper,

@@ -1034,3 +1119,3 @@ match: matchWrapper

{
finalExports$2.isInstance(request, Request, {
finalAssertExports.isInstance(request, Request, {
paramName: request,

@@ -1060,3 +1145,3 @@ expectedClass: 'Request',

if (request) {
finalExports$2.isInstance(request, Request, {
finalAssertExports.isInstance(request, Request, {
moduleName: 'Plugin',

@@ -1084,3 +1169,3 @@ funcName: pluginEvents.CACHED_RESPONSE_WILL_BE_USED,

{
defaultExport$1.debug(`Network request for ` + `'${getFriendlyURL(request.url)}' returned a response with ` + `status '${response.status}'.`);
defaultExport.debug(`Network request for ` + `'${getFriendlyURL(request.url)}' returned a response with ` + `status '${response.status}'.`);
}

@@ -1090,3 +1175,3 @@ return response;

{
defaultExport$1.error(`Network request for ` + `'${getFriendlyURL(request.url)}' threw an error.`, err);
defaultExport.error(`Network request for ` + `'${getFriendlyURL(request.url)}' threw an error.`, err);
}

@@ -1110,3 +1195,3 @@

const exports$3 = {
const fetchWrapper = {
fetch: wrappedFetch

@@ -1477,11 +1562,9 @@ };

// We either expose defaults or we expose every named export.
var _private = Object.freeze({
logger: defaultExport$1,
assert: finalExports$2,
cacheNames: exports$1,
cacheWrapper: exports$2,
fetchWrapper: exports$3,
logger: defaultExport,
assert: finalAssertExports,
cacheNames: cacheNames,
cacheWrapper: cacheWrapper,
fetchWrapper: fetchWrapper,
WorkboxError: WorkboxError,

@@ -1508,3 +1591,3 @@ DBWrapper: DBWrapper,

const finalExports = Object.assign(defaultExport, {
const finalExports = Object.assign(defaultExport$1, {
LOG_LEVELS,

@@ -1511,0 +1594,0 @@ _private

@@ -1,3 +0,3 @@

self.babelHelpers={asyncToGenerator:function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(o,i){try{var l=t[o](i),c=l.value}catch(e){return void r(e)}if(!l.done)return Promise.resolve(c).then(function(e){n("next",e)},function(e){n("throw",e)});e(c)}("next")})}}},this.workbox=this.workbox||{},this.workbox.core=function(){"use strict";try{self.workbox.v["workbox:core:3.0.0-beta.0"]=1}catch(e){}var e={debug:0,log:1,warn:2,error:3,silent:4};const t=(e,...t)=>{let r=e;return t.length>0&&(r+=` :: ${JSON.stringify(t)}`),r};class r extends Error{constructor(e,r){let n=t(e,r);super(n),this.name=e,this.details=r}}const n={prefix:"workbox",suffix:self.registration.scope,googleAnalytics:"googleAnalytics",precache:"precache",runtime:"runtime"},o=e=>[n.prefix,e,n.suffix].filter(e=>e.length>0).join("-"),i={updateDetails:e=>{Object.keys(n).forEach(t=>{void 0!==e[t]&&(n[t]=e[t])})},getGoogleAnalyticsName:e=>e||o(n.googleAnalytics),getPrecacheName:e=>e||o(n.precache),getRuntimeName:e=>e||o(n.runtime)};let l=e.warn;const c=e=>l<=e,u=e=>l=e,s=()=>l,a=e.error,f=function(t,r,n){const o=0===t.indexOf("group")?a:e[t];if(!c(o))return;if(!n)return void console[t](...r);const i=["%cworkbox",`background: ${n}; color: white; padding: 2px 0.5em; `+"border-radius: 0.5em;"];console[t](...i,...r)},d=()=>{c(a)&&console.groupEnd()},h={groupEnd:d,unprefixed:{groupEnd:d}},p={debug:"#7f8c8d",log:"#2ecc71",warn:"#f39c12",error:"#c0392b",groupCollapsed:"#3498db"};Object.keys(p).forEach(e=>(y=e,b=p[e],h[y]=((...e)=>f(y,e,b)),void(h.unprefixed[y]=((...e)=>f(y,e)))));var y,b;var g=new class{constructor(){try{self.workbox.v=self.workbox.v||{}}catch(e){}}get cacheNames(){return{googleAnalytics:i.getGoogleAnalyticsName(),precache:i.getPrecacheName(),runtime:i.getRuntimeName()}}setCacheNameDetails(e){i.updateDetails(e)}get logLevel(){return s()}setLogLevel(t){if(t>e.silent||t<e.debug)throw new r("invalid-value",{paramName:"logLevel",validValueDescription:"Please use a value from LOG_LEVELS, i.e 'logLevel = workbox.core.LOG_LEVELS.debug'.",value:t});u(t)}};var v="cacheDidUpdate",m="cacheWillUpdate",w="cachedResponseWillBeUsed",L="fetchDidFail",E="requestWillFetch",H=(e,t)=>e.filter(e=>t in e);const x=(()=>{var e=babelHelpers.asyncToGenerator(function*(e,t,r,n=[]){let o=yield N(t,r,n);if(!o)return;const i=yield caches.open(e),l=H(n,v);let c=l.length>0?yield q(e,t):null;yield i.put(t,o);for(let r of l)yield r[v].call(r,{cacheName:e,request:t,oldResponse:c,newResponse:o})});return function(t,r,n){return e.apply(this,arguments)}})(),q=(()=>{var e=babelHelpers.asyncToGenerator(function*(e,t,r,n=[]){let o=yield(yield caches.open(e)).match(t,r);for(let i of n)w in i&&(o=yield i[w].call(i,{cacheName:e,request:t,matchOptions:r,cachedResponse:o}));return o});return function(t,r,n){return e.apply(this,arguments)}})(),N=(()=>{var e=babelHelpers.asyncToGenerator(function*(e,t,r){let n=t,o=!1;for(let t of r)if(m in t&&(o=!0,!(n=yield t[m].call(t,{request:e,response:n}))))break;return o||(n=n.ok?n:null),n||null});return function(t,r,n){return e.apply(this,arguments)}})(),O={put:x,match:q},k={fetch:(()=>{var e=babelHelpers.asyncToGenerator(function*(e,t,n=[]){"string"==typeof e&&(e=new Request(e));const o=H(n,L),i=o.length>0?e.clone():null;try{for(let t of n)E in t&&(e=yield t[E].call(t,{request:e.clone()}))}catch(e){throw new r("plugin-error-request-will-fetch",{thrownError:e})}const l=e.clone();try{return yield fetch(e,t)}catch(e){for(let e of o)yield e[L].call(e,{originalRequest:i.clone(),request:l.clone()});throw e}});return function(t,r){return e.apply(this,arguments)}})()};class R{constructor(e,t,{onupgradeneeded:r,onversionchange:n=this.e}={}){this.t=e,this.r=t,this.n=r,this.e=n,this.o=null}open(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(!e.o)return e.o=yield new Promise(function(t,r){let n=!1;setTimeout(function(){n=!0,r(new Error("The open request was blocked and timed out"))},e.OPEN_TIMEOUT);const o=indexedDB.open(e.t,e.r);o.onerror=function(e){return r(o.error)},o.onupgradeneeded=function(t){n?(o.transaction.abort(),t.target.result.close()):e.n&&e.n(t)},o.onsuccess=function(r){const o=r.target.result;n?o.close():(o.onversionchange=e.e,t(o))}}),e})()}get(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i("get",e,"readonly",...t)})()}add(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i("add",e,"readwrite",...t)})()}put(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i("put",e,"readwrite",...t)})()}delete(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){yield r.i("delete",e,"readwrite",...t)})()}getAll(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return"getAll"in IDBObjectStore.prototype?yield n.i("getAll",e,"readonly",t,r):yield n.getAllMatching(e,{query:t,count:r})})()}getAllMatching(e,t={}){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.transaction([e],"readonly",function(r,n){const o=r[e],i=[];(t.index?o.index(t.index):o).openCursor(t.query,t.direction).onsuccess=function(e){const r=e.target.result;if(r){const{primaryKey:e,key:o,value:l}=r;i.push(t.includeKeys?{primaryKey:e,key:o,value:l}:l),t.count&&i.length>=t.count?n(i):r.continue()}else n(i)}})})()}transaction(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){yield n.open();return yield new Promise(function(o,i){const l=n.o.transaction(e,t);l.onerror=function(e){return i(e.target.error)},l.onabort=function(e){return i(e.target.error)},l.oncomplete=function(){return o()};const c={};for(const t of e)c[t]=l.objectStore(t);r(c,function(e){return o(e)},function(){i(new Error("The transaction was manually aborted")),l.abort()})})})()}i(e,t,r,...n){var o=this;return babelHelpers.asyncToGenerator(function*(){yield o.open();return yield o.transaction([t],r,function(r,o){r[t][e](...n).onsuccess=function(e){o(e.target.result)}})})()}e(e){this.close()}close(){this.o&&this.o.close()}}R.prototype.OPEN_TIMEOUT=2e3;var A=Object.freeze({logger:h,assert:null,cacheNames:i,cacheWrapper:O,fetchWrapper:k,WorkboxError:r,DBWrapper:R,getFriendlyURL:e=>{const t=new URL(e,location);return t.origin===location.origin?t.pathname:t.href}});return Object.assign(g,{LOG_LEVELS:e,_private:A})}();
self.babelHelpers={asyncToGenerator:function(e){return function(){var r=e.apply(this,arguments);return new Promise(function(e,t){return function n(o,i){try{var l=r[o](i),c=l.value}catch(e){return void t(e)}if(!l.done)return Promise.resolve(c).then(function(e){n("next",e)},function(e){n("throw",e)});e(c)}("next")})}}},this.workbox=this.workbox||{},this.workbox.core=function(){"use strict";try{self.workbox.v["workbox:core:3.0.0-beta.1"]=1}catch(e){}var e={debug:0,log:1,warn:2,error:3,silent:4};const r=(e,...r)=>{let t=e;return r.length>0&&(t+=` :: ${JSON.stringify(r)}`),t};class t extends Error{constructor(e,t){let n=r(e,t);super(n),this.name=e,this.details=t}}const n={prefix:"workbox",suffix:self.registration.scope,googleAnalytics:"googleAnalytics",precache:"precache",runtime:"runtime"},o=e=>[n.prefix,e,n.suffix].filter(e=>e.length>0).join("-"),i={updateDetails:e=>{Object.keys(n).forEach(r=>{void 0!==e[r]&&(n[r]=e[r])})},getGoogleAnalyticsName:e=>e||o(n.googleAnalytics),getPrecacheName:e=>e||o(n.precache),getRuntimeName:e=>e||o(n.runtime)},l=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);let c=e.warn;const u=e=>c<=e,s=e=>c=e,a=()=>c,d=e.error,f=function(r,t,n){const o=0===r.indexOf("group")?d:e[r];if(!u(o))return;if(!n||"groupCollapsed"===r&&l)return void console[r](...t);const i=["%cworkbox",`background: ${n}; color: white; padding: 2px 0.5em; `+"border-radius: 0.5em;"];console[r](...i,...t)},h=()=>{u(d)&&console.groupEnd()},p={groupEnd:h,unprefixed:{groupEnd:h}},y={debug:"#7f8c8d",log:"#2ecc71",warn:"#f39c12",error:"#c0392b",groupCollapsed:"#3498db"};Object.keys(y).forEach(e=>(b=e,g=y[e],p[b]=((...e)=>f(b,e,g)),void(p.unprefixed[b]=((...e)=>f(b,e)))));var b,g;var v=new class{constructor(){try{self.workbox.v=self.workbox.v||{}}catch(e){}}get cacheNames(){return{googleAnalytics:i.getGoogleAnalyticsName(),precache:i.getPrecacheName(),runtime:i.getRuntimeName()}}setCacheNameDetails(e){i.updateDetails(e)}get logLevel(){return a()}setLogLevel(r){if(r>e.silent||r<e.debug)throw new t("invalid-value",{paramName:"logLevel",validValueDescription:"Please use a value from LOG_LEVELS, i.e 'logLevel = workbox.core.LOG_LEVELS.debug'.",value:r});s(r)}};var m="cacheDidUpdate",w="cacheWillUpdate",L="cachedResponseWillBeUsed",E="fetchDidFail",H="requestWillFetch",x=(e,r)=>e.filter(e=>r in e);const q=(()=>{var e=babelHelpers.asyncToGenerator(function*(e,r,t,n=[]){let o=yield O(r,t,n);if(!o)return;const i=yield caches.open(e),l=x(n,m);let c=l.length>0?yield N(e,r):null;yield i.put(r,o);for(let t of l)yield t[m].call(t,{cacheName:e,request:r,oldResponse:c,newResponse:o})});return function(r,t,n){return e.apply(this,arguments)}})(),N=(()=>{var e=babelHelpers.asyncToGenerator(function*(e,r,t,n=[]){let o=yield(yield caches.open(e)).match(r,t);for(let i of n)L in i&&(o=yield i[L].call(i,{cacheName:e,request:r,matchOptions:t,cachedResponse:o}));return o});return function(r,t,n){return e.apply(this,arguments)}})(),O=(()=>{var e=babelHelpers.asyncToGenerator(function*(e,r,t){let n=r,o=!1;for(let r of t)if(w in r&&(o=!0,!(n=yield r[w].call(r,{request:e,response:n}))))break;return o||(n=n.ok?n:null),n||null});return function(r,t,n){return e.apply(this,arguments)}})(),k={put:q,match:N},R={fetch:(()=>{var e=babelHelpers.asyncToGenerator(function*(e,r,n=[]){"string"==typeof e&&(e=new Request(e));const o=x(n,E),i=o.length>0?e.clone():null;try{for(let r of n)H in r&&(e=yield r[H].call(r,{request:e.clone()}))}catch(e){throw new t("plugin-error-request-will-fetch",{thrownError:e})}const l=e.clone();try{return yield fetch(e,r)}catch(e){for(let e of o)yield e[E].call(e,{originalRequest:i.clone(),request:l.clone()});throw e}});return function(r,t){return e.apply(this,arguments)}})()};class A{constructor(e,r,{onupgradeneeded:t,onversionchange:n=this.e}={}){this.r=e,this.t=r,this.n=t,this.e=n,this.o=null}open(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(!e.o)return e.o=yield new Promise(function(r,t){let n=!1;setTimeout(function(){n=!0,t(new Error("The open request was blocked and timed out"))},e.OPEN_TIMEOUT);const o=indexedDB.open(e.r,e.t);o.onerror=function(e){return t(o.error)},o.onupgradeneeded=function(r){n?(o.transaction.abort(),r.target.result.close()):e.n&&e.n(r)},o.onsuccess=function(t){const o=t.target.result;n?o.close():(o.onversionchange=e.e,r(o))}}),e})()}get(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.i("get",e,"readonly",...r)})()}add(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.i("add",e,"readwrite",...r)})()}put(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.i("put",e,"readwrite",...r)})()}delete(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.i("delete",e,"readwrite",...r)})()}getAll(e,r,t){var n=this;return babelHelpers.asyncToGenerator(function*(){return"getAll"in IDBObjectStore.prototype?yield n.i("getAll",e,"readonly",r,t):yield n.getAllMatching(e,{query:r,count:t})})()}getAllMatching(e,r={}){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.transaction([e],"readonly",function(t,n){const o=t[e],i=[];(r.index?o.index(r.index):o).openCursor(r.query,r.direction).onsuccess=function(e){const t=e.target.result;if(t){const{primaryKey:e,key:o,value:l}=t;i.push(r.includeKeys?{primaryKey:e,key:o,value:l}:l),r.count&&i.length>=r.count?n(i):t.continue()}else n(i)}})})()}transaction(e,r,t){var n=this;return babelHelpers.asyncToGenerator(function*(){yield n.open();return yield new Promise(function(o,i){const l=n.o.transaction(e,r);l.onerror=function(e){return i(e.target.error)},l.onabort=function(e){return i(e.target.error)},l.oncomplete=function(){return o()};const c={};for(const r of e)c[r]=l.objectStore(r);t(c,function(e){return o(e)},function(){i(new Error("The transaction was manually aborted")),l.abort()})})})()}i(e,r,t,...n){var o=this;return babelHelpers.asyncToGenerator(function*(){yield o.open();return yield o.transaction([r],t,function(t,o){t[r][e](...n).onsuccess=function(e){o(e.target.result)}})})()}e(e){this.close()}close(){this.o&&this.o.close()}}A.prototype.OPEN_TIMEOUT=2e3;var D=Object.freeze({logger:p,assert:null,cacheNames:i,cacheWrapper:k,fetchWrapper:R,WorkboxError:t,DBWrapper:A,getFriendlyURL:e=>{const r=new URL(e,location);return r.origin===location.origin?r.pathname:r.href}});return Object.assign(v,{LOG_LEVELS:e,_private:D})}();
//# sourceMappingURL=workbox-core.prod.js.map
{
"name": "workbox-core",
"version": "3.0.0-beta.0",
"version": "3.0.0-beta.1",
"license": "Apache-2.0",

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

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