diff --git a/bin/build-schema-json.mjs b/bin/build-schema-json.mjs index a599ff528b743..17e58d8afed58 100644 --- a/bin/build-schema-json.mjs +++ b/bin/build-schema-json.mjs @@ -9,7 +9,7 @@ import tsj from 'ts-json-schema-generator' /** @type {import('ts-json-schema-generator/dist/src/Config').Config} */ const config = { ...tsj.DEFAULT_CONFIG, - path: 'frontend/src/queries/schema.ts', + path: 'frontend/src/queries/schema/index.ts', tsconfig: 'tsconfig.json', discriminatorType: 'open-api', skipTypeCheck: true, diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json index adf0ef5f77413..77276058740e7 100644 --- a/frontend/src/queries/schema.json +++ b/frontend/src/queries/schema.json @@ -5,7 +5,7 @@ "additionalProperties": false, "properties": { "actionId": { - "type": "integer" + "$ref": "#/definitions/integer" } }, "required": ["actionId"], @@ -25,7 +25,7 @@ "type": "array" }, "id": { - "type": "integer" + "$ref": "#/definitions/integer" }, "kind": { "const": "ActionsNode", @@ -68,7 +68,7 @@ "additionalProperties": false, "properties": { "group_type_index": { - "type": "integer" + "$ref": "#/definitions/integer" }, "kind": { "const": "ActorsPropertyTaxonomyQuery", @@ -126,7 +126,7 @@ "additionalProperties": false, "properties": { "sample_count": { - "type": "integer" + "$ref": "#/definitions/integer" }, "sample_values": { "items": { @@ -141,7 +141,7 @@ "type": "boolean" }, { - "type": "integer" + "$ref": "#/definitions/integer" } ] }, @@ -166,14 +166,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "orderBy": { "items": { @@ -239,17 +239,17 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "missing_actors_count": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -539,9 +539,9 @@ "additionalProperties": false, "properties": { "breakdown_limit": { + "$ref": "#/definitions/integer", "default": 25, - "description": "How many distinct values to show.", - "type": "integer" + "description": "How many distinct values to show." } }, "type": "object" @@ -582,7 +582,7 @@ "breakdown_group_type_index": { "anyOf": [ { - "type": "integer" + "$ref": "#/definitions/integer" }, { "type": "null" @@ -591,9 +591,9 @@ "description": "If `breakdown_type` is `group`, this is the index of the group. Use the index from the group mapping." }, "breakdown_limit": { + "$ref": "#/definitions/integer", "default": 25, - "description": "How many distinct values to show.", - "type": "integer" + "description": "How many distinct values to show." }, "breakdown_type": { "$ref": "#/definitions/AssistantFunnelsBreakdownType", @@ -648,10 +648,10 @@ "type": "string" }, "funnelFromStep": { - "type": "integer" + "$ref": "#/definitions/integer" }, "funnelToStep": { - "type": "integer" + "$ref": "#/definitions/integer" }, "kind": { "const": "EventsNode", @@ -697,9 +697,9 @@ "description": "Defines the type of visualization to use. The `steps` option is recommended. `steps` - shows a step-by-step funnel. Perfect to show a conversion rate of a sequence of events (default). `time_to_convert` - shows a histogram of the time it took to complete the funnel. Use this if the user asks about the average time it takes to complete the funnel. `trends` - shows a trend of the whole sequence's conversion rate over time. Use this if the user wants to see how the conversion rate changes over time." }, "funnelWindowInterval": { + "$ref": "#/definitions/integer", "default": 14, - "description": "Controls a time frame value for a conversion to be considered. Select a reasonable value based on the user's query. Use in combination with `funnelWindowIntervalUnit`. The default value is 14 days.", - "type": "integer" + "description": "Controls a time frame value for a conversion to be considered. Select a reasonable value based on the user's query. Use in combination with `funnelWindowIntervalUnit`. The default value is 14 days." }, "funnelWindowIntervalUnit": { "$ref": "#/definitions/FunnelConversionWindowTimeUnit", @@ -718,8 +718,8 @@ "additionalProperties": false, "properties": { "aggregation_group_type_index": { - "description": "Use this field to define the aggregation by a specific group from the group mapping that the user has provided.", - "type": "integer" + "$ref": "#/definitions/integer", + "description": "Use this field to define the aggregation by a specific group from the group mapping that the user has provided." }, "breakdownFilter": { "$ref": "#/definitions/AssistantFunnelsBreakdownFilter", @@ -811,8 +811,27 @@ "description": "`icontains` - case insensitive contains. `not_icontains` - case insensitive does not contain. `regex` - matches the regex pattern. `not_regex` - does not match the regex pattern." }, "type": { - "enum": ["event", "person", "session", "feature"], - "type": "string" + "anyOf": [ + { + "const": "event", + "description": "Event properties", + "type": "string" + }, + { + "const": "person", + "description": "Person properties", + "type": "string" + }, + { + "const": "session", + "type": "string" + }, + { + "const": "feature", + "description": "Event property with \"$feature/\" prepended", + "type": "string" + } + ] }, "value": { "description": "Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. Otherwise, the value must be a substring that will be matched against the property value.", @@ -834,8 +853,27 @@ "description": "`exact` - exact match of any of the values. `is_not` - does not match any of the values." }, "type": { - "enum": ["event", "person", "session", "feature"], - "type": "string" + "anyOf": [ + { + "const": "event", + "description": "Event properties", + "type": "string" + }, + { + "const": "person", + "description": "Person properties", + "type": "string" + }, + { + "const": "session", + "type": "string" + }, + { + "const": "feature", + "description": "Event property with \"$feature/\" prepended", + "type": "string" + } + ] }, "value": { "description": "Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string \"true\" or \"false\".", @@ -859,8 +897,27 @@ "$ref": "#/definitions/AssistantDateTimePropertyFilterOperator" }, "type": { - "enum": ["event", "person", "session", "feature"], - "type": "string" + "anyOf": [ + { + "const": "event", + "description": "Event properties", + "type": "string" + }, + { + "const": "person", + "description": "Person properties", + "type": "string" + }, + { + "const": "session", + "type": "string" + }, + { + "const": "feature", + "description": "Event property with \"$feature/\" prepended", + "type": "string" + } + ] }, "value": { "description": "Value must be a date in ISO 8601 format.", @@ -882,8 +939,27 @@ "description": "`is_set` - the property has any value. `is_not_set` - the property doesn't have a value or wasn't collected." }, "type": { - "enum": ["event", "person", "session", "feature"], - "type": "string" + "anyOf": [ + { + "const": "event", + "description": "Event properties", + "type": "string" + }, + { + "const": "person", + "description": "Person properties", + "type": "string" + }, + { + "const": "session", + "type": "string" + }, + { + "const": "feature", + "description": "Event property with \"$feature/\" prepended", + "type": "string" + } + ] } }, "required": ["key", "operator", "type"], @@ -897,7 +973,7 @@ "group_type_index": { "anyOf": [ { - "type": "integer" + "$ref": "#/definitions/integer" }, { "type": "null" @@ -923,8 +999,8 @@ "additionalProperties": false, "properties": { "group_type_index": { - "description": "Index of the group type from the group mapping.", - "type": "integer" + "$ref": "#/definitions/integer", + "description": "Index of the group type from the group mapping." }, "key": { "description": "Use one of the properties the user has provided in the plan.", @@ -950,8 +1026,8 @@ "additionalProperties": false, "properties": { "group_type_index": { - "description": "Index of the group type from the group mapping.", - "type": "integer" + "$ref": "#/definitions/integer", + "description": "Index of the group type from the group mapping." }, "key": { "description": "Use one of the properties the user has provided in the plan.", @@ -980,8 +1056,8 @@ "additionalProperties": false, "properties": { "group_type_index": { - "description": "Index of the group type from the group mapping.", - "type": "integer" + "$ref": "#/definitions/integer", + "description": "Index of the group type from the group mapping." }, "key": { "description": "Use one of the properties the user has provided in the plan.", @@ -1006,8 +1082,8 @@ "additionalProperties": false, "properties": { "group_type_index": { - "description": "Index of the group type from the group mapping.", - "type": "integer" + "$ref": "#/definitions/integer", + "description": "Index of the group type from the group mapping." }, "key": { "description": "Use one of the properties the user has provided in the plan.", @@ -1143,9 +1219,9 @@ "additionalProperties": false, "properties": { "breakdown_limit": { + "$ref": "#/definitions/integer", "default": 25, - "description": "How many distinct values to show.", - "type": "integer" + "description": "How many distinct values to show." }, "breakdowns": { "description": "Use this field to define breakdowns.", @@ -1474,7 +1550,7 @@ "group_type_index": { "anyOf": [ { - "type": "integer" + "$ref": "#/definitions/integer" }, { "type": "null" @@ -1482,7 +1558,7 @@ ] }, "histogram_bin_count": { - "type": "integer" + "$ref": "#/definitions/integer" }, "normalize_url": { "type": "boolean" @@ -1517,7 +1593,7 @@ "type": "string" }, { - "type": "integer" + "$ref": "#/definitions/integer" }, { "items": { @@ -1526,7 +1602,7 @@ "type": "string" }, { - "type": "integer" + "$ref": "#/definitions/integer" } ] }, @@ -1540,7 +1616,7 @@ "breakdown_group_type_index": { "anyOf": [ { - "type": "integer" + "$ref": "#/definitions/integer" }, { "type": "null" @@ -1551,10 +1627,10 @@ "type": ["boolean", "null"] }, "breakdown_histogram_bin_count": { - "type": "integer" + "$ref": "#/definitions/integer" }, "breakdown_limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "breakdown_normalize_url": { "type": "boolean" @@ -1646,7 +1722,7 @@ "type": "string" }, "BreakdownValueInt": { - "type": "integer" + "$ref": "#/definitions/integer" }, "CacheMissResponse": { "additionalProperties": false, @@ -1763,10 +1839,10 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "missing_actors_count": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", @@ -1777,7 +1853,7 @@ "type": "string" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -1861,7 +1937,7 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", @@ -1872,7 +1948,7 @@ "type": "string" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -2007,7 +2083,7 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", @@ -2018,7 +2094,7 @@ "type": "string" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -2133,7 +2209,7 @@ "type": "boolean" }, "stats_version": { - "type": "integer" + "$ref": "#/definitions/integer" }, "timezone": { "type": "string" @@ -2234,7 +2310,7 @@ "type": "boolean" }, "stats_version": { - "type": "integer" + "$ref": "#/definitions/integer" }, "timezone": { "type": "string" @@ -2300,7 +2376,7 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", @@ -2311,7 +2387,7 @@ "type": "string" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -2475,7 +2551,7 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "metadata": { "$ref": "#/definitions/HogQLMetadataResponse", @@ -2490,7 +2566,7 @@ "type": "string" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query": { "description": "Input query string", @@ -2606,8 +2682,8 @@ "type": "string" }, "value": { - "description": "An interval selected out of available intervals in source query", - "type": "integer" + "$ref": "#/definitions/integer", + "description": "An interval selected out of available intervals in source query" } }, "required": ["label", "value"], @@ -2638,7 +2714,7 @@ "type": "string" }, "value": { - "type": "integer" + "$ref": "#/definitions/integer" } }, "required": ["label", "value"], @@ -2910,7 +2986,7 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", @@ -2921,7 +2997,7 @@ "type": "string" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -3315,7 +3391,7 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", @@ -3326,7 +3402,7 @@ "type": "string" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -3401,7 +3477,7 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", @@ -3412,7 +3488,7 @@ "type": "string" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -3564,7 +3640,7 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", @@ -3575,7 +3651,7 @@ "type": "string" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -3635,6 +3711,10 @@ "required": ["column"], "type": "object" }, + "ChartDisplayCategory": { + "enum": ["TimeSeries", "CumulativeTimeSeries", "TotalValue"], + "type": "string" + }, "ChartDisplayType": { "enum": [ "ActionsLineGraph", @@ -3734,19 +3814,19 @@ "additionalProperties": false, "properties": { "active_cpu_time": { - "type": "integer" + "$ref": "#/definitions/integer" }, "bytes_read": { - "type": "integer" + "$ref": "#/definitions/integer" }, "estimated_rows_total": { - "type": "integer" + "$ref": "#/definitions/integer" }, "rows_read": { - "type": "integer" + "$ref": "#/definitions/integer" }, "time_elapsed": { - "type": "integer" + "$ref": "#/definitions/integer" } }, "required": ["bytes_read", "rows_read", "estimated_rows_total", "time_elapsed", "active_cpu_time"], @@ -4015,14 +4095,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -4071,17 +4151,17 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "missing_actors_count": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -4142,7 +4222,7 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "metadata": { "$ref": "#/definitions/HogQLMetadataResponse", @@ -4153,7 +4233,7 @@ "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query": { "description": "Input query string", @@ -4247,14 +4327,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -4301,14 +4381,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -4355,14 +4435,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -4409,14 +4489,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -4459,14 +4539,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -4535,7 +4615,7 @@ "type": "boolean" }, "stats_version": { - "type": "integer" + "$ref": "#/definitions/integer" }, "variants": { "items": { @@ -4602,7 +4682,7 @@ "type": "boolean" }, "stats_version": { - "type": "integer" + "$ref": "#/definitions/integer" }, "variants": { "items": { @@ -4968,7 +5048,7 @@ "type": "string" }, { - "type": "integer" + "$ref": "#/definitions/integer" } ] }, @@ -5244,7 +5324,7 @@ "type": "string" }, "Day": { - "type": "integer" + "$ref": "#/definitions/integer" }, "DefaultChannelTypes": { "enum": [ @@ -5453,7 +5533,7 @@ "assignee": { "anyOf": [ { - "type": "integer" + "$ref": "#/definitions/integer" }, { "type": "null" @@ -5477,14 +5557,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "orderBy": { "enum": ["last_seen", "first_seen", "occurrences", "users", "sessions"], @@ -5527,14 +5607,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -5585,13 +5665,13 @@ "$ref": "#/definitions/EventDefinition" }, "failure_count": { - "type": "integer" + "$ref": "#/definitions/integer" }, "odds_ratio": { "type": "number" }, "success_count": { - "type": "integer" + "$ref": "#/definitions/integer" } }, "required": ["event", "success_count", "failure_count", "odds_ratio", "correlation_type"], @@ -5630,7 +5710,7 @@ "type": "string" }, "sample_count": { - "type": "integer" + "$ref": "#/definitions/integer" }, "sample_values": { "items": { @@ -5784,7 +5864,7 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "math": { "$ref": "#/definitions/MathType" @@ -5830,8 +5910,8 @@ "additionalProperties": false, "properties": { "actionId": { - "description": "Show events matching a given action", - "type": "integer" + "$ref": "#/definitions/integer", + "description": "Show events matching a given action" }, "after": { "description": "Only fetch events that happened after this timestamp", @@ -5861,16 +5941,16 @@ "type": "string" }, "limit": { - "description": "Number of rows to return", - "type": "integer" + "$ref": "#/definitions/integer", + "description": "Number of rows to return" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "description": "Number of rows to skip before returning rows", - "type": "integer" + "$ref": "#/definitions/integer", + "description": "Number of rows to skip before returning rows" }, "orderBy": { "description": "Columns to order by", @@ -5958,14 +6038,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -5999,7 +6079,7 @@ "additionalProperties": false, "properties": { "experiment_id": { - "type": "integer" + "$ref": "#/definitions/integer" }, "funnels_query": { "$ref": "#/definitions/FunnelsQuery" @@ -6019,7 +6099,7 @@ "$ref": "#/definitions/ExperimentFunnelsQueryResponse" }, "stats_version": { - "type": "integer" + "$ref": "#/definitions/integer" } }, "required": ["funnels_query", "kind"], @@ -6071,7 +6151,7 @@ "type": "boolean" }, "stats_version": { - "type": "integer" + "$ref": "#/definitions/integer" }, "variants": { "items": { @@ -6103,7 +6183,7 @@ "$ref": "#/definitions/TrendsQuery" }, "experiment_id": { - "type": "integer" + "$ref": "#/definitions/integer" }, "exposure_query": { "$ref": "#/definitions/TrendsQuery" @@ -6123,7 +6203,7 @@ "$ref": "#/definitions/ExperimentTrendsQueryResponse" }, "stats_version": { - "type": "integer" + "$ref": "#/definitions/integer" } }, "required": ["count_query", "kind"], @@ -6175,7 +6255,7 @@ "type": "boolean" }, "stats_version": { - "type": "integer" + "$ref": "#/definitions/integer" }, "variants": { "items": { @@ -6385,14 +6465,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -6460,13 +6540,13 @@ "type": "array" }, "funnelFromStep": { - "type": "integer" + "$ref": "#/definitions/integer" }, "funnelToStep": { - "type": "integer" + "$ref": "#/definitions/integer" }, "id": { - "type": "integer" + "$ref": "#/definitions/integer" }, "kind": { "const": "ActionsNode", @@ -6523,17 +6603,17 @@ "type": "array" }, "funnelFromStep": { - "type": "integer" + "$ref": "#/definitions/integer" }, "funnelToStep": { - "type": "integer" + "$ref": "#/definitions/integer" }, "kind": { "const": "EventsNode", "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "math": { "$ref": "#/definitions/MathType" @@ -6610,10 +6690,10 @@ "additionalProperties": false, "properties": { "funnelFromStep": { - "type": "integer" + "$ref": "#/definitions/integer" }, "funnelToStep": { - "type": "integer" + "$ref": "#/definitions/integer" } }, "required": ["funnelFromStep", "funnelToStep"], @@ -6641,7 +6721,7 @@ "$ref": "#/definitions/FunnelsQuery" }, "funnelStep": { - "type": "integer" + "$ref": "#/definitions/integer" } }, "required": ["funnelSource"], @@ -6703,13 +6783,13 @@ "funnelCustomSteps": { "description": "Custom step numbers to get persons for. This overrides `funnelStep`. Primarily for correlation use.", "items": { - "type": "integer" + "$ref": "#/definitions/integer" }, "type": "array" }, "funnelStep": { - "description": "Index of the step for which we want to get the timestamp for, per person. Positive for converted persons, negative for dropped of persons.", - "type": "integer" + "$ref": "#/definitions/integer", + "description": "Index of the step for which we want to get the timestamp for, per person. Positive for converted persons, negative for dropped of persons." }, "funnelStepBreakdown": { "$ref": "#/definitions/BreakdownKeyType", @@ -6754,7 +6834,7 @@ "default": "first_touch" }, "breakdownAttributionValue": { - "type": "integer" + "$ref": "#/definitions/integer" }, "exclusions": { "default": [], @@ -6767,7 +6847,7 @@ "type": "string" }, "funnelFromStep": { - "type": "integer" + "$ref": "#/definitions/integer" }, "funnelOrderType": { "$ref": "#/definitions/StepOrderValue", @@ -6778,15 +6858,15 @@ "default": "total" }, "funnelToStep": { - "type": "integer" + "$ref": "#/definitions/integer" }, "funnelVizType": { "$ref": "#/definitions/FunnelVizType", "default": "steps" }, "funnelWindowInterval": { - "default": 14, - "type": "integer" + "$ref": "#/definitions/integer", + "default": 14 }, "funnelWindowIntervalUnit": { "$ref": "#/definitions/FunnelConversionWindowTimeUnit", @@ -6883,7 +6963,7 @@ "aggregation_group_type_index": { "anyOf": [ { - "type": "integer" + "$ref": "#/definitions/integer" }, { "type": "null" @@ -7127,8 +7207,8 @@ "additionalProperties": false, "properties": { "endPosition": { - "description": "End position of the editor word", - "type": "integer" + "$ref": "#/definitions/integer", + "description": "End position of the editor word" }, "filters": { "$ref": "#/definitions/HogQLFilters", @@ -7162,8 +7242,8 @@ "description": "Query in whose context to validate." }, "startPosition": { - "description": "Start position of the editor word", - "type": "integer" + "$ref": "#/definitions/integer", + "description": "Start position of the editor word" } }, "required": ["endPosition", "kind", "language", "query", "startPosition"], @@ -7312,7 +7392,7 @@ "additionalProperties": false, "properties": { "end": { - "type": "integer" + "$ref": "#/definitions/integer" }, "fix": { "type": "string" @@ -7321,7 +7401,7 @@ "type": "string" }, "start": { - "type": "integer" + "$ref": "#/definitions/integer" } }, "required": ["message"], @@ -7488,7 +7568,7 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "metadata": { "$ref": "#/definitions/HogQLMetadataResponse", @@ -7499,7 +7579,7 @@ "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query": { "description": "Input query string", @@ -7637,8 +7717,8 @@ "type": "boolean" }, "interval": { - "description": "An interval selected out of available intervals in source query.", - "type": "integer" + "$ref": "#/definitions/integer", + "description": "An interval selected out of available intervals in source query." }, "kind": { "const": "InsightActorsQuery", @@ -7652,7 +7732,7 @@ "$ref": "#/definitions/ActorsQueryResponse" }, "series": { - "type": "integer" + "$ref": "#/definitions/integer" }, "source": { "$ref": "#/definitions/InsightQuerySource" @@ -7776,8 +7856,8 @@ "type": "string" }, "value": { - "description": "An interval selected out of available intervals in source query", - "type": "integer" + "$ref": "#/definitions/integer", + "description": "An interval selected out of available intervals in source query" } }, "required": ["label", "value"], @@ -7793,7 +7873,7 @@ "type": "string" }, "value": { - "type": "integer" + "$ref": "#/definitions/integer" } }, "required": ["label", "value"], @@ -7973,7 +8053,7 @@ "aggregation_group_type_index": { "anyOf": [ { - "type": "integer" + "$ref": "#/definitions/integer" }, { "type": "null" @@ -8034,7 +8114,7 @@ "aggregation_group_type_index": { "anyOf": [ { - "type": "integer" + "$ref": "#/definitions/integer" }, { "type": "null" @@ -8095,7 +8175,7 @@ "aggregation_group_type_index": { "anyOf": [ { - "type": "integer" + "$ref": "#/definitions/integer" }, { "type": "null" @@ -8156,7 +8236,7 @@ "aggregation_group_type_index": { "anyOf": [ { - "type": "integer" + "$ref": "#/definitions/integer" }, { "type": "null" @@ -8217,7 +8297,7 @@ "aggregation_group_type_index": { "anyOf": [ { - "type": "integer" + "$ref": "#/definitions/integer" }, { "type": "null" @@ -8331,7 +8411,7 @@ "aggregation_group_type_index": { "anyOf": [ { - "type": "integer" + "$ref": "#/definitions/integer" }, { "type": "null" @@ -8596,8 +8676,8 @@ "additionalProperties": false, "properties": { "edgeLimit": { - "default": 50, - "type": "integer" + "$ref": "#/definitions/integer", + "default": 50 }, "endPoint": { "type": "string" @@ -8661,8 +8741,8 @@ "type": "string" }, "stepLimit": { - "default": 5, - "type": "integer" + "$ref": "#/definitions/integer", + "default": 5 } }, "type": "object" @@ -8744,7 +8824,7 @@ "aggregation_group_type_index": { "anyOf": [ { - "type": "integer" + "$ref": "#/definitions/integer" }, { "type": "null" @@ -8904,7 +8984,7 @@ "deprecated": "Use `ActorsQuery` instead.", "properties": { "cohort": { - "type": "integer" + "$ref": "#/definitions/integer" }, "distinctId": { "type": "string" @@ -8921,14 +9001,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "properties": { "description": "Properties configurable in the interface", @@ -9111,14 +9191,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -9167,17 +9247,17 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "missing_actors_count": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -9272,8 +9352,8 @@ "type": "string" }, "value": { - "description": "An interval selected out of available intervals in source query", - "type": "integer" + "$ref": "#/definitions/integer", + "description": "An interval selected out of available intervals in source query" } }, "required": ["label", "value"], @@ -9289,7 +9369,7 @@ "type": "string" }, "value": { - "type": "integer" + "$ref": "#/definitions/integer" } }, "required": ["label", "value"], @@ -9405,7 +9485,7 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "metadata": { "$ref": "#/definitions/HogQLMetadataResponse", @@ -9416,7 +9496,7 @@ "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query": { "description": "Input query string", @@ -9574,14 +9654,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -9628,14 +9708,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -9682,14 +9762,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -9736,14 +9816,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -9786,14 +9866,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -9862,7 +9942,7 @@ "type": "boolean" }, "stats_version": { - "type": "integer" + "$ref": "#/definitions/integer" }, "variants": { "items": { @@ -9929,7 +10009,7 @@ "type": "boolean" }, "stats_version": { - "type": "integer" + "$ref": "#/definitions/integer" }, "variants": { "items": { @@ -9976,14 +10056,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -10032,17 +10112,17 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "missing_actors_count": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -10103,7 +10183,7 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "metadata": { "$ref": "#/definitions/HogQLMetadataResponse", @@ -10114,7 +10194,7 @@ "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query": { "description": "Input query string", @@ -10208,14 +10288,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -10262,14 +10342,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -10316,14 +10396,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -10370,14 +10450,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -10420,14 +10500,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -10496,7 +10576,7 @@ "type": "boolean" }, "stats_version": { - "type": "integer" + "$ref": "#/definitions/integer" }, "variants": { "items": { @@ -10563,7 +10643,7 @@ "type": "boolean" }, "stats_version": { - "type": "integer" + "$ref": "#/definitions/integer" }, "variants": { "items": { @@ -10836,14 +10916,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -11126,7 +11206,7 @@ "type": "boolean" }, "dashboard_id": { - "type": "integer" + "$ref": "#/definitions/integer" }, "end_time": { "description": "When did the query execution task finish (whether successfully or not).", @@ -11150,7 +11230,7 @@ "type": "string" }, "insight_id": { - "type": "integer" + "$ref": "#/definitions/integer" }, "labels": { "items": { @@ -11182,7 +11262,7 @@ "type": "string" }, "team_id": { - "type": "integer" + "$ref": "#/definitions/integer" } }, "required": ["id", "query_async", "team_id", "error", "complete", "error_message"], @@ -11328,14 +11408,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "operand": { "$ref": "#/definitions/FilterLogicalOperator", @@ -11531,8 +11611,8 @@ "$ref": "#/definitions/RetentionEntity" }, "totalIntervals": { - "default": 11, - "type": "integer" + "$ref": "#/definitions/integer", + "default": 11 } }, "type": "object" @@ -11579,7 +11659,7 @@ "aggregation_group_type_index": { "anyOf": [ { - "type": "integer" + "$ref": "#/definitions/integer" }, { "type": "null" @@ -11702,7 +11782,7 @@ "additionalProperties": false, "properties": { "count": { - "type": "integer" + "$ref": "#/definitions/integer" } }, "required": ["count"], @@ -11927,14 +12007,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "response": { "$ref": "#/definitions/SessionAttributionExplorerQueryResponse" @@ -11962,14 +12042,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -12189,7 +12269,7 @@ }, "hiddenLegendIndexes": { "items": { - "type": "integer" + "$ref": "#/definitions/integer" }, "type": "array" }, @@ -12206,7 +12286,7 @@ "$ref": "#/definitions/StickinessOperator" }, "value": { - "type": "integer" + "$ref": "#/definitions/integer" } }, "required": ["operator", "value"], @@ -12448,7 +12528,7 @@ "additionalProperties": false, "properties": { "count": { - "type": "integer" + "$ref": "#/definitions/integer" }, "event": { "type": "string" @@ -12645,7 +12725,7 @@ "type": "boolean" }, "series_index": { - "type": "integer" + "$ref": "#/definitions/integer" }, "type": { "const": "TrendsAlertConfig", @@ -12683,7 +12763,7 @@ }, "hiddenLegendIndexes": { "items": { - "type": "integer" + "$ref": "#/definitions/integer" }, "type": "array" }, @@ -12732,8 +12812,8 @@ "type": "boolean" }, "smoothingIntervals": { - "default": 1, - "type": "integer" + "$ref": "#/definitions/integer", + "default": 1 }, "yAxisScaleType": { "enum": ["log10", "linear"], @@ -12817,7 +12897,7 @@ "aggregation_group_type_index": { "anyOf": [ { - "type": "integer" + "$ref": "#/definitions/integer" }, { "type": "null" @@ -13067,7 +13147,7 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", @@ -13121,14 +13201,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -13183,7 +13263,7 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", @@ -13234,14 +13314,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -13467,7 +13547,7 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", @@ -13518,14 +13598,14 @@ "type": "string" }, "limit": { - "type": "integer" + "$ref": "#/definitions/integer" }, "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, "offset": { - "type": "integer" + "$ref": "#/definitions/integer" }, "query_status": { "$ref": "#/definitions/QueryStatus", @@ -13567,8 +13647,8 @@ }, "type": "object" }, - "numerical_key": { - "type": "string" + "integer": { + "type": "integer" } } } diff --git a/frontend/src/queries/schema/index.ts b/frontend/src/queries/schema/index.ts new file mode 100644 index 0000000000000..6637b73a694c1 --- /dev/null +++ b/frontend/src/queries/schema/index.ts @@ -0,0 +1,5 @@ +/* eslint-disable simple-import-sort/exports */ +export * from './schema-general' +export * from './schema-assistant-queries' +export * from './schema-assistant-messages' +/* eslint-enable simple-import-sort/exports */ diff --git a/frontend/src/queries/schema/schema-assistant-messages.ts b/frontend/src/queries/schema/schema-assistant-messages.ts new file mode 100644 index 0000000000000..16c13b356e66c --- /dev/null +++ b/frontend/src/queries/schema/schema-assistant-messages.ts @@ -0,0 +1,70 @@ +import { AssistantFunnelsQuery, AssistantTrendsQuery } from './schema-assistant-queries' + +export enum AssistantMessageType { + Human = 'human', + Assistant = 'ai', + Reasoning = 'ai/reasoning', + Visualization = 'ai/viz', + Failure = 'ai/failure', + Router = 'ai/router', +} + +export interface BaseAssistantMessage { + id?: string +} + +export interface HumanMessage extends BaseAssistantMessage { + type: AssistantMessageType.Human + content: string +} + +export interface AssistantMessage extends BaseAssistantMessage { + type: AssistantMessageType.Assistant + content: string +} + +export interface ReasoningMessage extends BaseAssistantMessage { + type: AssistantMessageType.Reasoning + content: string + substeps?: string[] +} + +export interface VisualizationMessage extends BaseAssistantMessage { + type: AssistantMessageType.Visualization + plan?: string + answer?: AssistantTrendsQuery | AssistantFunnelsQuery + initiator?: string +} + +export interface FailureMessage extends BaseAssistantMessage { + type: AssistantMessageType.Failure + content?: string +} + +export interface RouterMessage extends BaseAssistantMessage { + type: AssistantMessageType.Router + content: string +} + +export type RootAssistantMessage = + | VisualizationMessage + | ReasoningMessage + | AssistantMessage + | HumanMessage + | FailureMessage + | RouterMessage + +export enum AssistantEventType { + Status = 'status', + Message = 'message', + Conversation = 'conversation', +} + +export enum AssistantGenerationStatusType { + Acknowledged = 'ack', + GenerationError = 'generation_error', +} + +export interface AssistantGenerationStatusEvent { + type: AssistantGenerationStatusType +} diff --git a/frontend/src/queries/schema/schema-assistant-queries.ts b/frontend/src/queries/schema/schema-assistant-queries.ts new file mode 100644 index 0000000000000..3103b7c551b9f --- /dev/null +++ b/frontend/src/queries/schema/schema-assistant-queries.ts @@ -0,0 +1,408 @@ +import { BreakdownType, FunnelMathType, IntervalType, PropertyFilterType, PropertyOperator } from '~/types' + +import { + CompareFilter, + DateRange, + EventsNode, + FunnelExclusionSteps, + FunnelsFilterLegacy, + MultipleBreakdownType, + Node, + NodeKind, + TrendsFilterLegacy, +} from './schema-general' +import { integer } from './type-utils' + +export type AssistantArrayPropertyFilterOperator = PropertyOperator.Exact | PropertyOperator.IsNot +export interface AssistantArrayPropertyFilter { + /** + * `exact` - exact match of any of the values. + * `is_not` - does not match any of the values. + */ + operator: AssistantArrayPropertyFilterOperator + /** + * Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string "true" or "false". + */ + value: string[] +} + +export type AssistantSetPropertyFilterOperator = PropertyOperator.IsSet | PropertyOperator.IsNotSet + +export interface AssistantSetPropertyFilter { + /** + * `is_set` - the property has any value. + * `is_not_set` - the property doesn't have a value or wasn't collected. + */ + operator: AssistantSetPropertyFilterOperator +} + +export type AssistantSingleValuePropertyFilterOperator = + | PropertyOperator.Exact + | PropertyOperator.IsNot + | PropertyOperator.IContains + | PropertyOperator.NotIContains + | PropertyOperator.Regex + | PropertyOperator.NotRegex + +export interface AssistantSingleValuePropertyFilter { + /** + * `icontains` - case insensitive contains. + * `not_icontains` - case insensitive does not contain. + * `regex` - matches the regex pattern. + * `not_regex` - does not match the regex pattern. + */ + operator: AssistantSingleValuePropertyFilterOperator + /** + * Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. + * Otherwise, the value must be a substring that will be matched against the property value. + */ + value: string +} + +export type AssistantStringNumberOrBooleanPropertyFilter = + | AssistantSingleValuePropertyFilter + | AssistantArrayPropertyFilter + +export type AssistantDateTimePropertyFilterOperator = + | PropertyOperator.IsDateExact + | PropertyOperator.IsDateBefore + | PropertyOperator.IsDateAfter + +export interface AssistantDateTimePropertyFilter { + operator: AssistantDateTimePropertyFilterOperator + /** + * Value must be a date in ISO 8601 format. + */ + value: string +} + +export type AssistantBasePropertyFilter = + | AssistantStringNumberOrBooleanPropertyFilter + | AssistantDateTimePropertyFilter + | AssistantSetPropertyFilter + +export type AssistantGenericPropertyFilter = AssistantBasePropertyFilter & { + type: PropertyFilterType.Event | PropertyFilterType.Person | PropertyFilterType.Session | PropertyFilterType.Feature + /** + * Use one of the properties the user has provided in the plan. + */ + key: string +} + +export type AssistantGroupPropertyFilter = AssistantBasePropertyFilter & { + type: PropertyFilterType.Group + /** + * Use one of the properties the user has provided in the plan. + */ + key: string + /** + * Index of the group type from the group mapping. + */ + group_type_index: integer +} + +export type AssistantPropertyFilter = AssistantGenericPropertyFilter | AssistantGroupPropertyFilter + +export interface AssistantInsightsQueryBase { + /** + * Date range for the query + */ + dateRange?: DateRange + + /** + * Exclude internal and test users by applying the respective filters + * + * @default false + */ + filterTestAccounts?: boolean + + /** + * Property filters for all series + * + * @default [] + */ + properties?: AssistantPropertyFilter[] + + /** + * Sampling rate from 0 to 1 where 1 is 100% of the data. + */ + samplingFactor?: number | null +} + +export interface AssistantTrendsEventsNode + extends Omit { + properties?: AssistantPropertyFilter[] +} + +export interface AssistantBaseMultipleBreakdownFilter { + /** + * Property name from the plan to break down by. + */ + property: string +} + +export interface AssistantGroupMultipleBreakdownFilter extends AssistantBaseMultipleBreakdownFilter { + type: 'group' + /** + * Index of the group type from the group mapping. + */ + group_type_index?: integer | null +} + +export type AssistantEventMultipleBreakdownFilterType = Exclude + +export interface AssistantGenericMultipleBreakdownFilter extends AssistantBaseMultipleBreakdownFilter { + type: AssistantEventMultipleBreakdownFilterType +} + +export type AssistantMultipleBreakdownFilter = + | AssistantGroupMultipleBreakdownFilter + | AssistantGenericMultipleBreakdownFilter + +export interface AssistantBreakdownFilter { + /** + * How many distinct values to show. + * @default 25 + */ + breakdown_limit?: integer +} + +export interface AssistantTrendsBreakdownFilter extends AssistantBreakdownFilter { + /** + * Use this field to define breakdowns. + * @maxLength 3 + */ + breakdowns: AssistantMultipleBreakdownFilter[] +} + +// Remove deprecated display types. +export type AssistantTrendsDisplayType = Exclude + +export interface AssistantTrendsFilter { + /** + * If the formula is provided, apply it here. + */ + formula?: TrendsFilterLegacy['formula'] + + /** + * Visualization type. Available values: + * `ActionsLineGraph` - time-series line chart; most common option, as it shows change over time. + * `ActionsBar` - time-series bar chart. + * `ActionsAreaGraph` - time-series area chart. + * `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics. + * `BoldNumber` - total value single large number. You can't use this with breakdown; use when user explicitly asks for a single output number. + * `ActionsBarValue` - total value (NOT time-series) bar chart; good for categorical data. + * `ActionsPie` - total value pie chart; good for visualizing proportions. + * `ActionsTable` - total value table; good when using breakdown to list users or other entities. + * `WorldMap` - total value world map; use when breaking down by country name using property `$geoip_country_name`, and only then. + * @default ActionsLineGraph + */ + display?: AssistantTrendsDisplayType + + /** + * Whether to show the legend describing series and breakdowns. + * @default false + */ + showLegend?: TrendsFilterLegacy['show_legend'] + + /** + * Formats the trends value axis. Do not use the formatting unless you are absolutely sure that formatting will match the data. + * `numeric` - no formatting. Prefer this option by default. + * `duration` - formats the value in seconds to a human-readable duration, e.g., `132` becomes `2 minutes 12 seconds`. Use this option only if you are sure that the values are in seconds. + * `duration_ms` - formats the value in miliseconds to a human-readable duration, e.g., `1050` becomes `1 second 50 milliseconds`. Use this option only if you are sure that the values are in miliseconds. + * `percentage` - adds a percentage sign to the value, e.g., `50` becomes `50%`. + * `percentage_scaled` - formats the value as a percentage scaled to 0-100, e.g., `0.5` becomes `50%`. + * @default numeric + */ + aggregationAxisFormat?: TrendsFilterLegacy['aggregation_axis_format'] + + /** + * Custom prefix to add to the aggregation axis, e.g., `$` for USD dollars. You may need to add a space after prefix. + */ + aggregationAxisPrefix?: TrendsFilterLegacy['aggregation_axis_prefix'] + + /** + * Custom postfix to add to the aggregation axis, e.g., ` clicks` to format 5 as `5 clicks`. You may need to add a space before postfix. + */ + aggregationAxisPostfix?: TrendsFilterLegacy['aggregation_axis_postfix'] + + /** + * Number of decimal places to show. Do not add this unless you are sure that values will have a decimal point. + */ + decimalPlaces?: TrendsFilterLegacy['decimal_places'] + + /** + * Whether to show a value on each data point. + * @default false + */ + showValuesOnSeries?: TrendsFilterLegacy['show_values_on_series'] + + /** + * Whether to show a percentage of each series. Use only with + * @default false + */ + showPercentStackView?: TrendsFilterLegacy['show_percent_stack_view'] + + /** + * Whether to scale the y-axis. + * @default linear + */ + yAxisScaleType?: TrendsFilterLegacy['y_axis_scale_type'] +} + +export interface AssistantTrendsQuery extends AssistantInsightsQueryBase { + kind: NodeKind.TrendsQuery + + /** + * Granularity of the response. Can be one of `hour`, `day`, `week` or `month` + * + * @default day + */ + interval?: IntervalType + + /** + * Events to include + */ + series: AssistantTrendsEventsNode[] + + /** + * Properties specific to the trends insight + */ + trendsFilter?: AssistantTrendsFilter + + /** + * Breakdown of the events + */ + breakdownFilter?: AssistantTrendsBreakdownFilter + + /** + * Compare to date range + */ + compareFilter?: CompareFilter +} + +export type AssistantTrendsMath = FunnelMathType.FirstTimeForUser | FunnelMathType.FirstTimeForUserWithFilters + +export interface AssistantFunnelsEventsNode extends Node { + kind: NodeKind.EventsNode + /** + * Name of the event. + */ + event: string + /** + * Optional custom name for the event if it is needed to be renamed. + */ + custom_name?: string + /** + * Optional math aggregation type for the series. Only specify this math type if the user wants one of these. + * `first_time_for_user` - counts the number of users who have completed the event for the first time ever. + * `first_time_for_user_with_filters` - counts the number of users who have completed the event with specified filters for the first time. + */ + math?: AssistantTrendsMath + properties?: AssistantPropertyFilter[] +} + +/** + * Exclustion steps for funnels. The "from" and "to" steps must not exceed the funnel's series length. + */ +export interface AssistantFunnelsExclusionEventsNode extends FunnelExclusionSteps { + kind: NodeKind.EventsNode + event: string +} + +export interface AssistantFunnelsFilter { + /** + * Defines the behavior of event matching between steps. Prefer the `strict` option unless explicitly told to use a different one. + * `ordered` - defines a sequential funnel. Step B must happen after Step A, but any number of events can happen between A and B. + * `strict` - defines a funnel where all events must happen in order. Step B must happen directly after Step A without any events in between. + * `any` - order doesn't matter. Steps can be completed in any sequence. + * @default ordered + */ + funnelOrderType?: FunnelsFilterLegacy['funnel_order_type'] + /** + * Defines the type of visualization to use. The `steps` option is recommended. + * `steps` - shows a step-by-step funnel. Perfect to show a conversion rate of a sequence of events (default). + * `time_to_convert` - shows a histogram of the time it took to complete the funnel. Use this if the user asks about the average time it takes to complete the funnel. + * `trends` - shows a trend of the whole sequence's conversion rate over time. Use this if the user wants to see how the conversion rate changes over time. + * @default steps + */ + funnelVizType?: FunnelsFilterLegacy['funnel_viz_type'] + /** + * Users may want to use exclusion events to filter out conversions in which a particular event occurred between specific steps. These events must not be included in the main sequence. + * You must include start and end indexes for each exclusion where the minimum index is one and the maximum index is the number of steps in the funnel. + * For example, there is a sequence with three steps: sign up, finish onboarding, purchase. If the user wants to exclude all conversions in which users left the page before finishing the onboarding, the exclusion step would be the event `$pageleave` with start index 2 and end index 3. + * @default [] + */ + exclusions?: AssistantFunnelsExclusionEventsNode[] + /** + * Controls how the funnel chart is displayed: vertically (preferred) or horizontally. + * @default vertical + */ + layout?: FunnelsFilterLegacy['layout'] + /** + * Use this setting only when `funnelVizType` is `time_to_convert`: number of bins to show in histogram. + * @asType integer + */ + binCount?: FunnelsFilterLegacy['bin_count'] + /** + * Controls a time frame value for a conversion to be considered. Select a reasonable value based on the user's query. Use in combination with `funnelWindowIntervalUnit`. The default value is 14 days. + * @default 14 + */ + funnelWindowInterval?: integer + /** + * Controls a time frame interval for a conversion to be considered. Select a reasonable value based on the user's query. Use in combination with `funnelWindowInterval`. The default value is 14 days. + * @default day + */ + funnelWindowIntervalUnit?: FunnelsFilterLegacy['funnel_window_interval_unit'] + /** + * Whether conversion shown in the graph should be across all steps or just relative to the previous step. + * @default total + */ + funnelStepReference?: FunnelsFilterLegacy['funnel_step_reference'] + /** + * Use this field only if the user explicitly asks to aggregate the funnel by unique sessions. + */ + funnelAggregateByHogQL?: 'properties.$session_id' +} + +export type AssistantFunnelsBreakdownType = Extract + +export interface AssistantFunnelsBreakdownFilter extends AssistantBreakdownFilter { + /** + * Type of the entity to break down by. If `group` is used, you must also provide `breakdown_group_type_index` from the group mapping. + * @default event + */ + breakdown_type: AssistantFunnelsBreakdownType + /** + * The entity property to break down by. + */ + breakdown: string + /** + * If `breakdown_type` is `group`, this is the index of the group. Use the index from the group mapping. + */ + breakdown_group_type_index?: integer | null +} + +export interface AssistantFunnelsQuery extends AssistantInsightsQueryBase { + kind: NodeKind.FunnelsQuery + /** + * Granularity of the response. Can be one of `hour`, `day`, `week` or `month` + */ + interval?: IntervalType + /** + * Events to include + */ + series: AssistantFunnelsEventsNode[] + /** + * Properties specific to the funnels insight + */ + funnelsFilter?: AssistantFunnelsFilter + /** + * Breakdown the chart by a property + */ + breakdownFilter?: AssistantFunnelsBreakdownFilter + /** + * Use this field to define the aggregation by a specific group from the group mapping that the user has provided. + */ + aggregation_group_type_index?: integer +} diff --git a/frontend/src/queries/schema.ts b/frontend/src/queries/schema/schema-general.ts similarity index 79% rename from frontend/src/queries/schema.ts rename to frontend/src/queries/schema/schema-general.ts index 26b995a1c6d1d..736d27d457973 100644 --- a/frontend/src/queries/schema.ts +++ b/frontend/src/queries/schema/schema-general.ts @@ -27,7 +27,6 @@ import { LogEntryPropertyFilter, PathsFilterType, PersonPropertyFilter, - PropertyFilterType, PropertyGroupFilter, PropertyMathType, PropertyOperator, @@ -38,15 +37,9 @@ import { TrendsFilterType, } from '~/types' -export { ChartDisplayCategory } - -// Type alias for number to be reflected as integer in json-schema. -/** @asType integer */ -type integer = number +import { integer, numerical_key } from './type-utils' -// Type alias for a numerical key. Needs to be reflected as string in json-schema, as JSON only supports string keys. -/** @asType string */ -export type numerical_key = number +export { ChartDisplayCategory } /** * PostHog Query Schema definition. @@ -951,243 +944,6 @@ export interface TrendsQuery extends InsightsQueryBase { conversionGoal?: WebAnalyticsConversionGoal | null } -export type AssistantArrayPropertyFilterOperator = PropertyOperator.Exact | PropertyOperator.IsNot -export interface AssistantArrayPropertyFilter { - /** - * `exact` - exact match of any of the values. - * `is_not` - does not match any of the values. - */ - operator: AssistantArrayPropertyFilterOperator - /** - * Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string "true" or "false". - */ - value: string[] -} - -export type AssistantSetPropertyFilterOperator = PropertyOperator.IsSet | PropertyOperator.IsNotSet - -export interface AssistantSetPropertyFilter { - /** - * `is_set` - the property has any value. - * `is_not_set` - the property doesn't have a value or wasn't collected. - */ - operator: AssistantSetPropertyFilterOperator -} - -export type AssistantSingleValuePropertyFilterOperator = - | PropertyOperator.Exact - | PropertyOperator.IsNot - | PropertyOperator.IContains - | PropertyOperator.NotIContains - | PropertyOperator.Regex - | PropertyOperator.NotRegex - -export interface AssistantSingleValuePropertyFilter { - /** - * `icontains` - case insensitive contains. - * `not_icontains` - case insensitive does not contain. - * `regex` - matches the regex pattern. - * `not_regex` - does not match the regex pattern. - */ - operator: AssistantSingleValuePropertyFilterOperator - /** - * Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. - * Otherwise, the value must be a substring that will be matched against the property value. - */ - value: string -} - -export type AssistantStringNumberOrBooleanPropertyFilter = - | AssistantSingleValuePropertyFilter - | AssistantArrayPropertyFilter - -export type AssistantDateTimePropertyFilterOperator = - | PropertyOperator.IsDateExact - | PropertyOperator.IsDateBefore - | PropertyOperator.IsDateAfter - -export interface AssistantDateTimePropertyFilter { - operator: AssistantDateTimePropertyFilterOperator - /** - * Value must be a date in ISO 8601 format. - */ - value: string -} - -export type AssistantBasePropertyFilter = - | AssistantStringNumberOrBooleanPropertyFilter - | AssistantDateTimePropertyFilter - | AssistantSetPropertyFilter - -export type AssistantGenericPropertyFilter = AssistantBasePropertyFilter & { - type: PropertyFilterType.Event | PropertyFilterType.Person | PropertyFilterType.Session | PropertyFilterType.Feature - /** - * Use one of the properties the user has provided in the plan. - */ - key: string -} - -export type AssistantGroupPropertyFilter = AssistantBasePropertyFilter & { - type: PropertyFilterType.Group - /** - * Use one of the properties the user has provided in the plan. - */ - key: string - /** - * Index of the group type from the group mapping. - */ - group_type_index: integer -} - -export type AssistantPropertyFilter = AssistantGenericPropertyFilter | AssistantGroupPropertyFilter - -export interface AssistantInsightsQueryBase { - /** - * Date range for the query - */ - dateRange?: DateRange - - /** - * Exclude internal and test users by applying the respective filters - * - * @default false - */ - filterTestAccounts?: boolean - - /** - * Property filters for all series - * - * @default [] - */ - properties?: AssistantPropertyFilter[] - - /** - * Sampling rate from 0 to 1 where 1 is 100% of the data. - */ - samplingFactor?: number | null -} - -export interface AssistantTrendsEventsNode - extends Omit { - properties?: AssistantPropertyFilter[] -} - -export interface AssistantBaseMultipleBreakdownFilter { - /** - * Property name from the plan to break down by. - */ - property: string -} - -export interface AssistantGroupMultipleBreakdownFilter extends AssistantBaseMultipleBreakdownFilter { - type: 'group' - /** - * Index of the group type from the group mapping. - */ - group_type_index?: integer | null -} - -export type AssistantEventMultipleBreakdownFilterType = Exclude - -export interface AssistantGenericMultipleBreakdownFilter extends AssistantBaseMultipleBreakdownFilter { - type: AssistantEventMultipleBreakdownFilterType -} - -export type AssistantMultipleBreakdownFilter = - | AssistantGroupMultipleBreakdownFilter - | AssistantGenericMultipleBreakdownFilter - -export interface AssistantBreakdownFilter { - /** - * How many distinct values to show. - * @default 25 - */ - breakdown_limit?: integer -} - -export interface AssistantTrendsBreakdownFilter extends AssistantBreakdownFilter { - /** - * Use this field to define breakdowns. - * @maxLength 3 - */ - breakdowns: AssistantMultipleBreakdownFilter[] -} - -// Remove deprecated display types. -export type AssistantTrendsDisplayType = Exclude - -export interface AssistantTrendsFilter { - /** - * If the formula is provided, apply it here. - */ - formula?: TrendsFilterLegacy['formula'] - - /** - * Visualization type. Available values: - * `ActionsLineGraph` - time-series line chart; most common option, as it shows change over time. - * `ActionsBar` - time-series bar chart. - * `ActionsAreaGraph` - time-series area chart. - * `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics. - * `BoldNumber` - total value single large number. You can't use this with breakdown; use when user explicitly asks for a single output number. - * `ActionsBarValue` - total value (NOT time-series) bar chart; good for categorical data. - * `ActionsPie` - total value pie chart; good for visualizing proportions. - * `ActionsTable` - total value table; good when using breakdown to list users or other entities. - * `WorldMap` - total value world map; use when breaking down by country name using property `$geoip_country_name`, and only then. - * @default ActionsLineGraph - */ - display?: AssistantTrendsDisplayType - - /** - * Whether to show the legend describing series and breakdowns. - * @default false - */ - showLegend?: TrendsFilterLegacy['show_legend'] - - /** - * Formats the trends value axis. Do not use the formatting unless you are absolutely sure that formatting will match the data. - * `numeric` - no formatting. Prefer this option by default. - * `duration` - formats the value in seconds to a human-readable duration, e.g., `132` becomes `2 minutes 12 seconds`. Use this option only if you are sure that the values are in seconds. - * `duration_ms` - formats the value in miliseconds to a human-readable duration, e.g., `1050` becomes `1 second 50 milliseconds`. Use this option only if you are sure that the values are in miliseconds. - * `percentage` - adds a percentage sign to the value, e.g., `50` becomes `50%`. - * `percentage_scaled` - formats the value as a percentage scaled to 0-100, e.g., `0.5` becomes `50%`. - * @default numeric - */ - aggregationAxisFormat?: TrendsFilterLegacy['aggregation_axis_format'] - - /** - * Custom prefix to add to the aggregation axis, e.g., `$` for USD dollars. You may need to add a space after prefix. - */ - aggregationAxisPrefix?: TrendsFilterLegacy['aggregation_axis_prefix'] - - /** - * Custom postfix to add to the aggregation axis, e.g., ` clicks` to format 5 as `5 clicks`. You may need to add a space before postfix. - */ - aggregationAxisPostfix?: TrendsFilterLegacy['aggregation_axis_postfix'] - - /** - * Number of decimal places to show. Do not add this unless you are sure that values will have a decimal point. - */ - decimalPlaces?: TrendsFilterLegacy['decimal_places'] - - /** - * Whether to show a value on each data point. - * @default false - */ - showValuesOnSeries?: TrendsFilterLegacy['show_values_on_series'] - - /** - * Whether to show a percentage of each series. Use only with - * @default false - */ - showPercentStackView?: TrendsFilterLegacy['show_percent_stack_view'] - - /** - * Whether to scale the y-axis. - * @default linear - */ - yAxisScaleType?: TrendsFilterLegacy['y_axis_scale_type'] -} - export interface CompareFilter { /** * Whether to compare the current date range to a previous date range. @@ -1201,163 +957,6 @@ export interface CompareFilter { compare_to?: string } -export interface AssistantTrendsQuery extends AssistantInsightsQueryBase { - kind: NodeKind.TrendsQuery - - /** - * Granularity of the response. Can be one of `hour`, `day`, `week` or `month` - * - * @default day - */ - interval?: IntervalType - - /** - * Events to include - */ - series: AssistantTrendsEventsNode[] - - /** - * Properties specific to the trends insight - */ - trendsFilter?: AssistantTrendsFilter - - /** - * Breakdown of the events - */ - breakdownFilter?: AssistantTrendsBreakdownFilter - - /** - * Compare to date range - */ - compareFilter?: CompareFilter -} - -export type AssistantTrendsMath = FunnelMathType.FirstTimeForUser | FunnelMathType.FirstTimeForUserWithFilters - -export interface AssistantFunnelsEventsNode extends Node { - kind: NodeKind.EventsNode - /** - * Name of the event. - */ - event: string - /** - * Optional custom name for the event if it is needed to be renamed. - */ - custom_name?: string - /** - * Optional math aggregation type for the series. Only specify this math type if the user wants one of these. - * `first_time_for_user` - counts the number of users who have completed the event for the first time ever. - * `first_time_for_user_with_filters` - counts the number of users who have completed the event with specified filters for the first time. - */ - math?: AssistantTrendsMath - properties?: AssistantPropertyFilter[] -} - -/** - * Exclustion steps for funnels. The "from" and "to" steps must not exceed the funnel's series length. - */ -export interface AssistantFunnelsExclusionEventsNode extends FunnelExclusionSteps { - kind: NodeKind.EventsNode - event: string -} - -export interface AssistantFunnelsFilter { - /** - * Defines the behavior of event matching between steps. Prefer the `strict` option unless explicitly told to use a different one. - * `ordered` - defines a sequential funnel. Step B must happen after Step A, but any number of events can happen between A and B. - * `strict` - defines a funnel where all events must happen in order. Step B must happen directly after Step A without any events in between. - * `any` - order doesn't matter. Steps can be completed in any sequence. - * @default ordered - */ - funnelOrderType?: FunnelsFilterLegacy['funnel_order_type'] - /** - * Defines the type of visualization to use. The `steps` option is recommended. - * `steps` - shows a step-by-step funnel. Perfect to show a conversion rate of a sequence of events (default). - * `time_to_convert` - shows a histogram of the time it took to complete the funnel. Use this if the user asks about the average time it takes to complete the funnel. - * `trends` - shows a trend of the whole sequence's conversion rate over time. Use this if the user wants to see how the conversion rate changes over time. - * @default steps - */ - funnelVizType?: FunnelsFilterLegacy['funnel_viz_type'] - /** - * Users may want to use exclusion events to filter out conversions in which a particular event occurred between specific steps. These events must not be included in the main sequence. - * You must include start and end indexes for each exclusion where the minimum index is one and the maximum index is the number of steps in the funnel. - * For example, there is a sequence with three steps: sign up, finish onboarding, purchase. If the user wants to exclude all conversions in which users left the page before finishing the onboarding, the exclusion step would be the event `$pageleave` with start index 2 and end index 3. - * @default [] - */ - exclusions?: AssistantFunnelsExclusionEventsNode[] - /** - * Controls how the funnel chart is displayed: vertically (preferred) or horizontally. - * @default vertical - */ - layout?: FunnelsFilterLegacy['layout'] - /** - * Use this setting only when `funnelVizType` is `time_to_convert`: number of bins to show in histogram. - * @asType integer - */ - binCount?: FunnelsFilterLegacy['bin_count'] - /** - * Controls a time frame value for a conversion to be considered. Select a reasonable value based on the user's query. Use in combination with `funnelWindowIntervalUnit`. The default value is 14 days. - * @default 14 - */ - funnelWindowInterval?: integer - /** - * Controls a time frame interval for a conversion to be considered. Select a reasonable value based on the user's query. Use in combination with `funnelWindowInterval`. The default value is 14 days. - * @default day - */ - funnelWindowIntervalUnit?: FunnelsFilterLegacy['funnel_window_interval_unit'] - /** - * Whether conversion shown in the graph should be across all steps or just relative to the previous step. - * @default total - */ - funnelStepReference?: FunnelsFilterLegacy['funnel_step_reference'] - /** - * Use this field only if the user explicitly asks to aggregate the funnel by unique sessions. - */ - funnelAggregateByHogQL?: 'properties.$session_id' -} - -export type AssistantFunnelsBreakdownType = Extract - -export interface AssistantFunnelsBreakdownFilter extends AssistantBreakdownFilter { - /** - * Type of the entity to break down by. If `group` is used, you must also provide `breakdown_group_type_index` from the group mapping. - * @default event - */ - breakdown_type: AssistantFunnelsBreakdownType - /** - * The entity property to break down by. - */ - breakdown: string - /** - * If `breakdown_type` is `group`, this is the index of the group. Use the index from the group mapping. - */ - breakdown_group_type_index?: integer | null -} - -export interface AssistantFunnelsQuery extends AssistantInsightsQueryBase { - kind: NodeKind.FunnelsQuery - /** - * Granularity of the response. Can be one of `hour`, `day`, `week` or `month` - */ - interval?: IntervalType - /** - * Events to include - */ - series: AssistantFunnelsEventsNode[] - /** - * Properties specific to the funnels insight - */ - funnelsFilter?: AssistantFunnelsFilter - /** - * Breakdown the chart by a property - */ - breakdownFilter?: AssistantFunnelsBreakdownFilter - /** - * Use this field to define the aggregation by a specific group from the group mapping that the user has provided. - */ - aggregation_group_type_index?: integer -} - /** `FunnelsFilterType` minus everything inherited from `FilterType` and persons modal related params */ export type FunnelsFilterLegacy = Omit< FunnelsFilterType, @@ -2486,75 +2085,6 @@ export type ActorsPropertyTaxonomyQueryResponse = AnalyticsQueryResponseBase -export enum AssistantMessageType { - Human = 'human', - Assistant = 'ai', - Reasoning = 'ai/reasoning', - Visualization = 'ai/viz', - Failure = 'ai/failure', - Router = 'ai/router', -} - -export interface BaseAssistantMessage { - id?: string -} - -export interface HumanMessage extends BaseAssistantMessage { - type: AssistantMessageType.Human - content: string -} - -export interface AssistantMessage extends BaseAssistantMessage { - type: AssistantMessageType.Assistant - content: string -} - -export interface ReasoningMessage extends BaseAssistantMessage { - type: AssistantMessageType.Reasoning - content: string - substeps?: string[] -} - -export interface VisualizationMessage extends BaseAssistantMessage { - type: AssistantMessageType.Visualization - plan?: string - answer?: AssistantTrendsQuery | AssistantFunnelsQuery - initiator?: string -} - -export interface FailureMessage extends BaseAssistantMessage { - type: AssistantMessageType.Failure - content?: string -} - -export interface RouterMessage extends BaseAssistantMessage { - type: AssistantMessageType.Router - content: string -} - -export type RootAssistantMessage = - | VisualizationMessage - | ReasoningMessage - | AssistantMessage - | HumanMessage - | FailureMessage - | RouterMessage - -export enum AssistantEventType { - Status = 'status', - Message = 'message', - Conversation = 'conversation', -} - -export enum AssistantGenerationStatusType { - Acknowledged = 'ack', - GenerationError = 'generation_error', -} - -export interface AssistantGenerationStatusEvent { - type: AssistantGenerationStatusType -} - export enum CustomChannelField { UTMSource = 'utm_source', UTMMedium = 'utm_medium', diff --git a/frontend/src/queries/schema/type-utils.ts b/frontend/src/queries/schema/type-utils.ts new file mode 100644 index 0000000000000..c6fdb7533f6ff --- /dev/null +++ b/frontend/src/queries/schema/type-utils.ts @@ -0,0 +1,7 @@ +// Type alias for number to be reflected as integer in json-schema. +/** @asType integer */ +export type integer = number + +// Type alias for a numerical key. Needs to be reflected as string in json-schema, as JSON only supports string keys. +/** @asType string */ +export type numerical_key = number diff --git a/package.json b/package.json index dd5e60bb55b8a..c636f327cb26f 100644 --- a/package.json +++ b/package.json @@ -319,7 +319,7 @@ "stylelint-order": "^6.0.3", "sucrase": "^3.29.0", "timekeeper": "^2.2.0", - "ts-json-schema-generator": "^1.5.0", + "ts-json-schema-generator": "^v2.4.0-next.6", "ts-node": "^10.9.1", "typescript": "~4.9.5", "webpack": "^5.88.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 70a5e029db767..2ec8c34ed9528 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -771,8 +771,8 @@ devDependencies: specifier: ^2.2.0 version: 2.2.0 ts-json-schema-generator: - specifier: ^1.5.0 - version: 1.5.0 + specifier: ^v2.4.0-next.6 + version: 2.4.0-next.6 ts-node: specifier: ^10.9.1 version: 10.9.1(@swc/core@1.3.93)(@types/node@18.11.9)(typescript@4.9.5) @@ -8294,7 +8294,7 @@ packages: resolution: {integrity: sha512-gsF+c/0XOguWgaOgvFs+xnnRqt9GwgTvIks36WpE6ueeI4KCEHHd8K/CKHqhOqrJKsYH8m27kRzQEvWXAwXUTw==} dependencies: '@types/estree': 1.0.1 - '@types/json-schema': 7.0.12 + '@types/json-schema': 7.0.15 dev: true /@types/estree@0.0.51: @@ -8417,6 +8417,10 @@ packages: resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==} dev: true + /@types/json-schema@7.0.15: + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + dev: true + /@types/json5@0.0.29: resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} dev: true @@ -9432,7 +9436,7 @@ packages: dependencies: '@types/react': 17.0.52 react: 18.2.0 - tslib: 2.4.1 + tslib: 2.6.2 dev: true /aria-query@5.1.3: @@ -10527,9 +10531,9 @@ packages: engines: {node: '>=14'} dev: true - /commander@11.1.0: - resolution: {integrity: sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==} - engines: {node: '>=16'} + /commander@13.0.0: + resolution: {integrity: sha512-oPYleIY8wmTVzkvQq10AEok6YcTC4sRUBl8F9gVuwchGVUCTbl/vhLTaQqutuuySYOsu8YTgV+OxKc/8Yvx+mQ==} + engines: {node: '>=18'} dev: true /commander@2.20.3: @@ -13447,6 +13451,19 @@ packages: path-scurry: 1.10.1 dev: true + /glob@11.0.0: + resolution: {integrity: sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==} + engines: {node: 20 || >=22} + hasBin: true + dependencies: + foreground-child: 3.1.1 + jackspeak: 4.0.2 + minimatch: 10.0.1 + minipass: 7.1.2 + package-json-from-dist: 1.0.1 + path-scurry: 2.0.0 + dev: true + /glob@7.1.6: resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==} dependencies: @@ -13459,6 +13476,7 @@ packages: /glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} + deprecated: Glob versions prior to v9 are no longer supported dependencies: fs.realpath: 1.0.0 inflight: 1.0.6 @@ -13468,17 +13486,6 @@ packages: path-is-absolute: 1.0.1 dev: true - /glob@8.0.3: - resolution: {integrity: sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==} - engines: {node: '>=12'} - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 5.1.1 - once: 1.4.0 - dev: true - /global-dirs@3.0.0: resolution: {integrity: sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==} engines: {node: '>=10'} @@ -14607,6 +14614,13 @@ packages: '@pkgjs/parseargs': 0.11.0 dev: true + /jackspeak@4.0.2: + resolution: {integrity: sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==} + engines: {node: 20 || >=22} + dependencies: + '@isaacs/cliui': 8.0.2 + dev: true + /jake@10.8.7: resolution: {integrity: sha512-ZDi3aP+fG/LchyBzUM804VjddnwfSfsdeYkwt8NcbKRvo4rFkjhs456iLFn3k2ZUWvNe4i48WACDbza8fhq2+w==} engines: {node: '>=10'} @@ -15879,9 +15893,13 @@ packages: highlight.js: 10.7.3 dev: false - /lru-cache@10.0.1: - resolution: {integrity: sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==} - engines: {node: 14 || >=16.14} + /lru-cache@10.4.3: + resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + dev: true + + /lru-cache@11.0.2: + resolution: {integrity: sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==} + engines: {node: 20 || >=22} dev: true /lru-cache@5.1.1: @@ -16169,6 +16187,13 @@ packages: engines: {node: '>=4'} dev: true + /minimatch@10.0.1: + resolution: {integrity: sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==} + engines: {node: 20 || >=22} + dependencies: + brace-expansion: 2.0.1 + dev: true + /minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} dependencies: @@ -16217,6 +16242,11 @@ packages: engines: {node: '>=16 || 14 >=14.17'} dev: true + /minipass@7.1.2: + resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} + engines: {node: '>=16 || 14 >=14.17'} + dev: true + /minizlib@2.1.2: resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} engines: {node: '>= 8'} @@ -16811,6 +16841,10 @@ packages: release-zalgo: 1.0.0 dev: true + /package-json-from-dist@1.0.1: + resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} + dev: true + /pako@0.2.9: resolution: {integrity: sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==} dev: true @@ -16924,8 +16958,16 @@ packages: resolution: {integrity: sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==} engines: {node: '>=16 || 14 >=14.17'} dependencies: - lru-cache: 10.0.1 - minipass: 7.0.3 + lru-cache: 10.4.3 + minipass: 7.1.2 + dev: true + + /path-scurry@2.0.0: + resolution: {integrity: sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==} + engines: {node: 20 || >=22} + dependencies: + lru-cache: 11.0.2 + minipass: 7.1.2 dev: true /path-to-regexp@0.1.7: @@ -19289,6 +19331,11 @@ packages: engines: {node: '>=10'} dev: true + /safe-stable-stringify@2.5.0: + resolution: {integrity: sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==} + engines: {node: '>=10'} + dev: true + /safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} @@ -19551,7 +19598,7 @@ packages: resolution: {integrity: sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==} engines: {node: '>= 12.13.0'} dependencies: - '@types/json-schema': 7.0.12 + '@types/json-schema': 7.0.15 ajv: 8.12.0 ajv-formats: 2.1.1(ajv@8.12.0) ajv-keywords: 5.1.0(ajv@8.12.0) @@ -20784,18 +20831,19 @@ packages: /ts-interface-checker@0.1.13: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} - /ts-json-schema-generator@1.5.0: - resolution: {integrity: sha512-RkiaJ6YxGc5EWVPfyHxszTmpGxX8HC2XBvcFlAl1zcvpOG4tjjh+eXioStXJQYTvr9MoK8zCOWzAUlko3K0DiA==} - engines: {node: '>=10.0.0'} + /ts-json-schema-generator@2.4.0-next.6: + resolution: {integrity: sha512-31jtE+ylG90xnevAt9296Gpo5hu4XQ1hqui4HIxUeH40lLOBaP2FQlGIESWP/L1XiWYhXsg0aDpnNdQ8HYlktA==} + engines: {node: '>=18.0.0'} hasBin: true dependencies: - '@types/json-schema': 7.0.12 - commander: 11.1.0 - glob: 8.0.3 + '@types/json-schema': 7.0.15 + commander: 13.0.0 + glob: 11.0.0 json5: 2.2.3 normalize-path: 3.0.0 - safe-stable-stringify: 2.4.3 - typescript: 5.3.2 + safe-stable-stringify: 2.5.0 + tslib: 2.8.1 + typescript: 5.7.2 dev: true /ts-node@10.9.1(@swc/core@1.3.93)(@types/node@18.11.9)(typescript@4.9.5): @@ -20852,6 +20900,10 @@ packages: /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + /tslib@2.8.1: + resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + dev: true + /tsutils@3.21.0(typescript@4.9.5): resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} @@ -20987,8 +21039,8 @@ packages: engines: {node: '>=4.2.0'} hasBin: true - /typescript@5.3.2: - resolution: {integrity: sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==} + /typescript@5.7.2: + resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} engines: {node: '>=14.17'} hasBin: true dev: true diff --git a/posthog/schema.py b/posthog/schema.py index 77561f637c7b9..43eb5209fee9d 100644 --- a/posthog/schema.py +++ b/posthog/schema.py @@ -12,13 +12,6 @@ class SchemaRoot(RootModel[Any]): root: Any -class ActionConversionGoal(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - actionId: int - - class MathGroupTypeIndex(float, Enum): NUMBER_0 = 0 NUMBER_1 = 1 @@ -27,14 +20,6 @@ class MathGroupTypeIndex(float, Enum): NUMBER_4 = 4 -class ActorsPropertyTaxonomyResponse(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - sample_count: int - sample_values: list[Union[str, float, bool, int]] - - class AggregationAxisFormat(StrEnum): NUMERIC = "numeric" DURATION = "duration" @@ -75,13 +60,6 @@ class AssistantBaseMultipleBreakdownFilter(BaseModel): property: str = Field(..., description="Property name from the plan to break down by.") -class AssistantBreakdownFilter(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - breakdown_limit: Optional[int] = Field(default=25, description="How many distinct values to show.") - - class AssistantDateTimePropertyFilterOperator(StrEnum): IS_DATE_EXACT = "is_date_exact" IS_DATE_BEFORE = "is_date_before" @@ -108,16 +86,6 @@ class AssistantFunnelsBreakdownType(StrEnum): SESSION = "session" -class AssistantFunnelsExclusionEventsNode(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - event: str - funnelFromStep: int - funnelToStep: int - kind: Literal["EventsNode"] = "EventsNode" - - class AssistantGenerationStatusType(StrEnum): ACK = "ack" GENERATION_ERROR = "generation_error" @@ -131,13 +99,6 @@ class AssistantGenericMultipleBreakdownFilter(BaseModel): type: AssistantEventMultipleBreakdownFilterType -class Type(StrEnum): - EVENT = "event" - PERSON = "person" - SESSION = "session" - FEATURE = "feature" - - class AssistantGenericPropertyFilter2(BaseModel): model_config = ConfigDict( extra="forbid", @@ -146,7 +107,7 @@ class AssistantGenericPropertyFilter2(BaseModel): operator: AssistantArrayPropertyFilterOperator = Field( ..., description="`exact` - exact match of any of the values. `is_not` - does not match any of the values." ) - type: Type + type: str value: list[str] = Field( ..., description=( @@ -162,46 +123,7 @@ class AssistantGenericPropertyFilter3(BaseModel): ) key: str = Field(..., description="Use one of the properties the user has provided in the plan.") operator: AssistantDateTimePropertyFilterOperator - type: Type - value: str = Field(..., description="Value must be a date in ISO 8601 format.") - - -class AssistantGroupMultipleBreakdownFilter(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - group_type_index: Optional[int] = Field(default=None, description="Index of the group type from the group mapping.") - property: str = Field(..., description="Property name from the plan to break down by.") - type: Literal["group"] = "group" - - -class AssistantGroupPropertyFilter2(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - group_type_index: int = Field(..., description="Index of the group type from the group mapping.") - key: str = Field(..., description="Use one of the properties the user has provided in the plan.") - operator: AssistantArrayPropertyFilterOperator = Field( - ..., description="`exact` - exact match of any of the values. `is_not` - does not match any of the values." - ) - type: Literal["group"] = "group" - value: list[str] = Field( - ..., - description=( - "Only use property values from the plan. Always use strings as values. If you have a number, convert it to" - ' a string first. If you have a boolean, convert it to a string "true" or "false".' - ), - ) - - -class AssistantGroupPropertyFilter3(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - group_type_index: int = Field(..., description="Index of the group type from the group mapping.") - key: str = Field(..., description="Use one of the properties the user has provided in the plan.") - operator: AssistantDateTimePropertyFilterOperator - type: Literal["group"] = "group" + type: str value: str = Field(..., description="Value must be a date in ISO 8601 format.") @@ -237,16 +159,6 @@ class AssistantSingleValuePropertyFilterOperator(StrEnum): NOT_REGEX = "not_regex" -class AssistantTrendsBreakdownFilter(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - breakdown_limit: Optional[int] = Field(default=25, description="How many distinct values to show.") - breakdowns: list[Union[AssistantGroupMultipleBreakdownFilter, AssistantGenericMultipleBreakdownFilter]] = Field( - ..., description="Use this field to define breakdowns.", max_length=3 - ) - - class AssistantTrendsDisplayType(RootModel[Union[str, Any]]): root: Union[str, Any] @@ -412,22 +324,6 @@ class CompareItem(BaseModel): value: str -class IntervalItem(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - label: str - value: int = Field(..., description="An interval selected out of available intervals in source query") - - -class Series(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - label: str - value: int - - class StatusItem(BaseModel): model_config = ConfigDict( extra="forbid", @@ -436,6 +332,12 @@ class StatusItem(BaseModel): value: str +class ChartDisplayCategory(StrEnum): + TIME_SERIES = "TimeSeries" + CUMULATIVE_TIME_SERIES = "CumulativeTimeSeries" + TOTAL_VALUE = "TotalValue" + + class ChartDisplayType(StrEnum): ACTIONS_LINE_GRAPH = "ActionsLineGraph" ACTIONS_BAR = "ActionsBar" @@ -487,17 +389,6 @@ class ChartSettingsFormatting(BaseModel): suffix: Optional[str] = None -class ClickhouseQueryProgress(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - active_cpu_time: int - bytes_read: int - estimated_rows_total: int - rows_read: int - time_elapsed: int - - class CompareFilter(BaseModel): model_config = ConfigDict( extra="forbid", @@ -619,7 +510,7 @@ class DatabaseSchemaSource(BaseModel): status: str -class Type4(StrEnum): +class Type(StrEnum): POSTHOG = "posthog" DATA_WAREHOUSE = "data_warehouse" VIEW = "view" @@ -663,10 +554,6 @@ class DatetimeDay(RootModel[AwareDatetime]): root: AwareDatetime -class Day(RootModel[int]): - root: int - - class DefaultChannelTypes(StrEnum): CROSS_NETWORK = "Cross Network" PAID_SEARCH = "Paid Search" @@ -776,26 +663,6 @@ class CorrelationType(StrEnum): FAILURE = "failure" -class EventOddsRatioSerialized(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - correlation_type: CorrelationType - event: EventDefinition - failure_count: int - odds_ratio: float - success_count: int - - -class EventTaxonomyItem(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - property: str - sample_count: int - sample_values: list[str] - - class Person(BaseModel): model_config = ConfigDict( extra="forbid", @@ -888,14 +755,6 @@ class FunnelConversionWindowTimeUnit(StrEnum): MONTH = "month" -class FunnelCorrelationResult(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - events: list[EventOddsRatioSerialized] - skewed: bool - - class FunnelCorrelationResultsType(StrEnum): EVENTS = "events" PROPERTIES = "properties" @@ -916,14 +775,6 @@ class FunnelExclusionLegacy(BaseModel): type: Optional[EntityType] = None -class FunnelExclusionSteps(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - funnelFromStep: int - funnelToStep: int - - class FunnelLayout(StrEnum): HORIZONTAL = "horizontal" VERTICAL = "vertical" @@ -984,16 +835,6 @@ class HogLanguage(StrEnum): HOG_TEMPLATE = "hogTemplate" -class HogQLNotice(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - end: Optional[int] = None - fix: Optional[str] = None - message: str - start: Optional[int] = None - - class BounceRatePageViewMode(StrEnum): COUNT_PAGEVIEWS = "count_pageviews" UNIQ_URLS = "uniq_urls" @@ -1077,14 +918,6 @@ class Compare(StrEnum): PREVIOUS = "previous" -class DayItem(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - label: str - value: Union[str, AwareDatetime, int] - - class InsightFilterProperty(StrEnum): TRENDS_FILTER = "trendsFilter" FUNNELS_FILTER = "funnelsFilter" @@ -1204,27 +1037,6 @@ class PathType(StrEnum): HOGQL = "hogql" -class PathsFilter(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - edgeLimit: Optional[int] = 50 - endPoint: Optional[str] = None - excludeEvents: Optional[list[str]] = None - includeEventTypes: Optional[list[PathType]] = None - localPathCleaningFilters: Optional[list[PathCleaningFilter]] = None - maxEdgeWeight: Optional[int] = None - minEdgeWeight: Optional[int] = None - pathDropoffKey: Optional[str] = Field(default=None, description="Relevant only within actors query") - pathEndKey: Optional[str] = Field(default=None, description="Relevant only within actors query") - pathGroupings: Optional[list[str]] = None - pathReplacements: Optional[bool] = None - pathStartKey: Optional[str] = Field(default=None, description="Relevant only within actors query") - pathsHogQLExpression: Optional[str] = None - startPoint: Optional[str] = None - stepLimit: Optional[int] = 5 - - class PathsFilterLegacy(BaseModel): model_config = ConfigDict( extra="forbid", @@ -1320,19 +1132,6 @@ class QueryResponseAlternative5(BaseModel): stdout: Optional[str] = None -class QueryResponseAlternative7(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - errors: list[HogQLNotice] - isValid: Optional[bool] = None - isValidView: Optional[bool] = None - notices: list[HogQLNotice] - query: Optional[str] = None - table_names: Optional[list[str]] = None - warnings: list[HogQLNotice] - - class QueryResponseAlternative36(BaseModel): model_config = ConfigDict( extra="forbid", @@ -1340,50 +1139,6 @@ class QueryResponseAlternative36(BaseModel): questions: list[str] -class QueryStatus(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - complete: Optional[bool] = Field( - default=False, - description=( - "Whether the query is still running. Will be true if the query is complete, even if it errored. Either" - " result or error will be set." - ), - ) - dashboard_id: Optional[int] = None - end_time: Optional[AwareDatetime] = Field( - default=None, description="When did the query execution task finish (whether successfully or not)." - ) - error: Optional[bool] = Field( - default=False, - description=( - "If the query failed, this will be set to true. More information can be found in the error_message field." - ), - ) - error_message: Optional[str] = None - expiration_time: Optional[AwareDatetime] = None - id: str - insight_id: Optional[int] = None - labels: Optional[list[str]] = None - pickup_time: Optional[AwareDatetime] = Field( - default=None, description="When was the query execution task picked up by a worker." - ) - query_async: Literal[True] = Field(default=True, description="ONLY async queries use QueryStatus.") - query_progress: Optional[ClickhouseQueryProgress] = None - results: Optional[Any] = None - start_time: Optional[AwareDatetime] = Field(default=None, description="When was query execution task enqueued.") - task_id: Optional[str] = None - team_id: int - - -class QueryStatusResponse(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - query_status: QueryStatus - - class QueryTiming(BaseModel): model_config = ConfigDict( extra="forbid", @@ -1476,13 +1231,6 @@ class RetentionType(StrEnum): RETENTION_FIRST_TIME = "retention_first_time" -class RetentionValue(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - count: int - - class RouterMessage(BaseModel): model_config = ConfigDict( extra="forbid", @@ -1596,14 +1344,6 @@ class TaxonomicFilterGroupType(StrEnum): REPLAY = "replay" -class TeamTaxonomyItem(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - count: int - event: str - - class TimelineEntry(BaseModel): model_config = ConfigDict( extra="forbid", @@ -1613,43 +1353,6 @@ class TimelineEntry(BaseModel): sessionId: Optional[str] = Field(default=None, description="Session ID. None means out-of-session events") -class TrendsAlertConfig(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - check_ongoing_interval: Optional[bool] = None - series_index: int - type: Literal["TrendsAlertConfig"] = "TrendsAlertConfig" - - -class TrendsFilter(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - aggregationAxisFormat: Optional[AggregationAxisFormat] = AggregationAxisFormat.NUMERIC - aggregationAxisPostfix: Optional[str] = None - aggregationAxisPrefix: Optional[str] = None - breakdown_histogram_bin_count: Optional[float] = None - decimalPlaces: Optional[float] = None - display: Optional[ChartDisplayType] = ChartDisplayType.ACTIONS_LINE_GRAPH - formula: Optional[str] = None - hiddenLegendIndexes: Optional[list[int]] = None - resultCustomizationBy: Optional[ResultCustomizationBy] = Field( - default=ResultCustomizationBy.VALUE, - description="Wether result datasets are associated by their values or by their order.", - ) - resultCustomizations: Optional[ - Union[dict[str, ResultCustomizationByValue], dict[str, ResultCustomizationByPosition]] - ] = Field(default=None, description="Customizations for the appearance of result datasets.") - showAlertThresholdLines: Optional[bool] = False - showLabelsOnSeries: Optional[bool] = None - showLegend: Optional[bool] = False - showPercentStackView: Optional[bool] = False - showValuesOnSeries: Optional[bool] = False - smoothingIntervals: Optional[int] = 1 - yAxisScaleType: Optional[YAxisScaleType] = YAxisScaleType.LINEAR - - class TrendsFilterLegacy(BaseModel): model_config = ConfigDict( extra="forbid", @@ -1749,8 +1452,23 @@ class YAxisSettings(BaseModel): startAtZero: Optional[bool] = Field(default=None, description="Whether the Y axis should start at zero") -class NumericalKey(RootModel[str]): - root: str +class Integer(RootModel[int]): + root: int + + +class ActionConversionGoal(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + actionId: int + + +class ActorsPropertyTaxonomyResponse(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + sample_count: int + sample_values: list[Union[str, float, bool, int]] class AlertCondition(BaseModel): @@ -1776,6 +1494,13 @@ class AssistantArrayPropertyFilter(BaseModel): ) +class AssistantBreakdownFilter(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + breakdown_limit: Optional[int] = Field(default=25, description="How many distinct values to show.") + + class AssistantDateTimePropertyFilter(BaseModel): model_config = ConfigDict( extra="forbid", @@ -1805,6 +1530,16 @@ class AssistantFunnelsBreakdownFilter(BaseModel): ) +class AssistantFunnelsExclusionEventsNode(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + event: str + funnelFromStep: int + funnelToStep: int + kind: Literal["EventsNode"] = "EventsNode" + + class AssistantFunnelsFilter(BaseModel): model_config = ConfigDict( extra="forbid", @@ -1896,7 +1631,7 @@ class AssistantGenericPropertyFilter1(BaseModel): " matches the regex pattern. `not_regex` - does not match the regex pattern." ), ) - type: Type + type: str value: str = Field( ..., description=( @@ -1919,7 +1654,16 @@ class AssistantGenericPropertyFilter4(BaseModel): " collected." ), ) - type: Type + type: str + + +class AssistantGroupMultipleBreakdownFilter(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + group_type_index: Optional[int] = Field(default=None, description="Index of the group type from the group mapping.") + property: str = Field(..., description="Property name from the plan to break down by.") + type: Literal["group"] = "group" class AssistantGroupPropertyFilter1(BaseModel): @@ -1946,6 +1690,36 @@ class AssistantGroupPropertyFilter1(BaseModel): ) +class AssistantGroupPropertyFilter2(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + group_type_index: int = Field(..., description="Index of the group type from the group mapping.") + key: str = Field(..., description="Use one of the properties the user has provided in the plan.") + operator: AssistantArrayPropertyFilterOperator = Field( + ..., description="`exact` - exact match of any of the values. `is_not` - does not match any of the values." + ) + type: Literal["group"] = "group" + value: list[str] = Field( + ..., + description=( + "Only use property values from the plan. Always use strings as values. If you have a number, convert it to" + ' a string first. If you have a boolean, convert it to a string "true" or "false".' + ), + ) + + +class AssistantGroupPropertyFilter3(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + group_type_index: int = Field(..., description="Index of the group type from the group mapping.") + key: str = Field(..., description="Use one of the properties the user has provided in the plan.") + operator: AssistantDateTimePropertyFilterOperator + type: Literal["group"] = "group" + value: str = Field(..., description="Value must be a date in ISO 8601 format.") + + class AssistantGroupPropertyFilter4(BaseModel): model_config = ConfigDict( extra="forbid", @@ -1996,6 +1770,16 @@ class AssistantSingleValuePropertyFilter(BaseModel): ) +class AssistantTrendsBreakdownFilter(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + breakdown_limit: Optional[int] = Field(default=25, description="How many distinct values to show.") + breakdowns: list[Union[AssistantGroupMultipleBreakdownFilter, AssistantGenericMultipleBreakdownFilter]] = Field( + ..., description="Use this field to define breakdowns.", max_length=3 + ) + + class AutocompleteCompletionItem(BaseModel): model_config = ConfigDict( extra="forbid", @@ -2039,7 +1823,7 @@ class BreakdownFilter(BaseModel): model_config = ConfigDict( extra="forbid", ) - breakdown: Optional[Union[str, int, list[Union[str, int]]]] = None + breakdown: Optional[Union[str, list[Union[str, int]], int]] = None breakdown_group_type_index: Optional[int] = None breakdown_hide_other_aggregation: Optional[bool] = None breakdown_histogram_bin_count: Optional[int] = None @@ -2049,39 +1833,20 @@ class BreakdownFilter(BaseModel): breakdowns: Optional[list[Breakdown]] = Field(default=None, max_length=3) -class BreakdownItem(BaseModel): +class IntervalItem(BaseModel): model_config = ConfigDict( extra="forbid", ) label: str - value: Union[str, int] - - -class CacheMissResponse(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - cache_key: Optional[str] = None - query_status: Optional[QueryStatus] = None + value: int = Field(..., description="An interval selected out of available intervals in source query") -class CachedSuggestedQuestionsQueryResponse(BaseModel): +class Series(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" - ) - is_cached: bool - last_refresh: AwareDatetime - next_allowed_client_refresh: AwareDatetime - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." - ) - questions: list[str] - timezone: str + label: str + value: int class Settings(BaseModel): @@ -2116,6 +1881,17 @@ class ChartSettings(BaseModel): ) +class ClickhouseQueryProgress(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + active_cpu_time: int + bytes_read: int + estimated_rows_total: int + rows_read: int + time_elapsed: int + + class CohortPropertyFilter(BaseModel): model_config = ConfigDict( extra="forbid", @@ -2200,7 +1976,11 @@ class DatabaseSchemaTableCommon(BaseModel): fields: dict[str, DatabaseSchemaField] id: str name: str - type: Type4 + type: Type + + +class Day(RootModel[int]): + root: int class ElementPropertyFilter(BaseModel): @@ -2214,6 +1994,17 @@ class ElementPropertyFilter(BaseModel): value: Optional[Union[str, float, list[Union[str, float]]]] = None +class EventOddsRatioSerialized(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + correlation_type: CorrelationType + event: EventDefinition + failure_count: int + odds_ratio: float + success_count: int + + class EventPropertyFilter(BaseModel): model_config = ConfigDict( extra="forbid", @@ -2225,6 +2016,15 @@ class EventPropertyFilter(BaseModel): value: Optional[Union[str, float, list[Union[str, float]]]] = None +class EventTaxonomyItem(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + property: str + sample_count: int + sample_values: list[str] + + class FeaturePropertyFilter(BaseModel): model_config = ConfigDict( extra="forbid", @@ -2236,6 +2036,22 @@ class FeaturePropertyFilter(BaseModel): value: Optional[Union[str, float, list[Union[str, float]]]] = None +class FunnelCorrelationResult(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + events: list[EventOddsRatioSerialized] + skewed: bool + + +class FunnelExclusionSteps(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + funnelFromStep: int + funnelToStep: int + + class FunnelsFilterLegacy(BaseModel): model_config = ConfigDict( extra="forbid", @@ -2256,21 +2072,6 @@ class FunnelsFilterLegacy(BaseModel): layout: Optional[FunnelLayout] = None -class GenericCachedQueryResponse(BaseModel): - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" - ) - is_cached: bool - last_refresh: AwareDatetime - next_allowed_client_refresh: AwareDatetime - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." - ) - timezone: str - - class GroupPropertyFilter(BaseModel): model_config = ConfigDict( extra="forbid", @@ -2294,17 +2095,14 @@ class HogQLAutocompleteResponse(BaseModel): ) -class HogQLMetadataResponse(BaseModel): +class HogQLNotice(BaseModel): model_config = ConfigDict( extra="forbid", ) - errors: list[HogQLNotice] - isValid: Optional[bool] = None - isValidView: Optional[bool] = None - notices: list[HogQLNotice] - query: Optional[str] = None - table_names: Optional[list[str]] = None - warnings: list[HogQLNotice] + end: Optional[int] = None + fix: Optional[str] = None + message: str + start: Optional[int] = None class HogQLPropertyFilter(BaseModel): @@ -2338,46 +2136,24 @@ class HogQLQueryModifiers(BaseModel): useMaterializedViews: Optional[bool] = None -class HogQLQueryResponse(BaseModel): +class HogQuery(BaseModel): model_config = ConfigDict( extra="forbid", ) - clickhouse: Optional[str] = Field(default=None, description="Executed ClickHouse query") - columns: Optional[list] = Field(default=None, description="Returned columns") - error: Optional[str] = Field( - default=None, - description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", + code: Optional[str] = None + kind: Literal["HogQuery"] = "HogQuery" + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" ) - explain: Optional[list[str]] = Field(default=None, description="Query explanation output") - hasMore: Optional[bool] = None - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - limit: Optional[int] = None - metadata: Optional[HogQLMetadataResponse] = Field(default=None, description="Query metadata output") - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" - ) - offset: Optional[int] = None - query: Optional[str] = Field(default=None, description="Input query string") - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." - ) - results: list - timings: Optional[list[QueryTiming]] = Field( - default=None, description="Measured timings for different parts of the query generation process" - ) - types: Optional[list] = Field(default=None, description="Types of returned columns") + response: Optional[HogQueryResponse] = None -class HogQuery(BaseModel): +class DayItem(BaseModel): model_config = ConfigDict( extra="forbid", ) - code: Optional[str] = None - kind: Literal["HogQuery"] = "HogQuery" - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" - ) - response: Optional[HogQueryResponse] = None + label: str + value: Union[str, AwareDatetime, int] class InsightThreshold(BaseModel): @@ -2406,27 +2182,6 @@ class LifecycleFilterLegacy(BaseModel): toggledLifecycles: Optional[list[LifecycleToggle]] = None -class LifecycleQueryResponse(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - error: Optional[str] = Field( - default=None, - description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", - ) - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" - ) - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." - ) - results: list[dict[str, Any]] - timings: Optional[list[QueryTiming]] = Field( - default=None, description="Measured timings for different parts of the query generation process" - ) - - class LogEntryPropertyFilter(BaseModel): model_config = ConfigDict( extra="forbid", @@ -2446,32 +2201,25 @@ class MatchedRecording(BaseModel): session_id: Optional[str] = None -class MultipleBreakdownOptions(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - values: list[BreakdownItem] - - -class PathsQueryResponse(BaseModel): +class PathsFilter(BaseModel): model_config = ConfigDict( extra="forbid", ) - error: Optional[str] = Field( - default=None, - description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", - ) - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" - ) - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." - ) - results: list[dict[str, Any]] - timings: Optional[list[QueryTiming]] = Field( - default=None, description="Measured timings for different parts of the query generation process" - ) + edgeLimit: Optional[int] = 50 + endPoint: Optional[str] = None + excludeEvents: Optional[list[str]] = None + includeEventTypes: Optional[list[PathType]] = None + localPathCleaningFilters: Optional[list[PathCleaningFilter]] = None + maxEdgeWeight: Optional[int] = None + minEdgeWeight: Optional[int] = None + pathDropoffKey: Optional[str] = Field(default=None, description="Relevant only within actors query") + pathEndKey: Optional[str] = Field(default=None, description="Relevant only within actors query") + pathGroupings: Optional[list[str]] = None + pathReplacements: Optional[bool] = None + pathStartKey: Optional[str] = Field(default=None, description="Relevant only within actors query") + pathsHogQLExpression: Optional[str] = None + startPoint: Optional[str] = None + stepLimit: Optional[int] = 5 class PersonPropertyFilter(BaseModel): @@ -2485,163 +2233,190 @@ class PersonPropertyFilter(BaseModel): value: Optional[Union[str, float, list[Union[str, float]]]] = None -class QueryResponseAlternative1(BaseModel): +class QueryResponseAlternative7(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: list - error: Optional[str] = Field( - default=None, - description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", - ) - hasMore: Optional[bool] = None - hogql: str = Field(..., description="Generated HogQL query.") - limit: Optional[int] = None - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" - ) - offset: Optional[int] = None - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." + errors: list[HogQLNotice] + isValid: Optional[bool] = None + isValidView: Optional[bool] = None + notices: list[HogQLNotice] + query: Optional[str] = None + table_names: Optional[list[str]] = None + warnings: list[HogQLNotice] + + +class QueryResponseAlternative8(BaseModel): + model_config = ConfigDict( + extra="forbid", ) - results: list[list] + incomplete_list: bool = Field(..., description="Whether or not the suggestions returned are complete") + suggestions: list[AutocompleteCompletionItem] timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) - types: list[str] -class QueryResponseAlternative2(BaseModel): +class QueryStatus(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: list - error: Optional[str] = Field( - default=None, - description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", + complete: Optional[bool] = Field( + default=False, + description=( + "Whether the query is still running. Will be true if the query is complete, even if it errored. Either" + " result or error will be set." + ), ) - hasMore: Optional[bool] = None - hogql: str = Field(..., description="Generated HogQL query.") - limit: int - missing_actors_count: Optional[int] = None - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" + dashboard_id: Optional[int] = None + end_time: Optional[AwareDatetime] = Field( + default=None, description="When did the query execution task finish (whether successfully or not)." ) - offset: int - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." + error: Optional[bool] = Field( + default=False, + description=( + "If the query failed, this will be set to true. More information can be found in the error_message field." + ), ) - results: list[list] - timings: Optional[list[QueryTiming]] = Field( - default=None, description="Measured timings for different parts of the query generation process" + error_message: Optional[str] = None + expiration_time: Optional[AwareDatetime] = None + id: str + insight_id: Optional[int] = None + labels: Optional[list[str]] = None + pickup_time: Optional[AwareDatetime] = Field( + default=None, description="When was the query execution task picked up by a worker." ) - types: list[str] + query_async: Literal[True] = Field(default=True, description="ONLY async queries use QueryStatus.") + query_progress: Optional[ClickhouseQueryProgress] = None + results: Optional[Any] = None + start_time: Optional[AwareDatetime] = Field(default=None, description="When was query execution task enqueued.") + task_id: Optional[str] = None + team_id: int -class QueryResponseAlternative3(BaseModel): +class QueryStatusResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - breakdown: Optional[list[BreakdownItem]] = None - breakdowns: Optional[list[MultipleBreakdownOptions]] = None - compare: Optional[list[CompareItem]] = None - day: Optional[list[DayItem]] = None - interval: Optional[list[IntervalItem]] = None - series: Optional[list[Series]] = None - status: Optional[list[StatusItem]] = None + query_status: QueryStatus -class QueryResponseAlternative4(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - error: Optional[str] = Field( - default=None, - description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", - ) - hasMore: Optional[bool] = None - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" - ) - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." - ) - results: list[TimelineEntry] - timings: Optional[list[QueryTiming]] = Field( - default=None, description="Measured timings for different parts of the query generation process" - ) +class ResultCustomization(RootModel[Union[ResultCustomizationByValue, ResultCustomizationByPosition]]): + root: Union[ResultCustomizationByValue, ResultCustomizationByPosition] -class QueryResponseAlternative6(BaseModel): +class RetentionEntity(BaseModel): model_config = ConfigDict( extra="forbid", ) - clickhouse: Optional[str] = Field(default=None, description="Executed ClickHouse query") - columns: Optional[list] = Field(default=None, description="Returned columns") - error: Optional[str] = Field( - default=None, - description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", - ) - explain: Optional[list[str]] = Field(default=None, description="Query explanation output") - hasMore: Optional[bool] = None - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - limit: Optional[int] = None - metadata: Optional[HogQLMetadataResponse] = Field(default=None, description="Query metadata output") - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" - ) - offset: Optional[int] = None - query: Optional[str] = Field(default=None, description="Input query string") - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." - ) - results: list - timings: Optional[list[QueryTiming]] = Field( - default=None, description="Measured timings for different parts of the query generation process" - ) - types: Optional[list] = Field(default=None, description="Types of returned columns") + custom_name: Optional[str] = None + id: Optional[Union[str, float]] = None + kind: Optional[RetentionEntityKind] = None + name: Optional[str] = None + order: Optional[int] = None + type: Optional[EntityType] = None + uuid: Optional[str] = None -class QueryResponseAlternative8(BaseModel): +class RetentionFilter(BaseModel): model_config = ConfigDict( extra="forbid", ) - incomplete_list: bool = Field(..., description="Whether or not the suggestions returned are complete") - suggestions: list[AutocompleteCompletionItem] - timings: Optional[list[QueryTiming]] = Field( - default=None, description="Measured timings for different parts of the query generation process" - ) + cumulative: Optional[bool] = None + period: Optional[RetentionPeriod] = RetentionPeriod.DAY + retentionReference: Optional[RetentionReference] = None + retentionType: Optional[RetentionType] = None + returningEntity: Optional[RetentionEntity] = None + showMean: Optional[bool] = None + targetEntity: Optional[RetentionEntity] = None + totalIntervals: Optional[int] = 11 -class QueryResponseAlternative10(BaseModel): +class RetentionFilterLegacy(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: Optional[list] = None - error: Optional[str] = Field( - default=None, - description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", - ) - hasMore: Optional[bool] = None - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - limit: Optional[int] = None - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" + cumulative: Optional[bool] = None + period: Optional[RetentionPeriod] = None + retention_reference: Optional[RetentionReference] = None + retention_type: Optional[RetentionType] = None + returning_entity: Optional[RetentionEntity] = None + show_mean: Optional[bool] = None + target_entity: Optional[RetentionEntity] = None + total_intervals: Optional[int] = None + + +class RetentionValue(BaseModel): + model_config = ConfigDict( + extra="forbid", ) - offset: Optional[int] = None - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." + count: int + + +class SavedInsightNode(BaseModel): + model_config = ConfigDict( + extra="forbid", ) - results: list - samplingRate: Optional[SamplingRate] = None - timings: Optional[list[QueryTiming]] = Field( - default=None, description="Measured timings for different parts of the query generation process" + allowSorting: Optional[bool] = Field( + default=None, description="Can the user click on column headers to sort the table? (default: true)" ) - types: Optional[list] = None + embedded: Optional[bool] = Field(default=None, description="Query is embedded inside another bordered component") + expandable: Optional[bool] = Field( + default=None, description="Can expand row to show raw event data (default: true)" + ) + full: Optional[bool] = Field( + default=None, description="Show with most visual options enabled. Used in insight scene." + ) + hidePersonsModal: Optional[bool] = None + kind: Literal["SavedInsightNode"] = "SavedInsightNode" + propertiesViaUrl: Optional[bool] = Field(default=None, description="Link properties via the URL (default: false)") + shortId: str + showActions: Optional[bool] = Field(default=None, description="Show the kebab menu at the end of the row") + showColumnConfigurator: Optional[bool] = Field( + default=None, description="Show a button to configure the table's columns if possible" + ) + showCorrelationTable: Optional[bool] = None + showDateRange: Optional[bool] = Field(default=None, description="Show date range selector") + showElapsedTime: Optional[bool] = Field(default=None, description="Show the time it takes to run a query") + showEventFilter: Optional[bool] = Field( + default=None, description="Include an event filter above the table (EventsNode only)" + ) + showExport: Optional[bool] = Field(default=None, description="Show the export button") + showFilters: Optional[bool] = None + showHeader: Optional[bool] = None + showHogQLEditor: Optional[bool] = Field(default=None, description="Include a HogQL query editor above HogQL tables") + showLastComputation: Optional[bool] = None + showLastComputationRefresh: Optional[bool] = None + showOpenEditorButton: Optional[bool] = Field( + default=None, description="Show a button to open the current query as a new insight. (default: true)" + ) + showPersistentColumnConfigurator: Optional[bool] = Field( + default=None, description="Show a button to configure and persist the table's default columns if possible" + ) + showPropertyFilter: Optional[Union[bool, list[TaxonomicFilterGroupType]]] = Field( + default=None, description="Include a property filter above the table" + ) + showReload: Optional[bool] = Field(default=None, description="Show a reload button") + showResults: Optional[bool] = None + showResultsTable: Optional[bool] = Field(default=None, description="Show a results table") + showSavedQueries: Optional[bool] = Field(default=None, description="Shows a list of saved queries") + showSearch: Optional[bool] = Field(default=None, description="Include a free text search field (PersonsNode only)") + showTable: Optional[bool] = None + showTestAccountFilters: Optional[bool] = Field(default=None, description="Show filter to exclude test accounts") + showTimings: Optional[bool] = Field(default=None, description="Show a detailed query timing breakdown") + suppressSessionAnalysisWarning: Optional[bool] = None + vizSpecificOptions: Optional[VizSpecificOptions] = None -class QueryResponseAlternative13(BaseModel): +class Filters(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + dateRange: Optional[DateRange] = None + properties: Optional[list[SessionPropertyFilter]] = None + + +class SessionAttributionExplorerQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) @@ -2667,197 +2442,227 @@ class QueryResponseAlternative13(BaseModel): types: Optional[list] = None -class QueryResponseAlternative14(BaseModel): +class SessionRecordingType(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: Optional[list[str]] = None - error: Optional[str] = Field( - default=None, - description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", - ) - hasMore: Optional[bool] = None - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - limit: Optional[int] = None - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" + active_seconds: Optional[float] = None + activity_score: Optional[float] = Field( + default=None, description="calculated on the backend so that we can sort by it, definition may change over time" ) - offset: Optional[int] = None - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." + click_count: Optional[float] = None + console_error_count: Optional[float] = None + console_log_count: Optional[float] = None + console_warn_count: Optional[float] = None + distinct_id: Optional[str] = None + email: Optional[str] = None + end_time: str = Field(..., description="When the recording ends in ISO format.") + id: str + inactive_seconds: Optional[float] = None + keypress_count: Optional[float] = None + matching_events: Optional[list[MatchedRecording]] = Field(default=None, description="List of matching events. *") + mouse_activity_count: Optional[float] = Field( + default=None, description="count of all mouse activity in the recording, not just clicks" ) - results: list[ErrorTrackingIssue] - timings: Optional[list[QueryTiming]] = Field( - default=None, description="Measured timings for different parts of the query generation process" + ongoing: Optional[bool] = Field( + default=None, + description=( + "whether we have received data for this recording in the last 5 minutes (assumes the recording was loaded" + " from ClickHouse)\n*" + ), ) + person: Optional[PersonType] = None + recording_duration: float = Field(..., description="Length of recording in seconds.") + snapshot_source: SnapshotSource + start_time: str = Field(..., description="When the recording starts in ISO format.") + start_url: Optional[str] = None + storage: Optional[Storage] = Field(default=None, description="Where this recording information was loaded from") + summary: Optional[str] = None + viewed: bool = Field(..., description="Whether this recording has been viewed already.") -class QueryResponseAlternative17(BaseModel): +class SessionsTimelineQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: list error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) hasMore: Optional[bool] = None - hogql: str = Field(..., description="Generated HogQL query.") - limit: Optional[int] = None + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[list] + results: list[TimelineEntry] timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) - types: list[str] -class QueryResponseAlternative18(BaseModel): +class StickinessCriteria(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: list - error: Optional[str] = Field( - default=None, - description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", - ) - hasMore: Optional[bool] = None - hogql: str = Field(..., description="Generated HogQL query.") - limit: int - missing_actors_count: Optional[int] = None - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" - ) - offset: int - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." - ) - results: list[list] - timings: Optional[list[QueryTiming]] = Field( - default=None, description="Measured timings for different parts of the query generation process" + operator: StickinessOperator + value: int + + +class StickinessFilter(BaseModel): + model_config = ConfigDict( + extra="forbid", ) - types: list[str] + display: Optional[ChartDisplayType] = None + hiddenLegendIndexes: Optional[list[int]] = None + showLegend: Optional[bool] = None + showValuesOnSeries: Optional[bool] = None + stickinessCriteria: Optional[StickinessCriteria] = None -class QueryResponseAlternative19(BaseModel): +class StickinessQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - clickhouse: Optional[str] = Field(default=None, description="Executed ClickHouse query") - columns: Optional[list] = Field(default=None, description="Returned columns") error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - explain: Optional[list[str]] = Field(default=None, description="Query explanation output") - hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - limit: Optional[int] = None - metadata: Optional[HogQLMetadataResponse] = Field(default=None, description="Query metadata output") modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - offset: Optional[int] = None - query: Optional[str] = Field(default=None, description="Input query string") query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list + results: list[dict[str, Any]] timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) - types: Optional[list] = Field(default=None, description="Types of returned columns") -class QueryResponseAlternative21(BaseModel): +class SuggestedQuestionsQuery(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: Optional[list] = None - error: Optional[str] = Field( - default=None, - description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", - ) - hasMore: Optional[bool] = None - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - limit: Optional[int] = None + kind: Literal["SuggestedQuestionsQuery"] = "SuggestedQuestionsQuery" modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - offset: Optional[int] = None - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." + response: Optional[SuggestedQuestionsQueryResponse] = None + + +class TableSettings(BaseModel): + model_config = ConfigDict( + extra="forbid", ) - results: list - samplingRate: Optional[SamplingRate] = None - timings: Optional[list[QueryTiming]] = Field( - default=None, description="Measured timings for different parts of the query generation process" + columns: Optional[list[ChartAxis]] = None + conditionalFormatting: Optional[list[ConditionalFormattingRule]] = None + + +class TeamTaxonomyItem(BaseModel): + model_config = ConfigDict( + extra="forbid", ) - types: Optional[list] = None + count: int + event: str -class QueryResponseAlternative24(BaseModel): +class TestBasicQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: Optional[list] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: Any + results: list timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) - types: Optional[list] = None -class QueryResponseAlternative25(BaseModel): +class TestCachedBasicQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: Optional[list[str]] = None + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + ) error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - limit: Optional[int] = None + is_cached: bool + last_refresh: AwareDatetime modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - offset: Optional[int] = None + next_allowed_client_refresh: AwareDatetime query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[ErrorTrackingIssue] + results: list + timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) -class QueryResponseAlternative28(BaseModel): +class TrendsAlertConfig(BaseModel): model_config = ConfigDict( extra="forbid", ) - error: Optional[str] = Field( + check_ongoing_interval: Optional[bool] = None + series_index: int + type: Literal["TrendsAlertConfig"] = "TrendsAlertConfig" + + +class TrendsFilter(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + aggregationAxisFormat: Optional[AggregationAxisFormat] = AggregationAxisFormat.NUMERIC + aggregationAxisPostfix: Optional[str] = None + aggregationAxisPrefix: Optional[str] = None + breakdown_histogram_bin_count: Optional[float] = None + decimalPlaces: Optional[float] = None + display: Optional[ChartDisplayType] = ChartDisplayType.ACTIONS_LINE_GRAPH + formula: Optional[str] = None + hiddenLegendIndexes: Optional[list[int]] = None + resultCustomizationBy: Optional[ResultCustomizationBy] = Field( + default=ResultCustomizationBy.VALUE, + description="Wether result datasets are associated by their values or by their order.", + ) + resultCustomizations: Optional[ + Union[dict[str, ResultCustomizationByValue], dict[str, ResultCustomizationByPosition]] + ] = Field(default=None, description="Customizations for the appearance of result datasets.") + showAlertThresholdLines: Optional[bool] = False + showLabelsOnSeries: Optional[bool] = None + showLegend: Optional[bool] = False + showPercentStackView: Optional[bool] = False + showValuesOnSeries: Optional[bool] = False + smoothingIntervals: Optional[int] = 1 + yAxisScaleType: Optional[YAxisScaleType] = YAxisScaleType.LINEAR + + +class TrendsQueryResponse(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) @@ -2875,97 +2680,124 @@ class QueryResponseAlternative28(BaseModel): ) -class QueryResponseAlternative29(BaseModel): +class WebExternalClicksTableQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) + columns: Optional[list] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) + hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - isUdf: Optional[bool] = None + limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) + offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: Union[FunnelTimeToConvertResults, list[dict[str, Any]], list[list[dict[str, Any]]]] + results: list + samplingRate: Optional[SamplingRate] = None timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) + types: Optional[list] = None -class QueryResponseAlternative31(BaseModel): +class WebGoalsQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) + columns: Optional[list] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) + hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) + offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[dict[str, Any]] + results: list + samplingRate: Optional[SamplingRate] = None timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) + types: Optional[list] = None -class QueryResponseAlternative34(BaseModel): +class WebOverviewItem(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: Optional[list] = None + changeFromPreviousPct: Optional[float] = None + isIncreaseBad: Optional[bool] = None + key: str + kind: WebOverviewItemKind + previous: Optional[float] = None + value: Optional[float] = None + + +class WebOverviewQueryResponse(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + dateFrom: Optional[str] = None + dateTo: Optional[str] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: FunnelCorrelationResult + results: list[WebOverviewItem] + samplingRate: Optional[SamplingRate] = None timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) - types: Optional[list] = None -class QueryResponseAlternative37(BaseModel): +class WebStatsTableQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) + columns: Optional[list] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) + hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) + offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[TeamTaxonomyItem] + results: list + samplingRate: Optional[SamplingRate] = None timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) + types: Optional[list] = None -class QueryResponseAlternative38(BaseModel): +class ActorsPropertyTaxonomyQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) @@ -2980,339 +2812,408 @@ class QueryResponseAlternative38(BaseModel): query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[EventTaxonomyItem] + results: ActorsPropertyTaxonomyResponse timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) -class QueryResponseAlternative39(BaseModel): +class ActorsQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) + columns: list error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + hasMore: Optional[bool] = None + hogql: str = Field(..., description="Generated HogQL query.") + limit: int + missing_actors_count: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) + offset: int query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: ActorsPropertyTaxonomyResponse + results: list[list] timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) + types: list[str] -class ResultCustomization(RootModel[Union[ResultCustomizationByValue, ResultCustomizationByPosition]]): - root: Union[ResultCustomizationByValue, ResultCustomizationByPosition] +class AssistantBasePropertyFilter( + RootModel[ + Union[ + AssistantDateTimePropertyFilter, + AssistantSetPropertyFilter, + Union[AssistantSingleValuePropertyFilter, AssistantArrayPropertyFilter], + ] + ] +): + root: Union[ + AssistantDateTimePropertyFilter, + AssistantSetPropertyFilter, + Union[AssistantSingleValuePropertyFilter, AssistantArrayPropertyFilter], + ] -class RetentionEntity(BaseModel): +class AssistantFunnelsEventsNode(BaseModel): model_config = ConfigDict( extra="forbid", ) - custom_name: Optional[str] = None - id: Optional[Union[str, float]] = None - kind: Optional[RetentionEntityKind] = None - name: Optional[str] = None - order: Optional[int] = None - type: Optional[EntityType] = None - uuid: Optional[str] = None - - -class RetentionFilter(BaseModel): - model_config = ConfigDict( - extra="forbid", + custom_name: Optional[str] = Field( + default=None, description="Optional custom name for the event if it is needed to be renamed." ) - cumulative: Optional[bool] = None - period: Optional[RetentionPeriod] = RetentionPeriod.DAY - retentionReference: Optional[RetentionReference] = None - retentionType: Optional[RetentionType] = None - returningEntity: Optional[RetentionEntity] = None - showMean: Optional[bool] = None - targetEntity: Optional[RetentionEntity] = None - totalIntervals: Optional[int] = 11 - - -class RetentionFilterLegacy(BaseModel): - model_config = ConfigDict( - extra="forbid", + event: str = Field(..., description="Name of the event.") + kind: Literal["EventsNode"] = "EventsNode" + math: Optional[AssistantTrendsMath] = Field( + default=None, + description=( + "Optional math aggregation type for the series. Only specify this math type if the user wants one of these." + " `first_time_for_user` - counts the number of users who have completed the event for the first time ever." + " `first_time_for_user_with_filters` - counts the number of users who have completed the event with" + " specified filters for the first time." + ), ) - cumulative: Optional[bool] = None - period: Optional[RetentionPeriod] = None - retention_reference: Optional[RetentionReference] = None - retention_type: Optional[RetentionType] = None - returning_entity: Optional[RetentionEntity] = None - show_mean: Optional[bool] = None - target_entity: Optional[RetentionEntity] = None - total_intervals: Optional[int] = None + properties: Optional[ + list[ + Union[ + Union[ + AssistantGenericPropertyFilter1, + AssistantGenericPropertyFilter2, + AssistantGenericPropertyFilter3, + AssistantGenericPropertyFilter4, + ], + Union[ + AssistantGroupPropertyFilter1, + AssistantGroupPropertyFilter2, + AssistantGroupPropertyFilter3, + AssistantGroupPropertyFilter4, + ], + ] + ] + ] = None + response: Optional[dict[str, Any]] = None -class RetentionResult(BaseModel): +class AssistantFunnelsQuery(BaseModel): model_config = ConfigDict( extra="forbid", ) - date: AwareDatetime - label: str - values: list[RetentionValue] - - -class SavedInsightNode(BaseModel): - model_config = ConfigDict( - extra="forbid", + aggregation_group_type_index: Optional[int] = Field( + default=None, + description=( + "Use this field to define the aggregation by a specific group from the group mapping that the user has" + " provided." + ), ) - allowSorting: Optional[bool] = Field( - default=None, description="Can the user click on column headers to sort the table? (default: true)" + breakdownFilter: Optional[AssistantFunnelsBreakdownFilter] = Field( + default=None, description="Breakdown the chart by a property" ) - embedded: Optional[bool] = Field(default=None, description="Query is embedded inside another bordered component") - expandable: Optional[bool] = Field( - default=None, description="Can expand row to show raw event data (default: true)" + dateRange: Optional[DateRange] = Field(default=None, description="Date range for the query") + filterTestAccounts: Optional[bool] = Field( + default=False, description="Exclude internal and test users by applying the respective filters" ) - full: Optional[bool] = Field( - default=None, description="Show with most visual options enabled. Used in insight scene." + funnelsFilter: Optional[AssistantFunnelsFilter] = Field( + default=None, description="Properties specific to the funnels insight" ) - hidePersonsModal: Optional[bool] = None - kind: Literal["SavedInsightNode"] = "SavedInsightNode" - propertiesViaUrl: Optional[bool] = Field(default=None, description="Link properties via the URL (default: false)") - shortId: str - showActions: Optional[bool] = Field(default=None, description="Show the kebab menu at the end of the row") - showColumnConfigurator: Optional[bool] = Field( - default=None, description="Show a button to configure the table's columns if possible" + interval: Optional[IntervalType] = Field( + default=None, description="Granularity of the response. Can be one of `hour`, `day`, `week` or `month`" ) - showCorrelationTable: Optional[bool] = None - showDateRange: Optional[bool] = Field(default=None, description="Show date range selector") - showElapsedTime: Optional[bool] = Field(default=None, description="Show the time it takes to run a query") - showEventFilter: Optional[bool] = Field( - default=None, description="Include an event filter above the table (EventsNode only)" + kind: Literal["FunnelsQuery"] = "FunnelsQuery" + properties: Optional[ + list[ + Union[ + Union[ + AssistantGenericPropertyFilter1, + AssistantGenericPropertyFilter2, + AssistantGenericPropertyFilter3, + AssistantGenericPropertyFilter4, + ], + Union[ + AssistantGroupPropertyFilter1, + AssistantGroupPropertyFilter2, + AssistantGroupPropertyFilter3, + AssistantGroupPropertyFilter4, + ], + ] + ] + ] = Field(default=[], description="Property filters for all series") + samplingFactor: Optional[float] = Field( + default=None, description="Sampling rate from 0 to 1 where 1 is 100% of the data." ) - showExport: Optional[bool] = Field(default=None, description="Show the export button") - showFilters: Optional[bool] = None - showHeader: Optional[bool] = None - showHogQLEditor: Optional[bool] = Field(default=None, description="Include a HogQL query editor above HogQL tables") - showLastComputation: Optional[bool] = None - showLastComputationRefresh: Optional[bool] = None - showOpenEditorButton: Optional[bool] = Field( - default=None, description="Show a button to open the current query as a new insight. (default: true)" + series: list[AssistantFunnelsEventsNode] = Field(..., description="Events to include") + + +class AssistantInsightsQueryBase(BaseModel): + model_config = ConfigDict( + extra="forbid", ) - showPersistentColumnConfigurator: Optional[bool] = Field( - default=None, description="Show a button to configure and persist the table's default columns if possible" + dateRange: Optional[DateRange] = Field(default=None, description="Date range for the query") + filterTestAccounts: Optional[bool] = Field( + default=False, description="Exclude internal and test users by applying the respective filters" ) - showPropertyFilter: Optional[Union[bool, list[TaxonomicFilterGroupType]]] = Field( - default=None, description="Include a property filter above the table" + properties: Optional[ + list[ + Union[ + Union[ + AssistantGenericPropertyFilter1, + AssistantGenericPropertyFilter2, + AssistantGenericPropertyFilter3, + AssistantGenericPropertyFilter4, + ], + Union[ + AssistantGroupPropertyFilter1, + AssistantGroupPropertyFilter2, + AssistantGroupPropertyFilter3, + AssistantGroupPropertyFilter4, + ], + ] + ] + ] = Field(default=[], description="Property filters for all series") + samplingFactor: Optional[float] = Field( + default=None, description="Sampling rate from 0 to 1 where 1 is 100% of the data." ) - showReload: Optional[bool] = Field(default=None, description="Show a reload button") - showResults: Optional[bool] = None - showResultsTable: Optional[bool] = Field(default=None, description="Show a results table") - showSavedQueries: Optional[bool] = Field(default=None, description="Shows a list of saved queries") - showSearch: Optional[bool] = Field(default=None, description="Include a free text search field (PersonsNode only)") - showTable: Optional[bool] = None - showTestAccountFilters: Optional[bool] = Field(default=None, description="Show filter to exclude test accounts") - showTimings: Optional[bool] = Field(default=None, description="Show a detailed query timing breakdown") - suppressSessionAnalysisWarning: Optional[bool] = None - vizSpecificOptions: Optional[VizSpecificOptions] = None -class Filters(BaseModel): +class AssistantTrendsEventsNode(BaseModel): model_config = ConfigDict( extra="forbid", ) - dateRange: Optional[DateRange] = None - properties: Optional[list[SessionPropertyFilter]] = None + custom_name: Optional[str] = None + event: Optional[str] = Field(default=None, description="The event or `null` for all events.") + kind: Literal["EventsNode"] = "EventsNode" + math: Optional[ + Union[ + BaseMathType, + FunnelMathType, + PropertyMathType, + CountPerActorMathType, + Literal["unique_group"], + Literal["hogql"], + ] + ] = None + math_group_type_index: Optional[MathGroupTypeIndex] = None + math_property: Optional[str] = None + math_property_type: Optional[str] = None + name: Optional[str] = None + orderBy: Optional[list[str]] = Field(default=None, description="Columns to order by") + properties: Optional[ + list[ + Union[ + Union[ + AssistantGenericPropertyFilter1, + AssistantGenericPropertyFilter2, + AssistantGenericPropertyFilter3, + AssistantGenericPropertyFilter4, + ], + Union[ + AssistantGroupPropertyFilter1, + AssistantGroupPropertyFilter2, + AssistantGroupPropertyFilter3, + AssistantGroupPropertyFilter4, + ], + ] + ] + ] = None + response: Optional[dict[str, Any]] = None -class SessionAttributionExplorerQueryResponse(BaseModel): +class AssistantTrendsQuery(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: Optional[list] = None - error: Optional[str] = Field( - default=None, - description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", + breakdownFilter: Optional[AssistantTrendsBreakdownFilter] = Field( + default=None, description="Breakdown of the events" ) - hasMore: Optional[bool] = None - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - limit: Optional[int] = None - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" + compareFilter: Optional[CompareFilter] = Field(default=None, description="Compare to date range") + dateRange: Optional[DateRange] = Field(default=None, description="Date range for the query") + filterTestAccounts: Optional[bool] = Field( + default=False, description="Exclude internal and test users by applying the respective filters" ) - offset: Optional[int] = None - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." + interval: Optional[IntervalType] = Field( + default=IntervalType.DAY, + description="Granularity of the response. Can be one of `hour`, `day`, `week` or `month`", ) - results: Any - timings: Optional[list[QueryTiming]] = Field( - default=None, description="Measured timings for different parts of the query generation process" + kind: Literal["TrendsQuery"] = "TrendsQuery" + properties: Optional[ + list[ + Union[ + Union[ + AssistantGenericPropertyFilter1, + AssistantGenericPropertyFilter2, + AssistantGenericPropertyFilter3, + AssistantGenericPropertyFilter4, + ], + Union[ + AssistantGroupPropertyFilter1, + AssistantGroupPropertyFilter2, + AssistantGroupPropertyFilter3, + AssistantGroupPropertyFilter4, + ], + ] + ] + ] = Field(default=[], description="Property filters for all series") + samplingFactor: Optional[float] = Field( + default=None, description="Sampling rate from 0 to 1 where 1 is 100% of the data." + ) + series: list[AssistantTrendsEventsNode] = Field(..., description="Events to include") + trendsFilter: Optional[AssistantTrendsFilter] = Field( + default=None, description="Properties specific to the trends insight" ) - types: Optional[list] = None -class SessionRecordingType(BaseModel): +class BreakdownItem(BaseModel): model_config = ConfigDict( extra="forbid", ) - active_seconds: Optional[float] = None - activity_score: Optional[float] = Field( - default=None, description="calculated on the backend so that we can sort by it, definition may change over time" - ) - click_count: Optional[float] = None - console_error_count: Optional[float] = None - console_log_count: Optional[float] = None - console_warn_count: Optional[float] = None - distinct_id: Optional[str] = None - email: Optional[str] = None - end_time: str = Field(..., description="When the recording ends in ISO format.") - id: str - inactive_seconds: Optional[float] = None - keypress_count: Optional[float] = None - matching_events: Optional[list[MatchedRecording]] = Field(default=None, description="List of matching events. *") - mouse_activity_count: Optional[float] = Field( - default=None, description="count of all mouse activity in the recording, not just clicks" - ) - ongoing: Optional[bool] = Field( - default=None, - description=( - "whether we have received data for this recording in the last 5 minutes (assumes the recording was loaded" - " from ClickHouse)\n*" - ), + label: str + value: Union[str, int] + + +class CacheMissResponse(BaseModel): + model_config = ConfigDict( + extra="forbid", ) - person: Optional[PersonType] = None - recording_duration: float = Field(..., description="Length of recording in seconds.") - snapshot_source: SnapshotSource - start_time: str = Field(..., description="When the recording starts in ISO format.") - start_url: Optional[str] = None - storage: Optional[Storage] = Field(default=None, description="Where this recording information was loaded from") - summary: Optional[str] = None - viewed: bool = Field(..., description="Whether this recording has been viewed already.") + cache_key: Optional[str] = None + query_status: Optional[QueryStatus] = None -class SessionsTimelineQueryResponse(BaseModel): +class CachedActorsPropertyTaxonomyQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + ) error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + is_cached: bool + last_refresh: AwareDatetime modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) + next_allowed_client_refresh: AwareDatetime query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[TimelineEntry] + results: ActorsPropertyTaxonomyResponse + timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) -class StickinessCriteria(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - operator: StickinessOperator - value: int - - -class StickinessFilter(BaseModel): +class CachedActorsQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - display: Optional[ChartDisplayType] = None - hiddenLegendIndexes: Optional[list[int]] = None - showLegend: Optional[bool] = None - showValuesOnSeries: Optional[bool] = None - stickinessCriteria: Optional[StickinessCriteria] = None - - -class StickinessQueryResponse(BaseModel): - model_config = ConfigDict( - extra="forbid", + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" ) + columns: list error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + hasMore: Optional[bool] = None + hogql: str = Field(..., description="Generated HogQL query.") + is_cached: bool + last_refresh: AwareDatetime + limit: int + missing_actors_count: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) + next_allowed_client_refresh: AwareDatetime + offset: int query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[dict[str, Any]] + results: list[list] + timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) + types: list[str] -class SuggestedQuestionsQuery(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - kind: Literal["SuggestedQuestionsQuery"] = "SuggestedQuestionsQuery" - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" - ) - response: Optional[SuggestedQuestionsQueryResponse] = None - - -class TableSettings(BaseModel): +class CachedErrorTrackingQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: Optional[list[ChartAxis]] = None - conditionalFormatting: Optional[list[ConditionalFormattingRule]] = None - - -class TeamTaxonomyQueryResponse(BaseModel): - model_config = ConfigDict( - extra="forbid", + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" ) + columns: Optional[list[str]] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) + hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + is_cached: bool + last_refresh: AwareDatetime + limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) + next_allowed_client_refresh: AwareDatetime + offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[TeamTaxonomyItem] + results: list[ErrorTrackingIssue] + timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) -class TestBasicQueryResponse(BaseModel): +class CachedEventTaxonomyQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + ) error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + is_cached: bool + last_refresh: AwareDatetime modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) + next_allowed_client_refresh: AwareDatetime query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list + results: list[EventTaxonomyItem] + timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) -class TestCachedBasicQueryResponse(BaseModel): +class CachedEventsQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) @@ -3321,143 +3222,167 @@ class TestCachedBasicQueryResponse(BaseModel): calculation_trigger: Optional[str] = Field( default=None, description="What triggered the calculation of the query, leave empty if user/immediate" ) + columns: list error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + hasMore: Optional[bool] = None + hogql: str = Field(..., description="Generated HogQL query.") is_cached: bool last_refresh: AwareDatetime + limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) next_allowed_client_refresh: AwareDatetime + offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list + results: list[list] timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) + types: list[str] -class TrendsQueryResponse(BaseModel): +class CachedFunnelCorrelationResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + ) + columns: Optional[list] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hasMore: Optional[bool] = Field(default=None, description="Wether more breakdown values are available.") + hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + is_cached: bool + last_refresh: AwareDatetime + limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) + next_allowed_client_refresh: AwareDatetime + offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[dict[str, Any]] + results: FunnelCorrelationResult + timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) + types: Optional[list] = None -class WebExternalClicksTableQueryResponse(BaseModel): +class CachedFunnelsQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: Optional[list] = None + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + ) error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - limit: Optional[int] = None + isUdf: Optional[bool] = None + is_cached: bool + last_refresh: AwareDatetime modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - offset: Optional[int] = None + next_allowed_client_refresh: AwareDatetime query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list - samplingRate: Optional[SamplingRate] = None + results: Union[FunnelTimeToConvertResults, list[dict[str, Any]], list[list[dict[str, Any]]]] + timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) - types: Optional[list] = None -class WebGoalsQueryResponse(BaseModel): +class CachedLifecycleQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: Optional[list] = None + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + ) error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - limit: Optional[int] = None + is_cached: bool + last_refresh: AwareDatetime modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - offset: Optional[int] = None + next_allowed_client_refresh: AwareDatetime query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list - samplingRate: Optional[SamplingRate] = None + results: list[dict[str, Any]] + timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) - types: Optional[list] = None -class WebOverviewItem(BaseModel): +class CachedPathsQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - changeFromPreviousPct: Optional[float] = None - isIncreaseBad: Optional[bool] = None - key: str - kind: WebOverviewItemKind - previous: Optional[float] = None - value: Optional[float] = None - - -class WebOverviewQueryResponse(BaseModel): - model_config = ConfigDict( - extra="forbid", + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" ) - dateFrom: Optional[str] = None - dateTo: Optional[str] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + is_cached: bool + last_refresh: AwareDatetime modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) + next_allowed_client_refresh: AwareDatetime query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[WebOverviewItem] - samplingRate: Optional[SamplingRate] = None + results: list[dict[str, Any]] + timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) -class WebStatsTableQueryResponse(BaseModel): +class CachedSessionAttributionExplorerQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + ) columns: Optional[list] = None error: Optional[str] = Field( default=None, @@ -3465,293 +3390,203 @@ class WebStatsTableQueryResponse(BaseModel): ) hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + is_cached: bool + last_refresh: AwareDatetime limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) + next_allowed_client_refresh: AwareDatetime offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list - samplingRate: Optional[SamplingRate] = None + results: Any + timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) types: Optional[list] = None -class ActorsPropertyTaxonomyQueryResponse(BaseModel): +class CachedSessionsTimelineQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + ) error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) + hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + is_cached: bool + last_refresh: AwareDatetime modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) + next_allowed_client_refresh: AwareDatetime query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: ActorsPropertyTaxonomyResponse + results: list[TimelineEntry] + timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) -class ActorsQueryResponse(BaseModel): +class CachedStickinessQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: list + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + ) error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hasMore: Optional[bool] = None - hogql: str = Field(..., description="Generated HogQL query.") - limit: int - missing_actors_count: Optional[int] = None + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + is_cached: bool + last_refresh: AwareDatetime modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - offset: int + next_allowed_client_refresh: AwareDatetime query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[list] + results: list[dict[str, Any]] + timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) - types: list[str] - - -class AssistantBasePropertyFilter( - RootModel[ - Union[ - AssistantDateTimePropertyFilter, - AssistantSetPropertyFilter, - Union[AssistantSingleValuePropertyFilter, AssistantArrayPropertyFilter], - ] - ] -): - root: Union[ - AssistantDateTimePropertyFilter, - AssistantSetPropertyFilter, - Union[AssistantSingleValuePropertyFilter, AssistantArrayPropertyFilter], - ] - - -class AssistantFunnelsEventsNode(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - custom_name: Optional[str] = Field( - default=None, description="Optional custom name for the event if it is needed to be renamed." - ) - event: str = Field(..., description="Name of the event.") - kind: Literal["EventsNode"] = "EventsNode" - math: Optional[AssistantTrendsMath] = Field( - default=None, - description=( - "Optional math aggregation type for the series. Only specify this math type if the user wants one of these." - " `first_time_for_user` - counts the number of users who have completed the event for the first time ever." - " `first_time_for_user_with_filters` - counts the number of users who have completed the event with" - " specified filters for the first time." - ), - ) - properties: Optional[ - list[ - Union[ - Union[ - AssistantGenericPropertyFilter1, - AssistantGenericPropertyFilter2, - AssistantGenericPropertyFilter3, - AssistantGenericPropertyFilter4, - ], - Union[ - AssistantGroupPropertyFilter1, - AssistantGroupPropertyFilter2, - AssistantGroupPropertyFilter3, - AssistantGroupPropertyFilter4, - ], - ] - ] - ] = None - response: Optional[dict[str, Any]] = None -class AssistantFunnelsQuery(BaseModel): +class CachedSuggestedQuestionsQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - aggregation_group_type_index: Optional[int] = Field( - default=None, - description=( - "Use this field to define the aggregation by a specific group from the group mapping that the user has" - " provided." - ), - ) - breakdownFilter: Optional[AssistantFunnelsBreakdownFilter] = Field( - default=None, description="Breakdown the chart by a property" - ) - dateRange: Optional[DateRange] = Field(default=None, description="Date range for the query") - filterTestAccounts: Optional[bool] = Field( - default=False, description="Exclude internal and test users by applying the respective filters" - ) - funnelsFilter: Optional[AssistantFunnelsFilter] = Field( - default=None, description="Properties specific to the funnels insight" - ) - interval: Optional[IntervalType] = Field( - default=None, description="Granularity of the response. Can be one of `hour`, `day`, `week` or `month`" + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" ) - kind: Literal["FunnelsQuery"] = "FunnelsQuery" - properties: Optional[ - list[ - Union[ - Union[ - AssistantGenericPropertyFilter1, - AssistantGenericPropertyFilter2, - AssistantGenericPropertyFilter3, - AssistantGenericPropertyFilter4, - ], - Union[ - AssistantGroupPropertyFilter1, - AssistantGroupPropertyFilter2, - AssistantGroupPropertyFilter3, - AssistantGroupPropertyFilter4, - ], - ] - ] - ] = Field(default=[], description="Property filters for all series") - samplingFactor: Optional[float] = Field( - default=None, description="Sampling rate from 0 to 1 where 1 is 100% of the data." + is_cached: bool + last_refresh: AwareDatetime + next_allowed_client_refresh: AwareDatetime + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - series: list[AssistantFunnelsEventsNode] = Field(..., description="Events to include") + questions: list[str] + timezone: str -class AssistantInsightsQueryBase(BaseModel): +class CachedTeamTaxonomyQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - dateRange: Optional[DateRange] = Field(default=None, description="Date range for the query") - filterTestAccounts: Optional[bool] = Field( - default=False, description="Exclude internal and test users by applying the respective filters" + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" ) - properties: Optional[ - list[ - Union[ - Union[ - AssistantGenericPropertyFilter1, - AssistantGenericPropertyFilter2, - AssistantGenericPropertyFilter3, - AssistantGenericPropertyFilter4, - ], - Union[ - AssistantGroupPropertyFilter1, - AssistantGroupPropertyFilter2, - AssistantGroupPropertyFilter3, - AssistantGroupPropertyFilter4, - ], - ] - ] - ] = Field(default=[], description="Property filters for all series") - samplingFactor: Optional[float] = Field( - default=None, description="Sampling rate from 0 to 1 where 1 is 100% of the data." + error: Optional[str] = Field( + default=None, + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", + ) + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + is_cached: bool + last_refresh: AwareDatetime + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" + ) + next_allowed_client_refresh: AwareDatetime + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." + ) + results: list[TeamTaxonomyItem] + timezone: str + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" ) -class AssistantTrendsEventsNode(BaseModel): +class CachedTrendsQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - custom_name: Optional[str] = None - event: Optional[str] = Field(default=None, description="The event or `null` for all events.") - kind: Literal["EventsNode"] = "EventsNode" - math: Optional[ - Union[ - BaseMathType, - FunnelMathType, - PropertyMathType, - CountPerActorMathType, - Literal["unique_group"], - Literal["hogql"], - ] - ] = None - math_group_type_index: Optional[MathGroupTypeIndex] = None - math_property: Optional[str] = None - math_property_type: Optional[str] = None - name: Optional[str] = None - orderBy: Optional[list[str]] = Field(default=None, description="Columns to order by") - properties: Optional[ - list[ - Union[ - Union[ - AssistantGenericPropertyFilter1, - AssistantGenericPropertyFilter2, - AssistantGenericPropertyFilter3, - AssistantGenericPropertyFilter4, - ], - Union[ - AssistantGroupPropertyFilter1, - AssistantGroupPropertyFilter2, - AssistantGroupPropertyFilter3, - AssistantGroupPropertyFilter4, - ], - ] - ] - ] = None - response: Optional[dict[str, Any]] = None + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + ) + error: Optional[str] = Field( + default=None, + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", + ) + hasMore: Optional[bool] = Field(default=None, description="Wether more breakdown values are available.") + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + is_cached: bool + last_refresh: AwareDatetime + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" + ) + next_allowed_client_refresh: AwareDatetime + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." + ) + results: list[dict[str, Any]] + timezone: str + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" + ) -class AssistantTrendsQuery(BaseModel): +class CachedWebExternalClicksTableQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - breakdownFilter: Optional[AssistantTrendsBreakdownFilter] = Field( - default=None, description="Breakdown of the events" + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" ) - compareFilter: Optional[CompareFilter] = Field(default=None, description="Compare to date range") - dateRange: Optional[DateRange] = Field(default=None, description="Date range for the query") - filterTestAccounts: Optional[bool] = Field( - default=False, description="Exclude internal and test users by applying the respective filters" + columns: Optional[list] = None + error: Optional[str] = Field( + default=None, + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - interval: Optional[IntervalType] = Field( - default=IntervalType.DAY, - description="Granularity of the response. Can be one of `hour`, `day`, `week` or `month`", + hasMore: Optional[bool] = None + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + is_cached: bool + last_refresh: AwareDatetime + limit: Optional[int] = None + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" ) - kind: Literal["TrendsQuery"] = "TrendsQuery" - properties: Optional[ - list[ - Union[ - Union[ - AssistantGenericPropertyFilter1, - AssistantGenericPropertyFilter2, - AssistantGenericPropertyFilter3, - AssistantGenericPropertyFilter4, - ], - Union[ - AssistantGroupPropertyFilter1, - AssistantGroupPropertyFilter2, - AssistantGroupPropertyFilter3, - AssistantGroupPropertyFilter4, - ], - ] - ] - ] = Field(default=[], description="Property filters for all series") - samplingFactor: Optional[float] = Field( - default=None, description="Sampling rate from 0 to 1 where 1 is 100% of the data." + next_allowed_client_refresh: AwareDatetime + offset: Optional[int] = None + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - series: list[AssistantTrendsEventsNode] = Field(..., description="Events to include") - trendsFilter: Optional[AssistantTrendsFilter] = Field( - default=None, description="Properties specific to the trends insight" + results: list + samplingRate: Optional[SamplingRate] = None + timezone: str + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" ) + types: Optional[list] = None -class CachedActorsPropertyTaxonomyQueryResponse(BaseModel): +class CachedWebGoalsQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) @@ -3760,28 +3595,34 @@ class CachedActorsPropertyTaxonomyQueryResponse(BaseModel): calculation_trigger: Optional[str] = Field( default=None, description="What triggered the calculation of the query, leave empty if user/immediate" ) + columns: Optional[list] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) + hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") is_cached: bool last_refresh: AwareDatetime + limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) next_allowed_client_refresh: AwareDatetime + offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: ActorsPropertyTaxonomyResponse + results: list + samplingRate: Optional[SamplingRate] = None timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) + types: Optional[list] = None -class CachedActorsQueryResponse(BaseModel): +class CachedWebOverviewQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) @@ -3790,34 +3631,31 @@ class CachedActorsQueryResponse(BaseModel): calculation_trigger: Optional[str] = Field( default=None, description="What triggered the calculation of the query, leave empty if user/immediate" ) - columns: list + dateFrom: Optional[str] = None + dateTo: Optional[str] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hasMore: Optional[bool] = None - hogql: str = Field(..., description="Generated HogQL query.") + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") is_cached: bool last_refresh: AwareDatetime - limit: int - missing_actors_count: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) next_allowed_client_refresh: AwareDatetime - offset: int query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[list] + results: list[WebOverviewItem] + samplingRate: Optional[SamplingRate] = None timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) - types: list[str] -class CachedErrorTrackingQueryResponse(BaseModel): +class CachedWebStatsTableQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) @@ -3826,7 +3664,7 @@ class CachedErrorTrackingQueryResponse(BaseModel): calculation_trigger: Optional[str] = Field( default=None, description="What triggered the calculation of the query, leave empty if user/immediate" ) - columns: Optional[list[str]] = None + columns: Optional[list] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", @@ -3844,87 +3682,123 @@ class CachedErrorTrackingQueryResponse(BaseModel): query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[ErrorTrackingIssue] + results: list + samplingRate: Optional[SamplingRate] = None timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) + types: Optional[list] = None + + +class DashboardFilter(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + date_from: Optional[str] = None + date_to: Optional[str] = None + properties: Optional[ + list[ + Union[ + EventPropertyFilter, + PersonPropertyFilter, + ElementPropertyFilter, + SessionPropertyFilter, + CohortPropertyFilter, + RecordingPropertyFilter, + LogEntryPropertyFilter, + GroupPropertyFilter, + FeaturePropertyFilter, + HogQLPropertyFilter, + EmptyPropertyFilter, + DataWarehousePropertyFilter, + DataWarehousePersonPropertyFilter, + ] + ] + ] = None + + +class Response(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + columns: list + error: Optional[str] = Field( + default=None, + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", + ) + hasMore: Optional[bool] = None + hogql: str = Field(..., description="Generated HogQL query.") + limit: Optional[int] = None + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" + ) + offset: Optional[int] = None + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." + ) + results: list[list] + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" + ) + types: list[str] -class CachedEventTaxonomyQueryResponse(BaseModel): +class Response1(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" - ) + columns: list error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - is_cached: bool - last_refresh: AwareDatetime + hasMore: Optional[bool] = None + hogql: str = Field(..., description="Generated HogQL query.") + limit: int + missing_actors_count: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - next_allowed_client_refresh: AwareDatetime + offset: int query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[EventTaxonomyItem] - timezone: str + results: list[list] timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) + types: list[str] -class CachedEventsQueryResponse(BaseModel): +class Response3(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" - ) - columns: list + dateFrom: Optional[str] = None + dateTo: Optional[str] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hasMore: Optional[bool] = None - hogql: str = Field(..., description="Generated HogQL query.") - is_cached: bool - last_refresh: AwareDatetime - limit: Optional[int] = None + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - next_allowed_client_refresh: AwareDatetime - offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[list] - timezone: str + results: list[WebOverviewItem] + samplingRate: Optional[SamplingRate] = None timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) - types: list[str] -class CachedFunnelCorrelationResponse(BaseModel): +class Response4(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" - ) columns: Optional[list] = None error: Optional[str] = Field( default=None, @@ -3932,219 +3806,376 @@ class CachedFunnelCorrelationResponse(BaseModel): ) hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - is_cached: bool - last_refresh: AwareDatetime limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - next_allowed_client_refresh: AwareDatetime offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: FunnelCorrelationResult - timezone: str + results: list + samplingRate: Optional[SamplingRate] = None timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) types: Optional[list] = None -class CachedFunnelsQueryResponse(BaseModel): +class Response7(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" - ) + columns: Optional[list] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) + hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - isUdf: Optional[bool] = None - is_cached: bool - last_refresh: AwareDatetime + limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - next_allowed_client_refresh: AwareDatetime + offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: Union[FunnelTimeToConvertResults, list[dict[str, Any]], list[list[dict[str, Any]]]] - timezone: str + results: Any timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) + types: Optional[list] = None -class CachedHogQLQueryResponse(BaseModel): +class Response8(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" - ) - clickhouse: Optional[str] = Field(default=None, description="Executed ClickHouse query") - columns: Optional[list] = Field(default=None, description="Returned columns") + columns: Optional[list[str]] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - explain: Optional[list[str]] = Field(default=None, description="Query explanation output") hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - is_cached: bool - last_refresh: AwareDatetime limit: Optional[int] = None - metadata: Optional[HogQLMetadataResponse] = Field(default=None, description="Query metadata output") modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - next_allowed_client_refresh: AwareDatetime offset: Optional[int] = None - query: Optional[str] = Field(default=None, description="Input query string") query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list - timezone: str + results: list[ErrorTrackingIssue] timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) - types: Optional[list] = Field(default=None, description="Types of returned columns") -class CachedInsightActorsQueryOptionsResponse(BaseModel): +class DataWarehouseNode(BaseModel): model_config = ConfigDict( extra="forbid", ) - breakdown: Optional[list[BreakdownItem]] = None - breakdowns: Optional[list[MultipleBreakdownOptions]] = None - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + custom_name: Optional[str] = None + distinct_id_field: str + fixedProperties: Optional[ + list[ + Union[ + EventPropertyFilter, + PersonPropertyFilter, + ElementPropertyFilter, + SessionPropertyFilter, + CohortPropertyFilter, + RecordingPropertyFilter, + LogEntryPropertyFilter, + GroupPropertyFilter, + FeaturePropertyFilter, + HogQLPropertyFilter, + EmptyPropertyFilter, + DataWarehousePropertyFilter, + DataWarehousePersonPropertyFilter, + ] + ] + ] = Field( + default=None, + description="Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)", ) - compare: Optional[list[CompareItem]] = None - day: Optional[list[DayItem]] = None - interval: Optional[list[IntervalItem]] = None - is_cached: bool - last_refresh: AwareDatetime - next_allowed_client_refresh: AwareDatetime - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." + id: str + id_field: str + kind: Literal["DataWarehouseNode"] = "DataWarehouseNode" + math: Optional[ + Union[ + BaseMathType, + FunnelMathType, + PropertyMathType, + CountPerActorMathType, + Literal["unique_group"], + Literal["hogql"], + ] + ] = None + math_group_type_index: Optional[MathGroupTypeIndex] = None + math_hogql: Optional[str] = None + math_property: Optional[str] = None + math_property_type: Optional[str] = None + name: Optional[str] = None + properties: Optional[ + list[ + Union[ + EventPropertyFilter, + PersonPropertyFilter, + ElementPropertyFilter, + SessionPropertyFilter, + CohortPropertyFilter, + RecordingPropertyFilter, + LogEntryPropertyFilter, + GroupPropertyFilter, + FeaturePropertyFilter, + HogQLPropertyFilter, + EmptyPropertyFilter, + DataWarehousePropertyFilter, + DataWarehousePersonPropertyFilter, + ] + ] + ] = Field(default=None, description="Properties configurable in the interface") + response: Optional[dict[str, Any]] = None + table_name: str + timestamp_field: str + + +class DatabaseSchemaBatchExportTable(BaseModel): + model_config = ConfigDict( + extra="forbid", ) - series: Optional[list[Series]] = None - status: Optional[list[StatusItem]] = None - timezone: str + fields: dict[str, DatabaseSchemaField] + id: str + name: str + type: Literal["batch_export"] = "batch_export" + + +class DatabaseSchemaDataWarehouseTable(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + fields: dict[str, DatabaseSchemaField] + format: str + id: str + name: str + schema_: Optional[DatabaseSchemaSchema] = Field(default=None, alias="schema") + source: Optional[DatabaseSchemaSource] = None + type: Literal["data_warehouse"] = "data_warehouse" + url_pattern: str + + +class EntityNode(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + custom_name: Optional[str] = None + fixedProperties: Optional[ + list[ + Union[ + EventPropertyFilter, + PersonPropertyFilter, + ElementPropertyFilter, + SessionPropertyFilter, + CohortPropertyFilter, + RecordingPropertyFilter, + LogEntryPropertyFilter, + GroupPropertyFilter, + FeaturePropertyFilter, + HogQLPropertyFilter, + EmptyPropertyFilter, + DataWarehousePropertyFilter, + DataWarehousePersonPropertyFilter, + ] + ] + ] = Field( + default=None, + description="Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)", + ) + kind: NodeKind + math: Optional[ + Union[ + BaseMathType, + FunnelMathType, + PropertyMathType, + CountPerActorMathType, + Literal["unique_group"], + Literal["hogql"], + ] + ] = None + math_group_type_index: Optional[MathGroupTypeIndex] = None + math_hogql: Optional[str] = None + math_property: Optional[str] = None + math_property_type: Optional[str] = None + name: Optional[str] = None + properties: Optional[ + list[ + Union[ + EventPropertyFilter, + PersonPropertyFilter, + ElementPropertyFilter, + SessionPropertyFilter, + CohortPropertyFilter, + RecordingPropertyFilter, + LogEntryPropertyFilter, + GroupPropertyFilter, + FeaturePropertyFilter, + HogQLPropertyFilter, + EmptyPropertyFilter, + DataWarehousePropertyFilter, + DataWarehousePersonPropertyFilter, + ] + ] + ] = Field(default=None, description="Properties configurable in the interface") + response: Optional[dict[str, Any]] = None -class CachedLifecycleQueryResponse(BaseModel): +class ErrorTrackingQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" - ) + columns: Optional[list[str]] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) + hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - is_cached: bool - last_refresh: AwareDatetime + limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - next_allowed_client_refresh: AwareDatetime + offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[dict[str, Any]] - timezone: str + results: list[ErrorTrackingIssue] timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) -class CachedPathsQueryResponse(BaseModel): +class EventTaxonomyQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" - ) error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - is_cached: bool - last_refresh: AwareDatetime modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - next_allowed_client_refresh: AwareDatetime query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[dict[str, Any]] - timezone: str + results: list[EventTaxonomyItem] timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) -class CachedRetentionQueryResponse(BaseModel): +class EventsNode(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + custom_name: Optional[str] = None + event: Optional[str] = Field(default=None, description="The event or `null` for all events.") + fixedProperties: Optional[ + list[ + Union[ + EventPropertyFilter, + PersonPropertyFilter, + ElementPropertyFilter, + SessionPropertyFilter, + CohortPropertyFilter, + RecordingPropertyFilter, + LogEntryPropertyFilter, + GroupPropertyFilter, + FeaturePropertyFilter, + HogQLPropertyFilter, + EmptyPropertyFilter, + DataWarehousePropertyFilter, + DataWarehousePersonPropertyFilter, + ] + ] + ] = Field( + default=None, + description="Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)", + ) + kind: Literal["EventsNode"] = "EventsNode" + limit: Optional[int] = None + math: Optional[ + Union[ + BaseMathType, + FunnelMathType, + PropertyMathType, + CountPerActorMathType, + Literal["unique_group"], + Literal["hogql"], + ] + ] = None + math_group_type_index: Optional[MathGroupTypeIndex] = None + math_hogql: Optional[str] = None + math_property: Optional[str] = None + math_property_type: Optional[str] = None + name: Optional[str] = None + orderBy: Optional[list[str]] = Field(default=None, description="Columns to order by") + properties: Optional[ + list[ + Union[ + EventPropertyFilter, + PersonPropertyFilter, + ElementPropertyFilter, + SessionPropertyFilter, + CohortPropertyFilter, + RecordingPropertyFilter, + LogEntryPropertyFilter, + GroupPropertyFilter, + FeaturePropertyFilter, + HogQLPropertyFilter, + EmptyPropertyFilter, + DataWarehousePropertyFilter, + DataWarehousePersonPropertyFilter, + ] + ] + ] = Field(default=None, description="Properties configurable in the interface") + response: Optional[dict[str, Any]] = None + + +class EventsQueryResponse(BaseModel): + model_config = ConfigDict( + extra="forbid", ) + columns: list error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - is_cached: bool - last_refresh: AwareDatetime + hasMore: Optional[bool] = None + hogql: str = Field(..., description="Generated HogQL query.") + limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - next_allowed_client_refresh: AwareDatetime + offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[RetentionResult] - timezone: str + results: list[list] timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) + types: list[str] -class CachedSessionAttributionExplorerQueryResponse(BaseModel): +class FunnelCorrelationResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" - ) columns: Optional[list] = None error: Optional[str] = Field( default=None, @@ -4152,296 +4183,392 @@ class CachedSessionAttributionExplorerQueryResponse(BaseModel): ) hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - is_cached: bool - last_refresh: AwareDatetime limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - next_allowed_client_refresh: AwareDatetime offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: Any - timezone: str + results: FunnelCorrelationResult timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) types: Optional[list] = None -class CachedSessionsTimelineQueryResponse(BaseModel): +class FunnelExclusionActionsNode(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + custom_name: Optional[str] = None + fixedProperties: Optional[ + list[ + Union[ + EventPropertyFilter, + PersonPropertyFilter, + ElementPropertyFilter, + SessionPropertyFilter, + CohortPropertyFilter, + RecordingPropertyFilter, + LogEntryPropertyFilter, + GroupPropertyFilter, + FeaturePropertyFilter, + HogQLPropertyFilter, + EmptyPropertyFilter, + DataWarehousePropertyFilter, + DataWarehousePersonPropertyFilter, + ] + ] + ] = Field( + default=None, + description="Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)", + ) + funnelFromStep: int + funnelToStep: int + id: int + kind: Literal["ActionsNode"] = "ActionsNode" + math: Optional[ + Union[ + BaseMathType, + FunnelMathType, + PropertyMathType, + CountPerActorMathType, + Literal["unique_group"], + Literal["hogql"], + ] + ] = None + math_group_type_index: Optional[MathGroupTypeIndex] = None + math_hogql: Optional[str] = None + math_property: Optional[str] = None + math_property_type: Optional[str] = None + name: Optional[str] = None + properties: Optional[ + list[ + Union[ + EventPropertyFilter, + PersonPropertyFilter, + ElementPropertyFilter, + SessionPropertyFilter, + CohortPropertyFilter, + RecordingPropertyFilter, + LogEntryPropertyFilter, + GroupPropertyFilter, + FeaturePropertyFilter, + HogQLPropertyFilter, + EmptyPropertyFilter, + DataWarehousePropertyFilter, + DataWarehousePersonPropertyFilter, + ] + ] + ] = Field(default=None, description="Properties configurable in the interface") + response: Optional[dict[str, Any]] = None + + +class FunnelExclusionEventsNode(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + custom_name: Optional[str] = None + event: Optional[str] = Field(default=None, description="The event or `null` for all events.") + fixedProperties: Optional[ + list[ + Union[ + EventPropertyFilter, + PersonPropertyFilter, + ElementPropertyFilter, + SessionPropertyFilter, + CohortPropertyFilter, + RecordingPropertyFilter, + LogEntryPropertyFilter, + GroupPropertyFilter, + FeaturePropertyFilter, + HogQLPropertyFilter, + EmptyPropertyFilter, + DataWarehousePropertyFilter, + DataWarehousePersonPropertyFilter, + ] + ] + ] = Field( + default=None, + description="Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)", + ) + funnelFromStep: int + funnelToStep: int + kind: Literal["EventsNode"] = "EventsNode" + limit: Optional[int] = None + math: Optional[ + Union[ + BaseMathType, + FunnelMathType, + PropertyMathType, + CountPerActorMathType, + Literal["unique_group"], + Literal["hogql"], + ] + ] = None + math_group_type_index: Optional[MathGroupTypeIndex] = None + math_hogql: Optional[str] = None + math_property: Optional[str] = None + math_property_type: Optional[str] = None + name: Optional[str] = None + orderBy: Optional[list[str]] = Field(default=None, description="Columns to order by") + properties: Optional[ + list[ + Union[ + EventPropertyFilter, + PersonPropertyFilter, + ElementPropertyFilter, + SessionPropertyFilter, + CohortPropertyFilter, + RecordingPropertyFilter, + LogEntryPropertyFilter, + GroupPropertyFilter, + FeaturePropertyFilter, + HogQLPropertyFilter, + EmptyPropertyFilter, + DataWarehousePropertyFilter, + DataWarehousePersonPropertyFilter, + ] + ] + ] = Field(default=None, description="Properties configurable in the interface") + response: Optional[dict[str, Any]] = None + + +class FunnelsQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" - ) error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - is_cached: bool - last_refresh: AwareDatetime + isUdf: Optional[bool] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - next_allowed_client_refresh: AwareDatetime query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[TimelineEntry] - timezone: str + results: Union[FunnelTimeToConvertResults, list[dict[str, Any]], list[list[dict[str, Any]]]] timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) -class CachedStickinessQueryResponse(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +class GenericCachedQueryResponse(BaseModel): cache_key: str cache_target_age: Optional[AwareDatetime] = None calculation_trigger: Optional[str] = Field( default=None, description="What triggered the calculation of the query, leave empty if user/immediate" ) - error: Optional[str] = Field( - default=None, - description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", - ) - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") is_cached: bool last_refresh: AwareDatetime - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" - ) next_allowed_client_refresh: AwareDatetime query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[dict[str, Any]] timezone: str - timings: Optional[list[QueryTiming]] = Field( - default=None, description="Measured timings for different parts of the query generation process" - ) -class CachedTeamTaxonomyQueryResponse(BaseModel): +class HogQLFilters(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" - ) - error: Optional[str] = Field( - default=None, - description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", - ) - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - is_cached: bool - last_refresh: AwareDatetime - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" - ) - next_allowed_client_refresh: AwareDatetime - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." - ) - results: list[TeamTaxonomyItem] - timezone: str - timings: Optional[list[QueryTiming]] = Field( - default=None, description="Measured timings for different parts of the query generation process" - ) + dateRange: Optional[DateRange] = None + filterTestAccounts: Optional[bool] = None + properties: Optional[ + list[ + Union[ + EventPropertyFilter, + PersonPropertyFilter, + ElementPropertyFilter, + SessionPropertyFilter, + CohortPropertyFilter, + RecordingPropertyFilter, + LogEntryPropertyFilter, + GroupPropertyFilter, + FeaturePropertyFilter, + HogQLPropertyFilter, + EmptyPropertyFilter, + DataWarehousePropertyFilter, + DataWarehousePersonPropertyFilter, + ] + ] + ] = None -class CachedTrendsQueryResponse(BaseModel): +class HogQLMetadataResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" - ) - error: Optional[str] = Field( - default=None, - description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", - ) - hasMore: Optional[bool] = Field(default=None, description="Wether more breakdown values are available.") - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - is_cached: bool - last_refresh: AwareDatetime - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" - ) - next_allowed_client_refresh: AwareDatetime - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." - ) - results: list[dict[str, Any]] - timezone: str - timings: Optional[list[QueryTiming]] = Field( - default=None, description="Measured timings for different parts of the query generation process" - ) + errors: list[HogQLNotice] + isValid: Optional[bool] = None + isValidView: Optional[bool] = None + notices: list[HogQLNotice] + query: Optional[str] = None + table_names: Optional[list[str]] = None + warnings: list[HogQLNotice] -class CachedWebExternalClicksTableQueryResponse(BaseModel): +class HogQLQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" - ) - columns: Optional[list] = None + clickhouse: Optional[str] = Field(default=None, description="Executed ClickHouse query") + columns: Optional[list] = Field(default=None, description="Returned columns") error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) + explain: Optional[list[str]] = Field(default=None, description="Query explanation output") hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - is_cached: bool - last_refresh: AwareDatetime limit: Optional[int] = None + metadata: Optional[HogQLMetadataResponse] = Field(default=None, description="Query metadata output") modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - next_allowed_client_refresh: AwareDatetime offset: Optional[int] = None + query: Optional[str] = Field(default=None, description="Input query string") query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) results: list - samplingRate: Optional[SamplingRate] = None - timezone: str timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) - types: Optional[list] = None + types: Optional[list] = Field(default=None, description="Types of returned columns") -class CachedWebGoalsQueryResponse(BaseModel): +class InsightActorsQueryBase(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + includeRecordings: Optional[bool] = None + kind: NodeKind + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" + ) + response: Optional[ActorsQueryResponse] = None + + +class LifecycleQueryResponse(BaseModel): + model_config = ConfigDict( + extra="forbid", ) - columns: Optional[list] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - is_cached: bool - last_refresh: AwareDatetime - limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - next_allowed_client_refresh: AwareDatetime - offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list - samplingRate: Optional[SamplingRate] = None - timezone: str + results: list[dict[str, Any]] timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) - types: Optional[list] = None -class CachedWebOverviewQueryResponse(BaseModel): +class MultipleBreakdownOptions(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + values: list[BreakdownItem] + + +class PathsQueryResponse(BaseModel): + model_config = ConfigDict( + extra="forbid", ) - dateFrom: Optional[str] = None - dateTo: Optional[str] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - is_cached: bool - last_refresh: AwareDatetime modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - next_allowed_client_refresh: AwareDatetime query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[WebOverviewItem] - samplingRate: Optional[SamplingRate] = None - timezone: str + results: list[dict[str, Any]] timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) -class CachedWebStatsTableQueryResponse(BaseModel): +class PersonsNode(BaseModel): model_config = ConfigDict( extra="forbid", ) - cache_key: str - cache_target_age: Optional[AwareDatetime] = None - calculation_trigger: Optional[str] = Field( - default=None, description="What triggered the calculation of the query, leave empty if user/immediate" - ) - columns: Optional[list] = None - error: Optional[str] = Field( + cohort: Optional[int] = None + distinctId: Optional[str] = None + fixedProperties: Optional[ + list[ + Union[ + EventPropertyFilter, + PersonPropertyFilter, + ElementPropertyFilter, + SessionPropertyFilter, + CohortPropertyFilter, + RecordingPropertyFilter, + LogEntryPropertyFilter, + GroupPropertyFilter, + FeaturePropertyFilter, + HogQLPropertyFilter, + EmptyPropertyFilter, + DataWarehousePropertyFilter, + DataWarehousePersonPropertyFilter, + ] + ] + ] = Field( default=None, - description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", - ) - hasMore: Optional[bool] = None - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - is_cached: bool - last_refresh: AwareDatetime - limit: Optional[int] = None - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" - ) - next_allowed_client_refresh: AwareDatetime - offset: Optional[int] = None - query_status: Optional[QueryStatus] = Field( - default=None, description="Query status indicates whether next to the provided data, a query is still running." + description="Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)", ) - results: list - samplingRate: Optional[SamplingRate] = None - timezone: str - timings: Optional[list[QueryTiming]] = Field( - default=None, description="Measured timings for different parts of the query generation process" + kind: Literal["PersonsNode"] = "PersonsNode" + limit: Optional[int] = None + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" ) - types: Optional[list] = None + offset: Optional[int] = None + properties: Optional[ + list[ + Union[ + EventPropertyFilter, + PersonPropertyFilter, + ElementPropertyFilter, + SessionPropertyFilter, + CohortPropertyFilter, + RecordingPropertyFilter, + LogEntryPropertyFilter, + GroupPropertyFilter, + FeaturePropertyFilter, + HogQLPropertyFilter, + EmptyPropertyFilter, + DataWarehousePropertyFilter, + DataWarehousePersonPropertyFilter, + ] + ] + ] = Field(default=None, description="Properties configurable in the interface") + response: Optional[dict[str, Any]] = None + search: Optional[str] = None -class DashboardFilter(BaseModel): +class PropertyGroupFilterValue(BaseModel): model_config = ConfigDict( extra="forbid", ) - date_from: Optional[str] = None - date_to: Optional[str] = None - properties: Optional[ - list[ + type: FilterLogicalOperator + values: list[ + Union[ + PropertyGroupFilterValue, Union[ EventPropertyFilter, PersonPropertyFilter, @@ -4456,12 +4583,12 @@ class DashboardFilter(BaseModel): EmptyPropertyFilter, DataWarehousePropertyFilter, DataWarehousePersonPropertyFilter, - ] + ], ] - ] = None + ] -class Response(BaseModel): +class QueryResponseAlternative1(BaseModel): model_config = ConfigDict( extra="forbid", ) @@ -4487,7 +4614,7 @@ class Response(BaseModel): types: list[str] -class Response1(BaseModel): +class QueryResponseAlternative2(BaseModel): model_config = ConfigDict( extra="forbid", ) @@ -4514,7 +4641,42 @@ class Response1(BaseModel): types: list[str] -class Response2(BaseModel): +class QueryResponseAlternative3(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + breakdown: Optional[list[BreakdownItem]] = None + breakdowns: Optional[list[MultipleBreakdownOptions]] = None + compare: Optional[list[CompareItem]] = None + day: Optional[list[DayItem]] = None + interval: Optional[list[IntervalItem]] = None + series: Optional[list[Series]] = None + status: Optional[list[StatusItem]] = None + + +class QueryResponseAlternative4(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + error: Optional[str] = Field( + default=None, + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", + ) + hasMore: Optional[bool] = None + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" + ) + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." + ) + results: list[TimelineEntry] + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" + ) + + +class QueryResponseAlternative6(BaseModel): model_config = ConfigDict( extra="forbid", ) @@ -4544,7 +4706,7 @@ class Response2(BaseModel): types: Optional[list] = Field(default=None, description="Types of returned columns") -class Response3(BaseModel): +class QueryResponseAlternative9(BaseModel): model_config = ConfigDict( extra="forbid", ) @@ -4568,7 +4730,7 @@ class Response3(BaseModel): ) -class Response4(BaseModel): +class QueryResponseAlternative10(BaseModel): model_config = ConfigDict( extra="forbid", ) @@ -4595,7 +4757,7 @@ class Response4(BaseModel): types: Optional[list] = None -class Response7(BaseModel): +class QueryResponseAlternative13(BaseModel): model_config = ConfigDict( extra="forbid", ) @@ -4621,7 +4783,7 @@ class Response7(BaseModel): types: Optional[list] = None -class Response8(BaseModel): +class QueryResponseAlternative14(BaseModel): model_config = ConfigDict( extra="forbid", ) @@ -4646,290 +4808,124 @@ class Response8(BaseModel): ) -class DataWarehouseNode(BaseModel): +class QueryResponseAlternative17(BaseModel): model_config = ConfigDict( extra="forbid", ) - custom_name: Optional[str] = None - distinct_id_field: str - fixedProperties: Optional[ - list[ - Union[ - EventPropertyFilter, - PersonPropertyFilter, - ElementPropertyFilter, - SessionPropertyFilter, - CohortPropertyFilter, - RecordingPropertyFilter, - LogEntryPropertyFilter, - GroupPropertyFilter, - FeaturePropertyFilter, - HogQLPropertyFilter, - EmptyPropertyFilter, - DataWarehousePropertyFilter, - DataWarehousePersonPropertyFilter, - ] - ] - ] = Field( + columns: list + error: Optional[str] = Field( default=None, - description="Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)", - ) - id: str - id_field: str - kind: Literal["DataWarehouseNode"] = "DataWarehouseNode" - math: Optional[ - Union[ - BaseMathType, - FunnelMathType, - PropertyMathType, - CountPerActorMathType, - Literal["unique_group"], - Literal["hogql"], - ] - ] = None - math_group_type_index: Optional[MathGroupTypeIndex] = None - math_hogql: Optional[str] = None - math_property: Optional[str] = None - math_property_type: Optional[str] = None - name: Optional[str] = None - properties: Optional[ - list[ - Union[ - EventPropertyFilter, - PersonPropertyFilter, - ElementPropertyFilter, - SessionPropertyFilter, - CohortPropertyFilter, - RecordingPropertyFilter, - LogEntryPropertyFilter, - GroupPropertyFilter, - FeaturePropertyFilter, - HogQLPropertyFilter, - EmptyPropertyFilter, - DataWarehousePropertyFilter, - DataWarehousePersonPropertyFilter, - ] - ] - ] = Field(default=None, description="Properties configurable in the interface") - response: Optional[dict[str, Any]] = None - table_name: str - timestamp_field: str - - -class DatabaseSchemaBatchExportTable(BaseModel): - model_config = ConfigDict( - extra="forbid", + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - fields: dict[str, DatabaseSchemaField] - id: str - name: str - type: Literal["batch_export"] = "batch_export" - - -class DatabaseSchemaDataWarehouseTable(BaseModel): - model_config = ConfigDict( - extra="forbid", + hasMore: Optional[bool] = None + hogql: str = Field(..., description="Generated HogQL query.") + limit: Optional[int] = None + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" ) - fields: dict[str, DatabaseSchemaField] - format: str - id: str - name: str - schema_: Optional[DatabaseSchemaSchema] = Field(default=None, alias="schema") - source: Optional[DatabaseSchemaSource] = None - type: Literal["data_warehouse"] = "data_warehouse" - url_pattern: str - - -class EntityNode(BaseModel): - model_config = ConfigDict( - extra="forbid", + offset: Optional[int] = None + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - custom_name: Optional[str] = None - fixedProperties: Optional[ - list[ - Union[ - EventPropertyFilter, - PersonPropertyFilter, - ElementPropertyFilter, - SessionPropertyFilter, - CohortPropertyFilter, - RecordingPropertyFilter, - LogEntryPropertyFilter, - GroupPropertyFilter, - FeaturePropertyFilter, - HogQLPropertyFilter, - EmptyPropertyFilter, - DataWarehousePropertyFilter, - DataWarehousePersonPropertyFilter, - ] - ] - ] = Field( - default=None, - description="Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)", + results: list[list] + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" ) - kind: NodeKind - math: Optional[ - Union[ - BaseMathType, - FunnelMathType, - PropertyMathType, - CountPerActorMathType, - Literal["unique_group"], - Literal["hogql"], - ] - ] = None - math_group_type_index: Optional[MathGroupTypeIndex] = None - math_hogql: Optional[str] = None - math_property: Optional[str] = None - math_property_type: Optional[str] = None - name: Optional[str] = None - properties: Optional[ - list[ - Union[ - EventPropertyFilter, - PersonPropertyFilter, - ElementPropertyFilter, - SessionPropertyFilter, - CohortPropertyFilter, - RecordingPropertyFilter, - LogEntryPropertyFilter, - GroupPropertyFilter, - FeaturePropertyFilter, - HogQLPropertyFilter, - EmptyPropertyFilter, - DataWarehousePropertyFilter, - DataWarehousePersonPropertyFilter, - ] - ] - ] = Field(default=None, description="Properties configurable in the interface") - response: Optional[dict[str, Any]] = None + types: list[str] -class ErrorTrackingQueryResponse(BaseModel): +class QueryResponseAlternative18(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: Optional[list[str]] = None + columns: list error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) hasMore: Optional[bool] = None - hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - limit: Optional[int] = None + hogql: str = Field(..., description="Generated HogQL query.") + limit: int + missing_actors_count: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - offset: Optional[int] = None + offset: int query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[ErrorTrackingIssue] + results: list[list] timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) + types: list[str] -class EventTaxonomyQueryResponse(BaseModel): +class QueryResponseAlternative19(BaseModel): model_config = ConfigDict( extra="forbid", ) + clickhouse: Optional[str] = Field(default=None, description="Executed ClickHouse query") + columns: Optional[list] = Field(default=None, description="Returned columns") error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) + explain: Optional[list[str]] = Field(default=None, description="Query explanation output") + hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + limit: Optional[int] = None + metadata: Optional[HogQLMetadataResponse] = Field(default=None, description="Query metadata output") modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) + offset: Optional[int] = None + query: Optional[str] = Field(default=None, description="Input query string") query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[EventTaxonomyItem] + results: list timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) + types: Optional[list] = Field(default=None, description="Types of returned columns") -class EventsNode(BaseModel): +class QueryResponseAlternative20(BaseModel): model_config = ConfigDict( extra="forbid", ) - custom_name: Optional[str] = None - event: Optional[str] = Field(default=None, description="The event or `null` for all events.") - fixedProperties: Optional[ - list[ - Union[ - EventPropertyFilter, - PersonPropertyFilter, - ElementPropertyFilter, - SessionPropertyFilter, - CohortPropertyFilter, - RecordingPropertyFilter, - LogEntryPropertyFilter, - GroupPropertyFilter, - FeaturePropertyFilter, - HogQLPropertyFilter, - EmptyPropertyFilter, - DataWarehousePropertyFilter, - DataWarehousePersonPropertyFilter, - ] - ] - ] = Field( + dateFrom: Optional[str] = None + dateTo: Optional[str] = None + error: Optional[str] = Field( default=None, - description="Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)", + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", + ) + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" + ) + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." + ) + results: list[WebOverviewItem] + samplingRate: Optional[SamplingRate] = None + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" ) - kind: Literal["EventsNode"] = "EventsNode" - limit: Optional[int] = None - math: Optional[ - Union[ - BaseMathType, - FunnelMathType, - PropertyMathType, - CountPerActorMathType, - Literal["unique_group"], - Literal["hogql"], - ] - ] = None - math_group_type_index: Optional[MathGroupTypeIndex] = None - math_hogql: Optional[str] = None - math_property: Optional[str] = None - math_property_type: Optional[str] = None - name: Optional[str] = None - orderBy: Optional[list[str]] = Field(default=None, description="Columns to order by") - properties: Optional[ - list[ - Union[ - EventPropertyFilter, - PersonPropertyFilter, - ElementPropertyFilter, - SessionPropertyFilter, - CohortPropertyFilter, - RecordingPropertyFilter, - LogEntryPropertyFilter, - GroupPropertyFilter, - FeaturePropertyFilter, - HogQLPropertyFilter, - EmptyPropertyFilter, - DataWarehousePropertyFilter, - DataWarehousePersonPropertyFilter, - ] - ] - ] = Field(default=None, description="Properties configurable in the interface") - response: Optional[dict[str, Any]] = None -class EventsQueryResponse(BaseModel): +class QueryResponseAlternative21(BaseModel): model_config = ConfigDict( extra="forbid", ) - columns: list + columns: Optional[list] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) hasMore: Optional[bool] = None - hogql: str = Field(..., description="Generated HogQL query.") + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" @@ -4938,14 +4934,15 @@ class EventsQueryResponse(BaseModel): query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[list] + results: list + samplingRate: Optional[SamplingRate] = None timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) - types: list[str] + types: Optional[list] = None -class FunnelCorrelationResponse(BaseModel): +class QueryResponseAlternative24(BaseModel): model_config = ConfigDict( extra="forbid", ) @@ -4964,335 +4961,133 @@ class FunnelCorrelationResponse(BaseModel): query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: FunnelCorrelationResult + results: Any timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) types: Optional[list] = None -class FunnelExclusionActionsNode(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - custom_name: Optional[str] = None - fixedProperties: Optional[ - list[ - Union[ - EventPropertyFilter, - PersonPropertyFilter, - ElementPropertyFilter, - SessionPropertyFilter, - CohortPropertyFilter, - RecordingPropertyFilter, - LogEntryPropertyFilter, - GroupPropertyFilter, - FeaturePropertyFilter, - HogQLPropertyFilter, - EmptyPropertyFilter, - DataWarehousePropertyFilter, - DataWarehousePersonPropertyFilter, - ] - ] - ] = Field( - default=None, - description="Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)", - ) - funnelFromStep: int - funnelToStep: int - id: int - kind: Literal["ActionsNode"] = "ActionsNode" - math: Optional[ - Union[ - BaseMathType, - FunnelMathType, - PropertyMathType, - CountPerActorMathType, - Literal["unique_group"], - Literal["hogql"], - ] - ] = None - math_group_type_index: Optional[MathGroupTypeIndex] = None - math_hogql: Optional[str] = None - math_property: Optional[str] = None - math_property_type: Optional[str] = None - name: Optional[str] = None - properties: Optional[ - list[ - Union[ - EventPropertyFilter, - PersonPropertyFilter, - ElementPropertyFilter, - SessionPropertyFilter, - CohortPropertyFilter, - RecordingPropertyFilter, - LogEntryPropertyFilter, - GroupPropertyFilter, - FeaturePropertyFilter, - HogQLPropertyFilter, - EmptyPropertyFilter, - DataWarehousePropertyFilter, - DataWarehousePersonPropertyFilter, - ] - ] - ] = Field(default=None, description="Properties configurable in the interface") - response: Optional[dict[str, Any]] = None - - -class FunnelExclusionEventsNode(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - custom_name: Optional[str] = None - event: Optional[str] = Field(default=None, description="The event or `null` for all events.") - fixedProperties: Optional[ - list[ - Union[ - EventPropertyFilter, - PersonPropertyFilter, - ElementPropertyFilter, - SessionPropertyFilter, - CohortPropertyFilter, - RecordingPropertyFilter, - LogEntryPropertyFilter, - GroupPropertyFilter, - FeaturePropertyFilter, - HogQLPropertyFilter, - EmptyPropertyFilter, - DataWarehousePropertyFilter, - DataWarehousePersonPropertyFilter, - ] - ] - ] = Field( - default=None, - description="Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)", - ) - funnelFromStep: int - funnelToStep: int - kind: Literal["EventsNode"] = "EventsNode" - limit: Optional[int] = None - math: Optional[ - Union[ - BaseMathType, - FunnelMathType, - PropertyMathType, - CountPerActorMathType, - Literal["unique_group"], - Literal["hogql"], - ] - ] = None - math_group_type_index: Optional[MathGroupTypeIndex] = None - math_hogql: Optional[str] = None - math_property: Optional[str] = None - math_property_type: Optional[str] = None - name: Optional[str] = None - orderBy: Optional[list[str]] = Field(default=None, description="Columns to order by") - properties: Optional[ - list[ - Union[ - EventPropertyFilter, - PersonPropertyFilter, - ElementPropertyFilter, - SessionPropertyFilter, - CohortPropertyFilter, - RecordingPropertyFilter, - LogEntryPropertyFilter, - GroupPropertyFilter, - FeaturePropertyFilter, - HogQLPropertyFilter, - EmptyPropertyFilter, - DataWarehousePropertyFilter, - DataWarehousePersonPropertyFilter, - ] - ] - ] = Field(default=None, description="Properties configurable in the interface") - response: Optional[dict[str, Any]] = None - - -class FunnelsQueryResponse(BaseModel): +class QueryResponseAlternative25(BaseModel): model_config = ConfigDict( extra="forbid", ) + columns: Optional[list[str]] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) + hasMore: Optional[bool] = None hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") - isUdf: Optional[bool] = None + limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) + offset: Optional[int] = None query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: Union[FunnelTimeToConvertResults, list[dict[str, Any]], list[list[dict[str, Any]]]] + results: list[ErrorTrackingIssue] timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) -class HogQLFilters(BaseModel): +class QueryResponseAlternative28(BaseModel): model_config = ConfigDict( extra="forbid", ) - dateRange: Optional[DateRange] = None - filterTestAccounts: Optional[bool] = None - properties: Optional[ - list[ - Union[ - EventPropertyFilter, - PersonPropertyFilter, - ElementPropertyFilter, - SessionPropertyFilter, - CohortPropertyFilter, - RecordingPropertyFilter, - LogEntryPropertyFilter, - GroupPropertyFilter, - FeaturePropertyFilter, - HogQLPropertyFilter, - EmptyPropertyFilter, - DataWarehousePropertyFilter, - DataWarehousePersonPropertyFilter, - ] - ] - ] = None - - -class HogQLQuery(BaseModel): - model_config = ConfigDict( - extra="forbid", + error: Optional[str] = Field( + default=None, + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - explain: Optional[bool] = None - filters: Optional[HogQLFilters] = None - kind: Literal["HogQLQuery"] = "HogQLQuery" + hasMore: Optional[bool] = Field(default=None, description="Wether more breakdown values are available.") + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - query: str - response: Optional[HogQLQueryResponse] = None - values: Optional[dict[str, Any]] = Field( - default=None, description="Constant values that can be referenced with the {placeholder} syntax in the query" + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - variables: Optional[dict[str, HogQLVariable]] = Field( - default=None, description="Variables to be subsituted into the query" + results: list[dict[str, Any]] + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" ) -class InsightActorsQueryBase(BaseModel): +class QueryResponseAlternative29(BaseModel): model_config = ConfigDict( extra="forbid", ) - includeRecordings: Optional[bool] = None - kind: NodeKind + error: Optional[str] = Field( + default=None, + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", + ) + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + isUdf: Optional[bool] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - response: Optional[ActorsQueryResponse] = None + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." + ) + results: Union[FunnelTimeToConvertResults, list[dict[str, Any]], list[list[dict[str, Any]]]] + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" + ) -class InsightActorsQueryOptionsResponse(BaseModel): +class QueryResponseAlternative31(BaseModel): model_config = ConfigDict( extra="forbid", ) - breakdown: Optional[list[BreakdownItem]] = None - breakdowns: Optional[list[MultipleBreakdownOptions]] = None - compare: Optional[list[CompareItem]] = None - day: Optional[list[DayItem]] = None - interval: Optional[list[IntervalItem]] = None - series: Optional[list[Series]] = None - status: Optional[list[StatusItem]] = None + error: Optional[str] = Field( + default=None, + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", + ) + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" + ) + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." + ) + results: list[dict[str, Any]] + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" + ) -class PersonsNode(BaseModel): +class QueryResponseAlternative34(BaseModel): model_config = ConfigDict( extra="forbid", ) - cohort: Optional[int] = None - distinctId: Optional[str] = None - fixedProperties: Optional[ - list[ - Union[ - EventPropertyFilter, - PersonPropertyFilter, - ElementPropertyFilter, - SessionPropertyFilter, - CohortPropertyFilter, - RecordingPropertyFilter, - LogEntryPropertyFilter, - GroupPropertyFilter, - FeaturePropertyFilter, - HogQLPropertyFilter, - EmptyPropertyFilter, - DataWarehousePropertyFilter, - DataWarehousePersonPropertyFilter, - ] - ] - ] = Field( + columns: Optional[list] = None + error: Optional[str] = Field( default=None, - description="Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)", + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - kind: Literal["PersonsNode"] = "PersonsNode" + hasMore: Optional[bool] = None + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") limit: Optional[int] = None modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) offset: Optional[int] = None - properties: Optional[ - list[ - Union[ - EventPropertyFilter, - PersonPropertyFilter, - ElementPropertyFilter, - SessionPropertyFilter, - CohortPropertyFilter, - RecordingPropertyFilter, - LogEntryPropertyFilter, - GroupPropertyFilter, - FeaturePropertyFilter, - HogQLPropertyFilter, - EmptyPropertyFilter, - DataWarehousePropertyFilter, - DataWarehousePersonPropertyFilter, - ] - ] - ] = Field(default=None, description="Properties configurable in the interface") - response: Optional[dict[str, Any]] = None - search: Optional[str] = None - - -class PropertyGroupFilterValue(BaseModel): - model_config = ConfigDict( - extra="forbid", + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - type: FilterLogicalOperator - values: list[ - Union[ - PropertyGroupFilterValue, - Union[ - EventPropertyFilter, - PersonPropertyFilter, - ElementPropertyFilter, - SessionPropertyFilter, - CohortPropertyFilter, - RecordingPropertyFilter, - LogEntryPropertyFilter, - GroupPropertyFilter, - FeaturePropertyFilter, - HogQLPropertyFilter, - EmptyPropertyFilter, - DataWarehousePropertyFilter, - DataWarehousePersonPropertyFilter, - ], - ] - ] + results: FunnelCorrelationResult + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" + ) + types: Optional[list] = None -class QueryResponseAlternative9(BaseModel): +class QueryResponseAlternative37(BaseModel): model_config = ConfigDict( extra="forbid", ) - dateFrom: Optional[str] = None - dateTo: Optional[str] = None error: Optional[str] = Field( default=None, description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", @@ -5304,14 +5099,13 @@ class QueryResponseAlternative9(BaseModel): query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[WebOverviewItem] - samplingRate: Optional[SamplingRate] = None + results: list[TeamTaxonomyItem] timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) -class QueryResponseAlternative30(BaseModel): +class QueryResponseAlternative38(BaseModel): model_config = ConfigDict( extra="forbid", ) @@ -5326,21 +5120,13 @@ class QueryResponseAlternative30(BaseModel): query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[RetentionResult] + results: list[EventTaxonomyItem] timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) -class RecordingsQueryResponse(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - has_next: bool - results: list[SessionRecordingType] - - -class RetentionQueryResponse(BaseModel): +class QueryResponseAlternative39(BaseModel): model_config = ConfigDict( extra="forbid", ) @@ -5355,12 +5141,29 @@ class RetentionQueryResponse(BaseModel): query_status: Optional[QueryStatus] = Field( default=None, description="Query status indicates whether next to the provided data, a query is still running." ) - results: list[RetentionResult] + results: ActorsPropertyTaxonomyResponse timings: Optional[list[QueryTiming]] = Field( default=None, description="Measured timings for different parts of the query generation process" ) +class RecordingsQueryResponse(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + has_next: bool + results: list[SessionRecordingType] + + +class RetentionResult(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + date: AwareDatetime + label: str + values: list[RetentionValue] + + class SessionAttributionExplorerQuery(BaseModel): model_config = ConfigDict( extra="forbid", @@ -5394,15 +5197,25 @@ class SessionsTimelineQuery(BaseModel): response: Optional[SessionsTimelineQueryResponse] = None -class TeamTaxonomyQuery(BaseModel): +class TeamTaxonomyQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - kind: Literal["TeamTaxonomyQuery"] = "TeamTaxonomyQuery" + error: Optional[str] = Field( + default=None, + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", + ) + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - response: Optional[TeamTaxonomyQueryResponse] = None + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." + ) + results: list[TeamTaxonomyItem] + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" + ) class VisualizationMessage(BaseModel): @@ -5602,39 +5415,128 @@ class AnyResponseType( ] -class DataVisualizationNode(BaseModel): +class CachedHogQLQueryResponse(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + ) + clickhouse: Optional[str] = Field(default=None, description="Executed ClickHouse query") + columns: Optional[list] = Field(default=None, description="Returned columns") + error: Optional[str] = Field( + default=None, + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", + ) + explain: Optional[list[str]] = Field(default=None, description="Query explanation output") + hasMore: Optional[bool] = None + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + is_cached: bool + last_refresh: AwareDatetime + limit: Optional[int] = None + metadata: Optional[HogQLMetadataResponse] = Field(default=None, description="Query metadata output") + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" + ) + next_allowed_client_refresh: AwareDatetime + offset: Optional[int] = None + query: Optional[str] = Field(default=None, description="Input query string") + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." + ) + results: list + timezone: str + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" + ) + types: Optional[list] = Field(default=None, description="Types of returned columns") + + +class CachedInsightActorsQueryOptionsResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - chartSettings: Optional[ChartSettings] = None - display: Optional[ChartDisplayType] = None - kind: Literal["DataVisualizationNode"] = "DataVisualizationNode" - source: HogQLQuery - tableSettings: Optional[TableSettings] = None + breakdown: Optional[list[BreakdownItem]] = None + breakdowns: Optional[list[MultipleBreakdownOptions]] = None + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + ) + compare: Optional[list[CompareItem]] = None + day: Optional[list[DayItem]] = None + interval: Optional[list[IntervalItem]] = None + is_cached: bool + last_refresh: AwareDatetime + next_allowed_client_refresh: AwareDatetime + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." + ) + series: Optional[list[Series]] = None + status: Optional[list[StatusItem]] = None + timezone: str -class DatabaseSchemaMaterializedViewTable(BaseModel): +class CachedRetentionQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - fields: dict[str, DatabaseSchemaField] - id: str - last_run_at: Optional[str] = None - name: str - query: HogQLQuery - status: Optional[str] = None - type: Literal["materialized_view"] = "materialized_view" + cache_key: str + cache_target_age: Optional[AwareDatetime] = None + calculation_trigger: Optional[str] = Field( + default=None, description="What triggered the calculation of the query, leave empty if user/immediate" + ) + error: Optional[str] = Field( + default=None, + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", + ) + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + is_cached: bool + last_refresh: AwareDatetime + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" + ) + next_allowed_client_refresh: AwareDatetime + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." + ) + results: list[RetentionResult] + timezone: str + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" + ) -class DatabaseSchemaViewTable(BaseModel): +class Response2(BaseModel): model_config = ConfigDict( extra="forbid", ) - fields: dict[str, DatabaseSchemaField] - id: str - name: str - query: HogQLQuery - type: Literal["view"] = "view" + clickhouse: Optional[str] = Field(default=None, description="Executed ClickHouse query") + columns: Optional[list] = Field(default=None, description="Returned columns") + error: Optional[str] = Field( + default=None, + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", + ) + explain: Optional[list[str]] = Field(default=None, description="Query explanation output") + hasMore: Optional[bool] = None + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + limit: Optional[int] = None + metadata: Optional[HogQLMetadataResponse] = Field(default=None, description="Query metadata output") + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" + ) + offset: Optional[int] = None + query: Optional[str] = Field(default=None, description="Input query string") + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." + ) + results: list + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" + ) + types: Optional[list] = Field(default=None, description="Types of returned columns") class EventTaxonomyQuery(BaseModel): @@ -5674,6 +5576,39 @@ class FunnelsFilter(BaseModel): useUdf: Optional[bool] = None +class HogQLQuery(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + explain: Optional[bool] = None + filters: Optional[HogQLFilters] = None + kind: Literal["HogQLQuery"] = "HogQLQuery" + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" + ) + query: str + response: Optional[HogQLQueryResponse] = None + values: Optional[dict[str, Any]] = Field( + default=None, description="Constant values that can be referenced with the {placeholder} syntax in the query" + ) + variables: Optional[dict[str, HogQLVariable]] = Field( + default=None, description="Variables to be subsituted into the query" + ) + + +class InsightActorsQueryOptionsResponse(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + breakdown: Optional[list[BreakdownItem]] = None + breakdowns: Optional[list[MultipleBreakdownOptions]] = None + compare: Optional[list[CompareItem]] = None + day: Optional[list[DayItem]] = None + interval: Optional[list[IntervalItem]] = None + series: Optional[list[Series]] = None + status: Optional[list[StatusItem]] = None + + class InsightFilter( RootModel[Union[TrendsFilter, FunnelsFilter, RetentionFilter, PathsFilter, StickinessFilter, LifecycleFilter]] ): @@ -5688,6 +5623,27 @@ class PropertyGroupFilter(BaseModel): values: list[PropertyGroupFilterValue] +class QueryResponseAlternative30(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + error: Optional[str] = Field( + default=None, + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", + ) + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" + ) + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." + ) + results: list[RetentionResult] + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" + ) + + class RecordingsQuery(BaseModel): model_config = ConfigDict( extra="forbid", @@ -5750,45 +5706,25 @@ class RecordingsQuery(BaseModel): user_modified_filters: Optional[dict[str, Any]] = None -class RetentionQuery(BaseModel): +class RetentionQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", ) - aggregation_group_type_index: Optional[int] = Field(default=None, description="Groups aggregation") - dataColorTheme: Optional[float] = Field(default=None, description="Colors used in the insight's visualization") - dateRange: Optional[DateRange] = Field(default=None, description="Date range for the query") - filterTestAccounts: Optional[bool] = Field( - default=False, description="Exclude internal and test users by applying the respective filters" + error: Optional[str] = Field( + default=None, + description="Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.", ) - kind: Literal["RetentionQuery"] = "RetentionQuery" + hogql: Optional[str] = Field(default=None, description="Generated HogQL query.") modifiers: Optional[HogQLQueryModifiers] = Field( default=None, description="Modifiers used when performing the query" ) - properties: Optional[ - Union[ - list[ - Union[ - EventPropertyFilter, - PersonPropertyFilter, - ElementPropertyFilter, - SessionPropertyFilter, - CohortPropertyFilter, - RecordingPropertyFilter, - LogEntryPropertyFilter, - GroupPropertyFilter, - FeaturePropertyFilter, - HogQLPropertyFilter, - EmptyPropertyFilter, - DataWarehousePropertyFilter, - DataWarehousePersonPropertyFilter, - ] - ], - PropertyGroupFilter, - ] - ] = Field(default=[], description="Property filters for all series") - response: Optional[RetentionQueryResponse] = None - retentionFilter: RetentionFilter = Field(..., description="Properties specific to the retention insight") - samplingFactor: Optional[float] = Field(default=None, description="Sampling rate") + query_status: Optional[QueryStatus] = Field( + default=None, description="Query status indicates whether next to the provided data, a query is still running." + ) + results: list[RetentionResult] + timings: Optional[list[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" + ) class RootAssistantMessage( @@ -5849,6 +5785,17 @@ class StickinessQuery(BaseModel): ) +class TeamTaxonomyQuery(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + kind: Literal["TeamTaxonomyQuery"] = "TeamTaxonomyQuery" + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" + ) + response: Optional[TeamTaxonomyQueryResponse] = None + + class TrendsQuery(BaseModel): model_config = ConfigDict( extra="forbid", @@ -5948,6 +5895,41 @@ class Response10(BaseModel): variants: list[ExperimentVariantTrendsBaseStats] +class DataVisualizationNode(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + chartSettings: Optional[ChartSettings] = None + display: Optional[ChartDisplayType] = None + kind: Literal["DataVisualizationNode"] = "DataVisualizationNode" + source: HogQLQuery + tableSettings: Optional[TableSettings] = None + + +class DatabaseSchemaMaterializedViewTable(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + fields: dict[str, DatabaseSchemaField] + id: str + last_run_at: Optional[str] = None + name: str + query: HogQLQuery + status: Optional[str] = None + type: Literal["materialized_view"] = "materialized_view" + + +class DatabaseSchemaViewTable(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + fields: dict[str, DatabaseSchemaField] + id: str + name: str + query: HogQLQuery + type: Literal["view"] = "view" + + class ErrorTrackingQuery(BaseModel): model_config = ConfigDict( extra="forbid", @@ -6423,98 +6405,45 @@ class QueryResponseAlternative27(BaseModel): variants: list[ExperimentVariantTrendsBaseStats] -class QueryResponseAlternative35(BaseModel): +class RetentionQuery(BaseModel): model_config = ConfigDict( extra="forbid", ) - tables: dict[ - str, - Union[ - DatabaseSchemaPostHogTable, - DatabaseSchemaDataWarehouseTable, - DatabaseSchemaViewTable, - DatabaseSchemaBatchExportTable, - DatabaseSchemaMaterializedViewTable, - ], - ] - - -class QueryResponseAlternative( - RootModel[ + aggregation_group_type_index: Optional[int] = Field(default=None, description="Groups aggregation") + dataColorTheme: Optional[float] = Field(default=None, description="Colors used in the insight's visualization") + dateRange: Optional[DateRange] = Field(default=None, description="Date range for the query") + filterTestAccounts: Optional[bool] = Field( + default=False, description="Exclude internal and test users by applying the respective filters" + ) + kind: Literal["RetentionQuery"] = "RetentionQuery" + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" + ) + properties: Optional[ Union[ - dict[str, Any], - QueryResponseAlternative1, - QueryResponseAlternative2, - QueryResponseAlternative3, - QueryResponseAlternative4, - QueryResponseAlternative5, - QueryResponseAlternative6, - QueryResponseAlternative7, - QueryResponseAlternative8, - QueryResponseAlternative9, - QueryResponseAlternative10, - QueryResponseAlternative13, - QueryResponseAlternative14, - QueryResponseAlternative15, - QueryResponseAlternative16, - Any, - QueryResponseAlternative17, - QueryResponseAlternative18, - QueryResponseAlternative19, - QueryResponseAlternative21, - QueryResponseAlternative24, - QueryResponseAlternative25, - QueryResponseAlternative26, - QueryResponseAlternative27, - QueryResponseAlternative28, - QueryResponseAlternative29, - QueryResponseAlternative30, - QueryResponseAlternative31, - QueryResponseAlternative34, - QueryResponseAlternative35, - QueryResponseAlternative36, - QueryResponseAlternative37, - QueryResponseAlternative38, - QueryResponseAlternative39, + list[ + Union[ + EventPropertyFilter, + PersonPropertyFilter, + ElementPropertyFilter, + SessionPropertyFilter, + CohortPropertyFilter, + RecordingPropertyFilter, + LogEntryPropertyFilter, + GroupPropertyFilter, + FeaturePropertyFilter, + HogQLPropertyFilter, + EmptyPropertyFilter, + DataWarehousePropertyFilter, + DataWarehousePersonPropertyFilter, + ] + ], + PropertyGroupFilter, ] - ] -): - root: Union[ - dict[str, Any], - QueryResponseAlternative1, - QueryResponseAlternative2, - QueryResponseAlternative3, - QueryResponseAlternative4, - QueryResponseAlternative5, - QueryResponseAlternative6, - QueryResponseAlternative7, - QueryResponseAlternative8, - QueryResponseAlternative9, - QueryResponseAlternative10, - QueryResponseAlternative13, - QueryResponseAlternative14, - QueryResponseAlternative15, - QueryResponseAlternative16, - Any, - QueryResponseAlternative17, - QueryResponseAlternative18, - QueryResponseAlternative19, - QueryResponseAlternative21, - QueryResponseAlternative24, - QueryResponseAlternative25, - QueryResponseAlternative26, - QueryResponseAlternative27, - QueryResponseAlternative28, - QueryResponseAlternative29, - QueryResponseAlternative30, - QueryResponseAlternative31, - QueryResponseAlternative34, - QueryResponseAlternative35, - QueryResponseAlternative36, - QueryResponseAlternative37, - QueryResponseAlternative38, - QueryResponseAlternative39, - ] + ] = Field(default=[], description="Property filters for all series") + response: Optional[RetentionQueryResponse] = None + retentionFilter: RetentionFilter = Field(..., description="Properties specific to the retention insight") + samplingFactor: Optional[float] = Field(default=None, description="Sampling rate") class CachedExperimentFunnelsQueryResponse(BaseModel): @@ -6561,22 +6490,6 @@ class Response9(BaseModel): variants: list[ExperimentVariantFunnelsBaseStats] -class DatabaseSchemaQueryResponse(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - tables: dict[ - str, - Union[ - DatabaseSchemaPostHogTable, - DatabaseSchemaDataWarehouseTable, - DatabaseSchemaViewTable, - DatabaseSchemaBatchExportTable, - DatabaseSchemaMaterializedViewTable, - ], - ] - - class ExperimentFunnelsQueryResponse(BaseModel): model_config = ConfigDict( extra="forbid", @@ -6700,15 +6613,116 @@ class PathsQuery(BaseModel): samplingFactor: Optional[float] = Field(default=None, description="Sampling rate") -class DatabaseSchemaQuery(BaseModel): +class QueryResponseAlternative35(BaseModel): model_config = ConfigDict( extra="forbid", ) - kind: Literal["DatabaseSchemaQuery"] = "DatabaseSchemaQuery" - modifiers: Optional[HogQLQueryModifiers] = Field( - default=None, description="Modifiers used when performing the query" + tables: dict[ + str, + Union[ + DatabaseSchemaPostHogTable, + DatabaseSchemaDataWarehouseTable, + DatabaseSchemaViewTable, + DatabaseSchemaBatchExportTable, + DatabaseSchemaMaterializedViewTable, + ], + ] + + +class QueryResponseAlternative( + RootModel[ + Union[ + dict[str, Any], + QueryResponseAlternative1, + QueryResponseAlternative2, + QueryResponseAlternative3, + QueryResponseAlternative4, + QueryResponseAlternative5, + QueryResponseAlternative6, + QueryResponseAlternative7, + QueryResponseAlternative8, + QueryResponseAlternative9, + QueryResponseAlternative10, + QueryResponseAlternative13, + QueryResponseAlternative14, + QueryResponseAlternative15, + QueryResponseAlternative16, + Any, + QueryResponseAlternative17, + QueryResponseAlternative18, + QueryResponseAlternative19, + QueryResponseAlternative20, + QueryResponseAlternative21, + QueryResponseAlternative24, + QueryResponseAlternative25, + QueryResponseAlternative26, + QueryResponseAlternative27, + QueryResponseAlternative28, + QueryResponseAlternative29, + QueryResponseAlternative30, + QueryResponseAlternative31, + QueryResponseAlternative34, + QueryResponseAlternative35, + QueryResponseAlternative36, + QueryResponseAlternative37, + QueryResponseAlternative38, + QueryResponseAlternative39, + ] + ] +): + root: Union[ + dict[str, Any], + QueryResponseAlternative1, + QueryResponseAlternative2, + QueryResponseAlternative3, + QueryResponseAlternative4, + QueryResponseAlternative5, + QueryResponseAlternative6, + QueryResponseAlternative7, + QueryResponseAlternative8, + QueryResponseAlternative9, + QueryResponseAlternative10, + QueryResponseAlternative13, + QueryResponseAlternative14, + QueryResponseAlternative15, + QueryResponseAlternative16, + Any, + QueryResponseAlternative17, + QueryResponseAlternative18, + QueryResponseAlternative19, + QueryResponseAlternative20, + QueryResponseAlternative21, + QueryResponseAlternative24, + QueryResponseAlternative25, + QueryResponseAlternative26, + QueryResponseAlternative27, + QueryResponseAlternative28, + QueryResponseAlternative29, + QueryResponseAlternative30, + QueryResponseAlternative31, + QueryResponseAlternative34, + QueryResponseAlternative35, + QueryResponseAlternative36, + QueryResponseAlternative37, + QueryResponseAlternative38, + QueryResponseAlternative39, + ] + + +class DatabaseSchemaQueryResponse(BaseModel): + model_config = ConfigDict( + extra="forbid", ) - response: Optional[DatabaseSchemaQueryResponse] = None + tables: dict[ + str, + Union[ + DatabaseSchemaPostHogTable, + DatabaseSchemaDataWarehouseTable, + DatabaseSchemaViewTable, + DatabaseSchemaBatchExportTable, + DatabaseSchemaMaterializedViewTable, + ], + ] class ExperimentFunnelsQuery(BaseModel): @@ -6765,6 +6779,17 @@ class InsightVizNode(BaseModel): vizSpecificOptions: Optional[VizSpecificOptions] = None +class DatabaseSchemaQuery(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + kind: Literal["DatabaseSchemaQuery"] = "DatabaseSchemaQuery" + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" + ) + response: Optional[DatabaseSchemaQueryResponse] = None + + class FunnelCorrelationActorsQuery(BaseModel): model_config = ConfigDict( extra="forbid",