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

merge-graphql-schemas

Package Overview
Dependencies
Maintainers
2
Versions
269
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

merge-graphql-schemas - npm Package Compare versions

Comparing version 1.5.1 to 1.5.2

4

CHANGELOG.md

@@ -9,2 +9,6 @@ # Change Log

## [1.5.2]
### Fixed
- Correctly merge directives when using `mergeTypes` in [PR #144](https://github.com/okgrow/merge-graphql-schemas/pull/144) by [@JulianKnodt](https://github.com/julianknodt)
## [1.5.1] - 2018-03-16

@@ -11,0 +15,0 @@ ### Changed

2

package.json
{
"name": "merge-graphql-schemas",
"author": "OK GROW!",
"version": "1.5.1",
"version": "1.5.2",
"description": "A utility library to facilitate merging of modularized GraphQL schemas and resolver objects.",

@@ -6,0 +6,0 @@ "repository": {

@@ -20,2 +20,3 @@ # Merge Graphql Schemas

- [Import everything from a specified folder](#import-everything-from-a-specified-folder)
- [Output the string of typeDefs](#output-the-string-of-typedefs)
- [Merging nested Types](#merging-nested-types)

@@ -145,3 +146,3 @@ - [Merging resolvers](#merging-resolvers)

> The `fileLoader` function will by default ignore files named `index.js`. This allows you to create your index file inside the actual types folder if desired.
> The `fileLoader` function will by default ignore files named `index.js` or `index.ts`. This allows you to create your index file inside the actual types folder if desired.

@@ -236,2 +237,14 @@ ```graphql

### Output the string of typeDefs
Since the output of `mergeTypes` is just a string, after you merge your types, you can save it to a file to be passed around to other systems. Here is an example using ES6 modules:
```js
import { fileLoader, mergeTypes } from 'merge-graphql-schemas'
import { writeFileSync } from 'fs'
const typeDefs = mergeTypes(fileLoader(`${__dirname}/schema/**/*.graphql`), { all: true })
writeFileSync('joined.graphql', typeDefs)
```
### Merging nested Types

@@ -289,2 +302,23 @@

#### Merging Directives
Directives will be stacked on top of each other, in the order of declaration.
```js
type Query {
client: Client @foo
}
type Query {
client: Client @bar
}
```
Becomes
```
type Query {
client: Client @foo @bar
}
```
#### Warning

@@ -364,2 +398,43 @@

**Optional: Automatic with Resolver Naming Convention**
If you would like to use the automated `fileLoader` approach _but_ would like complete
freedom over the structure of your resolver files, then simply use a resolver file naming
convention like, `[file].resolvers.js/ts`.
Then setup your `fileLoader` like so, and you're in business:
```js
// ./graphql/resolvers/index.js/ts
import path from 'path';
import { fileLoader, mergeResolvers } from 'merge-graphql-schemas';
const resolversArray = fileLoader(path.join(__dirname, "./**/*.resolvers.*"));
export default mergeResolvers(resolversArray);
```
With this approach, you're free to structure resolver files as you see fit. Of course,
unique naming of Queries, Mutations and Subscriptions still applies!
Now you can structure by **function**...
```
+-- graphql
| +-- resolvers
| | +-- author.resolvers.js/ts
| | +-- book.resolvers.js/ts
| | +-- index.ts <<< Merges all `*.resolvers.*` files
```
Or by **type**...
```
+-- graphql
| +-- entity
| | +-- author
| | | +-- author.resolvers.js/ts
| | | +-- ...
| | +-- book
| | | +-- book.resolvers.js/ts
| | | +-- ...
| | +-- index.ts <<< Merges all `*.resolvers.*` files
```
### Server setup

@@ -415,8 +490,14 @@

## Maintainer
## Maintainers
This is an open source package. We hope to deal with contributions in a timely manner, but that's not always the case. The main maintainer is:
This is an open source package. We hope to deal with contributions in a timely manner, but that's not always the case. The main maintainers are:
[@RodMachado](https://github.com/RodMachado)
[@cfnelson](https://github.com/cfnelson)
[@RichardLitt](https://github.com/RichardLitt) (triage and basic support)
Along with the team at [@okgrow](https://github.com/okgrow).
Feel free to ping if there are open issues or pull requests which are taking a while to be dealt with!

@@ -423,0 +504,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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