@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.cjs.js
CHANGED
|
@@ -12,7 +12,7 @@ var grpcJs = require('@grpc/grpc-js');
|
|
|
12
12
|
var protoLoader = require('@grpc/proto-loader');
|
|
13
13
|
|
|
14
14
|
const name = "@firebase/firestore";
|
|
15
|
-
const version$1 = "3.4.4-canary.
|
|
15
|
+
const version$1 = "3.4.4-canary.6c8eabfc5";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @license
|
|
@@ -65,7 +65,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
65
65
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
66
66
|
User.MOCK_USER = new User('mock-user');
|
|
67
67
|
|
|
68
|
-
const version = "9.6.
|
|
68
|
+
const version = "9.6.6-canary.6c8eabfc5";
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* @license
|
|
@@ -1196,23 +1196,6 @@ function decodeResourcePath(path) {
|
|
|
1196
1196
|
}
|
|
1197
1197
|
return new ResourcePath(segments);
|
|
1198
1198
|
}
|
|
1199
|
-
|
|
1200
|
-
/**
|
|
1201
|
-
* @license
|
|
1202
|
-
* Copyright 2017 Google LLC
|
|
1203
|
-
*
|
|
1204
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1205
|
-
* you may not use this file except in compliance with the License.
|
|
1206
|
-
* You may obtain a copy of the License at
|
|
1207
|
-
*
|
|
1208
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1209
|
-
*
|
|
1210
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1211
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1212
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1213
|
-
* See the License for the specific language governing permissions and
|
|
1214
|
-
* limitations under the License.
|
|
1215
|
-
*/
|
|
1216
1199
|
/**
|
|
1217
1200
|
* Schema Version for the Web client:
|
|
1218
1201
|
* 1. Initial version including Mutation Queue, Query Cache, and Remote
|
|
@@ -1231,6 +1214,7 @@ function decodeResourcePath(path) {
|
|
|
1231
1214
|
* an auto-incrementing ID. This is required for Index-Free queries.
|
|
1232
1215
|
* 10. Rewrite the canonical IDs to the explicit Protobuf-based format.
|
|
1233
1216
|
* 11. Add bundles and named_queries for bundle support.
|
|
1217
|
+
* 12. Add indexing support.
|
|
1234
1218
|
*/
|
|
1235
1219
|
const SCHEMA_VERSION = 11;
|
|
1236
1220
|
/**
|
|
@@ -1757,9 +1741,7 @@ class DbClientMetadata {
|
|
|
1757
1741
|
DbClientMetadata.store = 'clientMetadata';
|
|
1758
1742
|
/** Keys are automatically assigned via the clientId properties. */
|
|
1759
1743
|
DbClientMetadata.keyPath = 'clientId';
|
|
1760
|
-
/**
|
|
1761
|
-
* A object representing a bundle loaded by the SDK.
|
|
1762
|
-
*/
|
|
1744
|
+
/** An object representing a bundle loaded by the SDK. */
|
|
1763
1745
|
class DbBundle {
|
|
1764
1746
|
constructor(
|
|
1765
1747
|
/** The ID of the loaded bundle. */
|
|
@@ -1776,9 +1758,7 @@ class DbBundle {
|
|
|
1776
1758
|
/** Name of the IndexedDb object store. */
|
|
1777
1759
|
DbBundle.store = 'bundles';
|
|
1778
1760
|
DbBundle.keyPath = 'bundleId';
|
|
1779
|
-
/**
|
|
1780
|
-
* A object representing a named query loaded by the SDK via a bundle.
|
|
1781
|
-
*/
|
|
1761
|
+
/** An object representing a named query loaded by the SDK via a bundle. */
|
|
1782
1762
|
class DbNamedQuery {
|
|
1783
1763
|
constructor(
|
|
1784
1764
|
/** The name of the query. */
|
|
@@ -1795,6 +1775,93 @@ class DbNamedQuery {
|
|
|
1795
1775
|
/** Name of the IndexedDb object store. */
|
|
1796
1776
|
DbNamedQuery.store = 'namedQueries';
|
|
1797
1777
|
DbNamedQuery.keyPath = 'name';
|
|
1778
|
+
/** An object representing the global configuration for a field index. */
|
|
1779
|
+
class DbIndexConfiguration {
|
|
1780
|
+
constructor(
|
|
1781
|
+
/** The index id for this entry. */
|
|
1782
|
+
indexId,
|
|
1783
|
+
/** The collection group this index belongs to. */
|
|
1784
|
+
collectionGroup,
|
|
1785
|
+
/** The fields to index for this index. */
|
|
1786
|
+
fields) {
|
|
1787
|
+
this.indexId = indexId;
|
|
1788
|
+
this.collectionGroup = collectionGroup;
|
|
1789
|
+
this.fields = fields;
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
/** Name of the IndexedDb object store. */
|
|
1793
|
+
DbIndexConfiguration.store = 'indexConfiguration';
|
|
1794
|
+
DbIndexConfiguration.keyPath = 'indexId';
|
|
1795
|
+
/**
|
|
1796
|
+
* An object describing how up-to-date the index backfill is for each user and
|
|
1797
|
+
* index.
|
|
1798
|
+
*/
|
|
1799
|
+
class DbIndexState {
|
|
1800
|
+
constructor(
|
|
1801
|
+
/** The index id for this entry. */
|
|
1802
|
+
indexId,
|
|
1803
|
+
/** The user id for this entry. */
|
|
1804
|
+
uid,
|
|
1805
|
+
/**
|
|
1806
|
+
* A number that indicates when the index was last updated (relative to
|
|
1807
|
+
* other indexes).
|
|
1808
|
+
*/
|
|
1809
|
+
sequenceNumber,
|
|
1810
|
+
/**
|
|
1811
|
+
* The latest read time that has been indexed by Firestore for this field
|
|
1812
|
+
* index. Set to `{seconds: 0, nanos: 0}` if no documents have been indexed.
|
|
1813
|
+
*/
|
|
1814
|
+
readTime,
|
|
1815
|
+
/**
|
|
1816
|
+
* The last document that has been indexed for this field index. Empty if
|
|
1817
|
+
* no documents have been indexed.
|
|
1818
|
+
*/
|
|
1819
|
+
documentKey,
|
|
1820
|
+
/**
|
|
1821
|
+
* The largest mutation batch id that has been processed for this index. -1
|
|
1822
|
+
* if no mutations have been indexed.
|
|
1823
|
+
*/
|
|
1824
|
+
largestBatchId) {
|
|
1825
|
+
this.indexId = indexId;
|
|
1826
|
+
this.uid = uid;
|
|
1827
|
+
this.sequenceNumber = sequenceNumber;
|
|
1828
|
+
this.readTime = readTime;
|
|
1829
|
+
this.documentKey = documentKey;
|
|
1830
|
+
this.largestBatchId = largestBatchId;
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
/** Name of the IndexedDb object store. */
|
|
1834
|
+
DbIndexState.store = 'indexState';
|
|
1835
|
+
DbIndexState.keyPath = ['indexId', 'uid'];
|
|
1836
|
+
/** An object that stores the encoded entries for all documents and fields. */
|
|
1837
|
+
class DbIndexEntries {
|
|
1838
|
+
constructor(
|
|
1839
|
+
/** The index id for this entry. */
|
|
1840
|
+
indexId,
|
|
1841
|
+
/** The user id for this entry. */
|
|
1842
|
+
uid,
|
|
1843
|
+
/** The encoded array index value for this entry. */
|
|
1844
|
+
arrayValue,
|
|
1845
|
+
/** The encoded directional value for equality and inequality filters. */
|
|
1846
|
+
directionalValue,
|
|
1847
|
+
/** The document key this entry points to. */
|
|
1848
|
+
documentKey) {
|
|
1849
|
+
this.indexId = indexId;
|
|
1850
|
+
this.uid = uid;
|
|
1851
|
+
this.arrayValue = arrayValue;
|
|
1852
|
+
this.directionalValue = directionalValue;
|
|
1853
|
+
this.documentKey = documentKey;
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
/** Name of the IndexedDb object store. */
|
|
1857
|
+
DbIndexEntries.store = 'indexEntries';
|
|
1858
|
+
DbIndexEntries.keyPath = [
|
|
1859
|
+
'indexId',
|
|
1860
|
+
'uid',
|
|
1861
|
+
'arrayValue',
|
|
1862
|
+
'directionalValue',
|
|
1863
|
+
'documentKey'
|
|
1864
|
+
];
|
|
1798
1865
|
// Visible for testing
|
|
1799
1866
|
const V1_STORES = [
|
|
1800
1867
|
DbMutationQueue.store,
|
|
@@ -1809,7 +1876,6 @@ const V1_STORES = [
|
|
|
1809
1876
|
// V2 is no longer usable (see comment at top of file)
|
|
1810
1877
|
// Visible for testing
|
|
1811
1878
|
const V3_STORES = V1_STORES;
|
|
1812
|
-
// Visible for testing
|
|
1813
1879
|
// Note: DbRemoteDocumentChanges is no longer used and dropped with v9.
|
|
1814
1880
|
const V4_STORES = [...V3_STORES, DbClientMetadata.store];
|
|
1815
1881
|
// V5 does not change the set of stores.
|
|
@@ -1819,6 +1885,12 @@ const V8_STORES = [...V6_STORES, DbCollectionParent.store];
|
|
|
1819
1885
|
// V9 does not change the set of stores.
|
|
1820
1886
|
// V10 does not change the set of stores.
|
|
1821
1887
|
const V11_STORES = [...V8_STORES, DbBundle.store, DbNamedQuery.store];
|
|
1888
|
+
[
|
|
1889
|
+
...V11_STORES,
|
|
1890
|
+
DbIndexConfiguration.store,
|
|
1891
|
+
DbIndexState.store,
|
|
1892
|
+
DbIndexEntries.store
|
|
1893
|
+
];
|
|
1822
1894
|
/**
|
|
1823
1895
|
* The list of all default IndexedDB stores used throughout the SDK. This is
|
|
1824
1896
|
* used when creating transactions so that access across all stores is done
|
|
@@ -2121,6 +2193,15 @@ class SimpleDbTransaction {
|
|
|
2121
2193
|
this.transaction.abort();
|
|
2122
2194
|
}
|
|
2123
2195
|
}
|
|
2196
|
+
maybeCommit() {
|
|
2197
|
+
// If the browser supports V3 IndexedDB, we invoke commit() explicitly to
|
|
2198
|
+
// speed up index DB processing if the event loop remains blocks.
|
|
2199
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2200
|
+
const maybeV3IndexedDb = this.transaction;
|
|
2201
|
+
if (!this.aborted && typeof maybeV3IndexedDb.commit === 'function') {
|
|
2202
|
+
maybeV3IndexedDb.commit();
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2124
2205
|
/**
|
|
2125
2206
|
* Returns a SimpleDbStore<KeyType, ValueType> for the specified store. All
|
|
2126
2207
|
* operations performed on the SimpleDbStore happen within the context of this
|
|
@@ -2317,6 +2398,10 @@ class SimpleDb {
|
|
|
2317
2398
|
this.db = await this.ensureDb(action);
|
|
2318
2399
|
const transaction = SimpleDbTransaction.open(this.db, action, readonly ? 'readonly' : 'readwrite', objectStores);
|
|
2319
2400
|
const transactionFnResult = transactionFn(transaction)
|
|
2401
|
+
.next(result => {
|
|
2402
|
+
transaction.maybeCommit();
|
|
2403
|
+
return result;
|
|
2404
|
+
})
|
|
2320
2405
|
.catch(error => {
|
|
2321
2406
|
// Abort the transaction if there was an error.
|
|
2322
2407
|
transaction.abort(error);
|
|
@@ -3378,6 +3463,75 @@ function getLocalWriteTime(value) {
|
|
|
3378
3463
|
return new Timestamp(localWriteTime.seconds, localWriteTime.nanos);
|
|
3379
3464
|
}
|
|
3380
3465
|
|
|
3466
|
+
/**
|
|
3467
|
+
* @license
|
|
3468
|
+
* Copyright 2017 Google LLC
|
|
3469
|
+
*
|
|
3470
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3471
|
+
* you may not use this file except in compliance with the License.
|
|
3472
|
+
* You may obtain a copy of the License at
|
|
3473
|
+
*
|
|
3474
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3475
|
+
*
|
|
3476
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3477
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3478
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3479
|
+
* See the License for the specific language governing permissions and
|
|
3480
|
+
* limitations under the License.
|
|
3481
|
+
*/
|
|
3482
|
+
class DatabaseInfo {
|
|
3483
|
+
/**
|
|
3484
|
+
* Constructs a DatabaseInfo using the provided host, databaseId and
|
|
3485
|
+
* persistenceKey.
|
|
3486
|
+
*
|
|
3487
|
+
* @param databaseId - The database to use.
|
|
3488
|
+
* @param appId - The Firebase App Id.
|
|
3489
|
+
* @param persistenceKey - A unique identifier for this Firestore's local
|
|
3490
|
+
* storage (used in conjunction with the databaseId).
|
|
3491
|
+
* @param host - The Firestore backend host to connect to.
|
|
3492
|
+
* @param ssl - Whether to use SSL when connecting.
|
|
3493
|
+
* @param forceLongPolling - Whether to use the forceLongPolling option
|
|
3494
|
+
* when using WebChannel as the network transport.
|
|
3495
|
+
* @param autoDetectLongPolling - Whether to use the detectBufferingProxy
|
|
3496
|
+
* option when using WebChannel as the network transport.
|
|
3497
|
+
* @param useFetchStreams Whether to use the Fetch API instead of
|
|
3498
|
+
* XMLHTTPRequest
|
|
3499
|
+
*/
|
|
3500
|
+
constructor(databaseId, appId, persistenceKey, host, ssl, forceLongPolling, autoDetectLongPolling, useFetchStreams) {
|
|
3501
|
+
this.databaseId = databaseId;
|
|
3502
|
+
this.appId = appId;
|
|
3503
|
+
this.persistenceKey = persistenceKey;
|
|
3504
|
+
this.host = host;
|
|
3505
|
+
this.ssl = ssl;
|
|
3506
|
+
this.forceLongPolling = forceLongPolling;
|
|
3507
|
+
this.autoDetectLongPolling = autoDetectLongPolling;
|
|
3508
|
+
this.useFetchStreams = useFetchStreams;
|
|
3509
|
+
}
|
|
3510
|
+
}
|
|
3511
|
+
/** The default database name for a project. */
|
|
3512
|
+
const DEFAULT_DATABASE_NAME = '(default)';
|
|
3513
|
+
/**
|
|
3514
|
+
* Represents the database ID a Firestore client is associated with.
|
|
3515
|
+
* @internal
|
|
3516
|
+
*/
|
|
3517
|
+
class DatabaseId {
|
|
3518
|
+
constructor(projectId, database) {
|
|
3519
|
+
this.projectId = projectId;
|
|
3520
|
+
this.database = database ? database : DEFAULT_DATABASE_NAME;
|
|
3521
|
+
}
|
|
3522
|
+
static empty() {
|
|
3523
|
+
return new DatabaseId('', '');
|
|
3524
|
+
}
|
|
3525
|
+
get isDefaultDatabase() {
|
|
3526
|
+
return this.database === DEFAULT_DATABASE_NAME;
|
|
3527
|
+
}
|
|
3528
|
+
isEqual(other) {
|
|
3529
|
+
return (other instanceof DatabaseId &&
|
|
3530
|
+
other.projectId === this.projectId &&
|
|
3531
|
+
other.database === this.database);
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
|
|
3381
3535
|
/**
|
|
3382
3536
|
* @license
|
|
3383
3537
|
* Copyright 2017 Google LLC
|
|
@@ -4233,6 +4387,125 @@ function compareDocumentsByField(field, d1, d2) {
|
|
|
4233
4387
|
}
|
|
4234
4388
|
}
|
|
4235
4389
|
|
|
4390
|
+
/**
|
|
4391
|
+
* @license
|
|
4392
|
+
* Copyright 2021 Google LLC
|
|
4393
|
+
*
|
|
4394
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4395
|
+
* you may not use this file except in compliance with the License.
|
|
4396
|
+
* You may obtain a copy of the License at
|
|
4397
|
+
*
|
|
4398
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4399
|
+
*
|
|
4400
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4401
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4402
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4403
|
+
* See the License for the specific language governing permissions and
|
|
4404
|
+
* limitations under the License.
|
|
4405
|
+
*/
|
|
4406
|
+
/**
|
|
4407
|
+
* The initial mutation batch id for each index. Gets updated during index
|
|
4408
|
+
* backfill.
|
|
4409
|
+
*/
|
|
4410
|
+
const INITIAL_LARGEST_BATCH_ID = -1;
|
|
4411
|
+
/**
|
|
4412
|
+
* The initial sequence number for each index. Gets updated during index
|
|
4413
|
+
* backfill.
|
|
4414
|
+
*/
|
|
4415
|
+
const INITIAL_SEQUENCE_NUMBER = 0;
|
|
4416
|
+
/**
|
|
4417
|
+
* An index definition for field indexes in Firestore.
|
|
4418
|
+
*
|
|
4419
|
+
* Every index is associated with a collection. The definition contains a list
|
|
4420
|
+
* of fields and their index kind (which can be `ASCENDING`, `DESCENDING` or
|
|
4421
|
+
* `CONTAINS` for ArrayContains/ArrayContainsAny queries).
|
|
4422
|
+
*
|
|
4423
|
+
* Unlike the backend, the SDK does not differentiate between collection or
|
|
4424
|
+
* collection group-scoped indices. Every index can be used for both single
|
|
4425
|
+
* collection and collection group queries.
|
|
4426
|
+
*/
|
|
4427
|
+
class FieldIndex {
|
|
4428
|
+
constructor(
|
|
4429
|
+
/**
|
|
4430
|
+
* The index ID. Returns -1 if the index ID is not available (e.g. the index
|
|
4431
|
+
* has not yet been persisted).
|
|
4432
|
+
*/
|
|
4433
|
+
indexId,
|
|
4434
|
+
/** The collection ID this index applies to. */
|
|
4435
|
+
collectionGroup,
|
|
4436
|
+
/** The field segments for this index. */
|
|
4437
|
+
segments,
|
|
4438
|
+
/** Shows how up-to-date the index is for the current user. */
|
|
4439
|
+
indexState) {
|
|
4440
|
+
this.indexId = indexId;
|
|
4441
|
+
this.collectionGroup = collectionGroup;
|
|
4442
|
+
this.segments = segments;
|
|
4443
|
+
this.indexState = indexState;
|
|
4444
|
+
}
|
|
4445
|
+
}
|
|
4446
|
+
/** An ID for an index that has not yet been added to persistence. */
|
|
4447
|
+
FieldIndex.UNKNOWN_ID = -1;
|
|
4448
|
+
/** An index component consisting of field path and index type. */
|
|
4449
|
+
class IndexSegment {
|
|
4450
|
+
constructor(
|
|
4451
|
+
/** The field path of the component. */
|
|
4452
|
+
fieldPath,
|
|
4453
|
+
/** The fields sorting order. */
|
|
4454
|
+
kind) {
|
|
4455
|
+
this.fieldPath = fieldPath;
|
|
4456
|
+
this.kind = kind;
|
|
4457
|
+
}
|
|
4458
|
+
}
|
|
4459
|
+
/**
|
|
4460
|
+
* Stores the "high water mark" that indicates how updated the Index is for the
|
|
4461
|
+
* current user.
|
|
4462
|
+
*/
|
|
4463
|
+
class IndexState {
|
|
4464
|
+
constructor(
|
|
4465
|
+
/**
|
|
4466
|
+
* Indicates when the index was last updated (relative to other indexes).
|
|
4467
|
+
*/
|
|
4468
|
+
sequenceNumber,
|
|
4469
|
+
/** The the latest indexed read time, document and batch id. */
|
|
4470
|
+
offset) {
|
|
4471
|
+
this.sequenceNumber = sequenceNumber;
|
|
4472
|
+
this.offset = offset;
|
|
4473
|
+
}
|
|
4474
|
+
/** The state of an index that has not yet been backfilled. */
|
|
4475
|
+
static empty() {
|
|
4476
|
+
return new IndexState(INITIAL_SEQUENCE_NUMBER, IndexOffset.min());
|
|
4477
|
+
}
|
|
4478
|
+
}
|
|
4479
|
+
/**
|
|
4480
|
+
* Stores the latest read time, document and batch ID that were processed for an
|
|
4481
|
+
* index.
|
|
4482
|
+
*/
|
|
4483
|
+
class IndexOffset {
|
|
4484
|
+
constructor(
|
|
4485
|
+
/**
|
|
4486
|
+
* The latest read time version that has been indexed by Firestore for this
|
|
4487
|
+
* field index.
|
|
4488
|
+
*/
|
|
4489
|
+
readTime,
|
|
4490
|
+
/**
|
|
4491
|
+
* The key of the last document that was indexed for this query. Use
|
|
4492
|
+
* `DocumentKey.empty()` if no document has been indexed.
|
|
4493
|
+
*/
|
|
4494
|
+
documentKey,
|
|
4495
|
+
/*
|
|
4496
|
+
* The largest mutation batch id that's been processed by Firestore.
|
|
4497
|
+
*/
|
|
4498
|
+
largestBatchId) {
|
|
4499
|
+
this.readTime = readTime;
|
|
4500
|
+
this.documentKey = documentKey;
|
|
4501
|
+
this.largestBatchId = largestBatchId;
|
|
4502
|
+
}
|
|
4503
|
+
/** The state of an index that has not yet been backfilled. */
|
|
4504
|
+
static min() {
|
|
4505
|
+
return new IndexOffset(SnapshotVersion.min(), DocumentKey.empty(), INITIAL_LARGEST_BATCH_ID);
|
|
4506
|
+
}
|
|
4507
|
+
}
|
|
4508
|
+
|
|
4236
4509
|
/**
|
|
4237
4510
|
* @license
|
|
4238
4511
|
* Copyright 2019 Google LLC
|
|
@@ -4276,27 +4549,29 @@ function newTarget(path, collectionGroup = null, orderBy = [], filters = [], lim
|
|
|
4276
4549
|
function canonifyTarget(target) {
|
|
4277
4550
|
const targetImpl = debugCast(target);
|
|
4278
4551
|
if (targetImpl.memoizedCanonicalId === null) {
|
|
4279
|
-
let
|
|
4552
|
+
let str = targetImpl.path.canonicalString();
|
|
4280
4553
|
if (targetImpl.collectionGroup !== null) {
|
|
4281
|
-
|
|
4554
|
+
str += '|cg:' + targetImpl.collectionGroup;
|
|
4282
4555
|
}
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4556
|
+
str += '|f:';
|
|
4557
|
+
str += targetImpl.filters.map(f => canonifyFilter(f)).join(',');
|
|
4558
|
+
str += '|ob:';
|
|
4559
|
+
str += targetImpl.orderBy.map(o => canonifyOrderBy(o)).join(',');
|
|
4287
4560
|
if (!isNullOrUndefined(targetImpl.limit)) {
|
|
4288
|
-
|
|
4289
|
-
|
|
4561
|
+
str += '|l:';
|
|
4562
|
+
str += targetImpl.limit;
|
|
4290
4563
|
}
|
|
4291
4564
|
if (targetImpl.startAt) {
|
|
4292
|
-
|
|
4293
|
-
|
|
4565
|
+
str += '|lb:';
|
|
4566
|
+
str += targetImpl.startAt.inclusive ? 'b:' : 'a:';
|
|
4567
|
+
str += targetImpl.startAt.position.map(p => canonicalId(p)).join(',');
|
|
4294
4568
|
}
|
|
4295
4569
|
if (targetImpl.endAt) {
|
|
4296
|
-
|
|
4297
|
-
|
|
4570
|
+
str += '|ub:';
|
|
4571
|
+
str += targetImpl.endAt.inclusive ? 'a:' : 'b:';
|
|
4572
|
+
str += targetImpl.endAt.position.map(p => canonicalId(p)).join(',');
|
|
4298
4573
|
}
|
|
4299
|
-
targetImpl.memoizedCanonicalId =
|
|
4574
|
+
targetImpl.memoizedCanonicalId = str;
|
|
4300
4575
|
}
|
|
4301
4576
|
return targetImpl.memoizedCanonicalId;
|
|
4302
4577
|
}
|
|
@@ -4319,10 +4594,14 @@ function stringifyTarget(target) {
|
|
|
4319
4594
|
.join(', ')}]`;
|
|
4320
4595
|
}
|
|
4321
4596
|
if (target.startAt) {
|
|
4322
|
-
str += ', startAt: '
|
|
4597
|
+
str += ', startAt: ';
|
|
4598
|
+
str += target.startAt.inclusive ? 'b:' : 'a:';
|
|
4599
|
+
str += target.startAt.position.map(p => canonicalId(p)).join(',');
|
|
4323
4600
|
}
|
|
4324
4601
|
if (target.endAt) {
|
|
4325
|
-
str += ', endAt: '
|
|
4602
|
+
str += ', endAt: ';
|
|
4603
|
+
str += target.endAt.inclusive ? 'a:' : 'b:';
|
|
4604
|
+
str += target.endAt.position.map(p => canonicalId(p)).join(',');
|
|
4326
4605
|
}
|
|
4327
4606
|
return `Target(${str})`;
|
|
4328
4607
|
}
|
|
@@ -4357,7 +4636,7 @@ function targetEquals(left, right) {
|
|
|
4357
4636
|
}
|
|
4358
4637
|
return boundEquals(left.endAt, right.endAt);
|
|
4359
4638
|
}
|
|
4360
|
-
function
|
|
4639
|
+
function targetIsDocumentTarget(target) {
|
|
4361
4640
|
return (DocumentKey.isDocumentKey(target.path) &&
|
|
4362
4641
|
target.collectionGroup === null &&
|
|
4363
4642
|
target.filters.length === 0);
|
|
@@ -4560,17 +4839,11 @@ class ArrayContainsAnyFilter extends FieldFilter {
|
|
|
4560
4839
|
* just after the provided values.
|
|
4561
4840
|
*/
|
|
4562
4841
|
class Bound {
|
|
4563
|
-
constructor(position,
|
|
4842
|
+
constructor(position, inclusive) {
|
|
4564
4843
|
this.position = position;
|
|
4565
|
-
this.
|
|
4844
|
+
this.inclusive = inclusive;
|
|
4566
4845
|
}
|
|
4567
4846
|
}
|
|
4568
|
-
function canonifyBound(bound) {
|
|
4569
|
-
// TODO(b/29183165): Make this collision robust.
|
|
4570
|
-
return `${bound.before ? 'b' : 'a'}:${bound.position
|
|
4571
|
-
.map(p => canonicalId(p))
|
|
4572
|
-
.join(',')}`;
|
|
4573
|
-
}
|
|
4574
4847
|
/**
|
|
4575
4848
|
* An ordering on a field, in some Direction. Direction defaults to ASCENDING.
|
|
4576
4849
|
*/
|
|
@@ -4590,11 +4863,7 @@ function stringifyOrderBy(orderBy) {
|
|
|
4590
4863
|
function orderByEquals(left, right) {
|
|
4591
4864
|
return left.dir === right.dir && left.field.isEqual(right.field);
|
|
4592
4865
|
}
|
|
4593
|
-
|
|
4594
|
-
* Returns true if a document sorts before a bound using the provided sort
|
|
4595
|
-
* order.
|
|
4596
|
-
*/
|
|
4597
|
-
function sortsBeforeDocument(bound, orderBy, doc) {
|
|
4866
|
+
function boundCompareToDocument(bound, orderBy, doc) {
|
|
4598
4867
|
let comparison = 0;
|
|
4599
4868
|
for (let i = 0; i < bound.position.length; i++) {
|
|
4600
4869
|
const orderByComponent = orderBy[i];
|
|
@@ -4613,7 +4882,23 @@ function sortsBeforeDocument(bound, orderBy, doc) {
|
|
|
4613
4882
|
break;
|
|
4614
4883
|
}
|
|
4615
4884
|
}
|
|
4616
|
-
return
|
|
4885
|
+
return comparison;
|
|
4886
|
+
}
|
|
4887
|
+
/**
|
|
4888
|
+
* Returns true if a document sorts after a bound using the provided sort
|
|
4889
|
+
* order.
|
|
4890
|
+
*/
|
|
4891
|
+
function boundSortsAfterDocument(bound, orderBy, doc) {
|
|
4892
|
+
const comparison = boundCompareToDocument(bound, orderBy, doc);
|
|
4893
|
+
return bound.inclusive ? comparison >= 0 : comparison > 0;
|
|
4894
|
+
}
|
|
4895
|
+
/**
|
|
4896
|
+
* Returns true if a document sorts before a bound using the provided sort
|
|
4897
|
+
* order.
|
|
4898
|
+
*/
|
|
4899
|
+
function boundSortsBeforeDocument(bound, orderBy, doc) {
|
|
4900
|
+
const comparison = boundCompareToDocument(bound, orderBy, doc);
|
|
4901
|
+
return bound.inclusive ? comparison <= 0 : comparison < 0;
|
|
4617
4902
|
}
|
|
4618
4903
|
function boundEquals(left, right) {
|
|
4619
4904
|
if (left === null) {
|
|
@@ -4622,7 +4907,7 @@ function boundEquals(left, right) {
|
|
|
4622
4907
|
else if (right === null) {
|
|
4623
4908
|
return false;
|
|
4624
4909
|
}
|
|
4625
|
-
if (left.
|
|
4910
|
+
if (left.inclusive !== right.inclusive ||
|
|
4626
4911
|
left.position.length !== right.position.length) {
|
|
4627
4912
|
return false;
|
|
4628
4913
|
}
|
|
@@ -4826,10 +5111,10 @@ function queryToTarget(query) {
|
|
|
4826
5111
|
}
|
|
4827
5112
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
4828
5113
|
const startAt = queryImpl.endAt
|
|
4829
|
-
? new Bound(queryImpl.endAt.position, !queryImpl.endAt.
|
|
5114
|
+
? new Bound(queryImpl.endAt.position, !queryImpl.endAt.inclusive)
|
|
4830
5115
|
: null;
|
|
4831
5116
|
const endAt = queryImpl.startAt
|
|
4832
|
-
? new Bound(queryImpl.startAt.position, !queryImpl.startAt.
|
|
5117
|
+
? new Bound(queryImpl.startAt.position, !queryImpl.startAt.inclusive)
|
|
4833
5118
|
: null;
|
|
4834
5119
|
// Now return as a LimitType.First query.
|
|
4835
5120
|
queryImpl.memoizedTarget = newTarget(queryImpl.path, queryImpl.collectionGroup, orderBys, queryImpl.filters, queryImpl.limit, startAt, endAt);
|
|
@@ -4917,11 +5202,11 @@ function queryMatchesFilters(query, doc) {
|
|
|
4917
5202
|
/** Makes sure a document is within the bounds, if provided. */
|
|
4918
5203
|
function queryMatchesBounds(query, doc) {
|
|
4919
5204
|
if (query.startAt &&
|
|
4920
|
-
!
|
|
5205
|
+
!boundSortsBeforeDocument(query.startAt, queryOrderBy(query), doc)) {
|
|
4921
5206
|
return false;
|
|
4922
5207
|
}
|
|
4923
5208
|
if (query.endAt &&
|
|
4924
|
-
|
|
5209
|
+
!boundSortsAfterDocument(query.endAt, queryOrderBy(query), doc)) {
|
|
4925
5210
|
return false;
|
|
4926
5211
|
}
|
|
4927
5212
|
return true;
|
|
@@ -7002,7 +7287,7 @@ class WatchChangeAggregator {
|
|
|
7002
7287
|
const targetData = this.targetDataForActiveTarget(targetId);
|
|
7003
7288
|
if (targetData) {
|
|
7004
7289
|
const target = targetData.target;
|
|
7005
|
-
if (
|
|
7290
|
+
if (targetIsDocumentTarget(target)) {
|
|
7006
7291
|
if (expectedCount === 0) {
|
|
7007
7292
|
// The existence filter told us the document does not exist. We deduce
|
|
7008
7293
|
// that this document does not exist and apply a deleted document to
|
|
@@ -7037,7 +7322,7 @@ class WatchChangeAggregator {
|
|
|
7037
7322
|
this.targetStates.forEach((targetState, targetId) => {
|
|
7038
7323
|
const targetData = this.targetDataForActiveTarget(targetId);
|
|
7039
7324
|
if (targetData) {
|
|
7040
|
-
if (targetState.current &&
|
|
7325
|
+
if (targetState.current && targetIsDocumentTarget(targetData.target)) {
|
|
7041
7326
|
// Document queries for document that don't exist can produce an empty
|
|
7042
7327
|
// result set. To update our local cache, we synthesize a document
|
|
7043
7328
|
// delete if we have not previously received the document. This
|
|
@@ -7800,10 +8085,10 @@ function toQueryTarget(serializer, target) {
|
|
|
7800
8085
|
result.structuredQuery.limit = limit;
|
|
7801
8086
|
}
|
|
7802
8087
|
if (target.startAt) {
|
|
7803
|
-
result.structuredQuery.startAt =
|
|
8088
|
+
result.structuredQuery.startAt = toStartAtCursor(target.startAt);
|
|
7804
8089
|
}
|
|
7805
8090
|
if (target.endAt) {
|
|
7806
|
-
result.structuredQuery.endAt =
|
|
8091
|
+
result.structuredQuery.endAt = toEndAtCursor(target.endAt);
|
|
7807
8092
|
}
|
|
7808
8093
|
return result;
|
|
7809
8094
|
}
|
|
@@ -7836,11 +8121,11 @@ function convertQueryTargetToQuery(target) {
|
|
|
7836
8121
|
}
|
|
7837
8122
|
let startAt = null;
|
|
7838
8123
|
if (query.startAt) {
|
|
7839
|
-
startAt =
|
|
8124
|
+
startAt = fromStartAtCursor(query.startAt);
|
|
7840
8125
|
}
|
|
7841
8126
|
let endAt = null;
|
|
7842
8127
|
if (query.endAt) {
|
|
7843
|
-
endAt =
|
|
8128
|
+
endAt = fromEndAtCursor(query.endAt);
|
|
7844
8129
|
}
|
|
7845
8130
|
return newQuery(path, collectionGroup, orderBy, filterBy, limit, "F" /* First */, startAt, endAt);
|
|
7846
8131
|
}
|
|
@@ -7873,7 +8158,7 @@ function toLabel(serializer, purpose) {
|
|
|
7873
8158
|
function toTarget(serializer, targetData) {
|
|
7874
8159
|
let result;
|
|
7875
8160
|
const target = targetData.target;
|
|
7876
|
-
if (
|
|
8161
|
+
if (targetIsDocumentTarget(target)) {
|
|
7877
8162
|
result = { documents: toDocumentsTarget(serializer, target) };
|
|
7878
8163
|
}
|
|
7879
8164
|
else {
|
|
@@ -7931,16 +8216,27 @@ function toOrder(orderBys) {
|
|
|
7931
8216
|
function fromOrder(orderBys) {
|
|
7932
8217
|
return orderBys.map(order => fromPropertyOrder(order));
|
|
7933
8218
|
}
|
|
7934
|
-
function
|
|
8219
|
+
function toStartAtCursor(cursor) {
|
|
8220
|
+
return {
|
|
8221
|
+
before: cursor.inclusive,
|
|
8222
|
+
values: cursor.position
|
|
8223
|
+
};
|
|
8224
|
+
}
|
|
8225
|
+
function toEndAtCursor(cursor) {
|
|
7935
8226
|
return {
|
|
7936
|
-
before: cursor.
|
|
8227
|
+
before: !cursor.inclusive,
|
|
7937
8228
|
values: cursor.position
|
|
7938
8229
|
};
|
|
7939
8230
|
}
|
|
7940
|
-
function
|
|
7941
|
-
const
|
|
8231
|
+
function fromStartAtCursor(cursor) {
|
|
8232
|
+
const inclusive = !!cursor.before;
|
|
8233
|
+
const position = cursor.values || [];
|
|
8234
|
+
return new Bound(position, inclusive);
|
|
8235
|
+
}
|
|
8236
|
+
function fromEndAtCursor(cursor) {
|
|
8237
|
+
const inclusive = !cursor.before;
|
|
7942
8238
|
const position = cursor.values || [];
|
|
7943
|
-
return new Bound(position,
|
|
8239
|
+
return new Bound(position, inclusive);
|
|
7944
8240
|
}
|
|
7945
8241
|
// visible for testing
|
|
7946
8242
|
function toDirection(dir) {
|
|
@@ -8323,7 +8619,7 @@ function toDbTarget(localSerializer, targetData) {
|
|
|
8323
8619
|
const dbTimestamp = toDbTimestamp(targetData.snapshotVersion);
|
|
8324
8620
|
const dbLastLimboFreeTimestamp = toDbTimestamp(targetData.lastLimboFreeSnapshotVersion);
|
|
8325
8621
|
let queryProto;
|
|
8326
|
-
if (
|
|
8622
|
+
if (targetIsDocumentTarget(targetData.target)) {
|
|
8327
8623
|
queryProto = toDocumentsTarget(localSerializer.remoteSerializer, targetData.target);
|
|
8328
8624
|
}
|
|
8329
8625
|
else {
|
|
@@ -8493,6 +8789,38 @@ class MemoryIndexManager {
|
|
|
8493
8789
|
getCollectionParents(transaction, collectionId) {
|
|
8494
8790
|
return PersistencePromise.resolve(this.collectionParentIndex.getEntries(collectionId));
|
|
8495
8791
|
}
|
|
8792
|
+
addFieldIndex(transaction, index) {
|
|
8793
|
+
// Field indices are not supported with memory persistence.
|
|
8794
|
+
return PersistencePromise.resolve();
|
|
8795
|
+
}
|
|
8796
|
+
deleteFieldIndex(transaction, index) {
|
|
8797
|
+
// Field indices are not supported with memory persistence.
|
|
8798
|
+
return PersistencePromise.resolve();
|
|
8799
|
+
}
|
|
8800
|
+
getDocumentsMatchingTarget(transaction, fieldIndex, target) {
|
|
8801
|
+
// Field indices are not supported with memory persistence.
|
|
8802
|
+
return PersistencePromise.resolve(documentKeySet());
|
|
8803
|
+
}
|
|
8804
|
+
getFieldIndex(transaction, target) {
|
|
8805
|
+
// Field indices are not supported with memory persistence.
|
|
8806
|
+
return PersistencePromise.resolve(null);
|
|
8807
|
+
}
|
|
8808
|
+
getFieldIndexes(transaction, collectionGroup) {
|
|
8809
|
+
// Field indices are not supported with memory persistence.
|
|
8810
|
+
return PersistencePromise.resolve([]);
|
|
8811
|
+
}
|
|
8812
|
+
getNextCollectionGroupToUpdate(transaction) {
|
|
8813
|
+
// Field indices are not supported with memory persistence.
|
|
8814
|
+
return PersistencePromise.resolve(null);
|
|
8815
|
+
}
|
|
8816
|
+
updateCollectionGroup(transaction, collectionGroup, offset) {
|
|
8817
|
+
// Field indices are not supported with memory persistence.
|
|
8818
|
+
return PersistencePromise.resolve();
|
|
8819
|
+
}
|
|
8820
|
+
updateIndexEntries(transaction, documents) {
|
|
8821
|
+
// Field indices are not supported with memory persistence.
|
|
8822
|
+
return PersistencePromise.resolve();
|
|
8823
|
+
}
|
|
8496
8824
|
}
|
|
8497
8825
|
/**
|
|
8498
8826
|
* Internal implementation of the collection-parent index exposed by MemoryIndexManager.
|
|
@@ -8601,6 +8929,38 @@ class IndexedDbIndexManager {
|
|
|
8601
8929
|
return parentPaths;
|
|
8602
8930
|
});
|
|
8603
8931
|
}
|
|
8932
|
+
addFieldIndex(transaction, index) {
|
|
8933
|
+
// TODO(indexing): Implement
|
|
8934
|
+
return PersistencePromise.resolve();
|
|
8935
|
+
}
|
|
8936
|
+
deleteFieldIndex(transaction, index) {
|
|
8937
|
+
// TODO(indexing): Implement
|
|
8938
|
+
return PersistencePromise.resolve();
|
|
8939
|
+
}
|
|
8940
|
+
getDocumentsMatchingTarget(transaction, fieldIndex, target) {
|
|
8941
|
+
// TODO(indexing): Implement
|
|
8942
|
+
return PersistencePromise.resolve(documentKeySet());
|
|
8943
|
+
}
|
|
8944
|
+
getFieldIndex(transaction, target) {
|
|
8945
|
+
// TODO(indexing): Implement
|
|
8946
|
+
return PersistencePromise.resolve(null);
|
|
8947
|
+
}
|
|
8948
|
+
getFieldIndexes(transaction, collectionGroup) {
|
|
8949
|
+
// TODO(indexing): Implement
|
|
8950
|
+
return PersistencePromise.resolve([]);
|
|
8951
|
+
}
|
|
8952
|
+
getNextCollectionGroupToUpdate(transaction) {
|
|
8953
|
+
// TODO(indexing): Implement
|
|
8954
|
+
return PersistencePromise.resolve(null);
|
|
8955
|
+
}
|
|
8956
|
+
updateCollectionGroup(transaction, collectionGroup, offset) {
|
|
8957
|
+
// TODO(indexing): Implement
|
|
8958
|
+
return PersistencePromise.resolve();
|
|
8959
|
+
}
|
|
8960
|
+
updateIndexEntries(transaction, documents) {
|
|
8961
|
+
// TODO(indexing): Implement
|
|
8962
|
+
return PersistencePromise.resolve();
|
|
8963
|
+
}
|
|
8604
8964
|
}
|
|
8605
8965
|
/**
|
|
8606
8966
|
* Helper to get a typed SimpleDbStore for the collectionParents
|
|
@@ -9771,7 +10131,7 @@ class IndexedDbLruDelegateImpl {
|
|
|
9771
10131
|
// Our size accounting requires us to read all documents before
|
|
9772
10132
|
// removing them.
|
|
9773
10133
|
return changeBuffer.getEntry(txn, docKey).next(() => {
|
|
9774
|
-
changeBuffer.removeEntry(docKey);
|
|
10134
|
+
changeBuffer.removeEntry(docKey, SnapshotVersion.min());
|
|
9775
10135
|
return documentTargetStore(txn).delete(sentinelKey$1(docKey));
|
|
9776
10136
|
});
|
|
9777
10137
|
}
|
|
@@ -10452,9 +10812,6 @@ class SchemaConverter {
|
|
|
10452
10812
|
* and local feature development.
|
|
10453
10813
|
*/
|
|
10454
10814
|
createOrUpgrade(db, txn, fromVersion, toVersion) {
|
|
10455
|
-
hardAssert(fromVersion < toVersion &&
|
|
10456
|
-
fromVersion >= 0 &&
|
|
10457
|
-
toVersion <= SCHEMA_VERSION);
|
|
10458
10815
|
const simpleDbTransaction = new SimpleDbTransaction('createOrUpgrade', txn);
|
|
10459
10816
|
if (fromVersion < 1 && toVersion >= 1) {
|
|
10460
10817
|
createPrimaryClientStore(db);
|
|
@@ -10521,6 +10878,11 @@ class SchemaConverter {
|
|
|
10521
10878
|
createNamedQueriesStore(db);
|
|
10522
10879
|
});
|
|
10523
10880
|
}
|
|
10881
|
+
if (fromVersion < 12 && toVersion >= 12) {
|
|
10882
|
+
p = p.next(() => {
|
|
10883
|
+
createFieldIndex(db);
|
|
10884
|
+
});
|
|
10885
|
+
}
|
|
10524
10886
|
return p;
|
|
10525
10887
|
}
|
|
10526
10888
|
addDocumentGlobal(txn) {
|
|
@@ -10727,6 +11089,17 @@ function createNamedQueriesStore(db) {
|
|
|
10727
11089
|
db.createObjectStore(DbNamedQuery.store, {
|
|
10728
11090
|
keyPath: DbNamedQuery.keyPath
|
|
10729
11091
|
});
|
|
11092
|
+
}
|
|
11093
|
+
function createFieldIndex(db) {
|
|
11094
|
+
db.createObjectStore(DbIndexConfiguration.store, {
|
|
11095
|
+
keyPath: DbIndexConfiguration.keyPath
|
|
11096
|
+
});
|
|
11097
|
+
db.createObjectStore(DbIndexState.store, {
|
|
11098
|
+
keyPath: DbIndexState.keyPath
|
|
11099
|
+
});
|
|
11100
|
+
db.createObjectStore(DbIndexEntries.store, {
|
|
11101
|
+
keyPath: DbIndexEntries.keyPath
|
|
11102
|
+
});
|
|
10730
11103
|
}
|
|
10731
11104
|
|
|
10732
11105
|
/**
|
|
@@ -13291,7 +13664,7 @@ class MemoryEagerDelegate {
|
|
|
13291
13664
|
const key = DocumentKey.fromPath(path);
|
|
13292
13665
|
return this.isReferenced(txn, key).next(isReferenced => {
|
|
13293
13666
|
if (!isReferenced) {
|
|
13294
|
-
changeBuffer.removeEntry(key);
|
|
13667
|
+
changeBuffer.removeEntry(key, SnapshotVersion.min());
|
|
13295
13668
|
}
|
|
13296
13669
|
});
|
|
13297
13670
|
}).next(() => {
|
|
@@ -20155,12 +20528,12 @@ async function syncEngineListen(syncEngine, query) {
|
|
|
20155
20528
|
}
|
|
20156
20529
|
else {
|
|
20157
20530
|
const targetData = await localStoreAllocateTarget(syncEngineImpl.localStore, queryToTarget(query));
|
|
20158
|
-
const status = syncEngineImpl.sharedClientState.addLocalQueryTarget(targetData.targetId);
|
|
20159
|
-
targetId = targetData.targetId;
|
|
20160
|
-
viewSnapshot = await initializeViewAndComputeSnapshot(syncEngineImpl, query, targetId, status === 'current');
|
|
20161
20531
|
if (syncEngineImpl.isPrimaryClient) {
|
|
20162
20532
|
remoteStoreListen(syncEngineImpl.remoteStore, targetData);
|
|
20163
20533
|
}
|
|
20534
|
+
const status = syncEngineImpl.sharedClientState.addLocalQueryTarget(targetData.targetId);
|
|
20535
|
+
targetId = targetData.targetId;
|
|
20536
|
+
viewSnapshot = await initializeViewAndComputeSnapshot(syncEngineImpl, query, targetId, status === 'current');
|
|
20164
20537
|
}
|
|
20165
20538
|
return viewSnapshot;
|
|
20166
20539
|
}
|
|
@@ -20348,6 +20721,9 @@ async function syncEngineRejectListen(syncEngine, targetId, err) {
|
|
|
20348
20721
|
// store to purge a document. However, it would be tricky to keep all of
|
|
20349
20722
|
// the local store's invariants with another method.
|
|
20350
20723
|
let documentUpdates = new SortedMap(DocumentKey.comparator);
|
|
20724
|
+
// TODO(b/217189216): This limbo document should ideally have a read time,
|
|
20725
|
+
// so that it is picked up by any read-time based scans. The backend,
|
|
20726
|
+
// however, does not send a read time for target removals.
|
|
20351
20727
|
documentUpdates = documentUpdates.insert(limboKey, MutableDocument.newNoDocument(limboKey, SnapshotVersion.min()));
|
|
20352
20728
|
const resolvedLimboDocuments = documentKeySet().add(limboKey);
|
|
20353
20729
|
const event = new RemoteEvent(SnapshotVersion.min(),
|
|
@@ -22292,72 +22668,6 @@ function createBundleReader(data, serializer) {
|
|
|
22292
22668
|
return newBundleReader(toByteStreamReader(content), serializer);
|
|
22293
22669
|
}
|
|
22294
22670
|
|
|
22295
|
-
/**
|
|
22296
|
-
* @license
|
|
22297
|
-
* Copyright 2017 Google LLC
|
|
22298
|
-
*
|
|
22299
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
22300
|
-
* you may not use this file except in compliance with the License.
|
|
22301
|
-
* You may obtain a copy of the License at
|
|
22302
|
-
*
|
|
22303
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
22304
|
-
*
|
|
22305
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
22306
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
22307
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22308
|
-
* See the License for the specific language governing permissions and
|
|
22309
|
-
* limitations under the License.
|
|
22310
|
-
*/
|
|
22311
|
-
class DatabaseInfo {
|
|
22312
|
-
/**
|
|
22313
|
-
* Constructs a DatabaseInfo using the provided host, databaseId and
|
|
22314
|
-
* persistenceKey.
|
|
22315
|
-
*
|
|
22316
|
-
* @param databaseId - The database to use.
|
|
22317
|
-
* @param appId - The Firebase App Id.
|
|
22318
|
-
* @param persistenceKey - A unique identifier for this Firestore's local
|
|
22319
|
-
* storage (used in conjunction with the databaseId).
|
|
22320
|
-
* @param host - The Firestore backend host to connect to.
|
|
22321
|
-
* @param ssl - Whether to use SSL when connecting.
|
|
22322
|
-
* @param forceLongPolling - Whether to use the forceLongPolling option
|
|
22323
|
-
* when using WebChannel as the network transport.
|
|
22324
|
-
* @param autoDetectLongPolling - Whether to use the detectBufferingProxy
|
|
22325
|
-
* option when using WebChannel as the network transport.
|
|
22326
|
-
* @param useFetchStreams Whether to use the Fetch API instead of
|
|
22327
|
-
* XMLHTTPRequest
|
|
22328
|
-
*/
|
|
22329
|
-
constructor(databaseId, appId, persistenceKey, host, ssl, forceLongPolling, autoDetectLongPolling, useFetchStreams) {
|
|
22330
|
-
this.databaseId = databaseId;
|
|
22331
|
-
this.appId = appId;
|
|
22332
|
-
this.persistenceKey = persistenceKey;
|
|
22333
|
-
this.host = host;
|
|
22334
|
-
this.ssl = ssl;
|
|
22335
|
-
this.forceLongPolling = forceLongPolling;
|
|
22336
|
-
this.autoDetectLongPolling = autoDetectLongPolling;
|
|
22337
|
-
this.useFetchStreams = useFetchStreams;
|
|
22338
|
-
}
|
|
22339
|
-
}
|
|
22340
|
-
/** The default database name for a project. */
|
|
22341
|
-
const DEFAULT_DATABASE_NAME = '(default)';
|
|
22342
|
-
/**
|
|
22343
|
-
* Represents the database ID a Firestore client is associated with.
|
|
22344
|
-
* @internal
|
|
22345
|
-
*/
|
|
22346
|
-
class DatabaseId {
|
|
22347
|
-
constructor(projectId, database) {
|
|
22348
|
-
this.projectId = projectId;
|
|
22349
|
-
this.database = database ? database : DEFAULT_DATABASE_NAME;
|
|
22350
|
-
}
|
|
22351
|
-
get isDefaultDatabase() {
|
|
22352
|
-
return this.database === DEFAULT_DATABASE_NAME;
|
|
22353
|
-
}
|
|
22354
|
-
isEqual(other) {
|
|
22355
|
-
return (other instanceof DatabaseId &&
|
|
22356
|
-
other.projectId === this.projectId &&
|
|
22357
|
-
other.database === this.database);
|
|
22358
|
-
}
|
|
22359
|
-
}
|
|
22360
|
-
|
|
22361
22671
|
/**
|
|
22362
22672
|
* @license
|
|
22363
22673
|
* Copyright 2020 Google LLC
|
|
@@ -24731,8 +25041,7 @@ class DocumentSnapshot extends DocumentSnapshot$1 {
|
|
|
24731
25041
|
this.metadata = metadata;
|
|
24732
25042
|
}
|
|
24733
25043
|
/**
|
|
24734
|
-
*
|
|
24735
|
-
* exists. True if the document exists.
|
|
25044
|
+
* Returns whether or not the data exists. True if the document exists.
|
|
24736
25045
|
*/
|
|
24737
25046
|
exists() {
|
|
24738
25047
|
return super.exists();
|
|
@@ -25106,51 +25415,53 @@ function limitToLast(limit) {
|
|
|
25106
25415
|
return new QueryLimitConstraint('limitToLast', limit, "L" /* Last */);
|
|
25107
25416
|
}
|
|
25108
25417
|
class QueryStartAtConstraint extends QueryConstraint {
|
|
25109
|
-
constructor(type, _docOrFields,
|
|
25418
|
+
constructor(type, _docOrFields, _inclusive) {
|
|
25110
25419
|
super();
|
|
25111
25420
|
this.type = type;
|
|
25112
25421
|
this._docOrFields = _docOrFields;
|
|
25113
|
-
this.
|
|
25422
|
+
this._inclusive = _inclusive;
|
|
25114
25423
|
}
|
|
25115
25424
|
_apply(query) {
|
|
25116
|
-
const bound = newQueryBoundFromDocOrFields(query, this.type, this._docOrFields, this.
|
|
25425
|
+
const bound = newQueryBoundFromDocOrFields(query, this.type, this._docOrFields, this._inclusive);
|
|
25117
25426
|
return new Query(query.firestore, query.converter, queryWithStartAt(query._query, bound));
|
|
25118
25427
|
}
|
|
25119
25428
|
}
|
|
25120
25429
|
function startAt(...docOrFields) {
|
|
25121
|
-
return new QueryStartAtConstraint('startAt', docOrFields,
|
|
25430
|
+
return new QueryStartAtConstraint('startAt', docOrFields,
|
|
25431
|
+
/*inclusive=*/ true);
|
|
25122
25432
|
}
|
|
25123
25433
|
function startAfter(...docOrFields) {
|
|
25124
25434
|
return new QueryStartAtConstraint('startAfter', docOrFields,
|
|
25125
|
-
/*
|
|
25435
|
+
/*inclusive=*/ false);
|
|
25126
25436
|
}
|
|
25127
25437
|
class QueryEndAtConstraint extends QueryConstraint {
|
|
25128
|
-
constructor(type, _docOrFields,
|
|
25438
|
+
constructor(type, _docOrFields, _inclusive) {
|
|
25129
25439
|
super();
|
|
25130
25440
|
this.type = type;
|
|
25131
25441
|
this._docOrFields = _docOrFields;
|
|
25132
|
-
this.
|
|
25442
|
+
this._inclusive = _inclusive;
|
|
25133
25443
|
}
|
|
25134
25444
|
_apply(query) {
|
|
25135
|
-
const bound = newQueryBoundFromDocOrFields(query, this.type, this._docOrFields, this.
|
|
25445
|
+
const bound = newQueryBoundFromDocOrFields(query, this.type, this._docOrFields, this._inclusive);
|
|
25136
25446
|
return new Query(query.firestore, query.converter, queryWithEndAt(query._query, bound));
|
|
25137
25447
|
}
|
|
25138
25448
|
}
|
|
25139
25449
|
function endBefore(...docOrFields) {
|
|
25140
|
-
return new QueryEndAtConstraint('endBefore', docOrFields,
|
|
25450
|
+
return new QueryEndAtConstraint('endBefore', docOrFields,
|
|
25451
|
+
/*inclusive=*/ false);
|
|
25141
25452
|
}
|
|
25142
25453
|
function endAt(...docOrFields) {
|
|
25143
|
-
return new QueryEndAtConstraint('endAt', docOrFields, /*
|
|
25454
|
+
return new QueryEndAtConstraint('endAt', docOrFields, /*inclusive=*/ true);
|
|
25144
25455
|
}
|
|
25145
25456
|
/** Helper function to create a bound from a document or fields */
|
|
25146
|
-
function newQueryBoundFromDocOrFields(query, methodName, docOrFields,
|
|
25457
|
+
function newQueryBoundFromDocOrFields(query, methodName, docOrFields, inclusive) {
|
|
25147
25458
|
docOrFields[0] = util$1.getModularInstance(docOrFields[0]);
|
|
25148
25459
|
if (docOrFields[0] instanceof DocumentSnapshot$1) {
|
|
25149
|
-
return newQueryBoundFromDocument(query._query, query.firestore._databaseId, methodName, docOrFields[0]._document,
|
|
25460
|
+
return newQueryBoundFromDocument(query._query, query.firestore._databaseId, methodName, docOrFields[0]._document, inclusive);
|
|
25150
25461
|
}
|
|
25151
25462
|
else {
|
|
25152
25463
|
const reader = newUserDataReader(query.firestore);
|
|
25153
|
-
return newQueryBoundFromFields(query._query, query.firestore._databaseId, reader, methodName, docOrFields,
|
|
25464
|
+
return newQueryBoundFromFields(query._query, query.firestore._databaseId, reader, methodName, docOrFields, inclusive);
|
|
25154
25465
|
}
|
|
25155
25466
|
}
|
|
25156
25467
|
function newQueryFilter(query, methodName, dataReader, databaseId, fieldPath, op, value) {
|
|
@@ -25208,7 +25519,7 @@ function newQueryOrderBy(query, fieldPath, direction) {
|
|
|
25208
25519
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
25209
25520
|
* server timestamp.
|
|
25210
25521
|
*/
|
|
25211
|
-
function newQueryBoundFromDocument(query, databaseId, methodName, doc,
|
|
25522
|
+
function newQueryBoundFromDocument(query, databaseId, methodName, doc, inclusive) {
|
|
25212
25523
|
if (!doc) {
|
|
25213
25524
|
throw new FirestoreError(Code.NOT_FOUND, `Can't use a DocumentSnapshot that doesn't exist for ` +
|
|
25214
25525
|
`${methodName}().`);
|
|
@@ -25245,12 +25556,12 @@ function newQueryBoundFromDocument(query, databaseId, methodName, doc, before) {
|
|
|
25245
25556
|
}
|
|
25246
25557
|
}
|
|
25247
25558
|
}
|
|
25248
|
-
return new Bound(components,
|
|
25559
|
+
return new Bound(components, inclusive);
|
|
25249
25560
|
}
|
|
25250
25561
|
/**
|
|
25251
25562
|
* Converts a list of field values to a `Bound` for the given query.
|
|
25252
25563
|
*/
|
|
25253
|
-
function newQueryBoundFromFields(query, databaseId, dataReader, methodName, values,
|
|
25564
|
+
function newQueryBoundFromFields(query, databaseId, dataReader, methodName, values, inclusive) {
|
|
25254
25565
|
// Use explicit order by's because it has to match the query the user made
|
|
25255
25566
|
const orderBy = query.explicitOrderBy;
|
|
25256
25567
|
if (values.length > orderBy.length) {
|
|
@@ -25287,7 +25598,7 @@ function newQueryBoundFromFields(query, databaseId, dataReader, methodName, valu
|
|
|
25287
25598
|
components.push(wrapped);
|
|
25288
25599
|
}
|
|
25289
25600
|
}
|
|
25290
|
-
return new Bound(components,
|
|
25601
|
+
return new Bound(components, inclusive);
|
|
25291
25602
|
}
|
|
25292
25603
|
/**
|
|
25293
25604
|
* Parses the given `documentIdValue` into a `ReferenceValue`, throwing
|
|
@@ -26272,125 +26583,6 @@ function writeBatch(firestore) {
|
|
|
26272
26583
|
return new WriteBatch(firestore, mutations => executeWrite(firestore, mutations));
|
|
26273
26584
|
}
|
|
26274
26585
|
|
|
26275
|
-
/**
|
|
26276
|
-
* @license
|
|
26277
|
-
* Copyright 2021 Google LLC
|
|
26278
|
-
*
|
|
26279
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
26280
|
-
* you may not use this file except in compliance with the License.
|
|
26281
|
-
* You may obtain a copy of the License at
|
|
26282
|
-
*
|
|
26283
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
26284
|
-
*
|
|
26285
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
26286
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
26287
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26288
|
-
* See the License for the specific language governing permissions and
|
|
26289
|
-
* limitations under the License.
|
|
26290
|
-
*/
|
|
26291
|
-
/**
|
|
26292
|
-
* The initial mutation batch id for each index. Gets updated during index
|
|
26293
|
-
* backfill.
|
|
26294
|
-
*/
|
|
26295
|
-
const INITIAL_LARGEST_BATCH_ID = -1;
|
|
26296
|
-
/**
|
|
26297
|
-
* The initial sequence number for each index. Gets updated during index
|
|
26298
|
-
* backfill.
|
|
26299
|
-
*/
|
|
26300
|
-
const INITIAL_SEQUENCE_NUMBER = 0;
|
|
26301
|
-
/**
|
|
26302
|
-
* An index definition for field indexes in Firestore.
|
|
26303
|
-
*
|
|
26304
|
-
* Every index is associated with a collection. The definition contains a list
|
|
26305
|
-
* of fields and their index kind (which can be `ASCENDING`, `DESCENDING` or
|
|
26306
|
-
* `CONTAINS` for ArrayContains/ArrayContainsAny queries).
|
|
26307
|
-
*
|
|
26308
|
-
* Unlike the backend, the SDK does not differentiate between collection or
|
|
26309
|
-
* collection group-scoped indices. Every index can be used for both single
|
|
26310
|
-
* collection and collection group queries.
|
|
26311
|
-
*/
|
|
26312
|
-
class FieldIndex {
|
|
26313
|
-
constructor(
|
|
26314
|
-
/**
|
|
26315
|
-
* The index ID. Returns -1 if the index ID is not available (e.g. the index
|
|
26316
|
-
* has not yet been persisted).
|
|
26317
|
-
*/
|
|
26318
|
-
indexId,
|
|
26319
|
-
/** The collection ID this index applies to. */
|
|
26320
|
-
collectionGroup,
|
|
26321
|
-
/** The field segments for this index. */
|
|
26322
|
-
segments,
|
|
26323
|
-
/** Shows how up-to-date the index is for the current user. */
|
|
26324
|
-
indexState) {
|
|
26325
|
-
this.indexId = indexId;
|
|
26326
|
-
this.collectionGroup = collectionGroup;
|
|
26327
|
-
this.segments = segments;
|
|
26328
|
-
this.indexState = indexState;
|
|
26329
|
-
}
|
|
26330
|
-
}
|
|
26331
|
-
/** An ID for an index that has not yet been added to persistence. */
|
|
26332
|
-
FieldIndex.UNKNOWN_ID = -1;
|
|
26333
|
-
/** An index component consisting of field path and index type. */
|
|
26334
|
-
class IndexSegment {
|
|
26335
|
-
constructor(
|
|
26336
|
-
/** The field path of the component. */
|
|
26337
|
-
fieldPath,
|
|
26338
|
-
/** The fields sorting order. */
|
|
26339
|
-
kind) {
|
|
26340
|
-
this.fieldPath = fieldPath;
|
|
26341
|
-
this.kind = kind;
|
|
26342
|
-
}
|
|
26343
|
-
}
|
|
26344
|
-
/**
|
|
26345
|
-
* Stores the "high water mark" that indicates how updated the Index is for the
|
|
26346
|
-
* current user.
|
|
26347
|
-
*/
|
|
26348
|
-
class IndexState {
|
|
26349
|
-
constructor(
|
|
26350
|
-
/**
|
|
26351
|
-
* Indicates when the index was last updated (relative to other indexes).
|
|
26352
|
-
*/
|
|
26353
|
-
sequenceNumber,
|
|
26354
|
-
/** The the latest indexed read time, document and batch id. */
|
|
26355
|
-
offset) {
|
|
26356
|
-
this.sequenceNumber = sequenceNumber;
|
|
26357
|
-
this.offset = offset;
|
|
26358
|
-
}
|
|
26359
|
-
/** The state of an index that has not yet been backfilled. */
|
|
26360
|
-
static empty() {
|
|
26361
|
-
return new IndexState(INITIAL_SEQUENCE_NUMBER, IndexOffset.min());
|
|
26362
|
-
}
|
|
26363
|
-
}
|
|
26364
|
-
/**
|
|
26365
|
-
* Stores the latest read time, document and batch ID that were processed for an
|
|
26366
|
-
* index.
|
|
26367
|
-
*/
|
|
26368
|
-
class IndexOffset {
|
|
26369
|
-
constructor(
|
|
26370
|
-
/**
|
|
26371
|
-
* The latest read time version that has been indexed by Firestore for this
|
|
26372
|
-
* field index.
|
|
26373
|
-
*/
|
|
26374
|
-
readTime,
|
|
26375
|
-
/**
|
|
26376
|
-
* The key of the last document that was indexed for this query. Use
|
|
26377
|
-
* `DocumentKey.empty()` if no document has been indexed.
|
|
26378
|
-
*/
|
|
26379
|
-
documentKey,
|
|
26380
|
-
/*
|
|
26381
|
-
* The largest mutation batch id that's been processed by Firestore.
|
|
26382
|
-
*/
|
|
26383
|
-
largestBatchId) {
|
|
26384
|
-
this.readTime = readTime;
|
|
26385
|
-
this.documentKey = documentKey;
|
|
26386
|
-
this.largestBatchId = largestBatchId;
|
|
26387
|
-
}
|
|
26388
|
-
/** The state of an index that has not yet been backfilled. */
|
|
26389
|
-
static min() {
|
|
26390
|
-
return new IndexOffset(SnapshotVersion.min(), DocumentKey.empty(), INITIAL_LARGEST_BATCH_ID);
|
|
26391
|
-
}
|
|
26392
|
-
}
|
|
26393
|
-
|
|
26394
26586
|
/**
|
|
26395
26587
|
* @license
|
|
26396
26588
|
* Copyright 2021 Google LLC
|