-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: setup of docusaurus + preshot few pages * refactor: main page * feat: add per plugin configuration * refactor: plugins pages configuration * feat: add workflow file * fix: remove shared plugin doc * fix: move docs to services * refactor: change button and colors * fix: update logo main page
- Loading branch information
Showing
44 changed files
with
7,272 additions
and
265 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,36 @@ | ||
name: Deploy to GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- '.github/workflows/docs.yml' | ||
- 'services/docs/**' | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy to GitHub Pages | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: yarn | ||
|
||
- name: Install dependencies | ||
run: | | ||
corepack enable | ||
yarn install --frozen-lockfile | ||
- name: Build website | ||
run: yarn workspace docs build | ||
|
||
# Popular action to deploy to GitHub Pages: | ||
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus | ||
- name: Deploy to GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./services/docs/build |
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 |
---|---|---|
|
@@ -6,3 +6,5 @@ | |
build | ||
coverage | ||
dist | ||
|
||
services/docs/.docusaurus |
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
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
This file was deleted.
Oops, something went wrong.
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
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,20 @@ | ||
# Dependencies | ||
/node_modules | ||
|
||
# Production | ||
/build | ||
|
||
# Generated files | ||
.docusaurus | ||
.cache-loader | ||
|
||
# Misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
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,41 @@ | ||
# Website | ||
|
||
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator. | ||
|
||
### Installation | ||
|
||
``` | ||
$ yarn | ||
``` | ||
|
||
### Local Development | ||
|
||
``` | ||
$ yarn start | ||
``` | ||
|
||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. | ||
|
||
### Build | ||
|
||
``` | ||
$ yarn build | ||
``` | ||
|
||
This command generates static content into the `build` directory and can be served using any static contents hosting service. | ||
|
||
### Deployment | ||
|
||
Using SSH: | ||
|
||
``` | ||
$ USE_SSH=true yarn deploy | ||
``` | ||
|
||
Not using SSH: | ||
|
||
``` | ||
$ GIT_USER=<Your GitHub username> yarn deploy | ||
``` | ||
|
||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. |
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,3 @@ | ||
module.exports = { | ||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')], | ||
}; |
Empty file.
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,5 @@ | ||
--- | ||
sidebar_position: 100 | ||
--- | ||
|
||
# FAQ |
Empty file.
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,8 @@ | ||
{ | ||
"label": "API", | ||
"position": 10, | ||
"link": { | ||
"type": "generated-index", | ||
"description": "Full API documentation" | ||
} | ||
} |
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,19 @@ | ||
# Types | ||
|
||
## Callbacks | ||
|
||
### GraphQLArmorAcceptCallback | ||
|
||
```ts | ||
import type { ValidationContext } from 'graphql'; | ||
|
||
export type GraphQLArmorAcceptCallback = (ctx: ValidationContext | null, details: any) => void; | ||
``` | ||
|
||
### GraphQLArmorRejectCallback | ||
|
||
```ts | ||
import type { GraphQLError, ValidationContext } from 'graphql'; | ||
|
||
export type GraphQLArmorRejectCallback = (ctx: ValidationContext | null, error: GraphQLError) => void; | ||
``` |
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 @@ | ||
# Apollo Configuration |
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,8 @@ | ||
{ | ||
"label": "Configuration", | ||
"position": 10, | ||
"link": { | ||
"type": "generated-index", | ||
"description": "In depth documentation on how to configure GraphQL Armor" | ||
} | ||
} |
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 @@ | ||
# Envelop Configuration |
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 @@ | ||
# GraphQL JS Configuration |
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,7 @@ | ||
# Determinate plugin thresholds | ||
|
||
We recommend [GraphQL Inspector](https://github.com/kamilkisiela/graphql-inspector) to help you determinate the thresholds to use. | ||
|
||
This tool is capable of analyzing your schema and generate useful metrics helping you to determinate and monitor your limits. | ||
|
||
> View [GraphQL Inspector `audit`](https://the-guild.dev/graphql/inspector/docs/essentials/audit). |
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,128 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# Getting started | ||
|
||
This package is dedicated to any **GraphQL developer** who wants to add a security layer to their API, in a simple and efficient way. | ||
|
||
GraphQL Armor mainly focused on limiting the impact of malicious **GraphQL operations**. | ||
|
||
You can find more information about the upcoming features on our [issues page](https://github.com/Escape-Technologies/graphql-armor/issues). | ||
|
||
If you need help or want to discuss about the project, you can hop in [project discussions](https://github.com/Escape-Technologies/graphql-armor/discussions). | ||
|
||
## Installation | ||
|
||
```bash | ||
# npm | ||
npm install -S @escape.tech/graphql-armor | ||
|
||
# yarn | ||
yarn add @escape.tech/graphql-armor | ||
``` | ||
|
||
## Usage | ||
|
||
We provided [some examples](https://github.com/Escape-Technologies/graphql-armor/tree/main/examples) to help you get started with GraphQL Armor. | ||
|
||
We will detail the usage of GraphQL Armor in the following sections: | ||
|
||
- [Apollo Server](#apollo-server) | ||
- [GraphQL Yoga](#graphql-yoga) | ||
- [Envelop](#envelop) | ||
|
||
### Apollo Server | ||
|
||
If you do not use plugins and validations rules, we recommend you to proceed with the following example: | ||
|
||
```ts | ||
import { ApolloArmor } from '@escape.tech/graphql-armor'; | ||
|
||
const armor = new ApolloArmor(); | ||
|
||
const server = new ApolloServer({ | ||
typeDefs, | ||
resolvers, | ||
...armor.protect() | ||
}); | ||
``` | ||
|
||
Otherwise, if you already have some plugins or validation rules, we recommend you to proceed this way: | ||
|
||
```ts | ||
import { ApolloArmor } from '@escape.tech/graphql-armor'; | ||
|
||
const armor = new ApolloArmor(); | ||
const protection = armor.protect() | ||
|
||
const server = new ApolloServer({ | ||
typeDefs, | ||
resolvers, | ||
...protection, | ||
plugins: [...protection.plugins, myPlugin1, myPlugin2 ] | ||
validationRules: [, ...protection.validationRules, myRule1, myRule2 ] | ||
}); | ||
``` | ||
|
||
### GraphQL Yoga | ||
|
||
If you do not use plugins and validations rules, we recommend you to proceed with the following example: | ||
|
||
```ts | ||
import { EnvelopArmor } from '@escape.tech/graphql-armor'; | ||
|
||
const armor = new EnvelopArmor(); | ||
const protection = armor.protect() | ||
|
||
async function main() { | ||
const server = createServer({ | ||
schema, | ||
plugins: [...protection.plugins], | ||
}); | ||
await server.start(); | ||
} | ||
|
||
main(); | ||
``` | ||
|
||
Otherwise, if you already have some plugins or validation rules, we recommend you to proceed this way: | ||
|
||
```ts | ||
import { EnvelopArmorPlugin } from '@escape.tech/graphql-armor'; | ||
|
||
async function main() { | ||
const server = createServer({ | ||
schema, | ||
plugins: [EnvelopArmorPlugin()], | ||
}); | ||
await server.start(); | ||
} | ||
|
||
main(); | ||
``` | ||
|
||
### Envelop | ||
|
||
If you do not use plugins and validations rules, we recommend you to proceed with the following example: | ||
|
||
```ts | ||
import { EnvelopArmor } from '@escape.tech/graphql-armor'; | ||
|
||
const armor = new EnvelopArmor(); | ||
const protection = armor.protect() | ||
|
||
const getEnveloped = envelop({ | ||
plugins: [otherPlugins, ...protection.plugins], | ||
}); | ||
``` | ||
|
||
Otherwise, if you already have some plugins or validation rules, we recommend you to proceed this way: | ||
|
||
```ts | ||
import { EnvelopArmorPlugin } from '@escape.tech/graphql-armor'; | ||
|
||
const getEnveloped = envelop({ | ||
plugins: [otherPlugins, EnvelopArmorPlugin()], | ||
}); | ||
``` |
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,8 @@ | ||
{ | ||
"label": "Plugins", | ||
"position": 10, | ||
"link": { | ||
"type": "generated-index", | ||
"description": "Detailed information per plugin" | ||
} | ||
} |
Oops, something went wrong.