better-convex 0.5.8 → 0.6.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/dist/auth/index.d.ts +123 -107
- package/dist/auth/index.js +562 -112
- package/dist/auth-client/index.d.ts +2 -1
- package/dist/auth-client/index.js +2 -1
- package/dist/auth-config/index.d.ts +45 -0
- package/dist/auth-config/index.js +24 -0
- package/dist/auth-nextjs/index.d.ts +2 -2
- package/dist/auth-nextjs/index.js +2 -2
- package/dist/{caller-factory-CeZ07fQ2.js → caller-factory-B1FvYSKr.js} +18 -12
- package/dist/cli.mjs +246 -0
- package/dist/{codegen-CSeApTME.cjs → codegen-DkpPBVPn.mjs} +28 -60
- package/dist/context-utils-DSuX99Da.d.ts +17 -0
- package/dist/{create-schema-B4CUvqik.js → create-schema-DhWXOhnU.js} +1 -1
- package/dist/create-schema-orm-DplxTtYj.js +145 -0
- package/dist/crpc/index.d.ts +3 -3
- package/dist/crpc/index.js +4 -3
- package/dist/customFunctions-C1okqCzL.js +377 -0
- package/dist/{http-types-BrMbHGYR.d.ts → http-types-BRLY10NX.d.ts} +70 -20
- package/dist/index-BQkhP2ny.d.ts +1326 -0
- package/dist/orm/index.d.ts +2977 -0
- package/dist/orm/index.js +3 -0
- package/dist/orm-Banm-XXb.js +8812 -0
- package/dist/react/index.d.ts +46 -9
- package/dist/react/index.js +362 -123
- package/dist/rsc/index.d.ts +7 -4
- package/dist/rsc/index.js +10 -7
- package/dist/server/index.d.ts +4 -617
- package/dist/server/index.js +914 -50
- package/dist/transformer-CTNSPjwp.js +194 -0
- package/dist/types-jftzhhuc.d.ts +42 -0
- package/dist/{types-DrFf50wo.d.ts → types-o-5rYcTr.d.ts} +1 -1
- package/dist/watcher.mjs +41 -0
- package/package.json +10 -12
- package/dist/cli.cjs +0 -215
- package/dist/watcher.cjs +0 -29
- /package/dist/{error-BPjr9_gg.js → error-BZUhlhYz.js} +0 -0
- /package/dist/{meta-utils-DS5fA5GB.js → meta-utils-DCpLSBWB.js} +0 -0
- /package/dist/{query-options-Dbyr-NY1.js → query-options-BL1Q0X7q.js} +0 -0
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { t as GenericCtx } from "../context-utils-DSuX99Da.js";
|
|
2
|
+
import { convex } from "@convex-dev/better-auth/plugins";
|
|
1
3
|
import * as better_auth_adapters1 from "better-auth/adapters";
|
|
2
4
|
import { DBAdapterDebugLogOption } from "better-auth/adapters";
|
|
3
5
|
import { BetterAuthDBSchema } from "better-auth/db";
|
|
4
|
-
import * as
|
|
5
|
-
import { DocumentByName, FunctionReference, GenericDataModel, GenericMutationCtx, GenericQueryCtx, GenericSchema,
|
|
6
|
+
import * as convex_server24 from "convex/server";
|
|
7
|
+
import { DocumentByName, FunctionReference, GenericDataModel, GenericMutationCtx, GenericQueryCtx, GenericSchema, HttpRouter, PaginationOptions, PaginationResult, SchemaDefinition, TableNamesInDataModel, internalMutationGeneric } from "convex/server";
|
|
6
8
|
import * as convex_values0 from "convex/values";
|
|
7
9
|
import { Infer } from "convex/values";
|
|
8
10
|
import { MiddlewareHandler } from "hono";
|
|
9
11
|
import * as better_auth0 from "better-auth";
|
|
10
12
|
import { BetterAuthOptions, Where, betterAuth } from "better-auth";
|
|
11
|
-
import { GenericCtx } from "@convex-dev/better-auth";
|
|
12
13
|
import { SetOptional } from "type-fest";
|
|
13
14
|
|
|
14
15
|
//#region src/auth/create-client.d.ts
|
|
@@ -27,49 +28,47 @@ type AuthFunctions = {
|
|
|
27
28
|
beforeDelete?: FunctionReference<'mutation', 'internal', Record<string, any>>;
|
|
28
29
|
beforeUpdate?: FunctionReference<'mutation', 'internal', Record<string, any>>;
|
|
29
30
|
};
|
|
30
|
-
type Triggers<DataModel extends GenericDataModel, Schema extends SchemaDefinition<any, any>> = { [K in keyof Schema['tables'] & string]?: {
|
|
31
|
-
beforeCreate?: (ctx:
|
|
32
|
-
beforeDelete?: (ctx:
|
|
33
|
-
beforeUpdate?: (ctx:
|
|
34
|
-
onCreate?: (ctx:
|
|
35
|
-
onDelete?: (ctx:
|
|
36
|
-
onUpdate?: (ctx:
|
|
37
|
-
_creationTime: number;
|
|
38
|
-
}, oldDoc: Infer<Schema['tables'][K]['validator']> & IdField<K> & SystemFields) => Promise<void>;
|
|
31
|
+
type Triggers<DataModel extends GenericDataModel, Schema extends SchemaDefinition<any, any>, TriggerCtx extends GenericMutationCtx<DataModel> = GenericMutationCtx<DataModel>> = { [K in Extract<keyof Schema['tables'] & string, TableNamesInDataModel<DataModel>>]?: {
|
|
32
|
+
beforeCreate?: (ctx: TriggerCtx, data: Omit<DocumentByName<DataModel, K>, '_id' | '_creationTime'>) => Promise<Omit<DocumentByName<DataModel, K>, '_id' | '_creationTime'> | undefined>;
|
|
33
|
+
beforeDelete?: (ctx: TriggerCtx, doc: DocumentByName<DataModel, K>) => Promise<DocumentByName<DataModel, K> | undefined>;
|
|
34
|
+
beforeUpdate?: (ctx: TriggerCtx, doc: DocumentByName<DataModel, K>, update: Partial<Omit<DocumentByName<DataModel, K>, '_id' | '_creationTime'>>) => Promise<Partial<Omit<DocumentByName<DataModel, K>, '_id' | '_creationTime'>> | undefined>;
|
|
35
|
+
onCreate?: (ctx: TriggerCtx, doc: DocumentByName<DataModel, K>) => Promise<void>;
|
|
36
|
+
onDelete?: (ctx: TriggerCtx, doc: DocumentByName<DataModel, K>) => Promise<void>;
|
|
37
|
+
onUpdate?: (ctx: TriggerCtx, newDoc: DocumentByName<DataModel, K>, oldDoc: DocumentByName<DataModel, K>) => Promise<void>;
|
|
39
38
|
} };
|
|
40
|
-
declare const createClient: <DataModel extends GenericDataModel, Schema extends SchemaDefinition<GenericSchema, true>>(config: {
|
|
39
|
+
declare const createClient: <DataModel extends GenericDataModel, Schema extends SchemaDefinition<GenericSchema, true>, TriggerCtx extends GenericMutationCtx<DataModel> = GenericMutationCtx<DataModel>>(config: {
|
|
41
40
|
authFunctions: AuthFunctions;
|
|
42
41
|
schema: Schema;
|
|
43
42
|
internalMutation?: typeof internalMutationGeneric;
|
|
44
|
-
|
|
43
|
+
context?: (ctx: GenericMutationCtx<DataModel>) => TriggerCtx | Promise<TriggerCtx>;
|
|
44
|
+
triggers?: Triggers<DataModel, Schema, TriggerCtx>;
|
|
45
45
|
}) => {
|
|
46
46
|
authFunctions: AuthFunctions;
|
|
47
|
-
triggers: Triggers<DataModel, Schema> | undefined;
|
|
48
|
-
adapter: (ctx: GenericCtx<DataModel>,
|
|
49
|
-
httpAdapter: (ctx: GenericCtx<DataModel>) => better_auth_adapters1.AdapterFactory;
|
|
47
|
+
triggers: Triggers<DataModel, Schema, TriggerCtx> | undefined;
|
|
48
|
+
adapter: (ctx: GenericCtx<DataModel>, getAuthOptions: (ctx: any) => BetterAuthOptions) => better_auth_adapters1.AdapterFactory;
|
|
50
49
|
triggersApi: () => {
|
|
51
|
-
beforeCreate:
|
|
52
|
-
model: string;
|
|
50
|
+
beforeCreate: convex_server24.RegisteredMutation<"internal", {
|
|
53
51
|
data: any;
|
|
52
|
+
model: string;
|
|
54
53
|
}, Promise<any>>;
|
|
55
|
-
beforeDelete:
|
|
54
|
+
beforeDelete: convex_server24.RegisteredMutation<"internal", {
|
|
56
55
|
model: string;
|
|
57
56
|
doc: any;
|
|
58
57
|
}, Promise<any>>;
|
|
59
|
-
beforeUpdate:
|
|
60
|
-
model: string;
|
|
58
|
+
beforeUpdate: convex_server24.RegisteredMutation<"internal", {
|
|
61
59
|
update: any;
|
|
60
|
+
model: string;
|
|
62
61
|
doc: any;
|
|
63
62
|
}, Promise<any>>;
|
|
64
|
-
onCreate:
|
|
63
|
+
onCreate: convex_server24.RegisteredMutation<"internal", {
|
|
65
64
|
model: string;
|
|
66
65
|
doc: any;
|
|
67
66
|
}, Promise<void>>;
|
|
68
|
-
onDelete:
|
|
67
|
+
onDelete: convex_server24.RegisteredMutation<"internal", {
|
|
69
68
|
model: string;
|
|
70
69
|
doc: any;
|
|
71
70
|
}, Promise<void>>;
|
|
72
|
-
onUpdate:
|
|
71
|
+
onUpdate: convex_server24.RegisteredMutation<"internal", {
|
|
73
72
|
model: string;
|
|
74
73
|
newDoc: any;
|
|
75
74
|
oldDoc: any;
|
|
@@ -125,7 +124,7 @@ declare const adapterConfig: {
|
|
|
125
124
|
field: string;
|
|
126
125
|
action: "create" | "update" | "findOne" | "findMany" | "updateMany" | "delete" | "deleteMany" | "count";
|
|
127
126
|
model: string;
|
|
128
|
-
schema:
|
|
127
|
+
schema: BetterAuthDBSchema;
|
|
129
128
|
options: BetterAuthOptions;
|
|
130
129
|
}) => any;
|
|
131
130
|
customTransformOutput: ({
|
|
@@ -137,20 +136,22 @@ declare const adapterConfig: {
|
|
|
137
136
|
field: string;
|
|
138
137
|
select: string[];
|
|
139
138
|
model: string;
|
|
140
|
-
schema:
|
|
139
|
+
schema: BetterAuthDBSchema;
|
|
141
140
|
options: BetterAuthOptions;
|
|
142
141
|
}) => any;
|
|
143
142
|
};
|
|
144
143
|
declare const httpAdapter: <DataModel extends GenericDataModel, Schema extends SchemaDefinition<any, any>>(ctx: GenericCtx<DataModel>, {
|
|
145
144
|
authFunctions,
|
|
146
145
|
debugLogs,
|
|
146
|
+
schema,
|
|
147
147
|
triggers
|
|
148
148
|
}: {
|
|
149
149
|
authFunctions: AuthFunctions;
|
|
150
150
|
debugLogs?: DBAdapterDebugLogOption;
|
|
151
|
+
schema?: Schema;
|
|
151
152
|
triggers?: Triggers<DataModel, Schema>;
|
|
152
153
|
}) => better_auth_adapters1.AdapterFactory;
|
|
153
|
-
declare const dbAdapter: <DataModel extends GenericDataModel, Schema extends SchemaDefinition<any, any>>(ctx: GenericCtx<DataModel>,
|
|
154
|
+
declare const dbAdapter: <DataModel extends GenericDataModel, Schema extends SchemaDefinition<any, any>>(ctx: GenericCtx<DataModel>, getAuthOptions: (ctx: any) => BetterAuthOptions, {
|
|
154
155
|
authFunctions,
|
|
155
156
|
debugLogs,
|
|
156
157
|
schema,
|
|
@@ -163,30 +164,34 @@ declare const dbAdapter: <DataModel extends GenericDataModel, Schema extends Sch
|
|
|
163
164
|
}) => better_auth_adapters1.AdapterFactory;
|
|
164
165
|
//#endregion
|
|
165
166
|
//#region src/auth/adapter-utils.d.ts
|
|
167
|
+
type AdapterPaginationOptions = PaginationOptions & {
|
|
168
|
+
endCursor?: string | null;
|
|
169
|
+
maximumRowsRead?: number;
|
|
170
|
+
};
|
|
166
171
|
declare const adapterWhereValidator: convex_values0.VObject<{
|
|
167
172
|
connector?: "AND" | "OR" | undefined;
|
|
168
|
-
operator?: "
|
|
169
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
173
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
170
174
|
field: string;
|
|
175
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
171
176
|
}, {
|
|
172
177
|
connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
|
|
173
178
|
field: convex_values0.VString<string, "required">;
|
|
174
|
-
operator: convex_values0.VUnion<"
|
|
179
|
+
operator: convex_values0.VUnion<"lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
|
|
175
180
|
value: convex_values0.VUnion<string | number | boolean | string[] | number[] | null, [convex_values0.VString<string, "required">, convex_values0.VFloat64<number, "required">, convex_values0.VBoolean<boolean, "required">, convex_values0.VArray<string[], convex_values0.VString<string, "required">, "required">, convex_values0.VArray<number[], convex_values0.VFloat64<number, "required">, "required">, convex_values0.VNull<null, "required">], "required", never>;
|
|
176
|
-
}, "required", "
|
|
181
|
+
}, "required", "connector" | "field" | "operator" | "value">;
|
|
177
182
|
declare const adapterArgsValidator: convex_values0.VObject<{
|
|
178
183
|
limit?: number | undefined;
|
|
179
|
-
offset?: number | undefined;
|
|
180
184
|
select?: string[] | undefined;
|
|
185
|
+
offset?: number | undefined;
|
|
181
186
|
sortBy?: {
|
|
182
187
|
field: string;
|
|
183
188
|
direction: "asc" | "desc";
|
|
184
189
|
} | undefined;
|
|
185
190
|
where?: {
|
|
186
191
|
connector?: "AND" | "OR" | undefined;
|
|
187
|
-
operator?: "
|
|
188
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
192
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
189
193
|
field: string;
|
|
194
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
190
195
|
}[] | undefined;
|
|
191
196
|
model: string;
|
|
192
197
|
}, {
|
|
@@ -203,31 +208,31 @@ declare const adapterArgsValidator: convex_values0.VObject<{
|
|
|
203
208
|
}, "optional", "field" | "direction">;
|
|
204
209
|
where: convex_values0.VArray<{
|
|
205
210
|
connector?: "AND" | "OR" | undefined;
|
|
206
|
-
operator?: "
|
|
207
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
211
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
208
212
|
field: string;
|
|
213
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
209
214
|
}[] | undefined, convex_values0.VObject<{
|
|
210
215
|
connector?: "AND" | "OR" | undefined;
|
|
211
|
-
operator?: "
|
|
212
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
216
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
213
217
|
field: string;
|
|
218
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
214
219
|
}, {
|
|
215
220
|
connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
|
|
216
221
|
field: convex_values0.VString<string, "required">;
|
|
217
|
-
operator: convex_values0.VUnion<"
|
|
222
|
+
operator: convex_values0.VUnion<"lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
|
|
218
223
|
value: convex_values0.VUnion<string | number | boolean | string[] | number[] | null, [convex_values0.VString<string, "required">, convex_values0.VFloat64<number, "required">, convex_values0.VBoolean<boolean, "required">, convex_values0.VArray<string[], convex_values0.VString<string, "required">, "required">, convex_values0.VArray<number[], convex_values0.VFloat64<number, "required">, "required">, convex_values0.VNull<null, "required">], "required", never>;
|
|
219
|
-
}, "required", "
|
|
220
|
-
}, "required", "limit" | "model" | "
|
|
224
|
+
}, "required", "connector" | "field" | "operator" | "value">, "optional">;
|
|
225
|
+
}, "required", "limit" | "model" | "select" | "offset" | "sortBy" | "where" | "sortBy.field" | "sortBy.direction">;
|
|
221
226
|
declare const hasUniqueFields: (betterAuthSchema: BetterAuthDBSchema, model: string, input: Record<string, any>) => boolean;
|
|
222
227
|
declare const checkUniqueFields: <Schema extends SchemaDefinition<any, any>>(ctx: GenericQueryCtx<GenericDataModel>, schema: Schema, betterAuthSchema: BetterAuthDBSchema, table: string, input: Record<string, any>, doc?: Record<string, any>) => Promise<void>;
|
|
223
228
|
declare const selectFields: <T extends TableNamesInDataModel<GenericDataModel>, D extends DocumentByName<GenericDataModel, T>>(doc: D | null, select?: string[]) => Promise<D | null>;
|
|
224
229
|
declare const paginate: <Doc extends DocumentByName<GenericDataModel, T>, T extends TableNamesInDataModel<GenericDataModel>>(ctx: GenericQueryCtx<GenericDataModel>, schema: SchemaDefinition<any, any>, betterAuthSchema: BetterAuthDBSchema, args: Infer<typeof adapterArgsValidator> & {
|
|
225
|
-
paginationOpts:
|
|
230
|
+
paginationOpts: AdapterPaginationOptions;
|
|
226
231
|
}) => Promise<PaginationResult<Doc>>;
|
|
227
232
|
declare const listOne: <Doc extends DocumentByName<GenericDataModel, T>, T extends TableNamesInDataModel<GenericDataModel>>(ctx: GenericQueryCtx<GenericDataModel>, schema: SchemaDefinition<any, any>, betterAuthSchema: BetterAuthDBSchema, args: Infer<typeof adapterArgsValidator>) => Promise<Doc | null>;
|
|
228
233
|
//#endregion
|
|
229
234
|
//#region src/auth/types.d.ts
|
|
230
|
-
type
|
|
235
|
+
type GetAuth = (ctx: any) => ReturnType<typeof betterAuth>;
|
|
231
236
|
//#endregion
|
|
232
237
|
//#region src/auth/create-api.d.ts
|
|
233
238
|
type Schema = SchemaDefinition<any, any>;
|
|
@@ -245,7 +250,7 @@ declare const findOneHandler: (ctx: any, args: {
|
|
|
245
250
|
model: string;
|
|
246
251
|
select?: string[];
|
|
247
252
|
where?: any[];
|
|
248
|
-
}, schema: Schema, betterAuthSchema: any) => Promise<
|
|
253
|
+
}, schema: Schema, betterAuthSchema: any) => Promise<convex_server24.GenericDocument | null>;
|
|
249
254
|
declare const findManyHandler: (ctx: any, args: {
|
|
250
255
|
model: string;
|
|
251
256
|
paginationOpts: any;
|
|
@@ -256,7 +261,7 @@ declare const findManyHandler: (ctx: any, args: {
|
|
|
256
261
|
field: string;
|
|
257
262
|
};
|
|
258
263
|
where?: any[];
|
|
259
|
-
}, schema: Schema, betterAuthSchema: any) => Promise<
|
|
264
|
+
}, schema: Schema, betterAuthSchema: any) => Promise<convex_server24.PaginationResult<convex_server24.GenericDocument>>;
|
|
260
265
|
declare const updateOneHandler: (ctx: any, args: {
|
|
261
266
|
input: {
|
|
262
267
|
model: string;
|
|
@@ -279,8 +284,8 @@ declare const updateManyHandler: (ctx: any, args: {
|
|
|
279
284
|
count: number;
|
|
280
285
|
ids: any[];
|
|
281
286
|
isDone: boolean;
|
|
282
|
-
continueCursor:
|
|
283
|
-
splitCursor?:
|
|
287
|
+
continueCursor: convex_server24.Cursor;
|
|
288
|
+
splitCursor?: convex_server24.Cursor | null;
|
|
284
289
|
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
285
290
|
}>;
|
|
286
291
|
declare const deleteOneHandler: (ctx: any, args: {
|
|
@@ -291,7 +296,7 @@ declare const deleteOneHandler: (ctx: any, args: {
|
|
|
291
296
|
beforeDeleteHandle?: string;
|
|
292
297
|
skipBeforeHooks?: boolean;
|
|
293
298
|
onDeleteHandle?: string;
|
|
294
|
-
}, schema: Schema, betterAuthSchema: any) => Promise<
|
|
299
|
+
}, schema: Schema, betterAuthSchema: any) => Promise<convex_server24.GenericDocument | undefined>;
|
|
295
300
|
declare const deleteManyHandler: (ctx: any, args: {
|
|
296
301
|
input: {
|
|
297
302
|
model: string;
|
|
@@ -305,62 +310,63 @@ declare const deleteManyHandler: (ctx: any, args: {
|
|
|
305
310
|
count: number;
|
|
306
311
|
ids: any[];
|
|
307
312
|
isDone: boolean;
|
|
308
|
-
continueCursor:
|
|
309
|
-
splitCursor?:
|
|
313
|
+
continueCursor: convex_server24.Cursor;
|
|
314
|
+
splitCursor?: convex_server24.Cursor | null;
|
|
310
315
|
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
311
316
|
}>;
|
|
312
|
-
declare const createApi: <Schema extends SchemaDefinition<any, any>>(schema: Schema,
|
|
313
|
-
internalMutation?: typeof internalMutationGeneric;
|
|
317
|
+
declare const createApi: <Schema extends SchemaDefinition<any, any>>(schema: Schema, getAuth: GetAuth, options?: {
|
|
318
|
+
internalMutation?: typeof internalMutationGeneric;
|
|
319
|
+
context?: (ctx: any) => any | Promise<any>; /** Skip input validation for smaller generated types. Since these are internal functions, validation is optional. */
|
|
314
320
|
skipValidation?: boolean;
|
|
315
321
|
}) => {
|
|
316
|
-
create:
|
|
322
|
+
create: convex_server24.RegisteredMutation<"internal", {
|
|
317
323
|
select?: string[] | undefined;
|
|
318
324
|
beforeCreateHandle?: string | undefined;
|
|
319
325
|
onCreateHandle?: string | undefined;
|
|
320
326
|
input: {
|
|
321
|
-
model: string;
|
|
322
327
|
data: any;
|
|
323
|
-
} | {
|
|
324
328
|
model: string;
|
|
329
|
+
} | {
|
|
325
330
|
data: {
|
|
326
331
|
[x: string]: unknown;
|
|
327
332
|
[x: number]: unknown;
|
|
328
333
|
[x: symbol]: unknown;
|
|
329
334
|
};
|
|
335
|
+
model: string;
|
|
330
336
|
};
|
|
331
337
|
}, Promise<any>>;
|
|
332
|
-
deleteMany:
|
|
338
|
+
deleteMany: convex_server24.RegisteredMutation<"internal", {
|
|
333
339
|
beforeDeleteHandle?: string | undefined;
|
|
334
340
|
onDeleteHandle?: string | undefined;
|
|
341
|
+
paginationOpts: {
|
|
342
|
+
id?: number;
|
|
343
|
+
endCursor?: string | null;
|
|
344
|
+
maximumRowsRead?: number;
|
|
345
|
+
maximumBytesRead?: number;
|
|
346
|
+
numItems: number;
|
|
347
|
+
cursor: string | null;
|
|
348
|
+
};
|
|
335
349
|
input: {
|
|
336
350
|
where?: any[] | undefined;
|
|
337
351
|
model: string;
|
|
338
352
|
} | {
|
|
339
353
|
where?: {
|
|
340
354
|
connector?: "AND" | "OR" | undefined;
|
|
341
|
-
operator?: "
|
|
342
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
355
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
343
356
|
field: string;
|
|
357
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
344
358
|
}[] | undefined;
|
|
345
359
|
model: string;
|
|
346
360
|
};
|
|
347
|
-
paginationOpts: {
|
|
348
|
-
id?: number;
|
|
349
|
-
endCursor?: string | null;
|
|
350
|
-
maximumRowsRead?: number;
|
|
351
|
-
maximumBytesRead?: number;
|
|
352
|
-
numItems: number;
|
|
353
|
-
cursor: string | null;
|
|
354
|
-
};
|
|
355
361
|
}, Promise<{
|
|
356
362
|
count: number;
|
|
357
363
|
ids: any[];
|
|
358
364
|
isDone: boolean;
|
|
359
|
-
continueCursor:
|
|
360
|
-
splitCursor?:
|
|
365
|
+
continueCursor: convex_server24.Cursor;
|
|
366
|
+
splitCursor?: convex_server24.Cursor | null;
|
|
361
367
|
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
362
368
|
}>>;
|
|
363
|
-
deleteOne:
|
|
369
|
+
deleteOne: convex_server24.RegisteredMutation<"internal", {
|
|
364
370
|
beforeDeleteHandle?: string | undefined;
|
|
365
371
|
onDeleteHandle?: string | undefined;
|
|
366
372
|
input: {
|
|
@@ -369,14 +375,14 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>>(schema: Sch
|
|
|
369
375
|
} | {
|
|
370
376
|
where?: {
|
|
371
377
|
connector?: "AND" | "OR" | undefined;
|
|
372
|
-
operator?: "
|
|
373
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
378
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
374
379
|
field: string;
|
|
380
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
375
381
|
}[] | undefined;
|
|
376
382
|
model: string;
|
|
377
383
|
};
|
|
378
|
-
}, Promise<
|
|
379
|
-
findMany:
|
|
384
|
+
}, Promise<convex_server24.GenericDocument | undefined>>;
|
|
385
|
+
findMany: convex_server24.RegisteredQuery<"internal", {
|
|
380
386
|
limit?: number | undefined;
|
|
381
387
|
join?: any;
|
|
382
388
|
offset?: number | undefined;
|
|
@@ -386,11 +392,10 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>>(schema: Sch
|
|
|
386
392
|
} | undefined;
|
|
387
393
|
where?: {
|
|
388
394
|
connector?: "AND" | "OR" | undefined;
|
|
389
|
-
operator?: "
|
|
390
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
395
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
391
396
|
field: string;
|
|
397
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
392
398
|
}[] | undefined;
|
|
393
|
-
model: string;
|
|
394
399
|
paginationOpts: {
|
|
395
400
|
id?: number;
|
|
396
401
|
endCursor?: string | null;
|
|
@@ -399,79 +404,80 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>>(schema: Sch
|
|
|
399
404
|
numItems: number;
|
|
400
405
|
cursor: string | null;
|
|
401
406
|
};
|
|
402
|
-
|
|
403
|
-
|
|
407
|
+
model: string;
|
|
408
|
+
}, Promise<convex_server24.PaginationResult<convex_server24.GenericDocument>>>;
|
|
409
|
+
findOne: convex_server24.RegisteredQuery<"internal", {
|
|
404
410
|
join?: any;
|
|
405
411
|
select?: string[] | undefined;
|
|
406
412
|
where?: {
|
|
407
413
|
connector?: "AND" | "OR" | undefined;
|
|
408
|
-
operator?: "
|
|
409
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
414
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
410
415
|
field: string;
|
|
416
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
411
417
|
}[] | undefined;
|
|
412
418
|
model: string;
|
|
413
|
-
}, Promise<
|
|
414
|
-
updateMany:
|
|
419
|
+
}, Promise<convex_server24.GenericDocument | null>>;
|
|
420
|
+
updateMany: convex_server24.RegisteredMutation<"internal", {
|
|
415
421
|
beforeUpdateHandle?: string | undefined;
|
|
416
422
|
onUpdateHandle?: string | undefined;
|
|
423
|
+
paginationOpts: {
|
|
424
|
+
id?: number;
|
|
425
|
+
endCursor?: string | null;
|
|
426
|
+
maximumRowsRead?: number;
|
|
427
|
+
maximumBytesRead?: number;
|
|
428
|
+
numItems: number;
|
|
429
|
+
cursor: string | null;
|
|
430
|
+
};
|
|
417
431
|
input: {
|
|
418
432
|
where?: any[] | undefined;
|
|
419
|
-
model: string;
|
|
420
433
|
update: any;
|
|
434
|
+
model: string;
|
|
421
435
|
} | {
|
|
422
436
|
where?: {
|
|
423
437
|
connector?: "AND" | "OR" | undefined;
|
|
424
|
-
operator?: "
|
|
425
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
438
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
426
439
|
field: string;
|
|
440
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
427
441
|
}[] | undefined;
|
|
428
|
-
model: string;
|
|
429
442
|
update: {
|
|
430
443
|
[x: string]: unknown;
|
|
431
444
|
[x: number]: unknown;
|
|
432
445
|
[x: symbol]: unknown;
|
|
433
446
|
};
|
|
434
|
-
|
|
435
|
-
paginationOpts: {
|
|
436
|
-
id?: number;
|
|
437
|
-
endCursor?: string | null;
|
|
438
|
-
maximumRowsRead?: number;
|
|
439
|
-
maximumBytesRead?: number;
|
|
440
|
-
numItems: number;
|
|
441
|
-
cursor: string | null;
|
|
447
|
+
model: string;
|
|
442
448
|
};
|
|
443
449
|
}, Promise<{
|
|
444
450
|
count: number;
|
|
445
451
|
ids: any[];
|
|
446
452
|
isDone: boolean;
|
|
447
|
-
continueCursor:
|
|
448
|
-
splitCursor?:
|
|
453
|
+
continueCursor: convex_server24.Cursor;
|
|
454
|
+
splitCursor?: convex_server24.Cursor | null;
|
|
449
455
|
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
450
456
|
}>>;
|
|
451
|
-
updateOne:
|
|
457
|
+
updateOne: convex_server24.RegisteredMutation<"internal", {
|
|
452
458
|
beforeUpdateHandle?: string | undefined;
|
|
453
459
|
onUpdateHandle?: string | undefined;
|
|
454
460
|
input: {
|
|
455
461
|
where?: any[] | undefined;
|
|
456
|
-
model: string;
|
|
457
462
|
update: any;
|
|
463
|
+
model: string;
|
|
458
464
|
} | {
|
|
459
465
|
where?: {
|
|
460
466
|
connector?: "AND" | "OR" | undefined;
|
|
461
|
-
operator?: "
|
|
462
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
467
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
463
468
|
field: string;
|
|
469
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
464
470
|
}[] | undefined;
|
|
465
|
-
model: string;
|
|
466
471
|
update: {
|
|
467
472
|
[x: string]: unknown;
|
|
468
473
|
[x: number]: unknown;
|
|
469
474
|
[x: symbol]: unknown;
|
|
470
475
|
};
|
|
476
|
+
model: string;
|
|
471
477
|
};
|
|
472
478
|
}, Promise<any>>;
|
|
473
|
-
getLatestJwks:
|
|
474
|
-
rotateKeys:
|
|
479
|
+
getLatestJwks: convex_server24.RegisteredAction<"internal", {}, Promise<any>>;
|
|
480
|
+
rotateKeys: convex_server24.RegisteredAction<"internal", {}, Promise<any>>;
|
|
475
481
|
};
|
|
476
482
|
//#endregion
|
|
477
483
|
//#region src/auth/helpers.d.ts
|
|
@@ -522,11 +528,21 @@ interface AuthMiddlewareOptions {
|
|
|
522
528
|
*
|
|
523
529
|
* const app = new Hono();
|
|
524
530
|
* app.use('/api/*', cors({ origin: process.env.SITE_URL, credentials: true }));
|
|
525
|
-
* app.use(authMiddleware(
|
|
531
|
+
* app.use(authMiddleware(getAuth));
|
|
526
532
|
*
|
|
527
533
|
* export default createHttpRouter(app, appRouter);
|
|
528
534
|
* ```
|
|
529
535
|
*/
|
|
530
|
-
declare function authMiddleware(
|
|
536
|
+
declare function authMiddleware(getAuth: GetAuth, opts?: AuthMiddlewareOptions): MiddlewareHandler;
|
|
537
|
+
//#endregion
|
|
538
|
+
//#region src/auth/registerRoutes.d.ts
|
|
539
|
+
declare const registerRoutes: (http: HttpRouter, getAuth: GetAuth, opts?: {
|
|
540
|
+
cors?: {
|
|
541
|
+
allowedHeaders?: string[];
|
|
542
|
+
allowedOrigins?: string[];
|
|
543
|
+
exposedHeaders?: string[];
|
|
544
|
+
} | boolean;
|
|
545
|
+
verbose?: boolean;
|
|
546
|
+
}) => void;
|
|
531
547
|
//#endregion
|
|
532
|
-
export { AuthFunctions, AuthMiddlewareOptions, ConvexCleanedWhere,
|
|
548
|
+
export { type AuthFunctions, AuthMiddlewareOptions, ConvexCleanedWhere, GetAuth, adapterArgsValidator, adapterConfig, adapterWhereValidator, authMiddleware, checkUniqueFields, convex, createApi, createClient, createHandler, dbAdapter, deleteManyHandler, deleteOneHandler, findManyHandler, findOneHandler, getAuthUserId, getAuthUserIdentity, getHeaders, getSession, handlePagination, hasUniqueFields, httpAdapter, listOne, paginate, registerRoutes, selectFields, updateManyHandler, updateOneHandler };
|