Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
Revert "chore(protocol): auto-serialize SerializedValue in validators (#40798)" (#40858)
Dmitry Gozman409d6d0d9bfe
diff --git a/packages/playwright-core/src/browserServerImpl.ts b/packages/playwright-core/src/browserServerImpl.tsindex 1d4fa9b29d..d0776eae0a 100644--- a/packages/playwright-core/src/browserServerImpl.ts+++ b/packages/playwright-core/src/browserServerImpl.ts@@ -46,8 +46,7 @@ export class BrowserServerLauncherImpl implements BrowserServerLauncher {tChannelImpl: (names: '*' | string[], arg: any, path: string) => {throw new validatorPrimitives.ValidationError(`${path}: channels are not expected in launchServer`);},- direction: 'fromWire',- rawBuffers: true,+ binary: 'buffer',isUnderTest,} satisfies validatorPrimitives.ValidatorContext;let launchOptions = {diff --git a/packages/playwright-core/src/client/channelOwner.ts b/packages/playwright-core/src/client/channelOwner.tsindex b539fc925c..7542265254 100644--- a/packages/playwright-core/src/client/channelOwner.ts+++ b/packages/playwright-core/src/client/channelOwner.ts@@ -137,8 +137,7 @@ export abstract class ChannelOwner<T extends channels.Channel = channels.Channelprivate _validatorToWireContext(): ValidatorContext {return {tChannelImpl: tChannelImplToWire,- direction: 'toWire',- rawBuffers: this._connection.rawBuffers(),+ binary: this._connection.rawBuffers() ? 'buffer' : 'toBase64',isUnderTest: () => this._platform.isUnderTest(),};}diff --git a/packages/playwright-core/src/client/connection.ts b/packages/playwright-core/src/client/connection.tsindex 8bea42ebb0..4e72253fb1 100644--- a/packages/playwright-core/src/client/connection.ts+++ b/packages/playwright-core/src/client/connection.ts@@ -205,8 +205,7 @@ export class Connection extends EventEmitter {private _validatorFromWireContext(): ValidatorContext {return {tChannelImpl: this._tChannelImplFromWire.bind(this),- direction: 'fromWire',- rawBuffers: this._rawBuffers,+ binary: this._rawBuffers ? 'buffer' : 'fromBase64',isUnderTest: () => this._platform.isUnderTest(),};}diff --git a/packages/playwright-core/src/client/electron.ts b/packages/playwright-core/src/client/electron.tsindex 0b3290b560..2399aa61ff 100644--- a/packages/playwright-core/src/client/electron.ts+++ b/packages/playwright-core/src/client/electron.ts@@ -20,7 +20,7 @@ import { envObjectToArray } from './clientHelper';import { ConsoleMessage } from './consoleMessage';import { TargetClosedError, isTargetClosedError } from './errors';import { Events } from './events';-import { JSHandle, serializeArgument } from './jsHandle';+import { JSHandle, parseResult, serializeArgument } from './jsHandle';import { Waiter } from './waiter';import { TimeoutSettings } from './timeoutSettings';@@ -159,7 +159,7 @@ export class ElectronApplication extends ChannelOwner<channels.ElectronApplicatiasync evaluate<R, Arg>(pageFunction: structs.PageFunctionOn<ElectronAppType, Arg, R>, arg: Arg): Promise<R> {const result = await this._channel.evaluateExpression({ expression: String(pageFunction), isFunction: typeof pageFunction === 'function', arg: serializeArgument(arg) });- return result.value;+ return parseResult(result.value);}async evaluateHandle<R, Arg>(pageFunction: structs.PageFunctionOn<ElectronAppType, Arg, R>, arg: Arg): Promise<structs.SmartHandle<R>> {diff --git a/packages/playwright-core/src/client/elementHandle.ts b/packages/playwright-core/src/client/elementHandle.tsindex 676356caa6..99e3c555d9 100644--- a/packages/playwright-core/src/client/elementHandle.ts+++ b/packages/playwright-core/src/client/elementHandle.ts@@ -18,7 +18,7 @@ import { assert } from '@isomorphic/assert';import { isString } from '@isomorphic/rtti';import { getMimeTypeForPath } from '@isomorphic/mimeType';import { Frame } from './frame';-import { JSHandle, serializeArgument } from './jsHandle';+import { JSHandle, parseResult, serializeArgument } from './jsHandle';import { fileUploadSizeLimit, mkdirIfNeeded } from './fileUtils';import { WritableStream } from './writableStream';@@ -214,12 +214,12 @@ export class ElementHandle<T extends Node = Node> extends JSHandle<T> implementsasync $eval<R, Arg>(selector: string, pageFunction: structs.PageFunctionOn<Element, Arg, R>, arg?: Arg): Promise<R> {const result = await this._elementChannel.evalOnSelector({ selector, expression: String(pageFunction), isFunction: typeof pageFunction === 'function', arg: serializeArgument(arg) });- return result.value;+ return parseResult(result.value);}async $$eval<R, Arg>(selector: string, pageFunction: structs.PageFunctionOn<Element[], Arg, R>, arg?: Arg): Promise<R> {const result = await this._elementChannel.evalOnSelectorAll({ selector, expression: String(pageFunction), isFunction: typeof pageFunction === 'function', arg: serializeArgument(arg) });- return result.value;+ return parseResult(result.value);}async waitForElementState(state: 'visible' | 'hidden' | 'stable' | 'enabled' | 'disabled', options: TimeoutOptions = {}): Promise<void> {diff --git a/packages/playwright-core/src/client/frame.ts b/packages/playwright-core/src/client/frame.tsindex ed288e398c..aaadf17b46 100644--- a/packages/playwright-core/src/client/frame.ts+++ b/packages/playwright-core/src/client/frame.ts@@ -23,7 +23,7 @@ import { ChannelOwner } from './channelOwner';import { addSourceUrlToScript } from './clientHelper';import { ElementHandle, convertInputFiles, convertSelectOptionValues } from './elementHandle';import { Events } from './events';-import { JSHandle, assertMaxArguments, serializeArgument } from './jsHandle';+import { JSHandle, assertMaxArguments, parseResult, serializeArgument } from './jsHandle';import { FrameLocator, Locator, testIdAttributeName } from './locator';import * as network from './network';import { kLifecycleEvents } from './types';@@ -200,13 +200,13 @@ export class Frame extends ChannelOwner<channels.FrameChannel> implements api.Frasync evaluate<R, Arg>(pageFunction: structs.PageFunction<Arg, R>, arg?: Arg): Promise<R> {assertMaxArguments(arguments.length, 2);const result = await this._channel.evaluateExpression({ expression: String(pageFunction), isFunction: typeof pageFunction === 'function', arg: serializeArgument(arg) });- return result.value;+ return parseResult(result.value);}async _evaluateExposeUtilityScript<R, Arg>(pageFunction: structs.PageFunction<Arg, R>, arg?: Arg): Promise<R> {assertMaxArguments(arguments.length, 2);const result = await this._channel.evaluateExpression({ expression: String(pageFunction), isFunction: typeof pageFunction === 'function', arg: serializeArgument(arg) });- return result.value;+ return parseResult(result.value);}async $(selector: string, options?: { strict?: boolean }): Promise<ElementHandle<SVGElement | HTMLElement> | null> {@@ -232,13 +232,13 @@ export class Frame extends ChannelOwner<channels.FrameChannel> implements api.Frasync $eval<R, Arg>(selector: string, pageFunction: structs.PageFunctionOn<Element, Arg, R>, arg?: Arg): Promise<R> {assertMaxArguments(arguments.length, 3);const result = await this._channel.evalOnSelector({ selector, expression: String(pageFunction), isFunction: typeof pageFunction === 'function', arg: serializeArgument(arg) });- return result.value;+ return parseResult(result.value);}async $$eval<R, Arg>(selector: string, pageFunction: structs.PageFunctionOn<Element[], Arg, R>, arg?: Arg): Promise<R> {assertMaxArguments(arguments.length, 3);const result = await this._channel.evalOnSelectorAll({ selector, expression: String(pageFunction), isFunction: typeof pageFunction === 'function', arg: serializeArgument(arg) });- return result.value;+ return parseResult(result.value);}async $$(selector: string): Promise<ElementHandle<SVGElement | HTMLElement>[]> {@@ -490,14 +490,25 @@ export class Frame extends ChannelOwner<channels.FrameChannel> implements api.Frasync _expect(expression: string, options: Omit<channels.FrameExpectParams, 'expression'>): Promise<ExpectResult> {const params: channels.FrameExpectParams = { expression, ...options, isNot: !!options.isNot };params.expectedValue = serializeArgument(options.expectedValue);- const result = await this._channel.expect(params);- if (result.matches !== !!options.isNot)- delete result.received;+ const channelResult = await this._channel.expect(params);+ const result: ExpectResult = {+ matches: channelResult.matches,+ log: channelResult.log,+ timedOut: channelResult.timedOut,+ errorMessage: channelResult.errorMessage,+ };+ if (channelResult.received !== undefined && channelResult.matches === !!options.isNot) {+ result.received = {+ value: channelResult.received.value !== undefined ? parseResult(channelResult.received.value) : undefined,+ ariaSnapshot: channelResult.received.ariaSnapshot,+ };+ }return result;}}-export type ExpectResult = channels.FrameExpectResult;+export type ExpectReceived = { value?: any, ariaSnapshot?: string };+export type ExpectResult = { matches: boolean, received?: ExpectReceived, log?: string[], timedOut?: boolean, errorMessage?: string };export function verifyLoadState(name: string, waitUntil: LifecycleEvent): LifecycleEvent {if (waitUntil as unknown === 'networkidle0')diff --git a/packages/playwright-core/src/client/jsHandle.ts b/packages/playwright-core/src/client/jsHandle.tsindex d5e8a25d98..62a54950d5 100644--- a/packages/playwright-core/src/client/jsHandle.ts+++ b/packages/playwright-core/src/client/jsHandle.ts@@ -16,7 +16,7 @@import { ChannelOwner } from './channelOwner';import { isTargetClosedError } from './errors';-import { serializeValue } from '../protocol/serializers';+import { parseSerializedValue, serializeValue } from '../protocol/serializers';import type * as structs from '../../types/structs';import type * as api from '../../types/types';@@ -38,7 +38,7 @@ export class JSHandle<T = any> extends ChannelOwner<channels.JSHandleChannel> imasync evaluate<R, Arg>(pageFunction: structs.PageFunctionOn<T, Arg, R>, arg?: Arg): Promise<R> {const result = await this._channel.evaluateExpression({ expression: String(pageFunction), isFunction: typeof pageFunction === 'function', arg: serializeArgument(arg) });- return result.value;+ return parseResult(result.value);}async evaluateHandle<R, Arg>(pageFunction: structs.PageFunctionOn<T, Arg, R>, arg?: Arg): Promise<structs.SmartHandle<R>> {@@ -59,7 +59,7 @@ export class JSHandle<T = any> extends ChannelOwner<channels.JSHandleChannel> im}async jsonValue(): Promise<T> {- return (await this._channel.jsonValue()).value;+ return parseResult((await this._channel.jsonValue()).value);}asElement(): T extends Node ? api.ElementHandle<T> : null {@@ -101,6 +101,10 @@ export function serializeArgument(arg: any): channels.SerializedArgument {return { value, handles };}+export function parseResult(value: channels.SerializedValue): any {+ return parseSerializedValue(value, undefined);+}+export function assertMaxArguments(count: number, max: number): asserts count {if (count > max)throw new Error('Too many arguments. If you need to pass more than 1 argument to the function wrap them in an object.');diff --git a/packages/playwright-core/src/client/page.ts b/packages/playwright-core/src/client/page.tsindex 0dfe2efc6b..f2b3811276 100644--- a/packages/playwright-core/src/client/page.ts+++ b/packages/playwright-core/src/client/page.ts@@ -35,7 +35,7 @@ import { Frame, verifyLoadState } from './frame';import { HarRouter } from './harRouter';import { Keyboard, Mouse, Touchscreen } from './input';import { WebStorage } from './webStorage';-import { assertMaxArguments, serializeArgument } from './jsHandle';+import { assertMaxArguments, parseResult, serializeArgument } from './jsHandle';import { Request, Response, Route, RouteHandler, WebSocket, WebSocketRoute, WebSocketRouteHandler, validateHeaders } from './network';import { Video } from './video';import { Screencast } from './screencast';@@ -900,7 +900,7 @@ export class BindingCall extends ChannelOwner<channels.BindingCallChannel> {page: frame._page!,frame};- const result = await func(source, ...this._initializer.args);+ const result = await func(source, ...this._initializer.args.map(parseResult));this._channel.resolve({ result: serializeArgument(result) }).catch(() => {});} catch (e) {this._channel.reject({ error: serializeError(e) }).catch(() => {});diff --git a/packages/playwright-core/src/client/worker.ts b/packages/playwright-core/src/client/worker.tsindex e24f4faf89..ee98e35779 100644--- a/packages/playwright-core/src/client/worker.ts+++ b/packages/playwright-core/src/client/worker.ts@@ -19,7 +19,7 @@ import { ChannelOwner } from './channelOwner';import { ConsoleMessage } from './consoleMessage';import { isTargetClosedError, TargetClosedError } from './errors';import { Events } from './events';-import { JSHandle, assertMaxArguments, serializeArgument } from './jsHandle';+import { JSHandle, assertMaxArguments, parseResult, serializeArgument } from './jsHandle';import { TimeoutSettings } from './timeoutSettings';import { Waiter } from './waiter';@@ -77,7 +77,7 @@ export class Worker extends ChannelOwner<channels.WorkerChannel> implements api.async evaluate<R, Arg>(pageFunction: structs.PageFunction<Arg, R>, arg?: Arg): Promise<R> {assertMaxArguments(arguments.length, 2);const result = await this._channel.evaluateExpression({ expression: String(pageFunction), isFunction: typeof pageFunction === 'function', arg: serializeArgument(arg) });- return result.value;+ return parseResult(result.value);}async evaluateHandle<R, Arg>(pageFunction: structs.PageFunction<Arg, R>, arg?: Arg): Promise<structs.SmartHandle<R>> {diff --git a/packages/playwright-core/src/protocol/serializers.ts b/packages/playwright-core/src/protocol/serializers.tsindex f53e4af6a8..c6d0d926bc 100644--- a/packages/playwright-core/src/protocol/serializers.ts+++ b/packages/playwright-core/src/protocol/serializers.ts@@ -14,13 +14,13 @@* limitations under the License.*/-import type { SerializedArgumentValue } from '@protocol/channels';+import type { SerializedValue } from '@protocol/channels';-export function parseSerializedValue(value: SerializedArgumentValue, handles: any[] | undefined): any {- return innerParseSerializedArgumentValue(value, handles, new Map(), []);+export function parseSerializedValue(value: SerializedValue, handles: any[] | undefined): any {+ return innerParseSerializedValue(value, handles, new Map(), []);}-function innerParseSerializedArgumentValue(value: SerializedArgumentValue, handles: any[] | undefined, refs: Map<number, object>, accessChain: Array<string | number>): any {+function innerParseSerializedValue(value: SerializedValue, handles: any[] | undefined, refs: Map<number, object>, accessChain: Array<string | number>): any {if (value.ref !== undefined)return refs.get(value.ref);if (value.n !== undefined)@@ -66,14 +66,14 @@ function innerParseSerializedArgumentValue(value: SerializedArgumentValue, handlconst result: any[] = [];refs.set(value.id!, result);for (let i = 0; i < value.a.length; i++)- result.push(innerParseSerializedArgumentValue(value.a[i], handles, refs, [...accessChain, i]));+ result.push(innerParseSerializedValue(value.a[i], handles, refs, [...accessChain, i]));return result;}if (value.o !== undefined) {const result: any = {};refs.set(value.id!, result);for (const { k, v } of value.o)- result[k] = innerParseSerializedArgumentValue(v, handles, refs, [...accessChain, k]);+ result[k] = innerParseSerializedValue(v, handles, refs, [...accessChain, k]);return result;}if (value.h !== undefined) {@@ -90,15 +90,15 @@ type VisitorInfo = {lastId: number;};-export function serializeValue(value: any, handleSerializer: (value: any) => HandleOrValue): SerializedArgumentValue {+export function serializeValue(value: any, handleSerializer: (value: any) => HandleOrValue): SerializedValue {return innerSerializeValue(value, handleSerializer, { lastId: 0, visited: new Map() }, []);}-export function serializePlainValue(arg: any): SerializedArgumentValue {+export function serializePlainValue(arg: any): SerializedValue {return serializeValue(arg, value => ({ fallThrough: value }));}-function innerSerializeValue(value: any, handleSerializer: (value: any) => HandleOrValue, visitorInfo: VisitorInfo, accessChain: Array<string | number>): SerializedArgumentValue {+function innerSerializeValue(value: any, handleSerializer: (value: any) => HandleOrValue, visitorInfo: VisitorInfo, accessChain: Array<string | number>): SerializedValue {const handle = handleSerializer(value);if ('fallThrough' in handle)value = handle.fallThrough;@@ -153,7 +153,7 @@ function innerSerializeValue(value: any, handleSerializer: (value: any) => Handlreturn { a, id };}if (typeof value === 'object') {- const o: { k: string, v: SerializedArgumentValue }[] = [];+ const o: { k: string, v: SerializedValue }[] = [];const id = ++visitorInfo.lastId;visitorInfo.visited.set(value, id);for (const name of Object.keys(value))@@ -192,7 +192,7 @@ function isError(obj: any): obj is Error {}-type TypedArrayKind = NonNullable<SerializedArgumentValue['ta']>['k'];+type TypedArrayKind = NonNullable<SerializedValue['ta']>['k'];const typedArrayKindToConstructor: Record<TypedArrayKind, Function> = {i8: Int8Array,ui8: Uint8Array,diff --git a/packages/playwright-core/src/protocol/validator.ts b/packages/playwright-core/src/protocol/validator.tsindex 1d643a548f..c2e1b77177 100644--- a/packages/playwright-core/src/protocol/validator.ts+++ b/packages/playwright-core/src/protocol/validator.ts@@ -16,7 +16,7 @@// This file is generated by generate_channels.js, do not edit manually.-import { scheme, tOptional, tObject, tBoolean, tInt, tFloat, tString, tAny, tEnum, tArray, tBinary, tChannel, tType, tSerializedValue } from './validatorPrimitives';+import { scheme, tOptional, tObject, tBoolean, tInt, tFloat, tString, tAny, tEnum, tArray, tBinary, tChannel, tType } from './validatorPrimitives';export type { Validator, ValidatorContext } from './validatorPrimitives';export { ValidationError, findValidator, maybeFindValidator, createMetadataValidator, createWaitInfoValidator } from './validatorPrimitives';@@ -1171,7 +1171,7 @@ scheme.ElectronApplicationEvaluateExpressionParams = tObject({arg: tType('SerializedArgument'),});scheme.ElectronApplicationEvaluateExpressionResult = tObject({- value: tSerializedValue,+ value: tType('SerializedValue'),});scheme.ElectronApplicationEvaluateExpressionHandleParams = tObject({expression: tString,@@ -1212,7 +1212,7 @@ scheme.FrameEvalOnSelectorParams = tObject({arg: tType('SerializedArgument'),});scheme.FrameEvalOnSelectorResult = tObject({- value: tSerializedValue,+ value: tType('SerializedValue'),});scheme.FrameEvalOnSelectorAllParams = tObject({selector: tString,@@ -1221,7 +1221,7 @@ scheme.FrameEvalOnSelectorAllParams = tObject({arg: tType('SerializedArgument'),});scheme.FrameEvalOnSelectorAllResult = tObject({- value: tSerializedValue,+ value: tType('SerializedValue'),});scheme.FrameAddScriptTagParams = tObject({url: tOptional(tString),@@ -1340,7 +1340,7 @@ scheme.FrameEvaluateExpressionParams = tObject({arg: tType('SerializedArgument'),});scheme.FrameEvaluateExpressionResult = tObject({- value: tSerializedValue,+ value: tType('SerializedValue'),});scheme.FrameEvaluateExpressionHandleParams = tObject({expression: tString,@@ -1624,7 +1624,7 @@ scheme.FrameExpectParams = tObject({scheme.FrameExpectResult = tObject({matches: tBoolean,received: tOptional(tObject({- value: tOptional(tSerializedValue),+ value: tOptional(tType('SerializedValue')),ariaSnapshot: tOptional(tString),})),timedOut: tOptional(tBoolean),@@ -1649,7 +1649,7 @@ scheme.JSHandleEvaluateExpressionParams = tObject({});scheme.ElementHandleEvaluateExpressionParams = tType('JSHandleEvaluateExpressionParams');scheme.JSHandleEvaluateExpressionResult = tObject({- value: tSerializedValue,+ value: tType('SerializedValue'),});scheme.ElementHandleEvaluateExpressionResult = tType('JSHandleEvaluateExpressionResult');scheme.JSHandleEvaluateExpressionHandleParams = tObject({@@ -1682,7 +1682,7 @@ scheme.ElementHandleGetPropertyResult = tType('JSHandleGetPropertyResult');scheme.JSHandleJsonValueParams = tOptional(tObject({}));scheme.ElementHandleJsonValueParams = tType('JSHandleJsonValueParams');scheme.JSHandleJsonValueResult = tObject({- value: tSerializedValue,+ value: tType('SerializedValue'),});scheme.ElementHandleJsonValueResult = tType('JSHandleJsonValueResult');scheme.ElementHandleInitializer = tObject({@@ -1696,7 +1696,7 @@ scheme.ElementHandleEvalOnSelectorParams = tObject({arg: tType('SerializedArgument'),});scheme.ElementHandleEvalOnSelectorResult = tObject({- value: tSerializedValue,+ value: tType('SerializedValue'),});scheme.ElementHandleEvalOnSelectorAllParams = tObject({selector: tString,@@ -1705,7 +1705,7 @@ scheme.ElementHandleEvalOnSelectorAllParams = tObject({arg: tType('SerializedArgument'),});scheme.ElementHandleEvalOnSelectorAllResult = tObject({- value: tSerializedValue,+ value: tType('SerializedValue'),});scheme.ElementHandleBoundingBoxParams = tOptional(tObject({}));scheme.ElementHandleBoundingBoxResult = tObject({@@ -2907,7 +2907,7 @@ scheme.CDPSessionDetachResult = tOptional(tObject({}));scheme.BindingCallInitializer = tObject({frame: tChannel(['Frame']),name: tString,- args: tArray(tSerializedValue),+ args: tArray(tType('SerializedValue')),});scheme.BindingCallRejectParams = tObject({error: tType('SerializedError'),@@ -2955,7 +2955,7 @@ scheme.DialogAcceptParams = tObject({scheme.DialogAcceptResult = tOptional(tObject({}));scheme.DialogDismissParams = tOptional(tObject({}));scheme.DialogDismissResult = tOptional(tObject({}));-scheme.SerializedArgumentValue = tObject({+scheme.SerializedValue = tObject({n: tOptional(tFloat),b: tOptional(tBoolean),s: tOptional(tString),@@ -2976,17 +2976,17 @@ scheme.SerializedArgumentValue = tObject({p: tString,f: tString,})),- a: tOptional(tArray(tType('SerializedArgumentValue'))),+ a: tOptional(tArray(tType('SerializedValue'))),o: tOptional(tArray(tObject({k: tString,- v: tType('SerializedArgumentValue'),+ v: tType('SerializedValue'),}))),h: tOptional(tInt),id: tOptional(tInt),ref: tOptional(tInt),});scheme.SerializedArgument = tObject({- value: tType('SerializedArgumentValue'),+ value: tType('SerializedValue'),handles: tArray(tChannel('*')),});scheme.SerializedError = tObject({@@ -2995,7 +2995,7 @@ scheme.SerializedError = tObject({name: tString,stack: tOptional(tString),})),- value: tOptional(tSerializedValue),+ value: tOptional(tType('SerializedValue')),});scheme.StackFrame = tObject({file: tString,@@ -3102,7 +3102,7 @@ scheme.WorkerEvaluateExpressionParams = tObject({arg: tType('SerializedArgument'),});scheme.WorkerEvaluateExpressionResult = tObject({- value: tSerializedValue,+ value: tType('SerializedValue'),});scheme.WorkerEvaluateExpressionHandleParams = tObject({expression: tString,diff --git a/packages/playwright-core/src/protocol/validatorPrimitives.ts b/packages/playwright-core/src/protocol/validatorPrimitives.tsindex a2afe7c348..ba15b856d8 100644--- a/packages/playwright-core/src/protocol/validatorPrimitives.ts+++ b/packages/playwright-core/src/protocol/validatorPrimitives.ts@@ -14,14 +14,11 @@* limitations under the License.*/-import { parseSerializedValue, serializeValue } from './serializers';-export class ValidationError extends Error {}export type Validator = (arg: any, path: string, context: ValidatorContext) => any;export type ValidatorContext = {tChannelImpl: (names: '*' | string[], arg: any, path: string, context: ValidatorContext) => any;- direction: 'toWire' | 'fromWire';- rawBuffers?: boolean;+ binary: 'toBase64' | 'fromBase64' | 'buffer';isUnderTest: () => boolean;};export const scheme: { [key: string]: Validator } = {};@@ -77,32 +74,25 @@ export const tString: Validator = (arg: any, path: string, context: ValidatorConthrow new ValidationError(`${path}: expected string, got ${typeof arg}`);};export const tBinary: Validator = (arg: any, path: string, context: ValidatorContext) => {- if (context.rawBuffers) {- // TODO: support custom binary types.- if (!(arg instanceof Buffer) && !(arg instanceof Object))- throw new ValidationError(`${path}: expected Buffer, got ${typeof arg}`);- return arg;- }- if (context.direction === 'fromWire') {+ if (context.binary === 'fromBase64') {if (arg instanceof String)return Buffer.from(arg.valueOf(), 'base64');if (typeof arg === 'string')return Buffer.from(arg, 'base64');throw new ValidationError(`${path}: expected base64-encoded buffer, got ${typeof arg}`);}- if (context.direction === 'toWire') {+ if (context.binary === 'toBase64') {if (!(arg instanceof Buffer))throw new ValidationError(`${path}: expected Buffer, got ${typeof arg}`);return (arg as Buffer).toString('base64');}- throw new ValidationError(`Unsupported direction "${context.direction}"`);-};-export const tSerializedValue: Validator = (arg: any, path: string, context: ValidatorContext) => {- if (context.direction === 'toWire')- return serializeValue(arg, value => ({ fallThrough: value }));- if (context.direction === 'fromWire')- return parseSerializedValue(arg, undefined);- throw new ValidationError(`Unsupported direction "${context.direction}"`);+ if (context.binary === 'buffer') {+ // TODO: support custom binary types.+ if (!(arg instanceof Buffer) && !(arg instanceof Object))+ throw new ValidationError(`${path}: expected Buffer, got ${typeof arg}`);+ return arg;+ }+ throw new ValidationError(`Unsupported binary behavior "${context.binary}"`);};export const tUndefined: Validator = (arg: any, path: string, context: ValidatorContext) => {if (Object.is(arg, undefined))diff --git a/packages/playwright-core/src/server/dispatchers/dispatcher.ts b/packages/playwright-core/src/server/dispatchers/dispatcher.tsindex 660e6221a1..7e91fc1e7f 100644--- a/packages/playwright-core/src/server/dispatchers/dispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/dispatcher.ts@@ -229,8 +229,7 @@ export class DispatcherConnection {private _validatorToWireContext(): ValidatorContext {return {tChannelImpl: this._tChannelImplToWire.bind(this),- direction: 'toWire',- rawBuffers: this._isLocal,+ binary: this._isLocal ? 'buffer' : 'toBase64',isUnderTest,};}@@ -238,8 +237,7 @@ export class DispatcherConnection {private _validatorFromWireContext(): ValidatorContext {return {tChannelImpl: this._tChannelImplFromWire.bind(this),- direction: 'fromWire',- rawBuffers: this._isLocal,+ binary: this._isLocal ? 'buffer' : 'fromBase64',isUnderTest,};}@@ -360,7 +358,7 @@ export class DispatcherConnection {const result = await dispatcher._runCommand(callMetadata, method, validParams);const validator = findValidator(dispatcher._type, method, 'Result');response.result = validator(result, '', this._validatorToWireContext());- callMetadata.result = response.result; // Use the wire-format result for the trace recorder.+ callMetadata.result = result;} catch (e) {if (isTargetClosedError(e)) {const reason = sdkObject.closeReason();diff --git a/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts b/packages/playwright-core/src/server/dispatchers/electronDispatcher.tsindex 7fdb16befb..4dcf68d0d1 100644--- a/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts@@ -16,7 +16,7 @@import { BrowserContextDispatcher } from './browserContextDispatcher';import { Dispatcher } from './dispatcher';-import { JSHandleDispatcher, parseArgument } from './jsHandleDispatcher';+import { JSHandleDispatcher, parseArgument, serializeResult } from './jsHandleDispatcher';import { ElectronApplication } from '../electron/electron';import type { RootDispatcher } from './dispatcher';@@ -77,7 +77,7 @@ export class ElectronApplicationDispatcher extends Dispatcher<ElectronApplicatioasync evaluateExpression(params: channels.ElectronApplicationEvaluateExpressionParams, progress: Progress): Promise<channels.ElectronApplicationEvaluateExpressionResult> {const handle = await progress.race(this._object._nodeElectronHandlePromise);- return { value: await handle.evaluateExpression(progress, params.expression, { isFunction: params.isFunction }, parseArgument(params.arg)) };+ return { value: serializeResult(await handle.evaluateExpression(progress, params.expression, { isFunction: params.isFunction }, parseArgument(params.arg))) };}async evaluateExpressionHandle(params: channels.ElectronApplicationEvaluateExpressionHandleParams, progress: Progress): Promise<channels.ElectronApplicationEvaluateExpressionHandleResult> {diff --git a/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.ts b/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.tsindex 8706bf6a3a..899c71a0db 100644--- a/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.ts@@ -16,7 +16,7 @@import { BrowserContextDispatcher } from './browserContextDispatcher';import { FrameDispatcher } from './frameDispatcher';-import { JSHandleDispatcher, parseArgument } from './jsHandleDispatcher';+import { JSHandleDispatcher, parseArgument, serializeResult } from './jsHandleDispatcher';import type { ElementHandle } from '../dom';import type { Frame } from '../frames';@@ -197,11 +197,11 @@ export class ElementHandleDispatcher extends JSHandleDispatcher<FrameDispatcher>}async evalOnSelector(params: channels.ElementHandleEvalOnSelectorParams, progress: Progress): Promise<channels.ElementHandleEvalOnSelectorResult> {- return { value: await this._elementHandle.evalOnSelector(progress, params.selector, !!params.strict, params.expression, params.isFunction, parseArgument(params.arg)) };+ return { value: serializeResult(await this._elementHandle.evalOnSelector(progress, params.selector, !!params.strict, params.expression, params.isFunction, parseArgument(params.arg))) };}async evalOnSelectorAll(params: channels.ElementHandleEvalOnSelectorAllParams, progress: Progress): Promise<channels.ElementHandleEvalOnSelectorAllResult> {- return { value: await this._elementHandle.evalOnSelectorAll(progress, params.selector, params.expression, params.isFunction, parseArgument(params.arg)) };+ return { value: serializeResult(await this._elementHandle.evalOnSelectorAll(progress, params.selector, params.expression, params.isFunction, parseArgument(params.arg))) };}async waitForElementState(params: channels.ElementHandleWaitForElementStateParams, progress: Progress): Promise<void> {diff --git a/packages/playwright-core/src/server/dispatchers/frameDispatcher.ts b/packages/playwright-core/src/server/dispatchers/frameDispatcher.tsindex 29cf5587ec..9c038ccc20 100644--- a/packages/playwright-core/src/server/dispatchers/frameDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/frameDispatcher.ts@@ -20,7 +20,7 @@ import { renderTitleForCall } from '@isomorphic/protocolFormatter';import { Frame } from '../frames';import { Dispatcher } from './dispatcher';import { ElementHandleDispatcher } from './elementHandlerDispatcher';-import { parseArgument } from './jsHandleDispatcher';+import { parseArgument, serializeResult } from './jsHandleDispatcher';import { ResponseDispatcher } from './networkDispatchers';import { RequestDispatcher } from './networkDispatchers';import type { Progress } from '../progress';@@ -84,7 +84,7 @@ export class FrameDispatcher extends Dispatcher<Frame, channels.FrameChannel, Br}async evaluateExpression(params: channels.FrameEvaluateExpressionParams, progress: Progress): Promise<channels.FrameEvaluateExpressionResult> {- return { value: await this._frame.evaluateExpression(progress, params.expression, { isFunction: params.isFunction }, parseArgument(params.arg)) };+ return { value: serializeResult(await this._frame.evaluateExpression(progress, params.expression, { isFunction: params.isFunction }, parseArgument(params.arg))) };}async evaluateExpressionHandle(params: channels.FrameEvaluateExpressionHandleParams, progress: Progress): Promise<channels.FrameEvaluateExpressionHandleResult> {@@ -100,11 +100,11 @@ export class FrameDispatcher extends Dispatcher<Frame, channels.FrameChannel, Br}async evalOnSelector(params: channels.FrameEvalOnSelectorParams, progress: Progress): Promise<channels.FrameEvalOnSelectorResult> {- return { value: await this._frame.evalOnSelector(progress, params.selector, !!params.strict, params.expression, params.isFunction, parseArgument(params.arg)) };+ return { value: serializeResult(await this._frame.evalOnSelector(progress, params.selector, !!params.strict, params.expression, params.isFunction, parseArgument(params.arg))) };}async evalOnSelectorAll(params: channels.FrameEvalOnSelectorAllParams, progress: Progress): Promise<channels.FrameEvalOnSelectorAllResult> {- return { value: await this._frame.evalOnSelectorAll(progress, params.selector, params.expression, params.isFunction, parseArgument(params.arg)) };+ return { value: serializeResult(await this._frame.evalOnSelectorAll(progress, params.selector, params.expression, params.isFunction, parseArgument(params.arg))) };}async querySelector(params: channels.FrameQuerySelectorParams, progress: Progress): Promise<channels.FrameQuerySelectorResult> {@@ -277,6 +277,19 @@ export class FrameDispatcher extends Dispatcher<Frame, channels.FrameChannel, Brif (params.expression === 'to.match.aria' && expectedValue)expectedValue = parseAriaSnapshotUnsafe(yaml, expectedValue);progress.log(`${renderTitleForCall(progress.metadata)}${params.timeout ? ` with timeout ${params.timeout}ms` : ''}`);- return await this._frame.expect(progress, params.selector, { ...params, expectedValue });+ const result = await this._frame.expect(progress, params.selector, { ...params, expectedValue });+ const channelResult: channels.FrameExpectResult = {+ matches: result.matches,+ log: result.log,+ timedOut: result.timedOut,+ errorMessage: result.errorMessage,+ };+ if (result.received !== undefined) {+ channelResult.received = {+ value: result.received.value !== undefined ? serializeResult(result.received.value) : undefined,+ ariaSnapshot: result.received.ariaSnapshot,+ };+ }+ return channelResult;}}diff --git a/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts b/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.tsindex b7c1bcacf1..0155587d1a 100644--- a/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts@@ -16,7 +16,7 @@import { Dispatcher } from './dispatcher';import { ElementHandleDispatcher } from './elementHandlerDispatcher';-import { parseSerializedValue } from '../../protocol/serializers';+import { parseSerializedValue, serializeValue } from '../../protocol/serializers';import type * as js from '../javascript';import type { ElectronApplicationDispatcher } from './electronDispatcher';@@ -44,7 +44,7 @@ export class JSHandleDispatcher<ParentScope extends JSHandleDispatcherParentScopasync evaluateExpression(params: channels.JSHandleEvaluateExpressionParams, progress: Progress): Promise<channels.JSHandleEvaluateExpressionResult> {const jsHandle = await this._object.evaluateExpression(progress, params.expression, { isFunction: params.isFunction }, parseArgument(params.arg));- return { value: jsHandle };+ return { value: serializeResult(jsHandle) };}async evaluateExpressionHandle(params: channels.JSHandleEvaluateExpressionHandleParams, progress: Progress): Promise<channels.JSHandleEvaluateExpressionHandleResult> {@@ -70,7 +70,7 @@ export class JSHandleDispatcher<ParentScope extends JSHandleDispatcherParentScop}async jsonValue(params: channels.JSHandleJsonValueParams, progress: Progress): Promise<channels.JSHandleJsonValueResult> {- return { value: await this._object.jsonValue(progress) };+ return { value: serializeResult(await this._object.jsonValue(progress)) };}async dispose(_: any, progress: Progress) {@@ -84,3 +84,11 @@ export class JSHandleDispatcher<ParentScope extends JSHandleDispatcherParentScopexport function parseArgument(arg: channels.SerializedArgument): any {return parseSerializedValue(arg.value, arg.handles.map(a => (a as JSHandleDispatcher)._object));}++export function parseValue(v: channels.SerializedValue): any {+ return parseSerializedValue(v, []);+}++export function serializeResult(arg: any): channels.SerializedValue {+ return serializeValue(arg, value => ({ fallThrough: value }));+}diff --git a/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts b/packages/playwright-core/src/server/dispatchers/pageDispatcher.tsindex d8ba2b63ca..1e2e7d0c0f 100644--- a/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts@@ -22,7 +22,7 @@ import { parseError, serializeError } from '../errors';import { ArtifactDispatcher } from './artifactDispatcher';import { ElementHandleDispatcher } from './elementHandlerDispatcher';import { FrameDispatcher } from './frameDispatcher';-import { JSHandleDispatcher, parseArgument } from './jsHandleDispatcher';+import { JSHandleDispatcher, parseArgument, serializeResult } from './jsHandleDispatcher';import { RequestDispatcher } from './networkDispatchers';import { ResponseDispatcher } from './networkDispatchers';import { RouteDispatcher, WebSocketDispatcher } from './networkDispatchers';@@ -545,7 +545,7 @@ export class WorkerDispatcher extends Dispatcher<Worker, channels.WorkerChannel,}async evaluateExpression(params: channels.WorkerEvaluateExpressionParams, progress: Progress): Promise<channels.WorkerEvaluateExpressionResult> {- return { value: await this._object.evaluateExpression(progress, params.expression, params.isFunction, parseArgument(params.arg)) };+ return { value: serializeResult(await this._object.evaluateExpression(progress, params.expression, params.isFunction, parseArgument(params.arg))) };}async evaluateExpressionHandle(params: channels.WorkerEvaluateExpressionHandleParams, progress: Progress): Promise<channels.WorkerEvaluateExpressionHandleResult> {@@ -571,7 +571,7 @@ export class BindingCallDispatcher extends Dispatcher<SdkObject, channels.Bindinsuper(scope, new SdkObject(scope._object, 'bindingCall'), 'BindingCall', {frame: frameDispatcher,name,- args,+ args: args.map(serializeResult),});this._promise = new Promise((resolve, reject) => {this._resolve = resolve;diff --git a/packages/playwright-core/src/server/socksInterceptor.ts b/packages/playwright-core/src/server/socksInterceptor.tsindex 7e5df6b152..c410ff19bc 100644--- a/packages/playwright-core/src/server/socksInterceptor.ts+++ b/packages/playwright-core/src/server/socksInterceptor.ts@@ -43,7 +43,7 @@ export class SocksInterceptor {const id = --lastId;this._ids.add(id);const validator = findValidator('SocksSupport', prop, 'Params');- params = validator(params, '', { tChannelImpl: tChannelForSocks, direction: 'toWire', isUnderTest });+ params = validator(params, '', { tChannelImpl: tChannelForSocks, binary: 'toBase64', isUnderTest });transport.send({ id, guid: this._socksSupportObjectGuid, method: prop, params, metadata: { stack: [], apiName: '', internal: true } } as any);} catch (e) {}@@ -75,7 +75,7 @@ export class SocksInterceptor {}if (this._socksSupportObjectGuid && message.guid === this._socksSupportObjectGuid) {const validator = findValidator('SocksSupport', message.method, 'Event');- const params = validator(message.params, '', { tChannelImpl: tChannelForSocks, direction: 'fromWire', isUnderTest });+ const params = validator(message.params, '', { tChannelImpl: tChannelForSocks, binary: 'fromBase64', isUnderTest });this._channel.emit(message.method, params);return true;}diff --git a/packages/protocol/spec/serialized.yml b/packages/protocol/spec/serialized.ymlindex 2046064a41..1457d5f891 100644--- a/packages/protocol/spec/serialized.yml+++ b/packages/protocol/spec/serialized.yml@@ -12,7 +12,7 @@# See the License for the specific language governing permissions and# limitations under the License.-SerializedArgumentValue:+SerializedValue:type: object# Exactly one of the properties must be present.properties:@@ -68,7 +68,7 @@ SerializedArgumentValue:f: stringa:type: array?- items: SerializedArgumentValue+ items: SerializedValue# Object with keys and values.o:type: array?@@ -76,7 +76,7 @@ SerializedArgumentValue:type: objectproperties:k: string- v: SerializedArgumentValue+ v: SerializedValue# An index in the handles array from SerializedArgument.h: int?# Index of the object in value-type for circular reference resolution.@@ -87,7 +87,7 @@ SerializedArgumentValue:SerializedArgument:type: objectproperties:- value: SerializedArgumentValue+ value: SerializedValuehandles:type: arrayitems: Channeldiff --git a/packages/protocol/src/channels.d.ts b/packages/protocol/src/channels.d.tsindex 11443e0976..d3acc2cc95 100644--- a/packages/protocol/src/channels.d.ts+++ b/packages/protocol/src/channels.d.ts@@ -20,7 +20,6 @@ import type { CallMetadata } from './callMetadata';import type { Progress } from './progress';export type Binary = Buffer;-export type UnserializedValue = any;export interface Channel {}@@ -2218,7 +2217,7 @@ export type ElectronApplicationEvaluateExpressionOptions = {isFunction?: boolean,};export type ElectronApplicationEvaluateExpressionResult = {- value: UnserializedValue,+ value: SerializedValue,};export type ElectronApplicationEvaluateExpressionHandleParams = {expression: string,@@ -2332,7 +2331,7 @@ export type FrameEvalOnSelectorOptions = {isFunction?: boolean,};export type FrameEvalOnSelectorResult = {- value: UnserializedValue,+ value: SerializedValue,};export type FrameEvalOnSelectorAllParams = {selector: string,@@ -2344,7 +2343,7 @@ export type FrameEvalOnSelectorAllOptions = {isFunction?: boolean,};export type FrameEvalOnSelectorAllResult = {- value: UnserializedValue,+ value: SerializedValue,};export type FrameAddScriptTagParams = {url?: string,@@ -2540,7 +2539,7 @@ export type FrameEvaluateExpressionOptions = {isFunction?: boolean,};export type FrameEvaluateExpressionResult = {- value: UnserializedValue,+ value: SerializedValue,};export type FrameEvaluateExpressionHandleParams = {expression: string,@@ -2967,7 +2966,7 @@ export type FrameExpectOptions = {export type FrameExpectResult = {matches: boolean,received?: {- value?: UnserializedValue,+ value?: SerializedValue,ariaSnapshot?: string,},timedOut?: boolean,@@ -3011,7 +3010,7 @@ export type JSHandleEvaluateExpressionOptions = {isFunction?: boolean,};export type JSHandleEvaluateExpressionResult = {- value: UnserializedValue,+ value: SerializedValue,};export type JSHandleEvaluateExpressionHandleParams = {expression: string,@@ -3044,7 +3043,7 @@ export type JSHandleGetPropertyResult = {export type JSHandleJsonValueParams = {};export type JSHandleJsonValueOptions = {};export type JSHandleJsonValueResult = {- value: UnserializedValue,+ value: SerializedValue,};export interface JSHandleEvents {@@ -3106,7 +3105,7 @@ export type ElementHandleEvalOnSelectorOptions = {isFunction?: boolean,};export type ElementHandleEvalOnSelectorResult = {- value: UnserializedValue,+ value: SerializedValue,};export type ElementHandleEvalOnSelectorAllParams = {selector: string,@@ -3118,7 +3117,7 @@ export type ElementHandleEvalOnSelectorAllOptions = {isFunction?: boolean,};export type ElementHandleEvalOnSelectorAllResult = {- value: UnserializedValue,+ value: SerializedValue,};export type ElementHandleBoundingBoxParams = {};export type ElementHandleBoundingBoxOptions = {};@@ -5140,7 +5139,7 @@ export interface CDPSessionEvents {export type BindingCallInitializer = {frame: FrameChannel,name: string,- args: UnserializedValue[],+ args: SerializedValue[],};export interface BindingCallEventTarget {}@@ -5243,7 +5242,7 @@ export type DialogDismissResult = void;export interface DialogEvents {}-export type SerializedArgumentValue = {+export type SerializedValue = {n?: number,b?: boolean,s?: string,@@ -5264,10 +5263,10 @@ export type SerializedArgumentValue = {p: string,f: string,},- a?: SerializedArgumentValue[],+ a?: SerializedValue[],o?: {k: string,- v: SerializedArgumentValue,+ v: SerializedValue,}[],h?: number,id?: number,@@ -5275,7 +5274,7 @@ export type SerializedArgumentValue = {};export type SerializedArgument = {- value: SerializedArgumentValue,+ value: SerializedValue,handles: Channel[],};@@ -5285,7 +5284,7 @@ export type SerializedError = {name: string,stack?: string,},- value?: UnserializedValue,+ value?: SerializedValue,};export type StackFrame = {@@ -5462,7 +5461,7 @@ export type WorkerEvaluateExpressionOptions = {isFunction?: boolean,};export type WorkerEvaluateExpressionResult = {- value: UnserializedValue,+ value: SerializedValue,};export type WorkerEvaluateExpressionHandleParams = {expression: string,diff --git a/packages/trace-viewer/src/ui/callTab.tsx b/packages/trace-viewer/src/ui/callTab.tsxindex 38e7cd092a..69da4e94c1 100644--- a/packages/trace-viewer/src/ui/callTab.tsx+++ b/packages/trace-viewer/src/ui/callTab.tsx@@ -14,7 +14,7 @@* limitations under the License.*/-import type { SerializedArgumentValue } from '@protocol/channels';+import type { SerializedValue } from '@protocol/channels';import type { ActionTraceEvent } from '@trace/trace';import { clsx } from '@web/uiUtils';import { msToString } from '@isomorphic/formatUtils';@@ -127,7 +127,7 @@ function propertyToString(event: ActionTraceEvent, name: string, value: any, sdkreturn { text: JSON.stringify(value), type: 'object', name };}-function parseSerializedValue(value: SerializedArgumentValue, handles: any[] | undefined): any {+function parseSerializedValue(value: SerializedValue, handles: any[] | undefined): any {if (value.n !== undefined)return value.n;if (value.s !== undefined)diff --git a/utils/generate_channels.js b/utils/generate_channels.jsindex 82e1fca406..cd33d24177 100755--- a/utils/generate_channels.js+++ b/utils/generate_channels.js@@ -40,8 +40,6 @@ function inlineType(type, indent, wrapEnums = false) {return { ts: 'Binary', scheme: 'tBinary', optional };if (type === 'json')return { ts: 'any', scheme: 'tAny', optional };- if (type === 'SerializedValue')- return { ts: 'UnserializedValue', scheme: 'tSerializedValue', optional };if (['string', 'boolean', 'undefined'].includes(type))return { ts: type, scheme: `t${titleCase(type)}`, optional };if (type === 'number')@@ -134,7 +132,6 @@ import type { CallMetadata } from './callMetadata';import type { Progress } from './progress';export type Binary = Buffer;-export type UnserializedValue = any;export interface Channel {}@@ -159,7 +156,7 @@ const validator_ts = [// This file is generated by ${path.basename(__filename)}, do not edit manually.-import { scheme, tOptional, tObject, tBoolean, tInt, tFloat, tString, tAny, tEnum, tArray, tBinary, tChannel, tType, tSerializedValue } from './validatorPrimitives';+import { scheme, tOptional, tObject, tBoolean, tInt, tFloat, tString, tAny, tEnum, tArray, tBinary, tChannel, tType } from './validatorPrimitives';export type { Validator, ValidatorContext } from './validatorPrimitives';export { ValidationError, findValidator, maybeFindValidator, createMetadataValidator, createWaitInfoValidator } from './validatorPrimitives';`];