@envelop/types
Advanced tools
Comparing version 1.1.0-alpha-53d0475.0 to 1.1.0-alpha-d7e3951.0
import { OnExecuteDoneEventPayload, OnExecuteDoneHookResult, OnExecuteDoneHookResultOnNextHook } from '@envelop/core'; | ||
import { ExecutionResult } from 'graphql'; | ||
/** | ||
@@ -9,3 +8,3 @@ * Returns true if the provided object implements the AsyncIterator protocol via | ||
*/ | ||
export declare function isAsyncIterable(maybeAsyncIterable: any): maybeAsyncIterable is AsyncIterableIterator<ExecutionResult>; | ||
export declare function isAsyncIterable(maybeAsyncIterable: any): maybeAsyncIterable is AsyncIterable<any>; | ||
/** | ||
@@ -12,0 +11,0 @@ * A utility function for hanlding `onExecuteDone` hook result, for simplifying the hanlding of AsyncIterable returned from `execute`. |
@@ -5,3 +5,3 @@ import type { DocumentNode, ExecutionArgs, ExecutionResult, GraphQLError, GraphQLResolveInfo, GraphQLSchema, ParseOptions, Source, SubscriptionArgs, ValidationRule } from 'graphql'; | ||
import { DefaultContext } from './context-types'; | ||
import { AsyncIterableIteratorOrValue, ExecuteFunction, ParseFunction, ValidateFunction, ValidateFunctionParameter } from '@envelop/core'; | ||
import { AsyncGeneratorOrValue, ExecuteFunction, ParseFunction, ValidateFunction, ValidateFunctionParameter } from '@envelop/core'; | ||
import { SubscribeFunction } from './graphql'; | ||
@@ -22,10 +22,2 @@ import { Plugin } from './plugin'; | ||
export declare type OnSchemaChangeHook = (options: OnSchemaChangeEventPayload) => void; | ||
export declare type OnContextErrorHandlerPayload = { | ||
/** The error or thing that got rejected or thrown */ | ||
error: unknown; | ||
/** Overwrite the error or thing that got rejected or thrown. */ | ||
setError: (err: unknown) => void; | ||
}; | ||
export declare type OnContextErrorHandler = (options: OnContextErrorHandlerPayload) => PromiseOrValue<void>; | ||
export declare type RegisterContextErrorHandler = (handler: OnContextErrorHandler) => void; | ||
/** | ||
@@ -47,6 +39,2 @@ * Payload forwarded to the onPluginInit hook. | ||
setSchema: SetSchemaFn; | ||
/** | ||
* Register an error handler used for context creation. | ||
*/ | ||
registerContextErrorHandler: RegisterContextErrorHandler; | ||
}; | ||
@@ -315,7 +303,7 @@ /** | ||
*/ | ||
result: AsyncIterableIteratorOrValue<ExecutionResult>; | ||
result: AsyncGeneratorOrValue<ExecutionResult>; | ||
/** | ||
* Replace the execution result with a new execution result. | ||
*/ | ||
setResult: (newResult: AsyncIterableIteratorOrValue<ExecutionResult>) => void; | ||
setResult: (newResult: AsyncGeneratorOrValue<ExecutionResult>) => void; | ||
}; | ||
@@ -378,7 +366,7 @@ /** | ||
*/ | ||
result: AsyncIterableIterator<ExecutionResult> | ExecutionResult; | ||
result: AsyncGenerator<ExecutionResult> | ExecutionResult; | ||
/** | ||
* Replace the current execution result with a new execution result. | ||
*/ | ||
setResult: (newResult: AsyncIterableIterator<ExecutionResult> | ExecutionResult) => void; | ||
setResult: (newResult: AsyncGenerator<ExecutionResult, void, void> | ExecutionResult) => void; | ||
}; | ||
@@ -385,0 +373,0 @@ export declare type OnSubscribeResultResultOnNextHookPayload = { |
{ | ||
"name": "@envelop/types", | ||
"version": "1.1.0-alpha-53d0475.0", | ||
"version": "1.1.0-alpha-d7e3951.0", | ||
"sideEffects": false, | ||
"peerDependencies": { | ||
"graphql": "^14.0.0 || ^15.0.0" | ||
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0" | ||
}, | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -21,3 +21,5 @@ export declare type OptionalPropertyNames<T> = { | ||
export declare type PromiseOrValue<T> = T | Promise<T>; | ||
export declare type AsyncIterableIteratorOrValue<T> = T | AsyncIterableIterator<T>; | ||
export declare type AsyncGeneratorOrValue<T> = T | AsyncGenerator<T, void, void>; | ||
/** @deprecated Use AsyncGeneratorOrValue instead. */ | ||
export declare type AsyncIterableIteratorOrValue<T> = AsyncGeneratorOrValue<T>; | ||
export declare type Maybe<T> = T | null | undefined; |
25532
640