kitcn 0.12.1 → 0.12.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.
@@ -1,4 +1,4 @@
1
- import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial, dn as ConvexTableWithColumns, tr as ConvexTextBuilderInitial } from "../where-clause-compiler-DdjN63Io.js";
1
+ import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial, dn as ConvexTableWithColumns, tr as ConvexTextBuilderInitial } from "../where-clause-compiler-CuH2JNxb.js";
2
2
  import * as convex_values0 from "convex/values";
3
3
  import { GenericId, Infer, Value } from "convex/values";
4
4
  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-D-sOFy92.js";
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-Ct12mYyH.js";
2
2
  export { type AuthRuntime, BetterAuthOptionsWithoutDatabase, type GeneratedAuthDisabledReasonKind, GenericAuthBeforeResult, GenericAuthDefinition, GenericAuthTriggerChange, GenericAuthTriggerHandlers, GenericAuthTriggers, createDisabledAuthRuntime, defineAuth, getGeneratedAuthDisabledReason };
@@ -1,7 +1,7 @@
1
1
  import { a as QueryCtxWithPreferredOrmQueryTable, n as LookupByIdResultByCtx, t as DocByCtx } from "../query-context-CFZqIvD7.js";
2
2
  import { t as GetAuth } from "../types-BiJE7qxR.js";
3
3
  import { t as GenericCtx } from "../context-utils-HPC5nXzx.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-D-sOFy92.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-Ct12mYyH.js";
5
5
  import * as convex_values0 from "convex/values";
6
6
  import { Infer } from "convex/values";
7
7
  import { DocumentByName, GenericDataModel, GenericMutationCtx, GenericQueryCtx, GenericSchema, PaginationOptions, PaginationResult, SchemaDefinition, TableNamesInDataModel } from "convex/server";
@@ -103,25 +103,25 @@ type AdapterPaginationOptions = PaginationOptions & {
103
103
  maximumRowsRead?: number;
104
104
  };
105
105
  declare const adapterWhereValidator: convex_values0.VObject<{
106
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
106
107
  connector?: "AND" | "OR" | undefined;
107
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
108
108
  value: string | number | boolean | string[] | number[] | null;
109
109
  field: string;
110
110
  }, {
111
111
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
112
112
  field: convex_values0.VString<string, "required">;
113
- 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>;
113
+ operator: convex_values0.VUnion<"eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "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>;
114
114
  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>;
115
- }, "required", "value" | "connector" | "field" | "operator">;
115
+ }, "required", "operator" | "value" | "field" | "connector">;
116
116
  declare const adapterArgsValidator: convex_values0.VObject<{
117
- select?: string[] | undefined;
117
+ limit?: number | undefined;
118
118
  where?: {
119
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
119
120
  connector?: "AND" | "OR" | undefined;
120
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
121
121
  value: string | number | boolean | string[] | number[] | null;
122
122
  field: string;
123
123
  }[] | undefined;
124
- limit?: number | undefined;
124
+ select?: string[] | undefined;
125
125
  offset?: number | undefined;
126
126
  sortBy?: {
127
127
  field: string;
@@ -141,22 +141,22 @@ declare const adapterArgsValidator: convex_values0.VObject<{
141
141
  field: convex_values0.VString<string, "required">;
142
142
  }, "optional", "field" | "direction">;
143
143
  where: convex_values0.VArray<{
144
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
144
145
  connector?: "AND" | "OR" | undefined;
145
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
146
146
  value: string | number | boolean | string[] | number[] | null;
147
147
  field: string;
148
148
  }[] | undefined, convex_values0.VObject<{
149
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
149
150
  connector?: "AND" | "OR" | undefined;
150
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
151
151
  value: string | number | boolean | string[] | number[] | null;
152
152
  field: string;
153
153
  }, {
154
154
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
155
155
  field: convex_values0.VString<string, "required">;
156
- 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>;
156
+ operator: convex_values0.VUnion<"eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "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>;
157
157
  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>;
158
- }, "required", "value" | "connector" | "field" | "operator">, "optional">;
159
- }, "required", "model" | "select" | "where" | "limit" | "offset" | "sortBy" | "sortBy.field" | "sortBy.direction">;
158
+ }, "required", "operator" | "value" | "field" | "connector">, "optional">;
159
+ }, "required", "limit" | "where" | "model" | "select" | "offset" | "sortBy" | "sortBy.field" | "sortBy.direction">;
160
160
  declare const hasUniqueFields: (betterAuthSchema: BetterAuthDBSchema, model: string, input: Record<string, any>) => boolean;
161
161
  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>;
162
162
  declare const selectFields: <T extends TableNamesInDataModel<GenericDataModel>, D extends DocumentByName<GenericDataModel, T>>(doc: D | null, select?: string[]) => D | null;
package/dist/cli.mjs CHANGED
@@ -9,7 +9,6 @@ import { confirm, isCancel, multiselect, select, spinner } from "@clack/prompts"
9
9
  import { parse } from "dotenv";
10
10
  import { execa } from "execa";
11
11
  import { createJiti } from "jiti";
12
- import ts from "typescript";
13
12
  import { createInterface } from "node:readline/promises";
14
13
  import { build } from "esbuild";
15
14
  import os from "node:os";
@@ -3470,20 +3469,40 @@ const buildPluginInstallPlan = async (params) => {
3470
3469
  };
3471
3470
  };
3472
3471
 
3472
+ //#endregion
3473
+ //#region src/cli/utils/typescript-runtime.ts
3474
+ const require$1 = createRequire(import.meta.url);
3475
+ let cachedTypeScript = null;
3476
+ const loadTypeScript = () => {
3477
+ if (cachedTypeScript) return cachedTypeScript;
3478
+ const loaded = require$1("typescript");
3479
+ const resolved = "default" in loaded && loaded.default ? loaded.default : loaded;
3480
+ cachedTypeScript = resolved;
3481
+ return resolved;
3482
+ };
3483
+ const createTypeScriptProxy = () => new Proxy({}, { get(_target, property) {
3484
+ return loadTypeScript()[property];
3485
+ } });
3486
+
3473
3487
  //#endregion
3474
3488
  //#region src/cli/registry/schema-ownership.ts
3475
3489
  const OBJECT_ENTRY_INDENT = " ";
3476
3490
  const LEADING_INDENT_RE = /^[ \t]*/;
3477
3491
  const LEGACY_MANAGED_COMMENT_RE = /^[ \t]*\/\* kitcn-managed [^*]+ \*\/\n?/gm;
3478
3492
  const WHITESPACE_RE = /\s/;
3479
- const printer = ts.createPrinter({ removeComments: true });
3493
+ const ts$2 = createTypeScriptProxy();
3494
+ let printer = null;
3495
+ const getPrinter = () => {
3496
+ printer ??= ts$2.createPrinter({ removeComments: true });
3497
+ return printer;
3498
+ };
3480
3499
  const escapeRegex = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3481
3500
  const normalizePathForMessage = (path) => {
3482
3501
  const relativePath = relative(process.cwd(), path).replaceAll("\\", "/");
3483
3502
  return relativePath.startsWith("..") ? path.replaceAll("\\", "/") : relativePath;
3484
3503
  };
3485
3504
  const stripLegacyManagedComments = (source) => source.replace(LEGACY_MANAGED_COMMENT_RE, "").replace(/\n{3,}/g, "\n\n");
3486
- const parseSource = (source) => ts.createSourceFile("schema.ts", source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
3505
+ const parseSource = (source) => ts$2.createSourceFile("schema.ts", source, ts$2.ScriptTarget.Latest, true, ts$2.ScriptKind.TS);
3487
3506
  const indentBlock = (value, indent) => value.trim().split("\n").map((line) => `${indent}${line}`).join("\n");
3488
3507
  const ensureTrailingComma = (value) => {
3489
3508
  const trimmed = value.trim();
@@ -3494,15 +3513,15 @@ const getIndentAt = (source, index) => {
3494
3513
  return LEADING_INDENT_RE.exec(source.slice(lineStart))?.[0] ?? "";
3495
3514
  };
3496
3515
  const replaceRange = (source, start, end, content) => `${source.slice(0, start)}${content}${source.slice(end)}`;
3497
- const isStringLiteralLike = (node) => ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node);
3516
+ const isStringLiteralLike = (node) => ts$2.isStringLiteral(node) || ts$2.isNoSubstitutionTemplateLiteral(node);
3498
3517
  const getPropertyName = (property) => {
3499
- if ((ts.isPropertyAssignment(property) || ts.isShorthandPropertyAssignment(property)) && property.name) {
3500
- if (ts.isIdentifier(property.name)) return property.name.text;
3518
+ if ((ts$2.isPropertyAssignment(property) || ts$2.isShorthandPropertyAssignment(property)) && property.name) {
3519
+ if (ts$2.isIdentifier(property.name)) return property.name.text;
3501
3520
  if (isStringLiteralLike(property.name)) return property.name.text;
3502
3521
  }
3503
3522
  return null;
3504
3523
  };
3505
- const renderNode = (node, sourceFile) => printer.printNode(ts.EmitHint.Unspecified, node, sourceFile).trim();
3524
+ const renderNode = (node, sourceFile) => getPrinter().printNode(ts$2.EmitHint.Unspecified, node, sourceFile).trim();
3506
3525
  const renderObjectLiteral = (baseIndent, entries) => {
3507
3526
  if (entries.length === 0) return "{}";
3508
3527
  const entryIndent = `${baseIndent}${OBJECT_ENTRY_INDENT}`;
@@ -3516,8 +3535,8 @@ const renderArrayLiteral = (baseIndent, entries) => {
3516
3535
  const findTablesObject = (source) => {
3517
3536
  const sourceFile = parseSource(source);
3518
3537
  for (const statement of sourceFile.statements) {
3519
- if (!ts.isVariableStatement(statement)) continue;
3520
- for (const declaration of statement.declarationList.declarations) if (ts.isIdentifier(declaration.name) && declaration.name.text === "tables" && declaration.initializer && ts.isObjectLiteralExpression(declaration.initializer)) return {
3538
+ if (!ts$2.isVariableStatement(statement)) continue;
3539
+ for (const declaration of statement.declarationList.declarations) if (ts$2.isIdentifier(declaration.name) && declaration.name.text === "tables" && declaration.initializer && ts$2.isObjectLiteralExpression(declaration.initializer)) return {
3521
3540
  object: declaration.initializer,
3522
3541
  sourceFile,
3523
3542
  statementStart: statement.getStart(sourceFile)
@@ -3525,15 +3544,15 @@ const findTablesObject = (source) => {
3525
3544
  }
3526
3545
  let defineSchemaObject = null;
3527
3546
  const visit = (node, statementStart) => {
3528
- if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === "defineSchema") {
3547
+ if (ts$2.isCallExpression(node) && ts$2.isIdentifier(node.expression) && node.expression.text === "defineSchema") {
3529
3548
  const firstArg = node.arguments[0];
3530
- if (firstArg && ts.isObjectLiteralExpression(firstArg) && !defineSchemaObject) defineSchemaObject = {
3549
+ if (firstArg && ts$2.isObjectLiteralExpression(firstArg) && !defineSchemaObject) defineSchemaObject = {
3531
3550
  object: firstArg,
3532
3551
  sourceFile,
3533
3552
  statementStart
3534
3553
  };
3535
3554
  }
3536
- ts.forEachChild(node, (child) => visit(child, statementStart));
3555
+ ts$2.forEachChild(node, (child) => visit(child, statementStart));
3537
3556
  };
3538
3557
  for (const statement of sourceFile.statements) visit(statement, statement.getStart(sourceFile));
3539
3558
  return defineSchemaObject;
@@ -3542,18 +3561,18 @@ const findRelationsCall = (source) => {
3542
3561
  const sourceFile = parseSource(source);
3543
3562
  let result = null;
3544
3563
  const visit = (node) => {
3545
- if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && node.expression.name.text === "relations") {
3564
+ if (ts$2.isCallExpression(node) && ts$2.isPropertyAccessExpression(node.expression) && node.expression.name.text === "relations") {
3546
3565
  const firstArg = node.arguments[0];
3547
- if (firstArg && ts.isArrowFunction(firstArg)) {
3548
- const body = ts.isParenthesizedExpression(firstArg.body) ? firstArg.body.expression : firstArg.body;
3549
- if (ts.isObjectLiteralExpression(body) && !result) result = {
3566
+ if (firstArg && ts$2.isArrowFunction(firstArg)) {
3567
+ const body = ts$2.isParenthesizedExpression(firstArg.body) ? firstArg.body.expression : firstArg.body;
3568
+ if (ts$2.isObjectLiteralExpression(body) && !result) result = {
3550
3569
  call: node,
3551
3570
  object: body,
3552
3571
  sourceFile
3553
3572
  };
3554
3573
  }
3555
3574
  }
3556
- ts.forEachChild(node, visit);
3575
+ ts$2.forEachChild(node, visit);
3557
3576
  };
3558
3577
  visit(sourceFile);
3559
3578
  return result;
@@ -3562,36 +3581,36 @@ const hasStandaloneDefineRelations = (source) => {
3562
3581
  const sourceFile = parseSource(source);
3563
3582
  let found = false;
3564
3583
  const visit = (node) => {
3565
- if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === "defineRelations") {
3584
+ if (ts$2.isCallExpression(node) && ts$2.isIdentifier(node.expression) && node.expression.text === "defineRelations") {
3566
3585
  found = true;
3567
3586
  return;
3568
3587
  }
3569
- if (!found) ts.forEachChild(node, visit);
3588
+ if (!found) ts$2.forEachChild(node, visit);
3570
3589
  };
3571
3590
  visit(sourceFile);
3572
3591
  return found;
3573
3592
  };
3574
3593
  const getArrayLiteralFromExpression = (expression) => {
3575
- if (ts.isArrayLiteralExpression(expression)) return expression;
3576
- if (ts.isParenthesizedExpression(expression) && ts.isArrayLiteralExpression(expression.expression)) return expression.expression;
3594
+ if (ts$2.isArrayLiteralExpression(expression)) return expression;
3595
+ if (ts$2.isParenthesizedExpression(expression) && ts$2.isArrayLiteralExpression(expression.expression)) return expression.expression;
3577
3596
  return null;
3578
3597
  };
3579
3598
  const readTableDeclarationInfo = (source, tableKey) => {
3580
3599
  const sourceFile = parseSource(source);
3581
3600
  for (const statement of sourceFile.statements) {
3582
- if (!ts.isVariableStatement(statement)) continue;
3601
+ if (!ts$2.isVariableStatement(statement)) continue;
3583
3602
  for (const declaration of statement.declarationList.declarations) {
3584
- if (!ts.isIdentifier(declaration.name) || !declaration.initializer || !ts.isCallExpression(declaration.initializer) || !ts.isIdentifier(declaration.initializer.expression) || declaration.initializer.expression.text !== "convexTable") continue;
3603
+ if (!ts$2.isIdentifier(declaration.name) || !declaration.initializer || !ts$2.isCallExpression(declaration.initializer) || !ts$2.isIdentifier(declaration.initializer.expression) || declaration.initializer.expression.text !== "convexTable") continue;
3585
3604
  const firstArg = declaration.initializer.arguments[0];
3586
3605
  const secondArg = declaration.initializer.arguments[1];
3587
- if (!firstArg || !secondArg || !isStringLiteralLike(firstArg) || firstArg.text !== tableKey || !ts.isObjectLiteralExpression(secondArg)) continue;
3606
+ if (!firstArg || !secondArg || !isStringLiteralLike(firstArg) || firstArg.text !== tableKey || !ts$2.isObjectLiteralExpression(secondArg)) continue;
3588
3607
  const thirdArg = declaration.initializer.arguments[2];
3589
3608
  let indexEntries = null;
3590
3609
  let indexParamName = null;
3591
- if (thirdArg && ts.isArrowFunction(thirdArg) && thirdArg.parameters[0] && ts.isIdentifier(thirdArg.parameters[0].name)) {
3592
- const arrayLiteral = ts.isBlock(thirdArg.body) ? null : getArrayLiteralFromExpression(thirdArg.body);
3610
+ if (thirdArg && ts$2.isArrowFunction(thirdArg) && thirdArg.parameters[0] && ts$2.isIdentifier(thirdArg.parameters[0].name)) {
3611
+ const arrayLiteral = ts$2.isBlock(thirdArg.body) ? null : getArrayLiteralFromExpression(thirdArg.body);
3593
3612
  if (arrayLiteral) {
3594
- indexEntries = arrayLiteral.elements.filter((element) => ts.isExpression(element));
3613
+ indexEntries = arrayLiteral.elements.filter((element) => ts$2.isExpression(element));
3595
3614
  indexParamName = thirdArg.parameters[0].name.text;
3596
3615
  }
3597
3616
  }
@@ -3619,11 +3638,11 @@ const parseUnitTableDeclaration = (unit) => {
3619
3638
  const readPropertyObject = (source, expectedKey) => {
3620
3639
  const sourceFile = parseSource(`const object = {${source.trim()}};`);
3621
3640
  const statement = sourceFile.statements[0];
3622
- if (!statement || !ts.isVariableStatement(statement)) return null;
3641
+ if (!statement || !ts$2.isVariableStatement(statement)) return null;
3623
3642
  const declaration = statement.declarationList.declarations[0];
3624
- if (!declaration?.initializer || !ts.isObjectLiteralExpression(declaration.initializer)) return null;
3643
+ if (!declaration?.initializer || !ts$2.isObjectLiteralExpression(declaration.initializer)) return null;
3625
3644
  const property = declaration.initializer.properties[0];
3626
- if (!property || !ts.isPropertyAssignment(property) || !property.name || !ts.isObjectLiteralExpression(property.initializer)) return null;
3645
+ if (!property || !ts$2.isPropertyAssignment(property) || !property.name || !ts$2.isObjectLiteralExpression(property.initializer)) return null;
3627
3646
  const propertyName = getPropertyName(property);
3628
3647
  if (expectedKey && propertyName !== expectedKey) return null;
3629
3648
  return {
@@ -3639,21 +3658,21 @@ const getObjectPropertyMap = (object, _sourceFile) => new Map(object.properties.
3639
3658
  }));
3640
3659
  const getFieldRootSignature = (expression, sourceFile) => {
3641
3660
  let current = expression;
3642
- while (ts.isCallExpression(current) && ts.isPropertyAccessExpression(current.expression)) current = current.expression.expression;
3643
- return ts.isCallExpression(current) ? renderNode(current, sourceFile) : null;
3661
+ while (ts$2.isCallExpression(current) && ts$2.isPropertyAccessExpression(current.expression)) current = current.expression.expression;
3662
+ return ts$2.isCallExpression(current) ? renderNode(current, sourceFile) : null;
3644
3663
  };
3645
3664
  const isCompatibleFieldProperty = (existingProperty, existingSourceFile, desiredProperty, desiredSourceFile) => {
3646
- if (!ts.isPropertyAssignment(existingProperty) || !ts.isPropertyAssignment(desiredProperty)) return false;
3665
+ if (!ts$2.isPropertyAssignment(existingProperty) || !ts$2.isPropertyAssignment(desiredProperty)) return false;
3647
3666
  if (renderNode(existingProperty, existingSourceFile) === renderNode(desiredProperty, desiredSourceFile)) return true;
3648
3667
  const existingSignature = getFieldRootSignature(existingProperty.initializer, existingSourceFile);
3649
3668
  const desiredSignature = getFieldRootSignature(desiredProperty.initializer, desiredSourceFile);
3650
3669
  return typeof existingSignature === "string" && existingSignature === desiredSignature;
3651
3670
  };
3652
3671
  const getRelationCompatibilitySignature = (property, sourceFile) => {
3653
- if (!ts.isPropertyAssignment(property) || !ts.isCallExpression(property.initializer)) return null;
3672
+ if (!ts$2.isPropertyAssignment(property) || !ts$2.isCallExpression(property.initializer)) return null;
3654
3673
  const relationKind = renderNormalizedExpression(property.initializer.expression, sourceFile, {});
3655
3674
  const firstArg = property.initializer.arguments[0];
3656
- if (!firstArg || !ts.isObjectLiteralExpression(firstArg)) return relationKind;
3675
+ if (!firstArg || !ts$2.isObjectLiteralExpression(firstArg)) return relationKind;
3657
3676
  const propertyMap = getObjectPropertyMap(firstArg, sourceFile);
3658
3677
  const from = propertyMap.get("from");
3659
3678
  const to = propertyMap.get("to");
@@ -3665,16 +3684,16 @@ const getRelationCompatibilitySignature = (property, sourceFile) => {
3665
3684
  };
3666
3685
  const getIndexIdentity = (expression, sourceFile) => {
3667
3686
  let current = expression;
3668
- while (ts.isCallExpression(current) && ts.isPropertyAccessExpression(current.expression)) current = current.expression.expression;
3669
- if (ts.isCallExpression(current) && ts.isIdentifier(current.expression) && current.arguments[0] && isStringLiteralLike(current.arguments[0])) return `${current.expression.text}:${current.arguments[0].text}`;
3687
+ while (ts$2.isCallExpression(current) && ts$2.isPropertyAccessExpression(current.expression)) current = current.expression.expression;
3688
+ if (ts$2.isCallExpression(current) && ts$2.isIdentifier(current.expression) && current.arguments[0] && isStringLiteralLike(current.arguments[0])) return `${current.expression.text}:${current.arguments[0].text}`;
3670
3689
  return renderNode(current, sourceFile);
3671
3690
  };
3672
3691
  const renderNormalizedExpression = (node, sourceFile, replacements) => {
3673
- if (ts.isIdentifier(node)) return replacements[node.text] ?? node.text;
3692
+ if (ts$2.isIdentifier(node)) return replacements[node.text] ?? node.text;
3674
3693
  if (isStringLiteralLike(node)) return JSON.stringify(node.text);
3675
- if (ts.isPropertyAccessExpression(node)) return `${renderNormalizedExpression(node.expression, sourceFile, replacements)}.${node.name.text}`;
3676
- if (ts.isCallExpression(node)) return `${renderNormalizedExpression(node.expression, sourceFile, replacements)}(${node.arguments.map((argument) => renderNormalizedExpression(argument, sourceFile, replacements)).join(",")})`;
3677
- if (ts.isParenthesizedExpression(node)) return `(${renderNormalizedExpression(node.expression, sourceFile, replacements)})`;
3694
+ if (ts$2.isPropertyAccessExpression(node)) return `${renderNormalizedExpression(node.expression, sourceFile, replacements)}.${node.name.text}`;
3695
+ if (ts$2.isCallExpression(node)) return `${renderNormalizedExpression(node.expression, sourceFile, replacements)}(${node.arguments.map((argument) => renderNormalizedExpression(argument, sourceFile, replacements)).join(",")})`;
3696
+ if (ts$2.isParenthesizedExpression(node)) return `(${renderNormalizedExpression(node.expression, sourceFile, replacements)})`;
3678
3697
  return renderNode(node, sourceFile);
3679
3698
  };
3680
3699
  const mergeNamedEntries = (params) => {
@@ -3852,7 +3871,7 @@ const findRelationsInsertIndex = (source) => {
3852
3871
  const mergeRelationProperty = (params) => {
3853
3872
  const desiredInfo = readPropertyObject(params.desiredRelation, params.tableKey);
3854
3873
  if (!desiredInfo) throw new Error(`Schema patch error: expected relation block for "${params.tableKey}".`);
3855
- if (!ts.isPropertyAssignment(params.existingProperty) || !ts.isObjectLiteralExpression(params.existingProperty.initializer)) throw new Error(`Schema patch conflict in ${params.displayPath}: ${params.pluginKey} relations for table "${params.tableKey}" are incompatible with the existing schema.`);
3874
+ if (!ts$2.isPropertyAssignment(params.existingProperty) || !ts$2.isObjectLiteralExpression(params.existingProperty.initializer)) throw new Error(`Schema patch conflict in ${params.displayPath}: ${params.pluginKey} relations for table "${params.tableKey}" are incompatible with the existing schema.`);
3856
3875
  const existingPropertyName = params.existingProperty.name.getText(params.existingSourceFile);
3857
3876
  const nestedMerge = mergeNamedEntries({
3858
3877
  compatibilityLabel: "relation",
@@ -3920,9 +3939,9 @@ const updateRelationsObject = (source, params) => {
3920
3939
  const printCanonicalObjectEntry = (content) => {
3921
3940
  const sourceFile = parseSource(`const object = {\n${content.trim()}\n};`);
3922
3941
  const statement = sourceFile.statements[0];
3923
- if (!statement || !ts.isVariableStatement(statement)) return content.trim();
3942
+ if (!statement || !ts$2.isVariableStatement(statement)) return content.trim();
3924
3943
  const declaration = statement.declarationList.declarations[0];
3925
- if (!declaration?.initializer || !ts.isObjectLiteralExpression(declaration.initializer)) return content.trim();
3944
+ if (!declaration?.initializer || !ts$2.isObjectLiteralExpression(declaration.initializer)) return content.trim();
3926
3945
  const property = declaration.initializer.properties[0];
3927
3946
  if (!property) return content.trim();
3928
3947
  return renderNode(property, sourceFile);
@@ -3968,9 +3987,9 @@ const readManagedChecksumFromSource = (source, unit) => {
3968
3987
  const mergeOrmImports = (source, importNames) => {
3969
3988
  if (importNames.length === 0) return source;
3970
3989
  const sourceFile = parseSource(source);
3971
- const ormImport = sourceFile.statements.find((statement) => ts.isImportDeclaration(statement) && isStringLiteralLike(statement.moduleSpecifier) && statement.moduleSpecifier.text === "kitcn/orm");
3990
+ const ormImport = sourceFile.statements.find((statement) => ts$2.isImportDeclaration(statement) && isStringLiteralLike(statement.moduleSpecifier) && statement.moduleSpecifier.text === "kitcn/orm");
3972
3991
  if (!ormImport) return `${`import {\n ${[...new Set(importNames)].sort().join(",\n ")},\n} from 'kitcn/orm';\n\n`}${source}`;
3973
- if (!ormImport.importClause?.namedBindings || !ts.isNamedImports(ormImport.importClause.namedBindings)) return source;
3992
+ if (!ormImport.importClause?.namedBindings || !ts$2.isNamedImports(ormImport.importClause.namedBindings)) return source;
3974
3993
  const existingImports = ormImport.importClause.namedBindings.elements.map((element) => element.getText(sourceFile));
3975
3994
  const nextImport = `import {\n ${[...new Set([...existingImports, ...importNames])].sort((a, b) => a.localeCompare(b)).join(",\n ")},\n} from 'kitcn/orm';`;
3976
3995
  return replaceRange(source, ormImport.getStart(sourceFile), ormImport.end, nextImport);
@@ -5125,6 +5144,7 @@ const DEFAULT_AUTH_SCHEMA_ENV = {
5125
5144
  };
5126
5145
  const loadGetAuthTables = async () => (await import("better-auth/db")).getAuthTables;
5127
5146
  const loadConvexAuthPlugin = async () => (await import("@convex-dev/better-auth/plugins")).convex;
5147
+ const ts$1 = createTypeScriptProxy();
5128
5148
  const withAuthSchemaEnv = async (run) => {
5129
5149
  const globalScope = globalThis;
5130
5150
  const originalEntries = Object.fromEntries(Object.keys(DEFAULT_AUTH_SCHEMA_ENV).map((key) => [key, process.env[key]]));
@@ -5157,36 +5177,36 @@ const renderManagedAuthSchemaFile = async ({ authOptions, kind, outputPath }) =>
5157
5177
  })).code;
5158
5178
  };
5159
5179
  const parseRootSchemaUnitsFromExtension = (source) => {
5160
- const sourceFile = ts.createSourceFile("auth-schema.ts", source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
5161
- const ormImport = sourceFile.statements.find((statement) => ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier) && statement.moduleSpecifier.text === "kitcn/orm");
5162
- const importNames = ormImport && ts.isImportDeclaration(ormImport) && ormImport.importClause?.namedBindings && ts.isNamedImports(ormImport.importClause.namedBindings) ? ormImport.importClause.namedBindings.elements.map((element) => element.getText(sourceFile)).filter((name) => name !== "defineSchemaExtension") : [];
5180
+ const sourceFile = ts$1.createSourceFile("auth-schema.ts", source, ts$1.ScriptTarget.Latest, true, ts$1.ScriptKind.TS);
5181
+ const ormImport = sourceFile.statements.find((statement) => ts$1.isImportDeclaration(statement) && ts$1.isStringLiteral(statement.moduleSpecifier) && statement.moduleSpecifier.text === "kitcn/orm");
5182
+ const importNames = ormImport && ts$1.isImportDeclaration(ormImport) && ormImport.importClause?.namedBindings && ts$1.isNamedImports(ormImport.importClause.namedBindings) ? ormImport.importClause.namedBindings.elements.map((element) => element.getText(sourceFile)).filter((name) => name !== "defineSchemaExtension") : [];
5163
5183
  const declarations = /* @__PURE__ */ new Map();
5164
5184
  for (const statement of sourceFile.statements) {
5165
- if (!ts.isVariableStatement(statement)) continue;
5166
- for (const declaration of statement.declarationList.declarations) if (declaration.initializer && ts.isCallExpression(declaration.initializer) && ts.isIdentifier(declaration.initializer.expression) && declaration.initializer.expression.text === "convexTable") {
5185
+ if (!ts$1.isVariableStatement(statement)) continue;
5186
+ for (const declaration of statement.declarationList.declarations) if (declaration.initializer && ts$1.isCallExpression(declaration.initializer) && ts$1.isIdentifier(declaration.initializer.expression) && declaration.initializer.expression.text === "convexTable") {
5167
5187
  const firstArg = declaration.initializer.arguments[0];
5168
- if (firstArg && (ts.isStringLiteral(firstArg) || ts.isNoSubstitutionTemplateLiteral(firstArg))) declarations.set(firstArg.text, statement.getText(sourceFile));
5188
+ if (firstArg && (ts$1.isStringLiteral(firstArg) || ts$1.isNoSubstitutionTemplateLiteral(firstArg))) declarations.set(firstArg.text, statement.getText(sourceFile));
5169
5189
  }
5170
5190
  }
5171
5191
  let registrationObject = null;
5172
5192
  let relationObject = null;
5173
5193
  const visit = (node) => {
5174
- if (ts.isCallExpression(node)) {
5175
- if (ts.isIdentifier(node.expression) && node.expression.text === "defineSchemaExtension") {
5194
+ if (ts$1.isCallExpression(node)) {
5195
+ if (ts$1.isIdentifier(node.expression) && node.expression.text === "defineSchemaExtension") {
5176
5196
  const secondArg = node.arguments[1];
5177
- if (secondArg && ts.isObjectLiteralExpression(secondArg) && !registrationObject) registrationObject = secondArg;
5197
+ if (secondArg && ts$1.isObjectLiteralExpression(secondArg) && !registrationObject) registrationObject = secondArg;
5178
5198
  }
5179
- if (ts.isPropertyAccessExpression(node.expression) && node.expression.name.text === "relations" && ts.isCallExpression(node.expression.expression) && ts.isIdentifier(node.expression.expression.expression) && node.expression.expression.expression.text === "defineSchemaExtension") {
5199
+ if (ts$1.isPropertyAccessExpression(node.expression) && node.expression.name.text === "relations" && ts$1.isCallExpression(node.expression.expression) && ts$1.isIdentifier(node.expression.expression.expression) && node.expression.expression.expression.text === "defineSchemaExtension") {
5180
5200
  const secondArg = node.expression.expression.arguments[1];
5181
- if (secondArg && ts.isObjectLiteralExpression(secondArg) && !registrationObject) registrationObject = secondArg;
5201
+ if (secondArg && ts$1.isObjectLiteralExpression(secondArg) && !registrationObject) registrationObject = secondArg;
5182
5202
  const firstArg = node.arguments[0];
5183
- if (firstArg && ts.isArrowFunction(firstArg)) {
5184
- const body = ts.isParenthesizedExpression(firstArg.body) ? firstArg.body.expression : firstArg.body;
5185
- if (ts.isObjectLiteralExpression(body) && !relationObject) relationObject = body;
5203
+ if (firstArg && ts$1.isArrowFunction(firstArg)) {
5204
+ const body = ts$1.isParenthesizedExpression(firstArg.body) ? firstArg.body.expression : firstArg.body;
5205
+ if (ts$1.isObjectLiteralExpression(body) && !relationObject) relationObject = body;
5186
5206
  }
5187
5207
  }
5188
5208
  }
5189
- ts.forEachChild(node, visit);
5209
+ ts$1.forEachChild(node, visit);
5190
5210
  };
5191
5211
  visit(sourceFile);
5192
5212
  if (!registrationObject) return [];
@@ -5194,15 +5214,15 @@ const parseRootSchemaUnitsFromExtension = (source) => {
5194
5214
  const relationObjectLiteral = relationObject;
5195
5215
  const relationMap = /* @__PURE__ */ new Map();
5196
5216
  const relationProperties = relationObjectLiteral?.properties ?? [];
5197
- for (const property of relationProperties) if (ts.isPropertyAssignment(property) && (ts.isIdentifier(property.name) || ts.isStringLiteral(property.name))) {
5198
- const key = ts.isIdentifier(property.name) ? property.name.text : property.name.text;
5217
+ for (const property of relationProperties) if (ts$1.isPropertyAssignment(property) && (ts$1.isIdentifier(property.name) || ts$1.isStringLiteral(property.name))) {
5218
+ const key = ts$1.isIdentifier(property.name) ? property.name.text : property.name.text;
5199
5219
  relationMap.set(key, property.getText(sourceFile));
5200
5220
  }
5201
5221
  return registrationObjectLiteral.properties.flatMap((property) => {
5202
- if (!ts.isPropertyAssignment(property) && !ts.isShorthandPropertyAssignment(property)) return [];
5222
+ if (!ts$1.isPropertyAssignment(property) && !ts$1.isShorthandPropertyAssignment(property)) return [];
5203
5223
  const propertyName = property.name;
5204
- if (!ts.isIdentifier(propertyName) && !ts.isStringLiteral(propertyName)) return [];
5205
- const key = ts.isIdentifier(propertyName) ? propertyName.text : propertyName.text;
5224
+ if (!ts$1.isIdentifier(propertyName) && !ts$1.isStringLiteral(propertyName)) return [];
5225
+ const key = ts$1.isIdentifier(propertyName) ? propertyName.text : propertyName.text;
5206
5226
  const declaration = declarations.get(key);
5207
5227
  if (!declaration) return [];
5208
5228
  return [{
@@ -8250,6 +8270,7 @@ const createSpinner = (text, options = {}) => {
8250
8270
  const __filename$2 = fileURLToPath(import.meta.url);
8251
8271
  const __dirname$1 = dirname(__filename$2);
8252
8272
  let ownVersion;
8273
+ const ts = createTypeScriptProxy();
8253
8274
  const require = createRequire(import.meta.url);
8254
8275
  const realConvex = join(dirname(require.resolve("convex/package.json")), "bin/main.js");
8255
8276
  const MISSING_BACKFILL_FUNCTION_RE = /could not find function|function .* was not found|unknown function/i;
@@ -173,10 +173,18 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
173
173
  };
174
174
  }, Promise<any>>;
175
175
  deleteMany: convex_server0.RegisteredMutation<"internal", {
176
+ paginationOpts: {
177
+ id?: number;
178
+ endCursor?: string | null;
179
+ maximumRowsRead?: number;
180
+ maximumBytesRead?: number;
181
+ numItems: number;
182
+ cursor: string | null;
183
+ };
176
184
  input: {
177
185
  where?: {
186
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
178
187
  connector?: "AND" | "OR" | undefined;
179
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
180
188
  value: string | number | boolean | string[] | number[] | null;
181
189
  field: string;
182
190
  }[] | undefined;
@@ -185,14 +193,6 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
185
193
  where?: any[] | undefined;
186
194
  model: string;
187
195
  };
188
- paginationOpts: {
189
- id?: number;
190
- endCursor?: string | null;
191
- maximumRowsRead?: number;
192
- maximumBytesRead?: number;
193
- numItems: number;
194
- cursor: string | null;
195
- };
196
196
  }, Promise<{
197
197
  count: number;
198
198
  ids: any[];
@@ -204,8 +204,8 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
204
204
  deleteOne: convex_server0.RegisteredMutation<"internal", {
205
205
  input: {
206
206
  where?: {
207
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
207
208
  connector?: "AND" | "OR" | undefined;
208
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
209
209
  value: string | number | boolean | string[] | number[] | null;
210
210
  field: string;
211
211
  }[] | undefined;
@@ -216,20 +216,19 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
216
216
  };
217
217
  }, Promise<Record<string, unknown> | undefined>>;
218
218
  findMany: convex_server0.RegisteredQuery<"internal", {
219
+ limit?: number | undefined;
219
220
  join?: any;
220
221
  where?: {
222
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
221
223
  connector?: "AND" | "OR" | undefined;
222
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
223
224
  value: string | number | boolean | string[] | number[] | null;
224
225
  field: string;
225
226
  }[] | undefined;
226
- limit?: number | undefined;
227
227
  offset?: number | undefined;
228
228
  sortBy?: {
229
229
  field: string;
230
230
  direction: "asc" | "desc";
231
231
  } | undefined;
232
- model: string;
233
232
  paginationOpts: {
234
233
  id?: number;
235
234
  endCursor?: string | null;
@@ -238,46 +237,47 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
238
237
  numItems: number;
239
238
  cursor: string | null;
240
239
  };
240
+ model: string;
241
241
  }, Promise<convex_server0.PaginationResult<convex_server0.GenericDocument>>>;
242
242
  findOne: convex_server0.RegisteredQuery<"internal", {
243
243
  join?: any;
244
- select?: string[] | undefined;
245
244
  where?: {
245
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
246
246
  connector?: "AND" | "OR" | undefined;
247
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
248
247
  value: string | number | boolean | string[] | number[] | null;
249
248
  field: string;
250
249
  }[] | undefined;
250
+ select?: string[] | undefined;
251
251
  model: string;
252
252
  }, Promise<convex_server0.GenericDocument | null>>;
253
253
  getLatestJwks: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
254
254
  rotateKeys: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
255
255
  updateMany: convex_server0.RegisteredMutation<"internal", {
256
+ paginationOpts: {
257
+ id?: number;
258
+ endCursor?: string | null;
259
+ maximumRowsRead?: number;
260
+ maximumBytesRead?: number;
261
+ numItems: number;
262
+ cursor: string | null;
263
+ };
256
264
  input: {
257
265
  where?: {
266
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
258
267
  connector?: "AND" | "OR" | undefined;
259
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
260
268
  value: string | number | boolean | string[] | number[] | null;
261
269
  field: string;
262
270
  }[] | undefined;
263
- model: string;
264
271
  update: {
265
272
  [x: string]: unknown;
266
273
  [x: number]: unknown;
267
274
  [x: symbol]: unknown;
268
275
  };
276
+ model: string;
269
277
  } | {
270
278
  where?: any[] | undefined;
271
- model: string;
272
279
  update: any;
273
- };
274
- paginationOpts: {
275
- id?: number;
276
- endCursor?: string | null;
277
- maximumRowsRead?: number;
278
- maximumBytesRead?: number;
279
- numItems: number;
280
- cursor: string | null;
280
+ model: string;
281
281
  };
282
282
  }, Promise<{
283
283
  count: number;
@@ -290,21 +290,21 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
290
290
  updateOne: convex_server0.RegisteredMutation<"internal", {
291
291
  input: {
292
292
  where?: {
293
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
293
294
  connector?: "AND" | "OR" | undefined;
294
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
295
295
  value: string | number | boolean | string[] | number[] | null;
296
296
  field: string;
297
297
  }[] | undefined;
298
- model: string;
299
298
  update: {
300
299
  [x: string]: unknown;
301
300
  [x: number]: unknown;
302
301
  [x: symbol]: unknown;
303
302
  };
303
+ model: string;
304
304
  } | {
305
305
  where?: any[] | undefined;
306
- model: string;
307
306
  update: any;
307
+ model: string;
308
308
  };
309
309
  }, Promise<any>>;
310
310
  };
@@ -1,4 +1,4 @@
1
- import { $ as GenericOrmCtx$1, $n as unique, $r as endsWith, $t as ManyConfig, A as ConvexDateMode, An as ConvexRankIndexBuilder, Ar as ReturningResult, At as MigrationManifestEntry, B as ConvexBytesBuilderInitial, Bn as rankIndex, Br as OrmSchemaRelations, Bt as defineMigration, C as ConvexNumberBuilderInitial, Ci as ColumnBuilderWithTableName, Cn as RlsRole, Cr as MutationReturning, Ct as MigrationStatusArgs, D as id, Di as IsPrimaryKey, Dn as ConvexAggregateIndexBuilderOn, Dr as PaginatedResult, Dt as MigrationDoc, E as ConvexIdBuilderInitial, Ei as HasDefault, En as ConvexAggregateIndexBuilder, Er as OrderDirection, Et as MigrationDirection, F as custom, Fn as ConvexVectorIndexBuilder, Fr as unsetToken, Ft as MigrationStateMap, G as ConvexBigIntBuilder, Gn as ConvexCheckConfig, Gr as ExpressionVisitor, Gt as OrmReader$1, H as ConvexBooleanBuilder, Hn as uniqueIndex, Hr as TableName, Ht as detectMigrationDrift, I as json, In as ConvexVectorIndexBuilderOn, Ir as Brand, It as MigrationStep, J as CountBackfillChunkArgs, Jn as ConvexUniqueConstraintBuilder, Jr as LogicalExpression, Jt as RlsMode, K as ConvexBigIntBuilderInitial, Kn as ConvexForeignKeyBuilder, Kr as FieldReference, Kt as OrmWriter$1, L as objectOf, Ln as ConvexVectorIndexConfig, Lr as Columns, Lt as MigrationTableName, M as ConvexCustomBuilder, Mn as ConvexSearchIndexBuilder, Mr as UpdateSet, Mt as MigrationPlan, N as ConvexCustomBuilderInitial, Nn as ConvexSearchIndexBuilderOn, Nr as VectorQueryConfig, Nt as MigrationRunStatus, O as ConvexDateBuilder, Oi as IsUnique, On as ConvexIndexBuilder, Or as PredicateWhereIndexConfig, Ot as MigrationDocContext, P as arrayOf, Pn as ConvexSearchIndexConfig, Pr as VectorSearchProvider, Pt as MigrationSet, Q as GenericOrm$1, Qn as foreignKey, Qr as contains, Qt as ExtractTablesWithRelations, R as unionOf, Rn as aggregateIndex, Rr as OrmSchemaExtensionTables, Rt as MigrationWriteMode, S as ConvexNumberBuilder, Si as ColumnBuilderTypeConfig, Sn as rlsPolicy, Sr as MutationResult, St as MigrationRunChunkArgs, T as ConvexIdBuilder, Ti as DrizzleEntity, Tn as rlsRole, Tr as OrderByClause, Tt as MigrationDefinition, U as ConvexBooleanBuilderInitial, Un as vectorIndex, Ur as SystemFields, Ut as DatabaseWithMutations, V as bytes, Vn as searchIndex, Vr as OrmSchemaTriggers, Vt as defineMigrationSet, W as boolean, Wn as ConvexCheckBuilder, Wr as BinaryExpression, Wt as DatabaseWithQuery, X as CountBackfillStatusArgs, Xn as ConvexUniqueConstraintConfig, Xr as and, Xt as extractRelationsConfig, Y as CountBackfillKickoffArgs, Yn as ConvexUniqueConstraintBuilderOn, Yr as UnaryExpression, Yt as EdgeMetadata, Z as CreateOrmOptions, Zn as check, Zr as between, Zt as ExtractTablesFromSchema, _ as ConvexTimestampMode, _i as startsWith, _n as deletion, _r as MutationExecuteConfig, _t as OrmTriggerContext, a as requireSchemaRelations, ai as inArray, an as TablesRelationalConfig, ar as AggregateResult, at as OrmWriterCtx, b as ConvexTextEnumBuilderInitial, bi as ColumnBuilderBaseConfig, bn as RlsPolicyConfig, br as MutationPaginateConfig, bt as MigrationCancelArgs, c as TableConfigResult, ci as isNull, cn as ConvexDeletionBuilder, cr as CountConfig, ct as ScheduledMutationBatchArgs, d as OrmNotFoundError, di as lte, dn as ConvexTableWithColumns, dr as FilterOperators, dt as scheduledDeleteFactory, ei as eq, en as OneConfig, er as ConvexTextBuilder, et as OrmApiResult, f as ConvexVectorBuilder, fi as ne, fn as DiscriminatorBuilderConfig, fr as GetColumnData, ft as SchemaExtension, g as ConvexTimestampBuilderInitial, gi as or, gn as convexTable, gr as InsertValue, gt as OrmTriggerChange, h as ConvexTimestampBuilder, hi as notInArray, hn as TableConfig, hr as InferSelectModel, ht as OrmTableTriggers, i as getSchemaTriggers, ii as ilike, in as TableRelationalConfig, ir as AggregateFieldValue, it as OrmReaderCtx, j as date, jn as ConvexRankIndexBuilderOn, jr as ReturningSelection, jt as MigrationMigrateOne, k as ConvexDateBuilderInitial, ki as NotNull, kn as ConvexIndexBuilderOn, kr as ReturningAll, kt as MigrationDriftIssue, l as getTableColumns, li as like, ln as ConvexDeletionConfig, lr as CountResult, lt as scheduledMutationBatchFactory, m as vector, mi as notBetween, mn as OrmLifecycleOperation, mr as InferModelFromColumns, mt as OrmBeforeResult, n as defineSchema, ni as gt, nn as RelationsBuilderColumnBase, nr as text, nt as OrmClientWithApi$1, o as asc, oi as isFieldReference, on as defineRelations, or as BuildQueryResult, ot as ResolveOrmSchema, p as ConvexVectorBuilderInitial, pi as not, pn as OrmLifecycleChange, pr as InferInsertModel, pt as defineSchemaExtension, q as bigint, qn as ConvexForeignKeyConfig, qr as FilterExpression, qt as RlsContext, r as getSchemaRelations, ri as gte, rn as RelationsBuilderColumnConfig, rr as AggregateConfig, rt as OrmFunctions, s as desc, si as isNotNull, sn as defineRelationsPart, sr as BuildRelationResult, st as createOrm, t as WhereClauseResult, ti as fieldRef, tn as RelationsBuilder, tr as ConvexTextBuilderInitial, tt as OrmClientBase$1, u as getTableConfig, ui as lt, un as ConvexTable, ur as DBQueryConfig, ut as ScheduledDeleteArgs, v as timestamp, vi as AnyColumn, vn as discriminator, vr as MutationExecuteResult, vt as OrmTriggers, w as integer, wi as ColumnDataType, wn as RlsRoleConfig, wr as MutationRunMode, wt as MigrationAppliedState, x as textEnum, xi as ColumnBuilderRuntimeConfig, xn as RlsPolicyToOption, xr as MutationPaginatedResult, xt as MigrationRunArgs, y as ConvexTextEnumBuilder, yi as ColumnBuilder, yn as RlsPolicy, yr as MutationExecutionMode, yt as defineTriggers, z as ConvexBytesBuilder, zn as index, zr as OrmSchemaExtensions, zt as buildMigrationPlan } from "../where-clause-compiler-DdjN63Io.js";
1
+ import { $ as GenericOrmCtx$1, $n as unique, $r as endsWith, $t as ManyConfig, A as ConvexDateMode, An as ConvexRankIndexBuilder, Ar as ReturningResult, At as MigrationManifestEntry, B as ConvexBytesBuilderInitial, Bn as rankIndex, Br as OrmSchemaRelations, Bt as defineMigration, C as ConvexNumberBuilderInitial, Ci as ColumnBuilderWithTableName, Cn as RlsRole, Cr as MutationReturning, Ct as MigrationStatusArgs, D as id, Di as IsPrimaryKey, Dn as ConvexAggregateIndexBuilderOn, Dr as PaginatedResult, Dt as MigrationDoc, E as ConvexIdBuilderInitial, Ei as HasDefault, En as ConvexAggregateIndexBuilder, Er as OrderDirection, Et as MigrationDirection, F as custom, Fn as ConvexVectorIndexBuilder, Fr as unsetToken, Ft as MigrationStateMap, G as ConvexBigIntBuilder, Gn as ConvexCheckConfig, Gr as ExpressionVisitor, Gt as OrmReader$1, H as ConvexBooleanBuilder, Hn as uniqueIndex, Hr as TableName, Ht as detectMigrationDrift, I as json, In as ConvexVectorIndexBuilderOn, Ir as Brand, It as MigrationStep, J as CountBackfillChunkArgs, Jn as ConvexUniqueConstraintBuilder, Jr as LogicalExpression, Jt as RlsMode, K as ConvexBigIntBuilderInitial, Kn as ConvexForeignKeyBuilder, Kr as FieldReference, Kt as OrmWriter$1, L as objectOf, Ln as ConvexVectorIndexConfig, Lr as Columns, Lt as MigrationTableName, M as ConvexCustomBuilder, Mn as ConvexSearchIndexBuilder, Mr as UpdateSet, Mt as MigrationPlan, N as ConvexCustomBuilderInitial, Nn as ConvexSearchIndexBuilderOn, Nr as VectorQueryConfig, Nt as MigrationRunStatus, O as ConvexDateBuilder, Oi as IsUnique, On as ConvexIndexBuilder, Or as PredicateWhereIndexConfig, Ot as MigrationDocContext, P as arrayOf, Pn as ConvexSearchIndexConfig, Pr as VectorSearchProvider, Pt as MigrationSet, Q as GenericOrm$1, Qn as foreignKey, Qr as contains, Qt as ExtractTablesWithRelations, R as unionOf, Rn as aggregateIndex, Rr as OrmSchemaExtensionTables, Rt as MigrationWriteMode, S as ConvexNumberBuilder, Si as ColumnBuilderTypeConfig, Sn as rlsPolicy, Sr as MutationResult, St as MigrationRunChunkArgs, T as ConvexIdBuilder, Ti as DrizzleEntity, Tn as rlsRole, Tr as OrderByClause, Tt as MigrationDefinition, U as ConvexBooleanBuilderInitial, Un as vectorIndex, Ur as SystemFields, Ut as DatabaseWithMutations, V as bytes, Vn as searchIndex, Vr as OrmSchemaTriggers, Vt as defineMigrationSet, W as boolean, Wn as ConvexCheckBuilder, Wr as BinaryExpression, Wt as DatabaseWithQuery, X as CountBackfillStatusArgs, Xn as ConvexUniqueConstraintConfig, Xr as and, Xt as extractRelationsConfig, Y as CountBackfillKickoffArgs, Yn as ConvexUniqueConstraintBuilderOn, Yr as UnaryExpression, Yt as EdgeMetadata, Z as CreateOrmOptions, Zn as check, Zr as between, Zt as ExtractTablesFromSchema, _ as ConvexTimestampMode, _i as startsWith, _n as deletion, _r as MutationExecuteConfig, _t as OrmTriggerContext, a as requireSchemaRelations, ai as inArray, an as TablesRelationalConfig, ar as AggregateResult, at as OrmWriterCtx, b as ConvexTextEnumBuilderInitial, bi as ColumnBuilderBaseConfig, bn as RlsPolicyConfig, br as MutationPaginateConfig, bt as MigrationCancelArgs, c as TableConfigResult, ci as isNull, cn as ConvexDeletionBuilder, cr as CountConfig, ct as ScheduledMutationBatchArgs, d as OrmNotFoundError, di as lte, dn as ConvexTableWithColumns, dr as FilterOperators, dt as scheduledDeleteFactory, ei as eq, en as OneConfig, er as ConvexTextBuilder, et as OrmApiResult, f as ConvexVectorBuilder, fi as ne, fn as DiscriminatorBuilderConfig, fr as GetColumnData, ft as SchemaExtension, g as ConvexTimestampBuilderInitial, gi as or, gn as convexTable, gr as InsertValue, gt as OrmTriggerChange, h as ConvexTimestampBuilder, hi as notInArray, hn as TableConfig, hr as InferSelectModel, ht as OrmTableTriggers, i as getSchemaTriggers, ii as ilike, in as TableRelationalConfig, ir as AggregateFieldValue, it as OrmReaderCtx, j as date, jn as ConvexRankIndexBuilderOn, jr as ReturningSelection, jt as MigrationMigrateOne, k as ConvexDateBuilderInitial, ki as NotNull, kn as ConvexIndexBuilderOn, kr as ReturningAll, kt as MigrationDriftIssue, l as getTableColumns, li as like, ln as ConvexDeletionConfig, lr as CountResult, lt as scheduledMutationBatchFactory, m as vector, mi as notBetween, mn as OrmLifecycleOperation, mr as InferModelFromColumns, mt as OrmBeforeResult, n as defineSchema, ni as gt, nn as RelationsBuilderColumnBase, nr as text, nt as OrmClientWithApi$1, o as asc, oi as isFieldReference, on as defineRelations, or as BuildQueryResult, ot as ResolveOrmSchema, p as ConvexVectorBuilderInitial, pi as not, pn as OrmLifecycleChange, pr as InferInsertModel, pt as defineSchemaExtension, q as bigint, qn as ConvexForeignKeyConfig, qr as FilterExpression, qt as RlsContext, r as getSchemaRelations, ri as gte, rn as RelationsBuilderColumnConfig, rr as AggregateConfig, rt as OrmFunctions, s as desc, si as isNotNull, sn as defineRelationsPart, sr as BuildRelationResult, st as createOrm, t as WhereClauseResult, ti as fieldRef, tn as RelationsBuilder, tr as ConvexTextBuilderInitial, tt as OrmClientBase$1, u as getTableConfig, ui as lt, un as ConvexTable, ur as DBQueryConfig, ut as ScheduledDeleteArgs, v as timestamp, vi as AnyColumn, vn as discriminator, vr as MutationExecuteResult, vt as OrmTriggers, w as integer, wi as ColumnDataType, wn as RlsRoleConfig, wr as MutationRunMode, wt as MigrationAppliedState, x as textEnum, xi as ColumnBuilderRuntimeConfig, xn as RlsPolicyToOption, xr as MutationPaginatedResult, xt as MigrationRunArgs, y as ConvexTextEnumBuilder, yi as ColumnBuilder, yn as RlsPolicy, yr as MutationExecutionMode, yt as defineTriggers, z as ConvexBytesBuilder, zn as index, zr as OrmSchemaExtensions, zt as buildMigrationPlan } from "../where-clause-compiler-CuH2JNxb.js";
2
2
  import { i as pretendRequired, n as deprecated, r as pretend } from "../validators-vzRKjBJC.js";
3
3
  import { a as QueryCtxWithPreferredOrmQueryTable, i as QueryCtxWithOrmQueryTable, n as LookupByIdResultByCtx, o as getByIdWithOrmQueryFallback, r as QueryCtxWithOptionalOrmQueryTable, t as DocByCtx } from "../query-context-CFZqIvD7.js";
4
4
  import { DefineSchemaOptions, GenericDatabaseReader, GenericDatabaseWriter, GenericSchema, SchemaDefinition } from "convex/server";
@@ -3992,11 +3992,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
3992
3992
  readonly aggregate_extrema: ConvexTableWithColumns<{
3993
3993
  name: "aggregate_extrema";
3994
3994
  columns: {
3995
- value: ConvexCustomBuilderInitial<"", convex_values0.VAny<any, "required", string>> & {
3996
- _: {
3997
- $type: convex_values0.Value;
3998
- };
3999
- } & {
3995
+ count: ConvexNumberBuilderInitial<""> & {
4000
3996
  _: {
4001
3997
  notNull: true;
4002
3998
  };
@@ -4006,10 +4002,14 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4006
4002
  };
4007
4003
  } & {
4008
4004
  _: {
4009
- fieldName: "value";
4005
+ fieldName: "count";
4010
4006
  };
4011
4007
  };
4012
- count: ConvexNumberBuilderInitial<""> & {
4008
+ value: ConvexCustomBuilderInitial<"", convex_values0.VAny<any, "required", string>> & {
4009
+ _: {
4010
+ $type: convex_values0.Value;
4011
+ };
4012
+ } & {
4013
4013
  _: {
4014
4014
  notNull: true;
4015
4015
  };
@@ -4019,7 +4019,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4019
4019
  };
4020
4020
  } & {
4021
4021
  _: {
4022
- fieldName: "count";
4022
+ fieldName: "value";
4023
4023
  };
4024
4024
  };
4025
4025
  tableKey: ConvexTextBuilderInitial<""> & {
@@ -4398,22 +4398,22 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4398
4398
  readonly migration_state: ConvexTableWithColumns<{
4399
4399
  name: "migration_state";
4400
4400
  columns: {
4401
- cursor: ConvexTextBuilderInitial<""> & {
4401
+ direction: ConvexTextBuilderInitial<""> & {
4402
4402
  _: {
4403
4403
  tableName: "migration_state";
4404
4404
  };
4405
4405
  } & {
4406
4406
  _: {
4407
- fieldName: "cursor";
4407
+ fieldName: "direction";
4408
4408
  };
4409
4409
  };
4410
- direction: ConvexTextBuilderInitial<""> & {
4410
+ cursor: ConvexTextBuilderInitial<""> & {
4411
4411
  _: {
4412
4412
  tableName: "migration_state";
4413
4413
  };
4414
4414
  } & {
4415
4415
  _: {
4416
- fieldName: "direction";
4416
+ fieldName: "cursor";
4417
4417
  };
4418
4418
  };
4419
4419
  status: ConvexTextBuilderInitial<""> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitcn",
3
- "version": "0.12.1",
3
+ "version": "0.12.3",
4
4
  "description": "kitcn - React Query integration and CLI tools for Convex",
5
5
  "keywords": [
6
6
  "convex",
@@ -69,7 +69,7 @@ Use the CLI-first path:
69
69
  npx kitcn add auth --yes
70
70
  ```
71
71
 
72
- If kitcn is not bootstrapped yet, start with `npx kitcn init -t next --yes` for a fresh app or `npx kitcn init --yes` for in-place adoption.
72
+ If kitcn is not bootstrapped yet, start with `npx kitcn@latest init -t next --yes` for a fresh app or `npx kitcn@latest init --yes` for in-place adoption.
73
73
 
74
74
  On local Convex, `add auth --yes` also finishes the first auth bootstrap pass: generated runtime, `BETTER_AUTH_SECRET`, and `JWKS`.
75
75
 
@@ -279,6 +279,12 @@ export const {
279
279
 
280
280
  ### Sign In
281
281
 
282
+ Rule:
283
+
284
+ 1. The standard Next local path assumes `NEXT_PUBLIC_SITE_URL=http://localhost:3000`.
285
+ 2. If the app runs on another port, update `.env.local` `NEXT_PUBLIC_SITE_URL`,
286
+ `convex/.env` `SITE_URL`, and the app dev script together.
287
+
282
288
  **Social:**
283
289
  ```ts
284
290
  const signInSocial = useMutation(useSignInSocialMutationOptions());
@@ -7,10 +7,10 @@ Feature gate: only apply this section if auth is enabled.
7
7
  If kitcn is not bootstrapped yet, start there first:
8
8
 
9
9
  ```bash
10
- bunx kitcn init -t next --yes
10
+ npx kitcn@latest init -t next --yes
11
11
  ```
12
12
 
13
- Use `bunx kitcn init --yes` instead for in-place adoption of the
13
+ Use `npx kitcn@latest init --yes` instead for in-place adoption of the
14
14
  current supported app.
15
15
 
16
16
  Then install auth:
@@ -82,7 +82,7 @@ export default defineAuth(() => ({
82
82
 
83
83
  Canonical rule:
84
84
 
85
- 1. `bunx kitcn init --yes`, `bunx kitcn dev`, and `bunx kitcn add auth --yes` all drive generation of `convex/functions/generated/` when they own the local Convex flow.
85
+ 1. `npx kitcn@latest init --yes`, `bunx kitcn dev`, and `bunx kitcn add auth --yes` all drive generation of `convex/functions/generated/` when they own the local Convex flow.
86
86
  2. `auth.ts` default-exports `defineAuth(() => ({ ...options, triggers }))` imported from `./generated/auth`.
87
87
  3. Import runtime auth contract (`getAuth`, `authClient`, CRUD/triggers, `auth`) from `<functionsDir>/generated/auth`.
88
88
  4. If `auth.ts` is missing or incomplete, codegen still succeeds and generated runtime exports `authEnabled = false` with setup guidance at call time.
@@ -86,7 +86,7 @@ Quickstart path:
86
86
  ```bash
87
87
  mkdir my-app
88
88
  cd my-app
89
- bunx kitcn init -t next --yes
89
+ npx kitcn@latest init -t next --yes
90
90
  ```
91
91
 
92
92
  Then start the long-running backend with `bunx kitcn dev`, run the
@@ -99,19 +99,19 @@ Use the CLI first:
99
99
 
100
100
  ```bash
101
101
  # Adopt the current supported app in place
102
- bunx kitcn init --yes
102
+ npx kitcn@latest init --yes
103
103
 
104
104
  # Adopt the current supported app on Concave
105
- bunx kitcn --backend concave init --yes
105
+ npx kitcn@latest --backend concave init --yes
106
106
 
107
107
  # New Next.js app with deterministic shadcn bootstrap + first local Convex bootstrap
108
- bunx kitcn init -t next --yes
108
+ npx kitcn@latest init -t next --yes
109
109
 
110
110
  # New Vite app with the React baseline + first local Convex bootstrap
111
- bunx kitcn init -t vite --yes
111
+ npx kitcn@latest init -t vite --yes
112
112
 
113
113
  # Nested app target
114
- bunx kitcn init -t next --yes --cwd apps --name web
114
+ npx kitcn@latest init -t next --yes --cwd apps --name web
115
115
  ```
116
116
 
117
117
  Then add only the features you want:
@@ -373,6 +373,13 @@ NEXT_PUBLIC_SITE_URL=http://localhost:3000
373
373
 
374
374
  Rule: real-time URL uses `.cloud`; HTTP/router/caller URL uses `.site`.
375
375
 
376
+ Local auth contract:
377
+
378
+ 1. Default app origin is `http://localhost:3000`.
379
+ 2. If you move the app to another local port, update `.env.local`
380
+ `NEXT_PUBLIC_SITE_URL`, `convex/.env` `SITE_URL`, and the app dev script
381
+ together.
382
+
376
383
  ### 4.3 Typed env helper (recommended for full backend parity)
377
384
 
378
385
  When multiple Convex functions and libs share env values (auth, billing, dev guards), create one typed helper:
@@ -598,6 +605,7 @@ CLI commands:
598
605
  ```bash
599
606
  bunx kitcn dev
600
607
  # deterministic one-shot local runtime proof:
608
+ # stop any long-running local backend first
601
609
  bunx kitcn verify
602
610
  # optional fallback only if dev cannot run and backend is already active:
603
611
  bunx kitcn codegen
@@ -622,6 +630,7 @@ dev session and auto-pushes later edits. Keep `env push` for `--prod`,
622
630
  Run these after base setup (Sections 3-5) and before starting Section 6:
623
631
 
624
632
  ```bash
633
+ # stop any long-running local backend first
625
634
  bunx kitcn verify
626
635
  bunx convex run internal.seed.seed
627
636
  bunx convex run internal.init.default
@@ -643,6 +652,7 @@ Then sanity-check runtime paths (non-auth only):
643
652
  Run this after Section 6 and before Sections 7-10:
644
653
 
645
654
  ```bash
655
+ # stop any long-running local backend first
646
656
  bunx kitcn verify
647
657
  bun run typecheck || bunx tsc --noEmit
648
658
  bun test
@@ -172,4 +172,3 @@ Provider mount checklist:
172
172
  1. `AppConvexProvider` wraps app routes before client feature components render.
173
173
  2. `CRPCProvider` is nested inside TanStack Query provider (`QueryClientProvider`).
174
174
  3. Next.js apps pass token where required (Section 8.A.4) or intentionally run without token for public-only paths.
175
-
@@ -1,6 +1,6 @@
1
1
  ## 5. Core Backend
2
2
 
3
- For production bootstrap, start in the CLI Registry: use `bunx kitcn init -t <next|vite> --yes` for the shortest fresh local path, `bunx kitcn init --yes` to adopt the current app and finish the first local Convex bootstrap in one command, and `bunx kitcn add <plugin>` for feature layers. This file is the manual backend wiring reference.
3
+ For production bootstrap, start in the CLI Registry: use `npx kitcn@latest init -t <next|vite> --yes` for the shortest fresh local path, `npx kitcn@latest init --yes` to adopt the current app and finish the first local Convex bootstrap in one command, and `bunx kitcn add <plugin>` for feature layers. This file is the manual backend wiring reference.
4
4
 
5
5
  ### 5.1 Define schema and relations
6
6
 
@@ -204,8 +204,8 @@ Do not fake generated files.
204
204
 
205
205
  Automation/non-interactive path:
206
206
 
207
- 1. Run `bunx kitcn init --yes` when you want scaffold or adoption plus the one-shot local Convex bootstrap in one command.
208
- 2. Run `bunx kitcn verify` when you want a non-interactive local runtime proof in the current app. It reuses an existing local deployment when one is already configured, and only falls back to anonymous fresh-local setup when it has to.
207
+ 1. Run `npx kitcn@latest init --yes` when you want scaffold or adoption plus the one-shot local Convex bootstrap in one command.
208
+ 2. Run `bunx kitcn verify` when you want a non-interactive local runtime proof in the current app. Stop any long-running local backend first. It reuses an existing local deployment when one is already configured, and only falls back to anonymous fresh-local setup when it has to.
209
209
  3. Confirm the generated runtime exists in `convex/functions/generated/server.ts`.
210
210
  4. Then run `bunx kitcn dev` for ongoing codegen/API refresh.
211
211
 
@@ -222,7 +222,7 @@ Agent command policy:
222
222
  1. Default to `bunx kitcn dev`.
223
223
  2. `kitcn dev` already runs codegen/API generation.
224
224
  3. Do not run `bunx kitcn codegen` as a separate default step.
225
- 4. Use `bunx kitcn verify` for one-shot local runtime proof in CI or agent runs.
225
+ 4. Use `bunx kitcn verify` for one-shot local runtime proof in CI or agent runs, with any long-running local backend stopped first.
226
226
  5. Use manual `bunx kitcn codegen` only as fallback when `kitcn dev` cannot be run and backend is already active.
227
227
  6. Use `bunx kitcn insights` for cloud-deployment debugging; it forwards to the upstream Convex insights CLI.
228
228