Skip to content

Releases: DWTechs/Antity-pgsql.js

support for direct SQL comparators

04 May 19:54

Choose a tag to compare

  • Add support for direct SQL comparators (=, <, >, <=, >=, <>, IS, IS NOT, IN, NOT IN, LIKE, NOT LIKE) as valid matchMode values in Filter
    • mapComparator() now passes through direct comparators without mapping
    • mapIndexes() now wraps indexes in parentheses for IN and NOT IN comparators
    • shouldSkipValue() now allows null values for IS and IS NOT comparators
    • check.matchMode() now accepts direct comparators as valid for all property types

Fix audit column names for consumer nickname

18 Apr 14:55

Choose a tag to compare

  • Fix audit column names for consumer nickname in generated SQL queries:
    • INSERT queries (query.insert(), query.upsert()) now write consumer.nickname into creatorName instead of name
    • UPDATE queries (query.update(), query.archive()) now write consumer.nickname into updaterName instead of name
  • Add double quotes around audit column names creatorId, creatorName, updaterId, updaterName in generated SQL queries to preserve camelCase

Fix audit column names

18 Apr 12:30

Choose a tag to compare

  • Fix audit column names to use camelCase in generated SQL queries:
    • INSERT queries (query.insert(), query.upsert()) now write into creatorId instead of creatorid
    • UPDATE queries (query.update(), query.archive()) now write into updaterId instead of updaterid

Rename audit columns

17 Apr 21:12

Choose a tag to compare

  • Rename audit columns in INSERT and UPDATE queries to match database conventions:
    • INSERT queries (query.insert(), query.upsert()) now write consumer.id into creatorid and consumer.nickname into name instead of "consumerId" / "consumerName"
    • UPDATE queries (query.update(), query.archive()) now write consumer.id into updaterid and consumer.nickname into name instead of "consumerId" / "consumerName"

Single `consumer` object

11 Apr 20:25

Choose a tag to compare

  • Replace separate consumerId / consumerName parameters with a single consumer object ({ id?, nickname? }) across all relevant APIs:
    • query.update(), query.insert(), query.upsert(), query.archive() now accept consumer?: { id?: number | string, nickname?: string } instead of two separate arguments
    • Express middlewares (add, update, upsert, archive, sync) now read res.locals.consumer.id and res.locals.consumer.nickname instead of res.locals.consumerId / res.locals.consumerName

Fix 'in' 'notin'

29 Mar 11:33

Choose a tag to compare

  • Fix notIn match mode not working in filter SQL generation:
  • Add "in" and "notIn" to allowed match modes for numberand string

Fix filters empty values

28 Mar 21:05

Choose a tag to compare

  • Fix filter handling to exclude empty values from WHERE clauses:
    • Filters with empty string values are now skipped
    • Filters with empty arrays are now skipped
    • Filters with null values are skipped except for is and isNot match modes

Sync

28 Mar 17:37

Choose a tag to compare

  • Add bulk sync functionality:
    • New sync() Express middleware atomically synchronises a table with the full provided row list inside a single PostgreSQL transaction (BEGIN / COMMIT / ROLLBACK on failure)
    • Incoming rows without an ID (or with an unknown ID) are inserted; rows with a known ID are updated; existing rows absent from the list are deleted
    • Accepts optional idField in request body (defaults to 'id') to specify the identity column
    • Accepts optional filters in request body to scope the managed set — rows outside the filter are never touched
    • Returns synced rows with generated IDs in res.locals.rows
    • Returns operation summary { inserted, updated, deleted } in res.locals.sync
    • Supports consumerId / consumerName forwarding for history tracking on inserts and updates
  • Add syncArraySubstack getter returning [normalizeArray, validateArray, sync] middleware chain

UPSERT

24 Mar 20:39

Choose a tag to compare

  • Add UPSERT functionality using PostgreSQL's INSERT ... ON CONFLICT ... DO UPDATE syntax:
    • New query.upsert() method generates upsert queries with configurable conflict targets
    • Supports single or multiple column conflict targets (e.g., 'id' or ['email', 'username'])
    • Properties with both INSERT and UPDATE operations are automatically included in upsert
    • Optionally includes consumerId and consumerName for history tracking
    • Supports RETURNING clause to retrieve updated/inserted row IDs
  • Add upsert() Express middleware for handling upsert operations:
    • Expects rows and conflictTarget in request body
    • Returns upserted rows with IDs in res.locals.rows
    • Supports chunking for bulk operations
  • Add convenience Express substack middlewares:
    • upsertArraySubstack: Returns [normalizeArray, validateArray, upsert] middleware chain
    • upsertOneSubstack: Returns [normalizeOne, validateOne, upsert] middleware chain

Add dedicated `Archive` query

19 Mar 19:50

Choose a tag to compare

  • Add dedicated Archive query :
    • Replaces the previous approach of passing archived: true through the generic Update query
    • Generates a simplified UPDATE ... SET archived = true WHERE id IN (...) query directly
    • Optionally appends consumerId and consumerName as single scalar values (not per-row CASE blocks)
  • Add query.archive() method to SQLEntity using the new Archive class
  • Add properties getter to SQLEntity returning the list of Property instances passed at construction