@clickhouse/client 1.16.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/connection/compression.d.ts +2 -1
- package/dist/connection/compression.js +8 -5
- package/dist/connection/compression.js.map +1 -1
- package/dist/connection/node_base_connection.d.ts +11 -3
- package/dist/connection/node_base_connection.js +410 -157
- package/dist/connection/node_base_connection.js.map +1 -1
- package/dist/connection/node_custom_agent_connection.js +1 -6
- package/dist/connection/node_custom_agent_connection.js.map +1 -1
- package/dist/connection/stream.d.ts +9 -1
- package/dist/connection/stream.js +71 -3
- package/dist/connection/stream.js.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/result_set.js +34 -59
- package/dist/result_set.js.map +1 -1
- package/dist/utils/encoder.js +1 -6
- package/dist/utils/encoder.js.map +1 -1
- package/dist/utils/runtime.js +3 -18
- package/dist/utils/runtime.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LogWriter } from '@clickhouse/client-common';
|
|
2
|
+
import { ClickHouseLogLevel } from '@clickhouse/client-common';
|
|
2
3
|
import type Http from 'http';
|
|
3
4
|
import Stream from 'stream';
|
|
4
5
|
type DecompressResponseResult = {
|
|
@@ -6,7 +7,7 @@ type DecompressResponseResult = {
|
|
|
6
7
|
} | {
|
|
7
8
|
error: Error;
|
|
8
9
|
};
|
|
9
|
-
export declare function decompressResponse(response: Http.IncomingMessage,
|
|
10
|
+
export declare function decompressResponse(response: Http.IncomingMessage, log_writer: LogWriter, log_level: ClickHouseLogLevel): DecompressResponseResult;
|
|
10
11
|
export declare function isDecompressionError(result: any): result is {
|
|
11
12
|
error: Error;
|
|
12
13
|
};
|
|
@@ -5,18 +5,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.decompressResponse = decompressResponse;
|
|
7
7
|
exports.isDecompressionError = isDecompressionError;
|
|
8
|
+
const client_common_1 = require("@clickhouse/client-common");
|
|
8
9
|
const stream_1 = __importDefault(require("stream"));
|
|
9
10
|
const zlib_1 = __importDefault(require("zlib"));
|
|
10
|
-
function decompressResponse(response,
|
|
11
|
+
function decompressResponse(response, log_writer, log_level) {
|
|
11
12
|
const encoding = response.headers['content-encoding'];
|
|
12
13
|
if (encoding === 'gzip') {
|
|
13
14
|
return {
|
|
14
15
|
response: stream_1.default.pipeline(response, zlib_1.default.createGunzip(), function pipelineCb(err) {
|
|
15
16
|
if (err) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
if (log_level <= client_common_1.ClickHouseLogLevel.ERROR) {
|
|
18
|
+
log_writer.error({
|
|
19
|
+
message: 'An error occurred while decompressing the response',
|
|
20
|
+
err,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
20
23
|
}
|
|
21
24
|
}),
|
|
22
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compression.js","sourceRoot":"","sources":["../../src/connection/compression.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"compression.js","sourceRoot":"","sources":["../../src/connection/compression.ts"],"names":[],"mappings":";;;;;AAQA,gDA+BC;AAED,oDAEC;AA1CD,6DAA8D;AAE9D,oDAA2B;AAC3B,gDAAuB;AAIvB,SAAgB,kBAAkB,CAChC,QAA8B,EAC9B,UAAqB,EACrB,SAA6B;IAE7B,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAErD,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACxB,OAAO;YACL,QAAQ,EAAE,gBAAM,CAAC,QAAQ,CACvB,QAAQ,EACR,cAAI,CAAC,YAAY,EAAE,EACnB,SAAS,UAAU,CAAC,GAAG;gBACrB,IAAI,GAAG,EAAE,CAAC;oBACR,IAAI,SAAS,IAAI,kCAAkB,CAAC,KAAK,EAAE,CAAC;wBAC1C,UAAU,CAAC,KAAK,CAAC;4BACf,OAAO,EAAE,oDAAoD;4BAC7D,GAAG;yBACJ,CAAC,CAAA;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC,CACF;SACF,CAAA;IACH,CAAC;SAAM,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAClC,OAAO;YACL,KAAK,EAAE,IAAI,KAAK,CAAC,wBAAwB,QAAQ,EAAE,CAAC;SACrD,CAAA;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,CAAA;AACrB,CAAC;AAED,SAAgB,oBAAoB,CAAC,MAAW;IAC9C,OAAO,MAAM,CAAC,KAAK,KAAK,SAAS,CAAA;AACnC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ConnBaseQueryParams, ConnCommandResult, Connection, ConnectionParams, ConnExecParams, ConnExecResult, ConnInsertParams, ConnInsertResult, ConnPingResult, ConnQueryResult } from '@clickhouse/client-common';
|
|
1
|
+
import type { ConnBaseQueryParams, ConnCommandResult, Connection, ConnectionParams, ConnExecParams, ConnExecResult, ConnInsertParams, ConnInsertResult, ConnPingResult, ConnQueryResult, LogWriter } from '@clickhouse/client-common';
|
|
2
|
+
import { ClickHouseLogLevel } from '@clickhouse/client-common';
|
|
2
3
|
import { type ConnPingParams } from '@clickhouse/client-common';
|
|
3
4
|
import type Http from 'http';
|
|
4
5
|
import type Https from 'node:https';
|
|
@@ -12,6 +13,7 @@ export type NodeConnectionParams = ConnectionParams & {
|
|
|
12
13
|
enabled: boolean;
|
|
13
14
|
idle_socket_ttl: number;
|
|
14
15
|
};
|
|
16
|
+
log_level: ClickHouseLogLevel;
|
|
15
17
|
};
|
|
16
18
|
export type TLSParams = {
|
|
17
19
|
ca_cert: Buffer;
|
|
@@ -34,6 +36,9 @@ export interface RequestParams {
|
|
|
34
36
|
ignore_error_response?: boolean;
|
|
35
37
|
parse_summary?: boolean;
|
|
36
38
|
query: string;
|
|
39
|
+
query_id: string;
|
|
40
|
+
log_writer: LogWriter;
|
|
41
|
+
log_level: ClickHouseLogLevel;
|
|
37
42
|
}
|
|
38
43
|
export declare abstract class NodeBaseConnection implements Connection<Stream.Readable> {
|
|
39
44
|
protected readonly params: NodeConnectionParams;
|
|
@@ -41,9 +46,13 @@ export declare abstract class NodeBaseConnection implements Connection<Stream.Re
|
|
|
41
46
|
protected readonly defaultAuthHeader: string;
|
|
42
47
|
protected readonly defaultHeaders: Http.OutgoingHttpHeaders;
|
|
43
48
|
private readonly jsonHandling;
|
|
44
|
-
private readonly logger;
|
|
45
49
|
private readonly knownSockets;
|
|
46
50
|
private readonly idleSocketTTL;
|
|
51
|
+
private readonly connectionId;
|
|
52
|
+
private socketCounter;
|
|
53
|
+
private requestCounter;
|
|
54
|
+
private getNewSocketId;
|
|
55
|
+
private getNewRequestId;
|
|
47
56
|
protected constructor(params: NodeConnectionParams, agent: Http.Agent);
|
|
48
57
|
ping(params: ConnPingParams): Promise<ConnPingResult>;
|
|
49
58
|
query(params: ConnBaseQueryParams): Promise<ConnQueryResult<Stream.Readable>>;
|
|
@@ -56,7 +65,6 @@ export declare abstract class NodeBaseConnection implements Connection<Stream.Re
|
|
|
56
65
|
protected abstract createClientRequest(params: RequestParams): Http.ClientRequest;
|
|
57
66
|
private getQueryId;
|
|
58
67
|
private getAbortController;
|
|
59
|
-
private logResponse;
|
|
60
68
|
private logRequestError;
|
|
61
69
|
private httpRequestErrorMessage;
|
|
62
70
|
private parseSummary;
|