Skip to content

Releases: DoneDeal0/superdiff

v3.1.2

03 Nov 20:39
d21a35f
Compare
Choose a tag to compare

DOCUMENTATION

Add the link to the documentation website: https://superdiff.gitbook.io/donedeal0-superdiff (#33 )

Capture d’écran 2024-11-03 à 21 46 15

v3.1.1

02 Nov 20:37
e77b875
Compare
Choose a tag to compare

Bug Fix

  • Fix the subpath exports that broke the library import. (#32)

ℹ️ Please refer to the latest release note for information on the new features.

v3.1.0

02 Nov 17:06
40094fc
Compare
Choose a tag to compare

FEATURE

  • Add a useWorker option to streamListDiff. If set to true, the diff will be run in a worker for maximum performance. Only recommended for large lists (e.g. +100,000 items). true by default.
const diff = streamListDiff(hugeListA, hugeListB, "id", { chunksSize: 100_000,  useWorker: true });

pull request #31

BREAKING CHANGES

  • Enums standardization
    • OBJECT_STATUS becomes ObjectStatus
    • LIST_STATUS becomes ListStatus
    • GRANULARITY becomes Granularity

CHORE

  • Add a showWarnings option to streamListDiff
  • Allow enum and unions for ListStatus
  • Clean models
  • Fix client and server import subpaths
  • Convert Jest config to Typescript
  • Update dev dependencies
  • Update README.md

v3.0.0

25 Oct 15:35
4d22c68
Compare
Choose a tag to compare

New Feature

  • streamListDiff now supports array, stream, and file inputs for maximum performance, polyvalence, and optimal memory usage. 🎸🦅 (#28).

Import

// If you are in a server environment
import { streamListDiff } from "@donedeal0/superdiff/server";
// If you are in a browser environment
import { streamListDiff } from "@donedeal0/superdiff/client";

Input

You can send streams, file paths, or arrays as input:

If you are in a server environment

    // for a simple array
    const stream = [{ id: 1, name: "hello" }]
    // for a large array 
    const stream = Readable.from(list, { objectMode: true });
    // for a local file
    const stream = path.resolve(__dirname, "./list.json");
   

If you are in a browser environment

    // for a simple array 
    const stream = [{ id: 1, name: "hello" }]
    // for a large array 
    const stream = new ReadableStream({
      start(controller) {
        list.forEach((value) => controller.enqueue(value));
        controller.close();
      },
    }); 
    // for a local file
    const stream = new File([JSON.stringify(file)], "file.json", { type: "application/json" }); 
    // for a file input
    const stream = e.target.files[0]; 

See the documentation for more details.

Improvement

  • Improve the execution time of getObjectDiff⚡️(#30).
  • Rewrite the getObjectDiff code which is now cleaner and more elegant.

Chores

  • Update the documentation.
  • Create two subbuilds: client and server to expose an appropriate version of streamListDiff.

BREAKING CHANGE

  • streamListDiff is no longer imported from the index, but from @donedeal0/superdiff/server or @donedeal0/superdiff/client.

v2.1.0

07 Oct 19:05
Compare
Choose a tag to compare

2.1.0

New Feature

  • Add a new function streamListDiff to stream the diff of two object lists. It is ideal for large lists and maximum performance 🔥 (#26).

Basic usage (see the documentation for more details)

import { streamListDiff } from "@donedeal0/superdiff";

const diff = streamListDiff([], [], "id")

diff.on("data", (chunk) => { console.log(chunk) )}
diff.on("finish", () => console.log("The full diff is available"))
diff.on("error", (err) => console.log(err))

Improvement

  • Improve the execution time of getListDiff by 55.6% ⚡️(#27).

Chores

  • Use SWC to speed up the tests.
  • Add aliases (@models, @lib).
  • Clean devDependencies.
  • Restructure the codebase.
  • Update the documentation.

v2.0.0

29 Sep 12:09
c6a186e
Compare
Choose a tag to compare

2.0.0 (2024-09-29)

Features

Chore

  • pre-commit script
  • better linter
  • improved CI, automated CD

BREAKING CHANGES

  • subPropertiesDiff has been removed from the getObjectDiff output. There is now a single recursive diff key for more simplicity. The types have also been improved.

1.1.3

16 Jul 18:55
Compare
Choose a tag to compare
  • Add the option ignoreArrayOrder to getListDiff (#23)

v1.1.2

27 Jun 11:55
88a11d3
Compare
Choose a tag to compare
  • Fix bug when comparing an array to a non-array value (#18)
  • Export types (#19)

Thanks to @mfactorial

v1.1.1

21 Jan 10:55
Compare
Choose a tag to compare
  • add referenceProperty in the options parameter of getListDiff. referenceProperty will consider an object to be updated instead of added or deleted if one of its properties remains stable, such as its id. This option has no effect on other datatypes. (feature requested in #14)
getListDiff(listA, listB, { referenceProperty: "id" })
  • update dev dependencies
  • add generic types for getListDiff
  • add typescript documentation to functions
  • correct README.md grammar and update the documentation

v1.0.9

11 Feb 13:37
Compare
Choose a tag to compare

v1.0.9

  • Add the option showOnly to filter getObjectDiff output by status:
{
  ignoreArrayOrder?: boolean // false by default,
  showOnly?: {
    statuses: ("added" | "deleted" | "updated" | "equal")[], // [] by default
    granularity?: "basic" | "deep" // "basic" by default
  }
}
  • ignoreArrayOrder: if set to true, ["hello", "world"] and ["world", "hello"] will be considered as equal, because the two arrays have the same value, just not in the same order.

  • showOnly: only returns the values whose status interest you. It has two parameters:

    • statuses: status you want to see in the output (ex: ["added", "equal"])
      • granularity:
        • basic only returns the main properties whose status match your request.
        • deep can return main properties if some of their subproperties' status match your request. The subproperties will be filtered accordingly.
  • Add the option showOnly to filter getListDiff output by status:

{
  showOnly?: ("added" | "deleted" | "moved" | "updated" | "equal")[], // [] by default
}
  • showOnly gives you the option to only return the values whose status interest you (ex: ["added", "equal"]).

  • Upgrade dev dependencies

  • Add more tests

Breaking changes

  • in getObjectDiff output, subPropertiesDiff.name is now renamed subPropertiesDiff.property.
  • The option discardArrayOrder is now renamed ignoreArrayOrder