RequestFilterSchema is part of core

This commit is contained in:
Matt Aitken
2023-10-20 13:04:24 +01:00
parent 81d55f94a0
commit 0cd79fd83c
3 changed files with 16 additions and 1 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
import { z } from "zod";
const stringPatternMatchers = [
export const stringPatternMatchers = [
z.object({
$endsWith: z.string(),
}),
+1
View File
@@ -2,6 +2,7 @@ export * from "./api";
export * from "./json";
export * from "./triggers";
export * from "./eventFilter";
export * from "./requestFilter";
export * from "./errors";
export * from "./tasks";
export * from "./properties";
@@ -0,0 +1,14 @@
import { z } from "zod";
import { EventFilterSchema, stringPatternMatchers } from "./eventFilter";
const StringMatchSchema = z.union([
/** Match against a string */
z.array(z.string()),
z.array(z.union(stringPatternMatchers)),
]);
export const RequestFilterSchema = z.object({
headers: z.record(StringMatchSchema),
query: z.record(StringMatchSchema),
body: EventFilterSchema.optional(),
});