Socket
Socket
Sign inDemoInstall

@clickhouse/client-common

Package Overview
Dependencies
Maintainers
4
Versions
26
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.2.0 to 1.3.0

4

dist/clickhouse_types.d.ts

@@ -36,4 +36,8 @@ export interface ResponseJSON<T = unknown> {

}
export type ResponseHeaders = Record<string, string | string[] | undefined>;
export interface WithClickHouseSummary {
summary?: ClickHouseSummary;
}
export interface WithResponseHeaders {
response_headers: ResponseHeaders;
}

6

dist/client.d.ts

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

import type { BaseClickHouseClientConfigOptions, ClickHouseSettings, ConnExecResult, IsSame, WithClickHouseSummary } from '@clickhouse/client-common';
import type { BaseClickHouseClientConfigOptions, ClickHouseSettings, ConnExecResult, IsSame, WithClickHouseSummary, WithResponseHeaders } from '@clickhouse/client-common';
import { type DataFormat } from '@clickhouse/client-common';

@@ -50,3 +50,3 @@ import type { InputJSON, InputJSONObjectEachRow } from './clickhouse_types';

query_id: string;
} & WithClickHouseSummary;
} & WithClickHouseSummary & WithResponseHeaders;
export type InsertResult = {

@@ -65,3 +65,3 @@ /**

query_id: string;
} & WithClickHouseSummary;
} & WithClickHouseSummary & WithResponseHeaders;
export type ExecResult<Stream> = ConnExecResult<Stream>;

@@ -68,0 +68,0 @@ export type PingResult = ConnPingResult;

@@ -73,3 +73,3 @@ "use strict";

const queryParams = this.withClientQueryParams(params);
const { stream, query_id } = await this.connection.query({
const { stream, query_id, response_headers } = await this.connection.query({
query,

@@ -89,3 +89,3 @@ ...queryParams,

});
});
}, response_headers);
}

@@ -127,3 +127,3 @@ /**

if (Array.isArray(params.values) && params.values.length === 0) {
return { executed: false, query_id: '' };
return { executed: false, query_id: '', response_headers: {} };
}

@@ -130,0 +130,0 @@ const format = params.format || 'JSONCompactEachRow';

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

import type { ResponseHeaders } from './clickhouse_types';
import type { InsertValues } from './client';

@@ -80,3 +81,3 @@ import type { Connection, ConnectionParams } from './connection';

export type MakeConnection<Stream, Config = BaseClickHouseClientConfigOptionsWithURL> = (config: Config, params: ConnectionParams) => Connection<Stream>;
export type MakeResultSet<Stream> = <Format extends DataFormat, ResultSet extends BaseResultSet<Stream, Format>>(stream: Stream, format: Format, query_id: string, log_error: (err: Error) => void) => ResultSet;
export type MakeResultSet<Stream> = <Format extends DataFormat, ResultSet extends BaseResultSet<Stream, Format>>(stream: Stream, format: Format, query_id: string, log_error: (err: Error) => void, response_headers: ResponseHeaders) => ResultSet;
export interface ValuesEncoder<Stream> {

@@ -83,0 +84,0 @@ validateInsertValues<T = unknown>(values: InsertValues<Stream, T>, format: DataFormat): void;

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

import type { WithClickHouseSummary } from './clickhouse_types';
import type { WithClickHouseSummary, WithResponseHeaders } from './clickhouse_types';
import type { LogWriter } from './logger';

@@ -39,3 +39,3 @@ import type { ClickHouseSettings } from './settings';

}
export interface ConnBaseResult {
export interface ConnBaseResult extends WithResponseHeaders {
query_id: string;

@@ -42,0 +42,0 @@ }

@@ -1,14 +0,16 @@

declare const streamableJSONFormats: readonly ["JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes"];
declare const recordsJSONFormats: readonly ["JSONObjectEachRow"];
declare const singleDocumentJSONFormats: readonly ["JSON", "JSONStrings", "JSONCompact", "JSONCompactStrings", "JSONColumnsWithMetadata"];
declare const supportedRawFormats: readonly ["CSV", "CSVWithNames", "CSVWithNamesAndTypes", "TabSeparated", "TabSeparatedRaw", "TabSeparatedWithNames", "TabSeparatedWithNamesAndTypes", "CustomSeparated", "CustomSeparatedWithNames", "CustomSeparatedWithNamesAndTypes", "Parquet"];
export declare const StreamableJSONFormats: readonly ["JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes"];
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 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"];
/** CSV, TSV, etc. - can be streamed, but cannot be decoded as JSON. */
export type RawDataFormat = (typeof supportedRawFormats)[number];
export type RawDataFormat = (typeof SupportedRawFormats)[number];
/** Each row is returned as a separate JSON object or an array, and these formats can be streamed. */
export type StreamableJSONDataFormat = (typeof streamableJSONFormats)[number];
export type StreamableJSONDataFormat = (typeof StreamableJSONFormats)[number];
/** Returned as a single {@link ResponseJSON} object, cannot be streamed. */
export type SingleDocumentJSONFormat = (typeof singleDocumentJSONFormats)[number];
export type SingleDocumentJSONFormat = (typeof SingleDocumentJSONFormats)[number];
/** Returned as a single object { row_1: T, row_2: T, ...} <br/>
* (i.e. Record<string, T>), cannot be streamed. */
export type RecordsJSONFormat = (typeof recordsJSONFormats)[number];
export type RecordsJSONFormat = (typeof RecordsJSONFormats)[number];
/** All allowed JSON formats, whether streamable or not. */

@@ -26,5 +28,4 @@ export type JSONDataFormat = StreamableJSONDataFormat | SingleDocumentJSONFormat | RecordsJSONFormat;

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", "Parquet"];
/** All data formats that can be streamed, whether it can be decoded as JSON or not. */
export type StreamableDataFormat = (typeof streamableFormat)[number];
export type StreamableDataFormat = (typeof StreamableFormats)[number];
export declare function isNotStreamableJSONFamily(format: DataFormat): format is SingleDocumentJSONFormat;

@@ -41,2 +42,1 @@ export declare function isStreamableJSONFamily(format: DataFormat): format is StreamableJSONDataFormat;

export declare function encodeJSON(value: any, format: DataFormat): string;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.encodeJSON = exports.validateStreamFormat = exports.isSupportedRawFormat = exports.isStreamableJSONFamily = exports.isNotStreamableJSONFamily = void 0;
const streamableJSONFormats = [
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.StreamableJSONFormats = [
'JSONEachRow',

@@ -14,4 +14,4 @@ 'JSONStringsEachRow',

];
const recordsJSONFormats = ['JSONObjectEachRow'];
const singleDocumentJSONFormats = [
exports.RecordsJSONFormats = ['JSONObjectEachRow'];
exports.SingleDocumentJSONFormats = [
'JSON',

@@ -23,8 +23,8 @@ 'JSONStrings',

];
const supportedJSONFormats = [
...recordsJSONFormats,
...singleDocumentJSONFormats,
...streamableJSONFormats,
exports.SupportedJSONFormats = [
...exports.RecordsJSONFormats,
...exports.SingleDocumentJSONFormats,
...exports.StreamableJSONFormats,
];
const supportedRawFormats = [
exports.SupportedRawFormats = [
'CSV',

@@ -42,22 +42,22 @@ 'CSVWithNames',

];
const streamableFormat = [
...streamableJSONFormats,
...supportedRawFormats,
exports.StreamableFormats = [
...exports.StreamableJSONFormats,
...exports.SupportedRawFormats,
];
function isNotStreamableJSONFamily(format) {
return (singleDocumentJSONFormats.includes(format) ||
recordsJSONFormats.includes(format));
return (exports.SingleDocumentJSONFormats.includes(format) ||
exports.RecordsJSONFormats.includes(format));
}
exports.isNotStreamableJSONFamily = isNotStreamableJSONFamily;
function isStreamableJSONFamily(format) {
return streamableJSONFormats.includes(format);
return exports.StreamableJSONFormats.includes(format);
}
exports.isStreamableJSONFamily = isStreamableJSONFamily;
function isSupportedRawFormat(dataFormat) {
return supportedRawFormats.includes(dataFormat);
return exports.SupportedRawFormats.includes(dataFormat);
}
exports.isSupportedRawFormat = isSupportedRawFormat;
function validateStreamFormat(format) {
if (!streamableFormat.includes(format)) {
throw new Error(`${format} format is not streamable. Streamable formats: ${streamableFormat.join(',')}`);
if (!exports.StreamableFormats.includes(format)) {
throw new Error(`${format} format is not streamable. Streamable formats: ${exports.StreamableFormats.join(',')}`);
}

@@ -74,3 +74,3 @@ return true;

function encodeJSON(value, format) {
if (supportedJSONFormats.includes(format)) {
if (exports.SupportedJSONFormats.includes(format)) {
return JSON.stringify(value) + '\n';

@@ -77,0 +77,0 @@ }

@@ -5,6 +5,6 @@ /** Should be re-exported by the implementation */

export type { Row, BaseResultSet, ResultJSONType, RowJSONType, ResultStream, } from './result';
export type { DataFormat, RawDataFormat, JSONDataFormat, StreamableDataFormat, StreamableJSONDataFormat, SingleDocumentJSONFormat, } from './data_formatter';
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, WithClickHouseSummary, ResponseJSON, InputJSON, InputJSONObjectEachRow, } from './clickhouse_types';
export type { ClickHouseSummary, InputJSON, InputJSONObjectEachRow, ResponseJSON, ResponseHeaders, WithClickHouseSummary, WithResponseHeaders, } from './clickhouse_types';
export { type ClickHouseSettings, type MergeTreeSettings, SettingsMap, } from './settings';

@@ -11,0 +11,0 @@ /** For implementations usage only - should not be re-exported */

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

import type { ResponseJSON } from './clickhouse_types';
import type { ResponseHeaders, ResponseJSON } from './clickhouse_types';
import type { DataFormat, RawDataFormat, RecordsJSONFormat, SingleDocumentJSONFormat, StreamableDataFormat, StreamableJSONDataFormat } from './data_formatter';

@@ -85,2 +85,4 @@ export type ResultStream<Format extends DataFormat | unknown, Stream> = Format extends StreamableDataFormat ? Stream : Format extends SingleDocumentJSONFormat ? never : Format extends RecordsJSONFormat ? never : Stream;

query_id: string;
/** Response headers. */
response_headers: ResponseHeaders;
}

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

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

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

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

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