@lunora/solid 1.0.0-alpha.70 → 1.0.0-alpha.71
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.d.mts +16 -11
- package/dist/index.d.ts +16 -11
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/createFlag-CkY9V_ou.mjs +1 -0
- package/dist/packem_shared/createInfiniteQuery-DLpKN_aQ.mjs +1 -0
- package/package.json +4 -4
- package/dist/packem_shared/createFlag-DB3YHQrF.mjs +0 -1
- package/dist/packem_shared/createInfiniteQuery-Chl4xGx9.mjs +0 -1
- package/dist/packem_shared/stable-key-B_BlboiY.mjs +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -542,8 +542,6 @@ declare const Unauthenticated: AuthGate;
|
|
|
542
542
|
* reactive root.
|
|
543
543
|
*/
|
|
544
544
|
declare const createConnectionStatus: () => Accessor<ConnectionStatus>;
|
|
545
|
-
/** A targeting context merged on top of the app's default (`defineFlags({ identify })`). */
|
|
546
|
-
type FlagContext = Record<string, unknown>;
|
|
547
545
|
/** The value kinds a flag resolves to — OpenFeature's boolean / number / string / structured (JSON) flags. */
|
|
548
546
|
type FlagValue = boolean | number | string | {
|
|
549
547
|
[key: string]: unknown;
|
|
@@ -557,26 +555,33 @@ type FlagValue = boolean | number | string | {
|
|
|
557
555
|
* `defaultValue`'s runtime type, so `createFlag("dark", false)` reads a boolean
|
|
558
556
|
* and `createFlag("hero", "control")` a string.
|
|
559
557
|
*
|
|
560
|
-
* `key`
|
|
561
|
-
*
|
|
562
|
-
*
|
|
563
|
-
*
|
|
558
|
+
* `key` may be a plain value or an accessor; passing an accessor makes the
|
|
559
|
+
* subscription reactive — when it changes the old subscription is torn down (via
|
|
560
|
+
* `onCleanup`) and a fresh one opens.
|
|
561
|
+
*
|
|
562
|
+
* The reactive channel is public, so the server evaluates every flag under the
|
|
563
|
+
* socket's own verified identity — the targeting key your `defineFlags({
|
|
564
|
+
* identify })` derives — and accepts no client-supplied targeting context. For
|
|
565
|
+
* evaluation under a context you compute, call `ctx.flags.*` inside a query,
|
|
566
|
+
* mutation, or action and return the resolved value.
|
|
564
567
|
*
|
|
565
568
|
* Evaluation runs through whatever OpenFeature provider the app wired in
|
|
566
569
|
* `lunora/flags.ts`; the read never throws — a provider error resolves the
|
|
567
570
|
* default (the same fail-open contract as server-side `ctx.flags`).
|
|
568
571
|
*/
|
|
569
|
-
declare const createFlag: <T extends FlagValue>(key: MaybeAccessor<string>, defaultValue: T
|
|
572
|
+
declare const createFlag: <T extends FlagValue>(key: MaybeAccessor<string>, defaultValue: T) => Accessor<T>;
|
|
570
573
|
/**
|
|
571
574
|
* Subscribe to several feature flags at once and return a reactive accessor of
|
|
572
575
|
* the resolved record.
|
|
573
576
|
*
|
|
574
577
|
* Pass a record of `key → defaultValue`; each flag's kind is inferred from its
|
|
575
578
|
* default, and the accessor reads the same-shaped record with resolved values
|
|
576
|
-
* (the defaults until each evaluation lands).
|
|
577
|
-
*
|
|
579
|
+
* (the defaults until each evaluation lands). This is the batched form of
|
|
580
|
+
* {@link createFlag}, and evaluates under the socket's server-verified identity
|
|
581
|
+
* only. The flag set is fixed for the primitive's lifetime, so nothing here is
|
|
582
|
+
* reactive — the subscriptions open on mount and tear down on cleanup.
|
|
578
583
|
*/
|
|
579
|
-
declare const createFlags: <T extends Record<string, FlagValue>>(flags: T
|
|
584
|
+
declare const createFlags: <T extends Record<string, FlagValue>>(flags: T) => Accessor<T>;
|
|
580
585
|
interface MutationHandle<F extends FunctionReference> {
|
|
581
586
|
/** The latest invocation's resolved value, or `undefined` before the first success. */
|
|
582
587
|
data: Accessor<ReturnOf<F> | undefined>;
|
|
@@ -1077,7 +1082,7 @@ interface LunoraProviderProps {
|
|
|
1077
1082
|
* descendants exactly as the JSX form did.
|
|
1078
1083
|
*/
|
|
1079
1084
|
declare const LunoraProvider: (props: LunoraProviderProps) => SolidElement;
|
|
1080
|
-
export { type ActionClient, type ActionHandle, type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, Authenticated, type CreateAgentApi, type CreateAgentChatApi, type CreateAgentChatOptions, type CreateAgentChatResult, type CreateAgentOptions, type CreateAgentResult, type CreateAgentStateApi, type CreateAgentStateOptions, type CreateAgentStateResult, type CreateAgentToolEventsApi, type CreateAgentToolEventsOptions, type CreateAgentToolEventsResult, type CreateInfiniteQueryOptions, type CreateInfiniteQueryResult, type CreatePaginatedQueryOptions, type CreatePaginatedQueryResult, type CreatePresenceOptions, type CreatePresenceResult, type CreateQueryOptions, type CreateRateLimitOptions, type CreateRateLimitResult, type CreateStreamOptions, type CreateStreamResult, type CreateStreamStatus, type CreateSubscriptionResult, type CreateVoiceAgentOptions, type CreateVoiceAgentResult, type
|
|
1085
|
+
export { type ActionClient, type ActionHandle, type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, Authenticated, type CreateAgentApi, type CreateAgentChatApi, type CreateAgentChatOptions, type CreateAgentChatResult, type CreateAgentOptions, type CreateAgentResult, type CreateAgentStateApi, type CreateAgentStateOptions, type CreateAgentStateResult, type CreateAgentToolEventsApi, type CreateAgentToolEventsOptions, type CreateAgentToolEventsResult, type CreateInfiniteQueryOptions, type CreateInfiniteQueryResult, type CreatePaginatedQueryOptions, type CreatePaginatedQueryResult, type CreatePresenceOptions, type CreatePresenceResult, type CreateQueryOptions, type CreateRateLimitOptions, type CreateRateLimitResult, type CreateStreamOptions, type CreateStreamResult, type CreateStreamStatus, type CreateSubscriptionResult, type CreateVoiceAgentOptions, type CreateVoiceAgentResult, type FlagValue, type HeartbeatReference, type ListPresentReference, LunoraContext, LunoraProvider,
|
|
1081
1086
|
/**
|
|
1082
1087
|
* SolidJS adapter for Lunora.
|
|
1083
1088
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -542,8 +542,6 @@ declare const Unauthenticated: AuthGate;
|
|
|
542
542
|
* reactive root.
|
|
543
543
|
*/
|
|
544
544
|
declare const createConnectionStatus: () => Accessor<ConnectionStatus>;
|
|
545
|
-
/** A targeting context merged on top of the app's default (`defineFlags({ identify })`). */
|
|
546
|
-
type FlagContext = Record<string, unknown>;
|
|
547
545
|
/** The value kinds a flag resolves to — OpenFeature's boolean / number / string / structured (JSON) flags. */
|
|
548
546
|
type FlagValue = boolean | number | string | {
|
|
549
547
|
[key: string]: unknown;
|
|
@@ -557,26 +555,33 @@ type FlagValue = boolean | number | string | {
|
|
|
557
555
|
* `defaultValue`'s runtime type, so `createFlag("dark", false)` reads a boolean
|
|
558
556
|
* and `createFlag("hero", "control")` a string.
|
|
559
557
|
*
|
|
560
|
-
* `key`
|
|
561
|
-
*
|
|
562
|
-
*
|
|
563
|
-
*
|
|
558
|
+
* `key` may be a plain value or an accessor; passing an accessor makes the
|
|
559
|
+
* subscription reactive — when it changes the old subscription is torn down (via
|
|
560
|
+
* `onCleanup`) and a fresh one opens.
|
|
561
|
+
*
|
|
562
|
+
* The reactive channel is public, so the server evaluates every flag under the
|
|
563
|
+
* socket's own verified identity — the targeting key your `defineFlags({
|
|
564
|
+
* identify })` derives — and accepts no client-supplied targeting context. For
|
|
565
|
+
* evaluation under a context you compute, call `ctx.flags.*` inside a query,
|
|
566
|
+
* mutation, or action and return the resolved value.
|
|
564
567
|
*
|
|
565
568
|
* Evaluation runs through whatever OpenFeature provider the app wired in
|
|
566
569
|
* `lunora/flags.ts`; the read never throws — a provider error resolves the
|
|
567
570
|
* default (the same fail-open contract as server-side `ctx.flags`).
|
|
568
571
|
*/
|
|
569
|
-
declare const createFlag: <T extends FlagValue>(key: MaybeAccessor<string>, defaultValue: T
|
|
572
|
+
declare const createFlag: <T extends FlagValue>(key: MaybeAccessor<string>, defaultValue: T) => Accessor<T>;
|
|
570
573
|
/**
|
|
571
574
|
* Subscribe to several feature flags at once and return a reactive accessor of
|
|
572
575
|
* the resolved record.
|
|
573
576
|
*
|
|
574
577
|
* Pass a record of `key → defaultValue`; each flag's kind is inferred from its
|
|
575
578
|
* default, and the accessor reads the same-shaped record with resolved values
|
|
576
|
-
* (the defaults until each evaluation lands).
|
|
577
|
-
*
|
|
579
|
+
* (the defaults until each evaluation lands). This is the batched form of
|
|
580
|
+
* {@link createFlag}, and evaluates under the socket's server-verified identity
|
|
581
|
+
* only. The flag set is fixed for the primitive's lifetime, so nothing here is
|
|
582
|
+
* reactive — the subscriptions open on mount and tear down on cleanup.
|
|
578
583
|
*/
|
|
579
|
-
declare const createFlags: <T extends Record<string, FlagValue>>(flags: T
|
|
584
|
+
declare const createFlags: <T extends Record<string, FlagValue>>(flags: T) => Accessor<T>;
|
|
580
585
|
interface MutationHandle<F extends FunctionReference> {
|
|
581
586
|
/** The latest invocation's resolved value, or `undefined` before the first success. */
|
|
582
587
|
data: Accessor<ReturnOf<F> | undefined>;
|
|
@@ -1077,7 +1082,7 @@ interface LunoraProviderProps {
|
|
|
1077
1082
|
* descendants exactly as the JSX form did.
|
|
1078
1083
|
*/
|
|
1079
1084
|
declare const LunoraProvider: (props: LunoraProviderProps) => SolidElement;
|
|
1080
|
-
export { type ActionClient, type ActionHandle, type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, Authenticated, type CreateAgentApi, type CreateAgentChatApi, type CreateAgentChatOptions, type CreateAgentChatResult, type CreateAgentOptions, type CreateAgentResult, type CreateAgentStateApi, type CreateAgentStateOptions, type CreateAgentStateResult, type CreateAgentToolEventsApi, type CreateAgentToolEventsOptions, type CreateAgentToolEventsResult, type CreateInfiniteQueryOptions, type CreateInfiniteQueryResult, type CreatePaginatedQueryOptions, type CreatePaginatedQueryResult, type CreatePresenceOptions, type CreatePresenceResult, type CreateQueryOptions, type CreateRateLimitOptions, type CreateRateLimitResult, type CreateStreamOptions, type CreateStreamResult, type CreateStreamStatus, type CreateSubscriptionResult, type CreateVoiceAgentOptions, type CreateVoiceAgentResult, type
|
|
1085
|
+
export { type ActionClient, type ActionHandle, type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, Authenticated, type CreateAgentApi, type CreateAgentChatApi, type CreateAgentChatOptions, type CreateAgentChatResult, type CreateAgentOptions, type CreateAgentResult, type CreateAgentStateApi, type CreateAgentStateOptions, type CreateAgentStateResult, type CreateAgentToolEventsApi, type CreateAgentToolEventsOptions, type CreateAgentToolEventsResult, type CreateInfiniteQueryOptions, type CreateInfiniteQueryResult, type CreatePaginatedQueryOptions, type CreatePaginatedQueryResult, type CreatePresenceOptions, type CreatePresenceResult, type CreateQueryOptions, type CreateRateLimitOptions, type CreateRateLimitResult, type CreateStreamOptions, type CreateStreamResult, type CreateStreamStatus, type CreateSubscriptionResult, type CreateVoiceAgentOptions, type CreateVoiceAgentResult, type FlagValue, type HeartbeatReference, type ListPresentReference, LunoraContext, LunoraProvider,
|
|
1081
1086
|
/**
|
|
1082
1087
|
* SolidJS adapter for Lunora.
|
|
1083
1088
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LunoraContext as r,useLunora as o}from"./packem_shared/LunoraContext-dPcjtn6R.mjs";import{createAction as c,createActionForClient as n}from"./packem_shared/createAction-M4s8XBXV.mjs";import{createAgent as m}from"./packem_shared/createAgent-DTUKko5X.mjs";import{createAgentChat as x}from"./packem_shared/createAgentChat-Bo021xHU.mjs";import{createAgentState as u}from"./packem_shared/createAgentState-DIknFZyn.mjs";import{createAgentToolEvents as A}from"./packem_shared/createAgentToolEvents-BZDqkzK6.mjs";import{AuthLoading as l,Authenticated as s,Unauthenticated as h,createAuth as C}from"./packem_shared/AuthLoading-6vueEnV0.mjs";import{default as y}from"./packem_shared/createConnectionStatus-BnlXYWeE.mjs";import{createFlag as P,createFlags as S}from"./packem_shared/createFlag-
|
|
1
|
+
import{LunoraContext as r,useLunora as o}from"./packem_shared/LunoraContext-dPcjtn6R.mjs";import{createAction as c,createActionForClient as n}from"./packem_shared/createAction-M4s8XBXV.mjs";import{createAgent as m}from"./packem_shared/createAgent-DTUKko5X.mjs";import{createAgentChat as x}from"./packem_shared/createAgentChat-Bo021xHU.mjs";import{createAgentState as u}from"./packem_shared/createAgentState-DIknFZyn.mjs";import{createAgentToolEvents as A}from"./packem_shared/createAgentToolEvents-BZDqkzK6.mjs";import{AuthLoading as l,Authenticated as s,Unauthenticated as h,createAuth as C}from"./packem_shared/AuthLoading-6vueEnV0.mjs";import{default as y}from"./packem_shared/createConnectionStatus-BnlXYWeE.mjs";import{createFlag as P,createFlags as S}from"./packem_shared/createFlag-CkY9V_ou.mjs";import{createMutation as Q,createMutationForClient as v}from"./packem_shared/createMutation-DcSsIbGF.mjs";import{createMutator as E}from"./packem_shared/createMutator-q9cMjGKv.mjs";import{createInfiniteQuery as R,createPaginatedQuery as T}from"./packem_shared/createInfiniteQuery-DLpKN_aQ.mjs";import{createPresence as V}from"./packem_shared/createPresence-Da_DdL7L.mjs";import{createQuery as k}from"./packem_shared/createQuery-DMcnUyOD.mjs";import{createRateLimit as w}from"./packem_shared/createRateLimit-CIVWrD5H.mjs";import{createStream as B}from"./packem_shared/createStream-B10b3ijV.mjs";import{createSubscription as G}from"./packem_shared/createSubscription-D9e8lT1C.mjs";import{createVoiceAgent as J}from"./packem_shared/createVoiceAgent-BjL6DH05.mjs";import{default as N}from"./packem_shared/hydratePreloaded-CnJNitir.mjs";import{LunoraProvider as W}from"./packem_shared/LunoraProvider-BKWckcDR.mjs";export{l as AuthLoading,s as Authenticated,r as LunoraContext,W as LunoraProvider,h as Unauthenticated,c as createAction,n as createActionForClient,m as createAgent,x as createAgentChat,u as createAgentState,A as createAgentToolEvents,C as createAuth,y as createConnectionStatus,P as createFlag,S as createFlags,R as createInfiniteQuery,Q as createMutation,v as createMutationForClient,E as createMutator,T as createPaginatedQuery,V as createPresence,k as createQuery,w as createRateLimit,B as createStream,G as createSubscription,J as createVoiceAgent,N as hydratePreloaded,o as useLunora};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createSignal as u}from"solid-js";import{useLunora as a}from"./LunoraContext-dPcjtn6R.mjs";import{resolveMaybe as b}from"./createAgent-DTUKko5X.mjs";import{t as d,o as m}from"./solid-compat-ByG5HD_F.mjs";const _="__lunora_flags__:eval",p=t=>{const e=typeof t;return e==="boolean"||e==="number"||e==="string"?e:"object"},y={__lunoraRef:_},f=(t,e,r)=>{try{return t.subscribe(y,{default:e.default,key:e.key,type:p(e.default)},o=>{r(o)},{onError:()=>{r(e.default)}})}catch{return()=>{}}},A=(t,e)=>{const r=a(),[o,s]=u(e);return d(()=>b(t),n=>(s(()=>e),f(r,{default:e,key:n},c=>{s(()=>c)}))),o},E=t=>{const e=a(),[r,o]=u(t);return m(()=>{const s=[];for(const[n,c]of Object.entries(t))s.push(f(e,{default:c,key:n},l=>{o(i=>({...i,[n]:l}))}));return()=>{for(const n of s)n()}}),r};export{A as createFlag,E as createFlags};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{initialPages as C,derivePaginationStatus as $,applyLoadMore as G,rebalance as H}from"@lunora/client/pagination";import{createMemo as S,createSignal as B}from"solid-js";import{useLunora as V}from"./LunoraContext-dPcjtn6R.mjs";import{t as D}from"./solid-compat-ByG5HD_F.mjs";const X=/["\\\u0000-\u001F\uD800-\uDFFF]/,U=e=>X.test(e)?JSON.stringify(e):`"${e}"`,F=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(typeof e=="number"){if(Number.isNaN(e))return"nan";if(e===1/0)return"inf";if(e===-1/0)return"-inf";if(Object.is(e,-0))return"-0"}if(typeof e=="string")return U(e);if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e)){let n="[";for(let s=0;s<e.length;s++)s>0&&(n+=","),n+=F(e[s]);return n+"]"}const r=Object.getPrototypeOf(e);if(r!==null&&r!==Object.prototype){const n=e.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${n} in a stable JSON cache key — only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}const l=e,u=Object.keys(l).sort();let a="{",t=!0;for(const n of u){const s=l[n];s!==void 0&&(t?t=!1:a+=",",a+=U(n),a+=":",a+=F(s))}return a+"}"},x=e=>{let r="";for(let u=0;u<e.length;u+=32768)r+=String.fromCharCode(...e.subarray(u,u+32768));return btoa(r)},y="$lunora.wire$",J=64,Y="__proto__",Z=e=>{if(e===null||typeof e!="object")return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype},k=(e,r=0)=>{if(r>J)throw new RangeError(`wire-codec: value nesting exceeds the ${J}-level limit`);if(e===void 0)return[y,"undefined"];if(e===null)return null;const l=typeof e;if(l==="bigint")return[y,"bigint",e.toString()];if(l==="number"){const t=e;return Number.isNaN(t)?[y,"nan"]:t===1/0?[y,"inf"]:t===-1/0?[y,"-inf"]:t}if(l!=="object")return e;if(e instanceof Date)return[y,"date",k(e.getTime(),r+1)];if(e instanceof Error){const t=e,n={};for(const d of Object.keys(t))t[d]!==void 0&&(n[d]=k(t[d],r+1));const s=[y,"error",t.name,t.message,n];return t.cause!==void 0&&s.push(k(t.cause,r+1)),s}if(e instanceof URL)return[y,"url",e.href];if(e instanceof Map)return[y,"map",[...e.entries()].map(([t,n])=>[k(t,r+1),k(n,r+1)])];if(e instanceof Set)return[y,"set",[...e].map(t=>k(t,r+1))];if(e instanceof ArrayBuffer)return[y,"bytes",x(new Uint8Array(e)),"ArrayBuffer"];if(ArrayBuffer.isView(e)){const t=e,n=t.constructor.name,s=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);return n==="Uint8Array"?[y,"bytes",x(s)]:[y,"bytes",x(s),n]}if(Array.isArray(e)){const t=e.map(n=>k(n,r+1));return t.length>0&&t[0]===y?[y,"arr",t]:t}if(!Z(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 u=e,a={};for(const t of Object.keys(u)){const n=u[t];if(n===void 0)continue;const s=k(n,r+1);t===Y?Object.defineProperty(a,t,{configurable:!0,enumerable:!0,value:s,writable:!0}):a[t]=s}return a},v=e=>F(k(e)),N=(e,r)=>({...r,paginationOpts:{cursor:e.lower,endCursor:e.upper,numItems:e.numItems}}),O=(e,r)=>`${e}::${v(r)}`,W=(e,r,l)=>{const u=V(),{initialNumItems:a,shardKey:t}=l,n=()=>typeof r=="function"?r():r,[s,d]=B(C(a)),g=new Map,[h,j]=B([]),p=new Map,M=new Set,E=(o,f)=>{const b=o.map(i=>{const c=O(e.__lunoraRef,N(i,f));return g.get(c)});j(b)},q=(o,f,b)=>{const i=c=>O(e.__lunoraRef,N(c,b));for(const c of f){const m=i(c);if(g.has(m))continue;const P=o.find(w=>w.lower===c.lower);if(P){const w=g.get(i(P));w&&g.set(m,w)}}},Q=(o,f)=>{const b=new Set;for(const i of o)b.add(O(e.__lunoraRef,N(i,f)));for(const[i,c]of p)b.has(i)||(c(),p.delete(i),M.delete(i),g.delete(i));for(const i of o){const c=N(i,f),m=O(e.__lunoraRef,c);if(p.has(m))continue;M.add(m);const P=u.subscribe(e,c,w=>{g.set(m,w),M.delete(m);const A=n();if(A!=="skip"&&(E(s(),A),M.size===0)){const R=s(),K=H(R,h());K&&(q(R,K,A),d(K))}},{shardKey:t});p.set(m,P)}};let L=!1,_=!1;const I=(o,f)=>{if(L){_=!0;return}L=!0;try{let b=o,i=f;do{_=!1,Q(b,i);const c=n();if(c==="skip")break;b=s(),i=c}while(_)}finally{L=!1}},T=()=>{for(const o of p.values())o();p.clear(),g.clear(),M.clear()};D(n,o=>(T(),d(C(a)),j([]),o!=="skip"&&(I(s(),o),E(s(),o)),T)),D(s,o=>{const f=n();f!=="skip"&&(I(o,f),E(o,f))});const z=S(()=>{const o=n()==="skip";return $(o,h()).status});return{loadMore:o=>{const f=n();if(f==="skip")return;const{nextCursor:b,status:i}=$(!1,h());if(i!=="CanLoadMore")return;const c=G(s(),b,o);if(!c)return;const m=s().at(-1),P=c.at(-2);if(m&&P){const w=O(e.__lunoraRef,N(m,f)),A=O(e.__lunoraRef,N(P,f));if(w!==A){const R=g.get(w);R&&g.set(A,R)}}d(c)},pageResults:h,status:z}},oe=(e,r,l)=>{const{loadMore:u,pageResults:a,status:t}=W(e,r,l),n=S(()=>a().flatMap(d=>d?.page??[]));return{isLoading:S(()=>t()==="LoadingFirstPage"||t()==="LoadingMore"),loadMore:u,results:n,status:t}},ie=(e,r,l)=>{const{initialNumItems:u}=l,{loadMore:a,pageResults:t,status:n}=W(e,r,l),s=S(()=>t().flatMap(p=>p?[p.page]:[])),d=S(()=>n()==="LoadingFirstPage"),g=S(()=>n()==="CanLoadMore"),h=S(()=>n()==="LoadingMore");return{fetchNextPage:p=>{a(p??u)},hasNextPage:g,isFetchingNextPage:h,isLoading:d,pages:s,status:n}};export{ie as createInfiniteQuery,oe as createPaginatedQuery};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/solid",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.71",
|
|
4
4
|
"description": "SolidJS adapter for Lunora — live queries, optimistic mutations, and reactive loaders",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@lunora/client": "1.0.0-alpha.
|
|
58
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
59
|
-
"@lunora/ratelimit": "1.0.0-alpha.
|
|
57
|
+
"@lunora/client": "1.0.0-alpha.68",
|
|
58
|
+
"@lunora/errors": "1.0.0-alpha.27",
|
|
59
|
+
"@lunora/ratelimit": "1.0.0-alpha.32",
|
|
60
60
|
"@visulima/storage-client": "1.0.2"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createSignal as f}from"solid-js";import{s as l}from"./stable-key-B_BlboiY.mjs";import{useLunora as b}from"./LunoraContext-dPcjtn6R.mjs";import{resolveMaybe as o}from"./createAgent-DTUKko5X.mjs";import{t as m}from"./solid-compat-ByG5HD_F.mjs";const v="__lunora_flags__:eval",x=e=>{const t=typeof e;return t==="boolean"||t==="number"||t==="string"?t:"object"},F={__lunoraRef:v},p=(e,t,r)=>{try{return e.subscribe(F,{context:t.context,default:t.default,key:t.key,type:x(t.default)},c=>{r(c)},{onError:()=>{r(t.default)}})}catch{return()=>{}}},d=e=>e===void 0?"":l(e),S=(e,t,r)=>{const c=b(),[s,u]=f(t);return m(()=>`${o(e)} ${d(o(r))}`,()=>{const i=o(e),a=o(r);return u(()=>t),p(c,{context:a,default:t,key:i},n=>{u(()=>n)})}),s},g=(e,t)=>{const r=b(),[c,s]=f(e),u=l(e);return m(()=>`${u} ${d(o(t))}`,()=>{const i=o(t);s(()=>e);const a=[];for(const[n,y]of Object.entries(e))a.push(p(r,{context:i,default:y,key:n},_=>{s(k=>({...k,[n]:_}))}));return()=>{for(const n of a)n()}}),c};export{S as createFlag,g as createFlags};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{initialPages as T,derivePaginationStatus as B,applyLoadMore as z,rebalance as G}from"@lunora/client/pagination";import{createMemo as A,createSignal as U}from"solid-js";import{s as H}from"./stable-key-B_BlboiY.mjs";import{useLunora as V}from"./LunoraContext-dPcjtn6R.mjs";import{t as $}from"./solid-compat-ByG5HD_F.mjs";const E=e=>{let n="";for(let u=0;u<e.length;u+=32768)n+=String.fromCharCode(...e.subarray(u,u+32768));return btoa(n)},f="$lunora.wire$",F=64,X="__proto__",Y=e=>{if(e===null||typeof e!="object")return!1;const n=Object.getPrototypeOf(e);return n===null||n===Object.prototype},P=(e,n=0)=>{if(n>F)throw new RangeError(`wire-codec: value nesting exceeds the ${F}-level limit`);if(e===void 0)return[f,"undefined"];if(e===null)return null;const l=typeof e;if(l==="bigint")return[f,"bigint",e.toString()];if(l==="number"){const t=e;return Number.isNaN(t)?[f,"nan"]:t===1/0?[f,"inf"]:t===-1/0?[f,"-inf"]:t}if(l!=="object")return e;if(e instanceof Date)return[f,"date",P(e.getTime(),n+1)];if(e instanceof Error){const t=e,r={};for(const d of Object.keys(t))t[d]!==void 0&&(r[d]=P(t[d],n+1));const o=[f,"error",t.name,t.message,r];return t.cause!==void 0&&o.push(P(t.cause,n+1)),o}if(e instanceof URL)return[f,"url",e.href];if(e instanceof Map)return[f,"map",[...e.entries()].map(([t,r])=>[P(t,n+1),P(r,n+1)])];if(e instanceof Set)return[f,"set",[...e].map(t=>P(t,n+1))];if(e instanceof ArrayBuffer)return[f,"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"?[f,"bytes",E(o)]:[f,"bytes",E(o),r]}if(Array.isArray(e)){const t=e.map(r=>P(r,n+1));return t.length>0&&t[0]===f?[f,"arr",t]:t}if(!Y(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 u=e,m={};for(const t of Object.keys(u)){const r=u[t];if(r===void 0)continue;const o=P(r,n+1);t===X?Object.defineProperty(m,t,{configurable:!0,enumerable:!0,value:o,writable:!0}):m[t]=o}return m},J=e=>H(P(e)),h=(e,n)=>({...n,paginationOpts:{cursor:e.lower,endCursor:e.upper,numItems:e.numItems}}),L=(e,n)=>`${e}::${J(n)}`,D=(e,n,l)=>{const u=V(),{initialNumItems:m,shardKey:t}=l,r=()=>typeof n=="function"?n():n,[o,d]=U(T(m)),g=new Map,[M,N]=U([]),y=new Map,S=new Set,x=(s,c)=>{const p=s.map(i=>{const a=L(e.__lunoraRef,h(i,c));return g.get(a)});N(p)},Q=(s,c,p)=>{const i=a=>L(e.__lunoraRef,h(a,p));for(const a of c){const b=i(a);if(g.has(b))continue;const k=s.find(w=>w.lower===a.lower);if(k){const w=g.get(i(k));w&&g.set(b,w)}}},W=(s,c)=>{const p=new Set;for(const i of s)p.add(L(e.__lunoraRef,h(i,c)));for(const[i,a]of y)p.has(i)||(a(),y.delete(i),S.delete(i),g.delete(i));for(const i of s){const a=h(i,c),b=L(e.__lunoraRef,a);if(y.has(b))continue;S.add(b);const k=u.subscribe(e,a,w=>{g.set(b,w),S.delete(b);const R=r();if(R!=="skip"&&(x(o(),R),S.size===0)){const _=o(),j=G(_,M());j&&(Q(_,j,R),d(j))}},{shardKey:t});y.set(b,k)}};let K=!1,O=!1;const C=(s,c)=>{if(K){O=!0;return}K=!0;try{let p=s,i=c;do{O=!1,W(p,i);const a=r();if(a==="skip")break;p=o(),i=a}while(O)}finally{K=!1}},I=()=>{for(const s of y.values())s();y.clear(),g.clear(),S.clear()};$(r,s=>(I(),d(T(m)),N([]),s!=="skip"&&(C(o(),s),x(o(),s)),I)),$(o,s=>{const c=r();c!=="skip"&&(C(s,c),x(s,c))});const q=A(()=>{const s=r()==="skip";return B(s,M()).status});return{loadMore:s=>{const c=r();if(c==="skip")return;const{nextCursor:p,status:i}=B(!1,M());if(i!=="CanLoadMore")return;const a=z(o(),p,s);if(!a)return;const b=o().at(-1),k=a.at(-2);if(b&&k){const w=L(e.__lunoraRef,h(b,c)),R=L(e.__lunoraRef,h(k,c));if(w!==R){const _=g.get(w);_&&g.set(R,_)}}d(a)},pageResults:M,status:q}},se=(e,n,l)=>{const{loadMore:u,pageResults:m,status:t}=D(e,n,l),r=A(()=>m().flatMap(d=>d?.page??[]));return{isLoading:A(()=>t()==="LoadingFirstPage"||t()==="LoadingMore"),loadMore:u,results:r,status:t}},oe=(e,n,l)=>{const{initialNumItems:u}=l,{loadMore:m,pageResults:t,status:r}=D(e,n,l),o=A(()=>t().flatMap(y=>y?[y.page]:[])),d=A(()=>r()==="LoadingFirstPage"),g=A(()=>r()==="CanLoadMore"),M=A(()=>r()==="LoadingMore");return{fetchNextPage:y=>{m(y??u)},hasNextPage:g,isFetchingNextPage:M,isLoading:d,pages:o,status:r}};export{oe as createInfiniteQuery,se as createPaginatedQuery};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const a=/["\\\u0000-\u001F\uD800-\uDFFF]/,f=t=>a.test(t)?JSON.stringify(t):`"${t}"`,y=t=>{if(t===void 0)return"null";if(typeof t=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key — pass it as a string, or use stableWireKey");if(typeof t=="number"){if(Number.isNaN(t))return"nan";if(t===1/0)return"inf";if(t===-1/0)return"-inf";if(Object.is(t,-0))return"-0"}if(typeof t=="string")return f(t);if(t===null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t)){let r="[";for(let n=0;n<t.length;n++)n>0&&(r+=","),r+=y(t[n]);return r+"]"}const i=Object.getPrototypeOf(t);if(i!==null&&i!==Object.prototype){const r=t.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${r} in a stable JSON cache key — only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}const o=t,c=Object.keys(o).sort();let e="{",s=!0;for(const r of c){const n=o[r];n!==void 0&&(s?s=!1:e+=",",e+=f(r),e+=":",e+=y(n))}return e+"}"};export{y as s};
|