@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.
108 lines (100 loc) • 2.92 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
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";
/**
* Filter type. One of [contextAttribute, eventProperty, group]
*/
export const AiConfigsFilterType = {
Group: "group",
ContextAttribute: "contextAttribute",
EventProperty: "eventProperty",
} as const;
/**
* Filter type. One of [contextAttribute, eventProperty, group]
*/
export type AiConfigsFilterType = ClosedEnum<typeof AiConfigsFilterType>;
export type AiConfigsFilter = {
/**
* Filter type. One of [contextAttribute, eventProperty, group]
*/
type: AiConfigsFilterType;
/**
* If not a group node, the context attribute name or event property name to filter on
*/
attribute?: string | undefined;
op: string;
/**
* The context attribute / event property values or group member nodes
*/
values: Array<any>;
/**
* For context attribute filters, the context kind.
*/
contextKind?: string | undefined;
/**
* If set, then take the inverse of the operator. 'in' becomes 'not in'.
*/
negate: boolean;
};
/** @internal */
export const AiConfigsFilterType$inboundSchema: z.ZodNativeEnum<
typeof AiConfigsFilterType
> = z.nativeEnum(AiConfigsFilterType);
/** @internal */
export const AiConfigsFilterType$outboundSchema: z.ZodNativeEnum<
typeof AiConfigsFilterType
> = AiConfigsFilterType$inboundSchema;
/** @internal */
export const AiConfigsFilter$inboundSchema: z.ZodType<
AiConfigsFilter,
z.ZodTypeDef,
unknown
> = z.object({
type: AiConfigsFilterType$inboundSchema,
attribute: z.string().optional(),
op: z.string(),
values: z.array(z.any()),
contextKind: z.string().optional(),
negate: z.boolean(),
});
/** @internal */
export type AiConfigsFilter$Outbound = {
type: string;
attribute?: string | undefined;
op: string;
values: Array<any>;
contextKind?: string | undefined;
negate: boolean;
};
/** @internal */
export const AiConfigsFilter$outboundSchema: z.ZodType<
AiConfigsFilter$Outbound,
z.ZodTypeDef,
AiConfigsFilter
> = z.object({
type: AiConfigsFilterType$outboundSchema,
attribute: z.string().optional(),
op: z.string(),
values: z.array(z.any()),
contextKind: z.string().optional(),
negate: z.boolean(),
});
export function aiConfigsFilterToJSON(
aiConfigsFilter: AiConfigsFilter,
): string {
return JSON.stringify(AiConfigsFilter$outboundSchema.parse(aiConfigsFilter));
}
export function aiConfigsFilterFromJSON(
jsonString: string,
): SafeParseResult<AiConfigsFilter, SDKValidationError> {
return safeParse(
jsonString,
(x) => AiConfigsFilter$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AiConfigsFilter' from JSON`,
);
}