@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.
225 lines (217 loc) • 6.3 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { remap as remap$ } from "../../lib/primitives.js";
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 {
AIConfigDependency,
AIConfigDependency$inboundSchema,
AIConfigDependency$Outbound,
AIConfigDependency$outboundSchema,
} from "./aiconfigdependency.js";
import {
AIConfigMaintainer,
AIConfigMaintainer$inboundSchema,
AIConfigMaintainer$Outbound,
AIConfigMaintainer$outboundSchema,
} from "./aiconfigmaintainer.js";
import {
AiConfigsAccess,
AiConfigsAccess$inboundSchema,
AiConfigsAccess$Outbound,
AiConfigsAccess$outboundSchema,
} from "./aiconfigsaccess.js";
import {
AIConfigVariation,
AIConfigVariation$inboundSchema,
AIConfigVariation$Outbound,
AIConfigVariation$outboundSchema,
} from "./aiconfigvariation.js";
import {
CoreLink,
CoreLink$inboundSchema,
CoreLink$Outbound,
CoreLink$outboundSchema,
} from "./corelink.js";
import {
ParentAndSelfLinks,
ParentAndSelfLinks$inboundSchema,
ParentAndSelfLinks$Outbound,
ParentAndSelfLinks$outboundSchema,
} from "./parentandselflinks.js";
/**
* The AI Config mode
*/
export const AIConfigMode = {
Agent: "agent",
Completion: "completion",
Judge: "judge",
} as const;
/**
* The AI Config mode
*/
export type AIConfigMode = ClosedEnum<typeof AIConfigMode>;
export type AIConfig = {
access?: AiConfigsAccess | undefined;
/**
* The location and content type of related resources
*/
links?: ParentAndSelfLinks | undefined;
site?: CoreLink | undefined;
/**
* A description of the AI Config
*/
description: string;
/**
* The AI Config key
*/
key: string;
/**
* The member or team that maintains this resource
*/
maintainer?: AIConfigMaintainer | undefined;
/**
* The AI Config mode
*/
mode?: AIConfigMode | undefined;
/**
* The AI Config name
*/
name: string;
/**
* Tags for this resource
*/
tags: Array<string>;
/**
* The version number of this resource
*/
version: number;
/**
* The variations of this AI Config
*/
variations: Array<AIConfigVariation>;
createdAt: number;
updatedAt: number;
/**
* Evaluation metric key for this config
*/
evaluationMetricKey?: string | undefined;
/**
* List of evaluation metric keys for this config
*
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
*/
evaluationMetricKeys?: Array<string> | undefined;
/**
* Whether the evaluation metric is inverted, meaning a lower value is better if set as true
*/
isInverted?: boolean | undefined;
/**
* Resources that depend on this config, grouped by type
*/
dependencies?: Array<AIConfigDependency> | undefined;
};
/** @internal */
export const AIConfigMode$inboundSchema: z.ZodNativeEnum<typeof AIConfigMode> =
z.nativeEnum(AIConfigMode);
/** @internal */
export const AIConfigMode$outboundSchema: z.ZodNativeEnum<typeof AIConfigMode> =
AIConfigMode$inboundSchema;
/** @internal */
export const AIConfig$inboundSchema: z.ZodType<
AIConfig,
z.ZodTypeDef,
unknown
> = z.object({
_access: AiConfigsAccess$inboundSchema.optional(),
_links: ParentAndSelfLinks$inboundSchema.optional(),
_site: CoreLink$inboundSchema.optional(),
description: z.string(),
key: z.string(),
_maintainer: AIConfigMaintainer$inboundSchema.optional(),
mode: AIConfigMode$inboundSchema.default("completion"),
name: z.string(),
tags: z.array(z.string()),
version: z.number().int(),
variations: z.array(AIConfigVariation$inboundSchema),
createdAt: z.number().int(),
updatedAt: z.number().int(),
evaluationMetricKey: z.string().optional(),
evaluationMetricKeys: z.array(z.string()).optional(),
isInverted: z.boolean().optional(),
dependencies: z.array(AIConfigDependency$inboundSchema).optional(),
}).transform((v) => {
return remap$(v, {
"_access": "access",
"_links": "links",
"_site": "site",
"_maintainer": "maintainer",
});
});
/** @internal */
export type AIConfig$Outbound = {
_access?: AiConfigsAccess$Outbound | undefined;
_links?: ParentAndSelfLinks$Outbound | undefined;
_site?: CoreLink$Outbound | undefined;
description: string;
key: string;
_maintainer?: AIConfigMaintainer$Outbound | undefined;
mode: string;
name: string;
tags: Array<string>;
version: number;
variations: Array<AIConfigVariation$Outbound>;
createdAt: number;
updatedAt: number;
evaluationMetricKey?: string | undefined;
evaluationMetricKeys?: Array<string> | undefined;
isInverted?: boolean | undefined;
dependencies?: Array<AIConfigDependency$Outbound> | undefined;
};
/** @internal */
export const AIConfig$outboundSchema: z.ZodType<
AIConfig$Outbound,
z.ZodTypeDef,
AIConfig
> = z.object({
access: AiConfigsAccess$outboundSchema.optional(),
links: ParentAndSelfLinks$outboundSchema.optional(),
site: CoreLink$outboundSchema.optional(),
description: z.string(),
key: z.string(),
maintainer: AIConfigMaintainer$outboundSchema.optional(),
mode: AIConfigMode$outboundSchema.default("completion"),
name: z.string(),
tags: z.array(z.string()),
version: z.number().int(),
variations: z.array(AIConfigVariation$outboundSchema),
createdAt: z.number().int(),
updatedAt: z.number().int(),
evaluationMetricKey: z.string().optional(),
evaluationMetricKeys: z.array(z.string()).optional(),
isInverted: z.boolean().optional(),
dependencies: z.array(AIConfigDependency$outboundSchema).optional(),
}).transform((v) => {
return remap$(v, {
access: "_access",
links: "_links",
site: "_site",
maintainer: "_maintainer",
});
});
export function aiConfigToJSON(aiConfig: AIConfig): string {
return JSON.stringify(AIConfig$outboundSchema.parse(aiConfig));
}
export function aiConfigFromJSON(
jsonString: string,
): SafeParseResult<AIConfig, SDKValidationError> {
return safeParse(
jsonString,
(x) => AIConfig$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AIConfig' from JSON`,
);
}