@clickhouse/client 1.8.0 → 1.8.1

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.
@@ -2,6 +2,7 @@ import Http from 'http';
2
2
  import type { NodeConnectionParams, RequestParams } from './node_base_connection';
3
3
  import { NodeBaseConnection } from './node_base_connection';
4
4
  export declare class NodeCustomAgentConnection extends NodeBaseConnection {
5
+ private readonly httpRequestFn;
5
6
  constructor(params: NodeConnectionParams);
6
7
  protected createClientRequest(params: RequestParams): Http.ClientRequest;
7
8
  }
@@ -4,15 +4,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.NodeCustomAgentConnection = void 0;
7
- const client_common_1 = require("@clickhouse/client-common");
8
7
  const http_1 = __importDefault(require("http"));
8
+ const https_1 = __importDefault(require("https"));
9
9
  const node_base_connection_1 = require("./node_base_connection");
10
+ const client_common_1 = require("@clickhouse/client-common");
10
11
  class NodeCustomAgentConnection extends node_base_connection_1.NodeBaseConnection {
11
12
  constructor(params) {
12
13
  if (!params.http_agent) {
13
14
  throw new Error('http_agent is required to create NodeCustomAgentConnection');
14
15
  }
15
16
  super(params, params.http_agent);
17
+ Object.defineProperty(this, "httpRequestFn", {
18
+ enumerable: true,
19
+ configurable: true,
20
+ writable: true,
21
+ value: void 0
22
+ });
23
+ // See https://github.com/ClickHouse/clickhouse-js/issues/352
24
+ if (params.url.protocol.startsWith('https')) {
25
+ this.httpRequestFn = https_1.default.request;
26
+ }
27
+ else {
28
+ this.httpRequestFn = http_1.default.request;
29
+ }
16
30
  }
17
31
  createClientRequest(params) {
18
32
  const headers = (0, client_common_1.withCompressionHeaders)({
@@ -20,7 +34,7 @@ class NodeCustomAgentConnection extends node_base_connection_1.NodeBaseConnectio
20
34
  enable_request_compression: params.enable_request_compression,
21
35
  enable_response_compression: params.enable_response_compression,
22
36
  });
23
- return http_1.default.request(params.url, {
37
+ return this.httpRequestFn(params.url, {
24
38
  method: params.method,
25
39
  agent: this.agent,
26
40
  timeout: this.params.request_timeout,
@@ -1 +1 @@
1
- {"version":3,"file":"node_custom_agent_connection.js","sourceRoot":"","sources":["../../../../packages/client-node/src/connection/node_custom_agent_connection.ts"],"names":[],"mappings":";;;;;;AAAA,6DAAkE;AAClE,gDAAuB;AAKvB,iEAA2D;AAE3D,MAAa,yBAA0B,SAAQ,yCAAkB;IAC/D,YAAY,MAA4B;QACtC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CACb,4DAA4D,CAC7D,CAAA;QACH,CAAC;QACD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;IAClC,CAAC;IAES,mBAAmB,CAAC,MAAqB;QACjD,MAAM,OAAO,GAAG,IAAA,sCAAsB,EAAC;YACrC,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,0BAA0B,EAAE,MAAM,CAAC,0BAA0B;YAC7D,2BAA2B,EAAE,MAAM,CAAC,2BAA2B;SAChE,CAAC,CAAA;QACF,OAAO,cAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE;YAC9B,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe;YACpC,MAAM,EAAE,MAAM,CAAC,YAAY;YAC3B,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;CACF;AAxBD,8DAwBC"}
1
+ {"version":3,"file":"node_custom_agent_connection.js","sourceRoot":"","sources":["../../../../packages/client-node/src/connection/node_custom_agent_connection.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,kDAAyB;AAKzB,iEAA2D;AAC3D,6DAAkE;AAElE,MAAa,yBAA0B,SAAQ,yCAAkB;IAE/D,YAAY,MAA4B;QACtC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CACb,4DAA4D,CAC7D,CAAA;QACH,CAAC;QACD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;QAPjB;;;;;WAAyD;QASxE,6DAA6D;QAC7D,IAAI,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC,aAAa,GAAG,eAAK,CAAC,OAAO,CAAA;QACpC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,aAAa,GAAG,cAAI,CAAC,OAAO,CAAA;QACnC,CAAC;IACH,CAAC;IAES,mBAAmB,CAAC,MAAqB;QACjD,MAAM,OAAO,GAAG,IAAA,sCAAsB,EAAC;YACrC,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,0BAA0B,EAAE,MAAM,CAAC,0BAA0B;YAC7D,2BAA2B,EAAE,MAAM,CAAC,2BAA2B;SAChE,CAAC,CAAA;QACF,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,EAAE;YACpC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe;YACpC,MAAM,EAAE,MAAM,CAAC,YAAY;YAC3B,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;CACF;AAhCD,8DAgCC"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.8.0";
1
+ declare const _default: "1.8.1";
2
2
  export default _default;
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '1.8.0';
3
+ exports.default = '1.8.1';
4
4
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@clickhouse/client",
3
3
  "description": "Official JS client for ClickHouse DB - Node.js implementation",
4
4
  "homepage": "https://clickhouse.com",
5
- "version": "1.8.0",
5
+ "version": "1.8.1",
6
6
  "license": "Apache-2.0",
7
7
  "keywords": [
8
8
  "clickhouse",
@@ -23,6 +23,6 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "@clickhouse/client-common": "1.8.0"
26
+ "@clickhouse/client-common": "1.8.1"
27
27
  }
28
28
  }