netlify-onegraph-internal
Advanced tools
Comparing version 0.0.26 to 0.0.27
@@ -334,3 +334,3 @@ "use strict"; | ||
kind: "UnnamedExportedFile", | ||
content: "" + ts(netlifyGraphConfig, 'import type { NextApiRequest, NextApiResponse } from "next";\n') + imp(netlifyGraphConfig, "NetlifyGraph", netlifyGraphConfig.netlifyGraphRequirePath) + ";\n\n" + exp(netlifyGraphConfig, "handler") + " = async (req" + ts(netlifyGraphConfig, ": NextApiRequest") + ", res" + ts(netlifyGraphConfig, ": NextApiResponse") + ") => {\n const reqBody = await extractBody(req);\n\n const payload = NetlifyGraph.parseAndVerify" + operationData.name + "Event({\n headers: req.headers,\n body: reqBody,\n });\n\n if (!payload) {\n return res.status(422).json({\n success: false,\n error: 'Unable to verify payload signature',\n });\n }\n\n const { errors, data } = payload;\n\n if (errors) {\n console.error(errors);\n }\n\n console.log(data);\n\n res.setHeader(\"Content-Type\", \"application/json\");\n\n /**\n * If you want to unsubscribe from this webhook\n * in order to stop receiving new events,\n * simply return status 410, e.g.:\n * \n * return res.status(410).json({});\n */\n\n return res.status(200).json({\n successfullyProcessedIncomingWebhook: true,\n });\n};\n\n" + expDefault(netlifyGraphConfig, "handler") + ";\n\nexport const config = {\n api: {\n // We manually parse the body of the request in order to verify\n // that it's signed by Netlify before processing the event.\n bodyParser: false,\n },\n};\n\nconst extractBody = (req" + ts(netlifyGraphConfig, ": NextApiRequest") + ")" + ts(netlifyGraphConfig, ": Promise<string>") + " => {\n let body = [];\n const promise" + ts(netlifyGraphConfig, ": Promise<string>") + " = new Promise((resolve, reject) => {\n req\n .on(\"data\", (chunk) => {\n body.push(chunk);\n })\n .on(\"end\", () => {\n const fullBody = Buffer.concat(body).toString();\n resolve(fullBody);\n });\n });\n\n return promise;\n};\n", | ||
content: "" + ts(netlifyGraphConfig, 'import type { NextApiRequest, NextApiResponse } from "next";\n') + imp(netlifyGraphConfig, "NetlifyGraph", netlifyGraphConfig.netlifyGraphRequirePath) + ";\n\n" + exp(netlifyGraphConfig, "handler") + " = async (req" + ts(netlifyGraphConfig, ": NextApiRequest") + ", res" + ts(netlifyGraphConfig, ": NextApiResponse") + ") => {\n const reqBody = await extractBody(req);\n\n const payload = NetlifyGraph.parseAndVerify" + operationData.name + "Event({\n headers: {\n \"x-netlify-graph-signature\": req.headers[\n \"x-netlify-graph-signature\"\n ]" + ts(netlifyGraphConfig, " as string") + "\n },\n body: reqBody,\n });\n\n if (!payload) {\n return res.status(422).json({\n success: false,\n error: 'Unable to verify payload signature',\n });\n }\n\n const { errors, data } = payload;\n\n if (errors) {\n console.error(errors);\n }\n\n console.log(data);\n\n res.setHeader(\"Content-Type\", \"application/json\");\n\n /**\n * If you want to unsubscribe from this webhook\n * in order to stop receiving new events,\n * simply return status 410, e.g.:\n * \n * return res.status(410).json({});\n */\n\n return res.status(200).json({\n successfullyProcessedIncomingWebhook: true,\n });\n};\n\n" + expDefault(netlifyGraphConfig, "handler") + ";\n\nexport const config = {\n api: {\n // We manually parse the body of the request in order to verify\n // that it's signed by Netlify before processing the event.\n bodyParser: false,\n },\n};\n\nconst extractBody = (req" + ts(netlifyGraphConfig, ": NextApiRequest") + ")" + ts(netlifyGraphConfig, ": Promise<string>") + " => {\n let body = [];\n const promise" + ts(netlifyGraphConfig, ": Promise<string>") + " = new Promise((resolve, reject) => {\n req\n .on(\"data\", (chunk) => {\n body.push(chunk);\n })\n .on(\"end\", () => {\n const fullBody = Buffer.concat(body).toString();\n resolve(fullBody);\n });\n });\n\n return promise;\n};\n", | ||
}; | ||
@@ -337,0 +337,0 @@ }; |
{ | ||
"name": "netlify-onegraph-internal", | ||
"version": "0.0.26", | ||
"version": "0.0.27", | ||
"description": "Internal tools for use by Netlify", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
335766