@clickhouse/client-web
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -9,5 +9,5 @@ "use strict"; | ||
make_connection: (_, params) => new connection_1.WebConnection(params), | ||
make_result_set: ((stream, format, query_id) => new result_set_1.ResultSet(stream, format, query_id)), | ||
make_result_set: ((stream, format, query_id, _log_error, response_headers) => new result_set_1.ResultSet(stream, format, query_id, response_headers)), | ||
values_encoder: new utils_1.WebValuesEncoder(), | ||
}; | ||
//# sourceMappingURL=config.js.map |
@@ -43,2 +43,3 @@ "use strict"; | ||
stream: response.body || new ReadableStream(), | ||
response_headers: getResponseHeaders(response), | ||
}; | ||
@@ -51,10 +52,11 @@ } | ||
stream: result.stream || new ReadableStream(), | ||
response_headers: result.response_headers, | ||
}; | ||
} | ||
async command(params) { | ||
const { stream, query_id } = await this.runExec(params); | ||
const { stream, query_id, response_headers } = await this.runExec(params); | ||
if (stream !== null) { | ||
await stream.cancel(); | ||
} | ||
return { query_id }; | ||
return { query_id, response_headers }; | ||
} | ||
@@ -71,3 +73,3 @@ async insert(params) { | ||
}); | ||
const res = await this.request({ | ||
const response = await this.request({ | ||
values: params.values, | ||
@@ -77,7 +79,8 @@ params, | ||
}); | ||
if (res.body !== null) { | ||
await res.text(); // drain the response (it's empty anyway) | ||
if (response.body !== null) { | ||
await response.text(); // drain the response (it's empty anyway) | ||
} | ||
return { | ||
query_id, | ||
response_headers: getResponseHeaders(response), | ||
}; | ||
@@ -187,2 +190,3 @@ } | ||
stream: response.body, | ||
response_headers: getResponseHeaders(response), | ||
query_id, | ||
@@ -196,2 +200,9 @@ }; | ||
} | ||
function getResponseHeaders(response) { | ||
const headers = {}; | ||
response.headers.forEach((value, key) => { | ||
headers[key] = value; | ||
}); | ||
return headers; | ||
} | ||
//# sourceMappingURL=web_connection.js.map |
@@ -6,2 +6,2 @@ export type { WebClickHouseClient as ClickHouseClient, QueryResult, } from './client'; | ||
/** Re-export @clickhouse/client-common types */ | ||
export { type BaseClickHouseClientConfigOptions, type BaseQueryParams, type QueryParams, type ExecParams, type InsertParams, type InsertValues, type CommandParams, type CommandResult, type ExecResult, type InsertResult, type DataFormat, type RawDataFormat, type JSONDataFormat, type StreamableDataFormat, type StreamableJSONDataFormat, type SingleDocumentJSONFormat, type Logger, type LogParams, type ErrorLogParams, type WarnLogParams, type ClickHouseSettings, type MergeTreeSettings, type Row, type ResponseJSON, type InputJSON, type InputJSONObjectEachRow, type BaseResultSet, type PingResult, ClickHouseError, ClickHouseLogLevel, SettingsMap, } from '@clickhouse/client-common'; | ||
export { type BaseClickHouseClientConfigOptions, type BaseQueryParams, type QueryParams, type ExecParams, type InsertParams, type InsertValues, type CommandParams, type CommandResult, type ExecResult, type InsertResult, type DataFormat, type RawDataFormat, type JSONDataFormat, type StreamableDataFormat, type StreamableJSONDataFormat, type SingleDocumentJSONFormat, type Logger, type LogParams, type ErrorLogParams, type WarnLogParams, type ClickHouseSettings, type MergeTreeSettings, type Row, type ResponseJSON, type InputJSON, type InputJSONObjectEachRow, type BaseResultSet, type PingResult, ClickHouseError, ClickHouseLogLevel, SettingsMap, SupportedJSONFormats, SupportedRawFormats, StreamableFormats, StreamableJSONFormats, SingleDocumentJSONFormats, RecordsJSONFormats, } from '@clickhouse/client-common'; |
@@ -1,2 +0,2 @@ | ||
import type { BaseResultSet, DataFormat, ResultJSONType, ResultStream, Row } from '@clickhouse/client-common'; | ||
import type { BaseResultSet, DataFormat, ResponseHeaders, ResultJSONType, ResultStream, Row } from '@clickhouse/client-common'; | ||
export declare class ResultSet<Format extends DataFormat | unknown> implements BaseResultSet<ReadableStream<Row[]>, Format> { | ||
@@ -6,4 +6,5 @@ private _stream; | ||
readonly query_id: string; | ||
readonly response_headers: ResponseHeaders; | ||
private isAlreadyConsumed; | ||
constructor(_stream: ReadableStream, format: Format, query_id: string); | ||
constructor(_stream: ReadableStream, format: Format, query_id: string, _response_headers?: ResponseHeaders); | ||
/** See {@link BaseResultSet.text} */ | ||
@@ -10,0 +11,0 @@ text(): Promise<string>; |
@@ -8,3 +8,3 @@ "use strict"; | ||
class ResultSet { | ||
constructor(_stream, format, query_id) { | ||
constructor(_stream, format, query_id, _response_headers) { | ||
Object.defineProperty(this, "_stream", { | ||
@@ -28,2 +28,8 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(this, "response_headers", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "isAlreadyConsumed", { | ||
@@ -35,2 +41,4 @@ enumerable: true, | ||
}); | ||
this.response_headers = | ||
_response_headers !== undefined ? Object.freeze(_response_headers) : {}; | ||
} | ||
@@ -37,0 +45,0 @@ /** See {@link BaseResultSet.text} */ |
@@ -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", | ||
@@ -24,4 +24,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@clickhouse/client-common": "1.2.0" | ||
"@clickhouse/client-common": "1.3.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
49481
549
+ Added@clickhouse/client-common@1.3.0(transitive)
- Removed@clickhouse/client-common@1.2.0(transitive)