graphile-build-pg
Advanced tools
Comparing version 0.1.0-alpha.19 to 0.1.0-alpha.20
@@ -7,4 +7,10 @@ "use strict"; | ||
var _keys = require("babel-runtime/core-js/object/keys"); | ||
var _keys2 = _interopRequireDefault(_keys); | ||
var _jsonwebtoken = require("jsonwebtoken"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = function PgJWTPlugin(builder, _ref) { | ||
@@ -78,4 +84,13 @@ var inflection = _ref.pgInflection, | ||
pg2GqlMapper[compositeType.id] = { | ||
map: function map(_) { | ||
return _; | ||
map: function map(value) { | ||
if (!value) return null; | ||
var values = (0, _keys2.default)(value).map(function (k) { | ||
return value[k]; | ||
}); | ||
if (values.every(function (v) { | ||
return v == null; | ||
})) { | ||
return null; | ||
} | ||
return value; | ||
}, | ||
@@ -82,0 +97,0 @@ unmap: function unmap() { |
@@ -7,4 +7,10 @@ "use strict"; | ||
var _keys = require("babel-runtime/core-js/object/keys"); | ||
var _keys2 = _interopRequireDefault(_keys); | ||
var _jsonwebtoken = require("jsonwebtoken"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = function PgJWTPlugin(builder, { pgInflection: inflection, pgJwtTypeIdentifier, pgJwtSecret }) { | ||
@@ -63,3 +69,10 @@ builder.hook("init", (_, { | ||
pg2GqlMapper[compositeType.id] = { | ||
map: _ => _, | ||
map: value => { | ||
if (!value) return null; | ||
const values = (0, _keys2.default)(value).map(k => value[k]); | ||
if (values.every(v => v == null)) { | ||
return null; | ||
} | ||
return value; | ||
}, | ||
unmap: () => { | ||
@@ -66,0 +79,0 @@ throw new Error("We don't support passing a JWT token into GraphQL currently"); |
{ | ||
"name": "graphile-build-pg", | ||
"version": "0.1.0-alpha.19", | ||
"version": "0.1.0-alpha.20", | ||
"description": "Build a GraphQL schema by reflection over a PostgreSQL schema. Easy to customize since it's built with plugins on graphile-build", | ||
@@ -5,0 +5,0 @@ "main": "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
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
1319666
9080