@lunora/angular 1.0.0-alpha.247 → 1.0.0-alpha.249

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 e}from"./packem_shared/agent-DjMQf-yE.mjs";import{agentChat as p}from"./packem_shared/agentChat-CQ3TWlc5.mjs";import{agentState as f}from"./packem_shared/agentState-Bjqf9q2f.mjs";import{agentToolEvents as x}from"./packem_shared/agentToolEvents-CFnjzw3X.mjs";import{auth as i,authGate as u}from"./packem_shared/auth-C3dB8sYS.mjs";import{LUNORA_CLIENT as g,injectLunoraClient as l,provideLunora as s}from"./packem_shared/LUNORA_CLIENT-B0toApHY.mjs";import{connectionStatus as v}from"./packem_shared/connectionStatus-UhmuwzMa.mjs";import{flag as h,flags as y}from"./packem_shared/flag-BDKBQGos.mjs";import{hydratePreloaded as C}from"./packem_shared/hydratePreloaded-QPAo50Am.mjs";import{liveQuery as S}from"./packem_shared/liveQuery-eE9zMaxo.mjs";import{liveTopic as E}from"./packem_shared/liveTopic-Cz1BDkMP.mjs";import{mutate as N}from"./packem_shared/mutate-Dg5AiM8y.mjs";import{mutator as b}from"./packem_shared/mutator-DjG1yGk8.mjs";import{infiniteQuery as G,paginatedQuery as K}from"./packem_shared/infiniteQuery-DGYdgFHW.mjs";import{presence as R}from"./packem_shared/presence-NK13Gvdk.mjs";import{rateLimit as _}from"./packem_shared/rateLimit-B3h9qzh-.mjs";import{runAction as q}from"./packem_shared/runAction-BfiPq4Xz.mjs";import{stream as z}from"./packem_shared/stream-BuhiwhIH.mjs";import{subscription as D}from"./packem_shared/subscription-zJv48q6C.mjs";import{voiceAgent as H}from"./packem_shared/voiceAgent-DppK8OxH.mjs";import{SKIP as M}from"@lunora/client/query";export{g as LUNORA_CLIENT,M as SKIP,e as agent,p as agentChat,f as agentState,x as agentToolEvents,i as auth,u as authGate,v as connectionStatus,h as flag,y as flags,C as hydratePreloaded,G as infiniteQuery,l as injectLunoraClient,S as liveQuery,E as liveTopic,N as mutate,b as mutator,K as paginatedQuery,R as presence,s as provideLunora,_ as rateLimit,q as runAction,z as stream,D as subscription,H as voiceAgent};
1
+ import{agent as e}from"./packem_shared/agent-DjMQf-yE.mjs";import{agentChat as p}from"./packem_shared/agentChat-CQ3TWlc5.mjs";import{agentState as f}from"./packem_shared/agentState-Bjqf9q2f.mjs";import{agentToolEvents as x}from"./packem_shared/agentToolEvents-CFnjzw3X.mjs";import{auth as i,authGate as u}from"./packem_shared/auth-C3dB8sYS.mjs";import{LUNORA_CLIENT as g,injectLunoraClient as l,provideLunora as s}from"./packem_shared/LUNORA_CLIENT-B0toApHY.mjs";import{connectionStatus as v}from"./packem_shared/connectionStatus-UhmuwzMa.mjs";import{flag as h,flags as y}from"./packem_shared/flag-BDKBQGos.mjs";import{hydratePreloaded as C}from"./packem_shared/hydratePreloaded-QPAo50Am.mjs";import{liveQuery as S}from"./packem_shared/liveQuery-eE9zMaxo.mjs";import{liveTopic as E}from"./packem_shared/liveTopic-Cz1BDkMP.mjs";import{mutate as N}from"./packem_shared/mutate-Dg5AiM8y.mjs";import{mutator as b}from"./packem_shared/mutator-DjG1yGk8.mjs";import{infiniteQuery as G,paginatedQuery as K}from"./packem_shared/infiniteQuery-CnLj_eFx.mjs";import{presence as R}from"./packem_shared/presence-NK13Gvdk.mjs";import{rateLimit as _}from"./packem_shared/rateLimit-B3h9qzh-.mjs";import{runAction as q}from"./packem_shared/runAction-BfiPq4Xz.mjs";import{stream as z}from"./packem_shared/stream-BuhiwhIH.mjs";import{subscription as D}from"./packem_shared/subscription-zJv48q6C.mjs";import{voiceAgent as H}from"./packem_shared/voiceAgent-DppK8OxH.mjs";import{SKIP as M}from"@lunora/client/query";export{g as LUNORA_CLIENT,M as SKIP,e as agent,p as agentChat,f as agentState,x as agentToolEvents,i as auth,u as authGate,v as connectionStatus,h as flag,y as flags,C as hydratePreloaded,G as infiniteQuery,l as injectLunoraClient,S as liveQuery,E as liveTopic,N as mutate,b as mutator,K as paginatedQuery,R as presence,s as provideLunora,_ as rateLimit,q as runAction,z as stream,D as subscription,H as voiceAgent};
@@ -0,0 +1 @@
1
+ import{computed as g,inject as q,DestroyRef as z,signal as S}from"@angular/core";import{initialPages as J,derivePaginationStatus as W,applyLoadMore as T,rebalance as U}from"@lunora/client/pagination";import{stableWireKey as X}from"@lunora/wire";import{resolveLunoraClient as B}from"./LUNORA_CLIENT-B0toApHY.mjs";import{s as E,a as Y}from"./platform-DGTu4Ucl.mjs";const Z=(a,t)=>`${a}::${X(t)}`,_=(a,t)=>({...t,paginationOpts:{cursor:a.lower,endCursor:a.upper,numItems:a.numItems}}),$=(a,t,s,d)=>{const c=B(s.client),K=s.destroyRef===void 0&&d===void 0,{initialNumItems:i,shardKey:R}=s,h=a.__lunoraRef,w=t==="skip"?{}:t,e=S(J(i)),x=S([]),O=S("LoadingFirstPage"),C=S(void 0),P=new Map,f=new Map,b=new Set,D=new WeakMap,v=u=>{let n=D.get(u);return n===void 0&&(n=Z(h,_(u,w)),D.set(u,n)),n},L=()=>{const n=e().map(o=>{const l=v(o);return f.get(l)});x.set(n);const{status:p}=W(t==="skip",n);O.set(p)},G=(u,n)=>{for(const p of n){const o=v(p);if(f.has(o))continue;const l=u.find(r=>r.lower===p.lower);if(l){const r=f.get(v(l));r&&f.set(o,r)}}},H=u=>{const n=new Set;for(const o of u)n.add(v(o));for(const[o,l]of P)n.has(l.currentKey)||(l.unsub(),P.delete(o),f.delete(l.currentKey));const p=new Set([...P.values()].map(o=>o.currentKey));for(const o of u){const l=_(o,w),r=v(o);if(p.has(r))continue;const y={currentKey:r,unsub:void 0};b.add(r);const I=c.subscribe(a,l,M=>{if(f.set(y.currentKey,M),b.delete(y.currentKey),C.set(void 0),L(),b.size===0){const m=e(),k=U(m,x());k&&(G(m,k),e.set(k),F(k),L())}},{onError:M=>{b.delete(r),C.set(M);const m=e(),k=m.at(-1);m.length>1&&k&&!f.has(r)&&v(k)===r&&(e.set(m.slice(0,-1)),F(e())),L(),s.onError?.(M)},shardKey:R});y.unsub=I,P.set(r,y),p.add(r)}};let j=!1,N=!1;const F=u=>{if(j){N=!0;return}j=!0;try{let n=u;do N=!1,H(n),n=e();while(N)}finally{j=!1}};t!=="skip"&&E(K)&&F(e()),L();const Q=()=>{for(const u of P.values())u.unsub();P.clear(),f.clear()};return d===void 0?(s.destroyRef??q(z)).onDestroy(Q):d(Q),{error:C,loadMore:u=>{if(t==="skip")return;const{nextCursor:n,status:p}=W(!1,x());if(p!=="CanLoadMore")return;const o=T(e(),n,u);if(!o)return;const l=e().at(-1),r=o.at(-2);if(l&&r){const y=v(l),I=v(r),M=P.get(y);if(M&&y!==I){const m=f.get(y);m&&f.set(I,m),M.unsub(),P.delete(y),f.delete(y)}}C.set(void 0),e.set(o),F(e()),L()},pageResults:x,skipped:g(()=>t==="skip"),status:O}},V=(a,t,s)=>{if(typeof t!="function")return $(a,t,s);const d=B(s.client),c=s.destroyRef===void 0,K=s.destroyRef??q(z),i=S(void 0);return E(c)&&Y(t,{destroyRef:K,injector:s.injector},(R,h)=>{const w=[];i.set($(a,R,{...s,client:d},e=>w.push(e))),h(()=>{for(const e of w)e()})}),{error:g(()=>i()?.error()),loadMore:R=>{i()?.loadMore(R)},pageResults:g(()=>i()?.pageResults()??[]),skipped:g(()=>i()?.skipped()??t()==="skip"),status:g(()=>i()?.status()??"LoadingFirstPage")}},re=(a,t,s)=>{const d=V(a,t,s),c=g(()=>d.pageResults().flatMap(i=>i?.page??[])),K=g(()=>{const i=d.status();return!d.skipped()&&(i==="LoadingFirstPage"||i==="LoadingMore")});return{error:d.error,isLoading:K,loadMore:d.loadMore,results:c,status:d.status}},ae=(a,t,s)=>{const{initialNumItems:d}=s,c=V(a,t,s),K=g(()=>c.pageResults().flatMap(e=>e?[e.page]:[])),i=g(()=>!c.skipped()&&c.status()==="LoadingFirstPage"),R=g(()=>c.status()==="CanLoadMore"),h=g(()=>!c.skipped()&&c.status()==="LoadingMore"),w=e=>{c.loadMore(e??d)};return{error:c.error,fetchNextPage:w,hasNextPage:R,isFetchingNextPage:h,isLoading:i,pages:K,status:c.status}};export{ae as infiniteQuery,re as paginatedQuery};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/angular",
3
- "version": "1.0.0-alpha.247",
3
+ "version": "1.0.0-alpha.249",
4
4
  "description": "Angular reactive adapter for Lunora — signal-based live queries and mutations",
5
5
  "keywords": [
6
6
  "angular",
@@ -53,9 +53,9 @@
53
53
  "access": "public"
54
54
  },
55
55
  "dependencies": {
56
- "@lunora/client": "1.0.0-alpha.263",
57
- "@lunora/ratelimit": "1.0.0-alpha.181",
58
- "@lunora/wire": "1.0.0-alpha.3",
56
+ "@lunora/client": "1.0.0-alpha.265",
57
+ "@lunora/ratelimit": "1.0.0-alpha.183",
58
+ "@lunora/wire": "1.0.0-alpha.4",
59
59
  "@visulima/storage-client": "1.0.9"
60
60
  },
61
61
  "peerDependencies": {
@@ -1 +0,0 @@
1
- import{computed as m,inject as q,DestroyRef as z,signal as x}from"@angular/core";import{initialPages as H,derivePaginationStatus as _,applyLoadMore as J,rebalance as T}from"@lunora/client/pagination";import{stableWireKey as U}from"@lunora/wire";import{resolveLunoraClient as B}from"./LUNORA_CLIENT-B0toApHY.mjs";import{s as E,a as X}from"./platform-DGTu4Ucl.mjs";const h=(o,t)=>`${o}::${U(t)}`,L=(o,t)=>({...t,paginationOpts:{cursor:o.lower,endCursor:o.upper,numItems:o.numItems}}),$=(o,t,n,i)=>{const r=B(n.client),K=n.destroyRef===void 0&&i===void 0,{initialNumItems:a,shardKey:w}=n,g=o.__lunoraRef,l=t==="skip"?{}:t,e=x(H(a)),C=x([]),D=x("LoadingFirstPage"),b=x(void 0),R=new Map,p=new Map,F=new Set,S=()=>{const f=e().map(s=>{const u=h(g,L(s,l));return p.get(u)});C.set(f);const{status:P}=_(t==="skip",f);D.set(P)},W=(y,f)=>{const P=s=>h(g,L(s,l));for(const s of f){const u=P(s);if(p.has(u))continue;const d=y.find(c=>c.lower===s.lower);if(d){const c=p.get(P(d));c&&p.set(u,c)}}},G=y=>{const f=new Set;for(const s of y)f.add(h(g,L(s,l)));for(const[s,u]of R)f.has(u.currentKey)||(u.unsub(),R.delete(s),p.delete(u.currentKey));const P=new Set([...R.values()].map(s=>s.currentKey));for(const s of y){const u=L(s,l),d=h(g,u);if(P.has(d))continue;const c={currentKey:d,unsub:void 0};F.add(d);const j=r.subscribe(o,u,M=>{if(p.set(c.currentKey,M),F.delete(c.currentKey),b.set(void 0),S(),F.size===0){const v=e(),k=T(v,C());k&&(W(v,k),e.set(k),I(k),S())}},{onError:M=>{F.delete(d),b.set(M);const v=e(),k=v.at(-1);v.length>1&&k&&!p.has(d)&&h(g,L(k,l))===d&&(e.set(v.slice(0,-1)),I(e())),S(),n.onError?.(M)},shardKey:w});c.unsub=j,R.set(d,c),P.add(d)}};let N=!1,O=!1;const I=y=>{if(N){O=!0;return}N=!0;try{let f=y;do O=!1,G(f),f=e();while(O)}finally{N=!1}};t!=="skip"&&E(K)&&I(e()),S();const Q=()=>{for(const y of R.values())y.unsub();R.clear(),p.clear()};return i===void 0?(n.destroyRef??q(z)).onDestroy(Q):i(Q),{error:b,loadMore:y=>{if(t==="skip")return;const{nextCursor:f,status:P}=_(!1,C());if(P!=="CanLoadMore")return;const s=J(e(),f,y);if(!s)return;const u=e().at(-1),d=s.at(-2);if(u&&d){const c=h(g,L(u,l)),j=h(g,L(d,l)),M=R.get(c);if(M&&c!==j){const v=p.get(c);v&&p.set(j,v),M.unsub(),R.delete(c),p.delete(c)}}b.set(void 0),e.set(s),I(e()),S()},pageResults:C,skipped:m(()=>t==="skip"),status:D}},V=(o,t,n)=>{if(typeof t!="function")return $(o,t,n);const i=B(n.client),r=n.destroyRef===void 0,K=n.destroyRef??q(z),a=x(void 0);return E(r)&&X(t,{destroyRef:K,injector:n.injector},(w,g)=>{const l=[];a.set($(o,w,{...n,client:i},e=>l.push(e))),g(()=>{for(const e of l)e()})}),{error:m(()=>a()?.error()),loadMore:w=>{a()?.loadMore(w)},pageResults:m(()=>a()?.pageResults()??[]),skipped:m(()=>a()?.skipped()??t()==="skip"),status:m(()=>a()?.status()??"LoadingFirstPage")}},ne=(o,t,n)=>{const i=V(o,t,n),r=m(()=>i.pageResults().flatMap(a=>a?.page??[])),K=m(()=>{const a=i.status();return!i.skipped()&&(a==="LoadingFirstPage"||a==="LoadingMore")});return{error:i.error,isLoading:K,loadMore:i.loadMore,results:r,status:i.status}},oe=(o,t,n)=>{const{initialNumItems:i}=n,r=V(o,t,n),K=m(()=>r.pageResults().flatMap(e=>e?[e.page]:[])),a=m(()=>!r.skipped()&&r.status()==="LoadingFirstPage"),w=m(()=>r.status()==="CanLoadMore"),g=m(()=>!r.skipped()&&r.status()==="LoadingMore"),l=e=>{r.loadMore(e??i)};return{error:r.error,fetchNextPage:l,hasNextPage:w,isFetchingNextPage:g,isLoading:a,pages:K,status:r.status}};export{oe as infiniteQuery,ne as paginatedQuery};