Skip to content

Sync

Choose a tag to compare

@LCluber LCluber released this 28 Mar 17:37
· 47 commits to main since this release
  • 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