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-4706): validate Timestamp ctor argument #536

Merged
merged 6 commits into from
Dec 8, 2022

Conversation

nbbeeken
Copy link
Contributor

@nbbeeken nbbeeken commented Dec 6, 2022

Description

What is changing?

Completed in this PR as well:
https://jira.mongodb.org/browse/NODE-4705

  • Updating TS to 4.9 is motivated by getting the type narrowing features of the in operator working
  • That removes the need for isObjectLike, I added tests for isDBRefLike, but the logic has not been changed
  • Validates Timestamp ctor argument. I went with a verbose approach, given this has been a site of errors and confusion it seems worth raising errors for each possible input mistake that we can catch.
  • Adds a type declaration for bigint as an input for Timestamp, this already worked at runtime, NODE-4705 was filed to only to remove support for the two low/hight number inputs, so bigint should keep working.

What is the motivation for this change?

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

tsconfig.json Show resolved Hide resolved
@nbbeeken nbbeeken changed the title feat!(NODE-4706): Validate Timestamp ctor argument feat!(NODE-4706): validate Timestamp ctor argument Dec 6, 2022
@nbbeeken nbbeeken marked this pull request as ready for review December 6, 2022 22:52
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.

Apologies for the nit-picky testing suggestions. Just want to keep to the "tests as documentation" mantra and align with our agreed standards. :)

test/node/timestamp.test.ts Outdated Show resolved Hide resolved
test/node/timestamp.test.ts Outdated Show resolved Hide resolved
test/node/timestamp.test.ts Outdated Show resolved Hide resolved
test/node/timestamp.test.ts Outdated Show resolved Hide resolved
@durran durran added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Dec 7, 2022
@nbbeeken nbbeeken requested a review from durran December 7, 2022 17:47
@nbbeeken
Copy link
Contributor Author

nbbeeken commented Dec 7, 2022

@durran Love the test improvements, I did it locally to make the linter happy with the formatting etc, let me know if I got all the changes in

@durran
Copy link
Member

durran commented Dec 7, 2022

@durran Love the test improvements, I did it locally to make the linter happy with the formatting etc, let me know if I got all the changes in

Looks great. Thanks!

durran
durran previously approved these changes Dec 7, 2022
@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
Copy link
Member

durran commented Dec 8, 2022

@nbbeeken Can we rebase and resolve conflicts? Then I think we're good to merge.

@nbbeeken
Copy link
Contributor Author

nbbeeken commented Dec 8, 2022

@durran Updated!

@durran durran merged commit f90bcc3 into main Dec 8, 2022
@durran durran deleted the NODE-4706-validate-t-i branch December 8, 2022 14:17
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