drizzle-cube 0.1.18 → 0.1.19
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-Dec55JjO.js → compiler-CPsEzFP2.js} +702 -703
- package/dist/adapters/express/index.d.ts +7 -7
- package/dist/adapters/express/index.js +1 -1
- package/dist/adapters/fastify/index.d.ts +6 -6
- package/dist/adapters/fastify/index.js +1 -1
- package/dist/adapters/hono/index.d.ts +7 -7
- package/dist/adapters/hono/index.js +1 -1
- package/dist/adapters/nextjs/index.d.ts +9 -9
- package/dist/adapters/nextjs/index.js +1 -1
- package/dist/adapters/utils.d.ts +3 -3
- package/dist/server/index.d.ts +177 -246
- package/dist/server/index.js +613 -621
- package/package.json +2 -2
|
@@ -4,22 +4,22 @@ import { SemanticQuery, SecurityContext, DatabaseExecutor, DrizzleDatabase, Cube
|
|
|
4
4
|
import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
|
5
5
|
import { MySql2Database } from 'drizzle-orm/mysql2';
|
|
6
6
|
import { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
|
7
|
-
export interface ExpressAdapterOptions
|
|
7
|
+
export interface ExpressAdapterOptions {
|
|
8
8
|
/**
|
|
9
9
|
* Array of cube definitions to register
|
|
10
10
|
*/
|
|
11
|
-
cubes: Cube
|
|
11
|
+
cubes: Cube[];
|
|
12
12
|
/**
|
|
13
13
|
* Drizzle database instance (REQUIRED)
|
|
14
14
|
* This is the core of drizzle-cube - Drizzle ORM integration
|
|
15
15
|
* Accepts PostgreSQL, MySQL, or SQLite database instances
|
|
16
16
|
*/
|
|
17
|
-
drizzle: PostgresJsDatabase<
|
|
17
|
+
drizzle: PostgresJsDatabase<any> | MySql2Database<any> | BetterSQLite3Database<any> | DrizzleDatabase;
|
|
18
18
|
/**
|
|
19
19
|
* Database schema for type inference (RECOMMENDED)
|
|
20
20
|
* Provides full type safety for cube definitions
|
|
21
21
|
*/
|
|
22
|
-
schema?:
|
|
22
|
+
schema?: any;
|
|
23
23
|
/**
|
|
24
24
|
* Extract security context from incoming HTTP request.
|
|
25
25
|
* Called for EVERY API request to determine user permissions and multi-tenant isolation.
|
|
@@ -65,11 +65,11 @@ export interface ExpressAdapterOptions<TSchema extends Record<string, any> = Rec
|
|
|
65
65
|
/**
|
|
66
66
|
* Create Express router for Cube.js-compatible API
|
|
67
67
|
*/
|
|
68
|
-
export declare function createCubeRouter
|
|
68
|
+
export declare function createCubeRouter(options: ExpressAdapterOptions): Router;
|
|
69
69
|
/**
|
|
70
70
|
* Convenience function to mount Cube routes on an existing Express app
|
|
71
71
|
*/
|
|
72
|
-
export declare function mountCubeRoutes
|
|
72
|
+
export declare function mountCubeRoutes(app: Express, options: ExpressAdapterOptions): Express;
|
|
73
73
|
/**
|
|
74
74
|
* Create a complete Express app with Cube.js routes
|
|
75
75
|
*
|
|
@@ -85,5 +85,5 @@ export declare function mountCubeRoutes<TSchema extends Record<string, any> = Re
|
|
|
85
85
|
* }
|
|
86
86
|
* })
|
|
87
87
|
*/
|
|
88
|
-
export declare function createCubeApp
|
|
88
|
+
export declare function createCubeApp(options: ExpressAdapterOptions): Express;
|
|
89
89
|
export type { SecurityContext, DatabaseExecutor, SemanticQuery, DrizzleDatabase, CorsOptions };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Q, { Router as E } from "express";
|
|
2
2
|
import R from "cors";
|
|
3
|
-
import { S as $, c as a, f as v, a as L, b as x, h } from "../compiler-
|
|
3
|
+
import { S as $, c as a, f as v, a as L, b as x, h } from "../compiler-CPsEzFP2.js";
|
|
4
4
|
function N(l) {
|
|
5
5
|
const {
|
|
6
6
|
cubes: c,
|
|
@@ -4,22 +4,22 @@ import { SemanticQuery, SecurityContext, DatabaseExecutor, DrizzleDatabase, Cube
|
|
|
4
4
|
import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
|
5
5
|
import { MySql2Database } from 'drizzle-orm/mysql2';
|
|
6
6
|
import { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
|
7
|
-
export interface FastifyAdapterOptions
|
|
7
|
+
export interface FastifyAdapterOptions {
|
|
8
8
|
/**
|
|
9
9
|
* Array of cube definitions to register
|
|
10
10
|
*/
|
|
11
|
-
cubes: Cube
|
|
11
|
+
cubes: Cube[];
|
|
12
12
|
/**
|
|
13
13
|
* Drizzle database instance (REQUIRED)
|
|
14
14
|
* This is the core of drizzle-cube - Drizzle ORM integration
|
|
15
15
|
* Accepts PostgreSQL, MySQL, or SQLite database instances
|
|
16
16
|
*/
|
|
17
|
-
drizzle: PostgresJsDatabase<
|
|
17
|
+
drizzle: PostgresJsDatabase<any> | MySql2Database<any> | BetterSQLite3Database<any> | DrizzleDatabase;
|
|
18
18
|
/**
|
|
19
19
|
* Database schema for type inference (RECOMMENDED)
|
|
20
20
|
* Provides full type safety for cube definitions
|
|
21
21
|
*/
|
|
22
|
-
schema?:
|
|
22
|
+
schema?: any;
|
|
23
23
|
/**
|
|
24
24
|
* Extract security context from incoming HTTP request.
|
|
25
25
|
* Called for EVERY API request to determine user permissions and multi-tenant isolation.
|
|
@@ -68,7 +68,7 @@ export declare const cubePlugin: FastifyPluginCallback<FastifyAdapterOptions>;
|
|
|
68
68
|
/**
|
|
69
69
|
* Helper function to register cube routes on an existing Fastify instance
|
|
70
70
|
*/
|
|
71
|
-
export declare function registerCubeRoutes
|
|
71
|
+
export declare function registerCubeRoutes(fastify: FastifyInstance, options: FastifyAdapterOptions): Promise<void>;
|
|
72
72
|
/**
|
|
73
73
|
* Create a complete Fastify instance with Cube.js routes
|
|
74
74
|
*
|
|
@@ -84,5 +84,5 @@ export declare function registerCubeRoutes<TSchema extends Record<string, any> =
|
|
|
84
84
|
* }
|
|
85
85
|
* })
|
|
86
86
|
*/
|
|
87
|
-
export declare function createCubeApp
|
|
87
|
+
export declare function createCubeApp(options: FastifyAdapterOptions): FastifyInstance;
|
|
88
88
|
export type { SecurityContext, DatabaseExecutor, SemanticQuery, DrizzleDatabase, FastifyCorsOptions };
|
|
@@ -3,22 +3,22 @@ import { SemanticQuery, SecurityContext, DatabaseExecutor, DrizzleDatabase, Cube
|
|
|
3
3
|
import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
|
4
4
|
import { MySql2Database } from 'drizzle-orm/mysql2';
|
|
5
5
|
import { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
|
6
|
-
export interface HonoAdapterOptions
|
|
6
|
+
export interface HonoAdapterOptions {
|
|
7
7
|
/**
|
|
8
8
|
* Array of cube definitions to register
|
|
9
9
|
*/
|
|
10
|
-
cubes: Cube
|
|
10
|
+
cubes: Cube[];
|
|
11
11
|
/**
|
|
12
12
|
* Drizzle database instance (REQUIRED)
|
|
13
13
|
* This is the core of drizzle-cube - Drizzle ORM integration
|
|
14
14
|
* Accepts PostgreSQL, MySQL, or SQLite database instances
|
|
15
15
|
*/
|
|
16
|
-
drizzle: PostgresJsDatabase<
|
|
16
|
+
drizzle: PostgresJsDatabase<any> | MySql2Database<any> | BetterSQLite3Database<any> | DrizzleDatabase;
|
|
17
17
|
/**
|
|
18
18
|
* Database schema for type inference (RECOMMENDED)
|
|
19
19
|
* Provides full type safety for cube definitions
|
|
20
20
|
*/
|
|
21
|
-
schema?:
|
|
21
|
+
schema?: any;
|
|
22
22
|
/**
|
|
23
23
|
* Extract security context from incoming HTTP request.
|
|
24
24
|
* Called for EVERY API request to determine user permissions and multi-tenant isolation.
|
|
@@ -64,11 +64,11 @@ export interface HonoAdapterOptions<TSchema extends Record<string, any> = Record
|
|
|
64
64
|
/**
|
|
65
65
|
* Create Hono routes for Cube.js-compatible API
|
|
66
66
|
*/
|
|
67
|
-
export declare function createCubeRoutes
|
|
67
|
+
export declare function createCubeRoutes(options: HonoAdapterOptions): Hono<import('hono/types').BlankEnv, import('hono/types').BlankSchema, "/">;
|
|
68
68
|
/**
|
|
69
69
|
* Convenience function to create routes and mount them on an existing Hono app
|
|
70
70
|
*/
|
|
71
|
-
export declare function mountCubeRoutes
|
|
71
|
+
export declare function mountCubeRoutes(app: Hono, options: HonoAdapterOptions): Hono<import('hono/types').BlankEnv, import('hono/types').BlankSchema, "/">;
|
|
72
72
|
/**
|
|
73
73
|
* Create a complete Hono app with Cube.js routes
|
|
74
74
|
*
|
|
@@ -84,5 +84,5 @@ export declare function mountCubeRoutes<TSchema extends Record<string, any> = Re
|
|
|
84
84
|
* }
|
|
85
85
|
* })
|
|
86
86
|
*/
|
|
87
|
-
export declare function createCubeApp
|
|
87
|
+
export declare function createCubeApp(options: HonoAdapterOptions): Hono<import('hono/types').BlankEnv, import('hono/types').BlankSchema, "/">;
|
|
88
88
|
export type { SecurityContext, DatabaseExecutor, SemanticQuery, DrizzleDatabase };
|
|
@@ -21,22 +21,22 @@ export interface NextCorsOptions {
|
|
|
21
21
|
*/
|
|
22
22
|
credentials?: boolean;
|
|
23
23
|
}
|
|
24
|
-
export interface NextAdapterOptions
|
|
24
|
+
export interface NextAdapterOptions {
|
|
25
25
|
/**
|
|
26
26
|
* Array of cube definitions to register
|
|
27
27
|
*/
|
|
28
|
-
cubes: Cube
|
|
28
|
+
cubes: Cube[];
|
|
29
29
|
/**
|
|
30
30
|
* Drizzle database instance (REQUIRED)
|
|
31
31
|
* This is the core of drizzle-cube - Drizzle ORM integration
|
|
32
32
|
* Accepts PostgreSQL, MySQL, or SQLite database instances
|
|
33
33
|
*/
|
|
34
|
-
drizzle: PostgresJsDatabase<
|
|
34
|
+
drizzle: PostgresJsDatabase<any> | MySql2Database<any> | BetterSQLite3Database<any> | DrizzleDatabase;
|
|
35
35
|
/**
|
|
36
36
|
* Database schema for type inference (RECOMMENDED)
|
|
37
37
|
* Provides full type safety for cube definitions
|
|
38
38
|
*/
|
|
39
|
-
schema?:
|
|
39
|
+
schema?: any;
|
|
40
40
|
/**
|
|
41
41
|
* Extract security context from incoming HTTP request.
|
|
42
42
|
* Called for EVERY API request to determine user permissions and multi-tenant isolation.
|
|
@@ -93,19 +93,19 @@ export declare function createOptionsHandler(corsOptions: NextCorsOptions): Rout
|
|
|
93
93
|
/**
|
|
94
94
|
* Create load handler - Execute queries
|
|
95
95
|
*/
|
|
96
|
-
export declare function createLoadHandler
|
|
96
|
+
export declare function createLoadHandler(options: NextAdapterOptions): RouteHandler;
|
|
97
97
|
/**
|
|
98
98
|
* Create meta handler - Get cube metadata
|
|
99
99
|
*/
|
|
100
|
-
export declare function createMetaHandler
|
|
100
|
+
export declare function createMetaHandler(options: NextAdapterOptions): RouteHandler;
|
|
101
101
|
/**
|
|
102
102
|
* Create SQL handler - Generate SQL without execution
|
|
103
103
|
*/
|
|
104
|
-
export declare function createSqlHandler
|
|
104
|
+
export declare function createSqlHandler(options: NextAdapterOptions): RouteHandler;
|
|
105
105
|
/**
|
|
106
106
|
* Create dry-run handler - Validate queries without execution
|
|
107
107
|
*/
|
|
108
|
-
export declare function createDryRunHandler
|
|
108
|
+
export declare function createDryRunHandler(options: NextAdapterOptions): RouteHandler;
|
|
109
109
|
/**
|
|
110
110
|
* Convenience function to create all route handlers
|
|
111
111
|
*
|
|
@@ -125,5 +125,5 @@ export declare function createDryRunHandler<TSchema extends Record<string, any>
|
|
|
125
125
|
* export const GET = handlers.load
|
|
126
126
|
* export const POST = handlers.load
|
|
127
127
|
*/
|
|
128
|
-
export declare function createCubeHandlers
|
|
128
|
+
export declare function createCubeHandlers(options: NextAdapterOptions): CubeHandlers;
|
|
129
129
|
export type { SecurityContext, DatabaseExecutor, SemanticQuery, DrizzleDatabase, NextCorsOptions as CorsOptions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NextResponse as o } from "next/server";
|
|
2
|
-
import { c as l, f as C, a as H, b as p, h as v, S as A } from "../compiler-
|
|
2
|
+
import { c as l, f as C, a as H, b as p, h as v, S as A } from "../compiler-CPsEzFP2.js";
|
|
3
3
|
function g(t) {
|
|
4
4
|
const { cubes: e, drizzle: n, schema: s, engineType: y } = t;
|
|
5
5
|
if (!e || e.length === 0)
|
package/dist/adapters/utils.d.ts
CHANGED
|
@@ -14,11 +14,11 @@ export declare function buildTransformedQuery(query: SemanticQuery): any;
|
|
|
14
14
|
/**
|
|
15
15
|
* Get database type from semantic layer
|
|
16
16
|
*/
|
|
17
|
-
export declare function getDatabaseType(semanticLayer: SemanticLayerCompiler
|
|
17
|
+
export declare function getDatabaseType(semanticLayer: SemanticLayerCompiler): string;
|
|
18
18
|
/**
|
|
19
19
|
* Helper function to handle dry-run logic for all adapters
|
|
20
20
|
*/
|
|
21
|
-
export declare function handleDryRun(query: SemanticQuery, securityContext: SecurityContext, semanticLayer: SemanticLayerCompiler
|
|
21
|
+
export declare function handleDryRun(query: SemanticQuery, securityContext: SecurityContext, semanticLayer: SemanticLayerCompiler): Promise<{
|
|
22
22
|
queryType: string;
|
|
23
23
|
normalizedQueries: {
|
|
24
24
|
cube: string;
|
|
@@ -65,7 +65,7 @@ export declare function handleDryRun(query: SemanticQuery, securityContext: Secu
|
|
|
65
65
|
export declare function formatCubeResponse(query: SemanticQuery, result: {
|
|
66
66
|
data: any[];
|
|
67
67
|
annotation?: any;
|
|
68
|
-
}, semanticLayer: SemanticLayerCompiler
|
|
68
|
+
}, semanticLayer: SemanticLayerCompiler): {
|
|
69
69
|
queryType: string;
|
|
70
70
|
results: {
|
|
71
71
|
query: SemanticQuery;
|