@hypequery/clickhouse 1.2.3 → 1.2.5
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 +3 -3
- package/dist/cli/index.d.ts +1 -1
- package/dist/core/connection.d.ts +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 +4 -4
- package/dist/core/query-builder.js +11 -11
- package/dist/core/tests/index.d.ts +1 -1
- package/dist/core/tests/integration/setup.js +2 -2
- package/dist/core/tests/test-utils.js +1 -1
- package/dist/core/validators/filter-validator.js +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/types/base.d.ts +2 -2
- package/dist/types/filters.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/package.json +5 -4
|
@@ -118,7 +118,7 @@ export interface IntrospectedSchema {`;
|
|
|
118
118
|
typeDefinitions += `\n ${table.name}: {`;
|
|
119
119
|
for (const column of columns) {
|
|
120
120
|
const clickHouseType = column.type.replace(/'/g, "\\'"); // Escape single quotes, e.g. `DateTime('UTC')`
|
|
121
|
-
typeDefinitions += `\n ${column.name}: '${clickHouseType}';`;
|
|
121
|
+
typeDefinitions += `\n '${column.name}': '${clickHouseType}';`;
|
|
122
122
|
}
|
|
123
123
|
typeDefinitions += '\n };';
|
|
124
124
|
}
|
|
@@ -137,7 +137,7 @@ export interface IntrospectedSchema {`;
|
|
|
137
137
|
typeDefinitions += `export interface ${capitalizeFirstLetter(table.name)}Record {`;
|
|
138
138
|
for (const column of columns) {
|
|
139
139
|
const tsType = clickhouseToTsType(column.type).replace(/'/g, '');
|
|
140
|
-
typeDefinitions += `\n ${column.name}: ${tsType};`;
|
|
140
|
+
typeDefinitions += `\n '${column.name}': ${tsType};`;
|
|
141
141
|
}
|
|
142
142
|
typeDefinitions += '\n}\n\n';
|
|
143
143
|
}
|
|
@@ -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';
|
|
152
152
|
*
|
|
153
153
|
* // Create a type-safe query builder
|
|
154
154
|
* const db = createQueryBuilder<IntrospectedSchema>();
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// CLI module type declarations
|
|
2
|
-
export { generateTypes } from './generate-types';
|
|
2
|
+
export { generateTypes } from './generate-types.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ClickHouseSettings } from '@clickhouse/client-common';
|
|
2
2
|
import type { ClickHouseClient as NodeClickHouseClient } from '@clickhouse/client';
|
|
3
3
|
import type { ClickHouseClient as WebClickHouseClient } from '@clickhouse/client-web';
|
|
4
|
-
import type { ClickHouseConfig } from './query-builder';
|
|
4
|
+
import type { ClickHouseConfig } from './query-builder.js';
|
|
5
5
|
type ClickHouseClient = NodeClickHouseClient | WebClickHouseClient;
|
|
6
6
|
/**
|
|
7
7
|
* The main entry point for connecting to a ClickHouse database.
|
package/dist/core/connection.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createClient as createNodeClient } from '@clickhouse/client';
|
|
2
|
-
import { isClientConfig } from './query-builder
|
|
2
|
+
import { isClientConfig } from './query-builder';
|
|
3
3
|
// Function to synchronously get the appropriate client
|
|
4
4
|
function getClickHouseClientSync() {
|
|
5
5
|
const isDev = process.env.NODE_ENV === 'development';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FilterValidator } from './validators/filter-validator
|
|
1
|
+
import { FilterValidator } from './validators/filter-validator';
|
|
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';
|
|
2
|
+
import { substituteParameters } from '../utils';
|
|
3
|
+
import { logger } from '../utils/logger';
|
|
4
4
|
export class ExecutorFeature {
|
|
5
5
|
constructor(builder) {
|
|
6
6
|
this.builder = builder;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CrossFilter } from './cross-filter';
|
|
1
|
+
import { CrossFilter } from './cross-filter.js';
|
|
2
2
|
import { ColumnType, FilterOperator, OrderDirection, TableColumn, AggregationType, QueryConfig, OperatorValueMap, InferColumnType, PaginationOptions, PaginatedResult } from '../types';
|
|
3
|
-
import { SQLFormatter } from './formatters/sql-formatter';
|
|
4
|
-
import { JoinRelationships, JoinPathOptions } from './join-relationships';
|
|
5
|
-
import { SqlExpression } from './utils/sql-expressions';
|
|
3
|
+
import { SQLFormatter } from './formatters/sql-formatter.js';
|
|
4
|
+
import { JoinRelationships, JoinPathOptions } from './join-relationships.js';
|
|
5
|
+
import { SqlExpression } from './utils/sql-expressions.js';
|
|
6
6
|
import type { ClickHouseSettings, BaseClickHouseClientConfigOptions } from '@clickhouse/client-common';
|
|
7
7
|
import type { ClickHouseClient as NodeClickHouseClient } from '@clickhouse/client';
|
|
8
8
|
import type { ClickHouseClient as WebClickHouseClient } from '@clickhouse/client-web';
|
|
@@ -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';
|
|
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';
|
|
12
12
|
/**
|
|
13
13
|
* Type guard to check if a config is a client-based configuration.
|
|
14
14
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './test-utils';
|
|
1
|
+
export * from './test-utils.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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';
|
|
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';
|
|
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 });
|
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, ClickHouseClientConfig } from './core/query-builder';
|
|
5
|
-
export { isClientConfig } from './core/query-builder';
|
|
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';
|
|
1
|
+
export { createQueryBuilder, QueryBuilder } from './core/query-builder.js';
|
|
2
|
+
export { ClickHouseConnection } from './core/connection.js';
|
|
3
|
+
export { JoinRelationships } from './core/join-relationships.js';
|
|
4
|
+
export type { ClickHouseConfig, ClickHouseClientConfig } from './core/query-builder.js';
|
|
5
|
+
export { isClientConfig } from './core/query-builder.js';
|
|
6
|
+
export type { TableSchema, QueryConfig, ColumnType, WhereExpression, GroupByExpression, TableRecord, DatabaseSchema, PaginatedResult, PageInfo, PaginationOptions } from './types/base.js';
|
|
7
|
+
export type { JoinPath, JoinPathOptions } from './core/join-relationships.js';
|
|
8
|
+
export { CrossFilter } from './core/cross-filter.js';
|
|
9
|
+
export { logger } from './core/utils/logger.js';
|
|
10
|
+
export { raw, rawAs, toDateTime, formatDateTime, toStartOfInterval, datePart, FormatDateTimeOptions } from './core/utils/sql-expressions.js';
|
|
11
|
+
export type { SqlExpression, AliasedExpression } from './core/utils/sql-expressions.js';
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
13
13
|
|
|
14
14
|
/**
|
package/dist/types/base.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ClickHouseType, InferClickHouseType } from "./clickhouse-types";
|
|
2
|
-
import { FilterOperator } from "./filters";
|
|
1
|
+
import { ClickHouseType, InferClickHouseType } from "./clickhouse-types.js";
|
|
2
|
+
import { FilterOperator } from "./filters.js";
|
|
3
3
|
export interface QueryConfig<T, Schema> {
|
|
4
4
|
select?: Array<keyof T | string>;
|
|
5
5
|
where?: WhereCondition[];
|
package/dist/types/filters.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TableColumn } from "./base";
|
|
1
|
+
import { TableColumn } from "./base.js";
|
|
2
2
|
export type FilterValue<T> = T extends Date ? Date | string : T extends number ? number : T extends string ? string : T extends boolean ? boolean : never;
|
|
3
3
|
export type FilterCondition<T> = {
|
|
4
4
|
eq: FilterValue<T>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './base';
|
|
2
|
-
export * from './filters';
|
|
1
|
+
export * from './base.js';
|
|
2
|
+
export * from './filters.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hypequery/clickhouse",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
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 fix-
|
|
10
|
+
"build": "npm run build:main && npm run build:cli && npm run fix-typedefs && npm run fix-dts-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 fix-
|
|
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-dts-imports && npm run verify-build || npm run diagnose-ci",
|
|
14
14
|
"fix-typedefs": "node scripts/fix-typedefs.js",
|
|
15
|
-
"fix-
|
|
15
|
+
"fix-dts-imports": "node scripts/fix-dts-imports.js",
|
|
16
16
|
"verify-build": "node scripts/verify-build.js",
|
|
17
17
|
"diagnose-ci": "node scripts/diagnose-ci.js",
|
|
18
18
|
"dev": "tsc --watch",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"@semantic-release/release-notes-generator": "^12.1.0",
|
|
61
61
|
"@types/jest": "^29.5.11",
|
|
62
62
|
"@types/node": "^18.19.80",
|
|
63
|
+
"glob": "^11.0.3",
|
|
63
64
|
"jest": "^29.7.0",
|
|
64
65
|
"jest-esbuild": "^0.3.0",
|
|
65
66
|
"semantic-release": "^23.0.2",
|