Socket
Socket
Sign inDemoInstall

@clickhouse/client

Package Overview
Dependencies
Maintainers
3
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clickhouse/client - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0-beta1

dist/connection/node_base_connection.d.ts

153

dist/client.d.ts
/// <reference types="node" />
/// <reference types="node" />
import Stream from 'stream';
import type { ExecResult, InsertResult } from './connection';
import type { Logger } from './logger';
import { type DataFormat } from './data_formatter';
import { ResultSet } from './result';
import type { ClickHouseSettings } from './settings';
import type { InputJSON, InputJSONObjectEachRow } from './clickhouse_types';
export interface ClickHouseClientConfigOptions {
/** A ClickHouse instance URL.
* <br/> Default value: `http://localhost:8123`. */
host?: string;
/** The request timeout in milliseconds.
* <br/> Default value: `30_000`. */
request_timeout?: number;
/** Maximum number of sockets to allow per host.
* <br/> Default value: `Infinity`. */
max_open_connections?: number;
compression?: {
/** `response: true` instructs ClickHouse server to respond with
* compressed response body. <br/> Default: true. */
response?: boolean;
/** `request: true` enabled compression on the client request body.
* <br/> Default: false. */
request?: boolean;
};
/** The name of the user on whose behalf requests are made.
* <br/> Default: 'default'. */
username?: string;
/** The user password. <br/> Default: ''. */
password?: string;
/** The name of the application using the nodejs client.
* <br/> Default: empty. */
application?: string;
/** Database name to use. <br/> Default value: `default`. */
database?: string;
/** ClickHouse settings to apply to all requests. <br/> Default value: {} */
clickhouse_settings?: ClickHouseSettings;
log?: {
/** A class to instantiate a custom logger implementation.
* <br/> Default: {@link DefaultLogger} */
LoggerClass?: new () => Logger;
};
import type { BaseClickHouseClientConfigOptions, Connection } from '@clickhouse/client-common';
import { ClickHouseClient } from '@clickhouse/client-common';
import type Stream from 'stream';
import type { NodeConnectionParams } from './connection';
export type NodeClickHouseClientConfigOptions = BaseClickHouseClientConfigOptions<Stream.Readable> & {
tls?: BasicTLSOptions | MutualTLSOptions;
session_id?: string;
/** HTTP Keep-Alive related settings */
keep_alive?: {
/** Enable or disable HTTP Keep-Alive mechanism. <br/> Default: true */
/** Enable or disable HTTP Keep-Alive mechanism. Default: true */
enabled?: boolean;

@@ -54,5 +16,5 @@ /** How long to keep a particular open socket alive

* Should be less than the server setting
* (see `keep_alive_timeout` in server's `config.xml`). <br/>
* (see `keep_alive_timeout` in server's `config.xml`).
* Currently, has no effect if {@link retry_on_expired_socket}
* is unset or false. <br/> Default value: 2500
* is unset or false. Default value: 2500
* (based on the default ClickHouse server setting, which is 3000) */

@@ -63,7 +25,6 @@ socket_ttl?: number;

* before sending the request, and this request will be retried
* with a new socket up to 3 times.
* <br/> * Default: false (no retries) */
* with a new socket up to 3 times. Default: false (no retries) */
retry_on_expired_socket?: boolean;
};
}
};
interface BasicTLSOptions {

@@ -77,94 +38,4 @@ ca_cert: Buffer;

}
export interface BaseParams {
/** ClickHouse settings that can be applied on query level. */
clickhouse_settings?: ClickHouseSettings;
/** Parameters for query binding. https://clickhouse.com/docs/en/interfaces/http/#cli-queries-with-parameters */
query_params?: Record<string, unknown>;
/** AbortSignal instance to cancel a request in progress. */
abort_signal?: AbortSignal;
/** A specific `query_id` that will be sent with this request.
* If it is not set, a random identifier will be generated automatically by the client. */
query_id?: string;
}
export interface QueryParams extends BaseParams {
/** Statement to execute. */
query: string;
/** Format of the resulting dataset. */
format?: DataFormat;
}
export interface ExecParams extends BaseParams {
/** Statement to execute. */
query: string;
}
export type CommandParams = ExecParams;
export interface CommandResult {
query_id: string;
}
type InsertValues<T> = ReadonlyArray<T> | Stream.Readable | InputJSON<T> | InputJSONObjectEachRow<T>;
export interface InsertParams<T = unknown> extends BaseParams {
/** Name of a table to insert into. */
table: string;
/** A dataset to insert. */
values: InsertValues<T>;
/** Format of the dataset to insert. */
format?: DataFormat;
}
export declare class ClickHouseClient {
private readonly config;
private readonly connection;
private readonly logger;
constructor(config?: ClickHouseClientConfigOptions);
private getBaseParams;
/**
* Used for most statements that can have a response, such as SELECT.
* FORMAT clause should be specified separately via {@link QueryParams.format} (default is JSON)
* Consider using {@link ClickHouseClient.insert} for data insertion,
* or {@link ClickHouseClient.command} for DDLs.
*/
query(params: QueryParams): Promise<ResultSet>;
/**
* It should be used for statements that do not have any output,
* when the format clause is not applicable, or when you are not interested in the response at all.
* Response stream is destroyed immediately as we do not expect useful information there.
* Examples of such statements are DDLs or custom inserts.
* If you are interested in the response data, consider using {@link ClickHouseClient.exec}
*/
command(params: CommandParams): Promise<CommandResult>;
/**
* Similar to {@link ClickHouseClient.command}, but for the cases where the output is expected,
* but format clause is not applicable. The caller of this method is expected to consume the stream,
* otherwise, the request will eventually be timed out.
*/
exec(params: ExecParams): Promise<ExecResult>;
/**
* The primary method for data insertion. It is recommended to avoid arrays in case of large inserts
* to reduce application memory consumption and consider streaming for most of such use cases.
* As the insert operation does not provide any output, the response stream is immediately destroyed.
* In case of a custom insert operation, such as, for example, INSERT FROM SELECT,
* consider using {@link ClickHouseClient.command}, passing the entire raw query there (including FORMAT clause).
*/
insert<T>(params: InsertParams<T>): Promise<InsertResult>;
/**
* Health-check request. Can throw an error if the connection is refused.
*/
ping(): Promise<boolean>;
/**
* Shuts down the underlying connection.
* This method should ideally be called only once per application lifecycle,
* for example, during the graceful shutdown phase.
*/
close(): Promise<void>;
}
export declare function validateInsertValues<T>(values: InsertValues<T>, format: DataFormat): void;
/**
* A function encodes an array or a stream of JSON objects to a format compatible with ClickHouse.
* If values are provided as an array of JSON objects, the function encodes it in place.
* If values are provided as a stream of JSON objects, the function sets up the encoding of each chunk.
* If values are provided as a raw non-object stream, the function does nothing.
*
* @param values a set of values to send to ClickHouse.
* @param format a format to encode value to.
*/
export declare function encodeValues<T>(values: InsertValues<T>, format: DataFormat): string | Stream.Readable;
export declare function createClient(config?: ClickHouseClientConfigOptions): ClickHouseClient;
export declare function createClient(config?: NodeClickHouseClientConfigOptions): ClickHouseClient<Stream.Readable>;
export declare function createConnection(params: NodeConnectionParams): Connection<Stream.Readable>;
export {};
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createClient = exports.encodeValues = exports.validateInsertValues = exports.ClickHouseClient = void 0;
const stream_1 = __importDefault(require("stream"));
exports.createConnection = exports.createClient = void 0;
const client_common_1 = require("@clickhouse/client-common");
const connection_1 = require("./connection");
const logger_1 = require("./logger");
const result_set_1 = require("./result_set");
const utils_1 = require("./utils");
const data_formatter_1 = require("./data_formatter");
const result_1 = require("./result");
function validateConfig({ url }) {
if (url.protocol !== 'http:' && url.protocol !== 'https:') {
throw new Error(`Only http(s) protocol is supported, but given: [${url.protocol}]`);
}
// TODO add SSL validation
}
function createUrl(host) {
try {
return new URL(host);
}
catch (err) {
throw new Error('Configuration parameter "host" contains malformed url.');
}
}
function normalizeConfig(config) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
function createClient(config) {
var _a, _b, _c, _d, _e, _f;
let tls = undefined;
if (config.tls) {
if (config === null || config === void 0 ? void 0 : config.tls) {
if ('cert' in config.tls && 'key' in config.tls) {

@@ -44,212 +25,41 @@ tls = {

}
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,
tls,
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,
},
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 : {},
log: {
LoggerClass: (_o = (_m = config.log) === null || _m === void 0 ? void 0 : _m.LoggerClass) !== null && _o !== void 0 ? _o : logger_1.DefaultLogger,
},
session_id: config.session_id,
keep_alive: {
enabled: (_q = (_p = config.keep_alive) === null || _p === void 0 ? void 0 : _p.enabled) !== null && _q !== void 0 ? _q : true,
socket_ttl: (_s = (_r = config.keep_alive) === null || _r === void 0 ? void 0 : _r.socket_ttl) !== null && _s !== void 0 ? _s : 2500,
retry_on_expired_socket: (_u = (_t = config.keep_alive) === null || _t === void 0 ? void 0 : _t.retry_on_expired_socket) !== null && _u !== void 0 ? _u : false,
},
const keep_alive = {
enabled: (_b = (_a = config === null || config === void 0 ? void 0 : config.keep_alive) === null || _a === void 0 ? void 0 : _a.enabled) !== null && _b !== void 0 ? _b : true,
socket_ttl: (_d = (_c = config === null || config === void 0 ? void 0 : config.keep_alive) === null || _c === void 0 ? void 0 : _c.socket_ttl) !== null && _d !== void 0 ? _d : 2500,
retry_on_expired_socket: (_f = (_e = config === null || config === void 0 ? void 0 : config.keep_alive) === null || _e === void 0 ? void 0 : _e.retry_on_expired_socket) !== null && _f !== void 0 ? _f : false,
};
}
class ClickHouseClient {
constructor(config = {}) {
Object.defineProperty(this, "config", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "connection", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "logger", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.config = normalizeConfig(config);
validateConfig(this.config);
this.logger = new logger_1.LogWriter(new this.config.log.LoggerClass());
this.connection = (0, connection_1.createConnection)(this.config, this.logger);
}
getBaseParams(params) {
return {
clickhouse_settings: {
...this.config.clickhouse_settings,
...params.clickhouse_settings,
return new client_common_1.ClickHouseClient({
impl: {
make_connection: (params) => {
switch (params.url.protocol) {
case 'http:':
return new connection_1.NodeHttpConnection({ ...params, keep_alive });
case 'https:':
return new connection_1.NodeHttpsConnection({ ...params, tls, keep_alive });
default:
throw new Error('Only HTTP(s) adapters are supported');
}
},
query_params: params.query_params,
abort_signal: params.abort_signal,
session_id: this.config.session_id,
query_id: params.query_id,
};
}
/**
* Used for most statements that can have a response, such as SELECT.
* FORMAT clause should be specified separately via {@link QueryParams.format} (default is JSON)
* Consider using {@link ClickHouseClient.insert} for data insertion,
* or {@link ClickHouseClient.command} for DDLs.
*/
async query(params) {
var _a;
const format = (_a = params.format) !== null && _a !== void 0 ? _a : 'JSON';
const query = formatQuery(params.query, format);
const { stream, query_id } = await this.connection.query({
query,
...this.getBaseParams(params),
});
return new result_1.ResultSet(stream, format, query_id);
}
/**
* It should be used for statements that do not have any output,
* when the format clause is not applicable, or when you are not interested in the response at all.
* Response stream is destroyed immediately as we do not expect useful information there.
* Examples of such statements are DDLs or custom inserts.
* If you are interested in the response data, consider using {@link ClickHouseClient.exec}
*/
async command(params) {
const { stream, query_id } = await this.exec(params);
stream.destroy();
return { query_id };
}
/**
* Similar to {@link ClickHouseClient.command}, but for the cases where the output is expected,
* but format clause is not applicable. The caller of this method is expected to consume the stream,
* otherwise, the request will eventually be timed out.
*/
async exec(params) {
const query = removeTrailingSemi(params.query.trim());
return await this.connection.exec({
query,
...this.getBaseParams(params),
});
}
/**
* The primary method for data insertion. It is recommended to avoid arrays in case of large inserts
* to reduce application memory consumption and consider streaming for most of such use cases.
* As the insert operation does not provide any output, the response stream is immediately destroyed.
* In case of a custom insert operation, such as, for example, INSERT FROM SELECT,
* consider using {@link ClickHouseClient.command}, passing the entire raw query there (including FORMAT clause).
*/
async insert(params) {
const format = params.format || 'JSONCompactEachRow';
validateInsertValues(params.values, format);
const query = `INSERT INTO ${params.table.trim()} FORMAT ${format}`;
return await this.connection.insert({
query,
values: encodeValues(params.values, format),
...this.getBaseParams(params),
});
}
/**
* Health-check request. Can throw an error if the connection is refused.
*/
async ping() {
return await this.connection.ping();
}
/**
* Shuts down the underlying connection.
* This method should ideally be called only once per application lifecycle,
* for example, during the graceful shutdown phase.
*/
async close() {
return await this.connection.close();
}
make_result_set: (stream, format, session_id) => new result_set_1.ResultSet(stream, format, session_id),
values_encoder: new utils_1.NodeValuesEncoder(),
close_stream: async (stream) => {
stream.destroy();
},
},
...(config || {}),
});
}
exports.ClickHouseClient = ClickHouseClient;
function formatQuery(query, format) {
query = query.trim();
query = removeTrailingSemi(query);
return query + ' \nFORMAT ' + format;
}
function removeTrailingSemi(query) {
let lastNonSemiIdx = query.length;
for (let i = lastNonSemiIdx; i > 0; i--) {
if (query[i - 1] !== ';') {
lastNonSemiIdx = i;
break;
}
}
if (lastNonSemiIdx !== query.length) {
return query.slice(0, lastNonSemiIdx);
}
return query;
}
function validateInsertValues(values, format) {
if (!Array.isArray(values) &&
!(0, utils_1.isStream)(values) &&
typeof values !== 'object') {
throw new Error('Insert expected "values" to be an array, a stream of values or a JSON object, ' +
`got: ${typeof values}`);
}
if ((0, utils_1.isStream)(values)) {
if ((0, data_formatter_1.isSupportedRawFormat)(format)) {
if (values.readableObjectMode) {
throw new Error(`Insert for ${format} expected Readable Stream with disabled object mode.`);
}
}
else if (!values.readableObjectMode) {
throw new Error(`Insert for ${format} expected Readable Stream with enabled object mode.`);
}
}
}
exports.validateInsertValues = validateInsertValues;
/**
* A function encodes an array or a stream of JSON objects to a format compatible with ClickHouse.
* If values are provided as an array of JSON objects, the function encodes it in place.
* If values are provided as a stream of JSON objects, the function sets up the encoding of each chunk.
* If values are provided as a raw non-object stream, the function does nothing.
*
* @param values a set of values to send to ClickHouse.
* @param format a format to encode value to.
*/
function encodeValues(values, format) {
if ((0, utils_1.isStream)(values)) {
// TSV/CSV/CustomSeparated formats don't require additional serialization
if (!values.readableObjectMode) {
return values;
}
// JSON* formats streams
return stream_1.default.pipeline(values, (0, utils_1.mapStream)((value) => (0, data_formatter_1.encodeJSON)(value, format)), pipelineCb);
}
// JSON* arrays
if (Array.isArray(values)) {
return values.map((value) => (0, data_formatter_1.encodeJSON)(value, format)).join('');
}
// JSON & JSONObjectEachRow format input
if (typeof values === 'object') {
return (0, data_formatter_1.encodeJSON)(values, format);
}
throw new Error(`Cannot encode values of type ${typeof values} with ${format} format`);
}
exports.encodeValues = encodeValues;
function createClient(config) {
return new ClickHouseClient(config);
}
exports.createClient = createClient;
function pipelineCb(err) {
if (err) {
console.error(err);
function createConnection(params) {
// TODO throw ClickHouseClient error
switch (params.url.protocol) {
case 'http:':
return new connection_1.NodeHttpConnection(params);
case 'https:':
return new connection_1.NodeHttpsConnection(params);
default:
throw new Error('Only HTTP(s) adapters are supported');
}
}
exports.createConnection = createConnection;
//# sourceMappingURL=client.js.map

@@ -1,1 +0,3 @@

export * from './connection';
export * from './node_base_connection';
export * from './node_http_connection';
export * from './node_https_connection';

@@ -17,3 +17,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./connection"), exports);
__exportStar(require("./node_base_connection"), exports);
__exportStar(require("./node_http_connection"), exports);
__exportStar(require("./node_https_connection"), exports);
//# sourceMappingURL=index.js.map

@@ -1,15 +0,4 @@

import { createClient } from './client';
export { createClient };
declare const _default: {
createClient: typeof createClient;
};
export default _default;
export { type ClickHouseClientConfigOptions, type ClickHouseClient, type BaseParams, type QueryParams, type ExecParams, type InsertParams, type CommandParams, type CommandResult, } from './client';
export { Row, ResultSet } from './result';
export type { Connection, ExecResult, InsertResult } from './connection';
export type { DataFormat } from './data_formatter';
export type { ClickHouseError } from './error';
export type { Logger } from './logger';
export type { ResponseJSON, InputJSON, InputJSONObjectEachRow, } from './clickhouse_types';
export type { ClickHouseSettings } from './settings';
export { SettingsMap } from './settings';
export { createConnection, createClient } from './client';
export { ResultSet } from './result_set';
/** Re-export @clickhouse/client-common types */
export { type BaseClickHouseClientConfigOptions, type ClickHouseClientConfigOptions, type BaseQueryParams, type QueryParams, type ExecParams, type InsertParams, type InsertValues, type CommandParams, type CommandResult, type ExecResult, type InsertResult, type DataFormat, type ErrorLogParams, type Logger, type LogParams, type ClickHouseSettings, type MergeTreeSettings, type Row, type ResponseJSON, type InputJSON, type InputJSONObjectEachRow, type BaseResultSet, ClickHouseError, ClickHouseLogLevel, ClickHouseClient, SettingsMap, } from '@clickhouse/client-common';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SettingsMap = exports.ResultSet = exports.createClient = void 0;
const client_1 = require("./client");
exports.SettingsMap = exports.ClickHouseClient = exports.ClickHouseLogLevel = exports.ClickHouseError = exports.ResultSet = exports.createClient = exports.createConnection = void 0;
var client_1 = require("./client");
Object.defineProperty(exports, "createConnection", { enumerable: true, get: function () { return client_1.createConnection; } });
Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return client_1.createClient; } });
exports.default = {
createClient: client_1.createClient,
};
var result_1 = require("./result");
Object.defineProperty(exports, "ResultSet", { enumerable: true, get: function () { return result_1.ResultSet; } });
var settings_1 = require("./settings");
Object.defineProperty(exports, "SettingsMap", { enumerable: true, get: function () { return settings_1.SettingsMap; } });
var result_set_1 = require("./result_set");
Object.defineProperty(exports, "ResultSet", { enumerable: true, get: function () { return result_set_1.ResultSet; } });
/** Re-export @clickhouse/client-common types */
var client_common_1 = require("@clickhouse/client-common");
Object.defineProperty(exports, "ClickHouseError", { enumerable: true, get: function () { return client_common_1.ClickHouseError; } });
Object.defineProperty(exports, "ClickHouseLogLevel", { enumerable: true, get: function () { return client_common_1.ClickHouseLogLevel; } });
Object.defineProperty(exports, "ClickHouseClient", { enumerable: true, get: function () { return client_common_1.ClickHouseClient; } });
Object.defineProperty(exports, "SettingsMap", { enumerable: true, get: function () { return client_common_1.SettingsMap; } });
//# sourceMappingURL=index.js.map
export * from './stream';
export * from './string';
export * from './encoder';
export * from './process';
export * from './user_agent';

@@ -18,3 +18,5 @@ "use strict";

__exportStar(require("./stream"), exports);
__exportStar(require("./string"), exports);
__exportStar(require("./encoder"), exports);
__exportStar(require("./process"), exports);
__exportStar(require("./user_agent"), exports);
//# sourceMappingURL=index.js.map

@@ -5,2 +5,2 @@ /// <reference types="node" />

export declare function getAsText(stream: Stream.Readable): Promise<string>;
export declare function mapStream(mapper: (input: any) => any): Stream.Transform;
export declare function mapStream(mapper: (input: unknown) => string): Stream.Transform;

@@ -32,3 +32,2 @@ "use strict";

const version_1 = __importDefault(require("../version"));
const process_1 = require("./process");
/**

@@ -41,3 +40,3 @@ * Generate a user agent string like

function getUserAgent(application_id) {
const defaultUserAgent = `clickhouse-js/${version_1.default} (lv:nodejs/${(0, process_1.getProcessVersion)()}; os:${os.platform()})`;
const defaultUserAgent = `clickhouse-js/${version_1.default} (lv:nodejs/${process.version}; os:${os.platform()})`;
return application_id

@@ -44,0 +43,0 @@ ? `${application_id} ${defaultUserAgent}`

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

declare const _default: "0.1.1";
export default _default;
declare const version = "0.2.0-beta1";
export default version;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = '0.1.1';
const version = '0.2.0-beta1';
exports.default = version;
//# sourceMappingURL=version.js.map
{
"name": "@clickhouse/client",
"version": "0.1.1",
"description": "Official JS client for ClickHouse DB",
"description": "Official JS client for ClickHouse DB - Node.js implementation",
"homepage": "https://clickhouse.com",
"version": "0.2.0-beta1",
"license": "Apache-2.0",

@@ -11,6 +12,2 @@ "keywords": [

],
"engines": {
"node": ">=16"
},
"private": false,
"repository": {

@@ -20,16 +17,5 @@ "type": "git",

},
"homepage": "https://clickhouse.com",
"scripts": {
"build": "rm -rf dist; tsc",
"build:all": "rm -rf dist; tsc --project tsconfig.dev.json",
"typecheck": "tsc --project tsconfig.dev.json --noEmit",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint --fix . --ext .ts",
"test": "jest --testPathPattern=__tests__ --globalSetup='<rootDir>/__tests__/setup.integration.ts'",
"test:tls": "jest --testMatch='**/__tests__/tls/*.test.ts'",
"test:unit": "jest --testMatch='**/__tests__/{unit,utils}/*.test.ts'",
"test:integration": "jest --runInBand --testPathPattern=__tests__/integration --globalSetup='<rootDir>/__tests__/setup.integration.ts'",
"test:integration:local_cluster": "CLICKHOUSE_TEST_ENVIRONMENT=local_cluster jest --runInBand --testPathPattern=__tests__/integration --globalSetup='<rootDir>/__tests__/setup.integration.ts'",
"test:integration:cloud": "CLICKHOUSE_TEST_ENVIRONMENT=cloud jest --runInBand --testPathPattern=__tests__/integration --globalSetup='<rootDir>/__tests__/setup.integration.ts'",
"prepare": "husky install"
"private": false,
"engines": {
"node": ">=16"
},

@@ -42,31 +28,4 @@ "main": "dist/index.js",

"dependencies": {
"uuid": "^9.0.0"
},
"devDependencies": {
"@jest/reporters": "^29.4.0",
"@types/jest": "^29.4.0",
"@types/node": "^18.11.18",
"@types/split2": "^3.2.1",
"@types/uuid": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^5.49.0",
"@typescript-eslint/parser": "^5.49.0",
"eslint": "^8.32.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.2",
"jest": "^29.4.0",
"lint-staged": "^13.1.0",
"prettier": "2.8.3",
"split2": "^4.1.0",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.1.2",
"typescript": "^4.9.4"
},
"lint-staged": {
"*.ts": [
"prettier --write",
"eslint --fix"
]
"@clickhouse/client-common": "0.2.0-beta1"
}
}
<p align="center">
<img src=".static/logo.png" width="200px" align="center">
<h1 align="center">ClickHouse Node.JS client</h1>
<h1 align="center">ClickHouse JS client</h1>
</p>

@@ -10,5 +10,2 @@ <br/>

</a>
<a href="http://htmlpreview.github.io/?https://github.com/ClickHouse/clickhouse-js/blob/main/coverage/lcov-report/index.html">
<img src="./coverage/badge.svg">
</a>
</p>

@@ -18,6 +15,13 @@

Official Node.js client for [ClickHouse](https://clickhouse.com/), written purely in TypeScript, thoroughly tested with actual ClickHouse versions.
Official JS client for [ClickHouse](https://clickhouse.com/), written purely in TypeScript,
thoroughly tested with actual ClickHouse versions.
It is focused on data streaming for both inserts and selects using standard [Node.js Streaming API](https://nodejs.org/docs/latest-v14.x/api/stream.html).
The repository consists of three packages:
- `@clickhouse/client` - Node.js client, built on top of [HTTP](https://nodejs.org/api/http.html)
and [Stream](https://nodejs.org/api/stream.html) APIs; supports streaming for both selects and inserts.
- `@clickhouse/client-browser` - browser client, built on top of [Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
and [Web Streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) APIs; supports streaming for selects.
- `@clickhouse/common` - shared common types and the base framework for building a custom client implementation.
## Documentation

@@ -24,0 +28,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

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