@lunora/react 1.0.0-alpha.3 → 1.0.0-alpha.300

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 (69) hide show
  1. package/LICENSE.md +207 -104
  2. package/README.md +31 -19
  3. package/__assets__/package-og.svg +1 -1
  4. package/dist/index.d.mts +1391 -321
  5. package/dist/index.d.ts +1391 -321
  6. package/dist/index.mjs +1 -16
  7. package/dist/packem_shared/AuthLoading-DgQHaQD5.mjs +2 -0
  8. package/dist/packem_shared/LunoraProvider-0PzN8244.mjs +1 -0
  9. package/dist/packem_shared/hydratePreloaded-DbwkdExV.mjs +2 -0
  10. package/dist/packem_shared/lunora-provider-BMJTPKMP.mjs +2 -0
  11. package/dist/packem_shared/query-core-C9_ReCKt.mjs +2 -0
  12. package/dist/packem_shared/stream-state-abygFxmy.mjs +1 -0
  13. package/dist/packem_shared/use-paginated-core-BjpWBr46.mjs +2 -0
  14. package/dist/packem_shared/useAction-BGTQyx5l.mjs +2 -0
  15. package/dist/packem_shared/useAgent-BW4uKe79.mjs +2 -0
  16. package/dist/packem_shared/useAgentApprovals-VbOnL2Lx.mjs +2 -0
  17. package/dist/packem_shared/useAgentChat-DjLC2W3L.mjs +2 -0
  18. package/dist/packem_shared/useAgentState-CNZ5F4mc.mjs +2 -0
  19. package/dist/packem_shared/useAgentToolEvents-dndcx99y.mjs +2 -0
  20. package/dist/packem_shared/useAuth-C1_ruDmE.mjs +2 -0
  21. package/dist/packem_shared/useAuthSessions-Cv3RRW_S.mjs +2 -0
  22. package/dist/packem_shared/useAuthState-DZhCIjSA.mjs +2 -0
  23. package/dist/packem_shared/useClientQuery-D-c8YM6Q.mjs +2 -0
  24. package/dist/packem_shared/useConnectionStatus-CAmQqRpD.mjs +2 -0
  25. package/dist/packem_shared/useFlag-CWjaNeAp.mjs +2 -0
  26. package/dist/packem_shared/useHttpStream-C-VR6P1E.mjs +2 -0
  27. package/dist/packem_shared/useInfiniteQuery-BIkpHK0e.mjs +2 -0
  28. package/dist/packem_shared/useLiveTopic-Cp5b1ncm.mjs +2 -0
  29. package/dist/packem_shared/useMutation-D6p61C2U.mjs +2 -0
  30. package/dist/packem_shared/useMutator-BtUd-xEA.mjs +2 -0
  31. package/dist/packem_shared/usePaginatedQuery-B7tBY2XC.mjs +2 -0
  32. package/dist/packem_shared/usePresence-dgOxESVW.mjs +2 -0
  33. package/dist/packem_shared/useQuery-DMSZbdFz.mjs +2 -0
  34. package/dist/packem_shared/useRateLimit-Cckxi8m9.mjs +2 -0
  35. package/dist/packem_shared/useStream-B_XzhM-6.mjs +2 -0
  36. package/dist/packem_shared/useSubscription-CRqptgB_.mjs +2 -0
  37. package/dist/packem_shared/useSuspenseQuery-B9DrM8Kw.mjs +2 -0
  38. package/dist/packem_shared/useVoiceAgent-BHkPJWuv.mjs +2 -0
  39. package/dist/payment.d.mts +107 -0
  40. package/dist/payment.d.ts +107 -0
  41. package/dist/payment.mjs +2 -0
  42. package/dist/server.d.mts +103 -31
  43. package/dist/server.d.ts +103 -31
  44. package/dist/server.mjs +1 -31
  45. package/dist/upload.d.mts +24 -0
  46. package/dist/upload.d.ts +24 -0
  47. package/dist/upload.mjs +2 -0
  48. package/package.json +17 -6
  49. package/dist/packem_shared/AuthLoading-DtKgZT2Z.mjs +0 -33
  50. package/dist/packem_shared/CheckoutButton-CVSry8U1.mjs +0 -185
  51. package/dist/packem_shared/LunoraProvider-D38Xp16l.mjs +0 -80
  52. package/dist/packem_shared/cache-CItk3fgN.mjs +0 -75
  53. package/dist/packem_shared/hydratePreloaded-BlFL9FGq.mjs +0 -46
  54. package/dist/packem_shared/lunoraQueryOptions-CsuWzjg1.mjs +0 -16
  55. package/dist/packem_shared/query-key-C5rufkEE.mjs +0 -21
  56. package/dist/packem_shared/query-options.d-D4okOpO8.d.mts +0 -38
  57. package/dist/packem_shared/query-options.d-D4okOpO8.d.ts +0 -38
  58. package/dist/packem_shared/use-paginated-core-CoOfcc-p.mjs +0 -161
  59. package/dist/packem_shared/useAuth-CNUKtOOp.mjs +0 -129
  60. package/dist/packem_shared/useAuthState-BiGhtSCs.mjs +0 -36
  61. package/dist/packem_shared/useConnectionStatus-DRSY9ldm.mjs +0 -30
  62. package/dist/packem_shared/useInfiniteQuery-MH0x4l8h.mjs +0 -97
  63. package/dist/packem_shared/useMutation-CrvMXRsk.mjs +0 -67
  64. package/dist/packem_shared/usePaginatedQuery-D3PTDRGS.mjs +0 -46
  65. package/dist/packem_shared/usePresence-D7jLuxj0.mjs +0 -108
  66. package/dist/packem_shared/useQuery-C5S0W-7K.mjs +0 -41
  67. package/dist/packem_shared/useRateLimit-DTEffQEi.mjs +0 -64
  68. package/dist/packem_shared/useStream-BRY9nemd.mjs +0 -125
  69. package/dist/packem_shared/useSubscription-CHMCjyQg.mjs +0 -139
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-C5rufkEE.mjs';
4
- export { lunoraQueryOptions } from './packem_shared/lunoraQueryOptions-CsuWzjg1.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.3",
3
+ "version": "1.0.0-alpha.300",
4
4
  "description": "React hooks for Lunora: useQuery, useMutation, useSubscription, and useAuth",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "homepage": "https://lunora.sh",
16
16
  "bugs": "https://github.com/anolilab/lunora/issues",
17
- "license": "FSL-1.1-Apache-2.0",
17
+ "license": "Apache-2.0",
18
18
  "author": {
19
19
  "name": "Daniel Bannert",
20
20
  "email": "d.bannert@anolilab.de"
@@ -25,7 +25,7 @@
25
25
  "directory": "packages/react"
26
26
  },
27
27
  "files": [
28
- "dist",
28
+ "./dist",
29
29
  "README.md",
30
30
  "LICENSE.md",
31
31
  "__assets__"
@@ -39,18 +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.2",
53
- "@lunora/ratelimit": "1.0.0-alpha.2"
60
+ "@lunora/client": "^1.0.0-alpha.288",
61
+ "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
62
+ "@lunora/ratelimit": "1.0.0-alpha.196",
63
+ "@lunora/wire": "1.0.0-alpha.6",
64
+ "@visulima/storage-client": "1.0.9"
54
65
  },
55
66
  "peerDependencies": {
56
67
  "@tanstack/react-query": "^5.101.0",
@@ -65,7 +76,7 @@
65
76
  "optional": false
66
77
  },
67
78
  "react-dom": {
68
- "optional": false
79
+ "optional": true
69
80
  }
70
81
  },
71
82
  "engines": {
@@ -1,33 +0,0 @@
1
- 'use client';
2
- import { useAuthState } from './useAuthState-BiGhtSCs.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 };