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

BSON exported #3363

Merged
merged 10 commits into from
Jan 11, 2021
Merged

BSON exported #3363

merged 10 commits into from
Jan 11, 2021

Conversation

kraenhansen
Copy link
Member

@kraenhansen kraenhansen commented Oct 27, 2020

What, How & Why?

This closes #3242 by exporting the BSON types from both Realm JS and Realm Web.

This is what the JSDocs look like:

Screenshot 2020-10-27 at 13 34 11

☑️ ToDos

  • 📝 Changelog entry
  • 📝 Compatibility label is updated or copied from previous entry
  • 🚦 Tests
  • 📝 Public documentation PR created or is not necessary
  • 💥 Breaking label has been applied or is not necessary

If this PR adds or changes public API's:

  • typescript definitions file is updated
  • jsdoc files updated
  • Chrome debug API is updated if API is available on React Native

@kraenhansen kraenhansen requested a review from kneth October 27, 2020 12:11
@kraenhansen kraenhansen self-assigned this Oct 27, 2020
@kraenhansen kraenhansen changed the base branch from master to v10 October 27, 2020 12:35
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2020 Realm Inc.
// Copyright 2016 Realm Inc.
Copy link
Member Author

Choose a reason for hiding this comment

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

Hah! What a weird change. I didn't move this file 😆

expect(typeof BSON).equals("object");
});

it("can construct an ObjectId", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to check Decimal128 too?

Copy link
Member Author

Choose a reason for hiding this comment

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

If constructing an ObjectId works, I would expect a failure to construct a Decimal128 to come from a bug in the bson package. In other word, I think its safe to keep it limited to this.

@blagoev blagoev self-requested a review November 5, 2020 17:23
Copy link
Contributor

@blagoev blagoev left a comment

Choose a reason for hiding this comment

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

We are not validating if the BSON type is coming from our dependency or somewhere else. Are we going to do that or we are going to allow external BSON type usage. So two ways to handle these:

  1. We allow the usage of external BSON types and its responsibility of the developer to handle any incompatibilities
  2. We validate the BSON type is explicitly our own dependency and throw errors if it is not.

Currently we have these checks which will be valid regardless of where the BSON type is coming from.
https://github.com/realm/realm-js/blob/v10/src/node/node_value.hpp#L101-L123

@kraenhansen kraenhansen changed the base branch from v10 to master January 8, 2021 14:08
@kraenhansen
Copy link
Member Author

I've rebased this on the current master and testet it locally in Chrome debugging mode ✅

The project uses the esModuleInterop option
The project uses the esModuleInterop option
@kraenhansen kraenhansen merged commit 724388b into master Jan 11, 2021
@kraenhansen kraenhansen deleted the kh/bson-exported branch January 11, 2021 12:35
@cristianoccazinsp
Copy link

Started to get BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values. from either this or similar update.

Any thoughts? We send warnings to our reporting tool so this is causing some really bad noise right now.

#3714

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Realm Web: Export BSON types from the package
4 participants