better-convex 0.0.5 → 0.1.0
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.
- package/dist/auth/index.d.ts +49 -49
- package/dist/react/index.js +2 -1
- package/package.json +1 -1
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as better_auth_adapters0 from "better-auth/adapters";
|
|
2
2
|
import { DBAdapterDebugLogOption } from "better-auth/adapters";
|
|
3
3
|
import { BetterAuthDBSchema } from "better-auth/db";
|
|
4
|
-
import * as
|
|
4
|
+
import * as convex_server0 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";
|
|
@@ -44,31 +44,31 @@ declare const createClient: <DataModel extends GenericDataModel, Schema$1 extend
|
|
|
44
44
|
}) => {
|
|
45
45
|
authFunctions: AuthFunctions;
|
|
46
46
|
triggers: Triggers<DataModel, Schema$1> | undefined;
|
|
47
|
-
adapter: (ctx: GenericCtx<DataModel>, createAuthOptions: (ctx: any) => BetterAuthOptions) =>
|
|
48
|
-
httpAdapter: (ctx: GenericCtx<DataModel>) =>
|
|
47
|
+
adapter: (ctx: GenericCtx<DataModel>, createAuthOptions: (ctx: any) => BetterAuthOptions) => better_auth_adapters0.AdapterFactory;
|
|
48
|
+
httpAdapter: (ctx: GenericCtx<DataModel>) => better_auth_adapters0.AdapterFactory;
|
|
49
49
|
triggersApi: () => {
|
|
50
|
-
beforeCreate:
|
|
50
|
+
beforeCreate: convex_server0.RegisteredMutation<"internal", {
|
|
51
51
|
data: any;
|
|
52
52
|
model: string;
|
|
53
53
|
}, Promise<any>>;
|
|
54
|
-
beforeDelete:
|
|
54
|
+
beforeDelete: convex_server0.RegisteredMutation<"internal", {
|
|
55
55
|
model: string;
|
|
56
56
|
doc: any;
|
|
57
57
|
}, Promise<any>>;
|
|
58
|
-
beforeUpdate:
|
|
58
|
+
beforeUpdate: convex_server0.RegisteredMutation<"internal", {
|
|
59
59
|
update: any;
|
|
60
60
|
model: string;
|
|
61
61
|
doc: any;
|
|
62
62
|
}, Promise<any>>;
|
|
63
|
-
onCreate:
|
|
63
|
+
onCreate: convex_server0.RegisteredMutation<"internal", {
|
|
64
64
|
model: string;
|
|
65
65
|
doc: any;
|
|
66
66
|
}, Promise<void>>;
|
|
67
|
-
onDelete:
|
|
67
|
+
onDelete: convex_server0.RegisteredMutation<"internal", {
|
|
68
68
|
model: string;
|
|
69
69
|
doc: any;
|
|
70
70
|
}, Promise<void>>;
|
|
71
|
-
onUpdate:
|
|
71
|
+
onUpdate: convex_server0.RegisteredMutation<"internal", {
|
|
72
72
|
model: string;
|
|
73
73
|
newDoc: any;
|
|
74
74
|
oldDoc: any;
|
|
@@ -148,7 +148,7 @@ declare const httpAdapter: <DataModel extends GenericDataModel, Schema$1 extends
|
|
|
148
148
|
authFunctions: AuthFunctions;
|
|
149
149
|
debugLogs?: DBAdapterDebugLogOption;
|
|
150
150
|
triggers?: Triggers<DataModel, Schema$1>;
|
|
151
|
-
}) =>
|
|
151
|
+
}) => better_auth_adapters0.AdapterFactory;
|
|
152
152
|
declare const dbAdapter: <DataModel extends GenericDataModel, Schema$1 extends SchemaDefinition<any, any>>(ctx: GenericCtx<DataModel>, createAuthOptions: (ctx: any) => BetterAuthOptions, {
|
|
153
153
|
authFunctions,
|
|
154
154
|
debugLogs,
|
|
@@ -159,7 +159,7 @@ declare const dbAdapter: <DataModel extends GenericDataModel, Schema$1 extends S
|
|
|
159
159
|
schema: Schema$1;
|
|
160
160
|
debugLogs?: DBAdapterDebugLogOption;
|
|
161
161
|
triggers?: Triggers<DataModel, Schema$1>;
|
|
162
|
-
}) =>
|
|
162
|
+
}) => better_auth_adapters0.AdapterFactory;
|
|
163
163
|
//#endregion
|
|
164
164
|
//#region src/auth/adapter-utils.d.ts
|
|
165
165
|
declare const adapterWhereValidator: convex_values0.VObject<{
|
|
@@ -175,18 +175,18 @@ declare const adapterWhereValidator: convex_values0.VObject<{
|
|
|
175
175
|
}, "required", "operator" | "value" | "field" | "connector">;
|
|
176
176
|
declare const adapterArgsValidator: convex_values0.VObject<{
|
|
177
177
|
limit?: number | undefined;
|
|
178
|
+
offset?: number | undefined;
|
|
179
|
+
select?: string[] | undefined;
|
|
180
|
+
sortBy?: {
|
|
181
|
+
field: string;
|
|
182
|
+
direction: "asc" | "desc";
|
|
183
|
+
} | undefined;
|
|
178
184
|
where?: {
|
|
179
185
|
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
180
186
|
connector?: "AND" | "OR" | undefined;
|
|
181
187
|
value: string | number | boolean | string[] | number[] | null;
|
|
182
188
|
field: string;
|
|
183
189
|
}[] | undefined;
|
|
184
|
-
select?: string[] | undefined;
|
|
185
|
-
offset?: number | undefined;
|
|
186
|
-
sortBy?: {
|
|
187
|
-
field: string;
|
|
188
|
-
direction: "asc" | "desc";
|
|
189
|
-
} | undefined;
|
|
190
190
|
model: string;
|
|
191
191
|
}, {
|
|
192
192
|
limit: convex_values0.VFloat64<number | undefined, "optional">;
|
|
@@ -216,7 +216,7 @@ declare const adapterArgsValidator: convex_values0.VObject<{
|
|
|
216
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>;
|
|
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
218
|
}, "required", "operator" | "value" | "field" | "connector">, "optional">;
|
|
219
|
-
}, "required", "limit" | "
|
|
219
|
+
}, "required", "limit" | "model" | "offset" | "select" | "sortBy" | "where" | "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>;
|
|
222
222
|
declare const selectFields: <T extends TableNamesInDataModel<GenericDataModel>, D extends DocumentByName<GenericDataModel, T>>(doc: D | null, select?: string[]) => Promise<D | null>;
|
|
@@ -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<
|
|
247
|
+
}, schema: Schema, betterAuthSchema: any) => Promise<convex_server0.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<
|
|
258
|
+
}, schema: Schema, betterAuthSchema: any) => Promise<convex_server0.PaginationResult<convex_server0.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:
|
|
282
|
-
splitCursor?:
|
|
281
|
+
continueCursor: convex_server0.Cursor;
|
|
282
|
+
splitCursor?: convex_server0.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<
|
|
293
|
+
}, schema: Schema, betterAuthSchema: any) => Promise<convex_server0.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:
|
|
308
|
-
splitCursor?:
|
|
307
|
+
continueCursor: convex_server0.Cursor;
|
|
308
|
+
splitCursor?: convex_server0.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:
|
|
316
|
+
create: convex_server0.RegisteredMutation<"internal", {
|
|
317
317
|
select?: string[] | undefined;
|
|
318
318
|
beforeCreateHandle?: string | undefined;
|
|
319
319
|
onCreateHandle?: string | undefined;
|
|
@@ -329,7 +329,7 @@ declare const createApi: <Schema$1 extends SchemaDefinition<any, any>>(schema: S
|
|
|
329
329
|
model: string;
|
|
330
330
|
};
|
|
331
331
|
}, Promise<any>>;
|
|
332
|
-
deleteMany:
|
|
332
|
+
deleteMany: convex_server0.RegisteredMutation<"internal", {
|
|
333
333
|
beforeDeleteHandle?: string | undefined;
|
|
334
334
|
onDeleteHandle?: string | undefined;
|
|
335
335
|
paginationOpts: {
|
|
@@ -356,11 +356,11 @@ declare const createApi: <Schema$1 extends SchemaDefinition<any, any>>(schema: S
|
|
|
356
356
|
count: number;
|
|
357
357
|
ids: any[];
|
|
358
358
|
isDone: boolean;
|
|
359
|
-
continueCursor:
|
|
360
|
-
splitCursor?:
|
|
359
|
+
continueCursor: convex_server0.Cursor;
|
|
360
|
+
splitCursor?: convex_server0.Cursor | null;
|
|
361
361
|
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
362
362
|
}>>;
|
|
363
|
-
deleteOne:
|
|
363
|
+
deleteOne: convex_server0.RegisteredMutation<"internal", {
|
|
364
364
|
beforeDeleteHandle?: string | undefined;
|
|
365
365
|
onDeleteHandle?: string | undefined;
|
|
366
366
|
input: {
|
|
@@ -375,21 +375,21 @@ declare const createApi: <Schema$1 extends SchemaDefinition<any, any>>(schema: S
|
|
|
375
375
|
}[] | undefined;
|
|
376
376
|
model: string;
|
|
377
377
|
};
|
|
378
|
-
}, Promise<
|
|
379
|
-
findMany:
|
|
380
|
-
limit?: number | undefined;
|
|
378
|
+
}, Promise<convex_server0.GenericDocument | undefined>>;
|
|
379
|
+
findMany: convex_server0.RegisteredQuery<"internal", {
|
|
381
380
|
join?: any;
|
|
381
|
+
limit?: number | undefined;
|
|
382
|
+
offset?: number | undefined;
|
|
383
|
+
sortBy?: {
|
|
384
|
+
field: string;
|
|
385
|
+
direction: "asc" | "desc";
|
|
386
|
+
} | undefined;
|
|
382
387
|
where?: {
|
|
383
388
|
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
384
389
|
connector?: "AND" | "OR" | undefined;
|
|
385
390
|
value: string | number | boolean | string[] | number[] | null;
|
|
386
391
|
field: string;
|
|
387
392
|
}[] | undefined;
|
|
388
|
-
offset?: number | undefined;
|
|
389
|
-
sortBy?: {
|
|
390
|
-
field: string;
|
|
391
|
-
direction: "asc" | "desc";
|
|
392
|
-
} | undefined;
|
|
393
393
|
paginationOpts: {
|
|
394
394
|
id?: number;
|
|
395
395
|
endCursor?: string | null;
|
|
@@ -399,19 +399,19 @@ declare const createApi: <Schema$1 extends SchemaDefinition<any, any>>(schema: S
|
|
|
399
399
|
cursor: string | null;
|
|
400
400
|
};
|
|
401
401
|
model: string;
|
|
402
|
-
}, Promise<
|
|
403
|
-
findOne:
|
|
402
|
+
}, Promise<convex_server0.PaginationResult<convex_server0.GenericDocument>>>;
|
|
403
|
+
findOne: convex_server0.RegisteredQuery<"internal", {
|
|
404
404
|
join?: any;
|
|
405
|
+
select?: string[] | undefined;
|
|
405
406
|
where?: {
|
|
406
407
|
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
407
408
|
connector?: "AND" | "OR" | undefined;
|
|
408
409
|
value: string | number | boolean | string[] | number[] | null;
|
|
409
410
|
field: string;
|
|
410
411
|
}[] | undefined;
|
|
411
|
-
select?: string[] | undefined;
|
|
412
412
|
model: string;
|
|
413
|
-
}, Promise<
|
|
414
|
-
updateMany:
|
|
413
|
+
}, Promise<convex_server0.GenericDocument | null>>;
|
|
414
|
+
updateMany: convex_server0.RegisteredMutation<"internal", {
|
|
415
415
|
beforeUpdateHandle?: string | undefined;
|
|
416
416
|
onUpdateHandle?: string | undefined;
|
|
417
417
|
paginationOpts: {
|
|
@@ -444,11 +444,11 @@ declare const createApi: <Schema$1 extends SchemaDefinition<any, any>>(schema: S
|
|
|
444
444
|
count: number;
|
|
445
445
|
ids: any[];
|
|
446
446
|
isDone: boolean;
|
|
447
|
-
continueCursor:
|
|
448
|
-
splitCursor?:
|
|
447
|
+
continueCursor: convex_server0.Cursor;
|
|
448
|
+
splitCursor?: convex_server0.Cursor | null;
|
|
449
449
|
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
450
450
|
}>>;
|
|
451
|
-
updateOne:
|
|
451
|
+
updateOne: convex_server0.RegisteredMutation<"internal", {
|
|
452
452
|
beforeUpdateHandle?: string | undefined;
|
|
453
453
|
onUpdateHandle?: string | undefined;
|
|
454
454
|
input: {
|
|
@@ -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:
|
|
474
|
-
rotateKeys:
|
|
473
|
+
getLatestJwks: convex_server0.RegisteredAction<"internal", {}, Promise<any>>;
|
|
474
|
+
rotateKeys: convex_server0.RegisteredAction<"internal", {}, Promise<any>>;
|
|
475
475
|
};
|
|
476
476
|
//#endregion
|
|
477
477
|
//#region src/auth/helpers.d.ts
|
package/dist/react/index.js
CHANGED
|
@@ -1274,6 +1274,8 @@ var ConvexQueryClient = class {
|
|
|
1274
1274
|
if (result.value !== null && result.value !== void 0 || !(existingData !== null && existingData !== void 0)) this.queryClient.setQueryData(queryKey, result.value);
|
|
1275
1275
|
} else {
|
|
1276
1276
|
const { error } = result;
|
|
1277
|
+
const authState = this.getAuthState();
|
|
1278
|
+
if (authState?.isLoading && authState.isUnauthorized(error)) return;
|
|
1277
1279
|
query.setState({
|
|
1278
1280
|
error,
|
|
1279
1281
|
errorUpdateCount: query.state.errorUpdateCount + 1,
|
|
@@ -1283,7 +1285,6 @@ var ConvexQueryClient = class {
|
|
|
1283
1285
|
fetchStatus: "idle",
|
|
1284
1286
|
status: "error"
|
|
1285
1287
|
}, { meta: "set by ConvexQueryClient" });
|
|
1286
|
-
const authState = this.getAuthState();
|
|
1287
1288
|
if (authState?.isUnauthorized(error)) {
|
|
1288
1289
|
const [, funcName] = queryKey;
|
|
1289
1290
|
authState.onUnauthorized({ queryName: funcName });
|