@clickhouse/client-web
Advanced tools
Comparing version 0.2.7 to 0.2.8
import type { BaseClickHouseClientConfigOptions, BaseResultSet, InputJSON, InputJSONObjectEachRow, InsertParams, InsertResult, QueryParams, Row } from '@clickhouse/client-common'; | ||
import { ClickHouseClient } from '@clickhouse/client-common'; | ||
export type WebClickHouseClientConfigOptions = BaseClickHouseClientConfigOptions<ReadableStream> & { | ||
keep_alive?: { | ||
/** Enable or disable HTTP Keep-Alive mechanism. Default: true */ | ||
enabled: boolean; | ||
}; | ||
}; | ||
export type WebClickHouseClient = Omit<ClickHouseClient<ReadableStream>, 'insert' | 'query'> & { | ||
@@ -9,2 +15,2 @@ insert<T>(params: Omit<InsertParams<ReadableStream, T>, 'values'> & { | ||
}; | ||
export declare function createClient(config?: BaseClickHouseClientConfigOptions<ReadableStream>): WebClickHouseClient; | ||
export declare function createClient(config?: WebClickHouseClientConfigOptions): WebClickHouseClient; |
@@ -9,5 +9,8 @@ "use strict"; | ||
function createClient(config) { | ||
const keep_alive = { | ||
enabled: config?.keep_alive?.enabled ?? true, | ||
}; | ||
return new client_common_1.ClickHouseClient({ | ||
impl: { | ||
make_connection: (params) => new connection_1.WebConnection(params), | ||
make_connection: (params) => new connection_1.WebConnection({ ...params, keep_alive }), | ||
make_result_set: (stream, format, query_id) => new result_set_1.ResultSet(stream, format, query_id), | ||
@@ -14,0 +17,0 @@ values_encoder: new utils_1.WebValuesEncoder(), |
@@ -5,6 +5,11 @@ import type { ConnBaseQueryParams, Connection, ConnectionParams, ConnInsertParams, ConnInsertResult, ConnPingResult, ConnQueryResult } from '@clickhouse/client-common'; | ||
}; | ||
export type WebConnectionParams = ConnectionParams & { | ||
keep_alive: { | ||
enabled: boolean; | ||
}; | ||
}; | ||
export declare class WebConnection implements Connection<ReadableStream> { | ||
private readonly params; | ||
private readonly defaultHeaders; | ||
constructor(params: ConnectionParams); | ||
constructor(params: WebConnectionParams); | ||
query(params: ConnBaseQueryParams): Promise<ConnQueryResult<ReadableStream<Uint8Array>>>; | ||
@@ -11,0 +16,0 @@ exec(params: ConnBaseQueryParams): Promise<ConnQueryResult<ReadableStream<Uint8Array>>>; |
@@ -138,3 +138,3 @@ "use strict"; | ||
headers, | ||
keepalive: false, | ||
keepalive: this.params.keep_alive.enabled, | ||
method: method ?? 'POST', | ||
@@ -141,0 +141,0 @@ signal: abortController.signal, |
@@ -1,2 +0,2 @@ | ||
declare const _default: "0.2.7"; | ||
declare const _default: "0.2.8"; | ||
export default _default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = '0.2.7'; | ||
exports.default = '0.2.8'; | ||
//# sourceMappingURL=version.js.map |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://clickhouse.com", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"license": "Apache-2.0", | ||
@@ -24,4 +24,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@clickhouse/client-common": "0.2.7" | ||
"@clickhouse/client-common": "0.2.8" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
41964
463
+ Added@clickhouse/client-common@0.2.8(transitive)
- Removed@clickhouse/client-common@0.2.7(transitive)