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

graphile-build

Package Overview
Dependencies
Maintainers
1
Versions
171
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphile-build - npm Package Compare versions

Comparing version 4.10.0 to 4.11.0

71

node8plus/makeNewBuild.js

@@ -620,2 +620,73 @@ "use strict";

};
} else if (Type === GraphQLInterfaceType) {
const commonContext = {
type: "GraphQLInterfaceType",
scope
};
newSpec = builder.applyHooks(this, "GraphQLInterfaceType", newSpec, commonContext, `|${newSpec.name}`);
const rawSpec = newSpec;
newSpec = { ...newSpec,
fields: () => {
const processedFields = [];
const fieldsContext = { ...commonContext,
Self,
GraphQLInterfaceType: rawSpec,
fieldWithHooks: (fieldName, spec, fieldScope) => {
if (!isString(fieldName)) {
throw new Error("It looks like you forgot to pass the fieldName to `fieldWithHooks`, we're sorry this is currently necessary.");
}
if (!fieldScope) {
throw new Error("All calls to `fieldWithHooks` must specify a `fieldScope` " + "argument that gives additional context about the field so " + "that further plugins may more easily understand the field. " + "Keys within this object should contain the phrase 'field' " + "since they will be merged into the parent objects scope and " + "are not allowed to clash. If you really have no additional " + "information to give, please just pass `{}`.");
}
let newSpec = spec;
const context = { ...commonContext,
Self,
scope: (0, _extend.default)((0, _extend.default)({ ...scope
}, {
fieldName
}, `Within context for GraphQLInterfaceType '${rawSpec.name}'`), fieldScope, `Extending scope for field '${fieldName}' within context for GraphQLInterfaceType '${rawSpec.name}'`)
};
if (typeof newSpec === "function") {
newSpec = newSpec(context);
}
newSpec = builder.applyHooks(this, "GraphQLInterfaceType:fields:field", newSpec, context, `|${getNameFromType(Self)}.fields.${fieldName}`);
newSpec.args = newSpec.args || {};
newSpec = { ...newSpec,
args: builder.applyHooks(this, "GraphQLInterfaceType:fields:field:args", newSpec.args, { ...context,
field: newSpec,
returnType: newSpec.type
}, `|${getNameFromType(Self)}.fields.${fieldName}`)
};
const finalSpec = newSpec;
processedFields.push(finalSpec);
return finalSpec;
}
};
let rawFields = rawSpec.fields || {};
if (typeof rawFields === "function") {
rawFields = rawFields(fieldsContext);
}
const fieldsSpec = builder.applyHooks(this, "GraphQLInterfaceType:fields", this.extend({}, rawFields, `Default field included in newWithHooks call for '${rawSpec.name}'. ${inScope.__origin || ""}`), fieldsContext, `|${rawSpec.name}`); // Finally, check through all the fields that they've all been processed; any that have not we should do so now.
for (const fieldName in fieldsSpec) {
const fieldSpec = fieldsSpec[fieldName];
if (processedFields.indexOf(fieldSpec) < 0) {
// We've not processed this yet; process it now!
fieldsSpec[fieldName] = fieldsContext.fieldWithHooks(fieldName, fieldSpec, {
autoField: true // We don't have any additional information
});
}
}
return fieldsSpec;
}
};
}

@@ -622,0 +693,0 @@

@@ -17,2 +17,3 @@ import {

GraphQLUnionTypeConfig,
GraphQLInterfaceTypeConfig,
} from "graphql";

@@ -186,3 +187,31 @@ import { EventEmitter } from "events";

): void;
hook<TSource, TContext>(
hookName: "GraphQLInterfaceType",
fn: Hook<GraphQLInterfaceTypeConfig<TSource, TContext>>,
provides?: Array<string>,
before?: Array<string>,
after?: Array<string>
): void;
hook<TSource, TContext>(
hookName: "GraphQLInterfaceType:fields",
fn: Hook<GraphQLFieldConfigMap<TSource, TContext>>,
provides?: Array<string>,
before?: Array<string>,
after?: Array<string>
): void;
hook<TSource, TContext>(
hookName: "GraphQLInterfaceType:fields:field",
fn: Hook<GraphQLFieldConfig<TSource, TContext>>,
provides?: Array<string>,
before?: Array<string>,
after?: Array<string>
): void;
hook(
hookName: "GraphQLInterfaceType:fields:field:args",
fn: Hook<GraphQLFieldConfigArgumentMap>,
provides?: Array<string>,
before?: Array<string>,
after?: Array<string>
): void;
hook(
hookName: "finalize",

@@ -189,0 +218,0 @@ fn: Hook<GraphQLSchema>,

23

node8plus/SchemaBuilder.js

@@ -99,3 +99,15 @@ "use strict";

GraphQLUnionType: [],
"GraphQLUnionType:types": []
"GraphQLUnionType:types": [],
// When creating a GraphQLInterfaceType via `newWithHooks`, we'll
// execute, the following hooks:
// - 'GraphQLInterfaceType' to add any root-level attributes, e.g. add a description
// - 'GraphQLInterfaceType:fields' to add additional fields to this interface type (is
// ran asynchronously and gets a reference to the final GraphQL Interface as
// `Self` in the context)
// - 'GraphQLInterfaceType:fields:field' to customise an individual field from above
// - 'GraphQLInterfaceType:fields:field:args' to customize the arguments to a field
GraphQLInterfaceType: [],
"GraphQLInterfaceType:fields": [],
"GraphQLInterfaceType:fields:field": [],
"GraphQLInterfaceType:fields:field:args": []
};

@@ -329,3 +341,10 @@ }

});
this._generatedSchema = this.applyHooks(build, "finalize", schema, {}, "Finalising GraphQL schema");
const hookedSchema = this.applyHooks(build, "finalize", schema, {}, "Finalising GraphQL schema");
const errors = build.graphql.validateSchema(hookedSchema);
if (errors && errors.length) {
throw new Error("GraphQL schema is invalid:\n" + errors.map(e => `- ` + e.message.replace(/\n/g, "\n ")).join("\n"));
}
this._generatedSchema = hookedSchema;
}

@@ -332,0 +351,0 @@

12

package.json
{
"name": "graphile-build",
"version": "4.10.0",
"version": "4.11.0",
"description": "Build a GraphQL schema from plugins",

@@ -14,3 +14,3 @@ "main": "node8plus/index.js",

"type": "git",
"url": "git+https://github.com/graphile/graphile-build.git"
"url": "git+https://github.com/graphile/graphile-engine.git"
},

@@ -30,10 +30,10 @@ "keywords": [

"bugs": {
"url": "https://github.com/graphile/graphile-build/issues"
"url": "https://github.com/graphile/graphile-engine/issues"
},
"homepage": "https://graphile.org/graphile-build/",
"dependencies": {
"@graphile/lru": "4.9.0",
"@graphile/lru": "4.11.0",
"chalk": "^2.4.2",
"debug": "^4.1.1",
"graphql-parse-resolve-info": "4.10.0",
"graphql-parse-resolve-info": "4.11.0",
"iterall": "^1.2.2",

@@ -62,3 +62,3 @@ "lodash": ">=4 <5",

],
"gitHead": "c20e6827fa3fd1de9029b9cb77de71bf75a61f5a"
"gitHead": "742133b9064cd64d61e45edc981261a036d56c7f"
}

@@ -40,2 +40,3 @@ # graphile-build

<td align="center"><a href="https://storyscript.com/?utm_source=postgraphile"><img src="https://graphile.org/images/sponsors/storyscript.png" width="90" height="90" alt="Storyscript" /><br />Storyscript</a> *</td>
<td align="center"><a href="https://surge.io/"><img src="https://graphile.org/images/sponsors/surge.png" width="90" height="90" alt="Surge.io" /><br />Surge.io</a> *</td>
<td align="center"><a href="https://postlight.com/?utm_source=graphile"><img src="https://graphile.org/images/sponsors/postlight.jpg" width="90" height="90" alt="Postlight" /><br />Postlight</a> *</td>

@@ -42,0 +43,0 @@ </tr></table>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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