kitcn 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/aggregate/index.d.ts +2 -2
  3. package/dist/aggregate/index.js +1 -1
  4. package/dist/auth/generated/index.d.ts +1 -1
  5. package/dist/auth/generated/index.js +1 -1
  6. package/dist/auth/http/index.d.ts +1 -1
  7. package/dist/auth/index.d.ts +20 -20
  8. package/dist/auth/index.js +133 -9
  9. package/dist/auth/nextjs/index.d.ts +2 -2
  10. package/dist/auth/nextjs/index.js +3 -3
  11. package/dist/auth/start/server/index.d.ts +2 -2
  12. package/dist/auth/start/server/index.js +3 -3
  13. package/dist/{builder-CsAw-DK8.js → builder-Cyd5nCxZ.js} +2 -2
  14. package/dist/{caller-factory-D4pz5GcZ.js → caller-factory-C-N540BC.js} +3 -3
  15. package/dist/{capabilities-6PZBmvc8.d.ts → capabilities-DPB-JKlm.d.ts} +1 -1
  16. package/dist/cli.mjs +1 -1
  17. package/dist/{create-schema-orm-HcJzGCxj.js → create-schema-orm-CwJD930B.js} +1 -1
  18. package/dist/crpc/index.d.ts +2 -2
  19. package/dist/crpc/index.js +3 -3
  20. package/dist/{customFunctions-ivbc6-_g.js → customFunctions-X_B4kET8.js} +64 -1
  21. package/dist/{definitions-DS8ZDc74.js → definitions-3PX4ywR-.js} +2 -2
  22. package/dist/{extensions-Blzsyekm.js → extensions-Bp0XHanR.js} +1 -1
  23. package/dist/{generated-contract-disabled-CgYQZCw2.d.ts → generated-contract-disabled-CTUQ9nxL.d.ts} +70 -41
  24. package/dist/{generated-contract-disabled-_1Mjg9pW.js → generated-contract-disabled-RyPYlwq0.js} +1 -0
  25. package/dist/{http-types-90mapMP9.d.ts → http-types-BhhPZtwa.d.ts} +2 -2
  26. package/dist/{id-CuSfWa5q.js → id-BVdWER1U.js} +1 -1
  27. package/dist/{filter-expression-Dydt8wS0.js → index-utils-C1DyktHe.js} +95 -1
  28. package/dist/{local-env-Dk8RJvt5.mjs → local-env-DGSkmXQk.mjs} +6 -0
  29. package/dist/{middleware-CE_MC6Gi.d.ts → middleware-BBS7oLtT.d.ts} +1 -1
  30. package/dist/{middleware-BvnabcNq.js → middleware-D61Nm-iB.js} +1 -1
  31. package/dist/orm/aggregate-index/index.d.ts +1 -1
  32. package/dist/orm/aggregate-index/index.js +4 -3
  33. package/dist/orm/index.d.ts +4 -4
  34. package/dist/orm/index.js +8 -7
  35. package/dist/orm/migrations/index.d.ts +2 -2
  36. package/dist/orm/migrations/index.js +1 -1
  37. package/dist/plugins/index.d.ts +1 -1
  38. package/dist/plugins/index.js +1 -1
  39. package/dist/{procedure-caller-BR-Wb0si.js → procedure-caller-DgMiD0-a.js} +2 -2
  40. package/dist/{procedure-name-l2YusEZI.d.ts → procedure-name-DPYyLiVS.d.ts} +3 -3
  41. package/dist/ratelimit/index.d.ts +2 -2
  42. package/dist/ratelimit/index.js +3 -3
  43. package/dist/rsc/index.d.ts +4 -4
  44. package/dist/rsc/index.js +4 -4
  45. package/dist/{runtime-CcOvOf4K.js → runtime-BcvcfaP8.js} +2 -2
  46. package/dist/{schema-D8ZZMSKd.js → schema-hL2FWCE7.js} +6 -97
  47. package/dist/server/index.d.ts +4 -4
  48. package/dist/server/index.js +4 -4
  49. package/dist/symbols-DDNAddkd.js +21 -0
  50. package/dist/{table-CX2lnX7e.js → table-d9o_n4R3.js} +2 -21
  51. package/dist/{token-B0NKKxqP.js → token-CuJopBdP.js} +1 -1
  52. package/dist/{types-In-ZZOsd.d.ts → types-BXpu7xIU.d.ts} +1 -1
  53. package/dist/watcher.mjs +1 -1
  54. package/dist/{where-clause-compiler-DvYSTJXe.d.ts → where-clause-compiler-Dddhscyy.d.ts} +57 -57
  55. package/package.json +1 -1
  56. /package/dist/{api-entry-CkDpGYVg.js → api-entry-Buvjl9hn.js} +0 -0
  57. /package/dist/{context-utils-DwZ3Cam1.d.ts → context-utils-Cbv4r0AA.d.ts} +0 -0
  58. /package/dist/{convex-plugin-Dic0l-k8.js → convex-plugin-AbNQl1Sg.js} +0 -0
  59. /package/dist/{create-schema-ojI-OH_9.js → create-schema-BmVH4gPc.js} +0 -0
  60. /package/dist/{error-CMLeCadS.js → error-Dyqhgbf6.js} +0 -0
  61. /package/dist/{meta-utils-D2lqN2Lg.js → meta-utils-Cc7neQOB.js} +0 -0
  62. /package/dist/{query-context-DJONf8X5.d.ts → query-context-BkNjkDCk.d.ts} +0 -0
  63. /package/dist/{query-context-DOm5Xm3H.js → query-context-DdSg3fuk.js} +0 -0
  64. /package/dist/{query-options-DUiOj01a.js → query-options-DGG93--5.js} +0 -0
  65. /package/dist/{token-kQaqFby4.d.ts → token-tlbNKQS0.d.ts} +0 -0
  66. /package/dist/{transformer-D8wO-kEj.js → transformer-C8lVwHNT.js} +0 -0
  67. /package/dist/{types-eNzQmbqM.d.ts → types-Bkeicpo6.d.ts} +0 -0
  68. /package/dist/{types-MHYXboyy.d.ts → types-Bqi_ivSd.d.ts} +0 -0
  69. /package/dist/{types-Bf3XQex5.d.ts → types-ex0-J-SC.d.ts} +0 -0
  70. /package/dist/{validators-wOIjhkfN.d.ts → validators-0I-Ik1EN.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
- import { t as GetAuth } from "./types-Bf3XQex5.js";
2
- import { t as GenericCtx } from "./context-utils-DwZ3Cam1.js";
1
+ import { t as GetAuth } from "./types-ex0-J-SC.js";
2
+ import { t as GenericCtx } from "./context-utils-Cbv4r0AA.js";
3
3
  import * as convex_server0 from "convex/server";
4
4
  import { DocumentByName, FunctionReference, GenericDataModel, GenericMutationCtx, GenericSchema, PaginationResult, SchemaDefinition, TableNamesInDataModel, internalMutationGeneric } from "convex/server";
5
5
  import * as better_auth_adapters0 from "better-auth/adapters";
@@ -93,6 +93,24 @@ declare const findOneHandler: (ctx: any, args: {
93
93
  select?: string[];
94
94
  where?: any[];
95
95
  }, schema: Schema, betterAuthSchema: any) => Promise<convex_server0.GenericDocument | null>;
96
+ /**
97
+ * Row count for one Better Auth model, or `null` when the requested shape can
98
+ * only be answered by reading the rows.
99
+ *
100
+ * Two shapes are bounded:
101
+ * - An empty `where` uses Convex's native table count, which reads no
102
+ * documents. This is the shape `countTotalUsers` issues, and the only one
103
+ * that also works on a plain (non-ORM) auth schema.
104
+ * - An equality-only `where` whose field set exactly matches a declared
105
+ * `aggregateIndex` reads a constant number of bucket rows through the ORM.
106
+ *
107
+ * Everything else returns `null` so the caller walks pages instead. That walk
108
+ * returns the same number; it is only linear in matching rows.
109
+ */
110
+ declare const countHandler: (ctx: any, args: {
111
+ model: string;
112
+ where?: any[];
113
+ }, schema: Schema, betterAuthSchema: any) => Promise<number | null>;
96
114
  declare const findManyHandler: (ctx: any, args: {
97
115
  model: string;
98
116
  paginationOpts: any;
@@ -178,13 +196,23 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
178
196
  triggers?: GenericAuthTriggers<DataModel, Schema, TriggerCtx> | ((ctx: TriggerCtx) => GenericAuthTriggers<DataModel, Schema, TriggerCtx> | undefined); /** Validate input validators against auth table schemas. Defaults to false for smaller generated types. */
179
197
  validateInput?: boolean;
180
198
  }) => {
199
+ count: convex_server0.RegisteredQuery<"internal", {
200
+ where?: {
201
+ mode?: "sensitive" | "insensitive" | undefined;
202
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
203
+ connector?: "AND" | "OR" | undefined;
204
+ value: string | number | boolean | string[] | number[] | null;
205
+ field: string;
206
+ }[] | undefined;
207
+ model: string;
208
+ }, Promise<number | null>>;
181
209
  consumeOne: convex_server0.RegisteredMutation<"internal", {
182
210
  input: {
183
211
  where?: {
212
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
184
213
  connector?: "AND" | "OR" | undefined;
185
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
186
- field: string;
187
214
  value: string | number | boolean | string[] | number[] | null;
215
+ field: string;
188
216
  }[] | undefined;
189
217
  model: string;
190
218
  } | {
@@ -207,26 +235,26 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
207
235
  };
208
236
  }, Promise<any>>;
209
237
  deleteMany: convex_server0.RegisteredMutation<"internal", {
238
+ paginationOpts: {
239
+ id?: number;
240
+ endCursor?: string | null;
241
+ maximumRowsRead?: number;
242
+ maximumBytesRead?: number;
243
+ numItems: number;
244
+ cursor: string | null;
245
+ };
210
246
  input: {
211
247
  where?: {
248
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
212
249
  connector?: "AND" | "OR" | undefined;
213
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
214
- field: string;
215
250
  value: string | number | boolean | string[] | number[] | null;
251
+ field: string;
216
252
  }[] | undefined;
217
253
  model: string;
218
254
  } | {
219
255
  where?: any[] | undefined;
220
256
  model: string;
221
257
  };
222
- paginationOpts: {
223
- id?: number;
224
- endCursor?: string | null;
225
- maximumRowsRead?: number;
226
- maximumBytesRead?: number;
227
- numItems: number;
228
- cursor: string | null;
229
- };
230
258
  }, Promise<{
231
259
  count: number;
232
260
  ids: any[];
@@ -238,10 +266,10 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
238
266
  deleteOne: convex_server0.RegisteredMutation<"internal", {
239
267
  input: {
240
268
  where?: {
269
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
241
270
  connector?: "AND" | "OR" | undefined;
242
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
243
- field: string;
244
271
  value: string | number | boolean | string[] | number[] | null;
272
+ field: string;
245
273
  }[] | undefined;
246
274
  model: string;
247
275
  } | {
@@ -250,21 +278,20 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
250
278
  };
251
279
  }, Promise<Record<string, unknown> | undefined>>;
252
280
  findMany: convex_server0.RegisteredQuery<"internal", {
281
+ limit?: number | undefined;
253
282
  join?: any;
254
283
  where?: {
255
284
  mode?: "sensitive" | "insensitive" | undefined;
285
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
256
286
  connector?: "AND" | "OR" | undefined;
257
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
258
- field: string;
259
287
  value: string | number | boolean | string[] | number[] | null;
288
+ field: string;
260
289
  }[] | undefined;
261
- limit?: number | undefined;
262
290
  offset?: number | undefined;
263
291
  sortBy?: {
264
292
  field: string;
265
293
  direction: "asc" | "desc";
266
294
  } | undefined;
267
- model: string;
268
295
  paginationOpts: {
269
296
  id?: number;
270
297
  endCursor?: string | null;
@@ -273,15 +300,16 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
273
300
  numItems: number;
274
301
  cursor: string | null;
275
302
  };
303
+ model: string;
276
304
  }, Promise<PaginationResult<convex_server0.GenericDocument>>>;
277
305
  findOne: convex_server0.RegisteredQuery<"internal", {
278
306
  join?: any;
279
307
  where?: {
280
308
  mode?: "sensitive" | "insensitive" | undefined;
309
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
281
310
  connector?: "AND" | "OR" | undefined;
282
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
283
- field: string;
284
311
  value: string | number | boolean | string[] | number[] | null;
312
+ field: string;
285
313
  }[] | undefined;
286
314
  select?: string[] | undefined;
287
315
  model: string;
@@ -291,10 +319,10 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
291
319
  input: {
292
320
  where?: {
293
321
  mode?: "sensitive" | "insensitive" | undefined;
322
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
294
323
  connector?: "AND" | "OR" | undefined;
295
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
296
- field: string;
297
324
  value: string | number | boolean | string[] | number[] | null;
325
+ field: string;
298
326
  }[] | undefined;
299
327
  set?: Record<string, any> | undefined;
300
328
  model: string;
@@ -303,31 +331,31 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
303
331
  }, Promise<any>>;
304
332
  rotateKeys: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
305
333
  updateMany: convex_server0.RegisteredMutation<"internal", {
334
+ paginationOpts: {
335
+ id?: number;
336
+ endCursor?: string | null;
337
+ maximumRowsRead?: number;
338
+ maximumBytesRead?: number;
339
+ numItems: number;
340
+ cursor: string | null;
341
+ };
306
342
  input: {
307
343
  where?: {
344
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
308
345
  connector?: "AND" | "OR" | undefined;
309
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
310
- field: string;
311
346
  value: string | number | boolean | string[] | number[] | null;
347
+ field: string;
312
348
  }[] | undefined;
313
- model: string;
314
349
  update: {
315
350
  [x: string]: unknown;
316
351
  [x: number]: unknown;
317
352
  [x: symbol]: unknown;
318
353
  };
354
+ model: string;
319
355
  } | {
320
356
  where?: any[] | undefined;
321
- model: string;
322
357
  update: any;
323
- };
324
- paginationOpts: {
325
- id?: number;
326
- endCursor?: string | null;
327
- maximumRowsRead?: number;
328
- maximumBytesRead?: number;
329
- numItems: number;
330
- cursor: string | null;
358
+ model: string;
331
359
  };
332
360
  }, Promise<{
333
361
  count: number;
@@ -340,27 +368,28 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
340
368
  updateOne: convex_server0.RegisteredMutation<"internal", {
341
369
  input: {
342
370
  where?: {
371
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
343
372
  connector?: "AND" | "OR" | undefined;
344
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
345
- field: string;
346
373
  value: string | number | boolean | string[] | number[] | null;
374
+ field: string;
347
375
  }[] | undefined;
348
- model: string;
349
376
  update: {
350
377
  [x: string]: unknown;
351
378
  [x: number]: unknown;
352
379
  [x: symbol]: unknown;
353
380
  };
381
+ model: string;
354
382
  } | {
355
383
  where?: any[] | undefined;
356
- model: string;
357
384
  update: any;
385
+ model: string;
358
386
  };
359
387
  }, Promise<any>>;
360
388
  };
361
389
  //#endregion
362
390
  //#region src/auth/create-client.d.ts
363
391
  type AuthFunctions = {
392
+ count: FunctionReference<'query', 'internal', Record<string, any>>;
364
393
  consumeOne: FunctionReference<'mutation', 'internal', Record<string, any>>;
365
394
  create: FunctionReference<'mutation', 'internal', Record<string, any>>;
366
395
  deleteMany: FunctionReference<'mutation', 'internal', Record<string, any>>;
@@ -408,4 +437,4 @@ declare const createDisabledAuthRuntime: <DataModel extends GenericDataModel, Sc
408
437
  reason?: string;
409
438
  }) => AuthRuntime<DataModel, Schema, TriggerCtx, GenericCtx, AuthOptions>;
410
439
  //#endregion
411
- export { GenericAuthTriggers as C, GenericAuthTriggerHandlers as S, updateOneHandler as _, AuthFunctions as a, GenericAuthDefinition as b, consumeOneHandler as c, deleteManyHandler as d, deleteOneHandler as f, updateManyHandler as g, incrementOneHandler as h, getGeneratedAuthDisabledReason as i, createApi as l, findOneHandler as m, GeneratedAuthDisabledReasonKind as n, Triggers as o, findManyHandler as p, createDisabledAuthRuntime as r, createClient as s, AuthRuntime as t, createHandler as u, BetterAuthOptionsWithoutDatabase as v, defineAuth as w, GenericAuthTriggerChange as x, GenericAuthBeforeResult as y };
440
+ export { GenericAuthTriggerHandlers as C, GenericAuthTriggerChange as S, defineAuth as T, updateManyHandler as _, AuthFunctions as a, GenericAuthBeforeResult as b, consumeOneHandler as c, createHandler as d, deleteManyHandler as f, incrementOneHandler as g, findOneHandler as h, getGeneratedAuthDisabledReason as i, countHandler as l, findManyHandler as m, GeneratedAuthDisabledReasonKind as n, Triggers as o, deleteOneHandler as p, createDisabledAuthRuntime as r, createClient as s, AuthRuntime as t, createApi as u, updateOneHandler as v, GenericAuthTriggers as w, GenericAuthDefinition as x, BetterAuthOptionsWithoutDatabase as y };
@@ -34,6 +34,7 @@ const createDisabledAuthRuntime = (config) => {
34
34
  throw new Error(`${message} (auth)`);
35
35
  } }),
36
36
  getAuth: createDisabledError(message, "getAuth"),
37
+ count: createDisabledRuntimeExport(message, "count"),
37
38
  consumeOne: createDisabledRuntimeExport(message, "consumeOne"),
38
39
  create: createDisabledRuntimeExport(message, "create"),
39
40
  deleteMany: createDisabledRuntimeExport(message, "deleteMany"),
@@ -1,5 +1,5 @@
1
- import { o as Simplify } from "./types-MHYXboyy.js";
2
- import { g as UnsetMarker, t as AnyMiddleware } from "./types-eNzQmbqM.js";
1
+ import { o as Simplify } from "./types-Bqi_ivSd.js";
2
+ import { g as UnsetMarker, t as AnyMiddleware } from "./types-Bkeicpo6.js";
3
3
  import { GenericActionCtx, GenericDataModel, HttpRouter } from "convex/server";
4
4
  import { z } from "zod";
5
5
  import { Context, Hono } from "hono";
@@ -1,4 +1,4 @@
1
- import { I as ConvexColumnBuilder, L as entityKind } from "./table-CX2lnX7e.js";
1
+ import { b as ConvexColumnBuilder, x as entityKind } from "./table-d9o_n4R3.js";
2
2
  import { v } from "convex/values";
3
3
 
4
4
  //#region src/orm/builders/id.ts
@@ -1,3 +1,5 @@
1
+ import { n as Columns } from "./symbols-DDNAddkd.js";
2
+
1
3
  //#region src/orm/filter-expression.ts
2
4
  /**
3
5
  * Unique symbol for FilterExpression brand
@@ -399,4 +401,96 @@ function isNotNull(col) {
399
401
  }
400
402
 
401
403
  //#endregion
402
- export { or as A, matchLikePattern as C, notIlike as D, notBetween as E, notInArray as O, lte as S, not as T, isFieldReference as _, between as a, like as b, endsWith as c, filterValueInList as d, filterValuesEqual as f, inArray as g, ilike as h, arrayOverlaps as i, startsWith as j, notLike as k, eq as l, gte as m, arrayContained as n, column as o, gt as p, arrayContains as r, contains as s, and as t, fieldRef as u, isNotNull as v, ne as w, lt as x, isNull as y };
404
+ //#region src/orm/timestamp-mode.ts
405
+ const PUBLIC_CREATED_AT_FIELD = "createdAt";
406
+ const INTERNAL_CREATION_TIME_FIELD = "_creationTime";
407
+ const CREATED_AT_MIGRATION_MESSAGE = "`_creationTime` is no longer public. Use `createdAt` instead.";
408
+ const hasUserCreatedAtColumn = (table) => {
409
+ if (!table || typeof table !== "object") return false;
410
+ const columns = table[Columns];
411
+ if (!columns || typeof columns !== "object") return false;
412
+ return Object.hasOwn(columns, PUBLIC_CREATED_AT_FIELD);
413
+ };
414
+ const usesSystemCreatedAtAlias = (_table) => true;
415
+
416
+ //#endregion
417
+ //#region src/orm/index-utils.ts
418
+ function getIndexes(table) {
419
+ const indexes = table.getIndexes?.();
420
+ return Array.isArray(indexes) ? indexes : [];
421
+ }
422
+ function getAggregateIndexes(table) {
423
+ const indexes = table.getAggregateIndexes?.();
424
+ return Array.isArray(indexes) ? indexes : [];
425
+ }
426
+ function getRankIndexes(table) {
427
+ const indexes = table.getRankIndexes?.();
428
+ return Array.isArray(indexes) ? indexes : [];
429
+ }
430
+ function getSearchIndexes(table) {
431
+ const indexes = table.getSearchIndexes?.();
432
+ return Array.isArray(indexes) ? indexes : [];
433
+ }
434
+ function findSearchIndexByName(table, indexName) {
435
+ return getSearchIndexes(table).find((index) => index.name === indexName) ?? null;
436
+ }
437
+ function getVectorIndexes(table) {
438
+ const indexes = table.getVectorIndexes?.();
439
+ return Array.isArray(indexes) ? indexes : [];
440
+ }
441
+ function findVectorIndexByName(table, indexName) {
442
+ return getVectorIndexes(table).find((index) => index.name === indexName) ?? null;
443
+ }
444
+ function findIndexForColumns(indexes, columns) {
445
+ for (const index of indexes) if (hasColumnPrefix(index, columns)) return index.name;
446
+ return null;
447
+ }
448
+ function findExactIndexForColumns(indexes, columns) {
449
+ return indexes.find((candidate) => candidate.fields.length === columns.length && candidate.fields.every((field, position) => field === columns[position]))?.name ?? null;
450
+ }
451
+ const hasColumnPrefix = (index, columns) => {
452
+ if (index.fields.length < columns.length) return false;
453
+ for (let i = 0; i < columns.length; i += 1) if (index.fields[i] !== columns[i]) return false;
454
+ return true;
455
+ };
456
+ /**
457
+ * Answers "does scanning this index already produce the requested order?".
458
+ *
459
+ * Convex walks an index in full key order, so once a leading run of fields is
460
+ * pinned to a single value by `eq`, the remainder of the scan is already sorted
461
+ * by the next index field — and by `_creationTime` once every declared field is
462
+ * pinned, because Convex appends it as the implicit trailing key. When that
463
+ * field is the one the caller asked to sort by, `.order(dir).take(n)` returns
464
+ * the exact page and nothing has to be collected and sorted afterwards.
465
+ *
466
+ * This is the single owner of that decision. The top-level query planner and
467
+ * the relation loader both call it, so a bound one of them can push into the
468
+ * index can never be one the other silently drops.
469
+ *
470
+ * Returns the direction to hand to `.order()`, or null when the sort must run
471
+ * after the fetch.
472
+ */
473
+ function resolveIndexOrderPushdown(params) {
474
+ const { indexFields, pinnedEqCount, orderSpecs } = params;
475
+ if (!indexFields || orderSpecs.length !== 1) return null;
476
+ const primary = orderSpecs[0];
477
+ const eqCount = Math.min(Math.max(pinnedEqCount, 0), indexFields.length);
478
+ for (let i = 0; i < eqCount; i += 1) if (indexFields[i] === primary.field) return primary.direction;
479
+ const nativeField = eqCount >= indexFields.length ? INTERNAL_CREATION_TIME_FIELD : indexFields[eqCount];
480
+ return primary.field === nativeField ? primary.direction : null;
481
+ }
482
+ function findRelationIndex(table, columns, relationName, targetTableName, strict = true, allowFullScan = false, orderSpecs = []) {
483
+ const indexes = getIndexes(table);
484
+ const fallbackIndex = findIndexForColumns(indexes, columns);
485
+ const index = (orderSpecs.length === 0 ? void 0 : indexes.find((candidate) => hasColumnPrefix(candidate, columns) && resolveIndexOrderPushdown({
486
+ indexFields: candidate.fields,
487
+ pinnedEqCount: columns.length,
488
+ orderSpecs
489
+ }) !== null))?.name ?? fallbackIndex;
490
+ if (!index && !allowFullScan) throw new Error(`Relation ${relationName} requires index on '${targetTableName}(${columns.join(", ")})'. Set allowFullScan: true to override.`);
491
+ if (!index && strict) console.warn(`Relation ${relationName} running without index (allowFullScan: true).`);
492
+ return index;
493
+ }
494
+
495
+ //#endregion
496
+ export { inArray as A, notBetween as B, eq as C, gt as D, filterValuesEqual as E, lt as F, startsWith as G, notInArray as H, lte as I, matchLikePattern as L, isNotNull as M, isNull as N, gte as O, like as P, ne as R, endsWith as S, filterValueInList as T, notLike as U, notIlike as V, or as W, arrayContains as _, findVectorIndexByName as a, column as b, getRankIndexes as c, INTERNAL_CREATION_TIME_FIELD as d, PUBLIC_CREATED_AT_FIELD as f, arrayContained as g, and as h, findSearchIndexByName as i, isFieldReference as j, ilike as k, resolveIndexOrderPushdown as l, usesSystemCreatedAtAlias as m, findIndexForColumns as n, getAggregateIndexes as o, hasUserCreatedAtColumn as p, findRelationIndex as r, getIndexes as s, findExactIndexForColumns as t, CREATED_AT_MIGRATION_MESSAGE as u, arrayOverlaps as v, fieldRef as w, contains as x, between as y, not as z };
@@ -2739,6 +2739,11 @@ function resolveGenerationMode(options) {
2739
2739
  };
2740
2740
  }
2741
2741
  const AUTH_RUNTIME_PROCEDURES = [
2742
+ {
2743
+ exportName: "count",
2744
+ internal: true,
2745
+ type: "query"
2746
+ },
2742
2747
  {
2743
2748
  exportName: "create",
2744
2749
  internal: true,
@@ -3611,6 +3616,7 @@ export const {
3611
3616
  authClient,
3612
3617
  getAuth,
3613
3618
  auth,
3619
+ count,
3614
3620
  create,
3615
3621
  deleteMany,
3616
3622
  deleteOne,
@@ -1,4 +1,4 @@
1
- import { o as MiddlewareBuilder } from "./types-eNzQmbqM.js";
1
+ import { o as MiddlewareBuilder } from "./types-Bkeicpo6.js";
2
2
 
3
3
  //#region src/plugins/middleware.d.ts
4
4
  declare const PLUGIN_CONFIG_RESOLVERS: unique symbol;
@@ -1,4 +1,4 @@
1
- import { a as createMiddlewareFactory } from "./builder-CsAw-DK8.js";
1
+ import { a as createMiddlewareFactory } from "./builder-Cyd5nCxZ.js";
2
2
 
3
3
  //#region src/plugins/middleware.ts
4
4
  const PLUGIN_CONFIG_RESOLVERS = Symbol.for("kitcn:PluginConfigResolvers");
@@ -1,4 +1,4 @@
1
- import { $ as RankIndexDefinition, G as CountBackfillChunkArgs, J as CountBackfillStatusArgs, K as CountBackfillKickoffArgs, Q as CountIndexDefinition, X as CountQueryPlan, Y as AggregateQueryPlan, Z as AggregateIndexDefinition, et as RankOrderField, q as CountBackfillMode, r as OrmCapability } from "../../capabilities-6PZBmvc8.js";
1
+ import { $ as RankIndexDefinition, G as CountBackfillChunkArgs, J as CountBackfillStatusArgs, K as CountBackfillKickoffArgs, Q as CountIndexDefinition, X as CountQueryPlan, Y as AggregateQueryPlan, Z as AggregateIndexDefinition, et as RankOrderField, q as CountBackfillMode, r as OrmCapability } from "../../capabilities-DPB-JKlm.js";
2
2
 
3
3
  //#region src/orm/aggregate-index/capability.d.ts
4
4
  /**
@@ -1,6 +1,7 @@
1
- import { t as DirectAggregate } from "../../runtime-CcOvOf4K.js";
2
- import { a as Columns } from "../../table-CX2lnX7e.js";
3
- import { Dt as PUBLIC_CREATED_AT_FIELD, Et as INTERNAL_CREATION_TIME_FIELD, Ot as usesSystemCreatedAtAlias, Q as normalizeTemporalComparableValue, a as AGGREGATE_STATE_TABLE, c as getAggregateIndexDefinitions, d as COUNT_ERROR, ht as mapWithConcurrency, i as AGGREGATE_RANK_TREE_TABLE, l as getRankIndexDefinitions, m as createError, n as AGGREGATE_EXTREMA_TABLE, r as AGGREGATE_MEMBER_TABLE, s as rankAggregateName, t as AGGREGATE_BUCKET_TABLE, u as AGGREGATE_ERROR } from "../../schema-D8ZZMSKd.js";
1
+ import { t as DirectAggregate } from "../../runtime-BcvcfaP8.js";
2
+ import { n as Columns } from "../../symbols-DDNAddkd.js";
3
+ import { d as INTERNAL_CREATION_TIME_FIELD, f as PUBLIC_CREATED_AT_FIELD, m as usesSystemCreatedAtAlias } from "../../index-utils-C1DyktHe.js";
4
+ import { Q as normalizeTemporalComparableValue, a as AGGREGATE_STATE_TABLE, c as getAggregateIndexDefinitions, d as COUNT_ERROR, ht as mapWithConcurrency, i as AGGREGATE_RANK_TREE_TABLE, l as getRankIndexDefinitions, m as createError, n as AGGREGATE_EXTREMA_TABLE, r as AGGREGATE_MEMBER_TABLE, s as rankAggregateName, t as AGGREGATE_BUCKET_TABLE, u as AGGREGATE_ERROR } from "../../schema-hL2FWCE7.js";
4
5
 
5
6
  //#region src/orm/transaction-cache.ts
6
7
  /**
@@ -1,7 +1,7 @@
1
- import { $n as TableName, $t as OrmLifecycleChange, An as ConvexCheckBuilder, At as UpdateSet, Bn as ConvexTextBuilder, Br as IsPrimaryKey, Bt as RelationsBuilderColumnBase, C as MigrationStep, Cn as ConvexVectorIndexConfig, Cr as not, Ct as OrderByClause, D as defineMigration, Dn as searchIndex, Dr as startsWith, Dt as ReturningAll, E as buildMigrationPlan, En as rankIndex, Er as or, Et as PredicateWhereIndexConfig, Fn as ConvexUniqueConstraintBuilderOn, Fr as ColumnBuilderTypeConfig, Ft as ExtractTablesFromSchema, Gn as Columns, Gt as TablesRelationalConfig, H as RlsMode, Hn as text, Hr as NotNull, In as ConvexUniqueConstraintConfig, Ir as ColumnBuilderWithTableName, It as ExtractTablesWithRelations, Jn as OrmSchemaExtensionTables, Jt as ConvexDeletionBuilder, Kt as defineRelations, Ln as check, Lr as ColumnDataType, Lt as ManyConfig, M as DatabaseWithQuery, Mn as ConvexForeignKeyBuilder, Mr as ColumnBuilder, Mt as VectorSearchProvider, N as OrmReader$1, Nn as ConvexForeignKeyConfig, Nr as ColumnBuilderBaseConfig, Nt as unsetToken, O as defineMigrationSet, On as uniqueIndex, Ot as ReturningResult, P as OrmWriter$1, Pn as ConvexUniqueConstraintBuilder, Pr as ColumnBuilderRuntimeConfig, Qn as OrmSchemaTriggers, Qt as DiscriminatorBuilderConfig, Rn as foreignKey, Rr as DrizzleEntity, Rt as OneConfig, S as MigrationStateMap, Sn as ConvexVectorIndexBuilderOn, Sr as ne, St as MutationRunMode, T as MigrationWriteMode, Tn as index, Tr as notInArray, Tt as PaginatedResult, U as EdgeMetadata, V as RlsContext, Vn as ConvexTextBuilderInitial, Vr as IsUnique, Vt as RelationsBuilderColumnConfig, W as extractRelationsConfig, Wn as Brand, Wt as TableRelationalConfig, Xn as OrmSchemaExtensions, Xt as ConvexTable, Yt as ConvexDeletionConfig, Zn as OrmSchemaRelations, Zt as ConvexTableWithColumns, _ as MigrationManifestEntry, _n as ConvexRankIndexBuilderOn, _r as isNotNull, _t as MutationExecutionMode, an as RlsPolicy, ar as UnaryExpression, at as BuildRelationResult, b as MigrationRunStatus, bn as ConvexSearchIndexConfig, br as lt, bt as MutationResult, cn as rlsPolicy, cr as contains, ct as DBQueryConfig, d as MigrationAppliedState, dn as rlsRole, dr as fieldRef, dt as InferInsertModel, en as OrmLifecycleOperation, er as BinaryExpression, f as MigrationDefinition, fn as ConvexAggregateIndexBuilder, fr as gt, ft as InferModelFromColumns, g as MigrationDriftIssue, gn as ConvexRankIndexBuilder, gr as isFieldReference, gt as MutationExecuteResult, h as MigrationDocContext, hn as ConvexIndexBuilderOn, hr as inArray, ht as MutationExecuteConfig, i as OrmMigrationCapability, in as discriminator, ir as LogicalExpression, it as BuildQueryResult, j as DatabaseWithMutations, jn as ConvexCheckConfig, jr as AnyColumn, jt as VectorQueryConfig, k as detectMigrationDrift, kn as vectorIndex, kr as SystemFields, kt as ReturningSelection, ln as RlsRole, lr as endsWith, lt as FilterOperators, m as MigrationDoc, mn as ConvexIndexBuilder, mr as ilike, mt as InsertValue, n as OrmCapabilities, nn as convexTable, nr as FieldReference, nt as AggregateFieldValue, on as RlsPolicyConfig, or as and, ot as CountConfig, p as MigrationDirection, pn as ConvexAggregateIndexBuilderOn, pr as gte, pt as InferSelectModel, qt as defineRelationsPart, r as OrmCapability, rn as deletion, rr as FilterExpression, rt as AggregateResult, sn as RlsPolicyToOption, sr as between, st as CountResult, t as OrmAggregateCapability, tn as TableConfig, tr as ExpressionVisitor, tt as AggregateConfig, un as RlsRoleConfig, ur as eq, ut as GetColumnData, v as MigrationMigrateOne, vn as ConvexSearchIndexBuilder, vr as isNull, vt as MutationPaginateConfig, w as MigrationTableName, wn as aggregateIndex, wr as notBetween, wt as OrderDirection, x as MigrationSet, xn as ConvexVectorIndexBuilder, xr as lte, xt as MutationReturning, y as MigrationPlan, yn as ConvexSearchIndexBuilderOn, yr as like, yt as MutationPaginatedResult, zn as unique, zr as HasDefault, zt as RelationsBuilder } from "../capabilities-6PZBmvc8.js";
2
- import { $ as OrmClientWithApi$1, A as ConvexDateMode, B as ConvexBytesBuilderInitial, C as ConvexNumberBuilderInitial, D as id, E as ConvexIdBuilderInitial, F as custom, G as ConvexBigIntBuilder, H as ConvexBooleanBuilder, I as json, J as CreateOrmOptions, K as ConvexBigIntBuilderInitial, L as objectOf, M as ConvexCustomBuilder, N as ConvexCustomBuilderInitial, O as ConvexDateBuilder, P as arrayOf, Q as OrmClientBase$1, R as unionOf, S as ConvexNumberBuilder, St as defineTriggers, T as ConvexIdBuilder, U as ConvexBooleanBuilderInitial, V as bytes, W as boolean, X as GenericOrmCtx$1, Y as GenericOrm$1, Z as OrmApiResult, _ as ConvexTimestampMode, _t as OrmBeforeResult, a as requireSchemaRelations, at as ScheduledMutationBatchArgs, b as ConvexTextEnumBuilderInitial, bt as OrmTriggerContext, c as TableConfigResult, ct as scheduledDeleteFactory, d as OrmNotFoundError, et as OrmFunctions, f as ConvexVectorBuilder, g as ConvexTimestampBuilderInitial, gt as defineSchemaExtension, h as ConvexTimestampBuilder, ht as SchemaExtension, i as getSchemaTriggers, it as createOrm, j as date, k as ConvexDateBuilderInitial, l as getTableColumns, m as vector, n as defineSchema, nt as OrmWriterCtx, o as asc, ot as scheduledMutationBatchFactory, p as ConvexVectorBuilderInitial, q as bigint, r as getSchemaRelations, rt as ResolveOrmSchema, s as desc, st as ScheduledDeleteArgs, t as WhereClauseResult, tt as OrmReaderCtx, u as getTableConfig, v as timestamp, vt as OrmTableTriggers, w as integer, x as textEnum, xt as OrmTriggers, y as ConvexTextEnumBuilder, yt as OrmTriggerChange, z as ConvexBytesBuilder } from "../where-clause-compiler-DvYSTJXe.js";
3
- import { i as pretendRequired, n as deprecated, r as pretend } from "../validators-wOIjhkfN.js";
4
- import { a as QueryCtxWithPreferredOrmQueryTable, i as QueryCtxWithOrmQueryTable, n as LookupByIdResultByCtx, o as getByIdWithOrmQueryFallback, r as QueryCtxWithOptionalOrmQueryTable, t as DocByCtx } from "../query-context-DJONf8X5.js";
1
+ import { $n as TableName, $t as OrmLifecycleChange, An as ConvexCheckBuilder, At as UpdateSet, Bn as ConvexTextBuilder, Br as IsPrimaryKey, Bt as RelationsBuilderColumnBase, C as MigrationStep, Cn as ConvexVectorIndexConfig, Cr as not, Ct as OrderByClause, D as defineMigration, Dn as searchIndex, Dr as startsWith, Dt as ReturningAll, E as buildMigrationPlan, En as rankIndex, Er as or, Et as PredicateWhereIndexConfig, Fn as ConvexUniqueConstraintBuilderOn, Fr as ColumnBuilderTypeConfig, Ft as ExtractTablesFromSchema, Gn as Columns, Gt as TablesRelationalConfig, H as RlsMode, Hn as text, Hr as NotNull, In as ConvexUniqueConstraintConfig, Ir as ColumnBuilderWithTableName, It as ExtractTablesWithRelations, Jn as OrmSchemaExtensionTables, Jt as ConvexDeletionBuilder, Kt as defineRelations, Ln as check, Lr as ColumnDataType, Lt as ManyConfig, M as DatabaseWithQuery, Mn as ConvexForeignKeyBuilder, Mr as ColumnBuilder, Mt as VectorSearchProvider, N as OrmReader$1, Nn as ConvexForeignKeyConfig, Nr as ColumnBuilderBaseConfig, Nt as unsetToken, O as defineMigrationSet, On as uniqueIndex, Ot as ReturningResult, P as OrmWriter$1, Pn as ConvexUniqueConstraintBuilder, Pr as ColumnBuilderRuntimeConfig, Qn as OrmSchemaTriggers, Qt as DiscriminatorBuilderConfig, Rn as foreignKey, Rr as DrizzleEntity, Rt as OneConfig, S as MigrationStateMap, Sn as ConvexVectorIndexBuilderOn, Sr as ne, St as MutationRunMode, T as MigrationWriteMode, Tn as index, Tr as notInArray, Tt as PaginatedResult, U as EdgeMetadata, V as RlsContext, Vn as ConvexTextBuilderInitial, Vr as IsUnique, Vt as RelationsBuilderColumnConfig, W as extractRelationsConfig, Wn as Brand, Wt as TableRelationalConfig, Xn as OrmSchemaExtensions, Xt as ConvexTable, Yt as ConvexDeletionConfig, Zn as OrmSchemaRelations, Zt as ConvexTableWithColumns, _ as MigrationManifestEntry, _n as ConvexRankIndexBuilderOn, _r as isNotNull, _t as MutationExecutionMode, an as RlsPolicy, ar as UnaryExpression, at as BuildRelationResult, b as MigrationRunStatus, bn as ConvexSearchIndexConfig, br as lt, bt as MutationResult, cn as rlsPolicy, cr as contains, ct as DBQueryConfig, d as MigrationAppliedState, dn as rlsRole, dr as fieldRef, dt as InferInsertModel, en as OrmLifecycleOperation, er as BinaryExpression, f as MigrationDefinition, fn as ConvexAggregateIndexBuilder, fr as gt, ft as InferModelFromColumns, g as MigrationDriftIssue, gn as ConvexRankIndexBuilder, gr as isFieldReference, gt as MutationExecuteResult, h as MigrationDocContext, hn as ConvexIndexBuilderOn, hr as inArray, ht as MutationExecuteConfig, i as OrmMigrationCapability, in as discriminator, ir as LogicalExpression, it as BuildQueryResult, j as DatabaseWithMutations, jn as ConvexCheckConfig, jr as AnyColumn, jt as VectorQueryConfig, k as detectMigrationDrift, kn as vectorIndex, kr as SystemFields, kt as ReturningSelection, ln as RlsRole, lr as endsWith, lt as FilterOperators, m as MigrationDoc, mn as ConvexIndexBuilder, mr as ilike, mt as InsertValue, n as OrmCapabilities, nn as convexTable, nr as FieldReference, nt as AggregateFieldValue, on as RlsPolicyConfig, or as and, ot as CountConfig, p as MigrationDirection, pn as ConvexAggregateIndexBuilderOn, pr as gte, pt as InferSelectModel, qt as defineRelationsPart, r as OrmCapability, rn as deletion, rr as FilterExpression, rt as AggregateResult, sn as RlsPolicyToOption, sr as between, st as CountResult, t as OrmAggregateCapability, tn as TableConfig, tr as ExpressionVisitor, tt as AggregateConfig, un as RlsRoleConfig, ur as eq, ut as GetColumnData, v as MigrationMigrateOne, vn as ConvexSearchIndexBuilder, vr as isNull, vt as MutationPaginateConfig, w as MigrationTableName, wn as aggregateIndex, wr as notBetween, wt as OrderDirection, x as MigrationSet, xn as ConvexVectorIndexBuilder, xr as lte, xt as MutationReturning, y as MigrationPlan, yn as ConvexSearchIndexBuilderOn, yr as like, yt as MutationPaginatedResult, zn as unique, zr as HasDefault, zt as RelationsBuilder } from "../capabilities-DPB-JKlm.js";
2
+ import { $ as OrmClientWithApi$1, A as ConvexDateMode, B as ConvexBytesBuilderInitial, C as ConvexNumberBuilderInitial, D as id, E as ConvexIdBuilderInitial, F as custom, G as ConvexBigIntBuilder, H as ConvexBooleanBuilder, I as json, J as CreateOrmOptions, K as ConvexBigIntBuilderInitial, L as objectOf, M as ConvexCustomBuilder, N as ConvexCustomBuilderInitial, O as ConvexDateBuilder, P as arrayOf, Q as OrmClientBase$1, R as unionOf, S as ConvexNumberBuilder, St as defineTriggers, T as ConvexIdBuilder, U as ConvexBooleanBuilderInitial, V as bytes, W as boolean, X as GenericOrmCtx$1, Y as GenericOrm$1, Z as OrmApiResult, _ as ConvexTimestampMode, _t as OrmBeforeResult, a as requireSchemaRelations, at as ScheduledMutationBatchArgs, b as ConvexTextEnumBuilderInitial, bt as OrmTriggerContext, c as TableConfigResult, ct as scheduledDeleteFactory, d as OrmNotFoundError, et as OrmFunctions, f as ConvexVectorBuilder, g as ConvexTimestampBuilderInitial, gt as defineSchemaExtension, h as ConvexTimestampBuilder, ht as SchemaExtension, i as getSchemaTriggers, it as createOrm, j as date, k as ConvexDateBuilderInitial, l as getTableColumns, m as vector, n as defineSchema, nt as OrmWriterCtx, o as asc, ot as scheduledMutationBatchFactory, p as ConvexVectorBuilderInitial, q as bigint, r as getSchemaRelations, rt as ResolveOrmSchema, s as desc, st as ScheduledDeleteArgs, t as WhereClauseResult, tt as OrmReaderCtx, u as getTableConfig, v as timestamp, vt as OrmTableTriggers, w as integer, x as textEnum, xt as OrmTriggers, y as ConvexTextEnumBuilder, yt as OrmTriggerChange, z as ConvexBytesBuilder } from "../where-clause-compiler-Dddhscyy.js";
3
+ import { i as pretendRequired, n as deprecated, r as pretend } from "../validators-0I-Ik1EN.js";
4
+ import { a as QueryCtxWithPreferredOrmQueryTable, i as QueryCtxWithOrmQueryTable, n as LookupByIdResultByCtx, o as getByIdWithOrmQueryFallback, r as QueryCtxWithOptionalOrmQueryTable, t as DocByCtx } from "../query-context-BkNjkDCk.js";
5
5
  import { DefineSchemaOptions, GenericDatabaseReader, GenericDatabaseWriter, GenericSchema, SchemaDefinition } from "convex/server";
6
6
 
7
7
  //#region src/orm/index.d.ts
package/dist/orm/index.js CHANGED
@@ -1,11 +1,12 @@
1
- import { A as integer, C as index, D as vectorIndex, E as uniqueIndex, F as unionOf, I as ConvexColumnBuilder, L as entityKind, M as custom, N as json, O as text, P as objectOf, S as aggregateIndex, T as searchIndex, a as Columns, b as RlsPolicy, c as OrmSchemaDefinition, d as OrmSchemaExtensionTriggers, f as OrmSchemaExtensions, g as RlsPolicies, h as OrmSchemaTriggers, i as Brand, j as arrayOf, k as createSystemFields, l as OrmSchemaExtensionRelations, m as OrmSchemaRelations, n as deletion, o as EnableRLS, p as OrmSchemaOptions, r as discriminator, s as OrmContext, t as convexTable, u as OrmSchemaExtensionTables, v as TableName, w as rankIndex, x as rlsPolicy, y as TablePolymorphic } from "../table-CX2lnX7e.js";
2
- import { d as boolean, i as detectMigrationDrift, l as migrationExtension, n as defineMigration, r as defineMigrationSet, t as buildMigrationPlan } from "../definitions-DS8ZDc74.js";
1
+ import { _ as json, a as rlsPolicy, b as ConvexColumnBuilder, c as rankIndex, d as vectorIndex, f as text, g as custom, h as arrayOf, i as RlsPolicy, l as searchIndex, m as integer, n as deletion, o as aggregateIndex, p as createSystemFields, r as discriminator, s as index, t as convexTable, u as uniqueIndex, v as objectOf, x as entityKind, y as unionOf } from "../table-d9o_n4R3.js";
2
+ import { d as boolean, i as detectMigrationDrift, l as migrationExtension, n as defineMigration, r as defineMigrationSet, t as buildMigrationPlan } from "../definitions-3PX4ywR-.js";
3
3
  import { a as pretendRequired, i as pretend, n as deprecated } from "../validators-CIoUYCqO.js";
4
- import { t as id } from "../id-CuSfWa5q.js";
5
- import { A as or, C as matchLikePattern, D as notIlike, E as notBetween, O as notInArray, S as lte, T as not, _ as isFieldReference, a as between, b as like, c as endsWith, d as filterValueInList, f as filterValuesEqual, g as inArray, h as ilike, i as arrayOverlaps, j as startsWith, k as notLike, l as eq, m as gte, n as arrayContained, o as column, p as gt, r as arrayContains, s as contains, t as and, u as fieldRef, v as isNotNull, w as ne, x as lt, y as isNull } from "../filter-expression-Dydt8wS0.js";
6
- import { a as indexKeyWithinBounds, c as streamIndexRange, i as getIndexFields, l as isUnsetToken, n as EmptyStream, o as mergedStream, r as QueryStream, s as stream, t as getByIdWithOrmQueryFallback, u as unsetToken } from "../query-context-DOm5Xm3H.js";
7
- import { $ as patchReferencingRows, A as enforcePolymorphicWrite, B as getForeignKeys, C as collectPrimaryIdLookupRows, Ct as getRankIndexes, D as encodeUndefinedDeep, Dt as PUBLIC_CREATED_AT_FIELD, E as deserializeFilterExpression, Et as INTERNAL_CREATION_TIME_FIELD, F as evaluateCheckConstraintTriState, G as getTableColumns$2, H as getMutationCollectionLimits, I as evaluateFilter, J as getUniqueIndexes, K as getTableDeleteConfig, L as extractPrimaryIdLookup, M as ensureDefaultColumns, N as ensureNonNullValues, O as enforceCheckConstraints, Ot as usesSystemCreatedAtAlias, P as ensureNullableColumns, Q as normalizeTemporalComparableValue, R as getChecks, S as collectMutationRowsBounded, St as getIndexes, T as decodeUndefinedDeep, Tt as CREATED_AT_MIGRATION_MESSAGE, U as getMutationExecutionMode, V as getMutationAsyncDelayMs, W as getOrmContext, X as hydrateDateFieldsForRead, Y as hardDeleteRow, Z as normalizeDateFieldsForWrite, _ as applyDefaults, _t as findIndexForColumns, at as splitReturningSelection, b as buildForeignKeyGraph, bt as findVectorIndexByName, c as getAggregateIndexDefinitions, ct as toConvexFilter, d as COUNT_ERROR, dt as markLifecycleHookedTables, et as resolveOrmRuntimeDefaults, f as createAggregateError, ft as compileConvexFilter, g as ensureCountAllowedForRls, gt as findExactIndexForColumns, h as ensureAggregateAllowedForRls, ht as mapWithConcurrency, it as softDeleteRow, j as enforceUniqueIndexes, k as enforceForeignKeys, l as getRankIndexDefinitions, lt as unsetFieldsOf, mt as isConvexEnforceableFilter, nt as selectReturningRowWithHydration, o as aggregateExtension, ot as stripUnsetFields, p as createCountError, pt as convexAnd, q as getTableName, rt as serializeFilterExpression, st as takeRowsWithinByteBudget, tt as returningSelectionReadsCreationTime, u as AGGREGATE_ERROR, ut as hasLifecycleHooks, v as applyIncomingForeignKeyActionsOnDelete, vt as findRelationIndex, w as createForeignKeyProbeMemo, wt as resolveIndexOrderPushdown, x as canUsePrimaryIdLookupCursor, xt as getAggregateIndexes, y as applyIncomingForeignKeyActionsOnUpdate, yt as findSearchIndexByName, z as getColumnName$1 } from "../schema-D8ZZMSKd.js";
8
- import { t as defineSchemaExtension } from "../extensions-Blzsyekm.js";
4
+ import { t as id } from "../id-BVdWER1U.js";
5
+ import { a as OrmSchemaDefinition, c as OrmSchemaExtensionTriggers, d as OrmSchemaRelations, f as OrmSchemaTriggers, g as TablePolymorphic, h as TableName, i as OrmContext, l as OrmSchemaExtensions, n as Columns, o as OrmSchemaExtensionRelations, p as RlsPolicies, r as EnableRLS, s as OrmSchemaExtensionTables, t as Brand, u as OrmSchemaOptions } from "../symbols-DDNAddkd.js";
6
+ import { A as inArray, B as notBetween, C as eq, D as gt, E as filterValuesEqual, F as lt, G as startsWith, H as notInArray, I as lte, L as matchLikePattern, M as isNotNull, N as isNull, O as gte, P as like, R as ne, S as endsWith, T as filterValueInList, U as notLike, V as notIlike, W as or, _ as arrayContains, a as findVectorIndexByName, b as column, c as getRankIndexes, d as INTERNAL_CREATION_TIME_FIELD, f as PUBLIC_CREATED_AT_FIELD, g as arrayContained, h as and, i as findSearchIndexByName, j as isFieldReference, k as ilike, l as resolveIndexOrderPushdown, m as usesSystemCreatedAtAlias, n as findIndexForColumns, o as getAggregateIndexes, r as findRelationIndex, s as getIndexes, t as findExactIndexForColumns, u as CREATED_AT_MIGRATION_MESSAGE, v as arrayOverlaps, w as fieldRef, x as contains, y as between, z as not } from "../index-utils-C1DyktHe.js";
7
+ import { a as indexKeyWithinBounds, c as streamIndexRange, i as getIndexFields, l as isUnsetToken, n as EmptyStream, o as mergedStream, r as QueryStream, s as stream, t as getByIdWithOrmQueryFallback, u as unsetToken } from "../query-context-DdSg3fuk.js";
8
+ import { $ as patchReferencingRows, A as enforcePolymorphicWrite, B as getForeignKeys, C as collectPrimaryIdLookupRows, D as encodeUndefinedDeep, E as deserializeFilterExpression, F as evaluateCheckConstraintTriState, G as getTableColumns$2, H as getMutationCollectionLimits, I as evaluateFilter, J as getUniqueIndexes, K as getTableDeleteConfig, L as extractPrimaryIdLookup, M as ensureDefaultColumns, N as ensureNonNullValues, O as enforceCheckConstraints, P as ensureNullableColumns, Q as normalizeTemporalComparableValue, R as getChecks, S as collectMutationRowsBounded, T as decodeUndefinedDeep, U as getMutationExecutionMode, V as getMutationAsyncDelayMs, W as getOrmContext, X as hydrateDateFieldsForRead, Y as hardDeleteRow, Z as normalizeDateFieldsForWrite, _ as applyDefaults, at as splitReturningSelection, b as buildForeignKeyGraph, c as getAggregateIndexDefinitions, ct as toConvexFilter, d as COUNT_ERROR, dt as markLifecycleHookedTables, et as resolveOrmRuntimeDefaults, f as createAggregateError, ft as compileConvexFilter, g as ensureCountAllowedForRls, h as ensureAggregateAllowedForRls, ht as mapWithConcurrency, it as softDeleteRow, j as enforceUniqueIndexes, k as enforceForeignKeys, l as getRankIndexDefinitions, lt as unsetFieldsOf, mt as isConvexEnforceableFilter, nt as selectReturningRowWithHydration, o as aggregateExtension, ot as stripUnsetFields, p as createCountError, pt as convexAnd, q as getTableName, rt as serializeFilterExpression, st as takeRowsWithinByteBudget, tt as returningSelectionReadsCreationTime, u as AGGREGATE_ERROR, ut as hasLifecycleHooks, v as applyIncomingForeignKeyActionsOnDelete, w as createForeignKeyProbeMemo, x as canUsePrimaryIdLookupCursor, y as applyIncomingForeignKeyActionsOnUpdate, z as getColumnName$1 } from "../schema-hL2FWCE7.js";
9
+ import { t as defineSchemaExtension } from "../extensions-Bp0XHanR.js";
9
10
  import { compareValues, convexToJson, jsonToConvex, v } from "convex/values";
10
11
  import { defineSchema as defineSchema$1, internalActionGeneric, internalMutationGeneric, internalQueryGeneric } from "convex/server";
11
12
 
@@ -1,3 +1,3 @@
1
- import { C as MigrationStep, D as defineMigration, E as buildMigrationPlan, O as defineMigrationSet, S as MigrationStateMap, T as MigrationWriteMode, _ as MigrationManifestEntry, a as MAX_STATUS_RUN_LIMIT, b as MigrationRunStatus, c as MigrationRunChunkArgs, d as MigrationAppliedState, f as MigrationDefinition, g as MigrationDriftIssue, h as MigrationDocContext, k as detectMigrationDrift, l as MigrationStatusArgs, m as MigrationDoc, o as MigrationCancelArgs, p as MigrationDirection, s as MigrationRunArgs, u as createMigrationHandlers, v as MigrationMigrateOne, w as MigrationTableName, x as MigrationSet, y as MigrationPlan } from "../../capabilities-6PZBmvc8.js";
2
- import { Ct as migrationCapability, dt as MIGRATION_STORAGE_TABLE_NAMES, ft as injectMigrationStorageTables, lt as MIGRATION_RUN_TABLE, mt as migrationStorageTables, pt as migrationExtension, ut as MIGRATION_STATE_TABLE } from "../../where-clause-compiler-DvYSTJXe.js";
1
+ import { C as MigrationStep, D as defineMigration, E as buildMigrationPlan, O as defineMigrationSet, S as MigrationStateMap, T as MigrationWriteMode, _ as MigrationManifestEntry, a as MAX_STATUS_RUN_LIMIT, b as MigrationRunStatus, c as MigrationRunChunkArgs, d as MigrationAppliedState, f as MigrationDefinition, g as MigrationDriftIssue, h as MigrationDocContext, k as detectMigrationDrift, l as MigrationStatusArgs, m as MigrationDoc, o as MigrationCancelArgs, p as MigrationDirection, s as MigrationRunArgs, u as createMigrationHandlers, v as MigrationMigrateOne, w as MigrationTableName, x as MigrationSet, y as MigrationPlan } from "../../capabilities-DPB-JKlm.js";
2
+ import { Ct as migrationCapability, dt as MIGRATION_STORAGE_TABLE_NAMES, ft as injectMigrationStorageTables, lt as MIGRATION_RUN_TABLE, mt as migrationStorageTables, pt as migrationExtension, ut as MIGRATION_STATE_TABLE } from "../../where-clause-compiler-Dddhscyy.js";
3
3
  export { MAX_STATUS_RUN_LIMIT, MIGRATION_RUN_TABLE, MIGRATION_STATE_TABLE, MIGRATION_STORAGE_TABLE_NAMES, 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, buildMigrationPlan, createMigrationHandlers, defineMigration, defineMigrationSet, detectMigrationDrift, injectMigrationStorageTables, migrationCapability, migrationExtension, migrationStorageTables };
@@ -1,4 +1,4 @@
1
- import { a as MIGRATION_RUN_TABLE, c as injectMigrationStorageTables, i as detectMigrationDrift, l as migrationExtension, n as defineMigration, o as MIGRATION_STATE_TABLE, r as defineMigrationSet, s as MIGRATION_STORAGE_TABLE_NAMES, t as buildMigrationPlan, u as migrationStorageTables } from "../../definitions-DS8ZDc74.js";
1
+ import { a as MIGRATION_RUN_TABLE, c as injectMigrationStorageTables, i as detectMigrationDrift, l as migrationExtension, n as defineMigration, o as MIGRATION_STATE_TABLE, r as defineMigrationSet, s as MIGRATION_STORAGE_TABLE_NAMES, t as buildMigrationPlan, u as migrationStorageTables } from "../../definitions-3PX4ywR-.js";
2
2
 
3
3
  //#region src/orm/migrations/runtime.ts
4
4
  const DEFAULT_BATCH_SIZE = 128;
@@ -1,2 +1,2 @@
1
- import { a as PluginConfigureResolver, i as PluginConfigureInput, n as PluginApiScope, o as definePlugin, r as PluginConfigureContext, s as resolvePluginOptions, t as Plugin } from "../middleware-CE_MC6Gi.js";
1
+ import { a as PluginConfigureResolver, i as PluginConfigureInput, n as PluginApiScope, o as definePlugin, r as PluginConfigureContext, s as resolvePluginOptions, t as Plugin } from "../middleware-BBS7oLtT.js";
2
2
  export { type Plugin, type PluginApiScope, type PluginConfigureContext, type PluginConfigureInput, type PluginConfigureResolver, definePlugin, resolvePluginOptions };
@@ -1,3 +1,3 @@
1
- import { n as resolvePluginOptions, t as definePlugin } from "../middleware-BvnabcNq.js";
1
+ import { n as resolvePluginOptions, t as definePlugin } from "../middleware-D61Nm-iB.js";
2
2
 
3
3
  export { definePlugin, resolvePluginOptions };
@@ -1,5 +1,5 @@
1
- import { i as decodeWire, o as encodeWire } from "./transformer-D8wO-kEj.js";
2
- import { _ as CRPCError } from "./builder-CsAw-DK8.js";
1
+ import { i as decodeWire, o as encodeWire } from "./transformer-C8lVwHNT.js";
2
+ import { _ as CRPCError } from "./builder-Cyd5nCxZ.js";
3
3
  import * as z$1 from "zod";
4
4
 
5
5
  //#region src/server/env.ts
@@ -1,6 +1,6 @@
1
- import { t as VRequired } from "./validators-wOIjhkfN.js";
2
- import { A as HttpProcedureBuilderDef, D as HttpHandlerOpts, L as DataTransformerOptions, N as ProcedureMeta, O as HttpMethod, W as getTransformer, _ as CRPCHttpRouter, f as InferHttpInput, k as HttpProcedure, p as InferHttpOutput, y as HttpRouterRecord } from "./http-types-90mapMP9.js";
3
- import { g as UnsetMarker, i as IntersectIfDefined, o as MiddlewareBuilder, p as Overwrite$1, s as MiddlewareFunction, t as AnyMiddleware } from "./types-eNzQmbqM.js";
1
+ import { t as VRequired } from "./validators-0I-Ik1EN.js";
2
+ import { A as HttpProcedureBuilderDef, D as HttpHandlerOpts, L as DataTransformerOptions, N as ProcedureMeta, O as HttpMethod, W as getTransformer, _ as CRPCHttpRouter, f as InferHttpInput, k as HttpProcedure, p as InferHttpOutput, y as HttpRouterRecord } from "./http-types-BhhPZtwa.js";
3
+ import { g as UnsetMarker, i as IntersectIfDefined, o as MiddlewareBuilder, p as Overwrite$1, s as MiddlewareFunction, t as AnyMiddleware } from "./types-Bkeicpo6.js";
4
4
  import { ConvexError, GenericId, GenericValidator, ObjectType, OptionalProperty, PropertyValidators, VAny, VArray, VBoolean, VBytes, VFloat64, VId, VInt64, VLiteral, VNull, VObject, VOptional, VRecord, VString, VUnion, Validator, Value as Value$1 } from "convex/values";
5
5
  import { ActionBuilder, ArgsArrayToObject, DefaultFunctionArgs, FunctionReference, FunctionReturnType, FunctionVisibility, GenericActionCtx, GenericDataModel, GenericMutationCtx, GenericQueryCtx, MutationBuilder, QueryBuilder, RegisteredAction, RegisteredMutation, RegisteredQuery, TableNamesInDataModel } from "convex/server";
6
6
  import * as z$1 from "zod";
@@ -1,5 +1,5 @@
1
- import { o as MiddlewareBuilder } from "../types-eNzQmbqM.js";
2
- import { t as Plugin } from "../middleware-CE_MC6Gi.js";
1
+ import { o as MiddlewareBuilder } from "../types-Bkeicpo6.js";
2
+ import { t as Plugin } from "../middleware-BBS7oLtT.js";
3
3
  import * as convex_server0 from "convex/server";
4
4
 
5
5
  //#region src/ratelimit/duration.d.ts
@@ -1,6 +1,6 @@
1
- import { u as requireMutationCtx } from "../api-entry-CkDpGYVg.js";
2
- import { _ as CRPCError } from "../builder-CsAw-DK8.js";
3
- import { t as definePlugin } from "../middleware-BvnabcNq.js";
1
+ import { u as requireMutationCtx } from "../api-entry-Buvjl9hn.js";
2
+ import { _ as CRPCError } from "../builder-Cyd5nCxZ.js";
3
+ import { t as definePlugin } from "../middleware-D61Nm-iB.js";
4
4
  import { v } from "convex/values";
5
5
  import { mutationGeneric, queryGeneric } from "convex/server";
6
6
 
@@ -1,7 +1,7 @@
1
- import { n as DeepPartial, o as Simplify, r as DistributiveOmit } from "../types-MHYXboyy.js";
2
- import { L as DataTransformerOptions, _ as CRPCHttpRouter, c as HttpQueryKey, k as HttpProcedure, o as HttpMutationKey, y as HttpRouterRecord } from "../http-types-90mapMP9.js";
3
- import { g as UnsetMarker } from "../types-eNzQmbqM.js";
4
- import { A as HttpInputArgs, C as ReservedMutationOptions$1, S as ReservedInfiniteQueryOptions, T as StaticQueryOptsParam, _ as IsPaginated, b as PaginatedFnMeta, c as ConvexMutationKey, d as ConvexQueryMeta, f as EmptyObject, g as InfiniteQueryInput, l as ConvexQueryHookOptions, m as FUNC_REF_SYMBOL, o as ConvexActionKey, p as ExtractPaginatedItem, s as ConvexInfiniteQueryMeta, u as ConvexQueryKey, w as ReservedQueryOptions$1, y as MutationVariables } from "../types-In-ZZOsd.js";
1
+ import { n as DeepPartial, o as Simplify, r as DistributiveOmit } from "../types-Bqi_ivSd.js";
2
+ import { L as DataTransformerOptions, _ as CRPCHttpRouter, c as HttpQueryKey, k as HttpProcedure, o as HttpMutationKey, y as HttpRouterRecord } from "../http-types-BhhPZtwa.js";
3
+ import { g as UnsetMarker } from "../types-Bkeicpo6.js";
4
+ import { A as HttpInputArgs, C as ReservedMutationOptions$1, S as ReservedInfiniteQueryOptions, T as StaticQueryOptsParam, _ as IsPaginated, b as PaginatedFnMeta, c as ConvexMutationKey, d as ConvexQueryMeta, f as EmptyObject, g as InfiniteQueryInput, l as ConvexQueryHookOptions, m as FUNC_REF_SYMBOL, o as ConvexActionKey, p as ExtractPaginatedItem, s as ConvexInfiniteQueryMeta, u as ConvexQueryKey, w as ReservedQueryOptions$1, y as MutationVariables } from "../types-BXpu7xIU.js";
5
5
  import { FunctionArgs, FunctionReference, FunctionReturnType } from "convex/server";
6
6
  import { z } from "zod";
7
7
  import { DefaultError, QueryFilters, SkipToken, UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
package/dist/rsc/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { n as defaultIsUnauthorized } from "../error-CMLeCadS.js";
2
- import { n as getFuncRef, r as getFunctionMeta, t as buildMetaIndex } from "../meta-utils-D2lqN2Lg.js";
3
- import { o as encodeWire, s as getTransformer } from "../transformer-D8wO-kEj.js";
4
- import { c as HTTP_DEFAULT_STALE_TIME, n as convexInfiniteQueryOptions, o as executeHttpRequest, r as convexQuery, u as buildHttpQueryKey } from "../query-options-DUiOj01a.js";
1
+ import { n as defaultIsUnauthorized } from "../error-Dyqhgbf6.js";
2
+ import { n as getFuncRef, r as getFunctionMeta, t as buildMetaIndex } from "../meta-utils-Cc7neQOB.js";
3
+ import { o as encodeWire, s as getTransformer } from "../transformer-C8lVwHNT.js";
4
+ import { c as HTTP_DEFAULT_STALE_TIME, n as convexInfiniteQueryOptions, o as executeHttpRequest, r as convexQuery, u as buildHttpQueryKey } from "../query-options-DGG93--5.js";
5
5
  import { convexToJson } from "convex/values";
6
6
  import { getFunctionName } from "convex/server";
7
7
  import { fetchAction, fetchQuery } from "convex/nextjs";
@@ -1,5 +1,5 @@
1
- import { A as integer, C as index, M as custom, O as text, t as convexTable } from "./table-CX2lnX7e.js";
2
- import { t as id } from "./id-CuSfWa5q.js";
1
+ import { f as text, g as custom, m as integer, s as index, t as convexTable } from "./table-d9o_n4R3.js";
2
+ import { t as id } from "./id-BVdWER1U.js";
3
3
  import { ConvexError, convexToJson, jsonToConvex, v } from "convex/values";
4
4
 
5
5
  //#region src/aggregate-core/compare.ts