@hypequery/clickhouse 1.2.1 → 1.2.2-beta.1
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 +253 -0
- package/dist/core/connection.d.ts.map +1 -1
- package/dist/core/query-builder.d.ts +0 -4
- package/dist/core/query-builder.d.ts.map +1 -1
- package/dist/core/query-builder.js +0 -6
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/package.json +2 -5
package/README.md
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>@hypequery/clickhouse</h1>
|
|
3
|
+
<p>A typescript-first library for building type-safe dashboards with ClickHouse</p>
|
|
4
|
+
|
|
5
|
+
[](https://github.com/hypequery/hypequery/blob/main/LICENSE)
|
|
6
|
+
[](https://badge.fury.io/js/@hypequery%2Fclickhouse)
|
|
7
|
+
[](https://github.com/hypequery/hypequery/stargazers)
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
hypequery is a typescript-first query builder for ClickHouse designed specifically for building type-safe analytics dashboards. Unlike generic SQL query builders, hypequery understands your ClickHouse schema and provides full type checking, making it ideal for data-intensive applications.
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- 🎯 **Type-Safe**: Full TypeScript support with types from your ClickHouse schema
|
|
18
|
+
- 🚀 **Performant**: Built for real-time analytics with optimized query generation
|
|
19
|
+
- 🔍 **Cross Filtering**: Powerful cross-filtering capabilities for interactive dashboards
|
|
20
|
+
- 🛠️ **Developer Friendly**: Fluent API design for an intuitive development experience
|
|
21
|
+
- 📱 **Platform Agnostic**: Works in both Node.js and browser environments
|
|
22
|
+
- 🔄 **Schema Generation**: CLI tool to generate TypeScript types from your ClickHouse schema
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
This library requires one of the following ClickHouse clients as a peer dependency:
|
|
27
|
+
|
|
28
|
+
### For Node.js environments
|
|
29
|
+
```bash
|
|
30
|
+
npm install @hypequery/clickhouse
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### For browser/universal environments
|
|
34
|
+
```bash
|
|
35
|
+
npm install @hypequery/clickhouse @clickhouse/client-web
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Note**: The library supports multiple client selection strategies:
|
|
39
|
+
- **Manual injection**: Explicitly provide a client instance (required for browser environments)
|
|
40
|
+
- **Auto-detection**: Automatically selects the client for Node.js environments
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
### Node.js Environments
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { createQueryBuilder } from '@hypequery/clickhouse';
|
|
48
|
+
import type { IntrospectedSchema } from './generated-schema';
|
|
49
|
+
|
|
50
|
+
// Initialize the query builder
|
|
51
|
+
const db = createQueryBuilder<IntrospectedSchema>({
|
|
52
|
+
host: 'your-clickhouse-host',
|
|
53
|
+
username: 'default',
|
|
54
|
+
password: 'your-password',
|
|
55
|
+
database: 'default'
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Build and execute a query
|
|
59
|
+
const results = await db
|
|
60
|
+
.table('trips')
|
|
61
|
+
.select(['pickup_datetime', 'dropoff_datetime', 'total_amount'])
|
|
62
|
+
.where('total_amount', '>', 50)
|
|
63
|
+
.orderBy('pickup_datetime', 'DESC')
|
|
64
|
+
.limit(10)
|
|
65
|
+
.execute();
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Browser Environments
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { createQueryBuilder } from '@hypequery/clickhouse';
|
|
72
|
+
import { createClient } from '@clickhouse/client-web';
|
|
73
|
+
import type { IntrospectedSchema } from './generated-schema';
|
|
74
|
+
|
|
75
|
+
// Create the ClickHouse client explicitly
|
|
76
|
+
const client = createClient({
|
|
77
|
+
host: 'your-clickhouse-host',
|
|
78
|
+
username: 'default',
|
|
79
|
+
password: '',
|
|
80
|
+
database: 'default'
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// Initialize the query builder with the client
|
|
84
|
+
const db = createQueryBuilder<IntrospectedSchema>({
|
|
85
|
+
client // Explicitly provide the client
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// Build and execute a query
|
|
89
|
+
const results = await db
|
|
90
|
+
.table('trips')
|
|
91
|
+
.select(['pickup_datetime', 'dropoff_datetime', 'total_amount'])
|
|
92
|
+
.where('total_amount', '>', 50)
|
|
93
|
+
.orderBy('pickup_datetime', 'DESC')
|
|
94
|
+
.limit(10)
|
|
95
|
+
.execute();
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Schema Generation
|
|
99
|
+
|
|
100
|
+
hypequery provides a CLI tool to generate TypeScript types from your ClickHouse schema:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Install globally (optional)
|
|
104
|
+
npm install -g @hypequery/clickhouse
|
|
105
|
+
|
|
106
|
+
# Generate schema types
|
|
107
|
+
npx hypequery-generate-types --host your-clickhouse-host --database your-database
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
This creates a `generated-schema.ts` file that you can import in your application:
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
import { createQueryBuilder } from '@hypequery/clickhouse';
|
|
114
|
+
import type { IntrospectedSchema } from './generated-schema';
|
|
115
|
+
|
|
116
|
+
const db = createQueryBuilder<IntrospectedSchema>({
|
|
117
|
+
// connection details
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Core Features
|
|
122
|
+
|
|
123
|
+
### Type-Safe Queries
|
|
124
|
+
|
|
125
|
+
hypequery provides full TypeScript support, ensuring your queries are type-safe:
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
// Column names are type-checked
|
|
129
|
+
const query = db.table('trips')
|
|
130
|
+
.select(['pickup_datetime', 'total_amount'])
|
|
131
|
+
.where('total_amount', 'gt', 50)
|
|
132
|
+
.execute();
|
|
133
|
+
|
|
134
|
+
// Type error if column doesn't exist
|
|
135
|
+
db.table('trips').select(['non_existent_column']); // TypeScript error
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Cross Filtering
|
|
139
|
+
|
|
140
|
+
Implement interactive dashboards with cross-filtering support:
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import { CrossFilter } from '@hypequery/clickhouse';
|
|
144
|
+
|
|
145
|
+
// Create a filter
|
|
146
|
+
const filter = new CrossFilter()
|
|
147
|
+
.add({
|
|
148
|
+
column: 'pickup_datetime',
|
|
149
|
+
operator: 'gte',
|
|
150
|
+
value: '2024-01-01'
|
|
151
|
+
})
|
|
152
|
+
.add({
|
|
153
|
+
column: 'total_amount',
|
|
154
|
+
operator: 'gt',
|
|
155
|
+
value: 20
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// Apply to multiple queries
|
|
159
|
+
const query1 = db.table('trips')
|
|
160
|
+
.applyCrossFilters(filter)
|
|
161
|
+
.execute();
|
|
162
|
+
|
|
163
|
+
const query2 = db.table('drivers')
|
|
164
|
+
.applyCrossFilters(filter)
|
|
165
|
+
.execute();
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Advanced Queries
|
|
169
|
+
|
|
170
|
+
hypequery supports complex queries including joins, aggregations, and subqueries:
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
// Aggregations
|
|
174
|
+
const stats = await db.table('trips')
|
|
175
|
+
.avg('total_amount')
|
|
176
|
+
.max('trip_distance')
|
|
177
|
+
.count('trip_id')
|
|
178
|
+
.where('pickup_datetime', 'gte', '2024-01-01')
|
|
179
|
+
.execute();
|
|
180
|
+
|
|
181
|
+
// Joins
|
|
182
|
+
const tripsWithDrivers = await db.table('trips')
|
|
183
|
+
.select(['trips.trip_id', 'trips.total_amount', 'drivers.name'])
|
|
184
|
+
.join('drivers', 'trips.driver_id', 'drivers.id')
|
|
185
|
+
.execute();
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
**Benefits:**
|
|
191
|
+
- ✅ Works in all environments (Node.js, browser, bundlers)
|
|
192
|
+
- ✅ Explicit control over client configuration
|
|
193
|
+
- ✅ Required for browser environments (require() doesn't work in browsers)
|
|
194
|
+
- ✅ Synchronous API throughout
|
|
195
|
+
|
|
196
|
+
#### 2. Auto-Detection with Fallback (Node.js Environments Only)
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
const db = createQueryBuilder<IntrospectedSchema>({
|
|
200
|
+
host: 'your-clickhouse-host',
|
|
201
|
+
username: 'default',
|
|
202
|
+
password: '',
|
|
203
|
+
database: 'default'
|
|
204
|
+
});
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
## Versioning and Release Channels
|
|
209
|
+
|
|
210
|
+
hypequery follows semantic versioning and provides multiple release channels:
|
|
211
|
+
|
|
212
|
+
- **Latest**: Stable releases (`npm install @hypequery/clickhouse`)
|
|
213
|
+
- **Beta**: Pre-release versions (`npm install @hypequery/clickhouse@beta`)
|
|
214
|
+
|
|
215
|
+
## Documentation
|
|
216
|
+
|
|
217
|
+
For detailed documentation and examples, visit our [documentation site](https://hypequery.com/docs).
|
|
218
|
+
|
|
219
|
+
- [Getting Started](https://hypequery.com/docs/installation)
|
|
220
|
+
- [Query Building](https://hypequery.com/docs/guides/query-building)
|
|
221
|
+
- [Filtering](https://hypequery.com/docs/guides/filtering)
|
|
222
|
+
- [Pagination](https://hypequery.com/docs/features/pagination)
|
|
223
|
+
- [API Reference](https://hypequery.com/docs/reference/api)
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## Troubleshooting
|
|
227
|
+
|
|
228
|
+
### Common Issues
|
|
229
|
+
|
|
230
|
+
- **Connection Errors**: Ensure your ClickHouse server is running and accessible
|
|
231
|
+
- **CORS Issues**: Use a proxy server for browser environments
|
|
232
|
+
- **Type Errors**: Make sure to regenerate your schema types after schema changes
|
|
233
|
+
- **Client Not Found**: Make sure you have installed at least one of the required peer dependencies:
|
|
234
|
+
- `@clickhouse/client` (for Node.js environments)
|
|
235
|
+
- `@clickhouse/client-web` (for browser/universal environments)
|
|
236
|
+
- **Browser Auto-Detection**: Auto-detection doesn't work in browsers because `require()` calls don't work. Use manual injection instead.
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
## License
|
|
240
|
+
|
|
241
|
+
This project is licensed under the Apache-2.0 License - see the [LICENSE](LICENSE) file for details.
|
|
242
|
+
|
|
243
|
+
## Support
|
|
244
|
+
|
|
245
|
+
- 📚 [Documentation](https://hypequery.com/docs)
|
|
246
|
+
- 🐛 [Issue Tracker](https://github.com/hypequery/hypequery/issues)
|
|
247
|
+
- 💬 [Discussions](https://github.com/hypequery/hypequery/discussions)
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
<div align="center">
|
|
252
|
+
<sub>Built with ❤️ by the hypequery team</sub>
|
|
253
|
+
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/core/connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,KAAK,EAAE,gBAAgB,IAAI,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/core/connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,KAAK,EAAE,gBAAgB,IAAI,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIxD,KAAK,gBAAgB,GAAG,oBAAoB,GAAG,mBAAmB,CAAC;AA+CnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAiC;IACxD,OAAO,CAAC,MAAM,CAAC,YAAY,CAAuC;IAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,oBAAoB;IAaxE;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,SAAS,IAAI,gBAAgB;IAOpC;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,IAAI,kBAAkB;CAGnD"}
|
|
@@ -26,10 +26,6 @@ export interface ClickHouseClientConfig extends BaseClickHouseClientConfigOption
|
|
|
26
26
|
* Either provide a client instance OR connection details, but not both.
|
|
27
27
|
*/
|
|
28
28
|
export type ClickHouseConfig = ClickHouseHostConfig | ClickHouseClientConfig;
|
|
29
|
-
/**
|
|
30
|
-
* Type guard to check if a config is a host-based configuration.
|
|
31
|
-
*/
|
|
32
|
-
export declare function isHostConfig(config: ClickHouseConfig): config is ClickHouseHostConfig;
|
|
33
29
|
/**
|
|
34
30
|
* Type guard to check if a config is a client-based configuration.
|
|
35
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-builder.d.ts","sourceRoot":"","sources":["../../src/core/query-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,UAAU,EACV,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,eAAe,EAChB,MAAM,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,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI;CA4B5D;AAED,wBAAgB,kBAAkB,CAAC,MAAM,SAAS;KAC/C,CAAC,IAAI,MAAM,MAAM,GAAG;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAAA;KAAE;CAC1D,EACC,MAAM,EAAE,gBAAgB;UAKhB,SAAS,SAAS,MAAM,MAAM,aAAa,SAAS,GAAG,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;EAWlH"}
|
|
@@ -9,12 +9,6 @@ import { QueryModifiersFeature } from './features/query-modifiers.js';
|
|
|
9
9
|
import { FilterValidator } from './validators/filter-validator.js';
|
|
10
10
|
import { PaginationFeature } from './features/pagination.js';
|
|
11
11
|
import { CrossFilteringFeature } from './features/cross-filtering.js';
|
|
12
|
-
/**
|
|
13
|
-
* Type guard to check if a config is a host-based configuration.
|
|
14
|
-
*/
|
|
15
|
-
export function isHostConfig(config) {
|
|
16
|
-
return 'host' in config && !('client' in config);
|
|
17
|
-
}
|
|
18
12
|
/**
|
|
19
13
|
* Type guard to check if a config is a client-based configuration.
|
|
20
14
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { createQueryBuilder, QueryBuilder } from './core/query-builder
|
|
2
|
-
export { ClickHouseConnection } from './core/connection
|
|
3
|
-
export { JoinRelationships } from './core/join-relationships
|
|
4
|
-
export type { ClickHouseConfig, ClickHouseHostConfig, ClickHouseClientConfig } from './core/query-builder
|
|
5
|
-
export {
|
|
1
|
+
export { createQueryBuilder, QueryBuilder } from './core/query-builder';
|
|
2
|
+
export { ClickHouseConnection } from './core/connection';
|
|
3
|
+
export { JoinRelationships } from './core/join-relationships';
|
|
4
|
+
export type { ClickHouseConfig, ClickHouseHostConfig, ClickHouseClientConfig } from './core/query-builder';
|
|
5
|
+
export { isClientConfig } from './core/query-builder';
|
|
6
6
|
export type { TableSchema, QueryConfig, ColumnType, WhereExpression, GroupByExpression, TableRecord, DatabaseSchema, PaginatedResult, PageInfo, PaginationOptions } from './types/base';
|
|
7
|
-
export type { JoinPath, JoinPathOptions } from './core/join-relationships
|
|
8
|
-
export { CrossFilter } from './core/cross-filter
|
|
9
|
-
export { logger } from './core/utils/logger
|
|
10
|
-
export { raw, rawAs, toDateTime, formatDateTime, toStartOfInterval, datePart, FormatDateTimeOptions } from './core/utils/sql-expressions
|
|
11
|
-
export type { SqlExpression, AliasedExpression } from './core/utils/sql-expressions
|
|
7
|
+
export type { JoinPath, JoinPathOptions } from './core/join-relationships';
|
|
8
|
+
export { CrossFilter } from './core/cross-filter';
|
|
9
|
+
export { logger } from './core/utils/logger';
|
|
10
|
+
export { raw, rawAs, toDateTime, formatDateTime, toStartOfInterval, datePart, FormatDateTimeOptions } from './core/utils/sql-expressions';
|
|
11
|
+
export type { SqlExpression, AliasedExpression } from './core/utils/sql-expressions';
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
13
13
|
|
|
14
14
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,eAAe,EACf,QAAQ,EACR,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,GAAG,EACH,KAAK,EACL,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,QAAQ,EACR,qBAAqB,EACtB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,aAAa,EACb,iBAAiB,EAClB,MAAM,8BAA8B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hypequery/clickhouse",
|
|
3
|
-
"version": "1.2.1",
|
|
3
|
+
"version": "1.2.2-beta.1",
|
|
4
4
|
"description": "ClickHouse typescript query builder",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,16 +36,13 @@
|
|
|
36
36
|
"README-CLI.md"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"@clickhouse/client": "^1.11.2",
|
|
39
40
|
"dotenv": "^16.0.0"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
|
-
"@clickhouse/client": "^0.2.0 || ^1.0.0",
|
|
43
43
|
"@clickhouse/client-web": "^0.2.0 || ^1.0.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
|
-
"@clickhouse/client": {
|
|
47
|
-
"optional": true
|
|
48
|
-
},
|
|
49
46
|
"@clickhouse/client-web": {
|
|
50
47
|
"optional": true
|
|
51
48
|
}
|