first commit

This commit is contained in:
Frank John Begornia
2025-12-23 01:51:15 +08:00
commit c926590e1d
4137 changed files with 613038 additions and 0 deletions

View File

@@ -0,0 +1,148 @@
/**
* Copyright 2024 Google LLC.
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* THIS FILE IS AUTOGENERATED. Run `npm run bidi-types` to regenerate.
* @see https://github.com/w3c/webdriver-bidi/blob/master/index.bs
*/
import z from 'zod';
export declare const PermissionsCommandSchema: z.ZodLazy<z.ZodLazy<z.ZodObject<{
method: z.ZodLiteral<"permissions.setPermission">;
params: z.ZodLazy<z.ZodObject<{
descriptor: z.ZodLazy<z.ZodObject<{
name: z.ZodString;
}, "strip", z.ZodTypeAny, {
name: string;
}, {
name: string;
}>>;
state: z.ZodLazy<z.ZodEnum<["granted", "denied", "prompt"]>>;
origin: z.ZodString;
}, "strip", z.ZodTypeAny, {
origin: string;
descriptor: {
name: string;
};
state: "granted" | "denied" | "prompt";
}, {
origin: string;
descriptor: {
name: string;
};
state: "granted" | "denied" | "prompt";
}>>;
}, "strip", z.ZodTypeAny, {
params: {
origin: string;
descriptor: {
name: string;
};
state: "granted" | "denied" | "prompt";
};
method: "permissions.setPermission";
}, {
params: {
origin: string;
descriptor: {
name: string;
};
state: "granted" | "denied" | "prompt";
};
method: "permissions.setPermission";
}>>>;
export declare namespace Permissions {
const PermissionDescriptorSchema: z.ZodLazy<z.ZodObject<{
name: z.ZodString;
}, "strip", z.ZodTypeAny, {
name: string;
}, {
name: string;
}>>;
}
export declare namespace Permissions {
const PermissionStateSchema: z.ZodLazy<z.ZodEnum<["granted", "denied", "prompt"]>>;
}
export declare namespace Permissions {
const SetPermissionSchema: z.ZodLazy<z.ZodObject<{
method: z.ZodLiteral<"permissions.setPermission">;
params: z.ZodLazy<z.ZodObject<{
descriptor: z.ZodLazy<z.ZodObject<{
name: z.ZodString;
}, "strip", z.ZodTypeAny, {
name: string;
}, {
name: string;
}>>;
state: z.ZodLazy<z.ZodEnum<["granted", "denied", "prompt"]>>;
origin: z.ZodString;
}, "strip", z.ZodTypeAny, {
origin: string;
descriptor: {
name: string;
};
state: "granted" | "denied" | "prompt";
}, {
origin: string;
descriptor: {
name: string;
};
state: "granted" | "denied" | "prompt";
}>>;
}, "strip", z.ZodTypeAny, {
params: {
origin: string;
descriptor: {
name: string;
};
state: "granted" | "denied" | "prompt";
};
method: "permissions.setPermission";
}, {
params: {
origin: string;
descriptor: {
name: string;
};
state: "granted" | "denied" | "prompt";
};
method: "permissions.setPermission";
}>>;
}
export declare namespace Permissions {
const SetPermissionParametersSchema: z.ZodLazy<z.ZodObject<{
descriptor: z.ZodLazy<z.ZodObject<{
name: z.ZodString;
}, "strip", z.ZodTypeAny, {
name: string;
}, {
name: string;
}>>;
state: z.ZodLazy<z.ZodEnum<["granted", "denied", "prompt"]>>;
origin: z.ZodString;
}, "strip", z.ZodTypeAny, {
origin: string;
descriptor: {
name: string;
};
state: "granted" | "denied" | "prompt";
}, {
origin: string;
descriptor: {
name: string;
};
state: "granted" | "denied" | "prompt";
}>>;
}

View File

@@ -0,0 +1,53 @@
"use strict";
/**
* Copyright 2024 Google LLC.
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Permissions = exports.PermissionsCommandSchema = void 0;
/**
* THIS FILE IS AUTOGENERATED. Run `npm run bidi-types` to regenerate.
* @see https://github.com/w3c/webdriver-bidi/blob/master/index.bs
*/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck Some types may be circular.
const zod_1 = __importDefault(require("zod"));
exports.PermissionsCommandSchema = zod_1.default.lazy(() => Permissions.SetPermissionSchema);
var Permissions;
(function (Permissions) {
Permissions.PermissionDescriptorSchema = zod_1.default.lazy(() => zod_1.default.object({
name: zod_1.default.string(),
}));
})(Permissions || (exports.Permissions = Permissions = {}));
(function (Permissions) {
Permissions.PermissionStateSchema = zod_1.default.lazy(() => zod_1.default.enum(['granted', 'denied', 'prompt']));
})(Permissions || (exports.Permissions = Permissions = {}));
(function (Permissions) {
Permissions.SetPermissionSchema = zod_1.default.lazy(() => zod_1.default.object({
method: zod_1.default.literal('permissions.setPermission'),
params: Permissions.SetPermissionParametersSchema,
}));
})(Permissions || (exports.Permissions = Permissions = {}));
(function (Permissions) {
Permissions.SetPermissionParametersSchema = zod_1.default.lazy(() => zod_1.default.object({
descriptor: Permissions.PermissionDescriptorSchema,
state: Permissions.PermissionStateSchema,
origin: zod_1.default.string(),
}));
})(Permissions || (exports.Permissions = Permissions = {}));
//# sourceMappingURL=webdriver-bidi-permissions.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"webdriver-bidi-permissions.js","sourceRoot":"","sources":["../../../../src/protocol-parser/generated/webdriver-bidi-permissions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;AAEH;;;GAGG;AAEH,6DAA6D;AAC7D,0CAA0C;AAE1C,8CAAoB;AAEP,QAAA,wBAAwB,GAAG,aAAC,CAAC,IAAI,CAC5C,GAAG,EAAE,CAAC,WAAW,CAAC,mBAAmB,CACtC,CAAC;AACF,IAAiB,WAAW,CAM3B;AAND,WAAiB,WAAW;IACb,sCAA0B,GAAG,aAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACpD,aAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,aAAC,CAAC,MAAM,EAAE;KACjB,CAAC,CACH,CAAC;AACJ,CAAC,EANgB,WAAW,2BAAX,WAAW,QAM3B;AACD,WAAiB,WAAW;IACb,iCAAqB,GAAG,aAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAC/C,aAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CACxC,CAAC;AACJ,CAAC,EAJgB,WAAW,2BAAX,WAAW,QAI3B;AACD,WAAiB,WAAW;IACb,+BAAmB,GAAG,aAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAC7C,aAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,aAAC,CAAC,OAAO,CAAC,2BAA2B,CAAC;QAC9C,MAAM,EAAE,WAAW,CAAC,6BAA6B;KAClD,CAAC,CACH,CAAC;AACJ,CAAC,EAPgB,WAAW,2BAAX,WAAW,QAO3B;AACD,WAAiB,WAAW;IACb,yCAA6B,GAAG,aAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACvD,aAAC,CAAC,MAAM,CAAC;QACP,UAAU,EAAE,WAAW,CAAC,0BAA0B;QAClD,KAAK,EAAE,WAAW,CAAC,qBAAqB;QACxC,MAAM,EAAE,aAAC,CAAC,MAAM,EAAE;KACnB,CAAC,CACH,CAAC;AACJ,CAAC,EARgB,WAAW,2BAAX,WAAW,QAQ3B"}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,140 @@
/**
* Copyright 2022 Google LLC.
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Provides parsing and validator for WebDriver BiDi protocol.
* Parser types should match the `../protocol` types.
*/
import { z, type ZodType } from 'zod';
import type * as Protocol from '../protocol/protocol.js';
export declare function parseObject<T extends ZodType>(obj: unknown, schema: T): z.infer<T>;
/** @see https://w3c.github.io/webdriver-bidi/#module-network */
export declare namespace Network {
function parseAddInterceptParameters(params: unknown): {
phases: ("beforeRequestSent" | "responseStarted" | "authRequired")[];
urlPatterns?: ({
type: "pattern";
protocol?: string | undefined;
hostname?: string | undefined;
port?: string | undefined;
pathname?: string | undefined;
search?: string | undefined;
} | {
type: "string";
pattern: string;
})[] | undefined;
};
function parseContinueRequestParameters(params: unknown): {
request: string;
body?: {
type: "string";
value: string;
} | {
type: "base64";
value: string;
} | undefined;
cookies?: {
value: {
type: "string";
value: string;
} | {
type: "base64";
value: string;
};
name: string;
}[] | undefined;
headers?: {
value: {
type: "string";
value: string;
} | {
type: "base64";
value: string;
};
name: string;
}[] | undefined;
method?: string | undefined;
url?: string | undefined;
};
function parseContinueResponseParameters(params: unknown): Protocol.Network.ContinueResponseParameters;
function parseContinueWithAuthParameters(params: unknown): {
request: string;
} & ({
credentials: {
type: "password";
password: string;
username: string;
};
action: "provideCredentials";
} | {
action: "default" | "cancel";
});
function parseFailRequestParameters(params: unknown): {
request: string;
};
function parseProvideResponseParameters(params: unknown): Protocol.Network.ProvideResponseParameters;
function parseRemoveInterceptParameters(params: unknown): {
intercept: string;
};
}
/** @see https://w3c.github.io/webdriver-bidi/#module-script */
export declare namespace Script {
function parseGetRealmsParams(params: unknown): Protocol.Script.GetRealmsParameters;
function parseEvaluateParams(params: unknown): Protocol.Script.EvaluateParameters;
function parseDisownParams(params: unknown): Protocol.Script.DisownParameters;
function parseAddPreloadScriptParams(params: unknown): Protocol.Script.AddPreloadScriptParameters;
function parseRemovePreloadScriptParams(params: unknown): {
script: string;
};
function parseCallFunctionParams(params: unknown): Protocol.Script.CallFunctionParameters;
}
/** @see https://w3c.github.io/webdriver-bidi/#module-browsingContext */
export declare namespace BrowsingContext {
function parseActivateParams(params: unknown): {
context: string;
};
function parseGetTreeParams(params: unknown): Protocol.BrowsingContext.GetTreeParameters;
function parseNavigateParams(params: unknown): Protocol.BrowsingContext.NavigateParameters;
function parseReloadParams(params: unknown): Protocol.BrowsingContext.ReloadParameters;
function parseCreateParams(params: unknown): Protocol.BrowsingContext.CreateParameters;
function parseCloseParams(params: unknown): Protocol.BrowsingContext.CloseParameters;
function parseCaptureScreenshotParams(params: unknown): Protocol.BrowsingContext.CaptureScreenshotParameters;
function parsePrintParams(params: unknown): Protocol.BrowsingContext.PrintParameters;
function parseSetViewportParams(params: unknown): Protocol.BrowsingContext.SetViewportParameters;
function parseTraverseHistoryParams(params: unknown): Protocol.BrowsingContext.TraverseHistoryParameters;
function parseHandleUserPromptParameters(params: unknown): Protocol.BrowsingContext.HandleUserPromptParameters;
}
/** @see https://w3c.github.io/webdriver-bidi/#module-session */
export declare namespace Session {
function parseSubscribeParams(params: unknown): Protocol.Session.SubscriptionRequest;
}
export declare namespace Input {
function parsePerformActionsParams(params: unknown): Protocol.Input.PerformActionsParameters;
function parseReleaseActionsParams(params: unknown): Protocol.Input.ReleaseActionsParameters;
function parseSetFilesParams(params: unknown): Protocol.Input.SetFilesParameters;
}
export declare namespace Storage {
function parseGetCookiesParams(params: unknown): Protocol.Storage.GetCookiesParameters;
function parseSetCookieParams(params: unknown): Protocol.Storage.SetCookieParameters;
function parseDeleteCookiesParams(params: unknown): Protocol.Storage.DeleteCookiesParameters;
}
export declare namespace Cdp {
function parseSendCommandRequest(params: unknown): Protocol.Cdp.SendCommandParameters;
function parseGetSessionRequest(params: unknown): Protocol.Cdp.GetSessionParameters;
}
export declare namespace Permissions {
function parseSetPermissionsParams(params: unknown): Protocol.Permissions.SetPermissionParameters;
}

View File

@@ -0,0 +1,263 @@
"use strict";
/**
* Copyright 2022 Google LLC.
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Permissions = exports.Cdp = exports.Storage = exports.Input = exports.Session = exports.BrowsingContext = exports.Script = exports.Network = exports.parseObject = void 0;
/**
* @fileoverview Provides parsing and validator for WebDriver BiDi protocol.
* Parser types should match the `../protocol` types.
*/
const zod_1 = require("zod");
const protocol_js_1 = require("../protocol/protocol.js");
const WebDriverBidiPermissions = __importStar(require("./generated/webdriver-bidi-permissions.js"));
const WebDriverBidi = __importStar(require("./generated/webdriver-bidi.js"));
function parseObject(obj, schema) {
const parseResult = schema.safeParse(obj);
if (parseResult.success) {
return parseResult.data;
}
const errorMessage = parseResult.error.errors
.map((e) => `${e.message} in ` +
`${e.path.map((p) => JSON.stringify(p)).join('/')}.`)
.join(' ');
throw new protocol_js_1.InvalidArgumentException(errorMessage);
}
exports.parseObject = parseObject;
/** @see https://w3c.github.io/webdriver-bidi/#module-network */
var Network;
(function (Network) {
function parseAddInterceptParameters(params) {
return parseObject(params, WebDriverBidi.Network.AddInterceptParametersSchema);
}
Network.parseAddInterceptParameters = parseAddInterceptParameters;
function parseContinueRequestParameters(params) {
return parseObject(params, WebDriverBidi.Network.ContinueRequestParametersSchema);
}
Network.parseContinueRequestParameters = parseContinueRequestParameters;
function parseContinueResponseParameters(params) {
// Work around of `cddlconv` https://github.com/google/cddlconv/issues/19.
// The generated schema `SameSiteSchema` in `src/protocol-parser/webdriver-bidi.ts` is
// of type `"none" | "strict" | "lax"` which is not assignable to generated enum
// `SameSite` in `src/protocol/webdriver-bidi.ts`.
// TODO: remove cast after https://github.com/google/cddlconv/issues/19 is fixed.
return parseObject(params, WebDriverBidi.Network.ContinueResponseParametersSchema);
}
Network.parseContinueResponseParameters = parseContinueResponseParameters;
function parseContinueWithAuthParameters(params) {
return parseObject(params, WebDriverBidi.Network.ContinueWithAuthParametersSchema);
}
Network.parseContinueWithAuthParameters = parseContinueWithAuthParameters;
function parseFailRequestParameters(params) {
return parseObject(params, WebDriverBidi.Network.FailRequestParametersSchema);
}
Network.parseFailRequestParameters = parseFailRequestParameters;
function parseProvideResponseParameters(params) {
// Work around of `cddlconv` https://github.com/google/cddlconv/issues/19.
// The generated schema `SameSiteSchema` in `src/protocol-parser/webdriver-bidi.ts` is
// of type `"none" | "strict" | "lax"` which is not assignable to generated enum
// `SameSite` in `src/protocol/webdriver-bidi.ts`.
// TODO: remove cast after https://github.com/google/cddlconv/issues/19 is fixed.
return parseObject(params, WebDriverBidi.Network.ProvideResponseParametersSchema);
}
Network.parseProvideResponseParameters = parseProvideResponseParameters;
function parseRemoveInterceptParameters(params) {
return parseObject(params, WebDriverBidi.Network.RemoveInterceptParametersSchema);
}
Network.parseRemoveInterceptParameters = parseRemoveInterceptParameters;
})(Network || (exports.Network = Network = {}));
/** @see https://w3c.github.io/webdriver-bidi/#module-script */
var Script;
(function (Script) {
function parseGetRealmsParams(params) {
return parseObject(params, WebDriverBidi.Script.GetRealmsParametersSchema);
}
Script.parseGetRealmsParams = parseGetRealmsParams;
function parseEvaluateParams(params) {
return parseObject(params, WebDriverBidi.Script.EvaluateParametersSchema);
}
Script.parseEvaluateParams = parseEvaluateParams;
function parseDisownParams(params) {
return parseObject(params, WebDriverBidi.Script.DisownParametersSchema);
}
Script.parseDisownParams = parseDisownParams;
function parseAddPreloadScriptParams(params) {
return parseObject(params, WebDriverBidi.Script.AddPreloadScriptParametersSchema);
}
Script.parseAddPreloadScriptParams = parseAddPreloadScriptParams;
function parseRemovePreloadScriptParams(params) {
return parseObject(params, WebDriverBidi.Script.RemovePreloadScriptParametersSchema);
}
Script.parseRemovePreloadScriptParams = parseRemovePreloadScriptParams;
function parseCallFunctionParams(params) {
return parseObject(params, WebDriverBidi.Script.CallFunctionParametersSchema);
}
Script.parseCallFunctionParams = parseCallFunctionParams;
})(Script || (exports.Script = Script = {}));
/** @see https://w3c.github.io/webdriver-bidi/#module-browsingContext */
var BrowsingContext;
(function (BrowsingContext) {
function parseActivateParams(params) {
return parseObject(params, WebDriverBidi.BrowsingContext.ActivateParametersSchema);
}
BrowsingContext.parseActivateParams = parseActivateParams;
function parseGetTreeParams(params) {
return parseObject(params, WebDriverBidi.BrowsingContext.GetTreeParametersSchema);
}
BrowsingContext.parseGetTreeParams = parseGetTreeParams;
function parseNavigateParams(params) {
return parseObject(params, WebDriverBidi.BrowsingContext.NavigateParametersSchema);
}
BrowsingContext.parseNavigateParams = parseNavigateParams;
function parseReloadParams(params) {
return parseObject(params, WebDriverBidi.BrowsingContext.ReloadParametersSchema);
}
BrowsingContext.parseReloadParams = parseReloadParams;
function parseCreateParams(params) {
return parseObject(params, WebDriverBidi.BrowsingContext.CreateParametersSchema);
}
BrowsingContext.parseCreateParams = parseCreateParams;
function parseCloseParams(params) {
return parseObject(params, WebDriverBidi.BrowsingContext.CloseParametersSchema);
}
BrowsingContext.parseCloseParams = parseCloseParams;
function parseCaptureScreenshotParams(params) {
return parseObject(params, WebDriverBidi.BrowsingContext.CaptureScreenshotParametersSchema);
}
BrowsingContext.parseCaptureScreenshotParams = parseCaptureScreenshotParams;
function parsePrintParams(params) {
return parseObject(params, WebDriverBidi.BrowsingContext.PrintParametersSchema);
}
BrowsingContext.parsePrintParams = parsePrintParams;
function parseSetViewportParams(params) {
return parseObject(params, WebDriverBidi.BrowsingContext.SetViewportParametersSchema);
}
BrowsingContext.parseSetViewportParams = parseSetViewportParams;
function parseTraverseHistoryParams(params) {
return parseObject(params, WebDriverBidi.BrowsingContext.TraverseHistoryParametersSchema);
}
BrowsingContext.parseTraverseHistoryParams = parseTraverseHistoryParams;
function parseHandleUserPromptParameters(params) {
return parseObject(params, WebDriverBidi.BrowsingContext.HandleUserPromptParametersSchema);
}
BrowsingContext.parseHandleUserPromptParameters = parseHandleUserPromptParameters;
})(BrowsingContext || (exports.BrowsingContext = BrowsingContext = {}));
/** @see https://w3c.github.io/webdriver-bidi/#module-session */
var Session;
(function (Session) {
function parseSubscribeParams(params) {
return parseObject(params, WebDriverBidi.Session.SubscriptionRequestSchema);
}
Session.parseSubscribeParams = parseSubscribeParams;
})(Session || (exports.Session = Session = {}));
var Input;
(function (Input) {
function parsePerformActionsParams(params) {
return parseObject(params, WebDriverBidi.Input.PerformActionsParametersSchema);
}
Input.parsePerformActionsParams = parsePerformActionsParams;
function parseReleaseActionsParams(params) {
return parseObject(params, WebDriverBidi.Input.ReleaseActionsParametersSchema);
}
Input.parseReleaseActionsParams = parseReleaseActionsParams;
function parseSetFilesParams(params) {
return parseObject(params, WebDriverBidi.Input.SetFilesParametersSchema);
}
Input.parseSetFilesParams = parseSetFilesParams;
})(Input || (exports.Input = Input = {}));
var Storage;
(function (Storage) {
function parseGetCookiesParams(params) {
// Work around of `cddlconv` https://github.com/google/cddlconv/issues/19.
// The generated schema `SameSiteSchema` in `src/protocol-parser/webdriver-bidi.ts` is
// of type `"none" | "strict" | "lax"` which is not assignable to generated enum
// `SameSite` in `src/protocol/webdriver-bidi.ts`.
// TODO: remove cast after https://github.com/google/cddlconv/issues/19 is fixed.
return parseObject(params, WebDriverBidi.Storage.GetCookiesParametersSchema);
}
Storage.parseGetCookiesParams = parseGetCookiesParams;
function parseSetCookieParams(params) {
// Work around of `cddlconv` https://github.com/google/cddlconv/issues/19.
// The generated schema `SameSiteSchema` in `src/protocol-parser/webdriver-bidi.ts` is
// of type `"none" | "strict" | "lax"` which is not assignable to generated enum
// `SameSite` in `src/protocol/webdriver-bidi.ts`.
// TODO: remove cast after https://github.com/google/cddlconv/issues/19 is fixed.
return parseObject(params, WebDriverBidi.Storage.SetCookieParametersSchema);
}
Storage.parseSetCookieParams = parseSetCookieParams;
function parseDeleteCookiesParams(params) {
// Work around of `cddlconv` https://github.com/google/cddlconv/issues/19.
// The generated schema `SameSiteSchema` in `src/protocol-parser/webdriver-bidi.ts` is
// of type `"none" | "strict" | "lax"` which is not assignable to generated enum
// `SameSite` in `src/protocol/webdriver-bidi.ts`.
// TODO: remove cast after https://github.com/google/cddlconv/issues/19 is fixed.
return parseObject(params, WebDriverBidi.Storage.DeleteCookiesParametersSchema);
}
Storage.parseDeleteCookiesParams = parseDeleteCookiesParams;
})(Storage || (exports.Storage = Storage = {}));
var Cdp;
(function (Cdp) {
const SendCommandRequestSchema = zod_1.z.object({
// Allowing any cdpMethod, and casting to proper type later on.
method: zod_1.z.string(),
// `passthrough` allows object to have any fields.
// https://github.com/colinhacks/zod#passthrough
params: zod_1.z.object({}).passthrough().optional(),
session: zod_1.z.string().optional(),
});
const GetSessionRequestSchema = zod_1.z.object({
context: WebDriverBidi.BrowsingContext.BrowsingContextSchema,
});
function parseSendCommandRequest(params) {
return parseObject(params, SendCommandRequestSchema);
}
Cdp.parseSendCommandRequest = parseSendCommandRequest;
function parseGetSessionRequest(params) {
return parseObject(params, GetSessionRequestSchema);
}
Cdp.parseGetSessionRequest = parseGetSessionRequest;
})(Cdp || (exports.Cdp = Cdp = {}));
var Permissions;
(function (Permissions) {
function parseSetPermissionsParams(params) {
return parseObject(params, WebDriverBidiPermissions.Permissions.SetPermissionParametersSchema);
}
Permissions.parseSetPermissionsParams = parseSetPermissionsParams;
})(Permissions || (exports.Permissions = Permissions = {}));
//# sourceMappingURL=protocol-parser.js.map

File diff suppressed because one or more lines are too long