kitcn 0.0.1 → 0.12.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 (93) hide show
  1. package/bin/intent.js +3 -0
  2. package/dist/aggregate/index.d.ts +388 -0
  3. package/dist/aggregate/index.js +37 -0
  4. package/dist/api-entry-BckXqaLb.js +66 -0
  5. package/dist/auth/client/index.d.ts +37 -0
  6. package/dist/auth/client/index.js +217 -0
  7. package/dist/auth/config/index.d.ts +45 -0
  8. package/dist/auth/config/index.js +24 -0
  9. package/dist/auth/generated/index.d.ts +2 -0
  10. package/dist/auth/generated/index.js +3 -0
  11. package/dist/auth/http/index.d.ts +64 -0
  12. package/dist/auth/http/index.js +461 -0
  13. package/dist/auth/index.d.ts +221 -0
  14. package/dist/auth/index.js +1398 -0
  15. package/dist/auth/nextjs/index.d.ts +50 -0
  16. package/dist/auth/nextjs/index.js +81 -0
  17. package/dist/auth-store-Cljlmdmi.js +197 -0
  18. package/dist/builder-CBdG5W6A.js +1974 -0
  19. package/dist/caller-factory-cTXNvYdz.js +216 -0
  20. package/dist/cli.mjs +13264 -0
  21. package/dist/codegen-lF80HSWu.mjs +3416 -0
  22. package/dist/context-utils-HPC5nXzx.d.ts +17 -0
  23. package/dist/create-schema-odyF4kCy.js +156 -0
  24. package/dist/create-schema-orm-DOyiNDCx.js +246 -0
  25. package/dist/crpc/index.d.ts +105 -0
  26. package/dist/crpc/index.js +169 -0
  27. package/dist/customFunctions-C0voKmtx.js +144 -0
  28. package/dist/error-BZEnI7Sq.js +41 -0
  29. package/dist/generated-contract-disabled-Cih4eITO.js +50 -0
  30. package/dist/generated-contract-disabled-D-sOFy92.d.ts +354 -0
  31. package/dist/http-types-DqJubRPJ.d.ts +292 -0
  32. package/dist/meta-utils-0Pu0Nrap.js +117 -0
  33. package/dist/middleware-BUybuv9n.d.ts +34 -0
  34. package/dist/middleware-C2qTZ3V7.js +84 -0
  35. package/dist/orm/index.d.ts +17 -0
  36. package/dist/orm/index.js +10713 -0
  37. package/dist/plugins/index.d.ts +2 -0
  38. package/dist/plugins/index.js +3 -0
  39. package/dist/procedure-caller-DtxLmGwA.d.ts +1467 -0
  40. package/dist/procedure-caller-MWcxhQDv.js +349 -0
  41. package/dist/query-context-B8o6-8kC.js +1518 -0
  42. package/dist/query-context-CFZqIvD7.d.ts +42 -0
  43. package/dist/query-options-Dw7cOyXl.js +121 -0
  44. package/dist/ratelimit/index.d.ts +269 -0
  45. package/dist/ratelimit/index.js +856 -0
  46. package/dist/ratelimit/react/index.d.ts +76 -0
  47. package/dist/ratelimit/react/index.js +183 -0
  48. package/dist/react/index.d.ts +1284 -0
  49. package/dist/react/index.js +2526 -0
  50. package/dist/rsc/index.d.ts +276 -0
  51. package/dist/rsc/index.js +233 -0
  52. package/dist/runtime-CtvJPkur.js +2453 -0
  53. package/dist/server/index.d.ts +5 -0
  54. package/dist/server/index.js +6 -0
  55. package/dist/solid/index.d.ts +1221 -0
  56. package/dist/solid/index.js +2940 -0
  57. package/dist/transformer-DtDhR3Lc.js +194 -0
  58. package/dist/types-BTb_4BaU.d.ts +42 -0
  59. package/dist/types-BiJE7qxR.d.ts +4 -0
  60. package/dist/types-DEJpkIhw.d.ts +88 -0
  61. package/dist/types-HhO_R6pd.d.ts +213 -0
  62. package/dist/validators-B7oIJCAp.js +279 -0
  63. package/dist/validators-vzRKjBJC.d.ts +88 -0
  64. package/dist/watcher.mjs +96 -0
  65. package/dist/where-clause-compiler-DdjN63Io.d.ts +4756 -0
  66. package/package.json +107 -34
  67. package/skills/convex/SKILL.md +486 -0
  68. package/skills/convex/references/features/aggregates.md +353 -0
  69. package/skills/convex/references/features/auth-admin.md +446 -0
  70. package/skills/convex/references/features/auth-organizations.md +1141 -0
  71. package/skills/convex/references/features/auth-polar.md +579 -0
  72. package/skills/convex/references/features/auth.md +470 -0
  73. package/skills/convex/references/features/create-plugins.md +153 -0
  74. package/skills/convex/references/features/http.md +676 -0
  75. package/skills/convex/references/features/migrations.md +162 -0
  76. package/skills/convex/references/features/orm.md +1166 -0
  77. package/skills/convex/references/features/react.md +657 -0
  78. package/skills/convex/references/features/scheduling.md +267 -0
  79. package/skills/convex/references/features/testing.md +209 -0
  80. package/skills/convex/references/setup/auth.md +501 -0
  81. package/skills/convex/references/setup/biome.md +190 -0
  82. package/skills/convex/references/setup/doc-guidelines.md +145 -0
  83. package/skills/convex/references/setup/index.md +761 -0
  84. package/skills/convex/references/setup/next.md +116 -0
  85. package/skills/convex/references/setup/react.md +175 -0
  86. package/skills/convex/references/setup/server.md +473 -0
  87. package/skills/convex/references/setup/start.md +67 -0
  88. package/LICENSE +0 -21
  89. package/README.md +0 -0
  90. package/dist/index.d.mts +0 -5
  91. package/dist/index.d.mts.map +0 -1
  92. package/dist/index.mjs +0 -6
  93. package/dist/index.mjs.map +0 -1
@@ -0,0 +1,354 @@
1
+ import { t as GetAuth } from "./types-BiJE7qxR.js";
2
+ import { t as GenericCtx } from "./context-utils-HPC5nXzx.js";
3
+ import * as convex_server0 from "convex/server";
4
+ import { DocumentByName, FunctionReference, GenericDataModel, GenericMutationCtx, GenericSchema, SchemaDefinition, TableNamesInDataModel, internalMutationGeneric } from "convex/server";
5
+ import * as better_auth_adapters0 from "better-auth/adapters";
6
+ import { BetterAuthOptions } from "better-auth/minimal";
7
+ import { Auth } from "better-auth";
8
+
9
+ //#region src/auth/define-auth.d.ts
10
+ type MaybePromise$1<T> = T | Promise<T>;
11
+ type TableDoc<DataModel extends GenericDataModel, TableName extends string> = TableName extends TableNamesInDataModel<DataModel> ? DocumentByName<DataModel, TableName> extends Record<string, unknown> ? DocumentByName<DataModel, TableName> : Record<string, unknown> : Record<string, unknown>;
12
+ type InsertDocData<TDoc extends Record<string, unknown>> = Omit<TDoc, '_id' | '_creationTime'>;
13
+ type UpdateDocData<TDoc extends Record<string, unknown>> = Partial<Omit<TDoc, '_id' | '_creationTime'>>;
14
+ type TriggerChangeId<TDoc> = TDoc extends {
15
+ _id: infer TId;
16
+ } ? TId : TDoc extends {
17
+ id: infer TId;
18
+ } ? TId : unknown;
19
+ type GenericAuthTriggerChange<TDoc extends Record<string, unknown> = Record<string, unknown>, TId = TriggerChangeId<TDoc>> = {
20
+ id: TId;
21
+ newDoc: TDoc;
22
+ oldDoc: null;
23
+ operation: 'insert';
24
+ } | {
25
+ id: TId;
26
+ newDoc: TDoc;
27
+ oldDoc: TDoc;
28
+ operation: 'update';
29
+ } | {
30
+ id: TId;
31
+ newDoc: null;
32
+ oldDoc: TDoc;
33
+ operation: 'delete';
34
+ };
35
+ type GenericAuthBeforeResult<TData extends Record<string, unknown>> = void | false | {
36
+ data: Partial<TData>;
37
+ };
38
+ type GenericAuthTriggerHandlers<DataModel extends GenericDataModel, TableName extends string, TriggerCtx, Doc extends Record<string, unknown> = TableDoc<DataModel, TableName>, InsertDoc extends Record<string, unknown> = InsertDocData<Doc>, UpdateDoc extends Record<string, unknown> = UpdateDocData<Doc>> = {
39
+ change?: (change: GenericAuthTriggerChange<Doc>, ctx: TriggerCtx) => MaybePromise$1<void>;
40
+ create?: {
41
+ after?: (doc: Doc, ctx: TriggerCtx) => MaybePromise$1<void>;
42
+ before?: (data: InsertDoc, ctx: TriggerCtx) => MaybePromise$1<GenericAuthBeforeResult<InsertDoc>>;
43
+ };
44
+ delete?: {
45
+ after?: (doc: Doc, ctx: TriggerCtx) => MaybePromise$1<void>;
46
+ before?: (doc: Doc, ctx: TriggerCtx) => MaybePromise$1<GenericAuthBeforeResult<Doc>>;
47
+ };
48
+ update?: {
49
+ after?: (newDoc: Doc, ctx: TriggerCtx) => MaybePromise$1<void>;
50
+ before?: (update: UpdateDoc, ctx: TriggerCtx) => MaybePromise$1<GenericAuthBeforeResult<UpdateDoc>>;
51
+ };
52
+ };
53
+ type GenericAuthTriggers<DataModel extends GenericDataModel, Schema extends SchemaDefinition<any, any>, TriggerCtx = unknown> = { [K in keyof Schema['tables'] & string]?: GenericAuthTriggerHandlers<DataModel, K, TriggerCtx> };
54
+ type BetterAuthOptionsWithoutDatabase = Omit<BetterAuthOptions, 'database'>;
55
+ type GenericAuthDefinition<GenericCtx = unknown, DataModel extends GenericDataModel = GenericDataModel, Schema extends SchemaDefinition<GenericSchema, true> = SchemaDefinition<GenericSchema, true>, AuthOptions extends BetterAuthOptionsWithoutDatabase = BetterAuthOptionsWithoutDatabase> = (ctx: GenericCtx) => AuthOptions & {
56
+ triggers?: GenericAuthTriggers<DataModel, Schema, GenericCtx>;
57
+ };
58
+ declare const defineAuth: <GenericCtx = unknown, DataModel extends GenericDataModel = GenericDataModel, Schema extends SchemaDefinition<GenericSchema, true> = SchemaDefinition<GenericSchema, true>, AuthOptions extends BetterAuthOptionsWithoutDatabase = BetterAuthOptionsWithoutDatabase>(definition: GenericAuthDefinition<GenericCtx, DataModel, Schema, AuthOptions>) => GenericAuthDefinition<GenericCtx, DataModel, Schema, AuthOptions>;
59
+ //#endregion
60
+ //#region src/auth/create-api.d.ts
61
+ type Schema = SchemaDefinition<any, any>;
62
+ type MaybePromise<T> = T | Promise<T>;
63
+ type RuntimeBeforeResult = GenericAuthBeforeResult<Record<string, unknown>>;
64
+ type RuntimeTriggerChange = GenericAuthTriggerChange<Record<string, unknown>>;
65
+ type RuntimeTableTriggers = {
66
+ change?: (change: RuntimeTriggerChange, ctx: unknown) => MaybePromise<void>;
67
+ create?: {
68
+ after?: (doc: Record<string, unknown>, ctx: unknown) => MaybePromise<void>;
69
+ before?: (data: Record<string, unknown>, ctx: unknown) => MaybePromise<RuntimeBeforeResult>;
70
+ };
71
+ delete?: {
72
+ after?: (doc: Record<string, unknown>, ctx: unknown) => MaybePromise<void>;
73
+ before?: (doc: Record<string, unknown>, ctx: unknown) => MaybePromise<RuntimeBeforeResult>;
74
+ };
75
+ update?: {
76
+ after?: (doc: Record<string, unknown>, ctx: unknown) => MaybePromise<void>;
77
+ before?: (update: Record<string, unknown>, ctx: unknown) => MaybePromise<RuntimeBeforeResult>;
78
+ };
79
+ };
80
+ declare const createHandler: (ctx: any, args: {
81
+ input: {
82
+ data: any;
83
+ model: string;
84
+ };
85
+ select?: string[];
86
+ tableTriggers?: RuntimeTableTriggers;
87
+ triggerCtx?: unknown;
88
+ }, schema: Schema, betterAuthSchema: any) => Promise<any>;
89
+ declare const findOneHandler: (ctx: any, args: {
90
+ model: string;
91
+ select?: string[];
92
+ where?: any[];
93
+ }, schema: Schema, betterAuthSchema: any) => Promise<convex_server0.GenericDocument | null>;
94
+ declare const findManyHandler: (ctx: any, args: {
95
+ model: string;
96
+ paginationOpts: any;
97
+ limit?: number;
98
+ offset?: number;
99
+ sortBy?: {
100
+ direction: "asc" | "desc";
101
+ field: string;
102
+ };
103
+ where?: any[];
104
+ }, schema: Schema, betterAuthSchema: any) => Promise<convex_server0.PaginationResult<convex_server0.GenericDocument>>;
105
+ declare const updateOneHandler: (ctx: any, args: {
106
+ input: {
107
+ model: string;
108
+ update: any;
109
+ where?: any[];
110
+ };
111
+ tableTriggers?: RuntimeTableTriggers;
112
+ triggerCtx?: unknown;
113
+ }, schema: Schema, betterAuthSchema: any) => Promise<any>;
114
+ declare const updateManyHandler: (ctx: any, args: {
115
+ input: {
116
+ model: string;
117
+ update?: any;
118
+ where?: any[];
119
+ };
120
+ paginationOpts: any;
121
+ tableTriggers?: RuntimeTableTriggers;
122
+ triggerCtx?: unknown;
123
+ }, schema: Schema, betterAuthSchema: any) => Promise<{
124
+ count: number;
125
+ ids: any[];
126
+ isDone: boolean;
127
+ continueCursor: convex_server0.Cursor;
128
+ splitCursor?: convex_server0.Cursor | null;
129
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
130
+ }>;
131
+ declare const deleteOneHandler: (ctx: any, args: {
132
+ input: {
133
+ model: string;
134
+ where?: any[];
135
+ };
136
+ tableTriggers?: RuntimeTableTriggers;
137
+ triggerCtx?: unknown;
138
+ }, schema: Schema, betterAuthSchema: any) => Promise<Record<string, unknown> | undefined>;
139
+ declare const deleteManyHandler: (ctx: any, args: {
140
+ input: {
141
+ model: string;
142
+ where?: any[];
143
+ };
144
+ paginationOpts: any;
145
+ tableTriggers?: RuntimeTableTriggers;
146
+ triggerCtx?: unknown;
147
+ }, schema: Schema, betterAuthSchema: any) => Promise<{
148
+ count: number;
149
+ ids: any[];
150
+ isDone: boolean;
151
+ continueCursor: convex_server0.Cursor;
152
+ splitCursor?: convex_server0.Cursor | null;
153
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
154
+ }>;
155
+ declare const createApi: <Schema extends SchemaDefinition<any, any>, DataModel extends GenericDataModel = GenericDataModel, Ctx = unknown, TriggerCtx = Ctx, Auth = unknown>(schema: Schema, getAuth: GetAuth<Ctx, Auth>, options?: {
156
+ internalMutation?: typeof internalMutationGeneric;
157
+ context?: (ctx: any) => TriggerCtx | Promise<TriggerCtx>;
158
+ triggers?: GenericAuthTriggers<DataModel, Schema, TriggerCtx> | ((ctx: TriggerCtx) => GenericAuthTriggers<DataModel, Schema, TriggerCtx> | undefined); /** Validate input validators against auth table schemas. Defaults to false for smaller generated types. */
159
+ validateInput?: boolean;
160
+ }) => {
161
+ create: convex_server0.RegisteredMutation<"internal", {
162
+ select?: string[] | undefined;
163
+ input: {
164
+ data: {
165
+ [x: string]: unknown;
166
+ [x: number]: unknown;
167
+ [x: symbol]: unknown;
168
+ };
169
+ model: string;
170
+ } | {
171
+ data: any;
172
+ model: string;
173
+ };
174
+ }, Promise<any>>;
175
+ deleteMany: convex_server0.RegisteredMutation<"internal", {
176
+ input: {
177
+ where?: {
178
+ connector?: "AND" | "OR" | undefined;
179
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
180
+ value: string | number | boolean | string[] | number[] | null;
181
+ field: string;
182
+ }[] | undefined;
183
+ model: string;
184
+ } | {
185
+ where?: any[] | undefined;
186
+ model: string;
187
+ };
188
+ paginationOpts: {
189
+ id?: number;
190
+ endCursor?: string | null;
191
+ maximumRowsRead?: number;
192
+ maximumBytesRead?: number;
193
+ numItems: number;
194
+ cursor: string | null;
195
+ };
196
+ }, Promise<{
197
+ count: number;
198
+ ids: any[];
199
+ isDone: boolean;
200
+ continueCursor: convex_server0.Cursor;
201
+ splitCursor?: convex_server0.Cursor | null;
202
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
203
+ }>>;
204
+ deleteOne: convex_server0.RegisteredMutation<"internal", {
205
+ input: {
206
+ where?: {
207
+ connector?: "AND" | "OR" | undefined;
208
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
209
+ value: string | number | boolean | string[] | number[] | null;
210
+ field: string;
211
+ }[] | undefined;
212
+ model: string;
213
+ } | {
214
+ where?: any[] | undefined;
215
+ model: string;
216
+ };
217
+ }, Promise<Record<string, unknown> | undefined>>;
218
+ findMany: convex_server0.RegisteredQuery<"internal", {
219
+ join?: any;
220
+ where?: {
221
+ connector?: "AND" | "OR" | undefined;
222
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
223
+ value: string | number | boolean | string[] | number[] | null;
224
+ field: string;
225
+ }[] | undefined;
226
+ limit?: number | undefined;
227
+ offset?: number | undefined;
228
+ sortBy?: {
229
+ field: string;
230
+ direction: "asc" | "desc";
231
+ } | undefined;
232
+ model: string;
233
+ paginationOpts: {
234
+ id?: number;
235
+ endCursor?: string | null;
236
+ maximumRowsRead?: number;
237
+ maximumBytesRead?: number;
238
+ numItems: number;
239
+ cursor: string | null;
240
+ };
241
+ }, Promise<convex_server0.PaginationResult<convex_server0.GenericDocument>>>;
242
+ findOne: convex_server0.RegisteredQuery<"internal", {
243
+ join?: any;
244
+ select?: string[] | undefined;
245
+ where?: {
246
+ connector?: "AND" | "OR" | undefined;
247
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
248
+ value: string | number | boolean | string[] | number[] | null;
249
+ field: string;
250
+ }[] | undefined;
251
+ model: string;
252
+ }, Promise<convex_server0.GenericDocument | null>>;
253
+ getLatestJwks: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
254
+ rotateKeys: convex_server0.RegisteredAction<"internal", {}, Promise<unknown>>;
255
+ updateMany: convex_server0.RegisteredMutation<"internal", {
256
+ input: {
257
+ where?: {
258
+ connector?: "AND" | "OR" | undefined;
259
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
260
+ value: string | number | boolean | string[] | number[] | null;
261
+ field: string;
262
+ }[] | undefined;
263
+ model: string;
264
+ update: {
265
+ [x: string]: unknown;
266
+ [x: number]: unknown;
267
+ [x: symbol]: unknown;
268
+ };
269
+ } | {
270
+ where?: any[] | undefined;
271
+ model: string;
272
+ update: any;
273
+ };
274
+ paginationOpts: {
275
+ id?: number;
276
+ endCursor?: string | null;
277
+ maximumRowsRead?: number;
278
+ maximumBytesRead?: number;
279
+ numItems: number;
280
+ cursor: string | null;
281
+ };
282
+ }, Promise<{
283
+ count: number;
284
+ ids: any[];
285
+ isDone: boolean;
286
+ continueCursor: convex_server0.Cursor;
287
+ splitCursor?: convex_server0.Cursor | null;
288
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
289
+ }>>;
290
+ updateOne: convex_server0.RegisteredMutation<"internal", {
291
+ input: {
292
+ where?: {
293
+ connector?: "AND" | "OR" | undefined;
294
+ operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
295
+ value: string | number | boolean | string[] | number[] | null;
296
+ field: string;
297
+ }[] | undefined;
298
+ model: string;
299
+ update: {
300
+ [x: string]: unknown;
301
+ [x: number]: unknown;
302
+ [x: symbol]: unknown;
303
+ };
304
+ } | {
305
+ where?: any[] | undefined;
306
+ model: string;
307
+ update: any;
308
+ };
309
+ }, Promise<any>>;
310
+ };
311
+ //#endregion
312
+ //#region src/auth/create-client.d.ts
313
+ type AuthFunctions = {
314
+ create: FunctionReference<'mutation', 'internal', Record<string, any>>;
315
+ deleteMany: FunctionReference<'mutation', 'internal', Record<string, any>>;
316
+ deleteOne: FunctionReference<'mutation', 'internal', Record<string, any>>;
317
+ findMany: FunctionReference<'query', 'internal', Record<string, any>>;
318
+ findOne: FunctionReference<'query', 'internal', Record<string, any>>;
319
+ updateMany: FunctionReference<'mutation', 'internal', Record<string, any>>;
320
+ updateOne: FunctionReference<'mutation', 'internal', Record<string, any>>;
321
+ };
322
+ type Triggers<DataModel extends GenericDataModel, Schema extends SchemaDefinition<any, any>, TriggerCtx = unknown> = GenericAuthTriggers<DataModel, Schema, TriggerCtx>;
323
+ type TriggerResolver<DataModel extends GenericDataModel, Schema extends SchemaDefinition<any, any>, TriggerCtx extends GenericMutationCtx<DataModel> = GenericMutationCtx<DataModel>> = Triggers<DataModel, Schema, TriggerCtx> | ((ctx: TriggerCtx) => Triggers<DataModel, Schema, TriggerCtx> | undefined);
324
+ declare const createClient: <DataModel extends GenericDataModel, Schema extends SchemaDefinition<GenericSchema, true>, TriggerCtx extends GenericMutationCtx<DataModel> = GenericMutationCtx<DataModel>>(config: {
325
+ authFunctions: AuthFunctions;
326
+ schema: Schema;
327
+ context?: (ctx: GenericMutationCtx<DataModel>) => TriggerCtx | Promise<TriggerCtx>;
328
+ triggers?: TriggerResolver<DataModel, Schema, TriggerCtx>;
329
+ }) => {
330
+ authFunctions: AuthFunctions;
331
+ triggers: TriggerResolver<DataModel, Schema, TriggerCtx> | undefined;
332
+ adapter: (ctx: GenericCtx<DataModel>, getAuthOptions: (ctx: any) => BetterAuthOptions) => better_auth_adapters0.AdapterFactory<BetterAuthOptions>;
333
+ };
334
+ //#endregion
335
+ //#region src/auth/generated-contract-disabled.d.ts
336
+ type GeneratedAuthDisabledReasonKind = 'default_export_unavailable' | 'missing_auth_file' | 'missing_default_export';
337
+ declare const getGeneratedAuthDisabledReason: (kind: GeneratedAuthDisabledReasonKind, authDefinitionPath?: string) => string;
338
+ type AuthRuntime<DataModel extends GenericDataModel, Schema extends SchemaDefinition<GenericSchema, true>, TriggerCtx extends GenericMutationCtx<DataModel> = GenericMutationCtx<DataModel>, GenericCtx = GenericMutationCtx<DataModel>, AuthOptions extends BetterAuthOptionsWithoutDatabase = BetterAuthOptionsWithoutDatabase> = {
339
+ auth: Auth<AuthOptions & {
340
+ database: BetterAuthOptions['database'];
341
+ }>;
342
+ authClient: ReturnType<typeof createClient<DataModel, Schema, TriggerCtx>>;
343
+ authEnabled: boolean;
344
+ getAuth: (ctx: GenericCtx) => Auth<AuthOptions & {
345
+ database: BetterAuthOptions['database'];
346
+ }>;
347
+ } & ReturnType<typeof createApi<Schema, DataModel, GenericCtx, TriggerCtx, Auth<AuthOptions & {
348
+ database: BetterAuthOptions['database'];
349
+ }>>>;
350
+ declare const createDisabledAuthRuntime: <DataModel extends GenericDataModel, Schema extends SchemaDefinition<GenericSchema, true>, TriggerCtx extends GenericMutationCtx<DataModel> = GenericMutationCtx<DataModel>, GenericCtx = GenericMutationCtx<DataModel>, AuthOptions extends BetterAuthOptionsWithoutDatabase = BetterAuthOptionsWithoutDatabase>(config?: {
351
+ reason?: string;
352
+ }) => AuthRuntime<DataModel, Schema, TriggerCtx, GenericCtx, AuthOptions>;
353
+ //#endregion
354
+ export { defineAuth as S, GenericAuthBeforeResult as _, AuthFunctions as a, GenericAuthTriggerHandlers as b, createApi as c, deleteOneHandler as d, findManyHandler as f, BetterAuthOptionsWithoutDatabase as g, updateOneHandler as h, getGeneratedAuthDisabledReason as i, createHandler as l, updateManyHandler as m, GeneratedAuthDisabledReasonKind as n, Triggers as o, findOneHandler as p, createDisabledAuthRuntime as r, createClient as s, AuthRuntime as t, deleteManyHandler as u, GenericAuthDefinition as v, GenericAuthTriggers as x, GenericAuthTriggerChange as y };
@@ -0,0 +1,292 @@
1
+ import { o as Simplify } from "./types-BTb_4BaU.js";
2
+ import { m as UnsetMarker, t as AnyMiddleware } from "./types-DEJpkIhw.js";
3
+ import { GenericActionCtx, GenericDataModel, HttpRouter } from "convex/server";
4
+ import { z } from "zod";
5
+ import { Context, Hono } from "hono";
6
+
7
+ //#region src/crpc/transformer.d.ts
8
+ /**
9
+ * Generic transformer contract (mirrors tRPC shape).
10
+ */
11
+ interface DataTransformer {
12
+ deserialize(object: any): any;
13
+ serialize(object: any): any;
14
+ }
15
+ /**
16
+ * Separate input/output transformers.
17
+ */
18
+ interface CombinedDataTransformer {
19
+ input: DataTransformer;
20
+ output: DataTransformer;
21
+ }
22
+ /**
23
+ * Transformer config accepted by cRPC.
24
+ */
25
+ type DataTransformerOptions = CombinedDataTransformer | DataTransformer;
26
+ /**
27
+ * Extensible tagged wire codec.
28
+ */
29
+ interface WireCodec {
30
+ decode(value: unknown): unknown;
31
+ encode(value: unknown): unknown;
32
+ isType(value: unknown): boolean;
33
+ readonly tag: `$${string}`;
34
+ }
35
+ /**
36
+ * Date wire tag (Convex-style reserved key).
37
+ */
38
+ declare const DATE_CODEC_TAG = "$date";
39
+ /**
40
+ * Built-in Date codec.
41
+ */
42
+ declare const dateWireCodec: WireCodec;
43
+ /**
44
+ * Build a recursive tagged transformer from codecs.
45
+ */
46
+ declare const createTaggedTransformer: (codecs: readonly WireCodec[]) => DataTransformer;
47
+ /**
48
+ * Default cRPC transformer (Date-enabled).
49
+ */
50
+ declare const defaultCRPCTransformer: DataTransformer;
51
+ /**
52
+ * Normalize transformer config to split input/output shape.
53
+ * User transformers are additive and always composed with default Date handling.
54
+ */
55
+ declare const getTransformer: (transformer?: DataTransformerOptions) => CombinedDataTransformer;
56
+ /**
57
+ * Encode request payloads (input direction).
58
+ */
59
+ declare const encodeWire: (value: unknown, transformer?: DataTransformerOptions) => unknown;
60
+ /**
61
+ * Decode response payloads (output direction).
62
+ */
63
+ declare const decodeWire: (value: unknown, transformer?: DataTransformerOptions) => unknown;
64
+ /**
65
+ * Exposed identity transformer for advanced composition.
66
+ */
67
+ declare const identityTransformer: CombinedDataTransformer;
68
+ //#endregion
69
+ //#region src/server/http-types.d.ts
70
+ type ProcedureMeta = object;
71
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
72
+ interface HttpRouteDefinition<TMethod extends HttpMethod = HttpMethod> {
73
+ method: TMethod;
74
+ path: string;
75
+ pathParamNames: string[];
76
+ usePathPrefix: boolean;
77
+ }
78
+ /**
79
+ * Infer output type from schema, defaulting to void for UnsetMarker
80
+ */
81
+ type InferHttpInput$1<T> = T extends UnsetMarker ? undefined : T extends z.ZodTypeAny ? z.output<T> : never;
82
+ /**
83
+ * Internal definition for HttpProcedureBuilder
84
+ * Stores schema types directly (like QueryProcedureBuilder)
85
+ */
86
+ interface HttpProcedureBuilderDef<TCtx, TInput extends UnsetMarker | z.ZodTypeAny, TOutput extends UnsetMarker | z.ZodTypeAny, TParams extends UnsetMarker | z.ZodTypeAny, TQuery extends UnsetMarker | z.ZodTypeAny, TMeta extends ProcedureMeta, TMethod extends HttpMethod = HttpMethod, TForm extends UnsetMarker | z.ZodTypeAny = UnsetMarker> {
87
+ /** @internal Phantom types for type inference */
88
+ _types?: {
89
+ input: TInput;
90
+ output: TOutput;
91
+ params: TParams;
92
+ query: TQuery;
93
+ form: TForm;
94
+ };
95
+ formSchema?: z.ZodTypeAny;
96
+ functionConfig: {
97
+ base: HttpActionConstructor;
98
+ createContext: (ctx: GenericActionCtx<GenericDataModel>) => TCtx;
99
+ transformer: CombinedDataTransformer;
100
+ };
101
+ inputSchema?: z.ZodTypeAny;
102
+ meta: TMeta;
103
+ middlewares: AnyMiddleware[];
104
+ outputSchema?: z.ZodTypeAny;
105
+ paramsSchema?: z.ZodTypeAny;
106
+ querySchema?: z.ZodTypeAny;
107
+ route?: HttpRouteDefinition<TMethod>;
108
+ }
109
+ type HttpActionConstructor = (handler: (ctx: GenericActionCtx<GenericDataModel>, request: Request) => Promise<Response>) => HttpActionHandler;
110
+ interface HttpActionHandler {
111
+ isHttp: true;
112
+ }
113
+ interface HttpProcedure<TInput extends UnsetMarker | z.ZodTypeAny = any, TOutput extends UnsetMarker | z.ZodTypeAny = any, TParams extends UnsetMarker | z.ZodTypeAny = any, TQuery extends UnsetMarker | z.ZodTypeAny = any, TMethod extends HttpMethod = HttpMethod, TForm extends UnsetMarker | z.ZodTypeAny = any> extends HttpActionHandler {
114
+ _crpcHttpRoute: HttpRouteDefinition<TMethod>;
115
+ /** @internal Expose def for client-side type inference */
116
+ _def: {
117
+ inputSchema?: TInput;
118
+ outputSchema?: TOutput;
119
+ paramsSchema?: TParams;
120
+ querySchema?: TQuery;
121
+ formSchema?: TForm;
122
+ };
123
+ }
124
+ /**
125
+ * Handler options with ctx namespace (consistent with cRPC queries/mutations).
126
+ * - ctx: context properties (userId, db, runQuery, etc.)
127
+ * - input: parsed JSON body
128
+ * - params: parsed path params
129
+ * - searchParams: parsed query params
130
+ * - form: parsed form data
131
+ * - c: Hono Context for Response helpers (c.json, c.text, c.redirect, c.header, c.req)
132
+ */
133
+ type HttpHandlerOpts<TCtx, TInput extends UnsetMarker | z.ZodTypeAny, TParams extends UnsetMarker | z.ZodTypeAny, TSearchParams extends UnsetMarker | z.ZodTypeAny, TForm extends UnsetMarker | z.ZodTypeAny> = {
134
+ ctx: TCtx;
135
+ c: Context;
136
+ } & (TInput extends UnsetMarker ? object : {
137
+ input: z.output<TInput>;
138
+ }) & (TParams extends UnsetMarker ? object : {
139
+ params: z.output<TParams>;
140
+ }) & (TSearchParams extends UnsetMarker ? object : {
141
+ searchParams: z.output<TSearchParams>;
142
+ }) & (TForm extends UnsetMarker ? object : {
143
+ form: z.output<TForm>;
144
+ });
145
+ /**
146
+ * Hono handler with cRPC route metadata attached
147
+ */
148
+ interface CRPCHonoHandler {
149
+ _crpcRoute: {
150
+ path: string;
151
+ method: HttpMethod;
152
+ };
153
+ (c: Context): Promise<Response>;
154
+ }
155
+ //#endregion
156
+ //#region src/server/http-router.d.ts
157
+ /**
158
+ * Recursive router record - can contain procedures or nested routers
159
+ */
160
+ interface HttpRouterRecord {
161
+ [key: string]: HttpProcedure | HttpRouterRecord | CRPCHttpRouter<any>;
162
+ }
163
+ /**
164
+ * Router definition - stores both flat procedures and hierarchical record
165
+ */
166
+ interface HttpRouterDef<TRecord extends HttpRouterRecord> {
167
+ /** Flat map with dot-notation keys (e.g., "todos.get") for lookup */
168
+ procedures: Record<string, HttpProcedure>;
169
+ /** Hierarchical structure for type inference */
170
+ record: TRecord;
171
+ router: true;
172
+ }
173
+ /**
174
+ * HTTP Router - like tRPC's BuiltRouter
175
+ */
176
+ interface CRPCHttpRouter<TRecord extends HttpRouterRecord> {
177
+ _def: HttpRouterDef<TRecord>;
178
+ }
179
+ /**
180
+ * HTTP Router that wraps a Hono app for use with Convex.
181
+ * Internal class - use `createHttpRouter()` factory instead.
182
+ */
183
+ declare class HttpRouterWithHono extends HttpRouter {
184
+ private _app;
185
+ private _handler;
186
+ constructor(app: Hono);
187
+ }
188
+ /**
189
+ * Create a router factory function (like tRPC's createRouterFactory)
190
+ *
191
+ * @example
192
+ * ```ts
193
+ * // In crpc.ts
194
+ * export const router = c.router;
195
+ *
196
+ * // In api/todos.ts
197
+ * export const todosRouter = router({
198
+ * get: publicRoute.get('/api/todos/:id')...,
199
+ * create: authRoute.post('/api/todos')...,
200
+ * });
201
+ *
202
+ * // In http.ts
203
+ * export const httpRouter = router({
204
+ * todos: todosRouter,
205
+ * health,
206
+ * });
207
+ * export type AppRouter = typeof httpRouter;
208
+ * ```
209
+ */
210
+ declare function createHttpRouterFactory(): <TRecord extends HttpRouterRecord>(record: TRecord) => CRPCHttpRouter<TRecord>;
211
+ /**
212
+ * Create an HTTP router with cRPC routes registered.
213
+ *
214
+ * @example
215
+ * ```ts
216
+ * import { Hono } from 'hono';
217
+ * import { cors } from 'hono/cors';
218
+ * import { createHttpRouter } from 'kitcn/server';
219
+ *
220
+ * const app = new Hono();
221
+ * app.use('/api/*', cors({ origin: process.env.SITE_URL, credentials: true }));
222
+ *
223
+ * export default createHttpRouter(app, httpRouter);
224
+ * ```
225
+ */
226
+ declare function createHttpRouter<TRecord extends HttpRouterRecord>(app: Hono, router: CRPCHttpRouter<TRecord>): HttpRouterWithHono;
227
+ /**
228
+ * Extract route map from procedures for client runtime
229
+ *
230
+ * @example
231
+ * ```ts
232
+ * export const httpRoutes = extractRouteMap(httpRouter._def.procedures);
233
+ * ```
234
+ */
235
+ declare function extractRouteMap<T extends Record<string, HttpProcedure>>(procedures: T): { [K in keyof T]: {
236
+ path: string;
237
+ method: string;
238
+ } };
239
+ //#endregion
240
+ //#region src/crpc/http-types.d.ts
241
+ /** Route definition for client runtime */
242
+ type HttpRouteInfo = {
243
+ path: string;
244
+ method: string;
245
+ };
246
+ /** Route map type - from codegen */
247
+ type HttpRouteMap = Record<string, HttpRouteInfo>;
248
+ /** Infer schema type or return empty object if UnsetMarker */
249
+ type InferSchemaOrEmpty<T> = T extends UnsetMarker ? object : T extends z.ZodTypeAny ? z.infer<T> : object;
250
+ /**
251
+ * Infer merged input from HttpProcedure
252
+ * Combines params, query, and body input into a single object
253
+ */
254
+ type InferHttpInput<T> = T extends HttpProcedure<infer TInput, infer _TOutput, infer TParams, infer TQuery> ? Simplify<InferSchemaOrEmpty<TParams> & InferSchemaOrEmpty<TQuery> & InferSchemaOrEmpty<TInput>> : object;
255
+ /**
256
+ * Infer output type from HttpProcedure
257
+ */
258
+ type InferHttpOutput<T> = T extends HttpProcedure<infer _TInput, infer TOutput, infer _TParams, infer _TQuery> ? TOutput extends UnsetMarker ? unknown : TOutput extends z.ZodTypeAny ? z.infer<TOutput> : unknown : unknown;
259
+ /**
260
+ * Single procedure call signature
261
+ * Returns a function that takes merged input and returns output
262
+ */
263
+ type HttpProcedureCall<T extends HttpProcedure> = keyof InferHttpInput<T> extends never ? () => Promise<InferHttpOutput<T>> : object extends InferHttpInput<T> ? (input?: InferHttpInput<T>) => Promise<InferHttpOutput<T>> : (input: InferHttpInput<T>) => Promise<InferHttpOutput<T>>;
264
+ /**
265
+ * HTTP Client type from router record
266
+ * Maps each procedure to its call signature, recursively for nested routers
267
+ */
268
+ type HttpClient<T extends HttpRouterRecord> = { [K in keyof T]: T[K] extends HttpProcedure ? HttpProcedureCall<T[K]> : T[K] extends CRPCHttpRouter<infer R> ? HttpClient<R> : T[K] extends HttpRouterRecord ? HttpClient<T[K]> : never };
269
+ /**
270
+ * HTTP Client type from a CRPCHttpRouter
271
+ * Use this when your type is the router object (with _def)
272
+ */
273
+ type HttpClientFromRouter<TRouter extends CRPCHttpRouter<any>> = HttpClient<TRouter['_def']['record']>;
274
+ /** Error codes that can be returned from HTTP endpoints */
275
+ type HttpErrorCode = 'BAD_REQUEST' | 'UNAUTHORIZED' | 'FORBIDDEN' | 'NOT_FOUND' | 'METHOD_NOT_SUPPORTED' | 'CONFLICT' | 'UNPROCESSABLE_CONTENT' | 'TOO_MANY_REQUESTS' | 'INTERNAL_SERVER_ERROR' | 'UNKNOWN';
276
+ /** HTTP client error */
277
+ declare class HttpClientError extends Error {
278
+ readonly name = "HttpClientError";
279
+ readonly code: HttpErrorCode;
280
+ readonly status: number;
281
+ readonly procedureName: string;
282
+ constructor(opts: {
283
+ code: HttpErrorCode;
284
+ status: number;
285
+ procedureName: string;
286
+ message?: string;
287
+ });
288
+ }
289
+ /** Type guard for HttpClientError */
290
+ declare const isHttpClientError: (error: unknown) => error is HttpClientError;
291
+ //#endregion
292
+ export { DataTransformer as A, HttpProcedure as C, ProcedureMeta as D, InferHttpInput$1 as E, decodeWire as F, defaultCRPCTransformer as I, encodeWire as L, WireCodec as M, createTaggedTransformer as N, CombinedDataTransformer as O, dateWireCodec as P, getTransformer as R, HttpMethod as S, HttpRouteDefinition as T, extractRouteMap as _, HttpProcedureCall as a, HttpActionHandler as b, InferHttpInput as c, CRPCHttpRouter as d, HttpRouterDef as f, createHttpRouterFactory as g, createHttpRouter as h, HttpErrorCode as i, DataTransformerOptions as j, DATE_CODEC_TAG as k, InferHttpOutput as l, HttpRouterWithHono as m, HttpClientError as n, HttpRouteInfo as o, HttpRouterRecord as p, HttpClientFromRouter as r, HttpRouteMap as s, HttpClient as t, isHttpClientError as u, CRPCHonoHandler as v, HttpProcedureBuilderDef as w, HttpHandlerOpts as x, HttpActionConstructor as y, identityTransformer as z };