@lunora/react 1.0.0-alpha.55 → 1.0.0-alpha.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ReactNode, ReactElement } from 'react';
2
- import { LunoraClient, OptimisticUpdate, User, AuthImpersonation, AuthSession, AuthUser, FunctionReference, ClientQueryRef, ConnectionStatus, HttpStreamRef, HttpStreamArgsOf, HttpStreamChunkOf, ReturnOf, ArgsOf, MutatorHandle, Preloaded } from '@lunora/client';
2
+ import { LunoraClient, OptimisticUpdate, User, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, AuthImpersonation, AuthSession, AuthUser, ClientQueryRef, ConnectionStatus, HttpStreamRef, HttpStreamArgsOf, HttpStreamChunkOf, MutatorHandle, Preloaded } from '@lunora/client';
3
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-CdgGQ9s4.mjs";
@@ -199,6 +199,68 @@ interface UseAuthResult {
199
199
  token: string | null;
200
200
  user: User | null;
201
201
  }
202
+ interface ActionHook<F extends FunctionReference> {
203
+ /**
204
+ * Invoke the action. Awaitable, and rejects on failure — the same contract
205
+ * as `useMutation`'s `mutate`.
206
+ */
207
+ call: (args: ArgsOf<F>, options?: ActionCallOptions) => Promise<ReturnOf<F>>;
208
+ /** The latest invocation's resolved value, or `undefined` before the first success. */
209
+ data: ReturnOf<F> | undefined;
210
+ /** The latest invocation's error, or `undefined`. */
211
+ error: Error | undefined;
212
+ /** `true` while ANY invocation from this hook is in flight (ref-counted, so overlapping calls compose). */
213
+ pending: boolean;
214
+ /** Clear the latest `data`/`error` back to idle. */
215
+ reset: () => void;
216
+ }
217
+ /**
218
+ * Returns `{ call, pending, data, error, reset }` for the given action reference.
219
+ * Prefer destructuring at the call site so the React linter can track
220
+ * dependencies on each field independently.
221
+ *
222
+ * Actions were the one procedure kind with no hook: `useQuery` and `useMutation`
223
+ * shipped, so every app that called an action reached for `useLunora()` and
224
+ * re-derived the same pending/error wrapper by hand. This is that wrapper, once.
225
+ *
226
+ * The request state machine is the shared `createCallRunner` from
227
+ * `@lunora/client` — the same one Vue, Solid and Svelte bind to their own
228
+ * primitives — so `pending`, error normalization and latest-invocation ordering
229
+ * behave identically in every adapter. Only the `useState` cells are React's.
230
+ * TanStack's mutation cache still carries the call so it shows up in Query
231
+ * Devtools alongside `useQuery`/`useMutation`.
232
+ *
233
+ * **Lifecycle contract** (identical across the adapters): `data` and `error`
234
+ * both track the LATEST invocation, not the last to settle — a double-click
235
+ * whose first call resolves after the second cannot overwrite the second's
236
+ * outcome. A success clears `error`; a failure leaves the previous `data` in
237
+ * place, so a transient error does not blank the view. `reset()` clears both,
238
+ * but does NOT cancel an in-flight call, whose result still lands.
239
+ *
240
+ * **Why the two TanStack defaults are overridden.** `networkMode` is `"always"`
241
+ * because the default `"online"` pauses the retryer *after* the call is already
242
+ * marked pending: offline, the promise would never settle, the spinner would
243
+ * stick, and the action would silently fire minutes later on reconnect. `retry`
244
+ * is pinned to `0` — not inherited from an app-supplied QueryClient — because
245
+ * `client.action` sends no idempotency key, so a retry after a 502 on an action
246
+ * that already ran server-side would run it a second time. A mutation may pause
247
+ * and retry safely; it carries a `mutationId` and an offline queue. An action
248
+ * carries neither.
249
+ *
250
+ * **What it deliberately does not carry.** There is no `optimistic` /
251
+ * `optimisticUpdate` and no `withOptimisticUpdate`, which `useMutation` has. An
252
+ * optimistic update patches the subscription cache on the assumption the write
253
+ * will land; an action is not a write — it runs in the Worker, may call a third
254
+ * party, and has no declared effect on any query. Offering the option would
255
+ * imply a rollback guarantee nothing can honour.
256
+ *
257
+ * ```tsx
258
+ * const { call: runCommand, pending } = useAction(api.commands.run);
259
+ *
260
+ * await runCommand({ command: "lunora", args: ["verify"] });
261
+ * ```
262
+ */
263
+ declare const useAction: <F extends FunctionReference>(function_: F) => ActionHook<F>;
202
264
  /** The shape every list hook in this file returns. */
203
265
  interface AdminAuthListResult<T> {
204
266
  /** Rows loaded so far (the full current window, not just the latest page). `undefined` before the first response. */
@@ -1272,4 +1334,4 @@ interface UseVoiceAgentResult {
1272
1334
  * `createSocket`) so the hook is drivable outside a browser.
1273
1335
  */
1274
1336
  declare const useVoiceAgent: (options: UseVoiceAgentOptions) => UseVoiceAgentResult;
1275
- export { type AdminAuthListResult, 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 UseAuthSessionsOptions, type UseAuthUsersOptions, type UseCheckoutResult, 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 UseStreamOptions, type UseStreamResult, type UseStreamStatus, type UseSubscriptionResult, type UseVoiceAgentOptions, type UseVoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, hydratePreloaded, useAgent, useAgentChat, useAgentState, useAgentToolEvents, useAuth, useAuthSessions, useAuthState, useAuthUsers, useCheckout, useClientQuery, useConnectionStatus, useFlag, useFlags, useHttpStream, useImpersonate, useInfiniteQuery, useLunora, useMutation, useMutator, useOrganizations, usePaginatedQuery, usePreloadedQuery, usePresence, useQuery, useRateLimit, useStream, useSubscription, useVoiceAgent };
1337
+ export { type ActionHook, type AdminAuthListResult, 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 UseAuthSessionsOptions, type UseAuthUsersOptions, type UseCheckoutResult, 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 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, useCheckout, useClientQuery, useConnectionStatus, useFlag, useFlags, useHttpStream, useImpersonate, useInfiniteQuery, useLunora, useMutation, useMutator, useOrganizations, usePaginatedQuery, usePreloadedQuery, usePresence, useQuery, useRateLimit, 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, AuthImpersonation, AuthSession, AuthUser, FunctionReference, ClientQueryRef, ConnectionStatus, HttpStreamRef, HttpStreamArgsOf, HttpStreamChunkOf, ReturnOf, ArgsOf, MutatorHandle, Preloaded } from '@lunora/client';
2
+ import { LunoraClient, OptimisticUpdate, User, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, AuthImpersonation, AuthSession, AuthUser, ClientQueryRef, ConnectionStatus, HttpStreamRef, HttpStreamArgsOf, HttpStreamChunkOf, MutatorHandle, Preloaded } from '@lunora/client';
3
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-CdgGQ9s4.js";
@@ -199,6 +199,68 @@ interface UseAuthResult {
199
199
  token: string | null;
200
200
  user: User | null;
201
201
  }
202
+ interface ActionHook<F extends FunctionReference> {
203
+ /**
204
+ * Invoke the action. Awaitable, and rejects on failure — the same contract
205
+ * as `useMutation`'s `mutate`.
206
+ */
207
+ call: (args: ArgsOf<F>, options?: ActionCallOptions) => Promise<ReturnOf<F>>;
208
+ /** The latest invocation's resolved value, or `undefined` before the first success. */
209
+ data: ReturnOf<F> | undefined;
210
+ /** The latest invocation's error, or `undefined`. */
211
+ error: Error | undefined;
212
+ /** `true` while ANY invocation from this hook is in flight (ref-counted, so overlapping calls compose). */
213
+ pending: boolean;
214
+ /** Clear the latest `data`/`error` back to idle. */
215
+ reset: () => void;
216
+ }
217
+ /**
218
+ * Returns `{ call, pending, data, error, reset }` for the given action reference.
219
+ * Prefer destructuring at the call site so the React linter can track
220
+ * dependencies on each field independently.
221
+ *
222
+ * Actions were the one procedure kind with no hook: `useQuery` and `useMutation`
223
+ * shipped, so every app that called an action reached for `useLunora()` and
224
+ * re-derived the same pending/error wrapper by hand. This is that wrapper, once.
225
+ *
226
+ * The request state machine is the shared `createCallRunner` from
227
+ * `@lunora/client` — the same one Vue, Solid and Svelte bind to their own
228
+ * primitives — so `pending`, error normalization and latest-invocation ordering
229
+ * behave identically in every adapter. Only the `useState` cells are React's.
230
+ * TanStack's mutation cache still carries the call so it shows up in Query
231
+ * Devtools alongside `useQuery`/`useMutation`.
232
+ *
233
+ * **Lifecycle contract** (identical across the adapters): `data` and `error`
234
+ * both track the LATEST invocation, not the last to settle — a double-click
235
+ * whose first call resolves after the second cannot overwrite the second's
236
+ * outcome. A success clears `error`; a failure leaves the previous `data` in
237
+ * place, so a transient error does not blank the view. `reset()` clears both,
238
+ * but does NOT cancel an in-flight call, whose result still lands.
239
+ *
240
+ * **Why the two TanStack defaults are overridden.** `networkMode` is `"always"`
241
+ * because the default `"online"` pauses the retryer *after* the call is already
242
+ * marked pending: offline, the promise would never settle, the spinner would
243
+ * stick, and the action would silently fire minutes later on reconnect. `retry`
244
+ * is pinned to `0` — not inherited from an app-supplied QueryClient — because
245
+ * `client.action` sends no idempotency key, so a retry after a 502 on an action
246
+ * that already ran server-side would run it a second time. A mutation may pause
247
+ * and retry safely; it carries a `mutationId` and an offline queue. An action
248
+ * carries neither.
249
+ *
250
+ * **What it deliberately does not carry.** There is no `optimistic` /
251
+ * `optimisticUpdate` and no `withOptimisticUpdate`, which `useMutation` has. An
252
+ * optimistic update patches the subscription cache on the assumption the write
253
+ * will land; an action is not a write — it runs in the Worker, may call a third
254
+ * party, and has no declared effect on any query. Offering the option would
255
+ * imply a rollback guarantee nothing can honour.
256
+ *
257
+ * ```tsx
258
+ * const { call: runCommand, pending } = useAction(api.commands.run);
259
+ *
260
+ * await runCommand({ command: "lunora", args: ["verify"] });
261
+ * ```
262
+ */
263
+ declare const useAction: <F extends FunctionReference>(function_: F) => ActionHook<F>;
202
264
  /** The shape every list hook in this file returns. */
203
265
  interface AdminAuthListResult<T> {
204
266
  /** Rows loaded so far (the full current window, not just the latest page). `undefined` before the first response. */
@@ -1272,4 +1334,4 @@ interface UseVoiceAgentResult {
1272
1334
  * `createSocket`) so the hook is drivable outside a browser.
1273
1335
  */
1274
1336
  declare const useVoiceAgent: (options: UseVoiceAgentOptions) => UseVoiceAgentResult;
1275
- export { type AdminAuthListResult, 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 UseAuthSessionsOptions, type UseAuthUsersOptions, type UseCheckoutResult, 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 UseStreamOptions, type UseStreamResult, type UseStreamStatus, type UseSubscriptionResult, type UseVoiceAgentOptions, type UseVoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, hydratePreloaded, useAgent, useAgentChat, useAgentState, useAgentToolEvents, useAuth, useAuthSessions, useAuthState, useAuthUsers, useCheckout, useClientQuery, useConnectionStatus, useFlag, useFlags, useHttpStream, useImpersonate, useInfiniteQuery, useLunora, useMutation, useMutator, useOrganizations, usePaginatedQuery, usePreloadedQuery, usePresence, useQuery, useRateLimit, useStream, useSubscription, useVoiceAgent };
1337
+ export { type ActionHook, type AdminAuthListResult, 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 UseAuthSessionsOptions, type UseAuthUsersOptions, type UseCheckoutResult, 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 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, useCheckout, useClientQuery, useConnectionStatus, useFlag, useFlags, useHttpStream, useImpersonate, useInfiniteQuery, useLunora, useMutation, useMutator, useOrganizations, usePaginatedQuery, usePreloadedQuery, usePresence, useQuery, useRateLimit, useStream, useSubscription, useVoiceAgent };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{AuthLoading as t,Authenticated as o,Unauthenticated as u}from"./packem_shared/AuthLoading-dC08yqew.mjs";import{useAuthState as a}from"./packem_shared/useAuthState-CoOG9XdT.mjs";import{LunoraProvider as f,useLunora as n}from"./packem_shared/LunoraProvider-DC06S-p1.mjs";import{CheckoutButton as i,CustomerPortalButton as d,useCheckout as x}from"./packem_shared/CheckoutButton-D8MutXhg.mjs";import{lunoraQueryOptions as h}from"./packem_shared/lunoraQueryOptions-BtQVkawu.mjs";import{useAuthSessions as A,useAuthUsers as c,useImpersonate as C,useOrganizations as U}from"./packem_shared/useAuthSessions-Bq4-f3g-.mjs";import{useAgent as E}from"./packem_shared/useAgent-CDYDXIho.mjs";import{useAgentChat as Q}from"./packem_shared/useAgentChat-BosdEevp.mjs";import{useAgentState as L}from"./packem_shared/useAgentState-DybEIPYC.mjs";import{useAgentToolEvents as F}from"./packem_shared/useAgentToolEvents-BiKsdLnM.mjs";import{default as k}from"./packem_shared/useAuth-x4boOoAR.mjs";import{default as b}from"./packem_shared/useClientQuery-DFs7trEf.mjs";import{default as z}from"./packem_shared/useConnectionStatus-XYsYGiT6.mjs";import{useFlag as O,useFlags as T}from"./packem_shared/useFlag-CmYP4Qo-.mjs";import{useHttpStream as V}from"./packem_shared/useHttpStream-ByeMRVTu.mjs";import{default as q}from"./packem_shared/useInfiniteQuery-TifTSFTs.mjs";import{useMutation as D}from"./packem_shared/useMutation-BnKec7bE.mjs";import{useMutator as J}from"./packem_shared/useMutator-BtUd-xEA.mjs";import{usePaginatedQuery as N}from"./packem_shared/usePaginatedQuery-4-0SLkx7.mjs";import{hydratePreloaded as X,default as Y}from"./packem_shared/hydratePreloaded-CfPk_sQ5.mjs";import{usePresence as _}from"./packem_shared/usePresence-D5NOA_TJ.mjs";import{default as ee}from"./packem_shared/useQuery-CBd7O0N9.mjs";import{useRateLimit as te}from"./packem_shared/useRateLimit-Cckxi8m9.mjs";import{useStream as ue}from"./packem_shared/useStream-OBLaiEg1.mjs";import{default as ae}from"./packem_shared/useSubscription-BkLhTX0w.mjs";import{useVoiceAgent as fe}from"./packem_shared/useVoiceAgent-BziH3D-1.mjs";import{createClientQuery as me,getErrorCode as ie,getRetryAfterMs as de,isConflictError as xe,isForbiddenError as le,isRateLimitedError as he,isUnauthorizedError as ge}from"@lunora/client";import{RestrictionError as ce,UploadControl as Ce,UploadError as Ue}from"@visulima/storage-client";import{useChunkedRestUpload as Ee,useFileInput as Pe,useMultipartUpload as Qe,usePasteUpload as Se,useTusUpload as Le,useUpload as Re}from"@visulima/storage-client/react";export{t as AuthLoading,o as Authenticated,i as CheckoutButton,d as CustomerPortalButton,f as LunoraProvider,ce as RestrictionError,u as Unauthenticated,Ce as UploadControl,Ue as UploadError,me as createClientQuery,ie as getErrorCode,de as getRetryAfterMs,X as hydratePreloaded,xe as isConflictError,le as isForbiddenError,he as isRateLimitedError,ge as isUnauthorizedError,h as lunoraQueryOptions,E as useAgent,Q as useAgentChat,L as useAgentState,F as useAgentToolEvents,k as useAuth,A as useAuthSessions,a as useAuthState,c as useAuthUsers,x as useCheckout,Ee as useChunkedRestUpload,b as useClientQuery,z as useConnectionStatus,Pe as useFileInput,O as useFlag,T as useFlags,V as useHttpStream,C as useImpersonate,q as useInfiniteQuery,n as useLunora,Qe as useMultipartUpload,D as useMutation,J as useMutator,U as useOrganizations,N as usePaginatedQuery,Se as usePasteUpload,Y as usePreloadedQuery,_ as usePresence,ee as useQuery,te as useRateLimit,ue as useStream,ae as useSubscription,Le as useTusUpload,Re as useUpload,fe as useVoiceAgent};
2
+ import{AuthLoading as o,Authenticated as t,Unauthenticated as u}from"./packem_shared/AuthLoading-dC08yqew.mjs";import{useAuthState as a}from"./packem_shared/useAuthState-CoOG9XdT.mjs";import{LunoraProvider as f,useLunora as n}from"./packem_shared/LunoraProvider-DC06S-p1.mjs";import{CheckoutButton as i,CustomerPortalButton as d,useCheckout as x}from"./packem_shared/CheckoutButton-D8MutXhg.mjs";import{lunoraQueryOptions as h}from"./packem_shared/lunoraQueryOptions-BtQVkawu.mjs";import{useAction as c}from"./packem_shared/useAction-CUSJu4yq.mjs";import{useAuthSessions as C,useAuthUsers as U,useImpersonate as y,useOrganizations as E}from"./packem_shared/useAuthSessions-Bq4-f3g-.mjs";import{useAgent as Q}from"./packem_shared/useAgent-CDYDXIho.mjs";import{useAgentChat as L}from"./packem_shared/useAgentChat-BosdEevp.mjs";import{useAgentState as F}from"./packem_shared/useAgentState-DybEIPYC.mjs";import{useAgentToolEvents as k}from"./packem_shared/useAgentToolEvents-BiKsdLnM.mjs";import{default as b}from"./packem_shared/useAuth-x4boOoAR.mjs";import{default as z}from"./packem_shared/useClientQuery-DFs7trEf.mjs";import{default as O}from"./packem_shared/useConnectionStatus-XYsYGiT6.mjs";import{useFlag as H,useFlags as V}from"./packem_shared/useFlag-CmYP4Qo-.mjs";import{useHttpStream as q}from"./packem_shared/useHttpStream-ByeMRVTu.mjs";import{default as D}from"./packem_shared/useInfiniteQuery-TifTSFTs.mjs";import{useMutation as J}from"./packem_shared/useMutation-BnKec7bE.mjs";import{useMutator as N}from"./packem_shared/useMutator-BtUd-xEA.mjs";import{usePaginatedQuery as X}from"./packem_shared/usePaginatedQuery-4-0SLkx7.mjs";import{hydratePreloaded as Z,default as _}from"./packem_shared/hydratePreloaded-CfPk_sQ5.mjs";import{usePresence as ee}from"./packem_shared/usePresence-D5NOA_TJ.mjs";import{default as oe}from"./packem_shared/useQuery-CBd7O0N9.mjs";import{useRateLimit as ue}from"./packem_shared/useRateLimit-Cckxi8m9.mjs";import{useStream as ae}from"./packem_shared/useStream-OBLaiEg1.mjs";import{default as fe}from"./packem_shared/useSubscription-BkLhTX0w.mjs";import{useVoiceAgent as me}from"./packem_shared/useVoiceAgent-BziH3D-1.mjs";import{createClientQuery as de,getErrorCode as xe,getRetryAfterMs as le,isConflictError as he,isForbiddenError as Ae,isRateLimitedError as ce,isUnauthorizedError as ge}from"@lunora/client";import{RestrictionError as Ue,UploadControl as ye,UploadError as Ee}from"@visulima/storage-client";import{useChunkedRestUpload as Qe,useFileInput as Se,useMultipartUpload as Le,usePasteUpload as Re,useTusUpload as Fe,useUpload as Me}from"@visulima/storage-client/react";export{o as AuthLoading,t as Authenticated,i as CheckoutButton,d as CustomerPortalButton,f as LunoraProvider,Ue as RestrictionError,u as Unauthenticated,ye as UploadControl,Ee as UploadError,de as createClientQuery,xe as getErrorCode,le as getRetryAfterMs,Z as hydratePreloaded,he as isConflictError,Ae as isForbiddenError,ce as isRateLimitedError,ge as isUnauthorizedError,h as lunoraQueryOptions,c as useAction,Q as useAgent,L as useAgentChat,F as useAgentState,k as useAgentToolEvents,b as useAuth,C as useAuthSessions,a as useAuthState,U as useAuthUsers,x as useCheckout,Qe as useChunkedRestUpload,z as useClientQuery,O as useConnectionStatus,Se as useFileInput,H as useFlag,V as useFlags,q as useHttpStream,y as useImpersonate,D as useInfiniteQuery,n as useLunora,Le as useMultipartUpload,J as useMutation,N as useMutator,E as useOrganizations,X as usePaginatedQuery,Re as usePasteUpload,_ as usePreloadedQuery,ee as usePresence,oe as useQuery,ue as useRateLimit,ae as useStream,fe as useSubscription,Fe as useTusUpload,Me as useUpload,me as useVoiceAgent};
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ import{c as R}from"react/compiler-runtime";import{createCallRunner as k}from"@lunora/client";import{useMutation as x}from"@tanstack/react-query";import{useState as n}from"react";import{useLunora as C}from"./LunoraProvider-DC06S-p1.mjs";const S=a=>{const t=R(12),i=C(),[c,g]=n(void 0),[l,m]=n(void 0),[u,M]=n(!1);let o;t[0]!==i||t[1]!==a?(o={mutationFn:async e=>{const{args:y,options:A}=e;return i.action(a,y,A)},networkMode:"always",retry:0},t[0]=i,t[1]=a,t[2]=o):o=t[2];const{mutateAsync:d,reset:p}=x(o);let s;t[3]!==d||t[4]!==p?(s=()=>({call:k(async(e,y)=>d({args:e,options:y}),{setError:m,setPending:M,setResult:e=>{g(()=>e),m(void 0)}}),reset:()=>{g(void 0),m(void 0),p()}}),t[3]=d,t[4]=p,t[5]=s):s=t[5];const[w]=n(s),{call:f,reset:v}=w;let r;return t[6]!==f||t[7]!==c||t[8]!==l||t[9]!==u||t[10]!==v?(r={call:f,data:c,error:l,pending:u,reset:v},t[6]=f,t[7]=c,t[8]=l,t[9]=u,t[10]=v,t[11]=r):r=t[11],r};export{S as useAction};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/react",
3
- "version": "1.0.0-alpha.55",
3
+ "version": "1.0.0-alpha.56",
4
4
  "description": "React hooks for Lunora: useQuery, useMutation, useSubscription, and useAuth",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -53,7 +53,7 @@
53
53
  "access": "public"
54
54
  },
55
55
  "dependencies": {
56
- "@lunora/client": "1.0.0-alpha.51",
56
+ "@lunora/client": "1.0.0-alpha.52",
57
57
  "@lunora/errors": "1.0.0-alpha.22",
58
58
  "@lunora/ratelimit": "1.0.0-alpha.23",
59
59
  "@visulima/storage-client": "1.0.2"