@hypequery/clickhouse 1.2.0 → 1.2.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/dist/cli/generate-types.js +1 -1
- package/dist/core/connection.d.ts.map +1 -1
- package/dist/core/connection.js +1 -1
- package/dist/core/cross-filter.js +1 -1
- package/dist/core/features/executor.js +3 -3
- package/dist/core/query-builder.d.ts +9 -2
- package/dist/core/query-builder.d.ts.map +1 -1
- package/dist/core/query-builder.js +11 -11
- package/dist/core/tests/integration/setup.d.ts +1 -1
- package/dist/core/tests/integration/setup.d.ts.map +1 -1
- package/dist/core/tests/integration/setup.js +2 -2
- package/dist/core/tests/integration/test-initializer.d.ts +7 -0
- package/dist/core/tests/integration/test-initializer.d.ts.map +1 -0
- package/dist/core/tests/integration/test-initializer.js +32 -0
- package/dist/core/tests/test-utils.js +1 -1
- package/dist/core/validators/filter-validator.js +1 -1
- package/dist/index.d.ts +1 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/types/clickhouse-types.d.ts +2 -3
- package/dist/types/clickhouse-types.d.ts.map +1 -1
- package/package.json +4 -3
- package/README.md +0 -253
|
@@ -148,7 +148,7 @@ export interface IntrospectedSchema {`;
|
|
|
148
148
|
* Usage example:
|
|
149
149
|
*
|
|
150
150
|
* import { createQueryBuilder } from '@hypequery/clickhouse';
|
|
151
|
-
* import { IntrospectedSchema } from './path-to-this-file';
|
|
151
|
+
* import { IntrospectedSchema } from './path-to-this-file.js';
|
|
152
152
|
*
|
|
153
153
|
* // Create a type-safe query builder
|
|
154
154
|
* const db = createQueryBuilder<IntrospectedSchema>();
|
|
@@ -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,EAAwB,MAAM,iBAAiB,CAAC;AAI9E,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"}
|
package/dist/core/connection.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FilterValidator } from './validators/filter-validator';
|
|
1
|
+
import { FilterValidator } from './validators/filter-validator.js';
|
|
2
2
|
/**
|
|
3
3
|
* A type-safe filter builder supporting both simple conditions and complex nested groups.
|
|
4
4
|
* @template Schema - The full database schema type
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClickHouseConnection } from '../connection';
|
|
2
|
-
import { substituteParameters } from '../utils';
|
|
3
|
-
import { logger } from '../utils/logger';
|
|
1
|
+
import { ClickHouseConnection } from '../connection.js';
|
|
2
|
+
import { substituteParameters } from '../utils.js';
|
|
3
|
+
import { logger } from '../utils/logger.js';
|
|
4
4
|
export class ExecutorFeature {
|
|
5
5
|
constructor(builder) {
|
|
6
6
|
this.builder = builder;
|
|
@@ -7,6 +7,13 @@ import type { ClickHouseSettings, BaseClickHouseClientConfigOptions } from '@cli
|
|
|
7
7
|
import type { ClickHouseClient as NodeClickHouseClient } from '@clickhouse/client';
|
|
8
8
|
import type { ClickHouseClient as WebClickHouseClient } from '@clickhouse/client-web';
|
|
9
9
|
type ClickHouseClient = NodeClickHouseClient | WebClickHouseClient;
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for host-based connections.
|
|
12
|
+
*/
|
|
13
|
+
export interface ClickHouseHostConfig extends BaseClickHouseClientConfigOptions {
|
|
14
|
+
/** The ClickHouse server host URL. */
|
|
15
|
+
host: string;
|
|
16
|
+
}
|
|
10
17
|
/**
|
|
11
18
|
* Configuration for client-based connections.
|
|
12
19
|
*/
|
|
@@ -18,11 +25,11 @@ export interface ClickHouseClientConfig extends BaseClickHouseClientConfigOption
|
|
|
18
25
|
* Configuration options for ClickHouse connections.
|
|
19
26
|
* Either provide a client instance OR connection details, but not both.
|
|
20
27
|
*/
|
|
21
|
-
export type ClickHouseConfig =
|
|
28
|
+
export type ClickHouseConfig = ClickHouseHostConfig | ClickHouseClientConfig;
|
|
22
29
|
/**
|
|
23
30
|
* Type guard to check if a config is a host-based configuration.
|
|
24
31
|
*/
|
|
25
|
-
export declare function isHostConfig(config: ClickHouseConfig): config is
|
|
32
|
+
export declare function isHostConfig(config: ClickHouseConfig): config is ClickHouseHostConfig;
|
|
26
33
|
/**
|
|
27
34
|
* Type guard to check if a config is a client-based configuration.
|
|
28
35
|
*/
|
|
@@ -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,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAS1D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iCAAiC,EAAE,MAAM,2BAA2B,CAAC;AACvG,OAAO,KAAK,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,KAAK,EAAE,gBAAgB,IAAI,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAGtF,KAAK,gBAAgB,GAAG,oBAAoB,GAAG,mBAAmB,CAAC;
|
|
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,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAS1D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iCAAiC,EAAE,MAAM,2BAA2B,CAAC;AACvG,OAAO,KAAK,EA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;OAEG;IACH,YAAY,CAAC,IAAI,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"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ClickHouseConnection } from './connection';
|
|
2
|
-
import { SQLFormatter } from './formatters/sql-formatter';
|
|
3
|
-
import { AggregationFeature } from './features/aggregations';
|
|
4
|
-
import { JoinFeature } from './features/joins';
|
|
5
|
-
import { FilteringFeature } from './features/filtering';
|
|
6
|
-
import { AnalyticsFeature } from './features/analytics';
|
|
7
|
-
import { ExecutorFeature } from './features/executor';
|
|
8
|
-
import { QueryModifiersFeature } from './features/query-modifiers';
|
|
9
|
-
import { FilterValidator } from './validators/filter-validator';
|
|
10
|
-
import { PaginationFeature } from './features/pagination';
|
|
11
|
-
import { CrossFilteringFeature } from './features/cross-filtering';
|
|
1
|
+
import { ClickHouseConnection } from './connection.js';
|
|
2
|
+
import { SQLFormatter } from './formatters/sql-formatter.js';
|
|
3
|
+
import { AggregationFeature } from './features/aggregations.js';
|
|
4
|
+
import { JoinFeature } from './features/joins.js';
|
|
5
|
+
import { FilteringFeature } from './features/filtering.js';
|
|
6
|
+
import { AnalyticsFeature } from './features/analytics.js';
|
|
7
|
+
import { ExecutorFeature } from './features/executor.js';
|
|
8
|
+
import { QueryModifiersFeature } from './features/query-modifiers.js';
|
|
9
|
+
import { FilterValidator } from './validators/filter-validator.js';
|
|
10
|
+
import { PaginationFeature } from './features/pagination.js';
|
|
11
|
+
import { CrossFilteringFeature } from './features/cross-filtering.js';
|
|
12
12
|
/**
|
|
13
13
|
* Type guard to check if a config is a host-based configuration.
|
|
14
14
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const initializeTestConnection: () => Promise<{
|
|
2
2
|
table<TableName extends never>(tableName: TableName): import("../../query-builder").QueryBuilder<{}, {}[TableName], false, {}, {}[TableName]>;
|
|
3
3
|
}>;
|
|
4
|
-
export declare const ensureConnectionInitialized: () => import("@clickhouse/client
|
|
4
|
+
export declare const ensureConnectionInitialized: () => import("@clickhouse/client").ClickHouseClient | import("@clickhouse/client-web").ClickHouseClient;
|
|
5
5
|
export declare const isDockerAvailable: () => Promise<boolean>;
|
|
6
6
|
export declare const isDockerComposeAvailable: () => Promise<boolean>;
|
|
7
7
|
export declare const isContainerRunning: (containerName: string) => Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../../src/core/tests/integration/setup.ts"],"names":[],"mappings":"AA6CA,eAAO,MAAM,wBAAwB;;EAyBpC,CAAC;AAGF,eAAO,MAAM,2BAA2B,
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../../src/core/tests/integration/setup.ts"],"names":[],"mappings":"AA6CA,eAAO,MAAM,wBAAwB;;EAyBpC,CAAC;AAGF,eAAO,MAAM,2BAA2B,yGAevC,CAAC;AAGF,eAAO,MAAM,iBAAiB,QAAa,OAAO,CAAC,OAAO,CAOzD,CAAC;AAGF,eAAO,MAAM,wBAAwB,QAAa,OAAO,CAAC,OAAO,CAahE,CAAC;AAGF,eAAO,MAAM,kBAAkB,GAAU,eAAe,MAAM,KAAG,OAAO,CAAC,OAAO,CAO/E,CAAC;AAGF,eAAO,MAAM,iBAAiB,QAAa,OAAO,CAAC,OAAO,CAQzD,CAAC;AAGF,eAAO,MAAM,wBAAwB,QAAa,OAAO,CAAC,IAAI,CAwC7D,CAAC;AAGF,eAAO,MAAM,iBAAiB,GAC5B,oBAAgB,EAChB,sBAAoB,KACnB,OAAO,CAAC,IAAI,CAad,CAAC;AAGF,eAAO,MAAM,uBAAuB,QAAa,OAAO,CAAC,IAAI,CA0B5D,CAAC;AAGF,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,KAAK,CAAC;QAChB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,OAAO,CAAC;KACpB,CAAC,CAAC;IACH,KAAK,EAAE,KAAK,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;IACH,MAAM,EAAE,KAAK,CAAC;QACZ,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;CACJ;AAGD,eAAO,MAAM,SAAS,EAAE,cAoBvB,CAAC;AAGF,eAAO,MAAM,iBAAiB,QAAa,OAAO,CAAC,IAAI,CAuFtD,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { fileURLToPath } from 'url';
|
|
3
|
-
import { ClickHouseConnection } from '../../connection';
|
|
3
|
+
import { ClickHouseConnection } from '../../connection.js';
|
|
4
4
|
import { exec } from 'child_process';
|
|
5
5
|
import { promisify } from 'util';
|
|
6
|
-
import { logger as hypeQueryLogger } from '../../utils/logger';
|
|
6
|
+
import { logger as hypeQueryLogger } from '../../utils/logger.js';
|
|
7
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 });
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common initialization for all integration tests
|
|
3
|
+
* Import this at the beginning of each test file to ensure consistent setup
|
|
4
|
+
*/
|
|
5
|
+
export declare const skipIntegrationTests: () => boolean;
|
|
6
|
+
export declare const initializeForTest: () => Promise<void>;
|
|
7
|
+
//# sourceMappingURL=test-initializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-initializer.d.ts","sourceRoot":"","sources":["../../../../src/core/tests/integration/test-initializer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,eAAO,MAAM,oBAAoB,eAEhC,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAa,OAAO,CAAC,IAAI,CAqBtD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common initialization for all integration tests
|
|
3
|
+
* Import this at the beginning of each test file to ensure consistent setup
|
|
4
|
+
*/
|
|
5
|
+
import { startClickHouseContainer, waitForClickHouse, ensureConnectionInitialized, setupTestDatabase } from './setup.js';
|
|
6
|
+
export const skipIntegrationTests = () => {
|
|
7
|
+
return process.env.SKIP_INTEGRATION_TESTS === 'true' || process.env.CI === 'true';
|
|
8
|
+
};
|
|
9
|
+
export const initializeForTest = async () => {
|
|
10
|
+
if (skipIntegrationTests()) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
// Initialize the connection
|
|
15
|
+
ensureConnectionInitialized();
|
|
16
|
+
// Make sure container is running
|
|
17
|
+
await startClickHouseContainer();
|
|
18
|
+
// Wait for ClickHouse to be ready
|
|
19
|
+
await waitForClickHouse();
|
|
20
|
+
// Set up the test database
|
|
21
|
+
await setupTestDatabase();
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
console.error('Failed to initialize test environment:', error);
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
// Automatically initialize when this module is imported
|
|
29
|
+
initializeForTest().catch(error => {
|
|
30
|
+
console.error('Test initialization failed:', error);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
export { createQueryBuilder, QueryBuilder } from './core/query-builder.js';
|
|
2
2
|
export { ClickHouseConnection } from './core/connection.js';
|
|
3
3
|
export { JoinRelationships } from './core/join-relationships.js';
|
|
4
|
-
export type { ClickHouseConfig, ClickHouseClientConfig } from './core/query-builder.js';
|
|
4
|
+
export type { ClickHouseConfig, ClickHouseHostConfig, ClickHouseClientConfig } from './core/query-builder.js';
|
|
5
5
|
export { isHostConfig, isClientConfig } from './core/query-builder.js';
|
|
6
|
-
export type { ClickHouseSettings, BaseClickHouseClientConfigOptions } from '@clickhouse/client-common';
|
|
7
|
-
export type { ClickHouseClient } from '@clickhouse/client';
|
|
8
|
-
export type { ClickHouseClient as WebClickHouseClient } from '@clickhouse/client-web';
|
|
9
6
|
export type { TableSchema, QueryConfig, ColumnType, WhereExpression, GroupByExpression, TableRecord, DatabaseSchema, PaginatedResult, PageInfo, PaginationOptions } from './types/base';
|
|
10
7
|
export type { JoinPath, JoinPathOptions } from './core/join-relationships.js';
|
|
11
8
|
export { CrossFilter } from './core/cross-filter.js';
|
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,yBAAyB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACvE,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACvE,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,8BAA8B,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EACL,GAAG,EACH,KAAK,EACL,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,QAAQ,EACR,qBAAqB,EACtB,MAAM,iCAAiC,CAAC;AACzC,YAAY,EACV,aAAa,EACb,iBAAiB,EAClB,MAAM,iCAAiC,CAAC"}
|
|
@@ -3,12 +3,11 @@ export type ClickHouseFloat = 'Float32' | 'Float64';
|
|
|
3
3
|
export type ClickHouseDecimal = 'Decimal32' | 'Decimal64' | 'Decimal128' | 'Decimal256' | `Decimal(${number}, ${number})`;
|
|
4
4
|
export type ClickHouseDateTime = 'Date' | 'Date32' | 'DateTime' | `DateTime('${string}')` | `DateTime64(${number})` | `DateTime64(${number}, '${string}')`;
|
|
5
5
|
export type ClickHouseString = 'String' | `FixedString(${number})` | 'UUID';
|
|
6
|
-
export type ClickHouseEnum = `Enum8(${string})` | `Enum16(${string})`;
|
|
7
6
|
export type ClickHouseArray = `Array(${ClickHouseBaseType})`;
|
|
8
7
|
export type ClickHouseNullable = `Nullable(${ClickHouseBaseType})`;
|
|
9
8
|
export type ClickHouseLowCardinality = `LowCardinality(${ClickHouseString})`;
|
|
10
9
|
export type ClickHouseMap = `Map(${ClickHouseBaseType}, ${ClickHouseBaseType})`;
|
|
11
|
-
export type ClickHouseBaseType = ClickHouseInteger | ClickHouseFloat | ClickHouseDecimal | ClickHouseDateTime | ClickHouseString
|
|
10
|
+
export type ClickHouseBaseType = ClickHouseInteger | ClickHouseFloat | ClickHouseDecimal | ClickHouseDateTime | ClickHouseString;
|
|
12
11
|
export type ClickHouseType = ClickHouseBaseType | ClickHouseArray | ClickHouseNullable | ClickHouseLowCardinality | ClickHouseMap;
|
|
13
|
-
export type InferClickHouseType<T extends ClickHouseType> = T extends ClickHouseInteger ? number : T extends ClickHouseFloat ? number : T extends ClickHouseDecimal ? number : T extends ClickHouseDateTime ? Date : T extends ClickHouseString ? string : T extends
|
|
12
|
+
export type InferClickHouseType<T extends ClickHouseType> = T extends ClickHouseInteger ? number : T extends ClickHouseFloat ? number : T extends ClickHouseDecimal ? number : T extends ClickHouseDateTime ? Date : T extends ClickHouseString ? string : T extends `Array(${infer U extends ClickHouseBaseType})` ? Array<InferClickHouseType<U>> : T extends `Nullable(${infer U extends ClickHouseBaseType})` ? InferClickHouseType<U> | null : T extends `LowCardinality(${infer U extends ClickHouseString})` ? InferClickHouseType<U> : T extends `Map(${infer K extends ClickHouseBaseType}, ${infer V extends ClickHouseBaseType})` ? Map<InferClickHouseType<K>, InferClickHouseType<V>> : never;
|
|
14
13
|
//# sourceMappingURL=clickhouse-types.d.ts.map
|
|
@@ -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,aAAa,MAAM,IAAI,GACvB,cAAc,MAAM,GAAG,GACvB,cAAc,MAAM,MAAM,MAAM,IAAI,CAAC;AAGzC,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,eAAe,MAAM,GAAG,GACxB,MAAM,CAAC;AAGX,MAAM,MAAM,
|
|
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,aAAa,MA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B,GAAG,GAC7F,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,GACnD,KAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hypequery/clickhouse",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "ClickHouse typescript query builder",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"license": "Apache-2.0",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "npm run build:main && npm run build:cli && npm run fix-typedefs && npm run verify-build || npm run diagnose-ci",
|
|
10
|
+
"build": "npm run build:main && npm run build:cli && npm run fix-typedefs && npm run fix-esm-imports && npm run verify-build || npm run diagnose-ci",
|
|
11
11
|
"build:main": "tsc --project tsconfig.json",
|
|
12
12
|
"build:cli": "node scripts/ensure-core-files.js && node scripts/handle-cli-files.js",
|
|
13
|
-
"build:ci": "npm run build:main && node scripts/ensure-core-files.js && node scripts/handle-cli-files.js && npm run fix-typedefs && npm run verify-build || npm run diagnose-ci",
|
|
13
|
+
"build:ci": "npm run build:main && node scripts/ensure-core-files.js && node scripts/handle-cli-files.js && npm run fix-typedefs && npm run fix-esm-imports && npm run verify-build || npm run diagnose-ci",
|
|
14
14
|
"fix-typedefs": "node scripts/fix-typedefs.js",
|
|
15
|
+
"fix-esm-imports": "node scripts/fix-esm-imports.js",
|
|
15
16
|
"verify-build": "node scripts/verify-build.js",
|
|
16
17
|
"diagnose-ci": "node scripts/diagnose-ci.js",
|
|
17
18
|
"dev": "tsc --watch",
|
package/README.md
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
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 @clickhouse/client
|
|
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>
|