ts-postgres
Advanced tools
Changelog
v2.0.4 (2024-06-19)
Added "end" event which was removed in v1.8.0.
The end
method now correctly throws an error if a network error
occurred during the resulting protocol traffic.
Changelog
v2.0.3 (2024-06-15)
Fix issue where larger results would sometimes have duplicates (#122).
Fixed an issue where the result row array type would use the record generic
as the value type instead of any
which was incorrect.
The DatabaseError
, ErrorLevel
, and TransactionStatus
symbols
are no longer exported using type
(which was incorrect given that you want
to be able to use instanceof
and extract information).
Changelog
v2.0.2 (2024-04-12)
ssl
configuration option was not
correctly processed for the prefer and require settings.Changelog
v2.0.1 (2024-03-10)
Type declarations are now optimized and rolled up into a single file.
The PostgreSQL error code table has been removed. Consult the documentation to map error codes to the string identifiers used in the PostgreSQL codebase.
Parse additional fields into DatabaseError
and ClientNotice
. Note that a
detail
field has been added (previously it was added to the message) as
part of this change.
Changelog
v2.0.0 (2024-02-29)
The connect
function is now used to create a client, already
connected when the promise returns. The Client
symbol is now a
type instead of a value.
Add [Symbol.asyncDispose]
method to support Explicit Resource
Management. This
works on the client object as well as prepared statements.
Add off
method to disable event listening.
Remove dependency on
ts-typed-events,
which has been supplanted by updated typings for the built-in
EventEmitter
class that's now generic.
Changelog
v1.9.0 (2024-01-23)
Add support for ESM modules.
The database host, port and connection timeout options can now be
specified directly for connect
(taking priority over the
provided configuration).
Fix issue handling connection error during secure startup.
Changelog
v1.8.0 (2023-12-14)
Reduce buffer allocation and intelligently scale initial allocation when creating a new buffer.
Both the Query
object and client configuration now provide an optional bigints
setting which decides whether to use bigints or the number type for the INT8
data type. The setting is enabled by default.
Add support for the INT2 and INT8 array types.
The Connect
and End
events have been removed, in addition to the Parameter
event; the connect
method now returns an object with information about the
established connection, namely whether the connection is encrypted and the
connection parameters sent by the server.
Fixed a regression where some symbols were not correctly exposed for importing.
Changelog
v1.7.0 (2023-12-13)
The execute
method has been removed.
The querying options now include an optional transform
property which must be
a function which takes a column name input, allowing the transformation of column
names into for example camel-case.
The query
method now accepts a Query
object as the first argument in
addition to a string argument, but no longer accepts any additional arguments
after values
. The query options must now be provided using the query argument
instead.
The same change has been made to prepare
.
Changelog
v1.6.0 (2023-12-13)
The iterator methods now return reified representations of the query result (i.e. objects), carrying the generic type parameter specified for the query (#83).
The result rows now extend the array type, providing get
and reify
methods.
This separates the query results interface into an iterator interface (providing
objects) and a result interface (providing rows and column names).
Changelog
v1.5.0 (2023-12-06)
The Value
type has been replaced with any
, motivated by the new
generic result type as well as the possibility to implement custom
value readers which could return objects of any type.
Query results are now generic with typing support for the get
method on each row.
In addition, a new reify
method now produces records which conform
to the specified type. This method is available on all of the result
objects.
Use lookup table to optimize get
method.
The connect
method now returns a boolean status of whether the
connection is encrypted.
The "verify-ca" SSL mode has been removed, favoring "require"; in addition, both
"prefer" and "require" imply certificate verification. To use a self-signed
certificate, use for example the NODE_EXTRA_CA_CERTS
environment variable
to provide the public key to the runtime as a trusted certificate.
Database name now implicitly defaults to the user name.
Add additional client connection configuration options.
Result rows are now themselves iterable.
Use bigint
everywhere as a type instead of BigInt
.