kitcn 0.23.0 → 0.25.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 (85) hide show
  1. package/dist/aggregate/index.d.ts +11 -1
  2. package/dist/aggregate/index.js +1 -1
  3. package/dist/auth/generated/index.d.ts +1 -1
  4. package/dist/auth/generated/index.js +1 -1
  5. package/dist/auth/http/index.d.ts +1 -1
  6. package/dist/auth/index.d.ts +4 -4
  7. package/dist/auth/index.js +10 -9
  8. package/dist/auth/nextjs/index.d.ts +2 -2
  9. package/dist/auth/nextjs/index.js +3 -3
  10. package/dist/auth/start/server/index.d.ts +1 -1
  11. package/dist/auth/start/server/index.js +1 -1
  12. package/dist/{builder-CsxVc5xC.js → builder-1Vx-tEnS.js} +3 -3
  13. package/dist/{caller-factory-CWa0ELLD.js → caller-factory-Dd3H7j3V.js} +3 -3
  14. package/dist/{where-clause-compiler-B_H3oio5.d.ts → capabilities-Bem7xvGK.d.ts} +2958 -4145
  15. package/dist/cli.mjs +155 -60
  16. package/dist/{convex-plugin-D8B0oCFq.js → convex-plugin-DfOhBU9g.js} +1 -1
  17. package/dist/{create-schema-orm-B3f2Kc8O.js → create-schema-orm-Bu2JCiBS.js} +1 -1
  18. package/dist/crpc/index.d.ts +3 -3
  19. package/dist/crpc/index.js +4 -4
  20. package/dist/{customFunctions-DxEEO4Dq.js → customFunctions-BbhgdRGl.js} +2 -2
  21. package/dist/definitions-D9vhJ6OV.js +215 -0
  22. package/dist/extensions-DzjCJXYl.js +55 -0
  23. package/dist/filter-expression-Dydt8wS0.js +402 -0
  24. package/dist/{generated-contract-disabled-B-nmd7Ne.d.ts → generated-contract-disabled-BEc4d98x.d.ts} +2 -2
  25. package/dist/{http-types-BoSDAh4Y.d.ts → http-types-90mapMP9.d.ts} +33 -3
  26. package/dist/id-Bibg34Yb.js +37 -0
  27. package/dist/{local-env-yFKub75x.mjs → local-env-Du24tdbp.mjs} +2243 -2113
  28. package/dist/{middleware-Br5zubu7.d.ts → middleware-CE_MC6Gi.d.ts} +1 -1
  29. package/dist/{middleware-DUd1Sj39.js → middleware-cJDRHTRY.js} +1 -1
  30. package/dist/orm/aggregate-index/index.d.ts +20 -0
  31. package/dist/orm/aggregate-index/index.js +2136 -0
  32. package/dist/orm/index.d.ts +5 -4
  33. package/dist/orm/index.js +126 -4292
  34. package/dist/orm/migrations/index.d.ts +3 -0
  35. package/dist/orm/migrations/index.js +506 -0
  36. package/dist/plugins/index.d.ts +1 -1
  37. package/dist/plugins/index.js +1 -1
  38. package/dist/{procedure-caller-DQxnLBS_.js → procedure-caller-DIzXfX2E.js} +2 -2
  39. package/dist/{procedure-name-C55TynK3.d.ts → procedure-name-B09-cf1-.d.ts} +3 -3
  40. package/dist/{query-context-BzihIpnM.js → query-context-DOm5Xm3H.js} +1 -402
  41. package/dist/{query-options-C_eBSIXG.js → query-options-DUiOj01a.js} +33 -1
  42. package/dist/ratelimit/index.d.ts +47 -11
  43. package/dist/ratelimit/index.js +256 -102
  44. package/dist/react/index.d.ts +9 -6
  45. package/dist/react/index.js +36 -17
  46. package/dist/rsc/index.d.ts +6 -9
  47. package/dist/rsc/index.js +7 -11
  48. package/dist/runtime-DfGsZtx3.js +1074 -0
  49. package/dist/schema-Besl-rpv.js +1411 -0
  50. package/dist/server/index.d.ts +4 -4
  51. package/dist/server/index.js +4 -4
  52. package/dist/solid/index.d.ts +9 -6
  53. package/dist/solid/index.js +36 -17
  54. package/dist/{runtime-6DJxpDfb.js → table-rmJm5Qio.js} +3 -1095
  55. package/dist/{token-xlpENMVn.js → token-DcV_0fkF.js} +1 -1
  56. package/dist/{types-C0Xl7P8K.d.ts → types-In-ZZOsd.d.ts} +1 -1
  57. package/dist/{validators-C7LelqTN.js → validators-Dmbhsd3U.js} +1 -1
  58. package/dist/watcher.mjs +1 -1
  59. package/dist/where-clause-compiler-mohWFiG0.d.ts +2042 -0
  60. package/package.json +3 -2
  61. package/skills/kitcn/SKILL.md +19 -18
  62. package/skills/kitcn/references/features/aggregates.md +21 -0
  63. package/skills/kitcn/references/features/auth-organizations.md +3 -3
  64. package/skills/kitcn/references/features/auth-polar.md +2 -1
  65. package/skills/kitcn/references/features/auth.md +8 -1
  66. package/skills/kitcn/references/features/http.md +26 -1
  67. package/skills/kitcn/references/features/ratelimit.md +11 -0
  68. package/skills/kitcn/references/features/react.md +1 -1
  69. package/skills/kitcn/references/setup/auth.md +52 -42
  70. package/skills/kitcn/references/setup/index.md +1 -1
  71. package/skills/kitcn/references/setup/server.md +37 -6
  72. /package/dist/{api-entry-N3nBOlI2.js → api-entry-CkDpGYVg.js} +0 -0
  73. /package/dist/{context-utils-BBUtBqjN.d.ts → context-utils-DwZ3Cam1.d.ts} +0 -0
  74. /package/dist/{create-schema-BXrKE2YY.js → create-schema-BRFjdgRr.js} +0 -0
  75. /package/dist/{error-Bvo7YEhk.js → error-CMLeCadS.js} +0 -0
  76. /package/dist/{generated-contract-disabled-BXaz7JCE.js → generated-contract-disabled-CZa0iyV0.js} +0 -0
  77. /package/dist/{meta-utils-D9K4fICl.js → meta-utils-D2lqN2Lg.js} +0 -0
  78. /package/dist/{query-context-CNo9ffvI.d.ts → query-context-DJONf8X5.d.ts} +0 -0
  79. /package/dist/{token-B9Bjcqug.d.ts → token-kQaqFby4.d.ts} +0 -0
  80. /package/dist/{transformer-yZuBWo8v.js → transformer-D8wO-kEj.js} +0 -0
  81. /package/dist/{types-BCl8gfGy.d.ts → types-Bf3XQex5.d.ts} +0 -0
  82. /package/dist/{types-DF2cg_w0.d.ts → types-MHYXboyy.d.ts} +0 -0
  83. /package/dist/{types-CnTpHR1F.d.ts → types-eNzQmbqM.d.ts} +0 -0
  84. /package/dist/{upstream-BR6sBLg3.js → upstream-BCgGZX6q.js} +0 -0
  85. /package/dist/{validators-BhsByJeg.d.ts → validators-V4eM2-Jg.d.ts} +0 -0
@@ -0,0 +1,2042 @@
1
+ import { Bn as ConvexTextBuilderInitial, Dr as SystemFieldAliases, F as DeleteMode, Gn as OrmRuntimeDefaults, H as EdgeMetadata, Hn as ConvexColumnBuilder, Hr as entityKind, Ht as RelationsConfigWithSchema, I as SerializedFilterExpression, Jn as OrmSchemaExtensionTriggers, Kn as OrmSchemaExtensionRelations, L as getChecks, M as OrmReader, Mr as ColumnBuilderBaseConfig, N as OrmWriter, Nt as AnyRelationsBuilderConfig, Or as SystemFields, P as CascadeMode, Pt as ExtractTablesFromSchema, Qt as OrmLifecycleChange, R as getForeignKeys, Rr as HasDefault, Rt as RelationsBuilder, St as OrderByClause, Ut as TableRelationalConfig, Vr as NotNull, Vt as RelationsBuilderConfigValue, Wn as Columns, Wt as TablesRelationalConfig, Xn as OrmSchemaRelations, Xt as ConvexTableWithColumns, Yt as ConvexTable, Zn as OrmSchemaTriggers, b as MigrationSet, ft as InferSelectModel, in as RlsPolicy, jr as ColumnBuilder, jt as VectorSearchProvider, k as CreateDatabaseOptions, kr as $Type, nr as FilterExpression$1, r as OrmCapability, ut as InferInsertModel, z as getUniqueIndexes } from "./capabilities-Bem7xvGK.js";
2
+ import * as convex_values0 from "convex/values";
3
+ import { GenericId, Validator, Value } from "convex/values";
4
+ import { DefineSchemaOptions, GenericDatabaseReader, GenericDatabaseWriter, GenericSchema, SchedulableFunctionReference, Scheduler, SchemaDefinition, internalActionGeneric, internalMutationGeneric } from "convex/server";
5
+
6
+ //#region src/orm/migrations/capability.d.ts
7
+ /**
8
+ * Registers the migration runtime with `createOrm()`.
9
+ *
10
+ * Required by the migration handlers exposed through `orm.api()`. Importing
11
+ * this pulls the migration runtime into the calling Convex module, so only
12
+ * register it where it is actually used.
13
+ */
14
+ declare const migrationCapability: () => OrmCapability;
15
+ //#endregion
16
+ //#region src/orm/triggers.d.ts
17
+ type MaybePromise<T> = T | Promise<T>;
18
+ type AnyRecord = Record<string, unknown>;
19
+ type KnownKeys<T> = { [K in keyof T]-?: string extends K ? never : number extends K ? never : symbol extends K ? never : K }[keyof T];
20
+ type TriggerTableName<TSchema extends TablesRelationalConfig> = { [K in KnownKeys<TSchema>]-?: TSchema[K] extends TableRelationalConfig ? K extends string ? K : never : never }[KnownKeys<TSchema>];
21
+ type TriggerDoc<TSchema extends TablesRelationalConfig, TTableName extends TriggerTableName<TSchema>> = TSchema[TTableName] extends TableRelationalConfig ? InferSelectModel<TSchema[TTableName]['table']> : never;
22
+ type TriggerInsertData<TSchema extends TablesRelationalConfig, TTableName extends TriggerTableName<TSchema>> = TSchema[TTableName] extends TableRelationalConfig ? InferInsertModel<TSchema[TTableName]['table']> : never;
23
+ type TriggerUpdateData<TSchema extends TablesRelationalConfig, TTableName extends TriggerTableName<TSchema>> = Partial<TriggerInsertData<TSchema, TTableName>>;
24
+ type OrmTriggerContext<TSchema extends TablesRelationalConfig, TExtraCtx extends object = {}> = Omit<TExtraCtx, 'db' | 'innerDb' | 'orm'> & {
25
+ db: GenericDatabaseWriter<any>;
26
+ innerDb: GenericDatabaseWriter<any>;
27
+ orm: OrmWriter<TSchema>;
28
+ };
29
+ type TriggerChangeId<TDoc> = TDoc extends {
30
+ _id: infer TId;
31
+ } ? TId : TDoc extends {
32
+ id: infer TId;
33
+ } ? TId : unknown;
34
+ type OrmTriggerChange<TDoc = AnyRecord, TId = TriggerChangeId<TDoc>> = OrmLifecycleChange<TDoc, TId>;
35
+ type OrmBeforeResult<TData extends AnyRecord> = void | false | {
36
+ data: Partial<TData>;
37
+ };
38
+ type OrmBeforeHook<TData extends AnyRecord, TCtx extends object> = (data: TData, ctx: TCtx) => MaybePromise<OrmBeforeResult<TData>>;
39
+ type OrmAfterHook<TDoc extends AnyRecord, TCtx extends object> = (doc: TDoc, ctx: TCtx) => MaybePromise<void>;
40
+ type OrmChangeHook<TDoc extends AnyRecord, TCtx extends object> = ((change: OrmTriggerChange<TDoc>, ctx: TCtx) => MaybePromise<void>) | {
41
+ (): unknown;
42
+ (change: OrmTriggerChange<TDoc>, ctx: TCtx): MaybePromise<void>;
43
+ };
44
+ type OrmTableTriggers<TDoc extends AnyRecord, TInsert extends AnyRecord, TUpdate extends AnyRecord, TCtx extends object> = {
45
+ create?: {
46
+ before?: OrmBeforeHook<TInsert, TCtx>;
47
+ after?: OrmAfterHook<TDoc, TCtx>;
48
+ };
49
+ update?: {
50
+ before?: OrmBeforeHook<TUpdate, TCtx>;
51
+ after?: OrmAfterHook<TDoc, TCtx>;
52
+ };
53
+ delete?: {
54
+ before?: OrmBeforeHook<TDoc, TCtx>;
55
+ after?: OrmAfterHook<TDoc, TCtx>;
56
+ };
57
+ change?: OrmChangeHook<TDoc, TCtx>;
58
+ };
59
+ type OrmTriggers<TSchema extends TablesRelationalConfig, TExtraCtx extends object = {}> = { [TTableName in TriggerTableName<TSchema>]?: OrmTableTriggers<TriggerDoc<TSchema, TTableName>, TriggerInsertData<TSchema, TTableName>, TriggerUpdateData<TSchema, TTableName>, OrmTriggerContext<TSchema, TExtraCtx>> };
60
+ declare function defineTriggers<TSchema extends TablesRelationalConfig>(schema: TSchema, triggers: OrmTriggers<TSchema>): OrmTriggers<TSchema>;
61
+ declare function defineTriggers<TSchema extends TablesRelationalConfig, TExtraCtx extends object>(schema: TSchema, triggers: OrmTriggers<TSchema, TExtraCtx>): OrmTriggers<TSchema, TExtraCtx>;
62
+ //#endregion
63
+ //#region src/orm/extensions.d.ts
64
+ type SafeExtensionRelationsConfig<TRelationsConfig extends AnyRelationsBuilderConfig | undefined> = TRelationsConfig extends AnyRelationsBuilderConfig ? TRelationsConfig : {};
65
+ type SchemaExtensionRelationsAuthoringConfig<TTables extends object> = { [TTableName in keyof ExtractTablesFromSchema<TTables>]?: RelationsBuilderConfigValue };
66
+ type BivariantCallback<TCallback extends (...args: any[]) => unknown> = {
67
+ bivarianceHack(...args: Parameters<TCallback>): ReturnType<TCallback>;
68
+ }['bivarianceHack'];
69
+ type SchemaExtensionRelationsFactory<TTables extends object, TRelationsConfig extends AnyRelationsBuilderConfig> = (helpers: RelationsBuilder<ExtractTablesFromSchema<TTables>>) => TRelationsConfig;
70
+ type SchemaExtensionTriggersInput<TTables extends object = {}, TRelationsConfig extends AnyRelationsBuilderConfig | undefined = AnyRelationsBuilderConfig | undefined> = OrmTriggers<RelationsConfigWithSchema<SafeExtensionRelationsConfig<TRelationsConfig>, ExtractTablesFromSchema<TTables>>>;
71
+ type SchemaExtension<TTables extends object = {}, TRelationsConfig extends AnyRelationsBuilderConfig | undefined = AnyRelationsBuilderConfig | undefined, TTriggers extends SchemaExtensionTriggersInput<TTables, TRelationsConfig> | undefined = SchemaExtensionTriggersInput<TTables, TRelationsConfig> | undefined> = {
72
+ key: string;
73
+ tables: TTables;
74
+ [OrmSchemaExtensionRelations]?: TRelationsConfig extends AnyRelationsBuilderConfig ? BivariantCallback<SchemaExtensionRelationsFactory<TTables, TRelationsConfig>> : undefined;
75
+ [OrmSchemaExtensionTriggers]?: TTriggers;
76
+ };
77
+ type AnySchemaExtension = SchemaExtension<object, AnyRelationsBuilderConfig | undefined, SchemaExtensionTriggersInput<object, AnyRelationsBuilderConfig | undefined> | undefined>;
78
+ type SchemaExtensionChain<TTables extends object, TRelationsConfig extends AnyRelationsBuilderConfig | undefined, TCanRelations extends boolean, TCanTriggers extends boolean> = SchemaExtension<TTables, TRelationsConfig, SchemaExtensionTriggersInput<TTables, TRelationsConfig> | undefined> & (TCanRelations extends true ? {
79
+ relations: <const TNextRelationsConfig extends SchemaExtensionRelationsAuthoringConfig<TTables>>(relations: SchemaExtensionRelationsFactory<TTables, TNextRelationsConfig>) => SchemaExtensionChain<TTables, TNextRelationsConfig, false, true>;
80
+ } : {}) & (TCanTriggers extends true ? {
81
+ triggers: (triggers: SchemaExtensionTriggersInput<TTables, TRelationsConfig>) => SchemaExtensionChain<TTables, TRelationsConfig, false, false>;
82
+ } : {});
83
+ declare function defineSchemaExtension<const TTables extends object>(key: string, tables: TTables): SchemaExtensionChain<TTables, undefined, true, true>;
84
+ //#endregion
85
+ //#region src/orm/migrations/schema.d.ts
86
+ declare const MIGRATION_STATE_TABLE = "migration_state";
87
+ declare const MIGRATION_RUN_TABLE = "migration_run";
88
+ declare const migrationStorageTables: {
89
+ readonly migration_state: ConvexTableWithColumns<{
90
+ name: "migration_state";
91
+ columns: {
92
+ status: ConvexTextBuilderInitial<""> & {
93
+ _: {
94
+ notNull: true;
95
+ };
96
+ } & {
97
+ _: {
98
+ tableName: "migration_state";
99
+ };
100
+ } & {
101
+ _: {
102
+ fieldName: "status";
103
+ };
104
+ };
105
+ cursor: ConvexTextBuilderInitial<""> & {
106
+ _: {
107
+ tableName: "migration_state";
108
+ };
109
+ } & {
110
+ _: {
111
+ fieldName: "cursor";
112
+ };
113
+ };
114
+ direction: ConvexTextBuilderInitial<""> & {
115
+ _: {
116
+ tableName: "migration_state";
117
+ };
118
+ } & {
119
+ _: {
120
+ fieldName: "direction";
121
+ };
122
+ };
123
+ migrationId: ConvexTextBuilderInitial<""> & {
124
+ _: {
125
+ notNull: true;
126
+ };
127
+ } & {
128
+ _: {
129
+ tableName: "migration_state";
130
+ };
131
+ } & {
132
+ _: {
133
+ fieldName: "migrationId";
134
+ };
135
+ };
136
+ checksum: ConvexTextBuilderInitial<""> & {
137
+ _: {
138
+ notNull: true;
139
+ };
140
+ } & {
141
+ _: {
142
+ tableName: "migration_state";
143
+ };
144
+ } & {
145
+ _: {
146
+ fieldName: "checksum";
147
+ };
148
+ };
149
+ applied: ConvexBooleanBuilderInitial<""> & {
150
+ _: {
151
+ notNull: true;
152
+ };
153
+ } & {
154
+ _: {
155
+ tableName: "migration_state";
156
+ };
157
+ } & {
158
+ _: {
159
+ fieldName: "applied";
160
+ };
161
+ };
162
+ runId: ConvexTextBuilderInitial<""> & {
163
+ _: {
164
+ tableName: "migration_state";
165
+ };
166
+ } & {
167
+ _: {
168
+ fieldName: "runId";
169
+ };
170
+ };
171
+ processed: ConvexNumberBuilderInitial<""> & {
172
+ _: {
173
+ notNull: true;
174
+ };
175
+ } & {
176
+ _: {
177
+ tableName: "migration_state";
178
+ };
179
+ } & {
180
+ _: {
181
+ fieldName: "processed";
182
+ };
183
+ };
184
+ startedAt: ConvexNumberBuilderInitial<""> & {
185
+ _: {
186
+ tableName: "migration_state";
187
+ };
188
+ } & {
189
+ _: {
190
+ fieldName: "startedAt";
191
+ };
192
+ };
193
+ updatedAt: ConvexNumberBuilderInitial<""> & {
194
+ _: {
195
+ notNull: true;
196
+ };
197
+ } & {
198
+ _: {
199
+ tableName: "migration_state";
200
+ };
201
+ } & {
202
+ _: {
203
+ fieldName: "updatedAt";
204
+ };
205
+ };
206
+ completedAt: ConvexNumberBuilderInitial<""> & {
207
+ _: {
208
+ tableName: "migration_state";
209
+ };
210
+ } & {
211
+ _: {
212
+ fieldName: "completedAt";
213
+ };
214
+ };
215
+ lastError: ConvexTextBuilderInitial<""> & {
216
+ _: {
217
+ tableName: "migration_state";
218
+ };
219
+ } & {
220
+ _: {
221
+ fieldName: "lastError";
222
+ };
223
+ };
224
+ writeMode: ConvexTextBuilderInitial<""> & {
225
+ _: {
226
+ notNull: true;
227
+ };
228
+ } & {
229
+ _: {
230
+ tableName: "migration_state";
231
+ };
232
+ } & {
233
+ _: {
234
+ fieldName: "writeMode";
235
+ };
236
+ };
237
+ };
238
+ }, {
239
+ by_creation_time: ["_creationTime"];
240
+ by_migration_id: ["migrationId", "_creationTime"];
241
+ by_status: ["status", "_creationTime"];
242
+ }, {}, {}, {}>;
243
+ readonly migration_run: ConvexTableWithColumns<{
244
+ name: "migration_run";
245
+ columns: {
246
+ status: ConvexTextBuilderInitial<""> & {
247
+ _: {
248
+ notNull: true;
249
+ };
250
+ } & {
251
+ _: {
252
+ tableName: "migration_run";
253
+ };
254
+ } & {
255
+ _: {
256
+ fieldName: "status";
257
+ };
258
+ };
259
+ direction: ConvexTextBuilderInitial<""> & {
260
+ _: {
261
+ notNull: true;
262
+ };
263
+ } & {
264
+ _: {
265
+ tableName: "migration_run";
266
+ };
267
+ } & {
268
+ _: {
269
+ fieldName: "direction";
270
+ };
271
+ };
272
+ runId: ConvexTextBuilderInitial<""> & {
273
+ _: {
274
+ notNull: true;
275
+ };
276
+ } & {
277
+ _: {
278
+ tableName: "migration_run";
279
+ };
280
+ } & {
281
+ _: {
282
+ fieldName: "runId";
283
+ };
284
+ };
285
+ startedAt: ConvexNumberBuilderInitial<""> & {
286
+ _: {
287
+ notNull: true;
288
+ };
289
+ } & {
290
+ _: {
291
+ tableName: "migration_run";
292
+ };
293
+ } & {
294
+ _: {
295
+ fieldName: "startedAt";
296
+ };
297
+ };
298
+ updatedAt: ConvexNumberBuilderInitial<""> & {
299
+ _: {
300
+ notNull: true;
301
+ };
302
+ } & {
303
+ _: {
304
+ tableName: "migration_run";
305
+ };
306
+ } & {
307
+ _: {
308
+ fieldName: "updatedAt";
309
+ };
310
+ };
311
+ completedAt: ConvexNumberBuilderInitial<""> & {
312
+ _: {
313
+ tableName: "migration_run";
314
+ };
315
+ } & {
316
+ _: {
317
+ fieldName: "completedAt";
318
+ };
319
+ };
320
+ lastError: ConvexTextBuilderInitial<""> & {
321
+ _: {
322
+ tableName: "migration_run";
323
+ };
324
+ } & {
325
+ _: {
326
+ fieldName: "lastError";
327
+ };
328
+ };
329
+ dryRun: ConvexBooleanBuilderInitial<""> & {
330
+ _: {
331
+ notNull: true;
332
+ };
333
+ } & {
334
+ _: {
335
+ tableName: "migration_run";
336
+ };
337
+ } & {
338
+ _: {
339
+ fieldName: "dryRun";
340
+ };
341
+ };
342
+ allowDrift: ConvexBooleanBuilderInitial<""> & {
343
+ _: {
344
+ notNull: true;
345
+ };
346
+ } & {
347
+ _: {
348
+ tableName: "migration_run";
349
+ };
350
+ } & {
351
+ _: {
352
+ fieldName: "allowDrift";
353
+ };
354
+ };
355
+ migrationIds: ConvexCustomBuilderInitial<"", convex_values0.VArray<string[], convex_values0.VString<string, "required">, "required">> & {
356
+ _: {
357
+ notNull: true;
358
+ };
359
+ } & {
360
+ _: {
361
+ tableName: "migration_run";
362
+ };
363
+ } & {
364
+ _: {
365
+ fieldName: "migrationIds";
366
+ };
367
+ };
368
+ currentIndex: ConvexNumberBuilderInitial<""> & {
369
+ _: {
370
+ notNull: true;
371
+ };
372
+ } & {
373
+ _: {
374
+ tableName: "migration_run";
375
+ };
376
+ } & {
377
+ _: {
378
+ fieldName: "currentIndex";
379
+ };
380
+ };
381
+ cancelRequested: ConvexBooleanBuilderInitial<""> & {
382
+ _: {
383
+ notNull: true;
384
+ };
385
+ } & {
386
+ _: {
387
+ tableName: "migration_run";
388
+ };
389
+ } & {
390
+ _: {
391
+ fieldName: "cancelRequested";
392
+ };
393
+ };
394
+ };
395
+ }, {
396
+ by_creation_time: ["_creationTime"];
397
+ by_status: ["status", "_creationTime"];
398
+ by_run_id: ["runId", "_creationTime"];
399
+ }, {}, {}, {}>;
400
+ };
401
+ declare const MIGRATION_STORAGE_TABLE_NAMES: Set<string>;
402
+ declare function migrationExtension(): SchemaExtension<typeof migrationStorageTables>;
403
+ declare function injectMigrationStorageTables<TSchema extends Record<string, unknown>>(schema: TSchema): TSchema & typeof migrationStorageTables;
404
+ //#endregion
405
+ //#region src/orm/scheduled-delete.d.ts
406
+ type ScheduledDeleteArgs = {
407
+ table: string;
408
+ id: GenericId<any>;
409
+ cascadeMode?: CascadeMode;
410
+ deletionTime?: number;
411
+ };
412
+ declare function scheduledDeleteFactory<TSchema extends TablesRelationalConfig>(schema: TSchema, edgeMetadata: EdgeMetadata[], scheduledMutationBatch: SchedulableFunctionReference): (ctx: {
413
+ db: GenericDatabaseWriter<any>;
414
+ scheduler: Scheduler;
415
+ }, args: ScheduledDeleteArgs) => Promise<void>;
416
+ //#endregion
417
+ //#region src/orm/scheduled-mutation-batch.d.ts
418
+ type ScheduledMutationWorkType = 'root-update' | 'root-delete' | 'cascade-delete' | 'cascade-update';
419
+ type ScheduledMutationBatchArgs = {
420
+ workType?: ScheduledMutationWorkType;
421
+ mode?: 'sync' | 'async';
422
+ operation: 'update' | 'delete';
423
+ table: string;
424
+ where?: SerializedFilterExpression;
425
+ allowFullScan?: boolean;
426
+ update?: Record<string, unknown>;
427
+ deleteMode?: DeleteMode;
428
+ cascadeMode?: CascadeMode;
429
+ foreignIndexName?: string;
430
+ foreignSourceColumns?: string[];
431
+ targetValues?: unknown;
432
+ newValues?: unknown;
433
+ foreignAction?: 'cascade' | 'set null' | 'set default' | 'restrict' | 'no action';
434
+ cursor: string | null;
435
+ batchSize: number;
436
+ maxBytesPerBatch?: number;
437
+ delayMs: number;
438
+ };
439
+ declare function scheduledMutationBatchFactory<TSchema extends TablesRelationalConfig>(schema: TSchema, edgeMetadata: EdgeMetadata[], scheduledMutationBatch: SchedulableFunctionReference): (ctx: {
440
+ db: GenericDatabaseWriter<any>;
441
+ scheduler: Scheduler;
442
+ }, args: ScheduledMutationBatchArgs) => Promise<void>;
443
+ //#endregion
444
+ //#region src/orm/create-orm.d.ts
445
+ type OrmFunctions = {
446
+ scheduledMutationBatch: SchedulableFunctionReference;
447
+ scheduledDelete: SchedulableFunctionReference;
448
+ aggregateBackfillChunk?: SchedulableFunctionReference;
449
+ migrationRunChunk?: SchedulableFunctionReference;
450
+ resetChunk?: SchedulableFunctionReference;
451
+ };
452
+ type CreateOrmOptions = CreateDatabaseOptions;
453
+ type OrmWriterCtx = {
454
+ db: GenericDatabaseWriter<any>;
455
+ scheduler?: Scheduler;
456
+ vectorSearch?: VectorSearchProvider;
457
+ };
458
+ type OrmReaderCtx = {
459
+ db: GenericDatabaseReader<any>;
460
+ scheduler?: Scheduler;
461
+ vectorSearch?: VectorSearchProvider;
462
+ };
463
+ type OrmSource = GenericDatabaseReader<any> | GenericDatabaseWriter<any> | OrmReaderCtx | OrmWriterCtx;
464
+ type OrmSchemaInput = TablesRelationalConfig | object;
465
+ type ResolveOrmSchema<TSchema extends OrmSchemaInput> = TSchema extends TablesRelationalConfig ? TSchema : TSchema extends {
466
+ [OrmSchemaRelations]?: infer TRelations;
467
+ } ? Exclude<TRelations, undefined> extends TablesRelationalConfig ? Exclude<TRelations, undefined> : RelationsConfigWithSchema<{}, ExtractTablesFromSchema<TSchema & Record<string, unknown>>> : RelationsConfigWithSchema<{}, ExtractTablesFromSchema<TSchema & Record<string, unknown>>>;
468
+ type OrmResult<TSource extends OrmSource, TSchema extends TablesRelationalConfig> = TSource extends GenericDatabaseWriter<any> | OrmWriterCtx ? OrmWriter<TSchema> : OrmReader<TSchema>;
469
+ type GenericOrm<Ctx extends {
470
+ db: GenericDatabaseReader<any> | GenericDatabaseWriter<any>;
471
+ }, TSchema extends TablesRelationalConfig> = Ctx extends {
472
+ db: GenericDatabaseWriter<any>;
473
+ } ? OrmWriter<TSchema> : OrmReader<TSchema>;
474
+ type GenericOrmCtx<Ctx extends {
475
+ db: GenericDatabaseReader<any> | GenericDatabaseWriter<any>;
476
+ }, TSchema extends TablesRelationalConfig> = Ctx & {
477
+ orm: GenericOrm<Ctx, TSchema>;
478
+ };
479
+ type CreateOrmConfigBase<TSchema extends OrmSchemaInput> = {
480
+ schema: TSchema;
481
+ /**
482
+ * Optional subsystems this ORM may use.
483
+ *
484
+ * `count()`, `aggregate()`, `groupBy()`, `rank()`, relation `_count`,
485
+ * `aggregateIndex(...)` / `rankIndex(...)` write maintenance and the
486
+ * `orm.api()` backfill handlers need `aggregateCapability()` from
487
+ * `kitcn/orm/aggregate-index`. The `orm.api()` migration handlers need
488
+ * `migrationCapability()` from `kitcn/orm/migrations`. Anything not
489
+ * registered here stays out of the Convex bundle for this module.
490
+ */
491
+ capabilities?: readonly OrmCapability[];
492
+ migrations?: MigrationSet<any>;
493
+ internalMutation?: typeof internalMutationGeneric;
494
+ };
495
+ type CreateOrmConfigWithFunctions<TSchema extends OrmSchemaInput> = CreateOrmConfigBase<TSchema> & {
496
+ ormFunctions: OrmFunctions;
497
+ };
498
+ type CreateOrmConfigWithoutFunctions<TSchema extends OrmSchemaInput> = CreateOrmConfigBase<TSchema> & {
499
+ ormFunctions?: undefined;
500
+ };
501
+ type OrmFactory<TSchema extends TablesRelationalConfig> = <TSource extends OrmSource>(source: TSource, options?: CreateOrmOptions) => OrmResult<TSource, TSchema>;
502
+ type OrmApiResult = {
503
+ scheduledMutationBatch: ReturnType<typeof internalMutationGeneric>;
504
+ scheduledDelete: ReturnType<typeof internalMutationGeneric>;
505
+ aggregateBackfill: ReturnType<typeof internalMutationGeneric>;
506
+ aggregateBackfillChunk: ReturnType<typeof internalMutationGeneric>;
507
+ aggregateBackfillStatus: ReturnType<typeof internalMutationGeneric>;
508
+ migrationRun: ReturnType<typeof internalMutationGeneric>;
509
+ migrationRunChunk: ReturnType<typeof internalMutationGeneric>;
510
+ migrationStatus: ReturnType<typeof internalMutationGeneric>;
511
+ migrationCancel: ReturnType<typeof internalMutationGeneric>;
512
+ resetChunk: ReturnType<typeof internalMutationGeneric>;
513
+ reset: ReturnType<typeof internalActionGeneric>;
514
+ };
515
+ type OrmClientBase<TSchema extends TablesRelationalConfig> = {
516
+ db: OrmFactory<TSchema>;
517
+ with: <TContext extends OrmReaderCtx | OrmWriterCtx>(ctx: TContext, options?: CreateOrmOptions) => GenericOrmCtx<TContext, TSchema>;
518
+ };
519
+ type OrmClientWithApi<TSchema extends TablesRelationalConfig> = OrmClientBase<TSchema> & {
520
+ api: () => OrmApiResult;
521
+ };
522
+ declare function createOrm<TSchema extends OrmSchemaInput>(config: CreateOrmConfigWithoutFunctions<TSchema>): OrmClientBase<ResolveOrmSchema<TSchema>>;
523
+ declare function createOrm<TSchema extends OrmSchemaInput>(config: CreateOrmConfigWithFunctions<TSchema>): OrmClientWithApi<ResolveOrmSchema<TSchema>>;
524
+ //#endregion
525
+ //#region src/orm/builders/bigint.d.ts
526
+ /**
527
+ * Initial type for ConvexBigIntBuilder
528
+ */
529
+ type ConvexBigIntBuilderInitial<TName extends string> = ConvexBigIntBuilder<{
530
+ name: TName;
531
+ dataType: 'bigint';
532
+ columnType: 'ConvexBigInt';
533
+ data: bigint;
534
+ driverParam: bigint;
535
+ enumValues: undefined;
536
+ }>;
537
+ /**
538
+ * BigInt column builder class
539
+ * Compiles to v.int64() or v.optional(v.int64())
540
+ */
541
+ declare class ConvexBigIntBuilder<T extends ColumnBuilderBaseConfig<'bigint', 'ConvexBigInt'>> extends ConvexColumnBuilder<T> {
542
+ static readonly [entityKind]: string;
543
+ constructor(name: T['name']);
544
+ /**
545
+ * Expose Convex validator for schema integration
546
+ */
547
+ get convexValidator(): Validator<any, any, any>;
548
+ /**
549
+ * Compile to Convex validator
550
+ * .notNull() → v.int64()
551
+ * nullable → v.optional(v.int64())
552
+ */
553
+ build(): Validator<any, any, any>;
554
+ }
555
+ /**
556
+ * bigint() factory function
557
+ *
558
+ * Creates a bigint column builder (int64 in Convex).
559
+ * For JavaScript bigint values.
560
+ *
561
+ * @example
562
+ * bigint() → unnamed column
563
+ * bigint('col_name') → named column
564
+ */
565
+ declare function bigint(): ConvexBigIntBuilderInitial<''>;
566
+ declare function bigint<TName extends string>(name: TName): ConvexBigIntBuilderInitial<TName>;
567
+ //#endregion
568
+ //#region src/orm/builders/boolean.d.ts
569
+ /**
570
+ * Initial type for ConvexBooleanBuilder
571
+ */
572
+ type ConvexBooleanBuilderInitial<TName extends string> = ConvexBooleanBuilder<{
573
+ name: TName;
574
+ dataType: 'boolean';
575
+ columnType: 'ConvexBoolean';
576
+ data: boolean;
577
+ driverParam: boolean;
578
+ enumValues: undefined;
579
+ }>;
580
+ /**
581
+ * Boolean column builder class
582
+ * Compiles to v.boolean() or v.optional(v.boolean())
583
+ */
584
+ declare class ConvexBooleanBuilder<T extends ColumnBuilderBaseConfig<'boolean', 'ConvexBoolean'>> extends ConvexColumnBuilder<T> {
585
+ static readonly [entityKind]: string;
586
+ constructor(name: T['name']);
587
+ /**
588
+ * Expose Convex validator for schema integration
589
+ */
590
+ get convexValidator(): Validator<any, any, any>;
591
+ /**
592
+ * Compile to Convex validator
593
+ * .notNull() → v.boolean()
594
+ * nullable → v.optional(v.boolean())
595
+ */
596
+ build(): Validator<any, any, any>;
597
+ }
598
+ /**
599
+ * boolean() factory function
600
+ *
601
+ * Creates a boolean column builder.
602
+ *
603
+ * @example
604
+ * boolean() → unnamed column
605
+ * boolean('col_name') → named column
606
+ */
607
+ declare function boolean(): ConvexBooleanBuilderInitial<''>;
608
+ declare function boolean<TName extends string>(name: TName): ConvexBooleanBuilderInitial<TName>;
609
+ //#endregion
610
+ //#region src/orm/builders/bytes.d.ts
611
+ type ConvexBytesBuilderInitial<TName extends string> = ConvexBytesBuilder<{
612
+ name: TName;
613
+ dataType: 'bytes';
614
+ columnType: 'ConvexBytes';
615
+ data: ArrayBuffer;
616
+ driverParam: ArrayBuffer;
617
+ enumValues: undefined;
618
+ }>;
619
+ declare class ConvexBytesBuilder<T extends ColumnBuilderBaseConfig<'bytes', 'ConvexBytes'>> extends ConvexColumnBuilder<T> {
620
+ static readonly [entityKind]: string;
621
+ constructor(name: T['name']);
622
+ get convexValidator(): Validator<any, any, any>;
623
+ build(): Validator<any, any, any>;
624
+ }
625
+ declare function bytes(): ConvexBytesBuilderInitial<''>;
626
+ declare function bytes<TName extends string>(name: TName): ConvexBytesBuilderInitial<TName>;
627
+ //#endregion
628
+ //#region src/orm/builders/custom.d.ts
629
+ type AnyValidator = Validator<any, any, any>;
630
+ type AnyColumnBuilder = ColumnBuilder<any, any, any>;
631
+ interface NestedShapeInput {
632
+ [key: string]: NestedInput;
633
+ }
634
+ type NestedInput = AnyValidator | AnyColumnBuilder | NestedShapeInput;
635
+ type InferBuilderNestedValue<TBuilder extends AnyColumnBuilder> = TBuilder['_'] extends {
636
+ $type: infer TType;
637
+ } ? TType : TBuilder['_'] extends {
638
+ data: infer TData;
639
+ } ? TBuilder['_'] extends {
640
+ notNull: true;
641
+ } ? TData : TData | null : never;
642
+ type InferValidatorNestedValue<TValidator extends AnyValidator> = Exclude<TValidator['type'], undefined>;
643
+ type InferNestedValue<TInput extends NestedInput> = TInput extends AnyColumnBuilder ? InferBuilderNestedValue<TInput> : TInput extends AnyValidator ? InferValidatorNestedValue<TInput> : TInput extends NestedShapeInput ? InferObjectShape<TInput> : never;
644
+ type InferObjectShape<TShape extends NestedShapeInput> = { [K in keyof TShape]: InferNestedValue<TShape[K]> };
645
+ type InferObjectValue<TInput extends NestedInput> = TInput extends AnyColumnBuilder | AnyValidator ? Record<string, InferNestedValue<TInput>> : TInput extends NestedShapeInput ? InferObjectShape<TInput> : never;
646
+ type ConvexCustomBuilderInitial<TName extends string, TValidator extends AnyValidator> = ConvexCustomBuilder<{
647
+ name: TName;
648
+ dataType: 'any';
649
+ columnType: 'ConvexCustom';
650
+ data: TValidator['type'];
651
+ driverParam: TValidator['type'];
652
+ enumValues: undefined;
653
+ }, TValidator>;
654
+ declare class ConvexCustomBuilder<T extends ColumnBuilderBaseConfig<'any', 'ConvexCustom'>, TValidator extends AnyValidator> extends ConvexColumnBuilder<T, {
655
+ validator: TValidator;
656
+ }> {
657
+ static readonly [entityKind]: string;
658
+ constructor(name: T['name'], validator: TValidator);
659
+ get convexValidator(): Validator<any, any, any>;
660
+ build(): Validator<any, any, any>;
661
+ }
662
+ declare function custom<TValidator extends AnyValidator>(validator: TValidator): ConvexCustomBuilderInitial<'', TValidator>;
663
+ declare function custom<TName extends string, TValidator extends AnyValidator>(name: TName, validator: TValidator): ConvexCustomBuilderInitial<TName, TValidator>;
664
+ /**
665
+ * Creates an array column from a nested validator or builder.
666
+ *
667
+ * Values in nested arrays are always compiled as required validators.
668
+ */
669
+ declare function arrayOf<TElement extends NestedInput>(element: TElement): $Type<ConvexCustomBuilderInitial<"", convex_values0.VArray<any[], AnyValidator, "required">>, InferNestedValue<TElement>[]>;
670
+ /**
671
+ * Creates a union column from validators/builders without dropping to `v.union(...)`.
672
+ */
673
+ declare function unionOf<const TMembers extends readonly [NestedInput, NestedInput, ...NestedInput[]]>(...members: TMembers): $Type<ConvexCustomBuilderInitial<"", convex_values0.VUnion<any, [AnyValidator, AnyValidator, ...AnyValidator[]], "required", any>>, InferNestedValue<TMembers[number]>>;
674
+ /**
675
+ * Creates an object column from either:
676
+ * - a nested shape of validators/builders, or
677
+ * - a validator/builder describing homogeneous record values
678
+ *
679
+ * Fields in nested objects are always compiled as required validators.
680
+ */
681
+ declare function objectOf<TInput extends NestedInput>(input: TInput): $Type<ConvexCustomBuilderInitial<"", convex_values0.VRecord<Record<string, any>, convex_values0.VString<string, "required">, AnyValidator, "required", string>>, InferObjectValue<TInput>> | $Type<ConvexCustomBuilderInitial<"", AnyValidator>, InferObjectValue<TInput>>;
682
+ /**
683
+ * Convenience wrapper for Convex "JSON" values.
684
+ *
685
+ * Note: This is Convex JSON (runtime `v.any()`), not SQL JSON/JSONB.
686
+ */
687
+ declare function json<T = Value>(): $Type<ConvexCustomBuilderInitial<"", convex_values0.VAny<any, "required", string>>, T>;
688
+ //#endregion
689
+ //#region src/orm/builders/date.d.ts
690
+ type ConvexDateMode = 'string' | 'date';
691
+ type ConvexDateBuilderConfig<TName extends string, TMode extends ConvexDateMode> = {
692
+ name: TName;
693
+ dataType: 'string';
694
+ columnType: 'ConvexDate';
695
+ data: TMode extends 'date' ? Date : string;
696
+ driverParam: string;
697
+ enumValues: undefined;
698
+ };
699
+ type ConvexDateBuilderInitial<TName extends string, TMode extends ConvexDateMode = 'string'> = ConvexDateBuilder<ConvexDateBuilderConfig<TName, TMode>, TMode>;
700
+ type ConvexDateRuntimeConfig<TMode extends ConvexDateMode> = {
701
+ mode: TMode;
702
+ };
703
+ type ConvexDateBuilderArg<TMode extends ConvexDateMode> = {
704
+ mode?: TMode;
705
+ };
706
+ declare class ConvexDateBuilder<T extends ColumnBuilderBaseConfig<'string', 'ConvexDate'>, TMode extends ConvexDateMode = ConvexDateMode> extends ConvexColumnBuilder<T, ConvexDateRuntimeConfig<TMode>> {
707
+ static readonly [entityKind]: string;
708
+ constructor(name: T['name'], mode: TMode);
709
+ get convexValidator(): Validator<any, any, any>;
710
+ defaultNow(): HasDefault<this>;
711
+ build(): Validator<any, any, any>;
712
+ }
713
+ declare function date(): ConvexDateBuilderInitial<'', 'string'>;
714
+ declare function date<TName extends string>(name: TName): ConvexDateBuilderInitial<TName, 'string'>;
715
+ declare function date<TMode extends ConvexDateMode>(config: ConvexDateBuilderArg<TMode>): ConvexDateBuilderInitial<'', TMode>;
716
+ declare function date<TName extends string, TMode extends ConvexDateMode>(name: TName, config: ConvexDateBuilderArg<TMode>): ConvexDateBuilderInitial<TName, TMode>;
717
+ //#endregion
718
+ //#region src/orm/builders/id.d.ts
719
+ /**
720
+ * Initial type for ConvexIdBuilder
721
+ * Includes table name in type for branded Id
722
+ */
723
+ type ConvexIdBuilderInitial<TName extends string, TTableName extends string> = ConvexIdBuilder<{
724
+ name: TName;
725
+ dataType: 'string';
726
+ columnType: 'ConvexId';
727
+ data: GenericId<TTableName>;
728
+ driverParam: GenericId<TTableName>;
729
+ enumValues: undefined;
730
+ }>;
731
+ /**
732
+ * ID column builder class
733
+ * Compiles to v.id(tableName) or v.optional(v.id(tableName))
734
+ */
735
+ declare class ConvexIdBuilder<T extends ColumnBuilderBaseConfig<'string', 'ConvexId'>> extends ConvexColumnBuilder<T> {
736
+ private tableName;
737
+ static readonly [entityKind]: string;
738
+ constructor(name: T['name'], tableName: string);
739
+ /**
740
+ * Expose Convex validator for schema integration
741
+ */
742
+ get convexValidator(): Validator<any, any, any>;
743
+ /**
744
+ * Compile to Convex validator
745
+ * .notNull() → v.id(tableName)
746
+ * nullable → v.optional(v.id(tableName))
747
+ */
748
+ build(): Validator<any, any, any>;
749
+ }
750
+ /**
751
+ * id() factory function
752
+ *
753
+ * Creates an ID reference column builder (foreign key).
754
+ * Requires table name to generate branded Id type.
755
+ *
756
+ * @example
757
+ * id('users') → unnamed column referencing users table
758
+ */
759
+ declare function id<TTableName extends string>(tableName: TTableName): ConvexIdBuilderInitial<'', TTableName>;
760
+ //#endregion
761
+ //#region src/orm/builders/number.d.ts
762
+ /**
763
+ * Initial type for ConvexNumberBuilder
764
+ */
765
+ type ConvexNumberBuilderInitial<TName extends string> = ConvexNumberBuilder<{
766
+ name: TName;
767
+ dataType: 'number';
768
+ columnType: 'ConvexNumber';
769
+ data: number;
770
+ driverParam: number;
771
+ enumValues: undefined;
772
+ }>;
773
+ /**
774
+ * Number column builder class
775
+ * Compiles to v.number() or v.optional(v.number())
776
+ */
777
+ declare class ConvexNumberBuilder<T extends ColumnBuilderBaseConfig<'number', 'ConvexNumber'>> extends ConvexColumnBuilder<T> {
778
+ static readonly [entityKind]: string;
779
+ constructor(name: T['name']);
780
+ /**
781
+ * Expose Convex validator for schema integration
782
+ */
783
+ get convexValidator(): Validator<any, any, any>;
784
+ /**
785
+ * Compile to Convex validator
786
+ * .notNull() → v.number()
787
+ * nullable → v.optional(v.number())
788
+ */
789
+ build(): Validator<any, any, any>;
790
+ }
791
+ /**
792
+ * integer() factory function
793
+ *
794
+ * Drizzle-parity numeric builder.
795
+ * In Convex this maps to v.number() (Float64).
796
+ *
797
+ * @example
798
+ * integer() → unnamed column
799
+ * integer('col_name') → named column
800
+ */
801
+ declare function integer(): ConvexNumberBuilderInitial<''>;
802
+ declare function integer<TName extends string>(name: TName): ConvexNumberBuilderInitial<TName>;
803
+ //#endregion
804
+ //#region src/orm/builders/text-enum.d.ts
805
+ type EnumValues = readonly [string, ...string[]];
806
+ type ConvexTextEnumBuilderInitial<TName extends string, TValues extends EnumValues> = ConvexTextEnumBuilder<{
807
+ name: TName;
808
+ dataType: 'string';
809
+ columnType: 'ConvexText';
810
+ data: TValues[number];
811
+ driverParam: TValues[number];
812
+ enumValues: TValues[number][];
813
+ }>;
814
+ declare class ConvexTextEnumBuilder<T extends ColumnBuilderBaseConfig<'string', 'ConvexText'>> extends ConvexColumnBuilder<T, {
815
+ values: string[];
816
+ }> {
817
+ static readonly [entityKind]: string;
818
+ constructor(name: T['name'], values: readonly string[]);
819
+ private _enumValidator;
820
+ get convexValidator(): Validator<any, any, any>;
821
+ build(): Validator<any, any, any>;
822
+ }
823
+ declare function textEnum<const TValues extends EnumValues>(values: TValues): ConvexTextEnumBuilderInitial<'', TValues>;
824
+ //#endregion
825
+ //#region src/orm/builders/timestamp.d.ts
826
+ type ConvexTimestampMode = 'date' | 'string';
827
+ type ConvexTimestampBuilderConfig<TName extends string, TMode extends ConvexTimestampMode> = {
828
+ name: TName;
829
+ dataType: 'number';
830
+ columnType: 'ConvexTimestamp';
831
+ data: TMode extends 'string' ? string : Date;
832
+ driverParam: number;
833
+ enumValues: undefined;
834
+ };
835
+ type ConvexTimestampBuilderInitial<TName extends string, TMode extends ConvexTimestampMode = 'date'> = ConvexTimestampBuilder<ConvexTimestampBuilderConfig<TName, TMode>, TMode>;
836
+ type ConvexTimestampRuntimeConfig<TMode extends ConvexTimestampMode> = {
837
+ mode: TMode;
838
+ };
839
+ type ConvexTimestampBuilderArg<TMode extends ConvexTimestampMode> = {
840
+ mode?: TMode;
841
+ };
842
+ declare class ConvexTimestampBuilder<T extends ColumnBuilderBaseConfig<'number', 'ConvexTimestamp'>, TMode extends ConvexTimestampMode = ConvexTimestampMode> extends ConvexColumnBuilder<T, ConvexTimestampRuntimeConfig<TMode>> {
843
+ static readonly [entityKind]: string;
844
+ constructor(name: T['name'], mode: TMode);
845
+ get convexValidator(): Validator<any, any, any>;
846
+ defaultNow(): HasDefault<this>;
847
+ build(): Validator<any, any, any>;
848
+ }
849
+ declare function timestamp(): ConvexTimestampBuilderInitial<'', 'date'>;
850
+ declare function timestamp<TName extends string>(name: TName): ConvexTimestampBuilderInitial<TName, 'date'>;
851
+ declare function timestamp<TMode extends ConvexTimestampMode>(config: ConvexTimestampBuilderArg<TMode>): ConvexTimestampBuilderInitial<'', TMode>;
852
+ declare function timestamp<TName extends string, TMode extends ConvexTimestampMode>(name: TName, config: ConvexTimestampBuilderArg<TMode>): ConvexTimestampBuilderInitial<TName, TMode>;
853
+ //#endregion
854
+ //#region src/orm/builders/vector.d.ts
855
+ /**
856
+ * Initial type for ConvexVectorBuilder
857
+ */
858
+ type ConvexVectorBuilderInitial<TName extends string> = ConvexVectorBuilder<{
859
+ name: TName;
860
+ dataType: 'vector';
861
+ columnType: 'ConvexVector';
862
+ data: number[];
863
+ driverParam: number[];
864
+ enumValues: undefined;
865
+ }>;
866
+ /**
867
+ * Vector column builder class
868
+ * Compiles to v.array(v.float64()) or v.optional(v.array(v.float64()))
869
+ */
870
+ declare class ConvexVectorBuilder<T extends ColumnBuilderBaseConfig<'vector', 'ConvexVector'>> extends ConvexColumnBuilder<T, {
871
+ dimensions: number;
872
+ }> {
873
+ static readonly [entityKind]: string;
874
+ constructor(name: T['name'], dimensions: number);
875
+ get dimensions(): number;
876
+ /**
877
+ * Expose Convex validator for schema integration
878
+ */
879
+ get convexValidator(): Validator<any, any, any>;
880
+ /**
881
+ * Compile to Convex validator
882
+ * .notNull() → v.array(v.float64())
883
+ * nullable → v.optional(v.array(v.float64()))
884
+ */
885
+ build(): Validator<any, any, any>;
886
+ }
887
+ /**
888
+ * vector() factory function
889
+ *
890
+ * Creates a vector column builder with fixed dimensions.
891
+ *
892
+ * @example
893
+ * vector(1536) → unnamed column
894
+ * vector('embedding', 1536) → named column
895
+ */
896
+ declare function vector(dimensions: number): ConvexVectorBuilderInitial<''>;
897
+ declare function vector<TName extends string>(name: TName, dimensions: number): ConvexVectorBuilderInitial<TName>;
898
+ //#endregion
899
+ //#region src/orm/errors.d.ts
900
+ declare class OrmNotFoundError extends Error {
901
+ readonly table?: string | undefined;
902
+ constructor(message: string, table?: string | undefined);
903
+ }
904
+ //#endregion
905
+ //#region src/orm/index-utils.d.ts
906
+ type TableAggregateIndex = {
907
+ name: string;
908
+ fields: string[];
909
+ countFields: string[];
910
+ sumFields: string[];
911
+ avgFields: string[];
912
+ minFields: string[];
913
+ maxFields: string[];
914
+ };
915
+ type TableRankIndex = {
916
+ name: string;
917
+ partitionFields: string[];
918
+ orderFields: Array<{
919
+ field: string;
920
+ direction: 'asc' | 'desc';
921
+ }>;
922
+ sumField?: string;
923
+ };
924
+ declare function getIndexes(table: ConvexTable<any>): {
925
+ name: string;
926
+ fields: string[];
927
+ }[];
928
+ declare function getAggregateIndexes(table: ConvexTable<any>): TableAggregateIndex[];
929
+ declare function getRankIndexes(table: ConvexTable<any>): TableRankIndex[];
930
+ //#endregion
931
+ //#region src/orm/introspection.d.ts
932
+ declare function getTableColumns<TTable extends ConvexTable<any>>(table: TTable): TTable[typeof Columns] & SystemFields<TTable['_']['name']> & SystemFieldAliases<TTable['_']['name'], TTable[typeof Columns]>;
933
+ type TableConfigResult<TTable extends ConvexTable<any>> = {
934
+ name: string;
935
+ columns: ReturnType<typeof getTableColumns<TTable>>;
936
+ indexes: ReturnType<typeof getIndexes>;
937
+ aggregateIndexes: ReturnType<typeof getAggregateIndexes>;
938
+ rankIndexes: ReturnType<typeof getRankIndexes>;
939
+ uniqueIndexes: ReturnType<typeof getUniqueIndexes>;
940
+ foreignKeys: ReturnType<typeof getForeignKeys>;
941
+ checks: ReturnType<typeof getChecks>;
942
+ rls: {
943
+ enabled: boolean;
944
+ policies: RlsPolicy[];
945
+ };
946
+ };
947
+ declare function getTableConfig<TTable extends ConvexTable<any>>(table: TTable): TableConfigResult<TTable>;
948
+ //#endregion
949
+ //#region src/orm/order-by.d.ts
950
+ /**
951
+ * Create ascending order clause
952
+ * Following Drizzle pattern for type-safe ordering
953
+ *
954
+ * @example
955
+ * const posts = await db.query.posts.findMany({
956
+ * orderBy: asc(posts._creationTime),
957
+ * });
958
+ */
959
+ declare function asc<TBuilder extends ColumnBuilder<any, any, any>>(builder: TBuilder): OrderByClause<TBuilder>;
960
+ /**
961
+ * Create descending order clause
962
+ * Following Drizzle pattern for type-safe ordering
963
+ *
964
+ * @example
965
+ * const posts = await db.query.posts.findMany({
966
+ * orderBy: desc(posts._creationTime),
967
+ * });
968
+ */
969
+ declare function desc<TBuilder extends ColumnBuilder<any, any, any>>(builder: TBuilder): OrderByClause<TBuilder>;
970
+ //#endregion
971
+ //#region src/orm/schema.d.ts
972
+ type UnionToIntersection<T> = (T extends unknown ? (value: T) => void : never) extends ((value: infer I) => void) ? I : never;
973
+ type Simplify<T> = { [K in keyof T]: T[K] } & {};
974
+ type ExtensionList = readonly AnySchemaExtension[];
975
+ type ExtensionTables<TExtension extends AnySchemaExtension> = TExtension extends SchemaExtension<infer TTables extends object, any, any> ? TTables : {};
976
+ type ExtensionRelationsConfig<TExtension extends AnySchemaExtension> = TExtension extends SchemaExtension<any, infer TRelationsConfig extends AnyRelationsBuilderConfig | undefined, any> ? TRelationsConfig extends AnyRelationsBuilderConfig ? TRelationsConfig : {} : {};
977
+ type ResolvedSchemaExtensions<TExtensions extends ExtensionList> = readonly [...typeof BUILTIN_SCHEMA_EXTENSIONS, ...TExtensions];
978
+ type InjectedSchemaFromExtensions<TExtensions extends ExtensionList> = Simplify<UnionToIntersection<ExtensionTables<TExtensions[number]>>>;
979
+ type SchemaWithExtensions<TSchema extends object, TExtensions extends ExtensionList> = Simplify<TSchema & InjectedSchemaFromExtensions<ResolvedSchemaExtensions<TExtensions>>>;
980
+ type RelationsConfigFromExtensions<TExtensions extends ExtensionList> = Simplify<UnionToIntersection<ExtensionRelationsConfig<ResolvedSchemaExtensions<TExtensions>[number]>>>;
981
+ type ResolvedRelationsConfig<TExtensions extends ExtensionList, TRelationsConfig extends AnyRelationsBuilderConfig | undefined> = Simplify<RelationsConfigFromExtensions<TExtensions> & (TRelationsConfig extends AnyRelationsBuilderConfig ? TRelationsConfig : {})>;
982
+ type SafeRelationsConfig<TExtensions extends ExtensionList, TRelationsConfig extends AnyRelationsBuilderConfig | undefined> = ResolvedRelationsConfig<TExtensions, TRelationsConfig> extends AnyRelationsBuilderConfig ? ResolvedRelationsConfig<TExtensions, TRelationsConfig> : AnyRelationsBuilderConfig;
983
+ type SchemaRelationsFactory<TSchema extends object, TRelationsConfig extends AnyRelationsBuilderConfig> = (helpers: RelationsBuilder<ExtractTablesFromSchema<TSchema>>) => TRelationsConfig;
984
+ type SchemaRelations<TSchema extends object, TExtensions extends ExtensionList, TRelationsConfig extends AnyRelationsBuilderConfig | undefined> = RelationsConfigWithSchema<SafeRelationsConfig<TExtensions, TRelationsConfig>, ExtractTablesFromSchema<TSchema>>;
985
+ type SchemaRelationsAuthoringConfig<TSchema extends object> = { [TTableName in keyof ExtractTablesFromSchema<TSchema>]?: RelationsBuilderConfigValue };
986
+ type SchemaOptions<StrictTableNameTypes extends boolean> = DefineSchemaOptions<StrictTableNameTypes> & {
987
+ strict?: boolean;
988
+ defaults?: OrmRuntimeDefaults;
989
+ };
990
+ type SchemaResult<TSchema extends GenericSchema, StrictTableNameTypes extends boolean, TExtensions extends ExtensionList, TRelationsConfig extends AnyRelationsBuilderConfig | undefined> = SchemaDefinition<SchemaWithExtensions<TSchema, TExtensions>, StrictTableNameTypes> & {
991
+ [OrmSchemaRelations]?: SchemaRelations<SchemaWithExtensions<TSchema, TExtensions>, TExtensions, TRelationsConfig>;
992
+ [OrmSchemaTriggers]?: OrmTriggers<SchemaRelations<SchemaWithExtensions<TSchema, TExtensions>, TExtensions, TRelationsConfig>>;
993
+ };
994
+ type SchemaChain<TSchema extends GenericSchema, StrictTableNameTypes extends boolean, TExtensions extends ExtensionList, TRelationsConfig extends AnyRelationsBuilderConfig | undefined, TCanExtend extends boolean, TCanRelations extends boolean, TCanTriggers extends boolean> = SchemaResult<TSchema, StrictTableNameTypes, TExtensions, TRelationsConfig> & (TCanExtend extends true ? {
995
+ extend: <const TNewExtensions extends ExtensionList>(...extensions: TNewExtensions) => SchemaChain<TSchema, StrictTableNameTypes, readonly [...TExtensions, ...TNewExtensions], TRelationsConfig, true, true, true>;
996
+ } : {}) & (TCanRelations extends true ? {
997
+ relations: <const TNextRelationsConfig extends SchemaRelationsAuthoringConfig<SchemaWithExtensions<TSchema, TExtensions>>>(relations: SchemaRelationsFactory<SchemaWithExtensions<TSchema, TExtensions>, TNextRelationsConfig>) => SchemaChain<TSchema, StrictTableNameTypes, TExtensions, TNextRelationsConfig, false, false, true>;
998
+ } : {}) & (TCanTriggers extends true ? {
999
+ triggers: (triggers: OrmTriggers<SchemaRelations<SchemaWithExtensions<TSchema, TExtensions>, TExtensions, TRelationsConfig>>) => SchemaChain<TSchema, StrictTableNameTypes, TExtensions, TRelationsConfig, false, false, false>;
1000
+ } : {});
1001
+ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1002
+ readonly aggregate_bucket: ConvexTableWithColumns<{
1003
+ name: "aggregate_bucket";
1004
+ columns: {
1005
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1006
+ _: {
1007
+ notNull: true;
1008
+ };
1009
+ } & {
1010
+ _: {
1011
+ tableName: "aggregate_bucket";
1012
+ };
1013
+ } & {
1014
+ _: {
1015
+ fieldName: "updatedAt";
1016
+ };
1017
+ };
1018
+ tableKey: ConvexTextBuilderInitial<""> & {
1019
+ _: {
1020
+ notNull: true;
1021
+ };
1022
+ } & {
1023
+ _: {
1024
+ tableName: "aggregate_bucket";
1025
+ };
1026
+ } & {
1027
+ _: {
1028
+ fieldName: "tableKey";
1029
+ };
1030
+ };
1031
+ indexName: ConvexTextBuilderInitial<""> & {
1032
+ _: {
1033
+ notNull: true;
1034
+ };
1035
+ } & {
1036
+ _: {
1037
+ tableName: "aggregate_bucket";
1038
+ };
1039
+ } & {
1040
+ _: {
1041
+ fieldName: "indexName";
1042
+ };
1043
+ };
1044
+ keyHash: ConvexTextBuilderInitial<""> & {
1045
+ _: {
1046
+ notNull: true;
1047
+ };
1048
+ } & {
1049
+ _: {
1050
+ tableName: "aggregate_bucket";
1051
+ };
1052
+ } & {
1053
+ _: {
1054
+ fieldName: "keyHash";
1055
+ };
1056
+ };
1057
+ keyParts: ConvexCustomBuilderInitial<"", convex_values0.VArray<any[], convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>, "required">> & {
1058
+ _: {
1059
+ $type: convex_values0.Value[];
1060
+ };
1061
+ } & {
1062
+ _: {
1063
+ notNull: true;
1064
+ };
1065
+ } & {
1066
+ _: {
1067
+ tableName: "aggregate_bucket";
1068
+ };
1069
+ } & {
1070
+ _: {
1071
+ fieldName: "keyParts";
1072
+ };
1073
+ };
1074
+ count: ConvexNumberBuilderInitial<""> & {
1075
+ _: {
1076
+ notNull: true;
1077
+ };
1078
+ } & {
1079
+ _: {
1080
+ tableName: "aggregate_bucket";
1081
+ };
1082
+ } & {
1083
+ _: {
1084
+ fieldName: "count";
1085
+ };
1086
+ };
1087
+ sumValues: (NotNull<$Type<ConvexCustomBuilderInitial<"", convex_values0.VRecord<Record<string, any>, convex_values0.VString<string, "required">, convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>, "required", string>>, Record<string, number>>> | NotNull<$Type<ConvexCustomBuilderInitial<"", convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>>, Record<string, number>>>) & {
1088
+ _: {
1089
+ tableName: "aggregate_bucket";
1090
+ };
1091
+ } & {
1092
+ _: {
1093
+ fieldName: "sumValues";
1094
+ };
1095
+ };
1096
+ nonNullCountValues: (NotNull<$Type<ConvexCustomBuilderInitial<"", convex_values0.VRecord<Record<string, any>, convex_values0.VString<string, "required">, convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>, "required", string>>, Record<string, number>>> | NotNull<$Type<ConvexCustomBuilderInitial<"", convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>>, Record<string, number>>>) & {
1097
+ _: {
1098
+ tableName: "aggregate_bucket";
1099
+ };
1100
+ } & {
1101
+ _: {
1102
+ fieldName: "nonNullCountValues";
1103
+ };
1104
+ };
1105
+ };
1106
+ }, {
1107
+ by_creation_time: ["_creationTime"];
1108
+ by_table_index_hash: ["tableKey", "indexName", "keyHash", "_creationTime"];
1109
+ by_table_index: ["tableKey", "indexName", "_creationTime"];
1110
+ }, {}, {}, {}>;
1111
+ readonly aggregate_member: ConvexTableWithColumns<{
1112
+ name: "aggregate_member";
1113
+ columns: {
1114
+ kind: ConvexTextBuilderInitial<""> & {
1115
+ _: {
1116
+ notNull: true;
1117
+ };
1118
+ } & {
1119
+ _: {
1120
+ tableName: "aggregate_member";
1121
+ };
1122
+ } & {
1123
+ _: {
1124
+ fieldName: "kind";
1125
+ };
1126
+ };
1127
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1128
+ _: {
1129
+ notNull: true;
1130
+ };
1131
+ } & {
1132
+ _: {
1133
+ tableName: "aggregate_member";
1134
+ };
1135
+ } & {
1136
+ _: {
1137
+ fieldName: "updatedAt";
1138
+ };
1139
+ };
1140
+ tableKey: ConvexTextBuilderInitial<""> & {
1141
+ _: {
1142
+ notNull: true;
1143
+ };
1144
+ } & {
1145
+ _: {
1146
+ tableName: "aggregate_member";
1147
+ };
1148
+ } & {
1149
+ _: {
1150
+ fieldName: "tableKey";
1151
+ };
1152
+ };
1153
+ indexName: ConvexTextBuilderInitial<""> & {
1154
+ _: {
1155
+ notNull: true;
1156
+ };
1157
+ } & {
1158
+ _: {
1159
+ tableName: "aggregate_member";
1160
+ };
1161
+ } & {
1162
+ _: {
1163
+ fieldName: "indexName";
1164
+ };
1165
+ };
1166
+ keyHash: ConvexTextBuilderInitial<""> & {
1167
+ _: {
1168
+ notNull: true;
1169
+ };
1170
+ } & {
1171
+ _: {
1172
+ tableName: "aggregate_member";
1173
+ };
1174
+ } & {
1175
+ _: {
1176
+ fieldName: "keyHash";
1177
+ };
1178
+ };
1179
+ keyParts: ConvexCustomBuilderInitial<"", convex_values0.VArray<any[], convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>, "required">> & {
1180
+ _: {
1181
+ $type: convex_values0.Value[];
1182
+ };
1183
+ } & {
1184
+ _: {
1185
+ notNull: true;
1186
+ };
1187
+ } & {
1188
+ _: {
1189
+ tableName: "aggregate_member";
1190
+ };
1191
+ } & {
1192
+ _: {
1193
+ fieldName: "keyParts";
1194
+ };
1195
+ };
1196
+ sumValues: (NotNull<$Type<ConvexCustomBuilderInitial<"", convex_values0.VRecord<Record<string, any>, convex_values0.VString<string, "required">, convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>, "required", string>>, Record<string, number>>> | NotNull<$Type<ConvexCustomBuilderInitial<"", convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>>, Record<string, number>>>) & {
1197
+ _: {
1198
+ tableName: "aggregate_member";
1199
+ };
1200
+ } & {
1201
+ _: {
1202
+ fieldName: "sumValues";
1203
+ };
1204
+ };
1205
+ nonNullCountValues: (NotNull<$Type<ConvexCustomBuilderInitial<"", convex_values0.VRecord<Record<string, any>, convex_values0.VString<string, "required">, convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>, "required", string>>, Record<string, number>>> | NotNull<$Type<ConvexCustomBuilderInitial<"", convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>>, Record<string, number>>>) & {
1206
+ _: {
1207
+ tableName: "aggregate_member";
1208
+ };
1209
+ } & {
1210
+ _: {
1211
+ fieldName: "nonNullCountValues";
1212
+ };
1213
+ };
1214
+ docId: ConvexTextBuilderInitial<""> & {
1215
+ _: {
1216
+ notNull: true;
1217
+ };
1218
+ } & {
1219
+ _: {
1220
+ tableName: "aggregate_member";
1221
+ };
1222
+ } & {
1223
+ _: {
1224
+ fieldName: "docId";
1225
+ };
1226
+ };
1227
+ extremaValues: (NotNull<$Type<ConvexCustomBuilderInitial<"", convex_values0.VRecord<Record<string, any>, convex_values0.VString<string, "required">, convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>, "required", string>>, Record<string, convex_values0.Value>>> | NotNull<$Type<ConvexCustomBuilderInitial<"", convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>>, Record<string, convex_values0.Value>>>) & {
1228
+ _: {
1229
+ tableName: "aggregate_member";
1230
+ };
1231
+ } & {
1232
+ _: {
1233
+ fieldName: "extremaValues";
1234
+ };
1235
+ };
1236
+ rankNamespace: ConvexCustomBuilderInitial<"", convex_values0.VAny<any, "required", string>> & {
1237
+ _: {
1238
+ $type: convex_values0.Value;
1239
+ };
1240
+ } & {
1241
+ _: {
1242
+ tableName: "aggregate_member";
1243
+ };
1244
+ } & {
1245
+ _: {
1246
+ fieldName: "rankNamespace";
1247
+ };
1248
+ };
1249
+ rankKey: ConvexCustomBuilderInitial<"", convex_values0.VAny<any, "required", string>> & {
1250
+ _: {
1251
+ $type: convex_values0.Value;
1252
+ };
1253
+ } & {
1254
+ _: {
1255
+ tableName: "aggregate_member";
1256
+ };
1257
+ } & {
1258
+ _: {
1259
+ fieldName: "rankKey";
1260
+ };
1261
+ };
1262
+ rankSumValue: ConvexNumberBuilderInitial<""> & {
1263
+ _: {
1264
+ tableName: "aggregate_member";
1265
+ };
1266
+ } & {
1267
+ _: {
1268
+ fieldName: "rankSumValue";
1269
+ };
1270
+ };
1271
+ };
1272
+ }, {
1273
+ by_creation_time: ["_creationTime"];
1274
+ by_kind_table_index_doc: ["kind", "tableKey", "indexName", "docId", "_creationTime"];
1275
+ by_kind_table_index: ["kind", "tableKey", "indexName", "_creationTime"];
1276
+ }, {}, {}, {}>;
1277
+ readonly aggregate_extrema: ConvexTableWithColumns<{
1278
+ name: "aggregate_extrema";
1279
+ columns: {
1280
+ value: ConvexCustomBuilderInitial<"", convex_values0.VAny<any, "required", string>> & {
1281
+ _: {
1282
+ $type: convex_values0.Value;
1283
+ };
1284
+ } & {
1285
+ _: {
1286
+ notNull: true;
1287
+ };
1288
+ } & {
1289
+ _: {
1290
+ tableName: "aggregate_extrema";
1291
+ };
1292
+ } & {
1293
+ _: {
1294
+ fieldName: "value";
1295
+ };
1296
+ };
1297
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1298
+ _: {
1299
+ notNull: true;
1300
+ };
1301
+ } & {
1302
+ _: {
1303
+ tableName: "aggregate_extrema";
1304
+ };
1305
+ } & {
1306
+ _: {
1307
+ fieldName: "updatedAt";
1308
+ };
1309
+ };
1310
+ tableKey: ConvexTextBuilderInitial<""> & {
1311
+ _: {
1312
+ notNull: true;
1313
+ };
1314
+ } & {
1315
+ _: {
1316
+ tableName: "aggregate_extrema";
1317
+ };
1318
+ } & {
1319
+ _: {
1320
+ fieldName: "tableKey";
1321
+ };
1322
+ };
1323
+ indexName: ConvexTextBuilderInitial<""> & {
1324
+ _: {
1325
+ notNull: true;
1326
+ };
1327
+ } & {
1328
+ _: {
1329
+ tableName: "aggregate_extrema";
1330
+ };
1331
+ } & {
1332
+ _: {
1333
+ fieldName: "indexName";
1334
+ };
1335
+ };
1336
+ keyHash: ConvexTextBuilderInitial<""> & {
1337
+ _: {
1338
+ notNull: true;
1339
+ };
1340
+ } & {
1341
+ _: {
1342
+ tableName: "aggregate_extrema";
1343
+ };
1344
+ } & {
1345
+ _: {
1346
+ fieldName: "keyHash";
1347
+ };
1348
+ };
1349
+ count: ConvexNumberBuilderInitial<""> & {
1350
+ _: {
1351
+ notNull: true;
1352
+ };
1353
+ } & {
1354
+ _: {
1355
+ tableName: "aggregate_extrema";
1356
+ };
1357
+ } & {
1358
+ _: {
1359
+ fieldName: "count";
1360
+ };
1361
+ };
1362
+ fieldName: ConvexTextBuilderInitial<""> & {
1363
+ _: {
1364
+ notNull: true;
1365
+ };
1366
+ } & {
1367
+ _: {
1368
+ tableName: "aggregate_extrema";
1369
+ };
1370
+ } & {
1371
+ _: {
1372
+ fieldName: "fieldName";
1373
+ };
1374
+ };
1375
+ valueHash: ConvexTextBuilderInitial<""> & {
1376
+ _: {
1377
+ notNull: true;
1378
+ };
1379
+ } & {
1380
+ _: {
1381
+ tableName: "aggregate_extrema";
1382
+ };
1383
+ } & {
1384
+ _: {
1385
+ fieldName: "valueHash";
1386
+ };
1387
+ };
1388
+ sortKey: ConvexTextBuilderInitial<""> & {
1389
+ _: {
1390
+ notNull: true;
1391
+ };
1392
+ } & {
1393
+ _: {
1394
+ tableName: "aggregate_extrema";
1395
+ };
1396
+ } & {
1397
+ _: {
1398
+ fieldName: "sortKey";
1399
+ };
1400
+ };
1401
+ };
1402
+ }, {
1403
+ by_creation_time: ["_creationTime"];
1404
+ by_table_index: ["tableKey", "indexName", "_creationTime"];
1405
+ by_table_index_hash_field_value: ["tableKey", "indexName", "keyHash", "fieldName", "valueHash", "_creationTime"];
1406
+ by_table_index_hash_field_sort: ["tableKey", "indexName", "keyHash", "fieldName", "sortKey", "_creationTime"];
1407
+ }, {}, {}, {}>;
1408
+ readonly aggregate_rank_tree: ConvexTableWithColumns<{
1409
+ name: "aggregate_rank_tree";
1410
+ columns: {
1411
+ aggregateName: ConvexTextBuilderInitial<""> & {
1412
+ _: {
1413
+ notNull: true;
1414
+ };
1415
+ } & {
1416
+ _: {
1417
+ tableName: "aggregate_rank_tree";
1418
+ };
1419
+ } & {
1420
+ _: {
1421
+ fieldName: "aggregateName";
1422
+ };
1423
+ };
1424
+ maxNodeSize: ConvexNumberBuilderInitial<""> & {
1425
+ _: {
1426
+ notNull: true;
1427
+ };
1428
+ } & {
1429
+ _: {
1430
+ tableName: "aggregate_rank_tree";
1431
+ };
1432
+ } & {
1433
+ _: {
1434
+ fieldName: "maxNodeSize";
1435
+ };
1436
+ };
1437
+ namespace: ConvexCustomBuilderInitial<"", convex_values0.VAny<any, "required", string>> & {
1438
+ _: {
1439
+ $type: convex_values0.Value;
1440
+ };
1441
+ } & {
1442
+ _: {
1443
+ tableName: "aggregate_rank_tree";
1444
+ };
1445
+ } & {
1446
+ _: {
1447
+ fieldName: "namespace";
1448
+ };
1449
+ };
1450
+ root: ConvexIdBuilderInitial<"", "aggregate_rank_node"> & {
1451
+ _: {
1452
+ notNull: true;
1453
+ };
1454
+ } & {
1455
+ _: {
1456
+ tableName: "aggregate_rank_tree";
1457
+ };
1458
+ } & {
1459
+ _: {
1460
+ fieldName: "root";
1461
+ };
1462
+ };
1463
+ };
1464
+ }, {
1465
+ by_creation_time: ["_creationTime"];
1466
+ by_namespace: ["namespace", "_creationTime"];
1467
+ by_aggregate_name: ["aggregateName", "_creationTime"];
1468
+ }, {}, {}, {}>;
1469
+ readonly aggregate_rank_node: ConvexTableWithColumns<{
1470
+ name: "aggregate_rank_node";
1471
+ columns: {
1472
+ aggregate: ($Type<ConvexCustomBuilderInitial<"", convex_values0.VRecord<Record<string, any>, convex_values0.VString<string, "required">, convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>, "required", string>>, {
1473
+ count: number;
1474
+ sum: number;
1475
+ }> | $Type<ConvexCustomBuilderInitial<"", convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>>, {
1476
+ count: number;
1477
+ sum: number;
1478
+ }>) & {
1479
+ _: {
1480
+ tableName: "aggregate_rank_node";
1481
+ };
1482
+ } & {
1483
+ _: {
1484
+ fieldName: "aggregate";
1485
+ };
1486
+ };
1487
+ items: ConvexCustomBuilderInitial<"", convex_values0.VArray<any[], convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>, "required">> & {
1488
+ _: {
1489
+ $type: {
1490
+ k: convex_values0.Value;
1491
+ v: convex_values0.Value;
1492
+ s: number;
1493
+ }[];
1494
+ };
1495
+ } & {
1496
+ _: {
1497
+ notNull: true;
1498
+ };
1499
+ } & {
1500
+ _: {
1501
+ tableName: "aggregate_rank_node";
1502
+ };
1503
+ } & {
1504
+ _: {
1505
+ fieldName: "items";
1506
+ };
1507
+ };
1508
+ subtrees: ConvexCustomBuilderInitial<"", convex_values0.VArray<any[], convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>, "required">> & {
1509
+ _: {
1510
+ $type: string[];
1511
+ };
1512
+ } & {
1513
+ _: {
1514
+ notNull: true;
1515
+ };
1516
+ } & {
1517
+ _: {
1518
+ tableName: "aggregate_rank_node";
1519
+ };
1520
+ } & {
1521
+ _: {
1522
+ fieldName: "subtrees";
1523
+ };
1524
+ };
1525
+ };
1526
+ }, {
1527
+ by_creation_time: ["_creationTime"];
1528
+ }, {}, {}, {}>;
1529
+ readonly aggregate_state: ConvexTableWithColumns<{
1530
+ name: "aggregate_state";
1531
+ columns: {
1532
+ status: ConvexTextBuilderInitial<""> & {
1533
+ _: {
1534
+ notNull: true;
1535
+ };
1536
+ } & {
1537
+ _: {
1538
+ tableName: "aggregate_state";
1539
+ };
1540
+ } & {
1541
+ _: {
1542
+ fieldName: "status";
1543
+ };
1544
+ };
1545
+ kind: ConvexTextBuilderInitial<""> & {
1546
+ _: {
1547
+ notNull: true;
1548
+ };
1549
+ } & {
1550
+ _: {
1551
+ tableName: "aggregate_state";
1552
+ };
1553
+ } & {
1554
+ _: {
1555
+ fieldName: "kind";
1556
+ };
1557
+ };
1558
+ cursor: ConvexTextBuilderInitial<""> & {
1559
+ _: {
1560
+ tableName: "aggregate_state";
1561
+ };
1562
+ } & {
1563
+ _: {
1564
+ fieldName: "cursor";
1565
+ };
1566
+ };
1567
+ processed: ConvexNumberBuilderInitial<""> & {
1568
+ _: {
1569
+ notNull: true;
1570
+ };
1571
+ } & {
1572
+ _: {
1573
+ tableName: "aggregate_state";
1574
+ };
1575
+ } & {
1576
+ _: {
1577
+ fieldName: "processed";
1578
+ };
1579
+ };
1580
+ startedAt: ConvexNumberBuilderInitial<""> & {
1581
+ _: {
1582
+ notNull: true;
1583
+ };
1584
+ } & {
1585
+ _: {
1586
+ tableName: "aggregate_state";
1587
+ };
1588
+ } & {
1589
+ _: {
1590
+ fieldName: "startedAt";
1591
+ };
1592
+ };
1593
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1594
+ _: {
1595
+ notNull: true;
1596
+ };
1597
+ } & {
1598
+ _: {
1599
+ tableName: "aggregate_state";
1600
+ };
1601
+ } & {
1602
+ _: {
1603
+ fieldName: "updatedAt";
1604
+ };
1605
+ };
1606
+ completedAt: ConvexNumberBuilderInitial<""> & {
1607
+ _: {
1608
+ tableName: "aggregate_state";
1609
+ };
1610
+ } & {
1611
+ _: {
1612
+ fieldName: "completedAt";
1613
+ };
1614
+ };
1615
+ lastError: ConvexTextBuilderInitial<""> & {
1616
+ _: {
1617
+ tableName: "aggregate_state";
1618
+ };
1619
+ } & {
1620
+ _: {
1621
+ fieldName: "lastError";
1622
+ };
1623
+ };
1624
+ tableKey: ConvexTextBuilderInitial<""> & {
1625
+ _: {
1626
+ notNull: true;
1627
+ };
1628
+ } & {
1629
+ _: {
1630
+ tableName: "aggregate_state";
1631
+ };
1632
+ } & {
1633
+ _: {
1634
+ fieldName: "tableKey";
1635
+ };
1636
+ };
1637
+ indexName: ConvexTextBuilderInitial<""> & {
1638
+ _: {
1639
+ notNull: true;
1640
+ };
1641
+ } & {
1642
+ _: {
1643
+ tableName: "aggregate_state";
1644
+ };
1645
+ } & {
1646
+ _: {
1647
+ fieldName: "indexName";
1648
+ };
1649
+ };
1650
+ keyDefinitionHash: ConvexTextBuilderInitial<""> & {
1651
+ _: {
1652
+ notNull: true;
1653
+ };
1654
+ } & {
1655
+ _: {
1656
+ tableName: "aggregate_state";
1657
+ };
1658
+ } & {
1659
+ _: {
1660
+ fieldName: "keyDefinitionHash";
1661
+ };
1662
+ };
1663
+ metricDefinitionHash: ConvexTextBuilderInitial<""> & {
1664
+ _: {
1665
+ notNull: true;
1666
+ };
1667
+ } & {
1668
+ _: {
1669
+ tableName: "aggregate_state";
1670
+ };
1671
+ } & {
1672
+ _: {
1673
+ fieldName: "metricDefinitionHash";
1674
+ };
1675
+ };
1676
+ };
1677
+ }, {
1678
+ by_creation_time: ["_creationTime"];
1679
+ by_kind_table_index: ["kind", "tableKey", "indexName", "_creationTime"];
1680
+ by_kind_status: ["kind", "status", "_creationTime"];
1681
+ by_table_status: ["tableKey", "status", "_creationTime"];
1682
+ }, {}, {}, {}>;
1683
+ }>, SchemaExtension<{
1684
+ readonly migration_state: ConvexTableWithColumns<{
1685
+ name: "migration_state";
1686
+ columns: {
1687
+ status: ConvexTextBuilderInitial<""> & {
1688
+ _: {
1689
+ notNull: true;
1690
+ };
1691
+ } & {
1692
+ _: {
1693
+ tableName: "migration_state";
1694
+ };
1695
+ } & {
1696
+ _: {
1697
+ fieldName: "status";
1698
+ };
1699
+ };
1700
+ cursor: ConvexTextBuilderInitial<""> & {
1701
+ _: {
1702
+ tableName: "migration_state";
1703
+ };
1704
+ } & {
1705
+ _: {
1706
+ fieldName: "cursor";
1707
+ };
1708
+ };
1709
+ direction: ConvexTextBuilderInitial<""> & {
1710
+ _: {
1711
+ tableName: "migration_state";
1712
+ };
1713
+ } & {
1714
+ _: {
1715
+ fieldName: "direction";
1716
+ };
1717
+ };
1718
+ migrationId: ConvexTextBuilderInitial<""> & {
1719
+ _: {
1720
+ notNull: true;
1721
+ };
1722
+ } & {
1723
+ _: {
1724
+ tableName: "migration_state";
1725
+ };
1726
+ } & {
1727
+ _: {
1728
+ fieldName: "migrationId";
1729
+ };
1730
+ };
1731
+ checksum: ConvexTextBuilderInitial<""> & {
1732
+ _: {
1733
+ notNull: true;
1734
+ };
1735
+ } & {
1736
+ _: {
1737
+ tableName: "migration_state";
1738
+ };
1739
+ } & {
1740
+ _: {
1741
+ fieldName: "checksum";
1742
+ };
1743
+ };
1744
+ applied: ConvexBooleanBuilderInitial<""> & {
1745
+ _: {
1746
+ notNull: true;
1747
+ };
1748
+ } & {
1749
+ _: {
1750
+ tableName: "migration_state";
1751
+ };
1752
+ } & {
1753
+ _: {
1754
+ fieldName: "applied";
1755
+ };
1756
+ };
1757
+ runId: ConvexTextBuilderInitial<""> & {
1758
+ _: {
1759
+ tableName: "migration_state";
1760
+ };
1761
+ } & {
1762
+ _: {
1763
+ fieldName: "runId";
1764
+ };
1765
+ };
1766
+ processed: ConvexNumberBuilderInitial<""> & {
1767
+ _: {
1768
+ notNull: true;
1769
+ };
1770
+ } & {
1771
+ _: {
1772
+ tableName: "migration_state";
1773
+ };
1774
+ } & {
1775
+ _: {
1776
+ fieldName: "processed";
1777
+ };
1778
+ };
1779
+ startedAt: ConvexNumberBuilderInitial<""> & {
1780
+ _: {
1781
+ tableName: "migration_state";
1782
+ };
1783
+ } & {
1784
+ _: {
1785
+ fieldName: "startedAt";
1786
+ };
1787
+ };
1788
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1789
+ _: {
1790
+ notNull: true;
1791
+ };
1792
+ } & {
1793
+ _: {
1794
+ tableName: "migration_state";
1795
+ };
1796
+ } & {
1797
+ _: {
1798
+ fieldName: "updatedAt";
1799
+ };
1800
+ };
1801
+ completedAt: ConvexNumberBuilderInitial<""> & {
1802
+ _: {
1803
+ tableName: "migration_state";
1804
+ };
1805
+ } & {
1806
+ _: {
1807
+ fieldName: "completedAt";
1808
+ };
1809
+ };
1810
+ lastError: ConvexTextBuilderInitial<""> & {
1811
+ _: {
1812
+ tableName: "migration_state";
1813
+ };
1814
+ } & {
1815
+ _: {
1816
+ fieldName: "lastError";
1817
+ };
1818
+ };
1819
+ writeMode: ConvexTextBuilderInitial<""> & {
1820
+ _: {
1821
+ notNull: true;
1822
+ };
1823
+ } & {
1824
+ _: {
1825
+ tableName: "migration_state";
1826
+ };
1827
+ } & {
1828
+ _: {
1829
+ fieldName: "writeMode";
1830
+ };
1831
+ };
1832
+ };
1833
+ }, {
1834
+ by_creation_time: ["_creationTime"];
1835
+ by_migration_id: ["migrationId", "_creationTime"];
1836
+ by_status: ["status", "_creationTime"];
1837
+ }, {}, {}, {}>;
1838
+ readonly migration_run: ConvexTableWithColumns<{
1839
+ name: "migration_run";
1840
+ columns: {
1841
+ status: ConvexTextBuilderInitial<""> & {
1842
+ _: {
1843
+ notNull: true;
1844
+ };
1845
+ } & {
1846
+ _: {
1847
+ tableName: "migration_run";
1848
+ };
1849
+ } & {
1850
+ _: {
1851
+ fieldName: "status";
1852
+ };
1853
+ };
1854
+ direction: ConvexTextBuilderInitial<""> & {
1855
+ _: {
1856
+ notNull: true;
1857
+ };
1858
+ } & {
1859
+ _: {
1860
+ tableName: "migration_run";
1861
+ };
1862
+ } & {
1863
+ _: {
1864
+ fieldName: "direction";
1865
+ };
1866
+ };
1867
+ runId: ConvexTextBuilderInitial<""> & {
1868
+ _: {
1869
+ notNull: true;
1870
+ };
1871
+ } & {
1872
+ _: {
1873
+ tableName: "migration_run";
1874
+ };
1875
+ } & {
1876
+ _: {
1877
+ fieldName: "runId";
1878
+ };
1879
+ };
1880
+ startedAt: ConvexNumberBuilderInitial<""> & {
1881
+ _: {
1882
+ notNull: true;
1883
+ };
1884
+ } & {
1885
+ _: {
1886
+ tableName: "migration_run";
1887
+ };
1888
+ } & {
1889
+ _: {
1890
+ fieldName: "startedAt";
1891
+ };
1892
+ };
1893
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1894
+ _: {
1895
+ notNull: true;
1896
+ };
1897
+ } & {
1898
+ _: {
1899
+ tableName: "migration_run";
1900
+ };
1901
+ } & {
1902
+ _: {
1903
+ fieldName: "updatedAt";
1904
+ };
1905
+ };
1906
+ completedAt: ConvexNumberBuilderInitial<""> & {
1907
+ _: {
1908
+ tableName: "migration_run";
1909
+ };
1910
+ } & {
1911
+ _: {
1912
+ fieldName: "completedAt";
1913
+ };
1914
+ };
1915
+ lastError: ConvexTextBuilderInitial<""> & {
1916
+ _: {
1917
+ tableName: "migration_run";
1918
+ };
1919
+ } & {
1920
+ _: {
1921
+ fieldName: "lastError";
1922
+ };
1923
+ };
1924
+ dryRun: ConvexBooleanBuilderInitial<""> & {
1925
+ _: {
1926
+ notNull: true;
1927
+ };
1928
+ } & {
1929
+ _: {
1930
+ tableName: "migration_run";
1931
+ };
1932
+ } & {
1933
+ _: {
1934
+ fieldName: "dryRun";
1935
+ };
1936
+ };
1937
+ allowDrift: ConvexBooleanBuilderInitial<""> & {
1938
+ _: {
1939
+ notNull: true;
1940
+ };
1941
+ } & {
1942
+ _: {
1943
+ tableName: "migration_run";
1944
+ };
1945
+ } & {
1946
+ _: {
1947
+ fieldName: "allowDrift";
1948
+ };
1949
+ };
1950
+ migrationIds: ConvexCustomBuilderInitial<"", convex_values0.VArray<string[], convex_values0.VString<string, "required">, "required">> & {
1951
+ _: {
1952
+ notNull: true;
1953
+ };
1954
+ } & {
1955
+ _: {
1956
+ tableName: "migration_run";
1957
+ };
1958
+ } & {
1959
+ _: {
1960
+ fieldName: "migrationIds";
1961
+ };
1962
+ };
1963
+ currentIndex: ConvexNumberBuilderInitial<""> & {
1964
+ _: {
1965
+ notNull: true;
1966
+ };
1967
+ } & {
1968
+ _: {
1969
+ tableName: "migration_run";
1970
+ };
1971
+ } & {
1972
+ _: {
1973
+ fieldName: "currentIndex";
1974
+ };
1975
+ };
1976
+ cancelRequested: ConvexBooleanBuilderInitial<""> & {
1977
+ _: {
1978
+ notNull: true;
1979
+ };
1980
+ } & {
1981
+ _: {
1982
+ tableName: "migration_run";
1983
+ };
1984
+ } & {
1985
+ _: {
1986
+ fieldName: "cancelRequested";
1987
+ };
1988
+ };
1989
+ };
1990
+ }, {
1991
+ by_creation_time: ["_creationTime"];
1992
+ by_status: ["status", "_creationTime"];
1993
+ by_run_id: ["runId", "_creationTime"];
1994
+ }, {}, {}, {}>;
1995
+ }>];
1996
+ declare function defineSchema$1<TSchema extends GenericSchema, StrictTableNameTypes extends boolean = true>(schema: TSchema, options?: SchemaOptions<StrictTableNameTypes>): SchemaChain<TSchema, StrictTableNameTypes, readonly [], undefined, true, true, true>;
1997
+ declare function getSchemaRelations<TSchema extends object>(schema: TSchema): TSchema extends {
1998
+ [OrmSchemaRelations]?: infer TRelations;
1999
+ } ? TRelations : undefined;
2000
+ declare function getSchemaRelations(schema: unknown): TablesRelationalConfig | undefined;
2001
+ declare function requireSchemaRelations<TSchema extends object>(schema: TSchema): Exclude<TSchema extends {
2002
+ [OrmSchemaRelations]?: infer TRelations;
2003
+ } ? TRelations : never, undefined>;
2004
+ declare function requireSchemaRelations(schema: unknown): TablesRelationalConfig;
2005
+ declare function getSchemaTriggers<TSchema extends object>(schema: TSchema): TSchema extends {
2006
+ [OrmSchemaTriggers]?: infer TTriggers;
2007
+ } ? TTriggers : undefined;
2008
+ declare function getSchemaTriggers(schema: unknown): OrmTriggers<TablesRelationalConfig> | undefined;
2009
+ //#endregion
2010
+ //#region src/orm/where-clause-compiler.d.ts
2011
+ /**
2012
+ * Result of compiling a where clause
2013
+ * Contains index selection and filter expressions
2014
+ */
2015
+ interface WhereClauseResult {
2016
+ /** Filters that can use the index (eq/range on indexed fields) */
2017
+ indexFilters: FilterExpression$1<boolean>[];
2018
+ /** Filters applied after index scan (gt, lt, and, or, not) */
2019
+ postFilters: FilterExpression$1<boolean>[];
2020
+ /** Multi-probe filter groups for OR/inArray index union plans */
2021
+ probeFilters: FilterExpression$1<boolean>[][];
2022
+ /** Selected index for query optimization (null if no suitable index) */
2023
+ selectedIndex: IndexLike | null;
2024
+ /** Planning strategy used for index compilation */
2025
+ strategy: IndexStrategy;
2026
+ }
2027
+ type IndexStrategy = 'none' | 'singleIndex' | 'rangeIndex' | 'multiProbe';
2028
+ /**
2029
+ * Compiles FilterExpression trees into optimized Convex queries
2030
+ *
2031
+ * Algorithm:
2032
+ * 1. Extract field references from expression tree
2033
+ * 2. Score available indexes by field match quality
2034
+ * 3. Select best index (exact > prefix > partial)
2035
+ * 4. Split filters into index-compatible vs post-filters
2036
+ */
2037
+ interface IndexLike {
2038
+ indexFields: string[];
2039
+ indexName: string;
2040
+ }
2041
+ //#endregion
2042
+ export { OrmClientWithApi as $, ConvexDateMode as A, ConvexBytesBuilderInitial as B, ConvexNumberBuilderInitial as C, migrationCapability as Ct, id as D, ConvexIdBuilderInitial as E, custom as F, ConvexBigIntBuilder as G, ConvexBooleanBuilder as H, json as I, CreateOrmOptions as J, ConvexBigIntBuilderInitial as K, objectOf as L, ConvexCustomBuilder as M, ConvexCustomBuilderInitial as N, ConvexDateBuilder as O, arrayOf as P, OrmClientBase as Q, unionOf as R, ConvexNumberBuilder as S, defineTriggers as St, ConvexIdBuilder as T, ConvexBooleanBuilderInitial as U, bytes as V, boolean as W, GenericOrmCtx as X, GenericOrm as Y, OrmApiResult as Z, ConvexTimestampMode as _, OrmBeforeResult as _t, requireSchemaRelations as a, ScheduledMutationBatchArgs as at, ConvexTextEnumBuilderInitial as b, OrmTriggerContext as bt, TableConfigResult as c, scheduledDeleteFactory as ct, OrmNotFoundError as d, MIGRATION_STORAGE_TABLE_NAMES as dt, OrmFunctions as et, ConvexVectorBuilder as f, injectMigrationStorageTables as ft, ConvexTimestampBuilderInitial as g, defineSchemaExtension as gt, ConvexTimestampBuilder as h, SchemaExtension as ht, getSchemaTriggers as i, createOrm as it, date as j, ConvexDateBuilderInitial as k, getTableColumns as l, MIGRATION_RUN_TABLE as lt, vector as m, migrationStorageTables as mt, defineSchema$1 as n, OrmWriterCtx as nt, asc as o, scheduledMutationBatchFactory as ot, ConvexVectorBuilderInitial as p, migrationExtension as pt, bigint as q, getSchemaRelations as r, ResolveOrmSchema as rt, desc as s, ScheduledDeleteArgs as st, WhereClauseResult as t, OrmReaderCtx as tt, getTableConfig as u, MIGRATION_STATE_TABLE as ut, timestamp as v, OrmTableTriggers as vt, integer as w, textEnum as x, OrmTriggers as xt, ConvexTextEnumBuilder as y, OrmTriggerChange as yt, ConvexBytesBuilder as z };