From a88c4fc87b6f9075c5a9d7ce0fd561d347a55403 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Jun 2026 22:57:34 +0000 Subject: [PATCH 1/2] Repoint ClickHouse client type imports to platform packages for 1.23 forward-compat --- .changeset/clickhouse-client-forward-compat.md | 11 +++++++++++ packages/cli/package.json | 1 - packages/cli/src/api/client.ts | 2 +- .../common-utils/src/__tests__/clickhouse.test.ts | 2 +- .../common-utils/src/__tests__/metadata.int.test.ts | 2 +- .../src/__tests__/queryChartConfig.int.test.ts | 2 +- packages/common-utils/src/clickhouse/browser.ts | 11 +++++++---- packages/common-utils/src/clickhouse/node.ts | 13 ++++++++----- yarn.lock | 1 - 9 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 .changeset/clickhouse-client-forward-compat.md diff --git a/.changeset/clickhouse-client-forward-compat.md b/.changeset/clickhouse-client-forward-compat.md new file mode 100644 index 0000000000..1e5972925b --- /dev/null +++ b/.changeset/clickhouse-client-forward-compat.md @@ -0,0 +1,11 @@ +--- +"@hyperdx/common-utils": patch +"@hyperdx/cli": patch +--- + +Import ClickHouse client types from the platform packages +(`@clickhouse/client` / `@clickhouse/client-web`) instead of the deprecated +`@clickhouse/client-common`. This makes the packages forward-compatible with +`@clickhouse/client*` 1.23 (where `client-common` is deprecated and each +platform package bundles and re-exports its own copy of the shared types) +without bumping the pinned version. No runtime behavior changes. diff --git a/packages/cli/package.json b/packages/cli/package.json index 497fc92d9e..c5b9d99d67 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -40,7 +40,6 @@ }, "devDependencies": { "@clickhouse/client": "^1.12.1", - "@clickhouse/client-common": "^1.12.1", "@hyperdx/common-utils": "^0.20.0", "@jest/globals": "^30.2.0", "@types/crypto-js": "^4.2.2", diff --git a/packages/cli/src/api/client.ts b/packages/cli/src/api/client.ts index 403bca5c56..91d4fbc73c 100644 --- a/packages/cli/src/api/client.ts +++ b/packages/cli/src/api/client.ts @@ -12,7 +12,7 @@ import type { BaseResultSet, ClickHouseSettings, DataFormat, -} from '@clickhouse/client-common'; +} from '@clickhouse/client'; import { BaseClickhouseClient, diff --git a/packages/common-utils/src/__tests__/clickhouse.test.ts b/packages/common-utils/src/__tests__/clickhouse.test.ts index 336f9f9a9e..e7ddcb0378 100644 --- a/packages/common-utils/src/__tests__/clickhouse.test.ts +++ b/packages/common-utils/src/__tests__/clickhouse.test.ts @@ -1,4 +1,4 @@ -import { ResponseJSON } from '@clickhouse/client-common'; +import { ResponseJSON } from '@clickhouse/client'; import { ChSql, diff --git a/packages/common-utils/src/__tests__/metadata.int.test.ts b/packages/common-utils/src/__tests__/metadata.int.test.ts index e379d2c494..3676064b2d 100644 --- a/packages/common-utils/src/__tests__/metadata.int.test.ts +++ b/packages/common-utils/src/__tests__/metadata.int.test.ts @@ -1,5 +1,5 @@ import { createClient } from '@clickhouse/client'; -import { ClickHouseClient } from '@clickhouse/client-common'; +import { ClickHouseClient } from '@clickhouse/client'; import { ClickhouseClient as HdxClickhouseClient } from '@/clickhouse/node'; import { Metadata, MetadataCache } from '@/core/metadata'; diff --git a/packages/common-utils/src/__tests__/queryChartConfig.int.test.ts b/packages/common-utils/src/__tests__/queryChartConfig.int.test.ts index 50015052e3..5f76e73149 100644 --- a/packages/common-utils/src/__tests__/queryChartConfig.int.test.ts +++ b/packages/common-utils/src/__tests__/queryChartConfig.int.test.ts @@ -1,5 +1,5 @@ import { createClient } from '@clickhouse/client'; -import { ClickHouseClient } from '@clickhouse/client-common'; +import { ClickHouseClient } from '@clickhouse/client'; import { ClickhouseClient as HdxClickhouseClient } from '@/clickhouse/node'; import { Metadata, MetadataCache } from '@/core/metadata'; diff --git a/packages/common-utils/src/clickhouse/browser.ts b/packages/common-utils/src/clickhouse/browser.ts index f36348eded..d0e220316f 100644 --- a/packages/common-utils/src/clickhouse/browser.ts +++ b/packages/common-utils/src/clickhouse/browser.ts @@ -1,8 +1,9 @@ import type { BaseResultSet, + ClickHouseClient as WebClickHouseClient, ClickHouseSettings, DataFormat, -} from '@clickhouse/client-common'; +} from '@clickhouse/client-web'; import { createClient } from '@clickhouse/client-web'; import { @@ -125,10 +126,12 @@ export class ClickhouseClient extends BaseClickhouseClient { let clickhouseSettings: ClickHouseSettings | undefined; // If this is the settings query, we must not process the clickhouse settings, or else we will infinitely recurse if (!shouldSkipApplySettings) { - clickhouseSettings = await this.processClickhouseSettings({ + // The shared base class produces a platform-neutral settings object; the + // web client expects its own (now self-bundled) ClickHouseSettings type. + clickhouseSettings = (await this.processClickhouseSettings({ connectionId, externalClickhouseSettings, - }); + })) as ClickHouseSettings; } const httpHeaders: { [header: string]: string } = { @@ -138,7 +141,7 @@ export class ClickhouseClient extends BaseClickhouseClient { }; // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- client library type mismatch - return this.getClient().query({ + return (this.getClient() as WebClickHouseClient).query({ query, query_params, format, diff --git a/packages/common-utils/src/clickhouse/node.ts b/packages/common-utils/src/clickhouse/node.ts index 006c414891..8e9808a4bc 100644 --- a/packages/common-utils/src/clickhouse/node.ts +++ b/packages/common-utils/src/clickhouse/node.ts @@ -1,9 +1,10 @@ -import { createClient } from '@clickhouse/client'; import type { BaseResultSet, + ClickHouseClient as NodeClickHouseClient, ClickHouseSettings, DataFormat, -} from '@clickhouse/client-common'; +} from '@clickhouse/client'; +import { createClient } from '@clickhouse/client'; import { BaseClickhouseClient, @@ -43,15 +44,17 @@ export class ClickhouseClient extends BaseClickhouseClient { let clickhouseSettings: ClickHouseSettings | undefined; // If this is the settings query, we must not process the clickhouse settings, or else we will infinitely recurse if (!shouldSkipApplySettings) { - clickhouseSettings = await this.processClickhouseSettings({ + // The shared base class produces a platform-neutral settings object; the + // node client expects its own (now self-bundled) ClickHouseSettings type. + clickhouseSettings = (await this.processClickhouseSettings({ externalClickhouseSettings, connectionId, - }); + })) as ClickHouseSettings; } // TODO: Custom error handling // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- client library type mismatch - return this.getClient().query({ + return (this.getClient() as NodeClickHouseClient).query({ query, query_params, format, diff --git a/yarn.lock b/yarn.lock index c51659487f..ac3137e04b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4575,7 +4575,6 @@ __metadata: resolution: "@hyperdx/cli@workspace:packages/cli" dependencies: "@clickhouse/client": "npm:^1.12.1" - "@clickhouse/client-common": "npm:^1.12.1" "@hyperdx/common-utils": "npm:^0.20.0" "@jest/globals": "npm:^30.2.0" "@types/crypto-js": "npm:^4.2.2" From 4c2c9b3521ff3e7c9daa4982895edf23e50d131b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Jun 2026 23:01:57 +0000 Subject: [PATCH 2/2] Consolidate platform-client cast into a typed getClient() override per subclass --- packages/common-utils/src/clickhouse/browser.ts | 9 ++++++++- packages/common-utils/src/clickhouse/node.ts | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/common-utils/src/clickhouse/browser.ts b/packages/common-utils/src/clickhouse/browser.ts index d0e220316f..5f358740e8 100644 --- a/packages/common-utils/src/clickhouse/browser.ts +++ b/packages/common-utils/src/clickhouse/browser.ts @@ -73,6 +73,13 @@ export class ClickhouseClient extends BaseClickhouseClient { super(options); } + // This subclass always builds a web client, so narrow the base class's + // platform-agnostic client type to the web-specific one. + protected getClient(): WebClickHouseClient { + // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- subclass always builds a web client + return super.getClient() as WebClickHouseClient; + } + private buildClient() { let url = this.host!; let myFetch: typeof fetch; @@ -141,7 +148,7 @@ export class ClickhouseClient extends BaseClickhouseClient { }; // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- client library type mismatch - return (this.getClient() as WebClickHouseClient).query({ + return this.getClient().query({ query, query_params, format, diff --git a/packages/common-utils/src/clickhouse/node.ts b/packages/common-utils/src/clickhouse/node.ts index 8e9808a4bc..d8ad383f38 100644 --- a/packages/common-utils/src/clickhouse/node.ts +++ b/packages/common-utils/src/clickhouse/node.ts @@ -28,6 +28,13 @@ export class ClickhouseClient extends BaseClickhouseClient { }); } + // This subclass always builds a node client, so narrow the base class's + // platform-agnostic client type to the node-specific one. + protected getClient(): NodeClickHouseClient { + // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- subclass always builds a node client + return super.getClient() as NodeClickHouseClient; + } + protected async __query({ query, // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- default generic value @@ -54,7 +61,7 @@ export class ClickhouseClient extends BaseClickhouseClient { // TODO: Custom error handling // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- client library type mismatch - return (this.getClient() as NodeClickHouseClient).query({ + return this.getClient().query({ query, query_params, format,