@envelop/graphql-jit 4.4.1-alpha-ffbace6f.0 → 5.0.0-alpha-5b6bfa8.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 +7 -2
- package/esm/index.js +7 -2
- package/package.json +5 -3
- package/typings/index.d.ts +1 -1
package/cjs/index.js
CHANGED
|
@@ -3,10 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useGraphQlJit = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
/* eslint-disable no-console */
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
7
|
+
// @ts-nocheck MAKE ME WORK
|
|
6
8
|
const core_1 = require("@envelop/core");
|
|
7
|
-
const graphql_1 = require("graphql");
|
|
9
|
+
const graphql_1 = require("@graphql-tools/graphql");
|
|
8
10
|
const graphql_jit_1 = require("graphql-jit");
|
|
9
11
|
const lru_cache_1 = tslib_1.__importDefault(require("lru-cache"));
|
|
12
|
+
const compat_1 = require("@graphql-tools/compat");
|
|
10
13
|
const DEFAULT_MAX = 1000;
|
|
11
14
|
const DEFAULT_TTL = 3600000;
|
|
12
15
|
const useGraphQlJit = (compilerOptions = {}, pluginOptions = {}) => {
|
|
@@ -22,7 +25,9 @@ const useGraphQlJit = (compilerOptions = {}, pluginOptions = {}) => {
|
|
|
22
25
|
cacheEntry = jitCache.get(documentSource);
|
|
23
26
|
}
|
|
24
27
|
if (!cacheEntry) {
|
|
25
|
-
|
|
28
|
+
// TODO: CACHE ME
|
|
29
|
+
const schema = (0, compat_1.compatSchema)(args.schema);
|
|
30
|
+
const compilationResult = (0, graphql_jit_1.compileQuery)(schema, args.document, (_a = args.operationName) !== null && _a !== void 0 ? _a : undefined, compilerOptions);
|
|
26
31
|
if (!(0, graphql_jit_1.isCompiledQuery)(compilationResult)) {
|
|
27
32
|
if (pluginOptions === null || pluginOptions === void 0 ? void 0 : pluginOptions.onError) {
|
|
28
33
|
pluginOptions.onError(compilationResult);
|
package/esm/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3
|
+
// @ts-nocheck MAKE ME WORK
|
|
2
4
|
import { makeExecute, makeSubscribe } from '@envelop/core';
|
|
3
|
-
import { Source } from 'graphql';
|
|
5
|
+
import { Source } from '@graphql-tools/graphql';
|
|
4
6
|
import { compileQuery, isCompiledQuery } from 'graphql-jit';
|
|
5
7
|
import LRU from 'lru-cache';
|
|
8
|
+
import { compatSchema } from '@graphql-tools/compat';
|
|
6
9
|
const DEFAULT_MAX = 1000;
|
|
7
10
|
const DEFAULT_TTL = 3600000;
|
|
8
11
|
export const useGraphQlJit = (compilerOptions = {}, pluginOptions = {}) => {
|
|
@@ -18,7 +21,9 @@ export const useGraphQlJit = (compilerOptions = {}, pluginOptions = {}) => {
|
|
|
18
21
|
cacheEntry = jitCache.get(documentSource);
|
|
19
22
|
}
|
|
20
23
|
if (!cacheEntry) {
|
|
21
|
-
|
|
24
|
+
// TODO: CACHE ME
|
|
25
|
+
const schema = compatSchema(args.schema);
|
|
26
|
+
const compilationResult = compileQuery(schema, args.document, (_a = args.operationName) !== null && _a !== void 0 ? _a : undefined, compilerOptions);
|
|
22
27
|
if (!isCompiledQuery(compilationResult)) {
|
|
23
28
|
if (pluginOptions === null || pluginOptions === void 0 ? void 0 : pluginOptions.onError) {
|
|
24
29
|
pluginOptions.onError(compilationResult);
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/graphql-jit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-alpha-5b6bfa8.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "
|
|
7
|
-
"graphql": "
|
|
6
|
+
"@envelop/core": "3.0.0-alpha-5b6bfa8.0",
|
|
7
|
+
"@graphql-tools/graphql": "0.1.0-alpha-33fb2950.0",
|
|
8
|
+
"graphql": "^15 | ^16"
|
|
8
9
|
},
|
|
9
10
|
"dependencies": {
|
|
11
|
+
"@graphql-tools/compat": "0.0.1-alpha-33fb2950.0",
|
|
10
12
|
"graphql-jit": "^0.7.0",
|
|
11
13
|
"lru-cache": "^6.0.0"
|
|
12
14
|
},
|
package/typings/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from '@envelop/core';
|
|
2
|
-
import { ExecutionArgs, ExecutionResult } from 'graphql';
|
|
2
|
+
import { ExecutionArgs, ExecutionResult } from '@graphql-tools/graphql';
|
|
3
3
|
import { CompilerOptions, CompiledQuery } from 'graphql-jit';
|
|
4
4
|
declare type JITCacheEntry = {
|
|
5
5
|
query: CompiledQuery['query'];
|