fix(deps): update dependency @clickhouse/client-web to v1 #205
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^0.3.1
->^1.0.0
Release Notes
ClickHouse/clickhouse-js (@clickhouse/client-web)
v1.0.1
Compare Source
Bug fixes
v1.0.0
Compare Source
Formal stable release milestone with a lot of improvements and some breaking changes.
Major new features overview:
query
+ResultSet
From now on, the client will follow the official semantic versioning guidelines.
Deprecated API
The following configuration parameters are marked as deprecated:
host
configuration parameter is deprecated; useurl
instead.additional_headers
configuration parameter is deprecated; usehttp_headers
instead.The client will log a warning if any of these parameters are used. However, it is still allowed to use
host
instead ofurl
andadditional_headers
instead ofhttp_headers
for now; this deprecation is not supposed to break the existing code.These parameters will be removed in the next major release (2.0.0).
See "New features" section for more details.
Breaking changes in 1.0.0
compression.response
is now disabled by default in the client configuration options, as it cannot be used with readonly=1 users, and it was not clear from the ClickHouse error message what exact client option was causing the failing query in this case. If you'd like to continue using response compression, you should explicitly enable it in the client configuration.pathname
as a separate configuration option (as it would be considered as thedatabase
otherwise).ResultSet
andRow
are now more strictly typed, according to the format used during thequery
call. See this section for more details.ClickHouseClient
andClickHouseClientConfigOptions
types, specific to each implementation. ExportedClickHouseClient
now does not have aStream
type parameter, as it was unintended to expose it there. NB: you should still usecreateClient
factory function provided in the package.New features in 1.0.0
Advanced TypeScript support for
query
+ResultSet
Client will now try its best to figure out the shape of the data based on the DataFormat literal specified to the
query
call, as well as which methods are allowed to be called on theResultSet
.Live demo (see the full description below):
Screencast
Complete reference:
ResultSet.json<T>()
ResultSet.stream<T>()
Row.json<T>()
By default,
T
(which representsJSONType
) is stillunknown
. However, consideringJSONObjectsEachRow
example: prior to 1.0.0, you had to specify the entire type hint, including the shape of the data, manually:This is even more handy in case of streaming on the Node.js platform:
Calling
ResultSet.stream
is not allowed for certain data formats, such asJSON
andJSONObjectsEachRow
(unlikeJSONEachRow
and the rest ofJSON*EachRow
, these formats return a single object). In these cases, the client throws an error. However, it was previously not reflected on the type level; now, callingstream
on these formats will result in a TS compiler error. For example:Calling
ResultSet.json
also does not make sense onCSV
and similar "raw" formats, and the client throws. Again, now, it is typed properly:Currently, there is one known limitation: as the general shape of the data and the methods allowed for calling are inferred from the format literal, there might be situations where it will fail to do so, for example:
In this case, as it is likely that you already know the desired format in advance (otherwise, returning a specific shape like
Record<string, Data>
would've been incorrect), consider helping the client a bit:If you are interested in more details, see the related test (featuring a great ESLint plugin expect-types) in the client package.
URL configuration
url
configuration parameter. It is intended to replace the deprecatedhost
, which was already supposed to be passed as a valid URL.http[s]://[username:password@]hostname:port[/database][?param1=value1¶m2=value2]
. In almost every case, the name of a particular parameter reflects its path in the config options interface, with a few exceptions. The following parameters are supported:pathname
application_id
session_id
request_timeout
max_open_connections
compression_request
compression_response
log_level
OFF
,TRACE
,DEBUG
,INFO
,WARN
,ERROR
.keep_alive_enabled
clickhouse_setting_*
orch_*
http_header_*
keep_alive_idle_socket_ttl
[1] For booleans, valid values will be
true
/1
andfalse
/0
.[2] Any parameter prefixed with
clickhouse_setting_
orch_
will have this prefix removed and the rest added to client'sclickhouse_settings
. For example,?ch_async_insert=1&ch_wait_for_async_insert=1
will be the same as:Note: boolean values for
clickhouse_settings
should be passed as1
/0
in the URL.[3] Similar to [2], but for
http_header
configuration. For example,?http_header_x-clickhouse-auth=foobar
will be an equivalent of:Important: URL will always overwrite the hardcoded values and a warning will be logged in this case.
Currently not supported via URL:
log.LoggerClass
tls_ca_cert
,tls_cert
,tls_key
.See also: URL configuration example.
Performance
JSONEachRow
orJSONCompactEachRow
) by calling theResultSet.json()
method. NB: The actual streaming performance when consuming theResultSet.stream()
hasn't changed. Only theResultSet.json()
method used a suboptimal stream processing in some instances, and nowResultSet.json()
just consumes the same stream transformer provided by theResultSet.stream()
method (see #253 for more details).Miscellaneous
http_headers
configuration parameter as a direct replacement foradditional_headers
. Functionally, it is the same, and the change is purely cosmetic, as we'd like to leave an option to implement TCP connection in the future open.0.3.1 (Common, Node.js, Web)
Bug fixes
0.3.0 (Node.js only)
This release primarily focuses on improving the Keep-Alive mechanism's reliability on the client side.
New features
Idle sockets timeout rework; now, the client attaches internal timers to idling sockets, and forcefully removes them from the pool if it considers that a particular socket is idling for too long. The intention of this additional sockets housekeeping is to eliminate "Socket hang-up" errors that could previously still occur on certain configurations. Now, the client does not rely on KeepAlive agent when it comes to removing the idling sockets; in most cases, the server will not close the socket before the client does.
There is a new
keep_alive.idle_socket_ttl
configuration parameter. The default value is2500
(milliseconds), which is considered to be safe, as ClickHouse versions prior to 23.11 hadkeep_alive_timeout
set to 3 seconds by default, andkeep_alive.idle_socket_ttl
is supposed to be slightly less than that to allow the client to remove the sockets that are about to expire before the server does so.Logging improvements: more internal logs on failing requests; all client methods except ping will log an error on failure now. A failed ping will log a warning, since the underlying error is returned as a part of its result. Client logging still needs to be enabled explicitly by specifying the desired
log.level
config option, as the log level isOFF
by default. Currently, the client logs the following events, depending on the selectedlog.level
value:TRACE
- low-level information about the Keep-Alive sockets lifecycle.DEBUG
- response information (without authorization headers and host info).INFO
- still mostly unused, will print the current log level when the client is initialized.WARN
- non-fatal errors; failedping
request is logged as a warning, as the underlying error is included in the returned result.ERROR
- fatal errors fromquery
/insert
/exec
/command
methods, such as a failed request.Breaking changes
keep_alive.retry_on_expired_socket
andkeep_alive.socket_ttl
configuration parameters are removed.max_open_connections
configuration parameter is now 10 by default, as we should not rely on the KeepAlive agent's defaults.request_timeout
configuration value (now it is correctly set to30_000
, previously300_000
(milliseconds)).Bug fixes
Connection
header value considering Keep-Alive settings. If Keep-Alive is disabled, its value is now forced to "close".0.3.0-beta.1 (Node.js only)
See 0.3.0.
0.2.10 (Common, Node.js, Web)
New features
InsertParams.values
is an empty array, no request is sent to the server andClickHouseClient.insert
short-circuits itself. In this scenario, the newly addedInsertResult.executed
flag will befalse
, andInsertResult.query_id
will be an empty string.Bug fixes
Code: 354. inflate failed: buffer error
exception if request compression is enabled andInsertParams.values
is an empty array (see above).0.2.9 (Common, Node.js, Web)
New features
0.2.8 (Common, Node.js, Web)
New features
Keep-Alive setting is now enabled by default for the Web version.
See also the new examples:
ephemeral columns
(#217)
0.2.7 (Common, Node.js, Web)
New features
X-ClickHouse-Summary
response header is now parsed when working withinsert
/exec
/command
methods.See the related test for more details.
NB: it is guaranteed to be correct only for non-streaming scenarios.
Web version does not currently support this due to CORS limitations. (#210)
Bug fixes
async_insert
, especially in the Cloudflare Workers context.0.2.6 (Common, Node.js)
New features
See the new examples:
insert from a file,
select into a file.
0.2.5 (Common, Node.js, Web)
Bug fixes
pathname
segment fromhost
client configuration parameter is now handled properly when making requests.See this comment for more details.
0.2.4 (Node.js only)
No changes in web/common modules.
Bug fixes
0.2.3 (Node.js only)
No changes in web/common modules.
Bug fixes
insert
with akeep_alive
option enabled, which led to performance limitations. See #202 for more details. (@varrocs)0.2.2 (Common, Node.js & Web)
New features
default_format
setting, which allows to performexec
calls withoutFORMAT
clause.0.2.1 (Common, Node.js & Web)
Breaking changes
Date objects in query parameters are now serialized as time-zone-agnostic Unix timestamps (NNNNNNNNNN[.NNN], optionally with millisecond-precision) instead of datetime strings without time zones (YYYY-MM-DD HH:MM:SS[.MMM]). This means the server will receive the same absolute timestamp the client sent even if the client's time zone and the database server's time zone differ. Previously, if the server used one time zone and the client used another, Date objects would be encoded in the client's time zone and decoded in the server's time zone and create a mismatch.
For instance, if the server used UTC (GMT) and the client used PST (GMT-8), a Date object for "2023-01-01 13:00:00 PST" would be encoded as "2023-01-01 13:00:00.000" and decoded as "2023-01-01 13:00:00 UTC" (which is 2023-01-01 05:00:00 PST). Now, "2023-01-01 13:00:00 PST" is encoded as "1672606800000" and decoded as "2023-01-01 21:00:00 UTC", the same time the client sent.
0.2.0 (web platform support)
Introduces web client (using native fetch
and WebStream APIs)
without Node.js modules in the common interfaces. No polyfills are required.
Web client is confirmed to work with Chrome/Firefox/CloudFlare workers.
It is now possible to implement new custom connections on top of
@clickhouse/client-common
.The client was refactored into three packages:
@clickhouse/client-common
: all possible platform-independent code, types and interfaces@clickhouse/client-web
: new web (or non-Node.js env) connection, uses native fetch.@clickhouse/client
: Node.js connection as it was before.Node.js client breaking changes
ping
method behavior: it will not throw now.Instead, either
{ success: true }
or{ success: false, error: Error }
is returned.CLICKHOUSE_LOG_LEVEL
environment variable.Default is
OFF
.query
return type signature changed to isBaseResultSet<Stream.Readable>
(no functional changes)exec
return type signature changed toExecResult<Stream.Readable>
(no functional changes)insert<T>
params argument type changed toInsertParams<Stream, T>
(no functional changes)schema
module is removedWeb client known limitations
0.1.1
New features
and retry is enabled in the configuration, both socket and request will be immediately destroyed (before sending the data),
and the client will recreate the request. See
ClickHouseClientConfigOptions.keep_alive
for more details. Disabled by default.TRACE
log level.Examples
Disable Keep-Alive feature
Retry on expired socket
0.1.0
Breaking changes
connect_timeout
client setting is removed, as it was unused in the code.New features
command
method is introduced as an alternative toexec
.command
does not expect user to consume the response stream, and it is destroyed immediately.Essentially, this is a shortcut to
exec
that destroys the stream under the hood.Consider using
command
instead ofexec
for DDLs and other custom commands which do not provide any valuable output.Example:
Bug fixes
insert
that happened due to unclosed stream instance when using low number ofmax_open_connections
. See #161 for more details.0.0.16
As HTTP interface expects
\N
instead of'NULL'
string, it is now correctly handled for bothnull
and explicitly
undefined
parameters. See the test scenarios for more details.0.0.15
Bug fixes
0.0.14
New features
JSONStrings
,JSONCompact
,JSONCompactStrings
,JSONColumnsWithMetadata
formats (@andrewzolotukhin).0.0.13
New features
query_id
can be now overridden for all main client's methods:query
,exec
,insert
.0.0.12
New features
ResultSet.query_id
contains a unique query identifier that might be useful for retrieving query metrics fromsystem.query_log
User-Agent
HTTP header is set according to the language client spec.For example, for client version 0.0.12 and Node.js runtime v19.0.4 on Linux platform, it will be
clickhouse-js/0.0.12 (lv:nodejs/19.0.4; os:linux)
.If
ClickHouseClientConfigOptions.application
is set, it will be prepended to the generatedUser-Agent
.Breaking changes
client.insert
now returns{ query_id: string }
instead ofvoid
client.exec
now returns{ stream: Stream.Readable, query_id: string }
instead of justStream.Readable
0.0.11, 2022-12-08
Breaking changes
log.enabled
flag was removed from the client configuration.CLICKHOUSE_LOG_LEVEL
environment variable instead. Possible values:OFF
,TRACE
,DEBUG
,INFO
,WARN
,ERROR
.Currently, there are only debug messages, but we will log more in the future.
For more details, see PR #110
0.0.10, 2022-11-14
New features
#123
0.0.9, 2022-10-25
New features
#121
0.0.8, 2022-10-18
New features
#52
0.0.7, 2022-10-18
Bug fixes
#116
0.0.6, 2022-10-07
New features
#113
0.0.5, 2022-10-04
Breaking changes
ResultSet.stream()
yieldsRow[]
instead of a singleRow
.Please check out an example
and this PR for more details.
These changes allowed us to significantly reduce overhead on select result set streaming.
New features
Configuration
📅 Schedule: Branch creation - "before 4am on Monday" (UTC), Automerge - "before 4am on Monday" (UTC).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.