@@ -3,8 +3,8 @@ import { actor, UserError } from "@rivetkit/core";
33// Basic auth actor - requires API key
44export const authActor = actor ( {
55 state : { requests : 0 } ,
6- onAuth : ( params ) => {
7- const apiKey = ( params as any ) ?. apiKey ;
6+ onAuth : ( opts , params : { apiKey ?: string } | undefined ) => {
7+ const apiKey = params ?. apiKey ;
88 if ( ! apiKey ) {
99 throw new UserError ( "API key required" , { code : "missing_auth" } ) ;
1010 }
@@ -27,9 +27,9 @@ export const authActor = actor({
2727// Intent-specific auth actor - checks different permissions for different intents
2828export const intentAuthActor = actor ( {
2929 state : { value : 0 } ,
30- onAuth : ( params , { request, intents } ) => {
30+ onAuth : ( { request, intents } , params : { role : string } ) => {
3131 console . log ( "intents" , intents , params ) ;
32- const role = ( params as any ) ? .role ;
32+ const role = params . role ;
3333
3434 if ( intents . has ( "create" ) && role !== "admin" ) {
3535 throw new UserError ( "Admin role required for create operations" , {
@@ -80,8 +80,8 @@ export const noAuthActor = actor({
8080// Async auth actor - tests promise-based authentication
8181export const asyncAuthActor = actor ( {
8282 state : { count : 0 } ,
83- onAuth : async ( params ) => {
84- const token = ( params as any ) ?. token ;
83+ onAuth : async ( opts , params : { token ?: string } | undefined ) => {
84+ const token = params ?. token ;
8585 if ( ! token ) {
8686 throw new UserError ( "Token required" , { code : "missing_token" } ) ;
8787 }
0 commit comments