Skip to content

Commit 00a0080

Browse files
committed
Add typings for the remaining HTTP settings
1 parent 850ae64 commit 00a0080

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

packages/client-common/__tests__/unit/to_search_params.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ describe('toSearchParams', () => {
7373
extremes: 1,
7474
enable_optimize_predicate_expression: 0,
7575
wait_end_of_query: 1,
76+
compress: 1,
77+
decompress: 1,
78+
user: 'John',
79+
password: 'Doe',
80+
quota_key: 'my-quota-key',
81+
buffer_size: 1048576,
7682
},
7783
query_params: {
7884
qaz: 'qux',
@@ -84,15 +90,21 @@ describe('toSearchParams', () => {
8490
})!
8591
const result = toSortedArray(params)
8692
expect(result).toEqual([
93+
['buffer_size', '1048576'],
94+
['compress', '1'],
8795
['database', 'some_db'],
96+
['decompress', '1'],
8897
['enable_optimize_predicate_expression', '0'],
8998
['extremes', '1'],
9099
['param_qaz', 'qux'],
100+
['password', 'Doe'],
91101
['query', 'SELECT * FROM system.query_log'],
92102
['query_id', 'my-query-id'],
103+
['quota_key', 'my-quota-key'],
93104
['role', 'my-role-1'],
94105
['role', 'my-role-2'],
95106
['session_id', 'my-session-id'],
107+
['user', 'John'],
96108
['wait_end_of_query', '1'],
97109
])
98110
})

packages/client-common/src/settings.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,6 +1597,27 @@ interface ClickHouseServerSettings {
15971597

15981598
/** @see https://clickhouse.com/docs/en/interfaces/http */
15991599
interface ClickHouseHTTPSettings {
1600+
/** If you specify compress=1, the server will compress the data it sends to you. */
1601+
compress: Bool
1602+
/** If you specify decompress=1, the server will decompress the data which you pass in the POST method. */
1603+
decompress: Bool
1604+
/** User name. If the user name is not specified, then the default name is used. */
1605+
user: string
1606+
/** User password. If the password is not specified, then an empty password is used. */
1607+
password: string
1608+
/** The quota_key "key" is passed in the query parameter, and the quota is tracked separately for each key value.
1609+
* For example, you can pass a username as the key, so the quota will be counted separately for each username. */
1610+
quota_key: string
1611+
/** This is any string that serves as the query identifier.
1612+
* If a query from the same user with the same 'query_id' already exists at this time,
1613+
* the behaviour depends on the 'replace_running_query' parameter. */
1614+
query_id: string
1615+
/** Determines the number of bytes in the result to buffer in the server memory.
1616+
* If a result body is larger than this threshold, the buffer is written to the HTTP channel,
1617+
* and the remaining data is sent directly to the HTTP channel.
1618+
* To ensure that the entire response is buffered, set wait_end_of_query=1.
1619+
* In this case, the data that is not stored in memory will be buffered in a temporary server file. */
1620+
buffer_size: UInt64
16001621
/** Ensures that the entire response is buffered.
16011622
* In this case, the data that is not stored in memory will be buffered in a temporary server file.
16021623
* This could help prevent errors that might occur during the streaming of SELECT queries.
@@ -1607,6 +1628,9 @@ interface ClickHouseHTTPSettings {
16071628
* Only useful for the {@link ClickHouseClient.exec} method,
16081629
* as {@link ClickHouseClient.query} method always attaches this clause. */
16091630
default_format: DataFormat
1631+
/** The user defined session identifier.
1632+
* It allows to modify settings, create temporary tables and reuse them in subsequent requests. */
1633+
session_id: string
16101634
/** By default, the session is terminated after 60 seconds of inactivity
16111635
* This is regulated by the `default_session_timeout` server setting. */
16121636
session_timeout: UInt64

0 commit comments

Comments
 (0)