-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
serverless plugin to validate graphql schemas using apollo managed fe…
…deration (#1) * plugin to upload graphql schema to managed federation service * add readme * fix some linting * add comment * remove unused package * remove npx dependancy to fix npm audit failures * add npm ignore * add the ability to specify more than one graph for implementing services * fix apollo key issue, one per graph * fix missing packages
- Loading branch information
Imran
authored
Sep 10, 2020
1 parent
5caf080
commit 8245a4e
Showing
13 changed files
with
9,621 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
{ | ||
"env": { | ||
"es2020": true, | ||
"node": true, | ||
"mocha": true, | ||
"jest": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 11, | ||
"ecmaFeatures": { | ||
"experimentalObjectRestSpread": true | ||
} | ||
}, | ||
"extends": "eslint:recommended", | ||
"rules": { | ||
"indent": [ | ||
"error", | ||
2, | ||
{ | ||
"SwitchCase": 1 | ||
} | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
], | ||
"no-unused-vars": [ | ||
"error" | ||
], | ||
"prefer-const": [ | ||
"error", | ||
{ | ||
"destructuring": "all" | ||
} | ||
], | ||
"no-underscore-dangle": [ | ||
"error" | ||
], | ||
"no-console": "off", | ||
"strict": [ | ||
"error", | ||
"global" | ||
], | ||
"require-atomic-updates": "off", | ||
"no-buffer-constructor": [ | ||
"error" | ||
], | ||
"eol-last": [ | ||
"error", | ||
"always" | ||
], | ||
"no-multiple-empty-lines": [ | ||
"error", | ||
{ | ||
"max": 1 | ||
} | ||
], | ||
"array-bracket-spacing": [ | ||
"error", | ||
"never" | ||
], | ||
"space-in-parens": [ | ||
"error", | ||
"never" | ||
], | ||
"object-curly-spacing": [ | ||
"error", | ||
"always" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
.serverless |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# package directories | ||
node_modules | ||
jspm_packages | ||
|
||
test | ||
.eslintignore | ||
.eslintrc | ||
.gitignore | ||
jest.config.js | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Imran | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Serverless Plugin Apollo Graphql Federation | ||
|
||
A serverless plugin that uploads graphql schemas to Apollo managed federation. This plugin should be used in implementing services. This allows the gateway service to pull schema from apollo managed federation and also stops implementing services from uploading invalid schemas that would cause the gateway to fail. | ||
|
||
## Usage | ||
|
||
Install with npm | ||
|
||
```sh | ||
npm i -D serverless-plugin-apollo-graphql-federation | ||
``` | ||
|
||
Add to serverless.yml | ||
|
||
```yml | ||
plugins: | ||
- serverless-plugin-apollo-graphql-federation | ||
``` | ||
```yml | ||
service: | ||
custom: | ||
apolloGraphQLFederation: | ||
graphs: | ||
- name: 'myGraph' | ||
apolloKey: apollo-api-key-for-my-graph | ||
url: https://my-implementing-service/mygraphendpoint | ||
schema: './myGraph/schema.gql', | ||
``` | ||
## Couldn't I just use the serverless-hooks-plugin to do this? | ||
Yes you could but this would potentially log your apolloKey in your build server logs which is undesirable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
setupFilesAfterEnv: ['./test/setup.js'], | ||
maxWorkers: '1', | ||
testEnvironment: 'node', | ||
testMatch: [ | ||
'**/test/**/*test.js' | ||
], | ||
verbose: false | ||
}; |
Oops, something went wrong.