Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
notrab committed Jan 10, 2022
1 parent 665a5db commit f93a95b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
23 changes: 12 additions & 11 deletions gatsby-source-graphcms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,18 @@ module.exports = {

### Options

| Key | Type | Description |
| --------------------- | ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `endpoint` | String (**required**) | The endpoint URL for the GraphCMS project. This can be found in the [project settings UI](https://graphcms.com/docs/guides/concepts/apis#working-with-apis). |
| `token` | String | If your GraphCMS project is **not** publicly accessible, you will need to provide a [Permanent Auth Token](https://graphcms.com/docs/reference/authorization) to correctly authorize with the API. You can learn more about creating and managing API tokens [here](https://graphcms.com/docs/guides/concepts/apis#working-with-apis). |
| `typePrefix` | String _(Default: `GraphCMS_`)\_ | The string by which every generated type name is prefixed with. For example, a type of `Post` in GraphCMS would become `GraphCMS_Post` by default. If using multiple instances of the source plugin, you **must** provide a value here to prevent type conflicts. |
| `downloadLocalImages` | Boolean _(Default: `false`)_ | Download and cache GraphCMS image assets in your Gatsby project. [Learn more](#downloading-local-image-assets). |
| `buildMarkdownNodes` | Boolean _(Default: `false`)_ | Build markdown nodes for all [`RichText`](https://graphcms.com/docs/reference/fields/rich-text) fields in your GraphCMS schema. [Learn more](#using-markdown-nodes). |
| `fragmentsPath` | String _(Default: `graphcms-fragments`)_ | The local project path where generated query fragments are saved. This is relative to your current working directory. If using multiple instances of the source plugin, you **must** provide a value here to prevent type and/or fragment conflicts. |
| `locales` | String _(Default: `['en']`)_ | An array of locale key strings from your GraphCMS project. [Learn more](#querying-localised-nodes). You can read more about working with localisation in GraphCMS [here](https://graphcms.com/docs/guides/concepts/i18n). |
| `stages` | String _(Default: `['PUBLISHED']`)_ | An array of Content Stages from your GraphCMS project. [Learn more](#querying-from-content-stages). You can read more about using Content Stages [here](https://graphcms.com/guides/working-with-content-stages). |
| `queryConcurrency` | Integer _(Default: 10)_ | The number of promises ran at once when executing queries. |
| Key | Type | Description |
| ------------------------ | ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `endpoint` | String (**required**) | The endpoint URL for the GraphCMS project. This can be found in the [project settings UI](https://graphcms.com/docs/guides/concepts/apis#working-with-apis). |
| `token` | String | If your GraphCMS project is **not** publicly accessible, you will need to provide a [Permanent Auth Token](https://graphcms.com/docs/reference/authorization) to correctly authorize with the API. You can learn more about creating and managing API tokens [here](https://graphcms.com/docs/guides/concepts/apis#working-with-apis). |
| `typePrefix` | String _(Default: `GraphCMS_`)\_ | The string by which every generated type name is prefixed with. For example, a type of `Post` in GraphCMS would become `GraphCMS_Post` by default. If using multiple instances of the source plugin, you **must** provide a value here to prevent type conflicts. |
| `downloadLocalImages` | Boolean _(Default: `false`)_ | Download and cache GraphCMS image assets in your Gatsby project. [Learn more](#downloading-local-image-assets). |
| `buildMarkdownNodes` | Boolean _(Default: `false`)_ | Build markdown nodes for all [`RichText`](https://graphcms.com/docs/reference/fields/rich-text) fields in your GraphCMS schema. [Learn more](#using-markdown-nodes). |
| `fragmentsPath` | String _(Default: `graphcms-fragments`)_ | The local project path where generated query fragments are saved. This is relative to your current working directory. If using multiple instances of the source plugin, you **must** provide a value here to prevent type and/or fragment conflicts. |
| `locales` | String _(Default: `['en']`)_ | An array of locale key strings from your GraphCMS project. [Learn more](#querying-localised-nodes). You can read more about working with localisation in GraphCMS [here](https://graphcms.com/docs/guides/concepts/i18n). |
| `stages` | String _(Default: `['PUBLISHED']`)_ | An array of Content Stages from your GraphCMS project. [Learn more](#querying-from-content-stages). You can read more about using Content Stages [here](https://graphcms.com/guides/working-with-content-stages). |
| `queryConcurrency` | Integer _(Default: 10)_ | The number of promises ran at once when executing queries. |
| `richTextEmbedTypeNames` | String[] _(Default: [])_ | An array of Rich Text fields that have embeds enabled in the format of `[Model][Field]`, e.g. `ProductDescription` (`Product` being the model, `Description` the field.) |

## Features

Expand Down
16 changes: 13 additions & 3 deletions gatsby-source-graphcms/src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function pluginOptionsSchema({ Joi }) {
`The string by which every generated type name is prefixed with. For example, a type of Post in GraphCMS would become GraphCMS_Post by default. If using multiple instances of the source plugin, you **must** provide a value here to prevent type conflicts`
)
.default(`GraphCMS_`),
concurrency: Joi.number()
queryConcurrency: Joi.number()
.integer()
.min(1)
.default(10)
Expand All @@ -83,7 +83,15 @@ export function pluginOptionsSchema({ Joi }) {

const createSourcingConfig = async (
gatsbyApi,
{ endpoint, fragmentsPath, locales, stages, token, typePrefix, concurrency }
{
endpoint,
fragmentsPath,
locales,
stages,
token,
typePrefix,
queryConcurrency,
}
) => {
const execute = async ({ operationName, query, variables = {} }) => {
const { reporter } = gatsbyApi
Expand Down Expand Up @@ -208,7 +216,9 @@ const createSourcingConfig = async (
return {
gatsbyApi,
schema,
execute: wrapQueryExecutorWithQueue(execute, { concurrency }),
execute: wrapQueryExecutorWithQueue(execute, {
concurrency: queryConcurrency,
}),
gatsbyTypePrefix: typePrefix,
gatsbyNodeDefs: buildNodeDefinitions({ gatsbyNodeTypes, documents }),
}
Expand Down

0 comments on commit f93a95b

Please sign in to comment.