-
Notifications
You must be signed in to change notification settings - Fork 939
[Feat] Add bundler implementation to Firestore SSR Serialization feature branch #8872
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
Merged
DellaBitta
merged 33 commits into
ddb-firestore-result-serialization
from
ddb-migrate-fs-bundler
Apr 1, 2025
Merged
Changes from 8 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
aee01c3
first attempt
DellaBitta c18ddd5
Build fixes
DellaBitta 9ebb633
Add Firestore instance to constructor
DellaBitta 3c2e837
lint fixes
DellaBitta 71d24b4
first addQuery impl
DellaBitta 5e9ceb8
reduced tools in validation utils.
DellaBitta 5dd5ae4
remove unneeded utils.
DellaBitta 3d45407
Ideas to support converting bundle protos to Proto3 JSON compatible f…
DellaBitta c361963
Format and coalesce utils.
DellaBitta a1e6a0b
Bundle DocumentSnaps with toJSON
DellaBitta 5e3620d
QuerySnapshot toJSON impl, but it has bugs
DellaBitta ffff490
Successfully tested bundling a QuerySnapshot
DellaBitta 3bcf31e
Remove createTime & readTime from DocumentSnapshot
DellaBitta ccd5205
rename documentToDocumentSnapshotBundleData
DellaBitta 03f3ffb
Cleanup pass
DellaBitta 06d84e0
Remove unneeded bundle_builder_validation_utils.ts
DellaBitta 1b53351
clean up addBundleDocument readTime logic.
DellaBitta 5f413b6
removed extra `if(queryName)` in addBundleDocument
DellaBitta e0f3c29
Update fromTimestamp doc.
DellaBitta fbfa24f
toJSON methods warn of pending writes.
DellaBitta 070a84a
throw instead of warn.
DellaBitta 8e0b3bb
format
DellaBitta 65c3d8b
metadata contains hasPendingWrites
DellaBitta 73eb8a2
Unit tests.
DellaBitta 6251a28
Update database.test.ts
DellaBitta 2a3a7df
Add integration test.
DellaBitta f009e35
Merge branch 'main' into ddb-migrate-fs-bundler
DellaBitta afd294a
Docs
DellaBitta 06f71c9
debug logs
DellaBitta 4ec62ae
Guard test against missing path.
DellaBitta 36e4fd5
bundle test
DellaBitta bad6f72
Minify fix.
DellaBitta a5b46b7
lint fixes, console log removal.
DellaBitta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -520,6 +520,13 @@ export class DocumentSnapshot< | |
document.data.value.mapValue.fields, | ||
'previous' | ||
); | ||
if (this.metadata.hasPendingWrites) { | ||
throw new FirestoreError( | ||
Code.FAILED_PRECONDITION, | ||
'DocumentSnapshot.toJSON attempted to serialize a document with pending writes. ' + | ||
'Await `waitForPendingWrites()` before invoking `toJSON()`.' | ||
); | ||
} | ||
builder.addBundleDocument( | ||
documentToDocumentSnapshotBundleData( | ||
this.ref.path, | ||
|
@@ -703,6 +710,13 @@ export class QuerySnapshot< | |
doc._document.data.value.mapValue.fields, | ||
'previous' | ||
); | ||
if (this.metadata.hasPendingWrites) { | ||
throw new FirestoreError( | ||
Code.FAILED_PRECONDITION, | ||
'QuerySnapshot.toJSON attempted to serialize a document with pending writes. ' + | ||
'Await `waitForPendingWrites()` before invoking `toJSON()`.' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
); | ||
} | ||
docBundleDataArray.push( | ||
documentToDocumentSnapshotBundleData( | ||
doc.ref.path, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 0 additions & 60 deletions
60
packages/firestore/src/util/bundle_builder_validation_utils.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
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.
I think it needs to be
'Await
waitForPendingWrites()` before getting documents.'