@envelop/persisted-operations 4.6.0 → 4.6.1-alpha-20220901205925-b1fd44a9

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 CHANGED
@@ -15,6 +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
19
  import { envelop } from '@envelop/core'
19
20
  import { usePersistedOperations, InMemoryStore } from '@envelop/persisted-operations'
20
21
 
@@ -28,6 +29,10 @@ const store = new InMemoryStore({
28
29
  })
29
30
 
30
31
  const getEnveloped = envelop({
32
+ parse,
33
+ validate,
34
+ execute,
35
+ subscribe,
31
36
  plugins: [
32
37
  // ... other plugins ...
33
38
  usePersistedOperations({
@@ -58,6 +63,8 @@ usePersistedOperations({
58
63
  ## Usage Example with built-in JsonFileStore
59
64
 
60
65
  ```ts
66
+ import { parse, validate, execute, subscribe } from 'graphql'
67
+ import { envelop } from '@envelop/core'
61
68
  import { usePersistedOperations, JsonFileStore } from '@envelop/persisted-operations'
62
69
 
63
70
  const persistedOperationsStore = new JsonFilesStore()
@@ -70,6 +77,10 @@ persistedOperationsStore.loadFromFileSync(filePath) // load and parse persisted-
70
77
  await persistedOperationsStore.loadFromFile(filePath) // load and parse persisted-operations files
71
78
 
72
79
  const getEnveloped = envelop({
80
+ parse,
81
+ validate,
82
+ execute,
83
+ subscribe,
73
84
  plugins: [
74
85
  // ... other plugins ...
75
86
  usePersistedOperations({
@@ -84,7 +95,14 @@ const getEnveloped = envelop({
84
95
  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:
85
96
 
86
97
  ```ts
98
+ import { parse, validate, execute, subscribe } from 'graphql'
99
+ import { envelop } from '@envelop/core'
100
+
87
101
  const getEnveloped = envelop({
102
+ parse,
103
+ validate,
104
+ execute,
105
+ subscribe,
88
106
  plugins: [
89
107
  // ... other plugins ...
90
108
  usePersistedOperations({
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InMemoryStore = void 0;
4
4
  class InMemoryStore {
5
5
  constructor(options) {
6
- var _a;
7
- this.storeData = (_a = options === null || options === void 0 ? void 0 : options.initialData) !== null && _a !== void 0 ? _a : new Map();
6
+ this.storeData = options?.initialData ?? new Map();
8
7
  }
9
8
  get(operationId) {
10
9
  return this.storeData.get(operationId) || undefined;
@@ -1,7 +1,6 @@
1
1
  export class InMemoryStore {
2
2
  constructor(options) {
3
- var _a;
4
- this.storeData = (_a = options === null || options === void 0 ? void 0 : options.initialData) !== null && _a !== void 0 ? _a : new Map();
3
+ this.storeData = options?.initialData ?? new Map();
5
4
  }
6
5
  get(operationId) {
7
6
  return this.storeData.get(operationId) || undefined;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@envelop/persisted-operations",
3
- "version": "4.6.0",
3
+ "version": "4.6.1-alpha-20220901205925-b1fd44a9",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@envelop/core": "^2.6.0",
6
+ "@envelop/core": "2.6.1-alpha-20220901205925-b1fd44a9",
7
7
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
8
8
  },
9
9
  "dependencies": {