mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 07:11:25 +00:00
refactor: centralize outbound policy + target schema
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import {
|
||||
CHANNEL_TARGET_DESCRIPTION,
|
||||
CHANNEL_TARGETS_DESCRIPTION,
|
||||
} from "../../infra/outbound/channel-target.js";
|
||||
|
||||
type StringEnumOptions<T extends readonly string[]> = {
|
||||
description?: string;
|
||||
@@ -25,3 +29,13 @@ export function optionalStringEnum<T extends readonly string[]>(
|
||||
) {
|
||||
return Type.Optional(stringEnum(values, options));
|
||||
}
|
||||
|
||||
export function channelTargetSchema(options?: { description?: string }) {
|
||||
return Type.String({
|
||||
description: options?.description ?? CHANNEL_TARGET_DESCRIPTION,
|
||||
});
|
||||
}
|
||||
|
||||
export function channelTargetsSchema(options?: { description?: string }) {
|
||||
return Type.Array(channelTargetSchema({ description: options?.description ?? CHANNEL_TARGETS_DESCRIPTION }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user