New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@envelop/types

Package Overview
Dependencies
Maintainers
1
Versions
629
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@envelop/types - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2-alpha-e01c930.0

context-types.d.ts

117

index.d.ts

@@ -1,112 +0,5 @@

import { DocumentNode, GraphQLSchema, Source, ParseOptions, GraphQLError, execute, parse, validate, GraphQLResolveInfo, ExecutionArgs, ExecutionResult, ValidationRule, TypeInfo, subscribe, SubscriptionArgs } from 'graphql';
export declare type EnvelopContextFnWrapper<TFunction, ContextType = unknown> = (context: ContextType) => TFunction;
declare type AfterFnOrVoid<Result> = void | ((afterOptions: Result) => void);
export declare type DefaultContext = Record<string, unknown>;
export declare type DefaultArgs = Record<string, unknown>;
export declare type BeforeAfterHook<BeforePayload, AfterPayload = unknown, Async = false> = (beforeOptions: BeforePayload) => Async extends true ? Promise<AfterFnOrVoid<AfterPayload>> | AfterFnOrVoid<AfterPayload> : AfterFnOrVoid<AfterPayload>;
export declare type AfterResolverPayload = {
result: unknown | Error;
setResult: (newResult: unknown) => void;
};
export declare type OnResolverCalledHooks<ContextType = DefaultContext, ArgsType = DefaultArgs> = BeforeAfterHook<{
root: unknown;
args: ArgsType;
context: ContextType;
info: GraphQLResolveInfo;
}, AfterResolverPayload, true>;
export declare type OnExecuteHookResult<ContextType = DefaultContext> = {
onExecuteDone?: (options: {
result: ExecutionResult;
setResult: (newResult: ExecutionResult) => void;
}) => void;
onResolverCalled?: OnResolverCalledHooks<ContextType>;
};
export declare type OnSubscribeHookResult<ContextType = DefaultContext> = {
onSubscribeResult?: (options: {
result: AsyncIterableIterator<ExecutionResult> | ExecutionResult;
setResult: (newResult: AsyncIterableIterator<ExecutionResult> | ExecutionResult) => void;
}) => void;
onResolverCalled?: OnResolverCalledHooks<ContextType>;
};
export interface Plugin<PluginContext = DefaultContext> {
onSchemaChange?: (options: {
schema: GraphQLSchema;
replaceSchema: (newSchema: GraphQLSchema) => void;
}) => void;
onPluginInit?: (options: {
addPlugin: (newPlugin: Plugin<any>) => void;
plugins: Plugin[];
setSchema: (newSchema: GraphQLSchema) => void;
}) => void;
onExecute?: (options: {
executeFn: typeof execute;
args: ExecutionArgs;
setExecuteFn: (newExecute: typeof execute) => void;
setResultAndStopExecution: (newResult: ExecutionResult) => void;
extendContext: (contextExtension: Partial<PluginContext>) => void;
}) => void | OnExecuteHookResult<PluginContext>;
onSubscribe?: (options: {
subscribeFn: typeof subscribe;
args: SubscriptionArgs;
setSubscribeFn: (newSubscribe: typeof subscribe) => void;
extendContext: (contextExtension: Partial<PluginContext>) => void;
}) => void | OnSubscribeHookResult<PluginContext>;
onParse?: BeforeAfterHook<{
context: Readonly<PluginContext>;
extendContext: (contextExtension: Partial<PluginContext>) => void;
params: {
source: string | Source;
options?: ParseOptions;
};
parseFn: typeof parse;
setParseFn: (newFn: typeof parse) => void;
setParsedDocument: (doc: DocumentNode) => void;
}, {
context: Readonly<PluginContext>;
extendContext: (contextExtension: Partial<PluginContext>) => void;
result: DocumentNode | Error | null;
replaceParseResult: (newResult: DocumentNode | Error) => void;
}, false>;
onValidate?: BeforeAfterHook<{
context: Readonly<PluginContext>;
extendContext: (contextExtension: Partial<PluginContext>) => void;
params: {
schema: GraphQLSchema;
documentAST: DocumentNode;
rules?: ReadonlyArray<ValidationRule>;
typeInfo?: TypeInfo;
options?: {
maxErrors?: number;
};
};
addValidationRule: (rule: ValidationRule) => void;
validateFn: typeof validate;
setValidationFn: (newValidate: typeof validate) => void;
setResult: (errors: readonly GraphQLError[]) => void;
}, {
context: Readonly<PluginContext>;
extendContext: (contextExtension: Partial<PluginContext>) => void;
valid: boolean;
result: readonly GraphQLError[];
}>;
onContextBuilding?: BeforeAfterHook<{
context: Readonly<PluginContext>;
extendContext: (contextExtension: Partial<PluginContext>) => void;
}, {
extendContext: (contextExtension: Partial<PluginContext>) => void;
context: PluginContext;
}, true>;
}
export declare type AfterCallback<T extends keyof Plugin<any>> = NonNullable<Plugin[T]> extends BeforeAfterHook<infer B, infer A, infer Async> ? (afterOptions: A) => void : never;
export declare type Envelop<RequestContext = unknown, GraphQLContext = DefaultContext> = {
(initialContext?: Partial<RequestContext>): {
execute: typeof execute;
validate: typeof validate;
subscribe: typeof subscribe;
parse: typeof parse;
contextFactory: (orchestratorContext?: Partial<RequestContext>) => GraphQLContext | Promise<GraphQLContext>;
schema: GraphQLSchema;
};
_plugins: Plugin[];
};
export {};
export * from './context-types';
export * from './hooks';
export * from './plugin';
export * from './get-enveloped';
export * from './utils';
{
"name": "@envelop/types",
"version": "0.2.1",
"version": "0.2.2-alpha-e01c930.0",
"sideEffects": false,

@@ -5,0 +5,0 @@ "peerDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc