netlify-onegraph-internal
Advanced tools
Comparing version 0.0.31 to 0.0.32
@@ -64,3 +64,3 @@ "use strict"; | ||
], | ||
content: "import { json, Form, useActionData, useTransition } from \"remix\";\nimport type { ActionFunction } from \"remix\";\nimport NetlifyGraph from \"" + netlifyGraphConfig.netlifyGraphRequirePath + "\";" + ts(netlifyGraphConfig, "\nimport invariant from \"tiny-invariant\";") + "\n\n" + exp(netlifyGraphConfig, "action") + ts(netlifyGraphConfig, ": ActionFunction") + " = async ({ netlifyGraphToken, request }) => {\n const formData = await request.formData();\n\n // By default, all API calls use no authentication\n let accessToken;\n\n //// If you want to use the API with your own access token:\n // accessToken = netlifyGraphToken;\n\n " + fetcherInvocation + "\n\n return json({ data, errors });\n};\n\nexport default function handler() {\n const results = useActionData();\n const transition = useTransition();\n\n const errors = results?.errors;\n const data" + ts(netlifyGraphConfig, ": NetlifyGraph." + capitalizeFirstLetter(opts.operationData.name) + "[\"data\"]") + " = results?.data;\n\n\n return (\n <Form method=\"post\">\n " + form.formEl + "\n {errors ? (<pre className=\"error\">{JSON.stringify(errors, null, 2)}</pre>) : null}\n {data ? (<pre>{JSON.stringify(data, null, 2)}</pre>) : null}\n </Form>\n );\n}\n", | ||
content: ts(netlifyGraphConfig, "import { DataFunctionArgs } from \"@remix-run/server-runtime\";\n") + "import { json, Form, useActionData, useTransition } from \"remix\";\nimport type { ActionFunction } from \"remix\";\nimport NetlifyGraph from \"" + netlifyGraphConfig.netlifyGraphRequirePath + "\";" + ts(netlifyGraphConfig, "\nimport invariant from \"tiny-invariant\";") + "\n\n" + exp(netlifyGraphConfig, "action") + ts(netlifyGraphConfig, ": ActionFunction") + " = async ({ netlifyGraphToken, request }" + ts(netlifyGraphConfig, ": DataFunctionArgs & { netlifyGraphToken?: string; }") + ") => {\n const formData = await request.formData();\n\n // By default, all API calls use no authentication\n let accessToken;\n\n //// If you want to use the API with your own access token:\n // accessToken = netlifyGraphToken;\n\n " + fetcherInvocation + "\n\n return json({ data, errors });\n};\n\nexport default function handler() {\n const results = useActionData();\n const transition = useTransition();\n\n const errors = results?.errors;\n const data" + ts(netlifyGraphConfig, ": NetlifyGraph." + capitalizeFirstLetter(opts.operationData.name) + "[\"data\"]") + " = results?.data;\n\n\n return (\n <Form method=\"post\">\n " + form.formEl + "\n {errors ? (<pre className=\"error\">{JSON.stringify(errors, null, 2)}</pre>) : null}\n {data ? (<pre>{JSON.stringify(data, null, 2)}</pre>) : null}\n </Form>\n );\n}\n", | ||
}; | ||
@@ -362,3 +362,3 @@ }; | ||
], | ||
content: "import { " + ts(netlifyGraphConfig, "ActionFunction, ") + "json } from \"remix\";\nimport NetlifyGraph from \"../" + netlifyGraphConfig.netlifyGraphRequirePath + "\";\n\n" + exp(netlifyGraphConfig, "action") + ts(netlifyGraphConfig, ": ActionFunction") + " = async ({ netlifyGraphSignature, request }) => {\n const reqBody = await request.text();\n\n const payload = NetlifyGraph.parseAndVerify" + operationData.name + "Event({\n body: reqBody,\n headers: {\n 'x-netlify-graph-signature': netlifyGraphSignature\n },\n });\n\n if (!payload) {\n return json({\n success: false,\n error: 'Unable to verify payload signature',\n }, { status: 422 });\n }\n\n const { errors, data } = payload;\n\n if (errors) {\n console.error(errors);\n }\n\n console.log(data);\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 json({}, { status: 410 });\n */\n\n return json({\n successfullyProcessedIncomingWebhook: true,\n });\n};\n", | ||
content: ts(netlifyGraphConfig, "import { DataFunctionArgs } from \"@remix-run/server-runtime\";\n ") + "import { " + ts(netlifyGraphConfig, "ActionFunction, ") + "json } from \"remix\";\nimport NetlifyGraph from \"../" + netlifyGraphConfig.netlifyGraphRequirePath + "\";\n\n" + exp(netlifyGraphConfig, "action") + ts(netlifyGraphConfig, ": ActionFunction") + " = async ({ netlifyGraphSignature, request }" + ts(netlifyGraphConfig, ": DataFunctionArgs & { netlifyGraphSignature?: string; }") + ") => {\n const reqBody = await request.text();\n\n const payload = NetlifyGraph.parseAndVerify" + operationData.name + "Event({\n body: reqBody,\n headers: {\n 'x-netlify-graph-signature': netlifyGraphSignature\n },\n });\n\n if (!payload) {\n return json({\n success: false,\n error: 'Unable to verify payload signature',\n }, { status: 422 });\n }\n\n const { errors, data } = payload;\n\n if (errors) {\n console.error(errors);\n }\n\n console.log(data);\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 json({}, { status: 410 });\n */\n\n return json({\n successfullyProcessedIncomingWebhook: true,\n });\n};\n", | ||
}; | ||
@@ -365,0 +365,0 @@ }; |
{ | ||
"name": "netlify-onegraph-internal", | ||
"version": "0.0.31", | ||
"version": "0.0.32", | ||
"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
337137
4397