kitcn 0.25.1 → 0.25.3
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/dist/aggregate/index.d.ts +2 -2
- package/dist/auth/generated/index.d.ts +1 -1
- package/dist/auth/index.d.ts +5 -5
- package/dist/auth/nextjs/index.d.ts +1 -1
- package/dist/{builder-C6JSHkRK.js → builder-DoeyW4Vq.js} +64 -64
- package/dist/{capabilities-Bem7xvGK.d.ts → capabilities-DtDfpdcH.d.ts} +20 -1
- package/dist/cli.mjs +118 -20
- package/dist/{generated-contract-disabled-BEc4d98x.d.ts → generated-contract-disabled-SzH57bhp.d.ts} +1 -1
- package/dist/{middleware-CdqNVyp8.js → middleware-DIj-bwVi.js} +1 -1
- package/dist/orm/aggregate-index/index.d.ts +1 -1
- package/dist/orm/aggregate-index/index.js +15 -4
- package/dist/orm/index.d.ts +2 -2
- package/dist/orm/index.js +89 -19
- package/dist/orm/migrations/index.d.ts +2 -2
- package/dist/plugins/index.js +1 -1
- package/dist/{procedure-caller-CgLWu5F9.js → procedure-caller-Dxae9DW5.js} +3 -3
- package/dist/{procedure-name-Bjw1JDIS.d.ts → procedure-name-l2YusEZI.d.ts} +52 -52
- package/dist/ratelimit/index.js +2 -2
- package/dist/{schema-BQd2Xrfb.js → schema-D8sVYuYO.js} +25 -11
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +2 -2
- package/dist/{where-clause-compiler-Dmq4HMrK.d.ts → where-clause-compiler-Bke7ULoY.d.ts} +74 -74
- package/package.json +1 -1
- package/skills/kitcn/SKILL.md +1 -1
- package/skills/kitcn/references/features/aggregates.md +3 -0
- package/skills/kitcn/references/features/auth-polar.md +2 -2
- package/skills/kitcn/references/features/scheduling.md +1 -1
- package/skills/kitcn/references/setup/auth.md +1 -1
- package/skills/kitcn/references/setup/index.md +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Bn as ConvexTextBuilderInitial, Xt as ConvexTableWithColumns } from "../capabilities-
|
|
2
|
-
import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-
|
|
1
|
+
import { Bn as ConvexTextBuilderInitial, Xt as ConvexTableWithColumns } from "../capabilities-DtDfpdcH.js";
|
|
2
|
+
import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-Bke7ULoY.js";
|
|
3
3
|
import * as convex_values0 from "convex/values";
|
|
4
4
|
import { GenericId, Infer, Value } from "convex/values";
|
|
5
5
|
import { DocumentByName, GenericDataModel, GenericDatabaseReader, GenericDatabaseWriter, TableNamesInDataModel } from "convex/server";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { S as defineAuth, _ as GenericAuthBeforeResult, b as GenericAuthTriggerHandlers, g as BetterAuthOptionsWithoutDatabase, i as getGeneratedAuthDisabledReason, n as GeneratedAuthDisabledReasonKind, r as createDisabledAuthRuntime, t as AuthRuntime, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../../generated-contract-disabled-
|
|
1
|
+
import { S as defineAuth, _ as GenericAuthBeforeResult, b as GenericAuthTriggerHandlers, g as BetterAuthOptionsWithoutDatabase, i as getGeneratedAuthDisabledReason, n as GeneratedAuthDisabledReasonKind, r as createDisabledAuthRuntime, t as AuthRuntime, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../../generated-contract-disabled-SzH57bhp.js";
|
|
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 { S as defineAuth, _ as GenericAuthBeforeResult, a as AuthFunctions, b as GenericAuthTriggerHandlers, c as createApi, d as deleteOneHandler, f as findManyHandler, g as BetterAuthOptionsWithoutDatabase, h as updateOneHandler, i as getGeneratedAuthDisabledReason, l as createHandler, m as updateManyHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as findOneHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as deleteManyHandler, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../generated-contract-disabled-
|
|
4
|
+
import { S as defineAuth, _ as GenericAuthBeforeResult, a as AuthFunctions, b as GenericAuthTriggerHandlers, c as createApi, d as deleteOneHandler, f as findManyHandler, g as BetterAuthOptionsWithoutDatabase, h as updateOneHandler, i as getGeneratedAuthDisabledReason, l as createHandler, m as updateManyHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as findOneHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as deleteManyHandler, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../generated-contract-disabled-SzH57bhp.js";
|
|
5
5
|
import * as convex_values0 from "convex/values";
|
|
6
6
|
import { Infer } from "convex/values";
|
|
7
7
|
import { AuthConfig, DocumentByName, GenericDataModel, GenericMutationCtx, GenericQueryCtx, GenericSchema, PaginationOptions, PaginationResult, SchemaDefinition, TableNamesInDataModel } from "convex/server";
|
|
@@ -134,8 +134,8 @@ declare const adapterArgsValidator: convex_values0.VObject<{
|
|
|
134
134
|
limit?: number | undefined;
|
|
135
135
|
offset?: number | undefined;
|
|
136
136
|
sortBy?: {
|
|
137
|
-
field: string;
|
|
138
137
|
direction: "asc" | "desc";
|
|
138
|
+
field: string;
|
|
139
139
|
} | undefined;
|
|
140
140
|
model: string;
|
|
141
141
|
}, {
|
|
@@ -144,12 +144,12 @@ declare const adapterArgsValidator: convex_values0.VObject<{
|
|
|
144
144
|
offset: convex_values0.VFloat64<number | undefined, "optional">;
|
|
145
145
|
select: convex_values0.VArray<string[] | undefined, convex_values0.VString<string, "required">, "optional">;
|
|
146
146
|
sortBy: convex_values0.VObject<{
|
|
147
|
-
field: string;
|
|
148
147
|
direction: "asc" | "desc";
|
|
148
|
+
field: string;
|
|
149
149
|
} | undefined, {
|
|
150
150
|
direction: convex_values0.VUnion<"asc" | "desc", [convex_values0.VLiteral<"asc", "required">, convex_values0.VLiteral<"desc", "required">], "required", never>;
|
|
151
151
|
field: convex_values0.VString<string, "required">;
|
|
152
|
-
}, "optional", "
|
|
152
|
+
}, "optional", "direction" | "field">;
|
|
153
153
|
where: convex_values0.VArray<{
|
|
154
154
|
mode?: "sensitive" | "insensitive" | undefined;
|
|
155
155
|
connector?: "AND" | "OR" | undefined;
|
|
@@ -169,7 +169,7 @@ declare const adapterArgsValidator: convex_values0.VObject<{
|
|
|
169
169
|
operator: convex_values0.VUnion<"lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
|
|
170
170
|
value: convex_values0.VUnion<string | number | boolean | string[] | number[] | null, [convex_values0.VString<string, "required">, convex_values0.VFloat64<number, "required">, convex_values0.VBoolean<boolean, "required">, convex_values0.VArray<string[], convex_values0.VString<string, "required">, "required">, convex_values0.VArray<number[], convex_values0.VFloat64<number, "required">, "required">, convex_values0.VNull<null, "required">], "required", never>;
|
|
171
171
|
}, "required", "mode" | "value" | "connector" | "field" | "operator">, "optional">;
|
|
172
|
-
}, "required", "model" | "select" | "where" | "limit" | "offset" | "sortBy" | "sortBy.
|
|
172
|
+
}, "required", "model" | "select" | "where" | "limit" | "offset" | "sortBy" | "sortBy.direction" | "sortBy.field">;
|
|
173
173
|
declare const hasUniqueFields: (betterAuthSchema: BetterAuthDBSchema, model: string, input: Record<string, any>) => boolean;
|
|
174
174
|
declare const checkUniqueFields: <Schema extends SchemaDefinition<any, any>>(ctx: GenericQueryCtx<GenericDataModel>, schema: Schema, betterAuthSchema: BetterAuthDBSchema, table: string, input: Record<string, any>, doc?: Record<string, any>) => Promise<void>;
|
|
175
175
|
declare const selectFields: <T extends TableNamesInDataModel<GenericDataModel>, D extends DocumentByName<GenericDataModel, T>>(doc: D | null, select?: string[]) => D | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as ConvexContext, W as LazyCaller } from "../../procedure-name-
|
|
1
|
+
import { H as ConvexContext, W as LazyCaller } from "../../procedure-name-l2YusEZI.js";
|
|
2
2
|
import { t as GetTokenOptions } from "../../token-kQaqFby4.js";
|
|
3
3
|
|
|
4
4
|
//#region src/auth-nextjs/index.d.ts
|
|
@@ -3,8 +3,8 @@ import { n as customCtx, t as NoOp } from "./customFunctions-ivbc6-_g.js";
|
|
|
3
3
|
import { s as getTransformer } from "./transformer-D8wO-kEj.js";
|
|
4
4
|
import { ConvexError, v } from "convex/values";
|
|
5
5
|
import { HttpRouter, actionGeneric, httpActionGeneric, internalActionGeneric, internalMutationGeneric, internalQueryGeneric, mutationGeneric, queryGeneric } from "convex/server";
|
|
6
|
-
import
|
|
7
|
-
import * as z$
|
|
6
|
+
import * as z$1 from "zod";
|
|
7
|
+
import * as z$2 from "zod/v4";
|
|
8
8
|
import * as zCore from "zod/v4/core";
|
|
9
9
|
|
|
10
10
|
//#region src/internal/upstream/server/zod4.ts
|
|
@@ -190,7 +190,7 @@ function zCustomAction(action, customization) {
|
|
|
190
190
|
* @returns A Zod schema representing a Convex `Id`
|
|
191
191
|
*/
|
|
192
192
|
const zid = (tableName) => {
|
|
193
|
-
const result = z$
|
|
193
|
+
const result = z$2.custom((val) => typeof val === "string");
|
|
194
194
|
_zidRegistry.add(result, { tableName });
|
|
195
195
|
return result;
|
|
196
196
|
};
|
|
@@ -413,35 +413,35 @@ function convexToZod(convexValidator) {
|
|
|
413
413
|
zodValidator = zid(convexValidator.tableName);
|
|
414
414
|
break;
|
|
415
415
|
case "string":
|
|
416
|
-
zodValidator = z$
|
|
416
|
+
zodValidator = z$2.string();
|
|
417
417
|
break;
|
|
418
418
|
case "float64":
|
|
419
|
-
zodValidator = z$
|
|
419
|
+
zodValidator = z$2.number();
|
|
420
420
|
break;
|
|
421
421
|
case "int64":
|
|
422
|
-
zodValidator = z$
|
|
422
|
+
zodValidator = z$2.bigint();
|
|
423
423
|
break;
|
|
424
424
|
case "commitTs":
|
|
425
|
-
zodValidator = z$
|
|
425
|
+
zodValidator = z$2.union([z$2.bigint(), z$2.custom(isCommitTsPlaceholder)]);
|
|
426
426
|
break;
|
|
427
427
|
case "boolean":
|
|
428
|
-
zodValidator = z$
|
|
428
|
+
zodValidator = z$2.boolean();
|
|
429
429
|
break;
|
|
430
430
|
case "null":
|
|
431
|
-
zodValidator = z$
|
|
431
|
+
zodValidator = z$2.null();
|
|
432
432
|
break;
|
|
433
433
|
case "any":
|
|
434
|
-
zodValidator = z$
|
|
434
|
+
zodValidator = z$2.any();
|
|
435
435
|
break;
|
|
436
436
|
case "array":
|
|
437
|
-
zodValidator = z$
|
|
437
|
+
zodValidator = z$2.array(convexToZod(convexValidator.element));
|
|
438
438
|
break;
|
|
439
439
|
case "object":
|
|
440
|
-
zodValidator = z$
|
|
440
|
+
zodValidator = z$2.object(convexToZodFields(convexValidator.fields));
|
|
441
441
|
break;
|
|
442
442
|
case "union": {
|
|
443
443
|
if (convexValidator.members.length === 0) {
|
|
444
|
-
zodValidator = z$
|
|
444
|
+
zodValidator = z$2.never();
|
|
445
445
|
break;
|
|
446
446
|
}
|
|
447
447
|
if (convexValidator.members.length === 1) {
|
|
@@ -449,21 +449,21 @@ function convexToZod(convexValidator) {
|
|
|
449
449
|
break;
|
|
450
450
|
}
|
|
451
451
|
const memberValidators = convexValidator.members.map((member) => convexToZod(member));
|
|
452
|
-
zodValidator = z$
|
|
452
|
+
zodValidator = z$2.union([...memberValidators]);
|
|
453
453
|
break;
|
|
454
454
|
}
|
|
455
455
|
case "literal": {
|
|
456
456
|
const literalValidator = convexValidator;
|
|
457
|
-
zodValidator = z$
|
|
457
|
+
zodValidator = z$2.literal(literalValidator.value);
|
|
458
458
|
break;
|
|
459
459
|
}
|
|
460
460
|
case "record":
|
|
461
|
-
zodValidator = z$
|
|
461
|
+
zodValidator = z$2.record(convexToZod(convexValidator.key), convexToZod(convexValidator.value));
|
|
462
462
|
break;
|
|
463
463
|
case "bytes": throw new Error("v.bytes() is not supported");
|
|
464
464
|
default: throw new Error(`Unknown convex validator type: ${kind}`);
|
|
465
465
|
}
|
|
466
|
-
return isOptional ? z$
|
|
466
|
+
return isOptional ? z$2.optional(zodValidator) : zodValidator;
|
|
467
467
|
}
|
|
468
468
|
/**
|
|
469
469
|
* Like {@link convexToZod}, but it takes in a bare object, as expected by Convex
|
|
@@ -503,7 +503,7 @@ function withSystemFields(tableName, zObject) {
|
|
|
503
503
|
return {
|
|
504
504
|
...zObject,
|
|
505
505
|
_id: zid(tableName),
|
|
506
|
-
_creationTime: z$
|
|
506
|
+
_creationTime: z$2.number()
|
|
507
507
|
};
|
|
508
508
|
}
|
|
509
509
|
/**
|
|
@@ -523,7 +523,7 @@ function customFnBuilder(builder, customization) {
|
|
|
523
523
|
const inputArgs = customization.args ?? NoOp.args;
|
|
524
524
|
return function customBuilder(fn) {
|
|
525
525
|
const { args, handler = fn, skipConvexValidation = false, skipZodReturnsValidation = false, returns: maybeObject, ...extra } = fn;
|
|
526
|
-
const returns = maybeObject && !(maybeObject instanceof zCore.$ZodType) ? z$
|
|
526
|
+
const returns = maybeObject && !(maybeObject instanceof zCore.$ZodType) ? z$2.object(maybeObject) : maybeObject;
|
|
527
527
|
const returnValidator = returns && !skipConvexValidation ? { returns: zodOutputToConvex(returns) } : null;
|
|
528
528
|
const parseReturns = returns && !skipZodReturnsValidation ? (value) => returns.parseAsync(value === void 0 ? null : value) : null;
|
|
529
529
|
if (args) {
|
|
@@ -541,7 +541,7 @@ function customFnBuilder(builder, customization) {
|
|
|
541
541
|
handler: async (ctx, allArgs) => {
|
|
542
542
|
const added = await customInput(ctx, inputArgKeys.length === 0 ? {} : pickKeys(allArgs, inputArgKeySet), extra);
|
|
543
543
|
const rawArgs = pickKeys(allArgs, argKeySet);
|
|
544
|
-
argsSchema ??= z$
|
|
544
|
+
argsSchema ??= z$2.object(argsValidator);
|
|
545
545
|
const parsed = await argsSchema.safeParseAsync(rawArgs);
|
|
546
546
|
if (!parsed.success) throw new ConvexError({ ZodError: JSON.parse(JSON.stringify(parsed.error.issues, null, 2)) });
|
|
547
547
|
const args = parsed.data;
|
|
@@ -990,8 +990,8 @@ async function readFormDataBody(request) {
|
|
|
990
990
|
}
|
|
991
991
|
}
|
|
992
992
|
function getBaseSchema(schema) {
|
|
993
|
-
if (schema instanceof z.ZodOptional || schema instanceof z.ZodNullable) return getBaseSchema(schema.unwrap());
|
|
994
|
-
if (schema instanceof z.ZodDefault) return getBaseSchema(schema._def.innerType);
|
|
993
|
+
if (schema instanceof z$1.ZodOptional || schema instanceof z$1.ZodNullable) return getBaseSchema(schema.unwrap());
|
|
994
|
+
if (schema instanceof z$1.ZodDefault) return getBaseSchema(schema._def.innerType);
|
|
995
995
|
return schema;
|
|
996
996
|
}
|
|
997
997
|
/**
|
|
@@ -1007,12 +1007,12 @@ function getBaseSchema(schema) {
|
|
|
1007
1007
|
*/
|
|
1008
1008
|
function buildQueryCoercion(schema) {
|
|
1009
1009
|
const coercion = /* @__PURE__ */ new Map();
|
|
1010
|
-
if (!(schema instanceof z.ZodObject)) return coercion;
|
|
1010
|
+
if (!(schema instanceof z$1.ZodObject)) return coercion;
|
|
1011
1011
|
for (const [key, fieldSchema] of Object.entries(schema.shape)) {
|
|
1012
1012
|
const base = getBaseSchema(fieldSchema);
|
|
1013
|
-
if (base instanceof z.ZodArray) coercion.set(key, "array");
|
|
1014
|
-
else if (base instanceof z.ZodNumber) coercion.set(key, "number");
|
|
1015
|
-
else if (base instanceof z.ZodBoolean) coercion.set(key, "boolean");
|
|
1013
|
+
if (base instanceof z$1.ZodArray) coercion.set(key, "array");
|
|
1014
|
+
else if (base instanceof z$1.ZodNumber) coercion.set(key, "number");
|
|
1015
|
+
else if (base instanceof z$1.ZodBoolean) coercion.set(key, "boolean");
|
|
1016
1016
|
}
|
|
1017
1017
|
return coercion;
|
|
1018
1018
|
}
|
|
@@ -1083,7 +1083,7 @@ function createProcedure(def, handler, _type) {
|
|
|
1083
1083
|
if (def.paramsSchema) try {
|
|
1084
1084
|
parsedParams = def.paramsSchema.parse(pathParams);
|
|
1085
1085
|
} catch (error) {
|
|
1086
|
-
if (error instanceof z.ZodError) throw new CRPCError({
|
|
1086
|
+
if (error instanceof z$1.ZodError) throw new CRPCError({
|
|
1087
1087
|
code: "BAD_REQUEST",
|
|
1088
1088
|
message: "Invalid path params",
|
|
1089
1089
|
cause: error
|
|
@@ -1096,7 +1096,7 @@ function createProcedure(def, handler, _type) {
|
|
|
1096
1096
|
try {
|
|
1097
1097
|
parsedQuery = def.querySchema.parse(queryParams);
|
|
1098
1098
|
} catch (error) {
|
|
1099
|
-
if (error instanceof z.ZodError) throw new CRPCError({
|
|
1099
|
+
if (error instanceof z$1.ZodError) throw new CRPCError({
|
|
1100
1100
|
code: "BAD_REQUEST",
|
|
1101
1101
|
message: "Invalid query params",
|
|
1102
1102
|
cause: error
|
|
@@ -1116,7 +1116,7 @@ function createProcedure(def, handler, _type) {
|
|
|
1116
1116
|
try {
|
|
1117
1117
|
parsedInput = def.inputSchema.parse(def.functionConfig.transformer.input.deserialize(body));
|
|
1118
1118
|
} catch (error) {
|
|
1119
|
-
if (error instanceof z.ZodError) throw new CRPCError({
|
|
1119
|
+
if (error instanceof z$1.ZodError) throw new CRPCError({
|
|
1120
1120
|
code: "BAD_REQUEST",
|
|
1121
1121
|
message: "Invalid input",
|
|
1122
1122
|
cause: error
|
|
@@ -1132,7 +1132,7 @@ function createProcedure(def, handler, _type) {
|
|
|
1132
1132
|
try {
|
|
1133
1133
|
parsedForm = def.formSchema.parse(formObj);
|
|
1134
1134
|
} catch (error) {
|
|
1135
|
-
if (error instanceof z.ZodError) throw new CRPCError({
|
|
1135
|
+
if (error instanceof z$1.ZodError) throw new CRPCError({
|
|
1136
1136
|
code: "BAD_REQUEST",
|
|
1137
1137
|
message: "Invalid form data",
|
|
1138
1138
|
cause: error
|
|
@@ -1598,13 +1598,13 @@ function inferProcedureNameFromCallsite() {
|
|
|
1598
1598
|
*
|
|
1599
1599
|
* Core library - no project-specific dependencies
|
|
1600
1600
|
*/
|
|
1601
|
-
z.object({
|
|
1602
|
-
cursor: z.union([z.string(), z.null()]),
|
|
1603
|
-
limit: z.number()
|
|
1601
|
+
z$1.object({
|
|
1602
|
+
cursor: z$1.union([z$1.string(), z$1.null()]),
|
|
1603
|
+
limit: z$1.number()
|
|
1604
1604
|
});
|
|
1605
|
-
z.object({
|
|
1606
|
-
cursor: z.union([z.string(), z.null()]).optional(),
|
|
1607
|
-
limit: z.number().optional()
|
|
1605
|
+
z$1.object({
|
|
1606
|
+
cursor: z$1.union([z$1.string(), z$1.null()]).optional(),
|
|
1607
|
+
limit: z$1.number().optional()
|
|
1608
1608
|
});
|
|
1609
1609
|
/**
|
|
1610
1610
|
* Create a middleware factory for building reusable middleware chains
|
|
@@ -1731,32 +1731,32 @@ const withConvexSafeRunners = (ctx) => {
|
|
|
1731
1731
|
return changed ? wrappedContext : contextObject;
|
|
1732
1732
|
};
|
|
1733
1733
|
const replaceUnencodableOutputTypes = (schema) => {
|
|
1734
|
-
if (schema instanceof z.ZodDate) return z.any();
|
|
1735
|
-
if (schema instanceof z.ZodArray) return z.array(replaceUnencodableOutputTypes(schema.element));
|
|
1736
|
-
if (schema instanceof z.ZodObject) {
|
|
1734
|
+
if (schema instanceof z$1.ZodDate) return z$1.any();
|
|
1735
|
+
if (schema instanceof z$1.ZodArray) return z$1.array(replaceUnencodableOutputTypes(schema.element));
|
|
1736
|
+
if (schema instanceof z$1.ZodObject) {
|
|
1737
1737
|
const nextShape = {};
|
|
1738
1738
|
for (const [key, value] of Object.entries(schema.shape)) nextShape[key] = replaceUnencodableOutputTypes(value);
|
|
1739
|
-
return z.object(nextShape);
|
|
1739
|
+
return z$1.object(nextShape);
|
|
1740
1740
|
}
|
|
1741
|
-
if (schema instanceof z.ZodUnion) return z.union(schema.options.map((option) => replaceUnencodableOutputTypes(option)));
|
|
1742
|
-
if (schema instanceof z.ZodOptional) return replaceUnencodableOutputTypes(schema.unwrap()).optional();
|
|
1743
|
-
if (schema instanceof z.ZodNullable) return replaceUnencodableOutputTypes(schema.unwrap()).nullable();
|
|
1744
|
-
if (schema instanceof z.ZodRecord) return z.record(schema.keyType, replaceUnencodableOutputTypes(schema.valueType));
|
|
1741
|
+
if (schema instanceof z$1.ZodUnion) return z$1.union(schema.options.map((option) => replaceUnencodableOutputTypes(option)));
|
|
1742
|
+
if (schema instanceof z$1.ZodOptional) return replaceUnencodableOutputTypes(schema.unwrap()).optional();
|
|
1743
|
+
if (schema instanceof z$1.ZodNullable) return replaceUnencodableOutputTypes(schema.unwrap()).nullable();
|
|
1744
|
+
if (schema instanceof z$1.ZodRecord) return z$1.record(schema.keyType, replaceUnencodableOutputTypes(schema.valueType));
|
|
1745
1745
|
return schema;
|
|
1746
1746
|
};
|
|
1747
1747
|
const replaceUnencodableInputTypes = (schema) => {
|
|
1748
|
-
if (schema instanceof z.ZodDate) return z.any();
|
|
1749
|
-
if (schema instanceof z.ZodArray) return z.array(replaceUnencodableInputTypes(schema.element));
|
|
1750
|
-
if (schema instanceof z.ZodObject) {
|
|
1748
|
+
if (schema instanceof z$1.ZodDate) return z$1.any();
|
|
1749
|
+
if (schema instanceof z$1.ZodArray) return z$1.array(replaceUnencodableInputTypes(schema.element));
|
|
1750
|
+
if (schema instanceof z$1.ZodObject) {
|
|
1751
1751
|
const nextShape = {};
|
|
1752
1752
|
for (const [key, value] of Object.entries(schema.shape)) nextShape[key] = replaceUnencodableInputTypes(value);
|
|
1753
|
-
return z.object(nextShape);
|
|
1753
|
+
return z$1.object(nextShape);
|
|
1754
1754
|
}
|
|
1755
|
-
if (schema instanceof z.ZodUnion) return z.union(schema.options.map((option) => replaceUnencodableInputTypes(option)));
|
|
1756
|
-
if (schema instanceof z.ZodOptional) return replaceUnencodableInputTypes(schema.unwrap()).optional();
|
|
1757
|
-
if (schema instanceof z.ZodNullable) return replaceUnencodableInputTypes(schema.unwrap()).nullable();
|
|
1758
|
-
if (schema instanceof z.ZodRecord) return z.record(schema.keyType, replaceUnencodableInputTypes(schema.valueType));
|
|
1759
|
-
if (schema instanceof z.ZodDefault) return replaceUnencodableInputTypes(schema.removeDefault());
|
|
1755
|
+
if (schema instanceof z$1.ZodUnion) return z$1.union(schema.options.map((option) => replaceUnencodableInputTypes(option)));
|
|
1756
|
+
if (schema instanceof z$1.ZodOptional) return replaceUnencodableInputTypes(schema.unwrap()).optional();
|
|
1757
|
+
if (schema instanceof z$1.ZodNullable) return replaceUnencodableInputTypes(schema.unwrap()).nullable();
|
|
1758
|
+
if (schema instanceof z$1.ZodRecord) return z$1.record(schema.keyType, replaceUnencodableInputTypes(schema.valueType));
|
|
1759
|
+
if (schema instanceof z$1.ZodDefault) return replaceUnencodableInputTypes(schema.removeDefault());
|
|
1760
1760
|
return schema;
|
|
1761
1761
|
};
|
|
1762
1762
|
/**
|
|
@@ -1776,11 +1776,11 @@ const resolveConvexArgsShape = (inputShape) => {
|
|
|
1776
1776
|
try {
|
|
1777
1777
|
return toWireShape(inputShape);
|
|
1778
1778
|
} catch {
|
|
1779
|
-
const compatibleSchema = replaceUnencodableInputTypes(z.object(inputShape));
|
|
1779
|
+
const compatibleSchema = replaceUnencodableInputTypes(z$1.object(inputShape));
|
|
1780
1780
|
try {
|
|
1781
1781
|
return toWireShape(compatibleSchema.shape);
|
|
1782
1782
|
} catch {
|
|
1783
|
-
return Object.fromEntries(Object.keys(inputShape).map((key) => [key, z.any()]));
|
|
1783
|
+
return Object.fromEntries(Object.keys(inputShape).map((key) => [key, z$1.any()]));
|
|
1784
1784
|
}
|
|
1785
1785
|
}
|
|
1786
1786
|
};
|
|
@@ -1795,7 +1795,7 @@ const resolveConvexArgsShape = (inputShape) => {
|
|
|
1795
1795
|
const relaxSupersededKeys = (schema, superseded) => {
|
|
1796
1796
|
if (superseded.length === 0) return schema;
|
|
1797
1797
|
try {
|
|
1798
|
-
return schema.safeExtend(Object.fromEntries(superseded.map((key) => [key, z.any()])));
|
|
1798
|
+
return schema.safeExtend(Object.fromEntries(superseded.map((key) => [key, z$1.any()])));
|
|
1799
1799
|
} catch {
|
|
1800
1800
|
return schema;
|
|
1801
1801
|
}
|
|
@@ -1852,7 +1852,7 @@ const parseInput = (plan, value) => {
|
|
|
1852
1852
|
}
|
|
1853
1853
|
return parsed;
|
|
1854
1854
|
} catch (cause) {
|
|
1855
|
-
if (cause instanceof z.ZodError) throw new ConvexError({ ZodError: JSON.parse(JSON.stringify(cause.issues, null, 2)) });
|
|
1855
|
+
if (cause instanceof z$1.ZodError) throw new ConvexError({ ZodError: JSON.parse(JSON.stringify(cause.issues, null, 2)) });
|
|
1856
1856
|
throw cause;
|
|
1857
1857
|
}
|
|
1858
1858
|
};
|
|
@@ -2011,14 +2011,14 @@ var QueryProcedureBuilder = class QueryProcedureBuilder extends ProcedureBuilder
|
|
|
2011
2011
|
* @param opts.item - Zod schema for each item in the page array
|
|
2012
2012
|
*/
|
|
2013
2013
|
paginated(opts) {
|
|
2014
|
-
const paginationSchemaWithDefault = z.object({
|
|
2015
|
-
cursor: z.union([z.string(), z.null()]).default(null),
|
|
2016
|
-
limit: z.number().default(opts.limit).transform((n) => Math.min(n, opts.limit))
|
|
2014
|
+
const paginationSchemaWithDefault = z$1.object({
|
|
2015
|
+
cursor: z$1.union([z$1.string(), z$1.null()]).default(null),
|
|
2016
|
+
limit: z$1.number().default(opts.limit).transform((n) => Math.min(n, opts.limit))
|
|
2017
2017
|
});
|
|
2018
|
-
const outputSchema = z.object({
|
|
2019
|
-
continueCursor: z.union([z.string(), z.null()]),
|
|
2020
|
-
isDone: z.boolean(),
|
|
2021
|
-
page: z.array(opts.item)
|
|
2018
|
+
const outputSchema = z$1.object({
|
|
2019
|
+
continueCursor: z$1.union([z$1.string(), z$1.null()]),
|
|
2020
|
+
isDone: z$1.boolean(),
|
|
2021
|
+
page: z$1.array(opts.item)
|
|
2022
2022
|
});
|
|
2023
2023
|
return new QueryProcedureBuilder({
|
|
2024
2024
|
...this._def,
|
|
@@ -2139,7 +2139,7 @@ declare const createAggregateError: (code: AggregateErrorCode, message: string)
|
|
|
2139
2139
|
declare const ensureCountAllowedForRls: (tableConfig: TableRelationalConfig, rlsMode: "skip" | "default" | undefined) => void;
|
|
2140
2140
|
declare const ensureAggregateAllowedForRls: (tableConfig: TableRelationalConfig, rlsMode: "skip" | "default" | undefined, methodName: string) => void;
|
|
2141
2141
|
declare namespace runtime_d_exports$1 {
|
|
2142
|
-
export { AGGREGATE_ERROR, AGGREGATE_STATE_KIND_METRIC, AGGREGATE_STATE_KIND_RANK, AggregateBucketDelta, AggregateErrorCode, AggregateExtremaDelta, AggregateIndexDefinition, AggregateMemberWrite, AggregateMembershipDelta, AggregateQueryPlan, AggregateRangeConstraint, COUNT_ERROR, COUNT_STATUS_BUILDING, COUNT_STATUS_CLEARING, COUNT_STATUS_READY, ClearIndexChunkResult, CountErrorCode, CountIndexDefinition, CountQueryPlan, CountState, PlanBucketReadCache, applyAggregateIndexesForChange, applyCountIndexesForChange, asUnknownArray, assertAggregateIndexesWritable, clearCountIndexChunk, compileAggregateQueryPlan, compileCountFieldQueryPlan, compileCountQueryPlan, computeAggregateMembershipDelta, computeAggregateMetricValues, computeCountKeyParts, createAggregateError, createCountError, ensureAggregateAllowedForRls, ensureAggregateIndexReady, ensureCountAllowedForRls, ensureCountIndexReady, flushAggregateMembershipDeltas, getAggregateIndexDefinitions, getCountIndexDefinitions, getCountIndexValuesForFields, getCountState, isAggregatePlanZero, isIndexCountZero, listCountStates, listSchemaAggregateIndexes, listSchemaCountIndexes, parseAggregateWhere, parseCountWhere, readAverageFromBuckets, readCountFieldFromBuckets, readCountFromBuckets, readExtremaFromBuckets, readPlanBuckets, readSumFromBuckets, reconcileAggregateMembership, serializeCountKeyParts, setCountState, setCountStateError };
|
|
2142
|
+
export { AGGREGATE_ERROR, AGGREGATE_STATE_KIND_METRIC, AGGREGATE_STATE_KIND_RANK, AggregateBucketDelta, AggregateErrorCode, AggregateExtremaDelta, AggregateIndexDefinition, AggregateMemberWrite, AggregateMembershipDelta, AggregateQueryPlan, AggregateRangeConstraint, COUNT_ERROR, COUNT_STATUS_BUILDING, COUNT_STATUS_CLEARING, COUNT_STATUS_READY, ClearIndexChunkResult, CountErrorCode, CountIndexDefinition, CountQueryPlan, CountState, NULLISH_PROBE_VALUES, PlanBucketReadCache, applyAggregateIndexesForChange, applyCountIndexesForChange, asUnknownArray, assertAggregateIndexesWritable, clearCountIndexChunk, compileAggregateQueryPlan, compileCountFieldQueryPlan, compileCountQueryPlan, computeAggregateMembershipDelta, computeAggregateMetricValues, computeCountKeyParts, createAggregateError, createCountError, ensureAggregateAllowedForRls, ensureAggregateIndexReady, ensureCountAllowedForRls, ensureCountIndexReady, flushAggregateMembershipDeltas, getAggregateIndexDefinitions, getCountIndexDefinitions, getCountIndexValuesForFields, getCountState, isAggregatePlanZero, isIndexCountZero, listCountStates, listSchemaAggregateIndexes, listSchemaCountIndexes, parseAggregateWhere, parseCountWhere, readAverageFromBuckets, readCountFieldFromBuckets, readCountFromBuckets, readExtremaFromBuckets, readPlanBuckets, readSumFromBuckets, reconcileAggregateMembership, serializeCountKeyParts, setCountState, setCountStateError };
|
|
2143
2143
|
}
|
|
2144
2144
|
declare const AGGREGATE_STATE_KIND_METRIC = "metric";
|
|
2145
2145
|
declare const AGGREGATE_STATE_KIND_RANK = "rank";
|
|
@@ -2216,6 +2216,17 @@ type AggregateQueryPlan = {
|
|
|
2216
2216
|
metric: AggregateMetricRequest;
|
|
2217
2217
|
};
|
|
2218
2218
|
type PlanBucketReadCache = Map<string, Promise<unknown[]>>;
|
|
2219
|
+
/**
|
|
2220
|
+
* A nullable column is `v.optional(v.union(v.null(), ...))`, so a row that
|
|
2221
|
+
* never had the column written stores it absent, and `computeCountKeyParts`
|
|
2222
|
+
* encodes absent as the `__kitcnUndefined` sentinel — a different bucket from
|
|
2223
|
+
* the one an explicit `null` lands in. `isNull` means null-or-absent
|
|
2224
|
+
* everywhere else in the ORM, so probing only the `null` bucket silently
|
|
2225
|
+
* undercounts every row written before the column existed. Both probes are
|
|
2226
|
+
* looked up through `serializeStable`, which maps `undefined` onto the same
|
|
2227
|
+
* sentinel the write path stored.
|
|
2228
|
+
*/
|
|
2229
|
+
declare const NULLISH_PROBE_VALUES: readonly unknown[];
|
|
2219
2230
|
declare const serializeCountKeyParts: (parts: unknown[]) => string;
|
|
2220
2231
|
declare const compileCountQueryPlan: (tableConfig: TableRelationalConfig, where: unknown) => CountQueryPlan;
|
|
2221
2232
|
declare const compileCountFieldQueryPlan: (tableConfig: TableRelationalConfig, where: unknown, field: string) => AggregateQueryPlan;
|
|
@@ -3030,6 +3041,14 @@ declare class GelRelationalQuery<TSchema extends TablesRelationalConfig, TTableC
|
|
|
3030
3041
|
private _pushGroupByConstraint;
|
|
3031
3042
|
private _parseGroupByFieldConstraint;
|
|
3032
3043
|
private _collectGroupByFieldValues;
|
|
3044
|
+
/**
|
|
3045
|
+
* One group per distinct value, where `null` and absent count as the same
|
|
3046
|
+
* value. They occupy different aggregate buckets, so the emitted group key
|
|
3047
|
+
* and the filter that reads it diverge: the key reports `null` while the
|
|
3048
|
+
* filter keeps `isNull` so the aggregate compiler reads both buckets and
|
|
3049
|
+
* combines their metrics into a single row.
|
|
3050
|
+
*/
|
|
3051
|
+
private _buildGroupBySlots;
|
|
3033
3052
|
private _buildGroupByCandidates;
|
|
3034
3053
|
private _coerceGroupByByFields;
|
|
3035
3054
|
private _isGroupByOrderDirection;
|
package/dist/cli.mjs
CHANGED
|
@@ -6,12 +6,46 @@ import path, { basename, delimiter, dirname, extname, isAbsolute, join, posix, r
|
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { createHash, randomBytes } from "node:crypto";
|
|
8
8
|
import { execa } from "execa";
|
|
9
|
-
import { createInterface } from "node:readline/promises";
|
|
10
9
|
import os from "node:os";
|
|
10
|
+
import { createInterface } from "node:readline/promises";
|
|
11
11
|
import { diffWords, structuredPatch } from "diff";
|
|
12
12
|
import { parseEnv } from "node:util";
|
|
13
13
|
import { createServer } from "node:http";
|
|
14
14
|
|
|
15
|
+
//#region src/internal/concurrency.ts
|
|
16
|
+
/**
|
|
17
|
+
* Bounded-concurrency fan-out, shared by the ORM write path, relation loading
|
|
18
|
+
* and the CLI's entry-point analyzer.
|
|
19
|
+
*
|
|
20
|
+
* Deliberately dependency-free: ORM callers reach it from a Convex function
|
|
21
|
+
* entry, and Convex bundles every static import of an entry.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Runs `worker` over `items` with at most `limit` in flight. Results keep input
|
|
25
|
+
* order, so callers can rely on a stable mapping back to `items`.
|
|
26
|
+
*
|
|
27
|
+
* Unbounded `Promise.all` is not an option for the ORM caller: a fan-out is
|
|
28
|
+
* bounded only by `mutationMaxRows` (10,000), and that many simultaneous
|
|
29
|
+
* in-flight syscalls is its own failure mode.
|
|
30
|
+
*/
|
|
31
|
+
async function mapWithConcurrency(items, limit, worker) {
|
|
32
|
+
if (items.length === 0) return [];
|
|
33
|
+
const width = Math.max(1, Math.min(limit, items.length));
|
|
34
|
+
const results = new Array(items.length);
|
|
35
|
+
let nextIndex = 0;
|
|
36
|
+
const runWorker = async () => {
|
|
37
|
+
while (true) {
|
|
38
|
+
const index = nextIndex;
|
|
39
|
+
nextIndex += 1;
|
|
40
|
+
if (index >= items.length) return;
|
|
41
|
+
results[index] = await worker(items[index], index);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
await Promise.all(Array.from({ length: width }, () => runWorker()));
|
|
45
|
+
return results;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
15
49
|
//#region src/orm/mutation-utils.ts
|
|
16
50
|
const UTF8_ENCODER = new TextEncoder();
|
|
17
51
|
function getTableName(table) {
|
|
@@ -830,20 +864,32 @@ const collectAnalyzeEntrySelection = async (roots, options) => {
|
|
|
830
864
|
handlerExportsByEntry
|
|
831
865
|
};
|
|
832
866
|
};
|
|
867
|
+
const MAX_ANALYZE_CONCURRENCY = 8;
|
|
868
|
+
/**
|
|
869
|
+
* esbuild bundles are independent, so the entry sweep runs through a bounded
|
|
870
|
+
* pool instead of one build at a time. The cap stays low enough to avoid
|
|
871
|
+
* oversubscribing esbuild's worker pool on small machines.
|
|
872
|
+
*/
|
|
873
|
+
const resolveAnalyzeConcurrency = (taskCount) => {
|
|
874
|
+
if (taskCount <= 1) return 1;
|
|
875
|
+
const cpuCount = os.cpus().length || 1;
|
|
876
|
+
return Math.max(1, Math.min(MAX_ANALYZE_CONCURRENCY, cpuCount - 1, taskCount));
|
|
877
|
+
};
|
|
833
878
|
const collectHotspotRows = async (roots, options, includeDeepData) => {
|
|
834
879
|
const { isolateEntries, generatedEntries, entryPoints, handlerExportsByEntry } = await collectAnalyzeEntrySelection(roots, options);
|
|
835
|
-
const rows =
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
880
|
+
const rows = await mapWithConcurrency(entryPoints, resolveAnalyzeConcurrency(entryPoints.length), async (entryPoint) => {
|
|
881
|
+
try {
|
|
882
|
+
return {
|
|
883
|
+
...await analyzeHotspotEntry(entryPoint, roots.projectRoot, includeDeepData),
|
|
884
|
+
handlerExports: handlerExportsByEntry.get(entryPoint) ?? []
|
|
885
|
+
};
|
|
886
|
+
} catch (error) {
|
|
887
|
+
return {
|
|
888
|
+
entry: path.relative(roots.projectRoot, entryPoint),
|
|
889
|
+
error: error instanceof Error ? error.message : String(error)
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
});
|
|
847
893
|
return {
|
|
848
894
|
isolateEntries,
|
|
849
895
|
generatedEntries,
|
|
@@ -3270,7 +3316,7 @@ const upsertReadOptionalRuntimeEnvOption = (source, keys) => {
|
|
|
3270
3316
|
const renderEnvHelperContent = (envFields, existingContent) => {
|
|
3271
3317
|
const fields = resolveBootstrapEnvFields(envFields);
|
|
3272
3318
|
const readOptionalRuntimeEnvKeys = resolveReadOptionalRuntimeEnvKeys(fields);
|
|
3273
|
-
if (!existingContent) return `import { createEnv } from 'kitcn/server';\nimport
|
|
3319
|
+
if (!existingContent) return `import { createEnv } from 'kitcn/server';\nimport * as z from 'zod';\n\nconst envSchema = z.object({\n${fields.map((field) => ` ${field.key}: ${field.schema},`).join("\n")}\n});\n\nexport const getEnv = createEnv({\n${renderReadOptionalRuntimeEnvOption(readOptionalRuntimeEnvKeys)} schema: envSchema,\n});\n`;
|
|
3274
3320
|
const match = existingContent.match(ENV_SCHEMA_RE);
|
|
3275
3321
|
if (!match) throw new Error("Expected env helper to define `const envSchema = z.object({ ... });`.");
|
|
3276
3322
|
const existingBody = match[2];
|
|
@@ -6782,7 +6828,7 @@ const authRegistryItem = defineInternalRegistryItem({
|
|
|
6782
6828
|
//#region src/cli/registry/items/ratelimit/ratelimit-functions.template.ts
|
|
6783
6829
|
const PROJECT_CRPC_IMPORT_PLACEHOLDER$3 = "__KITCN_PROJECT_CRPC_IMPORT__";
|
|
6784
6830
|
const RATELIMIT_FUNCTIONS_TEMPLATE = `import { cleanupRatelimitState } from "kitcn/ratelimit";
|
|
6785
|
-
import
|
|
6831
|
+
import * as z from "zod";
|
|
6786
6832
|
import { privateMutation } from "${PROJECT_CRPC_IMPORT_PLACEHOLDER$3}";
|
|
6787
6833
|
|
|
6788
6834
|
const DEFAULT_BATCH_SIZE = 500;
|
|
@@ -7098,7 +7144,7 @@ import {
|
|
|
7098
7144
|
Text,
|
|
7099
7145
|
} from '@react-email/components';
|
|
7100
7146
|
import { render } from '@react-email/render';
|
|
7101
|
-
import
|
|
7147
|
+
import * as z from 'zod';
|
|
7102
7148
|
import { privateAction } from '${PROJECT_CRPC_IMPORT_PLACEHOLDER$2}';
|
|
7103
7149
|
${PROJECT_GET_ENV_IMPORT_PLACEHOLDER$1}
|
|
7104
7150
|
import { createResendCaller } from '${FUNCTIONS_DIR_IMPORT_PLACEHOLDER$2}/generated/plugins/resend.runtime';
|
|
@@ -7218,7 +7264,7 @@ const RESEND_FUNCTIONS_TEMPLATE = `import {
|
|
|
7218
7264
|
shouldRetry,
|
|
7219
7265
|
} from '@kitcn/resend';
|
|
7220
7266
|
import { eq, inArray } from 'kitcn/orm';
|
|
7221
|
-
import
|
|
7267
|
+
import * as z from 'zod';
|
|
7222
7268
|
import { privateAction, privateMutation, privateQuery } from '${PROJECT_CRPC_IMPORT_PLACEHOLDER$1}';
|
|
7223
7269
|
import { resend } from '${PLUGIN_CONFIG_IMPORT_PLACEHOLDER}';
|
|
7224
7270
|
import {
|
|
@@ -8916,7 +8962,7 @@ function renderInitNextEnvLocalTemplate(source) {
|
|
|
8916
8962
|
//#endregion
|
|
8917
8963
|
//#region src/cli/registry/init/next/init-next-messages.template.ts
|
|
8918
8964
|
const resolveCrpcImportPath = (functionsDirRelative) => functionsDirRelative === "convex" ? "./lib/crpc" : "../lib/crpc";
|
|
8919
|
-
const renderInitNextMessagesTemplate = (functionsDirRelative = "convex/functions") => `import
|
|
8965
|
+
const renderInitNextMessagesTemplate = (functionsDirRelative = "convex/functions") => `import * as z from 'zod';
|
|
8920
8966
|
|
|
8921
8967
|
import { publicMutation, publicQuery } from '${resolveCrpcImportPath(functionsDirRelative)}';
|
|
8922
8968
|
|
|
@@ -14368,6 +14414,54 @@ const assertRawConvexAuthDeploymentReady = () => {
|
|
|
14368
14414
|
const convexUrl = localEnv[projectContext.convexUrlEnvKey]?.trim();
|
|
14369
14415
|
if (!deployment || !convexUrl) throw new Error(RAW_CONVEX_AUTH_DEPLOYMENT_ERROR);
|
|
14370
14416
|
};
|
|
14417
|
+
const runDependencyInstallStage = async (installPlan, stage, execaFn) => {
|
|
14418
|
+
try {
|
|
14419
|
+
await applyDependencyInstallPlan(installPlan, execaFn);
|
|
14420
|
+
} catch (error) {
|
|
14421
|
+
throw new Error(`${stage}: ${error instanceof Error ? error.message : String(error)}`);
|
|
14422
|
+
}
|
|
14423
|
+
};
|
|
14424
|
+
/**
|
|
14425
|
+
* The baseline install and the plugin package install run back to back with no
|
|
14426
|
+
* code between them, so they collapse into a single package-manager call.
|
|
14427
|
+
* Merging only happens when both legs target the same package.json with the
|
|
14428
|
+
* same package manager; otherwise each leg runs on its own.
|
|
14429
|
+
*/
|
|
14430
|
+
const mergeBaselineAndPluginInstall = (baseline, plugin) => {
|
|
14431
|
+
if (!baseline) return null;
|
|
14432
|
+
if (plugin.skipped || !(plugin.packageName && plugin.packageJsonPath)) return null;
|
|
14433
|
+
if (resolve(baseline.cwd) !== resolve(dirname(plugin.packageJsonPath))) return null;
|
|
14434
|
+
if (detectPackageManager(baseline.cwd) !== baseline.packageManager) return null;
|
|
14435
|
+
const pluginSpec = plugin.packageSpec ?? plugin.packageName;
|
|
14436
|
+
const packages = [...baseline.packages, pluginSpec];
|
|
14437
|
+
const { args, command } = resolveDependencyInstallCommand(baseline.packageManager, packages);
|
|
14438
|
+
return {
|
|
14439
|
+
...baseline,
|
|
14440
|
+
args,
|
|
14441
|
+
command,
|
|
14442
|
+
packages
|
|
14443
|
+
};
|
|
14444
|
+
};
|
|
14445
|
+
const installBaselineAndPluginDependencies = async (params) => {
|
|
14446
|
+
const { baseline, plugin, pluginKey, execaFn } = params;
|
|
14447
|
+
const merged = mergeBaselineAndPluginInstall(baseline, plugin);
|
|
14448
|
+
if (merged) {
|
|
14449
|
+
await runDependencyInstallStage(merged, `Installing baseline dependencies and the ${pluginKey} package`, execaFn);
|
|
14450
|
+
return {
|
|
14451
|
+
packageName: plugin.packageName,
|
|
14452
|
+
packageSpec: plugin.packageSpec ?? plugin.packageName,
|
|
14453
|
+
packageJsonPath: plugin.packageJsonPath,
|
|
14454
|
+
installed: true,
|
|
14455
|
+
skipped: false
|
|
14456
|
+
};
|
|
14457
|
+
}
|
|
14458
|
+
await runDependencyInstallStage(baseline, "Installing baseline dependencies", execaFn);
|
|
14459
|
+
try {
|
|
14460
|
+
return await applyPluginDependencyInstall(plugin, execaFn);
|
|
14461
|
+
} catch (error) {
|
|
14462
|
+
throw new Error(`Installing the ${pluginKey} package: ${error instanceof Error ? error.message : String(error)}`);
|
|
14463
|
+
}
|
|
14464
|
+
};
|
|
14371
14465
|
const handleAddCommand = async (argv, deps = {}) => {
|
|
14372
14466
|
const parsed = parseArgs(argv);
|
|
14373
14467
|
if (HELP_FLAGS$10.has(argv[0] ?? "") || HELP_FLAGS$10.has(parsed.restArgs[0] ?? "")) {
|
|
@@ -14481,8 +14575,12 @@ const handleAddCommand = async (argv, deps = {}) => {
|
|
|
14481
14575
|
yes: addArgs.yes,
|
|
14482
14576
|
promptAdapter
|
|
14483
14577
|
});
|
|
14484
|
-
|
|
14485
|
-
|
|
14578
|
+
const dependencyInstall = await installBaselineAndPluginDependencies({
|
|
14579
|
+
baseline: initializationPlan?.dependencyInstall ?? null,
|
|
14580
|
+
plugin: plan.dependency,
|
|
14581
|
+
pluginKey: selectedPlugin,
|
|
14582
|
+
execaFn
|
|
14583
|
+
});
|
|
14486
14584
|
const installedDependencyHints = await applyDependencyHintsInstall(plan.dependencyHints, execaFn);
|
|
14487
14585
|
const payload = {
|
|
14488
14586
|
command: "add",
|
package/dist/{generated-contract-disabled-BEc4d98x.d.ts → generated-contract-disabled-SzH57bhp.d.ts}
RENAMED
|
@@ -235,8 +235,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
|
|
|
235
235
|
limit?: number | undefined;
|
|
236
236
|
offset?: number | undefined;
|
|
237
237
|
sortBy?: {
|
|
238
|
-
field: string;
|
|
239
238
|
direction: "asc" | "desc";
|
|
239
|
+
field: string;
|
|
240
240
|
} | undefined;
|
|
241
241
|
model: string;
|
|
242
242
|
paginationOpts: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as RankOrderField, G as CountBackfillKickoffArgs, J as AggregateQueryPlan, K as CountBackfillMode, Q as RankIndexDefinition, W as CountBackfillChunkArgs, X as AggregateIndexDefinition, Y as CountQueryPlan, Z as CountIndexDefinition, q as CountBackfillStatusArgs, r as OrmCapability } from "../../capabilities-
|
|
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-DtDfpdcH.js";
|
|
2
2
|
|
|
3
3
|
//#region src/orm/aggregate-index/capability.d.ts
|
|
4
4
|
/**
|