@clickhouse/client 1.23.0-head.70ad405.1 → 1.23.0-head.71b2e8a.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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 1.23.1
2
+
3
+ ## Bug Fixes
4
+
5
+ - Re-export `EXCEPTION_TAG_HEADER_NAME` and `extractErrorAtTheEndOfChunk` from `@clickhouse/client`. Both are part of the (now deprecated) `@clickhouse/client-common` public API but were missed when its surface was bundled into and re-exported from the client packages in 1.23.0 ([#845]). Reported downstream by Langfuse. ([#935])
6
+
7
+ [#935]: https://github.com/ClickHouse/clickhouse-js/pull/935
8
+
1
9
  # 1.23.0
2
10
 
3
11
  ## Migration Notes
package/README.md CHANGED
@@ -1,67 +1,27 @@
1
- <p align="center">
2
- <img src=".static/logo.svg" width="200px" align="center">
3
- <h1 align="center">ClickHouse JS client</h1>
4
- </p>
5
- <br/>
6
- <p align="center">
7
- <a href="https://www.npmjs.com/package/@clickhouse/client">
8
- <img alt="NPM Version" src="https://img.shields.io/npm/v/%40clickhouse%2Fclient?color=%233178C6&logo=npm">
9
- </a>
1
+ # @clickhouse/client
10
2
 
11
- <a href="https://www.npmjs.com/package/@clickhouse/client">
12
- <img alt="NPM Downloads" src="https://img.shields.io/npm/dw/%40clickhouse%2Fclient?color=%233178C6&logo=npm">
13
- </a>
3
+ Official Node.js client for [ClickHouse](https://clickhouse.com/), written
4
+ purely in TypeScript and thoroughly tested against actual ClickHouse versions.
14
5
 
15
- <a href="https://github.com/ClickHouse/clickhouse-js/actions/workflows/tests-node.yml">
16
- <img src="https://github.com/ClickHouse/clickhouse-js/actions/workflows/tests-node.yml/badge.svg?branch=main">
17
- </a>
6
+ It is built on top of the Node.js [HTTP](https://nodejs.org/api/http.html) and
7
+ [Stream](https://nodejs.org/api/stream.html) APIs and supports streaming for
8
+ both selects and inserts. The client has zero external dependencies and is
9
+ optimized for maximum performance.
18
10
 
19
- <a href="https://github.com/ClickHouse/clickhouse-js/actions/workflows/tests-web.yml">
20
- <img src="https://github.com/ClickHouse/clickhouse-js/actions/workflows/tests-web.yml/badge.svg?branch=main">
21
- </a>
22
-
23
- <a href="https://codecov.io/gh/ClickHouse/clickhouse-js">
24
- <img src="https://codecov.io/gh/ClickHouse/clickhouse-js/graph/badge.svg?token=B832WB00WJ">
25
- </a>
26
-
27
- <img src="https://api.scorecard.dev/projects/github.com/ClickHouse/clickhouse-js/badge">
28
- </p>
29
-
30
- ## About
31
-
32
- Official JS client for [ClickHouse](https://clickhouse.com/), written purely in TypeScript, thoroughly tested with actual ClickHouse versions.
33
-
34
- The client has zero external dependencies and is optimized for maximum performance.
35
-
36
- The repository consists of four packages:
37
-
38
- - `@clickhouse/client` - a version of the client designed for Node.js platform only. It is built on top of [HTTP](https://nodejs.org/api/http.html)
39
- and [Stream](https://nodejs.org/api/stream.html) APIs; supports streaming for both selects and inserts.
40
- - `@clickhouse/client-web` - a version of the client built on top of [Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
41
- and [Web Streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) APIs; supports streaming for selects.
42
- Compatible with Chrome/Firefox browsers and Cloudflare workers.
43
- - `@clickhouse/client-common` - shared common types and the base framework for building a custom client implementation.
44
- - `@clickhouse/rowbinary` - a library for reading (and soon writing) ClickHouse RowBinary format.
11
+ > Looking for a browser / edge runtime (Cloudflare Workers, etc.) instead? Use
12
+ > [`@clickhouse/client-web`](https://www.npmjs.com/package/@clickhouse/client-web).
45
13
 
46
14
  ## Installation
47
15
 
48
- Node.js client:
49
-
50
16
  ```sh
51
17
  npm i @clickhouse/client
52
18
  ```
53
19
 
54
- Web client (browsers, Cloudflare workers):
55
-
56
- ```sh
57
- npm i @clickhouse/client-web
58
- ```
59
-
60
20
  ## Environment requirements
61
21
 
62
- ### Node.js
63
-
64
- Node.js must be available in the environment to run the Node.js client. The client is compatible with all the [maintained](https://github.com/nodejs/release#readme) Node.js releases.
22
+ Node.js must be available in the environment to run the client. The client is
23
+ compatible with all the [maintained](https://github.com/nodejs/release#readme)
24
+ Node.js releases.
65
25
 
66
26
  | Node.js version | Supported? |
67
27
  | --------------- | ---------- |
@@ -70,9 +30,10 @@ Node.js must be available in the environment to run the Node.js client. The clie
70
30
  | 22.x | ✔ |
71
31
  | 20.x | ✔ |
72
32
 
73
- ### TypeScript
74
-
75
- If using TypeScript, version [4.5](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html) or above is required to enable [inline import and export syntax](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#type-modifiers-on-import-names).
33
+ If using TypeScript, version
34
+ [4.5](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html)
35
+ or above is required to enable
36
+ [inline import and export syntax](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#type-modifiers-on-import-names).
76
37
 
77
38
  ## Compatibility with ClickHouse
78
39
 
@@ -80,12 +41,13 @@ If using TypeScript, version [4.5](https://www.typescriptlang.org/docs/handbook/
80
41
  | -------------- | ---------- |
81
42
  | 1.12.0+ | 24.8+ |
82
43
 
83
- The client may work with older versions too; however, this is best-effort support and is not guaranteed.
44
+ The client may work with older versions too; however, this is best-effort
45
+ support and is not guaranteed.
84
46
 
85
47
  ## Quick start
86
48
 
87
49
  ```ts
88
- import { createClient } from "@clickhouse/client"; // or '@clickhouse/client-web'
50
+ import { createClient } from "@clickhouse/client";
89
51
 
90
52
  const client = createClient({
91
53
  url: process.env.CLICKHOUSE_URL ?? "http://localhost:8123",
@@ -104,53 +66,24 @@ console.log(tables);
104
66
  await client.close();
105
67
  ```
106
68
 
107
- See more examples in the [examples directory](./examples).
69
+ See more examples in the
70
+ [examples directory](https://github.com/ClickHouse/clickhouse-js/tree/main/examples).
108
71
 
109
72
  ## Documentation
110
73
 
111
- See the [ClickHouse website](https://clickhouse.com/docs/integrations/javascript) for the full documentation.
74
+ See the [ClickHouse website](https://clickhouse.com/docs/integrations/javascript)
75
+ for the full documentation.
112
76
 
113
77
  ## Changelog
114
78
 
115
- Each package keeps its own changelog:
116
-
117
- - `@clickhouse/client` — [`packages/client-node/CHANGELOG.md`](./packages/client-node/CHANGELOG.md)
118
- - `@clickhouse/client-web` — [`packages/client-web/CHANGELOG.md`](./packages/client-web/CHANGELOG.md)
119
- - `@clickhouse/client-common` (deprecated) — [`packages/client-common/CHANGELOG.md`](./packages/client-common/CHANGELOG.md)
120
- - `@clickhouse/datatype-parser` — [`packages/datatype-parser/CHANGELOG.md`](./packages/datatype-parser/CHANGELOG.md)
121
- - `@clickhouse/rowbinary` — [`skills/clickhouse-js-node-rowbinary/CHANGELOG.md`](./skills/clickhouse-js-node-rowbinary/CHANGELOG.md)
122
-
123
- History through `@clickhouse/client` 1.23.0 lives in the now-frozen repository-wide [`CHANGELOG.md`](./CHANGELOG.md).
124
-
125
- ## AI Agent Skills
126
-
127
- This repository contains agent skills for working with the client:
128
-
129
- - `clickhouse-js-node-troubleshooting` — troubleshooting playbook for the Node.js client.
130
-
131
- Install via CLI:
132
-
133
- ```sh
134
- # per project
135
- npx skills add ClickHouse/clickhouse-js
136
- # globally
137
- npx skills add ClickHouse/clickhouse-js -g
138
- ```
139
-
140
- Or ask your agent to install it for you:
141
-
142
- > install agent skills from ClickHouse/clickhouse-js
143
-
144
- ## Usage examples
145
-
146
- We have a wide range of [examples](./examples), aiming to cover various scenarios of client usage. The overview is available in the [examples README](https://github.com/ClickHouse/clickhouse-js/blob/main/examples/README.md#overview).
79
+ See [`CHANGELOG.md`](https://github.com/ClickHouse/clickhouse-js/blob/main/packages/client-node/CHANGELOG.md).
147
80
 
148
81
  ## Contact us
149
82
 
150
- If you have any questions or need help, feel free to reach out to us in the [Community Slack](https://clickhouse.com/slack) (`#clickhouse-js` channel) or via [GitHub issues](https://github.com/ClickHouse/clickhouse-js/issues).
151
-
152
- ## Contributing
83
+ If you have any questions or need help, feel free to reach out to us in the
84
+ [Community Slack](https://clickhouse.com/slack) (`#clickhouse-js` channel) or
85
+ via [GitHub issues](https://github.com/ClickHouse/clickhouse-js/issues).
153
86
 
154
- Check out our [contributing guide](./CONTRIBUTING.md).
87
+ ## License
155
88
 
156
- If you'd like to build a client for an alternative runtime (such as Bun or Cloudflare Workers) or an alternative protocol (such as the native ClickHouse protocol or gRPC over a proxy), see [Building specialized clients for alternative runtimes and protocols](./ALTERNATIVE_CLIENTS.md).
89
+ [Apache 2.0](https://github.com/ClickHouse/clickhouse-js/blob/main/LICENSE)
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ export { type BaseClickHouseClientConfigOptions, type BaseQueryParams, type Quer
13
13
  * applied to them in `./common/index` are NOT propagated to consumers of this package.
14
14
  * Importing these values from `@clickhouse/client` is the recommended, non-deprecated path.
15
15
  */
16
- import { ClickHouseError as ClickHouseError_, parseError as parseError_, ClickHouseLogLevel as ClickHouseLogLevel_, SettingsMap as SettingsMap_, parseColumnType as parseColumnType_, isProgressRow as isProgressRow_, isRow as isRow_, isException as isException_, TupleParam as TupleParam_ } from "./common/index";
16
+ import { ClickHouseError as ClickHouseError_, parseError as parseError_, ClickHouseLogLevel as ClickHouseLogLevel_, SettingsMap as SettingsMap_, parseColumnType as parseColumnType_, isProgressRow as isProgressRow_, isRow as isRow_, isException as isException_, TupleParam as TupleParam_, extractErrorAtTheEndOfChunk as extractErrorAtTheEndOfChunk_ } from "./common/index";
17
17
  export declare const ClickHouseError: typeof ClickHouseError_;
18
18
  export type ClickHouseError = ClickHouseError_;
19
19
  export declare const parseError: typeof parseError_;
@@ -70,3 +70,5 @@ export declare const ClickHouseSpanKind: {
70
70
  readonly CONSUMER: 4;
71
71
  };
72
72
  export declare const defaultJSONHandling: import("./common/index").JSONHandling;
73
+ export declare const EXCEPTION_TAG_HEADER_NAME = "x-clickhouse-exception-tag";
74
+ export declare const extractErrorAtTheEndOfChunk: typeof extractErrorAtTheEndOfChunk_;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultJSONHandling = exports.ClickHouseSpanKind = exports.ClickHouseSpanStatusCode = exports.ClickHouseSpanNames = exports.TupleParam = exports.isException = exports.isRow = exports.isProgressRow = exports.SimpleColumnTypes = exports.parseColumnType = exports.RecordsJSONFormats = exports.SingleDocumentJSONFormats = exports.StreamableJSONFormats = exports.StreamableFormats = exports.SupportedRawFormats = exports.SupportedJSONFormats = exports.SettingsMap = exports.ClickHouseLogLevel = exports.parseError = exports.ClickHouseError = exports.drainStream = exports.ResultSet = exports.createClient = exports.ClickHouseClient = void 0;
3
+ exports.extractErrorAtTheEndOfChunk = exports.EXCEPTION_TAG_HEADER_NAME = exports.defaultJSONHandling = exports.ClickHouseSpanKind = exports.ClickHouseSpanStatusCode = exports.ClickHouseSpanNames = exports.TupleParam = exports.isException = exports.isRow = exports.isProgressRow = exports.SimpleColumnTypes = exports.parseColumnType = exports.RecordsJSONFormats = exports.SingleDocumentJSONFormats = exports.StreamableJSONFormats = exports.StreamableFormats = exports.SupportedRawFormats = exports.SupportedJSONFormats = exports.SettingsMap = exports.ClickHouseLogLevel = exports.parseError = exports.ClickHouseError = exports.drainStream = exports.ResultSet = exports.createClient = exports.ClickHouseClient = void 0;
4
4
  var client_1 = require("./client");
5
5
  Object.defineProperty(exports, "ClickHouseClient", { enumerable: true, get: function () { return client_1.NodeClickHouseClient; } });
6
6
  var client_2 = require("./client");
@@ -40,4 +40,6 @@ exports.ClickHouseSpanNames = index_1.ClickHouseSpanNames;
40
40
  exports.ClickHouseSpanStatusCode = index_1.ClickHouseSpanStatusCode;
41
41
  exports.ClickHouseSpanKind = index_1.ClickHouseSpanKind;
42
42
  exports.defaultJSONHandling = index_1.defaultJSONHandling;
43
+ exports.EXCEPTION_TAG_HEADER_NAME = index_1.EXCEPTION_TAG_HEADER_NAME;
44
+ exports.extractErrorAtTheEndOfChunk = index_1.extractErrorAtTheEndOfChunk;
43
45
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAGkB;AAFhB,0GAAA,oBAAoB,OAAoB;AAG1C,mCAAwC;AAA/B,sGAAA,YAAY,OAAA;AAErB,2CAA8D;AAArD,uGAAA,SAAS,OAAA;AAClB,8CAAkD;AAAzC,qGAAA,WAAW,OAAA;AA2DpB;;;;;;;GAOG;AACH,0CAqBwB;AAEX,QAAA,eAAe,GAAG,uBAAgB,CAAC;AAEnC,QAAA,UAAU,GAAG,kBAAW,CAAC;AACzB,QAAA,kBAAkB,GAAG,0BAAmB,CAAC;AAEzC,QAAA,WAAW,GAAG,mBAAY,CAAC;AAE3B,QAAA,oBAAoB,GAAG,4BAAqB,CAAC;AAC7C,QAAA,mBAAmB,GAAG,2BAAoB,CAAC;AAC3C,QAAA,iBAAiB,GAAG,yBAAkB,CAAC;AACvC,QAAA,qBAAqB,GAAG,6BAAsB,CAAC;AAC/C,QAAA,yBAAyB,GAAG,iCAA0B,CAAC;AACvD,QAAA,kBAAkB,GAAG,0BAAmB,CAAC;AACtD,4JAA4J;AAC/I,QAAA,eAAe,GAAG,uBAAgB,CAAC;AAChD,4JAA4J;AAC/I,QAAA,iBAAiB,GAAG,yBAAkB,CAAC;AACvC,QAAA,aAAa,GAAG,qBAAc,CAAC;AAC/B,QAAA,KAAK,GAAG,aAAM,CAAC;AACf,QAAA,WAAW,GAAG,mBAAY,CAAC;AAC3B,QAAA,UAAU,GAAG,kBAAW,CAAC;AAEzB,QAAA,mBAAmB,GAAG,2BAAoB,CAAC;AAC3C,QAAA,wBAAwB,GAAG,gCAAyB,CAAC;AACrD,QAAA,kBAAkB,GAAG,0BAAmB,CAAC;AACzC,QAAA,mBAAmB,GAAG,2BAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAGkB;AAFhB,0GAAA,oBAAoB,OAAoB;AAG1C,mCAAwC;AAA/B,sGAAA,YAAY,OAAA;AAErB,2CAA8D;AAArD,uGAAA,SAAS,OAAA;AAClB,8CAAkD;AAAzC,qGAAA,WAAW,OAAA;AA2DpB;;;;;;;GAOG;AACH,0CAuBwB;AAEX,QAAA,eAAe,GAAG,uBAAgB,CAAC;AAEnC,QAAA,UAAU,GAAG,kBAAW,CAAC;AACzB,QAAA,kBAAkB,GAAG,0BAAmB,CAAC;AAEzC,QAAA,WAAW,GAAG,mBAAY,CAAC;AAE3B,QAAA,oBAAoB,GAAG,4BAAqB,CAAC;AAC7C,QAAA,mBAAmB,GAAG,2BAAoB,CAAC;AAC3C,QAAA,iBAAiB,GAAG,yBAAkB,CAAC;AACvC,QAAA,qBAAqB,GAAG,6BAAsB,CAAC;AAC/C,QAAA,yBAAyB,GAAG,iCAA0B,CAAC;AACvD,QAAA,kBAAkB,GAAG,0BAAmB,CAAC;AACtD,4JAA4J;AAC/I,QAAA,eAAe,GAAG,uBAAgB,CAAC;AAChD,4JAA4J;AAC/I,QAAA,iBAAiB,GAAG,yBAAkB,CAAC;AACvC,QAAA,aAAa,GAAG,qBAAc,CAAC;AAC/B,QAAA,KAAK,GAAG,aAAM,CAAC;AACf,QAAA,WAAW,GAAG,mBAAY,CAAC;AAC3B,QAAA,UAAU,GAAG,kBAAW,CAAC;AAEzB,QAAA,mBAAmB,GAAG,2BAAoB,CAAC;AAC3C,QAAA,wBAAwB,GAAG,gCAAyB,CAAC;AACrD,QAAA,kBAAkB,GAAG,0BAAmB,CAAC;AACzC,QAAA,mBAAmB,GAAG,2BAAoB,CAAC;AAC3C,QAAA,yBAAyB,GAAG,iCAA0B,CAAC;AACvD,QAAA,2BAA2B,GAAG,mCAA4B,CAAC"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.23.0-head.70ad405.1";
1
+ declare const _default: "1.23.0-head.71b2e8a.1";
2
2
  export default _default;
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = "1.23.0-head.70ad405.1";
3
+ exports.default = "1.23.0-head.71b2e8a.1";
4
4
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@clickhouse/client",
3
3
  "description": "Official JS client for ClickHouse DB - Node.js implementation",
4
4
  "homepage": "https://clickhouse.com",
5
- "version": "1.23.0-head.70ad405.1",
5
+ "version": "1.23.0-head.71b2e8a.1",
6
6
  "license": "Apache-2.0",
7
7
  "keywords": [
8
8
  "clickhouse",
@@ -42,11 +42,21 @@
42
42
  },
43
43
  "scripts": {
44
44
  "pack": "npm pack",
45
- "prepack": "rm -rf skills && cp ../../README.md ../../LICENSE . && cp -r ../../skills . && RBP=skills/clickhouse-js-node-rowbinary && rm -rf $RBP/tests $RBP/node_modules $RBP/dist $RBP/package.json $RBP/package-lock.json $RBP/tsconfig.json $RBP/tsconfig.build.json $RBP/vitest.config.ts $RBP/.gitignore $RBP/LICENSE $RBP/eval_result*.md",
45
+ "prepack": "rm -rf skills && cp ../../LICENSE . && cp -r ../../skills . && RBP=skills/clickhouse-js-node-rowbinary && rm -rf $RBP/tests $RBP/node_modules $RBP/dist $RBP/package.json $RBP/package-lock.json $RBP/tsconfig.json $RBP/tsconfig.build.json $RBP/vitest.config.ts $RBP/.gitignore $RBP/LICENSE $RBP/eval_result*.md",
46
46
  "typecheck": "tsc --noEmit",
47
47
  "lint": "eslint --max-warnings=0 .",
48
48
  "lint:fix": "eslint . --fix",
49
- "build": "rm -rf dist; tsc"
49
+ "build": "rm -rf dist; tsc",
50
+ "test:unit": "CLICKHOUSE_TEST_SKIP_INIT=1 TEST_MODE=unit vitest",
51
+ "test:unit:bun": "CLICKHOUSE_TEST_SKIP_INIT=1 TEST_MODE=unit bun --bun vitest",
52
+ "test:integration": "TEST_MODE=integration vitest",
53
+ "test:integration:tls": "TEST_MODE=tls vitest",
54
+ "test:integration:dist": "npm --prefix ../.. run build && TEST_TARGET=dist TEST_MODE=integration vitest",
55
+ "test:integration:local_cluster": "CLICKHOUSE_TEST_ENVIRONMENT=local_cluster TEST_MODE=integration vitest",
56
+ "test:integration:cloud": "CLICKHOUSE_TEST_ENVIRONMENT=cloud TEST_MODE=integration vitest",
57
+ "test:oss-dependents": "TEST_MODE=oss-dependents vitest",
58
+ "test:all": "TEST_MODE=all vitest",
59
+ "test:coverage": "VITEST_COVERAGE=true TEST_MODE=all vitest"
50
60
  },
51
61
  "dependencies": {},
52
62
  "devDependencies": {