kitcn 0.33.0 → 0.33.1

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 (38) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/aggregate/index.d.ts +1 -1
  3. package/dist/auth/generated/index.d.ts +1 -1
  4. package/dist/auth/index.d.ts +20 -20
  5. package/dist/auth/nextjs/index.d.ts +2 -2
  6. package/dist/auth/start/server/index.d.ts +2 -2
  7. package/dist/{builder-Cyd5nCxZ.js → builder-DDYTlmTB.js} +12 -3
  8. package/dist/caller-factory-C3pcbzo0.d.ts +140 -0
  9. package/dist/crpc/index.d.ts +3 -2
  10. package/dist/{generated-contract-disabled-PdNGvNYP.d.ts → generated-contract-disabled-B_EaHGCP.d.ts} +42 -42
  11. package/dist/{http-types-BhhPZtwa.d.ts → http-types-8FBr10yl.d.ts} +3 -79
  12. package/dist/{middleware-BBS7oLtT.d.ts → middleware-D2hKJuSZ.d.ts} +1 -1
  13. package/dist/{middleware-D61Nm-iB.js → middleware-LvZov-hA.js} +1 -1
  14. package/dist/orm/index.d.ts +1 -1
  15. package/dist/orm/migrations/index.d.ts +1 -1
  16. package/dist/plugins/index.d.ts +1 -1
  17. package/dist/plugins/index.js +1 -1
  18. package/dist/{procedure-caller-DgMiD0-a.js → procedure-caller-DgGF_hA8.js} +1 -1
  19. package/dist/{procedure-name-DPYyLiVS.d.ts → procedure-name-kn-awLk1.d.ts} +12 -142
  20. package/dist/ratelimit/index.d.ts +2 -2
  21. package/dist/ratelimit/index.js +2 -2
  22. package/dist/react/index.d.ts +5 -6
  23. package/dist/react/index.js +20 -66
  24. package/dist/rsc/index.d.ts +4 -3
  25. package/dist/server/index.d.ts +5 -4
  26. package/dist/server/index.js +2 -2
  27. package/dist/solid/index.d.ts +5 -6
  28. package/dist/solid/index.js +20 -66
  29. package/dist/transformer-BEkxlnss.d.ts +78 -0
  30. package/dist/{types-BXpu7xIU.d.ts → types-Cl0utsTL.d.ts} +4 -3
  31. package/dist/{where-clause-compiler-DrV6lQg0.d.ts → where-clause-compiler-CoPVAVDO.d.ts} +135 -135
  32. package/package.json +1 -1
  33. package/skills/kitcn/SKILL.md +2 -1
  34. package/skills/kitcn/references/features/auth-admin.md +1 -0
  35. package/skills/kitcn/references/features/react.md +4 -5
  36. /package/dist/{context-utils-Cbv4r0AA.d.ts → context-utils-ax351iFc.d.ts} +0 -0
  37. /package/dist/{token-tlbNKQS0.d.ts → token-CZpDQUHd.d.ts} +0 -0
  38. /package/dist/{types-Bkeicpo6.d.ts → types-CzGsrLrY.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # kitcn
2
2
 
3
+ ## 0.33.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#462](https://github.com/udecode/kitcn/pull/462) [`41eb956`](https://github.com/udecode/kitcn/commit/41eb9567ebea2ae0b6340624897815f54c51e0aa) Thanks [@zbeyens](https://github.com/zbeyens)! - Fix cRPC live pagination so reactive page splits preserve adjacent page
8
+ boundaries and invalid loaded cursors reset cleanly.
9
+
3
10
  ## 0.33.0
4
11
 
5
12
  ### Minor 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-DrV6lQg0.js";
2
+ import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial } from "../where-clause-compiler-CoPVAVDO.js";
3
3
  import * as convex_values0 from "convex/values";
4
4
  import { GenericId, Infer, Value } from "convex/values";
5
5
  import { DocumentByName, GenericDataModel, GenericDatabaseReader, GenericDatabaseWriter, TableNamesInDataModel } from "convex/server";
@@ -1,2 +1,2 @@
1
- import { 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-PdNGvNYP.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-B_EaHGCP.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-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-PdNGvNYP.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";
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;
112
113
  connector?: "AND" | "OR" | undefined;
113
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
114
- field: string;
115
114
  value: string | number | boolean | string[] | number[] | null;
115
+ field: string;
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<"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>;
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>;
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" | "connector" | "field" | "operator" | "value">;
122
+ }, "required", "mode" | "value" | "operator" | "field" | "connector">;
123
123
  declare const adapterArgsValidator: convex_values0.VObject<{
124
+ limit?: number | undefined;
124
125
  where?: {
125
126
  mode?: "sensitive" | "insensitive" | undefined;
127
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
126
128
  connector?: "AND" | "OR" | undefined;
127
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
128
- field: string;
129
129
  value: string | number | boolean | string[] | number[] | null;
130
+ field: string;
130
131
  }[] | undefined;
131
- limit?: number | undefined;
132
- offset?: number | undefined;
133
132
  select?: string[] | undefined;
133
+ offset?: number | undefined;
134
134
  sortBy?: {
135
- field: string;
136
135
  direction: "asc" | "desc";
136
+ field: string;
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
- field: string;
146
145
  direction: "asc" | "desc";
146
+ field: string;
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", "field" | "direction">;
150
+ }, "optional", "direction" | "field">;
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;
153
154
  connector?: "AND" | "OR" | undefined;
154
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
155
- field: string;
156
155
  value: string | number | boolean | string[] | number[] | null;
156
+ field: string;
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;
159
160
  connector?: "AND" | "OR" | undefined;
160
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
161
- field: string;
162
161
  value: string | number | boolean | string[] | number[] | null;
162
+ field: string;
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<"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>;
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>;
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" | "connector" | "field" | "operator" | "value">, "optional">;
170
- }, "required", "model" | "where" | "limit" | "offset" | "select" | "sortBy" | "sortBy.field" | "sortBy.direction">;
169
+ }, "required", "mode" | "value" | "operator" | "field" | "connector">, "optional">;
170
+ }, "required", "limit" | "where" | "model" | "select" | "offset" | "sortBy" | "sortBy.direction" | "sortBy.field">;
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 { H as ConvexContext, W as LazyCaller } from "../../procedure-name-DPYyLiVS.js";
2
- import { t as GetTokenOptions } from "../../token-tlbNKQS0.js";
1
+ import { r as LazyCaller, t as ConvexContext } from "../../caller-factory-C3pcbzo0.js";
2
+ import { t as GetTokenOptions } from "../../token-CZpDQUHd.js";
3
3
 
4
4
  //#region src/auth-nextjs/index.d.ts
5
5
  /** Auth options for server-side calls. */
@@ -1,5 +1,5 @@
1
- import { H as ConvexContext, W as LazyCaller } from "../../../procedure-name-DPYyLiVS.js";
2
- import { t as GetTokenOptions } from "../../../token-tlbNKQS0.js";
1
+ import { r as LazyCaller, t as ConvexContext } from "../../../caller-factory-C3pcbzo0.js";
2
+ import { t as GetTokenOptions } from "../../../token-CZpDQUHd.js";
3
3
  import { FunctionReference, FunctionReturnType, OptionalRestArgs } from "convex/server";
4
4
 
5
5
  //#region src/auth-start/server.d.ts
@@ -1716,10 +1716,12 @@ function inferProcedureNameFromCallsite() {
1716
1716
  */
1717
1717
  z$1.object({
1718
1718
  cursor: z$1.union([z$1.string(), z$1.null()]),
1719
+ endCursor: z$1.union([z$1.string(), z$1.null()]).optional(),
1719
1720
  limit: z$1.number()
1720
1721
  });
1721
1722
  z$1.object({
1722
1723
  cursor: z$1.union([z$1.string(), z$1.null()]).optional(),
1724
+ endCursor: z$1.union([z$1.string(), z$1.null()]).optional(),
1723
1725
  limit: z$1.number().optional()
1724
1726
  });
1725
1727
  /**
@@ -2120,8 +2122,8 @@ var QueryProcedureBuilder = class QueryProcedureBuilder extends ProcedureBuilder
2120
2122
  /**
2121
2123
  * Add pagination input (chainable before .query())
2122
2124
  *
2123
- * Creates flat { cursor, limit } input like tRPC and auto-wraps output.
2124
- * User accesses args.cursor and args.limit directly.
2125
+ * Creates flat { cursor, endCursor, limit } input like tRPC and auto-wraps
2126
+ * output. User accesses the pagination fields directly from args.
2125
2127
  *
2126
2128
  * @param opts.limit - Default/max items per page
2127
2129
  * @param opts.item - Zod schema for each item in the page array
@@ -2129,12 +2131,19 @@ var QueryProcedureBuilder = class QueryProcedureBuilder extends ProcedureBuilder
2129
2131
  paginated(opts) {
2130
2132
  const paginationSchemaWithDefault = z$1.object({
2131
2133
  cursor: z$1.union([z$1.string(), z$1.null()]).default(null),
2134
+ endCursor: z$1.union([z$1.string(), z$1.null()]).optional(),
2132
2135
  limit: z$1.number().default(opts.limit).transform((n) => Math.min(n, opts.limit))
2133
2136
  });
2134
2137
  const outputSchema = z$1.object({
2135
2138
  continueCursor: z$1.union([z$1.string(), z$1.null()]),
2136
2139
  isDone: z$1.boolean(),
2137
- page: z$1.array(opts.item)
2140
+ page: z$1.array(opts.item),
2141
+ pageStatus: z$1.union([
2142
+ z$1.literal("SplitRecommended"),
2143
+ z$1.literal("SplitRequired"),
2144
+ z$1.null()
2145
+ ]).optional(),
2146
+ splitCursor: z$1.union([z$1.string(), z$1.null()]).optional()
2138
2147
  });
2139
2148
  return new QueryProcedureBuilder({
2140
2149
  ...this._def,
@@ -0,0 +1,140 @@
1
+ import { i as DataTransformerOptions } from "./transformer-BEkxlnss.js";
2
+ import { FunctionReference, FunctionReturnType } from "convex/server";
3
+
4
+ //#region src/internal/upstream/index.d.ts
5
+ type EmptyObject = Record<string, never>;
6
+ /**
7
+ * Hack! This type causes TypeScript to simplify how it renders object types.
8
+ *
9
+ * It is functionally the identity for object types, but in practice it can
10
+ * simplify expressions like `A & B`.
11
+ */
12
+ type Expand<ObjectType extends Record<any, any>> = ObjectType extends Record<any, any> ? { [Key in keyof ObjectType]: ObjectType[Key] } : never;
13
+ //#endregion
14
+ //#region src/server/caller.d.ts
15
+ /** Metadata for a single function */
16
+ type FnMeta = {
17
+ type?: 'query' | 'mutation' | 'action';
18
+ [key: string]: unknown;
19
+ };
20
+ /** Metadata for all functions in a module */
21
+ type ModuleMeta = Record<string, FnMeta>;
22
+ /** Metadata for all modules - from generated `@convex/api` */
23
+ type CallerMeta = Record<string, ModuleMeta>;
24
+ /** Options for individual caller function calls */
25
+ type CallerOpts = {
26
+ /** Skip query silently when unauthenticated (returns null instead of throwing) */skipUnauth?: boolean;
27
+ };
28
+ type CallerReturn<T, Opts extends CallerOpts | undefined> = Opts extends {
29
+ skipUnauth: true;
30
+ } ? T | null : T;
31
+ type FetchFn<T extends 'query' | 'mutation' | 'action'> = <Fn extends FunctionReference<T>>(fn: Fn, args: Fn['_args'], opts?: CallerOpts) => Promise<FunctionReturnType<Fn> | null>;
32
+ type CreateCallerOptions = {
33
+ fetchQuery: FetchFn<'query'>;
34
+ fetchMutation: FetchFn<'mutation'>;
35
+ fetchAction: FetchFn<'action'>;
36
+ meta: CallerMeta;
37
+ transformer?: DataTransformerOptions;
38
+ };
39
+ type ServerCallerFn<TApi, K extends keyof TApi> = TApi[K] extends FunctionReference<infer T, 'public'> ? T extends 'query' | 'mutation' | 'action' ? keyof TApi[K]['_args'] extends never ? <Opts extends CallerOpts | undefined = undefined>(args?: EmptyObject, opts?: Opts) => Promise<CallerReturn<FunctionReturnType<TApi[K]>, Opts>> : EmptyObject extends TApi[K]['_args'] ? <Opts extends CallerOpts | undefined = undefined>(args?: TApi[K]['_args'], opts?: Opts) => Promise<CallerReturn<FunctionReturnType<TApi[K]>, Opts>> : <Opts extends CallerOpts | undefined = undefined>(args: TApi[K]['_args'], opts?: Opts) => Promise<CallerReturn<FunctionReturnType<TApi[K]>, Opts>> : never : ServerCaller<TApi[K]>;
40
+ type ServerCaller<TApi> = { [K in keyof TApi as K extends string ? K extends `_${string}` ? never : K extends 'http' ? never : K : K]: ServerCallerFn<TApi, K> };
41
+ /**
42
+ * Create a server caller for direct data fetching without React Query.
43
+ *
44
+ * This is detached from React Query cache - data is NOT available in client components.
45
+ * Use for server-only data that doesn't need to be shared with the client.
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * // src/lib/convex/rsc.tsx
50
+ * export const caller = createServerCaller(api, {
51
+ * fetchQuery: fetchAuthQuery,
52
+ * fetchMutation: fetchAuthMutation,
53
+ * });
54
+ *
55
+ * // app/page.tsx (RSC)
56
+ * const posts = await caller.posts.list();
57
+ * return <div>{posts?.length} posts</div>;
58
+ * ```
59
+ */
60
+ declare function createServerCaller<TApi extends Record<string, unknown>>(api: TApi, opts: CreateCallerOptions): ServerCaller<TApi>;
61
+ //#endregion
62
+ //#region src/server/lazy-caller.d.ts
63
+ type CallerContext<TApi> = {
64
+ caller: ServerCaller<TApi>;
65
+ token: string | undefined;
66
+ isAuthenticated: boolean;
67
+ };
68
+ /**
69
+ * Lazy caller with auth helper methods.
70
+ * Context is created on first procedure invocation, not at definition time.
71
+ */
72
+ type LazyCaller<TApi> = ServerCaller<TApi> & {
73
+ /** Check if user is authenticated */isAuth: () => Promise<boolean>; /** Check if user is unauthenticated */
74
+ isUnauth: () => Promise<boolean>; /** Get the auth token (for RSC prefetching) */
75
+ getToken: () => Promise<string | undefined>;
76
+ };
77
+ /**
78
+ * Create a lazy caller that creates context on each procedure invocation.
79
+ * Matches tRPC's `appRouter.createCaller(createTRPCContext)` pattern.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * // server.ts
84
+ * const { createContext, createCaller } = createCallerFactory({...});
85
+ *
86
+ * // rsc.tsx
87
+ * const createRSCContext = cache(async () => {
88
+ * const heads = await headers();
89
+ * return createContext({ headers: heads });
90
+ * });
91
+ * export const caller = createCaller(createRSCContext);
92
+ *
93
+ * // app/page.tsx - single call! Context created lazily
94
+ * const posts = await caller.posts.list();
95
+ * ```
96
+ */
97
+ declare function createLazyCaller<TApi extends Record<string, unknown>>(api: TApi, createContext: () => Promise<CallerContext<TApi>>): LazyCaller<TApi>;
98
+ //#endregion
99
+ //#region src/server/caller-factory.d.ts
100
+ type TokenResult = {
101
+ token?: string;
102
+ isFresh?: boolean;
103
+ };
104
+ type GetTokenFn = (siteUrl: string, headers: Headers, opts?: unknown) => Promise<TokenResult>;
105
+ /** Auth options for server-side calls. */
106
+ type AuthOptions = {
107
+ /** Function to extract auth token from request headers. */getToken: GetTokenFn;
108
+ /**
109
+ * Custom function to detect UNAUTHORIZED errors.
110
+ * Set this to resolve those errors to `null` instead of throwing.
111
+ *
112
+ * Refreshing an expired cached token and retrying does not require this:
113
+ * that always falls back to `defaultIsUnauthorized`.
114
+ */
115
+ isUnauthorized?: (error: unknown) => boolean;
116
+ };
117
+ type CreateCallerFactoryOptions<TApi> = {
118
+ /** Your Convex API object. */api: TApi; /** Convex site URL (must end in `.convex.site`). */
119
+ convexSiteUrl: string;
120
+ /**
121
+ * Convex deployment URL (must end in `.convex.cloud`).
122
+ * Defaults to `convexSiteUrl` with the domain swapped.
123
+ */
124
+ convexUrl?: string; /** Auth options. Pass to enable authenticated calls with JWT caching. */
125
+ auth?: AuthOptions; /** Optional wire transformer for request/response payloads (always composed with Date). */
126
+ transformer?: DataTransformerOptions;
127
+ };
128
+ type ConvexContext<TApi> = {
129
+ token: string | undefined;
130
+ isAuthenticated: boolean;
131
+ caller: ServerCaller<TApi>;
132
+ };
133
+ declare function createCallerFactory<TApi extends Record<string, unknown>>(opts: CreateCallerFactoryOptions<TApi>): {
134
+ createCaller: (ctxFn: () => Promise<ConvexContext<TApi>>) => LazyCaller<TApi>;
135
+ createContext: (reqOpts: {
136
+ headers: Headers;
137
+ }) => Promise<ConvexContext<TApi>>;
138
+ };
139
+ //#endregion
140
+ export { CallerMeta as a, createServerCaller as c, createLazyCaller as i, EmptyObject as l, createCallerFactory as n, CallerOpts as o, LazyCaller as r, ServerCaller as s, ConvexContext as t, Expand as u };
@@ -1,5 +1,6 @@
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-BXpu7xIU.js";
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";
3
4
  import { FunctionArgs, FunctionReference } from "convex/server";
4
5
 
5
6
  //#region src/crpc/auth-error.d.ts
@@ -1,5 +1,5 @@
1
1
  import { t as GetAuth } from "./types-ex0-J-SC.js";
2
- import { t as GenericCtx } from "./context-utils-Cbv4r0AA.js";
2
+ import { t as GenericCtx } from "./context-utils-ax351iFc.js";
3
3
  import * as convex_server0 from "convex/server";
4
4
  import { DocumentByName, FunctionReference, GenericDataModel, GenericMutationCtx, GenericSchema, PaginationResult, SchemaDefinition, TableNamesInDataModel, internalMutationGeneric } from "convex/server";
5
5
  import * as better_auth_adapters0 from "better-auth/adapters";
@@ -199,20 +199,20 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
199
199
  count: convex_server0.RegisteredQuery<"internal", {
200
200
  where?: {
201
201
  mode?: "sensitive" | "insensitive" | undefined;
202
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
202
203
  connector?: "AND" | "OR" | undefined;
203
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
204
- field: string;
205
204
  value: string | number | boolean | string[] | number[] | null;
205
+ field: string;
206
206
  }[] | undefined;
207
207
  model: string;
208
208
  }, Promise<number | null>>;
209
209
  consumeOne: convex_server0.RegisteredMutation<"internal", {
210
210
  input: {
211
211
  where?: {
212
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
212
213
  connector?: "AND" | "OR" | undefined;
213
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
214
- field: string;
215
214
  value: string | number | boolean | string[] | number[] | null;
215
+ field: string;
216
216
  }[] | undefined;
217
217
  model: string;
218
218
  } | {
@@ -235,26 +235,26 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
235
235
  };
236
236
  }, Promise<any>>;
237
237
  deleteMany: convex_server0.RegisteredMutation<"internal", {
238
+ paginationOpts: {
239
+ id?: number;
240
+ endCursor?: string | null;
241
+ maximumRowsRead?: number;
242
+ maximumBytesRead?: number;
243
+ numItems: number;
244
+ cursor: string | null;
245
+ };
238
246
  input: {
239
247
  where?: {
248
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
240
249
  connector?: "AND" | "OR" | undefined;
241
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
242
- field: string;
243
250
  value: string | number | boolean | string[] | number[] | null;
251
+ field: string;
244
252
  }[] | undefined;
245
253
  model: string;
246
254
  } | {
247
255
  where?: any[] | undefined;
248
256
  model: string;
249
257
  };
250
- paginationOpts: {
251
- id?: number;
252
- endCursor?: string | null;
253
- maximumRowsRead?: number;
254
- maximumBytesRead?: number;
255
- numItems: number;
256
- cursor: string | null;
257
- };
258
258
  }, Promise<{
259
259
  count: number;
260
260
  ids: any[];
@@ -266,10 +266,10 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
266
266
  deleteOne: convex_server0.RegisteredMutation<"internal", {
267
267
  input: {
268
268
  where?: {
269
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
269
270
  connector?: "AND" | "OR" | undefined;
270
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
271
- field: string;
272
271
  value: string | number | boolean | string[] | number[] | null;
272
+ field: string;
273
273
  }[] | undefined;
274
274
  model: string;
275
275
  } | {
@@ -279,20 +279,19 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
279
279
  }, Promise<Record<string, unknown> | undefined>>;
280
280
  findMany: convex_server0.RegisteredQuery<"internal", {
281
281
  join?: any;
282
+ limit?: number | undefined;
282
283
  where?: {
283
284
  mode?: "sensitive" | "insensitive" | undefined;
285
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
284
286
  connector?: "AND" | "OR" | undefined;
285
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
286
- field: string;
287
287
  value: string | number | boolean | string[] | number[] | null;
288
+ field: string;
288
289
  }[] | undefined;
289
- limit?: number | undefined;
290
290
  offset?: number | undefined;
291
291
  sortBy?: {
292
- field: string;
293
292
  direction: "asc" | "desc";
293
+ field: string;
294
294
  } | undefined;
295
- model: string;
296
295
  paginationOpts: {
297
296
  id?: number;
298
297
  endCursor?: string | null;
@@ -301,15 +300,16 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
301
300
  numItems: number;
302
301
  cursor: string | null;
303
302
  };
303
+ model: string;
304
304
  }, Promise<PaginationResult<convex_server0.GenericDocument>>>;
305
305
  findOne: convex_server0.RegisteredQuery<"internal", {
306
306
  join?: any;
307
307
  where?: {
308
308
  mode?: "sensitive" | "insensitive" | undefined;
309
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
309
310
  connector?: "AND" | "OR" | undefined;
310
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
311
- field: string;
312
311
  value: string | number | boolean | string[] | number[] | null;
312
+ field: string;
313
313
  }[] | undefined;
314
314
  select?: string[] | undefined;
315
315
  model: string;
@@ -319,10 +319,10 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
319
319
  input: {
320
320
  where?: {
321
321
  mode?: "sensitive" | "insensitive" | undefined;
322
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
322
323
  connector?: "AND" | "OR" | undefined;
323
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
324
- field: string;
325
324
  value: string | number | boolean | string[] | number[] | null;
325
+ field: string;
326
326
  }[] | undefined;
327
327
  set?: Record<string, any> | undefined;
328
328
  model: string;
@@ -331,31 +331,31 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
331
331
  }, Promise<any>>;
332
332
  rotateKeys: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
333
333
  updateMany: convex_server0.RegisteredMutation<"internal", {
334
+ paginationOpts: {
335
+ id?: number;
336
+ endCursor?: string | null;
337
+ maximumRowsRead?: number;
338
+ maximumBytesRead?: number;
339
+ numItems: number;
340
+ cursor: string | null;
341
+ };
334
342
  input: {
335
343
  where?: {
344
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
336
345
  connector?: "AND" | "OR" | undefined;
337
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
338
- field: string;
339
346
  value: string | number | boolean | string[] | number[] | null;
347
+ field: string;
340
348
  }[] | undefined;
341
- model: string;
342
349
  update: {
343
350
  [x: string]: unknown;
344
351
  [x: number]: unknown;
345
352
  [x: symbol]: unknown;
346
353
  };
354
+ model: string;
347
355
  } | {
348
356
  where?: any[] | undefined;
349
- model: string;
350
357
  update: any;
351
- };
352
- paginationOpts: {
353
- id?: number;
354
- endCursor?: string | null;
355
- maximumRowsRead?: number;
356
- maximumBytesRead?: number;
357
- numItems: number;
358
- cursor: string | null;
358
+ model: string;
359
359
  };
360
360
  }, Promise<{
361
361
  count: number;
@@ -368,21 +368,21 @@ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel e
368
368
  updateOne: convex_server0.RegisteredMutation<"internal", {
369
369
  input: {
370
370
  where?: {
371
+ operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
371
372
  connector?: "AND" | "OR" | undefined;
372
- operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
373
- field: string;
374
373
  value: string | number | boolean | string[] | number[] | null;
374
+ field: string;
375
375
  }[] | undefined;
376
- model: string;
377
376
  update: {
378
377
  [x: string]: unknown;
379
378
  [x: number]: unknown;
380
379
  [x: symbol]: unknown;
381
380
  };
381
+ model: string;
382
382
  } | {
383
383
  where?: any[] | undefined;
384
- model: string;
385
384
  update: any;
385
+ model: string;
386
386
  };
387
387
  }, Promise<any>>;
388
388
  };