@firebase/firestore 3.5.0-canary.e35db6f95 → 3.5.0-canary.ee871fc0b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/firestore/lite/index.d.ts +2 -0
- package/dist/firestore/src/api/aggregate.d.ts +19 -5
- package/dist/firestore/src/api/database.d.ts +6 -6
- package/dist/firestore/src/api.d.ts +2 -0
- package/dist/firestore/src/core/count_query_runner.d.ts +32 -0
- package/dist/firestore/src/core/firestore_client.d.ts +2 -2
- package/dist/firestore/src/lite-api/aggregate.d.ts +17 -61
- package/dist/firestore/src/lite-api/aggregate_types.d.ts +69 -0
- package/dist/firestore/src/lite-api/database.d.ts +6 -6
- package/dist/firestore/test/integration/api/aggregation.test.d.ts +17 -0
- package/dist/index.d.ts +189 -7
- package/dist/index.esm2017.js +3167 -2981
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3477 -3276
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +3893 -3670
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +3890 -3671
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +3231 -3045
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +103 -7
- package/dist/lite/firestore/lite/index.d.ts +2 -0
- package/dist/lite/firestore/src/api/aggregate.d.ts +19 -5
- package/dist/lite/firestore/src/api/database.d.ts +6 -6
- package/dist/lite/firestore/src/api.d.ts +2 -0
- package/dist/lite/firestore/src/core/count_query_runner.d.ts +32 -0
- package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -2
- package/dist/lite/firestore/src/lite-api/aggregate.d.ts +17 -61
- package/dist/lite/firestore/src/lite-api/aggregate_types.d.ts +69 -0
- package/dist/lite/firestore/src/lite-api/database.d.ts +6 -6
- package/dist/lite/firestore/test/integration/api/aggregation.test.d.ts +17 -0
- package/dist/lite/index.browser.esm2017.js +1068 -917
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +1183 -1037
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.d.ts +84 -4
- package/dist/lite/index.node.cjs.js +240 -62
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +238 -64
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +1059 -908
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +95 -6
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +213 -128
- package/dist/lite/packages/firestore/lite/index.d.ts +2 -0
- package/dist/lite/packages/firestore/src/api/aggregate.d.ts +19 -5
- package/dist/lite/packages/firestore/src/api/database.d.ts +6 -6
- package/dist/lite/packages/firestore/src/api.d.ts +2 -0
- package/dist/lite/packages/firestore/src/core/count_query_runner.d.ts +32 -0
- package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -2
- package/dist/lite/packages/firestore/src/lite-api/aggregate.d.ts +17 -61
- package/dist/lite/packages/firestore/src/lite-api/aggregate_types.d.ts +69 -0
- package/dist/lite/packages/firestore/src/lite-api/database.d.ts +6 -6
- package/dist/lite/packages/firestore/test/integration/api/aggregation.test.d.ts +17 -0
- package/dist/lite/private.d.ts +93 -4
- package/dist/packages/firestore/dist/index.esm2017.d.ts +295 -186
- package/dist/packages/firestore/lite/index.d.ts +2 -0
- package/dist/packages/firestore/src/api/aggregate.d.ts +19 -5
- package/dist/packages/firestore/src/api/database.d.ts +6 -6
- package/dist/packages/firestore/src/api.d.ts +2 -0
- package/dist/packages/firestore/src/core/count_query_runner.d.ts +32 -0
- package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -2
- package/dist/packages/firestore/src/lite-api/aggregate.d.ts +17 -61
- package/dist/packages/firestore/src/lite-api/aggregate_types.d.ts +69 -0
- package/dist/packages/firestore/src/lite-api/database.d.ts +6 -6
- package/dist/packages/firestore/test/integration/api/aggregation.test.d.ts +17 -0
- package/dist/private.d.ts +200 -11
- package/package.json +9 -9
package/dist/lite/index.node.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import { _getProvider, getApp, _removeServiceInstance, _registerComponent, regis
|
|
|
2
2
|
import { Component } from '@firebase/component';
|
|
3
3
|
import { Logger, LogLevel } from '@firebase/logger';
|
|
4
4
|
import { inspect } from 'util';
|
|
5
|
-
import { FirebaseError, createMockUserToken, getModularInstance } from '@firebase/util';
|
|
5
|
+
import { FirebaseError, createMockUserToken, getModularInstance, deepEqual } from '@firebase/util';
|
|
6
6
|
import nodeFetch from 'node-fetch';
|
|
7
7
|
import { randomBytes as randomBytes$1 } from 'crypto';
|
|
8
8
|
|
|
9
|
-
const version$1 = "3.5.0-canary.
|
|
9
|
+
const version$1 = "3.5.0-canary.ee871fc0b";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @license
|
|
@@ -59,7 +59,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
59
59
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
60
60
|
User.MOCK_USER = new User('mock-user');
|
|
61
61
|
|
|
62
|
-
const version = "9.10.0-canary.
|
|
62
|
+
const version = "9.10.0-canary.ee871fc0b";
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* @license
|
|
@@ -4567,6 +4567,21 @@ function toQueryTarget(serializer, target) {
|
|
|
4567
4567
|
}
|
|
4568
4568
|
return result;
|
|
4569
4569
|
}
|
|
4570
|
+
function toRunAggregationQueryRequest(serializer, target) {
|
|
4571
|
+
const queryTarget = toQueryTarget(serializer, target);
|
|
4572
|
+
return {
|
|
4573
|
+
structuredAggregationQuery: {
|
|
4574
|
+
aggregations: [
|
|
4575
|
+
{
|
|
4576
|
+
count: {},
|
|
4577
|
+
alias: 'count_alias'
|
|
4578
|
+
}
|
|
4579
|
+
],
|
|
4580
|
+
structuredQuery: queryTarget.structuredQuery
|
|
4581
|
+
},
|
|
4582
|
+
parent: queryTarget.parent
|
|
4583
|
+
};
|
|
4584
|
+
}
|
|
4570
4585
|
function toFilter(filters) {
|
|
4571
4586
|
if (filters.length === 0) {
|
|
4572
4587
|
return;
|
|
@@ -4969,6 +4984,19 @@ async function invokeRunQueryRpc(datastore, query) {
|
|
|
4969
4984
|
// Omit RunQueryResponses that only contain readTimes.
|
|
4970
4985
|
.filter(proto => !!proto.document)
|
|
4971
4986
|
.map(proto => fromDocument(datastoreImpl.serializer, proto.document, undefined)));
|
|
4987
|
+
}
|
|
4988
|
+
async function invokeRunAggregationQueryRpc(datastore, query) {
|
|
4989
|
+
const datastoreImpl = debugCast(datastore);
|
|
4990
|
+
const request = toRunAggregationQueryRequest(datastoreImpl.serializer, queryToTarget(query));
|
|
4991
|
+
const parent = request.parent;
|
|
4992
|
+
if (!datastoreImpl.connection.shouldResourcePathBeIncludedInRequest) {
|
|
4993
|
+
delete request.parent;
|
|
4994
|
+
}
|
|
4995
|
+
const response = await datastoreImpl.invokeStreamingRPC('RunAggregationQuery', parent, request, /*expectedResponseCount=*/ 1);
|
|
4996
|
+
return (response
|
|
4997
|
+
// Omit RunAggregationQueryResponse that only contain readTimes.
|
|
4998
|
+
.filter(proto => !!proto.result)
|
|
4999
|
+
.map(proto => proto.result.aggregateFields));
|
|
4972
5000
|
}
|
|
4973
5001
|
|
|
4974
5002
|
/**
|
|
@@ -5179,7 +5207,7 @@ class FirestoreSettingsImpl {
|
|
|
5179
5207
|
/**
|
|
5180
5208
|
* The Cloud Firestore service interface.
|
|
5181
5209
|
*
|
|
5182
|
-
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
5210
|
+
* Do not call this constructor directly. Instead, use {@link (getFirestore:1)}.
|
|
5183
5211
|
*/
|
|
5184
5212
|
class Firestore {
|
|
5185
5213
|
/** @hideconstructor */
|
|
@@ -5330,7 +5358,7 @@ function connectFirestoreEmulator(firestore, host, port, options = {}) {
|
|
|
5330
5358
|
* response from the server will not be resolved.
|
|
5331
5359
|
*
|
|
5332
5360
|
* To restart after termination, create a new instance of `Firestore` with
|
|
5333
|
-
* {@link getFirestore}.
|
|
5361
|
+
* {@link (getFirestore:1)}.
|
|
5334
5362
|
*
|
|
5335
5363
|
* Note: Under normal circumstances, calling `terminate()` is not required. This
|
|
5336
5364
|
* function is useful only when you want to force this instance to release all of
|
|
@@ -5378,6 +5406,100 @@ function registerFirestore() {
|
|
|
5378
5406
|
registerVersion('firestore-lite', version$1, 'esm2017');
|
|
5379
5407
|
}
|
|
5380
5408
|
|
|
5409
|
+
/**
|
|
5410
|
+
* @license
|
|
5411
|
+
* Copyright 2022 Google LLC
|
|
5412
|
+
*
|
|
5413
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5414
|
+
* you may not use this file except in compliance with the License.
|
|
5415
|
+
* You may obtain a copy of the License at
|
|
5416
|
+
*
|
|
5417
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5418
|
+
*
|
|
5419
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5420
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5421
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5422
|
+
* See the License for the specific language governing permissions and
|
|
5423
|
+
* limitations under the License.
|
|
5424
|
+
*/
|
|
5425
|
+
/**
|
|
5426
|
+
* Represents an aggregation that can be performed by Firestore.
|
|
5427
|
+
*/
|
|
5428
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5429
|
+
class AggregateField {
|
|
5430
|
+
constructor() {
|
|
5431
|
+
/** A type string to uniquely identify instances of this class. */
|
|
5432
|
+
this.type = 'AggregateField';
|
|
5433
|
+
}
|
|
5434
|
+
}
|
|
5435
|
+
/**
|
|
5436
|
+
* The results of executing an aggregation query.
|
|
5437
|
+
*/
|
|
5438
|
+
class AggregateQuerySnapshot {
|
|
5439
|
+
/** @hideconstructor */
|
|
5440
|
+
constructor(query, _data) {
|
|
5441
|
+
this._data = _data;
|
|
5442
|
+
/** A type string to uniquely identify instances of this class. */
|
|
5443
|
+
this.type = 'AggregateQuerySnapshot';
|
|
5444
|
+
this.query = query;
|
|
5445
|
+
}
|
|
5446
|
+
/**
|
|
5447
|
+
* Returns the results of the aggregations performed over the underlying
|
|
5448
|
+
* query.
|
|
5449
|
+
*
|
|
5450
|
+
* The keys of the returned object will be the same as those of the
|
|
5451
|
+
* `AggregateSpec` object specified to the aggregation method, and the values
|
|
5452
|
+
* will be the corresponding aggregation result.
|
|
5453
|
+
*
|
|
5454
|
+
* @returns The results of the aggregations performed over the underlying
|
|
5455
|
+
* query.
|
|
5456
|
+
*/
|
|
5457
|
+
data() {
|
|
5458
|
+
return this._data;
|
|
5459
|
+
}
|
|
5460
|
+
}
|
|
5461
|
+
|
|
5462
|
+
/**
|
|
5463
|
+
* @license
|
|
5464
|
+
* Copyright 2022 Google LLC
|
|
5465
|
+
*
|
|
5466
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5467
|
+
* you may not use this file except in compliance with the License.
|
|
5468
|
+
* You may obtain a copy of the License at
|
|
5469
|
+
*
|
|
5470
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5471
|
+
*
|
|
5472
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5473
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5474
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5475
|
+
* See the License for the specific language governing permissions and
|
|
5476
|
+
* limitations under the License.
|
|
5477
|
+
*/
|
|
5478
|
+
/**
|
|
5479
|
+
* CountQueryRunner encapsulates the logic needed to run the count aggregation
|
|
5480
|
+
* queries.
|
|
5481
|
+
*/
|
|
5482
|
+
class CountQueryRunner {
|
|
5483
|
+
constructor(query, datastore, userDataWriter) {
|
|
5484
|
+
this.query = query;
|
|
5485
|
+
this.datastore = datastore;
|
|
5486
|
+
this.userDataWriter = userDataWriter;
|
|
5487
|
+
}
|
|
5488
|
+
run() {
|
|
5489
|
+
return invokeRunAggregationQueryRpc(this.datastore, this.query._query).then(result => {
|
|
5490
|
+
hardAssert(result[0] !== undefined);
|
|
5491
|
+
const counts = Object.entries(result[0])
|
|
5492
|
+
.filter(([key, value]) => key === 'count_alias')
|
|
5493
|
+
.map(([key, value]) => this.userDataWriter.convertValue(value));
|
|
5494
|
+
const countValue = counts[0];
|
|
5495
|
+
hardAssert(typeof countValue === 'number');
|
|
5496
|
+
return Promise.resolve(new AggregateQuerySnapshot(this.query, {
|
|
5497
|
+
count: countValue
|
|
5498
|
+
}));
|
|
5499
|
+
});
|
|
5500
|
+
}
|
|
5501
|
+
}
|
|
5502
|
+
|
|
5381
5503
|
/**
|
|
5382
5504
|
* @license
|
|
5383
5505
|
* Copyright 2020 Google LLC
|
|
@@ -5609,64 +5731,6 @@ function queryEqual(left, right) {
|
|
|
5609
5731
|
return false;
|
|
5610
5732
|
}
|
|
5611
5733
|
|
|
5612
|
-
/**
|
|
5613
|
-
* @license
|
|
5614
|
-
* Copyright 2020 Google LLC
|
|
5615
|
-
*
|
|
5616
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5617
|
-
* you may not use this file except in compliance with the License.
|
|
5618
|
-
* You may obtain a copy of the License at
|
|
5619
|
-
*
|
|
5620
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5621
|
-
*
|
|
5622
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
5623
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5624
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5625
|
-
* See the License for the specific language governing permissions and
|
|
5626
|
-
* limitations under the License.
|
|
5627
|
-
*/
|
|
5628
|
-
/**
|
|
5629
|
-
* A `FieldPath` refers to a field in a document. The path may consist of a
|
|
5630
|
-
* single field name (referring to a top-level field in the document), or a
|
|
5631
|
-
* list of field names (referring to a nested field in the document).
|
|
5632
|
-
*
|
|
5633
|
-
* Create a `FieldPath` by providing field names. If more than one field
|
|
5634
|
-
* name is provided, the path will point to a nested field in a document.
|
|
5635
|
-
*/
|
|
5636
|
-
class FieldPath {
|
|
5637
|
-
/**
|
|
5638
|
-
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
5639
|
-
* name is provided, the path will point to a nested field in a document.
|
|
5640
|
-
*
|
|
5641
|
-
* @param fieldNames - A list of field names.
|
|
5642
|
-
*/
|
|
5643
|
-
constructor(...fieldNames) {
|
|
5644
|
-
for (let i = 0; i < fieldNames.length; ++i) {
|
|
5645
|
-
if (fieldNames[i].length === 0) {
|
|
5646
|
-
throw new FirestoreError(Code.INVALID_ARGUMENT, `Invalid field name at argument $(i + 1). ` +
|
|
5647
|
-
'Field names must not be empty.');
|
|
5648
|
-
}
|
|
5649
|
-
}
|
|
5650
|
-
this._internalPath = new FieldPath$1(fieldNames);
|
|
5651
|
-
}
|
|
5652
|
-
/**
|
|
5653
|
-
* Returns true if this `FieldPath` is equal to the provided one.
|
|
5654
|
-
*
|
|
5655
|
-
* @param other - The `FieldPath` to compare against.
|
|
5656
|
-
* @returns true if this `FieldPath` is equal to the provided one.
|
|
5657
|
-
*/
|
|
5658
|
-
isEqual(other) {
|
|
5659
|
-
return this._internalPath.isEqual(other._internalPath);
|
|
5660
|
-
}
|
|
5661
|
-
}
|
|
5662
|
-
/**
|
|
5663
|
-
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
5664
|
-
* It can be used in queries to sort or filter by the document ID.
|
|
5665
|
-
*/
|
|
5666
|
-
function documentId() {
|
|
5667
|
-
return new FieldPath(DOCUMENT_KEY_NAME);
|
|
5668
|
-
}
|
|
5669
|
-
|
|
5670
5734
|
/**
|
|
5671
5735
|
* @license
|
|
5672
5736
|
* Copyright 2020 Google LLC
|
|
@@ -5748,6 +5812,64 @@ class Bytes {
|
|
|
5748
5812
|
}
|
|
5749
5813
|
}
|
|
5750
5814
|
|
|
5815
|
+
/**
|
|
5816
|
+
* @license
|
|
5817
|
+
* Copyright 2020 Google LLC
|
|
5818
|
+
*
|
|
5819
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5820
|
+
* you may not use this file except in compliance with the License.
|
|
5821
|
+
* You may obtain a copy of the License at
|
|
5822
|
+
*
|
|
5823
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5824
|
+
*
|
|
5825
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5826
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5827
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5828
|
+
* See the License for the specific language governing permissions and
|
|
5829
|
+
* limitations under the License.
|
|
5830
|
+
*/
|
|
5831
|
+
/**
|
|
5832
|
+
* A `FieldPath` refers to a field in a document. The path may consist of a
|
|
5833
|
+
* single field name (referring to a top-level field in the document), or a
|
|
5834
|
+
* list of field names (referring to a nested field in the document).
|
|
5835
|
+
*
|
|
5836
|
+
* Create a `FieldPath` by providing field names. If more than one field
|
|
5837
|
+
* name is provided, the path will point to a nested field in a document.
|
|
5838
|
+
*/
|
|
5839
|
+
class FieldPath {
|
|
5840
|
+
/**
|
|
5841
|
+
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
5842
|
+
* name is provided, the path will point to a nested field in a document.
|
|
5843
|
+
*
|
|
5844
|
+
* @param fieldNames - A list of field names.
|
|
5845
|
+
*/
|
|
5846
|
+
constructor(...fieldNames) {
|
|
5847
|
+
for (let i = 0; i < fieldNames.length; ++i) {
|
|
5848
|
+
if (fieldNames[i].length === 0) {
|
|
5849
|
+
throw new FirestoreError(Code.INVALID_ARGUMENT, `Invalid field name at argument $(i + 1). ` +
|
|
5850
|
+
'Field names must not be empty.');
|
|
5851
|
+
}
|
|
5852
|
+
}
|
|
5853
|
+
this._internalPath = new FieldPath$1(fieldNames);
|
|
5854
|
+
}
|
|
5855
|
+
/**
|
|
5856
|
+
* Returns true if this `FieldPath` is equal to the provided one.
|
|
5857
|
+
*
|
|
5858
|
+
* @param other - The `FieldPath` to compare against.
|
|
5859
|
+
* @returns true if this `FieldPath` is equal to the provided one.
|
|
5860
|
+
*/
|
|
5861
|
+
isEqual(other) {
|
|
5862
|
+
return this._internalPath.isEqual(other._internalPath);
|
|
5863
|
+
}
|
|
5864
|
+
}
|
|
5865
|
+
/**
|
|
5866
|
+
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
5867
|
+
* It can be used in queries to sort or filter by the document ID.
|
|
5868
|
+
*/
|
|
5869
|
+
function documentId() {
|
|
5870
|
+
return new FieldPath(DOCUMENT_KEY_NAME);
|
|
5871
|
+
}
|
|
5872
|
+
|
|
5751
5873
|
/**
|
|
5752
5874
|
* @license
|
|
5753
5875
|
* Copyright 2020 Google LLC
|
|
@@ -7456,6 +7578,58 @@ function addDoc(reference, data) {
|
|
|
7456
7578
|
]).then(() => docRef);
|
|
7457
7579
|
}
|
|
7458
7580
|
|
|
7581
|
+
/**
|
|
7582
|
+
* @license
|
|
7583
|
+
* Copyright 2022 Google LLC
|
|
7584
|
+
*
|
|
7585
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7586
|
+
* you may not use this file except in compliance with the License.
|
|
7587
|
+
* You may obtain a copy of the License at
|
|
7588
|
+
*
|
|
7589
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7590
|
+
*
|
|
7591
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7592
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7593
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7594
|
+
* See the License for the specific language governing permissions and
|
|
7595
|
+
* limitations under the License.
|
|
7596
|
+
*/
|
|
7597
|
+
/**
|
|
7598
|
+
* Calculates the number of documents in the result set of the given query,
|
|
7599
|
+
* without actually downloading the documents.
|
|
7600
|
+
*
|
|
7601
|
+
* Using this function to count the documents is efficient because only the
|
|
7602
|
+
* final count, not the documents' data, is downloaded. This function can even
|
|
7603
|
+
* count the documents if the result set would be prohibitively large to
|
|
7604
|
+
* download entirely (e.g. thousands of documents).
|
|
7605
|
+
*
|
|
7606
|
+
* @param query - The query whose result set size to calculate.
|
|
7607
|
+
* @returns A Promise that will be resolved with the count; the count can be
|
|
7608
|
+
* retrieved from `snapshot.data().count`, where `snapshot` is the
|
|
7609
|
+
* `AggregateQuerySnapshot` to which the returned Promise resolves.
|
|
7610
|
+
*/
|
|
7611
|
+
function getCount(query) {
|
|
7612
|
+
const firestore = cast(query.firestore, Firestore);
|
|
7613
|
+
const datastore = getDatastore(firestore);
|
|
7614
|
+
const userDataWriter = new LiteUserDataWriter(firestore);
|
|
7615
|
+
return new CountQueryRunner(query, datastore, userDataWriter).run();
|
|
7616
|
+
}
|
|
7617
|
+
/**
|
|
7618
|
+
* Compares two `AggregateQuerySnapshot` instances for equality.
|
|
7619
|
+
*
|
|
7620
|
+
* Two `AggregateQuerySnapshot` instances are considered "equal" if they have
|
|
7621
|
+
* underlying queries that compare equal, and the same data.
|
|
7622
|
+
*
|
|
7623
|
+
* @param left - The first `AggregateQuerySnapshot` to compare.
|
|
7624
|
+
* @param right - The second `AggregateQuerySnapshot` to compare.
|
|
7625
|
+
*
|
|
7626
|
+
* @returns `true` if the objects are "equal", as defined above, or `false`
|
|
7627
|
+
* otherwise.
|
|
7628
|
+
*/
|
|
7629
|
+
function aggregateQuerySnapshotEqual(left, right) {
|
|
7630
|
+
return (queryEqual(left.query, right.query) && deepEqual(left.data(), right.data()));
|
|
7631
|
+
}
|
|
7632
|
+
|
|
7459
7633
|
/**
|
|
7460
7634
|
* @license
|
|
7461
7635
|
* Copyright 2020 Google LLC
|
|
@@ -8448,5 +8622,5 @@ function runTransaction(firestore, updateFunction, options) {
|
|
|
8448
8622
|
*/
|
|
8449
8623
|
registerFirestore();
|
|
8450
8624
|
|
|
8451
|
-
export { Bytes, CollectionReference, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Firestore, FirestoreError, GeoPoint, Query, QueryConstraint, QueryDocumentSnapshot, QuerySnapshot, Timestamp, Transaction, WriteBatch, addDoc, arrayRemove, arrayUnion, collection, collectionGroup, connectFirestoreEmulator, deleteDoc, deleteField, doc, documentId, endAt, endBefore, getDoc, getDocs, getFirestore, increment, initializeFirestore, limit, limitToLast, orderBy, query, queryEqual, refEqual, runTransaction, serverTimestamp, setDoc, setLogLevel, snapshotEqual, startAfter, startAt, terminate, updateDoc, where, writeBatch };
|
|
8625
|
+
export { AggregateField, AggregateQuerySnapshot, Bytes, CollectionReference, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Firestore, FirestoreError, GeoPoint, Query, QueryConstraint, QueryDocumentSnapshot, QuerySnapshot, Timestamp, Transaction, WriteBatch, addDoc, aggregateQuerySnapshotEqual, arrayRemove, arrayUnion, collection, collectionGroup, connectFirestoreEmulator, deleteDoc, deleteField, doc, documentId, endAt, endBefore, getCount, getDoc, getDocs, getFirestore, increment, initializeFirestore, limit, limitToLast, orderBy, query, queryEqual, refEqual, runTransaction, serverTimestamp, setDoc, setLogLevel, snapshotEqual, startAfter, startAt, terminate, updateDoc, where, writeBatch };
|
|
8452
8626
|
//# sourceMappingURL=index.node.mjs.map
|