Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(insights): discriminate remaining query schema unions (#70688)

Thomas Obermüllercc9525ca282b
diff --git a/bin/patch-schema-array-discriminators.py b/bin/patch-schema-array-discriminators.py
index 91cd0b41a72d..73274b6d0ab0 100644
--- a/bin/patch-schema-array-discriminators.py
+++ b/bin/patch-schema-array-discriminators.py
@@ -99,16 +99,18 @@ def _patch_schema_py(sites: list[tuple[str, str, str, str]]) -> int:
replacements = 0
for class_name, field_name, union_text, prop in sites:
- # Match the class body and within it the single line declaring the field as a list
- # of the inlined union. `re.DOTALL` lets `.*?` span newlines until the field line.
+ # Match the class body and within it the field declared as a list of the inlined
+ # union. `re.DOTALL` lets `.*?` span newlines until the field line. Codegen wraps
+ # long unions across lines, so members are matched with flexible whitespace.
+ union_pattern = r"\s*\|\s*".join(re.escape(member) for member in union_text.split(" | "))
class_re = re.compile(
r"(class "
+ re.escape(class_name)
+ r"\b[^\n]*:\n.*?\n "
+ re.escape(field_name)
- + r": )list\["
- + re.escape(union_text)
- + r"\](?P<tail>[^\n]*)\n",
+ + r": )list\[\s*"
+ + union_pattern
+ + r"\s*\](?P<tail>[^\n]*)\n",
re.DOTALL,
)
@@ -125,9 +127,9 @@ def _patch_schema_py(sites: list[tuple[str, str, str, str]]) -> int:
+ re.escape(class_name)
+ r"\b[^\n]*:\n.*?\n "
+ re.escape(field_name)
- + r": list\[Annotated\["
- + re.escape(union_text)
- + r", Field\(discriminator=",
+ + r": list\[\s*Annotated\[\s*"
+ + union_pattern
+ + r"\s*,\s*Field\(\s*discriminator=",
re.DOTALL,
)
if not already_patched_re.search(source):
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 0b71df6e1117..2efbae6f1c63 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -790,7 +790,10 @@
"description": "The union type with all cleaned queries for the assistant. Only used for generating the schemas with an LLM."
},
"AnyDataNode": {
- "anyOf": [
+ "discriminator": {
+ "propertyName": "kind"
+ },
+ "oneOf": [
{
"$ref": "#/definitions/EventsNode"
},
@@ -995,7 +998,9 @@
{
"$ref": "#/definitions/MCPToolNeighborsQuery"
}
- ]
+ ],
+ "required": ["kind"],
+ "type": "object"
},
"AnyDataWarehouseNode": {
"anyOf": [
@@ -1036,19 +1041,6 @@
}
]
},
- "AnyEntityNode<LifecycleDataWarehouseNode>": {
- "anyOf": [
- {
- "$ref": "#/definitions/EventsNode"
- },
- {
- "$ref": "#/definitions/ActionsNode"
- },
- {
- "$ref": "#/definitions/LifecycleDataWarehouseNode"
- }
- ]
- },
"AnyFilterLike": {
"anyOf": [
{
@@ -13306,7 +13298,7 @@
"series": {
"description": "Events and actions to include",
"items": {
- "$ref": "#/definitions/AnyEntityNode"
+ "$ref": "#/definitions/CalendarHeatmapQuerySeriesNode"
},
"type": "array"
},
@@ -13322,6 +13314,27 @@
"required": ["kind", "series"],
"type": "object"
},
+ "CalendarHeatmapQuerySeriesNode": {
+ "$ref": "#/definitions/CalendarHeatmapQuerySeriesNodeUnion"
+ },
+ "CalendarHeatmapQuerySeriesNodeUnion": {
+ "discriminator": {
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/definitions/EventsNode"
+ },
+ {
+ "$ref": "#/definitions/ActionsNode"
+ },
+ {
+ "$ref": "#/definitions/DataWarehouseNode"
+ }
+ ],
+ "required": ["kind"],
+ "type": "object"
+ },
"CalendarHeatmapResponse": {
"additionalProperties": false,
"properties": {
@@ -16753,107 +16766,7 @@
"type": "boolean"
},
"source": {
- "anyOf": [
- {
- "$ref": "#/definitions/EventsNode"
- },
- {
- "$ref": "#/definitions/EventsQuery"
- },
- {
- "$ref": "#/definitions/PersonsNode"
- },
- {
- "$ref": "#/definitions/ActorsQuery"
- },
- {
- "$ref": "#/definitions/GroupsQuery"
- },
- {
- "$ref": "#/definitions/HogQLQuery"
- },
- {
- "$ref": "#/definitions/WebOverviewQuery"
- },
- {
- "$ref": "#/definitions/WebStatsTableQuery"
- },
- {
- "$ref": "#/definitions/WebExternalClicksTableQuery"
- },
- {
- "$ref": "#/definitions/WebGoalsQuery"
- },
- {
- "$ref": "#/definitions/WebVitalsQuery"
- },
- {
- "$ref": "#/definitions/WebVitalsPathBreakdownQuery"
- },
- {
- "$ref": "#/definitions/SessionAttributionExplorerQuery"
- },
- {
- "$ref": "#/definitions/SessionsQuery"
- },
- {
- "$ref": "#/definitions/RevenueAnalyticsGrossRevenueQuery"
- },
- {
- "$ref": "#/definitions/RevenueAnalyticsMetricsQuery"
- },
- {
- "$ref": "#/definitions/RevenueAnalyticsMRRQuery"
- },
- {
- "$ref": "#/definitions/RevenueAnalyticsOverviewQuery"
- },
- {
- "$ref": "#/definitions/RevenueAnalyticsTopCustomersQuery"
- },
- {
- "$ref": "#/definitions/RevenueExampleEventsQuery"
- },
- {
- "$ref": "#/definitions/RevenueExampleDataWarehouseTablesQuery"
- },
- {
- "$ref": "#/definitions/MarketingAnalyticsTableQuery"
- },
- {
- "$ref": "#/definitions/MarketingAnalyticsAggregatedQuery"
- },
- {
- "$ref": "#/definitions/NonIntegratedConversionsTableQuery"
- },
- {
- "$ref": "#/definitions/ErrorTrackingQuery"
- },
- {
- "$ref": "#/definitions/ErrorTrackingIssueCorrelationQuery"
- },
- {
- "$ref": "#/definitions/ExperimentFunnelsQuery"
- },
- {
- "$ref": "#/definitions/ExperimentTrendsQuery"
- },
- {
- "$ref": "#/definitions/TracesQuery"
- },
- {
- "$ref": "#/definitions/TraceQuery"
- },
- {
- "$ref": "#/definitions/SessionQuery"
- },
- {
- "$ref": "#/definitions/EndpointsUsageTableQuery"
- },
- {
- "$ref": "#/definitions/AccountsQuery"
- }
- ],
+ "$ref": "#/definitions/DataTableNodeSource",
"description": "Source of the events"
},
"tags": {
@@ -16867,6 +16780,117 @@
"required": ["kind", "source"],
"type": "object"
},
+ "DataTableNodeSource": {
+ "$ref": "#/definitions/DataTableNodeSourceUnion"
+ },
+ "DataTableNodeSourceUnion": {
+ "discriminator": {
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/definitions/EventsNode"
+ },
+ {
+ "$ref": "#/definitions/EventsQuery"
+ },
+ {
+ "$ref": "#/definitions/PersonsNode"
+ },
+ {
+ "$ref": "#/definitions/ActorsQuery"
+ },
+ {
+ "$ref": "#/definitions/GroupsQuery"
+ },
+ {
+ "$ref": "#/definitions/HogQLQuery"
+ },
+ {
+ "$ref": "#/definitions/WebOverviewQuery"
+ },
+ {
+ "$ref": "#/definitions/WebStatsTableQuery"
+ },
+ {
+ "$ref": "#/definitions/WebExternalClicksTableQuery"
+ },
+ {
+ "$ref": "#/definitions/WebGoalsQuery"
+ },
+ {
+ "$ref": "#/definitions/WebVitalsQuery"
+ },
+ {
+ "$ref": "#/definitions/WebVitalsPathBreakdownQuery"
+ },
+ {
+ "$ref": "#/definitions/SessionAttributionExplorerQuery"
+ },
+ {
+ "$ref": "#/definitions/SessionsQuery"
+ },
+ {
+ "$ref": "#/definitions/RevenueAnalyticsGrossRevenueQuery"
+ },
+ {
+ "$ref": "#/definitions/RevenueAnalyticsMetricsQuery"
+ },
+ {
+ "$ref": "#/definitions/RevenueAnalyticsMRRQuery"
+ },
+ {
+ "$ref": "#/definitions/RevenueAnalyticsOverviewQuery"
+ },
+ {
+ "$ref": "#/definitions/RevenueAnalyticsTopCustomersQuery"
+ },
+ {
+ "$ref": "#/definitions/RevenueExampleEventsQuery"
+ },
+ {
+ "$ref": "#/definitions/RevenueExampleDataWarehouseTablesQuery"
+ },
+ {
+ "$ref": "#/definitions/MarketingAnalyticsTableQuery"
+ },
+ {
+ "$ref": "#/definitions/MarketingAnalyticsAggregatedQuery"
+ },
+ {
+ "$ref": "#/definitions/NonIntegratedConversionsTableQuery"
+ },
+ {
+ "$ref": "#/definitions/ErrorTrackingQuery"
+ },
+ {
+ "$ref": "#/definitions/ErrorTrackingIssueCorrelationQuery"
+ },
+ {
+ "$ref": "#/definitions/ExperimentFunnelsQuery"
+ },
+ {
+ "$ref": "#/definitions/ExperimentTrendsQuery"
+ },
+ {
+ "$ref": "#/definitions/TracesQuery"
+ },
+ {
+ "$ref": "#/definitions/TraceQuery"
+ },
+ {
+ "$ref": "#/definitions/SessionQuery"
+ },
+ {
+ "$ref": "#/definitions/EndpointsUsageTableQuery"
+ },
+ {
+ "$ref": "#/definitions/AccountsQuery"
+ }
+ ],
+ "required": ["kind"],
+ "type": "object"
+ },
"DataTableNodeViewPropsContext": {
"additionalProperties": false,
"properties": {
@@ -17749,7 +17773,11 @@
"type": "string"
},
"DetectorConfig": {
- "anyOf": [
+ "description": "Detector configuration types",
+ "discriminator": {
+ "propertyName": "type"
+ },
+ "oneOf": [
{
"$ref": "#/definitions/SingleDetectorConfig"
},
@@ -17757,7 +17785,8 @@
"$ref": "#/definitions/EnsembleDetectorConfig"
}
],
- "description": "Detector configuration types"
+ "required": ["type"],
+ "type": "object"
},
"DetectorType": {
"enum": [
@@ -23933,14 +23962,19 @@
"type": "string"
},
"FunnelExclusion": {
- "anyOf": [
+ "discriminator": {
+ "propertyName": "kind"
+ },
+ "oneOf": [
{
"$ref": "#/definitions/FunnelExclusionEventsNode"
},
{
"$ref": "#/definitions/FunnelExclusionActionsNode"
}
- ]
+ ],
+ "required": ["kind"],
+ "type": "object"
},
"FunnelExclusionActionsNode": {
"additionalProperties": false,
@@ -27391,7 +27425,7 @@
"series": {
"description": "Events and actions to include",
"items": {
- "$ref": "#/definitions/AnyEntityNode%3CLifecycleDataWarehouseNode%3E"
+ "$ref": "#/definitions/LifecycleQuerySeriesNode"
},
"type": "array"
},
@@ -27465,6 +27499,27 @@
"required": ["results"],
"type": "object"
},
+ "LifecycleQuerySeriesNode": {
+ "$ref": "#/definitions/LifecycleQuerySeriesNodeUnion"
+ },
+ "LifecycleQuerySeriesNodeUnion": {
+ "discriminator": {
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/definitions/EventsNode"
+ },
+ {
+ "$ref": "#/definitions/ActionsNode"
+ },
+ {
+ "$ref": "#/definitions/LifecycleDataWarehouseNode"
+ }
+ ],
+ "required": ["kind"],
+ "type": "object"
+ },
"LifecycleToggle": {
"enum": ["new", "resurrecting", "returning", "dormant"],
"type": "string"
@@ -44604,7 +44659,11 @@
"type": "string"
},
"SingleDetectorConfig": {
- "anyOf": [
+ "description": "A single (leaf) detector config",
+ "discriminator": {
+ "propertyName": "type"
+ },
+ "oneOf": [
{
"$ref": "#/definitions/ZScoreDetectorConfig"
},
@@ -44642,7 +44701,8 @@
"$ref": "#/definitions/PCADetectorConfig"
}
],
- "description": "A single (leaf) detector config"
+ "required": ["type"],
+ "type": "object"
},
"SlackIntegrationScope": {
"enum": [
@@ -45464,7 +45524,7 @@
"series": {
"description": "Events and actions to include",
"items": {
- "$ref": "#/definitions/AnyEntityNode"
+ "$ref": "#/definitions/StickinessQuerySeriesNode"
},
"type": "array"
},
@@ -45542,6 +45602,27 @@
"required": ["results"],
"type": "object"
},
+ "StickinessQuerySeriesNode": {
+ "$ref": "#/definitions/StickinessQuerySeriesNodeUnion"
+ },
+ "StickinessQuerySeriesNodeUnion": {
+ "discriminator": {
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/definitions/EventsNode"
+ },
+ {
+ "$ref": "#/definitions/ActionsNode"
+ },
+ {
+ "$ref": "#/definitions/DataWarehouseNode"
+ }
+ ],
+ "required": ["kind"],
+ "type": "object"
+ },
"SubagentUpdateEvent": {
"additionalProperties": false,
"properties": {
@@ -48044,14 +48125,7 @@
"series": {
"description": "Events and actions to include",
"items": {
- "anyOf": [
- {
- "$ref": "#/definitions/AnyEntityNode"
- },
- {
- "$ref": "#/definitions/GroupNode"
- }
- ]
+ "$ref": "#/definitions/TrendsQuerySeriesNode"
},
"type": "array"
},
@@ -48140,6 +48214,30 @@
"required": ["results"],
"type": "object"
},
+ "TrendsQuerySeriesNode": {
+ "$ref": "#/definitions/TrendsQuerySeriesNodeUnion"
+ },
+ "TrendsQuerySeriesNodeUnion": {
+ "discriminator": {
+ "propertyName": "kind"
+ },
+ "oneOf": [
+ {
+ "$ref": "#/definitions/EventsNode"
+ },
+ {
+ "$ref": "#/definitions/ActionsNode"
+ },
+ {
+ "$ref": "#/definitions/DataWarehouseNode"
+ },
+ {
+ "$ref": "#/definitions/GroupNode"
+ }
+ ],
+ "required": ["kind"],
+ "type": "object"
+ },
"UsageMetric": {
"additionalProperties": false,
"properties": {
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 554ca6ea96f4..d5216f48b4b5 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -208,6 +208,9 @@ export enum NodeKind {
PropertyValuesQuery = 'PropertyValuesQuery',
}
+/**
+ * @discriminator kind
+ */
export type AnyDataNode =
| EventsNode // never queried directly
| ActionsNode // old actions API endpoint
@@ -913,6 +916,8 @@ export interface ActionsNode extends EntityNode {
id: integer
}
+// NOTE: attaching `@discriminator` here breaks ts-json-schema-generator on the generic
+// alias ("multiple definitions") — per-query `*SeriesNodeUnion` aliases carry the tag instead.
export type AnyEntityNode<WarehouseNode = DataWarehouseNode> = EventsNode | ActionsNode | WarehouseNode
export type AnyDataWarehouseNode = DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode
@@ -1084,6 +1089,50 @@ export interface PersonsNode extends DataNode {
export type HasPropertiesNode = EventsNode | EventsQuery | PersonsNode
+// Named separately from `DataTableNodeSource` so the JSDoc `@discriminator` tag
+// can attach without tripping ts-json-schema-generator's dedup (same workaround
+// pattern as `FunnelsQuerySeriesNodeUnion = FunnelsQuerySeriesNode`). The alias is
+// the public type — callers continue to use `DataTableNodeSource`.
+/**
+ * @discriminator kind
+ */
+export type DataTableNodeSourceUnion =
+ | EventsNode
+ | EventsQuery
+ | PersonsNode
+ | ActorsQuery
+ | GroupsQuery
+ | HogQLQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | WebExternalClicksTableQuery
+ | WebGoalsQuery
+ | WebVitalsQuery
+ | WebVitalsPathBreakdownQuery
+ | SessionAttributionExplorerQuery
+ | SessionsQuery
+ | RevenueAnalyticsGrossRevenueQuery
+ | RevenueAnalyticsMetricsQuery
+ | RevenueAnalyticsMRRQuery
+ | RevenueAnalyticsOverviewQuery
+ | RevenueAnalyticsTopCustomersQuery
+ | RevenueExampleEventsQuery
+ | RevenueExampleDataWarehouseTablesQuery
+ | MarketingAnalyticsTableQuery
+ | MarketingAnalyticsAggregatedQuery
+ | NonIntegratedConversionsTableQuery
+ | ErrorTrackingQuery
+ | ErrorTrackingIssueCorrelationQuery
+ | ExperimentFunnelsQuery
+ | ExperimentTrendsQuery
+ | TracesQuery
+ | TraceQuery
+ | SessionQuery
+ | EndpointsUsageTableQuery
+ | AccountsQuery
+
+export type DataTableNodeSource = DataTableNodeSourceUnion
+
export interface DataTableNode
extends
Node<
@@ -1127,40 +1176,7 @@ export interface DataTableNode
DataTableNodeViewProps {
kind: NodeKind.DataTableNode
/** Source of the events */
- source:
- | EventsNode
- | EventsQuery
- | PersonsNode
- | ActorsQuery
- | GroupsQuery
- | HogQLQuery
- | WebOverviewQuery
- | WebStatsTableQuery
- | WebExternalClicksTableQuery
- | WebGoalsQuery
- | WebVitalsQuery
- | WebVitalsPathBreakdownQuery
- | SessionAttributionExplorerQuery
- | SessionsQuery
- | RevenueAnalyticsGrossRevenueQuery
- | RevenueAnalyticsMetricsQuery
- | RevenueAnalyticsMRRQuery
- | RevenueAnalyticsOverviewQuery
- | RevenueAnalyticsTopCustomersQuery
- | RevenueExampleEventsQuery
- | RevenueExampleDataWarehouseTablesQuery
- | MarketingAnalyticsTableQuery
- | MarketingAnalyticsAggregatedQuery
- | NonIntegratedConversionsTableQuery
- | ErrorTrackingQuery
- | ErrorTrackingIssueCorrelationQuery
- | ExperimentFunnelsQuery
- | ExperimentTrendsQuery
- | TracesQuery
- | TraceQuery
- | SessionQuery
- | EndpointsUsageTableQuery
- | AccountsQuery
+ source: DataTableNodeSource
/** Columns shown in the table, unless the `source` provides them. */
columns?: HogQLExpression[]
/** Columns that aren't shown in the table, even if in columns or returned data */
@@ -1671,6 +1687,17 @@ export interface ResultCustomizationByValue extends ResultCustomizationBase {
export type ResultCustomization = ResultCustomizationByValue | ResultCustomizationByPosition
+// Named separately from `TrendsQuerySeriesNode` so the JSDoc `@discriminator` tag
+// can attach without tripping ts-json-schema-generator's dedup (same workaround
+// pattern as `FunnelsQuerySeriesNodeUnion = FunnelsQuerySeriesNode`). The alias is
+// the public type — callers continue to use `TrendsQuerySeriesNode`.
+/**
+ * @discriminator kind
+ */
+export type TrendsQuerySeriesNodeUnion = EventsNode | ActionsNode | DataWarehouseNode | GroupNode
+
+export type TrendsQuerySeriesNode = TrendsQuerySeriesNodeUnion
+
export interface TrendsQuery extends InsightsQueryBase<TrendsQueryResponse> {
kind: NodeKind.TrendsQuery
/**
@@ -1680,7 +1707,7 @@ export interface TrendsQuery extends InsightsQueryBase<TrendsQueryResponse> {
*/
interval?: IntervalType
/** Events and actions to include */
- series: (AnyEntityNode | GroupNode)[]
+ series: TrendsQuerySeriesNode[]
/** Properties specific to the trends insight */
trendsFilter?: TrendsFilter
/**
@@ -1704,6 +1731,15 @@ export interface CalendarHeatmapResponse extends AnalyticsQueryResponseBase {
export type CachedCalendarHeatmapQueryResponse = CachedQueryResponse<CalendarHeatmapResponse>
+// Two-level alias so the JSDoc `@discriminator` tag survives ts-json-schema-generator's
+// dedup — same workaround pattern as `FunnelsQuerySeriesNodeUnion = FunnelsQuerySeriesNode`.
+/**
+ * @discriminator kind
+ */
+export type CalendarHeatmapQuerySeriesNodeUnion = EventsNode | ActionsNode | DataWarehouseNode
+
+export type CalendarHeatmapQuerySeriesNode = CalendarHeatmapQuerySeriesNodeUnion
+
export interface CalendarHeatmapQuery extends InsightsQueryBase<CalendarHeatmapResponse> {
kind: NodeKind.CalendarHeatmapQuery
/**
@@ -1713,7 +1749,7 @@ export interface CalendarHeatmapQuery extends InsightsQueryBase<CalendarHeatmapR
*/
interval?: IntervalType
/** Events and actions to include */
- series: AnyEntityNode[]
+ series: CalendarHeatmapQuerySeriesNode[]
/** Properties specific to the trends insight */
calendarHeatmapFilter?: CalendarHeatmapFilter
/** Whether we should be comparing against a specific conversion goal */
@@ -1757,6 +1793,9 @@ export interface FunnelExclusionSteps {
}
export interface FunnelExclusionEventsNode extends EventsNode, FunnelExclusionSteps {}
export interface FunnelExclusionActionsNode extends ActionsNode, FunnelExclusionSteps {}
+/**
+ * @discriminator kind
+ */
export type FunnelExclusion = FunnelExclusionEventsNode | FunnelExclusionActionsNode
export type FunnelsFilter = {
@@ -2056,6 +2095,15 @@ export interface StickinessQueryResponse extends AnalyticsQueryResponseBase {
export type CachedStickinessQueryResponse = CachedQueryResponse<StickinessQueryResponse>
+// Two-level alias so the JSDoc `@discriminator` tag survives ts-json-schema-generator's
+// dedup — same workaround pattern as `FunnelsQuerySeriesNodeUnion = FunnelsQuerySeriesNode`.
+/**
+ * @discriminator kind
+ */
+export type StickinessQuerySeriesNodeUnion = EventsNode | ActionsNode | DataWarehouseNode
+
+export type StickinessQuerySeriesNode = StickinessQuerySeriesNodeUnion
+
export interface StickinessQuery extends Omit<
InsightsQueryBase<StickinessQueryResponse>,
'aggregation_group_type_index'
@@ -2071,7 +2119,7 @@ export interface StickinessQuery extends Omit<
*/
intervalCount?: positive_integer
/** Events and actions to include */
- series: AnyEntityNode[]
+ series: StickinessQuerySeriesNode[]
/** Properties specific to the stickiness insight */
stickinessFilter?: StickinessFilter
/** Compare to date range */
@@ -2383,6 +2431,15 @@ export interface LifecycleQueryResponse extends AnalyticsQueryResponseBase {
export type CachedLifecycleQueryResponse = CachedQueryResponse<LifecycleQueryResponse>
+// Two-level alias so the JSDoc `@discriminator` tag survives ts-json-schema-generator's
+// dedup — same workaround pattern as `FunnelsQuerySeriesNodeUnion = FunnelsQuerySeriesNode`.
+/**
+ * @discriminator kind
+ */
+export type LifecycleQuerySeriesNodeUnion = EventsNode | ActionsNode | LifecycleDataWarehouseNode
+
+export type LifecycleQuerySeriesNode = LifecycleQuerySeriesNodeUnion
+
export interface LifecycleQuery extends InsightsQueryBase<LifecycleQueryResponse> {
kind: NodeKind.LifecycleQuery
/**
@@ -2391,7 +2448,7 @@ export interface LifecycleQuery extends InsightsQueryBase<LifecycleQueryResponse
*/
interval?: IntervalType
/** Events and actions to include */
- series: AnyEntityNode<LifecycleDataWarehouseNode>[]
+ series: LifecycleQuerySeriesNode[]
/** Properties specific to the lifecycle insight */
lifecycleFilter?: LifecycleFilter
/** For data warehouse based lifecycle insights when the aggregation target can't be mapped to persons or groups. */
@@ -5489,7 +5546,10 @@ export enum EnsembleOperator {
OR = 'or',
}
-/** A single (leaf) detector config */
+/**
+ * A single (leaf) detector config
+ * @discriminator type
+ */
export type SingleDetectorConfig =
| ZScoreDetectorConfig
| MADDetectorConfig
@@ -5512,7 +5572,10 @@ export interface EnsembleDetectorConfig {
detectors: SingleDetectorConfig[]
}
-/** Detector configuration types */
+/**
+ * Detector configuration types
+ * @discriminator type
+ */
export type DetectorConfig = SingleDetectorConfig | EnsembleDetectorConfig
export interface HogCompileResponse {
diff --git a/posthog/api/test/test_cohort.py b/posthog/api/test/test_cohort.py
index 9578970e1aeb..07e87d23946b 100644
--- a/posthog/api/test/test_cohort.py
+++ b/posthog/api/test/test_cohort.py
@@ -5336,6 +5336,7 @@ [email protected],
"source": {
"series": [
{
+ "kind": "EventsNode",
"event": "$pageview",
"properties": [{"type": "cohort", "value": cohort_id}],
}
diff --git a/posthog/api/test/test_sharing.py b/posthog/api/test/test_sharing.py
index 2034bf9d0d6e..a5d527d7ae70 100644
--- a/posthog/api/test/test_sharing.py
+++ b/posthog/api/test/test_sharing.py
@@ -1412,7 +1412,7 @@ class TestExportCacheKeyFlow(APIBaseTest):
cls.insight = Insight.objects.create(
team=cls.team,
name="Test Insight",
- query={"kind": "TrendsQuery", "series": [{"event": "$pageview"}]},
+ query={"kind": "TrendsQuery", "series": [{"kind": "EventsNode", "event": "$pageview"}]},
)
cls.sharing_config = SharingConfiguration.objects.create(
team=cls.team,
diff --git a/posthog/api/test/test_sharing_access_token_security.py b/posthog/api/test/test_sharing_access_token_security.py
index fe836c98eea8..23aef251ce41 100644
--- a/posthog/api/test/test_sharing_access_token_security.py
+++ b/posthog/api/test/test_sharing_access_token_security.py
@@ -46,7 +46,7 @@ class SharingAccessTokenSecurityTest(APIBaseTest):
name="Shared Insight",
team=self.team,
created_by=self.user,
- query={"kind": "TrendsQuery", "series": [{"event": "test_event"}]},
+ query={"kind": "TrendsQuery", "series": [{"kind": "EventsNode", "event": "test_event"}]},
)
self.dashboard.tiles.create(
insight=insight,
@@ -84,7 +84,7 @@ class SharingAccessTokenSecurityTest(APIBaseTest):
name="Shared Insight",
team=self.team,
created_by=self.user,
- query={"kind": "TrendsQuery", "series": [{"event": "test_event"}]},
+ query={"kind": "TrendsQuery", "series": [{"kind": "EventsNode", "event": "test_event"}]},
)
self.dashboard.tiles.create(
insight=insight,
@@ -144,7 +144,7 @@ class SharingAccessTokenSecurityTest(APIBaseTest):
created_by=self.user,
query={
"kind": "TrendsQuery",
- "series": [{"event": "test_event"}],
+ "series": [{"kind": "EventsNode", "event": "test_event"}],
},
)
@@ -155,7 +155,7 @@ class SharingAccessTokenSecurityTest(APIBaseTest):
created_by=self.user,
query={
"kind": "TrendsQuery",
- "series": [{"event": "secret_event"}],
+ "series": [{"kind": "EventsNode", "event": "secret_event"}],
},
)
@@ -201,7 +201,7 @@ class SharingAccessTokenSecurityTest(APIBaseTest):
created_by=self.user,
query={
"kind": "TrendsQuery",
- "series": [{"event": "original_event"}],
+ "series": [{"kind": "EventsNode", "event": "original_event"}],
"dateRange": {"date_from": "-7d"},
},
)
@@ -337,7 +337,7 @@ class SharingAccessTokenSecurityTest(APIBaseTest):
created_by=self.user,
query={
"kind": "TrendsQuery",
- "series": [{"event": "other_team_event"}],
+ "series": [{"kind": "EventsNode", "event": "other_team_event"}],
},
)
@@ -367,14 +367,14 @@ class SharingAccessTokenSecurityTest(APIBaseTest):
name="On Dashboard",
team=self.team,
created_by=self.user,
- query={"kind": "TrendsQuery", "series": [{"event": "dashboard_event"}]},
+ query={"kind": "TrendsQuery", "series": [{"kind": "EventsNode", "event": "dashboard_event"}]},
)
insight_not_on_dashboard = Insight.objects.create(
name="Not on Dashboard",
team=self.team,
created_by=self.user,
- query={"kind": "TrendsQuery", "series": [{"event": "secret_event"}]},
+ query={"kind": "TrendsQuery", "series": [{"kind": "EventsNode", "event": "secret_event"}]},
)
# Add only one to the dashboard
@@ -419,7 +419,7 @@ class SharingAccessTokenSecurityTest(APIBaseTest):
f"/api/environments/{self.team.id}/insights/?sharing_access_token={sharing_config.access_token}",
{
"name": "Malicious Insight",
- "query": {"kind": "TrendsQuery", "series": [{"event": "malicious_event"}]},
+ "query": {"kind": "TrendsQuery", "series": [{"kind": "EventsNode", "event": "malicious_event"}]},
},
)
assert response.status_code in [401, 403], (
@@ -431,7 +431,7 @@ class SharingAccessTokenSecurityTest(APIBaseTest):
f"/api/environments/{self.team.id}/insights/",
{
"name": "Malicious Insight",
- "query": {"kind": "TrendsQuery", "series": [{"event": "malicious_event"}]},
+ "query": {"kind": "TrendsQuery", "series": [{"kind": "EventsNode", "event": "malicious_event"}]},
"sharing_access_token": sharing_config.access_token,
},
)
@@ -468,7 +468,7 @@ class SharingAccessTokenSecurityTest(APIBaseTest):
name="Shared Insight",
team=self.team,
created_by=self.user,
- query={"kind": "TrendsQuery", "series": [{"event": "test_event"}]},
+ query={"kind": "TrendsQuery", "series": [{"kind": "EventsNode", "event": "test_event"}]},
)
self.dashboard.tiles.create(
insight=insight,
@@ -538,7 +538,7 @@ class SharingAccessTokenSecurityTest(APIBaseTest):
name="Shared Insight",
team=self.team,
created_by=self.user,
- query={"kind": "TrendsQuery", "series": [{"event": "test_event"}]},
+ query={"kind": "TrendsQuery", "series": [{"kind": "EventsNode", "event": "test_event"}]},
)
self.dashboard.tiles.create(
insight=insight,
diff --git a/posthog/api/web_vitals.py b/posthog/api/web_vitals.py
index 30e6f2107c0c..a66c9be016dc 100644
--- a/posthog/api/web_vitals.py
+++ b/posthog/api/web_vitals.py
@@ -44,6 +44,7 @@ class WebVitalsViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
],
"series": [
{
+ "kind": "EventsNode",
"event": "$web_vitals",
"name": "INP",
"custom_name": "INP",
@@ -51,6 +52,7 @@ class WebVitalsViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
"math_property": "$web_vitals_INP_value",
},
{
+ "kind": "EventsNode",
"event": "$web_vitals",
"name": "LCP",
"custom_name": "LCP",
@@ -58,6 +60,7 @@ class WebVitalsViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
"math_property": "$web_vitals_LCP_value",
},
{
+ "kind": "EventsNode",
"event": "$web_vitals",
"name": "CLS",
"custom_name": "CLS",
@@ -65,6 +68,7 @@ class WebVitalsViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
"math_property": "$web_vitals_CLS_value",
},
{
+ "kind": "EventsNode",
"event": "$web_vitals",
"name": "FCP",
"custom_name": "FCP",
diff --git a/posthog/hogql_queries/insights/trends/test/test_formula.py b/posthog/hogql_queries/insights/trends/test/test_formula.py
index b94fc01abe33..f0c32bf31fb3 100644
--- a/posthog/hogql_queries/insights/trends/test/test_formula.py
+++ b/posthog/hogql_queries/insights/trends/test/test_formula.py
@@ -150,11 +150,13 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
query_dict = {
"series": [
{
+ "kind": "EventsNode",
"event": "session start",
"math": "sum",
"math_property": "xyz",
},
{
+ "kind": "EventsNode",
"event": "session start",
"math": "avg",
"math_property": "xyz",
@@ -301,8 +303,8 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
action_response = self._run(
{
"series": [
- {"event": "session start", "math": "unique_session"},
- {"event": "session start", "math": "dau"},
+ {"kind": "EventsNode", "event": "session start", "math": "unique_session"},
+ {"kind": "EventsNode", "event": "session start", "math": "dau"},
],
"trendsFilter": {
"formula": "A / B",
@@ -318,6 +320,7 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
{
"series": [
{
+ "kind": "EventsNode",
"event": "session start",
"math": "unique_session",
"properties": [
@@ -329,7 +332,7 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
}
],
},
- {"event": "session start", "math": "unique_session"},
+ {"kind": "EventsNode", "event": "session start", "math": "unique_session"},
],
"trendsFilter": {
"formula": "A / B",
@@ -346,6 +349,7 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
{
"series": [
{
+ "kind": "EventsNode",
"event": "$autocapture",
"math": "unique_session",
"properties": [
@@ -358,6 +362,7 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
],
},
{
+ "kind": "EventsNode",
"event": "session start",
"math": "unique_session",
"properties": [
@@ -385,12 +390,14 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
{
"series": [
{
+ "kind": "EventsNode",
"event": "session start",
"name": "$pageview",
"math": "avg",
"math_property": "$session_duration",
},
{
+ "kind": "EventsNode",
"event": "session end",
"name": "$pageview",
"math": "total",
@@ -415,12 +422,14 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
},
"series": [
{
+ "kind": "EventsNode",
"event": "session start",
"name": "session start",
"math": "sum",
"math_property": "xyz",
},
{
+ "kind": "EventsNode",
"event": "session error",
"name": "session error",
"math": "sum",
@@ -462,11 +471,13 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
{
"series": [
{
+ "kind": "EventsNode",
"event": "session start",
"math": "sum",
"math_property": "xyz",
},
{
+ "kind": "EventsNode",
"event": "session end",
"math": "sum",
"math_property": "xyz",
@@ -510,10 +521,12 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
},
"series": [
{
+ "kind": "EventsNode",
"event": "session start",
"name": "session start",
},
{
+ "kind": "EventsNode",
"event": "session error",
"name": "session error",
},
@@ -709,7 +722,10 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
def test_breakdown_mismatching_sizes(self):
response = self._run(
{
- "series": [{"event": "session start"}, {"event": "session end"}],
+ "series": [
+ {"kind": "EventsNode", "event": "session start"},
+ {"kind": "EventsNode", "event": "session end"},
+ ],
"breakdownFilter": {
"breakdown": "location",
},
@@ -755,12 +771,14 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
{
"series": [
{
+ "kind": "EventsNode",
"event": "session start",
"math": "sum",
"math_property": "xyz",
"properties": [{"key": "$current_url", "value": "http://example.org"}],
},
{
+ "kind": "EventsNode",
"event": "session start",
"math": "avg",
"math_property": "xyz",
@@ -826,16 +844,19 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
{
"series": [
{
+ "kind": "EventsNode",
"event": "session start",
"math": "sum",
"math_property": "xyz",
},
{
+ "kind": "EventsNode",
"event": "session start",
"math": "avg",
"math_property": "xyz",
},
{
+ "kind": "EventsNode",
"event": "session start",
"math": "avg",
"math_property": "xyz",
@@ -851,8 +872,8 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
self._run(
{
"series": [
- {"event": "session start", "math": "unique_session"},
- {"event": "session start", "math": "unique_session"},
+ {"kind": "EventsNode", "event": "session start", "math": "unique_session"},
+ {"kind": "EventsNode", "event": "session start", "math": "unique_session"},
]
}
)[0]["data"],
@@ -871,11 +892,13 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
{
"series": [
{
+ "kind": "EventsNode",
"event": "session start",
"math": "unique_group",
"math_group_type_index": 0,
},
{
+ "kind": "EventsNode",
"event": "session start",
"math": "unique_group",
"math_group_type_index": 0,
@@ -899,12 +922,14 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
},
"series": [
{
+ "kind": "EventsNode",
"event": "nonexistent_event_that_has_no_data",
"name": "custom hogql",
"math": "hogql",
"math_hogql": "sum(toFloat(properties.xyz))",
},
{
+ "kind": "EventsNode",
"event": "session start",
"name": "session start",
"math": "sum",
@@ -925,6 +950,7 @@ class TestFormula(ClickhouseTestMixin, APIBaseTest):
{
"series": [
{
+ "kind": "EventsNode",
"event": "session start",
"math": "sum",
"math_property": "xyz",
diff --git a/posthog/schema.py b/posthog/schema.py
index 716636103b06..2ad01307f35b 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -23073,10 +23073,6 @@ class AnyEntityNodeDataWarehouseNode(RootModel[EventsNode | ActionsNode | DataWa
root: EventsNode | ActionsNode | DataWarehouseNode
-class AnyEntityNodeLifecycleDataWarehouseNode(RootModel[EventsNode | ActionsNode | LifecycleDataWarehouseNode]):
- root: EventsNode | ActionsNode | LifecycleDataWarehouseNode
-
-
class AnyResponseType(
RootModel[
dict[str, Any]
@@ -23782,18 +23778,21 @@ class EnsembleDetectorConfig(BaseModel):
extra="forbid",
)
detectors: list[
- ZScoreDetectorConfig
- | MADDetectorConfig
- | IQRDetectorConfig
- | ThresholdDetectorConfig
- | ECODDetectorConfig
- | COPODDetectorConfig
- | IsolationForestDetectorConfig
- | KNNDetectorConfig
- | HBOSDetectorConfig
- | LOFDetectorConfig
- | OCSVMDetectorConfig
- | PCADetectorConfig
+ Annotated[
+ ZScoreDetectorConfig
+ | MADDetectorConfig
+ | IQRDetectorConfig
+ | ThresholdDetectorConfig
+ | ECODDetectorConfig
+ | COPODDetectorConfig
+ | IsolationForestDetectorConfig
+ | KNNDetectorConfig
+ | HBOSDetectorConfig
+ | LOFDetectorConfig
+ | OCSVMDetectorConfig
+ | PCADetectorConfig,
+ Field(discriminator="type"),
+ ]
] = Field(..., description="Sub-detector configurations (minimum 2)")
operator: EnsembleOperator = Field(..., description="How to combine sub-detector results")
type: Literal["ensemble"] = "ensemble"
@@ -23963,7 +23962,9 @@ class FunnelsFilter(BaseModel):
"For data warehouse based funnel insights when the aggregation target can't be mapped to persons or groups."
),
)
- exclusions: list[FunnelExclusionEventsNode | FunnelExclusionActionsNode] | None = []
+ exclusions: (
+ list[Annotated[FunnelExclusionEventsNode | FunnelExclusionActionsNode, Field(discriminator="kind")]] | None
+ ) = []
funnelAggregateByHogQL: str | None = None
funnelFromStep: int | None = None
funnelOrderType: StepOrderValue | None = StepOrderValue.ORDERED
@@ -24736,65 +24737,6 @@ class RetentionQuery(BaseModel):
version: float | None = Field(default=None, description="version of the node, used for schema migrations")
-class StickinessQuery(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- compareFilter: CompareFilter | None = Field(default=None, description="Compare to date range")
- dataColorTheme: float | None = Field(default=None, description="Colors used in the insight's visualization")
- dateRange: DateRange | None = Field(default=None, description="Date range for the query")
- filterTestAccounts: bool | None = Field(
- default=False,
- description=("Exclude internal and test users by applying the respective filters"),
- )
- interval: IntervalType | None = Field(
- default=IntervalType.DAY,
- description=("Granularity of the response. Can be one of `hour`, `day`, `week` or `month`"),
- )
- intervalCount: conint(ge=1) | None = Field(
- default=None,
- description=("How many intervals comprise a period. Only used for cohorts, otherwise default 1."),
- )
- kind: Literal["StickinessQuery"] = "StickinessQuery"
- modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
- properties: (
- list[
- EventPropertyFilter
- | PersonPropertyFilter
- | PersonMetadataPropertyFilter
- | ElementPropertyFilter
- | EventMetadataPropertyFilter
- | SessionPropertyFilter
- | CohortPropertyFilter
- | RecordingPropertyFilter
- | LogEntryPropertyFilter
- | GroupPropertyFilter
- | FeaturePropertyFilter
- | FlagPropertyFilter
- | HogQLPropertyFilter
- | EmptyPropertyFilter
- | DataWarehousePropertyFilter
- | DataWarehousePersonPropertyFilter
- | ErrorTrackingIssueFilter
- | LogPropertyFilter
- | MetricPropertyFilter
- | SpanPropertyFilter
- | RevenueAnalyticsPropertyFilter
- | WorkflowVariablePropertyFilter
- ]
- | PropertyGroupFilter
- | None
- ) = Field(default=[], description="Property filters for all series")
- response: StickinessQueryResponse | None = None
- samplingFactor: float | None = Field(default=None, description="Sampling rate")
- series: list[EventsNode | ActionsNode | DataWarehouseNode] = Field(..., description="Events and actions to include")
- stickinessFilter: StickinessFilter | None = Field(
- default=None, description="Properties specific to the stickiness insight"
- )
- tags: QueryLogTags | None = Field(default=None, description="Tags that will be added to the Query log comment")
- version: float | None = Field(default=None, description="version of the node, used for schema migrations")
-
-
class TeamTaxonomyQuery(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -25099,65 +25041,6 @@ class CachedErrorTrackingIssueCorrelationQueryResponse(BaseModel):
)
-class CalendarHeatmapQuery(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- aggregation_group_type_index: int | None = Field(default=None, description="Groups aggregation")
- calendarHeatmapFilter: CalendarHeatmapFilter | None = Field(
- default=None, description="Properties specific to the trends insight"
- )
- conversionGoal: ActionConversionGoal | CustomEventConversionGoal | None = Field(
- default=None,
- description="Whether we should be comparing against a specific conversion goal",
- )
- dataColorTheme: float | None = Field(default=None, description="Colors used in the insight's visualization")
- dateRange: DateRange | None = Field(default=None, description="Date range for the query")
- filterTestAccounts: bool | None = Field(
- default=False,
- description=("Exclude internal and test users by applying the respective filters"),
- )
- interval: IntervalType | None = Field(
- default=IntervalType.DAY,
- description=("Granularity of the response. Can be one of `hour`, `day`, `week` or `month`"),
- )
- kind: Literal["CalendarHeatmapQuery"] = "CalendarHeatmapQuery"
- modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
- properties: (
- list[
- EventPropertyFilter
- | PersonPropertyFilter
- | PersonMetadataPropertyFilter
- | ElementPropertyFilter
- | EventMetadataPropertyFilter
- | SessionPropertyFilter
- | CohortPropertyFilter
- | RecordingPropertyFilter
- | LogEntryPropertyFilter
- | GroupPropertyFilter
- | FeaturePropertyFilter
- | FlagPropertyFilter
- | HogQLPropertyFilter
- | EmptyPropertyFilter
- | DataWarehousePropertyFilter
- | DataWarehousePersonPropertyFilter
- | ErrorTrackingIssueFilter
- | LogPropertyFilter
- | MetricPropertyFilter
- | SpanPropertyFilter
- | RevenueAnalyticsPropertyFilter
- | WorkflowVariablePropertyFilter
- ]
- | PropertyGroupFilter
- | None
- ) = Field(default=[], description="Property filters for all series")
- response: CalendarHeatmapResponse | None = None
- samplingFactor: float | None = Field(default=None, description="Sampling rate")
- series: list[EventsNode | ActionsNode | DataWarehouseNode] = Field(..., description="Events and actions to include")
- tags: QueryLogTags | None = Field(default=None, description="Tags that will be added to the Query log comment")
- version: float | None = Field(default=None, description="version of the node, used for schema migrations")
-
-
class Response22(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -25301,7 +25184,7 @@ class DetectorConfig(
| LOFDetectorConfig
| OCSVMDetectorConfig
| PCADetectorConfig
- ) = Field(..., description="Detector configuration types")
+ ) = Field(..., description="Detector configuration types", discriminator="type")
class ErrorTrackingIssueCorrelationQuery(BaseModel):
@@ -25835,70 +25718,6 @@ class InsightsQueryBaseTrendsQueryResponse(BaseModel):
version: float | None = Field(default=None, description="version of the node, used for schema migrations")
-class LifecycleQuery(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- aggregation_group_type_index: int | None = Field(default=None, description="Groups aggregation")
- customAggregationTarget: bool | None = Field(
- default=None,
- description=(
- "For data warehouse based lifecycle insights when the aggregation target"
- " can't be mapped to persons or groups."
- ),
- )
- dataColorTheme: float | None = Field(default=None, description="Colors used in the insight's visualization")
- dateRange: DateRange | None = Field(default=None, description="Date range for the query")
- filterTestAccounts: bool | None = Field(
- default=False,
- description=("Exclude internal and test users by applying the respective filters"),
- )
- interval: IntervalType | None = Field(
- default=IntervalType.DAY,
- description=("Granularity of the response. Can be one of `hour`, `day`, `week` or `month`"),
- )
- kind: Literal["LifecycleQuery"] = "LifecycleQuery"
- lifecycleFilter: LifecycleFilter | None = Field(
- default=None, description="Properties specific to the lifecycle insight"
- )
- modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
- properties: (
- list[
- EventPropertyFilter
- | PersonPropertyFilter
- | PersonMetadataPropertyFilter
- | ElementPropertyFilter
- | EventMetadataPropertyFilter
- | SessionPropertyFilter
- | CohortPropertyFilter
- | RecordingPropertyFilter
- | LogEntryPropertyFilter
- | GroupPropertyFilter
- | FeaturePropertyFilter
- | FlagPropertyFilter
- | HogQLPropertyFilter
- | EmptyPropertyFilter
- | DataWarehousePropertyFilter
- | DataWarehousePersonPropertyFilter
- | ErrorTrackingIssueFilter
- | LogPropertyFilter
- | MetricPropertyFilter
- | SpanPropertyFilter
- | RevenueAnalyticsPropertyFilter
- | WorkflowVariablePropertyFilter
- ]
- | PropertyGroupFilter
- | None
- ) = Field(default=[], description="Property filters for all series")
- response: LifecycleQueryResponse | None = None
- samplingFactor: float | None = Field(default=None, description="Sampling rate")
- series: list[EventsNode | ActionsNode | LifecycleDataWarehouseNode] = Field(
- ..., description="Events and actions to include"
- )
- tags: QueryLogTags | None = Field(default=None, description="Tags that will be added to the Query log comment")
- version: float | None = Field(default=None, description="version of the node, used for schema migrations")
-
-
class LogAttributesQuery(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -26117,38 +25936,14 @@ class SessionsQuery(BaseModel):
where: list[str] | None = Field(default=None, description="HogQL filters to apply on returned data")
-class StickinessActorsQuery(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- compare: Compare | None = None
- day: str | int | None = None
- includeRecordings: bool | None = None
- kind: Literal["StickinessActorsQuery"] = "StickinessActorsQuery"
- modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
- operator: StickinessOperator | None = None
- response: ActorsQueryResponse | None = None
- series: int | None = None
- source: StickinessQuery
- tags: QueryLogTags | None = None
- version: float | None = Field(default=None, description="version of the node, used for schema migrations")
-
-
-class TrendsQuery(BaseModel):
+class CalendarHeatmapQuery(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
aggregation_group_type_index: int | None = Field(default=None, description="Groups aggregation")
- breakdownFilter: BreakdownFilter | None = Field(default=None, description="Breakdown of the events and actions")
calendarHeatmapFilter: CalendarHeatmapFilter | None = Field(
- default=None,
- description=(
- "Properties specific to the calendar heatmap display variant. Only"
- " consulted when `trendsFilter.display ==="
- " ChartDisplayType.CalendarHeatmap`; ignored otherwise."
- ),
+ default=None, description="Properties specific to the trends insight"
)
- compareFilter: CompareFilter | None = Field(default=None, description="Compare to date range")
conversionGoal: ActionConversionGoal | CustomEventConversionGoal | None = Field(
default=None,
description="Whether we should be comparing against a specific conversion goal",
@@ -26163,7 +25958,7 @@ class TrendsQuery(BaseModel):
default=IntervalType.DAY,
description=("Granularity of the response. Can be one of `hour`, `day`, `week` or `month`"),
)
- kind: Literal["TrendsQuery"] = "TrendsQuery"
+ kind: Literal["CalendarHeatmapQuery"] = "CalendarHeatmapQuery"
modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
properties: (
list[
@@ -26193,145 +25988,39 @@ class TrendsQuery(BaseModel):
| PropertyGroupFilter
| None
) = Field(default=[], description="Property filters for all series")
- response: TrendsQueryResponse | None = None
+ response: CalendarHeatmapResponse | None = None
samplingFactor: float | None = Field(default=None, description="Sampling rate")
- series: list[GroupNode | EventsNode | ActionsNode | DataWarehouseNode] = Field(
+ series: list[Annotated[EventsNode | ActionsNode | DataWarehouseNode, Field(discriminator="kind")]] = Field(
..., description="Events and actions to include"
)
tags: QueryLogTags | None = Field(default=None, description="Tags that will be added to the Query log comment")
- trendsFilter: TrendsFilter | None = Field(default=None, description="Properties specific to the trends insight")
version: float | None = Field(default=None, description="version of the node, used for schema migrations")
-class CachedExperimentTrendsQueryResponse(BaseModel):
+class ExperimentFunnelMetric(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
- cache_key: str
- cache_target_age: AwareDatetime | None = None
- calculation_trigger: str | None = Field(
- default=None,
- description=("What triggered the calculation of the query, leave empty if user/immediate"),
- )
- count_query: TrendsQuery | None = None
- credible_intervals: dict[str, list[float]]
- exposure_query: TrendsQuery | None = None
- insight: list[dict[str, Any]]
- is_cached: bool
- kind: Literal["ExperimentTrendsQuery"] = "ExperimentTrendsQuery"
- last_refresh: AwareDatetime
- next_allowed_client_refresh: AwareDatetime
- p_value: float
- probability: dict[str, float]
- query_metadata: dict[str, Any] | None = None
- query_status: QueryStatus | None = Field(
- default=None,
- description=("Query status indicates whether next to the provided data, a query is still running."),
- )
- significance_code: ExperimentSignificanceCode
- significant: bool
- stats_version: int | None = None
- timezone: str
- variants: list[ExperimentVariantTrendsBaseStats]
- warnings: list[DataWarehouseSyncWarning] | None = Field(
- default=None,
- description=("Data warehouse sync warnings — see AnalyticsQueryResponseBase.warnings for semantics."),
- )
-
-
-class Response24(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- count_query: TrendsQuery | None = None
- credible_intervals: dict[str, list[float]]
- exposure_query: TrendsQuery | None = None
- insight: list[dict[str, Any]]
- kind: Literal["ExperimentTrendsQuery"] = "ExperimentTrendsQuery"
- p_value: float
- probability: dict[str, float]
- significance_code: ExperimentSignificanceCode
- significant: bool
- stats_version: int | None = None
- variants: list[ExperimentVariantTrendsBaseStats]
- warnings: list[DataWarehouseSyncWarning] | None = Field(
- default=None,
- description=("Data warehouse sync warnings — see AnalyticsQueryResponseBase.warnings for semantics."),
- )
-
-
-class EndpointRequest(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- bucket_overrides: dict[str, str] | None = Field(
- default=None,
- description=(
- "Per-column bucket function overrides for range variable materialization."
- " Keys are column names, values are bucket keys (hour, day, week, month)."
- ),
- )
- data_freshness_seconds: int | None = Field(
- default=None,
- description=(
- "How fresh the data should be, in seconds. Controls cache TTL and materialization sync frequency."
- ),
- )
- deleted: bool | None = Field(default=None, description="Set to true to soft-delete this endpoint")
- derived_from_insight: str | None = None
- description: str | None = None
- is_active: bool | None = None
- is_materialized: bool | None = Field(
- default=None,
- description="Whether this endpoint's query results are materialized to S3",
- )
- name: str | None = None
- optional_breakdown_properties: list[str] | None = Field(
- default=None,
- description=(
- "Breakdown property names that may be omitted on /run. Omitted ones return"
- " data aggregated across all values of that breakdown."
- ),
- )
- query: HogQLQuery | TrendsQuery | RetentionQuery | LifecycleQuery | WebStatsTableQuery | WebOverviewQuery | None = (
- None
- )
- tags: list[str] | None = Field(
- default=None,
- description=(
- "Tag names to associate with this endpoint. Replaces any existing tags. Omit to leave tags untouched."
- ),
- )
- version: int | None = Field(
- default=None,
- description=("Target a specific version for updates (optional, defaults to current version)"),
- )
-
-
-class ExperimentFunnelMetric(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- breakdownFilter: BreakdownFilter | None = None
- conversion_window: int | None = None
- conversion_window_unit: FunnelConversionWindowTimeUnit | None = None
- fingerprint: str | None = None
- funnel_order_type: StepOrderValue | None = None
- goal: ExperimentMetricGoal | None = None
- isSharedMetric: bool | None = None
- kind: Literal["ExperimentMetric"] = "ExperimentMetric"
- metric_type: Literal["funnel"] = "funnel"
- name: str | None = None
- response: dict[str, Any] | None = None
- series: list[Annotated[EventsNode | ActionsNode | ExperimentDataWarehouseNode, Field(discriminator="kind")]]
- sharedMetricId: float | None = None
- uuid: str | None = None
- version: float | None = Field(default=None, description="version of the node, used for schema migrations")
-
-
-class ExperimentMeanMetric(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
+ breakdownFilter: BreakdownFilter | None = None
+ conversion_window: int | None = None
+ conversion_window_unit: FunnelConversionWindowTimeUnit | None = None
+ fingerprint: str | None = None
+ funnel_order_type: StepOrderValue | None = None
+ goal: ExperimentMetricGoal | None = None
+ isSharedMetric: bool | None = None
+ kind: Literal["ExperimentMetric"] = "ExperimentMetric"
+ metric_type: Literal["funnel"] = "funnel"
+ name: str | None = None
+ response: dict[str, Any] | None = None
+ series: list[Annotated[EventsNode | ActionsNode | ExperimentDataWarehouseNode, Field(discriminator="kind")]]
+ sharedMetricId: float | None = None
+ uuid: str | None = None
+ version: float | None = Field(default=None, description="version of the node, used for schema migrations")
+
+
+class ExperimentMeanMetric(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
)
breakdownFilter: BreakdownFilter | None = None
conversion_window: int | None = None
@@ -26415,46 +26104,68 @@ class ExperimentMetricTypeProps(
)
-class ExperimentTrendsQueryResponse(BaseModel):
+class LifecycleQuery(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
- count_query: TrendsQuery | None = None
- credible_intervals: dict[str, list[float]]
- exposure_query: TrendsQuery | None = None
- insight: list[dict[str, Any]]
- kind: Literal["ExperimentTrendsQuery"] = "ExperimentTrendsQuery"
- p_value: float
- probability: dict[str, float]
- significance_code: ExperimentSignificanceCode
- significant: bool
- stats_version: int | None = None
- variants: list[ExperimentVariantTrendsBaseStats]
- warnings: list[DataWarehouseSyncWarning] | None = Field(
+ aggregation_group_type_index: int | None = Field(default=None, description="Groups aggregation")
+ customAggregationTarget: bool | None = Field(
default=None,
- description=("Data warehouse sync warnings — see AnalyticsQueryResponseBase.warnings for semantics."),
+ description=(
+ "For data warehouse based lifecycle insights when the aggregation target"
+ " can't be mapped to persons or groups."
+ ),
)
-
-
-class QueryResponseAlternative19(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
+ dataColorTheme: float | None = Field(default=None, description="Colors used in the insight's visualization")
+ dateRange: DateRange | None = Field(default=None, description="Date range for the query")
+ filterTestAccounts: bool | None = Field(
+ default=False,
+ description=("Exclude internal and test users by applying the respective filters"),
)
- count_query: TrendsQuery | None = None
- credible_intervals: dict[str, list[float]]
- exposure_query: TrendsQuery | None = None
- insight: list[dict[str, Any]]
- kind: Literal["ExperimentTrendsQuery"] = "ExperimentTrendsQuery"
- p_value: float
- probability: dict[str, float]
- significance_code: ExperimentSignificanceCode
- significant: bool
- stats_version: int | None = None
- variants: list[ExperimentVariantTrendsBaseStats]
- warnings: list[DataWarehouseSyncWarning] | None = Field(
- default=None,
- description=("Data warehouse sync warnings — see AnalyticsQueryResponseBase.warnings for semantics."),
+ interval: IntervalType | None = Field(
+ default=IntervalType.DAY,
+ description=("Granularity of the response. Can be one of `hour`, `day`, `week` or `month`"),
+ )
+ kind: Literal["LifecycleQuery"] = "LifecycleQuery"
+ lifecycleFilter: LifecycleFilter | None = Field(
+ default=None, description="Properties specific to the lifecycle insight"
+ )
+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ properties: (
+ list[
+ EventPropertyFilter
+ | PersonPropertyFilter
+ | PersonMetadataPropertyFilter
+ | ElementPropertyFilter
+ | EventMetadataPropertyFilter
+ | SessionPropertyFilter
+ | CohortPropertyFilter
+ | RecordingPropertyFilter
+ | LogEntryPropertyFilter
+ | GroupPropertyFilter
+ | FeaturePropertyFilter
+ | FlagPropertyFilter
+ | HogQLPropertyFilter
+ | EmptyPropertyFilter
+ | DataWarehousePropertyFilter
+ | DataWarehousePersonPropertyFilter
+ | ErrorTrackingIssueFilter
+ | LogPropertyFilter
+ | MetricPropertyFilter
+ | SpanPropertyFilter
+ | RevenueAnalyticsPropertyFilter
+ | WorkflowVariablePropertyFilter
+ ]
+ | PropertyGroupFilter
+ | None
+ ) = Field(default=[], description="Property filters for all series")
+ response: LifecycleQueryResponse | None = None
+ samplingFactor: float | None = Field(default=None, description="Sampling rate")
+ series: list[Annotated[EventsNode | ActionsNode | LifecycleDataWarehouseNode, Field(discriminator="kind")]] = Field(
+ ..., description="Events and actions to include"
)
+ tags: QueryLogTags | None = Field(default=None, description="Tags that will be added to the Query log comment")
+ version: float | None = Field(default=None, description="version of the node, used for schema migrations")
class QueryResponseAlternative75(BaseModel):
@@ -26475,6 +26186,67 @@ class QueryResponseAlternative75(BaseModel):
]
+class StickinessQuery(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ compareFilter: CompareFilter | None = Field(default=None, description="Compare to date range")
+ dataColorTheme: float | None = Field(default=None, description="Colors used in the insight's visualization")
+ dateRange: DateRange | None = Field(default=None, description="Date range for the query")
+ filterTestAccounts: bool | None = Field(
+ default=False,
+ description=("Exclude internal and test users by applying the respective filters"),
+ )
+ interval: IntervalType | None = Field(
+ default=IntervalType.DAY,
+ description=("Granularity of the response. Can be one of `hour`, `day`, `week` or `month`"),
+ )
+ intervalCount: conint(ge=1) | None = Field(
+ default=None,
+ description=("How many intervals comprise a period. Only used for cohorts, otherwise default 1."),
+ )
+ kind: Literal["StickinessQuery"] = "StickinessQuery"
+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ properties: (
+ list[
+ EventPropertyFilter
+ | PersonPropertyFilter
+ | PersonMetadataPropertyFilter
+ | ElementPropertyFilter
+ | EventMetadataPropertyFilter
+ | SessionPropertyFilter
+ | CohortPropertyFilter
+ | RecordingPropertyFilter
+ | LogEntryPropertyFilter
+ | GroupPropertyFilter
+ | FeaturePropertyFilter
+ | FlagPropertyFilter
+ | HogQLPropertyFilter
+ | EmptyPropertyFilter
+ | DataWarehousePropertyFilter
+ | DataWarehousePersonPropertyFilter
+ | ErrorTrackingIssueFilter
+ | LogPropertyFilter
+ | MetricPropertyFilter
+ | SpanPropertyFilter
+ | RevenueAnalyticsPropertyFilter
+ | WorkflowVariablePropertyFilter
+ ]
+ | PropertyGroupFilter
+ | None
+ ) = Field(default=[], description="Property filters for all series")
+ response: StickinessQueryResponse | None = None
+ samplingFactor: float | None = Field(default=None, description="Sampling rate")
+ series: list[Annotated[EventsNode | ActionsNode | DataWarehouseNode, Field(discriminator="kind")]] = Field(
+ ..., description="Events and actions to include"
+ )
+ stickinessFilter: StickinessFilter | None = Field(
+ default=None, description="Properties specific to the stickiness insight"
+ )
+ tags: QueryLogTags | None = Field(default=None, description="Tags that will be added to the Query log comment")
+ version: float | None = Field(default=None, description="version of the node, used for schema migrations")
+
+
class DatabaseSchemaQueryResponse(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -26537,23 +26309,6 @@ class ExperimentQueryResponse(BaseModel):
)
-class ExperimentTrendsQuery(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- count_query: TrendsQuery
- experiment_id: int | None = None
- exposure_query: TrendsQuery | None = None
- fingerprint: str | None = None
- kind: Literal["ExperimentTrendsQuery"] = "ExperimentTrendsQuery"
- modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
- name: str | None = None
- response: ExperimentTrendsQueryResponse | None = None
- tags: QueryLogTags | None = None
- uuid: str | None = None
- version: float | None = Field(default=None, description="version of the node, used for schema migrations")
-
-
class LegacyExperimentQueryResponse(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -26608,8 +26363,94 @@ class QueryResponseAlternative20(BaseModel):
variants: list[ExperimentVariantTrendsBaseStats] | list[ExperimentVariantFunnelsBaseStats] | None = None
warnings: list[DataWarehouseSyncWarning] | None = Field(
default=None,
- description=("Data warehouse sync warnings — see AnalyticsQueryResponseBase.warnings for semantics."),
+ description=("Data warehouse sync warnings — see AnalyticsQueryResponseBase.warnings for semantics."),
+ )
+
+
+class StickinessActorsQuery(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ compare: Compare | None = None
+ day: str | int | None = None
+ includeRecordings: bool | None = None
+ kind: Literal["StickinessActorsQuery"] = "StickinessActorsQuery"
+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ operator: StickinessOperator | None = None
+ response: ActorsQueryResponse | None = None
+ series: int | None = None
+ source: StickinessQuery
+ tags: QueryLogTags | None = None
+ version: float | None = Field(default=None, description="version of the node, used for schema migrations")
+
+
+class TrendsQuery(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ aggregation_group_type_index: int | None = Field(default=None, description="Groups aggregation")
+ breakdownFilter: BreakdownFilter | None = Field(default=None, description="Breakdown of the events and actions")
+ calendarHeatmapFilter: CalendarHeatmapFilter | None = Field(
+ default=None,
+ description=(
+ "Properties specific to the calendar heatmap display variant. Only"
+ " consulted when `trendsFilter.display ==="
+ " ChartDisplayType.CalendarHeatmap`; ignored otherwise."
+ ),
+ )
+ compareFilter: CompareFilter | None = Field(default=None, description="Compare to date range")
+ conversionGoal: ActionConversionGoal | CustomEventConversionGoal | None = Field(
+ default=None,
+ description="Whether we should be comparing against a specific conversion goal",
+ )
+ dataColorTheme: float | None = Field(default=None, description="Colors used in the insight's visualization")
+ dateRange: DateRange | None = Field(default=None, description="Date range for the query")
+ filterTestAccounts: bool | None = Field(
+ default=False,
+ description=("Exclude internal and test users by applying the respective filters"),
+ )
+ interval: IntervalType | None = Field(
+ default=IntervalType.DAY,
+ description=("Granularity of the response. Can be one of `hour`, `day`, `week` or `month`"),
+ )
+ kind: Literal["TrendsQuery"] = "TrendsQuery"
+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ properties: (
+ list[
+ EventPropertyFilter
+ | PersonPropertyFilter
+ | PersonMetadataPropertyFilter
+ | ElementPropertyFilter
+ | EventMetadataPropertyFilter
+ | SessionPropertyFilter
+ | CohortPropertyFilter
+ | RecordingPropertyFilter
+ | LogEntryPropertyFilter
+ | GroupPropertyFilter
+ | FeaturePropertyFilter
+ | FlagPropertyFilter
+ | HogQLPropertyFilter
+ | EmptyPropertyFilter
+ | DataWarehousePropertyFilter
+ | DataWarehousePersonPropertyFilter
+ | ErrorTrackingIssueFilter
+ | LogPropertyFilter
+ | MetricPropertyFilter
+ | SpanPropertyFilter
+ | RevenueAnalyticsPropertyFilter
+ | WorkflowVariablePropertyFilter
+ ]
+ | PropertyGroupFilter
+ | None
+ ) = Field(default=[], description="Property filters for all series")
+ response: TrendsQueryResponse | None = None
+ samplingFactor: float | None = Field(default=None, description="Sampling rate")
+ series: list[Annotated[EventsNode | ActionsNode | DataWarehouseNode | GroupNode, Field(discriminator="kind")]] = (
+ Field(..., description="Events and actions to include")
)
+ tags: QueryLogTags | None = Field(default=None, description="Tags that will be added to the Query log comment")
+ trendsFilter: TrendsFilter | None = Field(default=None, description="Properties specific to the trends insight")
+ version: float | None = Field(default=None, description="version of the node, used for schema migrations")
class NamedArgs1(BaseModel):
@@ -26688,6 +26529,42 @@ class CachedExperimentQueryResponse(BaseModel):
)
+class CachedExperimentTrendsQueryResponse(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ cache_key: str
+ cache_target_age: AwareDatetime | None = None
+ calculation_trigger: str | None = Field(
+ default=None,
+ description=("What triggered the calculation of the query, leave empty if user/immediate"),
+ )
+ count_query: TrendsQuery | None = None
+ credible_intervals: dict[str, list[float]]
+ exposure_query: TrendsQuery | None = None
+ insight: list[dict[str, Any]]
+ is_cached: bool
+ kind: Literal["ExperimentTrendsQuery"] = "ExperimentTrendsQuery"
+ last_refresh: AwareDatetime
+ next_allowed_client_refresh: AwareDatetime
+ p_value: float
+ probability: dict[str, float]
+ query_metadata: dict[str, Any] | None = None
+ query_status: QueryStatus | None = Field(
+ default=None,
+ description=("Query status indicates whether next to the provided data, a query is still running."),
+ )
+ significance_code: ExperimentSignificanceCode
+ significant: bool
+ stats_version: int | None = None
+ timezone: str
+ variants: list[ExperimentVariantTrendsBaseStats]
+ warnings: list[DataWarehouseSyncWarning] | None = Field(
+ default=None,
+ description=("Data warehouse sync warnings — see AnalyticsQueryResponseBase.warnings for semantics."),
+ )
+
+
class CachedLegacyExperimentQueryResponse(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -26725,6 +26602,27 @@ class CachedLegacyExperimentQueryResponse(BaseModel):
)
+class Response24(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ count_query: TrendsQuery | None = None
+ credible_intervals: dict[str, list[float]]
+ exposure_query: TrendsQuery | None = None
+ insight: list[dict[str, Any]]
+ kind: Literal["ExperimentTrendsQuery"] = "ExperimentTrendsQuery"
+ p_value: float
+ probability: dict[str, float]
+ significance_code: ExperimentSignificanceCode
+ significant: bool
+ stats_version: int | None = None
+ variants: list[ExperimentVariantTrendsBaseStats]
+ warnings: list[DataWarehouseSyncWarning] | None = Field(
+ default=None,
+ description=("Data warehouse sync warnings — see AnalyticsQueryResponseBase.warnings for semantics."),
+ )
+
+
class DatabaseSchemaQuery(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -26740,6 +26638,54 @@ class DatabaseSchemaQuery(BaseModel):
version: float | None = Field(default=None, description="version of the node, used for schema migrations")
+class EndpointRequest(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ bucket_overrides: dict[str, str] | None = Field(
+ default=None,
+ description=(
+ "Per-column bucket function overrides for range variable materialization."
+ " Keys are column names, values are bucket keys (hour, day, week, month)."
+ ),
+ )
+ data_freshness_seconds: int | None = Field(
+ default=None,
+ description=(
+ "How fresh the data should be, in seconds. Controls cache TTL and materialization sync frequency."
+ ),
+ )
+ deleted: bool | None = Field(default=None, description="Set to true to soft-delete this endpoint")
+ derived_from_insight: str | None = None
+ description: str | None = None
+ is_active: bool | None = None
+ is_materialized: bool | None = Field(
+ default=None,
+ description="Whether this endpoint's query results are materialized to S3",
+ )
+ name: str | None = None
+ optional_breakdown_properties: list[str] | None = Field(
+ default=None,
+ description=(
+ "Breakdown property names that may be omitted on /run. Omitted ones return"
+ " data aggregated across all values of that breakdown."
+ ),
+ )
+ query: HogQLQuery | TrendsQuery | RetentionQuery | LifecycleQuery | WebStatsTableQuery | WebOverviewQuery | None = (
+ None
+ )
+ tags: list[str] | None = Field(
+ default=None,
+ description=(
+ "Tag names to associate with this endpoint. Replaces any existing tags. Omit to leave tags untouched."
+ ),
+ )
+ version: int | None = Field(
+ default=None,
+ description=("Target a specific version for updates (optional, defaults to current version)"),
+ )
+
+
class ExperimentMetricTimeseries(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -26773,6 +26719,27 @@ class ExperimentQuery(BaseModel):
version: float | None = Field(default=None, description="version of the node, used for schema migrations")
+class ExperimentTrendsQueryResponse(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ count_query: TrendsQuery | None = None
+ credible_intervals: dict[str, list[float]]
+ exposure_query: TrendsQuery | None = None
+ insight: list[dict[str, Any]]
+ kind: Literal["ExperimentTrendsQuery"] = "ExperimentTrendsQuery"
+ p_value: float
+ probability: dict[str, float]
+ significance_code: ExperimentSignificanceCode
+ significant: bool
+ stats_version: int | None = None
+ variants: list[ExperimentVariantTrendsBaseStats]
+ warnings: list[DataWarehouseSyncWarning] | None = Field(
+ default=None,
+ description=("Data warehouse sync warnings — see AnalyticsQueryResponseBase.warnings for semantics."),
+ )
+
+
class FunnelsQuery(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -26850,6 +26817,68 @@ class QueryResponseAlternative18(BaseModel):
)
+class QueryResponseAlternative19(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ count_query: TrendsQuery | None = None
+ credible_intervals: dict[str, list[float]]
+ exposure_query: TrendsQuery | None = None
+ insight: list[dict[str, Any]]
+ kind: Literal["ExperimentTrendsQuery"] = "ExperimentTrendsQuery"
+ p_value: float
+ probability: dict[str, float]
+ significance_code: ExperimentSignificanceCode
+ significant: bool
+ stats_version: int | None = None
+ variants: list[ExperimentVariantTrendsBaseStats]
+ warnings: list[DataWarehouseSyncWarning] | None = Field(
+ default=None,
+ description=("Data warehouse sync warnings — see AnalyticsQueryResponseBase.warnings for semantics."),
+ )
+
+
+class QueryResponseAlternative62(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ credible_intervals: dict[str, list[float]]
+ expected_loss: float
+ funnels_query: FunnelsQuery | None = None
+ insight: list[list[dict[str, Any]]]
+ kind: Literal["ExperimentFunnelsQuery"] = "ExperimentFunnelsQuery"
+ probability: dict[str, float]
+ significance_code: ExperimentSignificanceCode
+ significant: bool
+ stats_version: int | None = None
+ variants: list[ExperimentVariantFunnelsBaseStats]
+ warnings: list[DataWarehouseSyncWarning] | None = Field(
+ default=None,
+ description=("Data warehouse sync warnings — see AnalyticsQueryResponseBase.warnings for semantics."),
+ )
+
+
+class QueryResponseAlternative63(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ count_query: TrendsQuery | None = None
+ credible_intervals: dict[str, list[float]]
+ exposure_query: TrendsQuery | None = None
+ insight: list[dict[str, Any]]
+ kind: Literal["ExperimentTrendsQuery"] = "ExperimentTrendsQuery"
+ p_value: float
+ probability: dict[str, float]
+ significance_code: ExperimentSignificanceCode
+ significant: bool
+ stats_version: int | None = None
+ variants: list[ExperimentVariantTrendsBaseStats]
+ warnings: list[DataWarehouseSyncWarning] | None = Field(
+ default=None,
+ description=("Data warehouse sync warnings — see AnalyticsQueryResponseBase.warnings for semantics."),
+ )
+
+
class QueryResponseAlternative(
RootModel[
dict[str, Any]
@@ -26911,6 +26940,8 @@ class QueryResponseAlternative(
| QueryResponseAlternative58
| QueryResponseAlternative59
| QueryResponseAlternative60
+ | QueryResponseAlternative62
+ | QueryResponseAlternative63
| QueryResponseAlternative64
| QueryResponseAlternative66
| QueryResponseAlternative67
@@ -27013,6 +27044,8 @@ class QueryResponseAlternative(
| QueryResponseAlternative58
| QueryResponseAlternative59
| QueryResponseAlternative60
+ | QueryResponseAlternative62
+ | QueryResponseAlternative63
| QueryResponseAlternative64
| QueryResponseAlternative66
| QueryResponseAlternative67
@@ -27169,6 +27202,23 @@ class ExperimentFunnelsQueryResponse(BaseModel):
)
+class ExperimentTrendsQuery(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ count_query: TrendsQuery
+ experiment_id: int | None = None
+ exposure_query: TrendsQuery | None = None
+ fingerprint: str | None = None
+ kind: Literal["ExperimentTrendsQuery"] = "ExperimentTrendsQuery"
+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ name: str | None = None
+ response: ExperimentTrendsQueryResponse | None = None
+ tags: QueryLogTags | None = None
+ uuid: str | None = None
+ version: float | None = Field(default=None, description="version of the node, used for schema migrations")
+
+
class FunnelPathsFilter(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -28046,7 +28096,7 @@ class DataTableNode(BaseModel):
| SessionQuery
| EndpointsUsageTableQuery
| AccountsQuery
- ) = Field(..., description="Source of the events")
+ ) = Field(..., description="Source of the events", discriminator="kind")
tags: QueryLogTags | None = None
version: float | None = Field(default=None, description="version of the node, used for schema migrations")
@@ -28156,7 +28206,11 @@ class HogQLAutocomplete(BaseModel):
| MCPToolSampleIntentsQuery
| MCPToolNeighborsQuery
| None
- ) = Field(default=None, description="Query in whose context to validate.")
+ ) = Field(
+ default=None,
+ description="Query in whose context to validate.",
+ discriminator="kind",
+ )
startPosition: int = Field(..., description="Start position of the editor word")
tags: QueryLogTags | None = None
version: float | None = Field(default=None, description="version of the node, used for schema migrations")
@@ -28258,6 +28312,7 @@ class HogQLMetadata(BaseModel):
) = Field(
default=None,
description=('Query within which "expr" and "template" are validated. Defaults to "select * from events"'),
+ discriminator="kind",
)
tags: QueryLogTags | None = None
variables: dict[str, HogQLVariable] | None = Field(
diff --git a/posthog/test/test_query_schema_discriminators.py b/posthog/test/test_query_schema_discriminators.py
new file mode 100644
index 000000000000..4b8138b9738e
--- /dev/null
+++ b/posthog/test/test_query_schema_discriminators.py
@@ -0,0 +1,173 @@
+from django.test.testcases import SimpleTestCase
+
+from parameterized import parameterized
+from pydantic import BaseModel, ValidationError
+
+from posthog.schema import (
+ CalendarHeatmapQuery,
+ DataTableNode,
+ DetectorConfig,
+ FunnelsFilter,
+ HogQLMetadata,
+ LifecycleQuery,
+ StickinessQuery,
+ TrendsQuery,
+)
+
+# Companion to test_funnels_series_discriminator.py, which pins the detailed error
+# shapes of the discriminator mechanism for one site. Each union here was made a
+# discriminated union separately (JSDoc @discriminator tag + schema regeneration),
+# so each site needs its own canary: `union_tag_invalid` is only ever produced by a
+# discriminated union, so these fail if a regeneration drops any single site back
+# to undiscriminated validation (error explosion + silent first-member coercion).
+
+_BAD_TAG = {"kind": "banana"}
+
+
+class TestQuerySchemaDiscriminators(SimpleTestCase):
+ @parameterized.expand(
+ [
+ # (case_name, model, payload, field_with_tagged_union)
+ ("trends_series", TrendsQuery, {"kind": "TrendsQuery", "series": [_BAD_TAG]}, "series"),
+ ("stickiness_series", StickinessQuery, {"kind": "StickinessQuery", "series": [_BAD_TAG]}, "series"),
+ ("lifecycle_series", LifecycleQuery, {"kind": "LifecycleQuery", "series": [_BAD_TAG]}, "series"),
+ (
+ "calendar_heatmap_series",
+ CalendarHeatmapQuery,
+ {"kind": "CalendarHeatmapQuery", "series": [_BAD_TAG]},
+ "series",
+ ),
+ ("funnel_exclusions", FunnelsFilter, {"exclusions": [_BAD_TAG]}, "exclusions"),
+ ("data_table_source", DataTableNode, {"kind": "DataTableNode", "source": _BAD_TAG}, "source"),
+ (
+ "hogql_metadata_source_query",
+ HogQLMetadata,
+ {"kind": "HogQLMetadata", "language": "hogQL", "query": "select 1", "sourceQuery": _BAD_TAG},
+ "sourceQuery",
+ ),
+ ("detector_config_root", DetectorConfig, {"type": "banana"}, None),
+ (
+ "ensemble_sub_detectors",
+ DetectorConfig,
+ {"type": "ensemble", "operator": "and", "detectors": [{"type": "banana"}]},
+ "detectors",
+ ),
+ ]
+ )
+ def test_unknown_tag_returns_single_union_tag_error(
+ self, _name: str, model: type[BaseModel], payload: dict, field: str | None
+ ) -> None:
+ with self.assertRaises(ValidationError) as ctx:
+ model.model_validate(payload)
+
+ errors = ctx.exception.errors()
+ assert len(errors) == 1, f"expected exactly one error, got {len(errors)}: {errors}"
+ assert errors[0]["type"] == "union_tag_invalid", (
+ f"expected union_tag_invalid (discriminator likely dropped), got {errors[0]['type']!r}: {errors[0]}"
+ )
+ if field is not None:
+ assert field in errors[0]["loc"], f"expected error under {field!r}, got loc {errors[0]['loc']!r}"
+
+ @parameterized.expand(
+ [
+ # (case_name, model, payload) — the union member's tag field has a pydantic
+ # default, but discriminated unions require the tag in the raw input; these pin
+ # the intentional rejection of tag-less payloads (previously silent coercion to
+ # the first structurally-matching member).
+ ("trends_series", TrendsQuery, {"kind": "TrendsQuery", "series": [{"event": "$pageview"}]}),
+ ("stickiness_series", StickinessQuery, {"kind": "StickinessQuery", "series": [{"event": "$pageview"}]}),
+ ("lifecycle_series", LifecycleQuery, {"kind": "LifecycleQuery", "series": [{"event": "$pageview"}]}),
+ (
+ "calendar_heatmap_series",
+ CalendarHeatmapQuery,
+ {"kind": "CalendarHeatmapQuery", "series": [{"event": "$pageview"}]},
+ ),
+ (
+ "funnel_exclusions",
+ FunnelsFilter,
+ {"exclusions": [{"event": "$pageview", "funnelFromStep": 0, "funnelToStep": 1}]},
+ ),
+ ("data_table_source", DataTableNode, {"kind": "DataTableNode", "source": {"query": "select 1"}}),
+ (
+ "hogql_metadata_source_query",
+ HogQLMetadata,
+ {"kind": "HogQLMetadata", "language": "hogQL", "query": "select 1", "sourceQuery": {"select": ["*"]}},
+ ),
+ ("detector_config_root", DetectorConfig, {"threshold": 0.9}),
+ (
+ "ensemble_sub_detectors",
+ DetectorConfig,
+ {"type": "ensemble", "operator": "and", "detectors": [{"threshold": 0.9}]},
+ ),
+ ]
+ )
+ def test_missing_tag_returns_single_union_tag_error(
+ self, _name: str, model: type[BaseModel], payload: dict
+ ) -> None:
+ with self.assertRaises(ValidationError) as ctx:
+ model.model_validate(payload)
+
+ errors = ctx.exception.errors()
+ assert len(errors) == 1, f"expected exactly one error, got {len(errors)}: {errors}"
+ assert errors[0]["type"] == "union_tag_not_found", (
+ f"expected union_tag_not_found (tag-less payload must be rejected, not coerced), got {errors[0]['type']!r}: {errors[0]}"
+ )
+
+ @parameterized.expand(
+ [
+ (
+ "trends_series",
+ TrendsQuery,
+ {
+ "kind": "TrendsQuery",
+ "series": [
+ {"kind": "EventsNode", "event": "$pageview"},
+ {"kind": "GroupNode", "operator": "AND", "nodes": [{"kind": "ActionsNode", "id": 1}]},
+ ],
+ },
+ ),
+ (
+ "stickiness_series",
+ StickinessQuery,
+ {"kind": "StickinessQuery", "series": [{"kind": "ActionsNode", "id": 1}]},
+ ),
+ (
+ "lifecycle_series",
+ LifecycleQuery,
+ {"kind": "LifecycleQuery", "series": [{"kind": "EventsNode", "event": "$pageview"}]},
+ ),
+ (
+ "calendar_heatmap_series",
+ CalendarHeatmapQuery,
+ {"kind": "CalendarHeatmapQuery", "series": [{"kind": "EventsNode", "event": "$pageview"}]},
+ ),
+ (
+ "funnel_exclusions",
+ FunnelsFilter,
+ {"exclusions": [{"kind": "EventsNode", "event": "$pageview", "funnelFromStep": 0, "funnelToStep": 1}]},
+ ),
+ (
+ "data_table_source",
+ DataTableNode,
+ {"kind": "DataTableNode", "source": {"kind": "HogQLQuery", "query": "select 1"}},
+ ),
+ (
+ "hogql_metadata_source_query",
+ HogQLMetadata,
+ {
+ "kind": "HogQLMetadata",
+ "language": "hogQL",
+ "query": "select 1",
+ "sourceQuery": {"kind": "EventsQuery", "select": ["*"]},
+ },
+ ),
+ ("detector_config_single", DetectorConfig, {"type": "zscore", "threshold": 0.9}),
+ (
+ "detector_config_ensemble",
+ DetectorConfig,
+ {"type": "ensemble", "operator": "and", "detectors": [{"type": "zscore"}, {"type": "mad"}]},
+ ),
+ ]
+ )
+ def test_valid_payload_still_validates(self, _name: str, model: type[BaseModel], payload: dict) -> None:
+ model.model_validate(payload)
diff --git a/products/alerts/frontend/generated/api.schemas.ts b/products/alerts/frontend/generated/api.schemas.ts
index 1e62a0daaea7..2e6b6df02d83 100644
--- a/products/alerts/frontend/generated/api.schemas.ts
+++ b/products/alerts/frontend/generated/api.schemas.ts
@@ -269,66 +269,110 @@ export interface PreprocessingConfigApi {
smooth_n?: number | null
}
+export type ZScoreDetectorConfigApiType = (typeof ZScoreDetectorConfigApiType)[keyof typeof ZScoreDetectorConfigApiType]
+
+export const ZScoreDetectorConfigApiType = {
+ Zscore: 'zscore',
+} as const
+
export interface ZScoreDetectorConfigApi {
/** Preprocessing transforms applied before detection */
preprocessing?: PreprocessingConfigApi | null
/** Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9) */
threshold?: number | null
- type?: 'zscore'
+ type: ZScoreDetectorConfigApiType
/** Rolling window size for calculating mean/std (default: 30) */
window?: number | null
}
+export type MADDetectorConfigApiType = (typeof MADDetectorConfigApiType)[keyof typeof MADDetectorConfigApiType]
+
+export const MADDetectorConfigApiType = {
+ Mad: 'mad',
+} as const
+
export interface MADDetectorConfigApi {
/** Preprocessing transforms applied before detection */
preprocessing?: PreprocessingConfigApi | null
/** Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9) */
threshold?: number | null
- type?: 'mad'
+ type: MADDetectorConfigApiType
/** Rolling window size for calculating median/MAD (default: 30) */
window?: number | null
}
+export type IQRDetectorConfigApiType = (typeof IQRDetectorConfigApiType)[keyof typeof IQRDetectorConfigApiType]
+
+export const IQRDetectorConfigApiType = {
+ Iqr: 'iqr',
+} as const
+
export interface IQRDetectorConfigApi {
/** IQR multiplier for fence calculation (default: 1.5, use 3.0 for far outliers) */
multiplier?: number | null
/** Preprocessing transforms applied before detection */
preprocessing?: PreprocessingConfigApi | null
- type?: 'iqr'
+ type: IQRDetectorConfigApiType
/** Rolling window size for calculating quartiles (default: 30) */
window?: number | null
}
+export type ThresholdDetectorConfigApiType =
+ (typeof ThresholdDetectorConfigApiType)[keyof typeof ThresholdDetectorConfigApiType]
+
+export const ThresholdDetectorConfigApiType = {
+ Threshold: 'threshold',
+} as const
+
export interface ThresholdDetectorConfigApi {
/** Lower bound - values below this are anomalies */
lower_bound?: number | null
/** Preprocessing transforms applied before detection */
preprocessing?: PreprocessingConfigApi | null
- type?: 'threshold'
+ type: ThresholdDetectorConfigApiType
/** Upper bound - values above this are anomalies */
upper_bound?: number | null
}
+export type ECODDetectorConfigApiType = (typeof ECODDetectorConfigApiType)[keyof typeof ECODDetectorConfigApiType]
+
+export const ECODDetectorConfigApiType = {
+ Ecod: 'ecod',
+} as const
+
export interface ECODDetectorConfigApi {
/** Preprocessing transforms applied before detection */
preprocessing?: PreprocessingConfigApi | null
/** Anomaly probability threshold (default: 0.9) */
threshold?: number | null
- type?: 'ecod'
+ type: ECODDetectorConfigApiType
/** Rolling window size — how many historical data points to train on (default: based on calculation interval) */
window?: number | null
}
+export type COPODDetectorConfigApiType = (typeof COPODDetectorConfigApiType)[keyof typeof COPODDetectorConfigApiType]
+
+export const COPODDetectorConfigApiType = {
+ Copod: 'copod',
+} as const
+
export interface COPODDetectorConfigApi {
/** Preprocessing transforms applied before detection */
preprocessing?: PreprocessingConfigApi | null
/** Anomaly probability threshold (default: 0.9) */
threshold?: number | null
- type?: 'copod'
+ type: COPODDetectorConfigApiType
/** Rolling window size — how many historical data points to train on (default: based on calculation interval) */
window?: number | null
}
+export type IsolationForestDetectorConfigApiType =
+ (typeof IsolationForestDetectorConfigApiType)[keyof typeof IsolationForestDetectorConfigApiType]
+
+export const IsolationForestDetectorConfigApiType = {
+ IsolationForest: 'isolation_forest',
+} as const
+
export interface IsolationForestDetectorConfigApi {
/** Number of trees in the forest (default: 100) */
n_estimators?: number | null
@@ -336,7 +380,7 @@ export interface IsolationForestDetectorConfigApi {
preprocessing?: PreprocessingConfigApi | null
/** Anomaly probability threshold (default: 0.9) */
threshold?: number | null
- type?: 'isolation_forest'
+ type: IsolationForestDetectorConfigApiType
/** Rolling window size — how many historical data points to train on (default: based on calculation interval) */
window?: number | null
}
@@ -349,6 +393,12 @@ export const MethodApi = {
Median: 'median',
} as const
+export type KNNDetectorConfigApiType = (typeof KNNDetectorConfigApiType)[keyof typeof KNNDetectorConfigApiType]
+
+export const KNNDetectorConfigApiType = {
+ Knn: 'knn',
+} as const
+
export interface KNNDetectorConfigApi {
/** Distance method: 'largest', 'mean', 'median' (default: 'largest') */
method?: MethodApi | null
@@ -358,11 +408,17 @@ export interface KNNDetectorConfigApi {
preprocessing?: PreprocessingConfigApi | null
/** Anomaly probability threshold (default: 0.9) */
threshold?: number | null
- type?: 'knn'
+ type: KNNDetectorConfigApiType
/** Rolling window size — how many historical data points to train on (default: based on calculation interval) */
window?: number | null
}
+export type HBOSDetectorConfigApiType = (typeof HBOSDetectorConfigApiType)[keyof typeof HBOSDetectorConfigApiType]
+
+export const HBOSDetectorConfigApiType = {
+ Hbos: 'hbos',
+} as const
+
export interface HBOSDetectorConfigApi {
/** Number of histogram bins (default: 10) */
n_bins?: number | null
@@ -370,11 +426,17 @@ export interface HBOSDetectorConfigApi {
preprocessing?: PreprocessingConfigApi | null
/** Anomaly probability threshold (default: 0.9) */
threshold?: number | null
- type?: 'hbos'
+ type: HBOSDetectorConfigApiType
/** Rolling window size — how many historical data points to train on (default: based on calculation interval) */
window?: number | null
}
+export type LOFDetectorConfigApiType = (typeof LOFDetectorConfigApiType)[keyof typeof LOFDetectorConfigApiType]
+
+export const LOFDetectorConfigApiType = {
+ Lof: 'lof',
+} as const
+
export interface LOFDetectorConfigApi {
/** Number of neighbors for LOF (default: 20) */
n_neighbors?: number | null
@@ -382,11 +444,17 @@ export interface LOFDetectorConfigApi {
preprocessing?: PreprocessingConfigApi | null
/** Anomaly probability threshold (default: 0.9) */
threshold?: number | null
- type?: 'lof'
+ type: LOFDetectorConfigApiType
/** Rolling window size — how many historical data points to train on (default: based on calculation interval) */
window?: number | null
}
+export type OCSVMDetectorConfigApiType = (typeof OCSVMDetectorConfigApiType)[keyof typeof OCSVMDetectorConfigApiType]
+
+export const OCSVMDetectorConfigApiType = {
+ Ocsvm: 'ocsvm',
+} as const
+
export interface OCSVMDetectorConfigApi {
/** SVM kernel type (default: "rbf") */
kernel?: string | null
@@ -396,17 +464,23 @@ export interface OCSVMDetectorConfigApi {
preprocessing?: PreprocessingConfigApi | null
/** Anomaly probability threshold (default: 0.9) */
threshold?: number | null
- type?: 'ocsvm'
+ type: OCSVMDetectorConfigApiType
/** Rolling window size — how many historical data points to train on (default: based on calculation interval) */
window?: number | null
}
+export type PCADetectorConfigApiType = (typeof PCADetectorConfigApiType)[keyof typeof PCADetectorConfigApiType]
+
+export const PCADetectorConfigApiType = {
+ Pca: 'pca',
+} as const
+
export interface PCADetectorConfigApi {
/** Preprocessing transforms applied before detection */
preprocessing?: PreprocessingConfigApi | null
/** Anomaly probability threshold (default: 0.9) */
threshold?: number | null
- type?: 'pca'
+ type: PCADetectorConfigApiType
/** Rolling window size — how many historical data points to train on (default: based on calculation interval) */
window?: number | null
}
@@ -418,6 +492,13 @@ export const EnsembleOperatorApi = {
Or: 'or',
} as const
+export type EnsembleDetectorConfigApiType =
+ (typeof EnsembleDetectorConfigApiType)[keyof typeof EnsembleDetectorConfigApiType]
+
+export const EnsembleDetectorConfigApiType = {
+ Ensemble: 'ensemble',
+} as const
+
export interface EnsembleDetectorConfigApi {
/** Sub-detector configurations (minimum 2) */
detectors: (
@@ -436,7 +517,7 @@ export interface EnsembleDetectorConfigApi {
)[]
/** How to combine sub-detector results */
operator: EnsembleOperatorApi
- type?: 'ensemble'
+ type: EnsembleDetectorConfigApiType
}
/**
diff --git a/products/alerts/frontend/generated/api.zod.ts b/products/alerts/frontend/generated/api.zod.ts
index 18de19a98cb7..d756a85aee42 100644
--- a/products/alerts/frontend/generated/api.zod.ts
+++ b/products/alerts/frontend/generated/api.zod.ts
@@ -97,7 +97,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
'Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)'
),
type: zod
- .literal('zscore')
+ .enum(['zscore'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemOneTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -138,7 +138,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
'Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)'
),
type: zod
- .literal('mad')
+ .enum(['mad'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemTwoTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -179,7 +179,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Preprocessing transforms applied before detection'),
type: zod
- .literal('iqr')
+ .enum(['iqr'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemThreeTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -218,7 +218,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Preprocessing transforms applied before detection'),
type: zod
- .literal('threshold')
+ .enum(['threshold'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemFourTypeDefault),
upper_bound: zod
.union([zod.number(), zod.null()])
@@ -257,7 +257,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('ecod')
+ .enum(['ecod'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemFiveTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -298,7 +298,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('copod')
+ .enum(['copod'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemSixTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -343,7 +343,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('isolation_forest')
+ .enum(['isolation_forest'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemSevenTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -392,7 +392,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('knn')
+ .enum(['knn'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemEightTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -437,7 +437,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('hbos')
+ .enum(['hbos'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemNineTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -482,7 +482,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('lof')
+ .enum(['lof'])
.default(
alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemOnezeroTypeDefault
),
@@ -533,7 +533,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('ocsvm')
+ .enum(['ocsvm'])
.default(
alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemOneoneTypeDefault
),
@@ -576,7 +576,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('pca')
+ .enum(['pca'])
.default(
alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemOnetwoTypeDefault
),
@@ -591,7 +591,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
)
.describe('Sub-detector configurations (minimum 2)'),
operator: zod.enum(['and', 'or']).describe('How to combine sub-detector results'),
- type: zod.literal('ensemble').default(alertsSimulateCreateBodyDetectorConfigOneOneTypeDefault),
+ type: zod.enum(['ensemble']).default(alertsSimulateCreateBodyDetectorConfigOneOneTypeDefault),
}),
zod.object({
preprocessing: zod
@@ -624,7 +624,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.describe(
'Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)'
),
- type: zod.literal('zscore').default(alertsSimulateCreateBodyDetectorConfigOneTwoTypeDefault),
+ type: zod.enum(['zscore']).default(alertsSimulateCreateBodyDetectorConfigOneTwoTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -661,7 +661,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.describe(
'Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)'
),
- type: zod.literal('mad').default(alertsSimulateCreateBodyDetectorConfigOneThreeTypeDefault),
+ type: zod.enum(['mad']).default(alertsSimulateCreateBodyDetectorConfigOneThreeTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -696,7 +696,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
])
.optional()
.describe('Preprocessing transforms applied before detection'),
- type: zod.literal('iqr').default(alertsSimulateCreateBodyDetectorConfigOneFourTypeDefault),
+ type: zod.enum(['iqr']).default(alertsSimulateCreateBodyDetectorConfigOneFourTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -731,7 +731,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
])
.optional()
.describe('Preprocessing transforms applied before detection'),
- type: zod.literal('threshold').default(alertsSimulateCreateBodyDetectorConfigOneFiveTypeDefault),
+ type: zod.enum(['threshold']).default(alertsSimulateCreateBodyDetectorConfigOneFiveTypeDefault),
upper_bound: zod
.union([zod.number(), zod.null()])
.optional()
@@ -766,7 +766,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('ecod').default(alertsSimulateCreateBodyDetectorConfigOneSixTypeDefault),
+ type: zod.enum(['ecod']).default(alertsSimulateCreateBodyDetectorConfigOneSixTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -803,7 +803,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('copod').default(alertsSimulateCreateBodyDetectorConfigOneSevenTypeDefault),
+ type: zod.enum(['copod']).default(alertsSimulateCreateBodyDetectorConfigOneSevenTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -844,9 +844,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod
- .literal('isolation_forest')
- .default(alertsSimulateCreateBodyDetectorConfigOneEightTypeDefault),
+ type: zod.enum(['isolation_forest']).default(alertsSimulateCreateBodyDetectorConfigOneEightTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -891,7 +889,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('knn').default(alertsSimulateCreateBodyDetectorConfigOneNineTypeDefault),
+ type: zod.enum(['knn']).default(alertsSimulateCreateBodyDetectorConfigOneNineTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -932,7 +930,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('hbos').default(alertsSimulateCreateBodyDetectorConfigOneOnezeroTypeDefault),
+ type: zod.enum(['hbos']).default(alertsSimulateCreateBodyDetectorConfigOneOnezeroTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -973,7 +971,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('lof').default(alertsSimulateCreateBodyDetectorConfigOneOneoneTypeDefault),
+ type: zod.enum(['lof']).default(alertsSimulateCreateBodyDetectorConfigOneOneoneTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -1015,7 +1013,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('ocsvm').default(alertsSimulateCreateBodyDetectorConfigOneOnetwoTypeDefault),
+ type: zod.enum(['ocsvm']).default(alertsSimulateCreateBodyDetectorConfigOneOnetwoTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -1052,7 +1050,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('pca').default(alertsSimulateCreateBodyDetectorConfigOneOnethreeTypeDefault),
+ type: zod.enum(['pca']).default(alertsSimulateCreateBodyDetectorConfigOneOnethreeTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.ts
index 8932efa76d4f..ede818c6046f 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -2440,7 +2440,7 @@ export interface TrendsQueryApi {
/** Sampling rate */
samplingFactor?: number | null
/** Events and actions to include */
- series: (GroupNodeApi | EventsNodeApi | ActionsNodeApi | DataWarehouseNodeApi)[]
+ series: (EventsNodeApi | ActionsNodeApi | DataWarehouseNodeApi | GroupNodeApi)[]
/** Tags that will be added to the Query log comment */
tags?: QueryLogTagsApi | null
/** Properties specific to the trends insight */
diff --git a/products/product_analytics/frontend/generated/api.schemas.ts b/products/product_analytics/frontend/generated/api.schemas.ts
index 99817e3aff71..f4b1fa31feeb 100644
--- a/products/product_analytics/frontend/generated/api.schemas.ts
+++ b/products/product_analytics/frontend/generated/api.schemas.ts
@@ -1793,7 +1793,7 @@ export interface TrendsQueryApi {
/** Sampling rate */
samplingFactor?: number | null
/** Events and actions to include */
- series: (GroupNodeApi | EventsNodeApi | ActionsNodeApi | DataWarehouseNodeApi)[]
+ series: (EventsNodeApi | ActionsNodeApi | DataWarehouseNodeApi | GroupNodeApi)[]
/** Tags that will be added to the Query log comment */
tags?: QueryLogTagsApi | null
/** Properties specific to the trends insight */
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index bdb947eacb08..87c0c9141f5e 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -2784,7 +2784,7 @@ export namespace Schemas {
/** Sampling rate */
samplingFactor?: number | null;
/** Events and actions to include */
- series: (GroupNode | EventsNode | ActionsNode | DataWarehouseNode)[];
+ series: (EventsNode | ActionsNode | DataWarehouseNode | GroupNode)[];
/** Tags that will be added to the Query log comment */
tags?: QueryLogTags | null;
/** Properties specific to the trends insight */
@@ -9125,66 +9125,115 @@ export namespace Schemas {
smooth_n?: number | null;
}
+ export type ZScoreDetectorConfigType = typeof ZScoreDetectorConfigType[keyof typeof ZScoreDetectorConfigType];
+
+
+ export const ZScoreDetectorConfigType = {
+ Zscore: 'zscore',
+ } as const;
+
export interface ZScoreDetectorConfig {
/** Preprocessing transforms applied before detection */
preprocessing?: PreprocessingConfig | null;
/** Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9) */
threshold?: number | null;
- type?: 'zscore';
+ type: ZScoreDetectorConfigType;
/** Rolling window size for calculating mean/std (default: 30) */
window?: number | null;
}
+ export type MADDetectorConfigType = typeof MADDetectorConfigType[keyof typeof MADDetectorConfigType];
+
+
+ export const MADDetectorConfigType = {
+ Mad: 'mad',
+ } as const;
+
export interface MADDetectorConfig {
/** Preprocessing transforms applied before detection */
preprocessing?: PreprocessingConfig | null;
/** Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9) */
threshold?: number | null;
- type?: 'mad';
+ type: MADDetectorConfigType;
/** Rolling window size for calculating median/MAD (default: 30) */
window?: number | null;
}
+ export type IQRDetectorConfigType = typeof IQRDetectorConfigType[keyof typeof IQRDetectorConfigType];
+
+
+ export const IQRDetectorConfigType = {
+ Iqr: 'iqr',
+ } as const;
+
export interface IQRDetectorConfig {
/** IQR multiplier for fence calculation (default: 1.5, use 3.0 for far outliers) */
multiplier?: number | null;
/** Preprocessing transforms applied before detection */
preprocessing?: PreprocessingConfig | null;
- type?: 'iqr';
+ type: IQRDetectorConfigType;
/** Rolling window size for calculating quartiles (default: 30) */
window?: number | null;
}
+ export type ThresholdDetectorConfigType = typeof ThresholdDetectorConfigType[keyof typeof ThresholdDetectorConfigType];
+
+
+ export const ThresholdDetectorConfigType = {
+ Threshold: 'threshold',
+ } as const;
+
export interface ThresholdDetectorConfig {
/** Lower bound - values below this are anomalies */
lower_bound?: number | null;
/** Preprocessing transforms applied before detection */
preprocessing?: PreprocessingConfig | null;
- type?: 'threshold';
+ type: ThresholdDetectorConfigType;
/** Upper bound - values above this are anomalies */
upper_bound?: number | null;
}
+ export type ECODDetectorConfigType = typeof ECODDetectorConfigType[keyof typeof ECODDetectorConfigType];
+
+
+ export const ECODDetectorConfigType = {
+ Ecod: 'ecod',
+ } as const;
+
export interface ECODDetectorConfig {
/** Preprocessing transforms applied before detection */
preprocessing?: PreprocessingConfig | null;
/** Anomaly probability threshold (default: 0.9) */
threshold?: number | null;
- type?: 'ecod';
+ type: ECODDetectorConfigType;
/** Rolling window size — how many historical data points to train on (default: based on calculation interval) */
window?: number | null;
}
+ export type COPODDetectorConfigType = typeof COPODDetectorConfigType[keyof typeof COPODDetectorConfigType];
+
+
+ export const COPODDetectorConfigType = {
+ Copod: 'copod',
+ } as const;
+
export interface COPODDetectorConfig {
/** Preprocessing transforms applied before detection */
preprocessing?: PreprocessingConfig | null;
/** Anomaly probability threshold (default: 0.9) */
threshold?: number | null;
- type?: 'copod';
+ type: COPODDetectorConfigType;
/** Rolling window size — how many historical data points to train on (default: based on calculation interval) */
window?: number | null;
}
+ export type IsolationForestDetectorConfigType = typeof IsolationForestDetectorConfigType[keyof typeof IsolationForestDetectorConfigType];
+
+
+ export const IsolationForestDetectorConfigType = {
+ IsolationForest: 'isolation_forest',
+ } as const;
+
export interface IsolationForestDetectorConfig {
/** Number of trees in the forest (default: 100) */
n_estimators?: number | null;
@@ -9192,7 +9241,7 @@ export namespace Schemas {
preprocessing?: PreprocessingConfig | null;
/** Anomaly probability threshold (default: 0.9) */
threshold?: number | null;
- type?: 'isolation_forest';
+ type: IsolationForestDetectorConfigType;
/** Rolling window size — how many historical data points to train on (default: based on calculation interval) */
window?: number | null;
}
@@ -9206,6 +9255,13 @@ export namespace Schemas {
Median: 'median',
} as const;
+ export type KNNDetectorConfigType = typeof KNNDetectorConfigType[keyof typeof KNNDetectorConfigType];
+
+
+ export const KNNDetectorConfigType = {
+ Knn: 'knn',
+ } as const;
+
export interface KNNDetectorConfig {
/** Distance method: 'largest', 'mean', 'median' (default: 'largest') */
method?: Method | null;
@@ -9215,11 +9271,18 @@ export namespace Schemas {
preprocessing?: PreprocessingConfig | null;
/** Anomaly probability threshold (default: 0.9) */
threshold?: number | null;
- type?: 'knn';
+ type: KNNDetectorConfigType;
/** Rolling window size — how many historical data points to train on (default: based on calculation interval) */
window?: number | null;
}
+ export type HBOSDetectorConfigType = typeof HBOSDetectorConfigType[keyof typeof HBOSDetectorConfigType];
+
+
+ export const HBOSDetectorConfigType = {
+ Hbos: 'hbos',
+ } as const;
+
export interface HBOSDetectorConfig {
/** Number of histogram bins (default: 10) */
n_bins?: number | null;
@@ -9227,11 +9290,18 @@ export namespace Schemas {
preprocessing?: PreprocessingConfig | null;
/** Anomaly probability threshold (default: 0.9) */
threshold?: number | null;
- type?: 'hbos';
+ type: HBOSDetectorConfigType;
/** Rolling window size — how many historical data points to train on (default: based on calculation interval) */
window?: number | null;
}
+ export type LOFDetectorConfigType = typeof LOFDetectorConfigType[keyof typeof LOFDetectorConfigType];
+
+
+ export const LOFDetectorConfigType = {
+ Lof: 'lof',
+ } as const;
+
export interface LOFDetectorConfig {
/** Number of neighbors for LOF (default: 20) */
n_neighbors?: number | null;
@@ -9239,11 +9309,18 @@ export namespace Schemas {
preprocessing?: PreprocessingConfig | null;
/** Anomaly probability threshold (default: 0.9) */
threshold?: number | null;
- type?: 'lof';
+ type: LOFDetectorConfigType;
/** Rolling window size — how many historical data points to train on (default: based on calculation interval) */
window?: number | null;
}
+ export type OCSVMDetectorConfigType = typeof OCSVMDetectorConfigType[keyof typeof OCSVMDetectorConfigType];
+
+
+ export const OCSVMDetectorConfigType = {
+ Ocsvm: 'ocsvm',
+ } as const;
+
export interface OCSVMDetectorConfig {
/** SVM kernel type (default: "rbf") */
kernel?: string | null;
@@ -9253,17 +9330,24 @@ export namespace Schemas {
preprocessing?: PreprocessingConfig | null;
/** Anomaly probability threshold (default: 0.9) */
threshold?: number | null;
- type?: 'ocsvm';
+ type: OCSVMDetectorConfigType;
/** Rolling window size — how many historical data points to train on (default: based on calculation interval) */
window?: number | null;
}
+ export type PCADetectorConfigType = typeof PCADetectorConfigType[keyof typeof PCADetectorConfigType];
+
+
+ export const PCADetectorConfigType = {
+ Pca: 'pca',
+ } as const;
+
export interface PCADetectorConfig {
/** Preprocessing transforms applied before detection */
preprocessing?: PreprocessingConfig | null;
/** Anomaly probability threshold (default: 0.9) */
threshold?: number | null;
- type?: 'pca';
+ type: PCADetectorConfigType;
/** Rolling window size — how many historical data points to train on (default: based on calculation interval) */
window?: number | null;
}
@@ -9276,12 +9360,19 @@ export namespace Schemas {
Or: 'or',
} as const;
+ export type EnsembleDetectorConfigType = typeof EnsembleDetectorConfigType[keyof typeof EnsembleDetectorConfigType];
+
+
+ export const EnsembleDetectorConfigType = {
+ Ensemble: 'ensemble',
+ } as const;
+
export interface EnsembleDetectorConfig {
/** Sub-detector configurations (minimum 2) */
detectors: (ZScoreDetectorConfig | MADDetectorConfig | IQRDetectorConfig | ThresholdDetectorConfig | ECODDetectorConfig | COPODDetectorConfig | IsolationForestDetectorConfig | KNNDetectorConfig | HBOSDetectorConfig | LOFDetectorConfig | OCSVMDetectorConfig | PCADetectorConfig)[];
/** How to combine sub-detector results */
operator: EnsembleOperator;
- type?: 'ensemble';
+ type: EnsembleDetectorConfigType;
}
/**
@@ -50886,6 +50977,49 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
+ export type QueryResponseAlternative62CredibleIntervals = {[key: string]: number[]};
+
+ export type QueryResponseAlternative62InsightItemItem = { [key: string]: unknown };
+
+ export type QueryResponseAlternative62Probability = {[key: string]: number};
+
+ export interface QueryResponseAlternative62 {
+ credible_intervals: QueryResponseAlternative62CredibleIntervals;
+ expected_loss: number;
+ funnels_query?: FunnelsQuery | null;
+ insight: QueryResponseAlternative62InsightItemItem[][];
+ kind?: 'ExperimentFunnelsQuery';
+ probability: QueryResponseAlternative62Probability;
+ significance_code: ExperimentSignificanceCode;
+ significant: boolean;
+ stats_version?: number | null;
+ variants: ExperimentVariantFunnelsBaseStats[];
+ /** Data warehouse sync warnings — see AnalyticsQueryResponseBase.warnings for semantics. */
+ warnings?: DataWarehouseSyncWarning[] | null;
+ }
+
+ export type QueryResponseAlternative63CredibleIntervals = {[key: string]: number[]};
+
+ export type QueryResponseAlternative63InsightItem = { [key: string]: unknown };
+
+ export type QueryResponseAlternative63Probability = {[key: string]: number};
+
+ export interface QueryResponseAlternative63 {
+ count_query?: TrendsQuery | null;
+ credible_intervals: QueryResponseAlternative63CredibleIntervals;
+ exposure_query?: TrendsQuery | null;
+ insight: QueryResponseAlternative63InsightItem[];
+ kind?: 'ExperimentTrendsQuery';
+ p_value: number;
+ probability: QueryResponseAlternative63Probability;
+ significance_code: ExperimentSignificanceCode;
+ significant: boolean;
+ stats_version?: number | null;
+ variants: ExperimentVariantTrendsBaseStats[];
+ /** Data warehouse sync warnings — see AnalyticsQueryResponseBase.warnings for semantics. */
+ warnings?: DataWarehouseSyncWarning[] | null;
+ }
+
export interface QueryResponseAlternative64 {
columns?: string[] | null;
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
@@ -51732,7 +51866,7 @@ export namespace Schemas {
warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;
}
- export type QueryResponseAlternative = { [key: string]: unknown } | QueryResponseAlternative1 | QueryResponseAlternative2 | QueryResponseAlternative3 | QueryResponseAlternative4 | QueryResponseAlternative5 | QueryResponseAlternative6 | QueryResponseAlternative7 | QueryResponseAlternative8 | QueryResponseAlternative9 | QueryResponseAlternative10 | QueryResponseAlternative11 | QueryResponseAlternative14 | QueryResponseAlternative15 | QueryResponseAlternative16 | QueryResponseAlternative17 | QueryResponseAlternative18 | QueryResponseAlternative19 | QueryResponseAlternative20 | QueryResponseAlternative21 | QueryResponseAlternative22 | QueryResponseAlternative23 | QueryResponseAlternative24 | QueryResponseAlternative25 | QueryResponseAlternative26 | QueryResponseAlternative27 | QueryResponseAlternative28 | QueryResponseAlternative29 | QueryResponseAlternative30 | QueryResponseAlternative31 | QueryResponseAlternative32 | QueryResponseAlternative33 | QueryResponseAlternative34 | QueryResponseAlternative35 | QueryResponseAlternative36 | QueryResponseAlternative37 | QueryResponseAlternative38 | unknown | QueryResponseAlternative39 | QueryResponseAlternative40 | QueryResponseAlternative41 | QueryResponseAlternative42 | QueryResponseAlternative43 | QueryResponseAlternative44 | QueryResponseAlternative45 | QueryResponseAlternative46 | QueryResponseAlternative47 | QueryResponseAlternative48 | QueryResponseAlternative49 | QueryResponseAlternative50 | QueryResponseAlternative51 | QueryResponseAlternative52 | QueryResponseAlternative53 | QueryResponseAlternative54 | QueryResponseAlternative55 | QueryResponseAlternative57 | QueryResponseAlternative58 | QueryResponseAlternative59 | QueryResponseAlternative60 | QueryResponseAlternative64 | QueryResponseAlternative66 | QueryResponseAlternative67 | QueryResponseAlternative68 | QueryResponseAlternative69 | QueryResponseAlternative70 | QueryResponseAlternative71 | QueryResponseAlternative72 | QueryResponseAlternative74 | QueryResponseAlternative75 | QueryResponseAlternative76 | QueryResponseAlternative77 | QueryResponseAlternative78 | QueryResponseAlternative79 | QueryResponseAlternative80 | QueryResponseAlternative81 | QueryResponseAlternative82 | QueryResponseAlternative83 | QueryResponseAlternative84 | QueryResponseAlternative85 | QueryResponseAlternative86 | QueryResponseAlternative87 | QueryResponseAlternative88 | QueryResponseAlternative89 | QueryResponseAlternative92 | QueryResponseAlternative93 | QueryResponseAlternative94 | QueryResponseAlternative95 | QueryResponseAlternative96 | QueryResponseAlternative97 | QueryResponseAlternative98 | QueryResponseAlternative99 | QueryResponseAlternative100 | QueryResponseAlternative101 | QueryResponseAlternative102 | QueryResponseAlternative103 | QueryResponseAlternative104 | QueryResponseAlternative105 | QueryResponseAlternative106 | QueryResponseAlternative107;
+ export type QueryResponseAlternative = { [key: string]: unknown } | QueryResponseAlternative1 | QueryResponseAlternative2 | QueryResponseAlternative3 | QueryResponseAlternative4 | QueryResponseAlternative5 | QueryResponseAlternative6 | QueryResponseAlternative7 | QueryResponseAlternative8 | QueryResponseAlternative9 | QueryResponseAlternative10 | QueryResponseAlternative11 | QueryResponseAlternative14 | QueryResponseAlternative15 | QueryResponseAlternative16 | QueryResponseAlternative17 | QueryResponseAlternative18 | QueryResponseAlternative19 | QueryResponseAlternative20 | QueryResponseAlternative21 | QueryResponseAlternative22 | QueryResponseAlternative23 | QueryResponseAlternative24 | QueryResponseAlternative25 | QueryResponseAlternative26 | QueryResponseAlternative27 | QueryResponseAlternative28 | QueryResponseAlternative29 | QueryResponseAlternative30 | QueryResponseAlternative31 | QueryResponseAlternative32 | QueryResponseAlternative33 | QueryResponseAlternative34 | QueryResponseAlternative35 | QueryResponseAlternative36 | QueryResponseAlternative37 | QueryResponseAlternative38 | unknown | QueryResponseAlternative39 | QueryResponseAlternative40 | QueryResponseAlternative41 | QueryResponseAlternative42 | QueryResponseAlternative43 | QueryResponseAlternative44 | QueryResponseAlternative45 | QueryResponseAlternative46 | QueryResponseAlternative47 | QueryResponseAlternative48 | QueryResponseAlternative49 | QueryResponseAlternative50 | QueryResponseAlternative51 | QueryResponseAlternative52 | QueryResponseAlternative53 | QueryResponseAlternative54 | QueryResponseAlternative55 | QueryResponseAlternative57 | QueryResponseAlternative58 | QueryResponseAlternative59 | QueryResponseAlternative60 | QueryResponseAlternative62 | QueryResponseAlternative63 | QueryResponseAlternative64 | QueryResponseAlternative66 | QueryResponseAlternative67 | QueryResponseAlternative68 | QueryResponseAlternative69 | QueryResponseAlternative70 | QueryResponseAlternative71 | QueryResponseAlternative72 | QueryResponseAlternative74 | QueryResponseAlternative75 | QueryResponseAlternative76 | QueryResponseAlternative77 | QueryResponseAlternative78 | QueryResponseAlternative79 | QueryResponseAlternative80 | QueryResponseAlternative81 | QueryResponseAlternative82 | QueryResponseAlternative83 | QueryResponseAlternative84 | QueryResponseAlternative85 | QueryResponseAlternative86 | QueryResponseAlternative87 | QueryResponseAlternative88 | QueryResponseAlternative89 | QueryResponseAlternative92 | QueryResponseAlternative93 | QueryResponseAlternative94 | QueryResponseAlternative95 | QueryResponseAlternative96 | QueryResponseAlternative97 | QueryResponseAlternative98 | QueryResponseAlternative99 | QueryResponseAlternative100 | QueryResponseAlternative101 | QueryResponseAlternative102 | QueryResponseAlternative103 | QueryResponseAlternative104 | QueryResponseAlternative105 | QueryResponseAlternative106 | QueryResponseAlternative107;
export interface QueryStatusResponse {
query_status: QueryStatus;
diff --git a/services/mcp/src/generated/alerts/api.ts b/services/mcp/src/generated/alerts/api.ts
index 798a4d7a5f16..a96140d2b56e 100644
--- a/services/mcp/src/generated/alerts/api.ts
+++ b/services/mcp/src/generated/alerts/api.ts
@@ -240,7 +240,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
'Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)'
),
type: zod
- .literal('zscore')
+ .enum(['zscore'])
.default(alertsCreateBodyDetectorConfigOneOneDetectorsItemOneTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -281,7 +281,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
'Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)'
),
type: zod
- .literal('mad')
+ .enum(['mad'])
.default(alertsCreateBodyDetectorConfigOneOneDetectorsItemTwoTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -322,7 +322,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Preprocessing transforms applied before detection'),
type: zod
- .literal('iqr')
+ .enum(['iqr'])
.default(alertsCreateBodyDetectorConfigOneOneDetectorsItemThreeTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -361,7 +361,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Preprocessing transforms applied before detection'),
type: zod
- .literal('threshold')
+ .enum(['threshold'])
.default(alertsCreateBodyDetectorConfigOneOneDetectorsItemFourTypeDefault),
upper_bound: zod
.union([zod.number(), zod.null()])
@@ -400,7 +400,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('ecod')
+ .enum(['ecod'])
.default(alertsCreateBodyDetectorConfigOneOneDetectorsItemFiveTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -441,7 +441,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('copod')
+ .enum(['copod'])
.default(alertsCreateBodyDetectorConfigOneOneDetectorsItemSixTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -486,7 +486,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('isolation_forest')
+ .enum(['isolation_forest'])
.default(alertsCreateBodyDetectorConfigOneOneDetectorsItemSevenTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -537,7 +537,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('knn')
+ .enum(['knn'])
.default(alertsCreateBodyDetectorConfigOneOneDetectorsItemEightTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -582,7 +582,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('hbos')
+ .enum(['hbos'])
.default(alertsCreateBodyDetectorConfigOneOneDetectorsItemNineTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -627,7 +627,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('lof')
+ .enum(['lof'])
.default(
alertsCreateBodyDetectorConfigOneOneDetectorsItemOnezeroTypeDefault
),
@@ -678,7 +678,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('ocsvm')
+ .enum(['ocsvm'])
.default(
alertsCreateBodyDetectorConfigOneOneDetectorsItemOneoneTypeDefault
),
@@ -721,7 +721,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('pca')
+ .enum(['pca'])
.default(
alertsCreateBodyDetectorConfigOneOneDetectorsItemOnetwoTypeDefault
),
@@ -736,7 +736,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
)
.describe('Sub-detector configurations (minimum 2)'),
operator: zod.enum(['and', 'or']).describe('How to combine sub-detector results'),
- type: zod.literal('ensemble').default(alertsCreateBodyDetectorConfigOneOneTypeDefault),
+ type: zod.enum(['ensemble']).default(alertsCreateBodyDetectorConfigOneOneTypeDefault),
}),
zod.object({
preprocessing: zod
@@ -771,7 +771,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.describe(
'Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)'
),
- type: zod.literal('zscore').default(alertsCreateBodyDetectorConfigOneTwoTypeDefault),
+ type: zod.enum(['zscore']).default(alertsCreateBodyDetectorConfigOneTwoTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -810,7 +810,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.describe(
'Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)'
),
- type: zod.literal('mad').default(alertsCreateBodyDetectorConfigOneThreeTypeDefault),
+ type: zod.enum(['mad']).default(alertsCreateBodyDetectorConfigOneThreeTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -847,7 +847,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
])
.optional()
.describe('Preprocessing transforms applied before detection'),
- type: zod.literal('iqr').default(alertsCreateBodyDetectorConfigOneFourTypeDefault),
+ type: zod.enum(['iqr']).default(alertsCreateBodyDetectorConfigOneFourTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -884,7 +884,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
])
.optional()
.describe('Preprocessing transforms applied before detection'),
- type: zod.literal('threshold').default(alertsCreateBodyDetectorConfigOneFiveTypeDefault),
+ type: zod.enum(['threshold']).default(alertsCreateBodyDetectorConfigOneFiveTypeDefault),
upper_bound: zod
.union([zod.number(), zod.null()])
.optional()
@@ -921,7 +921,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('ecod').default(alertsCreateBodyDetectorConfigOneSixTypeDefault),
+ type: zod.enum(['ecod']).default(alertsCreateBodyDetectorConfigOneSixTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -960,7 +960,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('copod').default(alertsCreateBodyDetectorConfigOneSevenTypeDefault),
+ type: zod.enum(['copod']).default(alertsCreateBodyDetectorConfigOneSevenTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -1003,9 +1003,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod
- .literal('isolation_forest')
- .default(alertsCreateBodyDetectorConfigOneEightTypeDefault),
+ type: zod.enum(['isolation_forest']).default(alertsCreateBodyDetectorConfigOneEightTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -1052,7 +1050,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('knn').default(alertsCreateBodyDetectorConfigOneNineTypeDefault),
+ type: zod.enum(['knn']).default(alertsCreateBodyDetectorConfigOneNineTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -1095,7 +1093,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('hbos').default(alertsCreateBodyDetectorConfigOneOnezeroTypeDefault),
+ type: zod.enum(['hbos']).default(alertsCreateBodyDetectorConfigOneOnezeroTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -1138,7 +1136,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('lof').default(alertsCreateBodyDetectorConfigOneOneoneTypeDefault),
+ type: zod.enum(['lof']).default(alertsCreateBodyDetectorConfigOneOneoneTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -1185,7 +1183,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('ocsvm').default(alertsCreateBodyDetectorConfigOneOnetwoTypeDefault),
+ type: zod.enum(['ocsvm']).default(alertsCreateBodyDetectorConfigOneOnetwoTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -1224,7 +1222,7 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('pca').default(alertsCreateBodyDetectorConfigOneOnethreeTypeDefault),
+ type: zod.enum(['pca']).default(alertsCreateBodyDetectorConfigOneOnethreeTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -1551,7 +1549,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
'Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)'
),
type: zod
- .literal('zscore')
+ .enum(['zscore'])
.default(
alertsPartialUpdateBodyDetectorConfigOneOneDetectorsItemOneTypeDefault
),
@@ -1594,7 +1592,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
'Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)'
),
type: zod
- .literal('mad')
+ .enum(['mad'])
.default(
alertsPartialUpdateBodyDetectorConfigOneOneDetectorsItemTwoTypeDefault
),
@@ -1637,7 +1635,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Preprocessing transforms applied before detection'),
type: zod
- .literal('iqr')
+ .enum(['iqr'])
.default(
alertsPartialUpdateBodyDetectorConfigOneOneDetectorsItemThreeTypeDefault
),
@@ -1678,7 +1676,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Preprocessing transforms applied before detection'),
type: zod
- .literal('threshold')
+ .enum(['threshold'])
.default(
alertsPartialUpdateBodyDetectorConfigOneOneDetectorsItemFourTypeDefault
),
@@ -1719,7 +1717,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('ecod')
+ .enum(['ecod'])
.default(
alertsPartialUpdateBodyDetectorConfigOneOneDetectorsItemFiveTypeDefault
),
@@ -1762,7 +1760,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('copod')
+ .enum(['copod'])
.default(
alertsPartialUpdateBodyDetectorConfigOneOneDetectorsItemSixTypeDefault
),
@@ -1809,7 +1807,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('isolation_forest')
+ .enum(['isolation_forest'])
.default(
alertsPartialUpdateBodyDetectorConfigOneOneDetectorsItemSevenTypeDefault
),
@@ -1862,7 +1860,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('knn')
+ .enum(['knn'])
.default(
alertsPartialUpdateBodyDetectorConfigOneOneDetectorsItemEightTypeDefault
),
@@ -1909,7 +1907,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('hbos')
+ .enum(['hbos'])
.default(
alertsPartialUpdateBodyDetectorConfigOneOneDetectorsItemNineTypeDefault
),
@@ -1956,7 +1954,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('lof')
+ .enum(['lof'])
.default(
alertsPartialUpdateBodyDetectorConfigOneOneDetectorsItemOnezeroTypeDefault
),
@@ -2007,7 +2005,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('ocsvm')
+ .enum(['ocsvm'])
.default(
alertsPartialUpdateBodyDetectorConfigOneOneDetectorsItemOneoneTypeDefault
),
@@ -2050,7 +2048,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('pca')
+ .enum(['pca'])
.default(
alertsPartialUpdateBodyDetectorConfigOneOneDetectorsItemOnetwoTypeDefault
),
@@ -2065,7 +2063,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
)
.describe('Sub-detector configurations (minimum 2)'),
operator: zod.enum(['and', 'or']).describe('How to combine sub-detector results'),
- type: zod.literal('ensemble').default(alertsPartialUpdateBodyDetectorConfigOneOneTypeDefault),
+ type: zod.enum(['ensemble']).default(alertsPartialUpdateBodyDetectorConfigOneOneTypeDefault),
}),
zod.object({
preprocessing: zod
@@ -2100,7 +2098,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.describe(
'Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)'
),
- type: zod.literal('zscore').default(alertsPartialUpdateBodyDetectorConfigOneTwoTypeDefault),
+ type: zod.enum(['zscore']).default(alertsPartialUpdateBodyDetectorConfigOneTwoTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -2139,7 +2137,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.describe(
'Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)'
),
- type: zod.literal('mad').default(alertsPartialUpdateBodyDetectorConfigOneThreeTypeDefault),
+ type: zod.enum(['mad']).default(alertsPartialUpdateBodyDetectorConfigOneThreeTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -2176,7 +2174,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
])
.optional()
.describe('Preprocessing transforms applied before detection'),
- type: zod.literal('iqr').default(alertsPartialUpdateBodyDetectorConfigOneFourTypeDefault),
+ type: zod.enum(['iqr']).default(alertsPartialUpdateBodyDetectorConfigOneFourTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -2213,7 +2211,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
])
.optional()
.describe('Preprocessing transforms applied before detection'),
- type: zod.literal('threshold').default(alertsPartialUpdateBodyDetectorConfigOneFiveTypeDefault),
+ type: zod.enum(['threshold']).default(alertsPartialUpdateBodyDetectorConfigOneFiveTypeDefault),
upper_bound: zod
.union([zod.number(), zod.null()])
.optional()
@@ -2250,7 +2248,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('ecod').default(alertsPartialUpdateBodyDetectorConfigOneSixTypeDefault),
+ type: zod.enum(['ecod']).default(alertsPartialUpdateBodyDetectorConfigOneSixTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -2289,7 +2287,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('copod').default(alertsPartialUpdateBodyDetectorConfigOneSevenTypeDefault),
+ type: zod.enum(['copod']).default(alertsPartialUpdateBodyDetectorConfigOneSevenTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -2333,7 +2331,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('isolation_forest')
+ .enum(['isolation_forest'])
.default(alertsPartialUpdateBodyDetectorConfigOneEightTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -2381,7 +2379,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('knn').default(alertsPartialUpdateBodyDetectorConfigOneNineTypeDefault),
+ type: zod.enum(['knn']).default(alertsPartialUpdateBodyDetectorConfigOneNineTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -2424,7 +2422,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('hbos').default(alertsPartialUpdateBodyDetectorConfigOneOnezeroTypeDefault),
+ type: zod.enum(['hbos']).default(alertsPartialUpdateBodyDetectorConfigOneOnezeroTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -2467,7 +2465,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('lof').default(alertsPartialUpdateBodyDetectorConfigOneOneoneTypeDefault),
+ type: zod.enum(['lof']).default(alertsPartialUpdateBodyDetectorConfigOneOneoneTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -2514,7 +2512,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('ocsvm').default(alertsPartialUpdateBodyDetectorConfigOneOnetwoTypeDefault),
+ type: zod.enum(['ocsvm']).default(alertsPartialUpdateBodyDetectorConfigOneOnetwoTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -2553,7 +2551,7 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('pca').default(alertsPartialUpdateBodyDetectorConfigOneOnethreeTypeDefault),
+ type: zod.enum(['pca']).default(alertsPartialUpdateBodyDetectorConfigOneOnethreeTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -2727,7 +2725,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
'Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)'
),
type: zod
- .literal('zscore')
+ .enum(['zscore'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemOneTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -2768,7 +2766,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
'Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)'
),
type: zod
- .literal('mad')
+ .enum(['mad'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemTwoTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -2809,7 +2807,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Preprocessing transforms applied before detection'),
type: zod
- .literal('iqr')
+ .enum(['iqr'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemThreeTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -2848,7 +2846,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Preprocessing transforms applied before detection'),
type: zod
- .literal('threshold')
+ .enum(['threshold'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemFourTypeDefault),
upper_bound: zod
.union([zod.number(), zod.null()])
@@ -2887,7 +2885,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('ecod')
+ .enum(['ecod'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemFiveTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -2928,7 +2926,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('copod')
+ .enum(['copod'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemSixTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -2973,7 +2971,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('isolation_forest')
+ .enum(['isolation_forest'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemSevenTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -3022,7 +3020,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('knn')
+ .enum(['knn'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemEightTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -3067,7 +3065,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('hbos')
+ .enum(['hbos'])
.default(alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemNineTypeDefault),
window: zod
.union([zod.number(), zod.null()])
@@ -3112,7 +3110,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('lof')
+ .enum(['lof'])
.default(
alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemOnezeroTypeDefault
),
@@ -3163,7 +3161,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('ocsvm')
+ .enum(['ocsvm'])
.default(
alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemOneoneTypeDefault
),
@@ -3206,7 +3204,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
type: zod
- .literal('pca')
+ .enum(['pca'])
.default(
alertsSimulateCreateBodyDetectorConfigOneOneDetectorsItemOnetwoTypeDefault
),
@@ -3221,7 +3219,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
)
.describe('Sub-detector configurations (minimum 2)'),
operator: zod.enum(['and', 'or']).describe('How to combine sub-detector results'),
- type: zod.literal('ensemble').default(alertsSimulateCreateBodyDetectorConfigOneOneTypeDefault),
+ type: zod.enum(['ensemble']).default(alertsSimulateCreateBodyDetectorConfigOneOneTypeDefault),
}),
zod.object({
preprocessing: zod
@@ -3254,7 +3252,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.describe(
'Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)'
),
- type: zod.literal('zscore').default(alertsSimulateCreateBodyDetectorConfigOneTwoTypeDefault),
+ type: zod.enum(['zscore']).default(alertsSimulateCreateBodyDetectorConfigOneTwoTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -3291,7 +3289,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.describe(
'Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)'
),
- type: zod.literal('mad').default(alertsSimulateCreateBodyDetectorConfigOneThreeTypeDefault),
+ type: zod.enum(['mad']).default(alertsSimulateCreateBodyDetectorConfigOneThreeTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -3326,7 +3324,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
])
.optional()
.describe('Preprocessing transforms applied before detection'),
- type: zod.literal('iqr').default(alertsSimulateCreateBodyDetectorConfigOneFourTypeDefault),
+ type: zod.enum(['iqr']).default(alertsSimulateCreateBodyDetectorConfigOneFourTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -3361,7 +3359,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
])
.optional()
.describe('Preprocessing transforms applied before detection'),
- type: zod.literal('threshold').default(alertsSimulateCreateBodyDetectorConfigOneFiveTypeDefault),
+ type: zod.enum(['threshold']).default(alertsSimulateCreateBodyDetectorConfigOneFiveTypeDefault),
upper_bound: zod
.union([zod.number(), zod.null()])
.optional()
@@ -3396,7 +3394,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('ecod').default(alertsSimulateCreateBodyDetectorConfigOneSixTypeDefault),
+ type: zod.enum(['ecod']).default(alertsSimulateCreateBodyDetectorConfigOneSixTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -3433,7 +3431,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('copod').default(alertsSimulateCreateBodyDetectorConfigOneSevenTypeDefault),
+ type: zod.enum(['copod']).default(alertsSimulateCreateBodyDetectorConfigOneSevenTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -3474,9 +3472,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod
- .literal('isolation_forest')
- .default(alertsSimulateCreateBodyDetectorConfigOneEightTypeDefault),
+ type: zod.enum(['isolation_forest']).default(alertsSimulateCreateBodyDetectorConfigOneEightTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -3521,7 +3517,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('knn').default(alertsSimulateCreateBodyDetectorConfigOneNineTypeDefault),
+ type: zod.enum(['knn']).default(alertsSimulateCreateBodyDetectorConfigOneNineTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -3562,7 +3558,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('hbos').default(alertsSimulateCreateBodyDetectorConfigOneOnezeroTypeDefault),
+ type: zod.enum(['hbos']).default(alertsSimulateCreateBodyDetectorConfigOneOnezeroTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -3603,7 +3599,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('lof').default(alertsSimulateCreateBodyDetectorConfigOneOneoneTypeDefault),
+ type: zod.enum(['lof']).default(alertsSimulateCreateBodyDetectorConfigOneOneoneTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -3645,7 +3641,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('ocsvm').default(alertsSimulateCreateBodyDetectorConfigOneOnetwoTypeDefault),
+ type: zod.enum(['ocsvm']).default(alertsSimulateCreateBodyDetectorConfigOneOnetwoTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
@@ -3682,7 +3678,7 @@ export const AlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
.union([zod.number(), zod.null()])
.optional()
.describe('Anomaly probability threshold (default: 0.9)'),
- type: zod.literal('pca').default(alertsSimulateCreateBodyDetectorConfigOneOnethreeTypeDefault),
+ type: zod.enum(['pca']).default(alertsSimulateCreateBodyDetectorConfigOneOnethreeTypeDefault),
window: zod
.union([zod.number(), zod.null()])
.optional()
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-create.json
index 3487e5d8d00e..a309321e86c6 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-create.json
@@ -229,8 +229,8 @@
"description": "Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)"
},
"type": {
- "const": "zscore",
"default": "zscore",
+ "enum": ["zscore"],
"type": "string"
},
"window": {
@@ -307,8 +307,8 @@
"description": "Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)"
},
"type": {
- "const": "mad",
"default": "mad",
+ "enum": ["mad"],
"type": "string"
},
"window": {
@@ -385,8 +385,8 @@
"description": "Preprocessing transforms applied before detection"
},
"type": {
- "const": "iqr",
"default": "iqr",
+ "enum": ["iqr"],
"type": "string"
},
"window": {
@@ -463,8 +463,8 @@
"description": "Preprocessing transforms applied before detection"
},
"type": {
- "const": "threshold",
"default": "threshold",
+ "enum": ["threshold"],
"type": "string"
},
"upper_bound": {
@@ -541,8 +541,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "ecod",
"default": "ecod",
+ "enum": ["ecod"],
"type": "string"
},
"window": {
@@ -619,8 +619,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "copod",
"default": "copod",
+ "enum": ["copod"],
"type": "string"
},
"window": {
@@ -708,8 +708,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "isolation_forest",
"default": "isolation_forest",
+ "enum": ["isolation_forest"],
"type": "string"
},
"window": {
@@ -809,8 +809,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "knn",
"default": "knn",
+ "enum": ["knn"],
"type": "string"
},
"window": {
@@ -898,8 +898,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "hbos",
"default": "hbos",
+ "enum": ["hbos"],
"type": "string"
},
"window": {
@@ -987,8 +987,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "lof",
"default": "lof",
+ "enum": ["lof"],
"type": "string"
},
"window": {
@@ -1087,8 +1087,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "ocsvm",
"default": "ocsvm",
+ "enum": ["ocsvm"],
"type": "string"
},
"window": {
@@ -1165,8 +1165,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "pca",
"default": "pca",
+ "enum": ["pca"],
"type": "string"
},
"window": {
@@ -1193,8 +1193,8 @@
"type": "string"
},
"type": {
- "const": "ensemble",
"default": "ensemble",
+ "enum": ["ensemble"],
"type": "string"
}
},
@@ -1261,8 +1261,8 @@
"description": "Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)"
},
"type": {
- "const": "zscore",
"default": "zscore",
+ "enum": ["zscore"],
"type": "string"
},
"window": {
@@ -1339,8 +1339,8 @@
"description": "Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)"
},
"type": {
- "const": "mad",
"default": "mad",
+ "enum": ["mad"],
"type": "string"
},
"window": {
@@ -1417,8 +1417,8 @@
"description": "Preprocessing transforms applied before detection"
},
"type": {
- "const": "iqr",
"default": "iqr",
+ "enum": ["iqr"],
"type": "string"
},
"window": {
@@ -1495,8 +1495,8 @@
"description": "Preprocessing transforms applied before detection"
},
"type": {
- "const": "threshold",
"default": "threshold",
+ "enum": ["threshold"],
"type": "string"
},
"upper_bound": {
@@ -1573,8 +1573,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "ecod",
"default": "ecod",
+ "enum": ["ecod"],
"type": "string"
},
"window": {
@@ -1651,8 +1651,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "copod",
"default": "copod",
+ "enum": ["copod"],
"type": "string"
},
"window": {
@@ -1740,8 +1740,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "isolation_forest",
"default": "isolation_forest",
+ "enum": ["isolation_forest"],
"type": "string"
},
"window": {
@@ -1841,8 +1841,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "knn",
"default": "knn",
+ "enum": ["knn"],
"type": "string"
},
"window": {
@@ -1930,8 +1930,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "hbos",
"default": "hbos",
+ "enum": ["hbos"],
"type": "string"
},
"window": {
@@ -2019,8 +2019,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "lof",
"default": "lof",
+ "enum": ["lof"],
"type": "string"
},
"window": {
@@ -2119,8 +2119,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "ocsvm",
"default": "ocsvm",
+ "enum": ["ocsvm"],
"type": "string"
},
"window": {
@@ -2197,8 +2197,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "pca",
"default": "pca",
+ "enum": ["pca"],
"type": "string"
},
"window": {
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-simulate.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-simulate.json
index 3a8019006519..1b9944586535 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-simulate.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-simulate.json
@@ -215,8 +215,8 @@
"description": "Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)"
},
"type": {
- "const": "zscore",
"default": "zscore",
+ "enum": ["zscore"],
"type": "string"
},
"window": {
@@ -293,8 +293,8 @@
"description": "Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)"
},
"type": {
- "const": "mad",
"default": "mad",
+ "enum": ["mad"],
"type": "string"
},
"window": {
@@ -371,8 +371,8 @@
"description": "Preprocessing transforms applied before detection"
},
"type": {
- "const": "iqr",
"default": "iqr",
+ "enum": ["iqr"],
"type": "string"
},
"window": {
@@ -449,8 +449,8 @@
"description": "Preprocessing transforms applied before detection"
},
"type": {
- "const": "threshold",
"default": "threshold",
+ "enum": ["threshold"],
"type": "string"
},
"upper_bound": {
@@ -527,8 +527,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "ecod",
"default": "ecod",
+ "enum": ["ecod"],
"type": "string"
},
"window": {
@@ -605,8 +605,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "copod",
"default": "copod",
+ "enum": ["copod"],
"type": "string"
},
"window": {
@@ -694,8 +694,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "isolation_forest",
"default": "isolation_forest",
+ "enum": ["isolation_forest"],
"type": "string"
},
"window": {
@@ -795,8 +795,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "knn",
"default": "knn",
+ "enum": ["knn"],
"type": "string"
},
"window": {
@@ -884,8 +884,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "hbos",
"default": "hbos",
+ "enum": ["hbos"],
"type": "string"
},
"window": {
@@ -973,8 +973,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "lof",
"default": "lof",
+ "enum": ["lof"],
"type": "string"
},
"window": {
@@ -1073,8 +1073,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "ocsvm",
"default": "ocsvm",
+ "enum": ["ocsvm"],
"type": "string"
},
"window": {
@@ -1151,8 +1151,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "pca",
"default": "pca",
+ "enum": ["pca"],
"type": "string"
},
"window": {
@@ -1179,8 +1179,8 @@
"type": "string"
},
"type": {
- "const": "ensemble",
"default": "ensemble",
+ "enum": ["ensemble"],
"type": "string"
}
},
@@ -1247,8 +1247,8 @@
"description": "Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)"
},
"type": {
- "const": "zscore",
"default": "zscore",
+ "enum": ["zscore"],
"type": "string"
},
"window": {
@@ -1325,8 +1325,8 @@
"description": "Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)"
},
"type": {
- "const": "mad",
"default": "mad",
+ "enum": ["mad"],
"type": "string"
},
"window": {
@@ -1403,8 +1403,8 @@
"description": "Preprocessing transforms applied before detection"
},
"type": {
- "const": "iqr",
"default": "iqr",
+ "enum": ["iqr"],
"type": "string"
},
"window": {
@@ -1481,8 +1481,8 @@
"description": "Preprocessing transforms applied before detection"
},
"type": {
- "const": "threshold",
"default": "threshold",
+ "enum": ["threshold"],
"type": "string"
},
"upper_bound": {
@@ -1559,8 +1559,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "ecod",
"default": "ecod",
+ "enum": ["ecod"],
"type": "string"
},
"window": {
@@ -1637,8 +1637,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "copod",
"default": "copod",
+ "enum": ["copod"],
"type": "string"
},
"window": {
@@ -1726,8 +1726,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "isolation_forest",
"default": "isolation_forest",
+ "enum": ["isolation_forest"],
"type": "string"
},
"window": {
@@ -1827,8 +1827,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "knn",
"default": "knn",
+ "enum": ["knn"],
"type": "string"
},
"window": {
@@ -1916,8 +1916,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "hbos",
"default": "hbos",
+ "enum": ["hbos"],
"type": "string"
},
"window": {
@@ -2005,8 +2005,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "lof",
"default": "lof",
+ "enum": ["lof"],
"type": "string"
},
"window": {
@@ -2105,8 +2105,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "ocsvm",
"default": "ocsvm",
+ "enum": ["ocsvm"],
"type": "string"
},
"window": {
@@ -2183,8 +2183,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "pca",
"default": "pca",
+ "enum": ["pca"],
"type": "string"
},
"window": {
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-update.json
index 51061213d28c..1ed7f3f2ad86 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-update.json
@@ -229,8 +229,8 @@
"description": "Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)"
},
"type": {
- "const": "zscore",
"default": "zscore",
+ "enum": ["zscore"],
"type": "string"
},
"window": {
@@ -307,8 +307,8 @@
"description": "Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)"
},
"type": {
- "const": "mad",
"default": "mad",
+ "enum": ["mad"],
"type": "string"
},
"window": {
@@ -385,8 +385,8 @@
"description": "Preprocessing transforms applied before detection"
},
"type": {
- "const": "iqr",
"default": "iqr",
+ "enum": ["iqr"],
"type": "string"
},
"window": {
@@ -463,8 +463,8 @@
"description": "Preprocessing transforms applied before detection"
},
"type": {
- "const": "threshold",
"default": "threshold",
+ "enum": ["threshold"],
"type": "string"
},
"upper_bound": {
@@ -541,8 +541,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "ecod",
"default": "ecod",
+ "enum": ["ecod"],
"type": "string"
},
"window": {
@@ -619,8 +619,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "copod",
"default": "copod",
+ "enum": ["copod"],
"type": "string"
},
"window": {
@@ -708,8 +708,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "isolation_forest",
"default": "isolation_forest",
+ "enum": ["isolation_forest"],
"type": "string"
},
"window": {
@@ -809,8 +809,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "knn",
"default": "knn",
+ "enum": ["knn"],
"type": "string"
},
"window": {
@@ -898,8 +898,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "hbos",
"default": "hbos",
+ "enum": ["hbos"],
"type": "string"
},
"window": {
@@ -987,8 +987,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "lof",
"default": "lof",
+ "enum": ["lof"],
"type": "string"
},
"window": {
@@ -1087,8 +1087,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "ocsvm",
"default": "ocsvm",
+ "enum": ["ocsvm"],
"type": "string"
},
"window": {
@@ -1165,8 +1165,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "pca",
"default": "pca",
+ "enum": ["pca"],
"type": "string"
},
"window": {
@@ -1193,8 +1193,8 @@
"type": "string"
},
"type": {
- "const": "ensemble",
"default": "ensemble",
+ "enum": ["ensemble"],
"type": "string"
}
},
@@ -1261,8 +1261,8 @@
"description": "Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)"
},
"type": {
- "const": "zscore",
"default": "zscore",
+ "enum": ["zscore"],
"type": "string"
},
"window": {
@@ -1339,8 +1339,8 @@
"description": "Anomaly probability threshold [0-1]. Points above this probability are flagged (default: 0.9)"
},
"type": {
- "const": "mad",
"default": "mad",
+ "enum": ["mad"],
"type": "string"
},
"window": {
@@ -1417,8 +1417,8 @@
"description": "Preprocessing transforms applied before detection"
},
"type": {
- "const": "iqr",
"default": "iqr",
+ "enum": ["iqr"],
"type": "string"
},
"window": {
@@ -1495,8 +1495,8 @@
"description": "Preprocessing transforms applied before detection"
},
"type": {
- "const": "threshold",
"default": "threshold",
+ "enum": ["threshold"],
"type": "string"
},
"upper_bound": {
@@ -1573,8 +1573,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "ecod",
"default": "ecod",
+ "enum": ["ecod"],
"type": "string"
},
"window": {
@@ -1651,8 +1651,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "copod",
"default": "copod",
+ "enum": ["copod"],
"type": "string"
},
"window": {
@@ -1740,8 +1740,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "isolation_forest",
"default": "isolation_forest",
+ "enum": ["isolation_forest"],
"type": "string"
},
"window": {
@@ -1841,8 +1841,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "knn",
"default": "knn",
+ "enum": ["knn"],
"type": "string"
},
"window": {
@@ -1930,8 +1930,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "hbos",
"default": "hbos",
+ "enum": ["hbos"],
"type": "string"
},
"window": {
@@ -2019,8 +2019,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "lof",
"default": "lof",
+ "enum": ["lof"],
"type": "string"
},
"window": {
@@ -2119,8 +2119,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "ocsvm",
"default": "ocsvm",
+ "enum": ["ocsvm"],
"type": "string"
},
"window": {
@@ -2197,8 +2197,8 @@
"description": "Anomaly probability threshold (default: 0.9)"
},
"type": {
- "const": "pca",
"default": "pca",
+ "enum": ["pca"],
"type": "string"
},
"window": {