mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 14:18:26 +00:00
cron: separate webhook POST delivery from announce (#17901)
* cron: split webhook delivery from announce mode * cron: validate webhook delivery target * cron: remove legacy webhook fallback config * fix: finalize cron webhook delivery prep (#17901) (thanks @advaitpaliwal) --------- Co-authored-by: Tyler Yust <TYTYYUST@YAHOO.COM>
This commit is contained in:
@@ -5,16 +5,28 @@ import { MACOS_APP_SOURCES_DIR } from "../compat/legacy-names.js";
|
||||
import { CronDeliverySchema } from "../gateway/protocol/schema.js";
|
||||
|
||||
type SchemaLike = {
|
||||
anyOf?: Array<{ properties?: Record<string, unknown>; const?: unknown }>;
|
||||
anyOf?: Array<SchemaLike>;
|
||||
properties?: Record<string, unknown>;
|
||||
const?: unknown;
|
||||
};
|
||||
|
||||
function extractDeliveryModes(schema: SchemaLike): string[] {
|
||||
const modeSchema = schema.properties?.mode as SchemaLike | undefined;
|
||||
return (modeSchema?.anyOf ?? [])
|
||||
const directModes = (modeSchema?.anyOf ?? [])
|
||||
.map((entry) => entry?.const)
|
||||
.filter((value): value is string => typeof value === "string");
|
||||
if (directModes.length > 0) {
|
||||
return directModes;
|
||||
}
|
||||
|
||||
const unionModes = (schema.anyOf ?? [])
|
||||
.map((entry) => {
|
||||
const mode = entry.properties?.mode as SchemaLike | undefined;
|
||||
return mode?.const;
|
||||
})
|
||||
.filter((value): value is string => typeof value === "string");
|
||||
|
||||
return Array.from(new Set(unionModes));
|
||||
}
|
||||
|
||||
const UI_FILES = ["ui/src/ui/types.ts", "ui/src/ui/ui-types.ts", "ui/src/ui/views/cron.ts"];
|
||||
|
||||
Reference in New Issue
Block a user