@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
|
@@ -63,7 +63,7 @@ l.MOCK_USER = new l("mock-user");
|
|
|
63
63
|
* See the License for the specific language governing permissions and
|
|
64
64
|
* limitations under the License.
|
|
65
65
|
*/
|
|
66
|
-
let f = "9.6.
|
|
66
|
+
let f = "9.6.11-canary.44948ac91";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -2342,14 +2342,10 @@ function ie(t, e) {
|
|
|
2342
2342
|
}
|
|
2343
2343
|
|
|
2344
2344
|
/** Creates a new Query for a query that matches all documents at `path` */ function ue(t) {
|
|
2345
|
-
return !ct(t.limit) && "L" /* Last */ === t.limitType;
|
|
2346
|
-
}
|
|
2347
|
-
|
|
2348
|
-
function ce(t) {
|
|
2349
2345
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
2350
2346
|
}
|
|
2351
2347
|
|
|
2352
|
-
function
|
|
2348
|
+
function ce(t) {
|
|
2353
2349
|
for (const e of t.filters) if (e.N()) return e.field;
|
|
2354
2350
|
return null;
|
|
2355
2351
|
}
|
|
@@ -2362,7 +2358,7 @@ function ae(t) {
|
|
|
2362
2358
|
* Returns whether the query matches a collection group rather than a specific
|
|
2363
2359
|
* collection.
|
|
2364
2360
|
*/
|
|
2365
|
-
function
|
|
2361
|
+
function ae(t) {
|
|
2366
2362
|
return null !== t.collectionGroup;
|
|
2367
2363
|
}
|
|
2368
2364
|
|
|
@@ -2370,11 +2366,11 @@ function he(t) {
|
|
|
2370
2366
|
* Returns the implicit order by constraint that is used to execute the Query,
|
|
2371
2367
|
* which can be different from the order by constraints the user provided (e.g.
|
|
2372
2368
|
* the SDK and backend always orders by `__name__`).
|
|
2373
|
-
*/ function
|
|
2369
|
+
*/ function he(t) {
|
|
2374
2370
|
const e = b(t);
|
|
2375
2371
|
if (null === e.$) {
|
|
2376
2372
|
e.$ = [];
|
|
2377
|
-
const t =
|
|
2373
|
+
const t = ce(e), n = ue(e);
|
|
2378
2374
|
if (null !== t && null === n)
|
|
2379
2375
|
// In order to implicitly add key ordering, we must also add the
|
|
2380
2376
|
// inequality filter field for it to be a valid query.
|
|
@@ -2395,24 +2391,24 @@ function he(t) {
|
|
|
2395
2391
|
|
|
2396
2392
|
/**
|
|
2397
2393
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2398
|
-
*/ function
|
|
2394
|
+
*/ function le(t) {
|
|
2399
2395
|
const e = b(t);
|
|
2400
|
-
if (!e.S) if ("F" /* First */ === e.limitType) e.S = Qt(e.path, e.collectionGroup,
|
|
2396
|
+
if (!e.S) if ("F" /* First */ === e.limitType) e.S = Qt(e.path, e.collectionGroup, he(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
2401
2397
|
// Flip the orderBy directions since we want the last results
|
|
2402
2398
|
const t = [];
|
|
2403
|
-
for (const n of
|
|
2399
|
+
for (const n of he(e)) {
|
|
2404
2400
|
const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
|
|
2405
2401
|
t.push(new re(n.field, e));
|
|
2406
2402
|
}
|
|
2407
2403
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2408
|
-
const n = e.endAt ? new ne(e.endAt.position,
|
|
2404
|
+
const n = e.endAt ? new ne(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new ne(e.startAt.position, e.startAt.inclusive) : null;
|
|
2409
2405
|
// Now return as a LimitType.First query.
|
|
2410
2406
|
e.S = Qt(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
|
|
2411
2407
|
}
|
|
2412
2408
|
return e.S;
|
|
2413
2409
|
}
|
|
2414
2410
|
|
|
2415
|
-
function
|
|
2411
|
+
function fe(t, e) {
|
|
2416
2412
|
return function(t, e) {
|
|
2417
2413
|
if (t.limit !== e.limit) return !1;
|
|
2418
2414
|
if (t.orderBy.length !== e.orderBy.length) return !1;
|
|
@@ -2422,7 +2418,7 @@ function de(t, e) {
|
|
|
2422
2418
|
n.op !== r.op || !n.field.isEqual(r.field) || !Ft(n.value, r.value)) return !1;
|
|
2423
2419
|
var n, r;
|
|
2424
2420
|
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!ie(t.startAt, e.startAt) && ie(t.endAt, e.endAt);
|
|
2425
|
-
}(
|
|
2421
|
+
}(le(t), le(e)) && t.limitType === e.limitType;
|
|
2426
2422
|
}
|
|
2427
2423
|
|
|
2428
2424
|
/**
|
|
@@ -2450,7 +2446,7 @@ function de(t, e) {
|
|
|
2450
2446
|
* The return value is an IntegerValue if it can safely represent the value,
|
|
2451
2447
|
* otherwise a DoubleValue is returned.
|
|
2452
2448
|
*/
|
|
2453
|
-
function
|
|
2449
|
+
function de(t, e) {
|
|
2454
2450
|
return function(t) {
|
|
2455
2451
|
return "number" == typeof t && Number.isInteger(t) && !at(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
|
|
2456
2452
|
}(e) ?
|
|
@@ -2495,7 +2491,7 @@ function we(t, e) {
|
|
|
2495
2491
|
* See the License for the specific language governing permissions and
|
|
2496
2492
|
* limitations under the License.
|
|
2497
2493
|
*/
|
|
2498
|
-
/** Used to represent a field transform on a mutation. */ class
|
|
2494
|
+
/** Used to represent a field transform on a mutation. */ class we {
|
|
2499
2495
|
constructor() {
|
|
2500
2496
|
// Make sure that the structural type of `TransformOperation` is unique.
|
|
2501
2497
|
// See https://github.com/microsoft/TypeScript/issues/5451
|
|
@@ -2503,15 +2499,15 @@ function we(t, e) {
|
|
|
2503
2499
|
}
|
|
2504
2500
|
}
|
|
2505
2501
|
|
|
2506
|
-
/** Transforms a value into a server-generated timestamp. */ class
|
|
2502
|
+
/** Transforms a value into a server-generated timestamp. */ class me extends we {}
|
|
2507
2503
|
|
|
2508
|
-
/** Transforms an array value via a union operation. */ class
|
|
2504
|
+
/** Transforms an array value via a union operation. */ class pe extends we {
|
|
2509
2505
|
constructor(t) {
|
|
2510
2506
|
super(), this.elements = t;
|
|
2511
2507
|
}
|
|
2512
2508
|
}
|
|
2513
2509
|
|
|
2514
|
-
/** Transforms an array value via a remove operation. */ class
|
|
2510
|
+
/** Transforms an array value via a remove operation. */ class ye extends we {
|
|
2515
2511
|
constructor(t) {
|
|
2516
2512
|
super(), this.elements = t;
|
|
2517
2513
|
}
|
|
@@ -2522,7 +2518,7 @@ function we(t, e) {
|
|
|
2522
2518
|
* transforms. Converts all field values to integers or doubles, but unlike the
|
|
2523
2519
|
* backend does not cap integer values at 2^63. Instead, JavaScript number
|
|
2524
2520
|
* arithmetic is used and precision loss can occur for values greater than 2^53.
|
|
2525
|
-
*/ class
|
|
2521
|
+
*/ class _e extends we {
|
|
2526
2522
|
constructor(t, e) {
|
|
2527
2523
|
super(), this.q = t, this.O = e;
|
|
2528
2524
|
}
|
|
@@ -2544,7 +2540,7 @@ function we(t, e) {
|
|
|
2544
2540
|
* See the License for the specific language governing permissions and
|
|
2545
2541
|
* limitations under the License.
|
|
2546
2542
|
*/
|
|
2547
|
-
/** A field path and the TransformOperation to perform upon it. */ class
|
|
2543
|
+
/** A field path and the TransformOperation to perform upon it. */ class ge {
|
|
2548
2544
|
constructor(t, e) {
|
|
2549
2545
|
this.field = t, this.transform = e;
|
|
2550
2546
|
}
|
|
@@ -2554,18 +2550,18 @@ function we(t, e) {
|
|
|
2554
2550
|
* Encodes a precondition for a mutation. This follows the model that the
|
|
2555
2551
|
* backend accepts with the special case of an explicit "empty" precondition
|
|
2556
2552
|
* (meaning no precondition).
|
|
2557
|
-
*/ class
|
|
2553
|
+
*/ class ve {
|
|
2558
2554
|
constructor(t, e) {
|
|
2559
2555
|
this.updateTime = t, this.exists = e;
|
|
2560
2556
|
}
|
|
2561
2557
|
/** Creates a new empty Precondition. */ static none() {
|
|
2562
|
-
return new
|
|
2558
|
+
return new ve;
|
|
2563
2559
|
}
|
|
2564
2560
|
/** Creates a new Precondition with an exists flag. */ static exists(t) {
|
|
2565
|
-
return new
|
|
2561
|
+
return new ve(void 0, t);
|
|
2566
2562
|
}
|
|
2567
2563
|
/** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
|
|
2568
|
-
return new
|
|
2564
|
+
return new ve(t);
|
|
2569
2565
|
}
|
|
2570
2566
|
/** Returns whether this Precondition is empty. */ get isNone() {
|
|
2571
2567
|
return void 0 === this.updateTime && void 0 === this.exists;
|
|
@@ -2618,12 +2614,12 @@ function we(t, e) {
|
|
|
2618
2614
|
* applyToLocalView() to implement the actual behavior of applying the mutation
|
|
2619
2615
|
* to some source document (see `setMutationApplyToRemoteDocument()` for an
|
|
2620
2616
|
* example).
|
|
2621
|
-
*/ class
|
|
2617
|
+
*/ class be {}
|
|
2622
2618
|
|
|
2623
2619
|
/**
|
|
2624
2620
|
* A mutation that creates or replaces the document at the given key with the
|
|
2625
2621
|
* object value contents.
|
|
2626
|
-
*/ class
|
|
2622
|
+
*/ class Ee extends be {
|
|
2627
2623
|
constructor(t, e, n, r = []) {
|
|
2628
2624
|
super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = r,
|
|
2629
2625
|
this.type = 0 /* Set */;
|
|
@@ -2642,14 +2638,14 @@ function we(t, e) {
|
|
|
2642
2638
|
* is deleted.
|
|
2643
2639
|
* * When a field is not in the mask but is in the values, the values map is
|
|
2644
2640
|
* ignored.
|
|
2645
|
-
*/ class
|
|
2641
|
+
*/ class Te extends be {
|
|
2646
2642
|
constructor(t, e, n, r, s = []) {
|
|
2647
2643
|
super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
|
|
2648
2644
|
this.fieldTransforms = s, this.type = 1 /* Patch */;
|
|
2649
2645
|
}
|
|
2650
2646
|
}
|
|
2651
2647
|
|
|
2652
|
-
/** A mutation that deletes the document at the given key. */ class
|
|
2648
|
+
/** A mutation that deletes the document at the given key. */ class Ie extends be {
|
|
2653
2649
|
constructor(t, e) {
|
|
2654
2650
|
super(), this.key = t, this.precondition = e, this.type = 2 /* Delete */ , this.fieldTransforms = [];
|
|
2655
2651
|
}
|
|
@@ -2661,7 +2657,7 @@ function we(t, e) {
|
|
|
2661
2657
|
*
|
|
2662
2658
|
* The `verify` operation is only used in Transactions, and this class serves
|
|
2663
2659
|
* primarily to facilitate serialization into protos.
|
|
2664
|
-
*/ class
|
|
2660
|
+
*/ class Ae extends be {
|
|
2665
2661
|
constructor(t, e) {
|
|
2666
2662
|
super(), this.key = t, this.precondition = e, this.type = 3 /* Verify */ , this.fieldTransforms = [];
|
|
2667
2663
|
}
|
|
@@ -2682,13 +2678,13 @@ function we(t, e) {
|
|
|
2682
2678
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2683
2679
|
* See the License for the specific language governing permissions and
|
|
2684
2680
|
* limitations under the License.
|
|
2685
|
-
*/ const
|
|
2681
|
+
*/ const Re = (() => {
|
|
2686
2682
|
const t = {
|
|
2687
2683
|
asc: "ASCENDING",
|
|
2688
2684
|
desc: "DESCENDING"
|
|
2689
2685
|
};
|
|
2690
2686
|
return t;
|
|
2691
|
-
})(),
|
|
2687
|
+
})(), Pe = (() => {
|
|
2692
2688
|
const t = {
|
|
2693
2689
|
"<": "LESS_THAN",
|
|
2694
2690
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -2718,7 +2714,7 @@ function we(t, e) {
|
|
|
2718
2714
|
* TODO(klimt): We can remove the databaseId argument if we keep the full
|
|
2719
2715
|
* resource name in documents.
|
|
2720
2716
|
*/
|
|
2721
|
-
class
|
|
2717
|
+
class Ve {
|
|
2722
2718
|
constructor(t, e) {
|
|
2723
2719
|
this.databaseId = t, this.F = e;
|
|
2724
2720
|
}
|
|
@@ -2735,7 +2731,7 @@ class De {
|
|
|
2735
2731
|
/**
|
|
2736
2732
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
2737
2733
|
*/
|
|
2738
|
-
function
|
|
2734
|
+
function De(t, e) {
|
|
2739
2735
|
if (t.F) {
|
|
2740
2736
|
return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
|
|
2741
2737
|
}
|
|
@@ -2750,35 +2746,35 @@ function Ne(t, e) {
|
|
|
2750
2746
|
*
|
|
2751
2747
|
* Visible for testing.
|
|
2752
2748
|
*/
|
|
2753
|
-
function
|
|
2749
|
+
function Ne(t, e) {
|
|
2754
2750
|
return t.F ? e.toBase64() : e.toUint8Array();
|
|
2755
2751
|
}
|
|
2756
2752
|
|
|
2757
|
-
function
|
|
2758
|
-
return
|
|
2753
|
+
function $e(t, e) {
|
|
2754
|
+
return De(t, e.toTimestamp());
|
|
2759
2755
|
}
|
|
2760
2756
|
|
|
2761
|
-
function
|
|
2757
|
+
function Se(t) {
|
|
2762
2758
|
return v(!!t), vt.fromTimestamp(function(t) {
|
|
2763
2759
|
const e = Rt(t);
|
|
2764
2760
|
return new gt(e.seconds, e.nanos);
|
|
2765
2761
|
}(t));
|
|
2766
2762
|
}
|
|
2767
2763
|
|
|
2768
|
-
function
|
|
2764
|
+
function Fe(t, e) {
|
|
2769
2765
|
return function(t) {
|
|
2770
2766
|
return new X([ "projects", t.projectId, "databases", t.database ]);
|
|
2771
2767
|
}(t).child("documents").child(e).canonicalString();
|
|
2772
2768
|
}
|
|
2773
2769
|
|
|
2774
|
-
function
|
|
2775
|
-
return
|
|
2770
|
+
function xe(t, e) {
|
|
2771
|
+
return Fe(t.databaseId, e.path);
|
|
2776
2772
|
}
|
|
2777
2773
|
|
|
2778
|
-
function
|
|
2774
|
+
function qe(t, e) {
|
|
2779
2775
|
const n = function(t) {
|
|
2780
2776
|
const e = X.fromString(t);
|
|
2781
|
-
return v(
|
|
2777
|
+
return v(Qe(e)), e;
|
|
2782
2778
|
}(e);
|
|
2783
2779
|
if (n.get(1) !== t.databaseId.projectId) throw new U(A, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
|
|
2784
2780
|
if (n.get(3) !== t.databaseId.database) throw new U(A, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
|
|
@@ -2786,25 +2782,25 @@ function Oe(t, e) {
|
|
|
2786
2782
|
var r;
|
|
2787
2783
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
2788
2784
|
|
|
2789
|
-
function
|
|
2790
|
-
return
|
|
2785
|
+
function Oe(t, e) {
|
|
2786
|
+
return Fe(t.databaseId, e);
|
|
2791
2787
|
}
|
|
2792
2788
|
|
|
2793
|
-
function
|
|
2789
|
+
function Ce(t) {
|
|
2794
2790
|
return new X([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
2795
2791
|
}
|
|
2796
2792
|
|
|
2797
|
-
function
|
|
2793
|
+
function Le(t, e, n) {
|
|
2798
2794
|
return {
|
|
2799
|
-
name:
|
|
2795
|
+
name: xe(t, e),
|
|
2800
2796
|
fields: n.value.mapValue.fields
|
|
2801
2797
|
};
|
|
2802
2798
|
}
|
|
2803
2799
|
|
|
2804
|
-
function
|
|
2800
|
+
function Ue(t, e) {
|
|
2805
2801
|
return "found" in e ? function(t, e) {
|
|
2806
2802
|
v(!!e.found), e.found.name, e.found.updateTime;
|
|
2807
|
-
const n =
|
|
2803
|
+
const n = qe(t, e.found.name), r = Se(e.found.updateTime), s = new Bt({
|
|
2808
2804
|
mapValue: {
|
|
2809
2805
|
fields: e.found.fields
|
|
2810
2806
|
}
|
|
@@ -2812,67 +2808,67 @@ function ke(t, e) {
|
|
|
2812
2808
|
return zt.newFoundDocument(n, r, s);
|
|
2813
2809
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
2814
2810
|
v(!!e.missing), v(!!e.readTime);
|
|
2815
|
-
const n =
|
|
2811
|
+
const n = qe(t, e.missing), r = Se(e.readTime);
|
|
2816
2812
|
return zt.newNoDocument(n, r);
|
|
2817
2813
|
}(t, e) : g();
|
|
2818
2814
|
}
|
|
2819
2815
|
|
|
2820
|
-
function
|
|
2816
|
+
function ke(t, e) {
|
|
2821
2817
|
let n;
|
|
2822
|
-
if (e instanceof
|
|
2823
|
-
update:
|
|
2824
|
-
}; else if (e instanceof Ae) n = {
|
|
2825
|
-
delete: qe(t, e.key)
|
|
2818
|
+
if (e instanceof Ee) n = {
|
|
2819
|
+
update: Le(t, e.key, e.value)
|
|
2826
2820
|
}; else if (e instanceof Ie) n = {
|
|
2827
|
-
|
|
2828
|
-
|
|
2821
|
+
delete: xe(t, e.key)
|
|
2822
|
+
}; else if (e instanceof Te) n = {
|
|
2823
|
+
update: Le(t, e.key, e.data),
|
|
2824
|
+
updateMask: Ge(e.fieldMask)
|
|
2829
2825
|
}; else {
|
|
2830
|
-
if (!(e instanceof
|
|
2826
|
+
if (!(e instanceof Ae)) return g();
|
|
2831
2827
|
n = {
|
|
2832
|
-
verify:
|
|
2828
|
+
verify: xe(t, e.key)
|
|
2833
2829
|
};
|
|
2834
2830
|
}
|
|
2835
2831
|
return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((t => function(t, e) {
|
|
2836
2832
|
const n = e.transform;
|
|
2837
|
-
if (n instanceof
|
|
2833
|
+
if (n instanceof me) return {
|
|
2838
2834
|
fieldPath: e.field.canonicalString(),
|
|
2839
2835
|
setToServerValue: "REQUEST_TIME"
|
|
2840
2836
|
};
|
|
2841
|
-
if (n instanceof
|
|
2837
|
+
if (n instanceof pe) return {
|
|
2842
2838
|
fieldPath: e.field.canonicalString(),
|
|
2843
2839
|
appendMissingElements: {
|
|
2844
2840
|
values: n.elements
|
|
2845
2841
|
}
|
|
2846
2842
|
};
|
|
2847
|
-
if (n instanceof
|
|
2843
|
+
if (n instanceof ye) return {
|
|
2848
2844
|
fieldPath: e.field.canonicalString(),
|
|
2849
2845
|
removeAllFromArray: {
|
|
2850
2846
|
values: n.elements
|
|
2851
2847
|
}
|
|
2852
2848
|
};
|
|
2853
|
-
if (n instanceof
|
|
2849
|
+
if (n instanceof _e) return {
|
|
2854
2850
|
fieldPath: e.field.canonicalString(),
|
|
2855
2851
|
increment: n.O
|
|
2856
2852
|
};
|
|
2857
2853
|
throw g();
|
|
2858
2854
|
}(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
2859
2855
|
return void 0 !== e.updateTime ? {
|
|
2860
|
-
updateTime:
|
|
2856
|
+
updateTime: $e(t, e.updateTime)
|
|
2861
2857
|
} : void 0 !== e.exists ? {
|
|
2862
2858
|
exists: e.exists
|
|
2863
2859
|
} : g();
|
|
2864
2860
|
}(t, e.precondition)), n;
|
|
2865
2861
|
}
|
|
2866
2862
|
|
|
2867
|
-
function
|
|
2863
|
+
function je(t, e) {
|
|
2868
2864
|
// Dissect the path into parent, collectionId, and optional key filter.
|
|
2869
2865
|
const n = {
|
|
2870
2866
|
structuredQuery: {}
|
|
2871
2867
|
}, r = e.path;
|
|
2872
|
-
null !== e.collectionGroup ? (n.parent =
|
|
2868
|
+
null !== e.collectionGroup ? (n.parent = Oe(t, r), n.structuredQuery.from = [ {
|
|
2873
2869
|
collectionId: e.collectionGroup,
|
|
2874
2870
|
allDescendants: !0
|
|
2875
|
-
} ]) : (n.parent =
|
|
2871
|
+
} ]) : (n.parent = Oe(t, r.popLast()), n.structuredQuery.from = [ {
|
|
2876
2872
|
collectionId: r.lastSegment()
|
|
2877
2873
|
} ]);
|
|
2878
2874
|
const s = function(t) {
|
|
@@ -2883,34 +2879,34 @@ function Me(t, e) {
|
|
|
2883
2879
|
if ("==" /* EQUAL */ === t.op) {
|
|
2884
2880
|
if (kt(t.value)) return {
|
|
2885
2881
|
unaryFilter: {
|
|
2886
|
-
field:
|
|
2882
|
+
field: ze(t.field),
|
|
2887
2883
|
op: "IS_NAN"
|
|
2888
2884
|
}
|
|
2889
2885
|
};
|
|
2890
2886
|
if (Ut(t.value)) return {
|
|
2891
2887
|
unaryFilter: {
|
|
2892
|
-
field:
|
|
2888
|
+
field: ze(t.field),
|
|
2893
2889
|
op: "IS_NULL"
|
|
2894
2890
|
}
|
|
2895
2891
|
};
|
|
2896
2892
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
2897
2893
|
if (kt(t.value)) return {
|
|
2898
2894
|
unaryFilter: {
|
|
2899
|
-
field:
|
|
2895
|
+
field: ze(t.field),
|
|
2900
2896
|
op: "IS_NOT_NAN"
|
|
2901
2897
|
}
|
|
2902
2898
|
};
|
|
2903
2899
|
if (Ut(t.value)) return {
|
|
2904
2900
|
unaryFilter: {
|
|
2905
|
-
field:
|
|
2901
|
+
field: ze(t.field),
|
|
2906
2902
|
op: "IS_NOT_NULL"
|
|
2907
2903
|
}
|
|
2908
2904
|
};
|
|
2909
2905
|
}
|
|
2910
2906
|
return {
|
|
2911
2907
|
fieldFilter: {
|
|
2912
|
-
field:
|
|
2913
|
-
op:
|
|
2908
|
+
field: ze(t.field),
|
|
2909
|
+
op: Be(t.op),
|
|
2914
2910
|
value: t.value
|
|
2915
2911
|
}
|
|
2916
2912
|
};
|
|
@@ -2930,8 +2926,8 @@ function Me(t, e) {
|
|
|
2930
2926
|
// visible for testing
|
|
2931
2927
|
function(t) {
|
|
2932
2928
|
return {
|
|
2933
|
-
field:
|
|
2934
|
-
direction:
|
|
2929
|
+
field: ze(t.field),
|
|
2930
|
+
direction: Me(t.dir)
|
|
2935
2931
|
};
|
|
2936
2932
|
}(t)));
|
|
2937
2933
|
}(e.orderBy);
|
|
@@ -2955,29 +2951,29 @@ function Me(t, e) {
|
|
|
2955
2951
|
(e.endAt)), n;
|
|
2956
2952
|
}
|
|
2957
2953
|
|
|
2958
|
-
function
|
|
2959
|
-
return
|
|
2954
|
+
function Me(t) {
|
|
2955
|
+
return Re[t];
|
|
2960
2956
|
}
|
|
2961
2957
|
|
|
2962
2958
|
// visible for testing
|
|
2963
|
-
function
|
|
2964
|
-
return
|
|
2959
|
+
function Be(t) {
|
|
2960
|
+
return Pe[t];
|
|
2965
2961
|
}
|
|
2966
2962
|
|
|
2967
|
-
function
|
|
2963
|
+
function ze(t) {
|
|
2968
2964
|
return {
|
|
2969
2965
|
fieldPath: t.canonicalString()
|
|
2970
2966
|
};
|
|
2971
2967
|
}
|
|
2972
2968
|
|
|
2973
|
-
function
|
|
2969
|
+
function Ge(t) {
|
|
2974
2970
|
const e = [];
|
|
2975
2971
|
return t.fields.forEach((t => e.push(t.canonicalString()))), {
|
|
2976
2972
|
fieldPaths: e
|
|
2977
2973
|
};
|
|
2978
2974
|
}
|
|
2979
2975
|
|
|
2980
|
-
function
|
|
2976
|
+
function Qe(t) {
|
|
2981
2977
|
// Resource names have at least 4 components (project ID, database ID)
|
|
2982
2978
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
2983
2979
|
}
|
|
@@ -2997,8 +2993,8 @@ function We(t) {
|
|
|
2997
2993
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2998
2994
|
* See the License for the specific language governing permissions and
|
|
2999
2995
|
* limitations under the License.
|
|
3000
|
-
*/ function
|
|
3001
|
-
return new
|
|
2996
|
+
*/ function We(t) {
|
|
2997
|
+
return new Ve(t, /* useProto3Json= */ !0);
|
|
3002
2998
|
}
|
|
3003
2999
|
|
|
3004
3000
|
/**
|
|
@@ -3026,7 +3022,7 @@ function We(t) {
|
|
|
3026
3022
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
3027
3023
|
* delays causing spikes of load to the backend.
|
|
3028
3024
|
*/
|
|
3029
|
-
class
|
|
3025
|
+
class Ye {
|
|
3030
3026
|
constructor(
|
|
3031
3027
|
/**
|
|
3032
3028
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -3124,7 +3120,7 @@ class He {
|
|
|
3124
3120
|
* An implementation of Datastore that exposes additional state for internal
|
|
3125
3121
|
* consumption.
|
|
3126
3122
|
*/
|
|
3127
|
-
class
|
|
3123
|
+
class He extends class {} {
|
|
3128
3124
|
constructor(t, e, n, r) {
|
|
3129
3125
|
super(), this.authCredentials = t, this.appCheckCredentials = e, this.K = n, this.q = r,
|
|
3130
3126
|
this.J = !1;
|
|
@@ -3151,19 +3147,19 @@ class Ke extends class {} {
|
|
|
3151
3147
|
|
|
3152
3148
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3153
3149
|
// firestore-exp client.
|
|
3154
|
-
async function
|
|
3155
|
-
const n = b(t), r =
|
|
3156
|
-
writes: e.map((t =>
|
|
3150
|
+
async function Ke(t, e) {
|
|
3151
|
+
const n = b(t), r = Ce(n.q) + "/documents", s = {
|
|
3152
|
+
writes: e.map((t => ke(n.q, t)))
|
|
3157
3153
|
};
|
|
3158
3154
|
await n.m("Commit", r, s);
|
|
3159
3155
|
}
|
|
3160
3156
|
|
|
3161
|
-
async function
|
|
3162
|
-
const n = b(t), r =
|
|
3163
|
-
documents: e.map((t =>
|
|
3157
|
+
async function Je(t, e) {
|
|
3158
|
+
const n = b(t), r = Ce(n.q) + "/documents", s = {
|
|
3159
|
+
documents: e.map((t => xe(n.q, t)))
|
|
3164
3160
|
}, i = await n.T("BatchGetDocuments", r, s), o = new Map;
|
|
3165
3161
|
i.forEach((t => {
|
|
3166
|
-
const e =
|
|
3162
|
+
const e = Ue(n.q, t);
|
|
3167
3163
|
o.set(e.key.toString(), e);
|
|
3168
3164
|
}));
|
|
3169
3165
|
const u = [];
|
|
@@ -3173,12 +3169,12 @@ async function Xe(t, e) {
|
|
|
3173
3169
|
})), u;
|
|
3174
3170
|
}
|
|
3175
3171
|
|
|
3176
|
-
async function
|
|
3177
|
-
const n = b(t), r =
|
|
3172
|
+
async function Xe(t, e) {
|
|
3173
|
+
const n = b(t), r = je(n.q, le(e));
|
|
3178
3174
|
return (await n.T("RunQuery", r.parent, {
|
|
3179
3175
|
structuredQuery: r.structuredQuery
|
|
3180
3176
|
})).filter((t => !!t.document)).map((t => function(t, e, n) {
|
|
3181
|
-
const r =
|
|
3177
|
+
const r = qe(t, e.name), s = Se(e.updateTime), i = new Bt({
|
|
3182
3178
|
mapValue: {
|
|
3183
3179
|
fields: e.fields
|
|
3184
3180
|
}
|
|
@@ -3202,7 +3198,7 @@ async function Ze(t, e) {
|
|
|
3202
3198
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3203
3199
|
* See the License for the specific language governing permissions and
|
|
3204
3200
|
* limitations under the License.
|
|
3205
|
-
*/ const
|
|
3201
|
+
*/ const Ze = new Map;
|
|
3206
3202
|
|
|
3207
3203
|
/**
|
|
3208
3204
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -3213,17 +3209,17 @@ async function Ze(t, e) {
|
|
|
3213
3209
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
3214
3210
|
* instance is terminated.
|
|
3215
3211
|
*/
|
|
3216
|
-
function
|
|
3212
|
+
function tn(t) {
|
|
3217
3213
|
if (t._terminated) throw new U(S, "The client has already been terminated.");
|
|
3218
|
-
if (!
|
|
3214
|
+
if (!Ze.has(t)) {
|
|
3219
3215
|
m("ComponentProvider", "Initializing Datastore");
|
|
3220
3216
|
const i = function(t) {
|
|
3221
3217
|
return new wt(t, fetch.bind(null));
|
|
3222
3218
|
}((e = t._databaseId, n = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
|
|
3223
|
-
new H(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o =
|
|
3224
|
-
return new
|
|
3219
|
+
new H(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = We(t._databaseId), u = function(t, e, n, r) {
|
|
3220
|
+
return new He(t, e, n, r);
|
|
3225
3221
|
}(t._authCredentials, t._appCheckCredentials, i, o);
|
|
3226
|
-
|
|
3222
|
+
Ze.set(t, u);
|
|
3227
3223
|
}
|
|
3228
3224
|
var e, n, r, s;
|
|
3229
3225
|
/**
|
|
@@ -3241,7 +3237,7 @@ function en(t) {
|
|
|
3241
3237
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3242
3238
|
* See the License for the specific language governing permissions and
|
|
3243
3239
|
* limitations under the License.
|
|
3244
|
-
*/ return
|
|
3240
|
+
*/ return Ze.get(t);
|
|
3245
3241
|
}
|
|
3246
3242
|
|
|
3247
3243
|
/**
|
|
@@ -3253,7 +3249,7 @@ function en(t) {
|
|
|
3253
3249
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
3254
3250
|
* defaults can be supplied and the value can be checked for equality.
|
|
3255
3251
|
*/
|
|
3256
|
-
class
|
|
3252
|
+
class en {
|
|
3257
3253
|
constructor(t) {
|
|
3258
3254
|
var e;
|
|
3259
3255
|
if (void 0 === t.host) {
|
|
@@ -3295,14 +3291,14 @@ class nn {
|
|
|
3295
3291
|
* The Cloud Firestore service interface.
|
|
3296
3292
|
*
|
|
3297
3293
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3298
|
-
*/ class
|
|
3294
|
+
*/ class nn {
|
|
3299
3295
|
/** @hideconstructor */
|
|
3300
3296
|
constructor(t, e, n) {
|
|
3301
3297
|
this._authCredentials = e, this._appCheckCredentials = n,
|
|
3302
3298
|
/**
|
|
3303
3299
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
3304
3300
|
*/
|
|
3305
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
3301
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new en({}),
|
|
3306
3302
|
this._settingsFrozen = !1, t instanceof K ? this._databaseId = t : (this._app = t,
|
|
3307
3303
|
this._databaseId = function(t) {
|
|
3308
3304
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(A, '"projectId" not provided in firebase.initializeApp.');
|
|
@@ -3335,7 +3331,7 @@ class nn {
|
|
|
3335
3331
|
}
|
|
3336
3332
|
_setSettings(t) {
|
|
3337
3333
|
if (this._settingsFrozen) throw new U(S, "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.");
|
|
3338
|
-
this._settings = new
|
|
3334
|
+
this._settings = new en(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
3339
3335
|
if (!t) return new M;
|
|
3340
3336
|
switch (t.type) {
|
|
3341
3337
|
case "gapi":
|
|
@@ -3376,13 +3372,13 @@ class nn {
|
|
|
3376
3372
|
* Only ever called once.
|
|
3377
3373
|
*/ _terminate() {
|
|
3378
3374
|
return function(t) {
|
|
3379
|
-
const e =
|
|
3380
|
-
e && (m("ComponentProvider", "Removing Datastore"),
|
|
3375
|
+
const e = Ze.get(t);
|
|
3376
|
+
e && (m("ComponentProvider", "Removing Datastore"), Ze.delete(t), e.terminate());
|
|
3381
3377
|
}(this), Promise.resolve();
|
|
3382
3378
|
}
|
|
3383
3379
|
}
|
|
3384
3380
|
|
|
3385
|
-
function
|
|
3381
|
+
function rn(t, e) {
|
|
3386
3382
|
const n = _getProvider(t, "firestore/lite");
|
|
3387
3383
|
if (n.isInitialized()) throw new U(S, "Firestore can only be initialized once per app.");
|
|
3388
3384
|
return n.initialize({
|
|
@@ -3398,7 +3394,7 @@ function sn(t, e) {
|
|
|
3398
3394
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
3399
3395
|
* instance is associated with.
|
|
3400
3396
|
* @returns The `Firestore` instance of the provided app.
|
|
3401
|
-
*/ function
|
|
3397
|
+
*/ function sn(e = getApp()) {
|
|
3402
3398
|
return _getProvider(e, "firestore/lite").getImmediate();
|
|
3403
3399
|
}
|
|
3404
3400
|
|
|
@@ -3414,9 +3410,9 @@ function sn(t, e) {
|
|
|
3414
3410
|
* @param port - the emulator port (ex: 9000).
|
|
3415
3411
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
3416
3412
|
* Security Rules.
|
|
3417
|
-
*/ function
|
|
3413
|
+
*/ function on(t, e, n, r = {}) {
|
|
3418
3414
|
var s;
|
|
3419
|
-
const i = (t = ot(t,
|
|
3415
|
+
const i = (t = ot(t, nn))._getSettings();
|
|
3420
3416
|
if ("firestore.googleapis.com" !== i.host && i.host !== e && y("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
3421
3417
|
t._setSettings(Object.assign(Object.assign({}, i), {
|
|
3422
3418
|
host: `${e}:${n}`,
|
|
@@ -3454,8 +3450,8 @@ function sn(t, e) {
|
|
|
3454
3450
|
* @param firestore - The `Firestore` instance to terminate.
|
|
3455
3451
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
3456
3452
|
* terminated.
|
|
3457
|
-
*/ function
|
|
3458
|
-
return t = ot(t,
|
|
3453
|
+
*/ function un(t) {
|
|
3454
|
+
return t = ot(t, nn), _removeServiceInstance(t.app, "firestore/lite"), t._delete();
|
|
3459
3455
|
}
|
|
3460
3456
|
|
|
3461
3457
|
/**
|
|
@@ -3495,7 +3491,7 @@ function sn(t, e) {
|
|
|
3495
3491
|
* and can be used to write, read, or listen to the location. The document at
|
|
3496
3492
|
* the referenced location may or may not exist.
|
|
3497
3493
|
*/
|
|
3498
|
-
class
|
|
3494
|
+
class cn {
|
|
3499
3495
|
/** @hideconstructor */
|
|
3500
3496
|
constructor(t,
|
|
3501
3497
|
/**
|
|
@@ -3523,17 +3519,17 @@ class an {
|
|
|
3523
3519
|
/**
|
|
3524
3520
|
* The collection this `DocumentReference` belongs to.
|
|
3525
3521
|
*/ get parent() {
|
|
3526
|
-
return new
|
|
3522
|
+
return new hn(this.firestore, this.converter, this._key.path.popLast());
|
|
3527
3523
|
}
|
|
3528
3524
|
withConverter(t) {
|
|
3529
|
-
return new
|
|
3525
|
+
return new cn(this.firestore, t, this._key);
|
|
3530
3526
|
}
|
|
3531
3527
|
}
|
|
3532
3528
|
|
|
3533
3529
|
/**
|
|
3534
3530
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
3535
3531
|
* construct refined `Query` objects by adding filters and ordering.
|
|
3536
|
-
*/ class
|
|
3532
|
+
*/ class an {
|
|
3537
3533
|
// This is the lite version of the Query class in the main SDK.
|
|
3538
3534
|
/** @hideconstructor protected */
|
|
3539
3535
|
constructor(t,
|
|
@@ -3546,14 +3542,14 @@ class an {
|
|
|
3546
3542
|
this.type = "query", this.firestore = t;
|
|
3547
3543
|
}
|
|
3548
3544
|
withConverter(t) {
|
|
3549
|
-
return new
|
|
3545
|
+
return new an(this.firestore, t, this._query);
|
|
3550
3546
|
}
|
|
3551
3547
|
}
|
|
3552
3548
|
|
|
3553
3549
|
/**
|
|
3554
3550
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
3555
3551
|
* document references, and querying for documents (using {@link query}).
|
|
3556
|
-
*/ class
|
|
3552
|
+
*/ class hn extends an {
|
|
3557
3553
|
/** @hideconstructor */
|
|
3558
3554
|
constructor(t, e, n) {
|
|
3559
3555
|
super(t, e, new oe(n)), this._path = n,
|
|
@@ -3574,23 +3570,23 @@ class an {
|
|
|
3574
3570
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
3575
3571
|
*/ get parent() {
|
|
3576
3572
|
const t = this._path.popLast();
|
|
3577
|
-
return t.isEmpty() ? null : new
|
|
3573
|
+
return t.isEmpty() ? null : new cn(this.firestore,
|
|
3578
3574
|
/* converter= */ null, new et(t));
|
|
3579
3575
|
}
|
|
3580
3576
|
withConverter(t) {
|
|
3581
|
-
return new
|
|
3577
|
+
return new hn(this.firestore, t, this._path);
|
|
3582
3578
|
}
|
|
3583
3579
|
}
|
|
3584
3580
|
|
|
3585
|
-
function
|
|
3586
|
-
if (t = getModularInstance(t), nt("collection", "path", e), t instanceof
|
|
3581
|
+
function ln(t, e, ...n) {
|
|
3582
|
+
if (t = getModularInstance(t), nt("collection", "path", e), t instanceof nn) {
|
|
3587
3583
|
const r = X.fromString(e, ...n);
|
|
3588
|
-
return st(r), new
|
|
3584
|
+
return st(r), new hn(t, /* converter= */ null, r);
|
|
3589
3585
|
}
|
|
3590
3586
|
{
|
|
3591
|
-
if (!(t instanceof
|
|
3587
|
+
if (!(t instanceof cn || t instanceof hn)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3592
3588
|
const r = t._path.child(X.fromString(e, ...n));
|
|
3593
|
-
return st(r), new
|
|
3589
|
+
return st(r), new hn(t.firestore,
|
|
3594
3590
|
/* converter= */ null, r);
|
|
3595
3591
|
}
|
|
3596
3592
|
}
|
|
@@ -3607,9 +3603,9 @@ function fn(t, e, ...n) {
|
|
|
3607
3603
|
* collection or subcollection with this ID as the last segment of its path
|
|
3608
3604
|
* will be included. Cannot contain a slash.
|
|
3609
3605
|
* @returns The created `Query`.
|
|
3610
|
-
*/ function
|
|
3611
|
-
if (t = ot(t,
|
|
3612
|
-
return new
|
|
3606
|
+
*/ function fn(t, e) {
|
|
3607
|
+
if (t = ot(t, nn), nt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new U(A, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
3608
|
+
return new an(t,
|
|
3613
3609
|
/* converter= */ null,
|
|
3614
3610
|
/**
|
|
3615
3611
|
* Creates a new Query for a collection group query that matches all documents
|
|
@@ -3620,19 +3616,19 @@ function fn(t, e, ...n) {
|
|
|
3620
3616
|
}(e));
|
|
3621
3617
|
}
|
|
3622
3618
|
|
|
3623
|
-
function
|
|
3619
|
+
function dn(t, e, ...n) {
|
|
3624
3620
|
if (t = getModularInstance(t),
|
|
3625
3621
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3626
3622
|
// 'undefined' and 'null'.
|
|
3627
|
-
1 === arguments.length && (e = pt.R()), nt("doc", "path", e), t instanceof
|
|
3623
|
+
1 === arguments.length && (e = pt.R()), nt("doc", "path", e), t instanceof nn) {
|
|
3628
3624
|
const r = X.fromString(e, ...n);
|
|
3629
|
-
return rt(r), new
|
|
3625
|
+
return rt(r), new cn(t,
|
|
3630
3626
|
/* converter= */ null, new et(r));
|
|
3631
3627
|
}
|
|
3632
3628
|
{
|
|
3633
|
-
if (!(t instanceof
|
|
3629
|
+
if (!(t instanceof cn || t instanceof hn)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3634
3630
|
const r = t._path.child(X.fromString(e, ...n));
|
|
3635
|
-
return rt(r), new
|
|
3631
|
+
return rt(r), new cn(t.firestore, t instanceof hn ? t.converter : null, new et(r));
|
|
3636
3632
|
}
|
|
3637
3633
|
}
|
|
3638
3634
|
|
|
@@ -3643,8 +3639,8 @@ function wn(t, e, ...n) {
|
|
|
3643
3639
|
* @param right - A reference to compare.
|
|
3644
3640
|
* @returns true if the references point to the same location in the same
|
|
3645
3641
|
* Firestore database.
|
|
3646
|
-
*/ function
|
|
3647
|
-
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof
|
|
3642
|
+
*/ function wn(t, e) {
|
|
3643
|
+
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof cn || t instanceof hn) && (e instanceof cn || e instanceof hn) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
|
|
3648
3644
|
}
|
|
3649
3645
|
|
|
3650
3646
|
/**
|
|
@@ -3655,8 +3651,8 @@ function wn(t, e, ...n) {
|
|
|
3655
3651
|
* @param right - A `Query` to compare.
|
|
3656
3652
|
* @returns true if the references point to the same location in the same
|
|
3657
3653
|
* Firestore database.
|
|
3658
|
-
*/ function
|
|
3659
|
-
return t = getModularInstance(t), e = getModularInstance(e), t instanceof
|
|
3654
|
+
*/ function mn(t, e) {
|
|
3655
|
+
return t = getModularInstance(t), e = getModularInstance(e), t instanceof an && e instanceof an && (t.firestore === e.firestore && fe(t._query, e._query) && t.converter === e.converter);
|
|
3660
3656
|
}
|
|
3661
3657
|
|
|
3662
3658
|
/**
|
|
@@ -3682,7 +3678,7 @@ function wn(t, e, ...n) {
|
|
|
3682
3678
|
*
|
|
3683
3679
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
3684
3680
|
* name is provided, the path will point to a nested field in a document.
|
|
3685
|
-
*/ class
|
|
3681
|
+
*/ class pn {
|
|
3686
3682
|
/**
|
|
3687
3683
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
3688
3684
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -3706,8 +3702,8 @@ function wn(t, e, ...n) {
|
|
|
3706
3702
|
/**
|
|
3707
3703
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
3708
3704
|
* It can be used in queries to sort or filter by the document ID.
|
|
3709
|
-
*/ function
|
|
3710
|
-
return new
|
|
3705
|
+
*/ function yn() {
|
|
3706
|
+
return new pn("__name__");
|
|
3711
3707
|
}
|
|
3712
3708
|
|
|
3713
3709
|
/**
|
|
@@ -3728,7 +3724,7 @@ function wn(t, e, ...n) {
|
|
|
3728
3724
|
*/
|
|
3729
3725
|
/**
|
|
3730
3726
|
* An immutable object representing an array of bytes.
|
|
3731
|
-
*/ class
|
|
3727
|
+
*/ class _n {
|
|
3732
3728
|
/** @hideconstructor */
|
|
3733
3729
|
constructor(t) {
|
|
3734
3730
|
this._byteString = t;
|
|
@@ -3740,7 +3736,7 @@ function wn(t, e, ...n) {
|
|
|
3740
3736
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3741
3737
|
*/ static fromBase64String(t) {
|
|
3742
3738
|
try {
|
|
3743
|
-
return new
|
|
3739
|
+
return new _n(It.fromBase64String(t));
|
|
3744
3740
|
} catch (t) {
|
|
3745
3741
|
throw new U(A, "Failed to construct data from Base64 string: " + t);
|
|
3746
3742
|
}
|
|
@@ -3750,7 +3746,7 @@ function wn(t, e, ...n) {
|
|
|
3750
3746
|
*
|
|
3751
3747
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3752
3748
|
*/ static fromUint8Array(t) {
|
|
3753
|
-
return new
|
|
3749
|
+
return new _n(It.fromUint8Array(t));
|
|
3754
3750
|
}
|
|
3755
3751
|
/**
|
|
3756
3752
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3802,7 +3798,7 @@ function wn(t, e, ...n) {
|
|
|
3802
3798
|
/**
|
|
3803
3799
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
3804
3800
|
* or `update()`.
|
|
3805
|
-
*/ class
|
|
3801
|
+
*/ class gn {
|
|
3806
3802
|
/**
|
|
3807
3803
|
* @param _methodName - The public API endpoint that returns this class.
|
|
3808
3804
|
* @hideconstructor
|
|
@@ -3834,7 +3830,7 @@ function wn(t, e, ...n) {
|
|
|
3834
3830
|
*
|
|
3835
3831
|
* Latitude values are in the range of [-90, 90].
|
|
3836
3832
|
* Longitude values are in the range of [-180, 180].
|
|
3837
|
-
*/ class
|
|
3833
|
+
*/ class vn {
|
|
3838
3834
|
/**
|
|
3839
3835
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
3840
3836
|
* longitude values.
|
|
@@ -3893,29 +3889,29 @@ function wn(t, e, ...n) {
|
|
|
3893
3889
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3894
3890
|
* See the License for the specific language governing permissions and
|
|
3895
3891
|
* limitations under the License.
|
|
3896
|
-
*/ const
|
|
3892
|
+
*/ const bn = /^__.*__$/;
|
|
3897
3893
|
|
|
3898
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
3894
|
+
/** The result of parsing document data (e.g. for a setData call). */ class En {
|
|
3899
3895
|
constructor(t, e, n) {
|
|
3900
3896
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3901
3897
|
}
|
|
3902
3898
|
toMutation(t, e) {
|
|
3903
|
-
return null !== this.fieldMask ? new
|
|
3899
|
+
return null !== this.fieldMask ? new Te(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Ee(t, this.data, e, this.fieldTransforms);
|
|
3904
3900
|
}
|
|
3905
3901
|
}
|
|
3906
3902
|
|
|
3907
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
3903
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class Tn {
|
|
3908
3904
|
constructor(t,
|
|
3909
3905
|
// The fieldMask does not include document transforms.
|
|
3910
3906
|
e, n) {
|
|
3911
3907
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3912
3908
|
}
|
|
3913
3909
|
toMutation(t, e) {
|
|
3914
|
-
return new
|
|
3910
|
+
return new Te(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
3915
3911
|
}
|
|
3916
3912
|
}
|
|
3917
3913
|
|
|
3918
|
-
function
|
|
3914
|
+
function In(t) {
|
|
3919
3915
|
switch (t) {
|
|
3920
3916
|
case 0 /* Set */ :
|
|
3921
3917
|
// fall through
|
|
@@ -3933,7 +3929,7 @@ function An(t) {
|
|
|
3933
3929
|
}
|
|
3934
3930
|
}
|
|
3935
3931
|
|
|
3936
|
-
/** A "context" object passed around while parsing user data. */ class
|
|
3932
|
+
/** A "context" object passed around while parsing user data. */ class An {
|
|
3937
3933
|
/**
|
|
3938
3934
|
* Initializes a ParseContext with the given source and path.
|
|
3939
3935
|
*
|
|
@@ -3965,7 +3961,7 @@ function An(t) {
|
|
|
3965
3961
|
return this.settings.tt;
|
|
3966
3962
|
}
|
|
3967
3963
|
/** Returns a new context with the specified settings overwritten. */ et(t) {
|
|
3968
|
-
return new
|
|
3964
|
+
return new An(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
3969
3965
|
}
|
|
3970
3966
|
nt(t) {
|
|
3971
3967
|
var e;
|
|
@@ -3992,7 +3988,7 @@ function An(t) {
|
|
|
3992
3988
|
});
|
|
3993
3989
|
}
|
|
3994
3990
|
ut(t) {
|
|
3995
|
-
return
|
|
3991
|
+
return Gn(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
|
|
3996
3992
|
}
|
|
3997
3993
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
3998
3994
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
@@ -4004,19 +4000,19 @@ function An(t) {
|
|
|
4004
4000
|
}
|
|
4005
4001
|
st(t) {
|
|
4006
4002
|
if (0 === t.length) throw this.ut("Document fields must not be empty");
|
|
4007
|
-
if (
|
|
4003
|
+
if (In(this.tt) && bn.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
|
|
4008
4004
|
}
|
|
4009
4005
|
}
|
|
4010
4006
|
|
|
4011
4007
|
/**
|
|
4012
4008
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
4013
4009
|
* classes.
|
|
4014
|
-
*/ class
|
|
4010
|
+
*/ class Rn {
|
|
4015
4011
|
constructor(t, e, n) {
|
|
4016
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n ||
|
|
4012
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n || We(t);
|
|
4017
4013
|
}
|
|
4018
4014
|
/** Creates a new top-level parse context. */ ht(t, e, n, r = !1) {
|
|
4019
|
-
return new
|
|
4015
|
+
return new An({
|
|
4020
4016
|
tt: t,
|
|
4021
4017
|
methodName: e,
|
|
4022
4018
|
at: n,
|
|
@@ -4027,29 +4023,29 @@ function An(t) {
|
|
|
4027
4023
|
}
|
|
4028
4024
|
}
|
|
4029
4025
|
|
|
4030
|
-
function
|
|
4031
|
-
const e = t._freezeSettings(), n =
|
|
4032
|
-
return new
|
|
4026
|
+
function Pn(t) {
|
|
4027
|
+
const e = t._freezeSettings(), n = We(t._databaseId);
|
|
4028
|
+
return new Rn(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
4033
4029
|
}
|
|
4034
4030
|
|
|
4035
|
-
/** Parse document data from a set() call. */ function
|
|
4031
|
+
/** Parse document data from a set() call. */ function Vn(t, e, n, r, s, i = {}) {
|
|
4036
4032
|
const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, s);
|
|
4037
|
-
|
|
4038
|
-
const u =
|
|
4033
|
+
jn("Data must be an object, but it was:", o, r);
|
|
4034
|
+
const u = Un(r, o);
|
|
4039
4035
|
let c, a;
|
|
4040
4036
|
if (i.merge) c = new Tt(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
|
|
4041
4037
|
const t = [];
|
|
4042
4038
|
for (const r of i.mergeFields) {
|
|
4043
|
-
const s =
|
|
4039
|
+
const s = Mn(e, r, n);
|
|
4044
4040
|
if (!o.contains(s)) throw new U(A, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4045
|
-
|
|
4041
|
+
Qn(t, s) || t.push(s);
|
|
4046
4042
|
}
|
|
4047
4043
|
c = new Tt(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4048
4044
|
} else c = null, a = o.fieldTransforms;
|
|
4049
|
-
return new
|
|
4045
|
+
return new En(new Bt(u), c, a);
|
|
4050
4046
|
}
|
|
4051
4047
|
|
|
4052
|
-
class
|
|
4048
|
+
class Dn extends gn {
|
|
4053
4049
|
_toFieldTransform(t) {
|
|
4054
4050
|
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}`);
|
|
4055
4051
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4057,7 +4053,7 @@ class Nn extends vn {
|
|
|
4057
4053
|
return t.fieldMask.push(t.path), null;
|
|
4058
4054
|
}
|
|
4059
4055
|
isEqual(t) {
|
|
4060
|
-
return t instanceof
|
|
4056
|
+
return t instanceof Dn;
|
|
4061
4057
|
}
|
|
4062
4058
|
}
|
|
4063
4059
|
|
|
@@ -4076,8 +4072,8 @@ class Nn extends vn {
|
|
|
4076
4072
|
* context.
|
|
4077
4073
|
* @param context - The parent context.
|
|
4078
4074
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4079
|
-
*/ function
|
|
4080
|
-
return new
|
|
4075
|
+
*/ function Nn(t, e, n) {
|
|
4076
|
+
return new An({
|
|
4081
4077
|
tt: 3 /* Argument */ ,
|
|
4082
4078
|
at: e.settings.at,
|
|
4083
4079
|
methodName: t._methodName,
|
|
@@ -4085,23 +4081,23 @@ class Nn extends vn {
|
|
|
4085
4081
|
}, e.databaseId, e.q, e.ignoreUndefinedProperties);
|
|
4086
4082
|
}
|
|
4087
4083
|
|
|
4088
|
-
class
|
|
4084
|
+
class $n extends gn {
|
|
4089
4085
|
_toFieldTransform(t) {
|
|
4090
|
-
return new
|
|
4086
|
+
return new ge(t.path, new me);
|
|
4091
4087
|
}
|
|
4092
4088
|
isEqual(t) {
|
|
4093
|
-
return t instanceof
|
|
4089
|
+
return t instanceof $n;
|
|
4094
4090
|
}
|
|
4095
4091
|
}
|
|
4096
4092
|
|
|
4097
|
-
class
|
|
4093
|
+
class Sn extends gn {
|
|
4098
4094
|
constructor(t, e) {
|
|
4099
4095
|
super(t), this.lt = e;
|
|
4100
4096
|
}
|
|
4101
4097
|
_toFieldTransform(t) {
|
|
4102
|
-
const e =
|
|
4103
|
-
/*array=*/ !0), n = this.lt.map((t =>
|
|
4104
|
-
return new
|
|
4098
|
+
const e = Nn(this, t,
|
|
4099
|
+
/*array=*/ !0), n = this.lt.map((t => Ln(t, e))), r = new pe(n);
|
|
4100
|
+
return new ge(t.path, r);
|
|
4105
4101
|
}
|
|
4106
4102
|
isEqual(t) {
|
|
4107
4103
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4109,14 +4105,14 @@ class Fn extends vn {
|
|
|
4109
4105
|
}
|
|
4110
4106
|
}
|
|
4111
4107
|
|
|
4112
|
-
class
|
|
4108
|
+
class Fn extends gn {
|
|
4113
4109
|
constructor(t, e) {
|
|
4114
4110
|
super(t), this.lt = e;
|
|
4115
4111
|
}
|
|
4116
4112
|
_toFieldTransform(t) {
|
|
4117
|
-
const e =
|
|
4118
|
-
/*array=*/ !0), n = this.lt.map((t =>
|
|
4119
|
-
return new
|
|
4113
|
+
const e = Nn(this, t,
|
|
4114
|
+
/*array=*/ !0), n = this.lt.map((t => Ln(t, e))), r = new ye(n);
|
|
4115
|
+
return new ge(t.path, r);
|
|
4120
4116
|
}
|
|
4121
4117
|
isEqual(t) {
|
|
4122
4118
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4124,13 +4120,13 @@ class xn extends vn {
|
|
|
4124
4120
|
}
|
|
4125
4121
|
}
|
|
4126
4122
|
|
|
4127
|
-
class
|
|
4123
|
+
class xn extends gn {
|
|
4128
4124
|
constructor(t, e) {
|
|
4129
4125
|
super(t), this.ft = e;
|
|
4130
4126
|
}
|
|
4131
4127
|
_toFieldTransform(t) {
|
|
4132
|
-
const e = new
|
|
4133
|
-
return new
|
|
4128
|
+
const e = new _e(t.q, de(t.q, this.ft));
|
|
4129
|
+
return new ge(t.path, e);
|
|
4134
4130
|
}
|
|
4135
4131
|
isEqual(t) {
|
|
4136
4132
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4138,50 +4134,50 @@ class qn extends vn {
|
|
|
4138
4134
|
}
|
|
4139
4135
|
}
|
|
4140
4136
|
|
|
4141
|
-
/** Parse update data from an update() call. */ function
|
|
4137
|
+
/** Parse update data from an update() call. */ function qn(t, e, n, r) {
|
|
4142
4138
|
const s = t.ht(1 /* Update */ , e, n);
|
|
4143
|
-
|
|
4139
|
+
jn("Data must be an object, but it was:", s, r);
|
|
4144
4140
|
const i = [], o = Bt.empty();
|
|
4145
4141
|
Et(r, ((t, r) => {
|
|
4146
|
-
const u =
|
|
4142
|
+
const u = zn(e, t, n);
|
|
4147
4143
|
// For Compat types, we have to "extract" the underlying types before
|
|
4148
4144
|
// performing validation.
|
|
4149
4145
|
r = getModularInstance(r);
|
|
4150
4146
|
const c = s.it(u);
|
|
4151
|
-
if (r instanceof
|
|
4147
|
+
if (r instanceof Dn)
|
|
4152
4148
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4153
4149
|
i.push(u); else {
|
|
4154
|
-
const t =
|
|
4150
|
+
const t = Ln(r, c);
|
|
4155
4151
|
null != t && (i.push(u), o.set(u, t));
|
|
4156
4152
|
}
|
|
4157
4153
|
}));
|
|
4158
4154
|
const u = new Tt(i);
|
|
4159
|
-
return new
|
|
4155
|
+
return new Tn(o, u, s.fieldTransforms);
|
|
4160
4156
|
}
|
|
4161
4157
|
|
|
4162
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
4163
|
-
const o = t.ht(1 /* Update */ , e, n), u = [
|
|
4158
|
+
/** Parse update data from a list of field/value arguments. */ function On(t, e, n, r, s, i) {
|
|
4159
|
+
const o = t.ht(1 /* Update */ , e, n), u = [ Mn(e, r, n) ], c = [ s ];
|
|
4164
4160
|
if (i.length % 2 != 0) throw new U(A, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4165
|
-
for (let t = 0; t < i.length; t += 2) u.push(
|
|
4161
|
+
for (let t = 0; t < i.length; t += 2) u.push(Mn(e, i[t])), c.push(i[t + 1]);
|
|
4166
4162
|
const a = [], l = Bt.empty();
|
|
4167
4163
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4168
4164
|
// user specified the field multiple times.
|
|
4169
|
-
for (let t = u.length - 1; t >= 0; --t) if (!
|
|
4165
|
+
for (let t = u.length - 1; t >= 0; --t) if (!Qn(a, u[t])) {
|
|
4170
4166
|
const e = u[t];
|
|
4171
4167
|
let n = c[t];
|
|
4172
4168
|
// For Compat types, we have to "extract" the underlying types before
|
|
4173
4169
|
// performing validation.
|
|
4174
4170
|
n = getModularInstance(n);
|
|
4175
4171
|
const r = o.it(e);
|
|
4176
|
-
if (n instanceof
|
|
4172
|
+
if (n instanceof Dn)
|
|
4177
4173
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4178
4174
|
a.push(e); else {
|
|
4179
|
-
const t =
|
|
4175
|
+
const t = Ln(n, r);
|
|
4180
4176
|
null != t && (a.push(e), l.set(e, t));
|
|
4181
4177
|
}
|
|
4182
4178
|
}
|
|
4183
4179
|
const f = new Tt(a);
|
|
4184
|
-
return new
|
|
4180
|
+
return new Tn(l, f, o.fieldTransforms);
|
|
4185
4181
|
}
|
|
4186
4182
|
|
|
4187
4183
|
/**
|
|
@@ -4190,8 +4186,8 @@ class qn extends vn {
|
|
|
4190
4186
|
*
|
|
4191
4187
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4192
4188
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4193
|
-
*/ function
|
|
4194
|
-
return
|
|
4189
|
+
*/ function Cn(t, e, n, r = !1) {
|
|
4190
|
+
return Ln(n, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
4195
4191
|
}
|
|
4196
4192
|
|
|
4197
4193
|
/**
|
|
@@ -4202,12 +4198,12 @@ class qn extends vn {
|
|
|
4202
4198
|
* the source of the data being parsed, etc.
|
|
4203
4199
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
4204
4200
|
* that should not be included in the resulting parsed data.
|
|
4205
|
-
*/ function
|
|
4206
|
-
if (
|
|
4201
|
+
*/ function Ln(t, e) {
|
|
4202
|
+
if (kn(
|
|
4207
4203
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4208
4204
|
// from firestore-exp.
|
|
4209
|
-
t = getModularInstance(t))) return
|
|
4210
|
-
if (t instanceof
|
|
4205
|
+
t = getModularInstance(t))) return jn("Unsupported field value:", e, t), Un(t, e);
|
|
4206
|
+
if (t instanceof gn)
|
|
4211
4207
|
// FieldValues usually parse into transforms (except deleteField())
|
|
4212
4208
|
// in which case we do not want to include this field in our parsed data
|
|
4213
4209
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -4219,7 +4215,7 @@ class qn extends vn {
|
|
|
4219
4215
|
*/
|
|
4220
4216
|
return function(t, e) {
|
|
4221
4217
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4222
|
-
if (!
|
|
4218
|
+
if (!In(e.tt)) throw e.ut(`${t._methodName}() can only be used with update() and set()`);
|
|
4223
4219
|
if (!e.path) throw e.ut(`${t._methodName}() is not currently supported inside arrays`);
|
|
4224
4220
|
const n = t._toFieldTransform(e);
|
|
4225
4221
|
n && e.fieldTransforms.push(n);
|
|
@@ -4249,7 +4245,7 @@ class qn extends vn {
|
|
|
4249
4245
|
const n = [];
|
|
4250
4246
|
let r = 0;
|
|
4251
4247
|
for (const s of t) {
|
|
4252
|
-
let t =
|
|
4248
|
+
let t = Ln(s, e.ot(r));
|
|
4253
4249
|
null == t && (
|
|
4254
4250
|
// Just include nulls in the array for fields being replaced with a
|
|
4255
4251
|
// sentinel.
|
|
@@ -4268,7 +4264,7 @@ class qn extends vn {
|
|
|
4268
4264
|
if (null === (t = getModularInstance(t))) return {
|
|
4269
4265
|
nullValue: "NULL_VALUE"
|
|
4270
4266
|
};
|
|
4271
|
-
if ("number" == typeof t) return
|
|
4267
|
+
if ("number" == typeof t) return de(e.q, t);
|
|
4272
4268
|
if ("boolean" == typeof t) return {
|
|
4273
4269
|
booleanValue: t
|
|
4274
4270
|
};
|
|
@@ -4278,7 +4274,7 @@ class qn extends vn {
|
|
|
4278
4274
|
if (t instanceof Date) {
|
|
4279
4275
|
const n = gt.fromDate(t);
|
|
4280
4276
|
return {
|
|
4281
|
-
timestampValue:
|
|
4277
|
+
timestampValue: De(e.q, n)
|
|
4282
4278
|
};
|
|
4283
4279
|
}
|
|
4284
4280
|
if (t instanceof gt) {
|
|
@@ -4287,23 +4283,23 @@ class qn extends vn {
|
|
|
4287
4283
|
// truncation immediately without waiting for the backend to do that.
|
|
4288
4284
|
const n = new gt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
4289
4285
|
return {
|
|
4290
|
-
timestampValue:
|
|
4286
|
+
timestampValue: De(e.q, n)
|
|
4291
4287
|
};
|
|
4292
4288
|
}
|
|
4293
|
-
if (t instanceof
|
|
4289
|
+
if (t instanceof vn) return {
|
|
4294
4290
|
geoPointValue: {
|
|
4295
4291
|
latitude: t.latitude,
|
|
4296
4292
|
longitude: t.longitude
|
|
4297
4293
|
}
|
|
4298
4294
|
};
|
|
4299
|
-
if (t instanceof
|
|
4300
|
-
bytesValue:
|
|
4295
|
+
if (t instanceof _n) return {
|
|
4296
|
+
bytesValue: Ne(e.q, t._byteString)
|
|
4301
4297
|
};
|
|
4302
|
-
if (t instanceof
|
|
4298
|
+
if (t instanceof cn) {
|
|
4303
4299
|
const n = e.databaseId, r = t.firestore._databaseId;
|
|
4304
4300
|
if (!r.isEqual(n)) throw e.ut(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);
|
|
4305
4301
|
return {
|
|
4306
|
-
referenceValue:
|
|
4302
|
+
referenceValue: Fe(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
4307
4303
|
};
|
|
4308
4304
|
}
|
|
4309
4305
|
throw e.ut(`Unsupported field value: ${it(t)}`);
|
|
@@ -4317,13 +4313,13 @@ class qn extends vn {
|
|
|
4317
4313
|
*/ (t, e);
|
|
4318
4314
|
}
|
|
4319
4315
|
|
|
4320
|
-
function
|
|
4316
|
+
function Un(t, e) {
|
|
4321
4317
|
const n = {};
|
|
4322
4318
|
return !function(t) {
|
|
4323
4319
|
for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
4324
4320
|
return !0;
|
|
4325
4321
|
}(t) ? Et(t, ((t, r) => {
|
|
4326
|
-
const s =
|
|
4322
|
+
const s = Ln(r, e.nt(t));
|
|
4327
4323
|
null != s && (n[t] = s);
|
|
4328
4324
|
})) :
|
|
4329
4325
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -4335,12 +4331,12 @@ function kn(t, e) {
|
|
|
4335
4331
|
};
|
|
4336
4332
|
}
|
|
4337
4333
|
|
|
4338
|
-
function
|
|
4339
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof
|
|
4334
|
+
function kn(t) {
|
|
4335
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof vn || t instanceof _n || t instanceof cn || t instanceof gn);
|
|
4340
4336
|
}
|
|
4341
4337
|
|
|
4342
|
-
function
|
|
4343
|
-
if (!
|
|
4338
|
+
function jn(t, e, n) {
|
|
4339
|
+
if (!kn(n) || !function(t) {
|
|
4344
4340
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4345
4341
|
}(n)) {
|
|
4346
4342
|
const r = it(n);
|
|
@@ -4350,20 +4346,20 @@ function Mn(t, e, n) {
|
|
|
4350
4346
|
|
|
4351
4347
|
/**
|
|
4352
4348
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
4353
|
-
*/ function
|
|
4349
|
+
*/ function Mn(t, e, n) {
|
|
4354
4350
|
if ((
|
|
4355
4351
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
4356
4352
|
// FieldPath.
|
|
4357
|
-
e = getModularInstance(e)) instanceof
|
|
4358
|
-
if ("string" == typeof e) return
|
|
4359
|
-
throw
|
|
4353
|
+
e = getModularInstance(e)) instanceof pn) return e._internalPath;
|
|
4354
|
+
if ("string" == typeof e) return zn(t, e);
|
|
4355
|
+
throw Gn("Field path arguments must be of type string or ", t,
|
|
4360
4356
|
/* hasConverter= */ !1,
|
|
4361
4357
|
/* path= */ void 0, n);
|
|
4362
4358
|
}
|
|
4363
4359
|
|
|
4364
4360
|
/**
|
|
4365
4361
|
* Matches any characters in a field path string that are reserved.
|
|
4366
|
-
*/ const
|
|
4362
|
+
*/ const Bn = new RegExp("[~\\*/\\[\\]]");
|
|
4367
4363
|
|
|
4368
4364
|
/**
|
|
4369
4365
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -4373,20 +4369,20 @@ function Mn(t, e, n) {
|
|
|
4373
4369
|
* split on dots.
|
|
4374
4370
|
* @param targetDoc - The document against which the field path will be
|
|
4375
4371
|
* evaluated.
|
|
4376
|
-
*/ function
|
|
4377
|
-
if (e.search(
|
|
4372
|
+
*/ function zn(t, e, n) {
|
|
4373
|
+
if (e.search(Bn) >= 0) throw Gn(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
4378
4374
|
/* hasConverter= */ !1,
|
|
4379
4375
|
/* path= */ void 0, n);
|
|
4380
4376
|
try {
|
|
4381
|
-
return new
|
|
4377
|
+
return new pn(...e.split("."))._internalPath;
|
|
4382
4378
|
} catch (r) {
|
|
4383
|
-
throw
|
|
4379
|
+
throw Gn(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
4384
4380
|
/* hasConverter= */ !1,
|
|
4385
4381
|
/* path= */ void 0, n);
|
|
4386
4382
|
}
|
|
4387
4383
|
}
|
|
4388
4384
|
|
|
4389
|
-
function
|
|
4385
|
+
function Gn(t, e, n, r, s) {
|
|
4390
4386
|
const i = r && !r.isEmpty(), o = void 0 !== s;
|
|
4391
4387
|
let u = `Function ${e}() called with invalid data`;
|
|
4392
4388
|
n && (u += " (via `toFirestore()`)"), u += ". ";
|
|
@@ -4395,7 +4391,7 @@ function Qn(t, e, n, r, s) {
|
|
|
4395
4391
|
c += ")"), new U(A, u + t + c);
|
|
4396
4392
|
}
|
|
4397
4393
|
|
|
4398
|
-
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function
|
|
4394
|
+
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Qn(t, e) {
|
|
4399
4395
|
return t.some((t => t.isEqual(e)));
|
|
4400
4396
|
}
|
|
4401
4397
|
|
|
@@ -4423,7 +4419,7 @@ function Qn(t, e, n, r, s) {
|
|
|
4423
4419
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
4424
4420
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
4425
4421
|
* explicitly verify a document's existence.
|
|
4426
|
-
*/ class
|
|
4422
|
+
*/ class Wn {
|
|
4427
4423
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
4428
4424
|
// the legacy SDK. The changes are:
|
|
4429
4425
|
// - No support for SnapshotMetadata.
|
|
@@ -4439,7 +4435,7 @@ function Qn(t, e, n, r, s) {
|
|
|
4439
4435
|
/**
|
|
4440
4436
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
4441
4437
|
*/ get ref() {
|
|
4442
|
-
return new
|
|
4438
|
+
return new cn(this._firestore, this._converter, this._key);
|
|
4443
4439
|
}
|
|
4444
4440
|
/**
|
|
4445
4441
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -4459,7 +4455,7 @@ function Qn(t, e, n, r, s) {
|
|
|
4459
4455
|
if (this._converter) {
|
|
4460
4456
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
4461
4457
|
// if a converter has been provided.
|
|
4462
|
-
const t = new
|
|
4458
|
+
const t = new Yn(this._firestore, this._userDataWriter, this._key, this._document,
|
|
4463
4459
|
/* converter= */ null);
|
|
4464
4460
|
return this._converter.fromFirestore(t);
|
|
4465
4461
|
}
|
|
@@ -4479,7 +4475,7 @@ function Qn(t, e, n, r, s) {
|
|
|
4479
4475
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4480
4476
|
get(t) {
|
|
4481
4477
|
if (this._document) {
|
|
4482
|
-
const e = this._document.data.field(
|
|
4478
|
+
const e = this._document.data.field(Jn("DocumentSnapshot.get", t));
|
|
4483
4479
|
if (null !== e) return this._userDataWriter.convertValue(e);
|
|
4484
4480
|
}
|
|
4485
4481
|
}
|
|
@@ -4495,7 +4491,7 @@ function Qn(t, e, n, r, s) {
|
|
|
4495
4491
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
4496
4492
|
* `exists` property will always be true and `data()` will never return
|
|
4497
4493
|
* 'undefined'.
|
|
4498
|
-
*/ class
|
|
4494
|
+
*/ class Yn extends Wn {
|
|
4499
4495
|
/**
|
|
4500
4496
|
* Retrieves all fields in the document as an `Object`.
|
|
4501
4497
|
*
|
|
@@ -4513,7 +4509,7 @@ function Qn(t, e, n, r, s) {
|
|
|
4513
4509
|
* array via the `docs` property or enumerated using the `forEach` method. The
|
|
4514
4510
|
* number of documents can be determined via the `empty` and `size`
|
|
4515
4511
|
* properties.
|
|
4516
|
-
*/ class
|
|
4512
|
+
*/ class Hn {
|
|
4517
4513
|
/** @hideconstructor */
|
|
4518
4514
|
constructor(t, e) {
|
|
4519
4515
|
this._docs = e, this.query = t;
|
|
@@ -4544,14 +4540,14 @@ function Qn(t, e, n, r, s) {
|
|
|
4544
4540
|
* @param left - A snapshot to compare.
|
|
4545
4541
|
* @param right - A snapshot to compare.
|
|
4546
4542
|
* @returns true if the snapshots are equal.
|
|
4547
|
-
*/ function
|
|
4548
|
-
return t = getModularInstance(t), e = getModularInstance(e), t instanceof
|
|
4543
|
+
*/ function Kn(t, e) {
|
|
4544
|
+
return t = getModularInstance(t), e = getModularInstance(e), t instanceof Wn && e instanceof Wn ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof Hn && e instanceof Hn && (mn(t.query, e.query) && _t(t.docs, e.docs, Kn));
|
|
4549
4545
|
}
|
|
4550
4546
|
|
|
4551
4547
|
/**
|
|
4552
4548
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
4553
|
-
*/ function
|
|
4554
|
-
return "string" == typeof e ?
|
|
4549
|
+
*/ function Jn(t, e) {
|
|
4550
|
+
return "string" == typeof e ? zn(t, e) : e instanceof pn ? e._internalPath : e._delegate._internalPath;
|
|
4555
4551
|
}
|
|
4556
4552
|
|
|
4557
4553
|
/**
|
|
@@ -4578,7 +4574,7 @@ function Qn(t, e, n, r, s) {
|
|
|
4578
4574
|
* can then be passed to {@link query} to create a new query instance that
|
|
4579
4575
|
* also contains this `QueryConstraint`.
|
|
4580
4576
|
*/
|
|
4581
|
-
class
|
|
4577
|
+
class Xn {}
|
|
4582
4578
|
|
|
4583
4579
|
/**
|
|
4584
4580
|
* Creates a new immutable instance of {@link Query} that is extended to also include
|
|
@@ -4588,40 +4584,40 @@ class Zn {}
|
|
|
4588
4584
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
4589
4585
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
4590
4586
|
* existing or new constraints.
|
|
4591
|
-
*/ function
|
|
4587
|
+
*/ function Zn(t, ...e) {
|
|
4592
4588
|
for (const n of e) t = n._apply(t);
|
|
4593
4589
|
return t;
|
|
4594
4590
|
}
|
|
4595
4591
|
|
|
4596
|
-
class
|
|
4592
|
+
class tr extends Xn {
|
|
4597
4593
|
constructor(t, e, n) {
|
|
4598
4594
|
super(), this.dt = t, this.wt = e, this.yt = n, this.type = "where";
|
|
4599
4595
|
}
|
|
4600
4596
|
_apply(t) {
|
|
4601
|
-
const e =
|
|
4597
|
+
const e = Pn(t.firestore), n = function(t, e, n, r, s, i, o) {
|
|
4602
4598
|
let u;
|
|
4603
4599
|
if (s.isKeyField()) {
|
|
4604
4600
|
if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(A, `Invalid Query. You can't perform '${i}' queries on documentId().`);
|
|
4605
4601
|
if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
|
|
4606
|
-
|
|
4602
|
+
mr(o, i);
|
|
4607
4603
|
const e = [];
|
|
4608
|
-
for (const n of o) e.push(
|
|
4604
|
+
for (const n of o) e.push(wr(r, t, n));
|
|
4609
4605
|
u = {
|
|
4610
4606
|
arrayValue: {
|
|
4611
4607
|
values: e
|
|
4612
4608
|
}
|
|
4613
4609
|
};
|
|
4614
|
-
} else u =
|
|
4615
|
-
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i ||
|
|
4616
|
-
u =
|
|
4610
|
+
} else u = wr(r, t, o);
|
|
4611
|
+
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || mr(o, i),
|
|
4612
|
+
u = Cn(n, e, o,
|
|
4617
4613
|
/* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
|
|
4618
4614
|
const c = Wt.create(s, i, u);
|
|
4619
4615
|
return function(t, e) {
|
|
4620
4616
|
if (e.N()) {
|
|
4621
|
-
const n =
|
|
4617
|
+
const n = ce(t);
|
|
4622
4618
|
if (null !== n && !n.isEqual(e.field)) throw new U(A, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${e.field.toString()}'`);
|
|
4623
|
-
const r =
|
|
4624
|
-
null !== r &&
|
|
4619
|
+
const r = ue(t);
|
|
4620
|
+
null !== r && pr(t, e.field, r);
|
|
4625
4621
|
}
|
|
4626
4622
|
const n = function(t, e) {
|
|
4627
4623
|
for (const n of t.filters) if (e.indexOf(n.op) >= 0) return n.op;
|
|
@@ -4665,7 +4661,7 @@ class er extends Zn {
|
|
|
4665
4661
|
throw n === e.op ? new U(A, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new U(A, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
4666
4662
|
}(t, c), c;
|
|
4667
4663
|
}(t._query, "where", e, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
4668
|
-
return new
|
|
4664
|
+
return new an(t.firestore, t.converter, function(t, e) {
|
|
4669
4665
|
const n = t.filters.concat([ e ]);
|
|
4670
4666
|
return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
4671
4667
|
}(t._query, n));
|
|
@@ -4682,12 +4678,12 @@ class er extends Zn {
|
|
|
4682
4678
|
* "<=", "!=").
|
|
4683
4679
|
* @param value - The value for comparison
|
|
4684
4680
|
* @returns The created {@link Query}.
|
|
4685
|
-
*/ function
|
|
4686
|
-
const r = e, s =
|
|
4687
|
-
return new
|
|
4681
|
+
*/ function er(t, e, n) {
|
|
4682
|
+
const r = e, s = Jn("where", t);
|
|
4683
|
+
return new tr(s, r, n);
|
|
4688
4684
|
}
|
|
4689
4685
|
|
|
4690
|
-
class
|
|
4686
|
+
class nr extends Xn {
|
|
4691
4687
|
constructor(t, e) {
|
|
4692
4688
|
super(), this.dt = t, this._t = e, this.type = "orderBy";
|
|
4693
4689
|
}
|
|
@@ -4697,10 +4693,10 @@ class rr extends Zn {
|
|
|
4697
4693
|
if (null !== t.endAt) throw new U(A, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
4698
4694
|
const r = new re(e, n);
|
|
4699
4695
|
return function(t, e) {
|
|
4700
|
-
if (null ===
|
|
4696
|
+
if (null === ue(t)) {
|
|
4701
4697
|
// This is the first order by. It must match any inequality.
|
|
4702
|
-
const n =
|
|
4703
|
-
null !== n &&
|
|
4698
|
+
const n = ce(t);
|
|
4699
|
+
null !== n && pr(t, n, e.field);
|
|
4704
4700
|
}
|
|
4705
4701
|
}(t, r), r;
|
|
4706
4702
|
}
|
|
@@ -4715,7 +4711,7 @@ class rr extends Zn {
|
|
|
4715
4711
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
4716
4712
|
* server timestamp.
|
|
4717
4713
|
*/ (t._query, this.dt, this._t);
|
|
4718
|
-
return new
|
|
4714
|
+
return new an(t.firestore, t.converter, function(t, e) {
|
|
4719
4715
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4720
4716
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
4721
4717
|
return new oe(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -4731,17 +4727,17 @@ class rr extends Zn {
|
|
|
4731
4727
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
4732
4728
|
* not specified, order will be ascending.
|
|
4733
4729
|
* @returns The created {@link Query}.
|
|
4734
|
-
*/ function
|
|
4735
|
-
const n = e, r =
|
|
4736
|
-
return new
|
|
4730
|
+
*/ function rr(t, e = "asc") {
|
|
4731
|
+
const n = e, r = Jn("orderBy", t);
|
|
4732
|
+
return new nr(r, n);
|
|
4737
4733
|
}
|
|
4738
4734
|
|
|
4739
|
-
class
|
|
4735
|
+
class sr extends Xn {
|
|
4740
4736
|
constructor(t, e, n) {
|
|
4741
4737
|
super(), this.type = t, this.gt = e, this.vt = n;
|
|
4742
4738
|
}
|
|
4743
4739
|
_apply(t) {
|
|
4744
|
-
return new
|
|
4740
|
+
return new an(t.firestore, t.converter, function(t, e, n) {
|
|
4745
4741
|
return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
4746
4742
|
}(t._query, this.gt, this.vt));
|
|
4747
4743
|
}
|
|
@@ -4752,8 +4748,8 @@ class ir extends Zn {
|
|
|
4752
4748
|
*
|
|
4753
4749
|
* @param limit - The maximum number of items to return.
|
|
4754
4750
|
* @returns The created {@link Query}.
|
|
4755
|
-
*/ function
|
|
4756
|
-
return ut("limit", t), new
|
|
4751
|
+
*/ function ir(t) {
|
|
4752
|
+
return ut("limit", t), new sr("limit", t, "F" /* First */);
|
|
4757
4753
|
}
|
|
4758
4754
|
|
|
4759
4755
|
/**
|
|
@@ -4764,55 +4760,55 @@ class ir extends Zn {
|
|
|
4764
4760
|
*
|
|
4765
4761
|
* @param limit - The maximum number of items to return.
|
|
4766
4762
|
* @returns The created {@link Query}.
|
|
4767
|
-
*/ function
|
|
4768
|
-
return ut("limitToLast", t), new
|
|
4763
|
+
*/ function or(t) {
|
|
4764
|
+
return ut("limitToLast", t), new sr("limitToLast", t, "L" /* Last */);
|
|
4769
4765
|
}
|
|
4770
4766
|
|
|
4771
|
-
class
|
|
4767
|
+
class ur extends Xn {
|
|
4772
4768
|
constructor(t, e, n) {
|
|
4773
4769
|
super(), this.type = t, this.bt = e, this.Et = n;
|
|
4774
4770
|
}
|
|
4775
4771
|
_apply(t) {
|
|
4776
|
-
const e =
|
|
4777
|
-
return new
|
|
4772
|
+
const e = dr(t, this.type, this.bt, this.Et);
|
|
4773
|
+
return new an(t.firestore, t.converter, function(t, e) {
|
|
4778
4774
|
return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
4779
4775
|
}(t._query, e));
|
|
4780
4776
|
}
|
|
4781
4777
|
}
|
|
4782
4778
|
|
|
4783
|
-
function
|
|
4784
|
-
return new
|
|
4779
|
+
function cr(...t) {
|
|
4780
|
+
return new ur("startAt", t,
|
|
4785
4781
|
/*inclusive=*/ !0);
|
|
4786
4782
|
}
|
|
4787
4783
|
|
|
4788
|
-
function
|
|
4789
|
-
return new
|
|
4784
|
+
function ar(...t) {
|
|
4785
|
+
return new ur("startAfter", t,
|
|
4790
4786
|
/*inclusive=*/ !1);
|
|
4791
4787
|
}
|
|
4792
4788
|
|
|
4793
|
-
class
|
|
4789
|
+
class hr extends Xn {
|
|
4794
4790
|
constructor(t, e, n) {
|
|
4795
4791
|
super(), this.type = t, this.bt = e, this.Et = n;
|
|
4796
4792
|
}
|
|
4797
4793
|
_apply(t) {
|
|
4798
|
-
const e =
|
|
4799
|
-
return new
|
|
4794
|
+
const e = dr(t, this.type, this.bt, this.Et);
|
|
4795
|
+
return new an(t.firestore, t.converter, function(t, e) {
|
|
4800
4796
|
return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
4801
4797
|
}(t._query, e));
|
|
4802
4798
|
}
|
|
4803
4799
|
}
|
|
4804
4800
|
|
|
4805
|
-
function
|
|
4806
|
-
return new
|
|
4801
|
+
function lr(...t) {
|
|
4802
|
+
return new hr("endBefore", t,
|
|
4807
4803
|
/*inclusive=*/ !1);
|
|
4808
4804
|
}
|
|
4809
4805
|
|
|
4810
|
-
function
|
|
4811
|
-
return new
|
|
4806
|
+
function fr(...t) {
|
|
4807
|
+
return new hr("endAt", t, /*inclusive=*/ !0);
|
|
4812
4808
|
}
|
|
4813
4809
|
|
|
4814
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
4815
|
-
if (n[0] = getModularInstance(n[0]), n[0] instanceof
|
|
4810
|
+
/** Helper function to create a bound from a document or fields */ function dr(t, e, n, r) {
|
|
4811
|
+
if (n[0] = getModularInstance(n[0]), n[0] instanceof Wn) return function(t, e, n, r, s) {
|
|
4816
4812
|
if (!r) throw new U(P, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
|
|
4817
4813
|
const i = [];
|
|
4818
4814
|
// Because people expect to continue/end a query at the exact document
|
|
@@ -4822,7 +4818,7 @@ function dr(...t) {
|
|
|
4822
4818
|
// the provided document. Without the key (by using the explicit sort
|
|
4823
4819
|
// orders), multiple documents could match the position, yielding duplicate
|
|
4824
4820
|
// results.
|
|
4825
|
-
for (const n of
|
|
4821
|
+
for (const n of he(t)) if (n.field.isKeyField()) i.push(Ct(e, r.key)); else {
|
|
4826
4822
|
const t = r.data.field(n.field);
|
|
4827
4823
|
if (Dt(t)) throw new U(A, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
4828
4824
|
if (null === t) {
|
|
@@ -4837,7 +4833,7 @@ function dr(...t) {
|
|
|
4837
4833
|
* Converts a list of field values to a `Bound` for the given query.
|
|
4838
4834
|
*/ (t._query, t.firestore._databaseId, e, n[0]._document, r);
|
|
4839
4835
|
{
|
|
4840
|
-
const s =
|
|
4836
|
+
const s = Pn(t.firestore);
|
|
4841
4837
|
return function(t, e, n, r, s, i) {
|
|
4842
4838
|
// Use explicit order by's because it has to match the query the user made
|
|
4843
4839
|
const o = t.explicitOrderBy;
|
|
@@ -4847,13 +4843,13 @@ function dr(...t) {
|
|
|
4847
4843
|
const c = s[i];
|
|
4848
4844
|
if (o[i].field.isKeyField()) {
|
|
4849
4845
|
if ("string" != typeof c) throw new U(A, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
|
|
4850
|
-
if (!
|
|
4846
|
+
if (!ae(t) && -1 !== c.indexOf("/")) throw new U(A, `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.`);
|
|
4851
4847
|
const n = t.path.child(X.fromString(c));
|
|
4852
4848
|
if (!et.isDocumentKey(n)) throw new U(A, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
|
|
4853
4849
|
const s = new et(n);
|
|
4854
4850
|
u.push(Ct(e, s));
|
|
4855
4851
|
} else {
|
|
4856
|
-
const t =
|
|
4852
|
+
const t = Cn(n, r, c);
|
|
4857
4853
|
u.push(t);
|
|
4858
4854
|
}
|
|
4859
4855
|
}
|
|
@@ -4867,27 +4863,27 @@ function dr(...t) {
|
|
|
4867
4863
|
}
|
|
4868
4864
|
}
|
|
4869
4865
|
|
|
4870
|
-
function
|
|
4866
|
+
function wr(t, e, n) {
|
|
4871
4867
|
if ("string" == typeof (n = getModularInstance(n))) {
|
|
4872
4868
|
if ("" === n) throw new U(A, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
4873
|
-
if (!
|
|
4869
|
+
if (!ae(e) && -1 !== n.indexOf("/")) throw new U(A, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
4874
4870
|
const r = e.path.child(X.fromString(n));
|
|
4875
4871
|
if (!et.isDocumentKey(r)) throw new U(A, `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}).`);
|
|
4876
4872
|
return Ct(t, new et(r));
|
|
4877
4873
|
}
|
|
4878
|
-
if (n instanceof
|
|
4874
|
+
if (n instanceof cn) return Ct(t, n._key);
|
|
4879
4875
|
throw new U(A, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${it(n)}.`);
|
|
4880
4876
|
}
|
|
4881
4877
|
|
|
4882
4878
|
/**
|
|
4883
4879
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
4884
4880
|
* array requirements.
|
|
4885
|
-
*/ function
|
|
4881
|
+
*/ function mr(t, e) {
|
|
4886
4882
|
if (!Array.isArray(t) || 0 === t.length) throw new U(A, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
|
|
4887
4883
|
if (t.length > 10) throw new U(A, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
|
|
4888
4884
|
}
|
|
4889
4885
|
|
|
4890
|
-
function
|
|
4886
|
+
function pr(t, e, n) {
|
|
4891
4887
|
if (!n.isEqual(e)) throw new U(A, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`);
|
|
4892
4888
|
}
|
|
4893
4889
|
|
|
@@ -4938,7 +4934,7 @@ function yr(t, e, n) {
|
|
|
4938
4934
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
4939
4935
|
* call.
|
|
4940
4936
|
*/
|
|
4941
|
-
function
|
|
4937
|
+
function yr(t, e, n) {
|
|
4942
4938
|
let r;
|
|
4943
4939
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
4944
4940
|
// toFirestore().
|
|
@@ -4947,7 +4943,7 @@ function _r(t, e, n) {
|
|
|
4947
4943
|
r;
|
|
4948
4944
|
}
|
|
4949
4945
|
|
|
4950
|
-
class
|
|
4946
|
+
class _r extends class {
|
|
4951
4947
|
convertValue(t, e = "none") {
|
|
4952
4948
|
switch (St(t)) {
|
|
4953
4949
|
case 0 /* NullValue */ :
|
|
@@ -4994,7 +4990,7 @@ class gr extends class {
|
|
|
4994
4990
|
})), n;
|
|
4995
4991
|
}
|
|
4996
4992
|
convertGeoPoint(t) {
|
|
4997
|
-
return new
|
|
4993
|
+
return new vn(Pt(t.latitude), Pt(t.longitude));
|
|
4998
4994
|
}
|
|
4999
4995
|
convertArray(t, e) {
|
|
5000
4996
|
return (t.values || []).map((t => this.convertValue(t, e)));
|
|
@@ -5018,7 +5014,7 @@ class gr extends class {
|
|
|
5018
5014
|
}
|
|
5019
5015
|
convertDocumentKey(t, e) {
|
|
5020
5016
|
const n = X.fromString(t);
|
|
5021
|
-
v(
|
|
5017
|
+
v(Qe(n));
|
|
5022
5018
|
const r = new K(n.get(1), n.get(3)), s = new et(n.popFirst(5));
|
|
5023
5019
|
return r.isEqual(e) ||
|
|
5024
5020
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -5030,11 +5026,11 @@ class gr extends class {
|
|
|
5030
5026
|
super(), this.firestore = t;
|
|
5031
5027
|
}
|
|
5032
5028
|
convertBytes(t) {
|
|
5033
|
-
return new
|
|
5029
|
+
return new _n(t);
|
|
5034
5030
|
}
|
|
5035
5031
|
convertReference(t) {
|
|
5036
5032
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
5037
|
-
return new
|
|
5033
|
+
return new cn(this.firestore, /* converter= */ null, e);
|
|
5038
5034
|
}
|
|
5039
5035
|
}
|
|
5040
5036
|
|
|
@@ -5050,12 +5046,12 @@ class gr extends class {
|
|
|
5050
5046
|
* @param reference - The reference of the document to fetch.
|
|
5051
5047
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
5052
5048
|
* document contents.
|
|
5053
|
-
*/ function
|
|
5054
|
-
const e =
|
|
5055
|
-
return
|
|
5049
|
+
*/ function gr(t) {
|
|
5050
|
+
const e = tn((t = ot(t, cn)).firestore), n = new _r(t.firestore);
|
|
5051
|
+
return Je(e, [ t._key ]).then((e => {
|
|
5056
5052
|
v(1 === e.length);
|
|
5057
5053
|
const r = e[0];
|
|
5058
|
-
return new
|
|
5054
|
+
return new Wn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5059
5055
|
}));
|
|
5060
5056
|
}
|
|
5061
5057
|
|
|
@@ -5070,33 +5066,33 @@ class gr extends class {
|
|
|
5070
5066
|
*
|
|
5071
5067
|
* @param query - The `Query` to execute.
|
|
5072
5068
|
* @returns A Promise that will be resolved with the results of the query.
|
|
5073
|
-
*/ function
|
|
5069
|
+
*/ function vr(t) {
|
|
5074
5070
|
!function(t) {
|
|
5075
|
-
if (
|
|
5076
|
-
}((t = ot(t,
|
|
5077
|
-
const e =
|
|
5078
|
-
return
|
|
5079
|
-
const r = e.map((e => new
|
|
5080
|
-
return
|
|
5071
|
+
if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new U(q, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5072
|
+
}((t = ot(t, an))._query);
|
|
5073
|
+
const e = tn(t.firestore), n = new _r(t.firestore);
|
|
5074
|
+
return Xe(e, t._query).then((e => {
|
|
5075
|
+
const r = e.map((e => new Yn(t.firestore, n, e.key, e, t.converter)));
|
|
5076
|
+
return "L" /* Last */ === t._query.limitType &&
|
|
5081
5077
|
// Limit to last queries reverse the orderBy constraint that was
|
|
5082
5078
|
// specified by the user. As such, we need to reverse the order of the
|
|
5083
5079
|
// results to return the documents in the expected order.
|
|
5084
|
-
r.reverse(), new
|
|
5080
|
+
r.reverse(), new Hn(t, r);
|
|
5085
5081
|
}));
|
|
5086
5082
|
}
|
|
5087
5083
|
|
|
5088
|
-
function
|
|
5089
|
-
const r =
|
|
5090
|
-
return
|
|
5084
|
+
function br(t, e, n) {
|
|
5085
|
+
const r = yr((t = ot(t, cn)).converter, e, n), s = Vn(Pn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
5086
|
+
return Ke(tn(t.firestore), [ s.toMutation(t._key, ve.none()) ]);
|
|
5091
5087
|
}
|
|
5092
5088
|
|
|
5093
|
-
function
|
|
5094
|
-
const s =
|
|
5089
|
+
function Er(t, e, n, ...r) {
|
|
5090
|
+
const s = Pn((t = ot(t, cn)).firestore);
|
|
5095
5091
|
// For Compat types, we have to "extract" the underlying types before
|
|
5096
5092
|
// performing validation.
|
|
5097
5093
|
let i;
|
|
5098
|
-
i = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
5099
|
-
return
|
|
5094
|
+
i = "string" == typeof (e = getModularInstance(e)) || e instanceof pn ? On(s, "updateDoc", t._key, e, n, r) : qn(s, "updateDoc", t._key, e);
|
|
5095
|
+
return Ke(tn(t.firestore), [ i.toMutation(t._key, ve.exists(!0)) ]);
|
|
5100
5096
|
}
|
|
5101
5097
|
|
|
5102
5098
|
/**
|
|
@@ -5110,8 +5106,8 @@ function Tr(t, e, n, ...r) {
|
|
|
5110
5106
|
* @param reference - A reference to the document to delete.
|
|
5111
5107
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5112
5108
|
* deleted from the backend.
|
|
5113
|
-
*/ function
|
|
5114
|
-
return
|
|
5109
|
+
*/ function Tr(t) {
|
|
5110
|
+
return Ke(tn((t = ot(t, cn)).firestore), [ new Ie(t._key, ve.none()) ]);
|
|
5115
5111
|
}
|
|
5116
5112
|
|
|
5117
5113
|
/**
|
|
@@ -5128,9 +5124,9 @@ function Tr(t, e, n, ...r) {
|
|
|
5128
5124
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
5129
5125
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
5130
5126
|
* newly created document after it has been written to the backend.
|
|
5131
|
-
*/ function
|
|
5132
|
-
const n =
|
|
5133
|
-
return
|
|
5127
|
+
*/ function Ir(t, e) {
|
|
5128
|
+
const n = dn(t = ot(t, hn)), r = yr(t.converter, e), s = Vn(Pn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
5129
|
+
return Ke(tn(t.firestore), [ s.toMutation(n._key, ve.exists(!1)) ]).then((() => n));
|
|
5134
5130
|
}
|
|
5135
5131
|
|
|
5136
5132
|
/**
|
|
@@ -5152,15 +5148,15 @@ function Tr(t, e, n, ...r) {
|
|
|
5152
5148
|
/**
|
|
5153
5149
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
5154
5150
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
5155
|
-
*/ function
|
|
5156
|
-
return new
|
|
5151
|
+
*/ function Ar() {
|
|
5152
|
+
return new Dn("deleteField");
|
|
5157
5153
|
}
|
|
5158
5154
|
|
|
5159
5155
|
/**
|
|
5160
5156
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
5161
5157
|
* include a server-generated timestamp in the written data.
|
|
5162
|
-
*/ function
|
|
5163
|
-
return new
|
|
5158
|
+
*/ function Rr() {
|
|
5159
|
+
return new $n("serverTimestamp");
|
|
5164
5160
|
}
|
|
5165
5161
|
|
|
5166
5162
|
/**
|
|
@@ -5174,10 +5170,10 @@ function Tr(t, e, n, ...r) {
|
|
|
5174
5170
|
* @param elements - The elements to union into the array.
|
|
5175
5171
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5176
5172
|
* `updateDoc()`.
|
|
5177
|
-
*/ function
|
|
5173
|
+
*/ function Pr(...t) {
|
|
5178
5174
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5179
5175
|
// update() since we'd need the Firestore instance to do this.
|
|
5180
|
-
return new
|
|
5176
|
+
return new Sn("arrayUnion", t);
|
|
5181
5177
|
}
|
|
5182
5178
|
|
|
5183
5179
|
/**
|
|
@@ -5190,10 +5186,10 @@ function Tr(t, e, n, ...r) {
|
|
|
5190
5186
|
* @param elements - The elements to remove from the array.
|
|
5191
5187
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5192
5188
|
* `updateDoc()`
|
|
5193
|
-
*/ function
|
|
5189
|
+
*/ function Vr(...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 Fn("arrayRemove", t);
|
|
5197
5193
|
}
|
|
5198
5194
|
|
|
5199
5195
|
/**
|
|
@@ -5214,8 +5210,8 @@ function Tr(t, e, n, ...r) {
|
|
|
5214
5210
|
* @param n - The value to increment by.
|
|
5215
5211
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5216
5212
|
* `updateDoc()`
|
|
5217
|
-
*/ function
|
|
5218
|
-
return new
|
|
5213
|
+
*/ function Dr(t) {
|
|
5214
|
+
return new xn("increment", t);
|
|
5219
5215
|
}
|
|
5220
5216
|
|
|
5221
5217
|
/**
|
|
@@ -5241,25 +5237,25 @@ function Tr(t, e, n, ...r) {
|
|
|
5241
5237
|
* provides methods for adding writes to the write batch. None of the writes
|
|
5242
5238
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
5243
5239
|
* called.
|
|
5244
|
-
*/ class
|
|
5240
|
+
*/ class Nr {
|
|
5245
5241
|
/** @hideconstructor */
|
|
5246
5242
|
constructor(t, e) {
|
|
5247
5243
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
5248
|
-
this._dataReader =
|
|
5244
|
+
this._dataReader = Pn(t);
|
|
5249
5245
|
}
|
|
5250
5246
|
set(t, e, n) {
|
|
5251
5247
|
this._verifyNotCommitted();
|
|
5252
|
-
const r =
|
|
5253
|
-
return this._mutations.push(i.toMutation(r._key,
|
|
5248
|
+
const r = $r(t, this._firestore), s = yr(r.converter, e, n), i = Vn(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
|
|
5249
|
+
return this._mutations.push(i.toMutation(r._key, ve.none())), this;
|
|
5254
5250
|
}
|
|
5255
5251
|
update(t, e, n, ...r) {
|
|
5256
5252
|
this._verifyNotCommitted();
|
|
5257
|
-
const s =
|
|
5253
|
+
const s = $r(t, this._firestore);
|
|
5258
5254
|
// For Compat types, we have to "extract" the underlying types before
|
|
5259
5255
|
// performing validation.
|
|
5260
5256
|
let i;
|
|
5261
|
-
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
5262
|
-
this._mutations.push(i.toMutation(s._key,
|
|
5257
|
+
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof pn ? On(this._dataReader, "WriteBatch.update", s._key, e, n, r) : qn(this._dataReader, "WriteBatch.update", s._key, e),
|
|
5258
|
+
this._mutations.push(i.toMutation(s._key, ve.exists(!0))), this;
|
|
5263
5259
|
}
|
|
5264
5260
|
/**
|
|
5265
5261
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -5268,8 +5264,8 @@ function Tr(t, e, n, ...r) {
|
|
|
5268
5264
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
5269
5265
|
*/ delete(t) {
|
|
5270
5266
|
this._verifyNotCommitted();
|
|
5271
|
-
const e =
|
|
5272
|
-
return this._mutations = this._mutations.concat(new
|
|
5267
|
+
const e = $r(t, this._firestore);
|
|
5268
|
+
return this._mutations = this._mutations.concat(new Ie(e._key, ve.none())), this;
|
|
5273
5269
|
}
|
|
5274
5270
|
/**
|
|
5275
5271
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -5290,7 +5286,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5290
5286
|
}
|
|
5291
5287
|
}
|
|
5292
5288
|
|
|
5293
|
-
function
|
|
5289
|
+
function $r(t, e) {
|
|
5294
5290
|
if ((t = getModularInstance(t)).firestore !== e) throw new U(A, "Provided document reference is from a different Firestore instance.");
|
|
5295
5291
|
return t;
|
|
5296
5292
|
}
|
|
@@ -5307,9 +5303,9 @@ function Sr(t, e) {
|
|
|
5307
5303
|
*
|
|
5308
5304
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
5309
5305
|
* writes.
|
|
5310
|
-
*/ function
|
|
5311
|
-
const e =
|
|
5312
|
-
return new
|
|
5306
|
+
*/ function Sr(t) {
|
|
5307
|
+
const e = tn(t = ot(t, nn));
|
|
5308
|
+
return new Nr(t, (t => Ke(e, t)));
|
|
5313
5309
|
}
|
|
5314
5310
|
|
|
5315
5311
|
/**
|
|
@@ -5331,7 +5327,7 @@ function Sr(t, e) {
|
|
|
5331
5327
|
/**
|
|
5332
5328
|
* Internal transaction object responsible for accumulating the mutations to
|
|
5333
5329
|
* perform and the base versions for any documents read.
|
|
5334
|
-
*/ class
|
|
5330
|
+
*/ class Fr {
|
|
5335
5331
|
constructor(t) {
|
|
5336
5332
|
this.datastore = t,
|
|
5337
5333
|
// The version of each document that was read during this transaction.
|
|
@@ -5351,7 +5347,7 @@ function Sr(t, e) {
|
|
|
5351
5347
|
}
|
|
5352
5348
|
async lookup(t) {
|
|
5353
5349
|
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(A, "Firestore transactions require all reads to be executed before all writes.");
|
|
5354
|
-
const e = await
|
|
5350
|
+
const e = await Je(this.datastore, t);
|
|
5355
5351
|
return e.forEach((t => this.recordVersion(t))), e;
|
|
5356
5352
|
}
|
|
5357
5353
|
set(t, e) {
|
|
@@ -5366,7 +5362,7 @@ function Sr(t, e) {
|
|
|
5366
5362
|
this.writtenDocs.add(t.toString());
|
|
5367
5363
|
}
|
|
5368
5364
|
delete(t) {
|
|
5369
|
-
this.write(new
|
|
5365
|
+
this.write(new Ie(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
5370
5366
|
}
|
|
5371
5367
|
async commit() {
|
|
5372
5368
|
if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
|
|
@@ -5379,8 +5375,8 @@ function Sr(t, e) {
|
|
|
5379
5375
|
// a `verify` operation.
|
|
5380
5376
|
t.forEach(((t, e) => {
|
|
5381
5377
|
const n = et.fromPath(e);
|
|
5382
|
-
this.mutations.push(new
|
|
5383
|
-
})), await
|
|
5378
|
+
this.mutations.push(new Ae(n, this.precondition(n)));
|
|
5379
|
+
})), await Ke(this.datastore, this.mutations), this.committed = !0;
|
|
5384
5380
|
}
|
|
5385
5381
|
recordVersion(t) {
|
|
5386
5382
|
let e;
|
|
@@ -5401,7 +5397,7 @@ function Sr(t, e) {
|
|
|
5401
5397
|
* as a precondition, or no precondition if it was not read.
|
|
5402
5398
|
*/ precondition(t) {
|
|
5403
5399
|
const e = this.readVersions.get(t.toString());
|
|
5404
|
-
return !this.writtenDocs.has(t.toString()) && e ?
|
|
5400
|
+
return !this.writtenDocs.has(t.toString()) && e ? ve.updateTime(e) : ve.none();
|
|
5405
5401
|
}
|
|
5406
5402
|
/**
|
|
5407
5403
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -5422,11 +5418,11 @@ function Sr(t, e) {
|
|
|
5422
5418
|
// transaction.
|
|
5423
5419
|
throw new U(A, "Can't update a document that doesn't exist.");
|
|
5424
5420
|
// Document exists, base precondition on document update time.
|
|
5425
|
-
return
|
|
5421
|
+
return ve.updateTime(e);
|
|
5426
5422
|
}
|
|
5427
5423
|
// Document was not read, so we just use the preconditions for a blind
|
|
5428
5424
|
// update.
|
|
5429
|
-
return
|
|
5425
|
+
return ve.exists(!0);
|
|
5430
5426
|
}
|
|
5431
5427
|
write(t) {
|
|
5432
5428
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
@@ -5454,17 +5450,17 @@ function Sr(t, e) {
|
|
|
5454
5450
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
5455
5451
|
* with backoff.
|
|
5456
5452
|
*/
|
|
5457
|
-
class
|
|
5453
|
+
class xr {
|
|
5458
5454
|
constructor(t, e, n, r) {
|
|
5459
5455
|
this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = r,
|
|
5460
|
-
this.Tt = 5, this.It = new
|
|
5456
|
+
this.Tt = 5, this.It = new Ye(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
5461
5457
|
}
|
|
5462
5458
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
5463
5459
|
this.Tt -= 1, this.At();
|
|
5464
5460
|
}
|
|
5465
5461
|
At() {
|
|
5466
5462
|
this.It.W((async () => {
|
|
5467
|
-
const t = new
|
|
5463
|
+
const t = new Fr(this.datastore), e = this.Rt(t);
|
|
5468
5464
|
e && e.then((e => {
|
|
5469
5465
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
5470
5466
|
this.deferred.resolve(e);
|
|
@@ -5554,7 +5550,7 @@ class qr {
|
|
|
5554
5550
|
* See the License for the specific language governing permissions and
|
|
5555
5551
|
* limitations under the License.
|
|
5556
5552
|
*/
|
|
5557
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
5553
|
+
/** The Platform's 'document' implementation or null if not available. */ function qr() {
|
|
5558
5554
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
5559
5555
|
// eslint-disable-next-line no-restricted-globals
|
|
5560
5556
|
return "undefined" != typeof document ? document : null;
|
|
@@ -5586,7 +5582,7 @@ class qr {
|
|
|
5586
5582
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
5587
5583
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
5588
5584
|
* IE.
|
|
5589
|
-
*/ class
|
|
5585
|
+
*/ class Or {
|
|
5590
5586
|
constructor(t, e, n, r, s) {
|
|
5591
5587
|
this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = s,
|
|
5592
5588
|
this.deferred = new k, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -5609,7 +5605,7 @@ class qr {
|
|
|
5609
5605
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
5610
5606
|
* the DelayedOperation class public.
|
|
5611
5607
|
*/ static createAndSchedule(t, e, n, r, s) {
|
|
5612
|
-
const i = Date.now() + n, o = new
|
|
5608
|
+
const i = Date.now() + n, o = new Or(t, e, i, r, s);
|
|
5613
5609
|
return o.start(n), o;
|
|
5614
5610
|
}
|
|
5615
5611
|
/**
|
|
@@ -5658,7 +5654,7 @@ class qr {
|
|
|
5658
5654
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5659
5655
|
* See the License for the specific language governing permissions and
|
|
5660
5656
|
* limitations under the License.
|
|
5661
|
-
*/ class
|
|
5657
|
+
*/ class Cr {
|
|
5662
5658
|
constructor() {
|
|
5663
5659
|
// The last promise in the queue.
|
|
5664
5660
|
this.Dt = Promise.resolve(),
|
|
@@ -5681,15 +5677,15 @@ class qr {
|
|
|
5681
5677
|
// List of TimerIds to fast-forward delays for.
|
|
5682
5678
|
this.Ot = [],
|
|
5683
5679
|
// Backoff timer used to schedule retries for retryable operations
|
|
5684
|
-
this.It = new
|
|
5680
|
+
this.It = new Ye(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5685
5681
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5686
5682
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5687
5683
|
// after page comes into foreground.
|
|
5688
5684
|
this.Ct = () => {
|
|
5689
|
-
const t =
|
|
5685
|
+
const t = qr();
|
|
5690
5686
|
t && m("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.It.H();
|
|
5691
5687
|
};
|
|
5692
|
-
const t =
|
|
5688
|
+
const t = qr();
|
|
5693
5689
|
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ct);
|
|
5694
5690
|
}
|
|
5695
5691
|
get isShuttingDown() {
|
|
@@ -5710,7 +5706,7 @@ class qr {
|
|
|
5710
5706
|
enterRestrictedMode(t) {
|
|
5711
5707
|
if (!this.$t) {
|
|
5712
5708
|
this.$t = !0, this.qt = t || !1;
|
|
5713
|
-
const e =
|
|
5709
|
+
const e = qr();
|
|
5714
5710
|
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ct);
|
|
5715
5711
|
}
|
|
5716
5712
|
}
|
|
@@ -5842,7 +5838,7 @@ class qr {
|
|
|
5842
5838
|
this.Lt(),
|
|
5843
5839
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5844
5840
|
this.Ot.indexOf(t) > -1 && (e = 0);
|
|
5845
|
-
const r =
|
|
5841
|
+
const r = Or.createAndSchedule(this, t, e, n, (t => this.jt(t)));
|
|
5846
5842
|
return this.St.push(r), r;
|
|
5847
5843
|
}
|
|
5848
5844
|
Lt() {
|
|
@@ -5896,10 +5892,10 @@ class qr {
|
|
|
5896
5892
|
}
|
|
5897
5893
|
}
|
|
5898
5894
|
|
|
5899
|
-
class
|
|
5895
|
+
class Lr {
|
|
5900
5896
|
/** @hideconstructor */
|
|
5901
5897
|
constructor(t, e) {
|
|
5902
|
-
this._firestore = t, this._transaction = e, this._dataReader =
|
|
5898
|
+
this._firestore = t, this._transaction = e, this._dataReader = Pn(t);
|
|
5903
5899
|
}
|
|
5904
5900
|
/**
|
|
5905
5901
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
@@ -5907,25 +5903,25 @@ class Ur {
|
|
|
5907
5903
|
* @param documentRef - A reference to the document to be read.
|
|
5908
5904
|
* @returns A `DocumentSnapshot` with the read data.
|
|
5909
5905
|
*/ get(t) {
|
|
5910
|
-
const e =
|
|
5906
|
+
const e = $r(t, this._firestore), n = new _r(this._firestore);
|
|
5911
5907
|
return this._transaction.lookup([ e._key ]).then((t => {
|
|
5912
5908
|
if (!t || 1 !== t.length) return g();
|
|
5913
5909
|
const r = t[0];
|
|
5914
|
-
if (r.isFoundDocument()) return new
|
|
5915
|
-
if (r.isNoDocument()) return new
|
|
5910
|
+
if (r.isFoundDocument()) return new Wn(this._firestore, n, r.key, r, e.converter);
|
|
5911
|
+
if (r.isNoDocument()) return new Wn(this._firestore, n, e._key, null, e.converter);
|
|
5916
5912
|
throw g();
|
|
5917
5913
|
}));
|
|
5918
5914
|
}
|
|
5919
5915
|
set(t, e, n) {
|
|
5920
|
-
const r =
|
|
5916
|
+
const r = $r(t, this._firestore), s = yr(r.converter, e, n), i = Vn(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
|
|
5921
5917
|
return this._transaction.set(r._key, i), this;
|
|
5922
5918
|
}
|
|
5923
5919
|
update(t, e, n, ...r) {
|
|
5924
|
-
const s =
|
|
5920
|
+
const s = $r(t, this._firestore);
|
|
5925
5921
|
// For Compat types, we have to "extract" the underlying types before
|
|
5926
5922
|
// performing validation.
|
|
5927
5923
|
let i;
|
|
5928
|
-
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
5924
|
+
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof pn ? On(this._dataReader, "Transaction.update", s._key, e, n, r) : qn(this._dataReader, "Transaction.update", s._key, e),
|
|
5929
5925
|
this._transaction.update(s._key, i), this;
|
|
5930
5926
|
}
|
|
5931
5927
|
/**
|
|
@@ -5934,7 +5930,7 @@ class Ur {
|
|
|
5934
5930
|
* @param documentRef - A reference to the document to be deleted.
|
|
5935
5931
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
5936
5932
|
*/ delete(t) {
|
|
5937
|
-
const e =
|
|
5933
|
+
const e = $r(t, this._firestore);
|
|
5938
5934
|
return this._transaction.delete(e._key), this;
|
|
5939
5935
|
}
|
|
5940
5936
|
}
|
|
@@ -5955,9 +5951,9 @@ class Ur {
|
|
|
5955
5951
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
5956
5952
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
5957
5953
|
* rejected promise with the corresponding failure error is returned.
|
|
5958
|
-
*/ function
|
|
5959
|
-
const n =
|
|
5960
|
-
return new
|
|
5954
|
+
*/ function Ur(t, e) {
|
|
5955
|
+
const n = tn(t = ot(t, nn)), r = new k;
|
|
5956
|
+
return new xr(new Cr, n, (n => e(new Lr(t, n))), r).run(), r.promise;
|
|
5961
5957
|
}
|
|
5962
5958
|
|
|
5963
5959
|
/**
|
|
@@ -5970,11 +5966,11 @@ class Ur {
|
|
|
5970
5966
|
*/ !function(t) {
|
|
5971
5967
|
f = t;
|
|
5972
5968
|
}(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {options: e}) => {
|
|
5973
|
-
const n = t.getProvider("app").getImmediate(), r = new
|
|
5969
|
+
const n = t.getProvider("app").getImmediate(), r = new nn(n, new z(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")));
|
|
5974
5970
|
return e && r._setSettings(e), r;
|
|
5975
5971
|
}), "PUBLIC")),
|
|
5976
5972
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5977
|
-
registerVersion("firestore-lite", "3.4.
|
|
5973
|
+
registerVersion("firestore-lite", "3.4.8-canary.44948ac91", ""), registerVersion("firestore-lite", "3.4.8-canary.44948ac91", "esm2017");
|
|
5978
5974
|
|
|
5979
|
-
export {
|
|
5975
|
+
export { _n as Bytes, hn as CollectionReference, cn as DocumentReference, Wn as DocumentSnapshot, pn as FieldPath, gn as FieldValue, nn as Firestore, U as FirestoreError, vn as GeoPoint, an as Query, Xn as QueryConstraint, Yn as QueryDocumentSnapshot, Hn as QuerySnapshot, gt as Timestamp, Lr as Transaction, Nr as WriteBatch, Ir as addDoc, Vr as arrayRemove, Pr as arrayUnion, ln as collection, fn as collectionGroup, on as connectFirestoreEmulator, Tr as deleteDoc, Ar as deleteField, dn as doc, yn as documentId, fr as endAt, lr as endBefore, gr as getDoc, vr as getDocs, sn as getFirestore, Dr as increment, rn as initializeFirestore, ir as limit, or as limitToLast, rr as orderBy, Zn as query, mn as queryEqual, wn as refEqual, Ur as runTransaction, Rr as serverTimestamp, br as setDoc, w as setLogLevel, Kn as snapshotEqual, ar as startAfter, cr as startAt, un as terminate, Er as updateDoc, er as where, Sr as writeBatch };
|
|
5980
5976
|
//# sourceMappingURL=index.browser.esm2017.js.map
|