Skip to content

Releases: juanluispaz/ts-sql-query

1.8.0

25 Jul 23:27
Compare
Choose a tag to compare

Documentation changes:

  • Make more clear and visible the warning about sharing the connection between HTTP requests.

Bug fixes:

  • Fix invalid query when an insert or update contains additional properties not precent in the table (that must be ignored)

1.7.0

22 Jul 22:51
Compare
Choose a tag to compare

Changes:

  • Implement isTransactionActive method at the connection object that allows to know if there is an active open transaction in ts-sql-query
  • Allows to use objects with the values in an insert or update that contains additional properties not precent in the table that will be ignored. This change makes the behaviour coherent with TypeScript compiler.

Bug fixes:

  • Fix transaction management when a ts-sql-connection connection from a pool is reused, started a transaction, but no query is executed.
  • Fix select result on non-strict mode, making the best approximation to have an usable result (but loosing the optional property information)

1.6.0

11 Jun 22:35
Compare
Choose a tag to compare

Changes:

  • Allows to use complex names in different places like the column alias (name of the property in the result object of a select)
  • Allow a dynamic select picking the columns
  • Handle splitting with select picking columns
  • The split method automatically determines if the created property is required or optional
  • Added splitRequired splitting method
  • Add support to optional joins in a select picking columns
  • Add support to table "from" customization, allowing to include raw sql to use features not supported yet by ts-sql-query
  • Add support to select query customizations
  • Add support to update query customizations
  • Add support to delete query customizations
  • Add support to insert query customizations

Documentation changes:

  • Document about how to deal with splitting result and dynamic queries
  • Add column types section in the documentation

Bug fixes:

  • Ensure insert multiple can generate the with clause
  • Add support to with clause on insert queries on databases that doesn't support a global with on insert (oracle, mysql, mariadb)
  • Fix invalid insert default values query on oracle

1.5.0

03 Jun 18:52
Compare
Choose a tag to compare

Changes:

  • Add support to custom array types
  • Add support to globally encrypted id
  • Big refactor to simplify the query runners implementation
  • Dropped support to very old better-sqlite3 versions (6 or before)
  • Allow to use returning clause on sqlite and mariadb in a sql text query executed directly with the query runner

Documentation changes:

  • Implements new documentation website using mkdocs and readthedocs.io, available at: https://ts-sql-query.readthedocs.io/
  • Add transaction documentation
  • Document security constraint regarding update and delete with no where
  • Add select with left join example to the documentation

Distribution changes:

  • Source maps are not included any more

Bug fixes:

  • Fix insert from select returning last inserted id
  • Fix invalid in queries when the in function didn't receives an array of values

1.4.0

23 May 13:09
Compare
Choose a tag to compare

Changes:

  • Add support to create dynamic conditions where the criteria is defined at runtime. This allows to have a select with a where provided by an external system.
  • Implements compound operator (union, intersect, except) on select expressions.
  • Allows executeSelectPage on select with group by
  • Allows insert from select returning last inserted id in PostgreSql and Sql Server
  • Extends the possibility of a select query to change the shape of the projected object allowing move some property to an internal object (split) or combine the result with a second query string the value as a property of the first one (compose)
  • Add support to recursive select queries

Bug fixes:

  • Fix startsWith and endsWith misspelling

1.3.0

09 May 09:36
Compare
Choose a tag to compare

Changes:

  • Add the transaction method to the connection to make easier deal with transactions at high level
  • Add Prisma support

1.2.0

03 May 18:01
Compare
Choose a tag to compare

Changes:

  • Implements LoggingQueryRunner

Documentation changes:

  • README improvements
  • Include optionalConst connection method in the documentation

1.1.0

09 Mar 19:06
Compare
Choose a tag to compare

Changes:

  • Implements SQL with clause that allows using a select as a view in another select query.
  • Rework insensitive comparison to allow use collations instead of the lower function; allowing in that way make comparison case insensitive and accent insensitive.
  • Implements insensitive order by extension.
  • Rework boolean management to support databases that don't have boolean data type (Sql Server and Oracle).
  • Add support to custom boolean columns.
  • Add support to execute better-sqlite3 queries synchronously.
  • Add support to computed columns on tables.
  • Add ID encrypter utility.

Documentation changes:

  • Add documentation about how encrypt the IDs.
  • Add warning to the readme about sharing the connection between HTTP requests.
  • Add warning about non-public files.
  • Add waring about table and views constructor arguments

New examples:

  • Add Sqlite example using better-sqlite3 for the connection and synchronous queries.
  • Add PostgreSql example using pg for the connection and encrypted primary/foreign keys.

Bug fixes:

  • Fix mismatching column name when an uppercase character is used as column's alias on PostgreSQL. PostgreSQL lowercase the column's alias when it is not escaped; in consequence, an error was thrown because the column was not found.
  • Fix some 'not' ignored during text comparison: notContainsInsensitive (on MySQL, MariaDB, Oracle, PostgreSQL, Sqlite, SqlServer), notEndWith (on Oracle, Sqlite, SqlServer)
  • Fix some posible invalid order by in MySql, MariaDB, SqlServer and Sqlite.
  • Fix invalid queries involving boolean operations in Sql Server and Oracle.
  • Fix missing bigint cast for a value coming from the database when it is a number.

1.0.0

30 Jan 12:53
Compare
Choose a tag to compare

First stable release!

See 1.0.0-beta.1 release notes

Bug fixes:

  • setIfValue, setIfSetIfValue, setIfNotSetIfValue when insert or update now have the same behaviour that any *IfValue function, respecting the configuration about treating an empty string as null value

1.0.0-beta.1

29 Dec 19:07
Compare
Choose a tag to compare
1.0.0-beta.1 Pre-release
Pre-release

Changes:

  • Implements reusable fragments as functions using the buildFragmentWithArgs function with the arg and valueArg functions (all defined in the connection)
  • Implements reusable fragments as functions that allow creating *IfValue functions using the buildFragmentWithArgsIfValue function with the arg and valueArg functions (all defined in the connection)
  • Add support to the newest Better Sqlite 3 returning bingint
  • Update all dependencies, and apply all required changes
  • Implements the method execute in the query runners to allows have direct access to the database using the raw objects used to establish the connection
  • Refactor how const values are handled. Now value source included two new methods:
    • isConstValue(): boolean that allows verify if it contains a const value
    • getConstValue(): TYPE that allows getting the value of a const value source (throw an error if it is not a const value source)
  • Update the readme to include explanations about dynamic queries
  • Add support to bigint column type
  • Add examples section to the readme

Braking changes:

  • Don't inline true or false values when they are defined with the const function. If you want a true or false value inlined use the true() and false() methods defined in the connection
  • Rename QueryRunner.getNativeConnection as getNativeRunner to avoid confusion because this method doesn't return the connection in all the implementation (could be the pool)
  • Big refactor to reduce the pressure on TypeScript type validations. Breaking changes:
    • Connections classes now only receive one generic argument with a unique name.
      Before: DBConection extends PostgreSqlConnection<DBConection, 'DBConnection'> { }
      After: DBConection extends PostgreSqlConnection<'DBConnection'> { }
    • Tables and views now receive a second generic argument with a unique name.
      Before: class TCompany extends Table<DBConection> { ... }
      After: class TCompany extends Table<DBConection, 'TCompany'> { ... }
      Before: class VCustomerAndCompany extends View<DBConection> { ... }
      After: class VCustomerAndCompany extends View<DBConection, 'VCustomerAndCompany'> { ... }
  • The value argument and the return type in the type adapters (including the default implementation in the connection) have now type unknown
  • Trak if a value source is optional and validates if the result of executing a query return a value when it is expected. Braking changes:
    • A const with an optional value must be created using the new optionalConst function in the connection, previously was used the const function in the connection
    • Theis function that allows comparing two values now returns a not optional boolean, previously it returned an optional value
  • Dropped the method NumberValueSource.asStringNumber, use instead the new methods:
    • NumberValueSource.asInt(): number
    • NumberValueSource.asDouble(): number
    • NumberValueSource.asStringInt(): number|string
    • NumberValueSource.asStringDouble(): number|string
    • StringNumberValueSource.asStringInt(): number|string
    • StringNumberValueSource.asStringDouble(): number|string

Internal changes:

  • Big refactor without change the public interface:
    • Use symbols for type marks instead of protected fields
    • Use interfaces instead of abstract classes (allowed by the previous change)
    • Use import type when it is possible
    • Join all databases files in one file
    • Drop alternative implementations code not in use

Bug fixes:

  • Fix invalid query when no value is provided to the function concatIfValue
  • Fix invalid usage of *IfValue functions result, now typescript report an error when it happens
  • Handle when the update has nothing to set, in that case, no update will be performed, and it returns 0 rows updated