/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { ClosedEnum } from "../../types/enums.js"; import * as z from "zod"; export type MetricSourceContractDtoIdTypeMapping = { /** * The identifier mapping for Statsig units. */ statsigUnitID: string; /** * The corresponding column name in the source that relates to the Statsig unit ID. */ column: string; }; /** * The type of source, indicating whether it is a database table or a custom query. */ export const MetricSourceContractDtoSourceType = { Table: "table", Query: "query", } as const; /** * The type of source, indicating whether it is a database table or a custom query. */ export type MetricSourceContractDtoSourceType = ClosedEnum< typeof MetricSourceContractDtoSourceType >; export type MetricSourceContractDtoCustomFieldMapping = { /** * The identifier for the custom field mapping. */ key: string; /** * The formula or expression used to compute the custom field value. */ formula: string; }; export type MetricSourceContractDto = { /** * The name of the metric source, serving as its primary identifier. */ name: string; /** * A detailed description of the metric source, providing context and usage information. */ description: string; /** * Optional tags for categorizing the metric source and improving searchability. */ tags?: Array | undefined; /** * The SQL query or statement used to extract data from the metric source. */ sql: string; /** * The name of the column containing timestamp data for the metric source. */ timestampColumn: string; /** * Indicates whether the timestamp should be treated as a day-level granularity. */ timestampAsDay?: boolean | undefined; /** * Array defining the mapping between Statsig unit IDs and their respective source columns. */ idTypeMapping: Array; /** * The type of source, indicating whether it is a database table or a custom query. */ sourceType?: MetricSourceContractDtoSourceType | undefined; /** * The name of the database table if the source type is "table". */ tableName?: string | undefined; /** * Optional array defining mappings for custom fields using specific formulas. */ customFieldMapping?: Array | undefined; }; /** @internal */ export const MetricSourceContractDtoIdTypeMapping$inboundSchema: z.ZodType< MetricSourceContractDtoIdTypeMapping, z.ZodTypeDef, unknown > = z.object({ statsigUnitID: z.string(), column: z.string(), }); /** @internal */ export type MetricSourceContractDtoIdTypeMapping$Outbound = { statsigUnitID: string; column: string; }; /** @internal */ export const MetricSourceContractDtoIdTypeMapping$outboundSchema: z.ZodType< MetricSourceContractDtoIdTypeMapping$Outbound, z.ZodTypeDef, MetricSourceContractDtoIdTypeMapping > = z.object({ statsigUnitID: z.string(), column: z.string(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace MetricSourceContractDtoIdTypeMapping$ { /** @deprecated use `MetricSourceContractDtoIdTypeMapping$inboundSchema` instead. */ export const inboundSchema = MetricSourceContractDtoIdTypeMapping$inboundSchema; /** @deprecated use `MetricSourceContractDtoIdTypeMapping$outboundSchema` instead. */ export const outboundSchema = MetricSourceContractDtoIdTypeMapping$outboundSchema; /** @deprecated use `MetricSourceContractDtoIdTypeMapping$Outbound` instead. */ export type Outbound = MetricSourceContractDtoIdTypeMapping$Outbound; } /** @internal */ export const MetricSourceContractDtoSourceType$inboundSchema: z.ZodNativeEnum< typeof MetricSourceContractDtoSourceType > = z.nativeEnum(MetricSourceContractDtoSourceType); /** @internal */ export const MetricSourceContractDtoSourceType$outboundSchema: z.ZodNativeEnum< typeof MetricSourceContractDtoSourceType > = MetricSourceContractDtoSourceType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace MetricSourceContractDtoSourceType$ { /** @deprecated use `MetricSourceContractDtoSourceType$inboundSchema` instead. */ export const inboundSchema = MetricSourceContractDtoSourceType$inboundSchema; /** @deprecated use `MetricSourceContractDtoSourceType$outboundSchema` instead. */ export const outboundSchema = MetricSourceContractDtoSourceType$outboundSchema; } /** @internal */ export const MetricSourceContractDtoCustomFieldMapping$inboundSchema: z.ZodType< MetricSourceContractDtoCustomFieldMapping, z.ZodTypeDef, unknown > = z.object({ key: z.string(), formula: z.string(), }); /** @internal */ export type MetricSourceContractDtoCustomFieldMapping$Outbound = { key: string; formula: string; }; /** @internal */ export const MetricSourceContractDtoCustomFieldMapping$outboundSchema: z.ZodType< MetricSourceContractDtoCustomFieldMapping$Outbound, z.ZodTypeDef, MetricSourceContractDtoCustomFieldMapping > = z.object({ key: z.string(), formula: z.string(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace MetricSourceContractDtoCustomFieldMapping$ { /** @deprecated use `MetricSourceContractDtoCustomFieldMapping$inboundSchema` instead. */ export const inboundSchema = MetricSourceContractDtoCustomFieldMapping$inboundSchema; /** @deprecated use `MetricSourceContractDtoCustomFieldMapping$outboundSchema` instead. */ export const outboundSchema = MetricSourceContractDtoCustomFieldMapping$outboundSchema; /** @deprecated use `MetricSourceContractDtoCustomFieldMapping$Outbound` instead. */ export type Outbound = MetricSourceContractDtoCustomFieldMapping$Outbound; } /** @internal */ export const MetricSourceContractDto$inboundSchema: z.ZodType< MetricSourceContractDto, z.ZodTypeDef, unknown > = z.object({ name: z.string(), description: z.string(), tags: z.array(z.string()).optional(), sql: z.string(), timestampColumn: z.string(), timestampAsDay: z.boolean().optional(), idTypeMapping: z.array(z.lazy(() => MetricSourceContractDtoIdTypeMapping$inboundSchema)), sourceType: MetricSourceContractDtoSourceType$inboundSchema.optional(), tableName: z.string().optional(), customFieldMapping: z .array(z.lazy(() => MetricSourceContractDtoCustomFieldMapping$inboundSchema)) .optional(), }); /** @internal */ export type MetricSourceContractDto$Outbound = { name: string; description: string; tags?: Array | undefined; sql: string; timestampColumn: string; timestampAsDay?: boolean | undefined; idTypeMapping: Array; sourceType?: string | undefined; tableName?: string | undefined; customFieldMapping?: Array | undefined; }; /** @internal */ export const MetricSourceContractDto$outboundSchema: z.ZodType< MetricSourceContractDto$Outbound, z.ZodTypeDef, MetricSourceContractDto > = z.object({ name: z.string(), description: z.string(), tags: z.array(z.string()).optional(), sql: z.string(), timestampColumn: z.string(), timestampAsDay: z.boolean().optional(), idTypeMapping: z.array(z.lazy(() => MetricSourceContractDtoIdTypeMapping$outboundSchema)), sourceType: MetricSourceContractDtoSourceType$outboundSchema.optional(), tableName: z.string().optional(), customFieldMapping: z .array(z.lazy(() => MetricSourceContractDtoCustomFieldMapping$outboundSchema)) .optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace MetricSourceContractDto$ { /** @deprecated use `MetricSourceContractDto$inboundSchema` instead. */ export const inboundSchema = MetricSourceContractDto$inboundSchema; /** @deprecated use `MetricSourceContractDto$outboundSchema` instead. */ export const outboundSchema = MetricSourceContractDto$outboundSchema; /** @deprecated use `MetricSourceContractDto$Outbound` instead. */ export type Outbound = MetricSourceContractDto$Outbound; }