New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

apollo-schema-extend

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-schema-extend

Extends your Apollo Server Express based graphql server with an external graphql source

  • 0.1.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

apollo-schema-extend

Extends your Apollo Server Express based graphql server with an external graphql source. Merges the external schema into the local schema and forwards any (parts of) request to be resolved by the external source. This library is intended for situations where Apollo Federation doesn't provide sufficient control or is not an option for other reasons.

Basic usage:

In this example myExternalSchema is a GraphQLSchema retrieved by using an IntrospectionQuery and GqlDataSource is a derived class of apollo-datasource-graphql.

const withMyExternalSchema = withExternalSchema(myExternalSchema, {
  dataSource: { name: 'external', factory: () => new GqlDataSource('https://myExternal.com/graphql') },
})

const apolloServer = new ApolloServer(withMyExternalSchema(localApolloServerConfig))
import { GraphQLDataSource } from 'apollo-datasource-graphql'
import { Context } from '...'

export class GqlDataSource extends GraphQLDataSource<Context> {
  constructor(baseUrl: string) {
    super()
    this.baseURL = baseUrl
  }

  protected willSendRequest(request: any) {
    // Add authorization header
  }
}

Installation

Using npm:

$ npm install apollo-schema-extend

Using yarn:

$ yarn add apollo-schema-extend

Restrictions

The current version requires the apollo server config to contain the following fields:

  • resolvers: must be IResolvers<any, any> (array is not supported)
  • typeDefs
  • dataSources

Keywords

FAQs

Package last updated on 18 May 2021

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