@domql/utils 3.7.4 → 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.
@@ -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
- const stateValue = getNestedValue(obj, key);
67
- return String(filterFn.call(element, stateValue !== void 0 ? stateValue : key) ?? "");
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
  }
@@ -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
- const stateValue = getNestedValue(obj, key);
35
- return String(filterFn.call(element, stateValue !== void 0 ? stateValue : key) ?? "");
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
  }
@@ -335,7 +335,9 @@ var DomqlUtils = (() => {
335
335
  );
336
336
  createClient = mod.createClient;
337
337
  }
338
- return supabaseAdapter(createClient(supabaseUrl, key, options));
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
- const stateValue = getNestedValue(obj, key);
2005
- return String(filterFn.call(element, stateValue !== void 0 ? stateValue : key) ?? "");
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/utils",
3
- "version": "3.7.4",
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.4"
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
- const stateValue = getNestedValue(obj, key)
57
- return String(filterFn.call(element, stateValue !== undefined ? stateValue : key) ?? '')
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
  }