(input: {
projectId: string;
startDate: string;
endDate: string;
startEvent: string;
endEvent?: string;
mode: 'after' | 'before' | 'between';
steps?: number;
exclude?: string[];
include?: string[];
})
| 796 | } |
| 797 | |
| 798 | export 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 | } |
no test coverage detected