Skip to content

Commit cf9c19b

Browse files
authored
Merge branch 'trunk' into chrome_enable_logging
2 parents 47992c9 + 4e9ec56 commit cf9c19b

File tree

113 files changed

+1709
-776
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+1709
-776
lines changed

.github/workflows/ci-python.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ jobs:
2121
- name: Checkout source tree
2222
uses: actions/checkout@v4
2323
- name: Set up Python 3.9
24-
uses: actions/setup-python@v4
24+
uses: actions/setup-python@v6
2525
with:
2626
python-version: 3.9
2727
- name: Install dependencies
2828
run: |
2929
python -m pip install --upgrade pip
30-
pip install tox==4.27.0
30+
pip install tox==4.30.2
3131
- name: Generate docs
3232
run: tox -c py/tox.ini
3333
env:
@@ -41,13 +41,13 @@ jobs:
4141
- name: Checkout source tree
4242
uses: actions/checkout@v4
4343
- name: Set up Python 3.9
44-
uses: actions/setup-python@v4
44+
uses: actions/setup-python@v6
4545
with:
4646
python-version: 3.9
4747
- name: Install dependencies
4848
run: |
4949
python -m pip install --upgrade pip
50-
pip install tox==4.27.0
50+
pip install tox==4.30.2
5151
- name: Run type checking
5252
run: |
5353
tox -c py/tox.ini || true

.github/workflows/update-documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
distribution: 'temurin'
6969
- name: Set up Python 3.9
7070
if: ${{ inputs.language == 'py' || inputs.language == 'all' }}
71-
uses: actions/setup-python@v5
71+
uses: actions/setup-python@v6
7272
with:
7373
python-version: 3.9
7474
- name: Install dependencies

MODULE.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ maven.install(
184184
"com.google.auto.service:auto-service:1.1.1",
185185
"com.google.auto.service:auto-service-annotations:1.1.1",
186186
"com.google.googlejavaformat:google-java-format:1.28.0",
187+
"com.google.protobuf:protobuf-java:3.25.5",
188+
"com.google.protobuf.nano:protobuf-javanano:3.1.0",
187189
"com.graphql-java:graphql-java:24.1",
188190
"dev.failsafe:failsafe:3.3.2",
189191
"io.grpc:grpc-context:1.74.0",
@@ -213,6 +215,7 @@ maven.install(
213215
"org.bouncycastle:bcpkix-jdk18on:1.81",
214216
"org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5",
215217
"org.hsqldb:hsqldb:2.7.4",
218+
"org.jboss.marshalling:jboss-marshalling:2.2.3.Final",
216219
"org.jspecify:jspecify:1.0.0",
217220
"org.junit.jupiter:junit-jupiter-api",
218221
"org.junit.jupiter:junit-jupiter-engine",
@@ -232,7 +235,7 @@ maven.install(
232235
],
233236
boms = [
234237
"io.opentelemetry:opentelemetry-bom:1.53.0",
235-
"io.netty:netty-bom:4.1.121.Final",
238+
"io.netty:netty-bom:4.2.4.Final",
236239
"org.junit:junit-bom:5.13.4",
237240
],
238241
excluded_artifacts = [

common/repositories.bzl

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def pin_browsers():
1111

1212
http_archive(
1313
name = "linux_firefox",
14-
url = "https://ftp.mozilla.org/pub/firefox/releases/142.0/linux-x86_64/en-US/firefox-142.0.tar.xz",
15-
sha256 = "da8897a6a618e73878e6022a2bece76af509c304c73ae5c53dc523d35cb7bae6",
14+
url = "https://ftp.mozilla.org/pub/firefox/releases/143.0/linux-x86_64/en-US/firefox-143.0.tar.xz",
15+
sha256 = "1c87a9de21941a15177384d4820a6aa3c7dacb38d34089c73a621734ebf1ea9a",
1616
build_file_content = """
1717
load("@aspect_rules_js//js:defs.bzl", "js_library")
1818
package(default_visibility = ["//visibility:public"])
@@ -33,8 +33,8 @@ js_library(
3333

3434
dmg_archive(
3535
name = "mac_firefox",
36-
url = "https://ftp.mozilla.org/pub/firefox/releases/142.0/mac/en-US/Firefox%20142.0.dmg",
37-
sha256 = "cc0ce6b3ec64d064c16187f92ca4a8df5a21a1d7aa2f79a9e82b44602f2b1a0f",
36+
url = "https://ftp.mozilla.org/pub/firefox/releases/143.0/mac/en-US/Firefox%20143.0.dmg",
37+
sha256 = "a5c570e277021b61df1295efe77446617ebd768d8ad36a20b309aa382685f6f2",
3838
build_file_content = """
3939
load("@aspect_rules_js//js:defs.bzl", "js_library")
4040
package(default_visibility = ["//visibility:public"])
@@ -50,8 +50,8 @@ js_library(
5050

5151
http_archive(
5252
name = "linux_beta_firefox",
53-
url = "https://ftp.mozilla.org/pub/firefox/releases/143.0b3/linux-x86_64/en-US/firefox-143.0b3.tar.xz",
54-
sha256 = "ea43085f0a47d14a8c088175b489c8af149f59703aec20e6dd2bbf01e36d36fc",
53+
url = "https://ftp.mozilla.org/pub/firefox/releases/144.0b2/linux-x86_64/en-US/firefox-144.0b2.tar.xz",
54+
sha256 = "f290da89a61c6d339968c2994a947843daf205510c979e2f636d5f29f310113a",
5555
build_file_content = """
5656
load("@aspect_rules_js//js:defs.bzl", "js_library")
5757
package(default_visibility = ["//visibility:public"])
@@ -72,8 +72,8 @@ js_library(
7272

7373
dmg_archive(
7474
name = "mac_beta_firefox",
75-
url = "https://ftp.mozilla.org/pub/firefox/releases/143.0b3/mac/en-US/Firefox%20143.0b3.dmg",
76-
sha256 = "0e392fc487de20c31c4fe66e25473f91ce001dd6e56528409720f7b9934f34e0",
75+
url = "https://ftp.mozilla.org/pub/firefox/releases/144.0b2/mac/en-US/Firefox%20144.0b2.dmg",
76+
sha256 = "5b7dadba49cd0087d540bc86cceba5da39d182aff174c526d5ac33d1b6c70b7b",
7777
build_file_content = """
7878
load("@aspect_rules_js//js:defs.bzl", "js_library")
7979
package(default_visibility = ["//visibility:public"])
@@ -123,10 +123,10 @@ js_library(
123123

124124
pkg_archive(
125125
name = "mac_edge",
126-
url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/95344cbf-d116-4494-8485-b96014e98901/MicrosoftEdge-139.0.3405.119.pkg",
127-
sha256 = "31b3ddce353180a706179d64086ed01b53cfd20a7daea45597a7e9e405fc553f",
126+
url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/548659d9-fd7c-41ae-98f2-88c5d8e2900e/MicrosoftEdge-140.0.3485.66.pkg",
127+
sha256 = "18d0dae9bcc13d02ea46934c45109a3b76075eadb5a1c25191ec44b3583aee32",
128128
move = {
129-
"MicrosoftEdge-139.0.3405.119.pkg/Payload/Microsoft Edge.app": "Edge.app",
129+
"MicrosoftEdge-140.0.3485.66.pkg/Payload/Microsoft Edge.app": "Edge.app",
130130
},
131131
build_file_content = """
132132
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -143,8 +143,8 @@ js_library(
143143

144144
deb_archive(
145145
name = "linux_edge",
146-
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_139.0.3405.119-1_amd64.deb",
147-
sha256 = "e51e4e36cde5e7be2031fd9145ac9bf26444f734a88ff43858e05c7782e60c7b",
146+
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_140.0.3485.66-1_amd64.deb",
147+
sha256 = "fc84c914286741ae572b89d07b76e21b0eafbd5fa92db6d935bf7cf5779c5066",
148148
build_file_content = """
149149
load("@aspect_rules_js//js:defs.bzl", "js_library")
150150
package(default_visibility = ["//visibility:public"])
@@ -165,8 +165,8 @@ js_library(
165165

166166
http_archive(
167167
name = "linux_edgedriver",
168-
url = "https://msedgedriver.microsoft.com/139.0.3405.111/edgedriver_linux64.zip",
169-
sha256 = "76f1c0e35120e37848c174eee1368150b7c2461b8e4907c80bcfc2e61b93c471",
168+
url = "https://msedgedriver.microsoft.com/140.0.3485.66/edgedriver_linux64.zip",
169+
sha256 = "140a592ad275329d22424cd213a8a05a348a66c6bee1eec8e890c3dbe9d23742",
170170
build_file_content = """
171171
load("@aspect_rules_js//js:defs.bzl", "js_library")
172172
package(default_visibility = ["//visibility:public"])
@@ -182,8 +182,8 @@ js_library(
182182

183183
http_archive(
184184
name = "mac_edgedriver",
185-
url = "https://msedgedriver.microsoft.com/139.0.3405.111/edgedriver_mac64.zip",
186-
sha256 = "c97588078c6f661dd6c66b858f5e21dc9cbcee40420a2b2e839a05803e0e468f",
185+
url = "https://msedgedriver.microsoft.com/140.0.3485.66/edgedriver_mac64.zip",
186+
sha256 = "69456486f9559620c0fcfc118f9ccfa232d7d4f7886347cf164e39b2a9205a03",
187187
build_file_content = """
188188
load("@aspect_rules_js//js:defs.bzl", "js_library")
189189
package(default_visibility = ["//visibility:public"])
@@ -199,8 +199,8 @@ js_library(
199199

200200
http_archive(
201201
name = "linux_chrome",
202-
url = "https://storage.googleapis.com/chrome-for-testing-public/139.0.7258.138/linux64/chrome-linux64.zip",
203-
sha256 = "a28ed679a017b8042747d81f7855cb86cc71402b268fc843b57533e69a835a17",
202+
url = "https://storage.googleapis.com/chrome-for-testing-public/140.0.7339.185/linux64/chrome-linux64.zip",
203+
sha256 = "a07772b4847a591fa0af4c5348711eb050ae35dde8ee635dfc98a9d44fb267af",
204204
build_file_content = """
205205
load("@aspect_rules_js//js:defs.bzl", "js_library")
206206
package(default_visibility = ["//visibility:public"])
@@ -220,8 +220,8 @@ js_library(
220220
)
221221
http_archive(
222222
name = "mac_chrome",
223-
url = "https://storage.googleapis.com/chrome-for-testing-public/139.0.7258.138/mac-x64/chrome-mac-x64.zip",
224-
sha256 = "e910233cc746230abb5d9c855a191fceee0729e299ac15cb562260be302fa64b",
223+
url = "https://storage.googleapis.com/chrome-for-testing-public/140.0.7339.185/mac-x64/chrome-mac-x64.zip",
224+
sha256 = "0c7392659efd1b888d9aedf7b5414438ad805940d7ca1ef77dd49a62254dc1a2",
225225
strip_prefix = "chrome-mac-x64",
226226
patch_cmds = [
227227
"mv 'Google Chrome for Testing.app' Chrome.app",
@@ -241,8 +241,8 @@ js_library(
241241
)
242242
http_archive(
243243
name = "linux_chromedriver",
244-
url = "https://storage.googleapis.com/chrome-for-testing-public/139.0.7258.138/linux64/chromedriver-linux64.zip",
245-
sha256 = "b5940d93d97da3d98dba0d4f5a67246b839a8e5634d69a6d625d0ad54bed8bb2",
244+
url = "https://storage.googleapis.com/chrome-for-testing-public/140.0.7339.185/linux64/chromedriver-linux64.zip",
245+
sha256 = "f5eaf884a5dc2c59f47332f7465cc0df18fa4644a6d16990b3aae52d88abaddb",
246246
strip_prefix = "chromedriver-linux64",
247247
build_file_content = """
248248
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -259,8 +259,8 @@ js_library(
259259

260260
http_archive(
261261
name = "mac_chromedriver",
262-
url = "https://storage.googleapis.com/chrome-for-testing-public/139.0.7258.138/mac-x64/chromedriver-mac-x64.zip",
263-
sha256 = "c6e2a630d72e0017649d54f29a93caa617fac0f846c23b2bd6494d8fe92e4479",
262+
url = "https://storage.googleapis.com/chrome-for-testing-public/140.0.7339.185/mac-x64/chromedriver-mac-x64.zip",
263+
sha256 = "36ac36651eb0c0afe45854e626dd78c259b539d54c12d48f4f9c47692c4639b8",
264264
strip_prefix = "chromedriver-mac-x64",
265265
build_file_content = """
266266
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -277,8 +277,8 @@ js_library(
277277

278278
http_archive(
279279
name = "linux_beta_chrome",
280-
url = "https://storage.googleapis.com/chrome-for-testing-public/140.0.7339.24/linux64/chrome-linux64.zip",
281-
sha256 = "d2371e5f2ea9cf349a48103ff8c95e83f0ec6a97ff5e7dad951fb73096413d1b",
280+
url = "https://storage.googleapis.com/chrome-for-testing-public/141.0.7390.16/linux64/chrome-linux64.zip",
281+
sha256 = "bdc9007ff717d4f23572ec4af4a4a8e2d69267585ff57d499ef37cf39f2dd229",
282282
build_file_content = """
283283
load("@aspect_rules_js//js:defs.bzl", "js_library")
284284
package(default_visibility = ["//visibility:public"])
@@ -298,8 +298,8 @@ js_library(
298298
)
299299
http_archive(
300300
name = "mac_beta_chrome",
301-
url = "https://storage.googleapis.com/chrome-for-testing-public/140.0.7339.24/mac-x64/chrome-mac-x64.zip",
302-
sha256 = "1eeec20838e918be14b6f5d4773fa3a1afedd8e81ff20611a59e0d54c5c3fb3d",
301+
url = "https://storage.googleapis.com/chrome-for-testing-public/141.0.7390.16/mac-x64/chrome-mac-x64.zip",
302+
sha256 = "f6b92982039152b6b52e9f39e6591016d66afb7a0252f3c0a09da12bc7431db1",
303303
strip_prefix = "chrome-mac-x64",
304304
patch_cmds = [
305305
"mv 'Google Chrome for Testing.app' Chrome.app",
@@ -319,8 +319,8 @@ js_library(
319319
)
320320
http_archive(
321321
name = "linux_beta_chromedriver",
322-
url = "https://storage.googleapis.com/chrome-for-testing-public/140.0.7339.24/linux64/chromedriver-linux64.zip",
323-
sha256 = "a908e9d9bf547c5b2d73e441d18ba16a0ee8a980c0ad8a0aaf9c3b42d03f5569",
322+
url = "https://storage.googleapis.com/chrome-for-testing-public/141.0.7390.16/linux64/chromedriver-linux64.zip",
323+
sha256 = "c325fbbe40d0dd508233a6bf496819c2ba6e00a4576b9820638c9a85dc5ad2d6",
324324
strip_prefix = "chromedriver-linux64",
325325
build_file_content = """
326326
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -337,8 +337,8 @@ js_library(
337337

338338
http_archive(
339339
name = "mac_beta_chromedriver",
340-
url = "https://storage.googleapis.com/chrome-for-testing-public/140.0.7339.24/mac-x64/chromedriver-mac-x64.zip",
341-
sha256 = "1b785a93d4dd848942064268428ca186a122d6a64c5aaf7fe2c6c8b1debcb34f",
340+
url = "https://storage.googleapis.com/chrome-for-testing-public/141.0.7390.16/mac-x64/chromedriver-mac-x64.zip",
341+
sha256 = "76b7a6239d4d32f2ef75e0a1d6749b7de89dbe14589ffdd3b3c5bf7c32efbaf6",
342342
strip_prefix = "chromedriver-mac-x64",
343343
build_file_content = """
344344
load("@aspect_rules_js//js:defs.bzl", "js_library")

common/src/web/data_url.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Page containing an image encoded as a Data URL</title>
6+
</head>
7+
<body>
8+
<img src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" alt="star" id="data-url-image">
9+
</body>
10+
</html>

dotnet/src/webdriver/BiDi/Communication/Broker.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ internal Broker(BiDi bidi, Uri url)
7575
new BrowserUserContextConverter(bidi),
7676
new BrowserClientWindowConverter(),
7777
new NavigationConverter(),
78+
new CollectorConverter(_bidi),
7879
new InterceptConverter(_bidi),
7980
new RequestConverter(),
8081
new ChannelConverter(),

dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,18 @@ namespace OpenQA.Selenium.BiDi.Communication.Json;
118118
[JsonSerializable(typeof(BrowsingContext.UserPromptOpenedEventArgs))]
119119
[JsonSerializable(typeof(BrowsingContext.UserPromptClosedEventArgs))]
120120

121+
[JsonSerializable(typeof(Network.AddDataCollectorCommand))]
122+
[JsonSerializable(typeof(Network.AddDataCollectorResult))]
121123
[JsonSerializable(typeof(Network.AddInterceptCommand))]
122124
[JsonSerializable(typeof(Network.AddInterceptResult))]
123125
[JsonSerializable(typeof(Network.ContinueRequestCommand))]
124126
[JsonSerializable(typeof(Network.ContinueResponseCommand))]
125127
[JsonSerializable(typeof(Network.ContinueWithAuthCommand))]
126128
[JsonSerializable(typeof(Network.FailRequestCommand))]
129+
[JsonSerializable(typeof(Network.GetDataCommand))]
130+
[JsonSerializable(typeof(Network.GetDataResult))]
127131
[JsonSerializable(typeof(Network.ProvideResponseCommand))]
132+
[JsonSerializable(typeof(Network.RemoveDataCollectorCommand))]
128133
[JsonSerializable(typeof(Network.RemoveInterceptCommand))]
129134
[JsonSerializable(typeof(Network.SetCacheBehaviorCommand))]
130135

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// <copyright file="CollectorConverter.cs" company="Selenium Committers">
2+
// Licensed to the Software Freedom Conservancy (SFC) under one
3+
// or more contributor license agreements. See the NOTICE file
4+
// distributed with this work for additional information
5+
// regarding copyright ownership. The SFC licenses this file
6+
// to you under the Apache License, Version 2.0 (the
7+
// "License"); you may not use this file except in compliance
8+
// with the License. You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing,
13+
// software distributed under the License is distributed on an
14+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
// KIND, either express or implied. See the License for the
16+
// specific language governing permissions and limitations
17+
// under the License.
18+
// </copyright>
19+
20+
using OpenQA.Selenium.BiDi.Network;
21+
using System;
22+
using System.Text.Json;
23+
using System.Text.Json.Serialization;
24+
25+
namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;
26+
27+
internal class CollectorConverter : JsonConverter<Collector>
28+
{
29+
private readonly BiDi _bidi;
30+
31+
public CollectorConverter(BiDi bidi)
32+
{
33+
_bidi = bidi;
34+
}
35+
36+
public override Collector? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
37+
{
38+
var id = reader.GetString();
39+
40+
return new Collector(_bidi, id!);
41+
}
42+
43+
public override void Write(Utf8JsonWriter writer, Collector value, JsonSerializerOptions options)
44+
{
45+
writer.WriteStringValue(value.Id);
46+
}
47+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// <copyright file="AddDataCollectorCommand.cs" company="Selenium Committers">
2+
// Licensed to the Software Freedom Conservancy (SFC) under one
3+
// or more contributor license agreements. See the NOTICE file
4+
// distributed with this work for additional information
5+
// regarding copyright ownership. The SFC licenses this file
6+
// to you under the Apache License, Version 2.0 (the
7+
// "License"); you may not use this file except in compliance
8+
// with the License. You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing,
13+
// software distributed under the License is distributed on an
14+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
// KIND, either express or implied. See the License for the
16+
// specific language governing permissions and limitations
17+
// under the License.
18+
// </copyright>
19+
20+
using System.Collections.Generic;
21+
using OpenQA.Selenium.BiDi.Communication;
22+
23+
namespace OpenQA.Selenium.BiDi.Network;
24+
25+
internal sealed class AddDataCollectorCommand(AddDataCollectorParameters @params)
26+
: Command<AddDataCollectorParameters, AddDataCollectorResult>(@params, "network.addDataCollector");
27+
28+
internal sealed record AddDataCollectorParameters(IEnumerable<DataType> DataTypes, int MaxEncodedDataSize, CollectorType? CollectorType, IEnumerable<BrowsingContext.BrowsingContext>? Contexts, IEnumerable<Browser.UserContext>? UserContexts) : Parameters;
29+
30+
public class AddDataCollectorOptions : CommandOptions
31+
{
32+
public CollectorType? CollectorType { get; set; }
33+
34+
public IEnumerable<BrowsingContext.BrowsingContext>? Contexts { get; set; }
35+
36+
public IEnumerable<Browser.UserContext>? UserContexts { get; set; }
37+
}
38+
39+
public sealed record AddDataCollectorResult(Collector Collector) : EmptyResult;
40+
41+
public enum DataType
42+
{
43+
Response
44+
}
45+
46+
public enum CollectorType
47+
{
48+
Blob
49+
}

dotnet/src/webdriver/BiDi/Network/BytesValue.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ public abstract record BytesValue
2929
{
3030
public static implicit operator BytesValue(string value) => new StringBytesValue(value);
3131
public static implicit operator BytesValue(byte[] value) => new Base64BytesValue(value);
32+
33+
public static explicit operator string(BytesValue value)
34+
{
35+
if (value is StringBytesValue stringBytesValue)
36+
{
37+
return stringBytesValue.Value;
38+
}
39+
40+
throw new InvalidCastException($"Cannot cast '{value.GetType()}' to '{typeof(string)}'.");
41+
}
3242
}
3343

3444
public sealed record StringBytesValue(string Value) : BytesValue;

0 commit comments

Comments
 (0)