@bbn/bbn 1.0.404 → 1.0.406
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 -6
- package/dist/fn/string/treatForHash.js +4 -4
- 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);
|
|
@@ -318,9 +315,8 @@ var db = {
|
|
|
318
315
|
});
|
|
319
316
|
},
|
|
320
317
|
add: function (database, name, structure) {
|
|
321
|
-
var _a
|
|
322
|
-
|
|
323
|
-
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)) {
|
|
324
320
|
if (!db._structures[database]) {
|
|
325
321
|
db._structures[database] = {};
|
|
326
322
|
}
|
|
@@ -42,7 +42,10 @@ export default function treatForHash(value, depth, level, visited, fn) {
|
|
|
42
42
|
value = "__BBN_BOOLEAN__" + value.toString();
|
|
43
43
|
}
|
|
44
44
|
else if (![undefined, Object, Array, null].includes(value === null || value === void 0 ? void 0 : value.constructor)) {
|
|
45
|
-
if (
|
|
45
|
+
if (isCp(value)) {
|
|
46
|
+
value = "__BBN_CP__" + value.$options.name + "/" + value.$cid;
|
|
47
|
+
}
|
|
48
|
+
else if (isDom(value)) {
|
|
46
49
|
if (value.bbnId) {
|
|
47
50
|
value =
|
|
48
51
|
"__BBN_DOM__" + value.tagName + "/" + value.bbnId + value.bbnHash;
|
|
@@ -51,9 +54,6 @@ export default function treatForHash(value, depth, level, visited, fn) {
|
|
|
51
54
|
value = "__BBN_DOM__" + value.tagName + "/" + value.className;
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
|
-
else if (isCp(value)) {
|
|
55
|
-
value = "__BBN_CP__" + value.$options.name + "/" + value.$cid;
|
|
56
|
-
}
|
|
57
57
|
else {
|
|
58
58
|
value = "__BBN_OBJECT__" + value.constructor.toString();
|
|
59
59
|
}
|