/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type Mysql = { /** * Optional plugin-specific data, whose meaning depends on the value of auth_plugin_name. Returned in the initial HandshakePacket. */ authPluginData?: string | undefined; /** * The name of the authentication plugin, returned in the initial HandshakePacket. */ authPluginName?: string | undefined; /** * The set of capability flags the server returned in the initial HandshakePacket. Each entry corresponds to a bit being set in the flags; key names correspond to the #defines in the MySQL docs. */ capabilityFlags?: { [k: string]: boolean } | undefined; /** * The identifier for the character set the server is using. Returned in the initial HandshakePacket. */ characterSet?: number | undefined; /** * The server's internal identifier for this client's connection, sent in the initial HandshakePacket. */ connectionId?: number | undefined; /** * Only set if there is an error returned by the server, for example if the scanner is not on the allowed hosts list. */ errorCode?: number | undefined; /** * The friendly name for the error code as defined at https://dev.mysql.com/doc/refman/8.0/en/error-messages-server.html, or UNKNOWN */ errorId?: string | undefined; /** * Optional string describing the error. Only set if there is an error. */ errorMessage?: string | undefined; /** * 8-bit unsigned integer representing the server's protocol version sent in the initial HandshakePacket from the server. */ protocolVersion?: number | undefined; /** * The specific server version returned in the initial HandshakePacket. Often in the form x.y.z, but not always. */ serverVersion?: string | undefined; /** * The set of status flags the server returned in the initial HandshakePacket. Each entry corresponds to a bit being set in the flags; key names correspond to the #defines in the MySQL docs. */ statusFlags?: { [k: string]: boolean } | undefined; }; /** @internal */ export const Mysql$inboundSchema: z.ZodType = z .object({ auth_plugin_data: z.string().optional(), auth_plugin_name: z.string().optional(), capability_flags: z.record(z.boolean()).optional(), character_set: z.number().int().optional(), connection_id: z.number().int().optional(), error_code: z.number().int().optional(), error_id: z.string().optional(), error_message: z.string().optional(), protocol_version: z.number().int().optional(), server_version: z.string().optional(), status_flags: z.record(z.boolean()).optional(), }).transform((v) => { return remap$(v, { "auth_plugin_data": "authPluginData", "auth_plugin_name": "authPluginName", "capability_flags": "capabilityFlags", "character_set": "characterSet", "connection_id": "connectionId", "error_code": "errorCode", "error_id": "errorId", "error_message": "errorMessage", "protocol_version": "protocolVersion", "server_version": "serverVersion", "status_flags": "statusFlags", }); }); export function mysqlFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Mysql$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Mysql' from JSON`, ); }