@velajs/better-auth 0.1.0 → 0.1.2

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/LICENSE +21 -0
  3. package/package.json +2 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,41 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@velajs/better-auth` are documented here. The format
4
+ follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
+
6
+ ## [Unreleased]
7
+
8
+ ## [0.1.0] — 2026-05-13
9
+
10
+ ### Added
11
+
12
+ - `BetterAuthModule.forRoot` / `forRootAsync` — wires a pre-constructed
13
+ `betterAuth({...})` instance into a Vela application. `isGlobal` registers
14
+ `AuthGuard` as `APP_GUARD` (deny-by-default).
15
+ - `AuthGuard` — singleton guard that reads `auth.api.getSession({ headers })`
16
+ and populates `REQUEST_CONTEXT` with the user and session.
17
+ - `RolesGuard` — reads `@Roles([...])` metadata and compares against
18
+ `user.role` (compatible with better-auth's admin plugin field).
19
+ - `@CurrentUser()` / `@CurrentSession()` — lazy parameter decorators built on
20
+ `createLazyParamDecorator`, so they correctly observe guard-populated state.
21
+ - `@Public(true)` / `@OptionalAuth(true)` — class- and method-level overrides.
22
+ - `@Roles([...])` — typed `Reflector.createDecorator<string[]>` for role gating.
23
+ - `BETTER_AUTH` injection token — exposes the live `betterAuth()` instance to
24
+ any vela service or controller via `@Inject(BETTER_AUTH)`.
25
+ - `BetterAuthCatchallController` — auto-mounts `/api/auth/*` (delegates to
26
+ `auth.handler`). Marked `@Public(true)` so the global guard never blocks
27
+ better-auth's own routes. Opt out with `mountHandler: false`.
28
+ - `examples/auth-lab` — end-to-end smoke (13 in-process checks) demonstrating
29
+ sign-up / sign-in / sign-out / protected route / public route / service
30
+ injection with `better-auth`'s `memoryAdapter`.
31
+
32
+ ### Notes
33
+
34
+ - Edge-clean: `dist/` contains no `node:*` imports, `Buffer`, or `process.*`
35
+ references. Edge-safety of the runtime ultimately depends on the database
36
+ adapter the consumer chooses; see the README's adapter matrix.
37
+ - Requires `@velajs/vela ≥ 1.6.0` (introduces `createLazyParamDecorator`).
38
+ - Peer-deps `better-auth ≥ 1.2.0`, `hono ≥ 4`.
39
+
40
+ [Unreleased]: https://github.com/velajs/better-auth/compare/v0.1.0...HEAD
41
+ [0.1.0]: https://github.com/velajs/better-auth/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kauan Guesser
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velajs/better-auth",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "better-auth integration for the Vela framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -49,6 +49,7 @@
49
49
  "devDependencies": {
50
50
  "@swc/cli": "^0.8.0",
51
51
  "@swc/core": "^1.15.11",
52
+ "@velajs/testing": "^0.2.1",
52
53
  "@velajs/vela": "^1.6.0",
53
54
  "better-auth": "^1.2.0",
54
55
  "hono": "^4",