From 1c99eac3783f30b08a67926d1ccec0377d5e2533 Mon Sep 17 00:00:00 2001 From: Ali Demirci Date: Fri, 31 Dec 2021 10:17:55 +0300 Subject: [PATCH] refactor(lib): use nodejs client as wrapper, instead of implementing it independently. --- README.md | 164 +++++++++++------- lib/clickhouse.module.ts | 8 +- lib/client/ClickHouseClient.ts | 197 ---------------------- lib/enums/ClickHouseCompressionMethod.ts | 6 - lib/enums/ClickHouseConnectionProtocol.ts | 4 - lib/enums/ClickHouseDataFormat.ts | 3 - lib/enums/index.ts | 3 - lib/index.ts | 4 +- lib/interfaces/ClickHouseModuleOptions.ts | 116 ------------- lib/interfaces/index.ts | 1 - package-lock.json | 136 ++++++++++++--- package.json | 8 +- 12 files changed, 225 insertions(+), 425 deletions(-) delete mode 100644 lib/client/ClickHouseClient.ts delete mode 100644 lib/enums/ClickHouseCompressionMethod.ts delete mode 100644 lib/enums/ClickHouseConnectionProtocol.ts delete mode 100644 lib/enums/ClickHouseDataFormat.ts delete mode 100644 lib/enums/index.ts delete mode 100644 lib/interfaces/ClickHouseModuleOptions.ts delete mode 100644 lib/interfaces/index.ts diff --git a/README.md b/README.md index 51e730b..d122b04 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,3 @@ -

- Nest Logo -

- -

A progressive Node.js framework for building efficient and scalable server-side applications.

-

-NPM Version -Package License -NPM Downloads -CircleCI -Coverage -Discord -Backers on Open Collective -Sponsors on Open Collective - - -

- - ## Description [ClickHouse®](https://clickhouse.com/) is an open-source, high performance columnar OLAP database management system for real-time analytics using SQL. ClickHouse combined with [TypeScript](https://www.typescriptlang.org/) helps you develop better type safety with your ClickHouse queries, giving you end-to-end typing. @@ -32,7 +12,10 @@ $ npm i --save @depyronick/nestjs-clickhouse ## Quick Start +> This NestJS module is a wrapper for **[@depyronick/clickhouse-client](https://github.com/depyronick/clickhouse-client '@depyronick/clickhouse-client')**. You can find latest documentation for methods there. + ### Importing the module + Once the installation process is complete, we can import the `ClickHouseModule` into the root `AppModule`. ```typescript @@ -41,16 +24,23 @@ import { ClickHouseModule } from '@depyronick/nestjs-clickhouse'; @Module({ imports: [ - ClickHouseModule.register([{ - name: 'ANALYTICS_SERVER', - host: '127.0.0.1', - password: '7h3ul71m473p4555w0rd' - }]) + ClickHouseModule.register([ + { + name: 'ANALYTICS_SERVER', + host: '127.0.0.1', + password: '7h3ul71m473p4555w0rd', + }, + ]), ], }) export class AppModule {} ``` -The `register()` method will register a ClickHouse client with the specified connection options. See **[ClickHouseOptions](https://github.com/depyronick/nestjs-clickhouse/blob/main/lib/interfaces/ClickHouseModuleOptions.ts "ClickHouseOptions")** object for more information. Each registered client should have an unique `name` definition. The default value for `name` property is `CLICKHOUSE_DEFAULT`. This property will be used as an injection token. + +The `register()` method will register a ClickHouse client with the specified connection options. + +See **[ClickHouseOptions](https://github.com/depyronick/clickhouse-client/blob/main/src/client/interfaces/ClickHouseClientOptions.ts 'ClickHouseOptions')** object for more information. + +Each registered client should have an unique `name` definition. The default value for `name` property is `CLICKHOUSE_DEFAULT`. This property will be used as an injection token. ### Interacting with ClickHouse Client @@ -58,15 +48,16 @@ To interact with the ClickHouse server that you have just registered, inject it ```typescript constructor( - @Inject('ANALYTICS_SERVER') + @Inject('ANALYTICS_SERVER') private analyticsServer: ClickHouseClient ) {} ``` + > The `ClickHouseClient` class is imported from the `@depyronick/nestjs-clickhouse`. -There are two methods to interact with the server: +## Examples -### `ClickHouseClient.query(query: string): Observable` +#### `ClickHouseClient.query(query: string): Observable` ```typescript import { Inject, Injectable } from '@nestjs/common'; @@ -85,11 +76,10 @@ interface VisitsTable { export class AppService { constructor( @Inject('ANALYTICS_SERVER') - private readonly analyticsServer: ClickHouseClient + private readonly analyticsServer: ClickHouseClient, ) { - this - .analyticsServer - .query("SELECT * FROM visits LIMIT 10") + this.analyticsServer + .query('SELECT * FROM visits LIMIT 10') .subscribe({ error: (err: any): void => { // called when an error occurred during query @@ -100,17 +90,57 @@ export class AppService { }, complete: (): void => { // called when stream is completed - } + }, + }); + } +} +``` + +#### `ClickHouseClient.queryPromise(query: string): Promise` + +```typescript +import { Inject, Injectable } from '@nestjs/common'; +import { ClickHouseClient } from '@depyronick/nestjs-clickhouse'; + +interface VisitsTable { + timestamp: number; + ip: string; + userAgent: string; + os: string; + version: string; + // ... +} + +@Injectable() +export class AppService { + constructor( + @Inject('ANALYTICS_SERVER') + private readonly analyticsServer: ClickHouseClient, + ) { + this.analyticsServer + .queryPromise('SELECT * FROM visits LIMIT 10') + .then((rows: VisitsTable[]) => { + // all retrieved rows }) + .catch((err) => { + // called when an error occurred during query + }); + + // or + + const rows = await this.analyticsServer.queryPromise( + 'SELECT * FROM visits LIMIT 10', + ); } } ``` -### `ClickHouseClient.insert(table: string, data: T[]): Observable` +#### `ClickHouseClient.insert(table: string, data: T[]): Observable` + +The `insert` method accepts two inputs. -The `insert` method accepts two inputs. -- `table` is the name of the table that you'll be inserting data to. - - Table value could be prefixed with database like `analytics_db.visits`. +- `table` is the name of the table that you'll be inserting data to. + - Table value could be prefixed with database like `analytics_db.visits`. - `data: T[]` array of JSON objects to insert. ```typescript @@ -130,17 +160,19 @@ interface VisitsTable { export class AppService { constructor( @Inject('ANALYTICS_SERVER') - private readonly analyticsServer: ClickHouseClient + private readonly analyticsServer: ClickHouseClient, ) { - this - .analyticsServer - .insert("visits", [{ - timestamp: new Date().getTime(), - ip: '127.0.0.1', - os: 'OSX', - userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/95.0.4638.69 Safari/537.36', - version: "1.0.0" - }]) + this.analyticsServer + .insert('visits', [ + { + timestamp: new Date().getTime(), + ip: '127.0.0.1', + os: 'OSX', + userAgent: + 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/95.0.4638.69 Safari/537.36', + version: '1.0.0', + }, + ]) .subscribe({ error: (err: any): void => { // called when an error occurred during insert @@ -150,33 +182,38 @@ export class AppService { }, complete: (): void => { // called when insert is completed - } - }) + }, + }); } } ``` ## Multiple Clients + You can register multiple clients in the same application as follows: ```typescript @Module({ imports: [ - ClickHouseModule.register([{ - name: 'ANALYTICS_SERVER', - host: '127.0.0.1', - password: '7h3ul71m473p4555w0rd' - }, { - name: 'CHAT_SERVER', - host: '192.168.1.110', - password: 'ch5ts3rv3Rp455w0rd' - }]) + ClickHouseModule.register([ + { + name: 'ANALYTICS_SERVER', + host: '127.0.0.1', + password: '7h3ul71m473p4555w0rd', + }, + { + name: 'CHAT_SERVER', + host: '192.168.1.110', + password: 'ch5ts3rv3Rp455w0rd', + }, + ]), ], controllers: [AppController], providers: [AppService], }) -export class AppModule { } +export class AppModule {} ``` + Then you can interact with these servers using their assigned injection tokens. ```typescript @@ -190,10 +227,11 @@ constructor( ``` ## Notes + - This repository will be actively maintained and improved. -- Currently only supports JSON format. - - Planning to support all applicable formats listed [here](https://clickhouse.com/docs/en/interfaces/formats/ "here"). -- Planning to implement TCP protocol, if ClickHouse decides to [documentate](https://clickhouse.com/docs/en/interfaces/tcp/ "documentate") it. +- Currently only supports JSON format. + - Planning to support all applicable formats listed [here](https://clickhouse.com/docs/en/interfaces/formats/ 'here'). +- Planning to implement TCP protocol, if ClickHouse decides to [documentate](https://clickhouse.com/docs/en/interfaces/tcp/ 'documentate') it. - Planning to implement inserts with streams. - This library supports http response compressions such as brotli, gzip and deflate. diff --git a/lib/clickhouse.module.ts b/lib/clickhouse.module.ts index d748f93..a0fe0e1 100644 --- a/lib/clickhouse.module.ts +++ b/lib/clickhouse.module.ts @@ -1,7 +1,11 @@ import { DynamicModule, Module } from '@nestjs/common'; -import { ClickHouseClient } from './client/ClickHouseClient'; -import { ClickHouseModuleOptions } from './interfaces/ClickHouseModuleOptions'; +import { + ClickHouseClient, + ClickHouseClientOptions as ClickHouseNodeClientOptions +} from '@depyronick/clickhouse-client'; + +export class ClickHouseModuleOptions extends ClickHouseNodeClientOptions { } @Module({}) export class ClickHouseModule { diff --git a/lib/client/ClickHouseClient.ts b/lib/client/ClickHouseClient.ts deleted file mode 100644 index 1cf4228..0000000 --- a/lib/client/ClickHouseClient.ts +++ /dev/null @@ -1,197 +0,0 @@ -import { Logger } from '@nestjs/common'; - -import axios, { AxiosRequestConfig, AxiosRequestHeaders } from 'axios'; - -import { IncomingMessage } from 'http'; - -import * as Pick from 'stream-json/filters/Pick'; -import * as StreamArray from 'stream-json/streamers/StreamArray'; - -import * as zlib from 'zlib'; - -import { Parser } from 'stream-json'; -import { Observable } from 'rxjs'; - -import { ClickHouseConnectionProtocol, ClickHouseCompressionMethod, ClickHouseDataFormat } from '../enums'; -import { ClickHouseModuleOptions } from '../interfaces/ClickHouseModuleOptions'; - -export class ClickHouseClient { - /** - * NestJS Logger - */ - private logger = new Logger('ClickHouseModule'); - - /** - * ClickHouse Service - */ - constructor( - private options: ClickHouseModuleOptions - ) { } - - /** - * Prepare request options - */ - private _getRequestOptions(query: string, withoutFormat: boolean = false): AxiosRequestConfig { - let url = ''; - switch (this.options.protocol) { - case ClickHouseConnectionProtocol.HTTP: - url = `http://${this.options.host}:${this.options.port}`; - break; - case ClickHouseConnectionProtocol.HTTPS: - url = `https://${this.options.host}:${this.options.port}`; - break; - } - - if (!withoutFormat) { - query = `${query.trimEnd()} FORMAT ${this.options.format}`; - } - - const params = { - query, - database: this.options.database - }; - - if (this.options.compression != ClickHouseCompressionMethod.NONE) { - params['enable_http_compression'] = 1; - } - - const requestOptions: AxiosRequestConfig = { - url, - params, - responseType: 'stream', - auth: { - username: this.options.username, - password: this.options.password - }, - transformResponse: (data: IncomingMessage) => { - if (this.options.compression == ClickHouseCompressionMethod.BROTLI) { - return data.pipe(zlib.createBrotliDecompress()); - } else { - return data; - } - }, - headers: this._getHeaders() - } - - return requestOptions; - } - - /** - * Prepare headers for request - */ - private _getHeaders(): AxiosRequestHeaders { - const headers = {}; - - switch (this.options.compression) { - case ClickHouseCompressionMethod.GZIP: - headers['Accept-Encoding'] = 'gzip'; - break; - case ClickHouseCompressionMethod.DEFLATE: - headers['Accept-Encoding'] = 'deflate'; - break; - case ClickHouseCompressionMethod.BROTLI: - headers['Accept-Encoding'] = 'br'; - } - - return headers; - } - - /** - * Create a Readable Query Stream - */ - public query(query: string) { - return new Observable(subscriber => { - axios - .request( - this._getRequestOptions(query) - ) - .then((response) => { - const stream: IncomingMessage = response.data; - - if (this.options.format == ClickHouseDataFormat.JSON) { - const pipeline = stream - .pipe(new Parser()) - .pipe(new Pick({ - filter: 'data' - })) - .pipe(new StreamArray()) - - pipeline - .on('data', (row) => { - subscriber.next(row.value as T); - }) - .on('end', () => { - subscriber.complete() - }) - } else { - throw new Error("Unsupported data format. Only JSON is supported for now.") - } - }) - .catch((reason) => { - if (reason && reason.response) { - let err: string = ''; - - reason - .response - .data - .on('data', chunk => { - err += chunk.toString('utf8') - }) - .on('end', () => { - this.logger.error(err.trim()); - subscriber.error(err.trim()); - - err = ''; - }); - } else { - subscriber.error(reason.code); - this.logger.error(reason.code); - } - }) - }) - } - - /** - * Insert data to table - */ - public insert(table: string, data: T[]) { - return new Observable(subscriber => { - let query = `INSERT INTO ${table}`; - let _data: any; - - switch (this.options.format) { - case ClickHouseDataFormat.JSON: - query += ` FORMAT JSONEachRow`; - _data = data.map(d => JSON.stringify(d)).join('\n'); - break; - } - - axios - .request( - Object.assign( - this._getRequestOptions(query, true), - { - responseType: 'stream', - method: 'POST', - data: _data - } - ) - ) - .then((response) => { - const stream: IncomingMessage = response.data; - - stream - .on('data', (data) => { - subscriber.next(data); - }) - .on('end', () => { - subscriber.complete(); - }); - }) - .catch(reason => { - subscriber.error(reason); - this.logger.error(reason); - }) - }); - } -} \ No newline at end of file diff --git a/lib/enums/ClickHouseCompressionMethod.ts b/lib/enums/ClickHouseCompressionMethod.ts deleted file mode 100644 index 7c91fc3..0000000 --- a/lib/enums/ClickHouseCompressionMethod.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum ClickHouseCompressionMethod { - NONE, - GZIP, - BROTLI, - DEFLATE -} \ No newline at end of file diff --git a/lib/enums/ClickHouseConnectionProtocol.ts b/lib/enums/ClickHouseConnectionProtocol.ts deleted file mode 100644 index a965257..0000000 --- a/lib/enums/ClickHouseConnectionProtocol.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum ClickHouseConnectionProtocol { - HTTP, - HTTPS -} \ No newline at end of file diff --git a/lib/enums/ClickHouseDataFormat.ts b/lib/enums/ClickHouseDataFormat.ts deleted file mode 100644 index eff43fa..0000000 --- a/lib/enums/ClickHouseDataFormat.ts +++ /dev/null @@ -1,3 +0,0 @@ -export enum ClickHouseDataFormat { - JSON = 'JSON' -} \ No newline at end of file diff --git a/lib/enums/index.ts b/lib/enums/index.ts deleted file mode 100644 index 90d9c67..0000000 --- a/lib/enums/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './ClickHouseCompressionMethod'; -export * from './ClickHouseDataFormat'; -export * from './ClickHouseConnectionProtocol'; \ No newline at end of file diff --git a/lib/index.ts b/lib/index.ts index 14e619b..4b2deb2 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,4 +1,2 @@ export * from './clickhouse.module'; -export * from './client/ClickHouseClient' -export * from './enums'; -export * from './interfaces'; \ No newline at end of file +export * from '@depyronick/clickhouse-client'; \ No newline at end of file diff --git a/lib/interfaces/ClickHouseModuleOptions.ts b/lib/interfaces/ClickHouseModuleOptions.ts deleted file mode 100644 index 3570f95..0000000 --- a/lib/interfaces/ClickHouseModuleOptions.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { - ClickHouseCompressionMethod, - ClickHouseConnectionProtocol, - ClickHouseDataFormat -} from "../enums"; - -export class ClickHouseSettings { - /** - * Enables or disables X-ClickHouse-Progress HTTP response headers in clickhouse-server responses. - * - * Default: 0 - */ - public send_progress_in_http_headers?: 0 | 1 = 0; - - /** - * You can enable response buffering on the server-side. The buffer_size and wait_end_of_query URL parameters are provided for this purpose. - * buffer_size determines the number of bytes in the result to buffer in the server memory. - * - * If a result body is larger than this threshold, the buffer is written to the HTTP channel, and the remaining data is sent directly to the HTTP channel. - * To ensure that the entire response is buffered, set wait_end_of_query=1. In this case, the data that is not stored in memory will be buffered in a temporary server file. - * - * Default: 1 - */ - public wait_end_of_query?: 0 | 1 = 1; - - /** - * You can enable response buffering on the server-side. The buffer_size and wait_end_of_query URL parameters are provided for this purpose. - * buffer_size determines the number of bytes in the result to buffer in the server memory. - * - * If a result body is larger than this threshold, the buffer is written to the HTTP channel, and the remaining data is sent directly to the HTTP channel. - * To ensure that the entire response is buffered, set wait_end_of_query=1. In this case, the data that is not stored in memory will be buffered in a temporary server file. - * - * Default: 1048576 - */ - public buffer_size?: number = 1048576; -} - -export class ClickHouseModuleOptions { - /** - * ClickHouse Server Identifier - * - * Default: CLICKHOUSE_DEFAULT - */ - public name?: string = 'CLICKHOUSE_DEFAULT'; - - /** - * ClickHouse Host - * - * Default: 127.0.0.1 - */ - public host?: string = "127.0.0.1"; - - /** - * ClickHouse Port - * - * Default: 8123 - */ - public port?: number = 8123; - - /** - * ClickHouse Username - * - * Default: default - */ - public username?: string = "default"; - - /** - * ClickHouse Password - * - * Default: - */ - public password?: string = ""; - - /** - * ClickHouse Database - * - * Default: default - */ - public database?: string = "default"; - - /** - * HTTP Inteface Protocol - * - * Default: HTTP - */ - public protocol?: ClickHouseConnectionProtocol = ClickHouseConnectionProtocol.HTTP; - - /** - * HTTP Interface Compression Method - * - * Default: NONE - */ - public compression?: ClickHouseCompressionMethod = ClickHouseCompressionMethod.NONE; - - /** - * Input & Output Data Format - * - * Default: JSON - * @note Currently, only JSON is supported. - */ - public format?: ClickHouseDataFormat = ClickHouseDataFormat.JSON; - - /** - * HTTP Interface Connection Settings - */ - public settings?: ClickHouseSettings = new ClickHouseSettings(); - - /** - * ClickHouse Connection Options - */ - constructor() { - if (this.settings) { - this.settings = Object.assign(new ClickHouseSettings(), this.settings); - } - } -} diff --git a/lib/interfaces/index.ts b/lib/interfaces/index.ts deleted file mode 100644 index 34ac40a..0000000 --- a/lib/interfaces/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './ClickHouseModuleOptions'; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 343f4e1..9af8dff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,9 +1,31 @@ { "name": "@depyronick/nestjs-clickhouse", - "version": "1.0.0", + "version": "1.0.7", "lockfileVersion": 1, "requires": true, "dependencies": { + "@depyronick/clickhouse-client": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@depyronick/clickhouse-client/-/clickhouse-client-1.0.7.tgz", + "integrity": "sha512-3fLL3YSKrYYefymKRRUgQnyJQwL5hbJvG/gRORujauGAuxHoX6BhpZh7SBO33FpBPHPwwzV4qtOqJDIp9ZjBZw==", + "requires": { + "axios": "^0.24.0", + "reflect-metadata": "^0.1.13", + "rimraf": "^3.0.2", + "rxjs": "^7.5.1", + "stream-json": "^1.7.3" + }, + "dependencies": { + "rxjs": { + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.1.tgz", + "integrity": "sha512-KExVEeZWxMZnZhUZtsJcFwz8IvPvgu4G2Z2QyqjZQzUGr32KDYuSxrEYO4w3tFFNbfLozcrKUTvTPi+E9ywJkQ==", + "requires": { + "tslib": "^2.1.0" + } + } + } + }, "@nestjs/common": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/@nestjs/common/-/common-8.2.0.tgz", @@ -48,25 +70,6 @@ "integrity": "sha512-QB5D2sqfSjCmTuWcBWyJ+/44bcjO7VbjSbOE0ucoVbAsSNQc4Lt6QkgkVXkTDwkL4z/beecZNDvVX15D4P8Jbw==", "dev": true }, - "@types/stream-chain": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/stream-chain/-/stream-chain-2.0.1.tgz", - "integrity": "sha512-D+Id9XpcBpampptkegH7WMsEk6fUdf9LlCIX7UhLydILsqDin4L0QT7ryJR0oycwC7OqohIzdfcMHVZ34ezNGg==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/stream-json": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@types/stream-json/-/stream-json-1.7.1.tgz", - "integrity": "sha512-BNIK/ix6iJvWvoXbDVVJhw5LNG1wie/rXcUo7jw4hBqY3FhIrg0e+RMXFN5UreKclBIStl9FDEHNSDLuuQ9/MQ==", - "dev": true, - "requires": { - "@types/node": "*", - "@types/stream-chain": "*" - } - }, "ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -84,6 +87,20 @@ "follow-redirects": "^1.14.4" } }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -109,6 +126,11 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, "consola": { "version": "2.15.3", "resolved": "https://registry.npmjs.org/consola/-/consola-2.15.3.tgz", @@ -126,18 +148,58 @@ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.5.tgz", "integrity": "sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==" }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, "iterare": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/iterare/-/iterare-1.2.1.tgz", "integrity": "sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==", "dev": true }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, "node-fetch": { "version": "2.6.6", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz", @@ -153,12 +215,38 @@ "integrity": "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==", "dev": true }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, "path-to-regexp": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-3.2.0.tgz", "integrity": "sha512-jczvQbCUS7XmS7o+y1aEO9OBVFeZBQ1MDSEqmO7xSoPgOPoowY/SxLpZ6Vh97/8qHZOteiCKb7gkG9gA2ZUxJA==", "dev": true }, + "reflect-metadata": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", + "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "requires": { + "glob": "^7.1.3" + } + }, "rxjs": { "version": "7.4.0", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.4.0.tgz", @@ -207,8 +295,7 @@ "tslib": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", - "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", - "dev": true + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" }, "uuid": { "version": "8.3.2", @@ -231,6 +318,11 @@ "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" } } } diff --git a/package.json b/package.json index 3cabc6a..262d125 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@depyronick/nestjs-clickhouse", - "version": "1.0.0", + "version": "1.0.7", "description": "ClickHouse Client Module for NestJS", "main": "index.js", "repository": "https://github.com/depyronick/nestjs-clickhouse", @@ -15,7 +15,6 @@ "@nestjs/common": "8.2.0", "@nestjs/core": "8.2.0", "@types/node": "^16.11.7", - "@types/stream-json": "^1.7.1", "rxjs": "^7.4.0", "reflect-metadata": "0.1.13" }, @@ -25,7 +24,6 @@ "reflect-metadata": "^0.1.13" }, "dependencies": { - "axios": "^0.24.0", - "stream-json": "^1.7.3" + "@depyronick/clickhouse-client": "^1.0.7" } -} \ No newline at end of file +}