UNPKG

@vzeta/camunda-api-zod-schemas

Version:

Zod schemas and TypeScript types for Camunda 8 unified API

37 lines (36 loc) 1.08 kB
import { z } from "zod"; import { API_VERSION } from "../common.js"; const partitionRoleSchema = z.enum(["leader", "follower", "inactive"]); const partitionHealthSchema = z.enum(["healthy", "unhealthy", "dead"]); const partitionSchema = z.object({ partitionId: z.number().int(), role: partitionRoleSchema, health: partitionHealthSchema }); const brokerInfoSchema = z.object({ nodeId: z.number().int(), host: z.string(), port: z.number().int(), partitions: z.array(partitionSchema), version: z.string() }); const getTopologyResponseBodySchema = z.object({ brokers: z.array(brokerInfoSchema).nullable(), clusterSize: z.number().int().nullable(), partitionsCount: z.number().int().nullable(), replicationFactor: z.number().int().nullable(), gatewayVersion: z.string().nullable(), lastCompletedChangeId: z.string().nullable() }); const getTopology = { method: "GET", getUrl: () => `/${API_VERSION}/topology` }; export { brokerInfoSchema, getTopology, getTopologyResponseBodySchema, partitionHealthSchema, partitionRoleSchema, partitionSchema };