kitcn 0.15.8 → 0.15.9

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-CgQj3ZHP.js";
1
+ import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial, dn as ConvexTableWithColumns, tr as ConvexTextBuilderInitial } from "../where-clause-compiler-Dc58we_m.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-0xEF3NtW.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-3mwCSv2F.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-CNo9ffvI.js";
2
2
  import { t as GetAuth } from "../types-BCl8gfGy.js";
3
3
  import { t as GenericCtx } from "../context-utils-OMkMGhBk.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-0xEF3NtW.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-3mwCSv2F.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";
@@ -107,27 +107,27 @@ type AdapterPaginationOptions = PaginationOptions & {
107
107
  };
108
108
  declare const adapterWhereValidator: convex_values0.VObject<{
109
109
  mode?: "sensitive" | "insensitive" | undefined;
110
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
110
111
  connector?: "AND" | "OR" | undefined;
111
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
112
112
  value: string | number | boolean | string[] | number[] | null;
113
113
  field: string;
114
114
  }, {
115
115
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
116
116
  field: convex_values0.VString<string, "required">;
117
117
  mode: convex_values0.VUnion<"sensitive" | "insensitive" | undefined, [convex_values0.VLiteral<"sensitive", "required">, convex_values0.VLiteral<"insensitive", "required">], "optional", never>;
118
- 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>;
118
+ 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>;
119
119
  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>;
120
- }, "required", "mode" | "value" | "connector" | "field" | "operator">;
120
+ }, "required", "mode" | "operator" | "value" | "field" | "connector">;
121
121
  declare const adapterArgsValidator: convex_values0.VObject<{
122
- select?: string[] | undefined;
122
+ limit?: number | undefined;
123
123
  where?: {
124
124
  mode?: "sensitive" | "insensitive" | undefined;
125
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
125
126
  connector?: "AND" | "OR" | undefined;
126
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
127
127
  value: string | number | boolean | string[] | number[] | null;
128
128
  field: string;
129
129
  }[] | undefined;
130
- limit?: number | undefined;
130
+ select?: string[] | undefined;
131
131
  offset?: number | undefined;
132
132
  sortBy?: {
133
133
  field: string;
@@ -148,24 +148,24 @@ declare const adapterArgsValidator: convex_values0.VObject<{
148
148
  }, "optional", "field" | "direction">;
149
149
  where: convex_values0.VArray<{
150
150
  mode?: "sensitive" | "insensitive" | undefined;
151
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
151
152
  connector?: "AND" | "OR" | undefined;
152
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
153
153
  value: string | number | boolean | string[] | number[] | null;
154
154
  field: string;
155
155
  }[] | undefined, convex_values0.VObject<{
156
156
  mode?: "sensitive" | "insensitive" | undefined;
157
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
157
158
  connector?: "AND" | "OR" | undefined;
158
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
159
159
  value: string | number | boolean | string[] | number[] | null;
160
160
  field: string;
161
161
  }, {
162
162
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
163
163
  field: convex_values0.VString<string, "required">;
164
164
  mode: convex_values0.VUnion<"sensitive" | "insensitive" | undefined, [convex_values0.VLiteral<"sensitive", "required">, convex_values0.VLiteral<"insensitive", "required">], "optional", never>;
165
- 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>;
165
+ 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>;
166
166
  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>;
167
- }, "required", "mode" | "value" | "connector" | "field" | "operator">, "optional">;
168
- }, "required", "model" | "select" | "where" | "limit" | "offset" | "sortBy" | "sortBy.field" | "sortBy.direction">;
167
+ }, "required", "mode" | "operator" | "value" | "field" | "connector">, "optional">;
168
+ }, "required", "limit" | "where" | "model" | "select" | "offset" | "sortBy" | "sortBy.field" | "sortBy.direction">;
169
169
  declare const hasUniqueFields: (betterAuthSchema: BetterAuthDBSchema, model: string, input: Record<string, any>) => boolean;
170
170
  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>;
171
171
  declare const selectFields: <T extends TableNamesInDataModel<GenericDataModel>, D extends DocumentByName<GenericDataModel, T>>(doc: D | null, select?: string[]) => D | null;
@@ -7068,8 +7068,8 @@ const READ_OPTIONAL_RUNTIME_ENV_PROPERTY_RE = /\breadOptionalRuntimeEnv\s*:/m;
7068
7068
  const READ_OPTIONAL_RUNTIME_ENV_RE = /(\s*readOptionalRuntimeEnv\s*:\s*\[)([\s\S]*?)(\]\s*,?)/m;
7069
7069
  const LEADING_WHITESPACE_RE = /^\s*/;
7070
7070
  const STRING_LITERAL_ARRAY_ENTRY_RE = /^(['"])([^'"]+)\1$/;
7071
- const WHITESPACE_RE$1 = /\s/;
7072
- const findMatchingObjectBraceIndex = (source, openIndex) => {
7071
+ const WHITESPACE_RE$2 = /\s/;
7072
+ const findMatchingObjectBraceIndex$1 = (source, openIndex) => {
7073
7073
  let depth = 0;
7074
7074
  let quote;
7075
7075
  let escaped = false;
@@ -7188,7 +7188,7 @@ const upsertReadOptionalRuntimeEnvOption = (source, keys) => {
7188
7188
  const createEnvMatch = source.match(CREATE_ENV_OPTIONS_START_RE);
7189
7189
  if (!createEnvMatch || createEnvMatch.index === void 0) throw new Error("Expected env helper to call `createEnv({ ... })` before adding `readOptionalRuntimeEnv`.");
7190
7190
  const insertIndex = createEnvMatch.index + createEnvMatch[0].lastIndexOf("{") + 1;
7191
- const closingBraceIndex = findMatchingObjectBraceIndex(source, insertIndex - 1);
7191
+ const closingBraceIndex = findMatchingObjectBraceIndex$1(source, insertIndex - 1);
7192
7192
  if (closingBraceIndex === -1) throw new Error("Expected env helper `createEnv` options object to close before adding `readOptionalRuntimeEnv`.");
7193
7193
  const existingOptionsBody = source.slice(insertIndex, closingBraceIndex);
7194
7194
  const existingMatch = existingOptionsBody.match(READ_OPTIONAL_RUNTIME_ENV_RE);
@@ -7378,9 +7378,9 @@ const getPlannedFileContent = (files, absolutePath) => {
7378
7378
  const normalizedPath = normalizePath$1(relative(process.cwd(), absolutePath));
7379
7379
  return files?.find((file) => file.path === normalizedPath)?.content;
7380
7380
  };
7381
- const skipWhitespace$1 = (source, start) => {
7381
+ const skipWhitespace$2 = (source, start) => {
7382
7382
  let index = start;
7383
- while (index < source.length && WHITESPACE_RE$1.test(source[index] ?? "")) index += 1;
7383
+ while (index < source.length && WHITESPACE_RE$2.test(source[index] ?? "")) index += 1;
7384
7384
  return index;
7385
7385
  };
7386
7386
  const findBalancedParenEnd$1 = (source, openParenIndex) => {
@@ -7418,7 +7418,7 @@ const findSchemaExtensionInsertIndex = (source) => {
7418
7418
  };
7419
7419
  const cursor = defineSchemaCloseParenIndex + 1;
7420
7420
  while (cursor < source.length) {
7421
- const nextSegmentIndex = skipWhitespace$1(source, cursor);
7421
+ const nextSegmentIndex = skipWhitespace$2(source, cursor);
7422
7422
  if (source.startsWith(".relations(", nextSegmentIndex) || source.startsWith(".triggers(", nextSegmentIndex)) return {
7423
7423
  closeParenIndex: -1,
7424
7424
  hasExtend: false,
@@ -7662,7 +7662,7 @@ const createTypeScriptProxy = () => new Proxy({}, { get(_target, property) {
7662
7662
  const OBJECT_ENTRY_INDENT = " ";
7663
7663
  const LEADING_INDENT_RE = /^[ \t]*/;
7664
7664
  const LEGACY_MANAGED_COMMENT_RE = /^[ \t]*\/\* kitcn-managed [^*]+ \*\/\n?/gm;
7665
- const WHITESPACE_RE = /\s/;
7665
+ const WHITESPACE_RE$1 = /\s/;
7666
7666
  const ts$2 = createTypeScriptProxy();
7667
7667
  let printer = null;
7668
7668
  const getPrinter = () => {
@@ -8003,9 +8003,9 @@ const updateTablesObject = (source, registrations) => {
8003
8003
  if (!changed) return source;
8004
8004
  return replaceRange(source, info.object.getStart(info.sourceFile), info.object.end, renderObjectLiteral(getIndentAt(source, info.object.getStart(info.sourceFile)), existingEntries));
8005
8005
  };
8006
- const skipWhitespace = (source, start) => {
8006
+ const skipWhitespace$1 = (source, start) => {
8007
8007
  let cursor = start;
8008
- while (cursor < source.length && WHITESPACE_RE.test(source[cursor])) cursor += 1;
8008
+ while (cursor < source.length && WHITESPACE_RE$1.test(source[cursor])) cursor += 1;
8009
8009
  return cursor;
8010
8010
  };
8011
8011
  const findBalancedParenEnd = (source, openParenIndex) => {
@@ -8029,7 +8029,7 @@ const findRelationsInsertIndex = (source) => {
8029
8029
  if (defineSchemaCloseParenIndex < 0) return -1;
8030
8030
  let cursor = defineSchemaCloseParenIndex + 1;
8031
8031
  while (cursor < source.length) {
8032
- const nextSegmentIndex = skipWhitespace(source, cursor);
8032
+ const nextSegmentIndex = skipWhitespace$1(source, cursor);
8033
8033
  if (source.startsWith(".relations(", nextSegmentIndex)) return nextSegmentIndex;
8034
8034
  if (source.startsWith(".triggers(", nextSegmentIndex)) return nextSegmentIndex;
8035
8035
  if (!source.startsWith(".extend(", nextSegmentIndex)) return nextSegmentIndex;
@@ -13646,6 +13646,8 @@ const INIT_NEXT_IMPORT_SEMICOLON_RE = /^\s*import .*;\s*$/m;
13646
13646
  const INIT_NEXT_TRAILING_NEWLINES_RE = /\n*$/;
13647
13647
  const INIT_NEXT_PROVIDERS_IMPORT_RE = /from ['"]@\/components\/providers['"]/;
13648
13648
  const INIT_NEXT_CHILDREN_SLOT_RE = /\{\s*children\s*\}/g;
13649
+ const IDENTIFIER_CHAR_RE = /[A-Za-z0-9_$]/;
13650
+ const WHITESPACE_RE = /\s/;
13649
13651
  const VALID_SCOPES = new Set([
13650
13652
  "all",
13651
13653
  "auth",
@@ -14741,9 +14743,248 @@ function patchInitReactMainContent(source) {
14741
14743
  }
14742
14744
  return nextSource.endsWith("\n") ? nextSource : `${nextSource}\n`;
14743
14745
  }
14746
+ function findMatchingObjectBraceIndex(source, openIndex) {
14747
+ let depth = 0;
14748
+ let quote;
14749
+ let escaped = false;
14750
+ let lineComment = false;
14751
+ let blockComment = false;
14752
+ for (let index = openIndex; index < source.length; index++) {
14753
+ const char = source[index];
14754
+ const nextChar = source[index + 1];
14755
+ if (lineComment) {
14756
+ if (char === "\n" || char === "\r") lineComment = false;
14757
+ continue;
14758
+ }
14759
+ if (blockComment) {
14760
+ if (char === "*" && nextChar === "/") {
14761
+ blockComment = false;
14762
+ index++;
14763
+ }
14764
+ continue;
14765
+ }
14766
+ if (quote) {
14767
+ if (escaped) {
14768
+ escaped = false;
14769
+ continue;
14770
+ }
14771
+ if (char === "\\") {
14772
+ escaped = true;
14773
+ continue;
14774
+ }
14775
+ if (char === quote) quote = void 0;
14776
+ continue;
14777
+ }
14778
+ if (char === "/" && nextChar === "/") {
14779
+ lineComment = true;
14780
+ index++;
14781
+ continue;
14782
+ }
14783
+ if (char === "/" && nextChar === "*") {
14784
+ blockComment = true;
14785
+ index++;
14786
+ continue;
14787
+ }
14788
+ if (char === "\"" || char === "'" || char === "`") {
14789
+ quote = char;
14790
+ continue;
14791
+ }
14792
+ if (char === "{") {
14793
+ depth++;
14794
+ continue;
14795
+ }
14796
+ if (char === "}") {
14797
+ depth--;
14798
+ if (depth === 0) return index;
14799
+ }
14800
+ }
14801
+ return -1;
14802
+ }
14803
+ function isIdentifierChar(char) {
14804
+ return typeof char === "string" && IDENTIFIER_CHAR_RE.test(char);
14805
+ }
14806
+ function isIdentifierAt(source, index, identifier) {
14807
+ return source.startsWith(identifier, index) && !isIdentifierChar(source[index - 1]) && !isIdentifierChar(source[index + identifier.length]);
14808
+ }
14809
+ function skipWhitespace(source, index) {
14810
+ let nextIndex = index;
14811
+ while (nextIndex < source.length && WHITESPACE_RE.test(source[nextIndex] ?? "")) nextIndex++;
14812
+ return nextIndex;
14813
+ }
14814
+ function skipTrivia(source, index) {
14815
+ let nextIndex = index;
14816
+ while (nextIndex < source.length) {
14817
+ const whitespaceIndex = skipWhitespace(source, nextIndex);
14818
+ if (whitespaceIndex !== nextIndex) {
14819
+ nextIndex = whitespaceIndex;
14820
+ continue;
14821
+ }
14822
+ const char = source[nextIndex];
14823
+ const nextChar = source[nextIndex + 1];
14824
+ if (char === "/" && nextChar === "/") {
14825
+ const lineEndIndex = source.indexOf("\n", nextIndex + 2);
14826
+ nextIndex = lineEndIndex === -1 ? source.length : lineEndIndex + 1;
14827
+ continue;
14828
+ }
14829
+ if (char === "/" && nextChar === "*") {
14830
+ const blockEndIndex = source.indexOf("*/", nextIndex + 2);
14831
+ nextIndex = blockEndIndex === -1 ? source.length : blockEndIndex + 2;
14832
+ continue;
14833
+ }
14834
+ break;
14835
+ }
14836
+ return nextIndex;
14837
+ }
14838
+ function readObjectPropertyNameEndIndex(source, index, propertyName) {
14839
+ const char = source[index];
14840
+ if (char === "\"" || char === "'") {
14841
+ const closeIndex = source.indexOf(char, index + 1);
14842
+ if (closeIndex === -1) return -1;
14843
+ return source.slice(index + 1, closeIndex) === propertyName ? closeIndex + 1 : -1;
14844
+ }
14845
+ if (isIdentifierAt(source, index, propertyName)) return index + propertyName.length;
14846
+ return -1;
14847
+ }
14848
+ function findConfigObjectOpenIndex(source) {
14849
+ let quote;
14850
+ let escaped = false;
14851
+ let lineComment = false;
14852
+ let blockComment = false;
14853
+ for (let index = 0; index < source.length; index++) {
14854
+ const char = source[index];
14855
+ const nextChar = source[index + 1];
14856
+ if (lineComment) {
14857
+ if (char === "\n" || char === "\r") lineComment = false;
14858
+ continue;
14859
+ }
14860
+ if (blockComment) {
14861
+ if (char === "*" && nextChar === "/") {
14862
+ blockComment = false;
14863
+ index++;
14864
+ }
14865
+ continue;
14866
+ }
14867
+ if (quote) {
14868
+ if (escaped) {
14869
+ escaped = false;
14870
+ continue;
14871
+ }
14872
+ if (char === "\\") {
14873
+ escaped = true;
14874
+ continue;
14875
+ }
14876
+ if (char === quote) quote = void 0;
14877
+ continue;
14878
+ }
14879
+ if (char === "/" && nextChar === "/") {
14880
+ lineComment = true;
14881
+ index++;
14882
+ continue;
14883
+ }
14884
+ if (char === "/" && nextChar === "*") {
14885
+ blockComment = true;
14886
+ index++;
14887
+ continue;
14888
+ }
14889
+ if (char === "\"" || char === "'" || char === "`") {
14890
+ quote = char;
14891
+ continue;
14892
+ }
14893
+ if (isIdentifierAt(source, index, "defineConfig")) {
14894
+ const callIndex = skipTrivia(source, index + 12);
14895
+ if (source[callIndex] === "(") {
14896
+ const objectOpenIndex = skipTrivia(source, callIndex + 1);
14897
+ if (source[objectOpenIndex] === "{") return objectOpenIndex;
14898
+ }
14899
+ }
14900
+ if (isIdentifierAt(source, index, "export")) {
14901
+ const defaultIndex = skipTrivia(source, index + 6);
14902
+ if (isIdentifierAt(source, defaultIndex, "default")) {
14903
+ const objectOpenIndex = skipTrivia(source, defaultIndex + 7);
14904
+ if (source[objectOpenIndex] === "{") return objectOpenIndex;
14905
+ }
14906
+ }
14907
+ }
14908
+ return -1;
14909
+ }
14910
+ function findObjectPropertyValueIndex(source, openIndex, propertyName) {
14911
+ const closeIndex = findMatchingObjectBraceIndex(source, openIndex);
14912
+ if (closeIndex === -1) return -1;
14913
+ let depth = 1;
14914
+ let quote;
14915
+ let escaped = false;
14916
+ let lineComment = false;
14917
+ let blockComment = false;
14918
+ for (let index = openIndex + 1; index < closeIndex; index++) {
14919
+ const char = source[index];
14920
+ const nextChar = source[index + 1];
14921
+ if (lineComment) {
14922
+ if (char === "\n" || char === "\r") lineComment = false;
14923
+ continue;
14924
+ }
14925
+ if (blockComment) {
14926
+ if (char === "*" && nextChar === "/") {
14927
+ blockComment = false;
14928
+ index++;
14929
+ }
14930
+ continue;
14931
+ }
14932
+ if (quote) {
14933
+ if (escaped) {
14934
+ escaped = false;
14935
+ continue;
14936
+ }
14937
+ if (char === "\\") {
14938
+ escaped = true;
14939
+ continue;
14940
+ }
14941
+ if (char === quote) quote = void 0;
14942
+ continue;
14943
+ }
14944
+ if (char === "/" && nextChar === "/") {
14945
+ lineComment = true;
14946
+ index++;
14947
+ continue;
14948
+ }
14949
+ if (char === "/" && nextChar === "*") {
14950
+ blockComment = true;
14951
+ index++;
14952
+ continue;
14953
+ }
14954
+ if (depth === 1) {
14955
+ const propertyNameEndIndex = readObjectPropertyNameEndIndex(source, index, propertyName);
14956
+ if (propertyNameEndIndex !== -1) {
14957
+ const colonIndex = skipTrivia(source, propertyNameEndIndex);
14958
+ if (source[colonIndex] === ":") return skipTrivia(source, colonIndex + 1);
14959
+ }
14960
+ }
14961
+ if (char === "\"" || char === "'" || char === "`") {
14962
+ quote = char;
14963
+ continue;
14964
+ }
14965
+ if (char === "{") {
14966
+ depth++;
14967
+ continue;
14968
+ }
14969
+ if (char === "}") depth--;
14970
+ }
14971
+ return -1;
14972
+ }
14973
+ function hasEnabledTsconfigPathsValueAt(source, index) {
14974
+ const valueIndex = skipTrivia(source, index);
14975
+ return source[valueIndex] === "{" || isIdentifierAt(source, valueIndex, "true");
14976
+ }
14977
+ function hasResolveTsconfigPathsOption(source) {
14978
+ const configOpenIndex = findConfigObjectOpenIndex(source);
14979
+ if (configOpenIndex === -1) return false;
14980
+ const resolveValueIndex = findObjectPropertyValueIndex(source, configOpenIndex, "resolve");
14981
+ if (source[resolveValueIndex] !== "{") return false;
14982
+ const tsconfigPathsValueIndex = findObjectPropertyValueIndex(source, resolveValueIndex, "tsconfigPaths");
14983
+ return tsconfigPathsValueIndex !== -1 && hasEnabledTsconfigPathsValueAt(source, tsconfigPathsValueIndex);
14984
+ }
14744
14985
  function patchInitReactViteConfigContent(source) {
14745
14986
  if (source.includes("'@convex'") || source.includes("\"@convex\"")) return source.endsWith("\n") ? source : `${source}\n`;
14746
- if (source.includes("viteTsConfigPaths(") || source.includes("tsConfigPaths(")) return source.endsWith("\n") ? source : `${source}\n`;
14987
+ if (source.includes("viteTsConfigPaths(") || source.includes("tsConfigPaths(") || hasResolveTsconfigPathsOption(source)) return source.endsWith("\n") ? source : `${source}\n`;
14747
14988
  if (!source.includes("alias: {")) throw new Error("Could not patch vite.config.ts: expected a resolve.alias block.");
14748
14989
  const nextSource = source.replace("alias: {", `alias: {\n '@convex': path.resolve(__dirname, './convex/shared'),`);
14749
14990
  return nextSource.endsWith("\n") ? nextSource : `${nextSource}\n`;
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { $ as promptForScaffoldTemplateSelection, A as resolveCodegenTrimSegments, At as highlighter, B as runConfiguredCodegen, C as isEntryPoint, Ct as formatDependencyInstallCommand, D as parseInitCommandArgs, E as parseBackendRunJson, Et as stripConvexCommandNoise, F as resolveRunDeps, G as runMigrationFlow, H as runDevSchemaBackfillIfNeeded, I as runAfterScaffoldScript, J as withWorkingDirectory, K as trackProcess, L as runAggregateBackfillFlow, M as resolveDocTopic, N as resolveInitProjectDir, O as readPackageVersions, P as resolveMigrationConfig, Q as promptForPluginSelection, R as runAggregatePruneFlow, S as isConvexDevPreRunConflictFlag, St as detectPackageManager, T as parseArgs, Tt as serializeEnvValue, U as runInitCommandFlow, V as runConvexInitIfNeeded, W as runMigrationCreate, X as collectPluginScaffoldTemplates, Y as createSpinner, Z as filterScaffoldTemplatePathMap, _ as formatInfoOutput, _t as applyPlanningDependencyInstall, a as cleanup, at as getPluginCatalogEntry, b as getDevAggregateBackfillStatePath, bt as resolveSupportedDependencyWarnings, c as createCommandEnv, ct as buildPluginInstallPlan, d as extractBackfillCliOptions, dt as collectInstalledPluginKeys, et as resolveAddTemplateDefaults, f as extractConcaveRunTargetArgs, ft as getPluginLockfilePath, g as formatDocsOutput, gt as applyDependencyHintsInstall, h as extractResetCliOptions, ht as resolveSchemaInstalledPlugins, i as buildInitializationPlan, it as resolveTemplatesByIdOrThrow, j as resolveConfiguredBackend, k as resolveBackfillConfig, kt as logger, l as ensureConvexGitignoreEntry, lt as resolvePluginScaffoldRoots, m as extractMigrationDownOptions, mt as readPluginLockfile, n as applyPluginInstallPlanFiles, nt as resolvePresetScaffoldTemplates, o as createBackendAdapter, ot as getSupportedPluginKeys, p as extractMigrationCliOptions, pt as getSchemaFilePath, q as withLocalCodegenEnv, r as assertNoRemovedDevPreRunFlag, rt as resolveTemplateSelectionSource, s as createBackendCommandEnv, st as isSupportedPluginKey, t as applyDependencyInstallPlan, tt as resolvePluginPreset, u as extractBackendRunTargetArgs, ut as assertSchemaFileExists, v as getAggregateBackfillDeploymentKey, vt as applyPluginDependencyInstall, w as isInitialized, wt as resolveAuthEnvState, x as hasRemoteConvexDeploymentEnv, xt as resolveProjectScaffoldContext, y as getConvexDeploymentCommandEnv, yt as inspectPluginDependencyInstall, z as runBackendFunction } from "./backend-core-CQmXi2Q0.mjs";
2
+ import { $ as promptForScaffoldTemplateSelection, A as resolveCodegenTrimSegments, At as highlighter, B as runConfiguredCodegen, C as isEntryPoint, Ct as formatDependencyInstallCommand, D as parseInitCommandArgs, E as parseBackendRunJson, Et as stripConvexCommandNoise, F as resolveRunDeps, G as runMigrationFlow, H as runDevSchemaBackfillIfNeeded, I as runAfterScaffoldScript, J as withWorkingDirectory, K as trackProcess, L as runAggregateBackfillFlow, M as resolveDocTopic, N as resolveInitProjectDir, O as readPackageVersions, P as resolveMigrationConfig, Q as promptForPluginSelection, R as runAggregatePruneFlow, S as isConvexDevPreRunConflictFlag, St as detectPackageManager, T as parseArgs, Tt as serializeEnvValue, U as runInitCommandFlow, V as runConvexInitIfNeeded, W as runMigrationCreate, X as collectPluginScaffoldTemplates, Y as createSpinner, Z as filterScaffoldTemplatePathMap, _ as formatInfoOutput, _t as applyPlanningDependencyInstall, a as cleanup, at as getPluginCatalogEntry, b as getDevAggregateBackfillStatePath, bt as resolveSupportedDependencyWarnings, c as createCommandEnv, ct as buildPluginInstallPlan, d as extractBackfillCliOptions, dt as collectInstalledPluginKeys, et as resolveAddTemplateDefaults, f as extractConcaveRunTargetArgs, ft as getPluginLockfilePath, g as formatDocsOutput, gt as applyDependencyHintsInstall, h as extractResetCliOptions, ht as resolveSchemaInstalledPlugins, i as buildInitializationPlan, it as resolveTemplatesByIdOrThrow, j as resolveConfiguredBackend, k as resolveBackfillConfig, kt as logger, l as ensureConvexGitignoreEntry, lt as resolvePluginScaffoldRoots, m as extractMigrationDownOptions, mt as readPluginLockfile, n as applyPluginInstallPlanFiles, nt as resolvePresetScaffoldTemplates, o as createBackendAdapter, ot as getSupportedPluginKeys, p as extractMigrationCliOptions, pt as getSchemaFilePath, q as withLocalCodegenEnv, r as assertNoRemovedDevPreRunFlag, rt as resolveTemplateSelectionSource, s as createBackendCommandEnv, st as isSupportedPluginKey, t as applyDependencyInstallPlan, tt as resolvePluginPreset, u as extractBackendRunTargetArgs, ut as assertSchemaFileExists, v as getAggregateBackfillDeploymentKey, vt as applyPluginDependencyInstall, w as isInitialized, wt as resolveAuthEnvState, x as hasRemoteConvexDeploymentEnv, xt as resolveProjectScaffoldContext, y as getConvexDeploymentCommandEnv, yt as inspectPluginDependencyInstall, z as runBackendFunction } from "./backend-core-CRJpuVnf.mjs";
3
3
  import fs, { existsSync, readFileSync } from "node:fs";
4
4
  import path, { delimiter, dirname, join, relative, resolve } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
@@ -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,21 +216,20 @@ 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?: {
221
222
  mode?: "sensitive" | "insensitive" | undefined;
223
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
222
224
  connector?: "AND" | "OR" | undefined;
223
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
224
225
  value: string | number | boolean | string[] | number[] | null;
225
226
  field: string;
226
227
  }[] | undefined;
227
- limit?: number | undefined;
228
228
  offset?: number | undefined;
229
229
  sortBy?: {
230
230
  field: string;
231
231
  direction: "asc" | "desc";
232
232
  } | undefined;
233
- model: string;
234
233
  paginationOpts: {
235
234
  id?: number;
236
235
  endCursor?: string | null;
@@ -239,47 +238,48 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
239
238
  numItems: number;
240
239
  cursor: string | null;
241
240
  };
241
+ model: string;
242
242
  }, Promise<convex_server0.PaginationResult<convex_server0.GenericDocument>>>;
243
243
  findOne: convex_server0.RegisteredQuery<"internal", {
244
244
  join?: any;
245
- select?: string[] | undefined;
246
245
  where?: {
247
246
  mode?: "sensitive" | "insensitive" | undefined;
247
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
248
248
  connector?: "AND" | "OR" | undefined;
249
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
250
249
  value: string | number | boolean | string[] | number[] | null;
251
250
  field: string;
252
251
  }[] | undefined;
252
+ select?: string[] | undefined;
253
253
  model: string;
254
254
  }, Promise<convex_server0.GenericDocument | null>>;
255
255
  getLatestJwks: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
256
256
  rotateKeys: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
257
257
  updateMany: convex_server0.RegisteredMutation<"internal", {
258
+ paginationOpts: {
259
+ id?: number;
260
+ endCursor?: string | null;
261
+ maximumRowsRead?: number;
262
+ maximumBytesRead?: number;
263
+ numItems: number;
264
+ cursor: string | null;
265
+ };
258
266
  input: {
259
267
  where?: {
268
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
260
269
  connector?: "AND" | "OR" | undefined;
261
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
262
270
  value: string | number | boolean | string[] | number[] | null;
263
271
  field: string;
264
272
  }[] | undefined;
265
- model: string;
266
273
  update: {
267
274
  [x: string]: unknown;
268
275
  [x: number]: unknown;
269
276
  [x: symbol]: unknown;
270
277
  };
278
+ model: string;
271
279
  } | {
272
280
  where?: any[] | undefined;
273
- model: string;
274
281
  update: any;
275
- };
276
- paginationOpts: {
277
- id?: number;
278
- endCursor?: string | null;
279
- maximumRowsRead?: number;
280
- maximumBytesRead?: number;
281
- numItems: number;
282
- cursor: string | null;
282
+ model: string;
283
283
  };
284
284
  }, Promise<{
285
285
  count: number;
@@ -292,21 +292,21 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
292
292
  updateOne: convex_server0.RegisteredMutation<"internal", {
293
293
  input: {
294
294
  where?: {
295
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
295
296
  connector?: "AND" | "OR" | undefined;
296
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
297
297
  value: string | number | boolean | string[] | number[] | null;
298
298
  field: string;
299
299
  }[] | undefined;
300
- model: string;
301
300
  update: {
302
301
  [x: string]: unknown;
303
302
  [x: number]: unknown;
304
303
  [x: symbol]: unknown;
305
304
  };
305
+ model: string;
306
306
  } | {
307
307
  where?: any[] | undefined;
308
- model: string;
309
308
  update: any;
309
+ model: string;
310
310
  };
311
311
  }, Promise<any>>;
312
312
  };
@@ -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-CgQj3ZHP.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-Dc58we_m.js";
2
2
  import { i as pretendRequired, n as deprecated, r as pretend } from "../validators-BhsByJeg.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-CNo9ffvI.js";
4
4
  import { DefineSchemaOptions, GenericDatabaseReader, GenericDatabaseWriter, GenericSchema, SchemaDefinition } from "convex/server";
package/dist/watcher.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { Dt as generateMeta, F as resolveRunDeps, Ot as getConvexConfig, j as resolveConfiguredBackend, kt as logger, q as withLocalCodegenEnv } from "./backend-core-CQmXi2Q0.mjs";
2
+ import { Dt as generateMeta, F as resolveRunDeps, Ot as getConvexConfig, j as resolveConfiguredBackend, kt as logger, q as withLocalCodegenEnv } from "./backend-core-CRJpuVnf.mjs";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
 
@@ -3990,11 +3990,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
3990
3990
  readonly aggregate_extrema: ConvexTableWithColumns<{
3991
3991
  name: "aggregate_extrema";
3992
3992
  columns: {
3993
- value: ConvexCustomBuilderInitial<"", convex_values0.VAny<any, "required", string>> & {
3994
- _: {
3995
- $type: convex_values0.Value;
3996
- };
3997
- } & {
3993
+ count: ConvexNumberBuilderInitial<""> & {
3998
3994
  _: {
3999
3995
  notNull: true;
4000
3996
  };
@@ -4004,10 +4000,14 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4004
4000
  };
4005
4001
  } & {
4006
4002
  _: {
4007
- fieldName: "value";
4003
+ fieldName: "count";
4008
4004
  };
4009
4005
  };
4010
- count: ConvexNumberBuilderInitial<""> & {
4006
+ value: ConvexCustomBuilderInitial<"", convex_values0.VAny<any, "required", string>> & {
4007
+ _: {
4008
+ $type: convex_values0.Value;
4009
+ };
4010
+ } & {
4011
4011
  _: {
4012
4012
  notNull: true;
4013
4013
  };
@@ -4017,7 +4017,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4017
4017
  };
4018
4018
  } & {
4019
4019
  _: {
4020
- fieldName: "count";
4020
+ fieldName: "value";
4021
4021
  };
4022
4022
  };
4023
4023
  updatedAt: ConvexNumberBuilderInitial<""> & {
@@ -4409,22 +4409,22 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4409
4409
  fieldName: "status";
4410
4410
  };
4411
4411
  };
4412
- cursor: ConvexTextBuilderInitial<""> & {
4412
+ direction: ConvexTextBuilderInitial<""> & {
4413
4413
  _: {
4414
4414
  tableName: "migration_state";
4415
4415
  };
4416
4416
  } & {
4417
4417
  _: {
4418
- fieldName: "cursor";
4418
+ fieldName: "direction";
4419
4419
  };
4420
4420
  };
4421
- direction: ConvexTextBuilderInitial<""> & {
4421
+ cursor: ConvexTextBuilderInitial<""> & {
4422
4422
  _: {
4423
4423
  tableName: "migration_state";
4424
4424
  };
4425
4425
  } & {
4426
4426
  _: {
4427
- fieldName: "direction";
4427
+ fieldName: "cursor";
4428
4428
  };
4429
4429
  };
4430
4430
  updatedAt: ConvexNumberBuilderInitial<""> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitcn",
3
- "version": "0.15.8",
3
+ "version": "0.15.9",
4
4
  "description": "kitcn - React Query integration and CLI tools for Convex",
5
5
  "keywords": [
6
6
  "convex",
@@ -1,8 +1,7 @@
1
1
  ---
2
2
  name: kitcn
3
- description: ALWAYS use this skill when working with convex or kitcn. Covers both setup and e2e feature paths using cRPC + ORM + auth + React.
3
+ description: "Use for Convex/kitcn setup and feature work: cRPC, ORM, auth, React."
4
4
  sources: [www/content/docs/concepts.mdx, www/content/docs/orm/index.mdx, www/content/docs/orm/schema/relations.mdx, www/content/docs/orm/schema/triggers.mdx, www/content/docs/orm/queries/aggregates.mdx, www/content/docs/orm/queries/pagination.mdx, www/content/docs/server/error-handling.mdx, www/content/docs/server/http.mdx, www/content/docs/server/middlewares.mdx, www/content/docs/server/procedures.mdx, www/content/docs/server/server-side-calls.mdx, www/content/docs/react/queries.mdx, www/content/docs/react/mutations.mdx, www/content/docs/react/infinite-queries.mdx, www/content/docs/auth/client.mdx, www/content/docs/auth/server.mdx]
5
- metadata: { sources: [www/content/docs/concepts.mdx, www/content/docs/orm/index.mdx, www/content/docs/orm/schema/relations.mdx, www/content/docs/orm/schema/triggers.mdx, www/content/docs/orm/queries/aggregates.mdx, www/content/docs/orm/queries/pagination.mdx, www/content/docs/server/error-handling.mdx, www/content/docs/server/http.mdx, www/content/docs/server/middlewares.mdx, www/content/docs/server/procedures.mdx, www/content/docs/server/server-side-calls.mdx, www/content/docs/react/queries.mdx, www/content/docs/react/mutations.mdx, www/content/docs/react/infinite-queries.mdx, www/content/docs/auth/client.mdx, www/content/docs/auth/server.mdx] }
6
5
  ---
7
6
  # kitcn Core Skill (80% Path)
8
7
  Use this file first for everyday feature delivery in an already configured kitcn app.
@@ -25,7 +24,7 @@ Out of scope:
25
24
  4. Use `CRPCError` for expected failures.
26
25
  5. Prefer schema triggers for cross-row invariants, but move invariant maintenance to explicit mutation helpers if trigger execution is unstable (for example init/seed hangs or recursive write paths).
27
26
  6. Keep auth/rate-limit checks server-side.
28
- 7. **Inter-procedure calls**: `create<Module>Handler(ctx)` in queries/mutations (zero overhead) unless validation is relevant, `create<Module>Caller(ctx)` in actions/HTTP routes. In action context use `caller.actions.*` for action procedures and `caller.schedule.*` for scheduling. Import from `./generated/<module>.runtime`. Never call `ctx.runQuery`/`ctx.runMutation`/`ctx.runAction` directly for module procedures.
27
+ 7. **Inter-procedure calls**: use generated runtime helpers: `create<Module>Handler(ctx)` in queries/mutations, `create<Module>Caller(ctx)` in actions/HTTP routes, `caller.actions.*` for action procedures, and `caller.schedule.*` for scheduling. Never call `ctx.runQuery`/`ctx.runMutation`/`ctx.runAction` directly for module procedures.
29
28
  ## Shortcut Mode (tRPC + Drizzle Mental Model)
30
29
  Default assumption:
31
30
  - cRPC behavior is tRPC-like (builder chain + middleware + TanStack options).
@@ -50,9 +49,9 @@ Only remember these non-parity deltas:
50
49
  17. In RSC, `prefetch` hydrates client, `caller` is server-only and not hydrated, `preloadQuery` hydrates but can cause stale split ownership if also rendered client-side.
51
50
  18. Better Auth Next.js shortcut is `convexBetterAuth(...)`; generic server-only shortcut is `createCallerFactory(...)`.
52
51
  19. On the kitcn auth client path, use `createAuthMutations(authClient)` wrappers so logout unsubscribes auth queries before sign out. Raw Convex preset keeps a smaller plain `authClient`.
53
- 20. **NEVER** use `ctx.runQuery`/`ctx.runMutation`/`ctx.runAction` directly for module-to-module calls. Use `create<Module>Handler(ctx)` or `create<Module>Caller(ctx)` from `convex/functions/generated/<module>.runtime` instead.
54
- 21. **`create<Module>Handler(ctx)`** default choice for queries/mutations. Bypasses input validation, middleware, output validation → zero overhead. Query/mutation ctx only. Import from `./generated/<module>.runtime`.
55
- 22. **`create<Module>Caller(ctx)`** use in actions and HTTP routes (where handler is unavailable). Goes through validation + middleware. Root caller exposes query+mutation procedures. In `ActionCtx`, action procedures are under `caller.actions.*`; scheduling is under `caller.schedule.now|after|at` with `caller.schedule.cancel(id)`. Use `requireActionCtx(ctx)` only when the callback truly runs in `ActionCtx` and you need `caller.actions.*`. If the callback can run from `MutationCtx | ActionCtx` or generic scheduler-capable context, keep the seam honest: use `requireSchedulerCtx(ctx)` and `caller.schedule.*` instead of pretending the path is action-only. Import from `./generated/<module>.runtime`. Each caller/handler eagerly loads every procedure in its module (no lazy loading) — split large modules to keep bundles lean.
52
+ 20. **NEVER** use `ctx.runQuery`/`ctx.runMutation`/`ctx.runAction` directly for module-to-module calls. Use the generated runtime helpers from `convex/functions/generated/<module>.runtime`.
53
+ 21. **`create<Module>Handler(ctx)`** is the default in queries/mutations: zero overhead, query/mutation ctx only, and no redundant validation or middleware.
54
+ 22. **`create<Module>Caller(ctx)`** is for actions and HTTP routes. Action procedures live under `caller.actions.*`; scheduling lives under `caller.schedule.now|after|at|cancel`. Use `requireActionCtx(ctx)` only for true `ActionCtx` callbacks; use `requireSchedulerCtx(ctx)` when mutation or action contexts can schedule. Each caller/handler eagerly loads its module, so split large modules.
56
55
  23. API types (`Api`, `ApiInputs`, `ApiOutputs`, `Select`, `Insert`, `TableName`) import from `@convex/api` — no manual `inferApiInputs<typeof api>`.
57
56
  24. HTTP router must export as `httpRouter` (not `appRouter`) for codegen.
58
57
  25. Server wiring imports come from `convex/functions/generated/` directory: `getAuth`, `defineAuth` from `generated/auth`; `initCRPC`, `QueryCtx`, `MutationCtx`, `OrmCtx` from `generated/server`; `create<Module>Caller`, `create<Module>Handler` from `generated/<module>.runtime`. No manual `convex/lib/orm.ts`.
@@ -61,7 +60,7 @@ Only remember these non-parity deltas:
61
60
  28. Async mutation batching is the default (codegen wires it). Customize per call: `execute({ batchSize, delayMs })`. Opt into sync: `execute({ mode: 'sync' })` or `defineSchema(..., { defaults: { mutationExecutionMode: 'sync' } })`. Relevant defaults: `mutationBatchSize`, `mutationLeafBatchSize`, `mutationMaxRows`, `mutationScheduleCallCap`.
62
61
  29. Polymorphic unions are schema-first: use `actionType: discriminator({ variants, as? })` in `convexTable(...)`. Query config does not include a `polymorphic` option. Writes stay flat; reads synthesize nested `details` (or custom alias). Use `withVariants: true` to auto-load all `one()` relations on discriminator tables.
63
62
  30. Do not add manual ORM mutation batching loops in app/plugin code by default. Convex runtime batching already handles mutation execution. Prefer set-based deletes/updates over per-row loops. Only add explicit chunking when batching external side effects (for example Resend API calls) or bounded cleanup sweeps.
64
- ## Directory Boundary (Important)
63
+ ## Directory Boundary
65
64
  Use `references/setup/` when the task needs:
66
65
  1. Project/file structure setup → `setup/index.md` + `setup/server.md`
67
66
  2. Auth bootstrap → `setup/auth.md`
@@ -425,22 +425,6 @@ const canDelete = authClient.admin.checkRolePermission({
425
425
 
426
426
  ## API Reference
427
427
 
428
- | Operation | Method | Admin Required |
429
- |-----------|--------|----------------|
430
- | Create user | `authClient.admin.createUser` | Yes |
431
- | List users | `authClient.admin.listUsers` | Yes |
432
- | Set role | `authClient.admin.setRole` | Yes |
433
- | Set password | `authClient.admin.setUserPassword` | Yes |
434
- | Update user | `authClient.admin.updateUser` | Yes |
435
- | Ban user | `authClient.admin.banUser` | Yes |
436
- | Unban user | `authClient.admin.unbanUser` | Yes |
437
- | List sessions | `authClient.admin.listUserSessions` | Yes |
438
- | Revoke session | `authClient.admin.revokeUserSession` | Yes |
439
- | Revoke all sessions | `authClient.admin.revokeUserSessions` | Yes |
440
- | Impersonate | `authClient.admin.impersonateUser` | Yes |
441
- | Stop impersonating | `authClient.admin.stopImpersonating` | Yes |
442
- | Remove user | `authClient.admin.removeUser` | Yes |
443
- | Check permission | `authClient.admin.hasPermission` | No |
444
- | Check role permission | `authClient.admin.checkRolePermission` | No |
445
-
446
- Use Convex functions for custom admin operations. Use Better Auth client API for standard operations like user management, banning, and session management.
428
+ Use Better Auth client admin methods for standard user management, roles,
429
+ passwords, bans, sessions, impersonation, removal, and permission checks. Use
430
+ Convex functions only for custom admin operations.
@@ -1127,24 +1127,6 @@ await authClient.organization.setActiveTeam({ teamId });
1127
1127
 
1128
1128
  ## API Reference
1129
1129
 
1130
- | Operation | Method | Multi-table |
1131
- | ------------------ | --------------- | ----------- |
1132
- | Create org | Better Auth API | Yes |
1133
- | Update org | Better Auth API | No |
1134
- | Delete org | Better Auth API | Yes |
1135
- | List orgs | ORM | No |
1136
- | Check slug | ORM | No |
1137
- | Invite member | Better Auth API | Yes |
1138
- | Accept invite | Better Auth API | Yes |
1139
- | Reject invite | Better Auth API | Yes |
1140
- | Cancel invite | Better Auth API | Yes |
1141
- | List user invites | ORM | No |
1142
- | Add member | Better Auth API | Yes |
1143
- | Update role | Better Auth API | Yes |
1144
- | Remove member | Better Auth API | Yes |
1145
- | Leave org | Better Auth API | Yes |
1146
- | Create team | Better Auth API | Yes |
1147
- | Add team member | Better Auth API | Yes |
1148
- | Remove team member | Better Auth API | Yes |
1149
-
1150
- Use Better Auth API for multi-table operations. Use `ctx.orm` for simple single-table reads/updates.
1130
+ Use Better Auth API for multi-table org, invitation, member, role, and team
1131
+ operations. Use `ctx.orm` for simple single-table reads such as list orgs,
1132
+ check slug, and list user invitations.
@@ -561,19 +561,8 @@ Example-parity helper module:
561
561
 
562
562
  ## API Reference
563
563
 
564
- | Operation | Method | Type |
565
- |-----------|--------|------|
566
- | Checkout | `authClient.checkout` | Client |
567
- | Customer portal | `authClient.customer.portal` | Client |
568
- | Customer state | `authClient.customer.state` | Client |
569
- | List benefits | `authClient.customer.benefits.list` | Client |
570
- | List orders | `authClient.customer.orders.list` | Client |
571
- | List subscriptions | `authClient.customer.subscriptions.list` | Client |
572
- | Event ingestion | `authClient.usage.ingestion` | Client |
573
- | List meters | `authClient.usage.meters.list` | Client |
574
- | Create customer | `internal.polarCustomer.createCustomer` | Internal action |
575
- | Link customer ID | `internal.polarCustomer.updateUserPolarCustomerId` | Internal mutation |
576
- | Create subscription | `internal.polarSubscription.createSubscription` | Internal mutation |
577
- | Update subscription | `internal.polarSubscription.updateSubscription` | Internal mutation |
578
- | Cancel subscription | Convex action | User action |
579
- | Resume subscription | Convex action | User action |
564
+ Client operations: checkout, portal, customer state, benefits, orders,
565
+ subscriptions, usage ingestion, and meter listing.
566
+
567
+ Internal operations: create/link Polar customers and create/update
568
+ subscriptions. User-facing cancellation/resume flows should be Convex actions.
@@ -501,12 +501,8 @@ Auth triggers (`defineAuth(...).triggers`) handle auth lifecycle events. DB trig
501
501
 
502
502
  Nested `{ create, update, delete, change }` per table, matching ORM `defineTriggers` pattern:
503
503
 
504
- | Hook | Signature | Return |
505
- |------|-----------|--------|
506
- | `create.before` | `(data, ctx) => void \| { data } \| false` | Merge / cancel |
507
- | `create.after` | `(doc, ctx) => void` | Side effects |
508
- | `update.before` | `(update, ctx) => void \| { data } \| false` | Merge / cancel |
509
- | `update.after` | `(newDoc, ctx) => void` | Sync changes |
510
- | `delete.before` | `(doc, ctx) => void \| { data } \| false` | Guard / cancel |
511
- | `delete.after` | `(doc, ctx) => void` | Cleanup |
512
- | `change` | `(change, ctx) => void` | Cross-operation |
504
+ - `create.before(data, ctx)` / `update.before(update, ctx)` /
505
+ `delete.before(doc, ctx)` may return `{ data }` or `false`.
506
+ - `create.after(doc, ctx)`, `update.after(newDoc, ctx)`, and
507
+ `delete.after(doc, ctx)` run side effects.
508
+ - `change(change, ctx)` handles cross-operation sync.
@@ -617,60 +617,32 @@ if (ctx.isAuthenticated) await ctx.caller.todos.create({ title: "New task" });
617
617
 
618
618
  ### Route Builder Patterns
619
619
 
620
- | Pattern | Use Case |
621
- | ---------------------------------------- | ------------------------ |
622
- | `publicRoute.get('/path').query()` | Public GET endpoint |
623
- | `authRoute.post('/path').mutation()` | Auth-required POST |
624
- | `optionalAuthRoute.get('/path').query()` | Optional auth endpoint |
625
- | `.params(z.object({id}))` | Path params `/todos/:id` |
626
- | `.searchParams(z.object({limit}))` | Query params `?limit=10` |
627
- | `.input(z.object({...}))` | JSON body (POST/PATCH) |
628
- | `.form(z.object({file, description}))` | FormData uploads |
629
- | `.output(z.object({...}))` | Response validation |
630
- | `.meta({ ratelimit: 'api/heavy' })` | Procedure metadata |
631
- | `.use(middleware)` | Custom middleware |
632
- | `router({ endpoint1, endpoint2 })` | Group endpoints |
620
+ - `publicRoute.get("/path").query()` for public GET.
621
+ - `authRoute.post("/path").mutation()` for authenticated writes.
622
+ - `optionalAuthRoute.get("/path").query()` for optional-auth reads.
623
+ - Chain `.params(...)`, `.searchParams(...)`, `.input(...)`, `.form(...)`,
624
+ `.output(...)`, `.meta(...)`, and `.use(...)` as needed.
625
+ - Use `router({ endpoint })` for feature-level endpoint groups.
633
626
 
634
627
  ### HTTP Methods
635
628
 
636
- | Method | Builder | Use Case | Has Body |
637
- | ------ | ---------------------- | ----------------- | -------- |
638
- | GET | `.get().query()` | Read operations | No |
639
- | POST | `.post().mutation()` | Create operations | Yes |
640
- | PATCH | `.patch().mutation()` | Partial updates | Yes |
641
- | DELETE | `.delete().mutation()` | Delete operations | No |
629
+ Use `.get().query()` for reads, `.post().mutation()` for creates,
630
+ `.patch().mutation()` for partial updates, and `.delete().mutation()` for
631
+ deletes. GET/DELETE should not carry JSON bodies.
642
632
 
643
633
  ### Error Codes
644
634
 
645
- | Code | HTTP Status | Use Case |
646
- | ----------------------- | ----------- | --------------------------------- |
647
- | `BAD_REQUEST` | 400 | Invalid request format |
648
- | `UNAUTHORIZED` | 401 | Missing or invalid authentication |
649
- | `FORBIDDEN` | 403 | Authenticated but not authorized |
650
- | `NOT_FOUND` | 404 | Resource doesn't exist |
651
- | `CONFLICT` | 409 | Resource conflict (duplicate) |
652
- | `UNPROCESSABLE_CONTENT` | 422 | Validation failed |
653
- | `TOO_MANY_REQUESTS` | 429 | Rate limit exceeded |
654
- | `INTERNAL_SERVER_ERROR` | 500 | Unexpected server error |
635
+ Map expected failures through `CRPCError`: `BAD_REQUEST` 400, `UNAUTHORIZED`
636
+ 401, `FORBIDDEN` 403, `NOT_FOUND` 404, `CONFLICT` 409,
637
+ `UNPROCESSABLE_CONTENT` 422, `TOO_MANY_REQUESTS` 429, and
638
+ `INTERNAL_SERVER_ERROR` 500.
655
639
 
656
640
  ### Input Args
657
641
 
658
- | Property | Type | Description |
659
- | -------------- | --------------------------------------- | ------------------------------------- |
660
- | `params` | `Record<string, string>` | Path parameters (`:id`) |
661
- | `searchParams` | `Record<string, string \| string[]>` | Query string params |
662
- | `form` | `z.infer<TForm>` | Typed FormData (if `.form()` defined) |
663
- | `fetch` | `typeof fetch` | Custom fetch function |
664
- | `init` | `RequestInit` | Request options |
665
- | `headers` | `Record<string, string> \| (() => ...)` | Headers (incl. cookies) |
666
- | `[key]` | `unknown` | JSON body fields at root |
642
+ Client args can include `params`, `searchParams`, `form`, custom `fetch`,
643
+ `init`, `headers`, and root JSON body fields.
667
644
 
668
645
  ### Client Methods
669
646
 
670
- | Method | Signature | Description |
671
- | -------------------- | --------------------- | ----------------------------------------- |
672
- | `queryOptions` | `(args?, queryOpts?)` | Options for `useQuery`/`useSuspenseQuery` |
673
- | `staticQueryOptions` | `(args?, queryOpts?)` | For event handlers/prefetching (no hooks) |
674
- | `mutationOptions` | `(mutationOpts?)` | Options for `useMutation` |
675
- | `queryKey` | `(args?)` | Get query key for cache operations |
676
- | `queryFilter` | `(args?, filters?)` | Filter for `invalidateQueries` |
647
+ Generated clients expose `queryOptions`, `staticQueryOptions`,
648
+ `mutationOptions`, `queryKey`, and `queryFilter`.
@@ -1120,56 +1120,34 @@ export default defineSchema(tables, {
1120
1120
 
1121
1121
  ### Column Types
1122
1122
 
1123
- All from `kitcn/orm`:
1124
-
1125
- | Builder | TS Type | Convex | Notes |
1126
- | ------------------------------- | ------------- | ---------------------- | ------------------------------------------ |
1127
- | `text()` | `string` | `v.string()` | |
1128
- | `textEnum(['a','b'] as const)` | `'a' \| 'b'` | `v.string()` | Runtime-validated |
1129
- | `integer()` | `number` | `v.number()` | Float64 |
1130
- | `boolean()` | `boolean` | `v.boolean()` | |
1131
- | `bigint()` | `bigint` | `v.int64()` | |
1132
- | `timestamp()` | `Date` | `v.number()` | `.defaultNow()` for createdAt |
1133
- | `timestamp({ mode: 'string' })` | `string` | `v.number()` | |
1134
- | `date()` | `string` | `v.string()` | YYYY-MM-DD, or `{ mode: 'date' }` → `Date` |
1135
- | `id('table')` | `Id<'table'>` | `v.id('table')` | Typed reference |
1136
- | `vector(dims)` | `number[]` | `v.array(v.float64())` | For vectorIndex |
1137
- | `bytes()` | `ArrayBuffer` | `v.bytes()` | |
1138
- | `unionOf(text(), integer())` | `string \| number` | `v.union(...)` | Builder-only scalar union sugar |
1139
- | `objectOf(text().notNull())` | `Record<string, string>` | `v.record(...)` | Homogeneous record values |
1140
- | `json<T>()` | `T` | `v.any()` | Type-only, no runtime validation |
1141
- | `custom(validator)` | inferred | any `v.*` | Full Convex validator |
1123
+ All come from `kitcn/orm`: `text`, `textEnum`, `integer`, `boolean`,
1124
+ `bigint`, `timestamp`, `date`, `id`, `vector`, `bytes`, `unionOf`, `objectOf`,
1125
+ `json`, and `custom`.
1126
+
1127
+ Key type notes: `timestamp()` stores Convex numbers and exposes `Date`;
1128
+ `timestamp({ mode: "string" })` exposes `string`; `date()` is YYYY-MM-DD unless
1129
+ `{ mode: "date" }`; `json<T>()` is type-only over `v.any()`; `custom(...)`
1130
+ keeps the provided Convex validator.
1142
1131
 
1143
1132
  ### Operators
1144
1133
 
1145
- | Category | Operators |
1146
- | ------------------- | ---------------------------------------------------------------------------- |
1147
- | Comparison | `eq`, `ne`, `gt`, `gte`, `lt`, `lte` |
1148
- | Range | `between` (inclusive), `notBetween` (strict outside) |
1149
- | Set | `in`, `notIn` |
1150
- | Null | `isNull`, `isNotNull` |
1151
- | Logical | `AND`, `OR`, `NOT` |
1152
- | String (post-fetch) | `like`, `ilike`, `notLike`, `notIlike`, `startsWith`, `endsWith`, `contains` |
1153
- | Array (post-fetch) | `arrayContains`, `arrayContained`, `arrayOverlaps` |
1134
+ - Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`
1135
+ - Range/set/null: `between`, `notBetween`, `in`, `notIn`, `isNull`, `isNotNull`
1136
+ - Logical: `AND`, `OR`, `NOT`
1137
+ - Post-fetch string/array: `like`, `ilike`, `notLike`, `notIlike`,
1138
+ `startsWith`, `endsWith`, `contains`, `arrayContains`, `arrayContained`,
1139
+ `arrayOverlaps`
1154
1140
 
1155
1141
  ### Select Composition Limitations
1156
1142
 
1157
- | Combination | Status |
1158
- | ------------------------- | ------------- |
1159
- | `select() + search` | Not supported |
1160
- | `select() + vectorSearch` | Not supported |
1161
- | `select() + offset` | Not supported |
1162
- | `select() + with` | Not supported |
1163
- | `select() + extras` | Not supported |
1164
- | `select() + columns` | Not supported |
1143
+ Do not combine `select()` with `search`, `vectorSearch`, `offset`, `with`,
1144
+ `extras`, or `columns`.
1165
1145
 
1166
1146
  ### Full-Scan Operator Workarounds
1167
1147
 
1168
- | Operator | Scalable workaround |
1169
- | ---------------------------------- | -------------------------------------------------- |
1170
- | `arrayContains/Contained/Overlaps` | Inverted/join table keyed by element |
1171
- | `contains` | `withSearchIndex` or tokenized denormalized field |
1172
- | `endsWith` | Store reversed column, use `startsWith` |
1173
- | `ilike`/`notIlike` | Lowercase column + `startsWith`/`like('prefix%')` |
1174
- | `notLike` | Indexed positive pre-filter + `notLike` post-fetch |
1175
- | `NOT` (general) | Rewrite to positive predicates; cap with `maxScan` |
1148
+ - Array membership/overlap: use an inverted or join table keyed by element.
1149
+ - `contains`: use `withSearchIndex` or tokenized denormalized fields.
1150
+ - `endsWith`: store a reversed column and query with `startsWith`.
1151
+ - `ilike` / `notIlike`: lowercase a query column and use prefix/like filters.
1152
+ - `notLike` and general `NOT`: rewrite to positive indexed predicates and cap
1153
+ fallback scans with `maxScan`.
@@ -657,11 +657,6 @@ Don't render `preloadQuery` data in BOTH Server and Client components — the se
657
657
 
658
658
  ### Infinite Query Return Value
659
659
 
660
- | Property | Type | Description |
661
- |----------|------|-------------|
662
- | `data` | `T[]` | Flattened array of all items |
663
- | `pages` | `T[][]` | Raw page arrays |
664
- | `fetchNextPage` | `(limit?) => void` | Load next page |
665
- | `hasNextPage` | `boolean` | More pages exist |
666
- | `status` | `PaginationStatus` | `'LoadingFirstPage' \| 'LoadingMore' \| 'CanLoadMore' \| 'Exhausted'` |
667
- | `isPlaceholderData` | `boolean` | Showing placeholder |
660
+ Return fields: flattened `data`, raw `pages`, `fetchNextPage(limit?)`,
661
+ `hasNextPage`, `status`, and `isPlaceholderData`. Status is one of
662
+ `LoadingFirstPage`, `LoadingMore`, `CanLoadMore`, or `Exhausted`.
@@ -728,58 +728,19 @@ Then sanity-check auth runtime paths:
728
728
  16. Phase A gate (Section 11.2) passes before any auth implementation.
729
729
  17. If auth enabled: Phase B auth sign-in gate (Section 11.3) passes before optional modules/plugins.
730
730
  18. No legacy Ents patterns in setup code.
731
- 19. NEVER use `@ts-nocheck` in app/convex source files.
731
+ 19. Do not use `@ts-nocheck` in app/convex source files.
732
732
 
733
733
  ## 13. Troubleshooting
734
734
 
735
735
  See the [Troubleshooting Reference](#troubleshooting-reference) at the bottom of this document for the full symptom/cause/fix matrix.
736
736
 
737
- ## Coverage Matrix
738
-
739
- Source coverage mapping used to build this runbook:
740
-
741
- | Source | Mapped In Setup |
742
- | ------------------------------------------------- | -------------------- |
743
- | `www/content/docs/cli/registry.mdx` | Sections 3, 11 |
744
- | `www/content/docs/quickstart.mdx` | Sections 3, 4, 11, 12 |
745
- | `www/content/docs/server/setup.mdx` | Section 5.3 |
746
- | `www/content/docs/auth/server.mdx` | Sections 6.1 - 6.10 |
747
- | `www/content/docs/auth/client.mdx` | Section 7.1 |
748
- | `www/content/docs/auth/server.mdx#triggers` | Section 6.3, 9.2 |
749
- | `www/content/docs/react/index.mdx` | Sections 7.2 - 7.4 |
750
- | `www/content/docs/nextjs/index.mdx` | Section 8.A |
751
- | `www/content/docs/tanstack-start.mdx` | Section 8.B |
752
- | `www/content/docs/server/http.mdx` | Sections 6.6, 9.6 |
753
- | `www/content/docs/server/server-side-calls.mdx` | Section 8.A.1, 8.B.3 |
754
- | `www/content/docs/plugins/ratelimit.mdx` | Section 9.4 |
755
- | `www/content/docs/orm/queries/aggregates.mdx` | Section 9.3 |
756
- | `www/content/docs/server/scheduling.mdx` | Section 9.5 |
757
- | `www/content/docs/orm/queries/index.mdx` | Sections 5, 12 |
758
- | `www/content/docs/orm/mutations/index.mdx` | Sections 5, 12 |
759
- | `www/content/docs/orm/triggers.mdx` | Sections 9.2, 9.3 |
760
- | `www/content/docs/orm/rls.mdx` | Section 9.1 |
761
- | `www/content/docs/auth/plugins/admin.mdx` | Section 10.1 |
762
- | `www/content/docs/auth/plugins/organizations.mdx` | Section 10.2 |
763
- | `www/content/docs/auth/plugins/polar.mdx` | Section 10.3 |
764
- | `www/content/docs/cli/backend.mdx` | Section 11 |
765
-
766
- ### Template Coverage (Recreation Target)
767
-
768
- This runbook + references map to the canonical template shape as follows:
769
-
770
- | Example Group | Primary Setup Section | Additional Reference |
771
- | --------------------------------------------------------------------------------------------------------- | ------------------------------- | ---------------------------------------- |
772
- | Core infra (`schema.ts`, `functions/generated/`, `crpc.ts`, `http.ts`) | Sections 5, 6.6, 9.6 | `orm.md`, `http.md` |
773
- | Shared contracts (`shared/api.ts`, `shared/auth-shared.ts`, `shared/polar-shared.ts`) | Sections 5.4, 6.3.2, 10.2, 10.3 | `auth-organizations.md` |
774
- | Auth core (`auth.config.ts`, `auth.ts`) | Section 6 | `auth.md` |
775
- | Auth plugins (`admin.ts`, `organization.ts`, `polar*`) | Section 10 | `auth-admin.md`, `auth-organizations.md` |
776
- | Feature modules (`user.ts`, `projects.ts`, `tags.ts`, `todoComments.ts`, `public.ts`, `items/queries.ts`) | Sections 5, 6.3.1, 9 | core `SKILL.md`, `orm.md` |
777
- | HTTP routers (`routers/health.ts`, `routers/todos.ts`, `routers/examples.ts`) | Section 9.6 | `http.md` |
778
- | Aggregates + rate limits (`aggregates.ts`, `lib/plugins/ratelimit/plugin.ts`) | Sections 9.3, 9.4 | `aggregates.md`, `orm.md` |
779
- | Scheduling + internals (`todoInternal.ts`, delayed jobs) | Sections 9.5, 11.1 | `scheduling.md` |
780
- | Email + Resend (`functions/plugins/email.tsx`, `lib/plugins/resend/*`) | Section 9.7 | `auth-organizations.md` |
781
- | Dev bootstrap (`init.ts`, `seed.ts`, `reset.ts`) | Section 11.1 | `testing.md` (for verification) |
782
- | Generated outputs (`functions/_generated/*`, `functions/generated/`, `shared/api.ts`) | Section 5.5 | n/a (generated by CLI) |
737
+ ## Coverage Notes
738
+
739
+ This setup runbook compresses the CLI registry, quickstart, server setup,
740
+ auth, React, Next.js, TanStack Start, HTTP, scheduling, aggregate, ORM,
741
+ RLS/trigger, plugin, and backend CLI docs. Use the feature references for
742
+ domain depth: `orm.md`, `http.md`, `react.md`, `aggregates.md`,
743
+ `scheduling.md`, `testing.md`, `auth*.md`, and `create-plugins.md`.
783
744
 
784
745
  ## Troubleshooting Reference
785
746