Skip to content

Conversation

pavelgj
Copy link
Collaborator

@pavelgj pavelgj commented Nov 22, 2024

    const act = action(
      {
        name: 'foo',
        inputSchema: z.string(),
        outputSchema: z.number(),
      },
      async (input, { sendChunk, context }) => {
        checkAuth(context);
        sendChunk(1);
        sendChunk(2);
        sendChunk(3);
        return input.length;
      }
    );

    const chunks: any[] = [];
    await act('1234', {
      context: { user: 'pavel' },
      onChunk: (c) => chunks.push(c),
    });

Checklist (if applicable):

  • Tested (manually, unit tested, etc.)

@pavelgj pavelgj requested review from mbleigh and apascal07 November 22, 2024 02:19
@pavelgj pavelgj requested a review from apascal07 November 25, 2024 14:25
@pavelgj pavelgj merged commit f4261f9 into main Nov 26, 2024
4 checks passed
@pavelgj pavelgj deleted the pj/actionContextAndStreaming branch November 26, 2024 17:45
pavelgj added a commit that referenced this pull request Nov 30, 2024
pavelgj added a commit that referenced this pull request Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants