RequestFilterSchema is part of core
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
const stringPatternMatchers = [
|
||||
export const stringPatternMatchers = [
|
||||
z.object({
|
||||
$endsWith: z.string(),
|
||||
}),
|
||||
|
||||
@@ -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(),
|
||||
});
|
||||
Reference in New Issue
Block a user