@envelop/graphql-jit 5.0.0-alpha-5b6bfa8.0 → 5.0.0-alpha-975a6c5.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/cjs/index.js CHANGED
@@ -26,7 +26,7 @@ const useGraphQlJit = (compilerOptions = {}, pluginOptions = {}) => {
26
26
  }
27
27
  if (!cacheEntry) {
28
28
  // TODO: CACHE ME
29
- const schema = (0, compat_1.compatSchema)(args.schema);
29
+ const schema = compat_1.compatSchema.toGraphQLJS(args.schema);
30
30
  const compilationResult = (0, graphql_jit_1.compileQuery)(schema, args.document, (_a = args.operationName) !== null && _a !== void 0 ? _a : undefined, compilerOptions);
31
31
  if (!(0, graphql_jit_1.isCompiledQuery)(compilationResult)) {
32
32
  if (pluginOptions === null || pluginOptions === void 0 ? void 0 : pluginOptions.onError) {
package/esm/index.js CHANGED
@@ -22,7 +22,7 @@ export const useGraphQlJit = (compilerOptions = {}, pluginOptions = {}) => {
22
22
  }
23
23
  if (!cacheEntry) {
24
24
  // TODO: CACHE ME
25
- const schema = compatSchema(args.schema);
25
+ const schema = compatSchema.toGraphQLJS(args.schema);
26
26
  const compilationResult = compileQuery(schema, args.document, (_a = args.operationName) !== null && _a !== void 0 ? _a : undefined, compilerOptions);
27
27
  if (!isCompiledQuery(compilationResult)) {
28
28
  if (pluginOptions === null || pluginOptions === void 0 ? void 0 : pluginOptions.onError) {
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@envelop/graphql-jit",
3
- "version": "5.0.0-alpha-5b6bfa8.0",
3
+ "version": "5.0.0-alpha-975a6c5.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@envelop/core": "3.0.0-alpha-5b6bfa8.0",
7
- "@graphql-tools/graphql": "0.1.0-alpha-33fb2950.0",
8
- "graphql": "^15 | ^16"
6
+ "@envelop/core": "3.0.0-alpha-975a6c5.0",
7
+ "@graphql-tools/graphql": "0.1.0-alpha-e7752ba5.0",
8
+ "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
9
9
  },
10
10
  "dependencies": {
11
- "@graphql-tools/compat": "0.0.1-alpha-33fb2950.0",
11
+ "@graphql-tools/compat": "0.0.1-alpha-e7752ba5.0",
12
12
  "graphql-jit": "^0.7.0",
13
13
  "lru-cache": "^6.0.0"
14
14
  },
@@ -29,7 +29,7 @@
29
29
  "exports": {
30
30
  ".": {
31
31
  "require": {
32
- "types": "./typings/index.d.ts",
32
+ "types": "./typings/index.d.cts",
33
33
  "default": "./cjs/index.js"
34
34
  },
35
35
  "import": {
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "./*": {
45
45
  "require": {
46
- "types": "./typings/*.d.ts",
46
+ "types": "./typings/*.d.cts",
47
47
  "default": "./cjs/*.js"
48
48
  },
49
49
  "import": {
@@ -0,0 +1,26 @@
1
+ import { Plugin } from '@envelop/core';
2
+ import { ExecutionArgs, ExecutionResult } from '@graphql-tools/graphql';
3
+ import { CompilerOptions, CompiledQuery } from 'graphql-jit';
4
+ declare type JITCacheEntry = {
5
+ query: CompiledQuery['query'];
6
+ subscribe?: CompiledQuery['subscribe'];
7
+ };
8
+ export interface JITCache {
9
+ get(key: string): JITCacheEntry | undefined;
10
+ set(key: string, value: JITCacheEntry): void;
11
+ }
12
+ export declare const useGraphQlJit: (compilerOptions?: Partial<CompilerOptions>, pluginOptions?: {
13
+ /**
14
+ * A helper function that helps to conditionally enable JIT based on incoming request
15
+ */
16
+ enableIf?: ((executionArgs: ExecutionArgs) => boolean | Promise<boolean>) | undefined;
17
+ /**
18
+ * Callback triggered in case of GraphQL Jit compilation error.
19
+ */
20
+ onError?: ((r: ExecutionResult) => void) | undefined;
21
+ /**
22
+ * Custom cache instance
23
+ */
24
+ cache?: JITCache | undefined;
25
+ }) => Plugin;
26
+ export {};