@autonoma-ai/server-web 0.1.3 → 0.1.7
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/README.md +8 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ export const POST = createHandler({
|
|
|
24
24
|
signingSecret: process.env.AUTONOMA_SIGNING_SECRET!,
|
|
25
25
|
auth: async (user) => {
|
|
26
26
|
const session = await createSession(user.id as string)
|
|
27
|
-
return {
|
|
27
|
+
return { headers: { Authorization: `Bearer ${session.token}` } }
|
|
28
28
|
},
|
|
29
29
|
})
|
|
30
30
|
```
|
|
@@ -60,7 +60,7 @@ Bun.serve({
|
|
|
60
60
|
|
|
61
61
|
## Auth callback
|
|
62
62
|
|
|
63
|
-
The `auth` callback receives the first `User` created during setup and must return
|
|
63
|
+
The `auth` callback receives the first `User` record created during setup (or `null` if no User model exists) and must return credentials for the test runner to authenticate:
|
|
64
64
|
|
|
65
65
|
```typescript
|
|
66
66
|
// Session cookie
|
|
@@ -74,7 +74,12 @@ auth: async (user) => {
|
|
|
74
74
|
// Bearer token
|
|
75
75
|
auth: async (user) => {
|
|
76
76
|
const token = jwt.sign({ sub: user.id }, SECRET)
|
|
77
|
-
return { token }
|
|
77
|
+
return { headers: { Authorization: `Bearer ${token}` } }
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Username + password (for login-page flows)
|
|
81
|
+
auth: async (user) => {
|
|
82
|
+
return { credentials: { email: user.email as string, password: 'TestP@ssw0rd123!' } }
|
|
78
83
|
}
|
|
79
84
|
```
|
|
80
85
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autonoma-ai/server-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Web standard (Hono, Next App Router, Bun, Deno) server adapter for Autonoma SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@autonoma-ai/sdk": "0.1.
|
|
19
|
+
"@autonoma-ai/sdk": "0.1.7"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^22.0.0",
|