diff --git a/.changeset/custom-mutation-builder.md b/.changeset/custom-mutation-builder.md deleted file mode 100644 index 6fa7364..0000000 --- a/.changeset/custom-mutation-builder.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -'better-auth-convex': patch ---- - -Add support for custom mutation builders in `createClient` and `createApi`. Both functions now accept an optional `internalMutation` parameter, allowing you to wrap internal mutations with custom context (e.g., triggers, aggregates, middleware). - -**Usage:** - -```ts -const internalMutation = customMutation( - internalMutationGeneric, - customCtx(async (ctx) => ({ - db: triggers.wrapDB(ctx).db, - })) -); - -// Pass to createClient -createClient({ - authFunctions, - schema, - internalMutation, - triggers, -}); - -// Pass to createApi -createApi(schema, { - ...auth.options, - internalMutation, -}); -``` diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b02d5a..bcda2a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,36 @@ # better-auth-convex +## 0.4.2 + +### Patch Changes + +- df53a30: Add support for custom mutation builders in `createClient` and `createApi`. Both functions now accept an optional `internalMutation` parameter, allowing you to wrap internal mutations with custom context (e.g., triggers, aggregates, middleware). + + **Usage:** + + ```ts + const internalMutation = customMutation( + internalMutationGeneric, + customCtx(async (ctx) => ({ + db: triggers.wrapDB(ctx).db, + })) + ); + + // Pass to createClient + createClient({ + authFunctions, + schema, + internalMutation, + triggers, + }); + + // Pass to createApi + createApi(schema, { + ...auth.options, + internalMutation, + }); + ``` + ## 0.4.1 ### Patch Changes diff --git a/package.json b/package.json index 04d5132..cfaf02f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "better-auth-convex", - "version": "0.4.1", + "version": "0.4.2", "description": "Better Auth Convex local integration", "keywords": [ "convex",