@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.
73 lines (67 loc) • 2.26 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 {
ExperimentAllocationRep,
ExperimentAllocationRep$inboundSchema,
ExperimentAllocationRep$Outbound,
ExperimentAllocationRep$outboundSchema,
} from "./experimentallocationrep.js";
import {
WeightedVariation,
WeightedVariation$inboundSchema,
WeightedVariation$Outbound,
WeightedVariation$outboundSchema,
} from "./weightedvariation.js";
export type Rollout = {
variations: Array<WeightedVariation>;
experimentAllocation?: ExperimentAllocationRep | undefined;
seed?: number | undefined;
bucketBy?: string | undefined;
contextKind?: string | undefined;
};
/** @internal */
export const Rollout$inboundSchema: z.ZodType<Rollout, z.ZodTypeDef, unknown> =
z.object({
variations: z.array(WeightedVariation$inboundSchema),
experimentAllocation: ExperimentAllocationRep$inboundSchema.optional(),
seed: z.number().int().optional(),
bucketBy: z.string().optional(),
contextKind: z.string().optional(),
});
/** @internal */
export type Rollout$Outbound = {
variations: Array<WeightedVariation$Outbound>;
experimentAllocation?: ExperimentAllocationRep$Outbound | undefined;
seed?: number | undefined;
bucketBy?: string | undefined;
contextKind?: string | undefined;
};
/** @internal */
export const Rollout$outboundSchema: z.ZodType<
Rollout$Outbound,
z.ZodTypeDef,
Rollout
> = z.object({
variations: z.array(WeightedVariation$outboundSchema),
experimentAllocation: ExperimentAllocationRep$outboundSchema.optional(),
seed: z.number().int().optional(),
bucketBy: z.string().optional(),
contextKind: z.string().optional(),
});
export function rolloutToJSON(rollout: Rollout): string {
return JSON.stringify(Rollout$outboundSchema.parse(rollout));
}
export function rolloutFromJSON(
jsonString: string,
): SafeParseResult<Rollout, SDKValidationError> {
return safeParse(
jsonString,
(x) => Rollout$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Rollout' from JSON`,
);
}