@clickhouse/client-common 0.3.1 → 0.4.0
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/LICENSE +2 -2
- package/README.md +14 -0
- package/dist/clickhouse_types.d.ts +59 -1
- package/dist/clickhouse_types.js +27 -0
- package/dist/clickhouse_types.js.map +1 -1
- package/dist/client.d.ts +126 -95
- package/dist/client.js +119 -76
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +173 -0
- package/dist/config.js +309 -0
- package/dist/config.js.map +1 -0
- package/dist/connection.d.ts +44 -13
- package/dist/connection.js.map +1 -1
- package/dist/data_formatter/format_query_params.d.ts +11 -1
- package/dist/data_formatter/format_query_params.js +74 -13
- package/dist/data_formatter/format_query_params.js.map +1 -1
- package/dist/data_formatter/format_query_settings.js +1 -2
- package/dist/data_formatter/format_query_settings.js.map +1 -1
- package/dist/data_formatter/formatter.d.ts +32 -14
- package/dist/data_formatter/formatter.js +27 -46
- package/dist/data_formatter/formatter.js.map +1 -1
- package/dist/data_formatter/index.d.ts +1 -1
- package/dist/data_formatter/index.js +2 -1
- package/dist/data_formatter/index.js.map +1 -1
- package/dist/error/error.d.ts +20 -0
- package/dist/error/error.js +69 -0
- package/dist/error/error.js.map +1 -0
- package/dist/error/index.d.ts +1 -1
- package/dist/error/index.js +1 -1
- package/dist/error/index.js.map +1 -1
- package/dist/index.d.ts +18 -12
- package/dist/index.js +34 -12
- package/dist/index.js.map +1 -1
- package/dist/logger.js +8 -8
- package/dist/logger.js.map +1 -1
- package/dist/parse/column_types.d.ts +127 -0
- package/dist/parse/column_types.js +540 -0
- package/dist/parse/column_types.js.map +1 -0
- package/dist/parse/index.d.ts +2 -0
- package/dist/parse/index.js +19 -0
- package/dist/parse/index.js.map +1 -0
- package/dist/parse/json_handling.d.ts +19 -0
- package/dist/parse/json_handling.js +8 -0
- package/dist/parse/json_handling.js.map +1 -0
- package/dist/result.d.ts +52 -8
- package/dist/result.js.map +1 -1
- package/dist/settings.d.ts +38 -2
- package/dist/settings.js.map +1 -1
- package/dist/ts_utils.d.ts +4 -0
- package/dist/ts_utils.js +3 -0
- package/dist/ts_utils.js.map +1 -0
- package/dist/utils/connection.d.ts +11 -3
- package/dist/utils/connection.js +19 -7
- package/dist/utils/connection.js.map +1 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/sleep.d.ts +1 -0
- package/dist/utils/sleep.js +9 -0
- package/dist/utils/sleep.js.map +1 -0
- package/dist/utils/stream.d.ts +14 -0
- package/dist/utils/stream.js +53 -0
- package/dist/utils/stream.js.map +1 -0
- package/dist/utils/url.d.ts +5 -4
- package/dist/utils/url.js +22 -13
- package/dist/utils/url.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +6 -2
- package/dist/error/parse_error.d.ts +0 -12
- package/dist/error/parse_error.js +0 -41
- package/dist/error/parse_error.js.map +0 -1
- package/dist/utils/permutations.d.ts +0 -1
- package/dist/utils/permutations.js +0 -12
- package/dist/utils/permutations.js.map +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./column_types"), exports);
|
|
18
|
+
__exportStar(require("./json_handling"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parse/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,kDAA+B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface JSONHandling {
|
|
2
|
+
/**
|
|
3
|
+
* Custom parser for JSON strings
|
|
4
|
+
*
|
|
5
|
+
* @param input stringified JSON
|
|
6
|
+
* @default JSON.parse // See {@link JSON.parse}
|
|
7
|
+
* @returns parsed object
|
|
8
|
+
*/
|
|
9
|
+
parse: <T>(input: string) => T;
|
|
10
|
+
/**
|
|
11
|
+
* Custom stringifier for JSON objects
|
|
12
|
+
*
|
|
13
|
+
* @param input any JSON-compatible object
|
|
14
|
+
* @default JSON.stringify // See {@link JSON.stringify}
|
|
15
|
+
* @returns stringified JSON
|
|
16
|
+
*/
|
|
17
|
+
stringify: <T = any>(input: T) => string;
|
|
18
|
+
}
|
|
19
|
+
export declare const defaultJSONHandling: JSONHandling;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json_handling.js","sourceRoot":"","sources":["../../src/parse/json_handling.ts"],"names":[],"mappings":";;;AAmBa,QAAA,mBAAmB,GAAiB;IAC/C,KAAK,EAAE,IAAI,CAAC,KAAK;IACjB,SAAS,EAAE,IAAI,CAAC,SAAS;CAC1B,CAAA"}
|
package/dist/result.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ProgressRow, ResponseHeaders, ResponseJSON, SpecialEventRow } from './clickhouse_types';
|
|
2
|
+
import type { DataFormat, RawDataFormat, RecordsJSONFormat, SingleDocumentJSONFormat, StreamableDataFormat, StreamableJSONDataFormat } from './data_formatter';
|
|
3
|
+
export type RowOrProgress<T> = {
|
|
4
|
+
row: T;
|
|
5
|
+
} | ProgressRow | SpecialEventRow<T>;
|
|
6
|
+
export type ResultStream<Format extends DataFormat | unknown, Stream> = Format extends StreamableDataFormat ? Stream : Format extends SingleDocumentJSONFormat ? never : Format extends RecordsJSONFormat ? never : Stream;
|
|
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
|
+
T[] | Record<string, T> | ResponseJSON<T>;
|
|
9
|
+
export type RowJSONType<T, F extends DataFormat | unknown> = F extends 'JSONEachRowWithProgress' ? RowOrProgress<T> : F extends StreamableJSONDataFormat ? T : F extends RawDataFormat | SingleDocumentJSONFormat | RecordsJSONFormat ? never : T;
|
|
10
|
+
export interface Row<JSONType = unknown, Format extends DataFormat | unknown = unknown> {
|
|
2
11
|
/** A string representation of a row. */
|
|
3
12
|
text: string;
|
|
4
13
|
/**
|
|
@@ -6,13 +15,15 @@ export interface Row {
|
|
|
6
15
|
* The method will throw if called on a response in JSON incompatible format.
|
|
7
16
|
* It is safe to call this method multiple times.
|
|
8
17
|
*/
|
|
9
|
-
json<T>(): T
|
|
18
|
+
json<T = JSONType>(): RowJSONType<T, Format>;
|
|
10
19
|
}
|
|
11
|
-
export interface BaseResultSet<Stream> {
|
|
20
|
+
export interface BaseResultSet<Stream, Format extends DataFormat | unknown> {
|
|
12
21
|
/**
|
|
13
22
|
* The method waits for all the rows to be fully loaded
|
|
14
23
|
* and returns the result as a string.
|
|
15
24
|
*
|
|
25
|
+
* It is possible to call this method for all supported formats.
|
|
26
|
+
*
|
|
16
27
|
* The method should throw if the underlying stream was already consumed
|
|
17
28
|
* by calling the other methods.
|
|
18
29
|
*/
|
|
@@ -21,13 +32,44 @@ export interface BaseResultSet<Stream> {
|
|
|
21
32
|
* The method waits for the all the rows to be fully loaded.
|
|
22
33
|
* When the response is received in full, it will be decoded to return JSON.
|
|
23
34
|
*
|
|
35
|
+
* Should be called only for JSON* formats family.
|
|
36
|
+
*
|
|
24
37
|
* The method should throw if the underlying stream was already consumed
|
|
25
|
-
* by calling the other methods
|
|
38
|
+
* by calling the other methods, or if it is called for non-JSON formats,
|
|
39
|
+
* such as CSV, TSV, etc.
|
|
26
40
|
*/
|
|
27
|
-
json<T>(): Promise<T
|
|
41
|
+
json<T = unknown>(): Promise<ResultJSONType<T, Format>>;
|
|
28
42
|
/**
|
|
29
|
-
* Returns a readable stream for responses that can be streamed
|
|
30
|
-
*
|
|
43
|
+
* Returns a readable stream for responses that can be streamed.
|
|
44
|
+
*
|
|
45
|
+
* Formats that CAN be streamed ({@link StreamableDataFormat}):
|
|
46
|
+
* * JSONEachRow
|
|
47
|
+
* * JSONStringsEachRow
|
|
48
|
+
* * JSONCompactEachRow
|
|
49
|
+
* * JSONCompactStringsEachRow
|
|
50
|
+
* * JSONCompactEachRowWithNames
|
|
51
|
+
* * JSONCompactEachRowWithNamesAndTypes
|
|
52
|
+
* * JSONCompactStringsEachRowWithNames
|
|
53
|
+
* * JSONCompactStringsEachRowWithNamesAndTypes
|
|
54
|
+
* * CSV
|
|
55
|
+
* * CSVWithNames
|
|
56
|
+
* * CSVWithNamesAndTypes
|
|
57
|
+
* * TabSeparated
|
|
58
|
+
* * TabSeparatedRaw
|
|
59
|
+
* * TabSeparatedWithNames
|
|
60
|
+
* * TabSeparatedWithNamesAndTypes
|
|
61
|
+
* * CustomSeparated
|
|
62
|
+
* * CustomSeparatedWithNames
|
|
63
|
+
* * CustomSeparatedWithNamesAndTypes
|
|
64
|
+
* * Parquet
|
|
65
|
+
*
|
|
66
|
+
* Formats that CANNOT be streamed (the method returns "never" in TS):
|
|
67
|
+
* * JSON
|
|
68
|
+
* * JSONStrings
|
|
69
|
+
* * JSONCompact
|
|
70
|
+
* * JSONCompactStrings
|
|
71
|
+
* * JSONColumnsWithMetadata
|
|
72
|
+
* * JSONObjectEachRow
|
|
31
73
|
*
|
|
32
74
|
* Every iteration provides an array of {@link Row} instances
|
|
33
75
|
* for {@link StreamableDataFormat} format.
|
|
@@ -38,9 +80,11 @@ export interface BaseResultSet<Stream> {
|
|
|
38
80
|
* and if the underlying stream was already consumed
|
|
39
81
|
* by calling the other methods.
|
|
40
82
|
*/
|
|
41
|
-
stream(): Stream
|
|
83
|
+
stream(): ResultStream<Format, Stream>;
|
|
42
84
|
/** Close the underlying stream. */
|
|
43
85
|
close(): void;
|
|
44
86
|
/** ClickHouse server QueryID. */
|
|
45
87
|
query_id: string;
|
|
88
|
+
/** Response headers. */
|
|
89
|
+
response_headers: ResponseHeaders;
|
|
46
90
|
}
|
package/dist/result.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":""}
|
package/dist/settings.d.ts
CHANGED
|
@@ -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. */
|
|
@@ -160,7 +172,9 @@ interface ClickHouseServerSettings {
|
|
|
160
172
|
bool_true_representation?: string;
|
|
161
173
|
/** Calculate text stack trace in case of exceptions during query execution. This is the default. It requires symbol lookups that may slow down fuzzing tests when huge amount of wrong queries are executed. In normal cases you should not disable this option. */
|
|
162
174
|
calculate_text_stack_trace?: Bool;
|
|
163
|
-
/** Cancel HTTP readonly queries when a client closes the connection without waiting for response.
|
|
175
|
+
/** Cancel HTTP readonly queries when a client closes the connection without waiting for response.
|
|
176
|
+
* @see https://clickhouse.com/docs/operations/settings/settings#cancel_http_readonly_queries_on_client_close
|
|
177
|
+
*/
|
|
164
178
|
cancel_http_readonly_queries_on_client_close?: Bool;
|
|
165
179
|
/** CAST operator into IPv4, CAST operator into IPV6 type, toIPv4, toIPv6 functions will return default value instead of throwing exception on conversion error. */
|
|
166
180
|
cast_ipv4_ipv6_default_on_conversion_error?: Bool;
|
|
@@ -614,6 +628,8 @@ interface ClickHouseServerSettings {
|
|
|
614
628
|
input_format_json_read_numbers_as_strings?: Bool;
|
|
615
629
|
/** Allow to parse JSON objects as strings in JSON input formats */
|
|
616
630
|
input_format_json_read_objects_as_strings?: Bool;
|
|
631
|
+
/** Throw an exception if JSON string contains bad escape sequence. If disabled, bad escape sequences will remain as is in the data. Default value - true. */
|
|
632
|
+
input_format_json_throw_on_bad_escape_sequence?: Bool;
|
|
617
633
|
/** Try to infer numbers from string fields while schema inference */
|
|
618
634
|
input_format_json_try_infer_numbers_from_strings?: Bool;
|
|
619
635
|
/** For JSON/JSONCompact/JSONColumnsWithMetadata input formats this controls whether format parser should check if data types from input metadata match data types of the corresponding columns from the table */
|
|
@@ -754,6 +770,8 @@ interface ClickHouseServerSettings {
|
|
|
754
770
|
legacy_column_name_of_tuple_literal?: Bool;
|
|
755
771
|
/** Limit on read rows from the most 'end' result for select query, default 0 means no limit length */
|
|
756
772
|
limit?: UInt64;
|
|
773
|
+
/** Controls the synchronicity of lightweight DELETE operations. It determines whether a DELETE statement will wait for the operation to complete before returning to the client. */
|
|
774
|
+
lightweight_deletes_sync?: UInt64;
|
|
757
775
|
/** The heartbeat interval in seconds to indicate live query is alive. */
|
|
758
776
|
live_view_heartbeat_interval?: Seconds;
|
|
759
777
|
/** Which replicas (among healthy replicas) to preferably send a query to (on the first attempt) for distributed processing. */
|
|
@@ -1573,11 +1591,29 @@ interface ClickHouseServerSettings {
|
|
|
1573
1591
|
/** Allows you to select the max window log of ZSTD (it will not be used for MergeTree family) */
|
|
1574
1592
|
zstd_window_log_max?: Int64;
|
|
1575
1593
|
}
|
|
1594
|
+
/** @see https://clickhouse.com/docs/en/interfaces/http */
|
|
1576
1595
|
interface ClickHouseHTTPSettings {
|
|
1596
|
+
/** Ensures that the entire response is buffered.
|
|
1597
|
+
* In this case, the data that is not stored in memory will be buffered in a temporary server file.
|
|
1598
|
+
* This could help prevent errors that might occur during the streaming of SELECT queries.
|
|
1599
|
+
* Additionally, this is useful when executing DDLs on clustered environments,
|
|
1600
|
+
* as the client will receive the response only when the DDL is applied on all nodes of the cluster. */
|
|
1577
1601
|
wait_end_of_query: Bool;
|
|
1602
|
+
/** Format to use if a SELECT query is executed without a FORMAT clause.
|
|
1603
|
+
* Only useful for the {@link ClickHouseClient.exec} method,
|
|
1604
|
+
* as {@link ClickHouseClient.query} method always attaches this clause. */
|
|
1578
1605
|
default_format: DataFormat;
|
|
1606
|
+
/** By default, the session is terminated after 60 seconds of inactivity
|
|
1607
|
+
* This is regulated by the `default_session_timeout` server setting. */
|
|
1608
|
+
session_timeout: UInt64;
|
|
1609
|
+
/** You can use this setting to check the session status before executing the query.
|
|
1610
|
+
* If a session is expired or cannot be found, the server returns `SESSION_NOT_FOUND` with error code 372.
|
|
1611
|
+
* NB: the session mechanism is only reliable when you connect directly to a particular ClickHouse server node.
|
|
1612
|
+
* Due to each particular session not being shared across the cluster, sessions won't work well in a multi-node environment with a load balancer,
|
|
1613
|
+
* as there will be no guarantee that each consequent request will be received on the same node. */
|
|
1614
|
+
session_check: Bool;
|
|
1579
1615
|
}
|
|
1580
|
-
export type ClickHouseSettings = Partial<ClickHouseServerSettings> & Partial<ClickHouseHTTPSettings>;
|
|
1616
|
+
export type ClickHouseSettings = Partial<ClickHouseServerSettings> & Partial<ClickHouseHTTPSettings> & Record<string, number | string | boolean | SettingsMap | undefined>;
|
|
1581
1617
|
export interface MergeTreeSettings {
|
|
1582
1618
|
/** Allow floating point as partition key */
|
|
1583
1619
|
allow_floating_point_partition_key?: Bool;
|
package/dist/settings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;AA25DA,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"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Adjusted from https://stackoverflow.com/a/72801672/4575540.
|
|
2
|
+
* Useful for checking if we could not infer a concrete literal type
|
|
3
|
+
* (i.e. if instead of 'JSONEachRow' or other literal we just get a generic {@link DataFormat} as an argument). */
|
|
4
|
+
export type IsSame<A, B> = [A] extends [B] ? B extends A ? true : false : false;
|
package/dist/ts_utils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts_utils.js","sourceRoot":"","sources":["../src/ts_utils.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import type { ClickHouseSettings } from '../settings';
|
|
2
2
|
export type HttpHeader = number | string | string[];
|
|
3
3
|
export type HttpHeaders = Record<string, HttpHeader | undefined>;
|
|
4
|
-
export declare function withCompressionHeaders({ headers,
|
|
4
|
+
export declare function withCompressionHeaders({ headers, enable_request_compression, enable_response_compression, }: {
|
|
5
5
|
headers: HttpHeaders;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
enable_request_compression: boolean | undefined;
|
|
7
|
+
enable_response_compression: boolean | undefined;
|
|
8
8
|
}): Record<string, string>;
|
|
9
9
|
export declare function withHttpSettings(clickhouse_settings?: ClickHouseSettings, compression?: boolean): ClickHouseSettings;
|
|
10
10
|
export declare function isSuccessfulResponse(statusCode?: number): boolean;
|
|
11
|
+
export declare function isJWTAuth(auth: unknown): auth is {
|
|
12
|
+
access_token: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function isCredentialsAuth(auth: unknown): auth is {
|
|
15
|
+
username: string;
|
|
16
|
+
password: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const EXCEPTION_TAG_HEADER_NAME = "x-clickhouse-exception-tag";
|
package/dist/utils/connection.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
exports.EXCEPTION_TAG_HEADER_NAME = void 0;
|
|
4
|
+
exports.withCompressionHeaders = withCompressionHeaders;
|
|
5
|
+
exports.withHttpSettings = withHttpSettings;
|
|
6
|
+
exports.isSuccessfulResponse = isSuccessfulResponse;
|
|
7
|
+
exports.isJWTAuth = isJWTAuth;
|
|
8
|
+
exports.isCredentialsAuth = isCredentialsAuth;
|
|
9
|
+
function withCompressionHeaders({ headers, enable_request_compression, enable_response_compression, }) {
|
|
5
10
|
return {
|
|
6
11
|
...headers,
|
|
7
|
-
...(
|
|
8
|
-
...(
|
|
12
|
+
...(enable_response_compression ? { 'Accept-Encoding': 'gzip' } : {}),
|
|
13
|
+
...(enable_request_compression ? { 'Content-Encoding': 'gzip' } : {}),
|
|
9
14
|
};
|
|
10
15
|
}
|
|
11
|
-
exports.withCompressionHeaders = withCompressionHeaders;
|
|
12
16
|
function withHttpSettings(clickhouse_settings, compression) {
|
|
13
17
|
return {
|
|
14
18
|
...(compression
|
|
@@ -19,9 +23,17 @@ function withHttpSettings(clickhouse_settings, compression) {
|
|
|
19
23
|
...clickhouse_settings,
|
|
20
24
|
};
|
|
21
25
|
}
|
|
22
|
-
exports.withHttpSettings = withHttpSettings;
|
|
23
26
|
function isSuccessfulResponse(statusCode) {
|
|
24
27
|
return Boolean(statusCode && 200 <= statusCode && statusCode < 300);
|
|
25
28
|
}
|
|
26
|
-
|
|
29
|
+
function isJWTAuth(auth) {
|
|
30
|
+
return auth !== null && typeof auth === 'object' && 'access_token' in auth;
|
|
31
|
+
}
|
|
32
|
+
function isCredentialsAuth(auth) {
|
|
33
|
+
return (auth !== null &&
|
|
34
|
+
typeof auth === 'object' &&
|
|
35
|
+
'username' in auth &&
|
|
36
|
+
'password' in auth);
|
|
37
|
+
}
|
|
38
|
+
exports.EXCEPTION_TAG_HEADER_NAME = 'x-clickhouse-exception-tag';
|
|
27
39
|
//# sourceMappingURL=connection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/utils/connection.ts"],"names":[],"mappings":";;;AAKA,wDAcC;AAED,4CAYC;AAED,oDAEC;AAED,8BAEC;AAED,8CASC;AA/CD,SAAgB,sBAAsB,CAAC,EACrC,OAAO,EACP,0BAA0B,EAC1B,2BAA2B,GAK5B;IACC,OAAO;QACL,GAAG,OAAO;QACV,GAAG,CAAC,2BAA2B,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrE,GAAG,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtE,CAAA;AACH,CAAC;AAED,SAAgB,gBAAgB,CAC9B,mBAAwC,EACxC,WAAqB;IAErB,OAAO;QACL,GAAG,CAAC,WAAW;YACb,CAAC,CAAC;gBACE,uBAAuB,EAAE,CAAC;aAC3B;YACH,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,mBAAmB;KACvB,CAAA;AACH,CAAC;AAED,SAAgB,oBAAoB,CAAC,UAAmB;IACtD,OAAO,OAAO,CAAC,UAAU,IAAI,GAAG,IAAI,UAAU,IAAI,UAAU,GAAG,GAAG,CAAC,CAAA;AACrE,CAAC;AAED,SAAgB,SAAS,CAAC,IAAa;IACrC,OAAO,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,cAAc,IAAI,IAAI,CAAA;AAC5E,CAAC;AAED,SAAgB,iBAAiB,CAC/B,IAAa;IAEb,OAAO,CACL,IAAI,KAAK,IAAI;QACb,OAAO,IAAI,KAAK,QAAQ;QACxB,UAAU,IAAI,IAAI;QAClB,UAAU,IAAI,IAAI,CACnB,CAAA;AACH,CAAC;AAEY,QAAA,yBAAyB,GAAG,4BAA4B,CAAA"}
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./connection"), exports);
|
|
18
|
+
__exportStar(require("./sleep"), exports);
|
|
19
|
+
__exportStar(require("./stream"), exports);
|
|
18
20
|
__exportStar(require("./url"), exports);
|
|
19
|
-
__exportStar(require("./permutations"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,0CAAuB;AACvB,2CAAwB;AACxB,wCAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../src/utils/sleep.ts"],"names":[],"mappings":";;AAAA,sBAMC;AANM,KAAK,UAAU,KAAK,CAAC,EAAU;IACpC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC5B,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;IACjB,CAAC,EAAE,EAAE,CAAC,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* After 25.11, a newline error character is preceded by a caret return
|
|
3
|
+
* this is a strong indication that we have an exception in the stream.
|
|
4
|
+
*
|
|
5
|
+
* Example with exception marker `FOOBAR`:
|
|
6
|
+
*
|
|
7
|
+
* \r\n__exception__\r\nFOOBAR
|
|
8
|
+
* boom
|
|
9
|
+
* 5 FOOBAR\r\n__exception__\r\n
|
|
10
|
+
*
|
|
11
|
+
* In this case, the exception length is 5 (including the newline character),
|
|
12
|
+
* and the exception message is "boom".
|
|
13
|
+
*/
|
|
14
|
+
export declare function checkErrorInChunkAtIndex(chunk: Uint8Array, newLineIdx: number, exceptionTag: string | undefined): Error | undefined;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkErrorInChunkAtIndex = checkErrorInChunkAtIndex;
|
|
4
|
+
const error_1 = require("../error");
|
|
5
|
+
const EXCEPTION_MARKER = '__exception__';
|
|
6
|
+
const NEWLINE = 0x0a;
|
|
7
|
+
const CARET_RETURN = 0x0d;
|
|
8
|
+
/**
|
|
9
|
+
* After 25.11, a newline error character is preceded by a caret return
|
|
10
|
+
* this is a strong indication that we have an exception in the stream.
|
|
11
|
+
*
|
|
12
|
+
* Example with exception marker `FOOBAR`:
|
|
13
|
+
*
|
|
14
|
+
* \r\n__exception__\r\nFOOBAR
|
|
15
|
+
* boom
|
|
16
|
+
* 5 FOOBAR\r\n__exception__\r\n
|
|
17
|
+
*
|
|
18
|
+
* In this case, the exception length is 5 (including the newline character),
|
|
19
|
+
* and the exception message is "boom".
|
|
20
|
+
*/
|
|
21
|
+
function checkErrorInChunkAtIndex(chunk, newLineIdx, exceptionTag) {
|
|
22
|
+
if (newLineIdx > 0 &&
|
|
23
|
+
chunk[newLineIdx - 1] === CARET_RETURN &&
|
|
24
|
+
exceptionTag !== undefined) {
|
|
25
|
+
try {
|
|
26
|
+
const textDecoder = new TextDecoder('utf-8');
|
|
27
|
+
const bytesCountAfterErrLenHint = 1 + // space
|
|
28
|
+
EXCEPTION_MARKER.length + // __exception__
|
|
29
|
+
2 + // \r\n
|
|
30
|
+
exceptionTag.length + // <value taken from the header>
|
|
31
|
+
2; // \r\n
|
|
32
|
+
let errMsgLenStartIdx = chunk.length - bytesCountAfterErrLenHint;
|
|
33
|
+
if (errMsgLenStartIdx < 1) {
|
|
34
|
+
return new Error('there was an error in the stream, but the last chunk is malformed');
|
|
35
|
+
}
|
|
36
|
+
do {
|
|
37
|
+
--errMsgLenStartIdx;
|
|
38
|
+
} while (chunk[errMsgLenStartIdx] !== NEWLINE);
|
|
39
|
+
const errMsgLen = parseInt(textDecoder.decode(chunk.subarray(errMsgLenStartIdx, -bytesCountAfterErrLenHint)));
|
|
40
|
+
if (isNaN(errMsgLen) || errMsgLen <= 0) {
|
|
41
|
+
return new Error('there was an error in the stream; failed to parse the message length');
|
|
42
|
+
}
|
|
43
|
+
const errMsg = textDecoder.decode(chunk.subarray(errMsgLenStartIdx - errMsgLen + 1, // skipping the newline character
|
|
44
|
+
errMsgLenStartIdx));
|
|
45
|
+
return (0, error_1.parseError)(errMsg);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
// theoretically, it can happen if a proxy cuts the last chunk
|
|
49
|
+
return err;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/utils/stream.ts"],"names":[],"mappings":";;AAoBA,4DAwDC;AA5ED,oCAAqC;AAErC,MAAM,gBAAgB,GAAG,eAAe,CAAA;AAExC,MAAM,OAAO,GAAG,IAAa,CAAA;AAC7B,MAAM,YAAY,GAAG,IAAa,CAAA;AAElC;;;;;;;;;;;;GAYG;AACH,SAAgB,wBAAwB,CACtC,KAAiB,EACjB,UAAkB,EAClB,YAAgC;IAEhC,IACE,UAAU,GAAG,CAAC;QACd,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,KAAK,YAAY;QACtC,YAAY,KAAK,SAAS,EAC1B,CAAC;QACD,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAA;YAE5C,MAAM,yBAAyB,GAC7B,CAAC,GAAG,QAAQ;gBACZ,gBAAgB,CAAC,MAAM,GAAG,gBAAgB;gBAC1C,CAAC,GAAG,OAAO;gBACX,YAAY,CAAC,MAAM,GAAG,gCAAgC;gBACtD,CAAC,CAAA,CAAC,OAAO;YAEX,IAAI,iBAAiB,GAAG,KAAK,CAAC,MAAM,GAAG,yBAAyB,CAAA;YAChE,IAAI,iBAAiB,GAAG,CAAC,EAAE,CAAC;gBAC1B,OAAO,IAAI,KAAK,CACd,mEAAmE,CACpE,CAAA;YACH,CAAC;YAED,GAAG,CAAC;gBACF,EAAE,iBAAiB,CAAA;YACrB,CAAC,QAAQ,KAAK,CAAC,iBAAiB,CAAC,KAAK,OAAO,EAAC;YAE9C,MAAM,SAAS,GAAG,QAAQ,CACxB,WAAW,CAAC,MAAM,CAChB,KAAK,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,yBAAyB,CAAC,CAC9D,CACF,CAAA;YAED,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,SAAS,IAAI,CAAC,EAAE,CAAC;gBACvC,OAAO,IAAI,KAAK,CACd,sEAAsE,CACvE,CAAA;YACH,CAAC;YAED,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAC/B,KAAK,CAAC,QAAQ,CACZ,iBAAiB,GAAG,SAAS,GAAG,CAAC,EAAE,iCAAiC;YACpE,iBAAiB,CAClB,CACF,CAAA;YAED,OAAO,IAAA,kBAAU,EAAC,MAAM,CAAC,CAAA;QAC3B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,8DAA8D;YAC9D,OAAO,GAAY,CAAA;QACrB,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/utils/url.d.ts
CHANGED
|
@@ -4,13 +4,14 @@ export declare function transformUrl({ url, pathname, searchParams, }: {
|
|
|
4
4
|
pathname?: string;
|
|
5
5
|
searchParams?: URLSearchParams;
|
|
6
6
|
}): URL;
|
|
7
|
-
|
|
8
|
-
database: string;
|
|
7
|
+
interface ToSearchParamsOptions {
|
|
8
|
+
database: string | undefined;
|
|
9
9
|
clickhouse_settings?: ClickHouseSettings;
|
|
10
10
|
query_params?: Record<string, unknown>;
|
|
11
11
|
query?: string;
|
|
12
12
|
session_id?: string;
|
|
13
13
|
query_id: string;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
role?: string | Array<string>;
|
|
15
|
+
}
|
|
16
|
+
export declare function toSearchParams({ database, query, query_params, clickhouse_settings, session_id, query_id, role, }: ToSearchParamsOptions): URLSearchParams;
|
|
16
17
|
export {};
|
package/dist/utils/url.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.transformUrl = transformUrl;
|
|
4
|
+
exports.toSearchParams = toSearchParams;
|
|
4
5
|
const data_formatter_1 = require("../data_formatter");
|
|
5
6
|
function transformUrl({ url, pathname, searchParams, }) {
|
|
6
7
|
const newUrl = new URL(url);
|
|
@@ -20,34 +21,42 @@ function transformUrl({ url, pathname, searchParams, }) {
|
|
|
20
21
|
}
|
|
21
22
|
return newUrl;
|
|
22
23
|
}
|
|
23
|
-
exports.transformUrl = transformUrl;
|
|
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
|
-
function toSearchParams({ database, query, query_params, clickhouse_settings, session_id, query_id, }) {
|
|
27
|
-
const
|
|
28
|
-
params.set('query_id', query_id);
|
|
26
|
+
function toSearchParams({ database, query, query_params, clickhouse_settings, session_id, query_id, role, }) {
|
|
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 });
|
|
31
|
+
entries.push([`param_${key}`, formattedParam]);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
if (clickhouse_settings !== undefined) {
|
|
35
35
|
for (const [key, value] of Object.entries(clickhouse_settings)) {
|
|
36
36
|
if (value !== undefined) {
|
|
37
|
-
|
|
37
|
+
entries.push([key, (0, data_formatter_1.formatQuerySettings)(value)]);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
if (database !== 'default') {
|
|
42
|
-
|
|
41
|
+
if (database !== undefined && database !== 'default') {
|
|
42
|
+
entries.push(['database', database]);
|
|
43
43
|
}
|
|
44
44
|
if (query) {
|
|
45
|
-
|
|
45
|
+
entries.push(['query', query]);
|
|
46
46
|
}
|
|
47
47
|
if (session_id) {
|
|
48
|
-
|
|
48
|
+
entries.push(['session_id', session_id]);
|
|
49
|
+
}
|
|
50
|
+
if (role) {
|
|
51
|
+
if (typeof role === 'string') {
|
|
52
|
+
entries.push(['role', role]);
|
|
53
|
+
}
|
|
54
|
+
else if (Array.isArray(role)) {
|
|
55
|
+
for (const r of role) {
|
|
56
|
+
entries.push(['role', r]);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
49
59
|
}
|
|
50
|
-
return
|
|
60
|
+
return new URLSearchParams(entries);
|
|
51
61
|
}
|
|
52
|
-
exports.toSearchParams = toSearchParams;
|
|
53
62
|
//# sourceMappingURL=url.js.map
|
package/dist/utils/url.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":";;AAGA,oCA2BC;AAcD,wCAiDC;AA7FD,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,OAAO,GAAuB,CAAC,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAA;IAE5D,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YACxD,MAAM,cAAc,GAAG,IAAA,kCAAiB,EAAC,EAAE,KAAK,EAAE,CAAC,CAAA;YACnD,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;IAED,IAAI,mBAAmB,KAAK,SAAS,EAAE,CAAC;QACtC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAAE,CAAC;YAC/D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,IAAA,oCAAmB,EAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YACjD,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACrD,OAAO,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAA;IACtC,CAAC;IAED,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;IAChC,CAAC;IAED,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAA;IAC1C,CAAC;IAED,IAAI,IAAI,EAAE,CAAC;QACT,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;QAC9B,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/B,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;gBACrB,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAA;AACrC,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "
|
|
1
|
+
declare const _default: "1.15.0";
|
|
2
2
|
export default _default;
|
package/dist/version.js
CHANGED
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;AAAA,kBAAe,QAAQ,CAAA"}
|
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": "0.
|
|
5
|
+
"version": "0.4.0",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"clickhouse",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "https://github.com/ClickHouse/clickhouse-js.git"
|
|
14
|
+
"url": "git+https://github.com/ClickHouse/clickhouse-js.git"
|
|
15
15
|
},
|
|
16
16
|
"private": false,
|
|
17
17
|
"main": "dist/index.js",
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"files": [
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"prepack": "cp ../../README.md ../../LICENSE .",
|
|
24
|
+
"build": "rm -rf dist; tsc"
|
|
25
|
+
},
|
|
22
26
|
"dependencies": {},
|
|
23
27
|
"devDependencies": {}
|
|
24
28
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
interface ParsedClickHouseError {
|
|
2
|
-
message: string;
|
|
3
|
-
code: string;
|
|
4
|
-
type?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare class ClickHouseError extends Error {
|
|
7
|
-
readonly code: string;
|
|
8
|
-
readonly type: string | undefined;
|
|
9
|
-
constructor({ message, code, type }: ParsedClickHouseError);
|
|
10
|
-
}
|
|
11
|
-
export declare function parseError(input: string | Error): ClickHouseError | Error;
|
|
12
|
-
export {};
|