@lunora/svelte 1.0.0-alpha.64 → 1.0.0-alpha.65

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/index.mjs CHANGED
@@ -1 +1 @@
1
- import{agent as o}from"./packem_shared/agent-CddTbgxO.mjs";import{agentChat as a}from"./packem_shared/agentChat-DKfx2E6R.mjs";import{agentState as f}from"./packem_shared/agentState-fc7KRCp9.mjs";import{agentToolEvents as n}from"./packem_shared/agentToolEvents-sOUvSZsy.mjs";import{auth as i,authGate as u}from"./packem_shared/auth-BWCPnv0n.mjs";import{connectionStatus as s}from"./packem_shared/connectionStatus-BHVAskxU.mjs";import{getLunoraClient as c,setLunoraClient as d}from"./packem_shared/getLunoraClient-DU7BmZy1.mjs";import{flag as y,flags as C}from"./packem_shared/flag-kAz4soTW.mjs";import{hydratePreloaded as v}from"./packem_shared/hydratePreloaded-Bbm6vwbA.mjs";import{mutation as S}from"./packem_shared/mutation-fa0Bj5Bo.mjs";import{mutator as q}from"./packem_shared/mutator-cvH3UrNm.mjs";import{infiniteQuery as E,paginatedQuery as G}from"./packem_shared/infiniteQuery-Cm9qC-mf.mjs";import{presence as T}from"./packem_shared/presence-C2YC1KOc.mjs";import{query as k}from"./packem_shared/query-BEQBdOJ2.mjs";import{rateLimit as z}from"./packem_shared/rateLimit-DtykU7F_.mjs";import{stream as D}from"./packem_shared/stream-DItOnXt6.mjs";import{subscription as H}from"./packem_shared/subscription-Dbz9sy8N.mjs";import{voiceAgent as J}from"./packem_shared/voiceAgent-D-82ai_D.mjs";export{o as agent,a as agentChat,f as agentState,n as agentToolEvents,i as auth,u as authGate,s as connectionStatus,y as flag,C as flags,c as getLunoraClient,v as hydratePreloaded,E as infiniteQuery,S as mutation,q as mutator,G as paginatedQuery,T as presence,k as query,z as rateLimit,d as setLunoraClient,D as stream,H as subscription,J as voiceAgent};
1
+ import{agent as o}from"./packem_shared/agent-CddTbgxO.mjs";import{agentChat as a}from"./packem_shared/agentChat-DKfx2E6R.mjs";import{agentState as f}from"./packem_shared/agentState-fc7KRCp9.mjs";import{agentToolEvents as n}from"./packem_shared/agentToolEvents-sOUvSZsy.mjs";import{auth as i,authGate as u}from"./packem_shared/auth-BWCPnv0n.mjs";import{connectionStatus as s}from"./packem_shared/connectionStatus-BHVAskxU.mjs";import{getLunoraClient as c,setLunoraClient as d}from"./packem_shared/getLunoraClient-DU7BmZy1.mjs";import{flag as y,flags as C}from"./packem_shared/flag-kAz4soTW.mjs";import{hydratePreloaded as v}from"./packem_shared/hydratePreloaded-Bbm6vwbA.mjs";import{mutation as S}from"./packem_shared/mutation-fa0Bj5Bo.mjs";import{mutator as q}from"./packem_shared/mutator-cvH3UrNm.mjs";import{infiniteQuery as E,paginatedQuery as G}from"./packem_shared/infiniteQuery-Cqxcrhn9.mjs";import{presence as T}from"./packem_shared/presence-C2YC1KOc.mjs";import{query as k}from"./packem_shared/query-BEQBdOJ2.mjs";import{rateLimit as z}from"./packem_shared/rateLimit-DtykU7F_.mjs";import{stream as D}from"./packem_shared/stream-DItOnXt6.mjs";import{subscription as H}from"./packem_shared/subscription-Dbz9sy8N.mjs";import{voiceAgent as J}from"./packem_shared/voiceAgent-D-82ai_D.mjs";export{o as agent,a as agentChat,f as agentState,n as agentToolEvents,i as auth,u as authGate,s as connectionStatus,y as flag,C as flags,c as getLunoraClient,v as hydratePreloaded,E as infiniteQuery,S as mutation,q as mutator,G as paginatedQuery,T as presence,k as query,z as rateLimit,d as setLunoraClient,D as stream,H as subscription,J as voiceAgent};
@@ -0,0 +1 @@
1
+ import{initialPages as K,derivePaginationStatus as T,applyLoadMore as V,rebalance as q}from"@lunora/client/pagination";import{derived as k,writable as B,readable as G,get as N}from"svelte/store";import{getLunoraClient as I}from"./getLunoraClient-DU7BmZy1.mjs";import{i as Q}from"./is-function-reference-ByqJF30w.mjs";const H=(e,r)=>e<r?-1:e>r?1:0,U=e=>{if(e===void 0)return"null";if(typeof e=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key — pass it as a string, or use stableWireKey");if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(t=>U(t)).join(",")}]`;const r=Object.getPrototypeOf(e);if(r!==null&&r!==Object.prototype){const t=e.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${t} in a stable JSON cache key — only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}const n=e,b=Object.keys(n).toSorted(H),i=[];for(const t of b){const o=n[t];o!==void 0&&i.push(`${JSON.stringify(t)}:${U(o)}`)}return`{${i.join(",")}}`},E=e=>{let r="";for(let n=0;n<e.length;n+=32768)r+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(r)},c="$lunora.wire$",D=64,X=e=>{if(e===null||typeof e!="object")return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype},S=(e,r=0)=>{if(r>D)throw new RangeError(`wire-codec: value nesting exceeds the ${D}-level limit`);if(e===void 0)return[c,"undefined"];if(e===null)return null;const n=typeof e;if(n==="bigint")return[c,"bigint",e.toString()];if(n==="number"){const t=e;return Number.isNaN(t)?[c,"nan"]:t===1/0?[c,"inf"]:t===-1/0?[c,"-inf"]:t}if(n!=="object")return e;if(e instanceof Date)return[c,"date",S(e.getTime(),r+1)];if(e instanceof Error){const t=e,o={};for(const s of Object.keys(t))t[s]!==void 0&&(o[s]=S(t[s],r+1));const a=[c,"error",t.name,t.message,o];return t.cause!==void 0&&a.push(S(t.cause,r+1)),a}if(e instanceof URL)return[c,"url",e.href];if(e instanceof Map)return[c,"map",[...e.entries()].map(([t,o])=>[S(t,r+1),S(o,r+1)])];if(e instanceof Set)return[c,"set",[...e].map(t=>S(t,r+1))];if(e instanceof ArrayBuffer)return[c,"bytes",E(new Uint8Array(e)),"ArrayBuffer"];if(ArrayBuffer.isView(e)){const t=e,o=t.constructor.name,a=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);return o==="Uint8Array"?[c,"bytes",E(a)]:[c,"bytes",E(a),o]}if(Array.isArray(e)){const t=e.map(o=>S(o,r+1));return t.length>0&&t[0]===c?[c,"arr",t]:t}if(!X(e)){const t=e.constructor?.name??"value";throw new TypeError(`wire-codec: cannot encode a ${t} over the Lunora wire — only plain objects, arrays, and the supported built-ins (Date, Error, URL, Map, Set, ArrayBuffer/typed arrays, bigint) round-trip`)}const b=e,i={};for(const t of Object.keys(b)){const o=b[t];o!==void 0&&(i[t]=S(o,r+1))}return i},Y=e=>U(S(e)),$=(e,r)=>({...r,paginationOpts:{cursor:e.lower,endCursor:e.upper,numItems:e.numItems}}),P=(e,r)=>`${e}::${Y(r)}`,W=(e,r,n,b)=>{const{initialNumItems:i,shardKey:t}=b,o=B(K(i)),a=B([]),s=new Map,y=new Map,w=new Set,f=n,g=()=>{if(f==="skip"){a.set([]);return}const l=N(o).map(m=>{const v=P(r.__lunoraRef,$(m,f));return s.get(v)});a.set(l)},O=(l,m)=>{if(f==="skip")return;const v=u=>P(r.__lunoraRef,$(u,f));for(const u of m){const h=v(u);if(s.has(h))continue;const d=l.find(R=>R.lower===u.lower);if(d){const R=s.get(v(d));R&&s.set(h,R)}}},A=()=>{if(f==="skip"){for(const u of y.values())u();y.clear(),a.set([]);return}const l=f,m=N(o),v=new Set;for(const u of m)v.add(P(r.__lunoraRef,$(u,l)));for(const[u,h]of y)v.has(u)||(h(),y.delete(u),w.delete(u),s.delete(u));for(const u of m){const h=$(u,l),d=P(r.__lunoraRef,h);if(y.has(d))continue;w.add(d);const R=e.subscribe(r,h,F=>{if(s.set(d,F),w.delete(d),g(),w.size===0){const L=N(o),M=q(L,N(a));M&&(O(L,M),o.set(M),p(),g())}},{shardKey:t});y.set(d,R)}};let j=!1,_=!1;const p=()=>{if(j){_=!0;return}j=!0;try{do _=!1,A();while(_)}finally{j=!1}},x=()=>{for(const l of y.values())l();y.clear(),s.clear(),w.clear()},C=G([],l=>{const m=a.subscribe(l);return f!=="skip"&&(p(),g()),()=>{m(),x(),o.set(K(i)),a.set([])}}),z=k(C,l=>T(f==="skip",l).status);return{loadMore:l=>{if(f==="skip")return;const m=N(a),{nextCursor:v,status:u}=T(!1,m);if(u!=="CanLoadMore")return;const h=N(o),d=V(h,v,l);if(!d)return;const R=h.at(-1),F=d.at(-2);if(R&&F){const L=P(r.__lunoraRef,$(R,f)),M=P(r.__lunoraRef,$(F,f));if(L!==M){const J=s.get(L);J&&(s.set(M,J),s.delete(L))}}o.set(d),p(),g()},pageResults:C,status:z}};function oe(e,r,n,b){const i=!Q(e),t=i?e:I(),o=i?r:e,a=i?n:r,s=i?b:n,{loadMore:y,pageResults:w,status:f}=W(t,o,a,s),g=k(w,O=>{const A=[];for(const j of O)j&&A.push(...j.page);return A});return{isLoading:k(f,O=>O==="LoadingFirstPage"||O==="LoadingMore"),loadMore:y,results:g,status:f}}function ne(e,r,n,b){const i=!Q(e),t=i?e:I(),o=i?r:e,a=i?n:r,s=i?b:n,{initialNumItems:y}=s,{loadMore:w,pageResults:f,status:g}=W(t,o,a,s),O=k(f,p=>{const x=[];for(const C of p)C&&x.push(C.page);return x}),A=k(g,p=>p==="LoadingFirstPage"),j=k(g,p=>p==="CanLoadMore"),_=k(g,p=>p==="LoadingMore");return{fetchNextPage:p=>{w(p??y)},hasNextPage:j,isFetchingNextPage:_,isLoading:A,pages:O,status:g}}export{ne as infiniteQuery,oe as paginatedQuery};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/svelte",
3
- "version": "1.0.0-alpha.64",
3
+ "version": "1.0.0-alpha.65",
4
4
  "description": "Svelte adapter for Lunora — live stores, optimistic mutations, and reactive loaders",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -58,10 +58,10 @@
58
58
  "access": "public"
59
59
  },
60
60
  "dependencies": {
61
- "@lunora/client": "1.0.0-alpha.37",
62
- "@lunora/errors": "1.0.0-alpha.12",
63
- "@lunora/ratelimit": "1.0.0-alpha.15",
64
- "@lunora/runtime": "1.0.0-alpha.51",
61
+ "@lunora/client": "1.0.0-alpha.38",
62
+ "@lunora/errors": "1.0.0-alpha.13",
63
+ "@lunora/ratelimit": "1.0.0-alpha.16",
64
+ "@lunora/runtime": "1.0.0-alpha.52",
65
65
  "@visulima/storage-client": "1.0.0"
66
66
  },
67
67
  "peerDependencies": {
@@ -1 +0,0 @@
1
- import{initialPages as K,derivePaginationStatus as T,applyLoadMore as V,rebalance as q}from"@lunora/client/pagination";import{derived as A,writable as B,readable as G,get as N}from"svelte/store";import{getLunoraClient as I}from"./getLunoraClient-DU7BmZy1.mjs";import{i as Q}from"./is-function-reference-ByqJF30w.mjs";const H=(e,n)=>e<n?-1:e>n?1:0,U=e=>{if(e===void 0)return"null";if(typeof e=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key — pass it as a string, or use stableWireKey");if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(c=>U(c)).join(",")}]`;const n=Object.getPrototypeOf(e);if(n!==null&&n!==Object.prototype){const c=e.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${c} in a stable JSON cache key — only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}const s=e,b=Object.keys(s).toSorted(H),i=[];for(const c of b){const t=s[c];t!==void 0&&i.push(`${JSON.stringify(c)}:${U(t)}`)}return`{${i.join(",")}}`},E=e=>{let n="";for(let s=0;s<e.length;s+=32768)n+=String.fromCharCode(...e.subarray(s,s+32768));return btoa(n)},l="$lunora.wire$",D=64,S=(e,n=0)=>{if(n>D)throw new RangeError(`wire-codec: value nesting exceeds the ${D}-level limit`);if(e===void 0)return[l,"undefined"];if(e===null)return null;const s=typeof e;if(s==="bigint")return[l,"bigint",e.toString()];if(s==="number"){const t=e;return Number.isNaN(t)?[l,"nan"]:t===1/0?[l,"inf"]:t===-1/0?[l,"-inf"]:t}if(s!=="object")return e;if(e instanceof Date)return[l,"date",S(e.getTime(),n+1)];if(e instanceof Error){const t=e,r={};for(const u of Object.keys(t))t[u]!==void 0&&(r[u]=S(t[u],n+1));const o=[l,"error",t.name,t.message,r];return t.cause!==void 0&&o.push(S(t.cause,n+1)),o}if(e instanceof URL)return[l,"url",e.href];if(e instanceof Map)return[l,"map",[...e.entries()].map(([t,r])=>[S(t,n+1),S(r,n+1)])];if(e instanceof Set)return[l,"set",[...e].map(t=>S(t,n+1))];if(e instanceof ArrayBuffer)return[l,"bytes",E(new Uint8Array(e)),"ArrayBuffer"];if(ArrayBuffer.isView(e)){const t=e,r=t.constructor.name,o=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);return r==="Uint8Array"?[l,"bytes",E(o)]:[l,"bytes",E(o),r]}if(Array.isArray(e)){const t=e.map(r=>S(r,n+1));return t.length>0&&t[0]===l?[l,"arr",t]:t}const b=Object.getPrototypeOf(e);if(b!==null&&b!==Object.prototype){const t=e.constructor?.name??"value";throw new TypeError(`wire-codec: cannot encode a ${t} over the Lunora wire — only plain objects, arrays, and the supported built-ins (Date, Error, URL, Map, Set, ArrayBuffer/typed arrays, bigint) round-trip`)}const i=e,c={};for(const t of Object.keys(i)){const r=i[t];r!==void 0&&(c[t]=S(r,n+1))}return c},X=e=>U(S(e)),$=(e,n)=>({...n,paginationOpts:{cursor:e.lower,endCursor:e.upper,numItems:e.numItems}}),P=(e,n)=>`${e}::${X(n)}`,W=(e,n,s,b)=>{const{initialNumItems:i,shardKey:c}=b,t=B(K(i)),r=B([]),o=new Map,u=new Map,w=new Set,f=s,g=()=>{if(f==="skip"){r.set([]);return}const p=N(t).map(m=>{const v=P(n.__lunoraRef,$(m,f));return o.get(v)});r.set(p)},O=(p,m)=>{if(f==="skip")return;const v=a=>P(n.__lunoraRef,$(a,f));for(const a of m){const h=v(a);if(o.has(h))continue;const y=p.find(R=>R.lower===a.lower);if(y){const R=o.get(v(y));R&&o.set(h,R)}}},L=()=>{if(f==="skip"){for(const a of u.values())a();u.clear(),r.set([]);return}const p=f,m=N(t),v=new Set;for(const a of m)v.add(P(n.__lunoraRef,$(a,p)));for(const[a,h]of u)v.has(a)||(h(),u.delete(a),w.delete(a),o.delete(a));for(const a of m){const h=$(a,p),y=P(n.__lunoraRef,h);if(u.has(y))continue;w.add(y);const R=e.subscribe(n,h,F=>{if(o.set(y,F),w.delete(y),g(),w.size===0){const M=N(t),j=q(M,N(r));j&&(O(M,j),t.set(j),d(),g())}},{shardKey:c});u.set(y,R)}};let k=!1,_=!1;const d=()=>{if(k){_=!0;return}k=!0;try{do _=!1,L();while(_)}finally{k=!1}},x=()=>{for(const p of u.values())p();u.clear(),o.clear(),w.clear()},C=G([],p=>{const m=r.subscribe(p);return f!=="skip"&&(d(),g()),()=>{m(),x(),t.set(K(i)),r.set([])}}),z=A(C,p=>T(f==="skip",p).status);return{loadMore:p=>{if(f==="skip")return;const m=N(r),{nextCursor:v,status:a}=T(!1,m);if(a!=="CanLoadMore")return;const h=N(t),y=V(h,v,p);if(!y)return;const R=h.at(-1),F=y.at(-2);if(R&&F){const M=P(n.__lunoraRef,$(R,f)),j=P(n.__lunoraRef,$(F,f));if(M!==j){const J=o.get(M);J&&(o.set(j,J),o.delete(M))}}t.set(y),d(),g()},pageResults:C,status:z}};function ne(e,n,s,b){const i=!Q(e),c=i?e:I(),t=i?n:e,r=i?s:n,o=i?b:s,{loadMore:u,pageResults:w,status:f}=W(c,t,r,o),g=A(w,O=>{const L=[];for(const k of O)k&&L.push(...k.page);return L});return{isLoading:A(f,O=>O==="LoadingFirstPage"||O==="LoadingMore"),loadMore:u,results:g,status:f}}function re(e,n,s,b){const i=!Q(e),c=i?e:I(),t=i?n:e,r=i?s:n,o=i?b:s,{initialNumItems:u}=o,{loadMore:w,pageResults:f,status:g}=W(c,t,r,o),O=A(f,d=>{const x=[];for(const C of d)C&&x.push(C.page);return x}),L=A(g,d=>d==="LoadingFirstPage"),k=A(g,d=>d==="CanLoadMore"),_=A(g,d=>d==="LoadingMore");return{fetchNextPage:d=>{w(d??u)},hasNextPage:k,isFetchingNextPage:_,isLoading:L,pages:O,status:g}}export{re as infiniteQuery,ne as paginatedQuery};