mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 19:44:30 +00:00
Slack: validate runtime blocks in send and edit paths
This commit is contained in:
@@ -31,11 +31,15 @@ function assertBlocksArray(raw: unknown) {
|
||||
}
|
||||
}
|
||||
|
||||
export function validateSlackBlocksArray(raw: unknown): (Block | KnownBlock)[] {
|
||||
assertBlocksArray(raw);
|
||||
return raw as (Block | KnownBlock)[];
|
||||
}
|
||||
|
||||
export function parseSlackBlocksInput(raw: unknown): (Block | KnownBlock)[] | undefined {
|
||||
if (raw == null) {
|
||||
return undefined;
|
||||
}
|
||||
const parsed = typeof raw === "string" ? parseBlocksJson(raw) : raw;
|
||||
assertBlocksArray(parsed);
|
||||
return parsed as (Block | KnownBlock)[];
|
||||
return validateSlackBlocksArray(parsed);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user