drizzle-cube 0.1.0 → 0.1.2
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/README.md +407 -0
- package/dist/adapters/hono/index.d.ts +49 -0
- package/dist/adapters/hono/index.js +169 -2
- package/dist/adapters/types.d.ts +41 -0
- package/dist/server/index.d.ts +1977 -76
- package/dist/server/index.js +3414 -485
- package/package.json +25 -4
package/dist/server/index.d.ts
CHANGED
|
@@ -1,13 +1,146 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { AnyColumn } from 'drizzle-orm';
|
|
2
|
+
import { Many } from 'drizzle-orm';
|
|
3
|
+
import { One } from 'drizzle-orm';
|
|
4
|
+
import { PgColumn } from 'drizzle-orm/pg-core';
|
|
5
|
+
import { PgTableWithColumns } from 'drizzle-orm/pg-core';
|
|
6
|
+
import { Relations } from 'drizzle-orm';
|
|
7
|
+
import { SQL } from 'drizzle-orm';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Abstract base class for database executors
|
|
11
|
+
*/
|
|
12
|
+
export declare abstract class BaseDatabaseExecutor<TSchema extends Record<string, any> = Record<string, any>> implements DatabaseExecutor<TSchema> {
|
|
13
|
+
db: DrizzleDatabase<TSchema>;
|
|
14
|
+
schema?: TSchema | undefined;
|
|
15
|
+
constructor(db: DrizzleDatabase<TSchema>, schema?: TSchema | undefined);
|
|
16
|
+
abstract execute<T = any[]>(query: SQL | any): Promise<T>;
|
|
17
|
+
abstract getEngineType(): 'postgres' | 'mysql' | 'sqlite';
|
|
3
18
|
}
|
|
4
19
|
|
|
5
20
|
/**
|
|
6
|
-
*
|
|
21
|
+
* Base query definition that can be extended dynamically
|
|
22
|
+
* Returns just the FROM/JOIN/WHERE setup, not a complete SELECT
|
|
23
|
+
*/
|
|
24
|
+
export declare interface BaseQueryDefinition {
|
|
25
|
+
/** Main table to query from */
|
|
26
|
+
from: any;
|
|
27
|
+
/** Optional joins to other tables */
|
|
28
|
+
joins?: Array<{
|
|
29
|
+
table: any;
|
|
30
|
+
on: SQL;
|
|
31
|
+
type?: 'left' | 'right' | 'inner' | 'full';
|
|
32
|
+
}>;
|
|
33
|
+
/** Base WHERE conditions (typically security context filtering) */
|
|
34
|
+
where?: SQL;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Compiled cube with execution function
|
|
39
|
+
*/
|
|
40
|
+
export declare interface CompiledCube<TSchema extends Record<string, any> = Record<string, any>> extends Cube<TSchema> {
|
|
41
|
+
/** Execute a query against this cube */
|
|
42
|
+
queryFn: (query: SemanticQuery, securityContext: SecurityContext) => Promise<QueryResult>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Helper function to convert Cube.dev-style YAML references
|
|
47
|
+
* Converts {CUBE}, {CubeName.field}, etc. to our format
|
|
48
|
+
*/
|
|
49
|
+
export declare function convertCubeReferences(sql: string): string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Auto-detect database type and create appropriate executor
|
|
53
|
+
* @param db - Drizzle database instance
|
|
54
|
+
* @param schema - Optional schema for type inference
|
|
55
|
+
* @param engineType - Optional explicit engine type override
|
|
56
|
+
* @returns Appropriate database executor
|
|
57
|
+
*/
|
|
58
|
+
export declare function createDatabaseExecutor<TSchema extends Record<string, any>>(db: DrizzleDatabase<TSchema>, schema?: TSchema, engineType?: 'postgres' | 'mysql' | 'sqlite'): DatabaseExecutor<TSchema>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Create a new semantic layer instance with Drizzle integration
|
|
7
62
|
* Use this when you need multiple isolated instances
|
|
8
63
|
*/
|
|
9
|
-
export declare function
|
|
64
|
+
export declare function createDrizzleSemanticLayer<TSchema extends Record<string, any>>(options: {
|
|
65
|
+
drizzle: DrizzleDatabase<TSchema>;
|
|
66
|
+
schema?: TSchema;
|
|
67
|
+
}): SemanticLayerCompiler<TSchema>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Helper to create multi-cube query context
|
|
71
|
+
*/
|
|
72
|
+
export declare function createMultiCubeContext<TSchema extends Record<string, any>>(baseContext: QueryContext<TSchema>, cubes: Map<string, Cube<TSchema>>, currentCube: Cube<TSchema>): MultiCubeQueryContext<TSchema>;
|
|
73
|
+
|
|
74
|
+
export declare function createMySQLExecutor<TSchema extends Record<string, any>>(db: DrizzleDatabase<TSchema>, schema?: TSchema): MySQLExecutor<TSchema>;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Factory functions for creating database executors
|
|
78
|
+
*/
|
|
79
|
+
export declare function createPostgresExecutor<TSchema extends Record<string, any>>(db: DrizzleDatabase<TSchema>, schema?: TSchema): PostgresExecutor<TSchema>;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Create a new semantic layer compiler with type inference
|
|
83
|
+
*/
|
|
84
|
+
export declare function createSemanticLayer<TSchema extends Record<string, any>>(options?: {
|
|
85
|
+
drizzle?: DatabaseExecutor<TSchema>['db'];
|
|
86
|
+
schema?: TSchema;
|
|
87
|
+
databaseExecutor?: DatabaseExecutor<TSchema>;
|
|
88
|
+
engineType?: 'postgres' | 'mysql' | 'sqlite';
|
|
89
|
+
}): SemanticLayerCompiler<TSchema>;
|
|
90
|
+
|
|
91
|
+
export declare function createSQLiteExecutor<TSchema extends Record<string, any>>(db: DrizzleDatabase<TSchema>, schema?: TSchema): SQLiteExecutor<TSchema>;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Cube definition focused on dynamic query building
|
|
95
|
+
*/
|
|
96
|
+
export declare interface Cube<TSchema extends Record<string, any> = Record<string, any>> {
|
|
97
|
+
name: string;
|
|
98
|
+
title?: string;
|
|
99
|
+
description?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Base query setup - returns the foundation that can be extended
|
|
102
|
+
* Should return FROM/JOIN/WHERE setup, NOT a complete SELECT
|
|
103
|
+
*/
|
|
104
|
+
sql: (ctx: QueryContext<TSchema>) => BaseQueryDefinition;
|
|
105
|
+
/** Cube dimensions using direct column references */
|
|
106
|
+
dimensions: Record<string, Dimension<TSchema>>;
|
|
107
|
+
/** Cube measures using direct column references */
|
|
108
|
+
measures: Record<string, Measure<TSchema>>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Helper type for creating type-safe cubes
|
|
113
|
+
*/
|
|
114
|
+
export declare interface CubeDefiner<TSchema extends Record<string, any>> {
|
|
115
|
+
<TName extends string>(name: TName, definition: CubeDefinition<TSchema>): SemanticCube<TSchema> & {
|
|
116
|
+
name: TName;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Utility type for cube definition with schema inference
|
|
122
|
+
*/
|
|
123
|
+
export declare type CubeDefinition<TSchema extends Record<string, any>> = Omit<SemanticCube<TSchema>, 'name'> & {
|
|
124
|
+
name?: string;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Cube join definition for multi-cube queries
|
|
129
|
+
*/
|
|
130
|
+
export declare interface CubeJoin<TSchema extends Record<string, any> = Record<string, any>> {
|
|
131
|
+
/** Target cube name to join with */
|
|
132
|
+
targetCube: string;
|
|
133
|
+
/** Join condition */
|
|
134
|
+
condition: (ctx: MultiCubeQueryContext<TSchema>) => SQL;
|
|
135
|
+
/** Join type */
|
|
136
|
+
type?: 'inner' | 'left' | 'right' | 'full';
|
|
137
|
+
/** Relationship type for metadata */
|
|
138
|
+
relationship: 'belongsTo' | 'hasOne' | 'hasMany';
|
|
139
|
+
}
|
|
10
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Cube metadata for API responses
|
|
143
|
+
*/
|
|
11
144
|
export declare interface CubeMetadata {
|
|
12
145
|
name: string;
|
|
13
146
|
title: string;
|
|
@@ -17,17 +150,180 @@ export declare interface CubeMetadata {
|
|
|
17
150
|
segments: any[];
|
|
18
151
|
}
|
|
19
152
|
|
|
20
|
-
|
|
21
|
-
|
|
153
|
+
/**
|
|
154
|
+
* Enhanced Cube with join definitions for multi-cube support
|
|
155
|
+
*/
|
|
156
|
+
export declare interface CubeWithJoins<TSchema extends Record<string, any> = Record<string, any>> extends Cube<TSchema> {
|
|
157
|
+
/** Joins to other cubes for multi-cube queries */
|
|
158
|
+
joins?: Record<string, CubeJoin<TSchema>>;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Database executor that wraps Drizzle ORM
|
|
163
|
+
* Provides type-safe SQL execution with engine-specific implementations
|
|
164
|
+
*/
|
|
165
|
+
export declare interface DatabaseExecutor<TSchema extends Record<string, any> = Record<string, any>> {
|
|
166
|
+
/** The Drizzle database instance */
|
|
167
|
+
db: DrizzleDatabase<TSchema>;
|
|
168
|
+
/** Optional schema for type inference */
|
|
169
|
+
schema?: TSchema;
|
|
170
|
+
/** Execute a Drizzle SQL query or query object */
|
|
171
|
+
execute<T = any[]>(query: SQL | any): Promise<T>;
|
|
172
|
+
/** Get the database engine type */
|
|
173
|
+
getEngineType(): 'postgres' | 'mysql' | 'sqlite';
|
|
22
174
|
}
|
|
23
175
|
|
|
24
176
|
/**
|
|
25
177
|
* Main semantic layer instance
|
|
26
178
|
* Use this for simple single-instance usage
|
|
27
179
|
*/
|
|
28
|
-
export declare const defaultSemanticLayer: SemanticLayerCompiler
|
|
180
|
+
export declare const defaultSemanticLayer: SemanticLayerCompiler<Record<string, any>>;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Helper function to create cubes
|
|
184
|
+
*/
|
|
185
|
+
export declare function defineCube<TSchema extends Record<string, any>>(name: string, definition: Omit<Cube<TSchema>, 'name'>): Cube<TSchema>;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Create a type-safe cube definition with schema inference
|
|
189
|
+
* @param _schema - Drizzle schema containing table definitions (used for type inference only)
|
|
190
|
+
* @param definition - Cube definition with type inference
|
|
191
|
+
* @returns Type-safe semantic cube
|
|
192
|
+
*/
|
|
193
|
+
export declare function defineLegacyCube<TSchema extends Record<string, any>>(_schema: TSchema, definition: CubeDefinition<TSchema> & {
|
|
194
|
+
name: string;
|
|
195
|
+
}): SemanticCube<TSchema>;
|
|
196
|
+
|
|
197
|
+
export declare const departments: PgTableWithColumns< {
|
|
198
|
+
name: "departments";
|
|
199
|
+
schema: undefined;
|
|
200
|
+
columns: {
|
|
201
|
+
id: PgColumn< {
|
|
202
|
+
name: "id";
|
|
203
|
+
tableName: "departments";
|
|
204
|
+
dataType: "number";
|
|
205
|
+
columnType: "PgInteger";
|
|
206
|
+
data: number;
|
|
207
|
+
driverParam: string | number;
|
|
208
|
+
notNull: true;
|
|
209
|
+
hasDefault: false;
|
|
210
|
+
isPrimaryKey: true;
|
|
211
|
+
isAutoincrement: false;
|
|
212
|
+
hasRuntimeDefault: false;
|
|
213
|
+
enumValues: undefined;
|
|
214
|
+
baseColumn: never;
|
|
215
|
+
identity: undefined;
|
|
216
|
+
generated: undefined;
|
|
217
|
+
}, {}, {}>;
|
|
218
|
+
name: PgColumn< {
|
|
219
|
+
name: "name";
|
|
220
|
+
tableName: "departments";
|
|
221
|
+
dataType: "string";
|
|
222
|
+
columnType: "PgText";
|
|
223
|
+
data: string;
|
|
224
|
+
driverParam: string;
|
|
225
|
+
notNull: true;
|
|
226
|
+
hasDefault: false;
|
|
227
|
+
isPrimaryKey: false;
|
|
228
|
+
isAutoincrement: false;
|
|
229
|
+
hasRuntimeDefault: false;
|
|
230
|
+
enumValues: [string, ...string[]];
|
|
231
|
+
baseColumn: never;
|
|
232
|
+
identity: undefined;
|
|
233
|
+
generated: undefined;
|
|
234
|
+
}, {}, {}>;
|
|
235
|
+
description: PgColumn< {
|
|
236
|
+
name: "description";
|
|
237
|
+
tableName: "departments";
|
|
238
|
+
dataType: "string";
|
|
239
|
+
columnType: "PgText";
|
|
240
|
+
data: string;
|
|
241
|
+
driverParam: string;
|
|
242
|
+
notNull: false;
|
|
243
|
+
hasDefault: false;
|
|
244
|
+
isPrimaryKey: false;
|
|
245
|
+
isAutoincrement: false;
|
|
246
|
+
hasRuntimeDefault: false;
|
|
247
|
+
enumValues: [string, ...string[]];
|
|
248
|
+
baseColumn: never;
|
|
249
|
+
identity: undefined;
|
|
250
|
+
generated: undefined;
|
|
251
|
+
}, {}, {}>;
|
|
252
|
+
organisation: PgColumn< {
|
|
253
|
+
name: "organisation";
|
|
254
|
+
tableName: "departments";
|
|
255
|
+
dataType: "number";
|
|
256
|
+
columnType: "PgInteger";
|
|
257
|
+
data: number;
|
|
258
|
+
driverParam: string | number;
|
|
259
|
+
notNull: true;
|
|
260
|
+
hasDefault: false;
|
|
261
|
+
isPrimaryKey: false;
|
|
262
|
+
isAutoincrement: false;
|
|
263
|
+
hasRuntimeDefault: false;
|
|
264
|
+
enumValues: undefined;
|
|
265
|
+
baseColumn: never;
|
|
266
|
+
identity: undefined;
|
|
267
|
+
generated: undefined;
|
|
268
|
+
}, {}, {}>;
|
|
269
|
+
createdAt: PgColumn< {
|
|
270
|
+
name: "created_at";
|
|
271
|
+
tableName: "departments";
|
|
272
|
+
dataType: "date";
|
|
273
|
+
columnType: "PgTimestamp";
|
|
274
|
+
data: Date;
|
|
275
|
+
driverParam: string;
|
|
276
|
+
notNull: false;
|
|
277
|
+
hasDefault: true;
|
|
278
|
+
isPrimaryKey: false;
|
|
279
|
+
isAutoincrement: false;
|
|
280
|
+
hasRuntimeDefault: false;
|
|
281
|
+
enumValues: undefined;
|
|
282
|
+
baseColumn: never;
|
|
283
|
+
identity: undefined;
|
|
284
|
+
generated: undefined;
|
|
285
|
+
}, {}, {}>;
|
|
286
|
+
updatedAt: PgColumn< {
|
|
287
|
+
name: "updated_at";
|
|
288
|
+
tableName: "departments";
|
|
289
|
+
dataType: "date";
|
|
290
|
+
columnType: "PgTimestamp";
|
|
291
|
+
data: Date;
|
|
292
|
+
driverParam: string;
|
|
293
|
+
notNull: false;
|
|
294
|
+
hasDefault: true;
|
|
295
|
+
isPrimaryKey: false;
|
|
296
|
+
isAutoincrement: false;
|
|
297
|
+
hasRuntimeDefault: false;
|
|
298
|
+
enumValues: undefined;
|
|
299
|
+
baseColumn: never;
|
|
300
|
+
identity: undefined;
|
|
301
|
+
generated: undefined;
|
|
302
|
+
}, {}, {}>;
|
|
303
|
+
};
|
|
304
|
+
dialect: "pg";
|
|
305
|
+
}>;
|
|
29
306
|
|
|
30
|
-
export declare const
|
|
307
|
+
export declare const departmentsRelations: Relations<"departments", {
|
|
308
|
+
organisation: One<"organisations", true>;
|
|
309
|
+
employees: Many<"employees">;
|
|
310
|
+
}>;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Dimension definition
|
|
314
|
+
*/
|
|
315
|
+
export declare interface Dimension<TSchema extends Record<string, any> = Record<string, any>> {
|
|
316
|
+
name: string;
|
|
317
|
+
title?: string;
|
|
318
|
+
description?: string;
|
|
319
|
+
type: DimensionType;
|
|
320
|
+
/** Direct column reference or SQL expression */
|
|
321
|
+
sql: AnyColumn | SQL | ((ctx: QueryContext<TSchema>) => AnyColumn | SQL);
|
|
322
|
+
/** Whether this is a primary key */
|
|
323
|
+
primaryKey?: boolean;
|
|
324
|
+
/** Display format */
|
|
325
|
+
format?: string;
|
|
326
|
+
}
|
|
31
327
|
|
|
32
328
|
export declare interface DimensionAnnotation {
|
|
33
329
|
title: string;
|
|
@@ -36,7 +332,7 @@ export declare interface DimensionAnnotation {
|
|
|
36
332
|
format?: DimensionFormat;
|
|
37
333
|
}
|
|
38
334
|
|
|
39
|
-
export declare type DimensionFormat = 'currency' | 'percent' | 'number' | 'date' | 'datetime';
|
|
335
|
+
export declare type DimensionFormat = 'currency' | 'percent' | 'number' | 'date' | 'datetime' | 'id' | 'link';
|
|
40
336
|
|
|
41
337
|
export declare interface DimensionMetadata {
|
|
42
338
|
name: string;
|
|
@@ -47,18 +343,892 @@ export declare interface DimensionMetadata {
|
|
|
47
343
|
description?: string;
|
|
48
344
|
}
|
|
49
345
|
|
|
50
|
-
export declare
|
|
346
|
+
export declare type DimensionType = 'string' | 'number' | 'time' | 'boolean';
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Drizzle column reference type
|
|
350
|
+
*/
|
|
351
|
+
export declare type DrizzleColumn = {
|
|
352
|
+
_: {
|
|
353
|
+
name: string;
|
|
354
|
+
dataType: string;
|
|
355
|
+
columnType: string;
|
|
356
|
+
};
|
|
357
|
+
};
|
|
51
358
|
|
|
52
359
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
360
|
+
* Generic Drizzle database type
|
|
361
|
+
* Supports any Drizzle client (PostgreSQL, MySQL, SQLite)
|
|
55
362
|
*/
|
|
56
|
-
export declare
|
|
363
|
+
export declare type DrizzleDatabase<TSchema extends Record<string, any> = Record<string, any>> = {
|
|
364
|
+
select: (fields?: any) => any;
|
|
365
|
+
insert: (table: any) => any;
|
|
366
|
+
update: (table: any) => any;
|
|
367
|
+
delete: (table: any) => any;
|
|
368
|
+
execute?: (query: SQL) => Promise<any>;
|
|
369
|
+
run?: (query: SQL) => any;
|
|
370
|
+
all?: (query: SQL) => any[];
|
|
371
|
+
get?: (query: SQL) => any;
|
|
372
|
+
$with: (alias: string) => any;
|
|
373
|
+
with: (...args: any[]) => any;
|
|
374
|
+
schema?: TSchema;
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
export declare const employees: PgTableWithColumns< {
|
|
378
|
+
name: "employees";
|
|
379
|
+
schema: undefined;
|
|
380
|
+
columns: {
|
|
381
|
+
id: PgColumn< {
|
|
382
|
+
name: "id";
|
|
383
|
+
tableName: "employees";
|
|
384
|
+
dataType: "number";
|
|
385
|
+
columnType: "PgInteger";
|
|
386
|
+
data: number;
|
|
387
|
+
driverParam: string | number;
|
|
388
|
+
notNull: true;
|
|
389
|
+
hasDefault: false;
|
|
390
|
+
isPrimaryKey: true;
|
|
391
|
+
isAutoincrement: false;
|
|
392
|
+
hasRuntimeDefault: false;
|
|
393
|
+
enumValues: undefined;
|
|
394
|
+
baseColumn: never;
|
|
395
|
+
identity: undefined;
|
|
396
|
+
generated: undefined;
|
|
397
|
+
}, {}, {}>;
|
|
398
|
+
name: PgColumn< {
|
|
399
|
+
name: "name";
|
|
400
|
+
tableName: "employees";
|
|
401
|
+
dataType: "string";
|
|
402
|
+
columnType: "PgText";
|
|
403
|
+
data: string;
|
|
404
|
+
driverParam: string;
|
|
405
|
+
notNull: true;
|
|
406
|
+
hasDefault: false;
|
|
407
|
+
isPrimaryKey: false;
|
|
408
|
+
isAutoincrement: false;
|
|
409
|
+
hasRuntimeDefault: false;
|
|
410
|
+
enumValues: [string, ...string[]];
|
|
411
|
+
baseColumn: never;
|
|
412
|
+
identity: undefined;
|
|
413
|
+
generated: undefined;
|
|
414
|
+
}, {}, {}>;
|
|
415
|
+
email: PgColumn< {
|
|
416
|
+
name: "email";
|
|
417
|
+
tableName: "employees";
|
|
418
|
+
dataType: "string";
|
|
419
|
+
columnType: "PgText";
|
|
420
|
+
data: string;
|
|
421
|
+
driverParam: string;
|
|
422
|
+
notNull: true;
|
|
423
|
+
hasDefault: false;
|
|
424
|
+
isPrimaryKey: false;
|
|
425
|
+
isAutoincrement: false;
|
|
426
|
+
hasRuntimeDefault: false;
|
|
427
|
+
enumValues: [string, ...string[]];
|
|
428
|
+
baseColumn: never;
|
|
429
|
+
identity: undefined;
|
|
430
|
+
generated: undefined;
|
|
431
|
+
}, {}, {}>;
|
|
432
|
+
active: PgColumn< {
|
|
433
|
+
name: "active";
|
|
434
|
+
tableName: "employees";
|
|
435
|
+
dataType: "boolean";
|
|
436
|
+
columnType: "PgBoolean";
|
|
437
|
+
data: boolean;
|
|
438
|
+
driverParam: boolean;
|
|
439
|
+
notNull: false;
|
|
440
|
+
hasDefault: true;
|
|
441
|
+
isPrimaryKey: false;
|
|
442
|
+
isAutoincrement: false;
|
|
443
|
+
hasRuntimeDefault: false;
|
|
444
|
+
enumValues: undefined;
|
|
445
|
+
baseColumn: never;
|
|
446
|
+
identity: undefined;
|
|
447
|
+
generated: undefined;
|
|
448
|
+
}, {}, {}>;
|
|
449
|
+
fteBasis: PgColumn< {
|
|
450
|
+
name: "fte_basis";
|
|
451
|
+
tableName: "employees";
|
|
452
|
+
dataType: "string";
|
|
453
|
+
columnType: "PgNumeric";
|
|
454
|
+
data: string;
|
|
455
|
+
driverParam: string;
|
|
456
|
+
notNull: false;
|
|
457
|
+
hasDefault: true;
|
|
458
|
+
isPrimaryKey: false;
|
|
459
|
+
isAutoincrement: false;
|
|
460
|
+
hasRuntimeDefault: false;
|
|
461
|
+
enumValues: undefined;
|
|
462
|
+
baseColumn: never;
|
|
463
|
+
identity: undefined;
|
|
464
|
+
generated: undefined;
|
|
465
|
+
}, {}, {}>;
|
|
466
|
+
startDate: PgColumn< {
|
|
467
|
+
name: "start_date";
|
|
468
|
+
tableName: "employees";
|
|
469
|
+
dataType: "date";
|
|
470
|
+
columnType: "PgTimestamp";
|
|
471
|
+
data: Date;
|
|
472
|
+
driverParam: string;
|
|
473
|
+
notNull: false;
|
|
474
|
+
hasDefault: false;
|
|
475
|
+
isPrimaryKey: false;
|
|
476
|
+
isAutoincrement: false;
|
|
477
|
+
hasRuntimeDefault: false;
|
|
478
|
+
enumValues: undefined;
|
|
479
|
+
baseColumn: never;
|
|
480
|
+
identity: undefined;
|
|
481
|
+
generated: undefined;
|
|
482
|
+
}, {}, {}>;
|
|
483
|
+
endDate: PgColumn< {
|
|
484
|
+
name: "end_date";
|
|
485
|
+
tableName: "employees";
|
|
486
|
+
dataType: "date";
|
|
487
|
+
columnType: "PgTimestamp";
|
|
488
|
+
data: Date;
|
|
489
|
+
driverParam: string;
|
|
490
|
+
notNull: false;
|
|
491
|
+
hasDefault: false;
|
|
492
|
+
isPrimaryKey: false;
|
|
493
|
+
isAutoincrement: false;
|
|
494
|
+
hasRuntimeDefault: false;
|
|
495
|
+
enumValues: undefined;
|
|
496
|
+
baseColumn: never;
|
|
497
|
+
identity: undefined;
|
|
498
|
+
generated: undefined;
|
|
499
|
+
}, {}, {}>;
|
|
500
|
+
department: PgColumn< {
|
|
501
|
+
name: "department";
|
|
502
|
+
tableName: "employees";
|
|
503
|
+
dataType: "number";
|
|
504
|
+
columnType: "PgInteger";
|
|
505
|
+
data: number;
|
|
506
|
+
driverParam: string | number;
|
|
507
|
+
notNull: false;
|
|
508
|
+
hasDefault: false;
|
|
509
|
+
isPrimaryKey: false;
|
|
510
|
+
isAutoincrement: false;
|
|
511
|
+
hasRuntimeDefault: false;
|
|
512
|
+
enumValues: undefined;
|
|
513
|
+
baseColumn: never;
|
|
514
|
+
identity: undefined;
|
|
515
|
+
generated: undefined;
|
|
516
|
+
}, {}, {}>;
|
|
517
|
+
supplier: PgColumn< {
|
|
518
|
+
name: "supplier";
|
|
519
|
+
tableName: "employees";
|
|
520
|
+
dataType: "number";
|
|
521
|
+
columnType: "PgInteger";
|
|
522
|
+
data: number;
|
|
523
|
+
driverParam: string | number;
|
|
524
|
+
notNull: false;
|
|
525
|
+
hasDefault: false;
|
|
526
|
+
isPrimaryKey: false;
|
|
527
|
+
isAutoincrement: false;
|
|
528
|
+
hasRuntimeDefault: false;
|
|
529
|
+
enumValues: undefined;
|
|
530
|
+
baseColumn: never;
|
|
531
|
+
identity: undefined;
|
|
532
|
+
generated: undefined;
|
|
533
|
+
}, {}, {}>;
|
|
534
|
+
organisation: PgColumn< {
|
|
535
|
+
name: "organisation";
|
|
536
|
+
tableName: "employees";
|
|
537
|
+
dataType: "number";
|
|
538
|
+
columnType: "PgInteger";
|
|
539
|
+
data: number;
|
|
540
|
+
driverParam: string | number;
|
|
541
|
+
notNull: true;
|
|
542
|
+
hasDefault: false;
|
|
543
|
+
isPrimaryKey: false;
|
|
544
|
+
isAutoincrement: false;
|
|
545
|
+
hasRuntimeDefault: false;
|
|
546
|
+
enumValues: undefined;
|
|
547
|
+
baseColumn: never;
|
|
548
|
+
identity: undefined;
|
|
549
|
+
generated: undefined;
|
|
550
|
+
}, {}, {}>;
|
|
551
|
+
createdAt: PgColumn< {
|
|
552
|
+
name: "created_at";
|
|
553
|
+
tableName: "employees";
|
|
554
|
+
dataType: "date";
|
|
555
|
+
columnType: "PgTimestamp";
|
|
556
|
+
data: Date;
|
|
557
|
+
driverParam: string;
|
|
558
|
+
notNull: false;
|
|
559
|
+
hasDefault: true;
|
|
560
|
+
isPrimaryKey: false;
|
|
561
|
+
isAutoincrement: false;
|
|
562
|
+
hasRuntimeDefault: false;
|
|
563
|
+
enumValues: undefined;
|
|
564
|
+
baseColumn: never;
|
|
565
|
+
identity: undefined;
|
|
566
|
+
generated: undefined;
|
|
567
|
+
}, {}, {}>;
|
|
568
|
+
updatedAt: PgColumn< {
|
|
569
|
+
name: "updated_at";
|
|
570
|
+
tableName: "employees";
|
|
571
|
+
dataType: "date";
|
|
572
|
+
columnType: "PgTimestamp";
|
|
573
|
+
data: Date;
|
|
574
|
+
driverParam: string;
|
|
575
|
+
notNull: false;
|
|
576
|
+
hasDefault: true;
|
|
577
|
+
isPrimaryKey: false;
|
|
578
|
+
isAutoincrement: false;
|
|
579
|
+
hasRuntimeDefault: false;
|
|
580
|
+
enumValues: undefined;
|
|
581
|
+
baseColumn: never;
|
|
582
|
+
identity: undefined;
|
|
583
|
+
generated: undefined;
|
|
584
|
+
}, {}, {}>;
|
|
585
|
+
};
|
|
586
|
+
dialect: "pg";
|
|
587
|
+
}>;
|
|
588
|
+
|
|
589
|
+
export declare const employeesRelations: Relations<"employees", {
|
|
590
|
+
organisation: One<"organisations", true>;
|
|
591
|
+
department: One<"departments", false>;
|
|
592
|
+
supplier: One<"suppliers", false>;
|
|
593
|
+
}>;
|
|
594
|
+
|
|
595
|
+
export declare type ExampleSchema = typeof exampleSchema;
|
|
596
|
+
|
|
597
|
+
export declare const exampleSchema: {
|
|
598
|
+
organisations: PgTableWithColumns< {
|
|
599
|
+
name: "organisations";
|
|
600
|
+
schema: undefined;
|
|
601
|
+
columns: {
|
|
602
|
+
id: PgColumn< {
|
|
603
|
+
name: "id";
|
|
604
|
+
tableName: "organisations";
|
|
605
|
+
dataType: "number";
|
|
606
|
+
columnType: "PgInteger";
|
|
607
|
+
data: number;
|
|
608
|
+
driverParam: string | number;
|
|
609
|
+
notNull: true;
|
|
610
|
+
hasDefault: false;
|
|
611
|
+
isPrimaryKey: true;
|
|
612
|
+
isAutoincrement: false;
|
|
613
|
+
hasRuntimeDefault: false;
|
|
614
|
+
enumValues: undefined;
|
|
615
|
+
baseColumn: never;
|
|
616
|
+
identity: undefined;
|
|
617
|
+
generated: undefined;
|
|
618
|
+
}, {}, {}>;
|
|
619
|
+
name: PgColumn< {
|
|
620
|
+
name: "name";
|
|
621
|
+
tableName: "organisations";
|
|
622
|
+
dataType: "string";
|
|
623
|
+
columnType: "PgText";
|
|
624
|
+
data: string;
|
|
625
|
+
driverParam: string;
|
|
626
|
+
notNull: true;
|
|
627
|
+
hasDefault: false;
|
|
628
|
+
isPrimaryKey: false;
|
|
629
|
+
isAutoincrement: false;
|
|
630
|
+
hasRuntimeDefault: false;
|
|
631
|
+
enumValues: [string, ...string[]];
|
|
632
|
+
baseColumn: never;
|
|
633
|
+
identity: undefined;
|
|
634
|
+
generated: undefined;
|
|
635
|
+
}, {}, {}>;
|
|
636
|
+
description: PgColumn< {
|
|
637
|
+
name: "description";
|
|
638
|
+
tableName: "organisations";
|
|
639
|
+
dataType: "string";
|
|
640
|
+
columnType: "PgText";
|
|
641
|
+
data: string;
|
|
642
|
+
driverParam: string;
|
|
643
|
+
notNull: false;
|
|
644
|
+
hasDefault: false;
|
|
645
|
+
isPrimaryKey: false;
|
|
646
|
+
isAutoincrement: false;
|
|
647
|
+
hasRuntimeDefault: false;
|
|
648
|
+
enumValues: [string, ...string[]];
|
|
649
|
+
baseColumn: never;
|
|
650
|
+
identity: undefined;
|
|
651
|
+
generated: undefined;
|
|
652
|
+
}, {}, {}>;
|
|
653
|
+
createdAt: PgColumn< {
|
|
654
|
+
name: "created_at";
|
|
655
|
+
tableName: "organisations";
|
|
656
|
+
dataType: "date";
|
|
657
|
+
columnType: "PgTimestamp";
|
|
658
|
+
data: Date;
|
|
659
|
+
driverParam: string;
|
|
660
|
+
notNull: false;
|
|
661
|
+
hasDefault: true;
|
|
662
|
+
isPrimaryKey: false;
|
|
663
|
+
isAutoincrement: false;
|
|
664
|
+
hasRuntimeDefault: false;
|
|
665
|
+
enumValues: undefined;
|
|
666
|
+
baseColumn: never;
|
|
667
|
+
identity: undefined;
|
|
668
|
+
generated: undefined;
|
|
669
|
+
}, {}, {}>;
|
|
670
|
+
updatedAt: PgColumn< {
|
|
671
|
+
name: "updated_at";
|
|
672
|
+
tableName: "organisations";
|
|
673
|
+
dataType: "date";
|
|
674
|
+
columnType: "PgTimestamp";
|
|
675
|
+
data: Date;
|
|
676
|
+
driverParam: string;
|
|
677
|
+
notNull: false;
|
|
678
|
+
hasDefault: true;
|
|
679
|
+
isPrimaryKey: false;
|
|
680
|
+
isAutoincrement: false;
|
|
681
|
+
hasRuntimeDefault: false;
|
|
682
|
+
enumValues: undefined;
|
|
683
|
+
baseColumn: never;
|
|
684
|
+
identity: undefined;
|
|
685
|
+
generated: undefined;
|
|
686
|
+
}, {}, {}>;
|
|
687
|
+
};
|
|
688
|
+
dialect: "pg";
|
|
689
|
+
}>;
|
|
690
|
+
departments: PgTableWithColumns< {
|
|
691
|
+
name: "departments";
|
|
692
|
+
schema: undefined;
|
|
693
|
+
columns: {
|
|
694
|
+
id: PgColumn< {
|
|
695
|
+
name: "id";
|
|
696
|
+
tableName: "departments";
|
|
697
|
+
dataType: "number";
|
|
698
|
+
columnType: "PgInteger";
|
|
699
|
+
data: number;
|
|
700
|
+
driverParam: string | number;
|
|
701
|
+
notNull: true;
|
|
702
|
+
hasDefault: false;
|
|
703
|
+
isPrimaryKey: true;
|
|
704
|
+
isAutoincrement: false;
|
|
705
|
+
hasRuntimeDefault: false;
|
|
706
|
+
enumValues: undefined;
|
|
707
|
+
baseColumn: never;
|
|
708
|
+
identity: undefined;
|
|
709
|
+
generated: undefined;
|
|
710
|
+
}, {}, {}>;
|
|
711
|
+
name: PgColumn< {
|
|
712
|
+
name: "name";
|
|
713
|
+
tableName: "departments";
|
|
714
|
+
dataType: "string";
|
|
715
|
+
columnType: "PgText";
|
|
716
|
+
data: string;
|
|
717
|
+
driverParam: string;
|
|
718
|
+
notNull: true;
|
|
719
|
+
hasDefault: false;
|
|
720
|
+
isPrimaryKey: false;
|
|
721
|
+
isAutoincrement: false;
|
|
722
|
+
hasRuntimeDefault: false;
|
|
723
|
+
enumValues: [string, ...string[]];
|
|
724
|
+
baseColumn: never;
|
|
725
|
+
identity: undefined;
|
|
726
|
+
generated: undefined;
|
|
727
|
+
}, {}, {}>;
|
|
728
|
+
description: PgColumn< {
|
|
729
|
+
name: "description";
|
|
730
|
+
tableName: "departments";
|
|
731
|
+
dataType: "string";
|
|
732
|
+
columnType: "PgText";
|
|
733
|
+
data: string;
|
|
734
|
+
driverParam: string;
|
|
735
|
+
notNull: false;
|
|
736
|
+
hasDefault: false;
|
|
737
|
+
isPrimaryKey: false;
|
|
738
|
+
isAutoincrement: false;
|
|
739
|
+
hasRuntimeDefault: false;
|
|
740
|
+
enumValues: [string, ...string[]];
|
|
741
|
+
baseColumn: never;
|
|
742
|
+
identity: undefined;
|
|
743
|
+
generated: undefined;
|
|
744
|
+
}, {}, {}>;
|
|
745
|
+
organisation: PgColumn< {
|
|
746
|
+
name: "organisation";
|
|
747
|
+
tableName: "departments";
|
|
748
|
+
dataType: "number";
|
|
749
|
+
columnType: "PgInteger";
|
|
750
|
+
data: number;
|
|
751
|
+
driverParam: string | number;
|
|
752
|
+
notNull: true;
|
|
753
|
+
hasDefault: false;
|
|
754
|
+
isPrimaryKey: false;
|
|
755
|
+
isAutoincrement: false;
|
|
756
|
+
hasRuntimeDefault: false;
|
|
757
|
+
enumValues: undefined;
|
|
758
|
+
baseColumn: never;
|
|
759
|
+
identity: undefined;
|
|
760
|
+
generated: undefined;
|
|
761
|
+
}, {}, {}>;
|
|
762
|
+
createdAt: PgColumn< {
|
|
763
|
+
name: "created_at";
|
|
764
|
+
tableName: "departments";
|
|
765
|
+
dataType: "date";
|
|
766
|
+
columnType: "PgTimestamp";
|
|
767
|
+
data: Date;
|
|
768
|
+
driverParam: string;
|
|
769
|
+
notNull: false;
|
|
770
|
+
hasDefault: true;
|
|
771
|
+
isPrimaryKey: false;
|
|
772
|
+
isAutoincrement: false;
|
|
773
|
+
hasRuntimeDefault: false;
|
|
774
|
+
enumValues: undefined;
|
|
775
|
+
baseColumn: never;
|
|
776
|
+
identity: undefined;
|
|
777
|
+
generated: undefined;
|
|
778
|
+
}, {}, {}>;
|
|
779
|
+
updatedAt: PgColumn< {
|
|
780
|
+
name: "updated_at";
|
|
781
|
+
tableName: "departments";
|
|
782
|
+
dataType: "date";
|
|
783
|
+
columnType: "PgTimestamp";
|
|
784
|
+
data: Date;
|
|
785
|
+
driverParam: string;
|
|
786
|
+
notNull: false;
|
|
787
|
+
hasDefault: true;
|
|
788
|
+
isPrimaryKey: false;
|
|
789
|
+
isAutoincrement: false;
|
|
790
|
+
hasRuntimeDefault: false;
|
|
791
|
+
enumValues: undefined;
|
|
792
|
+
baseColumn: never;
|
|
793
|
+
identity: undefined;
|
|
794
|
+
generated: undefined;
|
|
795
|
+
}, {}, {}>;
|
|
796
|
+
};
|
|
797
|
+
dialect: "pg";
|
|
798
|
+
}>;
|
|
799
|
+
suppliers: PgTableWithColumns< {
|
|
800
|
+
name: "suppliers";
|
|
801
|
+
schema: undefined;
|
|
802
|
+
columns: {
|
|
803
|
+
id: PgColumn< {
|
|
804
|
+
name: "id";
|
|
805
|
+
tableName: "suppliers";
|
|
806
|
+
dataType: "number";
|
|
807
|
+
columnType: "PgInteger";
|
|
808
|
+
data: number;
|
|
809
|
+
driverParam: string | number;
|
|
810
|
+
notNull: true;
|
|
811
|
+
hasDefault: false;
|
|
812
|
+
isPrimaryKey: true;
|
|
813
|
+
isAutoincrement: false;
|
|
814
|
+
hasRuntimeDefault: false;
|
|
815
|
+
enumValues: undefined;
|
|
816
|
+
baseColumn: never;
|
|
817
|
+
identity: undefined;
|
|
818
|
+
generated: undefined;
|
|
819
|
+
}, {}, {}>;
|
|
820
|
+
name: PgColumn< {
|
|
821
|
+
name: "name";
|
|
822
|
+
tableName: "suppliers";
|
|
823
|
+
dataType: "string";
|
|
824
|
+
columnType: "PgText";
|
|
825
|
+
data: string;
|
|
826
|
+
driverParam: string;
|
|
827
|
+
notNull: true;
|
|
828
|
+
hasDefault: false;
|
|
829
|
+
isPrimaryKey: false;
|
|
830
|
+
isAutoincrement: false;
|
|
831
|
+
hasRuntimeDefault: false;
|
|
832
|
+
enumValues: [string, ...string[]];
|
|
833
|
+
baseColumn: never;
|
|
834
|
+
identity: undefined;
|
|
835
|
+
generated: undefined;
|
|
836
|
+
}, {}, {}>;
|
|
837
|
+
description: PgColumn< {
|
|
838
|
+
name: "description";
|
|
839
|
+
tableName: "suppliers";
|
|
840
|
+
dataType: "string";
|
|
841
|
+
columnType: "PgText";
|
|
842
|
+
data: string;
|
|
843
|
+
driverParam: string;
|
|
844
|
+
notNull: false;
|
|
845
|
+
hasDefault: false;
|
|
846
|
+
isPrimaryKey: false;
|
|
847
|
+
isAutoincrement: false;
|
|
848
|
+
hasRuntimeDefault: false;
|
|
849
|
+
enumValues: [string, ...string[]];
|
|
850
|
+
baseColumn: never;
|
|
851
|
+
identity: undefined;
|
|
852
|
+
generated: undefined;
|
|
853
|
+
}, {}, {}>;
|
|
854
|
+
internal: PgColumn< {
|
|
855
|
+
name: "internal";
|
|
856
|
+
tableName: "suppliers";
|
|
857
|
+
dataType: "boolean";
|
|
858
|
+
columnType: "PgBoolean";
|
|
859
|
+
data: boolean;
|
|
860
|
+
driverParam: boolean;
|
|
861
|
+
notNull: false;
|
|
862
|
+
hasDefault: true;
|
|
863
|
+
isPrimaryKey: false;
|
|
864
|
+
isAutoincrement: false;
|
|
865
|
+
hasRuntimeDefault: false;
|
|
866
|
+
enumValues: undefined;
|
|
867
|
+
baseColumn: never;
|
|
868
|
+
identity: undefined;
|
|
869
|
+
generated: undefined;
|
|
870
|
+
}, {}, {}>;
|
|
871
|
+
organisation: PgColumn< {
|
|
872
|
+
name: "organisation";
|
|
873
|
+
tableName: "suppliers";
|
|
874
|
+
dataType: "number";
|
|
875
|
+
columnType: "PgInteger";
|
|
876
|
+
data: number;
|
|
877
|
+
driverParam: string | number;
|
|
878
|
+
notNull: true;
|
|
879
|
+
hasDefault: false;
|
|
880
|
+
isPrimaryKey: false;
|
|
881
|
+
isAutoincrement: false;
|
|
882
|
+
hasRuntimeDefault: false;
|
|
883
|
+
enumValues: undefined;
|
|
884
|
+
baseColumn: never;
|
|
885
|
+
identity: undefined;
|
|
886
|
+
generated: undefined;
|
|
887
|
+
}, {}, {}>;
|
|
888
|
+
createdAt: PgColumn< {
|
|
889
|
+
name: "created_at";
|
|
890
|
+
tableName: "suppliers";
|
|
891
|
+
dataType: "date";
|
|
892
|
+
columnType: "PgTimestamp";
|
|
893
|
+
data: Date;
|
|
894
|
+
driverParam: string;
|
|
895
|
+
notNull: false;
|
|
896
|
+
hasDefault: true;
|
|
897
|
+
isPrimaryKey: false;
|
|
898
|
+
isAutoincrement: false;
|
|
899
|
+
hasRuntimeDefault: false;
|
|
900
|
+
enumValues: undefined;
|
|
901
|
+
baseColumn: never;
|
|
902
|
+
identity: undefined;
|
|
903
|
+
generated: undefined;
|
|
904
|
+
}, {}, {}>;
|
|
905
|
+
updatedAt: PgColumn< {
|
|
906
|
+
name: "updated_at";
|
|
907
|
+
tableName: "suppliers";
|
|
908
|
+
dataType: "date";
|
|
909
|
+
columnType: "PgTimestamp";
|
|
910
|
+
data: Date;
|
|
911
|
+
driverParam: string;
|
|
912
|
+
notNull: false;
|
|
913
|
+
hasDefault: true;
|
|
914
|
+
isPrimaryKey: false;
|
|
915
|
+
isAutoincrement: false;
|
|
916
|
+
hasRuntimeDefault: false;
|
|
917
|
+
enumValues: undefined;
|
|
918
|
+
baseColumn: never;
|
|
919
|
+
identity: undefined;
|
|
920
|
+
generated: undefined;
|
|
921
|
+
}, {}, {}>;
|
|
922
|
+
};
|
|
923
|
+
dialect: "pg";
|
|
924
|
+
}>;
|
|
925
|
+
employees: PgTableWithColumns< {
|
|
926
|
+
name: "employees";
|
|
927
|
+
schema: undefined;
|
|
928
|
+
columns: {
|
|
929
|
+
id: PgColumn< {
|
|
930
|
+
name: "id";
|
|
931
|
+
tableName: "employees";
|
|
932
|
+
dataType: "number";
|
|
933
|
+
columnType: "PgInteger";
|
|
934
|
+
data: number;
|
|
935
|
+
driverParam: string | number;
|
|
936
|
+
notNull: true;
|
|
937
|
+
hasDefault: false;
|
|
938
|
+
isPrimaryKey: true;
|
|
939
|
+
isAutoincrement: false;
|
|
940
|
+
hasRuntimeDefault: false;
|
|
941
|
+
enumValues: undefined;
|
|
942
|
+
baseColumn: never;
|
|
943
|
+
identity: undefined;
|
|
944
|
+
generated: undefined;
|
|
945
|
+
}, {}, {}>;
|
|
946
|
+
name: PgColumn< {
|
|
947
|
+
name: "name";
|
|
948
|
+
tableName: "employees";
|
|
949
|
+
dataType: "string";
|
|
950
|
+
columnType: "PgText";
|
|
951
|
+
data: string;
|
|
952
|
+
driverParam: string;
|
|
953
|
+
notNull: true;
|
|
954
|
+
hasDefault: false;
|
|
955
|
+
isPrimaryKey: false;
|
|
956
|
+
isAutoincrement: false;
|
|
957
|
+
hasRuntimeDefault: false;
|
|
958
|
+
enumValues: [string, ...string[]];
|
|
959
|
+
baseColumn: never;
|
|
960
|
+
identity: undefined;
|
|
961
|
+
generated: undefined;
|
|
962
|
+
}, {}, {}>;
|
|
963
|
+
email: PgColumn< {
|
|
964
|
+
name: "email";
|
|
965
|
+
tableName: "employees";
|
|
966
|
+
dataType: "string";
|
|
967
|
+
columnType: "PgText";
|
|
968
|
+
data: string;
|
|
969
|
+
driverParam: string;
|
|
970
|
+
notNull: true;
|
|
971
|
+
hasDefault: false;
|
|
972
|
+
isPrimaryKey: false;
|
|
973
|
+
isAutoincrement: false;
|
|
974
|
+
hasRuntimeDefault: false;
|
|
975
|
+
enumValues: [string, ...string[]];
|
|
976
|
+
baseColumn: never;
|
|
977
|
+
identity: undefined;
|
|
978
|
+
generated: undefined;
|
|
979
|
+
}, {}, {}>;
|
|
980
|
+
active: PgColumn< {
|
|
981
|
+
name: "active";
|
|
982
|
+
tableName: "employees";
|
|
983
|
+
dataType: "boolean";
|
|
984
|
+
columnType: "PgBoolean";
|
|
985
|
+
data: boolean;
|
|
986
|
+
driverParam: boolean;
|
|
987
|
+
notNull: false;
|
|
988
|
+
hasDefault: true;
|
|
989
|
+
isPrimaryKey: false;
|
|
990
|
+
isAutoincrement: false;
|
|
991
|
+
hasRuntimeDefault: false;
|
|
992
|
+
enumValues: undefined;
|
|
993
|
+
baseColumn: never;
|
|
994
|
+
identity: undefined;
|
|
995
|
+
generated: undefined;
|
|
996
|
+
}, {}, {}>;
|
|
997
|
+
fteBasis: PgColumn< {
|
|
998
|
+
name: "fte_basis";
|
|
999
|
+
tableName: "employees";
|
|
1000
|
+
dataType: "string";
|
|
1001
|
+
columnType: "PgNumeric";
|
|
1002
|
+
data: string;
|
|
1003
|
+
driverParam: string;
|
|
1004
|
+
notNull: false;
|
|
1005
|
+
hasDefault: true;
|
|
1006
|
+
isPrimaryKey: false;
|
|
1007
|
+
isAutoincrement: false;
|
|
1008
|
+
hasRuntimeDefault: false;
|
|
1009
|
+
enumValues: undefined;
|
|
1010
|
+
baseColumn: never;
|
|
1011
|
+
identity: undefined;
|
|
1012
|
+
generated: undefined;
|
|
1013
|
+
}, {}, {}>;
|
|
1014
|
+
startDate: PgColumn< {
|
|
1015
|
+
name: "start_date";
|
|
1016
|
+
tableName: "employees";
|
|
1017
|
+
dataType: "date";
|
|
1018
|
+
columnType: "PgTimestamp";
|
|
1019
|
+
data: Date;
|
|
1020
|
+
driverParam: string;
|
|
1021
|
+
notNull: false;
|
|
1022
|
+
hasDefault: false;
|
|
1023
|
+
isPrimaryKey: false;
|
|
1024
|
+
isAutoincrement: false;
|
|
1025
|
+
hasRuntimeDefault: false;
|
|
1026
|
+
enumValues: undefined;
|
|
1027
|
+
baseColumn: never;
|
|
1028
|
+
identity: undefined;
|
|
1029
|
+
generated: undefined;
|
|
1030
|
+
}, {}, {}>;
|
|
1031
|
+
endDate: PgColumn< {
|
|
1032
|
+
name: "end_date";
|
|
1033
|
+
tableName: "employees";
|
|
1034
|
+
dataType: "date";
|
|
1035
|
+
columnType: "PgTimestamp";
|
|
1036
|
+
data: Date;
|
|
1037
|
+
driverParam: string;
|
|
1038
|
+
notNull: false;
|
|
1039
|
+
hasDefault: false;
|
|
1040
|
+
isPrimaryKey: false;
|
|
1041
|
+
isAutoincrement: false;
|
|
1042
|
+
hasRuntimeDefault: false;
|
|
1043
|
+
enumValues: undefined;
|
|
1044
|
+
baseColumn: never;
|
|
1045
|
+
identity: undefined;
|
|
1046
|
+
generated: undefined;
|
|
1047
|
+
}, {}, {}>;
|
|
1048
|
+
department: PgColumn< {
|
|
1049
|
+
name: "department";
|
|
1050
|
+
tableName: "employees";
|
|
1051
|
+
dataType: "number";
|
|
1052
|
+
columnType: "PgInteger";
|
|
1053
|
+
data: number;
|
|
1054
|
+
driverParam: string | number;
|
|
1055
|
+
notNull: false;
|
|
1056
|
+
hasDefault: false;
|
|
1057
|
+
isPrimaryKey: false;
|
|
1058
|
+
isAutoincrement: false;
|
|
1059
|
+
hasRuntimeDefault: false;
|
|
1060
|
+
enumValues: undefined;
|
|
1061
|
+
baseColumn: never;
|
|
1062
|
+
identity: undefined;
|
|
1063
|
+
generated: undefined;
|
|
1064
|
+
}, {}, {}>;
|
|
1065
|
+
supplier: PgColumn< {
|
|
1066
|
+
name: "supplier";
|
|
1067
|
+
tableName: "employees";
|
|
1068
|
+
dataType: "number";
|
|
1069
|
+
columnType: "PgInteger";
|
|
1070
|
+
data: number;
|
|
1071
|
+
driverParam: string | number;
|
|
1072
|
+
notNull: false;
|
|
1073
|
+
hasDefault: false;
|
|
1074
|
+
isPrimaryKey: false;
|
|
1075
|
+
isAutoincrement: false;
|
|
1076
|
+
hasRuntimeDefault: false;
|
|
1077
|
+
enumValues: undefined;
|
|
1078
|
+
baseColumn: never;
|
|
1079
|
+
identity: undefined;
|
|
1080
|
+
generated: undefined;
|
|
1081
|
+
}, {}, {}>;
|
|
1082
|
+
organisation: PgColumn< {
|
|
1083
|
+
name: "organisation";
|
|
1084
|
+
tableName: "employees";
|
|
1085
|
+
dataType: "number";
|
|
1086
|
+
columnType: "PgInteger";
|
|
1087
|
+
data: number;
|
|
1088
|
+
driverParam: string | number;
|
|
1089
|
+
notNull: true;
|
|
1090
|
+
hasDefault: false;
|
|
1091
|
+
isPrimaryKey: false;
|
|
1092
|
+
isAutoincrement: false;
|
|
1093
|
+
hasRuntimeDefault: false;
|
|
1094
|
+
enumValues: undefined;
|
|
1095
|
+
baseColumn: never;
|
|
1096
|
+
identity: undefined;
|
|
1097
|
+
generated: undefined;
|
|
1098
|
+
}, {}, {}>;
|
|
1099
|
+
createdAt: PgColumn< {
|
|
1100
|
+
name: "created_at";
|
|
1101
|
+
tableName: "employees";
|
|
1102
|
+
dataType: "date";
|
|
1103
|
+
columnType: "PgTimestamp";
|
|
1104
|
+
data: Date;
|
|
1105
|
+
driverParam: string;
|
|
1106
|
+
notNull: false;
|
|
1107
|
+
hasDefault: true;
|
|
1108
|
+
isPrimaryKey: false;
|
|
1109
|
+
isAutoincrement: false;
|
|
1110
|
+
hasRuntimeDefault: false;
|
|
1111
|
+
enumValues: undefined;
|
|
1112
|
+
baseColumn: never;
|
|
1113
|
+
identity: undefined;
|
|
1114
|
+
generated: undefined;
|
|
1115
|
+
}, {}, {}>;
|
|
1116
|
+
updatedAt: PgColumn< {
|
|
1117
|
+
name: "updated_at";
|
|
1118
|
+
tableName: "employees";
|
|
1119
|
+
dataType: "date";
|
|
1120
|
+
columnType: "PgTimestamp";
|
|
1121
|
+
data: Date;
|
|
1122
|
+
driverParam: string;
|
|
1123
|
+
notNull: false;
|
|
1124
|
+
hasDefault: true;
|
|
1125
|
+
isPrimaryKey: false;
|
|
1126
|
+
isAutoincrement: false;
|
|
1127
|
+
hasRuntimeDefault: false;
|
|
1128
|
+
enumValues: undefined;
|
|
1129
|
+
baseColumn: never;
|
|
1130
|
+
identity: undefined;
|
|
1131
|
+
generated: undefined;
|
|
1132
|
+
}, {}, {}>;
|
|
1133
|
+
};
|
|
1134
|
+
dialect: "pg";
|
|
1135
|
+
}>;
|
|
1136
|
+
organisationsRelations: Relations<"organisations", {
|
|
1137
|
+
departments: Many<"departments">;
|
|
1138
|
+
suppliers: Many<"suppliers">;
|
|
1139
|
+
employees: Many<"employees">;
|
|
1140
|
+
}>;
|
|
1141
|
+
departmentsRelations: Relations<"departments", {
|
|
1142
|
+
organisation: One<"organisations", true>;
|
|
1143
|
+
employees: Many<"employees">;
|
|
1144
|
+
}>;
|
|
1145
|
+
suppliersRelations: Relations<"suppliers", {
|
|
1146
|
+
organisation: One<"organisations", true>;
|
|
1147
|
+
employees: Many<"employees">;
|
|
1148
|
+
}>;
|
|
1149
|
+
employeesRelations: Relations<"employees", {
|
|
1150
|
+
organisation: One<"organisations", true>;
|
|
1151
|
+
department: One<"departments", false>;
|
|
1152
|
+
supplier: One<"suppliers", false>;
|
|
1153
|
+
}>;
|
|
1154
|
+
};
|
|
57
1155
|
|
|
58
|
-
|
|
1156
|
+
/**
|
|
1157
|
+
* Filter definitions with logical operators
|
|
1158
|
+
*/
|
|
1159
|
+
export declare type Filter = FilterCondition | LogicalFilter;
|
|
59
1160
|
|
|
1161
|
+
export declare interface FilterCondition {
|
|
1162
|
+
member: string;
|
|
1163
|
+
operator: FilterOperator;
|
|
1164
|
+
values: any[];
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
/**
|
|
1168
|
+
* Supported filter operators
|
|
1169
|
+
*/
|
|
60
1170
|
export declare type FilterOperator = 'equals' | 'notEquals' | 'contains' | 'notContains' | 'startsWith' | 'notStartsWith' | 'endsWith' | 'notEndsWith' | 'gt' | 'gte' | 'lt' | 'lte' | 'set' | 'notSet' | 'inDateRange' | 'beforeDate' | 'afterDate';
|
|
61
1171
|
|
|
1172
|
+
export declare type JoinType = 'left' | 'right' | 'inner' | 'full';
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* Compiled cube with executable query function
|
|
1176
|
+
*/
|
|
1177
|
+
export declare interface LegacyCompiledCube<TSchema extends Record<string, any> = Record<string, any>> extends SemanticCube<TSchema> {
|
|
1178
|
+
queryFn: (query: SemanticQuery, securityContext: SecurityContext) => Promise<QueryResult>;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
/**
|
|
1182
|
+
* Query context passed to cube SQL functions
|
|
1183
|
+
* Provides access to database, schema, and security context
|
|
1184
|
+
*/
|
|
1185
|
+
export declare interface LegacyQueryContext<TSchema extends Record<string, any> = Record<string, any>> {
|
|
1186
|
+
/** Drizzle database instance */
|
|
1187
|
+
db: DrizzleDatabase<TSchema>;
|
|
1188
|
+
/** Database schema (tables, columns, etc.) */
|
|
1189
|
+
schema: TSchema;
|
|
1190
|
+
/** Security context for filtering */
|
|
1191
|
+
securityContext: SecurityContext;
|
|
1192
|
+
/** The semantic query being executed */
|
|
1193
|
+
query: SemanticQuery;
|
|
1194
|
+
/** The compiled cube being queried */
|
|
1195
|
+
cube: LegacyCompiledCube<TSchema>;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* Load and parse YAML cubes from file content
|
|
1200
|
+
*/
|
|
1201
|
+
export declare function loadYamlCubes(yamlContent: string): SemanticCube[];
|
|
1202
|
+
|
|
1203
|
+
/**
|
|
1204
|
+
* Load YAML cubes from file system (Node.js only)
|
|
1205
|
+
*/
|
|
1206
|
+
export declare function loadYamlCubesFromFile(filePath: string): Promise<SemanticCube[]>;
|
|
1207
|
+
|
|
1208
|
+
export declare interface LogicalFilter {
|
|
1209
|
+
and?: Filter[];
|
|
1210
|
+
or?: Filter[];
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* Measure definition
|
|
1215
|
+
*/
|
|
1216
|
+
export declare interface Measure<TSchema extends Record<string, any> = Record<string, any>> {
|
|
1217
|
+
name: string;
|
|
1218
|
+
title?: string;
|
|
1219
|
+
description?: string;
|
|
1220
|
+
type: MeasureType;
|
|
1221
|
+
/** Column to aggregate or SQL expression */
|
|
1222
|
+
sql: AnyColumn | SQL | ((ctx: QueryContext<TSchema>) => AnyColumn | SQL);
|
|
1223
|
+
/** Display format */
|
|
1224
|
+
format?: string;
|
|
1225
|
+
/** Filters applied to this measure */
|
|
1226
|
+
filters?: Array<(ctx: QueryContext<TSchema>) => SQL>;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
/**
|
|
1230
|
+
* Annotation interfaces for UI metadata
|
|
1231
|
+
*/
|
|
62
1232
|
export declare interface MeasureAnnotation {
|
|
63
1233
|
title: string;
|
|
64
1234
|
shortTitle: string;
|
|
@@ -66,6 +1236,9 @@ export declare interface MeasureAnnotation {
|
|
|
66
1236
|
format?: MeasureFormat;
|
|
67
1237
|
}
|
|
68
1238
|
|
|
1239
|
+
/**
|
|
1240
|
+
* Display formats
|
|
1241
|
+
*/
|
|
69
1242
|
export declare type MeasureFormat = 'currency' | 'percent' | 'number' | 'integer';
|
|
70
1243
|
|
|
71
1244
|
export declare interface MeasureMetadata {
|
|
@@ -77,17 +1250,307 @@ export declare interface MeasureMetadata {
|
|
|
77
1250
|
description?: string;
|
|
78
1251
|
}
|
|
79
1252
|
|
|
1253
|
+
/**
|
|
1254
|
+
* Measure aggregation types
|
|
1255
|
+
*/
|
|
80
1256
|
export declare type MeasureType = 'count' | 'countDistinct' | 'countDistinctApprox' | 'sum' | 'avg' | 'min' | 'max' | 'runningTotal' | 'number';
|
|
81
1257
|
|
|
82
|
-
export declare
|
|
1258
|
+
export declare class MultiCubeBuilder<TSchema extends Record<string, any> = Record<string, any>> {
|
|
1259
|
+
/**
|
|
1260
|
+
* Analyze a semantic query to determine which cubes are involved
|
|
1261
|
+
*/
|
|
1262
|
+
analyzeCubeUsage(query: SemanticQuery): Set<string>;
|
|
1263
|
+
/**
|
|
1264
|
+
* Build a multi-cube query plan
|
|
1265
|
+
*/
|
|
1266
|
+
buildMultiCubeQueryPlan(cubes: Map<string, CubeWithJoins<TSchema>>, query: SemanticQuery, ctx: QueryContext<TSchema>): MultiCubeQueryPlan<TSchema>;
|
|
1267
|
+
/**
|
|
1268
|
+
* Choose the primary cube based on query analysis
|
|
1269
|
+
*/
|
|
1270
|
+
choosePrimaryCube(cubeNames: string[], query: SemanticQuery): string;
|
|
1271
|
+
/**
|
|
1272
|
+
* Build join plan for multi-cube query
|
|
1273
|
+
*/
|
|
1274
|
+
private buildJoinPlan;
|
|
1275
|
+
/**
|
|
1276
|
+
* Build selections across multiple cubes
|
|
1277
|
+
*/
|
|
1278
|
+
private buildMultiCubeSelections;
|
|
1279
|
+
/**
|
|
1280
|
+
* Build measure expression with aggregation (similar to single-cube approach)
|
|
1281
|
+
*/
|
|
1282
|
+
private buildMeasureExpression;
|
|
1283
|
+
/**
|
|
1284
|
+
* Build time dimension expression (similar to single-cube approach)
|
|
1285
|
+
*/
|
|
1286
|
+
private buildTimeDimensionExpression;
|
|
1287
|
+
/**
|
|
1288
|
+
* Build WHERE conditions for multi-cube query
|
|
1289
|
+
*/
|
|
1290
|
+
private buildMultiCubeWhereConditions;
|
|
1291
|
+
/**
|
|
1292
|
+
* Filter condition builder (would reuse logic from DrizzleExecutor)
|
|
1293
|
+
*/
|
|
1294
|
+
private buildFilterCondition;
|
|
1295
|
+
/**
|
|
1296
|
+
* Build GROUP BY fields for multi-cube query
|
|
1297
|
+
*/
|
|
1298
|
+
private buildMultiCubeGroupByFields;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
/**
|
|
1302
|
+
* Multi-cube query context for cross-cube operations
|
|
1303
|
+
*/
|
|
1304
|
+
export declare interface MultiCubeQueryContext<TSchema extends Record<string, any> = Record<string, any>> extends QueryContext<TSchema> {
|
|
1305
|
+
/** Available cubes for cross-cube operations */
|
|
1306
|
+
cubes: Map<string, Cube<TSchema>>;
|
|
1307
|
+
/** Current cube being processed */
|
|
1308
|
+
currentCube: Cube<TSchema>;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* Multi-cube query plan - describes how to execute a cross-cube query
|
|
1313
|
+
*/
|
|
1314
|
+
export declare interface MultiCubeQueryPlan<TSchema extends Record<string, any> = Record<string, any>> {
|
|
1315
|
+
/** Primary cube that drives the query */
|
|
1316
|
+
primaryCube: Cube<TSchema>;
|
|
1317
|
+
/** Additional cubes to join */
|
|
1318
|
+
joinCubes: Array<{
|
|
1319
|
+
cube: Cube<TSchema>;
|
|
1320
|
+
alias: string;
|
|
1321
|
+
joinType: 'inner' | 'left' | 'right' | 'full';
|
|
1322
|
+
joinCondition: SQL;
|
|
1323
|
+
}>;
|
|
1324
|
+
/** Combined field selections across all cubes */
|
|
1325
|
+
selections: Record<string, SQL | AnyColumn>;
|
|
1326
|
+
/** WHERE conditions for the entire query */
|
|
1327
|
+
whereConditions: SQL[];
|
|
1328
|
+
/** GROUP BY fields if aggregations are present */
|
|
1329
|
+
groupByFields: (SQL | AnyColumn)[];
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
/**
|
|
1333
|
+
* MySQL database executor
|
|
1334
|
+
* Works with mysql2 driver
|
|
1335
|
+
*/
|
|
1336
|
+
export declare class MySQLExecutor<TSchema extends Record<string, any> = Record<string, any>> extends BaseDatabaseExecutor<TSchema> {
|
|
1337
|
+
execute<T = any[]>(query: SQL | any): Promise<T>;
|
|
1338
|
+
getEngineType(): 'mysql';
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
/**
|
|
1342
|
+
* Example schema for demonstrating Drizzle cube definitions
|
|
1343
|
+
* This shows how to define cubes using actual Drizzle schema
|
|
1344
|
+
*/
|
|
1345
|
+
export declare const organisations: PgTableWithColumns< {
|
|
1346
|
+
name: "organisations";
|
|
1347
|
+
schema: undefined;
|
|
1348
|
+
columns: {
|
|
1349
|
+
id: PgColumn< {
|
|
1350
|
+
name: "id";
|
|
1351
|
+
tableName: "organisations";
|
|
1352
|
+
dataType: "number";
|
|
1353
|
+
columnType: "PgInteger";
|
|
1354
|
+
data: number;
|
|
1355
|
+
driverParam: string | number;
|
|
1356
|
+
notNull: true;
|
|
1357
|
+
hasDefault: false;
|
|
1358
|
+
isPrimaryKey: true;
|
|
1359
|
+
isAutoincrement: false;
|
|
1360
|
+
hasRuntimeDefault: false;
|
|
1361
|
+
enumValues: undefined;
|
|
1362
|
+
baseColumn: never;
|
|
1363
|
+
identity: undefined;
|
|
1364
|
+
generated: undefined;
|
|
1365
|
+
}, {}, {}>;
|
|
1366
|
+
name: PgColumn< {
|
|
1367
|
+
name: "name";
|
|
1368
|
+
tableName: "organisations";
|
|
1369
|
+
dataType: "string";
|
|
1370
|
+
columnType: "PgText";
|
|
1371
|
+
data: string;
|
|
1372
|
+
driverParam: string;
|
|
1373
|
+
notNull: true;
|
|
1374
|
+
hasDefault: false;
|
|
1375
|
+
isPrimaryKey: false;
|
|
1376
|
+
isAutoincrement: false;
|
|
1377
|
+
hasRuntimeDefault: false;
|
|
1378
|
+
enumValues: [string, ...string[]];
|
|
1379
|
+
baseColumn: never;
|
|
1380
|
+
identity: undefined;
|
|
1381
|
+
generated: undefined;
|
|
1382
|
+
}, {}, {}>;
|
|
1383
|
+
description: PgColumn< {
|
|
1384
|
+
name: "description";
|
|
1385
|
+
tableName: "organisations";
|
|
1386
|
+
dataType: "string";
|
|
1387
|
+
columnType: "PgText";
|
|
1388
|
+
data: string;
|
|
1389
|
+
driverParam: string;
|
|
1390
|
+
notNull: false;
|
|
1391
|
+
hasDefault: false;
|
|
1392
|
+
isPrimaryKey: false;
|
|
1393
|
+
isAutoincrement: false;
|
|
1394
|
+
hasRuntimeDefault: false;
|
|
1395
|
+
enumValues: [string, ...string[]];
|
|
1396
|
+
baseColumn: never;
|
|
1397
|
+
identity: undefined;
|
|
1398
|
+
generated: undefined;
|
|
1399
|
+
}, {}, {}>;
|
|
1400
|
+
createdAt: PgColumn< {
|
|
1401
|
+
name: "created_at";
|
|
1402
|
+
tableName: "organisations";
|
|
1403
|
+
dataType: "date";
|
|
1404
|
+
columnType: "PgTimestamp";
|
|
1405
|
+
data: Date;
|
|
1406
|
+
driverParam: string;
|
|
1407
|
+
notNull: false;
|
|
1408
|
+
hasDefault: true;
|
|
1409
|
+
isPrimaryKey: false;
|
|
1410
|
+
isAutoincrement: false;
|
|
1411
|
+
hasRuntimeDefault: false;
|
|
1412
|
+
enumValues: undefined;
|
|
1413
|
+
baseColumn: never;
|
|
1414
|
+
identity: undefined;
|
|
1415
|
+
generated: undefined;
|
|
1416
|
+
}, {}, {}>;
|
|
1417
|
+
updatedAt: PgColumn< {
|
|
1418
|
+
name: "updated_at";
|
|
1419
|
+
tableName: "organisations";
|
|
1420
|
+
dataType: "date";
|
|
1421
|
+
columnType: "PgTimestamp";
|
|
1422
|
+
data: Date;
|
|
1423
|
+
driverParam: string;
|
|
1424
|
+
notNull: false;
|
|
1425
|
+
hasDefault: true;
|
|
1426
|
+
isPrimaryKey: false;
|
|
1427
|
+
isAutoincrement: false;
|
|
1428
|
+
hasRuntimeDefault: false;
|
|
1429
|
+
enumValues: undefined;
|
|
1430
|
+
baseColumn: never;
|
|
1431
|
+
identity: undefined;
|
|
1432
|
+
generated: undefined;
|
|
1433
|
+
}, {}, {}>;
|
|
1434
|
+
};
|
|
1435
|
+
dialect: "pg";
|
|
1436
|
+
}>;
|
|
1437
|
+
|
|
1438
|
+
export declare const organisationsRelations: Relations<"organisations", {
|
|
1439
|
+
departments: Many<"departments">;
|
|
1440
|
+
suppliers: Many<"suppliers">;
|
|
1441
|
+
employees: Many<"employees">;
|
|
1442
|
+
}>;
|
|
1443
|
+
|
|
1444
|
+
/**
|
|
1445
|
+
* Parse YAML content and return validation result with converted cubes
|
|
1446
|
+
*/
|
|
1447
|
+
export declare function parseYamlCubes(yamlContent: string): YamlValidationResult;
|
|
1448
|
+
|
|
1449
|
+
/**
|
|
1450
|
+
* PostgreSQL database executor
|
|
1451
|
+
* Works with postgres.js and Neon drivers
|
|
1452
|
+
*/
|
|
1453
|
+
export declare class PostgresExecutor<TSchema extends Record<string, any> = Record<string, any>> extends BaseDatabaseExecutor<TSchema> {
|
|
1454
|
+
execute<T = any[]>(query: SQL | any): Promise<T>;
|
|
1455
|
+
/**
|
|
1456
|
+
* Convert numeric string fields to numbers
|
|
1457
|
+
*/
|
|
1458
|
+
private convertNumericFields;
|
|
1459
|
+
getEngineType(): 'postgres';
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
/**
|
|
1463
|
+
* Query context for dynamic building
|
|
1464
|
+
*/
|
|
1465
|
+
export declare interface QueryContext<TSchema extends Record<string, any> = Record<string, any>> {
|
|
1466
|
+
/** Drizzle database instance */
|
|
1467
|
+
db: DrizzleDatabase<TSchema>;
|
|
1468
|
+
/** Database schema */
|
|
1469
|
+
schema: TSchema;
|
|
1470
|
+
/** Security context for filtering */
|
|
83
1471
|
securityContext: SecurityContext;
|
|
84
|
-
cube: CompiledCube;
|
|
85
|
-
query: SemanticQuery;
|
|
86
|
-
table: {
|
|
87
|
-
[column: string]: string;
|
|
88
|
-
};
|
|
89
1472
|
}
|
|
90
1473
|
|
|
1474
|
+
export declare class QueryExecutor<TSchema extends Record<string, any> = Record<string, any>> {
|
|
1475
|
+
private dbExecutor;
|
|
1476
|
+
private multiCubeBuilder;
|
|
1477
|
+
constructor(dbExecutor: DatabaseExecutor<TSchema>);
|
|
1478
|
+
/**
|
|
1479
|
+
* Unified query execution method that handles both single and multi-cube queries
|
|
1480
|
+
*/
|
|
1481
|
+
execute(cubes: Map<string, CubeWithJoins<TSchema>>, query: SemanticQuery, securityContext: SecurityContext): Promise<QueryResult>;
|
|
1482
|
+
/**
|
|
1483
|
+
* Legacy interface for single cube queries
|
|
1484
|
+
*/
|
|
1485
|
+
executeQuery(cube: Cube<TSchema>, query: SemanticQuery, securityContext: SecurityContext): Promise<QueryResult>;
|
|
1486
|
+
/**
|
|
1487
|
+
* Execute a single cube query
|
|
1488
|
+
*/
|
|
1489
|
+
private executeSingleCube;
|
|
1490
|
+
/**
|
|
1491
|
+
* Execute a Cube query (dynamic query building)
|
|
1492
|
+
*/
|
|
1493
|
+
private executeCube;
|
|
1494
|
+
/**
|
|
1495
|
+
* Execute multi-cube query using JOIN resolution
|
|
1496
|
+
*/
|
|
1497
|
+
private executeMultiCube;
|
|
1498
|
+
/**
|
|
1499
|
+
* Generate raw SQL for debugging (without execution)
|
|
1500
|
+
*/
|
|
1501
|
+
generateSQL(cube: Cube<TSchema>, query: SemanticQuery, securityContext: SecurityContext): Promise<{
|
|
1502
|
+
sql: string;
|
|
1503
|
+
params?: any[];
|
|
1504
|
+
}>;
|
|
1505
|
+
/**
|
|
1506
|
+
* Generate SQL for Cube
|
|
1507
|
+
*/
|
|
1508
|
+
private generateCubeSQL;
|
|
1509
|
+
/**
|
|
1510
|
+
* Build dynamic selections for Cube measures and dimensions
|
|
1511
|
+
*/
|
|
1512
|
+
private buildSelections;
|
|
1513
|
+
/**
|
|
1514
|
+
* Build measure expression with aggregation and filters for Cube
|
|
1515
|
+
*/
|
|
1516
|
+
private buildMeasureExpression;
|
|
1517
|
+
/**
|
|
1518
|
+
* Build time dimension expression with granularity
|
|
1519
|
+
*/
|
|
1520
|
+
private buildTimeDimensionExpression;
|
|
1521
|
+
/**
|
|
1522
|
+
* Build WHERE conditions from semantic query filters (Cube)
|
|
1523
|
+
*/
|
|
1524
|
+
private buildWhereConditions;
|
|
1525
|
+
/**
|
|
1526
|
+
* Process a single filter for Cube (basic or logical)
|
|
1527
|
+
*/
|
|
1528
|
+
private processFilter;
|
|
1529
|
+
/**
|
|
1530
|
+
* Build filter condition using Drizzle operators
|
|
1531
|
+
*/
|
|
1532
|
+
private buildFilterCondition;
|
|
1533
|
+
/**
|
|
1534
|
+
* Build GROUP BY fields from dimensions and time dimensions (Cube)
|
|
1535
|
+
*/
|
|
1536
|
+
private buildGroupByFields;
|
|
1537
|
+
/**
|
|
1538
|
+
* Build ORDER BY clause
|
|
1539
|
+
*/
|
|
1540
|
+
private buildOrderBy;
|
|
1541
|
+
/**
|
|
1542
|
+
* Generate annotations for UI metadata
|
|
1543
|
+
*/
|
|
1544
|
+
private generateAnnotations;
|
|
1545
|
+
/**
|
|
1546
|
+
* Generate annotations for multi-cube queries
|
|
1547
|
+
*/
|
|
1548
|
+
private generateMultiCubeAnnotations;
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
/**
|
|
1552
|
+
* Query execution result
|
|
1553
|
+
*/
|
|
91
1554
|
export declare interface QueryResult {
|
|
92
1555
|
data: any[];
|
|
93
1556
|
annotation: {
|
|
@@ -99,55 +1562,169 @@ export declare interface QueryResult {
|
|
|
99
1562
|
}
|
|
100
1563
|
|
|
101
1564
|
/**
|
|
102
|
-
*
|
|
103
|
-
|
|
1565
|
+
* Helper to resolve SQL expressions
|
|
1566
|
+
*/
|
|
1567
|
+
export declare function resolveSqlExpression<TSchema extends Record<string, any>>(expr: AnyColumn | SQL | ((ctx: QueryContext<TSchema>) => AnyColumn | SQL), ctx: QueryContext<TSchema>): AnyColumn | SQL;
|
|
1568
|
+
|
|
1569
|
+
/**
|
|
1570
|
+
* Security context passed to cube SQL functions
|
|
1571
|
+
* Contains user/tenant-specific data for filtering
|
|
104
1572
|
*/
|
|
105
1573
|
export declare interface SecurityContext {
|
|
106
1574
|
[key: string]: any;
|
|
107
1575
|
}
|
|
108
1576
|
|
|
109
|
-
|
|
1577
|
+
/**
|
|
1578
|
+
* Semantic cube definition with Drizzle integration
|
|
1579
|
+
*/
|
|
1580
|
+
export declare interface SemanticCube<TSchema extends Record<string, any> = Record<string, any>> {
|
|
110
1581
|
name: string;
|
|
111
1582
|
title?: string;
|
|
112
1583
|
description?: string;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
1584
|
+
/** Base SQL for the cube - can use Drizzle query builder */
|
|
1585
|
+
sql: string | SQL | ((context: LegacyQueryContext<TSchema>) => SQL | Promise<SQL>);
|
|
1586
|
+
/** Cube dimensions */
|
|
1587
|
+
dimensions: Record<string, SemanticDimension<TSchema>>;
|
|
1588
|
+
/** Cube measures */
|
|
1589
|
+
measures: Record<string, SemanticMeasure<TSchema>>;
|
|
1590
|
+
/** Joins to other cubes */
|
|
1591
|
+
joins?: Record<string, SemanticJoin<TSchema>>;
|
|
1592
|
+
/** Whether cube is publicly accessible */
|
|
117
1593
|
public?: boolean;
|
|
1594
|
+
/** SQL alias for the cube */
|
|
1595
|
+
sqlAlias?: string;
|
|
1596
|
+
/** Data source identifier */
|
|
1597
|
+
dataSource?: string;
|
|
1598
|
+
/** Refresh configuration */
|
|
1599
|
+
refreshKey?: {
|
|
1600
|
+
every?: string;
|
|
1601
|
+
sql?: string | SQL;
|
|
1602
|
+
};
|
|
1603
|
+
/** Pre-aggregation definitions */
|
|
1604
|
+
preAggregations?: Record<string, SemanticPreAggregation>;
|
|
1605
|
+
/** Additional metadata */
|
|
1606
|
+
meta?: Record<string, any>;
|
|
118
1607
|
}
|
|
119
1608
|
|
|
120
|
-
|
|
1609
|
+
/**
|
|
1610
|
+
* Create a YAML cube definition from a SemanticCube (for export/migration)
|
|
1611
|
+
*/
|
|
1612
|
+
export declare function semanticCubeToYaml(cube: SemanticCube): string;
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* Semantic dimension with Drizzle column support
|
|
1616
|
+
*/
|
|
1617
|
+
export declare interface SemanticDimension<TSchema extends Record<string, any> = Record<string, any>> {
|
|
121
1618
|
name: string;
|
|
122
1619
|
title?: string;
|
|
123
1620
|
description?: string;
|
|
124
|
-
type:
|
|
125
|
-
|
|
1621
|
+
type: DimensionType;
|
|
1622
|
+
/** SQL expression - can be Drizzle column reference or SQL template */
|
|
1623
|
+
sql: string | SQL | DrizzleColumn | ((context: LegacyQueryContext<TSchema>) => SQL | DrizzleColumn);
|
|
1624
|
+
/** Whether this is a primary key */
|
|
126
1625
|
primaryKey?: boolean;
|
|
1626
|
+
/** Whether to show in UI */
|
|
127
1627
|
shown?: boolean;
|
|
1628
|
+
/** Display format */
|
|
128
1629
|
format?: DimensionFormat;
|
|
1630
|
+
/** Additional metadata */
|
|
129
1631
|
meta?: Record<string, any>;
|
|
130
1632
|
}
|
|
131
1633
|
|
|
132
|
-
|
|
133
|
-
|
|
1634
|
+
/**
|
|
1635
|
+
* Join definition between cubes
|
|
1636
|
+
*/
|
|
1637
|
+
export declare interface SemanticJoin<TSchema extends Record<string, any> = Record<string, any>> {
|
|
1638
|
+
name?: string;
|
|
1639
|
+
type?: JoinType;
|
|
1640
|
+
/** Join condition using Drizzle SQL */
|
|
1641
|
+
sql: string | SQL | ((context: LegacyQueryContext<TSchema>) => SQL);
|
|
1642
|
+
/** Relationship type */
|
|
134
1643
|
relationship: 'belongsTo' | 'hasOne' | 'hasMany';
|
|
135
1644
|
}
|
|
136
1645
|
|
|
137
|
-
export declare const semanticLayer: SemanticLayerCompiler
|
|
1646
|
+
export declare const semanticLayer: SemanticLayerCompiler<Record<string, any>>;
|
|
138
1647
|
|
|
139
|
-
export declare class SemanticLayerCompiler {
|
|
1648
|
+
export declare class SemanticLayerCompiler<TSchema extends Record<string, any> = Record<string, any>> {
|
|
140
1649
|
private cubes;
|
|
141
1650
|
private dbExecutor?;
|
|
142
|
-
constructor(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
1651
|
+
constructor(options?: {
|
|
1652
|
+
drizzle?: DatabaseExecutor<TSchema>['db'];
|
|
1653
|
+
schema?: TSchema;
|
|
1654
|
+
databaseExecutor?: DatabaseExecutor<TSchema>;
|
|
1655
|
+
engineType?: 'postgres' | 'mysql' | 'sqlite';
|
|
1656
|
+
});
|
|
1657
|
+
/**
|
|
1658
|
+
* Set or update the database executor
|
|
1659
|
+
*/
|
|
1660
|
+
setDatabaseExecutor(executor: DatabaseExecutor<TSchema>): void;
|
|
1661
|
+
/**
|
|
1662
|
+
* Set Drizzle instance and schema directly
|
|
1663
|
+
*/
|
|
1664
|
+
setDrizzle(db: DatabaseExecutor<TSchema>['db'], schema?: TSchema, engineType?: 'postgres' | 'mysql' | 'sqlite'): void;
|
|
1665
|
+
/**
|
|
1666
|
+
* Check if database executor is configured
|
|
1667
|
+
*/
|
|
1668
|
+
hasExecutor(): boolean;
|
|
1669
|
+
/**
|
|
1670
|
+
* Register a simplified cube with dynamic query building
|
|
1671
|
+
*/
|
|
1672
|
+
registerCube(cube: CubeWithJoins<TSchema>): void;
|
|
1673
|
+
/**
|
|
1674
|
+
* Get a cube by name
|
|
1675
|
+
*/
|
|
1676
|
+
getCube(name: string): CubeWithJoins<TSchema> | undefined;
|
|
1677
|
+
/**
|
|
1678
|
+
* Get all registered cubes
|
|
1679
|
+
*/
|
|
1680
|
+
getAllCubes(): CubeWithJoins<TSchema>[];
|
|
1681
|
+
/**
|
|
1682
|
+
* Get all cubes as a Map for multi-cube queries
|
|
1683
|
+
*/
|
|
1684
|
+
getAllCubesMap(): Map<string, CubeWithJoins<TSchema>>;
|
|
1685
|
+
/**
|
|
1686
|
+
* Unified query execution method that handles both single and multi-cube queries
|
|
1687
|
+
*/
|
|
1688
|
+
execute(query: SemanticQuery, securityContext: SecurityContext): Promise<QueryResult>;
|
|
1689
|
+
/**
|
|
1690
|
+
* Execute a multi-cube query
|
|
1691
|
+
*/
|
|
1692
|
+
executeMultiCubeQuery(query: SemanticQuery, securityContext: SecurityContext): Promise<QueryResult>;
|
|
1693
|
+
/**
|
|
1694
|
+
* Execute a single cube query
|
|
1695
|
+
*/
|
|
1696
|
+
executeQuery(cubeName: string, query: SemanticQuery, securityContext: SecurityContext): Promise<QueryResult>;
|
|
1697
|
+
/**
|
|
1698
|
+
* Get metadata for all cubes (for API responses)
|
|
1699
|
+
*/
|
|
147
1700
|
getMetadata(): CubeMetadata[];
|
|
148
|
-
|
|
149
|
-
|
|
1701
|
+
/**
|
|
1702
|
+
* Generate cube metadata for API responses from cubes
|
|
1703
|
+
*/
|
|
150
1704
|
private generateCubeMetadata;
|
|
1705
|
+
/**
|
|
1706
|
+
* Get SQL for a query without executing it (debugging)
|
|
1707
|
+
*/
|
|
1708
|
+
generateSQL(cubeName: string, query: SemanticQuery, securityContext: SecurityContext): Promise<{
|
|
1709
|
+
sql: string;
|
|
1710
|
+
params?: any[];
|
|
1711
|
+
}>;
|
|
1712
|
+
/**
|
|
1713
|
+
* Check if a cube exists
|
|
1714
|
+
*/
|
|
1715
|
+
hasCube(name: string): boolean;
|
|
1716
|
+
/**
|
|
1717
|
+
* Remove a cube
|
|
1718
|
+
*/
|
|
1719
|
+
removeCube(name: string): boolean;
|
|
1720
|
+
/**
|
|
1721
|
+
* Clear all cubes
|
|
1722
|
+
*/
|
|
1723
|
+
clearCubes(): void;
|
|
1724
|
+
/**
|
|
1725
|
+
* Get cube names
|
|
1726
|
+
*/
|
|
1727
|
+
getCubeNames(): string[];
|
|
151
1728
|
}
|
|
152
1729
|
|
|
153
1730
|
/**
|
|
@@ -157,7 +1734,7 @@ export declare const SemanticLayerUtils: {
|
|
|
157
1734
|
/**
|
|
158
1735
|
* Create a simple query builder
|
|
159
1736
|
*/
|
|
160
|
-
query: (
|
|
1737
|
+
query: () => {
|
|
161
1738
|
measures: (measures: string[]) => {
|
|
162
1739
|
dimensions: (dimensions?: string[]) => {
|
|
163
1740
|
filters: (filters?: any[]) => {
|
|
@@ -418,71 +1995,225 @@ export declare const SemanticLayerUtils: {
|
|
|
418
1995
|
};
|
|
419
1996
|
};
|
|
420
1997
|
|
|
421
|
-
|
|
1998
|
+
/**
|
|
1999
|
+
* Semantic measure with Drizzle aggregation support
|
|
2000
|
+
*/
|
|
2001
|
+
export declare interface SemanticMeasure<TSchema extends Record<string, any> = Record<string, any>> {
|
|
422
2002
|
name: string;
|
|
423
2003
|
title?: string;
|
|
424
2004
|
description?: string;
|
|
425
2005
|
type: MeasureType;
|
|
426
|
-
|
|
2006
|
+
/** SQL expression - can be Drizzle column or aggregation function */
|
|
2007
|
+
sql: string | SQL | DrizzleColumn | ((context: LegacyQueryContext<TSchema>) => SQL | DrizzleColumn);
|
|
2008
|
+
/** Display format */
|
|
427
2009
|
format?: MeasureFormat;
|
|
2010
|
+
/** Whether to show in UI */
|
|
2011
|
+
shown?: boolean;
|
|
2012
|
+
/** Filters applied to this measure */
|
|
428
2013
|
filters?: Array<{
|
|
429
|
-
sql: string;
|
|
2014
|
+
sql: string | SQL | ((context: LegacyQueryContext<TSchema>) => SQL);
|
|
430
2015
|
}>;
|
|
2016
|
+
/** Rolling window configuration */
|
|
431
2017
|
rollingWindow?: {
|
|
432
2018
|
trailing?: string;
|
|
433
2019
|
leading?: string;
|
|
434
2020
|
offset?: string;
|
|
435
2021
|
};
|
|
2022
|
+
/** Additional metadata */
|
|
436
2023
|
meta?: Record<string, any>;
|
|
437
2024
|
}
|
|
438
2025
|
|
|
2026
|
+
/**
|
|
2027
|
+
* Pre-aggregation configuration
|
|
2028
|
+
*/
|
|
2029
|
+
export declare interface SemanticPreAggregation {
|
|
2030
|
+
name: string;
|
|
2031
|
+
measures: string[];
|
|
2032
|
+
dimensions: string[];
|
|
2033
|
+
timeDimension?: {
|
|
2034
|
+
dimension: string;
|
|
2035
|
+
granularity: TimeGranularity[];
|
|
2036
|
+
};
|
|
2037
|
+
refreshKey?: {
|
|
2038
|
+
every: string;
|
|
2039
|
+
sql?: string | SQL;
|
|
2040
|
+
};
|
|
2041
|
+
indexes?: Record<string, string[]>;
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
/**
|
|
2045
|
+
* Semantic query structure (Cube.js compatible)
|
|
2046
|
+
*/
|
|
439
2047
|
export declare interface SemanticQuery {
|
|
440
2048
|
measures?: string[];
|
|
441
2049
|
dimensions?: string[];
|
|
442
|
-
filters?: Array<
|
|
443
|
-
|
|
444
|
-
operator: FilterOperator;
|
|
445
|
-
values: any[];
|
|
446
|
-
}>;
|
|
447
|
-
timeDimensions?: Array<{
|
|
448
|
-
dimension: string;
|
|
449
|
-
granularity?: TimeGranularity;
|
|
450
|
-
dateRange?: string | string[];
|
|
451
|
-
}>;
|
|
2050
|
+
filters?: Array<Filter>;
|
|
2051
|
+
timeDimensions?: Array<TimeDimension>;
|
|
452
2052
|
limit?: number;
|
|
453
2053
|
offset?: number;
|
|
454
2054
|
order?: Record<string, 'asc' | 'desc'>;
|
|
455
2055
|
}
|
|
456
2056
|
|
|
457
|
-
export
|
|
458
|
-
private dbExecutor;
|
|
459
|
-
constructor(dbExecutor: DatabaseExecutor);
|
|
460
|
-
executeQuery(cube: SemanticCube, query: SemanticQuery, securityContext: SecurityContext): Promise<QueryResult>;
|
|
461
|
-
generateSQL(cube: SemanticCube, query: SemanticQuery, securityContext: SecurityContext): {
|
|
462
|
-
sql: string;
|
|
463
|
-
params?: any[];
|
|
464
|
-
};
|
|
465
|
-
private substituteSecurityVariables;
|
|
466
|
-
private buildSelectClause;
|
|
467
|
-
private buildMeasureSQL;
|
|
468
|
-
private buildWhereClause;
|
|
469
|
-
private buildFilterCondition;
|
|
470
|
-
private buildGroupByClause;
|
|
471
|
-
private buildOrderByClause;
|
|
472
|
-
private buildLimitClause;
|
|
473
|
-
private generateAnnotations;
|
|
474
|
-
}
|
|
2057
|
+
export { SQL }
|
|
475
2058
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
2059
|
+
/**
|
|
2060
|
+
* SQLite database executor
|
|
2061
|
+
* Works with better-sqlite3 driver
|
|
2062
|
+
*/
|
|
2063
|
+
export declare class SQLiteExecutor<TSchema extends Record<string, any> = Record<string, any>> extends BaseDatabaseExecutor<TSchema> {
|
|
2064
|
+
execute<T = any[]>(query: SQL | any): Promise<T>;
|
|
2065
|
+
getEngineType(): 'sqlite';
|
|
479
2066
|
}
|
|
480
2067
|
|
|
2068
|
+
/**
|
|
2069
|
+
* SQL generation result
|
|
2070
|
+
*/
|
|
481
2071
|
export declare interface SqlResult {
|
|
482
2072
|
sql: string;
|
|
483
2073
|
params?: any[];
|
|
484
2074
|
}
|
|
485
2075
|
|
|
2076
|
+
export declare const suppliers: PgTableWithColumns< {
|
|
2077
|
+
name: "suppliers";
|
|
2078
|
+
schema: undefined;
|
|
2079
|
+
columns: {
|
|
2080
|
+
id: PgColumn< {
|
|
2081
|
+
name: "id";
|
|
2082
|
+
tableName: "suppliers";
|
|
2083
|
+
dataType: "number";
|
|
2084
|
+
columnType: "PgInteger";
|
|
2085
|
+
data: number;
|
|
2086
|
+
driverParam: string | number;
|
|
2087
|
+
notNull: true;
|
|
2088
|
+
hasDefault: false;
|
|
2089
|
+
isPrimaryKey: true;
|
|
2090
|
+
isAutoincrement: false;
|
|
2091
|
+
hasRuntimeDefault: false;
|
|
2092
|
+
enumValues: undefined;
|
|
2093
|
+
baseColumn: never;
|
|
2094
|
+
identity: undefined;
|
|
2095
|
+
generated: undefined;
|
|
2096
|
+
}, {}, {}>;
|
|
2097
|
+
name: PgColumn< {
|
|
2098
|
+
name: "name";
|
|
2099
|
+
tableName: "suppliers";
|
|
2100
|
+
dataType: "string";
|
|
2101
|
+
columnType: "PgText";
|
|
2102
|
+
data: string;
|
|
2103
|
+
driverParam: string;
|
|
2104
|
+
notNull: true;
|
|
2105
|
+
hasDefault: false;
|
|
2106
|
+
isPrimaryKey: false;
|
|
2107
|
+
isAutoincrement: false;
|
|
2108
|
+
hasRuntimeDefault: false;
|
|
2109
|
+
enumValues: [string, ...string[]];
|
|
2110
|
+
baseColumn: never;
|
|
2111
|
+
identity: undefined;
|
|
2112
|
+
generated: undefined;
|
|
2113
|
+
}, {}, {}>;
|
|
2114
|
+
description: PgColumn< {
|
|
2115
|
+
name: "description";
|
|
2116
|
+
tableName: "suppliers";
|
|
2117
|
+
dataType: "string";
|
|
2118
|
+
columnType: "PgText";
|
|
2119
|
+
data: string;
|
|
2120
|
+
driverParam: string;
|
|
2121
|
+
notNull: false;
|
|
2122
|
+
hasDefault: false;
|
|
2123
|
+
isPrimaryKey: false;
|
|
2124
|
+
isAutoincrement: false;
|
|
2125
|
+
hasRuntimeDefault: false;
|
|
2126
|
+
enumValues: [string, ...string[]];
|
|
2127
|
+
baseColumn: never;
|
|
2128
|
+
identity: undefined;
|
|
2129
|
+
generated: undefined;
|
|
2130
|
+
}, {}, {}>;
|
|
2131
|
+
internal: PgColumn< {
|
|
2132
|
+
name: "internal";
|
|
2133
|
+
tableName: "suppliers";
|
|
2134
|
+
dataType: "boolean";
|
|
2135
|
+
columnType: "PgBoolean";
|
|
2136
|
+
data: boolean;
|
|
2137
|
+
driverParam: boolean;
|
|
2138
|
+
notNull: false;
|
|
2139
|
+
hasDefault: true;
|
|
2140
|
+
isPrimaryKey: false;
|
|
2141
|
+
isAutoincrement: false;
|
|
2142
|
+
hasRuntimeDefault: false;
|
|
2143
|
+
enumValues: undefined;
|
|
2144
|
+
baseColumn: never;
|
|
2145
|
+
identity: undefined;
|
|
2146
|
+
generated: undefined;
|
|
2147
|
+
}, {}, {}>;
|
|
2148
|
+
organisation: PgColumn< {
|
|
2149
|
+
name: "organisation";
|
|
2150
|
+
tableName: "suppliers";
|
|
2151
|
+
dataType: "number";
|
|
2152
|
+
columnType: "PgInteger";
|
|
2153
|
+
data: number;
|
|
2154
|
+
driverParam: string | number;
|
|
2155
|
+
notNull: true;
|
|
2156
|
+
hasDefault: false;
|
|
2157
|
+
isPrimaryKey: false;
|
|
2158
|
+
isAutoincrement: false;
|
|
2159
|
+
hasRuntimeDefault: false;
|
|
2160
|
+
enumValues: undefined;
|
|
2161
|
+
baseColumn: never;
|
|
2162
|
+
identity: undefined;
|
|
2163
|
+
generated: undefined;
|
|
2164
|
+
}, {}, {}>;
|
|
2165
|
+
createdAt: PgColumn< {
|
|
2166
|
+
name: "created_at";
|
|
2167
|
+
tableName: "suppliers";
|
|
2168
|
+
dataType: "date";
|
|
2169
|
+
columnType: "PgTimestamp";
|
|
2170
|
+
data: Date;
|
|
2171
|
+
driverParam: string;
|
|
2172
|
+
notNull: false;
|
|
2173
|
+
hasDefault: true;
|
|
2174
|
+
isPrimaryKey: false;
|
|
2175
|
+
isAutoincrement: false;
|
|
2176
|
+
hasRuntimeDefault: false;
|
|
2177
|
+
enumValues: undefined;
|
|
2178
|
+
baseColumn: never;
|
|
2179
|
+
identity: undefined;
|
|
2180
|
+
generated: undefined;
|
|
2181
|
+
}, {}, {}>;
|
|
2182
|
+
updatedAt: PgColumn< {
|
|
2183
|
+
name: "updated_at";
|
|
2184
|
+
tableName: "suppliers";
|
|
2185
|
+
dataType: "date";
|
|
2186
|
+
columnType: "PgTimestamp";
|
|
2187
|
+
data: Date;
|
|
2188
|
+
driverParam: string;
|
|
2189
|
+
notNull: false;
|
|
2190
|
+
hasDefault: true;
|
|
2191
|
+
isPrimaryKey: false;
|
|
2192
|
+
isAutoincrement: false;
|
|
2193
|
+
hasRuntimeDefault: false;
|
|
2194
|
+
enumValues: undefined;
|
|
2195
|
+
baseColumn: never;
|
|
2196
|
+
identity: undefined;
|
|
2197
|
+
generated: undefined;
|
|
2198
|
+
}, {}, {}>;
|
|
2199
|
+
};
|
|
2200
|
+
dialect: "pg";
|
|
2201
|
+
}>;
|
|
2202
|
+
|
|
2203
|
+
export declare const suppliersRelations: Relations<"suppliers", {
|
|
2204
|
+
organisation: One<"organisations", true>;
|
|
2205
|
+
employees: Many<"employees">;
|
|
2206
|
+
}>;
|
|
2207
|
+
|
|
2208
|
+
/**
|
|
2209
|
+
* Time dimension with granularity
|
|
2210
|
+
*/
|
|
2211
|
+
export declare interface TimeDimension {
|
|
2212
|
+
dimension: string;
|
|
2213
|
+
granularity?: TimeGranularity;
|
|
2214
|
+
dateRange?: string | string[];
|
|
2215
|
+
}
|
|
2216
|
+
|
|
486
2217
|
export declare interface TimeDimensionAnnotation {
|
|
487
2218
|
title: string;
|
|
488
2219
|
shortTitle: string;
|
|
@@ -492,4 +2223,174 @@ export declare interface TimeDimensionAnnotation {
|
|
|
492
2223
|
|
|
493
2224
|
export declare type TimeGranularity = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
494
2225
|
|
|
2226
|
+
/**
|
|
2227
|
+
* Single YAML Cube Definition
|
|
2228
|
+
*/
|
|
2229
|
+
export declare interface YamlCube {
|
|
2230
|
+
name: string;
|
|
2231
|
+
title?: string;
|
|
2232
|
+
description?: string;
|
|
2233
|
+
sql?: string;
|
|
2234
|
+
sql_table?: string;
|
|
2235
|
+
sqlTable?: string;
|
|
2236
|
+
sql_alias?: string;
|
|
2237
|
+
sqlAlias?: string;
|
|
2238
|
+
data_source?: string;
|
|
2239
|
+
dataSource?: string;
|
|
2240
|
+
refresh_key?: {
|
|
2241
|
+
every?: string;
|
|
2242
|
+
sql?: string;
|
|
2243
|
+
};
|
|
2244
|
+
refreshKey?: {
|
|
2245
|
+
every?: string;
|
|
2246
|
+
sql?: string;
|
|
2247
|
+
};
|
|
2248
|
+
dimensions?: YamlDimension[];
|
|
2249
|
+
measures?: YamlMeasure[];
|
|
2250
|
+
joins?: YamlJoin[];
|
|
2251
|
+
pre_aggregations?: YamlPreAggregation[];
|
|
2252
|
+
preAggregations?: YamlPreAggregation[];
|
|
2253
|
+
meta?: Record<string, any>;
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
/**
|
|
2257
|
+
* Convert YAML cube to SemanticCube object
|
|
2258
|
+
*/
|
|
2259
|
+
export declare function yamlCubeToSemanticCube(yamlCube: YamlCube): SemanticCube;
|
|
2260
|
+
|
|
2261
|
+
/**
|
|
2262
|
+
* YAML Dimension Definition
|
|
2263
|
+
*/
|
|
2264
|
+
export declare interface YamlDimension {
|
|
2265
|
+
name: string;
|
|
2266
|
+
title?: string;
|
|
2267
|
+
description?: string;
|
|
2268
|
+
type: DimensionType;
|
|
2269
|
+
sql: string;
|
|
2270
|
+
primary_key?: boolean;
|
|
2271
|
+
primaryKey?: boolean;
|
|
2272
|
+
shown?: boolean;
|
|
2273
|
+
format?: 'id' | 'link' | 'currency' | 'percent' | 'number' | 'date' | 'datetime';
|
|
2274
|
+
meta?: Record<string, any>;
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
/**
|
|
2278
|
+
* YAML Join Definition
|
|
2279
|
+
*/
|
|
2280
|
+
export declare interface YamlJoin {
|
|
2281
|
+
name: string;
|
|
2282
|
+
type?: JoinType;
|
|
2283
|
+
relationship: 'one_to_one' | 'one_to_many' | 'many_to_one';
|
|
2284
|
+
sql: string;
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
/**
|
|
2288
|
+
* YAML Measure Definition
|
|
2289
|
+
*/
|
|
2290
|
+
export declare interface YamlMeasure {
|
|
2291
|
+
name: string;
|
|
2292
|
+
title?: string;
|
|
2293
|
+
description?: string;
|
|
2294
|
+
type: MeasureType;
|
|
2295
|
+
sql: string;
|
|
2296
|
+
format?: 'currency' | 'percent' | 'number' | 'integer';
|
|
2297
|
+
shown?: boolean;
|
|
2298
|
+
filters?: Array<{
|
|
2299
|
+
sql: string;
|
|
2300
|
+
}>;
|
|
2301
|
+
rolling_window?: {
|
|
2302
|
+
trailing?: string;
|
|
2303
|
+
leading?: string;
|
|
2304
|
+
offset?: string;
|
|
2305
|
+
};
|
|
2306
|
+
rollingWindow?: {
|
|
2307
|
+
trailing?: string;
|
|
2308
|
+
leading?: string;
|
|
2309
|
+
offset?: string;
|
|
2310
|
+
};
|
|
2311
|
+
meta?: Record<string, any>;
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2314
|
+
/**
|
|
2315
|
+
* YAML Pre-aggregation Definition
|
|
2316
|
+
*/
|
|
2317
|
+
export declare interface YamlPreAggregation {
|
|
2318
|
+
name: string;
|
|
2319
|
+
measures: string[];
|
|
2320
|
+
dimensions: string[];
|
|
2321
|
+
time_dimension?: {
|
|
2322
|
+
dimension: string;
|
|
2323
|
+
granularity: TimeGranularity[];
|
|
2324
|
+
};
|
|
2325
|
+
timeDimension?: {
|
|
2326
|
+
dimension: string;
|
|
2327
|
+
granularity: TimeGranularity[];
|
|
2328
|
+
};
|
|
2329
|
+
refresh_key?: {
|
|
2330
|
+
every: string;
|
|
2331
|
+
sql?: string;
|
|
2332
|
+
};
|
|
2333
|
+
refreshKey?: {
|
|
2334
|
+
every: string;
|
|
2335
|
+
sql?: string;
|
|
2336
|
+
};
|
|
2337
|
+
indexes?: Record<string, string[]>;
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
/**
|
|
2341
|
+
* Root YAML Schema - supports multiple formats:
|
|
2342
|
+
* 1. Single cube definition (properties at root)
|
|
2343
|
+
* 2. Multiple cubes (cubes array)
|
|
2344
|
+
* 3. Cubes and views (separate arrays)
|
|
2345
|
+
*/
|
|
2346
|
+
export declare interface YamlSchema {
|
|
2347
|
+
name?: string;
|
|
2348
|
+
title?: string;
|
|
2349
|
+
description?: string;
|
|
2350
|
+
sql?: string;
|
|
2351
|
+
sql_table?: string;
|
|
2352
|
+
sqlTable?: string;
|
|
2353
|
+
sql_alias?: string;
|
|
2354
|
+
sqlAlias?: string;
|
|
2355
|
+
data_source?: string;
|
|
2356
|
+
dataSource?: string;
|
|
2357
|
+
refresh_key?: YamlCube['refresh_key'];
|
|
2358
|
+
refreshKey?: YamlCube['refreshKey'];
|
|
2359
|
+
dimensions?: YamlDimension[];
|
|
2360
|
+
measures?: YamlMeasure[];
|
|
2361
|
+
joins?: YamlJoin[];
|
|
2362
|
+
pre_aggregations?: YamlPreAggregation[];
|
|
2363
|
+
preAggregations?: YamlPreAggregation[];
|
|
2364
|
+
meta?: Record<string, any>;
|
|
2365
|
+
cubes?: YamlCube[];
|
|
2366
|
+
views?: YamlView[];
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
/**
|
|
2370
|
+
* Validation result for YAML parsing
|
|
2371
|
+
*/
|
|
2372
|
+
export declare interface YamlValidationResult {
|
|
2373
|
+
valid: boolean;
|
|
2374
|
+
errors: string[];
|
|
2375
|
+
warnings: string[];
|
|
2376
|
+
cubes: YamlCube[];
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2379
|
+
/**
|
|
2380
|
+
* YAML View Definition (for future support)
|
|
2381
|
+
*/
|
|
2382
|
+
export declare interface YamlView {
|
|
2383
|
+
name: string;
|
|
2384
|
+
title?: string;
|
|
2385
|
+
description?: string;
|
|
2386
|
+
cubes: Array<{
|
|
2387
|
+
join_path?: string;
|
|
2388
|
+
joinPath?: string;
|
|
2389
|
+
prefix?: boolean;
|
|
2390
|
+
includes?: string[];
|
|
2391
|
+
excludes?: string[];
|
|
2392
|
+
}>;
|
|
2393
|
+
meta?: Record<string, any>;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
495
2396
|
export { }
|