@envelop/validation-cache 5.0.4 → 5.0.5-alpha-20221216195722-efa72eac

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/cjs/index.js CHANGED
@@ -27,7 +27,14 @@ const useValidationCache = (pluginOptions = {}) => {
27
27
  extendContext({ [rawDocumentSymbol]: params.source.toString() });
28
28
  },
29
29
  onValidate({ params, context, setResult }) {
30
- const key = context[rawDocumentSymbol] ?? (0, graphql_1.print)(params.documentAST);
30
+ let ruleKey = '';
31
+ if (Array.isArray(params.rules)) {
32
+ // Note: We could also order them... but that might be too much
33
+ for (const rule of params.rules) {
34
+ ruleKey = ruleKey + rule.name;
35
+ }
36
+ }
37
+ const key = ruleKey + (context[rawDocumentSymbol] ?? (0, graphql_1.print)(params.documentAST));
31
38
  const cachedResult = resultCache.get(key);
32
39
  if (cachedResult !== undefined) {
33
40
  setResult(cachedResult);
package/esm/index.js CHANGED
@@ -23,7 +23,14 @@ export const useValidationCache = (pluginOptions = {}) => {
23
23
  extendContext({ [rawDocumentSymbol]: params.source.toString() });
24
24
  },
25
25
  onValidate({ params, context, setResult }) {
26
- const key = context[rawDocumentSymbol] ?? print(params.documentAST);
26
+ let ruleKey = '';
27
+ if (Array.isArray(params.rules)) {
28
+ // Note: We could also order them... but that might be too much
29
+ for (const rule of params.rules) {
30
+ ruleKey = ruleKey + rule.name;
31
+ }
32
+ }
33
+ const key = ruleKey + (context[rawDocumentSymbol] ?? print(params.documentAST));
27
34
  const cachedResult = resultCache.get(key);
28
35
  if (cachedResult !== undefined) {
29
36
  setResult(cachedResult);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envelop/validation-cache",
3
- "version": "5.0.4",
3
+ "version": "5.0.5-alpha-20221216195722-efa72eac",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "@envelop/core": "^3.0.4",