Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-extensions

Package Overview
Dependencies
Maintainers
2
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-extensions - npm Package Compare versions

Comparing version 0.1.0-beta.4 to 0.1.0-beta.5

10

lib/index.d.ts
import { GraphQLSchema, GraphQLField, GraphQLResolveInfo, ExecutionArgs } from 'graphql';
export declare type EndHandler = () => void;
export declare type EndHandler = (err: Error | null) => void;
export declare class GraphQLExtension<TContext = any> {

@@ -7,3 +7,5 @@ requestDidStart?(o: {

}): EndHandler | void;
parsingDidStart?(): EndHandler | void;
parsingDidStart?(o: {
queryString: string;
}): EndHandler | void;
validationDidStart?(): EndHandler | void;

@@ -24,3 +26,5 @@ executionDidStart?(o: {

}): EndHandler;
parsingDidStart(): EndHandler;
parsingDidStart(o: {
queryString: string;
}): EndHandler;
validationDidStart(): EndHandler;

@@ -27,0 +31,0 @@ executionDidStart(o: {

@@ -17,4 +17,4 @@ "use strict";

};
GraphQLExtensionStack.prototype.parsingDidStart = function () {
return this.handleDidStart(function (ext) { return ext.parsingDidStart && ext.parsingDidStart(); });
GraphQLExtensionStack.prototype.parsingDidStart = function (o) {
return this.handleDidStart(function (ext) { return ext.parsingDidStart && ext.parsingDidStart(o); });
};

@@ -59,3 +59,3 @@ GraphQLExtensionStack.prototype.validationDidStart = function () {

});
return function () {
return function (err) {
// We run end handlers in reverse order of start handlers. That way, the

@@ -65,3 +65,3 @@ // first handler in the stack "surrounds" the entire event's process

endHandlers.reverse();
endHandlers.forEach(function (endHandler) { return endHandler(); });
endHandlers.forEach(function (endHandler) { return endHandler(err); });
};

@@ -68,0 +68,0 @@ };

{
"name": "graphql-extensions",
"version": "0.1.0-beta.4",
"version": "0.1.0-beta.5",
"description": "Add extensions to GraphQL servers",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -11,3 +11,3 @@ import {

export type EndHandler = () => void;
export type EndHandler = (err: Error | null) => void;
type StartHandler = () => EndHandler | void;

@@ -22,6 +22,8 @@ // A StartHandlerInvoker is a function that, given a specific GraphQLExtension,

export class GraphQLExtension<TContext = any> {
public requestDidStart?(o: {request: Request}): EndHandler | void;
public parsingDidStart?(): EndHandler | void;
public requestDidStart?(o: { request: Request }): EndHandler | void;
public parsingDidStart?(o: { queryString: string }): EndHandler | void;
public validationDidStart?(): EndHandler | void;
public executionDidStart?(o: {executionArgs: ExecutionArgs}): EndHandler | void;
public executionDidStart?(o: {
executionArgs: ExecutionArgs;
}): EndHandler | void;

@@ -45,13 +47,21 @@ public willResolveField?(

public requestDidStart(o: {request: Request}): EndHandler {
return this.handleDidStart(ext => ext.requestDidStart && ext.requestDidStart(o));
public requestDidStart(o: { request: Request }): EndHandler {
return this.handleDidStart(
ext => ext.requestDidStart && ext.requestDidStart(o),
);
}
public parsingDidStart(): EndHandler {
return this.handleDidStart(ext => ext.parsingDidStart && ext.parsingDidStart());
public parsingDidStart(o: { queryString: string }): EndHandler {
return this.handleDidStart(
ext => ext.parsingDidStart && ext.parsingDidStart(o),
);
}
public validationDidStart(): EndHandler {
return this.handleDidStart(ext => ext.validationDidStart && ext.validationDidStart());
return this.handleDidStart(
ext => ext.validationDidStart && ext.validationDidStart(),
);
}
public executionDidStart(o: {executionArgs: ExecutionArgs}): EndHandler {
return this.handleDidStart(ext => ext.executionDidStart && ext.executionDidStart(o));
public executionDidStart(o: { executionArgs: ExecutionArgs }): EndHandler {
return this.handleDidStart(
ext => ext.executionDidStart && ext.executionDidStart(o),
);
}

@@ -98,3 +108,3 @@

});
return () => {
return (err: Error | null) => {
// We run end handlers in reverse order of start handlers. That way, the

@@ -104,3 +114,3 @@ // first handler in the stack "surrounds" the entire event's process

endHandlers.reverse();
endHandlers.forEach(endHandler => endHandler());
endHandlers.forEach(endHandler => endHandler(err));
};

@@ -107,0 +117,0 @@ }

Sorry, the diff of this file is not supported yet

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