drizzle-cube 0.2.19 → 0.2.22

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 (41) hide show
  1. package/dist/adapters/{compiler-7cp4XzHx.js → compiler-DDXMrb9d.js} +2470 -2181
  2. package/dist/adapters/compiler-S2NEGW7Q.cjs +22 -0
  3. package/dist/adapters/express/index.cjs +1 -1
  4. package/dist/adapters/express/index.js +1 -1
  5. package/dist/adapters/fastify/index.cjs +1 -1
  6. package/dist/adapters/fastify/index.js +1 -1
  7. package/dist/adapters/hono/index.cjs +1 -1
  8. package/dist/adapters/hono/index.js +1 -1
  9. package/dist/adapters/nextjs/index.cjs +1 -1
  10. package/dist/adapters/nextjs/index.js +1 -1
  11. package/dist/client/charts.js +2 -2
  12. package/dist/client/chunks/{charts-B8YMw1mi.js → charts-BympPNAT.js} +2249 -2062
  13. package/dist/client/chunks/charts-BympPNAT.js.map +1 -0
  14. package/dist/client/chunks/{charts-amt7VOyw.js → charts-CEz9wcfI.js} +32 -32
  15. package/dist/client/chunks/{charts-amt7VOyw.js.map → charts-CEz9wcfI.js.map} +1 -1
  16. package/dist/client/chunks/{components-K3xrnHN-.js → components-__XqYVbP.js} +4694 -4502
  17. package/dist/client/chunks/components-__XqYVbP.js.map +1 -0
  18. package/dist/client/chunks/core-DWO_N91H.js +6 -0
  19. package/dist/client/chunks/core-DWO_N91H.js.map +1 -0
  20. package/dist/client/chunks/{index-B7NSVb33.js → index-mA36fTTV.js} +2 -2
  21. package/dist/client/chunks/{index-B7NSVb33.js.map → index-mA36fTTV.js.map} +1 -1
  22. package/dist/client/components/AnalysisBuilder/types.d.ts +9 -0
  23. package/dist/client/components/charts/ChartTooltip.d.ts +1 -1
  24. package/dist/client/components.js +2 -2
  25. package/dist/client/hooks.js +2 -2
  26. package/dist/client/icons.js +1 -1
  27. package/dist/client/index.js +3 -3
  28. package/dist/client/providers.js +1 -1
  29. package/dist/client/types.d.ts +18 -0
  30. package/dist/client/utils/comparisonUtils.d.ts +96 -0
  31. package/dist/client/utils/index.d.ts +1 -0
  32. package/dist/client-bundle-stats.html +1 -1
  33. package/dist/server/index.cjs +16 -16
  34. package/dist/server/index.d.ts +44 -0
  35. package/dist/server/index.js +3164 -2875
  36. package/package.json +1 -1
  37. package/dist/adapters/compiler-CITtZq3r.cjs +0 -22
  38. package/dist/client/chunks/charts-B8YMw1mi.js.map +0 -1
  39. package/dist/client/chunks/components-K3xrnHN-.js.map +0 -1
  40. package/dist/client/chunks/core-Dkym7d1O.js +0 -6
  41. package/dist/client/chunks/core-Dkym7d1O.js.map +0 -1
@@ -760,6 +760,21 @@ export declare class MySQLExecutor extends BaseDatabaseExecutor {
760
760
  getEngineType(): 'mysql' | 'singlestore';
761
761
  }
762
762
 
763
+ /**
764
+ * Period comparison metadata for compareDateRange queries
765
+ * Provides information about the periods being compared
766
+ */
767
+ export declare interface PeriodComparisonMetadata {
768
+ /** The date ranges being compared */
769
+ ranges: [string, string][];
770
+ /** Human-readable labels for each period */
771
+ labels: string[];
772
+ /** The time dimension used for comparison */
773
+ timeDimension: string;
774
+ /** Granularity used for the comparison */
775
+ granularity?: TimeGranularity;
776
+ }
777
+
763
778
  /**
764
779
  * Type helpers for specific database types
765
780
  */
@@ -1048,6 +1063,7 @@ export declare class QueryExecutor {
1048
1063
  private queryPlanner;
1049
1064
  private cteBuilder;
1050
1065
  private databaseAdapter;
1066
+ private comparisonQueryBuilder;
1051
1067
  constructor(dbExecutor: DatabaseExecutor);
1052
1068
  /**
1053
1069
  * Unified query execution method that handles both single and multi-cube queries
@@ -1057,6 +1073,16 @@ export declare class QueryExecutor {
1057
1073
  * Legacy interface for single cube queries
1058
1074
  */
1059
1075
  executeQuery(cube: Cube, query: SemanticQuery, securityContext: SecurityContext): Promise<QueryResult>;
1076
+ /**
1077
+ * Execute a comparison query with multiple date periods
1078
+ * Expands compareDateRange into multiple sub-queries and merges results
1079
+ */
1080
+ private executeComparisonQuery;
1081
+ /**
1082
+ * Standard query execution (non-comparison)
1083
+ * This is the core execution logic extracted for use by comparison queries
1084
+ */
1085
+ private executeStandardQuery;
1060
1086
  /**
1061
1087
  * Validate that all cubes in the query plan have proper security filtering.
1062
1088
  * Emits a warning if a cube's sql() function doesn't return a WHERE clause.
@@ -1281,6 +1307,8 @@ export declare interface QueryResult {
1281
1307
  dimensions: Record<string, DimensionAnnotation>;
1282
1308
  segments: Record<string, unknown>;
1283
1309
  timeDimensions: Record<string, TimeDimensionAnnotation>;
1310
+ /** Period comparison metadata (present when compareDateRange is used) */
1311
+ periods?: PeriodComparisonMetadata;
1284
1312
  };
1285
1313
  }
1286
1314
 
@@ -1543,6 +1571,22 @@ export declare interface TimeDimension {
1543
1571
  * Default: true (enabled)
1544
1572
  */
1545
1573
  fillMissingDates?: boolean;
1574
+ /**
1575
+ * Array of date ranges for period-over-period comparison.
1576
+ * When specified, queries are executed for each period and results are merged
1577
+ * with period metadata (__periodIndex, __periodDayIndex) for alignment.
1578
+ *
1579
+ * Each range can be:
1580
+ * - A relative string: 'this week', 'last month', 'last 30 days'
1581
+ * - A tuple: ['2024-01-01', '2024-01-31']
1582
+ *
1583
+ * @example
1584
+ * compareDateRange: [
1585
+ * 'last 30 days', // Current period
1586
+ * ['2024-01-01', '2024-01-30'] // Prior period to compare
1587
+ * ]
1588
+ */
1589
+ compareDateRange?: (string | [string, string])[];
1546
1590
  }
1547
1591
 
1548
1592
  export declare interface TimeDimensionAnnotation {