@clickhouse/client-web
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -11,4 +11,3 @@ "use strict"; | ||
values_encoder: new utils_1.WebValuesEncoder(), | ||
close_stream: (stream) => stream.cancel(), | ||
}; | ||
//# sourceMappingURL=config.js.map |
@@ -1,2 +0,2 @@ | ||
import type { ConnBaseQueryParams, Connection, ConnectionParams, ConnInsertParams, ConnInsertResult, ConnPingResult, ConnQueryResult } from '@clickhouse/client-common'; | ||
import type { ConnBaseQueryParams, ConnCommandResult, Connection, ConnectionParams, ConnInsertParams, ConnInsertResult, ConnPingResult, ConnQueryResult } from '@clickhouse/client-common'; | ||
type WebInsertParams<T> = Omit<ConnInsertParams<ReadableStream<T>>, 'values'> & { | ||
@@ -12,2 +12,3 @@ values: string; | ||
exec(params: ConnBaseQueryParams): Promise<ConnQueryResult<ReadableStream<Uint8Array>>>; | ||
command(params: ConnBaseQueryParams): Promise<ConnCommandResult>; | ||
insert<T = unknown>(params: WebInsertParams<T>): Promise<ConnInsertResult>; | ||
@@ -17,3 +18,4 @@ ping(): Promise<ConnPingResult>; | ||
private request; | ||
private runExec; | ||
} | ||
export {}; |
@@ -46,20 +46,15 @@ "use strict"; | ||
async exec(params) { | ||
const query_id = getQueryId(params.query_id); | ||
const searchParams = (0, client_common_1.toSearchParams)({ | ||
database: this.params.database, | ||
clickhouse_settings: params.clickhouse_settings, | ||
query_params: params.query_params, | ||
session_id: params.session_id, | ||
query_id, | ||
}); | ||
const response = await this.request({ | ||
values: params.query, | ||
params, | ||
searchParams, | ||
}); | ||
const result = await this.runExec(params); | ||
return { | ||
stream: response.body || new ReadableStream(), | ||
query_id, | ||
query_id: result.query_id, | ||
stream: result.stream || new ReadableStream(), | ||
}; | ||
} | ||
async command(params) { | ||
const { stream, query_id } = await this.runExec(params); | ||
if (stream !== null) { | ||
await stream.cancel(); | ||
} | ||
return { query_id }; | ||
} | ||
async insert(params) { | ||
@@ -168,2 +163,21 @@ const query_id = getQueryId(params.query_id); | ||
} | ||
async runExec(params) { | ||
const query_id = getQueryId(params.query_id); | ||
const searchParams = (0, client_common_1.toSearchParams)({ | ||
database: this.params.database, | ||
clickhouse_settings: params.clickhouse_settings, | ||
query_params: params.query_params, | ||
session_id: params.session_id, | ||
query_id, | ||
}); | ||
const response = await this.request({ | ||
values: params.query, | ||
params, | ||
searchParams, | ||
}); | ||
return { | ||
stream: response.body, | ||
query_id, | ||
}; | ||
} | ||
} | ||
@@ -170,0 +184,0 @@ exports.WebConnection = WebConnection; |
@@ -1,2 +0,2 @@ | ||
declare const _default: "1.0.1"; | ||
declare const _default: "1.0.2"; | ||
export default _default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = '1.0.1'; | ||
exports.default = '1.0.2'; | ||
//# sourceMappingURL=version.js.map |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://clickhouse.com", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"license": "Apache-2.0", | ||
@@ -24,4 +24,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@clickhouse/client-common": "1.0.1" | ||
"@clickhouse/client-common": "1.0.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
47390
524
+ Added@clickhouse/client-common@1.0.2(transitive)
- Removed@clickhouse/client-common@1.0.1(transitive)