@autonoma-ai/server-web 0.1.11 → 0.1.13

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 (2) hide show
  1. package/README.md +8 -7
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -15,14 +15,15 @@ pnpm add @autonoma-ai/sdk @autonoma-ai/sdk-prisma @autonoma-ai/server-web
15
15
  ```typescript
16
16
  // app/api/autonoma/route.ts
17
17
  import { createHandler } from '@autonoma-ai/server-web'
18
- import { prismaAdapter } from '@autonoma-ai/sdk-prisma'
18
+ import { prismaExecutor } from '@autonoma-ai/sdk-prisma'
19
19
  import { prisma } from '@/lib/db'
20
20
 
21
21
  export const POST = createHandler({
22
- adapter: prismaAdapter(prisma, { scopeField: 'organizationId' }),
22
+ executor: prismaExecutor(prisma),
23
+ scopeField: 'organizationId',
23
24
  sharedSecret: process.env.AUTONOMA_SHARED_SECRET!,
24
25
  signingSecret: process.env.AUTONOMA_SIGNING_SECRET!,
25
- auth: async (user) => {
26
+ auth: async (user, context) => {
26
27
  const session = await createSession(user.id as string)
27
28
  return { headers: { Authorization: `Bearer ${session.token}` } }
28
29
  },
@@ -60,11 +61,11 @@ Bun.serve({
60
61
 
61
62
  ## Auth callback
62
63
 
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
+ The `auth` callback receives the first `User` record created during setup (or `null` if no User model exists) and a context object with `scopeValue` and `refs`. It must return credentials for the test runner to authenticate:
64
65
 
65
66
  ```typescript
66
67
  // Session cookie
67
- auth: async (user) => {
68
+ auth: async (user, context) => {
68
69
  const session = await createSession(user.id as string)
69
70
  return {
70
71
  cookies: [{ name: 'session', value: session.token, httpOnly: true, sameSite: 'lax', path: '/' }],
@@ -72,13 +73,13 @@ auth: async (user) => {
72
73
  }
73
74
 
74
75
  // Bearer token
75
- auth: async (user) => {
76
+ auth: async (user, context) => {
76
77
  const token = jwt.sign({ sub: user.id }, SECRET)
77
78
  return { headers: { Authorization: `Bearer ${token}` } }
78
79
  }
79
80
 
80
81
  // Username + password (for login-page flows)
81
- auth: async (user) => {
82
+ auth: async (user, context) => {
82
83
  return { credentials: { email: user.email as string, password: 'TestP@ssw0rd123!' } }
83
84
  }
84
85
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autonoma-ai/server-web",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
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.11"
19
+ "@autonoma-ai/sdk": "0.1.13"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/node": "^22.0.0",