Skip to content

Commit

Permalink
Merge branch 'master' into fix-types
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Nov 28, 2018
2 parents d1d7d1b + 7d49f8e commit 20564fb
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import type { Plugin } from "graphile-build";

const base64 = str => Buffer.from(String(str)).toString("base64");

export default (function PgScalarFunctionConnectionPlugin(
builder,
{ pgForbidSetofFunctionsToReturnNull = false }
) {
export default (function PgScalarFunctionConnectionPlugin(builder) {
builder.hook("init", (_, build) => {
const {
newWithHooks,
Expand All @@ -26,8 +23,6 @@ export default (function PgScalarFunctionConnectionPlugin(
pgField,
} = build;

const nullableIf = (condition, Type) =>
condition ? Type : new GraphQLNonNull(Type);
const Cursor = getTypeByName("Cursor");
introspectionResultsByKind.procedure.forEach(proc => {
// PERFORMANCE: These used to be .filter(...) calls
Expand Down Expand Up @@ -111,11 +106,7 @@ export default (function PgScalarFunctionConnectionPlugin(
return {
nodes: pgField(build, fieldWithHooks, "nodes", {
description: `A list of \`${NodeType.name}\` objects.`,
type: new GraphQLNonNull(
new GraphQLList(
nullableIf(!pgForbidSetofFunctionsToReturnNull, NodeType)
)
),
type: new GraphQLNonNull(new GraphQLList(NodeType)),
resolve(data) {
return data.data.map(entry => entry.value);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ type FuncOutSetofConnection {
edges: [FuncOutSetofEdge!]!
\\"\\"\\"A list of \`Int\` objects.\\"\\"\\"
nodes: [Int!]!
nodes: [Int]!
}
\\"\\"\\"A \`Int\` edge in the connection.\\"\\"\\"
Expand Down Expand Up @@ -997,7 +997,7 @@ type FuncReturnsTableOneColConnection {
edges: [FuncReturnsTableOneColEdge!]!
\\"\\"\\"A list of \`Int\` objects.\\"\\"\\"
nodes: [Int!]!
nodes: [Int]!
}
\\"\\"\\"A \`Int\` edge in the connection.\\"\\"\\"
Expand Down Expand Up @@ -1074,7 +1074,7 @@ type IntSetQueryConnection {
edges: [IntSetQueryEdge!]!
\\"\\"\\"A list of \`Int\` objects.\\"\\"\\"
nodes: [Int!]!
nodes: [Int]!
}
\\"\\"\\"A \`Int\` edge in the connection.\\"\\"\\"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ type FuncOutSetofConnection {
edges: [FuncOutSetofEdge!]!
\\"\\"\\"A list of \`Int\` objects.\\"\\"\\"
nodes: [Int!]!
nodes: [Int]!
}
\\"\\"\\"A \`Int\` edge in the connection.\\"\\"\\"
Expand Down Expand Up @@ -997,7 +997,7 @@ type FuncReturnsTableOneColConnection {
edges: [FuncReturnsTableOneColEdge!]!
\\"\\"\\"A list of \`Int\` objects.\\"\\"\\"
nodes: [Int!]!
nodes: [Int]!
}
\\"\\"\\"A \`Int\` edge in the connection.\\"\\"\\"
Expand Down Expand Up @@ -1074,7 +1074,7 @@ type IntSetQueryConnection {
edges: [IntSetQueryEdge!]!
\\"\\"\\"A list of \`Int\` objects.\\"\\"\\"
nodes: [Int!]!
nodes: [Int]!
}
\\"\\"\\"A \`Int\` edge in the connection.\\"\\"\\"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ type FuncOutSetofConnection {
edges: [FuncOutSetofEdge!]!
\\"\\"\\"A list of \`Int\` objects.\\"\\"\\"
nodes: [Int!]!
nodes: [Int]!
}
\\"\\"\\"A \`Int\` edge in the connection.\\"\\"\\"
Expand Down Expand Up @@ -392,7 +392,7 @@ type FuncReturnsTableOneColConnection {
edges: [FuncReturnsTableOneColEdge!]!
\\"\\"\\"A list of \`Int\` objects.\\"\\"\\"
nodes: [Int!]!
nodes: [Int]!
}
\\"\\"\\"A \`Int\` edge in the connection.\\"\\"\\"
Expand Down Expand Up @@ -469,7 +469,7 @@ type IntSetQueryConnection {
edges: [IntSetQueryEdge!]!
\\"\\"\\"A list of \`Int\` objects.\\"\\"\\"
nodes: [Int!]!
nodes: [Int]!
}
\\"\\"\\"A \`Int\` edge in the connection.\\"\\"\\"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2341,7 +2341,7 @@ type PostComputedIntervalSetConnection {
edges: [PostComputedIntervalSetEdge!]!
\\"\\"\\"A list of \`Interval\` objects.\\"\\"\\"
nodes: [Interval!]!
nodes: [Interval]!
}
\\"\\"\\"A \`Interval\` edge in the connection.\\"\\"\\"
Expand Down Expand Up @@ -3075,7 +3075,7 @@ type QueryIntervalSetConnection {
edges: [QueryIntervalSetEdge!]!
\\"\\"\\"A list of \`Interval\` objects.\\"\\"\\"
nodes: [Interval!]!
nodes: [Interval]!
}
\\"\\"\\"A \`Interval\` edge in the connection.\\"\\"\\"
Expand Down Expand Up @@ -3501,7 +3501,7 @@ type StaticBigIntegerConnection {
edges: [StaticBigIntegerEdge!]!
\\"\\"\\"A list of \`BigInt\` objects.\\"\\"\\"
nodes: [BigInt!]!
nodes: [BigInt]!
}
\\"\\"\\"A \`BigInt\` edge in the connection.\\"\\"\\"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ type FuncOutSetofConnection {
edges: [FuncOutSetofEdge!]!
\\"\\"\\"A list of \`Int\` objects.\\"\\"\\"
nodes: [Int!]!
nodes: [Int]!
}
\\"\\"\\"A \`Int\` edge in the connection.\\"\\"\\"
Expand Down Expand Up @@ -997,7 +997,7 @@ type FuncReturnsTableOneColConnection {
edges: [FuncReturnsTableOneColEdge!]!
\\"\\"\\"A list of \`Int\` objects.\\"\\"\\"
nodes: [Int!]!
nodes: [Int]!
}
\\"\\"\\"A \`Int\` edge in the connection.\\"\\"\\"
Expand Down Expand Up @@ -1074,7 +1074,7 @@ type IntSetQueryConnection {
edges: [IntSetQueryEdge!]!
\\"\\"\\"A list of \`Int\` objects.\\"\\"\\"
nodes: [Int!]!
nodes: [Int]!
}
\\"\\"\\"A \`Int\` edge in the connection.\\"\\"\\"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ type FuncOutSetofConnection {
edges: [FuncOutSetofEdge!]!
\\"\\"\\"A list of \`Int\` objects.\\"\\"\\"
nodes: [Int!]!
nodes: [Int]!
}
\\"\\"\\"A \`Int\` edge in the connection.\\"\\"\\"
Expand Down Expand Up @@ -997,7 +997,7 @@ type FuncReturnsTableOneColConnection {
edges: [FuncReturnsTableOneColEdge!]!
\\"\\"\\"A list of \`Int\` objects.\\"\\"\\"
nodes: [Int!]!
nodes: [Int]!
}
\\"\\"\\"A \`Int\` edge in the connection.\\"\\"\\"
Expand Down Expand Up @@ -1074,7 +1074,7 @@ type IntSetQueryConnection {
edges: [IntSetQueryEdge!]!
\\"\\"\\"A list of \`Int\` objects.\\"\\"\\"
nodes: [Int!]!
nodes: [Int]!
}
\\"\\"\\"A \`Int\` edge in the connection.\\"\\"\\"
Expand Down

0 comments on commit 20564fb

Please sign in to comment.