New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@clickhouse/client-common

Package Overview
Dependencies
Maintainers
4
Versions
32
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.9.1 to 1.10.0

11

dist/clickhouse_types.d.ts

@@ -49,4 +49,15 @@ export interface ResponseJSON<T = unknown> {

}
export type InsertValues<Stream, T = unknown> = ReadonlyArray<T> | Stream | InputJSON<T> | InputJSONObjectEachRow<T>;
export type NonEmptyArray<T> = [T, ...T[]];
export interface ClickHouseCredentialsAuth {
username?: string;
password?: string;
}
/** Supported in ClickHouse Cloud only */
export interface ClickHouseJWTAuth {
access_token: string;
}
export type ClickHouseAuth = ClickHouseCredentialsAuth | ClickHouseJWTAuth;
/** 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;

10

dist/client.d.ts
import type { BaseClickHouseClientConfigOptions, ClickHouseSettings, ConnExecResult, IsSame, WithClickHouseSummary, WithResponseHeaders } from '@clickhouse/client-common';
import { type DataFormat } from '@clickhouse/client-common';
import type { InputJSON, InputJSONObjectEachRow } from './clickhouse_types';
import type { InsertValues, NonEmptyArray } from './clickhouse_types';
import type { ImplementationDetails } from './config';

@@ -25,4 +25,3 @@ import type { ConnPingResult } from './connection';

role?: string | Array<string>;
/** When defined, overrides the credentials from the {@link BaseClickHouseClientConfigOptions.username}
* and {@link BaseClickHouseClientConfigOptions.password} settings for this particular request.
/** When defined, overrides {@link BaseClickHouseClientConfigOptions.auth} for this particular request.
* @default undefined (no override) */

@@ -32,2 +31,4 @@ auth?: {

password: string;
} | {
access_token: string;
};

@@ -92,4 +93,2 @@ }

export type PingResult = ConnPingResult;
export type InsertValues<Stream, T = unknown> = ReadonlyArray<T> | Stream | InputJSON<T> | InputJSONObjectEachRow<T>;
type NonEmptyArray<T> = [T, ...T[]];
/** {@link except} field contains a non-empty list of columns to exclude when generating `(* EXCEPT (...))` clause */

@@ -181,2 +180,1 @@ export interface InsertColumnsExcept {

}
export {};

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

import type { ResponseHeaders } from './clickhouse_types';
import type { InsertValues } from './client';
import type { InsertValues, ResponseHeaders } from './clickhouse_types';
import type { Connection, ConnectionParams } from './connection';

@@ -42,7 +41,14 @@ import type { DataFormat } from './data_formatter';

/** The name of the user on whose behalf requests are made.
* Should not be set if {@link access_token} is provided.
* @default default */
username?: string;
/** The user password.
* Should not be set if {@link access_token} is provided.
* @default empty string */
password?: string;
/** A JWT access token to authenticate with ClickHouse.
* JWT token authentication is supported in ClickHouse Cloud only.
* Should not be set if {@link username} or {@link password} are provided.
* @default empty */
access_token?: string;
/** The name of the application using the JS client.

@@ -49,0 +55,0 @@ * @default empty string */

20

dist/config.js

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

function getConnectionParams(config, logger) {
let auth;
if (config.access_token !== undefined) {
if (config.username !== undefined || config.password !== undefined) {
throw new Error('Both access token and username/password are provided in the configuration. Please use only one authentication method.');
}
auth = { access_token: config.access_token, type: 'JWT' };
}
else {
auth = {
username: config.username ?? 'default',
password: config.password ?? '',
type: 'Credentials',
};
}
return {
auth,
url: config.url,

@@ -61,4 +76,2 @@ application_id: config.application,

},
username: config.username ?? 'default',
password: config.password ?? '',
database: config.database ?? 'default',

@@ -231,2 +244,5 @@ log_writer: new logger_1.LogWriter(logger, 'Connection', config.log?.level),

break;
case 'access_token':
config.access_token = value;
break;
default:

@@ -233,0 +249,0 @@ paramWasProcessed = false;

import type { WithClickHouseSummary, WithResponseHeaders } from './clickhouse_types';
import type { LogWriter } from './logger';
import type { ClickHouseSettings } from './settings';
export type ConnectionAuth = {
username: string;
password: string;
type: 'Credentials';
} | {
access_token: string;
type: 'JWT';
};
export interface ConnectionParams {

@@ -9,4 +17,2 @@ url: URL;

compression: CompressionSettings;
username: string;
password: string;
database: string;

@@ -20,2 +26,3 @@ clickhouse_settings: ClickHouseSettings;

http_headers?: Record<string, string>;
auth: ConnectionAuth;
}

@@ -36,2 +43,4 @@ export interface CompressionSettings {

password: string;
} | {
access_token: string;
};

@@ -38,0 +47,0 @@ role?: string | Array<string>;

/** 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 BaseQueryParams, type QueryParams, type QueryResult, type ExecParams, type InsertParams, ClickHouseClient, type CommandParams, type CommandResult, type ExecResult, type InsertResult, type PingResult, } from './client';
export { type BaseClickHouseClientConfigOptions } from './config';

@@ -9,3 +9,3 @@ export type { Row, RowOrProgress, BaseResultSet, ResultJSONType, RowJSONType, ResultStream, } from './result';

export { ClickHouseLogLevel, type ErrorLogParams, type WarnLogParams, type Logger, type LogParams, } from './logger';
export type { ClickHouseSummary, InputJSON, InputJSONObjectEachRow, ResponseJSON, ResponseHeaders, WithClickHouseSummary, WithResponseHeaders, ProgressRow, } from './clickhouse_types';
export type { ClickHouseSummary, InputJSON, InputJSONObjectEachRow, ResponseJSON, ResponseHeaders, WithClickHouseSummary, WithResponseHeaders, ProgressRow, InsertValues, ClickHouseAuth, ClickHouseJWTAuth, ClickHouseCredentialsAuth, } from './clickhouse_types';
export { isProgressRow } from './clickhouse_types';

@@ -18,3 +18,3 @@ export { type ClickHouseSettings, type MergeTreeSettings, SettingsMap, } from './settings';

export { type ValuesEncoder, type MakeResultSet, type MakeConnection, type HandleImplSpecificURLParams, type ImplementationDetails, booleanConfigURLValue, enumConfigURLValue, getConnectionParams, numberConfigURLValue, } from './config';
export { isSuccessfulResponse, sleep, toSearchParams, transformUrl, withCompressionHeaders, withHttpSettings, } from './utils';
export { isSuccessfulResponse, sleep, toSearchParams, transformUrl, withCompressionHeaders, withHttpSettings, isCredentialsAuth, isJWTAuth, } from './utils';
export { LogWriter, DefaultLogger, type LogWriterParams } from './logger';

@@ -21,0 +21,0 @@ export { parseError } from './error';

"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.TupleParam = exports.ClickHouseClient = void 0;
exports.parseError = exports.DefaultLogger = exports.LogWriter = exports.isJWTAuth = exports.isCredentialsAuth = 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 */

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

Object.defineProperty(exports, "withHttpSettings", { enumerable: true, get: function () { return utils_1.withHttpSettings; } });
Object.defineProperty(exports, "isCredentialsAuth", { enumerable: true, get: function () { return utils_1.isCredentialsAuth; } });
Object.defineProperty(exports, "isJWTAuth", { enumerable: true, get: function () { return utils_1.isJWTAuth; } });
var logger_2 = require("./logger");

@@ -43,0 +45,0 @@ Object.defineProperty(exports, "LogWriter", { enumerable: true, get: function () { return logger_2.LogWriter; } });

@@ -11,1 +11,8 @@ import type { ClickHouseSettings } from '../settings';

export declare function isSuccessfulResponse(statusCode?: number): boolean;
export declare function isJWTAuth(auth: unknown): auth is {
access_token: string;
};
export declare function isCredentialsAuth(auth: unknown): auth is {
username: string;
password: string;
};

@@ -6,2 +6,4 @@ "use strict";

exports.isSuccessfulResponse = isSuccessfulResponse;
exports.isJWTAuth = isJWTAuth;
exports.isCredentialsAuth = isCredentialsAuth;
function withCompressionHeaders({ headers, enable_request_compression, enable_response_compression, }) {

@@ -27,2 +29,11 @@ return {

}
function isJWTAuth(auth) {
return auth !== null && typeof auth === 'object' && 'access_token' in auth;
}
function isCredentialsAuth(auth) {
return (auth !== null &&
typeof auth === 'object' &&
'username' in auth &&
'password' in auth);
}
//# sourceMappingURL=connection.js.map

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

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

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

"homepage": "https://clickhouse.com",
"version": "1.9.1",
"version": "1.10.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 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