kitcn 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -937,58 +937,6 @@ function text(name) {
937
937
  return new ConvexTextBuilder(name ?? "");
938
938
  }
939
939
 
940
- //#endregion
941
- //#region src/orm/extensions.ts
942
- function defineChainMethod(target, key, value) {
943
- Object.defineProperty(target, key, {
944
- value,
945
- enumerable: false,
946
- configurable: true
947
- });
948
- }
949
- function createSchemaExtensionChain(state, capabilities) {
950
- const extension = {
951
- key: state.key,
952
- tables: state.tables
953
- };
954
- Object.defineProperty(extension, OrmSchemaExtensionRelations, {
955
- value: state.relations,
956
- enumerable: false,
957
- configurable: true
958
- });
959
- Object.defineProperty(extension, OrmSchemaExtensionTriggers, {
960
- value: state.triggers,
961
- enumerable: false,
962
- configurable: true
963
- });
964
- if (capabilities.canRelations) defineChainMethod(extension, "relations", (relations) => createSchemaExtensionChain({
965
- ...state,
966
- relations
967
- }, {
968
- canRelations: false,
969
- canTriggers: true
970
- }));
971
- if (capabilities.canTriggers) defineChainMethod(extension, "triggers", (triggers) => createSchemaExtensionChain({
972
- ...state,
973
- triggers
974
- }, {
975
- canRelations: false,
976
- canTriggers: false
977
- }));
978
- return extension;
979
- }
980
- function defineSchemaExtension(key, tables) {
981
- return createSchemaExtensionChain({
982
- key,
983
- tables,
984
- relations: void 0,
985
- triggers: void 0
986
- }, {
987
- canRelations: true,
988
- canTriggers: true
989
- });
990
- }
991
-
992
940
  //#endregion
993
941
  //#region src/orm/indexes.ts
994
942
  var ConvexIndexBuilderOn = class {
@@ -1961,14 +1909,98 @@ const convexTableWithRLS = (name, columns, extraConfig) => {
1961
1909
  };
1962
1910
  const convexTable = Object.assign(convexTableInternal, { withRLS: convexTableWithRLS });
1963
1911
 
1912
+ //#endregion
1913
+ //#region src/aggregate-core/schema.ts
1914
+ const AGGREGATE_TREE_TABLE = "aggregate_rank_tree";
1915
+ const AGGREGATE_NODE_TABLE = "aggregate_rank_node";
1916
+ const aggregateCounterValidator = v.object({
1917
+ count: v.number(),
1918
+ sum: v.number()
1919
+ });
1920
+ const aggregateItemValidator = v.object({
1921
+ k: v.any(),
1922
+ v: v.any(),
1923
+ s: v.number()
1924
+ });
1925
+ const aggregateTreeTable = convexTable(AGGREGATE_TREE_TABLE, {
1926
+ aggregateName: text().notNull(),
1927
+ deletionStack: custom(v.array(v.id(AGGREGATE_NODE_TABLE))),
1928
+ maxNodeSize: integer().notNull(),
1929
+ namespace: custom(v.any()),
1930
+ root: id(AGGREGATE_NODE_TABLE).notNull()
1931
+ }, (tree) => [index("by_namespace").on(tree.namespace), index("by_aggregate_name").on(tree.aggregateName)]);
1932
+ const aggregateNodeTable = convexTable(AGGREGATE_NODE_TABLE, {
1933
+ aggregate: custom(aggregateCounterValidator),
1934
+ items: custom(v.array(aggregateItemValidator)).notNull(),
1935
+ subtrees: custom(v.array(v.string())).notNull()
1936
+ });
1937
+ const aggregateStorageTables$1 = {
1938
+ [AGGREGATE_NODE_TABLE]: aggregateNodeTable,
1939
+ [AGGREGATE_TREE_TABLE]: aggregateTreeTable
1940
+ };
1941
+
1942
+ //#endregion
1943
+ //#region src/orm/extensions.ts
1944
+ function defineChainMethod(target, key, value) {
1945
+ Object.defineProperty(target, key, {
1946
+ value,
1947
+ enumerable: false,
1948
+ configurable: true
1949
+ });
1950
+ }
1951
+ function createSchemaExtensionChain(state, capabilities) {
1952
+ const extension = {
1953
+ key: state.key,
1954
+ tables: state.tables
1955
+ };
1956
+ Object.defineProperty(extension, OrmSchemaExtensionRelations, {
1957
+ value: state.relations,
1958
+ enumerable: false,
1959
+ configurable: true
1960
+ });
1961
+ Object.defineProperty(extension, OrmSchemaExtensionTriggers, {
1962
+ value: state.triggers,
1963
+ enumerable: false,
1964
+ configurable: true
1965
+ });
1966
+ if (capabilities.canRelations) defineChainMethod(extension, "relations", (relations) => createSchemaExtensionChain({
1967
+ ...state,
1968
+ relations
1969
+ }, {
1970
+ canRelations: false,
1971
+ canTriggers: true
1972
+ }));
1973
+ if (capabilities.canTriggers) defineChainMethod(extension, "triggers", (triggers) => createSchemaExtensionChain({
1974
+ ...state,
1975
+ triggers
1976
+ }, {
1977
+ canRelations: false,
1978
+ canTriggers: false
1979
+ }));
1980
+ return extension;
1981
+ }
1982
+ function defineSchemaExtension(key, tables) {
1983
+ return createSchemaExtensionChain({
1984
+ key,
1985
+ tables,
1986
+ relations: void 0,
1987
+ triggers: void 0
1988
+ }, {
1989
+ canRelations: true,
1990
+ canTriggers: true
1991
+ });
1992
+ }
1993
+
1964
1994
  //#endregion
1965
1995
  //#region src/orm/aggregate-index/schema.ts
1966
1996
  const AGGREGATE_BUCKET_TABLE = "aggregate_bucket";
1967
1997
  const AGGREGATE_MEMBER_TABLE = "aggregate_member";
1968
1998
  const AGGREGATE_EXTREMA_TABLE = "aggregate_extrema";
1969
- const AGGREGATE_RANK_TREE_TABLE = "aggregate_rank_tree";
1970
- const AGGREGATE_RANK_NODE_TABLE = "aggregate_rank_node";
1971
1999
  const AGGREGATE_STATE_TABLE = "aggregate_state";
2000
+ const AGGREGATE_RANK_TREE_TABLE = AGGREGATE_TREE_TABLE;
2001
+ const AGGREGATE_RANK_NODE_TABLE = AGGREGATE_NODE_TABLE;
2002
+ const rankTreeTable = aggregateTreeTable;
2003
+ const rankNodeTable = aggregateNodeTable;
1972
2004
  const countBucketTable = convexTable(AGGREGATE_BUCKET_TABLE, {
1973
2005
  tableKey: text().notNull(),
1974
2006
  indexName: text().notNull(),
@@ -2027,24 +2059,6 @@ const countStateTable = convexTable(AGGREGATE_STATE_TABLE, {
2027
2059
  index("by_kind_status").on(t.kind, t.status),
2028
2060
  index("by_table_status").on(t.tableKey, t.status)
2029
2061
  ]);
2030
- const rankTreeTable = convexTable(AGGREGATE_RANK_TREE_TABLE, {
2031
- aggregateName: text().notNull(),
2032
- maxNodeSize: integer().notNull(),
2033
- namespace: json(),
2034
- root: id(AGGREGATE_RANK_NODE_TABLE).notNull()
2035
- }, (tree) => [index("by_namespace").on(tree.namespace), index("by_aggregate_name").on(tree.aggregateName)]);
2036
- const rankNodeTable = convexTable(AGGREGATE_RANK_NODE_TABLE, {
2037
- aggregate: objectOf({
2038
- count: integer().notNull(),
2039
- sum: integer().notNull()
2040
- }),
2041
- items: arrayOf(objectOf({
2042
- k: json(),
2043
- v: json(),
2044
- s: integer().notNull()
2045
- })).notNull(),
2046
- subtrees: arrayOf(text().notNull()).notNull()
2047
- });
2048
2062
  const aggregateStorageTables = {
2049
2063
  [AGGREGATE_BUCKET_TABLE]: countBucketTable,
2050
2064
  [AGGREGATE_MEMBER_TABLE]: countMemberTable,
@@ -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-DPB-JKlm.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-CD-Ij91k.js";
2
2
 
3
3
  //#region src/orm/aggregate-index/capability.d.ts
4
4
  /**
@@ -1,7 +1,7 @@
1
- import { t as DirectAggregate } from "../../runtime-BcvcfaP8.js";
1
+ import { t as DirectAggregate } from "../../runtime-B-8HKSIE.js";
2
2
  import { n as Columns } from "../../symbols-DDNAddkd.js";
3
- import { d as INTERNAL_CREATION_TIME_FIELD, f as PUBLIC_CREATED_AT_FIELD, m as usesSystemCreatedAtAlias } from "../../index-utils-C1DyktHe.js";
4
- import { Q as normalizeTemporalComparableValue, a as AGGREGATE_STATE_TABLE, c as getAggregateIndexDefinitions, d as COUNT_ERROR, ht as mapWithConcurrency, i as AGGREGATE_RANK_TREE_TABLE, l as getRankIndexDefinitions, m as createError, n as AGGREGATE_EXTREMA_TABLE, r as AGGREGATE_MEMBER_TABLE, s as rankAggregateName, t as AGGREGATE_BUCKET_TABLE, u as AGGREGATE_ERROR } from "../../schema-hL2FWCE7.js";
3
+ import { d as INTERNAL_CREATION_TIME_FIELD, f as PUBLIC_CREATED_AT_FIELD, m as usesSystemCreatedAtAlias } from "../../index-utils-DvK7P6Q1.js";
4
+ import { Q as normalizeTemporalComparableValue, a as AGGREGATE_STATE_TABLE, c as getAggregateIndexDefinitions, d as COUNT_ERROR, ht as mapWithConcurrency, i as AGGREGATE_RANK_TREE_TABLE, l as getRankIndexDefinitions, m as createError, n as AGGREGATE_EXTREMA_TABLE, r as AGGREGATE_MEMBER_TABLE, s as rankAggregateName, t as AGGREGATE_BUCKET_TABLE, u as AGGREGATE_ERROR } from "../../schema-Bh7AmJwY.js";
5
5
 
6
6
  //#region src/orm/transaction-cache.ts
7
7
  /**
@@ -1411,23 +1411,21 @@ const setCountStateError = async (db, tableName, indexName, error, kind = AGGREG
1411
1411
  * reports whether anything is left. Callers drive it to completion across
1412
1412
  * transactions, so clearing a large index never has to fit in one mutation.
1413
1413
  *
1414
- * Members are removed through the normal delta machinery rather than raw
1415
- * deletes, so buckets and extrema stay consistent with the members that remain
1416
- * at every intermediate step. That keeps concurrent writers correct while the
1417
- * clear drains. Residual bucket/extrema rows (drift with no member behind them)
1418
- * are swept only once no members are left, and the loop re-checks members
1419
- * afterwards.
1414
+ * Member rows are deleted outright rather than run back through the delta
1415
+ * machinery. The bucket and extrema branches below drop every row this index
1416
+ * owns whatever it holds, so folding a removal delta into a bucket first would
1417
+ * only rewrite a document this same clear is about to delete.
1418
+ *
1419
+ * Branch order is load-bearing: buckets and extrema are swept only once no
1420
+ * members are left, and the loop re-checks members afterwards. The intermediate
1421
+ * "members gone, buckets still populated" state is safe because `setCountState`
1422
+ * refuses to leave CLEARING while a bucket or extrema row survives, and the
1423
+ * CLEARING write barrier keeps concurrent writers out of the index.
1420
1424
  */
1421
1425
  const clearCountIndexChunk = async (db, tableName, indexName, batchSize) => {
1422
1426
  const members = await takeMembersForIndex(db, tableName, indexName, batchSize);
1423
1427
  if (members.length > 0) {
1424
- await flushAggregateMembershipDeltas(db, tableName, indexName, members.map((member) => computeMembershipDelta(member, {
1425
- tableName,
1426
- indexName,
1427
- docId: member.docId,
1428
- keyParts: null,
1429
- metricValues: null
1430
- })));
1428
+ for (const member of members) await db.delete(AGGREGATE_MEMBER_TABLE, member._id);
1431
1429
  return {
1432
1430
  done: false,
1433
1431
  processed: members.length
@@ -1593,36 +1591,35 @@ const rankCtx = (db) => ({
1593
1591
  db,
1594
1592
  orm: void 0
1595
1593
  });
1596
- /** Trees dropped per invocation once every rank member has been removed. */
1597
- const RANK_TREE_DROP_BATCH = 16;
1598
1594
  /**
1599
- * Removes at most `batchSize` rank members and reports whether anything is
1600
- * left. Each member is removed from the btree before its row is dropped, so the
1601
- * tree stays consistent with the members that remain and a partially drained
1602
- * clear can safely resume in a later mutation.
1595
+ * Removes at most `batchSize` documents of a rank index's stored state and
1596
+ * reports whether anything is left. Callers drive it to completion across
1597
+ * transactions, so clearing a large index never has to fit in one mutation.
1598
+ *
1599
+ * Member rows are dropped without touching the btree. The tree branch below
1600
+ * deletes every node whatever it contains, so removing a member key first would
1601
+ * only buy a root-to-leaf descent plus an aggregate patch per level on nodes
1602
+ * this same clear is about to delete.
1603
+ *
1604
+ * Branch order is load-bearing: a member delete recreates the tree it lands on,
1605
+ * so the members must be gone before the first node is dropped. The
1606
+ * intermediate "members gone, tree still full" state is safe because
1607
+ * `setCountState` refuses to leave CLEARING while a tree row survives, and the
1608
+ * CLEARING write barrier keeps concurrent writers out of the index.
1603
1609
  */
1604
1610
  const clearRankIndexChunk = async (db, tableName, indexName, batchSize) => {
1605
- const aggregate = rankAggregate(tableName, indexName);
1606
- const ctx = rankCtx(db);
1607
1611
  const members = await takeRankMembers(db, tableName, indexName, batchSize);
1608
1612
  if (members.length > 0) {
1609
- for (const member of members) {
1610
- if (member.rankKey !== void 0) await aggregate.deleteIfExists(ctx, {
1611
- id: member.docId,
1612
- key: member.rankKey,
1613
- namespace: member.rankNamespace
1614
- });
1615
- await db.delete(AGGREGATE_MEMBER_TABLE, member._id);
1616
- }
1613
+ for (const member of members) await db.delete(AGGREGATE_MEMBER_TABLE, member._id);
1617
1614
  return {
1618
1615
  done: false,
1619
1616
  processed: members.length
1620
1617
  };
1621
1618
  }
1622
- const done = await aggregate.deleteTrees(ctx, RANK_TREE_DROP_BATCH);
1619
+ const { documents, done } = await rankAggregate(tableName, indexName).deleteTrees(rankCtx(db), batchSize);
1623
1620
  return {
1624
1621
  done,
1625
- processed: done ? 0 : RANK_TREE_DROP_BATCH
1622
+ processed: documents
1626
1623
  };
1627
1624
  };
1628
1625
  const reconcileRankMembership = async (db, params) => {
@@ -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-DPB-JKlm.js";
2
- import { $ as OrmClientWithApi$1, A as ConvexDateMode, B as ConvexBytesBuilderInitial, C as ConvexNumberBuilderInitial, D as id, E as ConvexIdBuilderInitial, F as custom, G as ConvexBigIntBuilder, H as ConvexBooleanBuilder, I as json, J as CreateOrmOptions, K as ConvexBigIntBuilderInitial, L as objectOf, M as ConvexCustomBuilder, N as ConvexCustomBuilderInitial, O as ConvexDateBuilder, P as arrayOf, Q as OrmClientBase$1, R as unionOf, S as ConvexNumberBuilder, St as defineTriggers, T as ConvexIdBuilder, U as ConvexBooleanBuilderInitial, V as bytes, W as boolean, X as GenericOrmCtx$1, Y as GenericOrm$1, Z as OrmApiResult, _ as ConvexTimestampMode, _t as OrmBeforeResult, a as requireSchemaRelations, at as ScheduledMutationBatchArgs, b as ConvexTextEnumBuilderInitial, bt as OrmTriggerContext, c as TableConfigResult, ct as scheduledDeleteFactory, d as OrmNotFoundError, et as OrmFunctions, f as ConvexVectorBuilder, g as ConvexTimestampBuilderInitial, gt as defineSchemaExtension, h as ConvexTimestampBuilder, ht as SchemaExtension, i as getSchemaTriggers, it as createOrm, j as date, k as ConvexDateBuilderInitial, l as getTableColumns, m as vector, n as defineSchema, nt as OrmWriterCtx, o as asc, ot as scheduledMutationBatchFactory, p as ConvexVectorBuilderInitial, q as bigint, r as getSchemaRelations, rt as ResolveOrmSchema, s as desc, st as ScheduledDeleteArgs, t as WhereClauseResult, tt as OrmReaderCtx, u as getTableConfig, v as timestamp, vt as OrmTableTriggers, w as integer, x as textEnum, xt as OrmTriggers, y as ConvexTextEnumBuilder, yt as OrmTriggerChange, z as ConvexBytesBuilder } from "../where-clause-compiler-Dddhscyy.js";
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";
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";