@clickhouse/client 0.1.1 → 0.2.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 +11 -6
- package/dist/client.d.ts +12 -141
- package/dist/client.js +39 -229
- package/dist/client.js.map +1 -1
- package/dist/connection/index.d.ts +3 -1
- package/dist/connection/index.js +3 -1
- package/dist/connection/index.js.map +1 -1
- package/dist/connection/node_base_connection.d.ts +50 -0
- package/dist/connection/{adapter/base_http_adapter.js → node_base_connection.js} +81 -117
- package/dist/connection/node_base_connection.js.map +1 -0
- package/dist/connection/node_http_connection.d.ts +11 -0
- package/dist/connection/node_http_connection.js +32 -0
- package/dist/connection/node_http_connection.js.map +1 -0
- package/dist/connection/node_https_connection.d.ts +12 -0
- package/dist/connection/node_https_connection.js +53 -0
- package/dist/connection/node_https_connection.js.map +1 -0
- package/dist/index.d.ts +4 -15
- package/dist/index.js +11 -9
- package/dist/index.js.map +1 -1
- package/dist/result_set.d.ts +13 -0
- package/dist/{result.js → result_set.js} +5 -32
- package/dist/result_set.js.map +1 -0
- package/dist/utils/encoder.d.ts +7 -0
- package/dist/utils/encoder.js +55 -0
- package/dist/utils/encoder.js.map +1 -0
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.js +3 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/process.js.map +1 -1
- package/dist/utils/stream.d.ts +1 -1
- package/dist/utils/stream.js.map +1 -1
- package/dist/utils/user_agent.js +1 -2
- package/dist/utils/user_agent.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 +7 -48
- package/dist/clickhouse_types.d.ts +0 -24
- package/dist/clickhouse_types.js +0 -3
- package/dist/clickhouse_types.js.map +0 -1
- package/dist/connection/adapter/base_http_adapter.d.ts +0 -38
- package/dist/connection/adapter/base_http_adapter.js.map +0 -1
- package/dist/connection/adapter/http_adapter.d.ts +0 -10
- package/dist/connection/adapter/http_adapter.js +0 -27
- package/dist/connection/adapter/http_adapter.js.map +0 -1
- package/dist/connection/adapter/http_search_params.d.ts +0 -11
- package/dist/connection/adapter/http_search_params.js +0 -42
- package/dist/connection/adapter/http_search_params.js.map +0 -1
- package/dist/connection/adapter/https_adapter.d.ts +0 -11
- package/dist/connection/adapter/https_adapter.js +0 -48
- package/dist/connection/adapter/https_adapter.js.map +0 -1
- package/dist/connection/adapter/index.d.ts +0 -2
- package/dist/connection/adapter/index.js +0 -8
- package/dist/connection/adapter/index.js.map +0 -1
- package/dist/connection/adapter/transform_url.d.ts +0 -5
- package/dist/connection/adapter/transform_url.js +0 -15
- package/dist/connection/adapter/transform_url.js.map +0 -1
- package/dist/connection/connection.d.ts +0 -63
- package/dist/connection/connection.js +0 -17
- package/dist/connection/connection.js.map +0 -1
- package/dist/data_formatter/format_query_params.d.ts +0 -1
- package/dist/data_formatter/format_query_params.js +0 -61
- package/dist/data_formatter/format_query_params.js.map +0 -1
- package/dist/data_formatter/format_query_settings.d.ts +0 -2
- package/dist/data_formatter/format_query_settings.js +0 -21
- package/dist/data_formatter/format_query_settings.js.map +0 -1
- package/dist/data_formatter/formatter.d.ts +0 -23
- package/dist/data_formatter/formatter.js +0 -96
- package/dist/data_formatter/formatter.js.map +0 -1
- package/dist/data_formatter/index.d.ts +0 -3
- package/dist/data_formatter/index.js +0 -23
- package/dist/data_formatter/index.js.map +0 -1
- package/dist/error/index.d.ts +0 -1
- package/dist/error/index.js +0 -18
- package/dist/error/index.js.map +0 -1
- package/dist/error/parse_error.d.ts +0 -12
- package/dist/error/parse_error.js +0 -39
- package/dist/error/parse_error.js.map +0 -1
- package/dist/logger.d.ts +0 -33
- package/dist/logger.js +0 -108
- package/dist/logger.js.map +0 -1
- package/dist/result.d.ts +0 -52
- package/dist/result.js.map +0 -1
- package/dist/schema/common.d.ts +0 -8
- package/dist/schema/common.js +0 -3
- package/dist/schema/common.js.map +0 -1
- package/dist/schema/engines.d.ts +0 -40
- package/dist/schema/engines.js +0 -61
- package/dist/schema/engines.js.map +0 -1
- package/dist/schema/index.d.ts +0 -7
- package/dist/schema/index.js +0 -24
- package/dist/schema/index.js.map +0 -1
- package/dist/schema/query_formatter.d.ts +0 -9
- package/dist/schema/query_formatter.js +0 -48
- package/dist/schema/query_formatter.js.map +0 -1
- package/dist/schema/result.d.ts +0 -13
- package/dist/schema/result.js +0 -3
- package/dist/schema/result.js.map +0 -1
- package/dist/schema/schema.d.ts +0 -6
- package/dist/schema/schema.js +0 -20
- package/dist/schema/schema.js.map +0 -1
- package/dist/schema/stream.d.ts +0 -11
- package/dist/schema/stream.js +0 -25
- package/dist/schema/stream.js.map +0 -1
- package/dist/schema/table.d.ts +0 -44
- package/dist/schema/table.js +0 -73
- package/dist/schema/table.js.map +0 -1
- package/dist/schema/types.d.ts +0 -201
- package/dist/schema/types.js +0 -268
- package/dist/schema/types.js.map +0 -1
- package/dist/schema/where.d.ts +0 -8
- package/dist/schema/where.js +0 -43
- package/dist/schema/where.js.map +0 -1
- package/dist/settings.d.ts +0 -1453
- package/dist/settings.js +0 -28
- package/dist/settings.js.map +0 -1
- package/dist/utils/string.d.ts +0 -1
- package/dist/utils/string.js +0 -9
- package/dist/utils/string.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function formatQueryParams(value: any, wrapStringInQuotes?: boolean): string;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatQueryParams = void 0;
|
|
4
|
-
const utils_1 = require("../utils");
|
|
5
|
-
function withPadding(value) {
|
|
6
|
-
if (value > 9)
|
|
7
|
-
return String(value);
|
|
8
|
-
return `0${value}`;
|
|
9
|
-
}
|
|
10
|
-
function formatMillis(value) {
|
|
11
|
-
const ms = value.getMilliseconds();
|
|
12
|
-
if (ms === 0) {
|
|
13
|
-
return '';
|
|
14
|
-
}
|
|
15
|
-
if (ms > 99) {
|
|
16
|
-
return `.${ms}`;
|
|
17
|
-
}
|
|
18
|
-
if (ms > 9) {
|
|
19
|
-
return `.0${ms}`;
|
|
20
|
-
}
|
|
21
|
-
return `.00${ms}`;
|
|
22
|
-
}
|
|
23
|
-
function formatQueryParams(value, wrapStringInQuotes = false) {
|
|
24
|
-
if (value === null || value === undefined)
|
|
25
|
-
return '\\N';
|
|
26
|
-
if (Number.isNaN(value))
|
|
27
|
-
return 'nan';
|
|
28
|
-
if (value === Number.POSITIVE_INFINITY)
|
|
29
|
-
return '+inf';
|
|
30
|
-
if (value === Number.NEGATIVE_INFINITY)
|
|
31
|
-
return '-inf';
|
|
32
|
-
if (typeof value === 'number')
|
|
33
|
-
return String(value);
|
|
34
|
-
if (typeof value === 'boolean')
|
|
35
|
-
return value ? '1' : '0';
|
|
36
|
-
if (typeof value === 'string') {
|
|
37
|
-
const escapedValue = (0, utils_1.replaceAll)((0, utils_1.replaceAll)(value, `\\`, `\\\\`), `'`, `\\'`);
|
|
38
|
-
return wrapStringInQuotes ? `'${escapedValue}'` : escapedValue;
|
|
39
|
-
}
|
|
40
|
-
if (Array.isArray(value)) {
|
|
41
|
-
const formatted = value.map((v) => formatQueryParams(v, true));
|
|
42
|
-
return `[${formatted.join(',')}]`;
|
|
43
|
-
}
|
|
44
|
-
if (value instanceof Date) {
|
|
45
|
-
// TODO add timezone support
|
|
46
|
-
const date = `${value.getFullYear()}-${withPadding(value.getMonth() + 1)}-${withPadding(value.getDate())}`;
|
|
47
|
-
const time = `${withPadding(value.getHours())}:${withPadding(value.getMinutes())}:${withPadding(value.getSeconds())}`;
|
|
48
|
-
const ms = formatMillis(value);
|
|
49
|
-
return `${date} ${time}${ms}`;
|
|
50
|
-
}
|
|
51
|
-
if (typeof value === 'object') {
|
|
52
|
-
const formatted = [];
|
|
53
|
-
for (const [key, val] of Object.entries(value)) {
|
|
54
|
-
formatted.push(`${formatQueryParams(key, true)}:${formatQueryParams(val, true)}`);
|
|
55
|
-
}
|
|
56
|
-
return `{${formatted.join(',')}}`;
|
|
57
|
-
}
|
|
58
|
-
throw new Error(`Unsupported value in query parameters: [${value}].`);
|
|
59
|
-
}
|
|
60
|
-
exports.formatQueryParams = formatQueryParams;
|
|
61
|
-
//# sourceMappingURL=format_query_params.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format_query_params.js","sourceRoot":"","sources":["../../src/data_formatter/format_query_params.ts"],"names":[],"mappings":";;;AAAA,oCAAqC;AAErC,SAAS,WAAW,CAAC,KAAa;IAChC,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;IACnC,OAAO,IAAI,KAAK,EAAE,CAAA;AACpB,CAAC;AAED,SAAS,YAAY,CAAC,KAAW;IAC/B,MAAM,EAAE,GAAG,KAAK,CAAC,eAAe,EAAE,CAAA;IAClC,IAAI,EAAE,KAAK,CAAC,EAAE;QACZ,OAAO,EAAE,CAAA;KACV;IACD,IAAI,EAAE,GAAG,EAAE,EAAE;QACX,OAAO,IAAI,EAAE,EAAE,CAAA;KAChB;IACD,IAAI,EAAE,GAAG,CAAC,EAAE;QACV,OAAO,KAAK,EAAE,EAAE,CAAA;KACjB;IACD,OAAO,MAAM,EAAE,EAAE,CAAA;AACnB,CAAC;AAED,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,O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AAA;QAC9B,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAC9C,SAAS,CAAC,IAAI,CACZ,GAAG,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAClE,CAAA;SACF;QACD,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAA;KAClC;IAED,MAAM,IAAI,KAAK,CAAC,2CAA2C,KAAK,IAAI,CAAC,CAAA;AACvE,CAAC;AA7CD,8CA6CC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatQuerySettings = void 0;
|
|
4
|
-
const settings_1 = require("../settings");
|
|
5
|
-
function formatQuerySettings(value) {
|
|
6
|
-
if (typeof value === 'boolean')
|
|
7
|
-
return value ? '1' : '0';
|
|
8
|
-
if (typeof value === 'number')
|
|
9
|
-
return String(value);
|
|
10
|
-
if (typeof value === 'string')
|
|
11
|
-
return value;
|
|
12
|
-
// ClickHouse requires a specific, non-JSON format for passing maps
|
|
13
|
-
// as a setting value - single quotes instead of double
|
|
14
|
-
// Example: {'system.numbers':'number != 3'}
|
|
15
|
-
if (value instanceof settings_1.SettingsMap) {
|
|
16
|
-
return value.toString();
|
|
17
|
-
}
|
|
18
|
-
throw new Error(`Unsupported value in query settings: [${value}].`);
|
|
19
|
-
}
|
|
20
|
-
exports.formatQuerySettings = formatQuerySettings;
|
|
21
|
-
//# sourceMappingURL=format_query_settings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format_query_settings.js","sourceRoot":"","sources":["../../src/data_formatter/format_query_settings.ts"],"names":[],"mappings":";;;AAAA,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;QAChC,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAA;KACxB;IACD,MAAM,IAAI,KAAK,CAAC,yCAAyC,KAAK,IAAI,CAAC,CAAA;AACrE,CAAC;AAbD,kDAaC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
declare const supportedJSONFormats: readonly ["JSON", "JSONStrings", "JSONCompact", "JSONCompactStrings", "JSONColumnsWithMetadata", "JSONObjectEachRow", "JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes"];
|
|
2
|
-
declare const supportedRawFormats: readonly ["CSV", "CSVWithNames", "CSVWithNamesAndTypes", "TabSeparated", "TabSeparatedRaw", "TabSeparatedWithNames", "TabSeparatedWithNamesAndTypes", "CustomSeparated", "CustomSeparatedWithNames", "CustomSeparatedWithNamesAndTypes"];
|
|
3
|
-
export type JSONDataFormat = (typeof supportedJSONFormats)[number];
|
|
4
|
-
export type RawDataFormat = (typeof supportedRawFormats)[number];
|
|
5
|
-
export type DataFormat = JSONDataFormat | RawDataFormat;
|
|
6
|
-
declare const streamableFormat: readonly ["JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes", "CSV", "CSVWithNames", "CSVWithNamesAndTypes", "TabSeparated", "TabSeparatedRaw", "TabSeparatedWithNames", "TabSeparatedWithNamesAndTypes", "CustomSeparated", "CustomSeparatedWithNames", "CustomSeparatedWithNamesAndTypes"];
|
|
7
|
-
type StreamableDataFormat = (typeof streamableFormat)[number];
|
|
8
|
-
export declare function isSupportedRawFormat(dataFormat: DataFormat): boolean;
|
|
9
|
-
export declare function validateStreamFormat(format: any): format is StreamableDataFormat;
|
|
10
|
-
/**
|
|
11
|
-
* Decodes a string in a ClickHouse format into a plain JavaScript object or an array of objects.
|
|
12
|
-
* @param text a string in a ClickHouse data format
|
|
13
|
-
* @param format One of the supported formats: https://clickhouse.com/docs/en/interfaces/formats/
|
|
14
|
-
*/
|
|
15
|
-
export declare function decode(text: string, format: DataFormat): any;
|
|
16
|
-
/**
|
|
17
|
-
* Encodes a single row of values into a string in a JSON format acceptable by ClickHouse.
|
|
18
|
-
* @param value a single value to encode.
|
|
19
|
-
* @param format One of the supported JSON formats: https://clickhouse.com/docs/en/interfaces/formats/
|
|
20
|
-
* @returns string
|
|
21
|
-
*/
|
|
22
|
-
export declare function encodeJSON(value: any, format: DataFormat): string;
|
|
23
|
-
export {};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodeJSON = exports.decode = exports.validateStreamFormat = exports.isSupportedRawFormat = void 0;
|
|
4
|
-
const streamableJSONFormats = [
|
|
5
|
-
'JSONEachRow',
|
|
6
|
-
'JSONStringsEachRow',
|
|
7
|
-
'JSONCompactEachRow',
|
|
8
|
-
'JSONCompactStringsEachRow',
|
|
9
|
-
'JSONCompactEachRowWithNames',
|
|
10
|
-
'JSONCompactEachRowWithNamesAndTypes',
|
|
11
|
-
'JSONCompactStringsEachRowWithNames',
|
|
12
|
-
'JSONCompactStringsEachRowWithNamesAndTypes',
|
|
13
|
-
];
|
|
14
|
-
const singleDocumentJSONFormats = [
|
|
15
|
-
'JSON',
|
|
16
|
-
'JSONStrings',
|
|
17
|
-
'JSONCompact',
|
|
18
|
-
'JSONCompactStrings',
|
|
19
|
-
'JSONColumnsWithMetadata',
|
|
20
|
-
'JSONObjectEachRow',
|
|
21
|
-
];
|
|
22
|
-
const supportedJSONFormats = [
|
|
23
|
-
...singleDocumentJSONFormats,
|
|
24
|
-
...streamableJSONFormats,
|
|
25
|
-
];
|
|
26
|
-
const supportedRawFormats = [
|
|
27
|
-
'CSV',
|
|
28
|
-
'CSVWithNames',
|
|
29
|
-
'CSVWithNamesAndTypes',
|
|
30
|
-
'TabSeparated',
|
|
31
|
-
'TabSeparatedRaw',
|
|
32
|
-
'TabSeparatedWithNames',
|
|
33
|
-
'TabSeparatedWithNamesAndTypes',
|
|
34
|
-
'CustomSeparated',
|
|
35
|
-
'CustomSeparatedWithNames',
|
|
36
|
-
'CustomSeparatedWithNamesAndTypes',
|
|
37
|
-
];
|
|
38
|
-
// TODO add others formats
|
|
39
|
-
const streamableFormat = [
|
|
40
|
-
...streamableJSONFormats,
|
|
41
|
-
...supportedRawFormats,
|
|
42
|
-
];
|
|
43
|
-
function isNotStreamableJSONFamily(format) {
|
|
44
|
-
// @ts-expect-error JSON is not assignable to notStreamableJSONFormats
|
|
45
|
-
return singleDocumentJSONFormats.includes(format);
|
|
46
|
-
}
|
|
47
|
-
function isStreamableJSONFamily(format) {
|
|
48
|
-
// @ts-expect-error JSON is not assignable to streamableJSONFormats
|
|
49
|
-
return streamableJSONFormats.includes(format);
|
|
50
|
-
}
|
|
51
|
-
function isSupportedRawFormat(dataFormat) {
|
|
52
|
-
return supportedRawFormats.includes(dataFormat);
|
|
53
|
-
}
|
|
54
|
-
exports.isSupportedRawFormat = isSupportedRawFormat;
|
|
55
|
-
function validateStreamFormat(format) {
|
|
56
|
-
if (!streamableFormat.includes(format)) {
|
|
57
|
-
throw new Error(`${format} format is not streamable. Streamable formats: ${streamableFormat.join(',')}`);
|
|
58
|
-
}
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
exports.validateStreamFormat = validateStreamFormat;
|
|
62
|
-
/**
|
|
63
|
-
* Decodes a string in a ClickHouse format into a plain JavaScript object or an array of objects.
|
|
64
|
-
* @param text a string in a ClickHouse data format
|
|
65
|
-
* @param format One of the supported formats: https://clickhouse.com/docs/en/interfaces/formats/
|
|
66
|
-
*/
|
|
67
|
-
function decode(text, format) {
|
|
68
|
-
if (isNotStreamableJSONFamily(format)) {
|
|
69
|
-
return JSON.parse(text);
|
|
70
|
-
}
|
|
71
|
-
if (isStreamableJSONFamily(format)) {
|
|
72
|
-
return text
|
|
73
|
-
.split('\n')
|
|
74
|
-
.filter(Boolean)
|
|
75
|
-
.map((l) => decode(l, 'JSON'));
|
|
76
|
-
}
|
|
77
|
-
if (isSupportedRawFormat(format)) {
|
|
78
|
-
throw new Error(`Cannot decode ${format} to JSON`);
|
|
79
|
-
}
|
|
80
|
-
throw new Error(`The client does not support [${format}] format decoding.`);
|
|
81
|
-
}
|
|
82
|
-
exports.decode = decode;
|
|
83
|
-
/**
|
|
84
|
-
* Encodes a single row of values into a string in a JSON format acceptable by ClickHouse.
|
|
85
|
-
* @param value a single value to encode.
|
|
86
|
-
* @param format One of the supported JSON formats: https://clickhouse.com/docs/en/interfaces/formats/
|
|
87
|
-
* @returns string
|
|
88
|
-
*/
|
|
89
|
-
function encodeJSON(value, format) {
|
|
90
|
-
if (supportedJSONFormats.includes(format)) {
|
|
91
|
-
return JSON.stringify(value) + '\n';
|
|
92
|
-
}
|
|
93
|
-
throw new Error(`The client does not support JSON encoding in [${format}] format.`);
|
|
94
|
-
}
|
|
95
|
-
exports.encodeJSON = encodeJSON;
|
|
96
|
-
//# sourceMappingURL=formatter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../src/data_formatter/formatter.ts"],"names":[],"mappings":";;;AAAA,MAAM,qBAAqB,GAA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M,CAAC,IAAY,EAAE,MAAkB;IACrD,IAAI,yBAAyB,CAAC,MAAM,CAAC,EAAE;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;KACxB;IACD,IAAI,sBAAsB,CAAC,MAAM,CAAC,EAAE;QAClC,OAAO,IAAI;aACR,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,OAAO,CAAC;aACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;KACjC;IACD,IAAI,oBAAoB,CAAC,MAAM,CAAC,EAAE;QAChC,MAAM,IAAI,KAAK,CAAC,iBAAiB,MAAM,UAAU,CAAC,CAAA;KACnD;IACD,MAAM,IAAI,KAAK,CAAC,gCAAgC,MAAM,oBAAoB,CAAC,CAAA;AAC7E,CAAC;AAdD,wBAcC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,KAAU,EAAE,MAAkB;IACvD,IAAK,oBAA0C,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAChE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;KACpC;IACD,MAAM,IAAI,KAAK,CACb,iDAAiD,MAAM,WAAW,CACnE,CAAA;AACH,CAAC;AAPD,gCAOC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
exports.formatQuerySettings = exports.formatQueryParams = void 0;
|
|
18
|
-
__exportStar(require("./formatter"), exports);
|
|
19
|
-
var format_query_params_1 = require("./format_query_params");
|
|
20
|
-
Object.defineProperty(exports, "formatQueryParams", { enumerable: true, get: function () { return format_query_params_1.formatQueryParams; } });
|
|
21
|
-
var format_query_settings_1 = require("./format_query_settings");
|
|
22
|
-
Object.defineProperty(exports, "formatQuerySettings", { enumerable: true, get: function () { return format_query_settings_1.formatQuerySettings; } });
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data_formatter/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,6DAAyD;AAAhD,wHAAA,iBAAiB,OAAA;AAC1B,iEAA6D;AAApD,4HAAA,mBAAmB,OAAA"}
|
package/dist/error/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './parse_error';
|
package/dist/error/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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("./parse_error"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
package/dist/error/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/error/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B"}
|
|
@@ -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): ClickHouseError | Error;
|
|
12
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseError = exports.ClickHouseError = void 0;
|
|
4
|
-
const errorRe = /(Code|Error): (?<code>\d+).*Exception: (?<message>.+)\((?<type>(?=.+[A-Z]{3})[A-Z0-9_]+?)\)/s;
|
|
5
|
-
class ClickHouseError extends Error {
|
|
6
|
-
constructor({ message, code, type }) {
|
|
7
|
-
super(message);
|
|
8
|
-
Object.defineProperty(this, "code", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
configurable: true,
|
|
11
|
-
writable: true,
|
|
12
|
-
value: void 0
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(this, "type", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
configurable: true,
|
|
17
|
-
writable: true,
|
|
18
|
-
value: void 0
|
|
19
|
-
});
|
|
20
|
-
this.code = code;
|
|
21
|
-
this.type = type;
|
|
22
|
-
// Set the prototype explicitly, see:
|
|
23
|
-
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
24
|
-
Object.setPrototypeOf(this, ClickHouseError.prototype);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.ClickHouseError = ClickHouseError;
|
|
28
|
-
function parseError(input) {
|
|
29
|
-
const match = input.match(errorRe);
|
|
30
|
-
const groups = match === null || match === void 0 ? void 0 : match.groups;
|
|
31
|
-
if (groups) {
|
|
32
|
-
return new ClickHouseError(groups);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
return new Error(input);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
exports.parseError = parseError;
|
|
39
|
-
//# sourceMappingURL=parse_error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse_error.js","sourceRoot":"","sources":["../../src/error/parse_error.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GACX,8FAA8F,CAAA;AAOhG,MAAa,eAAgB,SAAQ,KAAK;IAGxC,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAyB;QACxD,KAAK,CAAC,OAAO,CAAC,CAAA;QAHhB;;;;;WAAqB;QACrB;;;;;WAAiC;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,KAAa;IACtC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IAClC,MAAM,MAAM,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAA2C,CAAA;IACjE,IAAI,MAAM,EAAE;QACV,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAA;KACnC;SAAM;QACL,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAA;KACxB;AACH,CAAC;AARD,gCAQC"}
|
package/dist/logger.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export interface LogParams {
|
|
2
|
-
module: string;
|
|
3
|
-
message: string;
|
|
4
|
-
args?: Record<string, unknown>;
|
|
5
|
-
}
|
|
6
|
-
export type ErrorLogParams = LogParams & {
|
|
7
|
-
err: Error;
|
|
8
|
-
};
|
|
9
|
-
export interface Logger {
|
|
10
|
-
trace(params: LogParams): void;
|
|
11
|
-
debug(params: LogParams): void;
|
|
12
|
-
info(params: LogParams): void;
|
|
13
|
-
warn(params: LogParams): void;
|
|
14
|
-
error(params: ErrorLogParams): void;
|
|
15
|
-
}
|
|
16
|
-
export declare class DefaultLogger implements Logger {
|
|
17
|
-
trace({ module, message, args }: LogParams): void;
|
|
18
|
-
debug({ module, message, args }: LogParams): void;
|
|
19
|
-
info({ module, message, args }: LogParams): void;
|
|
20
|
-
warn({ module, message, args }: LogParams): void;
|
|
21
|
-
error({ module, message, args, err }: ErrorLogParams): void;
|
|
22
|
-
}
|
|
23
|
-
export declare class LogWriter {
|
|
24
|
-
private readonly logger;
|
|
25
|
-
private readonly logLevel;
|
|
26
|
-
constructor(logger: Logger);
|
|
27
|
-
trace(params: LogParams): void;
|
|
28
|
-
debug(params: LogParams): void;
|
|
29
|
-
info(params: LogParams): void;
|
|
30
|
-
warn(params: LogParams): void;
|
|
31
|
-
error(params: ErrorLogParams): void;
|
|
32
|
-
private getClickHouseLogLevel;
|
|
33
|
-
}
|
package/dist/logger.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LogWriter = exports.DefaultLogger = void 0;
|
|
4
|
-
class DefaultLogger {
|
|
5
|
-
trace({ module, message, args }) {
|
|
6
|
-
console.trace(formatMessage({ module, message }), args);
|
|
7
|
-
}
|
|
8
|
-
debug({ module, message, args }) {
|
|
9
|
-
console.debug(formatMessage({ module, message }), args);
|
|
10
|
-
}
|
|
11
|
-
info({ module, message, args }) {
|
|
12
|
-
console.info(formatMessage({ module, message }), args);
|
|
13
|
-
}
|
|
14
|
-
warn({ module, message, args }) {
|
|
15
|
-
console.warn(formatMessage({ module, message }), args);
|
|
16
|
-
}
|
|
17
|
-
error({ module, message, args, err }) {
|
|
18
|
-
console.error(formatMessage({ module, message }), args, err);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.DefaultLogger = DefaultLogger;
|
|
22
|
-
class LogWriter {
|
|
23
|
-
constructor(logger) {
|
|
24
|
-
Object.defineProperty(this, "logger", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
configurable: true,
|
|
27
|
-
writable: true,
|
|
28
|
-
value: logger
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(this, "logLevel", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
configurable: true,
|
|
33
|
-
writable: true,
|
|
34
|
-
value: void 0
|
|
35
|
-
});
|
|
36
|
-
this.logLevel = this.getClickHouseLogLevel();
|
|
37
|
-
this.info({
|
|
38
|
-
module: 'Logger',
|
|
39
|
-
message: `Log level is set to ${ClickHouseLogLevel[this.logLevel]}`,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
trace(params) {
|
|
43
|
-
if (this.logLevel <= ClickHouseLogLevel.TRACE) {
|
|
44
|
-
this.logger.trace(params);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
debug(params) {
|
|
48
|
-
if (this.logLevel <= ClickHouseLogLevel.DEBUG) {
|
|
49
|
-
this.logger.debug(params);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
info(params) {
|
|
53
|
-
if (this.logLevel <= ClickHouseLogLevel.INFO) {
|
|
54
|
-
this.logger.info(params);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
warn(params) {
|
|
58
|
-
if (this.logLevel <= ClickHouseLogLevel.WARN) {
|
|
59
|
-
this.logger.warn(params);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
error(params) {
|
|
63
|
-
if (this.logLevel <= ClickHouseLogLevel.ERROR) {
|
|
64
|
-
this.logger.error(params);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
getClickHouseLogLevel() {
|
|
68
|
-
const logLevelFromEnv = process.env['CLICKHOUSE_LOG_LEVEL'];
|
|
69
|
-
if (!logLevelFromEnv) {
|
|
70
|
-
return ClickHouseLogLevel.OFF;
|
|
71
|
-
}
|
|
72
|
-
const logLevel = logLevelFromEnv.toLocaleLowerCase();
|
|
73
|
-
if (logLevel === 'info') {
|
|
74
|
-
return ClickHouseLogLevel.INFO;
|
|
75
|
-
}
|
|
76
|
-
if (logLevel === 'warn') {
|
|
77
|
-
return ClickHouseLogLevel.WARN;
|
|
78
|
-
}
|
|
79
|
-
if (logLevel === 'error') {
|
|
80
|
-
return ClickHouseLogLevel.ERROR;
|
|
81
|
-
}
|
|
82
|
-
if (logLevel === 'debug') {
|
|
83
|
-
return ClickHouseLogLevel.DEBUG;
|
|
84
|
-
}
|
|
85
|
-
if (logLevel === 'trace') {
|
|
86
|
-
return ClickHouseLogLevel.TRACE;
|
|
87
|
-
}
|
|
88
|
-
if (logLevel === 'off') {
|
|
89
|
-
return ClickHouseLogLevel.OFF;
|
|
90
|
-
}
|
|
91
|
-
console.error(`Unknown CLICKHOUSE_LOG_LEVEL value: ${logLevelFromEnv}, logs are disabled`);
|
|
92
|
-
return ClickHouseLogLevel.OFF;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
exports.LogWriter = LogWriter;
|
|
96
|
-
var ClickHouseLogLevel;
|
|
97
|
-
(function (ClickHouseLogLevel) {
|
|
98
|
-
ClickHouseLogLevel[ClickHouseLogLevel["TRACE"] = 0] = "TRACE";
|
|
99
|
-
ClickHouseLogLevel[ClickHouseLogLevel["DEBUG"] = 1] = "DEBUG";
|
|
100
|
-
ClickHouseLogLevel[ClickHouseLogLevel["INFO"] = 2] = "INFO";
|
|
101
|
-
ClickHouseLogLevel[ClickHouseLogLevel["WARN"] = 3] = "WARN";
|
|
102
|
-
ClickHouseLogLevel[ClickHouseLogLevel["ERROR"] = 4] = "ERROR";
|
|
103
|
-
ClickHouseLogLevel[ClickHouseLogLevel["OFF"] = 127] = "OFF";
|
|
104
|
-
})(ClickHouseLogLevel || (ClickHouseLogLevel = {}));
|
|
105
|
-
function formatMessage({ module, message, }) {
|
|
106
|
-
return `[@clickhouse/client][${module}] ${message}`;
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=logger.js.map
|
package/dist/logger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;;AAcA,MAAa,aAAa;IACxB,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAa;QACxC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;IACzD,CAAC;IAED,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAa;QACxC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;IACzD,CAAC;IAED,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAa;QACvC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,E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T,6DAAS,CAAA;IACT,2DAAQ,CAAA;IACR,2DAAQ,CAAA;IACR,6DAAS,CAAA;IACT,2DAAS,CAAA;AACX,CAAC,EAPI,kBAAkB,KAAlB,kBAAkB,QAOtB;AAED,SAAS,aAAa,CAAC,EACrB,MAAM,EACN,OAAO,GAIR;IACC,OAAO,wBAAwB,MAAM,KAAK,OAAO,EAAE,CAAA;AACrD,CAAC"}
|
package/dist/result.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import Stream from 'stream';
|
|
3
|
-
import { type DataFormat } from './data_formatter';
|
|
4
|
-
export declare class ResultSet {
|
|
5
|
-
private _stream;
|
|
6
|
-
private readonly format;
|
|
7
|
-
readonly query_id: string;
|
|
8
|
-
constructor(_stream: Stream.Readable, format: DataFormat, query_id: string);
|
|
9
|
-
/**
|
|
10
|
-
* The method waits for all the rows to be fully loaded
|
|
11
|
-
* and returns the result as a string.
|
|
12
|
-
*
|
|
13
|
-
* The method will throw if the underlying stream was already consumed
|
|
14
|
-
* by calling the other methods.
|
|
15
|
-
*/
|
|
16
|
-
text(): Promise<string>;
|
|
17
|
-
/**
|
|
18
|
-
* The method waits for the all the rows to be fully loaded.
|
|
19
|
-
* When the response is received in full, it will be decoded to return JSON.
|
|
20
|
-
*
|
|
21
|
-
* The method will throw if the underlying stream was already consumed
|
|
22
|
-
* by calling the other methods.
|
|
23
|
-
*/
|
|
24
|
-
json<T>(): Promise<T>;
|
|
25
|
-
/**
|
|
26
|
-
* Returns a readable stream for responses that can be streamed
|
|
27
|
-
* (i.e. all except JSON).
|
|
28
|
-
*
|
|
29
|
-
* Every iteration provides an array of {@link Row} instances
|
|
30
|
-
* for {@link StreamableDataFormat} format.
|
|
31
|
-
*
|
|
32
|
-
* Should be called only once.
|
|
33
|
-
*
|
|
34
|
-
* The method will throw if called on a response in non-streamable format,
|
|
35
|
-
* and if the underlying stream was already consumed
|
|
36
|
-
* by calling the other methods.
|
|
37
|
-
*/
|
|
38
|
-
stream(): Stream.Readable;
|
|
39
|
-
close(): void;
|
|
40
|
-
}
|
|
41
|
-
export interface Row {
|
|
42
|
-
/**
|
|
43
|
-
* A string representation of a row.
|
|
44
|
-
*/
|
|
45
|
-
text: string;
|
|
46
|
-
/**
|
|
47
|
-
* Returns a JSON representation of a row.
|
|
48
|
-
* The method will throw if called on a response in JSON incompatible format.
|
|
49
|
-
* It is safe to call this method multiple times.
|
|
50
|
-
*/
|
|
51
|
-
json<T>(): T;
|
|
52
|
-
}
|
package/dist/result.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"result.js","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAA0C;AAE1C,mCAAmC;AACnC,qDAAgF;AAEhF,MAAa,SAAS;IACpB,YACU,OAAwB,EACf,MAAkB,EACnB,QAAgB;;;;;mBAFxB;;;;;;mBACS;;;;;;mBACD;;IACf,CAAC;IAEJ;;;;;;OAMG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE;YAC9B,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,MAAM,IAAA,iBAAS,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IACnD,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE;YAC9B,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,IAAA,uBAAM,EAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IAC/C,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,MAAM;QACJ,0EAA0E;QAC1E,iDAAiD;QACjD,+CAA+C;QAC/C,IAAI,IAAI,CAAC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AAA;IACJ,CAAC;IAED,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAA;IACxB,CAAC;CACF;AAtGD,8BAsGC;AAgBD,MAAM,4BAA4B,GAAG,kCAAkC,CAAA"}
|
package/dist/schema/common.d.ts
DELETED
package/dist/schema/common.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/schema/common.ts"],"names":[],"mappings":""}
|
package/dist/schema/engines.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export type TableEngine = MergeTreeFamily;
|
|
2
|
-
type MergeTreeFamily = ReturnType<typeof MergeTree> | ReturnType<typeof ReplicatedMergeTree> | ReturnType<typeof ReplacingMergeTree> | ReturnType<typeof SummingMergeTree> | ReturnType<typeof AggregatingMergeTree> | ReturnType<typeof CollapsingMergeTree> | ReturnType<typeof VersionedCollapsingMergeTree> | ReturnType<typeof GraphiteMergeTree>;
|
|
3
|
-
export declare const MergeTree: () => {
|
|
4
|
-
toString: () => string;
|
|
5
|
-
type: string;
|
|
6
|
-
};
|
|
7
|
-
export interface ReplicatedMergeTreeParameters {
|
|
8
|
-
zoo_path: string;
|
|
9
|
-
replica_name: string;
|
|
10
|
-
ver?: string;
|
|
11
|
-
}
|
|
12
|
-
export declare const ReplicatedMergeTree: ({ zoo_path, replica_name, ver, }: ReplicatedMergeTreeParameters) => {
|
|
13
|
-
toString: () => string;
|
|
14
|
-
type: string;
|
|
15
|
-
};
|
|
16
|
-
export declare const ReplacingMergeTree: (ver?: string) => {
|
|
17
|
-
toString: () => string;
|
|
18
|
-
type: string;
|
|
19
|
-
};
|
|
20
|
-
export declare const SummingMergeTree: (columns?: string[]) => {
|
|
21
|
-
toString: () => string;
|
|
22
|
-
type: string;
|
|
23
|
-
};
|
|
24
|
-
export declare const AggregatingMergeTree: () => {
|
|
25
|
-
toString: () => string;
|
|
26
|
-
type: string;
|
|
27
|
-
};
|
|
28
|
-
export declare const CollapsingMergeTree: (sign: string) => {
|
|
29
|
-
toString: () => string;
|
|
30
|
-
type: string;
|
|
31
|
-
};
|
|
32
|
-
export declare const VersionedCollapsingMergeTree: (sign: string, version: string) => {
|
|
33
|
-
toString: () => string;
|
|
34
|
-
type: string;
|
|
35
|
-
};
|
|
36
|
-
export declare const GraphiteMergeTree: (config_section: string) => {
|
|
37
|
-
toString: () => string;
|
|
38
|
-
type: string;
|
|
39
|
-
};
|
|
40
|
-
export {};
|