Socket
Socket
Sign inDemoInstall

workbox-background-sync

Package Overview
Dependencies
Maintainers
4
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workbox-background-sync - npm Package Compare versions

Comparing version 3.6.2 to 4.0.0-alpha.0

430

build/workbox-background-sync.dev.js

@@ -6,22 +6,13 @@ this.workbox = this.workbox || {};

try {
self.workbox.v['workbox:background-sync:3.6.2'] = 1;
self.workbox.v['workbox:background-sync:4.0.0-alpha.0'] = 1;
} catch (e) {} // eslint-disable-line
/*
Copyright 2017 Google Inc. All Rights Reserved.
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
Copyright 2018 Google LLC
http://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.
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const serializableProperties = ['method', 'referrer', 'referrerPolicy', 'mode', 'credentials', 'cache', 'redirect', 'integrity', 'keepalive'];
/**

@@ -33,2 +24,3 @@ * A class to make it easier to serialize and de-serialize requests so they

*/
class StorableRequest {

@@ -44,29 +36,30 @@ /**

*/
static fromRequest(request) {
return babelHelpers.asyncToGenerator(function* () {
const requestInit = { headers: {} };
static async fromRequest(request) {
const requestInit = {
headers: {}
}; // Set the body if present.
// Set the body if present.
if (request.method !== 'GET') {
// Use blob to support non-text request bodies,
// and clone first in case the caller still needs the request.
requestInit.body = yield request.clone().blob();
}
if (request.method !== 'GET') {
// Use blob to support non-text request bodies,
// and clone first in case the caller still needs the request.
requestInit.body = await request.clone().blob();
} // Convert the headers from an iterable to an object.
// Convert the headers from an iterable to an object.
for (const [key, value] of request.headers.entries()) {
requestInit.headers[key] = value;
}
// Add all other serializable request properties
for (const prop of serializableProperties) {
if (request[prop] !== undefined) {
requestInit[prop] = request[prop];
}
for (const [key, value] of request.headers.entries()) {
requestInit.headers[key] = value;
} // Add all other serializable request properties
for (const prop of serializableProperties) {
if (request[prop] !== undefined) {
requestInit[prop] = request[prop];
}
}
return new StorableRequest({ url: request.url, requestInit });
})();
return new StorableRequest({
url: request.url,
requestInit
});
}
/**

@@ -86,10 +79,14 @@ * Accepts a URL and RequestInit dictionary that can be used to create a

*/
constructor({ url, requestInit, timestamp = Date.now() }) {
constructor({
url,
requestInit,
timestamp = Date.now()
}) {
this.url = url;
this.requestInit = requestInit;
this.requestInit = requestInit; // "Private"
// "Private"
this._timestamp = timestamp;
}
/**

@@ -102,6 +99,7 @@ * Gets the private _timestamp property.

*/
get timestamp() {
return this._timestamp;
}
/**

@@ -114,2 +112,4 @@ * Coverts this instance to a plain Object.

*/
toObject() {

@@ -122,3 +122,2 @@ return {

}
/**

@@ -131,6 +130,7 @@ * Converts this instance to a Request.

*/
toRequest() {
return new Request(this.url, this.requestInit);
}
/**

@@ -143,5 +143,8 @@ * Creates and returns a deep clone of the instance.

*/
clone() {
const requestInit = Object.assign({}, this.requestInit);
requestInit.headers = Object.assign({}, this.requestInit.headers);
if (this.requestInit.body) {

@@ -157,19 +160,12 @@ requestInit.body = this.requestInit.body.slice();

}
}
/*
Copyright 2017 Google Inc. All Rights Reserved.
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
Copyright 2018 Google LLC
http://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.
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const DB_NAME = 'workbox-background-sync';

@@ -182,16 +178,8 @@ const OBJECT_STORE_NAME = 'requests';

/*
Copyright 2017 Google Inc. All Rights Reserved.
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
Copyright 2018 Google LLC
http://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.
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.
*/
/**

@@ -203,2 +191,3 @@ * A class to manage storing requests from a Queue in IndexedbDB,

*/
class QueueStore {

@@ -216,6 +205,9 @@ /**

this._db = new DBWrapper_mjs.DBWrapper(DB_NAME, 1, {
onupgradeneeded: evt => evt.target.result.createObjectStore(OBJECT_STORE_NAME, { autoIncrement: true }).createIndex(INDEXED_PROP, INDEXED_PROP, { unique: false })
onupgradeneeded: evt => evt.target.result.createObjectStore(OBJECT_STORE_NAME, {
autoIncrement: true
}).createIndex(INDEXED_PROP, INDEXED_PROP, {
unique: false
})
});
}
/**

@@ -229,13 +221,10 @@ * Takes a StorableRequest instance, converts it to an object and adds it

*/
addEntry(storableRequest) {
var _this = this;
return babelHelpers.asyncToGenerator(function* () {
yield _this._db.add(OBJECT_STORE_NAME, {
queueName: _this._queue.name,
storableRequest: storableRequest.toObject()
});
})();
async addEntry(storableRequest) {
await this._db.add(OBJECT_STORE_NAME, {
queueName: this._queue.name,
storableRequest: storableRequest.toObject()
});
}
/**

@@ -250,38 +239,28 @@ * Gets the oldest entry in the object store, removes it, and returns the

*/
getAndRemoveOldestEntry() {
var _this2 = this;
return babelHelpers.asyncToGenerator(function* () {
const [entry] = yield _this2._db.getAllMatching(OBJECT_STORE_NAME, {
index: INDEXED_PROP,
query: IDBKeyRange.only(_this2._queue.name),
count: 1,
includeKeys: true
});
if (entry) {
yield _this2._db.delete(OBJECT_STORE_NAME, entry.primaryKey);
return new StorableRequest(entry.value.storableRequest);
}
})();
async getAndRemoveOldestEntry() {
const [entry] = await this._db.getAllMatching(OBJECT_STORE_NAME, {
index: INDEXED_PROP,
query: IDBKeyRange.only(this._queue.name),
count: 1,
includeKeys: true
});
if (entry) {
await this._db.delete(OBJECT_STORE_NAME, entry.primaryKey);
return new StorableRequest(entry.value.storableRequest);
}
}
}
/*
Copyright 2017 Google Inc. All Rights Reserved.
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
Copyright 2018 Google LLC
http://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.
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 queueNames = new Set();
/**

@@ -294,2 +273,3 @@ * A class to manage storing failed requests in IndexedDB and retrying them

*/
class Queue {

@@ -328,3 +308,5 @@ /**

if (queueNames.has(name)) {
throw new WorkboxError_mjs.WorkboxError('duplicate-queue-name', { name });
throw new WorkboxError_mjs.WorkboxError('duplicate-queue-name', {
name
});
} else {

@@ -341,10 +323,10 @@ queueNames.add(name);

}
/**
* @return {string}
*/
get name() {
return this._name;
}
/**

@@ -357,26 +339,24 @@ * Stores the passed request into IndexedDB. The database used is

*/
addRequest(request) {
var _this = this;
return babelHelpers.asyncToGenerator(function* () {
{
assert_mjs.assert.isInstance(request, Request, {
moduleName: 'workbox-background-sync',
className: 'Queue',
funcName: 'addRequest',
paramName: 'request'
});
}
const storableRequest = yield StorableRequest.fromRequest(request.clone());
yield _this._runCallback('requestWillEnqueue', storableRequest);
yield _this._queueStore.addEntry(storableRequest);
yield _this._registerSync();
{
logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(storableRequest.url)}' has been
added to background sync queue '${_this._name}'.`);
}
})();
async addRequest(request) {
{
assert_mjs.assert.isInstance(request, Request, {
moduleName: 'workbox-background-sync',
className: 'Queue',
funcName: 'addRequest',
paramName: 'request'
});
}
const storableRequest = await StorableRequest.fromRequest(request.clone());
await this._runCallback('requestWillEnqueue', storableRequest);
await this._queueStore.addEntry(storableRequest);
await this._registerSync();
{
logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(storableRequest.url)}' has been
added to background sync queue '${this._name}'.`);
}
}
/**

@@ -389,59 +369,60 @@ * Retrieves all stored requests in IndexedDB and retries them. If the

*/
replayRequests() {
var _this2 = this;
return babelHelpers.asyncToGenerator(function* () {
const now = Date.now();
const replayedRequests = [];
const failedRequests = [];
let storableRequest;
while (storableRequest = yield _this2._queueStore.getAndRemoveOldestEntry()) {
// Make a copy so the unmodified request can be stored
// in the event of a replay failure.
const storableRequestClone = storableRequest.clone();
async replayRequests() {
const now = Date.now();
const replayedRequests = [];
const failedRequests = [];
let storableRequest;
// Ignore requests older than maxRetentionTime.
const maxRetentionTimeInMs = _this2._maxRetentionTime * 60 * 1000;
if (now - storableRequest.timestamp > maxRetentionTimeInMs) {
continue;
}
while (storableRequest = await this._queueStore.getAndRemoveOldestEntry()) {
// Make a copy so the unmodified request can be stored
// in the event of a replay failure.
const storableRequestClone = storableRequest.clone(); // Ignore requests older than maxRetentionTime.
yield _this2._runCallback('requestWillReplay', storableRequest);
const maxRetentionTimeInMs = this._maxRetentionTime * 60 * 1000;
const replay = { request: storableRequest.toRequest() };
if (now - storableRequest.timestamp > maxRetentionTimeInMs) {
continue;
}
try {
// Clone the request before fetching so callbacks get an unused one.
replay.response = yield fetch(replay.request.clone());
{
logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(storableRequest.url)}'
await this._runCallback('requestWillReplay', storableRequest);
const replay = {
request: storableRequest.toRequest()
};
try {
// Clone the request before fetching so callbacks get an unused one.
replay.response = await fetch(replay.request.clone());
{
logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(storableRequest.url)}'
has been replayed`);
}
} catch (err) {
{
logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(storableRequest.url)}'
}
} catch (err) {
{
logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(storableRequest.url)}'
failed to replay`);
}
replay.error = err;
failedRequests.push(storableRequestClone);
}
replayedRequests.push(replay);
replay.error = err;
failedRequests.push(storableRequestClone);
}
yield _this2._runCallback('queueDidReplay', replayedRequests);
replayedRequests.push(replay);
}
// If any requests failed, put the failed requests back in the queue
// and rethrow the failed requests count.
if (failedRequests.length) {
yield Promise.all(failedRequests.map(function (storableRequest) {
return _this2._queueStore.addEntry(storableRequest);
}));
await this._runCallback('queueDidReplay', replayedRequests); // If any requests failed, put the failed requests back in the queue
// and rethrow the failed requests count.
throw new WorkboxError_mjs.WorkboxError('queue-replay-failed', { name: _this2._name, count: failedRequests.length });
}
})();
if (failedRequests.length) {
await Promise.all(failedRequests.map(storableRequest => {
return this._queueStore.addEntry(storableRequest);
}));
throw new WorkboxError_mjs.WorkboxError('queue-replay-failed', {
name: this._name,
count: failedRequests.length
});
}
}
/**

@@ -454,12 +435,9 @@ * Runs the passed callback if it exists.

*/
_runCallback(name, ...args) {
var _this3 = this;
return babelHelpers.asyncToGenerator(function* () {
if (typeof _this3._callbacks[name] === 'function') {
yield _this3._callbacks[name].apply(null, args);
}
})();
async _runCallback(name, ...args) {
if (typeof this._callbacks[name] === 'function') {
await this._callbacks[name].apply(null, args);
}
}
/**

@@ -472,2 +450,4 @@ * In sync-supporting browsers, this adds a listener for the sync event.

*/
_addSyncListener() {

@@ -481,2 +461,3 @@ if ('sync' in registration) {

}
event.waitUntil(this.replayRequests());

@@ -488,9 +469,9 @@ }

logger_mjs.logger.log(`Background sync replaying without background sync event`);
}
// If the browser doesn't support background sync, retry
} // If the browser doesn't support background sync, retry
// every time the service worker starts up as a fallback.
this.replayRequests();
}
}
/**

@@ -501,20 +482,17 @@ * Registers a sync event with a tag unique to this instance.

*/
_registerSync() {
var _this4 = this;
return babelHelpers.asyncToGenerator(function* () {
if ('sync' in registration) {
try {
yield registration.sync.register(`${TAG_PREFIX}:${_this4._name}`);
} catch (err) {
// This means the registration failed for some reason, possibly due to
// the user disabling it.
{
logger_mjs.logger.warn(`Unable to register sync event for '${_this4._name}'.`, err);
}
async _registerSync() {
if ('sync' in registration) {
try {
await registration.sync.register(`${TAG_PREFIX}:${this._name}`);
} catch (err) {
// This means the registration failed for some reason, possibly due to
// the user disabling it.
{
logger_mjs.logger.warn(`Unable to register sync event for '${this._name}'.`, err);
}
}
})();
}
}
/**

@@ -528,22 +506,17 @@ * Returns the set of queue names. This is primarily used to reset the list

*/
static get _queueNames() {
return queueNames;
}
}
/*
Copyright 2017 Google Inc. All Rights Reserved.
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
Copyright 2018 Google LLC
http://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.
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.
*/
/**

@@ -555,2 +528,3 @@ * A class implementing the `fetchDidFail` lifecycle callback. This makes it

*/
class Plugin {

@@ -566,3 +540,2 @@ /**

}
/**

@@ -573,24 +546,18 @@ * @param {Object} options

*/
fetchDidFail({ request }) {
var _this = this;
return babelHelpers.asyncToGenerator(function* () {
yield _this._queue.addRequest(request);
})();
async fetchDidFail({
request
}) {
await this._queue.addRequest(request);
}
}
/*
Copyright 2017 Google Inc. All Rights Reserved.
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
Copyright 2018 Google LLC
http://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.
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.
*/

@@ -604,14 +571,7 @@

/*
Copyright 2017 Google Inc. All Rights Reserved.
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
Copyright 2018 Google LLC
http://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.
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.
*/

@@ -618,0 +578,0 @@

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

this.workbox=this.workbox||{},this.workbox.backgroundSync=function(e,t){"use strict";try{self.workbox.v["workbox:background-sync:3.6.2"]=1}catch(e){}const r=["method","referrer","referrerPolicy","mode","credentials","cache","redirect","integrity","keepalive"];class s{static fromRequest(e){return babelHelpers.asyncToGenerator(function*(){const t={headers:{}};"GET"!==e.method&&(t.body=yield e.clone().blob());for(const[r,s]of e.headers.entries())t.headers[r]=s;for(const s of r)void 0!==e[s]&&(t[s]=e[s]);return new s({url:e.url,requestInit:t})})()}constructor({url:e,requestInit:t,timestamp:r=Date.now()}){this.url=e,this.requestInit=t,this.e=r}get timestamp(){return this.e}toObject(){return{url:this.url,timestamp:this.timestamp,requestInit:this.requestInit}}toRequest(){return new Request(this.url,this.requestInit)}clone(){const e=Object.assign({},this.requestInit);return e.headers=Object.assign({},this.requestInit.headers),this.requestInit.body&&(e.body=this.requestInit.body.slice()),new s({url:this.url,timestamp:this.timestamp,requestInit:e})}}const i="workbox-background-sync",n="requests",u="queueName",c="workbox-background-sync",o=10080;class l{constructor(t){this.t=t,this.r=new e.DBWrapper(i,1,{onupgradeneeded:e=>e.target.result.createObjectStore(n,{autoIncrement:!0}).createIndex(u,u,{unique:!1})})}addEntry(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.r.add(n,{queueName:t.t.name,storableRequest:e.toObject()})})()}getAndRemoveOldestEntry(){var e=this;return babelHelpers.asyncToGenerator(function*(){const[t]=yield e.r.getAllMatching(n,{index:u,query:IDBKeyRange.only(e.t.name),count:1,includeKeys:!0});if(t)return yield e.r.delete(n,t.primaryKey),new s(t.value.storableRequest)})()}}const a=new Set;class h{constructor(e,{callbacks:r={},maxRetentionTime:s=o}={}){if(a.has(e))throw new t.WorkboxError("duplicate-queue-name",{name:e});a.add(e),this.s=e,this.i=r,this.n=s,this.u=new l(this),this.c()}get name(){return this.s}addRequest(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=yield s.fromRequest(e.clone());yield t.o("requestWillEnqueue",r),yield t.u.addEntry(r),yield t.l()})()}replayRequests(){var e=this;return babelHelpers.asyncToGenerator(function*(){const r=Date.now(),s=[],i=[];let n;for(;n=yield e.u.getAndRemoveOldestEntry();){const t=n.clone(),u=60*e.n*1e3;if(r-n.timestamp>u)continue;yield e.o("requestWillReplay",n);const c={request:n.toRequest()};try{c.response=yield fetch(c.request.clone())}catch(e){c.error=e,i.push(t)}s.push(c)}if(yield e.o("queueDidReplay",s),i.length)throw yield Promise.all(i.map(function(t){return e.u.addEntry(t)})),new t.WorkboxError("queue-replay-failed",{name:e.s,count:i.length})})()}o(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){"function"==typeof r.i[e]&&(yield r.i[e].apply(null,t))})()}c(){"sync"in registration?self.addEventListener("sync",e=>{e.tag===`${c}:${this.s}`&&e.waitUntil(this.replayRequests())}):this.replayRequests()}l(){var e=this;return babelHelpers.asyncToGenerator(function*(){if("sync"in registration)try{yield registration.sync.register(`${c}:${e.s}`)}catch(e){}})()}static get a(){return a}}return Object.freeze({Queue:h,Plugin:class{constructor(...e){this.t=new h(...e),this.fetchDidFail=this.fetchDidFail.bind(this)}fetchDidFail({request:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.t.addRequest(e)})()}}})}(workbox.core._private,workbox.core._private);
this.workbox=this.workbox||{},this.workbox.backgroundSync=function(t,e){"use strict";try{self.workbox.v["workbox:background-sync:4.0.0-alpha.0"]=1}catch(t){}const s=["method","referrer","referrerPolicy","mode","credentials","cache","redirect","integrity","keepalive"];class i{static async fromRequest(t){const e={headers:{}};"GET"!==t.method&&(e.body=await t.clone().blob());for(const[s,i]of t.headers.entries())e.headers[s]=i;for(const i of s)void 0!==t[i]&&(e[i]=t[i]);return new i({url:t.url,requestInit:e})}constructor({url:t,requestInit:e,timestamp:s=Date.now()}){this.url=t,this.requestInit=e,this.t=s}get timestamp(){return this.t}toObject(){return{url:this.url,timestamp:this.timestamp,requestInit:this.requestInit}}toRequest(){return new Request(this.url,this.requestInit)}clone(){const t=Object.assign({},this.requestInit);return t.headers=Object.assign({},this.requestInit.headers),this.requestInit.body&&(t.body=this.requestInit.body.slice()),new i({url:this.url,timestamp:this.timestamp,requestInit:t})}}const n="workbox-background-sync",a="requests",r="queueName",c="workbox-background-sync",u=10080;class h{constructor(e){this.e=e,this.s=new t.DBWrapper(n,1,{onupgradeneeded:t=>t.target.result.createObjectStore(a,{autoIncrement:!0}).createIndex(r,r,{unique:!1})})}async addEntry(t){await this.s.add(a,{queueName:this.e.name,storableRequest:t.toObject()})}async getAndRemoveOldestEntry(){const[t]=await this.s.getAllMatching(a,{index:r,query:IDBKeyRange.only(this.e.name),count:1,includeKeys:!0});if(t)return await this.s.delete(a,t.primaryKey),new i(t.value.storableRequest)}}const o=new Set;class l{constructor(t,{callbacks:s={},maxRetentionTime:i=u}={}){if(o.has(t))throw new e.WorkboxError("duplicate-queue-name",{name:t});o.add(t),this.i=t,this.n=s,this.a=i,this.r=new h(this),this.c()}get name(){return this.i}async addRequest(t){const e=await i.fromRequest(t.clone());await this.u("requestWillEnqueue",e),await this.r.addEntry(e),await this.h()}async replayRequests(){const t=Date.now(),s=[],i=[];let n;for(;n=await this.r.getAndRemoveOldestEntry();){const e=n.clone(),a=60*this.a*1e3;if(t-n.timestamp>a)continue;await this.u("requestWillReplay",n);const r={request:n.toRequest()};try{r.response=await fetch(r.request.clone())}catch(t){r.error=t,i.push(e)}s.push(r)}if(await this.u("queueDidReplay",s),i.length)throw await Promise.all(i.map(t=>this.r.addEntry(t))),new e.WorkboxError("queue-replay-failed",{name:this.i,count:i.length})}async u(t,...e){"function"==typeof this.n[t]&&await this.n[t].apply(null,e)}c(){"sync"in registration?self.addEventListener("sync",t=>{t.tag===`${c}:${this.i}`&&t.waitUntil(this.replayRequests())}):this.replayRequests()}async h(){if("sync"in registration)try{await registration.sync.register(`${c}:${this.i}`)}catch(t){}}static get o(){return o}}return Object.freeze({Queue:l,Plugin:class{constructor(...t){this.e=new l(...t),this.fetchDidFail=this.fetchDidFail.bind(this)}async fetchDidFail({request:t}){await this.e.addRequest(t)}}})}(workbox.core._private,workbox.core._private);
//# sourceMappingURL=workbox-background-sync.prod.js.map
{
"name": "workbox-background-sync",
"version": "3.6.2",
"license": "Apache-2.0",
"version": "4.0.0-alpha.0",
"license": "MIT",
"author": "Google's Web DevRel Team",

@@ -30,4 +30,5 @@ "description": "Queues failed requests and uses the Background Sync API to replay them when the network is available",

"dependencies": {
"workbox-core": "^3.6.2"
}
"workbox-core": "^4.0.0-alpha.0"
},
"gitHead": "db1fb73fd32fbd5cbf42e246e6144011a5c6edc2"
}

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