Skip to content

v5.0.0-alpha.4

@ltwlf ltwlf tagged this 04 Apr 06:10
* Add delta workflow helpers and comparison serialization (v5.0.0-alpha.2)

Port workflow helpers from json-delta-py PR #2, adapted to TypeScript
functional style:

- squashDeltas: compact multiple deltas into net-effect delta
- deltaMap / deltaStamp / deltaGroupBy: immutable delta transformations
- operationSpecDict / operationExtensions: spec vs extension key partitioning
- deltaSpecDict / deltaExtensions: same for delta envelopes
- leafProperty: terminal property name from operation path
- comparisonToDict: recursive comparison tree serialization
- comparisonToFlatList: flatten comparison to leaf changes with paths

* Address Copilot review: verifyTarget, undefined guards, IDENT_RE, test name

- Use diffDelta instead of JSON.stringify for target verification
  (handles key ordering differences correctly)
- Guard against undefined children in comparisonToDict and flattenNode
  (enrich() returns undefined for Function values)
- Fix IDENT_RE to match spec's SIMPLE_PROPERTY_RE (no $ in identifiers)
- Rename misleading test name to 'omits absent keys from result'

* Fix SonarCloud reliability issues: wrap .map callback, add localeCompare

* Fix array index preservation and prototype pollution in helpers

- comparisonToDict: preserve array indices with null placeholders instead
  of filtering (which collapsed indices)
- operationExtensions/deltaExtensions/deltaGroupBy: use Object.create(null)
  to prevent prototype pollution from untrusted keys

* Use Object.create(null) for remaining arbitrary-key accumulators

* Use Object.defineProperty for squashDeltas envelope extension merging

* Fix comparisonToDict docstring: plain JS object, not JSON object

* Rename JSON Delta to JSON Atom across the entire codebase

- Rename format from 'json-delta' to 'json-atom' per spec rename
- Rename files: deltaPath→atomPath, jsonDelta→jsonAtom, deltaHelpers→atomHelpers
- Rename all types: IJsonDelta→IJsonAtom, IDeltaOperation→IAtomOperation, etc.
- Rename all functions: diffDelta→diffAtom, applyDelta→applyAtom, etc.
- Update fixtures, tests, README, and CLAUDE.md
- Bump version to 5.0.0-alpha.3
- Spec repo: github.com/ltwlf/json-atom-format
- Python impl: github.com/ltwlf/json-atom-py

* Fix filterExpression to use dot notation for dot-containing keys (#392)

The filterExpression function used invalid bracket notation (@[key.name])
for dot-containing filter keys. This produced invalid JSONPath expressions.
Now always uses standard dot notation (@.key.name), which is correct for
both nested paths and round-trips through unatomizeChangeset.

* Proper JSONPath filter key canonicalization for TS/Python interop (#392)

- filterExpression: use bracket notation @['key'] for non-identifier
  keys (dots, hyphens, leading digits), dot notation @.key for simple
  identifiers. Matches JSON Atom spec Section 5.1.
- unatomizeChangeset: updated regex to parse both @.key and @['key']
  filter notations, extracting the property name correctly.
- atomicPathToAtomPath: canonicalize filter keys (v4 @.c.d → atom
  @['c.d']) so atom paths match the canonical format Python expects.
- atomPathToAtomicPath: convert bracket filter keys back to dot
  notation for v4 internal format compatibility.
- parseFilter: validate dot-notation keys against identifier regex,
  matching Python json-atom-py behavior.
- Remove isTestEnv/isSpecialTestCase hack from atomizeChangeset —
  deterministic path generation regardless of environment.
- Add comprehensive tests for round-trips, bracket notation, and
  cross-format compatibility.

* Fix lint: remove unnecessary escape in regex character class
Assets 2
Loading