@launchframe/mcp 1.1.1 → 1.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.
|
@@ -15,14 +15,14 @@ All routes are protected by default via the global `BetterAuthGuard` (registered
|
|
|
15
15
|
|------|-------------|
|
|
16
16
|
| `business_user` | Default role for all registered users |
|
|
17
17
|
| `superadmin` | Granted via admin panel; full access |
|
|
18
|
-
| `
|
|
18
|
+
| `customer` | B2B2C variant only — end-customer of the SaaS |
|
|
19
19
|
|
|
20
20
|
## Session Flow
|
|
21
21
|
|
|
22
22
|
1. Request hits `BetterAuthGuard`
|
|
23
23
|
2. Guard checks for `@AllowAnonymous` / `@OptionalAuth` metadata
|
|
24
24
|
3. Calls `auth.api.getSession({ headers })` via Better Auth
|
|
25
|
-
4. Rejects `
|
|
25
|
+
4. Rejects `customer` on non-`@CustomerPortal` routes
|
|
26
26
|
5. Attaches `request.session` and `request.user`
|
|
27
27
|
|
|
28
28
|
## Decorators
|
|
@@ -32,7 +32,7 @@ All routes are protected by default via the global `BetterAuthGuard` (registered
|
|
|
32
32
|
| `@AllowAnonymous()` | Route is fully public — no auth check |
|
|
33
33
|
| `@Public()` | Alias for `@AllowAnonymous()` |
|
|
34
34
|
| `@OptionalAuth()` | Auth checked but not required; `request.user` may be undefined |
|
|
35
|
-
| `@CustomerPortal()` | Allows `
|
|
35
|
+
| `@CustomerPortal()` | Allows `customer` role (B2B2C variant) |
|
|
36
36
|
| `@UserSession()` | Param decorator — injects the `User` from session |
|
|
37
37
|
| `@Session()` | Param decorator — injects full `{ user, session }` object |
|
|
38
38
|
|
|
@@ -20,7 +20,7 @@ Extends Base by adding workspace/project isolation.
|
|
|
20
20
|
|
|
21
21
|
### B2B2C
|
|
22
22
|
Extends Base by adding a separate customer-facing experience (end-users of your customers).
|
|
23
|
-
- Adds `
|
|
23
|
+
- Adds `customer` role
|
|
24
24
|
- Adds `customers-portal` frontend service
|
|
25
25
|
- Adds `@CustomerPortal()` route decorator for customer-only endpoints
|
|
26
26
|
- B2B2C can also be combined with multi-tenancy
|
package/dist/tools/auth.js
CHANGED
|
@@ -28,8 +28,8 @@ import { User } from '../users/user.entity';
|
|
|
28
28
|
@OptionalAuth()
|
|
29
29
|
@Get('route')
|
|
30
30
|
handler(@UserSession() user?: User) { ... }`,
|
|
31
|
-
customer_portal: `// Accessible by
|
|
32
|
-
// Without this decorator,
|
|
31
|
+
customer_portal: `// Accessible by customer role (B2B2C variant only)
|
|
32
|
+
// Without this decorator, customer gets 401
|
|
33
33
|
import { CustomerPortal, UserSession } from '../auth/auth.decorator';
|
|
34
34
|
import { User } from '../users/user.entity';
|
|
35
35
|
|
|
@@ -81,7 +81,7 @@ handler(@Session() session: { user: any; session: any }) {
|
|
|
81
81
|
// Source: src/modules/auth/better-auth.guard.ts
|
|
82
82
|
// Applied globally in app.module.ts as APP_GUARD.
|
|
83
83
|
// Allows: business_user, superadmin
|
|
84
|
-
// Blocks: unauthenticated,
|
|
84
|
+
// Blocks: unauthenticated, customer (unless @CustomerPortal())
|
|
85
85
|
// You never need to add this manually.`,
|
|
86
86
|
credits: `// CreditsGuard — deducts credits per request based on @DeductCredits(n).
|
|
87
87
|
// Source: src/modules/credits/guards/credits.guard.ts
|