npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@unidotnet/plugin-data-comparison

v1.1.2

Published

comparing Salesforce object data between two authenticated orgs and exporting the results (e.g., record count, total amount, average revenue) into CSV or PDF

Downloads

33

Readme

Data Comparison Plugin

Compare aggregated Salesforce record data across two authenticated orgs without copying full datasets. The compare:data command dynamically builds safe SOQL, executes aggregate queries (COUNT/SUM/AVG/MIN/MAX), optionally samples matching rows, and exports reconciliation reports.

Overview

  • Validate that key business metrics stay in sync between production and sandboxes or between environments.
  • Build aggregate queries on demand by discovering object metadata at runtime.
  • Export results as terminal tables, JSON payloads, CSV files, or lightweight PDFs for auditors.
  • Cache describe metadata locally to reduce repeated API calls.

Installation

Install the plugin into the Salesforce CLI (sf):

sf plugins install @unidotnet/plugin-data-comparison

To upgrade to the latest published version:

sf plugins update @unidotnet/plugin-data-comparison

Verify the installation:

sf plugins | grep data-comparison

Usage

Compare SObject Metrics

Run sf compare:data or sf compare data with the source and target org aliases, the object API name, and any metrics you want to reconcile.

sf compare data \
  --source-org prod \
  --target-org staging \
  --object Opportunity \
  --metrics count --metrics sum:Amount --metrics avg:Amount \
  --where "StageName = 'Closed Won'" \
  --sample-size 5

Key flags:

| Flag | Description | | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | --source-org, --target-org | Aliases/usernames of the baseline and comparison orgs (required). | | --object | API name of the SObject to compare (required). | | --metrics | Metrics to compute (defaults to count). Supported values: count, count-distinct:<field>, sum:<field>, avg:<field>, min:<field>, max:<field>, ratio:<aggregate>:<numerator>/<aggregate>:<denominator> (for example ratio:sum:Amount/avg:Amount), count-if:<condition>, sum-if:<field>:<condition>. | | --where | Optional filter applied to both org queries (omit the WHERE keyword). | | --sample-size | Number of raw rows to fetch for spot checks. Set to 0 to skip. | | --metadata-cache | Minutes to reuse cached describe metadata (default 10, 0 disables caching). | | --format | Output format: table (default), json, csv, or pdf. | | --output-file | Destination path for CSV/PDF exports (required when --format is csv or pdf). | | --report-title | Optional custom title for PDF output. | | --timeout | Query timeout in minutes (defaults to 10). |

Export CSV

sf compare data \
  --source-org prod \
  --target-org staging \
  --object Account \
  --metrics count --metrics sum:AnnualRevenue \
  --format csv \
  --output-file ./reports/account-compare.csv

Export PDF

sf compare data \
  --source-org prod \
  --target-org staging \
  --object Account \
  --metrics count --metrics sum:AnnualRevenue \
  --format pdf \
  --output-file ./reports/account-compare.pdf \
  --report-title "Account Reconciliation"

JSON for Automation

sf compare data \
  --source-org prod \
  --target-org staging \
  --object Account \
  --metrics count --metrics max:LastModifiedDate \
  --format json > comparison.json

See the quickstart for an end-to-end walkthrough, including metadata discovery and caching tips.

Known Limitations

  • Aggregate metrics respect Salesforce rules (for example, SUM ignores null values and currency handling mirrors the org configuration).
  • Sampling is best-effort and limited to records returned by synchronous SOQL; bulk sampling is not yet available.
  • The PDF exporter uses a minimal embedded Helvetica font; advanced formatting and localization are not supported yet.
  • Advanced statistical aggregates such as median, standard deviation, and variance are not yet available in core SOQL. Future releases may integrate CRM Analytics to unlock these metrics.
  • Multi-currency comparisons require metrics to use fields that share the same currency or rely on converted values provided by the org.

License Notices

All direct dependencies are distributed under the Apache-2.0 license. Review individual packages in package.json if your compliance process requires additional disclosure.

Contributing and Support

Please report issues and feature requests at https://github.com/unizhu/plugin-data-comparison/issues. Contribution guidelines and tooling instructions are unchanged from the template; see CODE_OF_CONDUCT.md and the repository wiki for more details.