Skip to content

Commit

Permalink
introduce ValidatedExecutionArgs (#4210)
Browse files Browse the repository at this point in the history
to safely export buildExecutionContext() as validateExecutionArgs()

motivation: this will allow us to:

1. export `executeOperation()` and `executeSubscription()` for those who would like to use directly.
2. add a `perEventExecutor` option to `ExecutionArgs` that allows one to pass a custom context for execution of each execution event, with the opportunity to clean up the context on return, a la #2485 and #3071, addressing #894, which would not require re-coercion of variables.

The signature of the `perEventExecutor` option would be:

```ts
type SubscriptionEventExecutor = ( validatedExecutionArgs: ValidatedExecutionArgs): PromiseOrValue<ExecutionResult>
```

rather than:

```ts
type SubscriptionEventExecutor = ( executionArgs: ExecutionArgs): PromiseOrValue<ExecutionResult>
```

This might be a first step to integrating `subscribe()` completely into `execute()` (see: graphql/graphql-js#3644) but is also a reasonable stopping place.
  • Loading branch information
yaacovCR authored Oct 1, 2024
1 parent b751310 commit a1d22a2
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 95 deletions.
Loading

0 comments on commit a1d22a2

Please sign in to comment.