# @wmfs/pg-delta-file

> Outputs change-only-update CSV files (or “delta” files) that contain all the necessary actions required to re-synchronize rows in a cloned table.

Latest version **1.104.1** (published 2026-08-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @wmfs/pg-delta-file
pnpm add @wmfs/pg-delta-file
yarn add @wmfs/pg-delta-file
bun add @wmfs/pg-delta-file
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.104.1 |
| Published | 2026-08-13 |
| First published | 2018-06-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 98.8 KB |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | West Midlands Fire Service |
| Maintainers | wmfsbot |
| Keywords | tymly, package, etl, pg, postgresql |

## Links

- npm: https://www.npmjs.com/package/@wmfs/pg-delta-file
- Repository: https://github.com/wmfs/pg-delta-file
- Homepage: https://github.com/wmfs/pg-delta-file#readme
- Issues: https://github.com/wmfs/pg-delta-file/issues
- npm.io page: https://npm.io/package/@wmfs/pg-delta-file

## Dependencies (5)

- [pg](https://npm.io/package/pg.md) 8.16.3
- [luxon](https://npm.io/package/luxon.md) 3.7.1
- [lodash](https://npm.io/package/lodash.md) 4.17.21
- [make-dir](https://npm.io/package/make-dir.md) 3.1.0
- [pg-query-stream](https://npm.io/package/pg-query-stream.md) 4.10.3

## Alternatives

- [monaco-yaml](https://npm.io/package/monaco-yaml.md) — 420.1K weekly downloads
- [@crewx/workflow](https://npm.io/package/@crewx/workflow.md) — 3.1K weekly downloads
- [yaml-cat](https://npm.io/package/yaml-cat.md) — 38 weekly downloads
- [nunjucks-in-yaml](https://npm.io/package/nunjucks-in-yaml.md) — 9 weekly downloads
- [shopify-symlinks](https://npm.io/package/shopify-symlinks.md) — 3 weekly downloads

## Recent versions

- 1.104.1 (latest) — 2026-08-13
- 1.104.0 — 2025-07-10
- 1.103.0 — 2025-06-30
- 1.102.0 — 2025-06-30
- 1.101.0 — 2025-06-20
- 1.100.0 — 2025-06-20
- 1.99.0 — 2025-05-13
- 1.98.0 — 2025-05-13
- 1.97.0 — 2025-04-28
- 1.96.0 — 2025-04-28
- 1.95.0 — 2025-04-25
- 1.94.0 — 2025-04-25
- 1.93.0 — 2025-04-23
- 1.92.0 — 2025-04-23
- 1.91.0 — 2025-04-01
- … 95 more at https://npm.io/package/@wmfs/pg-delta-file/versions

## README

# pg-delta-file
[![Tymly Package](https://img.shields.io/badge/tymly-package-blue.svg)](https://tymly.io/)
[![npm (scoped)](https://img.shields.io/npm/v/@wmfs/pg-delta-file.svg)](https://www.npmjs.com/package/@wmfs/pg-delta-file)
[![CircleCI](https://circleci.com/gh/wmfs/pg-delta-file.svg?style=svg)](https://circleci.com/gh/wmfs/pg-delta-file)
[![codecov](https://codecov.io/gh/wmfs/pg-delta-file/branch/master/graph/badge.svg)](https://codecov.io/gh/wmfs/pg-delta-file)
[![CodeFactor](https://www.codefactor.io/repository/github/wmfs/pg-delta-file/badge)](https://www.codefactor.io/repository/github/wmfs/pg-delta-file)
[![Dependabot badge](https://img.shields.io/badge/Dependabot-active-brightgreen.svg)](https://dependabot.com/)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/wmfs/tymly/blob/master/packages/pg-concat/LICENSE)




> Outputs change-only-update CSV files (or “delta” files) that contain all the necessary actions required to re-synchronize rows in a cloned table.

## Usage

```
const generateDeltaFile = require('pg-delta-file')

const deltaInfo = await generateDeltaFiles(
  since: '2017-07-16T20:37:26.847Z',
  outputFilepath: '/some/temp/dir/people-delta.csv',
  actionAliases: {
    insert: 'u',
    update: 'u',
    delete: 'd'
  },
  createdColumnName: '_created',
  modifiedColumnName: '_modified',
  transformFunction: (row, callback) => { ... } // optional data transformation
  filterFunction: (row) => { ... } // option filter predicate
  dryrun: true // optional flag, set true to return info without generating output file 
  csvExtracts: {
    '[schema.]people': [
      'PERSON', // Just output a literal
      '$ACTION', // Will output 'u' or 'd'
      '$ROW_NUM', // Row counter
      '@social_security_id', /// Column data
      '@first_name',
      '@last_name',
      '@age'
      '$DATESTAMP',
      '$TIMESTAMP',
      '$DATETIMESTAMP',
    ],
    '[schema2.]address': [
      ...
    ]
  }
)

/*
{
  "totalCount": 5,
  "people": {
    "totalCount": 5
  },
  "address": {
    "totalCount": 3
    "filteredCount": 2
  }
} 
*/
```

## <a name="install"></a>Install
```bash
$ npm install pg-delta-file --save
```

## <a name="license"></a>License
[MIT](https://github.com/wmfs/pg-delta-file/blob/master/LICENSE)

---
_Source: https://npm.io/package/@wmfs/pg-delta-file · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
