@lunora/react 1.0.0-alpha.26 → 1.0.0-alpha.28
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 +62 -28
- package/dist/index.d.ts +62 -28
- package/dist/index.mjs +15 -14
- package/dist/packem_shared/{cache-D1O_xfAe.mjs → cache-JeuDAXfE.mjs} +1 -1
- package/dist/packem_shared/{hydratePreloaded-uMDH_xA9.mjs → hydratePreloaded-2omLtadR.mjs} +2 -2
- package/dist/packem_shared/{lunoraQueryOptions-C3uwOTMW.mjs → lunoraQueryOptions-CefbPBId.mjs} +1 -1
- package/dist/packem_shared/{query-key-BmCbgidV.mjs → query-key-LGnArBTB.mjs} +2 -2
- package/dist/packem_shared/{stable-key-CGp4e2Ux.mjs → stable-key-DePnevIy.mjs} +2 -2
- package/dist/packem_shared/{use-paginated-core-DafedU4l.mjs → use-paginated-core-xxvd1YA0.mjs} +2 -2
- package/dist/packem_shared/{useAgent-DwLxTc3P.mjs → useAgent-BNLlIYHz.mjs} +1 -1
- package/dist/packem_shared/{useAgentChat-WPm5iHgR.mjs → useAgentChat-0cebQe7-.mjs} +83 -62
- package/dist/packem_shared/{useAgentState-Cikdlomg.mjs → useAgentState-Cqyd3Dfy.mjs} +1 -1
- package/dist/packem_shared/{useAgentToolEvents-BM7ERo00.mjs → useAgentToolEvents-gF7U4_KY.mjs} +2 -2
- package/dist/packem_shared/useClientQuery-DIkNT4QA.mjs +17 -0
- package/dist/packem_shared/{useFlag-C2Pkghli.mjs → useFlag-Beyeiq2b.mjs} +1 -1
- package/dist/packem_shared/useHttpStream-oc4s1pMy.mjs +127 -0
- package/dist/packem_shared/{useInfiniteQuery-BeaehE9f.mjs → useInfiniteQuery-CJNw1XaZ.mjs} +1 -1
- package/dist/packem_shared/{usePaginatedQuery-_6ETVUmf.mjs → usePaginatedQuery-DWzydaVR.mjs} +1 -1
- package/dist/packem_shared/{useQuery-C-hDzP-t.mjs → useQuery-CE8_QUgh.mjs} +2 -2
- package/dist/packem_shared/{useStream-CGC26afa.mjs → useStream-GYNgc9J5.mjs} +2 -2
- package/dist/packem_shared/{useSubscription-D38Jdyr8.mjs → useSubscription-DcDlvVuI.mjs} +2 -2
- package/dist/packem_shared/{useVoiceAgent-sC5_ADB8.mjs → useVoiceAgent-w7fzAMSB.mjs} +7 -1
- package/dist/packem_shared/wire-key-Bg8BJ8YM.mjs +101 -0
- package/dist/server.mjs +2 -2
- package/package.json +4 -4
- package/dist/packem_shared/useClientQuery-CN1sC3cP.mjs +0 -56
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode, ReactElement } from 'react';
|
|
2
|
-
import { LunoraClient, OptimisticUpdate, User, FunctionReference, ClientQueryRef, ConnectionStatus, ReturnOf,
|
|
3
|
-
export { type ArgsOf, type ClientQueryRef, type FunctionReference, type LunoraClient, type LunoraErrorCode, type MutatorHandle, type MutatorTransaction, type OptimisticLocalStore, type OptimisticUpdate, type Preloaded, type ReturnOf, type User, createClientQuery, getErrorCode, getRetryAfterMs, isConflictError, isForbiddenError, isRateLimitedError, isUnauthorizedError } from '@lunora/client';
|
|
2
|
+
import { LunoraClient, OptimisticUpdate, User, FunctionReference, ClientQueryRef, ConnectionStatus, ArgsOf, ReturnOf, HttpStreamRef, HttpStreamArgsOf, HttpStreamChunkOf, MutatorHandle, Preloaded } from '@lunora/client';
|
|
3
|
+
export { type ArgsOf, 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 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-D4okOpO8.mjs";
|
|
6
6
|
import { PaginationStatus } from '@lunora/client/pagination';
|
|
@@ -679,6 +679,65 @@ declare const useFlag: <T extends FlagValue>(key: string, defaultValue: T, conte
|
|
|
679
679
|
* changes between renders.
|
|
680
680
|
*/
|
|
681
681
|
declare const useFlags: <T extends Record<string, FlagValue>>(flags: T, context?: FlagContext) => T;
|
|
682
|
+
/** The lifecycle of a stream the hook is observing. */
|
|
683
|
+
type UseStreamStatus = "complete" | "error" | "idle" | "streaming";
|
|
684
|
+
interface UseStreamResult<T> {
|
|
685
|
+
/** Force-cancel the stream and resolve the iterator. Safe to call multiple times. */
|
|
686
|
+
cancel: () => void;
|
|
687
|
+
/** Chunks the server has pushed so far, in arrival order. */
|
|
688
|
+
chunks: ReadonlyArray<T>;
|
|
689
|
+
error: Error | undefined;
|
|
690
|
+
status: UseStreamStatus;
|
|
691
|
+
}
|
|
692
|
+
interface UseStreamOptions {
|
|
693
|
+
/** Forwarded to `client.stream()` — caps the in-flight chunk buffer. */
|
|
694
|
+
maxBuffer?: number;
|
|
695
|
+
shardKey?: string;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Subscribe to a streaming query. Returns the chunks pushed so far plus a
|
|
699
|
+
* lifecycle status and a cancel function. Changing `fn` or the serialized
|
|
700
|
+
* `args` resets the stream — the previous iterator is cancelled and a fresh
|
|
701
|
+
* one opens with empty `chunks`.
|
|
702
|
+
*
|
|
703
|
+
* Pass `"skip"` for `args` to keep the hook mounted without opening a stream
|
|
704
|
+
* (mirrors `useQuery` / `useSubscription`).
|
|
705
|
+
*/
|
|
706
|
+
declare const useStream: <F extends FunctionReference<"stream">>(function_: F, args: "skip" | ArgsOf<F>, options?: UseStreamOptions) => UseStreamResult<ReturnOf<F>>;
|
|
707
|
+
/**
|
|
708
|
+
* Result shape returned by {@link useHttpStream}.
|
|
709
|
+
* @experimental Part of the HTTP-SSE stream surface.
|
|
710
|
+
*/
|
|
711
|
+
interface UseHttpStreamResult<T> {
|
|
712
|
+
/** Force-cancel the stream (aborts the fetch) and resolve the iterator. Safe to call multiple times. */
|
|
713
|
+
cancel: () => void;
|
|
714
|
+
/** Chunks the server has pushed so far, in arrival order. */
|
|
715
|
+
chunks: ReadonlyArray<T>;
|
|
716
|
+
error: Error | undefined;
|
|
717
|
+
status: UseStreamStatus;
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Options accepted by {@link useHttpStream}.
|
|
721
|
+
* @experimental Part of the HTTP-SSE stream surface.
|
|
722
|
+
*/
|
|
723
|
+
interface UseHttpStreamOptions {
|
|
724
|
+
/** Forwarded to `client.httpStream()` — caps the in-flight chunk buffer. */
|
|
725
|
+
maxBuffer?: number;
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Consume an **HTTP-SSE route stream** (`httpRoute.<verb>(path).stream()`) via
|
|
729
|
+
* `client.httpStream`. Distinct from `useStream`, which consumes the WS
|
|
730
|
+
* procedure stream (`kind: "stream"`). Returns the chunks received so far plus
|
|
731
|
+
* a lifecycle status and a cancel function. Changing the route or the
|
|
732
|
+
* serialized `args` resets the stream — the previous fetch is aborted (the
|
|
733
|
+
* server sees `request.signal`) and a fresh one opens with empty `chunks`.
|
|
734
|
+
* Unmount also aborts.
|
|
735
|
+
*
|
|
736
|
+
* Pass `"skip"` for `args` to keep the hook mounted without opening a stream
|
|
737
|
+
* (mirrors `useQuery` / `useStream`).
|
|
738
|
+
* @experimental Reconnect/POST-body/wire-fidelity design questions are still open, so the shape may change.
|
|
739
|
+
*/
|
|
740
|
+
declare const useHttpStream: <Ref extends HttpStreamRef>(route: Ref, args: "skip" | HttpStreamArgsOf<Ref>, options?: UseHttpStreamOptions) => UseHttpStreamResult<HttpStreamChunkOf<Ref>>;
|
|
682
741
|
/** The args a paginated query exposes minus the framework-supplied page cursor. */
|
|
683
742
|
type PaginatedArgs<F> = Omit<ArgsOf<F>, "paginationOpts">;
|
|
684
743
|
/** The element type of the `page` array a paginated query returns. */
|
|
@@ -942,31 +1001,6 @@ interface UseRateLimitResult {
|
|
|
942
1001
|
* `useMemo`) so the `consume`/`check` callbacks keep a steady identity.
|
|
943
1002
|
*/
|
|
944
1003
|
declare const useRateLimit: (config: RateLimitConfig, options?: UseRateLimitOptions) => UseRateLimitResult;
|
|
945
|
-
/** The lifecycle of a stream the hook is observing. */
|
|
946
|
-
type UseStreamStatus = "complete" | "error" | "idle" | "streaming";
|
|
947
|
-
interface UseStreamResult<T> {
|
|
948
|
-
/** Force-cancel the stream and resolve the iterator. Safe to call multiple times. */
|
|
949
|
-
cancel: () => void;
|
|
950
|
-
/** Chunks the server has pushed so far, in arrival order. */
|
|
951
|
-
chunks: ReadonlyArray<T>;
|
|
952
|
-
error: Error | undefined;
|
|
953
|
-
status: UseStreamStatus;
|
|
954
|
-
}
|
|
955
|
-
interface UseStreamOptions {
|
|
956
|
-
/** Forwarded to `client.stream()` — caps the in-flight chunk buffer. */
|
|
957
|
-
maxBuffer?: number;
|
|
958
|
-
shardKey?: string;
|
|
959
|
-
}
|
|
960
|
-
/**
|
|
961
|
-
* Subscribe to a streaming query. Returns the chunks pushed so far plus a
|
|
962
|
-
* lifecycle status and a cancel function. Changing `fn` or the serialized
|
|
963
|
-
* `args` resets the stream — the previous iterator is cancelled and a fresh
|
|
964
|
-
* one opens with empty `chunks`.
|
|
965
|
-
*
|
|
966
|
-
* Pass `"skip"` for `args` to keep the hook mounted without opening a stream
|
|
967
|
-
* (mirrors `useQuery` / `useSubscription`).
|
|
968
|
-
*/
|
|
969
|
-
declare const useStream: <F extends FunctionReference<"stream">>(function_: F, args: "skip" | ArgsOf<F>, options?: UseStreamOptions) => UseStreamResult<ReturnOf<F>>;
|
|
970
1004
|
/**
|
|
971
1005
|
* Subscribe to a real-time stream from the server. Unlike `useQuery`, this
|
|
972
1006
|
* hook does not issue an initial HTTP fetch — it only delivers values that
|
|
@@ -1120,4 +1154,4 @@ interface UseVoiceAgentResult {
|
|
|
1120
1154
|
* `createSocket`) so the hook is drivable outside a browser.
|
|
1121
1155
|
*/
|
|
1122
1156
|
declare const useVoiceAgent: (options: UseVoiceAgentOptions) => UseVoiceAgentResult;
|
|
1123
|
-
export { type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, type AuthState, Authenticated, CheckoutButton, type CheckoutButtonProps, CustomerPortalButton, type CustomerPortalButtonProps, type FlagContext, type FlagValue, type HeartbeatReference, type ListPresentReference, LunoraProvider, type LunoraProviderProps, type MutationHook, type MutatorHook, type PageItemOf, type PaginatedArgs, type RedirectTarget, type RedirectTrigger, type Subscription, 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 UseCheckoutResult, type UseInfiniteQueryOptions, type UseInfiniteQueryResult, type UseMutationCallOptions, type UsePaginatedQueryOptions, type UsePaginatedQueryResult, type UsePresenceOptions, type UsePresenceResult, type UseQueryOptions, type UseRateLimitOptions, type UseRateLimitResult, type UseStreamOptions, type UseStreamResult, type UseStreamStatus, type UseSubscriptionResult, type UseVoiceAgentOptions, type UseVoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, hydratePreloaded, useAgent, useAgentChat, useAgentState, useAgentToolEvents, useAuth, useAuthState, useCheckout, useClientQuery, useConnectionStatus, useFlag, useFlags, useInfiniteQuery, useLunora, useMutation, useMutator, usePaginatedQuery, usePreloadedQuery, usePresence, useQuery, useRateLimit, useStream, useSubscription, useVoiceAgent };
|
|
1157
|
+
export { type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, type AuthState, Authenticated, CheckoutButton, type CheckoutButtonProps, CustomerPortalButton, type CustomerPortalButtonProps, type FlagContext, type FlagValue, type HeartbeatReference, type ListPresentReference, LunoraProvider, type LunoraProviderProps, type MutationHook, type MutatorHook, type PageItemOf, type PaginatedArgs, type RedirectTarget, type RedirectTrigger, type Subscription, 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 UseCheckoutResult, type UseHttpStreamOptions, type UseHttpStreamResult, type UseInfiniteQueryOptions, type UseInfiniteQueryResult, type UseMutationCallOptions, type UsePaginatedQueryOptions, type UsePaginatedQueryResult, type UsePresenceOptions, type UsePresenceResult, type UseQueryOptions, type UseRateLimitOptions, type UseRateLimitResult, type UseStreamOptions, type UseStreamResult, type UseStreamStatus, type UseSubscriptionResult, type UseVoiceAgentOptions, type UseVoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, hydratePreloaded, useAgent, useAgentChat, useAgentState, useAgentToolEvents, useAuth, useAuthState, useCheckout, useClientQuery, useConnectionStatus, useFlag, useFlags, useHttpStream, useInfiniteQuery, useLunora, useMutation, useMutator, usePaginatedQuery, usePreloadedQuery, usePresence, useQuery, useRateLimit, useStream, useSubscription, useVoiceAgent };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode, ReactElement } from 'react';
|
|
2
|
-
import { LunoraClient, OptimisticUpdate, User, FunctionReference, ClientQueryRef, ConnectionStatus, ReturnOf,
|
|
3
|
-
export { type ArgsOf, type ClientQueryRef, type FunctionReference, type LunoraClient, type LunoraErrorCode, type MutatorHandle, type MutatorTransaction, type OptimisticLocalStore, type OptimisticUpdate, type Preloaded, type ReturnOf, type User, createClientQuery, getErrorCode, getRetryAfterMs, isConflictError, isForbiddenError, isRateLimitedError, isUnauthorizedError } from '@lunora/client';
|
|
2
|
+
import { LunoraClient, OptimisticUpdate, User, FunctionReference, ClientQueryRef, ConnectionStatus, ArgsOf, ReturnOf, HttpStreamRef, HttpStreamArgsOf, HttpStreamChunkOf, MutatorHandle, Preloaded } from '@lunora/client';
|
|
3
|
+
export { type ArgsOf, 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 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-D4okOpO8.js";
|
|
6
6
|
import { PaginationStatus } from '@lunora/client/pagination';
|
|
@@ -679,6 +679,65 @@ declare const useFlag: <T extends FlagValue>(key: string, defaultValue: T, conte
|
|
|
679
679
|
* changes between renders.
|
|
680
680
|
*/
|
|
681
681
|
declare const useFlags: <T extends Record<string, FlagValue>>(flags: T, context?: FlagContext) => T;
|
|
682
|
+
/** The lifecycle of a stream the hook is observing. */
|
|
683
|
+
type UseStreamStatus = "complete" | "error" | "idle" | "streaming";
|
|
684
|
+
interface UseStreamResult<T> {
|
|
685
|
+
/** Force-cancel the stream and resolve the iterator. Safe to call multiple times. */
|
|
686
|
+
cancel: () => void;
|
|
687
|
+
/** Chunks the server has pushed so far, in arrival order. */
|
|
688
|
+
chunks: ReadonlyArray<T>;
|
|
689
|
+
error: Error | undefined;
|
|
690
|
+
status: UseStreamStatus;
|
|
691
|
+
}
|
|
692
|
+
interface UseStreamOptions {
|
|
693
|
+
/** Forwarded to `client.stream()` — caps the in-flight chunk buffer. */
|
|
694
|
+
maxBuffer?: number;
|
|
695
|
+
shardKey?: string;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Subscribe to a streaming query. Returns the chunks pushed so far plus a
|
|
699
|
+
* lifecycle status and a cancel function. Changing `fn` or the serialized
|
|
700
|
+
* `args` resets the stream — the previous iterator is cancelled and a fresh
|
|
701
|
+
* one opens with empty `chunks`.
|
|
702
|
+
*
|
|
703
|
+
* Pass `"skip"` for `args` to keep the hook mounted without opening a stream
|
|
704
|
+
* (mirrors `useQuery` / `useSubscription`).
|
|
705
|
+
*/
|
|
706
|
+
declare const useStream: <F extends FunctionReference<"stream">>(function_: F, args: "skip" | ArgsOf<F>, options?: UseStreamOptions) => UseStreamResult<ReturnOf<F>>;
|
|
707
|
+
/**
|
|
708
|
+
* Result shape returned by {@link useHttpStream}.
|
|
709
|
+
* @experimental Part of the HTTP-SSE stream surface.
|
|
710
|
+
*/
|
|
711
|
+
interface UseHttpStreamResult<T> {
|
|
712
|
+
/** Force-cancel the stream (aborts the fetch) and resolve the iterator. Safe to call multiple times. */
|
|
713
|
+
cancel: () => void;
|
|
714
|
+
/** Chunks the server has pushed so far, in arrival order. */
|
|
715
|
+
chunks: ReadonlyArray<T>;
|
|
716
|
+
error: Error | undefined;
|
|
717
|
+
status: UseStreamStatus;
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Options accepted by {@link useHttpStream}.
|
|
721
|
+
* @experimental Part of the HTTP-SSE stream surface.
|
|
722
|
+
*/
|
|
723
|
+
interface UseHttpStreamOptions {
|
|
724
|
+
/** Forwarded to `client.httpStream()` — caps the in-flight chunk buffer. */
|
|
725
|
+
maxBuffer?: number;
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Consume an **HTTP-SSE route stream** (`httpRoute.<verb>(path).stream()`) via
|
|
729
|
+
* `client.httpStream`. Distinct from `useStream`, which consumes the WS
|
|
730
|
+
* procedure stream (`kind: "stream"`). Returns the chunks received so far plus
|
|
731
|
+
* a lifecycle status and a cancel function. Changing the route or the
|
|
732
|
+
* serialized `args` resets the stream — the previous fetch is aborted (the
|
|
733
|
+
* server sees `request.signal`) and a fresh one opens with empty `chunks`.
|
|
734
|
+
* Unmount also aborts.
|
|
735
|
+
*
|
|
736
|
+
* Pass `"skip"` for `args` to keep the hook mounted without opening a stream
|
|
737
|
+
* (mirrors `useQuery` / `useStream`).
|
|
738
|
+
* @experimental Reconnect/POST-body/wire-fidelity design questions are still open, so the shape may change.
|
|
739
|
+
*/
|
|
740
|
+
declare const useHttpStream: <Ref extends HttpStreamRef>(route: Ref, args: "skip" | HttpStreamArgsOf<Ref>, options?: UseHttpStreamOptions) => UseHttpStreamResult<HttpStreamChunkOf<Ref>>;
|
|
682
741
|
/** The args a paginated query exposes minus the framework-supplied page cursor. */
|
|
683
742
|
type PaginatedArgs<F> = Omit<ArgsOf<F>, "paginationOpts">;
|
|
684
743
|
/** The element type of the `page` array a paginated query returns. */
|
|
@@ -942,31 +1001,6 @@ interface UseRateLimitResult {
|
|
|
942
1001
|
* `useMemo`) so the `consume`/`check` callbacks keep a steady identity.
|
|
943
1002
|
*/
|
|
944
1003
|
declare const useRateLimit: (config: RateLimitConfig, options?: UseRateLimitOptions) => UseRateLimitResult;
|
|
945
|
-
/** The lifecycle of a stream the hook is observing. */
|
|
946
|
-
type UseStreamStatus = "complete" | "error" | "idle" | "streaming";
|
|
947
|
-
interface UseStreamResult<T> {
|
|
948
|
-
/** Force-cancel the stream and resolve the iterator. Safe to call multiple times. */
|
|
949
|
-
cancel: () => void;
|
|
950
|
-
/** Chunks the server has pushed so far, in arrival order. */
|
|
951
|
-
chunks: ReadonlyArray<T>;
|
|
952
|
-
error: Error | undefined;
|
|
953
|
-
status: UseStreamStatus;
|
|
954
|
-
}
|
|
955
|
-
interface UseStreamOptions {
|
|
956
|
-
/** Forwarded to `client.stream()` — caps the in-flight chunk buffer. */
|
|
957
|
-
maxBuffer?: number;
|
|
958
|
-
shardKey?: string;
|
|
959
|
-
}
|
|
960
|
-
/**
|
|
961
|
-
* Subscribe to a streaming query. Returns the chunks pushed so far plus a
|
|
962
|
-
* lifecycle status and a cancel function. Changing `fn` or the serialized
|
|
963
|
-
* `args` resets the stream — the previous iterator is cancelled and a fresh
|
|
964
|
-
* one opens with empty `chunks`.
|
|
965
|
-
*
|
|
966
|
-
* Pass `"skip"` for `args` to keep the hook mounted without opening a stream
|
|
967
|
-
* (mirrors `useQuery` / `useSubscription`).
|
|
968
|
-
*/
|
|
969
|
-
declare const useStream: <F extends FunctionReference<"stream">>(function_: F, args: "skip" | ArgsOf<F>, options?: UseStreamOptions) => UseStreamResult<ReturnOf<F>>;
|
|
970
1004
|
/**
|
|
971
1005
|
* Subscribe to a real-time stream from the server. Unlike `useQuery`, this
|
|
972
1006
|
* hook does not issue an initial HTTP fetch — it only delivers values that
|
|
@@ -1120,4 +1154,4 @@ interface UseVoiceAgentResult {
|
|
|
1120
1154
|
* `createSocket`) so the hook is drivable outside a browser.
|
|
1121
1155
|
*/
|
|
1122
1156
|
declare const useVoiceAgent: (options: UseVoiceAgentOptions) => UseVoiceAgentResult;
|
|
1123
|
-
export { type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, type AuthState, Authenticated, CheckoutButton, type CheckoutButtonProps, CustomerPortalButton, type CustomerPortalButtonProps, type FlagContext, type FlagValue, type HeartbeatReference, type ListPresentReference, LunoraProvider, type LunoraProviderProps, type MutationHook, type MutatorHook, type PageItemOf, type PaginatedArgs, type RedirectTarget, type RedirectTrigger, type Subscription, 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 UseCheckoutResult, type UseInfiniteQueryOptions, type UseInfiniteQueryResult, type UseMutationCallOptions, type UsePaginatedQueryOptions, type UsePaginatedQueryResult, type UsePresenceOptions, type UsePresenceResult, type UseQueryOptions, type UseRateLimitOptions, type UseRateLimitResult, type UseStreamOptions, type UseStreamResult, type UseStreamStatus, type UseSubscriptionResult, type UseVoiceAgentOptions, type UseVoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, hydratePreloaded, useAgent, useAgentChat, useAgentState, useAgentToolEvents, useAuth, useAuthState, useCheckout, useClientQuery, useConnectionStatus, useFlag, useFlags, useInfiniteQuery, useLunora, useMutation, useMutator, usePaginatedQuery, usePreloadedQuery, usePresence, useQuery, useRateLimit, useStream, useSubscription, useVoiceAgent };
|
|
1157
|
+
export { type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, type AuthState, Authenticated, CheckoutButton, type CheckoutButtonProps, CustomerPortalButton, type CustomerPortalButtonProps, type FlagContext, type FlagValue, type HeartbeatReference, type ListPresentReference, LunoraProvider, type LunoraProviderProps, type MutationHook, type MutatorHook, type PageItemOf, type PaginatedArgs, type RedirectTarget, type RedirectTrigger, type Subscription, 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 UseCheckoutResult, type UseHttpStreamOptions, type UseHttpStreamResult, type UseInfiniteQueryOptions, type UseInfiniteQueryResult, type UseMutationCallOptions, type UsePaginatedQueryOptions, type UsePaginatedQueryResult, type UsePresenceOptions, type UsePresenceResult, type UseQueryOptions, type UseRateLimitOptions, type UseRateLimitResult, type UseStreamOptions, type UseStreamResult, type UseStreamStatus, type UseSubscriptionResult, type UseVoiceAgentOptions, type UseVoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, hydratePreloaded, useAgent, useAgentChat, useAgentState, useAgentToolEvents, useAuth, useAuthState, useCheckout, useClientQuery, useConnectionStatus, useFlag, useFlags, useHttpStream, useInfiniteQuery, useLunora, useMutation, useMutator, usePaginatedQuery, usePreloadedQuery, usePresence, useQuery, useRateLimit, useStream, useSubscription, useVoiceAgent };
|
package/dist/index.mjs
CHANGED
|
@@ -3,24 +3,25 @@ export { AuthLoading, Authenticated, Unauthenticated } from './packem_shared/Aut
|
|
|
3
3
|
export { useAuthState } from './packem_shared/useAuthState-CyF35qZR.mjs';
|
|
4
4
|
export { LunoraProvider, useLunora } from './packem_shared/LunoraProvider-BsuiW4Lk.mjs';
|
|
5
5
|
export { CheckoutButton, CustomerPortalButton, useCheckout } from './packem_shared/CheckoutButton-DUite8jJ.mjs';
|
|
6
|
-
export { lunoraQueryOptions } from './packem_shared/lunoraQueryOptions-
|
|
7
|
-
export { useAgent } from './packem_shared/useAgent-
|
|
8
|
-
export { useAgentChat } from './packem_shared/useAgentChat-
|
|
9
|
-
export { useAgentState } from './packem_shared/useAgentState-
|
|
10
|
-
export { useAgentToolEvents } from './packem_shared/useAgentToolEvents-
|
|
6
|
+
export { lunoraQueryOptions } from './packem_shared/lunoraQueryOptions-CefbPBId.mjs';
|
|
7
|
+
export { useAgent } from './packem_shared/useAgent-BNLlIYHz.mjs';
|
|
8
|
+
export { useAgentChat } from './packem_shared/useAgentChat-0cebQe7-.mjs';
|
|
9
|
+
export { useAgentState } from './packem_shared/useAgentState-Cqyd3Dfy.mjs';
|
|
10
|
+
export { useAgentToolEvents } from './packem_shared/useAgentToolEvents-gF7U4_KY.mjs';
|
|
11
11
|
export { default as useAuth } from './packem_shared/useAuth-BSutjJaa.mjs';
|
|
12
|
-
export { default as useClientQuery } from './packem_shared/useClientQuery-
|
|
12
|
+
export { default as useClientQuery } from './packem_shared/useClientQuery-DIkNT4QA.mjs';
|
|
13
13
|
export { default as useConnectionStatus } from './packem_shared/useConnectionStatus-PJ7vyCHy.mjs';
|
|
14
|
-
export { useFlag, useFlags } from './packem_shared/useFlag-
|
|
15
|
-
export {
|
|
14
|
+
export { useFlag, useFlags } from './packem_shared/useFlag-Beyeiq2b.mjs';
|
|
15
|
+
export { useHttpStream } from './packem_shared/useHttpStream-oc4s1pMy.mjs';
|
|
16
|
+
export { default as useInfiniteQuery } from './packem_shared/useInfiniteQuery-CJNw1XaZ.mjs';
|
|
16
17
|
export { useMutation } from './packem_shared/useMutation-BeqeIjTr.mjs';
|
|
17
18
|
export { useMutator } from './packem_shared/useMutator-IIrLtDiM.mjs';
|
|
18
|
-
export { usePaginatedQuery } from './packem_shared/usePaginatedQuery-
|
|
19
|
-
export { hydratePreloaded, default as usePreloadedQuery } from './packem_shared/hydratePreloaded-
|
|
19
|
+
export { usePaginatedQuery } from './packem_shared/usePaginatedQuery-DWzydaVR.mjs';
|
|
20
|
+
export { hydratePreloaded, default as usePreloadedQuery } from './packem_shared/hydratePreloaded-2omLtadR.mjs';
|
|
20
21
|
export { usePresence } from './packem_shared/usePresence-Rnx1Fznc.mjs';
|
|
21
|
-
export { default as useQuery } from './packem_shared/useQuery-
|
|
22
|
+
export { default as useQuery } from './packem_shared/useQuery-CE8_QUgh.mjs';
|
|
22
23
|
export { useRateLimit } from './packem_shared/useRateLimit-DTEffQEi.mjs';
|
|
23
|
-
export { useStream } from './packem_shared/useStream-
|
|
24
|
-
export { default as useSubscription } from './packem_shared/useSubscription-
|
|
25
|
-
export { useVoiceAgent } from './packem_shared/useVoiceAgent-
|
|
24
|
+
export { useStream } from './packem_shared/useStream-GYNgc9J5.mjs';
|
|
25
|
+
export { default as useSubscription } from './packem_shared/useSubscription-DcDlvVuI.mjs';
|
|
26
|
+
export { useVoiceAgent } from './packem_shared/useVoiceAgent-w7fzAMSB.mjs';
|
|
26
27
|
export { createClientQuery, getErrorCode, getRetryAfterMs, isConflictError, isForbiddenError, isRateLimitedError, isUnauthorizedError } from '@lunora/client';
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { c } from 'react/compiler-runtime';
|
|
3
3
|
import { useQueryClient, useQuery } from '@tanstack/react-query';
|
|
4
4
|
import { useEffect } from 'react';
|
|
5
|
-
import { g as getSubscriptionRegistry } from './cache-
|
|
5
|
+
import { g as getSubscriptionRegistry } from './cache-JeuDAXfE.mjs';
|
|
6
6
|
import { useLunora } from './LunoraProvider-BsuiW4Lk.mjs';
|
|
7
|
-
import { s as serializeQueryKey, l as lunoraQueryKey } from './query-key-
|
|
7
|
+
import { s as serializeQueryKey, l as lunoraQueryKey } from './query-key-LGnArBTB.mjs';
|
|
8
8
|
|
|
9
9
|
const usePreloadedQuery = function(preloaded) {
|
|
10
10
|
const $ = c(4);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { s as
|
|
1
|
+
import { s as stableWireKey } from './wire-key-Bg8BJ8YM.mjs';
|
|
2
2
|
|
|
3
|
-
const keyHash = (queryKey) =>
|
|
3
|
+
const keyHash = (queryKey) => stableWireKey(queryKey);
|
|
4
4
|
const lunoraQueryKey = (function_, args, shardKey) => [
|
|
5
5
|
"lunora",
|
|
6
6
|
function_.__lunoraRef,
|
|
@@ -9,7 +9,7 @@ const stableStringify = (value) => {
|
|
|
9
9
|
return "null";
|
|
10
10
|
}
|
|
11
11
|
if (typeof value === "bigint") {
|
|
12
|
-
throw new TypeError("stableStringify: cannot use a bigint in a cache key
|
|
12
|
+
throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key — pass it as a string, or use stableWireKey");
|
|
13
13
|
}
|
|
14
14
|
if (value === null || typeof value !== "object") {
|
|
15
15
|
return JSON.stringify(value);
|
|
@@ -20,7 +20,7 @@ const stableStringify = (value) => {
|
|
|
20
20
|
const proto = Object.getPrototypeOf(value);
|
|
21
21
|
if (proto !== null && proto !== Object.prototype) {
|
|
22
22
|
const name = value.constructor?.name ?? "value";
|
|
23
|
-
throw new TypeError(`stableStringify: cannot use a ${name} in a cache key
|
|
23
|
+
throw new TypeError(`stableStringify: cannot use a ${name} in a stable JSON cache key — only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`);
|
|
24
24
|
}
|
|
25
25
|
const record = value;
|
|
26
26
|
const keys = Object.keys(record).toSorted(compareKeys);
|
package/dist/packem_shared/{use-paginated-core-DafedU4l.mjs → use-paginated-core-xxvd1YA0.mjs}
RENAMED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { initialPages, rebalance, derivePaginationStatus, applyLoadMore } from '@lunora/client/pagination';
|
|
3
3
|
import { useQueryClient } from '@tanstack/react-query';
|
|
4
4
|
import { useRef, useReducer, useState, useEffect, useCallback } from 'react';
|
|
5
|
-
import { g as getSubscriptionRegistry } from './cache-
|
|
5
|
+
import { g as getSubscriptionRegistry } from './cache-JeuDAXfE.mjs';
|
|
6
6
|
import { useLunora } from './LunoraProvider-BsuiW4Lk.mjs';
|
|
7
|
-
import { s as serializeQueryKey, l as lunoraQueryKey } from './query-key-
|
|
7
|
+
import { s as serializeQueryKey, l as lunoraQueryKey } from './query-key-LGnArBTB.mjs';
|
|
8
8
|
|
|
9
9
|
const useLazyRef = function(create) {
|
|
10
10
|
const reference = useRef(void 0);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { c } from 'react/compiler-runtime';
|
|
3
3
|
import { useMutation } from './useMutation-BeqeIjTr.mjs';
|
|
4
|
-
import useSubscription from './useSubscription-
|
|
4
|
+
import useSubscription from './useSubscription-DcDlvVuI.mjs';
|
|
5
5
|
|
|
6
6
|
const NO_MUTATION_REF = {
|
|
7
7
|
__lunoraRef: ""
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { c } from 'react/compiler-runtime';
|
|
3
3
|
import { useState, useRef } from 'react';
|
|
4
4
|
import { useMutation } from './useMutation-BeqeIjTr.mjs';
|
|
5
|
-
import { useStream } from './useStream-
|
|
6
|
-
import useSubscription from './useSubscription-
|
|
5
|
+
import { useStream } from './useStream-GYNgc9J5.mjs';
|
|
6
|
+
import useSubscription from './useSubscription-DcDlvVuI.mjs';
|
|
7
7
|
|
|
8
8
|
const NO_MUTATION_REF = {
|
|
9
9
|
__lunoraRef: ""
|
|
@@ -13,18 +13,21 @@ const NO_STREAM_REF = {
|
|
|
13
13
|
};
|
|
14
14
|
const EMPTY_MESSAGES = [];
|
|
15
15
|
const reconcileOptimistic = (optimistic, durable) => {
|
|
16
|
-
const
|
|
16
|
+
const durableUserRows = durable.filter((message) => message.role === "user");
|
|
17
|
+
const consumed = /* @__PURE__ */ new Set();
|
|
17
18
|
return optimistic.filter((pending) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
for (let index = pending.durableUserCountAtSend; index < durableUserRows.length; index += 1) {
|
|
20
|
+
const row = durableUserRows[index];
|
|
21
|
+
if (row !== void 0 && !consumed.has(index) && row.content === pending.content) {
|
|
22
|
+
consumed.add(index);
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
22
25
|
}
|
|
23
26
|
return true;
|
|
24
27
|
});
|
|
25
28
|
};
|
|
26
29
|
const useAgentChat = (options) => {
|
|
27
|
-
const $ = c(
|
|
30
|
+
const $ = c(49);
|
|
28
31
|
const {
|
|
29
32
|
api,
|
|
30
33
|
cancel: cancelReference,
|
|
@@ -99,11 +102,24 @@ const useAgentChat = (options) => {
|
|
|
99
102
|
let t4;
|
|
100
103
|
if ($[9] !== durable || $[10] !== optimistic) {
|
|
101
104
|
const visibleOptimistic = reconcileOptimistic(optimistic, durable);
|
|
105
|
+
let maxDurableSeq;
|
|
106
|
+
if ($[12] !== durable) {
|
|
107
|
+
maxDurableSeq = -1;
|
|
108
|
+
for (const message of durable) {
|
|
109
|
+
if (message.seq > maxDurableSeq) {
|
|
110
|
+
maxDurableSeq = message.seq;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
$[12] = durable;
|
|
114
|
+
$[13] = maxDurableSeq;
|
|
115
|
+
} else {
|
|
116
|
+
maxDurableSeq = $[13];
|
|
117
|
+
}
|
|
102
118
|
t4 = visibleOptimistic.length === 0 ? durable : [...durable, ...visibleOptimistic.map((pending, index) => ({
|
|
103
119
|
content: pending.content,
|
|
104
120
|
optimistic: true,
|
|
105
121
|
role: "user",
|
|
106
|
-
seq:
|
|
122
|
+
seq: maxDurableSeq + 1 + index
|
|
107
123
|
}))];
|
|
108
124
|
$[9] = durable;
|
|
109
125
|
$[10] = optimistic;
|
|
@@ -113,32 +129,32 @@ const useAgentChat = (options) => {
|
|
|
113
129
|
}
|
|
114
130
|
const messages = t4;
|
|
115
131
|
let t5;
|
|
116
|
-
if ($[
|
|
132
|
+
if ($[14] !== durable) {
|
|
117
133
|
t5 = durable.filter(_temp);
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
134
|
+
$[14] = durable;
|
|
135
|
+
$[15] = t5;
|
|
120
136
|
} else {
|
|
121
|
-
t5 = $[
|
|
137
|
+
t5 = $[15];
|
|
122
138
|
}
|
|
123
139
|
const assistantCount = t5.length;
|
|
124
140
|
let t6;
|
|
125
|
-
if ($[
|
|
141
|
+
if ($[16] !== assistantCount || $[17] !== chunks || $[18] !== threadKey) {
|
|
126
142
|
let t72;
|
|
127
|
-
if ($[
|
|
143
|
+
if ($[20] !== assistantCount || $[21] !== threadKey) {
|
|
128
144
|
t72 = (event) => event.kind !== "progress" && event.threadKey === threadKey && event.turn >= assistantCount;
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
145
|
+
$[20] = assistantCount;
|
|
146
|
+
$[21] = threadKey;
|
|
147
|
+
$[22] = t72;
|
|
132
148
|
} else {
|
|
133
|
-
t72 = $[
|
|
149
|
+
t72 = $[22];
|
|
134
150
|
}
|
|
135
151
|
t6 = chunks.filter(t72).map(_temp2).join("");
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
152
|
+
$[16] = assistantCount;
|
|
153
|
+
$[17] = chunks;
|
|
154
|
+
$[18] = threadKey;
|
|
155
|
+
$[19] = t6;
|
|
140
156
|
} else {
|
|
141
|
-
t6 = $[
|
|
157
|
+
t6 = $[19];
|
|
142
158
|
}
|
|
143
159
|
const streamingText = t6;
|
|
144
160
|
const {
|
|
@@ -151,12 +167,14 @@ const useAgentChat = (options) => {
|
|
|
151
167
|
mutate: resolveMutate
|
|
152
168
|
} = approvalMutation;
|
|
153
169
|
let t7;
|
|
154
|
-
if ($[
|
|
170
|
+
if ($[23] !== durable || $[24] !== sendArgs || $[25] !== sendMutate || $[26] !== threadKey) {
|
|
155
171
|
t7 = async (input, args) => {
|
|
156
172
|
const id = nextIdRef.current;
|
|
157
173
|
nextIdRef.current = nextIdRef.current + 1;
|
|
174
|
+
const durableUserCountAtSend = durable.filter(_temp3).length;
|
|
158
175
|
setOptimistic((previous) => [...reconcileOptimistic(previous, durable), {
|
|
159
176
|
content: input,
|
|
177
|
+
durableUserCountAtSend,
|
|
160
178
|
id
|
|
161
179
|
}]);
|
|
162
180
|
try {
|
|
@@ -172,17 +190,17 @@ const useAgentChat = (options) => {
|
|
|
172
190
|
throw error;
|
|
173
191
|
}
|
|
174
192
|
};
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
-
$[
|
|
179
|
-
$[
|
|
193
|
+
$[23] = durable;
|
|
194
|
+
$[24] = sendArgs;
|
|
195
|
+
$[25] = sendMutate;
|
|
196
|
+
$[26] = threadKey;
|
|
197
|
+
$[27] = t7;
|
|
180
198
|
} else {
|
|
181
|
-
t7 = $[
|
|
199
|
+
t7 = $[27];
|
|
182
200
|
}
|
|
183
201
|
const send = t7;
|
|
184
202
|
let t8;
|
|
185
|
-
if ($[
|
|
203
|
+
if ($[28] !== instanceId || $[29] !== resolveMutate || $[30] !== threadKey) {
|
|
186
204
|
t8 = async (toolCallId, note) => {
|
|
187
205
|
if (instanceId === void 0) {
|
|
188
206
|
throw new Error("useAgentChat: cannot approve — no in-flight run (thread has no instanceId)");
|
|
@@ -197,16 +215,16 @@ const useAgentChat = (options) => {
|
|
|
197
215
|
}
|
|
198
216
|
});
|
|
199
217
|
};
|
|
200
|
-
$[
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
218
|
+
$[28] = instanceId;
|
|
219
|
+
$[29] = resolveMutate;
|
|
220
|
+
$[30] = threadKey;
|
|
221
|
+
$[31] = t8;
|
|
204
222
|
} else {
|
|
205
|
-
t8 = $[
|
|
223
|
+
t8 = $[31];
|
|
206
224
|
}
|
|
207
225
|
const approve = t8;
|
|
208
226
|
let t9;
|
|
209
|
-
if ($[
|
|
227
|
+
if ($[32] !== instanceId || $[33] !== resolveMutate || $[34] !== threadKey) {
|
|
210
228
|
t9 = async (toolCallId_0, note_0) => {
|
|
211
229
|
if (instanceId === void 0) {
|
|
212
230
|
throw new Error("useAgentChat: cannot reject — no in-flight run (thread has no instanceId)");
|
|
@@ -221,16 +239,16 @@ const useAgentChat = (options) => {
|
|
|
221
239
|
}
|
|
222
240
|
});
|
|
223
241
|
};
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
242
|
+
$[32] = instanceId;
|
|
243
|
+
$[33] = resolveMutate;
|
|
244
|
+
$[34] = threadKey;
|
|
245
|
+
$[35] = t9;
|
|
228
246
|
} else {
|
|
229
|
-
t9 = $[
|
|
247
|
+
t9 = $[35];
|
|
230
248
|
}
|
|
231
249
|
const reject = t9;
|
|
232
250
|
let t10;
|
|
233
|
-
if ($[
|
|
251
|
+
if ($[36] !== cancelMutate || $[37] !== cancelReference || $[38] !== instanceId || $[39] !== threadKey) {
|
|
234
252
|
t10 = async () => {
|
|
235
253
|
if (cancelReference === void 0 || instanceId === void 0) {
|
|
236
254
|
return;
|
|
@@ -240,17 +258,17 @@ const useAgentChat = (options) => {
|
|
|
240
258
|
threadKey
|
|
241
259
|
});
|
|
242
260
|
};
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
$[
|
|
261
|
+
$[36] = cancelMutate;
|
|
262
|
+
$[37] = cancelReference;
|
|
263
|
+
$[38] = instanceId;
|
|
264
|
+
$[39] = threadKey;
|
|
265
|
+
$[40] = t10;
|
|
248
266
|
} else {
|
|
249
|
-
t10 = $[
|
|
267
|
+
t10 = $[40];
|
|
250
268
|
}
|
|
251
269
|
const cancel = t10;
|
|
252
270
|
let t11;
|
|
253
|
-
if ($[
|
|
271
|
+
if ($[41] !== approve || $[42] !== cancel || $[43] !== messages || $[44] !== reject || $[45] !== send || $[46] !== status || $[47] !== streamingText) {
|
|
254
272
|
t11 = {
|
|
255
273
|
approve,
|
|
256
274
|
cancel,
|
|
@@ -260,24 +278,27 @@ const useAgentChat = (options) => {
|
|
|
260
278
|
status,
|
|
261
279
|
streamingText
|
|
262
280
|
};
|
|
263
|
-
$[
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
267
|
-
$[
|
|
268
|
-
$[
|
|
269
|
-
$[
|
|
270
|
-
$[
|
|
281
|
+
$[41] = approve;
|
|
282
|
+
$[42] = cancel;
|
|
283
|
+
$[43] = messages;
|
|
284
|
+
$[44] = reject;
|
|
285
|
+
$[45] = send;
|
|
286
|
+
$[46] = status;
|
|
287
|
+
$[47] = streamingText;
|
|
288
|
+
$[48] = t11;
|
|
271
289
|
} else {
|
|
272
|
-
t11 = $[
|
|
290
|
+
t11 = $[48];
|
|
273
291
|
}
|
|
274
292
|
return t11;
|
|
275
293
|
};
|
|
276
|
-
function _temp(
|
|
277
|
-
return
|
|
294
|
+
function _temp(message_0) {
|
|
295
|
+
return message_0.role === "assistant";
|
|
278
296
|
}
|
|
279
297
|
function _temp2(delta) {
|
|
280
298
|
return delta.text;
|
|
281
299
|
}
|
|
300
|
+
function _temp3(message_1) {
|
|
301
|
+
return message_1.role === "user";
|
|
302
|
+
}
|
|
282
303
|
|
|
283
304
|
export { useAgentChat };
|
package/dist/packem_shared/{useAgentToolEvents-BM7ERo00.mjs → useAgentToolEvents-gF7U4_KY.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { c } from 'react/compiler-runtime';
|
|
3
|
-
import { useStream } from './useStream-
|
|
4
|
-
import useSubscription from './useSubscription-
|
|
3
|
+
import { useStream } from './useStream-GYNgc9J5.mjs';
|
|
4
|
+
import useSubscription from './useSubscription-DcDlvVuI.mjs';
|
|
5
5
|
|
|
6
6
|
const NO_STREAM_REF = {
|
|
7
7
|
__lunoraRef: ""
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useCallback, useSyncExternalStore } from 'react';
|
|
3
|
+
import { useLunora } from './LunoraProvider-BsuiW4Lk.mjs';
|
|
4
|
+
|
|
5
|
+
const useClientQuery = (ref) => {
|
|
6
|
+
const client = useLunora();
|
|
7
|
+
const subscribe = useCallback((onStoreChange) => client.subscribeClientQuery(ref, () => {
|
|
8
|
+
onStoreChange();
|
|
9
|
+
}), [client, ref.key]);
|
|
10
|
+
const value = useSyncExternalStore(subscribe, () => client.getClientQuery(ref), () => client.getClientQuery(ref));
|
|
11
|
+
const setter = useCallback((next) => {
|
|
12
|
+
client.setClientQuery(ref, next);
|
|
13
|
+
}, [client, ref]);
|
|
14
|
+
return [value, setter];
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { useClientQuery as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useState, useRef, useEffect } from 'react';
|
|
3
3
|
import { useLunora } from './LunoraProvider-BsuiW4Lk.mjs';
|
|
4
|
-
import { s as stableStringify } from './stable-key-
|
|
4
|
+
import { s as stableStringify } from './stable-key-DePnevIy.mjs';
|
|
5
5
|
|
|
6
6
|
const FLAGS_EVAL_PATH = "__lunora_flags__:eval";
|
|
7
7
|
const flagKind = (value) => {
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useReducer, useRef, useEffect } from 'react';
|
|
3
|
+
import { useLunora } from './LunoraProvider-BsuiW4Lk.mjs';
|
|
4
|
+
import { s as stableStringify } from './stable-key-DePnevIy.mjs';
|
|
5
|
+
|
|
6
|
+
const reducer = function(state, action) {
|
|
7
|
+
switch (action.type) {
|
|
8
|
+
case "chunk": {
|
|
9
|
+
return {
|
|
10
|
+
chunks: [...state.chunks, action.chunk],
|
|
11
|
+
error: void 0,
|
|
12
|
+
status: "streaming"
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
case "complete": {
|
|
16
|
+
return {
|
|
17
|
+
...state,
|
|
18
|
+
status: "complete"
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
case "error": {
|
|
22
|
+
return {
|
|
23
|
+
...state,
|
|
24
|
+
error: action.error,
|
|
25
|
+
status: "error"
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
case "reset": {
|
|
29
|
+
return {
|
|
30
|
+
chunks: [],
|
|
31
|
+
error: void 0,
|
|
32
|
+
status: "idle"
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
case "start": {
|
|
36
|
+
return {
|
|
37
|
+
...state,
|
|
38
|
+
status: "streaming"
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
default: {
|
|
42
|
+
return state;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const useHttpStream = (route, args, options = {}) => {
|
|
47
|
+
const client = useLunora();
|
|
48
|
+
const [state, dispatch] = useReducer(reducer, {
|
|
49
|
+
chunks: [],
|
|
50
|
+
error: void 0,
|
|
51
|
+
status: "idle"
|
|
52
|
+
});
|
|
53
|
+
const skipped = args === "skip";
|
|
54
|
+
const serialized = skipped ? "skip" : stableStringify(args);
|
|
55
|
+
const cancelRef = useRef(void 0);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (skipped) {
|
|
58
|
+
dispatch({
|
|
59
|
+
type: "reset"
|
|
60
|
+
});
|
|
61
|
+
return () => {
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
dispatch({
|
|
65
|
+
type: "reset"
|
|
66
|
+
});
|
|
67
|
+
dispatch({
|
|
68
|
+
type: "start"
|
|
69
|
+
});
|
|
70
|
+
let stillMounted = true;
|
|
71
|
+
let cancelled = false;
|
|
72
|
+
const iterable = client.httpStream(route, args, {
|
|
73
|
+
maxBuffer: options.maxBuffer
|
|
74
|
+
});
|
|
75
|
+
const cancel = () => {
|
|
76
|
+
if (cancelled) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
cancelled = true;
|
|
80
|
+
iterable.cancel();
|
|
81
|
+
};
|
|
82
|
+
cancelRef.current = cancel;
|
|
83
|
+
(async () => {
|
|
84
|
+
try {
|
|
85
|
+
for await (const chunk of iterable) {
|
|
86
|
+
if (!stillMounted) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
dispatch({
|
|
90
|
+
chunk,
|
|
91
|
+
type: "chunk"
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (stillMounted) {
|
|
95
|
+
dispatch({
|
|
96
|
+
type: "complete"
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
} catch (error) {
|
|
100
|
+
if (!stillMounted) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
104
|
+
dispatch({
|
|
105
|
+
error: normalized,
|
|
106
|
+
type: "error"
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
})().catch(() => {
|
|
110
|
+
});
|
|
111
|
+
return () => {
|
|
112
|
+
stillMounted = false;
|
|
113
|
+
cancel();
|
|
114
|
+
cancelRef.current = void 0;
|
|
115
|
+
};
|
|
116
|
+
}, [client, route.method, route.path, serialized, skipped, options.maxBuffer]);
|
|
117
|
+
return {
|
|
118
|
+
cancel: () => {
|
|
119
|
+
cancelRef.current?.();
|
|
120
|
+
},
|
|
121
|
+
chunks: state.chunks,
|
|
122
|
+
error: state.error,
|
|
123
|
+
status: state.status
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export { useHttpStream };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { c } from 'react/compiler-runtime';
|
|
3
3
|
import { useRef, useEffect } from 'react';
|
|
4
|
-
import { u as usePaginatedCore } from './use-paginated-core-
|
|
4
|
+
import { u as usePaginatedCore } from './use-paginated-core-xxvd1YA0.mjs';
|
|
5
5
|
|
|
6
6
|
const useInfiniteQuery = (function_, args, options) => {
|
|
7
7
|
const $ = c(15);
|
package/dist/packem_shared/{usePaginatedQuery-_6ETVUmf.mjs → usePaginatedQuery-DWzydaVR.mjs}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { c } from 'react/compiler-runtime';
|
|
3
|
-
import { u as usePaginatedCore } from './use-paginated-core-
|
|
3
|
+
import { u as usePaginatedCore } from './use-paginated-core-xxvd1YA0.mjs';
|
|
4
4
|
|
|
5
5
|
const usePaginatedQuery = (function_, args, options) => {
|
|
6
6
|
const $ = c(7);
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { c } from 'react/compiler-runtime';
|
|
3
3
|
import { useQueryClient, useQuery as useQuery$1 } from '@tanstack/react-query';
|
|
4
4
|
import { useState, useEffect } from 'react';
|
|
5
|
-
import { g as getSubscriptionRegistry } from './cache-
|
|
5
|
+
import { g as getSubscriptionRegistry } from './cache-JeuDAXfE.mjs';
|
|
6
6
|
import { useLunora } from './LunoraProvider-BsuiW4Lk.mjs';
|
|
7
|
-
import { s as serializeQueryKey, l as lunoraQueryKey } from './query-key-
|
|
7
|
+
import { s as serializeQueryKey, l as lunoraQueryKey } from './query-key-LGnArBTB.mjs';
|
|
8
8
|
|
|
9
9
|
const useQuery = (function_, args, t0) => {
|
|
10
10
|
const $ = c(9);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useReducer, useRef, useEffect } from 'react';
|
|
3
3
|
import { useLunora } from './LunoraProvider-BsuiW4Lk.mjs';
|
|
4
|
-
import { s as
|
|
4
|
+
import { s as stableWireKey } from './wire-key-Bg8BJ8YM.mjs';
|
|
5
5
|
|
|
6
6
|
const reducer = function(state, action) {
|
|
7
7
|
switch (action.type) {
|
|
@@ -51,7 +51,7 @@ const useStream = (function_, args, options = {}) => {
|
|
|
51
51
|
status: "idle"
|
|
52
52
|
});
|
|
53
53
|
const skipped = args === "skip";
|
|
54
|
-
const serialized = skipped ? "skip" :
|
|
54
|
+
const serialized = skipped ? "skip" : stableWireKey(args);
|
|
55
55
|
const cancelRef = useRef(void 0);
|
|
56
56
|
useEffect(() => {
|
|
57
57
|
if (skipped) {
|
|
@@ -3,7 +3,7 @@ import { c } from 'react/compiler-runtime';
|
|
|
3
3
|
import { createQuerySubscription } from '@lunora/client/query';
|
|
4
4
|
import { useState, useRef, useEffect } from 'react';
|
|
5
5
|
import { useLunora } from './LunoraProvider-BsuiW4Lk.mjs';
|
|
6
|
-
import { s as
|
|
6
|
+
import { s as stableWireKey } from './wire-key-Bg8BJ8YM.mjs';
|
|
7
7
|
|
|
8
8
|
const useSubscription = (function_, args, t0) => {
|
|
9
9
|
const $ = c(22);
|
|
@@ -31,7 +31,7 @@ const useSubscription = (function_, args, t0) => {
|
|
|
31
31
|
const skipped = args === "skip";
|
|
32
32
|
let t3;
|
|
33
33
|
if ($[3] !== args || $[4] !== skipped) {
|
|
34
|
-
t3 = skipped ? "skip" :
|
|
34
|
+
t3 = skipped ? "skip" : stableWireKey(args);
|
|
35
35
|
$[3] = args;
|
|
36
36
|
$[4] = skipped;
|
|
37
37
|
$[5] = t3;
|
|
@@ -309,7 +309,13 @@ const useVoiceAgent = (options) => {
|
|
|
309
309
|
setInterimTranscript("");
|
|
310
310
|
try {
|
|
311
311
|
const url = voiceSocketUrl(client.url, agentNameFromReference(voice), threadKey);
|
|
312
|
-
const openSocket = createSocket ?? ((target) =>
|
|
312
|
+
const openSocket = createSocket ?? ((target) => {
|
|
313
|
+
const WebSocketImpl = client.getWebSocketImpl();
|
|
314
|
+
if (!WebSocketImpl) {
|
|
315
|
+
throw new Error("useVoiceAgent: no WebSocket implementation available (pass createSocket explicitly)");
|
|
316
|
+
}
|
|
317
|
+
return new WebSocketImpl(target);
|
|
318
|
+
});
|
|
313
319
|
const socket_0 = openSocket(url);
|
|
314
320
|
socket_0.binaryType = "arraybuffer";
|
|
315
321
|
const connection_2 = {
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { s as stableStringify } from './stable-key-DePnevIy.mjs';
|
|
2
|
+
|
|
3
|
+
const toBase64 = (bytes) => {
|
|
4
|
+
let binary = "";
|
|
5
|
+
const chunk = 32768;
|
|
6
|
+
for (let index = 0; index < bytes.length; index += chunk) {
|
|
7
|
+
binary += String.fromCharCode(...bytes.subarray(index, index + chunk));
|
|
8
|
+
}
|
|
9
|
+
return btoa(binary);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const TAG = "$lunora.wire$";
|
|
13
|
+
const MAX_DEPTH = 64;
|
|
14
|
+
const encodeWire = (value, depth = 0) => {
|
|
15
|
+
if (depth > MAX_DEPTH) {
|
|
16
|
+
throw new RangeError(`wire-codec: value nesting exceeds the ${MAX_DEPTH}-level limit`);
|
|
17
|
+
}
|
|
18
|
+
if (value === void 0) {
|
|
19
|
+
return [TAG, "undefined"];
|
|
20
|
+
}
|
|
21
|
+
if (value === null) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const kind = typeof value;
|
|
25
|
+
if (kind === "bigint") {
|
|
26
|
+
return [TAG, "bigint", value.toString()];
|
|
27
|
+
}
|
|
28
|
+
if (kind === "number") {
|
|
29
|
+
const numeric = value;
|
|
30
|
+
if (Number.isNaN(numeric)) {
|
|
31
|
+
return [TAG, "nan"];
|
|
32
|
+
}
|
|
33
|
+
if (numeric === Infinity) {
|
|
34
|
+
return [TAG, "inf"];
|
|
35
|
+
}
|
|
36
|
+
if (numeric === -Infinity) {
|
|
37
|
+
return [TAG, "-inf"];
|
|
38
|
+
}
|
|
39
|
+
return numeric;
|
|
40
|
+
}
|
|
41
|
+
if (kind !== "object") {
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
if (value instanceof Date) {
|
|
45
|
+
return [TAG, "date", encodeWire(value.getTime(), depth + 1)];
|
|
46
|
+
}
|
|
47
|
+
if (value instanceof Error) {
|
|
48
|
+
const error = value;
|
|
49
|
+
const properties = {};
|
|
50
|
+
for (const key of Object.keys(error)) {
|
|
51
|
+
if (error[key] !== void 0) {
|
|
52
|
+
properties[key] = encodeWire(error[key], depth + 1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const encodedError = [TAG, "error", error.name, error.message, properties];
|
|
56
|
+
if (error.cause !== void 0) {
|
|
57
|
+
encodedError.push(encodeWire(error.cause, depth + 1));
|
|
58
|
+
}
|
|
59
|
+
return encodedError;
|
|
60
|
+
}
|
|
61
|
+
if (value instanceof URL) {
|
|
62
|
+
return [TAG, "url", value.href];
|
|
63
|
+
}
|
|
64
|
+
if (value instanceof Map) {
|
|
65
|
+
return [TAG, "map", [...value.entries()].map(([k, v]) => [encodeWire(k, depth + 1), encodeWire(v, depth + 1)])];
|
|
66
|
+
}
|
|
67
|
+
if (value instanceof Set) {
|
|
68
|
+
return [TAG, "set", [...value].map((item) => encodeWire(item, depth + 1))];
|
|
69
|
+
}
|
|
70
|
+
if (value instanceof ArrayBuffer) {
|
|
71
|
+
return [TAG, "bytes", toBase64(new Uint8Array(value)), "ArrayBuffer"];
|
|
72
|
+
}
|
|
73
|
+
if (ArrayBuffer.isView(value)) {
|
|
74
|
+
const view = value;
|
|
75
|
+
const ctorName = view.constructor.name;
|
|
76
|
+
const bytes = new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
|
|
77
|
+
return ctorName === "Uint8Array" ? [TAG, "bytes", toBase64(bytes)] : [TAG, "bytes", toBase64(bytes), ctorName];
|
|
78
|
+
}
|
|
79
|
+
if (Array.isArray(value)) {
|
|
80
|
+
const encoded = value.map((item) => encodeWire(item, depth + 1));
|
|
81
|
+
return encoded.length > 0 && encoded[0] === TAG ? [TAG, "arr", encoded] : encoded;
|
|
82
|
+
}
|
|
83
|
+
const proto = Object.getPrototypeOf(value);
|
|
84
|
+
if (proto !== null && proto !== Object.prototype) {
|
|
85
|
+
const name = value.constructor?.name ?? "value";
|
|
86
|
+
throw new TypeError(`wire-codec: cannot encode a ${name} over the Lunora wire — only plain objects, arrays, and the supported built-ins (Date, Error, URL, Map, Set, ArrayBuffer/typed arrays, bigint) round-trip`);
|
|
87
|
+
}
|
|
88
|
+
const source = value;
|
|
89
|
+
const result = {};
|
|
90
|
+
for (const key of Object.keys(source)) {
|
|
91
|
+
const field = source[key];
|
|
92
|
+
if (field !== void 0) {
|
|
93
|
+
result[key] = encodeWire(field, depth + 1);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const stableWireKey = (value) => stableStringify(encodeWire(value));
|
|
100
|
+
|
|
101
|
+
export { stableWireKey as s };
|
package/dist/server.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createServerClient } from '@lunora/client/ssr';
|
|
2
2
|
export { createServerClient, deserializePreloaded, getServerSession, serializePreloaded } from '@lunora/client/ssr';
|
|
3
|
-
import { l as lunoraQueryKey } from './packem_shared/query-key-
|
|
4
|
-
export { lunoraQueryOptions } from './packem_shared/lunoraQueryOptions-
|
|
3
|
+
import { l as lunoraQueryKey } from './packem_shared/query-key-LGnArBTB.mjs';
|
|
4
|
+
export { lunoraQueryOptions } from './packem_shared/lunoraQueryOptions-CefbPBId.mjs';
|
|
5
5
|
export { preloadQuery, preloadedQueryResult } from '@lunora/client';
|
|
6
6
|
export { HydrationBoundary, dehydrate } from '@tanstack/react-query';
|
|
7
7
|
|
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.28",
|
|
4
4
|
"description": "React hooks for Lunora: useQuery, useMutation, useSubscription, and useAuth",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@lunora/client": "1.0.0-alpha.
|
|
53
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
54
|
-
"@lunora/ratelimit": "1.0.0-alpha.
|
|
52
|
+
"@lunora/client": "1.0.0-alpha.24",
|
|
53
|
+
"@lunora/errors": "1.0.0-alpha.5",
|
|
54
|
+
"@lunora/ratelimit": "1.0.0-alpha.8"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@tanstack/react-query": "^5.101.0",
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { c } from 'react/compiler-runtime';
|
|
3
|
-
import { useSyncExternalStore } from 'react';
|
|
4
|
-
import { useLunora } from './LunoraProvider-BsuiW4Lk.mjs';
|
|
5
|
-
|
|
6
|
-
const useClientQuery = (ref) => {
|
|
7
|
-
const $ = c(11);
|
|
8
|
-
const client = useLunora();
|
|
9
|
-
let t0;
|
|
10
|
-
let t1;
|
|
11
|
-
let t2;
|
|
12
|
-
if ($[0] !== client || $[1] !== ref) {
|
|
13
|
-
t0 = (onStoreChange) => {
|
|
14
|
-
const unsubscribe = client.subscribeClientQuery(ref, () => {
|
|
15
|
-
onStoreChange();
|
|
16
|
-
});
|
|
17
|
-
return unsubscribe;
|
|
18
|
-
};
|
|
19
|
-
t1 = () => client.getClientQuery(ref);
|
|
20
|
-
t2 = () => client.getClientQuery(ref);
|
|
21
|
-
$[0] = client;
|
|
22
|
-
$[1] = ref;
|
|
23
|
-
$[2] = t0;
|
|
24
|
-
$[3] = t1;
|
|
25
|
-
$[4] = t2;
|
|
26
|
-
} else {
|
|
27
|
-
t0 = $[2];
|
|
28
|
-
t1 = $[3];
|
|
29
|
-
t2 = $[4];
|
|
30
|
-
}
|
|
31
|
-
const value = useSyncExternalStore(t0, t1, t2);
|
|
32
|
-
let t3;
|
|
33
|
-
if ($[5] !== client || $[6] !== ref) {
|
|
34
|
-
t3 = (next) => {
|
|
35
|
-
client.setClientQuery(ref, next);
|
|
36
|
-
};
|
|
37
|
-
$[5] = client;
|
|
38
|
-
$[6] = ref;
|
|
39
|
-
$[7] = t3;
|
|
40
|
-
} else {
|
|
41
|
-
t3 = $[7];
|
|
42
|
-
}
|
|
43
|
-
const setter = t3;
|
|
44
|
-
let t4;
|
|
45
|
-
if ($[8] !== setter || $[9] !== value) {
|
|
46
|
-
t4 = [value, setter];
|
|
47
|
-
$[8] = setter;
|
|
48
|
-
$[9] = value;
|
|
49
|
-
$[10] = t4;
|
|
50
|
-
} else {
|
|
51
|
-
t4 = $[10];
|
|
52
|
-
}
|
|
53
|
-
return t4;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export { useClientQuery as default };
|