Releases: ThallesP/nestjs-better-auth
Releases · ThallesP/nestjs-better-auth
v2.6.0
What's New
Database Hook Decorators
Added support for Better Auth's databaseHooks lifecycle with NestJS dependency injection.
New decorators:
@DatabaseHook()— class-level marker@BeforeCreate(model)/@AfterCreate(model)@BeforeUpdate(model)/@AfterUpdate(model)@BeforeDelete(model)/@AfterDelete(model)
Where model is "user" | "session" | "account" | "verification".
Example:
@DatabaseHook()
@Injectable()
class UserCreateHook {
constructor(private readonly emailService: EmailService) {}
@BeforeCreate("user")
async beforeUserCreate(user) {
return { data: { ...user, firstName: user.name.split(" ")[0] } };
}
@AfterCreate("user")
async afterUserCreate(user) {
await this.emailService.sendWelcomeEmail(user.email);
}
}Requires databaseHooks: {} in your betterAuth(...) config.
Closes #32
v2.5.4
v2.5.3
What's Changed
- feat: add InferSession type for plugin-aware session typing by @ejirocodes in #135
New Contributors
- @ejirocodes made their first contribution in #135
Full Changelog: v2.5.2...v2.5.3
v2.5.2
v2.5.1
v2.5.0
What's Changed
- Transform require statements to imports for ESM compatibility by @luci1s in #113
- fix issue #115: import createAuthMiddleware from better-auth/api instead of better-auth/plugins by @Cicolas in #116
- B mensinga/master by @ThallesP in #119
- Add Fastify test scripts and run adapter matrix in CI by @ThallesP in #120
- Feat add has permission decorators by @Shakir-ahmed1 in #109
- refactor body parser configuration and deprecate legacy parser flags by @ThallesP in #122
- Deprecate
disableBodyParserand introduce configurablebodyParser/rawBodyoptions by @ThallesP in #123
New Contributors
- @luci1s made their first contribution in #113
- @Cicolas made their first contribution in #116
- @Shakir-ahmed1 made their first contribution in #109
Full Changelog: v2.4.0...v2.5.0
v2.4.0
v2.3.2
Full Changelog: v2.3.1...v2.3.2
v2.3.1
What's Changed
- feat: add global prefixes exclusion and use
MiddlewareConsumerby @danielfinke in #104
Full Changelog: v2.3.0...v2.3.1