Skip to content

Releases: juanluispaz/ts-sql-query

1.27.0

11 Apr 19:38
Compare
Choose a tag to compare

Re-release 1.27.0 due a mkdocs bug.

1.27.0 changes:

Documentation changes:

  • Add the insert on conflict methods to the supported operation documentation page

Bug fixes:

  • Fix TS4029 error when you need to emit the type definition (for use in a library) of the files that contains the database, tables and views
  • Avoid database connection leaks due a forbidden concurrent usage of a pooled query runner

1.27.0

11 Apr 18:45
Compare
Choose a tag to compare

Documentation changes:

  • Add the insert on conflict methods to the supported operation documentation page

Bug fixes:

  • Fix TS4029 error when you need to emit the type definition (for use in a library) of the files that contains the database, tables and views
  • Avoid database connection leaks due a forbidden concurrent usage of a pooled query runner

1.26.0

20 Mar 20:41
Compare
Choose a tag to compare

Changes:

  • Add support to "insert on conflict do nothing" and "insert on conflict do update" on PostgreSql, Sqlite, MariaDB and MySql
  • Add support to specify raw sql fragment in the order by; allowing complex order by in the select query
  • Allow insert, update and delete in raw sql fragments

Documentation changes:

  • Add a demo video to the documentation

Bug fixes:

  • Fix infinite instantiation in newer versions of TypeScript

1.25.0

09 Jan 18:04
Compare
Choose a tag to compare

Changes:

  • Implements forUseAsInlineAggregatedArrayValue function, that allows to transform a query in create an array value of a single column (if it is single-column query), or an object where the rows are represented as an object
  • Implements aggregateAsArray aggregation function, that allows to create an value that contains, per each row, an array of a single column, or an array with several columns represented as an object
  • Add support to the uuid type
  • Add support to orderByFromStringIfValue, limitIfValue and offsetIfValue
  • Add support to subqueries that contains with clause with external/contextual dependencies
  • Add support to compose over optional properties
  • Add support to withOptionalMany composing rule that allows to use undefined instead of an empty array when no value
  • Detect invalid queries in SqlServer, Oracle and MariaDB when an outer reference is used to create a query that is not supported by the database because no outer references are allowed in inner with, or, in MariaDB, no outer references are allowed in inner from
  • Combine multiple concat expressions in a single concat function call in MySql and MariaDB

Documentation changes:

  • Add a note in the mergeType function documentation warning about the reader evaluate the preferred alternatives first

Bug fixes:

  • Fix invalid query when a table alias is specified in Oracle
  • Fix invalid recursive query in Sql Server
  • Fix invalid recursive query in Oracle
  • Fix invalid query when contains method of a string value source is called in MySql/MariaDB
  • Fix substrToEnd, substringToEnd, substr and substring: now the index is according to JavaScript definition (the count start in 0) and the parameters have the correct type
  • Fix invalid type when a mathematical function is used and the provided value is not the same type that the column

1.24.0

21 Dec 22:50
Compare
Choose a tag to compare

Changes:

  • Manage complex projections in compound operations (union, intercept, etc.)
  • Ensure the dynamic conditions cannot create conditions when null/undefined values are provided to functions that doesn't expect it
  • Detect when null/undefined values are provided to an operation with a value coming from a left join where a not null/undefined value must be provided
  • Deprecate all value source methods overload that can produce unexpected falsy/null values because the provided value in JavaScript is null or undefined. Now all value source methods doesn't admit null or undefined values (except the *IfValue, is, isNot methods). In the odd case you need to use a nullable value from JavaScript, and you want to maintain the falsy/null output use an optional constant with the JavaScript value
  • Add the methods trueWhenNoValue and falseWhenNoValue to allows specify a boolean value when the *IfValue function produces no value. This can help to manage optional values coming from JavaScript in complex logic without need to use the deprecated methods that can produce unexpected falsy/null values
  • Allows to negate the result of a *IfValue function
  • Improve boolean expression reduction when the negate method is used
  • Detect invalid columns to be returned in a select (non-string key)

Preview of upcoming changes:

  • Implements aggregateAsArray aggregation function, that allows to create an value that contains, per each row, an array of a single column, or an array with several columns represented as an object
  • Add support to subqueries that contains with clause with external/contextual dependencies

Documentation changes:

  • Clean up sync helper function to handle synchronous promises in BetterSqlite3 with a stricter typing and better readability

Bug fixes:

  • Ensure any boolean operation apply over a boolean created using dynamicBooleanExpressionUsing is asignable to the initial type
  • Fix invalid result type of calling asOptional or asRequiredInOptionalObject when the type is different to int
  • Fix BetterSqlite3 implementation that returns a real promise instead of a synchronous promise when there is no columns to set

1.23.0

08 Dec 11:18
Compare
Choose a tag to compare

Changes:

  • Add support to complex projections, that allows to create inner objects in the result of a query
  • Detect invalid query when a table in the from of an update appears in the returning clause in sqlite. Now it verify the restriction 7 of the returning clause in Sqlite
  • Add support for Prisma 3
  • Add support for the interactive transactions in Prisma

Documentation changes:

  • Add test strategy information

Bug fixes:

  • Fix MariaDB/MySql stringConcat when an empty separator is used

1.22.0

24 Oct 20:48
Compare
Choose a tag to compare

Changes:

  • Deprecate replace method in favour of replaceAll in the string value source to align with JavaScript
  • Add the substr and substrToEnd to the string value source to align with JavaScript and respect the real available implementation in the databases
  • Add support to create complex dynamic boolean expression using the dynamicBooleanExpresionUsing method in the connection object. It allows to create programmatically dynamically complex boolean expressions instead of declarative dynamically conditions using the IfValue functions. It is recommend to use the IfValue functions when it is possible
  • Add mergeType utility function to deal with advanced dynamic queries when a variable ended with type a union of several types of value source. This function allows to resolve the union type in a single value source type

Documentation changes:

  • Combine all topics related to dynamic queries in a single page to avoid confusion
  • Improve documentation style

Bug fixes:

  • Fix broken substring implementation in the string value source

1.21.0

21 Oct 22:49
Compare
Choose a tag to compare

Changes:

  • Added a new general query runner: InterceptorQueryRunner

Bug fixes:

  • Fix error lost that was throw by a logger in a LogginQueryRunner

1.20.0

13 Oct 23:19
Compare
Choose a tag to compare

Changes:

  • Add support to scalar queries, that is an inline select query as value for another query
  • Add support to insert returning on databases that support it (PostgreSql, SqlServer, Oracle, modern Sqlite)
  • Add support to update returning on databases that support it (PostgreSql, SqlServer, Oracle, modern Sqlite)
  • Add support to update returning old values on databases that support it (SqlServer)
  • Add support to update returning old values on databases where it can be emulated in a single query (PostgreSql)
  • Add support to delete returning on databases that support it (PostgreSql, SqlServer, Oracle, modern Sqlite)
  • Add support to use more tables or views in an update (from clause)
  • Add support to use more tables or views in a delete (using clause)
  • Add support to use more tables or views in an update returning old values on databases that support it (SqlServer)
  • Add support to use more tables or views in an update returning old values on databases where it can be emulated in a single query (PostgreSql)
  • Improve error detection to identify misuse of values that have different columns types with same TypeScript type (like date and time)
  • Improve min and max limit verification on insert

Bug fixes:

  • Fix selectOneColum result type on complex objects (like Date)

1.19.0

07 Oct 21:41
Compare
Choose a tag to compare

Changes:

  • Add support to numeric date/time in Sqlite that is expressed as bigint in JavaScript by the database connector (By example, using defaultSafeIntegers option in BetterSqlite3)

Bug fixes:

  • Fix typo in Sqlite treatUnexpectedStringDateTimeAsUTC connection option (wrongly named: treatUxepectedStringDateTimeAsUTC)
  • Fix typo in Sqlite unexpectedUnixDateTimeAreMilliseconds connection option (wrongly named: uxepectedUnixDateTimeAreMilliseconds)