@envelop/graphql-jit 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
@@ -11,10 +11,15 @@ yarn add @envelop/graphql-jit
11
11
  ## Usage Example
12
12
 
13
13
  ```ts
14
+ import { parse, validate, execute, subscribe } from 'graphql'
14
15
  import { envelop } from '@envelop/core'
15
16
  import { useGraphQlJit } from '@envelop/graphql-jit'
16
17
 
17
18
  const getEnveloped = envelop({
19
+ parse,
20
+ validate,
21
+ execute,
22
+ subscribe,
18
23
  plugins: [
19
24
  // ... other plugins ...
20
25
  useGraphQlJit(
package/cjs/index.js CHANGED
@@ -15,16 +15,15 @@ const useGraphQlJit = (compilerOptions = {}, pluginOptions = {}) => {
15
15
  ? pluginOptions.cache
16
16
  : new lru_cache_1.default({ max: DEFAULT_MAX, maxAge: DEFAULT_TTL });
17
17
  function getCacheEntry(args) {
18
- var _a;
19
18
  let cacheEntry;
20
19
  const documentSource = documentSourceMap.get(args.document);
21
20
  if (documentSource) {
22
21
  cacheEntry = jitCache.get(documentSource);
23
22
  }
24
23
  if (!cacheEntry) {
25
- const compilationResult = (0, graphql_jit_1.compileQuery)(args.schema, args.document, (_a = args.operationName) !== null && _a !== void 0 ? _a : undefined, compilerOptions);
24
+ const compilationResult = (0, graphql_jit_1.compileQuery)(args.schema, args.document, args.operationName ?? undefined, compilerOptions);
26
25
  if (!(0, graphql_jit_1.isCompiledQuery)(compilationResult)) {
27
- if (pluginOptions === null || pluginOptions === void 0 ? void 0 : pluginOptions.onError) {
26
+ if (pluginOptions?.onError) {
28
27
  pluginOptions.onError(compilationResult);
29
28
  }
30
29
  else {
package/esm/index.js CHANGED
@@ -11,16 +11,15 @@ export const useGraphQlJit = (compilerOptions = {}, pluginOptions = {}) => {
11
11
  ? pluginOptions.cache
12
12
  : new LRU({ max: DEFAULT_MAX, maxAge: DEFAULT_TTL });
13
13
  function getCacheEntry(args) {
14
- var _a;
15
14
  let cacheEntry;
16
15
  const documentSource = documentSourceMap.get(args.document);
17
16
  if (documentSource) {
18
17
  cacheEntry = jitCache.get(documentSource);
19
18
  }
20
19
  if (!cacheEntry) {
21
- const compilationResult = compileQuery(args.schema, args.document, (_a = args.operationName) !== null && _a !== void 0 ? _a : undefined, compilerOptions);
20
+ const compilationResult = compileQuery(args.schema, args.document, args.operationName ?? undefined, compilerOptions);
22
21
  if (!isCompiledQuery(compilationResult)) {
23
- if (pluginOptions === null || pluginOptions === void 0 ? void 0 : pluginOptions.onError) {
22
+ if (pluginOptions?.onError) {
24
23
  pluginOptions.onError(compilationResult);
25
24
  }
26
25
  else {
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@envelop/graphql-jit",
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": {