feat(config): valibot schemas, schema version, migrations, filter AST

This commit is contained in:
RhenCloud committed 2026-08-15 17:03:42 +08:00
1 parent eaec039ad4
commit 2470bd786d
13 files changed
+617 -191

No files matched your search

+35
View File
@@ -60,6 +60,12 @@ export interface Route {
filters: Filter[];
targets: RouteTarget[];
groupId?: string;
/**
* Optional explicit filter expression tree. When present it replaces the
* flat `filters` array (which is equivalent to `{ all: filters }`). Omitted
* on routes stored without an AST — matching falls back to `filters`.
*/
ast?: FilterNode;
/**
* Fallback route: only fires when no other (non-fallback) route matched the
* event. Multiple fallback routes may exist; they are all skipped whenever at
@@ -154,6 +160,35 @@ export interface Filter {
exclude?: boolean;
}
/**
* A filter node matches an event when every child matches.
*/
export interface FilterAll {
all: FilterNode[];
}
/**
* A filter node matches an event when any child matches.
*/
export interface FilterAny {
any: FilterNode[];
}
/**
* A filter node matches an event when its child does not match.
*/
export interface FilterNot {
not: FilterNode;
}
/**
* A composable filter expression tree. Leaf nodes are `Filter`; the `all`,
* `any` and `not` nodes compose them. A route's `filters` array stays the
* flat AND-of-filters form (equivalent to `{ all: filters }`); `ast` optionally
* replaces it with an explicit tree.
*/
export type FilterNode = Filter | FilterAll | FilterAny | FilterNot;
export type WebhookProvider = "github" | "gitea" | "gitlab" | "custom";
export interface WebhookEvent {