better-convex 0.8.1 → 0.8.3

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,7 @@
1
- import { At as ConvexCustomBuilderInitial, Ct as ConvexIdBuilderInitial, _t as ConvexTextBuilderInitial, bt as ConvexNumberBuilderInitial, on as ConvexTableWithColumns } from "../where-clause-compiler-BIjTkVVJ.js";
1
+ import "../validators-BcQFm1oY.js";
2
+ import { jt as ConvexCustomBuilderInitial, sn as ConvexTableWithColumns, vt as ConvexTextBuilderInitial, wt as ConvexIdBuilderInitial, xt as ConvexNumberBuilderInitial } from "../where-clause-compiler-m-GQNB_K.js";
3
+ import "../query-context-ji7By8u0.js";
4
+ import "../orm/index.js";
2
5
  import * as convex_values0 from "convex/values";
3
6
  import { GenericId, Infer, Value } from "convex/values";
4
7
  import { DocumentByName, GenericDataModel, GenericDatabaseReader, GenericDatabaseWriter, TableNamesInDataModel } from "convex/server";
@@ -1,3 +1,4 @@
1
+ import "../validators-BcQFm1oY.js";
1
2
  import { a as QueryCtxWithPreferredOrmQueryTable, n as LookupByIdResultByCtx, t as DocByCtx } from "../query-context-ji7By8u0.js";
2
3
  import { t as GetAuth } from "../types-CM67ko7K.js";
3
4
  import { A as GenericCtx } from "../procedure-caller-DYjpq7rG.js";
@@ -182,13 +183,13 @@ type AdapterPaginationOptions = PaginationOptions & {
182
183
  };
183
184
  declare const adapterWhereValidator: convex_values0.VObject<{
184
185
  connector?: "AND" | "OR" | undefined;
185
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
186
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
186
187
  value: string | number | boolean | string[] | number[] | null;
187
188
  field: string;
188
189
  }, {
189
190
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
190
191
  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>;
192
+ 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
193
  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
194
  }, "required", "value" | "connector" | "field" | "operator">;
194
195
  declare const adapterArgsValidator: convex_values0.VObject<{
@@ -201,7 +202,7 @@ declare const adapterArgsValidator: convex_values0.VObject<{
201
202
  } | undefined;
202
203
  where?: {
203
204
  connector?: "AND" | "OR" | undefined;
204
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
205
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
205
206
  value: string | number | boolean | string[] | number[] | null;
206
207
  field: string;
207
208
  }[] | undefined;
@@ -220,18 +221,18 @@ declare const adapterArgsValidator: convex_values0.VObject<{
220
221
  }, "optional", "direction" | "field">;
221
222
  where: convex_values0.VArray<{
222
223
  connector?: "AND" | "OR" | undefined;
223
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
224
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
224
225
  value: string | number | boolean | string[] | number[] | null;
225
226
  field: string;
226
227
  }[] | undefined, convex_values0.VObject<{
227
228
  connector?: "AND" | "OR" | undefined;
228
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
229
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
229
230
  value: string | number | boolean | string[] | number[] | null;
230
231
  field: string;
231
232
  }, {
232
233
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
233
234
  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>;
235
+ 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
236
  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
237
  }, "required", "value" | "connector" | "field" | "operator">, "optional">;
237
238
  }, "required", "limit" | "model" | "select" | "offset" | "sortBy" | "where" | "sortBy.direction" | "sortBy.field">;
@@ -359,10 +360,18 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
359
360
  };
360
361
  }, Promise<any>>;
361
362
  deleteMany: convex_server0.RegisteredMutation<"internal", {
363
+ paginationOpts: {
364
+ id?: number;
365
+ endCursor?: string | null;
366
+ maximumRowsRead?: number;
367
+ maximumBytesRead?: number;
368
+ numItems: number;
369
+ cursor: string | null;
370
+ };
362
371
  input: {
363
372
  where?: {
364
373
  connector?: "AND" | "OR" | undefined;
365
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
374
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
366
375
  value: string | number | boolean | string[] | number[] | null;
367
376
  field: string;
368
377
  }[] | undefined;
@@ -371,14 +380,6 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
371
380
  where?: any[] | undefined;
372
381
  model: string;
373
382
  };
374
- paginationOpts: {
375
- id?: number;
376
- endCursor?: string | null;
377
- maximumRowsRead?: number;
378
- maximumBytesRead?: number;
379
- numItems: number;
380
- cursor: string | null;
381
- };
382
383
  }, Promise<{
383
384
  count: number;
384
385
  ids: any[];
@@ -391,7 +392,7 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
391
392
  input: {
392
393
  where?: {
393
394
  connector?: "AND" | "OR" | undefined;
394
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
395
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
395
396
  value: string | number | boolean | string[] | number[] | null;
396
397
  field: string;
397
398
  }[] | undefined;
@@ -402,8 +403,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
402
403
  };
403
404
  }, Promise<Record<string, unknown> | undefined>>;
404
405
  findMany: convex_server0.RegisteredQuery<"internal", {
405
- limit?: number | undefined;
406
406
  join?: any;
407
+ limit?: number | undefined;
407
408
  offset?: number | undefined;
408
409
  sortBy?: {
409
410
  direction: "asc" | "desc";
@@ -411,7 +412,7 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
411
412
  } | undefined;
412
413
  where?: {
413
414
  connector?: "AND" | "OR" | undefined;
414
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
415
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
415
416
  value: string | number | boolean | string[] | number[] | null;
416
417
  field: string;
417
418
  }[] | undefined;
@@ -430,17 +431,25 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
430
431
  select?: string[] | undefined;
431
432
  where?: {
432
433
  connector?: "AND" | "OR" | undefined;
433
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
434
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
434
435
  value: string | number | boolean | string[] | number[] | null;
435
436
  field: string;
436
437
  }[] | undefined;
437
438
  model: string;
438
439
  }, Promise<convex_server0.GenericDocument | null>>;
439
440
  updateMany: convex_server0.RegisteredMutation<"internal", {
441
+ paginationOpts: {
442
+ id?: number;
443
+ endCursor?: string | null;
444
+ maximumRowsRead?: number;
445
+ maximumBytesRead?: number;
446
+ numItems: number;
447
+ cursor: string | null;
448
+ };
440
449
  input: {
441
450
  where?: {
442
451
  connector?: "AND" | "OR" | undefined;
443
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
452
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
444
453
  value: string | number | boolean | string[] | number[] | null;
445
454
  field: string;
446
455
  }[] | undefined;
@@ -455,14 +464,6 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
455
464
  update: any;
456
465
  model: string;
457
466
  };
458
- paginationOpts: {
459
- id?: number;
460
- endCursor?: string | null;
461
- maximumRowsRead?: number;
462
- maximumBytesRead?: number;
463
- numItems: number;
464
- cursor: string | null;
465
- };
466
467
  }, Promise<{
467
468
  count: number;
468
469
  ids: any[];
@@ -475,7 +476,7 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
475
476
  input: {
476
477
  where?: {
477
478
  connector?: "AND" | "OR" | undefined;
478
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
479
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
479
480
  value: string | number | boolean | string[] | number[] | null;
480
481
  field: string;
481
482
  }[] | undefined;
@@ -19155,10 +19156,18 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19155
19156
  };
19156
19157
  }, Promise<any>>;
19157
19158
  deleteMany: convex_server0.RegisteredMutation<"internal", {
19159
+ paginationOpts: {
19160
+ id?: number;
19161
+ endCursor?: string | null;
19162
+ maximumRowsRead?: number;
19163
+ maximumBytesRead?: number;
19164
+ numItems: number;
19165
+ cursor: string | null;
19166
+ };
19158
19167
  input: {
19159
19168
  where?: {
19160
19169
  connector?: "AND" | "OR" | undefined;
19161
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19170
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19162
19171
  value: string | number | boolean | string[] | number[] | null;
19163
19172
  field: string;
19164
19173
  }[] | undefined;
@@ -19167,14 +19176,6 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19167
19176
  where?: any[] | undefined;
19168
19177
  model: string;
19169
19178
  };
19170
- paginationOpts: {
19171
- id?: number;
19172
- endCursor?: string | null;
19173
- maximumRowsRead?: number;
19174
- maximumBytesRead?: number;
19175
- numItems: number;
19176
- cursor: string | null;
19177
- };
19178
19179
  }, Promise<{
19179
19180
  count: number;
19180
19181
  ids: any[];
@@ -19187,7 +19188,7 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19187
19188
  input: {
19188
19189
  where?: {
19189
19190
  connector?: "AND" | "OR" | undefined;
19190
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19191
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19191
19192
  value: string | number | boolean | string[] | number[] | null;
19192
19193
  field: string;
19193
19194
  }[] | undefined;
@@ -19198,8 +19199,8 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19198
19199
  };
19199
19200
  }, Promise<Record<string, unknown> | undefined>>;
19200
19201
  findMany: convex_server0.RegisteredQuery<"internal", {
19201
- limit?: number | undefined;
19202
19202
  join?: any;
19203
+ limit?: number | undefined;
19203
19204
  offset?: number | undefined;
19204
19205
  sortBy?: {
19205
19206
  direction: "asc" | "desc";
@@ -19207,7 +19208,7 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19207
19208
  } | undefined;
19208
19209
  where?: {
19209
19210
  connector?: "AND" | "OR" | undefined;
19210
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19211
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19211
19212
  value: string | number | boolean | string[] | number[] | null;
19212
19213
  field: string;
19213
19214
  }[] | undefined;
@@ -19226,17 +19227,25 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19226
19227
  select?: string[] | undefined;
19227
19228
  where?: {
19228
19229
  connector?: "AND" | "OR" | undefined;
19229
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19230
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19230
19231
  value: string | number | boolean | string[] | number[] | null;
19231
19232
  field: string;
19232
19233
  }[] | undefined;
19233
19234
  model: string;
19234
19235
  }, Promise<convex_server0.GenericDocument | null>>;
19235
19236
  updateMany: convex_server0.RegisteredMutation<"internal", {
19237
+ paginationOpts: {
19238
+ id?: number;
19239
+ endCursor?: string | null;
19240
+ maximumRowsRead?: number;
19241
+ maximumBytesRead?: number;
19242
+ numItems: number;
19243
+ cursor: string | null;
19244
+ };
19236
19245
  input: {
19237
19246
  where?: {
19238
19247
  connector?: "AND" | "OR" | undefined;
19239
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19248
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19240
19249
  value: string | number | boolean | string[] | number[] | null;
19241
19250
  field: string;
19242
19251
  }[] | undefined;
@@ -19251,14 +19260,6 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19251
19260
  update: any;
19252
19261
  model: string;
19253
19262
  };
19254
- paginationOpts: {
19255
- id?: number;
19256
- endCursor?: string | null;
19257
- maximumRowsRead?: number;
19258
- maximumBytesRead?: number;
19259
- numItems: number;
19260
- cursor: string | null;
19261
- };
19262
19263
  }, Promise<{
19263
19264
  count: number;
19264
19265
  ids: any[];
@@ -19271,7 +19272,7 @@ declare const createAuthRuntime: <DataModel extends GenericDataModel, Schema ext
19271
19272
  input: {
19272
19273
  where?: {
19273
19274
  connector?: "AND" | "OR" | undefined;
19274
- operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19275
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
19275
19276
  value: string | number | boolean | string[] | number[] | null;
19276
19277
  field: string;
19277
19278
  }[] | undefined;
@@ -19334,6 +19335,10 @@ declare const createDisabledAuthRuntime: <DataModel extends GenericDataModel, Sc
19334
19335
  type SessionDoc<TCtx extends GenericQueryCtx<any>> = DocByCtx<TCtx, 'session'>;
19335
19336
  type SessionResult<TCtx extends GenericQueryCtx<any>> = LookupByIdResultByCtx<TCtx, 'session'>;
19336
19337
  type SessionLookupCtx<TCtx extends GenericQueryCtx<any>> = QueryCtxWithPreferredOrmQueryTable<TCtx, 'session'>;
19338
+ type SessionClientSignals = {
19339
+ ip?: string;
19340
+ userAgent?: string;
19341
+ };
19337
19342
  declare const getAuthUserIdentity: <DataModel extends GenericDataModel>(ctx: GenericQueryCtx<DataModel>) => Promise<{
19338
19343
  sessionId: DocumentByName<DataModel, "session">["_id"];
19339
19344
  userId: DocumentByName<DataModel, "user">["_id"];
@@ -19360,6 +19365,7 @@ declare const getAuthUserIdentity: <DataModel extends GenericDataModel>(ctx: Gen
19360
19365
  } | null>;
19361
19366
  declare const getAuthUserId: <DataModel extends GenericDataModel>(ctx: GenericQueryCtx<DataModel>) => Promise<string | null>;
19362
19367
  declare function getSession<TCtx extends GenericQueryCtx<any>>(ctx: TCtx & SessionLookupCtx<TCtx>, _sessionId?: SessionDoc<TCtx>['_id']): Promise<SessionResult<TCtx>>;
19368
+ declare const getSessionNetworkSignals: <TCtx extends GenericQueryCtx<any>>(ctx: TCtx & QueryCtxWithPreferredOrmQueryTable<TCtx, "session">, session?: SessionResult<TCtx> | null) => Promise<SessionClientSignals>;
19363
19369
  declare const getHeaders: <TCtx extends GenericQueryCtx<any>>(ctx: TCtx & QueryCtxWithPreferredOrmQueryTable<TCtx, "session">, session?: SessionResult<TCtx> | null) => Promise<Headers>;
19364
19370
  //#endregion
19365
- export { type AuthFunctions, BetterAuthOptionsWithoutDatabase, ConvexCleanedWhere, GeneratedAuthDisabledReasonKind, GenericAuthBeforeResult, GenericAuthDefinition, GenericAuthTriggerChange, GenericAuthTriggerHandlers, GenericAuthTriggers, GetAuth, type Triggers, adapterArgsValidator, adapterConfig, adapterWhereValidator, checkUniqueFields, convex, createApi, createAuthRuntime, createClient, createDisabledAuthRuntime, createHandler, dbAdapter, defineAuth, deleteManyHandler, deleteOneHandler, findManyHandler, findOneHandler, getAuthUserId, getAuthUserIdentity, getGeneratedAuthDisabledReason, getHeaders, getSession, handlePagination, hasUniqueFields, httpAdapter, listOne, paginate, resolveGeneratedAuthDefinition, selectFields, updateManyHandler, updateOneHandler };
19371
+ export { type AuthFunctions, BetterAuthOptionsWithoutDatabase, ConvexCleanedWhere, GeneratedAuthDisabledReasonKind, GenericAuthBeforeResult, GenericAuthDefinition, GenericAuthTriggerChange, GenericAuthTriggerHandlers, GenericAuthTriggers, GetAuth, SessionClientSignals, type Triggers, adapterArgsValidator, adapterConfig, adapterWhereValidator, checkUniqueFields, convex, createApi, createAuthRuntime, createClient, createDisabledAuthRuntime, createHandler, dbAdapter, defineAuth, deleteManyHandler, deleteOneHandler, findManyHandler, findOneHandler, getAuthUserId, getAuthUserIdentity, getGeneratedAuthDisabledReason, getHeaders, getSession, getSessionNetworkSignals, handlePagination, hasUniqueFields, httpAdapter, listOne, paginate, resolveGeneratedAuthDefinition, selectFields, updateManyHandler, updateOneHandler };
@@ -1148,6 +1148,11 @@ const createDisabledAuthRuntime = (config) => {
1148
1148
  //#endregion
1149
1149
  //#region src/auth/helpers.ts
1150
1150
  const SESSION_TOKEN_COOKIE_NAME = "better-auth.session_token";
1151
+ const normalizeSignal = (value) => {
1152
+ if (typeof value !== "string") return;
1153
+ const trimmed = value.trim();
1154
+ return trimmed.length > 0 ? trimmed : void 0;
1155
+ };
1151
1156
  const parseSessionTokenFromCookie = (cookieHeader) => {
1152
1157
  if (!cookieHeader) return null;
1153
1158
  const parts = cookieHeader.split(";");
@@ -1194,6 +1199,16 @@ async function getSession(ctx, _sessionId) {
1194
1199
  if (!sessionId) return null;
1195
1200
  return await getByIdWithOrmQueryFallback(ctx, "session", sessionId);
1196
1201
  }
1202
+ const getSessionNetworkSignals = async (ctx, session) => {
1203
+ const resolvedSession = session ?? await getSession(ctx);
1204
+ if (!resolvedSession) return {};
1205
+ const ip = normalizeSignal(resolvedSession.ipAddress);
1206
+ const userAgent = normalizeSignal(resolvedSession.userAgent);
1207
+ return {
1208
+ ...ip ? { ip } : {},
1209
+ ...userAgent ? { userAgent } : {}
1210
+ };
1211
+ };
1197
1212
  const getHeaders = async (ctx, session) => {
1198
1213
  const resolvedSession = session ?? await getSession(ctx);
1199
1214
  if (!resolvedSession) {
@@ -1208,4 +1223,4 @@ const getHeaders = async (ctx, session) => {
1208
1223
  };
1209
1224
 
1210
1225
  //#endregion
1211
- export { adapterArgsValidator, adapterConfig, adapterWhereValidator, checkUniqueFields, convex, createApi, createAuthRuntime, createClient, createDisabledAuthRuntime, createHandler, dbAdapter, defineAuth, deleteManyHandler, deleteOneHandler, findManyHandler, findOneHandler, getAuthUserId, getAuthUserIdentity, getGeneratedAuthDisabledReason, getHeaders, getSession, handlePagination, hasUniqueFields, httpAdapter, listOne, paginate, resolveGeneratedAuthDefinition, selectFields, updateManyHandler, updateOneHandler };
1226
+ export { adapterArgsValidator, adapterConfig, adapterWhereValidator, checkUniqueFields, convex, createApi, createAuthRuntime, createClient, createDisabledAuthRuntime, createHandler, dbAdapter, defineAuth, deleteManyHandler, deleteOneHandler, findManyHandler, findOneHandler, getAuthUserId, getAuthUserIdentity, getGeneratedAuthDisabledReason, getHeaders, getSession, getSessionNetworkSignals, handlePagination, hasUniqueFields, httpAdapter, listOne, paginate, resolveGeneratedAuthDefinition, selectFields, updateManyHandler, updateOneHandler };
@@ -1,3 +1,4 @@
1
+ import "../../validators-BcQFm1oY.js";
1
2
  import { B as ConvexContext, H as LazyCaller } from "../../procedure-caller-DYjpq7rG.js";
2
3
  import "../../http-types-BK7FuIcR.js";
3
4
  import "../../server/index.js";
@@ -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 CountResult, $r as startsWith, $t as TableRelationalConfig, A as MigrationRunArgs, An as ConvexVectorIndexConfig, Ar as LogicalExpression, At as ConvexCustomBuilderInitial, B as MigrationMigrateOne, Bn as ConvexForeignKeyConfig, Br as ilike, Bt as boolean, C as OrmBeforeResult, Cn as ConvexRankIndexBuilder, Cr as VectorQueryConfig, Ct as ConvexIdBuilderInitial, D as OrmTriggers, Dn as ConvexSearchIndexConfig, Dr as ExpressionVisitor, Dt as ConvexDateMode, E as OrmTriggerContext, En as ConvexSearchIndexBuilderOn, Er as BinaryExpression, Et as ConvexDateBuilderInitial, F as MigrationDirection, Fn as uniqueIndex, Fr as endsWith, Ft as ConvexBytesBuilder, G as MigrationStep, Gn as foreignKey, Gr as like, Gt as CountBackfillKickoffArgs, H as MigrationRunStatus, Hn as ConvexUniqueConstraintBuilderOn, Hr as isFieldReference, Ht as ConvexBigIntBuilderInitial, I as MigrationDoc, In as vectorIndex, Ir as eq, It as ConvexBytesBuilderInitial, J as buildMigrationPlan, Jn as AggregateFieldValue, Jr as ne, Jt as ManyConfig, K as MigrationTableName, Kn as unique, Kr as lt, Kt as CountBackfillStatusArgs, L as MigrationDocContext, Ln as ConvexCheckBuilder, Lr as fieldRef, Lt as bytes, M as MigrationStatusArgs, Mn as index, Mr as and, Mt as custom, N as MigrationAppliedState, Nn as rankIndex, Nr as between, Nt as json, O as defineTriggers, On as ConvexVectorIndexBuilder, Or as FieldReference, Ot as date, P as MigrationDefinition, Pn as searchIndex, Pr as contains, Pt as objectOf, Q as DatabaseWithMutations, Qn as CountConfig, Qr as or, Qt as RelationsBuilderColumnConfig, R as MigrationDriftIssue, Rn as ConvexCheckConfig, Rr as gt, Rt as ConvexBooleanBuilder, S as scheduledDeleteFactory, Sn as ConvexIndexBuilderOn, Sr as UpdateSet, St as ConvexIdBuilder, T as OrmTriggerChange, Tn as ConvexSearchIndexBuilder, Tr as unsetToken, Tt as ConvexDateBuilder, U as MigrationSet, Un as ConvexUniqueConstraintConfig, Ur as isNotNull, Ut as bigint, V as MigrationPlan, Vn as ConvexUniqueConstraintBuilder, Vr as inArray, Vt as ConvexBigIntBuilder, W as MigrationStateMap, Wn as check, Wr as isNull, Wt as CountBackfillChunkArgs, X as defineMigrationSet, Xn as BuildQueryResult, Xr as notBetween, Xt as RelationsBuilder, Y as defineMigration, Yn as AggregateResult, Yr as not, Yt as OneConfig, Z as detectMigrationDrift, Zn as BuildRelationResult, Zr as notInArray, Zt as RelationsBuilderColumnBase, _ as OrmWriterCtx, _i as NotNull, _n as RlsRoleConfig, _r as PaginatedResult, _t as ConvexTextBuilderInitial, a as TableConfigResult, ai as SystemFields, an as ConvexTable, ar as InferSelectModel, at as extractRelationsConfig, b as scheduledMutationBatchFactory, bn as ConvexAggregateIndexBuilderOn, br as ReturningResult, bt as ConvexNumberBuilderInitial, c as OrmNotFoundError, ci as ColumnBuilderBaseConfig, cn as OrmLifecycleOperation, cr as MutationExecuteResult, ct as vector, d as GenericOrmCtx, di as ColumnBuilderWithTableName, dn as deletion, dr as MutationPaginatedResult, dt as ConvexTimestampMode, ei as Brand, en as TablesRelationalConfig, er as DBQueryConfig, et as OrmReader, f as OrmApiResult, fi as ColumnDataType, fn as RlsPolicy, fr as MutationResult, ft as timestamp, g as OrmReaderCtx, gi as IsUnique, gn as RlsRole, gr as OrderDirection, gt as ConvexTextBuilder, h as OrmFunctions, hi as IsPrimaryKey, hn as rlsPolicy, hr as OrderByClause, ht as textEnum, i as desc, ii as TableName, in as ConvexDeletionConfig, ir as InferModelFromColumns, it as EdgeMetadata, j as MigrationRunChunkArgs, jn as aggregateIndex, jr as UnaryExpression, jt as arrayOf, k as MigrationCancelArgs, kn as ConvexVectorIndexBuilderOn, kr as FilterExpression, kt as ConvexCustomBuilder, l as CreateOrmOptions, li as ColumnBuilderRuntimeConfig, ln as TableConfig, lr as MutationExecutionMode, lt as ConvexTimestampBuilder, m as OrmClientWithApi, mi as HasDefault, mn as RlsPolicyToOption, mr as MutationRunMode, mt as ConvexTextEnumBuilderInitial, n as defineSchema, ni as OrmSchemaPlugin, nn as defineRelationsPart, nr as GetColumnData, nt as RlsContext, o as getTableColumns, oi as AnyColumn, or as InsertValue, ot as ConvexVectorBuilder, p as OrmClientBase, pi as DrizzleEntity, pn as RlsPolicyConfig, pr as MutationReturning, pt as ConvexTextEnumBuilder, q as MigrationWriteMode, qn as AggregateConfig, qr as lte, qt as ExtractTablesWithRelations, r as asc, ri as OrmSchemaPluginTables, rn as ConvexDeletionBuilder, rr as InferInsertModel, rt as RlsMode, s as getTableConfig, si as ColumnBuilder, sn as OrmLifecycleChange, sr as MutationExecuteConfig, st as ConvexVectorBuilderInitial, t as WhereClauseResult, ti as Columns, tn as defineRelations, tr as FilterOperators, tt as OrmWriter, u as GenericOrm, ui as ColumnBuilderTypeConfig, un as convexTable, ur as MutationPaginateConfig, ut as ConvexTimestampBuilderInitial, v as createOrm, vn as rlsRole, vr as PredicateWhereIndexConfig, vt as text, w as OrmTableTriggers, wn as ConvexRankIndexBuilderOn, wr as VectorSearchProvider, wt as id, x as ScheduledDeleteArgs, xn as ConvexIndexBuilder, xr as ReturningSelection, xt as integer, y as ScheduledMutationBatchArgs, yn as ConvexAggregateIndexBuilder, yr as ReturningAll, yt as ConvexNumberBuilder, z as MigrationManifestEntry, zn as ConvexForeignKeyBuilder, zr as gte, zt as ConvexBooleanBuilderInitial } from "../where-clause-compiler-BIjTkVVJ.js";
2
+ import { $ as DatabaseWithMutations, $n as CountConfig, $r as or, $t as RelationsBuilderColumnConfig, A as MigrationCancelArgs, An as ConvexVectorIndexBuilderOn, Ar as FilterExpression, At as ConvexCustomBuilder, B as MigrationManifestEntry, Bn as ConvexForeignKeyBuilder, Br as gte, Bt as ConvexBooleanBuilderInitial, C as OrmBeforeResult, Cn as ConvexIndexBuilderOn, Cr as UpdateSet, Ct as ConvexIdBuilder, D as OrmTriggers, Dn as ConvexSearchIndexBuilderOn, Dr as BinaryExpression, Dt as ConvexDateBuilderInitial, E as OrmTriggerContext, En as ConvexSearchIndexBuilder, Er as unsetToken, Et as ConvexDateBuilder, F as MigrationDefinition, Fn as searchIndex, Fr as contains, Ft as objectOf, G as MigrationStateMap, Gn as check, Gr as isNull, Gt as CountBackfillChunkArgs, H as MigrationPlan, Hn as ConvexUniqueConstraintBuilder, Hr as inArray, Ht as ConvexBigIntBuilder, I as MigrationDirection, In as uniqueIndex, Ir as endsWith, It as ConvexBytesBuilder, J as MigrationWriteMode, Jn as AggregateConfig, Jr as lte, Jt as ExtractTablesWithRelations, K as MigrationStep, Kn as foreignKey, Kr as like, Kt as CountBackfillKickoffArgs, L as MigrationDoc, Ln as vectorIndex, Lr as eq, Lt as ConvexBytesBuilderInitial, M as MigrationRunChunkArgs, Mn as aggregateIndex, Mr as UnaryExpression, Mt as arrayOf, N as MigrationStatusArgs, Nn as index, Nr as and, Nt as custom, O as defineTriggers, On as ConvexSearchIndexConfig, Or as ExpressionVisitor, Ot as ConvexDateMode, P as MigrationAppliedState, Pn as rankIndex, Pr as between, Pt as json, Q as detectMigrationDrift, Qn as BuildRelationResult, Qr as notInArray, Qt as RelationsBuilderColumnBase, R as MigrationDocContext, Rn as ConvexCheckBuilder, Rr as fieldRef, Rt as bytes, S as scheduledDeleteFactory, Sn as ConvexIndexBuilder, Sr as ReturningSelection, St as integer, T as OrmTriggerChange, Tn as ConvexRankIndexBuilderOn, Tr as VectorSearchProvider, Tt as id, U as MigrationRunStatus, Un as ConvexUniqueConstraintBuilderOn, Ur as isFieldReference, Ut as ConvexBigIntBuilderInitial, V as MigrationMigrateOne, Vn as ConvexForeignKeyConfig, Vr as ilike, Vt as boolean, W as MigrationSet, Wn as ConvexUniqueConstraintConfig, Wr as isNotNull, Wt as bigint, X as defineMigration, Xn as AggregateResult, Xr as not, Xt as OneConfig, Y as buildMigrationPlan, Yn as AggregateFieldValue, Yr as ne, Yt as ManyConfig, Z as defineMigrationSet, Zn as BuildQueryResult, Zr as notBetween, Zt as RelationsBuilder, _ as OrmWriterCtx, _i as IsUnique, _n as RlsRole, _r as OrderDirection, _t as ConvexTextBuilder, a as TableConfigResult, ai as TableName, an as ConvexDeletionConfig, ar as InferModelFromColumns, at as EdgeMetadata, b as scheduledMutationBatchFactory, bn as ConvexAggregateIndexBuilder, br as ReturningAll, bt as ConvexNumberBuilder, c as OrmNotFoundError, ci as ColumnBuilder, cn as OrmLifecycleChange, cr as MutationExecuteConfig, ct as ConvexVectorBuilderInitial, d as GenericOrmCtx, di as ColumnBuilderTypeConfig, dn as convexTable, dr as MutationPaginateConfig, dt as ConvexTimestampBuilderInitial, ei as startsWith, en as TableRelationalConfig, er as CountResult, et as DatabaseWithQuery, f as OrmApiResult, fi as ColumnBuilderWithTableName, fn as deletion, fr as MutationPaginatedResult, ft as ConvexTimestampMode, g as OrmReaderCtx, gi as IsPrimaryKey, gn as rlsPolicy, gr as OrderByClause, gt as textEnum, h as OrmFunctions, hi as HasDefault, hn as RlsPolicyToOption, hr as MutationRunMode, ht as ConvexTextEnumBuilderInitial, i as desc, ii as OrmSchemaPluginTables, in as ConvexDeletionBuilder, ir as InferInsertModel, it as RlsMode, j as MigrationRunArgs, jn as ConvexVectorIndexConfig, jr as LogicalExpression, jt as ConvexCustomBuilderInitial, kn as ConvexVectorIndexBuilder, kr as FieldReference, kt as date, l as CreateOrmOptions, li as ColumnBuilderBaseConfig, ln as OrmLifecycleOperation, lr as MutationExecuteResult, lt as vector, m as OrmClientWithApi, mi as DrizzleEntity, mn as RlsPolicyConfig, mr as MutationReturning, mt as ConvexTextEnumBuilder, n as defineSchema, ni as Columns, nn as defineRelations, nr as FilterOperators, nt as OrmWriter, o as getTableColumns, oi as SystemFields, on as ConvexTable, or as InferSelectModel, ot as extractRelationsConfig, p as OrmClientBase, pi as ColumnDataType, pn as RlsPolicy, pr as MutationResult, pt as timestamp, q as MigrationTableName, qn as unique, qr as lt, qt as CountBackfillStatusArgs, r as asc, ri as OrmSchemaPlugin, rn as defineRelationsPart, rr as GetColumnData, rt as RlsContext, s as getTableConfig, si as AnyColumn, sr as InsertValue, st as ConvexVectorBuilder, t as WhereClauseResult, ti as Brand, tn as TablesRelationalConfig, tr as DBQueryConfig, tt as OrmReader, u as GenericOrm, ui as ColumnBuilderRuntimeConfig, un as TableConfig, ur as MutationExecutionMode, ut as ConvexTimestampBuilder, v as createOrm, vi as NotNull, vn as RlsRoleConfig, vr as PaginatedResult, vt as ConvexTextBuilderInitial, w as OrmTableTriggers, wn as ConvexRankIndexBuilder, wr as VectorQueryConfig, wt as ConvexIdBuilderInitial, x as ScheduledDeleteArgs, xn as ConvexAggregateIndexBuilderOn, xr as ReturningResult, xt as ConvexNumberBuilderInitial, y as ScheduledMutationBatchArgs, yn as rlsRole, yr as PredicateWhereIndexConfig, yt as text, z as MigrationDriftIssue, zn as ConvexCheckConfig, zr as gt, zt as ConvexBooleanBuilder } from "../where-clause-compiler-m-GQNB_K.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 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, 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 };
package/dist/orm/index.js CHANGED
@@ -4815,10 +4815,85 @@ var GelRelationalQuery = class extends QueryPromise {
4815
4815
  if (hasFilterWith) this._stripFilterRelations(filtered, filterWith, requestedWith);
4816
4816
  return filtered;
4817
4817
  }
4818
+ _resolvePolymorphicFinalizeState() {
4819
+ const rawPolymorphic = this.config.polymorphic;
4820
+ if (rawPolymorphic === void 0) return null;
4821
+ if (!this._isRecord(rawPolymorphic)) throw new Error("polymorphic must be an object.");
4822
+ const discriminator = rawPolymorphic.discriminator;
4823
+ if (typeof discriminator !== "string" || discriminator.length === 0) throw new Error("polymorphic.discriminator must be a non-empty string.");
4824
+ const aliasRaw = rawPolymorphic.as;
4825
+ const alias = aliasRaw === void 0 ? "target" : typeof aliasRaw === "string" && aliasRaw.length > 0 ? aliasRaw : null;
4826
+ if (!alias) throw new Error("polymorphic.as must be a non-empty string when set.");
4827
+ const schema = rawPolymorphic.schema;
4828
+ if (!schema || typeof schema.safeParse !== "function" && typeof schema.parse !== "function") throw new Error("polymorphic.schema must provide safeParse() or parse().");
4829
+ const rawCases = rawPolymorphic.cases;
4830
+ if (!this._isRecord(rawCases) || Object.keys(rawCases).length === 0) throw new Error("polymorphic.cases must be a non-empty object of discriminator-to-relation mappings.");
4831
+ const cases = {};
4832
+ for (const [caseKey, caseRelation] of Object.entries(rawCases)) {
4833
+ if (typeof caseRelation !== "string" || caseRelation.length === 0) throw new Error(`polymorphic.cases.${caseKey} must be a relation name string.`);
4834
+ const relation = this.tableConfig.relations[caseRelation];
4835
+ if (!relation) throw new Error(`polymorphic.cases.${caseKey} references unknown relation '${caseRelation}' on '${this.tableConfig.name}'.`);
4836
+ if (relation.relationType !== "one") throw new Error(`polymorphic.cases.${caseKey} must map to a one() relation; received '${caseRelation}'.`);
4837
+ cases[caseKey] = caseRelation;
4838
+ }
4839
+ const requestedWith = this.config.with;
4840
+ const effectiveWith = requestedWith ? { ...requestedWith } : {};
4841
+ const autoLoadedCaseRelations = /* @__PURE__ */ new Set();
4842
+ for (const relationName of new Set(Object.values(cases))) if (effectiveWith[relationName] === void 0) {
4843
+ effectiveWith[relationName] = true;
4844
+ autoLoadedCaseRelations.add(relationName);
4845
+ }
4846
+ return {
4847
+ requestedWith,
4848
+ effectiveWith: Object.keys(effectiveWith).length ? effectiveWith : void 0,
4849
+ autoLoadedCaseRelations,
4850
+ discriminator,
4851
+ alias,
4852
+ cases,
4853
+ schema
4854
+ };
4855
+ }
4856
+ _extractPolymorphicSchemaErrorMessage(error) {
4857
+ if (!error || typeof error !== "object") return String(error);
4858
+ const issueMessage = error.issues?.[0]?.message;
4859
+ if (issueMessage) return issueMessage;
4860
+ return error.message ?? String(error);
4861
+ }
4862
+ _synthesizePolymorphicRows(rows, config) {
4863
+ for (const row of rows) {
4864
+ const discriminatorValue = row[config.discriminator];
4865
+ const caseKey = String(discriminatorValue);
4866
+ const relationName = config.cases[caseKey];
4867
+ if (!relationName) throw new Error(`polymorphic discriminator '${config.discriminator}' value '${caseKey}' has no matching case mapping.`);
4868
+ const targetValue = row[relationName];
4869
+ if (targetValue === null || targetValue === void 0) throw new Error(`polymorphic case '${caseKey}' resolved relation '${relationName}' but no target row was loaded.`);
4870
+ row[config.alias] = targetValue;
4871
+ const payload = {
4872
+ [config.discriminator]: discriminatorValue,
4873
+ [config.alias]: targetValue
4874
+ };
4875
+ if (typeof config.schema.safeParse === "function") {
4876
+ const result = config.schema.safeParse(payload);
4877
+ if (!result.success) throw new Error(`polymorphic schema parse failed: ${this._extractPolymorphicSchemaErrorMessage(result.error)}`);
4878
+ } else if (typeof config.schema.parse === "function") try {
4879
+ config.schema.parse(payload);
4880
+ } catch (error) {
4881
+ throw new Error(`polymorphic schema parse failed: ${this._extractPolymorphicSchemaErrorMessage(error)}`);
4882
+ }
4883
+ }
4884
+ for (const relationName of config.autoLoadedCaseRelations) {
4885
+ if (relationName === config.alias) continue;
4886
+ for (const row of rows) delete row[relationName];
4887
+ }
4888
+ }
4818
4889
  async _finalizeRows(rows) {
4890
+ const polymorphicState = this._resolvePolymorphicFinalizeState();
4891
+ const requestedWith = polymorphicState?.requestedWith ?? this.config.with;
4892
+ const effectiveWith = polymorphicState?.effectiveWith ?? this.config.with;
4819
4893
  let rowsWithRelations = rows;
4820
- if (this.config.with) rowsWithRelations = await this._loadRelations(rowsWithRelations, this.config.with, 0, 3, this.edgeMetadata, this.tableConfig);
4821
- if (this.config.extras) rowsWithRelations = this._applyExtras(rowsWithRelations, this.config.extras, this._getColumns(this.tableConfig), this.config.with, this.tableConfig.name, this.tableConfig);
4894
+ if (effectiveWith) rowsWithRelations = await this._loadRelations(rowsWithRelations, effectiveWith, 0, 3, this.edgeMetadata, this.tableConfig);
4895
+ if (polymorphicState) this._synthesizePolymorphicRows(rowsWithRelations, polymorphicState);
4896
+ if (this.config.extras) rowsWithRelations = this._applyExtras(rowsWithRelations, this.config.extras, this._getColumns(this.tableConfig), requestedWith, this.tableConfig.name, this.tableConfig);
4822
4897
  return this._selectColumns(rowsWithRelations, this.config.columns, this._getColumns(this.tableConfig), this.tableConfig);
4823
4898
  }
4824
4899
  _getSchemaDefinitionOrThrow() {
@@ -5961,6 +6036,7 @@ var GelRelationalQuery = class extends QueryPromise {
5961
6036
  if (config.with !== void 0) throw new Error("pipeline cannot be combined with with in findMany().");
5962
6037
  if (config.extras !== void 0) throw new Error("pipeline cannot be combined with extras in findMany().");
5963
6038
  if (config.columns !== void 0) throw new Error("pipeline cannot be combined with columns in findMany().");
6039
+ if (config.polymorphic !== void 0) throw new Error("pipeline cannot be combined with polymorphic in findMany().");
5964
6040
  }
5965
6041
  if (pageByKey) {
5966
6042
  if (this.mode !== "many") throw new Error("pageByKey is only supported on findMany().");
@@ -6191,11 +6267,8 @@ var GelRelationalQuery = class extends QueryPromise {
6191
6267
  let pageRows = paginationResult.page;
6192
6268
  pageRows = await this._applyRlsSelectFilter(pageRows, this.tableConfig);
6193
6269
  if (whereFilter) pageRows = await this._applyRelationsFilterToRows(pageRows, this.tableConfig, whereFilter, this.edgeMetadata, 0, 3, this.config.with);
6194
- let pageWithRelations = pageRows;
6195
- if (this.config.with) pageWithRelations = await this._loadRelations(pageWithRelations, this.config.with, 0, 3, this.edgeMetadata, this.tableConfig);
6196
- if (this.config.extras) pageWithRelations = this._applyExtras(pageWithRelations, this.config.extras, this._getColumns(this.tableConfig), this.config.with, this.tableConfig.name, this.tableConfig);
6197
6270
  return {
6198
- page: this._selectColumns(pageWithRelations, this.config.columns, this._getColumns(this.tableConfig), this.tableConfig),
6271
+ page: await this._finalizeRows(pageRows),
6199
6272
  continueCursor: paginationResult.continueCursor,
6200
6273
  isDone: paginationResult.isDone,
6201
6274
  pageStatus: paginationResult.pageStatus,
@@ -6215,10 +6288,7 @@ var GelRelationalQuery = class extends QueryPromise {
6215
6288
  if (offset > 0) rows = rows.slice(offset);
6216
6289
  if (limit !== void 0) rows = rows.slice(0, limit);
6217
6290
  }
6218
- let rowsWithRelations = rows;
6219
- if (this.config.with) rowsWithRelations = await this._loadRelations(rowsWithRelations, this.config.with, 0, 3, this.edgeMetadata, this.tableConfig);
6220
- if (this.config.extras) rowsWithRelations = this._applyExtras(rowsWithRelations, this.config.extras, this._getColumns(this.tableConfig), this.config.with, this.tableConfig.name, this.tableConfig);
6221
- const selectedRows = this._selectColumns(rowsWithRelations, this.config.columns, this._getColumns(this.tableConfig), this.tableConfig);
6291
+ const selectedRows = await this._finalizeRows(rows);
6222
6292
  return this._returnSelectedRows(selectedRows);
6223
6293
  }
6224
6294
  if (queryConfig.strategy === "multiProbe" && queryConfig.index && !isCursorPaginated) {
@@ -6248,10 +6318,7 @@ var GelRelationalQuery = class extends QueryPromise {
6248
6318
  const limit = this._resolveNonPaginatedLimit(config);
6249
6319
  if (offset > 0) rows = rows.slice(offset);
6250
6320
  if (limit !== void 0) rows = rows.slice(0, limit);
6251
- let rowsWithRelations = rows;
6252
- if (this.config.with) rowsWithRelations = await this._loadRelations(rowsWithRelations, this.config.with, 0, 3, this.edgeMetadata, this.tableConfig);
6253
- if (this.config.extras) rowsWithRelations = this._applyExtras(rowsWithRelations, this.config.extras, this._getColumns(this.tableConfig), this.config.with, this.tableConfig.name, this.tableConfig);
6254
- const selectedRows = this._selectColumns(rowsWithRelations, this.config.columns, this._getColumns(this.tableConfig), this.tableConfig);
6321
+ const selectedRows = await this._finalizeRows(rows);
6255
6322
  return this._returnSelectedRows(selectedRows);
6256
6323
  }
6257
6324
  if (isCursorPaginated) {
@@ -6279,11 +6346,8 @@ var GelRelationalQuery = class extends QueryPromise {
6279
6346
  let pageRows = paginationResult.page;
6280
6347
  pageRows = await this._applyRlsSelectFilter(pageRows, this.tableConfig);
6281
6348
  if (whereFilter) pageRows = await this._applyRelationsFilterToRows(pageRows, this.tableConfig, whereFilter, this.edgeMetadata, 0, 3, this.config.with);
6282
- let pageWithRelations = pageRows;
6283
- if (this.config.with) pageWithRelations = await this._loadRelations(pageWithRelations, this.config.with, 0, 3, this.edgeMetadata, this.tableConfig);
6284
- if (this.config.extras) pageWithRelations = this._applyExtras(pageWithRelations, this.config.extras, this._getColumns(this.tableConfig), this.config.with, this.tableConfig.name, this.tableConfig);
6285
6349
  return {
6286
- page: this._selectColumns(pageWithRelations, this.config.columns, this._getColumns(this.tableConfig), this.tableConfig),
6350
+ page: await this._finalizeRows(pageRows),
6287
6351
  continueCursor: paginationResult.continueCursor,
6288
6352
  isDone: paginationResult.isDone,
6289
6353
  pageStatus: paginationResult.pageStatus,
@@ -6313,11 +6377,8 @@ var GelRelationalQuery = class extends QueryPromise {
6313
6377
  let pageRows = paginationResult.page;
6314
6378
  pageRows = await this._applyRlsSelectFilter(pageRows, this.tableConfig);
6315
6379
  if (whereFilter) pageRows = await this._applyRelationsFilterToRows(pageRows, this.tableConfig, whereFilter, this.edgeMetadata, 0, 3, this.config.with);
6316
- let pageWithRelations = pageRows;
6317
- if (this.config.with) pageWithRelations = await this._loadRelations(pageWithRelations, this.config.with, 0, 3, this.edgeMetadata, this.tableConfig);
6318
- if (this.config.extras) pageWithRelations = this._applyExtras(pageWithRelations, this.config.extras, this._getColumns(this.tableConfig), this.config.with, this.tableConfig.name, this.tableConfig);
6319
6380
  return {
6320
- page: this._selectColumns(pageWithRelations, this.config.columns, this._getColumns(this.tableConfig), this.tableConfig),
6381
+ page: await this._finalizeRows(pageRows),
6321
6382
  continueCursor: paginationResult.continueCursor,
6322
6383
  isDone: paginationResult.isDone,
6323
6384
  pageStatus: paginationResult.pageStatus,
@@ -6347,11 +6408,8 @@ var GelRelationalQuery = class extends QueryPromise {
6347
6408
  let pageRows = paginationResult.page;
6348
6409
  pageRows = await this._applyRlsSelectFilter(pageRows, this.tableConfig);
6349
6410
  if (whereFilter) pageRows = await this._applyRelationsFilterToRows(pageRows, this.tableConfig, whereFilter, this.edgeMetadata, 0, 3, this.config.with);
6350
- let pageWithRelations = pageRows;
6351
- if (this.config.with) pageWithRelations = await this._loadRelations(pageWithRelations, this.config.with, 0, 3, this.edgeMetadata, this.tableConfig);
6352
- if (this.config.extras) pageWithRelations = this._applyExtras(pageWithRelations, this.config.extras, this._getColumns(this.tableConfig), this.config.with, this.tableConfig.name, this.tableConfig);
6353
6411
  return {
6354
- page: this._selectColumns(pageWithRelations, this.config.columns, this._getColumns(this.tableConfig), this.tableConfig),
6412
+ page: await this._finalizeRows(pageRows),
6355
6413
  continueCursor: paginationResult.continueCursor,
6356
6414
  isDone: paginationResult.isDone
6357
6415
  };
@@ -6378,10 +6436,7 @@ var GelRelationalQuery = class extends QueryPromise {
6378
6436
  if (offset > 0) rows = rows.slice(offset);
6379
6437
  if (limit !== void 0) rows = rows.slice(0, limit);
6380
6438
  }
6381
- let rowsWithRelations = rows;
6382
- if (this.config.with) rowsWithRelations = await this._loadRelations(rowsWithRelations, this.config.with, 0, 3, this.edgeMetadata, this.tableConfig);
6383
- if (this.config.extras) rowsWithRelations = this._applyExtras(rowsWithRelations, this.config.extras, this._getColumns(this.tableConfig), this.config.with, this.tableConfig.name, this.tableConfig);
6384
- const selectedRows = this._selectColumns(rowsWithRelations, this.config.columns, this._getColumns(this.tableConfig), this.tableConfig);
6439
+ const selectedRows = await this._finalizeRows(rows);
6385
6440
  return this._returnSelectedRows(selectedRows);
6386
6441
  }
6387
6442
  /**
@@ -8210,18 +8265,27 @@ var RelationalQueryBuilder = class RelationalQueryBuilder {
8210
8265
  return new GelRankQuery(this.db, this.tableConfig, indexName, config, this.rls);
8211
8266
  }
8212
8267
  findMany(config) {
8213
- if (config && config.pipeline !== void 0) throw new Error("findMany({ pipeline }) is removed; use db.query.<table>.select() chain instead");
8268
+ if (config && config.pipeline !== void 0) {
8269
+ if (config.polymorphic !== void 0) throw new Error("polymorphic cannot be combined with pipeline in findMany().");
8270
+ throw new Error("findMany({ pipeline }) is removed; use db.query.<table>.select() chain instead");
8271
+ }
8214
8272
  return this.createQuery(config ? config : {}, "many");
8215
8273
  }
8216
8274
  findFirst(config) {
8217
- if (config && config.pipeline !== void 0) throw new Error("findMany({ pipeline }) is removed; use db.query.<table>.select() chain instead");
8275
+ if (config && config.pipeline !== void 0) {
8276
+ if (config.polymorphic !== void 0) throw new Error("polymorphic cannot be combined with pipeline in findFirst().");
8277
+ throw new Error("findMany({ pipeline }) is removed; use db.query.<table>.select() chain instead");
8278
+ }
8218
8279
  return this.createQuery({
8219
8280
  ...config ? config : {},
8220
8281
  limit: 1
8221
8282
  }, "first");
8222
8283
  }
8223
8284
  findFirstOrThrow(config) {
8224
- if (config && config.pipeline !== void 0) throw new Error("findMany({ pipeline }) is removed; use db.query.<table>.select() chain instead");
8285
+ if (config && config.pipeline !== void 0) {
8286
+ if (config.polymorphic !== void 0) throw new Error("polymorphic cannot be combined with pipeline in findFirstOrThrow().");
8287
+ throw new Error("findMany({ pipeline }) is removed; use db.query.<table>.select() chain instead");
8288
+ }
8225
8289
  return this.createQuery({
8226
8290
  ...config ? config : {},
8227
8291
  limit: 1
@@ -1,8 +1,8 @@
1
- import { ni as OrmSchemaPlugin } from "../where-clause-compiler-BIjTkVVJ.js";
1
+ import "../validators-BcQFm1oY.js";
2
+ import { k as migrationPlugin, ri as OrmSchemaPlugin } from "../where-clause-compiler-m-GQNB_K.js";
3
+ import "../query-context-ji7By8u0.js";
4
+ import "../orm/index.js";
2
5
 
3
- //#region src/orm/migrations/schema.d.ts
4
- declare function migrationPlugin(): OrmSchemaPlugin;
5
- //#endregion
6
6
  //#region src/orm/aggregate-index/schema.d.ts
7
7
  declare function aggregatePlugin(): OrmSchemaPlugin;
8
8
  //#endregion
@@ -1,4 +1,7 @@
1
- import { ni as OrmSchemaPlugin } from "../../where-clause-compiler-BIjTkVVJ.js";
1
+ import "../../validators-BcQFm1oY.js";
2
+ import { ri as OrmSchemaPlugin } from "../../where-clause-compiler-m-GQNB_K.js";
3
+ import "../../query-context-ji7By8u0.js";
4
+ import "../../orm/index.js";
2
5
  import * as convex_server0 from "convex/server";
3
6
 
4
7
  //#region src/plugins/ratelimit/duration.d.ts
@@ -1,3 +1,4 @@
1
+ import "../validators-BcQFm1oY.js";
1
2
  import { $ as QueryProcedureBuilder, A as GenericCtx, B as ConvexContext, C as CRPC_ERROR_CODE_TO_HTTP, Ct as zodToConvex, D as toCRPCError, E as isCRPCError, F as isRunMutationCtx, G as CallerOpts, H as LazyCaller, I as requireActionCtx, J as createApiLeaf, K as ServerCaller, L as requireMutationCtx, M as isActionCtx, N as isMutationCtx, O as CreateEnvOptions, P as isQueryCtx, Q as ProcedureBuilder, R as requireQueryCtx, S as CRPC_ERROR_CODES_BY_KEY, St as zodOutputToConvexFields, T as getHTTPStatusCodeFromError, U as createLazyCaller, V as createCallerFactory, W as CallerMeta, X as CRPCFunctionTypeHint, Y as ActionProcedureBuilder, Z as MutationProcedureBuilder, _ as WithHttpRouter, _t as zCustomAction, a as ProcedureCaller, at as handleHttpError, b as CRPCError, bt as zid, c as ProcedureFromFunctionReference, ct as ConvexValidatorFromZodOutput, d as createGenericCallerFactory, dt as Zid, et as createMiddlewareFactory, f as createGenericHandlerFactory, ft as ZodFromValidatorBase, g as typedProcedureResolver, gt as withSystemFields, h as defineProcedure, ht as convexToZodFields, i as ProcedureActionCallerFromRegistry, it as extractPathParams, j as RunMutationCtx, k as createEnv, l as ProcedureSchedulableCallerFromRegistry, lt as CustomBuilder, m as createProcedureHandlerFactory, mt as convexToZod, n as GeneratedProcedureRegistry, nt as HttpProcedureBuilder, o as ProcedureCallerFromRegistry, ot as matchPathParams, p as createProcedureCallerFactory, pt as ZodValidatorFromConvex, q as createServerCaller, r as GeneratedProcedureRegistryEntry, rt as createHttpProcedureBuilder, s as ProcedureDefinition, st as ConvexValidatorFromZod, t as CreateProcedureCallerFactoryOptions, tt as initCRPC, u as ProcedureScheduleCallerFromRegistry, ut as ZCustomCtx, v as inferApiInputs, vt as zCustomMutation, w as getCRPCErrorFromUnknown, wt as zodToConvexFields, x as CRPCErrorCode, xt as zodOutputToConvex, y as inferApiOutputs, yt as zCustomQuery, z as requireRunMutationCtx } from "../procedure-caller-DYjpq7rG.js";
2
3
  import { A as GetRawInputFn, B as Simplify, C as HttpProcedure, D as ProcedureMeta, E as InferHttpInput, F as MiddlewareMarker, I as MiddlewareNext, L as MiddlewareResult, M as MergeZodObjects, N as MiddlewareBuilder, O as AnyMiddleware, P as MiddlewareFunction, R as Overwrite, S as HttpMethod, T as HttpRouteDefinition, V as UnsetMarker, _ as extractRouteMap, b as HttpActionHandler, d as CRPCHttpRouter, f as HttpRouterDef, g as createHttpRouterFactory, h as createHttpRouter, j as IntersectIfDefined, k as AnyMiddlewareBuilder, m as HttpRouterWithHono, p as HttpRouterRecord, v as CRPCHonoHandler, w as HttpProcedureBuilderDef, x as HttpHandlerOpts, y as HttpActionConstructor, z as ResolveIfSet } from "../http-types-BK7FuIcR.js";
3
4
  export { ActionProcedureBuilder, AnyMiddleware, AnyMiddlewareBuilder, CRPCError, CRPCErrorCode, CRPCFunctionTypeHint, CRPCHonoHandler, CRPCHttpRouter, CRPC_ERROR_CODES_BY_KEY, CRPC_ERROR_CODE_TO_HTTP, CallerMeta, CallerOpts, ConvexContext, ConvexValidatorFromZod, ConvexValidatorFromZodOutput, CreateEnvOptions, CreateProcedureCallerFactoryOptions, CustomBuilder, GeneratedProcedureRegistry, GeneratedProcedureRegistryEntry, GenericCtx, GetRawInputFn, HttpActionConstructor, HttpActionHandler, HttpHandlerOpts, HttpMethod, HttpProcedure, HttpProcedureBuilder, HttpProcedureBuilderDef, HttpRouteDefinition, HttpRouterDef, HttpRouterRecord, HttpRouterWithHono, InferHttpInput, IntersectIfDefined, LazyCaller, MergeZodObjects, MiddlewareBuilder, MiddlewareFunction, MiddlewareMarker, MiddlewareNext, MiddlewareResult, MutationProcedureBuilder, Overwrite, ProcedureActionCallerFromRegistry, ProcedureBuilder, ProcedureCaller, ProcedureCallerFromRegistry, ProcedureDefinition, ProcedureFromFunctionReference, ProcedureMeta, ProcedureSchedulableCallerFromRegistry, ProcedureScheduleCallerFromRegistry, QueryProcedureBuilder, ResolveIfSet, RunMutationCtx, ServerCaller, Simplify, UnsetMarker, WithHttpRouter, ZCustomCtx, Zid, ZodFromValidatorBase, ZodValidatorFromConvex, convexToZod, convexToZodFields, createApiLeaf, createCallerFactory, createEnv, createGenericCallerFactory, createGenericHandlerFactory, createHttpProcedureBuilder, createHttpRouter, createHttpRouterFactory, createLazyCaller, createMiddlewareFactory, createProcedureCallerFactory, createProcedureHandlerFactory, createServerCaller, defineProcedure, extractPathParams, extractRouteMap, getCRPCErrorFromUnknown, getHTTPStatusCodeFromError, handleHttpError, inferApiInputs, inferApiOutputs, initCRPC, isActionCtx, isCRPCError, isMutationCtx, isQueryCtx, isRunMutationCtx, matchPathParams, requireActionCtx, requireMutationCtx, requireQueryCtx, requireRunMutationCtx, toCRPCError, typedProcedureResolver, withSystemFields, zCustomAction, zCustomMutation, zCustomQuery, zid, zodOutputToConvex, zodOutputToConvexFields, zodToConvex, zodToConvexFields };
@@ -2024,12 +2024,19 @@ function isProcedureType(value) {
2024
2024
  function isProcedureDefinition(value) {
2025
2025
  return isRecord(value) && isProcedureType(value._type);
2026
2026
  }
2027
+ function getProcedureTypeFromExport(value) {
2028
+ const crpcType = value._crpcMeta?.type;
2029
+ if (isProcedureType(crpcType)) return crpcType;
2030
+ if (value.isQuery === true) return "query";
2031
+ if (value.isMutation === true) return "mutation";
2032
+ if (value.isAction === true) return "action";
2033
+ return null;
2034
+ }
2027
2035
  function isProcedureExport(value) {
2028
2036
  if (value === null || typeof value !== "object" && typeof value !== "function") return false;
2029
2037
  const exportValue = value;
2030
2038
  if (typeof exportValue._handler !== "function") return false;
2031
- const type = exportValue._crpcMeta?.type;
2032
- return isProcedureType(type);
2039
+ return getProcedureTypeFromExport(exportValue) !== null;
2033
2040
  }
2034
2041
  function decodeProcedureResult(procedure, value) {
2035
2042
  return decodeWire(value, procedure.__betterConvexTransformer);
@@ -2093,7 +2100,8 @@ function createRecursiveProxy(path, ctx, opts, mode) {
2093
2100
  assertCanInvoke(getContextType(ctx), node._type, pathString);
2094
2101
  const resolved = await opts.resolver(path);
2095
2102
  if (!isProcedureExport(resolved)) throw new Error(`[better-convex] Resolved value is not a cRPC procedure: "${pathString}".`);
2096
- if (resolved._crpcMeta?.type !== node._type) throw new Error(`[better-convex] Procedure type mismatch at "${pathString}". Expected "${node._type}" but got "${resolved._crpcMeta?.type ?? "unknown"}".`);
2103
+ const resolvedType = getProcedureTypeFromExport(resolved);
2104
+ if (resolvedType !== node._type) throw new Error(`[better-convex] Procedure type mismatch at "${pathString}". Expected "${node._type}" but got "${resolvedType ?? "unknown"}".`);
2097
2105
  return executeProcedure(resolved, mode, pathString, ctx, argsList[0] ?? {});
2098
2106
  }
2099
2107
  });
@@ -2164,7 +2172,8 @@ function createActionsRegistryProxy(path, ctx, registry) {
2164
2172
  const procedure = isProcedureExport(resolved) ? resolved : null;
2165
2173
  const canDispatchDirectly = !!getResolverFunctionReference(resolveProcedure);
2166
2174
  if (!procedure && !canDispatchDirectly) throw new Error(`[better-convex] Resolved value is not a cRPC procedure: "${pathString}".`);
2167
- if (procedure && procedure._crpcMeta?.type !== procedureType) throw new Error(`[better-convex] Procedure type mismatch at "${pathString}". Expected "${procedureType}" but got "${procedure._crpcMeta?.type ?? "unknown"}".`);
2175
+ const resolvedType = procedure ? getProcedureTypeFromExport(procedure) : null;
2176
+ if (procedure && resolvedType !== procedureType) throw new Error(`[better-convex] Procedure type mismatch at "${pathString}". Expected "${procedureType}" but got "${resolvedType ?? "unknown"}".`);
2168
2177
  return executeActionContextActionProcedure(ctx, procedure, pathString, resolveProcedure, argsList[0] ?? {});
2169
2178
  }
2170
2179
  });
@@ -2191,7 +2200,8 @@ function createScheduledRegistryProxy(path, ctx, registry, mode) {
2191
2200
  const procedure = isProcedureExport(resolved) ? resolved : null;
2192
2201
  const canDispatchDirectly = !!getResolverFunctionReference(resolveProcedure);
2193
2202
  if (!procedure && !canDispatchDirectly) throw new Error(`[better-convex] Resolved value is not a cRPC procedure: "${pathString}".`);
2194
- if (procedure && procedure._crpcMeta?.type !== procedureType) throw new Error(`[better-convex] Procedure type mismatch at "${pathString}". Expected "${procedureType}" but got "${procedure._crpcMeta?.type ?? "unknown"}".`);
2203
+ const resolvedType = procedure ? getProcedureTypeFromExport(procedure) : null;
2204
+ if (procedure && resolvedType !== procedureType) throw new Error(`[better-convex] Procedure type mismatch at "${pathString}". Expected "${procedureType}" but got "${resolvedType ?? "unknown"}".`);
2195
2205
  return executeScheduledProcedure(ctx, mode, procedure, pathString, resolveProcedure, argsList[0] ?? {});
2196
2206
  }
2197
2207
  });
@@ -2241,7 +2251,8 @@ function createRegistryProxy(path, ctx, registry, mode, supportsActionContext) {
2241
2251
  const procedure = isProcedureExport(resolved) ? resolved : null;
2242
2252
  const canDispatchDirectly = mode === "caller" && ctxType === "action" && !!getResolverFunctionReference(resolveProcedure);
2243
2253
  if (!procedure && !canDispatchDirectly) throw new Error(`[better-convex] Resolved value is not a cRPC procedure: "${pathString}".`);
2244
- if (procedure && procedure._crpcMeta?.type !== procedureType) throw new Error(`[better-convex] Procedure type mismatch at "${pathString}". Expected "${procedureType}" but got "${procedure._crpcMeta?.type ?? "unknown"}".`);
2254
+ const resolvedType = procedure ? getProcedureTypeFromExport(procedure) : null;
2255
+ if (procedure && resolvedType !== procedureType) throw new Error(`[better-convex] Procedure type mismatch at "${pathString}". Expected "${procedureType}" but got "${resolvedType ?? "unknown"}".`);
2245
2256
  const input = argsList[0] ?? {};
2246
2257
  if (ctxType === "action" && mode === "caller") {
2247
2258
  if (procedureType === "action") throw new Error(`[better-convex] Cannot call action procedures from action context: "${pathString}".`);
@@ -2,6 +2,7 @@ import { a as ReturnTypeOrValue, i as KnownKeysOnly, o as Simplify, t as Assume
2
2
  import * as convex_values0 from "convex/values";
3
3
  import { GenericId, Validator, Value } from "convex/values";
4
4
  import { DefineSchemaOptions, FilterExpression, GenericDatabaseReader, GenericDatabaseWriter, GenericIndexFields, GenericSchema, GenericTableIndexes, GenericTableSearchIndexes, GenericTableVectorIndexes, IndexRange, IndexRangeBuilder, SchedulableFunctionReference, Scheduler, SchemaDefinition, TableDefinition, VectorFilterBuilder, internalActionGeneric, internalMutationGeneric } from "convex/server";
5
+ import { z } from "zod";
5
6
 
6
7
  //#region src/orm/builders/column-builder.d.ts
7
8
  /**
@@ -753,6 +754,16 @@ type AggregateNoScanWhere<TTableConfig extends TableRelationalConfig = TableRela
753
754
  OR?: AggregateNoScanWhereBase<TTableConfig>[] | undefined;
754
755
  }>;
755
756
  type AggregateNoScanWhereArg<TTableConfig extends TableRelationalConfig = TableRelationalConfig> = [AggregateWhereFieldName<TTableConfig>] extends [never] ? never : AggregateNoScanWhere<TTableConfig>;
757
+ type OneRelationName<TTableConfig extends TableRelationalConfig = TableRelationalConfig> = Extract<{ [K in keyof TTableConfig['relations']]: TTableConfig['relations'][K] extends One<any, any> ? K : never }[keyof TTableConfig['relations']], string>;
758
+ type PolymorphicZodSchema$1 = z.ZodDiscriminatedUnion<any, any>;
759
+ type PolymorphicDiscriminatorFromSchema$1<TSchema extends PolymorphicZodSchema$1 = PolymorphicZodSchema$1> = TSchema extends z.ZodDiscriminatedUnion<any, infer TDisc extends string> ? TDisc : string;
760
+ type PolymorphicCaseLiteralFromSchema$1<TSchema extends PolymorphicZodSchema$1 = PolymorphicZodSchema$1, TDiscriminator extends string = string> = Extract<z.output<TSchema> extends Record<TDiscriminator, infer TValue> ? TValue : never, string>;
761
+ type PolymorphicQueryConfig<TTableConfig extends TableRelationalConfig = TableRelationalConfig, TSchema extends PolymorphicZodSchema$1 = PolymorphicZodSchema$1, TDiscriminator extends string = PolymorphicDiscriminatorFromSchema$1<TSchema>> = {
762
+ schema: TSchema;
763
+ discriminator: TDiscriminator;
764
+ cases: Record<PolymorphicCaseLiteralFromSchema$1<TSchema, TDiscriminator>, OneRelationName<TTableConfig>>;
765
+ as?: string | undefined;
766
+ };
756
767
  /**
757
768
  * Query configuration for findMany/findFirst
758
769
  *
@@ -818,6 +829,10 @@ type DBQueryConfig<TRelationType extends 'one' | 'many' = 'one' | 'many', _TIsRo
818
829
  * Stream-backed advanced query pipeline.
819
830
  */
820
831
  pipeline?: _TIsRoot extends true ? FindManyPipelineConfig<TSchema, TTableConfig> : never;
832
+ /**
833
+ * Synthesize a discriminated-union relation field from one() cases.
834
+ */
835
+ polymorphic?: PolymorphicQueryConfig<TTableConfig> | undefined;
821
836
  /**
822
837
  * Key-based page boundaries.
823
838
  */
@@ -1151,6 +1166,10 @@ type PaginatedResult<T> = {
1151
1166
  splitCursor?: string;
1152
1167
  };
1153
1168
  type BuildQueryResult<TSchema extends TablesRelationalConfig, TTableConfig extends TableRelationalConfig, TFullSelection> = Equal<TFullSelection, true> extends true ? InferModelFromColumns<TableColumns<TTableConfig>> : TFullSelection extends Record<string, unknown> ? Simplify<InferRelationalQueryTableResult<InferModelFromColumns<TableColumns<TTableConfig>>, TFullSelection['columns'] extends Record<string, unknown> ? TFullSelection['columns'] : 'Full'> & (Exclude<TFullSelection['extras'], undefined> extends Record<string, unknown> | ((...args: any[]) => Record<string, unknown>) ? ReturnTypeOrValue<Exclude<TFullSelection['extras'], undefined>> extends infer TExtras extends Record<string, unknown> ? { [K in NonUndefinedKeysOnly$1<TExtras>]: ReturnTypeOrValue<TExtras[K]> } : {} : {}) & (Exclude<TFullSelection['with'], undefined> extends Record<string, unknown> ? BuildRelationResult<TSchema, Exclude<TFullSelection['with'], undefined>, TTableConfig['relations']> : {}) & (TFullSelection extends {
1169
+ polymorphic: infer TPolymorphicConfig;
1170
+ } ? TPolymorphicConfig extends {
1171
+ schema: infer TPolymorphicSchema extends z.ZodTypeAny;
1172
+ } ? z.output<TPolymorphicSchema> : {} : {}) & (TFullSelection extends {
1154
1173
  vectorSearch: infer TVectorSearch;
1155
1174
  } ? [TVectorSearch] extends [undefined] ? {} : {
1156
1175
  _score?: number;
@@ -2751,6 +2770,9 @@ declare class GelRelationalQuery<TSchema extends TablesRelationalConfig, TTableC
2751
2770
  private _extractSearchEqFromWhereField;
2752
2771
  private _mergeSearchFiltersWithWhereEq;
2753
2772
  private _applyRelationsFilterToRows;
2773
+ private _resolvePolymorphicFinalizeState;
2774
+ private _extractPolymorphicSchemaErrorMessage;
2775
+ private _synthesizePolymorphicRows;
2754
2776
  private _finalizeRows;
2755
2777
  private _getSchemaDefinitionOrThrow;
2756
2778
  private _applyEqBounds;
@@ -2888,7 +2910,35 @@ declare class GelRelationalQuery<TSchema extends TablesRelationalConfig, TTableC
2888
2910
  }
2889
2911
  //#endregion
2890
2912
  //#region src/orm/query-builder.d.ts
2891
- type EnforcedConfig<TConfig, TTableConfig extends TableRelationalConfig, THasIndex extends boolean = false> = EnforceVectorSearchConstraints<EnforceSearchConstraints<EnforceCursorMaxScan<EnforceNoAllowFullScanWhenIndexed<EnforceWithIndexForWhere<TConfig, TTableConfig, THasIndex>, THasIndex>>, TTableConfig>, TTableConfig>;
2913
+ type OneRelationNameByType<TTableConfig extends TableRelationalConfig = TableRelationalConfig> = Extract<{ [K in keyof TTableConfig['relations']]: TTableConfig['relations'][K] extends {
2914
+ relationType: 'one';
2915
+ } ? K : never }[keyof TTableConfig['relations']], string>;
2916
+ type PolymorphicZodSchema = z.ZodDiscriminatedUnion<any, any>;
2917
+ type PolymorphicDiscriminatorFromSchema<TSchema extends PolymorphicZodSchema = PolymorphicZodSchema> = TSchema extends z.ZodDiscriminatedUnion<any, infer TDisc extends string> ? TDisc : string;
2918
+ type PolymorphicCaseLiteralFromSchema<TSchema extends PolymorphicZodSchema = PolymorphicZodSchema, TDiscriminator extends string = string> = Extract<z.output<TSchema> extends Record<TDiscriminator, infer TValue> ? TValue : never, string>;
2919
+ type IsWidenedString<T extends string> = string extends T ? true : false;
2920
+ type ValidatePolymorphicConfig<TConfig, TTableConfig extends TableRelationalConfig> = TConfig extends {
2921
+ polymorphic: infer TPolymorphic;
2922
+ } ? [TPolymorphic] extends [undefined] ? unknown : TPolymorphic extends {
2923
+ schema: infer TSchema;
2924
+ discriminator: infer TDiscriminator;
2925
+ cases: infer TCases;
2926
+ } ? TSchema extends PolymorphicZodSchema ? TDiscriminator extends string ? TCases extends Record<string, OneRelationNameByType<TTableConfig>> ? [PolymorphicCaseLiteralFromSchema<TSchema, PolymorphicDiscriminatorFromSchema<TSchema>>] extends [Extract<keyof TCases, string>] ? [Extract<keyof TCases, string>] extends [PolymorphicCaseLiteralFromSchema<TSchema, PolymorphicDiscriminatorFromSchema<TSchema>>] ? IsWidenedString<TDiscriminator> extends true ? unknown : TDiscriminator extends PolymorphicDiscriminatorFromSchema<TSchema> ? unknown : {
2927
+ __polymorphicDiscriminatorMustMatchSchema__: never;
2928
+ } : {
2929
+ __polymorphicCasesCannotContainUnknownLiterals__: never;
2930
+ } : {
2931
+ __polymorphicCasesMustCoverAllDiscriminatorLiterals__: never;
2932
+ } : {
2933
+ __polymorphicCasesMustMapToOneRelations__: never;
2934
+ } : {
2935
+ __polymorphicDiscriminatorMustBeString__: never;
2936
+ } : {
2937
+ __polymorphicSchemaMustBeDiscriminatedUnion__: never;
2938
+ } : {
2939
+ __polymorphicConfigInvalid__: never;
2940
+ } : unknown;
2941
+ type EnforcedConfig<TConfig, TTableConfig extends TableRelationalConfig, THasIndex extends boolean = false> = ValidatePolymorphicConfig<TConfig, TTableConfig> & EnforceVectorSearchConstraints<EnforceSearchConstraints<EnforceCursorMaxScan<EnforceNoAllowFullScanWhenIndexed<EnforceWithIndexForWhere<TConfig, TTableConfig, THasIndex>, THasIndex>>, TTableConfig>, TTableConfig>;
2892
2942
  type DisallowWithIndexSearchOrVector<THasIndex extends boolean> = THasIndex extends true ? {
2893
2943
  search?: never;
2894
2944
  vectorSearch?: never;
@@ -3112,6 +3162,14 @@ declare class RelationalQueryBuilder<TSchema extends TablesRelationalConfig, TTa
3112
3162
  * });
3113
3163
  */
3114
3164
  findMany(config: RelationCountWithConfig<TSchema, TTableConfig> & EnforcedConfig<RelationCountWithConfig<TSchema, TTableConfig>, TTableConfig, THasIndex> & DisallowWithIndexSearchOrVector<THasIndex>): GelRelationalQuery<TSchema, TTableConfig, FindManyResult<TSchema, TTableConfig, RelationCountWithConfig<TSchema, TTableConfig>>>;
3165
+ findMany<TPolymorphicSchema extends PolymorphicZodSchema, TPolymorphicDiscriminator extends PolymorphicDiscriminatorFromSchema<TPolymorphicSchema>, TPolymorphicCases extends Record<PolymorphicCaseLiteralFromSchema<TPolymorphicSchema, TPolymorphicDiscriminator>, OneRelationNameByType<TTableConfig>>, TConfig extends Omit<NonCursorConfigNoRelationCount<TSchema, TTableConfig>, 'polymorphic'> & {
3166
+ polymorphic: {
3167
+ schema: TPolymorphicSchema;
3168
+ discriminator: TPolymorphicDiscriminator;
3169
+ cases: TPolymorphicCases;
3170
+ as?: string | undefined;
3171
+ };
3172
+ }>(config: KnownKeysOnlyStrict<TConfig, NonCursorConfigNoSearch<TSchema, TTableConfig>> & EnforcedConfig<TConfig, TTableConfig, THasIndex>): GelRelationalQuery<TSchema, TTableConfig, FindManyResult<TSchema, TTableConfig, TConfig>>;
3115
3173
  findMany<TConfig extends SearchPaginatedConfig<TSchema, TTableConfig>>(config: KnownKeysOnlyStrict<TConfig, SearchPaginatedConfig<TSchema, TTableConfig>> & DisallowWithIndexSearchOrVector<THasIndex>): GelRelationalQuery<TSchema, TTableConfig, PaginatedResult<BuildQueryResult<TSchema, TTableConfig, TConfig>>>;
3116
3174
  findMany<TConfig extends SearchNonPaginatedConfig<TSchema, TTableConfig>>(config: KnownKeysOnlyStrict<TConfig, SearchNonPaginatedConfig<TSchema, TTableConfig>> & DisallowWithIndexSearchOrVector<THasIndex>): GelRelationalQuery<TSchema, TTableConfig, BuildQueryResult<TSchema, TTableConfig, TConfig>[]>;
3117
3175
  findMany<TConfig extends VectorNonPaginatedConfig<TSchema, TTableConfig>>(config: KnownKeysOnlyStrict<TConfig, VectorNonPaginatedConfig<TSchema, TTableConfig>> & DisallowWithIndexSearchOrVector<THasIndex>): GelRelationalQuery<TSchema, TTableConfig, BuildQueryResult<TSchema, TTableConfig, TConfig>[]>;
@@ -3133,6 +3191,14 @@ declare class RelationalQueryBuilder<TSchema extends TablesRelationalConfig, TTa
3133
3191
  * });
3134
3192
  */
3135
3193
  findFirst<TConfig extends SearchFindFirstConfig<TSchema, TTableConfig>>(config: KnownKeysOnlyStrict<TConfig, SearchFindFirstConfig<TSchema, TTableConfig>> & DisallowWithIndexSearchOrVector<THasIndex>): GelRelationalQuery<TSchema, TTableConfig, BuildQueryResult<TSchema, TTableConfig, TConfig> | null>;
3194
+ findFirst<TPolymorphicSchema extends PolymorphicZodSchema, TPolymorphicDiscriminator extends PolymorphicDiscriminatorFromSchema<TPolymorphicSchema>, TPolymorphicCases extends Record<PolymorphicCaseLiteralFromSchema<TPolymorphicSchema, TPolymorphicDiscriminator>, OneRelationNameByType<TTableConfig>>, TConfig extends Omit<FindFirstConfigNoSearch<TSchema, TTableConfig>, 'polymorphic'> & {
3195
+ polymorphic: {
3196
+ schema: TPolymorphicSchema;
3197
+ discriminator: TPolymorphicDiscriminator;
3198
+ cases: TPolymorphicCases;
3199
+ as?: string | undefined;
3200
+ };
3201
+ }>(config: KnownKeysOnlyStrict<TConfig, FindFirstConfigNoSearch<TSchema, TTableConfig>> & EnforcedConfig<TConfig, TTableConfig, THasIndex>): GelRelationalQuery<TSchema, TTableConfig, BuildQueryResult<TSchema, TTableConfig, TConfig> | null>;
3136
3202
  findFirst<TConfig extends FindFirstConfigNoSearch<TSchema, TTableConfig>>(config?: KnownKeysOnlyStrict<TConfig, FindFirstConfigNoSearch<TSchema, TTableConfig>> & EnforcedConfig<TConfig, TTableConfig, THasIndex>): GelRelationalQuery<TSchema, TTableConfig, BuildQueryResult<TSchema, TTableConfig, TConfig> | null>;
3137
3203
  /**
3138
3204
  * Find first row matching the query configuration, or throw if none exists.
@@ -3141,6 +3207,14 @@ declare class RelationalQueryBuilder<TSchema extends TablesRelationalConfig, TTa
3141
3207
  * useful when callers expect a row to exist.
3142
3208
  */
3143
3209
  findFirstOrThrow<TConfig extends SearchFindFirstConfig<TSchema, TTableConfig>>(config: KnownKeysOnlyStrict<TConfig, SearchFindFirstConfig<TSchema, TTableConfig>> & DisallowWithIndexSearchOrVector<THasIndex>): GelRelationalQuery<TSchema, TTableConfig, BuildQueryResult<TSchema, TTableConfig, TConfig>>;
3210
+ findFirstOrThrow<TPolymorphicSchema extends PolymorphicZodSchema, TPolymorphicDiscriminator extends PolymorphicDiscriminatorFromSchema<TPolymorphicSchema>, TPolymorphicCases extends Record<PolymorphicCaseLiteralFromSchema<TPolymorphicSchema, TPolymorphicDiscriminator>, OneRelationNameByType<TTableConfig>>, TConfig extends Omit<FindFirstConfigNoSearch<TSchema, TTableConfig>, 'polymorphic'> & {
3211
+ polymorphic: {
3212
+ schema: TPolymorphicSchema;
3213
+ discriminator: TPolymorphicDiscriminator;
3214
+ cases: TPolymorphicCases;
3215
+ as?: string | undefined;
3216
+ };
3217
+ }>(config: KnownKeysOnlyStrict<TConfig, FindFirstConfigNoSearch<TSchema, TTableConfig>> & EnforcedConfig<TConfig, TTableConfig, THasIndex>): GelRelationalQuery<TSchema, TTableConfig, BuildQueryResult<TSchema, TTableConfig, TConfig>>;
3144
3218
  findFirstOrThrow<TConfig extends FindFirstConfigNoSearch<TSchema, TTableConfig>>(config?: KnownKeysOnlyStrict<TConfig, FindFirstConfigNoSearch<TSchema, TTableConfig>> & EnforcedConfig<TConfig, TTableConfig, THasIndex>): GelRelationalQuery<TSchema, TTableConfig, BuildQueryResult<TSchema, TTableConfig, TConfig>>;
3145
3219
  }
3146
3220
  //#endregion
@@ -3324,6 +3398,9 @@ type MigrationCancelArgs = {
3324
3398
  runId?: string;
3325
3399
  };
3326
3400
  //#endregion
3401
+ //#region src/orm/migrations/schema.d.ts
3402
+ declare function migrationPlugin(): OrmSchemaPlugin;
3403
+ //#endregion
3327
3404
  //#region src/orm/triggers.d.ts
3328
3405
  type MaybePromise<T> = T | Promise<T>;
3329
3406
  type AnyRecord = Record<string, unknown>;
@@ -3596,4 +3673,4 @@ interface IndexLike {
3596
3673
  indexName: string;
3597
3674
  }
3598
3675
  //#endregion
3599
- export { DatabaseWithQuery as $, CountResult as $n, startsWith as $r, TableRelationalConfig as $t, MigrationRunArgs as A, ConvexVectorIndexConfig as An, LogicalExpression as Ar, ConvexCustomBuilderInitial as At, MigrationMigrateOne as B, ConvexForeignKeyConfig as Bn, ilike as Br, boolean as Bt, OrmBeforeResult as C, ConvexRankIndexBuilder as Cn, VectorQueryConfig as Cr, ConvexIdBuilderInitial as Ct, OrmTriggers as D, ConvexSearchIndexConfig as Dn, ExpressionVisitor as Dr, ConvexDateMode as Dt, OrmTriggerContext as E, ConvexSearchIndexBuilderOn as En, BinaryExpression as Er, ConvexDateBuilderInitial as Et, MigrationDirection as F, uniqueIndex as Fn, endsWith as Fr, ConvexBytesBuilder as Ft, MigrationStep as G, foreignKey as Gn, like as Gr, CountBackfillKickoffArgs as Gt, MigrationRunStatus as H, ConvexUniqueConstraintBuilderOn as Hn, isFieldReference as Hr, ConvexBigIntBuilderInitial as Ht, MigrationDoc as I, vectorIndex as In, eq as Ir, ConvexBytesBuilderInitial as It, buildMigrationPlan as J, AggregateFieldValue as Jn, ne as Jr, ManyConfig as Jt, MigrationTableName as K, unique as Kn, lt as Kr, CountBackfillStatusArgs as Kt, MigrationDocContext as L, ConvexCheckBuilder as Ln, fieldRef as Lr, bytes as Lt, MigrationStatusArgs as M, index as Mn, and as Mr, custom as Mt, MigrationAppliedState as N, rankIndex as Nn, between as Nr, json as Nt, defineTriggers as O, ConvexVectorIndexBuilder as On, FieldReference as Or, date as Ot, MigrationDefinition as P, searchIndex as Pn, contains as Pr, objectOf as Pt, DatabaseWithMutations as Q, CountConfig as Qn, or as Qr, RelationsBuilderColumnConfig as Qt, MigrationDriftIssue as R, ConvexCheckConfig as Rn, gt as Rr, ConvexBooleanBuilder as Rt, scheduledDeleteFactory as S, ConvexIndexBuilderOn as Sn, UpdateSet as Sr, ConvexIdBuilder as St, OrmTriggerChange as T, ConvexSearchIndexBuilder as Tn, unsetToken as Tr, ConvexDateBuilder as Tt, MigrationSet as U, ConvexUniqueConstraintConfig as Un, isNotNull as Ur, bigint as Ut, MigrationPlan as V, ConvexUniqueConstraintBuilder as Vn, inArray as Vr, ConvexBigIntBuilder as Vt, MigrationStateMap as W, check as Wn, isNull as Wr, CountBackfillChunkArgs as Wt, defineMigrationSet as X, BuildQueryResult as Xn, notBetween as Xr, RelationsBuilder as Xt, defineMigration as Y, AggregateResult as Yn, not as Yr, OneConfig as Yt, detectMigrationDrift as Z, BuildRelationResult as Zn, notInArray as Zr, RelationsBuilderColumnBase as Zt, OrmWriterCtx as _, NotNull as _i, RlsRoleConfig as _n, PaginatedResult as _r, ConvexTextBuilderInitial as _t, TableConfigResult as a, SystemFields as ai, ConvexTable as an, InferSelectModel as ar, extractRelationsConfig as at, scheduledMutationBatchFactory as b, ConvexAggregateIndexBuilderOn as bn, ReturningResult as br, ConvexNumberBuilderInitial as bt, OrmNotFoundError as c, ColumnBuilderBaseConfig as ci, OrmLifecycleOperation as cn, MutationExecuteResult as cr, vector as ct, GenericOrmCtx as d, ColumnBuilderWithTableName as di, deletion as dn, MutationPaginatedResult as dr, ConvexTimestampMode as dt, Brand as ei, TablesRelationalConfig as en, DBQueryConfig as er, OrmReader as et, OrmApiResult as f, ColumnDataType as fi, RlsPolicy as fn, MutationResult as fr, timestamp as ft, OrmReaderCtx as g, IsUnique as gi, RlsRole as gn, OrderDirection as gr, ConvexTextBuilder as gt, OrmFunctions as h, IsPrimaryKey as hi, rlsPolicy as hn, OrderByClause as hr, textEnum as ht, desc as i, TableName as ii, ConvexDeletionConfig as in, InferModelFromColumns as ir, EdgeMetadata as it, MigrationRunChunkArgs as j, aggregateIndex as jn, UnaryExpression as jr, arrayOf as jt, MigrationCancelArgs as k, ConvexVectorIndexBuilderOn as kn, FilterExpression$1 as kr, ConvexCustomBuilder as kt, CreateOrmOptions as l, ColumnBuilderRuntimeConfig as li, TableConfig as ln, MutationExecutionMode as lr, ConvexTimestampBuilder as lt, OrmClientWithApi as m, HasDefault as mi, RlsPolicyToOption as mn, MutationRunMode as mr, ConvexTextEnumBuilderInitial as mt, defineSchema$1 as n, OrmSchemaPlugin as ni, defineRelationsPart as nn, GetColumnData as nr, RlsContext as nt, getTableColumns as o, AnyColumn as oi, ConvexTableWithColumns as on, InsertValue as or, ConvexVectorBuilder as ot, OrmClientBase as p, DrizzleEntity as pi, RlsPolicyConfig as pn, MutationReturning as pr, ConvexTextEnumBuilder as pt, MigrationWriteMode as q, AggregateConfig as qn, lte as qr, ExtractTablesWithRelations as qt, asc as r, OrmSchemaPluginTables as ri, ConvexDeletionBuilder as rn, InferInsertModel as rr, RlsMode as rt, getTableConfig as s, ColumnBuilder as si, OrmLifecycleChange as sn, MutationExecuteConfig as sr, ConvexVectorBuilderInitial as st, WhereClauseResult as t, Columns as ti, defineRelations as tn, FilterOperators as tr, OrmWriter as tt, GenericOrm as u, ColumnBuilderTypeConfig as ui, convexTable as un, MutationPaginateConfig as ur, ConvexTimestampBuilderInitial as ut, createOrm as v, rlsRole as vn, PredicateWhereIndexConfig as vr, text as vt, OrmTableTriggers as w, ConvexRankIndexBuilderOn as wn, VectorSearchProvider as wr, id as wt, ScheduledDeleteArgs as x, ConvexIndexBuilder as xn, ReturningSelection as xr, integer as xt, ScheduledMutationBatchArgs as y, ConvexAggregateIndexBuilder as yn, ReturningAll as yr, ConvexNumberBuilder as yt, MigrationManifestEntry as z, ConvexForeignKeyBuilder as zn, gte as zr, ConvexBooleanBuilderInitial as zt };
3676
+ export { DatabaseWithMutations as $, CountConfig as $n, or as $r, RelationsBuilderColumnConfig as $t, MigrationCancelArgs as A, ConvexVectorIndexBuilderOn as An, FilterExpression$1 as Ar, ConvexCustomBuilder as At, MigrationManifestEntry as B, ConvexForeignKeyBuilder as Bn, gte as Br, ConvexBooleanBuilderInitial as Bt, OrmBeforeResult as C, ConvexIndexBuilderOn as Cn, UpdateSet as Cr, ConvexIdBuilder as Ct, OrmTriggers as D, ConvexSearchIndexBuilderOn as Dn, BinaryExpression as Dr, ConvexDateBuilderInitial as Dt, OrmTriggerContext as E, ConvexSearchIndexBuilder as En, unsetToken as Er, ConvexDateBuilder as Et, MigrationDefinition as F, searchIndex as Fn, contains as Fr, objectOf as Ft, MigrationStateMap as G, check as Gn, isNull as Gr, CountBackfillChunkArgs as Gt, MigrationPlan as H, ConvexUniqueConstraintBuilder as Hn, inArray as Hr, ConvexBigIntBuilder as Ht, MigrationDirection as I, uniqueIndex as In, endsWith as Ir, ConvexBytesBuilder as It, MigrationWriteMode as J, AggregateConfig as Jn, lte as Jr, ExtractTablesWithRelations as Jt, MigrationStep as K, foreignKey as Kn, like as Kr, CountBackfillKickoffArgs as Kt, MigrationDoc as L, vectorIndex as Ln, eq as Lr, ConvexBytesBuilderInitial as Lt, MigrationRunChunkArgs as M, aggregateIndex as Mn, UnaryExpression as Mr, arrayOf as Mt, MigrationStatusArgs as N, index as Nn, and as Nr, custom as Nt, defineTriggers as O, ConvexSearchIndexConfig as On, ExpressionVisitor as Or, ConvexDateMode as Ot, MigrationAppliedState as P, rankIndex as Pn, between as Pr, json as Pt, detectMigrationDrift as Q, BuildRelationResult as Qn, notInArray as Qr, RelationsBuilderColumnBase as Qt, MigrationDocContext as R, ConvexCheckBuilder as Rn, fieldRef as Rr, bytes as Rt, scheduledDeleteFactory as S, ConvexIndexBuilder as Sn, ReturningSelection as Sr, integer as St, OrmTriggerChange as T, ConvexRankIndexBuilderOn as Tn, VectorSearchProvider as Tr, id as Tt, MigrationRunStatus as U, ConvexUniqueConstraintBuilderOn as Un, isFieldReference as Ur, ConvexBigIntBuilderInitial as Ut, MigrationMigrateOne as V, ConvexForeignKeyConfig as Vn, ilike as Vr, boolean as Vt, MigrationSet as W, ConvexUniqueConstraintConfig as Wn, isNotNull as Wr, bigint as Wt, defineMigration as X, AggregateResult as Xn, not as Xr, OneConfig as Xt, buildMigrationPlan as Y, AggregateFieldValue as Yn, ne as Yr, ManyConfig as Yt, defineMigrationSet as Z, BuildQueryResult as Zn, notBetween as Zr, RelationsBuilder as Zt, OrmWriterCtx as _, IsUnique as _i, RlsRole as _n, OrderDirection as _r, ConvexTextBuilder as _t, TableConfigResult as a, TableName as ai, ConvexDeletionConfig as an, InferModelFromColumns as ar, EdgeMetadata as at, scheduledMutationBatchFactory as b, ConvexAggregateIndexBuilder as bn, ReturningAll as br, ConvexNumberBuilder as bt, OrmNotFoundError as c, ColumnBuilder as ci, OrmLifecycleChange as cn, MutationExecuteConfig as cr, ConvexVectorBuilderInitial as ct, GenericOrmCtx as d, ColumnBuilderTypeConfig as di, convexTable as dn, MutationPaginateConfig as dr, ConvexTimestampBuilderInitial as dt, startsWith as ei, TableRelationalConfig as en, CountResult as er, DatabaseWithQuery as et, OrmApiResult as f, ColumnBuilderWithTableName as fi, deletion as fn, MutationPaginatedResult as fr, ConvexTimestampMode as ft, OrmReaderCtx as g, IsPrimaryKey as gi, rlsPolicy as gn, OrderByClause as gr, textEnum as gt, OrmFunctions as h, HasDefault as hi, RlsPolicyToOption as hn, MutationRunMode as hr, ConvexTextEnumBuilderInitial as ht, desc as i, OrmSchemaPluginTables as ii, ConvexDeletionBuilder as in, InferInsertModel as ir, RlsMode as it, MigrationRunArgs as j, ConvexVectorIndexConfig as jn, LogicalExpression as jr, ConvexCustomBuilderInitial as jt, migrationPlugin as k, ConvexVectorIndexBuilder as kn, FieldReference as kr, date as kt, CreateOrmOptions as l, ColumnBuilderBaseConfig as li, OrmLifecycleOperation as ln, MutationExecuteResult as lr, vector as lt, OrmClientWithApi as m, DrizzleEntity as mi, RlsPolicyConfig as mn, MutationReturning as mr, ConvexTextEnumBuilder as mt, defineSchema$1 as n, Columns as ni, defineRelations as nn, FilterOperators as nr, OrmWriter as nt, getTableColumns as o, SystemFields as oi, ConvexTable as on, InferSelectModel as or, extractRelationsConfig as ot, OrmClientBase as p, ColumnDataType as pi, RlsPolicy as pn, MutationResult as pr, timestamp as pt, MigrationTableName as q, unique as qn, lt as qr, CountBackfillStatusArgs as qt, asc as r, OrmSchemaPlugin as ri, defineRelationsPart as rn, GetColumnData as rr, RlsContext as rt, getTableConfig as s, AnyColumn as si, ConvexTableWithColumns as sn, InsertValue as sr, ConvexVectorBuilder as st, WhereClauseResult as t, Brand as ti, TablesRelationalConfig as tn, DBQueryConfig as tr, OrmReader as tt, GenericOrm as u, ColumnBuilderRuntimeConfig as ui, TableConfig as un, MutationExecutionMode as ur, ConvexTimestampBuilder as ut, createOrm as v, NotNull as vi, RlsRoleConfig as vn, PaginatedResult as vr, ConvexTextBuilderInitial as vt, OrmTableTriggers as w, ConvexRankIndexBuilder as wn, VectorQueryConfig as wr, ConvexIdBuilderInitial as wt, ScheduledDeleteArgs as x, ConvexAggregateIndexBuilderOn as xn, ReturningResult as xr, ConvexNumberBuilderInitial as xt, ScheduledMutationBatchArgs as y, rlsRole as yn, PredicateWhereIndexConfig as yr, text as yt, MigrationDriftIssue as z, ConvexCheckConfig as zn, gt as zr, ConvexBooleanBuilder as zt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-convex",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "Better Convex - React Query integration and CLI tools for Convex",
5
5
  "keywords": [
6
6
  "convex",