@clickhouse/client-common 1.6.0 → 1.8.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/README.md +2 -0
- package/dist/clickhouse_types.d.ts +7 -0
- package/dist/clickhouse_types.js +9 -0
- package/dist/clickhouse_types.js.map +1 -1
- package/dist/client.d.ts +5 -0
- package/dist/client.js +9 -0
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +3 -0
- package/dist/config.js +9 -10
- package/dist/config.js.map +1 -1
- package/dist/connection.d.ts +1 -0
- package/dist/data_formatter/format_query_params.js +1 -2
- 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 +3 -3
- package/dist/data_formatter/formatter.js +7 -6
- package/dist/data_formatter/formatter.js.map +1 -1
- package/dist/error/parse_error.js +2 -2
- package/dist/error/parse_error.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/parse/column_types.d.ts +127 -0
- package/dist/parse/column_types.js +545 -0
- package/dist/parse/column_types.js.map +1 -0
- package/dist/parse/index.d.ts +1 -0
- package/dist/parse/index.js +18 -0
- package/dist/parse/index.js.map +1 -0
- package/dist/result.d.ts +6 -3
- package/dist/utils/connection.js +3 -4
- package/dist/utils/connection.js.map +1 -1
- package/dist/utils/sleep.js +1 -2
- package/dist/utils/sleep.js.map +1 -1
- package/dist/utils/url.d.ts +2 -1
- package/dist/utils/url.js +13 -4
- package/dist/utils/url.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
<img src="https://sonarcloud.io/api/project_badges/measure?project=ClickHouse_clickhouse-js&metric=alert_status">
|
|
20
20
|
|
|
21
21
|
<img src="https://sonarcloud.io/api/project_badges/measure?project=ClickHouse_clickhouse-js&metric=coverage">
|
|
22
|
+
|
|
23
|
+
<img src="https://api.scorecard.dev/projects/github.com/ClickHouse/clickhouse-js/badge">
|
|
22
24
|
</p>
|
|
23
25
|
|
|
24
26
|
## About
|
|
@@ -42,3 +42,10 @@ 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 */
|
|
46
|
+
export interface ProgressRow {
|
|
47
|
+
progress: ClickHouseSummary;
|
|
48
|
+
}
|
|
49
|
+
/** Type guard to use with JSONEachRowWithProgress, checking if the emitted row is a progress row.
|
|
50
|
+
* @see https://clickhouse.com/docs/en/interfaces/formats#jsoneachrowwithprogress */
|
|
51
|
+
export declare function isProgressRow(row: unknown): row is ProgressRow;
|
package/dist/clickhouse_types.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isProgressRow = isProgressRow;
|
|
4
|
+
/** Type guard to use with JSONEachRowWithProgress, checking if the emitted row is a progress row.
|
|
5
|
+
* @see https://clickhouse.com/docs/en/interfaces/formats#jsoneachrowwithprogress */
|
|
6
|
+
function isProgressRow(row) {
|
|
7
|
+
return (row !== null &&
|
|
8
|
+
typeof row === 'object' &&
|
|
9
|
+
'progress' in row &&
|
|
10
|
+
Object.keys(row).length === 1);
|
|
11
|
+
}
|
|
3
12
|
//# 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":""}
|
|
1
|
+
{"version":3,"file":"clickhouse_types.js","sourceRoot":"","sources":["../../../packages/client-common/src/clickhouse_types.ts"],"names":[],"mappings":";;AAkDA,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"}
|
package/dist/client.d.ts
CHANGED
|
@@ -18,6 +18,10 @@ export interface BaseQueryParams {
|
|
|
18
18
|
* If it is not set, {@link BaseClickHouseClientConfigOptions.session_id} will be used.
|
|
19
19
|
* @default undefined (no override) */
|
|
20
20
|
session_id?: string;
|
|
21
|
+
/** A specific list of roles to use for this query.
|
|
22
|
+
* If it is not set, {@link BaseClickHouseClientConfigOptions.roles} will be used.
|
|
23
|
+
* @default undefined (no override) */
|
|
24
|
+
role?: string | Array<string>;
|
|
21
25
|
/** When defined, overrides the credentials from the {@link BaseClickHouseClientConfigOptions.username}
|
|
22
26
|
* and {@link BaseClickHouseClientConfigOptions.password} settings for this particular request.
|
|
23
27
|
* @default undefined (no override) */
|
|
@@ -117,6 +121,7 @@ export declare class ClickHouseClient<Stream = unknown> {
|
|
|
117
121
|
private readonly makeResultSet;
|
|
118
122
|
private readonly valuesEncoder;
|
|
119
123
|
private readonly sessionId?;
|
|
124
|
+
private readonly role?;
|
|
120
125
|
private readonly logWriter;
|
|
121
126
|
constructor(config: BaseClickHouseClientConfigOptions & ImplementationDetails<Stream>);
|
|
122
127
|
/**
|
package/dist/client.js
CHANGED
|
@@ -41,6 +41,12 @@ class ClickHouseClient {
|
|
|
41
41
|
writable: true,
|
|
42
42
|
value: void 0
|
|
43
43
|
});
|
|
44
|
+
Object.defineProperty(this, "role", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
configurable: true,
|
|
47
|
+
writable: true,
|
|
48
|
+
value: void 0
|
|
49
|
+
});
|
|
44
50
|
Object.defineProperty(this, "logWriter", {
|
|
45
51
|
enumerable: true,
|
|
46
52
|
configurable: true,
|
|
@@ -55,6 +61,7 @@ class ClickHouseClient {
|
|
|
55
61
|
this.logWriter = this.connectionParams.log_writer;
|
|
56
62
|
this.clientClickHouseSettings = this.connectionParams.clickhouse_settings;
|
|
57
63
|
this.sessionId = config.session_id;
|
|
64
|
+
this.role = config.role;
|
|
58
65
|
this.connection = config.impl.make_connection(configWithURL, this.connectionParams);
|
|
59
66
|
this.makeResultSet = config.impl.make_result_set;
|
|
60
67
|
this.valuesEncoder = config.impl.values_encoder;
|
|
@@ -82,6 +89,7 @@ class ClickHouseClient {
|
|
|
82
89
|
message: 'Error while processing the ResultSet.',
|
|
83
90
|
args: {
|
|
84
91
|
session_id: queryParams.session_id,
|
|
92
|
+
role: queryParams.role,
|
|
85
93
|
query,
|
|
86
94
|
query_id,
|
|
87
95
|
},
|
|
@@ -171,6 +179,7 @@ class ClickHouseClient {
|
|
|
171
179
|
abort_signal: params.abort_signal,
|
|
172
180
|
query_id: params.query_id,
|
|
173
181
|
session_id: params.session_id ?? this.sessionId,
|
|
182
|
+
role: params.role ?? this.role,
|
|
174
183
|
auth: params.auth,
|
|
175
184
|
};
|
|
176
185
|
}
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../packages/client-common/src/client.ts"],"names":[],"mappings":";;;AAYA,6DAA0E;AAG1E,qCAAoE;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../packages/client-common/src/client.ts"],"names":[],"mappings":";;;AAYA,6DAA0E;AAG1E,qCAAoE;AAuIpE,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,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I,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/D,WAAW,GAAG,KAAK,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAA;QACjD,CAAC;aAAM,IACL,qBAAqB,CAAC,MAAM,CAAC,OAAO,CAAC;YACrC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAChC,CAAC;YACD,WAAW,GAAG,eAAe,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,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"}
|
package/dist/config.d.ts
CHANGED
|
@@ -63,6 +63,9 @@ export interface BaseClickHouseClientConfigOptions {
|
|
|
63
63
|
/** ClickHouse Session id to attach to the outgoing requests.
|
|
64
64
|
* @default empty string (no session) */
|
|
65
65
|
session_id?: string;
|
|
66
|
+
/** ClickHouse role name(s) to attach to the outgoing requests.
|
|
67
|
+
* @default undefined string (no roles) */
|
|
68
|
+
role?: string | Array<string>;
|
|
66
69
|
/** @deprecated since version 1.0.0. Use {@link http_headers} instead. <br/>
|
|
67
70
|
* Additional HTTP headers to attach to the outgoing requests.
|
|
68
71
|
* @default empty object */
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.prepareConfigWithURL = prepareConfigWithURL;
|
|
4
|
+
exports.getConnectionParams = getConnectionParams;
|
|
5
|
+
exports.mergeConfigs = mergeConfigs;
|
|
6
|
+
exports.createUrl = createUrl;
|
|
7
|
+
exports.loadConfigOptionsFromURL = loadConfigOptionsFromURL;
|
|
8
|
+
exports.booleanConfigURLValue = booleanConfigURLValue;
|
|
9
|
+
exports.numberConfigURLValue = numberConfigURLValue;
|
|
10
|
+
exports.enumConfigURLValue = enumConfigURLValue;
|
|
4
11
|
const logger_1 = require("./logger");
|
|
5
12
|
/**
|
|
6
13
|
* Validates and normalizes the provided "base" config.
|
|
@@ -40,7 +47,6 @@ function prepareConfigWithURL(baseConfigOptions, logger, handleImplURLParams) {
|
|
|
40
47
|
config.url = url;
|
|
41
48
|
return config;
|
|
42
49
|
}
|
|
43
|
-
exports.prepareConfigWithURL = prepareConfigWithURL;
|
|
44
50
|
function getConnectionParams(config, logger) {
|
|
45
51
|
return {
|
|
46
52
|
url: config.url,
|
|
@@ -60,7 +66,6 @@ function getConnectionParams(config, logger) {
|
|
|
60
66
|
http_headers: config.http_headers ?? {},
|
|
61
67
|
};
|
|
62
68
|
}
|
|
63
|
-
exports.getConnectionParams = getConnectionParams;
|
|
64
69
|
/**
|
|
65
70
|
* Merge two versions of the config: base (hardcoded) from the instance creation and the URL parsed one.
|
|
66
71
|
* URL config takes priority and overrides the base config parameters.
|
|
@@ -96,7 +101,6 @@ function mergeConfigs(baseConfig, configFromURL, logger) {
|
|
|
96
101
|
deepMerge(config, configFromURL);
|
|
97
102
|
return config;
|
|
98
103
|
}
|
|
99
|
-
exports.mergeConfigs = mergeConfigs;
|
|
100
104
|
function createUrl(configURL) {
|
|
101
105
|
let url;
|
|
102
106
|
try {
|
|
@@ -108,14 +112,13 @@ function createUrl(configURL) {
|
|
|
108
112
|
}
|
|
109
113
|
}
|
|
110
114
|
catch (err) {
|
|
111
|
-
throw new Error('ClickHouse URL is malformed. Expected format: http[s]://[username:password@]hostname:port[/database][?param1=value1¶m2=value2]');
|
|
115
|
+
throw new Error('ClickHouse URL is malformed. Expected format: http[s]://[username:password@]hostname:port[/database][?param1=value1¶m2=value2]', { cause: err });
|
|
112
116
|
}
|
|
113
117
|
if (url.protocol !== 'http:' && url.protocol !== 'https:') {
|
|
114
118
|
throw new Error(`ClickHouse URL protocol must be either http or https. Got: ${url.protocol}`);
|
|
115
119
|
}
|
|
116
120
|
return url;
|
|
117
121
|
}
|
|
118
|
-
exports.createUrl = createUrl;
|
|
119
122
|
/**
|
|
120
123
|
* @param url potentially contains auth, database and URL params to parse the configuration from
|
|
121
124
|
* @param handleExtraURLParams some platform-specific URL params might be unknown by the common package;
|
|
@@ -252,7 +255,6 @@ function loadConfigOptionsFromURL(url, handleExtraURLParams) {
|
|
|
252
255
|
const clickHouseURL = new URL(`${url.protocol}//${url.host}`);
|
|
253
256
|
return [clickHouseURL, config];
|
|
254
257
|
}
|
|
255
|
-
exports.loadConfigOptionsFromURL = loadConfigOptionsFromURL;
|
|
256
258
|
function booleanConfigURLValue({ key, value, }) {
|
|
257
259
|
const trimmed = value.trim();
|
|
258
260
|
if (trimmed === 'true' || trimmed === '1')
|
|
@@ -261,7 +263,6 @@ function booleanConfigURLValue({ key, value, }) {
|
|
|
261
263
|
return false;
|
|
262
264
|
throw new Error(`"${key}" has invalid boolean value: ${trimmed}. Expected one of: 0, 1, true, false.`);
|
|
263
265
|
}
|
|
264
|
-
exports.booleanConfigURLValue = booleanConfigURLValue;
|
|
265
266
|
function numberConfigURLValue({ key, value, min, max, }) {
|
|
266
267
|
const trimmed = value.trim();
|
|
267
268
|
const number = Number(trimmed);
|
|
@@ -275,7 +276,6 @@ function numberConfigURLValue({ key, value, min, max, }) {
|
|
|
275
276
|
}
|
|
276
277
|
return number;
|
|
277
278
|
}
|
|
278
|
-
exports.numberConfigURLValue = numberConfigURLValue;
|
|
279
279
|
function enumConfigURLValue({ key, value, enumObject, }) {
|
|
280
280
|
const values = Object.keys(enumObject).filter((item) => isNaN(Number(item)));
|
|
281
281
|
const trimmed = value.trim();
|
|
@@ -285,5 +285,4 @@ function enumConfigURLValue({ key, value, enumObject, }) {
|
|
|
285
285
|
}
|
|
286
286
|
return enumObject[trimmed];
|
|
287
287
|
}
|
|
288
|
-
exports.enumConfigURLValue = enumConfigURLValue;
|
|
289
288
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../packages/client-common/src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../packages/client-common/src/config.ts"],"names":[],"mappings":";;AAqKA,oDAoCC;AAED,kDAqBC;AAOD,oCAqCC;AAED,8BAoBC;AAOD,4DAoIC;AAED,sDAaC;AAED,oDAwBC;AAED,gDAoBC;AAveD,qCAAwD;AAwJxD;;;;;;;GAOG;AACH,SAAgB,oBAAoB,CAClC,iBAAoD,EACpD,MAAc,EACd,mBAAuD;IAEvD,MAAM,UAAU,GAAG,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAC3C,IAAI,UAAU,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;QAChD,MAAM,CAAC,IAAI,CAAC;YACV,MAAM,EAAE,QAAQ;YAChB,OAAO,EACL,iEAAiE;SACpE,CAAC,CAAA;QACF,UAAU,CAAC,YAAY,GAAG,UAAU,CAAC,kBAAkB,CAAA;QACvD,OAAO,UAAU,CAAC,kBAAkB,CAAA;IACtC,CAAC;IACD,IAAI,SAAS,CAAA;IACb,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,CAAC,IAAI,CAAC;YACV,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,0CAA0C;SACpD,CAAC,CAAA;QACF,SAAS,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QACtC,OAAO,UAAU,CAAC,IAAI,CAAA;IACxB,CAAC;SAAM,CAAC;QACN,SAAS,GAAG,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IACvC,CAAC;IACD,MAAM,CAAC,GAAG,EAAE,aAAa,CAAC,GAAG,wBAAwB,CACnD,SAAS,EACT,mBAAmB,CACp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C;QACtC,MAAM,IAAI,KAAK,CAAC,IAAI,GAAG,WAAW,OAAO,6BAA6B,GAAG,EAAE,CAAC,CAAA;IAC9E,CAAC;IACD,IAAI,GAAG,KAAK,SAAS,IAAI,MAAM,GAAG,GAAG,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CACb,IAAI,GAAG,WAAW,OAAO,gCAAgC,GAAG,EAAE,CAC/D,CAAA;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAgB,kBAAkB,CAA2B,EAC3D,GAAG,EACH,KAAK,EACL,UAAU,GAOX;IACC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC5E,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;IAC5B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAClC,MAAM,IAAI,KAAK,CACb,IAAI,GAAG,wBAAwB,OAAO,sBAAsB,QAAQ,GAAG,CACxE,CAAA;IACH,CAAC;IACD,OAAO,UAAU,CAAC,OAAc,CAAC,CAAA;AACnC,CAAC"}
|
package/dist/connection.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatQueryParams =
|
|
3
|
+
exports.formatQueryParams = formatQueryParams;
|
|
4
4
|
function formatQueryParams(value, wrapStringInQuotes = false) {
|
|
5
5
|
if (value === null || value === undefined)
|
|
6
6
|
return '\\N';
|
|
@@ -62,7 +62,6 @@ function formatQueryParams(value, wrapStringInQuotes = false) {
|
|
|
62
62
|
}
|
|
63
63
|
throw new Error(`Unsupported value in query parameters: [${value}].`);
|
|
64
64
|
}
|
|
65
|
-
exports.formatQueryParams = formatQueryParams;
|
|
66
65
|
const TabASCII = 9;
|
|
67
66
|
const NewlineASCII = 10;
|
|
68
67
|
const CarriageReturnASCII = 13;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format_query_params.js","sourceRoot":"","sources":["../../../../packages/client-common/src/data_formatter/format_query_params.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"format_query_params.js","sourceRoot":"","sources":["../../../../packages/client-common/src/data_formatter/format_query_params.ts"],"names":[],"mappings":";;AAAA,8CAgEC;AAhED,SAAgB,iBAAiB,CAC/B,KAAU,EACV,kBAAkB,GAAG,KAAK;IAE1B,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAA;IACvD,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IACrC,IAAI,KAAK,KAAK,MAAM,CAAC,iBAAiB;QAAE,OAAO,MAAM,CAAA;IACrD,IAAI,KAAK,KAAK,MAAM,CAAC,iBAAiB;QAAE,OAAO,MAAM,CAAA;IAErD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;IACnD,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;IACxD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,MAAM,GAAG,EAAE,CAAA;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,QAAQ,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC5B,KAAK,QAAQ;oBACX,MAAM,IAAI,KAAK,CAAA;oB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AE,CAAA;QAC9B,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/C,SAAS,CAAC,IAAI,CACZ,GAAG,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAClE,CAAA;QACH,CAAC;QACD,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAA;IACnC,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,2CAA2C,KAAK,IAAI,CAAC,CAAA;AACvE,CAAC;AAED,MAAM,QAAQ,GAAG,CAAC,CAAA;AAClB,MAAM,YAAY,GAAG,EAAE,CAAA;AACvB,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAC9B,MAAM,gBAAgB,GAAG,EAAE,CAAA;AAC3B,MAAM,cAAc,GAAG,EAAE,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatQuerySettings =
|
|
3
|
+
exports.formatQuerySettings = formatQuerySettings;
|
|
4
4
|
const settings_1 = require("../settings");
|
|
5
5
|
function formatQuerySettings(value) {
|
|
6
6
|
if (typeof value === 'boolean')
|
|
@@ -17,5 +17,4 @@ function formatQuerySettings(value) {
|
|
|
17
17
|
}
|
|
18
18
|
throw new Error(`Unsupported value in query settings: [${value}].`);
|
|
19
19
|
}
|
|
20
|
-
exports.formatQuerySettings = formatQuerySettings;
|
|
21
20
|
//# sourceMappingURL=format_query_settings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format_query_settings.js","sourceRoot":"","sources":["../../../../packages/client-common/src/data_formatter/format_query_settings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"format_query_settings.js","sourceRoot":"","sources":["../../../../packages/client-common/src/data_formatter/format_query_settings.ts"],"names":[],"mappings":";;AAEA,kDAaC;AAfD,0CAAyC;AAEzC,SAAgB,mBAAmB,CACjC,KAA8C;IAE9C,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;IACxD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;IACnD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC3C,mEAAmE;IACnE,uDAAuD;IACvD,4CAA4C;IAC5C,IAAI,KAAK,YAAY,sBAAW,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAA;IACzB,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,yCAAyC,KAAK,IAAI,CAAC,CAAA;AACrE,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export declare const StreamableJSONFormats: readonly ["JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes"];
|
|
1
|
+
export declare const StreamableJSONFormats: readonly ["JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes", "JSONEachRowWithProgress"];
|
|
2
2
|
export declare const RecordsJSONFormats: readonly ["JSONObjectEachRow"];
|
|
3
3
|
export declare const SingleDocumentJSONFormats: readonly ["JSON", "JSONStrings", "JSONCompact", "JSONCompactStrings", "JSONColumnsWithMetadata"];
|
|
4
|
-
export declare const SupportedJSONFormats: readonly ["JSONObjectEachRow", "JSON", "JSONStrings", "JSONCompact", "JSONCompactStrings", "JSONColumnsWithMetadata", "JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes"];
|
|
4
|
+
export declare const SupportedJSONFormats: readonly ["JSONObjectEachRow", "JSON", "JSONStrings", "JSONCompact", "JSONCompactStrings", "JSONColumnsWithMetadata", "JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes", "JSONEachRowWithProgress"];
|
|
5
5
|
export declare const SupportedRawFormats: readonly ["CSV", "CSVWithNames", "CSVWithNamesAndTypes", "TabSeparated", "TabSeparatedRaw", "TabSeparatedWithNames", "TabSeparatedWithNamesAndTypes", "CustomSeparated", "CustomSeparatedWithNames", "CustomSeparatedWithNamesAndTypes", "Parquet"];
|
|
6
|
-
export declare const StreamableFormats: readonly ["JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes", "CSV", "CSVWithNames", "CSVWithNamesAndTypes", "TabSeparated", "TabSeparatedRaw", "TabSeparatedWithNames", "TabSeparatedWithNamesAndTypes", "CustomSeparated", "CustomSeparatedWithNames", "CustomSeparatedWithNamesAndTypes", "Parquet"];
|
|
6
|
+
export declare const StreamableFormats: readonly ["JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes", "JSONEachRowWithProgress", "CSV", "CSVWithNames", "CSVWithNamesAndTypes", "TabSeparated", "TabSeparatedRaw", "TabSeparatedWithNames", "TabSeparatedWithNamesAndTypes", "CustomSeparated", "CustomSeparatedWithNames", "CustomSeparatedWithNamesAndTypes", "Parquet"];
|
|
7
7
|
/** CSV, TSV, etc. - can be streamed, but cannot be decoded as JSON. */
|
|
8
8
|
export type RawDataFormat = (typeof SupportedRawFormats)[number];
|
|
9
9
|
/** Each row is returned as a separate JSON object or an array, and these formats can be streamed. */
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.StreamableFormats = exports.SupportedRawFormats = exports.SupportedJSONFormats = exports.SingleDocumentJSONFormats = exports.RecordsJSONFormats = exports.StreamableJSONFormats = void 0;
|
|
4
|
+
exports.isNotStreamableJSONFamily = isNotStreamableJSONFamily;
|
|
5
|
+
exports.isStreamableJSONFamily = isStreamableJSONFamily;
|
|
6
|
+
exports.isSupportedRawFormat = isSupportedRawFormat;
|
|
7
|
+
exports.validateStreamFormat = validateStreamFormat;
|
|
8
|
+
exports.encodeJSON = encodeJSON;
|
|
4
9
|
exports.StreamableJSONFormats = [
|
|
5
10
|
'JSONEachRow',
|
|
6
11
|
'JSONStringsEachRow',
|
|
@@ -10,6 +15,7 @@ exports.StreamableJSONFormats = [
|
|
|
10
15
|
'JSONCompactEachRowWithNamesAndTypes',
|
|
11
16
|
'JSONCompactStringsEachRowWithNames',
|
|
12
17
|
'JSONCompactStringsEachRowWithNamesAndTypes',
|
|
18
|
+
'JSONEachRowWithProgress',
|
|
13
19
|
];
|
|
14
20
|
exports.RecordsJSONFormats = ['JSONObjectEachRow'];
|
|
15
21
|
exports.SingleDocumentJSONFormats = [
|
|
@@ -45,22 +51,18 @@ function isNotStreamableJSONFamily(format) {
|
|
|
45
51
|
return (exports.SingleDocumentJSONFormats.includes(format) ||
|
|
46
52
|
exports.RecordsJSONFormats.includes(format));
|
|
47
53
|
}
|
|
48
|
-
exports.isNotStreamableJSONFamily = isNotStreamableJSONFamily;
|
|
49
54
|
function isStreamableJSONFamily(format) {
|
|
50
55
|
return exports.StreamableJSONFormats.includes(format);
|
|
51
56
|
}
|
|
52
|
-
exports.isStreamableJSONFamily = isStreamableJSONFamily;
|
|
53
57
|
function isSupportedRawFormat(dataFormat) {
|
|
54
58
|
return exports.SupportedRawFormats.includes(dataFormat);
|
|
55
59
|
}
|
|
56
|
-
exports.isSupportedRawFormat = isSupportedRawFormat;
|
|
57
60
|
function validateStreamFormat(format) {
|
|
58
61
|
if (!exports.StreamableFormats.includes(format)) {
|
|
59
62
|
throw new Error(`${format} format is not streamable. Streamable formats: ${exports.StreamableFormats.join(',')}`);
|
|
60
63
|
}
|
|
61
64
|
return true;
|
|
62
65
|
}
|
|
63
|
-
exports.validateStreamFormat = validateStreamFormat;
|
|
64
66
|
/**
|
|
65
67
|
* Encodes a single row of values into a string in a JSON format acceptable by ClickHouse.
|
|
66
68
|
* @param value a single value to encode.
|
|
@@ -73,5 +75,4 @@ function encodeJSON(value, format) {
|
|
|
73
75
|
}
|
|
74
76
|
throw new Error(`The client does not support JSON encoding in [${format}] format.`);
|
|
75
77
|
}
|
|
76
|
-
exports.encodeJSON = encodeJSON;
|
|
77
78
|
//# sourceMappingURL=formatter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../../packages/client-common/src/data_formatter/formatter.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../../packages/client-common/src/data_formatter/formatter.ts"],"names":[],"mappings":";;;AA4EA,8DAOC;AAED,wDAIC;AAED,oDAEC;AAED,oDAWC;AAQD,gCAOC;AAzHY,QAAA,qBAAqB,GAAG;IACnC,aAAa;IACb,oBAAoB;IACpB,oBAAoB;IACpB,2BAA2B;IAC3B,6BAA6B;IAC7B,qCAAqC;IACrC,oCAAoC;IACpC,4CAA4C;IAC5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K,4BAA0C,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACjE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;IACrC,CAAC;IACD,MAAM,IAAI,KAAK,CACb,iDAAiD,MAAM,WAAW,CACnE,CAAA;AACH,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ClickHouseError = void 0;
|
|
4
|
+
exports.parseError = parseError;
|
|
4
5
|
const errorRe = /(Code|Error): (?<code>\d+).*Exception: (?<message>.+)\((?<type>(?=.+[A-Z]{3})[A-Z0-9_]+?)\)/s;
|
|
5
6
|
class ClickHouseError extends Error {
|
|
6
7
|
constructor({ message, code, type }) {
|
|
@@ -37,5 +38,4 @@ function parseError(input) {
|
|
|
37
38
|
return inputIsError ? input : new Error(input);
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
exports.parseError = parseError;
|
|
41
41
|
//# sourceMappingURL=parse_error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse_error.js","sourceRoot":"","sources":["../../../../packages/client-common/src/error/parse_error.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"parse_error.js","sourceRoot":"","sources":["../../../../packages/client-common/src/error/parse_error.ts"],"names":[],"mappings":";;;AAuBA,gCAUC;AAjCD,MAAM,OAAO,GACX,8FAA8F,CAAA;AAQhG,MAAa,eAAgB,SAAQ,KAAK;IAGxC,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAyB;QACxD,KAAK,CAAC,OAAO,CAAC,CAAA;QAHP;;;;;WAAY;QACZ;;;;;WAAwB;QAG/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAEhB,qCAAqC;QACrC,gIAAgI;QAChI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;IACxD,CAAC;CACF;AAZD,0CAYC;AAED,SAAgB,UAAU,CAAC,KAAqB;IAC9C,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAA;IAC3C,MAAM,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAA;IACpD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACpC,MAAM,MAAM,GAAG,KAAK,EAAE,MAA2C,CAAA;IACjE,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAA;IACpC,CAAC;SAAM,CAAC;QACN,OAAO,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAA;IAChD,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/** Should be re-exported by the implementation */
|
|
2
2
|
export { type BaseQueryParams, type QueryParams, type QueryResult, type ExecParams, type InsertParams, type InsertValues, ClickHouseClient, type CommandParams, type CommandResult, type ExecResult, type InsertResult, type PingResult, } from './client';
|
|
3
3
|
export { type BaseClickHouseClientConfigOptions } from './config';
|
|
4
|
-
export type { Row, BaseResultSet, ResultJSONType, RowJSONType, ResultStream, } from './result';
|
|
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 { ClickHouseError } from './error';
|
|
7
7
|
export { ClickHouseLogLevel, type ErrorLogParams, type WarnLogParams, type Logger, type LogParams, } from './logger';
|
|
8
|
-
export type { ClickHouseSummary, InputJSON, InputJSONObjectEachRow, ResponseJSON, ResponseHeaders, WithClickHouseSummary, WithResponseHeaders, } from './clickhouse_types';
|
|
8
|
+
export type { ClickHouseSummary, InputJSON, InputJSONObjectEachRow, ResponseJSON, ResponseHeaders, WithClickHouseSummary, WithResponseHeaders, ProgressRow, } from './clickhouse_types';
|
|
9
|
+
export { isProgressRow } from './clickhouse_types';
|
|
9
10
|
export { type ClickHouseSettings, type MergeTreeSettings, SettingsMap, } from './settings';
|
|
11
|
+
export type { SimpleColumnType, ParsedColumnSimple, ParsedColumnEnum, ParsedColumnFixedString, ParsedColumnNullable, ParsedColumnDecimal, ParsedColumnDateTime, ParsedColumnDateTime64, ParsedColumnArray, ParsedColumnTuple, ParsedColumnMap, ParsedColumnType, } from './parse';
|
|
12
|
+
export { SimpleColumnTypes, parseColumnType } from './parse';
|
|
10
13
|
/** For implementations usage only - should not be re-exported */
|
|
11
14
|
export { formatQuerySettings, formatQueryParams, encodeJSON, isSupportedRawFormat, isStreamableJSONFamily, isNotStreamableJSONFamily, validateStreamFormat, } from './data_formatter';
|
|
12
15
|
export { type ValuesEncoder, type MakeResultSet, type MakeConnection, type HandleImplSpecificURLParams, type ImplementationDetails, booleanConfigURLValue, enumConfigURLValue, getConnectionParams, numberConfigURLValue, } from './config';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseError = exports.DefaultLogger = exports.LogWriter = 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.SettingsMap = exports.ClickHouseLogLevel = exports.ClickHouseError = exports.ClickHouseClient = void 0;
|
|
3
|
+
exports.parseError = exports.DefaultLogger = exports.LogWriter = 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.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,8 +8,13 @@ var error_1 = require("./error");
|
|
|
8
8
|
Object.defineProperty(exports, "ClickHouseError", { enumerable: true, get: function () { return error_1.ClickHouseError; } });
|
|
9
9
|
var logger_1 = require("./logger");
|
|
10
10
|
Object.defineProperty(exports, "ClickHouseLogLevel", { enumerable: true, get: function () { return logger_1.ClickHouseLogLevel; } });
|
|
11
|
+
var clickhouse_types_1 = require("./clickhouse_types");
|
|
12
|
+
Object.defineProperty(exports, "isProgressRow", { enumerable: true, get: function () { return clickhouse_types_1.isProgressRow; } });
|
|
11
13
|
var settings_1 = require("./settings");
|
|
12
14
|
Object.defineProperty(exports, "SettingsMap", { enumerable: true, get: function () { return settings_1.SettingsMap; } });
|
|
15
|
+
var parse_1 = require("./parse");
|
|
16
|
+
Object.defineProperty(exports, "SimpleColumnTypes", { enumerable: true, get: function () { return parse_1.SimpleColumnTypes; } });
|
|
17
|
+
Object.defineProperty(exports, "parseColumnType", { enumerable: true, get: function () { return parse_1.parseColumnType; } });
|
|
13
18
|
/** For implementations usage only - should not be re-exported */
|
|
14
19
|
var data_formatter_1 = require("./data_formatter");
|
|
15
20
|
Object.defineProperty(exports, "formatQuerySettings", { enumerable: true, get: function () { return data_formatter_1.formatQuerySettings; } });
|
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,mCAaiB;AANf,0GAAA,gBAAgB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/client-common/src/index.ts"],"names":[],"mappings":";;;AAAA,kDAAkD;AAClD,mCAaiB;AANf,0GAAA,gBAAgB,OAAA;AA8BlB,iCAAyC;AAAhC,wGAAA,eAAe,OAAA;AACxB,mCAMiB;AALf,4GAAA,kBAAkB,OAAA;AAgBpB,uDAAkD;AAAzC,iHAAA,aAAa,OAAA;AACtB,uCAImB;AADjB,uGAAA,WAAW,OAAA;AAgBb,iCAA4D;AAAnD,0GAAA,iBAAiB,OAAA;AAAE,wGAAA,eAAe,OAAA;AAE3C,iEAAiE;AACjE,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,iCAOgB;AANd,6GAAA,oBAAoB,OAAA;AACpB,8FAAA,KAAK,OAAA;AACL,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,+GAAA,sBAAsB,OAAA;AACtB,yGAAA,gBAAgB,OAAA;AAElB,mCAAyE;AAAhE,mGAAA,SAAS,OAAA;AAAE,uGAAA,aAAa,OAAA;AACjC,iCAAoC;AAA3B,mGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
export declare class ColumnTypeParseError extends Error {
|
|
2
|
+
readonly args: Record<string, unknown>;
|
|
3
|
+
constructor(message: string, args?: Record<string, unknown>);
|
|
4
|
+
}
|
|
5
|
+
export declare const SimpleColumnTypes: readonly ["Bool", "UInt8", "Int8", "UInt16", "Int16", "UInt32", "Int32", "UInt64", "Int64", "UInt128", "Int128", "UInt256", "Int256", "Float32", "Float64", "String", "UUID", "Date", "Date32", "IPv4", "IPv6"];
|
|
6
|
+
export type SimpleColumnType = (typeof SimpleColumnTypes)[number];
|
|
7
|
+
export interface ParsedColumnSimple {
|
|
8
|
+
type: 'Simple';
|
|
9
|
+
/** Without LowCardinality and Nullable. For example:
|
|
10
|
+
* * UInt8 -> UInt8
|
|
11
|
+
* * LowCardinality(Nullable(String)) -> String */
|
|
12
|
+
columnType: SimpleColumnType;
|
|
13
|
+
/** The original type before parsing. */
|
|
14
|
+
sourceType: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ParsedColumnFixedString {
|
|
17
|
+
type: 'FixedString';
|
|
18
|
+
sizeBytes: number;
|
|
19
|
+
sourceType: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ParsedColumnDateTime {
|
|
22
|
+
type: 'DateTime';
|
|
23
|
+
timezone: string | null;
|
|
24
|
+
sourceType: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ParsedColumnDateTime64 {
|
|
27
|
+
type: 'DateTime64';
|
|
28
|
+
timezone: string | null;
|
|
29
|
+
/** Valid range: [0 : 9] */
|
|
30
|
+
precision: number;
|
|
31
|
+
sourceType: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ParsedColumnEnum {
|
|
34
|
+
type: 'Enum';
|
|
35
|
+
/** Index to name */
|
|
36
|
+
values: Record<number, string>;
|
|
37
|
+
/** UInt8 or UInt16 */
|
|
38
|
+
intSize: 8 | 16;
|
|
39
|
+
sourceType: string;
|
|
40
|
+
}
|
|
41
|
+
/** Int size for Decimal depends on the Precision
|
|
42
|
+
* * 32 bits for precision < 10
|
|
43
|
+
* * 64 bits for precision < 19
|
|
44
|
+
* * 128 bits for precision < 39
|
|
45
|
+
* * 256 bits for precision >= 39
|
|
46
|
+
*/
|
|
47
|
+
export interface DecimalParams {
|
|
48
|
+
precision: number;
|
|
49
|
+
scale: number;
|
|
50
|
+
intSize: 32 | 64 | 128 | 256;
|
|
51
|
+
}
|
|
52
|
+
export interface ParsedColumnDecimal {
|
|
53
|
+
type: 'Decimal';
|
|
54
|
+
params: DecimalParams;
|
|
55
|
+
sourceType: string;
|
|
56
|
+
}
|
|
57
|
+
/** Tuple, Array or Map itself cannot be Nullable */
|
|
58
|
+
export interface ParsedColumnNullable {
|
|
59
|
+
type: 'Nullable';
|
|
60
|
+
value: ParsedColumnSimple | ParsedColumnEnum | ParsedColumnDecimal | ParsedColumnFixedString | ParsedColumnDateTime | ParsedColumnDateTime64;
|
|
61
|
+
sourceType: string;
|
|
62
|
+
}
|
|
63
|
+
/** Array cannot be Nullable or LowCardinality, but its value type can be.
|
|
64
|
+
* Arrays can be multidimensional, e.g. Array(Array(Array(T))).
|
|
65
|
+
* Arrays are allowed to have a Map as the value type.
|
|
66
|
+
*/
|
|
67
|
+
export interface ParsedColumnArray {
|
|
68
|
+
type: 'Array';
|
|
69
|
+
value: ParsedColumnNullable | ParsedColumnSimple | ParsedColumnFixedString | ParsedColumnDecimal | ParsedColumnEnum | ParsedColumnMap | ParsedColumnDateTime | ParsedColumnDateTime64 | ParsedColumnTuple;
|
|
70
|
+
/** Array(T) = 1 dimension, Array(Array(T)) = 2, etc. */
|
|
71
|
+
dimensions: number;
|
|
72
|
+
sourceType: string;
|
|
73
|
+
}
|
|
74
|
+
/** @see https://clickhouse.com/docs/en/sql-reference/data-types/map */
|
|
75
|
+
export interface ParsedColumnMap {
|
|
76
|
+
type: 'Map';
|
|
77
|
+
/** Possible key types:
|
|
78
|
+
* - String, Integer, UUID, Date, Date32, etc ({@link ParsedColumnSimple})
|
|
79
|
+
* - FixedString
|
|
80
|
+
* - DateTime
|
|
81
|
+
* - Enum
|
|
82
|
+
*/
|
|
83
|
+
key: ParsedColumnSimple | ParsedColumnFixedString | ParsedColumnEnum | ParsedColumnDateTime;
|
|
84
|
+
/** Value types are arbitrary, including Map, Array, and Tuple. */
|
|
85
|
+
value: ParsedColumnType;
|
|
86
|
+
sourceType: string;
|
|
87
|
+
}
|
|
88
|
+
export interface ParsedColumnTuple {
|
|
89
|
+
type: 'Tuple';
|
|
90
|
+
/** Element types are arbitrary, including Map, Array, and Tuple. */
|
|
91
|
+
elements: ParsedColumnType[];
|
|
92
|
+
sourceType: string;
|
|
93
|
+
}
|
|
94
|
+
export type ParsedColumnType = ParsedColumnSimple | ParsedColumnEnum | ParsedColumnFixedString | ParsedColumnNullable | ParsedColumnDecimal | ParsedColumnDateTime | ParsedColumnDateTime64 | ParsedColumnArray | ParsedColumnTuple | ParsedColumnMap;
|
|
95
|
+
/**
|
|
96
|
+
* @experimental - incomplete, unstable API;
|
|
97
|
+
* originally intended to be used for RowBinary/Native header parsing internally.
|
|
98
|
+
* Currently unsupported source types:
|
|
99
|
+
* * Geo
|
|
100
|
+
* * (Simple)AggregateFunction
|
|
101
|
+
* * Nested
|
|
102
|
+
* * Old/new JSON
|
|
103
|
+
* * Dynamic
|
|
104
|
+
* * Variant
|
|
105
|
+
*/
|
|
106
|
+
export declare function parseColumnType(sourceType: string): ParsedColumnType;
|
|
107
|
+
export declare function parseDecimalType({ columnType, sourceType, }: ParseColumnTypeParams): ParsedColumnDecimal;
|
|
108
|
+
export declare function parseEnumType({ columnType, sourceType, }: ParseColumnTypeParams): ParsedColumnEnum;
|
|
109
|
+
export declare function parseMapType({ columnType, sourceType, }: ParseColumnTypeParams): ParsedColumnMap;
|
|
110
|
+
export declare function parseTupleType({ columnType, sourceType, }: ParseColumnTypeParams): ParsedColumnTuple;
|
|
111
|
+
export declare function parseArrayType({ columnType, sourceType, }: ParseColumnTypeParams): ParsedColumnArray;
|
|
112
|
+
export declare function parseDateTimeType({ columnType, sourceType, }: ParseColumnTypeParams): ParsedColumnDateTime;
|
|
113
|
+
export declare function parseDateTime64Type({ columnType, sourceType, }: ParseColumnTypeParams): ParsedColumnDateTime64;
|
|
114
|
+
export declare function parseFixedStringType({ columnType, sourceType, }: ParseColumnTypeParams): ParsedColumnFixedString;
|
|
115
|
+
export declare function asNullableType(value: ParsedColumnType, sourceType: string): ParsedColumnNullable;
|
|
116
|
+
/** Used for Map key/value types and Tuple elements.
|
|
117
|
+
* * `String, UInt8` results in [`String`, `UInt8`].
|
|
118
|
+
* * `String, UInt8, Array(String)` results in [`String`, `UInt8`, `Array(String)`].
|
|
119
|
+
* * Throws if parsed values are below the required minimum. */
|
|
120
|
+
export declare function getElementsTypes({ columnType, sourceType }: ParseColumnTypeParams, minElements: number): string[];
|
|
121
|
+
interface ParseColumnTypeParams {
|
|
122
|
+
/** A particular type to parse, such as DateTime. */
|
|
123
|
+
columnType: string;
|
|
124
|
+
/** Full type definition, such as Map(String, DateTime). */
|
|
125
|
+
sourceType: string;
|
|
126
|
+
}
|
|
127
|
+
export {};
|