-
Notifications
You must be signed in to change notification settings - Fork 932
[FEAT] Restrict Firestore Doc/QuerySnapshot toJSON on client. #9048
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] Restrict Firestore Doc/QuerySnapshot toJSON on client. #9048
Conversation
Can't easily test bundles client side. They can't be generated on the client. I tried pre-generating some but the bundle must align with the Firebase project name, and the Firebase project name varies across test targets (prod, local, etc).
|
Vertex AI Mock Responses Check
|
Size Report 1Affected Products
Test Logs |
Size Analysis Report 1This report is too large (1,806,337 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.Test Logs |
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const result: any = {}; | ||
result['type'] = QuerySnapshot._jsonSchemaVersion; | ||
result['bundleSource'] = 'QuerySnapshot'; | ||
result['bundleName'] = AutoId.newId(); | ||
|
||
const builder: BundleBuilder = new BundleBuilder( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bundle code is now moved into a platform specific file so only for node
environments. The other platforms produce a bundle string that simply reads NOT SUPPORTED
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
38d8bc5
into
ddb-firestore-result-serialization
Discussion
To reduce bundle size on clients, the
toJSON
methods ofDocumentSnapshot
andQuerySnapshot
will not create bundles.Testing
Updated the integration and unit tests to test
fromJSON
functionality in node environments only.I did attempt to create pre-packaged bundles so that we can test in browser still, but unforunately the bundle includes the project name, and the project that we test against varies depending on the profile of tests that were running (prod, local, etc). If these don't match then an error is thrown.
API Changes
N/A