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

@envelop/core

Package Overview
Dependencies
Maintainers
1
Versions
1362
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@envelop/core - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2-alpha-21f43b1.0

util.d.ts

1

create.d.ts
import { Envelop, Plugin } from '@envelop/types';
export declare const resolversHooksSymbol: unique symbol;
export declare function envelop({ plugins }: {
plugins: Plugin[];
}): Envelop;

78

index.cjs.js

@@ -8,2 +8,39 @@ 'use strict';

function getExecuteArgs(args) {
return args.length === 1
? args[0]
: {
schema: args[0],
document: args[1],
rootValue: args[2],
contextValue: args[3],
variableValues: args[4],
operationName: args[5],
fieldResolver: args[6],
typeResolver: args[7],
};
}
/**
* Utility function for making a execute function that handles polymorphic arguments.
*/
const makeExecute = (executeFn) => (...polyArgs) => executeFn(getExecuteArgs(polyArgs));
function getSubscribeArgs(args) {
return args.length === 1
? args[0]
: {
schema: args[0],
document: args[1],
rootValue: args[2],
contextValue: args[3],
variableValues: args[4],
operationName: args[5],
fieldResolver: args[6],
subscribeFieldResolver: args[7],
};
}
/**
* Utility function for making a subscribe function that handles polymorphic arguments.
*/
const makeSubscribe = (subscribeFn) => (...polyArgs) => subscribeFn(getSubscribeArgs(polyArgs));
const trackedSchemaSymbol = Symbol('TRACKED_SCHEMA');

@@ -163,15 +200,3 @@ const resolversHooksSymbol = Symbol('RESOLVERS_HOOKS');

: (ctx) => ctx;
const customSubscribe = async (argsOrSchema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, subscribeFieldResolver) => {
const args = argsOrSchema instanceof graphql.GraphQLSchema
? {
schema: argsOrSchema,
document: document,
rootValue,
contextValue,
variableValues,
operationName,
fieldResolver,
subscribeFieldResolver,
}
: argsOrSchema;
const customSubscribe = makeSubscribe(async (args) => {
const onResolversHandlers = [];

@@ -225,17 +250,5 @@ let subscribeFn = graphql.subscribe;

return result;
};
const customExecute = onExecuteCbs.length
? async (argsOrSchema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) => {
const args = argsOrSchema instanceof graphql.GraphQLSchema
? {
schema: argsOrSchema,
document: document,
rootValue,
contextValue,
variableValues,
operationName,
fieldResolver,
typeResolver,
}
: argsOrSchema;
});
const customExecute = (onExecuteCbs.length
? makeExecute(async (args) => {
const onResolversHandlers = [];

@@ -298,4 +311,4 @@ let executeFn = graphql.execute;

return result;
}
: graphql.execute;
})
: graphql.execute);
function prepareSchema() {

@@ -597,2 +610,7 @@ if (!schema || schema[trackedSchemaSymbol]) {

exports.formatError = formatError;
exports.getExecuteArgs = getExecuteArgs;
exports.getSubscribeArgs = getSubscribeArgs;
exports.makeExecute = makeExecute;
exports.makeSubscribe = makeSubscribe;
exports.resolversHooksSymbol = resolversHooksSymbol;
exports.useErrorHandler = useErrorHandler;

@@ -599,0 +617,0 @@ exports.useExtendContext = useExtendContext;

export * from '@envelop/types';
export * from './create';
export * from './util';
export * from './plugins/use-logger';

@@ -4,0 +5,0 @@ export * from './plugins/use-timing';

export * from '@envelop/types';
import { parse, specifiedRules, validate, execute, isIntrospectionType, isObjectType, defaultFieldResolver, GraphQLSchema, subscribe, getOperationAST, GraphQLError } from 'graphql';
import { parse, specifiedRules, validate, execute, isIntrospectionType, isObjectType, defaultFieldResolver, subscribe, getOperationAST, GraphQLError } from 'graphql';
function getExecuteArgs(args) {
return args.length === 1
? args[0]
: {
schema: args[0],
document: args[1],
rootValue: args[2],
contextValue: args[3],
variableValues: args[4],
operationName: args[5],
fieldResolver: args[6],
typeResolver: args[7],
};
}
/**
* Utility function for making a execute function that handles polymorphic arguments.
*/
const makeExecute = (executeFn) => (...polyArgs) => executeFn(getExecuteArgs(polyArgs));
function getSubscribeArgs(args) {
return args.length === 1
? args[0]
: {
schema: args[0],
document: args[1],
rootValue: args[2],
contextValue: args[3],
variableValues: args[4],
operationName: args[5],
fieldResolver: args[6],
subscribeFieldResolver: args[7],
};
}
/**
* Utility function for making a subscribe function that handles polymorphic arguments.
*/
const makeSubscribe = (subscribeFn) => (...polyArgs) => subscribeFn(getSubscribeArgs(polyArgs));
const trackedSchemaSymbol = Symbol('TRACKED_SCHEMA');

@@ -158,15 +195,3 @@ const resolversHooksSymbol = Symbol('RESOLVERS_HOOKS');

: (ctx) => ctx;
const customSubscribe = async (argsOrSchema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, subscribeFieldResolver) => {
const args = argsOrSchema instanceof GraphQLSchema
? {
schema: argsOrSchema,
document: document,
rootValue,
contextValue,
variableValues,
operationName,
fieldResolver,
subscribeFieldResolver,
}
: argsOrSchema;
const customSubscribe = makeSubscribe(async (args) => {
const onResolversHandlers = [];

@@ -220,17 +245,5 @@ let subscribeFn = subscribe;

return result;
};
const customExecute = onExecuteCbs.length
? async (argsOrSchema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) => {
const args = argsOrSchema instanceof GraphQLSchema
? {
schema: argsOrSchema,
document: document,
rootValue,
contextValue,
variableValues,
operationName,
fieldResolver,
typeResolver,
}
: argsOrSchema;
});
const customExecute = (onExecuteCbs.length
? makeExecute(async (args) => {
const onResolversHandlers = [];

@@ -293,4 +306,4 @@ let executeFn = execute;

return result;
}
: execute;
})
: execute);
function prepareSchema() {

@@ -581,3 +594,3 @@ if (!schema || schema[trackedSchemaSymbol]) {

export { EnvelopError, envelop, formatError, useErrorHandler, useExtendContext, useLogger, useMaskedErrors, usePayloadFormatter, useSchema, useTiming };
export { EnvelopError, envelop, formatError, getExecuteArgs, getSubscribeArgs, makeExecute, makeSubscribe, resolversHooksSymbol, useErrorHandler, useExtendContext, useLogger, useMaskedErrors, usePayloadFormatter, useSchema, useTiming };
//# sourceMappingURL=index.esm.js.map
{
"name": "@envelop/core",
"version": "0.2.1",
"version": "0.2.2-alpha-21f43b1.0",
"sideEffects": false,

@@ -9,3 +9,3 @@ "peerDependencies": {

"dependencies": {
"@envelop/types": "0.1.4"
"@envelop/types": "0.1.5-alpha-21f43b1.0"
},

@@ -12,0 +12,0 @@ "repository": {

@@ -135,4 +135,3 @@ ## `@envelop/core`

```ts
import { envelop, useSchema } from '@envelop/core';
import { useMaskedErrors, EnvelopError } from '@envelop/masked-errors';
import { envelop, useSchema, useMaskedErrors, EnvelopError } from '@envelop/core';
import { makeExecutableSchema } from 'graphql';

@@ -139,0 +138,0 @@

Sorry, the diff of this file is not supported yet

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