better-convex 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import * as better_auth_adapters1 from "better-auth/adapters";
2
2
  import { DBAdapterDebugLogOption } from "better-auth/adapters";
3
3
  import { BetterAuthDBSchema } from "better-auth/db";
4
- import * as convex_server24 from "convex/server";
4
+ import * as convex_server23 from "convex/server";
5
5
  import { DocumentByName, FunctionReference, GenericDataModel, GenericMutationCtx, GenericQueryCtx, GenericSchema, HttpRouter, IdField, PaginationOptions, PaginationResult, SchemaDefinition, SystemFields, TableNamesInDataModel, internalMutationGeneric } from "convex/server";
6
6
  import * as convex_values0 from "convex/values";
7
7
  import { Infer } from "convex/values";
@@ -47,28 +47,28 @@ declare const createClient: <DataModel extends GenericDataModel, Schema$1 extend
47
47
  adapter: (ctx: GenericCtx<DataModel>, createAuthOptions: (ctx: any) => BetterAuthOptions) => better_auth_adapters1.AdapterFactory;
48
48
  httpAdapter: (ctx: GenericCtx<DataModel>) => better_auth_adapters1.AdapterFactory;
49
49
  triggersApi: () => {
50
- beforeCreate: convex_server24.RegisteredMutation<"internal", {
50
+ beforeCreate: convex_server23.RegisteredMutation<"internal", {
51
51
  data: any;
52
52
  model: string;
53
53
  }, Promise<any>>;
54
- beforeDelete: convex_server24.RegisteredMutation<"internal", {
54
+ beforeDelete: convex_server23.RegisteredMutation<"internal", {
55
55
  model: string;
56
56
  doc: any;
57
57
  }, Promise<any>>;
58
- beforeUpdate: convex_server24.RegisteredMutation<"internal", {
58
+ beforeUpdate: convex_server23.RegisteredMutation<"internal", {
59
59
  update: any;
60
60
  model: string;
61
61
  doc: any;
62
62
  }, Promise<any>>;
63
- onCreate: convex_server24.RegisteredMutation<"internal", {
63
+ onCreate: convex_server23.RegisteredMutation<"internal", {
64
64
  model: string;
65
65
  doc: any;
66
66
  }, Promise<void>>;
67
- onDelete: convex_server24.RegisteredMutation<"internal", {
67
+ onDelete: convex_server23.RegisteredMutation<"internal", {
68
68
  model: string;
69
69
  doc: any;
70
70
  }, Promise<void>>;
71
- onUpdate: convex_server24.RegisteredMutation<"internal", {
71
+ onUpdate: convex_server23.RegisteredMutation<"internal", {
72
72
  model: string;
73
73
  newDoc: any;
74
74
  oldDoc: any;
@@ -163,20 +163,20 @@ declare const dbAdapter: <DataModel extends GenericDataModel, Schema$1 extends S
163
163
  //#endregion
164
164
  //#region src/auth/adapter-utils.d.ts
165
165
  declare const adapterWhereValidator: convex_values0.VObject<{
166
- operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
166
+ operator?: "in" | "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
167
167
  connector?: "AND" | "OR" | undefined;
168
168
  value: string | number | boolean | string[] | number[] | null;
169
169
  field: string;
170
170
  }, {
171
171
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
172
172
  field: convex_values0.VString<string, "required">;
173
- 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>;
173
+ operator: convex_values0.VUnion<"in" | "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "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>;
174
174
  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>;
175
- }, "required", "operator" | "value" | "field" | "connector">;
175
+ }, "required", "value" | "operator" | "field" | "connector">;
176
176
  declare const adapterArgsValidator: convex_values0.VObject<{
177
177
  limit?: number | undefined;
178
178
  where?: {
179
- operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
179
+ operator?: "in" | "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
180
180
  connector?: "AND" | "OR" | undefined;
181
181
  value: string | number | boolean | string[] | number[] | null;
182
182
  field: string;
@@ -201,21 +201,21 @@ declare const adapterArgsValidator: convex_values0.VObject<{
201
201
  field: convex_values0.VString<string, "required">;
202
202
  }, "optional", "field" | "direction">;
203
203
  where: convex_values0.VArray<{
204
- operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
204
+ operator?: "in" | "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
205
205
  connector?: "AND" | "OR" | undefined;
206
206
  value: string | number | boolean | string[] | number[] | null;
207
207
  field: string;
208
208
  }[] | undefined, convex_values0.VObject<{
209
- operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
209
+ operator?: "in" | "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
210
210
  connector?: "AND" | "OR" | undefined;
211
211
  value: string | number | boolean | string[] | number[] | null;
212
212
  field: string;
213
213
  }, {
214
214
  connector: convex_values0.VUnion<"AND" | "OR" | undefined, [convex_values0.VLiteral<"AND", "required">, convex_values0.VLiteral<"OR", "required">], "optional", never>;
215
215
  field: convex_values0.VString<string, "required">;
216
- 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>;
216
+ operator: convex_values0.VUnion<"in" | "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "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>;
217
217
  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>;
218
- }, "required", "operator" | "value" | "field" | "connector">, "optional">;
218
+ }, "required", "value" | "operator" | "field" | "connector">, "optional">;
219
219
  }, "required", "limit" | "where" | "model" | "select" | "offset" | "sortBy" | "sortBy.field" | "sortBy.direction">;
220
220
  declare const hasUniqueFields: (betterAuthSchema: BetterAuthDBSchema, model: string, input: Record<string, any>) => boolean;
221
221
  declare const checkUniqueFields: <Schema$1 extends SchemaDefinition<any, any>>(ctx: GenericQueryCtx<GenericDataModel>, schema: Schema$1, betterAuthSchema: BetterAuthDBSchema, table: string, input: Record<string, any>, doc?: Record<string, any>) => Promise<void>;
@@ -244,7 +244,7 @@ declare const findOneHandler: (ctx: any, args: {
244
244
  model: string;
245
245
  select?: string[];
246
246
  where?: any[];
247
- }, schema: Schema, betterAuthSchema: any) => Promise<convex_server24.GenericDocument | null>;
247
+ }, schema: Schema, betterAuthSchema: any) => Promise<convex_server23.GenericDocument | null>;
248
248
  declare const findManyHandler: (ctx: any, args: {
249
249
  model: string;
250
250
  paginationOpts: any;
@@ -255,7 +255,7 @@ declare const findManyHandler: (ctx: any, args: {
255
255
  field: string;
256
256
  };
257
257
  where?: any[];
258
- }, schema: Schema, betterAuthSchema: any) => Promise<convex_server24.PaginationResult<convex_server24.GenericDocument>>;
258
+ }, schema: Schema, betterAuthSchema: any) => Promise<convex_server23.PaginationResult<convex_server23.GenericDocument>>;
259
259
  declare const updateOneHandler: (ctx: any, args: {
260
260
  input: {
261
261
  model: string;
@@ -278,8 +278,8 @@ declare const updateManyHandler: (ctx: any, args: {
278
278
  count: number;
279
279
  ids: any[];
280
280
  isDone: boolean;
281
- continueCursor: convex_server24.Cursor;
282
- splitCursor?: convex_server24.Cursor | null;
281
+ continueCursor: convex_server23.Cursor;
282
+ splitCursor?: convex_server23.Cursor | null;
283
283
  pageStatus?: "SplitRecommended" | "SplitRequired" | null;
284
284
  }>;
285
285
  declare const deleteOneHandler: (ctx: any, args: {
@@ -290,7 +290,7 @@ declare const deleteOneHandler: (ctx: any, args: {
290
290
  beforeDeleteHandle?: string;
291
291
  skipBeforeHooks?: boolean;
292
292
  onDeleteHandle?: string;
293
- }, schema: Schema, betterAuthSchema: any) => Promise<convex_server24.GenericDocument | undefined>;
293
+ }, schema: Schema, betterAuthSchema: any) => Promise<convex_server23.GenericDocument | undefined>;
294
294
  declare const deleteManyHandler: (ctx: any, args: {
295
295
  input: {
296
296
  model: string;
@@ -304,8 +304,8 @@ declare const deleteManyHandler: (ctx: any, args: {
304
304
  count: number;
305
305
  ids: any[];
306
306
  isDone: boolean;
307
- continueCursor: convex_server24.Cursor;
308
- splitCursor?: convex_server24.Cursor | null;
307
+ continueCursor: convex_server23.Cursor;
308
+ splitCursor?: convex_server23.Cursor | null;
309
309
  pageStatus?: "SplitRecommended" | "SplitRequired" | null;
310
310
  }>;
311
311
  declare const createApi: <Schema$1 extends SchemaDefinition<any, any>>(schema: Schema$1, createAuth: CreateAuth, options?: {
@@ -313,7 +313,7 @@ declare const createApi: <Schema$1 extends SchemaDefinition<any, any>>(schema: S
313
313
  /** Skip input validation for smaller generated types. Since these are internal functions, validation is optional. */
314
314
  skipValidation?: boolean;
315
315
  }) => {
316
- create: convex_server24.RegisteredMutation<"internal", {
316
+ create: convex_server23.RegisteredMutation<"internal", {
317
317
  select?: string[] | undefined;
318
318
  beforeCreateHandle?: string | undefined;
319
319
  onCreateHandle?: string | undefined;
@@ -329,38 +329,38 @@ declare const createApi: <Schema$1 extends SchemaDefinition<any, any>>(schema: S
329
329
  model: string;
330
330
  };
331
331
  }, Promise<any>>;
332
- deleteMany: convex_server24.RegisteredMutation<"internal", {
332
+ deleteMany: convex_server23.RegisteredMutation<"internal", {
333
333
  beforeDeleteHandle?: string | undefined;
334
334
  onDeleteHandle?: string | undefined;
335
- paginationOpts: {
336
- id?: number;
337
- endCursor?: string | null;
338
- maximumRowsRead?: number;
339
- maximumBytesRead?: number;
340
- numItems: number;
341
- cursor: string | null;
342
- };
343
335
  input: {
344
336
  where?: any[] | undefined;
345
337
  model: string;
346
338
  } | {
347
339
  where?: {
348
- operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
340
+ operator?: "in" | "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
349
341
  connector?: "AND" | "OR" | undefined;
350
342
  value: string | number | boolean | string[] | number[] | null;
351
343
  field: string;
352
344
  }[] | undefined;
353
345
  model: string;
354
346
  };
347
+ paginationOpts: {
348
+ id?: number;
349
+ endCursor?: string | null;
350
+ maximumRowsRead?: number;
351
+ maximumBytesRead?: number;
352
+ numItems: number;
353
+ cursor: string | null;
354
+ };
355
355
  }, Promise<{
356
356
  count: number;
357
357
  ids: any[];
358
358
  isDone: boolean;
359
- continueCursor: convex_server24.Cursor;
360
- splitCursor?: convex_server24.Cursor | null;
359
+ continueCursor: convex_server23.Cursor;
360
+ splitCursor?: convex_server23.Cursor | null;
361
361
  pageStatus?: "SplitRecommended" | "SplitRequired" | null;
362
362
  }>>;
363
- deleteOne: convex_server24.RegisteredMutation<"internal", {
363
+ deleteOne: convex_server23.RegisteredMutation<"internal", {
364
364
  beforeDeleteHandle?: string | undefined;
365
365
  onDeleteHandle?: string | undefined;
366
366
  input: {
@@ -368,19 +368,19 @@ declare const createApi: <Schema$1 extends SchemaDefinition<any, any>>(schema: S
368
368
  model: string;
369
369
  } | {
370
370
  where?: {
371
- operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
371
+ operator?: "in" | "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
372
372
  connector?: "AND" | "OR" | undefined;
373
373
  value: string | number | boolean | string[] | number[] | null;
374
374
  field: string;
375
375
  }[] | undefined;
376
376
  model: string;
377
377
  };
378
- }, Promise<convex_server24.GenericDocument | undefined>>;
379
- findMany: convex_server24.RegisteredQuery<"internal", {
378
+ }, Promise<convex_server23.GenericDocument | undefined>>;
379
+ findMany: convex_server23.RegisteredQuery<"internal", {
380
380
  limit?: number | undefined;
381
381
  join?: any;
382
382
  where?: {
383
- operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
383
+ operator?: "in" | "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
384
384
  connector?: "AND" | "OR" | undefined;
385
385
  value: string | number | boolean | string[] | number[] | null;
386
386
  field: string;
@@ -399,36 +399,28 @@ declare const createApi: <Schema$1 extends SchemaDefinition<any, any>>(schema: S
399
399
  cursor: string | null;
400
400
  };
401
401
  model: string;
402
- }, Promise<convex_server24.PaginationResult<convex_server24.GenericDocument>>>;
403
- findOne: convex_server24.RegisteredQuery<"internal", {
402
+ }, Promise<convex_server23.PaginationResult<convex_server23.GenericDocument>>>;
403
+ findOne: convex_server23.RegisteredQuery<"internal", {
404
404
  join?: any;
405
405
  where?: {
406
- operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
406
+ operator?: "in" | "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
407
407
  connector?: "AND" | "OR" | undefined;
408
408
  value: string | number | boolean | string[] | number[] | null;
409
409
  field: string;
410
410
  }[] | undefined;
411
411
  select?: string[] | undefined;
412
412
  model: string;
413
- }, Promise<convex_server24.GenericDocument | null>>;
414
- updateMany: convex_server24.RegisteredMutation<"internal", {
413
+ }, Promise<convex_server23.GenericDocument | null>>;
414
+ updateMany: convex_server23.RegisteredMutation<"internal", {
415
415
  beforeUpdateHandle?: string | undefined;
416
416
  onUpdateHandle?: string | undefined;
417
- paginationOpts: {
418
- id?: number;
419
- endCursor?: string | null;
420
- maximumRowsRead?: number;
421
- maximumBytesRead?: number;
422
- numItems: number;
423
- cursor: string | null;
424
- };
425
417
  input: {
426
418
  where?: any[] | undefined;
427
419
  update: any;
428
420
  model: string;
429
421
  } | {
430
422
  where?: {
431
- operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
423
+ operator?: "in" | "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
432
424
  connector?: "AND" | "OR" | undefined;
433
425
  value: string | number | boolean | string[] | number[] | null;
434
426
  field: string;
@@ -440,15 +432,23 @@ declare const createApi: <Schema$1 extends SchemaDefinition<any, any>>(schema: S
440
432
  };
441
433
  model: string;
442
434
  };
435
+ paginationOpts: {
436
+ id?: number;
437
+ endCursor?: string | null;
438
+ maximumRowsRead?: number;
439
+ maximumBytesRead?: number;
440
+ numItems: number;
441
+ cursor: string | null;
442
+ };
443
443
  }, Promise<{
444
444
  count: number;
445
445
  ids: any[];
446
446
  isDone: boolean;
447
- continueCursor: convex_server24.Cursor;
448
- splitCursor?: convex_server24.Cursor | null;
447
+ continueCursor: convex_server23.Cursor;
448
+ splitCursor?: convex_server23.Cursor | null;
449
449
  pageStatus?: "SplitRecommended" | "SplitRequired" | null;
450
450
  }>>;
451
- updateOne: convex_server24.RegisteredMutation<"internal", {
451
+ updateOne: convex_server23.RegisteredMutation<"internal", {
452
452
  beforeUpdateHandle?: string | undefined;
453
453
  onUpdateHandle?: string | undefined;
454
454
  input: {
@@ -457,7 +457,7 @@ declare const createApi: <Schema$1 extends SchemaDefinition<any, any>>(schema: S
457
457
  model: string;
458
458
  } | {
459
459
  where?: {
460
- operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
460
+ operator?: "in" | "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
461
461
  connector?: "AND" | "OR" | undefined;
462
462
  value: string | number | boolean | string[] | number[] | null;
463
463
  field: string;
@@ -470,8 +470,8 @@ declare const createApi: <Schema$1 extends SchemaDefinition<any, any>>(schema: S
470
470
  model: string;
471
471
  };
472
472
  }, Promise<any>>;
473
- getLatestJwks: convex_server24.RegisteredAction<"internal", {}, Promise<any>>;
474
- rotateKeys: convex_server24.RegisteredAction<"internal", {}, Promise<any>>;
473
+ getLatestJwks: convex_server23.RegisteredAction<"internal", {}, Promise<any>>;
474
+ rotateKeys: convex_server23.RegisteredAction<"internal", {}, Promise<any>>;
475
475
  };
476
476
  //#endregion
477
477
  //#region src/auth/helpers.d.ts
@@ -1,4 +1,4 @@
1
- import { s as createCallerFactory, t as CRPCError } from "../error-_XBsa1OD.js";
1
+ import { s as createCallerFactory, t as CRPCError } from "../error-DwOaXhPE.js";
2
2
  import { getToken } from "@convex-dev/better-auth/utils";
3
3
 
4
4
  //#region src/auth-nextjs/index.ts
@@ -144,8 +144,10 @@ const parseConvexSiteUrl = (url) => {
144
144
  * });
145
145
  * ```
146
146
  */
147
+ const noAuthGetToken = () => Promise.resolve({ token: void 0 });
147
148
  function createCallerFactory(opts) {
148
149
  const siteUrl = parseConvexSiteUrl(opts.convexSiteUrl);
150
+ const getToken = opts.getToken ?? noAuthGetToken;
149
151
  const isAuthError = opts.jwtCache?.isAuthError;
150
152
  const callWithTokenAndRetry = async (fn, tokenResult, headers) => {
151
153
  try {
@@ -153,7 +155,7 @@ function createCallerFactory(opts) {
153
155
  } catch (error) {
154
156
  if (isAuthError?.(error)) return null;
155
157
  if (!opts.jwtCache?.enabled || tokenResult.isFresh) throw error;
156
- const newToken = await opts.getToken(siteUrl, headers, {
158
+ const newToken = await getToken(siteUrl, headers, {
157
159
  ...opts,
158
160
  forceRefresh: true
159
161
  });
@@ -166,7 +168,7 @@ function createCallerFactory(opts) {
166
168
  }
167
169
  };
168
170
  const createContext = async (reqOpts) => {
169
- const tokenResult = await opts.getToken(siteUrl, reqOpts.headers, opts);
171
+ const tokenResult = await getToken(siteUrl, reqOpts.headers, opts);
170
172
  const fetchAuthQuery = async (query, args, callerOpts) => {
171
173
  if (callerOpts?.skipUnauth && !tokenResult.token) return null;
172
174
  return callWithTokenAndRetry((token) => {
@@ -1,4 +1,4 @@
1
- import * as convex_server30 from "convex/server";
1
+ import * as convex_server0 from "convex/server";
2
2
  import { FunctionReference, FunctionReturnType, GenericActionCtx, GenericDataModel, GenericMutationCtx, GenericQueryCtx } from "convex/server";
3
3
  import { EmptyObject } from "convex-helpers";
4
4
  import { ConvexError } from "convex/values";
@@ -184,7 +184,7 @@ declare class ProcedureBuilder<TBaseCtx, TContext, TContextOverrides extends Uns
184
184
  protected _meta(value: TMeta): ProcedureBuilderDef<TMeta>;
185
185
  /** Merge all input schemas into one */
186
186
  protected _getMergedInput(): Record<string, any> | undefined;
187
- protected _createFunction(handler: any, baseFunction: any, customFn: typeof zCustomQuery | typeof zCustomMutation | typeof zCustomAction, fnType: 'query' | 'mutation' | 'action'): convex_server30.RegisteredMutation<convex_server30.FunctionVisibility, Record<string, unknown>, unknown> | convex_server30.RegisteredQuery<convex_server30.FunctionVisibility, Record<string, unknown>, unknown> | convex_server30.RegisteredAction<convex_server30.FunctionVisibility, Record<string, unknown>, unknown>;
187
+ protected _createFunction(handler: any, baseFunction: any, customFn: typeof zCustomQuery | typeof zCustomMutation | typeof zCustomAction, fnType: 'query' | 'mutation' | 'action'): convex_server0.RegisteredMutation<convex_server0.FunctionVisibility, Record<string, unknown>, unknown> | convex_server0.RegisteredQuery<convex_server0.FunctionVisibility, Record<string, unknown>, unknown> | convex_server0.RegisteredAction<convex_server0.FunctionVisibility, Record<string, unknown>, unknown>;
188
188
  }
189
189
  /**
190
190
  * Query-specific procedure builder
@@ -220,7 +220,7 @@ declare class QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides extend
220
220
  query<TResult>(handler: (opts: {
221
221
  ctx: Overwrite<TContext, TContextOverrides>;
222
222
  input: InferInput<TInput>;
223
- }) => Promise<TOutput extends z.ZodTypeAny ? z.infer<TOutput> : TResult>): convex_server30.RegisteredMutation<convex_server30.FunctionVisibility, Record<string, unknown>, unknown> | convex_server30.RegisteredQuery<convex_server30.FunctionVisibility, Record<string, unknown>, unknown> | convex_server30.RegisteredAction<convex_server30.FunctionVisibility, Record<string, unknown>, unknown>;
223
+ }) => Promise<TOutput extends z.ZodTypeAny ? z.infer<TOutput> : TResult>): convex_server0.RegisteredMutation<convex_server0.FunctionVisibility, Record<string, unknown>, unknown> | convex_server0.RegisteredQuery<convex_server0.FunctionVisibility, Record<string, unknown>, unknown> | convex_server0.RegisteredAction<convex_server0.FunctionVisibility, Record<string, unknown>, unknown>;
224
224
  /** Mark as internal - returns chainable builder using internal function */
225
225
  internal(): QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TOutput, TMeta>;
226
226
  }
@@ -241,7 +241,7 @@ declare class MutationProcedureBuilder<TBaseCtx, TContext, TContextOverrides ext
241
241
  mutation<TResult>(handler: (opts: {
242
242
  ctx: Overwrite<TContext, TContextOverrides>;
243
243
  input: InferInput<TInput>;
244
- }) => Promise<TOutput extends z.ZodTypeAny ? z.infer<TOutput> : TResult>): convex_server30.RegisteredMutation<convex_server30.FunctionVisibility, Record<string, unknown>, unknown> | convex_server30.RegisteredQuery<convex_server30.FunctionVisibility, Record<string, unknown>, unknown> | convex_server30.RegisteredAction<convex_server30.FunctionVisibility, Record<string, unknown>, unknown>;
244
+ }) => Promise<TOutput extends z.ZodTypeAny ? z.infer<TOutput> : TResult>): convex_server0.RegisteredMutation<convex_server0.FunctionVisibility, Record<string, unknown>, unknown> | convex_server0.RegisteredQuery<convex_server0.FunctionVisibility, Record<string, unknown>, unknown> | convex_server0.RegisteredAction<convex_server0.FunctionVisibility, Record<string, unknown>, unknown>;
245
245
  /** Mark as internal - returns chainable builder using internal function */
246
246
  internal(): MutationProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TOutput, TMeta>;
247
247
  }
@@ -262,7 +262,7 @@ declare class ActionProcedureBuilder<TBaseCtx, TContext, TContextOverrides exten
262
262
  action<TResult>(handler: (opts: {
263
263
  ctx: Overwrite<TContext, TContextOverrides>;
264
264
  input: InferInput<TInput>;
265
- }) => Promise<TOutput extends z.ZodTypeAny ? z.infer<TOutput> : TResult>): convex_server30.RegisteredMutation<convex_server30.FunctionVisibility, Record<string, unknown>, unknown> | convex_server30.RegisteredQuery<convex_server30.FunctionVisibility, Record<string, unknown>, unknown> | convex_server30.RegisteredAction<convex_server30.FunctionVisibility, Record<string, unknown>, unknown>;
265
+ }) => Promise<TOutput extends z.ZodTypeAny ? z.infer<TOutput> : TResult>): convex_server0.RegisteredMutation<convex_server0.FunctionVisibility, Record<string, unknown>, unknown> | convex_server0.RegisteredQuery<convex_server0.FunctionVisibility, Record<string, unknown>, unknown> | convex_server0.RegisteredAction<convex_server0.FunctionVisibility, Record<string, unknown>, unknown>;
266
266
  /** Mark as internal - returns chainable builder using internal function */
267
267
  internal(): ActionProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TOutput, TMeta>;
268
268
  }
@@ -298,6 +298,10 @@ declare class CRPCBuilderWithMeta<DataModel extends GenericDataModel, TMeta exte
298
298
  * Configure context creators for each function type
299
299
  */
300
300
  context<TConfig extends ContextConfig<DataModel>>(config: TConfig): CRPCBuilderWithContext<DataModel, InferQueryCtx<TConfig, DataModel>, InferMutationCtx<TConfig, DataModel>, InferActionCtx<TConfig, DataModel>, TMeta>;
301
+ /**
302
+ * Create the CRPC instance directly (uses default passthrough context)
303
+ */
304
+ create(config: CreateConfig<TMeta>): CRPCInstance<GenericQueryCtx<DataModel>, GenericMutationCtx<DataModel>, GenericActionCtx<DataModel>, TMeta>;
301
305
  }
302
306
  /**
303
307
  * Initial CRPC builder - configure meta and context
@@ -311,6 +315,10 @@ declare class CRPCBuilder<DataModel extends GenericDataModel> {
311
315
  * Configure context creators for each function type
312
316
  */
313
317
  context<TConfig extends ContextConfig<DataModel>>(config: TConfig): CRPCBuilderWithContext<DataModel, InferQueryCtx<TConfig, DataModel>, InferMutationCtx<TConfig, DataModel>, InferActionCtx<TConfig, DataModel>>;
318
+ /**
319
+ * Create the CRPC instance directly (uses default passthrough context)
320
+ */
321
+ create(config: CreateConfig<object>): CRPCInstance<GenericQueryCtx<DataModel>, GenericMutationCtx<DataModel>, GenericActionCtx<DataModel>, object>;
314
322
  }
315
323
  /**
316
324
  * CRPC entry point - tRPC-style object
@@ -342,6 +350,10 @@ declare const initCRPC: {
342
350
  * Configure context creators (uses GenericDataModel)
343
351
  */
344
352
  context<TConfig extends ContextConfig<GenericDataModel>>(config: TConfig): CRPCBuilderWithContext<GenericDataModel, InferQueryCtx<TConfig, GenericDataModel>, InferMutationCtx<TConfig, GenericDataModel>, InferActionCtx<TConfig, GenericDataModel>>;
353
+ /**
354
+ * Create the CRPC instance directly (uses GenericDataModel and default passthrough context)
355
+ */
356
+ create(config: CreateConfig<object>): CRPCInstance<GenericQueryCtx<GenericDataModel>, GenericMutationCtx<GenericDataModel>, GenericActionCtx<GenericDataModel>, object>;
345
357
  };
346
358
  //#endregion
347
359
  //#region src/server/caller.d.ts
@@ -450,8 +462,8 @@ type CreateCallerFactoryOptions<TApi> = {
450
462
  api: TApi;
451
463
  /** Convex site URL (must end in `.convex.site`). */
452
464
  convexSiteUrl: string;
453
- /** Function to extract auth token from request headers. */
454
- getToken: GetTokenFn;
465
+ /** Function to extract auth token from request headers. Defaults to no auth. */
466
+ getToken?: GetTokenFn;
455
467
  /** JWT caching options for automatic token refresh. */
456
468
  jwtCache?: JwtCacheOptions;
457
469
  /** Procedure metadata. */
@@ -462,21 +474,6 @@ type ConvexContext<TApi> = {
462
474
  isAuthenticated: boolean;
463
475
  caller: ServerCaller<TApi>;
464
476
  };
465
- /**
466
- * Framework-agnostic caller factory.
467
- *
468
- * @example
469
- * ```ts
470
- * import { getToken } from '@convex-dev/better-auth/utils';
471
- *
472
- * const { createContext, createCaller } = createCallerFactory({
473
- * api,
474
- * convexSiteUrl: env.NEXT_PUBLIC_CONVEX_SITE_URL,
475
- * getToken,
476
- * jwtCache: { enabled: true, isAuthError },
477
- * });
478
- * ```
479
- */
480
477
  declare function createCallerFactory<TApi extends Record<string, unknown>>(opts: CreateCallerFactoryOptions<TApi>): {
481
478
  createContext: (reqOpts: {
482
479
  headers: Headers;
@@ -1,4 +1,4 @@
1
- import { a as getHTTPStatusCodeFromError, c as createLazyCaller, i as getCRPCErrorFromUnknown, l as createServerCaller, n as CRPC_ERROR_CODES_BY_KEY, o as isCRPCError, r as CRPC_ERROR_CODE_TO_HTTP, s as createCallerFactory, t as CRPCError } from "../error-_XBsa1OD.js";
1
+ import { a as getHTTPStatusCodeFromError, c as createLazyCaller, i as getCRPCErrorFromUnknown, l as createServerCaller, n as CRPC_ERROR_CODES_BY_KEY, o as isCRPCError, r as CRPC_ERROR_CODE_TO_HTTP, s as createCallerFactory, t as CRPCError } from "../error-DwOaXhPE.js";
2
2
  import { customCtx } from "convex-helpers/server/customFunctions";
3
3
  import { zCustomAction, zCustomMutation, zCustomQuery } from "convex-helpers/server/zod4";
4
4
  import { z } from "zod";
@@ -338,6 +338,12 @@ var CRPCBuilderWithMeta = class {
338
338
  context(config) {
339
339
  return new CRPCBuilderWithContext(config);
340
340
  }
341
+ /**
342
+ * Create the CRPC instance directly (uses default passthrough context)
343
+ */
344
+ create(config) {
345
+ return new CRPCBuilderWithContext({}).create(config);
346
+ }
341
347
  };
342
348
  /**
343
349
  * Initial CRPC builder - configure meta and context
@@ -355,6 +361,12 @@ var CRPCBuilder = class {
355
361
  context(config) {
356
362
  return new CRPCBuilderWithContext(config);
357
363
  }
364
+ /**
365
+ * Create the CRPC instance directly (uses default passthrough context)
366
+ */
367
+ create(config) {
368
+ return new CRPCBuilderWithContext({}).create(config);
369
+ }
358
370
  };
359
371
  /**
360
372
  * CRPC entry point - tRPC-style object
@@ -382,6 +394,9 @@ const initCRPC = {
382
394
  },
383
395
  context(config) {
384
396
  return new CRPCBuilderWithContext(config);
397
+ },
398
+ create(config) {
399
+ return new CRPCBuilderWithContext({}).create(config);
385
400
  }
386
401
  };
387
402
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-convex",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Better Convex - React Query integration and CLI tools for Convex",
5
5
  "keywords": [
6
6
  "convex",