kitcn 0.33.1 → 0.33.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/aggregate/index.d.ts +1 -1
  3. package/dist/auth/client/index.js +1 -1
  4. package/dist/auth/generated/index.d.ts +1 -1
  5. package/dist/auth/index.d.ts +19 -19
  6. package/dist/auth/nextjs/index.d.ts +2 -2
  7. package/dist/auth/nextjs/index.js +2 -2
  8. package/dist/auth/start/server/index.d.ts +2 -2
  9. package/dist/auth/start/server/index.js +2 -2
  10. package/dist/{auth-store-BnsWs1xd.js → auth-store-x3_wvhTR.js} +17 -2
  11. package/dist/{caller-factory-C-N540BC.js → caller-factory-CEKbQdGY.js} +1 -1
  12. package/dist/cli.mjs +48 -7
  13. package/dist/crpc/index.d.ts +9 -5
  14. package/dist/crpc/index.js +1 -1
  15. package/dist/{error-Dyqhgbf6.js → error-CLgc9khF.js} +18 -3
  16. package/dist/{generated-contract-disabled-B_EaHGCP.d.ts → generated-contract-disabled-BPjuEPZD.d.ts} +43 -43
  17. package/dist/{http-types-8FBr10yl.d.ts → http-types-BhhPZtwa.d.ts} +79 -3
  18. package/dist/{middleware-D2hKJuSZ.d.ts → middleware-BBS7oLtT.d.ts} +1 -1
  19. package/dist/orm/index.d.ts +1 -1
  20. package/dist/orm/migrations/index.d.ts +1 -1
  21. package/dist/plugins/index.d.ts +1 -1
  22. package/dist/{procedure-name-kn-awLk1.d.ts → procedure-name-DRSOwAJY.d.ts} +139 -5
  23. package/dist/ratelimit/index.d.ts +2 -2
  24. package/dist/react/index.js +1 -1
  25. package/dist/rsc/index.d.ts +3 -4
  26. package/dist/rsc/index.js +1 -1
  27. package/dist/server/index.d.ts +4 -5
  28. package/dist/server/index.js +1 -1
  29. package/dist/solid/index.js +17 -2
  30. package/dist/{types-Cl0utsTL.d.ts → types-C7JkpfeY.d.ts} +1 -2
  31. package/dist/{where-clause-compiler-CoPVAVDO.d.ts → where-clause-compiler-jhCEPHxi.d.ts} +129 -129
  32. package/package.json +1 -1
  33. package/dist/caller-factory-C3pcbzo0.d.ts +0 -140
  34. package/dist/transformer-BEkxlnss.d.ts +0 -78
  35. /package/dist/{context-utils-ax351iFc.d.ts → context-utils-Cbv4r0AA.d.ts} +0 -0
  36. /package/dist/{token-CZpDQUHd.d.ts → token-tlbNKQS0.d.ts} +0 -0
  37. /package/dist/{types-CzGsrLrY.d.ts → types-Bkeicpo6.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # kitcn
2
2
 
3
+ ## 0.33.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#464](https://github.com/udecode/kitcn/pull/464) [`ac73cc6`](https://github.com/udecode/kitcn/commit/ac73cc6a9ffcb95a6d4ce89f9ef9a591eeacf883) Thanks [@tjramage](https://github.com/tjramage)! - ## Patches
8
+
9
+ - Fix cRPC client-error guards (`isCRPCClientError`, `isCRPCError`,
10
+ `isCRPCErrorCode`) rejecting errors thrown through other entrypoints such as
11
+ `kitcn/react` and `kitcn/solid`, so deterministic refusals like
12
+ `UNAUTHORIZED` are no longer retried as transport failures.
13
+
14
+ ## 0.33.2
15
+
16
+ ### Patch Changes
17
+
18
+ - [#467](https://github.com/udecode/kitcn/pull/467) [`5794ed3`](https://github.com/udecode/kitcn/commit/5794ed381c0a3074e74585269eb7c24a030497cc) Thanks [@zbeyens](https://github.com/zbeyens)! - ## Patches
19
+
20
+ - Fix Next.js scaffolds to select and reconcile a compatible ESLint release.
21
+
3
22
  ## 0.33.1
4
23
 
5
24
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  import { Vn as ConvexTextBuilderInitial, Zt as ConvexTableWithColumns } from "../capabilities-Bxzoofl4.js";
2
- import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-CoPVAVDO.js";
2
+ import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-jhCEPHxi.js";
3
3
  import * as convex_values0 from "convex/values";
4
4
  import { GenericId, Infer, Value } from "convex/values";
5
5
  import { DocumentByName, GenericDataModel, GenericDatabaseReader, GenericDatabaseWriter, TableNamesInDataModel } from "convex/server";
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { A as CRPCClientError, C as decodeJwtExp, D as readAuthSessionFallbackToken, E as readAuthSessionFallbackData, O as writeAuthSessionFallbackData, T as clearAuthSessionFallback, d as isSessionSyncGraceActive, g as useAuthValue, h as useAuthStore, j as defaultIsUnauthorized, n as AuthProvider, o as ConvexProviderWithAuth$1, s as FetchAccessTokenContext, t as AUTH_SESSION_SYNC_GRACE_MS } from "../../auth-store-BnsWs1xd.js";
2
+ import { A as CRPCClientError, C as decodeJwtExp, D as readAuthSessionFallbackToken, E as readAuthSessionFallbackData, O as writeAuthSessionFallbackData, T as clearAuthSessionFallback, d as isSessionSyncGraceActive, g as useAuthValue, h as useAuthStore, j as defaultIsUnauthorized, n as AuthProvider, o as ConvexProviderWithAuth$1, s as FetchAccessTokenContext, t as AUTH_SESSION_SYNC_GRACE_MS } from "../../auth-store-x3_wvhTR.js";
3
3
  import { useConvexAuth } from "convex/react";
4
4
  import { useCallback, useEffect, useMemo, useRef } from "react";
5
5
  import { jsx } from "react/jsx-runtime";
@@ -1,2 +1,2 @@
1
- import { C as GenericAuthTriggerHandlers, S as GenericAuthTriggerChange, T as defineAuth, b as GenericAuthBeforeResult, i as getGeneratedAuthDisabledReason, n as GeneratedAuthDisabledReasonKind, r as createDisabledAuthRuntime, t as AuthRuntime, w as GenericAuthTriggers, x as GenericAuthDefinition, y as BetterAuthOptionsWithoutDatabase } from "../../generated-contract-disabled-B_EaHGCP.js";
1
+ import { C as GenericAuthTriggerHandlers, S as GenericAuthTriggerChange, T as defineAuth, b as GenericAuthBeforeResult, i as getGeneratedAuthDisabledReason, n as GeneratedAuthDisabledReasonKind, r as createDisabledAuthRuntime, t as AuthRuntime, w as GenericAuthTriggers, x as GenericAuthDefinition, y as BetterAuthOptionsWithoutDatabase } from "../../generated-contract-disabled-BPjuEPZD.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-BkNjkDCk.js";
2
2
  import { t as GetAuth } from "../types-ex0-J-SC.js";
3
- import { t as GenericCtx } from "../context-utils-ax351iFc.js";
4
- import { C as GenericAuthTriggerHandlers, S as GenericAuthTriggerChange, T as defineAuth, _ as updateManyHandler, a as AuthFunctions, b as GenericAuthBeforeResult, c as consumeOneHandler, d as createHandler, f as deleteManyHandler, g as incrementOneHandler, h as findOneHandler, i as getGeneratedAuthDisabledReason, l as countHandler, m as findManyHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as deleteOneHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as createApi, v as updateOneHandler, w as GenericAuthTriggers, x as GenericAuthDefinition, y as BetterAuthOptionsWithoutDatabase } from "../generated-contract-disabled-B_EaHGCP.js";
3
+ import { t as GenericCtx } from "../context-utils-Cbv4r0AA.js";
4
+ import { C as GenericAuthTriggerHandlers, S as GenericAuthTriggerChange, T as defineAuth, _ as updateManyHandler, a as AuthFunctions, b as GenericAuthBeforeResult, c as consumeOneHandler, d as createHandler, f as deleteManyHandler, g as incrementOneHandler, h as findOneHandler, i as getGeneratedAuthDisabledReason, l as countHandler, m as findManyHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as deleteOneHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as createApi, v as updateOneHandler, w as GenericAuthTriggers, x as GenericAuthDefinition, y as BetterAuthOptionsWithoutDatabase } from "../generated-contract-disabled-BPjuEPZD.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";
@@ -109,31 +109,31 @@ type AdapterPaginationOptions = PaginationOptions & {
109
109
  };
110
110
  declare const adapterWhereValidator: convex_values0.VObject<{
111
111
  mode?: "sensitive" | "insensitive" | undefined;
112
- operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
113
112
  connector?: "AND" | "OR" | undefined;
114
- value: string | number | boolean | string[] | number[] | null;
113
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
115
114
  field: string;
115
+ value: string | number | boolean | string[] | number[] | null;
116
116
  }, {
117
117
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
118
118
  field: convex_values0.VString<string, "required">;
119
119
  mode: convex_values0.VUnion<"sensitive" | "insensitive" | undefined, [convex_values0.VLiteral<"sensitive", "required">, convex_values0.VLiteral<"insensitive", "required">], "optional", never>;
120
- 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>;
120
+ operator: convex_values0.VUnion<"lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
121
121
  value: convex_values0.VUnion<string | number | boolean | string[] | number[] | null, [convex_values0.VString<string, "required">, convex_values0.VFloat64<number, "required">, convex_values0.VBoolean<boolean, "required">, convex_values0.VArray<string[], convex_values0.VString<string, "required">, "required">, convex_values0.VArray<number[], convex_values0.VFloat64<number, "required">, "required">, convex_values0.VNull<null, "required">], "required", never>;
122
- }, "required", "mode" | "value" | "operator" | "field" | "connector">;
122
+ }, "required", "mode" | "connector" | "field" | "operator" | "value">;
123
123
  declare const adapterArgsValidator: convex_values0.VObject<{
124
124
  limit?: number | undefined;
125
125
  where?: {
126
126
  mode?: "sensitive" | "insensitive" | undefined;
127
- operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
128
127
  connector?: "AND" | "OR" | undefined;
129
- value: string | number | boolean | string[] | number[] | null;
128
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
130
129
  field: string;
130
+ value: string | number | boolean | string[] | number[] | null;
131
131
  }[] | undefined;
132
- select?: string[] | undefined;
133
132
  offset?: number | undefined;
133
+ select?: string[] | undefined;
134
134
  sortBy?: {
135
- direction: "asc" | "desc";
136
135
  field: string;
136
+ direction: "asc" | "desc";
137
137
  } | undefined;
138
138
  model: string;
139
139
  }, {
@@ -142,32 +142,32 @@ declare const adapterArgsValidator: convex_values0.VObject<{
142
142
  offset: convex_values0.VFloat64<number | undefined, "optional">;
143
143
  select: convex_values0.VArray<string[] | undefined, convex_values0.VString<string, "required">, "optional">;
144
144
  sortBy: convex_values0.VObject<{
145
- direction: "asc" | "desc";
146
145
  field: string;
146
+ direction: "asc" | "desc";
147
147
  } | undefined, {
148
148
  direction: convex_values0.VUnion<"asc" | "desc", [convex_values0.VLiteral<"asc", "required">, convex_values0.VLiteral<"desc", "required">], "required", never>;
149
149
  field: convex_values0.VString<string, "required">;
150
- }, "optional", "direction" | "field">;
150
+ }, "optional", "field" | "direction">;
151
151
  where: convex_values0.VArray<{
152
152
  mode?: "sensitive" | "insensitive" | undefined;
153
- operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
154
153
  connector?: "AND" | "OR" | undefined;
155
- value: string | number | boolean | string[] | number[] | null;
154
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
156
155
  field: string;
156
+ value: string | number | boolean | string[] | number[] | null;
157
157
  }[] | undefined, convex_values0.VObject<{
158
158
  mode?: "sensitive" | "insensitive" | undefined;
159
- operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
160
159
  connector?: "AND" | "OR" | undefined;
161
- value: string | number | boolean | string[] | number[] | null;
160
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
162
161
  field: string;
162
+ value: string | number | boolean | string[] | number[] | null;
163
163
  }, {
164
164
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
165
165
  field: convex_values0.VString<string, "required">;
166
166
  mode: convex_values0.VUnion<"sensitive" | "insensitive" | undefined, [convex_values0.VLiteral<"sensitive", "required">, convex_values0.VLiteral<"insensitive", "required">], "optional", never>;
167
- 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>;
167
+ operator: convex_values0.VUnion<"lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
168
168
  value: convex_values0.VUnion<string | number | boolean | string[] | number[] | null, [convex_values0.VString<string, "required">, convex_values0.VFloat64<number, "required">, convex_values0.VBoolean<boolean, "required">, convex_values0.VArray<string[], convex_values0.VString<string, "required">, "required">, convex_values0.VArray<number[], convex_values0.VFloat64<number, "required">, "required">, convex_values0.VNull<null, "required">], "required", never>;
169
- }, "required", "mode" | "value" | "operator" | "field" | "connector">, "optional">;
170
- }, "required", "limit" | "where" | "model" | "select" | "offset" | "sortBy" | "sortBy.direction" | "sortBy.field">;
169
+ }, "required", "mode" | "connector" | "field" | "operator" | "value">, "optional">;
170
+ }, "required", "limit" | "model" | "where" | "offset" | "select" | "sortBy" | "sortBy.field" | "sortBy.direction">;
171
171
  declare const hasUniqueFields: (betterAuthSchema: BetterAuthDBSchema, model: string, input: Record<string, any>) => boolean;
172
172
  declare const checkUniqueFields: <Schema extends SchemaDefinition<any, any>>(ctx: GenericQueryCtx<GenericDataModel>, schema: Schema, betterAuthSchema: BetterAuthDBSchema, table: string, input: Record<string, any>, doc?: Record<string, any>) => Promise<void>;
173
173
  declare const selectFields: <T extends TableNamesInDataModel<GenericDataModel>, D extends DocumentByName<GenericDataModel, T>>(doc: D | null, select?: string[]) => D | null;
@@ -1,5 +1,5 @@
1
- import { r as LazyCaller, t as ConvexContext } from "../../caller-factory-C3pcbzo0.js";
2
- import { t as GetTokenOptions } from "../../token-CZpDQUHd.js";
1
+ import { H as ConvexContext, W as LazyCaller } from "../../procedure-name-DRSOwAJY.js";
2
+ import { t as GetTokenOptions } from "../../token-tlbNKQS0.js";
3
3
 
4
4
  //#region src/auth-nextjs/index.d.ts
5
5
  /** Auth options for server-side calls. */
@@ -1,6 +1,6 @@
1
1
  import { t as getToken } from "../../token-CuJopBdP.js";
2
- import { n as defaultIsUnauthorized } from "../../error-Dyqhgbf6.js";
3
- import { t as createCallerFactory } from "../../caller-factory-C-N540BC.js";
2
+ import { n as defaultIsUnauthorized } from "../../error-CLgc9khF.js";
3
+ import { t as createCallerFactory } from "../../caller-factory-CEKbQdGY.js";
4
4
 
5
5
  //#region src/auth-nextjs/index.ts
6
6
  /** biome-ignore-all lint/suspicious/noExplicitAny: lib */
@@ -1,5 +1,5 @@
1
- import { r as LazyCaller, t as ConvexContext } from "../../../caller-factory-C3pcbzo0.js";
2
- import { t as GetTokenOptions } from "../../../token-CZpDQUHd.js";
1
+ import { H as ConvexContext, W as LazyCaller } from "../../../procedure-name-DRSOwAJY.js";
2
+ import { t as GetTokenOptions } from "../../../token-tlbNKQS0.js";
3
3
  import { FunctionReference, FunctionReturnType, OptionalRestArgs } from "convex/server";
4
4
 
5
5
  //#region src/auth-start/server.d.ts
@@ -1,6 +1,6 @@
1
1
  import { t as getToken } from "../../../token-CuJopBdP.js";
2
- import { n as defaultIsUnauthorized } from "../../../error-Dyqhgbf6.js";
3
- import { t as createCallerFactory } from "../../../caller-factory-C-N540BC.js";
2
+ import { n as defaultIsUnauthorized } from "../../../error-CLgc9khF.js";
3
+ import { t as createCallerFactory } from "../../../caller-factory-CEKbQdGY.js";
4
4
  import { stripIndent } from "common-tags";
5
5
  import { getRequest } from "@tanstack/react-start/server";
6
6
  import { ConvexHttpClient } from "convex/browser";
@@ -5,6 +5,13 @@ import { createAtomStore } from "jotai-x";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
 
7
7
  //#region src/crpc/error.ts
8
+ const CLIENT_ERROR_CODES = [
9
+ "UNAUTHORIZED",
10
+ "FORBIDDEN",
11
+ "NOT_FOUND",
12
+ "BAD_REQUEST",
13
+ "TOO_MANY_REQUESTS"
14
+ ];
8
15
  /**
9
16
  * Client-side CRPC error.
10
17
  * Mirrors backend CRPCError pattern with typed error codes.
@@ -19,8 +26,16 @@ var CRPCClientError = class extends Error {
19
26
  this.functionName = opts.functionName;
20
27
  }
21
28
  };
22
- /** Type guard for CRPCClientError */
23
- const isCRPCClientError = (error) => error instanceof CRPCClientError;
29
+ /**
30
+ * Type guard for CRPCClientError.
31
+ * Checks shape, not constructor: package entrypoints bundle separate copies
32
+ * of the class, so `instanceof` fails across them.
33
+ */
34
+ const isCRPCClientError = (error) => {
35
+ if (!(error instanceof Error)) return false;
36
+ const candidate = error;
37
+ return candidate.name === "CRPCClientError" && CLIENT_ERROR_CODES.includes(candidate.code) && typeof candidate.functionName === "string" && typeof candidate.message === "string";
38
+ };
24
39
  /** Default unauthorized detection - checks UNAUTHORIZED code */
25
40
  const defaultIsUnauthorized = (error) => {
26
41
  if (!error || typeof error !== "object") return false;
@@ -1,4 +1,4 @@
1
- import { n as defaultIsUnauthorized } from "./error-Dyqhgbf6.js";
1
+ import { n as defaultIsUnauthorized } from "./error-CLgc9khF.js";
2
2
  import { i as getFunctionType, n as getFuncRef, t as buildMetaIndex } from "./meta-utils-Cc7neQOB.js";
3
3
  import { s as getTransformer } from "./transformer-C8lVwHNT.js";
4
4
  import { fetchAction, fetchMutation, fetchQuery } from "convex/nextjs";
package/dist/cli.mjs CHANGED
@@ -9267,13 +9267,42 @@ const INIT_NEXT_PACKAGE_JSON_DEPENDENCIES = {
9267
9267
  "@opentelemetry/api": SUPPORTED_DEPENDENCY_VERSIONS.opentelemetryApi.exact,
9268
9268
  superjson: "2.2.6"
9269
9269
  };
9270
+ const INIT_NEXT_ESLINT_VERSION = "9.39.5";
9271
+ const MIN_ESLINT_9_NEXT_CONFIG_MAJOR = 15;
9272
+ const EXTERNALLY_MANAGED_VERSION_RE = /^(?:catalog|workspace):/;
9273
+ const SIMPLE_VERSION_MAJOR_RE = /^(?:[v=~^]\s*)?(\d+)(?:\.(?:\d+|x|\*)){0,2}(?:-[0-9A-Za-z.-]+)?$/i;
9270
9274
  const INIT_NEXT_PACKAGE_JSON_DEV_DEPENDENCIES = { "@types/bun": "latest" };
9271
- const getInitNextPackageJsonDevDependencies = (options) => ({
9275
+ const resolveSimpleVersionMajor = (version) => {
9276
+ const major = version?.trim().match(SIMPLE_VERSION_MAJOR_RE)?.[1];
9277
+ return major === void 0 ? void 0 : Number(major);
9278
+ };
9279
+ const resolveInitNextEslintVersionFromPackageJson = (packageJson) => {
9280
+ const eslintConfigNextVersion = packageJson.devDependencies?.["eslint-config-next"] ?? packageJson.dependencies?.["eslint-config-next"];
9281
+ if (eslintConfigNextVersion === void 0) return;
9282
+ const configMajor = resolveSimpleVersionMajor(eslintConfigNextVersion);
9283
+ if (configMajor !== void 0) return configMajor >= MIN_ESLINT_9_NEXT_CONFIG_MAJOR ? INIT_NEXT_ESLINT_VERSION : void 0;
9284
+ const nextVersion = packageJson.dependencies?.next ?? packageJson.devDependencies?.next;
9285
+ const nextMajor = resolveSimpleVersionMajor(nextVersion);
9286
+ if (nextMajor !== void 0) return nextMajor >= MIN_ESLINT_9_NEXT_CONFIG_MAJOR ? INIT_NEXT_ESLINT_VERSION : void 0;
9287
+ const eslintVersion = packageJson.devDependencies?.eslint ?? packageJson.dependencies?.eslint;
9288
+ const eslintMajor = resolveSimpleVersionMajor(eslintVersion);
9289
+ if (eslintMajor !== void 0 && eslintMajor < 9) return;
9290
+ if ([
9291
+ eslintConfigNextVersion,
9292
+ nextVersion,
9293
+ eslintVersion
9294
+ ].every((version) => version !== void 0 && EXTERNALLY_MANAGED_VERSION_RE.test(version))) return;
9295
+ return INIT_NEXT_ESLINT_VERSION;
9296
+ };
9297
+ const getInitNextPackageJsonDevDependencies = (options, eslintVersion) => ({
9272
9298
  ...INIT_NEXT_PACKAGE_JSON_DEV_DEPENDENCIES,
9299
+ ...eslintVersion ? { eslint: eslintVersion } : {},
9273
9300
  ...options.backend === "concave" ? { "@concavejs/cli": SUPPORTED_DEPENDENCY_VERSIONS.concaveCli.exact } : {}
9274
9301
  });
9275
9302
  function renderInitNextPackageJsonTemplate(source, options = {}) {
9276
9303
  const existing = source ? JSON.parse(source) : {};
9304
+ const eslintVersion = resolveInitNextEslintVersionFromPackageJson(existing);
9305
+ const existingDependencies = eslintVersion ? Object.fromEntries(Object.entries(existing.dependencies ?? {}).filter(([packageName]) => packageName !== "eslint")) : existing.dependencies;
9277
9306
  const nextScripts = {
9278
9307
  ...existing.scripts,
9279
9308
  ...INIT_NEXT_PACKAGE_JSON_SCRIPTS
@@ -9286,12 +9315,12 @@ function renderInitNextPackageJsonTemplate(source, options = {}) {
9286
9315
  ...existing,
9287
9316
  scripts: nextScripts,
9288
9317
  dependencies: {
9289
- ...existing.dependencies,
9318
+ ...existingDependencies,
9290
9319
  ...INIT_NEXT_PACKAGE_JSON_DEPENDENCIES
9291
9320
  },
9292
9321
  devDependencies: {
9293
9322
  ...existing.devDependencies,
9294
- ...getInitNextPackageJsonDevDependencies(options)
9323
+ ...getInitNextPackageJsonDevDependencies(options, eslintVersion)
9295
9324
  }
9296
9325
  }, null, 2)}\n`;
9297
9326
  }
@@ -11840,11 +11869,15 @@ function buildDependencyInstallPlan(projectDir, dependencies) {
11840
11869
  ...pkg.dependencies ?? {},
11841
11870
  ...pkg.devDependencies ?? {}
11842
11871
  };
11843
- const missing = dependencies.filter((dependency) => !(dependency.packageName in existing));
11844
- if (missing.length === 0) return null;
11872
+ const missing = dependencies.filter((dependency) => !dependency.installFromManifest && !(dependency.packageName in existing));
11873
+ const requiresReconcile = dependencies.some((dependency) => dependency.requiredVersion !== void 0 && (dependency.installFromManifest || existing[dependency.packageName] !== void 0) && existing[dependency.packageName] !== dependency.requiredVersion || dependency.requiredSection === "devDependencies" && pkg.dependencies?.[dependency.packageName] !== void 0 || dependency.requiredSection === "dependencies" && pkg.devDependencies?.[dependency.packageName] !== void 0);
11874
+ if (missing.length === 0 && !requiresReconcile) return null;
11845
11875
  const packageManager = detectPackageManager(projectDir);
11846
11876
  const missingSpecs = missing.map((dependency) => dependency.installSpec);
11847
- const installCommand = resolveDependencyInstallCommand(packageManager, missingSpecs);
11877
+ const installCommand = missingSpecs.length > 0 ? resolveDependencyInstallCommand(packageManager, missingSpecs) : {
11878
+ command: packageManager,
11879
+ args: ["install"]
11880
+ };
11848
11881
  return {
11849
11882
  packageManager,
11850
11883
  command: installCommand.command,
@@ -11954,6 +11987,7 @@ function buildInitializationPlan(params) {
11954
11987
  skipReason: "Baseline http.ts is already bootstrapped."
11955
11988
  }));
11956
11989
  files.push(...templateFiles);
11990
+ const nextEslintVersion = projectContext?.mode === "next-app" ? resolveInitNextEslintVersionFromPackageJson(JSON.parse(fs.readFileSync(resolve(process.cwd(), "package.json"), "utf8"))) : void 0;
11957
11991
  const dependencyPackages = projectContext ? [
11958
11992
  ...BASELINE_DEPENDENCY_INSTALL_SPECS.map((installSpec) => ({
11959
11993
  installSpec,
@@ -11966,7 +12000,14 @@ function buildInitializationPlan(params) {
11966
12000
  ...INIT_TEMPLATE_DEPENDENCY_INSTALL_SPECS.map((installSpec) => ({
11967
12001
  installSpec,
11968
12002
  packageName: getPackageNameFromInstallSpec(installSpec)
11969
- }))
12003
+ })),
12004
+ ...nextEslintVersion ? [{
12005
+ installFromManifest: true,
12006
+ installSpec: `eslint@${nextEslintVersion}`,
12007
+ packageName: "eslint",
12008
+ requiredSection: "devDependencies",
12009
+ requiredVersion: nextEslintVersion
12010
+ }] : []
11970
12011
  ] : [...BASELINE_DEPENDENCY_INSTALL_SPECS.map((installSpec) => ({
11971
12012
  installSpec,
11972
12013
  packageName: getPackageNameFromInstallSpec(installSpec)
@@ -1,6 +1,5 @@
1
- import { a as WireCodec, c as decodeWire, d as getTransformer, f as identityTransformer, i as DataTransformerOptions, l as defaultCRPCTransformer, n as DATE_CODEC_TAG, o as createTaggedTransformer, r as DataTransformer, s as dateWireCodec, t as CombinedDataTransformer, u as encodeWire } from "../transformer-BEkxlnss.js";
2
- import { a as HttpErrorCode, c as HttpQueryKey, d as HttpRouteMap, f as InferHttpInput, g as isHttpClientError, h as buildHttpQueryPrefixKey, i as HttpClientFromRouter, l as HttpQueryPrefixKey, m as buildHttpQueryKey, n as HttpClient, o as HttpMutationKey, p as InferHttpOutput, r as HttpClientError, s as HttpProcedureCall, t as HTTP_DEFAULT_STALE_TIME, u as HttpRouteInfo } from "../http-types-8FBr10yl.js";
3
- import { A as HttpInputArgs, C as ReservedMutationOptions, D as VanillaMutation, E as VanillaAction, F as replaceUrlParam, M as RESERVED_KEYS, N as buildSearchParams, O as HttpClientOptions, P as executeHttpRequest, S as ReservedInfiniteQueryOptions, T as StaticQueryOptsParam, _ as IsPaginated, a as BaseInfiniteQueryOptsParam, b as PaginatedFnMeta, c as ConvexMutationKey, d as ConvexQueryMeta, f as EmptyObject, g as InfiniteQueryInput, h as FnMeta, i as BaseConvexQueryOptions, j as HttpProxyBaseOptions, k as HttpFormValue, l as ConvexQueryHookOptions, m as FUNC_REF_SYMBOL, n as BaseConvexActionOptions, o as ConvexActionKey, p as ExtractPaginatedItem, r as BaseConvexInfiniteQueryOptions, s as ConvexInfiniteQueryMeta, t as AuthType, u as ConvexQueryKey, v as Meta, w as ReservedQueryOptions, x as PaginationOpts, y as MutationVariables } from "../types-Cl0utsTL.js";
1
+ import { B as dateWireCodec, F as DATE_CODEC_TAG, G as identityTransformer, H as defaultCRPCTransformer, I as DataTransformer, L as DataTransformerOptions, P as CombinedDataTransformer, R as WireCodec, U as encodeWire, V as decodeWire, W as getTransformer, a as HttpErrorCode, c as HttpQueryKey, d as HttpRouteMap, f as InferHttpInput, g as isHttpClientError, h as buildHttpQueryPrefixKey, i as HttpClientFromRouter, l as HttpQueryPrefixKey, m as buildHttpQueryKey, n as HttpClient, o as HttpMutationKey, p as InferHttpOutput, r as HttpClientError, s as HttpProcedureCall, t as HTTP_DEFAULT_STALE_TIME, u as HttpRouteInfo, z as createTaggedTransformer } from "../http-types-BhhPZtwa.js";
2
+ import { A as HttpInputArgs, C as ReservedMutationOptions, D as VanillaMutation, E as VanillaAction, F as replaceUrlParam, M as RESERVED_KEYS, N as buildSearchParams, O as HttpClientOptions, P as executeHttpRequest, S as ReservedInfiniteQueryOptions, T as StaticQueryOptsParam, _ as IsPaginated, a as BaseInfiniteQueryOptsParam, b as PaginatedFnMeta, c as ConvexMutationKey, d as ConvexQueryMeta, f as EmptyObject, g as InfiniteQueryInput, h as FnMeta, i as BaseConvexQueryOptions, j as HttpProxyBaseOptions, k as HttpFormValue, l as ConvexQueryHookOptions, m as FUNC_REF_SYMBOL, n as BaseConvexActionOptions, o as ConvexActionKey, p as ExtractPaginatedItem, r as BaseConvexInfiniteQueryOptions, s as ConvexInfiniteQueryMeta, t as AuthType, u as ConvexQueryKey, v as Meta, w as ReservedQueryOptions, x as PaginationOpts, y as MutationVariables } from "../types-C7JkpfeY.js";
4
3
  import { FunctionArgs, FunctionReference } from "convex/server";
5
4
 
6
5
  //#region src/crpc/auth-error.d.ts
@@ -33,10 +32,11 @@ declare class AuthMutationError extends Error {
33
32
  declare function isAuthMutationError(error: unknown): error is AuthMutationError;
34
33
  //#endregion
35
34
  //#region src/crpc/error.d.ts
35
+ declare const CLIENT_ERROR_CODES: readonly ["UNAUTHORIZED", "FORBIDDEN", "NOT_FOUND", "BAD_REQUEST", "TOO_MANY_REQUESTS"];
36
36
  /**
37
37
  * Client error codes (subset of CRPC codes for client-side use)
38
38
  */
39
- type ClientErrorCode = 'UNAUTHORIZED' | 'FORBIDDEN' | 'NOT_FOUND' | 'BAD_REQUEST' | 'TOO_MANY_REQUESTS';
39
+ type ClientErrorCode = (typeof CLIENT_ERROR_CODES)[number];
40
40
  /**
41
41
  * Client-side CRPC error.
42
42
  * Mirrors backend CRPCError pattern with typed error codes.
@@ -51,7 +51,11 @@ declare class CRPCClientError extends Error {
51
51
  message?: string;
52
52
  });
53
53
  }
54
- /** Type guard for CRPCClientError */
54
+ /**
55
+ * Type guard for CRPCClientError.
56
+ * Checks shape, not constructor: package entrypoints bundle separate copies
57
+ * of the class, so `instanceof` fails across them.
58
+ */
55
59
  declare const isCRPCClientError: (error: unknown) => error is CRPCClientError;
56
60
  /**
57
61
  * Unified check for any deterministic CRPC error (Convex or HTTP).
@@ -1,4 +1,4 @@
1
- import { a as isCRPCErrorCode, i as isCRPCError, n as defaultIsUnauthorized, r as isCRPCClientError, t as CRPCClientError } from "../error-Dyqhgbf6.js";
1
+ import { a as isCRPCErrorCode, i as isCRPCError, n as defaultIsUnauthorized, r as isCRPCClientError, t as CRPCClientError } from "../error-CLgc9khF.js";
2
2
  import { a as defaultCRPCTransformer, c as identityTransformer, i as decodeWire, n as createTaggedTransformer, o as encodeWire, r as dateWireCodec, s as getTransformer, t as DATE_CODEC_TAG } from "../transformer-C8lVwHNT.js";
3
3
  import { a as buildSearchParams, c as HTTP_DEFAULT_STALE_TIME, d as buildHttpQueryPrefixKey, f as isHttpClientError, i as RESERVED_KEYS, l as HttpClientError, n as convexInfiniteQueryOptions, o as executeHttpRequest, r as convexQuery, s as replaceUrlParam, t as convexAction, u as buildHttpQueryKey } from "../query-options-DGG93--5.js";
4
4
 
@@ -1,4 +1,11 @@
1
1
  //#region src/crpc/error.ts
2
+ const CLIENT_ERROR_CODES = [
3
+ "UNAUTHORIZED",
4
+ "FORBIDDEN",
5
+ "NOT_FOUND",
6
+ "BAD_REQUEST",
7
+ "TOO_MANY_REQUESTS"
8
+ ];
2
9
  /**
3
10
  * Client-side CRPC error.
4
11
  * Mirrors backend CRPCError pattern with typed error codes.
@@ -13,14 +20,22 @@ var CRPCClientError = class extends Error {
13
20
  this.functionName = opts.functionName;
14
21
  }
15
22
  };
16
- /** Type guard for CRPCClientError */
17
- const isCRPCClientError = (error) => error instanceof CRPCClientError;
23
+ /**
24
+ * Type guard for CRPCClientError.
25
+ * Checks shape, not constructor: package entrypoints bundle separate copies
26
+ * of the class, so `instanceof` fails across them.
27
+ */
28
+ const isCRPCClientError = (error) => {
29
+ if (!(error instanceof Error)) return false;
30
+ const candidate = error;
31
+ return candidate.name === "CRPCClientError" && CLIENT_ERROR_CODES.includes(candidate.code) && typeof candidate.functionName === "string" && typeof candidate.message === "string";
32
+ };
18
33
  /**
19
34
  * Unified check for any deterministic CRPC error (Convex or HTTP).
20
35
  * Use in retry logic to skip retrying client errors (4xx).
21
36
  */
22
37
  const isCRPCError = (error) => {
23
- if (error instanceof CRPCClientError) return true;
38
+ if (isCRPCClientError(error)) return true;
24
39
  if (error instanceof Error && error.name === "HttpClientError" && "status" in error && typeof error.status === "number") return error.status < 500;
25
40
  return false;
26
41
  };