@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.
95 lines (87 loc) • 2.29 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";
/**
* Status of the flag
*/
export const Name = {
New: "new",
Inactive: "inactive",
Active: "active",
Launched: "launched",
} as const;
/**
* Status of the flag
*/
export type Name = ClosedEnum<typeof Name>;
export type FeatureFlagStatus = {
/**
* Status of the flag
*/
name: Name;
/**
* Timestamp of last time flag was requested
*/
lastRequested?: Date | null | undefined;
/**
* Default value seen from code
*/
default?: any | undefined;
};
/** @internal */
export const Name$inboundSchema: z.ZodNativeEnum<typeof Name> = z.nativeEnum(
Name,
);
/** @internal */
export const Name$outboundSchema: z.ZodNativeEnum<typeof Name> =
Name$inboundSchema;
/** @internal */
export const FeatureFlagStatus$inboundSchema: z.ZodType<
FeatureFlagStatus,
z.ZodTypeDef,
unknown
> = z.object({
name: Name$inboundSchema,
lastRequested: z.nullable(
z.string().datetime({ offset: true }).transform(v => new Date(v)),
).optional(),
default: z.any().optional(),
});
/** @internal */
export type FeatureFlagStatus$Outbound = {
name: string;
lastRequested?: string | null | undefined;
default?: any | undefined;
};
/** @internal */
export const FeatureFlagStatus$outboundSchema: z.ZodType<
FeatureFlagStatus$Outbound,
z.ZodTypeDef,
FeatureFlagStatus
> = z.object({
name: Name$outboundSchema,
lastRequested: z.nullable(z.date().transform(v => v.toISOString()))
.optional(),
default: z.any().optional(),
});
export function featureFlagStatusToJSON(
featureFlagStatus: FeatureFlagStatus,
): string {
return JSON.stringify(
FeatureFlagStatus$outboundSchema.parse(featureFlagStatus),
);
}
export function featureFlagStatusFromJSON(
jsonString: string,
): SafeParseResult<FeatureFlagStatus, SDKValidationError> {
return safeParse(
jsonString,
(x) => FeatureFlagStatus$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'FeatureFlagStatus' from JSON`,
);
}