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.

197 lines (185 loc) • 5.95 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AnalysisConfigInput, AnalysisConfigInput$inboundSchema, AnalysisConfigInput$Outbound, AnalysisConfigInput$outboundSchema, } from "./analysisconfiginput.js"; import { IterationInput, IterationInput$inboundSchema, IterationInput$Outbound, IterationInput$outboundSchema, } from "./iterationinput.js"; /** * The results analysis approach. Defaults to "frequentist" when not provided, or "bayesian" for multi-armed bandit experiments. */ export const ExperimentPostMethodology = { Bayesian: "bayesian", Frequentist: "frequentist", ExportOnly: "export_only", } as const; /** * The results analysis approach. Defaults to "frequentist" when not provided, or "bayesian" for multi-armed bandit experiments. */ export type ExperimentPostMethodology = ClosedEnum< typeof ExperimentPostMethodology >; /** * The source of metric data in order to analyze results. Defaults to "launchdarkly" when not provided. */ export const ExperimentPostDataSource = { Launchdarkly: "launchdarkly", Snowflake: "snowflake", } as const; /** * The source of metric data in order to analyze results. Defaults to "launchdarkly" when not provided. */ export type ExperimentPostDataSource = ClosedEnum< typeof ExperimentPostDataSource >; /** * The type of experiment. */ export const ExperimentPostType = { Experiment: "experiment", Mab: "mab", Holdout: "holdout", } as const; /** * The type of experiment. */ export type ExperimentPostType = ClosedEnum<typeof ExperimentPostType>; export type ExperimentPost = { /** * The experiment name */ name: string; /** * The experiment description */ description?: string | undefined; /** * The ID of the member who maintains this experiment */ maintainerId?: string | undefined; /** * The experiment key */ key: string; iteration: IterationInput; /** * The ID of the holdout */ holdoutId?: string | undefined; /** * Tags for the experiment */ tags?: Array<string> | undefined; /** * The results analysis approach. Defaults to "frequentist" when not provided, or "bayesian" for multi-armed bandit experiments. */ methodology?: ExperimentPostMethodology | undefined; analysisConfig?: AnalysisConfigInput | undefined; /** * The source of metric data in order to analyze results. Defaults to "launchdarkly" when not provided. */ dataSource?: ExperimentPostDataSource | undefined; /** * The type of experiment. */ type?: ExperimentPostType | undefined; }; /** @internal */ export const ExperimentPostMethodology$inboundSchema: z.ZodNativeEnum< typeof ExperimentPostMethodology > = z.nativeEnum(ExperimentPostMethodology); /** @internal */ export const ExperimentPostMethodology$outboundSchema: z.ZodNativeEnum< typeof ExperimentPostMethodology > = ExperimentPostMethodology$inboundSchema; /** @internal */ export const ExperimentPostDataSource$inboundSchema: z.ZodNativeEnum< typeof ExperimentPostDataSource > = z.nativeEnum(ExperimentPostDataSource); /** @internal */ export const ExperimentPostDataSource$outboundSchema: z.ZodNativeEnum< typeof ExperimentPostDataSource > = ExperimentPostDataSource$inboundSchema; /** @internal */ export const ExperimentPostType$inboundSchema: z.ZodNativeEnum< typeof ExperimentPostType > = z.nativeEnum(ExperimentPostType); /** @internal */ export const ExperimentPostType$outboundSchema: z.ZodNativeEnum< typeof ExperimentPostType > = ExperimentPostType$inboundSchema; /** @internal */ export const ExperimentPost$inboundSchema: z.ZodType< ExperimentPost, z.ZodTypeDef, unknown > = z.object({ name: z.string(), description: z.string().optional(), maintainerId: z.string().optional(), key: z.string(), iteration: IterationInput$inboundSchema, holdoutId: z.string().optional(), tags: z.array(z.string()).optional(), methodology: ExperimentPostMethodology$inboundSchema.optional(), analysisConfig: AnalysisConfigInput$inboundSchema.optional(), dataSource: ExperimentPostDataSource$inboundSchema.optional(), type: ExperimentPostType$inboundSchema.optional(), }); /** @internal */ export type ExperimentPost$Outbound = { name: string; description?: string | undefined; maintainerId?: string | undefined; key: string; iteration: IterationInput$Outbound; holdoutId?: string | undefined; tags?: Array<string> | undefined; methodology?: string | undefined; analysisConfig?: AnalysisConfigInput$Outbound | undefined; dataSource?: string | undefined; type?: string | undefined; }; /** @internal */ export const ExperimentPost$outboundSchema: z.ZodType< ExperimentPost$Outbound, z.ZodTypeDef, ExperimentPost > = z.object({ name: z.string(), description: z.string().optional(), maintainerId: z.string().optional(), key: z.string(), iteration: IterationInput$outboundSchema, holdoutId: z.string().optional(), tags: z.array(z.string()).optional(), methodology: ExperimentPostMethodology$outboundSchema.optional(), analysisConfig: AnalysisConfigInput$outboundSchema.optional(), dataSource: ExperimentPostDataSource$outboundSchema.optional(), type: ExperimentPostType$outboundSchema.optional(), }); export function experimentPostToJSON(experimentPost: ExperimentPost): string { return JSON.stringify(ExperimentPost$outboundSchema.parse(experimentPost)); } export function experimentPostFromJSON( jsonString: string, ): SafeParseResult<ExperimentPost, SDKValidationError> { return safeParse( jsonString, (x) => ExperimentPost$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExperimentPost' from JSON`, ); }