Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@clickhouse/client-common

Package Overview
Dependencies
Maintainers
4
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clickhouse/client-common - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

dist/parse/column_types.d.ts

7

dist/clickhouse_types.d.ts

@@ -45,1 +45,8 @@ export interface ResponseJSON<T = unknown> {

}
/** X-ClickHouse-Summary response header and progress rows from JSONEachRowWithProgress share the same structure */
export interface ProgressRow {
progress: ClickHouseSummary;
}
/** Type guard to use with JSONEachRowWithProgress, checking if the emitted row is a progress row.
* @see https://clickhouse.com/docs/en/interfaces/formats#jsoneachrowwithprogress */
export declare function isProgressRow(row: unknown): row is ProgressRow;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isProgressRow = isProgressRow;
/** Type guard to use with JSONEachRowWithProgress, checking if the emitted row is a progress row.
* @see https://clickhouse.com/docs/en/interfaces/formats#jsoneachrowwithprogress */
function isProgressRow(row) {
return (row !== null &&
typeof row === 'object' &&
'progress' in row &&
Object.keys(row).length === 1);
}
//# sourceMappingURL=clickhouse_types.js.map

19

dist/config.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.enumConfigURLValue = exports.numberConfigURLValue = exports.booleanConfigURLValue = exports.loadConfigOptionsFromURL = exports.createUrl = exports.mergeConfigs = exports.getConnectionParams = exports.prepareConfigWithURL = void 0;
exports.prepareConfigWithURL = prepareConfigWithURL;
exports.getConnectionParams = getConnectionParams;
exports.mergeConfigs = mergeConfigs;
exports.createUrl = createUrl;
exports.loadConfigOptionsFromURL = loadConfigOptionsFromURL;
exports.booleanConfigURLValue = booleanConfigURLValue;
exports.numberConfigURLValue = numberConfigURLValue;
exports.enumConfigURLValue = enumConfigURLValue;
const logger_1 = require("./logger");

@@ -43,3 +50,2 @@ /**

}
exports.prepareConfigWithURL = prepareConfigWithURL;
function getConnectionParams(config, logger) {

@@ -64,3 +70,2 @@ return {

}
exports.getConnectionParams = getConnectionParams;
/**

@@ -101,3 +106,2 @@ * Merge two versions of the config: base (hardcoded) from the instance creation and the URL parsed one.

}
exports.mergeConfigs = mergeConfigs;
function createUrl(configURL) {

@@ -114,3 +118,3 @@ let url;

catch (err) {
throw new Error('ClickHouse URL is malformed. Expected format: http[s]://[username:password@]hostname:port[/database][?param1=value1&param2=value2]');
throw new Error('ClickHouse URL is malformed. Expected format: http[s]://[username:password@]hostname:port[/database][?param1=value1&param2=value2]', { cause: err });
}

@@ -122,3 +126,2 @@ if (url.protocol !== 'http:' && url.protocol !== 'https:') {

}
exports.createUrl = createUrl;
/**

@@ -260,3 +263,2 @@ * @param url potentially contains auth, database and URL params to parse the configuration from

}
exports.loadConfigOptionsFromURL = loadConfigOptionsFromURL;
function booleanConfigURLValue({ key, value, }) {

@@ -270,3 +272,2 @@ const trimmed = value.trim();

}
exports.booleanConfigURLValue = booleanConfigURLValue;
function numberConfigURLValue({ key, value, min, max, }) {

@@ -285,3 +286,2 @@ const trimmed = value.trim();

}
exports.numberConfigURLValue = numberConfigURLValue;
function enumConfigURLValue({ key, value, enumObject, }) {

@@ -296,3 +296,2 @@ const values = Object.keys(enumObject).filter((item) => isNaN(Number(item)));

}
exports.enumConfigURLValue = enumConfigURLValue;
//# sourceMappingURL=config.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatQueryParams = void 0;
exports.formatQueryParams = formatQueryParams;
function formatQueryParams(value, wrapStringInQuotes = false) {

@@ -65,3 +65,2 @@ if (value === null || value === undefined)

}
exports.formatQueryParams = formatQueryParams;
const TabASCII = 9;

@@ -68,0 +67,0 @@ const NewlineASCII = 10;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatQuerySettings = void 0;
exports.formatQuerySettings = formatQuerySettings;
const settings_1 = require("../settings");

@@ -20,3 +20,2 @@ function formatQuerySettings(value) {

}
exports.formatQuerySettings = formatQuerySettings;
//# sourceMappingURL=format_query_settings.js.map

@@ -1,7 +0,7 @@

export declare const StreamableJSONFormats: readonly ["JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes"];
export declare const StreamableJSONFormats: readonly ["JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes", "JSONEachRowWithProgress"];
export declare const RecordsJSONFormats: readonly ["JSONObjectEachRow"];
export declare const SingleDocumentJSONFormats: readonly ["JSON", "JSONStrings", "JSONCompact", "JSONCompactStrings", "JSONColumnsWithMetadata"];
export declare const SupportedJSONFormats: readonly ["JSONObjectEachRow", "JSON", "JSONStrings", "JSONCompact", "JSONCompactStrings", "JSONColumnsWithMetadata", "JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes"];
export declare const SupportedJSONFormats: readonly ["JSONObjectEachRow", "JSON", "JSONStrings", "JSONCompact", "JSONCompactStrings", "JSONColumnsWithMetadata", "JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes", "JSONEachRowWithProgress"];
export declare const SupportedRawFormats: readonly ["CSV", "CSVWithNames", "CSVWithNamesAndTypes", "TabSeparated", "TabSeparatedRaw", "TabSeparatedWithNames", "TabSeparatedWithNamesAndTypes", "CustomSeparated", "CustomSeparatedWithNames", "CustomSeparatedWithNamesAndTypes", "Parquet"];
export declare const StreamableFormats: readonly ["JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes", "CSV", "CSVWithNames", "CSVWithNamesAndTypes", "TabSeparated", "TabSeparatedRaw", "TabSeparatedWithNames", "TabSeparatedWithNamesAndTypes", "CustomSeparated", "CustomSeparatedWithNames", "CustomSeparatedWithNamesAndTypes", "Parquet"];
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"];
/** CSV, TSV, etc. - can be streamed, but cannot be decoded as JSON. */

@@ -8,0 +8,0 @@ export type RawDataFormat = (typeof SupportedRawFormats)[number];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.encodeJSON = exports.validateStreamFormat = exports.isSupportedRawFormat = exports.isStreamableJSONFamily = exports.isNotStreamableJSONFamily = exports.StreamableFormats = exports.SupportedRawFormats = exports.SupportedJSONFormats = exports.SingleDocumentJSONFormats = exports.RecordsJSONFormats = exports.StreamableJSONFormats = void 0;
exports.StreamableFormats = exports.SupportedRawFormats = exports.SupportedJSONFormats = exports.SingleDocumentJSONFormats = exports.RecordsJSONFormats = exports.StreamableJSONFormats = void 0;
exports.isNotStreamableJSONFamily = isNotStreamableJSONFamily;
exports.isStreamableJSONFamily = isStreamableJSONFamily;
exports.isSupportedRawFormat = isSupportedRawFormat;
exports.validateStreamFormat = validateStreamFormat;
exports.encodeJSON = encodeJSON;
exports.StreamableJSONFormats = [

@@ -13,2 +18,3 @@ 'JSONEachRow',

'JSONCompactStringsEachRowWithNamesAndTypes',
'JSONEachRowWithProgress',
];

@@ -49,11 +55,8 @@ exports.RecordsJSONFormats = ['JSONObjectEachRow'];

}
exports.isNotStreamableJSONFamily = isNotStreamableJSONFamily;
function isStreamableJSONFamily(format) {
return exports.StreamableJSONFormats.includes(format);
}
exports.isStreamableJSONFamily = isStreamableJSONFamily;
function isSupportedRawFormat(dataFormat) {
return exports.SupportedRawFormats.includes(dataFormat);
}
exports.isSupportedRawFormat = isSupportedRawFormat;
function validateStreamFormat(format) {

@@ -65,3 +68,2 @@ if (!exports.StreamableFormats.includes(format)) {

}
exports.validateStreamFormat = validateStreamFormat;
/**

@@ -79,3 +81,2 @@ * Encodes a single row of values into a string in a JSON format acceptable by ClickHouse.

}
exports.encodeJSON = encodeJSON;
//# sourceMappingURL=formatter.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseError = exports.ClickHouseError = void 0;
exports.ClickHouseError = void 0;
exports.parseError = parseError;
const errorRe = /(Code|Error): (?<code>\d+).*Exception: (?<message>.+)\((?<type>(?=.+[A-Z]{3})[A-Z0-9_]+?)\)/s;

@@ -40,3 +41,2 @@ class ClickHouseError extends Error {

}
exports.parseError = parseError;
//# sourceMappingURL=parse_error.js.map
/** Should be re-exported by the implementation */
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';
export { type BaseClickHouseClientConfigOptions } from './config';
export type { Row, BaseResultSet, ResultJSONType, RowJSONType, ResultStream, } from './result';
export type { Row, RowOrProgress, BaseResultSet, ResultJSONType, RowJSONType, ResultStream, } from './result';
export type { DataFormat, RawDataFormat, JSONDataFormat, StreamableDataFormat, StreamableJSONDataFormat, SingleDocumentJSONFormat, SupportedJSONFormats, SupportedRawFormats, StreamableFormats, StreamableJSONFormats, SingleDocumentJSONFormats, RecordsJSONFormats, } from './data_formatter';
export { ClickHouseError } from './error';
export { ClickHouseLogLevel, type ErrorLogParams, type WarnLogParams, type Logger, type LogParams, } from './logger';
export type { ClickHouseSummary, InputJSON, InputJSONObjectEachRow, ResponseJSON, ResponseHeaders, WithClickHouseSummary, WithResponseHeaders, } from './clickhouse_types';
export type { ClickHouseSummary, InputJSON, InputJSONObjectEachRow, ResponseJSON, ResponseHeaders, WithClickHouseSummary, WithResponseHeaders, ProgressRow, } from './clickhouse_types';
export { isProgressRow } from './clickhouse_types';
export { type ClickHouseSettings, type MergeTreeSettings, SettingsMap, } from './settings';
export type { SimpleColumnType, ParsedColumnSimple, ParsedColumnEnum, ParsedColumnFixedString, ParsedColumnNullable, ParsedColumnDecimal, ParsedColumnDateTime, ParsedColumnDateTime64, ParsedColumnArray, ParsedColumnTuple, ParsedColumnMap, ParsedColumnType, } from './parse';
export { SimpleColumnTypes, parseColumnType } from './parse';
/** For implementations usage only - should not be re-exported */

@@ -11,0 +14,0 @@ export { formatQuerySettings, formatQueryParams, encodeJSON, isSupportedRawFormat, isStreamableJSONFamily, isNotStreamableJSONFamily, validateStreamFormat, } from './data_formatter';

"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.SettingsMap = 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.ClickHouseClient = void 0;
/** Should be re-exported by the implementation */

@@ -11,4 +11,9 @@ var client_1 = require("./client");

Object.defineProperty(exports, "ClickHouseLogLevel", { enumerable: true, get: function () { return logger_1.ClickHouseLogLevel; } });
var clickhouse_types_1 = require("./clickhouse_types");
Object.defineProperty(exports, "isProgressRow", { enumerable: true, get: function () { return clickhouse_types_1.isProgressRow; } });
var settings_1 = require("./settings");
Object.defineProperty(exports, "SettingsMap", { enumerable: true, get: function () { return settings_1.SettingsMap; } });
var parse_1 = require("./parse");
Object.defineProperty(exports, "SimpleColumnTypes", { enumerable: true, get: function () { return parse_1.SimpleColumnTypes; } });
Object.defineProperty(exports, "parseColumnType", { enumerable: true, get: function () { return parse_1.parseColumnType; } });
/** For implementations usage only - should not be re-exported */

@@ -15,0 +20,0 @@ var data_formatter_1 = require("./data_formatter");

@@ -1,7 +0,10 @@

import type { ResponseHeaders, ResponseJSON } from './clickhouse_types';
import type { ProgressRow, ResponseHeaders, ResponseJSON } from './clickhouse_types';
import type { DataFormat, RawDataFormat, RecordsJSONFormat, SingleDocumentJSONFormat, StreamableDataFormat, StreamableJSONDataFormat } from './data_formatter';
export type RowOrProgress<T> = {
row: T;
} | ProgressRow;
export type ResultStream<Format extends DataFormat | unknown, Stream> = Format extends StreamableDataFormat ? Stream : Format extends SingleDocumentJSONFormat ? never : Format extends RecordsJSONFormat ? never : Stream;
export type ResultJSONType<T, F extends DataFormat | unknown> = F extends StreamableJSONDataFormat ? T[] : F extends SingleDocumentJSONFormat ? ResponseJSON<T> : F extends RecordsJSONFormat ? Record<string, T> : F extends RawDataFormat ? never : // happens only when Format could not be inferred from a literal
export type ResultJSONType<T, F extends DataFormat | unknown> = F extends 'JSONEachRowWithProgress' ? RowOrProgress<T>[] : F extends StreamableJSONDataFormat ? T[] : F extends SingleDocumentJSONFormat ? ResponseJSON<T> : F extends RecordsJSONFormat ? Record<string, T> : F extends RawDataFormat ? never : // happens only when Format could not be inferred from a literal
T[] | Record<string, T> | ResponseJSON<T>;
export type RowJSONType<T, F extends DataFormat | unknown> = F extends StreamableJSONDataFormat ? T : F extends RawDataFormat | SingleDocumentJSONFormat | RecordsJSONFormat ? never : T;
export type RowJSONType<T, F extends DataFormat | unknown> = F extends 'JSONEachRowWithProgress' ? RowOrProgress<T> : F extends StreamableJSONDataFormat ? T : F extends RawDataFormat | SingleDocumentJSONFormat | RecordsJSONFormat ? never : T;
export interface Row<JSONType = unknown, Format extends DataFormat | unknown = unknown> {

@@ -8,0 +11,0 @@ /** A string representation of a row. */

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSuccessfulResponse = exports.withHttpSettings = exports.withCompressionHeaders = void 0;
exports.withCompressionHeaders = withCompressionHeaders;
exports.withHttpSettings = withHttpSettings;
exports.isSuccessfulResponse = isSuccessfulResponse;
function withCompressionHeaders({ headers, enable_request_compression, enable_response_compression, }) {

@@ -11,3 +13,2 @@ return {

}
exports.withCompressionHeaders = withCompressionHeaders;
function withHttpSettings(clickhouse_settings, compression) {

@@ -23,7 +24,5 @@ return {

}
exports.withHttpSettings = withHttpSettings;
function isSuccessfulResponse(statusCode) {
return Boolean(statusCode && 200 <= statusCode && statusCode < 300);
}
exports.isSuccessfulResponse = isSuccessfulResponse;
//# sourceMappingURL=connection.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sleep = void 0;
exports.sleep = sleep;
async function sleep(ms) {

@@ -9,3 +9,2 @@ await new Promise((resolve) => setTimeout(() => {

}
exports.sleep = sleep;
//# sourceMappingURL=sleep.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toSearchParams = exports.transformUrl = void 0;
exports.transformUrl = transformUrl;
exports.toSearchParams = toSearchParams;
const data_formatter_1 = require("../data_formatter");

@@ -23,3 +24,2 @@ function transformUrl({ url, pathname, searchParams, }) {

}
exports.transformUrl = transformUrl;
// TODO validate max length of the resulting query

@@ -53,3 +53,2 @@ // https://stackoverflow.com/questions/812925/what-is-the-maximum-possible-length-of-a-query-string

}
exports.toSearchParams = toSearchParams;
//# sourceMappingURL=url.js.map

@@ -1,2 +0,2 @@

declare const _default: "1.6.0";
declare const _default: "1.7.0";
export default _default;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = '1.6.0';
exports.default = '1.7.0';
//# sourceMappingURL=version.js.map

@@ -5,3 +5,3 @@ {

"homepage": "https://clickhouse.com",
"version": "1.6.0",
"version": "1.7.0",
"license": "Apache-2.0",

@@ -8,0 +8,0 @@ "keywords": [

@@ -22,2 +22,4 @@ <p align="center">

<img src="https://sonarcloud.io/api/project_badges/measure?project=ClickHouse_clickhouse-js&metric=coverage">
<img src="https://api.scorecard.dev/projects/github.com/ClickHouse/clickhouse-js/badge">
</p>

@@ -24,0 +26,0 @@

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc