@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.
90 lines (84 loc) • 2.27 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 TokenSummary = {
links?: { [k: string]: Link } | undefined;
id?: string | undefined;
/**
* The name of the token
*/
name?: string | undefined;
/**
* The last few characters of the token
*/
ending?: string | undefined;
/**
* Whether this is a service token
*/
serviceToken?: boolean | undefined;
};
/** @internal */
export const TokenSummary$inboundSchema: z.ZodType<
TokenSummary,
z.ZodTypeDef,
unknown
> = z.object({
_links: z.record(Link$inboundSchema).optional(),
_id: z.string().optional(),
name: z.string().optional(),
ending: z.string().optional(),
serviceToken: z.boolean().optional(),
}).transform((v) => {
return remap$(v, {
"_links": "links",
"_id": "id",
});
});
/** @internal */
export type TokenSummary$Outbound = {
_links?: { [k: string]: Link$Outbound } | undefined;
_id?: string | undefined;
name?: string | undefined;
ending?: string | undefined;
serviceToken?: boolean | undefined;
};
/** @internal */
export const TokenSummary$outboundSchema: z.ZodType<
TokenSummary$Outbound,
z.ZodTypeDef,
TokenSummary
> = z.object({
links: z.record(Link$outboundSchema).optional(),
id: z.string().optional(),
name: z.string().optional(),
ending: z.string().optional(),
serviceToken: z.boolean().optional(),
}).transform((v) => {
return remap$(v, {
links: "_links",
id: "_id",
});
});
export function tokenSummaryToJSON(tokenSummary: TokenSummary): string {
return JSON.stringify(TokenSummary$outboundSchema.parse(tokenSummary));
}
export function tokenSummaryFromJSON(
jsonString: string,
): SafeParseResult<TokenSummary, SDKValidationError> {
return safeParse(
jsonString,
(x) => TokenSummary$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'TokenSummary' from JSON`,
);
}