@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.
86 lines (80 loc) • 2.19 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 { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
Environment,
Environment$inboundSchema,
Environment$Outbound,
Environment$outboundSchema,
} from "./environment.js";
import {
Link,
Link$inboundSchema,
Link$Outbound,
Link$outboundSchema,
} from "./link.js";
export type Environments = {
/**
* The location and content type of related resources
*/
links?: { [k: string]: Link } | undefined;
/**
* The number of environments returned
*/
totalCount?: number | undefined;
/**
* An array of environments
*/
items: Array<Environment>;
};
/** @internal */
export const Environments$inboundSchema: z.ZodType<
Environments,
z.ZodTypeDef,
unknown
> = z.object({
_links: z.record(Link$inboundSchema).optional(),
totalCount: z.number().int().optional(),
items: z.array(Environment$inboundSchema),
}).transform((v) => {
return remap$(v, {
"_links": "links",
});
});
/** @internal */
export type Environments$Outbound = {
_links?: { [k: string]: Link$Outbound } | undefined;
totalCount?: number | undefined;
items: Array<Environment$Outbound>;
};
/** @internal */
export const Environments$outboundSchema: z.ZodType<
Environments$Outbound,
z.ZodTypeDef,
Environments
> = z.object({
links: z.record(Link$outboundSchema).optional(),
totalCount: z.number().int().optional(),
items: z.array(Environment$outboundSchema),
}).transform((v) => {
return remap$(v, {
links: "_links",
});
});
export function environmentsToJSON(environments: Environments): string {
return JSON.stringify(Environments$outboundSchema.parse(environments));
}
export function environmentsFromJSON(
jsonString: string,
): SafeParseResult<Environments, SDKValidationError> {
return safeParse(
jsonString,
(x) => Environments$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Environments' from JSON`,
);
}