Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xebiastudio/gatsby-source-graphql-multiple

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xebiastudio/gatsby-source-graphql-multiple

Gatsby source plugin that exposes multiple GraphQL endpoints as a single merged schema

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

gatsby-source-graphql-multiple

version badge license badge

Gatsby source plugin that exposes multiple GraphQL endpoints as a single merged schema. This plugin is based on the gatsby-source-graphql plugin.

Installation

npm install --save @xebiastudio/gatsby-source-graphql-multiple

Usage

To use this plugin, add the following to your Gatsby configuration:

// gatsby-config.js
exports.plugins = [
  {
    resolve: `@xebiastudio/gatsby-source-graphql-multiple`,
    options: {
      typeName: `MyCombinedSource`,
      fieldName: `myCombinedSource`,
      // The paramName will create a query parameter on myCombinedSource that determines which source to use
      // As an example, let's imagine that each source contains content in a specific language
      paramName: `language`,
      sources: [
        {
          key: `en`,
          url: `example.com/en/graphql`
        },
        {
          key: `fr`,
          url: `example.com/fr/graphql`
        }
      ]
    }
  }
];

This will allow you to query content in the following way:

query GetContent($language: String!) {
  myCombinedSource(language: $language) {
    # This part of the query is delegated to the source with key === $language
    pages {
      nodes {
        slug
      }
    }
  }
}

Example use cases

This plugin works well when you have more than one GraphQL source with the same schema, such as:

  • When using WPGraphQL on a WordPress site that is using the MultiSite plugin
  • When using multiple Contentful spaces with the same content model (when using space-level localization as mentioned here)

Maintaining

Publishing a new version

To publish a new version, run

npm version major|minor|patch

This will automatically update the version in the package.json, commit the change and tag it. Push your changes:

git push && git push --tags

Whenever a new tag is created, Github Actions will automatically publish the new version to the Package Registry.

Keywords

FAQs

Package last updated on 23 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc