@clickhouse/client-common
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -70,4 +70,3 @@ "use strict"; | ||
async query(params) { | ||
var _a; | ||
const format = (_a = params.format) !== null && _a !== void 0 ? _a : 'JSON'; | ||
const format = params.format ?? 'JSON'; | ||
const query = formatQuery(params.query, format); | ||
@@ -170,21 +169,20 @@ const { stream, query_id } = await this.connection.query({ | ||
function getConnectionParams(config) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; | ||
return { | ||
application_id: config.application, | ||
url: createUrl((_a = config.host) !== null && _a !== void 0 ? _a : 'http://localhost:8123'), | ||
request_timeout: (_b = config.request_timeout) !== null && _b !== void 0 ? _b : 300000, | ||
max_open_connections: (_c = config.max_open_connections) !== null && _c !== void 0 ? _c : Infinity, | ||
url: createUrl(config.host ?? 'http://localhost:8123'), | ||
request_timeout: config.request_timeout ?? 300000, | ||
max_open_connections: config.max_open_connections ?? Infinity, | ||
compression: { | ||
decompress_response: (_e = (_d = config.compression) === null || _d === void 0 ? void 0 : _d.response) !== null && _e !== void 0 ? _e : true, | ||
compress_request: (_g = (_f = config.compression) === null || _f === void 0 ? void 0 : _f.request) !== null && _g !== void 0 ? _g : false, | ||
decompress_response: config.compression?.response ?? true, | ||
compress_request: config.compression?.request ?? false, | ||
}, | ||
username: (_h = config.username) !== null && _h !== void 0 ? _h : 'default', | ||
password: (_j = config.password) !== null && _j !== void 0 ? _j : '', | ||
database: (_k = config.database) !== null && _k !== void 0 ? _k : 'default', | ||
clickhouse_settings: (_l = config.clickhouse_settings) !== null && _l !== void 0 ? _l : {}, | ||
logWriter: new client_common_1.LogWriter(((_m = config === null || config === void 0 ? void 0 : config.log) === null || _m === void 0 ? void 0 : _m.LoggerClass) | ||
username: config.username ?? 'default', | ||
password: config.password ?? '', | ||
database: config.database ?? 'default', | ||
clickhouse_settings: config.clickhouse_settings ?? {}, | ||
logWriter: new client_common_1.LogWriter(config?.log?.LoggerClass | ||
? new config.log.LoggerClass() | ||
: new client_common_1.DefaultLogger(), (_o = config.log) === null || _o === void 0 ? void 0 : _o.level), | ||
: new client_common_1.DefaultLogger(), config.log?.level), | ||
}; | ||
} | ||
//# sourceMappingURL=client.js.map |
declare const supportedJSONFormats: readonly ["JSON", "JSONStrings", "JSONCompact", "JSONCompactStrings", "JSONColumnsWithMetadata", "JSONObjectEachRow", "JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes"]; | ||
declare const supportedRawFormats: readonly ["CSV", "CSVWithNames", "CSVWithNamesAndTypes", "TabSeparated", "TabSeparatedRaw", "TabSeparatedWithNames", "TabSeparatedWithNamesAndTypes", "CustomSeparated", "CustomSeparatedWithNames", "CustomSeparatedWithNamesAndTypes"]; | ||
declare const supportedRawFormats: readonly ["CSV", "CSVWithNames", "CSVWithNamesAndTypes", "TabSeparated", "TabSeparatedRaw", "TabSeparatedWithNames", "TabSeparatedWithNamesAndTypes", "CustomSeparated", "CustomSeparatedWithNames", "CustomSeparatedWithNamesAndTypes", "Parquet"]; | ||
export type JSONDataFormat = (typeof supportedJSONFormats)[number]; | ||
export type RawDataFormat = (typeof supportedRawFormats)[number]; | ||
export type DataFormat = JSONDataFormat | RawDataFormat; | ||
declare const streamableFormat: readonly ["JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes", "CSV", "CSVWithNames", "CSVWithNamesAndTypes", "TabSeparated", "TabSeparatedRaw", "TabSeparatedWithNames", "TabSeparatedWithNamesAndTypes", "CustomSeparated", "CustomSeparatedWithNames", "CustomSeparatedWithNamesAndTypes"]; | ||
declare const streamableFormat: readonly ["JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes", "CSV", "CSVWithNames", "CSVWithNamesAndTypes", "TabSeparated", "TabSeparatedRaw", "TabSeparatedWithNames", "TabSeparatedWithNamesAndTypes", "CustomSeparated", "CustomSeparatedWithNames", "CustomSeparatedWithNamesAndTypes", "Parquet"]; | ||
type StreamableDataFormat = (typeof streamableFormat)[number]; | ||
@@ -8,0 +8,0 @@ export declare function isSupportedRawFormat(dataFormat: DataFormat): boolean; |
@@ -37,2 +37,3 @@ "use strict"; | ||
'CustomSeparatedWithNamesAndTypes', | ||
'Parquet', | ||
]; | ||
@@ -39,0 +40,0 @@ // TODO add others formats |
@@ -32,3 +32,3 @@ "use strict"; | ||
const match = message.match(errorRe); | ||
const groups = match === null || match === void 0 ? void 0 : match.groups; | ||
const groups = match?.groups; | ||
if (groups) { | ||
@@ -35,0 +35,0 @@ return new ClickHouseError(groups); |
@@ -36,3 +36,3 @@ "use strict"; | ||
}); | ||
this.logLevel = logLevel !== null && logLevel !== void 0 ? logLevel : ClickHouseLogLevel.OFF; | ||
this.logLevel = logLevel ?? ClickHouseLogLevel.OFF; | ||
this.info({ | ||
@@ -39,0 +39,0 @@ module: 'Logger', |
@@ -19,3 +19,3 @@ "use strict"; | ||
if (searchParams) { | ||
newUrl.search = searchParams === null || searchParams === void 0 ? void 0 : searchParams.toString(); | ||
newUrl.search = searchParams?.toString(); | ||
} | ||
@@ -22,0 +22,0 @@ return newUrl; |
@@ -1,2 +0,2 @@ | ||
declare const _default: "0.2.5"; | ||
declare const _default: "0.2.6"; | ||
export default _default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = '0.2.5'; | ||
exports.default = '0.2.6'; | ||
//# sourceMappingURL=version.js.map |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://clickhouse.com", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"license": "Apache-2.0", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
228944