Skip to content

Commit

Permalink
introduce new execute exports (graphql#4215)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacovCR authored Oct 7, 2024
1 parent be674ac commit c075a89
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/execution/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ export function experimentalExecuteIncrementally(
return { errors: validatedExecutionArgs };
}

return executeQueryOrMutationOrSubscriptionEvent(validatedExecutionArgs);
return experimentalExecuteQueryOrMutationOrSubscriptionEvent(
validatedExecutionArgs,
);
}

/**
Expand All @@ -288,7 +290,16 @@ export function experimentalExecuteIncrementally(
* at which point we still log the error and null the parent field, which
* in this case is the entire response.
*/
function executeQueryOrMutationOrSubscriptionEvent(
export function executeQueryOrMutationOrSubscriptionEvent(
validatedExecutionArgs: ValidatedExecutionArgs,
): PromiseOrValue<ExecutionResult> {
const result = experimentalExecuteQueryOrMutationOrSubscriptionEvent(
validatedExecutionArgs,
);
return ensureSinglePayload(result);
}

export function experimentalExecuteQueryOrMutationOrSubscriptionEvent(
validatedExecutionArgs: ValidatedExecutionArgs,
): PromiseOrValue<ExecutionResult | ExperimentalIncrementalExecutionResults> {
const exeContext: ExecutionContext = {
Expand Down Expand Up @@ -1981,10 +1992,7 @@ function mapSourceToResponse(
export function executeSubscriptionEvent(
validatedExecutionArgs: ValidatedExecutionArgs,
): PromiseOrValue<ExecutionResult> {
const result = executeQueryOrMutationOrSubscriptionEvent(
validatedExecutionArgs,
);
return ensureSinglePayload(result);
return executeQueryOrMutationOrSubscriptionEvent(validatedExecutionArgs);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/execution/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ export { pathToArray as responsePathAsArray } from '../jsutils/Path.js';
export {
createSourceEventStream,
execute,
executeQueryOrMutationOrSubscriptionEvent,
executeSubscriptionEvent,
experimentalExecuteIncrementally,
experimentalExecuteQueryOrMutationOrSubscriptionEvent,
executeSync,
defaultFieldResolver,
defaultTypeResolver,
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,10 @@ export type {
// Execute GraphQL queries.
export {
execute,
executeQueryOrMutationOrSubscriptionEvent,
executeSubscriptionEvent,
experimentalExecuteIncrementally,
experimentalExecuteQueryOrMutationOrSubscriptionEvent,
executeSync,
defaultFieldResolver,
defaultTypeResolver,
Expand Down

0 comments on commit c075a89

Please sign in to comment.