@clickhouse/client-web
Advanced tools
Comparing version 1.6.0 to 1.7.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createClient = void 0; | ||
exports.createClient = createClient; | ||
const client_common_1 = require("@clickhouse/client-common"); | ||
@@ -18,3 +18,2 @@ const config_1 = require("./config"); | ||
} | ||
exports.createClient = createClient; | ||
//# sourceMappingURL=client.js.map |
@@ -6,2 +6,2 @@ export { WebClickHouseClient as ClickHouseClient, type 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, SupportedJSONFormats, SupportedRawFormats, StreamableFormats, StreamableJSONFormats, SingleDocumentJSONFormats, RecordsJSONFormats, } 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, type SimpleColumnType, type ParsedColumnSimple, type ParsedColumnEnum, type ParsedColumnFixedString, type ParsedColumnNullable, type ParsedColumnDecimal, type ParsedColumnDateTime, type ParsedColumnDateTime64, type ParsedColumnArray, type ParsedColumnTuple, type ParsedColumnMap, type ParsedColumnType, parseColumnType, SimpleColumnTypes, type ProgressRow, isProgressRow, type RowOrProgress, } from '@clickhouse/client-common'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SettingsMap = exports.ClickHouseLogLevel = exports.ClickHouseError = exports.ResultSet = exports.createClient = void 0; | ||
exports.isProgressRow = exports.SimpleColumnTypes = exports.parseColumnType = exports.SettingsMap = exports.ClickHouseLogLevel = exports.ClickHouseError = exports.ResultSet = exports.createClient = void 0; | ||
var client_1 = require("./client"); | ||
@@ -13,2 +13,5 @@ Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return client_1.createClient; } }); | ||
Object.defineProperty(exports, "SettingsMap", { enumerable: true, get: function () { return client_common_1.SettingsMap; } }); | ||
Object.defineProperty(exports, "parseColumnType", { enumerable: true, get: function () { return client_common_1.parseColumnType; } }); | ||
Object.defineProperty(exports, "SimpleColumnTypes", { enumerable: true, get: function () { return client_common_1.SimpleColumnTypes; } }); | ||
Object.defineProperty(exports, "isProgressRow", { enumerable: true, get: function () { return client_common_1.isProgressRow; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -5,4 +5,4 @@ "use strict"; | ||
const client_common_1 = require("@clickhouse/client-common"); | ||
const client_common_2 = require("@clickhouse/client-common"); | ||
const utils_1 = require("./utils"); | ||
const NEWLINE = 0x0a; | ||
class ResultSet { | ||
@@ -77,4 +77,5 @@ constructor(_stream, format, query_id, _response_headers) { | ||
this.markAsConsumed(); | ||
(0, client_common_2.validateStreamFormat)(this.format); | ||
let decodedChunk = ''; | ||
(0, client_common_1.validateStreamFormat)(this.format); | ||
let incompleteChunks = []; | ||
let totalIncompleteLength = 0; | ||
const decoder = new TextDecoder('utf-8'); | ||
@@ -89,10 +90,40 @@ const transform = new TransformStream({ | ||
} | ||
decodedChunk += decoder.decode(chunk); | ||
const rows = []; | ||
// eslint-disable-next-line no-constant-condition | ||
while (true) { | ||
const idx = decodedChunk.indexOf('\n'); | ||
if (idx !== -1) { | ||
const text = decodedChunk.slice(0, idx); | ||
decodedChunk = decodedChunk.slice(idx + 1); | ||
let idx; | ||
let lastIdx = 0; | ||
do { | ||
// an unescaped newline character denotes the end of a row | ||
idx = chunk.indexOf(NEWLINE, lastIdx); | ||
// there is no complete row in the rest of the current chunk | ||
if (idx === -1) { | ||
// to be processed during the next transform iteration | ||
const incompleteChunk = chunk.slice(lastIdx); | ||
incompleteChunks.push(incompleteChunk); | ||
totalIncompleteLength += incompleteChunk.length; | ||
// send the extracted rows to the consumer, if any | ||
if (rows.length > 0) { | ||
controller.enqueue(rows); | ||
} | ||
} | ||
else { | ||
let text; | ||
if (incompleteChunks.length > 0) { | ||
const completeRowBytes = new Uint8Array(totalIncompleteLength + idx); | ||
// using the incomplete chunks from the previous iterations | ||
let offset = 0; | ||
incompleteChunks.forEach((incompleteChunk) => { | ||
completeRowBytes.set(incompleteChunk, offset); | ||
offset += incompleteChunk.length; | ||
}); | ||
// finalize the row with the current chunk slice that ends with a newline | ||
const finalChunk = chunk.slice(0, idx); | ||
completeRowBytes.set(finalChunk, offset); | ||
// reset the incomplete chunks | ||
incompleteChunks = []; | ||
totalIncompleteLength = 0; | ||
text = decoder.decode(completeRowBytes); | ||
} | ||
else { | ||
text = decoder.decode(chunk.slice(lastIdx, idx)); | ||
} | ||
rows.push({ | ||
@@ -104,14 +135,6 @@ text, | ||
}); | ||
lastIdx = idx + 1; // skipping newline character | ||
} | ||
else { | ||
if (rows.length) { | ||
controller.enqueue(rows); | ||
} | ||
break; | ||
} | ||
} | ||
} while (idx !== -1); | ||
}, | ||
flush() { | ||
decodedChunk = ''; | ||
}, | ||
}); | ||
@@ -118,0 +141,0 @@ const pipeline = this._stream.pipeThrough(transform, { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getAsText = exports.isStream = void 0; | ||
exports.isStream = isStream; | ||
exports.getAsText = getAsText; | ||
function isStream(obj) { | ||
return (obj !== null && obj !== undefined && typeof obj.pipeThrough === 'function'); | ||
} | ||
exports.isStream = isStream; | ||
async function getAsText(stream) { | ||
@@ -22,3 +22,2 @@ let result = ''; | ||
} | ||
exports.getAsText = getAsText; | ||
//# sourceMappingURL=stream.js.map |
@@ -1,2 +0,2 @@ | ||
declare const _default: "1.6.0"; | ||
declare const _default: "1.7.0"; | ||
export default _default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = '1.6.0'; | ||
exports.default = '1.7.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://clickhouse.com", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"license": "Apache-2.0", | ||
@@ -24,4 +24,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@clickhouse/client-common": "1.6.0" | ||
"@clickhouse/client-common": "1.7.0" | ||
} | ||
} |
@@ -22,2 +22,4 @@ <p align="center"> | ||
<img src="https://sonarcloud.io/api/project_badges/measure?project=ClickHouse_clickhouse-js&metric=coverage"> | ||
<img src="https://api.scorecard.dev/projects/github.com/ClickHouse/clickhouse-js/badge"> | ||
</p> | ||
@@ -24,0 +26,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
53061
579
54
+ Added@clickhouse/client-common@1.7.0(transitive)
- Removed@clickhouse/client-common@1.6.0(transitive)