@preference-sl/prefconfigurator-wasm 4.1.1 → 4.1.4
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/_framework/PrefConfigurator.Abstractions.bwls3njd84.wasm +0 -0
- package/_framework/PrefConfigurator.Abstractions.bwls3njd84.wasm.br +0 -0
- package/_framework/PrefConfigurator.Abstractions.bwls3njd84.wasm.gz +0 -0
- package/_framework/PrefConfigurator.Application.4zgfe5zrfl.wasm +0 -0
- package/_framework/PrefConfigurator.Application.4zgfe5zrfl.wasm.br +0 -0
- package/_framework/PrefConfigurator.Application.4zgfe5zrfl.wasm.gz +0 -0
- package/_framework/{PrefConfigurator.Domain.5op7cflivp.wasm → PrefConfigurator.Domain.4u3qflgie3.wasm} +0 -0
- package/_framework/PrefConfigurator.Domain.4u3qflgie3.wasm.br +0 -0
- package/_framework/PrefConfigurator.Domain.4u3qflgie3.wasm.gz +0 -0
- package/_framework/PrefConfigurator.Infrastructure.2dmpyc231g.wasm +0 -0
- package/_framework/PrefConfigurator.Infrastructure.2dmpyc231g.wasm.br +0 -0
- package/_framework/PrefConfigurator.Infrastructure.2dmpyc231g.wasm.gz +0 -0
- package/_framework/{PrefConfigurator.Wasm.1fmzws19hk.wasm → PrefConfigurator.Wasm.nxm9rxwekj.wasm} +0 -0
- package/_framework/PrefConfigurator.Wasm.nxm9rxwekj.wasm.br +0 -0
- package/_framework/PrefConfigurator.Wasm.nxm9rxwekj.wasm.gz +0 -0
- package/_framework/blazor.boot.json +11 -11
- package/_framework/blazor.boot.json.br +0 -0
- package/_framework/blazor.boot.json.gz +0 -0
- package/js/gltf-storage.js +127 -115
- package/package.json +1 -1
- package/_framework/PrefConfigurator.Abstractions.805c7bprsx.wasm +0 -0
- package/_framework/PrefConfigurator.Abstractions.805c7bprsx.wasm.br +0 -0
- package/_framework/PrefConfigurator.Abstractions.805c7bprsx.wasm.gz +0 -0
- package/_framework/PrefConfigurator.Application.iffkp149kr.wasm +0 -0
- package/_framework/PrefConfigurator.Application.iffkp149kr.wasm.br +0 -0
- package/_framework/PrefConfigurator.Application.iffkp149kr.wasm.gz +0 -0
- package/_framework/PrefConfigurator.Domain.5op7cflivp.wasm.br +0 -0
- package/_framework/PrefConfigurator.Domain.5op7cflivp.wasm.gz +0 -0
- package/_framework/PrefConfigurator.Infrastructure.ensnlfxrnt.wasm +0 -0
- package/_framework/PrefConfigurator.Infrastructure.ensnlfxrnt.wasm.br +0 -0
- package/_framework/PrefConfigurator.Infrastructure.ensnlfxrnt.wasm.gz +0 -0
- package/_framework/PrefConfigurator.Wasm.1fmzws19hk.wasm.br +0 -0
- package/_framework/PrefConfigurator.Wasm.1fmzws19hk.wasm.gz +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/_framework/{PrefConfigurator.Wasm.1fmzws19hk.wasm → PrefConfigurator.Wasm.nxm9rxwekj.wasm}
RENAMED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"mainAssemblyName": "PrefConfigurator.Wasm",
|
|
3
3
|
"resources": {
|
|
4
|
-
"hash": "sha256-
|
|
4
|
+
"hash": "sha256-dLT2KzsyfRRVLa8678CpIF6cFvQCiA5BP5J9p/xAbsU=",
|
|
5
5
|
"fingerprinting": {
|
|
6
6
|
"Microsoft.CSharp.wdyr58w263.wasm": "Microsoft.CSharp.wasm",
|
|
7
7
|
"Microsoft.Extensions.Caching.Abstractions.9tfokavdri.wasm": "Microsoft.Extensions.Caching.Abstractions.wasm",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"Microsoft.Extensions.Options.c9gmov336d.wasm": "Microsoft.Extensions.Options.wasm",
|
|
35
35
|
"Microsoft.Extensions.Primitives.ii8zcoqmmf.wasm": "Microsoft.Extensions.Primitives.wasm",
|
|
36
36
|
"Newtonsoft.Json.ou6h2ikg0u.wasm": "Newtonsoft.Json.wasm",
|
|
37
|
-
"PrefConfigurator.Abstractions.
|
|
38
|
-
"PrefConfigurator.Application.
|
|
39
|
-
"PrefConfigurator.Domain.
|
|
40
|
-
"PrefConfigurator.Infrastructure.
|
|
41
|
-
"PrefConfigurator.Wasm.
|
|
37
|
+
"PrefConfigurator.Abstractions.bwls3njd84.wasm": "PrefConfigurator.Abstractions.wasm",
|
|
38
|
+
"PrefConfigurator.Application.4zgfe5zrfl.wasm": "PrefConfigurator.Application.wasm",
|
|
39
|
+
"PrefConfigurator.Domain.4u3qflgie3.wasm": "PrefConfigurator.Domain.wasm",
|
|
40
|
+
"PrefConfigurator.Infrastructure.2dmpyc231g.wasm": "PrefConfigurator.Infrastructure.wasm",
|
|
41
|
+
"PrefConfigurator.Wasm.nxm9rxwekj.wasm": "PrefConfigurator.Wasm.wasm",
|
|
42
42
|
"Preference.Hydra.OpenApi.oba396x8m7.wasm": "Preference.Hydra.OpenApi.wasm",
|
|
43
43
|
"System.f0t8bkq7p2.wasm": "System.wasm",
|
|
44
44
|
"System.Collections.Concurrent.3x28nluuwn.wasm": "System.Collections.Concurrent.wasm",
|
|
@@ -135,11 +135,11 @@
|
|
|
135
135
|
"Microsoft.Extensions.Options.c9gmov336d.wasm": "sha256-0N/ionjXj1tzE4oM9Wt55U0WDRfW6CCbnq2+PbQfUBc=",
|
|
136
136
|
"Microsoft.Extensions.Primitives.ii8zcoqmmf.wasm": "sha256-Jt5QBSXSDEahiZ89Pn1MhJ9A3C/ftN8ZXaBGV9JgqwQ=",
|
|
137
137
|
"Newtonsoft.Json.ou6h2ikg0u.wasm": "sha256-8EZ4H5Mb5yxuavrUzuw5k75ewxJQbdU+Y1rksETqPVo=",
|
|
138
|
-
"PrefConfigurator.Abstractions.
|
|
139
|
-
"PrefConfigurator.Application.
|
|
140
|
-
"PrefConfigurator.Domain.
|
|
141
|
-
"PrefConfigurator.Infrastructure.
|
|
142
|
-
"PrefConfigurator.Wasm.
|
|
138
|
+
"PrefConfigurator.Abstractions.bwls3njd84.wasm": "sha256-JZNqV6cxRk3hAxCuZG7f8A65QW6/l+hJPFvmTu/FLa4=",
|
|
139
|
+
"PrefConfigurator.Application.4zgfe5zrfl.wasm": "sha256-sPVJ1Gn14yoLx9NQu80R3C4qqaO1BLk7ETA5gQtsChg=",
|
|
140
|
+
"PrefConfigurator.Domain.4u3qflgie3.wasm": "sha256-7Pgd5UD+i29HPDg1kw42eB/YvtqljniTE5urx2Dh4Ro=",
|
|
141
|
+
"PrefConfigurator.Infrastructure.2dmpyc231g.wasm": "sha256-di/j6Ia2oEt7jdmmepuJp2x7U1jZvtEGzVq6OmEp5BM=",
|
|
142
|
+
"PrefConfigurator.Wasm.nxm9rxwekj.wasm": "sha256-pYSMbQyGZJiKXDlocvTWxlGSwEDYOVecuiDqJfQsdc4=",
|
|
143
143
|
"Preference.Hydra.OpenApi.oba396x8m7.wasm": "sha256-BOitG9XqTGoVdagU40GvNefDuOylKCPs3Gp5VG0M3oY=",
|
|
144
144
|
"System.f0t8bkq7p2.wasm": "sha256-319B7WIXJ7ZD6SZ1l7es3CoglOLgv5lKWx0Ew9mli1c=",
|
|
145
145
|
"System.Collections.Concurrent.3x28nluuwn.wasm": "sha256-xwvOotzdpOgojZxJSPpPCqC1ZclGeXX5Gb5BO3q0GTw=",
|
|
Binary file
|
|
Binary file
|
package/js/gltf-storage.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// wwwroot/js/gltf-storage.js
|
|
2
2
|
|
|
3
|
-
// Public, inspectable namespace
|
|
4
|
-
const PC = (globalThis.PrefConfigurator ??= {});
|
|
5
|
-
PC.version = PC.version ?? "1.0.1"; // bump if your schema changes!!
|
|
6
|
-
PC.db = PC.db ?? null;
|
|
3
|
+
// Public, inspectable namespace
|
|
4
|
+
const PC = (globalThis.PrefConfigurator ??= {});
|
|
5
|
+
PC.version = PC.version ?? "1.0.1"; // bump if your schema changes!!
|
|
6
|
+
PC.db = PC.db ?? null;
|
|
7
|
+
PC.dbName = PC.dbName ?? null;
|
|
8
|
+
PC.storeName = PC.storeName ?? null;
|
|
7
9
|
|
|
8
10
|
function _getDbOrThrow() {
|
|
9
11
|
const db = PC.db;
|
|
@@ -11,38 +13,66 @@ function _getDbOrThrow() {
|
|
|
11
13
|
return db;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
// --- internal helpers -------------------------------------------------------
|
|
15
|
-
function _openEnsuringStore(dbName, storeName) {
|
|
16
|
-
return new Promise((resolve, reject) => {
|
|
17
|
-
const open = indexedDB.open(dbName, 5);
|
|
16
|
+
// --- internal helpers -------------------------------------------------------
|
|
17
|
+
function _openEnsuringStore(dbName, storeName) {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
const open = indexedDB.open(dbName, 5);
|
|
18
20
|
|
|
19
21
|
open.onblocked = () => reject(new Error("Open blocked by another tab or worker"));
|
|
20
22
|
open.onerror = () => reject(open.error);
|
|
21
23
|
open.onsuccess = (e) => {
|
|
22
24
|
resolve(e.target.result);
|
|
23
25
|
}
|
|
24
|
-
open.onupgradeneeded = (ev) => {
|
|
25
|
-
const upgradeDb = ev.target.result;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
26
|
+
open.onupgradeneeded = (ev) => {
|
|
27
|
+
const upgradeDb = ev.target.result;
|
|
28
|
+
const tx = ev.target.transaction;
|
|
29
|
+
|
|
30
|
+
let store;
|
|
31
|
+
if (!upgradeDb.objectStoreNames.contains(storeName)) {
|
|
32
|
+
store = upgradeDb.createObjectStore(storeName, { keyPath: 'id' });
|
|
33
|
+
} else if (tx) {
|
|
34
|
+
store = tx.objectStore(storeName);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (store && !store.indexNames.contains('expirationTimeStamp')) {
|
|
38
|
+
store.createIndex('expirationTimeStamp', 'expirationTimeStamp', { unique: false });
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function _isRecoverableDbError(err) {
|
|
45
|
+
const msg = String(err?.message ?? err ?? "");
|
|
46
|
+
if (!msg) return false;
|
|
47
|
+
return msg.includes("Database not initialized") ||
|
|
48
|
+
msg.includes("The database connection is closing") ||
|
|
49
|
+
msg.includes("InvalidStateError") ||
|
|
50
|
+
msg.includes("NotFoundError");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function _withDbRetry(work) {
|
|
54
|
+
try {
|
|
55
|
+
return await work(_getDbOrThrow());
|
|
56
|
+
} catch (e) {
|
|
57
|
+
if (!_isRecoverableDbError(e) || !PC.dbName || !PC.storeName) {
|
|
58
|
+
throw e;
|
|
59
|
+
}
|
|
60
|
+
await initDb(PC.dbName, PC.storeName);
|
|
61
|
+
return await work(_getDbOrThrow());
|
|
62
|
+
}
|
|
63
|
+
}
|
|
37
64
|
|
|
38
65
|
// --- public API -------------------------------------------------------------
|
|
39
66
|
|
|
40
67
|
// Inicializar IndexedDB y dejar el handle en PrefConfigurator.db (público)
|
|
41
|
-
export async function initDb(dbName, storeName) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
68
|
+
export async function initDb(dbName, storeName) {
|
|
69
|
+
PC.dbName = dbName;
|
|
70
|
+
PC.storeName = storeName;
|
|
71
|
+
|
|
72
|
+
const db = await _openEnsuringStore(dbName, storeName);
|
|
73
|
+
// Close any previous handle to avoid versionchange blocking
|
|
74
|
+
try { PC.db?.close?.(); } catch { }
|
|
75
|
+
PC.db = db;
|
|
46
76
|
|
|
47
77
|
// If another tab upgrades, close gracefully so next call can re-init
|
|
48
78
|
db.onversionchange = () => {
|
|
@@ -53,44 +83,38 @@ export async function initDb(dbName, storeName) {
|
|
|
53
83
|
}
|
|
54
84
|
|
|
55
85
|
// Guardar modelo
|
|
56
|
-
export async function saveModel(modelDataStr, storeName) {
|
|
57
|
-
return new Promise((resolve, reject) => {
|
|
58
|
-
let
|
|
59
|
-
try {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const req = store.get(modelId);
|
|
89
|
-
|
|
90
|
-
req.onerror = () => reject(req.error);
|
|
91
|
-
req.onsuccess = () => resolve(req.result ?? null);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
86
|
+
export async function saveModel(modelDataStr, storeName) {
|
|
87
|
+
return _withDbRetry((db) => new Promise((resolve, reject) => {
|
|
88
|
+
let modelData;
|
|
89
|
+
try { modelData = JSON.parse(modelDataStr); }
|
|
90
|
+
catch (e) { reject(new Error("saveModel: modelDataStr is not valid JSON")); return; }
|
|
91
|
+
|
|
92
|
+
const dataToStore = {
|
|
93
|
+
...modelData,
|
|
94
|
+
data: modelData.data,
|
|
95
|
+
size: (modelData?.data?.length ?? 0)
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const tx = db.transaction([storeName], "readwrite");
|
|
99
|
+
const store = tx.objectStore(storeName);
|
|
100
|
+
const req = store.put(dataToStore);
|
|
101
|
+
|
|
102
|
+
req.onerror = () => reject(req.error);
|
|
103
|
+
req.onsuccess = () => resolve();
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Cargar modelo
|
|
108
|
+
export function loadModel(modelId, storeName) {
|
|
109
|
+
return _withDbRetry((db) => new Promise((resolve, reject) => {
|
|
110
|
+
const tx = db.transaction([storeName], "readonly");
|
|
111
|
+
const store = tx.objectStore(storeName);
|
|
112
|
+
const req = store.get(modelId);
|
|
113
|
+
|
|
114
|
+
req.onerror = () => reject(req.error);
|
|
115
|
+
req.onsuccess = () => resolve(req.result ?? null);
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
94
118
|
|
|
95
119
|
// Descargar archivo desde base64
|
|
96
120
|
export function downloadFileFromBytes(fileName, bytesBase64, mimeType) {
|
|
@@ -103,14 +127,11 @@ export function downloadFileFromBytes(fileName, bytesBase64, mimeType) {
|
|
|
103
127
|
}
|
|
104
128
|
|
|
105
129
|
// Obtener todos los modelos (solo metadata)
|
|
106
|
-
export async function getAllModels(storeName) {
|
|
107
|
-
return new Promise((resolve, reject) => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const tx = db.transaction([storeName], "readonly");
|
|
112
|
-
const store = tx.objectStore(storeName);
|
|
113
|
-
const req = store.getAll();
|
|
130
|
+
export async function getAllModels(storeName) {
|
|
131
|
+
return _withDbRetry((db) => new Promise((resolve, reject) => {
|
|
132
|
+
const tx = db.transaction([storeName], "readonly");
|
|
133
|
+
const store = tx.objectStore(storeName);
|
|
134
|
+
const req = store.getAll();
|
|
114
135
|
|
|
115
136
|
req.onerror = () => reject(req.error);
|
|
116
137
|
req.onsuccess = () => {
|
|
@@ -121,50 +142,41 @@ export async function getAllModels(storeName) {
|
|
|
121
142
|
timeStamp: item.timeStamp,
|
|
122
143
|
size: item.size
|
|
123
144
|
}));
|
|
124
|
-
// keep old behavior: return JSON string
|
|
125
|
-
resolve(JSON.stringify(results));
|
|
126
|
-
};
|
|
127
|
-
});
|
|
128
|
-
}
|
|
145
|
+
// keep old behavior: return JSON string
|
|
146
|
+
resolve(JSON.stringify(results));
|
|
147
|
+
};
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
129
150
|
|
|
130
151
|
// Eliminar modelo por id
|
|
131
|
-
export async function deleteModel(modelId, storeName) {
|
|
132
|
-
return new Promise((resolve, reject) => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
req.onsuccess = () => resolve();
|
|
142
|
-
});
|
|
143
|
-
}
|
|
152
|
+
export async function deleteModel(modelId, storeName) {
|
|
153
|
+
return _withDbRetry((db) => new Promise((resolve, reject) => {
|
|
154
|
+
const tx = db.transaction([storeName], "readwrite");
|
|
155
|
+
const store = tx.objectStore(storeName);
|
|
156
|
+
const req = store.delete(modelId);
|
|
157
|
+
|
|
158
|
+
req.onerror = () => reject(req.error);
|
|
159
|
+
req.onsuccess = () => resolve();
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
144
162
|
|
|
145
163
|
// Limpiar toda la store
|
|
146
|
-
export async function clearAll(storeName) {
|
|
147
|
-
return new Promise((resolve, reject) => {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
req.onsuccess = () => resolve();
|
|
157
|
-
});
|
|
158
|
-
}
|
|
164
|
+
export async function clearAll(storeName) {
|
|
165
|
+
return _withDbRetry((db) => new Promise((resolve, reject) => {
|
|
166
|
+
const tx = db.transaction([storeName], "readwrite");
|
|
167
|
+
const store = tx.objectStore(storeName);
|
|
168
|
+
const req = store.clear();
|
|
169
|
+
|
|
170
|
+
req.onerror = () => reject(req.error);
|
|
171
|
+
req.onsuccess = () => resolve();
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
159
174
|
|
|
160
175
|
// Borrar modelos expirados usando el índice "expirationTimeStamp"
|
|
161
|
-
export async function cleanExpiredModels(storeName) {
|
|
162
|
-
return new Promise((resolve, reject) => {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const tx = db.transaction([storeName], "readwrite");
|
|
167
|
-
const store = tx.objectStore(storeName);
|
|
176
|
+
export async function cleanExpiredModels(storeName) {
|
|
177
|
+
return _withDbRetry((db) => new Promise((resolve, reject) => {
|
|
178
|
+
const tx = db.transaction([storeName], "readwrite");
|
|
179
|
+
const store = tx.objectStore(storeName);
|
|
168
180
|
|
|
169
181
|
const index = store.index("expirationTimeStamp");
|
|
170
182
|
const now = Date.now();
|
|
@@ -179,11 +191,11 @@ export async function cleanExpiredModels(storeName) {
|
|
|
179
191
|
cursor.continue();
|
|
180
192
|
}
|
|
181
193
|
};
|
|
182
|
-
|
|
183
|
-
tx.oncomplete = () => resolve();
|
|
184
|
-
tx.onerror = () => reject(tx.error);
|
|
185
|
-
});
|
|
186
|
-
}
|
|
194
|
+
|
|
195
|
+
tx.oncomplete = () => resolve();
|
|
196
|
+
tx.onerror = () => reject(tx.error);
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
187
199
|
|
|
188
200
|
// Utilidades opcionales y visibles (por si las quieres usar en consola)
|
|
189
201
|
export function closeDb() {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
},
|
|
5
5
|
"description": ".NET WebAssembly runtime package that centralizes logic for building product configurators, exposing a simple API for integration into ecommerce platforms.",
|
|
6
6
|
"types": "main.d.ts",
|
|
7
|
-
"version": "4.1.
|
|
7
|
+
"version": "4.1.4",
|
|
8
8
|
"files": [
|
|
9
9
|
"_framework/**",
|
|
10
10
|
"**/*.js",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|