graphile-build
Advanced tools
Comparing version 4.1.0-alpha.0 to 4.1.0-alpha.1
@@ -15,6 +15,6 @@ "use strict"; | ||
const aExtendedB = new WeakMap(); | ||
const INDENT = " "; | ||
const $$hints = Symbol("hints"); | ||
function indent(text) { | ||
@@ -25,20 +25,13 @@ return INDENT + text.replace(/\n/g, "\n" + INDENT).replace(/\n +(?=\n|$)/g, "\n"); | ||
function extend(base, extra, hint) { | ||
const keysA = Object.keys(base); | ||
// $FlowFixMe | ||
const hints = base[$$hints] || {}; | ||
const keysB = Object.keys(extra); | ||
const hints = Object.create(null); | ||
for (const key of keysA) { | ||
const hintKey = `_source__${key}`; | ||
if (base[hintKey]) { | ||
hints[hintKey] = base[hintKey]; | ||
} | ||
} | ||
const extraHints = extra[$$hints] || {}; | ||
for (const key of keysB) { | ||
const newValue = extra[key]; | ||
const oldValue = base[key]; | ||
const hintKey = `_source__${key}`; | ||
const hintB = extra[hintKey] || hint; | ||
if (aExtendedB.get(newValue) !== oldValue && keysA.indexOf(key) >= 0) { | ||
const hintB = extraHints[key] || hint; | ||
if (key in base && base[key] !== newValue) { | ||
// $FlowFixMe | ||
const hintA = base[hintKey]; | ||
const hintA = hints[key]; | ||
const firstEntityDetails = !hintA ? "We don't have any information about the first entity." : `The first entity was:\n\n${indent(_chalk2.default.magenta(hintA))}`; | ||
@@ -48,18 +41,11 @@ const secondEntityDetails = !hintB ? "We don't have any information about the second entity." : `The second entity was:\n\n${indent(_chalk2.default.yellow(hintB))}`; | ||
} | ||
hints[hintKey] = hints[hintKey] || hintB || base[hintKey]; | ||
} | ||
const obj = Object.assign({}, base, extra); | ||
aExtendedB.set(obj, base); | ||
for (const hintKey in hints) { | ||
if (hints[hintKey]) { | ||
Object.defineProperty(obj, hintKey, { | ||
configurable: false, | ||
enumerable: false, | ||
value: hints[hintKey], | ||
writable: false | ||
}); | ||
if (hintB) { | ||
hints[key] = hintB; | ||
} | ||
} | ||
return obj; | ||
return Object.assign(base, extra, { | ||
// $FlowFixMe | ||
[$$hints]: hints | ||
}); | ||
} | ||
//# sourceMappingURL=extend.js.map |
@@ -416,3 +416,3 @@ "use strict"; | ||
}, | ||
scope: (0, _extend2.default)((0, _extend2.default)(scope, { | ||
scope: (0, _extend2.default)((0, _extend2.default)({ ...scope }, { | ||
fieldName | ||
@@ -476,3 +476,3 @@ }, `Within context for GraphQLObjectType '${rawSpec.name}'`), fieldScope, `Extending scope for field '${fieldName}' within context for GraphQLObjectType '${rawSpec.name}'`) | ||
Self, | ||
scope: (0, _extend2.default)((0, _extend2.default)(scope, { | ||
scope: (0, _extend2.default)((0, _extend2.default)({ ...scope }, { | ||
fieldName | ||
@@ -479,0 +479,0 @@ }, `Within context for GraphQLInputObjectType '${rawSpec.name}'`), fieldScope, `Extending scope for field '${fieldName}' within context for GraphQLInputObjectType '${rawSpec.name}'`) |
@@ -71,2 +71,3 @@ "use strict"; | ||
} = build; | ||
let Query; | ||
newWithHooks(GraphQLInterfaceType, { | ||
@@ -77,3 +78,4 @@ name: "Node", | ||
if (value === $$isQuery) { | ||
return getTypeByName("Query"); | ||
if (!Query) Query = getTypeByName("Query"); | ||
return Query; | ||
} else if (value[$$nodeType]) { | ||
@@ -80,0 +82,0 @@ return getNullableType(value[$$nodeType]); |
{ | ||
"name": "graphile-build", | ||
"version": "4.1.0-alpha.0", | ||
"version": "4.1.0-alpha.1", | ||
"description": "Build a GraphQL schema from plugins", | ||
@@ -34,2 +34,3 @@ "main": "node8plus/index.js", | ||
"@types/graphql": "^0.13.4", | ||
"chalk": "^2.1.0", | ||
"debug": ">=2 <3", | ||
@@ -60,3 +61,3 @@ "graphql-parse-resolve-info": "4.0.0", | ||
], | ||
"gitHead": "b737bd393854b5fda265c7b30b916b8608c75c31" | ||
"gitHead": "378bc2eb419ccbbda2643655a34f16aa06b016e6" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
253790
8
1697
+ Addedchalk@^2.1.0
+ Addedansi-styles@3.2.1(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedsupports-color@5.5.0(transitive)