@envelop/types
Advanced tools
Comparing version 1.1.0-alpha-1e3a5f8.0 to 1.1.0-alpha-2b0980a.0
@@ -21,2 +21,10 @@ import type { DocumentNode, ExecutionArgs, ExecutionResult, GraphQLError, GraphQLResolveInfo, GraphQLSchema, ParseOptions, Source, SubscriptionArgs, ValidationRule } from 'graphql'; | ||
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; | ||
/** | ||
@@ -38,2 +46,6 @@ * Payload forwarded to the onPluginInit hook. | ||
setSchema: SetSchemaFn; | ||
/** | ||
* Register an error handler used for context creation. | ||
*/ | ||
registerContextErrorHandler: RegisterContextErrorHandler; | ||
}; | ||
@@ -208,17 +220,3 @@ /** | ||
*/ | ||
export declare type OnEndContextBuildingHook<ContextType> = (options: AfterContextBuildingEventPayload<ContextType>) => PromiseOrValue<void>; | ||
declare type OnErrorContextBuildingHookEventPayload = { | ||
/** 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 OnErrorContextBuildingHook = (options: OnErrorContextBuildingHookEventPayload) => PromiseOrValue<void>; | ||
export declare type AfterContextBuildingHooks<ContextType> = { | ||
/** Invoked after the context was created successfully. */ | ||
onEnd?: OnEndContextBuildingHook<ContextType>; | ||
/** Invoked after the context creation failed. */ | ||
onError?: OnErrorContextBuildingHook; | ||
}; | ||
export declare type AfterContextBuildingHook<ContextType> = OnEndContextBuildingHook<ContextType> | AfterContextBuildingHooks<ContextType>; | ||
export declare type AfterContextBuildingHook<ContextType> = (options: AfterContextBuildingEventPayload<ContextType>) => PromiseOrValue<void>; | ||
/** | ||
@@ -418,2 +416,7 @@ * Invoked before the context has been builded. | ||
export declare type SubscribeResultHook = (options: OnSubscribeResultEventPayload) => void | OnSubscribeResultResult; | ||
export declare type SubscribeErrorHookPayload = { | ||
error: unknown; | ||
setError: (err: unknown) => void; | ||
}; | ||
export declare type SubscribeErrorHook = (payload: SubscribeErrorHookPayload) => void; | ||
export declare type OnSubscribeHookResult<ContextType> = { | ||
@@ -425,2 +428,6 @@ /** | ||
/** | ||
* Invoked if the source stream returned from subscribe throws an error. | ||
*/ | ||
onSubscribeError?: SubscribeErrorHook; | ||
/** | ||
* Invoked before each resolver has been invoked during the execution phase. | ||
@@ -435,2 +442,1 @@ */ | ||
export declare type OnSubscribeHook<ContextType> = (options: OnSubscribeEventPayload<ContextType>) => PromiseOrValue<void | OnSubscribeHookResult<ContextType>>; | ||
export {}; |
{ | ||
"name": "@envelop/types", | ||
"version": "1.1.0-alpha-1e3a5f8.0", | ||
"version": "1.1.0-alpha-2b0980a.0", | ||
"sideEffects": false, | ||
@@ -5,0 +5,0 @@ "peerDependencies": { |
26389
660