@domql/utils 3.7.3 → 3.7.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/cjs/extends.js +5 -2
- package/dist/cjs/methods.js +2 -2
- package/dist/cjs/string.js +6 -2
- package/dist/esm/extends.js +5 -2
- package/dist/esm/methods.js +2 -2
- package/dist/esm/string.js +6 -2
- package/dist/iife/index.js +19 -9
- package/extends.js +5 -2
- package/methods.js +2 -2
- package/package.json +2 -2
- package/string.js +4 -2
package/dist/cjs/extends.js
CHANGED
|
@@ -228,14 +228,17 @@ const deepMergeExtends = (element, extend, sourcemap, sourceName, preBuiltSource
|
|
|
228
228
|
}
|
|
229
229
|
return element;
|
|
230
230
|
};
|
|
231
|
-
const trackSourcemapDeep = (sourcemap, obj, sourceName) => {
|
|
231
|
+
const trackSourcemapDeep = (sourcemap, obj, sourceName, seen) => {
|
|
232
|
+
if (!seen) seen = /* @__PURE__ */ new WeakSet();
|
|
233
|
+
if (seen.has(obj)) return;
|
|
234
|
+
seen.add(obj);
|
|
232
235
|
for (const key in obj) {
|
|
233
236
|
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
234
237
|
if (key === "__proto__" || key === "constructor" || key === "prototype") continue;
|
|
235
238
|
const val = obj[key];
|
|
236
239
|
if ((0, import_types.isObject)(val) && !(0, import_types.isArray)(val)) {
|
|
237
240
|
sourcemap[key] = sourcemap[key] || {};
|
|
238
|
-
trackSourcemapDeep(sourcemap[key], val, sourceName);
|
|
241
|
+
trackSourcemapDeep(sourcemap[key], val, sourceName, seen);
|
|
239
242
|
} else {
|
|
240
243
|
sourcemap[key] = sourceName;
|
|
241
244
|
}
|
package/dist/cjs/methods.js
CHANGED
|
@@ -372,12 +372,12 @@ function call(fnKey, ...args) {
|
|
|
372
372
|
const result = fn.call(this, ...args);
|
|
373
373
|
if (result && typeof result.then === "function") {
|
|
374
374
|
result.catch((err) => {
|
|
375
|
-
this
|
|
375
|
+
error.call(this, err);
|
|
376
376
|
});
|
|
377
377
|
}
|
|
378
378
|
return result;
|
|
379
379
|
} catch (err) {
|
|
380
|
-
this
|
|
380
|
+
error.call(this, err);
|
|
381
381
|
if (context?.strictMode) throw err;
|
|
382
382
|
}
|
|
383
383
|
}
|
package/dist/cjs/string.js
CHANGED
|
@@ -63,8 +63,12 @@ function replaceLiteralsWithObjectFields(str, state, options = {}) {
|
|
|
63
63
|
if (filter) {
|
|
64
64
|
const filterFn = element?.context?.functions?.[filter];
|
|
65
65
|
if (filterFn) {
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
try {
|
|
67
|
+
const stateValue = getNestedValue(obj, key);
|
|
68
|
+
return String(filterFn.call(element, stateValue != null ? stateValue : key) ?? "");
|
|
69
|
+
} catch (e) {
|
|
70
|
+
return "";
|
|
71
|
+
}
|
|
68
72
|
}
|
|
69
73
|
return "";
|
|
70
74
|
}
|
package/dist/esm/extends.js
CHANGED
|
@@ -179,14 +179,17 @@ const deepMergeExtends = (element, extend, sourcemap, sourceName, preBuiltSource
|
|
|
179
179
|
}
|
|
180
180
|
return element;
|
|
181
181
|
};
|
|
182
|
-
const trackSourcemapDeep = (sourcemap, obj, sourceName) => {
|
|
182
|
+
const trackSourcemapDeep = (sourcemap, obj, sourceName, seen) => {
|
|
183
|
+
if (!seen) seen = /* @__PURE__ */ new WeakSet();
|
|
184
|
+
if (seen.has(obj)) return;
|
|
185
|
+
seen.add(obj);
|
|
183
186
|
for (const key in obj) {
|
|
184
187
|
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
185
188
|
if (key === "__proto__" || key === "constructor" || key === "prototype") continue;
|
|
186
189
|
const val = obj[key];
|
|
187
190
|
if (isObject(val) && !isArray(val)) {
|
|
188
191
|
sourcemap[key] = sourcemap[key] || {};
|
|
189
|
-
trackSourcemapDeep(sourcemap[key], val, sourceName);
|
|
192
|
+
trackSourcemapDeep(sourcemap[key], val, sourceName, seen);
|
|
190
193
|
} else {
|
|
191
194
|
sourcemap[key] = sourceName;
|
|
192
195
|
}
|
package/dist/esm/methods.js
CHANGED
|
@@ -309,12 +309,12 @@ function call(fnKey, ...args) {
|
|
|
309
309
|
const result = fn.call(this, ...args);
|
|
310
310
|
if (result && typeof result.then === "function") {
|
|
311
311
|
result.catch((err) => {
|
|
312
|
-
this
|
|
312
|
+
error.call(this, err);
|
|
313
313
|
});
|
|
314
314
|
}
|
|
315
315
|
return result;
|
|
316
316
|
} catch (err) {
|
|
317
|
-
this
|
|
317
|
+
error.call(this, err);
|
|
318
318
|
if (context?.strictMode) throw err;
|
|
319
319
|
}
|
|
320
320
|
}
|
package/dist/esm/string.js
CHANGED
|
@@ -31,8 +31,12 @@ function replaceLiteralsWithObjectFields(str, state, options = {}) {
|
|
|
31
31
|
if (filter) {
|
|
32
32
|
const filterFn = element?.context?.functions?.[filter];
|
|
33
33
|
if (filterFn) {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
try {
|
|
35
|
+
const stateValue = getNestedValue(obj, key);
|
|
36
|
+
return String(filterFn.call(element, stateValue != null ? stateValue : key) ?? "");
|
|
37
|
+
} catch (e) {
|
|
38
|
+
return "";
|
|
39
|
+
}
|
|
36
40
|
}
|
|
37
41
|
return "";
|
|
38
42
|
}
|
package/dist/iife/index.js
CHANGED
|
@@ -335,7 +335,9 @@ var DomqlUtils = (() => {
|
|
|
335
335
|
);
|
|
336
336
|
createClient = mod.createClient;
|
|
337
337
|
}
|
|
338
|
-
|
|
338
|
+
const client = createClient(supabaseUrl, key, options);
|
|
339
|
+
if (!client || !client.auth) return null;
|
|
340
|
+
return supabaseAdapter(client);
|
|
339
341
|
};
|
|
340
342
|
applyFilters = (query, params) => {
|
|
341
343
|
if (!params) return query;
|
|
@@ -967,7 +969,7 @@ var DomqlUtils = (() => {
|
|
|
967
969
|
return resolved;
|
|
968
970
|
};
|
|
969
971
|
initAdapterAuth = async (adapter, context) => {
|
|
970
|
-
if (adapter.__authInitialized) return;
|
|
972
|
+
if (!adapter || adapter.__authInitialized) return;
|
|
971
973
|
adapter.__authInitialized = true;
|
|
972
974
|
if (!adapter.getSession) return;
|
|
973
975
|
const updateAuth = (user, session) => {
|
|
@@ -999,9 +1001,10 @@ var DomqlUtils = (() => {
|
|
|
999
1001
|
if (db.__resolving) return db.__resolving;
|
|
1000
1002
|
db.__resolving = resolveDb(db);
|
|
1001
1003
|
const resolved = await db.__resolving;
|
|
1004
|
+
delete db.__resolving;
|
|
1005
|
+
if (!resolved) return null;
|
|
1002
1006
|
db.__resolved = resolved;
|
|
1003
1007
|
context.fetch = resolved;
|
|
1004
|
-
delete db.__resolving;
|
|
1005
1008
|
if (db.auth !== false) await initAdapterAuth(resolved, context);
|
|
1006
1009
|
return resolved;
|
|
1007
1010
|
};
|
|
@@ -2001,8 +2004,12 @@ var DomqlUtils = (() => {
|
|
|
2001
2004
|
if (filter) {
|
|
2002
2005
|
const filterFn = element?.context?.functions?.[filter];
|
|
2003
2006
|
if (filterFn) {
|
|
2004
|
-
|
|
2005
|
-
|
|
2007
|
+
try {
|
|
2008
|
+
const stateValue = getNestedValue(obj, key);
|
|
2009
|
+
return String(filterFn.call(element, stateValue != null ? stateValue : key) ?? "");
|
|
2010
|
+
} catch (e) {
|
|
2011
|
+
return "";
|
|
2012
|
+
}
|
|
2006
2013
|
}
|
|
2007
2014
|
return "";
|
|
2008
2015
|
}
|
|
@@ -3345,14 +3352,17 @@ var DomqlUtils = (() => {
|
|
|
3345
3352
|
}
|
|
3346
3353
|
return element;
|
|
3347
3354
|
};
|
|
3348
|
-
var trackSourcemapDeep = (sourcemap, obj, sourceName) => {
|
|
3355
|
+
var trackSourcemapDeep = (sourcemap, obj, sourceName, seen) => {
|
|
3356
|
+
if (!seen) seen = /* @__PURE__ */ new WeakSet();
|
|
3357
|
+
if (seen.has(obj)) return;
|
|
3358
|
+
seen.add(obj);
|
|
3349
3359
|
for (const key in obj) {
|
|
3350
3360
|
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
3351
3361
|
if (key === "__proto__" || key === "constructor" || key === "prototype") continue;
|
|
3352
3362
|
const val = obj[key];
|
|
3353
3363
|
if (isObject(val) && !isArray(val)) {
|
|
3354
3364
|
sourcemap[key] = sourcemap[key] || {};
|
|
3355
|
-
trackSourcemapDeep(sourcemap[key], val, sourceName);
|
|
3365
|
+
trackSourcemapDeep(sourcemap[key], val, sourceName, seen);
|
|
3356
3366
|
} else {
|
|
3357
3367
|
sourcemap[key] = sourceName;
|
|
3358
3368
|
}
|
|
@@ -4465,12 +4475,12 @@ var DomqlUtils = (() => {
|
|
|
4465
4475
|
const result = fn.call(this, ...args);
|
|
4466
4476
|
if (result && typeof result.then === "function") {
|
|
4467
4477
|
result.catch((err) => {
|
|
4468
|
-
this
|
|
4478
|
+
error.call(this, err);
|
|
4469
4479
|
});
|
|
4470
4480
|
}
|
|
4471
4481
|
return result;
|
|
4472
4482
|
} catch (err) {
|
|
4473
|
-
this
|
|
4483
|
+
error.call(this, err);
|
|
4474
4484
|
if (context?.strictMode) throw err;
|
|
4475
4485
|
}
|
|
4476
4486
|
}
|
package/extends.js
CHANGED
|
@@ -252,14 +252,17 @@ export const deepMergeExtends = (element, extend, sourcemap, sourceName, preBuil
|
|
|
252
252
|
return element
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
const trackSourcemapDeep = (sourcemap, obj, sourceName) => {
|
|
255
|
+
const trackSourcemapDeep = (sourcemap, obj, sourceName, seen) => {
|
|
256
|
+
if (!seen) seen = new WeakSet()
|
|
257
|
+
if (seen.has(obj)) return
|
|
258
|
+
seen.add(obj)
|
|
256
259
|
for (const key in obj) {
|
|
257
260
|
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue
|
|
258
261
|
if (key === '__proto__' || key === 'constructor' || key === 'prototype') continue
|
|
259
262
|
const val = obj[key]
|
|
260
263
|
if (isObject(val) && !isArray(val)) {
|
|
261
264
|
sourcemap[key] = sourcemap[key] || {}
|
|
262
|
-
trackSourcemapDeep(sourcemap[key], val, sourceName)
|
|
265
|
+
trackSourcemapDeep(sourcemap[key], val, sourceName, seen)
|
|
263
266
|
} else {
|
|
264
267
|
sourcemap[key] = sourceName
|
|
265
268
|
}
|
package/methods.js
CHANGED
|
@@ -389,12 +389,12 @@ export function call (fnKey, ...args) {
|
|
|
389
389
|
const result = fn.call(this, ...args)
|
|
390
390
|
if (result && typeof result.then === 'function') {
|
|
391
391
|
result.catch((err) => {
|
|
392
|
-
this
|
|
392
|
+
error.call(this, err)
|
|
393
393
|
})
|
|
394
394
|
}
|
|
395
395
|
return result
|
|
396
396
|
} catch (err) {
|
|
397
|
-
this
|
|
397
|
+
error.call(this, err)
|
|
398
398
|
if (context?.strictMode) throw err
|
|
399
399
|
}
|
|
400
400
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/utils",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.5",
|
|
4
4
|
"license": "CC-BY-NC-4.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@symbo.ls/fetch": "^3.7.
|
|
41
|
+
"@symbo.ls/fetch": "^3.7.5"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"@symbo.ls/fetch": {
|
package/string.js
CHANGED
|
@@ -53,8 +53,10 @@ export function replaceLiteralsWithObjectFields (str, state, options = {}) {
|
|
|
53
53
|
if (filter) {
|
|
54
54
|
const filterFn = element?.context?.functions?.[filter]
|
|
55
55
|
if (filterFn) {
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
try {
|
|
57
|
+
const stateValue = getNestedValue(obj, key)
|
|
58
|
+
return String(filterFn.call(element, stateValue != null ? stateValue : key) ?? '')
|
|
59
|
+
} catch (e) { return '' }
|
|
58
60
|
}
|
|
59
61
|
return ''
|
|
60
62
|
}
|