Socket
Socket
Sign inDemoInstall

graphile-build

Package Overview
Dependencies
Maintainers
1
Versions
167
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.0.0-rc.4 to 4.0.0-rc.5

16

node8plus/makeNewBuild.js

@@ -32,2 +32,6 @@ "use strict";

var _resolveNode = require("./resolveNode");
var _resolveNode2 = _interopRequireDefault(_resolveNode);
var _extend = require("./extend");

@@ -46,2 +50,3 @@

const isString = str => typeof str === "string";
const isDev = ["test", "development"].indexOf(process.env.NODE_ENV) >= 0;

@@ -220,3 +225,3 @@ const debug = (0, _debug2.default)("graphile-build");

extend: _extend2.default,
newWithHooks(Type, spec, inScope, returnNullOnInvalid = false) {
newWithHooks(Type, spec, inScope, performNonEmptyFieldsCheck = false) {
const scope = inScope || {};

@@ -489,3 +494,3 @@ if (!inScope) {

const Self = new Type(finalSpec);
if (!(Self instanceof GraphQLSchema) && returnNullOnInvalid) {
if (!(Self instanceof GraphQLSchema) && performNonEmptyFieldsCheck) {
try {

@@ -505,2 +510,5 @@ if (Self instanceof GraphQLInterfaceType || Self instanceof GraphQLObjectType || Self instanceof GraphQLInputObjectType) {

// https://github.com/graphql/graphql-js/blob/831598ba76f015078ecb6c5c1fbaf133302f3f8e/src/type/definition.js#L526-L531
if (inScope && inScope.isRootQuery) {
throw e;
}
const isProbablyAnEmptyObjectError = !!e.message.match(/function which returns such an object/);

@@ -534,5 +542,7 @@ if (!isProbablyAnEmptyObjectError) {

},
swallowError: _swallowError2.default
swallowError: _swallowError2.default,
// resolveNode: EXPERIMENTAL, API might change!
resolveNode: _resolveNode2.default
};
}
//# sourceMappingURL=makeNewBuild.js.map

@@ -14,2 +14,3 @@ "use strict";

const base64 = str => new Buffer(String(str)).toString("base64");
const base64Decode = str => new Buffer(String(str), "base64").toString("utf8");

@@ -29,2 +30,9 @@ exports.default = function NodePlugin(builder, { nodeIdFieldName: inNodeIdFieldName }) {

},
getTypeAndIdentifiersFromNodeId(nodeId) {
const [alias, ...identifiers] = JSON.parse(base64Decode(nodeId));
return {
Type: this.getTypeByName(nodeTypeNameByAlias[alias] || alias),
identifiers
};
},
addNodeFetcherForTypeName(typeName, fetcher) {

@@ -31,0 +39,0 @@ if (nodeFetcherByTypeName[typeName]) {

6

node8plus/resolveNode.js

@@ -6,3 +6,2 @@ "use strict";

});
const base64Decode = str => new Buffer(String(str), "base64").toString("utf8");

@@ -15,3 +14,3 @@ exports.default = async function resolveNode(nodeId, build, { getDataFromParsedResolveInfoFragment }, data, context, resolveInfo) {

nodeFetcherByTypeName,
getNodeType,
getTypeAndIdentifiersFromNodeId,
graphql: { getNamedType }

@@ -23,4 +22,3 @@ } = build;

try {
const [alias, ...identifiers] = JSON.parse(base64Decode(nodeId));
const Type = getNodeType(alias);
const { Type, identifiers } = getTypeAndIdentifiersFromNodeId(nodeId);
if (!Type) {

@@ -27,0 +25,0 @@ throw new Error("Type not found");

@@ -209,3 +209,13 @@ "use strict";

// XXX: optionally debounce
this.emit("schema", this.buildSchema());
try {
const schema = this.buildSchema();
this.emit("schema", schema);
} catch (e) {
// Build errors introduced while watching are ignored because it's
// primarily used in development.
// eslint-disable-next-line no-console
console.error("⚠️⚠️⚠️ An error occured when building the schema on watch:");
// eslint-disable-next-line no-console
console.error(e);
}
};

@@ -212,0 +222,0 @@ if (listener) {

@@ -16,7 +16,20 @@ "use strict";

function swallowError(e) {
// BE VERY CAREFUL NOT TO THROW!
// XXX: Improve this
// eslint-disable-next-line no-console
console.warn(`An error occurred, it might be okay but it doesn't look like the error we were expecting... ${debugWarn.enabled ? "" : `run with envvar 'DEBUG="graphile-build:warn"' to view the error`}`);
debugWarn(e);
if (debugWarn.enabled) {
// eslint-disable-next-line no-console
console.warn(`Recoverable error occurred:`);
debugWarn(e);
} else {
const errorSnippet = e && typeof e.toString === "function" ? String(e).replace(/\n.*/g, "").substr(0, 160).trim() : null;
if (errorSnippet) {
// eslint-disable-next-line no-console
console.warn(`Recoverable error occurred; use envvar 'DEBUG="graphile-build:warn"' for full error\n> ${errorSnippet}…`);
} else {
// eslint-disable-next-line no-console
console.warn(`Recoverable error occurred; use envvar 'DEBUG="graphile-build:warn"' for error`);
}
debugWarn(e);
}
}
//# sourceMappingURL=swallowError.js.map
{
"name": "graphile-build",
"version": "4.0.0-rc.4",
"version": "4.0.0-rc.5",
"description": "Build a GraphQL schema from plugins",

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

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

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

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