@graphql-mesh/http 0.94.4 → 0.94.5
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/graphqlHandler.js +2 -1
- package/cjs/index.js +9 -2
- package/esm/graphqlHandler.js +2 -1
- package/esm/index.js +9 -2
- package/package.json +4 -4
- package/typings/graphqlHandler.d.cts +8 -1
- package/typings/graphqlHandler.d.ts +8 -1
package/cjs/graphqlHandler.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.graphqlHandler = void 0;
|
|
4
4
|
const graphql_yoga_1 = require("graphql-yoga");
|
|
5
|
-
const graphqlHandler = (getBuiltMesh, playgroundTitle, playgroundEnabled, graphqlEndpoint, corsConfig) => {
|
|
5
|
+
const graphqlHandler = ({ getBuiltMesh, playgroundTitle, playgroundEnabled, graphqlEndpoint, corsConfig, batchingLimit, }) => {
|
|
6
6
|
let yoga$;
|
|
7
7
|
return (request, ctx) => {
|
|
8
8
|
if (!yoga$) {
|
|
@@ -26,6 +26,7 @@ const graphqlHandler = (getBuiltMesh, playgroundTitle, playgroundEnabled, graphq
|
|
|
26
26
|
cors: corsConfig,
|
|
27
27
|
graphqlEndpoint,
|
|
28
28
|
landingPage: false,
|
|
29
|
+
batching: batchingLimit ? { limit: batchingLimit } : false,
|
|
29
30
|
}));
|
|
30
31
|
}
|
|
31
32
|
return yoga$.then(yoga => yoga.handleRequest(request, ctx));
|
package/cjs/index.js
CHANGED
|
@@ -9,11 +9,18 @@ function createMeshHTTPHandler({ baseDir, getBuiltMesh, rawServeConfig = {}, pla
|
|
|
9
9
|
let readyFlag = false;
|
|
10
10
|
let logger = new utils_1.DefaultLogger('Mesh HTTP');
|
|
11
11
|
let mesh$;
|
|
12
|
-
const { cors: corsConfig, staticFiles, playground: playgroundEnabled, endpoint: graphqlPath = '/graphql',
|
|
12
|
+
const { cors: corsConfig, staticFiles, playground: playgroundEnabled, endpoint: graphqlPath = '/graphql', batchingLimit,
|
|
13
13
|
// TODO
|
|
14
14
|
// trustProxy = 'loopback',
|
|
15
15
|
} = rawServeConfig;
|
|
16
|
-
return (0, server_1.createServerAdapter)((0, graphqlHandler_js_1.graphqlHandler)(
|
|
16
|
+
return (0, server_1.createServerAdapter)((0, graphqlHandler_js_1.graphqlHandler)({
|
|
17
|
+
getBuiltMesh: () => mesh$,
|
|
18
|
+
playgroundTitle,
|
|
19
|
+
playgroundEnabled,
|
|
20
|
+
graphqlEndpoint: graphqlPath,
|
|
21
|
+
corsConfig,
|
|
22
|
+
batchingLimit,
|
|
23
|
+
}), {
|
|
17
24
|
plugins: [
|
|
18
25
|
{
|
|
19
26
|
onRequest({ request, url, endResponse }) {
|
package/esm/graphqlHandler.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createYoga, useLogger } from 'graphql-yoga';
|
|
2
|
-
export const graphqlHandler = (getBuiltMesh, playgroundTitle, playgroundEnabled, graphqlEndpoint, corsConfig) => {
|
|
2
|
+
export const graphqlHandler = ({ getBuiltMesh, playgroundTitle, playgroundEnabled, graphqlEndpoint, corsConfig, batchingLimit, }) => {
|
|
3
3
|
let yoga$;
|
|
4
4
|
return (request, ctx) => {
|
|
5
5
|
if (!yoga$) {
|
|
@@ -23,6 +23,7 @@ export const graphqlHandler = (getBuiltMesh, playgroundTitle, playgroundEnabled,
|
|
|
23
23
|
cors: corsConfig,
|
|
24
24
|
graphqlEndpoint,
|
|
25
25
|
landingPage: false,
|
|
26
|
+
batching: batchingLimit ? { limit: batchingLimit } : false,
|
|
26
27
|
}));
|
|
27
28
|
}
|
|
28
29
|
return yoga$.then(yoga => yoga.handleRequest(request, ctx));
|
package/esm/index.js
CHANGED
|
@@ -6,11 +6,18 @@ export function createMeshHTTPHandler({ baseDir, getBuiltMesh, rawServeConfig =
|
|
|
6
6
|
let readyFlag = false;
|
|
7
7
|
let logger = new DefaultLogger('Mesh HTTP');
|
|
8
8
|
let mesh$;
|
|
9
|
-
const { cors: corsConfig, staticFiles, playground: playgroundEnabled, endpoint: graphqlPath = '/graphql',
|
|
9
|
+
const { cors: corsConfig, staticFiles, playground: playgroundEnabled, endpoint: graphqlPath = '/graphql', batchingLimit,
|
|
10
10
|
// TODO
|
|
11
11
|
// trustProxy = 'loopback',
|
|
12
12
|
} = rawServeConfig;
|
|
13
|
-
return createServerAdapter(graphqlHandler(
|
|
13
|
+
return createServerAdapter(graphqlHandler({
|
|
14
|
+
getBuiltMesh: () => mesh$,
|
|
15
|
+
playgroundTitle,
|
|
16
|
+
playgroundEnabled,
|
|
17
|
+
graphqlEndpoint: graphqlPath,
|
|
18
|
+
corsConfig,
|
|
19
|
+
batchingLimit,
|
|
20
|
+
}), {
|
|
14
21
|
plugins: [
|
|
15
22
|
{
|
|
16
23
|
onRequest({ request, url, endResponse }) {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-mesh/http",
|
|
3
|
-
"version": "0.94.
|
|
3
|
+
"version": "0.94.5",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@graphql-mesh/cross-helpers": "^0.4.0",
|
|
7
|
-
"@graphql-mesh/runtime": "^0.94.
|
|
8
|
-
"@graphql-mesh/types": "^0.94.
|
|
9
|
-
"@graphql-mesh/utils": "^0.94.
|
|
7
|
+
"@graphql-mesh/runtime": "^0.94.2",
|
|
8
|
+
"@graphql-mesh/types": "^0.94.2",
|
|
9
|
+
"@graphql-mesh/utils": "^0.94.2",
|
|
10
10
|
"graphql": "*",
|
|
11
11
|
"tslib": "^2.4.0"
|
|
12
12
|
},
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { CORSOptions } from 'graphql-yoga';
|
|
2
2
|
import { MeshInstance } from '@graphql-mesh/runtime';
|
|
3
|
-
export declare const graphqlHandler: (getBuiltMesh
|
|
3
|
+
export declare const graphqlHandler: ({ getBuiltMesh, playgroundTitle, playgroundEnabled, graphqlEndpoint, corsConfig, batchingLimit, }: {
|
|
4
|
+
getBuiltMesh: () => Promise<MeshInstance>;
|
|
5
|
+
playgroundTitle: string;
|
|
6
|
+
playgroundEnabled: boolean;
|
|
7
|
+
graphqlEndpoint: string;
|
|
8
|
+
corsConfig: CORSOptions;
|
|
9
|
+
batchingLimit?: number;
|
|
10
|
+
}) => (request: Request, ctx: any) => Promise<Response>;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { CORSOptions } from 'graphql-yoga';
|
|
2
2
|
import { MeshInstance } from '@graphql-mesh/runtime';
|
|
3
|
-
export declare const graphqlHandler: (getBuiltMesh
|
|
3
|
+
export declare const graphqlHandler: ({ getBuiltMesh, playgroundTitle, playgroundEnabled, graphqlEndpoint, corsConfig, batchingLimit, }: {
|
|
4
|
+
getBuiltMesh: () => Promise<MeshInstance>;
|
|
5
|
+
playgroundTitle: string;
|
|
6
|
+
playgroundEnabled: boolean;
|
|
7
|
+
graphqlEndpoint: string;
|
|
8
|
+
corsConfig: CORSOptions;
|
|
9
|
+
batchingLimit?: number;
|
|
10
|
+
}) => (request: Request, ctx: any) => Promise<Response>;
|