@bbn/bbn 1.0.403 → 1.0.405
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bbn.js +1 -1
- package/dist/bbn.js.map +1 -1
- package/dist/db.js +2 -11
- package/package.json +1 -1
package/dist/db.js
CHANGED
|
@@ -113,7 +113,6 @@ var dbObject = function (dbName) {
|
|
|
113
113
|
var res = 0;
|
|
114
114
|
for (var i = 0; i < rows.length; i++) {
|
|
115
115
|
var newData = extend({}, replace ? (_a = {}, _a[primary] = rows[i][primary], _a) : rows[i], data);
|
|
116
|
-
log("UPDATING FROM BBN-JS", newData);
|
|
117
116
|
if (!newData[primary]) {
|
|
118
117
|
throw new Error(_("No primary key in the data"));
|
|
119
118
|
}
|
|
@@ -274,7 +273,6 @@ var db = {
|
|
|
274
273
|
_stores: {},
|
|
275
274
|
ok: idb !== undefined,
|
|
276
275
|
updateStructure: function (storeName, structure, req) {
|
|
277
|
-
bbn.fn.log("Updating structure for store:", storeName, structure, req);
|
|
278
276
|
var primary = structure.keys.PRIMARY.columns.length > 1 ? structure.keys.PRIMARY.columns : structure.keys.PRIMARY.columns[0];
|
|
279
277
|
var stores = req.objectStoreNames;
|
|
280
278
|
if (!stores.contains(storeName)) {
|
|
@@ -300,7 +298,6 @@ var db = {
|
|
|
300
298
|
var num = Math.max.apply(Math, __spreadArray([1], Object.keys(db._structures[name]).map(function (a) { return db._structures[name][a].num || 1; }), false));
|
|
301
299
|
var conn_1 = idb.open(name, num);
|
|
302
300
|
conn_1.onupgradeneeded = function () {
|
|
303
|
-
log("UPGRADE NEEDED");
|
|
304
301
|
var req = conn_1.result;
|
|
305
302
|
iterate(db._structures[name], function (structure, storeName) {
|
|
306
303
|
_this.updateStructure(storeName, structure, req);
|
|
@@ -309,11 +306,6 @@ var db = {
|
|
|
309
306
|
conn_1.onsuccess = function () {
|
|
310
307
|
db._connections[name] = conn_1.result;
|
|
311
308
|
var obj = new dbObject(name);
|
|
312
|
-
bbn.fn.iterate(db._structures[name], function (structure, storeName) {
|
|
313
|
-
if (!db._stores[storeName]) {
|
|
314
|
-
_this.updateStructure(storeName, structure, conn_1.result);
|
|
315
|
-
}
|
|
316
|
-
});
|
|
317
309
|
resolve(obj);
|
|
318
310
|
};
|
|
319
311
|
}
|
|
@@ -323,9 +315,8 @@ var db = {
|
|
|
323
315
|
});
|
|
324
316
|
},
|
|
325
317
|
add: function (database, name, structure) {
|
|
326
|
-
var _a
|
|
327
|
-
|
|
328
|
-
if (((_b = structure === null || structure === void 0 ? void 0 : structure.keys) === null || _b === void 0 ? void 0 : _b.PRIMARY) && (structure === null || structure === void 0 ? void 0 : structure.fields)) {
|
|
318
|
+
var _a;
|
|
319
|
+
if (((_a = structure === null || structure === void 0 ? void 0 : structure.keys) === null || _a === void 0 ? void 0 : _a.PRIMARY) && (structure === null || structure === void 0 ? void 0 : structure.fields)) {
|
|
329
320
|
if (!db._structures[database]) {
|
|
330
321
|
db._structures[database] = {};
|
|
331
322
|
}
|