kitcn 0.12.27 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/aggregate/index.d.ts +1 -1
  2. package/dist/aggregate/index.js +1 -1
  3. package/dist/auth/client/index.d.ts +312 -4
  4. package/dist/auth/client/index.js +17 -5
  5. package/dist/auth/config/index.d.ts +1 -1
  6. package/dist/auth/generated/index.d.ts +1 -1
  7. package/dist/auth/generated/index.js +1 -1
  8. package/dist/auth/http/index.d.ts +12 -9
  9. package/dist/auth/http/index.js +35 -6
  10. package/dist/auth/index.d.ts +292 -8
  11. package/dist/auth/index.js +29 -23
  12. package/dist/auth/nextjs/index.d.ts +4 -3
  13. package/dist/auth/nextjs/index.js +9 -4
  14. package/dist/auth/start/index.d.ts +13 -3
  15. package/dist/auth/start/index.js +97 -8
  16. package/dist/{backend-core-DqCCa0nr.mjs → backend-core-CXmrWqdi.mjs} +122 -48
  17. package/dist/{builder-Cb6gloDB.js → builder-DBgto1yn.js} +4 -3
  18. package/dist/{caller-factory-cTXNvYdz.js → caller-factory-NEfgD5E0.js} +3 -3
  19. package/dist/cli.mjs +26 -26
  20. package/dist/convex-plugin-C3N9BB-J.js +275 -0
  21. package/dist/convex-plugin-tWTDqoKJ.mjs +276 -0
  22. package/dist/{create-schema-orm-DOyiNDCx.js → create-schema-orm-B3f2Kc8O.js} +1 -1
  23. package/dist/crpc/index.d.ts +2 -2
  24. package/dist/crpc/index.js +3 -3
  25. package/dist/{customFunctions-C0voKmtx.js → customFunctions-DxEEO4Dq.js} +2 -1
  26. package/dist/{generated-contract-disabled-21YxPk5W.d.ts → generated-contract-disabled-C_-KWRfT.d.ts} +4 -2
  27. package/dist/{http-types-BLFA9zS7.d.ts → http-types-zsMHb_QN.d.ts} +2 -2
  28. package/dist/{middleware-DkIhQXwg.js → middleware-Bg-PdtrI.js} +1 -1
  29. package/dist/{middleware-nS_qXecO.d.ts → middleware-DrtexzF3.d.ts} +1 -1
  30. package/dist/orm/index.d.ts +3 -3
  31. package/dist/orm/index.js +3 -3
  32. package/dist/plugins/index.d.ts +1 -1
  33. package/dist/plugins/index.js +1 -1
  34. package/dist/{procedure-caller-AjLfkHyF.js → procedure-caller-DplSC7Us.js} +2 -2
  35. package/dist/{procedure-name-D-fDCBlo.d.ts → procedure-name-BCRBr6Po.d.ts} +3 -3
  36. package/dist/ratelimit/index.d.ts +2 -2
  37. package/dist/ratelimit/index.js +3 -3
  38. package/dist/react/index.d.ts +18 -14
  39. package/dist/react/index.js +14 -27
  40. package/dist/rsc/index.d.ts +4 -4
  41. package/dist/rsc/index.js +4 -4
  42. package/dist/{runtime-CtvJPkur.js → runtime-i6t-HoZn.js} +1 -1
  43. package/dist/server/index.d.ts +4 -4
  44. package/dist/server/index.js +4 -4
  45. package/dist/solid/index.d.ts +300 -4
  46. package/dist/token-B9Bjcqug.d.ts +13 -0
  47. package/dist/token-tpipF-7y.js +47 -0
  48. package/dist/{types-C6pQrnzD.d.ts → types-YHpe0rsb.d.ts} +1 -1
  49. package/dist/upstream-BR6sBLg3.js +84 -0
  50. package/dist/upstream-BUCdbLok.mjs +26 -0
  51. package/dist/{validators-B7oIJCAp.js → validators-C7LelqTN.js} +2 -84
  52. package/dist/watcher.mjs +1 -1
  53. package/dist/{where-clause-compiler-DdjN63Io.d.ts → where-clause-compiler-TMppDl9g.d.ts} +51 -51
  54. package/package.json +5 -4
  55. package/skills/convex/references/features/auth.md +20 -0
  56. package/skills/convex/references/setup/auth.md +2 -0
  57. package/skills/convex/references/setup/index.md +5 -5
  58. package/skills/convex/references/setup/server.md +1 -1
  59. /package/dist/{api-entry-BUAh_K4k.js → api-entry-N3nBOlI2.js} +0 -0
  60. /package/dist/{context-utils-BvWW0Ilq.d.ts → context-utils-OMkMGhBk.d.ts} +0 -0
  61. /package/dist/{create-schema-odyF4kCy.js → create-schema-BXrKE2YY.js} +0 -0
  62. /package/dist/{error-BZEnI7Sq.js → error-Bvo7YEhk.js} +0 -0
  63. /package/dist/{generated-contract-disabled-Cih4eITO.js → generated-contract-disabled-BXaz7JCE.js} +0 -0
  64. /package/dist/{meta-utils-0Pu0Nrap.js → meta-utils-D9K4fICl.js} +0 -0
  65. /package/dist/{query-context-CFZqIvD7.d.ts → query-context-CNo9ffvI.d.ts} +0 -0
  66. /package/dist/{query-context-B8o6-8kC.js → query-context-ydn9kb6P.js} +0 -0
  67. /package/dist/{query-options-Dw7cOyXl.js → query-options-C96zLANM.js} +0 -0
  68. /package/dist/{transformer-DtDhR3Lc.js → transformer-C6pGVHqx.js} +0 -0
  69. /package/dist/{types-BiJE7qxR.d.ts → types-BCl8gfGy.d.ts} +0 -0
  70. /package/dist/{types-a-RHmrDZ.d.ts → types-CnTpHR1F.d.ts} +0 -0
  71. /package/dist/{types-BTb_4BaU.d.ts → types-DF2cg_w0.d.ts} +0 -0
  72. /package/dist/{validators-vzRKjBJC.d.ts → validators-BhsByJeg.d.ts} +0 -0
@@ -0,0 +1,47 @@
1
+ import { t as JWT_COOKIE_NAME } from "./convex-plugin-C3N9BB-J.js";
2
+ import { betterFetch } from "@better-fetch/fetch";
3
+ import { getSessionCookie } from "better-auth/cookies";
4
+ import * as jose from "jose";
5
+
6
+ //#region src/auth/internal/token-utils.ts
7
+ const TRAILING_SLASH_RE = /\/$/;
8
+ const resolveConvexTokenPath = (basePath) => {
9
+ return `${basePath && basePath !== "/" ? basePath.replace(TRAILING_SLASH_RE, "") : "/api/auth"}/convex/token`;
10
+ };
11
+ const isTokenExpired = (exp, expirationToleranceSeconds = 60, now = Math.floor(Date.now() / 1e3)) => {
12
+ if (!exp) return true;
13
+ return now >= exp - expirationToleranceSeconds;
14
+ };
15
+
16
+ //#endregion
17
+ //#region src/auth/internal/token.ts
18
+ const getToken = async (siteUrl, headers, opts) => {
19
+ const fetchToken = async () => {
20
+ const { data } = await betterFetch(resolveConvexTokenPath(opts?.basePath), {
21
+ baseURL: siteUrl,
22
+ headers
23
+ });
24
+ return {
25
+ isFresh: true,
26
+ token: data?.token
27
+ };
28
+ };
29
+ if (!opts?.jwtCache?.enabled || opts.forceRefresh) return await fetchToken();
30
+ const token = getSessionCookie(new Headers(headers), {
31
+ cookieName: JWT_COOKIE_NAME,
32
+ cookiePrefix: opts?.cookiePrefix
33
+ });
34
+ if (!token) return await fetchToken();
35
+ try {
36
+ if (!isTokenExpired(jose.decodeJwt(token)?.exp, opts?.jwtCache?.expirationToleranceSeconds ?? 60)) return {
37
+ isFresh: false,
38
+ token
39
+ };
40
+ } catch (error) {
41
+ console.error("Error decoding JWT", error);
42
+ }
43
+ return await fetchToken();
44
+ };
45
+
46
+ //#endregion
47
+ export { getToken as t };
@@ -1,4 +1,4 @@
1
- import { O as CombinedDataTransformer, n as HttpClientError } from "./http-types-BLFA9zS7.js";
1
+ import { O as CombinedDataTransformer, n as HttpClientError } from "./http-types-zsMHb_QN.js";
2
2
  import { FunctionArgs, FunctionReference, FunctionReturnType } from "convex/server";
3
3
 
4
4
  //#region src/crpc/http-client.d.ts
@@ -0,0 +1,84 @@
1
+ //#region src/internal/upstream/index.ts
2
+ /** biome-ignore-all lint: vendored upstream helper source */
3
+ /**
4
+ * Vendored from upstream helper repository at commit c5e52c8.
5
+ * Source path: packages/convex_helpers/index.ts
6
+ */
7
+ /**
8
+ * asyncMap returns the results of applying an async function over an list.
9
+ *
10
+ * The list can even be a promise, or an iterable like a Set.
11
+ * @param list - Iterable object of items, e.g. an Array, Set, Object.keys
12
+ * @param asyncTransform
13
+ * @returns
14
+ */
15
+ async function asyncMap(list, asyncTransform) {
16
+ const promises = [];
17
+ let index = 0;
18
+ list = await list;
19
+ for (const item of list) {
20
+ promises.push(asyncTransform(item, index));
21
+ index += 1;
22
+ }
23
+ return Promise.all(promises);
24
+ }
25
+ /**
26
+ * pick helps you pick keys from an object more concisely.
27
+ *
28
+ * e.g. `pick({a: v.string(), b: v.number()}, ["a"])` is equivalent to
29
+ * `{a: v.string()}`
30
+ * The alternative could be something like:
31
+ * ```js
32
+ * const obj = { a: v.string(), b: v.number() };
33
+ * // pick does the following
34
+ * const { a } = obj;
35
+ * const onlyA = { a };
36
+ * ```
37
+ *
38
+ * @param obj The object to pick from. Often like { a: v.string() }
39
+ * @param keys The keys to pick from the object.
40
+ * @returns A new object with only the keys you picked and their values.
41
+ */
42
+ function pick(obj, keys) {
43
+ return Object.fromEntries(Object.entries(obj).filter(([k]) => keys.includes(k)));
44
+ }
45
+ /**
46
+ * omit helps you omit keys from an object more concisely.
47
+ *
48
+ * e.g. `omit({a: v.string(), b: v.number()}, ["a"])` is equivalent to
49
+ * `{b: v.number()}`
50
+ *
51
+ * The alternative could be something like:
52
+ * ```js
53
+ * const obj = { a: v.string(), b: v.number() };
54
+ * // omit does the following
55
+ * const { a, ...rest } = obj;
56
+ * const withoutA = rest;
57
+ * ```
58
+ *
59
+ * @param obj The object to return a copy of without the specified keys.
60
+ * @param keys The keys to omit from the object.
61
+ * @returns A new object with the keys you omitted removed.
62
+ */
63
+ function omit(obj, keys) {
64
+ return Object.fromEntries(Object.entries(obj).filter(([k]) => !keys.includes(k)));
65
+ }
66
+ /**
67
+ * A utility to validate truthiness at runtime, providing a type guard
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * const x: string | null = getValue();
72
+ * assert(x);
73
+ * // x is now of type string
74
+ * ```
75
+ * You can also provide a function, to avoid doing expensive string templating.
76
+ * @param arg A value to assert the truthiness of.
77
+ * @param message An optional message to throw if the value is not truthy, or a function to generate the message.
78
+ */
79
+ function assert(value, message) {
80
+ if (!value) throw new Error(typeof message === "function" ? message() : message);
81
+ }
82
+
83
+ //#endregion
84
+ export { pick as i, asyncMap as n, omit as r, assert as t };
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+ //#region src/internal/upstream/index.ts
3
+ /**
4
+ * omit helps you omit keys from an object more concisely.
5
+ *
6
+ * e.g. `omit({a: v.string(), b: v.number()}, ["a"])` is equivalent to
7
+ * `{b: v.number()}`
8
+ *
9
+ * The alternative could be something like:
10
+ * ```js
11
+ * const obj = { a: v.string(), b: v.number() };
12
+ * // omit does the following
13
+ * const { a, ...rest } = obj;
14
+ * const withoutA = rest;
15
+ * ```
16
+ *
17
+ * @param obj The object to return a copy of without the specified keys.
18
+ * @param keys The keys to omit from the object.
19
+ * @returns A new object with the keys you omitted removed.
20
+ */
21
+ function omit(obj, keys) {
22
+ return Object.fromEntries(Object.entries(obj).filter(([k]) => !keys.includes(k)));
23
+ }
24
+
25
+ //#endregion
26
+ export { omit as t };
@@ -1,88 +1,6 @@
1
+ import { t as assert } from "./upstream-BR6sBLg3.js";
1
2
  import { asObjectValidator, v } from "convex/values";
2
3
 
3
- //#region src/internal/upstream/index.ts
4
- /** biome-ignore-all lint: vendored upstream helper source */
5
- /**
6
- * Vendored from upstream helper repository at commit c5e52c8.
7
- * Source path: packages/convex_helpers/index.ts
8
- */
9
- /**
10
- * asyncMap returns the results of applying an async function over an list.
11
- *
12
- * The list can even be a promise, or an iterable like a Set.
13
- * @param list - Iterable object of items, e.g. an Array, Set, Object.keys
14
- * @param asyncTransform
15
- * @returns
16
- */
17
- async function asyncMap(list, asyncTransform) {
18
- const promises = [];
19
- let index = 0;
20
- list = await list;
21
- for (const item of list) {
22
- promises.push(asyncTransform(item, index));
23
- index += 1;
24
- }
25
- return Promise.all(promises);
26
- }
27
- /**
28
- * pick helps you pick keys from an object more concisely.
29
- *
30
- * e.g. `pick({a: v.string(), b: v.number()}, ["a"])` is equivalent to
31
- * `{a: v.string()}`
32
- * The alternative could be something like:
33
- * ```js
34
- * const obj = { a: v.string(), b: v.number() };
35
- * // pick does the following
36
- * const { a } = obj;
37
- * const onlyA = { a };
38
- * ```
39
- *
40
- * @param obj The object to pick from. Often like { a: v.string() }
41
- * @param keys The keys to pick from the object.
42
- * @returns A new object with only the keys you picked and their values.
43
- */
44
- function pick(obj, keys) {
45
- return Object.fromEntries(Object.entries(obj).filter(([k]) => keys.includes(k)));
46
- }
47
- /**
48
- * omit helps you omit keys from an object more concisely.
49
- *
50
- * e.g. `omit({a: v.string(), b: v.number()}, ["a"])` is equivalent to
51
- * `{b: v.number()}`
52
- *
53
- * The alternative could be something like:
54
- * ```js
55
- * const obj = { a: v.string(), b: v.number() };
56
- * // omit does the following
57
- * const { a, ...rest } = obj;
58
- * const withoutA = rest;
59
- * ```
60
- *
61
- * @param obj The object to return a copy of without the specified keys.
62
- * @param keys The keys to omit from the object.
63
- * @returns A new object with the keys you omitted removed.
64
- */
65
- function omit(obj, keys) {
66
- return Object.fromEntries(Object.entries(obj).filter(([k]) => !keys.includes(k)));
67
- }
68
- /**
69
- * A utility to validate truthiness at runtime, providing a type guard
70
- *
71
- * @example
72
- * ```ts
73
- * const x: string | null = getValue();
74
- * assert(x);
75
- * // x is now of type string
76
- * ```
77
- * You can also provide a function, to avoid doing expensive string templating.
78
- * @param arg A value to assert the truthiness of.
79
- * @param message An optional message to throw if the value is not truthy, or a function to generate the message.
80
- */
81
- function assert(value, message) {
82
- if (!value) throw new Error(typeof message === "function" ? message() : message);
83
- }
84
-
85
- //#endregion
86
4
  //#region src/internal/upstream/validators.ts
87
5
  function partial(fieldsOrObjOrUnion) {
88
6
  if (fieldsOrObjOrUnion.isConvexValidator) {
@@ -276,4 +194,4 @@ function vRequired(validator) {
276
194
  }
277
195
 
278
196
  //#endregion
279
- export { pretendRequired as a, omit as c, pretend as i, pick as l, deprecated as n, vRequired as o, partial as r, asyncMap as s, addFieldsToValidator as t };
197
+ export { pretendRequired as a, pretend as i, deprecated as n, vRequired as o, partial as r, addFieldsToValidator as t };
package/dist/watcher.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { A as resolveConfiguredBackend, Ct as generateMeta, K as withLocalCodegenEnv, P as resolveRunDeps, Tt as logger, wt as getConvexConfig } from "./backend-core-DqCCa0nr.mjs";
2
+ import { Dt as logger, Et as getConvexConfig, F as resolveRunDeps, Tt as generateMeta, j as resolveConfiguredBackend, q as withLocalCodegenEnv } from "./backend-core-CXmrWqdi.mjs";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
 
@@ -1,4 +1,4 @@
1
- import { a as ReturnTypeOrValue, i as KnownKeysOnly, o as Simplify$1, t as Assume } from "./types-BTb_4BaU.js";
1
+ import { a as ReturnTypeOrValue, i as KnownKeysOnly, o as Simplify$1, t as Assume } from "./types-DF2cg_w0.js";
2
2
  import * as convex_values0 from "convex/values";
3
3
  import { GenericId, Validator, Value } from "convex/values";
4
4
  import { DefineSchemaOptions, FilterExpression, GenericDatabaseReader, GenericDatabaseWriter, GenericIndexFields, GenericSchema, GenericTableIndexes, GenericTableSearchIndexes, GenericTableVectorIndexes, IndexRange, IndexRangeBuilder, SchedulableFunctionReference, Scheduler, SchemaDefinition, TableDefinition, VectorFilterBuilder, internalActionGeneric, internalMutationGeneric } from "convex/server";
@@ -3717,19 +3717,6 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
3717
3717
  readonly aggregate_bucket: ConvexTableWithColumns<{
3718
3718
  name: "aggregate_bucket";
3719
3719
  columns: {
3720
- count: ConvexNumberBuilderInitial<""> & {
3721
- _: {
3722
- notNull: true;
3723
- };
3724
- } & {
3725
- _: {
3726
- tableName: "aggregate_bucket";
3727
- };
3728
- } & {
3729
- _: {
3730
- fieldName: "count";
3731
- };
3732
- };
3733
3720
  tableKey: ConvexTextBuilderInitial<""> & {
3734
3721
  _: {
3735
3722
  notNull: true;
@@ -3799,6 +3786,19 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
3799
3786
  fieldName: "keyParts";
3800
3787
  };
3801
3788
  };
3789
+ count: ConvexNumberBuilderInitial<""> & {
3790
+ _: {
3791
+ notNull: true;
3792
+ };
3793
+ } & {
3794
+ _: {
3795
+ tableName: "aggregate_bucket";
3796
+ };
3797
+ } & {
3798
+ _: {
3799
+ fieldName: "count";
3800
+ };
3801
+ };
3802
3802
  sumValues: (NotNull<$Type<ConvexCustomBuilderInitial<"", convex_values0.VRecord<Record<string, any>, convex_values0.VString<string, "required">, convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>, "required", string>>, Record<string, number>>> | NotNull<$Type<ConvexCustomBuilderInitial<"", convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>>, Record<string, number>>>) & {
3803
3803
  _: {
3804
3804
  tableName: "aggregate_bucket";
@@ -4009,7 +4009,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4009
4009
  fieldName: "value";
4010
4010
  };
4011
4011
  };
4012
- count: ConvexNumberBuilderInitial<""> & {
4012
+ tableKey: ConvexTextBuilderInitial<""> & {
4013
4013
  _: {
4014
4014
  notNull: true;
4015
4015
  };
@@ -4019,10 +4019,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4019
4019
  };
4020
4020
  } & {
4021
4021
  _: {
4022
- fieldName: "count";
4022
+ fieldName: "tableKey";
4023
4023
  };
4024
4024
  };
4025
- tableKey: ConvexTextBuilderInitial<""> & {
4025
+ indexName: ConvexTextBuilderInitial<""> & {
4026
4026
  _: {
4027
4027
  notNull: true;
4028
4028
  };
@@ -4032,10 +4032,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4032
4032
  };
4033
4033
  } & {
4034
4034
  _: {
4035
- fieldName: "tableKey";
4035
+ fieldName: "indexName";
4036
4036
  };
4037
4037
  };
4038
- indexName: ConvexTextBuilderInitial<""> & {
4038
+ updatedAt: ConvexNumberBuilderInitial<""> & {
4039
4039
  _: {
4040
4040
  notNull: true;
4041
4041
  };
@@ -4045,10 +4045,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4045
4045
  };
4046
4046
  } & {
4047
4047
  _: {
4048
- fieldName: "indexName";
4048
+ fieldName: "updatedAt";
4049
4049
  };
4050
4050
  };
4051
- updatedAt: ConvexNumberBuilderInitial<""> & {
4051
+ keyHash: ConvexTextBuilderInitial<""> & {
4052
4052
  _: {
4053
4053
  notNull: true;
4054
4054
  };
@@ -4058,10 +4058,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4058
4058
  };
4059
4059
  } & {
4060
4060
  _: {
4061
- fieldName: "updatedAt";
4061
+ fieldName: "keyHash";
4062
4062
  };
4063
4063
  };
4064
- keyHash: ConvexTextBuilderInitial<""> & {
4064
+ count: ConvexNumberBuilderInitial<""> & {
4065
4065
  _: {
4066
4066
  notNull: true;
4067
4067
  };
@@ -4071,7 +4071,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4071
4071
  };
4072
4072
  } & {
4073
4073
  _: {
4074
- fieldName: "keyHash";
4074
+ fieldName: "count";
4075
4075
  };
4076
4076
  };
4077
4077
  fieldName: ConvexTextBuilderInitial<""> & {
@@ -4244,6 +4244,19 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4244
4244
  readonly aggregate_state: ConvexTableWithColumns<{
4245
4245
  name: "aggregate_state";
4246
4246
  columns: {
4247
+ status: ConvexTextBuilderInitial<""> & {
4248
+ _: {
4249
+ notNull: true;
4250
+ };
4251
+ } & {
4252
+ _: {
4253
+ tableName: "aggregate_state";
4254
+ };
4255
+ } & {
4256
+ _: {
4257
+ fieldName: "status";
4258
+ };
4259
+ };
4247
4260
  kind: ConvexTextBuilderInitial<""> & {
4248
4261
  _: {
4249
4262
  notNull: true;
@@ -4318,19 +4331,6 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4318
4331
  fieldName: "metricDefinitionHash";
4319
4332
  };
4320
4333
  };
4321
- status: ConvexTextBuilderInitial<""> & {
4322
- _: {
4323
- notNull: true;
4324
- };
4325
- } & {
4326
- _: {
4327
- tableName: "aggregate_state";
4328
- };
4329
- } & {
4330
- _: {
4331
- fieldName: "status";
4332
- };
4333
- };
4334
4334
  processed: ConvexNumberBuilderInitial<""> & {
4335
4335
  _: {
4336
4336
  notNull: true;
@@ -4398,35 +4398,35 @@ 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
+ status: ConvexTextBuilderInitial<""> & {
4402
+ _: {
4403
+ notNull: true;
4404
+ };
4405
+ } & {
4402
4406
  _: {
4403
4407
  tableName: "migration_state";
4404
4408
  };
4405
4409
  } & {
4406
4410
  _: {
4407
- fieldName: "cursor";
4411
+ fieldName: "status";
4408
4412
  };
4409
4413
  };
4410
- direction: ConvexTextBuilderInitial<""> & {
4414
+ cursor: ConvexTextBuilderInitial<""> & {
4411
4415
  _: {
4412
4416
  tableName: "migration_state";
4413
4417
  };
4414
4418
  } & {
4415
4419
  _: {
4416
- fieldName: "direction";
4420
+ fieldName: "cursor";
4417
4421
  };
4418
4422
  };
4419
- status: ConvexTextBuilderInitial<""> & {
4420
- _: {
4421
- notNull: true;
4422
- };
4423
- } & {
4423
+ direction: ConvexTextBuilderInitial<""> & {
4424
4424
  _: {
4425
4425
  tableName: "migration_state";
4426
4426
  };
4427
4427
  } & {
4428
4428
  _: {
4429
- fieldName: "status";
4429
+ fieldName: "direction";
4430
4430
  };
4431
4431
  };
4432
4432
  processed: ConvexNumberBuilderInitial<""> & {
@@ -4552,7 +4552,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4552
4552
  readonly migration_run: ConvexTableWithColumns<{
4553
4553
  name: "migration_run";
4554
4554
  columns: {
4555
- direction: ConvexTextBuilderInitial<""> & {
4555
+ status: ConvexTextBuilderInitial<""> & {
4556
4556
  _: {
4557
4557
  notNull: true;
4558
4558
  };
@@ -4562,10 +4562,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4562
4562
  };
4563
4563
  } & {
4564
4564
  _: {
4565
- fieldName: "direction";
4565
+ fieldName: "status";
4566
4566
  };
4567
4567
  };
4568
- status: ConvexTextBuilderInitial<""> & {
4568
+ direction: ConvexTextBuilderInitial<""> & {
4569
4569
  _: {
4570
4570
  notNull: true;
4571
4571
  };
@@ -4575,7 +4575,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
4575
4575
  };
4576
4576
  } & {
4577
4577
  _: {
4578
- fieldName: "status";
4578
+ fieldName: "direction";
4579
4579
  };
4580
4580
  };
4581
4581
  startedAt: ConvexNumberBuilderInitial<""> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitcn",
3
- "version": "0.12.27",
3
+ "version": "0.13.0",
4
4
  "description": "kitcn - React Query integration and CLI tools for Convex",
5
5
  "keywords": [
6
6
  "convex",
@@ -58,8 +58,8 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@babel/parser": "^7.28.4",
61
+ "@better-fetch/fetch": "^1.1.21",
61
62
  "@clack/prompts": "^0.11.0",
62
- "@convex-dev/better-auth": "^0.11.1",
63
63
  "chokidar": "^5.0.0",
64
64
  "common-tags": "^1.8.2",
65
65
  "diff": "^8.0.2",
@@ -69,6 +69,7 @@
69
69
  "jiti": "^2.6.1",
70
70
  "jotai": "^2.18.0",
71
71
  "jotai-x": "^2.3.3",
72
+ "jose": "^6.1.3",
72
73
  "picocolors": "^1.1.1",
73
74
  "remeda": "^2.33.6",
74
75
  "svix": "^1.84.1",
@@ -88,8 +89,8 @@
88
89
  "@tanstack/query-core": ">=5",
89
90
  "@tanstack/react-query": ">=5",
90
91
  "@tanstack/solid-query": ">=5",
91
- "better-auth": "1.5.3",
92
- "convex": ">=1.33",
92
+ "better-auth": "1.6.5",
93
+ "convex": ">=1.35",
93
94
  "hono": "4.12.9",
94
95
  "next": ">=14",
95
96
  "react": ">=18",
@@ -161,6 +161,9 @@ If you want to own the auth tables by hand, use `setup/server.md`.
161
161
 
162
162
  Import auth route helpers from `kitcn/auth/http`.
163
163
  That entrypoint auto-installs the Convex-safe `MessageChannel` polyfill.
164
+ `registerRoutes` is lazy by default, so Better Auth does not initialize during
165
+ `convex/http.ts` registration. If your auth config uses a custom base path, pass
166
+ the same `basePath` to `registerRoutes`.
164
167
 
165
168
  ### 7. HTTP Routes
166
169
 
@@ -186,6 +189,23 @@ app.use(authMiddleware(getAuth));
186
189
  export default createHttpRouter(app, httpRouter);
187
190
  ```
188
191
 
192
+ ```ts
193
+ // convex/functions/http.ts - plain Convex option
194
+ import { registerRoutes } from 'kitcn/auth/http';
195
+ import { httpRouter } from 'convex/server';
196
+ import { getAuth } from './generated/auth';
197
+
198
+ const http = httpRouter();
199
+
200
+ registerRoutes(http, getAuth, {
201
+ cors: {
202
+ allowedOrigins: [process.env.SITE_URL!],
203
+ },
204
+ });
205
+
206
+ export default http;
207
+ ```
208
+
189
209
  ### 8. Environment Variables
190
210
 
191
211
  ```bash
@@ -200,6 +200,8 @@ Keep all auth reads/writes on ORM table definitions in `convex/functions/schema.
200
200
 
201
201
  Use `kitcn/auth/http` for `authMiddleware` or `registerRoutes`.
202
202
  It auto-installs the Convex-safe `MessageChannel` polyfill, so no manual `http-polyfills.ts` file is needed.
203
+ `registerRoutes` is lazy by default. If the auth config uses a custom base path,
204
+ pass that same `basePath` in the route options.
203
205
 
204
206
  **Create:** `convex/functions/http.ts`
205
207
 
@@ -91,9 +91,9 @@ npx kitcn@latest init -t next --yes
91
91
 
92
92
  Then start the long-running backend with `bunx kitcn dev`, run the
93
93
  framework dev server (`bun dev` for the Next starter), and open `/convex` for
94
- the scaffolded messages demo. In `--yes` mode, kitcn provisions an anonymous
95
- local Convex deployment when no account is linked yet, so the starter path does
96
- not stop on a login prompt.
94
+ the scaffolded messages demo. In `--yes` mode, Convex uses anonymous local
95
+ deployment setup when no account is linked yet, so the starter path does not
96
+ stop on a login prompt.
97
97
 
98
98
  Use the CLI first:
99
99
 
@@ -759,7 +759,7 @@ This runbook + references map to the canonical template shape as follows:
759
759
  | Symptom | Likely Cause | Fix |
760
760
  | ------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
761
761
  | `@convex/api` not found | `kitcn dev` not run | Run `bunx kitcn dev` and regenerate API metadata |
762
- | `Cannot prompt for input in non-interactive terminals` during bootstrap | Convex deployment selection still needs a local choice | Use `bunx kitcn verify` for local proof, or pass `--env-file` / deployment-target args so Convex can resolve the deployment without prompting |
762
+ | `Cannot prompt for input in non-interactive terminals` during bootstrap | Convex deployment targeting is ambiguous | Use `bunx kitcn verify` for local proof, or pass `--env-file` / deployment-target args so Convex can resolve the deployment without prompting |
763
763
  | Can't find new local backend files under `~/.convex` | Convex now stores new local deployment state per project | Check `.convex/local/default/` in the current project root; treat `~/.convex/**` as legacy storage |
764
764
  | `kitcn env push` fails to set auth vars | Target deployment is not active or not initialized | For local proof, run `bunx kitcn verify`. For remote targets, resolve deployment targeting, then rerun `bunx kitcn env push` |
765
765
  | `Failed to analyze auth.js` with `Unexpected token` / `map is not a function` on JWKS | Static `JWKS` value is malformed JSON | Unset/fix `JWKS`; use `getAuthConfigProvider()` fallback or repush with `bunx kitcn env push` |
@@ -772,7 +772,7 @@ This runbook + references map to the canonical template shape as follows:
772
772
  | `Property 'insert'/'update' does not exist on type 'OrmReader'` | Using query context for mutations | Ensure mutation handlers use `publicMutation` / `protectedMutation` builders |
773
773
  | `useCRPC must be used within CRPCProvider` | Provider chain not mounted around route tree | Wrap app with `AppConvexProvider` and verify `CRPCProvider` is inside QueryClientProvider (Section 7.4 / 8.A.4) |
774
774
  | Route auth cookies not set | Missing CORS auth headers | Add `Better-Auth-Cookie` allow/expose headers + credentials |
775
- | TanStack Start auth helper import errors | Using `kitcn/auth/nextjs` in Start app | Use TanStack Start exception with `@convex-dev/better-auth/*` helpers |
775
+ | TanStack Start auth helper import errors | Using `kitcn/auth/nextjs` in Start app | Use the TanStack Start helper from `kitcn/auth/start` |
776
776
  | `Returned promise will never resolve` from internal function | Trigger path is recursively querying/updating related rows or stale component wiring still runs | Isolate failing write with logs, disable/move trigger-side sync into explicit mutation helper, rerun `bunx kitcn verify`, then retry the runtime proof |
777
777
  | Better Auth secret mismatch/warnings in setup flows | `BETTER_AUTH_SECRET` manually set inconsistently or low entropy | Let `bunx kitcn dev` manage local bootstrap, or regenerate/push via `bunx kitcn env push` for active non-local targets |
778
778
  | `Invalid orderBy value. Use a column or asc()/desc()` | Wrong `orderBy` shape (`[{ field, direction }]`) | Use object form only, e.g. `orderBy: { updatedAt: "desc" }` |
@@ -205,7 +205,7 @@ Do not fake generated files.
205
205
  Automation/non-interactive path:
206
206
 
207
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.
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 lets Convex create anonymous local state when no local deployment is configured.
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
 
File without changes