kitcn 0.32.0 → 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,37 @@
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
+
15
+ ## 0.32.1
16
+
17
+ ### Patch Changes
18
+
19
+ - [#427](https://github.com/udecode/kitcn/pull/427) [`92381f5`](https://github.com/udecode/kitcn/commit/92381f56a660dfcd4679674f612e64c1518bcf75) Thanks [@MikeyZhang75](https://github.com/MikeyZhang75)! - ## Patches
20
+
21
+ - Improve the read cost of filtering parents by whether a related child exists.
22
+ `where: { posts: { type: 'wanted' } }` now stops at the first matching child
23
+ instead of loading the whole per-parent child window and testing it afterwards.
24
+ On one parent with 61 posts and a match sorting first, that is 2 document reads
25
+ instead of 62 — the same cost as the hand-written
26
+ `with: { posts: { where: { type: 'wanted' }, limit: 1 } }`. The same applies to
27
+ `where: { posts: true }`, to a relation existence test under `NOT`, and to
28
+ `through` relations, where it also stops at the first matching junction row.
29
+ Results are unchanged: the filter still decides from the same window it read
30
+ before, so a match past `defaultLimit` is excluded exactly as it was.
31
+ - A relation named more than once in one `where` — across `OR`, `AND` and `NOT`
32
+ branches — keeps the previous single unbounded load, because those branches
33
+ share it and each needs to read it in full.
34
+
3
35
  ## 0.32.0
4
36
 
5
37
  ### Minor Changes
@@ -1,5 +1,5 @@
1
- import { Vn as ConvexTextBuilderInitial, Zt as ConvexTableWithColumns } from "../capabilities-CD-Ij91k.js";
2
- import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-FDJTqLDC.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;
@@ -3014,7 +3028,21 @@ declare class GelRelationalQuery<TSchema extends TablesRelationalConfig, TTableC
3014
3028
  private _buildFieldFilterExpression;
3015
3029
  private _buildFilterExpression;
3016
3030
  private _mergeWithConfig;
3031
+ /**
3032
+ * Relation keys the filter tree mentions exactly once, across every OR/AND/NOT
3033
+ * branch at this table level.
3034
+ *
3035
+ * `_mergeWithConfig` collapses the whole tree into one load per relation key,
3036
+ * so a key two branches disagree about has to be loaded the way both branches
3037
+ * can read. Only a key with a single occurrence has one predicate to satisfy,
3038
+ * and only then can that predicate be pushed into the read plan.
3039
+ *
3040
+ * Relation values are not descended into: they belong to the target table and
3041
+ * get their own count when that level is lowered.
3042
+ */
3043
+ private _collectSingleOccurrenceRelations;
3017
3044
  private _buildFilterWithConfig;
3045
+ private _buildFilterWithConfigForLevel;
3018
3046
  private _stripFilterRelations;
3019
3047
  private _hasSearchDisallowedRelationFilter;
3020
3048
  private _searchFilterValuesEqual;
@@ -3205,7 +3233,39 @@ declare class GelRelationalQuery<TSchema extends TablesRelationalConfig, TTableC
3205
3233
  * Helper for recursive relation loading
3206
3234
  */
3207
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;
3208
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;
3209
3269
  private _getRelationConcurrency;
3210
3270
  private _getRelationFanOutKeyCap;
3211
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-CD-Ij91k.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-CD-Ij91k.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-FDJTqLDC.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";