diff --git a/plugins/gatsby-source-newrelic-sdk/gatsby-node.js b/plugins/gatsby-source-newrelic-sdk/gatsby-node.js index 2b24b6ba7..6348d1585 100644 --- a/plugins/gatsby-source-newrelic-sdk/gatsby-node.js +++ b/plugins/gatsby-source-newrelic-sdk/gatsby-node.js @@ -46,11 +46,13 @@ exports.createSchemaCustomization = ({ actions, schema }) => { const typeDefs = ` type NewRelicSdkComponent implements Node { + constants: [NewRelicSdkConstant!]! propTypes: [NewRelicSdkPropTypeDefinition!]! - typeDefs: [NewRelicSdkTypeDefinition] + typeDefs: [NewRelicSdkTypeDefinition!]! } type NewRelicSdkApi implements Node { + constants: [NewRelicSdkConstant!]! typeDefs: [NewRelicSdkTypeDefinition] } @@ -107,6 +109,11 @@ exports.createSchemaCustomization = ({ actions, schema }) => { description: String type: String! } + + type NewRelicSdkConstant { + name: String! + value: JSON! + } `; createTypes([propTypeMeta, typeDefs]); diff --git a/plugins/gatsby-source-newrelic-sdk/src/constantInfo.js b/plugins/gatsby-source-newrelic-sdk/src/constantInfo.js index 0925e252c..3d110f2fc 100644 --- a/plugins/gatsby-source-newrelic-sdk/src/constantInfo.js +++ b/plugins/gatsby-source-newrelic-sdk/src/constantInfo.js @@ -14,12 +14,7 @@ exports.getConstants = (name, sdk) => { return { name: `${name}.${member}`, - type: Array.isArray(value) ? 'array' : typeof value, - values: Array.isArray(value) - ? value.map((el) => JSON.stringify(el)) - : Object.getOwnPropertyNames(value).map( - (key) => `${key}: ${JSON.stringify(value[key])}` - ), + value: JSON.stringify(value), }; }); }; diff --git a/plugins/gatsby-source-newrelic-sdk/src/navigationApi.js b/plugins/gatsby-source-newrelic-sdk/src/navigationApi.js index 592fee789..0a144f8ec 100644 --- a/plugins/gatsby-source-newrelic-sdk/src/navigationApi.js +++ b/plugins/gatsby-source-newrelic-sdk/src/navigationApi.js @@ -2,6 +2,8 @@ module.exports = { name: 'navigation', description: '', usage: "import { navigation } from 'nr1'", + constants: [], + examples: [], typeDefs: [ { name: 'Nerdlet',