@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.
98 lines (92 loc) • 2.77 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 {
Link,
Link$inboundSchema,
Link$Outbound,
Link$outboundSchema,
} from "./link.js";
export type FlagRep = {
/**
* The targeting rule
*/
targetingRule?: string | undefined;
/**
* The rule description
*/
targetingRuleDescription?: string | undefined;
/**
* An array of clauses used for individual targeting based on attributes
*/
targetingRuleClauses?: Array<any> | undefined;
/**
* The flag version
*/
flagConfigVersion?: number | undefined;
/**
* The ID of the variation to route traffic not part of the experiment analysis to
*/
notInExperimentVariationId?: string | undefined;
/**
* The location and content type of related resources
*/
links: { [k: string]: Link };
};
/** @internal */
export const FlagRep$inboundSchema: z.ZodType<FlagRep, z.ZodTypeDef, unknown> =
z.object({
targetingRule: z.string().optional(),
targetingRuleDescription: z.string().optional(),
targetingRuleClauses: z.array(z.any()).optional(),
flagConfigVersion: z.number().int().optional(),
notInExperimentVariationId: z.string().optional(),
_links: z.record(Link$inboundSchema),
}).transform((v) => {
return remap$(v, {
"_links": "links",
});
});
/** @internal */
export type FlagRep$Outbound = {
targetingRule?: string | undefined;
targetingRuleDescription?: string | undefined;
targetingRuleClauses?: Array<any> | undefined;
flagConfigVersion?: number | undefined;
notInExperimentVariationId?: string | undefined;
_links: { [k: string]: Link$Outbound };
};
/** @internal */
export const FlagRep$outboundSchema: z.ZodType<
FlagRep$Outbound,
z.ZodTypeDef,
FlagRep
> = z.object({
targetingRule: z.string().optional(),
targetingRuleDescription: z.string().optional(),
targetingRuleClauses: z.array(z.any()).optional(),
flagConfigVersion: z.number().int().optional(),
notInExperimentVariationId: z.string().optional(),
links: z.record(Link$outboundSchema),
}).transform((v) => {
return remap$(v, {
links: "_links",
});
});
export function flagRepToJSON(flagRep: FlagRep): string {
return JSON.stringify(FlagRep$outboundSchema.parse(flagRep));
}
export function flagRepFromJSON(
jsonString: string,
): SafeParseResult<FlagRep, SDKValidationError> {
return safeParse(
jsonString,
(x) => FlagRep$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'FlagRep' from JSON`,
);
}