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.

203 lines (193 loc) • 6.6 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 { ClosedEnum } from "../../types/enums.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"; import { MetricInGroupRep, MetricInGroupRep$inboundSchema, MetricInGroupRep$Outbound, MetricInGroupRep$outboundSchema, } from "./metricingrouprep.js"; /** * If this is a metric, then it represents the kind of event the metric tracks. If this is a metric group, then it represents the group type */ export const DependentMetricOrMetricGroupRepKind = { Pageview: "pageview", Click: "click", Custom: "custom", Trace: "trace", Funnel: "funnel", Standard: "standard", } as const; /** * If this is a metric, then it represents the kind of event the metric tracks. If this is a metric group, then it represents the group type */ export type DependentMetricOrMetricGroupRepKind = ClosedEnum< typeof DependentMetricOrMetricGroupRepKind >; /** * The method for analyzing metric events. Only set for individual metrics, not metric groups. */ export const DependentMetricOrMetricGroupRepAnalysisType = { Mean: "mean", Percentile: "percentile", } as const; /** * The method for analyzing metric events. Only set for individual metrics, not metric groups. */ export type DependentMetricOrMetricGroupRepAnalysisType = ClosedEnum< typeof DependentMetricOrMetricGroupRepAnalysisType >; export type DependentMetricOrMetricGroupRep = { /** * A unique key to reference the metric or metric group */ key: string; /** * The version ID of the metric or metric group */ versionId: string; /** * A human-friendly name for the metric or metric group */ name: string; /** * If this is a metric, then it represents the kind of event the metric tracks. If this is a metric group, then it represents the group type */ kind: DependentMetricOrMetricGroupRepKind; /** * For custom and trace metrics, whether to track numeric changes in value against a baseline (<code>true</code>) or to track a conversion when an end user takes an action (<code>false</code>). */ isNumeric?: boolean | undefined; /** * The event key sent with the metric. Only relevant for custom metrics. */ eventKey?: string | undefined; /** * The location and content type of related resources */ links: { [k: string]: Link }; /** * Whether this is a metric group or a metric */ isGroup: boolean; /** * An ordered list of the metrics in this metric group */ metrics?: Array<MetricInGroupRep> | undefined; /** * The method for analyzing metric events. Only set for individual metrics, not metric groups. */ analysisType?: DependentMetricOrMetricGroupRepAnalysisType | undefined; /** * The context kind chosen as the analysis unit for this metric in the iteration. If null, analysis uses the iteration's randomization unit. */ analysisUnit?: string | undefined; }; /** @internal */ export const DependentMetricOrMetricGroupRepKind$inboundSchema: z.ZodNativeEnum< typeof DependentMetricOrMetricGroupRepKind > = z.nativeEnum(DependentMetricOrMetricGroupRepKind); /** @internal */ export const DependentMetricOrMetricGroupRepKind$outboundSchema: z.ZodNativeEnum<typeof DependentMetricOrMetricGroupRepKind> = DependentMetricOrMetricGroupRepKind$inboundSchema; /** @internal */ export const DependentMetricOrMetricGroupRepAnalysisType$inboundSchema: z.ZodNativeEnum<typeof DependentMetricOrMetricGroupRepAnalysisType> = z .nativeEnum(DependentMetricOrMetricGroupRepAnalysisType); /** @internal */ export const DependentMetricOrMetricGroupRepAnalysisType$outboundSchema: z.ZodNativeEnum<typeof DependentMetricOrMetricGroupRepAnalysisType> = DependentMetricOrMetricGroupRepAnalysisType$inboundSchema; /** @internal */ export const DependentMetricOrMetricGroupRep$inboundSchema: z.ZodType< DependentMetricOrMetricGroupRep, z.ZodTypeDef, unknown > = z.object({ key: z.string(), _versionId: z.string(), name: z.string(), kind: DependentMetricOrMetricGroupRepKind$inboundSchema, isNumeric: z.boolean().optional(), eventKey: z.string().optional(), _links: z.record(Link$inboundSchema), isGroup: z.boolean(), metrics: z.array(MetricInGroupRep$inboundSchema).optional(), analysisType: DependentMetricOrMetricGroupRepAnalysisType$inboundSchema .optional(), analysisUnit: z.string().optional(), }).transform((v) => { return remap$(v, { "_versionId": "versionId", "_links": "links", }); }); /** @internal */ export type DependentMetricOrMetricGroupRep$Outbound = { key: string; _versionId: string; name: string; kind: string; isNumeric?: boolean | undefined; eventKey?: string | undefined; _links: { [k: string]: Link$Outbound }; isGroup: boolean; metrics?: Array<MetricInGroupRep$Outbound> | undefined; analysisType?: string | undefined; analysisUnit?: string | undefined; }; /** @internal */ export const DependentMetricOrMetricGroupRep$outboundSchema: z.ZodType< DependentMetricOrMetricGroupRep$Outbound, z.ZodTypeDef, DependentMetricOrMetricGroupRep > = z.object({ key: z.string(), versionId: z.string(), name: z.string(), kind: DependentMetricOrMetricGroupRepKind$outboundSchema, isNumeric: z.boolean().optional(), eventKey: z.string().optional(), links: z.record(Link$outboundSchema), isGroup: z.boolean(), metrics: z.array(MetricInGroupRep$outboundSchema).optional(), analysisType: DependentMetricOrMetricGroupRepAnalysisType$outboundSchema .optional(), analysisUnit: z.string().optional(), }).transform((v) => { return remap$(v, { versionId: "_versionId", links: "_links", }); }); export function dependentMetricOrMetricGroupRepToJSON( dependentMetricOrMetricGroupRep: DependentMetricOrMetricGroupRep, ): string { return JSON.stringify( DependentMetricOrMetricGroupRep$outboundSchema.parse( dependentMetricOrMetricGroupRep, ), ); } export function dependentMetricOrMetricGroupRepFromJSON( jsonString: string, ): SafeParseResult<DependentMetricOrMetricGroupRep, SDKValidationError> { return safeParse( jsonString, (x) => DependentMetricOrMetricGroupRep$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DependentMetricOrMetricGroupRep' from JSON`, ); }