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.
- package/README.md +926 -0
- package/dist/components/index.mjs +937 -0
- package/dist/error-D4GuI0ot.mjs +71 -0
- package/dist/file-field-BqVgy8xY.mjs +205 -0
- package/dist/form-BXJK_j10.d.mts +99 -0
- package/dist/index.d.mts +433 -0
- package/dist/index.mjs +1 -0
- package/dist/index2.d.mts +5 -0
- package/dist/index3.d.mts +35 -0
- package/dist/index4.d.mts +101 -0
- package/dist/index5.d.mts +842 -0
- package/dist/next/index.mjs +151 -0
- package/dist/org-CmJBb8z-.d.mts +56 -0
- package/dist/react/index.mjs +158 -0
- package/dist/retry.d.mts +12 -0
- package/dist/retry.mjs +35 -0
- package/dist/schema.d.mts +23 -0
- package/dist/schema.mjs +15 -0
- package/dist/server/index.mjs +2572 -0
- package/dist/types-DWBVRtit.d.mts +322 -0
- package/dist/use-online-status-CMr73Jlk.mjs +155 -0
- package/dist/use-upload-DtELytQi.mjs +95 -0
- package/dist/zod.d.mts +18 -0
- package/dist/zod.mjs +87 -0
- package/package.json +40 -0
- package/src/components/editors-section.tsx +86 -0
- package/src/components/fields.tsx +884 -0
- package/src/components/file-field.tsx +234 -0
- package/src/components/form.tsx +191 -0
- package/src/components/index.ts +11 -0
- package/src/components/offline-indicator.tsx +15 -0
- package/src/components/org-avatar.tsx +13 -0
- package/src/components/permission-guard.tsx +36 -0
- package/src/components/role-badge.tsx +14 -0
- package/src/components/suspense-wrap.tsx +8 -0
- package/src/index.ts +40 -0
- package/src/next/active-org.ts +33 -0
- package/src/next/auth.ts +9 -0
- package/src/next/image.ts +134 -0
- package/src/next/index.ts +3 -0
- package/src/react/form-meta.ts +53 -0
- package/src/react/form.ts +201 -0
- package/src/react/index.ts +8 -0
- package/src/react/org.tsx +96 -0
- package/src/react/use-active-org.ts +48 -0
- package/src/react/use-bulk-selection.ts +47 -0
- package/src/react/use-online-status.ts +21 -0
- package/src/react/use-optimistic.ts +54 -0
- package/src/react/use-upload.ts +101 -0
- package/src/retry.ts +47 -0
- package/src/schema.ts +30 -0
- package/src/server/cache-crud.ts +175 -0
- package/src/server/check-schema.ts +29 -0
- package/src/server/child.ts +98 -0
- package/src/server/crud.ts +384 -0
- package/src/server/db.ts +7 -0
- package/src/server/error.ts +39 -0
- package/src/server/file.ts +372 -0
- package/src/server/helpers.ts +214 -0
- package/src/server/index.ts +12 -0
- package/src/server/org-crud.ts +307 -0
- package/src/server/org-helpers.ts +54 -0
- package/src/server/org.ts +572 -0
- package/src/server/schema-helpers.ts +107 -0
- package/src/server/setup.ts +138 -0
- package/src/server/test-crud.ts +211 -0
- package/src/server/test.ts +554 -0
- package/src/server/types.ts +392 -0
- package/src/server/unique.ts +28 -0
- package/src/zod.ts +141 -0
|
@@ -0,0 +1,842 @@
|
|
|
1
|
+
import { I as WithUrls, M as SetupConfig, N as StorageLike, O as QueryCtxLike, S as OrgCrudResult, a as CacheCrudResult, c as ChildConfig, d as CrudOptions, i as BaseBuilders, j as Rec, l as ChildCrudResult, m as DbLike, p as CrudResult, s as CanEditOpts, u as ComparisonOp, v as ErrorCode, w as OrgRole, x as MutationCtxLike } from "./types-DWBVRtit.mjs";
|
|
2
|
+
import * as convex_values0 from "convex/values";
|
|
3
|
+
import { GenericId } from "convex/values";
|
|
4
|
+
import * as convex_server0 from "convex/server";
|
|
5
|
+
import { ActionBuilder, GenericDataModel, GenericMutationCtx, GenericQueryCtx, MutationBuilder, QueryBuilder } from "convex/server";
|
|
6
|
+
import * as zod_v40 from "zod/v4";
|
|
7
|
+
import { ZodObject, ZodRawShape, z } from "zod/v4";
|
|
8
|
+
import * as convex_helpers_server_zod40 from "convex-helpers/server/zod4";
|
|
9
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
10
|
+
|
|
11
|
+
//#region src/server/check-schema.d.ts
|
|
12
|
+
declare const checkSchema: (schemas: Record<string, ZodObject<ZodRawShape>>) => void;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/server/error.d.ts
|
|
15
|
+
type ErrorHandler = Partial<Record<ErrorCode, () => void>> & {
|
|
16
|
+
default?: () => void;
|
|
17
|
+
};
|
|
18
|
+
declare const isRecord: (v: unknown) => v is Record<string, unknown>, getErrorCode: (e: unknown) => ErrorCode | undefined, getErrorMessage: (e: unknown) => string, handleConvexError: (e: unknown, handlers: ErrorHandler) => void;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/server/file.d.ts
|
|
21
|
+
interface FileUploadConfig<DM extends GenericDataModel = GenericDataModel> {
|
|
22
|
+
action: ActionBuilder<DM, 'public'>;
|
|
23
|
+
allowedTypes?: Set<string>;
|
|
24
|
+
getAuthUserId: (ctx: unknown) => Promise<null | string>;
|
|
25
|
+
internalMutation: MutationBuilder<DM, 'internal'>;
|
|
26
|
+
internalQuery: QueryBuilder<DM, 'internal'>;
|
|
27
|
+
maxFileSize?: number;
|
|
28
|
+
mutation: MutationBuilder<DM, 'public'>;
|
|
29
|
+
namespace: string;
|
|
30
|
+
query: QueryBuilder<DM, 'public'>;
|
|
31
|
+
}
|
|
32
|
+
declare const CHUNK_SIZE: number, makeFileUpload: <DM extends GenericDataModel>(config: FileUploadConfig<DM>) => {
|
|
33
|
+
assembleChunks: convex_server0.RegisteredAction<"public", convex_server0.DefaultFunctionArgs, any>;
|
|
34
|
+
cancelChunkedUpload: convex_server0.RegisteredMutation<"public", convex_server0.DefaultFunctionArgs, any>;
|
|
35
|
+
CHUNK_SIZE: number;
|
|
36
|
+
confirmChunk: convex_server0.RegisteredMutation<"public", convex_server0.DefaultFunctionArgs, any>;
|
|
37
|
+
finalizeAssembly: convex_server0.RegisteredMutation<"internal", convex_server0.DefaultFunctionArgs, any>;
|
|
38
|
+
getSessionForAssembly: convex_server0.RegisteredQuery<"internal", convex_server0.DefaultFunctionArgs, any>;
|
|
39
|
+
getUploadProgress: convex_server0.RegisteredQuery<"public", convex_server0.DefaultFunctionArgs, any>;
|
|
40
|
+
info: convex_server0.RegisteredQuery<"public", convex_server0.DefaultFunctionArgs, any>;
|
|
41
|
+
startChunkedUpload: convex_server0.RegisteredMutation<"public", convex_server0.DefaultFunctionArgs, any>;
|
|
42
|
+
upload: convex_server0.RegisteredMutation<"public", convex_server0.DefaultFunctionArgs, any>;
|
|
43
|
+
uploadChunk: convex_server0.RegisteredMutation<"public", convex_server0.DefaultFunctionArgs, any>;
|
|
44
|
+
validate: convex_server0.RegisteredMutation<"public", convex_server0.DefaultFunctionArgs, any>;
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/server/helpers.d.ts
|
|
48
|
+
declare const log: (level: "debug" | "error" | "info" | "warn", msg: string, data?: Record<string, unknown>) => void, isRecord$1: (v: unknown) => v is Record<string, unknown>, isComparisonOp: (val: unknown) => val is ComparisonOp<unknown>, pgOpts: zod_v40.ZodObject<{
|
|
49
|
+
cursor: zod_v40.ZodNullable<zod_v40.ZodString>;
|
|
50
|
+
endCursor: zod_v40.ZodOptional<zod_v40.ZodNullable<zod_v40.ZodString>>;
|
|
51
|
+
id: zod_v40.ZodOptional<zod_v40.ZodNumber>;
|
|
52
|
+
maximumBytesRead: zod_v40.ZodOptional<zod_v40.ZodNumber>;
|
|
53
|
+
maximumRowsRead: zod_v40.ZodOptional<zod_v40.ZodNumber>;
|
|
54
|
+
numItems: zod_v40.ZodNumber;
|
|
55
|
+
}, zod_v4_core0.$strip>, cascadeFor: (parent: string, children: Record<string, ChildConfig>) => {
|
|
56
|
+
foreignKey: string;
|
|
57
|
+
table: string;
|
|
58
|
+
}[], detectFiles: <S extends ZodRawShape>(s: S) => (keyof S & string)[], err: (code: ErrorCode, debug?: string) => never, noFetcher: () => never, time: () => {
|
|
59
|
+
updatedAt: number;
|
|
60
|
+
}, getUser: ({
|
|
61
|
+
ctx,
|
|
62
|
+
db,
|
|
63
|
+
getAuthUserId
|
|
64
|
+
}: {
|
|
65
|
+
ctx: MutationCtxLike | QueryCtxLike;
|
|
66
|
+
db: DbLike;
|
|
67
|
+
getAuthUserId: (c: never) => Promise<null | string>;
|
|
68
|
+
}) => Promise<Record<string, unknown> & {
|
|
69
|
+
_id: string;
|
|
70
|
+
}>, ownGet: (db: DbLike, userId: string) => (id: string) => Promise<Record<string, unknown>>, readCtx: <D = DbLike, S = StorageLike>({
|
|
71
|
+
db,
|
|
72
|
+
storage,
|
|
73
|
+
viewerId
|
|
74
|
+
}: {
|
|
75
|
+
db: D;
|
|
76
|
+
storage: S;
|
|
77
|
+
viewerId: null | string;
|
|
78
|
+
}) => {
|
|
79
|
+
db: D;
|
|
80
|
+
storage: S;
|
|
81
|
+
viewerId: string | null;
|
|
82
|
+
withAuthor: <T extends {
|
|
83
|
+
userId: string;
|
|
84
|
+
}>(docs: T[]) => Promise<(T & {
|
|
85
|
+
author: Rec | null;
|
|
86
|
+
own: boolean | null;
|
|
87
|
+
})[]>;
|
|
88
|
+
}, cleanFiles: (opts: {
|
|
89
|
+
doc: Record<string, unknown>;
|
|
90
|
+
fileFields: string[];
|
|
91
|
+
next?: Record<string, unknown>;
|
|
92
|
+
storage: StorageLike;
|
|
93
|
+
}) => Promise<void>, addUrls: <D extends Record<string, unknown>>({
|
|
94
|
+
doc,
|
|
95
|
+
fileFields,
|
|
96
|
+
storage
|
|
97
|
+
}: {
|
|
98
|
+
doc: D;
|
|
99
|
+
fileFields: string[];
|
|
100
|
+
storage: StorageLike;
|
|
101
|
+
}) => Promise<WithUrls<D>>, groupList: <WG extends Record<string, unknown> & {
|
|
102
|
+
own?: boolean;
|
|
103
|
+
}>(w?: WG & {
|
|
104
|
+
or?: WG[];
|
|
105
|
+
}) => WG[], matchW: <WG extends Record<string, unknown> & {
|
|
106
|
+
own?: boolean;
|
|
107
|
+
}>(doc: Record<string, unknown>, w: undefined | (WG & {
|
|
108
|
+
or?: WG[];
|
|
109
|
+
}), vid?: null | string) => boolean, pickFields: (data: Record<string, unknown>, keys: string[]) => Record<string, unknown>, errValidation: (code: ErrorCode, zodError: {
|
|
110
|
+
flatten: () => {
|
|
111
|
+
fieldErrors: Record<string, string[] | undefined>;
|
|
112
|
+
};
|
|
113
|
+
}) => never;
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/server/org.d.ts
|
|
116
|
+
interface InviteDocLike {
|
|
117
|
+
[k: string]: unknown;
|
|
118
|
+
_creationTime: number;
|
|
119
|
+
_id: GenericId<'orgInvite'>;
|
|
120
|
+
email: string;
|
|
121
|
+
expiresAt: number;
|
|
122
|
+
isAdmin: boolean;
|
|
123
|
+
orgId: GenericId<'org'>;
|
|
124
|
+
token: string;
|
|
125
|
+
}
|
|
126
|
+
interface JoinRequestItem {
|
|
127
|
+
request: {
|
|
128
|
+
[k: string]: unknown;
|
|
129
|
+
_creationTime: number;
|
|
130
|
+
_id: GenericId<'orgJoinRequest'>;
|
|
131
|
+
message?: string;
|
|
132
|
+
orgId: GenericId<'org'>;
|
|
133
|
+
status: string;
|
|
134
|
+
userId: GenericId<'users'>;
|
|
135
|
+
};
|
|
136
|
+
user: null | OrgUserLike;
|
|
137
|
+
}
|
|
138
|
+
interface OrgDocLike {
|
|
139
|
+
[k: string]: unknown;
|
|
140
|
+
_creationTime: number;
|
|
141
|
+
_id: GenericId<'org'>;
|
|
142
|
+
avatarId?: GenericId<'_storage'>;
|
|
143
|
+
name: string;
|
|
144
|
+
slug: string;
|
|
145
|
+
updatedAt: number;
|
|
146
|
+
userId: GenericId<'users'>;
|
|
147
|
+
}
|
|
148
|
+
interface OrgMemberItem {
|
|
149
|
+
memberId?: GenericId<'orgMember'>;
|
|
150
|
+
role: OrgRole;
|
|
151
|
+
user: null | OrgUserLike;
|
|
152
|
+
userId: GenericId<'users'>;
|
|
153
|
+
}
|
|
154
|
+
interface OrgUserLike {
|
|
155
|
+
[k: string]: unknown;
|
|
156
|
+
_id: GenericId<'users'>;
|
|
157
|
+
email?: string;
|
|
158
|
+
image?: string;
|
|
159
|
+
name?: string;
|
|
160
|
+
}
|
|
161
|
+
declare const makeOrg: <DM extends GenericDataModel, S extends ZodRawShape>({
|
|
162
|
+
cascadeTables,
|
|
163
|
+
getAuthUserId,
|
|
164
|
+
mutation,
|
|
165
|
+
query,
|
|
166
|
+
schema: orgSchema
|
|
167
|
+
}: {
|
|
168
|
+
cascadeTables?: string[];
|
|
169
|
+
getAuthUserId: (ctx: never) => Promise<null | string>;
|
|
170
|
+
mutation: MutationBuilder<DM, "public">;
|
|
171
|
+
query: QueryBuilder<DM, "public">;
|
|
172
|
+
schema: ZodObject<S>;
|
|
173
|
+
}) => {
|
|
174
|
+
acceptInvite: convex_server0.RegisteredMutation<"public", {
|
|
175
|
+
token: string;
|
|
176
|
+
}, Promise<{
|
|
177
|
+
orgId: GenericId<"org">;
|
|
178
|
+
}>>;
|
|
179
|
+
approveJoinRequest: convex_server0.RegisteredMutation<"public", {
|
|
180
|
+
requestId: unknown;
|
|
181
|
+
isAdmin?: boolean | undefined;
|
|
182
|
+
}, Promise<undefined>>;
|
|
183
|
+
cancelJoinRequest: convex_server0.RegisteredMutation<"public", {
|
|
184
|
+
requestId: unknown;
|
|
185
|
+
}, Promise<undefined>>;
|
|
186
|
+
create: convex_server0.RegisteredMutation<"public", {
|
|
187
|
+
data: z.core.$InferObjectInput<S, {}>;
|
|
188
|
+
}, Promise<{
|
|
189
|
+
orgId: GenericId<"org">;
|
|
190
|
+
}>>;
|
|
191
|
+
get: convex_server0.RegisteredQuery<"public", {
|
|
192
|
+
orgId: unknown;
|
|
193
|
+
}, Promise<OrgDocLike | null>>;
|
|
194
|
+
getBySlug: convex_server0.RegisteredQuery<"public", {
|
|
195
|
+
slug: string;
|
|
196
|
+
}, Promise<OrgDocLike | null>>;
|
|
197
|
+
getPublic: convex_server0.RegisteredQuery<"public", {
|
|
198
|
+
slug: string;
|
|
199
|
+
}, Promise<{
|
|
200
|
+
_id: GenericId<"org">;
|
|
201
|
+
avatarId?: GenericId<"_storage">;
|
|
202
|
+
name: string;
|
|
203
|
+
slug: string;
|
|
204
|
+
} | null>>;
|
|
205
|
+
invite: convex_server0.RegisteredMutation<"public", {
|
|
206
|
+
email: string;
|
|
207
|
+
isAdmin: boolean;
|
|
208
|
+
orgId: unknown;
|
|
209
|
+
}, Promise<{
|
|
210
|
+
inviteId: GenericId<"orgInvite">;
|
|
211
|
+
token: string;
|
|
212
|
+
}>>;
|
|
213
|
+
isSlugAvailable: convex_server0.RegisteredQuery<"public", {
|
|
214
|
+
slug: string;
|
|
215
|
+
}, Promise<{
|
|
216
|
+
available: boolean;
|
|
217
|
+
}>>;
|
|
218
|
+
leave: convex_server0.RegisteredMutation<"public", {
|
|
219
|
+
orgId: unknown;
|
|
220
|
+
}, Promise<undefined>>;
|
|
221
|
+
members: convex_server0.RegisteredQuery<"public", {
|
|
222
|
+
orgId: unknown;
|
|
223
|
+
}, Promise<OrgMemberItem[]>>;
|
|
224
|
+
membership: convex_server0.RegisteredQuery<"public", {
|
|
225
|
+
orgId: unknown;
|
|
226
|
+
}, Promise<{
|
|
227
|
+
memberId: GenericId<"orgMember"> | null;
|
|
228
|
+
role: OrgRole;
|
|
229
|
+
} | null>>;
|
|
230
|
+
myJoinRequest: convex_server0.RegisteredQuery<"public", {
|
|
231
|
+
orgId: unknown;
|
|
232
|
+
}, Promise<{
|
|
233
|
+
_id: GenericId<"orgJoinRequest">;
|
|
234
|
+
message?: string;
|
|
235
|
+
orgId: GenericId<"org">;
|
|
236
|
+
status: string;
|
|
237
|
+
userId: GenericId<"users">;
|
|
238
|
+
} | null>>;
|
|
239
|
+
myOrgs: convex_server0.RegisteredQuery<"public", {}, Promise<{
|
|
240
|
+
org: OrgDocLike;
|
|
241
|
+
role: OrgRole;
|
|
242
|
+
}[]>>;
|
|
243
|
+
pendingInvites: convex_server0.RegisteredQuery<"public", {
|
|
244
|
+
orgId: unknown;
|
|
245
|
+
}, Promise<InviteDocLike[]>>;
|
|
246
|
+
pendingJoinRequests: convex_server0.RegisteredQuery<"public", {
|
|
247
|
+
orgId: unknown;
|
|
248
|
+
}, Promise<JoinRequestItem[]>>;
|
|
249
|
+
rejectJoinRequest: convex_server0.RegisteredMutation<"public", {
|
|
250
|
+
requestId: unknown;
|
|
251
|
+
}, Promise<undefined>>;
|
|
252
|
+
remove: convex_server0.RegisteredMutation<"public", {
|
|
253
|
+
orgId: unknown;
|
|
254
|
+
}, Promise<undefined>>;
|
|
255
|
+
removeMember: convex_server0.RegisteredMutation<"public", {
|
|
256
|
+
memberId: unknown;
|
|
257
|
+
}, Promise<undefined>>;
|
|
258
|
+
requestJoin: convex_server0.RegisteredMutation<"public", {
|
|
259
|
+
orgId: unknown;
|
|
260
|
+
message?: string | undefined;
|
|
261
|
+
}, Promise<{
|
|
262
|
+
requestId: GenericId<"orgJoinRequest">;
|
|
263
|
+
}>>;
|
|
264
|
+
revokeInvite: convex_server0.RegisteredMutation<"public", {
|
|
265
|
+
inviteId: unknown;
|
|
266
|
+
}, Promise<undefined>>;
|
|
267
|
+
setAdmin: convex_server0.RegisteredMutation<"public", {
|
|
268
|
+
isAdmin: boolean;
|
|
269
|
+
memberId: unknown;
|
|
270
|
+
}, Promise<undefined>>;
|
|
271
|
+
transferOwnership: convex_server0.RegisteredMutation<"public", {
|
|
272
|
+
newOwnerId: unknown;
|
|
273
|
+
orgId: unknown;
|
|
274
|
+
}, Promise<undefined>>;
|
|
275
|
+
update: convex_server0.RegisteredMutation<"public", {
|
|
276
|
+
data: z.core.$InferObjectInput<{ [k in keyof S]: z.ZodOptional<S[k]> }, {}>;
|
|
277
|
+
orgId: unknown;
|
|
278
|
+
}, Promise<undefined>>;
|
|
279
|
+
};
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region src/server/org-crud.d.ts
|
|
282
|
+
interface CascadeOption {
|
|
283
|
+
foreignKey: string;
|
|
284
|
+
table: string;
|
|
285
|
+
}
|
|
286
|
+
interface OrgCrudOptions {
|
|
287
|
+
acl?: boolean;
|
|
288
|
+
aclFrom?: {
|
|
289
|
+
field: string;
|
|
290
|
+
table: string;
|
|
291
|
+
};
|
|
292
|
+
cascade?: CascadeOption;
|
|
293
|
+
}
|
|
294
|
+
declare const makeOrgCrud: <S extends ZodRawShape>({
|
|
295
|
+
builders,
|
|
296
|
+
options: opt,
|
|
297
|
+
schema,
|
|
298
|
+
table
|
|
299
|
+
}: {
|
|
300
|
+
builders: BaseBuilders;
|
|
301
|
+
options?: OrgCrudOptions;
|
|
302
|
+
schema: ZodObject<S>;
|
|
303
|
+
table: string;
|
|
304
|
+
}) => OrgCrudResult<S>, orgCascade: (config: {
|
|
305
|
+
foreignKey: string;
|
|
306
|
+
table: string;
|
|
307
|
+
}) => CascadeOption;
|
|
308
|
+
//#endregion
|
|
309
|
+
//#region src/server/org-helpers.d.ts
|
|
310
|
+
declare const ROLE_LEVEL: Record<OrgRole, number>, getOrgRole: ({
|
|
311
|
+
member,
|
|
312
|
+
org,
|
|
313
|
+
userId
|
|
314
|
+
}: {
|
|
315
|
+
member: null | Record<string, unknown>;
|
|
316
|
+
org: Record<string, unknown>;
|
|
317
|
+
userId: string;
|
|
318
|
+
}) => null | OrgRole, getOrgMember: ({
|
|
319
|
+
db,
|
|
320
|
+
orgId,
|
|
321
|
+
userId
|
|
322
|
+
}: {
|
|
323
|
+
db: unknown;
|
|
324
|
+
orgId: string;
|
|
325
|
+
userId: string;
|
|
326
|
+
}) => Promise<Record<string, unknown> | null>, requireOrgMember: ({
|
|
327
|
+
db,
|
|
328
|
+
orgId,
|
|
329
|
+
userId
|
|
330
|
+
}: {
|
|
331
|
+
db: unknown;
|
|
332
|
+
orgId: string;
|
|
333
|
+
userId: string;
|
|
334
|
+
}) => Promise<{
|
|
335
|
+
member: Record<string, unknown> | null;
|
|
336
|
+
org: Rec;
|
|
337
|
+
role: OrgRole;
|
|
338
|
+
}>;
|
|
339
|
+
interface RequireOrgRoleArgs {
|
|
340
|
+
db: unknown;
|
|
341
|
+
minRole: OrgRole;
|
|
342
|
+
orgId: string;
|
|
343
|
+
userId: string;
|
|
344
|
+
}
|
|
345
|
+
declare const requireOrgRole: ({
|
|
346
|
+
db,
|
|
347
|
+
minRole,
|
|
348
|
+
orgId,
|
|
349
|
+
userId
|
|
350
|
+
}: RequireOrgRoleArgs) => Promise<{
|
|
351
|
+
member: Record<string, unknown> | null;
|
|
352
|
+
org: Rec;
|
|
353
|
+
role: OrgRole;
|
|
354
|
+
}>, canEdit: ({
|
|
355
|
+
acl,
|
|
356
|
+
doc,
|
|
357
|
+
role,
|
|
358
|
+
userId
|
|
359
|
+
}: CanEditOpts) => boolean;
|
|
360
|
+
//#endregion
|
|
361
|
+
//#region src/server/schema-helpers.d.ts
|
|
362
|
+
declare const baseTable: <T extends ZodRawShape>(s: ZodObject<T>) => convex_server0.TableDefinition<convex_values0.VObject<convex_server0.Expand<{ [Property_1 in ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
363
|
+
updatedAt: convex_values0.VFloat64<number | undefined, "optional">;
|
|
364
|
+
} extends infer T_1 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_1]: T_1[Property]["isOptional"] extends "optional" ? Property : never } : never)[keyof T | "updatedAt"]]?: Exclude<convex_values0.Infer<({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
365
|
+
updatedAt: convex_values0.VFloat64<number | undefined, "optional">;
|
|
366
|
+
})[Property_1]>, undefined> | undefined } & { [Property_2 in Exclude<keyof T, ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
367
|
+
updatedAt: convex_values0.VFloat64<number | undefined, "optional">;
|
|
368
|
+
} extends infer T_2 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_2]: T_2[Property]["isOptional"] extends "optional" ? Property : never } : never)[keyof T | "updatedAt"]> | Exclude<"updatedAt", ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
369
|
+
updatedAt: convex_values0.VFloat64<number | undefined, "optional">;
|
|
370
|
+
} extends infer T_3 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_3]: T_3[Property]["isOptional"] extends "optional" ? Property : never } : never)[keyof T | "updatedAt"]>]: convex_values0.Infer<({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
371
|
+
updatedAt: convex_values0.VFloat64<number | undefined, "optional">;
|
|
372
|
+
})[Property_2]> }>, { [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
373
|
+
updatedAt: convex_values0.VFloat64<number | undefined, "optional">;
|
|
374
|
+
}, "required", ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
375
|
+
updatedAt: convex_values0.VFloat64<number | undefined, "optional">;
|
|
376
|
+
} extends infer T_4 extends Record<string, convex_values0.GenericValidator> ? { [Property_3 in keyof T_4]: Property_3 | `${Property_3 & string}.${T_4[Property_3]["fieldPaths"]}` } : never)[keyof T | "updatedAt"] & string>, {}, {}, {}>, ownedTable: <T extends ZodRawShape>(s: ZodObject<T>) => convex_server0.TableDefinition<convex_values0.VObject<convex_server0.Expand<{ [Property_1 in ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
377
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
378
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
379
|
+
} extends infer T_1 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_1]: T_1[Property]["isOptional"] extends "optional" ? Property : never } : never)["userId" | "updatedAt" | keyof T]]?: Exclude<convex_values0.Infer<({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
380
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
381
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
382
|
+
})[Property_1]>, undefined> | undefined } & { [Property_2 in Exclude<"userId", ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
383
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
384
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
385
|
+
} extends infer T_2 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_2]: T_2[Property]["isOptional"] extends "optional" ? Property : never } : never)["userId" | "updatedAt" | keyof T]> | Exclude<"updatedAt", ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
386
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
387
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
388
|
+
} extends infer T_3 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_3]: T_3[Property]["isOptional"] extends "optional" ? Property : never } : never)["userId" | "updatedAt" | keyof T]> | Exclude<keyof T, ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
389
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
390
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
391
|
+
} extends infer T_4 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_4]: T_4[Property]["isOptional"] extends "optional" ? Property : never } : never)["userId" | "updatedAt" | keyof T]>]: convex_values0.Infer<({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
392
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
393
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
394
|
+
})[Property_2]> }>, { [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
395
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
396
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
397
|
+
}, "required", ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
398
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
399
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
400
|
+
} extends infer T_5 extends Record<string, convex_values0.GenericValidator> ? { [Property_3 in keyof T_5]: Property_3 | `${Property_3 & string}.${T_5[Property_3]["fieldPaths"]}` } : never)["userId" | "updatedAt" | keyof T] & string>, {
|
|
401
|
+
by_user: [never, "_creationTime"];
|
|
402
|
+
}, {}, {}>, orgTable: <T extends ZodRawShape>(s: ZodObject<T>) => convex_server0.TableDefinition<convex_values0.VObject<convex_server0.Expand<{ [Property_1 in ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
403
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
404
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
405
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
406
|
+
} extends infer T_1 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_1]: T_1[Property]["isOptional"] extends "optional" ? Property : never } : never)["orgId" | "userId" | "updatedAt" | keyof T]]?: Exclude<convex_values0.Infer<({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
407
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
408
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
409
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
410
|
+
})[Property_1]>, undefined> | undefined } & { [Property_2 in Exclude<"orgId", ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
411
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
412
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
413
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
414
|
+
} extends infer T_2 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_2]: T_2[Property]["isOptional"] extends "optional" ? Property : never } : never)["orgId" | "userId" | "updatedAt" | keyof T]> | Exclude<"userId", ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
415
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
416
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
417
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
418
|
+
} extends infer T_3 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_3]: T_3[Property]["isOptional"] extends "optional" ? Property : never } : never)["orgId" | "userId" | "updatedAt" | keyof T]> | Exclude<"updatedAt", ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
419
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
420
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
421
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
422
|
+
} extends infer T_4 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_4]: T_4[Property]["isOptional"] extends "optional" ? Property : never } : never)["orgId" | "userId" | "updatedAt" | keyof T]> | Exclude<keyof T, ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
423
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
424
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
425
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
426
|
+
} extends infer T_5 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_5]: T_5[Property]["isOptional"] extends "optional" ? Property : never } : never)["orgId" | "userId" | "updatedAt" | keyof T]>]: convex_values0.Infer<({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
427
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
428
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
429
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
430
|
+
})[Property_2]> }>, { [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
431
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
432
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
433
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
434
|
+
}, "required", ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
435
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
436
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
437
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
438
|
+
} extends infer T_6 extends Record<string, convex_values0.GenericValidator> ? { [Property_3 in keyof T_6]: Property_3 | `${Property_3 & string}.${T_6[Property_3]["fieldPaths"]}` } : never)["orgId" | "userId" | "updatedAt" | keyof T] & string>, {
|
|
439
|
+
by_org: [never, "_creationTime"];
|
|
440
|
+
by_org_user: [never, never, "_creationTime"];
|
|
441
|
+
}, {}, {}>, orgChildTable: <T extends ZodRawShape>(s: ZodObject<T>, parent: {
|
|
442
|
+
foreignKey: string;
|
|
443
|
+
table: string;
|
|
444
|
+
}) => convex_server0.TableDefinition<convex_values0.VObject<convex_server0.Expand<{ [Property_1 in ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
445
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
446
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
447
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
448
|
+
} extends infer T_1 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_1]: T_1[Property]["isOptional"] extends "optional" ? Property : never } : never)["orgId" | "userId" | "updatedAt" | keyof T]]?: Exclude<convex_values0.Infer<({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
449
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
450
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
451
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
452
|
+
})[Property_1]>, undefined> | undefined } & { [Property_2 in Exclude<"orgId", ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
453
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
454
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
455
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
456
|
+
} extends infer T_2 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_2]: T_2[Property]["isOptional"] extends "optional" ? Property : never } : never)["orgId" | "userId" | "updatedAt" | keyof T]> | Exclude<"userId", ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
457
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
458
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
459
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
460
|
+
} extends infer T_3 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_3]: T_3[Property]["isOptional"] extends "optional" ? Property : never } : never)["orgId" | "userId" | "updatedAt" | keyof T]> | Exclude<"updatedAt", ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
461
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
462
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
463
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
464
|
+
} extends infer T_4 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_4]: T_4[Property]["isOptional"] extends "optional" ? Property : never } : never)["orgId" | "userId" | "updatedAt" | keyof T]> | Exclude<keyof T, ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
465
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
466
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
467
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
468
|
+
} extends infer T_5 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_5]: T_5[Property]["isOptional"] extends "optional" ? Property : never } : never)["orgId" | "userId" | "updatedAt" | keyof T]>]: convex_values0.Infer<({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
469
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
470
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
471
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
472
|
+
})[Property_2]> }>, { [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
473
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
474
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
475
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
476
|
+
}, "required", ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
477
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
478
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
479
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
480
|
+
} extends infer T_6 extends Record<string, convex_values0.GenericValidator> ? { [Property_3 in keyof T_6]: Property_3 | `${Property_3 & string}.${T_6[Property_3]["fieldPaths"]}` } : never)["orgId" | "userId" | "updatedAt" | keyof T] & string>, {
|
|
481
|
+
by_org: [never, "_creationTime"];
|
|
482
|
+
by_parent: [never, "_creationTime"];
|
|
483
|
+
}, {}, {}>, childTable: <T extends ZodRawShape>(s: ZodObject<T>, indexField: string, indexName?: string) => convex_server0.TableDefinition<convex_values0.VObject<convex_server0.Expand<{ [Property_1 in ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
484
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
485
|
+
} extends infer T_1 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_1]: T_1[Property]["isOptional"] extends "optional" ? Property : never } : never)["updatedAt" | keyof T]]?: Exclude<convex_values0.Infer<({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
486
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
487
|
+
})[Property_1]>, undefined> | undefined } & { [Property_2 in Exclude<"updatedAt", ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
488
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
489
|
+
} extends infer T_2 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_2]: T_2[Property]["isOptional"] extends "optional" ? Property : never } : never)["updatedAt" | keyof T]> | Exclude<keyof T, ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
490
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
491
|
+
} extends infer T_3 extends Record<string, convex_values0.GenericValidator> ? { [Property in keyof T_3]: T_3[Property]["isOptional"] extends "optional" ? Property : never } : never)["updatedAt" | keyof T]>]: convex_values0.Infer<({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
492
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
493
|
+
})[Property_2]> }>, { [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
494
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
495
|
+
}, "required", ({ [k in keyof T]: convex_helpers_server_zod40.ConvexValidatorFromZodOutput<T[k], "required"> } & {
|
|
496
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
497
|
+
} extends infer T_4 extends Record<string, convex_values0.GenericValidator> ? { [Property_3 in keyof T_4]: Property_3 | `${Property_3 & string}.${T_4[Property_3]["fieldPaths"]}` } : never)["updatedAt" | keyof T] & string>, {
|
|
498
|
+
[x: string]: [never, "_creationTime"];
|
|
499
|
+
}, {}, {}>, orgTables: () => {
|
|
500
|
+
org: convex_server0.TableDefinition<convex_values0.VObject<{
|
|
501
|
+
avatarId?: convex_values0.GenericId<"_storage"> | undefined;
|
|
502
|
+
name: string;
|
|
503
|
+
slug: string;
|
|
504
|
+
userId: convex_values0.GenericId<"users">;
|
|
505
|
+
updatedAt: number;
|
|
506
|
+
}, {
|
|
507
|
+
avatarId: convex_values0.VId<convex_values0.GenericId<"_storage"> | undefined, "optional">;
|
|
508
|
+
name: convex_values0.VString<string, "required">;
|
|
509
|
+
slug: convex_values0.VString<string, "required">;
|
|
510
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
511
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
512
|
+
}, "required", "avatarId" | "name" | "slug" | "userId" | "updatedAt">, {
|
|
513
|
+
by_slug: ["slug", "_creationTime"];
|
|
514
|
+
by_user: ["userId", "_creationTime"];
|
|
515
|
+
}, {}, {}>;
|
|
516
|
+
orgInvite: convex_server0.TableDefinition<convex_values0.VObject<{
|
|
517
|
+
email: string;
|
|
518
|
+
orgId: convex_values0.GenericId<"org">;
|
|
519
|
+
token: string;
|
|
520
|
+
isAdmin: boolean;
|
|
521
|
+
expiresAt: number;
|
|
522
|
+
}, {
|
|
523
|
+
email: convex_values0.VString<string, "required">;
|
|
524
|
+
expiresAt: convex_values0.VFloat64<number, "required">;
|
|
525
|
+
isAdmin: convex_values0.VBoolean<boolean, "required">;
|
|
526
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
527
|
+
token: convex_values0.VString<string, "required">;
|
|
528
|
+
}, "required", "email" | "orgId" | "token" | "isAdmin" | "expiresAt">, {
|
|
529
|
+
by_org: ["orgId", "_creationTime"];
|
|
530
|
+
by_token: ["token", "_creationTime"];
|
|
531
|
+
}, {}, {}>;
|
|
532
|
+
orgJoinRequest: convex_server0.TableDefinition<convex_values0.VObject<{
|
|
533
|
+
message?: string | undefined;
|
|
534
|
+
orgId: convex_values0.GenericId<"org">;
|
|
535
|
+
status: "pending" | "approved" | "rejected";
|
|
536
|
+
userId: convex_values0.GenericId<"users">;
|
|
537
|
+
}, {
|
|
538
|
+
message: convex_values0.VString<string | undefined, "optional">;
|
|
539
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
540
|
+
status: convex_values0.VUnion<"pending" | "approved" | "rejected", [convex_values0.VLiteral<"pending", "required">, convex_values0.VLiteral<"approved", "required">, convex_values0.VLiteral<"rejected", "required">], "required", never>;
|
|
541
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
542
|
+
}, "required", "message" | "orgId" | "status" | "userId">, {
|
|
543
|
+
by_org: ["orgId", "_creationTime"];
|
|
544
|
+
by_org_status: ["orgId", "status", "_creationTime"];
|
|
545
|
+
by_user: ["userId", "_creationTime"];
|
|
546
|
+
}, {}, {}>;
|
|
547
|
+
orgMember: convex_server0.TableDefinition<convex_values0.VObject<{
|
|
548
|
+
orgId: convex_values0.GenericId<"org">;
|
|
549
|
+
isAdmin: boolean;
|
|
550
|
+
userId: convex_values0.GenericId<"users">;
|
|
551
|
+
updatedAt: number;
|
|
552
|
+
}, {
|
|
553
|
+
isAdmin: convex_values0.VBoolean<boolean, "required">;
|
|
554
|
+
orgId: convex_values0.VId<convex_values0.GenericId<"org">, "required">;
|
|
555
|
+
updatedAt: convex_values0.VFloat64<number, "required">;
|
|
556
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
557
|
+
}, "required", "orgId" | "isAdmin" | "userId" | "updatedAt">, {
|
|
558
|
+
by_org: ["orgId", "_creationTime"];
|
|
559
|
+
by_org_user: ["orgId", "userId", "_creationTime"];
|
|
560
|
+
by_user: ["userId", "_creationTime"];
|
|
561
|
+
}, {}, {}>;
|
|
562
|
+
}, uploadTables: () => {
|
|
563
|
+
uploadChunk: convex_server0.TableDefinition<convex_values0.VObject<{
|
|
564
|
+
userId: convex_values0.GenericId<"users">;
|
|
565
|
+
uploadId: string;
|
|
566
|
+
chunkIndex: number;
|
|
567
|
+
storageId: convex_values0.GenericId<"_storage">;
|
|
568
|
+
totalChunks: number;
|
|
569
|
+
}, {
|
|
570
|
+
chunkIndex: convex_values0.VFloat64<number, "required">;
|
|
571
|
+
storageId: convex_values0.VId<convex_values0.GenericId<"_storage">, "required">;
|
|
572
|
+
totalChunks: convex_values0.VFloat64<number, "required">;
|
|
573
|
+
uploadId: convex_values0.VString<string, "required">;
|
|
574
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
575
|
+
}, "required", "userId" | "uploadId" | "chunkIndex" | "storageId" | "totalChunks">, {
|
|
576
|
+
by_upload: ["uploadId", "_creationTime"];
|
|
577
|
+
by_user: ["userId", "_creationTime"];
|
|
578
|
+
}, {}, {}>;
|
|
579
|
+
uploadRateLimit: convex_server0.TableDefinition<convex_values0.VObject<{
|
|
580
|
+
userId: convex_values0.GenericId<"users">;
|
|
581
|
+
timestamp: number;
|
|
582
|
+
}, {
|
|
583
|
+
timestamp: convex_values0.VFloat64<number, "required">;
|
|
584
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
585
|
+
}, "required", "userId" | "timestamp">, {
|
|
586
|
+
by_user: ["userId", "_creationTime"];
|
|
587
|
+
}, {}, {}>;
|
|
588
|
+
uploadSession: convex_server0.TableDefinition<convex_values0.VObject<{
|
|
589
|
+
finalStorageId?: convex_values0.GenericId<"_storage"> | undefined;
|
|
590
|
+
status: "pending" | "assembling" | "completed" | "failed";
|
|
591
|
+
userId: convex_values0.GenericId<"users">;
|
|
592
|
+
uploadId: string;
|
|
593
|
+
contentType: string;
|
|
594
|
+
fileName: string;
|
|
595
|
+
totalChunks: number;
|
|
596
|
+
totalSize: number;
|
|
597
|
+
completedChunks: number;
|
|
598
|
+
}, {
|
|
599
|
+
completedChunks: convex_values0.VFloat64<number, "required">;
|
|
600
|
+
contentType: convex_values0.VString<string, "required">;
|
|
601
|
+
fileName: convex_values0.VString<string, "required">;
|
|
602
|
+
finalStorageId: convex_values0.VId<convex_values0.GenericId<"_storage"> | undefined, "optional">;
|
|
603
|
+
status: convex_values0.VUnion<"pending" | "assembling" | "completed" | "failed", [convex_values0.VLiteral<"pending", "required">, convex_values0.VLiteral<"assembling", "required">, convex_values0.VLiteral<"completed", "required">, convex_values0.VLiteral<"failed", "required">], "required", never>;
|
|
604
|
+
totalChunks: convex_values0.VFloat64<number, "required">;
|
|
605
|
+
totalSize: convex_values0.VFloat64<number, "required">;
|
|
606
|
+
uploadId: convex_values0.VString<string, "required">;
|
|
607
|
+
userId: convex_values0.VId<convex_values0.GenericId<"users">, "required">;
|
|
608
|
+
}, "required", "status" | "userId" | "uploadId" | "finalStorageId" | "contentType" | "fileName" | "totalChunks" | "totalSize" | "completedChunks">, {
|
|
609
|
+
by_upload_id: ["uploadId", "_creationTime"];
|
|
610
|
+
by_user: ["userId", "_creationTime"];
|
|
611
|
+
}, {}, {}>;
|
|
612
|
+
};
|
|
613
|
+
//#endregion
|
|
614
|
+
//#region src/server/setup.d.ts
|
|
615
|
+
declare const setup: <DM extends GenericDataModel>(config: SetupConfig<DM>) => {
|
|
616
|
+
cacheCrud: <S extends ZodRawShape, K extends keyof Rec>(opts: {
|
|
617
|
+
fetcher?: (c: unknown, key: unknown) => Promise<unknown>;
|
|
618
|
+
key: K;
|
|
619
|
+
schema: ZodObject<S>;
|
|
620
|
+
table: string;
|
|
621
|
+
ttl?: number;
|
|
622
|
+
}) => CacheCrudResult<S>;
|
|
623
|
+
childCrud: <S extends ZodRawShape>(table: string, meta: {
|
|
624
|
+
foreignKey: string;
|
|
625
|
+
index: string;
|
|
626
|
+
parent: string;
|
|
627
|
+
schema: ZodObject<S>;
|
|
628
|
+
}) => ChildCrudResult<S>;
|
|
629
|
+
cm: convex_helpers_server_zod40.CustomBuilder<"mutation", Record<string, never>, {}, Record<string, never>, GenericMutationCtx<DM>, "public", Record<string, any>>;
|
|
630
|
+
cq: convex_helpers_server_zod40.CustomBuilder<"query", Record<string, never>, {}, Record<string, never>, GenericQueryCtx<DM>, "public", Record<string, any>>;
|
|
631
|
+
crud: <S extends ZodRawShape>(table: string, schema: ZodObject<S>, opt?: CrudOptions<S>) => CrudResult<S>;
|
|
632
|
+
m: convex_helpers_server_zod40.CustomBuilder<"mutation", Record<string, never>, {
|
|
633
|
+
create: (t: string, d: Rec) => Promise<string>;
|
|
634
|
+
delete: (id: string) => Promise<Record<string, unknown>>;
|
|
635
|
+
get: (id: string) => Promise<Record<string, unknown>>;
|
|
636
|
+
patch: (id: string, data: ((doc: Rec) => Partial<Rec> | Promise<Partial<Rec>>) | Partial<Rec>, expectedUpdatedAt?: number) => Promise<{
|
|
637
|
+
updatedAt: number;
|
|
638
|
+
}>;
|
|
639
|
+
user: Record<string, unknown> & {
|
|
640
|
+
_id: string;
|
|
641
|
+
};
|
|
642
|
+
}, Record<string, never>, GenericMutationCtx<DM>, "public", Record<string, any>>;
|
|
643
|
+
org: {
|
|
644
|
+
acceptInvite: convex_server0.RegisteredMutation<"public", {
|
|
645
|
+
token: string;
|
|
646
|
+
}, Promise<{
|
|
647
|
+
orgId: convex_values0.GenericId<"org">;
|
|
648
|
+
}>>;
|
|
649
|
+
approveJoinRequest: convex_server0.RegisteredMutation<"public", {
|
|
650
|
+
requestId: unknown;
|
|
651
|
+
isAdmin?: boolean | undefined;
|
|
652
|
+
}, Promise<undefined>>;
|
|
653
|
+
cancelJoinRequest: convex_server0.RegisteredMutation<"public", {
|
|
654
|
+
requestId: unknown;
|
|
655
|
+
}, Promise<undefined>>;
|
|
656
|
+
create: convex_server0.RegisteredMutation<"public", {
|
|
657
|
+
data: Record<string, unknown>;
|
|
658
|
+
}, Promise<{
|
|
659
|
+
orgId: convex_values0.GenericId<"org">;
|
|
660
|
+
}>>;
|
|
661
|
+
get: convex_server0.RegisteredQuery<"public", {
|
|
662
|
+
orgId: unknown;
|
|
663
|
+
}, Promise<OrgDocLike | null>>;
|
|
664
|
+
getBySlug: convex_server0.RegisteredQuery<"public", {
|
|
665
|
+
slug: string;
|
|
666
|
+
}, Promise<OrgDocLike | null>>;
|
|
667
|
+
getPublic: convex_server0.RegisteredQuery<"public", {
|
|
668
|
+
slug: string;
|
|
669
|
+
}, Promise<{
|
|
670
|
+
_id: convex_values0.GenericId<"org">;
|
|
671
|
+
avatarId?: convex_values0.GenericId<"_storage">;
|
|
672
|
+
name: string;
|
|
673
|
+
slug: string;
|
|
674
|
+
} | null>>;
|
|
675
|
+
invite: convex_server0.RegisteredMutation<"public", {
|
|
676
|
+
email: string;
|
|
677
|
+
isAdmin: boolean;
|
|
678
|
+
orgId: unknown;
|
|
679
|
+
}, Promise<{
|
|
680
|
+
inviteId: convex_values0.GenericId<"orgInvite">;
|
|
681
|
+
token: string;
|
|
682
|
+
}>>;
|
|
683
|
+
isSlugAvailable: convex_server0.RegisteredQuery<"public", {
|
|
684
|
+
slug: string;
|
|
685
|
+
}, Promise<{
|
|
686
|
+
available: boolean;
|
|
687
|
+
}>>;
|
|
688
|
+
leave: convex_server0.RegisteredMutation<"public", {
|
|
689
|
+
orgId: unknown;
|
|
690
|
+
}, Promise<undefined>>;
|
|
691
|
+
members: convex_server0.RegisteredQuery<"public", {
|
|
692
|
+
orgId: unknown;
|
|
693
|
+
}, Promise<OrgMemberItem[]>>;
|
|
694
|
+
membership: convex_server0.RegisteredQuery<"public", {
|
|
695
|
+
orgId: unknown;
|
|
696
|
+
}, Promise<{
|
|
697
|
+
memberId: convex_values0.GenericId<"orgMember"> | null;
|
|
698
|
+
role: OrgRole;
|
|
699
|
+
} | null>>;
|
|
700
|
+
myJoinRequest: convex_server0.RegisteredQuery<"public", {
|
|
701
|
+
orgId: unknown;
|
|
702
|
+
}, Promise<{
|
|
703
|
+
_id: convex_values0.GenericId<"orgJoinRequest">;
|
|
704
|
+
message?: string;
|
|
705
|
+
orgId: convex_values0.GenericId<"org">;
|
|
706
|
+
status: string;
|
|
707
|
+
userId: convex_values0.GenericId<"users">;
|
|
708
|
+
} | null>>;
|
|
709
|
+
myOrgs: convex_server0.RegisteredQuery<"public", {}, Promise<{
|
|
710
|
+
org: OrgDocLike;
|
|
711
|
+
role: OrgRole;
|
|
712
|
+
}[]>>;
|
|
713
|
+
pendingInvites: convex_server0.RegisteredQuery<"public", {
|
|
714
|
+
orgId: unknown;
|
|
715
|
+
}, Promise<InviteDocLike[]>>;
|
|
716
|
+
pendingJoinRequests: convex_server0.RegisteredQuery<"public", {
|
|
717
|
+
orgId: unknown;
|
|
718
|
+
}, Promise<JoinRequestItem[]>>;
|
|
719
|
+
rejectJoinRequest: convex_server0.RegisteredMutation<"public", {
|
|
720
|
+
requestId: unknown;
|
|
721
|
+
}, Promise<undefined>>;
|
|
722
|
+
remove: convex_server0.RegisteredMutation<"public", {
|
|
723
|
+
orgId: unknown;
|
|
724
|
+
}, Promise<undefined>>;
|
|
725
|
+
removeMember: convex_server0.RegisteredMutation<"public", {
|
|
726
|
+
memberId: unknown;
|
|
727
|
+
}, Promise<undefined>>;
|
|
728
|
+
requestJoin: convex_server0.RegisteredMutation<"public", {
|
|
729
|
+
orgId: unknown;
|
|
730
|
+
message?: string | undefined;
|
|
731
|
+
}, Promise<{
|
|
732
|
+
requestId: convex_values0.GenericId<"orgJoinRequest">;
|
|
733
|
+
}>>;
|
|
734
|
+
revokeInvite: convex_server0.RegisteredMutation<"public", {
|
|
735
|
+
inviteId: unknown;
|
|
736
|
+
}, Promise<undefined>>;
|
|
737
|
+
setAdmin: convex_server0.RegisteredMutation<"public", {
|
|
738
|
+
isAdmin: boolean;
|
|
739
|
+
memberId: unknown;
|
|
740
|
+
}, Promise<undefined>>;
|
|
741
|
+
transferOwnership: convex_server0.RegisteredMutation<"public", {
|
|
742
|
+
newOwnerId: unknown;
|
|
743
|
+
orgId: unknown;
|
|
744
|
+
}, Promise<undefined>>;
|
|
745
|
+
update: convex_server0.RegisteredMutation<"public", {
|
|
746
|
+
data: Record<string, unknown>;
|
|
747
|
+
orgId: unknown;
|
|
748
|
+
}, Promise<undefined>>;
|
|
749
|
+
} | undefined;
|
|
750
|
+
orgCrud: <S extends ZodRawShape>(table: string, schema: ZodObject<S>, opt?: Rec) => OrgCrudResult<S>;
|
|
751
|
+
pq: convex_helpers_server_zod40.CustomBuilder<"query", Record<string, never>, {
|
|
752
|
+
viewerId: string | null;
|
|
753
|
+
withAuthor: <T extends {
|
|
754
|
+
userId: string;
|
|
755
|
+
}>(docs: T[]) => Promise<(T & {
|
|
756
|
+
author: Rec | null;
|
|
757
|
+
own: boolean | null;
|
|
758
|
+
})[]>;
|
|
759
|
+
}, Record<string, never>, GenericQueryCtx<DM>, "public", Record<string, any>>;
|
|
760
|
+
q: convex_helpers_server_zod40.CustomBuilder<"query", Record<string, never>, {
|
|
761
|
+
get: (id: string) => Promise<Record<string, unknown>>;
|
|
762
|
+
user: Record<string, unknown> & {
|
|
763
|
+
_id: string;
|
|
764
|
+
};
|
|
765
|
+
viewerId: string | null;
|
|
766
|
+
withAuthor: <T extends {
|
|
767
|
+
userId: string;
|
|
768
|
+
}>(docs: T[]) => Promise<(T & {
|
|
769
|
+
author: Rec | null;
|
|
770
|
+
own: boolean | null;
|
|
771
|
+
})[]>;
|
|
772
|
+
}, Record<string, never>, GenericQueryCtx<DM>, "public", Record<string, any>>;
|
|
773
|
+
uniqueCheck: (table: string, field: string) => convex_server0.RegisteredQuery<"public", {
|
|
774
|
+
exclude?: string;
|
|
775
|
+
value: string;
|
|
776
|
+
}, boolean>;
|
|
777
|
+
user: {
|
|
778
|
+
me: convex_server0.RegisteredQuery<"public", convex_server0.DefaultFunctionArgs, unknown>;
|
|
779
|
+
};
|
|
780
|
+
};
|
|
781
|
+
//#endregion
|
|
782
|
+
//#region src/server/test.d.ts
|
|
783
|
+
interface TestAuthConfig<DM extends GenericDataModel = GenericDataModel> {
|
|
784
|
+
getAuthUserId: (ctx: unknown) => Promise<null | string>;
|
|
785
|
+
mutation: MutationBuilder<DM, 'public'>;
|
|
786
|
+
query: QueryBuilder<DM, 'public'>;
|
|
787
|
+
}
|
|
788
|
+
declare const TEST_EMAIL = "test@playwright.local",
|
|
789
|
+
isTestMode: () => boolean,
|
|
790
|
+
makeTestAuth: <DM extends GenericDataModel>(config: TestAuthConfig<DM>) => {
|
|
791
|
+
acceptInviteAsUser: Rec;
|
|
792
|
+
addTestOrgMember: Rec;
|
|
793
|
+
approveJoinRequestAsUser: Rec;
|
|
794
|
+
cancelJoinRequestAsUser: Rec;
|
|
795
|
+
cleanupOrgTestData: Rec;
|
|
796
|
+
cleanupTestUsers: Rec;
|
|
797
|
+
createExpiredInvite: Rec;
|
|
798
|
+
createTestUser: Rec;
|
|
799
|
+
deleteOrgAsUser: Rec;
|
|
800
|
+
ensureTestUser: Rec;
|
|
801
|
+
getAuthUserIdOrTest: (ctx: unknown) => Promise<null | string>;
|
|
802
|
+
getJoinRequest: Rec;
|
|
803
|
+
getTestUser: Rec;
|
|
804
|
+
getTestUserByEmail: Rec;
|
|
805
|
+
inviteAsUser: Rec;
|
|
806
|
+
isTestMode: () => boolean;
|
|
807
|
+
leaveOrgAsUser: Rec;
|
|
808
|
+
pendingInvitesAsUser: Rec;
|
|
809
|
+
pendingJoinRequestsAsUser: Rec;
|
|
810
|
+
rejectJoinRequestAsUser: Rec;
|
|
811
|
+
removeMemberAsUser: Rec;
|
|
812
|
+
removeTestOrgMember: Rec;
|
|
813
|
+
requestJoinAsUser: Rec;
|
|
814
|
+
setAdminAsUser: Rec;
|
|
815
|
+
TEST_EMAIL: string;
|
|
816
|
+
transferOwnershipAsUser: Rec;
|
|
817
|
+
updateOrgAsUser: Rec;
|
|
818
|
+
};
|
|
819
|
+
//#endregion
|
|
820
|
+
//#region src/server/test-crud.d.ts
|
|
821
|
+
interface OrgTestCrudConfig<DM extends GenericDataModel = GenericDataModel> {
|
|
822
|
+
acl?: boolean;
|
|
823
|
+
aclFrom?: {
|
|
824
|
+
field: string;
|
|
825
|
+
table: string;
|
|
826
|
+
};
|
|
827
|
+
cascade?: {
|
|
828
|
+
foreignKey: string;
|
|
829
|
+
table: string;
|
|
830
|
+
}[];
|
|
831
|
+
mutation: MutationBuilder<DM, 'public'>;
|
|
832
|
+
query: QueryBuilder<DM, 'public'>;
|
|
833
|
+
table: string;
|
|
834
|
+
}
|
|
835
|
+
declare const getOrgMembership: (db: DbLike, orgId: string, userId: string) => Promise<{
|
|
836
|
+
isAdmin: boolean;
|
|
837
|
+
isOwner: boolean;
|
|
838
|
+
member: Rec | null;
|
|
839
|
+
orgDoc: Rec;
|
|
840
|
+
} | null>, makeOrgTestCrud: <DM extends GenericDataModel>(config: OrgTestCrudConfig<DM>) => Rec;
|
|
841
|
+
//#endregion
|
|
842
|
+
export { type InviteDocLike, type JoinRequestItem, type OrgDocLike, type OrgMemberItem, type OrgUserLike, baseTable, canEdit, checkSchema, err, getErrorCode, getErrorMessage, getOrgMember, getOrgMembership, getOrgRole, isRecord, makeFileUpload, makeOrg, makeOrgTestCrud, makeTestAuth, orgCascade, orgChildTable, orgTable, orgTables, ownedTable, requireOrgMember, requireOrgRole, setup, time, uploadTables };
|