@lunora/solid 1.0.0-alpha.40 → 1.0.0-alpha.41

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 CHANGED
@@ -7,14 +7,14 @@ import { RateLimitStatus, RateLimitConfig } from '@lunora/ratelimit';
7
7
  * Solid context carrying the framework-neutral {@link LunoraClient}. Every
8
8
  * reactive primitive in this adapter (`createQuery`, `createMutation`,
9
9
  * `hydratePreloaded`) reads the client from here, so a single
10
- * `<LunoraProvider client={…}>` at the root of the tree wires the whole app.
10
+ * `<LunoraProvider client={…}>` at the root of the tree wires the whole app.
11
11
  *
12
12
  * Defaults to `undefined` so {@link useLunora} can throw a helpful error when a
13
13
  * primitive is used outside a provider rather than dereferencing it.
14
14
  */
15
15
  declare const LunoraContext: Context<LunoraClient | undefined>;
16
16
  /**
17
- * Read the {@link LunoraClient} from the nearest `&lt;LunoraProvider>`.
17
+ * Read the {@link LunoraClient} from the nearest `<LunoraProvider>`.
18
18
  *
19
19
  * Throws when called outside a provider — the client is required to open the
20
20
  * HTTP/WS transport, so there is no sensible fallback. The React adapter's
@@ -68,14 +68,14 @@ interface CreateAgentOptions {
68
68
  api: CreateAgentApi;
69
69
  /**
70
70
  * Optional app mutation over the agent's cancel path
71
- * (`ctx.agents.&lt;name>.cancel(id)`). Called with `{ instanceId, threadKey }`.
71
+ * (`ctx.agents.<name>.cancel(id)`). Called with `{ instanceId, threadKey }`.
72
72
  * When omitted (or no run is in flight) {@link CreateAgentResult.cancel} is a
73
73
  * no-op.
74
74
  */
75
75
  cancel?: FunctionReference<"mutation">;
76
76
  /**
77
77
  * The app mutation that starts (or continues) a run — a thin wrapper over
78
- * `ctx.agents.&lt;name>.run(...)`. Called with `{ threadKey, input }` merged with
78
+ * `ctx.agents.<name>.run(...)`. Called with `{ threadKey, input }` merged with
79
79
  * {@link CreateAgentOptions.runArgs} and the per-call args.
80
80
  */
81
81
  run: FunctionReference<"mutation">;
@@ -108,7 +108,7 @@ interface CreateAgentResult {
108
108
  * `createAgentChat`.
109
109
  *
110
110
  * `run` and `cancel` stay generic over the app-defined mutations that wrap
111
- * `ctx.agents.&lt;name>.run` / `.cancel`, so the primitive hard-codes no function
111
+ * `ctx.agents.<name>.run` / `.cancel`, so the primitive hard-codes no function
112
112
  * names beyond the `agents:*` surface. `threadKey` may be an accessor — a changing
113
113
  * key re-subscribes to the new thread.
114
114
  */
@@ -222,7 +222,7 @@ interface CreateAgentChatOptions {
222
222
  api: CreateAgentChatApi;
223
223
  /**
224
224
  * Optional app mutation over the agent's cancel path
225
- * (`ctx.agents.&lt;name>.cancel(id)`). Called with `{ instanceId, threadKey }`.
225
+ * (`ctx.agents.<name>.cancel(id)`). Called with `{ instanceId, threadKey }`.
226
226
  * When omitted (or no run is in flight) {@link CreateAgentChatResult.cancel} is
227
227
  * a no-op.
228
228
  */
@@ -231,7 +231,7 @@ interface CreateAgentChatOptions {
231
231
  limit?: number;
232
232
  /**
233
233
  * The app mutation that starts (or continues) a run — a thin wrapper over
234
- * `ctx.agents.&lt;name>.run(...)`. Called with `{ threadKey, input }` merged with
234
+ * `ctx.agents.<name>.run(...)`. Called with `{ threadKey, input }` merged with
235
235
  * {@link CreateAgentChatOptions.sendArgs} and the per-call args.
236
236
  */
237
237
  send: FunctionReference<"mutation">;
@@ -528,7 +528,7 @@ declare const createMutationForClient: <F extends FunctionReference>(client: Mut
528
528
  /**
529
529
  * Returns a reactive handle `{ mutate, pending, data, error, reset }` for the
530
530
  * given mutation reference, bound to the `LunoraClient` from the nearest
531
- * `&lt;LunoraProvider>`.
531
+ * `<LunoraProvider>`.
532
532
  *
533
533
  * Optimistic updates stay client-owned: the `optimistic` / `optimisticUpdate`
534
534
  * call options pass straight through to `client.mutation`, which applies and
@@ -701,7 +701,7 @@ interface CreateQueryOptions {
701
701
  *
702
702
  * ```tsx
703
703
  * const messages = createQuery(api.messages.list, () => ({ channelId: channelId() }));
704
- * return &lt;For each={messages()?.messages}>{(m) => &lt;li>{m.text}&lt;/li>}&lt;/For>;
704
+ * return <For each={messages()?.messages}>{(m) => <li>{m.text}</li>}</For>;
705
705
  * ```
706
706
  */
707
707
  declare const createQuery: <F extends FunctionReference>(function_: F, args: (ArgsOf<F> | "skip") | Accessor<ArgsOf<F> | "skip">, options?: CreateQueryOptions) => Accessor<ReturnOf<F> | undefined>;
@@ -833,9 +833,9 @@ type CreateSpeaker = (config: {
833
833
  audioFormat: VoiceAudioFormat;
834
834
  }) => VoiceSpeaker;
835
835
  /**
836
- * The `agents.&lt;name>Voice` reference codegen emits for a voice-enabled agent — a
836
+ * The `agents.<name>Voice` reference codegen emits for a voice-enabled agent — a
837
837
  * live, WS-backed session keyed by `threadKey`. A structural subset of the
838
- * generated member, so passing `api.agents.&lt;name>Voice` type-checks.
838
+ * generated member, so passing `api.agents.<name>Voice` type-checks.
839
839
  */
840
840
  type VoiceReference = FunctionReference<"stream", {
841
841
  threadKey: string;
@@ -877,7 +877,7 @@ interface CreateVoiceAgentOptions {
877
877
  silenceThreshold?: number;
878
878
  /** The thread to converse on — shared with the agent's text turns. May be a plain value or accessor (resolved when the call opens). */
879
879
  threadKey: MaybeAccessor$1<string>;
880
- /** The generated `api.agents.&lt;name>Voice` reference — identifies the voice DO endpoint. */
880
+ /** The generated `api.agents.<name>Voice` reference — identifies the voice DO endpoint. */
881
881
  voice: VoiceReference;
882
882
  }
883
883
  interface CreateVoiceAgentResult {
@@ -909,7 +909,7 @@ interface CreateVoiceAgentResult {
909
909
  * WebSocket to the agent's `VoiceSessionDO`, captures mic audio as 16 kHz PCM,
910
910
  * streams the agent's synthesized speech back through the browser's audio output,
911
911
  * and mirrors the call lifecycle (`status`, `transcript`, `interimTranscript`,
912
- * `audioLevel`) to Solid signals. Pass the generated `api.agents.&lt;name>Voice`
912
+ * `audioLevel`) to Solid signals. Pass the generated `api.agents.<name>Voice`
913
913
  * reference (never a string), matching `createAgentChat`'s reference-passing style.
914
914
  * The Solid counterpart to React's `useVoiceAgent`, re-expressed with signals; the
915
915
  * per-call connection lives in a closure variable (a primitive runs once per
@@ -936,7 +936,7 @@ declare const createVoiceAgent: (options: CreateVoiceAgentOptions) => CreateVoic
936
936
  * ```tsx
937
937
  * // route loader (server): const preloaded = await preloadQuery(client, api.messages.list, args);
938
938
  * const messages = hydratePreloaded(preloaded); // seeded from SSR, then live
939
- * return &lt;pre>{JSON.stringify(messages())}&lt;/pre>;
939
+ * return <pre>{JSON.stringify(messages())}</pre>;
940
940
  * ```
941
941
  *
942
942
  * Effects do not run on the server during SSR (Solid only runs them after
@@ -967,9 +967,9 @@ interface LunoraProviderProps {
967
967
  * const client = new LunoraClient({ url: window.location.origin });
968
968
  *
969
969
  * render(() => (
970
- * &lt;LunoraProvider client={client}>
971
- * &lt;App />
972
- * &lt;/LunoraProvider>
970
+ * <LunoraProvider client={client}>
971
+ * <App />
972
+ * </LunoraProvider>
973
973
  * ), root);
974
974
  * ```
975
975
  */
package/dist/index.d.ts CHANGED
@@ -7,14 +7,14 @@ import { RateLimitStatus, RateLimitConfig } from '@lunora/ratelimit';
7
7
  * Solid context carrying the framework-neutral {@link LunoraClient}. Every
8
8
  * reactive primitive in this adapter (`createQuery`, `createMutation`,
9
9
  * `hydratePreloaded`) reads the client from here, so a single
10
- * `&lt;LunoraProvider client={…}>` at the root of the tree wires the whole app.
10
+ * `<LunoraProvider client={…}>` at the root of the tree wires the whole app.
11
11
  *
12
12
  * Defaults to `undefined` so {@link useLunora} can throw a helpful error when a
13
13
  * primitive is used outside a provider rather than dereferencing it.
14
14
  */
15
15
  declare const LunoraContext: Context<LunoraClient | undefined>;
16
16
  /**
17
- * Read the {@link LunoraClient} from the nearest `&lt;LunoraProvider>`.
17
+ * Read the {@link LunoraClient} from the nearest `<LunoraProvider>`.
18
18
  *
19
19
  * Throws when called outside a provider — the client is required to open the
20
20
  * HTTP/WS transport, so there is no sensible fallback. The React adapter's
@@ -68,14 +68,14 @@ interface CreateAgentOptions {
68
68
  api: CreateAgentApi;
69
69
  /**
70
70
  * Optional app mutation over the agent's cancel path
71
- * (`ctx.agents.&lt;name>.cancel(id)`). Called with `{ instanceId, threadKey }`.
71
+ * (`ctx.agents.<name>.cancel(id)`). Called with `{ instanceId, threadKey }`.
72
72
  * When omitted (or no run is in flight) {@link CreateAgentResult.cancel} is a
73
73
  * no-op.
74
74
  */
75
75
  cancel?: FunctionReference<"mutation">;
76
76
  /**
77
77
  * The app mutation that starts (or continues) a run — a thin wrapper over
78
- * `ctx.agents.&lt;name>.run(...)`. Called with `{ threadKey, input }` merged with
78
+ * `ctx.agents.<name>.run(...)`. Called with `{ threadKey, input }` merged with
79
79
  * {@link CreateAgentOptions.runArgs} and the per-call args.
80
80
  */
81
81
  run: FunctionReference<"mutation">;
@@ -108,7 +108,7 @@ interface CreateAgentResult {
108
108
  * `createAgentChat`.
109
109
  *
110
110
  * `run` and `cancel` stay generic over the app-defined mutations that wrap
111
- * `ctx.agents.&lt;name>.run` / `.cancel`, so the primitive hard-codes no function
111
+ * `ctx.agents.<name>.run` / `.cancel`, so the primitive hard-codes no function
112
112
  * names beyond the `agents:*` surface. `threadKey` may be an accessor — a changing
113
113
  * key re-subscribes to the new thread.
114
114
  */
@@ -222,7 +222,7 @@ interface CreateAgentChatOptions {
222
222
  api: CreateAgentChatApi;
223
223
  /**
224
224
  * Optional app mutation over the agent's cancel path
225
- * (`ctx.agents.&lt;name>.cancel(id)`). Called with `{ instanceId, threadKey }`.
225
+ * (`ctx.agents.<name>.cancel(id)`). Called with `{ instanceId, threadKey }`.
226
226
  * When omitted (or no run is in flight) {@link CreateAgentChatResult.cancel} is
227
227
  * a no-op.
228
228
  */
@@ -231,7 +231,7 @@ interface CreateAgentChatOptions {
231
231
  limit?: number;
232
232
  /**
233
233
  * The app mutation that starts (or continues) a run — a thin wrapper over
234
- * `ctx.agents.&lt;name>.run(...)`. Called with `{ threadKey, input }` merged with
234
+ * `ctx.agents.<name>.run(...)`. Called with `{ threadKey, input }` merged with
235
235
  * {@link CreateAgentChatOptions.sendArgs} and the per-call args.
236
236
  */
237
237
  send: FunctionReference<"mutation">;
@@ -528,7 +528,7 @@ declare const createMutationForClient: <F extends FunctionReference>(client: Mut
528
528
  /**
529
529
  * Returns a reactive handle `{ mutate, pending, data, error, reset }` for the
530
530
  * given mutation reference, bound to the `LunoraClient` from the nearest
531
- * `&lt;LunoraProvider>`.
531
+ * `<LunoraProvider>`.
532
532
  *
533
533
  * Optimistic updates stay client-owned: the `optimistic` / `optimisticUpdate`
534
534
  * call options pass straight through to `client.mutation`, which applies and
@@ -701,7 +701,7 @@ interface CreateQueryOptions {
701
701
  *
702
702
  * ```tsx
703
703
  * const messages = createQuery(api.messages.list, () => ({ channelId: channelId() }));
704
- * return &lt;For each={messages()?.messages}>{(m) => &lt;li>{m.text}&lt;/li>}&lt;/For>;
704
+ * return <For each={messages()?.messages}>{(m) => <li>{m.text}</li>}</For>;
705
705
  * ```
706
706
  */
707
707
  declare const createQuery: <F extends FunctionReference>(function_: F, args: (ArgsOf<F> | "skip") | Accessor<ArgsOf<F> | "skip">, options?: CreateQueryOptions) => Accessor<ReturnOf<F> | undefined>;
@@ -833,9 +833,9 @@ type CreateSpeaker = (config: {
833
833
  audioFormat: VoiceAudioFormat;
834
834
  }) => VoiceSpeaker;
835
835
  /**
836
- * The `agents.&lt;name>Voice` reference codegen emits for a voice-enabled agent — a
836
+ * The `agents.<name>Voice` reference codegen emits for a voice-enabled agent — a
837
837
  * live, WS-backed session keyed by `threadKey`. A structural subset of the
838
- * generated member, so passing `api.agents.&lt;name>Voice` type-checks.
838
+ * generated member, so passing `api.agents.<name>Voice` type-checks.
839
839
  */
840
840
  type VoiceReference = FunctionReference<"stream", {
841
841
  threadKey: string;
@@ -877,7 +877,7 @@ interface CreateVoiceAgentOptions {
877
877
  silenceThreshold?: number;
878
878
  /** The thread to converse on — shared with the agent's text turns. May be a plain value or accessor (resolved when the call opens). */
879
879
  threadKey: MaybeAccessor$1<string>;
880
- /** The generated `api.agents.&lt;name>Voice` reference — identifies the voice DO endpoint. */
880
+ /** The generated `api.agents.<name>Voice` reference — identifies the voice DO endpoint. */
881
881
  voice: VoiceReference;
882
882
  }
883
883
  interface CreateVoiceAgentResult {
@@ -909,7 +909,7 @@ interface CreateVoiceAgentResult {
909
909
  * WebSocket to the agent's `VoiceSessionDO`, captures mic audio as 16 kHz PCM,
910
910
  * streams the agent's synthesized speech back through the browser's audio output,
911
911
  * and mirrors the call lifecycle (`status`, `transcript`, `interimTranscript`,
912
- * `audioLevel`) to Solid signals. Pass the generated `api.agents.&lt;name>Voice`
912
+ * `audioLevel`) to Solid signals. Pass the generated `api.agents.<name>Voice`
913
913
  * reference (never a string), matching `createAgentChat`'s reference-passing style.
914
914
  * The Solid counterpart to React's `useVoiceAgent`, re-expressed with signals; the
915
915
  * per-call connection lives in a closure variable (a primitive runs once per
@@ -936,7 +936,7 @@ declare const createVoiceAgent: (options: CreateVoiceAgentOptions) => CreateVoic
936
936
  * ```tsx
937
937
  * // route loader (server): const preloaded = await preloadQuery(client, api.messages.list, args);
938
938
  * const messages = hydratePreloaded(preloaded); // seeded from SSR, then live
939
- * return &lt;pre>{JSON.stringify(messages())}&lt;/pre>;
939
+ * return <pre>{JSON.stringify(messages())}</pre>;
940
940
  * ```
941
941
  *
942
942
  * Effects do not run on the server during SSR (Solid only runs them after
@@ -967,9 +967,9 @@ interface LunoraProviderProps {
967
967
  * const client = new LunoraClient({ url: window.location.origin });
968
968
  *
969
969
  * render(() => (
970
- * &lt;LunoraProvider client={client}>
971
- * &lt;App />
972
- * &lt;/LunoraProvider>
970
+ * <LunoraProvider client={client}>
971
+ * <App />
972
+ * </LunoraProvider>
973
973
  * ), root);
974
974
  * ```
975
975
  */
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{LunoraContext as r,useLunora as o}from"./packem_shared/LunoraContext-CVOsskhY.mjs";import{createAgent as c}from"./packem_shared/createAgent-BbHVxEpf.mjs";import{createAgentChat as f}from"./packem_shared/createAgentChat-B79ZiHfq.mjs";import{createAgentState as p}from"./packem_shared/createAgentState-CbE2MP_H.mjs";import{createAgentToolEvents as u}from"./packem_shared/createAgentToolEvents-DOU_J3JT.mjs";import{AuthLoading as d,Authenticated as g,Unauthenticated as s,createAuth as A}from"./packem_shared/AuthLoading-D6A1mBRs.mjs";import{default as h}from"./packem_shared/createConnectionStatus-B9ly5m1x.mjs";import{createFlag as y,createFlags as C}from"./packem_shared/createFlag-qBxuQ5hP.mjs";import{createMutation as S,createMutationForClient as F}from"./packem_shared/createMutation-9i34uh8U.mjs";import{createMutator as Q}from"./packem_shared/createMutator-zzxMk2QQ.mjs";import{createInfiniteQuery as b,createPaginatedQuery as E}from"./packem_shared/createInfiniteQuery-EM9Tio0U.mjs";import{createPresence as R}from"./packem_shared/createPresence-DNVSvTzP.mjs";import{createQuery as U}from"./packem_shared/createQuery-CFb7mUGW.mjs";import{createRateLimit as j}from"./packem_shared/createRateLimit-BdVo3eNW.mjs";import{createStream as q}from"./packem_shared/createStream-DozkYNOc.mjs";import{createSubscription as z}from"./packem_shared/createSubscription-KbQk0ohZ.mjs";import{createVoiceAgent as D}from"./packem_shared/createVoiceAgent-CzXF9acz.mjs";import{default as H}from"./packem_shared/hydratePreloaded-BbGFlPEb.mjs";import{LunoraProvider as K}from"./packem_shared/LunoraProvider-cifsrLab.mjs";export{d as AuthLoading,g as Authenticated,r as LunoraContext,K as LunoraProvider,s as Unauthenticated,c as createAgent,f as createAgentChat,p as createAgentState,u as createAgentToolEvents,A as createAuth,h as createConnectionStatus,y as createFlag,C as createFlags,b as createInfiniteQuery,S as createMutation,F as createMutationForClient,Q as createMutator,E as createPaginatedQuery,R as createPresence,U as createQuery,j as createRateLimit,q as createStream,z as createSubscription,D as createVoiceAgent,H as hydratePreloaded,o as useLunora};
1
+ import{LunoraContext as r,useLunora as o}from"./packem_shared/LunoraContext-CVOsskhY.mjs";import{createAgent as c}from"./packem_shared/createAgent-BbHVxEpf.mjs";import{createAgentChat as f}from"./packem_shared/createAgentChat-B79ZiHfq.mjs";import{createAgentState as p}from"./packem_shared/createAgentState-CbE2MP_H.mjs";import{createAgentToolEvents as u}from"./packem_shared/createAgentToolEvents-DOU_J3JT.mjs";import{AuthLoading as d,Authenticated as g,Unauthenticated as s,createAuth as A}from"./packem_shared/AuthLoading-D6A1mBRs.mjs";import{default as h}from"./packem_shared/createConnectionStatus-B9ly5m1x.mjs";import{createFlag as y,createFlags as C}from"./packem_shared/createFlag-qBxuQ5hP.mjs";import{createMutation as S,createMutationForClient as F}from"./packem_shared/createMutation-9i34uh8U.mjs";import{createMutator as Q}from"./packem_shared/createMutator-zzxMk2QQ.mjs";import{createInfiniteQuery as b,createPaginatedQuery as E}from"./packem_shared/createInfiniteQuery-Cq1TI1WK.mjs";import{createPresence as R}from"./packem_shared/createPresence-DNVSvTzP.mjs";import{createQuery as U}from"./packem_shared/createQuery-CFb7mUGW.mjs";import{createRateLimit as j}from"./packem_shared/createRateLimit-BdVo3eNW.mjs";import{createStream as q}from"./packem_shared/createStream-DozkYNOc.mjs";import{createSubscription as z}from"./packem_shared/createSubscription-KbQk0ohZ.mjs";import{createVoiceAgent as D}from"./packem_shared/createVoiceAgent-CzXF9acz.mjs";import{default as H}from"./packem_shared/hydratePreloaded-BbGFlPEb.mjs";import{LunoraProvider as K}from"./packem_shared/LunoraProvider-cifsrLab.mjs";export{d as AuthLoading,g as Authenticated,r as LunoraContext,K as LunoraProvider,s as Unauthenticated,c as createAgent,f as createAgentChat,p as createAgentState,u as createAgentToolEvents,A as createAuth,h as createConnectionStatus,y as createFlag,C as createFlags,b as createInfiniteQuery,S as createMutation,F as createMutationForClient,Q as createMutator,E as createPaginatedQuery,R as createPresence,U as createQuery,j as createRateLimit,q as createStream,z as createSubscription,D as createVoiceAgent,H as hydratePreloaded,o as useLunora};
@@ -0,0 +1 @@
1
+ import{initialPages as U,derivePaginationStatus as E,applyLoadMore as G,rebalance as H}from"@lunora/client/pagination";import{createMemo as L,createSignal as F,createEffect as B,on as Q,onCleanup as V}from"solid-js";import{e as J}from"./stable-key-BSG0zK_E.mjs";import{useLunora as W}from"./LunoraContext-CVOsskhY.mjs";const N=e=>{let r="";for(let f=0;f<e.length;f+=32768)r+=String.fromCharCode(...e.subarray(f,f+32768));return btoa(r)},c="$lunora.wire$",D=64,X="__proto__",Y=e=>{if(e===null||typeof e!="object")return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype},w=(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 f=typeof e;if(f==="bigint")return[c,"bigint",e.toString()];if(f==="number"){const t=e;return Number.isNaN(t)?[c,"nan"]:t===1/0?[c,"inf"]:t===-1/0?[c,"-inf"]:t}if(f!=="object")return e;if(e instanceof Date)return[c,"date",w(e.getTime(),r+1)];if(e instanceof Error){const t=e,o={};for(const l of Object.keys(t))t[l]!==void 0&&(o[l]=w(t[l],r+1));const n=[c,"error",t.name,t.message,o];return t.cause!==void 0&&n.push(w(t.cause,r+1)),n}if(e instanceof URL)return[c,"url",e.href];if(e instanceof Map)return[c,"map",[...e.entries()].map(([t,o])=>[w(t,r+1),w(o,r+1)])];if(e instanceof Set)return[c,"set",[...e].map(t=>w(t,r+1))];if(e instanceof ArrayBuffer)return[c,"bytes",N(new Uint8Array(e)),"ArrayBuffer"];if(ArrayBuffer.isView(e)){const t=e,o=t.constructor.name,n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);return o==="Uint8Array"?[c,"bytes",N(n)]:[c,"bytes",N(n),o]}if(Array.isArray(e)){const t=e.map(o=>w(o,r+1));return t.length>0&&t[0]===c?[c,"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 h=e,m={};for(const t of Object.keys(h)){const o=h[t];if(o===void 0)continue;const n=w(o,r+1);t===X?Object.defineProperty(m,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):m[t]=n}return m},Z=e=>J(w(e)),k=(e,r)=>({...r,paginationOpts:{cursor:e.lower,endCursor:e.upper,numItems:e.numItems}}),A=(e,r)=>`${e}::${Z(r)}`,K=(e,r,f)=>{const h=W(),{initialNumItems:m,shardKey:t}=f,o=()=>typeof r=="function"?r():r,[n,l]=F(U(m)),p=new Map,[P,_]=F([]),y=new Map,R=new Set,j=(a,u)=>{const d=a.map(s=>{const i=A(e.__lunoraRef,k(s,u));return p.get(i)});_(d)},T=(a,u,d)=>{const s=i=>A(e.__lunoraRef,k(i,d));for(const i of u){const g=s(i);if(p.has(g))continue;const M=a.find(b=>b.lower===i.lower);if(M){const b=p.get(s(M));b&&p.set(g,b)}}},q=(a,u)=>{const d=new Set;for(const s of a)d.add(A(e.__lunoraRef,k(s,u)));for(const[s,i]of y)d.has(s)||(i(),y.delete(s),R.delete(s),p.delete(s));for(const s of a){const i=k(s,u),g=A(e.__lunoraRef,i);if(y.has(g))continue;R.add(g);const M=h.subscribe(e,i,b=>{p.set(g,b),R.delete(g);const v=o();if(v!=="skip"&&(j(n(),v),R.size===0)){const O=n(),C=H(O,P());C&&(T(O,C,v),l(C))}},{shardKey:t});y.set(g,M)}};let S=!1,$=!1;const x=(a,u)=>{if(S){$=!0;return}S=!0;try{let d=a,s=u;do{$=!1,q(d,s);const i=o();if(i==="skip")break;d=n(),s=i}while($)}finally{S=!1}},I=()=>{for(const a of y.values())a();y.clear(),p.clear(),R.clear()};B(Q(o,a=>{I(),l(U(m)),_([]),a!=="skip"&&(x(n(),a),j(n(),a)),V(I)})),B(Q(n,a=>{const u=o();u!=="skip"&&(x(a,u),j(a,u))}));const z=L(()=>{const a=o()==="skip";return E(a,P()).status});return{loadMore:a=>{const u=o();if(u==="skip")return;const{nextCursor:d,status:s}=E(!1,P());if(s!=="CanLoadMore")return;const i=G(n(),d,a);if(!i)return;const g=n().at(-1),M=i.at(-2);if(g&&M){const b=A(e.__lunoraRef,k(g,u)),v=A(e.__lunoraRef,k(M,u));if(b!==v){const O=p.get(b);O&&p.set(v,O)}}l(i)},pageResults:P,status:z}},ne=(e,r,f)=>{const{loadMore:h,pageResults:m,status:t}=K(e,r,f),o=L(()=>{const n=[];for(const l of m())l&&n.push(...l.page);return n});return{isLoading:L(()=>t()==="LoadingFirstPage"||t()==="LoadingMore"),loadMore:h,results:o,status:t}},ae=(e,r,f)=>{const{initialNumItems:h}=f,{loadMore:m,pageResults:t,status:o}=K(e,r,f),n=L(()=>{const _=[];for(const y of t())y&&_.push(y.page);return _}),l=L(()=>o()==="LoadingFirstPage"),p=L(()=>o()==="CanLoadMore"),P=L(()=>o()==="LoadingMore");return{fetchNextPage:_=>{m(_??h)},hasNextPage:p,isFetchingNextPage:P,isLoading:l,pages:n,status:o}};export{ae as createInfiniteQuery,ne as createPaginatedQuery};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/solid",
3
- "version": "1.0.0-alpha.40",
3
+ "version": "1.0.0-alpha.41",
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.38",
58
- "@lunora/errors": "1.0.0-alpha.13",
59
- "@lunora/ratelimit": "1.0.0-alpha.16",
57
+ "@lunora/client": "1.0.0-alpha.40",
58
+ "@lunora/errors": "1.0.0-alpha.14",
59
+ "@lunora/ratelimit": "1.0.0-alpha.17",
60
60
  "@visulima/storage-client": "1.0.0"
61
61
  },
62
62
  "peerDependencies": {
@@ -1 +0,0 @@
1
- import{initialPages as U,derivePaginationStatus as E,applyLoadMore as G,rebalance as H}from"@lunora/client/pagination";import{createMemo as P,createSignal as F,createEffect as B,on as Q,onCleanup as V}from"solid-js";import{e as J}from"./stable-key-BSG0zK_E.mjs";import{useLunora as W}from"./LunoraContext-CVOsskhY.mjs";const $=t=>{let r="";for(let c=0;c<t.length;c+=32768)r+=String.fromCharCode(...t.subarray(c,c+32768));return btoa(r)},u="$lunora.wire$",D=64,X=t=>{if(t===null||typeof t!="object")return!1;const r=Object.getPrototypeOf(t);return r===null||r===Object.prototype},h=(t,r=0)=>{if(r>D)throw new RangeError(`wire-codec: value nesting exceeds the ${D}-level limit`);if(t===void 0)return[u,"undefined"];if(t===null)return null;const c=typeof t;if(c==="bigint")return[u,"bigint",t.toString()];if(c==="number"){const e=t;return Number.isNaN(e)?[u,"nan"]:e===1/0?[u,"inf"]:e===-1/0?[u,"-inf"]:e}if(c!=="object")return t;if(t instanceof Date)return[u,"date",h(t.getTime(),r+1)];if(t instanceof Error){const e=t,o={};for(const l of Object.keys(e))e[l]!==void 0&&(o[l]=h(e[l],r+1));const a=[u,"error",e.name,e.message,o];return e.cause!==void 0&&a.push(h(e.cause,r+1)),a}if(t instanceof URL)return[u,"url",t.href];if(t instanceof Map)return[u,"map",[...t.entries()].map(([e,o])=>[h(e,r+1),h(o,r+1)])];if(t instanceof Set)return[u,"set",[...t].map(e=>h(e,r+1))];if(t instanceof ArrayBuffer)return[u,"bytes",$(new Uint8Array(t)),"ArrayBuffer"];if(ArrayBuffer.isView(t)){const e=t,o=e.constructor.name,a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return o==="Uint8Array"?[u,"bytes",$(a)]:[u,"bytes",$(a),o]}if(Array.isArray(t)){const e=t.map(o=>h(o,r+1));return e.length>0&&e[0]===u?[u,"arr",e]:e}if(!X(t)){const e=t.constructor?.name??"value";throw new TypeError(`wire-codec: cannot encode a ${e} 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 w=t,m={};for(const e of Object.keys(w)){const o=w[e];o!==void 0&&(m[e]=h(o,r+1))}return m},Y=t=>J(h(t)),v=(t,r)=>({...r,paginationOpts:{cursor:t.lower,endCursor:t.upper,numItems:t.numItems}}),R=(t,r)=>`${t}::${Y(r)}`,K=(t,r,c)=>{const w=W(),{initialNumItems:m,shardKey:e}=c,o=()=>typeof r=="function"?r():r,[a,l]=F(U(m)),p=new Map,[_,M]=F([]),y=new Map,A=new Set,S=(n,f)=>{const d=n.map(s=>{const i=R(t.__lunoraRef,v(s,f));return p.get(i)});M(d)},T=(n,f,d)=>{const s=i=>R(t.__lunoraRef,v(i,d));for(const i of f){const g=s(i);if(p.has(g))continue;const L=n.find(b=>b.lower===i.lower);if(L){const b=p.get(s(L));b&&p.set(g,b)}}},q=(n,f)=>{const d=new Set;for(const s of n)d.add(R(t.__lunoraRef,v(s,f)));for(const[s,i]of y)d.has(s)||(i(),y.delete(s),A.delete(s),p.delete(s));for(const s of n){const i=v(s,f),g=R(t.__lunoraRef,i);if(y.has(g))continue;A.add(g);const L=w.subscribe(t,i,b=>{p.set(g,b),A.delete(g);const k=o();if(k!=="skip"&&(S(a(),k),A.size===0)){const O=a(),N=H(O,_());N&&(T(O,N,k),l(N))}},{shardKey:e});y.set(g,L)}};let j=!1,C=!1;const x=(n,f)=>{if(j){C=!0;return}j=!0;try{let d=n,s=f;do{C=!1,q(d,s);const i=o();if(i==="skip")break;d=a(),s=i}while(C)}finally{j=!1}},I=()=>{for(const n of y.values())n();y.clear(),p.clear(),A.clear()};B(Q(o,n=>{I(),l(U(m)),M([]),n!=="skip"&&(x(a(),n),S(a(),n)),V(I)})),B(Q(a,n=>{const f=o();f!=="skip"&&(x(n,f),S(n,f))}));const z=P(()=>{const n=o()==="skip";return E(n,_()).status});return{loadMore:n=>{const f=o();if(f==="skip")return;const{nextCursor:d,status:s}=E(!1,_());if(s!=="CanLoadMore")return;const i=G(a(),d,n);if(!i)return;const g=a().at(-1),L=i.at(-2);if(g&&L){const b=R(t.__lunoraRef,v(g,f)),k=R(t.__lunoraRef,v(L,f));if(b!==k){const O=p.get(b);O&&p.set(k,O)}}l(i)},pageResults:_,status:z}},ot=(t,r,c)=>{const{loadMore:w,pageResults:m,status:e}=K(t,r,c),o=P(()=>{const a=[];for(const l of m())l&&a.push(...l.page);return a});return{isLoading:P(()=>e()==="LoadingFirstPage"||e()==="LoadingMore"),loadMore:w,results:o,status:e}},nt=(t,r,c)=>{const{initialNumItems:w}=c,{loadMore:m,pageResults:e,status:o}=K(t,r,c),a=P(()=>{const M=[];for(const y of e())y&&M.push(y.page);return M}),l=P(()=>o()==="LoadingFirstPage"),p=P(()=>o()==="CanLoadMore"),_=P(()=>o()==="LoadingMore");return{fetchNextPage:M=>{m(M??w)},hasNextPage:p,isFetchingNextPage:_,isLoading:l,pages:a,status:o}};export{nt as createInfiniteQuery,ot as createPaginatedQuery};