MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / getUserFlowCore

Function getUserFlowCore

packages/db/src/services/sankey.service.ts:798–836  ·  view source on GitHub ↗
(input: {
  projectId: string;
  startDate: string;
  endDate: string;
  startEvent: string;
  endEvent?: string;
  mode: 'after' | 'before' | 'between';
  steps?: number;
  exclude?: string[];
  include?: string[];
})

Source from the content-addressed store, hash-verified

796}
797
798export async function getUserFlowCore(input: {
799 projectId: string;
800 startDate: string;
801 endDate: string;
802 startEvent: string;
803 endEvent?: string;
804 mode: 'after' | 'before' | 'between';
805 steps?: number;
806 exclude?: string[];
807 include?: string[];
808}) {
809 if (input.mode === 'between' && !input.endEvent) {
810 throw new Error('endEvent is required when mode is "between"');
811 }
812
813 const { timezone } = await getSettingsForProject(input.projectId);
814 const result = await sankeyService.getSankey({
815 projectId: input.projectId,
816 startDate: input.startDate,
817 endDate: input.endDate,
818 steps: input.steps ?? 5,
819 mode: input.mode,
820 startEvent: toChartEvent(input.startEvent),
821 endEvent: input.endEvent ? toChartEvent(input.endEvent) : undefined,
822 exclude: input.exclude ?? [],
823 include: input.include,
824 timezone,
825 });
826
827 return {
828 mode: input.mode,
829 startEvent: input.startEvent,
830 endEvent: input.endEvent,
831 node_count: result.nodes.length,
832 link_count: result.links.length,
833 nodes: result.nodes,
834 links: result.links,
835 };
836}

Callers 3

registerUserFlowToolsFunction · 0.90
getUserFlowFunction · 0.90
base.tsFile · 0.90

Calls 3

getSettingsForProjectFunction · 0.90
toChartEventFunction · 0.85
getSankeyMethod · 0.80

Tested by

no test coverage detected