drizzle-cube 0.1.66 → 0.1.68
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/{compiler-BEgt1OH1.js → compiler-BnHK-nxh.js} +1231 -1003
- package/dist/adapters/compiler-CghsDLXl.cjs +22 -0
- package/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.js +1 -1
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.js +1 -1
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.js +1 -1
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.js +1 -1
- package/dist/adapters/utils.d.ts +2 -1
- package/dist/client/charts.js +3 -3
- package/dist/client/chunks/{charts-BvRqT6o9.js → charts-jwgcWeFt.js} +330 -310
- package/dist/client/chunks/charts-jwgcWeFt.js.map +1 -0
- package/dist/client/chunks/{components-DRsjhKyD.js → components-fN-QOY6G.js} +7861 -7681
- package/dist/client/chunks/components-fN-QOY6G.js.map +1 -0
- package/dist/client/chunks/{icons-a6fQwcor.js → icons-Bky5w1eH.js} +739 -614
- package/dist/client/chunks/icons-Bky5w1eH.js.map +1 -0
- package/dist/client/components/AnalyticsDashboard.d.ts +1 -1
- package/dist/client/components/DashboardGrid.d.ts +3 -1
- package/dist/client/components/LoadingIndicator.d.ts +16 -0
- package/dist/client/components/QueryBuilder/QueryAnalysisPanel.d.ts +7 -0
- package/dist/client/components/QueryBuilder/types.d.ts +64 -0
- package/dist/client/components.js +6 -6
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +31 -30
- package/dist/client/styles.css +1 -1
- package/dist/client/types.d.ts +3 -0
- package/dist/client-bundle-stats.html +1 -1
- package/dist/server/index.cjs +17 -17
- package/dist/server/index.d.ts +159 -0
- package/dist/server/index.js +1816 -1596
- package/package.json +1 -1
- package/dist/adapters/compiler-DP0leK4b.cjs +0 -22
- package/dist/client/chunks/charts-BvRqT6o9.js.map +0 -1
- package/dist/client/chunks/components-DRsjhKyD.js.map +0 -1
- package/dist/client/chunks/icons-a6fQwcor.js.map +0 -1
package/dist/server/index.d.ts
CHANGED
|
@@ -436,6 +436,49 @@ export declare interface JoinKeyInfo {
|
|
|
436
436
|
targetColumnObj?: AnyColumn;
|
|
437
437
|
}
|
|
438
438
|
|
|
439
|
+
/**
|
|
440
|
+
* Complete join path from primary to target cube
|
|
441
|
+
*/
|
|
442
|
+
export declare interface JoinPathAnalysis {
|
|
443
|
+
/** Target cube name */
|
|
444
|
+
targetCube: string;
|
|
445
|
+
/** Whether a path was found */
|
|
446
|
+
pathFound: boolean;
|
|
447
|
+
/** The join steps (if found) */
|
|
448
|
+
path?: JoinPathStep[];
|
|
449
|
+
/** Total path length */
|
|
450
|
+
pathLength?: number;
|
|
451
|
+
/** Error message if path not found */
|
|
452
|
+
error?: string;
|
|
453
|
+
/** Cubes that were visited during BFS search */
|
|
454
|
+
visitedCubes?: string[];
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Single step in a join path
|
|
459
|
+
*/
|
|
460
|
+
export declare interface JoinPathStep {
|
|
461
|
+
/** Source cube name */
|
|
462
|
+
fromCube: string;
|
|
463
|
+
/** Target cube name */
|
|
464
|
+
toCube: string;
|
|
465
|
+
/** Relationship type used */
|
|
466
|
+
relationship: 'belongsTo' | 'hasOne' | 'hasMany' | 'belongsToMany';
|
|
467
|
+
/** SQL join type that will be used */
|
|
468
|
+
joinType: 'inner' | 'left' | 'right' | 'full';
|
|
469
|
+
/** Join condition columns */
|
|
470
|
+
joinColumns: Array<{
|
|
471
|
+
sourceColumn: string;
|
|
472
|
+
targetColumn: string;
|
|
473
|
+
}>;
|
|
474
|
+
/** Junction table info for belongsToMany */
|
|
475
|
+
junctionTable?: {
|
|
476
|
+
tableName: string;
|
|
477
|
+
sourceColumns: string[];
|
|
478
|
+
targetColumns: string[];
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
|
|
439
482
|
export declare type JoinType = 'left' | 'right' | 'inner' | 'full';
|
|
440
483
|
|
|
441
484
|
export declare interface LogicalFilter {
|
|
@@ -558,6 +601,25 @@ export declare class PostgresExecutor extends BaseDatabaseExecutor {
|
|
|
558
601
|
getEngineType(): 'postgres';
|
|
559
602
|
}
|
|
560
603
|
|
|
604
|
+
/**
|
|
605
|
+
* Pre-aggregation CTE analysis
|
|
606
|
+
*/
|
|
607
|
+
export declare interface PreAggregationAnalysis {
|
|
608
|
+
/** Cube being pre-aggregated */
|
|
609
|
+
cubeName: string;
|
|
610
|
+
/** CTE alias in the query */
|
|
611
|
+
cteAlias: string;
|
|
612
|
+
/** Why this cube needs a CTE */
|
|
613
|
+
reason: string;
|
|
614
|
+
/** Measures included in CTE */
|
|
615
|
+
measures: string[];
|
|
616
|
+
/** Join keys used */
|
|
617
|
+
joinKeys: Array<{
|
|
618
|
+
sourceColumn: string;
|
|
619
|
+
targetColumn: string;
|
|
620
|
+
}>;
|
|
621
|
+
}
|
|
622
|
+
|
|
561
623
|
/**
|
|
562
624
|
* Pre-aggregation CTE information
|
|
563
625
|
* Describes a Common Table Expression used for pre-aggregating hasMany relationships
|
|
@@ -575,12 +637,71 @@ export declare interface PreAggregationCTEInfo {
|
|
|
575
637
|
measures: string[];
|
|
576
638
|
}
|
|
577
639
|
|
|
640
|
+
/**
|
|
641
|
+
* Primary cube selection analysis
|
|
642
|
+
*/
|
|
643
|
+
export declare interface PrimaryCubeAnalysis {
|
|
644
|
+
/** Name of the selected primary cube */
|
|
645
|
+
selectedCube: string;
|
|
646
|
+
/** Reason for selection */
|
|
647
|
+
reason: PrimaryCubeSelectionReason;
|
|
648
|
+
/** Human-readable explanation */
|
|
649
|
+
explanation: string;
|
|
650
|
+
/** Other candidates that were considered */
|
|
651
|
+
candidates?: PrimaryCubeCandidate[];
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* Candidate cube considered for primary selection
|
|
656
|
+
*/
|
|
657
|
+
export declare interface PrimaryCubeCandidate {
|
|
658
|
+
/** Cube name */
|
|
659
|
+
cubeName: string;
|
|
660
|
+
/** Number of dimensions from this cube in the query */
|
|
661
|
+
dimensionCount: number;
|
|
662
|
+
/** Number of join definitions on this cube */
|
|
663
|
+
joinCount: number;
|
|
664
|
+
/** Whether this cube can reach all other required cubes */
|
|
665
|
+
canReachAll: boolean;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Query Analysis Types
|
|
670
|
+
* Provides transparency into query planning decisions for debugging
|
|
671
|
+
*/
|
|
672
|
+
/**
|
|
673
|
+
* Reason why a cube was selected as primary (FROM table)
|
|
674
|
+
*/
|
|
675
|
+
export declare type PrimaryCubeSelectionReason = 'most_dimensions' | 'most_connected' | 'alphabetical_fallback' | 'single_cube';
|
|
676
|
+
|
|
578
677
|
/**
|
|
579
678
|
* Any queryable relation that can be used in FROM/JOIN clauses
|
|
580
679
|
* Supports tables, views, subqueries, and raw SQL expressions
|
|
581
680
|
*/
|
|
582
681
|
export declare type QueryableRelation = Table | View | Subquery | SQL;
|
|
583
682
|
|
|
683
|
+
/**
|
|
684
|
+
* Complete query analysis result
|
|
685
|
+
*/
|
|
686
|
+
export declare interface QueryAnalysis {
|
|
687
|
+
/** Timestamp of analysis */
|
|
688
|
+
timestamp: string;
|
|
689
|
+
/** Number of cubes involved */
|
|
690
|
+
cubeCount: number;
|
|
691
|
+
/** List of all cubes used */
|
|
692
|
+
cubesInvolved: string[];
|
|
693
|
+
/** Primary cube selection details */
|
|
694
|
+
primaryCube: PrimaryCubeAnalysis;
|
|
695
|
+
/** Join path analysis for each joined cube */
|
|
696
|
+
joinPaths: JoinPathAnalysis[];
|
|
697
|
+
/** Pre-aggregation CTE details */
|
|
698
|
+
preAggregations: PreAggregationAnalysis[];
|
|
699
|
+
/** Overall query structure summary */
|
|
700
|
+
querySummary: QuerySummary;
|
|
701
|
+
/** Warnings or potential issues */
|
|
702
|
+
warnings?: string[];
|
|
703
|
+
}
|
|
704
|
+
|
|
584
705
|
export declare class QueryBuilder {
|
|
585
706
|
private databaseAdapter;
|
|
586
707
|
constructor(databaseAdapter: DatabaseAdapter);
|
|
@@ -867,6 +988,24 @@ export declare class QueryPlanner {
|
|
|
867
988
|
* Find hasMany join definition from primary cube to target cube
|
|
868
989
|
*/
|
|
869
990
|
private findHasManyJoinDef;
|
|
991
|
+
/**
|
|
992
|
+
* Analyze query planning decisions without building the full query
|
|
993
|
+
* Returns detailed metadata about how the query plan would be constructed
|
|
994
|
+
* Used for debugging and transparency in the playground UI
|
|
995
|
+
*/
|
|
996
|
+
analyzeQueryPlan(cubes: Map<string, Cube>, query: SemanticQuery, _ctx: QueryContext): QueryAnalysis;
|
|
997
|
+
/**
|
|
998
|
+
* Analyze why a particular cube was chosen as primary
|
|
999
|
+
*/
|
|
1000
|
+
private analyzePrimaryCubeSelection;
|
|
1001
|
+
/**
|
|
1002
|
+
* Analyze the join path between two cubes with detailed step information
|
|
1003
|
+
*/
|
|
1004
|
+
private analyzeJoinPath;
|
|
1005
|
+
/**
|
|
1006
|
+
* Analyze pre-aggregation requirements for hasMany relationships
|
|
1007
|
+
*/
|
|
1008
|
+
private analyzePreAggregations;
|
|
870
1009
|
}
|
|
871
1010
|
|
|
872
1011
|
/**
|
|
@@ -882,6 +1021,20 @@ export declare interface QueryResult {
|
|
|
882
1021
|
};
|
|
883
1022
|
}
|
|
884
1023
|
|
|
1024
|
+
/**
|
|
1025
|
+
* Query structure summary
|
|
1026
|
+
*/
|
|
1027
|
+
export declare interface QuerySummary {
|
|
1028
|
+
/** Query type: 'single_cube', 'multi_cube_join', or 'multi_cube_cte' */
|
|
1029
|
+
queryType: 'single_cube' | 'multi_cube_join' | 'multi_cube_cte';
|
|
1030
|
+
/** Total number of joins */
|
|
1031
|
+
joinCount: number;
|
|
1032
|
+
/** Total number of CTEs */
|
|
1033
|
+
cteCount: number;
|
|
1034
|
+
/** Has hasMany relationships requiring aggregation */
|
|
1035
|
+
hasPreAggregation: boolean;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
885
1038
|
/**
|
|
886
1039
|
* Resolve cube reference (handles both direct and lazy references)
|
|
887
1040
|
*/
|
|
@@ -1036,6 +1189,12 @@ export declare class SemanticLayerCompiler {
|
|
|
1036
1189
|
isValid: boolean;
|
|
1037
1190
|
errors: string[];
|
|
1038
1191
|
};
|
|
1192
|
+
/**
|
|
1193
|
+
* Analyze query planning decisions for debugging and transparency
|
|
1194
|
+
* Returns detailed metadata about how the query would be planned
|
|
1195
|
+
* Used by the playground UI to help users understand query structure
|
|
1196
|
+
*/
|
|
1197
|
+
analyzeQuery(query: SemanticQuery, securityContext: SecurityContext): QueryAnalysis;
|
|
1039
1198
|
}
|
|
1040
1199
|
|
|
1041
1200
|
/**
|