Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

ralph(M15-130): The findings no rule covers: packages/core/src/modules/export

ralph0aa32e300056
diff --git a/packages/core/src/modules/export/export.routes.ts b/packages/core/src/modules/export/export.routes.ts
index 342a6d934..ef7394ed8 100644
--- a/packages/core/src/modules/export/export.routes.ts
+++ b/packages/core/src/modules/export/export.routes.ts
@@ -57,10 +57,7 @@ import {
gscGetTopQueriesCore,
} from '../gsc/gsc.service';
import { getSettingsForProject } from '../organization/organization.service';
-import type {
- IGetTopGenericInput,
- TrafficColumn,
-} from '../overview/overview.service';
+import type { IGetTopGenericInput } from '../overview/overview.service';
import {
getAnalyticsOverviewCore,
getTrafficBreakdownCore,
@@ -164,6 +161,13 @@ const zExportEvents = z.object({
.optional(),
});
+const zExportChartSeriesItem = z.object({
+ name: z.string(),
+ filters: zChartEvent.shape.filters.optional(),
+ segment: zChartEvent.shape.segment.optional(),
+ property: zChartEvent.shape.property.optional(),
+});
+
const zExportCharts = zReport
.pick({
breakdowns: true,
@@ -176,27 +180,9 @@ const zExportCharts = zReport
.extend({
project_id: z.string().optional(),
projectId: z.string().optional(),
- series: z
- .array(
- z.object({
- name: z.string(),
- filters: zChartEvent.shape.filters.optional(),
- segment: zChartEvent.shape.segment.optional(),
- property: zChartEvent.shape.property.optional(),
- })
- )
- .optional(),
+ series: z.array(zExportChartSeriesItem).optional(),
// Backward compatibility - events will be migrated to series via preprocessing
- events: z
- .array(
- z.object({
- name: z.string(),
- filters: zChartEvent.shape.filters.optional(),
- segment: zChartEvent.shape.segment.optional(),
- property: zChartEvent.shape.property.optional(),
- })
- )
- .optional(),
+ events: z.array(zExportChartSeriesItem).optional(),
});
export const exportRoutes = defineRoutes((app) =>
@@ -1052,7 +1038,7 @@ export const insightsRoutes = defineRoutes((app) =>
projectId,
startDate,
endDate,
- column: query.breakdown as TrafficColumn,
+ column: query.breakdown,
});
},
{
@@ -1078,7 +1064,7 @@ export const insightsRoutes = defineRoutes((app) =>
projectId,
startDate,
endDate,
- column: query.breakdown as TrafficColumn,
+ column: query.breakdown,
});
},
{
@@ -1105,7 +1091,7 @@ export const insightsRoutes = defineRoutes((app) =>
projectId,
startDate,
endDate,
- column: query.breakdown as TrafficColumn,
+ column: query.breakdown,
});
},
{
diff --git a/packages/core/src/modules/export/export.service.ts b/packages/core/src/modules/export/export.service.ts
index c004f7eb9..f0a15d2f3 100644
--- a/packages/core/src/modules/export/export.service.ts
+++ b/packages/core/src/modules/export/export.service.ts
@@ -1,5 +1,5 @@
// The export module owns no data of its own — it is the public read API
-// (`/export` + `/insights`, ~35 GET routes, TARGET_ARCHITECTURE §7). Every
+// (`/export` + `/insights`, 56 GET routes, TARGET_ARCHITECTURE §7). Every
// handler in `export.routes.ts` is a thin delegate onto the overview/chart/
// event/session/profile/group/gsc/report services already ported to core
// (M7-001..006). This file holds only the plumbing every route shares —