@lunora/react 1.0.0-alpha.240 → 1.0.0-alpha.242
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 +3 -0
- package/dist/index.d.mts +29 -2
- package/dist/index.d.ts +29 -2
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/useLiveTopic-UYAE2s4R.mjs +2 -0
- package/package.json +3 -3
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(topic, options?)` | `{ lastEvent, error }` | Follows one declared live topic over an SSE connection shared by stream route. 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(topic, options?)` follows one topic a `defineLiveStream` declares. Pass the reference `_generated/live.ts` hands out, e.g. `useLiveTopic(live.posts.post({ postId }), { onEvent })`: the stream's route is resolved against the `LunoraClient` from `<LunoraProvider>`, so there is no URL or topic string to write, and `lastEvent` and `onEvent` are typed by the payload the topic declares. The SSE connection is shared by stream route and connection options: hooks with the same route, `shardKey`, `sessionKey`, credentials, headers and retry tuning ride 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. Options are `onEvent`, `onError`, `shardKey` (follow a `.shardBy` shard, and publish to the same one), `sessionKey` (partitions the shared connection: a changed value opens a new one and closes the old, for example on sign-out; it is never sent to the server), and the transport tuning `headers`, `withCredentials`, `retryDelay`, `maxDelayMs`. 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, LiveTopicOptions, LiveStreamSubscribeError, LiveTopicRef, 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,33 @@ 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 transport tuning and callbacks, with the callbacks read through a ref. */
|
|
957
|
+
type UseLiveTopicOptions<Payload = unknown> = LiveTopicOptions<Payload>;
|
|
958
|
+
interface UseLiveTopicResult<Payload = unknown> {
|
|
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: Payload | undefined;
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* `useLiveTopic` — follow one live topic of a `defineLiveStream` for the life of
|
|
966
|
+
* the component. Pass the reference `_generated/live.ts` hands out
|
|
967
|
+
* (`live.posts.post({ postId })`): the stream's route is resolved against the
|
|
968
|
+
* `LunoraClient` from the nearest `<LunoraProvider>`, and `lastEvent` and `onEvent`
|
|
969
|
+
* are typed by the payload the topic declares.
|
|
970
|
+
*
|
|
971
|
+
* It is a lifecycle wrapper over `subscribeLiveTopic`: the connection itself is
|
|
972
|
+
* shared by URL, so mounting this hook ten times still opens one stream. It
|
|
973
|
+
* subscribes on mount, unsubscribes on unmount, and resubscribes only when the
|
|
974
|
+
* connection inputs (topic, shard, credentials, headers, retry tuning) change.
|
|
975
|
+
* Building the reference inline on every render is fine, since only its content
|
|
976
|
+
* counts. Changing `onEvent` or `onError` identity does not resubscribe — the
|
|
977
|
+
* latest callback is read through a ref.
|
|
978
|
+
*
|
|
979
|
+
* It is a no-op during SSR: effects do not run on the server, so the hook returns
|
|
980
|
+
* its initial values there.
|
|
981
|
+
*/
|
|
982
|
+
declare function useLiveTopic<Payload>(topic: LiveTopicRef<Payload>, options?: UseLiveTopicOptions<Payload>): UseLiveTopicResult<Payload>;
|
|
956
983
|
type CallOptions<F extends FunctionReference> = UseMutationCallOptions<unknown, unknown, ArgsOf<F>>;
|
|
957
984
|
interface MutationHook<F extends FunctionReference> {
|
|
958
985
|
/** The latest invocation's resolved value, or `undefined` before the first success. */
|
|
@@ -1413,4 +1440,4 @@ interface UseVoiceAgentResult {
|
|
|
1413
1440
|
* `createSocket`) so the hook is drivable outside a browser.
|
|
1414
1441
|
*/
|
|
1415
1442
|
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 };
|
|
1443
|
+
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, LiveTopicOptions, LiveStreamSubscribeError, LiveTopicRef, 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,33 @@ 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 transport tuning and callbacks, with the callbacks read through a ref. */
|
|
957
|
+
type UseLiveTopicOptions<Payload = unknown> = LiveTopicOptions<Payload>;
|
|
958
|
+
interface UseLiveTopicResult<Payload = unknown> {
|
|
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: Payload | undefined;
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* `useLiveTopic` — follow one live topic of a `defineLiveStream` for the life of
|
|
966
|
+
* the component. Pass the reference `_generated/live.ts` hands out
|
|
967
|
+
* (`live.posts.post({ postId })`): the stream's route is resolved against the
|
|
968
|
+
* `LunoraClient` from the nearest `<LunoraProvider>`, and `lastEvent` and `onEvent`
|
|
969
|
+
* are typed by the payload the topic declares.
|
|
970
|
+
*
|
|
971
|
+
* It is a lifecycle wrapper over `subscribeLiveTopic`: the connection itself is
|
|
972
|
+
* shared by URL, so mounting this hook ten times still opens one stream. It
|
|
973
|
+
* subscribes on mount, unsubscribes on unmount, and resubscribes only when the
|
|
974
|
+
* connection inputs (topic, shard, credentials, headers, retry tuning) change.
|
|
975
|
+
* Building the reference inline on every render is fine, since only its content
|
|
976
|
+
* counts. Changing `onEvent` or `onError` identity does not resubscribe — the
|
|
977
|
+
* latest callback is read through a ref.
|
|
978
|
+
*
|
|
979
|
+
* It is a no-op during SSR: effects do not run on the server, so the hook returns
|
|
980
|
+
* its initial values there.
|
|
981
|
+
*/
|
|
982
|
+
declare function useLiveTopic<Payload>(topic: LiveTopicRef<Payload>, options?: UseLiveTopicOptions<Payload>): UseLiveTopicResult<Payload>;
|
|
956
983
|
type CallOptions<F extends FunctionReference> = UseMutationCallOptions<unknown, unknown, ArgsOf<F>>;
|
|
957
984
|
interface MutationHook<F extends FunctionReference> {
|
|
958
985
|
/** The latest invocation's resolved value, or `undefined` before the first success. */
|
|
@@ -1413,4 +1440,4 @@ interface UseVoiceAgentResult {
|
|
|
1413
1440
|
* `createSocket`) so the hook is drivable outside a browser.
|
|
1414
1441
|
*/
|
|
1415
1442
|
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 };
|
|
1443
|
+
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
|
|
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-UYAE2s4R.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 D}from"react/compiler-runtime";import{liveTopicSubscription as R,subscribeLiveTopic as C}from"@lunora/client";import{stableWireKey as M}from"@lunora/wire";import{useState as W,useRef as $,useEffect as y}from"react";import{u as g}from"./lunora-provider-_WqSuvf9.mjs";function F(b,f){const t=D(8),d=f===void 0?{}:f,o=R(g(),b,d),{headers:k,maxDelayMs:T,retryDelay:K,sessionKey:L,topic:S,url:h,withCredentials:w}=o,e=M({headers:k,maxDelayMs:T,retryDelay:K,sessionKey:L,topic:S,url:h,withCredentials:w}),[p,l]=W(),m=p?.key===e?p:void 0,s=$(o);let n;t[0]!==o?(n=()=>{s.current=o},t[0]=o,t[1]=n):n=t[1],y(n);let i,c;t[2]!==e?(i=()=>{const x=C({...s.current,onError:r=>{l(E=>({error:r,key:e,lastEvent:E?.key===e?E.lastEvent:void 0})),s.current.onError?.(r)},onEvent:r=>{l({error:void 0,key:e,lastEvent:r}),s.current.onEvent?.(r)}});return()=>{x(),l(void 0)}},c=[e],t[2]=e,t[3]=i,t[4]=c):(i=t[3],c=t[4]),y(i,c);const a=m?.error,v=m?.lastEvent;let u;return t[5]!==a||t[6]!==v?(u={error:a,lastEvent:v},t[5]=a,t[6]=v,t[7]=u):u=t[7],u}export{F as useLiveTopic};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/react",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.242",
|
|
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.
|
|
60
|
+
"@lunora/client": "1.0.0-alpha.229",
|
|
61
61
|
"@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
|
|
62
|
-
"@lunora/ratelimit": "1.0.0-alpha.
|
|
62
|
+
"@lunora/ratelimit": "1.0.0-alpha.152",
|
|
63
63
|
"@lunora/wire": "1.0.0-alpha.1",
|
|
64
64
|
"@visulima/storage-client": "1.0.9"
|
|
65
65
|
},
|