v1.0.0
The estimator is an object you create and keep: every counting function takes it
first, so one count can be saved, resumed, read at any point, and carried across
several sources.
Breaking
- Requires Node 20 or newer.
estimateDistinct(estimator, source, options).epsilon,delta,
expectedSize,seedandrandombelong tonew CVM()alone; the options of
the counting functions cover only how values reach it.- Sources are split by kind:
estimateDistinctSyncfor an iterable you already
hold,estimateDistinctfor an async iterable or aReadable. Each refuses
the other's sources and names the one to call, and the synchronous one takes no
signal. keyFn's parameter follows the element type of the source, so over anOrder[]
a wrong field is a compile error where it used to beany. TypeScript only:
the runtime is unchanged.DistinctEstimateStreamis replaced bycreateEstimatorSink(estimator, options).
The count is read from the estimator, so the sink has noresult().expectedSizeis required and must be at least 1. A snapshot written by 0.4
without it carries 0 and no longer restores.
Fixed
- An abort lands while the source is waiting, not only between values.
- A signal already aborted before the call rejects with
ABORT_ERRon a
Readablesource too, instead of Node 24'sERR_STREAM_UNABLE_TO_PIPE. createRandomthrows withCVM_INVALID_OPTIONon a bad seed, the one error
that carried no code.
The hand-written types are now typechecked as a consumer compiles them, in CI and
before publishing.