: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(notebooks): remove the client-side legacy insight filter conversion (#97281)
Thomas Obermüller77bd9baa5d99
diff --git a/frontend/src/queries/nodes/InsightQuery/utils/filtersToQueryNode.ts b/frontend/src/queries/nodes/InsightQuery/utils/filtersToQueryNode.tsindex 4bb4e8f6906d..16b2dee9b01b 100644--- a/frontend/src/queries/nodes/InsightQuery/utils/filtersToQueryNode.ts+++ b/frontend/src/queries/nodes/InsightQuery/utils/filtersToQueryNode.ts@@ -248,7 +248,7 @@ export const legacyEntityToNode = () as any}-export const exlusionEntityToNode = (+const exlusionEntityToNode = (entity: FunnelExclusionLegacy): FunnelExclusionEventsNode | FunnelExclusionActionsNode => {const baseEntity = legacyEntityToNode(entity as ActionFilter, false, MathAvailability.None) as@@ -538,7 +538,7 @@ export const filtersToQueryNode = (return objectCleanWithEmpty(query as Record<string, any>, ['series']) as InsightQueryNode}-export const trendsFilterToQuery = (filters: Partial<TrendsFilterType>): TrendsFilter => {+const trendsFilterToQuery = (filters: Partial<TrendsFilterType>): TrendsFilter => {return objectCleanWithEmpty({smoothingIntervals: filters.smoothing_intervals,showLegend: filters.show_legend,@@ -560,7 +560,7 @@ export const trendsFilterToQuery = (filters: Partial<TrendsFilterType>): TrendsF})}-export const funnelsFilterToQuery = (filters: Partial<FunnelsFilterType>): FunnelsFilter => {+const funnelsFilterToQuery = (filters: Partial<FunnelsFilterType>): FunnelsFilter => {return objectCleanWithEmpty({funnelVizType: filters.funnel_viz_type,funnelFromStep: filters.funnel_from_step,@@ -582,7 +582,7 @@ export const funnelsFilterToQuery = (filters: Partial<FunnelsFilterType>): Funne})}-export const retentionFilterToQuery = (filters: Partial<RetentionFilterType>): RetentionFilter => {+const retentionFilterToQuery = (filters: Partial<RetentionFilterType>): RetentionFilter => {return objectCleanWithEmpty({retentionType: filters.retention_type,retentionReference: filters.retention_reference,@@ -596,7 +596,7 @@ export const retentionFilterToQuery = (filters: Partial<RetentionFilterType>): R// TODO: query.aggregation_group_type_index}-export const pathsFilterToQuery = (filters: Partial<PathsFilterType>): PathsFilter => {+const pathsFilterToQuery = (filters: Partial<PathsFilterType>): PathsFilter => {return objectCleanWithEmpty({pathsHogQLExpression: filters.paths_hogql_expression,includeEventTypes: filters.include_event_types,@@ -625,7 +625,7 @@ export const filtersToFunnelPathsQuery = (filters: Partial<PathsFilterType>): Fu}}-export const stickinessFilterToQuery = (filters: Record<string, any>): StickinessFilter => {+const stickinessFilterToQuery = (filters: Record<string, any>): StickinessFilter => {return objectCleanWithEmpty({display: filters.display,showLegend: filters.show_legend,@@ -635,7 +635,7 @@ export const stickinessFilterToQuery = (filters: Record<string, any>): Stickines})}-export const lifecycleFilterToQuery = (filters: Record<string, any>): LifecycleFilter => {+const lifecycleFilterToQuery = (filters: Record<string, any>): LifecycleFilter => {return objectCleanWithEmpty({showLegend: filters.show_legend,toggledLifecycles: filters.toggledLifecycles,@@ -643,7 +643,7 @@ export const lifecycleFilterToQuery = (filters: Record<string, any>): LifecycleF})}-export const breakdownFilterToQuery = (filters: Record<string, any>, isTrends: boolean): BreakdownFilter => {+const breakdownFilterToQuery = (filters: Record<string, any>, isTrends: boolean): BreakdownFilter => {return objectCleanWithEmpty({breakdown_type: filters.breakdown_type,breakdown: filters.breakdown,@@ -660,7 +660,7 @@ export const breakdownFilterToQuery = (filters: Record<string, any>, isTrends: b})}-export const compareFilterToQuery = (filters: Record<string, any>): CompareFilter => {+const compareFilterToQuery = (filters: Record<string, any>): CompareFilter => {return objectCleanWithEmpty({compare: filters.compare,compare_to: filters.compare_to,diff --git a/frontend/src/queries/nodes/InsightQuery/utils/legacy.ts b/frontend/src/queries/nodes/InsightQuery/utils/legacy.tsdeleted file mode 100644index abe49230016e..000000000000--- a/frontend/src/queries/nodes/InsightQuery/utils/legacy.ts+++ /dev/null@@ -1,103 +0,0 @@-export const isLegacyTrendsFilter = (filters: Record<string, any> | undefined): boolean => {- if (filters == null) {- return false- }-- const legacyKeys = [- 'smoothing_intervals',- 'show_legend',- 'hidden_legend_keys',- 'aggregation_axis_format',- 'aggregation_axis_prefix',- 'aggregation_axis_postfix',- 'decimal_places',- 'show_values_on_series',- 'show_percent_stack_view',- 'show_labels_on_series',- 'compare',- 'compare_to',- ]- return legacyKeys.some((key) => key in filters)-}--export const isLegacyFunnelsFilter = (filters: Record<string, any> | undefined): boolean => {- if (filters == null) {- return false- }-- const legacyKeys = [- 'funnel_viz_type',- 'funnel_from_step',- 'funnel_to_step',- 'funnel_step_reference',- 'breakdown_attribution_type',- 'breakdown_attribution_value',- 'bin_count',- 'funnel_window_interval_unit',- 'funnel_window_interval',- 'funnel_order_type',- 'hidden_legend_keys',- 'funnel_aggregate_by_hogql',- ]- return legacyKeys.some((key) => key in filters)-}--export const isLegacyFunnelsExclusion = (filters: Record<string, any> | undefined): boolean => {- if (filters == null) {- return false- }-- const exclusions = filters.exclusions || []- return exclusions.some((exclusion: Record<string, any>) => 'type' in exclusion)-}--export const isLegacyRetentionFilter = (filters: Record<string, any> | undefined): boolean => {- if (filters == null) {- return false- }-- const legacyKeys = ['retention_type', 'retention_reference', 'total_intervals', 'returning_entity', 'target_entity']- return legacyKeys.some((key) => key in filters)-}--export const isLegacyPathsFilter = (filters: Record<string, any> | undefined): boolean => {- if (filters == null) {- return false- }-- const legacyKeys = [- 'paths_hogql_expression',- 'include_event_types',- 'start_point',- 'end_point',- 'path_groupings',- 'funnel_paths',- 'funnel_filter',- 'exclude_events',- 'step_limit',- 'path_replacements',- 'local_path_cleaning_filters',- 'edge_limit',- 'min_edge_weight',- 'max_edge_weight',- ]- return legacyKeys.some((key) => key in filters)-}--export const isLegacyStickinessFilter = (filters: Record<string, any> | undefined): boolean => {- if (filters == null) {- return false- }-- const legacyKeys = ['show_legend', 'hidden_legend_keys', 'show_values_on_series', 'compare', 'compare_to']- return legacyKeys.some((key) => key in filters)-}--export const isLegacyLifecycleFilter = (filters: Record<string, any> | undefined): boolean => {- if (filters == null) {- return false- }-- const legacyKeys = ['show_values_on_series']- return legacyKeys.some((key) => key in filters)-}diff --git a/frontend/src/scenes/notebooks/Notebook/migrations/migrate.test.ts b/frontend/src/scenes/notebooks/Notebook/migrations/migrate.test.tsindex 359406636b62..3bdf6b8bb235 100644--- a/frontend/src/scenes/notebooks/Notebook/migrations/migrate.test.ts+++ b/frontend/src/scenes/notebooks/Notebook/migrations/migrate.test.ts@@ -169,9 +169,8 @@ describe('migrate()', () => {},],interval: 'week',- breakdownFilter: { breakdown_type: 'event', breakdown: '$referring_domain' },- trendsFilter: { display: 'ActionsBar' },- compareFilter: { compare: true },+ breakdown: { breakdown_type: 'event', breakdown: '$referring_domain' },+ trendsFilter: { compare: true, display: 'ActionsBar' },version: LATEST_VERSIONS[NodeKind.TrendsQuery],},},@@ -184,120 +183,6 @@ describe('migrate()', () => {},],],- [- 'migrates funnels filter',- [- {- type: 'ph-query',- attrs: {- query: {- kind: 'InsightVizNode',- source: {- kind: 'FunnelsQuery',- series: [- {- kind: 'EventsNode',- math: 'total',- name: 'user signed up',- event: 'user signed up',- properties: [- {- key: 'is_organization_first_user',- type: 'person',- value: ['true'],- operator: 'exact',- },- {- key: 'realm',- type: 'event',- value: ['cloud'],- operator: 'exact',- },- ],- },- {- kind: 'EventsNode',- math: 'total',- name: 'recording analyzed',- event: 'recording analyzed',- },- ],- interval: 'day',- dateRange: { date_to: '', date_from: '-6w' },- funnelsFilter: {- funnel_viz_type: 'trends',- funnel_order_type: 'ordered',- funnel_window_interval: 14,- funnel_window_interval_unit: 'day',- },- aggregation_group_type_index: 0,- },- },- title: 'Organisation signed up -> recording analyzed, last 6 weeks',- __init: null,- height: 516,- nodeId: 'be5c5e34-f330-4f3f-9a2f-6361c60d0f2e',- children: null,- },- },- ],- [- {- type: 'ph-query',- attrs: {- query: {- kind: 'InsightVizNode',- source: {- kind: 'FunnelsQuery',- series: [- {- kind: 'EventsNode',- math: 'total',- name: 'user signed up',- event: 'user signed up',- properties: [- {- key: 'is_organization_first_user',- type: 'person',- value: ['true'],- operator: 'exact',- },- {- key: 'realm',- type: 'event',- value: ['cloud'],- operator: 'exact',- },- ],- },- {- kind: 'EventsNode',- math: 'total',- name: 'recording analyzed',- event: 'recording analyzed',- },- ],- interval: 'day',- dateRange: { date_to: '', date_from: '-6w' },- funnelsFilter: {- funnelOrderType: 'ordered',- funnelVizType: 'trends',- funnelWindowInterval: 14,- funnelWindowIntervalUnit: 'day',- },- aggregation_group_type_index: 0,- version: LATEST_VERSIONS[NodeKind.FunnelsQuery],- },- },- title: 'Organisation signed up -> recording analyzed, last 6 weeks',- __init: null,- height: 516,- nodeId: 'be5c5e34-f330-4f3f-9a2f-6361c60d0f2e',- children: null,- },- },- ],- ],['migrates retention filter',[@@ -389,671 +274,6 @@ describe('migrate()', () => {},],],- [- 'migrates trends queries (mixed with breakdown)',- [- {- type: 'ph-query',- attrs: {- query: {- kind: 'InsightVizNode',- source: {- kind: 'TrendsQuery',- series: [- {- kind: 'EventsNode',- math: 'dau',- name: '$pageview',- event: '$pageview',- properties: [- {- key: '$current_url',- type: 'event',- value: 'https://(app|eu).posthog.com',- operator: 'regex',- },- ],- },- ],- interval: 'day',- breakdown: {- breakdown: '$feature/posthog-3000',- breakdown_type: 'event',- },- trendsFilter: {- display: 'ActionsLineGraph',- show_legend: true,- },- filterTestAccounts: false,- version: 2,- },- },- title: 'Rollout of users on 3000',- __init: null,- height: null,- nodeId: '4c2a07ee-fc9f-45c5-b36c-5e14a10f8e89',- children: null,- },- },- ],- [- {- type: 'ph-query',- attrs: {- query: {- kind: 'InsightVizNode',- source: {- kind: 'TrendsQuery',- series: [- {- kind: 'EventsNode',- math: 'dau',- name: '$pageview',- event: '$pageview',- properties: [- {- key: '$current_url',- type: 'event',- value: 'https://(app|eu).posthog.com',- operator: 'regex',- },- ],- },- ],- interval: 'day',- breakdownFilter: {- breakdown: '$feature/posthog-3000',- breakdown_type: 'event',- },- trendsFilter: {- display: 'ActionsLineGraph',- showLegend: true,- },- filterTestAccounts: false,- version: LATEST_VERSIONS[NodeKind.TrendsQuery],- },- },- title: 'Rollout of users on 3000',- __init: null,- height: null,- nodeId: '4c2a07ee-fc9f-45c5-b36c-5e14a10f8e89',- children: null,- },- },- ],- ],- [- 'migrates breakdown',- [- {- type: 'ph-query',- attrs: {- query: {- kind: 'InsightVizNode',- source: {- kind: 'TrendsQuery',- series: [- {- kind: 'EventsNode',- math: 'dau',- name: '$pageview',- event: '$pageview',- properties: [- {- key: '$referring_domain',- type: 'event',- value: 'google|duckduckgo|brave|bing',- operator: 'regex',- },- {- key: 'utm_source',- type: 'event',- value: 'is_not_set',- operator: 'is_not_set',- },- {- key: '$host',- type: 'event',- value: ['posthog.com'],- operator: 'exact',- },- ],- },- ],- interval: 'week',- breakdown: {- breakdown: '$referring_domain',- breakdown_type: 'event',- },- dateRange: { date_to: null, date_from: '-90d' },- properties: {- type: 'AND',- values: [{ type: 'AND', values: [] }],- },- trendsFilter: { display: 'ActionsBar' },- compareFilter: { compare: true, compare_to: '-4w' },- filterTestAccounts: true,- version: 2,- },- },- title: 'SEO trend last 90 days',- __init: null,- height: null,- nodeId: '245516ed-8bb2-41c3-83c6-fc10bb0c5149',- children: null,- },- },- ],- [- {- type: 'ph-query',- attrs: {- query: {- kind: 'InsightVizNode',- source: {- kind: 'TrendsQuery',- series: [- {- kind: 'EventsNode',- math: 'dau',- name: '$pageview',- event: '$pageview',- properties: [- {- key: '$referring_domain',- type: 'event',- value: 'google|duckduckgo|brave|bing',- operator: 'regex',- },- {- key: 'utm_source',- type: 'event',- value: 'is_not_set',- operator: 'is_not_set',- },- {- key: '$host',- type: 'event',- value: ['posthog.com'],- operator: 'exact',- },- ],- },- ],- interval: 'week',- breakdownFilter: {- breakdown: '$referring_domain',- breakdown_type: 'event',- },- dateRange: { date_to: null, date_from: '-90d' },- properties: {- type: 'AND',- values: [{ type: 'AND', values: [] }],- },- trendsFilter: { display: 'ActionsBar' },- compareFilter: { compare: true, compare_to: '-4w' },- filterTestAccounts: true,- version: LATEST_VERSIONS[NodeKind.TrendsQuery],- },- },- title: 'SEO trend last 90 days',- __init: null,- height: null,- nodeId: '245516ed-8bb2-41c3-83c6-fc10bb0c5149',- children: null,- },- },- ],- ],- [- 'migrates paths filter',- [- {- type: 'ph-query',- attrs: {- query: {- kind: 'InsightVizNode',- source: {- kind: 'PathsQuery',- interval: 'day',- dateRange: { date_to: null, date_from: '-30d' },- pathsFilter: {- edge_limit: 20,- step_limit: 9,- start_point: 'https://posthog.com/blog/best-mixpanel-alternatives',- include_event_types: ['$pageview'],- },- filterTestAccounts: true,- },- },- title: null,- __init: null,- height: null,- nodeId: 'e2f225af-7e5f-40c0-afbd-832cbb866079',- children: null,- },- },- ],- [- {- type: 'ph-query',- attrs: {- query: {- kind: 'InsightVizNode',- source: {- kind: 'PathsQuery',- interval: 'day',- dateRange: { date_to: null, date_from: '-30d' },- pathsFilter: {- edgeLimit: 20,- stepLimit: 9,- startPoint: 'https://posthog.com/blog/best-mixpanel-alternatives',- includeEventTypes: ['$pageview'],- },- filterTestAccounts: true,- },- },- title: null,- __init: null,- height: null,- nodeId: 'e2f225af-7e5f-40c0-afbd-832cbb866079',- children: null,- },- },- ],- ],- [- 'migrates series TODO',- [- {- type: 'ph-query',- attrs: {- query: {- kind: 'InsightVizNode',- source: {- kind: 'TrendsQuery',- series: [- {- id: '2674',- kind: 'ActionsNode',- math: 'unique_group',- name: 'User Signed Up (Comprehensive)',- properties: [- {- key: 'is_organization_first_user',- type: 'event',- value: ['true'],- operator: 'exact',- },- ],- custom_name: 'All Org Signups',- math_group_type_index: 0,- },- {- id: '2674',- kind: 'ActionsNode',- math: 'unique_group',- name: 'User Signed Up (Comprehensive)',- properties: [- {- key: 'id',- type: 'cohort',- value: 15394,- operator: null,- },- {- key: 'is_organization_first_user',- type: 'event',- value: ['true'],- operator: 'exact',- },- ],- custom_name: 'High ICP Organizations',- math_group_type_index: 0,- },- {- id: '8231',- kind: 'ActionsNode',- math: 'unique_group',- name: 'User Signed Up (Cloud)',- properties: [- {- key: 'is_organization_first_user',- type: 'event',- value: ['true'],- operator: 'exact',- },- ],- custom_name: 'Cloud Signups',- math_group_type_index: 0,- },- {- id: '9847',- kind: 'ActionsNode',- math: 'unique_group',- name: 'User signed up (self-hosted Clickhouse)',- properties: [- {- key: 'is_organization_first_user',- type: 'event',- value: ['true'],- operator: 'exact',- },- ],- custom_name: 'Open Source Signups',- math_group_type_index: 0,- },- ],- interval: 'week',- dateRange: { date_to: null, date_from: '-90d' },- properties: {- type: 'AND',- values: [- {- type: 'AND',- values: [- {- key: 'email',- type: 'event',- value: 'posthog.com',- operator: 'not_icontains',- },- {- key: 'organization_name',- type: 'group',- value: ['teste'],- operator: 'is_not',- group_type_index: 0,- },- {- key: 'organization_name',- type: 'group',- value: ['HOgflix movie'],- operator: 'is_not',- group_type_index: 0,- },- ],- },- ],- },- trendsFilter: {- display: 'ActionsLineGraph',- show_legend: false,- smoothing_intervals: 1,- show_values_on_series: true,- compare: true,- },- filterTestAccounts: false,- version: 2,- },- },- title: 'Weekly Org Signups',- __init: null,- height: null,- nodeId: '564e15f2-78a0-4ff9-837d-c871aa71c2ef',- children: null,- },- },- ],- [- {- type: 'ph-query',- attrs: {- query: {- kind: 'InsightVizNode',- source: {- kind: 'TrendsQuery',- series: [- {- id: '2674',- kind: 'ActionsNode',- math: 'unique_group',- name: 'User Signed Up (Comprehensive)',- properties: [- {- key: 'is_organization_first_user',- type: 'event',- value: ['true'],- operator: 'exact',- },- ],- custom_name: 'All Org Signups',- math_group_type_index: 0,- },- {- id: '2674',- kind: 'ActionsNode',- math: 'unique_group',- name: 'User Signed Up (Comprehensive)',- properties: [- {- key: 'id',- type: 'cohort',- value: 15394,- operator: null,- },- {- key: 'is_organization_first_user',- type: 'event',- value: ['true'],- operator: 'exact',- },- ],- custom_name: 'High ICP Organizations',- math_group_type_index: 0,- },- {- id: '8231',- kind: 'ActionsNode',- math: 'unique_group',- name: 'User Signed Up (Cloud)',- properties: [- {- key: 'is_organization_first_user',- type: 'event',- value: ['true'],- operator: 'exact',- },- ],- custom_name: 'Cloud Signups',- math_group_type_index: 0,- },- {- id: '9847',- kind: 'ActionsNode',- math: 'unique_group',- name: 'User signed up (self-hosted Clickhouse)',- properties: [- {- key: 'is_organization_first_user',- type: 'event',- value: ['true'],- operator: 'exact',- },- ],- custom_name: 'Open Source Signups',- math_group_type_index: 0,- },- ],- interval: 'week',- dateRange: { date_to: null, date_from: '-90d' },- properties: {- type: 'AND',- values: [- {- type: 'AND',- values: [- {- key: 'email',- type: 'event',- value: 'posthog.com',- operator: 'not_icontains',- },- {- key: 'organization_name',- type: 'group',- value: ['teste'],- operator: 'is_not',- group_type_index: 0,- },- {- key: 'organization_name',- type: 'group',- value: ['HOgflix movie'],- operator: 'is_not',- group_type_index: 0,- },- ],- },- ],- },- trendsFilter: {- display: 'ActionsLineGraph',- showLegend: false,- smoothingIntervals: 1,- showValuesOnSeries: true,- },- compareFilter: { compare: true },- filterTestAccounts: false,- version: LATEST_VERSIONS[NodeKind.TrendsQuery],- },- },- title: 'Weekly Org Signups',- __init: null,- height: null,- nodeId: '564e15f2-78a0-4ff9-837d-c871aa71c2ef',- children: null,- },- },- ],- ],- [- 'migrates compare from previously migrated trends query',- [- {- type: 'ph-query',- attrs: {- query: {- kind: 'InsightVizNode',- source: {- kind: 'TrendsQuery',- series: [- {- kind: 'EventsNode',- event: '$pageview',- },- ],- trendsFilter: {- compare: true,- aggregationAxisFormat: 'percentage',- },- version: 2,- },- },- title: 'Some insight',- __init: null,- height: null,- nodeId: '4c2a07ee-fc9f-45c5-b36c-5e14a10f8e22',- children: null,- },- },- ],- [- {- type: 'ph-query',- attrs: {- query: {- kind: 'InsightVizNode',- source: {- kind: 'TrendsQuery',- series: [- {- kind: 'EventsNode',- event: '$pageview',- },- ],- trendsFilter: {- aggregationAxisFormat: 'percentage',- },- compareFilter: {- compare: true,- },- version: LATEST_VERSIONS[NodeKind.TrendsQuery],- },- },- title: 'Some insight',- __init: null,- height: null,- nodeId: '4c2a07ee-fc9f-45c5-b36c-5e14a10f8e22',- children: null,- },- },- ],- ],-- [- 'migrates compare from previously migrated stickiness query',- [- {- type: 'ph-query',- attrs: {- query: {- kind: 'InsightVizNode',- source: {- kind: 'StickinessQuery',- series: [- {- kind: 'EventsNode',- event: '$pageview',- },- ],- stickinessFilter: {- compare: true,- showValuesOnSeries: true,- },- version: 2,- },- },- title: 'Some insight',- __init: null,- height: null,- nodeId: '4c2a07ee-fc9f-45c5-b36c-5e14a10f8e22',- children: null,- },- },- ],- [- {- type: 'ph-query',- attrs: {- query: {- kind: 'InsightVizNode',- source: {- kind: 'StickinessQuery',- series: [- {- kind: 'EventsNode',- event: '$pageview',- },- ],- stickinessFilter: {- showValuesOnSeries: true,- },- compareFilter: {- compare: true,- },- version: LATEST_VERSIONS[NodeKind.StickinessQuery],- },- },- title: 'Some insight',- __init: null,- height: null,- nodeId: '4c2a07ee-fc9f-45c5-b36c-5e14a10f8e22',- children: null,- },- },- ],- ],]it.each(contentToExpected)('migrates %s', async (_name, prevContent, nextContent) => {diff --git a/frontend/src/scenes/notebooks/Notebook/migrations/migrate.ts b/frontend/src/scenes/notebooks/Notebook/migrations/migrate.tsindex 6779521d7745..a0d3be3e3b12 100644--- a/frontend/src/scenes/notebooks/Notebook/migrations/migrate.ts+++ b/frontend/src/scenes/notebooks/Notebook/migrations/migrate.ts@@ -1,43 +1,13 @@import { JSONContent } from '@tiptap/core'import api from 'lib/api'-import { isEmptyObject } from 'lib/utils/guards'import { NotebookNodePlaylistAttributes } from 'scenes/notebooks/Nodes/NotebookNodePlaylist'import { NotebookNodeType, NotebookType } from 'scenes/notebooks/types'import { convertLegacyFiltersToUniversalFilters } from 'scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic'-import {- breakdownFilterToQuery,- compareFilterToQuery,- exlusionEntityToNode,- funnelsFilterToQuery,- lifecycleFilterToQuery,- pathsFilterToQuery,- retentionFilterToQuery,- stickinessFilterToQuery,- trendsFilterToQuery,-} from '~/queries/nodes/InsightQuery/utils/filtersToQueryNode'-import {- isLegacyFunnelsExclusion,- isLegacyFunnelsFilter,- isLegacyLifecycleFilter,- isLegacyPathsFilter,- isLegacyRetentionFilter,- isLegacyStickinessFilter,- isLegacyTrendsFilter,-} from '~/queries/nodes/InsightQuery/utils/legacy'-import {- InsightVizNode,- NodeKind,- STICKINESS_FILTER_PROPERTIES,- StickinessFilter,- StickinessFilterLegacy,- TRENDS_FILTER_PROPERTIES,- TrendsFilter,- TrendsFilterLegacy,-} from '~/queries/schema/schema-general'+import { NodeKind } from '~/queries/schema/schema-general'import { checkLatestVersionsOnQuery } from '~/queries/utils'-import { FunnelExclusionLegacy, LegacyRecordingFilters } from '~/types'+import { LegacyRecordingFilters } from '~/types'import { convertMarkdownTablesInContent } from './convertMarkdownTablesInContent'@@ -64,7 +34,6 @@ export async function migrate(notebook: NotebookType, options: MigrateOptions =content = convertInsightToQueryNode(content)content = convertInsightQueryStringsToObjects(content)- content = convertInsightQueriesToNewSchema(content)content = convertPlaylistFiltersToUniversalFilters(content)content = convertMarkdownTablesInContent(content)if (!options.skipApiUpgrade) {@@ -162,101 +131,6 @@ function convertInsightQueryStringsToObjects(content: JSONContent[]): JSONConten})}-function convertInsightQueriesToNewSchema(content: JSONContent[]): JSONContent[] {- return content.map((node) => {- if (- !(- node.type == NotebookNodeType.Query &&- node.attrs &&- 'query' in node.attrs &&- typeof node.attrs.query === 'object' &&- node.attrs.query['kind'] === 'InsightVizNode'- )- ) {- return node- }-- const insightQuery = node.attrs.query as InsightVizNode- const query = insightQuery.source-- /*- * Insight filters- */- if (query.kind === NodeKind.TrendsQuery && isLegacyTrendsFilter(query.trendsFilter as any)) {- const compareFilter = compareFilterToQuery(query.trendsFilter as any)- if (!isEmptyObject(compareFilter)) {- query.compareFilter = compareFilter- }-- delete (query.trendsFilter as TrendsFilterLegacy).compare- delete (query.trendsFilter as TrendsFilterLegacy).compare_to-- query.trendsFilter = Object.fromEntries(- Object.entries(query.trendsFilter as TrendsFilter)- .filter(([k, _]) => TRENDS_FILTER_PROPERTIES.has(k as keyof TrendsFilter))- .concat(Object.entries(trendsFilterToQuery(query.trendsFilter as any)))- )- }-- if (query.kind === NodeKind.FunnelsQuery) {- if (isLegacyFunnelsFilter(query.funnelsFilter as any)) {- query.funnelsFilter = funnelsFilterToQuery(query.funnelsFilter as any)- } else if (isLegacyFunnelsExclusion(query.funnelsFilter as any)) {- query.funnelsFilter = {- ...query.funnelsFilter,- exclusions: query.funnelsFilter!.exclusions!.map((entity) =>- exlusionEntityToNode(entity as unknown as FunnelExclusionLegacy)- ),- }- }- }-- if (query.kind === NodeKind.RetentionQuery && isLegacyRetentionFilter(query.retentionFilter as any)) {- query.retentionFilter = retentionFilterToQuery(query.retentionFilter as any)- }-- if (query.kind === NodeKind.PathsQuery && isLegacyPathsFilter(query.pathsFilter as any)) {- query.pathsFilter = pathsFilterToQuery(query.pathsFilter as any)- }-- if (query.kind === NodeKind.StickinessQuery && isLegacyStickinessFilter(query.stickinessFilter as any)) {- const compareFilter = compareFilterToQuery(query.stickinessFilter as any)- if (!isEmptyObject(compareFilter)) {- query.compareFilter = compareFilter- }- delete (query.stickinessFilter as StickinessFilterLegacy).compare- delete (query.stickinessFilter as StickinessFilterLegacy).compare_to-- // This has to come after compare, because it removes compare- query.stickinessFilter = Object.fromEntries(- Object.entries(query.stickinessFilter as StickinessFilter)- .filter(([k, _]) => STICKINESS_FILTER_PROPERTIES.has(k as keyof StickinessFilter))- .concat(Object.entries(stickinessFilterToQuery(query.stickinessFilter as any)))- )- }-- if (query.kind === NodeKind.LifecycleQuery && isLegacyLifecycleFilter(query.lifecycleFilter as any)) {- query.lifecycleFilter = lifecycleFilterToQuery(query.lifecycleFilter as any)- }-- /*- * Breakdown- */- if ((query.kind === NodeKind.TrendsQuery || query.kind === NodeKind.FunnelsQuery) && 'breakdown' in query) {- query.breakdownFilter = breakdownFilterToQuery(query.breakdown as any, query.kind === NodeKind.TrendsQuery)- delete query.breakdown- }-- return {- ...node,- attrs: {- ...node.attrs,- query: insightQuery,- },- }- })-}-async function upgradeQueryNode(content: JSONContent[]): Promise<JSONContent[]> {return Promise.all(content.map(async (node) => {