kitcn 0.28.1 → 0.30.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.
- package/CHANGELOG.md +66 -0
- package/dist/aggregate/index.d.ts +2 -2
- package/dist/auth/generated/index.d.ts +1 -1
- package/dist/auth/index.d.ts +7 -7
- package/dist/{capabilities-BAiI8avr.d.ts → capabilities-6PZBmvc8.d.ts} +17 -3
- package/dist/cli.mjs +1 -1
- package/dist/{definitions-Dzk8mSTL.js → definitions-DS8ZDc74.js} +5 -1
- package/dist/{generated-contract-disabled-BBCcpNyF.d.ts → generated-contract-disabled-CgYQZCw2.d.ts} +8 -8
- package/dist/{local-env-Z8jj6ecD.mjs → local-env-Dk8RJvt5.mjs} +11 -5
- 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 +42 -10
- package/dist/orm/migrations/index.d.ts +3 -3
- package/dist/orm/migrations/index.js +25 -8
- package/dist/{schema-CzdjX7nx.js → schema-D8ZZMSKd.js} +11 -4
- package/dist/watcher.mjs +1 -1
- package/dist/{where-clause-compiler-DdAw9rNV.d.ts → where-clause-compiler-DvYSTJXe.d.ts} +28 -24
- package/package.json +1 -1
- package/skills/kitcn/references/features/aggregates.md +1 -1
- package/skills/kitcn/references/features/migrations.md +17 -0
- package/skills/kitcn/references/features/orm.md +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
1
|
# kitcn
|
|
2
2
|
|
|
3
|
+
## 0.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#422](https://github.com/udecode/kitcn/pull/422) [`f677251`](https://github.com/udecode/kitcn/commit/f6772514d2525104ac6878c0eeb7334a84af981b) Thanks [@MikeyZhang75](https://github.com/MikeyZhang75)! - ## Patches
|
|
8
|
+
|
|
9
|
+
- Fix soft cascade delete re-reading every child it had already processed. New scheduled campaigns require and resume through an exact foreign-key index, keeping reads linear without allowing mutable trailing index fields to strand a child. Queued jobs reselect a newly available exact index or drain through the legacy replay path.
|
|
10
|
+
|
|
11
|
+
## 0.29.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#421](https://github.com/udecode/kitcn/pull/421) [`26dd9b5`](https://github.com/udecode/kitcn/commit/26dd9b55357e4d49b7ada84812fefd52648f304a) Thanks [@MikeyZhang75](https://github.com/MikeyZhang75)! - ## Breaking changes
|
|
16
|
+
|
|
17
|
+
- Register `migrationStatus` and `aggregateBackfillStatus` as internal
|
|
18
|
+
**queries** instead of internal mutations. Polling migration or aggregate
|
|
19
|
+
status no longer opens a write transaction, so a status monitor stops
|
|
20
|
+
competing for OCC write slots on the very tables it is reporting on. Both can
|
|
21
|
+
now back a live subscription, and neither can be scheduled any more.
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
// Before — status read had to run from a mutation context
|
|
25
|
+
export const getStatus = authMutation.mutation(async ({ ctx }) => {
|
|
26
|
+
const server = createServerCaller(ctx);
|
|
27
|
+
return await server.migrationStatus({});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// After — status reads from a query context
|
|
31
|
+
export const getStatus = authQuery.query(async ({ ctx }) => {
|
|
32
|
+
const server = createServerCaller(ctx);
|
|
33
|
+
return await server.migrationStatus({});
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- Accept an `internalQuery` builder in `createOrm(...)` alongside
|
|
38
|
+
`internalMutation`. Apps generated by `kitcn codegen` pass it automatically;
|
|
39
|
+
hand-written `createOrm` calls that use `orm.api()` should pass it too so the
|
|
40
|
+
status procedures are built with the app's own Convex builder.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
// Before
|
|
44
|
+
const orm = createOrm({ schema, ormFunctions, internalMutation });
|
|
45
|
+
|
|
46
|
+
// After
|
|
47
|
+
const orm = createOrm({
|
|
48
|
+
schema,
|
|
49
|
+
ormFunctions,
|
|
50
|
+
internalMutation,
|
|
51
|
+
internalQuery,
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Patches
|
|
56
|
+
|
|
57
|
+
- Fix `migrationStatus` reading the entire `migration_run` history to return the
|
|
58
|
+
most recent runs. The listing now walks a new `by_started_at` index in reverse
|
|
59
|
+
and stops at `limit`, so the cost of a status call no longer grows with the
|
|
60
|
+
number of migrations ever run. Runs that share a `startedAt` millisecond now
|
|
61
|
+
order newest-first.
|
|
62
|
+
- Bound the `limit` argument of `migrationStatus` at `MAX_STATUS_RUN_LIMIT`
|
|
63
|
+
(`100`, default `25`), exported from `kitcn/orm/migrations`, so a caller
|
|
64
|
+
cannot reintroduce an unbounded read through the args.
|
|
65
|
+
- Resolve `migrationStatus`'s `runId` and `activeRun` through their existing
|
|
66
|
+
indexes instead of scanning the run history. `activeRun` now agrees with the
|
|
67
|
+
run that `migrate cancel` targets.
|
|
68
|
+
|
|
3
69
|
## 0.28.1
|
|
4
70
|
|
|
5
71
|
### Patch Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-
|
|
1
|
+
import { Vn as ConvexTextBuilderInitial, Zt as ConvexTableWithColumns } from "../capabilities-6PZBmvc8.js";
|
|
2
|
+
import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-DvYSTJXe.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 GenericAuthTriggers, S as GenericAuthTriggerHandlers, b as GenericAuthDefinition, i as getGeneratedAuthDisabledReason, n as GeneratedAuthDisabledReasonKind, r as createDisabledAuthRuntime, t as AuthRuntime, v as BetterAuthOptionsWithoutDatabase, w as defineAuth, x as GenericAuthTriggerChange, y as GenericAuthBeforeResult } from "../../generated-contract-disabled-
|
|
1
|
+
import { C as GenericAuthTriggers, S as GenericAuthTriggerHandlers, b as GenericAuthDefinition, i as getGeneratedAuthDisabledReason, n as GeneratedAuthDisabledReasonKind, r as createDisabledAuthRuntime, t as AuthRuntime, v as BetterAuthOptionsWithoutDatabase, w as defineAuth, x as GenericAuthTriggerChange, y as GenericAuthBeforeResult } from "../../generated-contract-disabled-CgYQZCw2.js";
|
|
2
2
|
export { type AuthRuntime, BetterAuthOptionsWithoutDatabase, type GeneratedAuthDisabledReasonKind, GenericAuthBeforeResult, GenericAuthDefinition, GenericAuthTriggerChange, GenericAuthTriggerHandlers, GenericAuthTriggers, createDisabledAuthRuntime, defineAuth, getGeneratedAuthDisabledReason };
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as QueryCtxWithPreferredOrmQueryTable, n as LookupByIdResultByCtx, t as DocByCtx } from "../query-context-DJONf8X5.js";
|
|
2
2
|
import { t as GetAuth } from "../types-Bf3XQex5.js";
|
|
3
3
|
import { t as GenericCtx } from "../context-utils-DwZ3Cam1.js";
|
|
4
|
-
import { C as GenericAuthTriggers, S as GenericAuthTriggerHandlers, _ as updateOneHandler, a as AuthFunctions, b as GenericAuthDefinition, c as consumeOneHandler, d as deleteManyHandler, f as deleteOneHandler, g as updateManyHandler, h as incrementOneHandler, i as getGeneratedAuthDisabledReason, l as createApi, m as findOneHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as findManyHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as createHandler, v as BetterAuthOptionsWithoutDatabase, w as defineAuth, x as GenericAuthTriggerChange, y as GenericAuthBeforeResult } from "../generated-contract-disabled-
|
|
4
|
+
import { C as GenericAuthTriggers, S as GenericAuthTriggerHandlers, _ as updateOneHandler, a as AuthFunctions, b as GenericAuthDefinition, c as consumeOneHandler, d as deleteManyHandler, f as deleteOneHandler, g as updateManyHandler, h as incrementOneHandler, i as getGeneratedAuthDisabledReason, l as createApi, m as findOneHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as findManyHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as createHandler, v as BetterAuthOptionsWithoutDatabase, w as defineAuth, x as GenericAuthTriggerChange, y as GenericAuthBeforeResult } from "../generated-contract-disabled-CgYQZCw2.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
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
115
114
|
field: string;
|
|
115
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
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" | "
|
|
122
|
+
}, "required", "mode" | "connector" | "field" | "operator" | "value">;
|
|
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
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
129
128
|
field: string;
|
|
129
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
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
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
156
155
|
field: string;
|
|
156
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
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
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
162
161
|
field: string;
|
|
162
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
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" | "
|
|
169
|
+
}, "required", "mode" | "connector" | "field" | "operator" | "value">, "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>;
|
|
@@ -3647,8 +3647,15 @@ declare function buildMigrationPlan<TSchema extends MigrationSchemaInput = Table
|
|
|
3647
3647
|
to?: string;
|
|
3648
3648
|
}): MigrationPlan<TSchema>;
|
|
3649
3649
|
declare namespace runtime_d_exports {
|
|
3650
|
-
export { MigrationCancelArgs, MigrationRunArgs, MigrationRunChunkArgs, MigrationStatusArgs, createMigrationHandlers };
|
|
3650
|
+
export { MAX_STATUS_RUN_LIMIT, MigrationCancelArgs, MigrationRunArgs, MigrationRunChunkArgs, MigrationStatusArgs, createMigrationHandlers };
|
|
3651
3651
|
}
|
|
3652
|
+
/**
|
|
3653
|
+
* Hard ceiling on how many `migration_run` rows one `status()` call may read.
|
|
3654
|
+
*
|
|
3655
|
+
* `limit` is caller-supplied, so bounding the query without bounding the
|
|
3656
|
+
* argument would just move the unbounded read behind the args surface.
|
|
3657
|
+
*/
|
|
3658
|
+
declare const MAX_STATUS_RUN_LIMIT = 100;
|
|
3652
3659
|
type MigrationRunArgs = {
|
|
3653
3660
|
direction?: MigrationDirection;
|
|
3654
3661
|
steps?: number;
|
|
@@ -3673,6 +3680,13 @@ type RuntimeCtx = {
|
|
|
3673
3680
|
db: GenericDatabaseWriter<any>;
|
|
3674
3681
|
scheduler?: Scheduler;
|
|
3675
3682
|
};
|
|
3683
|
+
/**
|
|
3684
|
+
* `status()` never writes, so it runs on a query ctx where `db` is a reader and
|
|
3685
|
+
* there is no scheduler.
|
|
3686
|
+
*/
|
|
3687
|
+
type RuntimeReadCtx = {
|
|
3688
|
+
db: GenericDatabaseReader<any> | GenericDatabaseWriter<any>;
|
|
3689
|
+
};
|
|
3676
3690
|
type CreateMigrationHandlersParams<TSchema extends TablesRelationalConfig> = {
|
|
3677
3691
|
schema: TSchema;
|
|
3678
3692
|
migrations?: MigrationSet<TSchema>;
|
|
@@ -3682,7 +3696,7 @@ type CreateMigrationHandlersParams<TSchema extends TablesRelationalConfig> = {
|
|
|
3682
3696
|
declare function createMigrationHandlers<TSchema extends TablesRelationalConfig>(params: CreateMigrationHandlersParams<TSchema>): {
|
|
3683
3697
|
run: (ctx: RuntimeCtx, args?: MigrationRunArgs) => Promise<Record<string, unknown>>;
|
|
3684
3698
|
chunk: (ctx: RuntimeCtx, args: MigrationRunChunkArgs) => Promise<Record<string, unknown>>;
|
|
3685
|
-
status: (ctx:
|
|
3699
|
+
status: (ctx: RuntimeReadCtx, args?: MigrationStatusArgs) => Promise<Record<string, unknown>>;
|
|
3686
3700
|
cancel: (ctx: RuntimeCtx, args?: MigrationCancelArgs) => Promise<Record<string, unknown>>;
|
|
3687
3701
|
};
|
|
3688
3702
|
//#endregion
|
|
@@ -3764,4 +3778,4 @@ type OrmCapabilities = {
|
|
|
3764
3778
|
migrations?: OrmMigrationCapability;
|
|
3765
3779
|
};
|
|
3766
3780
|
//#endregion
|
|
3767
|
-
export {
|
|
3781
|
+
export { RankIndexDefinition as $, TableName as $n, OrmLifecycleChange as $t, CreateDatabaseOptions as A, ConvexCheckBuilder as An, $Type as Ar, UpdateSet as At, getUniqueIndexes as B, ConvexTextBuilder as Bn, IsPrimaryKey as Br, RelationsBuilderColumnBase as Bt, MigrationStep as C, ConvexVectorIndexConfig as Cn, not as Cr, OrderByClause as Ct, defineMigration as D, searchIndex as Dn, startsWith as Dr, ReturningAll as Dt, buildMigrationPlan as E, rankIndex as En, or as Er, PredicateWhereIndexConfig as Et, CascadeMode as F, ConvexUniqueConstraintBuilderOn as Fn, ColumnBuilderTypeConfig as Fr, ExtractTablesFromSchema as Ft, CountBackfillChunkArgs as G, Columns as Gn, TablesRelationalConfig as Gt, RlsMode as H, text as Hn, NotNull as Hr, RelationsBuilderConfigValue as Ht, DeleteMode as I, ConvexUniqueConstraintConfig as In, ColumnBuilderWithTableName as Ir, ExtractTablesWithRelations as It, CountBackfillStatusArgs as J, OrmSchemaExtensionTables as Jn, ConvexDeletionBuilder as Jt, CountBackfillKickoffArgs as K, OrmRuntimeDefaults as Kn, defineRelations as Kt, SerializedFilterExpression as L, check as Ln, ColumnDataType as Lr, ManyConfig as Lt, DatabaseWithQuery as M, ConvexForeignKeyBuilder as Mn, ColumnBuilder as Mr, VectorSearchProvider as Mt, OrmReader as N, ConvexForeignKeyConfig as Nn, ColumnBuilderBaseConfig as Nr, unsetToken as Nt, defineMigrationSet as O, uniqueIndex as On, SystemFieldAliases as Or, ReturningResult as Ot, OrmWriter as P, ConvexUniqueConstraintBuilder as Pn, ColumnBuilderRuntimeConfig as Pr, AnyRelationsBuilderConfig as Pt, CountIndexDefinition as Q, OrmSchemaTriggers as Qn, DiscriminatorBuilderConfig as Qt, getChecks as R, foreignKey as Rn, DrizzleEntity as Rr, OneConfig as Rt, MigrationStateMap as S, ConvexVectorIndexBuilderOn as Sn, ne as Sr, MutationRunMode as St, MigrationWriteMode as T, index as Tn, notInArray as Tr, PaginatedResult as Tt, EdgeMetadata as U, ConvexColumnBuilder as Un, entityKind as Ur, RelationsConfigWithSchema as Ut, RlsContext as V, ConvexTextBuilderInitial as Vn, IsUnique as Vr, RelationsBuilderColumnConfig as Vt, extractRelationsConfig as W, Brand as Wn, TableRelationalConfig as Wt, CountQueryPlan as X, OrmSchemaExtensions as Xn, ConvexTable as Xt, AggregateQueryPlan as Y, OrmSchemaExtensionTriggers as Yn, ConvexDeletionConfig as Yt, AggregateIndexDefinition as Z, OrmSchemaRelations as Zn, ConvexTableWithColumns as Zt, MigrationManifestEntry as _, ConvexRankIndexBuilderOn as _n, isNotNull as _r, MutationExecutionMode as _t, MAX_STATUS_RUN_LIMIT as a, RlsPolicy as an, UnaryExpression as ar, BuildRelationResult as at, MigrationRunStatus as b, ConvexSearchIndexConfig as bn, lt as br, MutationResult as bt, MigrationRunChunkArgs as c, rlsPolicy as cn, contains as cr, DBQueryConfig as ct, MigrationAppliedState as d, rlsRole as dn, fieldRef as dr, InferInsertModel as dt, OrmLifecycleOperation as en, BinaryExpression as er, RankOrderField as et, MigrationDefinition as f, ConvexAggregateIndexBuilder as fn, gt as fr, InferModelFromColumns as ft, MigrationDriftIssue as g, ConvexRankIndexBuilder as gn, isFieldReference as gr, MutationExecuteResult as gt, MigrationDocContext as h, ConvexIndexBuilderOn as hn, inArray as hr, MutationExecuteConfig as ht, OrmMigrationCapability as i, discriminator as in, LogicalExpression as ir, BuildQueryResult as it, DatabaseWithMutations as j, ConvexCheckConfig as jn, AnyColumn as jr, VectorQueryConfig as jt, detectMigrationDrift as k, vectorIndex as kn, SystemFields as kr, ReturningSelection as kt, MigrationStatusArgs as l, RlsRole as ln, endsWith as lr, FilterOperators as lt, MigrationDoc as m, ConvexIndexBuilder as mn, ilike as mr, InsertValue as mt, OrmCapabilities as n, convexTable as nn, FieldReference as nr, AggregateFieldValue as nt, MigrationCancelArgs as o, RlsPolicyConfig as on, and as or, CountConfig as ot, MigrationDirection as p, ConvexAggregateIndexBuilderOn as pn, gte as pr, InferSelectModel as pt, CountBackfillMode as q, OrmSchemaExtensionRelations as qn, defineRelationsPart as qt, OrmCapability as r, deletion as rn, FilterExpression$1 as rr, AggregateResult as rt, MigrationRunArgs as s, RlsPolicyToOption as sn, between as sr, CountResult as st, OrmAggregateCapability as t, TableConfig as tn, ExpressionVisitor as tr, AggregateConfig as tt, createMigrationHandlers as u, RlsRoleConfig as un, eq as ur, GetColumnData as ut, MigrationMigrateOne as v, ConvexSearchIndexBuilder as vn, isNull as vr, MutationPaginateConfig as vt, MigrationTableName as w, aggregateIndex as wn, notBetween as wr, OrderDirection as wt, MigrationSet as x, ConvexVectorIndexBuilder as xn, lte as xr, MutationReturning as xt, MigrationPlan as y, ConvexSearchIndexBuilderOn as yn, like as yr, MutationPaginatedResult as yt, getForeignKeys as z, unique as zn, HasDefault as zr, RelationsBuilder as zt };
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as Columns, D as TableName, E as RlsPolicies, O as createSystemFields, S as getRankIndexes, T as OrmSchemaExtensions, _ as loadEsbuild, a as generateMeta, b as getAggregateIndexes, c as resolveSchemaDefaultExport, f as createProjectJiti, g as loadDotenv, h as loadClackPrompts, i as resolveConfiguredBackend, l as schemaDeclaresAggregateIndexes, m as loadBabelParser, n as withLocalCodegenEnv, o as getConvexConfig, p as CRPC_BUILDER_STUB_SOURCE, r as loadCliConfig, s as collectSchemaTables, t as getLocalBackendEnvVars, u as logger, v as highlighter, w as EnableRLS, x as getIndexes, y as isColorEnabled } from "./local-env-
|
|
2
|
+
import { C as Columns, D as TableName, E as RlsPolicies, O as createSystemFields, S as getRankIndexes, T as OrmSchemaExtensions, _ as loadEsbuild, a as generateMeta, b as getAggregateIndexes, c as resolveSchemaDefaultExport, f as createProjectJiti, g as loadDotenv, h as loadClackPrompts, i as resolveConfiguredBackend, l as schemaDeclaresAggregateIndexes, m as loadBabelParser, n as withLocalCodegenEnv, o as getConvexConfig, p as CRPC_BUILDER_STUB_SOURCE, r as loadCliConfig, s as collectSchemaTables, t as getLocalBackendEnvVars, u as logger, v as highlighter, w as EnableRLS, x as getIndexes, y as isColorEnabled } from "./local-env-Dk8RJvt5.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import fs, { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import path, { basename, delimiter, dirname, extname, isAbsolute, join, posix, relative, resolve } from "node:path";
|
|
@@ -64,7 +64,11 @@ const migrationRunTable = convexTable(MIGRATION_RUN_TABLE, {
|
|
|
64
64
|
completedAt: integer(),
|
|
65
65
|
cancelRequested: boolean().notNull(),
|
|
66
66
|
lastError: text()
|
|
67
|
-
}, (t) => [
|
|
67
|
+
}, (t) => [
|
|
68
|
+
index("by_run_id").on(t.runId),
|
|
69
|
+
index("by_status").on(t.status),
|
|
70
|
+
index("by_started_at").on(t.startedAt)
|
|
71
|
+
]);
|
|
68
72
|
const migrationStorageTables = {
|
|
69
73
|
[MIGRATION_STATE_TABLE]: migrationStateTable,
|
|
70
74
|
[MIGRATION_RUN_TABLE]: migrationRunTable
|
package/dist/{generated-contract-disabled-BBCcpNyF.d.ts → generated-contract-disabled-CgYQZCw2.d.ts}
RENAMED
|
@@ -183,8 +183,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
183
183
|
where?: {
|
|
184
184
|
connector?: "AND" | "OR" | undefined;
|
|
185
185
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
186
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
187
186
|
field: string;
|
|
187
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
188
188
|
}[] | undefined;
|
|
189
189
|
model: string;
|
|
190
190
|
} | {
|
|
@@ -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
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
215
214
|
field: string;
|
|
215
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
216
216
|
}[] | undefined;
|
|
217
217
|
model: string;
|
|
218
218
|
} | {
|
|
@@ -240,8 +240,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
240
240
|
where?: {
|
|
241
241
|
connector?: "AND" | "OR" | undefined;
|
|
242
242
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
243
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
244
243
|
field: string;
|
|
244
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
245
245
|
}[] | undefined;
|
|
246
246
|
model: string;
|
|
247
247
|
} | {
|
|
@@ -255,8 +255,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
255
255
|
mode?: "sensitive" | "insensitive" | undefined;
|
|
256
256
|
connector?: "AND" | "OR" | undefined;
|
|
257
257
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
258
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
259
258
|
field: string;
|
|
259
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
260
260
|
}[] | undefined;
|
|
261
261
|
limit?: number | undefined;
|
|
262
262
|
offset?: number | undefined;
|
|
@@ -280,8 +280,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
280
280
|
mode?: "sensitive" | "insensitive" | undefined;
|
|
281
281
|
connector?: "AND" | "OR" | undefined;
|
|
282
282
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
283
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
284
283
|
field: string;
|
|
284
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
285
285
|
}[] | undefined;
|
|
286
286
|
select?: string[] | undefined;
|
|
287
287
|
model: string;
|
|
@@ -293,8 +293,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
293
293
|
mode?: "sensitive" | "insensitive" | undefined;
|
|
294
294
|
connector?: "AND" | "OR" | undefined;
|
|
295
295
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
296
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
297
296
|
field: string;
|
|
297
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
298
298
|
}[] | undefined;
|
|
299
299
|
set?: Record<string, any> | undefined;
|
|
300
300
|
model: string;
|
|
@@ -307,8 +307,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
307
307
|
where?: {
|
|
308
308
|
connector?: "AND" | "OR" | undefined;
|
|
309
309
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
310
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
311
310
|
field: string;
|
|
311
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
312
312
|
}[] | undefined;
|
|
313
313
|
model: string;
|
|
314
314
|
update: {
|
|
@@ -342,8 +342,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
342
342
|
where?: {
|
|
343
343
|
connector?: "AND" | "OR" | undefined;
|
|
344
344
|
operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
345
|
-
value: string | number | boolean | string[] | number[] | null;
|
|
346
345
|
field: string;
|
|
346
|
+
value: string | number | boolean | string[] | number[] | null;
|
|
347
347
|
}[] | undefined;
|
|
348
348
|
model: string;
|
|
349
349
|
update: {
|
|
@@ -2089,7 +2089,11 @@ const migrationRunTable = convexTable(MIGRATION_RUN_TABLE, {
|
|
|
2089
2089
|
completedAt: integer(),
|
|
2090
2090
|
cancelRequested: boolean$1().notNull(),
|
|
2091
2091
|
lastError: text()
|
|
2092
|
-
}, (t) => [
|
|
2092
|
+
}, (t) => [
|
|
2093
|
+
index("by_run_id").on(t.runId),
|
|
2094
|
+
index("by_status").on(t.status),
|
|
2095
|
+
index("by_started_at").on(t.startedAt)
|
|
2096
|
+
]);
|
|
2093
2097
|
const migrationStorageTables = {
|
|
2094
2098
|
[MIGRATION_STATE_TABLE]: migrationStateTable,
|
|
2095
2099
|
[MIGRATION_RUN_TABLE]: migrationRunTable
|
|
@@ -2805,7 +2809,7 @@ const GENERATED_ORM_RUNTIME_PROCEDURES = [
|
|
|
2805
2809
|
{
|
|
2806
2810
|
exportName: "migrationStatus",
|
|
2807
2811
|
internal: true,
|
|
2808
|
-
type: "
|
|
2812
|
+
type: "query"
|
|
2809
2813
|
},
|
|
2810
2814
|
{
|
|
2811
2815
|
exportName: "migrationCancel",
|
|
@@ -2837,7 +2841,7 @@ const GENERATED_AGGREGATE_RUNTIME_PROCEDURES = [
|
|
|
2837
2841
|
{
|
|
2838
2842
|
exportName: "aggregateBackfillStatus",
|
|
2839
2843
|
internal: true,
|
|
2840
|
-
type: "
|
|
2844
|
+
type: "query"
|
|
2841
2845
|
}
|
|
2842
2846
|
];
|
|
2843
2847
|
function listFilesRecursive(cwd, relDir = "") {
|
|
@@ -3413,7 +3417,7 @@ import type {
|
|
|
3413
3417
|
MutationCtx as ServerMutationCtx,
|
|
3414
3418
|
QueryCtx as ServerQueryCtx,
|
|
3415
3419
|
} from ${serverTypesImportLiteral};
|
|
3416
|
-
import { httpAction, internalMutation } from ${serverTypesImportLiteral};
|
|
3420
|
+
import { httpAction, internalMutation, internalQuery } from ${serverTypesImportLiteral};
|
|
3417
3421
|
import schema from ${schemaImportLiteral};
|
|
3418
3422
|
import { procedureNames } from ${procedureNamesImportLiteral};
|
|
3419
3423
|
${migrationsImportLine}
|
|
@@ -3433,6 +3437,7 @@ export const orm = createOrm({
|
|
|
3433
3437
|
schema: ormSchema,
|
|
3434
3438
|
ormFunctions,
|
|
3435
3439
|
${capabilitiesConfigLine}${migrationsConfigLine} internalMutation,
|
|
3440
|
+
internalQuery,
|
|
3436
3441
|
});
|
|
3437
3442
|
|
|
3438
3443
|
export type OrmCtx<Ctx extends ServerQueryCtx | ServerMutationCtx = ServerQueryCtx> = GenericOrmCtx<Ctx, typeof ormSchema>;
|
|
@@ -3476,7 +3481,7 @@ function emitGeneratedAggregateFile(outputFile, functionsDir) {
|
|
|
3476
3481
|
import { createOrm, type OrmFunctions } from 'kitcn/orm';
|
|
3477
3482
|
import { aggregateCapability } from 'kitcn/orm/aggregate-index';
|
|
3478
3483
|
import { createGeneratedFunctionReference } from 'kitcn/server';
|
|
3479
|
-
import { internalMutation } from ${serverTypesImportLiteral};
|
|
3484
|
+
import { internalMutation, internalQuery } from ${serverTypesImportLiteral};
|
|
3480
3485
|
import schema from ${schemaImportLiteral};
|
|
3481
3486
|
|
|
3482
3487
|
const ormFunctions: OrmFunctions = {
|
|
@@ -3490,6 +3495,7 @@ const orm = createOrm({
|
|
|
3490
3495
|
ormFunctions,
|
|
3491
3496
|
capabilities: [aggregateCapability()],
|
|
3492
3497
|
internalMutation,
|
|
3498
|
+
internalQuery,
|
|
3493
3499
|
});
|
|
3494
3500
|
|
|
3495
3501
|
export const {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
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-6PZBmvc8.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 { Dt as
|
|
3
|
+
import { Dt as PUBLIC_CREATED_AT_FIELD, Et as INTERNAL_CREATION_TIME_FIELD, Ot as usesSystemCreatedAtAlias, 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-D8ZZMSKd.js";
|
|
4
4
|
|
|
5
5
|
//#region src/orm/transaction-cache.ts
|
|
6
6
|
/**
|
package/dist/orm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $n as
|
|
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 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-6PZBmvc8.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-DvYSTJXe.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
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { A as integer, C as index, D as vectorIndex, E as uniqueIndex, F as unionOf, I as ConvexColumnBuilder, L as entityKind, M as custom, N as json, O as text, P as objectOf, S as aggregateIndex, T as searchIndex, a as Columns, b as RlsPolicy, c as OrmSchemaDefinition, d as OrmSchemaExtensionTriggers, f as OrmSchemaExtensions, g as RlsPolicies, h as OrmSchemaTriggers, i as Brand, j as arrayOf, k as createSystemFields, l as OrmSchemaExtensionRelations, m as OrmSchemaRelations, n as deletion, o as EnableRLS, p as OrmSchemaOptions, r as discriminator, s as OrmContext, t as convexTable, u as OrmSchemaExtensionTables, v as TableName, w as rankIndex, x as rlsPolicy, y as TablePolymorphic } from "../table-CX2lnX7e.js";
|
|
2
|
-
import { d as boolean, i as detectMigrationDrift, l as migrationExtension, n as defineMigration, r as defineMigrationSet, t as buildMigrationPlan } from "../definitions-
|
|
2
|
+
import { d as boolean, i as detectMigrationDrift, l as migrationExtension, n as defineMigration, r as defineMigrationSet, t as buildMigrationPlan } from "../definitions-DS8ZDc74.js";
|
|
3
3
|
import { a as pretendRequired, i as pretend, n as deprecated } from "../validators-CIoUYCqO.js";
|
|
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 patchReferencingRows, A as enforcePolymorphicWrite, B as getForeignKeys, C as collectPrimaryIdLookupRows, Ct as
|
|
7
|
+
import { $ as patchReferencingRows, A as enforcePolymorphicWrite, B as getForeignKeys, C as collectPrimaryIdLookupRows, Ct as getRankIndexes, D as encodeUndefinedDeep, Dt as PUBLIC_CREATED_AT_FIELD, E as deserializeFilterExpression, Et as INTERNAL_CREATION_TIME_FIELD, F as evaluateCheckConstraintTriState, G as getTableColumns$2, H as getMutationCollectionLimits, I as evaluateFilter, J as getUniqueIndexes, K as getTableDeleteConfig, L as extractPrimaryIdLookup, M as ensureDefaultColumns, N as ensureNonNullValues, O as enforceCheckConstraints, Ot as usesSystemCreatedAtAlias, P as ensureNullableColumns, Q as normalizeTemporalComparableValue, R as getChecks, S as collectMutationRowsBounded, St as getIndexes, T as decodeUndefinedDeep, Tt as CREATED_AT_MIGRATION_MESSAGE, U as getMutationExecutionMode, V as getMutationAsyncDelayMs, W as getOrmContext, X as hydrateDateFieldsForRead, Y as hardDeleteRow, Z as normalizeDateFieldsForWrite, _ as applyDefaults, _t as findIndexForColumns, at as splitReturningSelection, b as buildForeignKeyGraph, bt as findVectorIndexByName, c as getAggregateIndexDefinitions, ct as toConvexFilter, d as COUNT_ERROR, dt as markLifecycleHookedTables, et as resolveOrmRuntimeDefaults, f as createAggregateError, ft as compileConvexFilter, g as ensureCountAllowedForRls, gt as findExactIndexForColumns, h as ensureAggregateAllowedForRls, ht as mapWithConcurrency, it as softDeleteRow, j as enforceUniqueIndexes, k as enforceForeignKeys, l as getRankIndexDefinitions, lt as unsetFieldsOf, mt as isConvexEnforceableFilter, nt as selectReturningRowWithHydration, o as aggregateExtension, ot as stripUnsetFields, p as createCountError, pt as convexAnd, q as getTableName, rt as serializeFilterExpression, st as takeRowsWithinByteBudget, tt as returningSelectionReadsCreationTime, u as AGGREGATE_ERROR, ut as hasLifecycleHooks, v as applyIncomingForeignKeyActionsOnDelete, vt as findRelationIndex, w as createForeignKeyProbeMemo, wt as resolveIndexOrderPushdown, x as canUsePrimaryIdLookupCursor, xt as getAggregateIndexes, y as applyIncomingForeignKeyActionsOnUpdate, yt as findSearchIndexByName, z as getColumnName$1 } from "../schema-D8ZZMSKd.js";
|
|
8
8
|
import { t as defineSchemaExtension } from "../extensions-Blzsyekm.js";
|
|
9
9
|
import { compareValues, convexToJson, jsonToConvex, v } from "convex/values";
|
|
10
|
-
import { defineSchema as defineSchema$1, internalActionGeneric, internalMutationGeneric } from "convex/server";
|
|
10
|
+
import { defineSchema as defineSchema$1, internalActionGeneric, internalMutationGeneric, internalQueryGeneric } from "convex/server";
|
|
11
11
|
|
|
12
12
|
//#region src/orm/builders/bigint.ts
|
|
13
13
|
/**
|
|
@@ -7360,6 +7360,7 @@ function scheduledDeleteFactory(schema, edgeMetadata, scheduledMutationBatch) {
|
|
|
7360
7360
|
//#region src/orm/scheduled-mutation-batch.ts
|
|
7361
7361
|
/** Column stamped by `softDeleteRow`; see mutation-utils.ts. */
|
|
7362
7362
|
const DELETION_TIME_FIELD = "deletionTime";
|
|
7363
|
+
const isPending = (row) => row[DELETION_TIME_FIELD] === void 0 || row[DELETION_TIME_FIELD] === null;
|
|
7363
7364
|
const isRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
7364
7365
|
function scheduledMutationBatchFactory(schema, edgeMetadata, scheduledMutationBatch) {
|
|
7365
7366
|
const tableByName = /* @__PURE__ */ new Map();
|
|
@@ -7424,23 +7425,30 @@ function scheduledMutationBatchFactory(schema, edgeMetadata, scheduledMutationBa
|
|
|
7424
7425
|
if (!targetValues || !Array.isArray(targetValues)) throw new Error("scheduledMutationBatch: targetValues are required for cascade work.");
|
|
7425
7426
|
if (!args.foreignIndexName) throw new Error("scheduledMutationBatch: foreignIndexName is required for cascade work.");
|
|
7426
7427
|
const action = args.foreignAction ?? "no action";
|
|
7427
|
-
const
|
|
7428
|
+
const isSoftCascade = workType === "cascade-delete" && action === "cascade" && (args.cascadeMode ?? "hard") === "soft";
|
|
7429
|
+
const exactIndexName = findExactIndexForColumns(getIndexes(table), sourceColumns);
|
|
7430
|
+
if (isSoftCascade && args.softCascadeCursorVersion === 1 && !exactIndexName) throw new Error(`scheduledMutationBatch: async soft cascade on '${args.table}' requires an exact foreign-key index on (${sourceColumns.join(", ")}).`);
|
|
7431
|
+
const effectiveIndexName = isSoftCascade && exactIndexName ? exactIndexName : args.foreignIndexName;
|
|
7432
|
+
const recoversQueuedJob = isSoftCascade && exactIndexName !== null && (args.softCascadeCursorVersion !== 1 || args.foreignIndexName !== exactIndexName);
|
|
7433
|
+
const pageStartCursor = isSoftCascade && exactIndexName ? recoversQueuedJob ? null : args.cursor : null;
|
|
7434
|
+
const replaysQueuedPrefixJob = isSoftCascade && !exactIndexName;
|
|
7428
7435
|
const queryWithIndex = () => {
|
|
7429
|
-
const indexed = ctx.db.query(args.table).withIndex(
|
|
7436
|
+
const indexed = ctx.db.query(args.table).withIndex(effectiveIndexName, (q) => {
|
|
7430
7437
|
let builder = q.eq(sourceColumns[0], targetValues[0]);
|
|
7431
7438
|
for (let i = 1; i < sourceColumns.length; i += 1) builder = builder.eq(sourceColumns[i], targetValues[i]);
|
|
7432
7439
|
return builder;
|
|
7433
7440
|
});
|
|
7434
|
-
if (!
|
|
7441
|
+
if (!replaysQueuedPrefixJob) return indexed;
|
|
7435
7442
|
return indexed.filter((q) => q.or(q.eq(q.field(DELETION_TIME_FIELD), void 0), q.eq(q.field(DELETION_TIME_FIELD), null)));
|
|
7436
7443
|
};
|
|
7437
7444
|
const paged = await queryWithIndex().paginate({
|
|
7438
|
-
cursor:
|
|
7445
|
+
cursor: pageStartCursor,
|
|
7439
7446
|
numItems: args.batchSize
|
|
7440
7447
|
});
|
|
7441
7448
|
const resolvedMaxBytesPerBatch = args.maxBytesPerBatch ?? maxBytesPerBatch;
|
|
7442
7449
|
const bounded = takeRowsWithinByteBudget(paged.page, resolvedMaxBytesPerBatch);
|
|
7443
|
-
const
|
|
7450
|
+
const consumedRows = bounded.rows;
|
|
7451
|
+
const rows = isSoftCascade ? consumedRows.filter(isPending) : consumedRows;
|
|
7444
7452
|
const hitByteLimit = bounded.hitLimit;
|
|
7445
7453
|
const scheduleState = {
|
|
7446
7454
|
remainingCalls: scheduleCallCap,
|
|
@@ -7498,6 +7506,29 @@ function scheduledMutationBatchFactory(schema, edgeMetadata, scheduledMutationBa
|
|
|
7498
7506
|
await patchReferencingRows(ctx.db, args.table, rows, patchValues);
|
|
7499
7507
|
}
|
|
7500
7508
|
}
|
|
7509
|
+
if (isSoftCascade && exactIndexName) {
|
|
7510
|
+
if (hitByteLimit) {
|
|
7511
|
+
await ctx.scheduler.runAfter(args.delayMs, scheduledMutationBatch, {
|
|
7512
|
+
...args,
|
|
7513
|
+
workType,
|
|
7514
|
+
foreignIndexName: exactIndexName,
|
|
7515
|
+
softCascadeCursorVersion: 1,
|
|
7516
|
+
cursor: pageStartCursor,
|
|
7517
|
+
batchSize: consumedRows.length,
|
|
7518
|
+
maxBytesPerBatch: resolvedMaxBytesPerBatch
|
|
7519
|
+
});
|
|
7520
|
+
return;
|
|
7521
|
+
}
|
|
7522
|
+
if (!paged.isDone && paged.continueCursor !== null) await ctx.scheduler.runAfter(args.delayMs, scheduledMutationBatch, {
|
|
7523
|
+
...args,
|
|
7524
|
+
workType,
|
|
7525
|
+
foreignIndexName: exactIndexName,
|
|
7526
|
+
softCascadeCursorVersion: 1,
|
|
7527
|
+
cursor: paged.continueCursor,
|
|
7528
|
+
maxBytesPerBatch: resolvedMaxBytesPerBatch
|
|
7529
|
+
});
|
|
7530
|
+
return;
|
|
7531
|
+
}
|
|
7501
7532
|
if (await queryWithIndex().first() !== null || hitByteLimit) await ctx.scheduler.runAfter(args.delayMs, scheduledMutationBatch, {
|
|
7502
7533
|
...args,
|
|
7503
7534
|
workType,
|
|
@@ -7861,6 +7892,7 @@ function createOrm(config) {
|
|
|
7861
7892
|
with: withContext
|
|
7862
7893
|
};
|
|
7863
7894
|
const mutationBuilder = config.internalMutation ?? internalMutationGeneric;
|
|
7895
|
+
const queryBuilder = config.internalQuery ?? internalQueryGeneric;
|
|
7864
7896
|
return {
|
|
7865
7897
|
db,
|
|
7866
7898
|
with: withContext,
|
|
@@ -7926,7 +7958,7 @@ function createOrm(config) {
|
|
|
7926
7958
|
handler: ((ctx, args) => countBackfillHandlers().kickoff(ctx, args))
|
|
7927
7959
|
}),
|
|
7928
7960
|
aggregateBackfillChunk,
|
|
7929
|
-
aggregateBackfillStatus:
|
|
7961
|
+
aggregateBackfillStatus: queryBuilder({
|
|
7930
7962
|
args: v.any(),
|
|
7931
7963
|
handler: ((ctx, args) => countBackfillHandlers().status(ctx, args))
|
|
7932
7964
|
}),
|
|
@@ -7935,7 +7967,7 @@ function createOrm(config) {
|
|
|
7935
7967
|
handler: ((ctx, args) => migrationHandlers().run(ctx, args))
|
|
7936
7968
|
}),
|
|
7937
7969
|
migrationRunChunk,
|
|
7938
|
-
migrationStatus:
|
|
7970
|
+
migrationStatus: queryBuilder({
|
|
7939
7971
|
args: v.any(),
|
|
7940
7972
|
handler: ((ctx, args) => migrationHandlers().status(ctx, args))
|
|
7941
7973
|
}),
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as
|
|
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-
|
|
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 };
|
|
1
|
+
import { C as MigrationStep, D as defineMigration, E as buildMigrationPlan, O as defineMigrationSet, S as MigrationStateMap, T as MigrationWriteMode, _ as MigrationManifestEntry, a as MAX_STATUS_RUN_LIMIT, b as MigrationRunStatus, c as MigrationRunChunkArgs, d as MigrationAppliedState, f as MigrationDefinition, g as MigrationDriftIssue, h as MigrationDocContext, k as detectMigrationDrift, l as MigrationStatusArgs, m as MigrationDoc, o as MigrationCancelArgs, p as MigrationDirection, s as MigrationRunArgs, u as createMigrationHandlers, v as MigrationMigrateOne, w as MigrationTableName, x as MigrationSet, y as MigrationPlan } from "../../capabilities-6PZBmvc8.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-DvYSTJXe.js";
|
|
3
|
+
export { MAX_STATUS_RUN_LIMIT, MIGRATION_RUN_TABLE, MIGRATION_STATE_TABLE, MIGRATION_STORAGE_TABLE_NAMES, type MigrationAppliedState, type MigrationCancelArgs, type MigrationDefinition, type MigrationDirection, type MigrationDoc, type MigrationDocContext, type MigrationDriftIssue, type MigrationManifestEntry, type MigrationMigrateOne, type MigrationPlan, type MigrationRunArgs, type MigrationRunChunkArgs, type MigrationRunStatus, type MigrationSet, type MigrationStateMap, type MigrationStatusArgs, type MigrationStep, type MigrationTableName, type MigrationWriteMode, buildMigrationPlan, createMigrationHandlers, defineMigration, defineMigrationSet, detectMigrationDrift, injectMigrationStorageTables, migrationCapability, migrationExtension, migrationStorageTables };
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import { a as MIGRATION_RUN_TABLE, c as injectMigrationStorageTables, i as detectMigrationDrift, l as migrationExtension, n as defineMigration, o as MIGRATION_STATE_TABLE, r as defineMigrationSet, s as MIGRATION_STORAGE_TABLE_NAMES, t as buildMigrationPlan, u as migrationStorageTables } from "../../definitions-
|
|
1
|
+
import { a as MIGRATION_RUN_TABLE, c as injectMigrationStorageTables, i as detectMigrationDrift, l as migrationExtension, n as defineMigration, o as MIGRATION_STATE_TABLE, r as defineMigrationSet, s as MIGRATION_STORAGE_TABLE_NAMES, t as buildMigrationPlan, u as migrationStorageTables } from "../../definitions-DS8ZDc74.js";
|
|
2
2
|
|
|
3
3
|
//#region src/orm/migrations/runtime.ts
|
|
4
4
|
const DEFAULT_BATCH_SIZE = 128;
|
|
5
|
+
const DEFAULT_STATUS_RUN_LIMIT = 25;
|
|
6
|
+
/**
|
|
7
|
+
* Hard ceiling on how many `migration_run` rows one `status()` call may read.
|
|
8
|
+
*
|
|
9
|
+
* `limit` is caller-supplied, so bounding the query without bounding the
|
|
10
|
+
* argument would just move the unbounded read behind the args surface.
|
|
11
|
+
*/
|
|
12
|
+
const MAX_STATUS_RUN_LIMIT = 100;
|
|
5
13
|
function createMigrationHandlers(params) {
|
|
6
14
|
const { schema, migrations, getOrm, getChunkRef } = params;
|
|
7
15
|
const knownTables = new Set(Object.values(schema).map((tableConfig) => tableConfig.name));
|
|
@@ -287,12 +295,11 @@ function createMigrationHandlers(params) {
|
|
|
287
295
|
status: "noop",
|
|
288
296
|
reason: "no_migrations_registered"
|
|
289
297
|
};
|
|
290
|
-
const limit = parseOptionalPositiveInteger(args.limit, "limit") ??
|
|
298
|
+
const limit = Math.min(parseOptionalPositiveInteger(args.limit, "limit") ?? DEFAULT_STATUS_RUN_LIMIT, MAX_STATUS_RUN_LIMIT);
|
|
291
299
|
const runId = parseOptionalString(args.runId, "runId");
|
|
292
300
|
const stateRows = await getAllStateRows(ctx.db);
|
|
293
|
-
const
|
|
294
|
-
const
|
|
295
|
-
const activeRun = sortedRuns.find((entry) => entry.status === "running") ?? null;
|
|
301
|
+
const selectedRuns = runId ? await getRunsById(ctx.db, runId) : await getRecentRuns(ctx.db, limit);
|
|
302
|
+
const activeRun = await getActiveRun(ctx.db);
|
|
296
303
|
const appliedState = toAppliedStateMap(stateRows);
|
|
297
304
|
const drift = detectMigrationDrift({
|
|
298
305
|
migrationSet: migrations,
|
|
@@ -405,11 +412,21 @@ function toAppliedStateMap(stateRows) {
|
|
|
405
412
|
};
|
|
406
413
|
return entries;
|
|
407
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* Bounded by the number of authored migrations, not by run history, and the
|
|
417
|
+
* full set is part of the `status()` payload (`migrations`, `pending`,
|
|
418
|
+
* `drift`), so this one stays a collect.
|
|
419
|
+
*/
|
|
408
420
|
async function getAllStateRows(db) {
|
|
409
421
|
return await db.query(MIGRATION_STATE_TABLE).collect();
|
|
410
422
|
}
|
|
411
|
-
|
|
412
|
-
|
|
423
|
+
/** Most recent `limit` runs, read straight off `by_started_at` in reverse. */
|
|
424
|
+
async function getRecentRuns(db, limit) {
|
|
425
|
+
return await db.query(MIGRATION_RUN_TABLE).withIndex("by_started_at").order("desc").take(limit);
|
|
426
|
+
}
|
|
427
|
+
async function getRunsById(db, runId) {
|
|
428
|
+
const row = await getRunById(db, runId);
|
|
429
|
+
return row ? [row] : [];
|
|
413
430
|
}
|
|
414
431
|
async function getRunById(db, runId) {
|
|
415
432
|
return await db.query(MIGRATION_RUN_TABLE).withIndex("by_run_id", (query) => query.eq("runId", runId)).first() ?? null;
|
|
@@ -503,4 +520,4 @@ const migrationCapability = () => ({
|
|
|
503
520
|
});
|
|
504
521
|
|
|
505
522
|
//#endregion
|
|
506
|
-
export { MIGRATION_RUN_TABLE, MIGRATION_STATE_TABLE, MIGRATION_STORAGE_TABLE_NAMES, buildMigrationPlan, createMigrationHandlers, defineMigration, defineMigrationSet, detectMigrationDrift, injectMigrationStorageTables, migrationCapability, migrationExtension, migrationStorageTables };
|
|
523
|
+
export { MAX_STATUS_RUN_LIMIT, MIGRATION_RUN_TABLE, MIGRATION_STATE_TABLE, MIGRATION_STORAGE_TABLE_NAMES, buildMigrationPlan, createMigrationHandlers, defineMigration, defineMigrationSet, detectMigrationDrift, injectMigrationStorageTables, migrationCapability, migrationExtension, migrationStorageTables };
|
|
@@ -47,6 +47,9 @@ function findIndexForColumns(indexes, columns) {
|
|
|
47
47
|
for (const index of indexes) if (hasColumnPrefix(index, columns)) return index.name;
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
|
+
function findExactIndexForColumns(indexes, columns) {
|
|
51
|
+
return indexes.find((candidate) => candidate.fields.length === columns.length && candidate.fields.every((field, position) => field === columns[position]))?.name ?? null;
|
|
52
|
+
}
|
|
50
53
|
const hasColumnPrefix = (index, columns) => {
|
|
51
54
|
if (index.fields.length < columns.length) return false;
|
|
52
55
|
for (let i = 0; i < columns.length; i += 1) if (index.fields[i] !== columns[i]) return false;
|
|
@@ -880,8 +883,9 @@ async function enforceForeignKeys(db, table, candidate, options) {
|
|
|
880
883
|
}).first()) throw new Error(`Foreign key violation on '${tableName}': missing document in '${foreignKey.foreignTableName}'.`);
|
|
881
884
|
}
|
|
882
885
|
}
|
|
883
|
-
function getIndexForForeignKey(foreignKey) {
|
|
884
|
-
|
|
886
|
+
function getIndexForForeignKey(foreignKey, exact = false) {
|
|
887
|
+
const indexes = getIndexes(foreignKey.sourceTable);
|
|
888
|
+
return exact ? findExactIndexForColumns(indexes, foreignKey.sourceColumns) : findIndexForColumns(indexes, foreignKey.sourceColumns);
|
|
885
889
|
}
|
|
886
890
|
function foreignKeyIndexError(foreignKey) {
|
|
887
891
|
return /* @__PURE__ */ new Error(`Foreign key on '${foreignKey.sourceTableName}' requires index on '${foreignKey.sourceTableName}(${foreignKey.sourceColumns.join(", ")})' for cascading actions.`);
|
|
@@ -969,7 +973,9 @@ async function applyIncomingForeignKeyActionsOnDelete(db, table, row, options) {
|
|
|
969
973
|
const action = foreignKey.onDelete ?? "no action";
|
|
970
974
|
const targetValues = foreignKey.targetColumns.map((column) => row[column]);
|
|
971
975
|
if (targetValues.some((value) => value === void 0 || value === null)) continue;
|
|
972
|
-
const
|
|
976
|
+
const requiresExactIndex = options.executionMode === "async" && options.cascadeMode === "soft" && action === "cascade";
|
|
977
|
+
const indexName = getIndexForForeignKey(foreignKey, requiresExactIndex);
|
|
978
|
+
if (requiresExactIndex && !indexName) throw new Error(`Async soft cascade on '${foreignKey.sourceTableName}' requires an exact foreign-key index on (${foreignKey.sourceColumns.join(", ")}). Prefix indexes with trailing fields cannot provide stable scheduled continuation.`);
|
|
973
979
|
if (action === "restrict" || action === "no action") {
|
|
974
980
|
if (!indexName && !options.allowFullScan) throw foreignKeyIndexError(foreignKey);
|
|
975
981
|
if (!indexName && options.strict) console.warn(`Foreign key check running without index (allowFullScan: true) on '${foreignKey.sourceTableName}'.`);
|
|
@@ -1001,6 +1007,7 @@ async function applyIncomingForeignKeyActionsOnDelete(db, table, row, options) {
|
|
|
1001
1007
|
foreignAction: action,
|
|
1002
1008
|
deleteMode: options.deleteMode,
|
|
1003
1009
|
cascadeMode: options.cascadeMode,
|
|
1010
|
+
softCascadeCursorVersion: requiresExactIndex ? 1 : void 0,
|
|
1004
1011
|
cursor: null,
|
|
1005
1012
|
batchSize: asyncBatchSize,
|
|
1006
1013
|
maxBytesPerBatch: options.maxBytesPerBatch,
|
|
@@ -1526,4 +1533,4 @@ function aggregateExtension() {
|
|
|
1526
1533
|
}
|
|
1527
1534
|
|
|
1528
1535
|
//#endregion
|
|
1529
|
-
export { patchReferencingRows as $, enforcePolymorphicWrite as A, getForeignKeys as B, collectPrimaryIdLookupRows as C,
|
|
1536
|
+
export { patchReferencingRows as $, enforcePolymorphicWrite as A, getForeignKeys as B, collectPrimaryIdLookupRows as C, getRankIndexes as Ct, encodeUndefinedDeep as D, PUBLIC_CREATED_AT_FIELD as Dt, deserializeFilterExpression as E, INTERNAL_CREATION_TIME_FIELD as Et, evaluateCheckConstraintTriState as F, getTableColumns as G, getMutationCollectionLimits as H, evaluateFilter as I, getUniqueIndexes as J, getTableDeleteConfig as K, extractPrimaryIdLookup as L, ensureDefaultColumns as M, ensureNonNullValues as N, enforceCheckConstraints as O, usesSystemCreatedAtAlias as Ot, ensureNullableColumns as P, normalizeTemporalComparableValue as Q, getChecks as R, collectMutationRowsBounded as S, getIndexes as St, decodeUndefinedDeep as T, CREATED_AT_MIGRATION_MESSAGE as Tt, getMutationExecutionMode as U, getMutationAsyncDelayMs as V, getOrmContext as W, hydrateDateFieldsForRead as X, hardDeleteRow as Y, normalizeDateFieldsForWrite as Z, applyDefaults as _, findIndexForColumns as _t, AGGREGATE_STATE_TABLE as a, splitReturningSelection as at, buildForeignKeyGraph as b, findVectorIndexByName as bt, getAggregateIndexDefinitions as c, toConvexFilter as ct, COUNT_ERROR as d, markLifecycleHookedTables as dt, resolveOrmRuntimeDefaults as et, createAggregateError as f, compileConvexFilter as ft, ensureCountAllowedForRls as g, findExactIndexForColumns as gt, ensureAggregateAllowedForRls as h, mapWithConcurrency as ht, AGGREGATE_RANK_TREE_TABLE as i, softDeleteRow as it, enforceUniqueIndexes as j, enforceForeignKeys as k, getRankIndexDefinitions as l, unsetFieldsOf as lt, createError as m, isConvexEnforceableFilter as mt, AGGREGATE_EXTREMA_TABLE as n, selectReturningRowWithHydration as nt, aggregateExtension as o, stripUnsetFields as ot, createCountError as p, convexAnd as pt, getTableName as q, AGGREGATE_MEMBER_TABLE as r, serializeFilterExpression as rt, rankAggregateName as s, takeRowsWithinByteBudget as st, AGGREGATE_BUCKET_TABLE as t, returningSelectionReadsCreationTime as tt, AGGREGATE_ERROR as u, hasLifecycleHooks as ut, applyIncomingForeignKeyActionsOnDelete as v, findRelationIndex as vt, createForeignKeyProbeMemo as w, resolveIndexOrderPushdown as wt, canUsePrimaryIdLookupCursor as x, getAggregateIndexes as xt, applyIncomingForeignKeyActionsOnUpdate as y, findSearchIndexByName as yt, getColumnName as z };
|
package/dist/watcher.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as generateMeta, d as PARSE_SNAPSHOT_SUFFIX, i as resolveConfiguredBackend, n as withLocalCodegenEnv, o as getConvexConfig, r as loadCliConfig, u as logger } from "./local-env-
|
|
2
|
+
import { a as generateMeta, d as PARSE_SNAPSHOT_SUFFIX, i as resolveConfiguredBackend, n as withLocalCodegenEnv, o as getConvexConfig, r as loadCliConfig, u as logger } from "./local-env-Dk8RJvt5.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $t as OrmLifecycleChange, A as CreateDatabaseOptions, Ar as $Type, B as getUniqueIndexes, Ct as OrderByClause, F as CascadeMode, Ft as ExtractTablesFromSchema, Gn as Columns, Gt as TablesRelationalConfig, Ht as RelationsBuilderConfigValue, I as DeleteMode, Kn as OrmRuntimeDefaults, L as SerializedFilterExpression, Mr as ColumnBuilder, Mt as VectorSearchProvider, N as OrmReader, Nr as ColumnBuilderBaseConfig, Or as SystemFieldAliases, P as OrmWriter, Pt as AnyRelationsBuilderConfig, Qn as OrmSchemaTriggers, R as getChecks, U as EdgeMetadata, Un as ConvexColumnBuilder, Ur as entityKind, Ut as RelationsConfigWithSchema, Vn as ConvexTextBuilderInitial, Wt as TableRelationalConfig, Xt as ConvexTable, Yn as OrmSchemaExtensionTriggers, Zn as OrmSchemaRelations, Zt as ConvexTableWithColumns, an as RlsPolicy, dt as InferInsertModel, kr as SystemFields, pt as InferSelectModel, qn as OrmSchemaExtensionRelations, r as OrmCapability, rr as FilterExpression$1, x as MigrationSet, z as getForeignKeys, zr as HasDefault, zt as RelationsBuilder } from "./capabilities-6PZBmvc8.js";
|
|
2
2
|
import * as convex_values0 from "convex/values";
|
|
3
3
|
import { GenericId, Validator, Value } from "convex/values";
|
|
4
|
-
import { DefineSchemaOptions, GenericDatabaseReader, GenericDatabaseWriter, GenericSchema, SchedulableFunctionReference, Scheduler, SchemaDefinition, internalActionGeneric, internalMutationGeneric } from "convex/server";
|
|
4
|
+
import { DefineSchemaOptions, GenericDatabaseReader, GenericDatabaseWriter, GenericSchema, SchedulableFunctionReference, Scheduler, SchemaDefinition, internalActionGeneric, internalMutationGeneric, internalQueryGeneric } from "convex/server";
|
|
5
5
|
|
|
6
6
|
//#region src/orm/migrations/capability.d.ts
|
|
7
7
|
/**
|
|
@@ -396,6 +396,7 @@ declare const migrationStorageTables: {
|
|
|
396
396
|
by_creation_time: ["_creationTime"];
|
|
397
397
|
by_status: ["status", "_creationTime"];
|
|
398
398
|
by_run_id: ["runId", "_creationTime"];
|
|
399
|
+
by_started_at: ["startedAt", "_creationTime"];
|
|
399
400
|
}, {}, {}, {}>;
|
|
400
401
|
};
|
|
401
402
|
declare const MIGRATION_STORAGE_TABLE_NAMES: Set<string>;
|
|
@@ -426,6 +427,7 @@ type ScheduledMutationBatchArgs = {
|
|
|
426
427
|
update?: Record<string, unknown>;
|
|
427
428
|
deleteMode?: DeleteMode;
|
|
428
429
|
cascadeMode?: CascadeMode;
|
|
430
|
+
softCascadeCursorVersion?: 1;
|
|
429
431
|
foreignIndexName?: string;
|
|
430
432
|
foreignSourceColumns?: string[];
|
|
431
433
|
targetValues?: unknown;
|
|
@@ -491,6 +493,7 @@ type CreateOrmConfigBase<TSchema extends OrmSchemaInput> = {
|
|
|
491
493
|
capabilities?: readonly OrmCapability[];
|
|
492
494
|
migrations?: MigrationSet<any>;
|
|
493
495
|
internalMutation?: typeof internalMutationGeneric;
|
|
496
|
+
internalQuery?: typeof internalQueryGeneric;
|
|
494
497
|
};
|
|
495
498
|
type CreateOrmConfigWithFunctions<TSchema extends OrmSchemaInput> = CreateOrmConfigBase<TSchema> & {
|
|
496
499
|
ormFunctions: OrmFunctions;
|
|
@@ -504,10 +507,10 @@ type OrmApiResult = {
|
|
|
504
507
|
scheduledDelete: ReturnType<typeof internalMutationGeneric>;
|
|
505
508
|
aggregateBackfill: ReturnType<typeof internalMutationGeneric>;
|
|
506
509
|
aggregateBackfillChunk: ReturnType<typeof internalMutationGeneric>;
|
|
507
|
-
aggregateBackfillStatus: ReturnType<typeof
|
|
510
|
+
aggregateBackfillStatus: ReturnType<typeof internalQueryGeneric>;
|
|
508
511
|
migrationRun: ReturnType<typeof internalMutationGeneric>;
|
|
509
512
|
migrationRunChunk: ReturnType<typeof internalMutationGeneric>;
|
|
510
|
-
migrationStatus: ReturnType<typeof
|
|
513
|
+
migrationStatus: ReturnType<typeof internalQueryGeneric>;
|
|
511
514
|
migrationCancel: ReturnType<typeof internalMutationGeneric>;
|
|
512
515
|
resetChunk: ReturnType<typeof internalMutationGeneric>;
|
|
513
516
|
reset: ReturnType<typeof internalActionGeneric>;
|
|
@@ -1021,7 +1024,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
1021
1024
|
fieldName: "updatedAt";
|
|
1022
1025
|
};
|
|
1023
1026
|
};
|
|
1024
|
-
|
|
1027
|
+
indexName: ConvexTextBuilderInitial<""> & {
|
|
1025
1028
|
_: {
|
|
1026
1029
|
notNull: true;
|
|
1027
1030
|
};
|
|
@@ -1031,7 +1034,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
1031
1034
|
};
|
|
1032
1035
|
} & {
|
|
1033
1036
|
_: {
|
|
1034
|
-
fieldName: "
|
|
1037
|
+
fieldName: "indexName";
|
|
1035
1038
|
};
|
|
1036
1039
|
};
|
|
1037
1040
|
tableKey: ConvexTextBuilderInitial<""> & {
|
|
@@ -1047,7 +1050,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
1047
1050
|
fieldName: "tableKey";
|
|
1048
1051
|
};
|
|
1049
1052
|
};
|
|
1050
|
-
|
|
1053
|
+
count: ConvexNumberBuilderInitial<""> & {
|
|
1051
1054
|
_: {
|
|
1052
1055
|
notNull: true;
|
|
1053
1056
|
};
|
|
@@ -1057,7 +1060,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
1057
1060
|
};
|
|
1058
1061
|
} & {
|
|
1059
1062
|
_: {
|
|
1060
|
-
fieldName: "
|
|
1063
|
+
fieldName: "count";
|
|
1061
1064
|
};
|
|
1062
1065
|
};
|
|
1063
1066
|
keyHash: ConvexTextBuilderInitial<""> & {
|
|
@@ -1159,7 +1162,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
1159
1162
|
fieldName: "updatedAt";
|
|
1160
1163
|
};
|
|
1161
1164
|
};
|
|
1162
|
-
|
|
1165
|
+
indexName: ConvexTextBuilderInitial<""> & {
|
|
1163
1166
|
_: {
|
|
1164
1167
|
notNull: true;
|
|
1165
1168
|
};
|
|
@@ -1169,10 +1172,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
1169
1172
|
};
|
|
1170
1173
|
} & {
|
|
1171
1174
|
_: {
|
|
1172
|
-
fieldName: "
|
|
1175
|
+
fieldName: "indexName";
|
|
1173
1176
|
};
|
|
1174
1177
|
};
|
|
1175
|
-
|
|
1178
|
+
tableKey: ConvexTextBuilderInitial<""> & {
|
|
1176
1179
|
_: {
|
|
1177
1180
|
notNull: true;
|
|
1178
1181
|
};
|
|
@@ -1182,7 +1185,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
1182
1185
|
};
|
|
1183
1186
|
} & {
|
|
1184
1187
|
_: {
|
|
1185
|
-
fieldName: "
|
|
1188
|
+
fieldName: "tableKey";
|
|
1186
1189
|
};
|
|
1187
1190
|
};
|
|
1188
1191
|
keyHash: ConvexTextBuilderInitial<""> & {
|
|
@@ -1353,7 +1356,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
1353
1356
|
fieldName: "updatedAt";
|
|
1354
1357
|
};
|
|
1355
1358
|
};
|
|
1356
|
-
|
|
1359
|
+
indexName: ConvexTextBuilderInitial<""> & {
|
|
1357
1360
|
_: {
|
|
1358
1361
|
notNull: true;
|
|
1359
1362
|
};
|
|
@@ -1363,7 +1366,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
1363
1366
|
};
|
|
1364
1367
|
} & {
|
|
1365
1368
|
_: {
|
|
1366
|
-
fieldName: "
|
|
1369
|
+
fieldName: "indexName";
|
|
1367
1370
|
};
|
|
1368
1371
|
};
|
|
1369
1372
|
tableKey: ConvexTextBuilderInitial<""> & {
|
|
@@ -1379,7 +1382,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
1379
1382
|
fieldName: "tableKey";
|
|
1380
1383
|
};
|
|
1381
1384
|
};
|
|
1382
|
-
|
|
1385
|
+
count: ConvexNumberBuilderInitial<""> & {
|
|
1383
1386
|
_: {
|
|
1384
1387
|
notNull: true;
|
|
1385
1388
|
};
|
|
@@ -1389,7 +1392,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
1389
1392
|
};
|
|
1390
1393
|
} & {
|
|
1391
1394
|
_: {
|
|
1392
|
-
fieldName: "
|
|
1395
|
+
fieldName: "count";
|
|
1393
1396
|
};
|
|
1394
1397
|
};
|
|
1395
1398
|
keyHash: ConvexTextBuilderInitial<""> & {
|
|
@@ -1668,7 +1671,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
1668
1671
|
fieldName: "lastError";
|
|
1669
1672
|
};
|
|
1670
1673
|
};
|
|
1671
|
-
|
|
1674
|
+
indexName: ConvexTextBuilderInitial<""> & {
|
|
1672
1675
|
_: {
|
|
1673
1676
|
notNull: true;
|
|
1674
1677
|
};
|
|
@@ -1678,10 +1681,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
1678
1681
|
};
|
|
1679
1682
|
} & {
|
|
1680
1683
|
_: {
|
|
1681
|
-
fieldName: "
|
|
1684
|
+
fieldName: "indexName";
|
|
1682
1685
|
};
|
|
1683
1686
|
};
|
|
1684
|
-
|
|
1687
|
+
keyDefinitionHash: ConvexTextBuilderInitial<""> & {
|
|
1685
1688
|
_: {
|
|
1686
1689
|
notNull: true;
|
|
1687
1690
|
};
|
|
@@ -1691,10 +1694,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
1691
1694
|
};
|
|
1692
1695
|
} & {
|
|
1693
1696
|
_: {
|
|
1694
|
-
fieldName: "
|
|
1697
|
+
fieldName: "keyDefinitionHash";
|
|
1695
1698
|
};
|
|
1696
1699
|
};
|
|
1697
|
-
|
|
1700
|
+
metricDefinitionHash: ConvexTextBuilderInitial<""> & {
|
|
1698
1701
|
_: {
|
|
1699
1702
|
notNull: true;
|
|
1700
1703
|
};
|
|
@@ -1704,10 +1707,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
1704
1707
|
};
|
|
1705
1708
|
} & {
|
|
1706
1709
|
_: {
|
|
1707
|
-
fieldName: "
|
|
1710
|
+
fieldName: "metricDefinitionHash";
|
|
1708
1711
|
};
|
|
1709
1712
|
};
|
|
1710
|
-
|
|
1713
|
+
tableKey: ConvexTextBuilderInitial<""> & {
|
|
1711
1714
|
_: {
|
|
1712
1715
|
notNull: true;
|
|
1713
1716
|
};
|
|
@@ -1717,7 +1720,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
1717
1720
|
};
|
|
1718
1721
|
} & {
|
|
1719
1722
|
_: {
|
|
1720
|
-
fieldName: "
|
|
1723
|
+
fieldName: "tableKey";
|
|
1721
1724
|
};
|
|
1722
1725
|
};
|
|
1723
1726
|
};
|
|
@@ -2038,6 +2041,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
2038
2041
|
by_creation_time: ["_creationTime"];
|
|
2039
2042
|
by_status: ["status", "_creationTime"];
|
|
2040
2043
|
by_run_id: ["runId", "_creationTime"];
|
|
2044
|
+
by_started_at: ["startedAt", "_creationTime"];
|
|
2041
2045
|
}, {}, {}, {}>;
|
|
2042
2046
|
}>];
|
|
2043
2047
|
declare function defineSchema$1<TSchema extends GenericSchema, StrictTableNameTypes extends boolean = true>(schema: TSchema, options?: SchemaOptions<StrictTableNameTypes>): SchemaChain<TSchema, StrictTableNameTypes, readonly [], undefined, true, true, true>;
|
package/package.json
CHANGED
|
@@ -56,7 +56,7 @@ const orders = convexTable(
|
|
|
56
56
|
- `.all()` — unfiltered global metrics
|
|
57
57
|
- `.count(field)` / `.sum(field)` / `.avg(field)` / `.min(field)` / `.max(field)` — chainable metrics
|
|
58
58
|
|
|
59
|
-
After deploying, CLI runs `aggregateBackfill` automatically. Wait for `aggregateBackfillStatus` to report `READY`.
|
|
59
|
+
After deploying, CLI runs `aggregateBackfill` automatically. Wait for `aggregateBackfillStatus` (an internal query) to report `READY`.
|
|
60
60
|
|
|
61
61
|
### `count()` — O(1) No-Scan Counts
|
|
62
62
|
|
|
@@ -137,6 +137,23 @@ Applied migrations are immutable. Two drift checks:
|
|
|
137
137
|
|
|
138
138
|
Reserved names — do not create tables with these names.
|
|
139
139
|
|
|
140
|
+
## Status Procedure
|
|
141
|
+
|
|
142
|
+
`generated/server:migrationStatus` is an internal **query** — reading status
|
|
143
|
+
takes no write transaction and can back a live subscription.
|
|
144
|
+
|
|
145
|
+
| Arg | Description |
|
|
146
|
+
|-----|-------------|
|
|
147
|
+
| `limit` | Most recent runs to list. Default `25`, capped at `MAX_STATUS_RUN_LIMIT` (`100`); higher values clamp. |
|
|
148
|
+
| `runId` | Return only this run. Ignores `limit`. |
|
|
149
|
+
|
|
150
|
+
`activeRun` resolves independently of `runId`. `migrations`, `pending`, and
|
|
151
|
+
`drift` always cover every authored migration and ignore `limit`.
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
import { MAX_STATUS_RUN_LIMIT } from 'kitcn/orm/migrations';
|
|
155
|
+
```
|
|
156
|
+
|
|
140
157
|
## Runtime Statuses
|
|
141
158
|
|
|
142
159
|
`pending` → `running` → `completed` | `failed` | `canceled` | `dry_run` | `noop` | `drift_blocked`
|
|
@@ -89,6 +89,11 @@ import { foreignKey } from "kitcn/orm";
|
|
|
89
89
|
(t) => [foreignKey({ columns: [t.userSlug], foreignColumns: [users.slug] })];
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
+
Delta from parity: async soft cascade requires an exact child index on the
|
|
93
|
+
referencing columns. `index("by_author").on(t.authorId)` qualifies;
|
|
94
|
+
`index("by_author_rank").on(t.authorId, t.rank)` does not, because a mutable
|
|
95
|
+
trailing field cannot provide stable continuation across scheduled mutations.
|
|
96
|
+
|
|
92
97
|
### Check Constraints
|
|
93
98
|
|
|
94
99
|
```ts
|