kitcn 0.32.1 → 0.32.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # kitcn
2
2
 
3
+ ## 0.32.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#448](https://github.com/udecode/kitcn/pull/448) [`75ceda6`](https://github.com/udecode/kitcn/commit/75ceda65a12b4dfdd525c97a9401a31c54fd89d0) Thanks [@MikeyZhang75](https://github.com/MikeyZhang75)! - ## Patches
8
+
9
+ - Improve the read cost of a relation `where` on a relation joined on a column
10
+ other than the primary id, including `through` targets and `_count` on a
11
+ `through` relation.
12
+ - Fix relation targets sharing one loaded document, which could add fields to a
13
+ relation that only another relation in the same query requested.
14
+
3
15
  ## 0.32.1
4
16
 
5
17
  ### Patch Changes
@@ -1,5 +1,5 @@
1
- import { Vn as ConvexTextBuilderInitial, Zt as ConvexTableWithColumns } from "../capabilities-Ctcw2VRq.js";
2
- import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-BHGHbfb9.js";
1
+ import { Vn as ConvexTextBuilderInitial, Zt as ConvexTableWithColumns } from "../capabilities-BJm_VSDT.js";
2
+ import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-Dgf4lrO-.js";
3
3
  import * as convex_values0 from "convex/values";
4
4
  import { GenericId, Infer, Value } from "convex/values";
5
5
  import { DocumentByName, GenericDataModel, GenericDatabaseReader, GenericDatabaseWriter, TableNamesInDataModel } from "convex/server";
@@ -1,2 +1,2 @@
1
- import { C as GenericAuthTriggerHandlers, S as GenericAuthTriggerChange, T as defineAuth, b as GenericAuthBeforeResult, i as getGeneratedAuthDisabledReason, n as GeneratedAuthDisabledReasonKind, r as createDisabledAuthRuntime, t as AuthRuntime, w as GenericAuthTriggers, x as GenericAuthDefinition, y as BetterAuthOptionsWithoutDatabase } from "../../generated-contract-disabled-PdNGvNYP.js";
1
+ import { C as GenericAuthTriggerHandlers, S as GenericAuthTriggerChange, T as defineAuth, b as GenericAuthBeforeResult, i as getGeneratedAuthDisabledReason, n as GeneratedAuthDisabledReasonKind, r as createDisabledAuthRuntime, t as AuthRuntime, w as GenericAuthTriggers, x as GenericAuthDefinition, y as BetterAuthOptionsWithoutDatabase } from "../../generated-contract-disabled-BRm1dNQE.js";
2
2
  export { type AuthRuntime, BetterAuthOptionsWithoutDatabase, type GeneratedAuthDisabledReasonKind, GenericAuthBeforeResult, GenericAuthDefinition, GenericAuthTriggerChange, GenericAuthTriggerHandlers, GenericAuthTriggers, createDisabledAuthRuntime, defineAuth, getGeneratedAuthDisabledReason };
@@ -1,7 +1,7 @@
1
1
  import { a as QueryCtxWithPreferredOrmQueryTable, n as LookupByIdResultByCtx, t as DocByCtx } from "../query-context-BkNjkDCk.js";
2
2
  import { t as GetAuth } from "../types-ex0-J-SC.js";
3
3
  import { t as GenericCtx } from "../context-utils-Cbv4r0AA.js";
4
- import { C as GenericAuthTriggerHandlers, S as GenericAuthTriggerChange, T as defineAuth, _ as updateManyHandler, a as AuthFunctions, b as GenericAuthBeforeResult, c as consumeOneHandler, d as createHandler, f as deleteManyHandler, g as incrementOneHandler, h as findOneHandler, i as getGeneratedAuthDisabledReason, l as countHandler, m as findManyHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as deleteOneHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as createApi, v as updateOneHandler, w as GenericAuthTriggers, x as GenericAuthDefinition, y as BetterAuthOptionsWithoutDatabase } from "../generated-contract-disabled-PdNGvNYP.js";
4
+ import { C as GenericAuthTriggerHandlers, S as GenericAuthTriggerChange, T as defineAuth, _ as updateManyHandler, a as AuthFunctions, b as GenericAuthBeforeResult, c as consumeOneHandler, d as createHandler, f as deleteManyHandler, g as incrementOneHandler, h as findOneHandler, i as getGeneratedAuthDisabledReason, l as countHandler, m as findManyHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as deleteOneHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as createApi, v as updateOneHandler, w as GenericAuthTriggers, x as GenericAuthDefinition, y as BetterAuthOptionsWithoutDatabase } from "../generated-contract-disabled-BRm1dNQE.js";
5
5
  import * as convex_values0 from "convex/values";
6
6
  import { Infer } from "convex/values";
7
7
  import { AuthConfig, DocumentByName, GenericDataModel, GenericMutationCtx, GenericQueryCtx, GenericSchema, PaginationOptions, PaginationResult, SchemaDefinition, TableNamesInDataModel } from "convex/server";
@@ -111,22 +111,22 @@ declare const adapterWhereValidator: convex_values0.VObject<{
111
111
  mode?: "sensitive" | "insensitive" | undefined;
112
112
  connector?: "AND" | "OR" | undefined;
113
113
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
114
- field: string;
115
114
  value: string | number | boolean | string[] | number[] | null;
115
+ field: string;
116
116
  }, {
117
117
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
118
118
  field: convex_values0.VString<string, "required">;
119
119
  mode: convex_values0.VUnion<"sensitive" | "insensitive" | undefined, [convex_values0.VLiteral<"sensitive", "required">, convex_values0.VLiteral<"insensitive", "required">], "optional", never>;
120
120
  operator: convex_values0.VUnion<"lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
121
121
  value: convex_values0.VUnion<string | number | boolean | string[] | number[] | null, [convex_values0.VString<string, "required">, convex_values0.VFloat64<number, "required">, convex_values0.VBoolean<boolean, "required">, convex_values0.VArray<string[], convex_values0.VString<string, "required">, "required">, convex_values0.VArray<number[], convex_values0.VFloat64<number, "required">, "required">, convex_values0.VNull<null, "required">], "required", never>;
122
- }, "required", "mode" | "connector" | "field" | "operator" | "value">;
122
+ }, "required", "mode" | "value" | "connector" | "field" | "operator">;
123
123
  declare const adapterArgsValidator: convex_values0.VObject<{
124
124
  where?: {
125
125
  mode?: "sensitive" | "insensitive" | undefined;
126
126
  connector?: "AND" | "OR" | undefined;
127
127
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
128
- field: string;
129
128
  value: string | number | boolean | string[] | number[] | null;
129
+ field: string;
130
130
  }[] | undefined;
131
131
  limit?: number | undefined;
132
132
  offset?: number | undefined;
@@ -152,21 +152,21 @@ declare const adapterArgsValidator: convex_values0.VObject<{
152
152
  mode?: "sensitive" | "insensitive" | undefined;
153
153
  connector?: "AND" | "OR" | undefined;
154
154
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
155
- field: string;
156
155
  value: string | number | boolean | string[] | number[] | null;
156
+ field: string;
157
157
  }[] | undefined, convex_values0.VObject<{
158
158
  mode?: "sensitive" | "insensitive" | undefined;
159
159
  connector?: "AND" | "OR" | undefined;
160
160
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
161
- field: string;
162
161
  value: string | number | boolean | string[] | number[] | null;
162
+ field: string;
163
163
  }, {
164
164
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
165
165
  field: convex_values0.VString<string, "required">;
166
166
  mode: convex_values0.VUnion<"sensitive" | "insensitive" | undefined, [convex_values0.VLiteral<"sensitive", "required">, convex_values0.VLiteral<"insensitive", "required">], "optional", never>;
167
167
  operator: convex_values0.VUnion<"lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
168
168
  value: convex_values0.VUnion<string | number | boolean | string[] | number[] | null, [convex_values0.VString<string, "required">, convex_values0.VFloat64<number, "required">, convex_values0.VBoolean<boolean, "required">, convex_values0.VArray<string[], convex_values0.VString<string, "required">, "required">, convex_values0.VArray<number[], convex_values0.VFloat64<number, "required">, "required">, convex_values0.VNull<null, "required">], "required", never>;
169
- }, "required", "mode" | "connector" | "field" | "operator" | "value">, "optional">;
169
+ }, "required", "mode" | "value" | "connector" | "field" | "operator">, "optional">;
170
170
  }, "required", "model" | "where" | "limit" | "offset" | "select" | "sortBy" | "sortBy.field" | "sortBy.direction">;
171
171
  declare const hasUniqueFields: (betterAuthSchema: BetterAuthDBSchema, model: string, input: Record<string, any>) => boolean;
172
172
  declare const checkUniqueFields: <Schema extends SchemaDefinition<any, any>>(ctx: GenericQueryCtx<GenericDataModel>, schema: Schema, betterAuthSchema: BetterAuthDBSchema, table: string, input: Record<string, any>, doc?: Record<string, any>) => Promise<void>;
@@ -2922,6 +2922,20 @@ declare class GelRelationalQuery<TSchema extends TablesRelationalConfig, TTableC
2922
2922
  * intervening write would make it stale.
2923
2923
  */
2924
2924
  private readonly _documentByNormalizedId;
2925
+ /**
2926
+ * Single target documents resolved by an eq-pinned key during one execution,
2927
+ * keyed on the read itself: table, index, join columns and their values.
2928
+ *
2929
+ * `_documentByNormalizedId` only covers a join on the primary id. A relation
2930
+ * joined on any other column resolves its target with `.first()` instead, and
2931
+ * the same one-row-at-a-time membership predicate re-issues that read once per
2932
+ * drain. The index is fixed for the whole relation and the key is pinned by
2933
+ * `eq`, so the first row is a pure function of this key within an execution.
2934
+ *
2935
+ * Same scope and staleness argument as `_documentByNormalizedId`: not handed
2936
+ * to the next run by `_forExecution`, so an intervening write is still seen.
2937
+ */
2938
+ private readonly _firstDocumentByFieldKey;
2925
2939
  constructor(schema: TSchema, tableConfig: TTableConfig, edgeMetadata: EdgeMetadata[], db: GenericDatabaseReader<any>, config: DBQueryConfig<'one' | 'many', boolean, TSchema, TTableConfig>, mode: 'many' | 'first' | 'firstOrThrow' | 'count' | 'aggregate' | 'groupBy', _allEdges?: EdgeMetadata[] | undefined, // M6.5 Phase 2: All edges for nested loading
2926
2940
  rls?: RlsContext | undefined, relationLoading?: {
2927
2941
  concurrency?: number;
@@ -3219,7 +3233,39 @@ declare class GelRelationalQuery<TSchema extends TablesRelationalConfig, TTableC
3219
3233
  * Helper for recursive relation loading
3220
3234
  */
3221
3235
  private _getTargetTableEdges;
3236
+ /**
3237
+ * A memo entry is a snapshot, so every caller has to get its own document.
3238
+ *
3239
+ * Relation loaders write nested `with` results and `extras` straight onto the
3240
+ * target they were handed, and `hydrateDateFieldsForRead` copies every own key
3241
+ * it finds. Two loads that share one entry would therefore publish each
3242
+ * other's fields — a relation asked for as `true` coming back carrying a
3243
+ * nested relation only the `where` requested. Those writes are all top-level,
3244
+ * so a shallow copy is exactly as much isolation as they need.
3245
+ */
3246
+ private _ownedCopy;
3222
3247
  private _getById;
3248
+ /**
3249
+ * Identity of one `_firstByFields` read, or null when the join values cannot
3250
+ * be encoded losslessly.
3251
+ *
3252
+ * `JSON.stringify` alone is not safe here. It renders every `ArrayBuffer` as
3253
+ * `{}` and `NaN`/`Infinity`/`-Infinity` as `null`, so two distinct join values
3254
+ * would share one entry, and it throws outright on `int64`. The relation
3255
+ * loader's own per-batch key map cannot catch that, because the residual
3256
+ * relation `where` hands it one row at a time — a map of one never compares
3257
+ * two values. This key is the only thing that tells them apart.
3258
+ *
3259
+ * `convexToJson` is the same wire encoding the client uses for query keys, so
3260
+ * every Convex value round-trips distinctly. Anything it rejects is not a
3261
+ * Convex value and simply goes unmemoized.
3262
+ */
3263
+ private _firstByFieldsMemoKey;
3264
+ /**
3265
+ * `_getById` for a relation joined on something other than the primary id:
3266
+ * resolve one target document by an eq-pinned key, memoized per execution.
3267
+ */
3268
+ private _firstByFields;
3223
3269
  private _getRelationConcurrency;
3224
3270
  private _getRelationFanOutKeyCap;
3225
3271
  private _enforceRelationFanOutKeyCap;
@@ -201,8 +201,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
201
201
  mode?: "sensitive" | "insensitive" | undefined;
202
202
  connector?: "AND" | "OR" | undefined;
203
203
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
204
- field: string;
205
204
  value: string | number | boolean | string[] | number[] | null;
205
+ field: string;
206
206
  }[] | undefined;
207
207
  model: string;
208
208
  }, Promise<number | null>>;
@@ -211,8 +211,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
211
211
  where?: {
212
212
  connector?: "AND" | "OR" | undefined;
213
213
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
214
- field: string;
215
214
  value: string | number | boolean | string[] | number[] | null;
215
+ field: string;
216
216
  }[] | undefined;
217
217
  model: string;
218
218
  } | {
@@ -239,8 +239,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
239
239
  where?: {
240
240
  connector?: "AND" | "OR" | undefined;
241
241
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
242
- field: string;
243
242
  value: string | number | boolean | string[] | number[] | null;
243
+ field: string;
244
244
  }[] | undefined;
245
245
  model: string;
246
246
  } | {
@@ -268,8 +268,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
268
268
  where?: {
269
269
  connector?: "AND" | "OR" | undefined;
270
270
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
271
- field: string;
272
271
  value: string | number | boolean | string[] | number[] | null;
272
+ field: string;
273
273
  }[] | undefined;
274
274
  model: string;
275
275
  } | {
@@ -283,8 +283,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
283
283
  mode?: "sensitive" | "insensitive" | undefined;
284
284
  connector?: "AND" | "OR" | undefined;
285
285
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
286
- field: string;
287
286
  value: string | number | boolean | string[] | number[] | null;
287
+ field: string;
288
288
  }[] | undefined;
289
289
  limit?: number | undefined;
290
290
  offset?: number | undefined;
@@ -308,8 +308,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
308
308
  mode?: "sensitive" | "insensitive" | undefined;
309
309
  connector?: "AND" | "OR" | undefined;
310
310
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
311
- field: string;
312
311
  value: string | number | boolean | string[] | number[] | null;
312
+ field: string;
313
313
  }[] | undefined;
314
314
  select?: string[] | undefined;
315
315
  model: string;
@@ -321,8 +321,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
321
321
  mode?: "sensitive" | "insensitive" | undefined;
322
322
  connector?: "AND" | "OR" | undefined;
323
323
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
324
- field: string;
325
324
  value: string | number | boolean | string[] | number[] | null;
325
+ field: string;
326
326
  }[] | undefined;
327
327
  set?: Record<string, any> | undefined;
328
328
  model: string;
@@ -335,8 +335,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
335
335
  where?: {
336
336
  connector?: "AND" | "OR" | undefined;
337
337
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
338
- field: string;
339
338
  value: string | number | boolean | string[] | number[] | null;
339
+ field: string;
340
340
  }[] | undefined;
341
341
  model: string;
342
342
  update: {
@@ -370,8 +370,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
370
370
  where?: {
371
371
  connector?: "AND" | "OR" | undefined;
372
372
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
373
- field: string;
374
373
  value: string | number | boolean | string[] | number[] | null;
374
+ field: string;
375
375
  }[] | undefined;
376
376
  model: string;
377
377
  update: {
@@ -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-Ctcw2VRq.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-BJm_VSDT.js";
2
2
 
3
3
  //#region src/orm/aggregate-index/capability.d.ts
4
4
  /**
@@ -1,5 +1,5 @@
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-Ctcw2VRq.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-BHGHbfb9.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-BJm_VSDT.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-Dgf4lrO-.js";
3
3
  import { i as pretendRequired, n as deprecated, r as pretend } from "../validators-0I-Ik1EN.js";
4
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";
package/dist/orm/index.js CHANGED
@@ -1633,6 +1633,20 @@ var GelRelationalQuery = class GelRelationalQuery extends QueryPromise {
1633
1633
  * intervening write would make it stale.
1634
1634
  */
1635
1635
  _documentByNormalizedId = /* @__PURE__ */ new Map();
1636
+ /**
1637
+ * Single target documents resolved by an eq-pinned key during one execution,
1638
+ * keyed on the read itself: table, index, join columns and their values.
1639
+ *
1640
+ * `_documentByNormalizedId` only covers a join on the primary id. A relation
1641
+ * joined on any other column resolves its target with `.first()` instead, and
1642
+ * the same one-row-at-a-time membership predicate re-issues that read once per
1643
+ * drain. The index is fixed for the whole relation and the key is pinned by
1644
+ * `eq`, so the first row is a pure function of this key within an execution.
1645
+ *
1646
+ * Same scope and staleness argument as `_documentByNormalizedId`: not handed
1647
+ * to the next run by `_forExecution`, so an intervening write is still seen.
1648
+ */
1649
+ _firstDocumentByFieldKey = /* @__PURE__ */ new Map();
1636
1650
  constructor(schema, tableConfig, edgeMetadata, db, config, mode, _allEdges, rls, relationLoading, vectorSearchProvider, configuredIndex, countIndexReadiness) {
1637
1651
  super();
1638
1652
  this.schema = schema;
@@ -4700,18 +4714,75 @@ var GelRelationalQuery = class GelRelationalQuery extends QueryPromise {
4700
4714
  if (!this._allEdges) return [];
4701
4715
  return this._allEdges.filter((edge) => edge.sourceTable === tableName);
4702
4716
  }
4717
+ /**
4718
+ * A memo entry is a snapshot, so every caller has to get its own document.
4719
+ *
4720
+ * Relation loaders write nested `with` results and `extras` straight onto the
4721
+ * target they were handed, and `hydrateDateFieldsForRead` copies every own key
4722
+ * it finds. Two loads that share one entry would therefore publish each
4723
+ * other's fields — a relation asked for as `true` coming back carrying a
4724
+ * nested relation only the `where` requested. Those writes are all top-level,
4725
+ * so a shallow copy is exactly as much isolation as they need.
4726
+ */
4727
+ _ownedCopy(doc) {
4728
+ return doc === null || doc === void 0 ? null : { ...doc };
4729
+ }
4703
4730
  async _getById(tableName, id) {
4704
4731
  if (id === null || id === void 0) return null;
4705
4732
  const normalizedId = this.db.normalizeId(tableName, id);
4706
4733
  if (normalizedId === null) return null;
4707
4734
  const existing = this._documentByNormalizedId.get(normalizedId);
4708
- if (existing) return await existing;
4735
+ if (existing) return this._ownedCopy(await existing);
4709
4736
  const pending = Promise.resolve(this.db.get(normalizedId)).catch((error) => {
4710
4737
  this._documentByNormalizedId.delete(normalizedId);
4711
4738
  throw error;
4712
4739
  });
4713
4740
  this._documentByNormalizedId.set(normalizedId, pending);
4714
- return await pending;
4741
+ return this._ownedCopy(await pending);
4742
+ }
4743
+ /**
4744
+ * Identity of one `_firstByFields` read, or null when the join values cannot
4745
+ * be encoded losslessly.
4746
+ *
4747
+ * `JSON.stringify` alone is not safe here. It renders every `ArrayBuffer` as
4748
+ * `{}` and `NaN`/`Infinity`/`-Infinity` as `null`, so two distinct join values
4749
+ * would share one entry, and it throws outright on `int64`. The relation
4750
+ * loader's own per-batch key map cannot catch that, because the residual
4751
+ * relation `where` hands it one row at a time — a map of one never compares
4752
+ * two values. This key is the only thing that tells them apart.
4753
+ *
4754
+ * `convexToJson` is the same wire encoding the client uses for query keys, so
4755
+ * every Convex value round-trips distinctly. Anything it rejects is not a
4756
+ * Convex value and simply goes unmemoized.
4757
+ */
4758
+ _firstByFieldsMemoKey(tableName, fields, values, indexName) {
4759
+ try {
4760
+ return JSON.stringify([
4761
+ tableName,
4762
+ indexName,
4763
+ fields,
4764
+ values.map((value) => convexToJson(value))
4765
+ ]);
4766
+ } catch {
4767
+ return null;
4768
+ }
4769
+ }
4770
+ /**
4771
+ * `_getById` for a relation joined on something other than the primary id:
4772
+ * resolve one target document by an eq-pinned key, memoized per execution.
4773
+ */
4774
+ async _firstByFields(tableName, fields, values, indexName) {
4775
+ const read = () => this._queryByFields(this.db.query(tableName), fields, values, indexName).first();
4776
+ const key = this._firstByFieldsMemoKey(tableName, fields, values, indexName);
4777
+ if (key === null) return await read();
4778
+ const existing = this._firstDocumentByFieldKey.get(key);
4779
+ if (existing) return this._ownedCopy(await existing);
4780
+ const pending = Promise.resolve(read()).catch((error) => {
4781
+ this._firstDocumentByFieldKey.delete(key);
4782
+ throw error;
4783
+ });
4784
+ this._firstDocumentByFieldKey.set(key, pending);
4785
+ return this._ownedCopy(await pending);
4715
4786
  }
4716
4787
  _getRelationConcurrency() {
4717
4788
  const value = this.relationLoading?.concurrency;
@@ -4863,7 +4934,7 @@ var GelRelationalQuery = class GelRelationalQuery extends QueryPromise {
4863
4934
  const resolveTargetMatch = async (values) => {
4864
4935
  let target = null;
4865
4936
  if (useGetById) target = await this._getById(edge.targetTable, values[0]);
4866
- else target = await this._queryByFields(this.db.query(edge.targetTable), targetFields, values, targetIndexName).first();
4937
+ else target = await this._firstByFields(edge.targetTable, targetFields, values, targetIndexName);
4867
4938
  if (!target) return false;
4868
4939
  return this._evaluateTableFilter(target, targetTableConfig, whereRecord);
4869
4940
  };
@@ -4965,7 +5036,7 @@ var GelRelationalQuery = class GelRelationalQuery extends QueryPromise {
4965
5036
  const fetched = await this._mapWithConcurrency(entries, async ([key, values]) => {
4966
5037
  let target = null;
4967
5038
  if (useGetById) target = await this._getById(edge.targetTable, values[0]);
4968
- else target = await this._queryByFields(this.db.query(edge.targetTable), targetFields, values, indexName).first();
5039
+ else target = await this._firstByFields(edge.targetTable, targetFields, values, indexName);
4969
5040
  return {
4970
5041
  key,
4971
5042
  target
@@ -5217,7 +5288,7 @@ var GelRelationalQuery = class GelRelationalQuery extends QueryPromise {
5217
5288
  return await this._mapWithConcurrency(keyEntries, async ([key, values]) => {
5218
5289
  let target = null;
5219
5290
  if (useGetById) target = await this._getById(edge.targetTable, values[0]);
5220
- else target = await this._queryByFields(this.db.query(edge.targetTable), targetFields, values, indexName).first();
5291
+ else target = await this._firstByFields(edge.targetTable, targetFields, values, indexName);
5221
5292
  return {
5222
5293
  key,
5223
5294
  target
@@ -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-Ctcw2VRq.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-BHGHbfb9.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-BJm_VSDT.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-Dgf4lrO-.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 { $t as OrmLifecycleChange, A as CreateDatabaseOptions, Ar as $Type, B as getUniqueIndexes, Ct as OrderByClause, F as CascadeMode, Ft as ExtractTablesFromSchema, Gn as Columns, Gt as TablesRelationalConfig, Ht as RelationsBuilderConfigValue, I as DeleteMode, Kn as OrmRuntimeDefaults, L as SerializedFilterExpression, Mr as ColumnBuilder, Mt as VectorSearchProvider, N as OrmReader, Nr as ColumnBuilderBaseConfig, Or as SystemFieldAliases, P as OrmWriter, Pt as AnyRelationsBuilderConfig, Qn as OrmSchemaTriggers, R as getChecks, U as EdgeMetadata, Un as ConvexColumnBuilder, Ur as entityKind, Ut as RelationsConfigWithSchema, Vn as ConvexTextBuilderInitial, Wt as TableRelationalConfig, Xt as ConvexTable, Yn as OrmSchemaExtensionTriggers, Zn as OrmSchemaRelations, Zt as ConvexTableWithColumns, an as RlsPolicy, dt as InferInsertModel, kr as SystemFields, pt as InferSelectModel, qn as OrmSchemaExtensionRelations, r as OrmCapability, rr as FilterExpression$1, x as MigrationSet, z as getForeignKeys, zr as HasDefault, zt as RelationsBuilder } from "./capabilities-Ctcw2VRq.js";
1
+ import { $t as OrmLifecycleChange, A as CreateDatabaseOptions, Ar as $Type, B as getUniqueIndexes, Ct as OrderByClause, F as CascadeMode, Ft as ExtractTablesFromSchema, Gn as Columns, Gt as TablesRelationalConfig, Ht as RelationsBuilderConfigValue, I as DeleteMode, Kn as OrmRuntimeDefaults, L as SerializedFilterExpression, Mr as ColumnBuilder, Mt as VectorSearchProvider, N as OrmReader, Nr as ColumnBuilderBaseConfig, Or as SystemFieldAliases, P as OrmWriter, Pt as AnyRelationsBuilderConfig, Qn as OrmSchemaTriggers, R as getChecks, U as EdgeMetadata, Un as ConvexColumnBuilder, Ur as entityKind, Ut as RelationsConfigWithSchema, Vn as ConvexTextBuilderInitial, Wt as TableRelationalConfig, Xt as ConvexTable, Yn as OrmSchemaExtensionTriggers, Zn as OrmSchemaRelations, Zt as ConvexTableWithColumns, an as RlsPolicy, dt as InferInsertModel, kr as SystemFields, pt as InferSelectModel, qn as OrmSchemaExtensionRelations, r as OrmCapability, rr as FilterExpression$1, x as MigrationSet, z as getForeignKeys, zr as HasDefault, zt as RelationsBuilder } from "./capabilities-BJm_VSDT.js";
2
2
  import * as convex_values0 from "convex/values";
3
3
  import { GenericId, Validator, Value } from "convex/values";
4
4
  import { DefineSchemaOptions, GenericDatabaseReader, GenericDatabaseWriter, GenericSchema, SchedulableFunctionReference, Scheduler, SchemaDefinition, internalActionGeneric, internalMutationGeneric, internalQueryGeneric } from "convex/server";
@@ -120,7 +120,7 @@ declare const migrationStorageTables: {
120
120
  fieldName: "cursor";
121
121
  };
122
122
  };
123
- migrationId: ConvexTextBuilderInitial<""> & {
123
+ updatedAt: ConvexNumberBuilderInitial<""> & {
124
124
  _: {
125
125
  notNull: true;
126
126
  };
@@ -130,10 +130,10 @@ declare const migrationStorageTables: {
130
130
  };
131
131
  } & {
132
132
  _: {
133
- fieldName: "migrationId";
133
+ fieldName: "updatedAt";
134
134
  };
135
135
  };
136
- checksum: ConvexTextBuilderInitial<""> & {
136
+ processed: ConvexNumberBuilderInitial<""> & {
137
137
  _: {
138
138
  notNull: true;
139
139
  };
@@ -143,54 +143,50 @@ declare const migrationStorageTables: {
143
143
  };
144
144
  } & {
145
145
  _: {
146
- fieldName: "checksum";
146
+ fieldName: "processed";
147
147
  };
148
148
  };
149
- applied: ConvexBooleanBuilderInitial<""> & {
150
- _: {
151
- notNull: true;
152
- };
153
- } & {
149
+ startedAt: ConvexNumberBuilderInitial<""> & {
154
150
  _: {
155
151
  tableName: "migration_state";
156
152
  };
157
153
  } & {
158
154
  _: {
159
- fieldName: "applied";
155
+ fieldName: "startedAt";
160
156
  };
161
157
  };
162
- runId: ConvexTextBuilderInitial<""> & {
158
+ completedAt: ConvexNumberBuilderInitial<""> & {
163
159
  _: {
164
160
  tableName: "migration_state";
165
161
  };
166
162
  } & {
167
163
  _: {
168
- fieldName: "runId";
164
+ fieldName: "completedAt";
169
165
  };
170
166
  };
171
- processed: ConvexNumberBuilderInitial<""> & {
172
- _: {
173
- notNull: true;
174
- };
175
- } & {
167
+ lastError: ConvexTextBuilderInitial<""> & {
176
168
  _: {
177
169
  tableName: "migration_state";
178
170
  };
179
171
  } & {
180
172
  _: {
181
- fieldName: "processed";
173
+ fieldName: "lastError";
182
174
  };
183
175
  };
184
- startedAt: ConvexNumberBuilderInitial<""> & {
176
+ migrationId: ConvexTextBuilderInitial<""> & {
177
+ _: {
178
+ notNull: true;
179
+ };
180
+ } & {
185
181
  _: {
186
182
  tableName: "migration_state";
187
183
  };
188
184
  } & {
189
185
  _: {
190
- fieldName: "startedAt";
186
+ fieldName: "migrationId";
191
187
  };
192
188
  };
193
- updatedAt: ConvexNumberBuilderInitial<""> & {
189
+ checksum: ConvexTextBuilderInitial<""> & {
194
190
  _: {
195
191
  notNull: true;
196
192
  };
@@ -200,25 +196,29 @@ declare const migrationStorageTables: {
200
196
  };
201
197
  } & {
202
198
  _: {
203
- fieldName: "updatedAt";
199
+ fieldName: "checksum";
204
200
  };
205
201
  };
206
- completedAt: ConvexNumberBuilderInitial<""> & {
202
+ applied: ConvexBooleanBuilderInitial<""> & {
203
+ _: {
204
+ notNull: true;
205
+ };
206
+ } & {
207
207
  _: {
208
208
  tableName: "migration_state";
209
209
  };
210
210
  } & {
211
211
  _: {
212
- fieldName: "completedAt";
212
+ fieldName: "applied";
213
213
  };
214
214
  };
215
- lastError: ConvexTextBuilderInitial<""> & {
215
+ runId: ConvexTextBuilderInitial<""> & {
216
216
  _: {
217
217
  tableName: "migration_state";
218
218
  };
219
219
  } & {
220
220
  _: {
221
- fieldName: "lastError";
221
+ fieldName: "runId";
222
222
  };
223
223
  };
224
224
  writeMode: ConvexTextBuilderInitial<""> & {
@@ -269,7 +269,7 @@ declare const migrationStorageTables: {
269
269
  fieldName: "direction";
270
270
  };
271
271
  };
272
- runId: ConvexTextBuilderInitial<""> & {
272
+ updatedAt: ConvexNumberBuilderInitial<""> & {
273
273
  _: {
274
274
  notNull: true;
275
275
  };
@@ -279,7 +279,7 @@ declare const migrationStorageTables: {
279
279
  };
280
280
  } & {
281
281
  _: {
282
- fieldName: "runId";
282
+ fieldName: "updatedAt";
283
283
  };
284
284
  };
285
285
  startedAt: ConvexNumberBuilderInitial<""> & {
@@ -295,35 +295,35 @@ declare const migrationStorageTables: {
295
295
  fieldName: "startedAt";
296
296
  };
297
297
  };
298
- updatedAt: ConvexNumberBuilderInitial<""> & {
299
- _: {
300
- notNull: true;
301
- };
302
- } & {
298
+ completedAt: ConvexNumberBuilderInitial<""> & {
303
299
  _: {
304
300
  tableName: "migration_run";
305
301
  };
306
302
  } & {
307
303
  _: {
308
- fieldName: "updatedAt";
304
+ fieldName: "completedAt";
309
305
  };
310
306
  };
311
- completedAt: ConvexNumberBuilderInitial<""> & {
307
+ lastError: ConvexTextBuilderInitial<""> & {
312
308
  _: {
313
309
  tableName: "migration_run";
314
310
  };
315
311
  } & {
316
312
  _: {
317
- fieldName: "completedAt";
313
+ fieldName: "lastError";
318
314
  };
319
315
  };
320
- lastError: ConvexTextBuilderInitial<""> & {
316
+ runId: ConvexTextBuilderInitial<""> & {
317
+ _: {
318
+ notNull: true;
319
+ };
320
+ } & {
321
321
  _: {
322
322
  tableName: "migration_run";
323
323
  };
324
324
  } & {
325
325
  _: {
326
- fieldName: "lastError";
326
+ fieldName: "runId";
327
327
  };
328
328
  };
329
329
  dryRun: ConvexBooleanBuilderInitial<""> & {
@@ -1011,7 +1011,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1011
1011
  readonly aggregate_bucket: ConvexTableWithColumns<{
1012
1012
  name: "aggregate_bucket";
1013
1013
  columns: {
1014
- updatedAt: ConvexNumberBuilderInitial<""> & {
1014
+ count: ConvexNumberBuilderInitial<""> & {
1015
1015
  _: {
1016
1016
  notNull: true;
1017
1017
  };
@@ -1021,10 +1021,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1021
1021
  };
1022
1022
  } & {
1023
1023
  _: {
1024
- fieldName: "updatedAt";
1024
+ fieldName: "count";
1025
1025
  };
1026
1026
  };
1027
- tableKey: ConvexTextBuilderInitial<""> & {
1027
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1028
1028
  _: {
1029
1029
  notNull: true;
1030
1030
  };
@@ -1034,7 +1034,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1034
1034
  };
1035
1035
  } & {
1036
1036
  _: {
1037
- fieldName: "tableKey";
1037
+ fieldName: "updatedAt";
1038
1038
  };
1039
1039
  };
1040
1040
  indexName: ConvexTextBuilderInitial<""> & {
@@ -1050,7 +1050,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1050
1050
  fieldName: "indexName";
1051
1051
  };
1052
1052
  };
1053
- keyHash: ConvexTextBuilderInitial<""> & {
1053
+ tableKey: ConvexTextBuilderInitial<""> & {
1054
1054
  _: {
1055
1055
  notNull: true;
1056
1056
  };
@@ -1060,14 +1060,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1060
1060
  };
1061
1061
  } & {
1062
1062
  _: {
1063
- fieldName: "keyHash";
1063
+ fieldName: "tableKey";
1064
1064
  };
1065
1065
  };
1066
- keyParts: ConvexCustomBuilderInitial<"", convex_values0.VArray<any[], convex_values0.Validator<any, "required", any>, "required">> & {
1067
- _: {
1068
- $type: convex_values0.Value[];
1069
- };
1070
- } & {
1066
+ keyHash: ConvexTextBuilderInitial<""> & {
1071
1067
  _: {
1072
1068
  notNull: true;
1073
1069
  };
@@ -1077,10 +1073,14 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1077
1073
  };
1078
1074
  } & {
1079
1075
  _: {
1080
- fieldName: "keyParts";
1076
+ fieldName: "keyHash";
1081
1077
  };
1082
1078
  };
1083
- count: ConvexNumberBuilderInitial<""> & {
1079
+ keyParts: ConvexCustomBuilderInitial<"", convex_values0.VArray<any[], convex_values0.Validator<any, "required", any>, "required">> & {
1080
+ _: {
1081
+ $type: convex_values0.Value[];
1082
+ };
1083
+ } & {
1084
1084
  _: {
1085
1085
  notNull: true;
1086
1086
  };
@@ -1090,7 +1090,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1090
1090
  };
1091
1091
  } & {
1092
1092
  _: {
1093
- fieldName: "count";
1093
+ fieldName: "keyParts";
1094
1094
  };
1095
1095
  };
1096
1096
  sumValues: ConvexCustomBuilderInitial<"", ConvexValidatorLike> & {
@@ -1162,7 +1162,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1162
1162
  fieldName: "updatedAt";
1163
1163
  };
1164
1164
  };
1165
- tableKey: ConvexTextBuilderInitial<""> & {
1165
+ indexName: ConvexTextBuilderInitial<""> & {
1166
1166
  _: {
1167
1167
  notNull: true;
1168
1168
  };
@@ -1172,10 +1172,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1172
1172
  };
1173
1173
  } & {
1174
1174
  _: {
1175
- fieldName: "tableKey";
1175
+ fieldName: "indexName";
1176
1176
  };
1177
1177
  };
1178
- indexName: ConvexTextBuilderInitial<""> & {
1178
+ tableKey: ConvexTextBuilderInitial<""> & {
1179
1179
  _: {
1180
1180
  notNull: true;
1181
1181
  };
@@ -1185,7 +1185,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1185
1185
  };
1186
1186
  } & {
1187
1187
  _: {
1188
- fieldName: "indexName";
1188
+ fieldName: "tableKey";
1189
1189
  };
1190
1190
  };
1191
1191
  keyHash: ConvexTextBuilderInitial<""> & {
@@ -1343,7 +1343,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1343
1343
  fieldName: "value";
1344
1344
  };
1345
1345
  };
1346
- updatedAt: ConvexNumberBuilderInitial<""> & {
1346
+ count: ConvexNumberBuilderInitial<""> & {
1347
1347
  _: {
1348
1348
  notNull: true;
1349
1349
  };
@@ -1353,10 +1353,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1353
1353
  };
1354
1354
  } & {
1355
1355
  _: {
1356
- fieldName: "updatedAt";
1356
+ fieldName: "count";
1357
1357
  };
1358
1358
  };
1359
- tableKey: ConvexTextBuilderInitial<""> & {
1359
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1360
1360
  _: {
1361
1361
  notNull: true;
1362
1362
  };
@@ -1366,7 +1366,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1366
1366
  };
1367
1367
  } & {
1368
1368
  _: {
1369
- fieldName: "tableKey";
1369
+ fieldName: "updatedAt";
1370
1370
  };
1371
1371
  };
1372
1372
  indexName: ConvexTextBuilderInitial<""> & {
@@ -1382,7 +1382,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1382
1382
  fieldName: "indexName";
1383
1383
  };
1384
1384
  };
1385
- keyHash: ConvexTextBuilderInitial<""> & {
1385
+ tableKey: ConvexTextBuilderInitial<""> & {
1386
1386
  _: {
1387
1387
  notNull: true;
1388
1388
  };
@@ -1392,10 +1392,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1392
1392
  };
1393
1393
  } & {
1394
1394
  _: {
1395
- fieldName: "keyHash";
1395
+ fieldName: "tableKey";
1396
1396
  };
1397
1397
  };
1398
- count: ConvexNumberBuilderInitial<""> & {
1398
+ keyHash: ConvexTextBuilderInitial<""> & {
1399
1399
  _: {
1400
1400
  notNull: true;
1401
1401
  };
@@ -1405,7 +1405,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1405
1405
  };
1406
1406
  } & {
1407
1407
  _: {
1408
- fieldName: "count";
1408
+ fieldName: "keyHash";
1409
1409
  };
1410
1410
  };
1411
1411
  fieldName: ConvexTextBuilderInitial<""> & {
@@ -1618,7 +1618,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1618
1618
  fieldName: "cursor";
1619
1619
  };
1620
1620
  };
1621
- processed: ConvexNumberBuilderInitial<""> & {
1621
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1622
1622
  _: {
1623
1623
  notNull: true;
1624
1624
  };
@@ -1628,10 +1628,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1628
1628
  };
1629
1629
  } & {
1630
1630
  _: {
1631
- fieldName: "processed";
1631
+ fieldName: "updatedAt";
1632
1632
  };
1633
1633
  };
1634
- startedAt: ConvexNumberBuilderInitial<""> & {
1634
+ indexName: ConvexTextBuilderInitial<""> & {
1635
1635
  _: {
1636
1636
  notNull: true;
1637
1637
  };
@@ -1641,10 +1641,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1641
1641
  };
1642
1642
  } & {
1643
1643
  _: {
1644
- fieldName: "startedAt";
1644
+ fieldName: "indexName";
1645
1645
  };
1646
1646
  };
1647
- updatedAt: ConvexNumberBuilderInitial<""> & {
1647
+ keyDefinitionHash: ConvexTextBuilderInitial<""> & {
1648
1648
  _: {
1649
1649
  notNull: true;
1650
1650
  };
@@ -1654,28 +1654,23 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1654
1654
  };
1655
1655
  } & {
1656
1656
  _: {
1657
- fieldName: "updatedAt";
1657
+ fieldName: "keyDefinitionHash";
1658
1658
  };
1659
1659
  };
1660
- completedAt: ConvexNumberBuilderInitial<""> & {
1660
+ metricDefinitionHash: ConvexTextBuilderInitial<""> & {
1661
1661
  _: {
1662
- tableName: "aggregate_state";
1662
+ notNull: true;
1663
1663
  };
1664
1664
  } & {
1665
- _: {
1666
- fieldName: "completedAt";
1667
- };
1668
- };
1669
- lastError: ConvexTextBuilderInitial<""> & {
1670
1665
  _: {
1671
1666
  tableName: "aggregate_state";
1672
1667
  };
1673
1668
  } & {
1674
1669
  _: {
1675
- fieldName: "lastError";
1670
+ fieldName: "metricDefinitionHash";
1676
1671
  };
1677
1672
  };
1678
- tableKey: ConvexTextBuilderInitial<""> & {
1673
+ processed: ConvexNumberBuilderInitial<""> & {
1679
1674
  _: {
1680
1675
  notNull: true;
1681
1676
  };
@@ -1685,10 +1680,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1685
1680
  };
1686
1681
  } & {
1687
1682
  _: {
1688
- fieldName: "tableKey";
1683
+ fieldName: "processed";
1689
1684
  };
1690
1685
  };
1691
- indexName: ConvexTextBuilderInitial<""> & {
1686
+ startedAt: ConvexNumberBuilderInitial<""> & {
1692
1687
  _: {
1693
1688
  notNull: true;
1694
1689
  };
@@ -1698,23 +1693,28 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1698
1693
  };
1699
1694
  } & {
1700
1695
  _: {
1701
- fieldName: "indexName";
1696
+ fieldName: "startedAt";
1702
1697
  };
1703
1698
  };
1704
- keyDefinitionHash: ConvexTextBuilderInitial<""> & {
1699
+ completedAt: ConvexNumberBuilderInitial<""> & {
1705
1700
  _: {
1706
- notNull: true;
1701
+ tableName: "aggregate_state";
1707
1702
  };
1708
1703
  } & {
1704
+ _: {
1705
+ fieldName: "completedAt";
1706
+ };
1707
+ };
1708
+ lastError: ConvexTextBuilderInitial<""> & {
1709
1709
  _: {
1710
1710
  tableName: "aggregate_state";
1711
1711
  };
1712
1712
  } & {
1713
1713
  _: {
1714
- fieldName: "keyDefinitionHash";
1714
+ fieldName: "lastError";
1715
1715
  };
1716
1716
  };
1717
- metricDefinitionHash: ConvexTextBuilderInitial<""> & {
1717
+ tableKey: ConvexTextBuilderInitial<""> & {
1718
1718
  _: {
1719
1719
  notNull: true;
1720
1720
  };
@@ -1724,7 +1724,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1724
1724
  };
1725
1725
  } & {
1726
1726
  _: {
1727
- fieldName: "metricDefinitionHash";
1727
+ fieldName: "tableKey";
1728
1728
  };
1729
1729
  };
1730
1730
  };
@@ -1769,7 +1769,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1769
1769
  fieldName: "cursor";
1770
1770
  };
1771
1771
  };
1772
- migrationId: ConvexTextBuilderInitial<""> & {
1772
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1773
1773
  _: {
1774
1774
  notNull: true;
1775
1775
  };
@@ -1779,10 +1779,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1779
1779
  };
1780
1780
  } & {
1781
1781
  _: {
1782
- fieldName: "migrationId";
1782
+ fieldName: "updatedAt";
1783
1783
  };
1784
1784
  };
1785
- checksum: ConvexTextBuilderInitial<""> & {
1785
+ processed: ConvexNumberBuilderInitial<""> & {
1786
1786
  _: {
1787
1787
  notNull: true;
1788
1788
  };
@@ -1792,54 +1792,50 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1792
1792
  };
1793
1793
  } & {
1794
1794
  _: {
1795
- fieldName: "checksum";
1795
+ fieldName: "processed";
1796
1796
  };
1797
1797
  };
1798
- applied: ConvexBooleanBuilderInitial<""> & {
1799
- _: {
1800
- notNull: true;
1801
- };
1802
- } & {
1798
+ startedAt: ConvexNumberBuilderInitial<""> & {
1803
1799
  _: {
1804
1800
  tableName: "migration_state";
1805
1801
  };
1806
1802
  } & {
1807
1803
  _: {
1808
- fieldName: "applied";
1804
+ fieldName: "startedAt";
1809
1805
  };
1810
1806
  };
1811
- runId: ConvexTextBuilderInitial<""> & {
1807
+ completedAt: ConvexNumberBuilderInitial<""> & {
1812
1808
  _: {
1813
1809
  tableName: "migration_state";
1814
1810
  };
1815
1811
  } & {
1816
1812
  _: {
1817
- fieldName: "runId";
1813
+ fieldName: "completedAt";
1818
1814
  };
1819
1815
  };
1820
- processed: ConvexNumberBuilderInitial<""> & {
1821
- _: {
1822
- notNull: true;
1823
- };
1824
- } & {
1816
+ lastError: ConvexTextBuilderInitial<""> & {
1825
1817
  _: {
1826
1818
  tableName: "migration_state";
1827
1819
  };
1828
1820
  } & {
1829
1821
  _: {
1830
- fieldName: "processed";
1822
+ fieldName: "lastError";
1831
1823
  };
1832
1824
  };
1833
- startedAt: ConvexNumberBuilderInitial<""> & {
1825
+ migrationId: ConvexTextBuilderInitial<""> & {
1826
+ _: {
1827
+ notNull: true;
1828
+ };
1829
+ } & {
1834
1830
  _: {
1835
1831
  tableName: "migration_state";
1836
1832
  };
1837
1833
  } & {
1838
1834
  _: {
1839
- fieldName: "startedAt";
1835
+ fieldName: "migrationId";
1840
1836
  };
1841
1837
  };
1842
- updatedAt: ConvexNumberBuilderInitial<""> & {
1838
+ checksum: ConvexTextBuilderInitial<""> & {
1843
1839
  _: {
1844
1840
  notNull: true;
1845
1841
  };
@@ -1849,25 +1845,29 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1849
1845
  };
1850
1846
  } & {
1851
1847
  _: {
1852
- fieldName: "updatedAt";
1848
+ fieldName: "checksum";
1853
1849
  };
1854
1850
  };
1855
- completedAt: ConvexNumberBuilderInitial<""> & {
1851
+ applied: ConvexBooleanBuilderInitial<""> & {
1852
+ _: {
1853
+ notNull: true;
1854
+ };
1855
+ } & {
1856
1856
  _: {
1857
1857
  tableName: "migration_state";
1858
1858
  };
1859
1859
  } & {
1860
1860
  _: {
1861
- fieldName: "completedAt";
1861
+ fieldName: "applied";
1862
1862
  };
1863
1863
  };
1864
- lastError: ConvexTextBuilderInitial<""> & {
1864
+ runId: ConvexTextBuilderInitial<""> & {
1865
1865
  _: {
1866
1866
  tableName: "migration_state";
1867
1867
  };
1868
1868
  } & {
1869
1869
  _: {
1870
- fieldName: "lastError";
1870
+ fieldName: "runId";
1871
1871
  };
1872
1872
  };
1873
1873
  writeMode: ConvexTextBuilderInitial<""> & {
@@ -1918,7 +1918,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1918
1918
  fieldName: "direction";
1919
1919
  };
1920
1920
  };
1921
- runId: ConvexTextBuilderInitial<""> & {
1921
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1922
1922
  _: {
1923
1923
  notNull: true;
1924
1924
  };
@@ -1928,7 +1928,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1928
1928
  };
1929
1929
  } & {
1930
1930
  _: {
1931
- fieldName: "runId";
1931
+ fieldName: "updatedAt";
1932
1932
  };
1933
1933
  };
1934
1934
  startedAt: ConvexNumberBuilderInitial<""> & {
@@ -1944,35 +1944,35 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1944
1944
  fieldName: "startedAt";
1945
1945
  };
1946
1946
  };
1947
- updatedAt: ConvexNumberBuilderInitial<""> & {
1948
- _: {
1949
- notNull: true;
1950
- };
1951
- } & {
1947
+ completedAt: ConvexNumberBuilderInitial<""> & {
1952
1948
  _: {
1953
1949
  tableName: "migration_run";
1954
1950
  };
1955
1951
  } & {
1956
1952
  _: {
1957
- fieldName: "updatedAt";
1953
+ fieldName: "completedAt";
1958
1954
  };
1959
1955
  };
1960
- completedAt: ConvexNumberBuilderInitial<""> & {
1956
+ lastError: ConvexTextBuilderInitial<""> & {
1961
1957
  _: {
1962
1958
  tableName: "migration_run";
1963
1959
  };
1964
1960
  } & {
1965
1961
  _: {
1966
- fieldName: "completedAt";
1962
+ fieldName: "lastError";
1967
1963
  };
1968
1964
  };
1969
- lastError: ConvexTextBuilderInitial<""> & {
1965
+ runId: ConvexTextBuilderInitial<""> & {
1966
+ _: {
1967
+ notNull: true;
1968
+ };
1969
+ } & {
1970
1970
  _: {
1971
1971
  tableName: "migration_run";
1972
1972
  };
1973
1973
  } & {
1974
1974
  _: {
1975
- fieldName: "lastError";
1975
+ fieldName: "runId";
1976
1976
  };
1977
1977
  };
1978
1978
  dryRun: ConvexBooleanBuilderInitial<""> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitcn",
3
- "version": "0.32.1",
3
+ "version": "0.32.2",
4
4
  "description": "kitcn - React Query integration and CLI tools for Convex",
5
5
  "keywords": [
6
6
  "convex",