@lunora/solid 1.0.0-alpha.236 → 1.0.0-alpha.238

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/README.md CHANGED
@@ -102,6 +102,7 @@ render(
102
102
  | `createQuery` | `useQuery` | Live query signal — returns `() => T \| undefined`, re-subscribes on arg change. |
103
103
  | `createMutation` | `useMutation` | Optimistic mutation handle (`data`, `error`, `pending`, `mutate`, `reset`). |
104
104
  | `createSubscription` | `useSubscription` | Raw subscription signal — unbounded live stream. |
105
+ | `createLiveTopic` | `useLiveTopic` | One declared live topic — `lastEvent` and `error` accessors. |
105
106
  | `createPaginatedQuery` | `usePaginatedQuery` | Cursor-paginated query with `loadMore`, `status`, `results`, and `error` signals. |
106
107
  | `createInfiniteQuery` | `useInfiniteQuery` | Infinite-scroll variant of `createPaginatedQuery`. |
107
108
  | `createAuth` | `useAuth` | Reactive auth state (`token`, `user`, `status` signals + `setToken`). |
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { LunoraClient, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, SubscriptionErrorCallback, User, ConnectionStatus, MutationCallOptions, MutatorHandle, SubscriptionError, Preloaded } from '@lunora/client';
1
+ import { LunoraClient, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, SubscriptionErrorCallback, User, ConnectionStatus, LiveStreamSubscribeError, LiveTopicRef, LiveTopicOptions, MutationCallOptions, MutatorHandle, SubscriptionError, Preloaded } from '@lunora/client';
2
2
  export type { ArgsOf, FunctionReference, MutatorHandle, MutatorTransaction, OptimisticUpdate, Preloaded, ReturnOf, SubscriptionError, SubscriptionErrorCallback, Unsubscribe } from '@lunora/client';
3
3
  import { Context, Accessor } from 'solid-js';
4
4
  import { AuthStatus } from '@lunora/client/auth';
@@ -613,6 +613,30 @@ declare const createFlag: <T extends FlagValue>(key: MaybeAccessor<string>, defa
613
613
  * reactive — the subscriptions open on mount and tear down on cleanup.
614
614
  */
615
615
  declare const createFlags: <T extends Record<string, FlagValue>>(flags: T) => Accessor<T>;
616
+ /**
617
+ * `createLiveTopic` — follow one live topic on the connection shared by its URL.
618
+ *
619
+ * A thin lifecycle wrapper over `subscribeLiveTopic` from `@lunora/client`: it
620
+ * subscribes when the owner mounts, unsubscribes on cleanup, and resubscribes when
621
+ * the topic or the connection options change. Callbacks are not part of that
622
+ * identity, so a new `onEvent` / `onError` never reopens the subscription.
623
+ */
624
+ interface CreateLiveTopicResult<Payload = unknown> {
625
+ /** The shard's refusal of this subscription (403, 409, 429 and similar), or `undefined`. */
626
+ error: Accessor<LiveStreamSubscribeError | undefined>;
627
+ /** The last payload delivered on the topic, or `undefined` until the first event. */
628
+ lastEvent: Accessor<Payload | undefined>;
629
+ }
630
+ /**
631
+ * Follow the topic `topic` names on the live connection shared by its stream's route. Pass the
632
+ * reference `_generated/live.ts` hands out (`live.posts.post({ postId })`), plain or as an
633
+ * accessor; the route is resolved against the `LunoraClient` from the nearest `LunoraContext`,
634
+ * and `lastEvent` and `onEvent` are typed by the payload the topic declares.
635
+ *
636
+ * `options` may be a plain object or an accessor. The `onEvent` and `onError` callbacks are
637
+ * read at call time, so the latest identity is always the one invoked.
638
+ */
639
+ declare const createLiveTopic: <Payload>(topic: LiveTopicRef<Payload> | Accessor<LiveTopicRef<Payload>>, options?: LiveTopicOptions<Payload> | Accessor<LiveTopicOptions<Payload>>) => CreateLiveTopicResult<Payload>;
616
640
  interface MutationHandle<F extends FunctionReference> {
617
641
  /** The latest invocation's resolved value, or `undefined` before the first success. */
618
642
  data: Accessor<ReturnOf<F> | undefined>;
@@ -1189,7 +1213,7 @@ interface LunoraProviderProps {
1189
1213
  * itself is resolved per-major by {@link providerOf}.
1190
1214
  */
1191
1215
  declare const LunoraProvider: (props: LunoraProviderProps) => SolidElement;
1192
- 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,
1216
+ 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 CreateLiveTopicResult, 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,
1193
1217
  /**
1194
1218
  * SolidJS adapter for Lunora.
1195
1219
  *
@@ -1208,4 +1232,4 @@ export { type ActionClient, type ActionHandle, type AgentChatMessage, type Agent
1208
1232
  * framework-neutral server contract) — call it from your SolidStart route loader
1209
1233
  * and hand the resulting `Preloaded` token to `hydratePreloaded`.
1210
1234
  */
1211
- type LunoraProviderProps, type MutationClient, type MutationHandle, type MutatorHook, type PageItemOf, type PaginatedArgs, type SolidChildren, Unauthenticated, type UseAuthResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, createAction, createActionForClient, createAgent, createAgentChat, createAgentState, createAgentToolEvents, createAuth, createConnectionStatus, createFlag, createFlags, createInfiniteQuery, createMutation, createMutationForClient, createMutator, createPaginatedQuery, createPresence, createQuery, createRateLimit, createStream, createSubscription, createVoiceAgent, hydratePreloaded, useLunora };
1235
+ type LunoraProviderProps, type MutationClient, type MutationHandle, type MutatorHook, type PageItemOf, type PaginatedArgs, type SolidChildren, Unauthenticated, type UseAuthResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, createAction, createActionForClient, createAgent, createAgentChat, createAgentState, createAgentToolEvents, createAuth, createConnectionStatus, createFlag, createFlags, createInfiniteQuery, createLiveTopic, createMutation, createMutationForClient, createMutator, createPaginatedQuery, createPresence, createQuery, createRateLimit, createStream, createSubscription, createVoiceAgent, hydratePreloaded, useLunora };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { LunoraClient, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, SubscriptionErrorCallback, User, ConnectionStatus, MutationCallOptions, MutatorHandle, SubscriptionError, Preloaded } from '@lunora/client';
1
+ import { LunoraClient, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, SubscriptionErrorCallback, User, ConnectionStatus, LiveStreamSubscribeError, LiveTopicRef, LiveTopicOptions, MutationCallOptions, MutatorHandle, SubscriptionError, Preloaded } from '@lunora/client';
2
2
  export type { ArgsOf, FunctionReference, MutatorHandle, MutatorTransaction, OptimisticUpdate, Preloaded, ReturnOf, SubscriptionError, SubscriptionErrorCallback, Unsubscribe } from '@lunora/client';
3
3
  import { Context, Accessor } from 'solid-js';
4
4
  import { AuthStatus } from '@lunora/client/auth';
@@ -613,6 +613,30 @@ declare const createFlag: <T extends FlagValue>(key: MaybeAccessor<string>, defa
613
613
  * reactive — the subscriptions open on mount and tear down on cleanup.
614
614
  */
615
615
  declare const createFlags: <T extends Record<string, FlagValue>>(flags: T) => Accessor<T>;
616
+ /**
617
+ * `createLiveTopic` — follow one live topic on the connection shared by its URL.
618
+ *
619
+ * A thin lifecycle wrapper over `subscribeLiveTopic` from `@lunora/client`: it
620
+ * subscribes when the owner mounts, unsubscribes on cleanup, and resubscribes when
621
+ * the topic or the connection options change. Callbacks are not part of that
622
+ * identity, so a new `onEvent` / `onError` never reopens the subscription.
623
+ */
624
+ interface CreateLiveTopicResult<Payload = unknown> {
625
+ /** The shard's refusal of this subscription (403, 409, 429 and similar), or `undefined`. */
626
+ error: Accessor<LiveStreamSubscribeError | undefined>;
627
+ /** The last payload delivered on the topic, or `undefined` until the first event. */
628
+ lastEvent: Accessor<Payload | undefined>;
629
+ }
630
+ /**
631
+ * Follow the topic `topic` names on the live connection shared by its stream's route. Pass the
632
+ * reference `_generated/live.ts` hands out (`live.posts.post({ postId })`), plain or as an
633
+ * accessor; the route is resolved against the `LunoraClient` from the nearest `LunoraContext`,
634
+ * and `lastEvent` and `onEvent` are typed by the payload the topic declares.
635
+ *
636
+ * `options` may be a plain object or an accessor. The `onEvent` and `onError` callbacks are
637
+ * read at call time, so the latest identity is always the one invoked.
638
+ */
639
+ declare const createLiveTopic: <Payload>(topic: LiveTopicRef<Payload> | Accessor<LiveTopicRef<Payload>>, options?: LiveTopicOptions<Payload> | Accessor<LiveTopicOptions<Payload>>) => CreateLiveTopicResult<Payload>;
616
640
  interface MutationHandle<F extends FunctionReference> {
617
641
  /** The latest invocation's resolved value, or `undefined` before the first success. */
618
642
  data: Accessor<ReturnOf<F> | undefined>;
@@ -1189,7 +1213,7 @@ interface LunoraProviderProps {
1189
1213
  * itself is resolved per-major by {@link providerOf}.
1190
1214
  */
1191
1215
  declare const LunoraProvider: (props: LunoraProviderProps) => SolidElement;
1192
- 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,
1216
+ 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 CreateLiveTopicResult, 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,
1193
1217
  /**
1194
1218
  * SolidJS adapter for Lunora.
1195
1219
  *
@@ -1208,4 +1232,4 @@ export { type ActionClient, type ActionHandle, type AgentChatMessage, type Agent
1208
1232
  * framework-neutral server contract) — call it from your SolidStart route loader
1209
1233
  * and hand the resulting `Preloaded` token to `hydratePreloaded`.
1210
1234
  */
1211
- type LunoraProviderProps, type MutationClient, type MutationHandle, type MutatorHook, type PageItemOf, type PaginatedArgs, type SolidChildren, Unauthenticated, type UseAuthResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, createAction, createActionForClient, createAgent, createAgentChat, createAgentState, createAgentToolEvents, createAuth, createConnectionStatus, createFlag, createFlags, createInfiniteQuery, createMutation, createMutationForClient, createMutator, createPaginatedQuery, createPresence, createQuery, createRateLimit, createStream, createSubscription, createVoiceAgent, hydratePreloaded, useLunora };
1235
+ type LunoraProviderProps, type MutationClient, type MutationHandle, type MutatorHook, type PageItemOf, type PaginatedArgs, type SolidChildren, Unauthenticated, type UseAuthResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, createAction, createActionForClient, createAgent, createAgentChat, createAgentState, createAgentToolEvents, createAuth, createConnectionStatus, createFlag, createFlags, createInfiniteQuery, createLiveTopic, createMutation, createMutationForClient, createMutator, createPaginatedQuery, createPresence, createQuery, createRateLimit, createStream, createSubscription, createVoiceAgent, hydratePreloaded, useLunora };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{LunoraContext as r,useLunora as o}from"./packem_shared/LunoraContext-BWsj_3CK.mjs";import{createAction as c,createActionForClient as n}from"./packem_shared/createAction-BZkayM2R.mjs";import{createAgent as m}from"./packem_shared/createAgent-BN_C_ztD.mjs";import{createAgentChat as x}from"./packem_shared/createAgentChat-BWtnorVh.mjs";import{createAgentState as u}from"./packem_shared/createAgentState-Cl09r0tX.mjs";import{createAgentToolEvents as A}from"./packem_shared/createAgentToolEvents-on8XD92W.mjs";import{AuthLoading as l,Authenticated as s,Unauthenticated as h,createAuth as C}from"./packem_shared/AuthLoading-DjUnIaP5.mjs";import{default as y}from"./packem_shared/createConnectionStatus-D8bC05Jn.mjs";import{createFlag as P,createFlags as S}from"./packem_shared/createFlag-Bww9WQUu.mjs";import{createMutation as Q,createMutationForClient as v}from"./packem_shared/createMutation-DM2mXpq3.mjs";import{createMutator as E}from"./packem_shared/createMutator-q9cMjGKv.mjs";import{createInfiniteQuery as R,createPaginatedQuery as T}from"./packem_shared/createInfiniteQuery-CwGPFeuc.mjs";import{createPresence as V}from"./packem_shared/createPresence-DkTotieP.mjs";import{createQuery as k}from"./packem_shared/createQuery-oNQqVGjE.mjs";import{createRateLimit as w}from"./packem_shared/createRateLimit-CIVWrD5H.mjs";import{createStream as B}from"./packem_shared/createStream-CCAOb9q1.mjs";import{createSubscription as G}from"./packem_shared/createSubscription-DiyhxkoK.mjs";import{createVoiceAgent as J}from"./packem_shared/createVoiceAgent-BtRfW4lS.mjs";import{default as N}from"./packem_shared/hydratePreloaded-DCi296oW.mjs";import{LunoraProvider as W}from"./packem_shared/LunoraProvider-DMhpuxvx.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};
1
+ import{LunoraContext as r,useLunora as o}from"./packem_shared/LunoraContext-BWsj_3CK.mjs";import{createAction as c,createActionForClient as n}from"./packem_shared/createAction-BZkayM2R.mjs";import{createAgent as m}from"./packem_shared/createAgent-BN_C_ztD.mjs";import{createAgentChat as x}from"./packem_shared/createAgentChat-BWtnorVh.mjs";import{createAgentState as u}from"./packem_shared/createAgentState-Cl09r0tX.mjs";import{createAgentToolEvents as A}from"./packem_shared/createAgentToolEvents-on8XD92W.mjs";import{AuthLoading as l,Authenticated as s,Unauthenticated as h,createAuth as L}from"./packem_shared/AuthLoading-DjUnIaP5.mjs";import{default as y}from"./packem_shared/createConnectionStatus-D8bC05Jn.mjs";import{createFlag as P,createFlags as S}from"./packem_shared/createFlag-Bww9WQUu.mjs";import{createLiveTopic as M}from"./packem_shared/createLiveTopic-CgkjI8l8.mjs";import{createMutation as T,createMutationForClient as b}from"./packem_shared/createMutation-DM2mXpq3.mjs";import{createMutator as I}from"./packem_shared/createMutator-q9cMjGKv.mjs";import{createInfiniteQuery as U,createPaginatedQuery as V}from"./packem_shared/createInfiniteQuery-CwGPFeuc.mjs";import{createPresence as k}from"./packem_shared/createPresence-DkTotieP.mjs";import{createQuery as w}from"./packem_shared/createQuery-oNQqVGjE.mjs";import{createRateLimit as B}from"./packem_shared/createRateLimit-CIVWrD5H.mjs";import{createStream as G}from"./packem_shared/createStream-CCAOb9q1.mjs";import{createSubscription as J}from"./packem_shared/createSubscription-DiyhxkoK.mjs";import{createVoiceAgent as N}from"./packem_shared/createVoiceAgent-BtRfW4lS.mjs";import{default as W}from"./packem_shared/hydratePreloaded-DCi296oW.mjs";import{LunoraProvider as Y}from"./packem_shared/LunoraProvider-DMhpuxvx.mjs";export{l as AuthLoading,s as Authenticated,r as LunoraContext,Y as LunoraProvider,h as Unauthenticated,c as createAction,n as createActionForClient,m as createAgent,x as createAgentChat,u as createAgentState,A as createAgentToolEvents,L as createAuth,y as createConnectionStatus,P as createFlag,S as createFlags,U as createInfiniteQuery,M as createLiveTopic,T as createMutation,b as createMutationForClient,I as createMutator,V as createPaginatedQuery,k as createPresence,w as createQuery,B as createRateLimit,G as createStream,J as createSubscription,N as createVoiceAgent,W as hydratePreloaded,o as useLunora};
@@ -0,0 +1 @@
1
+ import{subscribeLiveTopic as m,liveTopicSubscription as d}from"@lunora/client";import{createSignal as i}from"solid-js";import{useLunora as y}from"./LunoraContext-BWsj_3CK.mjs";import{t as E}from"./reactive-args-qKMBsFpd.mjs";const p=e=>({headers:e.headers,maxDelayMs:e.maxDelayMs,retryDelay:e.retryDelay,sessionKey:e.sessionKey,topic:e.topic,url:e.url,withCredentials:e.withCredentials}),T=(e,t={})=>{const c=y(),a=typeof e=="function"?e:()=>e,v=typeof t=="function"?t:()=>t,o=()=>d(c,a(),v()),[l,s]=i(void 0),[u,n]=i(void 0);return E(()=>p(o()),f=>(s(()=>{}),n(()=>{}),m({...f,onError:r=>{n(()=>r),o().onError?.(r)},onEvent:r=>{s(()=>r),n(()=>{}),o().onEvent?.(r)}}))),{error:u,lastEvent:l}};export{T as createLiveTopic};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/solid",
3
- "version": "1.0.0-alpha.236",
3
+ "version": "1.0.0-alpha.238",
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.227",
57
+ "@lunora/client": "1.0.0-alpha.229",
58
58
  "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
59
- "@lunora/ratelimit": "1.0.0-alpha.150",
59
+ "@lunora/ratelimit": "1.0.0-alpha.152",
60
60
  "@lunora/wire": "1.0.0-alpha.1",
61
61
  "@visulima/storage-client": "1.0.9"
62
62
  },