@node-c/persistance-clickhouse 1.0.0-alpha33 → 1.0.0-alpha34
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.
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.ClickHouseConnectionModule = void 0;
|
|
4
13
|
const client_1 = require("@clickhouse/client");
|
|
@@ -15,9 +24,9 @@ class ClickHouseConnectionModule {
|
|
|
15
24
|
providers: [
|
|
16
25
|
{
|
|
17
26
|
provide: clientName,
|
|
18
|
-
useFactory: (configProvider) => {
|
|
27
|
+
useFactory: (configProvider) => __awaiter(this, void 0, void 0, function* () {
|
|
19
28
|
const persistanceConfig = configProvider.config.persistance;
|
|
20
|
-
const { database, host, password, port, protocol, user } = persistanceConfig[persistanceModuleName];
|
|
29
|
+
const { database, failOnConnectionError = true, host, password, port, protocol, user } = persistanceConfig[persistanceModuleName];
|
|
21
30
|
let client;
|
|
22
31
|
try {
|
|
23
32
|
client = (0, client_1.createClient)({
|
|
@@ -26,13 +35,19 @@ class ClickHouseConnectionModule {
|
|
|
26
35
|
url: `${protocol || 'http'}://${host}:${port}`,
|
|
27
36
|
username: user
|
|
28
37
|
});
|
|
38
|
+
const pingResult = yield client.ping({ select: true });
|
|
39
|
+
if (!pingResult.success) {
|
|
40
|
+
throw new Error(JSON.stringify(pingResult));
|
|
41
|
+
}
|
|
29
42
|
}
|
|
30
43
|
catch (err) {
|
|
31
44
|
console.error(`[ClickHouseConnectionModule][${persistanceModuleName}]: Error connecting to ClickHouse:`, err);
|
|
32
|
-
|
|
45
|
+
if (failOnConnectionError) {
|
|
46
|
+
throw err;
|
|
47
|
+
}
|
|
33
48
|
}
|
|
34
49
|
return client;
|
|
35
|
-
},
|
|
50
|
+
}),
|
|
36
51
|
inject: [core_1.ConfigProviderService]
|
|
37
52
|
}
|
|
38
53
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clickhouse.connection.module.js","sourceRoot":"","sources":["../../src/connectionModule/clickhouse.connection.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clickhouse.connection.module.js","sourceRoot":"","sources":["../../src/connectionModule/clickhouse.connection.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAoE;AAGpE,uCAA8E;AAI9E,uDAAkD;AAElD,MAAa,0BAA0B;IACrC,MAAM,CAAC,QAAQ,CAAC,OAA0C;QACxD,MAAM,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAC;QAC1C,MAAM,UAAU,GAAG,GAAG,uBAAS,CAAC,wBAAwB,GAAG,qBAAqB,EAAE,CAAC;QACnF,OAAO;YACL,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,0BAA0B;YAClC,OAAO,EAAE,EAAE;YACX,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,UAAU;oBACnB,UAAU,EAAE,CAAO,cAAqC,EAAE,EAAE;wBAC1D,MAAM,iBAAiB,GAAG,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC;wBAC5D,MAAM,EACJ,QAAQ,EACR,qBAAqB,GAAG,IAAI,EAC5B,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,IAAI,EACL,GAAG,iBAAiB,CAAC,qBAAuD,CAA4B,CAAC;wBAC1G,IAAI,MAAwB,CAAC;wBAC7B,IAAI,CAAC;4BACH,MAAM,GAAG,IAAA,qBAAY,EAAC;gCACpB,QAAQ;gCACR,QAAQ;gCACR,GAAG,EAAE,GAAG,QAAQ,IAAI,MAAM,MAAM,IAAI,IAAI,IAAI,EAAE;gCAC9C,QAAQ,EAAE,IAAI;6BACf,CAAC,CAAC;4BACH,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;4BACvD,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;gCACxB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;4BAC9C,CAAC;wBACH,CAAC;wBAAC,OAAO,GAAG,EAAE,CAAC;4BACb,OAAO,CAAC,KAAK,CACX,gCAAgC,qBAAqB,oCAAoC,EACzF,GAAG,CACJ,CAAC;4BACF,IAAI,qBAAqB,EAAE,CAAC;gCAC1B,MAAM,GAAG,CAAC;4BACZ,CAAC;wBACH,CAAC;wBACD,OAAO,MAAO,CAAC;oBACjB,CAAC,CAAA;oBACD,MAAM,EAAE,CAAC,4BAAqB,CAAC;iBAChC;aACF;YACD,OAAO,EAAE,CAAC,UAAU,CAAC;SACtB,CAAC;IACJ,CAAC;CACF;AAnDD,gEAmDC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-c/persistance-clickhouse",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-alpha34",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"@clickhouse/client": "^1.12.1",
|
|
17
17
|
"@nestjs/common": "^10.4.12",
|
|
18
18
|
"@nestjs/typeorm": "^10.0.2",
|
|
19
|
-
"@node-c/core": "^1.0.0-
|
|
20
|
-
"@node-c/persistance-rdb": "^1.0.0-
|
|
19
|
+
"@node-c/core": "^1.0.0-alpha34",
|
|
20
|
+
"@node-c/persistance-rdb": "^1.0.0-alpha34",
|
|
21
21
|
"class-validator": "^0.14.1",
|
|
22
22
|
"typeorm": "^0.3.20",
|
|
23
23
|
"uuid": "^11.0.5"
|