From dfe729ac6387b22524ce93e71c7e81e7ed67b302 Mon Sep 17 00:00:00 2001 From: NathanFallet Date: Fri, 10 Apr 2026 22:48:19 +0200 Subject: [PATCH 1/2] chore: update cdp --- .../dev/kdriver/cdp/domain/Accessibility.kt | 12 +++++++++++- .../kotlin/dev/kdriver/cdp/domain/Animation.kt | 13 ++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Audits.kt | 13 ++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Autofill.kt | 11 ++++++++++- .../dev/kdriver/cdp/domain/BackgroundService.kt | 12 +++++++++++- .../kdriver/cdp/domain/BluetoothEmulation.kt | 12 +++++++++++- .../kotlin/dev/kdriver/cdp/domain/Browser.kt | 13 ++++++++++++- .../kotlin/dev/kdriver/cdp/domain/CSS.kt | 15 ++++++++++++++- .../dev/kdriver/cdp/domain/CacheStorage.kt | 15 ++++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Cast.kt | 10 +++++++++- .../kotlin/dev/kdriver/cdp/domain/Console.kt | 11 ++++++++++- .../kotlin/dev/kdriver/cdp/domain/DOM.kt | 15 ++++++++++++++- .../dev/kdriver/cdp/domain/DOMDebugger.kt | 16 +++++++++++++++- .../dev/kdriver/cdp/domain/DOMSnapshot.kt | 17 ++++++++++++++++- .../kotlin/dev/kdriver/cdp/domain/DOMStorage.kt | 12 +++++++++++- .../kotlin/dev/kdriver/cdp/domain/Debugger.kt | 16 +++++++++++++++- .../dev/kdriver/cdp/domain/DeviceAccess.kt | 10 +++++++++- .../dev/kdriver/cdp/domain/DeviceOrientation.kt | 13 ++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Emulation.kt | 15 ++++++++++++++- .../dev/kdriver/cdp/domain/EventBreakpoints.kt | 13 ++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Extensions.kt | 14 +++++++++++++- .../kotlin/dev/kdriver/cdp/domain/FedCm.kt | 12 +++++++++++- .../kotlin/dev/kdriver/cdp/domain/Fetch.kt | 12 +++++++++++- .../kotlin/dev/kdriver/cdp/domain/FileSystem.kt | 14 +++++++++++++- .../kdriver/cdp/domain/HeadlessExperimental.kt | 16 +++++++++++++++- .../dev/kdriver/cdp/domain/HeapProfiler.kt | 14 +++++++++++++- .../kotlin/dev/kdriver/cdp/domain/IO.kt | 14 +++++++++++++- .../kotlin/dev/kdriver/cdp/domain/IndexedDB.kt | 16 +++++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Input.kt | 13 ++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Inspector.kt | 11 ++++++++++- .../kotlin/dev/kdriver/cdp/domain/LayerTree.kt | 14 +++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Log.kt | 12 +++++++++++- .../kotlin/dev/kdriver/cdp/domain/Media.kt | 14 +++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Memory.kt | 16 +++++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Network.kt | 16 +++++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Overlay.kt | 16 +++++++++++++++- .../kotlin/dev/kdriver/cdp/domain/PWA.kt | 15 ++++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Page.kt | 15 ++++++++++++++- .../dev/kdriver/cdp/domain/Performance.kt | 12 +++++++++++- .../kdriver/cdp/domain/PerformanceTimeline.kt | 13 ++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Preload.kt | 13 ++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Profiler.kt | 13 ++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Runtime.kt | 15 ++++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Schema.kt | 14 +++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Security.kt | 14 +++++++++++++- .../dev/kdriver/cdp/domain/ServiceWorker.kt | 13 ++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Storage.kt | 14 +++++++++++++- .../kotlin/dev/kdriver/cdp/domain/SystemInfo.kt | 17 ++++++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Target.kt | 14 +++++++++++++- .../kotlin/dev/kdriver/cdp/domain/Tethering.kt | 10 +++++++++- .../kotlin/dev/kdriver/cdp/domain/Tracing.kt | 13 ++++++++++++- .../kotlin/dev/kdriver/cdp/domain/WebAudio.kt | 10 +++++++++- .../kotlin/dev/kdriver/cdp/domain/WebAuthn.kt | 12 +++++++++++- 53 files changed, 662 insertions(+), 53 deletions(-) diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Accessibility.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Accessibility.kt index 8c27d1f73..3ab1f3af9 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Accessibility.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Accessibility.kt @@ -2,7 +2,17 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Animation.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Animation.kt index 55faeec81..de6ca1b46 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Animation.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Animation.kt @@ -2,7 +2,18 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Audits.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Audits.kt index ec54a71c3..42248d984 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Audits.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Audits.kt @@ -2,7 +2,18 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Autofill.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Autofill.kt index ecc68f1c3..70637a51b 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Autofill.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Autofill.kt @@ -2,7 +2,16 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/BackgroundService.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/BackgroundService.kt index b281db4b3..a42253d8c 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/BackgroundService.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/BackgroundService.kt @@ -2,7 +2,17 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/BluetoothEmulation.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/BluetoothEmulation.kt index 99cf27c11..600de4ae6 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/BluetoothEmulation.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/BluetoothEmulation.kt @@ -2,7 +2,17 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Browser.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Browser.kt index 50e0165e3..c64190859 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Browser.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Browser.kt @@ -2,7 +2,18 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CSS.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CSS.kt index 636dc6c34..a905a92c7 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CSS.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CSS.kt @@ -2,7 +2,20 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.collections.List +import kotlin.collections.Map import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CacheStorage.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CacheStorage.kt index 8d19ce273..d0caae982 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CacheStorage.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CacheStorage.kt @@ -2,7 +2,20 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Cast.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Cast.kt index ca87078ae..ac7f82145 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Cast.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Cast.kt @@ -2,7 +2,15 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Console.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Console.kt index 4a12b567e..969eefa82 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Console.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Console.kt @@ -2,13 +2,22 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Int +import kotlin.String +import kotlin.Suppress import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.map import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement +import kotlinx.serialization.json.encodeToJsonElement /** * This domain is deprecated - use Runtime or Log instead. diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOM.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOM.kt index 76475cb29..985bf3ee0 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOM.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOM.kt @@ -2,7 +2,20 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Deprecated +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMDebugger.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMDebugger.kt index b7d709953..7090a3538 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMDebugger.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMDebugger.kt @@ -2,7 +2,21 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Deprecated +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMSnapshot.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMSnapshot.kt index 6cb2a1bc2..44e4ab747 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMSnapshot.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMSnapshot.kt @@ -2,7 +2,22 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Deprecated +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMStorage.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMStorage.kt index 97ba8c5c4..71e944dc4 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMStorage.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMStorage.kt @@ -2,7 +2,17 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Debugger.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Debugger.kt index 9ff4205b0..83dfb2c7a 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Debugger.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Debugger.kt @@ -2,7 +2,21 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Deprecated +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.collections.List +import kotlin.collections.Map import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DeviceAccess.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DeviceAccess.kt index 17d627105..8470e80a3 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DeviceAccess.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DeviceAccess.kt @@ -2,7 +2,15 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DeviceOrientation.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DeviceOrientation.kt index 5d88bac05..7bcf39ce2 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DeviceOrientation.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DeviceOrientation.kt @@ -2,8 +2,19 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Double +import kotlin.Suppress +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map import kotlinx.serialization.Serializable +import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement public val CDP.deviceOrientation: DeviceOrientation diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Emulation.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Emulation.kt index 2f1216fcf..46480acc6 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Emulation.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Emulation.kt @@ -2,7 +2,20 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Deprecated +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/EventBreakpoints.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/EventBreakpoints.kt index 36cfa1ae6..0bc388b1f 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/EventBreakpoints.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/EventBreakpoints.kt @@ -2,8 +2,19 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.String +import kotlin.Suppress +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map import kotlinx.serialization.Serializable +import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement /** diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Extensions.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Extensions.kt index e0a718089..80e36c5df 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Extensions.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Extensions.kt @@ -2,7 +2,19 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List +import kotlin.collections.Map +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.JsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/FedCm.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/FedCm.kt index 580c66b1c..5d26fe494 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/FedCm.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/FedCm.kt @@ -2,7 +2,17 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Fetch.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Fetch.kt index 8f37df8a8..53c0fc929 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Fetch.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Fetch.kt @@ -2,7 +2,17 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/FileSystem.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/FileSystem.kt index d0812f066..96c70f7c4 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/FileSystem.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/FileSystem.kt @@ -2,7 +2,19 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Double +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/HeadlessExperimental.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/HeadlessExperimental.kt index e564ea8b9..51bde4a1d 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/HeadlessExperimental.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/HeadlessExperimental.kt @@ -2,7 +2,21 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Deprecated +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/HeapProfiler.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/HeapProfiler.kt index 42b82bba4..3a1d710ec 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/HeapProfiler.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/HeapProfiler.kt @@ -2,7 +2,19 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/IO.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/IO.kt index a8579e792..e901ad7e2 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/IO.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/IO.kt @@ -2,7 +2,19 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/IndexedDB.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/IndexedDB.kt index 048aacfeb..354039fd9 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/IndexedDB.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/IndexedDB.kt @@ -2,7 +2,21 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Input.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Input.kt index 6fa89c1db..608bf5f00 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Input.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Input.kt @@ -2,7 +2,18 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Inspector.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Inspector.kt index 8a2fc1177..9306f6b07 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Inspector.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Inspector.kt @@ -2,13 +2,22 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.String +import kotlin.Suppress +import kotlin.Unit import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.map import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement +import kotlinx.serialization.json.encodeToJsonElement public val CDP.inspector: Inspector get() = getGeneratedDomain() ?: cacheGeneratedDomain(Inspector(this)) diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/LayerTree.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/LayerTree.kt index 12af03ea7..948ac68c0 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/LayerTree.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/LayerTree.kt @@ -2,7 +2,19 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List +import kotlin.collections.Map import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Log.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Log.kt index 670c07976..c5dcc97b1 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Log.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Log.kt @@ -2,7 +2,17 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Media.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Media.kt index 6db1fa380..39af93d21 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Media.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Media.kt @@ -2,7 +2,18 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List +import kotlin.collections.Map import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -10,6 +21,7 @@ import kotlinx.coroutines.flow.map import kotlinx.serialization.Serializable import kotlinx.serialization.json.JsonElement import kotlinx.serialization.json.decodeFromJsonElement +import kotlinx.serialization.json.encodeToJsonElement /** * This domain allows detailed inspection of media elements diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Memory.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Memory.kt index 875cc8b74..04a777f78 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Memory.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Memory.kt @@ -2,7 +2,21 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Network.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Network.kt index f4b400279..8a51a859e 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Network.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Network.kt @@ -2,7 +2,21 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Deprecated +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.collections.List +import kotlin.collections.Map import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Overlay.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Overlay.kt index 4a69f1b42..aa9263a46 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Overlay.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Overlay.kt @@ -2,7 +2,21 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Deprecated +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.collections.List +import kotlin.collections.Map import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/PWA.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/PWA.kt index bb12c1df7..8556b81f1 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/PWA.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/PWA.kt @@ -2,7 +2,20 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Page.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Page.kt index ecfaf81e3..f5f3a60ee 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Page.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Page.kt @@ -2,7 +2,20 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Deprecated +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Performance.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Performance.kt index dcb791474..6a8a4ef57 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Performance.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Performance.kt @@ -2,7 +2,17 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Deprecated +import kotlin.Double +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/PerformanceTimeline.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/PerformanceTimeline.kt index 86225057a..93b0f821c 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/PerformanceTimeline.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/PerformanceTimeline.kt @@ -2,7 +2,18 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Preload.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Preload.kt index 2d5201ad7..48adaef56 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Preload.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Preload.kt @@ -2,7 +2,17 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -10,6 +20,7 @@ import kotlinx.coroutines.flow.map import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement +import kotlinx.serialization.json.encodeToJsonElement public val CDP.preload: Preload get() = getGeneratedDomain() ?: cacheGeneratedDomain(Preload(this)) diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Profiler.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Profiler.kt index a5ea4c408..2d5185966 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Profiler.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Profiler.kt @@ -2,7 +2,18 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Runtime.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Runtime.kt index 194b171f1..648895892 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Runtime.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Runtime.kt @@ -2,7 +2,20 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlin.collections.List +import kotlin.collections.Map import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Schema.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Schema.kt index b7c15bb56..5f60d662f 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Schema.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Schema.kt @@ -2,9 +2,21 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement +import kotlinx.serialization.json.encodeToJsonElement /** * This domain is deprecated. diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Security.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Security.kt index dbb20cb1e..159604091 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Security.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Security.kt @@ -2,7 +2,19 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Deprecated +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/ServiceWorker.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/ServiceWorker.kt index f83e3aa49..95e55cd84 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/ServiceWorker.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/ServiceWorker.kt @@ -2,7 +2,18 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Storage.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Storage.kt index 52d00e983..df1a2ed59 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Storage.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Storage.kt @@ -2,7 +2,19 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List +import kotlin.collections.Map import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/SystemInfo.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/SystemInfo.kt index 505aa3ad9..8b22abf70 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/SystemInfo.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/SystemInfo.kt @@ -2,7 +2,22 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List +import kotlin.collections.Map +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.JsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Target.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Target.kt index 7e0a31431..e2a4a1cd4 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Target.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Target.kt @@ -2,7 +2,19 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Deprecated +import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Tethering.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Tethering.kt index accd30eed..31522b863 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Tethering.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Tethering.kt @@ -2,7 +2,15 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Int +import kotlin.String +import kotlin.Suppress import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Tracing.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Tracing.kt index 74b78155a..7df0e6129 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Tracing.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Tracing.kt @@ -2,7 +2,18 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Double +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List +import kotlin.collections.Map import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebAudio.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebAudio.kt index 41eb35497..1e2e3c111 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebAudio.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebAudio.kt @@ -2,7 +2,15 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Double +import kotlin.String +import kotlin.Suppress import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebAuthn.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebAuthn.kt index 9d899c804..8c4711e06 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebAuthn.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebAuthn.kt @@ -2,7 +2,17 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.* +import dev.kdriver.cdp.CDP +import dev.kdriver.cdp.CommandMode +import dev.kdriver.cdp.Domain +import dev.kdriver.cdp.Serialization +import dev.kdriver.cdp.cacheGeneratedDomain +import dev.kdriver.cdp.getGeneratedDomain +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.Suppress +import kotlin.collections.List import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull From d726c4fd84dc64871a9938ce3c8a9a9cd51837d3 Mon Sep 17 00:00:00 2001 From: NathanFallet Date: Fri, 10 Apr 2026 23:25:05 +0200 Subject: [PATCH 2/2] updating for real this time (fixed schema url) --- .../kdriver/cdp/generate/CdpGeneratePlugin.kt | 17 +- .../dev/kdriver/cdp/domain/Accessibility.kt | 66 +- .../dev/kdriver/cdp/domain/Animation.kt | 17 +- .../kotlin/dev/kdriver/cdp/domain/Audits.kt | 291 ++-- .../kotlin/dev/kdriver/cdp/domain/Autofill.kt | 29 +- .../kdriver/cdp/domain/BackgroundService.kt | 12 +- .../kdriver/cdp/domain/BluetoothEmulation.kt | 12 +- .../kotlin/dev/kdriver/cdp/domain/Browser.kt | 46 +- .../kotlin/dev/kdriver/cdp/domain/CSS.kt | 146 +- .../dev/kdriver/cdp/domain/CacheStorage.kt | 15 +- .../kotlin/dev/kdriver/cdp/domain/Cast.kt | 10 +- .../kotlin/dev/kdriver/cdp/domain/Console.kt | 11 +- .../kdriver/cdp/domain/CrashReportContext.kt | 47 + .../kotlin/dev/kdriver/cdp/domain/DOM.kt | 100 +- .../dev/kdriver/cdp/domain/DOMDebugger.kt | 16 +- .../dev/kdriver/cdp/domain/DOMSnapshot.kt | 17 +- .../dev/kdriver/cdp/domain/DOMStorage.kt | 12 +- .../kotlin/dev/kdriver/cdp/domain/Debugger.kt | 16 +- .../dev/kdriver/cdp/domain/DeviceAccess.kt | 10 +- .../kdriver/cdp/domain/DeviceOrientation.kt | 13 +- .../dev/kdriver/cdp/domain/Emulation.kt | 438 +++++- .../kdriver/cdp/domain/EventBreakpoints.kt | 13 +- .../dev/kdriver/cdp/domain/Extensions.kt | 101 +- .../kotlin/dev/kdriver/cdp/domain/FedCm.kt | 12 +- .../kotlin/dev/kdriver/cdp/domain/Fetch.kt | 12 +- .../dev/kdriver/cdp/domain/FileSystem.kt | 14 +- .../cdp/domain/HeadlessExperimental.kt | 16 +- .../dev/kdriver/cdp/domain/HeapProfiler.kt | 21 +- .../kotlin/dev/kdriver/cdp/domain/IO.kt | 14 +- .../dev/kdriver/cdp/domain/IndexedDB.kt | 24 +- .../kotlin/dev/kdriver/cdp/domain/Input.kt | 13 +- .../dev/kdriver/cdp/domain/Inspector.kt | 21 +- .../dev/kdriver/cdp/domain/LayerTree.kt | 14 +- .../kotlin/dev/kdriver/cdp/domain/Log.kt | 12 +- .../kotlin/dev/kdriver/cdp/domain/Media.kt | 40 +- .../kotlin/dev/kdriver/cdp/domain/Memory.kt | 16 +- .../kotlin/dev/kdriver/cdp/domain/Network.kt | 1225 +++++++++++++---- .../kotlin/dev/kdriver/cdp/domain/Overlay.kt | 103 +- .../kotlin/dev/kdriver/cdp/domain/PWA.kt | 21 +- .../kotlin/dev/kdriver/cdp/domain/Page.kt | 146 +- .../dev/kdriver/cdp/domain/Performance.kt | 12 +- .../kdriver/cdp/domain/PerformanceTimeline.kt | 13 +- .../kotlin/dev/kdriver/cdp/domain/Preload.kt | 25 +- .../kotlin/dev/kdriver/cdp/domain/Profiler.kt | 13 +- .../kotlin/dev/kdriver/cdp/domain/Runtime.kt | 15 +- .../kotlin/dev/kdriver/cdp/domain/Security.kt | 20 +- .../dev/kdriver/cdp/domain/ServiceWorker.kt | 13 +- .../kdriver/cdp/domain/SmartCardEmulation.kt | 1062 ++++++++++++++ .../kotlin/dev/kdriver/cdp/domain/Storage.kt | 619 +-------- .../dev/kdriver/cdp/domain/SystemInfo.kt | 45 +- .../kotlin/dev/kdriver/cdp/domain/Target.kt | 96 +- .../dev/kdriver/cdp/domain/Tethering.kt | 10 +- .../kotlin/dev/kdriver/cdp/domain/Tracing.kt | 30 +- .../kotlin/dev/kdriver/cdp/domain/WebAudio.kt | 10 +- .../kotlin/dev/kdriver/cdp/domain/WebAuthn.kt | 27 +- .../kotlin/dev/kdriver/cdp/domain/WebMCP.kt | 214 +++ 56 files changed, 3759 insertions(+), 1644 deletions(-) create mode 100644 cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CrashReportContext.kt create mode 100644 cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/SmartCardEmulation.kt create mode 100644 cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebMCP.kt diff --git a/cdp-generate/src/main/kotlin/dev/kdriver/cdp/generate/CdpGeneratePlugin.kt b/cdp-generate/src/main/kotlin/dev/kdriver/cdp/generate/CdpGeneratePlugin.kt index 21dc190c2..8fbd1b950 100644 --- a/cdp-generate/src/main/kotlin/dev/kdriver/cdp/generate/CdpGeneratePlugin.kt +++ b/cdp-generate/src/main/kotlin/dev/kdriver/cdp/generate/CdpGeneratePlugin.kt @@ -8,8 +8,15 @@ import java.net.URL class CdpGeneratePlugin : Plugin { - private val schemaUrl = - "https://raw.githubusercontent.com/ChromeDevTools/debugger-protocol-viewer/master/pages/_data/tot.json" + /* + As said on their repo's README: + > FYI: The protocol files here in debugger-protocol-viewer#master don't get updated. A deployment writes to the devtools-protocol#ghpages branch. + The protocol is now split into two files: browser_protocol.json and js_protocol.json. + */ + private val schemaUrls = listOf( + "https://raw.githubusercontent.com/ChromeDevTools/devtools-protocol/refs/heads/master/json/browser_protocol.json", + "https://raw.githubusercontent.com/ChromeDevTools/devtools-protocol/refs/heads/master/json/js_protocol.json", + ) override fun apply(project: Project) { project.tasks.register("generateCdp") { @@ -19,8 +26,10 @@ class CdpGeneratePlugin : Plugin { val destination = File(listOf(project.projectDir.path, "src", "commonMain", "kotlin").joinToString("/")) File(destination, listOf("dev", "kdriver", "cdp", "domain").joinToString("/")).deleteRecursively() - val json = JsonSlurper().parse(URL(schemaUrl)) as Map<*, *> - val domains = json["domains"] as List> + val domains = schemaUrls.flatMap { schemaUrl -> + val json = JsonSlurper().parse(URL(schemaUrl)) as Map<*, *> + json["domains"] as List> + } val parsed = domains.map { domain -> Domain( domain = domain["domain"] as String, diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Accessibility.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Accessibility.kt index 3ab1f3af9..7985a4f86 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Accessibility.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Accessibility.kt @@ -2,17 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -472,7 +462,8 @@ public class Accessibility( * - from 'live' to 'root': attributes which apply to nodes in live regions * - from 'autocomplete' to 'valuetext': attributes which apply to widgets * - from 'checked' to 'selected': states which apply to widgets - * - from 'activedescendant' to 'owns' - relationships between elements other than parent/child/sibling. + * - from 'activedescendant' to 'owns': relationships between elements other than parent/child/sibling + * - from 'activeFullscreenElement' to 'uninteresting': reasons why this noode is hidden */ @Serializable public enum class AXPropertyName { @@ -598,6 +589,57 @@ public class Accessibility( @SerialName("url") URL, + + @SerialName("activeFullscreenElement") + ACTIVEFULLSCREENELEMENT, + + @SerialName("activeModalDialog") + ACTIVEMODALDIALOG, + + @SerialName("activeAriaModalDialog") + ACTIVEARIAMODALDIALOG, + + @SerialName("ariaHiddenElement") + ARIAHIDDENELEMENT, + + @SerialName("ariaHiddenSubtree") + ARIAHIDDENSUBTREE, + + @SerialName("emptyAlt") + EMPTYALT, + + @SerialName("emptyText") + EMPTYTEXT, + + @SerialName("inertElement") + INERTELEMENT, + + @SerialName("inertSubtree") + INERTSUBTREE, + + @SerialName("labelContainer") + LABELCONTAINER, + + @SerialName("labelFor") + LABELFOR, + + @SerialName("notRendered") + NOTRENDERED, + + @SerialName("notVisible") + NOTVISIBLE, + + @SerialName("presentationalRole") + PRESENTATIONALROLE, + + @SerialName("probablyPresentational") + PROBABLYPRESENTATIONAL, + + @SerialName("inactiveCarouselTabContent") + INACTIVECAROUSELTABCONTENT, + + @SerialName("uninteresting") + UNINTERESTING, } /** diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Animation.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Animation.kt index de6ca1b46..3b59e58e7 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Animation.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Animation.kt @@ -2,18 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -339,9 +328,9 @@ public class Animation( */ public val iterationStart: Double, /** - * `AnimationEffect`'s iterations. + * `AnimationEffect`'s iterations. Omitted if the value is infinite. */ - public val iterations: Double, + public val iterations: Double? = null, /** * `AnimationEffect`'s iteration duration. * Milliseconds for time based animations and diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Audits.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Audits.kt index 42248d984..42b9acaa4 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Audits.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Audits.kt @@ -2,18 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -96,26 +85,6 @@ public class Audits( cdp.callCommand("Audits.enable", parameter, mode) } - /** - * Runs the contrast check for the target page. Found issues are reported - * using Audits.issueAdded event. - */ - public suspend fun checkContrast(args: CheckContrastParameter, mode: CommandMode = CommandMode.DEFAULT) { - val parameter = Serialization.json.encodeToJsonElement(args) - cdp.callCommand("Audits.checkContrast", parameter, mode) - } - - /** - * Runs the contrast check for the target page. Found issues are reported - * using Audits.issueAdded event. - * - * @param reportAAA Whether to report WCAG AAA level issues. Default is false. - */ - public suspend fun checkContrast(reportAAA: Boolean? = null) { - val parameter = CheckContrastParameter(reportAAA = reportAAA) - checkContrast(parameter) - } - /** * Runs the form issues check for the target page. Found issues are reported * using Audits.issueAdded event. @@ -173,12 +142,6 @@ public class Audits( @SerialName("ExcludeSameSiteStrict") EXCLUDESAMESITESTRICT, - @SerialName("ExcludeInvalidSameParty") - EXCLUDEINVALIDSAMEPARTY, - - @SerialName("ExcludeSamePartyCrossPartyContext") - EXCLUDESAMEPARTYCROSSPARTYCONTEXT, - @SerialName("ExcludeDomainNonASCII") EXCLUDEDOMAINNONASCII, @@ -307,6 +270,21 @@ public class Audits( public val insight: CookieIssueInsight? = null, ) + @Serializable + public enum class PerformanceIssueType { + @SerialName("DocumentCookie") + DOCUMENTCOOKIE, + } + + /** + * Details for a performance issue. + */ + @Serializable + public data class PerformanceIssueDetails( + public val performanceIssueType: PerformanceIssueType, + public val sourceCodeLocation: SourceCodeLocation? = null, + ) + @Serializable public enum class MixedContentResolutionStatus { @SerialName("MixedContentBlocked") @@ -591,17 +569,6 @@ public class Audits( public val type: SharedArrayBufferIssueType, ) - @Serializable - public data class LowTextContrastIssueDetails( - public val violatingNodeId: Int, - public val violatingNodeSelector: String, - public val contrastRatio: Double, - public val thresholdAA: Double, - public val thresholdAAA: Double, - public val fontSize: String, - public val fontWeight: String, - ) - /** * Details for a CORS related issue, e.g. a warning or error related to * CORS RFC1918 enforcement. @@ -718,12 +685,18 @@ public class Audits( @SerialName("WriteErrorInvalidStructuredHeader") WRITEERRORINVALIDSTRUCTUREDHEADER, + @SerialName("WriteErrorInvalidTTLField") + WRITEERRORINVALIDTTLFIELD, + @SerialName("WriteErrorNavigationRequest") WRITEERRORNAVIGATIONREQUEST, @SerialName("WriteErrorNoMatchField") WRITEERRORNOMATCHFIELD, + @SerialName("WriteErrorNonIntegerTTLField") + WRITEERRORNONINTEGERTTLFIELD, + @SerialName("WriteErrorNonListMatchDestField") WRITEERRORNONLISTMATCHDESTFIELD, @@ -836,6 +809,27 @@ public class Audits( INCORRECTDIGESTLENGTH, } + @Serializable + public enum class ConnectionAllowlistError { + @SerialName("InvalidHeader") + INVALIDHEADER, + + @SerialName("MoreThanOneList") + MORETHANONELIST, + + @SerialName("ItemNotInnerList") + ITEMNOTINNERLIST, + + @SerialName("InvalidAllowlistItemType") + INVALIDALLOWLISTITEMTYPE, + + @SerialName("ReportingEndpointNotToken") + REPORTINGENDPOINTNOTTOKEN, + + @SerialName("InvalidUrlPattern") + INVALIDURLPATTERN, + } + /** * Details for issues around "Attribution Reporting API" usage. * Explainer: https://github.com/WICG/attribution-reporting-api @@ -891,6 +885,12 @@ public class Audits( public val request: AffectedRequest, ) + @Serializable + public data class ConnectionAllowlistIssueDetails( + public val error: ConnectionAllowlistError, + public val request: AffectedRequest, + ) + @Serializable public enum class GenericIssueErrorType { @SerialName("FormLabelForNameError") @@ -908,14 +908,14 @@ public class Audits( @SerialName("FormEmptyIdAndNameAttributesForInputError") FORMEMPTYIDANDNAMEATTRIBUTESFORINPUTERROR, - @SerialName("FormAriaLabelledByToNonExistingId") - FORMARIALABELLEDBYTONONEXISTINGID, + @SerialName("FormAriaLabelledByToNonExistingIdError") + FORMARIALABELLEDBYTONONEXISTINGIDERROR, @SerialName("FormInputAssignedAutocompleteValueToIdOrNameAttributeError") FORMINPUTASSIGNEDAUTOCOMPLETEVALUETOIDORNAMEATTRIBUTEERROR, - @SerialName("FormLabelHasNeitherForNorNestedInput") - FORMLABELHASNEITHERFORNORNESTEDINPUT, + @SerialName("FormLabelHasNeitherForNorNestedInputError") + FORMLABELHASNEITHERFORNORNESTEDINPUTERROR, @SerialName("FormLabelForMatchesNonExistingIdError") FORMLABELFORMATCHESNONEXISTINGIDERROR, @@ -925,6 +925,21 @@ public class Audits( @SerialName("ResponseWasBlockedByORB") RESPONSEWASBLOCKEDBYORB, + + @SerialName("NavigationEntryMarkedSkippable") + NAVIGATIONENTRYMARKEDSKIPPABLE, + + @SerialName("AutofillAndManualTextPolicyControlledFeaturesInfo") + AUTOFILLANDMANUALTEXTPOLICYCONTROLLEDFEATURESINFO, + + @SerialName("AutofillPolicyControlledFeatureInfo") + AUTOFILLPOLICYCONTROLLEDFEATUREINFO, + + @SerialName("ManualTextPolicyControlledFeatureInfo") + MANUALTEXTPOLICYCONTROLLEDFEATUREINFO, + + @SerialName("FormModelContextParameterMissingTitleAndDescription") + FORMMODELCONTEXTPARAMETERMISSINGTITLEANDDESCRIPTION, } /** @@ -1044,18 +1059,6 @@ public class Audits( @SerialName("ConfigInvalidContentType") CONFIGINVALIDCONTENTTYPE, - @SerialName("ClientMetadataHttpNotFound") - CLIENTMETADATAHTTPNOTFOUND, - - @SerialName("ClientMetadataNoResponse") - CLIENTMETADATANORESPONSE, - - @SerialName("ClientMetadataInvalidResponse") - CLIENTMETADATAINVALIDRESPONSE, - - @SerialName("ClientMetadataInvalidContentType") - CLIENTMETADATAINVALIDCONTENTTYPE, - @SerialName("IdpNotPotentiallyTrustworthy") IDPNOTPOTENTIALLYTRUSTWORTHY, @@ -1119,9 +1122,6 @@ public class Audits( @SerialName("SilentMediationFailure") SILENTMEDIATIONFAILURE, - @SerialName("ThirdPartyCookiesBlocked") - THIRDPARTYCOOKIESBLOCKED, - @SerialName("NotSignedInWithIdp") NOTSIGNEDINWITHIDP, @@ -1131,9 +1131,6 @@ public class Audits( @SerialName("ReplacedByActiveMode") REPLACEDBYACTIVEMODE, - @SerialName("InvalidFieldsSpecified") - INVALIDFIELDSSPECIFIED, - @SerialName("RelyingPartyOriginIsOpaque") RELYINGPARTYORIGINISOPAQUE, @@ -1357,6 +1354,129 @@ public class Audits( public val sourceCodeLocation: SourceCodeLocation? = null, ) + @Serializable + public enum class PermissionElementIssueType { + @SerialName("InvalidType") + INVALIDTYPE, + + @SerialName("FencedFrameDisallowed") + FENCEDFRAMEDISALLOWED, + + @SerialName("CspFrameAncestorsMissing") + CSPFRAMEANCESTORSMISSING, + + @SerialName("PermissionsPolicyBlocked") + PERMISSIONSPOLICYBLOCKED, + + @SerialName("PaddingRightUnsupported") + PADDINGRIGHTUNSUPPORTED, + + @SerialName("PaddingBottomUnsupported") + PADDINGBOTTOMUNSUPPORTED, + + @SerialName("InsetBoxShadowUnsupported") + INSETBOXSHADOWUNSUPPORTED, + + @SerialName("RequestInProgress") + REQUESTINPROGRESS, + + @SerialName("UntrustedEvent") + UNTRUSTEDEVENT, + + @SerialName("RegistrationFailed") + REGISTRATIONFAILED, + + @SerialName("TypeNotSupported") + TYPENOTSUPPORTED, + + @SerialName("InvalidTypeActivation") + INVALIDTYPEACTIVATION, + + @SerialName("SecurityChecksFailed") + SECURITYCHECKSFAILED, + + @SerialName("ActivationDisabled") + ACTIVATIONDISABLED, + + @SerialName("GeolocationDeprecated") + GEOLOCATIONDEPRECATED, + + @SerialName("InvalidDisplayStyle") + INVALIDDISPLAYSTYLE, + + @SerialName("NonOpaqueColor") + NONOPAQUECOLOR, + + @SerialName("LowContrast") + LOWCONTRAST, + + @SerialName("FontSizeTooSmall") + FONTSIZETOOSMALL, + + @SerialName("FontSizeTooLarge") + FONTSIZETOOLARGE, + + @SerialName("InvalidSizeValue") + INVALIDSIZEVALUE, + } + + /** + * This issue warns about improper usage of the element. + */ + @Serializable + public data class PermissionElementIssueDetails( + public val issueType: PermissionElementIssueType, + /** + * The value of the type attribute. + */ + public val type: String? = null, + /** + * The node ID of the element. + */ + public val nodeId: Int? = null, + /** + * True if the issue is a warning, false if it is an error. + */ + public val isWarning: Boolean? = null, + /** + * Fields for message construction: + * Used for messages that reference a specific permission name + */ + public val permissionName: String? = null, + /** + * Used for messages about occlusion + */ + public val occluderNodeInfo: String? = null, + /** + * Used for messages about occluder's parent + */ + public val occluderParentNodeInfo: String? = null, + /** + * Used for messages about activation disabled reason + */ + public val disableReason: String? = null, + ) + + /** + * The issue warns about blocked calls to privacy sensitive APIs via the + * Selective Permissions Intervention. + */ + @Serializable + public data class SelectivePermissionsInterventionIssueDetails( + /** + * Which API was intervened on. + */ + public val apiName: String, + /** + * Why the ad script using the API is considered an ad. + */ + public val adAncestry: Network.AdAncestry, + /** + * The stack trace at the time of the intervention. + */ + public val stackTrace: Runtime.StackTrace? = null, + ) + /** * A unique identifier for the type of issue. Each type may use one of the * optional fields in InspectorIssueDetails to convey more specific @@ -1382,9 +1502,6 @@ public class Audits( @SerialName("SharedArrayBufferIssue") SHAREDARRAYBUFFERISSUE, - @SerialName("LowTextContrastIssue") - LOWTEXTCONTRASTISSUE, - @SerialName("CorsIssue") CORSISSUE, @@ -1439,8 +1556,20 @@ public class Audits( @SerialName("UnencodedDigestIssue") UNENCODEDDIGESTISSUE, + @SerialName("ConnectionAllowlistIssue") + CONNECTIONALLOWLISTISSUE, + @SerialName("UserReidentificationIssue") USERREIDENTIFICATIONISSUE, + + @SerialName("PermissionElementIssue") + PERMISSIONELEMENTISSUE, + + @SerialName("PerformanceIssue") + PERFORMANCEISSUE, + + @SerialName("SelectivePermissionsInterventionIssue") + SELECTIVEPERMISSIONSINTERVENTIONISSUE, } /** @@ -1456,7 +1585,6 @@ public class Audits( public val heavyAdIssueDetails: HeavyAdIssueDetails? = null, public val contentSecurityPolicyIssueDetails: ContentSecurityPolicyIssueDetails? = null, public val sharedArrayBufferIssueDetails: SharedArrayBufferIssueDetails? = null, - public val lowTextContrastIssueDetails: LowTextContrastIssueDetails? = null, public val corsIssueDetails: CorsIssueDetails? = null, public val attributionReportingIssueDetails: AttributionReportingIssueDetails? = null, public val quirksModeIssueDetails: QuirksModeIssueDetails? = null, @@ -1477,7 +1605,12 @@ public class Audits( public val elementAccessibilityIssueDetails: ElementAccessibilityIssueDetails? = null, public val sriMessageSignatureIssueDetails: SRIMessageSignatureIssueDetails? = null, public val unencodedDigestIssueDetails: UnencodedDigestIssueDetails? = null, + public val connectionAllowlistIssueDetails: ConnectionAllowlistIssueDetails? = null, public val userReidentificationIssueDetails: UserReidentificationIssueDetails? = null, + public val permissionElementIssueDetails: PermissionElementIssueDetails? = null, + public val performanceIssueDetails: PerformanceIssueDetails? = null, + public val selectivePermissionsInterventionIssueDetails: + SelectivePermissionsInterventionIssueDetails? = null, ) /** @@ -1535,14 +1668,6 @@ public class Audits( public val encodedSize: Int, ) - @Serializable - public data class CheckContrastParameter( - /** - * Whether to report WCAG AAA level issues. Default is false. - */ - public val reportAAA: Boolean? = null, - ) - @Serializable public data class CheckFormsIssuesReturn( public val formIssues: List, diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Autofill.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Autofill.kt index 70637a51b..f99bd6f59 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Autofill.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Autofill.kt @@ -2,16 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -58,14 +49,16 @@ public class Autofill( * * @param fieldId Identifies a field that serves as an anchor for autofill. * @param frameId Identifies the frame that field belongs to. - * @param card Credit card information to fill out the form. Credit card data is not saved. + * @param card Credit card information to fill out the form. Credit card data is not saved. Mutually exclusive with `address`. + * @param address Address to fill out the form. Address data is not saved. Mutually exclusive with `card`. */ public suspend fun trigger( fieldId: Int, frameId: String? = null, - card: CreditCard, + card: CreditCard? = null, + address: Address? = null, ) { - val parameter = TriggerParameter(fieldId = fieldId, frameId = frameId, card = card) + val parameter = TriggerParameter(fieldId = fieldId, frameId = frameId, card = card, address = address) trigger(parameter) } @@ -131,6 +124,8 @@ public class Autofill( public data class AddressField( /** * address field name, for example GIVEN_NAME. + * The full list of supported field names: + * https://source.chromium.org/chromium/chromium/src/+/main:components/autofill/core/browser/field_types.cc;l=38 */ public val name: String, /** @@ -247,9 +242,13 @@ public class Autofill( */ public val frameId: String? = null, /** - * Credit card information to fill out the form. Credit card data is not saved. + * Credit card information to fill out the form. Credit card data is not saved. Mutually exclusive with `address`. */ - public val card: CreditCard, + public val card: CreditCard? = null, + /** + * Address to fill out the form. Address data is not saved. Mutually exclusive with `card`. + */ + public val address: Address? = null, ) @Serializable diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/BackgroundService.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/BackgroundService.kt index a42253d8c..b281db4b3 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/BackgroundService.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/BackgroundService.kt @@ -2,17 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/BluetoothEmulation.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/BluetoothEmulation.kt index 600de4ae6..99cf27c11 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/BluetoothEmulation.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/BluetoothEmulation.kt @@ -2,17 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Browser.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Browser.kt index c64190859..a257da6a9 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Browser.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Browser.kt @@ -2,18 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -56,7 +45,7 @@ public class Browser( .map { Serialization.json.decodeFromJsonElement(it) } /** - * Set permission settings for given origin. + * Set permission settings for given embedding and embedded origins. */ public suspend fun setPermission(args: SetPermissionParameter, mode: CommandMode = CommandMode.DEFAULT) { val parameter = Serialization.json.encodeToJsonElement(args) @@ -64,43 +53,52 @@ public class Browser( } /** - * Set permission settings for given origin. + * Set permission settings for given embedding and embedded origins. * * @param permission Descriptor of permission to override. * @param setting Setting of the permission. - * @param origin Origin the permission applies to, all origins if not specified. + * @param origin Embedding origin the permission applies to, all origins if not specified. + * @param embeddedOrigin Embedded origin the permission applies to. It is ignored unless the embedding origin is + * present and valid. If the embedding origin is provided but the embedded origin isn't, the + * embedding origin is used as the embedded origin. * @param browserContextId Context to override. When omitted, default browser context is used. */ public suspend fun setPermission( permission: PermissionDescriptor, setting: PermissionSetting, origin: String? = null, + embeddedOrigin: String? = null, browserContextId: String? = null, ) { val parameter = SetPermissionParameter( permission = permission, setting = setting, origin = origin, + embeddedOrigin = embeddedOrigin, browserContextId = browserContextId ) setPermission(parameter) } /** - * Grant specific permissions to the given origin and reject all others. + * Grant specific permissions to the given origin and reject all others. Deprecated. Use + * setPermission instead. */ + @Deprecated(message = "") public suspend fun grantPermissions(args: GrantPermissionsParameter, mode: CommandMode = CommandMode.DEFAULT) { val parameter = Serialization.json.encodeToJsonElement(args) cdp.callCommand("Browser.grantPermissions", parameter, mode) } /** - * Grant specific permissions to the given origin and reject all others. + * Grant specific permissions to the given origin and reject all others. Deprecated. Use + * setPermission instead. * * @param permissions No description * @param origin Origin the permission applies to, all origins if not specified. * @param browserContextId BrowserContext to override permissions. When omitted, default browser context is used. */ + @Deprecated(message = "") public suspend fun grantPermissions( permissions: List, origin: String? = null, @@ -565,9 +563,15 @@ public class Browser( @SerialName("localFonts") LOCALFONTS, + @SerialName("localNetwork") + LOCALNETWORK, + @SerialName("localNetworkAccess") LOCALNETWORKACCESS, + @SerialName("loopbackNetwork") + LOOPBACKNETWORK, + @SerialName("midi") MIDI, @@ -804,9 +808,15 @@ public class Browser( */ public val setting: PermissionSetting, /** - * Origin the permission applies to, all origins if not specified. + * Embedding origin the permission applies to, all origins if not specified. */ public val origin: String? = null, + /** + * Embedded origin the permission applies to. It is ignored unless the embedding origin is + * present and valid. If the embedding origin is provided but the embedded origin isn't, the + * embedding origin is used as the embedded origin. + */ + public val embeddedOrigin: String? = null, /** * Context to override. When omitted, default browser context is used. */ diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CSS.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CSS.kt index a905a92c7..e225b5024 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CSS.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CSS.kt @@ -2,20 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.Unit -import kotlin.collections.List -import kotlin.collections.Map +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -299,6 +286,8 @@ public class CSS( * to the provided property syntax, the value is parsed using combined * syntax as if null `propertyName` was provided. If the value cannot be * resolved even then, return the provided value without any changes. + * Note: this function currently does not resolve CSS random() function, + * it returns unmodified random() function parts.` */ public suspend fun resolveValues( args: ResolveValuesParameter, @@ -319,6 +308,8 @@ public class CSS( * to the provided property syntax, the value is parsed using combined * syntax as if null `propertyName` was provided. If the value cannot be * resolved even then, return the provided value without any changes. + * Note: this function currently does not resolve CSS random() function, + * it returns unmodified random() function parts.` * * @param values Cascade-dependent keywords (revert/revert-layer) do not work. * @param nodeId Id of the node in whose context the expression is evaluated @@ -799,6 +790,34 @@ public class CSS( return setSupportsText(parameter) } + /** + * Modifies the expression of a navigation at-rule. + */ + public suspend fun setNavigationText( + args: SetNavigationTextParameter, + mode: CommandMode = CommandMode.DEFAULT, + ): SetNavigationTextReturn { + val parameter = Serialization.json.encodeToJsonElement(args) + val result = cdp.callCommand("CSS.setNavigationText", parameter, mode) + return result!!.let { Serialization.json.decodeFromJsonElement(it) } + } + + /** + * Modifies the expression of a navigation at-rule. + * + * @param styleSheetId No description + * @param range No description + * @param text No description + */ + public suspend fun setNavigationText( + styleSheetId: String, + range: SourceRange, + text: String, + ): SetNavigationTextReturn { + val parameter = SetNavigationTextParameter(styleSheetId = styleSheetId, range = range, text = text) + return setNavigationText(parameter) + } + /** * Modifies the expression of a scope at-rule. */ @@ -1233,6 +1252,10 @@ public class CSS( * Associated style declaration. */ public val style: CSSStyle, + /** + * The BackendNodeId of the DOM node that constitutes the origin tree scope of this rule. + */ + public val originTreeScopeNodeId: Int? = null, /** * Media list array (for rules involving media queries). The array enumerates media queries * starting with the innermost one, going outwards. @@ -1267,6 +1290,11 @@ public class CSS( * The array enumerates @starting-style at-rules starting with the innermost one, going outwards. */ public val startingStyles: List? = null, + /** + * @navigation CSS at-rule array. + * The array enumerates @navigation at-rules starting with the innermost one, going outwards. + */ + public val navigations: List? = null, ) /** @@ -1295,6 +1323,9 @@ public class CSS( @SerialName("StartingStyleRule") STARTINGSTYLERULE, + + @SerialName("NavigationRule") + NAVIGATIONRULE, } /** @@ -1372,6 +1403,16 @@ public class CSS( public val `value`: String, ) + @Serializable + public data class ComputedStyleExtraFields( + /** + * Returns whether or not this node is being rendered with base appearance, + * which happens when it has its appearance property set to base/base-select + * or it is in the subtree of an element being rendered with base appearance. + */ + public val isAppearanceBase: Boolean, + ) + /** * CSS style representation. */ @@ -1585,6 +1626,30 @@ public class CSS( public val styleSheetId: String? = null, ) + /** + * CSS Navigation at-rule descriptor. + */ + @Serializable + public data class CSSNavigation( + /** + * Navigation rule text. + */ + public val text: String, + /** + * Whether the navigation condition is satisfied. + */ + public val active: Boolean? = null, + /** + * The associated rule header range in the enclosing stylesheet (if + * available). + */ + public val range: SourceRange? = null, + /** + * Identifier of the stylesheet containing this object (if exists). + */ + public val styleSheetId: String? = null, + ) + /** * CSS Scope at-rule descriptor. */ @@ -1831,10 +1896,23 @@ public class CSS( ) /** - * CSS font-palette-values rule representation. + * CSS generic @rule representation. */ @Serializable - public data class CSSFontPaletteValuesRule( + public data class CSSAtRule( + /** + * Type of at-rule. + */ + public val type: String, + /** + * Subsection of font-feature-values, if this is a subsection. + */ + public val subsection: String? = null, + /** + * LINT.ThenChange(//third_party/blink/renderer/core/inspector/inspector_style_sheet.cc:FontVariantAlternatesFeatureType,//third_party/blink/renderer/core/inspector/inspector_css_agent.cc:FontVariantAlternatesFeatureType) + * Associated name, if applicable. + */ + public val name: Value? = null, /** * The css style sheet identifier (absent for user agent stylesheet and user-specified * stylesheet rules) this rule came from. @@ -1844,10 +1922,6 @@ public class CSS( * Parent stylesheet's origin. */ public val origin: StyleSheetOrigin, - /** - * Associated font palette name. - */ - public val fontPaletteName: Value, /** * Associated style declaration. */ @@ -1910,6 +1984,10 @@ public class CSS( * @supports CSS at-rule condition. Only one type of condition should be set. */ public val supports: CSSSupports? = null, + /** + * @navigation condition. Only one type of condition should be set. + */ + public val navigation: CSSNavigation? = null, /** * Block body. */ @@ -1961,6 +2039,10 @@ public class CSS( * Function body. */ public val children: List, + /** + * The BackendNodeId of the DOM node that constitutes the origin tree scope of this rule. + */ + public val originTreeScopeNodeId: Int? = null, ) /** @@ -2186,6 +2268,11 @@ public class CSS( * Computed style for the specified DOM node. */ public val computedStyle: List, + /** + * A list of non-standard "extra fields" which blink stores alongside each + * computed style. + */ + public val extraFields: ComputedStyleExtraFields, ) @Serializable @@ -2321,9 +2408,9 @@ public class CSS( */ public val cssPropertyRegistrations: List?, /** - * A font-palette-values rule matching this node. + * A list of simple @rules matching this node or its pseudo-elements. */ - public val cssFontPaletteValuesRule: CSSFontPaletteValuesRule?, + public val cssAtRules: List?, /** * Id of the first parent element that does not have display: contents. */ @@ -2494,6 +2581,21 @@ public class CSS( public val supports: CSSSupports, ) + @Serializable + public data class SetNavigationTextParameter( + public val styleSheetId: String, + public val range: SourceRange, + public val text: String, + ) + + @Serializable + public data class SetNavigationTextReturn( + /** + * The resulting CSS Navigation rule after modification. + */ + public val navigation: CSSNavigation, + ) + @Serializable public data class SetScopeTextParameter( public val styleSheetId: String, diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CacheStorage.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CacheStorage.kt index d0caae982..8d19ce273 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CacheStorage.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CacheStorage.kt @@ -2,20 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List -import kotlinx.coroutines.flow.filter -import kotlinx.coroutines.flow.filterNotNull -import kotlinx.coroutines.flow.map +import dev.kdriver.cdp.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Cast.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Cast.kt index ac7f82145..ca87078ae 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Cast.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Cast.kt @@ -2,15 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Console.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Console.kt index 969eefa82..4a12b567e 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Console.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Console.kt @@ -2,22 +2,13 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Int -import kotlin.String -import kotlin.Suppress +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.map import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement -import kotlinx.serialization.json.encodeToJsonElement /** * This domain is deprecated - use Runtime or Log instead. diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CrashReportContext.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CrashReportContext.kt new file mode 100644 index 000000000..38644e280 --- /dev/null +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/CrashReportContext.kt @@ -0,0 +1,47 @@ +@file:Suppress("ALL") + +package dev.kdriver.cdp.domain + +import dev.kdriver.cdp.* +import kotlinx.serialization.Serializable +import kotlinx.serialization.json.decodeFromJsonElement + +/** + * This domain exposes the current state of the CrashReportContext API. + */ +public val CDP.crashReportContext: CrashReportContext + get() = getGeneratedDomain() ?: cacheGeneratedDomain(CrashReportContext(this)) + +/** + * This domain exposes the current state of the CrashReportContext API. + */ +public class CrashReportContext( + private val cdp: CDP, +) : Domain { + /** + * Returns all entries in the CrashReportContext across all frames in the page. + */ + public suspend fun getEntries(mode: CommandMode = CommandMode.DEFAULT): GetEntriesReturn { + val parameter = null + val result = cdp.callCommand("CrashReportContext.getEntries", parameter, mode) + return result!!.let { Serialization.json.decodeFromJsonElement(it) } + } + + /** + * Key-value pair in CrashReportContext. + */ + @Serializable + public data class CrashReportContextEntry( + public val key: String, + public val `value`: String, + /** + * The ID of the frame where the key-value pair was set. + */ + public val frameId: String, + ) + + @Serializable + public data class GetEntriesReturn( + public val entries: List, + ) +} diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOM.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOM.kt index 985bf3ee0..974fc3e6e 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOM.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOM.kt @@ -2,20 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Deprecated -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.Unit -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -60,6 +47,16 @@ public class DOM( .filterNotNull() .map { Serialization.json.decodeFromJsonElement(it) } + /** + * Fired when `Element`'s adoptedStyleSheets are modified. + */ + public val adoptedStyleSheetsModified: Flow = cdp + .events + .filter { it.method == "DOM.adoptedStyleSheetsModified" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + /** * Fired when `Element`'s attribute is removed. */ @@ -170,6 +167,27 @@ public class DOM( .filterNotNull() .map { Serialization.json.decodeFromJsonElement(it) } + /** + * Fired when a node's ad related state changes. + */ + public val adRelatedStateUpdated: Flow = cdp + .events + .filter { it.method == "DOM.adRelatedStateUpdated" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Fired when a node's starting styles changes. + */ + public val affectedByStartingStylesFlagUpdated: + Flow = cdp + .events + .filter { it.method == "DOM.affectedByStartingStylesFlagUpdated" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + /** * Called when a pseudo element is removed from an element. */ @@ -1487,6 +1505,9 @@ public class DOM( @SerialName("after") AFTER, + @SerialName("expand-icon") + EXPAND_ICON, + @SerialName("picker-icon") PICKER_ICON, @@ -1588,6 +1609,9 @@ public class DOM( @SerialName("permission-icon") PERMISSION_ICON, + + @SerialName("overscroll-area-parent") + OVERSCROLL_AREA_PARENT, } /** @@ -1792,6 +1816,9 @@ public class DOM( public val compatibilityMode: CompatibilityMode? = null, public val assignedSlot: BackendNode? = null, public val isScrollable: Boolean? = null, + public val affectedByStartingStyles: Boolean? = null, + public val adoptedStyleSheets: List? = null, + public val adProvenance: Network.AdProvenance? = null, ) /** @@ -1934,6 +1961,21 @@ public class DOM( public val `value`: String, ) + /** + * Fired when `Element`'s adoptedStyleSheets are modified. + */ + @Serializable + public data class AdoptedStyleSheetsModifiedParameter( + /** + * Id of the node that has changed. + */ + public val nodeId: Int, + /** + * New adoptedStyleSheets array. + */ + public val adoptedStyleSheets: List, + ) + /** * Fired when `Element`'s attribute is removed. */ @@ -2069,6 +2111,36 @@ public class DOM( public val isScrollable: Boolean, ) + /** + * Fired when a node's ad related state changes. + */ + @Serializable + public data class AdRelatedStateUpdatedParameter( + /** + * The id of the node. + */ + public val nodeId: Int, + /** + * The provenance of the ad related node, if it is ad related. + */ + public val adProvenance: Network.AdProvenance? = null, + ) + + /** + * Fired when a node's starting styles changes. + */ + @Serializable + public data class AffectedByStartingStylesFlagUpdatedParameter( + /** + * The id of the node. + */ + public val nodeId: Int, + /** + * If the node has starting styles. + */ + public val affectedByStartingStyles: Boolean, + ) + /** * Called when a pseudo element is removed from an element. */ diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMDebugger.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMDebugger.kt index 7090a3538..b7d709953 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMDebugger.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMDebugger.kt @@ -2,21 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Deprecated -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List -import kotlinx.coroutines.flow.filter -import kotlinx.coroutines.flow.filterNotNull -import kotlinx.coroutines.flow.map +import dev.kdriver.cdp.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMSnapshot.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMSnapshot.kt index 44e4ab747..6cb2a1bc2 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMSnapshot.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMSnapshot.kt @@ -2,22 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Deprecated -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List -import kotlinx.coroutines.flow.filter -import kotlinx.coroutines.flow.filterNotNull -import kotlinx.coroutines.flow.map +import dev.kdriver.cdp.* import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMStorage.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMStorage.kt index 71e944dc4..97ba8c5c4 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMStorage.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DOMStorage.kt @@ -2,17 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Debugger.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Debugger.kt index 83dfb2c7a..9ff4205b0 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Debugger.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Debugger.kt @@ -2,21 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Deprecated -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.Unit -import kotlin.collections.List -import kotlin.collections.Map +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DeviceAccess.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DeviceAccess.kt index 8470e80a3..17d627105 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DeviceAccess.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DeviceAccess.kt @@ -2,15 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DeviceOrientation.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DeviceOrientation.kt index 7bcf39ce2..5d88bac05 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DeviceOrientation.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/DeviceOrientation.kt @@ -2,19 +2,8 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Double -import kotlin.Suppress -import kotlinx.coroutines.flow.filter -import kotlinx.coroutines.flow.filterNotNull -import kotlinx.coroutines.flow.map +import dev.kdriver.cdp.* import kotlinx.serialization.Serializable -import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement public val CDP.deviceOrientation: DeviceOrientation diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Emulation.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Emulation.kt index 46480acc6..af8b44f29 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Emulation.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Emulation.kt @@ -2,20 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Deprecated -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.Unit -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -47,6 +34,18 @@ public class Emulation( .filterNotNull() .map { Serialization.json.decodeFromJsonElement(it) } + /** + * Fired when a page calls screen.orientation.lock() or screen.orientation.unlock() + * while device emulation is enabled. This allows the DevTools frontend to update the + * emulated device orientation accordingly. + */ + public val screenOrientationLockChanged: Flow = cdp + .events + .filter { it.method == "Emulation.screenOrientationLockChanged" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + /** * Tells whether emulation is supported. */ @@ -230,6 +229,12 @@ public class Emulation( * @param devicePosture If set, the posture of a foldable device. If not set the posture is set * to continuous. * Deprecated, use Emulation.setDevicePostureOverride. + * @param scrollbarType Scrollbar type. Default: `default`. + * @param screenOrientationLockEmulation If set to true, enables screen orientation lock emulation, which + * intercepts screen.orientation.lock() calls from the page and reports + * orientation changes via screenOrientationLockChanged events. This is + * useful for emulating mobile device orientation lock behavior in + * responsive design mode. */ public suspend fun setDeviceMetricsOverride( width: Int, @@ -246,6 +251,8 @@ public class Emulation( viewport: Page.Viewport? = null, displayFeature: DisplayFeature? = null, devicePosture: DevicePosture? = null, + scrollbarType: String? = null, + screenOrientationLockEmulation: Boolean? = null, ) { val parameter = SetDeviceMetricsOverrideParameter( width = width, @@ -261,7 +268,9 @@ public class Emulation( screenOrientation = screenOrientation, viewport = viewport, displayFeature = displayFeature, - devicePosture = devicePosture + devicePosture = devicePosture, + scrollbarType = scrollbarType, + screenOrientationLockEmulation = screenOrientationLockEmulation ) setDeviceMetricsOverride(parameter) } @@ -1026,6 +1035,164 @@ public class Emulation( setSmallViewportHeightDifferenceOverride(parameter) } + /** + * Returns device's screen configuration. In headful mode, the physical screens configuration is returned, + * whereas in headless mode, a virtual headless screen configuration is provided instead. + */ + public suspend fun getScreenInfos(mode: CommandMode = CommandMode.DEFAULT): GetScreenInfosReturn { + val parameter = null + val result = cdp.callCommand("Emulation.getScreenInfos", parameter, mode) + return result!!.let { Serialization.json.decodeFromJsonElement(it) } + } + + /** + * Add a new screen to the device. Only supported in headless mode. + */ + public suspend fun addScreen(args: AddScreenParameter, mode: CommandMode = CommandMode.DEFAULT): AddScreenReturn { + val parameter = Serialization.json.encodeToJsonElement(args) + val result = cdp.callCommand("Emulation.addScreen", parameter, mode) + return result!!.let { Serialization.json.decodeFromJsonElement(it) } + } + + /** + * Add a new screen to the device. Only supported in headless mode. + * + * @param left Offset of the left edge of the screen in pixels. + * @param top Offset of the top edge of the screen in pixels. + * @param width The width of the screen in pixels. + * @param height The height of the screen in pixels. + * @param workAreaInsets Specifies the screen's work area. Default is entire screen. + * @param devicePixelRatio Specifies the screen's device pixel ratio. Default is 1. + * @param rotation Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270. Default is 0. + * @param colorDepth Specifies the screen's color depth in bits. Default is 24. + * @param label Specifies the descriptive label for the screen. Default is none. + * @param isInternal Indicates whether the screen is internal to the device or external, attached to the device. Default is false. + */ + public suspend fun addScreen( + left: Int, + top: Int, + width: Int, + height: Int, + workAreaInsets: WorkAreaInsets? = null, + devicePixelRatio: Double? = null, + rotation: Int? = null, + colorDepth: Int? = null, + label: String? = null, + isInternal: Boolean? = null, + ): AddScreenReturn { + val parameter = AddScreenParameter( + left = left, + top = top, + width = width, + height = height, + workAreaInsets = workAreaInsets, + devicePixelRatio = devicePixelRatio, + rotation = rotation, + colorDepth = colorDepth, + label = label, + isInternal = isInternal + ) + return addScreen(parameter) + } + + /** + * Updates specified screen parameters. Only supported in headless mode. + */ + public suspend fun updateScreen( + args: UpdateScreenParameter, + mode: CommandMode = CommandMode.DEFAULT, + ): UpdateScreenReturn { + val parameter = Serialization.json.encodeToJsonElement(args) + val result = cdp.callCommand("Emulation.updateScreen", parameter, mode) + return result!!.let { Serialization.json.decodeFromJsonElement(it) } + } + + /** + * Updates specified screen parameters. Only supported in headless mode. + * + * @param screenId Target screen identifier. + * @param left Offset of the left edge of the screen in pixels. + * @param top Offset of the top edge of the screen in pixels. + * @param width The width of the screen in pixels. + * @param height The height of the screen in pixels. + * @param workAreaInsets Specifies the screen's work area. + * @param devicePixelRatio Specifies the screen's device pixel ratio. + * @param rotation Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270. + * @param colorDepth Specifies the screen's color depth in bits. + * @param label Specifies the descriptive label for the screen. + * @param isInternal Indicates whether the screen is internal to the device or external, attached to the device. Default is false. + */ + public suspend fun updateScreen( + screenId: String, + left: Int? = null, + top: Int? = null, + width: Int? = null, + height: Int? = null, + workAreaInsets: WorkAreaInsets? = null, + devicePixelRatio: Double? = null, + rotation: Int? = null, + colorDepth: Int? = null, + label: String? = null, + isInternal: Boolean? = null, + ): UpdateScreenReturn { + val parameter = UpdateScreenParameter( + screenId = screenId, + left = left, + top = top, + width = width, + height = height, + workAreaInsets = workAreaInsets, + devicePixelRatio = devicePixelRatio, + rotation = rotation, + colorDepth = colorDepth, + label = label, + isInternal = isInternal + ) + return updateScreen(parameter) + } + + /** + * Remove screen from the device. Only supported in headless mode. + */ + public suspend fun removeScreen(args: RemoveScreenParameter, mode: CommandMode = CommandMode.DEFAULT) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("Emulation.removeScreen", parameter, mode) + } + + /** + * Remove screen from the device. Only supported in headless mode. + * + * @param screenId No description + */ + public suspend fun removeScreen(screenId: String) { + val parameter = RemoveScreenParameter(screenId = screenId) + removeScreen(parameter) + } + + /** + * Set primary screen. Only supported in headless mode. + * Note that this changes the coordinate system origin to the top-left + * of the new primary screen, updating the bounds and work areas + * of all existing screens accordingly. + */ + public suspend fun setPrimaryScreen(args: SetPrimaryScreenParameter, mode: CommandMode = CommandMode.DEFAULT) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("Emulation.setPrimaryScreen", parameter, mode) + } + + /** + * Set primary screen. Only supported in headless mode. + * Note that this changes the coordinate system origin to the top-left + * of the new primary screen, updating the bounds and work areas + * of all existing screens accordingly. + * + * @param screenId No description + */ + public suspend fun setPrimaryScreen(screenId: String) { + val parameter = SetPrimaryScreenParameter(screenId = screenId) + setPrimaryScreen(parameter) + } + @Serializable public data class SafeAreaInsets( /** @@ -1257,6 +1424,98 @@ public class Emulation( public val available: Boolean? = null, ) + @Serializable + public data class WorkAreaInsets( + /** + * Work area top inset in pixels. Default is 0; + */ + public val top: Int? = null, + /** + * Work area left inset in pixels. Default is 0; + */ + public val left: Int? = null, + /** + * Work area bottom inset in pixels. Default is 0; + */ + public val bottom: Int? = null, + /** + * Work area right inset in pixels. Default is 0; + */ + public val right: Int? = null, + ) + + /** + * Screen information similar to the one returned by window.getScreenDetails() method, + * see https://w3c.github.io/window-management/#screendetailed. + */ + @Serializable + public data class ScreenInfo( + /** + * Offset of the left edge of the screen. + */ + public val left: Int, + /** + * Offset of the top edge of the screen. + */ + public val top: Int, + /** + * Width of the screen. + */ + public val width: Int, + /** + * Height of the screen. + */ + public val height: Int, + /** + * Offset of the left edge of the available screen area. + */ + public val availLeft: Int, + /** + * Offset of the top edge of the available screen area. + */ + public val availTop: Int, + /** + * Width of the available screen area. + */ + public val availWidth: Int, + /** + * Height of the available screen area. + */ + public val availHeight: Int, + /** + * Specifies the screen's device pixel ratio. + */ + public val devicePixelRatio: Double, + /** + * Specifies the screen's orientation. + */ + public val orientation: ScreenOrientation, + /** + * Specifies the screen's color depth in bits. + */ + public val colorDepth: Int, + /** + * Indicates whether the device has multiple screens. + */ + public val isExtended: Boolean, + /** + * Indicates whether the screen is internal to the device or external, attached to the device. + */ + public val isInternal: Boolean, + /** + * Indicates whether the screen is set as the the operating system primary screen. + */ + public val isPrimary: Boolean, + /** + * Specifies the descriptive label for the screen. + */ + public val label: String, + /** + * Specifies the unique identifier of the screen. + */ + public val id: String, + ) + /** * Enum of image types that can be disabled. */ @@ -1265,10 +1524,30 @@ public class Emulation( @SerialName("avif") AVIF, + @SerialName("jxl") + JXL, + @SerialName("webp") WEBP, } + /** + * Fired when a page calls screen.orientation.lock() or screen.orientation.unlock() + * while device emulation is enabled. This allows the DevTools frontend to update the + * emulated device orientation accordingly. + */ + @Serializable + public data class ScreenOrientationLockChangedParameter( + /** + * Whether the screen orientation is currently locked. + */ + public val locked: Boolean, + /** + * The orientation lock type requested by the page. Only set when locked is true. + */ + public val orientation: ScreenOrientation? = null, + ) + @Serializable public data class CanEmulateReturn( /** @@ -1380,6 +1659,18 @@ public class Emulation( * Deprecated, use Emulation.setDevicePostureOverride. */ public val devicePosture: DevicePosture? = null, + /** + * Scrollbar type. Default: `default`. + */ + public val scrollbarType: String? = null, + /** + * If set to true, enables screen orientation lock emulation, which + * intercepts screen.orientation.lock() calls from the page and reports + * orientation changes via screenOrientationLockChanged events. This is + * useful for emulating mobile device orientation lock behavior in + * responsive design mode. + */ + public val screenOrientationLockEmulation: Boolean? = null, ) @Serializable @@ -1687,4 +1978,121 @@ public class Emulation( */ public val difference: Int, ) + + @Serializable + public data class GetScreenInfosReturn( + public val screenInfos: List, + ) + + @Serializable + public data class AddScreenParameter( + /** + * Offset of the left edge of the screen in pixels. + */ + public val left: Int, + /** + * Offset of the top edge of the screen in pixels. + */ + public val top: Int, + /** + * The width of the screen in pixels. + */ + public val width: Int, + /** + * The height of the screen in pixels. + */ + public val height: Int, + /** + * Specifies the screen's work area. Default is entire screen. + */ + public val workAreaInsets: WorkAreaInsets? = null, + /** + * Specifies the screen's device pixel ratio. Default is 1. + */ + public val devicePixelRatio: Double? = null, + /** + * Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270. Default is 0. + */ + public val rotation: Int? = null, + /** + * Specifies the screen's color depth in bits. Default is 24. + */ + public val colorDepth: Int? = null, + /** + * Specifies the descriptive label for the screen. Default is none. + */ + public val label: String? = null, + /** + * Indicates whether the screen is internal to the device or external, attached to the device. Default is false. + */ + public val isInternal: Boolean? = null, + ) + + @Serializable + public data class AddScreenReturn( + public val screenInfo: ScreenInfo, + ) + + @Serializable + public data class UpdateScreenParameter( + /** + * Target screen identifier. + */ + public val screenId: String, + /** + * Offset of the left edge of the screen in pixels. + */ + public val left: Int? = null, + /** + * Offset of the top edge of the screen in pixels. + */ + public val top: Int? = null, + /** + * The width of the screen in pixels. + */ + public val width: Int? = null, + /** + * The height of the screen in pixels. + */ + public val height: Int? = null, + /** + * Specifies the screen's work area. + */ + public val workAreaInsets: WorkAreaInsets? = null, + /** + * Specifies the screen's device pixel ratio. + */ + public val devicePixelRatio: Double? = null, + /** + * Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270. + */ + public val rotation: Int? = null, + /** + * Specifies the screen's color depth in bits. + */ + public val colorDepth: Int? = null, + /** + * Specifies the descriptive label for the screen. + */ + public val label: String? = null, + /** + * Indicates whether the screen is internal to the device or external, attached to the device. Default is false. + */ + public val isInternal: Boolean? = null, + ) + + @Serializable + public data class UpdateScreenReturn( + public val screenInfo: ScreenInfo, + ) + + @Serializable + public data class RemoveScreenParameter( + public val screenId: String, + ) + + @Serializable + public data class SetPrimaryScreenParameter( + public val screenId: String, + ) } diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/EventBreakpoints.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/EventBreakpoints.kt index 0bc388b1f..36cfa1ae6 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/EventBreakpoints.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/EventBreakpoints.kt @@ -2,19 +2,8 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.String -import kotlin.Suppress -import kotlinx.coroutines.flow.filter -import kotlinx.coroutines.flow.filterNotNull -import kotlinx.coroutines.flow.map +import dev.kdriver.cdp.* import kotlinx.serialization.Serializable -import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement /** diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Extensions.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Extensions.kt index 80e36c5df..31360e724 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Extensions.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Extensions.kt @@ -2,19 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List -import kotlin.collections.Map -import kotlinx.coroutines.flow.filter -import kotlinx.coroutines.flow.filterNotNull -import kotlinx.coroutines.flow.map +import dev.kdriver.cdp.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.JsonElement @@ -33,6 +21,29 @@ public val CDP.extensions: Extensions public class Extensions( private val cdp: CDP, ) : Domain { + /** + * Runs an extension default action. + * Available if the client is connected using the --remote-debugging-pipe + * flag and the --enable-unsafe-extension-debugging flag is set. + */ + public suspend fun triggerAction(args: TriggerActionParameter, mode: CommandMode = CommandMode.DEFAULT) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("Extensions.triggerAction", parameter, mode) + } + + /** + * Runs an extension default action. + * Available if the client is connected using the --remote-debugging-pipe + * flag and the --enable-unsafe-extension-debugging flag is set. + * + * @param id Extension id. + * @param targetId A tab target ID to trigger the default extension action on. + */ + public suspend fun triggerAction(id: String, targetId: String) { + val parameter = TriggerActionParameter(id = id, targetId = targetId) + triggerAction(parameter) + } + /** * Installs an unpacked extension from the filesystem similar to * --load-extension CLI flags. Returns extension ID once the extension @@ -57,12 +68,24 @@ public class Extensions( * flag is set. * * @param path Absolute file path. + * @param enableInIncognito Enable the extension in incognito */ - public suspend fun loadUnpacked(path: String): LoadUnpackedReturn { - val parameter = LoadUnpackedParameter(path = path) + public suspend fun loadUnpacked(path: String, enableInIncognito: Boolean? = null): LoadUnpackedReturn { + val parameter = LoadUnpackedParameter(path = path, enableInIncognito = enableInIncognito) return loadUnpacked(parameter) } + /** + * Gets a list of all unpacked extensions. + * Available if the client is connected using the --remote-debugging-pipe flag + * and the --enable-unsafe-extension-debugging flag is set. + */ + public suspend fun getExtensions(mode: CommandMode = CommandMode.DEFAULT): GetExtensionsReturn { + val parameter = null + val result = cdp.callCommand("Extensions.getExtensions", parameter, mode) + return result!!.let { Serialization.json.decodeFromJsonElement(it) } + } + /** * Uninstalls an unpacked extension (others not supported) from the profile. * Available if the client is connected using the --remote-debugging-pipe flag @@ -202,12 +225,55 @@ public class Extensions( MANAGED, } + /** + * Detailed information about an extension. + */ + @Serializable + public data class ExtensionInfo( + /** + * Extension id. + */ + public val id: String, + /** + * Extension name. + */ + public val name: String, + /** + * Extension version. + */ + public val version: String, + /** + * The path from which the extension was loaded. + */ + public val path: String, + /** + * Extension enabled status. + */ + public val enabled: Boolean, + ) + + @Serializable + public data class TriggerActionParameter( + /** + * Extension id. + */ + public val id: String, + /** + * A tab target ID to trigger the default extension action on. + */ + public val targetId: String, + ) + @Serializable public data class LoadUnpackedParameter( /** * Absolute file path. */ public val path: String, + /** + * Enable the extension in incognito + */ + public val enableInIncognito: Boolean? = null, ) @Serializable @@ -218,6 +284,11 @@ public class Extensions( public val id: String, ) + @Serializable + public data class GetExtensionsReturn( + public val extensions: List, + ) + @Serializable public data class UninstallParameter( /** diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/FedCm.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/FedCm.kt index 5d26fe494..580c66b1c 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/FedCm.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/FedCm.kt @@ -2,17 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Fetch.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Fetch.kt index 53c0fc929..8f37df8a8 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Fetch.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Fetch.kt @@ -2,17 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/FileSystem.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/FileSystem.kt index 96c70f7c4..d0812f066 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/FileSystem.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/FileSystem.kt @@ -2,19 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Double -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List -import kotlinx.coroutines.flow.filter -import kotlinx.coroutines.flow.filterNotNull -import kotlinx.coroutines.flow.map +import dev.kdriver.cdp.* import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/HeadlessExperimental.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/HeadlessExperimental.kt index 51bde4a1d..e564ea8b9 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/HeadlessExperimental.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/HeadlessExperimental.kt @@ -2,21 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Deprecated -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlinx.coroutines.flow.filter -import kotlinx.coroutines.flow.filterNotNull -import kotlinx.coroutines.flow.map +import dev.kdriver.cdp.* import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/HeapProfiler.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/HeapProfiler.kt index 3a1d710ec..9089bd650 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/HeapProfiler.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/HeapProfiler.kt @@ -2,19 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.Unit -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -168,6 +156,7 @@ public class HeapProfiler( * * @param samplingInterval Average sample interval in bytes. Poisson distribution is used for the intervals. The * default value is 32768 bytes. + * @param stackDepth Maximum stack depth. The default value is 128. * @param includeObjectsCollectedByMajorGC By default, the sampling heap profiler reports only objects which are * still alive when the profile is returned via getSamplingProfile or * stopSampling, which is useful for determining what functions contribute @@ -185,11 +174,13 @@ public class HeapProfiler( */ public suspend fun startSampling( samplingInterval: Double? = null, + stackDepth: Double? = null, includeObjectsCollectedByMajorGC: Boolean? = null, includeObjectsCollectedByMinorGC: Boolean? = null, ) { val parameter = StartSamplingParameter( samplingInterval = samplingInterval, + stackDepth = stackDepth, includeObjectsCollectedByMajorGC = includeObjectsCollectedByMajorGC, includeObjectsCollectedByMinorGC = includeObjectsCollectedByMinorGC ) @@ -425,6 +416,10 @@ public class HeapProfiler( * default value is 32768 bytes. */ public val samplingInterval: Double? = null, + /** + * Maximum stack depth. The default value is 128. + */ + public val stackDepth: Double? = null, /** * By default, the sampling heap profiler reports only objects which are * still alive when the profile is returned via getSamplingProfile or diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/IO.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/IO.kt index e901ad7e2..a8579e792 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/IO.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/IO.kt @@ -2,19 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlinx.coroutines.flow.filter -import kotlinx.coroutines.flow.filterNotNull -import kotlinx.coroutines.flow.map +import dev.kdriver.cdp.* import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/IndexedDB.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/IndexedDB.kt index 354039fd9..bb7412ec2 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/IndexedDB.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/IndexedDB.kt @@ -2,21 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List -import kotlinx.coroutines.flow.filter -import kotlinx.coroutines.flow.filterNotNull -import kotlinx.coroutines.flow.map +import dev.kdriver.cdp.* import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement @@ -172,7 +158,7 @@ public class IndexedDB( * @param storageBucket Storage bucket. If not specified, it uses the default bucket. * @param databaseName Database name. * @param objectStoreName Object store name. - * @param indexName Index name, empty string for object store data requests. + * @param indexName Index name. If not specified, it performs an object store data request. * @param skipCount Number of records to skip. * @param pageSize Number of records to fetch. * @param keyRange Key range. @@ -183,7 +169,7 @@ public class IndexedDB( storageBucket: Storage.StorageBucket? = null, databaseName: String, objectStoreName: String, - indexName: String, + indexName: String? = null, skipCount: Int, pageSize: Int, keyRange: KeyRange? = null, @@ -557,9 +543,9 @@ public class IndexedDB( */ public val objectStoreName: String, /** - * Index name, empty string for object store data requests. + * Index name. If not specified, it performs an object store data request. */ - public val indexName: String, + public val indexName: String? = null, /** * Number of records to skip. */ diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Input.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Input.kt index 608bf5f00..6fa89c1db 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Input.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Input.kt @@ -2,18 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Inspector.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Inspector.kt index 9306f6b07..a20255d67 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Inspector.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Inspector.kt @@ -2,22 +2,13 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.String -import kotlin.Suppress -import kotlin.Unit +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.map import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement -import kotlinx.serialization.json.encodeToJsonElement public val CDP.inspector: Inspector get() = getGeneratedDomain() ?: cacheGeneratedDomain(Inspector(this)) @@ -55,6 +46,16 @@ public class Inspector( .filterNotNull() .map { Serialization.json.decodeFromJsonElement(it) } + /** + * Fired on worker targets when main worker script and any imported scripts have been evaluated. + */ + public val workerScriptLoaded: Flow = cdp + .events + .filter { it.method == "Inspector.workerScriptLoaded" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + /** * Disables inspector domain notifications. */ diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/LayerTree.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/LayerTree.kt index 948ac68c0..12af03ea7 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/LayerTree.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/LayerTree.kt @@ -2,19 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List -import kotlin.collections.Map +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Log.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Log.kt index c5dcc97b1..670c07976 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Log.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Log.kt @@ -2,17 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Media.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Media.kt index 39af93d21..fa906838e 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Media.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Media.kt @@ -2,18 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List -import kotlin.collections.Map +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -21,16 +10,15 @@ import kotlinx.coroutines.flow.map import kotlinx.serialization.Serializable import kotlinx.serialization.json.JsonElement import kotlinx.serialization.json.decodeFromJsonElement -import kotlinx.serialization.json.encodeToJsonElement /** - * This domain allows detailed inspection of media elements + * This domain allows detailed inspection of media elements. */ public val CDP.media: Media get() = getGeneratedDomain() ?: cacheGeneratedDomain(Media(this)) /** - * This domain allows detailed inspection of media elements + * This domain allows detailed inspection of media elements. */ public class Media( private val cdp: CDP, @@ -79,12 +67,12 @@ public class Media( /** * Called whenever a player is created, or when a new agent joins and receives - * a list of active players. If an agent is restored, it will receive the full - * list of player ids and all events again. + * a list of active players. If an agent is restored, it will receive one + * event for each active player. */ - public val playersCreated: Flow = cdp + public val playerCreated: Flow = cdp .events - .filter { it.method == "Media.playersCreated" } + .filter { it.method == "Media.playerCreated" } .map { it.params } .filterNotNull() .map { Serialization.json.decodeFromJsonElement(it) } @@ -180,6 +168,12 @@ public class Media( public val `data`: Map, ) + @Serializable + public data class Player( + public val playerId: String, + public val domNodeId: Int? = null, + ) + /** * This can be called multiple times, and can be used to set / override / * remove player properties. A null propValue indicates removal. @@ -220,11 +214,11 @@ public class Media( /** * Called whenever a player is created, or when a new agent joins and receives - * a list of active players. If an agent is restored, it will receive the full - * list of player ids and all events again. + * a list of active players. If an agent is restored, it will receive one + * event for each active player. */ @Serializable - public data class PlayersCreatedParameter( - public val players: List, + public data class PlayerCreatedParameter( + public val player: Player, ) } diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Memory.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Memory.kt index 04a777f78..875cc8b74 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Memory.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Memory.kt @@ -2,21 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List -import kotlinx.coroutines.flow.filter -import kotlinx.coroutines.flow.filterNotNull -import kotlinx.coroutines.flow.map +import dev.kdriver.cdp.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Network.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Network.kt index 8a51a859e..bae8eae75 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Network.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Network.kt @@ -2,21 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Deprecated -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.Unit -import kotlin.collections.List -import kotlin.collections.Map +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -305,6 +291,22 @@ public class Network( .filterNotNull() .map { Serialization.json.decodeFromJsonElement(it) } + public val directUDPSocketJoinedMulticastGroup: + Flow = cdp + .events + .filter { it.method == "Network.directUDPSocketJoinedMulticastGroup" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + public val directUDPSocketLeftMulticastGroup: Flow = + cdp + .events + .filter { it.method == "Network.directUDPSocketLeftMulticastGroup" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + /** * Fired upon direct_socket.UDPSocket creation. */ @@ -426,73 +428,47 @@ public class Network( .map { Serialization.json.decodeFromJsonElement(it) } /** - * Fired once when parsing the .wbn file has succeeded. - * The event contains the information about the web bundle contents. + * Is sent whenever a new report is added. + * And after 'enableReportingApi' for all existing reports. */ - public val subresourceWebBundleMetadataReceived: - Flow = cdp + public val reportingApiReportAdded: Flow = cdp .events - .filter { it.method == "Network.subresourceWebBundleMetadataReceived" } + .filter { it.method == "Network.reportingApiReportAdded" } .map { it.params } .filterNotNull() .map { Serialization.json.decodeFromJsonElement(it) } - /** - * Fired once when parsing the .wbn file has failed. - */ - public val subresourceWebBundleMetadataError: Flow = - cdp - .events - .filter { it.method == "Network.subresourceWebBundleMetadataError" } - .map { it.params } - .filterNotNull() - .map { Serialization.json.decodeFromJsonElement(it) } - - /** - * Fired when handling requests for resources within a .wbn file. - * Note: this will only be fired for resources that are requested by the webpage. - */ - public val subresourceWebBundleInnerResponseParsed: - Flow = cdp + public val reportingApiReportUpdated: Flow = cdp .events - .filter { it.method == "Network.subresourceWebBundleInnerResponseParsed" } + .filter { it.method == "Network.reportingApiReportUpdated" } .map { it.params } .filterNotNull() .map { Serialization.json.decodeFromJsonElement(it) } - /** - * Fired when request for resources within a .wbn file failed. - */ - public val subresourceWebBundleInnerResponseError: - Flow = cdp + public val reportingApiEndpointsChangedForOrigin: + Flow = cdp .events - .filter { it.method == "Network.subresourceWebBundleInnerResponseError" } + .filter { it.method == "Network.reportingApiEndpointsChangedForOrigin" } .map { it.params } .filterNotNull() .map { Serialization.json.decodeFromJsonElement(it) } /** - * Is sent whenever a new report is added. - * And after 'enableReportingApi' for all existing reports. + * Triggered when the initial set of device bound sessions is added. */ - public val reportingApiReportAdded: Flow = cdp - .events - .filter { it.method == "Network.reportingApiReportAdded" } - .map { it.params } - .filterNotNull() - .map { Serialization.json.decodeFromJsonElement(it) } - - public val reportingApiReportUpdated: Flow = cdp + public val deviceBoundSessionsAdded: Flow = cdp .events - .filter { it.method == "Network.reportingApiReportUpdated" } + .filter { it.method == "Network.deviceBoundSessionsAdded" } .map { it.params } .filterNotNull() .map { Serialization.json.decodeFromJsonElement(it) } - public val reportingApiEndpointsChangedForOrigin: - Flow = cdp + /** + * Triggered when a device bound session event occurs. + */ + public val deviceBoundSessionEventOccurred: Flow = cdp .events - .filter { it.method == "Network.reportingApiEndpointsChangedForOrigin" } + .filter { it.method == "Network.deviceBoundSessionEventOccurred" } .map { it.params } .filterNotNull() .map { Serialization.json.decodeFromJsonElement(it) } @@ -674,8 +650,10 @@ public class Network( } /** - * Activates emulation of network conditions. + * Activates emulation of network conditions. This command is deprecated in favor of the emulateNetworkConditionsByRule + * and overrideNetworkState commands, which can be used together to the same effect. */ + @Deprecated(message = "") public suspend fun emulateNetworkConditions( args: EmulateNetworkConditionsParameter, mode: CommandMode = CommandMode.DEFAULT, @@ -685,7 +663,8 @@ public class Network( } /** - * Activates emulation of network conditions. + * Activates emulation of network conditions. This command is deprecated in favor of the emulateNetworkConditionsByRule + * and overrideNetworkState commands, which can be used together to the same effect. * * @param offline True to emulate internet disconnection. * @param latency Minimum latency from request sent to response headers received (ms). @@ -696,6 +675,7 @@ public class Network( * @param packetQueueLength WebRTC packet queue length (packet). 0 removes any queue length limitations. * @param packetReordering WebRTC packetReordering feature. */ + @Deprecated(message = "") public suspend fun emulateNetworkConditions( offline: Boolean, latency: Double, @@ -719,6 +699,82 @@ public class Network( emulateNetworkConditions(parameter) } + /** + * Activates emulation of network conditions for individual requests using URL match patterns. Unlike the deprecated + * Network.emulateNetworkConditions this method does not affect `navigator` state. Use Network.overrideNetworkState to + * explicitly modify `navigator` behavior. + */ + public suspend fun emulateNetworkConditionsByRule( + args: EmulateNetworkConditionsByRuleParameter, + mode: CommandMode = CommandMode.DEFAULT, + ): EmulateNetworkConditionsByRuleReturn { + val parameter = Serialization.json.encodeToJsonElement(args) + val result = cdp.callCommand("Network.emulateNetworkConditionsByRule", parameter, mode) + return result!!.let { Serialization.json.decodeFromJsonElement(it) } + } + + /** + * Activates emulation of network conditions for individual requests using URL match patterns. Unlike the deprecated + * Network.emulateNetworkConditions this method does not affect `navigator` state. Use Network.overrideNetworkState to + * explicitly modify `navigator` behavior. + * + * @param offline True to emulate internet disconnection. Deprecated, use the offline property in matchedNetworkConditions + * or emulateOfflineServiceWorker instead. + * @param emulateOfflineServiceWorker True to emulate offline service worker. + * @param matchedNetworkConditions Configure conditions for matching requests. If multiple entries match a request, the first entry wins. Global + * conditions can be configured by leaving the urlPattern for the conditions empty. These global conditions are + * also applied for throttling of p2p connections. + */ + public suspend fun emulateNetworkConditionsByRule( + offline: Boolean? = null, + emulateOfflineServiceWorker: Boolean? = null, + matchedNetworkConditions: List, + ): EmulateNetworkConditionsByRuleReturn { + val parameter = EmulateNetworkConditionsByRuleParameter( + offline = offline, + emulateOfflineServiceWorker = emulateOfflineServiceWorker, + matchedNetworkConditions = matchedNetworkConditions + ) + return emulateNetworkConditionsByRule(parameter) + } + + /** + * Override the state of navigator.onLine and navigator.connection. + */ + public suspend fun overrideNetworkState( + args: OverrideNetworkStateParameter, + mode: CommandMode = CommandMode.DEFAULT, + ) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("Network.overrideNetworkState", parameter, mode) + } + + /** + * Override the state of navigator.onLine and navigator.connection. + * + * @param offline True to emulate internet disconnection. + * @param latency Minimum latency from request sent to response headers received (ms). + * @param downloadThroughput Maximal aggregated download throughput (bytes/sec). -1 disables download throttling. + * @param uploadThroughput Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling. + * @param connectionType Connection type if known. + */ + public suspend fun overrideNetworkState( + offline: Boolean, + latency: Double, + downloadThroughput: Double, + uploadThroughput: Double, + connectionType: ConnectionType? = null, + ) { + val parameter = OverrideNetworkStateParameter( + offline = offline, + latency = latency, + downloadThroughput = downloadThroughput, + uploadThroughput = uploadThroughput, + connectionType = connectionType + ) + overrideNetworkState(parameter) + } + /** * Enables network tracking, network events will now be delivered to the client. */ @@ -731,25 +787,63 @@ public class Network( * Enables network tracking, network events will now be delivered to the client. * * @param maxTotalBufferSize Buffer size in bytes to use when preserving network payloads (XHRs, etc). + * This is the maximum number of bytes that will be collected by this + * DevTools session. * @param maxResourceBufferSize Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc). * @param maxPostDataSize Longest post body size (in bytes) that would be included in requestWillBeSent notification * @param reportDirectSocketTraffic Whether DirectSocket chunk send/receive events should be reported. + * @param enableDurableMessages Enable storing response bodies outside of renderer, so that these survive + * a cross-process navigation. Requires maxTotalBufferSize to be set. + * Currently defaults to false. This field is being deprecated in favor of the dedicated + * configureDurableMessages command, due to the possibility of deadlocks when awaiting + * Network.enable before issuing Runtime.runIfWaitingForDebugger. */ public suspend fun enable( maxTotalBufferSize: Int? = null, maxResourceBufferSize: Int? = null, maxPostDataSize: Int? = null, reportDirectSocketTraffic: Boolean? = null, + enableDurableMessages: Boolean? = null, ) { val parameter = EnableParameter( maxTotalBufferSize = maxTotalBufferSize, maxResourceBufferSize = maxResourceBufferSize, maxPostDataSize = maxPostDataSize, - reportDirectSocketTraffic = reportDirectSocketTraffic + reportDirectSocketTraffic = reportDirectSocketTraffic, + enableDurableMessages = enableDurableMessages ) enable(parameter) } + /** + * Configures storing response bodies outside of renderer, so that these survive + * a cross-process navigation. + * If maxTotalBufferSize is not set, durable messages are disabled. + */ + public suspend fun configureDurableMessages( + args: ConfigureDurableMessagesParameter, + mode: CommandMode = CommandMode.DEFAULT, + ) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("Network.configureDurableMessages", parameter, mode) + } + + /** + * Configures storing response bodies outside of renderer, so that these survive + * a cross-process navigation. + * If maxTotalBufferSize is not set, durable messages are disabled. + * + * @param maxTotalBufferSize Buffer size in bytes to use when preserving network payloads (XHRs, etc). + * @param maxResourceBufferSize Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc). + */ + public suspend fun configureDurableMessages(maxTotalBufferSize: Int? = null, maxResourceBufferSize: Int? = null) { + val parameter = ConfigureDurableMessagesParameter( + maxTotalBufferSize = maxTotalBufferSize, + maxResourceBufferSize = maxResourceBufferSize + ) + configureDurableMessages(parameter) + } + /** * Returns all browser cookies. Depending on the backend support, will return detailed cookie * information in the `cookies` field. @@ -972,10 +1066,12 @@ public class Network( /** * Blocks URLs from loading. * + * @param urlPatterns Patterns to match in the order in which they are given. These patterns + * also take precedence over any wildcard patterns defined in `urls`. * @param urls URL patterns to block. Wildcards ('*') are allowed. */ - public suspend fun setBlockedURLs(urls: List) { - val parameter = SetBlockedURLsParameter(urls = urls) + public suspend fun setBlockedURLs(urlPatterns: List? = null, urls: List? = null) { + val parameter = SetBlockedURLsParameter(urlPatterns = urlPatterns, urls = urls) setBlockedURLs(parameter) } @@ -1041,7 +1137,6 @@ public class Network( * @param sameSite Cookie SameSite type. * @param expires Cookie expiration date, session cookie if not set * @param priority Cookie Priority type. - * @param sameParty True if cookie is SameParty. * @param sourceScheme Cookie source scheme type. * @param sourcePort Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. * An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. @@ -1059,7 +1154,6 @@ public class Network( sameSite: CookieSameSite? = null, expires: Double? = null, priority: CookiePriority? = null, - sameParty: Boolean? = null, sourceScheme: CookieSourceScheme? = null, sourcePort: Int? = null, partitionKey: CookiePartitionKey? = null, @@ -1075,7 +1169,6 @@ public class Network( sameSite = sameSite, expires = expires, priority = priority, - sameParty = sameParty, sourceScheme = sourceScheme, sourcePort = sourcePort, partitionKey = partitionKey @@ -1269,6 +1362,49 @@ public class Network( enableReportingApi(parameter) } + /** + * Sets up tracking device bound sessions and fetching of initial set of sessions. + */ + public suspend fun enableDeviceBoundSessions( + args: EnableDeviceBoundSessionsParameter, + mode: CommandMode = CommandMode.DEFAULT, + ) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("Network.enableDeviceBoundSessions", parameter, mode) + } + + /** + * Sets up tracking device bound sessions and fetching of initial set of sessions. + * + * @param enable Whether to enable or disable events. + */ + public suspend fun enableDeviceBoundSessions(enable: Boolean) { + val parameter = EnableDeviceBoundSessionsParameter(enable = enable) + enableDeviceBoundSessions(parameter) + } + + /** + * Fetches the schemeful site for a specific origin. + */ + public suspend fun fetchSchemefulSite( + args: FetchSchemefulSiteParameter, + mode: CommandMode = CommandMode.DEFAULT, + ): FetchSchemefulSiteReturn { + val parameter = Serialization.json.encodeToJsonElement(args) + val result = cdp.callCommand("Network.fetchSchemefulSite", parameter, mode) + return result!!.let { Serialization.json.decodeFromJsonElement(it) } + } + + /** + * Fetches the schemeful site for a specific origin. + * + * @param origin The URL origin. + */ + public suspend fun fetchSchemefulSite(origin: String): FetchSchemefulSiteReturn { + val parameter = FetchSchemefulSiteParameter(origin = origin) + return fetchSchemefulSite(parameter) + } + /** * Fetches the resource and returns the content. */ @@ -1312,19 +1448,10 @@ public class Network( * Page reload is required before the new cookie behavior will be observed * * @param enableThirdPartyCookieRestriction Whether 3pc restriction is enabled. - * @param disableThirdPartyCookieMetadata Whether 3pc grace period exception should be enabled; false by default. - * @param disableThirdPartyCookieHeuristics Whether 3pc heuristics exceptions should be enabled; false by default. */ - public suspend fun setCookieControls( - enableThirdPartyCookieRestriction: Boolean, - disableThirdPartyCookieMetadata: Boolean, - disableThirdPartyCookieHeuristics: Boolean, - ) { - val parameter = SetCookieControlsParameter( - enableThirdPartyCookieRestriction = enableThirdPartyCookieRestriction, - disableThirdPartyCookieMetadata = disableThirdPartyCookieMetadata, - disableThirdPartyCookieHeuristics = disableThirdPartyCookieHeuristics - ) + public suspend fun setCookieControls(enableThirdPartyCookieRestriction: Boolean) { + val parameter = + SetCookieControlsParameter(enableThirdPartyCookieRestriction = enableThirdPartyCookieRestriction) setCookieControls(parameter) } @@ -1634,6 +1761,27 @@ public class Network( VERYHIGH, } + /** + * The render-blocking behavior of a resource request. + */ + @Serializable + public enum class RenderBlockingBehavior { + @SerialName("Blocking") + BLOCKING, + + @SerialName("InBodyParserBlocking") + INBODYPARSERBLOCKING, + + @SerialName("NonBlocking") + NONBLOCKING, + + @SerialName("NonBlockingDynamic") + NONBLOCKINGDYNAMIC, + + @SerialName("PotentiallyBlocking") + POTENTIALLYBLOCKING, + } + /** * Post data entry for HTTP request */ @@ -1702,6 +1850,10 @@ public class Network( * request corresponding to the main frame. */ public val isSameSite: Boolean? = null, + /** + * True when the resource request is ad-related. + */ + public val isAdRelated: Boolean? = null, ) /** @@ -1944,12 +2096,6 @@ public class Network( @SerialName("PreflightInvalidAllowExternal") PREFLIGHTINVALIDALLOWEXTERNAL, - @SerialName("PreflightMissingAllowPrivateNetwork") - PREFLIGHTMISSINGALLOWPRIVATENETWORK, - - @SerialName("PreflightInvalidAllowPrivateNetwork") - PREFLIGHTINVALIDALLOWPRIVATENETWORK, - @SerialName("InvalidAllowMethodsPreflightResponse") INVALIDALLOWMETHODSPREFLIGHTRESPONSE, @@ -1965,30 +2111,15 @@ public class Network( @SerialName("RedirectContainsCredentials") REDIRECTCONTAINSCREDENTIALS, - @SerialName("InsecurePrivateNetwork") - INSECUREPRIVATENETWORK, - - @SerialName("InvalidPrivateNetworkAccess") - INVALIDPRIVATENETWORKACCESS, + @SerialName("InsecureLocalNetwork") + INSECURELOCALNETWORK, - @SerialName("UnexpectedPrivateNetworkAccess") - UNEXPECTEDPRIVATENETWORKACCESS, + @SerialName("InvalidLocalNetworkAccess") + INVALIDLOCALNETWORKACCESS, @SerialName("NoCorsRedirectModeNotFollow") NOCORSREDIRECTMODENOTFOLLOW, - @SerialName("PreflightMissingPrivateNetworkAccessId") - PREFLIGHTMISSINGPRIVATENETWORKACCESSID, - - @SerialName("PreflightMissingPrivateNetworkAccessName") - PREFLIGHTMISSINGPRIVATENETWORKACCESSNAME, - - @SerialName("PrivateNetworkAccessPermissionUnavailable") - PRIVATENETWORKACCESSPERMISSIONUNAVAILABLE, - - @SerialName("PrivateNetworkAccessPermissionDenied") - PRIVATENETWORKACCESSPERMISSIONDENIED, - @SerialName("LocalNetworkAccessPermissionDenied") LOCALNETWORKACCESSPERMISSIONDENIED, } @@ -2234,11 +2365,6 @@ public class Network( * Security details for the request. */ public val securityDetails: SecurityDetails? = null, - /** - * Indicates whether the request was sent through IP Protection proxies. If - * set to true, the request used the IP Protection privacy feature. - */ - public val isIpProtectionUsed: Boolean? = null, ) /** @@ -2401,6 +2527,9 @@ public class Network( public val path: String, /** * Cookie expiration date as the number of seconds since the UNIX epoch. + * The value is set to -1 if the expiry date is not set. + * The value can be null for values that cannot be represented in + * JSON (±Inf). */ public val expires: Double, /** @@ -2427,10 +2556,6 @@ public class Network( * Cookie Priority */ public val priority: CookiePriority, - /** - * True if cookie is SameParty. - */ - public val sameParty: Boolean, /** * Cookie source scheme type. */ @@ -2507,12 +2632,6 @@ public class Network( @SerialName("SchemefulSameSiteUnspecifiedTreatedAsLax") SCHEMEFULSAMESITEUNSPECIFIEDTREATEDASLAX, - @SerialName("SamePartyFromCrossPartyContext") - SAMEPARTYFROMCROSSPARTYCONTEXT, - - @SerialName("SamePartyConflictsWithOtherAttributes") - SAMEPARTYCONFLICTSWITHOTHERATTRIBUTES, - @SerialName("NameValuePairExceedsMaxSize") NAMEVALUEPAIREXCEEDSMAXSIZE, @@ -2570,9 +2689,6 @@ public class Network( @SerialName("SchemefulSameSiteUnspecifiedTreatedAsLax") SCHEMEFULSAMESITEUNSPECIFIEDTREATEDASLAX, - @SerialName("SamePartyFromCrossPartyContext") - SAMEPARTYFROMCROSSPARTYCONTEXT, - @SerialName("NameValuePairExceedsMaxSize") NAMEVALUEPAIREXCEEDSMAXSIZE, @@ -2734,10 +2850,6 @@ public class Network( * Cookie Priority. */ public val priority: CookiePriority? = null, - /** - * True if cookie is SameParty. - */ - public val sameParty: Boolean? = null, /** * Cookie source scheme type. */ @@ -2994,6 +3106,62 @@ public class Network( ZSTD, } + @Serializable + public data class NetworkConditions( + /** + * Only matching requests will be affected by these conditions. Patterns use the URLPattern constructor string + * syntax (https://urlpattern.spec.whatwg.org/) and must be absolute. If the pattern is empty, all requests are + * matched (including p2p connections). + */ + public val urlPattern: String, + /** + * Minimum latency from request sent to response headers received (ms). + */ + public val latency: Double, + /** + * Maximal aggregated download throughput (bytes/sec). -1 disables download throttling. + */ + public val downloadThroughput: Double, + /** + * Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling. + */ + public val uploadThroughput: Double, + /** + * Connection type if known. + */ + public val connectionType: ConnectionType? = null, + /** + * WebRTC packet loss (percent, 0-100). 0 disables packet loss emulation, 100 drops all the packets. + */ + public val packetLoss: Double? = null, + /** + * WebRTC packet queue length (packet). 0 removes any queue length limitations. + */ + public val packetQueueLength: Int? = null, + /** + * WebRTC packetReordering feature. + */ + public val packetReordering: Boolean? = null, + /** + * True to emulate internet disconnection. + */ + public val offline: Boolean? = null, + ) + + @Serializable + public data class BlockPattern( + /** + * URL pattern to match. Patterns use the URLPattern constructor string syntax + * (https://urlpattern.spec.whatwg.org/) and must be absolute. Example: `*://*:*/*.css`. + */ + public val urlPattern: String, + /** + * Whether or not to block the pattern. If false, a matching request will not be blocked even if it matches a later + * `BlockPattern`. + */ + public val block: Boolean, + ) + @Serializable public enum class DirectSocketDnsQueryType { @SerialName("ipv4") @@ -3045,6 +3213,12 @@ public class Network( * Expected to be unsigned integer. */ public val receiveBufferSize: Double? = null, + public val multicastLoopback: Boolean? = null, + /** + * Unsigned int 8. + */ + public val multicastTimeToLive: Int? = null, + public val multicastAllowAddressSharing: Boolean? = null, ) @Serializable @@ -3062,7 +3236,7 @@ public class Network( ) @Serializable - public enum class PrivateNetworkRequestPolicy { + public enum class LocalNetworkAccessRequestPolicy { @SerialName("Allow") ALLOW, @@ -3072,12 +3246,6 @@ public class Network( @SerialName("WarnFromInsecureToMorePrivate") WARNFROMINSECURETOMOREPRIVATE, - @SerialName("PreflightBlock") - PREFLIGHTBLOCK, - - @SerialName("PreflightWarn") - PREFLIGHTWARN, - @SerialName("PermissionBlock") PERMISSIONBLOCK, @@ -3114,7 +3282,69 @@ public class Network( public data class ClientSecurityState( public val initiatorIsSecureContext: Boolean, public val initiatorIPAddressSpace: IPAddressSpace, - public val privateNetworkRequestPolicy: PrivateNetworkRequestPolicy, + public val localNetworkAccessRequestPolicy: LocalNetworkAccessRequestPolicy, + ) + + /** + * Identifies the script on the stack that caused a resource or element to be + * labeled as an ad. For resources, this indicates the context that triggered + * the fetch. For elements, this indicates the context that caused the element + * to be appended to the DOM. + */ + @Serializable + public data class AdScriptIdentifier( + /** + * The script's V8 identifier. + */ + public val scriptId: String, + /** + * V8's debugging ID for the v8::Context. + */ + public val debuggerId: String, + /** + * The script's url (or generated name based on id if inline script). + */ + public val name: String, + ) + + /** + * Encapsulates the script ancestry and the root script filter list rule that + * caused the resource or element to be labeled as an ad. + */ + @Serializable + public data class AdAncestry( + /** + * A chain of `AdScriptIdentifier`s representing the ancestry of an ad + * script that led to the creation of a resource or element. The chain is + * ordered from the script itself (lowest level) up to its root ancestor + * that was flagged by a filter list. + */ + public val ancestryChain: List, + /** + * The filter list rule that caused the root (last) script in + * `ancestryChain` to be tagged as an ad. + */ + public val rootScriptFilterlistRule: String? = null, + ) + + /** + * Represents the provenance of an ad resource or element. Only one of + * `filterlistRule` or `adScriptAncestry` can be set. If `filterlistRule` + * is provided, the resource URL directly matches a filter list rule. If + * `adScriptAncestry` is provided, an ad script initiated the resource fetch or + * appended the element to the DOM. If neither is provided, the entity is + * known to be an ad, but provenance tracking information is unavailable. + */ + @Serializable + public data class AdProvenance( + /** + * The filterlist rule that matched, if any. + */ + public val filterlistRule: String? = null, + /** + * The script ancestry that created the ad, if any. + */ + public val adScriptAncestry: AdAncestry? = null, ) @Serializable @@ -3257,34 +3487,481 @@ public class Network( ) /** - * An object providing the result of a network resource load. + * Unique identifier for a device bound session. */ @Serializable - public data class LoadNetworkResourcePageResult( - public val success: Boolean, - /** - * Optional values used for error reporting. - */ - public val netError: Double? = null, - public val netErrorName: String? = null, - public val httpStatusCode: Double? = null, + public data class DeviceBoundSessionKey( /** - * If successful, one of the following two fields holds the result. + * The site the session is set up for. */ - public val stream: String? = null, + public val site: String, /** - * Response headers. + * The id of the session. */ - public val headers: Map? = null, + public val id: String, ) /** - * An options object that may be extended later to better support CORS, - * CORB and streaming. + * How a device bound session was used during a request. */ @Serializable - public data class LoadNetworkResourceOptions( - public val disableCache: Boolean, + public data class DeviceBoundSessionWithUsage( + /** + * The key for the session. + */ + public val sessionKey: DeviceBoundSessionKey, + /** + * How the session was used (or not used). + */ + public val usage: String, + ) + + /** + * A device bound session's cookie craving. + */ + @Serializable + public data class DeviceBoundSessionCookieCraving( + /** + * The name of the craving. + */ + public val name: String, + /** + * The domain of the craving. + */ + public val domain: String, + /** + * The path of the craving. + */ + public val path: String, + /** + * The `Secure` attribute of the craving attributes. + */ + public val secure: Boolean, + /** + * The `HttpOnly` attribute of the craving attributes. + */ + public val httpOnly: Boolean, + /** + * The `SameSite` attribute of the craving attributes. + */ + public val sameSite: CookieSameSite? = null, + ) + + /** + * A device bound session's inclusion URL rule. + */ + @Serializable + public data class DeviceBoundSessionUrlRule( + /** + * See comments on `net::device_bound_sessions::SessionInclusionRules::UrlRule::rule_type`. + */ + public val ruleType: String, + /** + * See comments on `net::device_bound_sessions::SessionInclusionRules::UrlRule::host_pattern`. + */ + public val hostPattern: String, + /** + * See comments on `net::device_bound_sessions::SessionInclusionRules::UrlRule::path_prefix`. + */ + public val pathPrefix: String, + ) + + /** + * A device bound session's inclusion rules. + */ + @Serializable + public data class DeviceBoundSessionInclusionRules( + /** + * See comments on `net::device_bound_sessions::SessionInclusionRules::origin_`. + */ + public val origin: String, + /** + * Whether the whole site is included. See comments on + * `net::device_bound_sessions::SessionInclusionRules::include_site_` for more + * details; this boolean is true if that value is populated. + */ + public val includeSite: Boolean, + /** + * See comments on `net::device_bound_sessions::SessionInclusionRules::url_rules_`. + */ + public val urlRules: List, + ) + + /** + * A device bound session. + */ + @Serializable + public data class DeviceBoundSession( + /** + * The site and session ID of the session. + */ + public val key: DeviceBoundSessionKey, + /** + * See comments on `net::device_bound_sessions::Session::refresh_url_`. + */ + public val refreshUrl: String, + /** + * See comments on `net::device_bound_sessions::Session::inclusion_rules_`. + */ + public val inclusionRules: DeviceBoundSessionInclusionRules, + /** + * See comments on `net::device_bound_sessions::Session::cookie_cravings_`. + */ + public val cookieCravings: List, + /** + * See comments on `net::device_bound_sessions::Session::expiry_date_`. + */ + public val expiryDate: Double, + /** + * See comments on `net::device_bound_sessions::Session::cached_challenge__`. + */ + public val cachedChallenge: String? = null, + /** + * See comments on `net::device_bound_sessions::Session::allowed_refresh_initiators_`. + */ + public val allowedRefreshInitiators: List, + ) + + /** + * A fetch result for a device bound session creation or refresh. + */ + @Serializable + public enum class DeviceBoundSessionFetchResult { + @SerialName("Success") + SUCCESS, + + @SerialName("KeyError") + KEYERROR, + + @SerialName("SigningError") + SIGNINGERROR, + + @SerialName("ServerRequestedTermination") + SERVERREQUESTEDTERMINATION, + + @SerialName("InvalidSessionId") + INVALIDSESSIONID, + + @SerialName("InvalidChallenge") + INVALIDCHALLENGE, + + @SerialName("TooManyChallenges") + TOOMANYCHALLENGES, + + @SerialName("InvalidFetcherUrl") + INVALIDFETCHERURL, + + @SerialName("InvalidRefreshUrl") + INVALIDREFRESHURL, + + @SerialName("TransientHttpError") + TRANSIENTHTTPERROR, + + @SerialName("ScopeOriginSameSiteMismatch") + SCOPEORIGINSAMESITEMISMATCH, + + @SerialName("RefreshUrlSameSiteMismatch") + REFRESHURLSAMESITEMISMATCH, + + @SerialName("MismatchedSessionId") + MISMATCHEDSESSIONID, + + @SerialName("MissingScope") + MISSINGSCOPE, + + @SerialName("NoCredentials") + NOCREDENTIALS, + + @SerialName("SubdomainRegistrationWellKnownUnavailable") + SUBDOMAINREGISTRATIONWELLKNOWNUNAVAILABLE, + + @SerialName("SubdomainRegistrationUnauthorized") + SUBDOMAINREGISTRATIONUNAUTHORIZED, + + @SerialName("SubdomainRegistrationWellKnownMalformed") + SUBDOMAINREGISTRATIONWELLKNOWNMALFORMED, + + @SerialName("SessionProviderWellKnownUnavailable") + SESSIONPROVIDERWELLKNOWNUNAVAILABLE, + + @SerialName("RelyingPartyWellKnownUnavailable") + RELYINGPARTYWELLKNOWNUNAVAILABLE, + + @SerialName("FederatedKeyThumbprintMismatch") + FEDERATEDKEYTHUMBPRINTMISMATCH, + + @SerialName("InvalidFederatedSessionUrl") + INVALIDFEDERATEDSESSIONURL, + + @SerialName("InvalidFederatedKey") + INVALIDFEDERATEDKEY, + + @SerialName("TooManyRelyingOriginLabels") + TOOMANYRELYINGORIGINLABELS, + + @SerialName("BoundCookieSetForbidden") + BOUNDCOOKIESETFORBIDDEN, + + @SerialName("NetError") + NETERROR, + + @SerialName("ProxyError") + PROXYERROR, + + @SerialName("EmptySessionConfig") + EMPTYSESSIONCONFIG, + + @SerialName("InvalidCredentialsConfig") + INVALIDCREDENTIALSCONFIG, + + @SerialName("InvalidCredentialsType") + INVALIDCREDENTIALSTYPE, + + @SerialName("InvalidCredentialsEmptyName") + INVALIDCREDENTIALSEMPTYNAME, + + @SerialName("InvalidCredentialsCookie") + INVALIDCREDENTIALSCOOKIE, + + @SerialName("PersistentHttpError") + PERSISTENTHTTPERROR, + + @SerialName("RegistrationAttemptedChallenge") + REGISTRATIONATTEMPTEDCHALLENGE, + + @SerialName("InvalidScopeOrigin") + INVALIDSCOPEORIGIN, + + @SerialName("ScopeOriginContainsPath") + SCOPEORIGINCONTAINSPATH, + + @SerialName("RefreshInitiatorNotString") + REFRESHINITIATORNOTSTRING, + + @SerialName("RefreshInitiatorInvalidHostPattern") + REFRESHINITIATORINVALIDHOSTPATTERN, + + @SerialName("InvalidScopeSpecification") + INVALIDSCOPESPECIFICATION, + + @SerialName("MissingScopeSpecificationType") + MISSINGSCOPESPECIFICATIONTYPE, + + @SerialName("EmptyScopeSpecificationDomain") + EMPTYSCOPESPECIFICATIONDOMAIN, + + @SerialName("EmptyScopeSpecificationPath") + EMPTYSCOPESPECIFICATIONPATH, + + @SerialName("InvalidScopeSpecificationType") + INVALIDSCOPESPECIFICATIONTYPE, + + @SerialName("InvalidScopeIncludeSite") + INVALIDSCOPEINCLUDESITE, + + @SerialName("MissingScopeIncludeSite") + MISSINGSCOPEINCLUDESITE, + + @SerialName("FederatedNotAuthorizedByProvider") + FEDERATEDNOTAUTHORIZEDBYPROVIDER, + + @SerialName("FederatedNotAuthorizedByRelyingParty") + FEDERATEDNOTAUTHORIZEDBYRELYINGPARTY, + + @SerialName("SessionProviderWellKnownMalformed") + SESSIONPROVIDERWELLKNOWNMALFORMED, + + @SerialName("SessionProviderWellKnownHasProviderOrigin") + SESSIONPROVIDERWELLKNOWNHASPROVIDERORIGIN, + + @SerialName("RelyingPartyWellKnownMalformed") + RELYINGPARTYWELLKNOWNMALFORMED, + + @SerialName("RelyingPartyWellKnownHasRelyingOrigins") + RELYINGPARTYWELLKNOWNHASRELYINGORIGINS, + + @SerialName("InvalidFederatedSessionProviderSessionMissing") + INVALIDFEDERATEDSESSIONPROVIDERSESSIONMISSING, + + @SerialName("InvalidFederatedSessionWrongProviderOrigin") + INVALIDFEDERATEDSESSIONWRONGPROVIDERORIGIN, + + @SerialName("InvalidCredentialsCookieCreationTime") + INVALIDCREDENTIALSCOOKIECREATIONTIME, + + @SerialName("InvalidCredentialsCookieName") + INVALIDCREDENTIALSCOOKIENAME, + + @SerialName("InvalidCredentialsCookieParsing") + INVALIDCREDENTIALSCOOKIEPARSING, + + @SerialName("InvalidCredentialsCookieUnpermittedAttribute") + INVALIDCREDENTIALSCOOKIEUNPERMITTEDATTRIBUTE, + + @SerialName("InvalidCredentialsCookieInvalidDomain") + INVALIDCREDENTIALSCOOKIEINVALIDDOMAIN, + + @SerialName("InvalidCredentialsCookiePrefix") + INVALIDCREDENTIALSCOOKIEPREFIX, + + @SerialName("InvalidScopeRulePath") + INVALIDSCOPERULEPATH, + + @SerialName("InvalidScopeRuleHostPattern") + INVALIDSCOPERULEHOSTPATTERN, + + @SerialName("ScopeRuleOriginScopedHostPatternMismatch") + SCOPERULEORIGINSCOPEDHOSTPATTERNMISMATCH, + + @SerialName("ScopeRuleSiteScopedHostPatternMismatch") + SCOPERULESITESCOPEDHOSTPATTERNMISMATCH, + + @SerialName("SigningQuotaExceeded") + SIGNINGQUOTAEXCEEDED, + + @SerialName("InvalidConfigJson") + INVALIDCONFIGJSON, + + @SerialName("InvalidFederatedSessionProviderFailedToRestoreKey") + INVALIDFEDERATEDSESSIONPROVIDERFAILEDTORESTOREKEY, + + @SerialName("FailedToUnwrapKey") + FAILEDTOUNWRAPKEY, + + @SerialName("SessionDeletedDuringRefresh") + SESSIONDELETEDDURINGREFRESH, + } + + /** + * Details about a failed device bound session network request. + */ + @Serializable + public data class DeviceBoundSessionFailedRequest( + /** + * The failed request URL. + */ + public val requestUrl: String, + /** + * The net error of the response if it was not OK. + */ + public val netError: String? = null, + /** + * The response code if the net error was OK and the response code was not + * 200. + */ + public val responseError: Int? = null, + /** + * The body of the response if the net error was OK, the response code was + * not 200, and the response body was not empty. + */ + public val responseErrorBody: String? = null, + ) + + /** + * Session event details specific to creation. + */ + @Serializable + public data class CreationEventDetails( + /** + * The result of the fetch attempt. + */ + public val fetchResult: DeviceBoundSessionFetchResult, + /** + * The session if there was a newly created session. This is populated for + * all successful creation events. + */ + public val newSession: DeviceBoundSession? = null, + /** + * Details about a failed device bound session network request if there was + * one. + */ + public val failedRequest: DeviceBoundSessionFailedRequest? = null, + ) + + /** + * Session event details specific to refresh. + */ + @Serializable + public data class RefreshEventDetails( + /** + * The result of a refresh. + */ + public val refreshResult: String, + /** + * If there was a fetch attempt, the result of that. + */ + public val fetchResult: DeviceBoundSessionFetchResult? = null, + /** + * The session display if there was a newly created session. This is populated + * for any refresh event that modifies the session config. + */ + public val newSession: DeviceBoundSession? = null, + /** + * See comments on `net::device_bound_sessions::RefreshEventResult::was_fully_proactive_refresh`. + */ + public val wasFullyProactiveRefresh: Boolean, + /** + * Details about a failed device bound session network request if there was + * one. + */ + public val failedRequest: DeviceBoundSessionFailedRequest? = null, + ) + + /** + * Session event details specific to termination. + */ + @Serializable + public data class TerminationEventDetails( + /** + * The reason for a session being deleted. + */ + public val deletionReason: String, + ) + + /** + * Session event details specific to challenges. + */ + @Serializable + public data class ChallengeEventDetails( + /** + * The result of a challenge. + */ + public val challengeResult: String, + /** + * The challenge set. + */ + public val challenge: String, + ) + + /** + * An object providing the result of a network resource load. + */ + @Serializable + public data class LoadNetworkResourcePageResult( + public val success: Boolean, + /** + * Optional values used for error reporting. + */ + public val netError: Double? = null, + public val netErrorName: String? = null, + public val httpStatusCode: Double? = null, + /** + * If successful, one of the following two fields holds the result. + */ + public val stream: String? = null, + /** + * Response headers. + */ + public val headers: Map? = null, + ) + + /** + * An options object that may be extended later to better support CORS, + * CORB and streaming. + */ + @Serializable + public data class LoadNetworkResourceOptions( + public val disableCache: Boolean, public val includeCredentials: Boolean, ) @@ -3524,6 +4201,10 @@ public class Network( * Whether the request is initiated by a user gesture. Defaults to false. */ public val hasUserGesture: Boolean? = null, + /** + * The render-blocking behavior of the request. + */ + public val renderBlockingBehavior: RenderBlockingBehavior? = null, ) /** @@ -3856,6 +4537,18 @@ public class Network( public val timestamp: Double, ) + @Serializable + public data class DirectUDPSocketJoinedMulticastGroupParameter( + public val identifier: String, + public val IPAddress: String, + ) + + @Serializable + public data class DirectUDPSocketLeftMulticastGroupParameter( + public val identifier: String, + public val IPAddress: String, + ) + /** * Fired upon direct_socket.UDPSocket creation. */ @@ -3950,6 +4643,10 @@ public class Network( * Connection timing information for the request. */ public val connectTiming: ConnectTiming, + /** + * How the request site's device bound sessions were used during this request. + */ + public val deviceBoundSessionUsages: List? = null, /** * The client security state set for the request. */ @@ -3958,6 +4655,11 @@ public class Network( * Whether the site has partitioned cookies stored in a partition different than the current one. */ public val siteHasCookieInOtherPartition: Boolean? = null, + /** + * The network conditions id if this request was affected by network conditions configured via + * emulateNetworkConditionsByRule. + */ + public val appliedNetworkConditionsId: String? = null, ) /** @@ -4068,104 +4770,68 @@ public class Network( ) /** - * Fired once when parsing the .wbn file has succeeded. - * The event contains the information about the web bundle contents. + * Is sent whenever a new report is added. + * And after 'enableReportingApi' for all existing reports. */ @Serializable - public data class SubresourceWebBundleMetadataReceivedParameter( - /** - * Request identifier. Used to match this information to another event. - */ - public val requestId: String, - /** - * A list of URLs of resources in the subresource Web Bundle. - */ - public val urls: List, + public data class ReportingApiReportAddedParameter( + public val report: ReportingApiReport, ) - /** - * Fired once when parsing the .wbn file has failed. - */ @Serializable - public data class SubresourceWebBundleMetadataErrorParameter( - /** - * Request identifier. Used to match this information to another event. - */ - public val requestId: String, + public data class ReportingApiReportUpdatedParameter( + public val report: ReportingApiReport, + ) + + @Serializable + public data class ReportingApiEndpointsChangedForOriginParameter( /** - * Error message + * Origin of the document(s) which configured the endpoints. */ - public val errorMessage: String, + public val origin: String, + public val endpoints: List, ) /** - * Fired when handling requests for resources within a .wbn file. - * Note: this will only be fired for resources that are requested by the webpage. + * Triggered when the initial set of device bound sessions is added. */ @Serializable - public data class SubresourceWebBundleInnerResponseParsedParameter( + public data class DeviceBoundSessionsAddedParameter( /** - * Request identifier of the subresource request + * The device bound sessions. */ - public val innerRequestId: String, - /** - * URL of the subresource resource. - */ - public val innerRequestURL: String, - /** - * Bundle request identifier. Used to match this information to another event. - * This made be absent in case when the instrumentation was enabled only - * after webbundle was parsed. - */ - public val bundleRequestId: String? = null, + public val sessions: List, ) /** - * Fired when request for resources within a .wbn file failed. + * Triggered when a device bound session event occurs. */ @Serializable - public data class SubresourceWebBundleInnerResponseErrorParameter( + public data class DeviceBoundSessionEventOccurredParameter( /** - * Request identifier of the subresource request + * A unique identifier for this session event. */ - public val innerRequestId: String, + public val eventId: String, /** - * URL of the subresource resource. + * The site this session event is associated with. */ - public val innerRequestURL: String, + public val site: String, /** - * Error message + * Whether this event was considered successful. */ - public val errorMessage: String, + public val succeeded: Boolean, /** - * Bundle request identifier. Used to match this information to another event. - * This made be absent in case when the instrumentation was enabled only - * after webbundle was parsed. + * The session ID this event is associated with. May not be populated for + * failed events. */ - public val bundleRequestId: String? = null, - ) - - /** - * Is sent whenever a new report is added. - * And after 'enableReportingApi' for all existing reports. - */ - @Serializable - public data class ReportingApiReportAddedParameter( - public val report: ReportingApiReport, - ) - - @Serializable - public data class ReportingApiReportUpdatedParameter( - public val report: ReportingApiReport, - ) - - @Serializable - public data class ReportingApiEndpointsChangedForOriginParameter( + public val sessionId: String? = null, /** - * Origin of the document(s) which configured the endpoints. + * The below are the different session event type details. Exactly one is populated. */ - public val origin: String, - public val endpoints: List, + public val creationEventDetails: CreationEventDetails? = null, + public val refreshEventDetails: RefreshEventDetails? = null, + public val terminationEventDetails: TerminationEventDetails? = null, + public val challengeEventDetails: ChallengeEventDetails? = null, ) @Serializable @@ -4301,10 +4967,64 @@ public class Network( public val packetReordering: Boolean? = null, ) + @Serializable + public data class EmulateNetworkConditionsByRuleParameter( + /** + * True to emulate internet disconnection. Deprecated, use the offline property in matchedNetworkConditions + * or emulateOfflineServiceWorker instead. + */ + public val offline: Boolean? = null, + /** + * True to emulate offline service worker. + */ + public val emulateOfflineServiceWorker: Boolean? = null, + /** + * Configure conditions for matching requests. If multiple entries match a request, the first entry wins. Global + * conditions can be configured by leaving the urlPattern for the conditions empty. These global conditions are + * also applied for throttling of p2p connections. + */ + public val matchedNetworkConditions: List, + ) + + @Serializable + public data class EmulateNetworkConditionsByRuleReturn( + /** + * An id for each entry in matchedNetworkConditions. The id will be included in the requestWillBeSentExtraInfo for + * requests affected by a rule. + */ + public val ruleIds: List, + ) + + @Serializable + public data class OverrideNetworkStateParameter( + /** + * True to emulate internet disconnection. + */ + public val offline: Boolean, + /** + * Minimum latency from request sent to response headers received (ms). + */ + public val latency: Double, + /** + * Maximal aggregated download throughput (bytes/sec). -1 disables download throttling. + */ + public val downloadThroughput: Double, + /** + * Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling. + */ + public val uploadThroughput: Double, + /** + * Connection type if known. + */ + public val connectionType: ConnectionType? = null, + ) + @Serializable public data class EnableParameter( /** * Buffer size in bytes to use when preserving network payloads (XHRs, etc). + * This is the maximum number of bytes that will be collected by this + * DevTools session. */ public val maxTotalBufferSize: Int? = null, /** @@ -4319,6 +5039,26 @@ public class Network( * Whether DirectSocket chunk send/receive events should be reported. */ public val reportDirectSocketTraffic: Boolean? = null, + /** + * Enable storing response bodies outside of renderer, so that these survive + * a cross-process navigation. Requires maxTotalBufferSize to be set. + * Currently defaults to false. This field is being deprecated in favor of the dedicated + * configureDurableMessages command, due to the possibility of deadlocks when awaiting + * Network.enable before issuing Runtime.runIfWaitingForDebugger. + */ + public val enableDurableMessages: Boolean? = null, + ) + + @Serializable + public data class ConfigureDurableMessagesParameter( + /** + * Buffer size in bytes to use when preserving network payloads (XHRs, etc). + */ + public val maxTotalBufferSize: Int? = null, + /** + * Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc). + */ + public val maxResourceBufferSize: Int? = null, ) @Serializable @@ -4394,6 +5134,10 @@ public class Network( * Request body string, omitting files from multipart requests */ public val postData: String, + /** + * True, if content was sent as base64. + */ + public val base64Encoded: Boolean, ) @Serializable @@ -4464,10 +5208,15 @@ public class Network( @Serializable public data class SetBlockedURLsParameter( + /** + * Patterns to match in the order in which they are given. These patterns + * also take precedence over any wildcard patterns defined in `urls`. + */ + public val urlPatterns: List? = null, /** * URL patterns to block. Wildcards ('*') are allowed. */ - public val urls: List, + public val urls: List? = null, ) @Serializable @@ -4529,10 +5278,6 @@ public class Network( * Cookie Priority type. */ public val priority: CookiePriority? = null, - /** - * True if cookie is SameParty. - */ - public val sameParty: Boolean? = null, /** * Cookie source scheme type. */ @@ -4647,6 +5392,30 @@ public class Network( public val enable: Boolean, ) + @Serializable + public data class EnableDeviceBoundSessionsParameter( + /** + * Whether to enable or disable events. + */ + public val enable: Boolean, + ) + + @Serializable + public data class FetchSchemefulSiteParameter( + /** + * The URL origin. + */ + public val origin: String, + ) + + @Serializable + public data class FetchSchemefulSiteReturn( + /** + * The corresponding schemeful site. + */ + public val schemefulSite: String, + ) + @Serializable public data class LoadNetworkResourceParameter( /** @@ -4675,13 +5444,5 @@ public class Network( * Whether 3pc restriction is enabled. */ public val enableThirdPartyCookieRestriction: Boolean, - /** - * Whether 3pc grace period exception should be enabled; false by default. - */ - public val disableThirdPartyCookieMetadata: Boolean, - /** - * Whether 3pc heuristics exceptions should be enabled; false by default. - */ - public val disableThirdPartyCookieHeuristics: Boolean, ) } diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Overlay.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Overlay.kt index aa9263a46..c31126656 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Overlay.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Overlay.kt @@ -2,21 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Deprecated -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.Unit -import kotlin.collections.List -import kotlin.collections.Map +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -70,6 +56,26 @@ public class Overlay( .filterNotNull() .map { Serialization.json.decodeFromJsonElement(it) } + /** + * Fired when user asks to show the Inspect panel. + */ + public val inspectPanelShowRequested: Flow = cdp + .events + .filter { it.method == "Overlay.inspectPanelShowRequested" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Fired when user asks to restore the Inspected Element floating window. + */ + public val inspectedElementWindowRestored: Flow = cdp + .events + .filter { it.method == "Overlay.inspectedElementWindowRestored" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + /** * Fired when user cancels the inspect mode. */ @@ -284,6 +290,9 @@ public class Overlay( /** * Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport. + * Issue: the method does not handle device pixel ratio (DPR) correctly. + * The coordinates currently have to be adjusted by the client + * if DPR is not 1 (see crbug.com/437807128). */ public suspend fun highlightRect(args: HighlightRectParameter, mode: CommandMode = CommandMode.DEFAULT) { val parameter = Serialization.json.encodeToJsonElement(args) @@ -292,6 +301,9 @@ public class Overlay( /** * Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport. + * Issue: the method does not handle device pixel ratio (DPR) correctly. + * The coordinates currently have to be adjusted by the client + * if DPR is not 1 (see crbug.com/437807128). * * @param x X coordinate * @param y Y coordinate @@ -531,6 +543,25 @@ public class Overlay( setShowContainerQueryOverlays(parameter) } + public suspend fun setShowInspectedElementAnchor( + args: SetShowInspectedElementAnchorParameter, + mode: CommandMode = CommandMode.DEFAULT, + ) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("Overlay.setShowInspectedElementAnchor", parameter, mode) + } + + /** + * + * + * @param inspectedElementAnchorConfig Node identifier for which to show an anchor for. + */ + public suspend fun setShowInspectedElementAnchor(inspectedElementAnchorConfig: InspectedElementAnchorConfig) { + val parameter = + SetShowInspectedElementAnchorParameter(inspectedElementAnchorConfig = inspectedElementAnchorConfig) + setShowInspectedElementAnchor(parameter) + } + /** * Requests that backend shows paint rectangles */ @@ -1181,6 +1212,18 @@ public class Overlay( NONE, } + @Serializable + public data class InspectedElementAnchorConfig( + /** + * Identifier of the node to highlight. + */ + public val nodeId: Int? = null, + /** + * Identifier of the backend node to highlight. + */ + public val backendNodeId: Int? = null, + ) + /** * Fired when the node should be inspected. This happens after call to `setInspectMode` or when * user manually inspects an element. @@ -1212,6 +1255,28 @@ public class Overlay( public val viewport: Page.Viewport, ) + /** + * Fired when user asks to show the Inspect panel. + */ + @Serializable + public data class InspectPanelShowRequestedParameter( + /** + * Id of the node to show in the panel. + */ + public val backendNodeId: Int, + ) + + /** + * Fired when user asks to restore the Inspected Element floating window. + */ + @Serializable + public data class InspectedElementWindowRestoredParameter( + /** + * Id of the node to restore the floating window for. + */ + public val backendNodeId: Int, + ) + @Serializable public data class GetHighlightObjectForTestParameter( /** @@ -1457,6 +1522,14 @@ public class Overlay( public val containerQueryHighlightConfigs: List, ) + @Serializable + public data class SetShowInspectedElementAnchorParameter( + /** + * Node identifier for which to show an anchor for. + */ + public val inspectedElementAnchorConfig: InspectedElementAnchorConfig, + ) + @Serializable public data class SetShowPaintRectsParameter( /** diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/PWA.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/PWA.kt index 8556b81f1..7186d83d3 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/PWA.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/PWA.kt @@ -2,20 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List -import kotlinx.coroutines.flow.filter -import kotlinx.coroutines.flow.filterNotNull -import kotlinx.coroutines.flow.map +import dev.kdriver.cdp.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement @@ -78,7 +65,8 @@ public class PWA( * * To generate bundle id for proxy mode: * 1. Generate 32 random bytes. - * 2. Add a specific suffix 0x00 at the end. + * 2. Add a specific suffix at the end following the documentation + * https://github.com/WICG/isolated-web-apps/blob/main/Scheme.md#suffix * 3. Encode the entire sequence using Base32 without padding. * * If Chrome is not in IWA dev @@ -110,7 +98,8 @@ public class PWA( * * To generate bundle id for proxy mode: * 1. Generate 32 random bytes. - * 2. Add a specific suffix 0x00 at the end. + * 2. Add a specific suffix at the end following the documentation + * https://github.com/WICG/isolated-web-apps/blob/main/Scheme.md#suffix * 3. Encode the entire sequence using Base32 without padding. * * If Chrome is not in IWA dev diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Page.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Page.kt index f5f3a60ee..ef9d2a2de 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Page.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Page.kt @@ -2,20 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Deprecated -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.Unit -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -1633,6 +1620,30 @@ public class Page( setPrerenderingAllowed(parameter) } + /** + * Get the annotated page content for the main frame. + * This is an experimental command that is subject to change. + */ + public suspend fun getAnnotatedPageContent( + args: GetAnnotatedPageContentParameter, + mode: CommandMode = CommandMode.DEFAULT, + ): GetAnnotatedPageContentReturn { + val parameter = Serialization.json.encodeToJsonElement(args) + val result = cdp.callCommand("Page.getAnnotatedPageContent", parameter, mode) + return result!!.let { Serialization.json.decodeFromJsonElement(it) } + } + + /** + * Get the annotated page content for the main frame. + * This is an experimental command that is subject to change. + * + * @param includeActionableInformation Whether to include actionable information. Defaults to true. + */ + public suspend fun getAnnotatedPageContent(includeActionableInformation: Boolean? = null): GetAnnotatedPageContentReturn { + val parameter = GetAnnotatedPageContentParameter(includeActionableInformation = includeActionableInformation) + return getAnnotatedPageContent(parameter) + } + /** * Indicates whether a frame has been identified as an ad. */ @@ -1669,45 +1680,6 @@ public class Page( public val explanations: List? = null, ) - /** - * Identifies the script which caused a script or frame to be labelled as an - * ad. - */ - @Serializable - public data class AdScriptId( - /** - * Script Id of the script which caused a script or frame to be labelled as - * an ad. - */ - public val scriptId: String, - /** - * Id of scriptId's debugger. - */ - public val debuggerId: String, - ) - - /** - * Encapsulates the script ancestry and the root script filterlist rule that - * caused the frame to be labelled as an ad. Only created when `ancestryChain` - * is not empty. - */ - @Serializable - public data class AdScriptAncestry( - /** - * A chain of `AdScriptId`s representing the ancestry of an ad script that - * led to the creation of a frame. The chain is ordered from the script - * itself (lower level) up to its root ancestor that was flagged by - * filterlist. - */ - public val ancestryChain: List, - /** - * The filterlist rule that caused the root (last) script in - * `ancestryChain` to be ad-tagged. Only populated if the rule is - * available. - */ - public val rootScriptFilterlistRule: String? = null, - ) - /** * Indicates whether the frame is a secure context and why it is the case. */ @@ -1778,6 +1750,9 @@ public class Page( @SerialName("attribution-reporting") ATTRIBUTION_REPORTING, + @SerialName("autofill") + AUTOFILL, + @SerialName("autoplay") AUTOPLAY, @@ -1898,6 +1873,9 @@ public class Page( @SerialName("direct-sockets") DIRECT_SOCKETS, + @SerialName("direct-sockets-multicast") + DIRECT_SOCKETS_MULTICAST, + @SerialName("direct-sockets-private") DIRECT_SOCKETS_PRIVATE, @@ -1916,9 +1894,6 @@ public class Page( @SerialName("execution-while-not-rendered") EXECUTION_WHILE_NOT_RENDERED, - @SerialName("fenced-unpartitioned-storage-read") - FENCED_UNPARTITIONED_STORAGE_READ, - @SerialName("focus-without-user-activation") FOCUS_WITHOUT_USER_ACTIVATION, @@ -1964,12 +1939,21 @@ public class Page( @SerialName("local-fonts") LOCAL_FONTS, + @SerialName("local-network") + LOCAL_NETWORK, + @SerialName("local-network-access") LOCAL_NETWORK_ACCESS, + @SerialName("loopback-network") + LOOPBACK_NETWORK, + @SerialName("magnetometer") MAGNETOMETER, + @SerialName("manual-text") + MANUAL_TEXT, + @SerialName("media-playback-while-not-visible") MEDIA_PLAYBACK_WHILE_NOT_VISIBLE, @@ -1991,9 +1975,6 @@ public class Page( @SerialName("picture-in-picture") PICTURE_IN_PICTURE, - @SerialName("popins") - POPINS, - @SerialName("private-aggregation") PRIVATE_AGGREGATION, @@ -2024,9 +2005,6 @@ public class Page( @SerialName("serial") SERIAL, - @SerialName("shared-autofill") - SHARED_AUTOFILL, - @SerialName("shared-storage") SHARED_STORAGE, @@ -3078,6 +3056,9 @@ public class Page( @SerialName("ForegroundCacheLimit") FOREGROUNDCACHELIMIT, + @SerialName("ForwardCacheDisabled") + FORWARDCACHEDISABLED, + @SerialName("BrowsingInstanceNotSwapped") BROWSINGINSTANCENOTSWAPPED, @@ -3201,12 +3182,21 @@ public class Page( @SerialName("SharedWorkerMessage") SHAREDWORKERMESSAGE, + @SerialName("SharedWorkerWithNoActiveClient") + SHAREDWORKERWITHNOACTIVECLIENT, + @SerialName("WebLocks") WEBLOCKS, + @SerialName("WebLocksContention") + WEBLOCKSCONTENTION, + @SerialName("WebHID") WEBHID, + @SerialName("WebBluetooth") + WEBBLUETOOTH, + @SerialName("WebShare") WEBSHARE, @@ -3273,14 +3263,14 @@ public class Page( @SerialName("JsNetworkRequestReceivedCacheControlNoStoreResource") JSNETWORKREQUESTRECEIVEDCACHECONTROLNOSTORERESOURCE, - @SerialName("WebRTCSticky") - WEBRTCSTICKY, + @SerialName("WebRTCUsedWithCCNS") + WEBRTCUSEDWITHCCNS, - @SerialName("WebTransportSticky") - WEBTRANSPORTSTICKY, + @SerialName("WebTransportUsedWithCCNS") + WEBTRANSPORTUSEDWITHCCNS, - @SerialName("WebSocketSticky") - WEBSOCKETSTICKY, + @SerialName("WebSocketUsedWithCCNS") + WEBSOCKETUSEDWITHCCNS, @SerialName("SmartCard") SMARTCARD, @@ -4093,7 +4083,7 @@ public class Page( * stack) to more distant ancestors (that created the immediately preceding * script). Only sent if frame is labelled as an ad and ids are available. */ - public val adScriptAncestry: AdScriptAncestry?, + public val adScriptAncestry: Network.AdAncestry?, ) @Serializable @@ -4680,4 +4670,22 @@ public class Page( public data class SetPrerenderingAllowedParameter( public val isAllowed: Boolean, ) + + @Serializable + public data class GetAnnotatedPageContentParameter( + /** + * Whether to include actionable information. Defaults to true. + */ + public val includeActionableInformation: Boolean? = null, + ) + + @Serializable + public data class GetAnnotatedPageContentReturn( + /** + * The annotated page content as a base64 encoded protobuf. + * The format is defined by the `AnnotatedPageContent` message in + * components/optimization_guide/proto/features/common_quality_data.proto (Encoded as a base64 string when passed over JSON) + */ + public val content: String, + ) } diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Performance.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Performance.kt index 6a8a4ef57..dcb791474 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Performance.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Performance.kt @@ -2,17 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Deprecated -import kotlin.Double -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/PerformanceTimeline.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/PerformanceTimeline.kt index 93b0f821c..86225057a 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/PerformanceTimeline.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/PerformanceTimeline.kt @@ -2,18 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Preload.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Preload.kt index 48adaef56..373d9e807 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Preload.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Preload.kt @@ -2,17 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -20,7 +10,6 @@ import kotlinx.coroutines.flow.map import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement -import kotlinx.serialization.json.encodeToJsonElement public val CDP.preload: Preload get() = getGeneratedDomain() ?: cacheGeneratedDomain(Preload(this)) @@ -139,6 +128,11 @@ public class Preload( * TODO(https://crbug.com/1425354): Replace this property with structured error. */ public val errorMessage: String? = null, + /** + * For more details, see: + * https://github.com/WICG/nav-speculation/blob/main/speculation-rules-tags.md + */ + public val tag: String? = null, ) @Serializable @@ -165,6 +159,9 @@ public class Preload( @SerialName("Prerender") PRERENDER, + + @SerialName("PrerenderUntilScript") + PRERENDERUNTILSCRIPT, } /** @@ -193,6 +190,7 @@ public class Preload( public val loaderId: String, public val action: SpeculationAction, public val url: String, + public val formSubmission: Boolean? = null, public val targetHint: SpeculationTargetHint? = null, ) @@ -436,6 +434,9 @@ public class Preload( @SerialName("PrerenderHostReused") PRERENDERHOSTREUSED, + + @SerialName("FormSubmitWhenPrerendering") + FORMSUBMITWHENPRERENDERING, } /** diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Profiler.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Profiler.kt index 2d5185966..a5ea4c408 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Profiler.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Profiler.kt @@ -2,18 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Runtime.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Runtime.kt index 648895892..194b171f1 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Runtime.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Runtime.kt @@ -2,20 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.Unit -import kotlin.collections.List -import kotlin.collections.Map +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Security.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Security.kt index 159604091..08eee13f4 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Security.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Security.kt @@ -2,19 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Deprecated -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -24,15 +12,9 @@ import kotlinx.serialization.Serializable import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement -/** - * Security - */ public val CDP.security: Security get() = getGeneratedDomain() ?: cacheGeneratedDomain(Security(this)) -/** - * Security - */ public class Security( private val cdp: CDP, ) : Domain { diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/ServiceWorker.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/ServiceWorker.kt index 95e55cd84..f83e3aa49 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/ServiceWorker.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/ServiceWorker.kt @@ -2,18 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/SmartCardEmulation.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/SmartCardEmulation.kt new file mode 100644 index 000000000..5de2efaad --- /dev/null +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/SmartCardEmulation.kt @@ -0,0 +1,1062 @@ +@file:Suppress("ALL") + +package dev.kdriver.cdp.domain + +import dev.kdriver.cdp.* +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.json.decodeFromJsonElement +import kotlinx.serialization.json.encodeToJsonElement + +public val CDP.smartCardEmulation: SmartCardEmulation + get() = getGeneratedDomain() ?: cacheGeneratedDomain(SmartCardEmulation(this)) + +public class SmartCardEmulation( + private val cdp: CDP, +) : Domain { + /** + * Fired when |SCardEstablishContext| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardestablishcontext + */ + public val establishContextRequested: Flow = cdp + .events + .filter { it.method == "SmartCardEmulation.establishContextRequested" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Fired when |SCardReleaseContext| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga6aabcba7744c5c9419fdd6404f73a934 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardreleasecontext + */ + public val releaseContextRequested: Flow = cdp + .events + .filter { it.method == "SmartCardEmulation.releaseContextRequested" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Fired when |SCardListReaders| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga93b07815789b3cf2629d439ecf20f0d9 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardlistreadersa + */ + public val listReadersRequested: Flow = cdp + .events + .filter { it.method == "SmartCardEmulation.listReadersRequested" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Fired when |SCardGetStatusChange| is called. Timeout is specified in milliseconds. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga33247d5d1257d59e55647c3bb717db24 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetstatuschangea + */ + public val getStatusChangeRequested: Flow = cdp + .events + .filter { it.method == "SmartCardEmulation.getStatusChangeRequested" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Fired when |SCardCancel| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaacbbc0c6d6c0cbbeb4f4debf6fbeeee6 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcancel + */ + public val cancelRequested: Flow = cdp + .events + .filter { it.method == "SmartCardEmulation.cancelRequested" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Fired when |SCardConnect| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardconnecta + */ + public val connectRequested: Flow = cdp + .events + .filter { it.method == "SmartCardEmulation.connectRequested" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Fired when |SCardDisconnect| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga4be198045c73ec0deb79e66c0ca1738a + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scarddisconnect + */ + public val disconnectRequested: Flow = cdp + .events + .filter { it.method == "SmartCardEmulation.disconnectRequested" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Fired when |SCardTransmit| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga9a2d77242a271310269065e64633ab99 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardtransmit + */ + public val transmitRequested: Flow = cdp + .events + .filter { it.method == "SmartCardEmulation.transmitRequested" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Fired when |SCardControl| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gac3454d4657110fd7f753b2d3d8f4e32f + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcontrol + */ + public val controlRequested: Flow = cdp + .events + .filter { it.method == "SmartCardEmulation.controlRequested" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Fired when |SCardGetAttrib| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaacfec51917255b7a25b94c5104961602 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetattrib + */ + public val getAttribRequested: Flow = cdp + .events + .filter { it.method == "SmartCardEmulation.getAttribRequested" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Fired when |SCardSetAttrib| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga060f0038a4ddfd5dd2b8fadf3c3a2e4f + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardsetattrib + */ + public val setAttribRequested: Flow = cdp + .events + .filter { it.method == "SmartCardEmulation.setAttribRequested" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Fired when |SCardStatus| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gae49c3c894ad7ac12a5b896bde70d0382 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardstatusa + */ + public val statusRequested: Flow = cdp + .events + .filter { it.method == "SmartCardEmulation.statusRequested" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Fired when |SCardBeginTransaction| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaddb835dce01a0da1d6ca02d33ee7d861 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardbegintransaction + */ + public val beginTransactionRequested: Flow = cdp + .events + .filter { it.method == "SmartCardEmulation.beginTransactionRequested" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Fired when |SCardEndTransaction| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gae8742473b404363e5c587f570d7e2f3b + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardendtransaction + */ + public val endTransactionRequested: Flow = cdp + .events + .filter { it.method == "SmartCardEmulation.endTransactionRequested" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Enables the |SmartCardEmulation| domain. + */ + public suspend fun enable(mode: CommandMode = CommandMode.DEFAULT) { + val parameter = null + cdp.callCommand("SmartCardEmulation.enable", parameter, mode) + } + + /** + * Disables the |SmartCardEmulation| domain. + */ + public suspend fun disable(mode: CommandMode = CommandMode.DEFAULT) { + val parameter = null + cdp.callCommand("SmartCardEmulation.disable", parameter, mode) + } + + /** + * Reports the successful result of a |SCardEstablishContext| call. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardestablishcontext + */ + public suspend fun reportEstablishContextResult( + args: ReportEstablishContextResultParameter, + mode: CommandMode = CommandMode.DEFAULT, + ) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("SmartCardEmulation.reportEstablishContextResult", parameter, mode) + } + + /** + * Reports the successful result of a |SCardEstablishContext| call. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardestablishcontext + * + * @param requestId No description + * @param contextId No description + */ + public suspend fun reportEstablishContextResult(requestId: String, contextId: Int) { + val parameter = ReportEstablishContextResultParameter(requestId = requestId, contextId = contextId) + reportEstablishContextResult(parameter) + } + + /** + * Reports the successful result of a |SCardReleaseContext| call. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga6aabcba7744c5c9419fdd6404f73a934 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardreleasecontext + */ + public suspend fun reportReleaseContextResult( + args: ReportReleaseContextResultParameter, + mode: CommandMode = CommandMode.DEFAULT, + ) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("SmartCardEmulation.reportReleaseContextResult", parameter, mode) + } + + /** + * Reports the successful result of a |SCardReleaseContext| call. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga6aabcba7744c5c9419fdd6404f73a934 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardreleasecontext + * + * @param requestId No description + */ + public suspend fun reportReleaseContextResult(requestId: String) { + val parameter = ReportReleaseContextResultParameter(requestId = requestId) + reportReleaseContextResult(parameter) + } + + /** + * Reports the successful result of a |SCardListReaders| call. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga93b07815789b3cf2629d439ecf20f0d9 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardlistreadersa + */ + public suspend fun reportListReadersResult( + args: ReportListReadersResultParameter, + mode: CommandMode = CommandMode.DEFAULT, + ) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("SmartCardEmulation.reportListReadersResult", parameter, mode) + } + + /** + * Reports the successful result of a |SCardListReaders| call. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga93b07815789b3cf2629d439ecf20f0d9 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardlistreadersa + * + * @param requestId No description + * @param readers No description + */ + public suspend fun reportListReadersResult(requestId: String, readers: List) { + val parameter = ReportListReadersResultParameter(requestId = requestId, readers = readers) + reportListReadersResult(parameter) + } + + /** + * Reports the successful result of a |SCardGetStatusChange| call. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga33247d5d1257d59e55647c3bb717db24 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetstatuschangea + */ + public suspend fun reportGetStatusChangeResult( + args: ReportGetStatusChangeResultParameter, + mode: CommandMode = CommandMode.DEFAULT, + ) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("SmartCardEmulation.reportGetStatusChangeResult", parameter, mode) + } + + /** + * Reports the successful result of a |SCardGetStatusChange| call. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga33247d5d1257d59e55647c3bb717db24 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetstatuschangea + * + * @param requestId No description + * @param readerStates No description + */ + public suspend fun reportGetStatusChangeResult(requestId: String, readerStates: List) { + val parameter = ReportGetStatusChangeResultParameter(requestId = requestId, readerStates = readerStates) + reportGetStatusChangeResult(parameter) + } + + /** + * Reports the result of a |SCardBeginTransaction| call. + * On success, this creates a new transaction object. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaddb835dce01a0da1d6ca02d33ee7d861 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardbegintransaction + */ + public suspend fun reportBeginTransactionResult( + args: ReportBeginTransactionResultParameter, + mode: CommandMode = CommandMode.DEFAULT, + ) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("SmartCardEmulation.reportBeginTransactionResult", parameter, mode) + } + + /** + * Reports the result of a |SCardBeginTransaction| call. + * On success, this creates a new transaction object. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaddb835dce01a0da1d6ca02d33ee7d861 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardbegintransaction + * + * @param requestId No description + * @param handle No description + */ + public suspend fun reportBeginTransactionResult(requestId: String, handle: Int) { + val parameter = ReportBeginTransactionResultParameter(requestId = requestId, handle = handle) + reportBeginTransactionResult(parameter) + } + + /** + * Reports the successful result of a call that returns only a result code. + * Used for: |SCardCancel|, |SCardDisconnect|, |SCardSetAttrib|, |SCardEndTransaction|. + * + * This maps to: + * 1. SCardCancel + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaacbbc0c6d6c0cbbeb4f4debf6fbeeee6 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcancel + * + * 2. SCardDisconnect + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga4be198045c73ec0deb79e66c0ca1738a + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scarddisconnect + * + * 3. SCardSetAttrib + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga060f0038a4ddfd5dd2b8fadf3c3a2e4f + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardsetattrib + * + * 4. SCardEndTransaction + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gae8742473b404363e5c587f570d7e2f3b + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardendtransaction + */ + public suspend fun reportPlainResult(args: ReportPlainResultParameter, mode: CommandMode = CommandMode.DEFAULT) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("SmartCardEmulation.reportPlainResult", parameter, mode) + } + + /** + * Reports the successful result of a call that returns only a result code. + * Used for: |SCardCancel|, |SCardDisconnect|, |SCardSetAttrib|, |SCardEndTransaction|. + * + * This maps to: + * 1. SCardCancel + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaacbbc0c6d6c0cbbeb4f4debf6fbeeee6 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcancel + * + * 2. SCardDisconnect + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga4be198045c73ec0deb79e66c0ca1738a + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scarddisconnect + * + * 3. SCardSetAttrib + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga060f0038a4ddfd5dd2b8fadf3c3a2e4f + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardsetattrib + * + * 4. SCardEndTransaction + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gae8742473b404363e5c587f570d7e2f3b + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardendtransaction + * + * @param requestId No description + */ + public suspend fun reportPlainResult(requestId: String) { + val parameter = ReportPlainResultParameter(requestId = requestId) + reportPlainResult(parameter) + } + + /** + * Reports the successful result of a |SCardConnect| call. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardconnecta + */ + public suspend fun reportConnectResult( + args: ReportConnectResultParameter, + mode: CommandMode = CommandMode.DEFAULT, + ) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("SmartCardEmulation.reportConnectResult", parameter, mode) + } + + /** + * Reports the successful result of a |SCardConnect| call. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardconnecta + * + * @param requestId No description + * @param handle No description + * @param activeProtocol No description + */ + public suspend fun reportConnectResult( + requestId: String, + handle: Int, + activeProtocol: Protocol? = null, + ) { + val parameter = + ReportConnectResultParameter(requestId = requestId, handle = handle, activeProtocol = activeProtocol) + reportConnectResult(parameter) + } + + /** + * Reports the successful result of a call that sends back data on success. + * Used for |SCardTransmit|, |SCardControl|, and |SCardGetAttrib|. + * + * This maps to: + * 1. SCardTransmit + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga9a2d77242a271310269065e64633ab99 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardtransmit + * + * 2. SCardControl + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gac3454d4657110fd7f753b2d3d8f4e32f + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcontrol + * + * 3. SCardGetAttrib + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaacfec51917255b7a25b94c5104961602 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetattrib + */ + public suspend fun reportDataResult(args: ReportDataResultParameter, mode: CommandMode = CommandMode.DEFAULT) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("SmartCardEmulation.reportDataResult", parameter, mode) + } + + /** + * Reports the successful result of a call that sends back data on success. + * Used for |SCardTransmit|, |SCardControl|, and |SCardGetAttrib|. + * + * This maps to: + * 1. SCardTransmit + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga9a2d77242a271310269065e64633ab99 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardtransmit + * + * 2. SCardControl + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gac3454d4657110fd7f753b2d3d8f4e32f + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcontrol + * + * 3. SCardGetAttrib + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaacfec51917255b7a25b94c5104961602 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetattrib + * + * @param requestId No description + * @param data No description + */ + public suspend fun reportDataResult(requestId: String, `data`: String) { + val parameter = ReportDataResultParameter(requestId = requestId, data = data) + reportDataResult(parameter) + } + + /** + * Reports the successful result of a |SCardStatus| call. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gae49c3c894ad7ac12a5b896bde70d0382 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardstatusa + */ + public suspend fun reportStatusResult(args: ReportStatusResultParameter, mode: CommandMode = CommandMode.DEFAULT) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("SmartCardEmulation.reportStatusResult", parameter, mode) + } + + /** + * Reports the successful result of a |SCardStatus| call. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gae49c3c894ad7ac12a5b896bde70d0382 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardstatusa + * + * @param requestId No description + * @param readerName No description + * @param state No description + * @param atr No description + * @param protocol No description + */ + public suspend fun reportStatusResult( + requestId: String, + readerName: String, + state: ConnectionState, + atr: String, + protocol: Protocol? = null, + ) { + val parameter = ReportStatusResultParameter( + requestId = requestId, + readerName = readerName, + state = state, + atr = atr, + protocol = protocol + ) + reportStatusResult(parameter) + } + + /** + * Reports an error result for the given request. + */ + public suspend fun reportError(args: ReportErrorParameter, mode: CommandMode = CommandMode.DEFAULT) { + val parameter = Serialization.json.encodeToJsonElement(args) + cdp.callCommand("SmartCardEmulation.reportError", parameter, mode) + } + + /** + * Reports an error result for the given request. + * + * @param requestId No description + * @param resultCode No description + */ + public suspend fun reportError(requestId: String, resultCode: ResultCode) { + val parameter = ReportErrorParameter(requestId = requestId, resultCode = resultCode) + reportError(parameter) + } + + /** + * Indicates the PC/SC error code. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__ErrorCodes.html + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/secauthn/authentication-return-values + */ + @Serializable + public enum class ResultCode { + @SerialName("success") + SUCCESS, + + @SerialName("removed-card") + REMOVED_CARD, + + @SerialName("reset-card") + RESET_CARD, + + @SerialName("unpowered-card") + UNPOWERED_CARD, + + @SerialName("unresponsive-card") + UNRESPONSIVE_CARD, + + @SerialName("unsupported-card") + UNSUPPORTED_CARD, + + @SerialName("reader-unavailable") + READER_UNAVAILABLE, + + @SerialName("sharing-violation") + SHARING_VIOLATION, + + @SerialName("not-transacted") + NOT_TRANSACTED, + + @SerialName("no-smartcard") + NO_SMARTCARD, + + @SerialName("proto-mismatch") + PROTO_MISMATCH, + + @SerialName("system-cancelled") + SYSTEM_CANCELLED, + + @SerialName("not-ready") + NOT_READY, + + @SerialName("cancelled") + CANCELLED, + + @SerialName("insufficient-buffer") + INSUFFICIENT_BUFFER, + + @SerialName("invalid-handle") + INVALID_HANDLE, + + @SerialName("invalid-parameter") + INVALID_PARAMETER, + + @SerialName("invalid-value") + INVALID_VALUE, + + @SerialName("no-memory") + NO_MEMORY, + + @SerialName("timeout") + TIMEOUT, + + @SerialName("unknown-reader") + UNKNOWN_READER, + + @SerialName("unsupported-feature") + UNSUPPORTED_FEATURE, + + @SerialName("no-readers-available") + NO_READERS_AVAILABLE, + + @SerialName("service-stopped") + SERVICE_STOPPED, + + @SerialName("no-service") + NO_SERVICE, + + @SerialName("comm-error") + COMM_ERROR, + + @SerialName("internal-error") + INTERNAL_ERROR, + + @SerialName("server-too-busy") + SERVER_TOO_BUSY, + + @SerialName("unexpected") + UNEXPECTED, + + @SerialName("shutdown") + SHUTDOWN, + + @SerialName("unknown-card") + UNKNOWN_CARD, + + @SerialName("unknown") + UNKNOWN, + } + + /** + * Maps to the |SCARD_SHARE_*| values. + */ + @Serializable + public enum class ShareMode { + @SerialName("shared") + SHARED, + + @SerialName("exclusive") + EXCLUSIVE, + + @SerialName("direct") + DIRECT, + } + + /** + * Indicates what the reader should do with the card. + */ + @Serializable + public enum class Disposition { + @SerialName("leave-card") + LEAVE_CARD, + + @SerialName("reset-card") + RESET_CARD, + + @SerialName("unpower-card") + UNPOWER_CARD, + + @SerialName("eject-card") + EJECT_CARD, + } + + /** + * Maps to |SCARD_*| connection state values. + */ + @Serializable + public enum class ConnectionState { + @SerialName("absent") + ABSENT, + + @SerialName("present") + PRESENT, + + @SerialName("swallowed") + SWALLOWED, + + @SerialName("powered") + POWERED, + + @SerialName("negotiable") + NEGOTIABLE, + + @SerialName("specific") + SPECIFIC, + } + + /** + * Maps to the |SCARD_STATE_*| flags. + */ + @Serializable + public data class ReaderStateFlags( + public val unaware: Boolean? = null, + public val ignore: Boolean? = null, + public val changed: Boolean? = null, + public val unknown: Boolean? = null, + public val unavailable: Boolean? = null, + public val empty: Boolean? = null, + public val present: Boolean? = null, + public val exclusive: Boolean? = null, + public val inuse: Boolean? = null, + public val mute: Boolean? = null, + public val unpowered: Boolean? = null, + ) + + /** + * Maps to the |SCARD_PROTOCOL_*| flags. + */ + @Serializable + public data class ProtocolSet( + public val t0: Boolean? = null, + public val t1: Boolean? = null, + public val raw: Boolean? = null, + ) + + /** + * Maps to the |SCARD_PROTOCOL_*| values. + */ + @Serializable + public enum class Protocol { + @SerialName("t0") + T0, + + @SerialName("t1") + T1, + + @SerialName("raw") + RAW, + } + + @Serializable + public data class ReaderStateIn( + public val reader: String, + public val currentState: ReaderStateFlags, + public val currentInsertionCount: Int, + ) + + @Serializable + public data class ReaderStateOut( + public val reader: String, + public val eventState: ReaderStateFlags, + public val eventCount: Int, + public val atr: String, + ) + + /** + * Fired when |SCardEstablishContext| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardestablishcontext + */ + @Serializable + public data class EstablishContextRequestedParameter( + public val requestId: String, + ) + + /** + * Fired when |SCardReleaseContext| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga6aabcba7744c5c9419fdd6404f73a934 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardreleasecontext + */ + @Serializable + public data class ReleaseContextRequestedParameter( + public val requestId: String, + public val contextId: Int, + ) + + /** + * Fired when |SCardListReaders| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga93b07815789b3cf2629d439ecf20f0d9 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardlistreadersa + */ + @Serializable + public data class ListReadersRequestedParameter( + public val requestId: String, + public val contextId: Int, + ) + + /** + * Fired when |SCardGetStatusChange| is called. Timeout is specified in milliseconds. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga33247d5d1257d59e55647c3bb717db24 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetstatuschangea + */ + @Serializable + public data class GetStatusChangeRequestedParameter( + public val requestId: String, + public val contextId: Int, + public val readerStates: List, + /** + * in milliseconds, if absent, it means "infinite" + */ + public val timeout: Int? = null, + ) + + /** + * Fired when |SCardCancel| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaacbbc0c6d6c0cbbeb4f4debf6fbeeee6 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcancel + */ + @Serializable + public data class CancelRequestedParameter( + public val requestId: String, + public val contextId: Int, + ) + + /** + * Fired when |SCardConnect| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardconnecta + */ + @Serializable + public data class ConnectRequestedParameter( + public val requestId: String, + public val contextId: Int, + public val reader: String, + public val shareMode: ShareMode, + public val preferredProtocols: ProtocolSet, + ) + + /** + * Fired when |SCardDisconnect| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga4be198045c73ec0deb79e66c0ca1738a + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scarddisconnect + */ + @Serializable + public data class DisconnectRequestedParameter( + public val requestId: String, + public val handle: Int, + public val disposition: Disposition, + ) + + /** + * Fired when |SCardTransmit| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga9a2d77242a271310269065e64633ab99 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardtransmit + */ + @Serializable + public data class TransmitRequestedParameter( + public val requestId: String, + public val handle: Int, + public val `data`: String, + public val protocol: Protocol? = null, + ) + + /** + * Fired when |SCardControl| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gac3454d4657110fd7f753b2d3d8f4e32f + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcontrol + */ + @Serializable + public data class ControlRequestedParameter( + public val requestId: String, + public val handle: Int, + public val controlCode: Int, + public val `data`: String, + ) + + /** + * Fired when |SCardGetAttrib| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaacfec51917255b7a25b94c5104961602 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetattrib + */ + @Serializable + public data class GetAttribRequestedParameter( + public val requestId: String, + public val handle: Int, + public val attribId: Int, + ) + + /** + * Fired when |SCardSetAttrib| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga060f0038a4ddfd5dd2b8fadf3c3a2e4f + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardsetattrib + */ + @Serializable + public data class SetAttribRequestedParameter( + public val requestId: String, + public val handle: Int, + public val attribId: Int, + public val `data`: String, + ) + + /** + * Fired when |SCardStatus| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gae49c3c894ad7ac12a5b896bde70d0382 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardstatusa + */ + @Serializable + public data class StatusRequestedParameter( + public val requestId: String, + public val handle: Int, + ) + + /** + * Fired when |SCardBeginTransaction| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaddb835dce01a0da1d6ca02d33ee7d861 + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardbegintransaction + */ + @Serializable + public data class BeginTransactionRequestedParameter( + public val requestId: String, + public val handle: Int, + ) + + /** + * Fired when |SCardEndTransaction| is called. + * + * This maps to: + * PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gae8742473b404363e5c587f570d7e2f3b + * Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardendtransaction + */ + @Serializable + public data class EndTransactionRequestedParameter( + public val requestId: String, + public val handle: Int, + public val disposition: Disposition, + ) + + @Serializable + public data class ReportEstablishContextResultParameter( + public val requestId: String, + public val contextId: Int, + ) + + @Serializable + public data class ReportReleaseContextResultParameter( + public val requestId: String, + ) + + @Serializable + public data class ReportListReadersResultParameter( + public val requestId: String, + public val readers: List, + ) + + @Serializable + public data class ReportGetStatusChangeResultParameter( + public val requestId: String, + public val readerStates: List, + ) + + @Serializable + public data class ReportBeginTransactionResultParameter( + public val requestId: String, + public val handle: Int, + ) + + @Serializable + public data class ReportPlainResultParameter( + public val requestId: String, + ) + + @Serializable + public data class ReportConnectResultParameter( + public val requestId: String, + public val handle: Int, + public val activeProtocol: Protocol? = null, + ) + + @Serializable + public data class ReportDataResultParameter( + public val requestId: String, + public val `data`: String, + ) + + @Serializable + public data class ReportStatusResultParameter( + public val requestId: String, + public val readerName: String, + public val state: ConnectionState, + public val atr: String, + public val protocol: Protocol? = null, + ) + + @Serializable + public data class ReportErrorParameter( + public val requestId: String, + public val resultCode: ResultCode, + ) +} diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Storage.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Storage.kt index df1a2ed59..5a36b4017 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Storage.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Storage.kt @@ -2,19 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List -import kotlin.collections.Map +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -145,40 +133,11 @@ public class Storage( .filterNotNull() .map { Serialization.json.decodeFromJsonElement(it) } - public val attributionReportingSourceRegistered: - Flow = cdp - .events - .filter { it.method == "Storage.attributionReportingSourceRegistered" } - .map { it.params } - .filterNotNull() - .map { Serialization.json.decodeFromJsonElement(it) } - - public val attributionReportingTriggerRegistered: - Flow = cdp - .events - .filter { it.method == "Storage.attributionReportingTriggerRegistered" } - .map { it.params } - .filterNotNull() - .map { Serialization.json.decodeFromJsonElement(it) } - - public val attributionReportingReportSent: Flow = cdp - .events - .filter { it.method == "Storage.attributionReportingReportSent" } - .map { it.params } - .filterNotNull() - .map { Serialization.json.decodeFromJsonElement(it) } - - public val attributionReportingVerboseDebugReportSent: - Flow = cdp - .events - .filter { it.method == "Storage.attributionReportingVerboseDebugReportSent" } - .map { it.params } - .filterNotNull() - .map { Serialization.json.decodeFromJsonElement(it) } - /** * Returns a storage key given a frame id. + * Deprecated. Please use Storage.getStorageKey instead. */ + @Deprecated(message = "") public suspend fun getStorageKeyForFrame( args: GetStorageKeyForFrameParameter, mode: CommandMode = CommandMode.DEFAULT, @@ -190,14 +149,40 @@ public class Storage( /** * Returns a storage key given a frame id. + * Deprecated. Please use Storage.getStorageKey instead. * * @param frameId No description */ + @Deprecated(message = "") public suspend fun getStorageKeyForFrame(frameId: String): GetStorageKeyForFrameReturn { val parameter = GetStorageKeyForFrameParameter(frameId = frameId) return getStorageKeyForFrame(parameter) } + /** + * Returns storage key for the given frame. If no frame ID is provided, + * the storage key of the target executing this command is returned. + */ + public suspend fun getStorageKey( + args: GetStorageKeyParameter, + mode: CommandMode = CommandMode.DEFAULT, + ): GetStorageKeyReturn { + val parameter = Serialization.json.encodeToJsonElement(args) + val result = cdp.callCommand("Storage.getStorageKey", parameter, mode) + return result!!.let { Serialization.json.decodeFromJsonElement(it) } + } + + /** + * Returns storage key for the given frame. If no frame ID is provided, + * the storage key of the target executing this command is returned. + * + * @param frameId No description + */ + public suspend fun getStorageKey(frameId: String? = null): GetStorageKeyReturn { + val parameter = GetStorageKeyParameter(frameId = frameId) + return getStorageKey(parameter) + } + /** * Clears storage for origin. */ @@ -833,58 +818,6 @@ public class Storage( return result!!.let { Serialization.json.decodeFromJsonElement(it) } } - /** - * https://wicg.github.io/attribution-reporting-api/ - */ - public suspend fun setAttributionReportingLocalTestingMode( - args: SetAttributionReportingLocalTestingModeParameter, - mode: CommandMode = CommandMode.DEFAULT, - ) { - val parameter = Serialization.json.encodeToJsonElement(args) - cdp.callCommand("Storage.setAttributionReportingLocalTestingMode", parameter, mode) - } - - /** - * https://wicg.github.io/attribution-reporting-api/ - * - * @param enabled If enabled, noise is suppressed and reports are sent immediately. - */ - public suspend fun setAttributionReportingLocalTestingMode(enabled: Boolean) { - val parameter = SetAttributionReportingLocalTestingModeParameter(enabled = enabled) - setAttributionReportingLocalTestingMode(parameter) - } - - /** - * Enables/disables issuing of Attribution Reporting events. - */ - public suspend fun setAttributionReportingTracking( - args: SetAttributionReportingTrackingParameter, - mode: CommandMode = CommandMode.DEFAULT, - ) { - val parameter = Serialization.json.encodeToJsonElement(args) - cdp.callCommand("Storage.setAttributionReportingTracking", parameter, mode) - } - - /** - * Enables/disables issuing of Attribution Reporting events. - * - * @param enable No description - */ - public suspend fun setAttributionReportingTracking(enable: Boolean) { - val parameter = SetAttributionReportingTrackingParameter(enable = enable) - setAttributionReportingTracking(parameter) - } - - /** - * Sends all pending Attribution Reports immediately, regardless of their - * scheduled report time. - */ - public suspend fun sendPendingAttributionReports(mode: CommandMode = CommandMode.DEFAULT): SendPendingAttributionReportsReturn { - val parameter = null - val result = cdp.callCommand("Storage.sendPendingAttributionReports", parameter, mode) - return result!!.let { Serialization.json.decodeFromJsonElement(it) } - } - /** * Returns the effective Related Website Sets in use by this profile for the browser * session. The effective Related Website Sets will not change during a browser session. @@ -895,39 +828,6 @@ public class Storage( return result!!.let { Serialization.json.decodeFromJsonElement(it) } } - /** - * Returns the list of URLs from a page and its embedded resources that match - * existing grace period URL pattern rules. - * https://developers.google.com/privacy-sandbox/cookies/temporary-exceptions/grace-period - */ - public suspend fun getAffectedUrlsForThirdPartyCookieMetadata( - args: GetAffectedUrlsForThirdPartyCookieMetadataParameter, - mode: CommandMode = CommandMode.DEFAULT, - ): GetAffectedUrlsForThirdPartyCookieMetadataReturn { - val parameter = Serialization.json.encodeToJsonElement(args) - val result = cdp.callCommand("Storage.getAffectedUrlsForThirdPartyCookieMetadata", parameter, mode) - return result!!.let { Serialization.json.decodeFromJsonElement(it) } - } - - /** - * Returns the list of URLs from a page and its embedded resources that match - * existing grace period URL pattern rules. - * https://developers.google.com/privacy-sandbox/cookies/temporary-exceptions/grace-period - * - * @param firstPartyUrl The URL of the page currently being visited. - * @param thirdPartyUrls The list of embedded resource URLs from the page. - */ - public suspend fun getAffectedUrlsForThirdPartyCookieMetadata( - firstPartyUrl: String, - thirdPartyUrls: List, - ): GetAffectedUrlsForThirdPartyCookieMetadataReturn { - val parameter = GetAffectedUrlsForThirdPartyCookieMetadataParameter( - firstPartyUrl = firstPartyUrl, - thirdPartyUrls = thirdPartyUrls - ) - return getAffectedUrlsForThirdPartyCookieMetadata(parameter) - } - public suspend fun setProtectedAudienceKAnonymity( args: SetProtectedAudienceKAnonymityParameter, mode: CommandMode = CommandMode.DEFAULT, @@ -1381,386 +1281,6 @@ public class Storage( public val durability: StorageBucketsDurability, ) - @Serializable - public enum class AttributionReportingSourceType { - @SerialName("navigation") - NAVIGATION, - - @SerialName("event") - EVENT, - } - - @Serializable - public data class AttributionReportingFilterDataEntry( - public val key: String, - public val values: List, - ) - - @Serializable - public data class AttributionReportingFilterConfig( - public val filterValues: List, - /** - * duration in seconds - */ - public val lookbackWindow: Int? = null, - ) - - @Serializable - public data class AttributionReportingFilterPair( - public val filters: List, - public val notFilters: List, - ) - - @Serializable - public data class AttributionReportingAggregationKeysEntry( - public val key: String, - public val `value`: String, - ) - - @Serializable - public data class AttributionReportingEventReportWindows( - /** - * duration in seconds - */ - public val start: Int, - /** - * duration in seconds - */ - public val ends: List, - ) - - @Serializable - public enum class AttributionReportingTriggerDataMatching { - @SerialName("exact") - EXACT, - - @SerialName("modulus") - MODULUS, - } - - @Serializable - public data class AttributionReportingAggregatableDebugReportingData( - public val keyPiece: String, - /** - * number instead of integer because not all uint32 can be represented by - * int - */ - public val `value`: Double, - public val types: List, - ) - - @Serializable - public data class AttributionReportingAggregatableDebugReportingConfig( - /** - * number instead of integer because not all uint32 can be represented by - * int, only present for source registrations - */ - public val budget: Double? = null, - public val keyPiece: String, - public val debugData: List, - public val aggregationCoordinatorOrigin: String? = null, - ) - - @Serializable - public data class AttributionScopesData( - public val values: List, - /** - * number instead of integer because not all uint32 can be represented by - * int - */ - public val limit: Double, - public val maxEventStates: Double, - ) - - @Serializable - public data class AttributionReportingNamedBudgetDef( - public val name: String, - public val budget: Int, - ) - - @Serializable - public data class AttributionReportingSourceRegistration( - public val time: Double, - /** - * duration in seconds - */ - public val expiry: Int, - /** - * number instead of integer because not all uint32 can be represented by - * int - */ - public val triggerData: List, - public val eventReportWindows: AttributionReportingEventReportWindows, - /** - * duration in seconds - */ - public val aggregatableReportWindow: Int, - public val type: AttributionReportingSourceType, - public val sourceOrigin: String, - public val reportingOrigin: String, - public val destinationSites: List, - public val eventId: String, - public val priority: String, - public val filterData: List, - public val aggregationKeys: List, - public val debugKey: String? = null, - public val triggerDataMatching: AttributionReportingTriggerDataMatching, - public val destinationLimitPriority: String, - public val aggregatableDebugReportingConfig: - AttributionReportingAggregatableDebugReportingConfig, - public val scopesData: AttributionScopesData? = null, - public val maxEventLevelReports: Int, - public val namedBudgets: List, - public val debugReporting: Boolean, - public val eventLevelEpsilon: Double, - ) - - @Serializable - public enum class AttributionReportingSourceRegistrationResult { - @SerialName("success") - SUCCESS, - - @SerialName("internalError") - INTERNALERROR, - - @SerialName("insufficientSourceCapacity") - INSUFFICIENTSOURCECAPACITY, - - @SerialName("insufficientUniqueDestinationCapacity") - INSUFFICIENTUNIQUEDESTINATIONCAPACITY, - - @SerialName("excessiveReportingOrigins") - EXCESSIVEREPORTINGORIGINS, - - @SerialName("prohibitedByBrowserPolicy") - PROHIBITEDBYBROWSERPOLICY, - - @SerialName("successNoised") - SUCCESSNOISED, - - @SerialName("destinationReportingLimitReached") - DESTINATIONREPORTINGLIMITREACHED, - - @SerialName("destinationGlobalLimitReached") - DESTINATIONGLOBALLIMITREACHED, - - @SerialName("destinationBothLimitsReached") - DESTINATIONBOTHLIMITSREACHED, - - @SerialName("reportingOriginsPerSiteLimitReached") - REPORTINGORIGINSPERSITELIMITREACHED, - - @SerialName("exceedsMaxChannelCapacity") - EXCEEDSMAXCHANNELCAPACITY, - - @SerialName("exceedsMaxScopesChannelCapacity") - EXCEEDSMAXSCOPESCHANNELCAPACITY, - - @SerialName("exceedsMaxTriggerStateCardinality") - EXCEEDSMAXTRIGGERSTATECARDINALITY, - - @SerialName("exceedsMaxEventStatesLimit") - EXCEEDSMAXEVENTSTATESLIMIT, - - @SerialName("destinationPerDayReportingLimitReached") - DESTINATIONPERDAYREPORTINGLIMITREACHED, - } - - @Serializable - public enum class AttributionReportingSourceRegistrationTimeConfig { - @SerialName("include") - INCLUDE, - - @SerialName("exclude") - EXCLUDE, - } - - @Serializable - public data class AttributionReportingAggregatableValueDictEntry( - public val key: String, - /** - * number instead of integer because not all uint32 can be represented by - * int - */ - public val `value`: Double, - public val filteringId: String, - ) - - @Serializable - public data class AttributionReportingAggregatableValueEntry( - public val values: List, - public val filters: AttributionReportingFilterPair, - ) - - @Serializable - public data class AttributionReportingEventTriggerData( - public val `data`: String, - public val priority: String, - public val dedupKey: String? = null, - public val filters: AttributionReportingFilterPair, - ) - - @Serializable - public data class AttributionReportingAggregatableTriggerData( - public val keyPiece: String, - public val sourceKeys: List, - public val filters: AttributionReportingFilterPair, - ) - - @Serializable - public data class AttributionReportingAggregatableDedupKey( - public val dedupKey: String? = null, - public val filters: AttributionReportingFilterPair, - ) - - @Serializable - public data class AttributionReportingNamedBudgetCandidate( - public val name: String? = null, - public val filters: AttributionReportingFilterPair, - ) - - @Serializable - public data class AttributionReportingTriggerRegistration( - public val filters: AttributionReportingFilterPair, - public val debugKey: String? = null, - public val aggregatableDedupKeys: List, - public val eventTriggerData: List, - public val aggregatableTriggerData: List, - public val aggregatableValues: List, - public val aggregatableFilteringIdMaxBytes: Int, - public val debugReporting: Boolean, - public val aggregationCoordinatorOrigin: String? = null, - public val sourceRegistrationTimeConfig: AttributionReportingSourceRegistrationTimeConfig, - public val triggerContextId: String? = null, - public val aggregatableDebugReportingConfig: - AttributionReportingAggregatableDebugReportingConfig, - public val scopes: List, - public val namedBudgets: List, - ) - - @Serializable - public enum class AttributionReportingEventLevelResult { - @SerialName("success") - SUCCESS, - - @SerialName("successDroppedLowerPriority") - SUCCESSDROPPEDLOWERPRIORITY, - - @SerialName("internalError") - INTERNALERROR, - - @SerialName("noCapacityForAttributionDestination") - NOCAPACITYFORATTRIBUTIONDESTINATION, - - @SerialName("noMatchingSources") - NOMATCHINGSOURCES, - - @SerialName("deduplicated") - DEDUPLICATED, - - @SerialName("excessiveAttributions") - EXCESSIVEATTRIBUTIONS, - - @SerialName("priorityTooLow") - PRIORITYTOOLOW, - - @SerialName("neverAttributedSource") - NEVERATTRIBUTEDSOURCE, - - @SerialName("excessiveReportingOrigins") - EXCESSIVEREPORTINGORIGINS, - - @SerialName("noMatchingSourceFilterData") - NOMATCHINGSOURCEFILTERDATA, - - @SerialName("prohibitedByBrowserPolicy") - PROHIBITEDBYBROWSERPOLICY, - - @SerialName("noMatchingConfigurations") - NOMATCHINGCONFIGURATIONS, - - @SerialName("excessiveReports") - EXCESSIVEREPORTS, - - @SerialName("falselyAttributedSource") - FALSELYATTRIBUTEDSOURCE, - - @SerialName("reportWindowPassed") - REPORTWINDOWPASSED, - - @SerialName("notRegistered") - NOTREGISTERED, - - @SerialName("reportWindowNotStarted") - REPORTWINDOWNOTSTARTED, - - @SerialName("noMatchingTriggerData") - NOMATCHINGTRIGGERDATA, - } - - @Serializable - public enum class AttributionReportingAggregatableResult { - @SerialName("success") - SUCCESS, - - @SerialName("internalError") - INTERNALERROR, - - @SerialName("noCapacityForAttributionDestination") - NOCAPACITYFORATTRIBUTIONDESTINATION, - - @SerialName("noMatchingSources") - NOMATCHINGSOURCES, - - @SerialName("excessiveAttributions") - EXCESSIVEATTRIBUTIONS, - - @SerialName("excessiveReportingOrigins") - EXCESSIVEREPORTINGORIGINS, - - @SerialName("noHistograms") - NOHISTOGRAMS, - - @SerialName("insufficientBudget") - INSUFFICIENTBUDGET, - - @SerialName("insufficientNamedBudget") - INSUFFICIENTNAMEDBUDGET, - - @SerialName("noMatchingSourceFilterData") - NOMATCHINGSOURCEFILTERDATA, - - @SerialName("notRegistered") - NOTREGISTERED, - - @SerialName("prohibitedByBrowserPolicy") - PROHIBITEDBYBROWSERPOLICY, - - @SerialName("deduplicated") - DEDUPLICATED, - - @SerialName("reportWindowPassed") - REPORTWINDOWPASSED, - - @SerialName("excessiveReports") - EXCESSIVEREPORTS, - } - - @Serializable - public enum class AttributionReportingReportResult { - @SerialName("sent") - SENT, - - @SerialName("prohibited") - PROHIBITED, - - @SerialName("failedToAssemble") - FAILEDTOASSEMBLE, - - @SerialName("expired") - EXPIRED, - } - /** * A single Related Website Set object. */ @@ -2017,47 +1537,22 @@ public class Storage( ) @Serializable - public data class AttributionReportingSourceRegisteredParameter( - public val registration: AttributionReportingSourceRegistration, - public val result: AttributionReportingSourceRegistrationResult, - ) - - @Serializable - public data class AttributionReportingTriggerRegisteredParameter( - public val registration: AttributionReportingTriggerRegistration, - public val eventLevel: AttributionReportingEventLevelResult, - public val aggregatable: AttributionReportingAggregatableResult, - ) - - @Serializable - public data class AttributionReportingReportSentParameter( - public val url: String, - public val body: Map, - public val result: AttributionReportingReportResult, - /** - * If result is `sent`, populated with net/HTTP status. - */ - public val netError: Int? = null, - public val netErrorName: String? = null, - public val httpStatusCode: Int? = null, + public data class GetStorageKeyForFrameParameter( + public val frameId: String, ) @Serializable - public data class AttributionReportingVerboseDebugReportSentParameter( - public val url: String, - public val body: List>? = null, - public val netError: Int? = null, - public val netErrorName: String? = null, - public val httpStatusCode: Int? = null, + public data class GetStorageKeyForFrameReturn( + public val storageKey: String, ) @Serializable - public data class GetStorageKeyForFrameParameter( - public val frameId: String, + public data class GetStorageKeyParameter( + public val frameId: String? = null, ) @Serializable - public data class GetStorageKeyForFrameReturn( + public data class GetStorageKeyReturn( public val storageKey: String, ) @@ -2345,53 +1840,11 @@ public class Storage( public val deletedSites: List, ) - @Serializable - public data class SetAttributionReportingLocalTestingModeParameter( - /** - * If enabled, noise is suppressed and reports are sent immediately. - */ - public val enabled: Boolean, - ) - - @Serializable - public data class SetAttributionReportingTrackingParameter( - public val enable: Boolean, - ) - - @Serializable - public data class SendPendingAttributionReportsReturn( - /** - * The number of reports that were sent. - */ - public val numSent: Int, - ) - @Serializable public data class GetRelatedWebsiteSetsReturn( public val sets: List, ) - @Serializable - public data class GetAffectedUrlsForThirdPartyCookieMetadataParameter( - /** - * The URL of the page currently being visited. - */ - public val firstPartyUrl: String, - /** - * The list of embedded resource URLs from the page. - */ - public val thirdPartyUrls: List, - ) - - @Serializable - public data class GetAffectedUrlsForThirdPartyCookieMetadataReturn( - /** - * Array of matching URLs. If there is a primary pattern match for the first- - * party URL, only the first-party URL is returned in the array. - */ - public val matchedUrls: List, - ) - @Serializable public data class SetProtectedAudienceKAnonymityParameter( public val owner: String, diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/SystemInfo.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/SystemInfo.kt index 8b22abf70..12ea9c4ce 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/SystemInfo.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/SystemInfo.kt @@ -2,22 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List -import kotlin.collections.Map -import kotlinx.coroutines.flow.filter -import kotlinx.coroutines.flow.filterNotNull -import kotlinx.coroutines.flow.map +import dev.kdriver.cdp.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.JsonElement @@ -203,30 +188,6 @@ public class SystemInfo( UNKNOWN, } - /** - * Describes a supported image decoding profile with its associated minimum and - * maximum resolutions and subsampling. - */ - @Serializable - public data class ImageDecodeAcceleratorCapability( - /** - * Image coded, e.g. Jpeg. - */ - public val imageType: ImageType, - /** - * Maximum supported dimensions of the image in pixels. - */ - public val maxDimensions: Size, - /** - * Minimum supported dimensions of the image in pixels. - */ - public val minDimensions: Size, - /** - * Optional array of supported subsampling formats, e.g. 4:2:0, if known. - */ - public val subsamplings: List, - ) - /** * Provides information about the GPU(s) on the system. */ @@ -256,10 +217,6 @@ public class SystemInfo( * Supported accelerated video encoding capabilities. */ public val videoEncoding: List, - /** - * Supported accelerated image decoding capabilities. - */ - public val imageDecoding: List, ) /** diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Target.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Target.kt index e2a4a1cd4..a07761123 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Target.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Target.kt @@ -2,19 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Deprecated -import kotlin.Double -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -307,6 +295,13 @@ public class Target( * @param hidden Whether to create a hidden target. The hidden target is observable via protocol, but not * present in the tab UI strip. Cannot be created with `forTab: true`, `newWindow: true` or * `background: false`. The life-time of the tab is limited to the life-time of the session. + * @param focus If specified, the option is used to determine if the new target should + * be focused or not. By default, the focus behavior depends on the + * value of the background field. For example, background=false and focus=false + * will result in the target tab being opened but the browser window remain + * unchanged (if it was in the background, it will remain in the background) + * and background=false with focus=undefined will result in the window being focused. + * Using background: true and focus: true is not supported and will result in an error. */ public suspend fun createTarget( url: String, @@ -321,6 +316,7 @@ public class Target( background: Boolean? = null, forTab: Boolean? = null, hidden: Boolean? = null, + focus: Boolean? = null, ): CreateTargetReturn { val parameter = CreateTargetParameter( url = url, @@ -334,7 +330,8 @@ public class Target( newWindow = newWindow, background = background, forTab = forTab, - hidden = hidden + hidden = hidden, + focus = focus ) return createTarget(parameter) } @@ -587,6 +584,30 @@ public class Target( setRemoteLocations(parameter) } + /** + * Gets the targetId of the DevTools page target opened for the given target + * (if any). + */ + public suspend fun getDevToolsTarget( + args: GetDevToolsTargetParameter, + mode: CommandMode = CommandMode.DEFAULT, + ): GetDevToolsTargetReturn { + val parameter = Serialization.json.encodeToJsonElement(args) + val result = cdp.callCommand("Target.getDevToolsTarget", parameter, mode) + return result!!.let { Serialization.json.decodeFromJsonElement(it) } + } + + /** + * Gets the targetId of the DevTools page target opened for the given target + * (if any). + * + * @param targetId Page or tab target ID. + */ + public suspend fun getDevToolsTarget(targetId: String): GetDevToolsTargetReturn { + val parameter = GetDevToolsTargetParameter(targetId = targetId) + return getDevToolsTarget(parameter) + } + /** * Opens a DevTools window for the target. */ @@ -603,9 +624,12 @@ public class Target( * Opens a DevTools window for the target. * * @param targetId This can be the page or tab target ID. + * @param panelId The id of the panel we want DevTools to open initially. Currently + * supported panels are elements, console, network, sources, resources + * and performance. */ - public suspend fun openDevTools(targetId: String): OpenDevToolsReturn { - val parameter = OpenDevToolsParameter(targetId = targetId) + public suspend fun openDevTools(targetId: String, panelId: String? = null): OpenDevToolsReturn { + val parameter = OpenDevToolsParameter(targetId = targetId, panelId = panelId) return openDevTools(parameter) } @@ -634,6 +658,10 @@ public class Target( * Frame id of originating window (is only set if target has an opener). */ public val openerFrameId: String? = null, + /** + * Id of the parent frame, only present for the "iframe" targets. + */ + public val parentFrameId: String? = null, public val browserContextId: String? = null, /** * Provides additional details for specific target types. For example, for @@ -861,6 +889,10 @@ public class Target( * An array of browser context ids. */ public val browserContextIds: List, + /** + * The id of the default browser context if available. + */ + public val defaultBrowserContextId: String?, ) @Serializable @@ -918,6 +950,16 @@ public class Target( * `background: false`. The life-time of the tab is limited to the life-time of the session. */ public val hidden: Boolean? = null, + /** + * If specified, the option is used to determine if the new target should + * be focused or not. By default, the focus behavior depends on the + * value of the background field. For example, background=false and focus=false + * will result in the target tab being opened but the browser window remain + * unchanged (if it was in the background, it will remain in the background) + * and background=false with focus=undefined will result in the window being focused. + * Using background: true and focus: true is not supported and will result in an error. + */ + public val focus: Boolean? = null, ) @Serializable @@ -1044,12 +1086,34 @@ public class Target( public val locations: List, ) + @Serializable + public data class GetDevToolsTargetParameter( + /** + * Page or tab target ID. + */ + public val targetId: String, + ) + + @Serializable + public data class GetDevToolsTargetReturn( + /** + * The targetId of DevTools page target if exists. + */ + public val targetId: String?, + ) + @Serializable public data class OpenDevToolsParameter( /** * This can be the page or tab target ID. */ public val targetId: String, + /** + * The id of the panel we want DevTools to open initially. Currently + * supported panels are elements, console, network, sources, resources + * and performance. + */ + public val panelId: String? = null, ) @Serializable diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Tethering.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Tethering.kt index 31522b863..accd30eed 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Tethering.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Tethering.kt @@ -2,15 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Int -import kotlin.String -import kotlin.Suppress +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Tracing.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Tracing.kt index 7df0e6129..3ea8305d9 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Tracing.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/Tracing.kt @@ -2,18 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Double -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List -import kotlin.collections.Map +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -76,6 +65,15 @@ public class Tracing( return result!!.let { Serialization.json.decodeFromJsonElement(it) } } + /** + * Return a descriptor for all available tracing categories. + */ + public suspend fun getTrackEventDescriptor(mode: CommandMode = CommandMode.DEFAULT): GetTrackEventDescriptorReturn { + val parameter = null + val result = cdp.callCommand("Tracing.getTrackEventDescriptor", parameter, mode) + return result!!.let { Serialization.json.decodeFromJsonElement(it) } + } + /** * Record a clock sync marker in the trace. */ @@ -336,6 +334,14 @@ public class Tracing( public val categories: List, ) + @Serializable + public data class GetTrackEventDescriptorReturn( + /** + * Base64-encoded serialized perfetto.protos.TrackEventDescriptor protobuf message. (Encoded as a base64 string when passed over JSON) + */ + public val descriptor: String, + ) + @Serializable public data class RecordClockSyncMarkerParameter( /** diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebAudio.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebAudio.kt index 1e2e3c111..41eb35497 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebAudio.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebAudio.kt @@ -2,15 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Double -import kotlin.String -import kotlin.Suppress +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebAuthn.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebAuthn.kt index 8c4711e06..b829808cc 100644 --- a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebAuthn.kt +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebAuthn.kt @@ -2,17 +2,7 @@ package dev.kdriver.cdp.domain -import dev.kdriver.cdp.CDP -import dev.kdriver.cdp.CommandMode -import dev.kdriver.cdp.Domain -import dev.kdriver.cdp.Serialization -import dev.kdriver.cdp.cacheGeneratedDomain -import dev.kdriver.cdp.getGeneratedDomain -import kotlin.Boolean -import kotlin.Int -import kotlin.String -import kotlin.Suppress -import kotlin.collections.List +import dev.kdriver.cdp.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -390,6 +380,9 @@ public class WebAuthn( @SerialName("ctap2_1") CTAP2_1, + + @SerialName("ctap2_2") + CTAP2_2, } @Serializable @@ -450,6 +443,18 @@ public class WebAuthn( * Defaults to false. */ public val hasPrf: Boolean? = null, + /** + * If set to true, the authenticator will support the hmac-secret extension. + * https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-hmac-secret-extension + * Defaults to false. + */ + public val hasHmacSecret: Boolean? = null, + /** + * If set to true, the authenticator will support the hmac-secret-mc extension. + * https://fidoalliance.org/specs/fido-v2.2-rd-20241003/fido-client-to-authenticator-protocol-v2.2-rd-20241003.html#sctn-hmac-secret-make-cred-extension + * Defaults to false. + */ + public val hasHmacSecretMc: Boolean? = null, /** * If set to true, tests of user presence will succeed immediately. * Otherwise, they will not be resolved. Defaults to true. diff --git a/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebMCP.kt b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebMCP.kt new file mode 100644 index 000000000..0f73638b1 --- /dev/null +++ b/cdp/src/commonMain/kotlin/dev/kdriver/cdp/domain/WebMCP.kt @@ -0,0 +1,214 @@ +@file:Suppress("ALL") + +package dev.kdriver.cdp.domain + +import dev.kdriver.cdp.* +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.json.JsonElement +import kotlinx.serialization.json.decodeFromJsonElement + +public val CDP.webMCP: WebMCP + get() = getGeneratedDomain() ?: cacheGeneratedDomain(WebMCP(this)) + +public class WebMCP( + private val cdp: CDP, +) : Domain { + /** + * Event fired when new tools are added. + */ + public val toolsAdded: Flow = cdp + .events + .filter { it.method == "WebMCP.toolsAdded" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Event fired when tools are removed. + */ + public val toolsRemoved: Flow = cdp + .events + .filter { it.method == "WebMCP.toolsRemoved" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Event fired when a tool invocation starts. + */ + public val toolInvoked: Flow = cdp + .events + .filter { it.method == "WebMCP.toolInvoked" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Event fired when a tool invocation completes or fails. + */ + public val toolResponded: Flow = cdp + .events + .filter { it.method == "WebMCP.toolResponded" } + .map { it.params } + .filterNotNull() + .map { Serialization.json.decodeFromJsonElement(it) } + + /** + * Enables the WebMCP domain, allowing events to be sent. Enabling the domain will trigger a toolsAdded event for + * all currently registered tools. + */ + public suspend fun enable(mode: CommandMode = CommandMode.DEFAULT) { + val parameter = null + cdp.callCommand("WebMCP.enable", parameter, mode) + } + + /** + * Disables the WebMCP domain. + */ + public suspend fun disable(mode: CommandMode = CommandMode.DEFAULT) { + val parameter = null + cdp.callCommand("WebMCP.disable", parameter, mode) + } + + /** + * Tool annotations + */ + @Serializable + public data class Annotation( + /** + * A hint indicating that the tool does not modify any state. + */ + public val readOnly: Boolean? = null, + /** + * If the declarative tool was declared with the autosubmit attribute. + */ + public val autosubmit: Boolean? = null, + ) + + /** + * Represents the status of a tool invocation. + */ + @Serializable + public enum class InvocationStatus { + @SerialName("Success") + SUCCESS, + + @SerialName("Canceled") + CANCELED, + + @SerialName("Error") + ERROR, + } + + /** + * Definition of a tool that can be invoked. + */ + @Serializable + public data class Tool( + /** + * Tool name. + */ + public val name: String, + /** + * Tool description. + */ + public val description: String, + /** + * Schema for the tool's input parameters. + */ + public val inputSchema: Map? = null, + /** + * Optional annotations for the tool. + */ + public val annotations: Annotation? = null, + /** + * Frame identifier associated with the tool registration. + */ + public val frameId: String, + /** + * Optional node ID for declarative tools. + */ + public val backendNodeId: Int? = null, + /** + * The stack trace at the time of the registration. + */ + public val stackTrace: Runtime.StackTrace? = null, + ) + + /** + * Event fired when new tools are added. + */ + @Serializable + public data class ToolsAddedParameter( + /** + * Array of tools that were added. + */ + public val tools: List, + ) + + /** + * Event fired when tools are removed. + */ + @Serializable + public data class ToolsRemovedParameter( + /** + * Array of tools that were removed. + */ + public val tools: List, + ) + + /** + * Event fired when a tool invocation starts. + */ + @Serializable + public data class ToolInvokedParameter( + /** + * Name of the tool to invoke. + */ + public val toolName: String, + /** + * Frame id + */ + public val frameId: String, + /** + * Invocation identifier. + */ + public val invocationId: String, + /** + * The input parameters used for the invocation. + */ + public val input: String, + ) + + /** + * Event fired when a tool invocation completes or fails. + */ + @Serializable + public data class ToolRespondedParameter( + /** + * Invocation identifier. + */ + public val invocationId: String, + /** + * Status of the invocation. + */ + public val status: InvocationStatus, + /** + * Output or error delivered as delivered to the agent. Missing if `status` is anything other than Success. + */ + public val output: JsonElement? = null, + /** + * Error text for protocol users. + */ + public val errorText: String? = null, + /** + * The exception object, if the javascript tool threw an error> + */ + public val exception: Runtime.RemoteObject? = null, + ) +}