@@ -16,11 +16,26 @@ function normalizeSchema(schema: unknown) {
1616 return schema ? toJsonSchema ( schema ) : undefined ;
1717}
1818
19+ const ALLOWED_FORMAT_KEYS = {
20+ markdown : new Set ( [ "type" , "mode" ] ) ,
21+ html : new Set ( [ "type" , "mode" ] ) ,
22+ screenshot : new Set ( [ "type" , "fullPage" , "width" , "height" , "quality" ] ) ,
23+ links : new Set ( [ "type" ] ) ,
24+ images : new Set ( [ "type" ] ) ,
25+ summary : new Set ( [ "type" ] ) ,
26+ branding : new Set ( [ "type" ] ) ,
27+ json : new Set ( [ "type" , "prompt" , "schema" , "mode" ] ) ,
28+ } as const ;
29+
1930function normalizeScrapeFormatEntry ( format : ApiScrapeFormatEntry ) : ApiScrapeFormatEntry {
20- if ( format . type !== "json" || ! format . schema ) return format ;
31+ const allowedKeys = ALLOWED_FORMAT_KEYS [ format . type ] ;
32+ const normalized = Object . fromEntries (
33+ Object . entries ( format ) . filter ( ( [ key ] ) => allowedKeys . has ( key ) ) ,
34+ ) as ApiScrapeFormatEntry ;
35+ if ( normalized . type !== "json" || ! normalized . schema ) return normalized ;
2136 return {
22- ...format ,
23- schema : normalizeSchema ( format . schema ) ,
37+ ...normalized ,
38+ schema : normalizeSchema ( normalized . schema ) ,
2439 } ;
2540}
2641
@@ -146,7 +161,6 @@ export function buildMonitorBody(monitorCreateInput: ApiMonitorCreateInput) {
146161 type : "json" as const ,
147162 prompt : legacyMonitorInput . prompt ,
148163 schema : normalizeSchema ( legacyMonitorInput . schema ) ,
149- llmConfig : legacyMonitorInput . llmConfig ,
150164 mode : "normal" as const ,
151165 } ,
152166 ] ,
0 commit comments