/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Unify event source */ export const EventSource = { Native: "native", Virtual: "virtual", } as const; /** * Unify event source */ export type EventSource = OpenEnum; /** * Unify event that is supported on the connector. Events are delivered via Webhooks. */ export type ConnectorEvent = { /** * Unify event type */ eventType?: string | undefined; /** * Unify event source */ eventSource?: EventSource | undefined; /** * Downstream event type */ downstreamEventType?: string | undefined; resources?: Array | undefined; /** * Unify entity type */ entityType?: string | undefined; }; /** @internal */ export const EventSource$inboundSchema: z.ZodType< EventSource, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(EventSource)); /** @internal */ export const ConnectorEvent$inboundSchema: z.ZodType< ConnectorEvent, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ event_type: types.optional(types.string()), event_source: types.optional(EventSource$inboundSchema), downstream_event_type: types.optional(types.string()), resources: types.optional(z.array(types.string())), entity_type: types.optional(types.string()), }).transform((v) => { return remap$(v, { "event_type": "eventType", "event_source": "eventSource", "downstream_event_type": "downstreamEventType", "entity_type": "entityType", }); }) ); export function connectorEventFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ConnectorEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConnectorEvent' from JSON`, ); }