@firebase/firestore 3.4.13 → 3.4.14-20220804201204
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/CHANGELOG.md +11 -0
- package/dist/firestore/src/api/index_configuration.d.ts +2 -8
- package/dist/firestore/src/api.d.ts +1 -1
- package/dist/firestore/src/local/indexeddb_schema.d.ts +1 -3
- package/dist/firestore/src/local/local_store_impl.d.ts +2 -0
- package/dist/firestore/src/util/array.d.ts +18 -0
- package/dist/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
- package/dist/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
- package/dist/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
- package/dist/firestore/test/unit/specs/spec_builder.d.ts +5 -0
- package/dist/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
- package/dist/firestore/test/unit/util/array.test.d.ts +17 -0
- package/dist/index.d.ts +91 -1
- package/dist/index.esm2017.js +2525 -2387
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +2383 -2282
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +216 -37
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +216 -37
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +2448 -2311
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +5 -13
- package/dist/lite/firestore/src/api/index_configuration.d.ts +2 -8
- package/dist/lite/firestore/src/api.d.ts +1 -1
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +1 -3
- package/dist/lite/firestore/src/local/local_store_impl.d.ts +2 -0
- package/dist/lite/firestore/src/util/array.d.ts +18 -0
- package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
- package/dist/lite/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
- package/dist/lite/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
- package/dist/lite/firestore/test/unit/specs/spec_builder.d.ts +5 -0
- package/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
- package/dist/lite/firestore/test/unit/util/array.test.d.ts +17 -0
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +2 -2
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +2 -2
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/src/api/index_configuration.d.ts +2 -8
- package/dist/lite/packages/firestore/src/api.d.ts +1 -1
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +1 -3
- package/dist/lite/packages/firestore/src/local/local_store_impl.d.ts +2 -0
- package/dist/lite/packages/firestore/src/util/array.d.ts +18 -0
- package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
- package/dist/lite/packages/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/unit/specs/spec_builder.d.ts +5 -0
- package/dist/lite/packages/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
- package/dist/lite/packages/firestore/test/unit/util/array.test.d.ts +17 -0
- package/dist/packages/firestore/dist/index.esm2017.d.ts +150 -150
- package/dist/packages/firestore/src/api/index_configuration.d.ts +2 -8
- package/dist/packages/firestore/src/api.d.ts +1 -1
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +1 -3
- package/dist/packages/firestore/src/local/local_store_impl.d.ts +2 -0
- package/dist/packages/firestore/src/util/array.d.ts +18 -0
- package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
- package/dist/packages/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
- package/dist/packages/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
- package/dist/packages/firestore/test/unit/specs/spec_builder.d.ts +5 -0
- package/dist/packages/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
- package/dist/packages/firestore/test/unit/util/array.test.d.ts +17 -0
- package/dist/private.d.ts +92 -4
- package/package.json +5 -4
package/dist/index.node.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import * as grpc from '@grpc/grpc-js';
|
|
|
8
8
|
import * as protoLoader from '@grpc/proto-loader';
|
|
9
9
|
|
|
10
10
|
const name = "@firebase/firestore";
|
|
11
|
-
const version$1 = "3.4.
|
|
11
|
+
const version$1 = "3.4.14-20220804201204";
|
|
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.9.
|
|
64
|
+
const version = "9.9.2-20220804201204";
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* @license
|
|
@@ -1498,6 +1498,23 @@ function fieldIndexGetKeyOrder(fieldIndex) {
|
|
|
1498
1498
|
? 0 /* ASCENDING */
|
|
1499
1499
|
: directionalSegments[directionalSegments.length - 1].kind;
|
|
1500
1500
|
}
|
|
1501
|
+
/**
|
|
1502
|
+
* Compares indexes by collection group and segments. Ignores update time and
|
|
1503
|
+
* index ID.
|
|
1504
|
+
*/
|
|
1505
|
+
function fieldIndexSemanticComparator(left, right) {
|
|
1506
|
+
let cmp = primitiveComparator(left.collectionGroup, right.collectionGroup);
|
|
1507
|
+
if (cmp !== 0) {
|
|
1508
|
+
return cmp;
|
|
1509
|
+
}
|
|
1510
|
+
for (let i = 0; i < Math.min(left.fields.length, right.fields.length); ++i) {
|
|
1511
|
+
cmp = indexSegmentComparator(left.fields[i], right.fields[i]);
|
|
1512
|
+
if (cmp !== 0) {
|
|
1513
|
+
return cmp;
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
return primitiveComparator(left.fields.length, right.fields.length);
|
|
1517
|
+
}
|
|
1501
1518
|
/** Returns a debug representation of the field index */
|
|
1502
1519
|
function fieldIndexToString(fieldIndex) {
|
|
1503
1520
|
return `id=${fieldIndex.indexId}|cg=${fieldIndex.collectionGroup}|f=${fieldIndex.fields.map(f => `${f.fieldPath}:${f.kind}`).join(',')}`;
|
|
@@ -1513,6 +1530,13 @@ class IndexSegment {
|
|
|
1513
1530
|
this.kind = kind;
|
|
1514
1531
|
}
|
|
1515
1532
|
}
|
|
1533
|
+
function indexSegmentComparator(left, right) {
|
|
1534
|
+
const cmp = FieldPath$1.comparator(left.fieldPath, right.fieldPath);
|
|
1535
|
+
if (cmp !== 0) {
|
|
1536
|
+
return cmp;
|
|
1537
|
+
}
|
|
1538
|
+
return primitiveComparator(left.kind, right.kind);
|
|
1539
|
+
}
|
|
1516
1540
|
/**
|
|
1517
1541
|
* Stores the "high water mark" that indicates how updated the Index is for the
|
|
1518
1542
|
* current user.
|
|
@@ -1599,31 +1623,6 @@ function indexOffsetComparator(left, right) {
|
|
|
1599
1623
|
}
|
|
1600
1624
|
return primitiveComparator(left.largestBatchId, right.largestBatchId);
|
|
1601
1625
|
}
|
|
1602
|
-
/**
|
|
1603
|
-
* Schema Version for the Web client:
|
|
1604
|
-
* 1. Initial version including Mutation Queue, Query Cache, and Remote
|
|
1605
|
-
* Document Cache
|
|
1606
|
-
* 2. Used to ensure a targetGlobal object exists and add targetCount to it. No
|
|
1607
|
-
* longer required because migration 3 unconditionally clears it.
|
|
1608
|
-
* 3. Dropped and re-created Query Cache to deal with cache corruption related
|
|
1609
|
-
* to limbo resolution. Addresses
|
|
1610
|
-
* https://github.com/firebase/firebase-ios-sdk/issues/1548
|
|
1611
|
-
* 4. Multi-Tab Support.
|
|
1612
|
-
* 5. Removal of held write acks.
|
|
1613
|
-
* 6. Create document global for tracking document cache size.
|
|
1614
|
-
* 7. Ensure every cached document has a sentinel row with a sequence number.
|
|
1615
|
-
* 8. Add collection-parent index for Collection Group queries.
|
|
1616
|
-
* 9. Change RemoteDocumentChanges store to be keyed by readTime rather than
|
|
1617
|
-
* an auto-incrementing ID. This is required for Index-Free queries.
|
|
1618
|
-
* 10. Rewrite the canonical IDs to the explicit Protobuf-based format.
|
|
1619
|
-
* 11. Add bundles and named_queries for bundle support.
|
|
1620
|
-
* 12. Add document overlays.
|
|
1621
|
-
* 13. Rewrite the keys of the remote document cache to allow for efficient
|
|
1622
|
-
* document lookup via `getAll()`.
|
|
1623
|
-
* 14. Add overlays.
|
|
1624
|
-
* 15. Add indexing support.
|
|
1625
|
-
*/
|
|
1626
|
-
const SCHEMA_VERSION = 14;
|
|
1627
1626
|
|
|
1628
1627
|
/**
|
|
1629
1628
|
* @license
|
|
@@ -2583,6 +2582,8 @@ function checkForAndReportiOSError(error) {
|
|
|
2583
2582
|
}
|
|
2584
2583
|
|
|
2585
2584
|
const LOG_TAG$h = 'IndexBackiller';
|
|
2585
|
+
/** How long we wait to try running index backfill after SDK initialization. */
|
|
2586
|
+
const INITIAL_BACKFILL_DELAY_MS = 15;
|
|
2586
2587
|
/** Minimum amount of time between backfill checks, after the first one. */
|
|
2587
2588
|
const REGULAR_BACKFILL_DELAY_MS = 1;
|
|
2588
2589
|
/** The maximum number of documents to process each time backfill() is called. */
|
|
@@ -2595,6 +2596,7 @@ class IndexBackfillerScheduler {
|
|
|
2595
2596
|
this.task = null;
|
|
2596
2597
|
}
|
|
2597
2598
|
start() {
|
|
2599
|
+
this.schedule(INITIAL_BACKFILL_DELAY_MS);
|
|
2598
2600
|
}
|
|
2599
2601
|
stop() {
|
|
2600
2602
|
if (this.task) {
|
|
@@ -12710,6 +12712,48 @@ function dbKeyComparator(l, r) {
|
|
|
12710
12712
|
return primitiveComparator(left[left.length - 1], right[right.length - 1]);
|
|
12711
12713
|
}
|
|
12712
12714
|
|
|
12715
|
+
/**
|
|
12716
|
+
* @license
|
|
12717
|
+
* Copyright 2017 Google LLC
|
|
12718
|
+
*
|
|
12719
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12720
|
+
* you may not use this file except in compliance with the License.
|
|
12721
|
+
* You may obtain a copy of the License at
|
|
12722
|
+
*
|
|
12723
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12724
|
+
*
|
|
12725
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12726
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12727
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12728
|
+
* See the License for the specific language governing permissions and
|
|
12729
|
+
* limitations under the License.
|
|
12730
|
+
*/
|
|
12731
|
+
/**
|
|
12732
|
+
* Schema Version for the Web client:
|
|
12733
|
+
* 1. Initial version including Mutation Queue, Query Cache, and Remote
|
|
12734
|
+
* Document Cache
|
|
12735
|
+
* 2. Used to ensure a targetGlobal object exists and add targetCount to it. No
|
|
12736
|
+
* longer required because migration 3 unconditionally clears it.
|
|
12737
|
+
* 3. Dropped and re-created Query Cache to deal with cache corruption related
|
|
12738
|
+
* to limbo resolution. Addresses
|
|
12739
|
+
* https://github.com/firebase/firebase-ios-sdk/issues/1548
|
|
12740
|
+
* 4. Multi-Tab Support.
|
|
12741
|
+
* 5. Removal of held write acks.
|
|
12742
|
+
* 6. Create document global for tracking document cache size.
|
|
12743
|
+
* 7. Ensure every cached document has a sentinel row with a sequence number.
|
|
12744
|
+
* 8. Add collection-parent index for Collection Group queries.
|
|
12745
|
+
* 9. Change RemoteDocumentChanges store to be keyed by readTime rather than
|
|
12746
|
+
* an auto-incrementing ID. This is required for Index-Free queries.
|
|
12747
|
+
* 10. Rewrite the canonical IDs to the explicit Protobuf-based format.
|
|
12748
|
+
* 11. Add bundles and named_queries for bundle support.
|
|
12749
|
+
* 12. Add document overlays.
|
|
12750
|
+
* 13. Rewrite the keys of the remote document cache to allow for efficient
|
|
12751
|
+
* document lookup via `getAll()`.
|
|
12752
|
+
* 14. Add overlays.
|
|
12753
|
+
* 15. Add indexing support.
|
|
12754
|
+
*/
|
|
12755
|
+
const SCHEMA_VERSION = 15;
|
|
12756
|
+
|
|
12713
12757
|
/**
|
|
12714
12758
|
* @license
|
|
12715
12759
|
* Copyright 2022 Google LLC
|
|
@@ -15248,6 +15292,73 @@ async function indexedDbClearPersistence(persistenceKey) {
|
|
|
15248
15292
|
await SimpleDb.delete(dbName);
|
|
15249
15293
|
}
|
|
15250
15294
|
|
|
15295
|
+
/**
|
|
15296
|
+
* @license
|
|
15297
|
+
* Copyright 2017 Google LLC
|
|
15298
|
+
*
|
|
15299
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
15300
|
+
* you may not use this file except in compliance with the License.
|
|
15301
|
+
* You may obtain a copy of the License at
|
|
15302
|
+
*
|
|
15303
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15304
|
+
*
|
|
15305
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15306
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15307
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15308
|
+
* See the License for the specific language governing permissions and
|
|
15309
|
+
* limitations under the License.
|
|
15310
|
+
*/
|
|
15311
|
+
/**
|
|
15312
|
+
* Compares two array for equality using comparator. The method computes the
|
|
15313
|
+
* intersection and invokes `onAdd` for every element that is in `after` but not
|
|
15314
|
+
* `before`. `onRemove` is invoked for every element in `before` but missing
|
|
15315
|
+
* from `after`.
|
|
15316
|
+
*
|
|
15317
|
+
* The method creates a copy of both `before` and `after` and runs in O(n log
|
|
15318
|
+
* n), where n is the size of the two lists.
|
|
15319
|
+
*
|
|
15320
|
+
* @param before - The elements that exist in the original array.
|
|
15321
|
+
* @param after - The elements to diff against the original array.
|
|
15322
|
+
* @param comparator - The comparator for the elements in before and after.
|
|
15323
|
+
* @param onAdd - A function to invoke for every element that is part of `
|
|
15324
|
+
* after` but not `before`.
|
|
15325
|
+
* @param onRemove - A function to invoke for every element that is part of
|
|
15326
|
+
* `before` but not `after`.
|
|
15327
|
+
*/
|
|
15328
|
+
function diffArrays(before, after, comparator, onAdd, onRemove) {
|
|
15329
|
+
before = [...before];
|
|
15330
|
+
after = [...after];
|
|
15331
|
+
before.sort(comparator);
|
|
15332
|
+
after.sort(comparator);
|
|
15333
|
+
const bLen = before.length;
|
|
15334
|
+
const aLen = after.length;
|
|
15335
|
+
let a = 0;
|
|
15336
|
+
let b = 0;
|
|
15337
|
+
while (a < aLen && b < bLen) {
|
|
15338
|
+
const cmp = comparator(before[b], after[a]);
|
|
15339
|
+
if (cmp < 0) {
|
|
15340
|
+
// The element was removed if the next element in our ordered
|
|
15341
|
+
// walkthrough is only in `before`.
|
|
15342
|
+
onRemove(before[b++]);
|
|
15343
|
+
}
|
|
15344
|
+
else if (cmp > 0) {
|
|
15345
|
+
// The element was added if the next element in our ordered walkthrough
|
|
15346
|
+
// is only in `after`.
|
|
15347
|
+
onAdd(after[a++]);
|
|
15348
|
+
}
|
|
15349
|
+
else {
|
|
15350
|
+
a++;
|
|
15351
|
+
b++;
|
|
15352
|
+
}
|
|
15353
|
+
}
|
|
15354
|
+
while (a < aLen) {
|
|
15355
|
+
onAdd(after[a++]);
|
|
15356
|
+
}
|
|
15357
|
+
while (b < bLen) {
|
|
15358
|
+
onRemove(before[b++]);
|
|
15359
|
+
}
|
|
15360
|
+
}
|
|
15361
|
+
|
|
15251
15362
|
/**
|
|
15252
15363
|
* @license
|
|
15253
15364
|
* Copyright 2020 Google LLC
|
|
@@ -16097,6 +16208,19 @@ async function localStoreSaveNamedQuery(localStore, query, documents = documentK
|
|
|
16097
16208
|
.next(() => localStoreImpl.targetCache.addMatchingKeys(transaction, documents, allocated.targetId))
|
|
16098
16209
|
.next(() => localStoreImpl.bundleCache.saveNamedQuery(transaction, query));
|
|
16099
16210
|
});
|
|
16211
|
+
}
|
|
16212
|
+
async function localStoreConfigureFieldIndexes(localStore, newFieldIndexes) {
|
|
16213
|
+
const localStoreImpl = debugCast(localStore);
|
|
16214
|
+
const indexManager = localStoreImpl.indexManager;
|
|
16215
|
+
const promises = [];
|
|
16216
|
+
return localStoreImpl.persistence.runTransaction('Configure indexes', 'readwrite', transaction => indexManager
|
|
16217
|
+
.getFieldIndexes(transaction)
|
|
16218
|
+
.next(oldFieldIndexes => diffArrays(oldFieldIndexes, newFieldIndexes, fieldIndexSemanticComparator, fieldIndex => {
|
|
16219
|
+
promises.push(indexManager.addFieldIndex(transaction, fieldIndex));
|
|
16220
|
+
}, fieldIndex => {
|
|
16221
|
+
promises.push(indexManager.deleteFieldIndex(transaction, fieldIndex));
|
|
16222
|
+
}))
|
|
16223
|
+
.next(() => PersistencePromise.waitFor(promises)));
|
|
16100
16224
|
}
|
|
16101
16225
|
|
|
16102
16226
|
/**
|
|
@@ -16176,9 +16300,56 @@ class QueryEngine {
|
|
|
16176
16300
|
* persisted index values. Returns `null` if an index is not available.
|
|
16177
16301
|
*/
|
|
16178
16302
|
performQueryUsingIndex(transaction, query) {
|
|
16179
|
-
{
|
|
16303
|
+
if (queryMatchesAllDocuments(query)) {
|
|
16304
|
+
// Queries that match all documents don't benefit from using
|
|
16305
|
+
// key-based lookups. It is more efficient to scan all documents in a
|
|
16306
|
+
// collection, rather than to perform individual lookups.
|
|
16180
16307
|
return PersistencePromise.resolve(null);
|
|
16181
16308
|
}
|
|
16309
|
+
let target = queryToTarget(query);
|
|
16310
|
+
return this.indexManager
|
|
16311
|
+
.getIndexType(transaction, target)
|
|
16312
|
+
.next(indexType => {
|
|
16313
|
+
if (indexType === 0 /* NONE */) {
|
|
16314
|
+
// The target cannot be served from any index.
|
|
16315
|
+
return null;
|
|
16316
|
+
}
|
|
16317
|
+
if (query.limit !== null && indexType === 1 /* PARTIAL */) {
|
|
16318
|
+
// We cannot apply a limit for targets that are served using a partial
|
|
16319
|
+
// index. If a partial index will be used to serve the target, the
|
|
16320
|
+
// query may return a superset of documents that match the target
|
|
16321
|
+
// (e.g. if the index doesn't include all the target's filters), or
|
|
16322
|
+
// may return the correct set of documents in the wrong order (e.g. if
|
|
16323
|
+
// the index doesn't include a segment for one of the orderBys).
|
|
16324
|
+
// Therefore, a limit should not be applied in such cases.
|
|
16325
|
+
query = queryWithLimit(query, null, "F" /* First */);
|
|
16326
|
+
target = queryToTarget(query);
|
|
16327
|
+
}
|
|
16328
|
+
return this.indexManager
|
|
16329
|
+
.getDocumentsMatchingTarget(transaction, target)
|
|
16330
|
+
.next(keys => {
|
|
16331
|
+
const sortedKeys = documentKeySet(...keys);
|
|
16332
|
+
return this.localDocumentsView
|
|
16333
|
+
.getDocuments(transaction, sortedKeys)
|
|
16334
|
+
.next(indexedDocuments => {
|
|
16335
|
+
return this.indexManager
|
|
16336
|
+
.getMinOffset(transaction, target)
|
|
16337
|
+
.next(offset => {
|
|
16338
|
+
const previousResults = this.applyQuery(query, indexedDocuments);
|
|
16339
|
+
if (this.needsRefill(query, previousResults, sortedKeys, offset.readTime)) {
|
|
16340
|
+
// A limit query whose boundaries change due to local
|
|
16341
|
+
// edits can be re-run against the cache by excluding the
|
|
16342
|
+
// limit. This ensures that all documents that match the
|
|
16343
|
+
// query's filters are included in the result set. The SDK
|
|
16344
|
+
// can then apply the limit once all local edits are
|
|
16345
|
+
// incorporated.
|
|
16346
|
+
return this.performQueryUsingIndex(transaction, queryWithLimit(query, null, "F" /* First */));
|
|
16347
|
+
}
|
|
16348
|
+
return this.appendRemainingResults(transaction, previousResults, query, offset);
|
|
16349
|
+
});
|
|
16350
|
+
});
|
|
16351
|
+
});
|
|
16352
|
+
});
|
|
16182
16353
|
}
|
|
16183
16354
|
/**
|
|
16184
16355
|
* Performs a query based on the target's persisted query mapping. Returns
|
|
@@ -24273,7 +24444,7 @@ class AsyncObserver {
|
|
|
24273
24444
|
this.scheduleEvent(this.observer.error, error);
|
|
24274
24445
|
}
|
|
24275
24446
|
else {
|
|
24276
|
-
|
|
24447
|
+
logError('Uncaught Error in snapshot listener:', error);
|
|
24277
24448
|
}
|
|
24278
24449
|
}
|
|
24279
24450
|
mute() {
|
|
@@ -26204,7 +26375,7 @@ function setPersistenceProviders(client, onlineComponentProvider, offlineCompone
|
|
|
26204
26375
|
if (!canFallbackFromIndexedDbError(error)) {
|
|
26205
26376
|
throw error;
|
|
26206
26377
|
}
|
|
26207
|
-
|
|
26378
|
+
logWarn('Error enabling offline persistence. Falling back to ' +
|
|
26208
26379
|
'persistence disabled: ' +
|
|
26209
26380
|
error);
|
|
26210
26381
|
persistenceResult.reject(error);
|
|
@@ -29118,14 +29289,23 @@ function writeBatch(firestore) {
|
|
|
29118
29289
|
* limitations under the License.
|
|
29119
29290
|
*/
|
|
29120
29291
|
function setIndexConfiguration(firestore, jsonOrConfiguration) {
|
|
29292
|
+
var _a;
|
|
29121
29293
|
firestore = cast(firestore, Firestore);
|
|
29122
|
-
ensureFirestoreConfigured(firestore);
|
|
29294
|
+
const client = ensureFirestoreConfigured(firestore);
|
|
29295
|
+
// PORTING NOTE: We don't return an error if the user has not enabled
|
|
29296
|
+
// persistence since `enableIndexeddbPersistence()` can fail on the Web.
|
|
29297
|
+
if (!((_a = client.offlineComponents) === null || _a === void 0 ? void 0 : _a.indexBackfillerScheduler)) {
|
|
29298
|
+
logWarn('Cannot enable indexes when persistence is disabled');
|
|
29299
|
+
return Promise.resolve();
|
|
29300
|
+
}
|
|
29301
|
+
const parsedIndexes = parseIndexes(jsonOrConfiguration);
|
|
29302
|
+
return getLocalStore(client).then(localStore => localStoreConfigureFieldIndexes(localStore, parsedIndexes));
|
|
29303
|
+
}
|
|
29304
|
+
function parseIndexes(jsonOrConfiguration) {
|
|
29123
29305
|
const indexConfiguration = typeof jsonOrConfiguration === 'string'
|
|
29124
29306
|
? tryParseJson(jsonOrConfiguration)
|
|
29125
29307
|
: jsonOrConfiguration;
|
|
29126
29308
|
const parsedIndexes = [];
|
|
29127
|
-
// PORTING NOTE: We don't return an error if the user has not enabled
|
|
29128
|
-
// persistence since `enableIndexeddbPersistence()` can fail on the Web.
|
|
29129
29309
|
if (Array.isArray(indexConfiguration.indexes)) {
|
|
29130
29310
|
for (const index of indexConfiguration.indexes) {
|
|
29131
29311
|
const collectionGroup = tryGetString(index, 'collectionGroup');
|
|
@@ -29148,8 +29328,7 @@ function setIndexConfiguration(firestore, jsonOrConfiguration) {
|
|
|
29148
29328
|
parsedIndexes.push(new FieldIndex(FieldIndex.UNKNOWN_ID, collectionGroup, segments, IndexState.empty()));
|
|
29149
29329
|
}
|
|
29150
29330
|
}
|
|
29151
|
-
|
|
29152
|
-
return Promise.resolve();
|
|
29331
|
+
return parsedIndexes;
|
|
29153
29332
|
}
|
|
29154
29333
|
function tryParseJson(json) {
|
|
29155
29334
|
var _a;
|
|
@@ -29157,7 +29336,7 @@ function tryParseJson(json) {
|
|
|
29157
29336
|
return JSON.parse(json);
|
|
29158
29337
|
}
|
|
29159
29338
|
catch (e) {
|
|
29160
|
-
throw new FirestoreError(Code.INVALID_ARGUMENT, 'Failed to parse JSON:' + ((_a = e) === null || _a === void 0 ? void 0 : _a.message));
|
|
29339
|
+
throw new FirestoreError(Code.INVALID_ARGUMENT, 'Failed to parse JSON: ' + ((_a = e) === null || _a === void 0 ? void 0 : _a.message));
|
|
29161
29340
|
}
|
|
29162
29341
|
}
|
|
29163
29342
|
function tryGetString(data, property) {
|
|
@@ -29185,5 +29364,5 @@ function tryGetString(data, property) {
|
|
|
29185
29364
|
*/
|
|
29186
29365
|
registerFirestore('node');
|
|
29187
29366
|
|
|
29188
|
-
export { AbstractUserDataWriter, Bytes, CACHE_SIZE_UNLIMITED, CollectionReference, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Firestore, FirestoreError, GeoPoint, LoadBundleTask, Query, QueryConstraint, QueryDocumentSnapshot, QuerySnapshot, SnapshotMetadata, Timestamp, Transaction, WriteBatch, DatabaseId as _DatabaseId, DocumentKey as _DocumentKey, EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider, EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider, FieldPath$1 as _FieldPath, cast as _cast, debugAssert as _debugAssert, isBase64Available as _isBase64Available, logWarn as _logWarn,
|
|
29367
|
+
export { AbstractUserDataWriter, Bytes, CACHE_SIZE_UNLIMITED, CollectionReference, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Firestore, FirestoreError, GeoPoint, LoadBundleTask, Query, QueryConstraint, QueryDocumentSnapshot, QuerySnapshot, SnapshotMetadata, Timestamp, Transaction, WriteBatch, DatabaseId as _DatabaseId, DocumentKey as _DocumentKey, EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider, EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider, FieldPath$1 as _FieldPath, cast as _cast, debugAssert as _debugAssert, isBase64Available as _isBase64Available, logWarn as _logWarn, validateIsNotUsedTogether as _validateIsNotUsedTogether, addDoc, arrayRemove, arrayUnion, clearIndexedDbPersistence, collection, collectionGroup, connectFirestoreEmulator, deleteDoc, deleteField, disableNetwork, doc, documentId, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, endAt, endBefore, ensureFirestoreConfigured, executeWrite, getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, getFirestore, increment, initializeFirestore, limit, limitToLast, loadBundle, namedQuery, onSnapshot, onSnapshotsInSync, orderBy, query, queryEqual, refEqual, runTransaction, serverTimestamp, setDoc, setIndexConfiguration, setLogLevel, snapshotEqual, startAfter, startAt, terminate, updateDoc, waitForPendingWrites, where, writeBatch };
|
|
29189
29368
|
//# sourceMappingURL=index.node.mjs.map
|