drizzle-cube 0.4.31 → 0.4.33

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 (34) hide show
  1. package/dist/adapters/express/index.cjs +1 -1
  2. package/dist/adapters/express/index.d.ts +1 -1
  3. package/dist/adapters/express/index.js +3 -3
  4. package/dist/adapters/fastify/index.cjs +1 -1
  5. package/dist/adapters/fastify/index.d.ts +1 -1
  6. package/dist/adapters/fastify/index.js +3 -3
  7. package/dist/adapters/{handler-GLMhjuwG.cjs → handler-ClgB__a-.cjs} +2 -2
  8. package/dist/adapters/{handler-BiVT5Sa4.js → handler-rPpxuopb.js} +2 -2
  9. package/dist/adapters/hono/index.cjs +1 -1
  10. package/dist/adapters/hono/index.d.ts +1 -1
  11. package/dist/adapters/hono/index.js +3 -3
  12. package/dist/adapters/mcp-transport-DPpei63d.cjs +255 -0
  13. package/dist/adapters/{mcp-transport-Cs6gEFCi.js → mcp-transport-DWSNkwUY.js} +581 -261
  14. package/dist/adapters/nextjs/index.cjs +1 -1
  15. package/dist/adapters/nextjs/index.d.ts +1 -1
  16. package/dist/adapters/nextjs/index.js +3 -3
  17. package/dist/adapters/{openai-C5Brybjm.cjs → openai-Bc8qwEKW.cjs} +1 -1
  18. package/dist/{server/openai-CucrxPHM.cjs → adapters/openai-C96O8M75.cjs} +1 -1
  19. package/dist/adapters/{openai-DPuFtYsB.js → openai-Ckpe7iU7.js} +1 -1
  20. package/dist/adapters/{openai-wU05wYGL.js → openai-DxeVtl8X.js} +1 -1
  21. package/dist/adapters/{utils-Dj1adfDc.js → utils-B7VkyzMv.js} +2 -1
  22. package/dist/adapters/{utils-cb6OWP7J.cjs → utils-BLFzzCI9.cjs} +1 -1
  23. package/dist/adapters/utils.cjs +1 -1
  24. package/dist/adapters/utils.d.ts +1 -1
  25. package/dist/adapters/utils.js +1 -1
  26. package/dist/server/index.cjs +42 -41
  27. package/dist/server/index.d.ts +43 -9
  28. package/dist/server/index.js +1452 -1131
  29. package/dist/server/{openai-DiyuZ3ds.cjs → openai-0HbLlZq6.cjs} +1 -1
  30. package/dist/{adapters/openai-D1zCEi6A.cjs → server/openai-DKpZPCay.cjs} +1 -1
  31. package/dist/server/{openai-owPdq1yN.js → openai-DnGeU9PT.js} +1 -1
  32. package/dist/server/{openai-nZJcAzON.js → openai-DqCEogm0.js} +1 -1
  33. package/package.json +11 -1
  34. package/dist/adapters/mcp-transport-nyTtswLM.cjs +0 -254
@@ -241,9 +241,9 @@ export declare abstract class BaseDatabaseExecutor implements DatabaseExecutor {
241
241
  db: DrizzleDatabase;
242
242
  schema?: any | undefined;
243
243
  databaseAdapter: DatabaseAdapter;
244
- constructor(db: DrizzleDatabase, schema?: any | undefined, engineType?: 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend');
244
+ constructor(db: DrizzleDatabase, schema?: any | undefined, engineType?: 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake');
245
245
  abstract execute<T = any[]>(query: SQL | any, numericFields?: string[]): Promise<T>;
246
- abstract getEngineType(): 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend';
246
+ abstract getEngineType(): 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake';
247
247
  abstract explainQuery(sqlString: string, params: unknown[], options?: ExplainOptions): Promise<ExplainResult>;
248
248
  abstract getTableIndexes(tableNames: string[]): Promise<IndexInfo[]>;
249
249
  }
@@ -615,7 +615,7 @@ export declare interface CompiledCube extends Cube {
615
615
  * @param engineType - Optional explicit engine type override
616
616
  * @returns Appropriate database executor
617
617
  */
618
- export declare function createDatabaseExecutor(db: DrizzleDatabase, schema?: any, engineType?: 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend'): DatabaseExecutor;
618
+ export declare function createDatabaseExecutor(db: DrizzleDatabase, schema?: any, engineType?: 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake'): DatabaseExecutor;
619
619
 
620
620
  /**
621
621
  * Factory function for creating Databend executors
@@ -651,6 +651,11 @@ export declare function createMySQLExecutor(db: DrizzleDatabase, schema?: any):
651
651
  */
652
652
  export declare function createPostgresExecutor(db: DrizzleDatabase, schema?: any): PostgresExecutor;
653
653
 
654
+ /**
655
+ * Factory function for creating Snowflake executors
656
+ */
657
+ export declare function createSnowflakeExecutor(db: DrizzleDatabase, schema?: any): SnowflakeExecutor;
658
+
654
659
  /**
655
660
  * Factory function for creating SQLite executors
656
661
  */
@@ -973,7 +978,7 @@ declare interface DatabaseAdapter {
973
978
  /**
974
979
  * Get the database engine type this adapter supports
975
980
  */
976
- getEngineType(): 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend';
981
+ getEngineType(): 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake';
977
982
  /**
978
983
  * Check if the database supports LATERAL joins
979
984
  * Required for optimized flow queries with index-backed seeks
@@ -1165,6 +1170,8 @@ declare interface DatabaseCapabilities {
1165
1170
  supportsPercentileSubqueries: boolean;
1166
1171
  /** Whether derived tables (subqueries) work in FROM clauses inside CTEs (false for Databend) */
1167
1172
  supportsDerivedTablesInCTE: boolean;
1173
+ /** Whether correlated LATERAL subqueries can reference CTEs (false for Snowflake) */
1174
+ supportsLateralSubqueriesInCTE: boolean;
1168
1175
  }
1169
1176
 
1170
1177
  /**
@@ -1181,7 +1188,7 @@ export declare interface DatabaseExecutor {
1181
1188
  /** Execute a Drizzle SQL query or query object */
1182
1189
  execute<T = any[]>(query: SQL | any, numericFields?: string[]): Promise<T>;
1183
1190
  /** Get the database engine type */
1184
- getEngineType(): 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend';
1191
+ getEngineType(): 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake';
1185
1192
  /** Execute EXPLAIN on a SQL query to get the execution plan */
1186
1193
  explainQuery(sqlString: string, params: unknown[], options?: ExplainOptions): Promise<ExplainResult>;
1187
1194
  /** Get existing indexes for the specified tables */
@@ -1654,7 +1661,7 @@ export declare interface ExplainResult {
1654
1661
  */
1655
1662
  export declare interface ExplainSummary {
1656
1663
  /** Database engine type */
1657
- database: 'postgres' | 'mysql' | 'sqlite' | 'duckdb' | 'databend';
1664
+ database: 'postgres' | 'mysql' | 'sqlite' | 'duckdb' | 'databend' | 'snowflake';
1658
1665
  /** Planning time in milliseconds (if available) */
1659
1666
  planningTime?: number;
1660
1667
  /** Execution time in milliseconds (if ANALYZE was used) */
@@ -4414,7 +4421,7 @@ export declare class SemanticLayerCompiler {
4414
4421
  drizzle?: DatabaseExecutor['db'];
4415
4422
  schema?: any;
4416
4423
  databaseExecutor?: DatabaseExecutor;
4417
- engineType?: 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend';
4424
+ engineType?: 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake';
4418
4425
  /** Cache configuration for query result caching */
4419
4426
  cache?: CacheConfig;
4420
4427
  });
@@ -4425,11 +4432,11 @@ export declare class SemanticLayerCompiler {
4425
4432
  /**
4426
4433
  * Get the database engine type for SQL formatting
4427
4434
  */
4428
- getEngineType(): 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | undefined;
4435
+ getEngineType(): 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake' | undefined;
4429
4436
  /**
4430
4437
  * Set Drizzle instance and schema directly
4431
4438
  */
4432
- setDrizzle(db: DatabaseExecutor['db'], schema?: any, engineType?: 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend'): void;
4439
+ setDrizzle(db: DatabaseExecutor['db'], schema?: any, engineType?: 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake'): void;
4433
4440
  /**
4434
4441
  * Check if database executor is configured
4435
4442
  */
@@ -4724,6 +4731,33 @@ export declare interface SimpleSource extends LogicalNodeBase {
4724
4731
  ctes: CTEPreAggregate[];
4725
4732
  }
4726
4733
 
4734
+ export declare class SnowflakeExecutor extends BaseDatabaseExecutor {
4735
+ execute<T = any[]>(query: SQL | any, numericFields?: string[]): Promise<T>;
4736
+ /**
4737
+ * Extract SQL string and params from a query object for error logging
4738
+ */
4739
+ private extractSqlFromQuery;
4740
+ /**
4741
+ * Convert numeric string fields to numbers (only for measure fields)
4742
+ */
4743
+ private convertNumericFields;
4744
+ /**
4745
+ * Coerce a value to a number if it represents a numeric type
4746
+ */
4747
+ private coerceToNumber;
4748
+ getEngineType(): 'snowflake';
4749
+ /**
4750
+ * Execute EXPLAIN on a SQL query to get the execution plan
4751
+ * Snowflake supports EXPLAIN and EXPLAIN USING TEXT/JSON/TABULAR
4752
+ */
4753
+ explainQuery(sqlString: string, params: unknown[], options?: ExplainOptions): Promise<ExplainResult>;
4754
+ /**
4755
+ * Get existing indexes for the specified tables
4756
+ * Snowflake doesn't use traditional indexes (it uses micro-partitioning)
4757
+ */
4758
+ getTableIndexes(_tableNames: string[]): Promise<IndexInfo[]>;
4759
+ }
4760
+
4727
4761
  export { SQL }
4728
4762
 
4729
4763
  /**