@pixagram/lacerta-db 0.12.3 → 0.12.5
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/browser.min.js +2 -2
- package/dist/index.min.js +2 -2
- package/index.js +10 -4
- package/package.json +4 -3
- package/webpack.config.js +5 -2
package/index.js
CHANGED
|
@@ -37,12 +37,12 @@ import TurboBase64 from "@pixagram/turbobase64";
|
|
|
37
37
|
// detectCircular — only affects serialization behavior (throws vs infinite loop)
|
|
38
38
|
// memoryPoolSize — only affects memory allocation
|
|
39
39
|
const TURBO_SERIAL_DEFAULTS = {
|
|
40
|
-
compression:
|
|
41
|
-
preservePropertyDescriptors:
|
|
40
|
+
compression: false,
|
|
41
|
+
preservePropertyDescriptors: false,
|
|
42
42
|
deduplication: false,
|
|
43
43
|
simdOptimization: true,
|
|
44
44
|
detectCircular: false,
|
|
45
|
-
shareArrayBuffers:
|
|
45
|
+
shareArrayBuffers: false,
|
|
46
46
|
allowFunction: false,
|
|
47
47
|
serializeFunctions: false,
|
|
48
48
|
memoryPoolSize: 65536 * 4
|
|
@@ -2491,6 +2491,8 @@ class IndexManager {
|
|
|
2491
2491
|
const decoded = this._base64.decode(stored);
|
|
2492
2492
|
const metadata = this._serializer.deserialize(decoded);
|
|
2493
2493
|
|
|
2494
|
+
if (!metadata || !Array.isArray(metadata.indexes)) return;
|
|
2495
|
+
|
|
2494
2496
|
for (const indexDef of metadata.indexes) {
|
|
2495
2497
|
const { name, ...index } = indexDef;
|
|
2496
2498
|
this._indexes.set(name, index);
|
|
@@ -3197,6 +3199,7 @@ class DatabaseMetadata {
|
|
|
3197
3199
|
this.name = name;
|
|
3198
3200
|
this._serializer = serializer;
|
|
3199
3201
|
this._base64 = base64;
|
|
3202
|
+
if (!data || typeof data !== 'object') data = {};
|
|
3200
3203
|
this.collections = data.collections || {};
|
|
3201
3204
|
this.totalSizeKB = data.totalSizeKB || 0;
|
|
3202
3205
|
this.totalLength = data.totalLength || 0;
|
|
@@ -3219,7 +3222,10 @@ class DatabaseMetadata {
|
|
|
3219
3222
|
try {
|
|
3220
3223
|
const decoded = base64.decode(stored);
|
|
3221
3224
|
const data = serializer.deserialize(decoded);
|
|
3222
|
-
|
|
3225
|
+
if (data && typeof data === 'object') {
|
|
3226
|
+
return new DatabaseMetadata(dbName, data, serializer, base64);
|
|
3227
|
+
}
|
|
3228
|
+
// Corrupted/stale — fall through to fresh metadata
|
|
3223
3229
|
} catch (e) {
|
|
3224
3230
|
console.error('Failed to load metadata:', e);
|
|
3225
3231
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixagram/lacerta-db",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.5",
|
|
4
4
|
"description": "Lacerta-DB is a Javascript IndexedDB Database for Web Browsers. Simple, Fast, Secure.",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@babel/core": "^7.23.6",
|
|
7
|
+
"@babel/plugin-transform-optional-chaining": "^7.28.6",
|
|
7
8
|
"@babel/preset-env": "^7.23.6",
|
|
8
9
|
"babel-loader": "~8.3.0",
|
|
9
10
|
"clean-jsdoc-theme": "^4.3.0",
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
17
18
|
"@pixagram/turbobase64": "~0.0.2",
|
|
18
|
-
"@pixagram/turboserial": "~0.
|
|
19
|
+
"@pixagram/turboserial": "~0.3.0"
|
|
19
20
|
},
|
|
20
21
|
"build": {},
|
|
21
22
|
"author": "Affolter Matias",
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
],
|
|
40
41
|
"scripts": {
|
|
41
42
|
"build": "NODE_OPTIONS=--openssl-legacy-provider NODE_ENV=production webpack --node-env production",
|
|
42
|
-
"docs": "documentation build index.js -f md > documentation.md"
|
|
43
|
+
"docs": "documentation build index.js -f md > documentation.md"
|
|
43
44
|
},
|
|
44
45
|
"license": "MIT",
|
|
45
46
|
"repository": {
|
package/webpack.config.js
CHANGED
|
@@ -21,16 +21,19 @@ module.exports = {
|
|
|
21
21
|
rules: [
|
|
22
22
|
{
|
|
23
23
|
test: /\.js$/,
|
|
24
|
-
exclude: /(
|
|
24
|
+
exclude: /node_modules\/(?!@pixagram)/,
|
|
25
25
|
use: {
|
|
26
26
|
loader: 'babel-loader',
|
|
27
27
|
options: {
|
|
28
28
|
"presets": [
|
|
29
29
|
["@babel/preset-env", {
|
|
30
30
|
"targets": {
|
|
31
|
-
"chrome": "
|
|
31
|
+
"chrome": "100"
|
|
32
32
|
}
|
|
33
33
|
}]
|
|
34
|
+
],
|
|
35
|
+
"plugins": [
|
|
36
|
+
"@babel/plugin-transform-optional-chaining"
|
|
34
37
|
]
|
|
35
38
|
}
|
|
36
39
|
}
|