@lunora/react 1.0.0-alpha.27 → 1.0.0-alpha.271

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.
Files changed (78) hide show
  1. package/README.md +28 -18
  2. package/dist/index.d.mts +1026 -614
  3. package/dist/index.d.ts +1026 -614
  4. package/dist/index.mjs +1 -26
  5. package/dist/packem_shared/AuthLoading-Dqb9692o.mjs +2 -0
  6. package/dist/packem_shared/LunoraProvider-CypI20I0.mjs +1 -0
  7. package/dist/packem_shared/hydratePreloaded-C94hJet3.mjs +2 -0
  8. package/dist/packem_shared/lunora-provider-D15UPNFD.mjs +2 -0
  9. package/dist/packem_shared/query-core-DG86Lpnw.mjs +2 -0
  10. package/dist/packem_shared/stream-state-abygFxmy.mjs +1 -0
  11. package/dist/packem_shared/use-paginated-core-Ot5YZ7W3.mjs +2 -0
  12. package/dist/packem_shared/useAction-CIlUzQVY.mjs +2 -0
  13. package/dist/packem_shared/useAgent-BBuc2RNx.mjs +2 -0
  14. package/dist/packem_shared/useAgentApprovals-yiIGlGck.mjs +2 -0
  15. package/dist/packem_shared/useAgentChat-Igz_15YO.mjs +2 -0
  16. package/dist/packem_shared/useAgentState-DbQmCmhH.mjs +2 -0
  17. package/dist/packem_shared/useAgentToolEvents-vgG15IZX.mjs +2 -0
  18. package/dist/packem_shared/useAuth-DTiEKNfL.mjs +2 -0
  19. package/dist/packem_shared/useAuthSessions-BSS2wfV4.mjs +2 -0
  20. package/dist/packem_shared/useAuthState-CFScqFAf.mjs +2 -0
  21. package/dist/packem_shared/useClientQuery-D01Sx8wn.mjs +2 -0
  22. package/dist/packem_shared/useConnectionStatus-VYjmmafS.mjs +2 -0
  23. package/dist/packem_shared/useFlag-CHzI2R8e.mjs +2 -0
  24. package/dist/packem_shared/useHttpStream-B32eZ6DN.mjs +2 -0
  25. package/dist/packem_shared/useInfiniteQuery-CeMlqAp6.mjs +2 -0
  26. package/dist/packem_shared/useLiveTopic-DzP_8Gf3.mjs +2 -0
  27. package/dist/packem_shared/useMutation-BfuQVXiY.mjs +2 -0
  28. package/dist/packem_shared/useMutator-BtUd-xEA.mjs +2 -0
  29. package/dist/packem_shared/usePaginatedQuery-t6CEO-xB.mjs +2 -0
  30. package/dist/packem_shared/usePresence-UDDcnYXw.mjs +2 -0
  31. package/dist/packem_shared/useQuery-BewsLSm_.mjs +2 -0
  32. package/dist/packem_shared/useRateLimit-Cckxi8m9.mjs +2 -0
  33. package/dist/packem_shared/useStream-D__0Rgzf.mjs +2 -0
  34. package/dist/packem_shared/useSubscription-P-_MNJm6.mjs +2 -0
  35. package/dist/packem_shared/useSuspenseQuery-5wC1or5S.mjs +2 -0
  36. package/dist/packem_shared/useVoiceAgent-iTIf7__2.mjs +2 -0
  37. package/dist/payment.d.mts +107 -0
  38. package/dist/payment.d.ts +107 -0
  39. package/dist/payment.mjs +2 -0
  40. package/dist/server.d.mts +103 -31
  41. package/dist/server.d.ts +103 -31
  42. package/dist/server.mjs +1 -31
  43. package/dist/upload.d.mts +24 -0
  44. package/dist/upload.d.ts +24 -0
  45. package/dist/upload.mjs +2 -0
  46. package/package.json +14 -4
  47. package/dist/packem_shared/AuthLoading-DezUWNB2.mjs +0 -33
  48. package/dist/packem_shared/CheckoutButton-DUite8jJ.mjs +0 -189
  49. package/dist/packem_shared/LunoraProvider-BsuiW4Lk.mjs +0 -81
  50. package/dist/packem_shared/cache-JeuDAXfE.mjs +0 -80
  51. package/dist/packem_shared/hydratePreloaded-2omLtadR.mjs +0 -54
  52. package/dist/packem_shared/lunoraQueryOptions-CefbPBId.mjs +0 -16
  53. package/dist/packem_shared/query-key-LGnArBTB.mjs +0 -13
  54. package/dist/packem_shared/query-options.d-D4okOpO8.d.mts +0 -38
  55. package/dist/packem_shared/query-options.d-D4okOpO8.d.ts +0 -38
  56. package/dist/packem_shared/stable-key-DePnevIy.mjs +0 -38
  57. package/dist/packem_shared/use-paginated-core-xxvd1YA0.mjs +0 -179
  58. package/dist/packem_shared/useAgent-BNLlIYHz.mjs +0 -101
  59. package/dist/packem_shared/useAgentChat-CSjKniMO.mjs +0 -283
  60. package/dist/packem_shared/useAgentState-Cqyd3Dfy.mjs +0 -37
  61. package/dist/packem_shared/useAgentToolEvents-gF7U4_KY.mjs +0 -129
  62. package/dist/packem_shared/useAuth-BSutjJaa.mjs +0 -129
  63. package/dist/packem_shared/useAuthState-CyF35qZR.mjs +0 -36
  64. package/dist/packem_shared/useClientQuery-CN1sC3cP.mjs +0 -56
  65. package/dist/packem_shared/useConnectionStatus-PJ7vyCHy.mjs +0 -30
  66. package/dist/packem_shared/useFlag-Beyeiq2b.mjs +0 -128
  67. package/dist/packem_shared/useHttpStream-oc4s1pMy.mjs +0 -127
  68. package/dist/packem_shared/useInfiniteQuery-CJNw1XaZ.mjs +0 -97
  69. package/dist/packem_shared/useMutation-BeqeIjTr.mjs +0 -67
  70. package/dist/packem_shared/useMutator-IIrLtDiM.mjs +0 -47
  71. package/dist/packem_shared/usePaginatedQuery-DWzydaVR.mjs +0 -46
  72. package/dist/packem_shared/usePresence-Rnx1Fznc.mjs +0 -115
  73. package/dist/packem_shared/useQuery-CE8_QUgh.mjs +0 -77
  74. package/dist/packem_shared/useRateLimit-DTEffQEi.mjs +0 -64
  75. package/dist/packem_shared/useStream-GYNgc9J5.mjs +0 -128
  76. package/dist/packem_shared/useSubscription-DcDlvVuI.mjs +0 -139
  77. package/dist/packem_shared/useVoiceAgent-sC5_ADB8.mjs +0 -416
  78. package/dist/packem_shared/wire-key-Bg8BJ8YM.mjs +0 -101
package/dist/server.d.mts CHANGED
@@ -1,23 +1,95 @@
1
1
  import { FunctionReference, ArgsOf, ReturnOf, LunoraClient } from '@lunora/client';
2
- export { type ArgsOf, type FunctionReference, type Preloaded, type ReturnOf, preloadQuery, preloadedQueryResult } from '@lunora/client';
2
+ export {
3
+ /**
4
+ * Server-side data-loading helpers for React Server Components.
5
+ *
6
+ * This module is the server half of `@lunora/react`: it carries no
7
+ * `"use client"` directive, opens no WebSocket, and touches no browser globals,
8
+ * so it is safe to import from an RSC / Next.js Server Component. The browser
9
+ * hooks (`useQuery`, `usePreloadedQuery`, …) live in the package root,
10
+ * `@lunora/react`, which is a client boundary.
11
+ *
12
+ * Two flows are supported, mirroring the two common RSC patterns. First,
13
+ * hydrating the TanStack cache: `prefetchQuery` runs the query on the server and
14
+ * seeds a `QueryClient` under the exact key the client `useQuery` reads back, so
15
+ * the client renders with data on the first paint and a live WS subscription
16
+ * attaches on mount. Second, the explicit-token flow: `preloadQuery` returns a
17
+ * serializable `Preloaded` value you hand to a client component that calls
18
+ * `usePreloadedQuery`.
19
+ */
20
+ type ArgsOf,
21
+ /**
22
+ * Server-side data-loading helpers for React Server Components.
23
+ *
24
+ * This module is the server half of `@lunora/react`: it carries no
25
+ * `"use client"` directive, opens no WebSocket, and touches no browser globals,
26
+ * so it is safe to import from an RSC / Next.js Server Component. The browser
27
+ * hooks (`useQuery`, `usePreloadedQuery`, …) live in the package root,
28
+ * `@lunora/react`, which is a client boundary.
29
+ *
30
+ * Two flows are supported, mirroring the two common RSC patterns. First,
31
+ * hydrating the TanStack cache: `prefetchQuery` runs the query on the server and
32
+ * seeds a `QueryClient` under the exact key the client `useQuery` reads back, so
33
+ * the client renders with data on the first paint and a live WS subscription
34
+ * attaches on mount. Second, the explicit-token flow: `preloadQuery` returns a
35
+ * serializable `Preloaded` value you hand to a client component that calls
36
+ * `usePreloadedQuery`.
37
+ */
38
+ type FunctionReference,
39
+ /**
40
+ * Server-side data-loading helpers for React Server Components.
41
+ *
42
+ * This module is the server half of `@lunora/react`: it carries no
43
+ * `"use client"` directive, opens no WebSocket, and touches no browser globals,
44
+ * so it is safe to import from an RSC / Next.js Server Component. The browser
45
+ * hooks (`useQuery`, `usePreloadedQuery`, …) live in the package root,
46
+ * `@lunora/react`, which is a client boundary.
47
+ *
48
+ * Two flows are supported, mirroring the two common RSC patterns. First,
49
+ * hydrating the TanStack cache: `prefetchQuery` runs the query on the server and
50
+ * seeds a `QueryClient` under the exact key the client `useQuery` reads back, so
51
+ * the client renders with data on the first paint and a live WS subscription
52
+ * attaches on mount. Second, the explicit-token flow: `preloadQuery` returns a
53
+ * serializable `Preloaded` value you hand to a client component that calls
54
+ * `usePreloadedQuery`.
55
+ */
56
+ type Preloaded,
57
+ /**
58
+ * Server-side data-loading helpers for React Server Components.
59
+ *
60
+ * This module is the server half of `@lunora/react`: it carries no
61
+ * `"use client"` directive, opens no WebSocket, and touches no browser globals,
62
+ * so it is safe to import from an RSC / Next.js Server Component. The browser
63
+ * hooks (`useQuery`, `usePreloadedQuery`, …) live in the package root,
64
+ * `@lunora/react`, which is a client boundary.
65
+ *
66
+ * Two flows are supported, mirroring the two common RSC patterns. First,
67
+ * hydrating the TanStack cache: `prefetchQuery` runs the query on the server and
68
+ * seeds a `QueryClient` under the exact key the client `useQuery` reads back, so
69
+ * the client renders with data on the first paint and a live WS subscription
70
+ * attaches on mount. Second, the explicit-token flow: `preloadQuery` returns a
71
+ * serializable `Preloaded` value you hand to a client component that calls
72
+ * `usePreloadedQuery`.
73
+ */
74
+ type ReturnOf, preloadQuery, preloadedQueryResult } from '@lunora/client';
3
75
  import { ServerClientOptions } from '@lunora/client/ssr';
4
76
  export { type AuthLike, type HeadersSource, type ServerClientOptions, type ServerSession, createServerClient, deserializePreloaded, getServerSession, serializePreloaded } from '@lunora/client/ssr';
5
77
  import { QueryClient } from '@tanstack/react-query';
6
78
  export { HydrationBoundary, dehydrate } from '@tanstack/react-query';
7
- export { type L as LunoraQueryOptions, l as lunoraQueryOptions } from "./packem_shared/query-options.d-D4okOpO8.mjs";
8
- /**
9
- * Run a query on the server and seed `queryClient` with the result under the
10
- * same key the client hooks use (see `lunoraQueryKey`), so a later
11
- * `useQuery(fn, args)` reads it straight from the hydrated cache — no loading
12
- * flash, no duplicate fetch on the client.
13
- *
14
- * Pair it with TanStack's `dehydrate` + `HydrationBoundary` (both re-exported
15
- * from this module): prefetch into a fresh `QueryClient`, `dehydrate` it, wrap
16
- * the client subtree in `HydrationBoundary`, and the client hooks pick the value
17
- * up from cache. Errors propagate — wrap the call if you'd rather render a
18
- * fallback than fail the server render. Drop the `await` for fire-and-forget
19
- * prefetch when you don't need the data present on the very first paint.
20
- */
79
+ export { type LunoraQueryOptions, lunoraQueryOptions } from '@lunora/client/query';
80
+ /**
81
+ * Run a query on the server and seed `queryClient` with the result under the
82
+ * same key the client hooks use (see `lunoraQueryKey`), so a later
83
+ * `useQuery(fn, args)` reads it straight from the hydrated cache — no loading
84
+ * flash, no duplicate fetch on the client.
85
+ *
86
+ * Pair it with TanStack's `dehydrate` + `HydrationBoundary` (both re-exported
87
+ * from this module): prefetch into a fresh `QueryClient`, `dehydrate` it, wrap
88
+ * the client subtree in `HydrationBoundary`, and the client hooks pick the value
89
+ * up from cache. Errors propagate — wrap the call if you'd rather render a
90
+ * fallback than fail the server render. Drop the `await` for fire-and-forget
91
+ * prefetch when you don't need the data present on the very first paint.
92
+ */
21
93
  declare const prefetchQuery: <F extends FunctionReference>(queryClient: QueryClient, client: LunoraClient, function_: F, args: ArgsOf<F>, options?: {
22
94
  shardKey?: string;
23
95
  }) => Promise<void>;
@@ -27,25 +99,25 @@ interface ServerCallOptions {
27
99
  shardKey?: string;
28
100
  }
29
101
  /**
30
- * Run a query once on the server and return its result — the standalone
31
- * counterpart to `prefetchQuery`/`preloadQuery` for when you just want the data
32
- * inline in a Server Component (e.g. to compute metadata or branch on a value)
33
- * rather than seed a cache or hand a `Preloaded` to the client.
34
- *
35
- * Builds a fresh request-scoped client per call (see `createServerClient`), so
36
- * pass `token` to run as the signed-in user. For several reads in one request,
37
- * prefer holding one `createServerClient` and calling `.query()` yourself to
38
- * avoid rebuilding the transport each time. Errors propagate.
39
- */
102
+ * Run a query once on the server and return its result — the standalone
103
+ * counterpart to `prefetchQuery`/`preloadQuery` for when you just want the data
104
+ * inline in a Server Component (e.g. to compute metadata or branch on a value)
105
+ * rather than seed a cache or hand a `Preloaded` to the client.
106
+ *
107
+ * Builds a fresh request-scoped client per call (see `createServerClient`), so
108
+ * pass `token` to run as the signed-in user. For several reads in one request,
109
+ * prefer holding one `createServerClient` and calling `.query()` yourself to
110
+ * avoid rebuilding the transport each time. Errors propagate.
111
+ */
40
112
  declare const fetchQuery: <F extends FunctionReference>(options: ServerClientOptions, function_: F, args: ArgsOf<F>, callOptions?: ServerCallOptions) => Promise<ReturnOf<F>>;
41
113
  /**
42
- * Run a mutation once on the server and return its result. Server-side calls go
43
- * straight over HTTP RPC — the offline queue and optimistic-update machinery are
44
- * client-only and never engage here. Errors propagate.
45
- */
114
+ * Run a mutation once on the server and return its result. Server-side calls go
115
+ * straight over HTTP RPC — the offline queue and optimistic-update machinery are
116
+ * client-only and never engage here. Errors propagate.
117
+ */
46
118
  declare const fetchMutation: <F extends FunctionReference>(options: ServerClientOptions, function_: F, args: ArgsOf<F>, callOptions?: ServerCallOptions) => Promise<ReturnOf<F>>;
47
119
  /**
48
- * Run an action once on the server and return its result. Errors propagate.
49
- */
120
+ * Run an action once on the server and return its result. Errors propagate.
121
+ */
50
122
  declare const fetchAction: <F extends FunctionReference>(options: ServerClientOptions, function_: F, args: ArgsOf<F>, callOptions?: ServerCallOptions) => Promise<ReturnOf<F>>;
51
123
  export { ServerCallOptions, fetchAction, fetchMutation, fetchQuery, prefetchQuery };
package/dist/server.d.ts CHANGED
@@ -1,23 +1,95 @@
1
1
  import { FunctionReference, ArgsOf, ReturnOf, LunoraClient } from '@lunora/client';
2
- export { type ArgsOf, type FunctionReference, type Preloaded, type ReturnOf, preloadQuery, preloadedQueryResult } from '@lunora/client';
2
+ export {
3
+ /**
4
+ * Server-side data-loading helpers for React Server Components.
5
+ *
6
+ * This module is the server half of `@lunora/react`: it carries no
7
+ * `"use client"` directive, opens no WebSocket, and touches no browser globals,
8
+ * so it is safe to import from an RSC / Next.js Server Component. The browser
9
+ * hooks (`useQuery`, `usePreloadedQuery`, …) live in the package root,
10
+ * `@lunora/react`, which is a client boundary.
11
+ *
12
+ * Two flows are supported, mirroring the two common RSC patterns. First,
13
+ * hydrating the TanStack cache: `prefetchQuery` runs the query on the server and
14
+ * seeds a `QueryClient` under the exact key the client `useQuery` reads back, so
15
+ * the client renders with data on the first paint and a live WS subscription
16
+ * attaches on mount. Second, the explicit-token flow: `preloadQuery` returns a
17
+ * serializable `Preloaded` value you hand to a client component that calls
18
+ * `usePreloadedQuery`.
19
+ */
20
+ type ArgsOf,
21
+ /**
22
+ * Server-side data-loading helpers for React Server Components.
23
+ *
24
+ * This module is the server half of `@lunora/react`: it carries no
25
+ * `"use client"` directive, opens no WebSocket, and touches no browser globals,
26
+ * so it is safe to import from an RSC / Next.js Server Component. The browser
27
+ * hooks (`useQuery`, `usePreloadedQuery`, …) live in the package root,
28
+ * `@lunora/react`, which is a client boundary.
29
+ *
30
+ * Two flows are supported, mirroring the two common RSC patterns. First,
31
+ * hydrating the TanStack cache: `prefetchQuery` runs the query on the server and
32
+ * seeds a `QueryClient` under the exact key the client `useQuery` reads back, so
33
+ * the client renders with data on the first paint and a live WS subscription
34
+ * attaches on mount. Second, the explicit-token flow: `preloadQuery` returns a
35
+ * serializable `Preloaded` value you hand to a client component that calls
36
+ * `usePreloadedQuery`.
37
+ */
38
+ type FunctionReference,
39
+ /**
40
+ * Server-side data-loading helpers for React Server Components.
41
+ *
42
+ * This module is the server half of `@lunora/react`: it carries no
43
+ * `"use client"` directive, opens no WebSocket, and touches no browser globals,
44
+ * so it is safe to import from an RSC / Next.js Server Component. The browser
45
+ * hooks (`useQuery`, `usePreloadedQuery`, …) live in the package root,
46
+ * `@lunora/react`, which is a client boundary.
47
+ *
48
+ * Two flows are supported, mirroring the two common RSC patterns. First,
49
+ * hydrating the TanStack cache: `prefetchQuery` runs the query on the server and
50
+ * seeds a `QueryClient` under the exact key the client `useQuery` reads back, so
51
+ * the client renders with data on the first paint and a live WS subscription
52
+ * attaches on mount. Second, the explicit-token flow: `preloadQuery` returns a
53
+ * serializable `Preloaded` value you hand to a client component that calls
54
+ * `usePreloadedQuery`.
55
+ */
56
+ type Preloaded,
57
+ /**
58
+ * Server-side data-loading helpers for React Server Components.
59
+ *
60
+ * This module is the server half of `@lunora/react`: it carries no
61
+ * `"use client"` directive, opens no WebSocket, and touches no browser globals,
62
+ * so it is safe to import from an RSC / Next.js Server Component. The browser
63
+ * hooks (`useQuery`, `usePreloadedQuery`, …) live in the package root,
64
+ * `@lunora/react`, which is a client boundary.
65
+ *
66
+ * Two flows are supported, mirroring the two common RSC patterns. First,
67
+ * hydrating the TanStack cache: `prefetchQuery` runs the query on the server and
68
+ * seeds a `QueryClient` under the exact key the client `useQuery` reads back, so
69
+ * the client renders with data on the first paint and a live WS subscription
70
+ * attaches on mount. Second, the explicit-token flow: `preloadQuery` returns a
71
+ * serializable `Preloaded` value you hand to a client component that calls
72
+ * `usePreloadedQuery`.
73
+ */
74
+ type ReturnOf, preloadQuery, preloadedQueryResult } from '@lunora/client';
3
75
  import { ServerClientOptions } from '@lunora/client/ssr';
4
76
  export { type AuthLike, type HeadersSource, type ServerClientOptions, type ServerSession, createServerClient, deserializePreloaded, getServerSession, serializePreloaded } from '@lunora/client/ssr';
5
77
  import { QueryClient } from '@tanstack/react-query';
6
78
  export { HydrationBoundary, dehydrate } from '@tanstack/react-query';
7
- export { type L as LunoraQueryOptions, l as lunoraQueryOptions } from "./packem_shared/query-options.d-D4okOpO8.js";
8
- /**
9
- * Run a query on the server and seed `queryClient` with the result under the
10
- * same key the client hooks use (see `lunoraQueryKey`), so a later
11
- * `useQuery(fn, args)` reads it straight from the hydrated cache — no loading
12
- * flash, no duplicate fetch on the client.
13
- *
14
- * Pair it with TanStack's `dehydrate` + `HydrationBoundary` (both re-exported
15
- * from this module): prefetch into a fresh `QueryClient`, `dehydrate` it, wrap
16
- * the client subtree in `HydrationBoundary`, and the client hooks pick the value
17
- * up from cache. Errors propagate — wrap the call if you'd rather render a
18
- * fallback than fail the server render. Drop the `await` for fire-and-forget
19
- * prefetch when you don't need the data present on the very first paint.
20
- */
79
+ export { type LunoraQueryOptions, lunoraQueryOptions } from '@lunora/client/query';
80
+ /**
81
+ * Run a query on the server and seed `queryClient` with the result under the
82
+ * same key the client hooks use (see `lunoraQueryKey`), so a later
83
+ * `useQuery(fn, args)` reads it straight from the hydrated cache — no loading
84
+ * flash, no duplicate fetch on the client.
85
+ *
86
+ * Pair it with TanStack's `dehydrate` + `HydrationBoundary` (both re-exported
87
+ * from this module): prefetch into a fresh `QueryClient`, `dehydrate` it, wrap
88
+ * the client subtree in `HydrationBoundary`, and the client hooks pick the value
89
+ * up from cache. Errors propagate — wrap the call if you'd rather render a
90
+ * fallback than fail the server render. Drop the `await` for fire-and-forget
91
+ * prefetch when you don't need the data present on the very first paint.
92
+ */
21
93
  declare const prefetchQuery: <F extends FunctionReference>(queryClient: QueryClient, client: LunoraClient, function_: F, args: ArgsOf<F>, options?: {
22
94
  shardKey?: string;
23
95
  }) => Promise<void>;
@@ -27,25 +99,25 @@ interface ServerCallOptions {
27
99
  shardKey?: string;
28
100
  }
29
101
  /**
30
- * Run a query once on the server and return its result — the standalone
31
- * counterpart to `prefetchQuery`/`preloadQuery` for when you just want the data
32
- * inline in a Server Component (e.g. to compute metadata or branch on a value)
33
- * rather than seed a cache or hand a `Preloaded` to the client.
34
- *
35
- * Builds a fresh request-scoped client per call (see `createServerClient`), so
36
- * pass `token` to run as the signed-in user. For several reads in one request,
37
- * prefer holding one `createServerClient` and calling `.query()` yourself to
38
- * avoid rebuilding the transport each time. Errors propagate.
39
- */
102
+ * Run a query once on the server and return its result — the standalone
103
+ * counterpart to `prefetchQuery`/`preloadQuery` for when you just want the data
104
+ * inline in a Server Component (e.g. to compute metadata or branch on a value)
105
+ * rather than seed a cache or hand a `Preloaded` to the client.
106
+ *
107
+ * Builds a fresh request-scoped client per call (see `createServerClient`), so
108
+ * pass `token` to run as the signed-in user. For several reads in one request,
109
+ * prefer holding one `createServerClient` and calling `.query()` yourself to
110
+ * avoid rebuilding the transport each time. Errors propagate.
111
+ */
40
112
  declare const fetchQuery: <F extends FunctionReference>(options: ServerClientOptions, function_: F, args: ArgsOf<F>, callOptions?: ServerCallOptions) => Promise<ReturnOf<F>>;
41
113
  /**
42
- * Run a mutation once on the server and return its result. Server-side calls go
43
- * straight over HTTP RPC — the offline queue and optimistic-update machinery are
44
- * client-only and never engage here. Errors propagate.
45
- */
114
+ * Run a mutation once on the server and return its result. Server-side calls go
115
+ * straight over HTTP RPC — the offline queue and optimistic-update machinery are
116
+ * client-only and never engage here. Errors propagate.
117
+ */
46
118
  declare const fetchMutation: <F extends FunctionReference>(options: ServerClientOptions, function_: F, args: ArgsOf<F>, callOptions?: ServerCallOptions) => Promise<ReturnOf<F>>;
47
119
  /**
48
- * Run an action once on the server and return its result. Errors propagate.
49
- */
120
+ * Run an action once on the server and return its result. Errors propagate.
121
+ */
50
122
  declare const fetchAction: <F extends FunctionReference>(options: ServerClientOptions, function_: F, args: ArgsOf<F>, callOptions?: ServerCallOptions) => Promise<ReturnOf<F>>;
51
123
  export { ServerCallOptions, fetchAction, fetchMutation, fetchQuery, prefetchQuery };
package/dist/server.mjs CHANGED
@@ -1,31 +1 @@
1
- import { createServerClient } from '@lunora/client/ssr';
2
- export { createServerClient, deserializePreloaded, getServerSession, serializePreloaded } from '@lunora/client/ssr';
3
- import { l as lunoraQueryKey } from './packem_shared/query-key-LGnArBTB.mjs';
4
- export { lunoraQueryOptions } from './packem_shared/lunoraQueryOptions-CefbPBId.mjs';
5
- export { preloadQuery, preloadedQueryResult } from '@lunora/client';
6
- export { HydrationBoundary, dehydrate } from '@tanstack/react-query';
7
-
8
- const prefetchQuery = async (queryClient, client, function_, args, options = {}) => {
9
- const argsRecord = args ?? {};
10
- await queryClient.prefetchQuery({
11
- queryFn: () => client.query(function_, argsRecord, {
12
- shardKey: options.shardKey
13
- }),
14
- queryKey: lunoraQueryKey(function_, argsRecord, options.shardKey),
15
- // Match the client hooks: Lunora is push-driven, so the seeded value is
16
- // never considered stale by TanStack — the WS subscription that attaches
17
- // on mount is the only freshness signal.
18
- staleTime: Number.POSITIVE_INFINITY
19
- });
20
- };
21
- const fetchQuery = async (options, function_, args, callOptions = {}) => createServerClient(options).query(function_, args, {
22
- shardKey: callOptions.shardKey
23
- });
24
- const fetchMutation = async (options, function_, args, callOptions = {}) => createServerClient(options).mutation(function_, args, {
25
- shardKey: callOptions.shardKey
26
- });
27
- const fetchAction = async (options, function_, args, callOptions = {}) => createServerClient(options).action(function_, args, {
28
- shardKey: callOptions.shardKey
29
- });
30
-
31
- export { fetchAction, fetchMutation, fetchQuery, prefetchQuery };
1
+ import{createServerClient as o}from"@lunora/client/ssr";import{createServerClient as K,deserializePreloaded as f,getServerSession as Q,serializePreloaded as x}from"@lunora/client/ssr";import{preloadQuery as S,preloadedQueryResult as q}from"@lunora/client";import{lunoraQueryKey as d}from"@lunora/client/query";import{lunoraQueryOptions as N}from"@lunora/client/query";import{HydrationBoundary as T,dehydrate as g}from"@tanstack/react-query";const u=async(r,a,e,t,y={})=>{const s=t??{};await r.prefetchQuery({queryFn:()=>a.query(e,s,{shardKey:y.shardKey}),queryKey:d(e,s,y.shardKey),staleTime:Number.POSITIVE_INFINITY})},h=async(r,a,e,t={})=>o(r).query(a,e,{shardKey:t.shardKey}),i=async(r,a,e,t={})=>o(r).mutation(a,e,{shardKey:t.shardKey}),l=async(r,a,e,t={})=>o(r).action(a,e,{shardKey:t.shardKey});export{T as HydrationBoundary,K as createServerClient,g as dehydrate,f as deserializePreloaded,l as fetchAction,i as fetchMutation,h as fetchQuery,Q as getServerSession,N as lunoraQueryOptions,u as prefetchQuery,S as preloadQuery,q as preloadedQueryResult,x as serializePreloaded};
@@ -0,0 +1,24 @@
1
+ export { RestrictionError, UploadControl, UploadError,
2
+ /**
3
+ * `@lunora/react/upload` — end-user file-upload hooks.
4
+ *
5
+ * A thin re-export of `@visulima/storage-client`'s React upload hooks (Lunora
6
+ * does not hand-roll the uploader). `useUpload` auto-selects TUS / chunked-REST /
7
+ * multipart by file size; the TUS path gives live progress, pause/resume and
8
+ * resume-after-a-dropped-connection. Point the hook's endpoint at a route backed
9
+ * by `@lunora/storage/upload`'s RLS-gated handler — end-user uploads gated by
10
+ * _your_ per-user policy, not an `adminToken`.
11
+ *
12
+ * ### TanStack Query
13
+ *
14
+ * The upload hooks re-exported here (`useUpload`, `useMultipartUpload`,
15
+ * `useTusUpload`, `useChunkedRestUpload`, `useFileInput`, `usePasteUpload`) hold
16
+ * their own state and need no `QueryClientProvider`, so Lunora's own `useQuery`
17
+ * and the visulima upload hooks coexist: the upload hooks never touch the query
18
+ * cache. `@visulima/storage-client`'s _data_ hooks (`useGetFileList` etc.) are
19
+ * not re-exported: they read files over `GET` on the upload route, which
20
+ * `@lunora/storage/upload` refuses (`405`). Read stored files through
21
+ * `ctx.storage` or a signed URL.
22
+ */
23
+ type UploadRestrictions } from '@visulima/storage-client';
24
+ export { type UploadMethod, type UploadResult, type UseChunkedRestUploadOptions, type UseChunkedRestUploadReturn, type UseFileInputOptions, type UseFileInputReturn, type UseMultipartUploadOptions, type UseMultipartUploadReturn, type UsePasteUploadOptions, type UsePasteUploadReturn, type UseTusUploadOptions, type UseTusUploadReturn, type UseUploadOptions, type UseUploadReturn, useChunkedRestUpload, useFileInput, useMultipartUpload, usePasteUpload, useTusUpload, useUpload } from '@visulima/storage-client/react';
@@ -0,0 +1,24 @@
1
+ export { RestrictionError, UploadControl, UploadError,
2
+ /**
3
+ * `@lunora/react/upload` — end-user file-upload hooks.
4
+ *
5
+ * A thin re-export of `@visulima/storage-client`'s React upload hooks (Lunora
6
+ * does not hand-roll the uploader). `useUpload` auto-selects TUS / chunked-REST /
7
+ * multipart by file size; the TUS path gives live progress, pause/resume and
8
+ * resume-after-a-dropped-connection. Point the hook's endpoint at a route backed
9
+ * by `@lunora/storage/upload`'s RLS-gated handler — end-user uploads gated by
10
+ * _your_ per-user policy, not an `adminToken`.
11
+ *
12
+ * ### TanStack Query
13
+ *
14
+ * The upload hooks re-exported here (`useUpload`, `useMultipartUpload`,
15
+ * `useTusUpload`, `useChunkedRestUpload`, `useFileInput`, `usePasteUpload`) hold
16
+ * their own state and need no `QueryClientProvider`, so Lunora's own `useQuery`
17
+ * and the visulima upload hooks coexist: the upload hooks never touch the query
18
+ * cache. `@visulima/storage-client`'s _data_ hooks (`useGetFileList` etc.) are
19
+ * not re-exported: they read files over `GET` on the upload route, which
20
+ * `@lunora/storage/upload` refuses (`405`). Read stored files through
21
+ * `ctx.storage` or a signed URL.
22
+ */
23
+ type UploadRestrictions } from '@visulima/storage-client';
24
+ export { type UploadMethod, type UploadResult, type UseChunkedRestUploadOptions, type UseChunkedRestUploadReturn, type UseFileInputOptions, type UseFileInputReturn, type UseMultipartUploadOptions, type UseMultipartUploadReturn, type UsePasteUploadOptions, type UsePasteUploadReturn, type UseTusUploadOptions, type UseTusUploadReturn, type UseUploadOptions, type UseUploadReturn, useChunkedRestUpload, useFileInput, useMultipartUpload, usePasteUpload, useTusUpload, useUpload } from '@visulima/storage-client/react';
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ import{RestrictionError as r,UploadControl as p,UploadError as l}from"@visulima/storage-client";import{useChunkedRestUpload as t,useFileInput as u,useMultipartUpload as a,usePasteUpload as d,useTusUpload as U,useUpload as i}from"@visulima/storage-client/react";export{r as RestrictionError,p as UploadControl,l as UploadError,t as useChunkedRestUpload,u as useFileInput,a as useMultipartUpload,d as usePasteUpload,U as useTusUpload,i as useUpload};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/react",
3
- "version": "1.0.0-alpha.27",
3
+ "version": "1.0.0-alpha.271",
4
4
  "description": "React hooks for Lunora: useQuery, useMutation, useSubscription, and useAuth",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -39,19 +39,29 @@
39
39
  "types": "./dist/index.d.ts",
40
40
  "import": "./dist/index.mjs"
41
41
  },
42
+ "./payment": {
43
+ "types": "./dist/payment.d.ts",
44
+ "import": "./dist/payment.mjs"
45
+ },
42
46
  "./server": {
43
47
  "types": "./dist/server.d.ts",
44
48
  "import": "./dist/server.mjs"
45
49
  },
50
+ "./upload": {
51
+ "types": "./dist/upload.d.ts",
52
+ "import": "./dist/upload.mjs"
53
+ },
46
54
  "./package.json": "./package.json"
47
55
  },
48
56
  "publishConfig": {
49
57
  "access": "public"
50
58
  },
51
59
  "dependencies": {
52
- "@lunora/client": "1.0.0-alpha.23",
53
- "@lunora/errors": "1.0.0-alpha.5",
54
- "@lunora/ratelimit": "1.0.0-alpha.8"
60
+ "@lunora/client": "1.0.0-alpha.259",
61
+ "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
62
+ "@lunora/ratelimit": "1.0.0-alpha.177",
63
+ "@lunora/wire": "1.0.0-alpha.3",
64
+ "@visulima/storage-client": "1.0.9"
55
65
  },
56
66
  "peerDependencies": {
57
67
  "@tanstack/react-query": "^5.101.0",
@@ -1,33 +0,0 @@
1
- 'use client';
2
- import { useAuthState } from './useAuthState-CyF35qZR.mjs';
3
-
4
- const Authenticated = (t0) => {
5
- const {
6
- children
7
- } = t0;
8
- const {
9
- isAuthenticated
10
- } = useAuthState();
11
- return isAuthenticated ? children : void 0;
12
- };
13
- const Unauthenticated = (t0) => {
14
- const {
15
- children
16
- } = t0;
17
- const {
18
- isAuthenticated,
19
- isLoading
20
- } = useAuthState();
21
- return !isLoading && !isAuthenticated ? children : void 0;
22
- };
23
- const AuthLoading = (t0) => {
24
- const {
25
- children
26
- } = t0;
27
- const {
28
- isLoading
29
- } = useAuthState();
30
- return isLoading ? children : void 0;
31
- };
32
-
33
- export { AuthLoading, Authenticated, Unauthenticated };
@@ -1,189 +0,0 @@
1
- 'use client';
2
- import { c } from 'react/compiler-runtime';
3
- import { useState, useCallback } from 'react';
4
- import { jsxDEV } from 'react/jsx-dev-runtime';
5
-
6
- const safeRedirectHref = (url) => {
7
- const parsed = new URL(url, globalThis.location.href);
8
- if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
9
- throw new Error(`refusing to redirect to a non-http(s) URL: ${parsed.protocol}`);
10
- }
11
- return parsed.href;
12
- };
13
- const useCheckout = (trigger) => {
14
- const [pending, setPending] = useState(false);
15
- const [error, setError] = useState(void 0);
16
- const checkout = useCallback(async () => {
17
- setPending(true);
18
- setError(void 0);
19
- try {
20
- const target = await trigger();
21
- globalThis.location.assign(safeRedirectHref(target.url));
22
- } catch (error_) {
23
- const normalized = error_ instanceof Error ? error_ : new Error(String(error_));
24
- setError(normalized);
25
- throw normalized;
26
- } finally {
27
- setPending(false);
28
- }
29
- }, [trigger]);
30
- return {
31
- checkout,
32
- error,
33
- pending
34
- };
35
- };
36
- const RedirectButton = (t0) => {
37
- const $ = c(11);
38
- const {
39
- "aria-label": ariaLabel,
40
- children,
41
- className,
42
- disabled,
43
- onError,
44
- title,
45
- trigger
46
- } = t0;
47
- const {
48
- checkout,
49
- pending
50
- } = useCheckout(trigger);
51
- let t1;
52
- if ($[0] !== checkout || $[1] !== onError) {
53
- t1 = () => {
54
- checkout().catch((error) => {
55
- const normalized = error instanceof Error ? error : new Error(String(error));
56
- onError?.(normalized);
57
- });
58
- };
59
- $[0] = checkout;
60
- $[1] = onError;
61
- $[2] = t1;
62
- } else {
63
- t1 = $[2];
64
- }
65
- const handleClick = t1;
66
- const t2 = disabled === true || pending;
67
- let t3;
68
- if ($[3] !== ariaLabel || $[4] !== children || $[5] !== className || $[6] !== handleClick || $[7] !== pending || $[8] !== t2 || $[9] !== title) {
69
- t3 = /* @__PURE__ */ jsxDEV("button", {
70
- "aria-busy": pending,
71
- "aria-label": ariaLabel,
72
- className,
73
- disabled: t2,
74
- onClick: handleClick,
75
- title,
76
- type: "button",
77
- children
78
- }, void 0, false);
79
- $[3] = ariaLabel;
80
- $[4] = children;
81
- $[5] = className;
82
- $[6] = handleClick;
83
- $[7] = pending;
84
- $[8] = t2;
85
- $[9] = title;
86
- $[10] = t3;
87
- } else {
88
- t3 = $[10];
89
- }
90
- return t3;
91
- };
92
- const CheckoutButton = (t0) => {
93
- const $ = c(11);
94
- let onCheckout;
95
- let rest;
96
- if ($[0] !== t0) {
97
- ({
98
- onCheckout,
99
- ...rest
100
- } = t0);
101
- $[0] = t0;
102
- $[1] = onCheckout;
103
- $[2] = rest;
104
- } else {
105
- onCheckout = $[1];
106
- rest = $[2];
107
- }
108
- const {
109
- "aria-label": ariaLabel,
110
- children,
111
- className,
112
- disabled,
113
- onError,
114
- title
115
- } = rest;
116
- let t1;
117
- if ($[3] !== ariaLabel || $[4] !== children || $[5] !== className || $[6] !== disabled || $[7] !== onCheckout || $[8] !== onError || $[9] !== title) {
118
- t1 = /* @__PURE__ */ jsxDEV(RedirectButton, {
119
- "aria-label": ariaLabel,
120
- className,
121
- disabled,
122
- onError,
123
- title,
124
- trigger: onCheckout,
125
- children
126
- }, void 0, false);
127
- $[3] = ariaLabel;
128
- $[4] = children;
129
- $[5] = className;
130
- $[6] = disabled;
131
- $[7] = onCheckout;
132
- $[8] = onError;
133
- $[9] = title;
134
- $[10] = t1;
135
- } else {
136
- t1 = $[10];
137
- }
138
- return t1;
139
- };
140
- const CustomerPortalButton = (t0) => {
141
- const $ = c(11);
142
- let onPortal;
143
- let rest;
144
- if ($[0] !== t0) {
145
- ({
146
- onPortal,
147
- ...rest
148
- } = t0);
149
- $[0] = t0;
150
- $[1] = onPortal;
151
- $[2] = rest;
152
- } else {
153
- onPortal = $[1];
154
- rest = $[2];
155
- }
156
- const {
157
- "aria-label": ariaLabel,
158
- children,
159
- className,
160
- disabled,
161
- onError,
162
- title
163
- } = rest;
164
- let t1;
165
- if ($[3] !== ariaLabel || $[4] !== children || $[5] !== className || $[6] !== disabled || $[7] !== onError || $[8] !== onPortal || $[9] !== title) {
166
- t1 = /* @__PURE__ */ jsxDEV(RedirectButton, {
167
- "aria-label": ariaLabel,
168
- className,
169
- disabled,
170
- onError,
171
- title,
172
- trigger: onPortal,
173
- children
174
- }, void 0, false);
175
- $[3] = ariaLabel;
176
- $[4] = children;
177
- $[5] = className;
178
- $[6] = disabled;
179
- $[7] = onError;
180
- $[8] = onPortal;
181
- $[9] = title;
182
- $[10] = t1;
183
- } else {
184
- t1 = $[10];
185
- }
186
- return t1;
187
- };
188
-
189
- export { CheckoutButton, CustomerPortalButton, useCheckout };