@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.
58 lines (52 loc) • 1.5 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";
export type Defaults = {
/**
* The index, from the array of variations for this flag, of the variation to serve by default when targeting is on.
*/
onVariation: number;
/**
* The index, from the array of variations for this flag, of the variation to serve by default when targeting is off.
*/
offVariation: number;
};
/** @internal */
export const Defaults$inboundSchema: z.ZodType<
Defaults,
z.ZodTypeDef,
unknown
> = z.object({
onVariation: z.number().int(),
offVariation: z.number().int(),
});
/** @internal */
export type Defaults$Outbound = {
onVariation: number;
offVariation: number;
};
/** @internal */
export const Defaults$outboundSchema: z.ZodType<
Defaults$Outbound,
z.ZodTypeDef,
Defaults
> = z.object({
onVariation: z.number().int(),
offVariation: z.number().int(),
});
export function defaultsToJSON(defaults: Defaults): string {
return JSON.stringify(Defaults$outboundSchema.parse(defaults));
}
export function defaultsFromJSON(
jsonString: string,
): SafeParseResult<Defaults, SDKValidationError> {
return safeParse(
jsonString,
(x) => Defaults$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Defaults' from JSON`,
);
}