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.

138 lines (132 loc) • 4.4 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Filter, Filter$inboundSchema, Filter$Outbound, Filter$outboundSchema, } from "./filter.js"; import { MetricDataSourceRefRep, MetricDataSourceRefRep$inboundSchema, MetricDataSourceRefRep$Outbound, MetricDataSourceRefRep$outboundSchema, } from "./metricdatasourcerefrep.js"; export type MetricDenominatorRep = { /** * The warehouse event column for the denominator */ eventName?: string | undefined; /** * Whether the denominator aggregates a numeric value */ isNumeric?: boolean | undefined; /** * How individual unit values are aggregated for the denominator */ unitAggregationType?: string | undefined; /** * The column to count distinct values of; required when unitAggregationType is count_distinct */ unitAggregationField?: string | undefined; /** * For a numeric denominator, the column holding the numeric value */ valueColumn?: string | undefined; dataSource?: MetricDataSourceRefRep | undefined; filters?: Filter | undefined; /** * Start of the measurement window in milliseconds */ windowStartOffset?: number | undefined; /** * End of the measurement window in milliseconds */ windowEndOffset?: number | undefined; /** * Lower winsorization percentile in the open interval (0, 100) */ winsorLowerPercentile?: number | undefined; /** * Upper winsorization percentile in the open interval (0, 100) */ winsorUpperPercentile?: number | undefined; /** * When true, the percentile bound calculation includes imputed zeros */ winsorIncludeImputed?: boolean | undefined; }; /** @internal */ export const MetricDenominatorRep$inboundSchema: z.ZodType< MetricDenominatorRep, z.ZodTypeDef, unknown > = z.object({ eventName: z.string().optional(), isNumeric: z.boolean().optional(), unitAggregationType: z.string().optional(), unitAggregationField: z.string().optional(), valueColumn: z.string().optional(), dataSource: MetricDataSourceRefRep$inboundSchema.optional(), filters: Filter$inboundSchema.optional(), windowStartOffset: z.number().int().optional(), windowEndOffset: z.number().int().optional(), winsorLowerPercentile: z.number().optional(), winsorUpperPercentile: z.number().optional(), winsorIncludeImputed: z.boolean().optional(), }); /** @internal */ export type MetricDenominatorRep$Outbound = { eventName?: string | undefined; isNumeric?: boolean | undefined; unitAggregationType?: string | undefined; unitAggregationField?: string | undefined; valueColumn?: string | undefined; dataSource?: MetricDataSourceRefRep$Outbound | undefined; filters?: Filter$Outbound | undefined; windowStartOffset?: number | undefined; windowEndOffset?: number | undefined; winsorLowerPercentile?: number | undefined; winsorUpperPercentile?: number | undefined; winsorIncludeImputed?: boolean | undefined; }; /** @internal */ export const MetricDenominatorRep$outboundSchema: z.ZodType< MetricDenominatorRep$Outbound, z.ZodTypeDef, MetricDenominatorRep > = z.object({ eventName: z.string().optional(), isNumeric: z.boolean().optional(), unitAggregationType: z.string().optional(), unitAggregationField: z.string().optional(), valueColumn: z.string().optional(), dataSource: MetricDataSourceRefRep$outboundSchema.optional(), filters: Filter$outboundSchema.optional(), windowStartOffset: z.number().int().optional(), windowEndOffset: z.number().int().optional(), winsorLowerPercentile: z.number().optional(), winsorUpperPercentile: z.number().optional(), winsorIncludeImputed: z.boolean().optional(), }); export function metricDenominatorRepToJSON( metricDenominatorRep: MetricDenominatorRep, ): string { return JSON.stringify( MetricDenominatorRep$outboundSchema.parse(metricDenominatorRep), ); } export function metricDenominatorRepFromJSON( jsonString: string, ): SafeParseResult<MetricDenominatorRep, SDKValidationError> { return safeParse( jsonString, (x) => MetricDenominatorRep$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MetricDenominatorRep' from JSON`, ); }