-
Notifications
You must be signed in to change notification settings - Fork 938
Mila/count #6597
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
Merged
Mila/count #6597
Changes from 6 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
b92e492
Mila/count update proto (#6482)
milaGGL 598e948
compile protos and upload the generated json file (#6491)
milaGGL 7f42490
Mila/count add api interface (#6499)
milaGGL 981e6f1
create sample count test cases (#6506)
milaGGL bc61df7
Mila/count implement count query (#6528)
milaGGL c21304b
add test case for terminated firestore
milaGGL a3242ce
Mila/count add tests (#6566)
milaGGL 6da4f4f
Mila/count export aggregate to api (#6575)
milaGGL fe871ce
change int32 to int64 (#6577)
milaGGL 507e984
check client offline state and test (#6579)
milaGGL 98189d5
Mila/count non lite api tests (#6581)
milaGGL 0ebab69
Mila/count update api surface (#6589)
milaGGL 4b273fe
remove DocumentFieldValue
milaGGL a9de825
Merge branch 'master' into mila/count
milaGGL 576d202
fix lint error: Symbol not found for identifier
milaGGL dd693c6
format to pass lint check
milaGGL 83fbc8d
remove the exports of aggregate query functions/types
milaGGL 26a0bd2
Update aggregation.test.ts
milaGGL 9cced28
skip count query test cases if not using emulator
milaGGL f490bfe
update the type of skipTestUnlessUsingEmulator
milaGGL 078d581
roll back to any type for skipTestUnlessUsingEmulator
milaGGL a9ee57a
move aggregation test file into api_internal folder
milaGGL dbbc2f8
resolve comments
milaGGL c12d5a0
reformat to pass lint check
milaGGL 74116a4
add changeset as requested by github
milaGGL de9dd9a
remove the changeset
milaGGL 9438594
Merge branch 'master' into mila/count
milaGGL 3a6cc27
add the changeset back
milaGGL 0267c69
resolve comments
milaGGL 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@firebase/firestore': minor | ||
--- | ||
|
||
Release count query for internal use. | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,14 +17,17 @@ | |
|
||
import { GetOptions } from '@firebase/firestore-types'; | ||
|
||
import { AggregateField, AggregateQuerySnapshot } from '../api/aggregate'; | ||
import { LoadBundleTask } from '../api/bundle'; | ||
import { | ||
CredentialChangeListener, | ||
CredentialsProvider | ||
} from '../api/credentials'; | ||
import { User } from '../auth/user'; | ||
import { getCount } from '../lite-api/aggregate'; | ||
import { | ||
AggregateField, | ||
AggregateQuerySnapshot, | ||
getCount | ||
} from '../lite-api/aggregate'; | ||
import { Query as LiteQuery } from '../lite-api/reference'; | ||
import { LocalStore } from '../local/local_store'; | ||
import { | ||
|
@@ -513,21 +516,20 @@ export function firestoreClientRunCountQuery( | |
AggregateQuerySnapshot<{ count: AggregateField<number> }> | ||
>(); | ||
client.asyncQueue.enqueueAndForget(async () => { | ||
dconeybe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const remoteStore = await getRemoteStore(client); | ||
if (!canUseNetwork(remoteStore)) { | ||
deferred.reject( | ||
new FirestoreError( | ||
Code.UNAVAILABLE, | ||
'Failed to get count result because the client is offline.' | ||
) | ||
); | ||
} else { | ||
try { | ||
const result = await getCount(query); | ||
deferred.resolve(result); | ||
} catch (e) { | ||
deferred.reject(e as Error); | ||
try { | ||
const remoteStore = await getRemoteStore(client); | ||
if (!canUseNetwork(remoteStore)) { | ||
deferred.reject( | ||
new FirestoreError( | ||
Code.UNAVAILABLE, | ||
'Failed to get count result because the client is offline.' | ||
) | ||
); | ||
} | ||
const result = await getCount(query); | ||
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. Lines 529 and 530 still need to be in an "else" block. |
||
deferred.resolve(result); | ||
} catch (e) { | ||
deferred.reject(e as Error); | ||
} | ||
}); | ||
return deferred.promise; | ||
|
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
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
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
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.
nit: "Release" -> "Implement"