@gusto/baerly-storage 0.1.0

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 (115) hide show
  1. package/README.md +97 -0
  2. package/dist/API.md +850 -0
  3. package/dist/app-config-Cb5dO2s9.d.ts +480 -0
  4. package/dist/app-config.d.ts +2 -0
  5. package/dist/app-config.js +8 -0
  6. package/dist/app-config.js.map +1 -0
  7. package/dist/auth.d.ts +237 -0
  8. package/dist/auth.js +1335 -0
  9. package/dist/auth.js.map +1 -0
  10. package/dist/baerly.js +761 -0
  11. package/dist/baerly.js.map +1 -0
  12. package/dist/bucket-uri-BrDEYvzy.js +4922 -0
  13. package/dist/bucket-uri-BrDEYvzy.js.map +1 -0
  14. package/dist/chunk-EAsCxrDo.js +14 -0
  15. package/dist/client-BLf3Ae5s.d.ts +233 -0
  16. package/dist/client-react.d.ts +131 -0
  17. package/dist/client-react.js +559 -0
  18. package/dist/client-react.js.map +1 -0
  19. package/dist/client.d.ts +4 -0
  20. package/dist/client.js +160 -0
  21. package/dist/client.js.map +1 -0
  22. package/dist/cloudflare-CINJPKCW.js +911 -0
  23. package/dist/cloudflare-CINJPKCW.js.map +1 -0
  24. package/dist/cloudflare.d.ts +211 -0
  25. package/dist/cloudflare.js +445 -0
  26. package/dist/cloudflare.js.map +1 -0
  27. package/dist/config-Bsg8wgwo.js +198 -0
  28. package/dist/config-Bsg8wgwo.js.map +1 -0
  29. package/dist/context-Oj7ffwD-.js +187 -0
  30. package/dist/context-Oj7ffwD-.js.map +1 -0
  31. package/dist/cost-B1WiZxlf.js +203 -0
  32. package/dist/cost-B1WiZxlf.js.map +1 -0
  33. package/dist/current-json-BkatBzF7.js +252 -0
  34. package/dist/current-json-BkatBzF7.js.map +1 -0
  35. package/dist/db-D62JguBc.d.ts +336 -0
  36. package/dist/deploy-BB-wqbhf.js +83 -0
  37. package/dist/deploy-BB-wqbhf.js.map +1 -0
  38. package/dist/dev-banner-CWHIk8tH.d.ts +26 -0
  39. package/dist/dev-vite.d.ts +146 -0
  40. package/dist/dev-vite.js +223 -0
  41. package/dist/dev-vite.js.map +1 -0
  42. package/dist/dev.d.ts +3 -0
  43. package/dist/dev.js +2 -0
  44. package/dist/doctor-B8h9GCN9.js +331 -0
  45. package/dist/doctor-B8h9GCN9.js.map +1 -0
  46. package/dist/dump-BHo_sIMZ.js +116 -0
  47. package/dist/dump-BHo_sIMZ.js.map +1 -0
  48. package/dist/errors-DOdL95kK.js +58 -0
  49. package/dist/errors-DOdL95kK.js.map +1 -0
  50. package/dist/export-Dz2PZKSR.js +423 -0
  51. package/dist/export-Dz2PZKSR.js.map +1 -0
  52. package/dist/fsck-DEz9lyCy.js +293 -0
  53. package/dist/fsck-DEz9lyCy.js.map +1 -0
  54. package/dist/http-CjUO1Bec.js +1756 -0
  55. package/dist/http-CjUO1Bec.js.map +1 -0
  56. package/dist/http.d.ts +1619 -0
  57. package/dist/http.js +2 -0
  58. package/dist/index-BGC-ENnj.d.ts +1065 -0
  59. package/dist/index-BYv0hb8M.d.ts +1457 -0
  60. package/dist/index-BquQkhJi.d.ts +112 -0
  61. package/dist/index-COsQ-Mlz.d.ts +146 -0
  62. package/dist/index.d.ts +6 -0
  63. package/dist/index.js +6 -0
  64. package/dist/indexes-BXn7a06a.js +297 -0
  65. package/dist/indexes-BXn7a06a.js.map +1 -0
  66. package/dist/indexes-DwOXkn1Y.d.ts +22 -0
  67. package/dist/inspect-x02aFWnh.js +149 -0
  68. package/dist/inspect-x02aFWnh.js.map +1 -0
  69. package/dist/log-walk-DIru96UT.js +260 -0
  70. package/dist/log-walk-DIru96UT.js.map +1 -0
  71. package/dist/maintenance-Bn6ul9aV.js +758 -0
  72. package/dist/maintenance-Bn6ul9aV.js.map +1 -0
  73. package/dist/maintenance.d.ts +323 -0
  74. package/dist/maintenance.js +2 -0
  75. package/dist/node.d.ts +422 -0
  76. package/dist/node.js +2 -0
  77. package/dist/normalize-XWY25_sG.js +133 -0
  78. package/dist/normalize-XWY25_sG.js.map +1 -0
  79. package/dist/observability-2IDYRuZK.js +2333 -0
  80. package/dist/observability-2IDYRuZK.js.map +1 -0
  81. package/dist/observability.d.ts +3 -0
  82. package/dist/observability.js +3 -0
  83. package/dist/plan-Cs17VqjU.js +224 -0
  84. package/dist/plan-Cs17VqjU.js.map +1 -0
  85. package/dist/query-DcSbFLJt.js +1880 -0
  86. package/dist/query-DcSbFLJt.js.map +1 -0
  87. package/dist/rebuild-index-C5gTXryd.js +119 -0
  88. package/dist/rebuild-index-C5gTXryd.js.map +1 -0
  89. package/dist/rebuild-index-DwXM0WfA.js +104 -0
  90. package/dist/rebuild-index-DwXM0WfA.js.map +1 -0
  91. package/dist/request-BEF_OvMh.js +72 -0
  92. package/dist/request-BEF_OvMh.js.map +1 -0
  93. package/dist/restore-CbKVMMpm.js +847 -0
  94. package/dist/restore-CbKVMMpm.js.map +1 -0
  95. package/dist/shared-secret-BJdSwpgw.js +71 -0
  96. package/dist/shared-secret-BJdSwpgw.js.map +1 -0
  97. package/dist/snapshot-D7C4_FSl.js +71 -0
  98. package/dist/snapshot-D7C4_FSl.js.map +1 -0
  99. package/dist/snapshot-z_N9hpTe.js +917 -0
  100. package/dist/snapshot-z_N9hpTe.js.map +1 -0
  101. package/dist/src-Chafbw8r.js +522 -0
  102. package/dist/src-Chafbw8r.js.map +1 -0
  103. package/dist/src-DyET_VPP.js +6199 -0
  104. package/dist/src-DyET_VPP.js.map +1 -0
  105. package/dist/src-n0Te1r98.js +352 -0
  106. package/dist/src-n0Te1r98.js.map +1 -0
  107. package/dist/subcommand-BWs6K7zb.js +110 -0
  108. package/dist/subcommand-BWs6K7zb.js.map +1 -0
  109. package/dist/usage-RVUQMLop.js +339 -0
  110. package/dist/usage-RVUQMLop.js.map +1 -0
  111. package/dist/validate-DhH1lO8I.js +377 -0
  112. package/dist/validate-DhH1lO8I.js.map +1 -0
  113. package/dist/wire-izfGZDvr.js +7 -0
  114. package/dist/wire-izfGZDvr.js.map +1 -0
  115. package/package.json +189 -0
@@ -0,0 +1,14 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
4
+ var __exportAll = (all, no_symbols) => {
5
+ let target = {};
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
11
+ return target;
12
+ };
13
+ //#endregion
14
+ export { __exportAll as n, __commonJSMin as t };
@@ -0,0 +1,233 @@
1
+ import { a as CollectionNames, f as DocumentData, o as RowOf, r as BaerlyConfig, s as UnboundConfig } from "./app-config-Cb5dO2s9.js";
2
+ import { f as PredicateArg, l as OrderSpec } from "./index-BGC-ENnj.js";
3
+
4
+ //#region packages/client/src/request.d.ts
5
+ /**
6
+ * Pluggable fetch implementation. Defaults to `globalThis.fetch`;
7
+ * tests override with a {@link MockFetch}.
8
+ */
9
+ type Fetcher = (req: Request) => Promise<Response>;
10
+ //#endregion
11
+ //#region packages/client/src/client.d.ts
12
+ /**
13
+ * Public options for {@link createBaerlyClient}.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const client = createBaerlyClient({
18
+ * baseUrl: "https://api.example.com",
19
+ * headers: { Authorization: "Bearer <token>" },
20
+ * });
21
+ * ```
22
+ */
23
+ interface BaerlyClientOptions<TConfig extends BaerlyConfig = UnboundConfig> {
24
+ /**
25
+ * Required. The deployed `baerly` server URL — e.g.
26
+ * `https://acme.example.com`. No trailing slash.
27
+ */
28
+ readonly baseUrl: string;
29
+ /**
30
+ * Optional. Defaults to `globalThis.fetch`. Wrap your own to add
31
+ * logging, retries, tracing, or auth-refresh — the entire client
32
+ * routes every request through this one function. This is the
33
+ * `link` middleware story (tRPC) and the `interceptor` story
34
+ * (axios) without new API surface.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * // Log every request + response.
39
+ * const withLogging: Fetcher = async (req) => {
40
+ * const t0 = performance.now();
41
+ * const res = await globalThis.fetch(req);
42
+ * console.log(`${req.method} ${req.url} → ${res.status} (${Math.round(performance.now() - t0)}ms)`);
43
+ * return res;
44
+ * };
45
+ *
46
+ * // Retry idempotent reads on 5xx (max 3 total attempts, 100ms backoff).
47
+ * const withRetry = (next: Fetcher): Fetcher => async (req) => {
48
+ * for (let i = 0; i < 2; i++) {
49
+ * const res = await next(req.clone());
50
+ * if (res.ok || res.status < 500 || req.method !== "GET") return res;
51
+ * await new Promise((r) => setTimeout(r, 100 * (i + 1)));
52
+ * }
53
+ * return next(req);
54
+ * };
55
+ *
56
+ * const client = createBaerlyClient({
57
+ * baseUrl: "https://api.example.com",
58
+ * fetch: withRetry(withLogging),
59
+ * });
60
+ * ```
61
+ *
62
+ * See `dist/API.md` → "Recipe — wrapping the client `fetch`"
63
+ * for `onSuccess` / `onError` helpers and a composition pattern.
64
+ */
65
+ readonly fetch?: Fetcher;
66
+ /**
67
+ * Optional. Forwarded on every request. Typically
68
+ * `{ Authorization: "Bearer <token>" }`. For credential refresh
69
+ * (fresh JWT per call, 401-driven re-issue, etc.) wrap
70
+ * {@link BaerlyClientOptions.fetch} instead — see the retry +
71
+ * logging examples above.
72
+ */
73
+ readonly headers?: Headers | Record<string, string>;
74
+ /**
75
+ * Optional. **Type-only** — the runtime client does not read this
76
+ * field; it exists so `client.collection(name)` can narrow `name` to
77
+ * declared collection names and infer the row type from
78
+ * `collections[name].schema`. Bind the type via the generic
79
+ * parameter using `import type` so the server-side storage
80
+ * adapter and secrets in `baerly.config.ts` do not enter the
81
+ * browser bundle:
82
+ *
83
+ * ```ts
84
+ * import type config from "./baerly.config.ts";
85
+ * const client = createBaerlyClient<typeof config>({ baseUrl });
86
+ * await client.collection("tickets").first(); // Promise<Ticket | undefined>
87
+ * ```
88
+ *
89
+ * Skip the type parameter to fall back to the per-call generic
90
+ * `client.collection("tickets")` form.
91
+ */
92
+ readonly config?: TConfig;
93
+ }
94
+ /**
95
+ * Trailing-options bag accepted by every terminal. Today this is
96
+ * only `signal`, so the type is split out for readability rather
97
+ * than forcing every call site to ascribe `{ signal?: AbortSignal }`.
98
+ * When other per-call options land (timeout, idempotency key, etc.)
99
+ * they belong here.
100
+ */
101
+ interface TerminalOptions {
102
+ /**
103
+ * Cancels this specific request. React effect cleanup is the
104
+ * canonical caller:
105
+ *
106
+ * ```ts
107
+ * useEffect(() => {
108
+ * const ac = new AbortController();
109
+ * client.collection("tickets").where(p).all({ signal: ac.signal }).then(setRows);
110
+ * return () => ac.abort();
111
+ * }, [predicateKey]);
112
+ * ```
113
+ */
114
+ readonly signal?: AbortSignal;
115
+ }
116
+ /**
117
+ * Client-side mirror of `Collection<T>` from `@baerly/protocol`. Cheap
118
+ * handle; constructs no I/O. Same method names as the in-process
119
+ * `Collection<T>`, but every terminal also accepts a trailing
120
+ * {@link TerminalOptions} bag carrying `{ signal }`.
121
+ *
122
+ * By-id mutation verbs (`update`, `replace`, `delete`) live here;
123
+ * predicate-aware bulk mutation has no HTTP route today and is
124
+ * intentionally absent from {@link ClientQuery}.
125
+ *
126
+ * @template T — document shape. `_id` is always present on rows
127
+ * returned from the server.
128
+ */
129
+ interface ClientCollection<T extends DocumentData = DocumentData> {
130
+ readonly name: string;
131
+ /** First document in the whole collection or `undefined`. */
132
+ first(opts?: TerminalOptions): Promise<T | undefined>;
133
+ /** Every document in the whole collection. Pair with `.where(...).limit(n)` on large collections. */
134
+ all(opts?: TerminalOptions): Promise<T[]>;
135
+ /** Count every row in the collection (equivalent to `.where({}).count()`). */
136
+ count(opts?: TerminalOptions): Promise<number>;
137
+ /** Fetch one document by primary key. Returns `undefined` when the id is unknown. */
138
+ get(id: string, opts?: TerminalOptions): Promise<T | undefined>;
139
+ /**
140
+ * Filter rows. Two shapes:
141
+ *
142
+ * - **Object literal** — equality only.
143
+ * - **Callback DSL** — `q => q.eq(...).gt(...).in(...)` for the
144
+ * operator vocabulary.
145
+ *
146
+ * Chained calls AND-merge across shapes.
147
+ */
148
+ where(predicate: PredicateArg<T>): ClientQuery<T>;
149
+ /** Order modifier; last call wins. */
150
+ order(spec: OrderSpec<T>): ClientQuery<T>;
151
+ /** Limit modifier; last call wins. */
152
+ limit(n: number): ClientQuery<T>;
153
+ /** Insert a new document. Returns the server-assigned `_id`. */
154
+ insert(doc: Partial<T> & DocumentData, opts?: TerminalOptions): Promise<{
155
+ readonly _id: string;
156
+ }>;
157
+ /** JSON-merge-patch applied to one row by primary key. */
158
+ update(id: string, patch: Partial<T>, opts?: TerminalOptions): Promise<{
159
+ readonly modified: number;
160
+ }>;
161
+ /** Whole-document replace on one row by primary key. */
162
+ replace(id: string, doc: T, opts?: TerminalOptions): Promise<void>;
163
+ /** Delete one row by primary key. Returns `{ deleted: 0 }` on 404 (not an error). */
164
+ delete(id: string, opts?: TerminalOptions): Promise<{
165
+ readonly deleted: number;
166
+ }>;
167
+ }
168
+ /**
169
+ * Client-side mirror of `Query<T>` from `@baerly/protocol`. See
170
+ * {@link ClientCollection} for the method-shape contract.
171
+ *
172
+ * Read-only over HTTP: by-id mutation lives on {@link ClientCollection}
173
+ * directly. Predicate-aware bulk mutation is server-only — the HTTP
174
+ * surface has no route for it.
175
+ */
176
+ interface ClientQuery<T extends DocumentData = DocumentData> {
177
+ where(predicate: PredicateArg<T>): ClientQuery<T>;
178
+ order(spec: OrderSpec<T>): ClientQuery<T>;
179
+ limit(n: number): ClientQuery<T>;
180
+ /** First match or `undefined`. Issues `GET /v1/c/:collection?...&limit=1`. */
181
+ first(opts?: TerminalOptions): Promise<T | undefined>;
182
+ /** Every matching document. Pair with `.limit(n)` on large collections. */
183
+ all(opts?: TerminalOptions): Promise<T[]>;
184
+ /** Count matching rows. Issues `GET /v1/count?collection=&where=`; server returns a scalar. */
185
+ count(opts?: TerminalOptions): Promise<number>;
186
+ }
187
+ /**
188
+ * Returned by {@link createBaerlyClient}. The typed entry point.
189
+ *
190
+ * `BaerlyClient` does NOT expose a `transaction(...)` method:
191
+ * the server has no HTTP route for atomic batch commit today (see
192
+ * `packages/server/src/http/router.ts`). Issuing N HTTP requests
193
+ * from the client would silently break the single-CAS invariant.
194
+ * If you need atomic multi-row mutation today, expose a business-
195
+ * level RPC on the server that calls `db.transaction(...)` in-
196
+ * process.
197
+ *
198
+ * @example
199
+ * ```ts
200
+ * const client = createBaerlyClient({ baseUrl: "https://api.example.com" });
201
+ * const { _id } = await client.collection("tickets").insert({ title: "hi" });
202
+ * const row = await client.collection("tickets").get(_id);
203
+ * ```
204
+ */
205
+ interface BaerlyClient<TConfig extends BaerlyConfig = UnboundConfig> {
206
+ /**
207
+ * Typed collection handle. Cheap; constructs no I/O.
208
+ *
209
+ * When `TConfig` is bound (via `options.config`) and `name` is one
210
+ * of the declared collection names, the row type is inferred from
211
+ * `TConfig["collections"][name]["schema"]`. Otherwise the row type
212
+ * defaults to `DocumentData` and the call accepts any string name —
213
+ * matching the in-process `Db.collection` shape.
214
+ */
215
+ collection<N extends CollectionNames<TConfig>>(name: N): ClientCollection<RowOf<TConfig, N> & DocumentData>;
216
+ }
217
+ /**
218
+ * Construct a typed HTTP client over the locked `/v1/...` routes.
219
+ * Returns a {@link BaerlyClient} with the same surface as the
220
+ * in-process `Db.collection(...)` API.
221
+ *
222
+ * @example
223
+ * ```ts
224
+ * const client = createBaerlyClient({
225
+ * baseUrl: "https://api.example.com",
226
+ * headers: { Authorization: "Bearer <token>" },
227
+ * });
228
+ * ```
229
+ */
230
+ declare const createBaerlyClient: <TConfig extends BaerlyConfig = UnboundConfig>(options: BaerlyClientOptions<TConfig>) => BaerlyClient<TConfig>;
231
+ //#endregion
232
+ export { TerminalOptions as a, ClientQuery as i, BaerlyClientOptions as n, createBaerlyClient as o, ClientCollection as r, Fetcher as s, BaerlyClient as t };
233
+ //# sourceMappingURL=client-BLf3Ae5s.d.ts.map
@@ -0,0 +1,131 @@
1
+ import { r as BaerlyConfig, s as UnboundConfig } from "./app-config-Cb5dO2s9.js";
2
+ import { o as BaerlyError } from "./index-BGC-ENnj.js";
3
+ import { t as BaerlyClient } from "./client-BLf3Ae5s.js";
4
+ import { ReactNode } from "react";
5
+
6
+ //#region packages/client/src/react/provider.d.ts
7
+ interface BaerlyProviderProps {
8
+ readonly client: BaerlyClient;
9
+ readonly children?: ReactNode;
10
+ }
11
+ /**
12
+ * Provides a {@link BaerlyClient} to every Baerly React hook below it.
13
+ * Wrap your app once near the root; the hooks read the client from
14
+ * this context and have no `client` argument.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * import { createBaerlyClient } from "@gusto/baerly-storage/client";
19
+ * import { BaerlyProvider } from "@gusto/baerly-storage/client/react";
20
+ *
21
+ * const client = createBaerlyClient({ baseUrl: "/api" });
22
+ *
23
+ * <BaerlyProvider client={client}>
24
+ * <App />
25
+ * </BaerlyProvider>
26
+ * ```
27
+ */
28
+ declare const BaerlyProvider: ({
29
+ client,
30
+ children
31
+ }: BaerlyProviderProps) => React.JSX.Element;
32
+ /**
33
+ * Returns the {@link BaerlyClient} provided by the nearest
34
+ * {@link BaerlyProvider}. Throws a clear error if called outside a
35
+ * provider — every hook in this package uses it, so a missing
36
+ * provider surfaces here first.
37
+ *
38
+ * Use this directly when you need imperative access — e.g. inside an
39
+ * event handler that performs a one-shot read or a custom long-poll.
40
+ * For declarative reads and mutations, prefer the typed hooks.
41
+ *
42
+ * @example
43
+ * ```tsx
44
+ * const client = useBaerlyClient<MyConfig>();
45
+ * const onExport = async () => {
46
+ * const rows = await client.collection("tickets").all();
47
+ * download(rows);
48
+ * };
49
+ * ```
50
+ */
51
+ declare const useBaerlyClient: <TConfig extends BaerlyConfig = UnboundConfig>() => BaerlyClient<TConfig>;
52
+ //#endregion
53
+ //#region packages/client/src/react/use-query.d.ts
54
+ declare const SKIP: unique symbol;
55
+ /**
56
+ * Result handed back by {@link useQuery}. Discriminate on `status` —
57
+ * narrowing into `"ok"` / `"refreshing"` gives `data: T`; narrowing
58
+ * into `"loading"` / `"skipped"` gives `data: undefined`; narrowing
59
+ * into `"error"` gives `data: T | undefined` (the prior successful
60
+ * read survives across errors so the UI can keep rendering).
61
+ */
62
+ type UseQueryResult<T> = {
63
+ readonly status: "loading";
64
+ readonly data: undefined;
65
+ readonly error: undefined;
66
+ } | {
67
+ readonly status: "refreshing";
68
+ readonly data: T;
69
+ readonly error: undefined;
70
+ } | {
71
+ readonly status: "ok";
72
+ readonly data: T;
73
+ readonly error: undefined;
74
+ } | {
75
+ readonly status: "skipped";
76
+ readonly data: undefined;
77
+ readonly error: undefined;
78
+ } | {
79
+ readonly status: "error";
80
+ readonly data: T | undefined;
81
+ readonly error: Error;
82
+ };
83
+ /**
84
+ * Reactive read hook. See {@link useQueryImpl} JSDoc for usage.
85
+ * The `.skip` property is the sentinel that short-circuits the hook
86
+ * into `status: "skipped"`.
87
+ */
88
+ declare const useQuery: {
89
+ <T, TConfig extends BaerlyConfig = UnboundConfig>(callback: (client: BaerlyClient<TConfig>) => Promise<T> | typeof SKIP, deps?: ReadonlyArray<unknown>): UseQueryResult<T>;
90
+ readonly skip: typeof SKIP;
91
+ };
92
+ //#endregion
93
+ //#region packages/client/src/react/use-mutation.d.ts
94
+ /**
95
+ * Tuple returned by {@link useMutation}. Positionally mirrors React
96
+ * 19's `useActionState`: `[mutate, state]`. `mutate` is stable across
97
+ * renders; `state` is a fresh object only when `isPending` or
98
+ * `error` actually flips.
99
+ */
100
+ type UseMutationTuple<TConfig extends BaerlyConfig = UnboundConfig> = readonly [mutate: <T>(callback: (client: BaerlyClient<TConfig>) => Promise<T>) => Promise<T>, state: {
101
+ readonly isPending: boolean;
102
+ readonly error: BaerlyError | undefined;
103
+ }];
104
+ /**
105
+ * Imperative mutation hook. `mutate(callback)` runs the callback
106
+ * against the real `BaerlyClient` and resolves to whatever the
107
+ * callback returns; `state` carries `isPending` (refcounted across
108
+ * concurrent submits — `true` until every in-flight call settles)
109
+ * and `error` (last-wins; the most recent rejection until the next
110
+ * successful call clears it).
111
+ *
112
+ * Errors are normalised to {@link BaerlyError}: a non-`BaerlyError`
113
+ * throwable from the callback is wrapped under
114
+ * `code: "MutationFailed"` with the original on `.cause`.
115
+ *
116
+ * @example
117
+ * ```tsx
118
+ * const [mutate, { isPending, error }] = useMutation();
119
+ * <button
120
+ * disabled={isPending}
121
+ * onClick={() => mutate((client) => client.collection("notes").insert({ body }))}
122
+ * >
123
+ * {isPending ? "Saving…" : "Save"}
124
+ * </button>
125
+ * {error ? <p>{error.message}</p> : null}
126
+ * ```
127
+ */
128
+ declare const useMutation: <TConfig extends BaerlyConfig = UnboundConfig>() => UseMutationTuple<TConfig>;
129
+ //#endregion
130
+ export { BaerlyProvider, type BaerlyProviderProps, type UseMutationTuple, type UseQueryResult, useBaerlyClient, useMutation, useQuery };
131
+ //# sourceMappingURL=client-react.d.ts.map