@clickhouse/client-web 1.23.0-head.287977a.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/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.
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.
65
29
 
66
- | Node.js version | Supported? |
67
- | --------------- | ----------- |
68
- | 24.x | ✔ |
69
- | 22.x | ✔ |
70
- | 20.x | ✔ |
71
- | 18.x | Best effort |
72
-
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).
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,41 +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.
112
-
113
- ## AI Agent Skills
114
-
115
- This repository contains agent skills for working with the client:
116
-
117
- - `clickhouse-js-node-troubleshooting` — troubleshooting playbook for the Node.js client.
118
-
119
- Install via CLI:
71
+ See the [ClickHouse website](https://clickhouse.com/docs/integrations/javascript)
72
+ for the full documentation.
120
73
 
121
- ```sh
122
- # per project
123
- npx skills add ClickHouse/clickhouse-js
124
- # globally
125
- npx skills add ClickHouse/clickhouse-js -g
126
- ```
127
-
128
- Or ask your agent to install it for you:
74
+ ## Changelog
129
75
 
130
- > install agent skills from ClickHouse/clickhouse-js
131
-
132
- ## Usage examples
133
-
134
- 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).
135
77
 
136
78
  ## Contact us
137
79
 
138
- 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).
139
-
140
- ## 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).
141
83
 
142
- Check out our [contributing guide](./CONTRIBUTING.md).
84
+ ## License
143
85
 
144
- 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,GA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AAW,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.287977a.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.287977a.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-web",
3
3
  "description": "Official JS client for ClickHouse DB - Web API implementation",
4
4
  "homepage": "https://clickhouse.com",
5
- "version": "1.23.0-head.287977a.1",
5
+ "version": "1.23.0-head.71b2e8a.1",
6
6
  "license": "Apache-2.0",
7
7
  "keywords": [
8
8
  "clickhouse",
@@ -15,7 +15,8 @@
15
15
  },
16
16
  "private": false,
17
17
  "files": [
18
- "dist"
18
+ "dist",
19
+ "CHANGELOG.md"
19
20
  ],
20
21
  "exports": {
21
22
  "types": "./dist/index.d.ts",
@@ -24,11 +25,19 @@
24
25
  },
25
26
  "scripts": {
26
27
  "pack": "npm pack",
27
- "prepack": "cp ../../README.md ../../LICENSE .",
28
+ "prepack": "cp ../../LICENSE .",
28
29
  "typecheck": "tsc --noEmit",
29
30
  "lint": "eslint --max-warnings=0 .",
30
31
  "lint:fix": "eslint . --fix",
31
- "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"
32
41
  },
33
42
  "dependencies": {}
34
43
  }