@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.
78 lines (72 loc) • 2.11 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
TreatmentParameterInput,
TreatmentParameterInput$inboundSchema,
TreatmentParameterInput$Outbound,
TreatmentParameterInput$outboundSchema,
} from "./treatmentparameterinput.js";
export type TreatmentInput = {
/**
* The treatment name
*/
name: string;
/**
* Whether this treatment is the baseline to compare other treatments against
*/
baseline: boolean;
/**
* The percentage of traffic allocated to this treatment during the iteration
*/
allocationPercent: string;
/**
* Details on the flag and variation to use for this treatment
*/
parameters: Array<TreatmentParameterInput>;
};
/** @internal */
export const TreatmentInput$inboundSchema: z.ZodType<
TreatmentInput,
z.ZodTypeDef,
unknown
> = z.object({
name: z.string(),
baseline: z.boolean(),
allocationPercent: z.string(),
parameters: z.array(TreatmentParameterInput$inboundSchema),
});
/** @internal */
export type TreatmentInput$Outbound = {
name: string;
baseline: boolean;
allocationPercent: string;
parameters: Array<TreatmentParameterInput$Outbound>;
};
/** @internal */
export const TreatmentInput$outboundSchema: z.ZodType<
TreatmentInput$Outbound,
z.ZodTypeDef,
TreatmentInput
> = z.object({
name: z.string(),
baseline: z.boolean(),
allocationPercent: z.string(),
parameters: z.array(TreatmentParameterInput$outboundSchema),
});
export function treatmentInputToJSON(treatmentInput: TreatmentInput): string {
return JSON.stringify(TreatmentInput$outboundSchema.parse(treatmentInput));
}
export function treatmentInputFromJSON(
jsonString: string,
): SafeParseResult<TreatmentInput, SDKValidationError> {
return safeParse(
jsonString,
(x) => TreatmentInput$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'TreatmentInput' from JSON`,
);
}