@clickhouse/client-common
Advanced tools
Comparing version 1.8.1 to 1.9.0
@@ -22,3 +22,3 @@ import type { BaseClickHouseClientConfigOptions, ClickHouseSettings, ConnExecResult, IsSame, WithClickHouseSummary, WithResponseHeaders } from '@clickhouse/client-common'; | ||
/** A specific list of roles to use for this query. | ||
* If it is not set, {@link BaseClickHouseClientConfigOptions.roles} will be used. | ||
* If it is not set, {@link BaseClickHouseClientConfigOptions.role} will be used. | ||
* @default undefined (no override) */ | ||
@@ -25,0 +25,0 @@ role?: string | Array<string>; |
@@ -0,1 +1,5 @@ | ||
export declare class TupleParam { | ||
readonly values: any[]; | ||
constructor(values: any[]); | ||
} | ||
export declare function formatQueryParams(value: any, wrapStringInQuotes?: boolean): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TupleParam = void 0; | ||
exports.formatQueryParams = formatQueryParams; | ||
class TupleParam { | ||
constructor(values) { | ||
Object.defineProperty(this, "values", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: values | ||
}); | ||
} | ||
} | ||
exports.TupleParam = TupleParam; | ||
function formatQueryParams(value, wrapStringInQuotes = false) { | ||
@@ -43,4 +55,3 @@ if (value === null || value === undefined) | ||
if (Array.isArray(value)) { | ||
const formatted = value.map((v) => formatQueryParams(v, true)); | ||
return `[${formatted.join(',')}]`; | ||
return `[${value.map((v) => formatQueryParams(v, true)).join(',')}]`; | ||
} | ||
@@ -57,2 +68,13 @@ if (value instanceof Date) { | ||
} | ||
if (value instanceof TupleParam) { | ||
return `(${value.values.map((v) => formatQueryParams(v, true)).join(',')})`; | ||
} | ||
if (value instanceof Map) { | ||
const formatted = []; | ||
for (const [key, val] of value) { | ||
formatted.push(`${formatQueryParams(key, true)}:${formatQueryParams(val, true)}`); | ||
} | ||
return `{${formatted.join(',')}}`; | ||
} | ||
// This is only useful for simple maps where the keys are strings | ||
if (typeof value === 'object') { | ||
@@ -59,0 +81,0 @@ const formatted = []; |
export * from './formatter'; | ||
export { formatQueryParams } from './format_query_params'; | ||
export { TupleParam, formatQueryParams } from './format_query_params'; | ||
export { formatQuerySettings } from './format_query_settings'; |
@@ -17,5 +17,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.formatQuerySettings = exports.formatQueryParams = void 0; | ||
exports.formatQuerySettings = exports.formatQueryParams = exports.TupleParam = void 0; | ||
__exportStar(require("./formatter"), exports); | ||
var format_query_params_1 = require("./format_query_params"); | ||
Object.defineProperty(exports, "TupleParam", { enumerable: true, get: function () { return format_query_params_1.TupleParam; } }); | ||
Object.defineProperty(exports, "formatQueryParams", { enumerable: true, get: function () { return format_query_params_1.formatQueryParams; } }); | ||
@@ -22,0 +23,0 @@ var format_query_settings_1 = require("./format_query_settings"); |
@@ -6,2 +6,3 @@ /** Should be re-exported by the implementation */ | ||
export type { DataFormat, RawDataFormat, JSONDataFormat, StreamableDataFormat, StreamableJSONDataFormat, SingleDocumentJSONFormat, SupportedJSONFormats, SupportedRawFormats, StreamableFormats, StreamableJSONFormats, SingleDocumentJSONFormats, RecordsJSONFormats, } from './data_formatter'; | ||
export { TupleParam } from './data_formatter'; | ||
export { ClickHouseError } from './error'; | ||
@@ -8,0 +9,0 @@ export { ClickHouseLogLevel, type ErrorLogParams, type WarnLogParams, type Logger, type LogParams, } from './logger'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
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; | ||
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.TupleParam = exports.ClickHouseClient = void 0; | ||
/** Should be re-exported by the implementation */ | ||
var client_1 = require("./client"); | ||
Object.defineProperty(exports, "ClickHouseClient", { enumerable: true, get: function () { return client_1.ClickHouseClient; } }); | ||
var data_formatter_1 = require("./data_formatter"); | ||
Object.defineProperty(exports, "TupleParam", { enumerable: true, get: function () { return data_formatter_1.TupleParam; } }); | ||
var error_1 = require("./error"); | ||
@@ -19,10 +21,10 @@ Object.defineProperty(exports, "ClickHouseError", { enumerable: true, get: function () { return error_1.ClickHouseError; } }); | ||
/** For implementations usage only - should not be re-exported */ | ||
var data_formatter_1 = require("./data_formatter"); | ||
Object.defineProperty(exports, "formatQuerySettings", { enumerable: true, get: function () { return data_formatter_1.formatQuerySettings; } }); | ||
Object.defineProperty(exports, "formatQueryParams", { enumerable: true, get: function () { return data_formatter_1.formatQueryParams; } }); | ||
Object.defineProperty(exports, "encodeJSON", { enumerable: true, get: function () { return data_formatter_1.encodeJSON; } }); | ||
Object.defineProperty(exports, "isSupportedRawFormat", { enumerable: true, get: function () { return data_formatter_1.isSupportedRawFormat; } }); | ||
Object.defineProperty(exports, "isStreamableJSONFamily", { enumerable: true, get: function () { return data_formatter_1.isStreamableJSONFamily; } }); | ||
Object.defineProperty(exports, "isNotStreamableJSONFamily", { enumerable: true, get: function () { return data_formatter_1.isNotStreamableJSONFamily; } }); | ||
Object.defineProperty(exports, "validateStreamFormat", { enumerable: true, get: function () { return data_formatter_1.validateStreamFormat; } }); | ||
var data_formatter_2 = require("./data_formatter"); | ||
Object.defineProperty(exports, "formatQuerySettings", { enumerable: true, get: function () { return data_formatter_2.formatQuerySettings; } }); | ||
Object.defineProperty(exports, "formatQueryParams", { enumerable: true, get: function () { return data_formatter_2.formatQueryParams; } }); | ||
Object.defineProperty(exports, "encodeJSON", { enumerable: true, get: function () { return data_formatter_2.encodeJSON; } }); | ||
Object.defineProperty(exports, "isSupportedRawFormat", { enumerable: true, get: function () { return data_formatter_2.isSupportedRawFormat; } }); | ||
Object.defineProperty(exports, "isStreamableJSONFamily", { enumerable: true, get: function () { return data_formatter_2.isStreamableJSONFamily; } }); | ||
Object.defineProperty(exports, "isNotStreamableJSONFamily", { enumerable: true, get: function () { return data_formatter_2.isNotStreamableJSONFamily; } }); | ||
Object.defineProperty(exports, "validateStreamFormat", { enumerable: true, get: function () { return data_formatter_2.validateStreamFormat; } }); | ||
var config_1 = require("./config"); | ||
@@ -29,0 +31,0 @@ Object.defineProperty(exports, "booleanConfigURLValue", { enumerable: true, get: function () { return config_1.booleanConfigURLValue; } }); |
@@ -31,3 +31,4 @@ "use strict"; | ||
for (const [key, value] of Object.entries(query_params)) { | ||
params.set(`param_${key}`, (0, data_formatter_1.formatQueryParams)(value)); | ||
const formattedParam = (0, data_formatter_1.formatQueryParams)(value); | ||
params.set(`param_${key}`, formattedParam); | ||
} | ||
@@ -34,0 +35,0 @@ } |
@@ -1,2 +0,2 @@ | ||
declare const _default: "1.8.1"; | ||
declare const _default: "1.9.0"; | ||
export default _default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = '1.8.1'; | ||
exports.default = '1.9.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://clickhouse.com", | ||
"version": "1.8.1", | ||
"version": "1.9.0", | ||
"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 too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
319898
4484