Skip to content

Conversation

@pavelgj
Copy link
Collaborator

@pavelgj pavelgj commented May 7, 2024

Action now have middleware support. Removed models specific implementation, models now use common middleware.

Ex:

    const act = action({
      name: 'foo',
      inputSchema: z.string(),
      outputSchema: z.number(),
      use: [
        async (input, next) => await next(input + 'middle1') + 1,
        async (input, next) => await next(input + 'middle2') + 2,
      ]
    }, async (input) => {
      return input.length
    });
@pavelgj pavelgj requested review from MichaelDoyle and mbleigh May 7, 2024 14:39
@MichaelDoyle
Copy link
Member

Thanks, Pavel! 🤙🏼 ✨

@pavelgj pavelgj merged commit 1c1f9a2 into main May 7, 2024
@pavelgj pavelgj deleted the pavelgj/actionmiddleware branch May 7, 2024 15:57
@mbleigh
Copy link
Collaborator

mbleigh commented May 7, 2024

I've been meaning to revive this for weeks, thanks Pavel! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants