@hypequery/clickhouse 0.0.0-canary-20260306132943
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/LICENSE +201 -0
- package/README-CLI.md +123 -0
- package/README.md +316 -0
- package/dist/cli/bin.js +285 -0
- package/dist/cli/generate-types.d.ts +5 -0
- package/dist/cli/generate-types.js +218 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +2 -0
- package/dist/core/cache/cache-manager.d.ts +4 -0
- package/dist/core/cache/cache-manager.d.ts.map +1 -0
- package/dist/core/cache/cache-manager.js +176 -0
- package/dist/core/cache/controller.d.ts +15 -0
- package/dist/core/cache/controller.d.ts.map +1 -0
- package/dist/core/cache/controller.js +58 -0
- package/dist/core/cache/key.d.ts +11 -0
- package/dist/core/cache/key.d.ts.map +1 -0
- package/dist/core/cache/key.js +26 -0
- package/dist/core/cache/providers/memory-lru.d.ts +31 -0
- package/dist/core/cache/providers/memory-lru.d.ts.map +1 -0
- package/dist/core/cache/providers/memory-lru.js +156 -0
- package/dist/core/cache/providers/noop.d.ts +7 -0
- package/dist/core/cache/providers/noop.d.ts.map +1 -0
- package/dist/core/cache/providers/noop.js +11 -0
- package/dist/core/cache/runtime-context.d.ts +30 -0
- package/dist/core/cache/runtime-context.d.ts.map +1 -0
- package/dist/core/cache/runtime-context.js +58 -0
- package/dist/core/cache/serialization.d.ts +6 -0
- package/dist/core/cache/serialization.d.ts.map +1 -0
- package/dist/core/cache/serialization.js +166 -0
- package/dist/core/cache/types.d.ts +52 -0
- package/dist/core/cache/types.d.ts.map +1 -0
- package/dist/core/cache/types.js +1 -0
- package/dist/core/cache/utils.d.ts +9 -0
- package/dist/core/cache/utils.d.ts.map +1 -0
- package/dist/core/cache/utils.js +30 -0
- package/dist/core/connection.d.ts +112 -0
- package/dist/core/connection.d.ts.map +1 -0
- package/dist/core/connection.js +150 -0
- package/dist/core/cross-filter.d.ts +73 -0
- package/dist/core/cross-filter.d.ts.map +1 -0
- package/dist/core/cross-filter.js +142 -0
- package/dist/core/env/auto-client.browser.d.ts +3 -0
- package/dist/core/env/auto-client.browser.d.ts.map +1 -0
- package/dist/core/env/auto-client.browser.js +3 -0
- package/dist/core/env/auto-client.d.ts +9 -0
- package/dist/core/env/auto-client.d.ts.map +1 -0
- package/dist/core/env/auto-client.js +21 -0
- package/dist/core/features/aggregations.d.ts +98 -0
- package/dist/core/features/aggregations.d.ts.map +1 -0
- package/dist/core/features/aggregations.js +36 -0
- package/dist/core/features/analytics.d.ts +81 -0
- package/dist/core/features/analytics.d.ts.map +1 -0
- package/dist/core/features/analytics.js +45 -0
- package/dist/core/features/cross-filtering.d.ts +11 -0
- package/dist/core/features/cross-filtering.d.ts.map +1 -0
- package/dist/core/features/cross-filtering.js +90 -0
- package/dist/core/features/executor.d.ts +21 -0
- package/dist/core/features/executor.d.ts.map +1 -0
- package/dist/core/features/executor.js +146 -0
- package/dist/core/features/filtering.d.ts +99 -0
- package/dist/core/features/filtering.d.ts.map +1 -0
- package/dist/core/features/filtering.js +118 -0
- package/dist/core/features/joins.d.ts +26 -0
- package/dist/core/features/joins.d.ts.map +1 -0
- package/dist/core/features/joins.js +17 -0
- package/dist/core/features/query-modifiers.d.ts +116 -0
- package/dist/core/features/query-modifiers.d.ts.map +1 -0
- package/dist/core/features/query-modifiers.js +51 -0
- package/dist/core/formatters/sql-formatter.d.ts +9 -0
- package/dist/core/formatters/sql-formatter.d.ts.map +1 -0
- package/dist/core/formatters/sql-formatter.js +131 -0
- package/dist/core/join-relationships.d.ts +51 -0
- package/dist/core/join-relationships.d.ts.map +1 -0
- package/dist/core/join-relationships.js +54 -0
- package/dist/core/query-builder.d.ts +236 -0
- package/dist/core/query-builder.d.ts.map +1 -0
- package/dist/core/query-builder.js +495 -0
- package/dist/core/tests/index.d.ts +2 -0
- package/dist/core/tests/index.d.ts.map +1 -0
- package/dist/core/tests/index.js +1 -0
- package/dist/core/tests/integration/setup.d.ts +48 -0
- package/dist/core/tests/integration/setup.d.ts.map +1 -0
- package/dist/core/tests/integration/setup.js +349 -0
- package/dist/core/tests/integration/test-config.d.ts +15 -0
- package/dist/core/tests/integration/test-config.d.ts.map +1 -0
- package/dist/core/tests/integration/test-config.js +14 -0
- package/dist/core/tests/integration/test-data.json +190 -0
- package/dist/core/tests/test-utils.d.ts +44 -0
- package/dist/core/tests/test-utils.d.ts.map +1 -0
- package/dist/core/tests/test-utils.js +65 -0
- package/dist/core/types/builder-state.d.ts +27 -0
- package/dist/core/types/builder-state.d.ts.map +1 -0
- package/dist/core/types/builder-state.js +1 -0
- package/dist/core/types/select-types.d.ts +33 -0
- package/dist/core/types/select-types.d.ts.map +1 -0
- package/dist/core/types/select-types.js +1 -0
- package/dist/core/types/type-helpers.d.ts +5 -0
- package/dist/core/types/type-helpers.d.ts.map +1 -0
- package/dist/core/types/type-helpers.js +1 -0
- package/dist/core/utils/logger.d.ts +43 -0
- package/dist/core/utils/logger.d.ts.map +1 -0
- package/dist/core/utils/logger.js +104 -0
- package/dist/core/utils/predicate-builder.d.ts +33 -0
- package/dist/core/utils/predicate-builder.d.ts.map +1 -0
- package/dist/core/utils/predicate-builder.js +95 -0
- package/dist/core/utils/sql-expressions.d.ts +77 -0
- package/dist/core/utils/sql-expressions.d.ts.map +1 -0
- package/dist/core/utils/sql-expressions.js +54 -0
- package/dist/core/utils/streaming-helpers.d.ts +2 -0
- package/dist/core/utils/streaming-helpers.d.ts.map +1 -0
- package/dist/core/utils/streaming-helpers.js +137 -0
- package/dist/core/utils.d.ts +3 -0
- package/dist/core/utils.d.ts.map +1 -0
- package/dist/core/utils.js +29 -0
- package/dist/core/validators/filter-validator.d.ts +9 -0
- package/dist/core/validators/filter-validator.d.ts.map +1 -0
- package/dist/core/validators/filter-validator.js +19 -0
- package/dist/core/validators/value-validator.d.ts +7 -0
- package/dist/core/validators/value-validator.d.ts.map +1 -0
- package/dist/core/validators/value-validator.js +47 -0
- package/dist/formatters/index.d.ts +2 -0
- package/dist/formatters/index.d.ts.map +1 -0
- package/dist/formatters/index.js +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/types/base.d.ts +50 -0
- package/dist/types/base.d.ts.map +1 -0
- package/dist/types/base.js +1 -0
- package/dist/types/clickhouse-types.d.ts +17 -0
- package/dist/types/clickhouse-types.d.ts.map +1 -0
- package/dist/types/clickhouse-types.js +1 -0
- package/dist/types/filters.d.ts +53 -0
- package/dist/types/filters.d.ts.map +1 -0
- package/dist/types/filters.js +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/schema.d.ts +19 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/schema.js +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
export class SQLFormatter {
|
|
2
|
+
formatSelect(config) {
|
|
3
|
+
const distinctClause = config.distinct ? 'DISTINCT ' : '';
|
|
4
|
+
if (!config.select?.length)
|
|
5
|
+
return distinctClause + '*';
|
|
6
|
+
return distinctClause + config.select.join(', ');
|
|
7
|
+
}
|
|
8
|
+
formatGroupBy(config) {
|
|
9
|
+
const groupBy = config.groupBy;
|
|
10
|
+
if (!groupBy?.length)
|
|
11
|
+
return '';
|
|
12
|
+
if (Array.isArray(groupBy)) {
|
|
13
|
+
return groupBy.join(', ');
|
|
14
|
+
}
|
|
15
|
+
return String(groupBy);
|
|
16
|
+
}
|
|
17
|
+
formatWhere(config) {
|
|
18
|
+
if (!config.where?.length)
|
|
19
|
+
return '';
|
|
20
|
+
let afterGroupStart = false; // Track whether we're immediately after a group-start
|
|
21
|
+
// First pass - generate the SQL fragments for each condition
|
|
22
|
+
const fragments = config.where.map((condition, index) => {
|
|
23
|
+
// Handle expression predicates
|
|
24
|
+
if (condition.type === 'expression') {
|
|
25
|
+
const prefix = index === 0 || afterGroupStart ? '' : ` ${condition.conjunction} `;
|
|
26
|
+
afterGroupStart = false;
|
|
27
|
+
return `${prefix}${condition.expression}`.trim();
|
|
28
|
+
}
|
|
29
|
+
// Handle special group markers
|
|
30
|
+
if (condition.type === 'group-start') {
|
|
31
|
+
const prefix = index === 0 ? '' : ` ${condition.conjunction} `;
|
|
32
|
+
afterGroupStart = true; // Mark that the next condition follows a group-start
|
|
33
|
+
return `${prefix}(`.trim();
|
|
34
|
+
}
|
|
35
|
+
if (condition.type === 'group-end') {
|
|
36
|
+
afterGroupStart = false; // Reset the flag after group-end
|
|
37
|
+
return ')';
|
|
38
|
+
}
|
|
39
|
+
// Normal conditions
|
|
40
|
+
const { column, operator, value, conjunction } = condition;
|
|
41
|
+
// Don't add conjunction if it's the first condition or right after a group-start
|
|
42
|
+
const prefix = index === 0 || afterGroupStart ? '' : ` ${conjunction} `;
|
|
43
|
+
// Reset the afterGroupStart flag
|
|
44
|
+
afterGroupStart = false;
|
|
45
|
+
// Handle IN operators
|
|
46
|
+
if (operator === 'in' || operator === 'notIn') {
|
|
47
|
+
if (!Array.isArray(value)) {
|
|
48
|
+
throw new Error(`Expected an array for ${operator} operator, but got ${typeof value}`);
|
|
49
|
+
}
|
|
50
|
+
if (value.length === 0) {
|
|
51
|
+
return `${prefix}1 = 0`;
|
|
52
|
+
}
|
|
53
|
+
const placeholders = value.map(() => '?').join(', ');
|
|
54
|
+
return `${prefix}${column} ${operator === 'in' ? 'IN' : 'NOT IN'} (${placeholders})`.trim();
|
|
55
|
+
}
|
|
56
|
+
// Handle GLOBAL IN operators
|
|
57
|
+
else if (operator === 'globalIn' || operator === 'globalNotIn') {
|
|
58
|
+
if (!Array.isArray(value)) {
|
|
59
|
+
throw new Error(`Expected an array for ${operator} operator, but got ${typeof value}`);
|
|
60
|
+
}
|
|
61
|
+
if (value.length === 0) {
|
|
62
|
+
return `${prefix}1 = 0`;
|
|
63
|
+
}
|
|
64
|
+
const placeholders = value.map(() => '?').join(', ');
|
|
65
|
+
return `${prefix}${column} ${operator === 'globalIn' ? 'GLOBAL IN' : 'GLOBAL NOT IN'} (${placeholders})`.trim();
|
|
66
|
+
}
|
|
67
|
+
// Handle subquery IN operators
|
|
68
|
+
else if (operator === 'inSubquery' || operator === 'globalInSubquery') {
|
|
69
|
+
if (typeof value !== 'string') {
|
|
70
|
+
throw new Error(`Expected a string (subquery) for ${operator} operator, but got ${typeof value}`);
|
|
71
|
+
}
|
|
72
|
+
return `${prefix}${column} ${operator === 'inSubquery' ? 'IN' : 'GLOBAL IN'} (${value})`.trim();
|
|
73
|
+
}
|
|
74
|
+
// Handle table reference IN operators
|
|
75
|
+
else if (operator === 'inTable' || operator === 'globalInTable') {
|
|
76
|
+
if (typeof value !== 'string') {
|
|
77
|
+
throw new Error(`Expected a string (table name) for ${operator} operator, but got ${typeof value}`);
|
|
78
|
+
}
|
|
79
|
+
return `${prefix}${column} ${operator === 'inTable' ? 'IN' : 'GLOBAL IN'} ${value}`.trim();
|
|
80
|
+
}
|
|
81
|
+
// Handle tuple IN operators
|
|
82
|
+
else if (operator === 'inTuple' || operator === 'globalInTuple') {
|
|
83
|
+
if (!Array.isArray(value)) {
|
|
84
|
+
throw new Error(`Expected an array of tuples for ${operator} operator, but got ${typeof value}`);
|
|
85
|
+
}
|
|
86
|
+
if (value.length === 0) {
|
|
87
|
+
return `${prefix}1 = 0`;
|
|
88
|
+
}
|
|
89
|
+
const placeholders = value.map(() => '(?, ?)').join(', ');
|
|
90
|
+
return `${prefix}${column} ${operator === 'inTuple' ? 'IN' : 'GLOBAL IN'} (${placeholders})`.trim();
|
|
91
|
+
}
|
|
92
|
+
else if (operator === 'between') {
|
|
93
|
+
return `${prefix}${column} BETWEEN ? AND ?`.trim();
|
|
94
|
+
}
|
|
95
|
+
else if (operator === 'like') {
|
|
96
|
+
return `${prefix}${column} LIKE ?`.trim();
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return `${prefix}${column} ${this.getSqlOperator(operator)} ?`.trim();
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
// Join fragments and then remove extra spaces around parentheses
|
|
103
|
+
let result = fragments.join(' ');
|
|
104
|
+
// Replace "( " with "(" and " )" with ")"
|
|
105
|
+
result = result.replace(/\(\s+/g, '(').replace(/\s+\)/g, ')');
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
getSqlOperator(operator) {
|
|
109
|
+
switch (operator) {
|
|
110
|
+
case 'eq': return '=';
|
|
111
|
+
case 'neq': return '!=';
|
|
112
|
+
case 'gt': return '>';
|
|
113
|
+
case 'gte': return '>=';
|
|
114
|
+
case 'lt': return '<';
|
|
115
|
+
case 'lte': return '<=';
|
|
116
|
+
case 'like': return 'LIKE';
|
|
117
|
+
default:
|
|
118
|
+
throw new Error(`Unsupported operator: ${operator}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
formatJoins(config) {
|
|
122
|
+
if (!config.joins?.length)
|
|
123
|
+
return '';
|
|
124
|
+
return config.joins.map(join => {
|
|
125
|
+
const tableClause = join.alias
|
|
126
|
+
? `${join.table} AS ${join.alias}`
|
|
127
|
+
: join.table;
|
|
128
|
+
return `${join.type} JOIN ${tableClause} ON ${join.leftColumn} = ${join.rightColumn}`;
|
|
129
|
+
}).join(' ');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { JoinType } from '../types/index.js';
|
|
2
|
+
import { ColumnType } from '../types/schema.js';
|
|
3
|
+
export interface JoinPath<Schema> {
|
|
4
|
+
from: keyof Schema;
|
|
5
|
+
to: keyof Schema;
|
|
6
|
+
leftColumn: string;
|
|
7
|
+
rightColumn: string;
|
|
8
|
+
type?: JoinType;
|
|
9
|
+
alias?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface JoinPathOptions {
|
|
12
|
+
type?: JoinType;
|
|
13
|
+
alias?: string;
|
|
14
|
+
context?: Record<string, any>;
|
|
15
|
+
}
|
|
16
|
+
export declare class JoinRelationships<Schema extends {
|
|
17
|
+
[K in keyof Schema]: {
|
|
18
|
+
[columnName: string]: ColumnType;
|
|
19
|
+
};
|
|
20
|
+
}> {
|
|
21
|
+
private paths;
|
|
22
|
+
/**
|
|
23
|
+
* Define a single join relationship
|
|
24
|
+
*/
|
|
25
|
+
define(name: string, path: JoinPath<Schema>): void;
|
|
26
|
+
/**
|
|
27
|
+
* Define a chain of join relationships
|
|
28
|
+
*/
|
|
29
|
+
defineChain(name: string, paths: JoinPath<Schema>[]): void;
|
|
30
|
+
/**
|
|
31
|
+
* Get a join relationship by name
|
|
32
|
+
*/
|
|
33
|
+
get(name: string): JoinPath<Schema> | JoinPath<Schema>[] | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Check if a join relationship exists
|
|
36
|
+
*/
|
|
37
|
+
has(name: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Remove a join relationship
|
|
40
|
+
*/
|
|
41
|
+
remove(name: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Clear all join relationships
|
|
44
|
+
*/
|
|
45
|
+
clear(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Get all defined relationship names
|
|
48
|
+
*/
|
|
49
|
+
getDefinedRelationships(): string[];
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=join-relationships.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join-relationships.d.ts","sourceRoot":"","sources":["../../src/core/join-relationships.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,WAAW,QAAQ,CAAC,MAAM;IAC9B,IAAI,EAAE,MAAM,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED,qBAAa,iBAAiB,CAAC,MAAM,SAAS;KAAG,CAAC,IAAI,MAAM,MAAM,GAAG;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAAA;KAAE;CAAE;IACzG,OAAO,CAAC,KAAK,CAA4D;IAEzE;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI;IAOlD;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI;IAU1D;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,SAAS;IAIpE;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI7B;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,uBAAuB,IAAI,MAAM,EAAE;CAGpC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export class JoinRelationships {
|
|
2
|
+
paths = new Map();
|
|
3
|
+
/**
|
|
4
|
+
* Define a single join relationship
|
|
5
|
+
*/
|
|
6
|
+
define(name, path) {
|
|
7
|
+
if (this.paths.has(name)) {
|
|
8
|
+
throw new Error(`Join relationship '${name}' is already defined`);
|
|
9
|
+
}
|
|
10
|
+
this.paths.set(name, path);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Define a chain of join relationships
|
|
14
|
+
*/
|
|
15
|
+
defineChain(name, paths) {
|
|
16
|
+
if (this.paths.has(name)) {
|
|
17
|
+
throw new Error(`Join chain '${name}' is already defined`);
|
|
18
|
+
}
|
|
19
|
+
if (paths.length === 0) {
|
|
20
|
+
throw new Error('Join chain must contain at least one path');
|
|
21
|
+
}
|
|
22
|
+
this.paths.set(name, paths);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get a join relationship by name
|
|
26
|
+
*/
|
|
27
|
+
get(name) {
|
|
28
|
+
return this.paths.get(name);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Check if a join relationship exists
|
|
32
|
+
*/
|
|
33
|
+
has(name) {
|
|
34
|
+
return this.paths.has(name);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Remove a join relationship
|
|
38
|
+
*/
|
|
39
|
+
remove(name) {
|
|
40
|
+
return this.paths.delete(name);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Clear all join relationships
|
|
44
|
+
*/
|
|
45
|
+
clear() {
|
|
46
|
+
this.paths.clear();
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get all defined relationship names
|
|
50
|
+
*/
|
|
51
|
+
getDefinedRelationships() {
|
|
52
|
+
return Array.from(this.paths.keys());
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { CrossFilter } from './cross-filter.js';
|
|
2
|
+
import { FilterOperator, OperatorValueMap, OrderDirection, QueryConfig } from '../types/index.js';
|
|
3
|
+
import { AnySchema } from '../types/schema.js';
|
|
4
|
+
import { SQLFormatter } from './formatters/sql-formatter.js';
|
|
5
|
+
import { ExecutorFeature } from './features/executor.js';
|
|
6
|
+
import { JoinRelationships, JoinPathOptions } from './join-relationships.js';
|
|
7
|
+
import { PredicateBuilder, PredicateExpression } from './utils/predicate-builder.js';
|
|
8
|
+
import type { ClickHouseSettings, BaseClickHouseClientConfigOptions } from '@clickhouse/client-common';
|
|
9
|
+
import type { ClickHouseClient as NodeClickHouseClient } from '@clickhouse/client';
|
|
10
|
+
import type { ClickHouseClient as WebClickHouseClient } from '@clickhouse/client-web';
|
|
11
|
+
import type { CacheOptions, CacheConfig } from './cache/types.js';
|
|
12
|
+
import type { QueryRuntimeContext } from './cache/runtime-context.js';
|
|
13
|
+
import type { BuilderState, AnyBuilderState, SchemaDefinition, InitialState, UpdateOutput, WidenTables, AppendToOutput, BaseRow, AddAlias, AddScalar } from './types/builder-state.js';
|
|
14
|
+
import { SelectableItem, SelectableColumn, SelectionResult, ColumnSelectionValue } from './types/select-types.js';
|
|
15
|
+
type WhereColumn<State extends AnyBuilderState> = SelectableColumn<State>;
|
|
16
|
+
type ColumnOperatorValue<Schema extends SchemaDefinition<Schema>, State extends BuilderState<Schema, string, any, keyof Schema, Partial<Record<string, keyof Schema>>>, Column extends WhereColumn<State>, Op extends keyof OperatorValueMap<any, Schema>> = OperatorValueMap<ColumnSelectionValue<State, Column>, Schema>[Op];
|
|
17
|
+
type ClickHouseClient = NodeClickHouseClient | WebClickHouseClient;
|
|
18
|
+
type ScalarAlias<Alias extends string> = Alias extends `${string} ${string}` ? never : Alias;
|
|
19
|
+
export interface ExecuteOptions {
|
|
20
|
+
queryId?: string;
|
|
21
|
+
cache?: CacheOptions | false;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Configuration for client-based connections.
|
|
25
|
+
*/
|
|
26
|
+
export interface ClickHouseClientConfig extends BaseClickHouseClientConfigOptions {
|
|
27
|
+
/** Pre-configured ClickHouse client instance. */
|
|
28
|
+
client: ClickHouseClient;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Configuration options for ClickHouse connections.
|
|
32
|
+
* Either provide a client instance OR connection details, but not both.
|
|
33
|
+
*/
|
|
34
|
+
export type ClickHouseConfig = BaseClickHouseClientConfigOptions | ClickHouseClientConfig;
|
|
35
|
+
/**
|
|
36
|
+
* Type guard to check if a config is a client-based configuration.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isClientConfig(config: ClickHouseConfig): config is ClickHouseClientConfig;
|
|
39
|
+
/**
|
|
40
|
+
* A type-safe query builder for ClickHouse databases.
|
|
41
|
+
* The builder carries a single state object that encodes scope, output, and schema metadata.
|
|
42
|
+
*/
|
|
43
|
+
export declare class QueryBuilder<Schema extends SchemaDefinition<Schema>, State extends BuilderState<Schema, string, any, keyof Schema, Partial<Record<string, keyof Schema>>>> {
|
|
44
|
+
private static relationships;
|
|
45
|
+
private config;
|
|
46
|
+
private tableName;
|
|
47
|
+
private state;
|
|
48
|
+
private formatter;
|
|
49
|
+
private aggregations;
|
|
50
|
+
private joins;
|
|
51
|
+
private filtering;
|
|
52
|
+
private analytics;
|
|
53
|
+
private executor;
|
|
54
|
+
private modifiers;
|
|
55
|
+
private crossFiltering;
|
|
56
|
+
private runtime;
|
|
57
|
+
private cacheOptions?;
|
|
58
|
+
constructor(tableName: string, state: State, runtime: QueryRuntimeContext);
|
|
59
|
+
private fork;
|
|
60
|
+
debug(): this;
|
|
61
|
+
cache(options: CacheOptions | false): this;
|
|
62
|
+
withCTE(alias: string, subquery: QueryBuilder<any, AnyBuilderState> | string): this;
|
|
63
|
+
withScalar<Alias extends string, TValue>(alias: ScalarAlias<Alias>, expressionBuilder: (expr: PredicateBuilder<State>) => PredicateExpression<TValue>): QueryBuilder<Schema, AddScalar<State, Alias, TValue>>;
|
|
64
|
+
/**
|
|
65
|
+
* Groups results by a time interval using a specified ClickHouse function.
|
|
66
|
+
*
|
|
67
|
+
* @param column - The column containing the date or timestamp.
|
|
68
|
+
* @param interval - The interval value. For example, "1 day" or "15 minute".
|
|
69
|
+
* This is only used when the method is 'toStartOfInterval'.
|
|
70
|
+
* @param method - The time bucketing function to use.
|
|
71
|
+
* Defaults to 'toStartOfInterval'.
|
|
72
|
+
* Other valid values include 'toStartOfMinute', 'toStartOfHour',
|
|
73
|
+
* 'toStartOfDay', 'toStartOfWeek', 'toStartOfMonth', 'toStartOfQuarter', and 'toStartOfYear'.
|
|
74
|
+
* @returns The current QueryBuilder instance.
|
|
75
|
+
*/
|
|
76
|
+
groupByTimeInterval(column: SelectableColumn<State>, interval: string, method?: 'toStartOfInterval' | 'toStartOfMinute' | 'toStartOfHour' | 'toStartOfDay' | 'toStartOfWeek' | 'toStartOfMonth' | 'toStartOfQuarter' | 'toStartOfYear'): this;
|
|
77
|
+
raw(sql: string): this;
|
|
78
|
+
settings(opts: ClickHouseSettings): this;
|
|
79
|
+
/**
|
|
80
|
+
* Applies a set of cross filters to the current query.
|
|
81
|
+
* All filter conditions from the provided CrossFilter are added to the query.
|
|
82
|
+
* @param crossFilter - An instance of CrossFilter containing shared filter conditions.
|
|
83
|
+
* @returns The current QueryBuilder instance.
|
|
84
|
+
*/
|
|
85
|
+
applyCrossFilters<TableName extends Extract<keyof Schema, string>>(crossFilter: CrossFilter<Schema, TableName>): this;
|
|
86
|
+
applyCrossFilters(crossFilter: CrossFilter<AnySchema, string>): this;
|
|
87
|
+
/**
|
|
88
|
+
* Selects specific columns from the table.
|
|
89
|
+
* @template K - The keys/columns to select
|
|
90
|
+
* @param {K[] | '*'} columnsOrAsterisk - Array of column names to select or '*' for all columns
|
|
91
|
+
* @returns {QueryBuilder} A new QueryBuilder instance with updated types
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* builder.select(['id', 'name'])
|
|
95
|
+
* builder.select('*')
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
select(columnsOrAsterisk: '*'): QueryBuilder<Schema, UpdateOutput<State, BaseRow<State>>>;
|
|
99
|
+
select<Selections extends ReadonlyArray<SelectableItem<State>>>(columnsOrAsterisk: Selections): QueryBuilder<Schema, UpdateOutput<State, SelectionResult<State, Selections[number]>>>;
|
|
100
|
+
selectConst<Selections extends ReadonlyArray<SelectableItem<State>>>(...columns: Selections): QueryBuilder<Schema, UpdateOutput<State, SelectionResult<State, Selections[number]>>>;
|
|
101
|
+
sum<Column extends keyof BaseRow<State>, Alias extends string = `${Column & string}_sum`>(column: Column, alias?: Alias): QueryBuilder<Schema, AppendToOutput<State, Record<Alias, string>>>;
|
|
102
|
+
count<Column extends keyof BaseRow<State>, Alias extends string = `${Column & string}_count`>(column: Column, alias?: Alias): QueryBuilder<Schema, AppendToOutput<State, Record<Alias, string>>>;
|
|
103
|
+
avg<Column extends keyof BaseRow<State>, Alias extends string = `${Column & string}_avg`>(column: Column, alias?: Alias): QueryBuilder<Schema, AppendToOutput<State, Record<Alias, string>>>;
|
|
104
|
+
min<Column extends keyof BaseRow<State>, Alias extends string = `${Column & string}_min`>(column: Column, alias?: Alias): QueryBuilder<Schema, AppendToOutput<State, Record<Alias, string>>>;
|
|
105
|
+
max<Column extends keyof BaseRow<State>, Alias extends string = `${Column & string}_max`>(column: Column, alias?: Alias): QueryBuilder<Schema, AppendToOutput<State, Record<Alias, string>>>;
|
|
106
|
+
private applyAggregation;
|
|
107
|
+
getTableName(): string;
|
|
108
|
+
getFormatter(): SQLFormatter;
|
|
109
|
+
getRuntimeContext(): QueryRuntimeContext;
|
|
110
|
+
getCacheOptions(): CacheOptions | undefined;
|
|
111
|
+
getExecutor(): ExecutorFeature<Schema, State>;
|
|
112
|
+
toSQL(): string;
|
|
113
|
+
toSQLWithParams(): {
|
|
114
|
+
sql: string;
|
|
115
|
+
parameters: any[];
|
|
116
|
+
};
|
|
117
|
+
execute(options?: ExecuteOptions): Promise<State['output'][]>;
|
|
118
|
+
stream(): Promise<ReadableStream<State['output'][]>>;
|
|
119
|
+
/**
|
|
120
|
+
* Processes each row in a stream with the provided callback function
|
|
121
|
+
* @param callback Function to call for each row in the stream
|
|
122
|
+
*/
|
|
123
|
+
streamForEach<R = void>(callback: (row: State['output']) => R | Promise<R>): Promise<void>;
|
|
124
|
+
private validateFilterValue;
|
|
125
|
+
/**
|
|
126
|
+
* Adds a WHERE clause to filter results.
|
|
127
|
+
* @template K - The column key type
|
|
128
|
+
* @param {K} column - The column to filter on
|
|
129
|
+
* @param {FilterOperator} operator - The comparison operator
|
|
130
|
+
* @param {any} value - The value to compare against
|
|
131
|
+
* @returns {this} The current QueryBuilder instance
|
|
132
|
+
* @example
|
|
133
|
+
* ```ts
|
|
134
|
+
* builder.where('age', 'gt', 18)
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
where(expressionBuilder: (expr: PredicateBuilder<State>) => PredicateExpression): this;
|
|
138
|
+
where<Column extends WhereColumn<State>, Op extends keyof OperatorValueMap<any, Schema>>(columnOrColumns: Column | Column[], operator: Op, value: ColumnOperatorValue<Schema, State, Column, Op>): this;
|
|
139
|
+
/**
|
|
140
|
+
* Adds a WHERE clause for tuple IN operations.
|
|
141
|
+
* @template K - The column keys type
|
|
142
|
+
* @param {K[]} columns - The columns to filter on (for tuple operations)
|
|
143
|
+
* @param {'inTuple' | 'globalInTuple'} operator - The tuple IN operator
|
|
144
|
+
* @param {any} value - The array of tuples to compare against
|
|
145
|
+
* @returns {this} The current QueryBuilder instance
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* builder.where(['counter_id', 'user_id'], 'inTuple', [[34, 123], [101500, 456]])
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
where<Column extends WhereColumn<State>>(columns: Column[], operator: 'inTuple' | 'globalInTuple', value: any): this;
|
|
152
|
+
orWhere(expressionBuilder: (expr: PredicateBuilder<State>) => PredicateExpression): this;
|
|
153
|
+
orWhere<Column extends WhereColumn<State>>(column: Column, operator: FilterOperator, value: any): this;
|
|
154
|
+
orWhere<Column extends WhereColumn<State>>(columns: Column[], operator: 'inTuple' | 'globalInTuple', value: any): this;
|
|
155
|
+
/**
|
|
156
|
+
* Creates a parenthesized group of WHERE conditions joined with AND/OR operators.
|
|
157
|
+
* @param {Function} callback - Function that builds the conditions within the group
|
|
158
|
+
* @returns {this} The current QueryBuilder instance
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* builder.whereGroup(qb => {
|
|
162
|
+
* qb.where('status', 'eq', 'active').orWhere('status', 'eq', 'pending');
|
|
163
|
+
* })
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
whereGroup(callback: (builder: this) => void): this;
|
|
167
|
+
/**
|
|
168
|
+
* Creates a parenthesized group of WHERE conditions joined with OR operator.
|
|
169
|
+
* @param {Function} callback - Function that builds the conditions within the group
|
|
170
|
+
* @returns {this} The current QueryBuilder instance
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* builder.orWhereGroup(qb => {
|
|
174
|
+
* qb.where('status', 'eq', 'active').orWhere('status', 'eq', 'pending');
|
|
175
|
+
* })
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
orWhereGroup(callback: (builder: this) => void): this;
|
|
179
|
+
/**
|
|
180
|
+
* Adds a GROUP BY clause.
|
|
181
|
+
* @param {keyof T | Array<keyof T>} columns - Column(s) to group by
|
|
182
|
+
* @returns {this} The current QueryBuilder instance
|
|
183
|
+
* @example
|
|
184
|
+
* ```ts
|
|
185
|
+
* builder.groupBy(['category', 'status'])
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
groupBy(columns: SelectableColumn<State> | Array<SelectableColumn<State>>): this;
|
|
189
|
+
limit(count: number): this;
|
|
190
|
+
offset(count: number): this;
|
|
191
|
+
/**
|
|
192
|
+
* Adds an ORDER BY clause.
|
|
193
|
+
* @param {keyof T} column - The column to order by
|
|
194
|
+
* @param {OrderDirection} [direction='ASC'] - The sort direction
|
|
195
|
+
* @returns {this} The current QueryBuilder instance
|
|
196
|
+
* @example
|
|
197
|
+
* ```ts
|
|
198
|
+
* builder.orderBy('created_at', 'DESC')
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
orderBy(column: SelectableColumn<State>, direction?: OrderDirection): this;
|
|
202
|
+
/**
|
|
203
|
+
* Adds a HAVING clause for filtering grouped results.
|
|
204
|
+
* @param {string} condition - The HAVING condition
|
|
205
|
+
* @returns {this} The current QueryBuilder instance
|
|
206
|
+
* @example
|
|
207
|
+
* ```ts
|
|
208
|
+
* builder.having('COUNT(*) > 5')
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
having(condition: string, parameters?: any[]): this;
|
|
212
|
+
distinct(): this;
|
|
213
|
+
whereBetween<Column extends keyof BaseRow<State>>(column: Column, [min, max]: [BaseRow<State>[Column], BaseRow<State>[Column]]): this;
|
|
214
|
+
innerJoin<TableName extends Extract<keyof Schema, string>, Alias extends string | undefined = undefined>(table: TableName, leftColumn: keyof BaseRow<State>, rightColumn: `${TableName & string}.${keyof Schema[TableName] & string}`, alias?: Alias): QueryBuilder<Schema, Alias extends string ? AddAlias<WidenTables<State, TableName>, Alias, TableName> : WidenTables<State, TableName>>;
|
|
215
|
+
leftJoin<TableName extends Extract<keyof Schema, string>, Alias extends string | undefined = undefined>(table: TableName, leftColumn: keyof BaseRow<State>, rightColumn: `${TableName & string}.${keyof Schema[TableName] & string}`, alias?: Alias): QueryBuilder<Schema, Alias extends string ? AddAlias<WidenTables<State, TableName>, Alias, TableName> : WidenTables<State, TableName>>;
|
|
216
|
+
rightJoin<TableName extends Extract<keyof Schema, string>, Alias extends string | undefined = undefined>(table: TableName, leftColumn: keyof BaseRow<State>, rightColumn: `${TableName & string}.${keyof Schema[TableName] & string}`, alias?: Alias): QueryBuilder<Schema, Alias extends string ? AddAlias<WidenTables<State, TableName>, Alias, TableName> : WidenTables<State, TableName>>;
|
|
217
|
+
fullJoin<TableName extends Extract<keyof Schema, string>, Alias extends string | undefined = undefined>(table: TableName, leftColumn: keyof BaseRow<State>, rightColumn: `${TableName & string}.${keyof Schema[TableName] & string}`, alias?: Alias): QueryBuilder<Schema, Alias extends string ? AddAlias<WidenTables<State, TableName>, Alias, TableName> : WidenTables<State, TableName>>;
|
|
218
|
+
private applyJoin;
|
|
219
|
+
getConfig(): QueryConfig<State["output"], Schema>;
|
|
220
|
+
static setJoinRelationships<S extends SchemaDefinition<S>>(relationships: JoinRelationships<S>): void;
|
|
221
|
+
/**
|
|
222
|
+
* Apply a predefined join relationship
|
|
223
|
+
*/
|
|
224
|
+
withRelation(name: string, options?: JoinPathOptions): this;
|
|
225
|
+
}
|
|
226
|
+
export type SelectQB<Schema extends SchemaDefinition<Schema>, Tables extends string, Output, BaseTable extends keyof Schema> = QueryBuilder<Schema, BuilderState<Schema, Tables, Output, BaseTable, {}>>;
|
|
227
|
+
export type CreateQueryBuilderConfig = ClickHouseConfig & {
|
|
228
|
+
cache?: CacheConfig;
|
|
229
|
+
};
|
|
230
|
+
export declare function createQueryBuilder<Schema extends SchemaDefinition<Schema>>(config: CreateQueryBuilderConfig): {
|
|
231
|
+
cache: import("./cache/controller.js").CacheController;
|
|
232
|
+
rawQuery<TResult = any>(sql: string, params?: unknown[]): Promise<TResult[][]>;
|
|
233
|
+
table<TableName extends Extract<keyof Schema, string>>(tableName: TableName): SelectQB<Schema, TableName, InitialState<Schema, TableName>["output"], TableName>;
|
|
234
|
+
};
|
|
235
|
+
export {};
|
|
236
|
+
//# sourceMappingURL=query-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-builder.d.ts","sourceRoot":"","sources":["../../src/core/query-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAK7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAiB,MAAM,yBAAyB,CAAC;AAE5F,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EAEpB,MAAM,8BAA8B,CAAC;AAEtC,OAAO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