drizzle-cube 0.3.13 → 0.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.d.ts +8 -1
- package/dist/adapters/express/index.js +162 -99
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.d.ts +8 -1
- package/dist/adapters/fastify/index.js +183 -96
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.d.ts +8 -1
- package/dist/adapters/hono/index.js +198 -142
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.d.ts +29 -1
- package/dist/adapters/nextjs/index.js +251 -132
- package/dist/adapters/utils.d.ts +100 -1
- package/dist/adapters/validation-Bgauxvm6.cjs +214 -0
- package/dist/adapters/{compiler-DTOU8IsK.js → validation-_UkKJ2pC.js} +9582 -5295
- package/dist/client/adapters/index.d.ts +2 -0
- package/dist/client/adapters/retentionModeAdapter.d.ts +3 -0
- package/dist/client/charts.js +12 -12
- package/dist/client/chunks/RetentionCombinedChart-DirfDaZH.js +256 -0
- package/dist/client/chunks/RetentionCombinedChart-DirfDaZH.js.map +1 -0
- package/dist/client/chunks/RetentionCombinedChart.config-C-ILIaEb.js +47 -0
- package/dist/client/chunks/RetentionCombinedChart.config-C-ILIaEb.js.map +1 -0
- package/dist/client/chunks/RetentionHeatmap-Bofadstm.js +178 -0
- package/dist/client/chunks/RetentionHeatmap-Bofadstm.js.map +1 -0
- package/dist/client/chunks/RetentionHeatmap.config-CIvhc-GT.js +28 -0
- package/dist/client/chunks/RetentionHeatmap.config-CIvhc-GT.js.map +1 -0
- package/dist/client/chunks/analysis-builder-APeCxkEH.js +6939 -0
- package/dist/client/chunks/analysis-builder-APeCxkEH.js.map +1 -0
- package/dist/client/chunks/analysis-builder-shared-DEovRjrp.js +2779 -0
- package/dist/client/chunks/analysis-builder-shared-DEovRjrp.js.map +1 -0
- package/dist/client/chunks/{chart-activity-grid-CuPARsr1.js → chart-activity-grid-BnweuBvr.js} +11 -11
- package/dist/client/chunks/{chart-activity-grid-CuPARsr1.js.map → chart-activity-grid-BnweuBvr.js.map} +1 -1
- package/dist/client/chunks/{chart-area-cPrJnhLj.js → chart-area-DLmXFWWy.js} +2 -2
- package/dist/client/chunks/{chart-area-cPrJnhLj.js.map → chart-area-DLmXFWWy.js.map} +1 -1
- package/dist/client/chunks/{chart-bar-D68HFPpa.js → chart-bar-7y0-F27Q.js} +2 -2
- package/dist/client/chunks/{chart-bar-D68HFPpa.js.map → chart-bar-7y0-F27Q.js.map} +1 -1
- package/dist/client/chunks/{chart-bubble-CquyYfNO.js → chart-bubble-3jYKCA2B.js} +2 -2
- package/dist/client/chunks/{chart-bubble-CquyYfNO.js.map → chart-bubble-3jYKCA2B.js.map} +1 -1
- package/dist/client/chunks/{chart-config-activity-grid-Bkvx0F-G.js → chart-config-activity-grid-BBSNCbkb.js} +2 -2
- package/dist/client/chunks/{chart-config-activity-grid-Bkvx0F-G.js.map → chart-config-activity-grid-BBSNCbkb.js.map} +1 -1
- package/dist/client/chunks/{chart-config-area-OApsRaYC.js → chart-config-area-CyyJOO2T.js} +2 -2
- package/dist/client/chunks/{chart-config-area-OApsRaYC.js.map → chart-config-area-CyyJOO2T.js.map} +1 -1
- package/dist/client/chunks/{chart-config-bar-Dy21oaIA.js → chart-config-bar-BJKGnfLt.js} +2 -2
- package/dist/client/chunks/{chart-config-bar-Dy21oaIA.js.map → chart-config-bar-BJKGnfLt.js.map} +1 -1
- package/dist/client/chunks/{chart-config-bubble-Chv0SoFm.js → chart-config-bubble-CuSsCHZ4.js} +2 -2
- package/dist/client/chunks/{chart-config-bubble-Chv0SoFm.js.map → chart-config-bubble-CuSsCHZ4.js.map} +1 -1
- package/dist/client/chunks/{chart-config-data-table-DTIdC35a.js → chart-config-data-table-BhgqwoqT.js} +2 -2
- package/dist/client/chunks/{chart-config-data-table-DTIdC35a.js.map → chart-config-data-table-BhgqwoqT.js.map} +1 -1
- package/dist/client/chunks/{chart-config-funnel-f17Livgr.js → chart-config-funnel-BlSQYng0.js} +4 -4
- package/dist/client/chunks/{chart-config-funnel-f17Livgr.js.map → chart-config-funnel-BlSQYng0.js.map} +1 -1
- package/dist/client/chunks/{chart-config-heat-map-DPhNICha.js → chart-config-heat-map-DHQGFZhX.js} +2 -2
- package/dist/client/chunks/{chart-config-heat-map-DPhNICha.js.map → chart-config-heat-map-DHQGFZhX.js.map} +1 -1
- package/dist/client/chunks/{chart-config-kpi-delta-CCl1d-St.js → chart-config-kpi-delta-yTA5ug_l.js} +2 -2
- package/dist/client/chunks/{chart-config-kpi-delta-CCl1d-St.js.map → chart-config-kpi-delta-yTA5ug_l.js.map} +1 -1
- package/dist/client/chunks/{chart-config-kpi-number-DkE3eSwH.js → chart-config-kpi-number-nVAwDXzq.js} +2 -2
- package/dist/client/chunks/{chart-config-kpi-number-DkE3eSwH.js.map → chart-config-kpi-number-nVAwDXzq.js.map} +1 -1
- package/dist/client/chunks/{chart-config-kpi-text-BMbgdxZm.js → chart-config-kpi-text-DZjqsx-b.js} +2 -2
- package/dist/client/chunks/{chart-config-kpi-text-BMbgdxZm.js.map → chart-config-kpi-text-DZjqsx-b.js.map} +1 -1
- package/dist/client/chunks/{chart-config-line-BnLlRUQE.js → chart-config-line-DR0ThxZy.js} +2 -2
- package/dist/client/chunks/{chart-config-line-BnLlRUQE.js.map → chart-config-line-DR0ThxZy.js.map} +1 -1
- package/dist/client/chunks/{chart-config-markdown-DIaMFC0Z.js → chart-config-markdown-DZxdGNVQ.js} +2 -2
- package/dist/client/chunks/{chart-config-markdown-DIaMFC0Z.js.map → chart-config-markdown-DZxdGNVQ.js.map} +1 -1
- package/dist/client/chunks/{chart-config-pie-O9y_T0BQ.js → chart-config-pie-BM5lgH-w.js} +2 -2
- package/dist/client/chunks/{chart-config-pie-O9y_T0BQ.js.map → chart-config-pie-BM5lgH-w.js.map} +1 -1
- package/dist/client/chunks/{chart-config-radar-CXa0354h.js → chart-config-radar-BBAVIF0S.js} +2 -2
- package/dist/client/chunks/{chart-config-radar-CXa0354h.js.map → chart-config-radar-BBAVIF0S.js.map} +1 -1
- package/dist/client/chunks/{chart-config-radial-bar-BppJU8-Q.js → chart-config-radial-bar-CTwjDRnB.js} +2 -2
- package/dist/client/chunks/{chart-config-radial-bar-BppJU8-Q.js.map → chart-config-radial-bar-CTwjDRnB.js.map} +1 -1
- package/dist/client/chunks/{chart-config-sankey-BfBHgL4x.js → chart-config-sankey-CNAgsMQ4.js} +2 -2
- package/dist/client/chunks/{chart-config-sankey-BfBHgL4x.js.map → chart-config-sankey-CNAgsMQ4.js.map} +1 -1
- package/dist/client/chunks/{chart-config-scatter-BTt8a10R.js → chart-config-scatter-CWvN2E-X.js} +2 -2
- package/dist/client/chunks/{chart-config-scatter-BTt8a10R.js.map → chart-config-scatter-CWvN2E-X.js.map} +1 -1
- package/dist/client/chunks/{chart-config-sunburst-DNmQpIIx.js → chart-config-sunburst-W_SKwaj0.js} +4 -4
- package/dist/client/chunks/{chart-config-sunburst-DNmQpIIx.js.map → chart-config-sunburst-W_SKwaj0.js.map} +1 -1
- package/dist/client/chunks/{chart-config-tree-map-HVgG4oa0.js → chart-config-tree-map-CLmRvvMR.js} +2 -2
- package/dist/client/chunks/{chart-config-tree-map-HVgG4oa0.js.map → chart-config-tree-map-CLmRvvMR.js.map} +1 -1
- package/dist/client/chunks/{chart-data-table-D4WDqbM0.js → chart-data-table-rUFLqysu.js} +4 -4
- package/dist/client/chunks/{chart-data-table-D4WDqbM0.js.map → chart-data-table-rUFLqysu.js.map} +1 -1
- package/dist/client/chunks/{chart-funnel-Csdn4FbN.js → chart-funnel-C7zGBfSw.js} +2 -2
- package/dist/client/chunks/{chart-funnel-Csdn4FbN.js.map → chart-funnel-C7zGBfSw.js.map} +1 -1
- package/dist/client/chunks/{chart-heat-map-v1afxnjq.js → chart-heat-map-B-l8hK8b.js} +2 -2
- package/dist/client/chunks/{chart-heat-map-v1afxnjq.js.map → chart-heat-map-B-l8hK8b.js.map} +1 -1
- package/dist/client/chunks/chart-kpi-delta-sfZEvQZm.js +351 -0
- package/dist/client/chunks/chart-kpi-delta-sfZEvQZm.js.map +1 -0
- package/dist/client/chunks/chart-kpi-number-BxGNOtzI.js +473 -0
- package/dist/client/chunks/chart-kpi-number-BxGNOtzI.js.map +1 -0
- package/dist/client/chunks/{chart-kpi-text-CRp8QWYG.js → chart-kpi-text-BLQ_CWQP.js} +3 -3
- package/dist/client/chunks/{chart-kpi-text-CRp8QWYG.js.map → chart-kpi-text-BLQ_CWQP.js.map} +1 -1
- package/dist/client/chunks/{chart-line-DqqE7ky9.js → chart-line-FSEpBk6Y.js} +5 -5
- package/dist/client/chunks/{chart-line-DqqE7ky9.js.map → chart-line-FSEpBk6Y.js.map} +1 -1
- package/dist/client/chunks/{chart-pie-B5WBzIRH.js → chart-pie-BRQEH9e-.js} +2 -2
- package/dist/client/chunks/{chart-pie-B5WBzIRH.js.map → chart-pie-BRQEH9e-.js.map} +1 -1
- package/dist/client/chunks/{chart-radar-DL_dvhA-.js → chart-radar-DgsFyiIP.js} +2 -2
- package/dist/client/chunks/{chart-radar-DL_dvhA-.js.map → chart-radar-DgsFyiIP.js.map} +1 -1
- package/dist/client/chunks/{chart-radial-bar-DDRo6nz-.js → chart-radial-bar-CUMoXyl9.js} +2 -2
- package/dist/client/chunks/{chart-radial-bar-DDRo6nz-.js.map → chart-radial-bar-CUMoXyl9.js.map} +1 -1
- package/dist/client/chunks/{chart-sankey-C_bgIfg-.js → chart-sankey-IAKDEe7A.js} +2 -2
- package/dist/client/chunks/{chart-sankey-C_bgIfg-.js.map → chart-sankey-IAKDEe7A.js.map} +1 -1
- package/dist/client/chunks/{chart-scatter-DjmJRlK0.js → chart-scatter-D6XwOD2W.js} +15 -15
- package/dist/client/chunks/{chart-scatter-DjmJRlK0.js.map → chart-scatter-D6XwOD2W.js.map} +1 -1
- package/dist/client/chunks/{chart-sunburst-CbMEnaes.js → chart-sunburst-CP_pnj0S.js} +2 -2
- package/dist/client/chunks/{chart-sunburst-CbMEnaes.js.map → chart-sunburst-CP_pnj0S.js.map} +1 -1
- package/dist/client/chunks/{chart-tree-map-DEfJtJVC.js → chart-tree-map-DQMsn47a.js} +30 -30
- package/dist/client/chunks/{chart-tree-map-DEfJtJVC.js.map → chart-tree-map-DQMsn47a.js.map} +1 -1
- package/dist/client/chunks/chartConfigRegistry-BumUIPw4.js +44 -0
- package/dist/client/chunks/{chartConfigRegistry-CiOq-PqX.js.map → chartConfigRegistry-BumUIPw4.js.map} +1 -1
- package/dist/client/chunks/charts-Dk_9XrA7.js +230 -0
- package/dist/client/chunks/charts-Dk_9XrA7.js.map +1 -0
- package/dist/client/chunks/{charts-core-CXrhEEVF.js → charts-core-CjQZBxmv.js} +10 -10
- package/dist/client/chunks/{charts-core-CXrhEEVF.js.map → charts-core-CjQZBxmv.js.map} +1 -1
- package/dist/client/chunks/{charts-loader-BtsnUO4Q.js → charts-loader-ChTUa_-G.js} +30 -28
- package/dist/client/chunks/charts-loader-ChTUa_-G.js.map +1 -0
- package/dist/client/chunks/{components-BDrlf9Er.js → components-BKZ7EAg0.js} +3575 -3208
- package/dist/client/chunks/components-BKZ7EAg0.js.map +1 -0
- package/dist/client/chunks/{core-B8zw0qRf.js → core-BRC075EG.js} +2 -2
- package/dist/client/chunks/{core-B8zw0qRf.js.map → core-BRC075EG.js.map} +1 -1
- package/dist/client/chunks/hooks-D7APQ8uS.js +150 -0
- package/dist/client/chunks/{hooks-B8Zw5PfL.js.map → hooks-D7APQ8uS.js.map} +1 -1
- package/dist/client/chunks/{icons-NzFHtqeM.js → icons-DRreo6m8.js} +128 -112
- package/dist/client/chunks/{icons-NzFHtqeM.js.map → icons-DRreo6m8.js.map} +1 -1
- package/dist/client/chunks/{providers-CqCiJTEj.js → providers-Cj7PQfXn.js} +2 -2
- package/dist/client/chunks/{providers-CqCiJTEj.js.map → providers-Cj7PQfXn.js.map} +1 -1
- package/dist/client/chunks/retention-CzCo8262.js +120 -0
- package/dist/client/chunks/retention-CzCo8262.js.map +1 -0
- package/dist/client/chunks/{useDirtyStateTracking-C_mitVwh.js → useDirtyStateTracking-ZSi3voVl.js} +101 -99
- package/dist/client/chunks/useDirtyStateTracking-ZSi3voVl.js.map +1 -0
- package/dist/client/chunks/{vendor-DzzxS7Ay.js → vendor-cTQhZ_G3.js} +549 -541
- package/dist/client/chunks/vendor-cTQhZ_G3.js.map +1 -0
- package/dist/client/components/AnalysisBuilder/AnalysisTypeSelector.d.ts +3 -1
- package/dist/client/components/AnalysisBuilder/RetentionConfigPanel.d.ts +36 -0
- package/dist/client/components/AnalysisBuilder/RetentionModeContent.d.ts +71 -0
- package/dist/client/components/AnalysisBuilder/types.d.ts +99 -0
- package/dist/client/components/DebugModal.d.ts +2 -1
- package/dist/client/components/charts/RetentionCombinedChart.config.d.ts +2 -0
- package/dist/client/components/charts/RetentionCombinedChart.d.ts +14 -0
- package/dist/client/components/charts/RetentionHeatmap.config.d.ts +2 -0
- package/dist/client/components/charts/RetentionHeatmap.d.ts +7 -0
- package/dist/client/components.js +2 -2
- package/dist/client/hooks/queries/index.d.ts +2 -1
- package/dist/client/hooks/queries/useDryRunQuery.d.ts +26 -0
- package/dist/client/hooks/queries/useExplainQuery.d.ts +3 -1
- package/dist/client/hooks/queries/useFlowQuery.d.ts +5 -0
- package/dist/client/hooks/queries/useRetentionQuery.d.ts +67 -0
- package/dist/client/hooks/useAnalysisBuilderHook.d.ts +61 -0
- package/dist/client/hooks/useAnalysisQueryExecution.d.ts +42 -1
- package/dist/client/hooks.js +3 -3
- package/dist/client/icons/customIcons.d.ts +7 -0
- package/dist/client/icons/types.d.ts +1 -0
- package/dist/client/icons.js +1 -1
- package/dist/client/index.js +11 -11
- package/dist/client/providers.js +1 -1
- package/dist/client/stores/analysisBuilderStore.d.ts +86 -1
- package/dist/client/stores/dashboardStore.d.ts +2 -1
- package/dist/client/stores/slices/index.d.ts +2 -0
- package/dist/client/stores/slices/retentionSlice.d.ts +66 -0
- package/dist/client/styles.css +1 -1
- package/dist/client/types/analysisConfig.d.ts +29 -4
- package/dist/client/types/funnel.d.ts +5 -0
- package/dist/client/types/retention.d.ts +301 -0
- package/dist/client/types.d.ts +6 -3
- package/dist/client-bundle-stats.html +1 -1
- package/dist/server/index.cjs +101 -79
- package/dist/server/index.d.ts +427 -0
- package/dist/server/index.js +9140 -4934
- package/package.json +5 -2
- package/dist/adapters/compiler-CO13DaEb.cjs +0 -192
- package/dist/client/chunks/analysis-builder-Dc9NrG_N.js +0 -6013
- package/dist/client/chunks/analysis-builder-Dc9NrG_N.js.map +0 -1
- package/dist/client/chunks/analysis-builder-shared-B3-UWqQ2.js +0 -2540
- package/dist/client/chunks/analysis-builder-shared-B3-UWqQ2.js.map +0 -1
- package/dist/client/chunks/chart-kpi-delta-Bs5R5xr4.js +0 -435
- package/dist/client/chunks/chart-kpi-delta-Bs5R5xr4.js.map +0 -1
- package/dist/client/chunks/chart-kpi-number-Cf4Pgkm9.js +0 -392
- package/dist/client/chunks/chart-kpi-number-Cf4Pgkm9.js.map +0 -1
- package/dist/client/chunks/chartConfigRegistry-CiOq-PqX.js +0 -44
- package/dist/client/chunks/charts-loader-BtsnUO4Q.js.map +0 -1
- package/dist/client/chunks/charts-xNubY0vm.js +0 -226
- package/dist/client/chunks/charts-xNubY0vm.js.map +0 -1
- package/dist/client/chunks/components-BDrlf9Er.js.map +0 -1
- package/dist/client/chunks/hooks-B8Zw5PfL.js +0 -123
- package/dist/client/chunks/useDirtyStateTracking-C_mitVwh.js.map +0 -1
- package/dist/client/chunks/vendor-DzzxS7Ay.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChartType, ChartAxisConfig, ChartDisplayConfig, CubeQuery, MultiQueryConfig } from '../types';
|
|
2
2
|
import { ServerFunnelQuery } from './funnel';
|
|
3
3
|
import { ServerFlowQuery } from './flow';
|
|
4
|
+
import { ServerRetentionQuery } from './retention';
|
|
4
5
|
/**
|
|
5
6
|
* Chart configuration - shared across all analysis types
|
|
6
7
|
*/
|
|
@@ -11,9 +12,9 @@ export interface ChartConfig {
|
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* Analysis type discriminator
|
|
14
|
-
* Future modes: '
|
|
15
|
+
* Future modes: 'cohort'
|
|
15
16
|
*/
|
|
16
|
-
export type AnalysisType = 'query' | 'funnel' | 'flow';
|
|
17
|
+
export type AnalysisType = 'query' | 'funnel' | 'flow' | 'retention';
|
|
17
18
|
/**
|
|
18
19
|
* Base config - common to all analysis types
|
|
19
20
|
*/
|
|
@@ -77,10 +78,25 @@ export interface FlowAnalysisConfig extends AnalysisConfigBase {
|
|
|
77
78
|
*/
|
|
78
79
|
query: ServerFlowQuery;
|
|
79
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Retention mode config - for cohort-based retention analysis
|
|
83
|
+
*
|
|
84
|
+
* The `query` field is the ServerRetentionQuery which can be sent
|
|
85
|
+
* directly to the server for execution.
|
|
86
|
+
*/
|
|
87
|
+
export interface RetentionAnalysisConfig extends AnalysisConfigBase {
|
|
88
|
+
analysisType: 'retention';
|
|
89
|
+
/**
|
|
90
|
+
* Server retention query - executable as-is.
|
|
91
|
+
* Contains cohortTimeDimension, activityTimeDimension, bindingKey,
|
|
92
|
+
* granularity settings, and period configuration.
|
|
93
|
+
*/
|
|
94
|
+
query: ServerRetentionQuery;
|
|
95
|
+
}
|
|
80
96
|
/**
|
|
81
97
|
* AnalysisConfig - union of all analysis mode configurations
|
|
82
98
|
*/
|
|
83
|
-
export type AnalysisConfig = QueryAnalysisConfig | FunnelAnalysisConfig | FlowAnalysisConfig;
|
|
99
|
+
export type AnalysisConfig = QueryAnalysisConfig | FunnelAnalysisConfig | FlowAnalysisConfig | RetentionAnalysisConfig;
|
|
84
100
|
/**
|
|
85
101
|
* Check if config is for query mode
|
|
86
102
|
*/
|
|
@@ -93,6 +109,10 @@ export declare const isFunnelConfig: (c: AnalysisConfig) => c is FunnelAnalysisC
|
|
|
93
109
|
* Check if config is for flow mode
|
|
94
110
|
*/
|
|
95
111
|
export declare const isFlowConfig: (c: AnalysisConfig) => c is FlowAnalysisConfig;
|
|
112
|
+
/**
|
|
113
|
+
* Check if config is for retention mode
|
|
114
|
+
*/
|
|
115
|
+
export declare const isRetentionConfig: (c: AnalysisConfig) => c is RetentionAnalysisConfig;
|
|
96
116
|
/**
|
|
97
117
|
* Check if a query config contains multiple queries
|
|
98
118
|
*/
|
|
@@ -117,6 +137,10 @@ export declare const createDefaultFunnelConfig: () => FunnelAnalysisConfig;
|
|
|
117
137
|
* Create a default empty flow analysis config
|
|
118
138
|
*/
|
|
119
139
|
export declare const createDefaultFlowConfig: () => FlowAnalysisConfig;
|
|
140
|
+
/**
|
|
141
|
+
* Create a default empty retention analysis config
|
|
142
|
+
*/
|
|
143
|
+
export declare const createDefaultRetentionConfig: () => RetentionAnalysisConfig;
|
|
120
144
|
/**
|
|
121
145
|
* Create a default config for the given analysis type
|
|
122
146
|
*/
|
|
@@ -126,7 +150,7 @@ export declare const createDefaultConfig: (type?: AnalysisType) => AnalysisConfi
|
|
|
126
150
|
*
|
|
127
151
|
* Unlike AnalysisConfig (which represents a single analysis mode),
|
|
128
152
|
* AnalysisWorkspace preserves state for ALL modes. This prevents state
|
|
129
|
-
* loss when switching between query, funnel, and
|
|
153
|
+
* loss when switching between query, funnel, flow, and retention modes.
|
|
130
154
|
*
|
|
131
155
|
* Usage:
|
|
132
156
|
* - localStorage persistence → AnalysisWorkspace (preserves all modes)
|
|
@@ -147,6 +171,7 @@ export interface AnalysisWorkspace {
|
|
|
147
171
|
query?: QueryAnalysisConfig;
|
|
148
172
|
funnel?: FunnelAnalysisConfig;
|
|
149
173
|
flow?: FlowAnalysisConfig;
|
|
174
|
+
retention?: RetentionAnalysisConfig;
|
|
150
175
|
};
|
|
151
176
|
}
|
|
152
177
|
/**
|
|
@@ -252,6 +252,11 @@ export interface UseFunnelQueryResult {
|
|
|
252
252
|
* Use this for debug panel display to show what's actually executed.
|
|
253
253
|
*/
|
|
254
254
|
serverQuery: ServerFunnelQuery | null;
|
|
255
|
+
/**
|
|
256
|
+
* Whether the query needs to be refreshed (manual refresh mode only).
|
|
257
|
+
* True when the current funnel config differs from the last executed query.
|
|
258
|
+
*/
|
|
259
|
+
needsRefresh: boolean;
|
|
255
260
|
}
|
|
256
261
|
/**
|
|
257
262
|
* Server-side funnel query format
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { Filter } from '../types';
|
|
2
|
+
import { FunnelBindingKey } from './funnel';
|
|
3
|
+
/**
|
|
4
|
+
* Date range for cohort analysis (REQUIRED)
|
|
5
|
+
* Matches server's RetentionDateRange interface
|
|
6
|
+
*/
|
|
7
|
+
export interface DateRange {
|
|
8
|
+
/** Start date (inclusive), ISO 8601 format (YYYY-MM-DD) */
|
|
9
|
+
start: string;
|
|
10
|
+
/** End date (inclusive), ISO 8601 format (YYYY-MM-DD) */
|
|
11
|
+
end: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Preset date range type
|
|
15
|
+
*/
|
|
16
|
+
export type DateRangePreset = 'last_30_days' | 'last_3_months' | 'last_6_months' | 'last_12_months' | 'this_year' | 'last_year' | 'custom';
|
|
17
|
+
/**
|
|
18
|
+
* Preset date range options for the UI
|
|
19
|
+
*/
|
|
20
|
+
export declare const RETENTION_DATE_RANGE_PRESETS: {
|
|
21
|
+
value: DateRangePreset;
|
|
22
|
+
label: string;
|
|
23
|
+
}[];
|
|
24
|
+
/**
|
|
25
|
+
* Default preset for retention date range
|
|
26
|
+
*/
|
|
27
|
+
export declare const DEFAULT_DATE_RANGE_PRESET: DateRangePreset;
|
|
28
|
+
/**
|
|
29
|
+
* Calculate date range from a preset value
|
|
30
|
+
* Returns ISO date strings (YYYY-MM-DD)
|
|
31
|
+
*/
|
|
32
|
+
export declare function getDateRangeFromPreset(preset: DateRangePreset): DateRange;
|
|
33
|
+
/**
|
|
34
|
+
* Detect which preset a date range matches, if any
|
|
35
|
+
*/
|
|
36
|
+
export declare function detectDateRangePreset(range: DateRange): DateRangePreset;
|
|
37
|
+
/**
|
|
38
|
+
* Server retention query format
|
|
39
|
+
* This is the shape sent to the server for execution
|
|
40
|
+
* Wrapped in { retention: {...} } similar to funnel queries
|
|
41
|
+
*/
|
|
42
|
+
export interface ServerRetentionQuery {
|
|
43
|
+
retention: RetentionQueryConfig;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Retention query configuration
|
|
47
|
+
* Contains all parameters needed for server-side retention analysis
|
|
48
|
+
*
|
|
49
|
+
* Simplified Mixpanel-style format:
|
|
50
|
+
* - Single cube and timestamp dimension
|
|
51
|
+
* - Single cohort (date range defines the cohort, not granularity)
|
|
52
|
+
* - Optional breakdown dimension for segmentation
|
|
53
|
+
*/
|
|
54
|
+
export interface RetentionQueryConfig {
|
|
55
|
+
/**
|
|
56
|
+
* Single timestamp dimension for the analysis.
|
|
57
|
+
* String format (e.g., 'Events.timestamp'),
|
|
58
|
+
* Object format for multi-cube with explicit cube reference.
|
|
59
|
+
*/
|
|
60
|
+
timeDimension: string | {
|
|
61
|
+
cube: string;
|
|
62
|
+
dimension: string;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Binding key - dimension that links users across events.
|
|
66
|
+
* This is typically a user ID or other entity identifier.
|
|
67
|
+
* String for single-cube (e.g., 'Events.userId'),
|
|
68
|
+
* Array for multi-cube with different column names per cube.
|
|
69
|
+
*/
|
|
70
|
+
bindingKey: string | {
|
|
71
|
+
cube: string;
|
|
72
|
+
dimension: string;
|
|
73
|
+
}[];
|
|
74
|
+
/**
|
|
75
|
+
* Date range for cohort analysis (REQUIRED).
|
|
76
|
+
* Users who first performed the cohort action within this range are included.
|
|
77
|
+
*/
|
|
78
|
+
dateRange: DateRange;
|
|
79
|
+
/**
|
|
80
|
+
* Granularity for viewing retention periods.
|
|
81
|
+
* Determines how retention periods are measured (day/week/month).
|
|
82
|
+
*/
|
|
83
|
+
granularity: RetentionGranularity;
|
|
84
|
+
/**
|
|
85
|
+
* Number of periods to calculate (e.g., 12 for 12 weeks).
|
|
86
|
+
* Period 0 is always the cohort entry period.
|
|
87
|
+
*/
|
|
88
|
+
periods: number;
|
|
89
|
+
/**
|
|
90
|
+
* Retention type:
|
|
91
|
+
* - 'classic': User returned exactly in period N (bounded)
|
|
92
|
+
* - 'rolling': User returned in period N or any later period (unbounded)
|
|
93
|
+
*/
|
|
94
|
+
retentionType: RetentionType;
|
|
95
|
+
/**
|
|
96
|
+
* Optional filters on cohort entry events.
|
|
97
|
+
* Applied when identifying which users enter the cohort.
|
|
98
|
+
*/
|
|
99
|
+
cohortFilters?: Filter | Filter[];
|
|
100
|
+
/**
|
|
101
|
+
* Optional filters on return activity events.
|
|
102
|
+
* Applied when checking for user activity in each period.
|
|
103
|
+
*/
|
|
104
|
+
activityFilters?: Filter | Filter[];
|
|
105
|
+
/**
|
|
106
|
+
* Optional breakdown dimensions for segmenting the cohort.
|
|
107
|
+
* When provided, retention is calculated per breakdown value combination.
|
|
108
|
+
* e.g., ["Events.country"] or ["Events.country", "Events.plan"]
|
|
109
|
+
*/
|
|
110
|
+
breakdownDimensions?: string[];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Supported granularity levels for retention analysis
|
|
114
|
+
*/
|
|
115
|
+
export type RetentionGranularity = 'day' | 'week' | 'month';
|
|
116
|
+
/**
|
|
117
|
+
* Retention calculation types
|
|
118
|
+
* - classic: User active exactly in period N
|
|
119
|
+
* - rolling: User active in period N or any later period
|
|
120
|
+
*/
|
|
121
|
+
export type RetentionType = 'classic' | 'rolling';
|
|
122
|
+
/**
|
|
123
|
+
* Single retention data point returned from server
|
|
124
|
+
* Results are returned as a flat array; client transforms to matrix if needed
|
|
125
|
+
*/
|
|
126
|
+
export interface RetentionResultRow {
|
|
127
|
+
/** Period number (0 = cohort entry, 1 = first retention period, etc.) */
|
|
128
|
+
period: number;
|
|
129
|
+
/** Number of users in the cohort */
|
|
130
|
+
cohortSize: number;
|
|
131
|
+
/** Number of users retained in this period */
|
|
132
|
+
retainedUsers: number;
|
|
133
|
+
/** Retention rate as decimal (0-1), e.g., 0.45 for 45% */
|
|
134
|
+
retentionRate: number;
|
|
135
|
+
/** Breakdown value when breakdown dimension is specified (e.g., "US", "UK") */
|
|
136
|
+
breakdownValue?: string | null;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Retention chart data format for visualization
|
|
140
|
+
* Supports both heatmap and line chart modes
|
|
141
|
+
*/
|
|
142
|
+
export interface RetentionChartData {
|
|
143
|
+
rows: RetentionResultRow[];
|
|
144
|
+
/** Period numbers (0 to periods) */
|
|
145
|
+
periods: number[];
|
|
146
|
+
/** Breakdown values when breakdown dimension is specified */
|
|
147
|
+
breakdownValues?: string[];
|
|
148
|
+
/** Summary statistics */
|
|
149
|
+
summary?: RetentionSummary;
|
|
150
|
+
/** Granularity of retention periods (day/week/month) for period label formatting */
|
|
151
|
+
granularity?: RetentionGranularity;
|
|
152
|
+
/** Human-readable label extracted from the binding key dimension (e.g., "userId" from "Users.userId") */
|
|
153
|
+
bindingKeyLabel?: string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Summary statistics for retention analysis
|
|
157
|
+
*/
|
|
158
|
+
export interface RetentionSummary {
|
|
159
|
+
/** Total unique users in the cohort */
|
|
160
|
+
totalUsers: number;
|
|
161
|
+
/** Average retention rate across all periods for period 1 */
|
|
162
|
+
avgPeriod1Retention: number;
|
|
163
|
+
/** Highest retention rate for period 1 */
|
|
164
|
+
maxPeriod1Retention: number;
|
|
165
|
+
/** Lowest retention rate for period 1 */
|
|
166
|
+
minPeriod1Retention: number;
|
|
167
|
+
/** Number of breakdown segments (1 if no breakdown) */
|
|
168
|
+
segmentCount?: number;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Breakdown item for retention analysis (single dimension)
|
|
172
|
+
* Follows Mixpanel pattern - one breakdown dimension only
|
|
173
|
+
*/
|
|
174
|
+
export interface RetentionBreakdownItem {
|
|
175
|
+
/** Full dimension name (e.g., "Events.country") */
|
|
176
|
+
field: string;
|
|
177
|
+
/** Display label for the dimension */
|
|
178
|
+
label?: string;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Retention mode state for the AnalysisBuilder store
|
|
182
|
+
* Simplified Mixpanel-style with single global configuration
|
|
183
|
+
*
|
|
184
|
+
* Key simplifications from previous version:
|
|
185
|
+
* - Single cube for all (no separate cohort/activity cubes)
|
|
186
|
+
* - Single timestamp dimension
|
|
187
|
+
* - Single cohort with breakdown support (no cohort explosion)
|
|
188
|
+
* - Granularity = viewing periods only
|
|
189
|
+
*/
|
|
190
|
+
export interface RetentionSliceState {
|
|
191
|
+
/** Single cube for retention analysis */
|
|
192
|
+
retentionCube: string | null;
|
|
193
|
+
/** Binding key that identifies entities (reuses funnel binding key type) */
|
|
194
|
+
retentionBindingKey: FunnelBindingKey | null;
|
|
195
|
+
/** Single timestamp dimension for both cohort entry and activity */
|
|
196
|
+
retentionTimeDimension: string | null;
|
|
197
|
+
/** Date range for cohort analysis (REQUIRED) */
|
|
198
|
+
retentionDateRange: DateRange;
|
|
199
|
+
/** Filters that define who enters the cohort */
|
|
200
|
+
retentionCohortFilters: Filter[];
|
|
201
|
+
/** Filters that define what counts as a return */
|
|
202
|
+
retentionActivityFilters: Filter[];
|
|
203
|
+
/** Optional breakdown dimensions for segmenting the cohort */
|
|
204
|
+
retentionBreakdowns: RetentionBreakdownItem[];
|
|
205
|
+
/** Granularity for viewing retention periods (day/week/month) */
|
|
206
|
+
retentionViewGranularity: RetentionGranularity;
|
|
207
|
+
/** Number of periods to analyze (1-52) */
|
|
208
|
+
retentionPeriods: number;
|
|
209
|
+
/** Type of retention calculation */
|
|
210
|
+
retentionType: RetentionType;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Retention slice actions for the store
|
|
214
|
+
*/
|
|
215
|
+
export interface RetentionSliceActions {
|
|
216
|
+
/** Set the single cube for retention analysis */
|
|
217
|
+
setRetentionCube: (cube: string | null) => void;
|
|
218
|
+
/** Set the retention binding key */
|
|
219
|
+
setRetentionBindingKey: (key: FunnelBindingKey | null) => void;
|
|
220
|
+
/** Set the single timestamp dimension */
|
|
221
|
+
setRetentionTimeDimension: (dim: string | null) => void;
|
|
222
|
+
/** Set the date range (REQUIRED) */
|
|
223
|
+
setRetentionDateRange: (range: DateRange) => void;
|
|
224
|
+
/** Set all cohort filters at once */
|
|
225
|
+
setRetentionCohortFilters: (filters: Filter[]) => void;
|
|
226
|
+
/** Add a cohort filter */
|
|
227
|
+
addRetentionCohortFilter: (filter: Filter) => void;
|
|
228
|
+
/** Remove a cohort filter by index */
|
|
229
|
+
removeRetentionCohortFilter: (index: number) => void;
|
|
230
|
+
/** Update a cohort filter by index */
|
|
231
|
+
updateRetentionCohortFilter: (index: number, filter: Filter) => void;
|
|
232
|
+
/** Set all activity filters at once */
|
|
233
|
+
setRetentionActivityFilters: (filters: Filter[]) => void;
|
|
234
|
+
/** Add an activity filter */
|
|
235
|
+
addRetentionActivityFilter: (filter: Filter) => void;
|
|
236
|
+
/** Remove an activity filter by index */
|
|
237
|
+
removeRetentionActivityFilter: (index: number) => void;
|
|
238
|
+
/** Update an activity filter by index */
|
|
239
|
+
updateRetentionActivityFilter: (index: number, filter: Filter) => void;
|
|
240
|
+
/** Set all breakdown dimensions */
|
|
241
|
+
setRetentionBreakdowns: (breakdowns: RetentionBreakdownItem[]) => void;
|
|
242
|
+
/** Add a breakdown dimension */
|
|
243
|
+
addRetentionBreakdown: (breakdown: RetentionBreakdownItem) => void;
|
|
244
|
+
/** Remove a breakdown dimension by field name */
|
|
245
|
+
removeRetentionBreakdown: (field: string) => void;
|
|
246
|
+
/** Set the view granularity */
|
|
247
|
+
setRetentionViewGranularity: (granularity: RetentionGranularity) => void;
|
|
248
|
+
/** Set the number of periods */
|
|
249
|
+
setRetentionPeriods: (periods: number) => void;
|
|
250
|
+
/** Set the retention type */
|
|
251
|
+
setRetentionType: (type: RetentionType) => void;
|
|
252
|
+
/** Check if in retention mode (analysisType === 'retention') */
|
|
253
|
+
isRetentionMode: () => boolean;
|
|
254
|
+
/** Check if retention mode is properly configured and ready for execution */
|
|
255
|
+
isRetentionModeEnabled: () => boolean;
|
|
256
|
+
/** Build ServerRetentionQuery from retention state */
|
|
257
|
+
buildRetentionQuery: () => ServerRetentionQuery | null;
|
|
258
|
+
/** Get validation errors explaining why retention query cannot be built */
|
|
259
|
+
getRetentionValidation: () => {
|
|
260
|
+
isValid: boolean;
|
|
261
|
+
errors: string[];
|
|
262
|
+
warnings: string[];
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Type guard to check if data is retention chart data
|
|
267
|
+
*/
|
|
268
|
+
export declare function isRetentionData(data: unknown): data is RetentionChartData;
|
|
269
|
+
/**
|
|
270
|
+
* Type guard to detect server retention query format
|
|
271
|
+
* Used to distinguish { retention: {...} } from CubeQuery, etc.
|
|
272
|
+
*/
|
|
273
|
+
export declare function isServerRetentionQuery(obj: unknown): obj is ServerRetentionQuery;
|
|
274
|
+
/**
|
|
275
|
+
* Type guard for retention result row
|
|
276
|
+
*/
|
|
277
|
+
export declare function isRetentionResultRow(row: unknown): row is RetentionResultRow;
|
|
278
|
+
/**
|
|
279
|
+
* Default retention slice state for store initialization
|
|
280
|
+
*/
|
|
281
|
+
export declare const defaultRetentionSliceState: RetentionSliceState;
|
|
282
|
+
/**
|
|
283
|
+
* Minimum and maximum values for retention periods
|
|
284
|
+
*/
|
|
285
|
+
export declare const RETENTION_MIN_PERIODS = 1;
|
|
286
|
+
export declare const RETENTION_MAX_PERIODS = 52;
|
|
287
|
+
/**
|
|
288
|
+
* Available granularity options
|
|
289
|
+
*/
|
|
290
|
+
export declare const RETENTION_GRANULARITY_OPTIONS: {
|
|
291
|
+
value: RetentionGranularity;
|
|
292
|
+
label: string;
|
|
293
|
+
}[];
|
|
294
|
+
/**
|
|
295
|
+
* Available retention type options
|
|
296
|
+
*/
|
|
297
|
+
export declare const RETENTION_TYPE_OPTIONS: {
|
|
298
|
+
value: RetentionType;
|
|
299
|
+
label: string;
|
|
300
|
+
description: string;
|
|
301
|
+
}[];
|
package/dist/client/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { ColorPalette } from './utils/colorPalettes';
|
|
3
3
|
import { FunnelBindingKey } from './types/funnel';
|
|
4
4
|
import { FlowChartData } from './types/flow';
|
|
5
|
+
import { RetentionChartData } from './types/retention';
|
|
5
6
|
export interface CubeMetaField {
|
|
6
7
|
name: string;
|
|
7
8
|
title: string;
|
|
@@ -38,7 +39,7 @@ export interface CubeMeta {
|
|
|
38
39
|
}
|
|
39
40
|
export type FieldLabelMap = Record<string, string>;
|
|
40
41
|
export type { ColorPalette } from './utils/colorPalettes';
|
|
41
|
-
export type ChartType = 'line' | 'bar' | 'pie' | 'table' | 'area' | 'scatter' | 'radar' | 'radialBar' | 'treemap' | 'bubble' | 'activityGrid' | 'kpiNumber' | 'kpiDelta' | 'kpiText' | 'markdown' | 'funnel' | 'sankey' | 'sunburst' | 'heatmap';
|
|
42
|
+
export type ChartType = 'line' | 'bar' | 'pie' | 'table' | 'area' | 'scatter' | 'radar' | 'radialBar' | 'treemap' | 'bubble' | 'activityGrid' | 'kpiNumber' | 'kpiDelta' | 'kpiText' | 'markdown' | 'funnel' | 'sankey' | 'sunburst' | 'heatmap' | 'retentionHeatmap' | 'retentionCombined';
|
|
42
43
|
export interface AxisFormatConfig {
|
|
43
44
|
label?: string;
|
|
44
45
|
unit?: 'currency' | 'percent' | 'number' | 'custom';
|
|
@@ -125,6 +126,8 @@ export interface ChartDisplayConfig {
|
|
|
125
126
|
showFunnelMedianTime?: boolean;
|
|
126
127
|
/** Show P90 time-to-convert metric in funnel charts */
|
|
127
128
|
showFunnelP90Time?: boolean;
|
|
129
|
+
/** Retention display mode: line chart, heatmap table, or combined view */
|
|
130
|
+
retentionDisplayMode?: 'line' | 'heatmap' | 'combined';
|
|
128
131
|
}
|
|
129
132
|
export interface PortletConfig {
|
|
130
133
|
id: string;
|
|
@@ -196,7 +199,7 @@ export interface DashboardConfig {
|
|
|
196
199
|
thumbnailData?: string;
|
|
197
200
|
thumbnailUrl?: string;
|
|
198
201
|
}
|
|
199
|
-
export type AnalysisType = 'query' | 'funnel' | 'flow';
|
|
202
|
+
export type AnalysisType = 'query' | 'funnel' | 'flow' | 'retention';
|
|
200
203
|
/**
|
|
201
204
|
* State for a single funnel step (dedicated for Funnel mode)
|
|
202
205
|
* Each step represents a stage in the funnel with its own cube and filters
|
|
@@ -318,7 +321,7 @@ export interface AnalyticsPortletProps {
|
|
|
318
321
|
chartConfig: ChartAxisConfig;
|
|
319
322
|
displayConfig: ChartDisplayConfig;
|
|
320
323
|
queryObject: any;
|
|
321
|
-
data: any[] | FlowChartData;
|
|
324
|
+
data: any[] | FlowChartData | RetentionChartData;
|
|
322
325
|
chartType: ChartType;
|
|
323
326
|
cacheInfo?: {
|
|
324
327
|
hit: true;
|