@lunora/react 1.0.0-alpha.240 → 1.0.0-alpha.241

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
@@ -103,6 +103,7 @@ function MessageList({ room }: { room: string }) {
103
103
  | `useInfiniteQuery(fn, args, { initialNumItems, onError? })` | `{ pages, status, hasNextPage, fetchNextPage, error, … }` | Page-array variant of the same paginator. |
104
104
  | `usePreloadedQuery(preloaded, options?)` | `T \| undefined` | Reads a server `Preloaded` token, then goes live. Pass `onError` to see a session expiry instead of rendering the stale SSR snapshot. |
105
105
  | `usePresence(roomId, { heartbeat, listPresent, … })` | `{ present, sessionId, setData, error }` | Drives the `definePresence` heartbeat + list functions. `roomId` is a positional first argument, not an option. |
106
+ | `useLiveTopic(options)` | `{ lastEvent, error }` | Follows one topic of a `defineLiveStream` over an SSE connection shared by URL. See the note below the table. |
106
107
  | `useFlag(key, default)` | flag value (live) | Live OpenFeature flag over the WS; reads `default` until the server answers. Evaluated under the socket's server-verified identity. |
107
108
  | `useFlags(defaults)` | `{ [key]: value }` | Batch variant — one live value per key in the `defaults` map. |
108
109
  | `useStream(fn, args, options?)` | `{ chunks, status, error, cancel }` | Consumes a streamed action response chunk by chunk. |
@@ -118,6 +119,8 @@ function MessageList({ room }: { room: string }) {
118
119
 
119
120
  The payment kit — `CheckoutButton`, `CustomerPortalButton`, and `useCheckout`, which wrap `@lunora/payment` flows — ships from the `@lunora/react/payment` subpath, not the package root: it renders a DOM `<button>` and navigates via `globalThis.location`, so it is the one part of this package that is browser-only (the root barrel stays renderer-agnostic, which is what lets `@lunora/react-native` re-export it wholesale).
120
121
 
122
+ `useLiveTopic(options)` follows one topic of a `defineLiveStream` route. The SSE connection is shared by `url`: every live-topic hook on the page rides one stream, and it closes after the last one unmounts. `lastEvent` is the last payload delivered on the topic, and `error` is set when the shard refuses the subscription. Changing `onEvent` or `onError` does not resubscribe. It opens nothing during SSR.
123
+
121
124
  `useVoiceAgent` opens nothing until you call `startCall()` — that is what requests the microphone, so it has to run from a user gesture; `endCall()` releases the socket, the mic tracks and the Web Audio graph, and also runs on unmount. See the [voice-agent docs](https://lunora.sh/docs/packages/react#voice-agents--usevoiceagentoptions) for the silence/barge-in thresholds.
122
125
 
123
126
  ## Server Components
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ReactNode, ReactElement } from 'react';
2
- import { LunoraClient, OptimisticUpdate, User, SubscriptionErrorCallback, SubscriptionError, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, AuthImpersonation, AuthSession, AuthUser, ClientQueryRef, ConnectionStatus, HttpStreamRef, HttpStreamArgsOf, HttpStreamChunkOf, MutatorHandle, Preloaded } from '@lunora/client';
2
+ import { LunoraClient, OptimisticUpdate, User, SubscriptionErrorCallback, SubscriptionError, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, AuthImpersonation, AuthSession, AuthUser, ClientQueryRef, ConnectionStatus, HttpStreamRef, HttpStreamArgsOf, HttpStreamChunkOf, SubscribeLiveTopicOptions, LiveStreamSubscribeError, MutatorHandle, Preloaded } from '@lunora/client';
3
3
  export { type ArgsOf, type AuthImpersonation, type AuthPage, type AuthSession, type AuthUser, type ClientQueryRef, type FunctionReference, type HttpStreamArgsOf, type HttpStreamChunkOf, type HttpStreamRef, type LunoraClient, type LunoraErrorCode, type MutatorHandle, type MutatorTransaction, type OptimisticLocalStore, type OptimisticUpdate, type Preloaded, type ReturnOf, type SubscriptionError, type SubscriptionErrorCallback, type User, createClientQuery, getErrorCode, getRetryAfterMs, isConflictError, isForbiddenError, isRateLimitedError, isUnauthorizedError } from '@lunora/client';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
5
  export { type L as LunoraQueryOptions, l as lunoraQueryOptions } from "./packem_shared/query-options.d-CdgGQ9s4.mjs";
@@ -953,6 +953,29 @@ declare const usePaginatedQuery: <F extends FunctionReference>(function_: F, arg
953
953
  * keyset implementation.
954
954
  */
955
955
  declare const useInfiniteQuery: <F extends FunctionReference>(function_: F, args: "skip" | PaginatedArgs<F>, options: UseInfiniteQueryOptions) => UseInfiniteQueryResult<PageItemOf<F>>;
956
+ /** Options for {@link useLiveTopic}: the `subscribeLiveTopic` options, with the callbacks read through a ref. */
957
+ type UseLiveTopicOptions = SubscribeLiveTopicOptions;
958
+ interface UseLiveTopicResult {
959
+ /** Set when the shard refuses the subscription (403, 409, 429 and similar). */
960
+ error: LiveStreamSubscribeError | undefined;
961
+ /** The last payload delivered on the topic, or `undefined` until the first event. */
962
+ lastEvent: unknown;
963
+ }
964
+ /**
965
+ * `useLiveTopic` — follow one live topic of a `defineLiveStream` for the life of
966
+ * the component.
967
+ *
968
+ * It is a lifecycle wrapper over `subscribeLiveTopic`: the connection itself is
969
+ * shared by URL, so mounting this hook ten times still opens one stream. It
970
+ * subscribes on mount, unsubscribes on unmount, and resubscribes only when the
971
+ * connection inputs (`url`, `topic`, credentials, headers, retry tuning) change.
972
+ * Changing `onEvent` or `onError` identity does not resubscribe — the latest
973
+ * callback is read through a ref.
974
+ *
975
+ * It is a no-op during SSR: effects do not run on the server, so the hook returns
976
+ * its initial values there.
977
+ */
978
+ declare const useLiveTopic: (options: UseLiveTopicOptions) => UseLiveTopicResult;
956
979
  type CallOptions<F extends FunctionReference> = UseMutationCallOptions<unknown, unknown, ArgsOf<F>>;
957
980
  interface MutationHook<F extends FunctionReference> {
958
981
  /** The latest invocation's resolved value, or `undefined` before the first success. */
@@ -1413,4 +1436,4 @@ interface UseVoiceAgentResult {
1413
1436
  * `createSocket`) so the hook is drivable outside a browser.
1414
1437
  */
1415
1438
  declare const useVoiceAgent: (options: UseVoiceAgentOptions) => UseVoiceAgentResult;
1416
- export { type ActionHook, type AdminAuthListResult, type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, type AuthState, Authenticated, type FlagValue, type HeartbeatReference, type ListPresentReference, LunoraProvider, type LunoraProviderProps, type MutationHook, type MutatorHook, type PageItemOf, type PaginatedArgs, Unauthenticated, type UseAgentApi, type UseAgentChatApi, type UseAgentChatOptions, type UseAgentChatResult, type UseAgentOptions, type UseAgentResult, type UseAgentStateApi, type UseAgentStateOptions, type UseAgentStateResult, type UseAgentToolEventsApi, type UseAgentToolEventsOptions, type UseAgentToolEventsResult, type UseAuthResult, type UseAuthSessionsOptions, type UseAuthUsersOptions, type UseHttpStreamOptions, type UseHttpStreamResult, type UseImpersonateResult, type UseInfiniteQueryOptions, type UseInfiniteQueryResult, type UseMutationCallOptions, type UseOrganizationsOptions, type UsePaginatedQueryOptions, type UsePaginatedQueryResult, type UsePresenceOptions, type UsePresenceResult, type UseQueryOptions, type UseRateLimitOptions, type UseRateLimitResult, type UseSignUpInvitationsOptions, type UseStreamOptions, type UseStreamResult, type UseStreamStatus, type UseSubscriptionResult, type UseVoiceAgentOptions, type UseVoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, hydratePreloaded, useAction, useAgent, useAgentChat, useAgentState, useAgentToolEvents, useAuth, useAuthSessions, useAuthState, useAuthUsers, useClientQuery, useConnectionStatus, useFlag, useFlags, useHttpStream, useImpersonate, useInfiniteQuery, useLunora, useMutation, useMutator, useOrganizations, usePaginatedQuery, usePreloadedQuery, usePresence, useQuery, useRateLimit, useSignUpInvitations, useStream, useSubscription, useVoiceAgent };
1439
+ export { type ActionHook, type AdminAuthListResult, type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, type AuthState, Authenticated, type FlagValue, type HeartbeatReference, type ListPresentReference, LunoraProvider, type LunoraProviderProps, type MutationHook, type MutatorHook, type PageItemOf, type PaginatedArgs, Unauthenticated, type UseAgentApi, type UseAgentChatApi, type UseAgentChatOptions, type UseAgentChatResult, type UseAgentOptions, type UseAgentResult, type UseAgentStateApi, type UseAgentStateOptions, type UseAgentStateResult, type UseAgentToolEventsApi, type UseAgentToolEventsOptions, type UseAgentToolEventsResult, type UseAuthResult, type UseAuthSessionsOptions, type UseAuthUsersOptions, type UseHttpStreamOptions, type UseHttpStreamResult, type UseImpersonateResult, type UseInfiniteQueryOptions, type UseInfiniteQueryResult, type UseLiveTopicOptions, type UseLiveTopicResult, type UseMutationCallOptions, type UseOrganizationsOptions, type UsePaginatedQueryOptions, type UsePaginatedQueryResult, type UsePresenceOptions, type UsePresenceResult, type UseQueryOptions, type UseRateLimitOptions, type UseRateLimitResult, type UseSignUpInvitationsOptions, type UseStreamOptions, type UseStreamResult, type UseStreamStatus, type UseSubscriptionResult, type UseVoiceAgentOptions, type UseVoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, hydratePreloaded, useAction, useAgent, useAgentChat, useAgentState, useAgentToolEvents, useAuth, useAuthSessions, useAuthState, useAuthUsers, useClientQuery, useConnectionStatus, useFlag, useFlags, useHttpStream, useImpersonate, useInfiniteQuery, useLiveTopic, useLunora, useMutation, useMutator, useOrganizations, usePaginatedQuery, usePreloadedQuery, usePresence, useQuery, useRateLimit, useSignUpInvitations, useStream, useSubscription, useVoiceAgent };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ReactNode, ReactElement } from 'react';
2
- import { LunoraClient, OptimisticUpdate, User, SubscriptionErrorCallback, SubscriptionError, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, AuthImpersonation, AuthSession, AuthUser, ClientQueryRef, ConnectionStatus, HttpStreamRef, HttpStreamArgsOf, HttpStreamChunkOf, MutatorHandle, Preloaded } from '@lunora/client';
2
+ import { LunoraClient, OptimisticUpdate, User, SubscriptionErrorCallback, SubscriptionError, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, AuthImpersonation, AuthSession, AuthUser, ClientQueryRef, ConnectionStatus, HttpStreamRef, HttpStreamArgsOf, HttpStreamChunkOf, SubscribeLiveTopicOptions, LiveStreamSubscribeError, MutatorHandle, Preloaded } from '@lunora/client';
3
3
  export { type ArgsOf, type AuthImpersonation, type AuthPage, type AuthSession, type AuthUser, type ClientQueryRef, type FunctionReference, type HttpStreamArgsOf, type HttpStreamChunkOf, type HttpStreamRef, type LunoraClient, type LunoraErrorCode, type MutatorHandle, type MutatorTransaction, type OptimisticLocalStore, type OptimisticUpdate, type Preloaded, type ReturnOf, type SubscriptionError, type SubscriptionErrorCallback, type User, createClientQuery, getErrorCode, getRetryAfterMs, isConflictError, isForbiddenError, isRateLimitedError, isUnauthorizedError } from '@lunora/client';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
5
  export { type L as LunoraQueryOptions, l as lunoraQueryOptions } from "./packem_shared/query-options.d-CdgGQ9s4.js";
@@ -953,6 +953,29 @@ declare const usePaginatedQuery: <F extends FunctionReference>(function_: F, arg
953
953
  * keyset implementation.
954
954
  */
955
955
  declare const useInfiniteQuery: <F extends FunctionReference>(function_: F, args: "skip" | PaginatedArgs<F>, options: UseInfiniteQueryOptions) => UseInfiniteQueryResult<PageItemOf<F>>;
956
+ /** Options for {@link useLiveTopic}: the `subscribeLiveTopic` options, with the callbacks read through a ref. */
957
+ type UseLiveTopicOptions = SubscribeLiveTopicOptions;
958
+ interface UseLiveTopicResult {
959
+ /** Set when the shard refuses the subscription (403, 409, 429 and similar). */
960
+ error: LiveStreamSubscribeError | undefined;
961
+ /** The last payload delivered on the topic, or `undefined` until the first event. */
962
+ lastEvent: unknown;
963
+ }
964
+ /**
965
+ * `useLiveTopic` — follow one live topic of a `defineLiveStream` for the life of
966
+ * the component.
967
+ *
968
+ * It is a lifecycle wrapper over `subscribeLiveTopic`: the connection itself is
969
+ * shared by URL, so mounting this hook ten times still opens one stream. It
970
+ * subscribes on mount, unsubscribes on unmount, and resubscribes only when the
971
+ * connection inputs (`url`, `topic`, credentials, headers, retry tuning) change.
972
+ * Changing `onEvent` or `onError` identity does not resubscribe — the latest
973
+ * callback is read through a ref.
974
+ *
975
+ * It is a no-op during SSR: effects do not run on the server, so the hook returns
976
+ * its initial values there.
977
+ */
978
+ declare const useLiveTopic: (options: UseLiveTopicOptions) => UseLiveTopicResult;
956
979
  type CallOptions<F extends FunctionReference> = UseMutationCallOptions<unknown, unknown, ArgsOf<F>>;
957
980
  interface MutationHook<F extends FunctionReference> {
958
981
  /** The latest invocation's resolved value, or `undefined` before the first success. */
@@ -1413,4 +1436,4 @@ interface UseVoiceAgentResult {
1413
1436
  * `createSocket`) so the hook is drivable outside a browser.
1414
1437
  */
1415
1438
  declare const useVoiceAgent: (options: UseVoiceAgentOptions) => UseVoiceAgentResult;
1416
- export { type ActionHook, type AdminAuthListResult, type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, type AuthState, Authenticated, type FlagValue, type HeartbeatReference, type ListPresentReference, LunoraProvider, type LunoraProviderProps, type MutationHook, type MutatorHook, type PageItemOf, type PaginatedArgs, Unauthenticated, type UseAgentApi, type UseAgentChatApi, type UseAgentChatOptions, type UseAgentChatResult, type UseAgentOptions, type UseAgentResult, type UseAgentStateApi, type UseAgentStateOptions, type UseAgentStateResult, type UseAgentToolEventsApi, type UseAgentToolEventsOptions, type UseAgentToolEventsResult, type UseAuthResult, type UseAuthSessionsOptions, type UseAuthUsersOptions, type UseHttpStreamOptions, type UseHttpStreamResult, type UseImpersonateResult, type UseInfiniteQueryOptions, type UseInfiniteQueryResult, type UseMutationCallOptions, type UseOrganizationsOptions, type UsePaginatedQueryOptions, type UsePaginatedQueryResult, type UsePresenceOptions, type UsePresenceResult, type UseQueryOptions, type UseRateLimitOptions, type UseRateLimitResult, type UseSignUpInvitationsOptions, type UseStreamOptions, type UseStreamResult, type UseStreamStatus, type UseSubscriptionResult, type UseVoiceAgentOptions, type UseVoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, hydratePreloaded, useAction, useAgent, useAgentChat, useAgentState, useAgentToolEvents, useAuth, useAuthSessions, useAuthState, useAuthUsers, useClientQuery, useConnectionStatus, useFlag, useFlags, useHttpStream, useImpersonate, useInfiniteQuery, useLunora, useMutation, useMutator, useOrganizations, usePaginatedQuery, usePreloadedQuery, usePresence, useQuery, useRateLimit, useSignUpInvitations, useStream, useSubscription, useVoiceAgent };
1439
+ export { type ActionHook, type AdminAuthListResult, type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, type AuthState, Authenticated, type FlagValue, type HeartbeatReference, type ListPresentReference, LunoraProvider, type LunoraProviderProps, type MutationHook, type MutatorHook, type PageItemOf, type PaginatedArgs, Unauthenticated, type UseAgentApi, type UseAgentChatApi, type UseAgentChatOptions, type UseAgentChatResult, type UseAgentOptions, type UseAgentResult, type UseAgentStateApi, type UseAgentStateOptions, type UseAgentStateResult, type UseAgentToolEventsApi, type UseAgentToolEventsOptions, type UseAgentToolEventsResult, type UseAuthResult, type UseAuthSessionsOptions, type UseAuthUsersOptions, type UseHttpStreamOptions, type UseHttpStreamResult, type UseImpersonateResult, type UseInfiniteQueryOptions, type UseInfiniteQueryResult, type UseLiveTopicOptions, type UseLiveTopicResult, type UseMutationCallOptions, type UseOrganizationsOptions, type UsePaginatedQueryOptions, type UsePaginatedQueryResult, type UsePresenceOptions, type UsePresenceResult, type UseQueryOptions, type UseRateLimitOptions, type UseRateLimitResult, type UseSignUpInvitationsOptions, type UseStreamOptions, type UseStreamResult, type UseStreamStatus, type UseSubscriptionResult, type UseVoiceAgentOptions, type UseVoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, hydratePreloaded, useAction, useAgent, useAgentChat, useAgentState, useAgentToolEvents, useAuth, useAuthSessions, useAuthState, useAuthUsers, useClientQuery, useConnectionStatus, useFlag, useFlags, useHttpStream, useImpersonate, useInfiniteQuery, useLiveTopic, useLunora, useMutation, useMutator, useOrganizations, usePaginatedQuery, usePreloadedQuery, usePresence, useQuery, useRateLimit, useSignUpInvitations, useStream, useSubscription, useVoiceAgent };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{AuthLoading as o,Authenticated as t,Unauthenticated as u}from"./packem_shared/AuthLoading-024-XH0I.mjs";import{useAuthState as a}from"./packem_shared/useAuthState-CqN1F2FM.mjs";import{L as n,u as f}from"./packem_shared/lunora-provider-_WqSuvf9.mjs";import{lunoraQueryOptions as m}from"./packem_shared/lunoraQueryOptions-IJB_aFzi.mjs";import{useAction as x}from"./packem_shared/useAction-jJl4KPEw.mjs";import{useAuthSessions as g,useAuthUsers as A,useImpersonate as h,useOrganizations as U,useSignUpInvitations as c}from"./packem_shared/useAuthSessions-jJWdw8Zw.mjs";import{useAgent as C}from"./packem_shared/useAgent-C2jMXz2-.mjs";import{useAgentChat as S}from"./packem_shared/useAgentChat-DiBCl0Rr.mjs";import{useAgentState as L}from"./packem_shared/useAgentState-CDAO3aLL.mjs";import{useAgentToolEvents as R}from"./packem_shared/useAgentToolEvents-Bb94yV7R.mjs";import{default as I}from"./packem_shared/useAuth-CpGKVRsv.mjs";import{default as v}from"./packem_shared/useClientQuery-DUEUAqPh.mjs";import{default as z}from"./packem_shared/useConnectionStatus-Dtx_OWez.mjs";import{useFlag as T,useFlags as k}from"./packem_shared/useFlag-A7XPHExt.mjs";import{useHttpStream as V}from"./packem_shared/useHttpStream-CzryjxVH.mjs";import{default as q}from"./packem_shared/useInfiniteQuery-D_AG59dX.mjs";import{useMutation as B}from"./packem_shared/useMutation-Bz9uwvGf.mjs";import{useMutator as G}from"./packem_shared/useMutator-BtUd-xEA.mjs";import{usePaginatedQuery as K}from"./packem_shared/usePaginatedQuery-DhQAsxgX.mjs";import{hydratePreloaded as W,default as X}from"./packem_shared/hydratePreloaded-qs8nspKB.mjs";import{usePresence as Z}from"./packem_shared/usePresence-X5Ax04Cf.mjs";import{default as $}from"./packem_shared/useQuery-CETQat99.mjs";import{useRateLimit as re}from"./packem_shared/useRateLimit-Cckxi8m9.mjs";import{useStream as te}from"./packem_shared/useStream-D8GB__4j.mjs";import{default as se}from"./packem_shared/useSubscription-CwZgOrE4.mjs";import{useVoiceAgent as pe}from"./packem_shared/useVoiceAgent-DAh27XxD.mjs";import{createClientQuery as fe,getErrorCode as ie,getRetryAfterMs as me,isConflictError as de,isForbiddenError as xe,isRateLimitedError as le,isUnauthorizedError as ge}from"@lunora/client";import{RestrictionError as he,UploadControl as Ue,UploadError as ce}from"@visulima/storage-client";import{useChunkedRestUpload as Ce,useFileInput as Ee,useMultipartUpload as Se,usePasteUpload as Qe,useTusUpload as Le,useUpload as Pe}from"@visulima/storage-client/react";export{o as AuthLoading,t as Authenticated,n as LunoraProvider,he as RestrictionError,u as Unauthenticated,Ue as UploadControl,ce as UploadError,fe as createClientQuery,ie as getErrorCode,me as getRetryAfterMs,W as hydratePreloaded,de as isConflictError,xe as isForbiddenError,le as isRateLimitedError,ge as isUnauthorizedError,m as lunoraQueryOptions,x as useAction,C as useAgent,S as useAgentChat,L as useAgentState,R as useAgentToolEvents,I as useAuth,g as useAuthSessions,a as useAuthState,A as useAuthUsers,Ce as useChunkedRestUpload,v as useClientQuery,z as useConnectionStatus,Ee as useFileInput,T as useFlag,k as useFlags,V as useHttpStream,h as useImpersonate,q as useInfiniteQuery,f as useLunora,Se as useMultipartUpload,B as useMutation,G as useMutator,U as useOrganizations,K as usePaginatedQuery,Qe as usePasteUpload,X as usePreloadedQuery,Z as usePresence,$ as useQuery,re as useRateLimit,c as useSignUpInvitations,te as useStream,se as useSubscription,Le as useTusUpload,Pe as useUpload,pe as useVoiceAgent};
2
+ import{AuthLoading as o,Authenticated as t,Unauthenticated as u}from"./packem_shared/AuthLoading-024-XH0I.mjs";import{useAuthState as a}from"./packem_shared/useAuthState-CqN1F2FM.mjs";import{L as f,u as n}from"./packem_shared/lunora-provider-_WqSuvf9.mjs";import{lunoraQueryOptions as m}from"./packem_shared/lunoraQueryOptions-IJB_aFzi.mjs";import{useAction as x}from"./packem_shared/useAction-jJl4KPEw.mjs";import{useAuthSessions as g,useAuthUsers as A,useImpersonate as c,useOrganizations as h,useSignUpInvitations as U}from"./packem_shared/useAuthSessions-jJWdw8Zw.mjs";import{useAgent as C}from"./packem_shared/useAgent-C2jMXz2-.mjs";import{useAgentChat as S}from"./packem_shared/useAgentChat-DiBCl0Rr.mjs";import{useAgentState as Q}from"./packem_shared/useAgentState-CDAO3aLL.mjs";import{useAgentToolEvents as R}from"./packem_shared/useAgentToolEvents-Bb94yV7R.mjs";import{default as F}from"./packem_shared/useAuth-CpGKVRsv.mjs";import{default as M}from"./packem_shared/useClientQuery-DUEUAqPh.mjs";import{default as b}from"./packem_shared/useConnectionStatus-Dtx_OWez.mjs";import{useFlag as O,useFlags as k}from"./packem_shared/useFlag-A7XPHExt.mjs";import{useHttpStream as V}from"./packem_shared/useHttpStream-CzryjxVH.mjs";import{default as q}from"./packem_shared/useInfiniteQuery-D_AG59dX.mjs";import{useLiveTopic as B}from"./packem_shared/useLiveTopic-C6a6nMn0.mjs";import{useMutation as G}from"./packem_shared/useMutation-Bz9uwvGf.mjs";import{useMutator as K}from"./packem_shared/useMutator-BtUd-xEA.mjs";import{usePaginatedQuery as W}from"./packem_shared/usePaginatedQuery-DhQAsxgX.mjs";import{hydratePreloaded as Y,default as Z}from"./packem_shared/hydratePreloaded-qs8nspKB.mjs";import{usePresence as $}from"./packem_shared/usePresence-X5Ax04Cf.mjs";import{default as re}from"./packem_shared/useQuery-CETQat99.mjs";import{useRateLimit as te}from"./packem_shared/useRateLimit-Cckxi8m9.mjs";import{useStream as se}from"./packem_shared/useStream-D8GB__4j.mjs";import{default as pe}from"./packem_shared/useSubscription-CwZgOrE4.mjs";import{useVoiceAgent as ne}from"./packem_shared/useVoiceAgent-DAh27XxD.mjs";import{createClientQuery as me,getErrorCode as de,getRetryAfterMs as xe,isConflictError as le,isForbiddenError as ge,isRateLimitedError as Ae,isUnauthorizedError as ce}from"@lunora/client";import{RestrictionError as Ue,UploadControl as ye,UploadError as Ce}from"@visulima/storage-client";import{useChunkedRestUpload as Se,useFileInput as Le,useMultipartUpload as Qe,usePasteUpload as Pe,useTusUpload as Re,useUpload as ve}from"@visulima/storage-client/react";export{o as AuthLoading,t as Authenticated,f as LunoraProvider,Ue as RestrictionError,u as Unauthenticated,ye as UploadControl,Ce as UploadError,me as createClientQuery,de as getErrorCode,xe as getRetryAfterMs,Y as hydratePreloaded,le as isConflictError,ge as isForbiddenError,Ae as isRateLimitedError,ce as isUnauthorizedError,m as lunoraQueryOptions,x as useAction,C as useAgent,S as useAgentChat,Q as useAgentState,R as useAgentToolEvents,F as useAuth,g as useAuthSessions,a as useAuthState,A as useAuthUsers,Se as useChunkedRestUpload,M as useClientQuery,b as useConnectionStatus,Le as useFileInput,O as useFlag,k as useFlags,V as useHttpStream,c as useImpersonate,q as useInfiniteQuery,B as useLiveTopic,n as useLunora,Qe as useMultipartUpload,G as useMutation,K as useMutator,h as useOrganizations,W as usePaginatedQuery,Pe as usePasteUpload,Z as usePreloadedQuery,$ as usePresence,re as useQuery,te as useRateLimit,U as useSignUpInvitations,se as useStream,pe as useSubscription,Re as useTusUpload,ve as useUpload,ne as useVoiceAgent};
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ import{c as R}from"react/compiler-runtime";import{subscribeLiveTopic as S}from"@lunora/client";import{stableWireKey as T}from"@lunora/wire";import{useState as w,useRef as C,useEffect as D}from"react";const j=r=>{const e=R(16),{headers:a,maxDelayMs:f,retryDelay:v,sessionKey:E,topic:m,url:y,withCredentials:b}=r;let n;e[0]!==a||e[1]!==f||e[2]!==v||e[3]!==E||e[4]!==m||e[5]!==y||e[6]!==b?(n=T({headers:a,maxDelayMs:f,retryDelay:v,sessionKey:E,topic:m,url:y,withCredentials:b}),e[0]=a,e[1]=f,e[2]=v,e[3]=E,e[4]=m,e[5]=y,e[6]=b,e[7]=n):n=e[7];const t=n,[h,d]=w(),p=h?.key===t?h:void 0,o=C(r);let c;e[8]!==r?(c=()=>{o.current=r},e[8]=r,e[9]=c):c=e[9],D(c);let i,l;e[10]!==t?(i=()=>{const L=S({...o.current,onError:s=>{d(x=>({error:s,key:t,lastEvent:x?.key===t?x.lastEvent:void 0})),o.current.onError?.(s)},onEvent:s=>{d({error:void 0,key:t,lastEvent:s}),o.current.onEvent?.(s)}});return()=>{L(),d(void 0)}},l=[t],e[10]=t,e[11]=i,e[12]=l):(i=e[11],l=e[12]),D(i,l);const k=p?.error,K=p?.lastEvent;let u;return e[13]!==k||e[14]!==K?(u={error:k,lastEvent:K},e[13]=k,e[14]=K,e[15]=u):u=e[15],u};export{j as useLiveTopic};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/react",
3
- "version": "1.0.0-alpha.240",
3
+ "version": "1.0.0-alpha.241",
4
4
  "description": "React hooks for Lunora: useQuery, useMutation, useSubscription, and useAuth",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -57,9 +57,9 @@
57
57
  "access": "public"
58
58
  },
59
59
  "dependencies": {
60
- "@lunora/client": "1.0.0-alpha.227",
60
+ "@lunora/client": "1.0.0-alpha.228",
61
61
  "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
62
- "@lunora/ratelimit": "1.0.0-alpha.150",
62
+ "@lunora/ratelimit": "1.0.0-alpha.151",
63
63
  "@lunora/wire": "1.0.0-alpha.1",
64
64
  "@visulima/storage-client": "1.0.9"
65
65
  },