:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(insights): delete the unused queryNodeToFilter converter (#119507)
Thomas Obermüller0495a8d44230
diff --git a/frontend/src/queries/nodes/InsightQuery/utils/queryNodeToFilter.test.ts b/frontend/src/queries/nodes/InsightQuery/utils/queryNodeToFilter.test.tsdeleted file mode 100644index cd7f1c5be0e8..000000000000--- a/frontend/src/queries/nodes/InsightQuery/utils/queryNodeToFilter.test.ts+++ /dev/null@@ -1,402 +0,0 @@-import { FunnelLayout } from 'lib/constants'--import { hiddenLegendItemsToKeys, queryNodeToFilter } from '~/queries/nodes/InsightQuery/utils/queryNodeToFilter'-import {- FunnelsQuery,- LifecycleQuery,- NodeKind,- PathsQuery,- StickinessQuery,- TrendsQuery,-} from '~/queries/schema/schema-general'-import {- BreakdownAttributionType,- ChartDisplayType,- FunnelConversionWindowTimeUnit,- FunnelPathType,- FunnelStepReference,- FunnelVizType,- FunnelsFilterType,- InsightType,- LifecycleFilterType,- PathType,- PathsFilterType,- StepOrderValue,- StickinessFilterType,- TrendsFilterType,-} from '~/types'--describe('queryNodeToFilter', () => {- test('maps a paths v2 query to its insight type only, as it has no legacy filter format', () => {- const result = queryNodeToFilter({- kind: NodeKind.PathsV2Query,- dateRange: { date_from: '-7d' },- pathsV2Filter: { maxSteps: 4 },- })-- expect(result).toEqual({ insight: InsightType.JOURNEYS })- })-- test('converts a query node to a filter', () => {- const query: LifecycleQuery = {- kind: NodeKind.LifecycleQuery,- lifecycleFilter: {- toggledLifecycles: ['new', 'dormant'],- },- series: [],- }-- const result = queryNodeToFilter(query)-- const filters: Partial<LifecycleFilterType> = {- entity_type: 'events',- insight: InsightType.LIFECYCLE,- toggledLifecycles: ['new', 'dormant'],- }- expect(result).toEqual(filters)- })-- test('converts a breakdownFilter into breakdown properties', () => {- const query: TrendsQuery = {- kind: NodeKind.TrendsQuery,- series: [],- breakdownFilter: {- breakdown: '$current_url',- breakdown_normalize_url: false,- breakdown_hide_other_aggregation: false,- },- }-- const result = queryNodeToFilter(query)-- const filters: Partial<TrendsFilterType> = {- entity_type: 'events',- insight: InsightType.TRENDS,- breakdown: '$current_url',- breakdown_hide_other_aggregation: false,- breakdown_normalize_url: false,- }- expect(result).toEqual(filters)- })-- test('converts a trendsFilter into filter properties', () => {- const query: TrendsQuery = {- kind: NodeKind.TrendsQuery,- series: [],- breakdownFilter: {- breakdown: '$browser',- breakdown_hide_other_aggregation: true,- breakdown_limit: 1,- breakdown_type: 'event',- breakdown_histogram_bin_count: 5,- },- trendsFilter: {- smoothingIntervals: 3,- formula: 'A + B',- display: ChartDisplayType.ActionsBar,- showLegend: true,- aggregationAxisFormat: 'numeric',- aggregationAxisPrefix: 'M',- aggregationAxisPostfix: '$',- decimalPlaces: 5,- xAxisLabel: 'Signup date',- yAxisLabel: 'Unique users',- showValuesOnSeries: true,- showLabelsOnSeries: true,- showPercentStackView: true,- yAxisScaleType: 'log10',- showMultipleYAxes: false,- hiddenLegendIndexes: [1, 2],- },- compareFilter: {- compare: true,- compare_to: '-4d',- },- }-- const result = queryNodeToFilter(query)-- const filters: Partial<TrendsFilterType> = {- insight: InsightType.TRENDS,- entity_type: 'events',- hidden_legend_keys: { 1: true, 2: true },- interval: undefined,- smoothing_intervals: 3,- display: ChartDisplayType.ActionsBar,- formula: 'A + B',- compare: true,- compare_to: '-4d',- decimal_places: 5,- aggregation_axis_format: 'numeric',- aggregation_axis_prefix: 'M',- aggregation_axis_postfix: '$',- x_axis_label: 'Signup date',- y_axis_label: 'Unique users',- breakdown: '$browser',- breakdown_hide_other_aggregation: true,- breakdown_limit: 1,- breakdown_type: 'event',- breakdown_histogram_bin_count: 5,- show_labels_on_series: true,- show_percent_stack_view: true,- show_legend: true,- show_values_on_series: true,- y_axis_scale_type: 'log10',- show_multiple_y_axes: false,- }- expect(result).toEqual(filters)- })-- test('converts a funnelsFilter into filter properties', () => {- const query: FunnelsQuery = {- kind: NodeKind.FunnelsQuery,- funnelsFilter: {- funnelVizType: FunnelVizType.Steps,- funnelFromStep: 1,- funnelToStep: 2,- funnelStepReference: FunnelStepReference.total,- breakdownAttributionType: BreakdownAttributionType.AllSteps,- breakdownAttributionValue: 1,- binCount: 'auto',- funnelWindowIntervalUnit: FunnelConversionWindowTimeUnit.Day,- funnelWindowInterval: 7,- funnelOrderType: StepOrderValue.ORDERED,- exclusions: [- {- event: '$pageview',- kind: NodeKind.EventsNode,- name: '$pageview',- funnelFromStep: 1,- funnelToStep: 2,- },- {- id: 3,- kind: NodeKind.ActionsNode,- name: 'Some action',- funnelFromStep: 1,- funnelToStep: 2,- },- ],- layout: FunnelLayout.horizontal,- },- series: [],- }-- const result = queryNodeToFilter(query)-- const filters: Partial<FunnelsFilterType> = {- insight: InsightType.FUNNELS,- funnel_viz_type: FunnelVizType.Steps,- funnel_from_step: 1,- funnel_to_step: 2,- funnel_step_reference: FunnelStepReference.total,- breakdown_attribution_type: BreakdownAttributionType.AllSteps,- breakdown_attribution_value: 1,- bin_count: 'auto',- funnel_window_interval_unit: FunnelConversionWindowTimeUnit.Day,- funnel_window_interval: 7,- funnel_order_type: StepOrderValue.ORDERED,- exclusions: [- {- id: '$pageview',- type: 'events',- order: 0,- name: '$pageview',- funnel_from_step: 1,- funnel_to_step: 2,- },- {- id: 3,- type: 'actions',- order: 1,- name: 'Some action',- funnel_from_step: 1,- funnel_to_step: 2,- },- ],- layout: FunnelLayout.horizontal,- interval: undefined,- hidden_legend_keys: undefined,- funnel_aggregate_by_hogql: undefined,- entity_type: 'events',- }- expect(result).toEqual(filters)- })-- test('converts a funnels data warehouse node to a legacy filter', () => {- const query: FunnelsQuery = {- kind: NodeKind.FunnelsQuery,- series: [- {- kind: NodeKind.FunnelsDataWarehouseNode,- id: 'warehouse_orders',- name: 'Orders',- table_name: 'warehouse_orders',- timestamp_field: 'timestamp',- id_field: 'id',- aggregation_target_field: 'person_id',- },- ],- }-- const result = queryNodeToFilter(query)-- expect(result.data_warehouse).toEqual([- {- type: 'data_warehouse',- id: 'warehouse_orders',- order: 0,- name: 'Orders',- table_name: 'warehouse_orders',- timestamp_field: 'timestamp',- id_field: 'id',- aggregation_target_field: 'person_id',- },- ])- })-- test('converts a pathsFilter and funnelPathsFilter into filter properties', () => {- const query: PathsQuery = {- kind: NodeKind.PathsQuery,- pathsFilter: {- includeEventTypes: [PathType.Screen, PathType.PageView],- startPoint: 'a',- endPoint: 'b',- pathGroupings: ['c', 'd'],- excludeEvents: ['e', 'f'],- stepLimit: 1,- pathReplacements: true,- localPathCleaningFilters: [{ alias: 'home' }],- edgeLimit: 1,- minEdgeWeight: 1,- maxEdgeWeight: 1,- },- funnelPathsFilter: {- funnelPathType: FunnelPathType.between,- funnelStep: 1,- funnelSource: {- funnelsFilter: {- funnelVizType: FunnelVizType.Steps,- },- kind: NodeKind.FunnelsQuery,- series: [- {- event: '$pageview',- kind: NodeKind.EventsNode,- name: '$pageview',- },- {- event: null,- kind: NodeKind.EventsNode,- },- ],- },- },- }-- const result = queryNodeToFilter(query)-- const filters: Partial<PathsFilterType> = {- insight: InsightType.PATHS,- include_event_types: [PathType.Screen, PathType.PageView],- start_point: 'a',- end_point: 'b',- path_groupings: ['c', 'd'],- funnel_paths: FunnelPathType.between,- entity_type: 'events',- funnel_filter: {- entity_type: 'events',- events: [- {- id: '$pageview',- name: '$pageview',- order: 0,- type: 'events',- },- {- id: null,- order: 1,- type: 'events',- },- ],- exclusions: undefined,- funnel_step: 1,- funnel_viz_type: 'steps',- insight: 'FUNNELS',- bin_count: undefined,- breakdown_attribution_type: undefined,- breakdown_attribution_value: undefined,- funnel_aggregate_by_hogql: undefined,- funnel_from_step: undefined,- funnel_to_step: undefined,- funnel_order_type: undefined,- funnel_step_reference: undefined,- funnel_window_interval: undefined,- funnel_window_interval_unit: undefined,- hidden_legend_keys: undefined,- interval: undefined,- },- exclude_events: ['e', 'f'],- step_limit: 1,- // path_start_key: 'g',- // path_end_key: 'h',- // path_dropoff_key: 'i',- path_replacements: true,- local_path_cleaning_filters: [{ alias: 'home' }],- edge_limit: 1,- min_edge_weight: 1,- max_edge_weight: 1,- paths_hogql_expression: undefined,- }- expect(result).toEqual(filters)- })-- test('converts a stickinessFilter into filter properties', () => {- const query: StickinessQuery = {- kind: NodeKind.StickinessQuery,- stickinessFilter: {- display: ChartDisplayType.ActionsBar,- showLegend: true,- showValuesOnSeries: true,- hiddenLegendIndexes: [1, 2],- },- interval: 'month',- series: [],- compareFilter: {- compare: true,- compare_to: '-4d',- },- }-- const result = queryNodeToFilter(query)-- const filters: Partial<StickinessFilterType> = {- insight: InsightType.STICKINESS,- compare: true,- compare_to: '-4d',- display: ChartDisplayType.ActionsBar,- hidden_legend_keys: { 1: true, 2: true },- interval: 'month',- show_legend: true,- show_values_on_series: true,- entity_type: 'events',- }- expect(result).toEqual(filters)- })-})--describe('hiddenLegendItemsToKeys', () => {- it('handles undefined', () => {- expect(hiddenLegendItemsToKeys(undefined)).toEqual(undefined)- })-- it('converts keys for funnel insights (breakdowns)', () => {- expect(hiddenLegendItemsToKeys(['a'])).toEqual({ a: true })- expect(hiddenLegendItemsToKeys(['a', 'b'])).toEqual({ a: true, b: true })- })-- it('converts keys for trends/stickiness insights', () => {- expect(hiddenLegendItemsToKeys([1])).toEqual({ '1': true })- expect(hiddenLegendItemsToKeys([1, 2])).toEqual({ '1': true, '2': true })- })-})diff --git a/frontend/src/queries/nodes/InsightQuery/utils/queryNodeToFilter.ts b/frontend/src/queries/nodes/InsightQuery/utils/queryNodeToFilter.tsdeleted file mode 100644index 4a19ce1b0de5..000000000000--- a/frontend/src/queries/nodes/InsightQuery/utils/queryNodeToFilter.ts+++ /dev/null@@ -1,397 +0,0 @@-import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'-import { objectClean } from 'lib/utils/objects'--import { ProductAnalyticsInsightNodeKind, nodeKindToInsightType } from '~/queries/nodes/InsightQuery/defaults'-import {- AnyDataWarehouseNode,- AnyEntityNode,- BreakdownFilter,- CompareFilter,- FunnelsFilterLegacy,- GroupNode,- InsightQueryNode,- LifecycleFilterLegacy,- NodeKind,- PathsFilterLegacy,- RetentionFilterLegacy,- StickinessFilterLegacy,- TrendsFilterLegacy,-} from '~/queries/schema/schema-general'-import {- isActionsNode,- isAnyDataWarehouseNode,- isDataWarehouseNode,- isEventsNode,- isFunnelsDataWarehouseNode,- isFunnelsQuery,- isGroupNode,- isLifecycleDataWarehouseNode,- isLifecycleQuery,- isPathsQuery,- isPathsV2Query,- isRetentionQuery,- isStickinessQuery,- isTrendsQuery,- isWebAnalyticsInsightQuery,-} from '~/queries/utils'-import { ActionFilter, EntityTypes, FilterType, InsightType } from '~/types'--type FilterTypeActionsAndEvents = {- events?: ActionFilter[]- actions?: ActionFilter[]- data_warehouse?: ActionFilter[]- new_entity?: ActionFilter[]- groups?: ActionFilter[]-}--const getFilterId = (node: AnyEntityNode<AnyDataWarehouseNode> | GroupNode): any => {- if (isGroupNode(node)) {- return undefined- }-- if (isAnyDataWarehouseNode(node)) {- return node.table_name- }-- if (isActionsNode(node)) {- return node.id- }-- return node.event-}--const seriesNodeToFilter = (node: AnyEntityNode<AnyDataWarehouseNode> | GroupNode, index?: number): ActionFilter => {- const entity: ActionFilter = objectClean({- type: isAnyDataWarehouseNode(node)- ? EntityTypes.DATA_WAREHOUSE- : isGroupNode(node)- ? EntityTypes.GROUPS- : isActionsNode(node)- ? EntityTypes.ACTIONS- : EntityTypes.EVENTS,- id: getFilterId(node),- order: index,- name: node.name,- custom_name: node.custom_name,- // TODO: math is not supported by funnel and lifecycle queries- math: node.math,- math_property: node.math_property,- math_property_type: node.math_property_type as TaxonomicFilterGroupType,- math_hogql: node.math_hogql,- math_group_type_index: node.math_group_type_index,- optionalInFunnel: node.optionalInFunnel,- properties: node.properties as any, // TODO,- ...(isDataWarehouseNode(node)- ? {- table_name: node.table_name,- id_field: node.id_field,- timestamp_field: node.timestamp_field,- distinct_id_field: node.distinct_id_field,- }- : {}),- ...(isFunnelsDataWarehouseNode(node)- ? {- table_name: node.table_name,- id_field: node.id_field,- timestamp_field: node.timestamp_field,- aggregation_target_field: node.aggregation_target_field,- }- : {}),- ...(isLifecycleDataWarehouseNode(node)- ? {- table_name: node.table_name,- timestamp_field: node.timestamp_field,- aggregation_target_field: node.aggregation_target_field,- created_at_field: node.created_at_field,- }- : {}),- ...(isGroupNode(node)- ? {- operator: node.operator,- nestedFilters: (node.nodes || []).map((v) => seriesNodeToFilter(v)),- }- : {}),- })-- return entity-}--const seriesToActionsAndEvents = (- series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode)[]-): Required<FilterTypeActionsAndEvents> => {- const actions: ActionFilter[] = []- const events: ActionFilter[] = []- const data_warehouse: ActionFilter[] = []- const new_entity: ActionFilter[] = []- const groups: ActionFilter[] = []- series.forEach((node, index) => {- const entity = seriesNodeToFilter(node, index)- if (isEventsNode(node)) {- events.push(entity)- } else if (isActionsNode(node)) {- actions.push(entity)- } else if (isAnyDataWarehouseNode(node)) {- data_warehouse.push(entity)- } else if (isGroupNode(node)) {- groups.push(entity)- } else {- new_entity.push(entity)- }- })-- return { actions, events, data_warehouse, new_entity, groups }-}--/**- * Converts arrays of hidden items (`hiddenLegendIndexes` and `hiddenLegendBreakdowns`)- * to their respective object variant for usage in `hidden_legend_keys`.- *- * Example: `["Chrome"]` will become `{Chrome: true}`.- */-export const hiddenLegendItemsToKeys = (- hidden_items: number[] | string[] | undefined-): Record<string, boolean | undefined> | undefined =>- hidden_items?.reduce(- (k, b) => {- k[b] = true- return k- },- {} as Record<string, boolean | undefined>- )--const nodeKindToFilterKey: Record<ProductAnalyticsInsightNodeKind, string> = {- [NodeKind.TrendsQuery]: 'trendsFilter',- [NodeKind.FunnelsQuery]: 'funnelsFilter',- [NodeKind.RetentionQuery]: 'retentionFilter',- [NodeKind.PathsQuery]: 'pathsFilter',- [NodeKind.PathsV2Query]: 'pathsV2Filter',- [NodeKind.StickinessQuery]: 'stickinessFilter',- [NodeKind.LifecycleQuery]: 'lifecycleFilter',-}--export const queryNodeToFilter = (query: InsightQueryNode): Partial<FilterType> => {- // Web Analytics queries don't have a legacy filter format- if (isWebAnalyticsInsightQuery(query)) {- return {- insight: InsightType.WEB_ANALYTICS,- }- }-- // Paths v2 queries don't have a legacy filter format either- if (isPathsV2Query(query)) {- return {- insight: InsightType.JOURNEYS,- }- }-- const filters: Partial<FilterType> = objectClean({- insight: nodeKindToInsightType[query.kind],- properties: query.properties,- filter_test_accounts: query.filterTestAccounts,- date_to: query.dateRange?.date_to,- // TODO: not used by retention queries- date_from: query.dateRange?.date_from,- explicit_date: query.dateRange?.explicitDate,- entity_type: 'events',- sampling_factor: query.samplingFactor,- })-- if (!isRetentionQuery(query) && !isPathsQuery(query) && 'series' in query) {- const { actions, events, data_warehouse, new_entity, groups } = seriesToActionsAndEvents(query.series)- if (actions.length > 0) {- filters.actions = actions- }- if (events.length > 0) {- filters.events = events- }- if (data_warehouse.length > 0) {- filters.data_warehouse = data_warehouse- }- if (new_entity.length > 0) {- filters.new_entity = new_entity- }- if (groups.length > 0) {- filters.groups = groups- }- }-- // TODO stickiness should probably support breakdowns as well- if ((isTrendsQuery(query) || isFunnelsQuery(query)) && query.breakdownFilter) {- Object.assign(filters, objectClean<Partial<Record<keyof BreakdownFilter, unknown>>>(query.breakdownFilter))- }-- if ((isTrendsQuery(query) || isStickinessQuery(query)) && query.compareFilter) {- Object.assign(filters, objectClean<Partial<Record<keyof CompareFilter, unknown>>>(query.compareFilter))- }-- if (!isStickinessQuery(query)) {- Object.assign(- filters,- objectClean({- aggregation_group_type_index: query.aggregation_group_type_index,- })- )- }-- if (isTrendsQuery(query) || isStickinessQuery(query) || isLifecycleQuery(query) || isFunnelsQuery(query)) {- filters.interval = query.interval- }-- // we don't want to mutate the original query- const queryCopy = JSON.parse(JSON.stringify(query))-- // replace camel cased props with the snake cased variant- const camelCasedTrendsProps: TrendsFilterLegacy = {}- const camelCasedFunnelsProps: FunnelsFilterLegacy = {}- const camelCasedRetentionProps: RetentionFilterLegacy = {}- const camelCasedPathsProps: PathsFilterLegacy = {}- const camelCasedStickinessProps: StickinessFilterLegacy = {}- const camelCasedLifecycleProps: LifecycleFilterLegacy = {}- if (isTrendsQuery(queryCopy)) {- camelCasedTrendsProps.hidden_legend_keys = hiddenLegendItemsToKeys(queryCopy.trendsFilter?.hiddenLegendIndexes)- camelCasedTrendsProps.smoothing_intervals = queryCopy.trendsFilter?.smoothingIntervals- camelCasedTrendsProps.decimal_places = queryCopy.trendsFilter?.decimalPlaces- camelCasedTrendsProps.aggregation_axis_format = queryCopy.trendsFilter?.aggregationAxisFormat- camelCasedTrendsProps.aggregation_axis_postfix = queryCopy.trendsFilter?.aggregationAxisPostfix- camelCasedTrendsProps.aggregation_axis_prefix = queryCopy.trendsFilter?.aggregationAxisPrefix- camelCasedTrendsProps.x_axis_label = queryCopy.trendsFilter?.xAxisLabel- camelCasedTrendsProps.y_axis_label = queryCopy.trendsFilter?.yAxisLabel- camelCasedTrendsProps.show_labels_on_series = queryCopy.trendsFilter?.showLabelsOnSeries- camelCasedTrendsProps.show_percent_stack_view = queryCopy.trendsFilter?.showPercentStackView- camelCasedTrendsProps.show_legend = queryCopy.trendsFilter?.showLegend- camelCasedTrendsProps.show_values_on_series = queryCopy.trendsFilter?.showValuesOnSeries- camelCasedTrendsProps.y_axis_scale_type = queryCopy.trendsFilter?.yAxisScaleType- camelCasedTrendsProps.show_multiple_y_axes = queryCopy.trendsFilter?.showMultipleYAxes- delete queryCopy.trendsFilter?.hiddenLegendIndexes- delete queryCopy.trendsFilter?.smoothingIntervals- delete queryCopy.trendsFilter?.decimalPlaces- delete queryCopy.trendsFilter?.aggregationAxisFormat- delete queryCopy.trendsFilter?.aggregationAxisPostfix- delete queryCopy.trendsFilter?.aggregationAxisPrefix- delete queryCopy.trendsFilter?.xAxisLabel- delete queryCopy.trendsFilter?.yAxisLabel- delete queryCopy.trendsFilter?.showLabelsOnSeries- delete queryCopy.trendsFilter?.showPercentStackView- delete queryCopy.trendsFilter?.showLegend- delete queryCopy.trendsFilter?.showValuesOnSeries- delete queryCopy.trendsFilter?.yAxisScaleType- delete queryCopy.trendsFilter?.showMultipleYAxes- } else if (isFunnelsQuery(queryCopy)) {- camelCasedFunnelsProps.exclusions = queryCopy.funnelsFilter?.exclusions- ? queryCopy.funnelsFilter.exclusions.map(({ funnelFromStep, funnelToStep, ...rest }, index) => ({- funnel_from_step: funnelFromStep,- funnel_to_step: funnelToStep,- order: index,- ...seriesNodeToFilter(rest),- }))- : undefined- camelCasedFunnelsProps.bin_count = queryCopy.funnelsFilter?.binCount- camelCasedFunnelsProps.breakdown_attribution_type = queryCopy.funnelsFilter?.breakdownAttributionType- camelCasedFunnelsProps.breakdown_attribution_value = queryCopy.funnelsFilter?.breakdownAttributionValue- camelCasedFunnelsProps.funnel_aggregate_by_hogql = queryCopy.funnelsFilter?.funnelAggregateByHogQL- camelCasedFunnelsProps.funnel_to_step = queryCopy.funnelsFilter?.funnelToStep- camelCasedFunnelsProps.funnel_from_step = queryCopy.funnelsFilter?.funnelFromStep- camelCasedFunnelsProps.funnel_order_type = queryCopy.funnelsFilter?.funnelOrderType- camelCasedFunnelsProps.funnel_viz_type = queryCopy.funnelsFilter?.funnelVizType- camelCasedFunnelsProps.funnel_window_interval = queryCopy.funnelsFilter?.funnelWindowInterval- camelCasedFunnelsProps.funnel_window_interval_unit = queryCopy.funnelsFilter?.funnelWindowIntervalUnit- camelCasedFunnelsProps.hidden_legend_keys = hiddenLegendItemsToKeys(- queryCopy.funnelsFilter?.hiddenLegendBreakdowns- )- camelCasedFunnelsProps.funnel_step_reference = queryCopy.funnelsFilter?.funnelStepReference- delete queryCopy.funnelsFilter?.exclusions- delete queryCopy.funnelsFilter?.binCount- delete queryCopy.funnelsFilter?.breakdownAttributionType- delete queryCopy.funnelsFilter?.breakdownAttributionValue- delete queryCopy.funnelsFilter?.funnelAggregateByHogQL- delete queryCopy.funnelsFilter?.funnelToStep- delete queryCopy.funnelsFilter?.funnelFromStep- delete queryCopy.funnelsFilter?.funnelOrderType- delete queryCopy.funnelsFilter?.funnelVizType- delete queryCopy.funnelsFilter?.funnelWindowInterval- delete queryCopy.funnelsFilter?.funnelWindowIntervalUnit- delete queryCopy.funnelsFilter?.hiddenLegendBreakdowns- delete queryCopy.funnelsFilter?.funnelStepReference- } else if (isRetentionQuery(queryCopy)) {- camelCasedRetentionProps.retention_reference = queryCopy.retentionFilter?.retentionReference- camelCasedRetentionProps.retention_type = queryCopy.retentionFilter?.retentionType- camelCasedRetentionProps.returning_entity = queryCopy.retentionFilter?.returningEntity- camelCasedRetentionProps.target_entity = queryCopy.retentionFilter?.targetEntity- camelCasedRetentionProps.total_intervals = queryCopy.retentionFilter?.totalIntervals- camelCasedRetentionProps.show_mean =- queryCopy.retentionFilter?.meanRetentionCalculation === 'simple'- ? true- : queryCopy.retentionFilter?.meanRetentionCalculation === 'none'- ? false- : undefined- camelCasedRetentionProps.cumulative = queryCopy.retentionFilter?.cumulative- delete queryCopy.retentionFilter?.retentionReference- delete queryCopy.retentionFilter?.retentionType- delete queryCopy.retentionFilter?.returningEntity- delete queryCopy.retentionFilter?.targetEntity- delete queryCopy.retentionFilter?.totalIntervals- delete queryCopy.retentionFilter?.cumulative- delete queryCopy.retentionFilter?.meanRetentionCalculation- } else if (isPathsQuery(queryCopy)) {- camelCasedPathsProps.edge_limit = queryCopy.pathsFilter?.edgeLimit- camelCasedPathsProps.paths_hogql_expression = queryCopy.pathsFilter?.pathsHogQLExpression- camelCasedPathsProps.include_event_types = queryCopy.pathsFilter?.includeEventTypes- camelCasedPathsProps.start_point = queryCopy.pathsFilter?.startPoint- camelCasedPathsProps.end_point = queryCopy.pathsFilter?.endPoint- camelCasedPathsProps.path_groupings = queryCopy.pathsFilter?.pathGroupings- camelCasedPathsProps.exclude_events = queryCopy.pathsFilter?.excludeEvents- camelCasedPathsProps.step_limit = queryCopy.pathsFilter?.stepLimit- camelCasedPathsProps.path_replacements = queryCopy.pathsFilter?.pathReplacements- camelCasedPathsProps.local_path_cleaning_filters = queryCopy.pathsFilter?.localPathCleaningFilters- camelCasedPathsProps.min_edge_weight = queryCopy.pathsFilter?.minEdgeWeight- camelCasedPathsProps.max_edge_weight = queryCopy.pathsFilter?.maxEdgeWeight- camelCasedPathsProps.funnel_paths = queryCopy.funnelPathsFilter?.funnelPathType- camelCasedPathsProps.funnel_filter =- queryCopy.funnelPathsFilter !== undefined- ? {- ...queryNodeToFilter(queryCopy.funnelPathsFilter.funnelSource),- funnel_step: queryCopy.funnelPathsFilter.funnelStep,- }- : undefined- delete queryCopy.pathsFilter?.edgeLimit- delete queryCopy.pathsFilter?.pathsHogQLExpression- delete queryCopy.pathsFilter?.includeEventTypes- delete queryCopy.pathsFilter?.startPoint- delete queryCopy.pathsFilter?.endPoint- delete queryCopy.pathsFilter?.pathGroupings- delete queryCopy.pathsFilter?.excludeEvents- delete queryCopy.pathsFilter?.stepLimit- delete queryCopy.pathsFilter?.pathReplacements- delete queryCopy.pathsFilter?.localPathCleaningFilters- delete queryCopy.pathsFilter?.minEdgeWeight- delete queryCopy.pathsFilter?.maxEdgeWeight- delete queryCopy.funnelPathsFilter- } else if (isStickinessQuery(queryCopy)) {- camelCasedStickinessProps.show_legend = queryCopy.stickinessFilter?.showLegend- camelCasedStickinessProps.show_values_on_series = queryCopy.stickinessFilter?.showValuesOnSeries- camelCasedStickinessProps.hidden_legend_keys = hiddenLegendItemsToKeys(- queryCopy.stickinessFilter?.hiddenLegendIndexes- )- delete queryCopy.stickinessFilter?.showLegend- delete queryCopy.stickinessFilter?.showValuesOnSeries- delete queryCopy.stickinessFilter?.hiddenLegendIndexes- } else if (isLifecycleQuery(queryCopy)) {- camelCasedLifecycleProps.show_values_on_series = queryCopy.lifecycleFilter?.showValuesOnSeries- camelCasedLifecycleProps.show_legend = queryCopy.lifecycleFilter?.showLegend- camelCasedLifecycleProps.toggledLifecycles = queryCopy.lifecycleFilter?.toggledLifecycles- delete queryCopy.lifecycleFilter?.showLegend- delete queryCopy.lifecycleFilter?.showValuesOnSeries- delete queryCopy.lifecycleFilter?.toggledLifecycles- }- Object.assign(filters, camelCasedTrendsProps)- Object.assign(filters, camelCasedFunnelsProps)- Object.assign(filters, camelCasedRetentionProps)- Object.assign(filters, camelCasedPathsProps)- Object.assign(filters, camelCasedStickinessProps)- Object.assign(filters, camelCasedLifecycleProps)-- // add the remaining node specific filter properties- Object.assign(filters, queryCopy[nodeKindToFilterKey[query.kind]])-- return filters-}