@envelop/parser-cache 10.1.1 → 10.2.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/LICENSE CHANGED
@@ -1,6 +1,8 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Dotan Simha
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
@@ -4,14 +4,14 @@ exports.useParserCache = void 0;
4
4
  const graphql_1 = require("graphql");
5
5
  const lru_cache_1 = require("lru-cache");
6
6
  const DEFAULT_MAX = 1000;
7
- const DEFAULT_TTL = 3600000;
7
+ const DEFAULT_TTL = 3_600_000;
8
8
  const useParserCache = (pluginOptions = {}) => {
9
- const documentCache = typeof pluginOptions.documentCache !== 'undefined'
10
- ? pluginOptions.documentCache
11
- : new lru_cache_1.LRUCache({ max: DEFAULT_MAX, ttl: DEFAULT_TTL });
12
- const errorCache = typeof pluginOptions.errorCache !== 'undefined'
13
- ? pluginOptions.errorCache
14
- : new lru_cache_1.LRUCache({ max: DEFAULT_MAX, ttl: DEFAULT_TTL });
9
+ const documentCache = typeof pluginOptions.documentCache === 'undefined'
10
+ ? new lru_cache_1.LRUCache({ max: DEFAULT_MAX, ttl: DEFAULT_TTL })
11
+ : pluginOptions.documentCache;
12
+ const errorCache = typeof pluginOptions.errorCache === 'undefined'
13
+ ? new lru_cache_1.LRUCache({ max: DEFAULT_MAX, ttl: DEFAULT_TTL })
14
+ : pluginOptions.errorCache;
15
15
  return {
16
16
  onParse({ params, setParsedDocument }) {
17
17
  const { source } = params;
package/esm/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { Source } from 'graphql';
2
2
  import { LRUCache } from 'lru-cache';
3
3
  const DEFAULT_MAX = 1000;
4
- const DEFAULT_TTL = 3600000;
4
+ const DEFAULT_TTL = 3_600_000;
5
5
  export const useParserCache = (pluginOptions = {}) => {
6
- const documentCache = typeof pluginOptions.documentCache !== 'undefined'
7
- ? pluginOptions.documentCache
8
- : new LRUCache({ max: DEFAULT_MAX, ttl: DEFAULT_TTL });
9
- const errorCache = typeof pluginOptions.errorCache !== 'undefined'
10
- ? pluginOptions.errorCache
11
- : new LRUCache({ max: DEFAULT_MAX, ttl: DEFAULT_TTL });
6
+ const documentCache = typeof pluginOptions.documentCache === 'undefined'
7
+ ? new LRUCache({ max: DEFAULT_MAX, ttl: DEFAULT_TTL })
8
+ : pluginOptions.documentCache;
9
+ const errorCache = typeof pluginOptions.errorCache === 'undefined'
10
+ ? new LRUCache({ max: DEFAULT_MAX, ttl: DEFAULT_TTL })
11
+ : pluginOptions.errorCache;
12
12
  return {
13
13
  onParse({ params, setParsedDocument }) {
14
14
  const { source } = params;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@envelop/parser-cache",
3
- "version": "10.1.1",
3
+ "version": "10.2.1",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0",
7
- "@envelop/core": "^5.5.1"
6
+ "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0",
7
+ "@envelop/core": "^5.6.1"
8
8
  },
9
9
  "dependencies": {
10
10
  "lru-cache": "^11.0.0",
@@ -12,9 +12,10 @@
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "https://github.com/graphql-hive/envelop.git",
16
- "directory": "packages/plugins/parser-cache"
15
+ "url": "https://github.com/graphql-hive/graphql-yoga.git",
16
+ "directory": "packages/envelop/plugins/parser-cache"
17
17
  },
18
+ "homepage": "https://github.com/graphql-hive/graphql-yoga/tree/main/packages/envelop/plugins/parser-cache#readme",
18
19
  "author": "Dotan Simha <dotansimha@gmail.com>",
19
20
  "license": "MIT",
20
21
  "engines": {
@@ -1,4 +1,4 @@
1
- import { DocumentNode } from 'graphql';
1
+ import type { DocumentNode } from 'graphql';
2
2
  import type { Plugin } from '@envelop/core';
3
3
  interface Cache<T> {
4
4
  get(key: string): T | undefined;
@@ -1,4 +1,4 @@
1
- import { DocumentNode } from 'graphql';
1
+ import type { DocumentNode } from 'graphql';
2
2
  import type { Plugin } from '@envelop/core';
3
3
  interface Cache<T> {
4
4
  get(key: string): T | undefined;