TypeScript clients for databases that prevent SQL Injection
MIT License
Bot releases are visible (Hide)
Published by ForbesLindesay almost 4 years ago
Published by ForbesLindesay almost 4 years ago
Published by ForbesLindesay almost 4 years ago
Update compile target to node 12.19.0 (#115)
Updated @databases/sql
to 3.0.0
(#114)
This means:
.compile()
or .compileMySQL()
methods.text
or .values
propertiesSQLQuery
is only a type, not a class.If you were previously using instanceof SQLQuery
to check if a value is an SQLQuery
, you can swap to using isSqlQuery
.
If you were relying on the properties or methods to get the actual query text, please open an issue.
Published by ForbesLindesay almost 4 years ago
Update compile target to node 12.19.0 (#115)
Updated @databases/sql
to 3.0.0
(#114)
This means:
.compile()
or .compileMySQL()
methods.text
or .values
propertiesSQLQuery
is only a type, not a class.If you were previously using instanceof SQLQuery
to check if a value is an SQLQuery
, you can swap to using isSqlQuery
.
If you were relying on the properties or methods to get the actual query text, please open an issue.
Published by ForbesLindesay almost 4 years ago
Update compile target to node 12.19.0 (#115)
Removed .compile()
and .compileMySQL()
methods & removed the .text
and .values
properties (#114)
These are replaced by the new .format(...)
method that allows consumers of SQLQuery
s to decide how to format them and how to escape identifiers.
This helps keep the library small and light. It also makes it more flexible to use with different database engines.
Only export the type for SQLQuery
and not the class (#114)
This prevents people accidentally importing & calling the methods on SQLQuery
directly, instead of via sql
. If you were previously using instanceof SQLQuery
to test if a value is an SQLQuery
, use isSqlQuery
We "de-indent" queries automatically (#114)
Instead of attempting to "minify" postgres queries, we now "de-indent" all queries. i.e. we remove excess whitespace from the front of each line by default.
Serializes the native JavaScript bigint
type as a string (#118)
Most databases correctly interpret the string as a BIGINT
Add __dangerous__constructFromParts
method (#116)
This is mainly intended for internal use in utilities like @databases/split-sql-query
Add isSqlQuery
helper (#114)
Add .format(...)
method to SQLQuery
(#114)
Published by ForbesLindesay almost 4 years ago
Published by ForbesLindesay almost 4 years ago
Published by ForbesLindesay almost 4 years ago
You can now provide a defaultConnection when constructing the typed API (#113)
If you provide a default connection, the connection will then be optional within the table API:
import createConnectionPool from '@databases/pg'
import tables from '@databases/pg-typed'
const db = createConnectionPool()
const {users} = tables<Schema>({defaultConnection: db})
// this uses the default connection
await users().selectOne({id: 42})
await db.tx(async tx => {
// this uses `tx` as the connection so it works with transactions
await users(tx).selectOne({id: 42})
})
Published by ForbesLindesay almost 4 years ago
Allow any version of @databases/pg
in peerDependencies
(#112)
This would have caused a warning from yarn when installing @databases/pg-typed
Published by ForbesLindesay almost 4 years ago
Update @databases/pg-data-type-id
to remove "composite" built in types (#112)
These actually represent tables within the pg_catalog
schema, and their IDs tend not to be stable across multiple Postgres versions.
Published by ForbesLindesay almost 4 years ago
Removed prettier
from peerDependencies
(#112)
An earlier version of @databases/pg-migrations
made use of prettier internally, but this version does not.
Published by ForbesLindesay almost 4 years ago
Update @databases/pg-data-type-id
to remove "composite" built in types (#112)
These actually represent tables within the pg_catalog
schema, and their IDs tend not to be stable across multiple Postgres versions.
Published by ForbesLindesay almost 4 years ago
Remove "composite" built in types (#112)
These actually represent tables within the pg_catalog
schema, and their IDs tend not to be stable across multiple Postgres versions.
Published by ForbesLindesay almost 4 years ago
Fix insertOrUpdate
, insertOrIgnore
and update
(#110)
All methods now also have at least one test covering them.
Published by ForbesLindesay almost 4 years ago
Published by ForbesLindesay about 4 years ago
Published by ForbesLindesay about 4 years ago
Define and export new types for Queryable
, Transaction
, Task
and ConnectionPool
(#105)
In the long term, Queryable
should replace Connection
as the go to interface name for an object that lets you query the database. This is because a Connection
can currently be a Transaction
or ConnectionPool
in addition to a regular connection.
Published by ForbesLindesay about 4 years ago
Output now requires TypeScript 3.8 or higher (#108)
This is because we make use of the export type {Name}
syntax required to support isolated modules and incremental build.
type
keyword to exports to support incremental build & isolated modules (#108)Published by ForbesLindesay about 4 years ago
Output now requires TypeScript 3.8 or higher (#108)
This is because we make use of the export type {Name}
syntax required to support isolated modules and incremental build.
type
keyword to exports to support incremental build & isolated modules (#108)Published by ForbesLindesay about 4 years ago