@quickback-dev/cli 0.40.0 → 0.46.0
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.
- package/dist/commands/claude.d.ts.map +1 -1
- package/dist/commands/claude.js +8 -0
- package/dist/commands/claude.js.map +1 -1
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +13 -2
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/compile.test.js +26 -21
- package/dist/commands/compile.test.js.map +1 -1
- package/dist/commands/create.js +6 -9
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +0 -9
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +6 -7
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +0 -4
- package/dist/commands/whoami.js.map +1 -1
- package/dist/docs/content.d.ts.map +1 -1
- package/dist/docs/content.js +23 -33
- package/dist/docs/content.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/api-client.d.ts +0 -12
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js +0 -10
- package/dist/lib/api-client.js.map +1 -1
- package/dist/lib/api-client.test.js +13 -8
- package/dist/lib/api-client.test.js.map +1 -1
- package/dist/lib/auth.d.ts +0 -1
- package/dist/lib/auth.d.ts.map +1 -1
- package/dist/lib/auth.js.map +1 -1
- package/dist/lib/compiler-stubs.d.ts +12 -0
- package/dist/lib/compiler-stubs.d.ts.map +1 -1
- package/dist/lib/compiler-stubs.js +18 -0
- package/dist/lib/compiler-stubs.js.map +1 -1
- package/dist/lib/file-loader.d.ts +14 -0
- package/dist/lib/file-loader.d.ts.map +1 -1
- package/dist/lib/file-loader.js +63 -9
- package/dist/lib/file-loader.js.map +1 -1
- package/dist/skill/SKILL.md +76 -6
- package/dist/skill/docs/changelog.md +253 -0
- package/dist/skill/docs/compiler/cloud-compiler/authentication.md +1 -2
- package/dist/skill/docs/compiler/cloud-compiler/cli.md +7 -8
- package/dist/skill/docs/compiler/config/agents.md +49 -1
- package/dist/skill/docs/compiler/config/auth.md +20 -5
- package/dist/skill/docs/compiler/config/security.md +46 -0
- package/dist/skill/docs/compiler/definitions/access.md +1 -1
- package/dist/skill/docs/compiler/definitions/actions.md +46 -4
- package/dist/skill/docs/compiler/definitions/scopes.md +11 -3
- package/dist/skill/docs/compiler/getting-started/full-example.md +5 -3
- package/dist/skill/docs/compiler/getting-started/index.md +7 -7
- package/dist/skill/docs/compiler/getting-started/patterns.md +39 -5
- package/dist/skill/docs/compiler/getting-started/template-blog.md +65 -44
- package/dist/skill/docs/compiler/getting-started/template-cloudflare.md +4 -5
- package/dist/skill/docs/compiler/getting-started/template-empty.md +7 -1
- package/dist/skill/docs/compiler/getting-started/templates.md +6 -6
- package/dist/skill/docs/compiler/targets/hono-api/using-the-api/openapi.md +23 -0
- package/dist/skill/docs/stack/account-ui/features/passwordless.md +4 -10
- package/dist/skill/docs/stack/account-ui/hooks.md +24 -1
- package/dist/skill/docs/stack/auth/plugins/aws-ses.md +0 -7
- package/dist/skill/docs/stack/auth/plugins/index.md +71 -28
- package/dist/skill/docs/stack/storage/r2.md +8 -6
- package/dist/skill/docs/stack/storage/using-r2.md +58 -33
- package/dist/templates/registry.d.ts +0 -12
- package/dist/templates/registry.d.ts.map +1 -1
- package/dist/templates/registry.js +0 -42
- package/dist/templates/registry.js.map +1 -1
- package/package.json +1 -1
- package/src/skill/SKILL.md +76 -6
- package/src/skill/docs/changelog.md +253 -0
- package/src/skill/docs/compiler/cloud-compiler/authentication.md +1 -2
- package/src/skill/docs/compiler/cloud-compiler/cli.md +7 -8
- package/src/skill/docs/compiler/config/agents.md +49 -1
- package/src/skill/docs/compiler/config/auth.md +20 -5
- package/src/skill/docs/compiler/config/security.md +46 -0
- package/src/skill/docs/compiler/definitions/access.md +1 -1
- package/src/skill/docs/compiler/definitions/actions.md +46 -4
- package/src/skill/docs/compiler/definitions/scopes.md +11 -3
- package/src/skill/docs/compiler/getting-started/full-example.md +5 -3
- package/src/skill/docs/compiler/getting-started/index.md +7 -7
- package/src/skill/docs/compiler/getting-started/patterns.md +39 -5
- package/src/skill/docs/compiler/getting-started/template-blog.md +65 -44
- package/src/skill/docs/compiler/getting-started/template-cloudflare.md +4 -5
- package/src/skill/docs/compiler/getting-started/template-empty.md +7 -1
- package/src/skill/docs/compiler/getting-started/templates.md +6 -6
- package/src/skill/docs/compiler/targets/hono-api/using-the-api/openapi.md +23 -0
- package/src/skill/docs/stack/account-ui/features/passwordless.md +4 -10
- package/src/skill/docs/stack/account-ui/hooks.md +24 -1
- package/src/skill/docs/stack/auth/plugins/aws-ses.md +0 -7
- package/src/skill/docs/stack/auth/plugins/index.md +71 -28
- package/src/skill/docs/stack/storage/r2.md +8 -6
- package/src/skill/docs/stack/storage/using-r2.md +58 -33
- package/dist/skill/docs/stack/auth/plugins/combo-auth.md +0 -74
- package/dist/skill/docs/stack/auth/plugins/upgrade-anonymous.md +0 -155
- package/src/skill/docs/stack/auth/plugins/combo-auth.md +0 -74
- package/src/skill/docs/stack/auth/plugins/upgrade-anonymous.md +0 -155
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Combo Auth Plugin
|
|
2
|
-
|
|
3
|
-
`@quickback-dev/better-auth-combo-auth` provides a combined authentication flow that sends both a magic link and an OTP code in a single email. Users can click the link (one-click) or enter the 6-digit OTP code — whichever is more convenient.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @quickback-dev/better-auth-combo-auth
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Server Setup
|
|
12
|
-
|
|
13
|
-
Add the plugin to your Better Auth configuration:
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
import { betterAuth } from "better-auth";
|
|
17
|
-
import { comboAuth } from "@quickback-dev/better-auth-combo-auth";
|
|
18
|
-
|
|
19
|
-
export const auth = betterAuth({
|
|
20
|
-
plugins: [
|
|
21
|
-
comboAuth({
|
|
22
|
-
sendComboAuth: async ({ email, otp, url }) => {
|
|
23
|
-
// Send email with both the magic link (url) and OTP code (otp)
|
|
24
|
-
await sendEmail({
|
|
25
|
-
to: email,
|
|
26
|
-
subject: "Sign in to My App",
|
|
27
|
-
html: `
|
|
28
|
-
<p>Click the link below to sign in:</p>
|
|
29
|
-
<a href="${url}">Sign in to My App</a>
|
|
30
|
-
<p>Or enter this code: <strong>${otp}</strong></p>
|
|
31
|
-
`,
|
|
32
|
-
});
|
|
33
|
-
},
|
|
34
|
-
}),
|
|
35
|
-
],
|
|
36
|
-
});
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Client Usage
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
import { createAuthClient } from "better-auth/client";
|
|
43
|
-
import { comboAuthClient } from "@quickback-dev/better-auth-combo-auth/client";
|
|
44
|
-
|
|
45
|
-
const authClient = createAuthClient({
|
|
46
|
-
plugins: [comboAuthClient()],
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// Request authentication — sends email with link + OTP
|
|
50
|
-
await authClient.signIn.comboAuth({
|
|
51
|
-
email: "user@example.com",
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// Verify with OTP code (if user enters it manually)
|
|
55
|
-
await authClient.signIn.comboAuth({
|
|
56
|
-
email: "user@example.com",
|
|
57
|
-
otp: "123456",
|
|
58
|
-
});
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## How It Works
|
|
62
|
-
|
|
63
|
-
1. User enters their email and requests sign-in
|
|
64
|
-
2. A single email is sent containing both a magic link and a 6-digit OTP
|
|
65
|
-
3. **Option A:** User clicks the magic link — authenticated immediately
|
|
66
|
-
4. **Option B:** User enters the OTP code — authenticated after verification
|
|
67
|
-
|
|
68
|
-
This provides the best of both worlds: convenience of magic links with the reliability of OTP codes (useful when magic links don't work well, e.g., opening email on a different device).
|
|
69
|
-
|
|
70
|
-
## See Also
|
|
71
|
-
|
|
72
|
-
- [Auth Plugins](/stack/auth/plugins) — All authentication plugin options
|
|
73
|
-
- [Upgrade Anonymous](/stack/auth/plugins/upgrade-anonymous) — Convert anonymous sessions to full accounts
|
|
74
|
-
- [AWS SES](/stack/auth/plugins/aws-ses) — Email delivery for auth flows
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
# Upgrade Anonymous Plugin
|
|
2
|
-
|
|
3
|
-
`@quickback-dev/better-auth-upgrade-anonymous` provides a single endpoint to convert anonymous users into full authenticated users. It flips the `isAnonymous` flag, optionally updates email and name, and refreshes the session — no re-authentication required.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @quickback-dev/better-auth-upgrade-anonymous
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Configuration
|
|
12
|
-
|
|
13
|
-
Enable both the `anonymous` and `upgradeAnonymous` plugins:
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
auth: defineAuth("better-auth", {
|
|
17
|
-
plugins: ["anonymous", "upgradeAnonymous"],
|
|
18
|
-
})
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
The plugin accepts optional configuration:
|
|
22
|
-
|
|
23
|
-
```typescript
|
|
24
|
-
import { upgradeAnonymous } from "@quickback-dev/better-auth-upgrade-anonymous";
|
|
25
|
-
|
|
26
|
-
upgradeAnonymous({
|
|
27
|
-
emailConfigured: true, // Whether email delivery is available
|
|
28
|
-
requireEmailVerification: true, // Whether to require email verification
|
|
29
|
-
})
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
| Option | Default | Description |
|
|
33
|
-
|--------|---------|-------------|
|
|
34
|
-
| `emailConfigured` | `false` | When `true` and an email is provided, `emailVerified` is set based on `requireEmailVerification` |
|
|
35
|
-
| `requireEmailVerification` | `true` | When `true`, provided emails are marked unverified (requiring OTP). When `false`, emails are marked verified immediately |
|
|
36
|
-
|
|
37
|
-
> **Quickback Compiler**
|
|
38
|
-
>
|
|
39
|
-
> When using the Quickback compiler, these options are set automatically based on your SES environment variables. You don't need to configure them manually.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
## Endpoint
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
POST /auth/v1/upgrade-anonymous
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Flow
|
|
49
|
-
|
|
50
|
-
1. Validates the user's session (returns `401` if not authenticated)
|
|
51
|
-
2. Checks if the user is already upgraded (returns success immediately if so)
|
|
52
|
-
3. If an email is provided, checks for duplicates (returns `400` if email is taken)
|
|
53
|
-
4. Updates `isAnonymous` to `false`, plus optional `email`, `name`, and `emailVerified` fields
|
|
54
|
-
5. Refreshes the session cookie with the updated user object
|
|
55
|
-
6. Returns the updated user, session, and `verificationRequired` flag
|
|
56
|
-
|
|
57
|
-
### Request
|
|
58
|
-
|
|
59
|
-
The body is optional. When provided, it accepts:
|
|
60
|
-
|
|
61
|
-
| Field | Type | Description |
|
|
62
|
-
|-------|------|-------------|
|
|
63
|
-
| `email` | `string` (email) | Optional. Real email to replace the anonymous placeholder |
|
|
64
|
-
| `name` | `string` | Optional. User's display name |
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
# Minimal — just upgrade, no email/name
|
|
68
|
-
curl -X POST https://api.example.com/auth/v1/upgrade-anonymous \
|
|
69
|
-
-H "Cookie: better-auth.session_token=..."
|
|
70
|
-
|
|
71
|
-
# With email and name
|
|
72
|
-
curl -X POST https://api.example.com/auth/v1/upgrade-anonymous \
|
|
73
|
-
-H "Cookie: better-auth.session_token=..." \
|
|
74
|
-
-H "Content-Type: application/json" \
|
|
75
|
-
-d '{"email": "jane@example.com", "name": "Jane"}'
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Response
|
|
79
|
-
|
|
80
|
-
```json
|
|
81
|
-
{
|
|
82
|
-
"success": true,
|
|
83
|
-
"verificationRequired": true,
|
|
84
|
-
"user": {
|
|
85
|
-
"id": "usr_abc123",
|
|
86
|
-
"email": "jane@example.com",
|
|
87
|
-
"isAnonymous": false
|
|
88
|
-
},
|
|
89
|
-
"session": {
|
|
90
|
-
"id": "sess_xyz",
|
|
91
|
-
"userId": "usr_abc123"
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
The `verificationRequired` field is `true` when all three conditions are met:
|
|
97
|
-
- An email was provided in the request body
|
|
98
|
-
- `emailConfigured` is `true` in plugin config
|
|
99
|
-
- `requireEmailVerification` is `true` in plugin config
|
|
100
|
-
|
|
101
|
-
When `verificationRequired` is `true`, the frontend should send a verification OTP and redirect the user to verify their email.
|
|
102
|
-
|
|
103
|
-
## How It Works
|
|
104
|
-
|
|
105
|
-
The plugin is designed to be flexible:
|
|
106
|
-
|
|
107
|
-
- **Minimal by default** — With no body, only changes `isAnonymous` from `true` to `false`
|
|
108
|
-
- **Optional email/name** — Can update email and name in the same request
|
|
109
|
-
- **Duplicate protection** — Rejects emails already associated with another account
|
|
110
|
-
- **Verification-aware** — Returns `verificationRequired` so the frontend knows whether to trigger OTP
|
|
111
|
-
- **Session preserved** — Same session ID, no re-authentication needed
|
|
112
|
-
- **Idempotent** — Calling on an already-upgraded user returns success immediately
|
|
113
|
-
|
|
114
|
-
## Typical Flows
|
|
115
|
-
|
|
116
|
-
### Passkey Signup (no email)
|
|
117
|
-
|
|
118
|
-
1. User creates anonymous session
|
|
119
|
-
2. User registers a passkey
|
|
120
|
-
3. App calls `POST /auth/v1/upgrade-anonymous` with no body
|
|
121
|
-
4. User is now a full user with passkey auth — no email on file
|
|
122
|
-
|
|
123
|
-
### Passkey Signup (with email)
|
|
124
|
-
|
|
125
|
-
1. User creates anonymous session
|
|
126
|
-
2. User registers a passkey
|
|
127
|
-
3. User optionally enters email/name on the email collection step
|
|
128
|
-
4. App calls `POST /auth/v1/upgrade-anonymous` with `{ email, name }`
|
|
129
|
-
5. If `verificationRequired`: app sends OTP, user verifies, then redirects to dashboard
|
|
130
|
-
6. Otherwise: user goes straight to dashboard
|
|
131
|
-
|
|
132
|
-
### Email Signup
|
|
133
|
-
|
|
134
|
-
1. User starts as anonymous (created via Better Auth's `anonymous` plugin)
|
|
135
|
-
2. User provides email/password through your UI (via combo auth or signup)
|
|
136
|
-
3. Your app calls `POST /auth/v1/upgrade-anonymous`
|
|
137
|
-
4. User is now a full user with the same ID and all their data intact
|
|
138
|
-
|
|
139
|
-
### Client Plugin
|
|
140
|
-
|
|
141
|
-
```typescript
|
|
142
|
-
import { upgradeAnonymousClient } from "@quickback-dev/better-auth-upgrade-anonymous/client";
|
|
143
|
-
|
|
144
|
-
const authClient = createAuthClient({
|
|
145
|
-
plugins: [upgradeAnonymousClient()],
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
// Upgrade the current anonymous user
|
|
149
|
-
await authClient.upgradeAnonymous();
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
## See Also
|
|
153
|
-
|
|
154
|
-
- [Combo Auth Plugin](/stack/auth/plugins/combo-auth) — Combined magic link + OTP for collecting credentials
|
|
155
|
-
- [Auth Configuration](/compiler/config/providers) — Configuring auth plugins
|