better-convex 0.5.8 → 0.6.1

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 (38) hide show
  1. package/dist/auth/index.d.ts +116 -100
  2. package/dist/auth/index.js +562 -112
  3. package/dist/auth-client/index.d.ts +2 -1
  4. package/dist/auth-client/index.js +2 -1
  5. package/dist/auth-config/index.d.ts +45 -0
  6. package/dist/auth-config/index.js +24 -0
  7. package/dist/auth-nextjs/index.d.ts +2 -2
  8. package/dist/auth-nextjs/index.js +2 -2
  9. package/dist/{caller-factory-CeZ07fQ2.js → caller-factory-B1FvYSKr.js} +18 -12
  10. package/dist/cli.mjs +246 -0
  11. package/dist/{codegen-CSeApTME.cjs → codegen-DkpPBVPn.mjs} +28 -60
  12. package/dist/context-utils-DSuX99Da.d.ts +17 -0
  13. package/dist/{create-schema-B4CUvqik.js → create-schema-DhWXOhnU.js} +1 -1
  14. package/dist/create-schema-orm-DplxTtYj.js +145 -0
  15. package/dist/crpc/index.d.ts +3 -3
  16. package/dist/crpc/index.js +4 -3
  17. package/dist/customFunctions-C1okqCzL.js +377 -0
  18. package/dist/{http-types-BrMbHGYR.d.ts → http-types-BRLY10NX.d.ts} +70 -20
  19. package/dist/index-BQkhP2ny.d.ts +1326 -0
  20. package/dist/orm/index.d.ts +2986 -0
  21. package/dist/orm/index.js +3 -0
  22. package/dist/orm-Banm-XXb.js +8812 -0
  23. package/dist/react/index.d.ts +46 -9
  24. package/dist/react/index.js +362 -123
  25. package/dist/rsc/index.d.ts +7 -4
  26. package/dist/rsc/index.js +10 -7
  27. package/dist/server/index.d.ts +4 -617
  28. package/dist/server/index.js +914 -50
  29. package/dist/transformer-CTNSPjwp.js +194 -0
  30. package/dist/types-jftzhhuc.d.ts +42 -0
  31. package/dist/{types-DrFf50wo.d.ts → types-o-5rYcTr.d.ts} +1 -1
  32. package/dist/watcher.mjs +41 -0
  33. package/package.json +10 -12
  34. package/dist/cli.cjs +0 -215
  35. package/dist/watcher.cjs +0 -29
  36. /package/dist/{error-BPjr9_gg.js → error-BZUhlhYz.js} +0 -0
  37. /package/dist/{meta-utils-DS5fA5GB.js → meta-utils-DCpLSBWB.js} +0 -0
  38. /package/dist/{query-options-Dbyr-NY1.js → query-options-BL1Q0X7q.js} +0 -0
@@ -1,14 +1,15 @@
1
- import * as better_auth_adapters1 from "better-auth/adapters";
1
+ import { t as GenericCtx } from "../context-utils-DSuX99Da.js";
2
+ import { convex } from "@convex-dev/better-auth/plugins";
3
+ import * as better_auth_adapters0 from "better-auth/adapters";
2
4
  import { DBAdapterDebugLogOption } from "better-auth/adapters";
3
5
  import { BetterAuthDBSchema } from "better-auth/db";
4
- import * as convex_server48 from "convex/server";
5
- import { DocumentByName, FunctionReference, GenericDataModel, GenericMutationCtx, GenericQueryCtx, GenericSchema, IdField, PaginationOptions, PaginationResult, SchemaDefinition, SystemFields, TableNamesInDataModel, internalMutationGeneric } from "convex/server";
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: GenericMutationCtx<DataModel>, data: Infer<Schema['tables'][K]['validator']>) => Promise<Infer<Schema['tables'][K]['validator']> | undefined>;
32
- beforeDelete?: (ctx: GenericMutationCtx<DataModel>, doc: Infer<Schema['tables'][K]['validator']> & IdField<K> & SystemFields) => Promise<(Infer<Schema['tables'][K]['validator']> & IdField<K> & SystemFields) | undefined>;
33
- beforeUpdate?: (ctx: GenericMutationCtx<DataModel>, doc: Infer<Schema['tables'][K]['validator']> & IdField<K> & SystemFields, update: Partial<Infer<Schema['tables'][K]['validator']>>) => Promise<Partial<Infer<Schema['tables'][K]['validator']>> | undefined>;
34
- onCreate?: (ctx: GenericMutationCtx<DataModel>, doc: Infer<Schema['tables'][K]['validator']> & IdField<K> & SystemFields) => Promise<void>;
35
- onDelete?: (ctx: GenericMutationCtx<DataModel>, doc: Infer<Schema['tables'][K]['validator']> & IdField<K> & SystemFields) => Promise<void>;
36
- onUpdate?: (ctx: GenericMutationCtx<DataModel>, newDoc: Infer<Schema['tables'][K]['validator']> & IdField<K> & {
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
- triggers?: Triggers<DataModel, Schema>;
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>, createAuthOptions: (ctx: any) => BetterAuthOptions) => better_auth_adapters1.AdapterFactory;
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_adapters0.AdapterFactory;
50
49
  triggersApi: () => {
51
- beforeCreate: convex_server48.RegisteredMutation<"internal", {
50
+ beforeCreate: convex_server24.RegisteredMutation<"internal", {
52
51
  model: string;
53
52
  data: any;
54
53
  }, Promise<any>>;
55
- beforeDelete: convex_server48.RegisteredMutation<"internal", {
54
+ beforeDelete: convex_server24.RegisteredMutation<"internal", {
56
55
  model: string;
57
56
  doc: any;
58
57
  }, Promise<any>>;
59
- beforeUpdate: convex_server48.RegisteredMutation<"internal", {
58
+ beforeUpdate: convex_server24.RegisteredMutation<"internal", {
60
59
  model: string;
61
60
  update: any;
62
61
  doc: any;
63
62
  }, Promise<any>>;
64
- onCreate: convex_server48.RegisteredMutation<"internal", {
63
+ onCreate: convex_server24.RegisteredMutation<"internal", {
65
64
  model: string;
66
65
  doc: any;
67
66
  }, Promise<void>>;
68
- onDelete: convex_server48.RegisteredMutation<"internal", {
67
+ onDelete: convex_server24.RegisteredMutation<"internal", {
69
68
  model: string;
70
69
  doc: any;
71
70
  }, Promise<void>>;
72
- onUpdate: convex_server48.RegisteredMutation<"internal", {
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: better_auth0.BetterAuthDBSchema;
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: better_auth0.BetterAuthDBSchema;
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
- }) => better_auth_adapters1.AdapterFactory;
153
- declare const dbAdapter: <DataModel extends GenericDataModel, Schema extends SchemaDefinition<any, any>>(ctx: GenericCtx<DataModel>, createAuthOptions: (ctx: any) => BetterAuthOptions, {
153
+ }) => better_auth_adapters0.AdapterFactory;
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,
@@ -160,20 +161,24 @@ declare const dbAdapter: <DataModel extends GenericDataModel, Schema extends Sch
160
161
  schema: Schema;
161
162
  debugLogs?: DBAdapterDebugLogOption;
162
163
  triggers?: Triggers<DataModel, Schema>;
163
- }) => better_auth_adapters1.AdapterFactory;
164
+ }) => better_auth_adapters0.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?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
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<"in" | "lt" | "lte" | "gt" | "gte" | "eq" | "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>;
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", "value" | "connector" | "field" | "operator">;
181
+ }, "required", "connector" | "field" | "operator" | "value">;
177
182
  declare const adapterArgsValidator: convex_values0.VObject<{
178
183
  limit?: number | undefined;
179
184
  offset?: number | undefined;
@@ -184,9 +189,9 @@ declare const adapterArgsValidator: convex_values0.VObject<{
184
189
  } | undefined;
185
190
  where?: {
186
191
  connector?: "AND" | "OR" | undefined;
187
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
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?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
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?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
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<"in" | "lt" | "lte" | "gt" | "gte" | "eq" | "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>;
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", "value" | "connector" | "field" | "operator">, "optional">;
224
+ }, "required", "connector" | "field" | "operator" | "value">, "optional">;
220
225
  }, "required", "limit" | "model" | "offset" | "select" | "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: PaginationOptions;
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 CreateAuth = (ctx: any) => ReturnType<typeof betterAuth>;
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<convex_server48.GenericDocument | null>;
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<convex_server48.PaginationResult<convex_server48.GenericDocument>>;
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: convex_server48.Cursor;
283
- splitCursor?: convex_server48.Cursor | null;
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<convex_server48.GenericDocument | undefined>;
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,15 +310,16 @@ declare const deleteManyHandler: (ctx: any, args: {
305
310
  count: number;
306
311
  ids: any[];
307
312
  isDone: boolean;
308
- continueCursor: convex_server48.Cursor;
309
- splitCursor?: convex_server48.Cursor | null;
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, createAuth: CreateAuth, options?: {
313
- internalMutation?: typeof internalMutationGeneric; /** Skip input validation for smaller generated types. Since these are internal functions, validation is optional. */
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: convex_server48.RegisteredMutation<"internal", {
322
+ create: convex_server24.RegisteredMutation<"internal", {
317
323
  select?: string[] | undefined;
318
324
  beforeCreateHandle?: string | undefined;
319
325
  onCreateHandle?: string | undefined;
@@ -329,38 +335,38 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>>(schema: Sch
329
335
  };
330
336
  };
331
337
  }, Promise<any>>;
332
- deleteMany: convex_server48.RegisteredMutation<"internal", {
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?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
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: convex_server48.Cursor;
360
- splitCursor?: convex_server48.Cursor | null;
365
+ continueCursor: convex_server24.Cursor;
366
+ splitCursor?: convex_server24.Cursor | null;
361
367
  pageStatus?: "SplitRecommended" | "SplitRequired" | null;
362
368
  }>>;
363
- deleteOne: convex_server48.RegisteredMutation<"internal", {
369
+ deleteOne: convex_server24.RegisteredMutation<"internal", {
364
370
  beforeDeleteHandle?: string | undefined;
365
371
  onDeleteHandle?: string | undefined;
366
372
  input: {
@@ -369,16 +375,16 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>>(schema: Sch
369
375
  } | {
370
376
  where?: {
371
377
  connector?: "AND" | "OR" | undefined;
372
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
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<convex_server48.GenericDocument | undefined>>;
379
- findMany: convex_server48.RegisteredQuery<"internal", {
380
- limit?: number | undefined;
384
+ }, Promise<convex_server24.GenericDocument | undefined>>;
385
+ findMany: convex_server24.RegisteredQuery<"internal", {
381
386
  join?: any;
387
+ limit?: number | undefined;
382
388
  offset?: number | undefined;
383
389
  sortBy?: {
384
390
  field: string;
@@ -386,9 +392,9 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>>(schema: Sch
386
392
  } | undefined;
387
393
  where?: {
388
394
  connector?: "AND" | "OR" | undefined;
389
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
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
399
  model: string;
394
400
  paginationOpts: {
@@ -399,21 +405,29 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>>(schema: Sch
399
405
  numItems: number;
400
406
  cursor: string | null;
401
407
  };
402
- }, Promise<convex_server48.PaginationResult<convex_server48.GenericDocument>>>;
403
- findOne: convex_server48.RegisteredQuery<"internal", {
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?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
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<convex_server48.GenericDocument | null>>;
414
- updateMany: convex_server48.RegisteredMutation<"internal", {
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
433
  model: string;
@@ -421,9 +435,9 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>>(schema: Sch
421
435
  } | {
422
436
  where?: {
423
437
  connector?: "AND" | "OR" | undefined;
424
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
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
442
  model: string;
429
443
  update: {
@@ -432,23 +446,15 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>>(schema: Sch
432
446
  [x: symbol]: unknown;
433
447
  };
434
448
  };
435
- paginationOpts: {
436
- id?: number;
437
- endCursor?: string | null;
438
- maximumRowsRead?: number;
439
- maximumBytesRead?: number;
440
- numItems: number;
441
- cursor: string | null;
442
- };
443
449
  }, Promise<{
444
450
  count: number;
445
451
  ids: any[];
446
452
  isDone: boolean;
447
- continueCursor: convex_server48.Cursor;
448
- splitCursor?: convex_server48.Cursor | null;
453
+ continueCursor: convex_server24.Cursor;
454
+ splitCursor?: convex_server24.Cursor | null;
449
455
  pageStatus?: "SplitRecommended" | "SplitRequired" | null;
450
456
  }>>;
451
- updateOne: convex_server48.RegisteredMutation<"internal", {
457
+ updateOne: convex_server24.RegisteredMutation<"internal", {
452
458
  beforeUpdateHandle?: string | undefined;
453
459
  onUpdateHandle?: string | undefined;
454
460
  input: {
@@ -458,9 +464,9 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>>(schema: Sch
458
464
  } | {
459
465
  where?: {
460
466
  connector?: "AND" | "OR" | undefined;
461
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
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
471
  model: string;
466
472
  update: {
@@ -470,8 +476,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>>(schema: Sch
470
476
  };
471
477
  };
472
478
  }, Promise<any>>;
473
- getLatestJwks: convex_server48.RegisteredAction<"internal", {}, Promise<any>>;
474
- rotateKeys: convex_server48.RegisteredAction<"internal", {}, Promise<any>>;
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(createAuth));
531
+ * app.use(authMiddleware(getAuth));
526
532
  *
527
533
  * export default createHttpRouter(app, appRouter);
528
534
  * ```
529
535
  */
530
- declare function authMiddleware(createAuth: CreateAuth, opts?: AuthMiddlewareOptions): MiddlewareHandler;
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, CreateAuth, Triggers, adapterArgsValidator, adapterConfig, adapterWhereValidator, authMiddleware, checkUniqueFields, createApi, createClient, createHandler, dbAdapter, deleteManyHandler, deleteOneHandler, findManyHandler, findOneHandler, getAuthUserId, getAuthUserIdentity, getHeaders, getSession, handlePagination, hasUniqueFields, httpAdapter, listOne, paginate, selectFields, updateManyHandler, updateOneHandler };
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 };