feat(NODE-7334): remove ByteUtils and NumberUtils from the onDemand ns
#859
+1
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Summary of Changes
This PR moves the
ByteUtilsandNumberUtilsexports from theonDemandnamespace to theBSONnamespace of the package. This allows for direct imports of these utilities.Documentation tags have been updated/maintained to ensure these exports are still explicitly marked as
@experimentalto indicate that their API is subject to change.Notes for Reviewers
Previously, these were accessed via
BSON.onDemand.NumberUtils.getInt32LE. Now, they can be imported directly viaBSON.ByteUtils/NumberUtilsmainly for consistency reasons (the onDemand ns is primarily for parsing functionality).What is the motivation for this change?
The
onDemandnamespace creates unnecessary friction for accessing these useful utility classes. By lifting them to theBSONnamespace, we improve developer experience and discoverability for advanced users who need to manipulate BSON/binary types or specific number formats, while still safeguarding the driver's semantic versioning guarantees by labeling them experimental.Release Highlight
ByteUtilsandNumberUtilsremoved fromonDemandnamespaceThe experimental
ByteUtilsandNumberUtilshelpers have been moved from theonDemandnamespace to the top-level package export.Double check the following
npm run check:lint)type(NODE-xxxx)[!]: descriptionfeat(NODE-1234)!: rewriting everything in coffeescript