@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.
147 lines (139 loc) • 4.1 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 { ClosedEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
AIConfigVariationPost,
AIConfigVariationPost$inboundSchema,
AIConfigVariationPost$Outbound,
AIConfigVariationPost$outboundSchema,
} from "./aiconfigvariationpost.js";
/**
* The AI Config mode
*/
export const AIConfigPostMode = {
Agent: "agent",
Completion: "completion",
Judge: "judge",
} as const;
/**
* The AI Config mode
*/
export type AIConfigPostMode = ClosedEnum<typeof AIConfigPostMode>;
export type AIConfigPost = {
/**
* A description of the AI Config
*/
description?: string | undefined;
/**
* A unique key for the AI Config
*/
key: string;
/**
* The ID of the member who maintains this resource
*/
maintainerId?: string | undefined;
/**
* The key of the team that maintains this resource
*/
maintainerTeamKey?: string | undefined;
/**
* The AI Config mode
*/
mode?: AIConfigPostMode | undefined;
/**
* A human-readable name for the AI Config
*/
name: string;
/**
* Tags for this resource
*/
tags?: Array<string> | undefined;
/**
* Keys of the views to add the AI Config to
*/
viewKeys?: Array<string> | undefined;
defaultVariation?: AIConfigVariationPost | undefined;
/**
* Evaluation metric key for this config
*/
evaluationMetricKey?: string | undefined;
/**
* Whether the evaluation metric is inverted, meaning a lower value is better if set as true
*/
isInverted?: boolean | undefined;
};
/** @internal */
export const AIConfigPostMode$inboundSchema: z.ZodNativeEnum<
typeof AIConfigPostMode
> = z.nativeEnum(AIConfigPostMode);
/** @internal */
export const AIConfigPostMode$outboundSchema: z.ZodNativeEnum<
typeof AIConfigPostMode
> = AIConfigPostMode$inboundSchema;
/** @internal */
export const AIConfigPost$inboundSchema: z.ZodType<
AIConfigPost,
z.ZodTypeDef,
unknown
> = z.object({
description: z.string().default(""),
key: z.string(),
maintainerId: z.string().optional(),
maintainerTeamKey: z.string().optional(),
mode: AIConfigPostMode$inboundSchema.default("completion"),
name: z.string(),
tags: z.array(z.string()).optional(),
viewKeys: z.array(z.string()).optional(),
defaultVariation: AIConfigVariationPost$inboundSchema.optional(),
evaluationMetricKey: z.string().optional(),
isInverted: z.boolean().optional(),
});
/** @internal */
export type AIConfigPost$Outbound = {
description: string;
key: string;
maintainerId?: string | undefined;
maintainerTeamKey?: string | undefined;
mode: string;
name: string;
tags?: Array<string> | undefined;
viewKeys?: Array<string> | undefined;
defaultVariation?: AIConfigVariationPost$Outbound | undefined;
evaluationMetricKey?: string | undefined;
isInverted?: boolean | undefined;
};
/** @internal */
export const AIConfigPost$outboundSchema: z.ZodType<
AIConfigPost$Outbound,
z.ZodTypeDef,
AIConfigPost
> = z.object({
description: z.string().default(""),
key: z.string(),
maintainerId: z.string().optional(),
maintainerTeamKey: z.string().optional(),
mode: AIConfigPostMode$outboundSchema.default("completion"),
name: z.string(),
tags: z.array(z.string()).optional(),
viewKeys: z.array(z.string()).optional(),
defaultVariation: AIConfigVariationPost$outboundSchema.optional(),
evaluationMetricKey: z.string().optional(),
isInverted: z.boolean().optional(),
});
export function aiConfigPostToJSON(aiConfigPost: AIConfigPost): string {
return JSON.stringify(AIConfigPost$outboundSchema.parse(aiConfigPost));
}
export function aiConfigPostFromJSON(
jsonString: string,
): SafeParseResult<AIConfigPost, SDKValidationError> {
return safeParse(
jsonString,
(x) => AIConfigPost$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AIConfigPost' from JSON`,
);
}