@graphcommerce/docs 9.0.0-canary.58 → 9.0.0-canary.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/framework/mesh.md +66 -0
- package/magento/algolia.md +46 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# GraphQL Mesh
|
|
2
|
+
|
|
3
|
+
GraphQL Mesh is a framework that helps shape and build an executable GraphQL
|
|
4
|
+
schema from multiple data sources.
|
|
5
|
+
|
|
6
|
+
## Differences between standard GraphQL Mesh
|
|
7
|
+
|
|
8
|
+
1. All the configurations are passed through the
|
|
9
|
+
`@graphcommerce/graphql-mesh/meshConfig` method which allows you to create
|
|
10
|
+
plugins for the mesh configuration
|
|
11
|
+
2. Backend requests are automatically retried with an exponential backoff
|
|
12
|
+
strategy.
|
|
13
|
+
3. `additionalTypeDefs`, `additionalResolver`, `sources.handlers.openapi.source`
|
|
14
|
+
accept module patterns `@graphcommerce/my-package/resolver.ts`
|
|
15
|
+
4. `*.graphqls` files are automatically loaded from the project root.
|
|
16
|
+
5. For all packages `schema/**/*.graphqls` are automatically loaded.
|
|
17
|
+
6. Magento version based graphql schema files are automatically loaded from
|
|
18
|
+
their respective `schema246` / `schema247` etc. folders.
|
|
19
|
+
|
|
20
|
+
## Configuration
|
|
21
|
+
|
|
22
|
+
To make modifications to the Mesh configuration, you can:
|
|
23
|
+
|
|
24
|
+
1. Modify the meshrc.yaml to make it suit your needs.
|
|
25
|
+
2. Write a plugin.
|
|
26
|
+
|
|
27
|
+
### Modify the meshrc.yaml:
|
|
28
|
+
|
|
29
|
+
You can always modify the base configuration of the Mesh by modifying the
|
|
30
|
+
`meshrc.yaml` file.
|
|
31
|
+
|
|
32
|
+
### Write a plugin:
|
|
33
|
+
|
|
34
|
+
1. Create a plugin file something like this:
|
|
35
|
+
plugins/meshConfigMyModifications.ts
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import type { meshConfig as meshConfigBase } from '@graphcommerce/graphql-mesh/meshConfig'
|
|
39
|
+
import type { FunctionPlugin, PluginConfig } from '@graphcommerce/next-config'
|
|
40
|
+
|
|
41
|
+
export const config: PluginConfig = {
|
|
42
|
+
module: '@graphcommerce/graphql-mesh/meshConfig',
|
|
43
|
+
type: 'function',
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const meshConfig: FunctionPlugin<typeof meshConfigBase> = (
|
|
47
|
+
prev,
|
|
48
|
+
baseConfig,
|
|
49
|
+
graphCommerceConfig,
|
|
50
|
+
) => {
|
|
51
|
+
prev({
|
|
52
|
+
...baseConfig,
|
|
53
|
+
sources: [
|
|
54
|
+
...baseConfig.sources,
|
|
55
|
+
{
|
|
56
|
+
name: 'mySource',
|
|
57
|
+
handler: {
|
|
58
|
+
graphql: {
|
|
59
|
+
endpoint: 'https://my-source.com/graphql',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Algolia Magento 2
|
|
2
|
+
|
|
3
|
+
An implementation of Algolia through the GraphQL Mesh.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
Make sure the Magento 2 module is correctly installed and working.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
1. Find current version of your `@graphcommerce/next-ui` in your package.json.
|
|
12
|
+
2. `yarn add @graphcommerce/address-fields-nl@9.0.0` (replace 9.0.0 with the
|
|
13
|
+
version of the step above)
|
|
14
|
+
3. Configure the following ([configuration values](./Config.graphqls)) in your
|
|
15
|
+
graphcommerce.config.js:
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
const config = {
|
|
19
|
+
algoliaApplicationId: 'your-algolia-application-id', // Stores > Configuration > Algolia Search > Credentials and Basic Setup > Application ID
|
|
20
|
+
algoliaIndexNamePrefix: 'default_', // Stores > Configuration > Algolia Search > Credentials and Basic Setup > Index name prefix
|
|
21
|
+
algoliaSearchOnlyApiKey: 'blabla', // Stores > Configuration > Algolia Search > Credentials and Basic Setup > Search-only (public) API key
|
|
22
|
+
algoliaCatalogEnabled: false, // start with search and if everything works as expected, you can move on to the catalog.
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Configuration
|
|
27
|
+
|
|
28
|
+
1. Setup the fields that you want to index in algolia
|
|
29
|
+
`Stores > configuration > Algolia Search > Products > Products`
|
|
30
|
+
2. Configure your aggregations/filters, make sure that the aggregation fields
|
|
31
|
+
are also indexed in step 2
|
|
32
|
+
`Stores > Configuration > Algolia Search > Instant Search Results Page > Facets`
|
|
33
|
+
3. Make sure the aggregations fields are made filterable(Use in layerd
|
|
34
|
+
Navigation), so the attributeList query can retrieve the labels.
|
|
35
|
+
`Stores > Products > Attributes`
|
|
36
|
+
4. To configure sorting options, enable Virtual Replica's.
|
|
37
|
+
`Stores > Configuration > Algolia Search > Instant Search Results Page > Use Virtual Replica`
|
|
38
|
+
|
|
39
|
+
### Customization
|
|
40
|
+
|
|
41
|
+
Customise the code by creating plugins on the functions you want to adjust
|
|
42
|
+
|
|
43
|
+
## Algolia for Catalog
|
|
44
|
+
|
|
45
|
+
Sorting is defined by Algolia and can not be configured per category as each
|
|
46
|
+
sorting option is a separate (virtual) index.
|
package/package.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"name": "@graphcommerce/docs",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/docs",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce/docs",
|
|
5
|
-
"version": "9.0.0-canary.
|
|
5
|
+
"version": "9.0.0-canary.60",
|
|
6
6
|
"sideEffects": true,
|
|
7
7
|
"peerDependencies": {
|
|
8
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.
|
|
8
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.60"
|
|
9
9
|
},
|
|
10
10
|
"prettier": "@graphcommerce/prettier-config-pwa"
|
|
11
11
|
}
|