Skip to content

Conversation

@ianmacartney
Copy link
Contributor

Currently the WorkflowCtx doesn't match Pick<MutationCtx, "runMutation"> or similar. This explores what it'd take to make that easier.

Currently components that want to work with Workflow have to define their runMutation like so:

export type RunMutationCtx = RunQueryCtx & {
  runMutation: <Mutation extends FunctionReference<"mutation", "internal">>(
    mutation: Mutation,
    args: FunctionArgs<Mutation>,
  ) => Promise<FunctionReturnType<Mutation>>;
};
  • only "internal" functions as args
  • args is a required argument, not allowed to omit it

FYI @thomasballinger this captures the delta between our ctx and workflow right now. scoping to "internal" is maybe overkill - was just trying to avoid people accidentally exposing their steps


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 13, 2025

Open in StackBlitz

npm i https://pkg.pr.new/get-convex/workflow/@convex-dev/workflow@165

commit: 970e780

@ecwyne
Copy link

ecwyne commented Nov 13, 2025

@ianmacartney I just ran in to only allowing internal queries/mutations/actions today. I do have some queries/actions that I'm also using publicly and to do so I need to export duplicate implementations (one public and one internal). Would love to have that restriction to internal lifted

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants