Skip to content

v5.0.0-alpha.6

@ltwlf ltwlf tagged this 05 Apr 15:37
* Support nested member-access in filter expressions (#392)

Function-based identity keys returning dot-separated paths (e.g.
"positionNumber.value") now produce nested dot-notation in filters:
  @.positionNumber.value=='002'
instead of the previous bracket notation:
  @['positionNumber.value']=='002'

This aligns with RFC 9535 JSONPath which supports nested member-access
in filter expressions. String-based identity keys with dots (literal
property names) still use bracket notation.

Changes:
- Add embeddedKeyIsPath flag to IChange, set when key comes from
  a function resolver
- filterExpression uses dot notation when isPath=true
- parseFilter/buildAtomPath accept nested dot-notation paths
- atomicPathToAtomPath preserves nested paths as dot notation

* Fix bracket-notation round-trip: add literalKey flag to KeyFilterSegment

- Add literalKey to AtomPathSegment for bracket-notation filter keys
- parseFilter sets literalKey=true when parsing @['key']
- buildAtomPath uses bracket notation when literalKey is true
- Validate isPath keys against NESTED_PATH_RE in filterExpression
- Add round-trip test for bracket-notation filter keys with dots

* Support nested property resolution in apply/revert (#392)

- Add resolveProperty helper for dot-separated path traversal
- applyArrayChange/revertArrayChange/indexOfItemInArray use it for
  nested identity key lookup (e.g. embeddedKey="positionNumber.value")
- Fix empty array edge case: use oldObj[0] fallback when newObj is empty
- Add apply + atomize→unatomize→apply round-trip test for nested keys

* Address review: isPath-aware apply/revert, falsy value fix, unatomize flag

- resolveProperty only traverses nested paths when isPath=true
- Thread isPath through removeKey/applyLeafChange/applyArrayChange
- Fix falsy identity values (0, false, '') in indexOfItemInArray
- Set embeddedKeyIsPath in unatomizeChangeset for dot-notation keys
- Add literal dot-key apply round-trip test

* Null guard in resolveProperty, thread isPath through revert path

* Fix escaped quotes in unatomizeChangeset regex, add round-trip tests

The regex now handles doubled-quote escaping (e.g. O''Brien) in both
bracket filter keys and filter values. Extracted values are unescaped.
Round-trip tests verify atomize → unatomize → apply with quoted values.

* Use NESTED_PATH_RE to gate embeddedKeyIsPath, add edge case test

embeddedKeyIsPath now only set when key matches NESTED_PATH_RE (valid
identifier segments separated by dots), not just any string with a dot.
Keys like "a-b.c" correctly fall back to bracket notation.

* Require dot in key for embeddedKeyIsPath, add single-segment key test

embeddedKeyIsPath only set when key contains dots AND matches
NESTED_PATH_RE. Single-segment keys like 'id' correctly don't get
the flag. Test verifies flag is undefined and round-trip works.

* Guard resolveProperty against non-string keys (FunctionKey)
Assets 2
Loading