Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!(NODE-4862): add BSONType enum and remove internal constants from export #532

Merged
merged 4 commits into from
Dec 8, 2022

Conversation

nbbeeken
Copy link
Contributor

@nbbeeken nbbeeken commented Dec 2, 2022

Description

What is changing?

  • removes internal constants from export,
  • Adds the BSONType enum from the driver

What is the motivation for this change?

The exports are a blocker for #524 passing typescript tests

The enum is a nice to have, it provides the same information that constants did but in a consistent way the driver already does, locating the enum here puts it closer to the code that it relates to, its not used by the BSON library but if someone needs type indicators this is a consistent way to make it available.

Double check the following

  • Ran npm run lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: <type>(NODE-xxxx)<!>: <description>
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

});
});

describe('BSONType enum', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests above are old, no change except for the import
Tests here are new for the enum

} as const);

/** @public */
export type BSONType = typeof BSONType[keyof typeof BSONType];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the enum pattern here, it makes BSONType the annotation equal to a union of the values.
BSONType the runtime value is an object with properties.

@durran durran added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Dec 6, 2022
Copy link
Member

@durran durran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we planning on removing the export in https://github.com/mongodb/node-mongodb-native/blob/main/src/mongo_types.ts to just re-export BSONType from here as part of NODE-4701?

durran
durran previously approved these changes Dec 6, 2022
@nbbeeken
Copy link
Contributor Author

nbbeeken commented Dec 6, 2022

I expect we'll change to a re-export in this ticket: https://jira.mongodb.org/browse/NODE-4867

@nbbeeken nbbeeken requested a review from durran December 6, 2022 17:54
@durran durran added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Dec 7, 2022
@durran durran merged commit 196f9f8 into main Dec 8, 2022
@durran durran deleted the NODE-4862-rm-constants branch December 8, 2022 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants