@firebase/firestore 3.4.7 → 3.4.8-canary.44948ac91
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 +10 -0
- package/dist/firestore/src/core/query.d.ts +2 -4
- package/dist/firestore/src/core/target.d.ts +2 -0
- package/dist/firestore/src/local/index_manager.d.ts +27 -5
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +15 -5
- package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/firestore/src/local/indexeddb_schema.d.ts +8 -2
- package/dist/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
- package/dist/firestore/src/local/local_documents_view.d.ts +1 -1
- package/dist/firestore/src/local/memory_index_manager.d.ts +6 -4
- package/dist/firestore/src/local/query_engine.d.ts +44 -5
- package/dist/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/firestore/src/model/collections.d.ts +1 -1
- package/dist/firestore/src/model/field_index.d.ts +6 -0
- package/dist/firestore/src/util/misc.d.ts +3 -0
- package/dist/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
- package/dist/firestore/test/unit/local/test_index_manager.d.ts +5 -4
- package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/index.esm2017.js +4632 -4498
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +4989 -4864
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +1743 -1547
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +1743 -1547
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +4461 -4327
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +26 -4
- package/dist/lite/firestore/src/core/query.d.ts +2 -4
- package/dist/lite/firestore/src/core/target.d.ts +2 -0
- package/dist/lite/firestore/src/local/index_manager.d.ts +27 -5
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +15 -5
- package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +8 -2
- package/dist/lite/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
- package/dist/lite/firestore/src/local/local_documents_view.d.ts +1 -1
- package/dist/lite/firestore/src/local/memory_index_manager.d.ts +6 -4
- package/dist/lite/firestore/src/local/query_engine.d.ts +44 -5
- package/dist/lite/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/lite/firestore/src/model/collections.d.ts +1 -1
- package/dist/lite/firestore/src/model/field_index.d.ts +6 -0
- package/dist/lite/firestore/src/util/misc.d.ts +3 -0
- package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
- package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +5 -4
- package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/lite/index.browser.esm2017.js +385 -389
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +377 -381
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +7 -9
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +7 -9
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +385 -389
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +95 -95
- package/dist/lite/packages/firestore/src/core/query.d.ts +2 -4
- package/dist/lite/packages/firestore/src/core/target.d.ts +2 -0
- package/dist/lite/packages/firestore/src/local/index_manager.d.ts +27 -5
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +15 -5
- package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +8 -2
- package/dist/lite/packages/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
- package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +1 -1
- package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +6 -4
- package/dist/lite/packages/firestore/src/local/query_engine.d.ts +44 -5
- package/dist/lite/packages/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/lite/packages/firestore/src/model/collections.d.ts +1 -1
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +6 -0
- package/dist/lite/packages/firestore/src/util/misc.d.ts +3 -0
- package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
- package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +5 -4
- package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/packages/firestore/dist/index.esm2017.d.ts +173 -173
- package/dist/packages/firestore/src/core/query.d.ts +2 -4
- package/dist/packages/firestore/src/core/target.d.ts +2 -0
- package/dist/packages/firestore/src/local/index_manager.d.ts +27 -5
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +15 -5
- package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +8 -2
- package/dist/packages/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
- package/dist/packages/firestore/src/local/local_documents_view.d.ts +1 -1
- package/dist/packages/firestore/src/local/memory_index_manager.d.ts +6 -4
- package/dist/packages/firestore/src/local/query_engine.d.ts +44 -5
- package/dist/packages/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/packages/firestore/src/model/collections.d.ts +1 -1
- package/dist/packages/firestore/src/model/field_index.d.ts +6 -0
- package/dist/packages/firestore/src/util/misc.d.ts +3 -0
- package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
- package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +5 -4
- package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/private.d.ts +26 -4
- package/package.json +9 -9
|
@@ -66,7 +66,7 @@ f.MOCK_USER = new f("mock-user");
|
|
|
66
66
|
* See the License for the specific language governing permissions and
|
|
67
67
|
* limitations under the License.
|
|
68
68
|
*/
|
|
69
|
-
let d = "9.6.
|
|
69
|
+
let d = "9.6.11-canary.44948ac91";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -2358,14 +2358,10 @@ function cn(t, n) {
|
|
|
2358
2358
|
}
|
|
2359
2359
|
|
|
2360
2360
|
/** Creates a new Query for a query that matches all documents at `path` */ function hn(t) {
|
|
2361
|
-
return !at(t.limit) && "L" /* Last */ === t.limitType;
|
|
2362
|
-
}
|
|
2363
|
-
|
|
2364
|
-
function ln(t) {
|
|
2365
2361
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
2366
2362
|
}
|
|
2367
2363
|
|
|
2368
|
-
function
|
|
2364
|
+
function ln(t) {
|
|
2369
2365
|
for (const n of t.filters) if (n.D()) return n.field;
|
|
2370
2366
|
return null;
|
|
2371
2367
|
}
|
|
@@ -2378,7 +2374,7 @@ function fn(t) {
|
|
|
2378
2374
|
* Returns whether the query matches a collection group rather than a specific
|
|
2379
2375
|
* collection.
|
|
2380
2376
|
*/
|
|
2381
|
-
function
|
|
2377
|
+
function fn(t) {
|
|
2382
2378
|
return null !== t.collectionGroup;
|
|
2383
2379
|
}
|
|
2384
2380
|
|
|
@@ -2386,11 +2382,11 @@ function dn(t) {
|
|
|
2386
2382
|
* Returns the implicit order by constraint that is used to execute the Query,
|
|
2387
2383
|
* which can be different from the order by constraints the user provided (e.g.
|
|
2388
2384
|
* the SDK and backend always orders by `__name__`).
|
|
2389
|
-
*/ function
|
|
2385
|
+
*/ function dn(t) {
|
|
2390
2386
|
const n = E(t);
|
|
2391
2387
|
if (null === n.$) {
|
|
2392
2388
|
n.$ = [];
|
|
2393
|
-
const t =
|
|
2389
|
+
const t = ln(n), e = hn(n);
|
|
2394
2390
|
if (null !== t && null === e)
|
|
2395
2391
|
// In order to implicitly add key ordering, we must also add the
|
|
2396
2392
|
// inequality filter field for it to be a valid query.
|
|
@@ -2411,24 +2407,24 @@ function dn(t) {
|
|
|
2411
2407
|
|
|
2412
2408
|
/**
|
|
2413
2409
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2414
|
-
*/ function
|
|
2410
|
+
*/ function wn(t) {
|
|
2415
2411
|
const n = E(t);
|
|
2416
|
-
if (!n.S) if ("F" /* First */ === n.limitType) n.S = Yt(n.path, n.collectionGroup,
|
|
2412
|
+
if (!n.S) if ("F" /* First */ === n.limitType) n.S = Yt(n.path, n.collectionGroup, dn(n), n.filters, n.limit, n.startAt, n.endAt); else {
|
|
2417
2413
|
// Flip the orderBy directions since we want the last results
|
|
2418
2414
|
const t = [];
|
|
2419
|
-
for (const e of
|
|
2415
|
+
for (const e of dn(n)) {
|
|
2420
2416
|
const n = "desc" /* DESCENDING */ === e.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
|
|
2421
2417
|
t.push(new on(e.field, n));
|
|
2422
2418
|
}
|
|
2423
2419
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2424
|
-
const e = n.endAt ? new sn(n.endAt.position,
|
|
2420
|
+
const e = n.endAt ? new sn(n.endAt.position, n.endAt.inclusive) : null, r = n.startAt ? new sn(n.startAt.position, n.startAt.inclusive) : null;
|
|
2425
2421
|
// Now return as a LimitType.First query.
|
|
2426
2422
|
n.S = Yt(n.path, n.collectionGroup, t, n.filters, n.limit, e, r);
|
|
2427
2423
|
}
|
|
2428
2424
|
return n.S;
|
|
2429
2425
|
}
|
|
2430
2426
|
|
|
2431
|
-
function
|
|
2427
|
+
function mn(t, n) {
|
|
2432
2428
|
return function(t, n) {
|
|
2433
2429
|
if (t.limit !== n.limit) return !1;
|
|
2434
2430
|
if (t.orderBy.length !== n.orderBy.length) return !1;
|
|
@@ -2438,7 +2434,7 @@ function pn(t, n) {
|
|
|
2438
2434
|
e.op !== r.op || !e.field.isEqual(r.field) || !qt(e.value, r.value)) return !1;
|
|
2439
2435
|
var e, r;
|
|
2440
2436
|
return t.collectionGroup === n.collectionGroup && !!t.path.isEqual(n.path) && !!cn(t.startAt, n.startAt) && cn(t.endAt, n.endAt);
|
|
2441
|
-
}(
|
|
2437
|
+
}(wn(t), wn(n)) && t.limitType === n.limitType;
|
|
2442
2438
|
}
|
|
2443
2439
|
|
|
2444
2440
|
/**
|
|
@@ -2466,7 +2462,7 @@ function pn(t, n) {
|
|
|
2466
2462
|
* The return value is an IntegerValue if it can safely represent the value,
|
|
2467
2463
|
* otherwise a DoubleValue is returned.
|
|
2468
2464
|
*/
|
|
2469
|
-
function
|
|
2465
|
+
function pn(t, n) {
|
|
2470
2466
|
return function(t) {
|
|
2471
2467
|
return "number" == typeof t && Number.isInteger(t) && !ht(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
|
|
2472
2468
|
}(n) ?
|
|
@@ -2511,7 +2507,7 @@ function yn(t, n) {
|
|
|
2511
2507
|
* See the License for the specific language governing permissions and
|
|
2512
2508
|
* limitations under the License.
|
|
2513
2509
|
*/
|
|
2514
|
-
/** Used to represent a field transform on a mutation. */ class
|
|
2510
|
+
/** Used to represent a field transform on a mutation. */ class yn {
|
|
2515
2511
|
constructor() {
|
|
2516
2512
|
// Make sure that the structural type of `TransformOperation` is unique.
|
|
2517
2513
|
// See https://github.com/microsoft/TypeScript/issues/5451
|
|
@@ -2519,15 +2515,15 @@ function yn(t, n) {
|
|
|
2519
2515
|
}
|
|
2520
2516
|
}
|
|
2521
2517
|
|
|
2522
|
-
/** Transforms a value into a server-generated timestamp. */ class
|
|
2518
|
+
/** Transforms a value into a server-generated timestamp. */ class _n extends yn {}
|
|
2523
2519
|
|
|
2524
|
-
/** Transforms an array value via a union operation. */ class
|
|
2520
|
+
/** Transforms an array value via a union operation. */ class gn extends yn {
|
|
2525
2521
|
constructor(t) {
|
|
2526
2522
|
super(), this.elements = t;
|
|
2527
2523
|
}
|
|
2528
2524
|
}
|
|
2529
2525
|
|
|
2530
|
-
/** Transforms an array value via a remove operation. */ class
|
|
2526
|
+
/** Transforms an array value via a remove operation. */ class vn extends yn {
|
|
2531
2527
|
constructor(t) {
|
|
2532
2528
|
super(), this.elements = t;
|
|
2533
2529
|
}
|
|
@@ -2538,7 +2534,7 @@ function yn(t, n) {
|
|
|
2538
2534
|
* transforms. Converts all field values to integers or doubles, but unlike the
|
|
2539
2535
|
* backend does not cap integer values at 2^63. Instead, JavaScript number
|
|
2540
2536
|
* arithmetic is used and precision loss can occur for values greater than 2^53.
|
|
2541
|
-
*/ class
|
|
2537
|
+
*/ class bn extends yn {
|
|
2542
2538
|
constructor(t, n) {
|
|
2543
2539
|
super(), this.q = t, this.O = n;
|
|
2544
2540
|
}
|
|
@@ -2560,7 +2556,7 @@ function yn(t, n) {
|
|
|
2560
2556
|
* See the License for the specific language governing permissions and
|
|
2561
2557
|
* limitations under the License.
|
|
2562
2558
|
*/
|
|
2563
|
-
/** A field path and the TransformOperation to perform upon it. */ class
|
|
2559
|
+
/** A field path and the TransformOperation to perform upon it. */ class En {
|
|
2564
2560
|
constructor(t, n) {
|
|
2565
2561
|
this.field = t, this.transform = n;
|
|
2566
2562
|
}
|
|
@@ -2570,18 +2566,18 @@ function yn(t, n) {
|
|
|
2570
2566
|
* Encodes a precondition for a mutation. This follows the model that the
|
|
2571
2567
|
* backend accepts with the special case of an explicit "empty" precondition
|
|
2572
2568
|
* (meaning no precondition).
|
|
2573
|
-
*/ class
|
|
2569
|
+
*/ class Tn {
|
|
2574
2570
|
constructor(t, n) {
|
|
2575
2571
|
this.updateTime = t, this.exists = n;
|
|
2576
2572
|
}
|
|
2577
2573
|
/** Creates a new empty Precondition. */ static none() {
|
|
2578
|
-
return new
|
|
2574
|
+
return new Tn;
|
|
2579
2575
|
}
|
|
2580
2576
|
/** Creates a new Precondition with an exists flag. */ static exists(t) {
|
|
2581
|
-
return new
|
|
2577
|
+
return new Tn(void 0, t);
|
|
2582
2578
|
}
|
|
2583
2579
|
/** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
|
|
2584
|
-
return new
|
|
2580
|
+
return new Tn(t);
|
|
2585
2581
|
}
|
|
2586
2582
|
/** Returns whether this Precondition is empty. */ get isNone() {
|
|
2587
2583
|
return void 0 === this.updateTime && void 0 === this.exists;
|
|
@@ -2634,12 +2630,12 @@ function yn(t, n) {
|
|
|
2634
2630
|
* applyToLocalView() to implement the actual behavior of applying the mutation
|
|
2635
2631
|
* to some source document (see `setMutationApplyToRemoteDocument()` for an
|
|
2636
2632
|
* example).
|
|
2637
|
-
*/ class
|
|
2633
|
+
*/ class In {}
|
|
2638
2634
|
|
|
2639
2635
|
/**
|
|
2640
2636
|
* A mutation that creates or replaces the document at the given key with the
|
|
2641
2637
|
* object value contents.
|
|
2642
|
-
*/ class
|
|
2638
|
+
*/ class An extends In {
|
|
2643
2639
|
constructor(t, n, e, r = []) {
|
|
2644
2640
|
super(), this.key = t, this.value = n, this.precondition = e, this.fieldTransforms = r,
|
|
2645
2641
|
this.type = 0 /* Set */;
|
|
@@ -2658,14 +2654,14 @@ function yn(t, n) {
|
|
|
2658
2654
|
* is deleted.
|
|
2659
2655
|
* * When a field is not in the mask but is in the values, the values map is
|
|
2660
2656
|
* ignored.
|
|
2661
|
-
*/ class
|
|
2657
|
+
*/ class Rn extends In {
|
|
2662
2658
|
constructor(t, n, e, r, s = []) {
|
|
2663
2659
|
super(), this.key = t, this.data = n, this.fieldMask = e, this.precondition = r,
|
|
2664
2660
|
this.fieldTransforms = s, this.type = 1 /* Patch */;
|
|
2665
2661
|
}
|
|
2666
2662
|
}
|
|
2667
2663
|
|
|
2668
|
-
/** A mutation that deletes the document at the given key. */ class
|
|
2664
|
+
/** A mutation that deletes the document at the given key. */ class Pn extends In {
|
|
2669
2665
|
constructor(t, n) {
|
|
2670
2666
|
super(), this.key = t, this.precondition = n, this.type = 2 /* Delete */ , this.fieldTransforms = [];
|
|
2671
2667
|
}
|
|
@@ -2677,7 +2673,7 @@ function yn(t, n) {
|
|
|
2677
2673
|
*
|
|
2678
2674
|
* The `verify` operation is only used in Transactions, and this class serves
|
|
2679
2675
|
* primarily to facilitate serialization into protos.
|
|
2680
|
-
*/ class
|
|
2676
|
+
*/ class Vn extends In {
|
|
2681
2677
|
constructor(t, n) {
|
|
2682
2678
|
super(), this.key = t, this.precondition = n, this.type = 3 /* Verify */ , this.fieldTransforms = [];
|
|
2683
2679
|
}
|
|
@@ -2698,13 +2694,13 @@ function yn(t, n) {
|
|
|
2698
2694
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2699
2695
|
* See the License for the specific language governing permissions and
|
|
2700
2696
|
* limitations under the License.
|
|
2701
|
-
*/ const
|
|
2697
|
+
*/ const Nn = (() => {
|
|
2702
2698
|
const t = {
|
|
2703
2699
|
asc: "ASCENDING",
|
|
2704
2700
|
desc: "DESCENDING"
|
|
2705
2701
|
};
|
|
2706
2702
|
return t;
|
|
2707
|
-
})(),
|
|
2703
|
+
})(), Dn = (() => {
|
|
2708
2704
|
const t = {
|
|
2709
2705
|
"<": "LESS_THAN",
|
|
2710
2706
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -2734,7 +2730,7 @@ function yn(t, n) {
|
|
|
2734
2730
|
* TODO(klimt): We can remove the databaseId argument if we keep the full
|
|
2735
2731
|
* resource name in documents.
|
|
2736
2732
|
*/
|
|
2737
|
-
class
|
|
2733
|
+
class $n {
|
|
2738
2734
|
constructor(t, n) {
|
|
2739
2735
|
this.databaseId = t, this.F = n;
|
|
2740
2736
|
}
|
|
@@ -2751,7 +2747,7 @@ class Sn {
|
|
|
2751
2747
|
/**
|
|
2752
2748
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
2753
2749
|
*/
|
|
2754
|
-
function
|
|
2750
|
+
function Sn(t, n) {
|
|
2755
2751
|
if (t.F) {
|
|
2756
2752
|
return `${new Date(1e3 * n.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + n.nanoseconds).slice(-9)}Z`;
|
|
2757
2753
|
}
|
|
@@ -2766,35 +2762,35 @@ function Fn(t, n) {
|
|
|
2766
2762
|
*
|
|
2767
2763
|
* Visible for testing.
|
|
2768
2764
|
*/
|
|
2769
|
-
function
|
|
2765
|
+
function Fn(t, n) {
|
|
2770
2766
|
return t.F ? n.toBase64() : n.toUint8Array();
|
|
2771
2767
|
}
|
|
2772
2768
|
|
|
2773
|
-
function
|
|
2774
|
-
return
|
|
2769
|
+
function xn(t, n) {
|
|
2770
|
+
return Sn(t, n.toTimestamp());
|
|
2775
2771
|
}
|
|
2776
2772
|
|
|
2777
|
-
function
|
|
2773
|
+
function qn(t) {
|
|
2778
2774
|
return b(!!t), bt.fromTimestamp(function(t) {
|
|
2779
2775
|
const n = Vt(t);
|
|
2780
2776
|
return new vt(n.seconds, n.nanos);
|
|
2781
2777
|
}(t));
|
|
2782
2778
|
}
|
|
2783
2779
|
|
|
2784
|
-
function
|
|
2780
|
+
function On(t, n) {
|
|
2785
2781
|
return function(t) {
|
|
2786
2782
|
return new Z([ "projects", t.projectId, "databases", t.database ]);
|
|
2787
2783
|
}(t).child("documents").child(n).canonicalString();
|
|
2788
2784
|
}
|
|
2789
2785
|
|
|
2790
|
-
function
|
|
2791
|
-
return
|
|
2786
|
+
function Cn(t, n) {
|
|
2787
|
+
return On(t.databaseId, n.path);
|
|
2792
2788
|
}
|
|
2793
2789
|
|
|
2794
|
-
function
|
|
2790
|
+
function Ln(t, n) {
|
|
2795
2791
|
const e = function(t) {
|
|
2796
2792
|
const n = Z.fromString(t);
|
|
2797
|
-
return b(
|
|
2793
|
+
return b(Hn(n)), n;
|
|
2798
2794
|
}(n);
|
|
2799
2795
|
if (e.get(1) !== t.databaseId.projectId) throw new U(R, "Tried to deserialize key from different project: " + e.get(1) + " vs " + t.databaseId.projectId);
|
|
2800
2796
|
if (e.get(3) !== t.databaseId.database) throw new U(R, "Tried to deserialize key from different database: " + e.get(3) + " vs " + t.databaseId.database);
|
|
@@ -2802,25 +2798,25 @@ function kn(t, n) {
|
|
|
2802
2798
|
var r;
|
|
2803
2799
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
2804
2800
|
|
|
2805
|
-
function
|
|
2806
|
-
return
|
|
2801
|
+
function kn(t, n) {
|
|
2802
|
+
return On(t.databaseId, n);
|
|
2807
2803
|
}
|
|
2808
2804
|
|
|
2809
|
-
function
|
|
2805
|
+
function Un(t) {
|
|
2810
2806
|
return new Z([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
2811
2807
|
}
|
|
2812
2808
|
|
|
2813
|
-
function
|
|
2809
|
+
function jn(t, n, e) {
|
|
2814
2810
|
return {
|
|
2815
|
-
name:
|
|
2811
|
+
name: Cn(t, n),
|
|
2816
2812
|
fields: e.value.mapValue.fields
|
|
2817
2813
|
};
|
|
2818
2814
|
}
|
|
2819
2815
|
|
|
2820
|
-
function
|
|
2816
|
+
function Mn(t, n) {
|
|
2821
2817
|
return "found" in n ? function(t, n) {
|
|
2822
2818
|
b(!!n.found), n.found.name, n.found.updateTime;
|
|
2823
|
-
const e =
|
|
2819
|
+
const e = Ln(t, n.found.name), r = qn(n.found.updateTime), s = new Gt({
|
|
2824
2820
|
mapValue: {
|
|
2825
2821
|
fields: n.found.fields
|
|
2826
2822
|
}
|
|
@@ -2828,67 +2824,67 @@ function Bn(t, n) {
|
|
|
2828
2824
|
return Qt.newFoundDocument(e, r, s);
|
|
2829
2825
|
}(t, n) : "missing" in n ? function(t, n) {
|
|
2830
2826
|
b(!!n.missing), b(!!n.readTime);
|
|
2831
|
-
const e =
|
|
2827
|
+
const e = Ln(t, n.missing), r = qn(n.readTime);
|
|
2832
2828
|
return Qt.newNoDocument(e, r);
|
|
2833
2829
|
}(t, n) : v();
|
|
2834
2830
|
}
|
|
2835
2831
|
|
|
2836
|
-
function
|
|
2832
|
+
function Bn(t, n) {
|
|
2837
2833
|
let e;
|
|
2838
|
-
if (n instanceof
|
|
2839
|
-
update:
|
|
2840
|
-
}; else if (n instanceof Vn) e = {
|
|
2841
|
-
delete: Ln(t, n.key)
|
|
2834
|
+
if (n instanceof An) e = {
|
|
2835
|
+
update: jn(t, n.key, n.value)
|
|
2842
2836
|
}; else if (n instanceof Pn) e = {
|
|
2843
|
-
|
|
2844
|
-
|
|
2837
|
+
delete: Cn(t, n.key)
|
|
2838
|
+
}; else if (n instanceof Rn) e = {
|
|
2839
|
+
update: jn(t, n.key, n.data),
|
|
2840
|
+
updateMask: Yn(n.fieldMask)
|
|
2845
2841
|
}; else {
|
|
2846
|
-
if (!(n instanceof
|
|
2842
|
+
if (!(n instanceof Vn)) return v();
|
|
2847
2843
|
e = {
|
|
2848
|
-
verify:
|
|
2844
|
+
verify: Cn(t, n.key)
|
|
2849
2845
|
};
|
|
2850
2846
|
}
|
|
2851
2847
|
return n.fieldTransforms.length > 0 && (e.updateTransforms = n.fieldTransforms.map((t => function(t, n) {
|
|
2852
2848
|
const e = n.transform;
|
|
2853
|
-
if (e instanceof
|
|
2849
|
+
if (e instanceof _n) return {
|
|
2854
2850
|
fieldPath: n.field.canonicalString(),
|
|
2855
2851
|
setToServerValue: "REQUEST_TIME"
|
|
2856
2852
|
};
|
|
2857
|
-
if (e instanceof
|
|
2853
|
+
if (e instanceof gn) return {
|
|
2858
2854
|
fieldPath: n.field.canonicalString(),
|
|
2859
2855
|
appendMissingElements: {
|
|
2860
2856
|
values: e.elements
|
|
2861
2857
|
}
|
|
2862
2858
|
};
|
|
2863
|
-
if (e instanceof
|
|
2859
|
+
if (e instanceof vn) return {
|
|
2864
2860
|
fieldPath: n.field.canonicalString(),
|
|
2865
2861
|
removeAllFromArray: {
|
|
2866
2862
|
values: e.elements
|
|
2867
2863
|
}
|
|
2868
2864
|
};
|
|
2869
|
-
if (e instanceof
|
|
2865
|
+
if (e instanceof bn) return {
|
|
2870
2866
|
fieldPath: n.field.canonicalString(),
|
|
2871
2867
|
increment: e.O
|
|
2872
2868
|
};
|
|
2873
2869
|
throw v();
|
|
2874
2870
|
}(0, t)))), n.precondition.isNone || (e.currentDocument = function(t, n) {
|
|
2875
2871
|
return void 0 !== n.updateTime ? {
|
|
2876
|
-
updateTime:
|
|
2872
|
+
updateTime: xn(t, n.updateTime)
|
|
2877
2873
|
} : void 0 !== n.exists ? {
|
|
2878
2874
|
exists: n.exists
|
|
2879
2875
|
} : v();
|
|
2880
2876
|
}(t, n.precondition)), e;
|
|
2881
2877
|
}
|
|
2882
2878
|
|
|
2883
|
-
function
|
|
2879
|
+
function zn(t, n) {
|
|
2884
2880
|
// Dissect the path into parent, collectionId, and optional key filter.
|
|
2885
2881
|
const e = {
|
|
2886
2882
|
structuredQuery: {}
|
|
2887
2883
|
}, r = n.path;
|
|
2888
|
-
null !== n.collectionGroup ? (e.parent =
|
|
2884
|
+
null !== n.collectionGroup ? (e.parent = kn(t, r), e.structuredQuery.from = [ {
|
|
2889
2885
|
collectionId: n.collectionGroup,
|
|
2890
2886
|
allDescendants: !0
|
|
2891
|
-
} ]) : (e.parent =
|
|
2887
|
+
} ]) : (e.parent = kn(t, r.popLast()), e.structuredQuery.from = [ {
|
|
2892
2888
|
collectionId: r.lastSegment()
|
|
2893
2889
|
} ]);
|
|
2894
2890
|
const s = function(t) {
|
|
@@ -2899,34 +2895,34 @@ function Gn(t, n) {
|
|
|
2899
2895
|
if ("==" /* EQUAL */ === t.op) {
|
|
2900
2896
|
if (Mt(t.value)) return {
|
|
2901
2897
|
unaryFilter: {
|
|
2902
|
-
field:
|
|
2898
|
+
field: Wn(t.field),
|
|
2903
2899
|
op: "IS_NAN"
|
|
2904
2900
|
}
|
|
2905
2901
|
};
|
|
2906
2902
|
if (jt(t.value)) return {
|
|
2907
2903
|
unaryFilter: {
|
|
2908
|
-
field:
|
|
2904
|
+
field: Wn(t.field),
|
|
2909
2905
|
op: "IS_NULL"
|
|
2910
2906
|
}
|
|
2911
2907
|
};
|
|
2912
2908
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
2913
2909
|
if (Mt(t.value)) return {
|
|
2914
2910
|
unaryFilter: {
|
|
2915
|
-
field:
|
|
2911
|
+
field: Wn(t.field),
|
|
2916
2912
|
op: "IS_NOT_NAN"
|
|
2917
2913
|
}
|
|
2918
2914
|
};
|
|
2919
2915
|
if (jt(t.value)) return {
|
|
2920
2916
|
unaryFilter: {
|
|
2921
|
-
field:
|
|
2917
|
+
field: Wn(t.field),
|
|
2922
2918
|
op: "IS_NOT_NULL"
|
|
2923
2919
|
}
|
|
2924
2920
|
};
|
|
2925
2921
|
}
|
|
2926
2922
|
return {
|
|
2927
2923
|
fieldFilter: {
|
|
2928
|
-
field:
|
|
2929
|
-
op:
|
|
2924
|
+
field: Wn(t.field),
|
|
2925
|
+
op: Qn(t.op),
|
|
2930
2926
|
value: t.value
|
|
2931
2927
|
}
|
|
2932
2928
|
};
|
|
@@ -2946,8 +2942,8 @@ function Gn(t, n) {
|
|
|
2946
2942
|
// visible for testing
|
|
2947
2943
|
function(t) {
|
|
2948
2944
|
return {
|
|
2949
|
-
field:
|
|
2950
|
-
direction:
|
|
2945
|
+
field: Wn(t.field),
|
|
2946
|
+
direction: Gn(t.dir)
|
|
2951
2947
|
};
|
|
2952
2948
|
}(t)));
|
|
2953
2949
|
}(n.orderBy);
|
|
@@ -2971,29 +2967,29 @@ function Gn(t, n) {
|
|
|
2971
2967
|
(n.endAt)), e;
|
|
2972
2968
|
}
|
|
2973
2969
|
|
|
2974
|
-
function
|
|
2975
|
-
return
|
|
2970
|
+
function Gn(t) {
|
|
2971
|
+
return Nn[t];
|
|
2976
2972
|
}
|
|
2977
2973
|
|
|
2978
2974
|
// visible for testing
|
|
2979
|
-
function
|
|
2980
|
-
return
|
|
2975
|
+
function Qn(t) {
|
|
2976
|
+
return Dn[t];
|
|
2981
2977
|
}
|
|
2982
2978
|
|
|
2983
|
-
function
|
|
2979
|
+
function Wn(t) {
|
|
2984
2980
|
return {
|
|
2985
2981
|
fieldPath: t.canonicalString()
|
|
2986
2982
|
};
|
|
2987
2983
|
}
|
|
2988
2984
|
|
|
2989
|
-
function
|
|
2985
|
+
function Yn(t) {
|
|
2990
2986
|
const n = [];
|
|
2991
2987
|
return t.fields.forEach((t => n.push(t.canonicalString()))), {
|
|
2992
2988
|
fieldPaths: n
|
|
2993
2989
|
};
|
|
2994
2990
|
}
|
|
2995
2991
|
|
|
2996
|
-
function
|
|
2992
|
+
function Hn(t) {
|
|
2997
2993
|
// Resource names have at least 4 components (project ID, database ID)
|
|
2998
2994
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
2999
2995
|
}
|
|
@@ -3013,8 +3009,8 @@ function Kn(t) {
|
|
|
3013
3009
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3014
3010
|
* See the License for the specific language governing permissions and
|
|
3015
3011
|
* limitations under the License.
|
|
3016
|
-
*/ function
|
|
3017
|
-
return new
|
|
3012
|
+
*/ function Kn(t) {
|
|
3013
|
+
return new $n(t, /* useProto3Json= */ !0);
|
|
3018
3014
|
}
|
|
3019
3015
|
|
|
3020
3016
|
/**
|
|
@@ -3042,7 +3038,7 @@ function Kn(t) {
|
|
|
3042
3038
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
3043
3039
|
* delays causing spikes of load to the backend.
|
|
3044
3040
|
*/
|
|
3045
|
-
class
|
|
3041
|
+
class Jn {
|
|
3046
3042
|
constructor(
|
|
3047
3043
|
/**
|
|
3048
3044
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -3140,7 +3136,7 @@ class Xn {
|
|
|
3140
3136
|
* An implementation of Datastore that exposes additional state for internal
|
|
3141
3137
|
* consumption.
|
|
3142
3138
|
*/
|
|
3143
|
-
class
|
|
3139
|
+
class Xn extends class {} {
|
|
3144
3140
|
constructor(t, n, e, r) {
|
|
3145
3141
|
super(), this.authCredentials = t, this.appCheckCredentials = n, this.K = e, this.q = r,
|
|
3146
3142
|
this.J = !1;
|
|
@@ -3167,19 +3163,19 @@ class Zn extends class {} {
|
|
|
3167
3163
|
|
|
3168
3164
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3169
3165
|
// firestore-exp client.
|
|
3170
|
-
async function
|
|
3171
|
-
const e = E(t), r =
|
|
3172
|
-
writes: n.map((t =>
|
|
3166
|
+
async function Zn(t, n) {
|
|
3167
|
+
const e = E(t), r = Un(e.q) + "/documents", s = {
|
|
3168
|
+
writes: n.map((t => Bn(e.q, t)))
|
|
3173
3169
|
};
|
|
3174
3170
|
await e.m("Commit", r, s);
|
|
3175
3171
|
}
|
|
3176
3172
|
|
|
3177
|
-
async function
|
|
3178
|
-
const e = E(t), r =
|
|
3179
|
-
documents: n.map((t =>
|
|
3173
|
+
async function te(t, n) {
|
|
3174
|
+
const e = E(t), r = Un(e.q) + "/documents", s = {
|
|
3175
|
+
documents: n.map((t => Cn(e.q, t)))
|
|
3180
3176
|
}, i = await e.T("BatchGetDocuments", r, s), o = new Map;
|
|
3181
3177
|
i.forEach((t => {
|
|
3182
|
-
const n =
|
|
3178
|
+
const n = Mn(e.q, t);
|
|
3183
3179
|
o.set(n.key.toString(), n);
|
|
3184
3180
|
}));
|
|
3185
3181
|
const u = [];
|
|
@@ -3189,12 +3185,12 @@ async function ne(t, n) {
|
|
|
3189
3185
|
})), u;
|
|
3190
3186
|
}
|
|
3191
3187
|
|
|
3192
|
-
async function
|
|
3193
|
-
const e = E(t), r =
|
|
3188
|
+
async function ne(t, n) {
|
|
3189
|
+
const e = E(t), r = zn(e.q, wn(n));
|
|
3194
3190
|
return (await e.T("RunQuery", r.parent, {
|
|
3195
3191
|
structuredQuery: r.structuredQuery
|
|
3196
3192
|
})).filter((t => !!t.document)).map((t => function(t, n, e) {
|
|
3197
|
-
const r =
|
|
3193
|
+
const r = Ln(t, n.name), s = qn(n.updateTime), i = new Gt({
|
|
3198
3194
|
mapValue: {
|
|
3199
3195
|
fields: n.fields
|
|
3200
3196
|
}
|
|
@@ -3218,7 +3214,7 @@ async function ee(t, n) {
|
|
|
3218
3214
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3219
3215
|
* See the License for the specific language governing permissions and
|
|
3220
3216
|
* limitations under the License.
|
|
3221
|
-
*/ const
|
|
3217
|
+
*/ const ee = new Map;
|
|
3222
3218
|
|
|
3223
3219
|
/**
|
|
3224
3220
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -3229,17 +3225,17 @@ async function ee(t, n) {
|
|
|
3229
3225
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
3230
3226
|
* instance is terminated.
|
|
3231
3227
|
*/
|
|
3232
|
-
function
|
|
3228
|
+
function re(t) {
|
|
3233
3229
|
if (t._terminated) throw new U(F, "The client has already been terminated.");
|
|
3234
|
-
if (!
|
|
3230
|
+
if (!ee.has(t)) {
|
|
3235
3231
|
p("ComponentProvider", "Initializing Datastore");
|
|
3236
3232
|
const i = function(t) {
|
|
3237
3233
|
return new mt(t, fetch.bind(null));
|
|
3238
3234
|
}((n = t._databaseId, e = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
|
|
3239
|
-
new K(n, e, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o =
|
|
3240
|
-
return new
|
|
3235
|
+
new K(n, e, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = Kn(t._databaseId), u = function(t, n, e, r) {
|
|
3236
|
+
return new Xn(t, n, e, r);
|
|
3241
3237
|
}(t._authCredentials, t._appCheckCredentials, i, o);
|
|
3242
|
-
|
|
3238
|
+
ee.set(t, u);
|
|
3243
3239
|
}
|
|
3244
3240
|
var n, e, r, s;
|
|
3245
3241
|
/**
|
|
@@ -3257,7 +3253,7 @@ function se(t) {
|
|
|
3257
3253
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3258
3254
|
* See the License for the specific language governing permissions and
|
|
3259
3255
|
* limitations under the License.
|
|
3260
|
-
*/ return
|
|
3256
|
+
*/ return ee.get(t);
|
|
3261
3257
|
}
|
|
3262
3258
|
|
|
3263
3259
|
/**
|
|
@@ -3269,7 +3265,7 @@ function se(t) {
|
|
|
3269
3265
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
3270
3266
|
* defaults can be supplied and the value can be checked for equality.
|
|
3271
3267
|
*/
|
|
3272
|
-
class
|
|
3268
|
+
class se {
|
|
3273
3269
|
constructor(t) {
|
|
3274
3270
|
var n;
|
|
3275
3271
|
if (void 0 === t.host) {
|
|
@@ -3311,14 +3307,14 @@ class ie {
|
|
|
3311
3307
|
* The Cloud Firestore service interface.
|
|
3312
3308
|
*
|
|
3313
3309
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3314
|
-
*/ class
|
|
3310
|
+
*/ class ie {
|
|
3315
3311
|
/** @hideconstructor */
|
|
3316
3312
|
constructor(t, n, e) {
|
|
3317
3313
|
this._authCredentials = n, this._appCheckCredentials = e,
|
|
3318
3314
|
/**
|
|
3319
3315
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
3320
3316
|
*/
|
|
3321
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
3317
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new se({}),
|
|
3322
3318
|
this._settingsFrozen = !1, t instanceof J ? this._databaseId = t : (this._app = t,
|
|
3323
3319
|
this._databaseId = function(t) {
|
|
3324
3320
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(R, '"projectId" not provided in firebase.initializeApp.');
|
|
@@ -3351,7 +3347,7 @@ class ie {
|
|
|
3351
3347
|
}
|
|
3352
3348
|
_setSettings(t) {
|
|
3353
3349
|
if (this._settingsFrozen) throw new U(F, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
|
|
3354
|
-
this._settings = new
|
|
3350
|
+
this._settings = new se(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
3355
3351
|
if (!t) return new B;
|
|
3356
3352
|
switch (t.type) {
|
|
3357
3353
|
case "gapi":
|
|
@@ -3392,13 +3388,13 @@ class ie {
|
|
|
3392
3388
|
* Only ever called once.
|
|
3393
3389
|
*/ _terminate() {
|
|
3394
3390
|
return function(t) {
|
|
3395
|
-
const n =
|
|
3396
|
-
n && (p("ComponentProvider", "Removing Datastore"),
|
|
3391
|
+
const n = ee.get(t);
|
|
3392
|
+
n && (p("ComponentProvider", "Removing Datastore"), ee.delete(t), n.terminate());
|
|
3397
3393
|
}(this), Promise.resolve();
|
|
3398
3394
|
}
|
|
3399
3395
|
}
|
|
3400
3396
|
|
|
3401
|
-
function
|
|
3397
|
+
function oe(t, n) {
|
|
3402
3398
|
const e = _getProvider(t, "firestore/lite");
|
|
3403
3399
|
if (e.isInitialized()) throw new U(F, "Firestore can only be initialized once per app.");
|
|
3404
3400
|
return e.initialize({
|
|
@@ -3414,7 +3410,7 @@ function ue(t, n) {
|
|
|
3414
3410
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
3415
3411
|
* instance is associated with.
|
|
3416
3412
|
* @returns The `Firestore` instance of the provided app.
|
|
3417
|
-
*/ function
|
|
3413
|
+
*/ function ue(n = t()) {
|
|
3418
3414
|
return _getProvider(n, "firestore/lite").getImmediate();
|
|
3419
3415
|
}
|
|
3420
3416
|
|
|
@@ -3430,9 +3426,9 @@ function ue(t, n) {
|
|
|
3430
3426
|
* @param port - the emulator port (ex: 9000).
|
|
3431
3427
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
3432
3428
|
* Security Rules.
|
|
3433
|
-
*/ function
|
|
3429
|
+
*/ function ce(t, n, e, r = {}) {
|
|
3434
3430
|
var s;
|
|
3435
|
-
const i = (t = ut(t,
|
|
3431
|
+
const i = (t = ut(t, ie))._getSettings();
|
|
3436
3432
|
if ("firestore.googleapis.com" !== i.host && i.host !== n && _("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
3437
3433
|
t._setSettings(Object.assign(Object.assign({}, i), {
|
|
3438
3434
|
host: `${n}:${e}`,
|
|
@@ -3470,8 +3466,8 @@ function ue(t, n) {
|
|
|
3470
3466
|
* @param firestore - The `Firestore` instance to terminate.
|
|
3471
3467
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
3472
3468
|
* terminated.
|
|
3473
|
-
*/ function
|
|
3474
|
-
return t = ut(t,
|
|
3469
|
+
*/ function ae(t) {
|
|
3470
|
+
return t = ut(t, ie), n(t.app, "firestore/lite"), t._delete();
|
|
3475
3471
|
}
|
|
3476
3472
|
|
|
3477
3473
|
/**
|
|
@@ -3511,7 +3507,7 @@ function ue(t, n) {
|
|
|
3511
3507
|
* and can be used to write, read, or listen to the location. The document at
|
|
3512
3508
|
* the referenced location may or may not exist.
|
|
3513
3509
|
*/
|
|
3514
|
-
class
|
|
3510
|
+
class he {
|
|
3515
3511
|
/** @hideconstructor */
|
|
3516
3512
|
constructor(t,
|
|
3517
3513
|
/**
|
|
@@ -3539,17 +3535,17 @@ class le {
|
|
|
3539
3535
|
/**
|
|
3540
3536
|
* The collection this `DocumentReference` belongs to.
|
|
3541
3537
|
*/ get parent() {
|
|
3542
|
-
return new
|
|
3538
|
+
return new fe(this.firestore, this.converter, this._key.path.popLast());
|
|
3543
3539
|
}
|
|
3544
3540
|
withConverter(t) {
|
|
3545
|
-
return new
|
|
3541
|
+
return new he(this.firestore, t, this._key);
|
|
3546
3542
|
}
|
|
3547
3543
|
}
|
|
3548
3544
|
|
|
3549
3545
|
/**
|
|
3550
3546
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
3551
3547
|
* construct refined `Query` objects by adding filters and ordering.
|
|
3552
|
-
*/ class
|
|
3548
|
+
*/ class le {
|
|
3553
3549
|
// This is the lite version of the Query class in the main SDK.
|
|
3554
3550
|
/** @hideconstructor protected */
|
|
3555
3551
|
constructor(t,
|
|
@@ -3562,14 +3558,14 @@ class le {
|
|
|
3562
3558
|
this.type = "query", this.firestore = t;
|
|
3563
3559
|
}
|
|
3564
3560
|
withConverter(t) {
|
|
3565
|
-
return new
|
|
3561
|
+
return new le(this.firestore, t, this._query);
|
|
3566
3562
|
}
|
|
3567
3563
|
}
|
|
3568
3564
|
|
|
3569
3565
|
/**
|
|
3570
3566
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
3571
3567
|
* document references, and querying for documents (using {@link query}).
|
|
3572
|
-
*/ class
|
|
3568
|
+
*/ class fe extends le {
|
|
3573
3569
|
/** @hideconstructor */
|
|
3574
3570
|
constructor(t, n, e) {
|
|
3575
3571
|
super(t, n, new an(e)), this._path = e,
|
|
@@ -3590,23 +3586,23 @@ class le {
|
|
|
3590
3586
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
3591
3587
|
*/ get parent() {
|
|
3592
3588
|
const t = this._path.popLast();
|
|
3593
|
-
return t.isEmpty() ? null : new
|
|
3589
|
+
return t.isEmpty() ? null : new he(this.firestore,
|
|
3594
3590
|
/* converter= */ null, new et(t));
|
|
3595
3591
|
}
|
|
3596
3592
|
withConverter(t) {
|
|
3597
|
-
return new
|
|
3593
|
+
return new fe(this.firestore, t, this._path);
|
|
3598
3594
|
}
|
|
3599
3595
|
}
|
|
3600
3596
|
|
|
3601
|
-
function
|
|
3602
|
-
if (t = l(t), rt("collection", "path", n), t instanceof
|
|
3597
|
+
function de(t, n, ...e) {
|
|
3598
|
+
if (t = l(t), rt("collection", "path", n), t instanceof ie) {
|
|
3603
3599
|
const r = Z.fromString(n, ...e);
|
|
3604
|
-
return it(r), new
|
|
3600
|
+
return it(r), new fe(t, /* converter= */ null, r);
|
|
3605
3601
|
}
|
|
3606
3602
|
{
|
|
3607
|
-
if (!(t instanceof
|
|
3603
|
+
if (!(t instanceof he || t instanceof fe)) throw new U(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3608
3604
|
const r = t._path.child(Z.fromString(n, ...e));
|
|
3609
|
-
return it(r), new
|
|
3605
|
+
return it(r), new fe(t.firestore,
|
|
3610
3606
|
/* converter= */ null, r);
|
|
3611
3607
|
}
|
|
3612
3608
|
}
|
|
@@ -3623,9 +3619,9 @@ function we(t, n, ...e) {
|
|
|
3623
3619
|
* collection or subcollection with this ID as the last segment of its path
|
|
3624
3620
|
* will be included. Cannot contain a slash.
|
|
3625
3621
|
* @returns The created `Query`.
|
|
3626
|
-
*/ function
|
|
3627
|
-
if (t = ut(t,
|
|
3628
|
-
return new
|
|
3622
|
+
*/ function we(t, n) {
|
|
3623
|
+
if (t = ut(t, ie), rt("collectionGroup", "collection id", n), n.indexOf("/") >= 0) throw new U(R, `Invalid collection ID '${n}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
3624
|
+
return new le(t,
|
|
3629
3625
|
/* converter= */ null,
|
|
3630
3626
|
/**
|
|
3631
3627
|
* Creates a new Query for a collection group query that matches all documents
|
|
@@ -3636,19 +3632,19 @@ function we(t, n, ...e) {
|
|
|
3636
3632
|
}(n));
|
|
3637
3633
|
}
|
|
3638
3634
|
|
|
3639
|
-
function
|
|
3635
|
+
function me(t, n, ...e) {
|
|
3640
3636
|
if (t = l(t),
|
|
3641
3637
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3642
3638
|
// 'undefined' and 'null'.
|
|
3643
|
-
1 === arguments.length && (n = yt.R()), rt("doc", "path", n), t instanceof
|
|
3639
|
+
1 === arguments.length && (n = yt.R()), rt("doc", "path", n), t instanceof ie) {
|
|
3644
3640
|
const r = Z.fromString(n, ...e);
|
|
3645
|
-
return st(r), new
|
|
3641
|
+
return st(r), new he(t,
|
|
3646
3642
|
/* converter= */ null, new et(r));
|
|
3647
3643
|
}
|
|
3648
3644
|
{
|
|
3649
|
-
if (!(t instanceof
|
|
3645
|
+
if (!(t instanceof he || t instanceof fe)) throw new U(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3650
3646
|
const r = t._path.child(Z.fromString(n, ...e));
|
|
3651
|
-
return st(r), new
|
|
3647
|
+
return st(r), new he(t.firestore, t instanceof fe ? t.converter : null, new et(r));
|
|
3652
3648
|
}
|
|
3653
3649
|
}
|
|
3654
3650
|
|
|
@@ -3659,8 +3655,8 @@ function pe(t, n, ...e) {
|
|
|
3659
3655
|
* @param right - A reference to compare.
|
|
3660
3656
|
* @returns true if the references point to the same location in the same
|
|
3661
3657
|
* Firestore database.
|
|
3662
|
-
*/ function
|
|
3663
|
-
return t = l(t), n = l(n), (t instanceof
|
|
3658
|
+
*/ function pe(t, n) {
|
|
3659
|
+
return t = l(t), n = l(n), (t instanceof he || t instanceof fe) && (n instanceof he || n instanceof fe) && (t.firestore === n.firestore && t.path === n.path && t.converter === n.converter);
|
|
3664
3660
|
}
|
|
3665
3661
|
|
|
3666
3662
|
/**
|
|
@@ -3671,8 +3667,8 @@ function pe(t, n, ...e) {
|
|
|
3671
3667
|
* @param right - A `Query` to compare.
|
|
3672
3668
|
* @returns true if the references point to the same location in the same
|
|
3673
3669
|
* Firestore database.
|
|
3674
|
-
*/ function
|
|
3675
|
-
return t = l(t), n = l(n), t instanceof
|
|
3670
|
+
*/ function ye(t, n) {
|
|
3671
|
+
return t = l(t), n = l(n), t instanceof le && n instanceof le && (t.firestore === n.firestore && mn(t._query, n._query) && t.converter === n.converter);
|
|
3676
3672
|
}
|
|
3677
3673
|
|
|
3678
3674
|
/**
|
|
@@ -3698,7 +3694,7 @@ function pe(t, n, ...e) {
|
|
|
3698
3694
|
*
|
|
3699
3695
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
3700
3696
|
* name is provided, the path will point to a nested field in a document.
|
|
3701
|
-
*/ class
|
|
3697
|
+
*/ class _e {
|
|
3702
3698
|
/**
|
|
3703
3699
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
3704
3700
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -3722,8 +3718,8 @@ function pe(t, n, ...e) {
|
|
|
3722
3718
|
/**
|
|
3723
3719
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
3724
3720
|
* It can be used in queries to sort or filter by the document ID.
|
|
3725
|
-
*/ function
|
|
3726
|
-
return new
|
|
3721
|
+
*/ function ge() {
|
|
3722
|
+
return new _e("__name__");
|
|
3727
3723
|
}
|
|
3728
3724
|
|
|
3729
3725
|
/**
|
|
@@ -3744,7 +3740,7 @@ function pe(t, n, ...e) {
|
|
|
3744
3740
|
*/
|
|
3745
3741
|
/**
|
|
3746
3742
|
* An immutable object representing an array of bytes.
|
|
3747
|
-
*/ class
|
|
3743
|
+
*/ class ve {
|
|
3748
3744
|
/** @hideconstructor */
|
|
3749
3745
|
constructor(t) {
|
|
3750
3746
|
this._byteString = t;
|
|
@@ -3756,7 +3752,7 @@ function pe(t, n, ...e) {
|
|
|
3756
3752
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3757
3753
|
*/ static fromBase64String(t) {
|
|
3758
3754
|
try {
|
|
3759
|
-
return new
|
|
3755
|
+
return new ve(Rt.fromBase64String(t));
|
|
3760
3756
|
} catch (t) {
|
|
3761
3757
|
throw new U(R, "Failed to construct data from Base64 string: " + t);
|
|
3762
3758
|
}
|
|
@@ -3766,7 +3762,7 @@ function pe(t, n, ...e) {
|
|
|
3766
3762
|
*
|
|
3767
3763
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3768
3764
|
*/ static fromUint8Array(t) {
|
|
3769
|
-
return new
|
|
3765
|
+
return new ve(Rt.fromUint8Array(t));
|
|
3770
3766
|
}
|
|
3771
3767
|
/**
|
|
3772
3768
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3818,7 +3814,7 @@ function pe(t, n, ...e) {
|
|
|
3818
3814
|
/**
|
|
3819
3815
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
3820
3816
|
* or `update()`.
|
|
3821
|
-
*/ class
|
|
3817
|
+
*/ class be {
|
|
3822
3818
|
/**
|
|
3823
3819
|
* @param _methodName - The public API endpoint that returns this class.
|
|
3824
3820
|
* @hideconstructor
|
|
@@ -3850,7 +3846,7 @@ function pe(t, n, ...e) {
|
|
|
3850
3846
|
*
|
|
3851
3847
|
* Latitude values are in the range of [-90, 90].
|
|
3852
3848
|
* Longitude values are in the range of [-180, 180].
|
|
3853
|
-
*/ class
|
|
3849
|
+
*/ class Ee {
|
|
3854
3850
|
/**
|
|
3855
3851
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
3856
3852
|
* longitude values.
|
|
@@ -3909,29 +3905,29 @@ function pe(t, n, ...e) {
|
|
|
3909
3905
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3910
3906
|
* See the License for the specific language governing permissions and
|
|
3911
3907
|
* limitations under the License.
|
|
3912
|
-
*/ const
|
|
3908
|
+
*/ const Te = /^__.*__$/;
|
|
3913
3909
|
|
|
3914
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
3910
|
+
/** The result of parsing document data (e.g. for a setData call). */ class Ie {
|
|
3915
3911
|
constructor(t, n, e) {
|
|
3916
3912
|
this.data = t, this.fieldMask = n, this.fieldTransforms = e;
|
|
3917
3913
|
}
|
|
3918
3914
|
toMutation(t, n) {
|
|
3919
|
-
return null !== this.fieldMask ? new
|
|
3915
|
+
return null !== this.fieldMask ? new Rn(t, this.data, this.fieldMask, n, this.fieldTransforms) : new An(t, this.data, n, this.fieldTransforms);
|
|
3920
3916
|
}
|
|
3921
3917
|
}
|
|
3922
3918
|
|
|
3923
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
3919
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class Ae {
|
|
3924
3920
|
constructor(t,
|
|
3925
3921
|
// The fieldMask does not include document transforms.
|
|
3926
3922
|
n, e) {
|
|
3927
3923
|
this.data = t, this.fieldMask = n, this.fieldTransforms = e;
|
|
3928
3924
|
}
|
|
3929
3925
|
toMutation(t, n) {
|
|
3930
|
-
return new
|
|
3926
|
+
return new Rn(t, this.data, this.fieldMask, n, this.fieldTransforms);
|
|
3931
3927
|
}
|
|
3932
3928
|
}
|
|
3933
3929
|
|
|
3934
|
-
function
|
|
3930
|
+
function Re(t) {
|
|
3935
3931
|
switch (t) {
|
|
3936
3932
|
case 0 /* Set */ :
|
|
3937
3933
|
// fall through
|
|
@@ -3949,7 +3945,7 @@ function Pe(t) {
|
|
|
3949
3945
|
}
|
|
3950
3946
|
}
|
|
3951
3947
|
|
|
3952
|
-
/** A "context" object passed around while parsing user data. */ class
|
|
3948
|
+
/** A "context" object passed around while parsing user data. */ class Pe {
|
|
3953
3949
|
/**
|
|
3954
3950
|
* Initializes a ParseContext with the given source and path.
|
|
3955
3951
|
*
|
|
@@ -3981,7 +3977,7 @@ function Pe(t) {
|
|
|
3981
3977
|
return this.settings.tt;
|
|
3982
3978
|
}
|
|
3983
3979
|
/** Returns a new context with the specified settings overwritten. */ nt(t) {
|
|
3984
|
-
return new
|
|
3980
|
+
return new Pe(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
3985
3981
|
}
|
|
3986
3982
|
et(t) {
|
|
3987
3983
|
var n;
|
|
@@ -4008,7 +4004,7 @@ function Pe(t) {
|
|
|
4008
4004
|
});
|
|
4009
4005
|
}
|
|
4010
4006
|
ut(t) {
|
|
4011
|
-
return
|
|
4007
|
+
return We(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
|
|
4012
4008
|
}
|
|
4013
4009
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
4014
4010
|
return void 0 !== this.fieldMask.find((n => t.isPrefixOf(n))) || void 0 !== this.fieldTransforms.find((n => t.isPrefixOf(n.field)));
|
|
@@ -4020,19 +4016,19 @@ function Pe(t) {
|
|
|
4020
4016
|
}
|
|
4021
4017
|
st(t) {
|
|
4022
4018
|
if (0 === t.length) throw this.ut("Document fields must not be empty");
|
|
4023
|
-
if (
|
|
4019
|
+
if (Re(this.tt) && Te.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
|
|
4024
4020
|
}
|
|
4025
4021
|
}
|
|
4026
4022
|
|
|
4027
4023
|
/**
|
|
4028
4024
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
4029
4025
|
* classes.
|
|
4030
|
-
*/ class
|
|
4026
|
+
*/ class Ve {
|
|
4031
4027
|
constructor(t, n, e) {
|
|
4032
|
-
this.databaseId = t, this.ignoreUndefinedProperties = n, this.q = e ||
|
|
4028
|
+
this.databaseId = t, this.ignoreUndefinedProperties = n, this.q = e || Kn(t);
|
|
4033
4029
|
}
|
|
4034
4030
|
/** Creates a new top-level parse context. */ ht(t, n, e, r = !1) {
|
|
4035
|
-
return new
|
|
4031
|
+
return new Pe({
|
|
4036
4032
|
tt: t,
|
|
4037
4033
|
methodName: n,
|
|
4038
4034
|
at: e,
|
|
@@ -4043,29 +4039,29 @@ function Pe(t) {
|
|
|
4043
4039
|
}
|
|
4044
4040
|
}
|
|
4045
4041
|
|
|
4046
|
-
function
|
|
4047
|
-
const n = t._freezeSettings(), e =
|
|
4048
|
-
return new
|
|
4042
|
+
function Ne(t) {
|
|
4043
|
+
const n = t._freezeSettings(), e = Kn(t._databaseId);
|
|
4044
|
+
return new Ve(t._databaseId, !!n.ignoreUndefinedProperties, e);
|
|
4049
4045
|
}
|
|
4050
4046
|
|
|
4051
|
-
/** Parse document data from a set() call. */ function
|
|
4047
|
+
/** Parse document data from a set() call. */ function De(t, n, e, r, s, i = {}) {
|
|
4052
4048
|
const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , n, e, s);
|
|
4053
|
-
|
|
4054
|
-
const u =
|
|
4049
|
+
Be("Data must be an object, but it was:", o, r);
|
|
4050
|
+
const u = je(r, o);
|
|
4055
4051
|
let c, a;
|
|
4056
4052
|
if (i.merge) c = new It(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
|
|
4057
4053
|
const t = [];
|
|
4058
4054
|
for (const r of i.mergeFields) {
|
|
4059
|
-
const s =
|
|
4055
|
+
const s = ze(n, r, e);
|
|
4060
4056
|
if (!o.contains(s)) throw new U(R, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4061
|
-
|
|
4057
|
+
Ye(t, s) || t.push(s);
|
|
4062
4058
|
}
|
|
4063
4059
|
c = new It(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4064
4060
|
} else c = null, a = o.fieldTransforms;
|
|
4065
|
-
return new
|
|
4061
|
+
return new Ie(new Gt(u), c, a);
|
|
4066
4062
|
}
|
|
4067
4063
|
|
|
4068
|
-
class
|
|
4064
|
+
class $e extends be {
|
|
4069
4065
|
_toFieldTransform(t) {
|
|
4070
4066
|
if (2 /* MergeSet */ !== t.tt) throw 1 /* Update */ === t.tt ? t.ut(`${this._methodName}() can only appear at the top level of your update data`) : t.ut(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
4071
4067
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4073,7 +4069,7 @@ class Se extends Ee {
|
|
|
4073
4069
|
return t.fieldMask.push(t.path), null;
|
|
4074
4070
|
}
|
|
4075
4071
|
isEqual(t) {
|
|
4076
|
-
return t instanceof
|
|
4072
|
+
return t instanceof $e;
|
|
4077
4073
|
}
|
|
4078
4074
|
}
|
|
4079
4075
|
|
|
@@ -4092,8 +4088,8 @@ class Se extends Ee {
|
|
|
4092
4088
|
* context.
|
|
4093
4089
|
* @param context - The parent context.
|
|
4094
4090
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4095
|
-
*/ function
|
|
4096
|
-
return new
|
|
4091
|
+
*/ function Se(t, n, e) {
|
|
4092
|
+
return new Pe({
|
|
4097
4093
|
tt: 3 /* Argument */ ,
|
|
4098
4094
|
at: n.settings.at,
|
|
4099
4095
|
methodName: t._methodName,
|
|
@@ -4101,23 +4097,23 @@ class Se extends Ee {
|
|
|
4101
4097
|
}, n.databaseId, n.q, n.ignoreUndefinedProperties);
|
|
4102
4098
|
}
|
|
4103
4099
|
|
|
4104
|
-
class
|
|
4100
|
+
class Fe extends be {
|
|
4105
4101
|
_toFieldTransform(t) {
|
|
4106
|
-
return new
|
|
4102
|
+
return new En(t.path, new _n);
|
|
4107
4103
|
}
|
|
4108
4104
|
isEqual(t) {
|
|
4109
|
-
return t instanceof
|
|
4105
|
+
return t instanceof Fe;
|
|
4110
4106
|
}
|
|
4111
4107
|
}
|
|
4112
4108
|
|
|
4113
|
-
class
|
|
4109
|
+
class xe extends be {
|
|
4114
4110
|
constructor(t, n) {
|
|
4115
4111
|
super(t), this.lt = n;
|
|
4116
4112
|
}
|
|
4117
4113
|
_toFieldTransform(t) {
|
|
4118
|
-
const n =
|
|
4119
|
-
/*array=*/ !0), e = this.lt.map((t =>
|
|
4120
|
-
return new
|
|
4114
|
+
const n = Se(this, t,
|
|
4115
|
+
/*array=*/ !0), e = this.lt.map((t => Ue(t, n))), r = new gn(e);
|
|
4116
|
+
return new En(t.path, r);
|
|
4121
4117
|
}
|
|
4122
4118
|
isEqual(t) {
|
|
4123
4119
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4125,14 +4121,14 @@ class qe extends Ee {
|
|
|
4125
4121
|
}
|
|
4126
4122
|
}
|
|
4127
4123
|
|
|
4128
|
-
class
|
|
4124
|
+
class qe extends be {
|
|
4129
4125
|
constructor(t, n) {
|
|
4130
4126
|
super(t), this.lt = n;
|
|
4131
4127
|
}
|
|
4132
4128
|
_toFieldTransform(t) {
|
|
4133
|
-
const n =
|
|
4134
|
-
/*array=*/ !0), e = this.lt.map((t =>
|
|
4135
|
-
return new
|
|
4129
|
+
const n = Se(this, t,
|
|
4130
|
+
/*array=*/ !0), e = this.lt.map((t => Ue(t, n))), r = new vn(e);
|
|
4131
|
+
return new En(t.path, r);
|
|
4136
4132
|
}
|
|
4137
4133
|
isEqual(t) {
|
|
4138
4134
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4140,13 +4136,13 @@ class Oe extends Ee {
|
|
|
4140
4136
|
}
|
|
4141
4137
|
}
|
|
4142
4138
|
|
|
4143
|
-
class
|
|
4139
|
+
class Oe extends be {
|
|
4144
4140
|
constructor(t, n) {
|
|
4145
4141
|
super(t), this.ft = n;
|
|
4146
4142
|
}
|
|
4147
4143
|
_toFieldTransform(t) {
|
|
4148
|
-
const n = new
|
|
4149
|
-
return new
|
|
4144
|
+
const n = new bn(t.q, pn(t.q, this.ft));
|
|
4145
|
+
return new En(t.path, n);
|
|
4150
4146
|
}
|
|
4151
4147
|
isEqual(t) {
|
|
4152
4148
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4154,50 +4150,50 @@ class Ce extends Ee {
|
|
|
4154
4150
|
}
|
|
4155
4151
|
}
|
|
4156
4152
|
|
|
4157
|
-
/** Parse update data from an update() call. */ function
|
|
4153
|
+
/** Parse update data from an update() call. */ function Ce(t, n, e, r) {
|
|
4158
4154
|
const s = t.ht(1 /* Update */ , n, e);
|
|
4159
|
-
|
|
4155
|
+
Be("Data must be an object, but it was:", s, r);
|
|
4160
4156
|
const i = [], o = Gt.empty();
|
|
4161
4157
|
Tt(r, ((t, r) => {
|
|
4162
|
-
const u =
|
|
4158
|
+
const u = Qe(n, t, e);
|
|
4163
4159
|
// For Compat types, we have to "extract" the underlying types before
|
|
4164
4160
|
// performing validation.
|
|
4165
4161
|
r = l(r);
|
|
4166
4162
|
const c = s.it(u);
|
|
4167
|
-
if (r instanceof
|
|
4163
|
+
if (r instanceof $e)
|
|
4168
4164
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4169
4165
|
i.push(u); else {
|
|
4170
|
-
const t =
|
|
4166
|
+
const t = Ue(r, c);
|
|
4171
4167
|
null != t && (i.push(u), o.set(u, t));
|
|
4172
4168
|
}
|
|
4173
4169
|
}));
|
|
4174
4170
|
const u = new It(i);
|
|
4175
|
-
return new
|
|
4171
|
+
return new Ae(o, u, s.fieldTransforms);
|
|
4176
4172
|
}
|
|
4177
4173
|
|
|
4178
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
4179
|
-
const o = t.ht(1 /* Update */ , n, e), u = [
|
|
4174
|
+
/** Parse update data from a list of field/value arguments. */ function Le(t, n, e, r, s, i) {
|
|
4175
|
+
const o = t.ht(1 /* Update */ , n, e), u = [ ze(n, r, e) ], c = [ s ];
|
|
4180
4176
|
if (i.length % 2 != 0) throw new U(R, `Function ${n}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4181
|
-
for (let t = 0; t < i.length; t += 2) u.push(
|
|
4177
|
+
for (let t = 0; t < i.length; t += 2) u.push(ze(n, i[t])), c.push(i[t + 1]);
|
|
4182
4178
|
const a = [], h = Gt.empty();
|
|
4183
4179
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4184
4180
|
// user specified the field multiple times.
|
|
4185
|
-
for (let t = u.length - 1; t >= 0; --t) if (!
|
|
4181
|
+
for (let t = u.length - 1; t >= 0; --t) if (!Ye(a, u[t])) {
|
|
4186
4182
|
const n = u[t];
|
|
4187
4183
|
let e = c[t];
|
|
4188
4184
|
// For Compat types, we have to "extract" the underlying types before
|
|
4189
4185
|
// performing validation.
|
|
4190
4186
|
e = l(e);
|
|
4191
4187
|
const r = o.it(n);
|
|
4192
|
-
if (e instanceof
|
|
4188
|
+
if (e instanceof $e)
|
|
4193
4189
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4194
4190
|
a.push(n); else {
|
|
4195
|
-
const t =
|
|
4191
|
+
const t = Ue(e, r);
|
|
4196
4192
|
null != t && (a.push(n), h.set(n, t));
|
|
4197
4193
|
}
|
|
4198
4194
|
}
|
|
4199
4195
|
const f = new It(a);
|
|
4200
|
-
return new
|
|
4196
|
+
return new Ae(h, f, o.fieldTransforms);
|
|
4201
4197
|
}
|
|
4202
4198
|
|
|
4203
4199
|
/**
|
|
@@ -4206,8 +4202,8 @@ class Ce extends Ee {
|
|
|
4206
4202
|
*
|
|
4207
4203
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4208
4204
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4209
|
-
*/ function
|
|
4210
|
-
return
|
|
4205
|
+
*/ function ke(t, n, e, r = !1) {
|
|
4206
|
+
return Ue(e, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , n));
|
|
4211
4207
|
}
|
|
4212
4208
|
|
|
4213
4209
|
/**
|
|
@@ -4218,12 +4214,12 @@ class Ce extends Ee {
|
|
|
4218
4214
|
* the source of the data being parsed, etc.
|
|
4219
4215
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
4220
4216
|
* that should not be included in the resulting parsed data.
|
|
4221
|
-
*/ function
|
|
4222
|
-
if (
|
|
4217
|
+
*/ function Ue(t, n) {
|
|
4218
|
+
if (Me(
|
|
4223
4219
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4224
4220
|
// from firestore-exp.
|
|
4225
|
-
t = l(t))) return
|
|
4226
|
-
if (t instanceof
|
|
4221
|
+
t = l(t))) return Be("Unsupported field value:", n, t), je(t, n);
|
|
4222
|
+
if (t instanceof be)
|
|
4227
4223
|
// FieldValues usually parse into transforms (except deleteField())
|
|
4228
4224
|
// in which case we do not want to include this field in our parsed data
|
|
4229
4225
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -4235,7 +4231,7 @@ class Ce extends Ee {
|
|
|
4235
4231
|
*/
|
|
4236
4232
|
return function(t, n) {
|
|
4237
4233
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4238
|
-
if (!
|
|
4234
|
+
if (!Re(n.tt)) throw n.ut(`${t._methodName}() can only be used with update() and set()`);
|
|
4239
4235
|
if (!n.path) throw n.ut(`${t._methodName}() is not currently supported inside arrays`);
|
|
4240
4236
|
const e = t._toFieldTransform(n);
|
|
4241
4237
|
e && n.fieldTransforms.push(e);
|
|
@@ -4265,7 +4261,7 @@ class Ce extends Ee {
|
|
|
4265
4261
|
const e = [];
|
|
4266
4262
|
let r = 0;
|
|
4267
4263
|
for (const s of t) {
|
|
4268
|
-
let t =
|
|
4264
|
+
let t = Ue(s, n.ot(r));
|
|
4269
4265
|
null == t && (
|
|
4270
4266
|
// Just include nulls in the array for fields being replaced with a
|
|
4271
4267
|
// sentinel.
|
|
@@ -4284,7 +4280,7 @@ class Ce extends Ee {
|
|
|
4284
4280
|
if (null === (t = l(t))) return {
|
|
4285
4281
|
nullValue: "NULL_VALUE"
|
|
4286
4282
|
};
|
|
4287
|
-
if ("number" == typeof t) return
|
|
4283
|
+
if ("number" == typeof t) return pn(n.q, t);
|
|
4288
4284
|
if ("boolean" == typeof t) return {
|
|
4289
4285
|
booleanValue: t
|
|
4290
4286
|
};
|
|
@@ -4294,7 +4290,7 @@ class Ce extends Ee {
|
|
|
4294
4290
|
if (t instanceof Date) {
|
|
4295
4291
|
const e = vt.fromDate(t);
|
|
4296
4292
|
return {
|
|
4297
|
-
timestampValue:
|
|
4293
|
+
timestampValue: Sn(n.q, e)
|
|
4298
4294
|
};
|
|
4299
4295
|
}
|
|
4300
4296
|
if (t instanceof vt) {
|
|
@@ -4303,23 +4299,23 @@ class Ce extends Ee {
|
|
|
4303
4299
|
// truncation immediately without waiting for the backend to do that.
|
|
4304
4300
|
const e = new vt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
4305
4301
|
return {
|
|
4306
|
-
timestampValue:
|
|
4302
|
+
timestampValue: Sn(n.q, e)
|
|
4307
4303
|
};
|
|
4308
4304
|
}
|
|
4309
|
-
if (t instanceof
|
|
4305
|
+
if (t instanceof Ee) return {
|
|
4310
4306
|
geoPointValue: {
|
|
4311
4307
|
latitude: t.latitude,
|
|
4312
4308
|
longitude: t.longitude
|
|
4313
4309
|
}
|
|
4314
4310
|
};
|
|
4315
|
-
if (t instanceof
|
|
4316
|
-
bytesValue:
|
|
4311
|
+
if (t instanceof ve) return {
|
|
4312
|
+
bytesValue: Fn(n.q, t._byteString)
|
|
4317
4313
|
};
|
|
4318
|
-
if (t instanceof
|
|
4314
|
+
if (t instanceof he) {
|
|
4319
4315
|
const e = n.databaseId, r = t.firestore._databaseId;
|
|
4320
4316
|
if (!r.isEqual(e)) throw n.ut(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${e.projectId}/${e.database}`);
|
|
4321
4317
|
return {
|
|
4322
|
-
referenceValue:
|
|
4318
|
+
referenceValue: On(t.firestore._databaseId || n.databaseId, t._key.path)
|
|
4323
4319
|
};
|
|
4324
4320
|
}
|
|
4325
4321
|
throw n.ut(`Unsupported field value: ${ot(t)}`);
|
|
@@ -4333,13 +4329,13 @@ class Ce extends Ee {
|
|
|
4333
4329
|
*/ (t, n);
|
|
4334
4330
|
}
|
|
4335
4331
|
|
|
4336
|
-
function
|
|
4332
|
+
function je(t, n) {
|
|
4337
4333
|
const e = {};
|
|
4338
4334
|
return !function(t) {
|
|
4339
4335
|
for (const n in t) if (Object.prototype.hasOwnProperty.call(t, n)) return !1;
|
|
4340
4336
|
return !0;
|
|
4341
4337
|
}(t) ? Tt(t, ((t, r) => {
|
|
4342
|
-
const s =
|
|
4338
|
+
const s = Ue(r, n.et(t));
|
|
4343
4339
|
null != s && (e[t] = s);
|
|
4344
4340
|
})) :
|
|
4345
4341
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -4351,12 +4347,12 @@ function Me(t, n) {
|
|
|
4351
4347
|
};
|
|
4352
4348
|
}
|
|
4353
4349
|
|
|
4354
|
-
function
|
|
4355
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof vt || t instanceof
|
|
4350
|
+
function Me(t) {
|
|
4351
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof vt || t instanceof Ee || t instanceof ve || t instanceof he || t instanceof be);
|
|
4356
4352
|
}
|
|
4357
4353
|
|
|
4358
|
-
function
|
|
4359
|
-
if (!
|
|
4354
|
+
function Be(t, n, e) {
|
|
4355
|
+
if (!Me(e) || !function(t) {
|
|
4360
4356
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4361
4357
|
}(e)) {
|
|
4362
4358
|
const r = ot(e);
|
|
@@ -4366,20 +4362,20 @@ function ze(t, n, e) {
|
|
|
4366
4362
|
|
|
4367
4363
|
/**
|
|
4368
4364
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
4369
|
-
*/ function
|
|
4365
|
+
*/ function ze(t, n, e) {
|
|
4370
4366
|
if ((
|
|
4371
4367
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
4372
4368
|
// FieldPath.
|
|
4373
|
-
n = l(n)) instanceof
|
|
4374
|
-
if ("string" == typeof n) return
|
|
4375
|
-
throw
|
|
4369
|
+
n = l(n)) instanceof _e) return n._internalPath;
|
|
4370
|
+
if ("string" == typeof n) return Qe(t, n);
|
|
4371
|
+
throw We("Field path arguments must be of type string or ", t,
|
|
4376
4372
|
/* hasConverter= */ !1,
|
|
4377
4373
|
/* path= */ void 0, e);
|
|
4378
4374
|
}
|
|
4379
4375
|
|
|
4380
4376
|
/**
|
|
4381
4377
|
* Matches any characters in a field path string that are reserved.
|
|
4382
|
-
*/ const
|
|
4378
|
+
*/ const Ge = new RegExp("[~\\*/\\[\\]]");
|
|
4383
4379
|
|
|
4384
4380
|
/**
|
|
4385
4381
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -4389,20 +4385,20 @@ function ze(t, n, e) {
|
|
|
4389
4385
|
* split on dots.
|
|
4390
4386
|
* @param targetDoc - The document against which the field path will be
|
|
4391
4387
|
* evaluated.
|
|
4392
|
-
*/ function
|
|
4393
|
-
if (n.search(
|
|
4388
|
+
*/ function Qe(t, n, e) {
|
|
4389
|
+
if (n.search(Ge) >= 0) throw We(`Invalid field path (${n}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
4394
4390
|
/* hasConverter= */ !1,
|
|
4395
4391
|
/* path= */ void 0, e);
|
|
4396
4392
|
try {
|
|
4397
|
-
return new
|
|
4393
|
+
return new _e(...n.split("."))._internalPath;
|
|
4398
4394
|
} catch (r) {
|
|
4399
|
-
throw
|
|
4395
|
+
throw We(`Invalid field path (${n}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
4400
4396
|
/* hasConverter= */ !1,
|
|
4401
4397
|
/* path= */ void 0, e);
|
|
4402
4398
|
}
|
|
4403
4399
|
}
|
|
4404
4400
|
|
|
4405
|
-
function
|
|
4401
|
+
function We(t, n, e, r, s) {
|
|
4406
4402
|
const i = r && !r.isEmpty(), o = void 0 !== s;
|
|
4407
4403
|
let u = `Function ${n}() called with invalid data`;
|
|
4408
4404
|
e && (u += " (via `toFirestore()`)"), u += ". ";
|
|
@@ -4411,7 +4407,7 @@ function Ye(t, n, e, r, s) {
|
|
|
4411
4407
|
c += ")"), new U(R, u + t + c);
|
|
4412
4408
|
}
|
|
4413
4409
|
|
|
4414
|
-
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function
|
|
4410
|
+
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Ye(t, n) {
|
|
4415
4411
|
return t.some((t => t.isEqual(n)));
|
|
4416
4412
|
}
|
|
4417
4413
|
|
|
@@ -4439,7 +4435,7 @@ function Ye(t, n, e, r, s) {
|
|
|
4439
4435
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
4440
4436
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
4441
4437
|
* explicitly verify a document's existence.
|
|
4442
|
-
*/ class
|
|
4438
|
+
*/ class He {
|
|
4443
4439
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
4444
4440
|
// the legacy SDK. The changes are:
|
|
4445
4441
|
// - No support for SnapshotMetadata.
|
|
@@ -4455,7 +4451,7 @@ function Ye(t, n, e, r, s) {
|
|
|
4455
4451
|
/**
|
|
4456
4452
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
4457
4453
|
*/ get ref() {
|
|
4458
|
-
return new
|
|
4454
|
+
return new he(this._firestore, this._converter, this._key);
|
|
4459
4455
|
}
|
|
4460
4456
|
/**
|
|
4461
4457
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -4475,7 +4471,7 @@ function Ye(t, n, e, r, s) {
|
|
|
4475
4471
|
if (this._converter) {
|
|
4476
4472
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
4477
4473
|
// if a converter has been provided.
|
|
4478
|
-
const t = new
|
|
4474
|
+
const t = new Ke(this._firestore, this._userDataWriter, this._key, this._document,
|
|
4479
4475
|
/* converter= */ null);
|
|
4480
4476
|
return this._converter.fromFirestore(t);
|
|
4481
4477
|
}
|
|
@@ -4495,7 +4491,7 @@ function Ye(t, n, e, r, s) {
|
|
|
4495
4491
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4496
4492
|
get(t) {
|
|
4497
4493
|
if (this._document) {
|
|
4498
|
-
const n = this._document.data.field(
|
|
4494
|
+
const n = this._document.data.field(Ze("DocumentSnapshot.get", t));
|
|
4499
4495
|
if (null !== n) return this._userDataWriter.convertValue(n);
|
|
4500
4496
|
}
|
|
4501
4497
|
}
|
|
@@ -4511,7 +4507,7 @@ function Ye(t, n, e, r, s) {
|
|
|
4511
4507
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
4512
4508
|
* `exists` property will always be true and `data()` will never return
|
|
4513
4509
|
* 'undefined'.
|
|
4514
|
-
*/ class
|
|
4510
|
+
*/ class Ke extends He {
|
|
4515
4511
|
/**
|
|
4516
4512
|
* Retrieves all fields in the document as an `Object`.
|
|
4517
4513
|
*
|
|
@@ -4529,7 +4525,7 @@ function Ye(t, n, e, r, s) {
|
|
|
4529
4525
|
* array via the `docs` property or enumerated using the `forEach` method. The
|
|
4530
4526
|
* number of documents can be determined via the `empty` and `size`
|
|
4531
4527
|
* properties.
|
|
4532
|
-
*/ class
|
|
4528
|
+
*/ class Je {
|
|
4533
4529
|
/** @hideconstructor */
|
|
4534
4530
|
constructor(t, n) {
|
|
4535
4531
|
this._docs = n, this.query = t;
|
|
@@ -4560,14 +4556,14 @@ function Ye(t, n, e, r, s) {
|
|
|
4560
4556
|
* @param left - A snapshot to compare.
|
|
4561
4557
|
* @param right - A snapshot to compare.
|
|
4562
4558
|
* @returns true if the snapshots are equal.
|
|
4563
|
-
*/ function
|
|
4564
|
-
return t = l(t), n = l(n), t instanceof
|
|
4559
|
+
*/ function Xe(t, n) {
|
|
4560
|
+
return t = l(t), n = l(n), t instanceof He && n instanceof He ? t._firestore === n._firestore && t._key.isEqual(n._key) && (null === t._document ? null === n._document : t._document.isEqual(n._document)) && t._converter === n._converter : t instanceof Je && n instanceof Je && (ye(t.query, n.query) && gt(t.docs, n.docs, Xe));
|
|
4565
4561
|
}
|
|
4566
4562
|
|
|
4567
4563
|
/**
|
|
4568
4564
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
4569
|
-
*/ function
|
|
4570
|
-
return "string" == typeof n ?
|
|
4565
|
+
*/ function Ze(t, n) {
|
|
4566
|
+
return "string" == typeof n ? Qe(t, n) : n instanceof _e ? n._internalPath : n._delegate._internalPath;
|
|
4571
4567
|
}
|
|
4572
4568
|
|
|
4573
4569
|
/**
|
|
@@ -4594,7 +4590,7 @@ function Ye(t, n, e, r, s) {
|
|
|
4594
4590
|
* can then be passed to {@link query} to create a new query instance that
|
|
4595
4591
|
* also contains this `QueryConstraint`.
|
|
4596
4592
|
*/
|
|
4597
|
-
class
|
|
4593
|
+
class tr {}
|
|
4598
4594
|
|
|
4599
4595
|
/**
|
|
4600
4596
|
* Creates a new immutable instance of {@link Query} that is extended to also include
|
|
@@ -4604,40 +4600,40 @@ class nr {}
|
|
|
4604
4600
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
4605
4601
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
4606
4602
|
* existing or new constraints.
|
|
4607
|
-
*/ function
|
|
4603
|
+
*/ function nr(t, ...n) {
|
|
4608
4604
|
for (const e of n) t = e._apply(t);
|
|
4609
4605
|
return t;
|
|
4610
4606
|
}
|
|
4611
4607
|
|
|
4612
|
-
class
|
|
4608
|
+
class er extends tr {
|
|
4613
4609
|
constructor(t, n, e) {
|
|
4614
4610
|
super(), this.dt = t, this.wt = n, this.yt = e, this.type = "where";
|
|
4615
4611
|
}
|
|
4616
4612
|
_apply(t) {
|
|
4617
|
-
const n =
|
|
4613
|
+
const n = Ne(t.firestore), e = function(t, n, e, r, s, i, o) {
|
|
4618
4614
|
let u;
|
|
4619
4615
|
if (s.isKeyField()) {
|
|
4620
4616
|
if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(R, `Invalid Query. You can't perform '${i}' queries on documentId().`);
|
|
4621
4617
|
if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
|
|
4622
|
-
|
|
4618
|
+
yr(o, i);
|
|
4623
4619
|
const n = [];
|
|
4624
|
-
for (const e of o) n.push(
|
|
4620
|
+
for (const e of o) n.push(pr(r, t, e));
|
|
4625
4621
|
u = {
|
|
4626
4622
|
arrayValue: {
|
|
4627
4623
|
values: n
|
|
4628
4624
|
}
|
|
4629
4625
|
};
|
|
4630
|
-
} else u =
|
|
4631
|
-
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i ||
|
|
4632
|
-
u =
|
|
4626
|
+
} else u = pr(r, t, o);
|
|
4627
|
+
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || yr(o, i),
|
|
4628
|
+
u = ke(e, n, o,
|
|
4633
4629
|
/* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
|
|
4634
4630
|
const c = Ht.create(s, i, u);
|
|
4635
4631
|
return function(t, n) {
|
|
4636
4632
|
if (n.D()) {
|
|
4637
|
-
const e =
|
|
4633
|
+
const e = ln(t);
|
|
4638
4634
|
if (null !== e && !e.isEqual(n.field)) throw new U(R, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${e.toString()}' and '${n.field.toString()}'`);
|
|
4639
|
-
const r =
|
|
4640
|
-
null !== r &&
|
|
4635
|
+
const r = hn(t);
|
|
4636
|
+
null !== r && _r(t, n.field, r);
|
|
4641
4637
|
}
|
|
4642
4638
|
const e = function(t, n) {
|
|
4643
4639
|
for (const e of t.filters) if (n.indexOf(e.op) >= 0) return e.op;
|
|
@@ -4681,7 +4677,7 @@ class rr extends nr {
|
|
|
4681
4677
|
throw e === n.op ? new U(R, `Invalid query. You cannot use more than one '${n.op.toString()}' filter.`) : new U(R, `Invalid query. You cannot use '${n.op.toString()}' filters with '${e.toString()}' filters.`);
|
|
4682
4678
|
}(t, c), c;
|
|
4683
4679
|
}(t._query, "where", n, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
4684
|
-
return new
|
|
4680
|
+
return new le(t.firestore, t.converter, function(t, n) {
|
|
4685
4681
|
const e = t.filters.concat([ n ]);
|
|
4686
4682
|
return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), e, t.limit, t.limitType, t.startAt, t.endAt);
|
|
4687
4683
|
}(t._query, e));
|
|
@@ -4698,12 +4694,12 @@ class rr extends nr {
|
|
|
4698
4694
|
* "<=", "!=").
|
|
4699
4695
|
* @param value - The value for comparison
|
|
4700
4696
|
* @returns The created {@link Query}.
|
|
4701
|
-
*/ function
|
|
4702
|
-
const r = n, s =
|
|
4703
|
-
return new
|
|
4697
|
+
*/ function rr(t, n, e) {
|
|
4698
|
+
const r = n, s = Ze("where", t);
|
|
4699
|
+
return new er(s, r, e);
|
|
4704
4700
|
}
|
|
4705
4701
|
|
|
4706
|
-
class
|
|
4702
|
+
class sr extends tr {
|
|
4707
4703
|
constructor(t, n) {
|
|
4708
4704
|
super(), this.dt = t, this._t = n, this.type = "orderBy";
|
|
4709
4705
|
}
|
|
@@ -4713,10 +4709,10 @@ class ir extends nr {
|
|
|
4713
4709
|
if (null !== t.endAt) throw new U(R, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
4714
4710
|
const r = new on(n, e);
|
|
4715
4711
|
return function(t, n) {
|
|
4716
|
-
if (null ===
|
|
4712
|
+
if (null === hn(t)) {
|
|
4717
4713
|
// This is the first order by. It must match any inequality.
|
|
4718
|
-
const e =
|
|
4719
|
-
null !== e &&
|
|
4714
|
+
const e = ln(t);
|
|
4715
|
+
null !== e && _r(t, e, n.field);
|
|
4720
4716
|
}
|
|
4721
4717
|
}(t, r), r;
|
|
4722
4718
|
}
|
|
@@ -4731,7 +4727,7 @@ class ir extends nr {
|
|
|
4731
4727
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
4732
4728
|
* server timestamp.
|
|
4733
4729
|
*/ (t._query, this.dt, this._t);
|
|
4734
|
-
return new
|
|
4730
|
+
return new le(t.firestore, t.converter, function(t, n) {
|
|
4735
4731
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4736
4732
|
const e = t.explicitOrderBy.concat([ n ]);
|
|
4737
4733
|
return new an(t.path, t.collectionGroup, e, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -4747,17 +4743,17 @@ class ir extends nr {
|
|
|
4747
4743
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
4748
4744
|
* not specified, order will be ascending.
|
|
4749
4745
|
* @returns The created {@link Query}.
|
|
4750
|
-
*/ function
|
|
4751
|
-
const e = n, r =
|
|
4752
|
-
return new
|
|
4746
|
+
*/ function ir(t, n = "asc") {
|
|
4747
|
+
const e = n, r = Ze("orderBy", t);
|
|
4748
|
+
return new sr(r, e);
|
|
4753
4749
|
}
|
|
4754
4750
|
|
|
4755
|
-
class
|
|
4751
|
+
class or extends tr {
|
|
4756
4752
|
constructor(t, n, e) {
|
|
4757
4753
|
super(), this.type = t, this.gt = n, this.vt = e;
|
|
4758
4754
|
}
|
|
4759
4755
|
_apply(t) {
|
|
4760
|
-
return new
|
|
4756
|
+
return new le(t.firestore, t.converter, function(t, n, e) {
|
|
4761
4757
|
return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), n, e, t.startAt, t.endAt);
|
|
4762
4758
|
}(t._query, this.gt, this.vt));
|
|
4763
4759
|
}
|
|
@@ -4768,8 +4764,8 @@ class ur extends nr {
|
|
|
4768
4764
|
*
|
|
4769
4765
|
* @param limit - The maximum number of items to return.
|
|
4770
4766
|
* @returns The created {@link Query}.
|
|
4771
|
-
*/ function
|
|
4772
|
-
return ct("limit", t), new
|
|
4767
|
+
*/ function ur(t) {
|
|
4768
|
+
return ct("limit", t), new or("limit", t, "F" /* First */);
|
|
4773
4769
|
}
|
|
4774
4770
|
|
|
4775
4771
|
/**
|
|
@@ -4780,55 +4776,55 @@ class ur extends nr {
|
|
|
4780
4776
|
*
|
|
4781
4777
|
* @param limit - The maximum number of items to return.
|
|
4782
4778
|
* @returns The created {@link Query}.
|
|
4783
|
-
*/ function
|
|
4784
|
-
return ct("limitToLast", t), new
|
|
4779
|
+
*/ function cr(t) {
|
|
4780
|
+
return ct("limitToLast", t), new or("limitToLast", t, "L" /* Last */);
|
|
4785
4781
|
}
|
|
4786
4782
|
|
|
4787
|
-
class
|
|
4783
|
+
class ar extends tr {
|
|
4788
4784
|
constructor(t, n, e) {
|
|
4789
4785
|
super(), this.type = t, this.bt = n, this.Et = e;
|
|
4790
4786
|
}
|
|
4791
4787
|
_apply(t) {
|
|
4792
|
-
const n =
|
|
4793
|
-
return new
|
|
4788
|
+
const n = mr(t, this.type, this.bt, this.Et);
|
|
4789
|
+
return new le(t.firestore, t.converter, function(t, n) {
|
|
4794
4790
|
return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, n, t.endAt);
|
|
4795
4791
|
}(t._query, n));
|
|
4796
4792
|
}
|
|
4797
4793
|
}
|
|
4798
4794
|
|
|
4799
|
-
function
|
|
4800
|
-
return new
|
|
4795
|
+
function hr(...t) {
|
|
4796
|
+
return new ar("startAt", t,
|
|
4801
4797
|
/*inclusive=*/ !0);
|
|
4802
4798
|
}
|
|
4803
4799
|
|
|
4804
|
-
function
|
|
4805
|
-
return new
|
|
4800
|
+
function lr(...t) {
|
|
4801
|
+
return new ar("startAfter", t,
|
|
4806
4802
|
/*inclusive=*/ !1);
|
|
4807
4803
|
}
|
|
4808
4804
|
|
|
4809
|
-
class
|
|
4805
|
+
class fr extends tr {
|
|
4810
4806
|
constructor(t, n, e) {
|
|
4811
4807
|
super(), this.type = t, this.bt = n, this.Et = e;
|
|
4812
4808
|
}
|
|
4813
4809
|
_apply(t) {
|
|
4814
|
-
const n =
|
|
4815
|
-
return new
|
|
4810
|
+
const n = mr(t, this.type, this.bt, this.Et);
|
|
4811
|
+
return new le(t.firestore, t.converter, function(t, n) {
|
|
4816
4812
|
return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, n);
|
|
4817
4813
|
}(t._query, n));
|
|
4818
4814
|
}
|
|
4819
4815
|
}
|
|
4820
4816
|
|
|
4821
|
-
function
|
|
4822
|
-
return new
|
|
4817
|
+
function dr(...t) {
|
|
4818
|
+
return new fr("endBefore", t,
|
|
4823
4819
|
/*inclusive=*/ !1);
|
|
4824
4820
|
}
|
|
4825
4821
|
|
|
4826
|
-
function
|
|
4827
|
-
return new
|
|
4822
|
+
function wr(...t) {
|
|
4823
|
+
return new fr("endAt", t, /*inclusive=*/ !0);
|
|
4828
4824
|
}
|
|
4829
4825
|
|
|
4830
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
4831
|
-
if (e[0] = l(e[0]), e[0] instanceof
|
|
4826
|
+
/** Helper function to create a bound from a document or fields */ function mr(t, n, e, r) {
|
|
4827
|
+
if (e[0] = l(e[0]), e[0] instanceof He) return function(t, n, e, r, s) {
|
|
4832
4828
|
if (!r) throw new U(V, `Can't use a DocumentSnapshot that doesn't exist for ${e}().`);
|
|
4833
4829
|
const i = [];
|
|
4834
4830
|
// Because people expect to continue/end a query at the exact document
|
|
@@ -4838,7 +4834,7 @@ function mr(...t) {
|
|
|
4838
4834
|
// the provided document. Without the key (by using the explicit sort
|
|
4839
4835
|
// orders), multiple documents could match the position, yielding duplicate
|
|
4840
4836
|
// results.
|
|
4841
|
-
for (const e of
|
|
4837
|
+
for (const e of dn(t)) if (e.field.isKeyField()) i.push(kt(n, r.key)); else {
|
|
4842
4838
|
const t = r.data.field(e.field);
|
|
4843
4839
|
if ($t(t)) throw new U(R, 'Invalid query. You are trying to start or end a query using a document for which the field "' + e.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
4844
4840
|
if (null === t) {
|
|
@@ -4853,7 +4849,7 @@ function mr(...t) {
|
|
|
4853
4849
|
* Converts a list of field values to a `Bound` for the given query.
|
|
4854
4850
|
*/ (t._query, t.firestore._databaseId, n, e[0]._document, r);
|
|
4855
4851
|
{
|
|
4856
|
-
const s =
|
|
4852
|
+
const s = Ne(t.firestore);
|
|
4857
4853
|
return function(t, n, e, r, s, i) {
|
|
4858
4854
|
// Use explicit order by's because it has to match the query the user made
|
|
4859
4855
|
const o = t.explicitOrderBy;
|
|
@@ -4863,13 +4859,13 @@ function mr(...t) {
|
|
|
4863
4859
|
const c = s[i];
|
|
4864
4860
|
if (o[i].field.isKeyField()) {
|
|
4865
4861
|
if ("string" != typeof c) throw new U(R, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
|
|
4866
|
-
if (!
|
|
4862
|
+
if (!fn(t) && -1 !== c.indexOf("/")) throw new U(R, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${c}' contains a slash.`);
|
|
4867
4863
|
const e = t.path.child(Z.fromString(c));
|
|
4868
4864
|
if (!et.isDocumentKey(e)) throw new U(R, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${e}' is not because it contains an odd number of segments.`);
|
|
4869
4865
|
const s = new et(e);
|
|
4870
4866
|
u.push(kt(n, s));
|
|
4871
4867
|
} else {
|
|
4872
|
-
const t =
|
|
4868
|
+
const t = ke(e, r, c);
|
|
4873
4869
|
u.push(t);
|
|
4874
4870
|
}
|
|
4875
4871
|
}
|
|
@@ -4883,27 +4879,27 @@ function mr(...t) {
|
|
|
4883
4879
|
}
|
|
4884
4880
|
}
|
|
4885
4881
|
|
|
4886
|
-
function
|
|
4882
|
+
function pr(t, n, e) {
|
|
4887
4883
|
if ("string" == typeof (e = l(e))) {
|
|
4888
4884
|
if ("" === e) throw new U(R, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
4889
|
-
if (!
|
|
4885
|
+
if (!fn(n) && -1 !== e.indexOf("/")) throw new U(R, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${e}' contains a '/' character.`);
|
|
4890
4886
|
const r = n.path.child(Z.fromString(e));
|
|
4891
4887
|
if (!et.isDocumentKey(r)) throw new U(R, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
|
|
4892
4888
|
return kt(t, new et(r));
|
|
4893
4889
|
}
|
|
4894
|
-
if (e instanceof
|
|
4890
|
+
if (e instanceof he) return kt(t, e._key);
|
|
4895
4891
|
throw new U(R, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ot(e)}.`);
|
|
4896
4892
|
}
|
|
4897
4893
|
|
|
4898
4894
|
/**
|
|
4899
4895
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
4900
4896
|
* array requirements.
|
|
4901
|
-
*/ function
|
|
4897
|
+
*/ function yr(t, n) {
|
|
4902
4898
|
if (!Array.isArray(t) || 0 === t.length) throw new U(R, `Invalid Query. A non-empty array is required for '${n.toString()}' filters.`);
|
|
4903
4899
|
if (t.length > 10) throw new U(R, `Invalid Query. '${n.toString()}' filters support a maximum of 10 elements in the value array.`);
|
|
4904
4900
|
}
|
|
4905
4901
|
|
|
4906
|
-
function
|
|
4902
|
+
function _r(t, n, e) {
|
|
4907
4903
|
if (!e.isEqual(n)) throw new U(R, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${n.toString()}' and so you must also use '${n.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${e.toString()}' instead.`);
|
|
4908
4904
|
}
|
|
4909
4905
|
|
|
@@ -4954,7 +4950,7 @@ function gr(t, n, e) {
|
|
|
4954
4950
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
4955
4951
|
* call.
|
|
4956
4952
|
*/
|
|
4957
|
-
function
|
|
4953
|
+
function gr(t, n, e) {
|
|
4958
4954
|
let r;
|
|
4959
4955
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
4960
4956
|
// toFirestore().
|
|
@@ -4963,7 +4959,7 @@ function vr(t, n, e) {
|
|
|
4963
4959
|
r;
|
|
4964
4960
|
}
|
|
4965
4961
|
|
|
4966
|
-
class
|
|
4962
|
+
class vr extends class {
|
|
4967
4963
|
convertValue(t, n = "none") {
|
|
4968
4964
|
switch (xt(t)) {
|
|
4969
4965
|
case 0 /* NullValue */ :
|
|
@@ -5010,7 +5006,7 @@ class br extends class {
|
|
|
5010
5006
|
})), e;
|
|
5011
5007
|
}
|
|
5012
5008
|
convertGeoPoint(t) {
|
|
5013
|
-
return new
|
|
5009
|
+
return new Ee(Nt(t.latitude), Nt(t.longitude));
|
|
5014
5010
|
}
|
|
5015
5011
|
convertArray(t, n) {
|
|
5016
5012
|
return (t.values || []).map((t => this.convertValue(t, n)));
|
|
@@ -5034,7 +5030,7 @@ class br extends class {
|
|
|
5034
5030
|
}
|
|
5035
5031
|
convertDocumentKey(t, n) {
|
|
5036
5032
|
const e = Z.fromString(t);
|
|
5037
|
-
b(
|
|
5033
|
+
b(Hn(e));
|
|
5038
5034
|
const r = new J(e.get(1), e.get(3)), s = new et(e.popFirst(5));
|
|
5039
5035
|
return r.isEqual(n) ||
|
|
5040
5036
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -5046,11 +5042,11 @@ class br extends class {
|
|
|
5046
5042
|
super(), this.firestore = t;
|
|
5047
5043
|
}
|
|
5048
5044
|
convertBytes(t) {
|
|
5049
|
-
return new
|
|
5045
|
+
return new ve(t);
|
|
5050
5046
|
}
|
|
5051
5047
|
convertReference(t) {
|
|
5052
5048
|
const n = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
5053
|
-
return new
|
|
5049
|
+
return new he(this.firestore, /* converter= */ null, n);
|
|
5054
5050
|
}
|
|
5055
5051
|
}
|
|
5056
5052
|
|
|
@@ -5066,12 +5062,12 @@ class br extends class {
|
|
|
5066
5062
|
* @param reference - The reference of the document to fetch.
|
|
5067
5063
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
5068
5064
|
* document contents.
|
|
5069
|
-
*/ function
|
|
5070
|
-
const n =
|
|
5071
|
-
return
|
|
5065
|
+
*/ function br(t) {
|
|
5066
|
+
const n = re((t = ut(t, he)).firestore), e = new vr(t.firestore);
|
|
5067
|
+
return te(n, [ t._key ]).then((n => {
|
|
5072
5068
|
b(1 === n.length);
|
|
5073
5069
|
const r = n[0];
|
|
5074
|
-
return new
|
|
5070
|
+
return new He(t.firestore, e, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5075
5071
|
}));
|
|
5076
5072
|
}
|
|
5077
5073
|
|
|
@@ -5086,33 +5082,33 @@ class br extends class {
|
|
|
5086
5082
|
*
|
|
5087
5083
|
* @param query - The `Query` to execute.
|
|
5088
5084
|
* @returns A Promise that will be resolved with the results of the query.
|
|
5089
|
-
*/ function
|
|
5085
|
+
*/ function Er(t) {
|
|
5090
5086
|
!function(t) {
|
|
5091
|
-
if (
|
|
5092
|
-
}((t = ut(t,
|
|
5093
|
-
const n =
|
|
5094
|
-
return
|
|
5095
|
-
const r = n.map((n => new
|
|
5096
|
-
return
|
|
5087
|
+
if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new U(O, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5088
|
+
}((t = ut(t, le))._query);
|
|
5089
|
+
const n = re(t.firestore), e = new vr(t.firestore);
|
|
5090
|
+
return ne(n, t._query).then((n => {
|
|
5091
|
+
const r = n.map((n => new Ke(t.firestore, e, n.key, n, t.converter)));
|
|
5092
|
+
return "L" /* Last */ === t._query.limitType &&
|
|
5097
5093
|
// Limit to last queries reverse the orderBy constraint that was
|
|
5098
5094
|
// specified by the user. As such, we need to reverse the order of the
|
|
5099
5095
|
// results to return the documents in the expected order.
|
|
5100
|
-
r.reverse(), new
|
|
5096
|
+
r.reverse(), new Je(t, r);
|
|
5101
5097
|
}));
|
|
5102
5098
|
}
|
|
5103
5099
|
|
|
5104
|
-
function
|
|
5105
|
-
const r =
|
|
5106
|
-
return
|
|
5100
|
+
function Tr(t, n, e) {
|
|
5101
|
+
const r = gr((t = ut(t, he)).converter, n, e), s = De(Ne(t.firestore), "setDoc", t._key, r, null !== t.converter, e);
|
|
5102
|
+
return Zn(re(t.firestore), [ s.toMutation(t._key, Tn.none()) ]);
|
|
5107
5103
|
}
|
|
5108
5104
|
|
|
5109
|
-
function
|
|
5110
|
-
const s =
|
|
5105
|
+
function Ir(t, n, e, ...r) {
|
|
5106
|
+
const s = Ne((t = ut(t, he)).firestore);
|
|
5111
5107
|
// For Compat types, we have to "extract" the underlying types before
|
|
5112
5108
|
// performing validation.
|
|
5113
5109
|
let i;
|
|
5114
|
-
i = "string" == typeof (n = l(n)) || n instanceof
|
|
5115
|
-
return
|
|
5110
|
+
i = "string" == typeof (n = l(n)) || n instanceof _e ? Le(s, "updateDoc", t._key, n, e, r) : Ce(s, "updateDoc", t._key, n);
|
|
5111
|
+
return Zn(re(t.firestore), [ i.toMutation(t._key, Tn.exists(!0)) ]);
|
|
5116
5112
|
}
|
|
5117
5113
|
|
|
5118
5114
|
/**
|
|
@@ -5126,8 +5122,8 @@ function Ar(t, n, e, ...r) {
|
|
|
5126
5122
|
* @param reference - A reference to the document to delete.
|
|
5127
5123
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5128
5124
|
* deleted from the backend.
|
|
5129
|
-
*/ function
|
|
5130
|
-
return
|
|
5125
|
+
*/ function Ar(t) {
|
|
5126
|
+
return Zn(re((t = ut(t, he)).firestore), [ new Pn(t._key, Tn.none()) ]);
|
|
5131
5127
|
}
|
|
5132
5128
|
|
|
5133
5129
|
/**
|
|
@@ -5144,9 +5140,9 @@ function Ar(t, n, e, ...r) {
|
|
|
5144
5140
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
5145
5141
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
5146
5142
|
* newly created document after it has been written to the backend.
|
|
5147
|
-
*/ function
|
|
5148
|
-
const e =
|
|
5149
|
-
return
|
|
5143
|
+
*/ function Rr(t, n) {
|
|
5144
|
+
const e = me(t = ut(t, fe)), r = gr(t.converter, n), s = De(Ne(t.firestore), "addDoc", e._key, r, null !== e.converter, {});
|
|
5145
|
+
return Zn(re(t.firestore), [ s.toMutation(e._key, Tn.exists(!1)) ]).then((() => e));
|
|
5150
5146
|
}
|
|
5151
5147
|
|
|
5152
5148
|
/**
|
|
@@ -5168,15 +5164,15 @@ function Ar(t, n, e, ...r) {
|
|
|
5168
5164
|
/**
|
|
5169
5165
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
5170
5166
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
5171
|
-
*/ function
|
|
5172
|
-
return new
|
|
5167
|
+
*/ function Pr() {
|
|
5168
|
+
return new $e("deleteField");
|
|
5173
5169
|
}
|
|
5174
5170
|
|
|
5175
5171
|
/**
|
|
5176
5172
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
5177
5173
|
* include a server-generated timestamp in the written data.
|
|
5178
|
-
*/ function
|
|
5179
|
-
return new
|
|
5174
|
+
*/ function Vr() {
|
|
5175
|
+
return new Fe("serverTimestamp");
|
|
5180
5176
|
}
|
|
5181
5177
|
|
|
5182
5178
|
/**
|
|
@@ -5190,10 +5186,10 @@ function Ar(t, n, e, ...r) {
|
|
|
5190
5186
|
* @param elements - The elements to union into the array.
|
|
5191
5187
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5192
5188
|
* `updateDoc()`.
|
|
5193
|
-
*/ function
|
|
5189
|
+
*/ function Nr(...t) {
|
|
5194
5190
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5195
5191
|
// update() since we'd need the Firestore instance to do this.
|
|
5196
|
-
return new
|
|
5192
|
+
return new xe("arrayUnion", t);
|
|
5197
5193
|
}
|
|
5198
5194
|
|
|
5199
5195
|
/**
|
|
@@ -5206,10 +5202,10 @@ function Ar(t, n, e, ...r) {
|
|
|
5206
5202
|
* @param elements - The elements to remove from the array.
|
|
5207
5203
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5208
5204
|
* `updateDoc()`
|
|
5209
|
-
*/ function
|
|
5205
|
+
*/ function Dr(...t) {
|
|
5210
5206
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5211
5207
|
// update() since we'd need the Firestore instance to do this.
|
|
5212
|
-
return new
|
|
5208
|
+
return new qe("arrayRemove", t);
|
|
5213
5209
|
}
|
|
5214
5210
|
|
|
5215
5211
|
/**
|
|
@@ -5230,8 +5226,8 @@ function Ar(t, n, e, ...r) {
|
|
|
5230
5226
|
* @param n - The value to increment by.
|
|
5231
5227
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5232
5228
|
* `updateDoc()`
|
|
5233
|
-
*/ function
|
|
5234
|
-
return new
|
|
5229
|
+
*/ function $r(t) {
|
|
5230
|
+
return new Oe("increment", t);
|
|
5235
5231
|
}
|
|
5236
5232
|
|
|
5237
5233
|
/**
|
|
@@ -5257,25 +5253,25 @@ function Ar(t, n, e, ...r) {
|
|
|
5257
5253
|
* provides methods for adding writes to the write batch. None of the writes
|
|
5258
5254
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
5259
5255
|
* called.
|
|
5260
|
-
*/ class
|
|
5256
|
+
*/ class Sr {
|
|
5261
5257
|
/** @hideconstructor */
|
|
5262
5258
|
constructor(t, n) {
|
|
5263
5259
|
this._firestore = t, this._commitHandler = n, this._mutations = [], this._committed = !1,
|
|
5264
|
-
this._dataReader =
|
|
5260
|
+
this._dataReader = Ne(t);
|
|
5265
5261
|
}
|
|
5266
5262
|
set(t, n, e) {
|
|
5267
5263
|
this._verifyNotCommitted();
|
|
5268
|
-
const r =
|
|
5269
|
-
return this._mutations.push(i.toMutation(r._key,
|
|
5264
|
+
const r = Fr(t, this._firestore), s = gr(r.converter, n, e), i = De(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, e);
|
|
5265
|
+
return this._mutations.push(i.toMutation(r._key, Tn.none())), this;
|
|
5270
5266
|
}
|
|
5271
5267
|
update(t, n, e, ...r) {
|
|
5272
5268
|
this._verifyNotCommitted();
|
|
5273
|
-
const s =
|
|
5269
|
+
const s = Fr(t, this._firestore);
|
|
5274
5270
|
// For Compat types, we have to "extract" the underlying types before
|
|
5275
5271
|
// performing validation.
|
|
5276
5272
|
let i;
|
|
5277
|
-
return i = "string" == typeof (n = l(n)) || n instanceof
|
|
5278
|
-
this._mutations.push(i.toMutation(s._key,
|
|
5273
|
+
return i = "string" == typeof (n = l(n)) || n instanceof _e ? Le(this._dataReader, "WriteBatch.update", s._key, n, e, r) : Ce(this._dataReader, "WriteBatch.update", s._key, n),
|
|
5274
|
+
this._mutations.push(i.toMutation(s._key, Tn.exists(!0))), this;
|
|
5279
5275
|
}
|
|
5280
5276
|
/**
|
|
5281
5277
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -5284,8 +5280,8 @@ function Ar(t, n, e, ...r) {
|
|
|
5284
5280
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
5285
5281
|
*/ delete(t) {
|
|
5286
5282
|
this._verifyNotCommitted();
|
|
5287
|
-
const n =
|
|
5288
|
-
return this._mutations = this._mutations.concat(new
|
|
5283
|
+
const n = Fr(t, this._firestore);
|
|
5284
|
+
return this._mutations = this._mutations.concat(new Pn(n._key, Tn.none())), this;
|
|
5289
5285
|
}
|
|
5290
5286
|
/**
|
|
5291
5287
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -5306,7 +5302,7 @@ function Ar(t, n, e, ...r) {
|
|
|
5306
5302
|
}
|
|
5307
5303
|
}
|
|
5308
5304
|
|
|
5309
|
-
function
|
|
5305
|
+
function Fr(t, n) {
|
|
5310
5306
|
if ((t = l(t)).firestore !== n) throw new U(R, "Provided document reference is from a different Firestore instance.");
|
|
5311
5307
|
return t;
|
|
5312
5308
|
}
|
|
@@ -5323,9 +5319,9 @@ function xr(t, n) {
|
|
|
5323
5319
|
*
|
|
5324
5320
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
5325
5321
|
* writes.
|
|
5326
|
-
*/ function
|
|
5327
|
-
const n =
|
|
5328
|
-
return new
|
|
5322
|
+
*/ function xr(t) {
|
|
5323
|
+
const n = re(t = ut(t, ie));
|
|
5324
|
+
return new Sr(t, (t => Zn(n, t)));
|
|
5329
5325
|
}
|
|
5330
5326
|
|
|
5331
5327
|
/**
|
|
@@ -5347,7 +5343,7 @@ function xr(t, n) {
|
|
|
5347
5343
|
/**
|
|
5348
5344
|
* Internal transaction object responsible for accumulating the mutations to
|
|
5349
5345
|
* perform and the base versions for any documents read.
|
|
5350
|
-
*/ class
|
|
5346
|
+
*/ class qr {
|
|
5351
5347
|
constructor(t) {
|
|
5352
5348
|
this.datastore = t,
|
|
5353
5349
|
// The version of each document that was read during this transaction.
|
|
@@ -5367,7 +5363,7 @@ function xr(t, n) {
|
|
|
5367
5363
|
}
|
|
5368
5364
|
async lookup(t) {
|
|
5369
5365
|
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(R, "Firestore transactions require all reads to be executed before all writes.");
|
|
5370
|
-
const n = await
|
|
5366
|
+
const n = await te(this.datastore, t);
|
|
5371
5367
|
return n.forEach((t => this.recordVersion(t))), n;
|
|
5372
5368
|
}
|
|
5373
5369
|
set(t, n) {
|
|
@@ -5382,7 +5378,7 @@ function xr(t, n) {
|
|
|
5382
5378
|
this.writtenDocs.add(t.toString());
|
|
5383
5379
|
}
|
|
5384
5380
|
delete(t) {
|
|
5385
|
-
this.write(new
|
|
5381
|
+
this.write(new Pn(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
5386
5382
|
}
|
|
5387
5383
|
async commit() {
|
|
5388
5384
|
if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
|
|
@@ -5395,8 +5391,8 @@ function xr(t, n) {
|
|
|
5395
5391
|
// a `verify` operation.
|
|
5396
5392
|
t.forEach(((t, n) => {
|
|
5397
5393
|
const e = et.fromPath(n);
|
|
5398
|
-
this.mutations.push(new
|
|
5399
|
-
})), await
|
|
5394
|
+
this.mutations.push(new Vn(e, this.precondition(e)));
|
|
5395
|
+
})), await Zn(this.datastore, this.mutations), this.committed = !0;
|
|
5400
5396
|
}
|
|
5401
5397
|
recordVersion(t) {
|
|
5402
5398
|
let n;
|
|
@@ -5417,7 +5413,7 @@ function xr(t, n) {
|
|
|
5417
5413
|
* as a precondition, or no precondition if it was not read.
|
|
5418
5414
|
*/ precondition(t) {
|
|
5419
5415
|
const n = this.readVersions.get(t.toString());
|
|
5420
|
-
return !this.writtenDocs.has(t.toString()) && n ?
|
|
5416
|
+
return !this.writtenDocs.has(t.toString()) && n ? Tn.updateTime(n) : Tn.none();
|
|
5421
5417
|
}
|
|
5422
5418
|
/**
|
|
5423
5419
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -5438,11 +5434,11 @@ function xr(t, n) {
|
|
|
5438
5434
|
// transaction.
|
|
5439
5435
|
throw new U(R, "Can't update a document that doesn't exist.");
|
|
5440
5436
|
// Document exists, base precondition on document update time.
|
|
5441
|
-
return
|
|
5437
|
+
return Tn.updateTime(n);
|
|
5442
5438
|
}
|
|
5443
5439
|
// Document was not read, so we just use the preconditions for a blind
|
|
5444
5440
|
// update.
|
|
5445
|
-
return
|
|
5441
|
+
return Tn.exists(!0);
|
|
5446
5442
|
}
|
|
5447
5443
|
write(t) {
|
|
5448
5444
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
@@ -5470,17 +5466,17 @@ function xr(t, n) {
|
|
|
5470
5466
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
5471
5467
|
* with backoff.
|
|
5472
5468
|
*/
|
|
5473
|
-
class
|
|
5469
|
+
class Or {
|
|
5474
5470
|
constructor(t, n, e, r) {
|
|
5475
5471
|
this.asyncQueue = t, this.datastore = n, this.updateFunction = e, this.deferred = r,
|
|
5476
|
-
this.Tt = 5, this.It = new
|
|
5472
|
+
this.Tt = 5, this.It = new Jn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
5477
5473
|
}
|
|
5478
5474
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
5479
5475
|
this.Tt -= 1, this.At();
|
|
5480
5476
|
}
|
|
5481
5477
|
At() {
|
|
5482
5478
|
this.It.W((async () => {
|
|
5483
|
-
const t = new
|
|
5479
|
+
const t = new qr(this.datastore), n = this.Rt(t);
|
|
5484
5480
|
n && n.then((n => {
|
|
5485
5481
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
5486
5482
|
this.deferred.resolve(n);
|
|
@@ -5570,7 +5566,7 @@ class Cr {
|
|
|
5570
5566
|
* See the License for the specific language governing permissions and
|
|
5571
5567
|
* limitations under the License.
|
|
5572
5568
|
*/
|
|
5573
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
5569
|
+
/** The Platform's 'document' implementation or null if not available. */ function Cr() {
|
|
5574
5570
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
5575
5571
|
// eslint-disable-next-line no-restricted-globals
|
|
5576
5572
|
return "undefined" != typeof document ? document : null;
|
|
@@ -5602,7 +5598,7 @@ class Cr {
|
|
|
5602
5598
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
5603
5599
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
5604
5600
|
* IE.
|
|
5605
|
-
*/ class
|
|
5601
|
+
*/ class Lr {
|
|
5606
5602
|
constructor(t, n, e, r, s) {
|
|
5607
5603
|
this.asyncQueue = t, this.timerId = n, this.targetTimeMs = e, this.op = r, this.removalCallback = s,
|
|
5608
5604
|
this.deferred = new j, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -5625,7 +5621,7 @@ class Cr {
|
|
|
5625
5621
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
5626
5622
|
* the DelayedOperation class public.
|
|
5627
5623
|
*/ static createAndSchedule(t, n, e, r, s) {
|
|
5628
|
-
const i = Date.now() + e, o = new
|
|
5624
|
+
const i = Date.now() + e, o = new Lr(t, n, i, r, s);
|
|
5629
5625
|
return o.start(e), o;
|
|
5630
5626
|
}
|
|
5631
5627
|
/**
|
|
@@ -5674,7 +5670,7 @@ class Cr {
|
|
|
5674
5670
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5675
5671
|
* See the License for the specific language governing permissions and
|
|
5676
5672
|
* limitations under the License.
|
|
5677
|
-
*/ class
|
|
5673
|
+
*/ class kr {
|
|
5678
5674
|
constructor() {
|
|
5679
5675
|
// The last promise in the queue.
|
|
5680
5676
|
this.Nt = Promise.resolve(),
|
|
@@ -5697,15 +5693,15 @@ class Cr {
|
|
|
5697
5693
|
// List of TimerIds to fast-forward delays for.
|
|
5698
5694
|
this.Ot = [],
|
|
5699
5695
|
// Backoff timer used to schedule retries for retryable operations
|
|
5700
|
-
this.It = new
|
|
5696
|
+
this.It = new Jn(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5701
5697
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5702
5698
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5703
5699
|
// after page comes into foreground.
|
|
5704
5700
|
this.Ct = () => {
|
|
5705
|
-
const t =
|
|
5701
|
+
const t = Cr();
|
|
5706
5702
|
t && p("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.It.H();
|
|
5707
5703
|
};
|
|
5708
|
-
const t =
|
|
5704
|
+
const t = Cr();
|
|
5709
5705
|
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ct);
|
|
5710
5706
|
}
|
|
5711
5707
|
get isShuttingDown() {
|
|
@@ -5726,7 +5722,7 @@ class Cr {
|
|
|
5726
5722
|
enterRestrictedMode(t) {
|
|
5727
5723
|
if (!this.$t) {
|
|
5728
5724
|
this.$t = !0, this.qt = t || !1;
|
|
5729
|
-
const n =
|
|
5725
|
+
const n = Cr();
|
|
5730
5726
|
n && "function" == typeof n.removeEventListener && n.removeEventListener("visibilitychange", this.Ct);
|
|
5731
5727
|
}
|
|
5732
5728
|
}
|
|
@@ -5858,7 +5854,7 @@ class Cr {
|
|
|
5858
5854
|
this.Lt(),
|
|
5859
5855
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5860
5856
|
this.Ot.indexOf(t) > -1 && (n = 0);
|
|
5861
|
-
const r =
|
|
5857
|
+
const r = Lr.createAndSchedule(this, t, n, e, (t => this.jt(t)));
|
|
5862
5858
|
return this.St.push(r), r;
|
|
5863
5859
|
}
|
|
5864
5860
|
Lt() {
|
|
@@ -5912,10 +5908,10 @@ class Cr {
|
|
|
5912
5908
|
}
|
|
5913
5909
|
}
|
|
5914
5910
|
|
|
5915
|
-
class
|
|
5911
|
+
class Ur {
|
|
5916
5912
|
/** @hideconstructor */
|
|
5917
5913
|
constructor(t, n) {
|
|
5918
|
-
this._firestore = t, this._transaction = n, this._dataReader =
|
|
5914
|
+
this._firestore = t, this._transaction = n, this._dataReader = Ne(t);
|
|
5919
5915
|
}
|
|
5920
5916
|
/**
|
|
5921
5917
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
@@ -5923,25 +5919,25 @@ class jr {
|
|
|
5923
5919
|
* @param documentRef - A reference to the document to be read.
|
|
5924
5920
|
* @returns A `DocumentSnapshot` with the read data.
|
|
5925
5921
|
*/ get(t) {
|
|
5926
|
-
const n =
|
|
5922
|
+
const n = Fr(t, this._firestore), e = new vr(this._firestore);
|
|
5927
5923
|
return this._transaction.lookup([ n._key ]).then((t => {
|
|
5928
5924
|
if (!t || 1 !== t.length) return v();
|
|
5929
5925
|
const r = t[0];
|
|
5930
|
-
if (r.isFoundDocument()) return new
|
|
5931
|
-
if (r.isNoDocument()) return new
|
|
5926
|
+
if (r.isFoundDocument()) return new He(this._firestore, e, r.key, r, n.converter);
|
|
5927
|
+
if (r.isNoDocument()) return new He(this._firestore, e, n._key, null, n.converter);
|
|
5932
5928
|
throw v();
|
|
5933
5929
|
}));
|
|
5934
5930
|
}
|
|
5935
5931
|
set(t, n, e) {
|
|
5936
|
-
const r =
|
|
5932
|
+
const r = Fr(t, this._firestore), s = gr(r.converter, n, e), i = De(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, e);
|
|
5937
5933
|
return this._transaction.set(r._key, i), this;
|
|
5938
5934
|
}
|
|
5939
5935
|
update(t, n, e, ...r) {
|
|
5940
|
-
const s =
|
|
5936
|
+
const s = Fr(t, this._firestore);
|
|
5941
5937
|
// For Compat types, we have to "extract" the underlying types before
|
|
5942
5938
|
// performing validation.
|
|
5943
5939
|
let i;
|
|
5944
|
-
return i = "string" == typeof (n = l(n)) || n instanceof
|
|
5940
|
+
return i = "string" == typeof (n = l(n)) || n instanceof _e ? Le(this._dataReader, "Transaction.update", s._key, n, e, r) : Ce(this._dataReader, "Transaction.update", s._key, n),
|
|
5945
5941
|
this._transaction.update(s._key, i), this;
|
|
5946
5942
|
}
|
|
5947
5943
|
/**
|
|
@@ -5950,7 +5946,7 @@ class jr {
|
|
|
5950
5946
|
* @param documentRef - A reference to the document to be deleted.
|
|
5951
5947
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
5952
5948
|
*/ delete(t) {
|
|
5953
|
-
const n =
|
|
5949
|
+
const n = Fr(t, this._firestore);
|
|
5954
5950
|
return this._transaction.delete(n._key), this;
|
|
5955
5951
|
}
|
|
5956
5952
|
}
|
|
@@ -5971,9 +5967,9 @@ class jr {
|
|
|
5971
5967
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
5972
5968
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
5973
5969
|
* rejected promise with the corresponding failure error is returned.
|
|
5974
|
-
*/ function
|
|
5975
|
-
const e =
|
|
5976
|
-
return new
|
|
5970
|
+
*/ function jr(t, n) {
|
|
5971
|
+
const e = re(t = ut(t, ie)), r = new j;
|
|
5972
|
+
return new Or(new kr, e, (e => n(new Ur(t, e))), r).run(), r.promise;
|
|
5977
5973
|
}
|
|
5978
5974
|
|
|
5979
5975
|
/**
|
|
@@ -5986,11 +5982,11 @@ class jr {
|
|
|
5986
5982
|
*/ !function(t) {
|
|
5987
5983
|
d = t;
|
|
5988
5984
|
}(`${s}_lite`), e(new i("firestore/lite", ((t, {options: n}) => {
|
|
5989
|
-
const e = t.getProvider("app").getImmediate(), r = new
|
|
5985
|
+
const e = t.getProvider("app").getImmediate(), r = new ie(e, new G(t.getProvider("auth-internal")), new H(t.getProvider("app-check-internal")));
|
|
5990
5986
|
return n && r._setSettings(n), r;
|
|
5991
5987
|
}), "PUBLIC")),
|
|
5992
5988
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5993
|
-
r("firestore-lite", "3.4.
|
|
5989
|
+
r("firestore-lite", "3.4.8-canary.44948ac91", "rn"), r("firestore-lite", "3.4.8-canary.44948ac91", "esm2017");
|
|
5994
5990
|
|
|
5995
|
-
export {
|
|
5991
|
+
export { ve as Bytes, fe as CollectionReference, he as DocumentReference, He as DocumentSnapshot, _e as FieldPath, be as FieldValue, ie as Firestore, U as FirestoreError, Ee as GeoPoint, le as Query, tr as QueryConstraint, Ke as QueryDocumentSnapshot, Je as QuerySnapshot, vt as Timestamp, Ur as Transaction, Sr as WriteBatch, Rr as addDoc, Dr as arrayRemove, Nr as arrayUnion, de as collection, we as collectionGroup, ce as connectFirestoreEmulator, Ar as deleteDoc, Pr as deleteField, me as doc, ge as documentId, wr as endAt, dr as endBefore, br as getDoc, Er as getDocs, ue as getFirestore, $r as increment, oe as initializeFirestore, ur as limit, cr as limitToLast, ir as orderBy, nr as query, ye as queryEqual, pe as refEqual, jr as runTransaction, Vr as serverTimestamp, Tr as setDoc, m as setLogLevel, Xe as snapshotEqual, lr as startAfter, hr as startAt, ae as terminate, Ir as updateDoc, rr as where, xr as writeBatch };
|
|
5996
5992
|
//# sourceMappingURL=index.rn.esm2017.js.map
|