better-convex 0.10.1 → 0.10.2

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.
@@ -1,4 +1,4 @@
1
- import { Dt as ConvexCustomBuilderInitial, _t as ConvexNumberBuilderInitial, bt as ConvexIdBuilderInitial, qn as ConvexTextBuilderInitial, rn as ConvexTableWithColumns } from "../where-clause-compiler-UavDdMUX.js";
1
+ import { Dt as ConvexCustomBuilderInitial, _t as ConvexNumberBuilderInitial, bt as ConvexIdBuilderInitial, qn as ConvexTextBuilderInitial, rn as ConvexTableWithColumns } from "../where-clause-compiler-BCECnxsG.js";
2
2
  import * as convex_values0 from "convex/values";
3
3
  import { GenericId, Infer, Value } from "convex/values";
4
4
  import { DocumentByName, GenericDataModel, GenericDatabaseReader, GenericDatabaseWriter, TableNamesInDataModel } from "convex/server";
@@ -182,13 +182,13 @@ type AdapterPaginationOptions = PaginationOptions & {
182
182
  };
183
183
  declare const adapterWhereValidator: convex_values0.VObject<{
184
184
  connector?: "AND" | "OR" | undefined;
185
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
185
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
186
186
  value: string | number | boolean | string[] | number[] | null;
187
187
  field: string;
188
188
  }, {
189
189
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
190
190
  field: convex_values0.VString<string, "required">;
191
- 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>;
191
+ 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>;
192
192
  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>;
193
193
  }, "required", "value" | "connector" | "field" | "operator">;
194
194
  declare const adapterArgsValidator: convex_values0.VObject<{
@@ -201,7 +201,7 @@ declare const adapterArgsValidator: convex_values0.VObject<{
201
201
  } | undefined;
202
202
  where?: {
203
203
  connector?: "AND" | "OR" | undefined;
204
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
204
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
205
205
  value: string | number | boolean | string[] | number[] | null;
206
206
  field: string;
207
207
  }[] | undefined;
@@ -220,18 +220,18 @@ declare const adapterArgsValidator: convex_values0.VObject<{
220
220
  }, "optional", "direction" | "field">;
221
221
  where: convex_values0.VArray<{
222
222
  connector?: "AND" | "OR" | undefined;
223
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
223
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
224
224
  value: string | number | boolean | string[] | number[] | null;
225
225
  field: string;
226
226
  }[] | undefined, convex_values0.VObject<{
227
227
  connector?: "AND" | "OR" | undefined;
228
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
228
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
229
229
  value: string | number | boolean | string[] | number[] | null;
230
230
  field: string;
231
231
  }, {
232
232
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
233
233
  field: convex_values0.VString<string, "required">;
234
- 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>;
234
+ 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>;
235
235
  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>;
236
236
  }, "required", "value" | "connector" | "field" | "operator">, "optional">;
237
237
  }, "required", "limit" | "model" | "select" | "offset" | "sortBy" | "where" | "sortBy.direction" | "sortBy.field">;
@@ -359,10 +359,18 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
359
359
  };
360
360
  }, Promise<any>>;
361
361
  deleteMany: convex_server0.RegisteredMutation<"internal", {
362
+ paginationOpts: {
363
+ id?: number;
364
+ endCursor?: string | null;
365
+ maximumRowsRead?: number;
366
+ maximumBytesRead?: number;
367
+ numItems: number;
368
+ cursor: string | null;
369
+ };
362
370
  input: {
363
371
  where?: {
364
372
  connector?: "AND" | "OR" | undefined;
365
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
373
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
366
374
  value: string | number | boolean | string[] | number[] | null;
367
375
  field: string;
368
376
  }[] | undefined;
@@ -371,14 +379,6 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
371
379
  where?: any[] | undefined;
372
380
  model: string;
373
381
  };
374
- paginationOpts: {
375
- id?: number;
376
- endCursor?: string | null;
377
- maximumRowsRead?: number;
378
- maximumBytesRead?: number;
379
- numItems: number;
380
- cursor: string | null;
381
- };
382
382
  }, Promise<{
383
383
  count: number;
384
384
  ids: any[];
@@ -391,7 +391,7 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
391
391
  input: {
392
392
  where?: {
393
393
  connector?: "AND" | "OR" | undefined;
394
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
394
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
395
395
  value: string | number | boolean | string[] | number[] | null;
396
396
  field: string;
397
397
  }[] | undefined;
@@ -402,8 +402,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
402
402
  };
403
403
  }, Promise<Record<string, unknown> | undefined>>;
404
404
  findMany: convex_server0.RegisteredQuery<"internal", {
405
- limit?: number | undefined;
406
405
  join?: any;
406
+ limit?: number | undefined;
407
407
  offset?: number | undefined;
408
408
  sortBy?: {
409
409
  direction: "asc" | "desc";
@@ -411,7 +411,7 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
411
411
  } | undefined;
412
412
  where?: {
413
413
  connector?: "AND" | "OR" | undefined;
414
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
414
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
415
415
  value: string | number | boolean | string[] | number[] | null;
416
416
  field: string;
417
417
  }[] | undefined;
@@ -430,7 +430,7 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
430
430
  select?: string[] | undefined;
431
431
  where?: {
432
432
  connector?: "AND" | "OR" | undefined;
433
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
433
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
434
434
  value: string | number | boolean | string[] | number[] | null;
435
435
  field: string;
436
436
  }[] | undefined;
@@ -439,10 +439,18 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
439
439
  getLatestJwks: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
440
440
  rotateKeys: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
441
441
  updateMany: convex_server0.RegisteredMutation<"internal", {
442
+ paginationOpts: {
443
+ id?: number;
444
+ endCursor?: string | null;
445
+ maximumRowsRead?: number;
446
+ maximumBytesRead?: number;
447
+ numItems: number;
448
+ cursor: string | null;
449
+ };
442
450
  input: {
443
451
  where?: {
444
452
  connector?: "AND" | "OR" | undefined;
445
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
453
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
446
454
  value: string | number | boolean | string[] | number[] | null;
447
455
  field: string;
448
456
  }[] | undefined;
@@ -457,14 +465,6 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
457
465
  update: any;
458
466
  model: string;
459
467
  };
460
- paginationOpts: {
461
- id?: number;
462
- endCursor?: string | null;
463
- maximumRowsRead?: number;
464
- maximumBytesRead?: number;
465
- numItems: number;
466
- cursor: string | null;
467
- };
468
468
  }, Promise<{
469
469
  count: number;
470
470
  ids: any[];
@@ -477,7 +477,7 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
477
477
  input: {
478
478
  where?: {
479
479
  connector?: "AND" | "OR" | undefined;
480
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
480
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
481
481
  value: string | number | boolean | string[] | number[] | null;
482
482
  field: string;
483
483
  }[] | undefined;
@@ -19155,10 +19155,18 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19155
19155
  };
19156
19156
  }, Promise<any>>;
19157
19157
  deleteMany: convex_server0.RegisteredMutation<"internal", {
19158
+ paginationOpts: {
19159
+ id?: number;
19160
+ endCursor?: string | null;
19161
+ maximumRowsRead?: number;
19162
+ maximumBytesRead?: number;
19163
+ numItems: number;
19164
+ cursor: string | null;
19165
+ };
19158
19166
  input: {
19159
19167
  where?: {
19160
19168
  connector?: "AND" | "OR" | undefined;
19161
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19169
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19162
19170
  value: string | number | boolean | string[] | number[] | null;
19163
19171
  field: string;
19164
19172
  }[] | undefined;
@@ -19167,14 +19175,6 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19167
19175
  where?: any[] | undefined;
19168
19176
  model: string;
19169
19177
  };
19170
- paginationOpts: {
19171
- id?: number;
19172
- endCursor?: string | null;
19173
- maximumRowsRead?: number;
19174
- maximumBytesRead?: number;
19175
- numItems: number;
19176
- cursor: string | null;
19177
- };
19178
19178
  }, Promise<{
19179
19179
  count: number;
19180
19180
  ids: any[];
@@ -19187,7 +19187,7 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19187
19187
  input: {
19188
19188
  where?: {
19189
19189
  connector?: "AND" | "OR" | undefined;
19190
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19190
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19191
19191
  value: string | number | boolean | string[] | number[] | null;
19192
19192
  field: string;
19193
19193
  }[] | undefined;
@@ -19198,8 +19198,8 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19198
19198
  };
19199
19199
  }, Promise<Record<string, unknown> | undefined>>;
19200
19200
  findMany: convex_server0.RegisteredQuery<"internal", {
19201
- limit?: number | undefined;
19202
19201
  join?: any;
19202
+ limit?: number | undefined;
19203
19203
  offset?: number | undefined;
19204
19204
  sortBy?: {
19205
19205
  direction: "asc" | "desc";
@@ -19207,7 +19207,7 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19207
19207
  } | undefined;
19208
19208
  where?: {
19209
19209
  connector?: "AND" | "OR" | undefined;
19210
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19210
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19211
19211
  value: string | number | boolean | string[] | number[] | null;
19212
19212
  field: string;
19213
19213
  }[] | undefined;
@@ -19226,7 +19226,7 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19226
19226
  select?: string[] | undefined;
19227
19227
  where?: {
19228
19228
  connector?: "AND" | "OR" | undefined;
19229
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19229
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19230
19230
  value: string | number | boolean | string[] | number[] | null;
19231
19231
  field: string;
19232
19232
  }[] | undefined;
@@ -19235,10 +19235,18 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19235
19235
  getLatestJwks: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
19236
19236
  rotateKeys: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
19237
19237
  updateMany: convex_server0.RegisteredMutation<"internal", {
19238
+ paginationOpts: {
19239
+ id?: number;
19240
+ endCursor?: string | null;
19241
+ maximumRowsRead?: number;
19242
+ maximumBytesRead?: number;
19243
+ numItems: number;
19244
+ cursor: string | null;
19245
+ };
19238
19246
  input: {
19239
19247
  where?: {
19240
19248
  connector?: "AND" | "OR" | undefined;
19241
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19249
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19242
19250
  value: string | number | boolean | string[] | number[] | null;
19243
19251
  field: string;
19244
19252
  }[] | undefined;
@@ -19253,14 +19261,6 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19253
19261
  update: any;
19254
19262
  model: string;
19255
19263
  };
19256
- paginationOpts: {
19257
- id?: number;
19258
- endCursor?: string | null;
19259
- maximumRowsRead?: number;
19260
- maximumBytesRead?: number;
19261
- numItems: number;
19262
- cursor: string | null;
19263
- };
19264
19264
  }, Promise<{
19265
19265
  count: number;
19266
19266
  ids: any[];
@@ -19273,7 +19273,7 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19273
19273
  input: {
19274
19274
  where?: {
19275
19275
  connector?: "AND" | "OR" | undefined;
19276
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19276
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19277
19277
  value: string | number | boolean | string[] | number[] | null;
19278
19278
  field: string;
19279
19279
  }[] | undefined;
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { n as getConvexConfig, t as generateMeta } from "./codegen-CMQIKrqh.mjs";
2
+ import { n as getConvexConfig, t as generateMeta } from "./codegen-CJiil63j.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { createHash } from "node:crypto";
5
5
  import fs from "node:fs";
@@ -583,72 +583,148 @@ function emitGeneratedModuleRuntimeFile(outputFile, functionsDir, moduleName, pr
583
583
  const handlerRegistryLines = hasHandlerRegistry ? emitProcedureRegistryEntries(handlerEntries, outputFile, functionsDir, moduleName) : [];
584
584
  const handlerRegistryBody = handlerRegistryLines.length > 0 ? `\n${handlerRegistryLines.join("\n")}\n` : "\n";
585
585
  const allEntriesAreCrpc = callerEntries.length > 0 && callerEntries.length === handlerEntries.length;
586
- const callerRegistryIdentifier = allEntriesAreCrpc ? "procedureRegistry" : "callerRegistry";
587
- const handlerRegistryIdentifier = allEntriesAreCrpc ? "procedureRegistry" : "handlerRegistry";
588
- const callerRegistryDeclaration = allEntriesAreCrpc ? `const procedureRegistry = {${callerRegistryBody}} as const;` : `const callerRegistry = {${callerRegistryBody}} as const;`;
586
+ const handlerRegistryDeclaration = hasHandlerRegistry ? allEntriesAreCrpc ? "\n const handlerRegistry = procedureRegistry;\n" : `\n const handlerRegistry = {${handlerRegistryBody}} as const;\n` : "";
587
+ const handlerTypeDeclarations = hasHandlerRegistry ? `
588
+ type ProcedureHandlerContext = QueryCtx | MutationCtx;
589
+ type GeneratedProcedureHandler<
590
+ TCtx extends ProcedureHandlerContext = ProcedureHandlerContext,
591
+ > = TCtx extends MutationCtx
592
+ ? ProcedureCallerFromRegistry<ProcedureHandlerRegistry, 'mutation'>
593
+ : ProcedureCallerFromRegistry<ProcedureHandlerRegistry, 'query'>;
594
+ ` : "";
595
+ const handlerFactoryHelpers = hasHandlerRegistry ? `
596
+ function createHandlerFromRegistryFactory() {
597
+ const { createGenericHandlerFactory } =
598
+ (require('better-convex/server') as RuntimeServerModule);
599
+ const { handlerRegistry } = buildProcedureRegistry();
600
+ return createGenericHandlerFactory<
601
+ QueryCtx,
602
+ MutationCtx,
603
+ ProcedureHandlerRegistry
604
+ >(handlerRegistry);
605
+ }
606
+
607
+ type HandlerFactory = ReturnType<typeof createHandlerFromRegistryFactory>;
608
+
609
+ let cachedCreateHandlerFromRegistry: HandlerFactory | undefined;
610
+
611
+ function getCreateHandlerFromRegistry(): HandlerFactory {
612
+ if (cachedCreateHandlerFromRegistry) {
613
+ return cachedCreateHandlerFromRegistry;
614
+ }
615
+
616
+ const generatedHandlerFactory = createHandlerFromRegistryFactory();
617
+ cachedCreateHandlerFromRegistry = generatedHandlerFactory;
618
+
619
+ return generatedHandlerFactory;
620
+ }
621
+
622
+ ` : "";
623
+ const handlerExport = hasHandlerRegistry ? `
624
+ export function ${handlerExportName}<TCtx extends ProcedureHandlerContext>(
625
+ ctx: TCtx
626
+ ): GeneratedProcedureHandler<TCtx> {
627
+ const createHandlerFromRegistry = getCreateHandlerFromRegistry();
628
+ return createHandlerFromRegistry(ctx) as GeneratedProcedureHandler<TCtx>;
629
+ }
630
+ ` : "";
589
631
  return `// biome-ignore-all format: generated
590
632
  // This file is auto-generated by better-convex
591
633
  // Do not edit manually. Run \`better-convex codegen\` to regenerate.
592
634
 
593
- import {
594
- createGenericCallerFactory,${hasHandlerRegistry ? "\n createGenericHandlerFactory," : ""}
595
- typedProcedureResolver,
596
- type ProcedureActionCallerFromRegistry,
597
- type ProcedureCallerFromRegistry,
598
- type ProcedureScheduleCallerFromRegistry,
635
+ import type {
636
+ ProcedureActionCallerFromRegistry,
637
+ ProcedureCallerFromRegistry,
638
+ ProcedureScheduleCallerFromRegistry,
599
639
  } from 'better-convex/server';
600
- import { api, internal } from '${runtimeApiImportPath}';
601
640
  import type { ActionCtx, MutationCtx, QueryCtx } from '${generatedServerImportPath}';
641
+ import type { OrmTriggerContext } from 'better-convex/orm';
642
+
643
+ type RuntimeServerModule = typeof import('better-convex/server');
644
+
645
+ function createProcedureRegistry() {
646
+ const { typedProcedureResolver } =
647
+ (require('better-convex/server') as RuntimeServerModule);
648
+ const { api, internal } =
649
+ (require(${JSON.stringify(runtimeApiImportPath)}) as typeof import('${runtimeApiImportPath}'));
650
+
651
+ const procedureRegistry = {${callerRegistryBody}} as const;
652
+ ${handlerRegistryDeclaration}
653
+ return {
654
+ procedureRegistry,
655
+ ${hasHandlerRegistry ? " handlerRegistry,\n" : ""} };
656
+ }
657
+
658
+ type ProcedureRegistryBundle = ReturnType<typeof createProcedureRegistry>;
659
+ type ProcedureCallerRegistry = ProcedureRegistryBundle['procedureRegistry'];
660
+ ${hasHandlerRegistry ? `type ProcedureHandlerRegistry = ProcedureRegistryBundle['handlerRegistry'];
661
+ ` : ""}
662
+
663
+ let cachedProcedureRegistry: ProcedureRegistryBundle | undefined;
602
664
 
603
- ${callerRegistryDeclaration}${hasHandlerRegistry && !allEntriesAreCrpc ? `\nconst handlerRegistry = {${handlerRegistryBody}} as const;\n` : ""}
665
+ function buildProcedureRegistry(): ProcedureRegistryBundle {
666
+ if (cachedProcedureRegistry) {
667
+ return cachedProcedureRegistry;
668
+ }
604
669
 
605
- type ProcedureCallerContext = QueryCtx | MutationCtx | ActionCtx;
670
+ const procedureRegistryBundle = createProcedureRegistry();
671
+ cachedProcedureRegistry = procedureRegistryBundle;
672
+
673
+ return procedureRegistryBundle;
674
+ }
675
+
676
+ type MutationCallerContext = MutationCtx | OrmTriggerContext<any, MutationCtx>;
677
+ type ProcedureCallerContext = QueryCtx | MutationCallerContext | ActionCtx;
606
678
  type GeneratedProcedureCaller<
607
679
  TCtx extends ProcedureCallerContext = ProcedureCallerContext,
608
- > = TCtx extends MutationCtx
609
- ? ProcedureCallerFromRegistry<typeof ${callerRegistryIdentifier}, 'mutation'> & {
610
- schedule: ProcedureScheduleCallerFromRegistry<typeof ${callerRegistryIdentifier}>;
680
+ > = TCtx extends MutationCallerContext
681
+ ? ProcedureCallerFromRegistry<ProcedureCallerRegistry, 'mutation'> & {
682
+ schedule: ProcedureScheduleCallerFromRegistry<ProcedureCallerRegistry>;
611
683
  }
612
684
  : TCtx extends ActionCtx
613
- ? ProcedureCallerFromRegistry<typeof ${callerRegistryIdentifier}, 'mutation'> & {
614
- actions: ProcedureActionCallerFromRegistry<typeof ${callerRegistryIdentifier}>;
615
- schedule: ProcedureScheduleCallerFromRegistry<typeof ${callerRegistryIdentifier}>;
685
+ ? ProcedureCallerFromRegistry<ProcedureCallerRegistry, 'mutation'> & {
686
+ actions: ProcedureActionCallerFromRegistry<ProcedureCallerRegistry>;
687
+ schedule: ProcedureScheduleCallerFromRegistry<ProcedureCallerRegistry>;
616
688
  }
617
- : ProcedureCallerFromRegistry<typeof ${callerRegistryIdentifier}, 'query'>;
618
- ${hasHandlerRegistry ? `
619
- type ProcedureHandlerContext = QueryCtx | MutationCtx;
620
- type GeneratedProcedureHandler<
621
- TCtx extends ProcedureHandlerContext = ProcedureHandlerContext,
622
- > = TCtx extends MutationCtx
623
- ? ProcedureCallerFromRegistry<typeof ${handlerRegistryIdentifier}, 'mutation'>
624
- : ProcedureCallerFromRegistry<typeof ${handlerRegistryIdentifier}, 'query'>;
625
- ` : ""}
689
+ : ProcedureCallerFromRegistry<ProcedureCallerRegistry, 'query'>;
690
+ ${handlerTypeDeclarations}
626
691
 
627
- const createCallerFromRegistry = createGenericCallerFactory<
628
- QueryCtx,
629
- MutationCtx,
630
- typeof ${callerRegistryIdentifier},
631
- ActionCtx
632
- >(${callerRegistryIdentifier});${hasHandlerRegistry ? `
633
- const createHandlerFromRegistry = createGenericHandlerFactory<
634
- QueryCtx,
635
- MutationCtx,
636
- typeof ${handlerRegistryIdentifier}
637
- >(${handlerRegistryIdentifier});
638
- ` : ""}
692
+ function createCallerFromRegistryFactory() {
693
+ const { createGenericCallerFactory } =
694
+ (require('better-convex/server') as RuntimeServerModule);
695
+ const { procedureRegistry } = buildProcedureRegistry();
696
+ return createGenericCallerFactory<
697
+ QueryCtx,
698
+ MutationCtx,
699
+ ProcedureCallerRegistry,
700
+ ActionCtx
701
+ >(procedureRegistry);
702
+ }
703
+
704
+ type CallerFactory = ReturnType<typeof createCallerFromRegistryFactory>;
705
+
706
+ let cachedCreateCallerFromRegistry: CallerFactory | undefined;
707
+
708
+ function getCreateCallerFromRegistry(): CallerFactory {
709
+ if (cachedCreateCallerFromRegistry) {
710
+ return cachedCreateCallerFromRegistry;
711
+ }
712
+
713
+ const generatedCallerFactory = createCallerFromRegistryFactory();
714
+ cachedCreateCallerFromRegistry = generatedCallerFactory;
715
+
716
+ return generatedCallerFactory;
717
+ }
718
+
719
+ ${handlerFactoryHelpers}
639
720
 
640
721
  export function ${callerExportName}<TCtx extends ProcedureCallerContext>(
641
722
  ctx: TCtx
642
723
  ): GeneratedProcedureCaller<TCtx> {
724
+ const createCallerFromRegistry = getCreateCallerFromRegistry();
643
725
  return createCallerFromRegistry(ctx) as GeneratedProcedureCaller<TCtx>;
644
726
  }
645
- ${hasHandlerRegistry ? `
646
- export function ${handlerExportName}<TCtx extends ProcedureHandlerContext>(
647
- ctx: TCtx
648
- ): GeneratedProcedureHandler<TCtx> {
649
- return createHandlerFromRegistry(ctx) as GeneratedProcedureHandler<TCtx>;
650
- }
651
- ` : ""}
727
+ ${handlerExport}
652
728
  `;
653
729
  }
654
730
  function hasNamedExport(filePath, exportName) {
@@ -1,5 +1,5 @@
1
1
  import { i as pretendRequired, n as deprecated, r as pretend } from "../validators-BcQFm1oY.js";
2
- import { $ as DatabaseWithQuery, $n as BuildRelationResult, $r as notInArray, $t as defineRelationsPart, A as MigrationRunArgs, An as aggregateIndex, Ar as FieldReference, At as json, B as MigrationMigrateOne, Bn as ConvexUniqueConstraintBuilder, Br as gt, Bt as bigint, C as OrmBeforeResult, Cn as ConvexRankIndexBuilderOn, Cr as ReturningSelection, Ct as ConvexDateBuilderInitial, D as OrmTriggers, Dn as ConvexVectorIndexBuilder, Dr as unsetToken, Dt as ConvexCustomBuilderInitial, E as OrmTriggerContext, En as ConvexSearchIndexConfig, Er as VectorSearchProvider, Et as ConvexCustomBuilder, F as MigrationDirection, Fn as vectorIndex, Fr as between, Ft as ConvexBooleanBuilder, G as MigrationStep, Gn as unique, Gr as isNotNull, Gt as ManyConfig, H as MigrationRunStatus, Hn as ConvexUniqueConstraintConfig, Hr as ilike, Ht as CountBackfillKickoffArgs, I as MigrationDoc, In as ConvexCheckBuilder, Ir as contains, It as ConvexBooleanBuilderInitial, J as buildMigrationPlan, Jn as text, Jr as lt, Jt as RelationsBuilderColumnBase, K as MigrationTableName, Kn as ConvexTextBuilder, Kr as isNull, Kt as OneConfig, L as MigrationDocContext, Ln as ConvexCheckConfig, Lr as endsWith, Lt as boolean, M as MigrationStatusArgs, Mn as rankIndex, Mr as LogicalExpression, Mt as ConvexBytesBuilder, N as MigrationAppliedState, Nn as searchIndex, Nr as UnaryExpression, Nt as ConvexBytesBuilderInitial, O as defineTriggers, On as ConvexVectorIndexBuilderOn, Or as BinaryExpression, Ot as arrayOf, P as MigrationDefinition, Pn as uniqueIndex, Pr as and, Pt as bytes, Q as DatabaseWithMutations, Qn as BuildQueryResult, Qr as notBetween, Qt as defineRelations, R as MigrationDriftIssue, Rn as ConvexForeignKeyBuilder, Rr as eq, Rt as ConvexBigIntBuilder, S as scheduledDeleteFactory, Sn as ConvexRankIndexBuilder, Sr as ReturningResult, St as ConvexDateBuilder, T as OrmTriggerChange, Tn as ConvexSearchIndexBuilderOn, Tr as VectorQueryConfig, Tt as date, U as MigrationSet, Un as check, Ur as inArray, Ut as CountBackfillStatusArgs, V as MigrationPlan, Vn as ConvexUniqueConstraintBuilderOn, Vr as gte, Vt as CountBackfillChunkArgs, W as MigrationStateMap, Wn as foreignKey, Wr as isFieldReference, Wt as ExtractTablesWithRelations, X as defineMigrationSet, Xn as AggregateFieldValue, Xr as ne, Xt as TableRelationalConfig, Y as defineMigration, Yn as AggregateConfig, Yr as lte, Yt as RelationsBuilderColumnConfig, Z as detectMigrationDrift, Zn as AggregateResult, Zr as not, Zt as TablesRelationalConfig, _ as OrmWriterCtx, _i as IsPrimaryKey, _n as rlsRole, _r as OrderByClause, _t as ConvexNumberBuilderInitial, a as TableConfigResult, ai as OrmSchemaPluginTables, an as OrmLifecycleChange, ar as InferInsertModel, at as extractRelationsConfig, b as scheduledMutationBatchFactory, bn as ConvexIndexBuilder, br as PredicateWhereIndexConfig, bt as ConvexIdBuilderInitial, c as OrmNotFoundError, ci as AnyColumn, cn as convexTable, cr as InsertValue, ct as vector, d as GenericOrmCtx, di as ColumnBuilderRuntimeConfig, dn as RlsPolicy, dr as MutationExecutionMode, dt as ConvexTimestampMode, ei as or, en as ConvexDeletionBuilder, er as CountConfig, et as OrmReader, f as OrmApiResult, fi as ColumnBuilderTypeConfig, fn as RlsPolicyConfig, fr as MutationPaginateConfig, ft as timestamp, g as OrmReaderCtx, gi as HasDefault, gn as RlsRoleConfig, gr as MutationRunMode, gt as ConvexNumberBuilder, h as OrmFunctions, hi as DrizzleEntity, hn as RlsRole, hr as MutationReturning, ht as textEnum, i as desc, ii as OrmSchemaPlugin, in as DiscriminatorBuilderConfig, ir as GetColumnData, it as EdgeMetadata, j as MigrationRunChunkArgs, jn as index, jr as FilterExpression, jt as objectOf, k as MigrationCancelArgs, kn as ConvexVectorIndexConfig, kr as ExpressionVisitor, kt as custom, l as CreateOrmOptions, li as ColumnBuilder, ln as deletion, lr as MutationExecuteConfig, lt as ConvexTimestampBuilder, m as OrmClientWithApi, mi as ColumnDataType, mn as rlsPolicy, mr as MutationResult, mt as ConvexTextEnumBuilderInitial, n as defineSchema, ni as Brand, nn as ConvexTable, nr as DBQueryConfig, nt as RlsContext, o as getTableColumns, oi as TableName, on as OrmLifecycleOperation, or as InferModelFromColumns, ot as ConvexVectorBuilder, p as OrmClientBase, pi as ColumnBuilderWithTableName, pn as RlsPolicyToOption, pr as MutationPaginatedResult, pt as ConvexTextEnumBuilder, q as MigrationWriteMode, qn as ConvexTextBuilderInitial, qr as like, qt as RelationsBuilder, r as asc, ri as Columns, rr as FilterOperators, rt as RlsMode, s as getTableConfig, si as SystemFields, sn as TableConfig, sr as InferSelectModel, st as ConvexVectorBuilderInitial, t as WhereClauseResult, ti as startsWith, tn as ConvexDeletionConfig, tr as CountResult, tt as OrmWriter, u as GenericOrm, ui as ColumnBuilderBaseConfig, un as discriminator, ur as MutationExecuteResult, ut as ConvexTimestampBuilderInitial, v as createOrm, vi as IsUnique, vn as ConvexAggregateIndexBuilder, vr as OrderDirection, vt as integer, w as OrmTableTriggers, wn as ConvexSearchIndexBuilder, wr as UpdateSet, wt as ConvexDateMode, x as ScheduledDeleteArgs, xn as ConvexIndexBuilderOn, xr as ReturningAll, xt as id, y as ScheduledMutationBatchArgs, yi as NotNull, yn as ConvexAggregateIndexBuilderOn, yr as PaginatedResult, yt as ConvexIdBuilder, z as MigrationManifestEntry, zn as ConvexForeignKeyConfig, zr as fieldRef, zt as ConvexBigIntBuilderInitial } from "../where-clause-compiler-UavDdMUX.js";
2
+ import { $ as DatabaseWithQuery, $n as BuildRelationResult, $r as notInArray, $t as defineRelationsPart, A as MigrationRunArgs, An as aggregateIndex, Ar as FieldReference, At as json, B as MigrationMigrateOne, Bn as ConvexUniqueConstraintBuilder, Br as gt, Bt as bigint, C as OrmBeforeResult, Cn as ConvexRankIndexBuilderOn, Cr as ReturningSelection, Ct as ConvexDateBuilderInitial, D as OrmTriggers, Dn as ConvexVectorIndexBuilder, Dr as unsetToken, Dt as ConvexCustomBuilderInitial, E as OrmTriggerContext, En as ConvexSearchIndexConfig, Er as VectorSearchProvider, Et as ConvexCustomBuilder, F as MigrationDirection, Fn as vectorIndex, Fr as between, Ft as ConvexBooleanBuilder, G as MigrationStep, Gn as unique, Gr as isNotNull, Gt as ManyConfig, H as MigrationRunStatus, Hn as ConvexUniqueConstraintConfig, Hr as ilike, Ht as CountBackfillKickoffArgs, I as MigrationDoc, In as ConvexCheckBuilder, Ir as contains, It as ConvexBooleanBuilderInitial, J as buildMigrationPlan, Jn as text, Jr as lt, Jt as RelationsBuilderColumnBase, K as MigrationTableName, Kn as ConvexTextBuilder, Kr as isNull, Kt as OneConfig, L as MigrationDocContext, Ln as ConvexCheckConfig, Lr as endsWith, Lt as boolean, M as MigrationStatusArgs, Mn as rankIndex, Mr as LogicalExpression, Mt as ConvexBytesBuilder, N as MigrationAppliedState, Nn as searchIndex, Nr as UnaryExpression, Nt as ConvexBytesBuilderInitial, O as defineTriggers, On as ConvexVectorIndexBuilderOn, Or as BinaryExpression, Ot as arrayOf, P as MigrationDefinition, Pn as uniqueIndex, Pr as and, Pt as bytes, Q as DatabaseWithMutations, Qn as BuildQueryResult, Qr as notBetween, Qt as defineRelations, R as MigrationDriftIssue, Rn as ConvexForeignKeyBuilder, Rr as eq, Rt as ConvexBigIntBuilder, S as scheduledDeleteFactory, Sn as ConvexRankIndexBuilder, Sr as ReturningResult, St as ConvexDateBuilder, T as OrmTriggerChange, Tn as ConvexSearchIndexBuilderOn, Tr as VectorQueryConfig, Tt as date, U as MigrationSet, Un as check, Ur as inArray, Ut as CountBackfillStatusArgs, V as MigrationPlan, Vn as ConvexUniqueConstraintBuilderOn, Vr as gte, Vt as CountBackfillChunkArgs, W as MigrationStateMap, Wn as foreignKey, Wr as isFieldReference, Wt as ExtractTablesWithRelations, X as defineMigrationSet, Xn as AggregateFieldValue, Xr as ne, Xt as TableRelationalConfig, Y as defineMigration, Yn as AggregateConfig, Yr as lte, Yt as RelationsBuilderColumnConfig, Z as detectMigrationDrift, Zn as AggregateResult, Zr as not, Zt as TablesRelationalConfig, _ as OrmWriterCtx, _i as IsPrimaryKey, _n as rlsRole, _r as OrderByClause, _t as ConvexNumberBuilderInitial, a as TableConfigResult, ai as OrmSchemaPluginTables, an as OrmLifecycleChange, ar as InferInsertModel, at as extractRelationsConfig, b as scheduledMutationBatchFactory, bn as ConvexIndexBuilder, br as PredicateWhereIndexConfig, bt as ConvexIdBuilderInitial, c as OrmNotFoundError, ci as AnyColumn, cn as convexTable, cr as InsertValue, ct as vector, d as GenericOrmCtx, di as ColumnBuilderRuntimeConfig, dn as RlsPolicy, dr as MutationExecutionMode, dt as ConvexTimestampMode, ei as or, en as ConvexDeletionBuilder, er as CountConfig, et as OrmReader, f as OrmApiResult, fi as ColumnBuilderTypeConfig, fn as RlsPolicyConfig, fr as MutationPaginateConfig, ft as timestamp, g as OrmReaderCtx, gi as HasDefault, gn as RlsRoleConfig, gr as MutationRunMode, gt as ConvexNumberBuilder, h as OrmFunctions, hi as DrizzleEntity, hn as RlsRole, hr as MutationReturning, ht as textEnum, i as desc, ii as OrmSchemaPlugin, in as DiscriminatorBuilderConfig, ir as GetColumnData, it as EdgeMetadata, j as MigrationRunChunkArgs, jn as index, jr as FilterExpression, jt as objectOf, k as MigrationCancelArgs, kn as ConvexVectorIndexConfig, kr as ExpressionVisitor, kt as custom, l as CreateOrmOptions, li as ColumnBuilder, ln as deletion, lr as MutationExecuteConfig, lt as ConvexTimestampBuilder, m as OrmClientWithApi, mi as ColumnDataType, mn as rlsPolicy, mr as MutationResult, mt as ConvexTextEnumBuilderInitial, n as defineSchema, ni as Brand, nn as ConvexTable, nr as DBQueryConfig, nt as RlsContext, o as getTableColumns, oi as TableName, on as OrmLifecycleOperation, or as InferModelFromColumns, ot as ConvexVectorBuilder, p as OrmClientBase, pi as ColumnBuilderWithTableName, pn as RlsPolicyToOption, pr as MutationPaginatedResult, pt as ConvexTextEnumBuilder, q as MigrationWriteMode, qn as ConvexTextBuilderInitial, qr as like, qt as RelationsBuilder, r as asc, ri as Columns, rr as FilterOperators, rt as RlsMode, s as getTableConfig, si as SystemFields, sn as TableConfig, sr as InferSelectModel, st as ConvexVectorBuilderInitial, t as WhereClauseResult, ti as startsWith, tn as ConvexDeletionConfig, tr as CountResult, tt as OrmWriter, u as GenericOrm, ui as ColumnBuilderBaseConfig, un as discriminator, ur as MutationExecuteResult, ut as ConvexTimestampBuilderInitial, v as createOrm, vi as IsUnique, vn as ConvexAggregateIndexBuilder, vr as OrderDirection, vt as integer, w as OrmTableTriggers, wn as ConvexSearchIndexBuilder, wr as UpdateSet, wt as ConvexDateMode, x as ScheduledDeleteArgs, xn as ConvexIndexBuilderOn, xr as ReturningAll, xt as id, y as ScheduledMutationBatchArgs, yi as NotNull, yn as ConvexAggregateIndexBuilderOn, yr as PaginatedResult, yt as ConvexIdBuilder, z as MigrationManifestEntry, zn as ConvexForeignKeyConfig, zr as fieldRef, zt as ConvexBigIntBuilderInitial } from "../where-clause-compiler-BCECnxsG.js";
3
3
  import { a as QueryCtxWithPreferredOrmQueryTable, i as QueryCtxWithOrmQueryTable, n as LookupByIdResultByCtx, o as getByIdWithOrmQueryFallback, r as QueryCtxWithOptionalOrmQueryTable, t as DocByCtx } from "../query-context-ji7By8u0.js";
4
4
  import { DefineSchemaOptions, GenericSchema, SchemaDefinition } from "convex/server";
5
5
  export { type AggregateConfig, type AggregateFieldValue, type AggregateResult, type AnyColumn, type BinaryExpression, Brand, type BuildQueryResult, type BuildRelationResult, type ColumnBuilder, type ColumnBuilderBaseConfig, type ColumnBuilderRuntimeConfig, type ColumnBuilderTypeConfig, type ColumnBuilderWithTableName, type ColumnDataType, Columns, type ConvexAggregateIndexBuilder, type ConvexAggregateIndexBuilderOn, type ConvexBigIntBuilder, type ConvexBigIntBuilderInitial, type ConvexBooleanBuilder, type ConvexBooleanBuilderInitial, type ConvexBytesBuilder, type ConvexBytesBuilderInitial, type ConvexCheckBuilder, type ConvexCheckConfig, type ConvexCustomBuilder, type ConvexCustomBuilderInitial, type ConvexDateBuilder, type ConvexDateBuilderInitial, type ConvexDateMode, type ConvexDeletionBuilder, type ConvexDeletionConfig, type ConvexForeignKeyBuilder, type ConvexForeignKeyConfig, type ConvexIdBuilder, type ConvexIdBuilderInitial, type ConvexIndexBuilder, type ConvexIndexBuilderOn, type ConvexNumberBuilder, type ConvexNumberBuilderInitial, type ConvexRankIndexBuilder, type ConvexRankIndexBuilderOn, type ConvexSearchIndexBuilder, type ConvexSearchIndexBuilderOn, type ConvexSearchIndexConfig, type ConvexTable, type ConvexTextBuilder, type ConvexTextBuilderInitial, type ConvexTextEnumBuilder, type ConvexTextEnumBuilderInitial, type ConvexTimestampBuilder, type ConvexTimestampBuilderInitial, type ConvexTimestampMode, type ConvexUniqueConstraintBuilder, type ConvexUniqueConstraintBuilderOn, type ConvexUniqueConstraintConfig, type ConvexVectorBuilder, type ConvexVectorBuilderInitial, type ConvexVectorIndexBuilder, type ConvexVectorIndexBuilderOn, type ConvexVectorIndexConfig, type CountBackfillChunkArgs, type CountBackfillKickoffArgs, type CountBackfillStatusArgs, type CountConfig, type CountResult, type CreateOrmOptions, type DBQueryConfig, type DatabaseWithMutations, type DatabaseWithQuery, type DefineSchemaOptions, type DiscriminatorBuilderConfig, type DocByCtx, type DrizzleEntity, type EdgeMetadata, type ExpressionVisitor, type ExtractTablesWithRelations, type FieldReference, type FilterExpression, type FilterOperators, type GenericOrm, type GenericOrmCtx, type GenericSchema, type GetColumnData, type HasDefault, type InferInsertModel, type InferModelFromColumns, type InferSelectModel, type InsertValue, type IsPrimaryKey, type IsUnique, type LogicalExpression, type LookupByIdResultByCtx, type ManyConfig, type MigrationAppliedState, type MigrationCancelArgs, type MigrationDefinition, type MigrationDirection, type MigrationDoc, type MigrationDocContext, type MigrationDriftIssue, type MigrationManifestEntry, type MigrationMigrateOne, type MigrationPlan, type MigrationRunArgs, type MigrationRunChunkArgs, type MigrationRunStatus, type MigrationSet, type MigrationStateMap, type MigrationStatusArgs, type MigrationStep, type MigrationTableName, type MigrationWriteMode, type MutationExecuteConfig, type MutationExecuteResult, type MutationExecutionMode, type MutationPaginateConfig, type MutationPaginatedResult, type MutationResult, type MutationReturning, type MutationRunMode, type NotNull, type OneConfig, type OrderByClause, type OrderDirection, type OrmApiResult, type OrmBeforeResult, type OrmClientBase, type OrmClientWithApi, type OrmFunctions, type OrmLifecycleChange, type OrmLifecycleOperation, OrmNotFoundError, type OrmReader, type OrmReaderCtx, type OrmSchemaPlugin, OrmSchemaPluginTables, type OrmTableTriggers, type OrmTriggerChange, type OrmTriggerContext, type OrmTriggers, type OrmWriter, type OrmWriterCtx, type PaginatedResult, type PredicateWhereIndexConfig, type QueryCtxWithOptionalOrmQueryTable, type QueryCtxWithOrmQueryTable, type QueryCtxWithPreferredOrmQueryTable, type RelationsBuilder, type RelationsBuilderColumnBase, type RelationsBuilderColumnConfig, type ReturningAll, type ReturningResult, type ReturningSelection, type RlsContext, type RlsMode, RlsPolicy, type RlsPolicyConfig, type RlsPolicyToOption, RlsRole, type RlsRoleConfig, type ScheduledDeleteArgs, type ScheduledMutationBatchArgs, type SchemaDefinition, type SystemFields, type TableConfig, type TableConfigResult, TableName, type TableRelationalConfig, type TablesRelationalConfig, type UnaryExpression, type UpdateSet, type VectorQueryConfig, type VectorSearchProvider, type WhereClauseResult, aggregateIndex, and, arrayOf, asc, between, bigint, boolean, buildMigrationPlan, bytes, check, contains, convexTable, createOrm, custom, date, defineMigration, defineMigrationSet, defineRelations, defineRelationsPart, defineSchema, defineTriggers, deletion, deprecated, desc, detectMigrationDrift, discriminator, endsWith, eq, extractRelationsConfig, fieldRef, foreignKey, getByIdWithOrmQueryFallback, getTableColumns, getTableConfig, gt, gte, id, ilike, inArray, index, integer, isFieldReference, isNotNull, isNull, json, like, lt, lte, ne, not, notBetween, notInArray, objectOf, or, pretend, pretendRequired, rankIndex, rlsPolicy, rlsRole, scheduledDeleteFactory, scheduledMutationBatchFactory, searchIndex, startsWith, text, textEnum, timestamp, unique, uniqueIndex, unsetToken, vector, vectorIndex };
@@ -1,4 +1,4 @@
1
- import { ii as OrmSchemaPlugin } from "../where-clause-compiler-UavDdMUX.js";
1
+ import { ii as OrmSchemaPlugin } from "../where-clause-compiler-BCECnxsG.js";
2
2
 
3
3
  //#region src/orm/migrations/schema.d.ts
4
4
  declare function migrationPlugin(): OrmSchemaPlugin;
@@ -1,4 +1,4 @@
1
- import { ii as OrmSchemaPlugin } from "../../where-clause-compiler-UavDdMUX.js";
1
+ import { ii as OrmSchemaPlugin } from "../../where-clause-compiler-BCECnxsG.js";
2
2
  import * as convex_server0 from "convex/server";
3
3
 
4
4
  //#region src/plugins/ratelimit/duration.d.ts
package/dist/watcher.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { n as getConvexConfig, t as generateMeta } from "./codegen-CMQIKrqh.mjs";
2
+ import { n as getConvexConfig, t as generateMeta } from "./codegen-CJiil63j.mjs";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
 
@@ -3428,7 +3428,7 @@ type TriggerTableName<TSchema extends TablesRelationalConfig> = { [K in KnownKey
3428
3428
  type TriggerDoc<TSchema extends TablesRelationalConfig, TTableName extends TriggerTableName<TSchema>> = TSchema[TTableName] extends TableRelationalConfig ? InferSelectModel<TSchema[TTableName]['table']> : never;
3429
3429
  type TriggerInsertData<TSchema extends TablesRelationalConfig, TTableName extends TriggerTableName<TSchema>> = TSchema[TTableName] extends TableRelationalConfig ? InferInsertModel<TSchema[TTableName]['table']> : never;
3430
3430
  type TriggerUpdateData<TSchema extends TablesRelationalConfig, TTableName extends TriggerTableName<TSchema>> = Partial<TriggerInsertData<TSchema, TTableName>>;
3431
- type OrmTriggerContext<TSchema extends TablesRelationalConfig, TExtraCtx extends Record<string, unknown> = {}> = Omit<TExtraCtx, 'db' | 'innerDb' | 'orm'> & {
3431
+ type OrmTriggerContext<TSchema extends TablesRelationalConfig, TExtraCtx extends object = {}> = Omit<TExtraCtx, 'db' | 'innerDb' | 'orm'> & {
3432
3432
  db: GenericDatabaseWriter<any>;
3433
3433
  innerDb: GenericDatabaseWriter<any>;
3434
3434
  orm: OrmWriter<TSchema>;
@@ -3442,13 +3442,13 @@ type OrmTriggerChange<TDoc = AnyRecord, TId = TriggerChangeId<TDoc>> = OrmLifecy
3442
3442
  type OrmBeforeResult<TData extends AnyRecord> = void | false | {
3443
3443
  data: Partial<TData>;
3444
3444
  };
3445
- type OrmBeforeHook<TData extends AnyRecord, TCtx extends Record<string, unknown>> = (data: TData, ctx: TCtx) => MaybePromise<OrmBeforeResult<TData>>;
3446
- type OrmAfterHook<TDoc extends AnyRecord, TCtx extends Record<string, unknown>> = (doc: TDoc, ctx: TCtx) => MaybePromise<void>;
3447
- type OrmChangeHook<TDoc extends AnyRecord, TCtx extends Record<string, unknown>> = ((change: OrmTriggerChange<TDoc>, ctx: TCtx) => MaybePromise<void>) | {
3445
+ type OrmBeforeHook<TData extends AnyRecord, TCtx extends object> = (data: TData, ctx: TCtx) => MaybePromise<OrmBeforeResult<TData>>;
3446
+ type OrmAfterHook<TDoc extends AnyRecord, TCtx extends object> = (doc: TDoc, ctx: TCtx) => MaybePromise<void>;
3447
+ type OrmChangeHook<TDoc extends AnyRecord, TCtx extends object> = ((change: OrmTriggerChange<TDoc>, ctx: TCtx) => MaybePromise<void>) | {
3448
3448
  (): unknown;
3449
3449
  (change: OrmTriggerChange<TDoc>, ctx: TCtx): MaybePromise<void>;
3450
3450
  };
3451
- type OrmTableTriggers<TDoc extends AnyRecord, TInsert extends AnyRecord, TUpdate extends AnyRecord, TCtx extends Record<string, unknown>> = {
3451
+ type OrmTableTriggers<TDoc extends AnyRecord, TInsert extends AnyRecord, TUpdate extends AnyRecord, TCtx extends object> = {
3452
3452
  create?: {
3453
3453
  before?: OrmBeforeHook<TInsert, TCtx>;
3454
3454
  after?: OrmAfterHook<TDoc, TCtx>;
@@ -3463,9 +3463,9 @@ type OrmTableTriggers<TDoc extends AnyRecord, TInsert extends AnyRecord, TUpdate
3463
3463
  };
3464
3464
  change?: OrmChangeHook<TDoc, TCtx>;
3465
3465
  };
3466
- type OrmTriggers<TSchema extends TablesRelationalConfig, TExtraCtx extends Record<string, unknown> = {}> = { [TTableName in TriggerTableName<TSchema>]?: OrmTableTriggers<TriggerDoc<TSchema, TTableName>, TriggerInsertData<TSchema, TTableName>, TriggerUpdateData<TSchema, TTableName>, OrmTriggerContext<TSchema, TExtraCtx>> };
3466
+ type OrmTriggers<TSchema extends TablesRelationalConfig, TExtraCtx extends object = {}> = { [TTableName in TriggerTableName<TSchema>]?: OrmTableTriggers<TriggerDoc<TSchema, TTableName>, TriggerInsertData<TSchema, TTableName>, TriggerUpdateData<TSchema, TTableName>, OrmTriggerContext<TSchema, TExtraCtx>> };
3467
3467
  declare function defineTriggers<TSchema extends TablesRelationalConfig>(schema: TSchema, triggers: OrmTriggers<TSchema>): OrmTriggers<TSchema>;
3468
- declare function defineTriggers<TSchema extends TablesRelationalConfig, TExtraCtx extends Record<string, unknown>>(schema: TSchema, triggers: OrmTriggers<TSchema, TExtraCtx>): OrmTriggers<TSchema, TExtraCtx>;
3468
+ declare function defineTriggers<TSchema extends TablesRelationalConfig, TExtraCtx extends object>(schema: TSchema, triggers: OrmTriggers<TSchema, TExtraCtx>): OrmTriggers<TSchema, TExtraCtx>;
3469
3469
  //#endregion
3470
3470
  //#region src/orm/scheduled-delete.d.ts
3471
3471
  type ScheduledDeleteArgs = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-convex",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "Better Convex - React Query integration and CLI tools for Convex",
5
5
  "keywords": [
6
6
  "convex",