Socket
Socket
Sign inDemoInstall

zapier-async-storage

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zapier-async-storage - npm Package Compare versions

Comparing version 0.3.3 to 0.3.4

73

build/index.js

@@ -123,44 +123,53 @@ 'use strict';

var dbConnection = indexedDB$1.open(name, version);
try {
var dbConnection = indexedDB$1.open(name, version);
// An upgrade needs to be performed, clear out the old object stores
// and then create the new object store
dbConnection.onupgradeneeded = function (evt) {
var oldVersion = evt.oldVersion,
newVersion = evt.newVersion;
// An upgrade needs to be performed, clear out the old object stores
// and then create the new object store
dbConnection.onupgradeneeded = function (evt) {
var oldVersion = evt.oldVersion,
newVersion = evt.newVersion;
var dbInstance = dbConnection.result;
var dbInstance = dbConnection.result;
try {
dbInstance.createObjectStore(storeName);
} catch (err) {
if (err.name === 'ConstraintError') {
console.warn('Database ' + name + ' has been upgraded from ' + oldVersion + ' -> ' + newVersion + ' but the table ' + storeName + ' already exists.');
try {
dbInstance.createObjectStore(storeName);
} catch (err) {
if (err.name === 'ConstraintError') {
console.warn('Database ' + name + ' has been upgraded from ' + oldVersion + ' -> ' + newVersion + ' but the table ' + storeName + ' already exists.');
// Force the store to clear because we've incremented the version
shouldClear = true;
} else {
throw err;
// Force the store to clear because we've incremented the version
shouldClear = true;
} else {
throw err;
}
}
}
};
};
// An error occured attempting to connect to the DB
dbConnection.onerror = function (evt) {
reject(evt.target.error);
};
// An error occured attempting to connect to the DB
dbConnection.onerror = function (evt) {
// See https://mzl.la/2wCPech
if (dbConnection.error && dbConnection.error.name === 'InvalidStateError') {
evt.preventDefault();
}
// Successfully connected to the database
dbConnection.onsuccess = function (evt) {
var dbInstance = evt.target.result;
reject(evt.target.error);
};
if (shouldClear) {
resolve(clearStore(dbInstance, storeName));
// Successfully connected to the database
dbConnection.onsuccess = function (evt) {
var dbInstance = evt.target.result;
if (shouldClear) {
resolve(clearStore(dbInstance, storeName));
return;
}
resolve(dbInstance);
return;
}
};
} catch (e) {
reject(e);
}
resolve(dbInstance);
return;
};
return;

@@ -167,0 +176,0 @@ });

@@ -85,44 +85,53 @@ 'use strict';

var dbConnection = indexedDB.open(name, version);
try {
var dbConnection = indexedDB.open(name, version);
// An upgrade needs to be performed, clear out the old object stores
// and then create the new object store
dbConnection.onupgradeneeded = function (evt) {
var oldVersion = evt.oldVersion,
newVersion = evt.newVersion;
// An upgrade needs to be performed, clear out the old object stores
// and then create the new object store
dbConnection.onupgradeneeded = function (evt) {
var oldVersion = evt.oldVersion,
newVersion = evt.newVersion;
var dbInstance = dbConnection.result;
var dbInstance = dbConnection.result;
try {
dbInstance.createObjectStore(storeName);
} catch (err) {
if (err.name === 'ConstraintError') {
console.warn('Database ' + name + ' has been upgraded from ' + oldVersion + ' -> ' + newVersion + ' but the table ' + storeName + ' already exists.');
try {
dbInstance.createObjectStore(storeName);
} catch (err) {
if (err.name === 'ConstraintError') {
console.warn('Database ' + name + ' has been upgraded from ' + oldVersion + ' -> ' + newVersion + ' but the table ' + storeName + ' already exists.');
// Force the store to clear because we've incremented the version
shouldClear = true;
} else {
throw err;
// Force the store to clear because we've incremented the version
shouldClear = true;
} else {
throw err;
}
}
}
};
};
// An error occured attempting to connect to the DB
dbConnection.onerror = function (evt) {
reject(evt.target.error);
};
// An error occured attempting to connect to the DB
dbConnection.onerror = function (evt) {
// See https://mzl.la/2wCPech
if (dbConnection.error && dbConnection.error.name === 'InvalidStateError') {
evt.preventDefault();
}
// Successfully connected to the database
dbConnection.onsuccess = function (evt) {
var dbInstance = evt.target.result;
reject(evt.target.error);
};
if (shouldClear) {
resolve((0, _clearStore2.default)(dbInstance, storeName));
// Successfully connected to the database
dbConnection.onsuccess = function (evt) {
var dbInstance = evt.target.result;
if (shouldClear) {
resolve((0, _clearStore2.default)(dbInstance, storeName));
return;
}
resolve(dbInstance);
return;
}
};
} catch (e) {
reject(e);
}
resolve(dbInstance);
return;
};
return;

@@ -129,0 +138,0 @@ });

{
"name": "zapier-async-storage",
"version": "0.3.3",
"version": "0.3.4",
"description": "Minimalist wrapper for IndexedDB",

@@ -5,0 +5,0 @@ "main": "build/index.js",

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