1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { z } from "npm:zod";
import { config } from "https://esm.town/v/emarref/EnvironmentConfig";
import { add, chain, send } from "https://esm.town/v/emarref/HttpMiddlewareChain";
import { requireHttpMethod } from "https://esm.town/v/emarref/HttpMiddlewareRequireHttpMethod";
import { validateRequest } from "https://esm.town/v/emarref/XeroWebhookMiddlewareValidateRequest";
const env = config({
XERO_WEBHOOK_SIGNING_KEY: z.string(),
});
export default await chain()
.then(add(requireHttpMethod("POST")))
.then(add(validateRequest(env.XERO_WEBHOOK_SIGNING_KEY)))
.then(send());