kitcn 0.27.3 → 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 +48 -0
- package/dist/aggregate/index.d.ts +2 -2
- package/dist/auth/generated/index.d.ts +1 -1
- package/dist/auth/index.d.ts +18 -18
- package/dist/{capabilities-CLCYgRdY.d.ts → capabilities-DkfnnNp7.d.ts} +18 -0
- package/dist/cli.mjs +208 -67
- package/dist/{generated-contract-disabled-D4mw0d-V.d.ts → generated-contract-disabled-BEc4d98x.d.ts} +13 -13
- package/dist/orm/aggregate-index/index.d.ts +1 -1
- package/dist/orm/aggregate-index/index.js +1 -1
- package/dist/orm/index.d.ts +2 -2
- package/dist/orm/index.js +61 -18
- package/dist/orm/migrations/index.d.ts +2 -2
- package/dist/{schema-C5WWEqsj.js → schema-D95Z3Kss.js} +34 -1
- package/dist/{where-clause-compiler-DAPEBp1y.d.ts → where-clause-compiler-DuC8Nr7e.d.ts} +110 -110
- package/package.json +2 -2
- package/skills/kitcn/references/setup/index.md +6 -0
package/dist/{generated-contract-disabled-D4mw0d-V.d.ts → generated-contract-disabled-BEc4d98x.d.ts}
RENAMED
|
@@ -183,8 +183,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
183
183
|
deleteMany: convex_server0.RegisteredMutation<"internal", {
|
|
184
184
|
input: {
|
|
185
185
|
where?: {
|
|
186
|
-
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
187
186
|
connector?: "AND" | "OR" | undefined;
|
|
187
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
188
188
|
value: string | number | boolean | string[] | number[] | null;
|
|
189
189
|
field: string;
|
|
190
190
|
}[] | undefined;
|
|
@@ -212,8 +212,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
212
212
|
deleteOne: convex_server0.RegisteredMutation<"internal", {
|
|
213
213
|
input: {
|
|
214
214
|
where?: {
|
|
215
|
-
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
216
215
|
connector?: "AND" | "OR" | undefined;
|
|
216
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
217
217
|
value: string | number | boolean | string[] | number[] | null;
|
|
218
218
|
field: string;
|
|
219
219
|
}[] | undefined;
|
|
@@ -225,19 +225,20 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
225
225
|
}, Promise<Record<string, unknown> | undefined>>;
|
|
226
226
|
findMany: convex_server0.RegisteredQuery<"internal", {
|
|
227
227
|
join?: any;
|
|
228
|
-
limit?: number | undefined;
|
|
229
|
-
offset?: number | undefined;
|
|
230
|
-
sortBy?: {
|
|
231
|
-
direction: "asc" | "desc";
|
|
232
|
-
field: string;
|
|
233
|
-
} | undefined;
|
|
234
228
|
where?: {
|
|
235
229
|
mode?: "sensitive" | "insensitive" | undefined;
|
|
236
|
-
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
237
230
|
connector?: "AND" | "OR" | undefined;
|
|
231
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
238
232
|
value: string | number | boolean | string[] | number[] | null;
|
|
239
233
|
field: string;
|
|
240
234
|
}[] | undefined;
|
|
235
|
+
limit?: number | undefined;
|
|
236
|
+
offset?: number | undefined;
|
|
237
|
+
sortBy?: {
|
|
238
|
+
field: string;
|
|
239
|
+
direction: "asc" | "desc";
|
|
240
|
+
} | undefined;
|
|
241
|
+
model: string;
|
|
241
242
|
paginationOpts: {
|
|
242
243
|
id?: number;
|
|
243
244
|
endCursor?: string | null;
|
|
@@ -246,15 +247,14 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
246
247
|
numItems: number;
|
|
247
248
|
cursor: string | null;
|
|
248
249
|
};
|
|
249
|
-
model: string;
|
|
250
250
|
}, Promise<PaginationResult<convex_server0.GenericDocument>>>;
|
|
251
251
|
findOne: convex_server0.RegisteredQuery<"internal", {
|
|
252
252
|
join?: any;
|
|
253
253
|
select?: string[] | undefined;
|
|
254
254
|
where?: {
|
|
255
255
|
mode?: "sensitive" | "insensitive" | undefined;
|
|
256
|
-
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
257
256
|
connector?: "AND" | "OR" | undefined;
|
|
257
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
258
258
|
value: string | number | boolean | string[] | number[] | null;
|
|
259
259
|
field: string;
|
|
260
260
|
}[] | undefined;
|
|
@@ -265,8 +265,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
265
265
|
updateMany: convex_server0.RegisteredMutation<"internal", {
|
|
266
266
|
input: {
|
|
267
267
|
where?: {
|
|
268
|
-
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
269
268
|
connector?: "AND" | "OR" | undefined;
|
|
269
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
270
270
|
value: string | number | boolean | string[] | number[] | null;
|
|
271
271
|
field: string;
|
|
272
272
|
}[] | undefined;
|
|
@@ -300,8 +300,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
300
300
|
updateOne: convex_server0.RegisteredMutation<"internal", {
|
|
301
301
|
input: {
|
|
302
302
|
where?: {
|
|
303
|
-
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
304
303
|
connector?: "AND" | "OR" | undefined;
|
|
304
|
+
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
305
305
|
value: string | number | boolean | string[] | number[] | null;
|
|
306
306
|
field: string;
|
|
307
307
|
}[] | undefined;
|
|
@@ -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-
|
|
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 {
|
|
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";
|
package/dist/orm/index.d.ts
CHANGED
|
@@ -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-
|
|
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-
|
|
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
|
|
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
|
-
|
|
5122
|
-
|
|
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 =
|
|
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) :
|
|
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 =
|
|
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 ?
|
|
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-
|
|
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-
|
|
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,
|
|
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 };
|