From 647ca8a21bb1bd619c2159846f20f5bfbd2b9622 Mon Sep 17 00:00:00 2001 From: Maksim Sadym Date: Tue, 29 Sep 2026 13:19:13 +0000 Subject: [PATCH 1/2] feat: add `--format zod4` for Zod v4 type annotations - Add `--format zod4` to emit Zod v4-compatible TypeScript type annotations while keeping `--format zod` for Zod v3 compatibility. - Zod v3 and Zod v4 have mutually exclusive generic type constraints for unions, string enums, and non-empty arrays, preventing generated schemas with explicit type annotations from compiling under Zod v4. - In `zod4` mode, emit `z.ZodUnion`, record-based `z.ZodEnum<{ [K]: K }>`, and single-parameter `z.ZodArray`. Fixes #95 --- README.md | 4 +- src/engines/zod.rs | 58 +- src/main.rs | 11 + tests/snapshots/zod4__it_works-2.snap | 1412 +++++++++++++++++ tests/snapshots/zod4__it_works.snap | 5 + .../zod4__it_works_with_amendments-2.snap | 14 + .../zod4__it_works_with_amendments.snap | 5 + ...od4__it_works_with_array_occurences-2.snap | 10 + .../zod4__it_works_with_array_occurences.snap | 5 + .../zod4__it_works_with_enums-2.snap | 13 + .../snapshots/zod4__it_works_with_enums.snap | 5 + .../snapshots/zod4__it_works_with_maps-2.snap | 35 + tests/snapshots/zod4__it_works_with_maps.snap | 5 + ...zod4__it_works_with_optional_groups-2.snap | 19 + .../zod4__it_works_with_optional_groups.snap | 5 + ...4__it_works_with_prelude_text_types-2.snap | 7 + ...od4__it_works_with_prelude_text_types.snap | 5 + ...t_works_with_simple_optional_groups-2.snap | 23 + ..._it_works_with_simple_optional_groups.snap | 5 + tests/zod4.rs | 51 + 20 files changed, 1683 insertions(+), 14 deletions(-) create mode 100644 tests/snapshots/zod4__it_works-2.snap create mode 100644 tests/snapshots/zod4__it_works.snap create mode 100644 tests/snapshots/zod4__it_works_with_amendments-2.snap create mode 100644 tests/snapshots/zod4__it_works_with_amendments.snap create mode 100644 tests/snapshots/zod4__it_works_with_array_occurences-2.snap create mode 100644 tests/snapshots/zod4__it_works_with_array_occurences.snap create mode 100644 tests/snapshots/zod4__it_works_with_enums-2.snap create mode 100644 tests/snapshots/zod4__it_works_with_enums.snap create mode 100644 tests/snapshots/zod4__it_works_with_maps-2.snap create mode 100644 tests/snapshots/zod4__it_works_with_maps.snap create mode 100644 tests/snapshots/zod4__it_works_with_optional_groups-2.snap create mode 100644 tests/snapshots/zod4__it_works_with_optional_groups.snap create mode 100644 tests/snapshots/zod4__it_works_with_prelude_text_types-2.snap create mode 100644 tests/snapshots/zod4__it_works_with_prelude_text_types.snap create mode 100644 tests/snapshots/zod4__it_works_with_simple_optional_groups-2.snap create mode 100644 tests/snapshots/zod4__it_works_with_simple_optional_groups.snap create mode 100644 tests/zod4.rs diff --git a/README.md b/README.md index a3653e3..ec25c12 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ A commandline utility for converting CDDL to various formats. ## Usage 1. Clone this repo and `cd` into it. -2. `cargo run -- path/to/file.cddl` +2. `cargo run -- [--format ] path/to/file.cddl` ## Tips @@ -26,4 +26,4 @@ cargo run -- path/to/file.cddl | prettier --stdin-filepath=$outfile > $outfile ## Limitations -1. Only [`TypeScript`](https://www.typescriptlang.org/) and [`Zod v4`](https://zod.dev/) is supported at the moment. +1. Only [`TypeScript`](https://www.typescriptlang.org/) (`--format type-script`), [`Zod v3`](https://v3.zod.dev/) (`--format zod`), and [`Zod v4`](https://zod.dev/) (`--format zod4`) are supported at the moment. diff --git a/src/engines/zod.rs b/src/engines/zod.rs index d1c3d19..fe09287 100644 --- a/src/engines/zod.rs +++ b/src/engines/zod.rs @@ -46,6 +46,12 @@ struct PostambleOptions { print_flatten: bool, } +#[derive(Copy, Clone, PartialEq, Eq)] +pub enum Version { + V3, + V4, +} + pub struct Engine where Stdout: Write, @@ -54,6 +60,7 @@ where nested_group_choices: Vec, nested_type1: Vec, is_type_mode: bool, + version: Version, cyclic_rules: std::collections::HashSet, #[allow(dead_code)] postamble_options: PostambleOptions, @@ -78,10 +85,18 @@ fn calculate_occurrence(occur: &Option>) -> (usize, us impl<'a, 'b: 'a, 'c, Stdout: Write, Stderr: Write> Engine { pub fn with_writers(stdout: Stdout, stderr: Stderr) -> Engine { + Self::with_writers_and_version(stdout, stderr, Version::V3) + } + pub fn with_writers_and_version( + stdout: Stdout, + stderr: Stderr, + version: Version, + ) -> Engine { Engine { nested_group_choices: Vec::new(), nested_type1: Vec::new(), is_type_mode: false, + version, cyclic_rules: std::collections::HashSet::new(), postamble_options: PostambleOptions { #[cfg(feature = "vector_groups")] @@ -104,6 +119,12 @@ impl<'a, 'b: 'a, 'c, Stdout: Write, Stderr: Write> Engine { unimplemented!(); } } + fn write_zod_union_type_start(&mut self) { + match self.version { + Version::V3 => write!(self.stdout, "z.ZodUnion<["), + Version::V4 => write!(self.stdout, "z.ZodUnion) -> bool { // Special case for string enums if t.type_choices.len() > 1 @@ -113,13 +134,26 @@ impl<'a, 'b: 'a, 'c, Stdout: Write, Stderr: Write> Engine { .all(|type2| matches!(type2, cddl::ast::Type2::TextValue { .. })) { if self.is_type_mode { - write!(self.stdout, "z.ZodEnum<["); - for type2 in t.type_choices.iter().map(|choice| &choice.type1.type2) { - if let cddl::ast::Type2::TextValue { value, .. } = type2 { - write!(self.stdout, "\"{}\",", value); + match self.version { + Version::V3 => { + write!(self.stdout, "z.ZodEnum<["); + for type2 in t.type_choices.iter().map(|choice| &choice.type1.type2) { + if let cddl::ast::Type2::TextValue { value, .. } = type2 { + write!(self.stdout, "\"{}\",", value); + } + } + write!(self.stdout, "]>"); + } + Version::V4 => { + write!(self.stdout, "z.ZodEnum<{{"); + for type2 in t.type_choices.iter().map(|choice| &choice.type1.type2) { + if let cddl::ast::Type2::TextValue { value, .. } = type2 { + write!(self.stdout, "\"{}\":\"{}\",", value, value); + } + } + write!(self.stdout, "}}>"); } } - write!(self.stdout, "]>"); } else { write!(self.stdout, "z.enum(["); for type2 in t.type_choices.iter().map(|choice| &choice.type1.type2) { @@ -137,7 +171,7 @@ impl<'a, 'b: 'a, 'c, Stdout: Write, Stderr: Write> Engine { fn visit_array(&mut self, g: &'b cddl::ast::Group<'a>) -> cddl::visitor::Result { if g.group_choices.len() != 1 { if self.is_type_mode { - write!(self.stdout, "z.ZodUnion<["); + self.write_zod_union_type_start(); } else { write!(self.stdout, "z.union(["); } @@ -369,7 +403,7 @@ impl<'a, 'b: 'a, 'c, Stdout: Write, Stderr: Write> Engine { } if upper < MAX_ARRAYS { if self.is_type_mode { - write!(self.stdout, "z.ZodUnion<["); + self.write_zod_union_type_start(); for bound in lower..upper + 1 { if bound != 0 { write!(self.stdout, ","); @@ -404,7 +438,7 @@ impl<'a, 'b: 'a, 'c, Stdout: Write, Stderr: Write> Engine { } else if self.is_type_mode { write!(self.stdout, "z.ZodArray<"); self.visit_type(&entry.entry_type)?; - if lower == 1 { + if lower == 1 && self.version == Version::V3 { write!(self.stdout, ", \"atleastone\""); } write!(self.stdout, ">"); @@ -597,7 +631,7 @@ impl<'a, 'b: 'a, Stdout: Write, Stderr: Write> Visitor<'a, 'b, Error> for Engine } if t.type_choices.len() != 1 { if self.is_type_mode { - write!(self.stdout, "z.ZodUnion<["); + self.write_zod_union_type_start(); } else { write!(self.stdout, "z.union(["); } @@ -688,7 +722,7 @@ impl<'a, 'b: 'a, Stdout: Write, Stderr: Write> Visitor<'a, 'b, Error> for Engine self.print_group_joiner(); if matches!(calculate_occurrence(&ge.occur), (0, max) if max > 0) { if self.is_type_mode { - write!(self.stdout, "z.ZodUnion<["); + self.write_zod_union_type_start(); self.visit_type_groupname_entry(ge)?; write!(self.stdout, ",z.ZodObject<{{}}>]>"); } else { @@ -704,7 +738,7 @@ impl<'a, 'b: 'a, Stdout: Write, Stderr: Write> Visitor<'a, 'b, Error> for Engine self.print_group_joiner(); if matches!(calculate_occurrence(&occur), (0, max) if max > 0) { if self.is_type_mode { - write!(self.stdout, "z.ZodUnion<["); + self.write_zod_union_type_start(); self.visit_group(group)?; write!(self.stdout, ",z.ZodObject<{{}}>]>"); } else { @@ -755,7 +789,7 @@ impl<'a, 'b: 'a, Stdout: Write, Stderr: Write> Visitor<'a, 'b, Error> for Engine fn visit_group(&mut self, g: &'b cddl::ast::Group<'a>) -> cddl::visitor::Result { if g.group_choices.len() != 1 { if self.is_type_mode { - write!(self.stdout, "z.ZodUnion<["); + self.write_zod_union_type_start(); } else { write!(self.stdout, "z.union(["); } diff --git a/src/main.rs b/src/main.rs index 738bb7d..548a2b8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,6 +21,7 @@ use std::path::PathBuf; enum EngineType { TypeScript, Zod, + Zod4, } /// Simple program to greet a person @@ -56,6 +57,16 @@ fn main() -> Result<()> { engine.visit_cddl(&cddl)?; engine.print_postamble(); } + EngineType::Zod4 => { + let mut engine = cddlconv::engines::zod::Engine::with_writers_and_version( + std::io::stdout(), + std::io::stderr(), + cddlconv::engines::zod::Version::V4, + ); + engine.print_preamble(); + engine.visit_cddl(&cddl)?; + engine.print_postamble(); + } }; Ok(()) diff --git a/tests/snapshots/zod4__it_works-2.snap b/tests/snapshots/zod4__it_works-2.snap new file mode 100644 index 0000000..5c032f7 --- /dev/null +++ b/tests/snapshots/zod4__it_works-2.snap @@ -0,0 +1,1412 @@ +--- +source: tests/zod4.rs +expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" +--- +export const CommandSchema: z.ZodLazy,typeof CommandDataSchema>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ +"id":JsUintSchema}).and( +CommandDataSchema) +.and( +ExtensibleSchema) +); +export const +CommandDataSchema: z.ZodLazy> = z.lazy(() => z.union([BrowserCommandSchema,BrowsingContextCommandSchema,InputCommandSchema,NetworkCommandSchema,ScriptCommandSchema,SessionCommandSchema])); +export const EmptyParamsSchema: z.ZodLazy = z.lazy(() => ExtensibleSchema); +export const MessageSchema: z.ZodLazy> = z.lazy(() => z.union([CommandResponseSchema,ErrorResponseSchema,EventSchema])); +export const CommandResponseSchema: z.ZodLazy,"id":typeof JsUintSchema,"result":typeof ResultDataSchema}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ +"type":z.literal("success"),"id":JsUintSchema,"result":ResultDataSchema}).and( +ExtensibleSchema) +); +export const ErrorResponseSchema: z.ZodLazy,"id":z.ZodUnion,"error":typeof ErrorCodeSchema,"message":z.ZodString,"stacktrace":z.ZodOptional}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ +"type":z.literal("error"),"id":z.union([JsUintSchema,z.null()]),"error":ErrorCodeSchema,"message":z.string(),"stacktrace":z.string().optional()}).and( +ExtensibleSchema) +); +export const ResultDataSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContextResultSchema,EmptyResultSchema,NetworkResultSchema,ScriptResultSchema,SessionResultSchema])); +export const EmptyResultSchema: z.ZodLazy = z.lazy(() => ExtensibleSchema); +export const EventSchema: z.ZodLazy}>,typeof EventDataSchema>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ +"type":z.literal("event")}).and( +EventDataSchema) +.and( +ExtensibleSchema) +); +export const +EventDataSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContextEventSchema,LogEventSchema,NetworkEventSchema,ScriptEventSchema])); +export const +ExtensibleSchema: z.ZodLazy> = z.lazy(() => z.record( +z.string(),z.any())); +export const JsIntSchema: z.ZodNumber = z.number().int().gte(-9007199254740991).lte(9007199254740991); +export const JsUintSchema: z.ZodNumber = z.number().int().nonnegative().gte(0).lte(9007199254740991); +export const ErrorCodeSchema: z.ZodLazy> = z.lazy(() => z.enum(["invalid argument","invalid session id","move target out of bounds","no such alert","no such element","no such frame","no such handle","no such history entry","no such intercept","no such node","no such request","no such script","session not created","unable to capture screen","unable to close browser","unknown command","unknown error","unsupported operation",])); +export const +SessionCommandSchema: z.ZodLazy> = z.lazy(() => z.union([Session.EndSchema,Session.NewSchema,Session.StatusSchema,Session.SubscribeSchema,Session.UnsubscribeSchema])); +export const SessionResultSchema: z.ZodLazy> = z.lazy(() => z.union([Session.NewResultSchema,Session.StatusResultSchema])); +export namespace Session { +export const CapabilitiesRequestSchema: z.ZodLazy,"firstMatch":z.ZodOptional>}>> = z.lazy(() => z.object({ +"alwaysMatch":Session.CapabilityRequestSchema.optional(),"firstMatch":z.array(Session.CapabilityRequestSchema).optional()})); +} +export namespace Session { +export const CapabilityRequestSchema: z.ZodLazy,"browserName":z.ZodOptional,"browserVersion":z.ZodOptional,"platformName":z.ZodOptional,"proxy":z.ZodOptional,"webSocketUrl":z.ZodOptional}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ +"acceptInsecureCerts":z.boolean().optional(),"browserName":z.string().optional(),"browserVersion":z.string().optional(),"platformName":z.string().optional(),"proxy":Session.ProxyConfigurationSchema.optional(),"webSocketUrl":z.boolean().optional()}).and( +ExtensibleSchema) +); +} +export namespace Session { +export const ProxyConfigurationSchema: z.ZodLazy]>> = z.lazy(() => z.union([Session.AutodetectProxyConfigurationSchema,Session.DirectProxyConfigurationSchema,Session.ManualProxyConfigurationSchema,Session.PacProxyConfigurationSchema,Session.SystemProxyConfigurationSchema,z.object({ +})])); +} +export namespace Session { +export const +AutodetectProxyConfigurationSchema: z.ZodLazy}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ +"proxyType":z.literal("autodetect")}).and( +ExtensibleSchema) +); +} +export namespace Session { +export const +DirectProxyConfigurationSchema: z.ZodLazy}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ +"proxyType":z.literal("direct")}).and( +ExtensibleSchema) +); +} +export namespace Session { +export const +ManualProxyConfigurationSchema: z.ZodLazy,"ftpProxy":z.ZodOptional,"httpProxy":z.ZodOptional,"sslProxy":z.ZodOptional}>,z.ZodUnion]>>,z.ZodObject<{ +"noProxy":z.ZodOptional>}>>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ +"proxyType":z.literal("manual"),"ftpProxy":z.string().optional(),"httpProxy":z.string().optional(),"sslProxy":z.string().optional()}).and( +Session.SocksProxyConfigurationSchema.or(z.object({}))) +.and( +z.object({ +"noProxy":z.array(z.string()).optional()})) +.and( +ExtensibleSchema) +); +} +export namespace Session { +export const +SocksProxyConfigurationSchema: z.ZodLazy> = z.lazy(() => z.object({ +"socksProxy":z.string(),"socksVersion":z.number().int().nonnegative().gte(0).lte(255)})); +} +export namespace Session { +export const +PacProxyConfigurationSchema: z.ZodLazy,"proxyAutoconfigUrl":z.ZodString}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ +"proxyType":z.literal("pac"),"proxyAutoconfigUrl":z.string()}).and( +ExtensibleSchema) +); +} +export namespace Session { +export const +SystemProxyConfigurationSchema: z.ZodLazy}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ +"proxyType":z.literal("system")}).and( +ExtensibleSchema) +); +} +export namespace Session { +export const SubscriptionRequestSchema: z.ZodLazy,"contexts":z.ZodOptional>}>> = z.lazy(() => z.object({ +"events":z.array(z.string()),"contexts":z.array(BrowsingContext.BrowsingContextSchema).optional()})); +} +export namespace Session { +export const +StatusSchema: z.ZodLazy,"params":typeof EmptyParamsSchema}>> = z.lazy(() => z.object({ +"method":z.literal("session.status"),"params":EmptyParamsSchema})); +} +export namespace Session { +export const StatusResultSchema: z.ZodLazy> = z.lazy(() => z.object({ +"ready":z.boolean(),"message":z.string()})); +} +export namespace Session { +export const +NewSchema: z.ZodLazy,"params":typeof Session.NewParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("session.new"),"params":Session.NewParametersSchema})); +} +export namespace Session { +export const NewParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ +"capabilities":Session.CapabilitiesRequestSchema})); +} +export namespace Session { +export const NewResultSchema: z.ZodLazy,"webSocketUrl":z.ZodOptional}>,typeof ExtensibleSchema>}>> = z.lazy(() => z.object({ +"sessionId":z.string(),"capabilities":z.object({ +"acceptInsecureCerts":z.boolean(),"browserName":z.string(),"browserVersion":z.string(),"platformName":z.string(),"setWindowRect":z.boolean(),"proxy":Session.ProxyConfigurationSchema.optional(),"webSocketUrl":z.boolean().optional()}).and( +ExtensibleSchema) +})); +} +export namespace Session { +export const +EndSchema: z.ZodLazy,"params":typeof EmptyParamsSchema}>> = z.lazy(() => z.object({ +"method":z.literal("session.end"),"params":EmptyParamsSchema})); +} +export namespace Session { +export const +SubscribeSchema: z.ZodLazy,"params":typeof Session.SubscriptionRequestSchema}>> = z.lazy(() => z.object({ +"method":z.literal("session.subscribe"),"params":Session.SubscriptionRequestSchema})); +} +export namespace Session { +export const +UnsubscribeSchema: z.ZodLazy,"params":typeof Session.SubscriptionRequestSchema}>> = z.lazy(() => z.object({ +"method":z.literal("session.unsubscribe"),"params":Session.SubscriptionRequestSchema})); +} +export const +BrowserCommandSchema: z.ZodLazy = z.lazy(() => Browser.CloseSchema); +export namespace Browser { +export const +CloseSchema: z.ZodLazy,"params":typeof EmptyParamsSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browser.close"),"params":EmptyParamsSchema})); +} +export const +BrowsingContextCommandSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.ActivateSchema,BrowsingContext.CaptureScreenshotSchema,BrowsingContext.CloseSchema,BrowsingContext.CreateSchema,BrowsingContext.GetTreeSchema,BrowsingContext.HandleUserPromptSchema,BrowsingContext.LocateNodesSchema,BrowsingContext.NavigateSchema,BrowsingContext.PrintSchema,BrowsingContext.ReloadSchema,BrowsingContext.SetViewportSchema,BrowsingContext.TraverseHistorySchema])); +export const BrowsingContextResultSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.CaptureScreenshotResultSchema,BrowsingContext.CreateResultSchema,BrowsingContext.GetTreeResultSchema,BrowsingContext.LocateNodesResultSchema,BrowsingContext.NavigateResultSchema,BrowsingContext.PrintResultSchema,BrowsingContext.TraverseHistoryResultSchema])); +export const +BrowsingContextEventSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.ContextCreatedSchema,BrowsingContext.ContextDestroyedSchema,BrowsingContext.DomContentLoadedSchema,BrowsingContext.DownloadWillBeginSchema,BrowsingContext.FragmentNavigatedSchema,BrowsingContext.LoadSchema,BrowsingContext.NavigationAbortedSchema,BrowsingContext.NavigationFailedSchema,BrowsingContext.NavigationStartedSchema,BrowsingContext.UserPromptClosedSchema,BrowsingContext.UserPromptOpenedSchema])); +export namespace BrowsingContext { +export const BrowsingContextSchema: z.ZodLazy = z.lazy(() => z.string()); +} +export namespace BrowsingContext { +export const InfoListSchema: z.ZodType = z.lazy(() => z.array(BrowsingContext.InfoSchema)); +} +export namespace BrowsingContext { +export const InfoSchema: z.ZodLazy,"parent":z.ZodOptional>}>> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema,"url":z.string(),"children":z.union([BrowsingContext.InfoListSchema,z.null()]),"parent":z.union([BrowsingContext.BrowsingContextSchema,z.null()]).optional()})); +} +export namespace BrowsingContext { +export const LocatorSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.CssLocatorSchema,BrowsingContext.InnerTextLocatorSchema,BrowsingContext.XPathLocatorSchema])); +} +export namespace BrowsingContext { +export const CssLocatorSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ +"type":z.literal("css"),"value":z.string()})); +} +export namespace BrowsingContext { +export const InnerTextLocatorSchema: z.ZodLazy,"value":z.ZodString,"ignoreCase":z.ZodOptional,"matchType":z.ZodOptional>,"maxDepth":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("innerText"),"value":z.string(),"ignoreCase":z.boolean().optional(),"matchType":z.enum(["full","partial",]).optional(),"maxDepth":JsUintSchema.optional()})); +} +export namespace BrowsingContext { +export const XPathLocatorSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ +"type":z.literal("xpath"),"value":z.string()})); +} +export namespace BrowsingContext { +export const NavigationSchema: z.ZodLazy = z.lazy(() => z.string()); +} +export namespace BrowsingContext { +export const NavigationInfoSchema: z.ZodLazy,"timestamp":typeof JsUintSchema,"url":z.ZodString}>> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema,"navigation":z.union([BrowsingContext.NavigationSchema,z.null()]),"timestamp":JsUintSchema,"url":z.string()})); +} +export namespace BrowsingContext { +export const ReadinessStateSchema: z.ZodLazy> = z.lazy(() => z.enum(["none","interactive","complete",])); +} +export namespace BrowsingContext { +export const +ActivateSchema: z.ZodLazy,"params":typeof BrowsingContext.ActivateParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.activate"),"params":BrowsingContext.ActivateParametersSchema})); +} +export namespace BrowsingContext { +export const ActivateParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema})); +} +export namespace BrowsingContext { +export const +CaptureScreenshotSchema: z.ZodLazy,"params":typeof BrowsingContext.CaptureScreenshotParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.captureScreenshot"),"params":BrowsingContext.CaptureScreenshotParametersSchema})); +} +export namespace BrowsingContext { +export const CaptureScreenshotParametersSchema: z.ZodLazy>>,"format":z.ZodOptional,"clip":z.ZodOptional}>> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema,"origin":z.enum(["viewport","document",]).default("viewport").optional(),"format":BrowsingContext.ImageFormatSchema.optional(),"clip":BrowsingContext.ClipRectangleSchema.optional()})); +} +export namespace BrowsingContext { +export const ImageFormatSchema: z.ZodLazy}>> = z.lazy(() => z.object({ +"type":z.string(),"quality":z.number().gte(0).lte(1).optional()})); +} +export namespace BrowsingContext { +export const ClipRectangleSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.BoxClipRectangleSchema,BrowsingContext.ElementClipRectangleSchema])); +} +export namespace BrowsingContext { +export const ElementClipRectangleSchema: z.ZodLazy,"element":typeof Script.SharedReferenceSchema}>> = z.lazy(() => z.object({ +"type":z.literal("element"),"element":Script.SharedReferenceSchema})); +} +export namespace BrowsingContext { +export const BoxClipRectangleSchema: z.ZodLazy,"x":z.ZodNumber,"y":z.ZodNumber,"width":z.ZodNumber,"height":z.ZodNumber}>> = z.lazy(() => z.object({ +"type":z.literal("box"),"x":z.number(),"y":z.number(),"width":z.number(),"height":z.number()})); +} +export namespace BrowsingContext { +export const CaptureScreenshotResultSchema: z.ZodLazy> = z.lazy(() => z.object({ +"data":z.string()})); +} +export namespace BrowsingContext { +export const +CloseSchema: z.ZodLazy,"params":typeof BrowsingContext.CloseParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.close"),"params":BrowsingContext.CloseParametersSchema})); +} +export namespace BrowsingContext { +export const CloseParametersSchema: z.ZodLazy>}>> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema,"promptUnload":z.boolean().default(false).optional()})); +} +export namespace BrowsingContext { +export const +CreateSchema: z.ZodLazy,"params":typeof BrowsingContext.CreateParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.create"),"params":BrowsingContext.CreateParametersSchema})); +} +export namespace BrowsingContext { +export const CreateTypeSchema: z.ZodLazy> = z.lazy(() => z.enum(["tab","window",])); +} +export namespace BrowsingContext { +export const CreateParametersSchema: z.ZodLazy,"background":z.ZodOptional>}>> = z.lazy(() => z.object({ +"type":BrowsingContext.CreateTypeSchema,"referenceContext":BrowsingContext.BrowsingContextSchema.optional(),"background":z.boolean().default(false).optional()})); +} +export namespace BrowsingContext { +export const CreateResultSchema: z.ZodLazy> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema})); +} +export namespace BrowsingContext { +export const +GetTreeSchema: z.ZodLazy,"params":typeof BrowsingContext.GetTreeParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.getTree"),"params":BrowsingContext.GetTreeParametersSchema})); +} +export namespace BrowsingContext { +export const GetTreeParametersSchema: z.ZodLazy,"root":z.ZodOptional}>> = z.lazy(() => z.object({ +"maxDepth":JsUintSchema.optional(),"root":BrowsingContext.BrowsingContextSchema.optional()})); +} +export namespace BrowsingContext { +export const GetTreeResultSchema: z.ZodLazy> = z.lazy(() => z.object({ +"contexts":BrowsingContext.InfoListSchema})); +} +export namespace BrowsingContext { +export const +HandleUserPromptSchema: z.ZodLazy,"params":typeof BrowsingContext.HandleUserPromptParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.handleUserPrompt"),"params":BrowsingContext.HandleUserPromptParametersSchema})); +} +export namespace BrowsingContext { +export const HandleUserPromptParametersSchema: z.ZodLazy,"userText":z.ZodOptional}>> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema,"accept":z.boolean().optional(),"userText":z.string().optional()})); +} +export namespace BrowsingContext { +export const +LocateNodesSchema: z.ZodLazy,"params":typeof BrowsingContext.LocateNodesParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.locateNodes"),"params":BrowsingContext.LocateNodesParametersSchema})); +} +export namespace BrowsingContext { +export const LocateNodesParametersSchema: z.ZodLazy,"ownership":z.ZodOptional,"sandbox":z.ZodOptional,"serializationOptions":z.ZodOptional,"startNodes":z.ZodOptional>}>> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema,"locator":BrowsingContext.LocatorSchema,"maxNodeCount":JsUintSchema.gte(1).optional(),"ownership":Script.ResultOwnershipSchema.optional(),"sandbox":z.string().optional(),"serializationOptions":Script.SerializationOptionsSchema.optional(),"startNodes":z.array(Script.SharedReferenceSchema).nonempty().optional()})); +} +export namespace BrowsingContext { +export const LocateNodesResultSchema: z.ZodLazy}>> = z.lazy(() => z.object({ +"nodes":z.array(Script.NodeRemoteValueSchema)})); +} +export namespace BrowsingContext { +export const +NavigateSchema: z.ZodLazy,"params":typeof BrowsingContext.NavigateParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.navigate"),"params":BrowsingContext.NavigateParametersSchema})); +} +export namespace BrowsingContext { +export const NavigateParametersSchema: z.ZodLazy}>> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema,"url":z.string(),"wait":BrowsingContext.ReadinessStateSchema.optional()})); +} +export namespace BrowsingContext { +export const NavigateResultSchema: z.ZodLazy,"url":z.ZodString}>> = z.lazy(() => z.object({ +"navigation":z.union([BrowsingContext.NavigationSchema,z.null()]),"url":z.string()})); +} +export namespace BrowsingContext { +export const +PrintSchema: z.ZodLazy,"params":typeof BrowsingContext.PrintParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.print"),"params":BrowsingContext.PrintParametersSchema})); +} +export namespace BrowsingContext { +export const PrintParametersSchema: z.ZodLazy>,"margin":z.ZodOptional,"orientation":z.ZodOptional>>,"page":z.ZodOptional,"pageRanges":z.ZodOptional>>,"scale":z.ZodOptional>,"shrinkToFit":z.ZodOptional>}>> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema,"background":z.boolean().default(false).optional(),"margin":BrowsingContext.PrintMarginParametersSchema.optional(),"orientation":z.enum(["portrait","landscape",]).default("portrait").optional(),"page":BrowsingContext.PrintPageParametersSchema.optional(),"pageRanges":z.array(z.union([JsUintSchema,z.string()])).optional(),"scale":z.number().gte(0.1).lte(2).default(1).optional(),"shrinkToFit":z.boolean().default(true).optional()})); +} +export namespace BrowsingContext { +export const PrintMarginParametersSchema: z.ZodLazy>,"left":z.ZodOptional>,"right":z.ZodOptional>,"top":z.ZodOptional>}>> = z.lazy(() => z.object({ +"bottom":z.number().gte(0).default(1).optional(),"left":z.number().gte(0).default(1).optional(),"right":z.number().gte(0).default(1).optional(),"top":z.number().gte(0).default(1).optional()})); +} +export namespace BrowsingContext { +export const PrintPageParametersSchema: z.ZodLazy>,"width":z.ZodOptional>}>> = z.lazy(() => z.object({ +"height":z.number().gte(0.0352).default(27.94).optional(),"width":z.number().gte(0.0352).default(21.59).optional()})); +} +export namespace BrowsingContext { +export const PrintResultSchema: z.ZodLazy> = z.lazy(() => z.object({ +"data":z.string()})); +} +export namespace BrowsingContext { +export const +ReloadSchema: z.ZodLazy,"params":typeof BrowsingContext.ReloadParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.reload"),"params":BrowsingContext.ReloadParametersSchema})); +} +export namespace BrowsingContext { +export const ReloadParametersSchema: z.ZodLazy,"wait":z.ZodOptional}>> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema,"ignoreCache":z.boolean().optional(),"wait":BrowsingContext.ReadinessStateSchema.optional()})); +} +export namespace BrowsingContext { +export const +SetViewportSchema: z.ZodLazy,"params":typeof BrowsingContext.SetViewportParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.setViewport"),"params":BrowsingContext.SetViewportParametersSchema})); +} +export namespace BrowsingContext { +export const SetViewportParametersSchema: z.ZodLazy>,"devicePixelRatio":z.ZodOptional>}>> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema,"viewport":z.union([BrowsingContext.ViewportSchema,z.null()]).optional(),"devicePixelRatio":z.union([z.number().gt(0),z.null()]).optional()})); +} +export namespace BrowsingContext { +export const ViewportSchema: z.ZodLazy> = z.lazy(() => z.object({ +"width":JsUintSchema,"height":JsUintSchema})); +} +export namespace BrowsingContext { +export const +TraverseHistorySchema: z.ZodLazy,"params":typeof BrowsingContext.TraverseHistoryParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.traverseHistory"),"params":BrowsingContext.TraverseHistoryParametersSchema})); +} +export namespace BrowsingContext { +export const TraverseHistoryParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema,"delta":JsIntSchema})); +} +export namespace BrowsingContext { +export const TraverseHistoryResultSchema: z.ZodLazy> = z.lazy(() => z.object({ +})); +} +export namespace BrowsingContext { +export const +ContextCreatedSchema: z.ZodLazy,"params":typeof BrowsingContext.InfoSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.contextCreated"),"params":BrowsingContext.InfoSchema})); +} +export namespace BrowsingContext { +export const +ContextDestroyedSchema: z.ZodLazy,"params":typeof BrowsingContext.InfoSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.contextDestroyed"),"params":BrowsingContext.InfoSchema})); +} +export namespace BrowsingContext { +export const +NavigationStartedSchema: z.ZodLazy,"params":typeof BrowsingContext.NavigationInfoSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.navigationStarted"),"params":BrowsingContext.NavigationInfoSchema})); +} +export namespace BrowsingContext { +export const +FragmentNavigatedSchema: z.ZodLazy,"params":typeof BrowsingContext.NavigationInfoSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.fragmentNavigated"),"params":BrowsingContext.NavigationInfoSchema})); +} +export namespace BrowsingContext { +export const +DomContentLoadedSchema: z.ZodLazy,"params":typeof BrowsingContext.NavigationInfoSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.domContentLoaded"),"params":BrowsingContext.NavigationInfoSchema})); +} +export namespace BrowsingContext { +export const +LoadSchema: z.ZodLazy,"params":typeof BrowsingContext.NavigationInfoSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.load"),"params":BrowsingContext.NavigationInfoSchema})); +} +export namespace BrowsingContext { +export const +DownloadWillBeginSchema: z.ZodLazy,"params":typeof BrowsingContext.NavigationInfoSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.downloadWillBegin"),"params":BrowsingContext.NavigationInfoSchema})); +} +export namespace BrowsingContext { +export const +NavigationAbortedSchema: z.ZodLazy,"params":typeof BrowsingContext.NavigationInfoSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.navigationAborted"),"params":BrowsingContext.NavigationInfoSchema})); +} +export namespace BrowsingContext { +export const +NavigationFailedSchema: z.ZodLazy,"params":typeof BrowsingContext.NavigationInfoSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.navigationFailed"),"params":BrowsingContext.NavigationInfoSchema})); +} +export namespace BrowsingContext { +export const +UserPromptClosedSchema: z.ZodLazy,"params":typeof BrowsingContext.UserPromptClosedParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.userPromptClosed"),"params":BrowsingContext.UserPromptClosedParametersSchema})); +} +export namespace BrowsingContext { +export const UserPromptClosedParametersSchema: z.ZodLazy}>> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema,"accepted":z.boolean(),"userText":z.string().optional()})); +} +export namespace BrowsingContext { +export const +UserPromptOpenedSchema: z.ZodLazy,"params":typeof BrowsingContext.UserPromptOpenedParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("browsingContext.userPromptOpened"),"params":BrowsingContext.UserPromptOpenedParametersSchema})); +} +export namespace BrowsingContext { +export const UserPromptOpenedParametersSchema: z.ZodLazy,"message":z.ZodString,"defaultValue":z.ZodOptional}>> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema,"type":z.enum(["alert","confirm","prompt","beforeunload",]),"message":z.string(),"defaultValue":z.string().optional()})); +} +export const +NetworkCommandSchema: z.ZodLazy> = z.lazy(() => z.union([Network.AddInterceptSchema,Network.ContinueRequestSchema,Network.ContinueResponseSchema,Network.ContinueWithAuthSchema,Network.FailRequestSchema,Network.ProvideResponseSchema,Network.RemoveInterceptSchema])); +export const +NetworkResultSchema: z.ZodLazy = z.lazy(() => Network.AddInterceptResultSchema); +export const +NetworkEventSchema: z.ZodLazy> = z.lazy(() => z.union([Network.AuthRequiredSchema,Network.BeforeRequestSentSchema,Network.FetchErrorSchema,Network.ResponseCompletedSchema,Network.ResponseStartedSchema])); +export namespace Network { +export const AuthChallengeSchema: z.ZodLazy> = z.lazy(() => z.object({ +"scheme":z.string(),"realm":z.string()})); +} +export namespace Network { +export const AuthCredentialsSchema: z.ZodLazy,"username":z.ZodString,"password":z.ZodString}>> = z.lazy(() => z.object({ +"type":z.literal("password"),"username":z.string(),"password":z.string()})); +} +export namespace Network { +export const +BaseParametersSchema: z.ZodLazy,"isBlocked":z.ZodBoolean,"navigation":z.ZodUnion,"redirectCount":typeof JsUintSchema,"request":typeof Network.RequestDataSchema,"timestamp":typeof JsUintSchema,"intercepts":z.ZodOptional>}>> = z.lazy(() => z.object({ +"context":z.union([BrowsingContext.BrowsingContextSchema,z.null()]),"isBlocked":z.boolean(),"navigation":z.union([BrowsingContext.NavigationSchema,z.null()]),"redirectCount":JsUintSchema,"request":Network.RequestDataSchema,"timestamp":JsUintSchema,"intercepts":z.array(Network.InterceptSchema).nonempty().optional()})); +} +export namespace Network { +export const BytesValueSchema: z.ZodLazy> = z.lazy(() => z.union([Network.StringValueSchema,Network.Base64ValueSchema])); +} +export namespace Network { +export const StringValueSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ +"type":z.literal("string"),"value":z.string()})); +} +export namespace Network { +export const Base64ValueSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ +"type":z.literal("base64"),"value":z.string()})); +} +export namespace Network { +export const CookieSchema: z.ZodLazy,"expires":z.ZodOptional}>> = z.lazy(() => z.object({ +"name":z.string(),"value":Network.BytesValueSchema,"domain":z.string(),"path":z.string(),"size":JsUintSchema,"httpOnly":z.boolean(),"secure":z.boolean(),"sameSite":z.enum(["strict","lax","none",]),"expires":JsUintSchema.optional()})); +} +export namespace Network { +export const CookieHeaderSchema: z.ZodLazy> = z.lazy(() => z.object({ +"name":z.string(),"value":Network.BytesValueSchema})); +} +export namespace Network { +export const FetchTimingInfoSchema: z.ZodLazy> = z.lazy(() => z.object({ +"timeOrigin":z.number(),"requestTime":z.number(),"redirectStart":z.number(),"redirectEnd":z.number(),"fetchStart":z.number(),"dnsStart":z.number(),"dnsEnd":z.number(),"connectStart":z.number(),"connectEnd":z.number(),"tlsStart":z.number(),"requestStart":z.number(),"responseStart":z.number(),"responseEnd":z.number()})); +} +export namespace Network { +export const HeaderSchema: z.ZodLazy> = z.lazy(() => z.object({ +"name":z.string(),"value":Network.BytesValueSchema})); +} +export namespace Network { +export const InitiatorSchema: z.ZodLazy,"columnNumber":z.ZodOptional,"lineNumber":z.ZodOptional,"stackTrace":z.ZodOptional,"request":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.enum(["parser","script","preflight","other",]),"columnNumber":JsUintSchema.optional(),"lineNumber":JsUintSchema.optional(),"stackTrace":Script.StackTraceSchema.optional(),"request":Network.RequestSchema.optional()})); +} +export namespace Network { +export const InterceptSchema: z.ZodLazy = z.lazy(() => z.string()); +} +export namespace Network { +export const RequestSchema: z.ZodLazy = z.lazy(() => z.string()); +} +export namespace Network { +export const RequestDataSchema: z.ZodLazy,"cookies":z.ZodArray,"headersSize":typeof JsUintSchema,"bodySize":z.ZodUnion,"timings":typeof Network.FetchTimingInfoSchema}>> = z.lazy(() => z.object({ +"request":Network.RequestSchema,"url":z.string(),"method":z.string(),"headers":z.array(Network.HeaderSchema),"cookies":z.array(Network.CookieSchema),"headersSize":JsUintSchema,"bodySize":z.union([JsUintSchema,z.null()]),"timings":Network.FetchTimingInfoSchema})); +} +export namespace Network { +export const ResponseContentSchema: z.ZodLazy> = z.lazy(() => z.object({ +"size":JsUintSchema})); +} +export namespace Network { +export const ResponseDataSchema: z.ZodLazy,"mimeType":z.ZodString,"bytesReceived":typeof JsUintSchema,"headersSize":z.ZodUnion,"bodySize":z.ZodUnion,"content":typeof Network.ResponseContentSchema,"authChallenge":z.ZodOptional}>> = z.lazy(() => z.object({ +"url":z.string(),"protocol":z.string(),"status":JsUintSchema,"statusText":z.string(),"fromCache":z.boolean(),"headers":z.array(Network.HeaderSchema),"mimeType":z.string(),"bytesReceived":JsUintSchema,"headersSize":z.union([JsUintSchema,z.null()]),"bodySize":z.union([JsUintSchema,z.null()]),"content":Network.ResponseContentSchema,"authChallenge":Network.AuthChallengeSchema.optional()})); +} +export namespace Network { +export const SetCookieHeaderSchema: z.ZodLazy,"httpOnly":z.ZodOptional,"expires":z.ZodOptional,"maxAge":z.ZodOptional,"path":z.ZodOptional,"sameSite":z.ZodOptional>,"secure":z.ZodOptional}>> = z.lazy(() => z.object({ +"name":z.string(),"value":Network.BytesValueSchema,"domain":z.string().optional(),"httpOnly":z.boolean().optional(),"expires":z.string().optional(),"maxAge":JsIntSchema.optional(),"path":z.string().optional(),"sameSite":z.enum(["strict","lax","none",]).optional(),"secure":z.boolean().optional()})); +} +export namespace Network { +export const UrlPatternSchema: z.ZodLazy> = z.lazy(() => z.union([Network.UrlPatternPatternSchema,Network.UrlPatternStringSchema])); +} +export namespace Network { +export const UrlPatternPatternSchema: z.ZodLazy,"protocol":z.ZodOptional,"hostname":z.ZodOptional,"port":z.ZodOptional,"pathname":z.ZodOptional,"search":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("pattern"),"protocol":z.string().optional(),"hostname":z.string().optional(),"port":z.string().optional(),"pathname":z.string().optional(),"search":z.string().optional()})); +} +export namespace Network { +export const UrlPatternStringSchema: z.ZodLazy,"pattern":z.ZodString}>> = z.lazy(() => z.object({ +"type":z.literal("string"),"pattern":z.string()})); +} +export namespace Network { +export const +AddInterceptSchema: z.ZodLazy,"params":typeof Network.AddInterceptParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("network.addIntercept"),"params":Network.AddInterceptParametersSchema})); +} +export namespace Network { +export const AddInterceptParametersSchema: z.ZodLazy,"urlPatterns":z.ZodOptional>}>> = z.lazy(() => z.object({ +"phases":z.array(Network.InterceptPhaseSchema).nonempty(),"urlPatterns":z.array(Network.UrlPatternSchema).optional()})); +} +export namespace Network { +export const InterceptPhaseSchema: z.ZodLazy> = z.lazy(() => z.enum(["beforeRequestSent","responseStarted","authRequired",])); +} +export namespace Network { +export const AddInterceptResultSchema: z.ZodLazy> = z.lazy(() => z.object({ +"intercept":Network.InterceptSchema})); +} +export namespace Network { +export const +ContinueRequestSchema: z.ZodLazy,"params":typeof Network.ContinueRequestParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("network.continueRequest"),"params":Network.ContinueRequestParametersSchema})); +} +export namespace Network { +export const ContinueRequestParametersSchema: z.ZodLazy,"cookies":z.ZodOptional>,"headers":z.ZodOptional>,"method":z.ZodOptional,"url":z.ZodOptional}>> = z.lazy(() => z.object({ +"request":Network.RequestSchema,"body":Network.BytesValueSchema.optional(),"cookies":z.array(Network.CookieHeaderSchema).optional(),"headers":z.array(Network.HeaderSchema).optional(),"method":z.string().optional(),"url":z.string().optional()})); +} +export namespace Network { +export const +ContinueResponseSchema: z.ZodLazy,"params":typeof Network.ContinueResponseParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("network.continueResponse"),"params":Network.ContinueResponseParametersSchema})); +} +export namespace Network { +export const ContinueResponseParametersSchema: z.ZodLazy>,"credentials":z.ZodOptional,"headers":z.ZodOptional>,"reasonPhrase":z.ZodOptional,"statusCode":z.ZodOptional}>> = z.lazy(() => z.object({ +"request":Network.RequestSchema,"cookies":z.array(Network.SetCookieHeaderSchema).optional(),"credentials":Network.AuthCredentialsSchema.optional(),"headers":z.array(Network.HeaderSchema).optional(),"reasonPhrase":z.string().optional(),"statusCode":JsUintSchema.optional()})); +} +export namespace Network { +export const +ContinueWithAuthSchema: z.ZodLazy,"params":typeof Network.ContinueWithAuthParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("network.continueWithAuth"),"params":Network.ContinueWithAuthParametersSchema})); +} +export namespace Network { +export const ContinueWithAuthParametersSchema: z.ZodLazy,z.ZodUnion>> = z.lazy(() => z.object({ +"request":Network.RequestSchema}).and( +z.union([Network.ContinueWithAuthCredentialsSchema,Network.ContinueWithAuthNoCredentialsSchema])) +); +} +export namespace Network { +export const +ContinueWithAuthCredentialsSchema: z.ZodLazy,"credentials":typeof Network.AuthCredentialsSchema}>> = z.lazy(() => z.object({ +"action":z.literal("provideCredentials"),"credentials":Network.AuthCredentialsSchema})); +} +export namespace Network { +export const +ContinueWithAuthNoCredentialsSchema: z.ZodLazy}>> = z.lazy(() => z.object({ +"action":z.enum(["default","cancel",])})); +} +export namespace Network { +export const +FailRequestSchema: z.ZodLazy,"params":typeof Network.FailRequestParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("network.failRequest"),"params":Network.FailRequestParametersSchema})); +} +export namespace Network { +export const FailRequestParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ +"request":Network.RequestSchema})); +} +export namespace Network { +export const +ProvideResponseSchema: z.ZodLazy,"params":typeof Network.ProvideResponseParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("network.provideResponse"),"params":Network.ProvideResponseParametersSchema})); +} +export namespace Network { +export const ProvideResponseParametersSchema: z.ZodLazy,"cookies":z.ZodOptional>,"headers":z.ZodOptional>,"reasonPhrase":z.ZodOptional,"statusCode":z.ZodOptional}>> = z.lazy(() => z.object({ +"request":Network.RequestSchema,"body":Network.BytesValueSchema.optional(),"cookies":z.array(Network.SetCookieHeaderSchema).optional(),"headers":z.array(Network.HeaderSchema).optional(),"reasonPhrase":z.string().optional(),"statusCode":JsUintSchema.optional()})); +} +export namespace Network { +export const +RemoveInterceptSchema: z.ZodLazy,"params":typeof Network.RemoveInterceptParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("network.removeIntercept"),"params":Network.RemoveInterceptParametersSchema})); +} +export namespace Network { +export const RemoveInterceptParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ +"intercept":Network.InterceptSchema})); +} +export namespace Network { +export const +AuthRequiredSchema: z.ZodLazy,"params":typeof Network.AuthRequiredParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("network.authRequired"),"params":Network.AuthRequiredParametersSchema})); +} +export namespace Network { +export const AuthRequiredParametersSchema: z.ZodLazy>> = z.lazy(() => Network.BaseParametersSchema.and( +z.object({ +"response":Network.ResponseDataSchema})) +); +} +export namespace Network { +export const +BeforeRequestSentSchema: z.ZodLazy,"params":typeof Network.BeforeRequestSentParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("network.beforeRequestSent"),"params":Network.BeforeRequestSentParametersSchema})); +} +export namespace Network { +export const BeforeRequestSentParametersSchema: z.ZodLazy>> = z.lazy(() => Network.BaseParametersSchema.and( +z.object({ +"initiator":Network.InitiatorSchema})) +); +} +export namespace Network { +export const +FetchErrorSchema: z.ZodLazy,"params":typeof Network.FetchErrorParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("network.fetchError"),"params":Network.FetchErrorParametersSchema})); +} +export namespace Network { +export const FetchErrorParametersSchema: z.ZodLazy>> = z.lazy(() => Network.BaseParametersSchema.and( +z.object({ +"errorText":z.string()})) +); +} +export namespace Network { +export const +ResponseCompletedSchema: z.ZodLazy,"params":typeof Network.ResponseCompletedParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("network.responseCompleted"),"params":Network.ResponseCompletedParametersSchema})); +} +export namespace Network { +export const ResponseCompletedParametersSchema: z.ZodLazy>> = z.lazy(() => Network.BaseParametersSchema.and( +z.object({ +"response":Network.ResponseDataSchema})) +); +} +export namespace Network { +export const +ResponseStartedSchema: z.ZodLazy,"params":typeof Network.ResponseStartedParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("network.responseStarted"),"params":Network.ResponseStartedParametersSchema})); +} +export namespace Network { +export const ResponseStartedParametersSchema: z.ZodLazy>> = z.lazy(() => Network.BaseParametersSchema.and( +z.object({ +"response":Network.ResponseDataSchema})) +); +} +export const +ScriptCommandSchema: z.ZodLazy> = z.lazy(() => z.union([Script.AddPreloadScriptSchema,Script.CallFunctionSchema,Script.DisownSchema,Script.EvaluateSchema,Script.GetRealmsSchema,Script.RemovePreloadScriptSchema])); +export const ScriptResultSchema: z.ZodLazy> = z.lazy(() => z.union([Script.AddPreloadScriptResultSchema,Script.EvaluateResultSchema,Script.GetRealmsResultSchema])); +export const +ScriptEventSchema: z.ZodLazy> = z.lazy(() => z.union([Script.MessageSchema,Script.RealmCreatedSchema,Script.RealmDestroyedSchema])); +export namespace Script { +export const ChannelSchema: z.ZodLazy = z.lazy(() => z.string()); +} +export namespace Script { +export const ChannelValueSchema: z.ZodLazy,"value":typeof Script.ChannelPropertiesSchema}>> = z.lazy(() => z.object({ +"type":z.literal("channel"),"value":Script.ChannelPropertiesSchema})); +} +export namespace Script { +export const ChannelPropertiesSchema: z.ZodLazy,"ownership":z.ZodOptional}>> = z.lazy(() => z.object({ +"channel":Script.ChannelSchema,"serializationOptions":Script.SerializationOptionsSchema.optional(),"ownership":Script.ResultOwnershipSchema.optional()})); +} +export namespace Script { +export const EvaluateResultSchema: z.ZodLazy> = z.lazy(() => z.union([Script.EvaluateResultSuccessSchema,Script.EvaluateResultExceptionSchema])); +} +export namespace Script { +export const EvaluateResultSuccessSchema: z.ZodLazy,"result":typeof Script.RemoteValueSchema,"realm":typeof Script.RealmSchema}>> = z.lazy(() => z.object({ +"type":z.literal("success"),"result":Script.RemoteValueSchema,"realm":Script.RealmSchema})); +} +export namespace Script { +export const EvaluateResultExceptionSchema: z.ZodLazy,"exceptionDetails":typeof Script.ExceptionDetailsSchema,"realm":typeof Script.RealmSchema}>> = z.lazy(() => z.object({ +"type":z.literal("exception"),"exceptionDetails":Script.ExceptionDetailsSchema,"realm":Script.RealmSchema})); +} +export namespace Script { +export const ExceptionDetailsSchema: z.ZodLazy> = z.lazy(() => z.object({ +"columnNumber":JsUintSchema,"exception":Script.RemoteValueSchema,"lineNumber":JsUintSchema,"stackTrace":Script.StackTraceSchema,"text":z.string()})); +} +export namespace Script { +export const HandleSchema: z.ZodLazy = z.lazy(() => z.string()); +} +export namespace Script { +export const InternalIdSchema: z.ZodLazy = z.lazy(() => z.string()); +} +export namespace Script { +export const LocalValueSchema: z.ZodType = z.lazy(() => z.union([Script.RemoteReferenceSchema,Script.PrimitiveProtocolValueSchema,Script.ChannelValueSchema,Script.ArrayLocalValueSchema,Script.DateLocalValueSchema,Script.MapLocalValueSchema,Script.ObjectLocalValueSchema,Script.RegExpLocalValueSchema,Script.SetLocalValueSchema])); +} +export namespace Script { +export const ListLocalValueSchema: z.ZodLazy> = z.lazy(() => z.array(Script.LocalValueSchema)); +} +export namespace Script { +export const ArrayLocalValueSchema: z.ZodLazy,"value":typeof Script.ListLocalValueSchema}>> = z.lazy(() => z.object({ +"type":z.literal("array"),"value":Script.ListLocalValueSchema})); +} +export namespace Script { +export const DateLocalValueSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ +"type":z.literal("date"),"value":z.string()})); +} +export namespace Script { +export const MappingLocalValueSchema: z.ZodLazy,typeof Script.LocalValueSchema], null>>> = z.lazy(() => z.array(z.tuple([ +z.union([Script.LocalValueSchema,z.string()]),Script.LocalValueSchema]))); +} +export namespace Script { +export const MapLocalValueSchema: z.ZodLazy,"value":typeof Script.MappingLocalValueSchema}>> = z.lazy(() => z.object({ +"type":z.literal("map"),"value":Script.MappingLocalValueSchema})); +} +export namespace Script { +export const ObjectLocalValueSchema: z.ZodLazy,"value":typeof Script.MappingLocalValueSchema}>> = z.lazy(() => z.object({ +"type":z.literal("object"),"value":Script.MappingLocalValueSchema})); +} +export namespace Script { +export const RegExpValueSchema: z.ZodLazy}>> = z.lazy(() => z.object({ +"pattern":z.string(),"flags":z.string().optional()})); +} +export namespace Script { +export const RegExpLocalValueSchema: z.ZodLazy,"value":typeof Script.RegExpValueSchema}>> = z.lazy(() => z.object({ +"type":z.literal("regexp"),"value":Script.RegExpValueSchema})); +} +export namespace Script { +export const SetLocalValueSchema: z.ZodLazy,"value":typeof Script.ListLocalValueSchema}>> = z.lazy(() => z.object({ +"type":z.literal("set"),"value":Script.ListLocalValueSchema})); +} +export namespace Script { +export const PreloadScriptSchema: z.ZodLazy = z.lazy(() => z.string()); +} +export namespace Script { +export const RealmSchema: z.ZodLazy = z.lazy(() => z.string()); +} +export namespace Script { +export const PrimitiveProtocolValueSchema: z.ZodLazy> = z.lazy(() => z.union([Script.UndefinedValueSchema,Script.NullValueSchema,Script.StringValueSchema,Script.NumberValueSchema,Script.BooleanValueSchema,Script.BigIntValueSchema])); +} +export namespace Script { +export const UndefinedValueSchema: z.ZodLazy}>> = z.lazy(() => z.object({ +"type":z.literal("undefined")})); +} +export namespace Script { +export const NullValueSchema: z.ZodLazy}>> = z.lazy(() => z.object({ +"type":z.literal("null")})); +} +export namespace Script { +export const StringValueSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ +"type":z.literal("string"),"value":z.string()})); +} +export namespace Script { +export const SpecialNumberSchema: z.ZodLazy> = z.lazy(() => z.enum(["NaN","-0","Infinity","-Infinity",])); +} +export namespace Script { +export const NumberValueSchema: z.ZodLazy,"value":z.ZodUnion}>> = z.lazy(() => z.object({ +"type":z.literal("number"),"value":z.union([z.number(),Script.SpecialNumberSchema])})); +} +export namespace Script { +export const BooleanValueSchema: z.ZodLazy,"value":z.ZodBoolean}>> = z.lazy(() => z.object({ +"type":z.literal("boolean"),"value":z.boolean()})); +} +export namespace Script { +export const BigIntValueSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ +"type":z.literal("bigint"),"value":z.string()})); +} +export namespace Script { +export const RealmInfoSchema: z.ZodLazy> = z.lazy(() => z.union([Script.WindowRealmInfoSchema,Script.DedicatedWorkerRealmInfoSchema,Script.SharedWorkerRealmInfoSchema,Script.ServiceWorkerRealmInfoSchema,Script.WorkerRealmInfoSchema,Script.PaintWorkletRealmInfoSchema,Script.AudioWorkletRealmInfoSchema,Script.WorkletRealmInfoSchema])); +} +export namespace Script { +export const +BaseRealmInfoSchema: z.ZodLazy> = z.lazy(() => z.object({ +"realm":Script.RealmSchema,"origin":z.string()})); +} +export namespace Script { +export const WindowRealmInfoSchema: z.ZodLazy,"context":typeof BrowsingContext.BrowsingContextSchema,"sandbox":z.ZodOptional}>>> = z.lazy(() => Script.BaseRealmInfoSchema.and( +z.object({ +"type":z.literal("window"),"context":BrowsingContext.BrowsingContextSchema,"sandbox":z.string().optional()})) +); +} +export namespace Script { +export const DedicatedWorkerRealmInfoSchema: z.ZodLazy}>>> = z.lazy(() => Script.BaseRealmInfoSchema.and( +z.object({ +"type":z.literal("dedicated-worker")})) +); +} +export namespace Script { +export const SharedWorkerRealmInfoSchema: z.ZodLazy}>>> = z.lazy(() => Script.BaseRealmInfoSchema.and( +z.object({ +"type":z.literal("shared-worker")})) +); +} +export namespace Script { +export const ServiceWorkerRealmInfoSchema: z.ZodLazy}>>> = z.lazy(() => Script.BaseRealmInfoSchema.and( +z.object({ +"type":z.literal("service-worker")})) +); +} +export namespace Script { +export const WorkerRealmInfoSchema: z.ZodLazy}>>> = z.lazy(() => Script.BaseRealmInfoSchema.and( +z.object({ +"type":z.literal("worker")})) +); +} +export namespace Script { +export const PaintWorkletRealmInfoSchema: z.ZodLazy}>>> = z.lazy(() => Script.BaseRealmInfoSchema.and( +z.object({ +"type":z.literal("paint-worklet")})) +); +} +export namespace Script { +export const AudioWorkletRealmInfoSchema: z.ZodLazy}>>> = z.lazy(() => Script.BaseRealmInfoSchema.and( +z.object({ +"type":z.literal("audio-worklet")})) +); +} +export namespace Script { +export const WorkletRealmInfoSchema: z.ZodLazy}>>> = z.lazy(() => Script.BaseRealmInfoSchema.and( +z.object({ +"type":z.literal("worklet")})) +); +} +export namespace Script { +export const RealmTypeSchema: z.ZodLazy> = z.lazy(() => z.enum(["window","dedicated-worker","shared-worker","service-worker","worker","paint-worklet","audio-worklet","worklet",])); +} +export namespace Script { +export const RemoteReferenceSchema: z.ZodLazy> = z.lazy(() => z.union([Script.SharedReferenceSchema,Script.RemoteObjectReferenceSchema])); +} +export namespace Script { +export const SharedReferenceSchema: z.ZodLazy}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ +"sharedId":Script.SharedIdSchema,"handle":Script.HandleSchema.optional()}).and( +ExtensibleSchema) +); +} +export namespace Script { +export const RemoteObjectReferenceSchema: z.ZodLazy}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ +"handle":Script.HandleSchema,"sharedId":Script.SharedIdSchema.optional()}).and( +ExtensibleSchema) +); +} +export namespace Script { +export const RemoteValueSchema: z.ZodType = z.lazy(() => z.union([Script.PrimitiveProtocolValueSchema,Script.SymbolRemoteValueSchema,Script.ArrayRemoteValueSchema,Script.ObjectRemoteValueSchema,Script.FunctionRemoteValueSchema,Script.RegExpRemoteValueSchema,Script.DateRemoteValueSchema,Script.MapRemoteValueSchema,Script.SetRemoteValueSchema,Script.WeakMapRemoteValueSchema,Script.WeakSetRemoteValueSchema,Script.IteratorRemoteValueSchema,Script.GeneratorRemoteValueSchema,Script.ErrorRemoteValueSchema,Script.ProxyRemoteValueSchema,Script.PromiseRemoteValueSchema,Script.TypedArrayRemoteValueSchema,Script.ArrayBufferRemoteValueSchema,Script.NodeListRemoteValueSchema,Script.HtmlCollectionRemoteValueSchema,Script.NodeRemoteValueSchema,Script.WindowProxyRemoteValueSchema])); +} +export namespace Script { +export const ListRemoteValueSchema: z.ZodLazy> = z.lazy(() => z.array(Script.RemoteValueSchema)); +} +export namespace Script { +export const MappingRemoteValueSchema: z.ZodLazy,typeof Script.RemoteValueSchema], null>>> = z.lazy(() => z.array(z.tuple([ +z.union([Script.RemoteValueSchema,z.string()]),Script.RemoteValueSchema]))); +} +export namespace Script { +export const SymbolRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("symbol"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); +} +export namespace Script { +export const ArrayRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional,"value":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("array"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional(),"value":Script.ListRemoteValueSchema.optional()})); +} +export namespace Script { +export const ObjectRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional,"value":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("object"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional(),"value":Script.MappingRemoteValueSchema.optional()})); +} +export namespace Script { +export const FunctionRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("function"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); +} +export namespace Script { +export const RegExpRemoteValueSchema: z.ZodLazy,"internalId":z.ZodOptional}>,typeof Script.RegExpLocalValueSchema>> = z.lazy(() => z.object({ +"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()}).and(Script.RegExpLocalValueSchema)); +} +export namespace Script { +export const DateRemoteValueSchema: z.ZodLazy,"internalId":z.ZodOptional}>,typeof Script.DateLocalValueSchema>> = z.lazy(() => z.object({ +"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()}).and(Script.DateLocalValueSchema)); +} +export namespace Script { +export const MapRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional,"value":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("map"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional(),"value":Script.MappingRemoteValueSchema.optional()})); +} +export namespace Script { +export const SetRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional,"value":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("set"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional(),"value":Script.ListRemoteValueSchema.optional()})); +} +export namespace Script { +export const WeakMapRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("weakmap"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); +} +export namespace Script { +export const WeakSetRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("weakset"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); +} +export namespace Script { +export const IteratorRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("iterator"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); +} +export namespace Script { +export const GeneratorRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("generator"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); +} +export namespace Script { +export const ErrorRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("error"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); +} +export namespace Script { +export const ProxyRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("proxy"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); +} +export namespace Script { +export const PromiseRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("promise"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); +} +export namespace Script { +export const TypedArrayRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("typedarray"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); +} +export namespace Script { +export const ArrayBufferRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("arraybuffer"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); +} +export namespace Script { +export const NodeListRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional,"value":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("nodelist"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional(),"value":Script.ListRemoteValueSchema.optional()})); +} +export namespace Script { +export const HtmlCollectionRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional,"value":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("htmlcollection"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional(),"value":Script.ListRemoteValueSchema.optional()})); +} +export namespace Script { +export const NodeRemoteValueSchema: z.ZodType = z.lazy(() => z.object({ +"type":z.literal("node"),"sharedId":Script.SharedIdSchema.optional(),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional(),"value":Script.NodePropertiesSchema.optional()})); +} +export namespace Script { +export const NodePropertiesSchema: z.ZodLazy>,"children":z.ZodOptional>,"localName":z.ZodOptional,"mode":z.ZodOptional>,"namespaceURI":z.ZodOptional,"nodeValue":z.ZodOptional,"shadowRoot":z.ZodOptional>}>> = z.lazy(() => z.object({ +"nodeType":JsUintSchema,"childNodeCount":JsUintSchema,"attributes":z.record( +z.string(),z.string()).optional(),"children":z.array(Script.NodeRemoteValueSchema).optional(),"localName":z.string().optional(),"mode":z.enum(["open","closed",]).optional(),"namespaceURI":z.string().optional(),"nodeValue":z.string().optional(),"shadowRoot":z.union([Script.NodeRemoteValueSchema,z.null()]).optional()})); +} +export namespace Script { +export const WindowProxyRemoteValueSchema: z.ZodLazy,"value":typeof Script.WindowProxyPropertiesSchema,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("window"),"value":Script.WindowProxyPropertiesSchema,"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); +} +export namespace Script { +export const WindowProxyPropertiesSchema: z.ZodLazy> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema})); +} +export namespace Script { +export const ResultOwnershipSchema: z.ZodLazy> = z.lazy(() => z.enum(["root","none",])); +} +export namespace Script { +export const SerializationOptionsSchema: z.ZodLazy>>,"maxObjectDepth":z.ZodOptional>>,"includeShadowTree":z.ZodOptional>>}>> = z.lazy(() => z.object({ +"maxDomDepth":z.union([JsUintSchema,z.null()]).default(0).optional(),"maxObjectDepth":z.union([JsUintSchema,z.null()]).default(null).optional(),"includeShadowTree":z.enum(["none","open","all",]).default("none").optional()})); +} +export namespace Script { +export const SharedIdSchema: z.ZodLazy = z.lazy(() => z.string()); +} +export namespace Script { +export const StackFrameSchema: z.ZodLazy> = z.lazy(() => z.object({ +"columnNumber":JsUintSchema,"functionName":z.string(),"lineNumber":JsUintSchema,"url":z.string()})); +} +export namespace Script { +export const StackTraceSchema: z.ZodLazy}>> = z.lazy(() => z.object({ +"callFrames":z.array(Script.StackFrameSchema)})); +} +export namespace Script { +export const SourceSchema: z.ZodLazy}>> = z.lazy(() => z.object({ +"realm":Script.RealmSchema,"context":BrowsingContext.BrowsingContextSchema.optional()})); +} +export namespace Script { +export const RealmTargetSchema: z.ZodLazy> = z.lazy(() => z.object({ +"realm":Script.RealmSchema})); +} +export namespace Script { +export const ContextTargetSchema: z.ZodLazy}>> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema,"sandbox":z.string().optional()})); +} +export namespace Script { +export const TargetSchema: z.ZodLazy> = z.lazy(() => z.union([Script.RealmTargetSchema,Script.ContextTargetSchema])); +} +export namespace Script { +export const +AddPreloadScriptSchema: z.ZodLazy,"params":typeof Script.AddPreloadScriptParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("script.addPreloadScript"),"params":Script.AddPreloadScriptParametersSchema})); +} +export namespace Script { +export const AddPreloadScriptParametersSchema: z.ZodLazy>,"contexts":z.ZodOptional>,"sandbox":z.ZodOptional}>> = z.lazy(() => z.object({ +"functionDeclaration":z.string(),"arguments":z.array(Script.ChannelValueSchema).optional(),"contexts":z.array(BrowsingContext.BrowsingContextSchema).nonempty().optional(),"sandbox":z.string().optional()})); +} +export namespace Script { +export const AddPreloadScriptResultSchema: z.ZodLazy> = z.lazy(() => z.object({ +"script":Script.PreloadScriptSchema})); +} +export namespace Script { +export const +DisownSchema: z.ZodLazy,"params":typeof Script.DisownParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("script.disown"),"params":Script.DisownParametersSchema})); +} +export namespace Script { +export const DisownParametersSchema: z.ZodLazy,"target":typeof Script.TargetSchema}>> = z.lazy(() => z.object({ +"handles":z.array(Script.HandleSchema),"target":Script.TargetSchema})); +} +export namespace Script { +export const +CallFunctionSchema: z.ZodLazy,"params":typeof Script.CallFunctionParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("script.callFunction"),"params":Script.CallFunctionParametersSchema})); +} +export namespace Script { +export const CallFunctionParametersSchema: z.ZodLazy>,"resultOwnership":z.ZodOptional,"serializationOptions":z.ZodOptional,"this":z.ZodOptional,"userActivation":z.ZodOptional>}>> = z.lazy(() => z.object({ +"functionDeclaration":z.string(),"awaitPromise":z.boolean(),"target":Script.TargetSchema,"arguments":z.array(Script.LocalValueSchema).optional(),"resultOwnership":Script.ResultOwnershipSchema.optional(),"serializationOptions":Script.SerializationOptionsSchema.optional(),"this":Script.LocalValueSchema.optional(),"userActivation":z.boolean().default(false).optional()})); +} +export namespace Script { +export const +EvaluateSchema: z.ZodLazy,"params":typeof Script.EvaluateParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("script.evaluate"),"params":Script.EvaluateParametersSchema})); +} +export namespace Script { +export const EvaluateParametersSchema: z.ZodLazy,"serializationOptions":z.ZodOptional,"userActivation":z.ZodOptional>}>> = z.lazy(() => z.object({ +"expression":z.string(),"target":Script.TargetSchema,"awaitPromise":z.boolean(),"resultOwnership":Script.ResultOwnershipSchema.optional(),"serializationOptions":Script.SerializationOptionsSchema.optional(),"userActivation":z.boolean().default(false).optional()})); +} +export namespace Script { +export const +GetRealmsSchema: z.ZodLazy,"params":typeof Script.GetRealmsParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("script.getRealms"),"params":Script.GetRealmsParametersSchema})); +} +export namespace Script { +export const GetRealmsParametersSchema: z.ZodLazy,"type":z.ZodOptional}>> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema.optional(),"type":Script.RealmTypeSchema.optional()})); +} +export namespace Script { +export const GetRealmsResultSchema: z.ZodLazy}>> = z.lazy(() => z.object({ +"realms":z.array(Script.RealmInfoSchema)})); +} +export namespace Script { +export const +RemovePreloadScriptSchema: z.ZodLazy,"params":typeof Script.RemovePreloadScriptParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("script.removePreloadScript"),"params":Script.RemovePreloadScriptParametersSchema})); +} +export namespace Script { +export const RemovePreloadScriptParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ +"script":Script.PreloadScriptSchema})); +} +export namespace Script { +export const +MessageSchema: z.ZodLazy,"params":typeof Script.MessageParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("script.message"),"params":Script.MessageParametersSchema})); +} +export namespace Script { +export const MessageParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ +"channel":Script.ChannelSchema,"data":Script.RemoteValueSchema,"source":Script.SourceSchema})); +} +export namespace Script { +export const +RealmCreatedSchema: z.ZodLazy,"params":typeof Script.RealmInfoSchema}>> = z.lazy(() => z.object({ +"method":z.literal("script.realmCreated"),"params":Script.RealmInfoSchema})); +} +export namespace Script { +export const +RealmDestroyedSchema: z.ZodLazy,"params":typeof Script.RealmDestroyedParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("script.realmDestroyed"),"params":Script.RealmDestroyedParametersSchema})); +} +export namespace Script { +export const RealmDestroyedParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ +"realm":Script.RealmSchema})); +} +export const +LogEventSchema: z.ZodLazy = z.lazy(() => Log.EntryAddedSchema); +export namespace Log { +export const LevelSchema: z.ZodLazy> = z.lazy(() => z.enum(["debug","info","warn","error",])); +} +export namespace Log { +export const EntrySchema: z.ZodLazy> = z.lazy(() => z.union([Log.GenericLogEntrySchema,Log.ConsoleLogEntrySchema,Log.JavascriptLogEntrySchema])); +} +export namespace Log { +export const +BaseLogEntrySchema: z.ZodLazy,"timestamp":typeof JsUintSchema,"stackTrace":z.ZodOptional}>> = z.lazy(() => z.object({ +"level":Log.LevelSchema,"source":Script.SourceSchema,"text":z.union([z.string(),z.null()]),"timestamp":JsUintSchema,"stackTrace":Script.StackTraceSchema.optional()})); +} +export namespace Log { +export const GenericLogEntrySchema: z.ZodLazy>> = z.lazy(() => Log.BaseLogEntrySchema.and( +z.object({ +"type":z.string()})) +); +} +export namespace Log { +export const ConsoleLogEntrySchema: z.ZodLazy,"method":z.ZodString,"args":z.ZodArray}>>> = z.lazy(() => Log.BaseLogEntrySchema.and( +z.object({ +"type":z.literal("console"),"method":z.string(),"args":z.array(Script.RemoteValueSchema)})) +); +} +export namespace Log { +export const JavascriptLogEntrySchema: z.ZodLazy}>>> = z.lazy(() => Log.BaseLogEntrySchema.and( +z.object({ +"type":z.literal("javascript")})) +); +} +export namespace Log { +export const +EntryAddedSchema: z.ZodLazy,"params":typeof Log.EntrySchema}>> = z.lazy(() => z.object({ +"method":z.literal("log.entryAdded"),"params":Log.EntrySchema})); +} +export const +InputCommandSchema: z.ZodLazy> = z.lazy(() => z.union([Input.PerformActionsSchema,Input.ReleaseActionsSchema])); +export namespace Input { +export const ElementOriginSchema: z.ZodLazy,"element":typeof Script.SharedReferenceSchema}>> = z.lazy(() => z.object({ +"type":z.literal("element"),"element":Script.SharedReferenceSchema})); +} +export namespace Input { +export const +PerformActionsSchema: z.ZodLazy,"params":typeof Input.PerformActionsParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("input.performActions"),"params":Input.PerformActionsParametersSchema})); +} +export namespace Input { +export const PerformActionsParametersSchema: z.ZodLazy}>> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema,"actions":z.array(Input.SourceActionsSchema)})); +} +export namespace Input { +export const SourceActionsSchema: z.ZodLazy> = z.lazy(() => z.union([Input.NoneSourceActionsSchema,Input.KeySourceActionsSchema,Input.PointerSourceActionsSchema,Input.WheelSourceActionsSchema])); +} +export namespace Input { +export const NoneSourceActionsSchema: z.ZodLazy,"id":z.ZodString,"actions":z.ZodArray}>> = z.lazy(() => z.object({ +"type":z.literal("none"),"id":z.string(),"actions":z.array(Input.NoneSourceActionSchema)})); +} +export namespace Input { +export const NoneSourceActionSchema: z.ZodLazy = z.lazy(() => Input.PauseActionSchema); +} +export namespace Input { +export const KeySourceActionsSchema: z.ZodLazy,"id":z.ZodString,"actions":z.ZodArray}>> = z.lazy(() => z.object({ +"type":z.literal("key"),"id":z.string(),"actions":z.array(Input.KeySourceActionSchema)})); +} +export namespace Input { +export const KeySourceActionSchema: z.ZodLazy> = z.lazy(() => z.union([Input.PauseActionSchema,Input.KeyDownActionSchema,Input.KeyUpActionSchema])); +} +export namespace Input { +export const PointerSourceActionsSchema: z.ZodLazy,"id":z.ZodString,"parameters":z.ZodOptional,"actions":z.ZodArray}>> = z.lazy(() => z.object({ +"type":z.literal("pointer"),"id":z.string(),"parameters":Input.PointerParametersSchema.optional(),"actions":z.array(Input.PointerSourceActionSchema)})); +} +export namespace Input { +export const PointerTypeSchema: z.ZodLazy> = z.lazy(() => z.enum(["mouse","pen","touch",])); +} +export namespace Input { +export const PointerParametersSchema: z.ZodLazy>}>> = z.lazy(() => z.object({ +"pointerType":Input.PointerTypeSchema.default("mouse").optional()})); +} +export namespace Input { +export const PointerSourceActionSchema: z.ZodLazy> = z.lazy(() => z.union([Input.PauseActionSchema,Input.PointerDownActionSchema,Input.PointerUpActionSchema,Input.PointerMoveActionSchema])); +} +export namespace Input { +export const WheelSourceActionsSchema: z.ZodLazy,"id":z.ZodString,"actions":z.ZodArray}>> = z.lazy(() => z.object({ +"type":z.literal("wheel"),"id":z.string(),"actions":z.array(Input.WheelSourceActionSchema)})); +} +export namespace Input { +export const WheelSourceActionSchema: z.ZodLazy> = z.lazy(() => z.union([Input.PauseActionSchema,Input.WheelScrollActionSchema])); +} +export namespace Input { +export const PauseActionSchema: z.ZodLazy,"duration":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.literal("pause"),"duration":JsUintSchema.optional()})); +} +export namespace Input { +export const KeyDownActionSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ +"type":z.literal("keyDown"),"value":z.string()})); +} +export namespace Input { +export const KeyUpActionSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ +"type":z.literal("keyUp"),"value":z.string()})); +} +export namespace Input { +export const PointerUpActionSchema: z.ZodLazy,"button":typeof JsUintSchema}>,typeof Input.PointerCommonPropertiesSchema>> = z.lazy(() => z.object({ +"type":z.literal("pointerUp"),"button":JsUintSchema}).and( +Input.PointerCommonPropertiesSchema) +); +} +export namespace Input { +export const PointerDownActionSchema: z.ZodLazy,"button":typeof JsUintSchema}>,typeof Input.PointerCommonPropertiesSchema>> = z.lazy(() => z.object({ +"type":z.literal("pointerDown"),"button":JsUintSchema}).and( +Input.PointerCommonPropertiesSchema) +); +} +export namespace Input { +export const PointerMoveActionSchema: z.ZodLazy,"x":typeof JsIntSchema,"y":typeof JsIntSchema,"duration":z.ZodOptional,"origin":z.ZodOptional}>,typeof Input.PointerCommonPropertiesSchema>> = z.lazy(() => z.object({ +"type":z.literal("pointerMove"),"x":JsIntSchema,"y":JsIntSchema,"duration":JsUintSchema.optional(),"origin":Input.OriginSchema.optional()}).and( +Input.PointerCommonPropertiesSchema) +); +} +export namespace Input { +export const WheelScrollActionSchema: z.ZodLazy,"x":typeof JsIntSchema,"y":typeof JsIntSchema,"deltaX":typeof JsIntSchema,"deltaY":typeof JsIntSchema,"duration":z.ZodOptional,"origin":z.ZodOptional>}>> = z.lazy(() => z.object({ +"type":z.literal("scroll"),"x":JsIntSchema,"y":JsIntSchema,"deltaX":JsIntSchema,"deltaY":JsIntSchema,"duration":JsUintSchema.optional(),"origin":Input.OriginSchema.default("viewport").optional()})); +} +export namespace Input { +export const +PointerCommonPropertiesSchema: z.ZodLazy>,"height":z.ZodOptional>,"pressure":z.ZodOptional>,"tangentialPressure":z.ZodOptional>,"twist":z.ZodOptional>,"altitudeAngle":z.ZodOptional>,"azimuthAngle":z.ZodOptional>}>> = z.lazy(() => z.object({ +"width":JsUintSchema.default(1).optional(),"height":JsUintSchema.default(1).optional(),"pressure":z.number().default(0).optional(),"tangentialPressure":z.number().default(0).optional(),"twist":z.number().int().nonnegative().gte(0).lte(359).default(0).optional(),"altitudeAngle":z.number().gte(0).lte(1.5707963267948966).default(0).optional(),"azimuthAngle":z.number().gte(0).lte(6.283185307179586).default(0).optional()})); +} +export namespace Input { +export const OriginSchema: z.ZodLazy,z.ZodLiteral<"pointer">,typeof Input.ElementOriginSchema]>> = z.lazy(() => z.union([z.literal("viewport"),z.literal("pointer"),Input.ElementOriginSchema])); +} +export namespace Input { +export const +ReleaseActionsSchema: z.ZodLazy,"params":typeof Input.ReleaseActionsParametersSchema}>> = z.lazy(() => z.object({ +"method":z.literal("input.releaseActions"),"params":Input.ReleaseActionsParametersSchema})); +} +export namespace Input { +export const ReleaseActionsParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ +"context":BrowsingContext.BrowsingContextSchema})); +} diff --git a/tests/snapshots/zod4__it_works.snap b/tests/snapshots/zod4__it_works.snap new file mode 100644 index 0000000..1b7af9e --- /dev/null +++ b/tests/snapshots/zod4__it_works.snap @@ -0,0 +1,5 @@ +--- +source: tests/zod4.rs +expression: "String :: from_utf8(stderr.into_inner().unwrap()).unwrap()" +--- + diff --git a/tests/snapshots/zod4__it_works_with_amendments-2.snap b/tests/snapshots/zod4__it_works_with_amendments-2.snap new file mode 100644 index 0000000..d40350f --- /dev/null +++ b/tests/snapshots/zod4__it_works_with_amendments-2.snap @@ -0,0 +1,14 @@ +--- +source: tests/zod4.rs +expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" +--- +export const TerminalColorSchema: z.ZodLazy = z.lazy(() => BasecolorsSchema); +export const +BasecolorsSchema: z.ZodLazy,"red":z.ZodLiteral<1>,"green":z.ZodLiteral<2>,"yellow":z.ZodLiteral<3>,"blue":z.ZodLiteral<4>,"magenta":z.ZodLiteral<5>,"cyan":z.ZodLiteral<6>,"white":z.ZodLiteral<7>}>> = z.lazy(() => z.object({ +"black":z.literal(0),"red":z.literal(1),"green":z.literal(2),"yellow":z.literal(3),"blue":z.literal(4),"magenta":z.literal(5),"cyan":z.literal(6),"white":z.literal(7)})); +export const ExtendedColorSchema: z.ZodLazy,"pink":z.ZodLiteral<9>,"purple":z.ZodLiteral<10>,"brown":z.ZodLiteral<11>}>>> = z.lazy(() => BasecolorsSchema.and( +z.object({ +"orange":z.literal(8),"pink":z.literal(9),"purple":z.literal(10),"brown":z.literal(11)})) +); diff --git a/tests/snapshots/zod4__it_works_with_amendments.snap b/tests/snapshots/zod4__it_works_with_amendments.snap new file mode 100644 index 0000000..1b7af9e --- /dev/null +++ b/tests/snapshots/zod4__it_works_with_amendments.snap @@ -0,0 +1,5 @@ +--- +source: tests/zod4.rs +expression: "String :: from_utf8(stderr.into_inner().unwrap()).unwrap()" +--- + diff --git a/tests/snapshots/zod4__it_works_with_array_occurences-2.snap b/tests/snapshots/zod4__it_works_with_array_occurences-2.snap new file mode 100644 index 0000000..848ab38 --- /dev/null +++ b/tests/snapshots/zod4__it_works_with_array_occurences-2.snap @@ -0,0 +1,10 @@ +--- +source: tests/zod4.rs +expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" +--- +export const CapabilityRequestSchema: z.ZodLazy> = z.lazy(() => z.object({ +})); +export const CapabilitiesRequestSchema: z.ZodLazy}>> = z.lazy(() => z.object({ +"firstMatch":z.array(CapabilityRequestSchema)})); diff --git a/tests/snapshots/zod4__it_works_with_array_occurences.snap b/tests/snapshots/zod4__it_works_with_array_occurences.snap new file mode 100644 index 0000000..1b7af9e --- /dev/null +++ b/tests/snapshots/zod4__it_works_with_array_occurences.snap @@ -0,0 +1,5 @@ +--- +source: tests/zod4.rs +expression: "String :: from_utf8(stderr.into_inner().unwrap()).unwrap()" +--- + diff --git a/tests/snapshots/zod4__it_works_with_enums-2.snap b/tests/snapshots/zod4__it_works_with_enums-2.snap new file mode 100644 index 0000000..0b30735 --- /dev/null +++ b/tests/snapshots/zod4__it_works_with_enums-2.snap @@ -0,0 +1,13 @@ +--- +source: tests/zod4.rs +expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" +--- +export const QEnumSchema: z.ZodLazy> = z.lazy(() => z.enum(["qValue","qValue2",])); +export namespace Network { +export const SameSiteSchema: z.ZodLazy> = z.lazy(() => z.enum(["strict","lax","none",])); +} +export namespace Network { +export const CookieSchema: z.ZodLazy> = z.lazy(() => z.object({ +"name":z.string(),"value":z.string(),"sameSite":Network.SameSiteSchema})); +} diff --git a/tests/snapshots/zod4__it_works_with_enums.snap b/tests/snapshots/zod4__it_works_with_enums.snap new file mode 100644 index 0000000..1b7af9e --- /dev/null +++ b/tests/snapshots/zod4__it_works_with_enums.snap @@ -0,0 +1,5 @@ +--- +source: tests/zod4.rs +expression: "String :: from_utf8(stderr.into_inner().unwrap()).unwrap()" +--- + diff --git a/tests/snapshots/zod4__it_works_with_maps-2.snap b/tests/snapshots/zod4__it_works_with_maps-2.snap new file mode 100644 index 0000000..502ae98 --- /dev/null +++ b/tests/snapshots/zod4__it_works_with_maps-2.snap @@ -0,0 +1,35 @@ +--- +source: tests/zod4.rs +expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" +--- +export const ExtensibleMapExampleSchema: z.ZodLazy}>,z.ZodRecord< +z.ZodString,z.ZodAny>>> = z.lazy(() => z.object({ +"optional-key":z.number().int().optional()}).and( +z.record( +z.string(),z.any())) +); +export const ExtensibleMapExample2Schema: z.ZodLazy}>,z.ZodRecord< +z.ZodString,z.ZodAny>>> = z.lazy(() => z.object({ +"optional-key":z.number().int().optional()}).and( +z.record( +z.string(),z.any())) +); +export const ExtensibleMapExample3Schema: z.ZodLazy}>,z.ZodRecord< +z.ZodString,z.ZodAny>>> = z.lazy(() => z.object({ +"optional-key":z.number().int().optional()}).and( +z.record( +z.string(),z.any())) +); +export const ExtensibleMapExample4Schema: z.ZodLazy,z.ZodOptional>,z.ZodRecord< +z.ZodString,z.ZodAny>>> = z.lazy(() => z.record( +z.literal("optional-key"),z.number().int().optional()).and( +z.record( +z.string(),z.any())) +); +export const ExampleMapSchema: z.ZodLazy,"another-key":z.ZodOptional,"standardIdentifier":z.ZodOptional,"1":z.ZodOptional}>> = z.lazy(() => z.object({ +"hyphenated-key":z.string().optional(),"another-key":z.string().optional(),"standardIdentifier":z.string().optional(),"1":z.string().optional()})); diff --git a/tests/snapshots/zod4__it_works_with_maps.snap b/tests/snapshots/zod4__it_works_with_maps.snap new file mode 100644 index 0000000..1b7af9e --- /dev/null +++ b/tests/snapshots/zod4__it_works_with_maps.snap @@ -0,0 +1,5 @@ +--- +source: tests/zod4.rs +expression: "String :: from_utf8(stderr.into_inner().unwrap()).unwrap()" +--- + diff --git a/tests/snapshots/zod4__it_works_with_optional_groups-2.snap b/tests/snapshots/zod4__it_works_with_optional_groups-2.snap new file mode 100644 index 0000000..f3fab0c --- /dev/null +++ b/tests/snapshots/zod4__it_works_with_optional_groups-2.snap @@ -0,0 +1,19 @@ +--- +source: tests/zod4.rs +expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" +--- +export const ASchema: z.ZodLazy,z.ZodUnion,z.ZodObject<{}>]>>> = z.lazy(() => z.object({ +"foo":z.string()}).and( +z.object({ +"bar":z.string()}).or(z.object({}))) +); +export const BSchema: z.ZodLazy,z.ZodUnion]>>> = z.lazy(() => z.object({ +"foo":z.string()}).and( +BarSchema.or(z.object({}))) +); +export const +BarSchema: z.ZodType = z.lazy(() => z.object({ +"bar":z.string()})); diff --git a/tests/snapshots/zod4__it_works_with_optional_groups.snap b/tests/snapshots/zod4__it_works_with_optional_groups.snap new file mode 100644 index 0000000..1b7af9e --- /dev/null +++ b/tests/snapshots/zod4__it_works_with_optional_groups.snap @@ -0,0 +1,5 @@ +--- +source: tests/zod4.rs +expression: "String :: from_utf8(stderr.into_inner().unwrap()).unwrap()" +--- + diff --git a/tests/snapshots/zod4__it_works_with_prelude_text_types-2.snap b/tests/snapshots/zod4__it_works_with_prelude_text_types-2.snap new file mode 100644 index 0000000..37e0078 --- /dev/null +++ b/tests/snapshots/zod4__it_works_with_prelude_text_types-2.snap @@ -0,0 +1,7 @@ +--- +source: tests/zod4.rs +expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" +--- +export const LinkSchema: z.ZodLazy> = z.lazy(() => z.object({ +"href":z.url(),"pattern":z.string()})); diff --git a/tests/snapshots/zod4__it_works_with_prelude_text_types.snap b/tests/snapshots/zod4__it_works_with_prelude_text_types.snap new file mode 100644 index 0000000..1b7af9e --- /dev/null +++ b/tests/snapshots/zod4__it_works_with_prelude_text_types.snap @@ -0,0 +1,5 @@ +--- +source: tests/zod4.rs +expression: "String :: from_utf8(stderr.into_inner().unwrap()).unwrap()" +--- + diff --git a/tests/snapshots/zod4__it_works_with_simple_optional_groups-2.snap b/tests/snapshots/zod4__it_works_with_simple_optional_groups-2.snap new file mode 100644 index 0000000..9f117cb --- /dev/null +++ b/tests/snapshots/zod4__it_works_with_simple_optional_groups-2.snap @@ -0,0 +1,23 @@ +--- +source: tests/zod4.rs +expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" +--- +export namespace Bluetooth { +export const HandleRequestDevicePromptParametersSchema: z.ZodLazy,z.ZodUnion>> = z.lazy(() => z.object({ +"context":z.string(),"prompt":z.string()}).and( +z.union([Bluetooth.HandleRequestDevicePromptAcceptParametersSchema,Bluetooth.HandleRequestDevicePromptCancelParametersSchema])) +); +} +export namespace Bluetooth { +export const +HandleRequestDevicePromptAcceptParametersSchema: z.ZodLazy,"device":z.ZodString}>> = z.lazy(() => z.object({ +"accept":z.literal(true),"device":z.string()})); +} +export namespace Bluetooth { +export const +HandleRequestDevicePromptCancelParametersSchema: z.ZodLazy}>> = z.lazy(() => z.object({ +"accept":z.literal(false)})); +} diff --git a/tests/snapshots/zod4__it_works_with_simple_optional_groups.snap b/tests/snapshots/zod4__it_works_with_simple_optional_groups.snap new file mode 100644 index 0000000..1b7af9e --- /dev/null +++ b/tests/snapshots/zod4__it_works_with_simple_optional_groups.snap @@ -0,0 +1,5 @@ +--- +source: tests/zod4.rs +expression: "String :: from_utf8(stderr.into_inner().unwrap()).unwrap()" +--- + diff --git a/tests/zod4.rs b/tests/zod4.rs new file mode 100644 index 0000000..d9ae197 --- /dev/null +++ b/tests/zod4.rs @@ -0,0 +1,51 @@ +use std::io::BufWriter; + +use cddl::visitor::Visitor; +use cddlconv; + +macro_rules! test { + ($name:ident, $input:expr) => { + #[test] + fn $name() { + let input = std::fs::read_to_string($input).unwrap(); + let cddl = cddl::parser::cddl_from_str(&input, true).unwrap(); + let stdout = BufWriter::new(Vec::new()); + let stderr = BufWriter::new(Vec::new()); + let mut engine = cddlconv::engines::zod::Engine::with_writers_and_version( + stdout, + stderr, + cddlconv::engines::zod::Version::V4, + ); + engine.visit_cddl(&cddl).unwrap(); + engine.print_postamble(); + + let (stdout, stderr) = engine.into_writers(); + insta::assert_snapshot!(String::from_utf8(stderr.into_inner().unwrap()).unwrap()); + insta::assert_snapshot!(String::from_utf8(stdout.into_inner().unwrap()).unwrap()); + } + }; +} + +test!(it_works, "examples/webdriver-bidi/webdriver-bidi.cddl"); +test!(it_works_with_maps, "examples/rfc-examples/maps.cddl"); +test!( + it_works_with_amendments, + "examples/rfc-examples/colors.cddl" +); +test!( + it_works_with_prelude_text_types, + "examples/rfc-examples/prelude_text_types.cddl" +); +test!( + it_works_with_optional_groups, + "examples/optional_groups.cddl" +); +test!( + it_works_with_simple_optional_groups, + "examples/simple_optional_groups.cddl" +); +test!( + it_works_with_array_occurences, + "examples/array_occurences.cddl" +); +test!(it_works_with_enums, "examples/enums.cddl"); From e4e9f4ea9969e77a218041ff7ebb0466ec7fdf3e Mon Sep 17 00:00:00 2001 From: Maksim Sadym Date: Tue, 29 Sep 2026 14:28:31 +0000 Subject: [PATCH 2/2] remove zod3 support --- README.md | 4 +- src/engines/zod.rs | 59 +- src/main.rs | 11 - tests/snapshots/zod4__it_works-2.snap | 1412 ----------------- tests/snapshots/zod4__it_works.snap | 5 - .../zod4__it_works_with_amendments-2.snap | 14 - .../zod4__it_works_with_amendments.snap | 5 - ...od4__it_works_with_array_occurences-2.snap | 10 - .../zod4__it_works_with_array_occurences.snap | 5 - .../zod4__it_works_with_enums-2.snap | 13 - .../snapshots/zod4__it_works_with_enums.snap | 5 - .../snapshots/zod4__it_works_with_maps-2.snap | 35 - tests/snapshots/zod4__it_works_with_maps.snap | 5 - ...zod4__it_works_with_optional_groups-2.snap | 19 - .../zod4__it_works_with_optional_groups.snap | 5 - ...4__it_works_with_prelude_text_types-2.snap | 7 - ...od4__it_works_with_prelude_text_types.snap | 5 - ...t_works_with_simple_optional_groups-2.snap | 23 - ..._it_works_with_simple_optional_groups.snap | 5 - tests/snapshots/zod__it_works-2.snap | 134 +- .../snapshots/zod__it_works_with_enums-2.snap | 4 +- .../zod__it_works_with_optional_groups-2.snap | 4 +- ...t_works_with_simple_optional_groups-2.snap | 2 +- tests/zod4.rs | 51 - 24 files changed, 85 insertions(+), 1757 deletions(-) delete mode 100644 tests/snapshots/zod4__it_works-2.snap delete mode 100644 tests/snapshots/zod4__it_works.snap delete mode 100644 tests/snapshots/zod4__it_works_with_amendments-2.snap delete mode 100644 tests/snapshots/zod4__it_works_with_amendments.snap delete mode 100644 tests/snapshots/zod4__it_works_with_array_occurences-2.snap delete mode 100644 tests/snapshots/zod4__it_works_with_array_occurences.snap delete mode 100644 tests/snapshots/zod4__it_works_with_enums-2.snap delete mode 100644 tests/snapshots/zod4__it_works_with_enums.snap delete mode 100644 tests/snapshots/zod4__it_works_with_maps-2.snap delete mode 100644 tests/snapshots/zod4__it_works_with_maps.snap delete mode 100644 tests/snapshots/zod4__it_works_with_optional_groups-2.snap delete mode 100644 tests/snapshots/zod4__it_works_with_optional_groups.snap delete mode 100644 tests/snapshots/zod4__it_works_with_prelude_text_types-2.snap delete mode 100644 tests/snapshots/zod4__it_works_with_prelude_text_types.snap delete mode 100644 tests/snapshots/zod4__it_works_with_simple_optional_groups-2.snap delete mode 100644 tests/snapshots/zod4__it_works_with_simple_optional_groups.snap delete mode 100644 tests/zod4.rs diff --git a/README.md b/README.md index ec25c12..2b335be 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ A commandline utility for converting CDDL to various formats. ## Usage 1. Clone this repo and `cd` into it. -2. `cargo run -- [--format ] path/to/file.cddl` +2. `cargo run -- [--format ] path/to/file.cddl` ## Tips @@ -26,4 +26,4 @@ cargo run -- path/to/file.cddl | prettier --stdin-filepath=$outfile > $outfile ## Limitations -1. Only [`TypeScript`](https://www.typescriptlang.org/) (`--format type-script`), [`Zod v3`](https://v3.zod.dev/) (`--format zod`), and [`Zod v4`](https://zod.dev/) (`--format zod4`) are supported at the moment. +1. Only [`TypeScript`](https://www.typescriptlang.org/) (`--format type-script`) and [`Zod v4`](https://zod.dev/) (`--format zod`) are supported at the moment. diff --git a/src/engines/zod.rs b/src/engines/zod.rs index fe09287..a9c2102 100644 --- a/src/engines/zod.rs +++ b/src/engines/zod.rs @@ -46,12 +46,6 @@ struct PostambleOptions { print_flatten: bool, } -#[derive(Copy, Clone, PartialEq, Eq)] -pub enum Version { - V3, - V4, -} - pub struct Engine where Stdout: Write, @@ -60,7 +54,6 @@ where nested_group_choices: Vec, nested_type1: Vec, is_type_mode: bool, - version: Version, cyclic_rules: std::collections::HashSet, #[allow(dead_code)] postamble_options: PostambleOptions, @@ -85,18 +78,10 @@ fn calculate_occurrence(occur: &Option>) -> (usize, us impl<'a, 'b: 'a, 'c, Stdout: Write, Stderr: Write> Engine { pub fn with_writers(stdout: Stdout, stderr: Stderr) -> Engine { - Self::with_writers_and_version(stdout, stderr, Version::V3) - } - pub fn with_writers_and_version( - stdout: Stdout, - stderr: Stderr, - version: Version, - ) -> Engine { Engine { nested_group_choices: Vec::new(), nested_type1: Vec::new(), is_type_mode: false, - version, cyclic_rules: std::collections::HashSet::new(), postamble_options: PostambleOptions { #[cfg(feature = "vector_groups")] @@ -119,12 +104,6 @@ impl<'a, 'b: 'a, 'c, Stdout: Write, Stderr: Write> Engine { unimplemented!(); } } - fn write_zod_union_type_start(&mut self) { - match self.version { - Version::V3 => write!(self.stdout, "z.ZodUnion<["), - Version::V4 => write!(self.stdout, "z.ZodUnion) -> bool { // Special case for string enums if t.type_choices.len() > 1 @@ -134,26 +113,13 @@ impl<'a, 'b: 'a, 'c, Stdout: Write, Stderr: Write> Engine { .all(|type2| matches!(type2, cddl::ast::Type2::TextValue { .. })) { if self.is_type_mode { - match self.version { - Version::V3 => { - write!(self.stdout, "z.ZodEnum<["); - for type2 in t.type_choices.iter().map(|choice| &choice.type1.type2) { - if let cddl::ast::Type2::TextValue { value, .. } = type2 { - write!(self.stdout, "\"{}\",", value); - } - } - write!(self.stdout, "]>"); - } - Version::V4 => { - write!(self.stdout, "z.ZodEnum<{{"); - for type2 in t.type_choices.iter().map(|choice| &choice.type1.type2) { - if let cddl::ast::Type2::TextValue { value, .. } = type2 { - write!(self.stdout, "\"{}\":\"{}\",", value, value); - } - } - write!(self.stdout, "}}>"); + write!(self.stdout, "z.ZodEnum<{{"); + for type2 in t.type_choices.iter().map(|choice| &choice.type1.type2) { + if let cddl::ast::Type2::TextValue { value, .. } = type2 { + write!(self.stdout, "\"{}\":\"{}\",", value, value); } } + write!(self.stdout, "}}>"); } else { write!(self.stdout, "z.enum(["); for type2 in t.type_choices.iter().map(|choice| &choice.type1.type2) { @@ -171,7 +137,7 @@ impl<'a, 'b: 'a, 'c, Stdout: Write, Stderr: Write> Engine { fn visit_array(&mut self, g: &'b cddl::ast::Group<'a>) -> cddl::visitor::Result { if g.group_choices.len() != 1 { if self.is_type_mode { - self.write_zod_union_type_start(); + write!(self.stdout, "z.ZodUnion Engine { } if upper < MAX_ARRAYS { if self.is_type_mode { - self.write_zod_union_type_start(); + write!(self.stdout, "z.ZodUnion Engine { } else if self.is_type_mode { write!(self.stdout, "z.ZodArray<"); self.visit_type(&entry.entry_type)?; - if lower == 1 && self.version == Version::V3 { - write!(self.stdout, ", \"atleastone\""); - } write!(self.stdout, ">"); } else { write!(self.stdout, "z.array("); @@ -631,7 +594,7 @@ impl<'a, 'b: 'a, Stdout: Write, Stderr: Write> Visitor<'a, 'b, Error> for Engine } if t.type_choices.len() != 1 { if self.is_type_mode { - self.write_zod_union_type_start(); + write!(self.stdout, "z.ZodUnion Visitor<'a, 'b, Error> for Engine self.print_group_joiner(); if matches!(calculate_occurrence(&ge.occur), (0, max) if max > 0) { if self.is_type_mode { - self.write_zod_union_type_start(); + write!(self.stdout, "z.ZodUnion]>"); } else { @@ -738,7 +701,7 @@ impl<'a, 'b: 'a, Stdout: Write, Stderr: Write> Visitor<'a, 'b, Error> for Engine self.print_group_joiner(); if matches!(calculate_occurrence(&occur), (0, max) if max > 0) { if self.is_type_mode { - self.write_zod_union_type_start(); + write!(self.stdout, "z.ZodUnion]>"); } else { @@ -789,7 +752,7 @@ impl<'a, 'b: 'a, Stdout: Write, Stderr: Write> Visitor<'a, 'b, Error> for Engine fn visit_group(&mut self, g: &'b cddl::ast::Group<'a>) -> cddl::visitor::Result { if g.group_choices.len() != 1 { if self.is_type_mode { - self.write_zod_union_type_start(); + write!(self.stdout, "z.ZodUnion Result<()> { engine.visit_cddl(&cddl)?; engine.print_postamble(); } - EngineType::Zod4 => { - let mut engine = cddlconv::engines::zod::Engine::with_writers_and_version( - std::io::stdout(), - std::io::stderr(), - cddlconv::engines::zod::Version::V4, - ); - engine.print_preamble(); - engine.visit_cddl(&cddl)?; - engine.print_postamble(); - } }; Ok(()) diff --git a/tests/snapshots/zod4__it_works-2.snap b/tests/snapshots/zod4__it_works-2.snap deleted file mode 100644 index 5c032f7..0000000 --- a/tests/snapshots/zod4__it_works-2.snap +++ /dev/null @@ -1,1412 +0,0 @@ ---- -source: tests/zod4.rs -expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" ---- -export const CommandSchema: z.ZodLazy,typeof CommandDataSchema>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ -"id":JsUintSchema}).and( -CommandDataSchema) -.and( -ExtensibleSchema) -); -export const -CommandDataSchema: z.ZodLazy> = z.lazy(() => z.union([BrowserCommandSchema,BrowsingContextCommandSchema,InputCommandSchema,NetworkCommandSchema,ScriptCommandSchema,SessionCommandSchema])); -export const EmptyParamsSchema: z.ZodLazy = z.lazy(() => ExtensibleSchema); -export const MessageSchema: z.ZodLazy> = z.lazy(() => z.union([CommandResponseSchema,ErrorResponseSchema,EventSchema])); -export const CommandResponseSchema: z.ZodLazy,"id":typeof JsUintSchema,"result":typeof ResultDataSchema}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ -"type":z.literal("success"),"id":JsUintSchema,"result":ResultDataSchema}).and( -ExtensibleSchema) -); -export const ErrorResponseSchema: z.ZodLazy,"id":z.ZodUnion,"error":typeof ErrorCodeSchema,"message":z.ZodString,"stacktrace":z.ZodOptional}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ -"type":z.literal("error"),"id":z.union([JsUintSchema,z.null()]),"error":ErrorCodeSchema,"message":z.string(),"stacktrace":z.string().optional()}).and( -ExtensibleSchema) -); -export const ResultDataSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContextResultSchema,EmptyResultSchema,NetworkResultSchema,ScriptResultSchema,SessionResultSchema])); -export const EmptyResultSchema: z.ZodLazy = z.lazy(() => ExtensibleSchema); -export const EventSchema: z.ZodLazy}>,typeof EventDataSchema>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ -"type":z.literal("event")}).and( -EventDataSchema) -.and( -ExtensibleSchema) -); -export const -EventDataSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContextEventSchema,LogEventSchema,NetworkEventSchema,ScriptEventSchema])); -export const -ExtensibleSchema: z.ZodLazy> = z.lazy(() => z.record( -z.string(),z.any())); -export const JsIntSchema: z.ZodNumber = z.number().int().gte(-9007199254740991).lte(9007199254740991); -export const JsUintSchema: z.ZodNumber = z.number().int().nonnegative().gte(0).lte(9007199254740991); -export const ErrorCodeSchema: z.ZodLazy> = z.lazy(() => z.enum(["invalid argument","invalid session id","move target out of bounds","no such alert","no such element","no such frame","no such handle","no such history entry","no such intercept","no such node","no such request","no such script","session not created","unable to capture screen","unable to close browser","unknown command","unknown error","unsupported operation",])); -export const -SessionCommandSchema: z.ZodLazy> = z.lazy(() => z.union([Session.EndSchema,Session.NewSchema,Session.StatusSchema,Session.SubscribeSchema,Session.UnsubscribeSchema])); -export const SessionResultSchema: z.ZodLazy> = z.lazy(() => z.union([Session.NewResultSchema,Session.StatusResultSchema])); -export namespace Session { -export const CapabilitiesRequestSchema: z.ZodLazy,"firstMatch":z.ZodOptional>}>> = z.lazy(() => z.object({ -"alwaysMatch":Session.CapabilityRequestSchema.optional(),"firstMatch":z.array(Session.CapabilityRequestSchema).optional()})); -} -export namespace Session { -export const CapabilityRequestSchema: z.ZodLazy,"browserName":z.ZodOptional,"browserVersion":z.ZodOptional,"platformName":z.ZodOptional,"proxy":z.ZodOptional,"webSocketUrl":z.ZodOptional}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ -"acceptInsecureCerts":z.boolean().optional(),"browserName":z.string().optional(),"browserVersion":z.string().optional(),"platformName":z.string().optional(),"proxy":Session.ProxyConfigurationSchema.optional(),"webSocketUrl":z.boolean().optional()}).and( -ExtensibleSchema) -); -} -export namespace Session { -export const ProxyConfigurationSchema: z.ZodLazy]>> = z.lazy(() => z.union([Session.AutodetectProxyConfigurationSchema,Session.DirectProxyConfigurationSchema,Session.ManualProxyConfigurationSchema,Session.PacProxyConfigurationSchema,Session.SystemProxyConfigurationSchema,z.object({ -})])); -} -export namespace Session { -export const -AutodetectProxyConfigurationSchema: z.ZodLazy}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ -"proxyType":z.literal("autodetect")}).and( -ExtensibleSchema) -); -} -export namespace Session { -export const -DirectProxyConfigurationSchema: z.ZodLazy}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ -"proxyType":z.literal("direct")}).and( -ExtensibleSchema) -); -} -export namespace Session { -export const -ManualProxyConfigurationSchema: z.ZodLazy,"ftpProxy":z.ZodOptional,"httpProxy":z.ZodOptional,"sslProxy":z.ZodOptional}>,z.ZodUnion]>>,z.ZodObject<{ -"noProxy":z.ZodOptional>}>>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ -"proxyType":z.literal("manual"),"ftpProxy":z.string().optional(),"httpProxy":z.string().optional(),"sslProxy":z.string().optional()}).and( -Session.SocksProxyConfigurationSchema.or(z.object({}))) -.and( -z.object({ -"noProxy":z.array(z.string()).optional()})) -.and( -ExtensibleSchema) -); -} -export namespace Session { -export const -SocksProxyConfigurationSchema: z.ZodLazy> = z.lazy(() => z.object({ -"socksProxy":z.string(),"socksVersion":z.number().int().nonnegative().gte(0).lte(255)})); -} -export namespace Session { -export const -PacProxyConfigurationSchema: z.ZodLazy,"proxyAutoconfigUrl":z.ZodString}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ -"proxyType":z.literal("pac"),"proxyAutoconfigUrl":z.string()}).and( -ExtensibleSchema) -); -} -export namespace Session { -export const -SystemProxyConfigurationSchema: z.ZodLazy}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ -"proxyType":z.literal("system")}).and( -ExtensibleSchema) -); -} -export namespace Session { -export const SubscriptionRequestSchema: z.ZodLazy,"contexts":z.ZodOptional>}>> = z.lazy(() => z.object({ -"events":z.array(z.string()),"contexts":z.array(BrowsingContext.BrowsingContextSchema).optional()})); -} -export namespace Session { -export const -StatusSchema: z.ZodLazy,"params":typeof EmptyParamsSchema}>> = z.lazy(() => z.object({ -"method":z.literal("session.status"),"params":EmptyParamsSchema})); -} -export namespace Session { -export const StatusResultSchema: z.ZodLazy> = z.lazy(() => z.object({ -"ready":z.boolean(),"message":z.string()})); -} -export namespace Session { -export const -NewSchema: z.ZodLazy,"params":typeof Session.NewParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("session.new"),"params":Session.NewParametersSchema})); -} -export namespace Session { -export const NewParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ -"capabilities":Session.CapabilitiesRequestSchema})); -} -export namespace Session { -export const NewResultSchema: z.ZodLazy,"webSocketUrl":z.ZodOptional}>,typeof ExtensibleSchema>}>> = z.lazy(() => z.object({ -"sessionId":z.string(),"capabilities":z.object({ -"acceptInsecureCerts":z.boolean(),"browserName":z.string(),"browserVersion":z.string(),"platformName":z.string(),"setWindowRect":z.boolean(),"proxy":Session.ProxyConfigurationSchema.optional(),"webSocketUrl":z.boolean().optional()}).and( -ExtensibleSchema) -})); -} -export namespace Session { -export const -EndSchema: z.ZodLazy,"params":typeof EmptyParamsSchema}>> = z.lazy(() => z.object({ -"method":z.literal("session.end"),"params":EmptyParamsSchema})); -} -export namespace Session { -export const -SubscribeSchema: z.ZodLazy,"params":typeof Session.SubscriptionRequestSchema}>> = z.lazy(() => z.object({ -"method":z.literal("session.subscribe"),"params":Session.SubscriptionRequestSchema})); -} -export namespace Session { -export const -UnsubscribeSchema: z.ZodLazy,"params":typeof Session.SubscriptionRequestSchema}>> = z.lazy(() => z.object({ -"method":z.literal("session.unsubscribe"),"params":Session.SubscriptionRequestSchema})); -} -export const -BrowserCommandSchema: z.ZodLazy = z.lazy(() => Browser.CloseSchema); -export namespace Browser { -export const -CloseSchema: z.ZodLazy,"params":typeof EmptyParamsSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browser.close"),"params":EmptyParamsSchema})); -} -export const -BrowsingContextCommandSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.ActivateSchema,BrowsingContext.CaptureScreenshotSchema,BrowsingContext.CloseSchema,BrowsingContext.CreateSchema,BrowsingContext.GetTreeSchema,BrowsingContext.HandleUserPromptSchema,BrowsingContext.LocateNodesSchema,BrowsingContext.NavigateSchema,BrowsingContext.PrintSchema,BrowsingContext.ReloadSchema,BrowsingContext.SetViewportSchema,BrowsingContext.TraverseHistorySchema])); -export const BrowsingContextResultSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.CaptureScreenshotResultSchema,BrowsingContext.CreateResultSchema,BrowsingContext.GetTreeResultSchema,BrowsingContext.LocateNodesResultSchema,BrowsingContext.NavigateResultSchema,BrowsingContext.PrintResultSchema,BrowsingContext.TraverseHistoryResultSchema])); -export const -BrowsingContextEventSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.ContextCreatedSchema,BrowsingContext.ContextDestroyedSchema,BrowsingContext.DomContentLoadedSchema,BrowsingContext.DownloadWillBeginSchema,BrowsingContext.FragmentNavigatedSchema,BrowsingContext.LoadSchema,BrowsingContext.NavigationAbortedSchema,BrowsingContext.NavigationFailedSchema,BrowsingContext.NavigationStartedSchema,BrowsingContext.UserPromptClosedSchema,BrowsingContext.UserPromptOpenedSchema])); -export namespace BrowsingContext { -export const BrowsingContextSchema: z.ZodLazy = z.lazy(() => z.string()); -} -export namespace BrowsingContext { -export const InfoListSchema: z.ZodType = z.lazy(() => z.array(BrowsingContext.InfoSchema)); -} -export namespace BrowsingContext { -export const InfoSchema: z.ZodLazy,"parent":z.ZodOptional>}>> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema,"url":z.string(),"children":z.union([BrowsingContext.InfoListSchema,z.null()]),"parent":z.union([BrowsingContext.BrowsingContextSchema,z.null()]).optional()})); -} -export namespace BrowsingContext { -export const LocatorSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.CssLocatorSchema,BrowsingContext.InnerTextLocatorSchema,BrowsingContext.XPathLocatorSchema])); -} -export namespace BrowsingContext { -export const CssLocatorSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ -"type":z.literal("css"),"value":z.string()})); -} -export namespace BrowsingContext { -export const InnerTextLocatorSchema: z.ZodLazy,"value":z.ZodString,"ignoreCase":z.ZodOptional,"matchType":z.ZodOptional>,"maxDepth":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("innerText"),"value":z.string(),"ignoreCase":z.boolean().optional(),"matchType":z.enum(["full","partial",]).optional(),"maxDepth":JsUintSchema.optional()})); -} -export namespace BrowsingContext { -export const XPathLocatorSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ -"type":z.literal("xpath"),"value":z.string()})); -} -export namespace BrowsingContext { -export const NavigationSchema: z.ZodLazy = z.lazy(() => z.string()); -} -export namespace BrowsingContext { -export const NavigationInfoSchema: z.ZodLazy,"timestamp":typeof JsUintSchema,"url":z.ZodString}>> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema,"navigation":z.union([BrowsingContext.NavigationSchema,z.null()]),"timestamp":JsUintSchema,"url":z.string()})); -} -export namespace BrowsingContext { -export const ReadinessStateSchema: z.ZodLazy> = z.lazy(() => z.enum(["none","interactive","complete",])); -} -export namespace BrowsingContext { -export const -ActivateSchema: z.ZodLazy,"params":typeof BrowsingContext.ActivateParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.activate"),"params":BrowsingContext.ActivateParametersSchema})); -} -export namespace BrowsingContext { -export const ActivateParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema})); -} -export namespace BrowsingContext { -export const -CaptureScreenshotSchema: z.ZodLazy,"params":typeof BrowsingContext.CaptureScreenshotParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.captureScreenshot"),"params":BrowsingContext.CaptureScreenshotParametersSchema})); -} -export namespace BrowsingContext { -export const CaptureScreenshotParametersSchema: z.ZodLazy>>,"format":z.ZodOptional,"clip":z.ZodOptional}>> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema,"origin":z.enum(["viewport","document",]).default("viewport").optional(),"format":BrowsingContext.ImageFormatSchema.optional(),"clip":BrowsingContext.ClipRectangleSchema.optional()})); -} -export namespace BrowsingContext { -export const ImageFormatSchema: z.ZodLazy}>> = z.lazy(() => z.object({ -"type":z.string(),"quality":z.number().gte(0).lte(1).optional()})); -} -export namespace BrowsingContext { -export const ClipRectangleSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.BoxClipRectangleSchema,BrowsingContext.ElementClipRectangleSchema])); -} -export namespace BrowsingContext { -export const ElementClipRectangleSchema: z.ZodLazy,"element":typeof Script.SharedReferenceSchema}>> = z.lazy(() => z.object({ -"type":z.literal("element"),"element":Script.SharedReferenceSchema})); -} -export namespace BrowsingContext { -export const BoxClipRectangleSchema: z.ZodLazy,"x":z.ZodNumber,"y":z.ZodNumber,"width":z.ZodNumber,"height":z.ZodNumber}>> = z.lazy(() => z.object({ -"type":z.literal("box"),"x":z.number(),"y":z.number(),"width":z.number(),"height":z.number()})); -} -export namespace BrowsingContext { -export const CaptureScreenshotResultSchema: z.ZodLazy> = z.lazy(() => z.object({ -"data":z.string()})); -} -export namespace BrowsingContext { -export const -CloseSchema: z.ZodLazy,"params":typeof BrowsingContext.CloseParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.close"),"params":BrowsingContext.CloseParametersSchema})); -} -export namespace BrowsingContext { -export const CloseParametersSchema: z.ZodLazy>}>> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema,"promptUnload":z.boolean().default(false).optional()})); -} -export namespace BrowsingContext { -export const -CreateSchema: z.ZodLazy,"params":typeof BrowsingContext.CreateParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.create"),"params":BrowsingContext.CreateParametersSchema})); -} -export namespace BrowsingContext { -export const CreateTypeSchema: z.ZodLazy> = z.lazy(() => z.enum(["tab","window",])); -} -export namespace BrowsingContext { -export const CreateParametersSchema: z.ZodLazy,"background":z.ZodOptional>}>> = z.lazy(() => z.object({ -"type":BrowsingContext.CreateTypeSchema,"referenceContext":BrowsingContext.BrowsingContextSchema.optional(),"background":z.boolean().default(false).optional()})); -} -export namespace BrowsingContext { -export const CreateResultSchema: z.ZodLazy> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema})); -} -export namespace BrowsingContext { -export const -GetTreeSchema: z.ZodLazy,"params":typeof BrowsingContext.GetTreeParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.getTree"),"params":BrowsingContext.GetTreeParametersSchema})); -} -export namespace BrowsingContext { -export const GetTreeParametersSchema: z.ZodLazy,"root":z.ZodOptional}>> = z.lazy(() => z.object({ -"maxDepth":JsUintSchema.optional(),"root":BrowsingContext.BrowsingContextSchema.optional()})); -} -export namespace BrowsingContext { -export const GetTreeResultSchema: z.ZodLazy> = z.lazy(() => z.object({ -"contexts":BrowsingContext.InfoListSchema})); -} -export namespace BrowsingContext { -export const -HandleUserPromptSchema: z.ZodLazy,"params":typeof BrowsingContext.HandleUserPromptParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.handleUserPrompt"),"params":BrowsingContext.HandleUserPromptParametersSchema})); -} -export namespace BrowsingContext { -export const HandleUserPromptParametersSchema: z.ZodLazy,"userText":z.ZodOptional}>> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema,"accept":z.boolean().optional(),"userText":z.string().optional()})); -} -export namespace BrowsingContext { -export const -LocateNodesSchema: z.ZodLazy,"params":typeof BrowsingContext.LocateNodesParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.locateNodes"),"params":BrowsingContext.LocateNodesParametersSchema})); -} -export namespace BrowsingContext { -export const LocateNodesParametersSchema: z.ZodLazy,"ownership":z.ZodOptional,"sandbox":z.ZodOptional,"serializationOptions":z.ZodOptional,"startNodes":z.ZodOptional>}>> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema,"locator":BrowsingContext.LocatorSchema,"maxNodeCount":JsUintSchema.gte(1).optional(),"ownership":Script.ResultOwnershipSchema.optional(),"sandbox":z.string().optional(),"serializationOptions":Script.SerializationOptionsSchema.optional(),"startNodes":z.array(Script.SharedReferenceSchema).nonempty().optional()})); -} -export namespace BrowsingContext { -export const LocateNodesResultSchema: z.ZodLazy}>> = z.lazy(() => z.object({ -"nodes":z.array(Script.NodeRemoteValueSchema)})); -} -export namespace BrowsingContext { -export const -NavigateSchema: z.ZodLazy,"params":typeof BrowsingContext.NavigateParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.navigate"),"params":BrowsingContext.NavigateParametersSchema})); -} -export namespace BrowsingContext { -export const NavigateParametersSchema: z.ZodLazy}>> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema,"url":z.string(),"wait":BrowsingContext.ReadinessStateSchema.optional()})); -} -export namespace BrowsingContext { -export const NavigateResultSchema: z.ZodLazy,"url":z.ZodString}>> = z.lazy(() => z.object({ -"navigation":z.union([BrowsingContext.NavigationSchema,z.null()]),"url":z.string()})); -} -export namespace BrowsingContext { -export const -PrintSchema: z.ZodLazy,"params":typeof BrowsingContext.PrintParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.print"),"params":BrowsingContext.PrintParametersSchema})); -} -export namespace BrowsingContext { -export const PrintParametersSchema: z.ZodLazy>,"margin":z.ZodOptional,"orientation":z.ZodOptional>>,"page":z.ZodOptional,"pageRanges":z.ZodOptional>>,"scale":z.ZodOptional>,"shrinkToFit":z.ZodOptional>}>> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema,"background":z.boolean().default(false).optional(),"margin":BrowsingContext.PrintMarginParametersSchema.optional(),"orientation":z.enum(["portrait","landscape",]).default("portrait").optional(),"page":BrowsingContext.PrintPageParametersSchema.optional(),"pageRanges":z.array(z.union([JsUintSchema,z.string()])).optional(),"scale":z.number().gte(0.1).lte(2).default(1).optional(),"shrinkToFit":z.boolean().default(true).optional()})); -} -export namespace BrowsingContext { -export const PrintMarginParametersSchema: z.ZodLazy>,"left":z.ZodOptional>,"right":z.ZodOptional>,"top":z.ZodOptional>}>> = z.lazy(() => z.object({ -"bottom":z.number().gte(0).default(1).optional(),"left":z.number().gte(0).default(1).optional(),"right":z.number().gte(0).default(1).optional(),"top":z.number().gte(0).default(1).optional()})); -} -export namespace BrowsingContext { -export const PrintPageParametersSchema: z.ZodLazy>,"width":z.ZodOptional>}>> = z.lazy(() => z.object({ -"height":z.number().gte(0.0352).default(27.94).optional(),"width":z.number().gte(0.0352).default(21.59).optional()})); -} -export namespace BrowsingContext { -export const PrintResultSchema: z.ZodLazy> = z.lazy(() => z.object({ -"data":z.string()})); -} -export namespace BrowsingContext { -export const -ReloadSchema: z.ZodLazy,"params":typeof BrowsingContext.ReloadParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.reload"),"params":BrowsingContext.ReloadParametersSchema})); -} -export namespace BrowsingContext { -export const ReloadParametersSchema: z.ZodLazy,"wait":z.ZodOptional}>> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema,"ignoreCache":z.boolean().optional(),"wait":BrowsingContext.ReadinessStateSchema.optional()})); -} -export namespace BrowsingContext { -export const -SetViewportSchema: z.ZodLazy,"params":typeof BrowsingContext.SetViewportParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.setViewport"),"params":BrowsingContext.SetViewportParametersSchema})); -} -export namespace BrowsingContext { -export const SetViewportParametersSchema: z.ZodLazy>,"devicePixelRatio":z.ZodOptional>}>> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema,"viewport":z.union([BrowsingContext.ViewportSchema,z.null()]).optional(),"devicePixelRatio":z.union([z.number().gt(0),z.null()]).optional()})); -} -export namespace BrowsingContext { -export const ViewportSchema: z.ZodLazy> = z.lazy(() => z.object({ -"width":JsUintSchema,"height":JsUintSchema})); -} -export namespace BrowsingContext { -export const -TraverseHistorySchema: z.ZodLazy,"params":typeof BrowsingContext.TraverseHistoryParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.traverseHistory"),"params":BrowsingContext.TraverseHistoryParametersSchema})); -} -export namespace BrowsingContext { -export const TraverseHistoryParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema,"delta":JsIntSchema})); -} -export namespace BrowsingContext { -export const TraverseHistoryResultSchema: z.ZodLazy> = z.lazy(() => z.object({ -})); -} -export namespace BrowsingContext { -export const -ContextCreatedSchema: z.ZodLazy,"params":typeof BrowsingContext.InfoSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.contextCreated"),"params":BrowsingContext.InfoSchema})); -} -export namespace BrowsingContext { -export const -ContextDestroyedSchema: z.ZodLazy,"params":typeof BrowsingContext.InfoSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.contextDestroyed"),"params":BrowsingContext.InfoSchema})); -} -export namespace BrowsingContext { -export const -NavigationStartedSchema: z.ZodLazy,"params":typeof BrowsingContext.NavigationInfoSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.navigationStarted"),"params":BrowsingContext.NavigationInfoSchema})); -} -export namespace BrowsingContext { -export const -FragmentNavigatedSchema: z.ZodLazy,"params":typeof BrowsingContext.NavigationInfoSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.fragmentNavigated"),"params":BrowsingContext.NavigationInfoSchema})); -} -export namespace BrowsingContext { -export const -DomContentLoadedSchema: z.ZodLazy,"params":typeof BrowsingContext.NavigationInfoSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.domContentLoaded"),"params":BrowsingContext.NavigationInfoSchema})); -} -export namespace BrowsingContext { -export const -LoadSchema: z.ZodLazy,"params":typeof BrowsingContext.NavigationInfoSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.load"),"params":BrowsingContext.NavigationInfoSchema})); -} -export namespace BrowsingContext { -export const -DownloadWillBeginSchema: z.ZodLazy,"params":typeof BrowsingContext.NavigationInfoSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.downloadWillBegin"),"params":BrowsingContext.NavigationInfoSchema})); -} -export namespace BrowsingContext { -export const -NavigationAbortedSchema: z.ZodLazy,"params":typeof BrowsingContext.NavigationInfoSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.navigationAborted"),"params":BrowsingContext.NavigationInfoSchema})); -} -export namespace BrowsingContext { -export const -NavigationFailedSchema: z.ZodLazy,"params":typeof BrowsingContext.NavigationInfoSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.navigationFailed"),"params":BrowsingContext.NavigationInfoSchema})); -} -export namespace BrowsingContext { -export const -UserPromptClosedSchema: z.ZodLazy,"params":typeof BrowsingContext.UserPromptClosedParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.userPromptClosed"),"params":BrowsingContext.UserPromptClosedParametersSchema})); -} -export namespace BrowsingContext { -export const UserPromptClosedParametersSchema: z.ZodLazy}>> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema,"accepted":z.boolean(),"userText":z.string().optional()})); -} -export namespace BrowsingContext { -export const -UserPromptOpenedSchema: z.ZodLazy,"params":typeof BrowsingContext.UserPromptOpenedParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("browsingContext.userPromptOpened"),"params":BrowsingContext.UserPromptOpenedParametersSchema})); -} -export namespace BrowsingContext { -export const UserPromptOpenedParametersSchema: z.ZodLazy,"message":z.ZodString,"defaultValue":z.ZodOptional}>> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema,"type":z.enum(["alert","confirm","prompt","beforeunload",]),"message":z.string(),"defaultValue":z.string().optional()})); -} -export const -NetworkCommandSchema: z.ZodLazy> = z.lazy(() => z.union([Network.AddInterceptSchema,Network.ContinueRequestSchema,Network.ContinueResponseSchema,Network.ContinueWithAuthSchema,Network.FailRequestSchema,Network.ProvideResponseSchema,Network.RemoveInterceptSchema])); -export const -NetworkResultSchema: z.ZodLazy = z.lazy(() => Network.AddInterceptResultSchema); -export const -NetworkEventSchema: z.ZodLazy> = z.lazy(() => z.union([Network.AuthRequiredSchema,Network.BeforeRequestSentSchema,Network.FetchErrorSchema,Network.ResponseCompletedSchema,Network.ResponseStartedSchema])); -export namespace Network { -export const AuthChallengeSchema: z.ZodLazy> = z.lazy(() => z.object({ -"scheme":z.string(),"realm":z.string()})); -} -export namespace Network { -export const AuthCredentialsSchema: z.ZodLazy,"username":z.ZodString,"password":z.ZodString}>> = z.lazy(() => z.object({ -"type":z.literal("password"),"username":z.string(),"password":z.string()})); -} -export namespace Network { -export const -BaseParametersSchema: z.ZodLazy,"isBlocked":z.ZodBoolean,"navigation":z.ZodUnion,"redirectCount":typeof JsUintSchema,"request":typeof Network.RequestDataSchema,"timestamp":typeof JsUintSchema,"intercepts":z.ZodOptional>}>> = z.lazy(() => z.object({ -"context":z.union([BrowsingContext.BrowsingContextSchema,z.null()]),"isBlocked":z.boolean(),"navigation":z.union([BrowsingContext.NavigationSchema,z.null()]),"redirectCount":JsUintSchema,"request":Network.RequestDataSchema,"timestamp":JsUintSchema,"intercepts":z.array(Network.InterceptSchema).nonempty().optional()})); -} -export namespace Network { -export const BytesValueSchema: z.ZodLazy> = z.lazy(() => z.union([Network.StringValueSchema,Network.Base64ValueSchema])); -} -export namespace Network { -export const StringValueSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ -"type":z.literal("string"),"value":z.string()})); -} -export namespace Network { -export const Base64ValueSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ -"type":z.literal("base64"),"value":z.string()})); -} -export namespace Network { -export const CookieSchema: z.ZodLazy,"expires":z.ZodOptional}>> = z.lazy(() => z.object({ -"name":z.string(),"value":Network.BytesValueSchema,"domain":z.string(),"path":z.string(),"size":JsUintSchema,"httpOnly":z.boolean(),"secure":z.boolean(),"sameSite":z.enum(["strict","lax","none",]),"expires":JsUintSchema.optional()})); -} -export namespace Network { -export const CookieHeaderSchema: z.ZodLazy> = z.lazy(() => z.object({ -"name":z.string(),"value":Network.BytesValueSchema})); -} -export namespace Network { -export const FetchTimingInfoSchema: z.ZodLazy> = z.lazy(() => z.object({ -"timeOrigin":z.number(),"requestTime":z.number(),"redirectStart":z.number(),"redirectEnd":z.number(),"fetchStart":z.number(),"dnsStart":z.number(),"dnsEnd":z.number(),"connectStart":z.number(),"connectEnd":z.number(),"tlsStart":z.number(),"requestStart":z.number(),"responseStart":z.number(),"responseEnd":z.number()})); -} -export namespace Network { -export const HeaderSchema: z.ZodLazy> = z.lazy(() => z.object({ -"name":z.string(),"value":Network.BytesValueSchema})); -} -export namespace Network { -export const InitiatorSchema: z.ZodLazy,"columnNumber":z.ZodOptional,"lineNumber":z.ZodOptional,"stackTrace":z.ZodOptional,"request":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.enum(["parser","script","preflight","other",]),"columnNumber":JsUintSchema.optional(),"lineNumber":JsUintSchema.optional(),"stackTrace":Script.StackTraceSchema.optional(),"request":Network.RequestSchema.optional()})); -} -export namespace Network { -export const InterceptSchema: z.ZodLazy = z.lazy(() => z.string()); -} -export namespace Network { -export const RequestSchema: z.ZodLazy = z.lazy(() => z.string()); -} -export namespace Network { -export const RequestDataSchema: z.ZodLazy,"cookies":z.ZodArray,"headersSize":typeof JsUintSchema,"bodySize":z.ZodUnion,"timings":typeof Network.FetchTimingInfoSchema}>> = z.lazy(() => z.object({ -"request":Network.RequestSchema,"url":z.string(),"method":z.string(),"headers":z.array(Network.HeaderSchema),"cookies":z.array(Network.CookieSchema),"headersSize":JsUintSchema,"bodySize":z.union([JsUintSchema,z.null()]),"timings":Network.FetchTimingInfoSchema})); -} -export namespace Network { -export const ResponseContentSchema: z.ZodLazy> = z.lazy(() => z.object({ -"size":JsUintSchema})); -} -export namespace Network { -export const ResponseDataSchema: z.ZodLazy,"mimeType":z.ZodString,"bytesReceived":typeof JsUintSchema,"headersSize":z.ZodUnion,"bodySize":z.ZodUnion,"content":typeof Network.ResponseContentSchema,"authChallenge":z.ZodOptional}>> = z.lazy(() => z.object({ -"url":z.string(),"protocol":z.string(),"status":JsUintSchema,"statusText":z.string(),"fromCache":z.boolean(),"headers":z.array(Network.HeaderSchema),"mimeType":z.string(),"bytesReceived":JsUintSchema,"headersSize":z.union([JsUintSchema,z.null()]),"bodySize":z.union([JsUintSchema,z.null()]),"content":Network.ResponseContentSchema,"authChallenge":Network.AuthChallengeSchema.optional()})); -} -export namespace Network { -export const SetCookieHeaderSchema: z.ZodLazy,"httpOnly":z.ZodOptional,"expires":z.ZodOptional,"maxAge":z.ZodOptional,"path":z.ZodOptional,"sameSite":z.ZodOptional>,"secure":z.ZodOptional}>> = z.lazy(() => z.object({ -"name":z.string(),"value":Network.BytesValueSchema,"domain":z.string().optional(),"httpOnly":z.boolean().optional(),"expires":z.string().optional(),"maxAge":JsIntSchema.optional(),"path":z.string().optional(),"sameSite":z.enum(["strict","lax","none",]).optional(),"secure":z.boolean().optional()})); -} -export namespace Network { -export const UrlPatternSchema: z.ZodLazy> = z.lazy(() => z.union([Network.UrlPatternPatternSchema,Network.UrlPatternStringSchema])); -} -export namespace Network { -export const UrlPatternPatternSchema: z.ZodLazy,"protocol":z.ZodOptional,"hostname":z.ZodOptional,"port":z.ZodOptional,"pathname":z.ZodOptional,"search":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("pattern"),"protocol":z.string().optional(),"hostname":z.string().optional(),"port":z.string().optional(),"pathname":z.string().optional(),"search":z.string().optional()})); -} -export namespace Network { -export const UrlPatternStringSchema: z.ZodLazy,"pattern":z.ZodString}>> = z.lazy(() => z.object({ -"type":z.literal("string"),"pattern":z.string()})); -} -export namespace Network { -export const -AddInterceptSchema: z.ZodLazy,"params":typeof Network.AddInterceptParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("network.addIntercept"),"params":Network.AddInterceptParametersSchema})); -} -export namespace Network { -export const AddInterceptParametersSchema: z.ZodLazy,"urlPatterns":z.ZodOptional>}>> = z.lazy(() => z.object({ -"phases":z.array(Network.InterceptPhaseSchema).nonempty(),"urlPatterns":z.array(Network.UrlPatternSchema).optional()})); -} -export namespace Network { -export const InterceptPhaseSchema: z.ZodLazy> = z.lazy(() => z.enum(["beforeRequestSent","responseStarted","authRequired",])); -} -export namespace Network { -export const AddInterceptResultSchema: z.ZodLazy> = z.lazy(() => z.object({ -"intercept":Network.InterceptSchema})); -} -export namespace Network { -export const -ContinueRequestSchema: z.ZodLazy,"params":typeof Network.ContinueRequestParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("network.continueRequest"),"params":Network.ContinueRequestParametersSchema})); -} -export namespace Network { -export const ContinueRequestParametersSchema: z.ZodLazy,"cookies":z.ZodOptional>,"headers":z.ZodOptional>,"method":z.ZodOptional,"url":z.ZodOptional}>> = z.lazy(() => z.object({ -"request":Network.RequestSchema,"body":Network.BytesValueSchema.optional(),"cookies":z.array(Network.CookieHeaderSchema).optional(),"headers":z.array(Network.HeaderSchema).optional(),"method":z.string().optional(),"url":z.string().optional()})); -} -export namespace Network { -export const -ContinueResponseSchema: z.ZodLazy,"params":typeof Network.ContinueResponseParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("network.continueResponse"),"params":Network.ContinueResponseParametersSchema})); -} -export namespace Network { -export const ContinueResponseParametersSchema: z.ZodLazy>,"credentials":z.ZodOptional,"headers":z.ZodOptional>,"reasonPhrase":z.ZodOptional,"statusCode":z.ZodOptional}>> = z.lazy(() => z.object({ -"request":Network.RequestSchema,"cookies":z.array(Network.SetCookieHeaderSchema).optional(),"credentials":Network.AuthCredentialsSchema.optional(),"headers":z.array(Network.HeaderSchema).optional(),"reasonPhrase":z.string().optional(),"statusCode":JsUintSchema.optional()})); -} -export namespace Network { -export const -ContinueWithAuthSchema: z.ZodLazy,"params":typeof Network.ContinueWithAuthParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("network.continueWithAuth"),"params":Network.ContinueWithAuthParametersSchema})); -} -export namespace Network { -export const ContinueWithAuthParametersSchema: z.ZodLazy,z.ZodUnion>> = z.lazy(() => z.object({ -"request":Network.RequestSchema}).and( -z.union([Network.ContinueWithAuthCredentialsSchema,Network.ContinueWithAuthNoCredentialsSchema])) -); -} -export namespace Network { -export const -ContinueWithAuthCredentialsSchema: z.ZodLazy,"credentials":typeof Network.AuthCredentialsSchema}>> = z.lazy(() => z.object({ -"action":z.literal("provideCredentials"),"credentials":Network.AuthCredentialsSchema})); -} -export namespace Network { -export const -ContinueWithAuthNoCredentialsSchema: z.ZodLazy}>> = z.lazy(() => z.object({ -"action":z.enum(["default","cancel",])})); -} -export namespace Network { -export const -FailRequestSchema: z.ZodLazy,"params":typeof Network.FailRequestParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("network.failRequest"),"params":Network.FailRequestParametersSchema})); -} -export namespace Network { -export const FailRequestParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ -"request":Network.RequestSchema})); -} -export namespace Network { -export const -ProvideResponseSchema: z.ZodLazy,"params":typeof Network.ProvideResponseParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("network.provideResponse"),"params":Network.ProvideResponseParametersSchema})); -} -export namespace Network { -export const ProvideResponseParametersSchema: z.ZodLazy,"cookies":z.ZodOptional>,"headers":z.ZodOptional>,"reasonPhrase":z.ZodOptional,"statusCode":z.ZodOptional}>> = z.lazy(() => z.object({ -"request":Network.RequestSchema,"body":Network.BytesValueSchema.optional(),"cookies":z.array(Network.SetCookieHeaderSchema).optional(),"headers":z.array(Network.HeaderSchema).optional(),"reasonPhrase":z.string().optional(),"statusCode":JsUintSchema.optional()})); -} -export namespace Network { -export const -RemoveInterceptSchema: z.ZodLazy,"params":typeof Network.RemoveInterceptParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("network.removeIntercept"),"params":Network.RemoveInterceptParametersSchema})); -} -export namespace Network { -export const RemoveInterceptParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ -"intercept":Network.InterceptSchema})); -} -export namespace Network { -export const -AuthRequiredSchema: z.ZodLazy,"params":typeof Network.AuthRequiredParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("network.authRequired"),"params":Network.AuthRequiredParametersSchema})); -} -export namespace Network { -export const AuthRequiredParametersSchema: z.ZodLazy>> = z.lazy(() => Network.BaseParametersSchema.and( -z.object({ -"response":Network.ResponseDataSchema})) -); -} -export namespace Network { -export const -BeforeRequestSentSchema: z.ZodLazy,"params":typeof Network.BeforeRequestSentParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("network.beforeRequestSent"),"params":Network.BeforeRequestSentParametersSchema})); -} -export namespace Network { -export const BeforeRequestSentParametersSchema: z.ZodLazy>> = z.lazy(() => Network.BaseParametersSchema.and( -z.object({ -"initiator":Network.InitiatorSchema})) -); -} -export namespace Network { -export const -FetchErrorSchema: z.ZodLazy,"params":typeof Network.FetchErrorParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("network.fetchError"),"params":Network.FetchErrorParametersSchema})); -} -export namespace Network { -export const FetchErrorParametersSchema: z.ZodLazy>> = z.lazy(() => Network.BaseParametersSchema.and( -z.object({ -"errorText":z.string()})) -); -} -export namespace Network { -export const -ResponseCompletedSchema: z.ZodLazy,"params":typeof Network.ResponseCompletedParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("network.responseCompleted"),"params":Network.ResponseCompletedParametersSchema})); -} -export namespace Network { -export const ResponseCompletedParametersSchema: z.ZodLazy>> = z.lazy(() => Network.BaseParametersSchema.and( -z.object({ -"response":Network.ResponseDataSchema})) -); -} -export namespace Network { -export const -ResponseStartedSchema: z.ZodLazy,"params":typeof Network.ResponseStartedParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("network.responseStarted"),"params":Network.ResponseStartedParametersSchema})); -} -export namespace Network { -export const ResponseStartedParametersSchema: z.ZodLazy>> = z.lazy(() => Network.BaseParametersSchema.and( -z.object({ -"response":Network.ResponseDataSchema})) -); -} -export const -ScriptCommandSchema: z.ZodLazy> = z.lazy(() => z.union([Script.AddPreloadScriptSchema,Script.CallFunctionSchema,Script.DisownSchema,Script.EvaluateSchema,Script.GetRealmsSchema,Script.RemovePreloadScriptSchema])); -export const ScriptResultSchema: z.ZodLazy> = z.lazy(() => z.union([Script.AddPreloadScriptResultSchema,Script.EvaluateResultSchema,Script.GetRealmsResultSchema])); -export const -ScriptEventSchema: z.ZodLazy> = z.lazy(() => z.union([Script.MessageSchema,Script.RealmCreatedSchema,Script.RealmDestroyedSchema])); -export namespace Script { -export const ChannelSchema: z.ZodLazy = z.lazy(() => z.string()); -} -export namespace Script { -export const ChannelValueSchema: z.ZodLazy,"value":typeof Script.ChannelPropertiesSchema}>> = z.lazy(() => z.object({ -"type":z.literal("channel"),"value":Script.ChannelPropertiesSchema})); -} -export namespace Script { -export const ChannelPropertiesSchema: z.ZodLazy,"ownership":z.ZodOptional}>> = z.lazy(() => z.object({ -"channel":Script.ChannelSchema,"serializationOptions":Script.SerializationOptionsSchema.optional(),"ownership":Script.ResultOwnershipSchema.optional()})); -} -export namespace Script { -export const EvaluateResultSchema: z.ZodLazy> = z.lazy(() => z.union([Script.EvaluateResultSuccessSchema,Script.EvaluateResultExceptionSchema])); -} -export namespace Script { -export const EvaluateResultSuccessSchema: z.ZodLazy,"result":typeof Script.RemoteValueSchema,"realm":typeof Script.RealmSchema}>> = z.lazy(() => z.object({ -"type":z.literal("success"),"result":Script.RemoteValueSchema,"realm":Script.RealmSchema})); -} -export namespace Script { -export const EvaluateResultExceptionSchema: z.ZodLazy,"exceptionDetails":typeof Script.ExceptionDetailsSchema,"realm":typeof Script.RealmSchema}>> = z.lazy(() => z.object({ -"type":z.literal("exception"),"exceptionDetails":Script.ExceptionDetailsSchema,"realm":Script.RealmSchema})); -} -export namespace Script { -export const ExceptionDetailsSchema: z.ZodLazy> = z.lazy(() => z.object({ -"columnNumber":JsUintSchema,"exception":Script.RemoteValueSchema,"lineNumber":JsUintSchema,"stackTrace":Script.StackTraceSchema,"text":z.string()})); -} -export namespace Script { -export const HandleSchema: z.ZodLazy = z.lazy(() => z.string()); -} -export namespace Script { -export const InternalIdSchema: z.ZodLazy = z.lazy(() => z.string()); -} -export namespace Script { -export const LocalValueSchema: z.ZodType = z.lazy(() => z.union([Script.RemoteReferenceSchema,Script.PrimitiveProtocolValueSchema,Script.ChannelValueSchema,Script.ArrayLocalValueSchema,Script.DateLocalValueSchema,Script.MapLocalValueSchema,Script.ObjectLocalValueSchema,Script.RegExpLocalValueSchema,Script.SetLocalValueSchema])); -} -export namespace Script { -export const ListLocalValueSchema: z.ZodLazy> = z.lazy(() => z.array(Script.LocalValueSchema)); -} -export namespace Script { -export const ArrayLocalValueSchema: z.ZodLazy,"value":typeof Script.ListLocalValueSchema}>> = z.lazy(() => z.object({ -"type":z.literal("array"),"value":Script.ListLocalValueSchema})); -} -export namespace Script { -export const DateLocalValueSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ -"type":z.literal("date"),"value":z.string()})); -} -export namespace Script { -export const MappingLocalValueSchema: z.ZodLazy,typeof Script.LocalValueSchema], null>>> = z.lazy(() => z.array(z.tuple([ -z.union([Script.LocalValueSchema,z.string()]),Script.LocalValueSchema]))); -} -export namespace Script { -export const MapLocalValueSchema: z.ZodLazy,"value":typeof Script.MappingLocalValueSchema}>> = z.lazy(() => z.object({ -"type":z.literal("map"),"value":Script.MappingLocalValueSchema})); -} -export namespace Script { -export const ObjectLocalValueSchema: z.ZodLazy,"value":typeof Script.MappingLocalValueSchema}>> = z.lazy(() => z.object({ -"type":z.literal("object"),"value":Script.MappingLocalValueSchema})); -} -export namespace Script { -export const RegExpValueSchema: z.ZodLazy}>> = z.lazy(() => z.object({ -"pattern":z.string(),"flags":z.string().optional()})); -} -export namespace Script { -export const RegExpLocalValueSchema: z.ZodLazy,"value":typeof Script.RegExpValueSchema}>> = z.lazy(() => z.object({ -"type":z.literal("regexp"),"value":Script.RegExpValueSchema})); -} -export namespace Script { -export const SetLocalValueSchema: z.ZodLazy,"value":typeof Script.ListLocalValueSchema}>> = z.lazy(() => z.object({ -"type":z.literal("set"),"value":Script.ListLocalValueSchema})); -} -export namespace Script { -export const PreloadScriptSchema: z.ZodLazy = z.lazy(() => z.string()); -} -export namespace Script { -export const RealmSchema: z.ZodLazy = z.lazy(() => z.string()); -} -export namespace Script { -export const PrimitiveProtocolValueSchema: z.ZodLazy> = z.lazy(() => z.union([Script.UndefinedValueSchema,Script.NullValueSchema,Script.StringValueSchema,Script.NumberValueSchema,Script.BooleanValueSchema,Script.BigIntValueSchema])); -} -export namespace Script { -export const UndefinedValueSchema: z.ZodLazy}>> = z.lazy(() => z.object({ -"type":z.literal("undefined")})); -} -export namespace Script { -export const NullValueSchema: z.ZodLazy}>> = z.lazy(() => z.object({ -"type":z.literal("null")})); -} -export namespace Script { -export const StringValueSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ -"type":z.literal("string"),"value":z.string()})); -} -export namespace Script { -export const SpecialNumberSchema: z.ZodLazy> = z.lazy(() => z.enum(["NaN","-0","Infinity","-Infinity",])); -} -export namespace Script { -export const NumberValueSchema: z.ZodLazy,"value":z.ZodUnion}>> = z.lazy(() => z.object({ -"type":z.literal("number"),"value":z.union([z.number(),Script.SpecialNumberSchema])})); -} -export namespace Script { -export const BooleanValueSchema: z.ZodLazy,"value":z.ZodBoolean}>> = z.lazy(() => z.object({ -"type":z.literal("boolean"),"value":z.boolean()})); -} -export namespace Script { -export const BigIntValueSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ -"type":z.literal("bigint"),"value":z.string()})); -} -export namespace Script { -export const RealmInfoSchema: z.ZodLazy> = z.lazy(() => z.union([Script.WindowRealmInfoSchema,Script.DedicatedWorkerRealmInfoSchema,Script.SharedWorkerRealmInfoSchema,Script.ServiceWorkerRealmInfoSchema,Script.WorkerRealmInfoSchema,Script.PaintWorkletRealmInfoSchema,Script.AudioWorkletRealmInfoSchema,Script.WorkletRealmInfoSchema])); -} -export namespace Script { -export const -BaseRealmInfoSchema: z.ZodLazy> = z.lazy(() => z.object({ -"realm":Script.RealmSchema,"origin":z.string()})); -} -export namespace Script { -export const WindowRealmInfoSchema: z.ZodLazy,"context":typeof BrowsingContext.BrowsingContextSchema,"sandbox":z.ZodOptional}>>> = z.lazy(() => Script.BaseRealmInfoSchema.and( -z.object({ -"type":z.literal("window"),"context":BrowsingContext.BrowsingContextSchema,"sandbox":z.string().optional()})) -); -} -export namespace Script { -export const DedicatedWorkerRealmInfoSchema: z.ZodLazy}>>> = z.lazy(() => Script.BaseRealmInfoSchema.and( -z.object({ -"type":z.literal("dedicated-worker")})) -); -} -export namespace Script { -export const SharedWorkerRealmInfoSchema: z.ZodLazy}>>> = z.lazy(() => Script.BaseRealmInfoSchema.and( -z.object({ -"type":z.literal("shared-worker")})) -); -} -export namespace Script { -export const ServiceWorkerRealmInfoSchema: z.ZodLazy}>>> = z.lazy(() => Script.BaseRealmInfoSchema.and( -z.object({ -"type":z.literal("service-worker")})) -); -} -export namespace Script { -export const WorkerRealmInfoSchema: z.ZodLazy}>>> = z.lazy(() => Script.BaseRealmInfoSchema.and( -z.object({ -"type":z.literal("worker")})) -); -} -export namespace Script { -export const PaintWorkletRealmInfoSchema: z.ZodLazy}>>> = z.lazy(() => Script.BaseRealmInfoSchema.and( -z.object({ -"type":z.literal("paint-worklet")})) -); -} -export namespace Script { -export const AudioWorkletRealmInfoSchema: z.ZodLazy}>>> = z.lazy(() => Script.BaseRealmInfoSchema.and( -z.object({ -"type":z.literal("audio-worklet")})) -); -} -export namespace Script { -export const WorkletRealmInfoSchema: z.ZodLazy}>>> = z.lazy(() => Script.BaseRealmInfoSchema.and( -z.object({ -"type":z.literal("worklet")})) -); -} -export namespace Script { -export const RealmTypeSchema: z.ZodLazy> = z.lazy(() => z.enum(["window","dedicated-worker","shared-worker","service-worker","worker","paint-worklet","audio-worklet","worklet",])); -} -export namespace Script { -export const RemoteReferenceSchema: z.ZodLazy> = z.lazy(() => z.union([Script.SharedReferenceSchema,Script.RemoteObjectReferenceSchema])); -} -export namespace Script { -export const SharedReferenceSchema: z.ZodLazy}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ -"sharedId":Script.SharedIdSchema,"handle":Script.HandleSchema.optional()}).and( -ExtensibleSchema) -); -} -export namespace Script { -export const RemoteObjectReferenceSchema: z.ZodLazy}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ -"handle":Script.HandleSchema,"sharedId":Script.SharedIdSchema.optional()}).and( -ExtensibleSchema) -); -} -export namespace Script { -export const RemoteValueSchema: z.ZodType = z.lazy(() => z.union([Script.PrimitiveProtocolValueSchema,Script.SymbolRemoteValueSchema,Script.ArrayRemoteValueSchema,Script.ObjectRemoteValueSchema,Script.FunctionRemoteValueSchema,Script.RegExpRemoteValueSchema,Script.DateRemoteValueSchema,Script.MapRemoteValueSchema,Script.SetRemoteValueSchema,Script.WeakMapRemoteValueSchema,Script.WeakSetRemoteValueSchema,Script.IteratorRemoteValueSchema,Script.GeneratorRemoteValueSchema,Script.ErrorRemoteValueSchema,Script.ProxyRemoteValueSchema,Script.PromiseRemoteValueSchema,Script.TypedArrayRemoteValueSchema,Script.ArrayBufferRemoteValueSchema,Script.NodeListRemoteValueSchema,Script.HtmlCollectionRemoteValueSchema,Script.NodeRemoteValueSchema,Script.WindowProxyRemoteValueSchema])); -} -export namespace Script { -export const ListRemoteValueSchema: z.ZodLazy> = z.lazy(() => z.array(Script.RemoteValueSchema)); -} -export namespace Script { -export const MappingRemoteValueSchema: z.ZodLazy,typeof Script.RemoteValueSchema], null>>> = z.lazy(() => z.array(z.tuple([ -z.union([Script.RemoteValueSchema,z.string()]),Script.RemoteValueSchema]))); -} -export namespace Script { -export const SymbolRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("symbol"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); -} -export namespace Script { -export const ArrayRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional,"value":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("array"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional(),"value":Script.ListRemoteValueSchema.optional()})); -} -export namespace Script { -export const ObjectRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional,"value":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("object"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional(),"value":Script.MappingRemoteValueSchema.optional()})); -} -export namespace Script { -export const FunctionRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("function"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); -} -export namespace Script { -export const RegExpRemoteValueSchema: z.ZodLazy,"internalId":z.ZodOptional}>,typeof Script.RegExpLocalValueSchema>> = z.lazy(() => z.object({ -"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()}).and(Script.RegExpLocalValueSchema)); -} -export namespace Script { -export const DateRemoteValueSchema: z.ZodLazy,"internalId":z.ZodOptional}>,typeof Script.DateLocalValueSchema>> = z.lazy(() => z.object({ -"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()}).and(Script.DateLocalValueSchema)); -} -export namespace Script { -export const MapRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional,"value":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("map"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional(),"value":Script.MappingRemoteValueSchema.optional()})); -} -export namespace Script { -export const SetRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional,"value":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("set"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional(),"value":Script.ListRemoteValueSchema.optional()})); -} -export namespace Script { -export const WeakMapRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("weakmap"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); -} -export namespace Script { -export const WeakSetRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("weakset"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); -} -export namespace Script { -export const IteratorRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("iterator"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); -} -export namespace Script { -export const GeneratorRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("generator"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); -} -export namespace Script { -export const ErrorRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("error"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); -} -export namespace Script { -export const ProxyRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("proxy"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); -} -export namespace Script { -export const PromiseRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("promise"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); -} -export namespace Script { -export const TypedArrayRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("typedarray"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); -} -export namespace Script { -export const ArrayBufferRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("arraybuffer"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); -} -export namespace Script { -export const NodeListRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional,"value":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("nodelist"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional(),"value":Script.ListRemoteValueSchema.optional()})); -} -export namespace Script { -export const HtmlCollectionRemoteValueSchema: z.ZodLazy,"handle":z.ZodOptional,"internalId":z.ZodOptional,"value":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("htmlcollection"),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional(),"value":Script.ListRemoteValueSchema.optional()})); -} -export namespace Script { -export const NodeRemoteValueSchema: z.ZodType = z.lazy(() => z.object({ -"type":z.literal("node"),"sharedId":Script.SharedIdSchema.optional(),"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional(),"value":Script.NodePropertiesSchema.optional()})); -} -export namespace Script { -export const NodePropertiesSchema: z.ZodLazy>,"children":z.ZodOptional>,"localName":z.ZodOptional,"mode":z.ZodOptional>,"namespaceURI":z.ZodOptional,"nodeValue":z.ZodOptional,"shadowRoot":z.ZodOptional>}>> = z.lazy(() => z.object({ -"nodeType":JsUintSchema,"childNodeCount":JsUintSchema,"attributes":z.record( -z.string(),z.string()).optional(),"children":z.array(Script.NodeRemoteValueSchema).optional(),"localName":z.string().optional(),"mode":z.enum(["open","closed",]).optional(),"namespaceURI":z.string().optional(),"nodeValue":z.string().optional(),"shadowRoot":z.union([Script.NodeRemoteValueSchema,z.null()]).optional()})); -} -export namespace Script { -export const WindowProxyRemoteValueSchema: z.ZodLazy,"value":typeof Script.WindowProxyPropertiesSchema,"handle":z.ZodOptional,"internalId":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("window"),"value":Script.WindowProxyPropertiesSchema,"handle":Script.HandleSchema.optional(),"internalId":Script.InternalIdSchema.optional()})); -} -export namespace Script { -export const WindowProxyPropertiesSchema: z.ZodLazy> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema})); -} -export namespace Script { -export const ResultOwnershipSchema: z.ZodLazy> = z.lazy(() => z.enum(["root","none",])); -} -export namespace Script { -export const SerializationOptionsSchema: z.ZodLazy>>,"maxObjectDepth":z.ZodOptional>>,"includeShadowTree":z.ZodOptional>>}>> = z.lazy(() => z.object({ -"maxDomDepth":z.union([JsUintSchema,z.null()]).default(0).optional(),"maxObjectDepth":z.union([JsUintSchema,z.null()]).default(null).optional(),"includeShadowTree":z.enum(["none","open","all",]).default("none").optional()})); -} -export namespace Script { -export const SharedIdSchema: z.ZodLazy = z.lazy(() => z.string()); -} -export namespace Script { -export const StackFrameSchema: z.ZodLazy> = z.lazy(() => z.object({ -"columnNumber":JsUintSchema,"functionName":z.string(),"lineNumber":JsUintSchema,"url":z.string()})); -} -export namespace Script { -export const StackTraceSchema: z.ZodLazy}>> = z.lazy(() => z.object({ -"callFrames":z.array(Script.StackFrameSchema)})); -} -export namespace Script { -export const SourceSchema: z.ZodLazy}>> = z.lazy(() => z.object({ -"realm":Script.RealmSchema,"context":BrowsingContext.BrowsingContextSchema.optional()})); -} -export namespace Script { -export const RealmTargetSchema: z.ZodLazy> = z.lazy(() => z.object({ -"realm":Script.RealmSchema})); -} -export namespace Script { -export const ContextTargetSchema: z.ZodLazy}>> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema,"sandbox":z.string().optional()})); -} -export namespace Script { -export const TargetSchema: z.ZodLazy> = z.lazy(() => z.union([Script.RealmTargetSchema,Script.ContextTargetSchema])); -} -export namespace Script { -export const -AddPreloadScriptSchema: z.ZodLazy,"params":typeof Script.AddPreloadScriptParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("script.addPreloadScript"),"params":Script.AddPreloadScriptParametersSchema})); -} -export namespace Script { -export const AddPreloadScriptParametersSchema: z.ZodLazy>,"contexts":z.ZodOptional>,"sandbox":z.ZodOptional}>> = z.lazy(() => z.object({ -"functionDeclaration":z.string(),"arguments":z.array(Script.ChannelValueSchema).optional(),"contexts":z.array(BrowsingContext.BrowsingContextSchema).nonempty().optional(),"sandbox":z.string().optional()})); -} -export namespace Script { -export const AddPreloadScriptResultSchema: z.ZodLazy> = z.lazy(() => z.object({ -"script":Script.PreloadScriptSchema})); -} -export namespace Script { -export const -DisownSchema: z.ZodLazy,"params":typeof Script.DisownParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("script.disown"),"params":Script.DisownParametersSchema})); -} -export namespace Script { -export const DisownParametersSchema: z.ZodLazy,"target":typeof Script.TargetSchema}>> = z.lazy(() => z.object({ -"handles":z.array(Script.HandleSchema),"target":Script.TargetSchema})); -} -export namespace Script { -export const -CallFunctionSchema: z.ZodLazy,"params":typeof Script.CallFunctionParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("script.callFunction"),"params":Script.CallFunctionParametersSchema})); -} -export namespace Script { -export const CallFunctionParametersSchema: z.ZodLazy>,"resultOwnership":z.ZodOptional,"serializationOptions":z.ZodOptional,"this":z.ZodOptional,"userActivation":z.ZodOptional>}>> = z.lazy(() => z.object({ -"functionDeclaration":z.string(),"awaitPromise":z.boolean(),"target":Script.TargetSchema,"arguments":z.array(Script.LocalValueSchema).optional(),"resultOwnership":Script.ResultOwnershipSchema.optional(),"serializationOptions":Script.SerializationOptionsSchema.optional(),"this":Script.LocalValueSchema.optional(),"userActivation":z.boolean().default(false).optional()})); -} -export namespace Script { -export const -EvaluateSchema: z.ZodLazy,"params":typeof Script.EvaluateParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("script.evaluate"),"params":Script.EvaluateParametersSchema})); -} -export namespace Script { -export const EvaluateParametersSchema: z.ZodLazy,"serializationOptions":z.ZodOptional,"userActivation":z.ZodOptional>}>> = z.lazy(() => z.object({ -"expression":z.string(),"target":Script.TargetSchema,"awaitPromise":z.boolean(),"resultOwnership":Script.ResultOwnershipSchema.optional(),"serializationOptions":Script.SerializationOptionsSchema.optional(),"userActivation":z.boolean().default(false).optional()})); -} -export namespace Script { -export const -GetRealmsSchema: z.ZodLazy,"params":typeof Script.GetRealmsParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("script.getRealms"),"params":Script.GetRealmsParametersSchema})); -} -export namespace Script { -export const GetRealmsParametersSchema: z.ZodLazy,"type":z.ZodOptional}>> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema.optional(),"type":Script.RealmTypeSchema.optional()})); -} -export namespace Script { -export const GetRealmsResultSchema: z.ZodLazy}>> = z.lazy(() => z.object({ -"realms":z.array(Script.RealmInfoSchema)})); -} -export namespace Script { -export const -RemovePreloadScriptSchema: z.ZodLazy,"params":typeof Script.RemovePreloadScriptParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("script.removePreloadScript"),"params":Script.RemovePreloadScriptParametersSchema})); -} -export namespace Script { -export const RemovePreloadScriptParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ -"script":Script.PreloadScriptSchema})); -} -export namespace Script { -export const -MessageSchema: z.ZodLazy,"params":typeof Script.MessageParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("script.message"),"params":Script.MessageParametersSchema})); -} -export namespace Script { -export const MessageParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ -"channel":Script.ChannelSchema,"data":Script.RemoteValueSchema,"source":Script.SourceSchema})); -} -export namespace Script { -export const -RealmCreatedSchema: z.ZodLazy,"params":typeof Script.RealmInfoSchema}>> = z.lazy(() => z.object({ -"method":z.literal("script.realmCreated"),"params":Script.RealmInfoSchema})); -} -export namespace Script { -export const -RealmDestroyedSchema: z.ZodLazy,"params":typeof Script.RealmDestroyedParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("script.realmDestroyed"),"params":Script.RealmDestroyedParametersSchema})); -} -export namespace Script { -export const RealmDestroyedParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ -"realm":Script.RealmSchema})); -} -export const -LogEventSchema: z.ZodLazy = z.lazy(() => Log.EntryAddedSchema); -export namespace Log { -export const LevelSchema: z.ZodLazy> = z.lazy(() => z.enum(["debug","info","warn","error",])); -} -export namespace Log { -export const EntrySchema: z.ZodLazy> = z.lazy(() => z.union([Log.GenericLogEntrySchema,Log.ConsoleLogEntrySchema,Log.JavascriptLogEntrySchema])); -} -export namespace Log { -export const -BaseLogEntrySchema: z.ZodLazy,"timestamp":typeof JsUintSchema,"stackTrace":z.ZodOptional}>> = z.lazy(() => z.object({ -"level":Log.LevelSchema,"source":Script.SourceSchema,"text":z.union([z.string(),z.null()]),"timestamp":JsUintSchema,"stackTrace":Script.StackTraceSchema.optional()})); -} -export namespace Log { -export const GenericLogEntrySchema: z.ZodLazy>> = z.lazy(() => Log.BaseLogEntrySchema.and( -z.object({ -"type":z.string()})) -); -} -export namespace Log { -export const ConsoleLogEntrySchema: z.ZodLazy,"method":z.ZodString,"args":z.ZodArray}>>> = z.lazy(() => Log.BaseLogEntrySchema.and( -z.object({ -"type":z.literal("console"),"method":z.string(),"args":z.array(Script.RemoteValueSchema)})) -); -} -export namespace Log { -export const JavascriptLogEntrySchema: z.ZodLazy}>>> = z.lazy(() => Log.BaseLogEntrySchema.and( -z.object({ -"type":z.literal("javascript")})) -); -} -export namespace Log { -export const -EntryAddedSchema: z.ZodLazy,"params":typeof Log.EntrySchema}>> = z.lazy(() => z.object({ -"method":z.literal("log.entryAdded"),"params":Log.EntrySchema})); -} -export const -InputCommandSchema: z.ZodLazy> = z.lazy(() => z.union([Input.PerformActionsSchema,Input.ReleaseActionsSchema])); -export namespace Input { -export const ElementOriginSchema: z.ZodLazy,"element":typeof Script.SharedReferenceSchema}>> = z.lazy(() => z.object({ -"type":z.literal("element"),"element":Script.SharedReferenceSchema})); -} -export namespace Input { -export const -PerformActionsSchema: z.ZodLazy,"params":typeof Input.PerformActionsParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("input.performActions"),"params":Input.PerformActionsParametersSchema})); -} -export namespace Input { -export const PerformActionsParametersSchema: z.ZodLazy}>> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema,"actions":z.array(Input.SourceActionsSchema)})); -} -export namespace Input { -export const SourceActionsSchema: z.ZodLazy> = z.lazy(() => z.union([Input.NoneSourceActionsSchema,Input.KeySourceActionsSchema,Input.PointerSourceActionsSchema,Input.WheelSourceActionsSchema])); -} -export namespace Input { -export const NoneSourceActionsSchema: z.ZodLazy,"id":z.ZodString,"actions":z.ZodArray}>> = z.lazy(() => z.object({ -"type":z.literal("none"),"id":z.string(),"actions":z.array(Input.NoneSourceActionSchema)})); -} -export namespace Input { -export const NoneSourceActionSchema: z.ZodLazy = z.lazy(() => Input.PauseActionSchema); -} -export namespace Input { -export const KeySourceActionsSchema: z.ZodLazy,"id":z.ZodString,"actions":z.ZodArray}>> = z.lazy(() => z.object({ -"type":z.literal("key"),"id":z.string(),"actions":z.array(Input.KeySourceActionSchema)})); -} -export namespace Input { -export const KeySourceActionSchema: z.ZodLazy> = z.lazy(() => z.union([Input.PauseActionSchema,Input.KeyDownActionSchema,Input.KeyUpActionSchema])); -} -export namespace Input { -export const PointerSourceActionsSchema: z.ZodLazy,"id":z.ZodString,"parameters":z.ZodOptional,"actions":z.ZodArray}>> = z.lazy(() => z.object({ -"type":z.literal("pointer"),"id":z.string(),"parameters":Input.PointerParametersSchema.optional(),"actions":z.array(Input.PointerSourceActionSchema)})); -} -export namespace Input { -export const PointerTypeSchema: z.ZodLazy> = z.lazy(() => z.enum(["mouse","pen","touch",])); -} -export namespace Input { -export const PointerParametersSchema: z.ZodLazy>}>> = z.lazy(() => z.object({ -"pointerType":Input.PointerTypeSchema.default("mouse").optional()})); -} -export namespace Input { -export const PointerSourceActionSchema: z.ZodLazy> = z.lazy(() => z.union([Input.PauseActionSchema,Input.PointerDownActionSchema,Input.PointerUpActionSchema,Input.PointerMoveActionSchema])); -} -export namespace Input { -export const WheelSourceActionsSchema: z.ZodLazy,"id":z.ZodString,"actions":z.ZodArray}>> = z.lazy(() => z.object({ -"type":z.literal("wheel"),"id":z.string(),"actions":z.array(Input.WheelSourceActionSchema)})); -} -export namespace Input { -export const WheelSourceActionSchema: z.ZodLazy> = z.lazy(() => z.union([Input.PauseActionSchema,Input.WheelScrollActionSchema])); -} -export namespace Input { -export const PauseActionSchema: z.ZodLazy,"duration":z.ZodOptional}>> = z.lazy(() => z.object({ -"type":z.literal("pause"),"duration":JsUintSchema.optional()})); -} -export namespace Input { -export const KeyDownActionSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ -"type":z.literal("keyDown"),"value":z.string()})); -} -export namespace Input { -export const KeyUpActionSchema: z.ZodLazy,"value":z.ZodString}>> = z.lazy(() => z.object({ -"type":z.literal("keyUp"),"value":z.string()})); -} -export namespace Input { -export const PointerUpActionSchema: z.ZodLazy,"button":typeof JsUintSchema}>,typeof Input.PointerCommonPropertiesSchema>> = z.lazy(() => z.object({ -"type":z.literal("pointerUp"),"button":JsUintSchema}).and( -Input.PointerCommonPropertiesSchema) -); -} -export namespace Input { -export const PointerDownActionSchema: z.ZodLazy,"button":typeof JsUintSchema}>,typeof Input.PointerCommonPropertiesSchema>> = z.lazy(() => z.object({ -"type":z.literal("pointerDown"),"button":JsUintSchema}).and( -Input.PointerCommonPropertiesSchema) -); -} -export namespace Input { -export const PointerMoveActionSchema: z.ZodLazy,"x":typeof JsIntSchema,"y":typeof JsIntSchema,"duration":z.ZodOptional,"origin":z.ZodOptional}>,typeof Input.PointerCommonPropertiesSchema>> = z.lazy(() => z.object({ -"type":z.literal("pointerMove"),"x":JsIntSchema,"y":JsIntSchema,"duration":JsUintSchema.optional(),"origin":Input.OriginSchema.optional()}).and( -Input.PointerCommonPropertiesSchema) -); -} -export namespace Input { -export const WheelScrollActionSchema: z.ZodLazy,"x":typeof JsIntSchema,"y":typeof JsIntSchema,"deltaX":typeof JsIntSchema,"deltaY":typeof JsIntSchema,"duration":z.ZodOptional,"origin":z.ZodOptional>}>> = z.lazy(() => z.object({ -"type":z.literal("scroll"),"x":JsIntSchema,"y":JsIntSchema,"deltaX":JsIntSchema,"deltaY":JsIntSchema,"duration":JsUintSchema.optional(),"origin":Input.OriginSchema.default("viewport").optional()})); -} -export namespace Input { -export const -PointerCommonPropertiesSchema: z.ZodLazy>,"height":z.ZodOptional>,"pressure":z.ZodOptional>,"tangentialPressure":z.ZodOptional>,"twist":z.ZodOptional>,"altitudeAngle":z.ZodOptional>,"azimuthAngle":z.ZodOptional>}>> = z.lazy(() => z.object({ -"width":JsUintSchema.default(1).optional(),"height":JsUintSchema.default(1).optional(),"pressure":z.number().default(0).optional(),"tangentialPressure":z.number().default(0).optional(),"twist":z.number().int().nonnegative().gte(0).lte(359).default(0).optional(),"altitudeAngle":z.number().gte(0).lte(1.5707963267948966).default(0).optional(),"azimuthAngle":z.number().gte(0).lte(6.283185307179586).default(0).optional()})); -} -export namespace Input { -export const OriginSchema: z.ZodLazy,z.ZodLiteral<"pointer">,typeof Input.ElementOriginSchema]>> = z.lazy(() => z.union([z.literal("viewport"),z.literal("pointer"),Input.ElementOriginSchema])); -} -export namespace Input { -export const -ReleaseActionsSchema: z.ZodLazy,"params":typeof Input.ReleaseActionsParametersSchema}>> = z.lazy(() => z.object({ -"method":z.literal("input.releaseActions"),"params":Input.ReleaseActionsParametersSchema})); -} -export namespace Input { -export const ReleaseActionsParametersSchema: z.ZodLazy> = z.lazy(() => z.object({ -"context":BrowsingContext.BrowsingContextSchema})); -} diff --git a/tests/snapshots/zod4__it_works.snap b/tests/snapshots/zod4__it_works.snap deleted file mode 100644 index 1b7af9e..0000000 --- a/tests/snapshots/zod4__it_works.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: tests/zod4.rs -expression: "String :: from_utf8(stderr.into_inner().unwrap()).unwrap()" ---- - diff --git a/tests/snapshots/zod4__it_works_with_amendments-2.snap b/tests/snapshots/zod4__it_works_with_amendments-2.snap deleted file mode 100644 index d40350f..0000000 --- a/tests/snapshots/zod4__it_works_with_amendments-2.snap +++ /dev/null @@ -1,14 +0,0 @@ ---- -source: tests/zod4.rs -expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" ---- -export const TerminalColorSchema: z.ZodLazy = z.lazy(() => BasecolorsSchema); -export const -BasecolorsSchema: z.ZodLazy,"red":z.ZodLiteral<1>,"green":z.ZodLiteral<2>,"yellow":z.ZodLiteral<3>,"blue":z.ZodLiteral<4>,"magenta":z.ZodLiteral<5>,"cyan":z.ZodLiteral<6>,"white":z.ZodLiteral<7>}>> = z.lazy(() => z.object({ -"black":z.literal(0),"red":z.literal(1),"green":z.literal(2),"yellow":z.literal(3),"blue":z.literal(4),"magenta":z.literal(5),"cyan":z.literal(6),"white":z.literal(7)})); -export const ExtendedColorSchema: z.ZodLazy,"pink":z.ZodLiteral<9>,"purple":z.ZodLiteral<10>,"brown":z.ZodLiteral<11>}>>> = z.lazy(() => BasecolorsSchema.and( -z.object({ -"orange":z.literal(8),"pink":z.literal(9),"purple":z.literal(10),"brown":z.literal(11)})) -); diff --git a/tests/snapshots/zod4__it_works_with_amendments.snap b/tests/snapshots/zod4__it_works_with_amendments.snap deleted file mode 100644 index 1b7af9e..0000000 --- a/tests/snapshots/zod4__it_works_with_amendments.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: tests/zod4.rs -expression: "String :: from_utf8(stderr.into_inner().unwrap()).unwrap()" ---- - diff --git a/tests/snapshots/zod4__it_works_with_array_occurences-2.snap b/tests/snapshots/zod4__it_works_with_array_occurences-2.snap deleted file mode 100644 index 848ab38..0000000 --- a/tests/snapshots/zod4__it_works_with_array_occurences-2.snap +++ /dev/null @@ -1,10 +0,0 @@ ---- -source: tests/zod4.rs -expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" ---- -export const CapabilityRequestSchema: z.ZodLazy> = z.lazy(() => z.object({ -})); -export const CapabilitiesRequestSchema: z.ZodLazy}>> = z.lazy(() => z.object({ -"firstMatch":z.array(CapabilityRequestSchema)})); diff --git a/tests/snapshots/zod4__it_works_with_array_occurences.snap b/tests/snapshots/zod4__it_works_with_array_occurences.snap deleted file mode 100644 index 1b7af9e..0000000 --- a/tests/snapshots/zod4__it_works_with_array_occurences.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: tests/zod4.rs -expression: "String :: from_utf8(stderr.into_inner().unwrap()).unwrap()" ---- - diff --git a/tests/snapshots/zod4__it_works_with_enums-2.snap b/tests/snapshots/zod4__it_works_with_enums-2.snap deleted file mode 100644 index 0b30735..0000000 --- a/tests/snapshots/zod4__it_works_with_enums-2.snap +++ /dev/null @@ -1,13 +0,0 @@ ---- -source: tests/zod4.rs -expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" ---- -export const QEnumSchema: z.ZodLazy> = z.lazy(() => z.enum(["qValue","qValue2",])); -export namespace Network { -export const SameSiteSchema: z.ZodLazy> = z.lazy(() => z.enum(["strict","lax","none",])); -} -export namespace Network { -export const CookieSchema: z.ZodLazy> = z.lazy(() => z.object({ -"name":z.string(),"value":z.string(),"sameSite":Network.SameSiteSchema})); -} diff --git a/tests/snapshots/zod4__it_works_with_enums.snap b/tests/snapshots/zod4__it_works_with_enums.snap deleted file mode 100644 index 1b7af9e..0000000 --- a/tests/snapshots/zod4__it_works_with_enums.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: tests/zod4.rs -expression: "String :: from_utf8(stderr.into_inner().unwrap()).unwrap()" ---- - diff --git a/tests/snapshots/zod4__it_works_with_maps-2.snap b/tests/snapshots/zod4__it_works_with_maps-2.snap deleted file mode 100644 index 502ae98..0000000 --- a/tests/snapshots/zod4__it_works_with_maps-2.snap +++ /dev/null @@ -1,35 +0,0 @@ ---- -source: tests/zod4.rs -expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" ---- -export const ExtensibleMapExampleSchema: z.ZodLazy}>,z.ZodRecord< -z.ZodString,z.ZodAny>>> = z.lazy(() => z.object({ -"optional-key":z.number().int().optional()}).and( -z.record( -z.string(),z.any())) -); -export const ExtensibleMapExample2Schema: z.ZodLazy}>,z.ZodRecord< -z.ZodString,z.ZodAny>>> = z.lazy(() => z.object({ -"optional-key":z.number().int().optional()}).and( -z.record( -z.string(),z.any())) -); -export const ExtensibleMapExample3Schema: z.ZodLazy}>,z.ZodRecord< -z.ZodString,z.ZodAny>>> = z.lazy(() => z.object({ -"optional-key":z.number().int().optional()}).and( -z.record( -z.string(),z.any())) -); -export const ExtensibleMapExample4Schema: z.ZodLazy,z.ZodOptional>,z.ZodRecord< -z.ZodString,z.ZodAny>>> = z.lazy(() => z.record( -z.literal("optional-key"),z.number().int().optional()).and( -z.record( -z.string(),z.any())) -); -export const ExampleMapSchema: z.ZodLazy,"another-key":z.ZodOptional,"standardIdentifier":z.ZodOptional,"1":z.ZodOptional}>> = z.lazy(() => z.object({ -"hyphenated-key":z.string().optional(),"another-key":z.string().optional(),"standardIdentifier":z.string().optional(),"1":z.string().optional()})); diff --git a/tests/snapshots/zod4__it_works_with_maps.snap b/tests/snapshots/zod4__it_works_with_maps.snap deleted file mode 100644 index 1b7af9e..0000000 --- a/tests/snapshots/zod4__it_works_with_maps.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: tests/zod4.rs -expression: "String :: from_utf8(stderr.into_inner().unwrap()).unwrap()" ---- - diff --git a/tests/snapshots/zod4__it_works_with_optional_groups-2.snap b/tests/snapshots/zod4__it_works_with_optional_groups-2.snap deleted file mode 100644 index f3fab0c..0000000 --- a/tests/snapshots/zod4__it_works_with_optional_groups-2.snap +++ /dev/null @@ -1,19 +0,0 @@ ---- -source: tests/zod4.rs -expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" ---- -export const ASchema: z.ZodLazy,z.ZodUnion,z.ZodObject<{}>]>>> = z.lazy(() => z.object({ -"foo":z.string()}).and( -z.object({ -"bar":z.string()}).or(z.object({}))) -); -export const BSchema: z.ZodLazy,z.ZodUnion]>>> = z.lazy(() => z.object({ -"foo":z.string()}).and( -BarSchema.or(z.object({}))) -); -export const -BarSchema: z.ZodType = z.lazy(() => z.object({ -"bar":z.string()})); diff --git a/tests/snapshots/zod4__it_works_with_optional_groups.snap b/tests/snapshots/zod4__it_works_with_optional_groups.snap deleted file mode 100644 index 1b7af9e..0000000 --- a/tests/snapshots/zod4__it_works_with_optional_groups.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: tests/zod4.rs -expression: "String :: from_utf8(stderr.into_inner().unwrap()).unwrap()" ---- - diff --git a/tests/snapshots/zod4__it_works_with_prelude_text_types-2.snap b/tests/snapshots/zod4__it_works_with_prelude_text_types-2.snap deleted file mode 100644 index 37e0078..0000000 --- a/tests/snapshots/zod4__it_works_with_prelude_text_types-2.snap +++ /dev/null @@ -1,7 +0,0 @@ ---- -source: tests/zod4.rs -expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" ---- -export const LinkSchema: z.ZodLazy> = z.lazy(() => z.object({ -"href":z.url(),"pattern":z.string()})); diff --git a/tests/snapshots/zod4__it_works_with_prelude_text_types.snap b/tests/snapshots/zod4__it_works_with_prelude_text_types.snap deleted file mode 100644 index 1b7af9e..0000000 --- a/tests/snapshots/zod4__it_works_with_prelude_text_types.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: tests/zod4.rs -expression: "String :: from_utf8(stderr.into_inner().unwrap()).unwrap()" ---- - diff --git a/tests/snapshots/zod4__it_works_with_simple_optional_groups-2.snap b/tests/snapshots/zod4__it_works_with_simple_optional_groups-2.snap deleted file mode 100644 index 9f117cb..0000000 --- a/tests/snapshots/zod4__it_works_with_simple_optional_groups-2.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/zod4.rs -expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" ---- -export namespace Bluetooth { -export const HandleRequestDevicePromptParametersSchema: z.ZodLazy,z.ZodUnion>> = z.lazy(() => z.object({ -"context":z.string(),"prompt":z.string()}).and( -z.union([Bluetooth.HandleRequestDevicePromptAcceptParametersSchema,Bluetooth.HandleRequestDevicePromptCancelParametersSchema])) -); -} -export namespace Bluetooth { -export const -HandleRequestDevicePromptAcceptParametersSchema: z.ZodLazy,"device":z.ZodString}>> = z.lazy(() => z.object({ -"accept":z.literal(true),"device":z.string()})); -} -export namespace Bluetooth { -export const -HandleRequestDevicePromptCancelParametersSchema: z.ZodLazy}>> = z.lazy(() => z.object({ -"accept":z.literal(false)})); -} diff --git a/tests/snapshots/zod4__it_works_with_simple_optional_groups.snap b/tests/snapshots/zod4__it_works_with_simple_optional_groups.snap deleted file mode 100644 index 1b7af9e..0000000 --- a/tests/snapshots/zod4__it_works_with_simple_optional_groups.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: tests/zod4.rs -expression: "String :: from_utf8(stderr.into_inner().unwrap()).unwrap()" ---- - diff --git a/tests/snapshots/zod__it_works-2.snap b/tests/snapshots/zod__it_works-2.snap index 26cfd9d..137868b 100644 --- a/tests/snapshots/zod__it_works-2.snap +++ b/tests/snapshots/zod__it_works-2.snap @@ -10,20 +10,20 @@ CommandDataSchema) ExtensibleSchema) ); export const -CommandDataSchema: z.ZodLazy> = z.lazy(() => z.union([BrowserCommandSchema,BrowsingContextCommandSchema,InputCommandSchema,NetworkCommandSchema,ScriptCommandSchema,SessionCommandSchema])); +CommandDataSchema: z.ZodLazy> = z.lazy(() => z.union([BrowserCommandSchema,BrowsingContextCommandSchema,InputCommandSchema,NetworkCommandSchema,ScriptCommandSchema,SessionCommandSchema])); export const EmptyParamsSchema: z.ZodLazy = z.lazy(() => ExtensibleSchema); -export const MessageSchema: z.ZodLazy> = z.lazy(() => z.union([CommandResponseSchema,ErrorResponseSchema,EventSchema])); +export const MessageSchema: z.ZodLazy> = z.lazy(() => z.union([CommandResponseSchema,ErrorResponseSchema,EventSchema])); export const CommandResponseSchema: z.ZodLazy,"id":typeof JsUintSchema,"result":typeof ResultDataSchema}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ "type":z.literal("success"),"id":JsUintSchema,"result":ResultDataSchema}).and( ExtensibleSchema) ); export const ErrorResponseSchema: z.ZodLazy,"id":z.ZodUnion<[typeof JsUintSchema,z.ZodNull]>,"error":typeof ErrorCodeSchema,"message":z.ZodString,"stacktrace":z.ZodOptional}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ +"type":z.ZodLiteral<"error">,"id":z.ZodUnion,"error":typeof ErrorCodeSchema,"message":z.ZodString,"stacktrace":z.ZodOptional}>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ "type":z.literal("error"),"id":z.union([JsUintSchema,z.null()]),"error":ErrorCodeSchema,"message":z.string(),"stacktrace":z.string().optional()}).and( ExtensibleSchema) ); -export const ResultDataSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContextResultSchema,EmptyResultSchema,NetworkResultSchema,ScriptResultSchema,SessionResultSchema])); +export const ResultDataSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContextResultSchema,EmptyResultSchema,NetworkResultSchema,ScriptResultSchema,SessionResultSchema])); export const EmptyResultSchema: z.ZodLazy = z.lazy(() => ExtensibleSchema); export const EventSchema: z.ZodLazy}>,typeof EventDataSchema>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ @@ -33,17 +33,17 @@ EventDataSchema) ExtensibleSchema) ); export const -EventDataSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContextEventSchema,LogEventSchema,NetworkEventSchema,ScriptEventSchema])); +EventDataSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContextEventSchema,LogEventSchema,NetworkEventSchema,ScriptEventSchema])); export const ExtensibleSchema: z.ZodLazy> = z.lazy(() => z.record( z.string(),z.any())); export const JsIntSchema: z.ZodNumber = z.number().int().gte(-9007199254740991).lte(9007199254740991); export const JsUintSchema: z.ZodNumber = z.number().int().nonnegative().gte(0).lte(9007199254740991); -export const ErrorCodeSchema: z.ZodLazy> = z.lazy(() => z.enum(["invalid argument","invalid session id","move target out of bounds","no such alert","no such element","no such frame","no such handle","no such history entry","no such intercept","no such node","no such request","no such script","session not created","unable to capture screen","unable to close browser","unknown command","unknown error","unsupported operation",])); +export const ErrorCodeSchema: z.ZodLazy> = z.lazy(() => z.enum(["invalid argument","invalid session id","move target out of bounds","no such alert","no such element","no such frame","no such handle","no such history entry","no such intercept","no such node","no such request","no such script","session not created","unable to capture screen","unable to close browser","unknown command","unknown error","unsupported operation",])); export const -SessionCommandSchema: z.ZodLazy> = z.lazy(() => z.union([Session.EndSchema,Session.NewSchema,Session.StatusSchema,Session.SubscribeSchema,Session.UnsubscribeSchema])); -export const SessionResultSchema: z.ZodLazy> = z.lazy(() => z.union([Session.NewResultSchema,Session.StatusResultSchema])); +SessionCommandSchema: z.ZodLazy> = z.lazy(() => z.union([Session.EndSchema,Session.NewSchema,Session.StatusSchema,Session.SubscribeSchema,Session.UnsubscribeSchema])); +export const SessionResultSchema: z.ZodLazy> = z.lazy(() => z.union([Session.NewResultSchema,Session.StatusResultSchema])); export namespace Session { export const CapabilitiesRequestSchema: z.ZodLazy,"firstMatch":z.ZodOptional>}>> = z.lazy(() => z.object({ @@ -57,7 +57,7 @@ ExtensibleSchema) ); } export namespace Session { -export const ProxyConfigurationSchema: z.ZodLazy]>> = z.lazy(() => z.union([Session.AutodetectProxyConfigurationSchema,Session.DirectProxyConfigurationSchema,Session.ManualProxyConfigurationSchema,Session.PacProxyConfigurationSchema,Session.SystemProxyConfigurationSchema,z.object({ })])); } @@ -80,7 +80,7 @@ ExtensibleSchema) export namespace Session { export const ManualProxyConfigurationSchema: z.ZodLazy,"ftpProxy":z.ZodOptional,"httpProxy":z.ZodOptional,"sslProxy":z.ZodOptional}>,z.ZodUnion<[typeof Session.SocksProxyConfigurationSchema,z.ZodObject<{}>]>>,z.ZodObject<{ +"proxyType":z.ZodLiteral<"manual">,"ftpProxy":z.ZodOptional,"httpProxy":z.ZodOptional,"sslProxy":z.ZodOptional}>,z.ZodUnion]>>,z.ZodObject<{ "noProxy":z.ZodOptional>}>>,typeof ExtensibleSchema>> = z.lazy(() => z.object({ "proxyType":z.literal("manual"),"ftpProxy":z.string().optional(),"httpProxy":z.string().optional(),"sslProxy":z.string().optional()}).and( Session.SocksProxyConfigurationSchema.or(z.object({}))) @@ -176,10 +176,10 @@ CloseSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.ActivateSchema,BrowsingContext.CaptureScreenshotSchema,BrowsingContext.CloseSchema,BrowsingContext.CreateSchema,BrowsingContext.GetTreeSchema,BrowsingContext.HandleUserPromptSchema,BrowsingContext.LocateNodesSchema,BrowsingContext.NavigateSchema,BrowsingContext.PrintSchema,BrowsingContext.ReloadSchema,BrowsingContext.SetViewportSchema,BrowsingContext.TraverseHistorySchema])); -export const BrowsingContextResultSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.CaptureScreenshotResultSchema,BrowsingContext.CreateResultSchema,BrowsingContext.GetTreeResultSchema,BrowsingContext.LocateNodesResultSchema,BrowsingContext.NavigateResultSchema,BrowsingContext.PrintResultSchema,BrowsingContext.TraverseHistoryResultSchema])); +BrowsingContextCommandSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.ActivateSchema,BrowsingContext.CaptureScreenshotSchema,BrowsingContext.CloseSchema,BrowsingContext.CreateSchema,BrowsingContext.GetTreeSchema,BrowsingContext.HandleUserPromptSchema,BrowsingContext.LocateNodesSchema,BrowsingContext.NavigateSchema,BrowsingContext.PrintSchema,BrowsingContext.ReloadSchema,BrowsingContext.SetViewportSchema,BrowsingContext.TraverseHistorySchema])); +export const BrowsingContextResultSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.CaptureScreenshotResultSchema,BrowsingContext.CreateResultSchema,BrowsingContext.GetTreeResultSchema,BrowsingContext.LocateNodesResultSchema,BrowsingContext.NavigateResultSchema,BrowsingContext.PrintResultSchema,BrowsingContext.TraverseHistoryResultSchema])); export const -BrowsingContextEventSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.ContextCreatedSchema,BrowsingContext.ContextDestroyedSchema,BrowsingContext.DomContentLoadedSchema,BrowsingContext.DownloadWillBeginSchema,BrowsingContext.FragmentNavigatedSchema,BrowsingContext.LoadSchema,BrowsingContext.NavigationAbortedSchema,BrowsingContext.NavigationFailedSchema,BrowsingContext.NavigationStartedSchema,BrowsingContext.UserPromptClosedSchema,BrowsingContext.UserPromptOpenedSchema])); +BrowsingContextEventSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.ContextCreatedSchema,BrowsingContext.ContextDestroyedSchema,BrowsingContext.DomContentLoadedSchema,BrowsingContext.DownloadWillBeginSchema,BrowsingContext.FragmentNavigatedSchema,BrowsingContext.LoadSchema,BrowsingContext.NavigationAbortedSchema,BrowsingContext.NavigationFailedSchema,BrowsingContext.NavigationStartedSchema,BrowsingContext.UserPromptClosedSchema,BrowsingContext.UserPromptOpenedSchema])); export namespace BrowsingContext { export const BrowsingContextSchema: z.ZodLazy = z.lazy(() => z.string()); } @@ -188,11 +188,11 @@ export const InfoListSchema: z.ZodType = z.lazy(() => z.array(BrowsingContext.In } export namespace BrowsingContext { export const InfoSchema: z.ZodLazy,"parent":z.ZodOptional>}>> = z.lazy(() => z.object({ +"context":typeof BrowsingContext.BrowsingContextSchema,"url":z.ZodString,"children":z.ZodUnion,"parent":z.ZodOptional>}>> = z.lazy(() => z.object({ "context":BrowsingContext.BrowsingContextSchema,"url":z.string(),"children":z.union([BrowsingContext.InfoListSchema,z.null()]),"parent":z.union([BrowsingContext.BrowsingContextSchema,z.null()]).optional()})); } export namespace BrowsingContext { -export const LocatorSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.CssLocatorSchema,BrowsingContext.InnerTextLocatorSchema,BrowsingContext.XPathLocatorSchema])); +export const LocatorSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.CssLocatorSchema,BrowsingContext.InnerTextLocatorSchema,BrowsingContext.XPathLocatorSchema])); } export namespace BrowsingContext { export const CssLocatorSchema: z.ZodLazy,"value":z.ZodString,"ignoreCase":z.ZodOptional,"matchType":z.ZodOptional>,"maxDepth":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.ZodLiteral<"innerText">,"value":z.ZodString,"ignoreCase":z.ZodOptional,"matchType":z.ZodOptional>,"maxDepth":z.ZodOptional}>> = z.lazy(() => z.object({ "type":z.literal("innerText"),"value":z.string(),"ignoreCase":z.boolean().optional(),"matchType":z.enum(["full","partial",]).optional(),"maxDepth":JsUintSchema.optional()})); } export namespace BrowsingContext { @@ -214,11 +214,11 @@ export const NavigationSchema: z.ZodLazy = z.lazy(() => z.string()) } export namespace BrowsingContext { export const NavigationInfoSchema: z.ZodLazy,"timestamp":typeof JsUintSchema,"url":z.ZodString}>> = z.lazy(() => z.object({ +"context":typeof BrowsingContext.BrowsingContextSchema,"navigation":z.ZodUnion,"timestamp":typeof JsUintSchema,"url":z.ZodString}>> = z.lazy(() => z.object({ "context":BrowsingContext.BrowsingContextSchema,"navigation":z.union([BrowsingContext.NavigationSchema,z.null()]),"timestamp":JsUintSchema,"url":z.string()})); } export namespace BrowsingContext { -export const ReadinessStateSchema: z.ZodLazy> = z.lazy(() => z.enum(["none","interactive","complete",])); +export const ReadinessStateSchema: z.ZodLazy> = z.lazy(() => z.enum(["none","interactive","complete",])); } export namespace BrowsingContext { export const @@ -239,7 +239,7 @@ CaptureScreenshotSchema: z.ZodLazy>>,"format":z.ZodOptional,"clip":z.ZodOptional}>> = z.lazy(() => z.object({ +"context":typeof BrowsingContext.BrowsingContextSchema,"origin":z.ZodOptional>>,"format":z.ZodOptional,"clip":z.ZodOptional}>> = z.lazy(() => z.object({ "context":BrowsingContext.BrowsingContextSchema,"origin":z.enum(["viewport","document",]).default("viewport").optional(),"format":BrowsingContext.ImageFormatSchema.optional(),"clip":BrowsingContext.ClipRectangleSchema.optional()})); } export namespace BrowsingContext { @@ -248,7 +248,7 @@ export const ImageFormatSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.BoxClipRectangleSchema,BrowsingContext.ElementClipRectangleSchema])); +export const ClipRectangleSchema: z.ZodLazy> = z.lazy(() => z.union([BrowsingContext.BoxClipRectangleSchema,BrowsingContext.ElementClipRectangleSchema])); } export namespace BrowsingContext { export const ElementClipRectangleSchema: z.ZodLazy> = z.lazy(() => z.enum(["tab","window",])); +export const CreateTypeSchema: z.ZodLazy> = z.lazy(() => z.enum(["tab","window",])); } export namespace BrowsingContext { export const CreateParametersSchema: z.ZodLazy,"ownership":z.ZodOptional,"sandbox":z.ZodOptional,"serializationOptions":z.ZodOptional,"startNodes":z.ZodOptional>}>> = z.lazy(() => z.object({ +"context":typeof BrowsingContext.BrowsingContextSchema,"locator":typeof BrowsingContext.LocatorSchema,"maxNodeCount":z.ZodOptional,"ownership":z.ZodOptional,"sandbox":z.ZodOptional,"serializationOptions":z.ZodOptional,"startNodes":z.ZodOptional>}>> = z.lazy(() => z.object({ "context":BrowsingContext.BrowsingContextSchema,"locator":BrowsingContext.LocatorSchema,"maxNodeCount":JsUintSchema.gte(1).optional(),"ownership":Script.ResultOwnershipSchema.optional(),"sandbox":z.string().optional(),"serializationOptions":Script.SerializationOptionsSchema.optional(),"startNodes":z.array(Script.SharedReferenceSchema).nonempty().optional()})); } export namespace BrowsingContext { @@ -351,7 +351,7 @@ export const NavigateParametersSchema: z.ZodLazy,"url":z.ZodString}>> = z.lazy(() => z.object({ +"navigation":z.ZodUnion,"url":z.ZodString}>> = z.lazy(() => z.object({ "navigation":z.union([BrowsingContext.NavigationSchema,z.null()]),"url":z.string()})); } export namespace BrowsingContext { @@ -362,7 +362,7 @@ PrintSchema: z.ZodLazy>,"margin":z.ZodOptional,"orientation":z.ZodOptional>>,"page":z.ZodOptional,"pageRanges":z.ZodOptional>>,"scale":z.ZodOptional>,"shrinkToFit":z.ZodOptional>}>> = z.lazy(() => z.object({ +"context":typeof BrowsingContext.BrowsingContextSchema,"background":z.ZodOptional>,"margin":z.ZodOptional,"orientation":z.ZodOptional>>,"page":z.ZodOptional,"pageRanges":z.ZodOptional>>,"scale":z.ZodOptional>,"shrinkToFit":z.ZodOptional>}>> = z.lazy(() => z.object({ "context":BrowsingContext.BrowsingContextSchema,"background":z.boolean().default(false).optional(),"margin":BrowsingContext.PrintMarginParametersSchema.optional(),"orientation":z.enum(["portrait","landscape",]).default("portrait").optional(),"page":BrowsingContext.PrintPageParametersSchema.optional(),"pageRanges":z.array(z.union([JsUintSchema,z.string()])).optional(),"scale":z.number().gte(0.1).lte(2).default(1).optional(),"shrinkToFit":z.boolean().default(true).optional()})); } export namespace BrowsingContext { @@ -399,7 +399,7 @@ SetViewportSchema: z.ZodLazy>,"devicePixelRatio":z.ZodOptional>}>> = z.lazy(() => z.object({ +"context":typeof BrowsingContext.BrowsingContextSchema,"viewport":z.ZodOptional>,"devicePixelRatio":z.ZodOptional>}>> = z.lazy(() => z.object({ "context":BrowsingContext.BrowsingContextSchema,"viewport":z.union([BrowsingContext.ViewportSchema,z.null()]).optional(),"devicePixelRatio":z.union([z.number().gt(0),z.null()]).optional()})); } export namespace BrowsingContext { @@ -496,15 +496,15 @@ UserPromptOpenedSchema: z.ZodLazy,"message":z.ZodString,"defaultValue":z.ZodOptional}>> = z.lazy(() => z.object({ +"context":typeof BrowsingContext.BrowsingContextSchema,"type":z.ZodEnum<{"alert":"alert","confirm":"confirm","prompt":"prompt","beforeunload":"beforeunload",}>,"message":z.ZodString,"defaultValue":z.ZodOptional}>> = z.lazy(() => z.object({ "context":BrowsingContext.BrowsingContextSchema,"type":z.enum(["alert","confirm","prompt","beforeunload",]),"message":z.string(),"defaultValue":z.string().optional()})); } export const -NetworkCommandSchema: z.ZodLazy> = z.lazy(() => z.union([Network.AddInterceptSchema,Network.ContinueRequestSchema,Network.ContinueResponseSchema,Network.ContinueWithAuthSchema,Network.FailRequestSchema,Network.ProvideResponseSchema,Network.RemoveInterceptSchema])); +NetworkCommandSchema: z.ZodLazy> = z.lazy(() => z.union([Network.AddInterceptSchema,Network.ContinueRequestSchema,Network.ContinueResponseSchema,Network.ContinueWithAuthSchema,Network.FailRequestSchema,Network.ProvideResponseSchema,Network.RemoveInterceptSchema])); export const NetworkResultSchema: z.ZodLazy = z.lazy(() => Network.AddInterceptResultSchema); export const -NetworkEventSchema: z.ZodLazy> = z.lazy(() => z.union([Network.AuthRequiredSchema,Network.BeforeRequestSentSchema,Network.FetchErrorSchema,Network.ResponseCompletedSchema,Network.ResponseStartedSchema])); +NetworkEventSchema: z.ZodLazy> = z.lazy(() => z.union([Network.AuthRequiredSchema,Network.BeforeRequestSentSchema,Network.FetchErrorSchema,Network.ResponseCompletedSchema,Network.ResponseStartedSchema])); export namespace Network { export const AuthChallengeSchema: z.ZodLazy> = z.lazy(() => z.object({ @@ -518,11 +518,11 @@ export const AuthCredentialsSchema: z.ZodLazy,"isBlocked":z.ZodBoolean,"navigation":z.ZodUnion<[typeof BrowsingContext.NavigationSchema,z.ZodNull]>,"redirectCount":typeof JsUintSchema,"request":typeof Network.RequestDataSchema,"timestamp":typeof JsUintSchema,"intercepts":z.ZodOptional>}>> = z.lazy(() => z.object({ +"context":z.ZodUnion,"isBlocked":z.ZodBoolean,"navigation":z.ZodUnion,"redirectCount":typeof JsUintSchema,"request":typeof Network.RequestDataSchema,"timestamp":typeof JsUintSchema,"intercepts":z.ZodOptional>}>> = z.lazy(() => z.object({ "context":z.union([BrowsingContext.BrowsingContextSchema,z.null()]),"isBlocked":z.boolean(),"navigation":z.union([BrowsingContext.NavigationSchema,z.null()]),"redirectCount":JsUintSchema,"request":Network.RequestDataSchema,"timestamp":JsUintSchema,"intercepts":z.array(Network.InterceptSchema).nonempty().optional()})); } export namespace Network { -export const BytesValueSchema: z.ZodLazy> = z.lazy(() => z.union([Network.StringValueSchema,Network.Base64ValueSchema])); +export const BytesValueSchema: z.ZodLazy> = z.lazy(() => z.union([Network.StringValueSchema,Network.Base64ValueSchema])); } export namespace Network { export const StringValueSchema: z.ZodLazy,"expires":z.ZodOptional}>> = z.lazy(() => z.object({ +"name":z.ZodString,"value":typeof Network.BytesValueSchema,"domain":z.ZodString,"path":z.ZodString,"size":typeof JsUintSchema,"httpOnly":z.ZodBoolean,"secure":z.ZodBoolean,"sameSite":z.ZodEnum<{"strict":"strict","lax":"lax","none":"none",}>,"expires":z.ZodOptional}>> = z.lazy(() => z.object({ "name":z.string(),"value":Network.BytesValueSchema,"domain":z.string(),"path":z.string(),"size":JsUintSchema,"httpOnly":z.boolean(),"secure":z.boolean(),"sameSite":z.enum(["strict","lax","none",]),"expires":JsUintSchema.optional()})); } export namespace Network { @@ -556,7 +556,7 @@ export const HeaderSchema: z.ZodLazy,"columnNumber":z.ZodOptional,"lineNumber":z.ZodOptional,"stackTrace":z.ZodOptional,"request":z.ZodOptional}>> = z.lazy(() => z.object({ +"type":z.ZodEnum<{"parser":"parser","script":"script","preflight":"preflight","other":"other",}>,"columnNumber":z.ZodOptional,"lineNumber":z.ZodOptional,"stackTrace":z.ZodOptional,"request":z.ZodOptional}>> = z.lazy(() => z.object({ "type":z.enum(["parser","script","preflight","other",]),"columnNumber":JsUintSchema.optional(),"lineNumber":JsUintSchema.optional(),"stackTrace":Script.StackTraceSchema.optional(),"request":Network.RequestSchema.optional()})); } export namespace Network { @@ -567,7 +567,7 @@ export const RequestSchema: z.ZodLazy = z.lazy(() => z.string()); } export namespace Network { export const RequestDataSchema: z.ZodLazy,"cookies":z.ZodArray,"headersSize":typeof JsUintSchema,"bodySize":z.ZodUnion<[typeof JsUintSchema,z.ZodNull]>,"timings":typeof Network.FetchTimingInfoSchema}>> = z.lazy(() => z.object({ +"request":typeof Network.RequestSchema,"url":z.ZodString,"method":z.ZodString,"headers":z.ZodArray,"cookies":z.ZodArray,"headersSize":typeof JsUintSchema,"bodySize":z.ZodUnion,"timings":typeof Network.FetchTimingInfoSchema}>> = z.lazy(() => z.object({ "request":Network.RequestSchema,"url":z.string(),"method":z.string(),"headers":z.array(Network.HeaderSchema),"cookies":z.array(Network.CookieSchema),"headersSize":JsUintSchema,"bodySize":z.union([JsUintSchema,z.null()]),"timings":Network.FetchTimingInfoSchema})); } export namespace Network { @@ -577,16 +577,16 @@ export const ResponseContentSchema: z.ZodLazy,"mimeType":z.ZodString,"bytesReceived":typeof JsUintSchema,"headersSize":z.ZodUnion<[typeof JsUintSchema,z.ZodNull]>,"bodySize":z.ZodUnion<[typeof JsUintSchema,z.ZodNull]>,"content":typeof Network.ResponseContentSchema,"authChallenge":z.ZodOptional}>> = z.lazy(() => z.object({ +"url":z.ZodString,"protocol":z.ZodString,"status":typeof JsUintSchema,"statusText":z.ZodString,"fromCache":z.ZodBoolean,"headers":z.ZodArray,"mimeType":z.ZodString,"bytesReceived":typeof JsUintSchema,"headersSize":z.ZodUnion,"bodySize":z.ZodUnion,"content":typeof Network.ResponseContentSchema,"authChallenge":z.ZodOptional}>> = z.lazy(() => z.object({ "url":z.string(),"protocol":z.string(),"status":JsUintSchema,"statusText":z.string(),"fromCache":z.boolean(),"headers":z.array(Network.HeaderSchema),"mimeType":z.string(),"bytesReceived":JsUintSchema,"headersSize":z.union([JsUintSchema,z.null()]),"bodySize":z.union([JsUintSchema,z.null()]),"content":Network.ResponseContentSchema,"authChallenge":Network.AuthChallengeSchema.optional()})); } export namespace Network { export const SetCookieHeaderSchema: z.ZodLazy,"httpOnly":z.ZodOptional,"expires":z.ZodOptional,"maxAge":z.ZodOptional,"path":z.ZodOptional,"sameSite":z.ZodOptional>,"secure":z.ZodOptional}>> = z.lazy(() => z.object({ +"name":z.ZodString,"value":typeof Network.BytesValueSchema,"domain":z.ZodOptional,"httpOnly":z.ZodOptional,"expires":z.ZodOptional,"maxAge":z.ZodOptional,"path":z.ZodOptional,"sameSite":z.ZodOptional>,"secure":z.ZodOptional}>> = z.lazy(() => z.object({ "name":z.string(),"value":Network.BytesValueSchema,"domain":z.string().optional(),"httpOnly":z.boolean().optional(),"expires":z.string().optional(),"maxAge":JsIntSchema.optional(),"path":z.string().optional(),"sameSite":z.enum(["strict","lax","none",]).optional(),"secure":z.boolean().optional()})); } export namespace Network { -export const UrlPatternSchema: z.ZodLazy> = z.lazy(() => z.union([Network.UrlPatternPatternSchema,Network.UrlPatternStringSchema])); +export const UrlPatternSchema: z.ZodLazy> = z.lazy(() => z.union([Network.UrlPatternPatternSchema,Network.UrlPatternStringSchema])); } export namespace Network { export const UrlPatternPatternSchema: z.ZodLazy,"urlPatterns":z.ZodOptional>}>> = z.lazy(() => z.object({ +"phases":z.ZodArray,"urlPatterns":z.ZodOptional>}>> = z.lazy(() => z.object({ "phases":z.array(Network.InterceptPhaseSchema).nonempty(),"urlPatterns":z.array(Network.UrlPatternSchema).optional()})); } export namespace Network { -export const InterceptPhaseSchema: z.ZodLazy> = z.lazy(() => z.enum(["beforeRequestSent","responseStarted","authRequired",])); +export const InterceptPhaseSchema: z.ZodLazy> = z.lazy(() => z.enum(["beforeRequestSent","responseStarted","authRequired",])); } export namespace Network { export const AddInterceptResultSchema: z.ZodLazy,z.ZodUnion<[typeof Network.ContinueWithAuthCredentialsSchema,typeof Network.ContinueWithAuthNoCredentialsSchema]>>> = z.lazy(() => z.object({ +"request":typeof Network.RequestSchema}>,z.ZodUnion>> = z.lazy(() => z.object({ "request":Network.RequestSchema}).and( z.union([Network.ContinueWithAuthCredentialsSchema,Network.ContinueWithAuthNoCredentialsSchema])) ); @@ -661,7 +661,7 @@ ContinueWithAuthCredentialsSchema: z.ZodLazy}>> = z.lazy(() => z.object({ +"action":z.ZodEnum<{"default":"default","cancel":"cancel",}>}>> = z.lazy(() => z.object({ "action":z.enum(["default","cancel",])})); } export namespace Network { @@ -763,10 +763,10 @@ z.object({ ); } export const -ScriptCommandSchema: z.ZodLazy> = z.lazy(() => z.union([Script.AddPreloadScriptSchema,Script.CallFunctionSchema,Script.DisownSchema,Script.EvaluateSchema,Script.GetRealmsSchema,Script.RemovePreloadScriptSchema])); -export const ScriptResultSchema: z.ZodLazy> = z.lazy(() => z.union([Script.AddPreloadScriptResultSchema,Script.EvaluateResultSchema,Script.GetRealmsResultSchema])); +ScriptCommandSchema: z.ZodLazy> = z.lazy(() => z.union([Script.AddPreloadScriptSchema,Script.CallFunctionSchema,Script.DisownSchema,Script.EvaluateSchema,Script.GetRealmsSchema,Script.RemovePreloadScriptSchema])); +export const ScriptResultSchema: z.ZodLazy> = z.lazy(() => z.union([Script.AddPreloadScriptResultSchema,Script.EvaluateResultSchema,Script.GetRealmsResultSchema])); export const -ScriptEventSchema: z.ZodLazy> = z.lazy(() => z.union([Script.MessageSchema,Script.RealmCreatedSchema,Script.RealmDestroyedSchema])); +ScriptEventSchema: z.ZodLazy> = z.lazy(() => z.union([Script.MessageSchema,Script.RealmCreatedSchema,Script.RealmDestroyedSchema])); export namespace Script { export const ChannelSchema: z.ZodLazy = z.lazy(() => z.string()); } @@ -781,7 +781,7 @@ export const ChannelPropertiesSchema: z.ZodLazy> = z.lazy(() => z.union([Script.EvaluateResultSuccessSchema,Script.EvaluateResultExceptionSchema])); +export const EvaluateResultSchema: z.ZodLazy> = z.lazy(() => z.union([Script.EvaluateResultSuccessSchema,Script.EvaluateResultExceptionSchema])); } export namespace Script { export const EvaluateResultSuccessSchema: z.ZodLazy,typeof Script.LocalValueSchema], null>>> = z.lazy(() => z.array(z.tuple([ +z.ZodUnion,typeof Script.LocalValueSchema], null>>> = z.lazy(() => z.array(z.tuple([ z.union([Script.LocalValueSchema,z.string()]),Script.LocalValueSchema]))); } export namespace Script { @@ -857,7 +857,7 @@ export namespace Script { export const RealmSchema: z.ZodLazy = z.lazy(() => z.string()); } export namespace Script { -export const PrimitiveProtocolValueSchema: z.ZodLazy> = z.lazy(() => z.union([Script.UndefinedValueSchema,Script.NullValueSchema,Script.StringValueSchema,Script.NumberValueSchema,Script.BooleanValueSchema,Script.BigIntValueSchema])); +export const PrimitiveProtocolValueSchema: z.ZodLazy> = z.lazy(() => z.union([Script.UndefinedValueSchema,Script.NullValueSchema,Script.StringValueSchema,Script.NumberValueSchema,Script.BooleanValueSchema,Script.BigIntValueSchema])); } export namespace Script { export const UndefinedValueSchema: z.ZodLazy> = z.lazy(() => z.enum(["NaN","-0","Infinity","-Infinity",])); +export const SpecialNumberSchema: z.ZodLazy> = z.lazy(() => z.enum(["NaN","-0","Infinity","-Infinity",])); } export namespace Script { export const NumberValueSchema: z.ZodLazy,"value":z.ZodUnion<[z.ZodNumber,typeof Script.SpecialNumberSchema]>}>> = z.lazy(() => z.object({ +"type":z.ZodLiteral<"number">,"value":z.ZodUnion}>> = z.lazy(() => z.object({ "type":z.literal("number"),"value":z.union([z.number(),Script.SpecialNumberSchema])})); } export namespace Script { @@ -893,7 +893,7 @@ export const BigIntValueSchema: z.ZodLazy> = z.lazy(() => z.union([Script.WindowRealmInfoSchema,Script.DedicatedWorkerRealmInfoSchema,Script.SharedWorkerRealmInfoSchema,Script.ServiceWorkerRealmInfoSchema,Script.WorkerRealmInfoSchema,Script.PaintWorkletRealmInfoSchema,Script.AudioWorkletRealmInfoSchema,Script.WorkletRealmInfoSchema])); +export const RealmInfoSchema: z.ZodLazy> = z.lazy(() => z.union([Script.WindowRealmInfoSchema,Script.DedicatedWorkerRealmInfoSchema,Script.SharedWorkerRealmInfoSchema,Script.ServiceWorkerRealmInfoSchema,Script.WorkerRealmInfoSchema,Script.PaintWorkletRealmInfoSchema,Script.AudioWorkletRealmInfoSchema,Script.WorkletRealmInfoSchema])); } export namespace Script { export const @@ -958,10 +958,10 @@ z.object({ ); } export namespace Script { -export const RealmTypeSchema: z.ZodLazy> = z.lazy(() => z.enum(["window","dedicated-worker","shared-worker","service-worker","worker","paint-worklet","audio-worklet","worklet",])); +export const RealmTypeSchema: z.ZodLazy> = z.lazy(() => z.enum(["window","dedicated-worker","shared-worker","service-worker","worker","paint-worklet","audio-worklet","worklet",])); } export namespace Script { -export const RemoteReferenceSchema: z.ZodLazy> = z.lazy(() => z.union([Script.SharedReferenceSchema,Script.RemoteObjectReferenceSchema])); +export const RemoteReferenceSchema: z.ZodLazy> = z.lazy(() => z.union([Script.SharedReferenceSchema,Script.RemoteObjectReferenceSchema])); } export namespace Script { export const SharedReferenceSchema: z.ZodLazy,typeof Script.RemoteValueSchema], null>>> = z.lazy(() => z.array(z.tuple([ +z.ZodUnion,typeof Script.RemoteValueSchema], null>>> = z.lazy(() => z.array(z.tuple([ z.union([Script.RemoteValueSchema,z.string()]),Script.RemoteValueSchema]))); } export namespace Script { @@ -1090,7 +1090,7 @@ export const NodeRemoteValueSchema: z.ZodType = z.lazy(() => z.object({ export namespace Script { export const NodePropertiesSchema: z.ZodLazy>,"children":z.ZodOptional>,"localName":z.ZodOptional,"mode":z.ZodOptional>,"namespaceURI":z.ZodOptional,"nodeValue":z.ZodOptional,"shadowRoot":z.ZodOptional>}>> = z.lazy(() => z.object({ +z.ZodString,z.ZodString>>,"children":z.ZodOptional>,"localName":z.ZodOptional,"mode":z.ZodOptional>,"namespaceURI":z.ZodOptional,"nodeValue":z.ZodOptional,"shadowRoot":z.ZodOptional>}>> = z.lazy(() => z.object({ "nodeType":JsUintSchema,"childNodeCount":JsUintSchema,"attributes":z.record( z.string(),z.string()).optional(),"children":z.array(Script.NodeRemoteValueSchema).optional(),"localName":z.string().optional(),"mode":z.enum(["open","closed",]).optional(),"namespaceURI":z.string().optional(),"nodeValue":z.string().optional(),"shadowRoot":z.union([Script.NodeRemoteValueSchema,z.null()]).optional()})); } @@ -1105,11 +1105,11 @@ export const WindowProxyPropertiesSchema: z.ZodLazy> = z.lazy(() => z.enum(["root","none",])); +export const ResultOwnershipSchema: z.ZodLazy> = z.lazy(() => z.enum(["root","none",])); } export namespace Script { export const SerializationOptionsSchema: z.ZodLazy>>,"maxObjectDepth":z.ZodOptional>>,"includeShadowTree":z.ZodOptional>>}>> = z.lazy(() => z.object({ +"maxDomDepth":z.ZodOptional>>,"maxObjectDepth":z.ZodOptional>>,"includeShadowTree":z.ZodOptional>>}>> = z.lazy(() => z.object({ "maxDomDepth":z.union([JsUintSchema,z.null()]).default(0).optional(),"maxObjectDepth":z.union([JsUintSchema,z.null()]).default(null).optional(),"includeShadowTree":z.enum(["none","open","all",]).default("none").optional()})); } export namespace Script { @@ -1141,7 +1141,7 @@ export const ContextTargetSchema: z.ZodLazy> = z.lazy(() => z.union([Script.RealmTargetSchema,Script.ContextTargetSchema])); +export const TargetSchema: z.ZodLazy> = z.lazy(() => z.union([Script.RealmTargetSchema,Script.ContextTargetSchema])); } export namespace Script { export const @@ -1151,7 +1151,7 @@ AddPreloadScriptSchema: z.ZodLazy>,"contexts":z.ZodOptional>,"sandbox":z.ZodOptional}>> = z.lazy(() => z.object({ +"functionDeclaration":z.ZodString,"arguments":z.ZodOptional>,"contexts":z.ZodOptional>,"sandbox":z.ZodOptional}>> = z.lazy(() => z.object({ "functionDeclaration":z.string(),"arguments":z.array(Script.ChannelValueSchema).optional(),"contexts":z.array(BrowsingContext.BrowsingContextSchema).nonempty().optional(),"sandbox":z.string().optional()})); } export namespace Script { @@ -1250,15 +1250,15 @@ export const RealmDestroyedParametersSchema: z.ZodLazy = z.lazy(() => Log.EntryAddedSchema); export namespace Log { -export const LevelSchema: z.ZodLazy> = z.lazy(() => z.enum(["debug","info","warn","error",])); +export const LevelSchema: z.ZodLazy> = z.lazy(() => z.enum(["debug","info","warn","error",])); } export namespace Log { -export const EntrySchema: z.ZodLazy> = z.lazy(() => z.union([Log.GenericLogEntrySchema,Log.ConsoleLogEntrySchema,Log.JavascriptLogEntrySchema])); +export const EntrySchema: z.ZodLazy> = z.lazy(() => z.union([Log.GenericLogEntrySchema,Log.ConsoleLogEntrySchema,Log.JavascriptLogEntrySchema])); } export namespace Log { export const BaseLogEntrySchema: z.ZodLazy,"timestamp":typeof JsUintSchema,"stackTrace":z.ZodOptional}>> = z.lazy(() => z.object({ +"level":typeof Log.LevelSchema,"source":typeof Script.SourceSchema,"text":z.ZodUnion,"timestamp":typeof JsUintSchema,"stackTrace":z.ZodOptional}>> = z.lazy(() => z.object({ "level":Log.LevelSchema,"source":Script.SourceSchema,"text":z.union([z.string(),z.null()]),"timestamp":JsUintSchema,"stackTrace":Script.StackTraceSchema.optional()})); } export namespace Log { @@ -1289,7 +1289,7 @@ EntryAddedSchema: z.ZodLazy> = z.lazy(() => z.union([Input.PerformActionsSchema,Input.ReleaseActionsSchema])); +InputCommandSchema: z.ZodLazy> = z.lazy(() => z.union([Input.PerformActionsSchema,Input.ReleaseActionsSchema])); export namespace Input { export const ElementOriginSchema: z.ZodLazy,"element":typeof Script.SharedReferenceSchema}>> = z.lazy(() => z.object({ @@ -1307,7 +1307,7 @@ export const PerformActionsParametersSchema: z.ZodLazy> = z.lazy(() => z.union([Input.NoneSourceActionsSchema,Input.KeySourceActionsSchema,Input.PointerSourceActionsSchema,Input.WheelSourceActionsSchema])); +export const SourceActionsSchema: z.ZodLazy> = z.lazy(() => z.union([Input.NoneSourceActionsSchema,Input.KeySourceActionsSchema,Input.PointerSourceActionsSchema,Input.WheelSourceActionsSchema])); } export namespace Input { export const NoneSourceActionsSchema: z.ZodLazy> = z.lazy(() => z.union([Input.PauseActionSchema,Input.KeyDownActionSchema,Input.KeyUpActionSchema])); +export const KeySourceActionSchema: z.ZodLazy> = z.lazy(() => z.union([Input.PauseActionSchema,Input.KeyDownActionSchema,Input.KeyUpActionSchema])); } export namespace Input { export const PointerSourceActionsSchema: z.ZodLazy> = z.lazy(() => z.enum(["mouse","pen","touch",])); +export const PointerTypeSchema: z.ZodLazy> = z.lazy(() => z.enum(["mouse","pen","touch",])); } export namespace Input { export const PointerParametersSchema: z.ZodLazy> = z.lazy(() => z.union([Input.PauseActionSchema,Input.PointerDownActionSchema,Input.PointerUpActionSchema,Input.PointerMoveActionSchema])); +export const PointerSourceActionSchema: z.ZodLazy> = z.lazy(() => z.union([Input.PauseActionSchema,Input.PointerDownActionSchema,Input.PointerUpActionSchema,Input.PointerMoveActionSchema])); } export namespace Input { export const WheelSourceActionsSchema: z.ZodLazy> = z.lazy(() => z.union([Input.PauseActionSchema,Input.WheelScrollActionSchema])); +export const WheelSourceActionSchema: z.ZodLazy> = z.lazy(() => z.union([Input.PauseActionSchema,Input.WheelScrollActionSchema])); } export namespace Input { export const PauseActionSchema: z.ZodLazy,z.ZodLiteral<"pointer">,typeof Input.ElementOriginSchema]>> = z.lazy(() => z.union([z.literal("viewport"),z.literal("pointer"),Input.ElementOriginSchema])); +export const OriginSchema: z.ZodLazy,z.ZodLiteral<"pointer">,typeof Input.ElementOriginSchema]>> = z.lazy(() => z.union([z.literal("viewport"),z.literal("pointer"),Input.ElementOriginSchema])); } export namespace Input { export const diff --git a/tests/snapshots/zod__it_works_with_enums-2.snap b/tests/snapshots/zod__it_works_with_enums-2.snap index c06a570..431a6a0 100644 --- a/tests/snapshots/zod__it_works_with_enums-2.snap +++ b/tests/snapshots/zod__it_works_with_enums-2.snap @@ -2,9 +2,9 @@ source: tests/zod.rs expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" --- -export const QEnumSchema: z.ZodLazy> = z.lazy(() => z.enum(["qValue","qValue2",])); +export const QEnumSchema: z.ZodLazy> = z.lazy(() => z.enum(["qValue","qValue2",])); export namespace Network { -export const SameSiteSchema: z.ZodLazy> = z.lazy(() => z.enum(["strict","lax","none",])); +export const SameSiteSchema: z.ZodLazy> = z.lazy(() => z.enum(["strict","lax","none",])); } export namespace Network { export const CookieSchema: z.ZodLazy,z.ZodUnion<[z.ZodObject<{ +"foo":z.ZodString}>,z.ZodUnion,z.ZodObject<{}>]>>> = z.lazy(() => z.object({ "foo":z.string()}).and( z.object({ "bar":z.string()}).or(z.object({}))) ); export const BSchema: z.ZodLazy,z.ZodUnion<[typeof BarSchema,z.ZodObject<{}>]>>> = z.lazy(() => z.object({ +"foo":z.ZodString}>,z.ZodUnion]>>> = z.lazy(() => z.object({ "foo":z.string()}).and( BarSchema.or(z.object({}))) ); diff --git a/tests/snapshots/zod__it_works_with_simple_optional_groups-2.snap b/tests/snapshots/zod__it_works_with_simple_optional_groups-2.snap index da15190..135ef5a 100644 --- a/tests/snapshots/zod__it_works_with_simple_optional_groups-2.snap +++ b/tests/snapshots/zod__it_works_with_simple_optional_groups-2.snap @@ -4,7 +4,7 @@ expression: "String :: from_utf8(stdout.into_inner().unwrap()).unwrap()" --- export namespace Bluetooth { export const HandleRequestDevicePromptParametersSchema: z.ZodLazy,z.ZodUnion<[typeof Bluetooth.HandleRequestDevicePromptAcceptParametersSchema,typeof Bluetooth.HandleRequestDevicePromptCancelParametersSchema]>>> = z.lazy(() => z.object({ +"context":z.ZodString,"prompt":z.ZodString}>,z.ZodUnion>> = z.lazy(() => z.object({ "context":z.string(),"prompt":z.string()}).and( z.union([Bluetooth.HandleRequestDevicePromptAcceptParametersSchema,Bluetooth.HandleRequestDevicePromptCancelParametersSchema])) ); diff --git a/tests/zod4.rs b/tests/zod4.rs deleted file mode 100644 index d9ae197..0000000 --- a/tests/zod4.rs +++ /dev/null @@ -1,51 +0,0 @@ -use std::io::BufWriter; - -use cddl::visitor::Visitor; -use cddlconv; - -macro_rules! test { - ($name:ident, $input:expr) => { - #[test] - fn $name() { - let input = std::fs::read_to_string($input).unwrap(); - let cddl = cddl::parser::cddl_from_str(&input, true).unwrap(); - let stdout = BufWriter::new(Vec::new()); - let stderr = BufWriter::new(Vec::new()); - let mut engine = cddlconv::engines::zod::Engine::with_writers_and_version( - stdout, - stderr, - cddlconv::engines::zod::Version::V4, - ); - engine.visit_cddl(&cddl).unwrap(); - engine.print_postamble(); - - let (stdout, stderr) = engine.into_writers(); - insta::assert_snapshot!(String::from_utf8(stderr.into_inner().unwrap()).unwrap()); - insta::assert_snapshot!(String::from_utf8(stdout.into_inner().unwrap()).unwrap()); - } - }; -} - -test!(it_works, "examples/webdriver-bidi/webdriver-bidi.cddl"); -test!(it_works_with_maps, "examples/rfc-examples/maps.cddl"); -test!( - it_works_with_amendments, - "examples/rfc-examples/colors.cddl" -); -test!( - it_works_with_prelude_text_types, - "examples/rfc-examples/prelude_text_types.cddl" -); -test!( - it_works_with_optional_groups, - "examples/optional_groups.cddl" -); -test!( - it_works_with_simple_optional_groups, - "examples/simple_optional_groups.cddl" -); -test!( - it_works_with_array_occurences, - "examples/array_occurences.cddl" -); -test!(it_works_with_enums, "examples/enums.cddl");