Skip to content

Releases: ThallesP/nestjs-better-auth

v2.6.0

09 Apr 03:44
fc1aadf

Choose a tag to compare

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

06 Apr 18:54
1cad647

Choose a tag to compare

What's Changed

  • docs: fix broken organization access control links by @ejirocodes in #137
  • Update TypeScript version range in package.json by @bobeagan in #140

New Contributors

Full Changelog: v2.5.3...v2.5.4

v2.5.3

29 Mar 20:12
f25b405

Choose a tag to compare

What's Changed

  • feat: add InferSession type for plugin-aware session typing by @ejirocodes in #135

New Contributors

Full Changelog: v2.5.2...v2.5.3

v2.5.2

24 Mar 04:32
d08bca3

Choose a tag to compare

What's Changed

Full Changelog: v2.5.1...v2.5.2

v2.5.1

11 Mar 23:04
e6e113e

Choose a tag to compare

What's Changed

  • docs: remove outdated Fastify beta warning from README by @ThallesP in #125
  • Fix duplicate Fastify CORS handling for Better Auth trustedOrigins by @ThallesP in #127

Full Changelog: v2.5.0...v2.5.1

v2.5.0

08 Mar 23:53
c620a58

Choose a tag to compare

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 disableBodyParser and introduce configurable bodyParser/rawBody options by @ThallesP in #123

New Contributors

Full Changelog: v2.4.0...v2.5.0

v2.4.0

08 Feb 04:17
9554855

Choose a tag to compare

What's Changed

  • feat: add enableRawBodyParser option for webhook signature verification by @ThallesP in #106

Full Changelog: v2.3.2...v2.4.0

v2.3.2

08 Feb 03:49

Choose a tag to compare

Full Changelog: v2.3.1...v2.3.2

v2.3.1

08 Feb 03:43
d9bae18

Choose a tag to compare

What's Changed

  • feat: add global prefixes exclusion and use MiddlewareConsumer by @danielfinke in #104

Full Changelog: v2.3.0...v2.3.1

v2.3.0

08 Feb 03:39
7f14995

Choose a tag to compare

What's Changed

  • feat: add organization plugin support by @m7salam in #94

New Contributors

Full Changelog: v2.2.6...v2.3.0