UNPKG

@launchdarkly/mcp-server

Version:

The local [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server for [LaunchDarkly](https://launchdarkly.com/) federal and European Union (EU) environments.

94 lines (88 loc) • 2.49 kB
/* * 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"; import { ParameterRep, ParameterRep$inboundSchema, ParameterRep$Outbound, ParameterRep$outboundSchema, } from "./parameterrep.js"; export type TreatmentRep = { /** * The treatment ID. This is the variation ID from the flag. */ id?: string | undefined; /** * The treatment name. This is the variation name from the flag. */ name: string; /** * The percentage of traffic allocated to this treatment during the iteration */ allocationPercent: string; /** * Whether this treatment is the baseline to compare other treatments against */ baseline?: boolean | undefined; /** * Details on the flag and variation used for this treatment */ parameters?: Array<ParameterRep> | undefined; }; /** @internal */ export const TreatmentRep$inboundSchema: z.ZodType< TreatmentRep, z.ZodTypeDef, unknown > = z.object({ _id: z.string().optional(), name: z.string(), allocationPercent: z.string(), baseline: z.boolean().optional(), parameters: z.array(ParameterRep$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "_id": "id", }); }); /** @internal */ export type TreatmentRep$Outbound = { _id?: string | undefined; name: string; allocationPercent: string; baseline?: boolean | undefined; parameters?: Array<ParameterRep$Outbound> | undefined; }; /** @internal */ export const TreatmentRep$outboundSchema: z.ZodType< TreatmentRep$Outbound, z.ZodTypeDef, TreatmentRep > = z.object({ id: z.string().optional(), name: z.string(), allocationPercent: z.string(), baseline: z.boolean().optional(), parameters: z.array(ParameterRep$outboundSchema).optional(), }).transform((v) => { return remap$(v, { id: "_id", }); }); export function treatmentRepToJSON(treatmentRep: TreatmentRep): string { return JSON.stringify(TreatmentRep$outboundSchema.parse(treatmentRep)); } export function treatmentRepFromJSON( jsonString: string, ): SafeParseResult<TreatmentRep, SDKValidationError> { return safeParse( jsonString, (x) => TreatmentRep$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TreatmentRep' from JSON`, ); }