@clickhouse/client 0.0.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.
- package/LICENSE +203 -0
- package/README.md +636 -0
- package/dist/clickhouse_types.d.ts +17 -0
- package/dist/clickhouse_types.js +3 -0
- package/dist/clickhouse_types.js.map +1 -0
- package/dist/client.d.ts +56 -0
- package/dist/client.js +180 -0
- package/dist/client.js.map +1 -0
- package/dist/connection/adapter/base_http_adapter.d.ts +33 -0
- package/dist/connection/adapter/base_http_adapter.js +257 -0
- package/dist/connection/adapter/base_http_adapter.js.map +1 -0
- package/dist/connection/adapter/http_adapter.d.ts +10 -0
- package/dist/connection/adapter/http_adapter.js +27 -0
- package/dist/connection/adapter/http_adapter.js.map +1 -0
- package/dist/connection/adapter/http_search_params.d.ts +9 -0
- package/dist/connection/adapter/http_search_params.js +36 -0
- package/dist/connection/adapter/http_search_params.js.map +1 -0
- package/dist/connection/adapter/https_adapter.d.ts +10 -0
- package/dist/connection/adapter/https_adapter.js +27 -0
- package/dist/connection/adapter/https_adapter.js.map +1 -0
- package/dist/connection/adapter/index.d.ts +2 -0
- package/dist/connection/adapter/index.js +8 -0
- package/dist/connection/adapter/index.js.map +1 -0
- package/dist/connection/adapter/transform_url.d.ts +5 -0
- package/dist/connection/adapter/transform_url.js +15 -0
- package/dist/connection/adapter/transform_url.js.map +1 -0
- package/dist/connection/connection.d.ts +34 -0
- package/dist/connection/connection.js +17 -0
- package/dist/connection/connection.js.map +1 -0
- package/dist/connection/index.d.ts +1 -0
- package/dist/connection/index.js +18 -0
- package/dist/connection/index.js.map +1 -0
- package/dist/data_formatter/format_query_params.d.ts +1 -0
- package/dist/data_formatter/format_query_params.js +61 -0
- package/dist/data_formatter/format_query_params.js.map +1 -0
- package/dist/data_formatter/format_query_settings.d.ts +2 -0
- package/dist/data_formatter/format_query_settings.js +21 -0
- package/dist/data_formatter/format_query_settings.js.map +1 -0
- package/dist/data_formatter/formatter.d.ts +23 -0
- package/dist/data_formatter/formatter.js +81 -0
- package/dist/data_formatter/formatter.js.map +1 -0
- package/dist/data_formatter/index.d.ts +3 -0
- package/dist/data_formatter/index.js +23 -0
- package/dist/data_formatter/index.js.map +1 -0
- package/dist/error/index.d.ts +1 -0
- package/dist/error/index.js +18 -0
- package/dist/error/index.js.map +1 -0
- package/dist/error/parse_error.d.ts +12 -0
- package/dist/error/parse_error.js +39 -0
- package/dist/error/parse_error.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +8 -0
- package/dist/logger.js +35 -0
- package/dist/logger.js.map +1 -0
- package/dist/rows.d.ts +50 -0
- package/dist/rows.js +114 -0
- package/dist/rows.js.map +1 -0
- package/dist/schema/common.d.ts +8 -0
- package/dist/schema/common.js +3 -0
- package/dist/schema/common.js.map +1 -0
- package/dist/schema/compact.d.ts +3 -0
- package/dist/schema/compact.js +24 -0
- package/dist/schema/compact.js.map +1 -0
- package/dist/schema/engines.d.ts +40 -0
- package/dist/schema/engines.js +61 -0
- package/dist/schema/engines.js.map +1 -0
- package/dist/schema/index.d.ts +7 -0
- package/dist/schema/index.js +24 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/query_formatter.d.ts +9 -0
- package/dist/schema/query_formatter.js +48 -0
- package/dist/schema/query_formatter.js.map +1 -0
- package/dist/schema/result.d.ts +13 -0
- package/dist/schema/result.js +3 -0
- package/dist/schema/result.js.map +1 -0
- package/dist/schema/schema.d.ts +6 -0
- package/dist/schema/schema.js +20 -0
- package/dist/schema/schema.js.map +1 -0
- package/dist/schema/stream.d.ts +11 -0
- package/dist/schema/stream.js +25 -0
- package/dist/schema/stream.js.map +1 -0
- package/dist/schema/table.d.ts +44 -0
- package/dist/schema/table.js +70 -0
- package/dist/schema/table.js.map +1 -0
- package/dist/schema/types.d.ts +201 -0
- package/dist/schema/types.js +268 -0
- package/dist/schema/types.js.map +1 -0
- package/dist/schema/where.d.ts +8 -0
- package/dist/schema/where.js +43 -0
- package/dist/schema/where.js.map +1 -0
- package/dist/settings.d.ts +1453 -0
- package/dist/settings.js +28 -0
- package/dist/settings.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/stream.d.ts +5 -0
- package/dist/utils/stream.js +32 -0
- package/dist/utils/stream.js.map +1 -0
- package/dist/utils/string.d.ts +1 -0
- package/dist/utils/string.js +9 -0
- package/dist/utils/string.js.map +1 -0
- package/package.json +63 -0
package/dist/settings.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @see {@link https://github.com/ClickHouse/ClickHouse/blob/46ed4f6cdf68fbbdc59fbe0f0bfa9a361cc0dec1/src/Core/Settings.h}
|
|
4
|
+
* @see {@link https://github.com/ClickHouse/ClickHouse/blob/5f84f06d6d26672da3d97d0b236ebb46b5080989/src/Core/Defines.h}
|
|
5
|
+
* @see {@link https://github.com/ClickHouse/ClickHouse/blob/eae2667a1c29565c801be0ffd465f8bfcffe77ef/src/Storages/MergeTree/MergeTreeSettings.h}
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.SettingsMap = void 0;
|
|
9
|
+
class SettingsMap {
|
|
10
|
+
constructor(record) {
|
|
11
|
+
Object.defineProperty(this, "record", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
configurable: true,
|
|
14
|
+
writable: true,
|
|
15
|
+
value: record
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
toString() {
|
|
19
|
+
return `{${Object.entries(this.record)
|
|
20
|
+
.map(([k, v]) => `'${k}':'${v}'`)
|
|
21
|
+
.join(',')}}`;
|
|
22
|
+
}
|
|
23
|
+
static from(record) {
|
|
24
|
+
return new this(record);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.SettingsMap = SettingsMap;
|
|
28
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAw5CH,MAAa,WAAW;IACtB,YAAqC,MAA8B;;;;;mBAA9B;;IAAiC,CAAC;IAEvE,QAAQ;QACN,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;aACnC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;aAChC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAA;IACjB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAA8B;QACxC,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,CAAA;IACzB,CAAC;CACF;AAZD,kCAYC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./stream"), exports);
|
|
18
|
+
__exportStar(require("./string"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,2CAAwB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import Stream from 'stream';
|
|
3
|
+
export declare function isStream(obj: any): obj is Stream.Readable;
|
|
4
|
+
export declare function getAsText(stream: Stream.Readable): Promise<string>;
|
|
5
|
+
export declare function mapStream(mapper: (input: any) => any): Stream.Transform;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.mapStream = exports.getAsText = exports.isStream = void 0;
|
|
7
|
+
const stream_1 = __importDefault(require("stream"));
|
|
8
|
+
function isStream(obj) {
|
|
9
|
+
return obj !== null && typeof obj.pipe === 'function';
|
|
10
|
+
}
|
|
11
|
+
exports.isStream = isStream;
|
|
12
|
+
async function getAsText(stream) {
|
|
13
|
+
let result = '';
|
|
14
|
+
const textDecoder = new TextDecoder();
|
|
15
|
+
for await (const chunk of stream) {
|
|
16
|
+
result += textDecoder.decode(chunk, { stream: true });
|
|
17
|
+
}
|
|
18
|
+
// flush
|
|
19
|
+
result += textDecoder.decode();
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
exports.getAsText = getAsText;
|
|
23
|
+
function mapStream(mapper) {
|
|
24
|
+
return new stream_1.default.Transform({
|
|
25
|
+
objectMode: true,
|
|
26
|
+
transform(chunk, encoding, callback) {
|
|
27
|
+
callback(null, mapper(chunk));
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
exports.mapStream = mapStream;
|
|
32
|
+
//# sourceMappingURL=stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/utils/stream.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA2B;AAE3B,SAAgB,QAAQ,CAAC,GAAQ;IAC/B,OAAO,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,UAAU,CAAA;AACvD,CAAC;AAFD,4BAEC;AAEM,KAAK,UAAU,SAAS,CAAC,MAAuB;IACrD,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAA;IAErC,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE;QAChC,MAAM,IAAI,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;KACtD;IAED,QAAQ;IACR,MAAM,IAAI,WAAW,CAAC,MAAM,EAAE,CAAA;IAC9B,OAAO,MAAM,CAAA;AACf,CAAC;AAXD,8BAWC;AAED,SAAgB,SAAS,CAAC,MAA2B;IACnD,OAAO,IAAI,gBAAM,CAAC,SAAS,CAAC;QAC1B,UAAU,EAAE,IAAI;QAChB,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ;YACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;QAC/B,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAPD,8BAOC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function replaceAll(input: string, replace_char: string, new_char: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replaceAll = void 0;
|
|
4
|
+
// string.replaceAll supported in nodejs v15+
|
|
5
|
+
function replaceAll(input, replace_char, new_char) {
|
|
6
|
+
return input.split(replace_char).join(new_char);
|
|
7
|
+
}
|
|
8
|
+
exports.replaceAll = replaceAll;
|
|
9
|
+
//# sourceMappingURL=string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/utils/string.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;AAC7C,SAAgB,UAAU,CACxB,KAAa,EACb,YAAoB,EACpB,QAAgB;IAEhB,OAAO,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;AACjD,CAAC;AAND,gCAMC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@clickhouse/client",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Official JS client for ClickHouse DB",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"clickhouse",
|
|
8
|
+
"sql",
|
|
9
|
+
"client"
|
|
10
|
+
],
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=14"
|
|
13
|
+
},
|
|
14
|
+
"private": false,
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "rm -rf dist; tsc",
|
|
17
|
+
"build:all": "rm -rf dist; tsc --project tsconfig.dev.json",
|
|
18
|
+
"typecheck": "tsc --project tsconfig.dev.json --noEmit",
|
|
19
|
+
"lint": "eslint . --ext .ts",
|
|
20
|
+
"lint:fix": "eslint --fix . --ext .ts",
|
|
21
|
+
"test": "jest --reporters jest-silent-reporter --testPathPattern=__tests__ --globalSetup='<rootDir>/__tests__/setup.integration.ts'",
|
|
22
|
+
"test:unit": "jest --reporters jest-silent-reporter --testMatch='**/__tests__/{unit,utils}/*.test.ts'",
|
|
23
|
+
"test:integration": "jest --reporters jest-silent-reporter --runInBand --testPathPattern=__tests__/integration --globalSetup='<rootDir>/__tests__/setup.integration.ts'",
|
|
24
|
+
"test:integration:local_cluster": "CLICKHOUSE_TEST_ENVIRONMENT=local_cluster jest --reporters jest-silent-reporter --runInBand --testPathPattern=__tests__/integration --globalSetup='<rootDir>/__tests__/setup.integration.ts'",
|
|
25
|
+
"test:integration:cloud": "CLICKHOUSE_TEST_ENVIRONMENT=cloud jest --reporters jest-silent-reporter --runInBand --testPathPattern=__tests__/integration --globalSetup='<rootDir>/__tests__/setup.integration.ts'",
|
|
26
|
+
"prepare": "husky install"
|
|
27
|
+
},
|
|
28
|
+
"main": "dist/index.js",
|
|
29
|
+
"types": "dist/index.d.ts",
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"node-abort-controller": "^3.0.1",
|
|
35
|
+
"split2": "^4.1.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/jest": "^29.0.2",
|
|
39
|
+
"@types/node": "^18.7.18",
|
|
40
|
+
"@types/split2": "^3.2.1",
|
|
41
|
+
"@types/uuid": "^8.3.4",
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^5.37.0",
|
|
43
|
+
"@typescript-eslint/parser": "^5.37.0",
|
|
44
|
+
"eslint": "^8.23.1",
|
|
45
|
+
"eslint-config-prettier": "^8.5.0",
|
|
46
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
47
|
+
"husky": "^8.0.1",
|
|
48
|
+
"jest": "^29.0.3",
|
|
49
|
+
"jest-silent-reporter": "^0.5.0",
|
|
50
|
+
"lint-staged": "^13.0.3",
|
|
51
|
+
"prettier": "2.7.1",
|
|
52
|
+
"ts-jest": "^29.0.1",
|
|
53
|
+
"ts-loader": "^9.3.1",
|
|
54
|
+
"typescript": "^4.8.3",
|
|
55
|
+
"uuid": "^9.0.0"
|
|
56
|
+
},
|
|
57
|
+
"lint-staged": {
|
|
58
|
+
"*.ts": [
|
|
59
|
+
"prettier --write",
|
|
60
|
+
"eslint --fix"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|