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.

248 lines (240 loc) • 8.61 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 { CovariateInfoRep, CovariateInfoRep$inboundSchema, CovariateInfoRep$Outbound, CovariateInfoRep$outboundSchema, } from "./covariateinforep.js"; import { DependentMetricGroupRepWithMetrics, DependentMetricGroupRepWithMetrics$inboundSchema, DependentMetricGroupRepWithMetrics$Outbound, DependentMetricGroupRepWithMetrics$outboundSchema, } from "./dependentmetricgrouprepwithmetrics.js"; import { DependentMetricOrMetricGroupRep, DependentMetricOrMetricGroupRep$inboundSchema, DependentMetricOrMetricGroupRep$Outbound, DependentMetricOrMetricGroupRep$outboundSchema, } from "./dependentmetricormetricgrouprep.js"; import { FlagRep, FlagRep$inboundSchema, FlagRep$Outbound, FlagRep$outboundSchema, } from "./flagrep.js"; import { LayerSnapshotRep, LayerSnapshotRep$inboundSchema, LayerSnapshotRep$Outbound, LayerSnapshotRep$outboundSchema, } from "./layersnapshotrep.js"; import { MetricV2Rep, MetricV2Rep$inboundSchema, MetricV2Rep$Outbound, MetricV2Rep$outboundSchema, } from "./metricv2rep.js"; import { TreatmentRep, TreatmentRep$inboundSchema, TreatmentRep$Outbound, TreatmentRep$outboundSchema, } from "./treatmentrep.js"; /** * The status of the iteration: <code>not_started</code>, <code>running</code>, <code>stopped</code> */ export const Status = { NotStarted: "not_started", Running: "running", Stopped: "stopped", } as const; /** * The status of the iteration: <code>not_started</code>, <code>running</code>, <code>stopped</code> */ export type Status = ClosedEnum<typeof Status>; export type IterationRep = { /** * The iteration ID */ id?: string | undefined; /** * The expected outcome of this experiment */ hypothesis?: string | undefined; /** * The status of the iteration: <code>not_started</code>, <code>running</code>, <code>stopped</code> */ status: Status; createdAt: number; startedAt?: number | undefined; endedAt?: number | undefined; /** * The ID of the treatment chosen when the experiment stopped */ winningTreatmentId?: string | undefined; /** * The reason you stopped the experiment */ winningReason?: string | undefined; /** * Whether the experiment may reassign traffic to different variations when the experiment audience changes (true) or must keep all traffic assigned to its initial variation (false). */ canReshuffleTraffic?: boolean | undefined; /** * Details on the flag used in this experiment */ flags?: { [k: string]: FlagRep } | undefined; /** * The cadence (in milliseconds) to update the allocation. Only present for multi-armed bandits. */ reallocationFrequencyMillis?: number | undefined; /** * The current version that the iteration is on */ version?: number | undefined; primaryMetric?: DependentMetricOrMetricGroupRep | undefined; primarySingleMetric?: MetricV2Rep | undefined; primaryFunnel?: DependentMetricGroupRepWithMetrics | undefined; /** * The unit of randomization for this iteration */ randomizationUnit?: string | undefined; /** * The available attribute filters for this iteration */ attributes?: Array<string> | undefined; /** * Details on the variations you are testing in the experiment */ treatments?: Array<TreatmentRep> | undefined; /** * Deprecated, use <code>metrics</code> instead. Details on the secondary metrics for this experiment. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ secondaryMetrics?: Array<MetricV2Rep> | undefined; /** * Details on the metrics for this experiment */ metrics?: Array<DependentMetricOrMetricGroupRep> | undefined; layerSnapshot?: LayerSnapshotRep | undefined; covariateInfo?: CovariateInfoRep | undefined; }; /** @internal */ export const Status$inboundSchema: z.ZodNativeEnum<typeof Status> = z .nativeEnum(Status); /** @internal */ export const Status$outboundSchema: z.ZodNativeEnum<typeof Status> = Status$inboundSchema; /** @internal */ export const IterationRep$inboundSchema: z.ZodType< IterationRep, z.ZodTypeDef, unknown > = z.object({ _id: z.string().optional(), hypothesis: z.string().optional(), status: Status$inboundSchema, createdAt: z.number().int(), startedAt: z.number().int().optional(), endedAt: z.number().int().optional(), winningTreatmentId: z.string().optional(), winningReason: z.string().optional(), canReshuffleTraffic: z.boolean().optional(), flags: z.record(FlagRep$inboundSchema).optional(), reallocationFrequencyMillis: z.number().int().optional(), version: z.number().int().optional(), primaryMetric: DependentMetricOrMetricGroupRep$inboundSchema.optional(), primarySingleMetric: MetricV2Rep$inboundSchema.optional(), primaryFunnel: DependentMetricGroupRepWithMetrics$inboundSchema.optional(), randomizationUnit: z.string().optional(), attributes: z.array(z.string()).optional(), treatments: z.array(TreatmentRep$inboundSchema).optional(), secondaryMetrics: z.array(MetricV2Rep$inboundSchema).optional(), metrics: z.array(DependentMetricOrMetricGroupRep$inboundSchema).optional(), layerSnapshot: LayerSnapshotRep$inboundSchema.optional(), covariateInfo: CovariateInfoRep$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "_id": "id", }); }); /** @internal */ export type IterationRep$Outbound = { _id?: string | undefined; hypothesis?: string | undefined; status: string; createdAt: number; startedAt?: number | undefined; endedAt?: number | undefined; winningTreatmentId?: string | undefined; winningReason?: string | undefined; canReshuffleTraffic?: boolean | undefined; flags?: { [k: string]: FlagRep$Outbound } | undefined; reallocationFrequencyMillis?: number | undefined; version?: number | undefined; primaryMetric?: DependentMetricOrMetricGroupRep$Outbound | undefined; primarySingleMetric?: MetricV2Rep$Outbound | undefined; primaryFunnel?: DependentMetricGroupRepWithMetrics$Outbound | undefined; randomizationUnit?: string | undefined; attributes?: Array<string> | undefined; treatments?: Array<TreatmentRep$Outbound> | undefined; secondaryMetrics?: Array<MetricV2Rep$Outbound> | undefined; metrics?: Array<DependentMetricOrMetricGroupRep$Outbound> | undefined; layerSnapshot?: LayerSnapshotRep$Outbound | undefined; covariateInfo?: CovariateInfoRep$Outbound | undefined; }; /** @internal */ export const IterationRep$outboundSchema: z.ZodType< IterationRep$Outbound, z.ZodTypeDef, IterationRep > = z.object({ id: z.string().optional(), hypothesis: z.string().optional(), status: Status$outboundSchema, createdAt: z.number().int(), startedAt: z.number().int().optional(), endedAt: z.number().int().optional(), winningTreatmentId: z.string().optional(), winningReason: z.string().optional(), canReshuffleTraffic: z.boolean().optional(), flags: z.record(FlagRep$outboundSchema).optional(), reallocationFrequencyMillis: z.number().int().optional(), version: z.number().int().optional(), primaryMetric: DependentMetricOrMetricGroupRep$outboundSchema.optional(), primarySingleMetric: MetricV2Rep$outboundSchema.optional(), primaryFunnel: DependentMetricGroupRepWithMetrics$outboundSchema.optional(), randomizationUnit: z.string().optional(), attributes: z.array(z.string()).optional(), treatments: z.array(TreatmentRep$outboundSchema).optional(), secondaryMetrics: z.array(MetricV2Rep$outboundSchema).optional(), metrics: z.array(DependentMetricOrMetricGroupRep$outboundSchema).optional(), layerSnapshot: LayerSnapshotRep$outboundSchema.optional(), covariateInfo: CovariateInfoRep$outboundSchema.optional(), }).transform((v) => { return remap$(v, { id: "_id", }); }); export function iterationRepToJSON(iterationRep: IterationRep): string { return JSON.stringify(IterationRep$outboundSchema.parse(iterationRep)); } export function iterationRepFromJSON( jsonString: string, ): SafeParseResult<IterationRep, SDKValidationError> { return safeParse( jsonString, (x) => IterationRep$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IterationRep' from JSON`, ); }