@envelop/validation-cache 10.1.1 → 10.2.0
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/LICENSE +3 -1
- package/cjs/index.js +5 -5
- package/esm/index.js +5 -5
- package/package.json +5 -5
- package/typings/index.d.cts +1 -1
- package/typings/index.d.ts +1 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2020
|
|
3
|
+
Copyright (c) 2018-2020 Graphcool
|
|
4
|
+
Copyright (c) 2020-2021 Prisma
|
|
5
|
+
Copyright (c) 2021- The Guild
|
|
4
6
|
|
|
5
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
8
|
of this software and associated documentation files (the "Software"), to deal
|
package/cjs/index.js
CHANGED
|
@@ -7,7 +7,7 @@ const lru_cache_1 = require("lru-cache");
|
|
|
7
7
|
const object_hash_1 = tslib_1.__importDefault(require("object-hash"));
|
|
8
8
|
const core_1 = require("@envelop/core");
|
|
9
9
|
const DEFAULT_MAX = 1000;
|
|
10
|
-
const DEFAULT_TTL =
|
|
10
|
+
const DEFAULT_TTL = 3_600_000;
|
|
11
11
|
const schemaHashCache = new WeakMap();
|
|
12
12
|
function getSchemaHash(schema) {
|
|
13
13
|
let hash = schemaHashCache.get(schema);
|
|
@@ -20,12 +20,12 @@ function getSchemaHash(schema) {
|
|
|
20
20
|
return hash;
|
|
21
21
|
}
|
|
22
22
|
const useValidationCache = (pluginOptions = {}) => {
|
|
23
|
-
const resultCache = typeof pluginOptions.cache
|
|
24
|
-
?
|
|
25
|
-
: new lru_cache_1.LRUCache({
|
|
23
|
+
const resultCache = typeof pluginOptions.cache === 'undefined'
|
|
24
|
+
? new lru_cache_1.LRUCache({
|
|
26
25
|
max: DEFAULT_MAX,
|
|
27
26
|
ttl: DEFAULT_TTL,
|
|
28
|
-
})
|
|
27
|
+
})
|
|
28
|
+
: pluginOptions.cache;
|
|
29
29
|
return {
|
|
30
30
|
onValidate({ params, setValidationFn, validateFn }) {
|
|
31
31
|
// We use setValidateFn over accessing params.rules directly, as other plugins in the chain might add more rules.
|
package/esm/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { LRUCache } from 'lru-cache';
|
|
|
3
3
|
import objectHash from 'object-hash';
|
|
4
4
|
import { getDocumentString } from '@envelop/core';
|
|
5
5
|
const DEFAULT_MAX = 1000;
|
|
6
|
-
const DEFAULT_TTL =
|
|
6
|
+
const DEFAULT_TTL = 3_600_000;
|
|
7
7
|
const schemaHashCache = new WeakMap();
|
|
8
8
|
function getSchemaHash(schema) {
|
|
9
9
|
let hash = schemaHashCache.get(schema);
|
|
@@ -16,12 +16,12 @@ function getSchemaHash(schema) {
|
|
|
16
16
|
return hash;
|
|
17
17
|
}
|
|
18
18
|
export const useValidationCache = (pluginOptions = {}) => {
|
|
19
|
-
const resultCache = typeof pluginOptions.cache
|
|
20
|
-
?
|
|
21
|
-
: new LRUCache({
|
|
19
|
+
const resultCache = typeof pluginOptions.cache === 'undefined'
|
|
20
|
+
? new LRUCache({
|
|
22
21
|
max: DEFAULT_MAX,
|
|
23
22
|
ttl: DEFAULT_TTL,
|
|
24
|
-
})
|
|
23
|
+
})
|
|
24
|
+
: pluginOptions.cache;
|
|
25
25
|
return {
|
|
26
26
|
onValidate({ params, setValidationFn, validateFn }) {
|
|
27
27
|
// We use setValidateFn over accessing params.rules directly, as other plugins in the chain might add more rules.
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/validation-cache",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
7
|
-
"@envelop/core": "^5.
|
|
6
|
+
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0",
|
|
7
|
+
"@envelop/core": "^5.6.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"lru-cache": "^11.0.0",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/graphql-hive/
|
|
17
|
-
"directory": "packages/plugins/validation-cache"
|
|
16
|
+
"url": "https://github.com/graphql-hive/graphql-yoga.git",
|
|
17
|
+
"directory": "packages/envelop/plugins/validation-cache"
|
|
18
18
|
},
|
|
19
19
|
"author": "Dotan Simha <dotansimha@gmail.com>",
|
|
20
20
|
"license": "MIT",
|
package/typings/index.d.cts
CHANGED
package/typings/index.d.ts
CHANGED