kitcn 0.27.4 → 0.27.5

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,25 @@
1
1
  # kitcn
2
2
 
3
+ ## 0.27.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#414](https://github.com/udecode/kitcn/pull/414) [`7b01244`](https://github.com/udecode/kitcn/commit/7b0124498000e6e6ef190b4b529d10026f0a1f16) Thanks [@MikeyZhang75](https://github.com/MikeyZhang75)! - ## Patches
8
+
9
+ - Stop `insert().returning({ ... })` reading each row back after writing it. A
10
+ projected `returning()` is now answered from the values that were just
11
+ inserted, so an 8-row insert spends 0 reads on post-images instead of 8.
12
+ Argument-less `returning()` still reads, because `createdAt` is only known
13
+ once the row is stored.
14
+ - Stop `insert().onConflictDoUpdate({ ... }).returning()` reading the row back
15
+ after patching it.
16
+ - Stop `returning({ _count })` re-fetching each affected row before counting its
17
+ relations, on `insert()`, `update()` and `delete()`. That is one fewer read
18
+ per row, and the counts, their `where` filters and `delete()`'s
19
+ before-cascade ordering are unchanged.
20
+ - Keep reading the row back on tables with triggers, `aggregateIndex` or
21
+ `rankIndex`, where a hook can rewrite what gets stored.
22
+
3
23
  ## 0.27.4
4
24
 
5
25
  ### Patch Changes
@@ -1,5 +1,5 @@
1
- import { Bn as ConvexTextBuilderInitial, Xt as ConvexTableWithColumns } from "../capabilities-CLCYgRdY.js";
2
- import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-DAPEBp1y.js";
1
+ import { Bn as ConvexTextBuilderInitial, Xt as ConvexTableWithColumns } from "../capabilities-DkfnnNp7.js";
2
+ import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-DuC8Nr7e.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 { S as defineAuth, _ as GenericAuthBeforeResult, b as GenericAuthTriggerHandlers, g as BetterAuthOptionsWithoutDatabase, i as getGeneratedAuthDisabledReason, n as GeneratedAuthDisabledReasonKind, r as createDisabledAuthRuntime, t as AuthRuntime, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../../generated-contract-disabled-SzH57bhp.js";
1
+ import { S as defineAuth, _ as GenericAuthBeforeResult, b as GenericAuthTriggerHandlers, g as BetterAuthOptionsWithoutDatabase, i as getGeneratedAuthDisabledReason, n as GeneratedAuthDisabledReasonKind, r as createDisabledAuthRuntime, t as AuthRuntime, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../../generated-contract-disabled-BEc4d98x.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-DJONf8X5.js";
2
2
  import { t as GetAuth } from "../types-Bf3XQex5.js";
3
3
  import { t as GenericCtx } from "../context-utils-DwZ3Cam1.js";
4
- import { S as defineAuth, _ as GenericAuthBeforeResult, a as AuthFunctions, b as GenericAuthTriggerHandlers, c as createApi, d as deleteOneHandler, f as findManyHandler, g as BetterAuthOptionsWithoutDatabase, h as updateOneHandler, i as getGeneratedAuthDisabledReason, l as createHandler, m as updateManyHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as findOneHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as deleteManyHandler, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../generated-contract-disabled-SzH57bhp.js";
4
+ import { S as defineAuth, _ as GenericAuthBeforeResult, a as AuthFunctions, b as GenericAuthTriggerHandlers, c as createApi, d as deleteOneHandler, f as findManyHandler, g as BetterAuthOptionsWithoutDatabase, h as updateOneHandler, i as getGeneratedAuthDisabledReason, l as createHandler, m as updateManyHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as findOneHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as deleteManyHandler, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../generated-contract-disabled-BEc4d98x.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";
@@ -134,8 +134,8 @@ declare const adapterArgsValidator: convex_values0.VObject<{
134
134
  limit?: number | undefined;
135
135
  offset?: number | undefined;
136
136
  sortBy?: {
137
- direction: "asc" | "desc";
138
137
  field: string;
138
+ direction: "asc" | "desc";
139
139
  } | undefined;
140
140
  model: string;
141
141
  }, {
@@ -144,12 +144,12 @@ declare const adapterArgsValidator: convex_values0.VObject<{
144
144
  offset: convex_values0.VFloat64<number | undefined, "optional">;
145
145
  select: convex_values0.VArray<string[] | undefined, convex_values0.VString<string, "required">, "optional">;
146
146
  sortBy: convex_values0.VObject<{
147
- direction: "asc" | "desc";
148
147
  field: string;
148
+ direction: "asc" | "desc";
149
149
  } | undefined, {
150
150
  direction: convex_values0.VUnion<"asc" | "desc", [convex_values0.VLiteral<"asc", "required">, convex_values0.VLiteral<"desc", "required">], "required", never>;
151
151
  field: convex_values0.VString<string, "required">;
152
- }, "optional", "direction" | "field">;
152
+ }, "optional", "field" | "direction">;
153
153
  where: convex_values0.VArray<{
154
154
  mode?: "sensitive" | "insensitive" | undefined;
155
155
  connector?: "AND" | "OR" | undefined;
@@ -169,7 +169,7 @@ declare const adapterArgsValidator: convex_values0.VObject<{
169
169
  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>;
170
170
  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>;
171
171
  }, "required", "mode" | "value" | "connector" | "field" | "operator">, "optional">;
172
- }, "required", "model" | "select" | "where" | "limit" | "offset" | "sortBy" | "sortBy.direction" | "sortBy.field">;
172
+ }, "required", "model" | "select" | "where" | "limit" | "offset" | "sortBy" | "sortBy.field" | "sortBy.direction">;
173
173
  declare const hasUniqueFields: (betterAuthSchema: BetterAuthDBSchema, model: string, input: Record<string, any>) => boolean;
174
174
  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>;
175
175
  declare const selectFields: <T extends TableNamesInDataModel<GenericDataModel>, D extends DocumentByName<GenericDataModel, T>>(doc: D | null, select?: string[]) => D | null;
@@ -2896,6 +2896,24 @@ declare class GelRelationalQuery<TSchema extends TablesRelationalConfig, TTableC
2896
2896
  rls?: RlsContext | undefined, relationLoading?: {
2897
2897
  concurrency?: number;
2898
2898
  } | undefined, vectorSearchProvider?: VectorSearchProvider | undefined, configuredIndex?: PredicateWhereIndexConfig<TTableConfig> | undefined, countIndexReadiness?: Map<string, Promise<void>>);
2899
+ /**
2900
+ * Relation counts for a document the caller is already holding.
2901
+ *
2902
+ * `returning({ _count })` runs inside the mutation that just wrote the row,
2903
+ * so resolving it through `execute()` spends one `db.get` re-reading a
2904
+ * document that is already in the transaction's write set. The count engine
2905
+ * only ever reads the counted edges' source fields off its parent, and the
2906
+ * caller's document carries all of them, so the root read is pure waste.
2907
+ * Everything else `execute()` would have done to that row — the select-plan
2908
+ * assertion and the RLS select filter — still runs here.
2909
+ *
2910
+ * Reached through the static accessor below rather than exposed on the instance:
2911
+ * `GelRelationalQuery` is the declared return type of the public query
2912
+ * builders, so an instance method would land in every user's autocomplete.
2913
+ */
2914
+ private _countRelationsForHeldRow;
2915
+ /** @internal Accessor for `returning({ _count })`; see `returning-count.ts`. */
2916
+ static countRelationsForHeldRow(query: GelRelationalQuery<any, any, any>, row: Record<string, unknown>, countSelection: Record<string, unknown>): Promise<Record<string, number>>;
2899
2917
  /**
2900
2918
  * The aggregate-index runtime, registered at `createOrm()`.
2901
2919
  *
@@ -235,8 +235,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
235
235
  limit?: number | undefined;
236
236
  offset?: number | undefined;
237
237
  sortBy?: {
238
- direction: "asc" | "desc";
239
238
  field: string;
239
+ direction: "asc" | "desc";
240
240
  } | undefined;
241
241
  model: string;
242
242
  paginationOpts: {
@@ -1,4 +1,4 @@
1
- import { $ as RankOrderField, G as CountBackfillKickoffArgs, J as AggregateQueryPlan, K as CountBackfillMode, Q as RankIndexDefinition, W as CountBackfillChunkArgs, X as AggregateIndexDefinition, Y as CountQueryPlan, Z as CountIndexDefinition, q as CountBackfillStatusArgs, r as OrmCapability } from "../../capabilities-CLCYgRdY.js";
1
+ import { $ as RankOrderField, G as CountBackfillKickoffArgs, J as AggregateQueryPlan, K as CountBackfillMode, Q as RankIndexDefinition, W as CountBackfillChunkArgs, X as AggregateIndexDefinition, Y as CountQueryPlan, Z as CountIndexDefinition, q as CountBackfillStatusArgs, r as OrmCapability } from "../../capabilities-DkfnnNp7.js";
2
2
 
3
3
  //#region src/orm/aggregate-index/capability.d.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  import { t as DirectAggregate } from "../../runtime-CcOvOf4K.js";
2
2
  import { a as Columns } from "../../table-CX2lnX7e.js";
3
- import { Ct as usesSystemCreatedAtAlias, St as PUBLIC_CREATED_AT_FIELD, Z as normalizeTemporalComparableValue, a as AGGREGATE_STATE_TABLE, c as getAggregateIndexDefinitions, d as COUNT_ERROR, dt as mapWithConcurrency, i as AGGREGATE_RANK_TREE_TABLE, l as getRankIndexDefinitions, m as createError, n as AGGREGATE_EXTREMA_TABLE, r as AGGREGATE_MEMBER_TABLE, s as rankAggregateName, t as AGGREGATE_BUCKET_TABLE, u as AGGREGATE_ERROR, xt as INTERNAL_CREATION_TIME_FIELD } from "../../schema-C5WWEqsj.js";
3
+ import { Et as usesSystemCreatedAtAlias, Tt as PUBLIC_CREATED_AT_FIELD, Z as normalizeTemporalComparableValue, a as AGGREGATE_STATE_TABLE, c as getAggregateIndexDefinitions, d as COUNT_ERROR, i as AGGREGATE_RANK_TREE_TABLE, l as getRankIndexDefinitions, m as createError, mt as mapWithConcurrency, n as AGGREGATE_EXTREMA_TABLE, r as AGGREGATE_MEMBER_TABLE, s as rankAggregateName, t as AGGREGATE_BUCKET_TABLE, u as AGGREGATE_ERROR, wt as INTERNAL_CREATION_TIME_FIELD } from "../../schema-D95Z3Kss.js";
4
4
 
5
5
  //#region src/orm/aggregate-index/runtime.ts
6
6
  const UNDEFINED_SENTINEL = "__kitcnUndefined";
@@ -1,5 +1,5 @@
1
- import { $n as BinaryExpression, $t as OrmLifecycleOperation, A as DatabaseWithMutations, An as ConvexCheckConfig, Ar as AnyColumn, At as VectorQueryConfig, B as RlsContext, Bn as ConvexTextBuilderInitial, Br as IsUnique, Bt as RelationsBuilderColumnConfig, C as MigrationTableName, Cn as aggregateIndex, Cr as notBetween, Ct as OrderDirection, D as defineMigrationSet, Dn as uniqueIndex, Dt as ReturningResult, E as defineMigration, En as searchIndex, Er as startsWith, Et as ReturningAll, Fn as ConvexUniqueConstraintConfig, Fr as ColumnBuilderWithTableName, Ft as ExtractTablesWithRelations, Gt as defineRelations, H as EdgeMetadata, In as check, Ir as ColumnDataType, It as ManyConfig, Jt as ConvexDeletionConfig, Kt as defineRelationsPart, Ln as foreignKey, Lr as DrizzleEntity, Lt as OneConfig, M as OrmReader$1, Mn as ConvexForeignKeyConfig, Mr as ColumnBuilderBaseConfig, Mt as unsetToken, N as OrmWriter$1, Nn as ConvexUniqueConstraintBuilder, Nr as ColumnBuilderRuntimeConfig, O as detectMigrationDrift, On as vectorIndex, Or as SystemFields, Ot as ReturningSelection, Pn as ConvexUniqueConstraintBuilderOn, Pr as ColumnBuilderTypeConfig, Pt as ExtractTablesFromSchema, Qn as TableName, Qt as OrmLifecycleChange, Rn as unique, Rr as HasDefault, Rt as RelationsBuilder, S as MigrationStep, Sn as ConvexVectorIndexConfig, Sr as not, St as OrderByClause, T as buildMigrationPlan, Tn as rankIndex, Tr as or, Tt as PredicateWhereIndexConfig, U as extractRelationsConfig, Un as Brand, Ut as TableRelationalConfig, V as RlsMode, Vn as text, Vr as NotNull, Wn as Columns, Wt as TablesRelationalConfig, Xn as OrmSchemaRelations, Xt as ConvexTableWithColumns, Yn as OrmSchemaExtensions, Yt as ConvexTable, Zn as OrmSchemaTriggers, Zt as DiscriminatorBuilderConfig, _ as MigrationMigrateOne, _n as ConvexSearchIndexBuilder, _r as isNull, _t as MutationPaginateConfig, an as RlsPolicyConfig, ar as and, at as CountConfig, b as MigrationSet, bn as ConvexVectorIndexBuilder, br as lte, bt as MutationReturning, cn as RlsRole, cr as endsWith, ct as FilterOperators, d as MigrationDefinition, dn as ConvexAggregateIndexBuilder, dr as gt, dt as InferModelFromColumns, en as TableConfig, er as ExpressionVisitor, et as AggregateConfig, f as MigrationDirection, fn as ConvexAggregateIndexBuilderOn, fr as gte, ft as InferSelectModel, g as MigrationManifestEntry, gn as ConvexRankIndexBuilderOn, gr as isNotNull, gt as MutationExecutionMode, h as MigrationDriftIssue, hn as ConvexRankIndexBuilder, hr as isFieldReference, ht as MutationExecuteResult, i as OrmMigrationCapability, in as RlsPolicy, ir as UnaryExpression, it as BuildRelationResult, j as DatabaseWithQuery, jn as ConvexForeignKeyBuilder, jr as ColumnBuilder, jt as VectorSearchProvider, kn as ConvexCheckBuilder, kt as UpdateSet, ln as RlsRoleConfig, lr as eq, lt as GetColumnData, m as MigrationDocContext, mn as ConvexIndexBuilderOn, mr as inArray, mt as MutationExecuteConfig, n as OrmCapabilities, nn as deletion, nr as FilterExpression, nt as AggregateResult, on as RlsPolicyToOption, or as between, ot as CountResult, p as MigrationDoc, pn as ConvexIndexBuilder, pr as ilike, pt as InsertValue, qn as OrmSchemaExtensionTables, qt as ConvexDeletionBuilder, r as OrmCapability, rn as discriminator, rr as LogicalExpression, rt as BuildQueryResult, sn as rlsPolicy, sr as contains, st as DBQueryConfig, t as OrmAggregateCapability, tn as convexTable, tr as FieldReference, tt as AggregateFieldValue, u as MigrationAppliedState, un as rlsRole, ur as fieldRef, ut as InferInsertModel, v as MigrationPlan, vn as ConvexSearchIndexBuilderOn, vr as like, vt as MutationPaginatedResult, w as MigrationWriteMode, wn as index, wr as notInArray, wt as PaginatedResult, x as MigrationStateMap, xn as ConvexVectorIndexBuilderOn, xr as ne, xt as MutationRunMode, y as MigrationRunStatus, yn as ConvexSearchIndexConfig, yr as lt, yt as MutationResult, zn as ConvexTextBuilder, zr as IsPrimaryKey, zt as RelationsBuilderColumnBase } from "../capabilities-CLCYgRdY.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-DAPEBp1y.js";
1
+ import { $n as BinaryExpression, $t as OrmLifecycleOperation, A as DatabaseWithMutations, An as ConvexCheckConfig, Ar as AnyColumn, At as VectorQueryConfig, B as RlsContext, Bn as ConvexTextBuilderInitial, Br as IsUnique, Bt as RelationsBuilderColumnConfig, C as MigrationTableName, Cn as aggregateIndex, Cr as notBetween, Ct as OrderDirection, D as defineMigrationSet, Dn as uniqueIndex, Dt as ReturningResult, E as defineMigration, En as searchIndex, Er as startsWith, Et as ReturningAll, Fn as ConvexUniqueConstraintConfig, Fr as ColumnBuilderWithTableName, Ft as ExtractTablesWithRelations, Gt as defineRelations, H as EdgeMetadata, In as check, Ir as ColumnDataType, It as ManyConfig, Jt as ConvexDeletionConfig, Kt as defineRelationsPart, Ln as foreignKey, Lr as DrizzleEntity, Lt as OneConfig, M as OrmReader$1, Mn as ConvexForeignKeyConfig, Mr as ColumnBuilderBaseConfig, Mt as unsetToken, N as OrmWriter$1, Nn as ConvexUniqueConstraintBuilder, Nr as ColumnBuilderRuntimeConfig, O as detectMigrationDrift, On as vectorIndex, Or as SystemFields, Ot as ReturningSelection, Pn as ConvexUniqueConstraintBuilderOn, Pr as ColumnBuilderTypeConfig, Pt as ExtractTablesFromSchema, Qn as TableName, Qt as OrmLifecycleChange, Rn as unique, Rr as HasDefault, Rt as RelationsBuilder, S as MigrationStep, Sn as ConvexVectorIndexConfig, Sr as not, St as OrderByClause, T as buildMigrationPlan, Tn as rankIndex, Tr as or, Tt as PredicateWhereIndexConfig, U as extractRelationsConfig, Un as Brand, Ut as TableRelationalConfig, V as RlsMode, Vn as text, Vr as NotNull, Wn as Columns, Wt as TablesRelationalConfig, Xn as OrmSchemaRelations, Xt as ConvexTableWithColumns, Yn as OrmSchemaExtensions, Yt as ConvexTable, Zn as OrmSchemaTriggers, Zt as DiscriminatorBuilderConfig, _ as MigrationMigrateOne, _n as ConvexSearchIndexBuilder, _r as isNull, _t as MutationPaginateConfig, an as RlsPolicyConfig, ar as and, at as CountConfig, b as MigrationSet, bn as ConvexVectorIndexBuilder, br as lte, bt as MutationReturning, cn as RlsRole, cr as endsWith, ct as FilterOperators, d as MigrationDefinition, dn as ConvexAggregateIndexBuilder, dr as gt, dt as InferModelFromColumns, en as TableConfig, er as ExpressionVisitor, et as AggregateConfig, f as MigrationDirection, fn as ConvexAggregateIndexBuilderOn, fr as gte, ft as InferSelectModel, g as MigrationManifestEntry, gn as ConvexRankIndexBuilderOn, gr as isNotNull, gt as MutationExecutionMode, h as MigrationDriftIssue, hn as ConvexRankIndexBuilder, hr as isFieldReference, ht as MutationExecuteResult, i as OrmMigrationCapability, in as RlsPolicy, ir as UnaryExpression, it as BuildRelationResult, j as DatabaseWithQuery, jn as ConvexForeignKeyBuilder, jr as ColumnBuilder, jt as VectorSearchProvider, kn as ConvexCheckBuilder, kt as UpdateSet, ln as RlsRoleConfig, lr as eq, lt as GetColumnData, m as MigrationDocContext, mn as ConvexIndexBuilderOn, mr as inArray, mt as MutationExecuteConfig, n as OrmCapabilities, nn as deletion, nr as FilterExpression, nt as AggregateResult, on as RlsPolicyToOption, or as between, ot as CountResult, p as MigrationDoc, pn as ConvexIndexBuilder, pr as ilike, pt as InsertValue, qn as OrmSchemaExtensionTables, qt as ConvexDeletionBuilder, r as OrmCapability, rn as discriminator, rr as LogicalExpression, rt as BuildQueryResult, sn as rlsPolicy, sr as contains, st as DBQueryConfig, t as OrmAggregateCapability, tn as convexTable, tr as FieldReference, tt as AggregateFieldValue, u as MigrationAppliedState, un as rlsRole, ur as fieldRef, ut as InferInsertModel, v as MigrationPlan, vn as ConvexSearchIndexBuilderOn, vr as like, vt as MutationPaginatedResult, w as MigrationWriteMode, wn as index, wr as notInArray, wt as PaginatedResult, x as MigrationStateMap, xn as ConvexVectorIndexBuilderOn, xr as ne, xt as MutationRunMode, y as MigrationRunStatus, yn as ConvexSearchIndexConfig, yr as lt, yt as MutationResult, zn as ConvexTextBuilder, zr as IsPrimaryKey, zt as RelationsBuilderColumnBase } from "../capabilities-DkfnnNp7.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-DuC8Nr7e.js";
3
3
  import { i as pretendRequired, n as deprecated, r as pretend } from "../validators-wOIjhkfN.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-DJONf8X5.js";
5
5
  import { DefineSchemaOptions, GenericDatabaseReader, GenericDatabaseWriter, GenericSchema, SchemaDefinition } from "convex/server";
package/dist/orm/index.js CHANGED
@@ -4,9 +4,9 @@ import { a as pretendRequired, i as pretend, n as deprecated } from "../validato
4
4
  import { t as id } from "../id-CuSfWa5q.js";
5
5
  import { A as or, C as matchLikePattern, D as notIlike, E as notBetween, O as notInArray, S as lte, T as not, _ as isFieldReference, a as between, b as like, c as endsWith, d as filterValueInList, f as filterValuesEqual, g as inArray, h as ilike, i as arrayOverlaps, j as startsWith, k as notLike, l as eq, m as gte, n as arrayContained, o as column, p as gt, r as arrayContains, s as contains, t as and, u as fieldRef, v as isNotNull, w as ne, x as lt, y as isNull } from "../filter-expression-Dydt8wS0.js";
6
6
  import { a as indexKeyWithinBounds, c as streamIndexRange, i as getIndexFields, l as isUnsetToken, n as EmptyStream, o as mergedStream, r as QueryStream, s as stream, t as getByIdWithOrmQueryFallback, u as unsetToken } from "../query-context-DOm5Xm3H.js";
7
- import { $ as resolveOrmRuntimeDefaults, A as enforceUniqueIndexes, B as getMutationAsyncDelayMs, C as collectPrimaryIdLookupRows, Ct as usesSystemCreatedAtAlias, D as enforceCheckConstraints, E as encodeUndefinedDeep, F as evaluateFilter, G as getTableDeleteConfig, H as getMutationExecutionMode, I as extractPrimaryIdLookup, J as hardDeleteRow, K as getTableName, L as getChecks, M as ensureNonNullValues, N as ensureNullableColumns, O as enforceForeignKeys, P as evaluateCheckConstraintTriState, Q as patchReferencingRows, R as getColumnName$1, S as collectMutationRowsBounded, St as PUBLIC_CREATED_AT_FIELD, T as deserializeFilterExpression, U as getOrmContext, V as getMutationCollectionLimits, W as getTableColumns$2, X as normalizeDateFieldsForWrite, Y as hydrateDateFieldsForRead, Z as normalizeTemporalComparableValue, _ as applyDefaults, _t as getIndexes, at as toConvexFilter, b as buildForeignKeyGraph, bt as CREATED_AT_MIGRATION_MESSAGE, c as getAggregateIndexDefinitions, ct as compileConvexFilter, d as COUNT_ERROR, dt as mapWithConcurrency, et as selectReturningRowWithHydration, f as createAggregateError, ft as findIndexForColumns, g as ensureCountAllowedForRls, gt as getAggregateIndexes, h as ensureAggregateAllowedForRls, ht as findVectorIndexByName, it as takeRowsWithinByteBudget, j as ensureDefaultColumns, k as enforcePolymorphicWrite, l as getRankIndexDefinitions, lt as convexAnd, mt as findSearchIndexByName, nt as softDeleteRow, o as aggregateExtension, ot as hasLifecycleHooks, p as createCountError, pt as findRelationIndex, q as getUniqueIndexes, rt as splitReturningSelection, st as markLifecycleHookedTables, tt as serializeFilterExpression, u as AGGREGATE_ERROR, ut as isConvexEnforceableFilter, v as applyIncomingForeignKeyActionsOnDelete, vt as getRankIndexes, w as decodeUndefinedDeep, x as canUsePrimaryIdLookupCursor, xt as INTERNAL_CREATION_TIME_FIELD, y as applyIncomingForeignKeyActionsOnUpdate, yt as resolveIndexOrderPushdown, z as getForeignKeys } from "../schema-C5WWEqsj.js";
7
+ import { $ as resolveOrmRuntimeDefaults, A as enforceUniqueIndexes, B as getMutationAsyncDelayMs, C as collectPrimaryIdLookupRows, Ct as CREATED_AT_MIGRATION_MESSAGE, D as enforceCheckConstraints, E as encodeUndefinedDeep, Et as usesSystemCreatedAtAlias, F as evaluateFilter, G as getTableDeleteConfig, H as getMutationExecutionMode, I as extractPrimaryIdLookup, J as hardDeleteRow, K as getTableName, L as getChecks, M as ensureNonNullValues, N as ensureNullableColumns, O as enforceForeignKeys, P as evaluateCheckConstraintTriState, Q as patchReferencingRows, R as getColumnName$1, S as collectMutationRowsBounded, St as resolveIndexOrderPushdown, T as deserializeFilterExpression, Tt as PUBLIC_CREATED_AT_FIELD, U as getOrmContext, V as getMutationCollectionLimits, W as getTableColumns$2, X as normalizeDateFieldsForWrite, Y as hydrateDateFieldsForRead, Z as normalizeTemporalComparableValue, _ as applyDefaults, _t as findSearchIndexByName, at as stripUnsetFields, b as buildForeignKeyGraph, bt as getIndexes, c as getAggregateIndexDefinitions, ct as unsetFieldsOf, d as COUNT_ERROR, dt as compileConvexFilter, et as returningSelectionReadsCreationTime, f as createAggregateError, ft as convexAnd, g as ensureCountAllowedForRls, gt as findRelationIndex, h as ensureAggregateAllowedForRls, ht as findIndexForColumns, it as splitReturningSelection, j as ensureDefaultColumns, k as enforcePolymorphicWrite, l as getRankIndexDefinitions, lt as hasLifecycleHooks, mt as mapWithConcurrency, nt as serializeFilterExpression, o as aggregateExtension, ot as takeRowsWithinByteBudget, p as createCountError, pt as isConvexEnforceableFilter, q as getUniqueIndexes, rt as softDeleteRow, st as toConvexFilter, tt as selectReturningRowWithHydration, u as AGGREGATE_ERROR, ut as markLifecycleHookedTables, v as applyIncomingForeignKeyActionsOnDelete, vt as findVectorIndexByName, w as decodeUndefinedDeep, wt as INTERNAL_CREATION_TIME_FIELD, x as canUsePrimaryIdLookupCursor, xt as getRankIndexes, y as applyIncomingForeignKeyActionsOnUpdate, yt as getAggregateIndexes, z as getForeignKeys } from "../schema-D95Z3Kss.js";
8
8
  import { t as defineSchemaExtension } from "../extensions-Blzsyekm.js";
9
- import { compareValues, v } from "convex/values";
9
+ import { compareValues, convexToJson, jsonToConvex, v } from "convex/values";
10
10
  import { defineSchema as defineSchema$1, internalActionGeneric, internalMutationGeneric } from "convex/server";
11
11
 
12
12
  //#region src/orm/builders/bigint.ts
@@ -1560,6 +1560,33 @@ var GelRelationalQuery = class GelRelationalQuery extends QueryPromise {
1560
1560
  this._countIndexReadinessByKey = countIndexReadiness ?? /* @__PURE__ */ new Map();
1561
1561
  }
1562
1562
  /**
1563
+ * Relation counts for a document the caller is already holding.
1564
+ *
1565
+ * `returning({ _count })` runs inside the mutation that just wrote the row,
1566
+ * so resolving it through `execute()` spends one `db.get` re-reading a
1567
+ * document that is already in the transaction's write set. The count engine
1568
+ * only ever reads the counted edges' source fields off its parent, and the
1569
+ * caller's document carries all of them, so the root read is pure waste.
1570
+ * Everything else `execute()` would have done to that row — the select-plan
1571
+ * assertion and the RLS select filter — still runs here.
1572
+ *
1573
+ * Reached through the static accessor below rather than exposed on the instance:
1574
+ * `GelRelationalQuery` is the declared return type of the public query
1575
+ * builders, so an instance method would land in every user's autocomplete.
1576
+ */
1577
+ async _countRelationsForHeldRow(row, countSelection) {
1578
+ this._assertRlsSelectPlan({ _count: countSelection }, this.tableConfig, this.edgeMetadata, 0, 3);
1579
+ const carrier = { ...row };
1580
+ const visible = await this._applyRlsSelectFilter([carrier], this.tableConfig);
1581
+ if (visible.length === 0) return {};
1582
+ await this._loadRelationCounts(visible, countSelection, this.edgeMetadata, this.tableConfig);
1583
+ return carrier._count ?? {};
1584
+ }
1585
+ /** @internal Accessor for `returning({ _count })`; see `returning-count.ts`. */
1586
+ static countRelationsForHeldRow(query, row, countSelection) {
1587
+ return query._countRelationsForHeldRow(row, countSelection);
1588
+ }
1589
+ /**
1563
1590
  * The aggregate-index runtime, registered at `createOrm()`.
1564
1591
  *
1565
1592
  * Only `count()`, `aggregate()` and relation counts reach this; plain reads
@@ -5118,13 +5145,26 @@ function createReturningCountLoader(db, table, ormContext) {
5118
5145
  const tableEdges = edgeMetadata.filter((edge) => edge.sourceTable === tableName);
5119
5146
  const countIndexReadiness = /* @__PURE__ */ new Map();
5120
5147
  return { async load(row, countSelection) {
5121
- return (await new GelRelationalQuery(schema, tableConfig, tableEdges, db, {
5122
- where: { id: row._id },
5123
- columns: {},
5124
- with: { _count: countSelection }
5125
- }, "first", edgeMetadata, ormContext?.rls, ormContext?.relationLoading, void 0, void 0, countIndexReadiness).execute())?._count ?? {};
5148
+ const query = new GelRelationalQuery(schema, tableConfig, tableEdges, db, {}, "first", edgeMetadata, ormContext?.rls, ormContext?.relationLoading, void 0, void 0, countIndexReadiness);
5149
+ return await GelRelationalQuery.countRelationsForHeldRow(query, row, countSelection);
5126
5150
  } };
5127
5151
  }
5152
+ /**
5153
+ * True when any edge leaving `tableName` keys on `_creationTime`.
5154
+ *
5155
+ * The count engine reads an edge's source fields straight off the row it is
5156
+ * handed, so a caller that derives that row instead of reading it back has to
5157
+ * know whether `_creationTime` is load-bearing — a derived insert post-image
5158
+ * cannot have it, and a missing source value counts zero without erroring.
5159
+ * Asked of every edge on the table rather than only the counted ones: the
5160
+ * count selection varies per statement, the schema does not.
5161
+ */
5162
+ function countedEdgesReadCreationTime(edgeMetadata, tableName) {
5163
+ return (edgeMetadata ?? []).some((edge) => {
5164
+ if (edge.sourceTable !== tableName) return false;
5165
+ return (edge.sourceFields.length > 0 ? edge.sourceFields : [edge.fieldName]).some((field) => field === INTERNAL_CREATION_TIME_FIELD || field === PUBLIC_CREATED_AT_FIELD);
5166
+ });
5167
+ }
5128
5168
 
5129
5169
  //#endregion
5130
5170
  //#region src/orm/delete.ts
@@ -5459,6 +5499,7 @@ var ConvexDeleteBuilder = class extends QueryPromise {
5459
5499
 
5460
5500
  //#endregion
5461
5501
  //#region src/orm/insert.ts
5502
+ const canonicalizeStoredRow = (row) => jsonToConvex(convexToJson(row));
5462
5503
  var ConvexInsertBuilder = class extends QueryPromise {
5463
5504
  valuesList = [];
5464
5505
  returningFields;
@@ -5509,13 +5550,15 @@ var ConvexInsertBuilder = class extends QueryPromise {
5509
5550
  async execute() {
5510
5551
  if (this.valuesList.length === 0) throw new Error("values() must be called before execute()");
5511
5552
  const ormContext = getOrmContext(this.db);
5553
+ const tableName = getTableName(this.table);
5512
5554
  const returningSelection = this.returningFields && this.returningFields !== true ? splitReturningSelection(this.returningFields) : void 0;
5555
+ const derivedRowSatisfiesCount = returningSelection?.countSelection === void 0 || !countedEdgesReadCreationTime(ormContext?.edgeMetadata, tableName) && !isRlsEnabled(this.table);
5556
+ const canDerivePostImage = returningSelection !== void 0 && !hasLifecycleHooks(this.db, tableName) && !returningSelectionReadsCreationTime(returningSelection.columnSelection) && derivedRowSatisfiesCount;
5513
5557
  const results = [];
5514
5558
  for (const value of this.valuesList) {
5515
5559
  const preparedValue = normalizeDateFieldsForWrite(this.table, applyDefaults(this.table, value));
5516
5560
  enforcePolymorphicWrite(this.table, preparedValue);
5517
5561
  const rls = ormContext?.rls;
5518
- const tableName = getTableName(this.table);
5519
5562
  const rlsResolution = createRlsPolicyResolutionCache();
5520
5563
  if (!await canInsertRow({
5521
5564
  cache: rlsResolution,
@@ -5534,7 +5577,10 @@ var ConvexInsertBuilder = class extends QueryPromise {
5534
5577
  await enforceUniqueIndexes(this.db, this.table, preparedValue, { changedFields: new Set(Object.keys(preparedValue)) });
5535
5578
  const id = await this.db.insert(tableName, preparedValue);
5536
5579
  if (!this.returningFields) continue;
5537
- const inserted = await this.db.get(id);
5580
+ const inserted = canDerivePostImage ? canonicalizeStoredRow({
5581
+ ...preparedValue,
5582
+ _id: id
5583
+ }) : await this.db.get(id);
5538
5584
  if (inserted) results.push(await this.resolveReturningRow(inserted, returningSelection, ormContext));
5539
5585
  }
5540
5586
  if (!this.returningFields) return;
@@ -5625,7 +5671,10 @@ var ConvexInsertBuilder = class extends QueryPromise {
5625
5671
  await this.db.patch(tableName, existing._id, writeSet);
5626
5672
  return {
5627
5673
  status: "updated",
5628
- row: this.returningFields ? await this.db.get(existing._id) : null
5674
+ row: this.returningFields ? hasLifecycleHooks(this.db, tableName) ? await this.db.get(existing._id) : canonicalizeStoredRow(stripUnsetFields({
5675
+ ...existing,
5676
+ ...writeSet
5677
+ }, unsetFieldsOf(writeSet))) : null
5629
5678
  };
5630
5679
  }
5631
5680
  async findConflictRow(value, targetColumns) {
@@ -6637,13 +6686,7 @@ var ConvexUpdateBuilder = class extends QueryPromise {
6637
6686
  const hooksCanWriteMidLoop = hasLifecycleHooks(this.db, tableName) || incomingForeignKeys.some((foreignKey) => hasLifecycleHooks(this.db, foreignKey.sourceTableName));
6638
6687
  const cascadeTargetsThisTable = incomingForeignKeys.some((foreignKey) => foreignKey.sourceTableName === tableName);
6639
6688
  const canDerivePostImage = !(hooksCanWriteMidLoop || cascadeTargetsThisTable);
6640
- const unsetFields = Object.keys(writeSet).filter((field) => writeSet[field] === void 0);
6641
- const derivePostImage = (candidate) => {
6642
- if (unsetFields.length === 0) return candidate;
6643
- const postImage = { ...candidate };
6644
- for (const field of unsetFields) delete postImage[field];
6645
- return postImage;
6646
- };
6689
+ const unsetFields = unsetFieldsOf(writeSet);
6647
6690
  /**
6648
6691
  * A single-column `references()` FK to `_id` whose column is supplied by
6649
6692
  * `set()` probes a byte-identical id on every row, and nothing in this loop
@@ -6690,7 +6733,7 @@ var ConvexUpdateBuilder = class extends QueryPromise {
6690
6733
  await this.db.patch(tableName, row._id, writeSet);
6691
6734
  numAffected++;
6692
6735
  if (!this.returningFields) continue;
6693
- const updated = canDerivePostImage ? derivePostImage(updatedRow) : await this.db.get(row._id);
6736
+ const updated = canDerivePostImage ? stripUnsetFields(updatedRow, unsetFields) : await this.db.get(row._id);
6694
6737
  if (!updated) continue;
6695
6738
  if (this.returningFields === true) results.push(hydrateDateFieldsForRead(this.table, updated));
6696
6739
  else {
@@ -1,3 +1,3 @@
1
- import { C as MigrationTableName, D as defineMigrationSet, E as defineMigration, O as detectMigrationDrift, S as MigrationStep, T as buildMigrationPlan, _ as MigrationMigrateOne, a as MigrationCancelArgs, b as MigrationSet, c as MigrationStatusArgs, d as MigrationDefinition, f as MigrationDirection, g as MigrationManifestEntry, h as MigrationDriftIssue, l as createMigrationHandlers, m as MigrationDocContext, o as MigrationRunArgs, p as MigrationDoc, s as MigrationRunChunkArgs, u as MigrationAppliedState, v as MigrationPlan, w as MigrationWriteMode, x as MigrationStateMap, y as MigrationRunStatus } from "../../capabilities-CLCYgRdY.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-DAPEBp1y.js";
1
+ import { C as MigrationTableName, D as defineMigrationSet, E as defineMigration, O as detectMigrationDrift, S as MigrationStep, T as buildMigrationPlan, _ as MigrationMigrateOne, a as MigrationCancelArgs, b as MigrationSet, c as MigrationStatusArgs, d as MigrationDefinition, f as MigrationDirection, g as MigrationManifestEntry, h as MigrationDriftIssue, l as createMigrationHandlers, m as MigrationDocContext, o as MigrationRunArgs, p as MigrationDoc, s as MigrationRunChunkArgs, u as MigrationAppliedState, v as MigrationPlan, w as MigrationWriteMode, x as MigrationStateMap, y as MigrationRunStatus } from "../../capabilities-DkfnnNp7.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-DuC8Nr7e.js";
3
3
  export { 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 };
@@ -1142,6 +1142,39 @@ function splitReturningSelection(fields) {
1142
1142
  countSelection
1143
1143
  };
1144
1144
  }
1145
+ /**
1146
+ * The keys a `patch` payload removes rather than writes.
1147
+ *
1148
+ * `patch` drops a key whose value is `undefined`; a local `{ ...row, ...set }`
1149
+ * merge keeps it, and `hydrateDateFieldsForRead` would then emit it. Hoisted
1150
+ * out of per-row loops by callers: one statement writes one `set()`.
1151
+ */
1152
+ function unsetFieldsOf(writeSet) {
1153
+ return Object.keys(writeSet).filter((field) => writeSet[field] === void 0);
1154
+ }
1155
+ /**
1156
+ * Removes the keys `patch` would have dropped from a locally derived
1157
+ * post-image. Returns `candidate` untouched when there is nothing to remove.
1158
+ */
1159
+ function stripUnsetFields(candidate, unsetFields) {
1160
+ if (unsetFields.length === 0) return candidate;
1161
+ const postImage = { ...candidate };
1162
+ for (const field of unsetFields) delete postImage[field];
1163
+ return postImage;
1164
+ }
1165
+ /**
1166
+ * True when the projection reads `_creationTime`, under either the public
1167
+ * `createdAt` alias or a user column that shadows it.
1168
+ *
1169
+ * `insert()` derives its post-image from the payload it just wrote, and
1170
+ * `_creationTime` is the one field that payload can never carry: Convex's
1171
+ * insert syscall returns the id and nothing else.
1172
+ */
1173
+ function returningSelectionReadsCreationTime(columnSelection) {
1174
+ if (!columnSelection) return false;
1175
+ for (const column of Object.values(columnSelection)) if (getSelectionColumnName(column) === INTERNAL_CREATION_TIME_FIELD) return true;
1176
+ return false;
1177
+ }
1145
1178
  const matchLike = matchLikePattern;
1146
1179
  function evaluateFilter(row, filter) {
1147
1180
  if (filter.type === "binary") {
@@ -1489,4 +1522,4 @@ function aggregateExtension() {
1489
1522
  }
1490
1523
 
1491
1524
  //#endregion
1492
- export { resolveOrmRuntimeDefaults as $, enforceUniqueIndexes as A, getMutationAsyncDelayMs as B, collectPrimaryIdLookupRows as C, usesSystemCreatedAtAlias as Ct, enforceCheckConstraints as D, encodeUndefinedDeep as E, evaluateFilter as F, getTableDeleteConfig as G, getMutationExecutionMode as H, extractPrimaryIdLookup as I, hardDeleteRow as J, getTableName as K, getChecks as L, ensureNonNullValues as M, ensureNullableColumns as N, enforceForeignKeys as O, evaluateCheckConstraintTriState as P, patchReferencingRows as Q, getColumnName as R, collectMutationRowsBounded as S, PUBLIC_CREATED_AT_FIELD as St, deserializeFilterExpression as T, getOrmContext as U, getMutationCollectionLimits as V, getTableColumns as W, normalizeDateFieldsForWrite as X, hydrateDateFieldsForRead as Y, normalizeTemporalComparableValue as Z, applyDefaults as _, getIndexes as _t, AGGREGATE_STATE_TABLE as a, toConvexFilter as at, buildForeignKeyGraph as b, CREATED_AT_MIGRATION_MESSAGE as bt, getAggregateIndexDefinitions as c, compileConvexFilter as ct, COUNT_ERROR as d, mapWithConcurrency as dt, selectReturningRowWithHydration as et, createAggregateError as f, findIndexForColumns as ft, ensureCountAllowedForRls as g, getAggregateIndexes as gt, ensureAggregateAllowedForRls as h, findVectorIndexByName as ht, AGGREGATE_RANK_TREE_TABLE as i, takeRowsWithinByteBudget as it, ensureDefaultColumns as j, enforcePolymorphicWrite as k, getRankIndexDefinitions as l, convexAnd as lt, createError as m, findSearchIndexByName as mt, AGGREGATE_EXTREMA_TABLE as n, softDeleteRow as nt, aggregateExtension as o, hasLifecycleHooks as ot, createCountError as p, findRelationIndex as pt, getUniqueIndexes as q, AGGREGATE_MEMBER_TABLE as r, splitReturningSelection as rt, rankAggregateName as s, markLifecycleHookedTables as st, AGGREGATE_BUCKET_TABLE as t, serializeFilterExpression as tt, AGGREGATE_ERROR as u, isConvexEnforceableFilter as ut, applyIncomingForeignKeyActionsOnDelete as v, getRankIndexes as vt, decodeUndefinedDeep as w, canUsePrimaryIdLookupCursor as x, INTERNAL_CREATION_TIME_FIELD as xt, applyIncomingForeignKeyActionsOnUpdate as y, resolveIndexOrderPushdown as yt, getForeignKeys as z };
1525
+ export { resolveOrmRuntimeDefaults as $, enforceUniqueIndexes as A, getMutationAsyncDelayMs as B, collectPrimaryIdLookupRows as C, CREATED_AT_MIGRATION_MESSAGE as Ct, enforceCheckConstraints as D, encodeUndefinedDeep as E, usesSystemCreatedAtAlias as Et, evaluateFilter as F, getTableDeleteConfig as G, getMutationExecutionMode as H, extractPrimaryIdLookup as I, hardDeleteRow as J, getTableName as K, getChecks as L, ensureNonNullValues as M, ensureNullableColumns as N, enforceForeignKeys as O, evaluateCheckConstraintTriState as P, patchReferencingRows as Q, getColumnName as R, collectMutationRowsBounded as S, resolveIndexOrderPushdown as St, deserializeFilterExpression as T, PUBLIC_CREATED_AT_FIELD as Tt, getOrmContext as U, getMutationCollectionLimits as V, getTableColumns as W, normalizeDateFieldsForWrite as X, hydrateDateFieldsForRead as Y, normalizeTemporalComparableValue as Z, applyDefaults as _, findSearchIndexByName as _t, AGGREGATE_STATE_TABLE as a, stripUnsetFields as at, buildForeignKeyGraph as b, getIndexes as bt, getAggregateIndexDefinitions as c, unsetFieldsOf as ct, COUNT_ERROR as d, compileConvexFilter as dt, returningSelectionReadsCreationTime as et, createAggregateError as f, convexAnd as ft, ensureCountAllowedForRls as g, findRelationIndex as gt, ensureAggregateAllowedForRls as h, findIndexForColumns as ht, AGGREGATE_RANK_TREE_TABLE as i, splitReturningSelection as it, ensureDefaultColumns as j, enforcePolymorphicWrite as k, getRankIndexDefinitions as l, hasLifecycleHooks as lt, createError as m, mapWithConcurrency as mt, AGGREGATE_EXTREMA_TABLE as n, serializeFilterExpression as nt, aggregateExtension as o, takeRowsWithinByteBudget as ot, createCountError as p, isConvexEnforceableFilter as pt, getUniqueIndexes as q, AGGREGATE_MEMBER_TABLE as r, softDeleteRow as rt, rankAggregateName as s, toConvexFilter as st, AGGREGATE_BUCKET_TABLE as t, selectReturningRowWithHydration as tt, AGGREGATE_ERROR as u, markLifecycleHookedTables as ut, applyIncomingForeignKeyActionsOnDelete as v, findVectorIndexByName as vt, decodeUndefinedDeep as w, INTERNAL_CREATION_TIME_FIELD as wt, canUsePrimaryIdLookupCursor as x, getRankIndexes as xt, applyIncomingForeignKeyActionsOnUpdate as y, getAggregateIndexes as yt, getForeignKeys as z };
@@ -1,4 +1,4 @@
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, 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-CLCYgRdY.js";
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, 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-DkfnnNp7.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 } from "convex/server";
@@ -102,20 +102,25 @@ declare const migrationStorageTables: {
102
102
  fieldName: "status";
103
103
  };
104
104
  };
105
- migrationId: ConvexTextBuilderInitial<""> & {
105
+ cursor: ConvexTextBuilderInitial<""> & {
106
106
  _: {
107
- notNull: true;
107
+ tableName: "migration_state";
108
108
  };
109
109
  } & {
110
+ _: {
111
+ fieldName: "cursor";
112
+ };
113
+ };
114
+ direction: ConvexTextBuilderInitial<""> & {
110
115
  _: {
111
116
  tableName: "migration_state";
112
117
  };
113
118
  } & {
114
119
  _: {
115
- fieldName: "migrationId";
120
+ fieldName: "direction";
116
121
  };
117
122
  };
118
- checksum: ConvexTextBuilderInitial<""> & {
123
+ updatedAt: ConvexNumberBuilderInitial<""> & {
119
124
  _: {
120
125
  notNull: true;
121
126
  };
@@ -125,10 +130,10 @@ declare const migrationStorageTables: {
125
130
  };
126
131
  } & {
127
132
  _: {
128
- fieldName: "checksum";
133
+ fieldName: "updatedAt";
129
134
  };
130
135
  };
131
- applied: ConvexBooleanBuilderInitial<""> & {
136
+ migrationId: ConvexTextBuilderInitial<""> & {
132
137
  _: {
133
138
  notNull: true;
134
139
  };
@@ -138,34 +143,42 @@ declare const migrationStorageTables: {
138
143
  };
139
144
  } & {
140
145
  _: {
141
- fieldName: "applied";
146
+ fieldName: "migrationId";
142
147
  };
143
148
  };
144
- direction: ConvexTextBuilderInitial<""> & {
149
+ checksum: ConvexTextBuilderInitial<""> & {
150
+ _: {
151
+ notNull: true;
152
+ };
153
+ } & {
145
154
  _: {
146
155
  tableName: "migration_state";
147
156
  };
148
157
  } & {
149
158
  _: {
150
- fieldName: "direction";
159
+ fieldName: "checksum";
151
160
  };
152
161
  };
153
- runId: ConvexTextBuilderInitial<""> & {
162
+ applied: ConvexBooleanBuilderInitial<""> & {
163
+ _: {
164
+ notNull: true;
165
+ };
166
+ } & {
154
167
  _: {
155
168
  tableName: "migration_state";
156
169
  };
157
170
  } & {
158
171
  _: {
159
- fieldName: "runId";
172
+ fieldName: "applied";
160
173
  };
161
174
  };
162
- cursor: ConvexTextBuilderInitial<""> & {
175
+ runId: ConvexTextBuilderInitial<""> & {
163
176
  _: {
164
177
  tableName: "migration_state";
165
178
  };
166
179
  } & {
167
180
  _: {
168
- fieldName: "cursor";
181
+ fieldName: "runId";
169
182
  };
170
183
  };
171
184
  processed: ConvexNumberBuilderInitial<""> & {
@@ -190,19 +203,6 @@ declare const migrationStorageTables: {
190
203
  fieldName: "startedAt";
191
204
  };
192
205
  };
193
- updatedAt: ConvexNumberBuilderInitial<""> & {
194
- _: {
195
- notNull: true;
196
- };
197
- } & {
198
- _: {
199
- tableName: "migration_state";
200
- };
201
- } & {
202
- _: {
203
- fieldName: "updatedAt";
204
- };
205
- };
206
206
  completedAt: ConvexNumberBuilderInitial<""> & {
207
207
  _: {
208
208
  tableName: "migration_state";
@@ -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,10 +279,10 @@ declare const migrationStorageTables: {
279
279
  };
280
280
  } & {
281
281
  _: {
282
- fieldName: "runId";
282
+ fieldName: "updatedAt";
283
283
  };
284
284
  };
285
- startedAt: ConvexNumberBuilderInitial<""> & {
285
+ runId: ConvexTextBuilderInitial<""> & {
286
286
  _: {
287
287
  notNull: true;
288
288
  };
@@ -292,10 +292,10 @@ declare const migrationStorageTables: {
292
292
  };
293
293
  } & {
294
294
  _: {
295
- fieldName: "startedAt";
295
+ fieldName: "runId";
296
296
  };
297
297
  };
298
- updatedAt: ConvexNumberBuilderInitial<""> & {
298
+ startedAt: ConvexNumberBuilderInitial<""> & {
299
299
  _: {
300
300
  notNull: true;
301
301
  };
@@ -305,7 +305,7 @@ declare const migrationStorageTables: {
305
305
  };
306
306
  } & {
307
307
  _: {
308
- fieldName: "updatedAt";
308
+ fieldName: "startedAt";
309
309
  };
310
310
  };
311
311
  completedAt: ConvexNumberBuilderInitial<""> & {
@@ -1008,7 +1008,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1008
1008
  readonly aggregate_bucket: ConvexTableWithColumns<{
1009
1009
  name: "aggregate_bucket";
1010
1010
  columns: {
1011
- updatedAt: ConvexNumberBuilderInitial<""> & {
1011
+ count: ConvexNumberBuilderInitial<""> & {
1012
1012
  _: {
1013
1013
  notNull: true;
1014
1014
  };
@@ -1018,10 +1018,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1018
1018
  };
1019
1019
  } & {
1020
1020
  _: {
1021
- fieldName: "updatedAt";
1021
+ fieldName: "count";
1022
1022
  };
1023
1023
  };
1024
- count: ConvexNumberBuilderInitial<""> & {
1024
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1025
1025
  _: {
1026
1026
  notNull: true;
1027
1027
  };
@@ -1031,10 +1031,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1031
1031
  };
1032
1032
  } & {
1033
1033
  _: {
1034
- fieldName: "count";
1034
+ fieldName: "updatedAt";
1035
1035
  };
1036
1036
  };
1037
- indexName: ConvexTextBuilderInitial<""> & {
1037
+ tableKey: ConvexTextBuilderInitial<""> & {
1038
1038
  _: {
1039
1039
  notNull: true;
1040
1040
  };
@@ -1044,10 +1044,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1044
1044
  };
1045
1045
  } & {
1046
1046
  _: {
1047
- fieldName: "indexName";
1047
+ fieldName: "tableKey";
1048
1048
  };
1049
1049
  };
1050
- tableKey: ConvexTextBuilderInitial<""> & {
1050
+ indexName: ConvexTextBuilderInitial<""> & {
1051
1051
  _: {
1052
1052
  notNull: true;
1053
1053
  };
@@ -1057,7 +1057,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1057
1057
  };
1058
1058
  } & {
1059
1059
  _: {
1060
- fieldName: "tableKey";
1060
+ fieldName: "indexName";
1061
1061
  };
1062
1062
  };
1063
1063
  keyHash: ConvexTextBuilderInitial<""> & {
@@ -1133,7 +1133,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1133
1133
  readonly aggregate_member: ConvexTableWithColumns<{
1134
1134
  name: "aggregate_member";
1135
1135
  columns: {
1136
- updatedAt: ConvexNumberBuilderInitial<""> & {
1136
+ kind: ConvexTextBuilderInitial<""> & {
1137
1137
  _: {
1138
1138
  notNull: true;
1139
1139
  };
@@ -1143,10 +1143,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1143
1143
  };
1144
1144
  } & {
1145
1145
  _: {
1146
- fieldName: "updatedAt";
1146
+ fieldName: "kind";
1147
1147
  };
1148
1148
  };
1149
- kind: ConvexTextBuilderInitial<""> & {
1149
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1150
1150
  _: {
1151
1151
  notNull: true;
1152
1152
  };
@@ -1156,10 +1156,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1156
1156
  };
1157
1157
  } & {
1158
1158
  _: {
1159
- fieldName: "kind";
1159
+ fieldName: "updatedAt";
1160
1160
  };
1161
1161
  };
1162
- indexName: ConvexTextBuilderInitial<""> & {
1162
+ tableKey: ConvexTextBuilderInitial<""> & {
1163
1163
  _: {
1164
1164
  notNull: true;
1165
1165
  };
@@ -1169,10 +1169,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1169
1169
  };
1170
1170
  } & {
1171
1171
  _: {
1172
- fieldName: "indexName";
1172
+ fieldName: "tableKey";
1173
1173
  };
1174
1174
  };
1175
- tableKey: ConvexTextBuilderInitial<""> & {
1175
+ indexName: ConvexTextBuilderInitial<""> & {
1176
1176
  _: {
1177
1177
  notNull: true;
1178
1178
  };
@@ -1182,7 +1182,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1182
1182
  };
1183
1183
  } & {
1184
1184
  _: {
1185
- fieldName: "tableKey";
1185
+ fieldName: "indexName";
1186
1186
  };
1187
1187
  };
1188
1188
  keyHash: ConvexTextBuilderInitial<""> & {
@@ -1323,7 +1323,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1323
1323
  readonly aggregate_extrema: ConvexTableWithColumns<{
1324
1324
  name: "aggregate_extrema";
1325
1325
  columns: {
1326
- updatedAt: ConvexNumberBuilderInitial<""> & {
1326
+ count: ConvexNumberBuilderInitial<""> & {
1327
1327
  _: {
1328
1328
  notNull: true;
1329
1329
  };
@@ -1333,7 +1333,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1333
1333
  };
1334
1334
  } & {
1335
1335
  _: {
1336
- fieldName: "updatedAt";
1336
+ fieldName: "count";
1337
1337
  };
1338
1338
  };
1339
1339
  value: ConvexCustomBuilderInitial<"", convex_values0.VAny<any, "required", string>> & {
@@ -1353,7 +1353,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1353
1353
  fieldName: "value";
1354
1354
  };
1355
1355
  };
1356
- count: ConvexNumberBuilderInitial<""> & {
1356
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1357
1357
  _: {
1358
1358
  notNull: true;
1359
1359
  };
@@ -1363,10 +1363,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1363
1363
  };
1364
1364
  } & {
1365
1365
  _: {
1366
- fieldName: "count";
1366
+ fieldName: "updatedAt";
1367
1367
  };
1368
1368
  };
1369
- indexName: ConvexTextBuilderInitial<""> & {
1369
+ tableKey: ConvexTextBuilderInitial<""> & {
1370
1370
  _: {
1371
1371
  notNull: true;
1372
1372
  };
@@ -1376,10 +1376,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1376
1376
  };
1377
1377
  } & {
1378
1378
  _: {
1379
- fieldName: "indexName";
1379
+ fieldName: "tableKey";
1380
1380
  };
1381
1381
  };
1382
- tableKey: ConvexTextBuilderInitial<""> & {
1382
+ indexName: ConvexTextBuilderInitial<""> & {
1383
1383
  _: {
1384
1384
  notNull: true;
1385
1385
  };
@@ -1389,7 +1389,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1389
1389
  };
1390
1390
  } & {
1391
1391
  _: {
1392
- fieldName: "tableKey";
1392
+ fieldName: "indexName";
1393
1393
  };
1394
1394
  };
1395
1395
  keyHash: ConvexTextBuilderInitial<""> & {
@@ -1589,6 +1589,19 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1589
1589
  fieldName: "status";
1590
1590
  };
1591
1591
  };
1592
+ kind: ConvexTextBuilderInitial<""> & {
1593
+ _: {
1594
+ notNull: true;
1595
+ };
1596
+ } & {
1597
+ _: {
1598
+ tableName: "aggregate_state";
1599
+ };
1600
+ } & {
1601
+ _: {
1602
+ fieldName: "kind";
1603
+ };
1604
+ };
1592
1605
  cursor: ConvexTextBuilderInitial<""> & {
1593
1606
  _: {
1594
1607
  tableName: "aggregate_state";
@@ -1598,7 +1611,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1598
1611
  fieldName: "cursor";
1599
1612
  };
1600
1613
  };
1601
- processed: ConvexNumberBuilderInitial<""> & {
1614
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1602
1615
  _: {
1603
1616
  notNull: true;
1604
1617
  };
@@ -1608,10 +1621,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1608
1621
  };
1609
1622
  } & {
1610
1623
  _: {
1611
- fieldName: "processed";
1624
+ fieldName: "updatedAt";
1612
1625
  };
1613
1626
  };
1614
- startedAt: ConvexNumberBuilderInitial<""> & {
1627
+ processed: ConvexNumberBuilderInitial<""> & {
1615
1628
  _: {
1616
1629
  notNull: true;
1617
1630
  };
@@ -1621,10 +1634,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1621
1634
  };
1622
1635
  } & {
1623
1636
  _: {
1624
- fieldName: "startedAt";
1637
+ fieldName: "processed";
1625
1638
  };
1626
1639
  };
1627
- updatedAt: ConvexNumberBuilderInitial<""> & {
1640
+ startedAt: ConvexNumberBuilderInitial<""> & {
1628
1641
  _: {
1629
1642
  notNull: true;
1630
1643
  };
@@ -1634,7 +1647,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1634
1647
  };
1635
1648
  } & {
1636
1649
  _: {
1637
- fieldName: "updatedAt";
1650
+ fieldName: "startedAt";
1638
1651
  };
1639
1652
  };
1640
1653
  completedAt: ConvexNumberBuilderInitial<""> & {
@@ -1655,7 +1668,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1655
1668
  fieldName: "lastError";
1656
1669
  };
1657
1670
  };
1658
- kind: ConvexTextBuilderInitial<""> & {
1671
+ tableKey: ConvexTextBuilderInitial<""> & {
1659
1672
  _: {
1660
1673
  notNull: true;
1661
1674
  };
@@ -1665,7 +1678,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1665
1678
  };
1666
1679
  } & {
1667
1680
  _: {
1668
- fieldName: "kind";
1681
+ fieldName: "tableKey";
1669
1682
  };
1670
1683
  };
1671
1684
  indexName: ConvexTextBuilderInitial<""> & {
@@ -1707,19 +1720,6 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1707
1720
  fieldName: "metricDefinitionHash";
1708
1721
  };
1709
1722
  };
1710
- tableKey: ConvexTextBuilderInitial<""> & {
1711
- _: {
1712
- notNull: true;
1713
- };
1714
- } & {
1715
- _: {
1716
- tableName: "aggregate_state";
1717
- };
1718
- } & {
1719
- _: {
1720
- fieldName: "tableKey";
1721
- };
1722
- };
1723
1723
  };
1724
1724
  }, {
1725
1725
  by_creation_time: ["_creationTime"];
@@ -1744,20 +1744,25 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1744
1744
  fieldName: "status";
1745
1745
  };
1746
1746
  };
1747
- migrationId: ConvexTextBuilderInitial<""> & {
1747
+ cursor: ConvexTextBuilderInitial<""> & {
1748
1748
  _: {
1749
- notNull: true;
1749
+ tableName: "migration_state";
1750
1750
  };
1751
1751
  } & {
1752
+ _: {
1753
+ fieldName: "cursor";
1754
+ };
1755
+ };
1756
+ direction: ConvexTextBuilderInitial<""> & {
1752
1757
  _: {
1753
1758
  tableName: "migration_state";
1754
1759
  };
1755
1760
  } & {
1756
1761
  _: {
1757
- fieldName: "migrationId";
1762
+ fieldName: "direction";
1758
1763
  };
1759
1764
  };
1760
- checksum: ConvexTextBuilderInitial<""> & {
1765
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1761
1766
  _: {
1762
1767
  notNull: true;
1763
1768
  };
@@ -1767,10 +1772,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1767
1772
  };
1768
1773
  } & {
1769
1774
  _: {
1770
- fieldName: "checksum";
1775
+ fieldName: "updatedAt";
1771
1776
  };
1772
1777
  };
1773
- applied: ConvexBooleanBuilderInitial<""> & {
1778
+ migrationId: ConvexTextBuilderInitial<""> & {
1774
1779
  _: {
1775
1780
  notNull: true;
1776
1781
  };
@@ -1780,34 +1785,42 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1780
1785
  };
1781
1786
  } & {
1782
1787
  _: {
1783
- fieldName: "applied";
1788
+ fieldName: "migrationId";
1784
1789
  };
1785
1790
  };
1786
- direction: ConvexTextBuilderInitial<""> & {
1791
+ checksum: ConvexTextBuilderInitial<""> & {
1792
+ _: {
1793
+ notNull: true;
1794
+ };
1795
+ } & {
1787
1796
  _: {
1788
1797
  tableName: "migration_state";
1789
1798
  };
1790
1799
  } & {
1791
1800
  _: {
1792
- fieldName: "direction";
1801
+ fieldName: "checksum";
1793
1802
  };
1794
1803
  };
1795
- runId: ConvexTextBuilderInitial<""> & {
1804
+ applied: ConvexBooleanBuilderInitial<""> & {
1805
+ _: {
1806
+ notNull: true;
1807
+ };
1808
+ } & {
1796
1809
  _: {
1797
1810
  tableName: "migration_state";
1798
1811
  };
1799
1812
  } & {
1800
1813
  _: {
1801
- fieldName: "runId";
1814
+ fieldName: "applied";
1802
1815
  };
1803
1816
  };
1804
- cursor: ConvexTextBuilderInitial<""> & {
1817
+ runId: ConvexTextBuilderInitial<""> & {
1805
1818
  _: {
1806
1819
  tableName: "migration_state";
1807
1820
  };
1808
1821
  } & {
1809
1822
  _: {
1810
- fieldName: "cursor";
1823
+ fieldName: "runId";
1811
1824
  };
1812
1825
  };
1813
1826
  processed: ConvexNumberBuilderInitial<""> & {
@@ -1832,19 +1845,6 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1832
1845
  fieldName: "startedAt";
1833
1846
  };
1834
1847
  };
1835
- updatedAt: ConvexNumberBuilderInitial<""> & {
1836
- _: {
1837
- notNull: true;
1838
- };
1839
- } & {
1840
- _: {
1841
- tableName: "migration_state";
1842
- };
1843
- } & {
1844
- _: {
1845
- fieldName: "updatedAt";
1846
- };
1847
- };
1848
1848
  completedAt: ConvexNumberBuilderInitial<""> & {
1849
1849
  _: {
1850
1850
  tableName: "migration_state";
@@ -1911,7 +1911,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1911
1911
  fieldName: "direction";
1912
1912
  };
1913
1913
  };
1914
- runId: ConvexTextBuilderInitial<""> & {
1914
+ updatedAt: ConvexNumberBuilderInitial<""> & {
1915
1915
  _: {
1916
1916
  notNull: true;
1917
1917
  };
@@ -1921,10 +1921,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1921
1921
  };
1922
1922
  } & {
1923
1923
  _: {
1924
- fieldName: "runId";
1924
+ fieldName: "updatedAt";
1925
1925
  };
1926
1926
  };
1927
- startedAt: ConvexNumberBuilderInitial<""> & {
1927
+ runId: ConvexTextBuilderInitial<""> & {
1928
1928
  _: {
1929
1929
  notNull: true;
1930
1930
  };
@@ -1934,10 +1934,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1934
1934
  };
1935
1935
  } & {
1936
1936
  _: {
1937
- fieldName: "startedAt";
1937
+ fieldName: "runId";
1938
1938
  };
1939
1939
  };
1940
- updatedAt: ConvexNumberBuilderInitial<""> & {
1940
+ startedAt: ConvexNumberBuilderInitial<""> & {
1941
1941
  _: {
1942
1942
  notNull: true;
1943
1943
  };
@@ -1947,7 +1947,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
1947
1947
  };
1948
1948
  } & {
1949
1949
  _: {
1950
- fieldName: "updatedAt";
1950
+ fieldName: "startedAt";
1951
1951
  };
1952
1952
  };
1953
1953
  completedAt: ConvexNumberBuilderInitial<""> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitcn",
3
- "version": "0.27.4",
3
+ "version": "0.27.5",
4
4
  "description": "kitcn - React Query integration and CLI tools for Convex",
5
5
  "keywords": [
6
6
  "convex",