kitcn 0.12.27 → 0.13.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 (73) hide show
  1. package/dist/aggregate/index.d.ts +1 -1
  2. package/dist/aggregate/index.js +1 -1
  3. package/dist/auth/client/index.d.ts +312 -4
  4. package/dist/auth/client/index.js +17 -5
  5. package/dist/auth/config/index.d.ts +1 -1
  6. package/dist/auth/generated/index.d.ts +1 -1
  7. package/dist/auth/generated/index.js +1 -1
  8. package/dist/auth/http/index.d.ts +12 -9
  9. package/dist/auth/http/index.js +35 -6
  10. package/dist/auth/index.d.ts +292 -8
  11. package/dist/auth/index.js +29 -23
  12. package/dist/auth/nextjs/index.d.ts +4 -3
  13. package/dist/auth/nextjs/index.js +9 -4
  14. package/dist/auth/start/index.d.ts +13 -3
  15. package/dist/auth/start/index.js +97 -8
  16. package/dist/{backend-core-DqCCa0nr.mjs → backend-core-yq-eWLRJ.mjs} +140 -54
  17. package/dist/{builder-Cb6gloDB.js → builder-DBgto1yn.js} +4 -3
  18. package/dist/{caller-factory-cTXNvYdz.js → caller-factory-NEfgD5E0.js} +3 -3
  19. package/dist/cli.mjs +26 -26
  20. package/dist/convex-plugin-C3N9BB-J.js +275 -0
  21. package/dist/convex-plugin-tWTDqoKJ.mjs +276 -0
  22. package/dist/{create-schema-orm-DOyiNDCx.js → create-schema-orm-B3f2Kc8O.js} +1 -1
  23. package/dist/crpc/index.d.ts +2 -2
  24. package/dist/crpc/index.js +3 -3
  25. package/dist/{customFunctions-C0voKmtx.js → customFunctions-DxEEO4Dq.js} +2 -1
  26. package/dist/{generated-contract-disabled-21YxPk5W.d.ts → generated-contract-disabled-C_-KWRfT.d.ts} +4 -2
  27. package/dist/{http-types-BLFA9zS7.d.ts → http-types-zsMHb_QN.d.ts} +2 -2
  28. package/dist/{middleware-DkIhQXwg.js → middleware-Bg-PdtrI.js} +1 -1
  29. package/dist/{middleware-nS_qXecO.d.ts → middleware-DrtexzF3.d.ts} +1 -1
  30. package/dist/orm/index.d.ts +3 -3
  31. package/dist/orm/index.js +3 -3
  32. package/dist/plugins/index.d.ts +1 -1
  33. package/dist/plugins/index.js +1 -1
  34. package/dist/{procedure-caller-AjLfkHyF.js → procedure-caller-DplSC7Us.js} +2 -2
  35. package/dist/{procedure-name-D-fDCBlo.d.ts → procedure-name-BCRBr6Po.d.ts} +3 -3
  36. package/dist/ratelimit/index.d.ts +2 -2
  37. package/dist/ratelimit/index.js +3 -3
  38. package/dist/react/index.d.ts +18 -14
  39. package/dist/react/index.js +14 -27
  40. package/dist/rsc/index.d.ts +4 -4
  41. package/dist/rsc/index.js +4 -4
  42. package/dist/{runtime-CtvJPkur.js → runtime-i6t-HoZn.js} +1 -1
  43. package/dist/server/index.d.ts +4 -4
  44. package/dist/server/index.js +4 -4
  45. package/dist/solid/index.d.ts +300 -4
  46. package/dist/token-B9Bjcqug.d.ts +13 -0
  47. package/dist/token-tpipF-7y.js +47 -0
  48. package/dist/{types-C6pQrnzD.d.ts → types-YHpe0rsb.d.ts} +1 -1
  49. package/dist/upstream-BR6sBLg3.js +84 -0
  50. package/dist/upstream-BUCdbLok.mjs +26 -0
  51. package/dist/{validators-B7oIJCAp.js → validators-C7LelqTN.js} +2 -84
  52. package/dist/watcher.mjs +1 -1
  53. package/dist/{where-clause-compiler-DdjN63Io.d.ts → where-clause-compiler-TMppDl9g.d.ts} +51 -51
  54. package/package.json +5 -4
  55. package/skills/convex/references/features/auth.md +20 -0
  56. package/skills/convex/references/features/orm.md +9 -0
  57. package/skills/convex/references/setup/auth.md +2 -0
  58. package/skills/convex/references/setup/index.md +5 -5
  59. package/skills/convex/references/setup/server.md +1 -1
  60. /package/dist/{api-entry-BUAh_K4k.js → api-entry-N3nBOlI2.js} +0 -0
  61. /package/dist/{context-utils-BvWW0Ilq.d.ts → context-utils-OMkMGhBk.d.ts} +0 -0
  62. /package/dist/{create-schema-odyF4kCy.js → create-schema-BXrKE2YY.js} +0 -0
  63. /package/dist/{error-BZEnI7Sq.js → error-Bvo7YEhk.js} +0 -0
  64. /package/dist/{generated-contract-disabled-Cih4eITO.js → generated-contract-disabled-BXaz7JCE.js} +0 -0
  65. /package/dist/{meta-utils-0Pu0Nrap.js → meta-utils-D9K4fICl.js} +0 -0
  66. /package/dist/{query-context-CFZqIvD7.d.ts → query-context-CNo9ffvI.d.ts} +0 -0
  67. /package/dist/{query-context-B8o6-8kC.js → query-context-ydn9kb6P.js} +0 -0
  68. /package/dist/{query-options-Dw7cOyXl.js → query-options-C96zLANM.js} +0 -0
  69. /package/dist/{transformer-DtDhR3Lc.js → transformer-C6pGVHqx.js} +0 -0
  70. /package/dist/{types-BiJE7qxR.d.ts → types-BCl8gfGy.d.ts} +0 -0
  71. /package/dist/{types-a-RHmrDZ.d.ts → types-CnTpHR1F.d.ts} +0 -0
  72. /package/dist/{types-BTb_4BaU.d.ts → types-DF2cg_w0.d.ts} +0 -0
  73. /package/dist/{validators-vzRKjBJC.d.ts → validators-BhsByJeg.d.ts} +0 -0
@@ -1,16 +1,19 @@
1
- import { a as QueryCtxWithPreferredOrmQueryTable, n as LookupByIdResultByCtx, t as DocByCtx } from "../query-context-CFZqIvD7.js";
2
- import { t as GetAuth } from "../types-BiJE7qxR.js";
3
- import { t as GenericCtx } from "../context-utils-BvWW0Ilq.js";
4
- import { S as defineAuth, _ as GenericAuthBeforeResult, a as AuthFunctions, b as GenericAuthTriggerHandlers, c as createApi, d as deleteOneHandler, f as findManyHandler, g as BetterAuthOptionsWithoutDatabase, h as updateOneHandler, i as getGeneratedAuthDisabledReason, l as createHandler, m as updateManyHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as findOneHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as deleteManyHandler, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../generated-contract-disabled-21YxPk5W.js";
1
+ import { a as QueryCtxWithPreferredOrmQueryTable, n as LookupByIdResultByCtx, t as DocByCtx } from "../query-context-CNo9ffvI.js";
2
+ import { t as GetAuth } from "../types-BCl8gfGy.js";
3
+ import { t as GenericCtx } from "../context-utils-OMkMGhBk.js";
4
+ import { S as defineAuth, _ as GenericAuthBeforeResult, a as AuthFunctions, b as GenericAuthTriggerHandlers, c as createApi, d as deleteOneHandler, f as findManyHandler, g as BetterAuthOptionsWithoutDatabase, h as updateOneHandler, i as getGeneratedAuthDisabledReason, l as createHandler, m as updateManyHandler, n as GeneratedAuthDisabledReasonKind, o as Triggers, p as findOneHandler, r as createDisabledAuthRuntime, s as createClient, t as AuthRuntime, u as deleteManyHandler, v as GenericAuthDefinition, x as GenericAuthTriggers, y as GenericAuthTriggerChange } from "../generated-contract-disabled-C_-KWRfT.js";
5
5
  import * as convex_values0 from "convex/values";
6
6
  import { Infer } from "convex/values";
7
- import { DocumentByName, GenericDataModel, GenericMutationCtx, GenericQueryCtx, GenericSchema, PaginationOptions, PaginationResult, SchemaDefinition, TableNamesInDataModel } from "convex/server";
8
- import { convex } from "@convex-dev/better-auth/plugins";
7
+ import { AuthConfig, DocumentByName, GenericDataModel, GenericMutationCtx, GenericQueryCtx, GenericSchema, PaginationOptions, PaginationResult, SchemaDefinition, TableNamesInDataModel } from "convex/server";
9
8
  import * as better_auth_adapters0 from "better-auth/adapters";
10
9
  import { DBAdapterDebugLogOption } from "better-auth/adapters";
11
10
  import { BetterAuthDBSchema } from "better-auth/db";
12
11
  import { BetterAuthOptions } from "better-auth/minimal";
12
+ import * as better_auth_api0 from "better-auth/api";
13
+ import * as better_auth_plugins_oidc_provider0 from "better-auth/plugins/oidc-provider";
14
+ import * as jose from "jose";
13
15
  import * as better_auth0 from "better-auth";
16
+ import { Session, User } from "better-auth";
14
17
  import { Where } from "better-auth/types";
15
18
  import { SetOptional } from "type-fest";
16
19
 
@@ -103,6 +106,7 @@ type AdapterPaginationOptions = PaginationOptions & {
103
106
  maximumRowsRead?: number;
104
107
  };
105
108
  declare const adapterWhereValidator: convex_values0.VObject<{
109
+ mode?: "sensitive" | "insensitive" | undefined;
106
110
  connector?: "AND" | "OR" | undefined;
107
111
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
108
112
  value: string | number | boolean | string[] | number[] | null;
@@ -110,12 +114,14 @@ declare const adapterWhereValidator: convex_values0.VObject<{
110
114
  }, {
111
115
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
112
116
  field: convex_values0.VString<string, "required">;
117
+ mode: convex_values0.VUnion<"sensitive" | "insensitive" | undefined, [convex_values0.VLiteral<"sensitive", "required">, convex_values0.VLiteral<"insensitive", "required">], "optional", never>;
113
118
  operator: convex_values0.VUnion<"lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
114
119
  value: convex_values0.VUnion<string | number | boolean | string[] | number[] | null, [convex_values0.VString<string, "required">, convex_values0.VFloat64<number, "required">, convex_values0.VBoolean<boolean, "required">, convex_values0.VArray<string[], convex_values0.VString<string, "required">, "required">, convex_values0.VArray<number[], convex_values0.VFloat64<number, "required">, "required">, convex_values0.VNull<null, "required">], "required", never>;
115
- }, "required", "value" | "connector" | "field" | "operator">;
120
+ }, "required", "mode" | "value" | "connector" | "field" | "operator">;
116
121
  declare const adapterArgsValidator: convex_values0.VObject<{
117
122
  select?: string[] | undefined;
118
123
  where?: {
124
+ mode?: "sensitive" | "insensitive" | undefined;
119
125
  connector?: "AND" | "OR" | undefined;
120
126
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
121
127
  value: string | number | boolean | string[] | number[] | null;
@@ -141,11 +147,13 @@ declare const adapterArgsValidator: convex_values0.VObject<{
141
147
  field: convex_values0.VString<string, "required">;
142
148
  }, "optional", "field" | "direction">;
143
149
  where: convex_values0.VArray<{
150
+ mode?: "sensitive" | "insensitive" | undefined;
144
151
  connector?: "AND" | "OR" | undefined;
145
152
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
146
153
  value: string | number | boolean | string[] | number[] | null;
147
154
  field: string;
148
155
  }[] | undefined, convex_values0.VObject<{
156
+ mode?: "sensitive" | "insensitive" | undefined;
149
157
  connector?: "AND" | "OR" | undefined;
150
158
  operator?: "lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
151
159
  value: string | number | boolean | string[] | number[] | null;
@@ -153,9 +161,10 @@ declare const adapterArgsValidator: convex_values0.VObject<{
153
161
  }, {
154
162
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
155
163
  field: convex_values0.VString<string, "required">;
164
+ mode: convex_values0.VUnion<"sensitive" | "insensitive" | undefined, [convex_values0.VLiteral<"sensitive", "required">, convex_values0.VLiteral<"insensitive", "required">], "optional", never>;
156
165
  operator: convex_values0.VUnion<"lt" | "lte" | "gt" | "gte" | "eq" | "in" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined, [convex_values0.VLiteral<"lt", "required">, convex_values0.VLiteral<"lte", "required">, convex_values0.VLiteral<"gt", "required">, convex_values0.VLiteral<"gte", "required">, convex_values0.VLiteral<"eq", "required">, convex_values0.VLiteral<"in", "required">, convex_values0.VLiteral<"not_in", "required">, convex_values0.VLiteral<"ne", "required">, convex_values0.VLiteral<"contains", "required">, convex_values0.VLiteral<"starts_with", "required">, convex_values0.VLiteral<"ends_with", "required">], "optional", never>;
157
166
  value: convex_values0.VUnion<string | number | boolean | string[] | number[] | null, [convex_values0.VString<string, "required">, convex_values0.VFloat64<number, "required">, convex_values0.VBoolean<boolean, "required">, convex_values0.VArray<string[], convex_values0.VString<string, "required">, "required">, convex_values0.VArray<number[], convex_values0.VFloat64<number, "required">, "required">, convex_values0.VNull<null, "required">], "required", never>;
158
- }, "required", "value" | "connector" | "field" | "operator">, "optional">;
167
+ }, "required", "mode" | "value" | "connector" | "field" | "operator">, "optional">;
159
168
  }, "required", "model" | "select" | "where" | "limit" | "offset" | "sortBy" | "sortBy.field" | "sortBy.direction">;
160
169
  declare const hasUniqueFields: (betterAuthSchema: BetterAuthDBSchema, model: string, input: Record<string, any>) => boolean;
161
170
  declare const checkUniqueFields: <Schema extends SchemaDefinition<any, any>>(ctx: GenericQueryCtx<GenericDataModel>, schema: Schema, betterAuthSchema: BetterAuthDBSchema, table: string, input: Record<string, any>, doc?: Record<string, any>) => Promise<void>;
@@ -218,4 +227,279 @@ declare function getSession<TCtx extends GenericQueryCtx<any>>(ctx: TCtx & Sessi
218
227
  declare const getSessionNetworkSignals: <TCtx extends GenericQueryCtx<any>>(ctx: TCtx & QueryCtxWithPreferredOrmQueryTable<TCtx, "session">, session?: SessionResult<TCtx> | null) => Promise<SessionClientSignals>;
219
228
  declare const getHeaders: <TCtx extends GenericQueryCtx<any>>(ctx: TCtx & QueryCtxWithPreferredOrmQueryTable<TCtx, "session">, session?: SessionResult<TCtx> | null) => Promise<Headers>;
220
229
  //#endregion
230
+ //#region src/auth/internal/convex-plugin.d.ts
231
+ declare const convex: (opts: {
232
+ authConfig: AuthConfig;
233
+ jwks?: string;
234
+ jwksRotateOnTokenGenerationError?: boolean;
235
+ jwt?: {
236
+ definePayload?: (session: {
237
+ session: Session & Record<string, any>;
238
+ user: User & Record<string, any>;
239
+ }) => Promise<Record<string, any>> | Record<string, any> | undefined;
240
+ expirationSeconds?: number;
241
+ };
242
+ /**
243
+ * @deprecated Use jwt.expirationSeconds instead.
244
+ */
245
+ jwtExpirationSeconds?: number;
246
+ options?: BetterAuthOptions;
247
+ }) => {
248
+ id: "convex";
249
+ init: (ctx: better_auth0.AuthContext) => void;
250
+ hooks: {
251
+ before: ({
252
+ matcher(context: better_auth0.HookEndpointContext): boolean;
253
+ handler: (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
254
+ context: {
255
+ headers: Headers;
256
+ };
257
+ } | undefined>;
258
+ } | {
259
+ matcher: (ctx: better_auth0.HookEndpointContext) => boolean;
260
+ handler: (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
261
+ context: better_auth0.MiddlewareContext<better_auth0.MiddlewareOptions, {
262
+ returned?: unknown | undefined;
263
+ responseHeaders?: Headers | undefined;
264
+ } & better_auth0.PluginContext<BetterAuthOptions> & better_auth0.InfoContext & {
265
+ options: BetterAuthOptions;
266
+ trustedOrigins: string[];
267
+ trustedProviders: string[];
268
+ isTrustedOrigin: (url: string, settings?: {
269
+ allowRelativePaths: boolean;
270
+ }) => boolean;
271
+ oauthConfig: {
272
+ skipStateCookieCheck?: boolean | undefined;
273
+ storeStateStrategy: "database" | "cookie";
274
+ };
275
+ newSession: {
276
+ session: {
277
+ id: string;
278
+ createdAt: Date;
279
+ updatedAt: Date;
280
+ userId: string;
281
+ expiresAt: Date;
282
+ token: string;
283
+ ipAddress?: string | null | undefined;
284
+ userAgent?: string | null | undefined;
285
+ } & Record<string, any>;
286
+ user: {
287
+ id: string;
288
+ createdAt: Date;
289
+ updatedAt: Date;
290
+ email: string;
291
+ emailVerified: boolean;
292
+ name: string;
293
+ image?: string | null | undefined;
294
+ } & Record<string, any>;
295
+ } | null;
296
+ session: {
297
+ session: {
298
+ id: string;
299
+ createdAt: Date;
300
+ updatedAt: Date;
301
+ userId: string;
302
+ expiresAt: Date;
303
+ token: string;
304
+ ipAddress?: string | null | undefined;
305
+ userAgent?: string | null | undefined;
306
+ } & Record<string, any>;
307
+ user: {
308
+ id: string;
309
+ createdAt: Date;
310
+ updatedAt: Date;
311
+ email: string;
312
+ emailVerified: boolean;
313
+ name: string;
314
+ image?: string | null | undefined;
315
+ } & Record<string, any>;
316
+ } | null;
317
+ setNewSession: (session: {
318
+ session: {
319
+ id: string;
320
+ createdAt: Date;
321
+ updatedAt: Date;
322
+ userId: string;
323
+ expiresAt: Date;
324
+ token: string;
325
+ ipAddress?: string | null | undefined;
326
+ userAgent?: string | null | undefined;
327
+ } & Record<string, any>;
328
+ user: {
329
+ id: string;
330
+ createdAt: Date;
331
+ updatedAt: Date;
332
+ email: string;
333
+ emailVerified: boolean;
334
+ name: string;
335
+ image?: string | null | undefined;
336
+ } & Record<string, any>;
337
+ } | null) => void;
338
+ socialProviders: better_auth0.OAuthProvider[];
339
+ authCookies: better_auth0.BetterAuthCookies;
340
+ logger: ReturnType<(options?: better_auth0.Logger | undefined) => better_auth0.InternalLogger>;
341
+ rateLimit: {
342
+ enabled: boolean;
343
+ window: number;
344
+ max: number;
345
+ storage: "memory" | "database" | "secondary-storage";
346
+ } & Omit<better_auth0.BetterAuthRateLimitOptions, "enabled" | "window" | "max" | "storage">;
347
+ adapter: better_auth0.DBAdapter<BetterAuthOptions>;
348
+ internalAdapter: better_auth0.InternalAdapter<BetterAuthOptions>;
349
+ createAuthCookie: (cookieName: string, overrideAttributes?: Partial<better_auth0.CookieOptions> | undefined) => better_auth0.BetterAuthCookie;
350
+ secret: string;
351
+ secretConfig: string | better_auth0.SecretConfig;
352
+ sessionConfig: {
353
+ updateAge: number;
354
+ expiresIn: number;
355
+ freshAge: number;
356
+ cookieRefreshCache: false | {
357
+ enabled: true;
358
+ updateAge: number;
359
+ };
360
+ };
361
+ generateId: (options: {
362
+ model: better_auth0.ModelNames;
363
+ size?: number | undefined;
364
+ }) => string | false;
365
+ secondaryStorage: better_auth0.SecondaryStorage | undefined;
366
+ password: {
367
+ hash: (password: string) => Promise<string>;
368
+ verify: (data: {
369
+ password: string;
370
+ hash: string;
371
+ }) => Promise<boolean>;
372
+ config: {
373
+ minPasswordLength: number;
374
+ maxPasswordLength: number;
375
+ };
376
+ checkPassword: (userId: string, ctx: better_auth0.GenericEndpointContext<BetterAuthOptions>) => Promise<boolean>;
377
+ };
378
+ tables: better_auth0.BetterAuthDBSchema;
379
+ runMigrations: () => Promise<void>;
380
+ publishTelemetry: (event: {
381
+ type: string;
382
+ anonymousId?: string | undefined;
383
+ payload: Record<string, any>;
384
+ }) => Promise<void>;
385
+ skipOriginCheck: boolean | string[];
386
+ skipCSRFCheck: boolean;
387
+ runInBackground: (promise: Promise<unknown>) => void;
388
+ runInBackgroundOrAwait: (promise: Promise<unknown> | void) => better_auth0.Awaitable<unknown>;
389
+ }>;
390
+ }>;
391
+ })[];
392
+ after: {
393
+ matcher: (context: better_auth0.HookEndpointContext) => boolean;
394
+ handler: better_auth_api0.AuthMiddleware;
395
+ }[];
396
+ };
397
+ endpoints: {
398
+ getOpenIdConfig: better_auth0.StrictEndpoint<"/convex/.well-known/openid-configuration", {
399
+ method: "GET";
400
+ metadata: {
401
+ isAction: false;
402
+ };
403
+ }, better_auth_plugins_oidc_provider0.OIDCMetadata>;
404
+ getJwks: better_auth0.StrictEndpoint<"/convex/jwks", {
405
+ method: "GET";
406
+ metadata: {
407
+ openapi: {
408
+ description: string;
409
+ responses: {
410
+ '200': {
411
+ description: string;
412
+ };
413
+ };
414
+ };
415
+ };
416
+ }, jose.JSONWebKeySet>;
417
+ getLatestJwks: better_auth0.StrictEndpoint<"/convex/latest-jwks", {
418
+ isAction: boolean;
419
+ method: "POST";
420
+ metadata: {
421
+ SERVER_ONLY: true;
422
+ openapi: {
423
+ description: string;
424
+ };
425
+ };
426
+ }, any[]>;
427
+ rotateKeys: better_auth0.StrictEndpoint<"/convex/rotate-keys", {
428
+ isAction: boolean;
429
+ method: "POST";
430
+ metadata: {
431
+ SERVER_ONLY: true;
432
+ openapi: {
433
+ description: string;
434
+ };
435
+ };
436
+ }, any[]>;
437
+ getToken: better_auth0.StrictEndpoint<"/convex/token", {
438
+ method: "GET";
439
+ requireHeaders: true;
440
+ use: ((inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<{
441
+ session: {
442
+ session: Record<string, any> & {
443
+ id: string;
444
+ createdAt: Date;
445
+ updatedAt: Date;
446
+ userId: string;
447
+ expiresAt: Date;
448
+ token: string;
449
+ ipAddress?: string | null | undefined;
450
+ userAgent?: string | null | undefined;
451
+ };
452
+ user: Record<string, any> & {
453
+ id: string;
454
+ createdAt: Date;
455
+ updatedAt: Date;
456
+ email: string;
457
+ emailVerified: boolean;
458
+ name: string;
459
+ image?: string | null | undefined;
460
+ };
461
+ };
462
+ }>)[];
463
+ metadata: {
464
+ openapi: {
465
+ description: string;
466
+ };
467
+ };
468
+ }, {
469
+ token: string;
470
+ }>;
471
+ };
472
+ schema: {
473
+ jwks: {
474
+ fields: {
475
+ publicKey: {
476
+ type: "string";
477
+ required: true;
478
+ };
479
+ privateKey: {
480
+ type: "string";
481
+ required: true;
482
+ };
483
+ createdAt: {
484
+ type: "date";
485
+ required: true;
486
+ };
487
+ expiresAt: {
488
+ type: "date";
489
+ required: false;
490
+ };
491
+ };
492
+ };
493
+ user: {
494
+ readonly fields: {
495
+ readonly userId: {
496
+ readonly type: "string";
497
+ readonly required: false;
498
+ readonly input: false;
499
+ };
500
+ };
501
+ };
502
+ };
503
+ };
504
+ //#endregion
221
505
  export { type AuthFunctions, type AuthRuntime, BetterAuthOptionsWithoutDatabase, ConvexCleanedWhere, type GeneratedAuthDisabledReasonKind, GenericAuthBeforeResult, GenericAuthDefinition, GenericAuthTriggerChange, GenericAuthTriggerHandlers, GenericAuthTriggers, GetAuth, SessionClientSignals, type Triggers, adapterArgsValidator, adapterConfig, adapterWhereValidator, checkUniqueFields, convex, createApi, createAuthRuntime, createClient, createDisabledAuthRuntime, createHandler, dbAdapter, defineAuth, deleteManyHandler, deleteOneHandler, findManyHandler, findOneHandler, getAuthUserId, getAuthUserIdentity, getGeneratedAuthDisabledReason, getHeaders, getInvalidAuthDefinitionExportReason, getSession, getSessionNetworkSignals, handlePagination, hasUniqueFields, httpAdapter, listOne, paginate, resolveGeneratedAuthDefinition, selectFields, updateManyHandler, updateOneHandler };
@@ -1,11 +1,12 @@
1
- import { r as partial, s as asyncMap } from "../validators-B7oIJCAp.js";
2
- import { i as defineAuth, n as createDisabledAuthRuntime, r as getGeneratedAuthDisabledReason, t as DEFAULT_AUTH_DEFINITION_PATH } from "../generated-contract-disabled-Cih4eITO.js";
3
- import { n as createGeneratedFunctionReference, o as isQueryCtx, s as isRunMutationCtx } from "../api-entry-BUAh_K4k.js";
4
- import { n as customCtx, r as customMutation } from "../customFunctions-C0voKmtx.js";
5
- import { a as mergedStream, l as unsetToken, o as stream, t as getByIdWithOrmQueryFallback, v as eq } from "../query-context-B8o6-8kC.js";
1
+ import { n as asyncMap } from "../upstream-BR6sBLg3.js";
2
+ import { r as partial } from "../validators-C7LelqTN.js";
3
+ import { i as defineAuth, n as createDisabledAuthRuntime, r as getGeneratedAuthDisabledReason, t as DEFAULT_AUTH_DEFINITION_PATH } from "../generated-contract-disabled-BXaz7JCE.js";
4
+ import { n as createGeneratedFunctionReference, o as isQueryCtx, s as isRunMutationCtx } from "../api-entry-N3nBOlI2.js";
5
+ import { n as customCtx, r as customMutation } from "../customFunctions-DxEEO4Dq.js";
6
+ import { a as mergedStream, l as unsetToken, o as stream, t as getByIdWithOrmQueryFallback, v as eq } from "../query-context-ydn9kb6P.js";
7
+ import { n as convex } from "../convex-plugin-C3N9BB-J.js";
6
8
  import { v } from "convex/values";
7
9
  import { internalActionGeneric, internalMutationGeneric, internalQueryGeneric, paginationOptsValidator } from "convex/server";
8
- import { convex } from "@convex-dev/better-auth/plugins";
9
10
  import { createAdapterFactory } from "better-auth/adapters";
10
11
  import { getAuthTables } from "better-auth/db";
11
12
  import { prop, sortBy } from "remeda";
@@ -16,6 +17,7 @@ import { betterAuth } from "better-auth/minimal";
16
17
  const adapterWhereValidator = v.object({
17
18
  connector: v.optional(v.union(v.literal("AND"), v.literal("OR"))),
18
19
  field: v.string(),
20
+ mode: v.optional(v.union(v.literal("sensitive"), v.literal("insensitive"))),
19
21
  operator: v.optional(v.union(v.literal("lt"), v.literal("lte"), v.literal("gt"), v.literal("gte"), v.literal("eq"), v.literal("in"), v.literal("not_in"), v.literal("ne"), v.literal("contains"), v.literal("starts_with"), v.literal("ends_with"))),
20
22
  value: v.union(v.string(), v.number(), v.boolean(), v.array(v.string()), v.array(v.number()), v.null())
21
23
  });
@@ -41,7 +43,7 @@ const hasUniqueFields = (betterAuthSchema, model, input) => {
41
43
  };
42
44
  const findIndex = (schema, args) => {
43
45
  if ((args.where?.length ?? 0) > 1 && args.where?.some((w) => w.connector === "OR")) throw new Error(`OR connector not supported with multiple where statements in findIndex, split up the where statements before calling findIndex: ${JSON.stringify(args.where)}`);
44
- const where = args.where?.filter((w) => (!w.operator || [
46
+ const where = args.where?.filter((w) => w.mode !== "insensitive" && (!w.operator || [
45
47
  "eq",
46
48
  "gt",
47
49
  "gte",
@@ -66,7 +68,7 @@ const findIndex = (schema, args) => {
66
68
  if (!table) throw new Error(`Table ${args.model} not found`);
67
69
  const indexes = table[" indexes"] ? table[" indexes"]() : table.export().indexes;
68
70
  const sortField = args.sortBy?.field;
69
- const indexFields = indexEqFields.map(([field]) => field).concat(boundField && boundField !== "createdAt" ? `${indexEqFields.length > 0 ? "_" : ""}${boundField}` : "").concat(sortField && sortField !== "createdAt" && boundField !== sortField ? `${indexEqFields.length > 0 || boundField ? "_" : ""}${sortField}` : "").filter(Boolean);
71
+ const indexFields = indexEqFields.map(([field]) => field).concat(boundField && boundField !== "createdAt" ? boundField : "").concat(sortField && sortField !== "createdAt" && boundField !== sortField ? sortField : "").filter(Boolean);
70
72
  if (indexFields.length === 0 && !boundField && !sortField) return;
71
73
  const index = indexFields.length === 0 ? {
72
74
  fields: [],
@@ -124,30 +126,34 @@ const filterByWhere = (doc, where, filterWhere) => {
124
126
  for (const w of where ?? []) {
125
127
  if (filterWhere && !filterWhere(w)) continue;
126
128
  const value = doc[w.field];
129
+ const normalizeString = (input) => w.mode === "insensitive" ? input.toLowerCase() : input;
130
+ const normalizeComparable = (input) => typeof input === "string" ? normalizeString(input) : input;
127
131
  const isLessThan = (val, wVal) => {
128
132
  if (wVal === void 0 || wVal === null) return false;
129
133
  if (val === void 0 || val === null) return true;
130
- return val < wVal;
134
+ return normalizeComparable(val) < normalizeComparable(wVal);
131
135
  };
132
136
  const isGreaterThan = (val, wVal) => {
133
137
  if (val === void 0 || val === null) return false;
134
138
  if (wVal === void 0 || wVal === null) return true;
135
- return val > wVal;
139
+ return normalizeComparable(val) > normalizeComparable(wVal);
136
140
  };
137
141
  const filter = (w) => {
142
+ const comparableValue = normalizeComparable(value);
143
+ const comparableWhereValue = normalizeComparable(w.value);
138
144
  switch (w.operator) {
139
- case "contains": return typeof value === "string" && value.includes(w.value);
140
- case "ends_with": return typeof value === "string" && value.endsWith(w.value);
145
+ case "contains": return typeof comparableValue === "string" && typeof comparableWhereValue === "string" && comparableValue.includes(comparableWhereValue);
146
+ case "ends_with": return typeof comparableValue === "string" && typeof comparableWhereValue === "string" && comparableValue.endsWith(comparableWhereValue);
141
147
  case "eq":
142
- case void 0: return value === w.value;
148
+ case void 0: return comparableValue === comparableWhereValue;
143
149
  case "gt": return isGreaterThan(value, w.value);
144
- case "gte": return value === w.value || isGreaterThan(value, w.value);
145
- case "in": return Array.isArray(w.value) && w.value.includes(value);
150
+ case "gte": return comparableValue === comparableWhereValue || isGreaterThan(value, w.value);
151
+ case "in": return Array.isArray(w.value) && w.value.some((candidate) => normalizeComparable(candidate) === comparableValue);
146
152
  case "lt": return isLessThan(value, w.value);
147
- case "lte": return value === w.value || isLessThan(value, w.value);
148
- case "ne": return value !== w.value;
149
- case "not_in": return Array.isArray(w.value) && !w.value.includes(value);
150
- case "starts_with": return typeof value === "string" && value.startsWith(w.value);
153
+ case "lte": return comparableValue === comparableWhereValue || isLessThan(value, w.value);
154
+ case "ne": return comparableValue !== comparableWhereValue;
155
+ case "not_in": return Array.isArray(w.value) && !w.value.some((candidate) => normalizeComparable(candidate) === comparableValue);
156
+ case "starts_with": return typeof comparableValue === "string" && typeof comparableWhereValue === "string" && comparableValue.startsWith(comparableWhereValue);
151
157
  }
152
158
  };
153
159
  if (!filter(w)) return false;
@@ -177,7 +183,7 @@ const generateQuery = (ctx, schema, args) => {
177
183
  `);
178
184
  return orderedQuery.filterWith(async (doc) => {
179
185
  if (!usableIndex) return filterByWhere(doc, args.where);
180
- return filterByWhere(doc, args.where, (w) => w.operator && [
186
+ return filterByWhere(doc, args.where, (w) => w.mode === "insensitive" || w.operator && [
181
187
  "contains",
182
188
  "ends_with",
183
189
  "ne",
@@ -195,7 +201,7 @@ const paginate = async (ctx, schema, betterAuthSchema, args) => {
195
201
  "ne",
196
202
  "not_in"
197
203
  ].includes(w.operator))) throw new Error(`id can only be used with eq, in, not_in, or ne operator: ${JSON.stringify(args.where)}`);
198
- const uniqueWhere = args.where?.find((w) => (!w.operator || w.operator === "eq") && (isUniqueField(betterAuthSchema, args.model, w.field) || w.field === "_id"));
204
+ const uniqueWhere = args.where?.find((w) => w.mode !== "insensitive" && (!w.operator || w.operator === "eq") && (isUniqueField(betterAuthSchema, args.model, w.field) || w.field === "_id"));
199
205
  if (uniqueWhere) {
200
206
  const { index } = findIndex(schema, {
201
207
  model: args.model,
@@ -813,13 +819,13 @@ const ORM_SCHEMA_OPTIONS = Symbol.for("kitcn:OrmSchemaOptions");
813
819
  const hasOrmSchemaMetadata = (schema) => !!schema && typeof schema === "object" && ORM_SCHEMA_OPTIONS in schema;
814
820
  const createAuthSchema = async ({ file, schema, tables }) => {
815
821
  if (hasOrmSchemaMetadata(schema)) {
816
- const { createSchemaOrm } = await import("../create-schema-orm-DOyiNDCx.js");
822
+ const { createSchemaOrm } = await import("../create-schema-orm-B3f2Kc8O.js");
817
823
  return createSchemaOrm({
818
824
  file,
819
825
  tables
820
826
  });
821
827
  }
822
- const { createSchema } = await import("../create-schema-odyF4kCy.js");
828
+ const { createSchema } = await import("../create-schema-BXrKE2YY.js");
823
829
  return createSchema({
824
830
  file,
825
831
  tables
@@ -1,10 +1,11 @@
1
- import { U as LazyCaller, V as ConvexContext } from "../../procedure-name-D-fDCBlo.js";
2
- import { GetTokenOptions } from "@convex-dev/better-auth/utils";
1
+ import { U as LazyCaller, V as ConvexContext } from "../../procedure-name-BCRBr6Po.js";
2
+ import { t as GetTokenOptions } from "../../token-B9Bjcqug.js";
3
3
 
4
4
  //#region src/auth-nextjs/index.d.ts
5
5
  /** Auth options for server-side calls. */
6
6
  type AuthOptions = {
7
- /** Enable/disable JWT caching. Default: true */jwtCache?: boolean; /** Custom function to detect UNAUTHORIZED errors. Default checks code property. */
7
+ /** Better Auth auth route base path. Defaults to `/api/auth`. */basePath?: string; /** Enable/disable JWT caching. Default: true */
8
+ jwtCache?: boolean; /** Custom function to detect UNAUTHORIZED errors. Default checks code property. */
8
9
  isUnauthorized?: (error: unknown) => boolean; /** Expiration tolerance in seconds. */
9
10
  expirationToleranceSeconds?: number;
10
11
  };
@@ -1,19 +1,23 @@
1
- import { n as defaultIsUnauthorized } from "../../error-BZEnI7Sq.js";
2
- import { t as createCallerFactory } from "../../caller-factory-cTXNvYdz.js";
3
- import { getToken } from "@convex-dev/better-auth/utils";
1
+ import { t as getToken } from "../../token-tpipF-7y.js";
2
+ import { n as defaultIsUnauthorized } from "../../error-Bvo7YEhk.js";
3
+ import { t as createCallerFactory } from "../../caller-factory-NEfgD5E0.js";
4
4
 
5
5
  //#region src/auth-nextjs/index.ts
6
6
  /** biome-ignore-all lint/suspicious/noExplicitAny: lib */
7
7
  /**
8
8
  * Next.js + Better Auth wrapper for Convex caller factory.
9
- * Uses @convex-dev/better-auth for token management.
10
9
  */
10
+ const TRAILING_COLON_RE = /:$/;
11
11
  const handler = async (request, siteUrl) => {
12
12
  const requestUrl = new URL(request.url);
13
13
  const nextUrl = `${siteUrl}${requestUrl.pathname}${requestUrl.search}`;
14
14
  const headers = new Headers(request.headers);
15
15
  headers.set("accept-encoding", "application/json");
16
16
  headers.set("host", new URL(siteUrl).host);
17
+ headers.set("x-forwarded-host", requestUrl.host);
18
+ headers.set("x-forwarded-proto", requestUrl.protocol.replace(TRAILING_COLON_RE, ""));
19
+ headers.set("x-better-auth-forwarded-host", requestUrl.host);
20
+ headers.set("x-better-auth-forwarded-proto", requestUrl.protocol.replace(TRAILING_COLON_RE, ""));
17
21
  const body = request.method !== "GET" && request.method !== "HEAD" ? await request.arrayBuffer() : void 0;
18
22
  return fetch(nextUrl, {
19
23
  body,
@@ -60,6 +64,7 @@ function convexBetterAuth(opts) {
60
64
  mutableHeaders.delete("transfer-encoding");
61
65
  mutableHeaders.set("accept-encoding", "identity");
62
66
  return getToken(siteUrl, mutableHeaders, {
67
+ basePath: auth.basePath,
63
68
  ...getTokenOpts,
64
69
  jwtCache: {
65
70
  enabled: true,
@@ -1,7 +1,17 @@
1
- import { convexBetterAuthReactStart as convexBetterAuthReactStart$1 } from "@convex-dev/better-auth/react-start";
2
- export * from "@convex-dev/better-auth/react-start";
1
+ import { t as GetTokenOptions } from "../../token-B9Bjcqug.js";
2
+ import { FunctionReference, FunctionReturnType, OptionalRestArgs } from "convex/server";
3
3
 
4
4
  //#region src/auth-start/index.d.ts
5
- declare const convexBetterAuthReactStart: typeof convexBetterAuthReactStart$1;
5
+ type ConvexBetterAuthReactStartOptions = Omit<GetTokenOptions, 'forceRefresh'> & {
6
+ convexSiteUrl: string;
7
+ convexUrl: string;
8
+ };
9
+ declare const convexBetterAuthReactStart: (opts: ConvexBetterAuthReactStartOptions) => {
10
+ getToken: () => Promise<string | undefined>;
11
+ handler: (request: Request) => Promise<Response>;
12
+ fetchAuthQuery: <Query extends FunctionReference<"query">>(query: Query, ...args: OptionalRestArgs<Query>) => Promise<FunctionReturnType<Query>>;
13
+ fetchAuthMutation: <Mutation extends FunctionReference<"mutation">>(mutation: Mutation, ...args: OptionalRestArgs<Mutation>) => Promise<FunctionReturnType<Mutation>>;
14
+ fetchAuthAction: <Action extends FunctionReference<"action">>(action: Action, ...args: OptionalRestArgs<Action>) => Promise<FunctionReturnType<Action>>;
15
+ };
6
16
  //#endregion
7
17
  export { convexBetterAuthReactStart };