@hypequery/clickhouse 1.0.0 → 1.0.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-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
 
@@ -14,7 +14,7 @@
14
14
 
15
15
  ## Overview
16
16
 
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.
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.
18
18
 
19
19
  ## Features
20
20
 
@@ -65,7 +65,7 @@ const results = await db
65
65
 
66
66
  ## Schema Generation
67
67
 
68
- HypeQuery provides a CLI tool to generate TypeScript types from your ClickHouse schema:
68
+ hypequery provides a CLI tool to generate TypeScript types from your ClickHouse schema:
69
69
 
70
70
  ```bash
71
71
  # Install globally (optional)
@@ -90,7 +90,7 @@ const db = createQueryBuilder<IntrospectedSchema>({
90
90
 
91
91
  ### Type-Safe Queries
92
92
 
93
- HypeQuery provides full TypeScript support, ensuring your queries are type-safe:
93
+ hypequery provides full TypeScript support, ensuring your queries are type-safe:
94
94
 
95
95
  ```typescript
96
96
  // Column names are type-checked
@@ -167,7 +167,7 @@ const prevPage = await db.table('trips')
167
167
 
168
168
  ### Advanced Queries
169
169
 
170
- HypeQuery supports complex queries including joins, aggregations, and subqueries:
170
+ hypequery supports complex queries including joins, aggregations, and subqueries:
171
171
 
172
172
  ```typescript
173
173
  // Aggregations
@@ -224,7 +224,7 @@ const db = createQueryBuilder<Schema>({
224
224
 
225
225
  ## Versioning and Release Channels
226
226
 
227
- HypeQuery follows semantic versioning and provides multiple release channels:
227
+ hypequery follows semantic versioning and provides multiple release channels:
228
228
 
229
229
  - **Latest**: Stable releases (`npm install @hypequery/core`)
230
230
  - **Beta**: Pre-release versions (`npm install @hypequery/core@beta`)
@@ -243,8 +243,8 @@ For detailed documentation and examples, visit our [documentation site](https://
243
243
 
244
244
  Check out our example implementations:
245
245
 
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
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
248
248
  - [Time Series Analysis](https://hypequery.dev/docs/guides/timeseries): Building time series analytics
249
249
 
250
250
  ## Troubleshooting
@@ -272,5 +272,5 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
272
272
  ---
273
273
 
274
274
  <div align="center">
275
- <sub>Built with ❤️ by the HypeQuery team</sub>
275
+ <sub>Built with ❤️ by the hypequery team</sub>
276
276
  </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,kBAAkB,GAC1B,MAAM,GAAG,QAAQ,GACjB,UAAU,GACV,cAAc,MAAM,GAAG,GACvB,cAAc,MAAM,MAAM,MAAM,IAAI,CAA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AS,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.0",
3
+ "version": "1.0.2",
4
4
  "description": "ClickHouse typescript query builder",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",