@envelop/persisted-operations 5.0.0 → 5.0.1
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/README.md +7 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ yarn add @envelop/persisted-operations
|
|
|
15
15
|
The most basic implementation can use an in-memory JS `Map` wrapper with a `Store` object:
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
|
-
import { parse, validate, execute, subscribe } from 'graphql'
|
|
18
|
+
import { parse, validate, specifiedRules, execute, subscribe } from 'graphql'
|
|
19
19
|
import { envelop, useEngine } from '@envelop/core'
|
|
20
20
|
import { usePersistedOperations, InMemoryStore } from '@envelop/persisted-operations'
|
|
21
21
|
|
|
@@ -30,7 +30,7 @@ const store = new InMemoryStore({
|
|
|
30
30
|
|
|
31
31
|
const getEnveloped = envelop({
|
|
32
32
|
plugins: [
|
|
33
|
-
useEngine({ parse, validate, execute, subscribe }),
|
|
33
|
+
useEngine({ parse, validate, specifiedRules, execute, subscribe }),
|
|
34
34
|
// ... other plugins ...
|
|
35
35
|
usePersistedOperations({
|
|
36
36
|
store: myStore
|
|
@@ -60,7 +60,7 @@ usePersistedOperations({
|
|
|
60
60
|
## Usage Example with built-in JsonFileStore
|
|
61
61
|
|
|
62
62
|
```ts
|
|
63
|
-
import { parse, validate, execute, subscribe } from 'graphql'
|
|
63
|
+
import { parse, validate, specifiedRules, execute, subscribe } from 'graphql'
|
|
64
64
|
import { envelop, useEngine } from '@envelop/core'
|
|
65
65
|
import { usePersistedOperations, JsonFileStore } from '@envelop/persisted-operations'
|
|
66
66
|
|
|
@@ -75,7 +75,7 @@ await persistedOperationsStore.loadFromFile(filePath) // load and parse persiste
|
|
|
75
75
|
|
|
76
76
|
const getEnveloped = envelop({
|
|
77
77
|
plugins: [
|
|
78
|
-
useEngine({ parse, validate, execute, subscribe }),
|
|
78
|
+
useEngine({ parse, validate, specifiedRules, execute, subscribe }),
|
|
79
79
|
// ... other plugins ...
|
|
80
80
|
usePersistedOperations({
|
|
81
81
|
store: persistedOperationsStore
|
|
@@ -89,12 +89,12 @@ const getEnveloped = envelop({
|
|
|
89
89
|
The `store` parameter accepts both a `Store` instance, or a function. If you need to support multiple stores (based on incoming GraphQL operation/HTTP request), you can provide a function to toggle between the stores, based on your needs:
|
|
90
90
|
|
|
91
91
|
```ts
|
|
92
|
-
import { parse, validate, execute, subscribe } from 'graphql'
|
|
92
|
+
import { parse, validate, specifiedRules, execute, subscribe } from 'graphql'
|
|
93
93
|
import { envelop, useEngine } from '@envelop/core'
|
|
94
94
|
|
|
95
95
|
const getEnveloped = envelop({
|
|
96
96
|
plugins: [
|
|
97
|
-
useEngine({ parse, validate, execute, subscribe }),
|
|
97
|
+
useEngine({ parse, validate, specifiedRules, execute, subscribe }),
|
|
98
98
|
// ... other plugins ...
|
|
99
99
|
usePersistedOperations({
|
|
100
100
|
store: context => {
|
|
@@ -120,7 +120,7 @@ You can pass `onlyPersisted: true` when you want to allow persisted operations o
|
|
|
120
120
|
|
|
121
121
|
### onMissingMatch
|
|
122
122
|
|
|
123
|
-
You might want to perform some actions, such as logging custom events, when your operation Id is not matched in your store/s; in this case you can use the `onMissingMatch` callback function.
|
|
123
|
+
You might want to perform some actions, such as logging custom events, when your operation Id is not matched in your store/s; in this case you can use the `onMissingMatch` callback function.
|
|
124
124
|
The function receives the context and operationId as arguments, so you can use it like so:
|
|
125
125
|
|
|
126
126
|
```js
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/persisted-operations",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "^3.0.
|
|
6
|
+
"@envelop/core": "^3.0.1",
|
|
7
7
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|