lazyconvex 0.0.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 (70) hide show
  1. package/README.md +926 -0
  2. package/dist/components/index.mjs +937 -0
  3. package/dist/error-D4GuI0ot.mjs +71 -0
  4. package/dist/file-field-BqVgy8xY.mjs +205 -0
  5. package/dist/form-BXJK_j10.d.mts +99 -0
  6. package/dist/index.d.mts +433 -0
  7. package/dist/index.mjs +1 -0
  8. package/dist/index2.d.mts +5 -0
  9. package/dist/index3.d.mts +35 -0
  10. package/dist/index4.d.mts +101 -0
  11. package/dist/index5.d.mts +842 -0
  12. package/dist/next/index.mjs +151 -0
  13. package/dist/org-CmJBb8z-.d.mts +56 -0
  14. package/dist/react/index.mjs +158 -0
  15. package/dist/retry.d.mts +12 -0
  16. package/dist/retry.mjs +35 -0
  17. package/dist/schema.d.mts +23 -0
  18. package/dist/schema.mjs +15 -0
  19. package/dist/server/index.mjs +2572 -0
  20. package/dist/types-DWBVRtit.d.mts +322 -0
  21. package/dist/use-online-status-CMr73Jlk.mjs +155 -0
  22. package/dist/use-upload-DtELytQi.mjs +95 -0
  23. package/dist/zod.d.mts +18 -0
  24. package/dist/zod.mjs +87 -0
  25. package/package.json +40 -0
  26. package/src/components/editors-section.tsx +86 -0
  27. package/src/components/fields.tsx +884 -0
  28. package/src/components/file-field.tsx +234 -0
  29. package/src/components/form.tsx +191 -0
  30. package/src/components/index.ts +11 -0
  31. package/src/components/offline-indicator.tsx +15 -0
  32. package/src/components/org-avatar.tsx +13 -0
  33. package/src/components/permission-guard.tsx +36 -0
  34. package/src/components/role-badge.tsx +14 -0
  35. package/src/components/suspense-wrap.tsx +8 -0
  36. package/src/index.ts +40 -0
  37. package/src/next/active-org.ts +33 -0
  38. package/src/next/auth.ts +9 -0
  39. package/src/next/image.ts +134 -0
  40. package/src/next/index.ts +3 -0
  41. package/src/react/form-meta.ts +53 -0
  42. package/src/react/form.ts +201 -0
  43. package/src/react/index.ts +8 -0
  44. package/src/react/org.tsx +96 -0
  45. package/src/react/use-active-org.ts +48 -0
  46. package/src/react/use-bulk-selection.ts +47 -0
  47. package/src/react/use-online-status.ts +21 -0
  48. package/src/react/use-optimistic.ts +54 -0
  49. package/src/react/use-upload.ts +101 -0
  50. package/src/retry.ts +47 -0
  51. package/src/schema.ts +30 -0
  52. package/src/server/cache-crud.ts +175 -0
  53. package/src/server/check-schema.ts +29 -0
  54. package/src/server/child.ts +98 -0
  55. package/src/server/crud.ts +384 -0
  56. package/src/server/db.ts +7 -0
  57. package/src/server/error.ts +39 -0
  58. package/src/server/file.ts +372 -0
  59. package/src/server/helpers.ts +214 -0
  60. package/src/server/index.ts +12 -0
  61. package/src/server/org-crud.ts +307 -0
  62. package/src/server/org-helpers.ts +54 -0
  63. package/src/server/org.ts +572 -0
  64. package/src/server/schema-helpers.ts +107 -0
  65. package/src/server/setup.ts +138 -0
  66. package/src/server/test-crud.ts +211 -0
  67. package/src/server/test.ts +554 -0
  68. package/src/server/types.ts +392 -0
  69. package/src/server/unique.ts +28 -0
  70. package/src/zod.ts +141 -0
@@ -0,0 +1,433 @@
1
+ import { c as FieldMetaMap, n as ConflictData, r as FormReturn$1, t as Api } from "./form-BXJK_j10.mjs";
2
+ import { w as OrgRole } from "./types-DWBVRtit.mjs";
3
+ import { FunctionReference } from "convex/server";
4
+ import { ZodObject, ZodRawShape, infer } from "zod/v4";
5
+ import { AnyFieldApi } from "@tanstack/react-form";
6
+ import * as react from "react";
7
+ import { ComponentProps, ReactNode } from "react";
8
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
9
+ import { Button } from "@a/ui/button";
10
+ import { LucideIcon } from "lucide-react";
11
+ import { useNavigationGuard } from "next-navigation-guard";
12
+
13
+ //#region src/components/editors-section.d.ts
14
+ interface EditorInfo {
15
+ email: string;
16
+ name: string;
17
+ userId: string;
18
+ }
19
+ interface MemberInfo {
20
+ user: null | {
21
+ email?: string;
22
+ name?: string;
23
+ };
24
+ userId: string;
25
+ }
26
+ declare const EditorsSection: ({
27
+ editorsList,
28
+ members,
29
+ onAdd,
30
+ onRemove
31
+ }: {
32
+ editorsList: EditorInfo[];
33
+ members: MemberInfo[];
34
+ onAdd: (userId: string) => void;
35
+ onRemove: (userId: string) => void;
36
+ }) => react_jsx_runtime0.JSX.Element;
37
+ //#endregion
38
+ //#region src/components/fields.d.ts
39
+ declare const FormContext: react.Context<{
40
+ form: Api<Record<string, unknown>>;
41
+ meta: FieldMetaMap;
42
+ schema: ZodObject<ZodRawShape>;
43
+ } | null>, fields: {
44
+ Arr: ({
45
+ className,
46
+ "data-testid": testId,
47
+ disabled,
48
+ inputClassName,
49
+ label,
50
+ name,
51
+ placeholder,
52
+ tagClassName,
53
+ transform
54
+ }: {
55
+ className?: string;
56
+ "data-testid"?: string;
57
+ disabled?: boolean;
58
+ inputClassName?: string;
59
+ label?: string;
60
+ name: string;
61
+ placeholder?: string;
62
+ tagClassName?: string;
63
+ transform?: (v: string) => string;
64
+ }) => react_jsx_runtime0.JSX.Element;
65
+ Choose: ({
66
+ "data-testid": testId,
67
+ label,
68
+ name,
69
+ options: explicitOptions,
70
+ placeholder
71
+ }: {
72
+ "data-testid"?: string;
73
+ label?: string;
74
+ name: string;
75
+ options?: readonly {
76
+ label: string;
77
+ value: string;
78
+ }[];
79
+ placeholder?: string;
80
+ }) => react_jsx_runtime0.JSX.Element;
81
+ Colorpick: ({
82
+ "data-testid": testId,
83
+ label,
84
+ name
85
+ }: {
86
+ "data-testid"?: string;
87
+ label?: string;
88
+ name: string;
89
+ }) => react_jsx_runtime0.JSX.Element;
90
+ Combobox: ({
91
+ "data-testid": testId,
92
+ emptyText,
93
+ label,
94
+ name,
95
+ options,
96
+ placeholder,
97
+ searchPlaceholder
98
+ }: {
99
+ "data-testid"?: string;
100
+ emptyText?: string;
101
+ label?: string;
102
+ name: string;
103
+ options: readonly {
104
+ label: string;
105
+ value: string;
106
+ }[];
107
+ placeholder?: string;
108
+ searchPlaceholder?: string;
109
+ }) => react_jsx_runtime0.JSX.Element;
110
+ Datepick: ({
111
+ clearable,
112
+ "data-testid": testId,
113
+ disabled,
114
+ label,
115
+ name,
116
+ placeholder
117
+ }: {
118
+ clearable?: boolean;
119
+ "data-testid"?: string;
120
+ disabled?: boolean;
121
+ label?: string;
122
+ name: string;
123
+ placeholder?: string;
124
+ }) => react_jsx_runtime0.JSX.Element;
125
+ Err: ({
126
+ error
127
+ }: {
128
+ error: Error | null;
129
+ }) => react_jsx_runtime0.JSX.Element | null;
130
+ File: ({
131
+ accept,
132
+ className,
133
+ compressImg,
134
+ "data-testid": testId,
135
+ disabled,
136
+ label,
137
+ maxSize,
138
+ name
139
+ }: {
140
+ accept?: string;
141
+ className?: string;
142
+ compressImg?: boolean;
143
+ "data-testid"?: string;
144
+ disabled?: boolean;
145
+ label?: string;
146
+ maxSize?: number;
147
+ name: string;
148
+ }) => react_jsx_runtime0.JSX.Element;
149
+ Files: ({
150
+ accept,
151
+ className,
152
+ compressImg,
153
+ "data-testid": testId,
154
+ disabled,
155
+ label,
156
+ max,
157
+ maxSize,
158
+ name
159
+ }: {
160
+ accept?: string;
161
+ className?: string;
162
+ compressImg?: boolean;
163
+ "data-testid"?: string;
164
+ disabled?: boolean;
165
+ label?: string;
166
+ max?: number;
167
+ maxSize?: number;
168
+ name: string;
169
+ }) => react_jsx_runtime0.JSX.Element;
170
+ MultiSelect: ({
171
+ "data-testid": testId,
172
+ label,
173
+ name,
174
+ options,
175
+ placeholder
176
+ }: {
177
+ "data-testid"?: string;
178
+ label?: string;
179
+ name: string;
180
+ options: readonly {
181
+ label: string;
182
+ value: string;
183
+ }[];
184
+ placeholder?: string;
185
+ }) => react_jsx_runtime0.JSX.Element;
186
+ Num: ({
187
+ "data-testid": testId,
188
+ label,
189
+ name,
190
+ ...props
191
+ }: Omit<ComponentProps<"input">, "form" | "id" | "key" | "name" | "onBlur" | "onChange" | "type" | "value"> & {
192
+ "data-testid"?: string;
193
+ label?: string;
194
+ name: string;
195
+ }) => react_jsx_runtime0.JSX.Element;
196
+ Rating: ({
197
+ "data-testid": testId,
198
+ label,
199
+ max,
200
+ name
201
+ }: {
202
+ "data-testid"?: string;
203
+ label?: string;
204
+ max?: number;
205
+ name: string;
206
+ }) => react_jsx_runtime0.JSX.Element;
207
+ Slider: ({
208
+ "data-testid": testId,
209
+ label,
210
+ max,
211
+ min,
212
+ name,
213
+ step
214
+ }: {
215
+ "data-testid"?: string;
216
+ label?: string;
217
+ max?: number;
218
+ min?: number;
219
+ name: string;
220
+ step?: number;
221
+ }) => react_jsx_runtime0.JSX.Element;
222
+ Submit: ({
223
+ children,
224
+ disabled,
225
+ Icon,
226
+ ...props
227
+ }: Omit<ComponentProps<typeof Button>, "key" | "type"> & {
228
+ children: ReactNode;
229
+ Icon?: LucideIcon;
230
+ }) => react_jsx_runtime0.JSX.Element;
231
+ Text: ({
232
+ asyncDebounceMs,
233
+ asyncValidate,
234
+ "data-testid": testId,
235
+ label,
236
+ maxLength,
237
+ multiline,
238
+ name,
239
+ ...props
240
+ }: Omit<ComponentProps<"input"> & ComponentProps<"textarea">, "form" | "id" | "key" | "maxLength" | "name" | "onBlur" | "onChange" | "value"> & {
241
+ asyncDebounceMs?: number;
242
+ asyncValidate?: (value: string) => Promise<string | undefined>;
243
+ "data-testid"?: string;
244
+ label?: string;
245
+ maxLength?: number;
246
+ multiline?: boolean;
247
+ name: string;
248
+ }) => react_jsx_runtime0.JSX.Element;
249
+ Timepick: ({
250
+ "data-testid": testId,
251
+ label,
252
+ name,
253
+ placeholder
254
+ }: {
255
+ "data-testid"?: string;
256
+ label?: string;
257
+ name: string;
258
+ placeholder?: string;
259
+ }) => react_jsx_runtime0.JSX.Element;
260
+ Toggle: ({
261
+ "data-testid": testId,
262
+ falseLabel,
263
+ name,
264
+ trueLabel
265
+ }: {
266
+ "data-testid"?: string;
267
+ falseLabel?: string;
268
+ name: string;
269
+ trueLabel: string;
270
+ }) => react_jsx_runtime0.JSX.Element;
271
+ };
272
+ //#endregion
273
+ //#region src/components/file-field.d.ts
274
+ interface FileApi {
275
+ info: FunctionReference<'query'>;
276
+ upload: FunctionReference<'mutation'>;
277
+ }
278
+ declare const FileApiContext: react.Context<FileApi | null>, FileApiProvider: ({
279
+ children,
280
+ value
281
+ }: {
282
+ children: ReactNode;
283
+ value: FileApi;
284
+ }) => react_jsx_runtime0.JSX.Element, FileFieldImpl: ({
285
+ accept,
286
+ className,
287
+ compressImg,
288
+ "data-testid": testId,
289
+ disabled,
290
+ field: f,
291
+ label,
292
+ max,
293
+ maxSize,
294
+ multiple
295
+ }: {
296
+ accept?: string;
297
+ className?: string;
298
+ compressImg?: boolean;
299
+ "data-testid"?: string;
300
+ disabled?: boolean;
301
+ field: AnyFieldApi;
302
+ label?: string;
303
+ max?: number;
304
+ maxSize?: number;
305
+ multiple?: boolean;
306
+ }) => react_jsx_runtime0.JSX.Element;
307
+ //#endregion
308
+ //#region src/components/form.d.ts
309
+ declare const ConflictDialog: ({
310
+ conflict,
311
+ onResolve
312
+ }: {
313
+ conflict: ConflictData | null;
314
+ onResolve: (action: "cancel" | "overwrite" | "reload") => void;
315
+ }) => react_jsx_runtime0.JSX.Element;
316
+ interface FormReturn<T extends Record<string, unknown>, S extends ZodObject<ZodRawShape>> extends FormReturn$1<T, S> {
317
+ guard: ReturnType<typeof useNavigationGuard>;
318
+ }
319
+ type Key<T, V> = string & { [K in keyof T]: T[K] extends V ? K : never }[keyof T];
320
+ type Props<K extends keyof typeof fields> = Parameters<(typeof fields)[K]>[0];
321
+ interface TypedFields<T> {
322
+ Arr: (p: WithName<Props<'Arr'>, Key<T, readonly string[] | string[] | undefined>>) => ReactNode;
323
+ Choose: (p: WithName<Props<'Choose'>, Key<T, string | undefined>>) => ReactNode;
324
+ Colorpick: (p: WithName<Props<'Colorpick'>, Key<T, string | undefined>>) => ReactNode;
325
+ Combobox: (p: WithName<Props<'Combobox'>, Key<T, string | undefined>>) => ReactNode;
326
+ Datepick: (p: WithName<Props<'Datepick'>, Key<T, null | number | undefined>>) => ReactNode;
327
+ Err: typeof fields.Err;
328
+ File: (p: WithName<Props<'File'>, Key<T, null | string | undefined>>) => ReactNode;
329
+ Files: (p: WithName<Props<'Files'>, Key<T, readonly string[] | string[] | undefined>>) => ReactNode;
330
+ MultiSelect: (p: WithName<Props<'MultiSelect'>, Key<T, readonly string[] | string[] | undefined>>) => ReactNode;
331
+ Num: (p: WithName<Props<'Num'>, Key<T, number | undefined>>) => ReactNode;
332
+ Rating: (p: WithName<Props<'Rating'>, Key<T, number | undefined>>) => ReactNode;
333
+ Slider: (p: WithName<Props<'Slider'>, Key<T, number | undefined>>) => ReactNode;
334
+ Submit: typeof fields.Submit;
335
+ Text: (p: WithName<Props<'Text'>, Key<T, string | undefined>> & {
336
+ asyncDebounceMs?: number;
337
+ asyncValidate?: (value: string) => Promise<string | undefined>;
338
+ }) => ReactNode;
339
+ Timepick: (p: WithName<Props<'Timepick'>, Key<T, string | undefined>>) => ReactNode;
340
+ Toggle: (p: {
341
+ falseLabel?: string;
342
+ name: Key<T, boolean | undefined>;
343
+ trueLabel: string;
344
+ }) => ReactNode;
345
+ }
346
+ type WithName<P, K> = Omit<P, 'name'> & {
347
+ name: K;
348
+ };
349
+ declare const useForm: <S extends ZodObject<ZodRawShape>>(opts: {
350
+ autoSave?: {
351
+ debounceMs: number;
352
+ enabled: boolean;
353
+ };
354
+ onConflict?: (data: ConflictData) => void;
355
+ onError?: (e: unknown) => void;
356
+ onSubmit: (d: infer<S>, force?: boolean) => Promise<undefined | infer<S>> | undefined | infer<S>;
357
+ onSuccess?: () => void;
358
+ resetOnSuccess?: boolean;
359
+ schema: S;
360
+ values?: infer<S>;
361
+ }) => FormReturn<infer<S>, S>, useFormMutation: <S extends ZodObject<ZodRawShape>>(opts: {
362
+ mutation: FunctionReference<"mutation">;
363
+ onConflict?: (data: ConflictData) => void;
364
+ onError?: (e: unknown) => void;
365
+ onSuccess?: () => void;
366
+ resetOnSuccess?: boolean;
367
+ schema: S;
368
+ transform?: (d: infer<S>) => Record<string, unknown>;
369
+ values?: infer<S>;
370
+ }) => FormReturn<infer<S>, S>, Form: <T extends Record<string, unknown>, S extends ZodObject<ZodRawShape>>({
371
+ className,
372
+ form: {
373
+ conflict,
374
+ error,
375
+ guard,
376
+ instance,
377
+ meta,
378
+ resolveConflict,
379
+ schema
380
+ },
381
+ render,
382
+ showError
383
+ }: {
384
+ className?: string;
385
+ form: FormReturn<T, S>;
386
+ render: (f: TypedFields<T>) => ReactNode;
387
+ showError?: boolean;
388
+ }) => react_jsx_runtime0.JSX.Element, AutoSaveIndicator: ({
389
+ lastSaved
390
+ }: {
391
+ lastSaved: null | number;
392
+ }) => react_jsx_runtime0.JSX.Element | null;
393
+ //#endregion
394
+ //#region src/components/offline-indicator.d.ts
395
+ declare const OfflineIndicator: () => react_jsx_runtime0.JSX.Element | null;
396
+ //#endregion
397
+ //#region src/components/org-avatar.d.ts
398
+ declare const OrgAvatar: ({
399
+ avatarUrl,
400
+ name,
401
+ size
402
+ }: {
403
+ avatarUrl?: string;
404
+ name: string;
405
+ size?: "lg" | "md" | "sm";
406
+ }) => react_jsx_runtime0.JSX.Element;
407
+ //#endregion
408
+ //#region src/components/permission-guard.d.ts
409
+ declare const PermissionGuard: ({
410
+ backHref,
411
+ backLabel,
412
+ canAccess,
413
+ children,
414
+ resource
415
+ }: {
416
+ backHref: string;
417
+ backLabel: string;
418
+ canAccess: boolean;
419
+ children: ReactNode;
420
+ resource: string;
421
+ }) => string | number | bigint | boolean | react_jsx_runtime0.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
422
+ //#endregion
423
+ //#region src/components/role-badge.d.ts
424
+ declare const RoleBadge: ({
425
+ role
426
+ }: {
427
+ role: OrgRole;
428
+ }) => react_jsx_runtime0.JSX.Element;
429
+ //#endregion
430
+ //#region src/components/suspense-wrap.d.ts
431
+ declare const _default: (f: (...args: unknown[]) => ReactNode) => () => react_jsx_runtime0.JSX.Element;
432
+ //#endregion
433
+ export { type Api, AutoSaveIndicator, ConflictDialog, EditorsSection, FileApiContext, FileApiProvider, FileFieldImpl, Form, FormContext, OfflineIndicator, OrgAvatar, PermissionGuard, RoleBadge, fields, _default as suspenseWrap, useForm, useFormMutation };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,5 @@
1
+ import { c as FieldMetaMap, n as ConflictData, o as FieldKind, r as FormReturn, s as FieldMeta, t as Api } from "./form-BXJK_j10.mjs";
2
+ import { A as ReadCtx, C as OrgEnrichedDoc, D as Qb, E as PaginationOptsShape, F as WhereOf, I as WithUrls, M as SetupConfig, N as StorageLike, O as QueryCtxLike, P as WhereGroupOf, S as OrgCrudResult, T as PaginatedResult, _ as EnrichedDoc, a as CacheCrudResult, b as Mb, c as ChildConfig, d as CrudOptions, f as CrudReadApi, g as DocBase, h as DbReadLike, k as QueryLike, l as ChildCrudResult, m as DbLike, n as ActionCtxLike, o as CacheOptions, p as CrudResult, r as AuthorInfo, s as CanEditOpts, t as Ab, u as ComparisonOp, v as ErrorCode, w as OrgRole, x as MutationCtxLike, y as FID } from "./types-DWBVRtit.mjs";
3
+ import { i as OrgProviderProps, n as OrgDoc, t as OrgContextValue } from "./org-CmJBb8z-.mjs";
4
+ import { CvMeta, DefType, ZodSchema } from "./zod.mjs";
5
+ export { type Ab, type ActionCtxLike, type Api, type AuthorInfo, type CacheCrudResult, type CacheOptions, type CanEditOpts, type ChildConfig, type ChildCrudResult, type ComparisonOp, type ConflictData, type CrudOptions, type CrudReadApi, type CrudResult, type CvMeta, type DbLike, type DbReadLike, type DefType, type DocBase, type EnrichedDoc, type ErrorCode, type FID, type FieldKind, type FieldMeta, type FieldMetaMap, type FormReturn, type Mb, type MutationCtxLike, type OrgContextValue, type OrgCrudResult, type OrgDoc, type OrgEnrichedDoc, type OrgProviderProps, type OrgRole, type PaginatedResult, type PaginationOptsShape, type Qb, type QueryCtxLike, type QueryLike, type ReadCtx, type SetupConfig, type StorageLike, type WhereGroupOf, type WhereOf, type WithUrls, type ZodSchema };
@@ -0,0 +1,35 @@
1
+ import { FunctionReference } from "convex/server";
2
+ import { NextRequest, NextResponse } from "next/server";
3
+
4
+ //#region src/next/active-org.d.ts
5
+ declare const setActiveOrgCookie: ({
6
+ orgId,
7
+ slug
8
+ }: {
9
+ orgId: string;
10
+ slug: string;
11
+ }) => Promise<void>, clearActiveOrgCookie: () => Promise<void>, getActiveOrg: ({
12
+ query,
13
+ token
14
+ }: {
15
+ query: FunctionReference<"query">;
16
+ token: null | string;
17
+ }) => Promise<any>;
18
+ //#endregion
19
+ //#region src/next/auth.d.ts
20
+ declare const getToken: () => Promise<string | undefined>, isAuthenticated: () => Promise<boolean>;
21
+ //#endregion
22
+ //#region src/next/image.d.ts
23
+ interface ImageRouteConfig {
24
+ convexUrl: string;
25
+ fileInfoQuery?: string;
26
+ }
27
+ declare const makeImageRoute: ({
28
+ convexUrl,
29
+ fileInfoQuery
30
+ }: ImageRouteConfig) => Promise<{
31
+ GET: (req: NextRequest) => Promise<NextResponse>;
32
+ POST: (req: NextRequest) => Promise<NextResponse>;
33
+ }>;
34
+ //#endregion
35
+ export { clearActiveOrgCookie, getActiveOrg, getToken, isAuthenticated, makeImageRoute, setActiveOrgCookie };
@@ -0,0 +1,101 @@
1
+ import { a as useFormMutation, i as useForm, l as buildMeta, u as getMeta } from "./form-BXJK_j10.mjs";
2
+ import "./types-DWBVRtit.mjs";
3
+ import { a as canEditResource, c as useOrgMutation, l as useOrgQuery, o as useMyOrgs, r as OrgProvider, s as useOrg } from "./org-CmJBb8z-.mjs";
4
+ import { FunctionReference, FunctionReturnType, OptionalRestArgs } from "convex/server";
5
+
6
+ //#region src/react/use-active-org.d.ts
7
+ interface OrgDoc {
8
+ [key: string]: unknown;
9
+ _id: string;
10
+ slug: string;
11
+ }
12
+ declare const setActiveOrgCookieClient: ({
13
+ orgId,
14
+ slug
15
+ }: {
16
+ orgId: string;
17
+ slug: string;
18
+ }) => void, useActiveOrg: <O extends OrgDoc>(orgGetQuery: FunctionReference<"query">) => {
19
+ activeOrg: O | null;
20
+ activeOrgId: string | null;
21
+ clearActiveOrg: () => void;
22
+ isLoading: boolean;
23
+ setActiveOrg: (org: OrgDoc) => void;
24
+ };
25
+ //#endregion
26
+ //#region src/react/use-bulk-selection.d.ts
27
+ interface UseBulkSelectionOpts {
28
+ bulkRm: (args: {
29
+ ids: string[];
30
+ orgId: string;
31
+ }) => Promise<unknown>;
32
+ items: {
33
+ _id: string;
34
+ }[];
35
+ onError?: (error: unknown) => void;
36
+ onSuccess?: (count: number) => void;
37
+ orgId: string;
38
+ }
39
+ declare const useBulkSelection: ({
40
+ bulkRm,
41
+ items,
42
+ onError,
43
+ onSuccess,
44
+ orgId
45
+ }: UseBulkSelectionOpts) => {
46
+ clear: () => void;
47
+ handleBulkDelete: () => void;
48
+ selected: Set<string>;
49
+ toggleSelect: (id: string) => void;
50
+ toggleSelectAll: () => void;
51
+ };
52
+ //#endregion
53
+ //#region src/react/use-online-status.d.ts
54
+ declare const useOnlineStatus: () => boolean;
55
+ //#endregion
56
+ //#region src/react/use-optimistic.d.ts
57
+ type Args<T extends MutationFn> = OptionalRestArgs<T>[0];
58
+ type MutationFn = FunctionReference<'mutation'>;
59
+ interface OptimisticOptions<T extends MutationFn, R = FunctionReturnType<T>> {
60
+ mutation: T;
61
+ onOptimistic?: (args: Args<T>) => void;
62
+ onRollback?: (args: Args<T>, catchError: Error) => void;
63
+ onSuccess?: (result: R, args: Args<T>) => void;
64
+ }
65
+ declare const useOptimisticMutation: <T extends MutationFn>({
66
+ mutation,
67
+ onOptimistic,
68
+ onRollback,
69
+ onSuccess
70
+ }: OptimisticOptions<T>) => {
71
+ error: Error | null;
72
+ execute: (args: Args<T>) => Promise<FunctionReturnType<T> | null>;
73
+ isPending: boolean;
74
+ };
75
+ //#endregion
76
+ //#region src/react/use-upload.d.ts
77
+ interface UploadOptions {
78
+ retries?: number;
79
+ retryDelay?: number;
80
+ }
81
+ type UploadResult = {
82
+ code: 'ABORTED' | 'INVALID_RESPONSE' | 'NETWORK' | 'URL';
83
+ ok: false;
84
+ } | {
85
+ code: 'HTTP';
86
+ ok: false;
87
+ status: number;
88
+ } | {
89
+ ok: true;
90
+ storageId: string;
91
+ };
92
+ declare const useUpload: (uploadMutation: FunctionReference<"mutation">, options?: UploadOptions) => {
93
+ attempt: number;
94
+ cancel: () => void;
95
+ isUploading: boolean;
96
+ progress: number;
97
+ reset: () => void;
98
+ upload: (file: File) => Promise<UploadResult>;
99
+ };
100
+ //#endregion
101
+ export { OrgProvider, buildMeta, canEditResource, getMeta, setActiveOrgCookieClient, useActiveOrg, useBulkSelection, useForm, useFormMutation, useMyOrgs, useOnlineStatus, useOptimisticMutation, useOrg, useOrgMutation, useOrgQuery, useUpload };