UNPKG

@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.

191 lines (185 loc) • 5.43 kB
/* * 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 { Access, Access$inboundSchema, Access$Outbound, Access$outboundSchema, } from "./access.js"; import { ApprovalSettings, ApprovalSettings$inboundSchema, ApprovalSettings$Outbound, ApprovalSettings$outboundSchema, } from "./approvalsettings.js"; import { Link, Link$inboundSchema, Link$Outbound, Link$outboundSchema, } from "./link.js"; export type Environment = { /** * The location and content type of related resources */ links: { [k: string]: Link }; /** * The ID for the environment. Use this as the client-side ID for authorization in some client-side SDKs, and to associate LaunchDarkly environments with CDN integrations in edge SDKs. */ id: string; /** * A project-unique key for the new environment */ key: string; /** * A human-friendly name for the new environment */ name: string; /** * The SDK key for the environment. Use this for authorization in server-side SDKs. */ apiKey: string; /** * The mobile key for the environment. Use this for authorization in mobile SDKs. */ mobileKey: string; /** * The color used to indicate this environment in the UI */ color: string; /** * The default time (in minutes) that the PHP SDK can cache feature flag rules locally */ defaultTtl: number; /** * Ensures that one end user of the client-side SDK cannot inspect the variations for another end user */ secureMode: boolean; access?: Access | undefined; /** * The initial value of trackEvents for flags created in this environment. Does not affect existing flags. Required for Data Export, but doesn't enable Data Export on its own. */ defaultTrackEvents: boolean; /** * Whether members who modify flags and segments through the LaunchDarkly user interface are required to add a comment */ requireComments: boolean; /** * Whether members who modify flags and segments through the LaunchDarkly user interface are required to confirm those changes */ confirmChanges: boolean; /** * A list of tags for this environment */ tags: Array<string>; approvalSettings?: ApprovalSettings | undefined; /** * Details about the approval settings for other resources in this environment, organized by resource kind (for example, "aiconfig" and "segment") */ resourceApprovalSettings?: { [k: string]: ApprovalSettings } | undefined; /** * Whether the environment is critical */ critical: boolean; }; /** @internal */ export const Environment$inboundSchema: z.ZodType< Environment, z.ZodTypeDef, unknown > = z.object({ _links: z.record(Link$inboundSchema), _id: z.string(), key: z.string(), name: z.string(), apiKey: z.string(), mobileKey: z.string(), color: z.string(), defaultTtl: z.number().int(), secureMode: z.boolean(), _access: Access$inboundSchema.optional(), defaultTrackEvents: z.boolean(), requireComments: z.boolean(), confirmChanges: z.boolean(), tags: z.array(z.string()), approvalSettings: ApprovalSettings$inboundSchema.optional(), resourceApprovalSettings: z.record(ApprovalSettings$inboundSchema).optional(), critical: z.boolean(), }).transform((v) => { return remap$(v, { "_links": "links", "_id": "id", "_access": "access", }); }); /** @internal */ export type Environment$Outbound = { _links: { [k: string]: Link$Outbound }; _id: string; key: string; name: string; apiKey: string; mobileKey: string; color: string; defaultTtl: number; secureMode: boolean; _access?: Access$Outbound | undefined; defaultTrackEvents: boolean; requireComments: boolean; confirmChanges: boolean; tags: Array<string>; approvalSettings?: ApprovalSettings$Outbound | undefined; resourceApprovalSettings?: | { [k: string]: ApprovalSettings$Outbound } | undefined; critical: boolean; }; /** @internal */ export const Environment$outboundSchema: z.ZodType< Environment$Outbound, z.ZodTypeDef, Environment > = z.object({ links: z.record(Link$outboundSchema), id: z.string(), key: z.string(), name: z.string(), apiKey: z.string(), mobileKey: z.string(), color: z.string(), defaultTtl: z.number().int(), secureMode: z.boolean(), access: Access$outboundSchema.optional(), defaultTrackEvents: z.boolean(), requireComments: z.boolean(), confirmChanges: z.boolean(), tags: z.array(z.string()), approvalSettings: ApprovalSettings$outboundSchema.optional(), resourceApprovalSettings: z.record(ApprovalSettings$outboundSchema) .optional(), critical: z.boolean(), }).transform((v) => { return remap$(v, { links: "_links", id: "_id", access: "_access", }); }); export function environmentToJSON(environment: Environment): string { return JSON.stringify(Environment$outboundSchema.parse(environment)); } export function environmentFromJSON( jsonString: string, ): SafeParseResult<Environment, SDKValidationError> { return safeParse( jsonString, (x) => Environment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Environment' from JSON`, ); }