@graphql-mesh/http 0.94.1 → 0.94.2
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 +18 -18
- package/esm/index.js +18 -18
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -36,24 +36,6 @@ function createMeshHTTPHandler({ baseDir, getBuiltMesh, rawServeConfig = {}, pla
|
|
|
36
36
|
}));
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
if (readyFlag) {
|
|
40
|
-
return mesh$.then(async (mesh) => {
|
|
41
|
-
for (const eventName of mesh.pubsub.getEventNames()) {
|
|
42
|
-
if (eventName === `webhook:${request.method.toLowerCase()}:${url.pathname}`) {
|
|
43
|
-
const body = await request.text();
|
|
44
|
-
logger.debug(`Received webhook request for ${url.pathname}`, body);
|
|
45
|
-
mesh.pubsub.publish(eventName, request.headers.get('content-type') === 'application/json'
|
|
46
|
-
? JSON.parse(body)
|
|
47
|
-
: body);
|
|
48
|
-
endResponse(new server_1.Response(null, {
|
|
49
|
-
status: 204,
|
|
50
|
-
statusText: 'OK',
|
|
51
|
-
}));
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
39
|
if (staticFiles && request.method === 'GET') {
|
|
58
40
|
let relativePath = url.pathname;
|
|
59
41
|
if (relativePath === '/' || !relativePath) {
|
|
@@ -83,6 +65,24 @@ function createMeshHTTPHandler({ baseDir, getBuiltMesh, rawServeConfig = {}, pla
|
|
|
83
65
|
return;
|
|
84
66
|
}
|
|
85
67
|
(0, utils_1.withCookies)(request);
|
|
68
|
+
if (readyFlag) {
|
|
69
|
+
return mesh$.then(async (mesh) => {
|
|
70
|
+
for (const eventName of mesh.pubsub.getEventNames()) {
|
|
71
|
+
if (eventName === `webhook:${request.method.toLowerCase()}:${url.pathname}`) {
|
|
72
|
+
const body = await request.text();
|
|
73
|
+
logger.debug(`Received webhook request for ${url.pathname}`, body);
|
|
74
|
+
mesh.pubsub.publish(eventName, request.headers.get('content-type') === 'application/json'
|
|
75
|
+
? JSON.parse(body)
|
|
76
|
+
: body);
|
|
77
|
+
endResponse(new server_1.Response(null, {
|
|
78
|
+
status: 204,
|
|
79
|
+
statusText: 'OK',
|
|
80
|
+
}));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
86
|
},
|
|
87
87
|
},
|
|
88
88
|
],
|
package/esm/index.js
CHANGED
|
@@ -33,24 +33,6 @@ export function createMeshHTTPHandler({ baseDir, getBuiltMesh, rawServeConfig =
|
|
|
33
33
|
}));
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
if (readyFlag) {
|
|
37
|
-
return mesh$.then(async (mesh) => {
|
|
38
|
-
for (const eventName of mesh.pubsub.getEventNames()) {
|
|
39
|
-
if (eventName === `webhook:${request.method.toLowerCase()}:${url.pathname}`) {
|
|
40
|
-
const body = await request.text();
|
|
41
|
-
logger.debug(`Received webhook request for ${url.pathname}`, body);
|
|
42
|
-
mesh.pubsub.publish(eventName, request.headers.get('content-type') === 'application/json'
|
|
43
|
-
? JSON.parse(body)
|
|
44
|
-
: body);
|
|
45
|
-
endResponse(new Response(null, {
|
|
46
|
-
status: 204,
|
|
47
|
-
statusText: 'OK',
|
|
48
|
-
}));
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
36
|
if (staticFiles && request.method === 'GET') {
|
|
55
37
|
let relativePath = url.pathname;
|
|
56
38
|
if (relativePath === '/' || !relativePath) {
|
|
@@ -80,6 +62,24 @@ export function createMeshHTTPHandler({ baseDir, getBuiltMesh, rawServeConfig =
|
|
|
80
62
|
return;
|
|
81
63
|
}
|
|
82
64
|
withCookies(request);
|
|
65
|
+
if (readyFlag) {
|
|
66
|
+
return mesh$.then(async (mesh) => {
|
|
67
|
+
for (const eventName of mesh.pubsub.getEventNames()) {
|
|
68
|
+
if (eventName === `webhook:${request.method.toLowerCase()}:${url.pathname}`) {
|
|
69
|
+
const body = await request.text();
|
|
70
|
+
logger.debug(`Received webhook request for ${url.pathname}`, body);
|
|
71
|
+
mesh.pubsub.publish(eventName, request.headers.get('content-type') === 'application/json'
|
|
72
|
+
? JSON.parse(body)
|
|
73
|
+
: body);
|
|
74
|
+
endResponse(new Response(null, {
|
|
75
|
+
status: 204,
|
|
76
|
+
statusText: 'OK',
|
|
77
|
+
}));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
],
|