drizzle-cube 0.2.28 → 0.2.29

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.
Files changed (43) hide show
  1. package/dist/client/charts/chartConfigs.d.ts +1 -1
  2. package/dist/client/charts.js +2 -2
  3. package/dist/client/chunks/{charts-BfXEKIrq.js → charts-Cr9ec7VQ.js} +66 -63
  4. package/dist/client/chunks/charts-Cr9ec7VQ.js.map +1 -0
  5. package/dist/client/chunks/{charts-DQuOI5HA.js → charts-nP6WCxHG.js} +2725 -2488
  6. package/dist/client/chunks/charts-nP6WCxHG.js.map +1 -0
  7. package/dist/client/chunks/{components-CWMeA5e-.js → components-CCRoi0sB.js} +5347 -4700
  8. package/dist/client/chunks/components-CCRoi0sB.js.map +1 -0
  9. package/dist/client/chunks/core-DcL8wSpZ.js +6 -0
  10. package/dist/client/chunks/core-DcL8wSpZ.js.map +1 -0
  11. package/dist/client/chunks/{hooks-CAKGR-w0.js → hooks-CM78mXuP.js} +20 -19
  12. package/dist/client/chunks/{hooks-CAKGR-w0.js.map → hooks-CM78mXuP.js.map} +1 -1
  13. package/dist/client/chunks/{icons-DI4Xack3.js → icons-D7ek1iXF.js} +39 -39
  14. package/dist/client/chunks/{icons-DI4Xack3.js.map → icons-D7ek1iXF.js.map} +1 -1
  15. package/dist/client/components/AnalysisBuilder/FunnelBindingKeySelector.d.ts +21 -0
  16. package/dist/client/components/AnalysisBuilder/types.d.ts +15 -4
  17. package/dist/client/components/charts/FunnelChart.config.d.ts +9 -0
  18. package/dist/client/components/charts/FunnelChart.d.ts +11 -0
  19. package/dist/client/components.js +2 -2
  20. package/dist/client/hooks/queries/index.d.ts +1 -0
  21. package/dist/client/hooks/queries/useFunnelQuery.d.ts +25 -0
  22. package/dist/client/hooks/useAnalysisBuilderHook.d.ts +7 -3
  23. package/dist/client/hooks/useAnalysisQueryExecution.d.ts +12 -1
  24. package/dist/client/hooks.js +5 -5
  25. package/dist/client/icons/types.d.ts +1 -0
  26. package/dist/client/icons.js +1 -1
  27. package/dist/client/index.d.ts +5 -3
  28. package/dist/client/index.js +115 -99
  29. package/dist/client/providers.js +1 -1
  30. package/dist/client/stores/analysisBuilderStore.d.ts +21 -1
  31. package/dist/client/styles.css +1 -1
  32. package/dist/client/types/funnel.d.ts +231 -0
  33. package/dist/client/types.d.ts +11 -2
  34. package/dist/client/utils/funnelExecution.d.ts +111 -0
  35. package/dist/client/utils/funnelValidation.d.ts +46 -0
  36. package/dist/client/utils/multiQueryValidation.d.ts +3 -3
  37. package/dist/client-bundle-stats.html +1 -1
  38. package/package.json +1 -1
  39. package/dist/client/chunks/charts-BfXEKIrq.js.map +0 -1
  40. package/dist/client/chunks/charts-DQuOI5HA.js.map +0 -1
  41. package/dist/client/chunks/components-CWMeA5e-.js.map +0 -1
  42. package/dist/client/chunks/core-DrhYtHHa.js +0 -6
  43. package/dist/client/chunks/core-DrhYtHHa.js.map +0 -1
@@ -0,0 +1,111 @@
1
+ import { CubeQuery } from '../types';
2
+ import { FunnelBindingKey, FunnelConfig, FunnelStep, FunnelStepResult, FunnelExecutionResult, FunnelChartData } from '../types/funnel';
3
+ /**
4
+ * Default maximum number of binding key values to pass between funnel steps.
5
+ * Limits the size of the IN clause to prevent performance issues.
6
+ */
7
+ export declare const DEFAULT_BINDING_KEY_LIMIT = 500;
8
+ /**
9
+ * Extract the binding key field name for a specific query/cube.
10
+ *
11
+ * For simple binding keys (string), returns the dimension directly.
12
+ * For cross-cube mappings, finds the mapping for the cube used in the query.
13
+ *
14
+ * @param bindingKey - The funnel binding key configuration
15
+ * @param query - The cube query (used to determine which cube is being queried)
16
+ * @returns The binding key field name (e.g., "Users.userId")
17
+ */
18
+ export declare function getBindingKeyField(bindingKey: FunnelBindingKey, query: CubeQuery): string;
19
+ /**
20
+ * Extract the cube name from a query by looking at measures/dimensions
21
+ */
22
+ export declare function getCubeNameFromQuery(query: CubeQuery): string | null;
23
+ /**
24
+ * Result from extracting binding key values
25
+ */
26
+ export interface ExtractedBindingKeyValues {
27
+ /** Binding key values (limited to max if specified) */
28
+ values: (string | number)[];
29
+ /** Total count of unique values before limiting */
30
+ totalCount: number;
31
+ /** Whether values were truncated due to limit */
32
+ wasTruncated: boolean;
33
+ }
34
+ /**
35
+ * Extract unique values for the binding key from query result data
36
+ *
37
+ * @param data - Raw data from query result
38
+ * @param bindingKeyField - The field name to extract values from
39
+ * @param limit - Maximum number of values to return (default: DEFAULT_BINDING_KEY_LIMIT)
40
+ * @returns Object with values array, total count, and truncation flag
41
+ */
42
+ export declare function extractBindingKeyValues(data: unknown[], bindingKeyField: string, limit?: number): ExtractedBindingKeyValues;
43
+ /**
44
+ * Build a step query with binding key filter applied.
45
+ *
46
+ * For the first step (no previous values), returns the original query
47
+ * with the binding key dimension ensured.
48
+ *
49
+ * For subsequent steps, adds an IN filter for the previous step's
50
+ * binding key values.
51
+ *
52
+ * @param step - The funnel step configuration
53
+ * @param bindingKey - The funnel binding key configuration
54
+ * @param previousBindingKeyValues - Binding key values from previous step (null for first step)
55
+ * @returns Modified CubeQuery with binding key filter
56
+ */
57
+ export declare function buildStepQuery(step: FunnelStep, bindingKey: FunnelBindingKey, previousBindingKeyValues: (string | number)[] | null): CubeQuery;
58
+ /**
59
+ * Calculate conversion metrics for a step
60
+ */
61
+ export declare function calculateStepMetrics(currentCount: number, previousCount: number | null, firstStepCount: number): {
62
+ conversionRate: number | null;
63
+ cumulativeConversionRate: number;
64
+ };
65
+ /**
66
+ * Build a funnel step result from query execution
67
+ */
68
+ export declare function buildStepResult(step: FunnelStep, stepIndex: number, data: unknown[], bindingKeyField: string, countUnique: boolean, previousCount: number | null, firstStepCount: number, executionTime: number, error?: Error | null, bindingKeyLimit?: number): FunnelStepResult;
69
+ /**
70
+ * Convert step results to chart-ready data format
71
+ */
72
+ export declare function buildFunnelChartData(stepResults: FunnelStepResult[]): FunnelChartData[];
73
+ /**
74
+ * Build the complete funnel execution result
75
+ */
76
+ export declare function buildFunnelResult(config: FunnelConfig, stepResults: FunnelStepResult[], status: FunnelExecutionResult['status'], error?: Error | null, currentStepIndex?: number | null): FunnelExecutionResult;
77
+ /**
78
+ * Create an empty/initial funnel result
79
+ */
80
+ export declare function createEmptyFunnelResult(config: FunnelConfig): FunnelExecutionResult;
81
+ /**
82
+ * Build a FunnelConfig from multi-query config state.
83
+ * Used to convert AnalysisBuilder state to funnel configuration.
84
+ *
85
+ * @param queries - Array of CubeQuery objects (one per step)
86
+ * @param bindingKey - The binding key configuration
87
+ * @param stepLabels - Optional labels for each step
88
+ * @param stepTimeToConvert - Optional time window for each step
89
+ * @returns FunnelConfig ready for execution
90
+ */
91
+ export declare function buildFunnelConfigFromQueries(queries: CubeQuery[], bindingKey: FunnelBindingKey, stepLabels?: string[], stepTimeToConvert?: (string | null)[]): FunnelConfig;
92
+ /**
93
+ * Check if funnel execution should stop early
94
+ * (e.g., when no binding key values remain)
95
+ */
96
+ export declare function shouldStopFunnelExecution(stepResult: FunnelStepResult): boolean;
97
+ /**
98
+ * Metadata fields injected into funnel result data
99
+ * (for compatibility with existing chart/table components)
100
+ */
101
+ export interface FunnelMetadata {
102
+ __stepIndex: number;
103
+ __stepName: string;
104
+ __stepId: string;
105
+ __conversionRate: number | null;
106
+ __cumulativeRate: number;
107
+ }
108
+ /**
109
+ * Check if data contains funnel metadata
110
+ */
111
+ export declare function isFunnelData(data: unknown[]): boolean;
@@ -0,0 +1,46 @@
1
+ import { CubeQuery, CubeMeta } from '../types';
2
+ import { FunnelBindingKey, FunnelConfig, FunnelStep, FunnelValidationError, FunnelValidationResult } from '../types/funnel';
3
+ /**
4
+ * Validate that a binding key dimension exists in the given cubes
5
+ */
6
+ export declare function validateBindingKeyExists(bindingKey: FunnelBindingKey, meta: CubeMeta | null): FunnelValidationError[];
7
+ /**
8
+ * Validate that each step has a valid query
9
+ */
10
+ export declare function validateStepQueries(steps: FunnelStep[]): FunnelValidationError[];
11
+ /**
12
+ * Check if binding key can be resolved for a given query
13
+ */
14
+ export declare function canResolveBindingKey(bindingKey: FunnelBindingKey, query: CubeQuery): boolean;
15
+ /**
16
+ * Validate binding key for all funnel steps
17
+ */
18
+ export declare function validateBindingKeyForSteps(bindingKey: FunnelBindingKey, steps: FunnelStep[]): FunnelValidationError[];
19
+ /**
20
+ * Validate time window format (ISO 8601 duration)
21
+ */
22
+ export declare function validateTimeWindow(duration: string | undefined): FunnelValidationError | null;
23
+ /**
24
+ * Validate complete funnel configuration
25
+ */
26
+ export declare function validateFunnelConfig(config: FunnelConfig, meta: CubeMeta | null): FunnelValidationResult;
27
+ /**
28
+ * Quick check if minimum funnel requirements are met
29
+ */
30
+ export declare function isMinimumFunnelConfigValid(bindingKey: FunnelBindingKey | null, queryCount: number): {
31
+ isValid: boolean;
32
+ message?: string;
33
+ };
34
+ /**
35
+ * Get available dimensions that can serve as binding keys
36
+ * These should be dimensions that identify entities (e.g., user IDs, order IDs)
37
+ */
38
+ export declare function getAvailableBindingKeyDimensions(meta: CubeMeta | null): Array<{
39
+ cube: string;
40
+ dimension: string;
41
+ label: string;
42
+ }>;
43
+ /**
44
+ * Get the display label for a binding key
45
+ */
46
+ export declare function getBindingKeyLabel(bindingKey: FunnelBindingKey | null): string;
@@ -1,4 +1,4 @@
1
- import { CubeQuery } from '../types';
1
+ import { CubeQuery, QueryMergeStrategy } from '../types';
2
2
  type TimeDimension = NonNullable<CubeQuery['timeDimensions']>[number];
3
3
  /**
4
4
  * Validation error for multi-query configuration
@@ -55,9 +55,9 @@ export declare function detectAsymmetricDateRanges(queries: CubeQuery[]): MultiQ
55
55
  /**
56
56
  * Validate a multi-query configuration
57
57
  * For 'merge' strategy: strict validation (errors block execution)
58
- * For 'concat' strategy: only warnings
58
+ * For 'concat' and 'funnel' strategies: only warnings
59
59
  */
60
- export declare function validateMultiQueryConfig(queries: CubeQuery[], mergeStrategy: 'concat' | 'merge', mergeKeys?: string[]): MultiQueryValidationResult;
60
+ export declare function validateMultiQueryConfig(queries: CubeQuery[], mergeStrategy: QueryMergeStrategy, mergeKeys?: string[]): MultiQueryValidationResult;
61
61
  /**
62
62
  * Check if a multi-query configuration is valid for execution
63
63
  */