@firebase/firestore 3.4.4-canary.6555aa70f → 3.4.4-canary.6c8eabfc5
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/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/firestore/src/api.d.ts +1 -1
- package/dist/firestore/src/core/database_info.d.ts +1 -0
- package/dist/firestore/src/core/target.d.ts +34 -5
- package/dist/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +11 -0
- package/dist/firestore/src/local/indexeddb_schema.d.ts +121 -7
- package/dist/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/firestore/src/local/simple_db.d.ts +1 -0
- package/dist/firestore/src/model/field_index.d.ts +4 -0
- package/dist/firestore/src/model/values.d.ts +7 -0
- package/dist/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/firestore/test/util/helpers.d.ts +2 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.esm2017.js +3415 -3246
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3379 -3288
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +478 -286
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +478 -286
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +3485 -3312
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +172 -4
- package/dist/lite/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/lite/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/lite/firestore/src/api.d.ts +1 -1
- package/dist/lite/firestore/src/core/database_info.d.ts +1 -0
- package/dist/lite/firestore/src/core/target.d.ts +34 -5
- package/dist/lite/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/lite/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +11 -0
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +121 -7
- package/dist/lite/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/lite/firestore/src/local/simple_db.d.ts +1 -0
- package/dist/lite/firestore/src/model/field_index.d.ts +4 -0
- package/dist/lite/firestore/src/model/values.d.ts +7 -0
- package/dist/lite/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/lite/firestore/test/util/helpers.d.ts +2 -2
- package/dist/lite/index.browser.esm2017.js +1159 -1152
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +339 -336
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +39 -28
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +39 -28
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +304 -297
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +3 -2
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +125 -124
- package/dist/lite/packages/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/lite/packages/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/lite/packages/firestore/src/api.d.ts +1 -1
- package/dist/lite/packages/firestore/src/core/database_info.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/target.d.ts +34 -5
- package/dist/lite/packages/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/lite/packages/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +11 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +121 -7
- package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/lite/packages/firestore/src/local/simple_db.d.ts +1 -0
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +4 -0
- package/dist/lite/packages/firestore/src/model/values.d.ts +7 -0
- package/dist/lite/packages/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/util/helpers.d.ts +2 -2
- package/dist/lite/private.d.ts +2 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +176 -175
- package/dist/packages/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/packages/firestore/src/api/snapshot.d.ts +1 -2
- package/dist/packages/firestore/src/api.d.ts +1 -1
- package/dist/packages/firestore/src/core/database_info.d.ts +1 -0
- package/dist/packages/firestore/src/core/target.d.ts +34 -5
- package/dist/packages/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/packages/firestore/src/local/index_manager.d.ts +52 -0
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +11 -0
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +121 -7
- package/dist/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
- package/dist/packages/firestore/src/local/simple_db.d.ts +1 -0
- package/dist/packages/firestore/src/model/field_index.d.ts +4 -0
- package/dist/packages/firestore/src/model/values.d.ts +7 -0
- package/dist/packages/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/packages/firestore/test/util/helpers.d.ts +2 -2
- package/dist/private.d.ts +171 -4
- package/package.json +9 -9
package/dist/index.node.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { credentials, loadPackageDefinition, Metadata } from '@grpc/grpc-js';
|
|
|
8
8
|
import { fromJSON } from '@grpc/proto-loader';
|
|
9
9
|
|
|
10
10
|
const name = "@firebase/firestore";
|
|
11
|
-
const version$1 = "3.4.4-canary.
|
|
11
|
+
const version$1 = "3.4.4-canary.6c8eabfc5";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -61,7 +61,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
61
61
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
62
62
|
User.MOCK_USER = new User('mock-user');
|
|
63
63
|
|
|
64
|
-
const version = "9.6.
|
|
64
|
+
const version = "9.6.6-canary.6c8eabfc5";
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* @license
|
|
@@ -1192,23 +1192,6 @@ function decodeResourcePath(path) {
|
|
|
1192
1192
|
}
|
|
1193
1193
|
return new ResourcePath(segments);
|
|
1194
1194
|
}
|
|
1195
|
-
|
|
1196
|
-
/**
|
|
1197
|
-
* @license
|
|
1198
|
-
* Copyright 2017 Google LLC
|
|
1199
|
-
*
|
|
1200
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1201
|
-
* you may not use this file except in compliance with the License.
|
|
1202
|
-
* You may obtain a copy of the License at
|
|
1203
|
-
*
|
|
1204
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1205
|
-
*
|
|
1206
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1207
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1208
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1209
|
-
* See the License for the specific language governing permissions and
|
|
1210
|
-
* limitations under the License.
|
|
1211
|
-
*/
|
|
1212
1195
|
/**
|
|
1213
1196
|
* Schema Version for the Web client:
|
|
1214
1197
|
* 1. Initial version including Mutation Queue, Query Cache, and Remote
|
|
@@ -1227,6 +1210,7 @@ function decodeResourcePath(path) {
|
|
|
1227
1210
|
* an auto-incrementing ID. This is required for Index-Free queries.
|
|
1228
1211
|
* 10. Rewrite the canonical IDs to the explicit Protobuf-based format.
|
|
1229
1212
|
* 11. Add bundles and named_queries for bundle support.
|
|
1213
|
+
* 12. Add indexing support.
|
|
1230
1214
|
*/
|
|
1231
1215
|
const SCHEMA_VERSION = 11;
|
|
1232
1216
|
/**
|
|
@@ -1753,9 +1737,7 @@ class DbClientMetadata {
|
|
|
1753
1737
|
DbClientMetadata.store = 'clientMetadata';
|
|
1754
1738
|
/** Keys are automatically assigned via the clientId properties. */
|
|
1755
1739
|
DbClientMetadata.keyPath = 'clientId';
|
|
1756
|
-
/**
|
|
1757
|
-
* A object representing a bundle loaded by the SDK.
|
|
1758
|
-
*/
|
|
1740
|
+
/** An object representing a bundle loaded by the SDK. */
|
|
1759
1741
|
class DbBundle {
|
|
1760
1742
|
constructor(
|
|
1761
1743
|
/** The ID of the loaded bundle. */
|
|
@@ -1772,9 +1754,7 @@ class DbBundle {
|
|
|
1772
1754
|
/** Name of the IndexedDb object store. */
|
|
1773
1755
|
DbBundle.store = 'bundles';
|
|
1774
1756
|
DbBundle.keyPath = 'bundleId';
|
|
1775
|
-
/**
|
|
1776
|
-
* A object representing a named query loaded by the SDK via a bundle.
|
|
1777
|
-
*/
|
|
1757
|
+
/** An object representing a named query loaded by the SDK via a bundle. */
|
|
1778
1758
|
class DbNamedQuery {
|
|
1779
1759
|
constructor(
|
|
1780
1760
|
/** The name of the query. */
|
|
@@ -1791,6 +1771,93 @@ class DbNamedQuery {
|
|
|
1791
1771
|
/** Name of the IndexedDb object store. */
|
|
1792
1772
|
DbNamedQuery.store = 'namedQueries';
|
|
1793
1773
|
DbNamedQuery.keyPath = 'name';
|
|
1774
|
+
/** An object representing the global configuration for a field index. */
|
|
1775
|
+
class DbIndexConfiguration {
|
|
1776
|
+
constructor(
|
|
1777
|
+
/** The index id for this entry. */
|
|
1778
|
+
indexId,
|
|
1779
|
+
/** The collection group this index belongs to. */
|
|
1780
|
+
collectionGroup,
|
|
1781
|
+
/** The fields to index for this index. */
|
|
1782
|
+
fields) {
|
|
1783
|
+
this.indexId = indexId;
|
|
1784
|
+
this.collectionGroup = collectionGroup;
|
|
1785
|
+
this.fields = fields;
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
/** Name of the IndexedDb object store. */
|
|
1789
|
+
DbIndexConfiguration.store = 'indexConfiguration';
|
|
1790
|
+
DbIndexConfiguration.keyPath = 'indexId';
|
|
1791
|
+
/**
|
|
1792
|
+
* An object describing how up-to-date the index backfill is for each user and
|
|
1793
|
+
* index.
|
|
1794
|
+
*/
|
|
1795
|
+
class DbIndexState {
|
|
1796
|
+
constructor(
|
|
1797
|
+
/** The index id for this entry. */
|
|
1798
|
+
indexId,
|
|
1799
|
+
/** The user id for this entry. */
|
|
1800
|
+
uid,
|
|
1801
|
+
/**
|
|
1802
|
+
* A number that indicates when the index was last updated (relative to
|
|
1803
|
+
* other indexes).
|
|
1804
|
+
*/
|
|
1805
|
+
sequenceNumber,
|
|
1806
|
+
/**
|
|
1807
|
+
* The latest read time that has been indexed by Firestore for this field
|
|
1808
|
+
* index. Set to `{seconds: 0, nanos: 0}` if no documents have been indexed.
|
|
1809
|
+
*/
|
|
1810
|
+
readTime,
|
|
1811
|
+
/**
|
|
1812
|
+
* The last document that has been indexed for this field index. Empty if
|
|
1813
|
+
* no documents have been indexed.
|
|
1814
|
+
*/
|
|
1815
|
+
documentKey,
|
|
1816
|
+
/**
|
|
1817
|
+
* The largest mutation batch id that has been processed for this index. -1
|
|
1818
|
+
* if no mutations have been indexed.
|
|
1819
|
+
*/
|
|
1820
|
+
largestBatchId) {
|
|
1821
|
+
this.indexId = indexId;
|
|
1822
|
+
this.uid = uid;
|
|
1823
|
+
this.sequenceNumber = sequenceNumber;
|
|
1824
|
+
this.readTime = readTime;
|
|
1825
|
+
this.documentKey = documentKey;
|
|
1826
|
+
this.largestBatchId = largestBatchId;
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
/** Name of the IndexedDb object store. */
|
|
1830
|
+
DbIndexState.store = 'indexState';
|
|
1831
|
+
DbIndexState.keyPath = ['indexId', 'uid'];
|
|
1832
|
+
/** An object that stores the encoded entries for all documents and fields. */
|
|
1833
|
+
class DbIndexEntries {
|
|
1834
|
+
constructor(
|
|
1835
|
+
/** The index id for this entry. */
|
|
1836
|
+
indexId,
|
|
1837
|
+
/** The user id for this entry. */
|
|
1838
|
+
uid,
|
|
1839
|
+
/** The encoded array index value for this entry. */
|
|
1840
|
+
arrayValue,
|
|
1841
|
+
/** The encoded directional value for equality and inequality filters. */
|
|
1842
|
+
directionalValue,
|
|
1843
|
+
/** The document key this entry points to. */
|
|
1844
|
+
documentKey) {
|
|
1845
|
+
this.indexId = indexId;
|
|
1846
|
+
this.uid = uid;
|
|
1847
|
+
this.arrayValue = arrayValue;
|
|
1848
|
+
this.directionalValue = directionalValue;
|
|
1849
|
+
this.documentKey = documentKey;
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
/** Name of the IndexedDb object store. */
|
|
1853
|
+
DbIndexEntries.store = 'indexEntries';
|
|
1854
|
+
DbIndexEntries.keyPath = [
|
|
1855
|
+
'indexId',
|
|
1856
|
+
'uid',
|
|
1857
|
+
'arrayValue',
|
|
1858
|
+
'directionalValue',
|
|
1859
|
+
'documentKey'
|
|
1860
|
+
];
|
|
1794
1861
|
// Visible for testing
|
|
1795
1862
|
const V1_STORES = [
|
|
1796
1863
|
DbMutationQueue.store,
|
|
@@ -1805,7 +1872,6 @@ const V1_STORES = [
|
|
|
1805
1872
|
// V2 is no longer usable (see comment at top of file)
|
|
1806
1873
|
// Visible for testing
|
|
1807
1874
|
const V3_STORES = V1_STORES;
|
|
1808
|
-
// Visible for testing
|
|
1809
1875
|
// Note: DbRemoteDocumentChanges is no longer used and dropped with v9.
|
|
1810
1876
|
const V4_STORES = [...V3_STORES, DbClientMetadata.store];
|
|
1811
1877
|
// V5 does not change the set of stores.
|
|
@@ -1815,6 +1881,12 @@ const V8_STORES = [...V6_STORES, DbCollectionParent.store];
|
|
|
1815
1881
|
// V9 does not change the set of stores.
|
|
1816
1882
|
// V10 does not change the set of stores.
|
|
1817
1883
|
const V11_STORES = [...V8_STORES, DbBundle.store, DbNamedQuery.store];
|
|
1884
|
+
[
|
|
1885
|
+
...V11_STORES,
|
|
1886
|
+
DbIndexConfiguration.store,
|
|
1887
|
+
DbIndexState.store,
|
|
1888
|
+
DbIndexEntries.store
|
|
1889
|
+
];
|
|
1818
1890
|
/**
|
|
1819
1891
|
* The list of all default IndexedDB stores used throughout the SDK. This is
|
|
1820
1892
|
* used when creating transactions so that access across all stores is done
|
|
@@ -2117,6 +2189,15 @@ class SimpleDbTransaction {
|
|
|
2117
2189
|
this.transaction.abort();
|
|
2118
2190
|
}
|
|
2119
2191
|
}
|
|
2192
|
+
maybeCommit() {
|
|
2193
|
+
// If the browser supports V3 IndexedDB, we invoke commit() explicitly to
|
|
2194
|
+
// speed up index DB processing if the event loop remains blocks.
|
|
2195
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2196
|
+
const maybeV3IndexedDb = this.transaction;
|
|
2197
|
+
if (!this.aborted && typeof maybeV3IndexedDb.commit === 'function') {
|
|
2198
|
+
maybeV3IndexedDb.commit();
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2120
2201
|
/**
|
|
2121
2202
|
* Returns a SimpleDbStore<KeyType, ValueType> for the specified store. All
|
|
2122
2203
|
* operations performed on the SimpleDbStore happen within the context of this
|
|
@@ -2313,6 +2394,10 @@ class SimpleDb {
|
|
|
2313
2394
|
this.db = await this.ensureDb(action);
|
|
2314
2395
|
const transaction = SimpleDbTransaction.open(this.db, action, readonly ? 'readonly' : 'readwrite', objectStores);
|
|
2315
2396
|
const transactionFnResult = transactionFn(transaction)
|
|
2397
|
+
.next(result => {
|
|
2398
|
+
transaction.maybeCommit();
|
|
2399
|
+
return result;
|
|
2400
|
+
})
|
|
2316
2401
|
.catch(error => {
|
|
2317
2402
|
// Abort the transaction if there was an error.
|
|
2318
2403
|
transaction.abort(error);
|
|
@@ -3374,6 +3459,75 @@ function getLocalWriteTime(value) {
|
|
|
3374
3459
|
return new Timestamp(localWriteTime.seconds, localWriteTime.nanos);
|
|
3375
3460
|
}
|
|
3376
3461
|
|
|
3462
|
+
/**
|
|
3463
|
+
* @license
|
|
3464
|
+
* Copyright 2017 Google LLC
|
|
3465
|
+
*
|
|
3466
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3467
|
+
* you may not use this file except in compliance with the License.
|
|
3468
|
+
* You may obtain a copy of the License at
|
|
3469
|
+
*
|
|
3470
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3471
|
+
*
|
|
3472
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3473
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3474
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3475
|
+
* See the License for the specific language governing permissions and
|
|
3476
|
+
* limitations under the License.
|
|
3477
|
+
*/
|
|
3478
|
+
class DatabaseInfo {
|
|
3479
|
+
/**
|
|
3480
|
+
* Constructs a DatabaseInfo using the provided host, databaseId and
|
|
3481
|
+
* persistenceKey.
|
|
3482
|
+
*
|
|
3483
|
+
* @param databaseId - The database to use.
|
|
3484
|
+
* @param appId - The Firebase App Id.
|
|
3485
|
+
* @param persistenceKey - A unique identifier for this Firestore's local
|
|
3486
|
+
* storage (used in conjunction with the databaseId).
|
|
3487
|
+
* @param host - The Firestore backend host to connect to.
|
|
3488
|
+
* @param ssl - Whether to use SSL when connecting.
|
|
3489
|
+
* @param forceLongPolling - Whether to use the forceLongPolling option
|
|
3490
|
+
* when using WebChannel as the network transport.
|
|
3491
|
+
* @param autoDetectLongPolling - Whether to use the detectBufferingProxy
|
|
3492
|
+
* option when using WebChannel as the network transport.
|
|
3493
|
+
* @param useFetchStreams Whether to use the Fetch API instead of
|
|
3494
|
+
* XMLHTTPRequest
|
|
3495
|
+
*/
|
|
3496
|
+
constructor(databaseId, appId, persistenceKey, host, ssl, forceLongPolling, autoDetectLongPolling, useFetchStreams) {
|
|
3497
|
+
this.databaseId = databaseId;
|
|
3498
|
+
this.appId = appId;
|
|
3499
|
+
this.persistenceKey = persistenceKey;
|
|
3500
|
+
this.host = host;
|
|
3501
|
+
this.ssl = ssl;
|
|
3502
|
+
this.forceLongPolling = forceLongPolling;
|
|
3503
|
+
this.autoDetectLongPolling = autoDetectLongPolling;
|
|
3504
|
+
this.useFetchStreams = useFetchStreams;
|
|
3505
|
+
}
|
|
3506
|
+
}
|
|
3507
|
+
/** The default database name for a project. */
|
|
3508
|
+
const DEFAULT_DATABASE_NAME = '(default)';
|
|
3509
|
+
/**
|
|
3510
|
+
* Represents the database ID a Firestore client is associated with.
|
|
3511
|
+
* @internal
|
|
3512
|
+
*/
|
|
3513
|
+
class DatabaseId {
|
|
3514
|
+
constructor(projectId, database) {
|
|
3515
|
+
this.projectId = projectId;
|
|
3516
|
+
this.database = database ? database : DEFAULT_DATABASE_NAME;
|
|
3517
|
+
}
|
|
3518
|
+
static empty() {
|
|
3519
|
+
return new DatabaseId('', '');
|
|
3520
|
+
}
|
|
3521
|
+
get isDefaultDatabase() {
|
|
3522
|
+
return this.database === DEFAULT_DATABASE_NAME;
|
|
3523
|
+
}
|
|
3524
|
+
isEqual(other) {
|
|
3525
|
+
return (other instanceof DatabaseId &&
|
|
3526
|
+
other.projectId === this.projectId &&
|
|
3527
|
+
other.database === this.database);
|
|
3528
|
+
}
|
|
3529
|
+
}
|
|
3530
|
+
|
|
3377
3531
|
/**
|
|
3378
3532
|
* @license
|
|
3379
3533
|
* Copyright 2017 Google LLC
|
|
@@ -4229,6 +4383,125 @@ function compareDocumentsByField(field, d1, d2) {
|
|
|
4229
4383
|
}
|
|
4230
4384
|
}
|
|
4231
4385
|
|
|
4386
|
+
/**
|
|
4387
|
+
* @license
|
|
4388
|
+
* Copyright 2021 Google LLC
|
|
4389
|
+
*
|
|
4390
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4391
|
+
* you may not use this file except in compliance with the License.
|
|
4392
|
+
* You may obtain a copy of the License at
|
|
4393
|
+
*
|
|
4394
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4395
|
+
*
|
|
4396
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4397
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4398
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4399
|
+
* See the License for the specific language governing permissions and
|
|
4400
|
+
* limitations under the License.
|
|
4401
|
+
*/
|
|
4402
|
+
/**
|
|
4403
|
+
* The initial mutation batch id for each index. Gets updated during index
|
|
4404
|
+
* backfill.
|
|
4405
|
+
*/
|
|
4406
|
+
const INITIAL_LARGEST_BATCH_ID = -1;
|
|
4407
|
+
/**
|
|
4408
|
+
* The initial sequence number for each index. Gets updated during index
|
|
4409
|
+
* backfill.
|
|
4410
|
+
*/
|
|
4411
|
+
const INITIAL_SEQUENCE_NUMBER = 0;
|
|
4412
|
+
/**
|
|
4413
|
+
* An index definition for field indexes in Firestore.
|
|
4414
|
+
*
|
|
4415
|
+
* Every index is associated with a collection. The definition contains a list
|
|
4416
|
+
* of fields and their index kind (which can be `ASCENDING`, `DESCENDING` or
|
|
4417
|
+
* `CONTAINS` for ArrayContains/ArrayContainsAny queries).
|
|
4418
|
+
*
|
|
4419
|
+
* Unlike the backend, the SDK does not differentiate between collection or
|
|
4420
|
+
* collection group-scoped indices. Every index can be used for both single
|
|
4421
|
+
* collection and collection group queries.
|
|
4422
|
+
*/
|
|
4423
|
+
class FieldIndex {
|
|
4424
|
+
constructor(
|
|
4425
|
+
/**
|
|
4426
|
+
* The index ID. Returns -1 if the index ID is not available (e.g. the index
|
|
4427
|
+
* has not yet been persisted).
|
|
4428
|
+
*/
|
|
4429
|
+
indexId,
|
|
4430
|
+
/** The collection ID this index applies to. */
|
|
4431
|
+
collectionGroup,
|
|
4432
|
+
/** The field segments for this index. */
|
|
4433
|
+
segments,
|
|
4434
|
+
/** Shows how up-to-date the index is for the current user. */
|
|
4435
|
+
indexState) {
|
|
4436
|
+
this.indexId = indexId;
|
|
4437
|
+
this.collectionGroup = collectionGroup;
|
|
4438
|
+
this.segments = segments;
|
|
4439
|
+
this.indexState = indexState;
|
|
4440
|
+
}
|
|
4441
|
+
}
|
|
4442
|
+
/** An ID for an index that has not yet been added to persistence. */
|
|
4443
|
+
FieldIndex.UNKNOWN_ID = -1;
|
|
4444
|
+
/** An index component consisting of field path and index type. */
|
|
4445
|
+
class IndexSegment {
|
|
4446
|
+
constructor(
|
|
4447
|
+
/** The field path of the component. */
|
|
4448
|
+
fieldPath,
|
|
4449
|
+
/** The fields sorting order. */
|
|
4450
|
+
kind) {
|
|
4451
|
+
this.fieldPath = fieldPath;
|
|
4452
|
+
this.kind = kind;
|
|
4453
|
+
}
|
|
4454
|
+
}
|
|
4455
|
+
/**
|
|
4456
|
+
* Stores the "high water mark" that indicates how updated the Index is for the
|
|
4457
|
+
* current user.
|
|
4458
|
+
*/
|
|
4459
|
+
class IndexState {
|
|
4460
|
+
constructor(
|
|
4461
|
+
/**
|
|
4462
|
+
* Indicates when the index was last updated (relative to other indexes).
|
|
4463
|
+
*/
|
|
4464
|
+
sequenceNumber,
|
|
4465
|
+
/** The the latest indexed read time, document and batch id. */
|
|
4466
|
+
offset) {
|
|
4467
|
+
this.sequenceNumber = sequenceNumber;
|
|
4468
|
+
this.offset = offset;
|
|
4469
|
+
}
|
|
4470
|
+
/** The state of an index that has not yet been backfilled. */
|
|
4471
|
+
static empty() {
|
|
4472
|
+
return new IndexState(INITIAL_SEQUENCE_NUMBER, IndexOffset.min());
|
|
4473
|
+
}
|
|
4474
|
+
}
|
|
4475
|
+
/**
|
|
4476
|
+
* Stores the latest read time, document and batch ID that were processed for an
|
|
4477
|
+
* index.
|
|
4478
|
+
*/
|
|
4479
|
+
class IndexOffset {
|
|
4480
|
+
constructor(
|
|
4481
|
+
/**
|
|
4482
|
+
* The latest read time version that has been indexed by Firestore for this
|
|
4483
|
+
* field index.
|
|
4484
|
+
*/
|
|
4485
|
+
readTime,
|
|
4486
|
+
/**
|
|
4487
|
+
* The key of the last document that was indexed for this query. Use
|
|
4488
|
+
* `DocumentKey.empty()` if no document has been indexed.
|
|
4489
|
+
*/
|
|
4490
|
+
documentKey,
|
|
4491
|
+
/*
|
|
4492
|
+
* The largest mutation batch id that's been processed by Firestore.
|
|
4493
|
+
*/
|
|
4494
|
+
largestBatchId) {
|
|
4495
|
+
this.readTime = readTime;
|
|
4496
|
+
this.documentKey = documentKey;
|
|
4497
|
+
this.largestBatchId = largestBatchId;
|
|
4498
|
+
}
|
|
4499
|
+
/** The state of an index that has not yet been backfilled. */
|
|
4500
|
+
static min() {
|
|
4501
|
+
return new IndexOffset(SnapshotVersion.min(), DocumentKey.empty(), INITIAL_LARGEST_BATCH_ID);
|
|
4502
|
+
}
|
|
4503
|
+
}
|
|
4504
|
+
|
|
4232
4505
|
/**
|
|
4233
4506
|
* @license
|
|
4234
4507
|
* Copyright 2019 Google LLC
|
|
@@ -4272,27 +4545,29 @@ function newTarget(path, collectionGroup = null, orderBy = [], filters = [], lim
|
|
|
4272
4545
|
function canonifyTarget(target) {
|
|
4273
4546
|
const targetImpl = debugCast(target);
|
|
4274
4547
|
if (targetImpl.memoizedCanonicalId === null) {
|
|
4275
|
-
let
|
|
4548
|
+
let str = targetImpl.path.canonicalString();
|
|
4276
4549
|
if (targetImpl.collectionGroup !== null) {
|
|
4277
|
-
|
|
4550
|
+
str += '|cg:' + targetImpl.collectionGroup;
|
|
4278
4551
|
}
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4552
|
+
str += '|f:';
|
|
4553
|
+
str += targetImpl.filters.map(f => canonifyFilter(f)).join(',');
|
|
4554
|
+
str += '|ob:';
|
|
4555
|
+
str += targetImpl.orderBy.map(o => canonifyOrderBy(o)).join(',');
|
|
4283
4556
|
if (!isNullOrUndefined(targetImpl.limit)) {
|
|
4284
|
-
|
|
4285
|
-
|
|
4557
|
+
str += '|l:';
|
|
4558
|
+
str += targetImpl.limit;
|
|
4286
4559
|
}
|
|
4287
4560
|
if (targetImpl.startAt) {
|
|
4288
|
-
|
|
4289
|
-
|
|
4561
|
+
str += '|lb:';
|
|
4562
|
+
str += targetImpl.startAt.inclusive ? 'b:' : 'a:';
|
|
4563
|
+
str += targetImpl.startAt.position.map(p => canonicalId(p)).join(',');
|
|
4290
4564
|
}
|
|
4291
4565
|
if (targetImpl.endAt) {
|
|
4292
|
-
|
|
4293
|
-
|
|
4566
|
+
str += '|ub:';
|
|
4567
|
+
str += targetImpl.endAt.inclusive ? 'a:' : 'b:';
|
|
4568
|
+
str += targetImpl.endAt.position.map(p => canonicalId(p)).join(',');
|
|
4294
4569
|
}
|
|
4295
|
-
targetImpl.memoizedCanonicalId =
|
|
4570
|
+
targetImpl.memoizedCanonicalId = str;
|
|
4296
4571
|
}
|
|
4297
4572
|
return targetImpl.memoizedCanonicalId;
|
|
4298
4573
|
}
|
|
@@ -4315,10 +4590,14 @@ function stringifyTarget(target) {
|
|
|
4315
4590
|
.join(', ')}]`;
|
|
4316
4591
|
}
|
|
4317
4592
|
if (target.startAt) {
|
|
4318
|
-
str += ', startAt: '
|
|
4593
|
+
str += ', startAt: ';
|
|
4594
|
+
str += target.startAt.inclusive ? 'b:' : 'a:';
|
|
4595
|
+
str += target.startAt.position.map(p => canonicalId(p)).join(',');
|
|
4319
4596
|
}
|
|
4320
4597
|
if (target.endAt) {
|
|
4321
|
-
str += ', endAt: '
|
|
4598
|
+
str += ', endAt: ';
|
|
4599
|
+
str += target.endAt.inclusive ? 'a:' : 'b:';
|
|
4600
|
+
str += target.endAt.position.map(p => canonicalId(p)).join(',');
|
|
4322
4601
|
}
|
|
4323
4602
|
return `Target(${str})`;
|
|
4324
4603
|
}
|
|
@@ -4353,7 +4632,7 @@ function targetEquals(left, right) {
|
|
|
4353
4632
|
}
|
|
4354
4633
|
return boundEquals(left.endAt, right.endAt);
|
|
4355
4634
|
}
|
|
4356
|
-
function
|
|
4635
|
+
function targetIsDocumentTarget(target) {
|
|
4357
4636
|
return (DocumentKey.isDocumentKey(target.path) &&
|
|
4358
4637
|
target.collectionGroup === null &&
|
|
4359
4638
|
target.filters.length === 0);
|
|
@@ -4556,17 +4835,11 @@ class ArrayContainsAnyFilter extends FieldFilter {
|
|
|
4556
4835
|
* just after the provided values.
|
|
4557
4836
|
*/
|
|
4558
4837
|
class Bound {
|
|
4559
|
-
constructor(position,
|
|
4838
|
+
constructor(position, inclusive) {
|
|
4560
4839
|
this.position = position;
|
|
4561
|
-
this.
|
|
4840
|
+
this.inclusive = inclusive;
|
|
4562
4841
|
}
|
|
4563
4842
|
}
|
|
4564
|
-
function canonifyBound(bound) {
|
|
4565
|
-
// TODO(b/29183165): Make this collision robust.
|
|
4566
|
-
return `${bound.before ? 'b' : 'a'}:${bound.position
|
|
4567
|
-
.map(p => canonicalId(p))
|
|
4568
|
-
.join(',')}`;
|
|
4569
|
-
}
|
|
4570
4843
|
/**
|
|
4571
4844
|
* An ordering on a field, in some Direction. Direction defaults to ASCENDING.
|
|
4572
4845
|
*/
|
|
@@ -4586,11 +4859,7 @@ function stringifyOrderBy(orderBy) {
|
|
|
4586
4859
|
function orderByEquals(left, right) {
|
|
4587
4860
|
return left.dir === right.dir && left.field.isEqual(right.field);
|
|
4588
4861
|
}
|
|
4589
|
-
|
|
4590
|
-
* Returns true if a document sorts before a bound using the provided sort
|
|
4591
|
-
* order.
|
|
4592
|
-
*/
|
|
4593
|
-
function sortsBeforeDocument(bound, orderBy, doc) {
|
|
4862
|
+
function boundCompareToDocument(bound, orderBy, doc) {
|
|
4594
4863
|
let comparison = 0;
|
|
4595
4864
|
for (let i = 0; i < bound.position.length; i++) {
|
|
4596
4865
|
const orderByComponent = orderBy[i];
|
|
@@ -4609,7 +4878,23 @@ function sortsBeforeDocument(bound, orderBy, doc) {
|
|
|
4609
4878
|
break;
|
|
4610
4879
|
}
|
|
4611
4880
|
}
|
|
4612
|
-
return
|
|
4881
|
+
return comparison;
|
|
4882
|
+
}
|
|
4883
|
+
/**
|
|
4884
|
+
* Returns true if a document sorts after a bound using the provided sort
|
|
4885
|
+
* order.
|
|
4886
|
+
*/
|
|
4887
|
+
function boundSortsAfterDocument(bound, orderBy, doc) {
|
|
4888
|
+
const comparison = boundCompareToDocument(bound, orderBy, doc);
|
|
4889
|
+
return bound.inclusive ? comparison >= 0 : comparison > 0;
|
|
4890
|
+
}
|
|
4891
|
+
/**
|
|
4892
|
+
* Returns true if a document sorts before a bound using the provided sort
|
|
4893
|
+
* order.
|
|
4894
|
+
*/
|
|
4895
|
+
function boundSortsBeforeDocument(bound, orderBy, doc) {
|
|
4896
|
+
const comparison = boundCompareToDocument(bound, orderBy, doc);
|
|
4897
|
+
return bound.inclusive ? comparison <= 0 : comparison < 0;
|
|
4613
4898
|
}
|
|
4614
4899
|
function boundEquals(left, right) {
|
|
4615
4900
|
if (left === null) {
|
|
@@ -4618,7 +4903,7 @@ function boundEquals(left, right) {
|
|
|
4618
4903
|
else if (right === null) {
|
|
4619
4904
|
return false;
|
|
4620
4905
|
}
|
|
4621
|
-
if (left.
|
|
4906
|
+
if (left.inclusive !== right.inclusive ||
|
|
4622
4907
|
left.position.length !== right.position.length) {
|
|
4623
4908
|
return false;
|
|
4624
4909
|
}
|
|
@@ -4822,10 +5107,10 @@ function queryToTarget(query) {
|
|
|
4822
5107
|
}
|
|
4823
5108
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
4824
5109
|
const startAt = queryImpl.endAt
|
|
4825
|
-
? new Bound(queryImpl.endAt.position, !queryImpl.endAt.
|
|
5110
|
+
? new Bound(queryImpl.endAt.position, !queryImpl.endAt.inclusive)
|
|
4826
5111
|
: null;
|
|
4827
5112
|
const endAt = queryImpl.startAt
|
|
4828
|
-
? new Bound(queryImpl.startAt.position, !queryImpl.startAt.
|
|
5113
|
+
? new Bound(queryImpl.startAt.position, !queryImpl.startAt.inclusive)
|
|
4829
5114
|
: null;
|
|
4830
5115
|
// Now return as a LimitType.First query.
|
|
4831
5116
|
queryImpl.memoizedTarget = newTarget(queryImpl.path, queryImpl.collectionGroup, orderBys, queryImpl.filters, queryImpl.limit, startAt, endAt);
|
|
@@ -4913,11 +5198,11 @@ function queryMatchesFilters(query, doc) {
|
|
|
4913
5198
|
/** Makes sure a document is within the bounds, if provided. */
|
|
4914
5199
|
function queryMatchesBounds(query, doc) {
|
|
4915
5200
|
if (query.startAt &&
|
|
4916
|
-
!
|
|
5201
|
+
!boundSortsBeforeDocument(query.startAt, queryOrderBy(query), doc)) {
|
|
4917
5202
|
return false;
|
|
4918
5203
|
}
|
|
4919
5204
|
if (query.endAt &&
|
|
4920
|
-
|
|
5205
|
+
!boundSortsAfterDocument(query.endAt, queryOrderBy(query), doc)) {
|
|
4921
5206
|
return false;
|
|
4922
5207
|
}
|
|
4923
5208
|
return true;
|
|
@@ -6998,7 +7283,7 @@ class WatchChangeAggregator {
|
|
|
6998
7283
|
const targetData = this.targetDataForActiveTarget(targetId);
|
|
6999
7284
|
if (targetData) {
|
|
7000
7285
|
const target = targetData.target;
|
|
7001
|
-
if (
|
|
7286
|
+
if (targetIsDocumentTarget(target)) {
|
|
7002
7287
|
if (expectedCount === 0) {
|
|
7003
7288
|
// The existence filter told us the document does not exist. We deduce
|
|
7004
7289
|
// that this document does not exist and apply a deleted document to
|
|
@@ -7033,7 +7318,7 @@ class WatchChangeAggregator {
|
|
|
7033
7318
|
this.targetStates.forEach((targetState, targetId) => {
|
|
7034
7319
|
const targetData = this.targetDataForActiveTarget(targetId);
|
|
7035
7320
|
if (targetData) {
|
|
7036
|
-
if (targetState.current &&
|
|
7321
|
+
if (targetState.current && targetIsDocumentTarget(targetData.target)) {
|
|
7037
7322
|
// Document queries for document that don't exist can produce an empty
|
|
7038
7323
|
// result set. To update our local cache, we synthesize a document
|
|
7039
7324
|
// delete if we have not previously received the document. This
|
|
@@ -7796,10 +8081,10 @@ function toQueryTarget(serializer, target) {
|
|
|
7796
8081
|
result.structuredQuery.limit = limit;
|
|
7797
8082
|
}
|
|
7798
8083
|
if (target.startAt) {
|
|
7799
|
-
result.structuredQuery.startAt =
|
|
8084
|
+
result.structuredQuery.startAt = toStartAtCursor(target.startAt);
|
|
7800
8085
|
}
|
|
7801
8086
|
if (target.endAt) {
|
|
7802
|
-
result.structuredQuery.endAt =
|
|
8087
|
+
result.structuredQuery.endAt = toEndAtCursor(target.endAt);
|
|
7803
8088
|
}
|
|
7804
8089
|
return result;
|
|
7805
8090
|
}
|
|
@@ -7832,11 +8117,11 @@ function convertQueryTargetToQuery(target) {
|
|
|
7832
8117
|
}
|
|
7833
8118
|
let startAt = null;
|
|
7834
8119
|
if (query.startAt) {
|
|
7835
|
-
startAt =
|
|
8120
|
+
startAt = fromStartAtCursor(query.startAt);
|
|
7836
8121
|
}
|
|
7837
8122
|
let endAt = null;
|
|
7838
8123
|
if (query.endAt) {
|
|
7839
|
-
endAt =
|
|
8124
|
+
endAt = fromEndAtCursor(query.endAt);
|
|
7840
8125
|
}
|
|
7841
8126
|
return newQuery(path, collectionGroup, orderBy, filterBy, limit, "F" /* First */, startAt, endAt);
|
|
7842
8127
|
}
|
|
@@ -7869,7 +8154,7 @@ function toLabel(serializer, purpose) {
|
|
|
7869
8154
|
function toTarget(serializer, targetData) {
|
|
7870
8155
|
let result;
|
|
7871
8156
|
const target = targetData.target;
|
|
7872
|
-
if (
|
|
8157
|
+
if (targetIsDocumentTarget(target)) {
|
|
7873
8158
|
result = { documents: toDocumentsTarget(serializer, target) };
|
|
7874
8159
|
}
|
|
7875
8160
|
else {
|
|
@@ -7927,16 +8212,27 @@ function toOrder(orderBys) {
|
|
|
7927
8212
|
function fromOrder(orderBys) {
|
|
7928
8213
|
return orderBys.map(order => fromPropertyOrder(order));
|
|
7929
8214
|
}
|
|
7930
|
-
function
|
|
8215
|
+
function toStartAtCursor(cursor) {
|
|
8216
|
+
return {
|
|
8217
|
+
before: cursor.inclusive,
|
|
8218
|
+
values: cursor.position
|
|
8219
|
+
};
|
|
8220
|
+
}
|
|
8221
|
+
function toEndAtCursor(cursor) {
|
|
7931
8222
|
return {
|
|
7932
|
-
before: cursor.
|
|
8223
|
+
before: !cursor.inclusive,
|
|
7933
8224
|
values: cursor.position
|
|
7934
8225
|
};
|
|
7935
8226
|
}
|
|
7936
|
-
function
|
|
7937
|
-
const
|
|
8227
|
+
function fromStartAtCursor(cursor) {
|
|
8228
|
+
const inclusive = !!cursor.before;
|
|
8229
|
+
const position = cursor.values || [];
|
|
8230
|
+
return new Bound(position, inclusive);
|
|
8231
|
+
}
|
|
8232
|
+
function fromEndAtCursor(cursor) {
|
|
8233
|
+
const inclusive = !cursor.before;
|
|
7938
8234
|
const position = cursor.values || [];
|
|
7939
|
-
return new Bound(position,
|
|
8235
|
+
return new Bound(position, inclusive);
|
|
7940
8236
|
}
|
|
7941
8237
|
// visible for testing
|
|
7942
8238
|
function toDirection(dir) {
|
|
@@ -8319,7 +8615,7 @@ function toDbTarget(localSerializer, targetData) {
|
|
|
8319
8615
|
const dbTimestamp = toDbTimestamp(targetData.snapshotVersion);
|
|
8320
8616
|
const dbLastLimboFreeTimestamp = toDbTimestamp(targetData.lastLimboFreeSnapshotVersion);
|
|
8321
8617
|
let queryProto;
|
|
8322
|
-
if (
|
|
8618
|
+
if (targetIsDocumentTarget(targetData.target)) {
|
|
8323
8619
|
queryProto = toDocumentsTarget(localSerializer.remoteSerializer, targetData.target);
|
|
8324
8620
|
}
|
|
8325
8621
|
else {
|
|
@@ -8489,6 +8785,38 @@ class MemoryIndexManager {
|
|
|
8489
8785
|
getCollectionParents(transaction, collectionId) {
|
|
8490
8786
|
return PersistencePromise.resolve(this.collectionParentIndex.getEntries(collectionId));
|
|
8491
8787
|
}
|
|
8788
|
+
addFieldIndex(transaction, index) {
|
|
8789
|
+
// Field indices are not supported with memory persistence.
|
|
8790
|
+
return PersistencePromise.resolve();
|
|
8791
|
+
}
|
|
8792
|
+
deleteFieldIndex(transaction, index) {
|
|
8793
|
+
// Field indices are not supported with memory persistence.
|
|
8794
|
+
return PersistencePromise.resolve();
|
|
8795
|
+
}
|
|
8796
|
+
getDocumentsMatchingTarget(transaction, fieldIndex, target) {
|
|
8797
|
+
// Field indices are not supported with memory persistence.
|
|
8798
|
+
return PersistencePromise.resolve(documentKeySet());
|
|
8799
|
+
}
|
|
8800
|
+
getFieldIndex(transaction, target) {
|
|
8801
|
+
// Field indices are not supported with memory persistence.
|
|
8802
|
+
return PersistencePromise.resolve(null);
|
|
8803
|
+
}
|
|
8804
|
+
getFieldIndexes(transaction, collectionGroup) {
|
|
8805
|
+
// Field indices are not supported with memory persistence.
|
|
8806
|
+
return PersistencePromise.resolve([]);
|
|
8807
|
+
}
|
|
8808
|
+
getNextCollectionGroupToUpdate(transaction) {
|
|
8809
|
+
// Field indices are not supported with memory persistence.
|
|
8810
|
+
return PersistencePromise.resolve(null);
|
|
8811
|
+
}
|
|
8812
|
+
updateCollectionGroup(transaction, collectionGroup, offset) {
|
|
8813
|
+
// Field indices are not supported with memory persistence.
|
|
8814
|
+
return PersistencePromise.resolve();
|
|
8815
|
+
}
|
|
8816
|
+
updateIndexEntries(transaction, documents) {
|
|
8817
|
+
// Field indices are not supported with memory persistence.
|
|
8818
|
+
return PersistencePromise.resolve();
|
|
8819
|
+
}
|
|
8492
8820
|
}
|
|
8493
8821
|
/**
|
|
8494
8822
|
* Internal implementation of the collection-parent index exposed by MemoryIndexManager.
|
|
@@ -8597,6 +8925,38 @@ class IndexedDbIndexManager {
|
|
|
8597
8925
|
return parentPaths;
|
|
8598
8926
|
});
|
|
8599
8927
|
}
|
|
8928
|
+
addFieldIndex(transaction, index) {
|
|
8929
|
+
// TODO(indexing): Implement
|
|
8930
|
+
return PersistencePromise.resolve();
|
|
8931
|
+
}
|
|
8932
|
+
deleteFieldIndex(transaction, index) {
|
|
8933
|
+
// TODO(indexing): Implement
|
|
8934
|
+
return PersistencePromise.resolve();
|
|
8935
|
+
}
|
|
8936
|
+
getDocumentsMatchingTarget(transaction, fieldIndex, target) {
|
|
8937
|
+
// TODO(indexing): Implement
|
|
8938
|
+
return PersistencePromise.resolve(documentKeySet());
|
|
8939
|
+
}
|
|
8940
|
+
getFieldIndex(transaction, target) {
|
|
8941
|
+
// TODO(indexing): Implement
|
|
8942
|
+
return PersistencePromise.resolve(null);
|
|
8943
|
+
}
|
|
8944
|
+
getFieldIndexes(transaction, collectionGroup) {
|
|
8945
|
+
// TODO(indexing): Implement
|
|
8946
|
+
return PersistencePromise.resolve([]);
|
|
8947
|
+
}
|
|
8948
|
+
getNextCollectionGroupToUpdate(transaction) {
|
|
8949
|
+
// TODO(indexing): Implement
|
|
8950
|
+
return PersistencePromise.resolve(null);
|
|
8951
|
+
}
|
|
8952
|
+
updateCollectionGroup(transaction, collectionGroup, offset) {
|
|
8953
|
+
// TODO(indexing): Implement
|
|
8954
|
+
return PersistencePromise.resolve();
|
|
8955
|
+
}
|
|
8956
|
+
updateIndexEntries(transaction, documents) {
|
|
8957
|
+
// TODO(indexing): Implement
|
|
8958
|
+
return PersistencePromise.resolve();
|
|
8959
|
+
}
|
|
8600
8960
|
}
|
|
8601
8961
|
/**
|
|
8602
8962
|
* Helper to get a typed SimpleDbStore for the collectionParents
|
|
@@ -9767,7 +10127,7 @@ class IndexedDbLruDelegateImpl {
|
|
|
9767
10127
|
// Our size accounting requires us to read all documents before
|
|
9768
10128
|
// removing them.
|
|
9769
10129
|
return changeBuffer.getEntry(txn, docKey).next(() => {
|
|
9770
|
-
changeBuffer.removeEntry(docKey);
|
|
10130
|
+
changeBuffer.removeEntry(docKey, SnapshotVersion.min());
|
|
9771
10131
|
return documentTargetStore(txn).delete(sentinelKey$1(docKey));
|
|
9772
10132
|
});
|
|
9773
10133
|
}
|
|
@@ -10448,9 +10808,6 @@ class SchemaConverter {
|
|
|
10448
10808
|
* and local feature development.
|
|
10449
10809
|
*/
|
|
10450
10810
|
createOrUpgrade(db, txn, fromVersion, toVersion) {
|
|
10451
|
-
hardAssert(fromVersion < toVersion &&
|
|
10452
|
-
fromVersion >= 0 &&
|
|
10453
|
-
toVersion <= SCHEMA_VERSION);
|
|
10454
10811
|
const simpleDbTransaction = new SimpleDbTransaction('createOrUpgrade', txn);
|
|
10455
10812
|
if (fromVersion < 1 && toVersion >= 1) {
|
|
10456
10813
|
createPrimaryClientStore(db);
|
|
@@ -10517,6 +10874,11 @@ class SchemaConverter {
|
|
|
10517
10874
|
createNamedQueriesStore(db);
|
|
10518
10875
|
});
|
|
10519
10876
|
}
|
|
10877
|
+
if (fromVersion < 12 && toVersion >= 12) {
|
|
10878
|
+
p = p.next(() => {
|
|
10879
|
+
createFieldIndex(db);
|
|
10880
|
+
});
|
|
10881
|
+
}
|
|
10520
10882
|
return p;
|
|
10521
10883
|
}
|
|
10522
10884
|
addDocumentGlobal(txn) {
|
|
@@ -10723,6 +11085,17 @@ function createNamedQueriesStore(db) {
|
|
|
10723
11085
|
db.createObjectStore(DbNamedQuery.store, {
|
|
10724
11086
|
keyPath: DbNamedQuery.keyPath
|
|
10725
11087
|
});
|
|
11088
|
+
}
|
|
11089
|
+
function createFieldIndex(db) {
|
|
11090
|
+
db.createObjectStore(DbIndexConfiguration.store, {
|
|
11091
|
+
keyPath: DbIndexConfiguration.keyPath
|
|
11092
|
+
});
|
|
11093
|
+
db.createObjectStore(DbIndexState.store, {
|
|
11094
|
+
keyPath: DbIndexState.keyPath
|
|
11095
|
+
});
|
|
11096
|
+
db.createObjectStore(DbIndexEntries.store, {
|
|
11097
|
+
keyPath: DbIndexEntries.keyPath
|
|
11098
|
+
});
|
|
10726
11099
|
}
|
|
10727
11100
|
|
|
10728
11101
|
/**
|
|
@@ -13287,7 +13660,7 @@ class MemoryEagerDelegate {
|
|
|
13287
13660
|
const key = DocumentKey.fromPath(path);
|
|
13288
13661
|
return this.isReferenced(txn, key).next(isReferenced => {
|
|
13289
13662
|
if (!isReferenced) {
|
|
13290
|
-
changeBuffer.removeEntry(key);
|
|
13663
|
+
changeBuffer.removeEntry(key, SnapshotVersion.min());
|
|
13291
13664
|
}
|
|
13292
13665
|
});
|
|
13293
13666
|
}).next(() => {
|
|
@@ -20151,12 +20524,12 @@ async function syncEngineListen(syncEngine, query) {
|
|
|
20151
20524
|
}
|
|
20152
20525
|
else {
|
|
20153
20526
|
const targetData = await localStoreAllocateTarget(syncEngineImpl.localStore, queryToTarget(query));
|
|
20154
|
-
const status = syncEngineImpl.sharedClientState.addLocalQueryTarget(targetData.targetId);
|
|
20155
|
-
targetId = targetData.targetId;
|
|
20156
|
-
viewSnapshot = await initializeViewAndComputeSnapshot(syncEngineImpl, query, targetId, status === 'current');
|
|
20157
20527
|
if (syncEngineImpl.isPrimaryClient) {
|
|
20158
20528
|
remoteStoreListen(syncEngineImpl.remoteStore, targetData);
|
|
20159
20529
|
}
|
|
20530
|
+
const status = syncEngineImpl.sharedClientState.addLocalQueryTarget(targetData.targetId);
|
|
20531
|
+
targetId = targetData.targetId;
|
|
20532
|
+
viewSnapshot = await initializeViewAndComputeSnapshot(syncEngineImpl, query, targetId, status === 'current');
|
|
20160
20533
|
}
|
|
20161
20534
|
return viewSnapshot;
|
|
20162
20535
|
}
|
|
@@ -20344,6 +20717,9 @@ async function syncEngineRejectListen(syncEngine, targetId, err) {
|
|
|
20344
20717
|
// store to purge a document. However, it would be tricky to keep all of
|
|
20345
20718
|
// the local store's invariants with another method.
|
|
20346
20719
|
let documentUpdates = new SortedMap(DocumentKey.comparator);
|
|
20720
|
+
// TODO(b/217189216): This limbo document should ideally have a read time,
|
|
20721
|
+
// so that it is picked up by any read-time based scans. The backend,
|
|
20722
|
+
// however, does not send a read time for target removals.
|
|
20347
20723
|
documentUpdates = documentUpdates.insert(limboKey, MutableDocument.newNoDocument(limboKey, SnapshotVersion.min()));
|
|
20348
20724
|
const resolvedLimboDocuments = documentKeySet().add(limboKey);
|
|
20349
20725
|
const event = new RemoteEvent(SnapshotVersion.min(),
|
|
@@ -22288,72 +22664,6 @@ function createBundleReader(data, serializer) {
|
|
|
22288
22664
|
return newBundleReader(toByteStreamReader(content), serializer);
|
|
22289
22665
|
}
|
|
22290
22666
|
|
|
22291
|
-
/**
|
|
22292
|
-
* @license
|
|
22293
|
-
* Copyright 2017 Google LLC
|
|
22294
|
-
*
|
|
22295
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
22296
|
-
* you may not use this file except in compliance with the License.
|
|
22297
|
-
* You may obtain a copy of the License at
|
|
22298
|
-
*
|
|
22299
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
22300
|
-
*
|
|
22301
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
22302
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
22303
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22304
|
-
* See the License for the specific language governing permissions and
|
|
22305
|
-
* limitations under the License.
|
|
22306
|
-
*/
|
|
22307
|
-
class DatabaseInfo {
|
|
22308
|
-
/**
|
|
22309
|
-
* Constructs a DatabaseInfo using the provided host, databaseId and
|
|
22310
|
-
* persistenceKey.
|
|
22311
|
-
*
|
|
22312
|
-
* @param databaseId - The database to use.
|
|
22313
|
-
* @param appId - The Firebase App Id.
|
|
22314
|
-
* @param persistenceKey - A unique identifier for this Firestore's local
|
|
22315
|
-
* storage (used in conjunction with the databaseId).
|
|
22316
|
-
* @param host - The Firestore backend host to connect to.
|
|
22317
|
-
* @param ssl - Whether to use SSL when connecting.
|
|
22318
|
-
* @param forceLongPolling - Whether to use the forceLongPolling option
|
|
22319
|
-
* when using WebChannel as the network transport.
|
|
22320
|
-
* @param autoDetectLongPolling - Whether to use the detectBufferingProxy
|
|
22321
|
-
* option when using WebChannel as the network transport.
|
|
22322
|
-
* @param useFetchStreams Whether to use the Fetch API instead of
|
|
22323
|
-
* XMLHTTPRequest
|
|
22324
|
-
*/
|
|
22325
|
-
constructor(databaseId, appId, persistenceKey, host, ssl, forceLongPolling, autoDetectLongPolling, useFetchStreams) {
|
|
22326
|
-
this.databaseId = databaseId;
|
|
22327
|
-
this.appId = appId;
|
|
22328
|
-
this.persistenceKey = persistenceKey;
|
|
22329
|
-
this.host = host;
|
|
22330
|
-
this.ssl = ssl;
|
|
22331
|
-
this.forceLongPolling = forceLongPolling;
|
|
22332
|
-
this.autoDetectLongPolling = autoDetectLongPolling;
|
|
22333
|
-
this.useFetchStreams = useFetchStreams;
|
|
22334
|
-
}
|
|
22335
|
-
}
|
|
22336
|
-
/** The default database name for a project. */
|
|
22337
|
-
const DEFAULT_DATABASE_NAME = '(default)';
|
|
22338
|
-
/**
|
|
22339
|
-
* Represents the database ID a Firestore client is associated with.
|
|
22340
|
-
* @internal
|
|
22341
|
-
*/
|
|
22342
|
-
class DatabaseId {
|
|
22343
|
-
constructor(projectId, database) {
|
|
22344
|
-
this.projectId = projectId;
|
|
22345
|
-
this.database = database ? database : DEFAULT_DATABASE_NAME;
|
|
22346
|
-
}
|
|
22347
|
-
get isDefaultDatabase() {
|
|
22348
|
-
return this.database === DEFAULT_DATABASE_NAME;
|
|
22349
|
-
}
|
|
22350
|
-
isEqual(other) {
|
|
22351
|
-
return (other instanceof DatabaseId &&
|
|
22352
|
-
other.projectId === this.projectId &&
|
|
22353
|
-
other.database === this.database);
|
|
22354
|
-
}
|
|
22355
|
-
}
|
|
22356
|
-
|
|
22357
22667
|
/**
|
|
22358
22668
|
* @license
|
|
22359
22669
|
* Copyright 2020 Google LLC
|
|
@@ -24727,8 +25037,7 @@ class DocumentSnapshot extends DocumentSnapshot$1 {
|
|
|
24727
25037
|
this.metadata = metadata;
|
|
24728
25038
|
}
|
|
24729
25039
|
/**
|
|
24730
|
-
*
|
|
24731
|
-
* exists. True if the document exists.
|
|
25040
|
+
* Returns whether or not the data exists. True if the document exists.
|
|
24732
25041
|
*/
|
|
24733
25042
|
exists() {
|
|
24734
25043
|
return super.exists();
|
|
@@ -25102,51 +25411,53 @@ function limitToLast(limit) {
|
|
|
25102
25411
|
return new QueryLimitConstraint('limitToLast', limit, "L" /* Last */);
|
|
25103
25412
|
}
|
|
25104
25413
|
class QueryStartAtConstraint extends QueryConstraint {
|
|
25105
|
-
constructor(type, _docOrFields,
|
|
25414
|
+
constructor(type, _docOrFields, _inclusive) {
|
|
25106
25415
|
super();
|
|
25107
25416
|
this.type = type;
|
|
25108
25417
|
this._docOrFields = _docOrFields;
|
|
25109
|
-
this.
|
|
25418
|
+
this._inclusive = _inclusive;
|
|
25110
25419
|
}
|
|
25111
25420
|
_apply(query) {
|
|
25112
|
-
const bound = newQueryBoundFromDocOrFields(query, this.type, this._docOrFields, this.
|
|
25421
|
+
const bound = newQueryBoundFromDocOrFields(query, this.type, this._docOrFields, this._inclusive);
|
|
25113
25422
|
return new Query(query.firestore, query.converter, queryWithStartAt(query._query, bound));
|
|
25114
25423
|
}
|
|
25115
25424
|
}
|
|
25116
25425
|
function startAt(...docOrFields) {
|
|
25117
|
-
return new QueryStartAtConstraint('startAt', docOrFields,
|
|
25426
|
+
return new QueryStartAtConstraint('startAt', docOrFields,
|
|
25427
|
+
/*inclusive=*/ true);
|
|
25118
25428
|
}
|
|
25119
25429
|
function startAfter(...docOrFields) {
|
|
25120
25430
|
return new QueryStartAtConstraint('startAfter', docOrFields,
|
|
25121
|
-
/*
|
|
25431
|
+
/*inclusive=*/ false);
|
|
25122
25432
|
}
|
|
25123
25433
|
class QueryEndAtConstraint extends QueryConstraint {
|
|
25124
|
-
constructor(type, _docOrFields,
|
|
25434
|
+
constructor(type, _docOrFields, _inclusive) {
|
|
25125
25435
|
super();
|
|
25126
25436
|
this.type = type;
|
|
25127
25437
|
this._docOrFields = _docOrFields;
|
|
25128
|
-
this.
|
|
25438
|
+
this._inclusive = _inclusive;
|
|
25129
25439
|
}
|
|
25130
25440
|
_apply(query) {
|
|
25131
|
-
const bound = newQueryBoundFromDocOrFields(query, this.type, this._docOrFields, this.
|
|
25441
|
+
const bound = newQueryBoundFromDocOrFields(query, this.type, this._docOrFields, this._inclusive);
|
|
25132
25442
|
return new Query(query.firestore, query.converter, queryWithEndAt(query._query, bound));
|
|
25133
25443
|
}
|
|
25134
25444
|
}
|
|
25135
25445
|
function endBefore(...docOrFields) {
|
|
25136
|
-
return new QueryEndAtConstraint('endBefore', docOrFields,
|
|
25446
|
+
return new QueryEndAtConstraint('endBefore', docOrFields,
|
|
25447
|
+
/*inclusive=*/ false);
|
|
25137
25448
|
}
|
|
25138
25449
|
function endAt(...docOrFields) {
|
|
25139
|
-
return new QueryEndAtConstraint('endAt', docOrFields, /*
|
|
25450
|
+
return new QueryEndAtConstraint('endAt', docOrFields, /*inclusive=*/ true);
|
|
25140
25451
|
}
|
|
25141
25452
|
/** Helper function to create a bound from a document or fields */
|
|
25142
|
-
function newQueryBoundFromDocOrFields(query, methodName, docOrFields,
|
|
25453
|
+
function newQueryBoundFromDocOrFields(query, methodName, docOrFields, inclusive) {
|
|
25143
25454
|
docOrFields[0] = getModularInstance(docOrFields[0]);
|
|
25144
25455
|
if (docOrFields[0] instanceof DocumentSnapshot$1) {
|
|
25145
|
-
return newQueryBoundFromDocument(query._query, query.firestore._databaseId, methodName, docOrFields[0]._document,
|
|
25456
|
+
return newQueryBoundFromDocument(query._query, query.firestore._databaseId, methodName, docOrFields[0]._document, inclusive);
|
|
25146
25457
|
}
|
|
25147
25458
|
else {
|
|
25148
25459
|
const reader = newUserDataReader(query.firestore);
|
|
25149
|
-
return newQueryBoundFromFields(query._query, query.firestore._databaseId, reader, methodName, docOrFields,
|
|
25460
|
+
return newQueryBoundFromFields(query._query, query.firestore._databaseId, reader, methodName, docOrFields, inclusive);
|
|
25150
25461
|
}
|
|
25151
25462
|
}
|
|
25152
25463
|
function newQueryFilter(query, methodName, dataReader, databaseId, fieldPath, op, value) {
|
|
@@ -25204,7 +25515,7 @@ function newQueryOrderBy(query, fieldPath, direction) {
|
|
|
25204
25515
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
25205
25516
|
* server timestamp.
|
|
25206
25517
|
*/
|
|
25207
|
-
function newQueryBoundFromDocument(query, databaseId, methodName, doc,
|
|
25518
|
+
function newQueryBoundFromDocument(query, databaseId, methodName, doc, inclusive) {
|
|
25208
25519
|
if (!doc) {
|
|
25209
25520
|
throw new FirestoreError(Code.NOT_FOUND, `Can't use a DocumentSnapshot that doesn't exist for ` +
|
|
25210
25521
|
`${methodName}().`);
|
|
@@ -25241,12 +25552,12 @@ function newQueryBoundFromDocument(query, databaseId, methodName, doc, before) {
|
|
|
25241
25552
|
}
|
|
25242
25553
|
}
|
|
25243
25554
|
}
|
|
25244
|
-
return new Bound(components,
|
|
25555
|
+
return new Bound(components, inclusive);
|
|
25245
25556
|
}
|
|
25246
25557
|
/**
|
|
25247
25558
|
* Converts a list of field values to a `Bound` for the given query.
|
|
25248
25559
|
*/
|
|
25249
|
-
function newQueryBoundFromFields(query, databaseId, dataReader, methodName, values,
|
|
25560
|
+
function newQueryBoundFromFields(query, databaseId, dataReader, methodName, values, inclusive) {
|
|
25250
25561
|
// Use explicit order by's because it has to match the query the user made
|
|
25251
25562
|
const orderBy = query.explicitOrderBy;
|
|
25252
25563
|
if (values.length > orderBy.length) {
|
|
@@ -25283,7 +25594,7 @@ function newQueryBoundFromFields(query, databaseId, dataReader, methodName, valu
|
|
|
25283
25594
|
components.push(wrapped);
|
|
25284
25595
|
}
|
|
25285
25596
|
}
|
|
25286
|
-
return new Bound(components,
|
|
25597
|
+
return new Bound(components, inclusive);
|
|
25287
25598
|
}
|
|
25288
25599
|
/**
|
|
25289
25600
|
* Parses the given `documentIdValue` into a `ReferenceValue`, throwing
|
|
@@ -26268,125 +26579,6 @@ function writeBatch(firestore) {
|
|
|
26268
26579
|
return new WriteBatch(firestore, mutations => executeWrite(firestore, mutations));
|
|
26269
26580
|
}
|
|
26270
26581
|
|
|
26271
|
-
/**
|
|
26272
|
-
* @license
|
|
26273
|
-
* Copyright 2021 Google LLC
|
|
26274
|
-
*
|
|
26275
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
26276
|
-
* you may not use this file except in compliance with the License.
|
|
26277
|
-
* You may obtain a copy of the License at
|
|
26278
|
-
*
|
|
26279
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
26280
|
-
*
|
|
26281
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
26282
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
26283
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26284
|
-
* See the License for the specific language governing permissions and
|
|
26285
|
-
* limitations under the License.
|
|
26286
|
-
*/
|
|
26287
|
-
/**
|
|
26288
|
-
* The initial mutation batch id for each index. Gets updated during index
|
|
26289
|
-
* backfill.
|
|
26290
|
-
*/
|
|
26291
|
-
const INITIAL_LARGEST_BATCH_ID = -1;
|
|
26292
|
-
/**
|
|
26293
|
-
* The initial sequence number for each index. Gets updated during index
|
|
26294
|
-
* backfill.
|
|
26295
|
-
*/
|
|
26296
|
-
const INITIAL_SEQUENCE_NUMBER = 0;
|
|
26297
|
-
/**
|
|
26298
|
-
* An index definition for field indexes in Firestore.
|
|
26299
|
-
*
|
|
26300
|
-
* Every index is associated with a collection. The definition contains a list
|
|
26301
|
-
* of fields and their index kind (which can be `ASCENDING`, `DESCENDING` or
|
|
26302
|
-
* `CONTAINS` for ArrayContains/ArrayContainsAny queries).
|
|
26303
|
-
*
|
|
26304
|
-
* Unlike the backend, the SDK does not differentiate between collection or
|
|
26305
|
-
* collection group-scoped indices. Every index can be used for both single
|
|
26306
|
-
* collection and collection group queries.
|
|
26307
|
-
*/
|
|
26308
|
-
class FieldIndex {
|
|
26309
|
-
constructor(
|
|
26310
|
-
/**
|
|
26311
|
-
* The index ID. Returns -1 if the index ID is not available (e.g. the index
|
|
26312
|
-
* has not yet been persisted).
|
|
26313
|
-
*/
|
|
26314
|
-
indexId,
|
|
26315
|
-
/** The collection ID this index applies to. */
|
|
26316
|
-
collectionGroup,
|
|
26317
|
-
/** The field segments for this index. */
|
|
26318
|
-
segments,
|
|
26319
|
-
/** Shows how up-to-date the index is for the current user. */
|
|
26320
|
-
indexState) {
|
|
26321
|
-
this.indexId = indexId;
|
|
26322
|
-
this.collectionGroup = collectionGroup;
|
|
26323
|
-
this.segments = segments;
|
|
26324
|
-
this.indexState = indexState;
|
|
26325
|
-
}
|
|
26326
|
-
}
|
|
26327
|
-
/** An ID for an index that has not yet been added to persistence. */
|
|
26328
|
-
FieldIndex.UNKNOWN_ID = -1;
|
|
26329
|
-
/** An index component consisting of field path and index type. */
|
|
26330
|
-
class IndexSegment {
|
|
26331
|
-
constructor(
|
|
26332
|
-
/** The field path of the component. */
|
|
26333
|
-
fieldPath,
|
|
26334
|
-
/** The fields sorting order. */
|
|
26335
|
-
kind) {
|
|
26336
|
-
this.fieldPath = fieldPath;
|
|
26337
|
-
this.kind = kind;
|
|
26338
|
-
}
|
|
26339
|
-
}
|
|
26340
|
-
/**
|
|
26341
|
-
* Stores the "high water mark" that indicates how updated the Index is for the
|
|
26342
|
-
* current user.
|
|
26343
|
-
*/
|
|
26344
|
-
class IndexState {
|
|
26345
|
-
constructor(
|
|
26346
|
-
/**
|
|
26347
|
-
* Indicates when the index was last updated (relative to other indexes).
|
|
26348
|
-
*/
|
|
26349
|
-
sequenceNumber,
|
|
26350
|
-
/** The the latest indexed read time, document and batch id. */
|
|
26351
|
-
offset) {
|
|
26352
|
-
this.sequenceNumber = sequenceNumber;
|
|
26353
|
-
this.offset = offset;
|
|
26354
|
-
}
|
|
26355
|
-
/** The state of an index that has not yet been backfilled. */
|
|
26356
|
-
static empty() {
|
|
26357
|
-
return new IndexState(INITIAL_SEQUENCE_NUMBER, IndexOffset.min());
|
|
26358
|
-
}
|
|
26359
|
-
}
|
|
26360
|
-
/**
|
|
26361
|
-
* Stores the latest read time, document and batch ID that were processed for an
|
|
26362
|
-
* index.
|
|
26363
|
-
*/
|
|
26364
|
-
class IndexOffset {
|
|
26365
|
-
constructor(
|
|
26366
|
-
/**
|
|
26367
|
-
* The latest read time version that has been indexed by Firestore for this
|
|
26368
|
-
* field index.
|
|
26369
|
-
*/
|
|
26370
|
-
readTime,
|
|
26371
|
-
/**
|
|
26372
|
-
* The key of the last document that was indexed for this query. Use
|
|
26373
|
-
* `DocumentKey.empty()` if no document has been indexed.
|
|
26374
|
-
*/
|
|
26375
|
-
documentKey,
|
|
26376
|
-
/*
|
|
26377
|
-
* The largest mutation batch id that's been processed by Firestore.
|
|
26378
|
-
*/
|
|
26379
|
-
largestBatchId) {
|
|
26380
|
-
this.readTime = readTime;
|
|
26381
|
-
this.documentKey = documentKey;
|
|
26382
|
-
this.largestBatchId = largestBatchId;
|
|
26383
|
-
}
|
|
26384
|
-
/** The state of an index that has not yet been backfilled. */
|
|
26385
|
-
static min() {
|
|
26386
|
-
return new IndexOffset(SnapshotVersion.min(), DocumentKey.empty(), INITIAL_LARGEST_BATCH_ID);
|
|
26387
|
-
}
|
|
26388
|
-
}
|
|
26389
|
-
|
|
26390
26582
|
/**
|
|
26391
26583
|
* @license
|
|
26392
26584
|
* Copyright 2021 Google LLC
|