Skip to content

Commit

Permalink
fix(dependencies): Solve missing dependency (#122)
Browse files Browse the repository at this point in the history
Fixes #119
  • Loading branch information
benjie committed Dec 3, 2017
1 parent b6a398b commit cda42a5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/graphile-build-pg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"lru-cache": "4.1.1",
"pg-range-parser": "^1.0.0",
"pg-sql2": "^1.0.0-beta.3",
"pluralize": "^5.0.0"
"pluralize": "^5.0.0",
"postgres-interval": "1.1.1"
},
"peerDependencies": {
"pg": ">=6 <7"
Expand Down
7 changes: 5 additions & 2 deletions packages/graphile-build-pg/src/plugins/PgColumnsPlugin.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// @flow
import { GraphQLNonNull, GraphQLString } from "graphql";
import queryFromResolveData from "../queryFromResolveData";
import type { Plugin } from "graphile-build";

const nullableIf = (condition, Type) =>
const nullableIf = (GraphQLNonNull, condition, Type) =>
condition ? Type : new GraphQLNonNull(Type);

const defaultPgColumnFilter = (_attr, _build, _context) => true;
Expand All @@ -19,6 +18,7 @@ export default (function PgColumnsPlugin(
pgIntrospectionResultsByKind: introspectionResultsByKind,
pgSql: sql,
pg2gql,
graphql: { GraphQLString, GraphQLNonNull },
getAliasFromResolveInfo,
pgTweakFragmentForType,
} = build;
Expand Down Expand Up @@ -117,6 +117,7 @@ export default (function PgColumnsPlugin(
return {
description: attr.description,
type: nullableIf(
GraphQLNonNull,
!attr.isNotNull && !attr.type.domainIsNotNull,
ReturnType
),
Expand All @@ -136,6 +137,7 @@ export default (function PgColumnsPlugin(
extend,
pgGetGqlInputTypeByTypeId,
pgIntrospectionResultsByKind: introspectionResultsByKind,
graphql: { GraphQLString, GraphQLNonNull },
} = build;
const {
scope: {
Expand Down Expand Up @@ -172,6 +174,7 @@ export default (function PgColumnsPlugin(
memo[fieldName] = pgAddSubfield(fieldName, attr.name, attr.type, {
description: attr.description,
type: nullableIf(
GraphQLNonNull,
isPgPatch ||
(!attr.isNotNull && !attr.type.domainIsNotNull) ||
attr.hasDefault,
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3255,7 +3255,7 @@ postgres-date@~1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/postgres-date/-/postgres-date-1.0.3.tgz#e2d89702efdb258ff9d9cee0fe91bd06975257a8"

postgres-interval@^1.1.0:
postgres-interval@1.1.1, postgres-interval@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/postgres-interval/-/postgres-interval-1.1.1.tgz#acdb0f897b4b1c6e496d9d4e0a853e1c428f06f0"
dependencies:
Expand Down

0 comments on commit cda42a5

Please sign in to comment.