@hypequery/clickhouse 1.0.1 → 1.0.3

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-CLI.md CHANGED
@@ -1,4 +1,4 @@
1
- # HypeQuery TypeScript Generator
1
+ # hypequery TypeScript Generator
2
2
 
3
3
  This tool automatically generates TypeScript type definitions from your ClickHouse database schema.
4
4
 
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # HypeQuery
1
+ # hypequery
2
2
 
3
3
  <div align="center">
4
- <img src="https://hypequery.dev/img/logo.svg" alt="HypeQuery Logo" width="200"/>
4
+ <img src="https://hypequery.dev/img/logo.svg" alt="hypequery Logo" width="200"/>
5
5
  <h1>@hypequery/clickhouse</h1>
6
6
  <p>A typescript-first library for building type-safe dashboards with ClickHouse</p>
7
7
 
@@ -10,11 +10,10 @@
10
10
  [![GitHub stars](https://img.shields.io/github/stars/lukejreilly/hypequery)](https://github.com/lukejreilly/hypequery/stargazers)
11
11
  </div>
12
12
 
13
- > **Note:** This package is published on npm as `@hypequery/core`. The unscoped package `hypequery-core` is unrelated and should not be used.
14
13
 
15
14
  ## Overview
16
15
 
17
- hypequery is a typescript-first query builder for ClickHouse designed specifically for building real-time, type-safe analytics dashboards. Unlike generic SQL query builders, HypeQuery understands your ClickHouse schema and provides full type checking throughout your codebase, making it ideal for data-intensive applications.
16
+ hypequery is a typescript-first query builder for ClickHouse designed specifically for building real-time, type-safe analytics dashboards. Unlike generic SQL query builders, hypequery understands your ClickHouse schema and provides full type checking throughout your codebase, making it ideal for data-intensive applications.
18
17
 
19
18
  ## Features
20
19
 
@@ -28,21 +27,25 @@ hypequery is a typescript-first query builder for ClickHouse designed specifical
28
27
 
29
28
  ## Installation
30
29
 
30
+ ### npm
31
31
  ```bash
32
- # npm
33
- npm install @hypequery/core
32
+ npm install @hypequery/clickhouse
33
+ ```
34
34
 
35
- # yarn
36
- yarn add @hypequery/core
35
+ ### yarn
36
+ ```bash
37
+ yarn add @hypequery/clickhouse
38
+ ```
37
39
 
38
- # pnpm
39
- pnpm add @hypequery/core
40
+ ### pnpm
41
+ ```bash
42
+ pnpm add @hypequery/clickhouse
40
43
  ```
41
44
 
42
45
  ## Quick Start
43
46
 
44
47
  ```typescript
45
- import { createQueryBuilder } from '@hypequery/core';
48
+ import { createQueryBuilder } from '@hypequery/clickhouse';
46
49
  import type { Schema } from './generated-schema';
47
50
 
48
51
  // Initialize the query builder
@@ -65,11 +68,11 @@ const results = await db
65
68
 
66
69
  ## Schema Generation
67
70
 
68
- HypeQuery provides a CLI tool to generate TypeScript types from your ClickHouse schema:
71
+ hypequery provides a CLI tool to generate TypeScript types from your ClickHouse schema:
69
72
 
70
73
  ```bash
71
74
  # Install globally (optional)
72
- npm install -g @hypequery/core
75
+ npm install -g @hypequery/clickhouse
73
76
 
74
77
  # Generate schema types
75
78
  npx hypequery-generate --host your-clickhouse-host --database your-database
@@ -78,7 +81,7 @@ npx hypequery-generate --host your-clickhouse-host --database your-database
78
81
  This creates a `generated-schema.ts` file that you can import in your application:
79
82
 
80
83
  ```typescript
81
- import { createQueryBuilder } from '@hypequery/core';
84
+ import { createQueryBuilder } from '@hypequery/clickhouse';
82
85
  import type { IntrospectedSchema } from './generated-schema';
83
86
 
84
87
  const db = createQueryBuilder<IntrospectedSchema>({
@@ -90,7 +93,7 @@ const db = createQueryBuilder<IntrospectedSchema>({
90
93
 
91
94
  ### Type-Safe Queries
92
95
 
93
- HypeQuery provides full TypeScript support, ensuring your queries are type-safe:
96
+ hypequery provides full TypeScript support, ensuring your queries are type-safe:
94
97
 
95
98
  ```typescript
96
99
  // Column names are type-checked
@@ -108,7 +111,7 @@ db.table('trips').select(['non_existent_column']); // TypeScript error
108
111
  Implement interactive dashboards with cross-filtering support:
109
112
 
110
113
  ```typescript
111
- import { CrossFilter } from '@hypequery/core';
114
+ import { CrossFilter } from '@hypequery/clickhouse';
112
115
 
113
116
  // Create a filter
114
117
  const filter = new CrossFilter()
@@ -167,7 +170,7 @@ const prevPage = await db.table('trips')
167
170
 
168
171
  ### Advanced Queries
169
172
 
170
- HypeQuery supports complex queries including joins, aggregations, and subqueries:
173
+ hypequery supports complex queries including joins, aggregations, and subqueries:
171
174
 
172
175
  ```typescript
173
176
  // Aggregations
@@ -224,10 +227,10 @@ const db = createQueryBuilder<Schema>({
224
227
 
225
228
  ## Versioning and Release Channels
226
229
 
227
- HypeQuery follows semantic versioning and provides multiple release channels:
230
+ hypequery follows semantic versioning and provides multiple release channels:
228
231
 
229
- - **Latest**: Stable releases (`npm install @hypequery/core`)
230
- - **Beta**: Pre-release versions (`npm install @hypequery/core@beta`)
232
+ - **Latest**: Stable releases (`npm install @hypequery/clickhouse`)
233
+ - **Beta**: Pre-release versions (`npm install @hypequery/clickhouse@beta`)
231
234
 
232
235
  ## Documentation
233
236
 
@@ -243,8 +246,8 @@ For detailed documentation and examples, visit our [documentation site](https://
243
246
 
244
247
  Check out our example implementations:
245
248
 
246
- - [Example Dashboard](https://github.com/lukejreilly/hypequery/tree/main/examples/example-dashboard): A complete Next.js dashboard with HypeQuery
247
- - [React Query Integration](https://hypequery.dev/docs/guides/integrations/react-query): Using HypeQuery with React Query
249
+ - [Example Dashboard](https://github.com/lukejreilly/hypequery/tree/main/examples/example-dashboard): A complete Next.js dashboard with hypequery
250
+ - [React Query Integration](https://hypequery.dev/docs/guides/integrations/react-query): Using hypequery with React Query
248
251
  - [Time Series Analysis](https://hypequery.dev/docs/guides/timeseries): Building time series analytics
249
252
 
250
253
  ## Troubleshooting
@@ -272,5 +275,5 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
272
275
  ---
273
276
 
274
277
  <div align="center">
275
- <sub>Built with ❤️ by the HypeQuery team</sub>
278
+ <sub>Built with ❤️ by the hypequery team</sub>
276
279
  </div>
package/dist/cli/bin.js CHANGED
@@ -26,7 +26,7 @@ const colors = {
26
26
  */
27
27
  function showBanner() {
28
28
  console.log(`
29
- ${colors.bright}${colors.cyan}HypeQuery TypeScript Generator${colors.reset}
29
+ ${colors.bright}${colors.cyan}hypequery TypeScript Generator${colors.reset}
30
30
  ${colors.dim}Generate TypeScript types from your ClickHouse database schema${colors.reset}
31
31
  `);
32
32
  }
@@ -118,7 +118,8 @@ export interface IntrospectedSchema {`;
118
118
 
119
119
  typeDefinitions += `\n ${table.name}: {`;
120
120
  for (const column of columns) {
121
- typeDefinitions += `\n ${column.name}: '${clickhouseToTsType(column.type)}';`;
121
+ const clickHouseType = column.type.replace.replace(/'/g, "\\'"); // Escape single quotes, e.g. `DateTime('UTC')`
122
+ typeDefinitions += `\n ${column.name}: '${clickHouseType}';`;
122
123
  }
123
124
  typeDefinitions += '\n };';
124
125
  }
@@ -177,4 +178,4 @@ export interface IntrospectedSchema {`;
177
178
  */
178
179
  function capitalizeFirstLetter(str) {
179
180
  return str.charAt(0).toUpperCase() + str.slice(1);
180
- }
181
+ }
@@ -4,7 +4,7 @@ import { ClickHouseConnection } from '../../connection';
4
4
  import { exec } from 'child_process';
5
5
  import { promisify } from 'util';
6
6
  import { logger as hypeQueryLogger } from '../../utils/logger';
7
- // Disable the HypeQuery logger to prevent "logs after tests" errors
7
+ // Disable the hypequery logger to prevent "logs after tests" errors
8
8
  // This must be done early in the setup, before any queries run
9
9
  hypeQueryLogger.configure({ enabled: false });
10
10
  // Setup a logger that respects test environment
@@ -44,22 +44,22 @@ class Logger {
44
44
  }
45
45
  debug(message, ...args) {
46
46
  if (this.shouldLog('debug')) {
47
- console.debug(`[HypeQuery Debug] ${message}`, ...args);
47
+ console.debug(`[hypequery Debug] ${message}`, ...args);
48
48
  }
49
49
  }
50
50
  info(message, ...args) {
51
51
  if (this.shouldLog('info')) {
52
- console.info(`[HypeQuery Info] ${message}`, ...args);
52
+ console.info(`[hypequery Info] ${message}`, ...args);
53
53
  }
54
54
  }
55
55
  warn(message, ...args) {
56
56
  if (this.shouldLog('warn')) {
57
- console.warn(`[HypeQuery Warn] ${message}`, ...args);
57
+ console.warn(`[hypequery Warn] ${message}`, ...args);
58
58
  }
59
59
  }
60
60
  error(message, ...args) {
61
61
  if (this.shouldLog('error')) {
62
- console.error(`[HypeQuery Error] ${message}`, ...args);
62
+ console.error(`[hypequery Error] ${message}`, ...args);
63
63
  }
64
64
  }
65
65
  logQuery(log) {
@@ -1,7 +1,7 @@
1
1
  export type ClickHouseInteger = 'Int8' | 'Int16' | 'Int32' | 'Int64' | 'Int128' | 'Int256' | 'UInt8' | 'UInt16' | 'UInt32' | 'UInt64' | 'UInt128' | 'UInt256';
2
2
  export type ClickHouseFloat = 'Float32' | 'Float64';
3
3
  export type ClickHouseDecimal = 'Decimal32' | 'Decimal64' | 'Decimal128' | 'Decimal256' | `Decimal(${number}, ${number})`;
4
- export type ClickHouseDateTime = 'Date' | 'Date32' | 'DateTime' | `DateTime64(${number})` | `DateTime64(${number}, '${string}')`;
4
+ export type ClickHouseDateTime = 'Date' | 'Date32' | 'DateTime' | `DateTime('${string}')` | `DateTime64(${number})` | `DateTime64(${number}, '${string}')`;
5
5
  export type ClickHouseString = 'String' | `FixedString(${number})` | 'UUID';
6
6
  export type ClickHouseArray = `Array(${ClickHouseBaseType})`;
7
7
  export type ClickHouseNullable = `Nullable(${ClickHouseBaseType})`;
@@ -1 +1 @@
1
- {"version":3,"file":"clickhouse-types.d.ts","sourceRoot":"","sources":["../../src/types/clickhouse-types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,iBAAiB,GACzB,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAC1D,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAErE,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,CAAC;AAEpD,MAAM,MAAM,iBAAiB,GACzB,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,YAAY,GACvD,WAAW,MAAM,KAAK,MAAM,GAAG,CAAC;AAGpC,MAAM,MAAM,kBAA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AAkB,GAClB,wBAAwB,GACxB,aAAa,CAAC;AAGlB,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,cAAc,IACtD,CAAC,SAAS,iBAAiB,GAAG,MAAM,GACpC,CAAC,SAAS,eAAe,GAAG,MAAM,GAClC,CAAC,SAAS,iBAAiB,GAAG,MAAM,GACpC,CAAC,SAAS,kBAAkB,GAAG,IAAI,GACnC,CAAC,SAAS,gBAAgB,GAAG,MAAM,GACnC,CAAC,SAAS,SAAS,MAAM,CAAC,SAAS,kBAAkB,GAAG,GAAG,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,GACxF,CAAC,SAAS,YAAY,MAAM,CAAC,SAAS,kBAAkB,GAAG,GAAG,mBAAmB,CAAC,CAAC,CAAC,GAAG,IAAI,GAC3F,CAAC,SAAS,kBAAkB,MAAM,CAAC,SAAS,gBAAgB,GAAG,GAAG,mBAAmB,CAAC,CAAC,CAAC,GACxF,CAAC,SAAS,OAAO,MAAM,CAAC,SAAS,kBAAkB,KAAK,MAAM,CAAC,SAAS,kBAAkB,GAAG,GAC7F,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,GACnD,KAAK,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypequery/clickhouse",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "ClickHouse typescript query builder",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",