@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.
84 lines (76 loc) • 2.19 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";
export const ClassifierType = {
Bool: "bool",
Float: "float",
Enum: "enum",
} as const;
export type ClassifierType = ClosedEnum<typeof ClassifierType>;
export type Classifier = {
key: string;
type: ClassifierType;
instructions: string;
/**
* Type-specific criteria. An enum classifier uses a map of option keys to descriptions.
*
* @remarks
* A float classifier uses an ordered list of level labels. A bool classifier uses optional
* true and false descriptions.
*/
criteria?: any | undefined;
};
/** @internal */
export const ClassifierType$inboundSchema: z.ZodNativeEnum<
typeof ClassifierType
> = z.nativeEnum(ClassifierType);
/** @internal */
export const ClassifierType$outboundSchema: z.ZodNativeEnum<
typeof ClassifierType
> = ClassifierType$inboundSchema;
/** @internal */
export const Classifier$inboundSchema: z.ZodType<
Classifier,
z.ZodTypeDef,
unknown
> = z.object({
key: z.string(),
type: ClassifierType$inboundSchema,
instructions: z.string(),
criteria: z.any().optional(),
});
/** @internal */
export type Classifier$Outbound = {
key: string;
type: string;
instructions: string;
criteria?: any | undefined;
};
/** @internal */
export const Classifier$outboundSchema: z.ZodType<
Classifier$Outbound,
z.ZodTypeDef,
Classifier
> = z.object({
key: z.string(),
type: ClassifierType$outboundSchema,
instructions: z.string(),
criteria: z.any().optional(),
});
export function classifierToJSON(classifier: Classifier): string {
return JSON.stringify(Classifier$outboundSchema.parse(classifier));
}
export function classifierFromJSON(
jsonString: string,
): SafeParseResult<Classifier, SDKValidationError> {
return safeParse(
jsonString,
(x) => Classifier$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Classifier' from JSON`,
);
}