@clickhouse/client-common 1.11.2 → 1.12.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
@@ -16,9 +16,9 @@
16
16
  <img src="https://github.com/ClickHouse/clickhouse-js/actions/workflows/tests.yml/badge.svg?branch=main">
17
17
  </a>
18
18
 
19
- <img src="https://sonarcloud.io/api/project_badges/measure?project=ClickHouse_clickhouse-js&metric=alert_status">
20
-
21
- <img src="https://sonarcloud.io/api/project_badges/measure?project=ClickHouse_clickhouse-js&metric=coverage">
19
+ <a href="https://codecov.io/gh/ClickHouse/clickhouse-js">
20
+ <img src="https://codecov.io/gh/ClickHouse/clickhouse-js/graph/badge.svg?token=B832WB00WJ">
21
+ </a>
22
22
 
23
23
  <img src="https://api.scorecard.dev/projects/github.com/ClickHouse/clickhouse-js/badge">
24
24
  </p>
@@ -42,10 +42,33 @@ export interface WithClickHouseSummary {
42
42
  export interface WithResponseHeaders {
43
43
  response_headers: ResponseHeaders;
44
44
  }
45
- /** X-ClickHouse-Summary response header and progress rows from JSONEachRowWithProgress share the same structure */
45
+ export interface ClickHouseProgress {
46
+ read_rows: string;
47
+ read_bytes: string;
48
+ elapsed_ns: string;
49
+ total_rows_to_read?: string;
50
+ }
46
51
  export interface ProgressRow {
47
- progress: ClickHouseSummary;
52
+ progress: ClickHouseProgress;
48
53
  }
54
+ export type SpecialEventRow<T> = {
55
+ meta: Array<{
56
+ name: string;
57
+ type: string;
58
+ }>;
59
+ } | {
60
+ totals: T;
61
+ } | {
62
+ min: T;
63
+ } | {
64
+ max: T;
65
+ } | {
66
+ rows_before_limit_at_least: number | string;
67
+ } | {
68
+ rows_before_aggregation: number | string;
69
+ } | {
70
+ exception: string;
71
+ };
49
72
  export type InsertValues<Stream, T = unknown> = ReadonlyArray<T> | Stream | InputJSON<T> | InputJSONObjectEachRow<T>;
50
73
  export type NonEmptyArray<T> = [T, ...T[]];
51
74
  export interface ClickHouseCredentialsAuth {
@@ -57,6 +80,16 @@ export interface ClickHouseJWTAuth {
57
80
  access_token: string;
58
81
  }
59
82
  export type ClickHouseAuth = ClickHouseCredentialsAuth | ClickHouseJWTAuth;
60
- /** Type guard to use with JSONEachRowWithProgress, checking if the emitted row is a progress row.
83
+ /** Type guard to use with `JSONEachRowWithProgress`, checking if the emitted row is a progress row.
61
84
  * @see https://clickhouse.com/docs/en/interfaces/formats#jsoneachrowwithprogress */
62
85
  export declare function isProgressRow(row: unknown): row is ProgressRow;
86
+ /** Type guard to use with `JSONEachRowWithProgress`, checking if the emitted row is a row with data.
87
+ * @see https://clickhouse.com/docs/en/interfaces/formats#jsoneachrowwithprogress */
88
+ export declare function isRow<T>(row: unknown): row is {
89
+ row: T;
90
+ };
91
+ /** Type guard to use with `JSONEachRowWithProgress`, checking if the row contains an exception.
92
+ * @see https://clickhouse.com/docs/en/interfaces/formats#jsoneachrowwithprogress */
93
+ export declare function isException(row: unknown): row is {
94
+ exception: string;
95
+ };
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isProgressRow = isProgressRow;
4
- /** Type guard to use with JSONEachRowWithProgress, checking if the emitted row is a progress row.
4
+ exports.isRow = isRow;
5
+ exports.isException = isException;
6
+ /** Type guard to use with `JSONEachRowWithProgress`, checking if the emitted row is a progress row.
5
7
  * @see https://clickhouse.com/docs/en/interfaces/formats#jsoneachrowwithprogress */
6
8
  function isProgressRow(row) {
7
9
  return (row !== null &&
@@ -9,4 +11,20 @@ function isProgressRow(row) {
9
11
  'progress' in row &&
10
12
  Object.keys(row).length === 1);
11
13
  }
14
+ /** Type guard to use with `JSONEachRowWithProgress`, checking if the emitted row is a row with data.
15
+ * @see https://clickhouse.com/docs/en/interfaces/formats#jsoneachrowwithprogress */
16
+ function isRow(row) {
17
+ return (row !== null &&
18
+ typeof row === 'object' &&
19
+ 'row' in row &&
20
+ Object.keys(row).length === 1);
21
+ }
22
+ /** Type guard to use with `JSONEachRowWithProgress`, checking if the row contains an exception.
23
+ * @see https://clickhouse.com/docs/en/interfaces/formats#jsoneachrowwithprogress */
24
+ function isException(row) {
25
+ return (row !== null &&
26
+ typeof row === 'object' &&
27
+ 'exception' in row &&
28
+ Object.keys(row).length === 1);
29
+ }
12
30
  //# sourceMappingURL=clickhouse_types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clickhouse_types.js","sourceRoot":"","sources":["../../../packages/client-common/src/clickhouse_types.ts"],"names":[],"mappings":";;AAsEA,sCAOC;AATD;qFACqF;AACrF,SAAgB,aAAa,CAAC,GAAY;IACxC,OAAO,CACL,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,UAAU,IAAI,GAAG;QACjB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAC9B,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"clickhouse_types.js","sourceRoot":"","sources":["../../../packages/client-common/src/clickhouse_types.ts"],"names":[],"mappings":";;AAqFA,sCAOC;AAID,sBAOC;AAID,kCAOC;AA/BD;qFACqF;AACrF,SAAgB,aAAa,CAAC,GAAY;IACxC,OAAO,CACL,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,UAAU,IAAI,GAAG;QACjB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAC9B,CAAA;AACH,CAAC;AAED;qFACqF;AACrF,SAAgB,KAAK,CAAI,GAAY;IACnC,OAAO,CACL,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,KAAK,IAAI,GAAG;QACZ,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAC9B,CAAA;AACH,CAAC;AAED;qFACqF;AACrF,SAAgB,WAAW,CAAC,GAAY;IACtC,OAAO,CACL,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,WAAW,IAAI,GAAG;QAClB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAC9B,CAAA;AACH,CAAC"}
package/dist/client.d.ts CHANGED
@@ -80,7 +80,7 @@ export type InsertResult = {
80
80
  /**
81
81
  * Indicates whether the INSERT statement was executed on the server.
82
82
  * Will be `false` if there was no data to insert.
83
- * For example: if {@link InsertParams.values} was an empty array,
83
+ * For example, if {@link InsertParams.values} was an empty array,
84
84
  * the client does not send any requests to the server, and {@link executed} is false.
85
85
  */
86
86
  executed: boolean;
@@ -91,7 +91,6 @@ export type InsertResult = {
91
91
  query_id: string;
92
92
  } & WithClickHouseSummary & WithResponseHeaders;
93
93
  export type ExecResult<Stream> = ConnExecResult<Stream>;
94
- export type PingResult = ConnPingResult;
95
94
  /** {@link except} field contains a non-empty list of columns to exclude when generating `(* EXCEPT (...))` clause */
96
95
  export interface InsertColumnsExcept {
97
96
  except: NonEmptyArray<string>;
@@ -104,7 +103,7 @@ export interface InsertParams<Stream = unknown, T = unknown> extends BaseQueryPa
104
103
  /** Format of the dataset to insert. Default: `JSONCompactEachRow` */
105
104
  format?: DataFormat;
106
105
  /**
107
- * Allows to specify which columns the data will be inserted into.
106
+ * Allows specifying which columns the data will be inserted into.
108
107
  * Accepts either an array of strings (column names) or an object of {@link InsertColumnsExcept} type.
109
108
  * Examples of generated queries:
110
109
  *
@@ -117,6 +116,20 @@ export interface InsertParams<Stream = unknown, T = unknown> extends BaseQueryPa
117
116
  * See also: https://clickhouse.com/docs/en/sql-reference/statements/insert-into */
118
117
  columns?: NonEmptyArray<string> | InsertColumnsExcept;
119
118
  }
119
+ /** Parameters for the health-check request - using the built-in `/ping` endpoint.
120
+ * This is the default behavior for the Node.js version. */
121
+ export type PingParamsWithEndpoint = {
122
+ select: false;
123
+ } & Pick<BaseQueryParams, 'abort_signal' | 'http_headers'>;
124
+ /** Parameters for the health-check request - using a SELECT query.
125
+ * This is the default behavior for the Web version, as the `/ping` endpoint does not support CORS.
126
+ * Most of the standard `query` method params, e.g., `query_id`, `abort_signal`, `http_headers`, etc. will work,
127
+ * except for `query_params`, which does not make sense to allow in this method. */
128
+ export type PingParamsWithSelectQuery = {
129
+ select: true;
130
+ } & Omit<BaseQueryParams, 'query_params'>;
131
+ export type PingParams = PingParamsWithEndpoint | PingParamsWithSelectQuery;
132
+ export type PingResult = ConnPingResult;
120
133
  export declare class ClickHouseClient<Stream = unknown> {
121
134
  private readonly clientClickHouseSettings;
122
135
  private readonly connectionParams;
@@ -139,7 +152,7 @@ export declare class ClickHouseClient<Stream = unknown> {
139
152
  /**
140
153
  * It should be used for statements that do not have any output,
141
154
  * when the format clause is not applicable, or when you are not interested in the response at all.
142
- * Response stream is destroyed immediately as we do not expect useful information there.
155
+ * The response stream is destroyed immediately as we do not expect useful information there.
143
156
  * Examples of such statements are DDLs or custom inserts.
144
157
  *
145
158
  * @note if you have a custom query that does not work with {@link ClickHouseClient.query},
@@ -166,10 +179,15 @@ export declare class ClickHouseClient<Stream = unknown> {
166
179
  */
167
180
  insert<T>(params: InsertParams<Stream, T>): Promise<InsertResult>;
168
181
  /**
169
- * Health-check request. It does not throw if an error occurs -
170
- * the error is returned inside the result object.
182
+ * A health-check request. It does not throw if an error occurs - the error is returned inside the result object.
183
+ *
184
+ * By default, Node.js version uses the built-in `/ping` endpoint, which does not verify credentials.
185
+ * Optionally, it can be switched to a `SELECT` query (see {@link PingParamsWithSelectQuery}).
186
+ * In that case, the server will verify the credentials.
187
+ *
188
+ * **NOTE**: Since the `/ping` endpoint does not support CORS, the Web version always uses a `SELECT` query.
171
189
  */
172
- ping(): Promise<PingResult>;
190
+ ping(params?: PingParams): Promise<PingResult>;
173
191
  /**
174
192
  * Shuts down the underlying connection.
175
193
  * This method should ideally be called only once per application lifecycle,
package/dist/client.js CHANGED
@@ -99,7 +99,7 @@ class ClickHouseClient {
99
99
  /**
100
100
  * It should be used for statements that do not have any output,
101
101
  * when the format clause is not applicable, or when you are not interested in the response at all.
102
- * Response stream is destroyed immediately as we do not expect useful information there.
102
+ * The response stream is destroyed immediately as we do not expect useful information there.
103
103
  * Examples of such statements are DDLs or custom inserts.
104
104
  *
105
105
  * @note if you have a custom query that does not work with {@link ClickHouseClient.query},
@@ -155,11 +155,16 @@ class ClickHouseClient {
155
155
  return { ...result, executed: true };
156
156
  }
157
157
  /**
158
- * Health-check request. It does not throw if an error occurs -
159
- * the error is returned inside the result object.
158
+ * A health-check request. It does not throw if an error occurs - the error is returned inside the result object.
159
+ *
160
+ * By default, Node.js version uses the built-in `/ping` endpoint, which does not verify credentials.
161
+ * Optionally, it can be switched to a `SELECT` query (see {@link PingParamsWithSelectQuery}).
162
+ * In that case, the server will verify the credentials.
163
+ *
164
+ * **NOTE**: Since the `/ping` endpoint does not support CORS, the Web version always uses a `SELECT` query.
160
165
  */
161
- async ping() {
162
- return await this.connection.ping();
166
+ async ping(params) {
167
+ return await this.connection.ping(params ?? { select: false });
163
168
  }
164
169
  /**
165
170
  * Shuts down the underlying connection.
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../packages/client-common/src/client.ts"],"names":[],"mappings":";;;AAYA,6DAA0E;AAG1E,qCAAoE;AAoIpE,MAAa,gBAAgB;IAU3B,YACE,MAAyE;QAV1D;;;;;WAA4C;QAC5C;;;;;WAAkC;QAClC;;;;;WAA8B;QAC9B;;;;;WAAoC;QACpC;;;;;WAAoC;QACpC;;;;;WAAkB;QAClB;;;;;WAA6B;QAC7B;;;;;WAAoB;QAKnC,MAAM,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,WAAW;YACrC,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE;YAC9B,CAAC,CAAC,IAAI,6BAAa,EAAE,CAAA;QACvB,MAAM,aAAa,GAAG,IAAA,6BAAoB,EACxC,MAAM,EACN,MAAM,EACN,MAAM,CAAC,IAAI,CAAC,0BAA0B,IAAI,IAAI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IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;QACnE,CAAC;IACH,CAAC;IACD,OAAO,eAAe,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,WAAW,WAAW,MAAM,EAAE,CAAA;AAC5E,CAAC"}
@@ -44,6 +44,9 @@ export interface ConnBaseQueryParams {
44
44
  role?: string | Array<string>;
45
45
  http_headers?: Record<string, string>;
46
46
  }
47
+ export type ConnPingParams = {
48
+ select: boolean;
49
+ } & Omit<ConnBaseQueryParams, 'query' | 'query_params'>;
47
50
  export interface ConnInsertParams<Stream> extends ConnBaseQueryParams {
48
51
  values: string | Stream;
49
52
  }
@@ -69,10 +72,10 @@ export type ConnPingResult = {
69
72
  };
70
73
  export type ConnOperation = 'Ping' | 'Query' | 'Insert' | 'Exec' | 'Command';
71
74
  export interface Connection<Stream> {
72
- ping(): Promise<ConnPingResult>;
73
- close(): Promise<void>;
75
+ ping(params: ConnPingParams): Promise<ConnPingResult>;
74
76
  query(params: ConnBaseQueryParams): Promise<ConnQueryResult<Stream>>;
75
77
  insert(params: ConnInsertParams<Stream>): Promise<ConnInsertResult>;
76
- exec(params: ConnExecParams<Stream>): Promise<ConnExecResult<Stream>>;
77
78
  command(params: ConnBaseQueryParams): Promise<ConnCommandResult>;
79
+ exec(params: ConnExecParams<Stream>): Promise<ConnExecResult<Stream>>;
80
+ close(): Promise<void>;
78
81
  }
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  /** Should be re-exported by the implementation */
2
- export { type BaseQueryParams, type QueryParams, type QueryResult, type ExecParams, type InsertParams, ClickHouseClient, type CommandParams, type CommandResult, type ExecResult, type InsertResult, type PingResult, } from './client';
2
+ export { type BaseQueryParams, type QueryParams, type QueryResult, type ExecParams, type InsertParams, ClickHouseClient, type CommandParams, type CommandResult, type ExecResult, type InsertResult, type PingResult, type PingParams, type PingParamsWithSelectQuery, type PingParamsWithEndpoint, } from './client';
3
3
  export { type BaseClickHouseClientConfigOptions } from './config';
4
4
  export type { Row, RowOrProgress, BaseResultSet, ResultJSONType, RowJSONType, ResultStream, } from './result';
5
5
  export type { DataFormat, RawDataFormat, JSONDataFormat, StreamableDataFormat, StreamableJSONDataFormat, SingleDocumentJSONFormat, SupportedJSONFormats, SupportedRawFormats, StreamableFormats, StreamableJSONFormats, SingleDocumentJSONFormats, RecordsJSONFormats, } from './data_formatter';
6
6
  export { TupleParam } from './data_formatter';
7
- export { ClickHouseError } from './error';
7
+ export { ClickHouseError, parseError } from './error';
8
8
  export { ClickHouseLogLevel, type ErrorLogParams, type WarnLogParams, type Logger, type LogParams, } from './logger';
9
9
  export type { ClickHouseSummary, InputJSON, InputJSONObjectEachRow, ResponseJSON, ResponseHeaders, WithClickHouseSummary, WithResponseHeaders, ProgressRow, InsertValues, ClickHouseAuth, ClickHouseJWTAuth, ClickHouseCredentialsAuth, } from './clickhouse_types';
10
- export { isProgressRow } from './clickhouse_types';
10
+ export { isProgressRow, isRow, isException } from './clickhouse_types';
11
11
  export { type ClickHouseSettings, type MergeTreeSettings, SettingsMap, } from './settings';
12
12
  export type { SimpleColumnType, ParsedColumnSimple, ParsedColumnEnum, ParsedColumnFixedString, ParsedColumnNullable, ParsedColumnDecimal, ParsedColumnDateTime, ParsedColumnDateTime64, ParsedColumnArray, ParsedColumnTuple, ParsedColumnMap, ParsedColumnType, } from './parse';
13
13
  export { SimpleColumnTypes, parseColumnType } from './parse';
@@ -16,7 +16,7 @@ export { formatQuerySettings, formatQueryParams, encodeJSON, isSupportedRawForma
16
16
  export { type ValuesEncoder, type MakeResultSet, type MakeConnection, type HandleImplSpecificURLParams, type ImplementationDetails, booleanConfigURLValue, enumConfigURLValue, getConnectionParams, numberConfigURLValue, } from './config';
17
17
  export { isSuccessfulResponse, sleep, toSearchParams, transformUrl, withCompressionHeaders, withHttpSettings, isCredentialsAuth, isJWTAuth, } from './utils';
18
18
  export { LogWriter, DefaultLogger, type LogWriterParams } from './logger';
19
- export { parseError, getCurrentStackTrace, enhanceStackTrace } from './error';
20
- export type { CompressionSettings, Connection, ConnectionParams, ConnInsertResult, ConnExecParams, ConnExecResult, ConnQueryResult, ConnBaseQueryParams, ConnBaseResult, ConnInsertParams, ConnPingResult, ConnCommandResult, ConnOperation, } from './connection';
19
+ export { getCurrentStackTrace, enhanceStackTrace } from './error';
20
+ export type { CompressionSettings, Connection, ConnectionParams, ConnInsertResult, ConnExecParams, ConnExecResult, ConnQueryResult, ConnBaseQueryParams, ConnBaseResult, ConnInsertParams, ConnPingResult, ConnCommandResult, ConnOperation, ConnPingParams, } from './connection';
21
21
  export type { QueryParamsWithFormat } from './client';
22
22
  export type { IsSame } from './ts_utils';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.enhanceStackTrace = exports.getCurrentStackTrace = exports.parseError = exports.DefaultLogger = exports.LogWriter = exports.isJWTAuth = exports.isCredentialsAuth = exports.withHttpSettings = exports.withCompressionHeaders = exports.transformUrl = exports.toSearchParams = exports.sleep = exports.isSuccessfulResponse = exports.numberConfigURLValue = exports.getConnectionParams = exports.enumConfigURLValue = exports.booleanConfigURLValue = exports.validateStreamFormat = exports.isNotStreamableJSONFamily = exports.isStreamableJSONFamily = exports.isSupportedRawFormat = exports.encodeJSON = exports.formatQueryParams = exports.formatQuerySettings = exports.parseColumnType = exports.SimpleColumnTypes = exports.SettingsMap = exports.isProgressRow = exports.ClickHouseLogLevel = exports.ClickHouseError = exports.TupleParam = exports.ClickHouseClient = void 0;
3
+ exports.enhanceStackTrace = exports.getCurrentStackTrace = exports.DefaultLogger = exports.LogWriter = exports.isJWTAuth = exports.isCredentialsAuth = exports.withHttpSettings = exports.withCompressionHeaders = exports.transformUrl = exports.toSearchParams = exports.sleep = exports.isSuccessfulResponse = exports.numberConfigURLValue = exports.getConnectionParams = exports.enumConfigURLValue = exports.booleanConfigURLValue = exports.validateStreamFormat = exports.isNotStreamableJSONFamily = exports.isStreamableJSONFamily = exports.isSupportedRawFormat = exports.encodeJSON = exports.formatQueryParams = exports.formatQuerySettings = exports.parseColumnType = exports.SimpleColumnTypes = exports.SettingsMap = exports.isException = exports.isRow = exports.isProgressRow = exports.ClickHouseLogLevel = exports.parseError = exports.ClickHouseError = exports.TupleParam = exports.ClickHouseClient = void 0;
4
4
  /** Should be re-exported by the implementation */
5
5
  var client_1 = require("./client");
6
6
  Object.defineProperty(exports, "ClickHouseClient", { enumerable: true, get: function () { return client_1.ClickHouseClient; } });
@@ -8,10 +8,13 @@ var data_formatter_1 = require("./data_formatter");
8
8
  Object.defineProperty(exports, "TupleParam", { enumerable: true, get: function () { return data_formatter_1.TupleParam; } });
9
9
  var error_1 = require("./error");
10
10
  Object.defineProperty(exports, "ClickHouseError", { enumerable: true, get: function () { return error_1.ClickHouseError; } });
11
+ Object.defineProperty(exports, "parseError", { enumerable: true, get: function () { return error_1.parseError; } });
11
12
  var logger_1 = require("./logger");
12
13
  Object.defineProperty(exports, "ClickHouseLogLevel", { enumerable: true, get: function () { return logger_1.ClickHouseLogLevel; } });
13
14
  var clickhouse_types_1 = require("./clickhouse_types");
14
15
  Object.defineProperty(exports, "isProgressRow", { enumerable: true, get: function () { return clickhouse_types_1.isProgressRow; } });
16
+ Object.defineProperty(exports, "isRow", { enumerable: true, get: function () { return clickhouse_types_1.isRow; } });
17
+ Object.defineProperty(exports, "isException", { enumerable: true, get: function () { return clickhouse_types_1.isException; } });
15
18
  var settings_1 = require("./settings");
16
19
  Object.defineProperty(exports, "SettingsMap", { enumerable: true, get: function () { return settings_1.SettingsMap; } });
17
20
  var parse_1 = require("./parse");
@@ -44,7 +47,6 @@ var logger_2 = require("./logger");
44
47
  Object.defineProperty(exports, "LogWriter", { enumerable: true, get: function () { return logger_2.LogWriter; } });
45
48
  Object.defineProperty(exports, "DefaultLogger", { enumerable: true, get: function () { return logger_2.DefaultLogger; } });
46
49
  var error_2 = require("./error");
47
- Object.defineProperty(exports, "parseError", { enumerable: true, get: function () { return error_2.parseError; } });
48
50
  Object.defineProperty(exports, "getCurrentStackTrace", { enumerable: true, get: function () { return error_2.getCurrentStackTrace; } });
49
51
  Object.defineProperty(exports, "enhanceStackTrace", { enumerable: true, get: function () { return error_2.enhanceStackTrace; } });
50
52
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/client-common/src/index.ts"],"names":[],"mappings":";;;AAAA,kDAAkD;AAClD,mCAYiB;AANf,0GAAA,gBAAgB,OAAA;AA8BlB,mDAA6C;AAApC,4GAAA,UAAU,OAAA;AACnB,iCAAyC;AAAhC,wGAAA,eAAe,OAAA;AACxB,mCAMiB;AALf,4GAAA,kBAAkB,OAAA;AAoBpB,uDAAkD;AAAzC,iHAAA,aAAa,OAAA;AACtB,uCAImB;AADjB,uGAAA,WAAW,OAAA;AAgBb,iCAA4D;AAAnD,0GAAA,iBAAiB,OAAA;AAAE,wGAAA,eAAe,OAAA;AAE3C,gEAAgE;AAChE,mDAQyB;AAPvB,qHAAA,mBAAmB,OAAA;AACnB,mHAAA,iBAAiB,OAAA;AACjB,4GAAA,UAAU,OAAA;AACV,sHAAA,oBAAoB,OAAA;AACpB,wHAAA,sBAAsB,OAAA;AACtB,2HAAA,yBAAyB,OAAA;AACzB,sHAAA,oBAAoB,OAAA;AAEtB,mCAUiB;AAJf,+GAAA,qBAAqB,OAAA;AACrB,4GAAA,kBAAkB,OAAA;AAClB,6GAAA,mBAAmB,OAAA;AACnB,8GAAA,oBAAoB,OAAA;AAEtB,iCASgB;AARd,6GAAA,oBAAoB,OAAA;AACpB,8FAAA,KAAK,OAAA;AACL,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,+GAAA,sBAAsB,OAAA;AACtB,yGAAA,gBAAgB,OAAA;AAChB,0GAAA,iBAAiB,OAAA;AACjB,kGAAA,SAAS,OAAA;AAEX,mCAAyE;AAAhE,mGAAA,SAAS,OAAA;AAAE,uGAAA,aAAa,OAAA;AACjC,iCAA6E;AAApE,mGAAA,UAAU,OAAA;AAAE,6GAAA,oBAAoB,OAAA;AAAE,0GAAA,iBAAiB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/client-common/src/index.ts"],"names":[],"mappings":";;;AAAA,kDAAkD;AAClD,mCAeiB;AATf,0GAAA,gBAAgB,OAAA;AAiClB,mDAA6C;AAApC,4GAAA,UAAU,OAAA;AACnB,iCAAqD;AAA5C,wGAAA,eAAe,OAAA;AAAE,mGAAA,UAAU,OAAA;AACpC,mCAMiB;AALf,4GAAA,kBAAkB,OAAA;AAoBpB,uDAAsE;AAA7D,iHAAA,aAAa,OAAA;AAAE,yGAAA,KAAK,OAAA;AAAE,+GAAA,WAAW,OAAA;AAC1C,uCAImB;AADjB,uGAAA,WAAW,OAAA;AAgBb,iCAA4D;AAAnD,0GAAA,iBAAiB,OAAA;AAAE,wGAAA,eAAe,OAAA;AAE3C,gEAAgE;AAChE,mDAQyB;AAPvB,qHAAA,mBAAmB,OAAA;AACnB,mHAAA,iBAAiB,OAAA;AACjB,4GAAA,UAAU,OAAA;AACV,sHAAA,oBAAoB,OAAA;AACpB,wHAAA,sBAAsB,OAAA;AACtB,2HAAA,yBAAyB,OAAA;AACzB,sHAAA,oBAAoB,OAAA;AAEtB,mCAUiB;AAJf,+GAAA,qBAAqB,OAAA;AACrB,4GAAA,kBAAkB,OAAA;AAClB,6GAAA,mBAAmB,OAAA;AACnB,8GAAA,oBAAoB,OAAA;AAEtB,iCASgB;AARd,6GAAA,oBAAoB,OAAA;AACpB,8FAAA,KAAK,OAAA;AACL,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,+GAAA,sBAAsB,OAAA;AACtB,yGAAA,gBAAgB,OAAA;AAChB,0GAAA,iBAAiB,OAAA;AACjB,kGAAA,SAAS,OAAA;AAEX,mCAAyE;AAAhE,mGAAA,SAAS,OAAA;AAAE,uGAAA,aAAa,OAAA;AACjC,iCAAiE;AAAxD,6GAAA,oBAAoB,OAAA;AAAE,0GAAA,iBAAiB,OAAA"}
package/dist/result.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import type { ProgressRow, ResponseHeaders, ResponseJSON } from './clickhouse_types';
1
+ import type { ProgressRow, ResponseHeaders, ResponseJSON, SpecialEventRow } from './clickhouse_types';
2
2
  import type { DataFormat, RawDataFormat, RecordsJSONFormat, SingleDocumentJSONFormat, StreamableDataFormat, StreamableJSONDataFormat } from './data_formatter';
3
3
  export type RowOrProgress<T> = {
4
4
  row: T;
5
- } | ProgressRow;
5
+ } | ProgressRow | SpecialEventRow<T>;
6
6
  export type ResultStream<Format extends DataFormat | unknown, Stream> = Format extends StreamableDataFormat ? Stream : Format extends SingleDocumentJSONFormat ? never : Format extends RecordsJSONFormat ? never : Stream;
7
7
  export type ResultJSONType<T, F extends DataFormat | unknown> = F extends 'JSONEachRowWithProgress' ? RowOrProgress<T>[] : F extends StreamableJSONDataFormat ? T[] : F extends SingleDocumentJSONFormat ? ResponseJSON<T> : F extends RecordsJSONFormat ? Record<string, T> : F extends RawDataFormat ? never : // happens only when Format could not be inferred from a literal
8
8
  T[] | Record<string, T> | ResponseJSON<T>;
@@ -36,7 +36,7 @@ export interface BaseResultSet<Stream, Format extends DataFormat | unknown> {
36
36
  *
37
37
  * The method should throw if the underlying stream was already consumed
38
38
  * by calling the other methods, or if it is called for non-JSON formats,
39
- * such as CSV, TSV etc.
39
+ * such as CSV, TSV, etc.
40
40
  */
41
41
  json<T = unknown>(): Promise<ResultJSONType<T, Format>>;
42
42
  /**
@@ -72,6 +72,18 @@ interface ClickHouseServerSettings {
72
72
  allow_experimental_undrop_table_query?: Bool;
73
73
  /** Enable WINDOW VIEW. Not mature enough. */
74
74
  allow_experimental_window_view?: Bool;
75
+ /** Support join with inequal conditions which involve columns from both left and right table. e.g. t1.y < t2.y. */
76
+ allow_experimental_join_condition?: Bool;
77
+ /** Since ClickHouse 24.1 */
78
+ allow_experimental_variant_type?: Bool;
79
+ /** Since ClickHouse 24.5 */
80
+ allow_experimental_dynamic_type?: Bool;
81
+ /** Since ClickHouse 24.8 */
82
+ allow_experimental_json_type?: Bool;
83
+ /** Since ClickHouse 25.3 */
84
+ enable_json_type?: Bool;
85
+ /** Since ClickHouse 25.6 */
86
+ enable_time_time64_type?: Bool;
75
87
  /** Allow functions that use Hyperscan library. Disable to avoid potentially long compilation times and excessive resource usage. */
76
88
  allow_hyperscan?: Bool;
77
89
  /** Allow functions for introspection of ELF and DWARF for query profiling. These functions are slow and may impose security considerations. */
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../packages/client-common/src/settings.ts"],"names":[],"mappings":";;;AA64DA,MAAa,WAAW;IACtB,YAAqC,MAA8B;QAA/C;;;;mBAAiB,MAAM;WAAwB;IAAG,CAAC;IAEvE,QAAQ;QACN,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;aACnC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;aAChC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAA;IACjB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAA8B;QACxC,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,CAAA;IACzB,CAAC;CACF;AAZD,kCAYC"}
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../packages/client-common/src/settings.ts"],"names":[],"mappings":";;;AAy5DA,MAAa,WAAW;IACtB,YAAqC,MAA8B;QAA/C;;;;mBAAiB,MAAM;WAAwB;IAAG,CAAC;IAEvE,QAAQ;QACN,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;aACnC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;aAChC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAA;IACjB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAA8B;QACxC,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,CAAA;IACzB,CAAC;CACF;AAZD,kCAYC"}
@@ -5,7 +5,7 @@ export declare function transformUrl({ url, pathname, searchParams, }: {
5
5
  searchParams?: URLSearchParams;
6
6
  }): URL;
7
7
  type ToSearchParamsOptions = {
8
- database: string;
8
+ database: string | undefined;
9
9
  clickhouse_settings?: ClickHouseSettings;
10
10
  query_params?: Record<string, unknown>;
11
11
  query?: string;
package/dist/utils/url.js CHANGED
@@ -24,40 +24,39 @@ function transformUrl({ url, pathname, searchParams, }) {
24
24
  // TODO validate max length of the resulting query
25
25
  // https://stackoverflow.com/questions/812925/what-is-the-maximum-possible-length-of-a-query-string
26
26
  function toSearchParams({ database, query, query_params, clickhouse_settings, session_id, query_id, role, }) {
27
- const params = new URLSearchParams();
28
- params.set('query_id', query_id);
27
+ const entries = [['query_id', query_id]];
29
28
  if (query_params !== undefined) {
30
29
  for (const [key, value] of Object.entries(query_params)) {
31
30
  const formattedParam = (0, data_formatter_1.formatQueryParams)({ value });
32
- params.set(`param_${key}`, formattedParam);
31
+ entries.push([`param_${key}`, formattedParam]);
33
32
  }
34
33
  }
35
34
  if (clickhouse_settings !== undefined) {
36
35
  for (const [key, value] of Object.entries(clickhouse_settings)) {
37
36
  if (value !== undefined) {
38
- params.set(key, (0, data_formatter_1.formatQuerySettings)(value));
37
+ entries.push([key, (0, data_formatter_1.formatQuerySettings)(value)]);
39
38
  }
40
39
  }
41
40
  }
42
- if (database !== 'default') {
43
- params.set('database', database);
41
+ if (database !== undefined && database !== 'default') {
42
+ entries.push(['database', database]);
44
43
  }
45
44
  if (query) {
46
- params.set('query', query);
45
+ entries.push(['query', query]);
47
46
  }
48
47
  if (session_id) {
49
- params.set('session_id', session_id);
48
+ entries.push(['session_id', session_id]);
50
49
  }
51
50
  if (role) {
52
51
  if (typeof role === 'string') {
53
- params.set('role', role);
52
+ entries.push(['role', role]);
54
53
  }
55
54
  else if (Array.isArray(role)) {
56
55
  for (const r of role) {
57
- params.append('role', r);
56
+ entries.push(['role', r]);
58
57
  }
59
58
  }
60
59
  }
61
- return params;
60
+ return new URLSearchParams(entries);
62
61
  }
63
62
  //# sourceMappingURL=url.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"url.js","sourceRoot":"","sources":["../../../../packages/client-common/src/utils/url.ts"],"names":[],"mappings":";;AAGA,oCA2BC;AAcD,wCAkDC;AA9FD,sDAA0E;AAG1E,SAAgB,YAAY,CAAC,EAC3B,GAAG,EACH,QAAQ,EACR,YAAY,GAKb;IACC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;IAE3B,IAAI,QAAQ,EAAE,CAAC;QACb,oEAAoE;QACpE,wEAAwE;QACxE,2DAA2D;QAC3D,IAAI,MAAM,CAAC,QAAQ,KAAK,GAAG,EAAE,CAAC;YAC5B,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAA;QAC5B,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,QAAQ,IAAI,QAAQ,CAAA;QAC7B,CAAC;IACH,CAAC;IAED,IAAI,YAAY,EAAE,CAAC;QACjB,MAAM,CAAC,MAAM,GAAG,YAAY,EAAE,QAAQ,EAAE,CAAA;IAC1C,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAYD,kDAAkD;AAClD,mGAAmG;AACnG,SAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,IAAI,GACkB;IACtB,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAA;IACpC,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IAEhC,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,KAAK,MAAM,CAAC,GA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1.12.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.11.2';
3
+ exports.default = '1.12.1';
4
4
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@clickhouse/client-common",
3
3
  "description": "Official JS client for ClickHouse DB - common types",
4
4
  "homepage": "https://clickhouse.com",
5
- "version": "1.11.2",
5
+ "version": "1.12.1",
6
6
  "license": "Apache-2.0",
7
7
  "keywords": [
8
8
  "clickhouse",