@symbo.ls/utils 3.14.17 → 3.14.18

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
@@ -1,5 +1,11 @@
1
1
  # @symbo.ls/utils
2
2
 
3
+ ## 3.14.18
4
+
5
+ ### Patch Changes
6
+
7
+ - Auto-generated cross-repo patch release.
8
+
3
9
  ## 3.14.17
4
10
 
5
11
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  "use strict";var D=Object.create;var g=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var M=(e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})},$=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of I(t))!F.call(e,r)&&r!==n&&g(e,r,{get:()=>t[r],enumerable:!(o=T(t,r))||o.enumerable});return e};var m=(e,t,n)=>(n=e!=null?D(L(e)):{},$(t||!e||!e.__esModule?g(n,"default",{value:e,enumerable:!0}):n,e)),J=e=>$(g({},"__esModule",{value:!0}),e);var Ot={};M(Ot,{call:()=>ut,defineSetter:()=>rt,error:()=>O,get:()=>U,getChildren:()=>Z,getContext:()=>ot,getDB:()=>at,getPath:()=>K,getQuery:()=>ht,getRef:()=>Y,getRoot:()=>tt,getRootContext:()=>nt,getRootData:()=>et,getRootState:()=>q,isMethod:()=>vt,keys:()=>j,log:()=>st,lookdown:()=>z,lookdownAll:()=>G,lookup:()=>B,nextElement:()=>ct,parse:()=>Q,parseDeep:()=>v,previousElement:()=>lt,remove:()=>H,setActiveRootState:()=>X,setNodeStyles:()=>C,setProps:()=>W,spotByPath:()=>V,variables:()=>ft,verbose:()=>N,warn:()=>it});module.exports=J(Ot);var S=require("./triggerEvent.js"),d=require("./keys.js"),f=require("./types.js"),E=require("./object.js"),P=require("./env.js"),A=require("./array.js"),b=require("./cache.js");const h="production";function V(e){const t=this,{__ref:n}=t,o=[].concat(e);let r=n.root[o[0]];if(!o||!o.length)return console.log(o,"on",t.key,"is undefined");for(;r.key===o[0]&&(o.shift(),!!o.length);)if(r=r[o[0]],!r)return;return r}function B(e){const t=this;let{parent:n}=t;if((0,f.isFunction)(e))return n.state&&e(n,n.state,n.context)?n:n.parent?n.lookup(e):void 0;if(t[e])return t[e];for(;n.param!==e;){if(n[e])return n[e];if(n=n.parent,!n)return}return n}function z(e){const t=this,{__ref:n}=t,o=n?.__children;if(o)for(let r=0;r<o.length;r++){const s=o[r],i=t[s];if(s===e)return i;if((0,f.isFunction)(e)){const l=e(i,i.state,i.context);if(i.state&&l)return i}const c=i?.lookdown?.(e);if(c)return c}}function G(e,t=[]){const n=this,{__ref:o}=n,r=o?.__children;if(r){for(let s=0;s<r.length;s++){const i=r[s],c=n[i];if(i===e)t.push(c);else if((0,f.isFunction)(e)){const l=e(c,c.state,c.context);c.state&&l&&t.push(c)}c?.lookdownAll?.(e,t)}return t.length?t:void 0}}function C(e={}){const t=this;if(t.node?.style){for(const n in e){const o=e[n],r=t[n];if((0,f.isObject)(o)&&r)C.call(r,o);else if(o!=null){const s=n.replace(/[A-Z]/g,c=>"-"+c.toLowerCase()),i=String(o).replace(/\s*!important\s*$/,"");t.node.style.setProperty(s,i,"important")}}return t}}function H(e){const t=this;if((0,S.triggerEventOn)("beforeRemove",t,e)===!1)return t;(0,f.isFunction)(t.node.remove)?t.node.remove():(0,P.isProduction)()||(console.warn("This item cant be removed"),t.log()),delete t.parent[t.key],t.parent.__ref&&(t.parent.__ref.__children=(0,A.removeValueFromArray)(t.parent.__ref.__children,t.key)),(0,S.triggerEventOn)("remove",t,e)}function U(e){return this[e]}function W(e,t){const n=this;if(e)return n.update(e,t),n}function Y(e){return e?this.__ref&&this.__ref[e]:this.__ref}function Z(){return this.getRef("__children").map(t=>this[t])}function K(){return this.getRef().path}let w=null;const X=e=>{w=e||null},k=()=>w||null;function q(e){let t=null;const n=o=>o.__element&&o.root?.isRootState;if(!this)t=k();else if(n(this))t=this.root;else if(this.__ref&&this.__ref.path){const o=this.state&&n(this.state),r=(0,f.isFunction)(this.state)&&this.parent.state&&n(this.parent.state);(o||r)&&(t=this.state.root||this.parent.state.root)}return t||(t=k()),e?t?.[e]:t}function tt(e){const t=this.getRootState()?.__element;return t&&Object.keys(t).length>0&&e?t[e]:t}function et(e){return this.getRoot("data")&&Object.keys(this.getRoot("data")).length>0&&e?this.getRoot("data")[e]:this.getRoot("data")}function nt(e){const t=this.getRoot()?.context;return e?t[e]:t}function ot(e){const t=this.context;return e?t[e]:t}const rt=(e,t,n,o)=>Object.defineProperty(e,t,{get:n,set:o});function j(){const e=this,t=[];for(const n in e)!Object.prototype.hasOwnProperty.call(e,n)||d.DOMQ_PROPERTIES.has(n)&&!d.PARSED_DOMQ_PROPERTIES.has(n)||t.push(n);return t}function Q(e=[]){const t=this,n={},o=j.call(t),r=o.includes("children"),s=e.length?new Set(e):null;for(let i=0;i<o.length;i++){const c=o[i];if(s&&s.has(c)||!Object.prototype.hasOwnProperty.call(t,c)||r&&c==="content")continue;const l=t[c];if(c==="state"){if(t.__ref&&!t.__ref.__hasRootState)continue;const u=(0,f.isFunction)(l&&l.parse)?l.parse():l;n[c]=(0,f.isFunction)(u)?u:JSON.parse(JSON.stringify(u||{}))}else if(c==="scope"){if(t.__ref&&!t.__ref.__hasRootScope)continue;n[c]=JSON.parse(JSON.stringify(l||{}))}else if(c==="props"){const{__element:u,update:a,...p}=t[c];n[c]=p}else(0,f.isDefined)(l)&&Object.prototype.hasOwnProperty.call(t,c)&&(n[c]=l)}return n}function v(e=[],t=new WeakSet){const n=this;if(t.has(n))return;t.add(n);const o=Q.call(n,e),r=e.length?new Set(e):null;for(const s in o){if(r&&r.has(s)||!Object.prototype.hasOwnProperty.call(n,s))continue;const i=o[s];Array.isArray(i)?o[s]=i.map(c=>(0,f.isObjectLike)(c)?v.call(c,e,t):c):(0,f.isObjectLike)(i)&&(o[s]=v.call(i,e,t))}return o}function N(...e){if(h!=="test"&&h!=="development")return;const t=this,{__ref:n}=t;return console.groupCollapsed(t.key),e.length?e.forEach(o=>console.log(`%c${o}:
2
- `,"font-weight: bold",t[o])):(console.log(n.path),t.keys().forEach(r=>console.log(`%c${r}:`,"font-weight: bold",t[r]))),console.log(t),console.groupEnd(t.key),t}function st(...e){(h==="test"||h==="development")&&console.log(...e)}function it(...e){(h==="test"||h==="development")&&console.warn(...e)}function O(...e){if(h==="test"||h==="development"){if(e[e.length-1]?.debugger)debugger;throw e[e.length-1]?.verbose&&N.call(this),new Error(...e)}}function ct(){const e=this,{key:t,parent:n}=e,{__children:o}=n.__ref,r=o.indexOf(t),s=o[r+1];return n[s]}function lt(e){const t=e||this,{key:n,parent:o}=t,{__children:r}=o.__ref;if(!r)return;const s=r.indexOf(n);return o[r[s-1]]}function ft(e={}){const t=this;t.data||(t.data={}),t.data.varCaches||(t.data.varCaches={});const n=t.data.varCaches,o={};let r;for(const s in e)e[s]!==n[s]&&(r=!0,o[s]=e[s]);return{changed:s=>{if(!r)return;const i=s(o,(0,E.deepClone)(n));for(const c in o)n[c]=o[c];return i},timeout:(s,i)=>{if(!r)return;const c=setTimeout(()=>{s(o),clearTimeout(c)},i)}}}function ut(e,...t){const n=this.context,o=n.utils?.[e]||n.functions?.[e]||n.methods?.[e]||n.snippets?.[e];if(o)try{const r=o.call(this,...t);return r&&typeof r.then=="function"&&r.catch(s=>{O.call(this,s)}),r}catch(r){if(O.call(this,r),n?.strictMode)throw r}}async function at(){const e=this,t=e.context?.fetch;if(!t)return null;if(typeof t.select=="function"){if(!t.__authInitialized&&t.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(t,e.context)}return t}if(t.__resolved){if(!t.__resolved.__authInitialized&&t.__resolved.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(t.__resolved,e.context)}return t.__resolved}if(t.__resolving)return t.__resolving;const n=import("@symbo.ls/fetch").then(({resolveDb:r})=>r(t));t.__resolving=n;const o=await n;if(t.__resolved=o,e.context.fetch=o,delete t.__resolving,o.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(o,e.context)}return o}function ht(e){const t=this,n=e||b.OPTIONS.useStateQuery||t.context?.useStateQuery;if(!n)return null;const o={};if(y(t,o),n===!0)return o;const r=St[n];return r?r(o):o}const y=(e,t)=>{const n=e.__ref;if(!n)return;const o=n.__state;o&&typeof o=="string"&&pt(t,o);const r=n.__children;if(r)for(let c=0;c<r.length;c++){const l=e[r[c]];l&&l.__ref&&y(l,t)}const s=n.contentElementKey||"content",i=e[s];i&&i.__ref&&y(i,t)},pt=(e,t)=>{const o=t.replaceAll("../","").replaceAll("~/","").split("/");let r=e;for(let s=0;s<o.length;s++){const i=o[s];s===o.length-1?r[i]||(r[i]=!0):(r[i]===!0&&(r[i]={}),r[i]||(r[i]={}),r=r[i])}},R=(e,t=0)=>{const n=" ".repeat(t),o=Object.entries(e);return o.length?o.map(([s,i])=>i===!0?`${n}${s}`:`${n}${s} {
2
+ `,"font-weight: bold",t[o])):(console.log(n.path),t.keys().forEach(r=>console.log(`%c${r}:`,"font-weight: bold",t[r]))),console.log(t),console.groupEnd(t.key),t}function st(...e){(h==="test"||h==="development")&&console.log(...e)}function it(...e){(h==="test"||h==="development")&&console.warn(...e)}function O(...e){if(h==="test"||h==="development"){if(e[e.length-1]?.debugger)debugger;throw e[e.length-1]?.verbose&&N.call(this),new Error(...e)}}function ct(){const e=this,{key:t,parent:n}=e,{__children:o}=n.__ref,r=o.indexOf(t),s=o[r+1];return n[s]}function lt(e){const t=e||this,{key:n,parent:o}=t,{__children:r}=o.__ref;if(!r)return;const s=r.indexOf(n);return o[r[s-1]]}function ft(e={}){const t=this;t.data||(t.data={}),t.data.varCaches||(t.data.varCaches={});const n=t.data.varCaches,o={};let r;for(const s in e)e[s]!==n[s]&&(r=!0,o[s]=e[s]);return{changed:s=>{if(!r)return;const i=s(o,(0,E.deepClone)(n));for(const c in o)n[c]=o[c];return i},timeout:(s,i)=>{if(!r)return;const c=setTimeout(()=>{s(o),clearTimeout(c)},i)}}}function ut(e,...t){const n=this.context,o=n.utils?.[e]||n.functions?.[e]||n.methods?.[e]||n.snippets?.[e];if(o)try{const r=o.call(this,...t);return r&&typeof r.then=="function"&&r.catch(s=>{O.call(this,s)}),r}catch(r){if(O.call(this,r),n?.strictMode)throw r}}async function at(){const e=this,t=e.context?.fetch;if(!t)return null;if(typeof t.select=="function"){if(!t.__authInitialized&&t.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(t,e.context)}return t}if(t.__resolved){if(!t.__resolved.__authInitialized&&t.__resolved.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(t.__resolved,e.context)}return t.__resolved}if(t.__resolving)return t.__resolving;const n=import("@symbo.ls/fetch").then(({resolveDb:r})=>r(t));t.__resolving=n;const o=await n;if(t.__resolved=o,e.context.fetch=o,delete t.__resolving,o?.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(o,e.context)}return o}function ht(e){const t=this,n=e||b.OPTIONS.useStateQuery||t.context?.useStateQuery;if(!n)return null;const o={};if(y(t,o),n===!0)return o;const r=St[n];return r?r(o):o}const y=(e,t)=>{const n=e.__ref;if(!n)return;const o=n.__state;o&&typeof o=="string"&&pt(t,o);const r=n.__children;if(r)for(let c=0;c<r.length;c++){const l=e[r[c]];l&&l.__ref&&y(l,t)}const s=n.contentElementKey||"content",i=e[s];i&&i.__ref&&y(i,t)},pt=(e,t)=>{const o=t.replaceAll("../","").replaceAll("~/","").split("/");let r=e;for(let s=0;s<o.length;s++){const i=o[s];s===o.length-1?r[i]||(r[i]=!0):(r[i]===!0&&(r[i]={}),r[i]||(r[i]={}),r=r[i])}},R=(e,t=0)=>{const n=" ".repeat(t),o=Object.entries(e);return o.length?o.map(([s,i])=>i===!0?`${n}${s}`:`${n}${s} {
3
3
  ${R(i,t+1)}
4
4
  ${n}}`).join(`
5
5
  `):""},dt=e=>`{
@@ -1,5 +1,5 @@
1
1
  import{triggerEventOn as m}from"./triggerEvent.js";import{DOMQ_PROPERTIES as w,METHODS as k,PARSED_DOMQ_PROPERTIES as R}from"./keys.js";import{isDefined as E,isFunction as p,isObject as P,isObjectLike as x}from"./types.js";import{deepClone as A}from"./object.js";import{isProduction as b}from"./env.js";import{removeValueFromArray as C}from"./array.js";import{OPTIONS as j}from"./cache.js";const a="production";function X(e){const t=this,{__ref:n}=t,o=[].concat(e);let r=n.root[o[0]];if(!o||!o.length)return console.log(o,"on",t.key,"is undefined");for(;r.key===o[0]&&(o.shift(),!!o.length);)if(r=r[o[0]],!r)return;return r}function q(e){const t=this;let{parent:n}=t;if(p(e))return n.state&&e(n,n.state,n.context)?n:n.parent?n.lookup(e):void 0;if(t[e])return t[e];for(;n.param!==e;){if(n[e])return n[e];if(n=n.parent,!n)return}return n}function tt(e){const t=this,{__ref:n}=t,o=n?.__children;if(o)for(let r=0;r<o.length;r++){const s=o[r],i=t[s];if(s===e)return i;if(p(e)){const l=e(i,i.state,i.context);if(i.state&&l)return i}const c=i?.lookdown?.(e);if(c)return c}}function et(e,t=[]){const n=this,{__ref:o}=n,r=o?.__children;if(r){for(let s=0;s<r.length;s++){const i=r[s],c=n[i];if(i===e)t.push(c);else if(p(e)){const l=e(c,c.state,c.context);c.state&&l&&t.push(c)}c?.lookdownAll?.(e,t)}return t.length?t:void 0}}function Q(e={}){const t=this;if(t.node?.style){for(const n in e){const o=e[n],r=t[n];if(P(o)&&r)Q.call(r,o);else if(o!=null){const s=n.replace(/[A-Z]/g,c=>"-"+c.toLowerCase()),i=String(o).replace(/\s*!important\s*$/,"");t.node.style.setProperty(s,i,"important")}}return t}}function nt(e){const t=this;if(m("beforeRemove",t,e)===!1)return t;p(t.node.remove)?t.node.remove():b()||(console.warn("This item cant be removed"),t.log()),delete t.parent[t.key],t.parent.__ref&&(t.parent.__ref.__children=C(t.parent.__ref.__children,t.key)),m("remove",t,e)}function ot(e){return this[e]}function rt(e,t){const n=this;if(e)return n.update(e,t),n}function st(e){return e?this.__ref&&this.__ref[e]:this.__ref}function it(){return this.getRef("__children").map(t=>this[t])}function ct(){return this.getRef().path}let y=null;const lt=e=>{y=e||null},S=()=>y||null;function ft(e){let t=null;const n=o=>o.__element&&o.root?.isRootState;if(!this)t=S();else if(n(this))t=this.root;else if(this.__ref&&this.__ref.path){const o=this.state&&n(this.state),r=p(this.state)&&this.parent.state&&n(this.parent.state);(o||r)&&(t=this.state.root||this.parent.state.root)}return t||(t=S()),e?t?.[e]:t}function ut(e){const t=this.getRootState()?.__element;return t&&Object.keys(t).length>0&&e?t[e]:t}function at(e){return this.getRoot("data")&&Object.keys(this.getRoot("data")).length>0&&e?this.getRoot("data")[e]:this.getRoot("data")}function ht(e){const t=this.getRoot()?.context;return e?t[e]:t}function pt(e){const t=this.context;return e?t[e]:t}const dt=(e,t,n,o)=>Object.defineProperty(e,t,{get:n,set:o});function N(){const e=this,t=[];for(const n in e)!Object.prototype.hasOwnProperty.call(e,n)||w.has(n)&&!R.has(n)||t.push(n);return t}function D(e=[]){const t=this,n={},o=N.call(t),r=o.includes("children"),s=e.length?new Set(e):null;for(let i=0;i<o.length;i++){const c=o[i];if(s&&s.has(c)||!Object.prototype.hasOwnProperty.call(t,c)||r&&c==="content")continue;const l=t[c];if(c==="state"){if(t.__ref&&!t.__ref.__hasRootState)continue;const f=p(l&&l.parse)?l.parse():l;n[c]=p(f)?f:JSON.parse(JSON.stringify(f||{}))}else if(c==="scope"){if(t.__ref&&!t.__ref.__hasRootScope)continue;n[c]=JSON.parse(JSON.stringify(l||{}))}else if(c==="props"){const{__element:f,update:u,...h}=t[c];n[c]=h}else E(l)&&Object.prototype.hasOwnProperty.call(t,c)&&(n[c]=l)}return n}function v(e=[],t=new WeakSet){const n=this;if(t.has(n))return;t.add(n);const o=D.call(n,e),r=e.length?new Set(e):null;for(const s in o){if(r&&r.has(s)||!Object.prototype.hasOwnProperty.call(n,s))continue;const i=o[s];Array.isArray(i)?o[s]=i.map(c=>x(c)?v.call(c,e,t):c):x(i)&&(o[s]=v.call(i,e,t))}return o}function T(...e){if(a!=="test"&&a!=="development")return;const t=this,{__ref:n}=t;return console.groupCollapsed(t.key),e.length?e.forEach(o=>console.log(`%c${o}:
2
- `,"font-weight: bold",t[o])):(console.log(n.path),t.keys().forEach(r=>console.log(`%c${r}:`,"font-weight: bold",t[r]))),console.log(t),console.groupEnd(t.key),t}function _t(...e){(a==="test"||a==="development")&&console.log(...e)}function gt(...e){(a==="test"||a==="development")&&console.warn(...e)}function O(...e){if(a==="test"||a==="development"){if(e[e.length-1]?.debugger)debugger;throw e[e.length-1]?.verbose&&T.call(this),new Error(...e)}}function mt(){const e=this,{key:t,parent:n}=e,{__children:o}=n.__ref,r=o.indexOf(t),s=o[r+1];return n[s]}function xt(e){const t=e||this,{key:n,parent:o}=t,{__children:r}=o.__ref;if(!r)return;const s=r.indexOf(n);return o[r[s-1]]}function yt(e={}){const t=this;t.data||(t.data={}),t.data.varCaches||(t.data.varCaches={});const n=t.data.varCaches,o={};let r;for(const s in e)e[s]!==n[s]&&(r=!0,o[s]=e[s]);return{changed:s=>{if(!r)return;const i=s(o,A(n));for(const c in o)n[c]=o[c];return i},timeout:(s,i)=>{if(!r)return;const c=setTimeout(()=>{s(o),clearTimeout(c)},i)}}}function St(e,...t){const n=this.context,o=n.utils?.[e]||n.functions?.[e]||n.methods?.[e]||n.snippets?.[e];if(o)try{const r=o.call(this,...t);return r&&typeof r.then=="function"&&r.catch(s=>{O.call(this,s)}),r}catch(r){if(O.call(this,r),n?.strictMode)throw r}}async function vt(){const e=this,t=e.context?.fetch;if(!t)return null;if(typeof t.select=="function"){if(!t.__authInitialized&&t.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(t,e.context)}return t}if(t.__resolved){if(!t.__resolved.__authInitialized&&t.__resolved.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(t.__resolved,e.context)}return t.__resolved}if(t.__resolving)return t.__resolving;const n=import("@symbo.ls/fetch").then(({resolveDb:r})=>r(t));t.__resolving=n;const o=await n;if(t.__resolved=o,e.context.fetch=o,delete t.__resolving,o.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(o,e.context)}return o}function Ot(e){const t=this,n=e||j.useStateQuery||t.context?.useStateQuery;if(!n)return null;const o={};if(g(t,o),n===!0)return o;const r=z[n];return r?r(o):o}const g=(e,t)=>{const n=e.__ref;if(!n)return;const o=n.__state;o&&typeof o=="string"&&I(t,o);const r=n.__children;if(r)for(let c=0;c<r.length;c++){const l=e[r[c]];l&&l.__ref&&g(l,t)}const s=n.contentElementKey||"content",i=e[s];i&&i.__ref&&g(i,t)},I=(e,t)=>{const o=t.replaceAll("../","").replaceAll("~/","").split("/");let r=e;for(let s=0;s<o.length;s++){const i=o[s];s===o.length-1?r[i]||(r[i]=!0):(r[i]===!0&&(r[i]={}),r[i]||(r[i]={}),r=r[i])}},$=(e,t=0)=>{const n=" ".repeat(t),o=Object.entries(e);return o.length?o.map(([s,i])=>i===!0?`${n}${s}`:`${n}${s} {
2
+ `,"font-weight: bold",t[o])):(console.log(n.path),t.keys().forEach(r=>console.log(`%c${r}:`,"font-weight: bold",t[r]))),console.log(t),console.groupEnd(t.key),t}function _t(...e){(a==="test"||a==="development")&&console.log(...e)}function gt(...e){(a==="test"||a==="development")&&console.warn(...e)}function O(...e){if(a==="test"||a==="development"){if(e[e.length-1]?.debugger)debugger;throw e[e.length-1]?.verbose&&T.call(this),new Error(...e)}}function mt(){const e=this,{key:t,parent:n}=e,{__children:o}=n.__ref,r=o.indexOf(t),s=o[r+1];return n[s]}function xt(e){const t=e||this,{key:n,parent:o}=t,{__children:r}=o.__ref;if(!r)return;const s=r.indexOf(n);return o[r[s-1]]}function yt(e={}){const t=this;t.data||(t.data={}),t.data.varCaches||(t.data.varCaches={});const n=t.data.varCaches,o={};let r;for(const s in e)e[s]!==n[s]&&(r=!0,o[s]=e[s]);return{changed:s=>{if(!r)return;const i=s(o,A(n));for(const c in o)n[c]=o[c];return i},timeout:(s,i)=>{if(!r)return;const c=setTimeout(()=>{s(o),clearTimeout(c)},i)}}}function St(e,...t){const n=this.context,o=n.utils?.[e]||n.functions?.[e]||n.methods?.[e]||n.snippets?.[e];if(o)try{const r=o.call(this,...t);return r&&typeof r.then=="function"&&r.catch(s=>{O.call(this,s)}),r}catch(r){if(O.call(this,r),n?.strictMode)throw r}}async function vt(){const e=this,t=e.context?.fetch;if(!t)return null;if(typeof t.select=="function"){if(!t.__authInitialized&&t.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(t,e.context)}return t}if(t.__resolved){if(!t.__resolved.__authInitialized&&t.__resolved.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(t.__resolved,e.context)}return t.__resolved}if(t.__resolving)return t.__resolving;const n=import("@symbo.ls/fetch").then(({resolveDb:r})=>r(t));t.__resolving=n;const o=await n;if(t.__resolved=o,e.context.fetch=o,delete t.__resolving,o?.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(o,e.context)}return o}function Ot(e){const t=this,n=e||j.useStateQuery||t.context?.useStateQuery;if(!n)return null;const o={};if(g(t,o),n===!0)return o;const r=z[n];return r?r(o):o}const g=(e,t)=>{const n=e.__ref;if(!n)return;const o=n.__state;o&&typeof o=="string"&&I(t,o);const r=n.__children;if(r)for(let c=0;c<r.length;c++){const l=e[r[c]];l&&l.__ref&&g(l,t)}const s=n.contentElementKey||"content",i=e[s];i&&i.__ref&&g(i,t)},I=(e,t)=>{const o=t.replaceAll("../","").replaceAll("~/","").split("/");let r=e;for(let s=0;s<o.length;s++){const i=o[s];s===o.length-1?r[i]||(r[i]=!0):(r[i]===!0&&(r[i]={}),r[i]||(r[i]={}),r=r[i])}},$=(e,t=0)=>{const n=" ".repeat(t),o=Object.entries(e);return o.length?o.map(([s,i])=>i===!0?`${n}${s}`:`${n}${s} {
3
3
  ${$(i,t+1)}
4
4
  ${n}}`).join(`
5
5
  `):""},L=e=>`{
package/methods.js CHANGED
@@ -474,7 +474,15 @@ export async function getDB () {
474
474
  db.__resolved = resolved
475
475
  element.context.fetch = resolved
476
476
  delete db.__resolving
477
- if (resolved.getSession) {
477
+ // resolveDb returns null when the config has no `adapter` field or the
478
+ // adapter's setup() bails (e.g. cross-realm Supabase createClient
479
+ // returns a client without `.auth` — see workspace
480
+ // attachDbAdapters.js:resolveDbAdapters for the consumer-side
481
+ // pre-resolve that bypasses this path). Without `?.`, the next line
482
+ // throws `Cannot read properties of null (reading 'getSession')` and
483
+ // unwinds the entire fetch boot — silently breaking every consumer
484
+ // that depended on the adapter.
485
+ if (resolved?.getSession) {
478
486
  const { initAdapterAuth } = await import('@symbo.ls/fetch')
479
487
  await initAdapterAuth(resolved, element.context)
480
488
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/utils",
3
- "version": "3.14.17",
3
+ "version": "3.14.18",
4
4
  "license": "CC-BY-NC-4.0",
5
5
  "type": "module",
6
6
  "module": "./dist/esm/index.js",