@clickhouse/client-web 1.23.0 → 1.23.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-web`. 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,78 +1,36 @@
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-web
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 Web client for [ClickHouse](https://clickhouse.com/), written purely in
4
+ 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
7
+ [Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) and
8
+ [Web Streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) APIs
9
+ and supports streaming for selects. It is compatible with Chrome/Firefox
10
+ browsers and Cloudflare Workers. The client has zero external dependencies and is
11
+ optimized for maximum performance.
18
12
 
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.
13
+ > Running on Node.js? Use
14
+ > [`@clickhouse/client`](https://www.npmjs.com/package/@clickhouse/client)
15
+ > instead, which additionally supports streaming for inserts.
45
16
 
46
17
  ## Installation
47
18
 
48
- Node.js client:
49
-
50
- ```sh
51
- npm i @clickhouse/client
52
- ```
53
-
54
- Web client (browsers, Cloudflare workers):
55
-
56
19
  ```sh
57
20
  npm i @clickhouse/client-web
58
21
  ```
59
22
 
60
23
  ## Environment requirements
61
24
 
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.
65
-
66
- | Node.js version | Supported? |
67
- | --------------- | ---------- |
68
- | 26.x | ✔ |
69
- | 24.x | ✔ |
70
- | 22.x | ✔ |
71
- | 20.x | ✔ |
72
-
73
- ### TypeScript
25
+ The client targets runtimes that provide the standard
26
+ [Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) and
27
+ [Web Streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) APIs,
28
+ such as modern Chrome/Firefox browsers and Cloudflare Workers.
74
29
 
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).
30
+ If using TypeScript, version
31
+ [4.5](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html)
32
+ or above is required to enable
33
+ [inline import and export syntax](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#type-modifiers-on-import-names).
76
34
 
77
35
  ## Compatibility with ClickHouse
78
36
 
@@ -80,17 +38,18 @@ If using TypeScript, version [4.5](https://www.typescriptlang.org/docs/handbook/
80
38
  | -------------- | ---------- |
81
39
  | 1.12.0+ | 24.8+ |
82
40
 
83
- The client may work with older versions too; however, this is best-effort support and is not guaranteed.
41
+ The client may work with older versions too; however, this is best-effort
42
+ support and is not guaranteed.
84
43
 
85
44
  ## Quick start
86
45
 
87
46
  ```ts
88
- import { createClient } from "@clickhouse/client"; // or '@clickhouse/client-web'
47
+ import { createClient } from "@clickhouse/client-web";
89
48
 
90
49
  const client = createClient({
91
- url: process.env.CLICKHOUSE_URL ?? "http://localhost:8123",
92
- username: process.env.CLICKHOUSE_USER ?? "default",
93
- password: process.env.CLICKHOUSE_PASSWORD ?? "",
50
+ url: "http://localhost:8123",
51
+ username: "default",
52
+ password: "",
94
53
  });
95
54
 
96
55
  const resultSet = await client.query({
@@ -104,53 +63,24 @@ console.log(tables);
104
63
  await client.close();
105
64
  ```
106
65
 
107
- See more examples in the [examples directory](./examples).
66
+ See more examples in the
67
+ [examples directory](https://github.com/ClickHouse/clickhouse-js/tree/main/examples).
108
68
 
109
69
  ## Documentation
110
70
 
111
- See the [ClickHouse website](https://clickhouse.com/docs/integrations/javascript) for the full documentation.
71
+ See the [ClickHouse website](https://clickhouse.com/docs/integrations/javascript)
72
+ for the full documentation.
112
73
 
113
74
  ## Changelog
114
75
 
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).
76
+ See [`CHANGELOG.md`](https://github.com/ClickHouse/clickhouse-js/blob/main/packages/client-web/CHANGELOG.md).
147
77
 
148
78
  ## Contact us
149
79
 
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
80
+ If you have any questions or need help, feel free to reach out to us in the
81
+ [Community Slack](https://clickhouse.com/slack) (`#clickhouse-js` channel) or
82
+ via [GitHub issues](https://github.com/ClickHouse/clickhouse-js/issues).
153
83
 
154
- Check out our [contributing guide](./CONTRIBUTING.md).
84
+ ## License
155
85
 
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).
86
+ [Apache 2.0](https://github.com/ClickHouse/clickhouse-js/blob/main/LICENSE)
package/dist/index.d.ts CHANGED
@@ -12,7 +12,7 @@ export { type BaseClickHouseClientConfigOptions, type BaseQueryParams, type Quer
12
12
  * applied to them in `./common/index` are NOT propagated to consumers of this package.
13
13
  * Importing these values from `@clickhouse/client-web` is the recommended, non-deprecated path.
14
14
  */
15
- 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";
15
+ 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";
16
16
  export declare const ClickHouseError: typeof ClickHouseError_;
17
17
  export type ClickHouseError = ClickHouseError_;
18
18
  export declare const parseError: typeof parseError_;
@@ -69,3 +69,5 @@ export declare const ClickHouseSpanKind: {
69
69
  readonly CONSUMER: 4;
70
70
  };
71
71
  export declare const defaultJSONHandling: import("./common/index").JSONHandling;
72
+ export declare const EXCEPTION_TAG_HEADER_NAME = "x-clickhouse-exception-tag";
73
+ 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.ResultSet = exports.createClient = 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.ResultSet = exports.createClient = void 0;
4
4
  var client_1 = require("./client");
5
5
  Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return client_1.createClient; } });
6
6
  var result_set_1 = require("./result_set");
@@ -36,4 +36,6 @@ exports.ClickHouseSpanNames = index_1.ClickHouseSpanNames;
36
36
  exports.ClickHouseSpanStatusCode = index_1.ClickHouseSpanStatusCode;
37
37
  exports.ClickHouseSpanKind = index_1.ClickHouseSpanKind;
38
38
  exports.defaultJSONHandling = index_1.defaultJSONHandling;
39
+ exports.EXCEPTION_TAG_HEADER_NAME = index_1.EXCEPTION_TAG_HEADER_NAME;
40
+ exports.extractErrorAtTheEndOfChunk = index_1.extractErrorAtTheEndOfChunk;
39
41
  //# 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":";;;AAIA,mCAAwC;AAA/B,sGAAA,YAAY,OAAA;AAErB,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AA2DlB;;;;;;;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":";;;AAIA,mCAAwC;AAA/B,sGAAA,YAAY,OAAA;AAErB,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AA2DlB;;;;;;;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";
1
+ declare const _default: "1.23.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";
3
+ exports.default = "1.23.1";
4
4
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@clickhouse/client-web",
3
3
  "description": "Official JS client for ClickHouse DB - Web API implementation",
4
4
  "homepage": "https://clickhouse.com",
5
- "version": "1.23.0",
5
+ "version": "1.23.1",
6
6
  "license": "Apache-2.0",
7
7
  "keywords": [
8
8
  "clickhouse",
@@ -25,11 +25,19 @@
25
25
  },
26
26
  "scripts": {
27
27
  "pack": "npm pack",
28
- "prepack": "cp ../../README.md ../../LICENSE .",
28
+ "prepack": "cp ../../LICENSE .",
29
29
  "typecheck": "tsc --noEmit",
30
30
  "lint": "eslint --max-warnings=0 .",
31
31
  "lint:fix": "eslint . --fix",
32
- "build": "rm -rf dist; tsc"
32
+ "build": "rm -rf dist; tsc",
33
+ "test:unit": "CLICKHOUSE_TEST_SKIP_INIT=1 TEST_MODE=unit vitest",
34
+ "test:integration": "TEST_MODE=integration vitest",
35
+ "test:integration:dist": "npm --prefix ../.. run build && TEST_TARGET=dist TEST_MODE=integration vitest",
36
+ "test:integration:local_cluster": "CLICKHOUSE_TEST_ENVIRONMENT=local_cluster TEST_MODE=integration vitest",
37
+ "test:integration:cloud": "CLICKHOUSE_TEST_ENVIRONMENT=cloud TEST_MODE=integration vitest",
38
+ "test:integration:cloud:jwt": "CLICKHOUSE_TEST_ENVIRONMENT=cloud TEST_MODE=jwt vitest",
39
+ "test:all": "TEST_MODE=all vitest",
40
+ "test:coverage": "VITEST_COVERAGE=true TEST_MODE=all vitest"
33
41
  },
34
42
  "dependencies": {}
35
43
  }