@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.
93 lines (87 loc) • 2.5 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 {
FeatureFlag,
FeatureFlag$inboundSchema,
FeatureFlag$Outbound,
FeatureFlag$outboundSchema,
} from "./featureflag.js";
import {
Link,
Link$inboundSchema,
Link$Outbound,
Link$outboundSchema,
} from "./link.js";
export type FeatureFlags = {
/**
* An array of feature flags
*/
items: Array<FeatureFlag>;
/**
* The location and content type of related resources
*/
links: { [k: string]: Link };
/**
* The total number of flags
*/
totalCount?: number | undefined;
/**
* The number of flags that have differences between environments. Only shown when query parameter <code>compare</code> is <code>true</code>.
*/
totalCountWithDifferences?: number | undefined;
};
/** @internal */
export const FeatureFlags$inboundSchema: z.ZodType<
FeatureFlags,
z.ZodTypeDef,
unknown
> = z.object({
items: z.array(FeatureFlag$inboundSchema),
_links: z.record(Link$inboundSchema),
totalCount: z.number().int().optional(),
totalCountWithDifferences: z.number().int().optional(),
}).transform((v) => {
return remap$(v, {
"_links": "links",
});
});
/** @internal */
export type FeatureFlags$Outbound = {
items: Array<FeatureFlag$Outbound>;
_links: { [k: string]: Link$Outbound };
totalCount?: number | undefined;
totalCountWithDifferences?: number | undefined;
};
/** @internal */
export const FeatureFlags$outboundSchema: z.ZodType<
FeatureFlags$Outbound,
z.ZodTypeDef,
FeatureFlags
> = z.object({
items: z.array(FeatureFlag$outboundSchema),
links: z.record(Link$outboundSchema),
totalCount: z.number().int().optional(),
totalCountWithDifferences: z.number().int().optional(),
}).transform((v) => {
return remap$(v, {
links: "_links",
});
});
export function featureFlagsToJSON(featureFlags: FeatureFlags): string {
return JSON.stringify(FeatureFlags$outboundSchema.parse(featureFlags));
}
export function featureFlagsFromJSON(
jsonString: string,
): SafeParseResult<FeatureFlags, SDKValidationError> {
return safeParse(
jsonString,
(x) => FeatureFlags$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'FeatureFlags' from JSON`,
);
}