From da0f26144c19ed609eeb5b3580453d61bb276b3b Mon Sep 17 00:00:00 2001 From: Trevor Livingston Date: Wed, 2 Mar 2022 10:44:23 -0600 Subject: [PATCH 1/2] accept a config where exclude is not defined --- lib/transforms/__tests__.js | 8 ++++++++ lib/transforms/index.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/transforms/__tests__.js b/lib/transforms/__tests__.js index e3b238b..ba42364 100644 --- a/lib/transforms/__tests__.js +++ b/lib/transforms/__tests__.js @@ -4,6 +4,14 @@ const { exclusions } = require('./index.js'); const Test = require('tape'); const { FilterTypes, FilterObjectFields } = require('graphql-tools'); +Test('exclusions() accepts null exclude arg', (t) => { + t.plan(1); + + t.doesNotThrow(() => { + exclusions(); + }, 'does not explode'); +}); + Test('exclusions() throws an error if passed a malformed exclusion', (t) => { try { exclusions(['mal.form.ed']); diff --git a/lib/transforms/index.js b/lib/transforms/index.js index a1f742e..505cc68 100644 --- a/lib/transforms/index.js +++ b/lib/transforms/index.js @@ -2,7 +2,7 @@ const { FilterTypes, FilterObjectFields } = require('graphql-tools'); -const exclusions = function(exclusions) { +const exclusions = function(exclusions = []) { return exclusions.map((exclusion) => { if (typeof exclusion === 'string') { const parts = exclusion.split('.'); From cd73f9e708597820672588cc978851fb4d905fc3 Mon Sep 17 00:00:00 2001 From: Trevor Livingston Date: Wed, 2 Mar 2022 11:40:07 -0600 Subject: [PATCH 2/2] updated version and changelog --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf62a3f..79baf98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +### v3.0.1 + +- [FIXED] - if `exclude` is undefined in a component config + +### v3.0.0 + +- Modernized to utilize new graphql-tools +- [BREAKING] - directives are not imported and maintained throughout the tree : top level component is responsible for directive implementations + ### v2.2.0 - [FEATURE] - Add "hook" for custom `makeExecutableSchema` function diff --git a/package.json b/package.json index 1c99d76..a052a3b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "graphql-component", - "version": "3.0.0", + "version": "3.0.1", "description": "Build, customize and compose GraphQL schemas in a componentized fashion", "keywords": [ "graphql",