@svta/cml-structured-field-values changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased
Fixed
- The published package includes
NOTICE.md.
1.1.8 - 2026-11-16
Changed
parseByteSequencethrows a parse error instead of aTypeErrorwhen the byte sequence contains a line break. Every other input reports the same error as before.- The README now has a When to use section. The section names the tasks that the package covers and the entry point of each task.
- The README and the
homepagefield ofpackage.jsonnow link to the package page on the website, cml.svta.org/packages/structured-field-values.
Fixed
- The encoders now round every Decimal tie to the even digit, as RFC 9651 section 4.1.5 requires.
encodeSfItem(2.0005)returns2.0instead of2.001. The fix is inroundToEvenof@svta/cml-utils, so install@svta/cml-utils1.7.1 or later (#665) - The decoders now throw a parse error for a Date outside the range of a JS
Date.decodeSfItem('@999999999999999')throws instead of returning an item with an Invalid Date. A JSDateholds at most 8,640,000,000,000 seconds before or after 1970-01-01. - The encoders now throw a serialize error for an Invalid Date.
encodeSfItem(new Date(NaN))throws instead of returning@NaN.
1.1.7 - 2026-10-18
Changed
- Update
@svta/cml-utilsto 1.6.2 - Peer dependency ranges are now caret ranges, for example
^1.6.2instead of1.6.2. A later patch or minor release of a peer no longer requires a new release of this package.
1.1.6 - 2026-09-15
Changed
- TSDoc: the comment prose is rewritten for readers who do not read English as a first language. Signatures, examples, tags, and links are unchanged. The
encodeSfDictandencodeSfListsummaries now say that the output is a string. They named a dictionary as the output. - README: the usage example prints its result instead of calling an undefined
assert. parseIntegerOrDecimalcreates itsErroronly when parsing fails. Before this change, every call created anErrorand captured a stack trace, also when parsing succeeded. Every Integer and Decimal in a parsed field passes through this function. Error messages do not change.- The encoder allocates less and runs faster.
encodeSfDict,encodeSfList, andencodeSfItemno longer wrap bare values inSfItemobjects, and the dictionary and parameter serializers no longer copy their entries throughObject.entries,Array.from, andmap.serializeStringreturns a string that needs no escape after one regex test.serializeKeychecks the character codes in a loop. For a 17-key CMCD request dictionary, one encode takes about 40% less time and allocates 2.1 KB instead of 6.5 KB. The output does not change. The error forencodeSfItem([1, 2])now quotes the array as passed,[1,2], instead of the wrapped items. serializeInnerListalso accepts the list and its parameters as two arguments:serializeInnerList([1, 2], { a: 1 }). TheSfInnerListobject form still works.- A benchmark for the encoder:
npm run bench -w libs/structured-field-values. The header ofbench/bench.tsdescribes the options.
Fixed
- Remove the module-scope template literal that built the
Integer or Decimalerror type name. Rolldown-based bundlers such as tsdown kept that statement and two constants in bundles that never used the parser.parseIntegerOrDecimalnow builds the name inside the function. Error messages do not change. serializeDecimalfails on values of1e21and above. Before this change, the magnitude check used the length ofNumber.prototype.toString, which switches to exponent notation at1e21, soserializeDecimal(1e21)returned1e+21.0. RFC 8941 allows at most 12 digits before the decimal point.
1.1.5 - 2026-07-28
Fixed
encodeSfDictandencodeSfListno longer drop the whitespace RFC 8941 emits after each comma when they are given a partial options object.whitespacewas applied via a default parameter, so any options object without that property (for exampleencodeSfDict(data, {})) silently produced compact output; it is now treated astrueunless explicitly set tofalse. Callers that passed an options object withoutwhitespaceand relied on compact output must now passwhitespace: false
1.1.4 - 2026-07-21
Changed
- Update
@svta/cml-utilsto 1.5.1
1.1.3 - 2026-05-13
Changed
- Update
@svta/cml-utilsto 1.5.0
1.1.2 - 2026-02-11
Changed
- Update
@svta/cml-utilsto 1.4.0
1.1.1 - 2026-02-04
Changed
- Update
@svta/cml-utilsto 1.3.0
1.1.0 - 2026-02-03
Added
- Add optional generic type parameters to
SfItemclass for improved type inference
1.0.2 - 2025-12-26
Changed
- Update
@svta/cml-utilsto 1.1.0 (#279)
1.0.1 - 2025-12-22
Fixed
- Use fixed version numbers for all CML peer dependencies (#277)