@schukai/monster 4.73.1 → 4.74.0
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
## [4.74.0] - 2026-01-03
|
|
6
|
+
|
|
7
|
+
### Add Features
|
|
8
|
+
|
|
9
|
+
- Enhance database connection handling in config-manager
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [4.73.2] - 2026-01-03
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- lookup [#360](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/360)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
5
21
|
## [4.73.1] - 2026-01-03
|
|
6
22
|
|
|
7
23
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.4","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.
|
|
1
|
+
{"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.4","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.74.0"}
|
|
@@ -66,6 +66,7 @@ const readRequestIdSymbol = Symbol("readRequestId");
|
|
|
66
66
|
const writeRequestIdSymbol = Symbol("writeRequestId");
|
|
67
67
|
const lookupCacheSymbol = Symbol("lookupCache");
|
|
68
68
|
const lookupPendingSymbol = Symbol("lookupPending");
|
|
69
|
+
const lookupPendingFetchSymbol = Symbol("lookupPendingFetch");
|
|
69
70
|
|
|
70
71
|
/**
|
|
71
72
|
* A rest api datasource
|
|
@@ -823,6 +824,7 @@ async function resolveRemoteLookup(requestId, name, cfg) {
|
|
|
823
824
|
|
|
824
825
|
const cache = getLookupCache.call(this, name);
|
|
825
826
|
const pending = getLookupPending.call(this, name);
|
|
827
|
+
const pendingFetches = getLookupPendingFetches.call(this, name);
|
|
826
828
|
|
|
827
829
|
const ids = collectLookupIds.call(
|
|
828
830
|
this,
|
|
@@ -832,6 +834,21 @@ async function resolveRemoteLookup(requestId, name, cfg) {
|
|
|
832
834
|
const missingIds = ids.filter((id) => !cache.has(id) && !pending.has(id));
|
|
833
835
|
|
|
834
836
|
if (missingIds.length === 0) {
|
|
837
|
+
if (pending.size > 0) {
|
|
838
|
+
updateLookupRows.call(this, requestId, (rows) => {
|
|
839
|
+
if (!isString(cfg.loadingKey)) return;
|
|
840
|
+
for (const row of rows) {
|
|
841
|
+
if (pending.has(String(row[key]))) {
|
|
842
|
+
row[cfg.loadingKey] = true;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
});
|
|
846
|
+
|
|
847
|
+
if (pendingFetches.size > 0) {
|
|
848
|
+
const fetches = Array.from(pendingFetches);
|
|
849
|
+
await Promise.all(fetches.map((promise) => promise.catch(() => null)));
|
|
850
|
+
}
|
|
851
|
+
}
|
|
835
852
|
applyLookupCache.call(this, requestId, cfg, cache);
|
|
836
853
|
return;
|
|
837
854
|
}
|
|
@@ -839,7 +856,7 @@ async function resolveRemoteLookup(requestId, name, cfg) {
|
|
|
839
856
|
updateLookupRows.call(this, requestId, (rows) => {
|
|
840
857
|
if (!isString(cfg.loadingKey)) return;
|
|
841
858
|
for (const row of rows) {
|
|
842
|
-
if (missingIds.includes(String(row[key]))) {
|
|
859
|
+
if (missingIds.includes(String(row[key])) || pending.has(String(row[key]))) {
|
|
843
860
|
row[cfg.loadingKey] = true;
|
|
844
861
|
}
|
|
845
862
|
}
|
|
@@ -847,7 +864,14 @@ async function resolveRemoteLookup(requestId, name, cfg) {
|
|
|
847
864
|
|
|
848
865
|
missingIds.forEach((id) => pending.add(id));
|
|
849
866
|
|
|
850
|
-
const
|
|
867
|
+
const fetchPromise = fetchLookupEntries.call(this, cfg, missingIds);
|
|
868
|
+
pendingFetches.add(fetchPromise);
|
|
869
|
+
let response;
|
|
870
|
+
try {
|
|
871
|
+
response = await fetchPromise;
|
|
872
|
+
} finally {
|
|
873
|
+
pendingFetches.delete(fetchPromise);
|
|
874
|
+
}
|
|
851
875
|
response.forEach((entry, id) => cache.set(id, entry));
|
|
852
876
|
missingIds.forEach((id) => pending.delete(id));
|
|
853
877
|
|
|
@@ -1137,6 +1161,21 @@ function getLookupPending(name) {
|
|
|
1137
1161
|
return this[lookupPendingSymbol].get(name);
|
|
1138
1162
|
}
|
|
1139
1163
|
|
|
1164
|
+
/**
|
|
1165
|
+
* @private
|
|
1166
|
+
* @param {string} name
|
|
1167
|
+
* @return {Set<Promise<Map<string, object>>>}
|
|
1168
|
+
*/
|
|
1169
|
+
function getLookupPendingFetches(name) {
|
|
1170
|
+
if (!this[lookupPendingFetchSymbol]) {
|
|
1171
|
+
this[lookupPendingFetchSymbol] = new Map();
|
|
1172
|
+
}
|
|
1173
|
+
if (!this[lookupPendingFetchSymbol].has(name)) {
|
|
1174
|
+
this[lookupPendingFetchSymbol].set(name, new Set());
|
|
1175
|
+
}
|
|
1176
|
+
return this[lookupPendingFetchSymbol].get(name);
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1140
1179
|
/**
|
|
1141
1180
|
* @private
|
|
1142
1181
|
* @return {string}
|
|
@@ -195,6 +195,9 @@ function openDatabase() {
|
|
|
195
195
|
const request = window.indexedDB.open(name, version);
|
|
196
196
|
|
|
197
197
|
return new Promise((resolve, reject) => {
|
|
198
|
+
let upgradeComplete = true;
|
|
199
|
+
let openComplete = false;
|
|
200
|
+
|
|
198
201
|
request.onerror = (event) => {
|
|
199
202
|
console.error("Error opening database", event);
|
|
200
203
|
reject(request.error);
|
|
@@ -202,20 +205,26 @@ function openDatabase() {
|
|
|
202
205
|
|
|
203
206
|
request.onsuccess = (event) => {
|
|
204
207
|
this[indexDBInstanceSymbol] = event?.target?.result;
|
|
205
|
-
|
|
208
|
+
openComplete = true;
|
|
209
|
+
if (upgradeComplete) {
|
|
210
|
+
resolve(request.result);
|
|
211
|
+
}
|
|
206
212
|
};
|
|
207
213
|
|
|
208
214
|
request.onupgradeneeded = (event) => {
|
|
209
215
|
const db = event.target.result;
|
|
216
|
+
this[indexDBInstanceSymbol] = db;
|
|
217
|
+
upgradeComplete = false;
|
|
210
218
|
|
|
211
|
-
let objectStore;
|
|
212
219
|
if (!db.objectStoreNames.contains(storageName)) {
|
|
213
|
-
|
|
220
|
+
db.createObjectStore(storageName, { keyPath: KeyPath });
|
|
214
221
|
}
|
|
215
222
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
223
|
+
event.target.transaction.oncomplete = () => {
|
|
224
|
+
upgradeComplete = true;
|
|
225
|
+
if (openComplete) {
|
|
226
|
+
resolve(request.result);
|
|
227
|
+
}
|
|
219
228
|
};
|
|
220
229
|
};
|
|
221
230
|
});
|