@firebase/firestore 3.1.0 → 3.1.1-canary.4594d3fd6
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 +6 -0
- package/dist/firestore/src/register.d.ts +1 -1
- package/dist/firestore/src/remote/persistent_stream.d.ts +5 -1
- package/dist/firestore/src/util/async_queue.d.ts +4 -2
- package/dist/index.esm2017.js +2997 -2993
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +2861 -2851
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +7051 -9102
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/{index.node.cjs.esm2017.js → index.node.mjs} +56 -23
- package/dist/index.node.mjs.map +1 -0
- package/dist/index.rn.js +2973 -2965
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +4 -2
- package/dist/lite/firestore/src/register.d.ts +1 -1
- package/dist/lite/firestore/src/remote/persistent_stream.d.ts +5 -1
- package/dist/lite/firestore/src/util/async_queue.d.ts +4 -2
- package/dist/lite/index.browser.esm2017.js +1188 -1191
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +797 -796
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +1807 -2262
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/{index.node.esm2017.js → index.node.mjs} +6 -4
- package/dist/lite/index.node.mjs.map +1 -0
- package/dist/lite/index.rn.esm2017.js +11 -11
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +4 -2
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +115 -115
- package/dist/lite/packages/firestore/src/register.d.ts +1 -1
- package/dist/lite/packages/firestore/src/remote/persistent_stream.d.ts +5 -1
- package/dist/lite/packages/firestore/src/util/async_queue.d.ts +4 -2
- package/dist/lite/private.d.ts +4 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +187 -187
- package/dist/packages/firestore/src/register.d.ts +1 -1
- package/dist/packages/firestore/src/remote/persistent_stream.d.ts +5 -1
- package/dist/packages/firestore/src/util/async_queue.d.ts +4 -2
- package/dist/private.d.ts +4 -2
- package/lite/package.json +1 -1
- package/package.json +22 -16
- package/dist/index.node.cjs.esm2017.js.map +0 -1
- package/dist/lite/firestore/dist/lite/index.node.esm2017.d.ts +0 -1195
- package/dist/lite/index.node.esm2017.js.map +0 -1
- package/dist/packages/firestore/dist/index.node.cjs.esm2017.d.ts +0 -1844
|
@@ -6,7 +6,7 @@ import { Component as c } from "@firebase/component";
|
|
|
6
6
|
|
|
7
7
|
import { Logger as f, LogLevel as l } from "@firebase/logger";
|
|
8
8
|
|
|
9
|
-
import { getModularInstance as h, createMockUserToken as
|
|
9
|
+
import { getModularInstance as h, createMockUserToken as d } from "@firebase/util";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @license
|
|
@@ -27,7 +27,7 @@ import { getModularInstance as h, createMockUserToken as p } from "@firebase/uti
|
|
|
27
27
|
/**
|
|
28
28
|
* Simple wrapper around a nullable UID. Mostly exists to make code more
|
|
29
29
|
* readable.
|
|
30
|
-
*/ var
|
|
30
|
+
*/ var p = /** @class */ function() {
|
|
31
31
|
function t(t) {
|
|
32
32
|
this.uid = t;
|
|
33
33
|
}
|
|
@@ -45,11 +45,11 @@ import { getModularInstance as h, createMockUserToken as p } from "@firebase/uti
|
|
|
45
45
|
}, t;
|
|
46
46
|
}();
|
|
47
47
|
|
|
48
|
-
/** A user with a null UID. */
|
|
48
|
+
/** A user with a null UID. */ p.UNAUTHENTICATED = new p(null),
|
|
49
49
|
// TODO(mikelehen): Look into getting a proper uid-equivalent for
|
|
50
50
|
// non-FirebaseAuth providers.
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
p.GOOGLE_CREDENTIALS = new p("google-credentials-uid"), p.FIRST_PARTY = new p("first-party-uid"),
|
|
52
|
+
p.MOCK_USER = new p("mock-user");
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* @license
|
|
@@ -67,7 +67,7 @@ d.MOCK_USER = new d("mock-user");
|
|
|
67
67
|
* See the License for the specific language governing permissions and
|
|
68
68
|
* limitations under the License.
|
|
69
69
|
*/
|
|
70
|
-
var m = "9.1.
|
|
70
|
+
var m = "9.1.3-canary.4594d3fd6", y = new f("@firebase/firestore");
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* @license
|
|
@@ -225,7 +225,7 @@ e) {
|
|
|
225
225
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
226
226
|
* See the License for the specific language governing permissions and
|
|
227
227
|
* limitations under the License.
|
|
228
|
-
*/ var I = "
|
|
228
|
+
*/ var I = "cancelled", A = "unknown", V = "invalid-argument", D = "deadline-exceeded", k = "not-found", P = "permission-denied", N = "unauthenticated", F = "resource-exhausted", O = "failed-precondition", q = "aborted", j = "out-of-range", L = "unimplemented", R = "internal", U = "unavailable", x = /** @class */ function(e) {
|
|
229
229
|
/** @hideconstructor */
|
|
230
230
|
function n(
|
|
231
231
|
/**
|
|
@@ -248,26 +248,26 @@ e) {
|
|
|
248
248
|
}, r;
|
|
249
249
|
}
|
|
250
250
|
return t(n, e), n;
|
|
251
|
-
}(Error),
|
|
251
|
+
}(Error), B = function() {
|
|
252
252
|
var t = this;
|
|
253
253
|
this.promise = new Promise((function(e, n) {
|
|
254
254
|
t.resolve = e, t.reject = n;
|
|
255
255
|
}));
|
|
256
|
-
},
|
|
256
|
+
}, C = function(t, e) {
|
|
257
257
|
this.user = e, this.type = "OAuth", this.authHeaders = {},
|
|
258
258
|
// Set the headers using Object Literal notation to avoid minification
|
|
259
259
|
this.authHeaders.Authorization = "Bearer " + t;
|
|
260
|
-
},
|
|
260
|
+
}, M = /** @class */ function() {
|
|
261
261
|
function t() {}
|
|
262
262
|
return t.prototype.getToken = function() {
|
|
263
263
|
return Promise.resolve(null);
|
|
264
264
|
}, t.prototype.invalidateToken = function() {}, t.prototype.start = function(t, e) {
|
|
265
265
|
// Fire with initial user.
|
|
266
266
|
t.enqueueRetryable((function() {
|
|
267
|
-
return e(
|
|
267
|
+
return e(p.UNAUTHENTICATED);
|
|
268
268
|
}));
|
|
269
269
|
}, t.prototype.shutdown = function() {}, t;
|
|
270
|
-
}(),
|
|
270
|
+
}(), G = /** @class */ function() {
|
|
271
271
|
function t(t) {
|
|
272
272
|
this.token = t,
|
|
273
273
|
/**
|
|
@@ -289,7 +289,7 @@ e) {
|
|
|
289
289
|
}, t.prototype.shutdown = function() {
|
|
290
290
|
this.changeListener = null;
|
|
291
291
|
}, t;
|
|
292
|
-
}(),
|
|
292
|
+
}(), Q = /** @class */ function() {
|
|
293
293
|
function t(t) {
|
|
294
294
|
var e = this;
|
|
295
295
|
this.auth = null, t.onInit((function(t) {
|
|
@@ -299,13 +299,13 @@ e) {
|
|
|
299
299
|
return t.prototype.getToken = function() {
|
|
300
300
|
var t = this;
|
|
301
301
|
return this.auth ? this.auth.getToken().then((function(e) {
|
|
302
|
-
return e ? (T("string" == typeof e.accessToken), new
|
|
302
|
+
return e ? (T("string" == typeof e.accessToken), new C(e.accessToken, new p(t.auth.getUid()))) : null;
|
|
303
303
|
})) : Promise.resolve(null);
|
|
304
304
|
}, t.prototype.invalidateToken = function() {}, t.prototype.start = function(t, e) {},
|
|
305
305
|
t.prototype.shutdown = function() {}, t;
|
|
306
|
-
}(),
|
|
306
|
+
}(), z = /** @class */ function() {
|
|
307
307
|
function t(t, e, n) {
|
|
308
|
-
this.t = t, this.i = e, this.o = n, this.type = "FirstParty", this.user =
|
|
308
|
+
this.t = t, this.i = e, this.o = n, this.type = "FirstParty", this.user = p.FIRST_PARTY;
|
|
309
309
|
}
|
|
310
310
|
return Object.defineProperty(t.prototype, "authHeaders", {
|
|
311
311
|
get: function() {
|
|
@@ -319,20 +319,20 @@ e) {
|
|
|
319
319
|
enumerable: !1,
|
|
320
320
|
configurable: !0
|
|
321
321
|
}), t;
|
|
322
|
-
}(),
|
|
322
|
+
}(), H = /** @class */ function() {
|
|
323
323
|
function t(t, e, n) {
|
|
324
324
|
this.t = t, this.i = e, this.o = n;
|
|
325
325
|
}
|
|
326
326
|
return t.prototype.getToken = function() {
|
|
327
|
-
return Promise.resolve(new
|
|
327
|
+
return Promise.resolve(new z(this.t, this.i, this.o));
|
|
328
328
|
}, t.prototype.start = function(t, e) {
|
|
329
329
|
// Fire with initial uid.
|
|
330
330
|
t.enqueueRetryable((function() {
|
|
331
|
-
return e(
|
|
331
|
+
return e(p.FIRST_PARTY);
|
|
332
332
|
}));
|
|
333
333
|
}, t.prototype.shutdown = function() {}, t.prototype.invalidateToken = function() {},
|
|
334
334
|
t;
|
|
335
|
-
}(),
|
|
335
|
+
}(), K =
|
|
336
336
|
/**
|
|
337
337
|
* Constructs a DatabaseInfo using the provided host, databaseId and
|
|
338
338
|
* persistenceKey.
|
|
@@ -353,7 +353,7 @@ e) {
|
|
|
353
353
|
function(t, e, n, r, i, o, a, s) {
|
|
354
354
|
this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = r, this.ssl = i,
|
|
355
355
|
this.forceLongPolling = o, this.autoDetectLongPolling = a, this.useFetchStreams = s;
|
|
356
|
-
},
|
|
356
|
+
}, W = /** @class */ function() {
|
|
357
357
|
function t(t, e) {
|
|
358
358
|
this.projectId = t, this.database = e || "(default)";
|
|
359
359
|
}
|
|
@@ -366,7 +366,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
366
366
|
}), t.prototype.isEqual = function(e) {
|
|
367
367
|
return e instanceof t && e.projectId === this.projectId && e.database === this.database;
|
|
368
368
|
}, t;
|
|
369
|
-
}(),
|
|
369
|
+
}(), Y = /** @class */ function() {
|
|
370
370
|
function t(t, e, n) {
|
|
371
371
|
void 0 === e ? e = 0 : e > t.length && S(), void 0 === n ? n = t.length - e : n > t.length - e && S(),
|
|
372
372
|
this.segments = t, this.offset = e, this.len = n;
|
|
@@ -419,7 +419,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
419
419
|
}
|
|
420
420
|
return t.length < e.length ? -1 : t.length > e.length ? 1 : 0;
|
|
421
421
|
}, t;
|
|
422
|
-
}(),
|
|
422
|
+
}(), X = /** @class */ function(e) {
|
|
423
423
|
function n() {
|
|
424
424
|
return null !== e && e.apply(this, arguments) || this;
|
|
425
425
|
}
|
|
@@ -445,7 +445,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
445
445
|
// for legacy reasons and should not be used frequently).
|
|
446
446
|
for (var r = [], i = 0, o = t; i < o.length; i++) {
|
|
447
447
|
var a = o[i];
|
|
448
|
-
if (a.indexOf("//") >= 0) throw new
|
|
448
|
+
if (a.indexOf("//") >= 0) throw new x(V, "Invalid segment (" + a + "). Paths must not contain // in them.");
|
|
449
449
|
// Strip leading and traling slashed.
|
|
450
450
|
r.push.apply(r, a.split("/").filter((function(t) {
|
|
451
451
|
return t.length > 0;
|
|
@@ -455,7 +455,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
455
455
|
}, n.emptyPath = function() {
|
|
456
456
|
return new n([]);
|
|
457
457
|
}, n;
|
|
458
|
-
}(
|
|
458
|
+
}(Y), $ = /^[_a-zA-Z][_a-zA-Z0-9]*$/, J = /** @class */ function(e) {
|
|
459
459
|
function n() {
|
|
460
460
|
return null !== e && e.apply(this, arguments) || this;
|
|
461
461
|
}
|
|
@@ -467,7 +467,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
467
467
|
* without escaping.
|
|
468
468
|
*/
|
|
469
469
|
n.isValidIdentifier = function(t) {
|
|
470
|
-
return
|
|
470
|
+
return $.test(t);
|
|
471
471
|
}, n.prototype.canonicalString = function() {
|
|
472
472
|
return this.toArray().map((function(t) {
|
|
473
473
|
return t = t.replace(/\\/g, "\\\\").replace(/`/g, "\\`"), n.isValidIdentifier(t) || (t = "`" + t + "`"),
|
|
@@ -500,39 +500,39 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
500
500
|
*/
|
|
501
501
|
n.fromServerFormat = function(t) {
|
|
502
502
|
for (var e = [], r = "", i = 0, o = function() {
|
|
503
|
-
if (0 === r.length) throw new
|
|
503
|
+
if (0 === r.length) throw new x(V, "Invalid field path (" + t + "). Paths must not be empty, begin with '.', end with '.', or contain '..'");
|
|
504
504
|
e.push(r), r = "";
|
|
505
505
|
}, a = !1; i < t.length; ) {
|
|
506
506
|
var s = t[i];
|
|
507
507
|
if ("\\" === s) {
|
|
508
|
-
if (i + 1 === t.length) throw new
|
|
508
|
+
if (i + 1 === t.length) throw new x(V, "Path has trailing escape character: " + t);
|
|
509
509
|
var u = t[i + 1];
|
|
510
|
-
if ("\\" !== u && "." !== u && "`" !== u) throw new
|
|
510
|
+
if ("\\" !== u && "." !== u && "`" !== u) throw new x(V, "Path has invalid escape sequence: " + t);
|
|
511
511
|
r += u, i += 2;
|
|
512
512
|
} else "`" === s ? (a = !a, i++) : "." !== s || a ? (r += s, i++) : (o(), i++);
|
|
513
513
|
}
|
|
514
|
-
if (o(), a) throw new
|
|
514
|
+
if (o(), a) throw new x(V, "Unterminated ` in path: " + t);
|
|
515
515
|
return new n(e);
|
|
516
516
|
}, n.emptyPath = function() {
|
|
517
517
|
return new n([]);
|
|
518
518
|
}, n;
|
|
519
|
-
}(
|
|
519
|
+
}(Y), Z = /** @class */ function() {
|
|
520
520
|
function t(t) {
|
|
521
521
|
this.path = t;
|
|
522
522
|
}
|
|
523
523
|
return t.fromPath = function(e) {
|
|
524
|
-
return new t(
|
|
524
|
+
return new t(X.fromString(e));
|
|
525
525
|
}, t.fromName = function(e) {
|
|
526
|
-
return new t(
|
|
526
|
+
return new t(X.fromString(e).popFirst(5));
|
|
527
527
|
},
|
|
528
528
|
/** Returns true if the document is in the specified collectionId. */ t.prototype.hasCollectionId = function(t) {
|
|
529
529
|
return this.path.length >= 2 && this.path.get(this.path.length - 2) === t;
|
|
530
530
|
}, t.prototype.isEqual = function(t) {
|
|
531
|
-
return null !== t && 0 ===
|
|
531
|
+
return null !== t && 0 === X.comparator(this.path, t.path);
|
|
532
532
|
}, t.prototype.toString = function() {
|
|
533
533
|
return this.path.toString();
|
|
534
534
|
}, t.comparator = function(t, e) {
|
|
535
|
-
return
|
|
535
|
+
return X.comparator(t.path, e.path);
|
|
536
536
|
}, t.isDocumentKey = function(t) {
|
|
537
537
|
return t.length % 2 == 0;
|
|
538
538
|
},
|
|
@@ -543,7 +543,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
543
543
|
* @returns A new instance of DocumentKey
|
|
544
544
|
*/
|
|
545
545
|
t.fromSegments = function(e) {
|
|
546
|
-
return new t(new
|
|
546
|
+
return new t(new X(e.slice()));
|
|
547
547
|
}, t;
|
|
548
548
|
}();
|
|
549
549
|
|
|
@@ -564,8 +564,8 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
564
564
|
* See the License for the specific language governing permissions and
|
|
565
565
|
* limitations under the License.
|
|
566
566
|
*/
|
|
567
|
-
function
|
|
568
|
-
if (!n) throw new
|
|
567
|
+
function tt(t, e, n) {
|
|
568
|
+
if (!n) throw new x(V, "Function " + t + "() cannot be called with an empty " + e + ".");
|
|
569
569
|
}
|
|
570
570
|
|
|
571
571
|
/**
|
|
@@ -575,22 +575,22 @@ function et(t, e, n) {
|
|
|
575
575
|
/**
|
|
576
576
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
577
577
|
* an even numbers of segments).
|
|
578
|
-
*/ function
|
|
579
|
-
if (!
|
|
578
|
+
*/ function et(t) {
|
|
579
|
+
if (!Z.isDocumentKey(t)) throw new x(V, "Invalid document reference. Document references must have an even number of segments, but " + t + " has " + t.length + ".");
|
|
580
580
|
}
|
|
581
581
|
|
|
582
582
|
/**
|
|
583
583
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
584
584
|
* contains an odd numbers of segments).
|
|
585
|
-
*/ function
|
|
586
|
-
if (
|
|
585
|
+
*/ function nt(t) {
|
|
586
|
+
if (Z.isDocumentKey(t)) throw new x(V, "Invalid collection reference. Collection references must have an odd number of segments, but " + t + " has " + t.length + ".");
|
|
587
587
|
}
|
|
588
588
|
|
|
589
589
|
/**
|
|
590
590
|
* Returns true if it's a non-null object without a custom prototype
|
|
591
591
|
* (i.e. excludes Array, Date, etc.).
|
|
592
592
|
*/
|
|
593
|
-
/** Returns a string describing the type / value of the provided input. */ function
|
|
593
|
+
/** Returns a string describing the type / value of the provided input. */ function rt(t) {
|
|
594
594
|
if (void 0 === t) return "undefined";
|
|
595
595
|
if (null === t) return "null";
|
|
596
596
|
if ("string" == typeof t) return t.length > 20 && (t = t.substring(0, 20) + "..."),
|
|
@@ -608,22 +608,22 @@ function et(t, e, n) {
|
|
|
608
608
|
return "function" == typeof t ? "a function" : S();
|
|
609
609
|
}
|
|
610
610
|
|
|
611
|
-
function
|
|
611
|
+
function it(t,
|
|
612
612
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
613
613
|
e) {
|
|
614
614
|
if ("_delegate" in t && (
|
|
615
615
|
// Unwrap Compat types
|
|
616
616
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
617
617
|
t = t._delegate), !(t instanceof e)) {
|
|
618
|
-
if (e.name === t.constructor.name) throw new
|
|
619
|
-
var n =
|
|
620
|
-
throw new
|
|
618
|
+
if (e.name === t.constructor.name) throw new x(V, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
619
|
+
var n = rt(t);
|
|
620
|
+
throw new x(V, "Expected type '" + e.name + "', but it was: " + n);
|
|
621
621
|
}
|
|
622
622
|
return t;
|
|
623
623
|
}
|
|
624
624
|
|
|
625
|
-
function
|
|
626
|
-
if (e <= 0) throw new
|
|
625
|
+
function ot(t, e) {
|
|
626
|
+
if (e <= 0) throw new x(V, "Function " + t + "() requires a positive number, but it was: " + e + ".");
|
|
627
627
|
}
|
|
628
628
|
|
|
629
629
|
/**
|
|
@@ -644,11 +644,11 @@ function at(t, e) {
|
|
|
644
644
|
*/
|
|
645
645
|
/**
|
|
646
646
|
* Returns whether a variable is either undefined or null.
|
|
647
|
-
*/ function
|
|
647
|
+
*/ function at(t) {
|
|
648
648
|
return null == t;
|
|
649
649
|
}
|
|
650
650
|
|
|
651
|
-
/** Returns whether the value represents -0. */ function
|
|
651
|
+
/** Returns whether the value represents -0. */ function st(t) {
|
|
652
652
|
// Detect if the value is -0.0. Based on polyfill from
|
|
653
653
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
654
654
|
return 0 === t && 1 / t == -1 / 0;
|
|
@@ -673,7 +673,7 @@ function at(t, e) {
|
|
|
673
673
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
674
674
|
* See the License for the specific language governing permissions and
|
|
675
675
|
* limitations under the License.
|
|
676
|
-
*/ var ct, ft
|
|
676
|
+
*/ var ut, ct, ft = {
|
|
677
677
|
BatchGetDocuments: "batchGet",
|
|
678
678
|
Commit: "commit",
|
|
679
679
|
RunQuery: "runQuery"
|
|
@@ -717,8 +717,8 @@ function at(t, e) {
|
|
|
717
717
|
* @returns The equivalent Code. Unknown status codes are mapped to
|
|
718
718
|
* Code.UNKNOWN.
|
|
719
719
|
*/
|
|
720
|
-
function
|
|
721
|
-
if (void 0 === t) return w("RPC_ERROR", "HTTP error has no status"),
|
|
720
|
+
function lt(t) {
|
|
721
|
+
if (void 0 === t) return w("RPC_ERROR", "HTTP error has no status"), A;
|
|
722
722
|
// The canonical error codes for Google APIs [1] specify mapping onto HTTP
|
|
723
723
|
// status codes but the mapping is not bijective. In each case of ambiguity
|
|
724
724
|
// this function chooses a primary error.
|
|
@@ -727,66 +727,66 @@ function ht(t) {
|
|
|
727
727
|
switch (t) {
|
|
728
728
|
case 200:
|
|
729
729
|
// OK
|
|
730
|
-
return
|
|
730
|
+
return "ok";
|
|
731
731
|
|
|
732
732
|
case 400:
|
|
733
733
|
// Bad Request
|
|
734
|
-
return
|
|
734
|
+
return O;
|
|
735
735
|
|
|
736
736
|
// Other possibilities based on the forward mapping
|
|
737
737
|
// return Code.INVALID_ARGUMENT;
|
|
738
738
|
// return Code.OUT_OF_RANGE;
|
|
739
739
|
case 401:
|
|
740
740
|
// Unauthorized
|
|
741
|
-
return
|
|
741
|
+
return N;
|
|
742
742
|
|
|
743
743
|
case 403:
|
|
744
744
|
// Forbidden
|
|
745
|
-
return
|
|
745
|
+
return P;
|
|
746
746
|
|
|
747
747
|
case 404:
|
|
748
748
|
// Not Found
|
|
749
|
-
return
|
|
749
|
+
return k;
|
|
750
750
|
|
|
751
751
|
case 409:
|
|
752
752
|
// Conflict
|
|
753
|
-
return
|
|
753
|
+
return q;
|
|
754
754
|
|
|
755
755
|
// Other possibilities:
|
|
756
756
|
// return Code.ALREADY_EXISTS;
|
|
757
757
|
case 416:
|
|
758
758
|
// Range Not Satisfiable
|
|
759
|
-
return
|
|
759
|
+
return j;
|
|
760
760
|
|
|
761
761
|
case 429:
|
|
762
762
|
// Too Many Requests
|
|
763
|
-
return
|
|
763
|
+
return F;
|
|
764
764
|
|
|
765
765
|
case 499:
|
|
766
766
|
// Client Closed Request
|
|
767
|
-
return
|
|
767
|
+
return I;
|
|
768
768
|
|
|
769
769
|
case 500:
|
|
770
770
|
// Internal Server Error
|
|
771
|
-
return
|
|
771
|
+
return A;
|
|
772
772
|
|
|
773
773
|
// Other possibilities:
|
|
774
774
|
// return Code.INTERNAL;
|
|
775
775
|
// return Code.DATA_LOSS;
|
|
776
776
|
case 501:
|
|
777
777
|
// Unimplemented
|
|
778
|
-
return
|
|
778
|
+
return L;
|
|
779
779
|
|
|
780
780
|
case 503:
|
|
781
781
|
// Service Unavailable
|
|
782
|
-
return
|
|
782
|
+
return U;
|
|
783
783
|
|
|
784
784
|
case 504:
|
|
785
785
|
// Gateway Timeout
|
|
786
|
-
return
|
|
786
|
+
return D;
|
|
787
787
|
|
|
788
788
|
default:
|
|
789
|
-
return t >= 200 && t < 300 ?
|
|
789
|
+
return t >= 200 && t < 300 ? "ok" : t >= 400 && t < 500 ? O : t >= 500 && t < 600 ? R : A;
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
792
|
|
|
@@ -809,29 +809,29 @@ function ht(t) {
|
|
|
809
809
|
/**
|
|
810
810
|
* A Rest-based connection that relies on the native HTTP stack
|
|
811
811
|
* (e.g. `fetch` or a polyfill).
|
|
812
|
-
*/ (
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
var
|
|
812
|
+
*/ (ct = ut || (ut = {}))[ct.OK = 0] = "OK", ct[ct.CANCELLED = 1] = "CANCELLED",
|
|
813
|
+
ct[ct.UNKNOWN = 2] = "UNKNOWN", ct[ct.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
|
|
814
|
+
ct[ct.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", ct[ct.NOT_FOUND = 5] = "NOT_FOUND",
|
|
815
|
+
ct[ct.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", ct[ct.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
816
|
+
ct[ct.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", ct[ct.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
817
|
+
ct[ct.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", ct[ct.ABORTED = 10] = "ABORTED",
|
|
818
|
+
ct[ct.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", ct[ct.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
|
|
819
|
+
ct[ct.INTERNAL = 13] = "INTERNAL", ct[ct.UNAVAILABLE = 14] = "UNAVAILABLE", ct[ct.DATA_LOSS = 15] = "DATA_LOSS";
|
|
820
|
+
|
|
821
|
+
var ht = /** @class */ function(r) {
|
|
822
822
|
/**
|
|
823
823
|
* @param databaseInfo - The connection info.
|
|
824
824
|
* @param fetchImpl - `fetch` or a Polyfill that implements the fetch API.
|
|
825
825
|
*/
|
|
826
826
|
function i(t, e) {
|
|
827
827
|
var n = this;
|
|
828
|
-
return (n = r.call(this, t) || this).
|
|
828
|
+
return (n = r.call(this, t) || this).T = e, n;
|
|
829
829
|
}
|
|
830
830
|
/**
|
|
831
831
|
* Base class for all Rest-based connections to the backend (WebChannel and
|
|
832
832
|
* HTTP).
|
|
833
833
|
*/
|
|
834
|
-
return t(i, r), i.prototype.
|
|
834
|
+
return t(i, r), i.prototype.I = function(t, e) {
|
|
835
835
|
throw new Error("Not supported by FetchConnection");
|
|
836
836
|
}, i.prototype.g = function(t, r, i, o) {
|
|
837
837
|
return e(this, void 0, void 0, (function() {
|
|
@@ -842,7 +842,7 @@ var pt = /** @class */ function(r) {
|
|
|
842
842
|
t = JSON.stringify(o), n.label = 1;
|
|
843
843
|
|
|
844
844
|
case 1:
|
|
845
|
-
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.
|
|
845
|
+
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.T(r, {
|
|
846
846
|
method: "POST",
|
|
847
847
|
headers: i,
|
|
848
848
|
body: t
|
|
@@ -852,10 +852,10 @@ var pt = /** @class */ function(r) {
|
|
|
852
852
|
return e = n.sent(), [ 3 /*break*/ , 4 ];
|
|
853
853
|
|
|
854
854
|
case 3:
|
|
855
|
-
throw a = n.sent(), new
|
|
855
|
+
throw a = n.sent(), new x(lt(a.status), "Request failed with error: " + a.statusText);
|
|
856
856
|
|
|
857
857
|
case 4:
|
|
858
|
-
if (!e.ok) throw new
|
|
858
|
+
if (!e.ok) throw new x(lt(e.status), "Request failed with error: " + e.statusText);
|
|
859
859
|
return [ 2 /*return*/ , e.json() ];
|
|
860
860
|
}
|
|
861
861
|
}));
|
|
@@ -895,7 +895,7 @@ var pt = /** @class */ function(r) {
|
|
|
895
895
|
t["Content-Type"] = "text/plain", this.databaseInfo.appId && (t["X-Firebase-GMPID"] = this.databaseInfo.appId),
|
|
896
896
|
e) for (var n in e.authHeaders) e.authHeaders.hasOwnProperty(n) && (t[n] = e.authHeaders[n]);
|
|
897
897
|
}, t.prototype.m = function(t, e) {
|
|
898
|
-
var n =
|
|
898
|
+
var n = ft[t];
|
|
899
899
|
return this.u + "/v1/" + e + ":" + n;
|
|
900
900
|
}, t;
|
|
901
901
|
}());
|
|
@@ -963,7 +963,7 @@ var pt = /** @class */ function(r) {
|
|
|
963
963
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
964
964
|
* See the License for the specific language governing permissions and
|
|
965
965
|
* limitations under the License.
|
|
966
|
-
*/ var
|
|
966
|
+
*/ var pt = /** @class */ function() {
|
|
967
967
|
function t() {}
|
|
968
968
|
return t.A = function() {
|
|
969
969
|
for (
|
|
@@ -978,11 +978,11 @@ var pt = /** @class */ function(r) {
|
|
|
978
978
|
}, t;
|
|
979
979
|
}();
|
|
980
980
|
|
|
981
|
-
function
|
|
981
|
+
function mt(t, e) {
|
|
982
982
|
return t < e ? -1 : t > e ? 1 : 0;
|
|
983
983
|
}
|
|
984
984
|
|
|
985
|
-
/** Helper to compare arrays using isEqual(). */ function
|
|
985
|
+
/** Helper to compare arrays using isEqual(). */ function yt(t, e, n) {
|
|
986
986
|
return t.length === e.length && t.every((function(t, r) {
|
|
987
987
|
return n(t, e[r]);
|
|
988
988
|
}));
|
|
@@ -1018,7 +1018,7 @@ function yt(t, e) {
|
|
|
1018
1018
|
*
|
|
1019
1019
|
* For examples and further specifications, refer to the
|
|
1020
1020
|
* {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
|
|
1021
|
-
*/ var
|
|
1021
|
+
*/ var vt = /** @class */ function() {
|
|
1022
1022
|
/**
|
|
1023
1023
|
* Creates a new timestamp.
|
|
1024
1024
|
*
|
|
@@ -1039,11 +1039,11 @@ function yt(t, e) {
|
|
|
1039
1039
|
* The fractions of a second at nanosecond resolution.*
|
|
1040
1040
|
*/
|
|
1041
1041
|
e) {
|
|
1042
|
-
if (this.seconds = t, this.nanoseconds = e, e < 0) throw new
|
|
1043
|
-
if (e >= 1e9) throw new
|
|
1044
|
-
if (t < -62135596800) throw new
|
|
1042
|
+
if (this.seconds = t, this.nanoseconds = e, e < 0) throw new x(V, "Timestamp nanoseconds out of range: " + e);
|
|
1043
|
+
if (e >= 1e9) throw new x(V, "Timestamp nanoseconds out of range: " + e);
|
|
1044
|
+
if (t < -62135596800) throw new x(V, "Timestamp seconds out of range: " + t);
|
|
1045
1045
|
// This will break in the year 10,000.
|
|
1046
|
-
if (t >= 253402300800) throw new
|
|
1046
|
+
if (t >= 253402300800) throw new x(V, "Timestamp seconds out of range: " + t);
|
|
1047
1047
|
}
|
|
1048
1048
|
/**
|
|
1049
1049
|
* Creates a new timestamp with the current date, with millisecond precision.
|
|
@@ -1095,7 +1095,7 @@ function yt(t, e) {
|
|
|
1095
1095
|
t.prototype.toMillis = function() {
|
|
1096
1096
|
return 1e3 * this.seconds + this.nanoseconds / 1e6;
|
|
1097
1097
|
}, t.prototype._compareTo = function(t) {
|
|
1098
|
-
return this.seconds === t.seconds ?
|
|
1098
|
+
return this.seconds === t.seconds ? mt(this.nanoseconds, t.nanoseconds) : mt(this.seconds, t.seconds);
|
|
1099
1099
|
},
|
|
1100
1100
|
/**
|
|
1101
1101
|
* Returns true if this `Timestamp` is equal to the provided one.
|
|
@@ -1132,14 +1132,14 @@ function yt(t, e) {
|
|
|
1132
1132
|
// 'seconds' values.
|
|
1133
1133
|
return String(t).padStart(12, "0") + "." + String(this.nanoseconds).padStart(9, "0");
|
|
1134
1134
|
}, t;
|
|
1135
|
-
}(),
|
|
1135
|
+
}(), gt = /** @class */ function() {
|
|
1136
1136
|
function t(t) {
|
|
1137
1137
|
this.timestamp = t;
|
|
1138
1138
|
}
|
|
1139
1139
|
return t.fromTimestamp = function(e) {
|
|
1140
1140
|
return new t(e);
|
|
1141
1141
|
}, t.min = function() {
|
|
1142
|
-
return new t(new
|
|
1142
|
+
return new t(new vt(0, 0));
|
|
1143
1143
|
}, t.prototype.compareTo = function(t) {
|
|
1144
1144
|
return this.timestamp._compareTo(t.timestamp);
|
|
1145
1145
|
}, t.prototype.isEqual = function(t) {
|
|
@@ -1191,13 +1191,13 @@ function yt(t, e) {
|
|
|
1191
1191
|
* See the License for the specific language governing permissions and
|
|
1192
1192
|
* limitations under the License.
|
|
1193
1193
|
*/
|
|
1194
|
-
function
|
|
1194
|
+
function wt(t) {
|
|
1195
1195
|
var e = 0;
|
|
1196
1196
|
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
|
|
1197
1197
|
return e;
|
|
1198
1198
|
}
|
|
1199
1199
|
|
|
1200
|
-
function
|
|
1200
|
+
function bt(t, e) {
|
|
1201
1201
|
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
|
|
1202
1202
|
}
|
|
1203
1203
|
|
|
@@ -1226,12 +1226,12 @@ function _t(t, e) {
|
|
|
1226
1226
|
* foo.bar - Overwrites only the field bar of the object foo.
|
|
1227
1227
|
* If foo is not an object, foo is replaced with an object
|
|
1228
1228
|
* containing foo
|
|
1229
|
-
*/ var
|
|
1229
|
+
*/ var _t = /** @class */ function() {
|
|
1230
1230
|
function t(t) {
|
|
1231
1231
|
this.fields = t,
|
|
1232
1232
|
// TODO(dimond): validation of FieldMask
|
|
1233
1233
|
// Sort the field mask to support `FieldMask.isEqual()` and assert below.
|
|
1234
|
-
t.sort(
|
|
1234
|
+
t.sort(J.comparator)
|
|
1235
1235
|
/**
|
|
1236
1236
|
* Verifies that `fieldPath` is included by at least one field in this field
|
|
1237
1237
|
* mask.
|
|
@@ -1245,25 +1245,26 @@ function _t(t, e) {
|
|
|
1245
1245
|
}
|
|
1246
1246
|
return !1;
|
|
1247
1247
|
}, t.prototype.isEqual = function(t) {
|
|
1248
|
-
return
|
|
1248
|
+
return yt(this.fields, t.fields, (function(t, e) {
|
|
1249
1249
|
return t.isEqual(e);
|
|
1250
1250
|
}));
|
|
1251
1251
|
}, t;
|
|
1252
|
-
}(),
|
|
1252
|
+
}(), St = /** @class */ function() {
|
|
1253
1253
|
function t(t) {
|
|
1254
1254
|
this.binaryString = t;
|
|
1255
1255
|
}
|
|
1256
1256
|
return t.fromBase64String = function(e) {
|
|
1257
1257
|
return new t(atob(e));
|
|
1258
1258
|
}, t.fromUint8Array = function(e) {
|
|
1259
|
-
|
|
1259
|
+
var n =
|
|
1260
1260
|
/**
|
|
1261
1261
|
* Helper function to convert an Uint8array to a binary string.
|
|
1262
1262
|
*/
|
|
1263
1263
|
function(t) {
|
|
1264
1264
|
for (var e = "", n = 0; n < t.length; ++n) e += String.fromCharCode(t[n]);
|
|
1265
1265
|
return e;
|
|
1266
|
-
}(e)
|
|
1266
|
+
}(e);
|
|
1267
|
+
return new t(n);
|
|
1267
1268
|
}, t.prototype.toBase64 = function() {
|
|
1268
1269
|
return t = this.binaryString, btoa(t);
|
|
1269
1270
|
/** Converts a binary string to a Base64 encoded string. */ var t;
|
|
@@ -1275,7 +1276,7 @@ function _t(t, e) {
|
|
|
1275
1276
|
}, t.prototype.approximateByteSize = function() {
|
|
1276
1277
|
return 2 * this.binaryString.length;
|
|
1277
1278
|
}, t.prototype.compareTo = function(t) {
|
|
1278
|
-
return
|
|
1279
|
+
return mt(this.binaryString, t.binaryString);
|
|
1279
1280
|
}, t.prototype.isEqual = function(t) {
|
|
1280
1281
|
return this.binaryString === t.binaryString;
|
|
1281
1282
|
}, t;
|
|
@@ -1322,14 +1323,14 @@ function _t(t, e) {
|
|
|
1322
1323
|
* the proto byte string in a common class that must be converted into a string
|
|
1323
1324
|
* before being sent as a proto.
|
|
1324
1325
|
* @internal
|
|
1325
|
-
*/
|
|
1326
|
+
*/ St.EMPTY_BYTE_STRING = new St("");
|
|
1326
1327
|
|
|
1327
|
-
var
|
|
1328
|
+
var Tt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
1328
1329
|
|
|
1329
1330
|
/**
|
|
1330
1331
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
1331
1332
|
* nanos" representation.
|
|
1332
|
-
*/ function
|
|
1333
|
+
*/ function Et(t) {
|
|
1333
1334
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1334
1335
|
// while the proto js library (for node) will return a
|
|
1335
1336
|
// google.protobuf.Timestamp instance.
|
|
@@ -1337,7 +1338,7 @@ var Et = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1337
1338
|
// The date string can have higher precision (nanos) than the Date class
|
|
1338
1339
|
// (millis), so we do some custom parsing here.
|
|
1339
1340
|
// Parse the nanos right out of the string.
|
|
1340
|
-
var e = 0, n =
|
|
1341
|
+
var e = 0, n = Tt.exec(t);
|
|
1341
1342
|
if (T(!!n), n[1]) {
|
|
1342
1343
|
// Pad the fraction out to 9 digits (nanos).
|
|
1343
1344
|
var r = n[1];
|
|
@@ -1351,21 +1352,21 @@ var Et = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1351
1352
|
};
|
|
1352
1353
|
}
|
|
1353
1354
|
return {
|
|
1354
|
-
seconds:
|
|
1355
|
-
nanos:
|
|
1355
|
+
seconds: It(t.seconds),
|
|
1356
|
+
nanos: It(t.nanos)
|
|
1356
1357
|
};
|
|
1357
1358
|
}
|
|
1358
1359
|
|
|
1359
1360
|
/**
|
|
1360
1361
|
* Converts the possible Proto types for numbers into a JavaScript number.
|
|
1361
1362
|
* Returns 0 if the value is not numeric.
|
|
1362
|
-
*/ function
|
|
1363
|
+
*/ function It(t) {
|
|
1363
1364
|
// TODO(bjornick): Handle int64 greater than 53 bits.
|
|
1364
1365
|
return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0;
|
|
1365
1366
|
}
|
|
1366
1367
|
|
|
1367
|
-
/** Converts the possible Proto types for Blobs into a ByteString. */ function
|
|
1368
|
-
return "string" == typeof t ?
|
|
1368
|
+
/** Converts the possible Proto types for Blobs into a ByteString. */ function At(t) {
|
|
1369
|
+
return "string" == typeof t ? St.fromBase64String(t) : St.fromUint8Array(t);
|
|
1369
1370
|
}
|
|
1370
1371
|
|
|
1371
1372
|
/**
|
|
@@ -1401,7 +1402,7 @@ var Et = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1401
1402
|
* FieldValueOptions to value().
|
|
1402
1403
|
* - With respect to other ServerTimestampValues, they sort by their
|
|
1403
1404
|
* localWriteTime.
|
|
1404
|
-
*/ function
|
|
1405
|
+
*/ function Vt(t) {
|
|
1405
1406
|
var e, n;
|
|
1406
1407
|
return "server_timestamp" === (null === (n = ((null === (e = null == t ? void 0 : t.mapValue) || void 0 === e ? void 0 : e.fields) || {}).__type__) || void 0 === n ? void 0 : n.stringValue);
|
|
1407
1408
|
}
|
|
@@ -1411,16 +1412,16 @@ var Et = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1411
1412
|
*
|
|
1412
1413
|
* Preserving the previous values allows the user to display the last resoled
|
|
1413
1414
|
* value until the backend responds with the timestamp.
|
|
1414
|
-
*/ function
|
|
1415
|
+
*/ function Dt(t) {
|
|
1415
1416
|
var e = t.mapValue.fields.__previous_value__;
|
|
1416
|
-
return
|
|
1417
|
+
return Vt(e) ? Dt(e) : e;
|
|
1417
1418
|
}
|
|
1418
1419
|
|
|
1419
1420
|
/**
|
|
1420
1421
|
* Returns the local time at which this timestamp was first set.
|
|
1421
|
-
*/ function
|
|
1422
|
-
var e =
|
|
1423
|
-
return new
|
|
1422
|
+
*/ function kt(t) {
|
|
1423
|
+
var e = Et(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1424
|
+
return new vt(e.seconds, e.nanos);
|
|
1424
1425
|
}
|
|
1425
1426
|
|
|
1426
1427
|
/**
|
|
@@ -1439,13 +1440,13 @@ var Et = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1439
1440
|
* See the License for the specific language governing permissions and
|
|
1440
1441
|
* limitations under the License.
|
|
1441
1442
|
*/
|
|
1442
|
-
/** Extracts the backend's type order for the provided value. */ function
|
|
1443
|
-
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ?
|
|
1443
|
+
/** Extracts the backend's type order for the provided value. */ function Pt(t) {
|
|
1444
|
+
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Vt(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ : S();
|
|
1444
1445
|
}
|
|
1445
1446
|
|
|
1446
|
-
/** Tests `left` and `right` for equality based on the backend semantics. */ function
|
|
1447
|
-
var n =
|
|
1448
|
-
if (n !==
|
|
1447
|
+
/** Tests `left` and `right` for equality based on the backend semantics. */ function Nt(t, e) {
|
|
1448
|
+
var n = Pt(t);
|
|
1449
|
+
if (n !== Pt(e)) return !1;
|
|
1449
1450
|
switch (n) {
|
|
1450
1451
|
case 0 /* NullValue */ :
|
|
1451
1452
|
return !0;
|
|
@@ -1454,14 +1455,14 @@ var Et = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1454
1455
|
return t.booleanValue === e.booleanValue;
|
|
1455
1456
|
|
|
1456
1457
|
case 4 /* ServerTimestampValue */ :
|
|
1457
|
-
return
|
|
1458
|
+
return kt(t).isEqual(kt(e));
|
|
1458
1459
|
|
|
1459
1460
|
case 3 /* TimestampValue */ :
|
|
1460
1461
|
return function(t, e) {
|
|
1461
1462
|
if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
|
|
1462
1463
|
// Use string equality for ISO 8601 timestamps
|
|
1463
1464
|
return t.timestampValue === e.timestampValue;
|
|
1464
|
-
var n =
|
|
1465
|
+
var n = Et(t.timestampValue), r = Et(e.timestampValue);
|
|
1465
1466
|
return n.seconds === r.seconds && n.nanos === r.nanos;
|
|
1466
1467
|
}(t, e);
|
|
1467
1468
|
|
|
@@ -1470,7 +1471,7 @@ var Et = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1470
1471
|
|
|
1471
1472
|
case 6 /* BlobValue */ :
|
|
1472
1473
|
return function(t, e) {
|
|
1473
|
-
return
|
|
1474
|
+
return At(t.bytesValue).isEqual(At(e.bytesValue));
|
|
1474
1475
|
}(t, e);
|
|
1475
1476
|
|
|
1476
1477
|
case 7 /* RefValue */ :
|
|
@@ -1478,27 +1479,27 @@ var Et = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1478
1479
|
|
|
1479
1480
|
case 8 /* GeoPointValue */ :
|
|
1480
1481
|
return function(t, e) {
|
|
1481
|
-
return
|
|
1482
|
+
return It(t.geoPointValue.latitude) === It(e.geoPointValue.latitude) && It(t.geoPointValue.longitude) === It(e.geoPointValue.longitude);
|
|
1482
1483
|
}(t, e);
|
|
1483
1484
|
|
|
1484
1485
|
case 2 /* NumberValue */ :
|
|
1485
1486
|
return function(t, e) {
|
|
1486
|
-
if ("integerValue" in t && "integerValue" in e) return
|
|
1487
|
+
if ("integerValue" in t && "integerValue" in e) return It(t.integerValue) === It(e.integerValue);
|
|
1487
1488
|
if ("doubleValue" in t && "doubleValue" in e) {
|
|
1488
|
-
var n =
|
|
1489
|
-
return n === r ?
|
|
1489
|
+
var n = It(t.doubleValue), r = It(e.doubleValue);
|
|
1490
|
+
return n === r ? st(n) === st(r) : isNaN(n) && isNaN(r);
|
|
1490
1491
|
}
|
|
1491
1492
|
return !1;
|
|
1492
1493
|
}(t, e);
|
|
1493
1494
|
|
|
1494
1495
|
case 9 /* ArrayValue */ :
|
|
1495
|
-
return
|
|
1496
|
+
return yt(t.arrayValue.values || [], e.arrayValue.values || [], Nt);
|
|
1496
1497
|
|
|
1497
1498
|
case 10 /* ObjectValue */ :
|
|
1498
1499
|
return function(t, e) {
|
|
1499
1500
|
var n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
|
|
1500
|
-
if (
|
|
1501
|
-
for (var i in n) if (n.hasOwnProperty(i) && (void 0 === r[i] || !
|
|
1501
|
+
if (wt(n) !== wt(r)) return !1;
|
|
1502
|
+
for (var i in n) if (n.hasOwnProperty(i) && (void 0 === r[i] || !Nt(n[i], r[i]))) return !1;
|
|
1502
1503
|
return !0;
|
|
1503
1504
|
}(t, e);
|
|
1504
1505
|
|
|
@@ -1507,67 +1508,67 @@ var Et = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1507
1508
|
}
|
|
1508
1509
|
}
|
|
1509
1510
|
|
|
1510
|
-
function
|
|
1511
|
+
function Ft(t, e) {
|
|
1511
1512
|
return void 0 !== (t.values || []).find((function(t) {
|
|
1512
|
-
return
|
|
1513
|
+
return Nt(t, e);
|
|
1513
1514
|
}));
|
|
1514
1515
|
}
|
|
1515
1516
|
|
|
1516
|
-
function
|
|
1517
|
-
var n =
|
|
1518
|
-
if (n !== r) return
|
|
1517
|
+
function Ot(t, e) {
|
|
1518
|
+
var n = Pt(t), r = Pt(e);
|
|
1519
|
+
if (n !== r) return mt(n, r);
|
|
1519
1520
|
switch (n) {
|
|
1520
1521
|
case 0 /* NullValue */ :
|
|
1521
1522
|
return 0;
|
|
1522
1523
|
|
|
1523
1524
|
case 1 /* BooleanValue */ :
|
|
1524
|
-
return
|
|
1525
|
+
return mt(t.booleanValue, e.booleanValue);
|
|
1525
1526
|
|
|
1526
1527
|
case 2 /* NumberValue */ :
|
|
1527
1528
|
return function(t, e) {
|
|
1528
|
-
var n =
|
|
1529
|
+
var n = It(t.integerValue || t.doubleValue), r = It(e.integerValue || e.doubleValue);
|
|
1529
1530
|
return n < r ? -1 : n > r ? 1 : n === r ? 0 :
|
|
1530
1531
|
// one or both are NaN.
|
|
1531
1532
|
isNaN(n) ? isNaN(r) ? 0 : -1 : 1;
|
|
1532
1533
|
}(t, e);
|
|
1533
1534
|
|
|
1534
1535
|
case 3 /* TimestampValue */ :
|
|
1535
|
-
return
|
|
1536
|
+
return qt(t.timestampValue, e.timestampValue);
|
|
1536
1537
|
|
|
1537
1538
|
case 4 /* ServerTimestampValue */ :
|
|
1538
|
-
return
|
|
1539
|
+
return qt(kt(t), kt(e));
|
|
1539
1540
|
|
|
1540
1541
|
case 5 /* StringValue */ :
|
|
1541
|
-
return
|
|
1542
|
+
return mt(t.stringValue, e.stringValue);
|
|
1542
1543
|
|
|
1543
1544
|
case 6 /* BlobValue */ :
|
|
1544
1545
|
return function(t, e) {
|
|
1545
|
-
var n =
|
|
1546
|
+
var n = At(t), r = At(e);
|
|
1546
1547
|
return n.compareTo(r);
|
|
1547
1548
|
}(t.bytesValue, e.bytesValue);
|
|
1548
1549
|
|
|
1549
1550
|
case 7 /* RefValue */ :
|
|
1550
1551
|
return function(t, e) {
|
|
1551
1552
|
for (var n = t.split("/"), r = e.split("/"), i = 0; i < n.length && i < r.length; i++) {
|
|
1552
|
-
var o =
|
|
1553
|
+
var o = mt(n[i], r[i]);
|
|
1553
1554
|
if (0 !== o) return o;
|
|
1554
1555
|
}
|
|
1555
|
-
return
|
|
1556
|
+
return mt(n.length, r.length);
|
|
1556
1557
|
}(t.referenceValue, e.referenceValue);
|
|
1557
1558
|
|
|
1558
1559
|
case 8 /* GeoPointValue */ :
|
|
1559
1560
|
return function(t, e) {
|
|
1560
|
-
var n =
|
|
1561
|
-
return 0 !== n ? n :
|
|
1561
|
+
var n = mt(It(t.latitude), It(e.latitude));
|
|
1562
|
+
return 0 !== n ? n : mt(It(t.longitude), It(e.longitude));
|
|
1562
1563
|
}(t.geoPointValue, e.geoPointValue);
|
|
1563
1564
|
|
|
1564
1565
|
case 9 /* ArrayValue */ :
|
|
1565
1566
|
return function(t, e) {
|
|
1566
1567
|
for (var n = t.values || [], r = e.values || [], i = 0; i < n.length && i < r.length; ++i) {
|
|
1567
|
-
var o =
|
|
1568
|
+
var o = Ot(n[i], r[i]);
|
|
1568
1569
|
if (o) return o;
|
|
1569
1570
|
}
|
|
1570
|
-
return
|
|
1571
|
+
return mt(n.length, r.length);
|
|
1571
1572
|
}(t.arrayValue, e.arrayValue);
|
|
1572
1573
|
|
|
1573
1574
|
case 10 /* ObjectValue */ :
|
|
@@ -1579,12 +1580,12 @@ function qt(t, e) {
|
|
|
1579
1580
|
// canonical IDs are independent of insertion order.
|
|
1580
1581
|
r.sort(), o.sort();
|
|
1581
1582
|
for (var a = 0; a < r.length && a < o.length; ++a) {
|
|
1582
|
-
var s =
|
|
1583
|
+
var s = mt(r[a], o[a]);
|
|
1583
1584
|
if (0 !== s) return s;
|
|
1584
|
-
var u =
|
|
1585
|
+
var u = Ot(n[r[a]], i[o[a]]);
|
|
1585
1586
|
if (0 !== u) return u;
|
|
1586
1587
|
}
|
|
1587
|
-
return
|
|
1588
|
+
return mt(r.length, o.length);
|
|
1588
1589
|
}(t.mapValue, e.mapValue);
|
|
1589
1590
|
|
|
1590
1591
|
default:
|
|
@@ -1592,35 +1593,35 @@ function qt(t, e) {
|
|
|
1592
1593
|
}
|
|
1593
1594
|
}
|
|
1594
1595
|
|
|
1595
|
-
function
|
|
1596
|
-
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return
|
|
1597
|
-
var n =
|
|
1598
|
-
return 0 !== i ? i :
|
|
1596
|
+
function qt(t, e) {
|
|
1597
|
+
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return mt(t, e);
|
|
1598
|
+
var n = Et(t), r = Et(e), i = mt(n.seconds, r.seconds);
|
|
1599
|
+
return 0 !== i ? i : mt(n.nanos, r.nanos);
|
|
1599
1600
|
}
|
|
1600
1601
|
|
|
1601
|
-
function
|
|
1602
|
+
function jt(t, e) {
|
|
1602
1603
|
return {
|
|
1603
1604
|
referenceValue: "projects/" + t.projectId + "/databases/" + t.database + "/documents/" + e.path.canonicalString()
|
|
1604
1605
|
};
|
|
1605
1606
|
}
|
|
1606
1607
|
|
|
1607
|
-
/** Returns true if `value` is an ArrayValue. */ function
|
|
1608
|
+
/** Returns true if `value` is an ArrayValue. */ function Lt(t) {
|
|
1608
1609
|
return !!t && "arrayValue" in t;
|
|
1609
1610
|
}
|
|
1610
1611
|
|
|
1611
|
-
/** Returns true if `value` is a NullValue. */ function
|
|
1612
|
+
/** Returns true if `value` is a NullValue. */ function Rt(t) {
|
|
1612
1613
|
return !!t && "nullValue" in t;
|
|
1613
1614
|
}
|
|
1614
1615
|
|
|
1615
|
-
/** Returns true if `value` is NaN. */ function
|
|
1616
|
+
/** Returns true if `value` is NaN. */ function Ut(t) {
|
|
1616
1617
|
return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
|
|
1617
1618
|
}
|
|
1618
1619
|
|
|
1619
|
-
/** Returns true if `value` is a MapValue. */ function
|
|
1620
|
+
/** Returns true if `value` is a MapValue. */ function xt(t) {
|
|
1620
1621
|
return !!t && "mapValue" in t;
|
|
1621
1622
|
}
|
|
1622
1623
|
|
|
1623
|
-
/** Creates a deep copy of `source`. */ function
|
|
1624
|
+
/** Creates a deep copy of `source`. */ function Bt(t) {
|
|
1624
1625
|
if (t.geoPointValue) return {
|
|
1625
1626
|
geoPointValue: Object.assign({}, t.geoPointValue)
|
|
1626
1627
|
};
|
|
@@ -1633,8 +1634,8 @@ function Lt(t, e) {
|
|
|
1633
1634
|
fields: {}
|
|
1634
1635
|
}
|
|
1635
1636
|
};
|
|
1636
|
-
return
|
|
1637
|
-
return e.mapValue.fields[t] =
|
|
1637
|
+
return bt(t.mapValue.fields, (function(t, n) {
|
|
1638
|
+
return e.mapValue.fields[t] = Bt(n);
|
|
1638
1639
|
})), e;
|
|
1639
1640
|
}
|
|
1640
1641
|
if (t.arrayValue) {
|
|
@@ -1642,7 +1643,7 @@ function Lt(t, e) {
|
|
|
1642
1643
|
arrayValue: {
|
|
1643
1644
|
values: []
|
|
1644
1645
|
}
|
|
1645
|
-
}, r = 0; r < (t.arrayValue.values || []).length; ++r) n.arrayValue.values[r] =
|
|
1646
|
+
}, r = 0; r < (t.arrayValue.values || []).length; ++r) n.arrayValue.values[r] = Bt(t.arrayValue.values[r]);
|
|
1646
1647
|
return n;
|
|
1647
1648
|
}
|
|
1648
1649
|
return Object.assign({}, t);
|
|
@@ -1667,7 +1668,7 @@ function Lt(t, e) {
|
|
|
1667
1668
|
/**
|
|
1668
1669
|
* An ObjectValue represents a MapValue in the Firestore Proto and offers the
|
|
1669
1670
|
* ability to add and remove fields (via the ObjectValueBuilder).
|
|
1670
|
-
*/ var
|
|
1671
|
+
*/ var Ct = /** @class */ function() {
|
|
1671
1672
|
function t(t) {
|
|
1672
1673
|
this.value = t;
|
|
1673
1674
|
}
|
|
@@ -1684,7 +1685,7 @@ function Lt(t, e) {
|
|
|
1684
1685
|
*/
|
|
1685
1686
|
t.prototype.field = function(t) {
|
|
1686
1687
|
if (t.isEmpty()) return this.value;
|
|
1687
|
-
for (var e = this.value, n = 0; n < t.length - 1; ++n) if (!
|
|
1688
|
+
for (var e = this.value, n = 0; n < t.length - 1; ++n) if (!xt(e = (e.mapValue.fields || {})[t.get(n)])) return null;
|
|
1688
1689
|
return (e = (e.mapValue.fields || {})[t.lastSegment()]) || null;
|
|
1689
1690
|
},
|
|
1690
1691
|
/**
|
|
@@ -1694,7 +1695,7 @@ function Lt(t, e) {
|
|
|
1694
1695
|
* @param value - The value to set.
|
|
1695
1696
|
*/
|
|
1696
1697
|
t.prototype.set = function(t, e) {
|
|
1697
|
-
this.getFieldsMap(t.popLast())[t.lastSegment()] =
|
|
1698
|
+
this.getFieldsMap(t.popLast())[t.lastSegment()] = Bt(e);
|
|
1698
1699
|
},
|
|
1699
1700
|
/**
|
|
1700
1701
|
* Sets the provided fields to the provided values.
|
|
@@ -1702,14 +1703,14 @@ function Lt(t, e) {
|
|
|
1702
1703
|
* @param data - A map of fields to values (or null for deletes).
|
|
1703
1704
|
*/
|
|
1704
1705
|
t.prototype.setAll = function(t) {
|
|
1705
|
-
var e = this, n =
|
|
1706
|
+
var e = this, n = J.emptyPath(), r = {}, i = [];
|
|
1706
1707
|
t.forEach((function(t, o) {
|
|
1707
1708
|
if (!n.isImmediateParentOf(o)) {
|
|
1708
1709
|
// Insert the accumulated changes at this parent location
|
|
1709
1710
|
var a = e.getFieldsMap(n);
|
|
1710
1711
|
e.applyChanges(a, r, i), r = {}, i = [], n = o.popLast();
|
|
1711
1712
|
}
|
|
1712
|
-
t ? r[o.lastSegment()] =
|
|
1713
|
+
t ? r[o.lastSegment()] = Bt(t) : i.push(o.lastSegment());
|
|
1713
1714
|
}));
|
|
1714
1715
|
var o = this.getFieldsMap(n);
|
|
1715
1716
|
this.applyChanges(o, r, i);
|
|
@@ -1722,9 +1723,9 @@ function Lt(t, e) {
|
|
|
1722
1723
|
*/
|
|
1723
1724
|
t.prototype.delete = function(t) {
|
|
1724
1725
|
var e = this.field(t.popLast());
|
|
1725
|
-
|
|
1726
|
+
xt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
|
|
1726
1727
|
}, t.prototype.isEqual = function(t) {
|
|
1727
|
-
return
|
|
1728
|
+
return Nt(this.value, t.value);
|
|
1728
1729
|
},
|
|
1729
1730
|
/**
|
|
1730
1731
|
* Returns the map that contains the leaf element of `path`. If the parent
|
|
@@ -1737,7 +1738,7 @@ function Lt(t, e) {
|
|
|
1737
1738
|
});
|
|
1738
1739
|
for (var n = 0; n < t.length; ++n) {
|
|
1739
1740
|
var r = e.mapValue.fields[t.get(n)];
|
|
1740
|
-
|
|
1741
|
+
xt(r) && r.mapValue.fields || (r = {
|
|
1741
1742
|
mapValue: {
|
|
1742
1743
|
fields: {}
|
|
1743
1744
|
}
|
|
@@ -1750,7 +1751,7 @@ function Lt(t, e) {
|
|
|
1750
1751
|
* entries.
|
|
1751
1752
|
*/
|
|
1752
1753
|
t.prototype.applyChanges = function(t, e, n) {
|
|
1753
|
-
|
|
1754
|
+
bt(e, (function(e, n) {
|
|
1754
1755
|
return t[e] = n;
|
|
1755
1756
|
}));
|
|
1756
1757
|
for (var r = 0, i = n; r < i.length; r++) {
|
|
@@ -1758,9 +1759,9 @@ function Lt(t, e) {
|
|
|
1758
1759
|
delete t[o];
|
|
1759
1760
|
}
|
|
1760
1761
|
}, t.prototype.clone = function() {
|
|
1761
|
-
return new t(
|
|
1762
|
+
return new t(Bt(this.value));
|
|
1762
1763
|
}, t;
|
|
1763
|
-
}(),
|
|
1764
|
+
}(), Mt = /** @class */ function() {
|
|
1764
1765
|
function t(t, e, n, r, i) {
|
|
1765
1766
|
this.key = t, this.documentType = e, this.version = n, this.data = r, this.documentState = i
|
|
1766
1767
|
/**
|
|
@@ -1769,7 +1770,7 @@ function Lt(t, e) {
|
|
|
1769
1770
|
*/;
|
|
1770
1771
|
}
|
|
1771
1772
|
return t.newInvalidDocument = function(e) {
|
|
1772
|
-
return new t(e, 0 /* INVALID */ ,
|
|
1773
|
+
return new t(e, 0 /* INVALID */ , gt.min(), Ct.empty(), 0 /* SYNCED */);
|
|
1773
1774
|
},
|
|
1774
1775
|
/**
|
|
1775
1776
|
* Creates a new document that is known to exist with the given data at the
|
|
@@ -1779,7 +1780,7 @@ function Lt(t, e) {
|
|
|
1779
1780
|
return new t(e, 1 /* FOUND_DOCUMENT */ , n, r, 0 /* SYNCED */);
|
|
1780
1781
|
},
|
|
1781
1782
|
/** Creates a new document that is known to not exist at the given version. */ t.newNoDocument = function(e, n) {
|
|
1782
|
-
return new t(e, 2 /* NO_DOCUMENT */ , n,
|
|
1783
|
+
return new t(e, 2 /* NO_DOCUMENT */ , n, Ct.empty(), 0 /* SYNCED */);
|
|
1783
1784
|
},
|
|
1784
1785
|
/**
|
|
1785
1786
|
* Creates a new document that is known to exist at the given version but
|
|
@@ -1787,7 +1788,7 @@ function Lt(t, e) {
|
|
|
1787
1788
|
* base document).
|
|
1788
1789
|
*/
|
|
1789
1790
|
t.newUnknownDocument = function(e, n) {
|
|
1790
|
-
return new t(e, 3 /* UNKNOWN_DOCUMENT */ , n,
|
|
1791
|
+
return new t(e, 3 /* UNKNOWN_DOCUMENT */ , n, Ct.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
1791
1792
|
},
|
|
1792
1793
|
/**
|
|
1793
1794
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -1802,7 +1803,7 @@ function Lt(t, e) {
|
|
|
1802
1803
|
* version.
|
|
1803
1804
|
*/
|
|
1804
1805
|
t.prototype.convertToNoDocument = function(t) {
|
|
1805
|
-
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data =
|
|
1806
|
+
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Ct.empty(),
|
|
1806
1807
|
this.documentState = 0 /* SYNCED */ , this;
|
|
1807
1808
|
},
|
|
1808
1809
|
/**
|
|
@@ -1811,7 +1812,7 @@ function Lt(t, e) {
|
|
|
1811
1812
|
* base document).
|
|
1812
1813
|
*/
|
|
1813
1814
|
t.prototype.convertToUnknownDocument = function(t) {
|
|
1814
|
-
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data =
|
|
1815
|
+
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Ct.empty(),
|
|
1815
1816
|
this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
1816
1817
|
}, t.prototype.setHasCommittedMutations = function() {
|
|
1817
1818
|
return this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
@@ -1850,7 +1851,7 @@ function Lt(t, e) {
|
|
|
1850
1851
|
}, t.prototype.toString = function() {
|
|
1851
1852
|
return "Document(" + this.key + ", " + this.version + ", " + JSON.stringify(this.data.value) + ", {documentType: " + this.documentType + "}), {documentState: " + this.documentState + "})";
|
|
1852
1853
|
}, t;
|
|
1853
|
-
}(),
|
|
1854
|
+
}(), Gt = function(t, e, n, r, i, o, a) {
|
|
1854
1855
|
void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
|
|
1855
1856
|
void 0 === i && (i = null), void 0 === o && (o = null), void 0 === a && (a = null),
|
|
1856
1857
|
this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = i,
|
|
@@ -1891,13 +1892,13 @@ function Lt(t, e) {
|
|
|
1891
1892
|
* using this factory method, because `Query` provides an implicit `orderBy`
|
|
1892
1893
|
* property.
|
|
1893
1894
|
*/
|
|
1894
|
-
function
|
|
1895
|
+
function Qt(t, e, n, r, i, o, a) {
|
|
1895
1896
|
return void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
|
|
1896
1897
|
void 0 === i && (i = null), void 0 === o && (o = null), void 0 === a && (a = null),
|
|
1897
|
-
new
|
|
1898
|
+
new Gt(t, e, n, r, i, o, a);
|
|
1898
1899
|
}
|
|
1899
1900
|
|
|
1900
|
-
var
|
|
1901
|
+
var zt = /** @class */ function(e) {
|
|
1901
1902
|
function n(t, n, r) {
|
|
1902
1903
|
var i = this;
|
|
1903
1904
|
return (i = e.call(this) || this).field = t, i.op = n, i.value = r, i;
|
|
@@ -1905,13 +1906,13 @@ var Ht = /** @class */ function(e) {
|
|
|
1905
1906
|
/**
|
|
1906
1907
|
* Creates a filter based on the provided arguments.
|
|
1907
1908
|
*/ return t(n, e), n.create = function(t, e, r) {
|
|
1908
|
-
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.R(t, e, r) : new
|
|
1909
|
+
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.R(t, e, r) : new Ht(t, e, r) : "array-contains" /* ARRAY_CONTAINS */ === e ? new Xt(t, r) : "in" /* IN */ === e ? new $t(t, r) : "not-in" /* NOT_IN */ === e ? new Jt(t, r) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new Zt(t, r) : new n(t, e, r);
|
|
1909
1910
|
}, n.R = function(t, e, n) {
|
|
1910
|
-
return "in" /* IN */ === e ? new
|
|
1911
|
+
return "in" /* IN */ === e ? new Kt(t, n) : new Wt(t, n);
|
|
1911
1912
|
}, n.prototype.matches = function(t) {
|
|
1912
1913
|
var e = t.data.field(this.field);
|
|
1913
1914
|
// Types do not have to match in NOT_EQUAL filters.
|
|
1914
|
-
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.V(
|
|
1915
|
+
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.V(Ot(e, this.value)) : null !== e && Pt(this.value) === Pt(e) && this.V(Ot(e, this.value));
|
|
1915
1916
|
// Only compare types with matching backend order (such as double and int).
|
|
1916
1917
|
}, n.prototype.V = function(t) {
|
|
1917
1918
|
switch (this.op) {
|
|
@@ -1936,23 +1937,22 @@ var Ht = /** @class */ function(e) {
|
|
|
1936
1937
|
default:
|
|
1937
1938
|
return S();
|
|
1938
1939
|
}
|
|
1939
|
-
}, n.prototype.
|
|
1940
|
+
}, n.prototype.D = function() {
|
|
1940
1941
|
return [ "<" /* LESS_THAN */ , "<=" /* LESS_THAN_OR_EQUAL */ , ">" /* GREATER_THAN */ , ">=" /* GREATER_THAN_OR_EQUAL */ , "!=" /* NOT_EQUAL */ , "not-in" /* NOT_IN */ ].indexOf(this.op) >= 0;
|
|
1941
1942
|
}, n;
|
|
1942
|
-
}((function() {})),
|
|
1943
|
+
}((function() {})), Ht = /** @class */ function(e) {
|
|
1943
1944
|
function n(t, n, r) {
|
|
1944
1945
|
var i = this;
|
|
1945
|
-
return (i = e.call(this, t, n, r) || this).key =
|
|
1946
|
-
i;
|
|
1946
|
+
return (i = e.call(this, t, n, r) || this).key = Z.fromName(r.referenceValue), i;
|
|
1947
1947
|
}
|
|
1948
1948
|
return t(n, e), n.prototype.matches = function(t) {
|
|
1949
|
-
var e =
|
|
1949
|
+
var e = Z.comparator(t.key, this.key);
|
|
1950
1950
|
return this.V(e);
|
|
1951
1951
|
}, n;
|
|
1952
|
-
}(
|
|
1952
|
+
}(zt), Kt = /** @class */ function(e) {
|
|
1953
1953
|
function n(t, n) {
|
|
1954
1954
|
var r = this;
|
|
1955
|
-
return (r = e.call(this, t, "in" /* IN */ , n) || this).keys =
|
|
1955
|
+
return (r = e.call(this, t, "in" /* IN */ , n) || this).keys = Yt("in" /* IN */ , n),
|
|
1956
1956
|
r;
|
|
1957
1957
|
}
|
|
1958
1958
|
return t(n, e), n.prototype.matches = function(t) {
|
|
@@ -1960,10 +1960,10 @@ var Ht = /** @class */ function(e) {
|
|
|
1960
1960
|
return e.isEqual(t.key);
|
|
1961
1961
|
}));
|
|
1962
1962
|
}, n;
|
|
1963
|
-
}(
|
|
1963
|
+
}(zt), Wt = /** @class */ function(e) {
|
|
1964
1964
|
function n(t, n) {
|
|
1965
1965
|
var r = this;
|
|
1966
|
-
return (r = e.call(this, t, "not-in" /* NOT_IN */ , n) || this).keys =
|
|
1966
|
+
return (r = e.call(this, t, "not-in" /* NOT_IN */ , n) || this).keys = Yt("not-in" /* NOT_IN */ , n),
|
|
1967
1967
|
r;
|
|
1968
1968
|
}
|
|
1969
1969
|
return t(n, e), n.prototype.matches = function(t) {
|
|
@@ -1971,67 +1971,67 @@ var Ht = /** @class */ function(e) {
|
|
|
1971
1971
|
return e.isEqual(t.key);
|
|
1972
1972
|
}));
|
|
1973
1973
|
}, n;
|
|
1974
|
-
}(
|
|
1974
|
+
}(zt);
|
|
1975
1975
|
|
|
1976
|
-
/** Filter that matches on key fields (i.e. '__name__'). */ function
|
|
1976
|
+
/** Filter that matches on key fields (i.e. '__name__'). */ function Yt(t, e) {
|
|
1977
1977
|
var n;
|
|
1978
1978
|
return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((function(t) {
|
|
1979
|
-
return
|
|
1979
|
+
return Z.fromName(t.referenceValue);
|
|
1980
1980
|
}));
|
|
1981
1981
|
}
|
|
1982
1982
|
|
|
1983
|
-
/** A Filter that implements the array-contains operator. */ var
|
|
1983
|
+
/** A Filter that implements the array-contains operator. */ var Xt = /** @class */ function(e) {
|
|
1984
1984
|
function n(t, n) {
|
|
1985
1985
|
return e.call(this, t, "array-contains" /* ARRAY_CONTAINS */ , n) || this;
|
|
1986
1986
|
}
|
|
1987
1987
|
return t(n, e), n.prototype.matches = function(t) {
|
|
1988
1988
|
var e = t.data.field(this.field);
|
|
1989
|
-
return
|
|
1989
|
+
return Lt(e) && Ft(e.arrayValue, this.value);
|
|
1990
1990
|
}, n;
|
|
1991
|
-
}(
|
|
1991
|
+
}(zt), $t = /** @class */ function(e) {
|
|
1992
1992
|
function n(t, n) {
|
|
1993
1993
|
return e.call(this, t, "in" /* IN */ , n) || this;
|
|
1994
1994
|
}
|
|
1995
1995
|
return t(n, e), n.prototype.matches = function(t) {
|
|
1996
1996
|
var e = t.data.field(this.field);
|
|
1997
|
-
return null !== e &&
|
|
1997
|
+
return null !== e && Ft(this.value.arrayValue, e);
|
|
1998
1998
|
}, n;
|
|
1999
|
-
}(
|
|
1999
|
+
}(zt), Jt = /** @class */ function(e) {
|
|
2000
2000
|
function n(t, n) {
|
|
2001
2001
|
return e.call(this, t, "not-in" /* NOT_IN */ , n) || this;
|
|
2002
2002
|
}
|
|
2003
2003
|
return t(n, e), n.prototype.matches = function(t) {
|
|
2004
|
-
if (
|
|
2004
|
+
if (Ft(this.value.arrayValue, {
|
|
2005
2005
|
nullValue: "NULL_VALUE"
|
|
2006
2006
|
})) return !1;
|
|
2007
2007
|
var e = t.data.field(this.field);
|
|
2008
|
-
return null !== e && !
|
|
2008
|
+
return null !== e && !Ft(this.value.arrayValue, e);
|
|
2009
2009
|
}, n;
|
|
2010
|
-
}(
|
|
2010
|
+
}(zt), Zt = /** @class */ function(e) {
|
|
2011
2011
|
function n(t, n) {
|
|
2012
2012
|
return e.call(this, t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , n) || this;
|
|
2013
2013
|
}
|
|
2014
2014
|
return t(n, e), n.prototype.matches = function(t) {
|
|
2015
2015
|
var e = this, n = t.data.field(this.field);
|
|
2016
|
-
return !(!
|
|
2017
|
-
return
|
|
2016
|
+
return !(!Lt(n) || !n.arrayValue.values) && n.arrayValue.values.some((function(t) {
|
|
2017
|
+
return Ft(e.value.arrayValue, t);
|
|
2018
2018
|
}));
|
|
2019
2019
|
}, n;
|
|
2020
|
-
}(
|
|
2020
|
+
}(zt), te = function(t, e) {
|
|
2021
2021
|
this.position = t, this.before = e;
|
|
2022
|
-
},
|
|
2022
|
+
}, ee = function(t, e /* ASCENDING */) {
|
|
2023
2023
|
void 0 === e && (e = "asc"), this.field = t, this.dir = e;
|
|
2024
2024
|
};
|
|
2025
2025
|
|
|
2026
|
-
/** A Filter that implements the IN operator. */ function
|
|
2026
|
+
/** A Filter that implements the IN operator. */ function ne(t, e) {
|
|
2027
2027
|
return t.dir === e.dir && t.field.isEqual(e.field);
|
|
2028
2028
|
}
|
|
2029
2029
|
|
|
2030
|
-
function
|
|
2030
|
+
function re(t, e) {
|
|
2031
2031
|
if (null === t) return null === e;
|
|
2032
2032
|
if (null === e) return !1;
|
|
2033
2033
|
if (t.before !== e.before || t.position.length !== e.position.length) return !1;
|
|
2034
|
-
for (var n = 0; n < t.position.length; n++) if (!
|
|
2034
|
+
for (var n = 0; n < t.position.length; n++) if (!Nt(t.position[n], e.position[n])) return !1;
|
|
2035
2035
|
return !0;
|
|
2036
2036
|
}
|
|
2037
2037
|
|
|
@@ -2057,7 +2057,7 @@ function ie(t, e) {
|
|
|
2057
2057
|
* query the RemoteStore results.
|
|
2058
2058
|
*
|
|
2059
2059
|
* Visible for testing.
|
|
2060
|
-
*/ var
|
|
2060
|
+
*/ var ie =
|
|
2061
2061
|
/**
|
|
2062
2062
|
* Initializes a Query with a path and optional additional query constraints.
|
|
2063
2063
|
* Path must currently be empty if this is a collection group query.
|
|
@@ -2067,23 +2067,23 @@ function(t, e, n, r, i, o /* First */ , a, s) {
|
|
|
2067
2067
|
void 0 === i && (i = null), void 0 === o && (o = "F"), void 0 === a && (a = null),
|
|
2068
2068
|
void 0 === s && (s = null), this.path = t, this.collectionGroup = e, this.explicitOrderBy = n,
|
|
2069
2069
|
this.filters = r, this.limit = i, this.limitType = o, this.startAt = a, this.endAt = s,
|
|
2070
|
-
this.
|
|
2070
|
+
this.N = null,
|
|
2071
2071
|
// The corresponding `Target` of this `Query` instance.
|
|
2072
2072
|
this.$ = null, this.startAt, this.endAt;
|
|
2073
2073
|
};
|
|
2074
2074
|
|
|
2075
|
-
/** Creates a new Query for a query that matches all documents at `path` */ function
|
|
2076
|
-
return !
|
|
2075
|
+
/** Creates a new Query for a query that matches all documents at `path` */ function oe(t) {
|
|
2076
|
+
return !at(t.limit) && "L" /* Last */ === t.limitType;
|
|
2077
2077
|
}
|
|
2078
2078
|
|
|
2079
|
-
function
|
|
2079
|
+
function ae(t) {
|
|
2080
2080
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
2081
2081
|
}
|
|
2082
2082
|
|
|
2083
|
-
function
|
|
2083
|
+
function se(t) {
|
|
2084
2084
|
for (var e = 0, n = t.filters; e < n.length; e++) {
|
|
2085
2085
|
var r = n[e];
|
|
2086
|
-
if (r.
|
|
2086
|
+
if (r.D()) return r.field;
|
|
2087
2087
|
}
|
|
2088
2088
|
return null;
|
|
2089
2089
|
}
|
|
@@ -2095,7 +2095,7 @@ function ue(t) {
|
|
|
2095
2095
|
/**
|
|
2096
2096
|
* Returns whether the query matches a collection group rather than a specific
|
|
2097
2097
|
* collection.
|
|
2098
|
-
*/ function
|
|
2098
|
+
*/ function ue(t) {
|
|
2099
2099
|
return null !== t.collectionGroup;
|
|
2100
2100
|
}
|
|
2101
2101
|
|
|
@@ -2103,46 +2103,46 @@ function ue(t) {
|
|
|
2103
2103
|
* Returns the implicit order by constraint that is used to execute the Query,
|
|
2104
2104
|
* which can be different from the order by constraints the user provided (e.g.
|
|
2105
2105
|
* the SDK and backend always orders by `__name__`).
|
|
2106
|
-
*/ function
|
|
2106
|
+
*/ function ce(t) {
|
|
2107
2107
|
var e = E(t);
|
|
2108
|
-
if (null === e.
|
|
2109
|
-
e.
|
|
2110
|
-
var n =
|
|
2108
|
+
if (null === e.N) {
|
|
2109
|
+
e.N = [];
|
|
2110
|
+
var n = se(e), r = ae(e);
|
|
2111
2111
|
if (null !== n && null === r)
|
|
2112
2112
|
// In order to implicitly add key ordering, we must also add the
|
|
2113
2113
|
// inequality filter field for it to be a valid query.
|
|
2114
2114
|
// Note that the default inequality field and key ordering is ascending.
|
|
2115
|
-
n.isKeyField() || e.
|
|
2115
|
+
n.isKeyField() || e.N.push(new ee(n)), e.N.push(new ee(J.keyField(), "asc" /* ASCENDING */)); else {
|
|
2116
2116
|
for (var i = !1, o = 0, a = e.explicitOrderBy; o < a.length; o++) {
|
|
2117
2117
|
var s = a[o];
|
|
2118
|
-
e.
|
|
2118
|
+
e.N.push(s), s.field.isKeyField() && (i = !0);
|
|
2119
2119
|
}
|
|
2120
2120
|
if (!i) {
|
|
2121
2121
|
// The order of the implicit key ordering always matches the last
|
|
2122
2122
|
// explicit order by
|
|
2123
2123
|
var u = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
|
|
2124
|
-
e.
|
|
2124
|
+
e.N.push(new ee(J.keyField(), u));
|
|
2125
2125
|
}
|
|
2126
2126
|
}
|
|
2127
2127
|
}
|
|
2128
|
-
return e.
|
|
2128
|
+
return e.N;
|
|
2129
2129
|
}
|
|
2130
2130
|
|
|
2131
2131
|
/**
|
|
2132
2132
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2133
|
-
*/ function
|
|
2133
|
+
*/ function fe(t) {
|
|
2134
2134
|
var e = E(t);
|
|
2135
|
-
if (!e.$) if ("F" /* First */ === e.limitType) e.$ =
|
|
2135
|
+
if (!e.$) if ("F" /* First */ === e.limitType) e.$ = Qt(e.path, e.collectionGroup, ce(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
2136
2136
|
for (
|
|
2137
2137
|
// Flip the orderBy directions since we want the last results
|
|
2138
|
-
var n = [], r = 0, i =
|
|
2138
|
+
var n = [], r = 0, i = ce(e); r < i.length; r++) {
|
|
2139
2139
|
var o = i[r], a = "desc" /* DESCENDING */ === o.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
|
|
2140
|
-
n.push(new
|
|
2140
|
+
n.push(new ee(o.field, a));
|
|
2141
2141
|
}
|
|
2142
2142
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2143
|
-
var s = e.endAt ? new
|
|
2143
|
+
var s = e.endAt ? new te(e.endAt.position, !e.endAt.before) : null, u = e.startAt ? new te(e.startAt.position, !e.startAt.before) : null;
|
|
2144
2144
|
// Now return as a LimitType.First query.
|
|
2145
|
-
e.$ =
|
|
2145
|
+
e.$ = Qt(e.path, e.collectionGroup, n, e.filters, e.limit, s, u);
|
|
2146
2146
|
}
|
|
2147
2147
|
return e.$;
|
|
2148
2148
|
}
|
|
@@ -2172,9 +2172,9 @@ function ue(t) {
|
|
|
2172
2172
|
* The return value is an IntegerValue if it can safely represent the value,
|
|
2173
2173
|
* otherwise a DoubleValue is returned.
|
|
2174
2174
|
*/
|
|
2175
|
-
function
|
|
2175
|
+
function le(t, e) {
|
|
2176
2176
|
return function(t) {
|
|
2177
|
-
return "number" == typeof t && Number.isInteger(t) && !
|
|
2177
|
+
return "number" == typeof t && Number.isInteger(t) && !st(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
|
|
2178
2178
|
}(e) ?
|
|
2179
2179
|
/**
|
|
2180
2180
|
* Returns an IntegerValue for `value`.
|
|
@@ -2196,7 +2196,7 @@ function he(t, e) {
|
|
|
2196
2196
|
};
|
|
2197
2197
|
}
|
|
2198
2198
|
return {
|
|
2199
|
-
doubleValue:
|
|
2199
|
+
doubleValue: st(e) ? "-0" : e
|
|
2200
2200
|
};
|
|
2201
2201
|
}(t, e);
|
|
2202
2202
|
}
|
|
@@ -2217,7 +2217,7 @@ function he(t, e) {
|
|
|
2217
2217
|
* See the License for the specific language governing permissions and
|
|
2218
2218
|
* limitations under the License.
|
|
2219
2219
|
*/
|
|
2220
|
-
/** Used to represent a field transform on a mutation. */ var
|
|
2220
|
+
/** Used to represent a field transform on a mutation. */ var he = function() {
|
|
2221
2221
|
// Make sure that the structural type of `TransformOperation` is unique.
|
|
2222
2222
|
// See https://github.com/microsoft/TypeScript/issues/5451
|
|
2223
2223
|
this._ = void 0;
|
|
@@ -2226,27 +2226,27 @@ function he(t, e) {
|
|
|
2226
2226
|
return null !== e && e.apply(this, arguments) || this;
|
|
2227
2227
|
}
|
|
2228
2228
|
return t(n, e), n;
|
|
2229
|
-
}(
|
|
2229
|
+
}(he), pe = /** @class */ function(e) {
|
|
2230
2230
|
function n(t) {
|
|
2231
2231
|
var n = this;
|
|
2232
2232
|
return (n = e.call(this) || this).elements = t, n;
|
|
2233
2233
|
}
|
|
2234
2234
|
return t(n, e), n;
|
|
2235
|
-
}(
|
|
2235
|
+
}(he), me = /** @class */ function(e) {
|
|
2236
2236
|
function n(t) {
|
|
2237
2237
|
var n = this;
|
|
2238
2238
|
return (n = e.call(this) || this).elements = t, n;
|
|
2239
2239
|
}
|
|
2240
2240
|
return t(n, e), n;
|
|
2241
|
-
}(
|
|
2241
|
+
}(he), ye = /** @class */ function(e) {
|
|
2242
2242
|
function n(t, n) {
|
|
2243
2243
|
var r = this;
|
|
2244
2244
|
return (r = e.call(this) || this).S = t, r.q = n, r;
|
|
2245
2245
|
}
|
|
2246
2246
|
return t(n, e), n;
|
|
2247
|
-
}(
|
|
2247
|
+
}(he), ve = function(t, e) {
|
|
2248
2248
|
this.field = t, this.transform = e;
|
|
2249
|
-
},
|
|
2249
|
+
}, ge = /** @class */ function() {
|
|
2250
2250
|
function t(t, e) {
|
|
2251
2251
|
this.updateTime = t, this.exists = e
|
|
2252
2252
|
/** Creates a new empty Precondition. */;
|
|
@@ -2268,7 +2268,7 @@ function he(t, e) {
|
|
|
2268
2268
|
}), t.prototype.isEqual = function(t) {
|
|
2269
2269
|
return this.exists === t.exists && (this.updateTime ? !!t.updateTime && this.updateTime.isEqual(t.updateTime) : !t.updateTime);
|
|
2270
2270
|
}, t;
|
|
2271
|
-
}(),
|
|
2271
|
+
}(), we = function() {}, be = /** @class */ function(e) {
|
|
2272
2272
|
function n(t, n, r, i) {
|
|
2273
2273
|
void 0 === i && (i = []);
|
|
2274
2274
|
var o = this;
|
|
@@ -2276,7 +2276,7 @@ function he(t, e) {
|
|
|
2276
2276
|
o.type = 0 /* Set */ , o;
|
|
2277
2277
|
}
|
|
2278
2278
|
return t(n, e), n;
|
|
2279
|
-
}(
|
|
2279
|
+
}(we), _e = /** @class */ function(e) {
|
|
2280
2280
|
function n(t, n, r, i, o) {
|
|
2281
2281
|
void 0 === o && (o = []);
|
|
2282
2282
|
var a = this;
|
|
@@ -2284,24 +2284,24 @@ function he(t, e) {
|
|
|
2284
2284
|
a.fieldTransforms = o, a.type = 1 /* Patch */ , a;
|
|
2285
2285
|
}
|
|
2286
2286
|
return t(n, e), n;
|
|
2287
|
-
}(
|
|
2287
|
+
}(we), Se = /** @class */ function(e) {
|
|
2288
2288
|
function n(t, n) {
|
|
2289
2289
|
var r = this;
|
|
2290
2290
|
return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 2 /* Delete */ ,
|
|
2291
2291
|
r.fieldTransforms = [], r;
|
|
2292
2292
|
}
|
|
2293
2293
|
return t(n, e), n;
|
|
2294
|
-
}(
|
|
2294
|
+
}(we), Te = /** @class */ function(e) {
|
|
2295
2295
|
function n(t, n) {
|
|
2296
2296
|
var r = this;
|
|
2297
2297
|
return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 3 /* Verify */ ,
|
|
2298
2298
|
r.fieldTransforms = [], r;
|
|
2299
2299
|
}
|
|
2300
2300
|
return t(n, e), n;
|
|
2301
|
-
}(
|
|
2301
|
+
}(we), Ee = {
|
|
2302
2302
|
asc: "ASCENDING",
|
|
2303
2303
|
desc: "DESCENDING"
|
|
2304
|
-
},
|
|
2304
|
+
}, Ie = {
|
|
2305
2305
|
"<": "LESS_THAN",
|
|
2306
2306
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
2307
2307
|
">": "GREATER_THAN",
|
|
@@ -2312,7 +2312,7 @@ function he(t, e) {
|
|
|
2312
2312
|
in: "IN",
|
|
2313
2313
|
"not-in": "NOT_IN",
|
|
2314
2314
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
2315
|
-
},
|
|
2315
|
+
}, Ae = function(t, e) {
|
|
2316
2316
|
this.databaseId = t, this.F = e;
|
|
2317
2317
|
};
|
|
2318
2318
|
|
|
@@ -2328,7 +2328,7 @@ function he(t, e) {
|
|
|
2328
2328
|
/**
|
|
2329
2329
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
2330
2330
|
*/
|
|
2331
|
-
function
|
|
2331
|
+
function Ve(t, e) {
|
|
2332
2332
|
return t.F ? new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "") + "." + ("000000000" + e.nanoseconds).slice(-9) + "Z" : {
|
|
2333
2333
|
seconds: "" + e.seconds,
|
|
2334
2334
|
nanos: e.nanoseconds
|
|
@@ -2339,57 +2339,57 @@ function De(t, e) {
|
|
|
2339
2339
|
* Returns a value for bytes that's appropriate to put in a proto.
|
|
2340
2340
|
*
|
|
2341
2341
|
* Visible for testing.
|
|
2342
|
-
*/ function
|
|
2342
|
+
*/ function De(t, e) {
|
|
2343
2343
|
return t.F ? e.toBase64() : e.toUint8Array();
|
|
2344
2344
|
}
|
|
2345
2345
|
|
|
2346
|
-
function
|
|
2347
|
-
return
|
|
2346
|
+
function ke(t, e) {
|
|
2347
|
+
return Ve(t, e.toTimestamp());
|
|
2348
2348
|
}
|
|
2349
2349
|
|
|
2350
|
-
function
|
|
2351
|
-
return T(!!t),
|
|
2352
|
-
var e =
|
|
2353
|
-
return new
|
|
2350
|
+
function Pe(t) {
|
|
2351
|
+
return T(!!t), gt.fromTimestamp(function(t) {
|
|
2352
|
+
var e = Et(t);
|
|
2353
|
+
return new vt(e.seconds, e.nanos);
|
|
2354
2354
|
}(t));
|
|
2355
2355
|
}
|
|
2356
2356
|
|
|
2357
|
-
function
|
|
2357
|
+
function Ne(t, e) {
|
|
2358
2358
|
return function(t) {
|
|
2359
|
-
return new
|
|
2359
|
+
return new X([ "projects", t.projectId, "databases", t.database ]);
|
|
2360
2360
|
}(t).child("documents").child(e).canonicalString();
|
|
2361
2361
|
}
|
|
2362
2362
|
|
|
2363
|
-
function
|
|
2364
|
-
return
|
|
2363
|
+
function Fe(t, e) {
|
|
2364
|
+
return Ne(t.databaseId, e.path);
|
|
2365
2365
|
}
|
|
2366
2366
|
|
|
2367
|
-
function
|
|
2367
|
+
function Oe(t, e) {
|
|
2368
2368
|
var n, r = function(t) {
|
|
2369
|
-
var e =
|
|
2370
|
-
return T(
|
|
2369
|
+
var e = X.fromString(t);
|
|
2370
|
+
return T(Me(e)), e;
|
|
2371
2371
|
}(e);
|
|
2372
|
-
if (r.get(1) !== t.databaseId.projectId) throw new
|
|
2373
|
-
if (r.get(3) !== t.databaseId.database) throw new
|
|
2374
|
-
return new
|
|
2372
|
+
if (r.get(1) !== t.databaseId.projectId) throw new x(V, "Tried to deserialize key from different project: " + r.get(1) + " vs " + t.databaseId.projectId);
|
|
2373
|
+
if (r.get(3) !== t.databaseId.database) throw new x(V, "Tried to deserialize key from different database: " + r.get(3) + " vs " + t.databaseId.database);
|
|
2374
|
+
return new Z((T((n = r).length > 4 && "documents" === n.get(4)), n.popFirst(5)));
|
|
2375
2375
|
}
|
|
2376
2376
|
|
|
2377
|
-
function
|
|
2378
|
-
return
|
|
2377
|
+
function qe(t, e) {
|
|
2378
|
+
return Ne(t.databaseId, e);
|
|
2379
2379
|
}
|
|
2380
2380
|
|
|
2381
|
-
function
|
|
2382
|
-
return new
|
|
2381
|
+
function je(t) {
|
|
2382
|
+
return new X([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
2383
2383
|
}
|
|
2384
2384
|
|
|
2385
|
-
function
|
|
2385
|
+
function Le(t, e, n) {
|
|
2386
2386
|
return {
|
|
2387
|
-
name:
|
|
2387
|
+
name: Fe(t, e),
|
|
2388
2388
|
fields: n.value.mapValue.fields
|
|
2389
2389
|
};
|
|
2390
2390
|
}
|
|
2391
2391
|
|
|
2392
|
-
function
|
|
2392
|
+
function Re(t) {
|
|
2393
2393
|
return {
|
|
2394
2394
|
before: t.before,
|
|
2395
2395
|
values: t.position
|
|
@@ -2397,22 +2397,22 @@ function Ue(t) {
|
|
|
2397
2397
|
}
|
|
2398
2398
|
|
|
2399
2399
|
// visible for testing
|
|
2400
|
-
function
|
|
2401
|
-
return
|
|
2400
|
+
function Ue(t) {
|
|
2401
|
+
return Ee[t];
|
|
2402
2402
|
}
|
|
2403
2403
|
|
|
2404
2404
|
// visible for testing
|
|
2405
|
-
function
|
|
2406
|
-
return
|
|
2405
|
+
function xe(t) {
|
|
2406
|
+
return Ie[t];
|
|
2407
2407
|
}
|
|
2408
2408
|
|
|
2409
|
-
function
|
|
2409
|
+
function Be(t) {
|
|
2410
2410
|
return {
|
|
2411
2411
|
fieldPath: t.canonicalString()
|
|
2412
2412
|
};
|
|
2413
2413
|
}
|
|
2414
2414
|
|
|
2415
|
-
function
|
|
2415
|
+
function Ce(t) {
|
|
2416
2416
|
var e = [];
|
|
2417
2417
|
return t.fields.forEach((function(t) {
|
|
2418
2418
|
return e.push(t.canonicalString());
|
|
@@ -2421,7 +2421,7 @@ function Me(t) {
|
|
|
2421
2421
|
};
|
|
2422
2422
|
}
|
|
2423
2423
|
|
|
2424
|
-
function
|
|
2424
|
+
function Me(t) {
|
|
2425
2425
|
// Resource names have at least 4 components (project ID, database ID)
|
|
2426
2426
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
2427
2427
|
}
|
|
@@ -2441,8 +2441,8 @@ function Ge(t) {
|
|
|
2441
2441
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2442
2442
|
* See the License for the specific language governing permissions and
|
|
2443
2443
|
* limitations under the License.
|
|
2444
|
-
*/ function
|
|
2445
|
-
return new
|
|
2444
|
+
*/ function Ge(t) {
|
|
2445
|
+
return new Ae(t, /* useProto3Json= */ !0);
|
|
2446
2446
|
}
|
|
2447
2447
|
|
|
2448
2448
|
/**
|
|
@@ -2469,7 +2469,7 @@ function Ge(t) {
|
|
|
2469
2469
|
* backoff curve, and a +/- 50% "jitter" that is calculated and added to the
|
|
2470
2470
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
2471
2471
|
* delays causing spikes of load to the backend.
|
|
2472
|
-
*/ var
|
|
2472
|
+
*/ var Qe = /** @class */ function() {
|
|
2473
2473
|
function t(
|
|
2474
2474
|
/**
|
|
2475
2475
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -2497,7 +2497,7 @@ function Ge(t) {
|
|
|
2497
2497
|
void 0 === n && (n = 1e3), void 0 === r && (r = 1.5), void 0 === i && (i = 6e4),
|
|
2498
2498
|
this.O = t, this.timerId = e, this.C = n, this.L = r, this.U = i, this.j = 0, this.k = null,
|
|
2499
2499
|
/** The last backoff attempt, as epoch milliseconds. */
|
|
2500
|
-
this.
|
|
2500
|
+
this.B = Date.now(), this.reset();
|
|
2501
2501
|
}
|
|
2502
2502
|
/**
|
|
2503
2503
|
* Resets the backoff delay.
|
|
@@ -2512,7 +2512,7 @@ function Ge(t) {
|
|
|
2512
2512
|
* Resets the backoff delay to the maximum delay (e.g. for use after a
|
|
2513
2513
|
* RESOURCE_EXHAUSTED error).
|
|
2514
2514
|
*/
|
|
2515
|
-
t.prototype.
|
|
2515
|
+
t.prototype.M = function() {
|
|
2516
2516
|
this.j = this.U;
|
|
2517
2517
|
},
|
|
2518
2518
|
/**
|
|
@@ -2520,17 +2520,17 @@ function Ge(t) {
|
|
|
2520
2520
|
* delay for any subsequent attempts. If there was a pending backoff operation
|
|
2521
2521
|
* already, it will be canceled.
|
|
2522
2522
|
*/
|
|
2523
|
-
t.prototype.
|
|
2523
|
+
t.prototype.G = function(t) {
|
|
2524
2524
|
var e = this;
|
|
2525
2525
|
// Cancel any pending backoff operation.
|
|
2526
2526
|
this.cancel();
|
|
2527
2527
|
// First schedule using the current base (which may be 0 and should be
|
|
2528
2528
|
// honored as such).
|
|
2529
|
-
var n = Math.floor(this.j + this.
|
|
2529
|
+
var n = Math.floor(this.j + this.W()), r = Math.max(0, Date.now() - this.B), i = Math.max(0, n - r);
|
|
2530
2530
|
// Guard against lastAttemptTime being in the future due to a clock change.
|
|
2531
2531
|
i > 0 && g("ExponentialBackoff", "Backing off for " + i + " ms (base delay: " + this.j + " ms, delay with jitter: " + n + " ms, last attempt: " + r + " ms ago)"),
|
|
2532
2532
|
this.k = this.O.enqueueAfterDelay(this.timerId, i, (function() {
|
|
2533
|
-
return e.
|
|
2533
|
+
return e.B = Date.now(), t();
|
|
2534
2534
|
})),
|
|
2535
2535
|
// Apply backoff factor to determine next delay and ensure it is within
|
|
2536
2536
|
// bounds.
|
|
@@ -2540,24 +2540,24 @@ function Ge(t) {
|
|
|
2540
2540
|
}, t.prototype.cancel = function() {
|
|
2541
2541
|
null !== this.k && (this.k.cancel(), this.k = null);
|
|
2542
2542
|
},
|
|
2543
|
-
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ t.prototype.
|
|
2543
|
+
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ t.prototype.W = function() {
|
|
2544
2544
|
return (Math.random() - .5) * this.j;
|
|
2545
2545
|
}, t;
|
|
2546
|
-
}(),
|
|
2546
|
+
}(), ze = /** @class */ function(e) {
|
|
2547
2547
|
function n(t, n, r) {
|
|
2548
2548
|
var i = this;
|
|
2549
2549
|
return (i = e.call(this) || this).credentials = t, i.Y = n, i.S = r, i.K = !1, i;
|
|
2550
2550
|
}
|
|
2551
2551
|
return t(n, e), n.prototype.J = function() {
|
|
2552
|
-
if (this.K) throw new
|
|
2552
|
+
if (this.K) throw new x(O, "The client has already been terminated.");
|
|
2553
2553
|
},
|
|
2554
2554
|
/** Gets an auth token and invokes the provided RPC. */ n.prototype.l = function(t, e, n) {
|
|
2555
2555
|
var r = this;
|
|
2556
2556
|
return this.J(), this.credentials.getToken().then((function(i) {
|
|
2557
2557
|
return r.Y.l(t, e, n, i);
|
|
2558
2558
|
})).catch((function(t) {
|
|
2559
|
-
throw "FirebaseError" === t.name ? (t.code ===
|
|
2560
|
-
t) : new
|
|
2559
|
+
throw "FirebaseError" === t.name ? (t.code === N && r.credentials.invalidateToken(),
|
|
2560
|
+
t) : new x(A, t.toString());
|
|
2561
2561
|
}));
|
|
2562
2562
|
},
|
|
2563
2563
|
/** Gets an auth token and invokes the provided RPC with streamed results. */ n.prototype.v = function(t, e, n) {
|
|
@@ -2565,8 +2565,8 @@ function Ge(t) {
|
|
|
2565
2565
|
return this.J(), this.credentials.getToken().then((function(i) {
|
|
2566
2566
|
return r.Y.v(t, e, n, i);
|
|
2567
2567
|
})).catch((function(t) {
|
|
2568
|
-
throw "FirebaseError" === t.name ? (t.code ===
|
|
2569
|
-
t) : new
|
|
2568
|
+
throw "FirebaseError" === t.name ? (t.code === N && r.credentials.invalidateToken(),
|
|
2569
|
+
t) : new x(A, t.toString());
|
|
2570
2570
|
}));
|
|
2571
2571
|
}, n.prototype.terminate = function() {
|
|
2572
2572
|
this.K = !0;
|
|
@@ -2600,27 +2600,27 @@ function Ge(t) {
|
|
|
2600
2600
|
*/
|
|
2601
2601
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
2602
2602
|
// firestore-exp client.
|
|
2603
|
-
function
|
|
2603
|
+
function He(t, r) {
|
|
2604
2604
|
return e(this, void 0, void 0, (function() {
|
|
2605
2605
|
var e, i, o;
|
|
2606
2606
|
return n(this, (function(n) {
|
|
2607
2607
|
switch (n.label) {
|
|
2608
2608
|
case 0:
|
|
2609
|
-
return e = E(t), i =
|
|
2609
|
+
return e = E(t), i = je(e.S) + "/documents", o = {
|
|
2610
2610
|
writes: r.map((function(t) {
|
|
2611
2611
|
return function(t, e) {
|
|
2612
2612
|
var n;
|
|
2613
|
-
if (e instanceof
|
|
2614
|
-
update:
|
|
2615
|
-
}; else if (e instanceof Te) n = {
|
|
2616
|
-
delete: Oe(t, e.key)
|
|
2613
|
+
if (e instanceof be) n = {
|
|
2614
|
+
update: Le(t, e.key, e.value)
|
|
2617
2615
|
}; else if (e instanceof Se) n = {
|
|
2618
|
-
|
|
2619
|
-
|
|
2616
|
+
delete: Fe(t, e.key)
|
|
2617
|
+
}; else if (e instanceof _e) n = {
|
|
2618
|
+
update: Le(t, e.key, e.data),
|
|
2619
|
+
updateMask: Ce(e.fieldMask)
|
|
2620
2620
|
}; else {
|
|
2621
|
-
if (!(e instanceof
|
|
2621
|
+
if (!(e instanceof Te)) return S();
|
|
2622
2622
|
n = {
|
|
2623
|
-
verify:
|
|
2623
|
+
verify: Fe(t, e.key)
|
|
2624
2624
|
};
|
|
2625
2625
|
}
|
|
2626
2626
|
return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((function(t) {
|
|
@@ -2630,19 +2630,19 @@ function Ke(t, r) {
|
|
|
2630
2630
|
fieldPath: e.field.canonicalString(),
|
|
2631
2631
|
setToServerValue: "REQUEST_TIME"
|
|
2632
2632
|
};
|
|
2633
|
-
if (n instanceof
|
|
2633
|
+
if (n instanceof pe) return {
|
|
2634
2634
|
fieldPath: e.field.canonicalString(),
|
|
2635
2635
|
appendMissingElements: {
|
|
2636
2636
|
values: n.elements
|
|
2637
2637
|
}
|
|
2638
2638
|
};
|
|
2639
|
-
if (n instanceof
|
|
2639
|
+
if (n instanceof me) return {
|
|
2640
2640
|
fieldPath: e.field.canonicalString(),
|
|
2641
2641
|
removeAllFromArray: {
|
|
2642
2642
|
values: n.elements
|
|
2643
2643
|
}
|
|
2644
2644
|
};
|
|
2645
|
-
if (n instanceof
|
|
2645
|
+
if (n instanceof ye) return {
|
|
2646
2646
|
fieldPath: e.field.canonicalString(),
|
|
2647
2647
|
increment: n.q
|
|
2648
2648
|
};
|
|
@@ -2650,7 +2650,7 @@ function Ke(t, r) {
|
|
|
2650
2650
|
}(0, t);
|
|
2651
2651
|
}))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
2652
2652
|
return void 0 !== e.updateTime ? {
|
|
2653
|
-
updateTime:
|
|
2653
|
+
updateTime: ke(t, e.updateTime)
|
|
2654
2654
|
} : void 0 !== e.exists ? {
|
|
2655
2655
|
exists: e.exists
|
|
2656
2656
|
} : S();
|
|
@@ -2666,15 +2666,15 @@ function Ke(t, r) {
|
|
|
2666
2666
|
}));
|
|
2667
2667
|
}
|
|
2668
2668
|
|
|
2669
|
-
function
|
|
2669
|
+
function Ke(t, r) {
|
|
2670
2670
|
return e(this, void 0, void 0, (function() {
|
|
2671
2671
|
var e, i, o, a, s, u;
|
|
2672
2672
|
return n(this, (function(n) {
|
|
2673
2673
|
switch (n.label) {
|
|
2674
2674
|
case 0:
|
|
2675
|
-
return e = E(t), i =
|
|
2675
|
+
return e = E(t), i = je(e.S) + "/documents", o = {
|
|
2676
2676
|
documents: r.map((function(t) {
|
|
2677
|
-
return
|
|
2677
|
+
return Fe(e.S, t);
|
|
2678
2678
|
}))
|
|
2679
2679
|
}, [ 4 /*yield*/ , e.v("BatchGetDocuments", i, o) ];
|
|
2680
2680
|
|
|
@@ -2683,16 +2683,16 @@ function We(t, r) {
|
|
|
2683
2683
|
var n = function(t, e) {
|
|
2684
2684
|
return "found" in e ? function(t, e) {
|
|
2685
2685
|
T(!!e.found), e.found.name, e.found.updateTime;
|
|
2686
|
-
var n =
|
|
2686
|
+
var n = Oe(t, e.found.name), r = Pe(e.found.updateTime), i = new Ct({
|
|
2687
2687
|
mapValue: {
|
|
2688
2688
|
fields: e.found.fields
|
|
2689
2689
|
}
|
|
2690
2690
|
});
|
|
2691
|
-
return
|
|
2691
|
+
return Mt.newFoundDocument(n, r, i);
|
|
2692
2692
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
2693
2693
|
T(!!e.missing), T(!!e.readTime);
|
|
2694
|
-
var n =
|
|
2695
|
-
return
|
|
2694
|
+
var n = Oe(t, e.missing), r = Pe(e.readTime);
|
|
2695
|
+
return Mt.newNoDocument(n, r);
|
|
2696
2696
|
}(t, e) : S();
|
|
2697
2697
|
}(e.S, t);
|
|
2698
2698
|
s.set(n.key.toString(), n);
|
|
@@ -2705,7 +2705,7 @@ function We(t, r) {
|
|
|
2705
2705
|
}));
|
|
2706
2706
|
}
|
|
2707
2707
|
|
|
2708
|
-
function
|
|
2708
|
+
function We(t, r) {
|
|
2709
2709
|
return e(this, void 0, void 0, (function() {
|
|
2710
2710
|
var e, i;
|
|
2711
2711
|
return n(this, (function(n) {
|
|
@@ -2716,10 +2716,10 @@ function Ye(t, r) {
|
|
|
2716
2716
|
var n = {
|
|
2717
2717
|
structuredQuery: {}
|
|
2718
2718
|
}, r = e.path;
|
|
2719
|
-
null !== e.collectionGroup ? (n.parent =
|
|
2719
|
+
null !== e.collectionGroup ? (n.parent = qe(t, r), n.structuredQuery.from = [ {
|
|
2720
2720
|
collectionId: e.collectionGroup,
|
|
2721
2721
|
allDescendants: !0
|
|
2722
|
-
} ]) : (n.parent =
|
|
2722
|
+
} ]) : (n.parent = qe(t, r.popLast()), n.structuredQuery.from = [ {
|
|
2723
2723
|
collectionId: r.lastSegment()
|
|
2724
2724
|
} ]);
|
|
2725
2725
|
var i = function(t) {
|
|
@@ -2728,36 +2728,36 @@ function Ye(t, r) {
|
|
|
2728
2728
|
// visible for testing
|
|
2729
2729
|
return function(t) {
|
|
2730
2730
|
if ("==" /* EQUAL */ === t.op) {
|
|
2731
|
-
if (
|
|
2731
|
+
if (Ut(t.value)) return {
|
|
2732
2732
|
unaryFilter: {
|
|
2733
|
-
field:
|
|
2733
|
+
field: Be(t.field),
|
|
2734
2734
|
op: "IS_NAN"
|
|
2735
2735
|
}
|
|
2736
2736
|
};
|
|
2737
|
-
if (
|
|
2737
|
+
if (Rt(t.value)) return {
|
|
2738
2738
|
unaryFilter: {
|
|
2739
|
-
field:
|
|
2739
|
+
field: Be(t.field),
|
|
2740
2740
|
op: "IS_NULL"
|
|
2741
2741
|
}
|
|
2742
2742
|
};
|
|
2743
2743
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
2744
|
-
if (
|
|
2744
|
+
if (Ut(t.value)) return {
|
|
2745
2745
|
unaryFilter: {
|
|
2746
|
-
field:
|
|
2746
|
+
field: Be(t.field),
|
|
2747
2747
|
op: "IS_NOT_NAN"
|
|
2748
2748
|
}
|
|
2749
2749
|
};
|
|
2750
|
-
if (
|
|
2750
|
+
if (Rt(t.value)) return {
|
|
2751
2751
|
unaryFilter: {
|
|
2752
|
-
field:
|
|
2752
|
+
field: Be(t.field),
|
|
2753
2753
|
op: "IS_NOT_NULL"
|
|
2754
2754
|
}
|
|
2755
2755
|
};
|
|
2756
2756
|
}
|
|
2757
2757
|
return {
|
|
2758
2758
|
fieldFilter: {
|
|
2759
|
-
field:
|
|
2760
|
-
op:
|
|
2759
|
+
field: Be(t.field),
|
|
2760
|
+
op: xe(t.op),
|
|
2761
2761
|
value: t.value
|
|
2762
2762
|
}
|
|
2763
2763
|
};
|
|
@@ -2777,21 +2777,21 @@ function Ye(t, r) {
|
|
|
2777
2777
|
// visible for testing
|
|
2778
2778
|
return function(t) {
|
|
2779
2779
|
return {
|
|
2780
|
-
field:
|
|
2781
|
-
direction:
|
|
2780
|
+
field: Be(t.field),
|
|
2781
|
+
direction: Ue(t.dir)
|
|
2782
2782
|
};
|
|
2783
2783
|
}(t);
|
|
2784
2784
|
}));
|
|
2785
2785
|
}(e.orderBy);
|
|
2786
2786
|
o && (n.structuredQuery.orderBy = o);
|
|
2787
2787
|
var a = function(t, e) {
|
|
2788
|
-
return t.F ||
|
|
2788
|
+
return t.F || at(e) ? e : {
|
|
2789
2789
|
value: e
|
|
2790
2790
|
};
|
|
2791
2791
|
}(t, e.limit);
|
|
2792
|
-
return null !== a && (n.structuredQuery.limit = a), e.startAt && (n.structuredQuery.startAt =
|
|
2793
|
-
e.endAt && (n.structuredQuery.endAt =
|
|
2794
|
-
}(e.S,
|
|
2792
|
+
return null !== a && (n.structuredQuery.limit = a), e.startAt && (n.structuredQuery.startAt = Re(e.startAt)),
|
|
2793
|
+
e.endAt && (n.structuredQuery.endAt = Re(e.endAt)), n;
|
|
2794
|
+
}(e.S, fe(r)), [ 4 /*yield*/ , e.v("RunQuery", i.parent, {
|
|
2795
2795
|
structuredQuery: i.structuredQuery
|
|
2796
2796
|
}) ];
|
|
2797
2797
|
|
|
@@ -2800,11 +2800,11 @@ function Ye(t, r) {
|
|
|
2800
2800
|
return !!t.document;
|
|
2801
2801
|
})).map((function(t) {
|
|
2802
2802
|
return function(t, e, n) {
|
|
2803
|
-
var r =
|
|
2803
|
+
var r = Oe(t, e.name), i = Pe(e.updateTime), o = new Ct({
|
|
2804
2804
|
mapValue: {
|
|
2805
2805
|
fields: e.fields
|
|
2806
2806
|
}
|
|
2807
|
-
}), a =
|
|
2807
|
+
}), a = Mt.newFoundDocument(r, i, o);
|
|
2808
2808
|
return a;
|
|
2809
2809
|
}(e.S, t.document);
|
|
2810
2810
|
})) ];
|
|
@@ -2828,7 +2828,7 @@ function Ye(t, r) {
|
|
|
2828
2828
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2829
2829
|
* See the License for the specific language governing permissions and
|
|
2830
2830
|
* limitations under the License.
|
|
2831
|
-
*/ var
|
|
2831
|
+
*/ var Ye = new Map;
|
|
2832
2832
|
|
|
2833
2833
|
/**
|
|
2834
2834
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -2838,17 +2838,17 @@ function Ye(t, r) {
|
|
|
2838
2838
|
* Returns an initialized and started Datastore for the given Firestore
|
|
2839
2839
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
2840
2840
|
* instance is terminated.
|
|
2841
|
-
*/ function
|
|
2842
|
-
if (t._terminated) throw new
|
|
2843
|
-
if (!
|
|
2841
|
+
*/ function Xe(t) {
|
|
2842
|
+
if (t._terminated) throw new x(O, "The client has already been terminated.");
|
|
2843
|
+
if (!Ye.has(t)) {
|
|
2844
2844
|
g("ComponentProvider", "Initializing Datastore");
|
|
2845
2845
|
var e = function(t) {
|
|
2846
|
-
return new
|
|
2846
|
+
return new ht(t, fetch.bind(null));
|
|
2847
2847
|
}((i = t._databaseId, o = t.app.options.appId || "", a = t._persistenceKey, s = t._freezeSettings(),
|
|
2848
|
-
new
|
|
2849
|
-
return new
|
|
2848
|
+
new K(i, o, a, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), n = Ge(t._databaseId), r = function(t, e, n) {
|
|
2849
|
+
return new ze(t, e, n);
|
|
2850
2850
|
}(t._credentials, e, n);
|
|
2851
|
-
|
|
2851
|
+
Ye.set(t, r);
|
|
2852
2852
|
}
|
|
2853
2853
|
var i, o, a, s;
|
|
2854
2854
|
/**
|
|
@@ -2866,7 +2866,7 @@ function Ye(t, r) {
|
|
|
2866
2866
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2867
2867
|
* See the License for the specific language governing permissions and
|
|
2868
2868
|
* limitations under the License.
|
|
2869
|
-
*/ return
|
|
2869
|
+
*/ return Ye.get(t);
|
|
2870
2870
|
}
|
|
2871
2871
|
|
|
2872
2872
|
/**
|
|
@@ -2877,38 +2877,38 @@ function Ye(t, r) {
|
|
|
2877
2877
|
* A concrete type describing all the values that can be applied via a
|
|
2878
2878
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
2879
2879
|
* defaults can be supplied and the value can be checked for equality.
|
|
2880
|
-
*/ var
|
|
2880
|
+
*/ var $e = /** @class */ function() {
|
|
2881
2881
|
function t(t) {
|
|
2882
2882
|
var e;
|
|
2883
2883
|
if (void 0 === t.host) {
|
|
2884
|
-
if (void 0 !== t.ssl) throw new
|
|
2884
|
+
if (void 0 !== t.ssl) throw new x(V, "Can't provide ssl option if host option is not set");
|
|
2885
2885
|
this.host = "firestore.googleapis.com", this.ssl = !0;
|
|
2886
2886
|
} else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;
|
|
2887
2887
|
if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
|
|
2888
2888
|
void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
|
|
2889
|
-
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new
|
|
2889
|
+
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new x(V, "cacheSizeBytes must be at least 1048576");
|
|
2890
2890
|
this.cacheSizeBytes = t.cacheSizeBytes;
|
|
2891
2891
|
}
|
|
2892
2892
|
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
|
|
2893
2893
|
this.useFetchStreams = !!t.useFetchStreams, function(t, e, n, r) {
|
|
2894
|
-
if (!0 === e && !0 === r) throw new
|
|
2894
|
+
if (!0 === e && !0 === r) throw new x(V, "experimentalForceLongPolling and experimentalAutoDetectLongPolling cannot be used together.");
|
|
2895
2895
|
}(0, t.experimentalForceLongPolling, 0, t.experimentalAutoDetectLongPolling);
|
|
2896
2896
|
}
|
|
2897
2897
|
return t.prototype.isEqual = function(t) {
|
|
2898
2898
|
return this.host === t.host && this.ssl === t.ssl && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties && this.useFetchStreams === t.useFetchStreams;
|
|
2899
2899
|
}, t;
|
|
2900
|
-
}(),
|
|
2900
|
+
}(), Je = /** @class */ function() {
|
|
2901
2901
|
/** @hideconstructor */
|
|
2902
2902
|
function t(t, e) {
|
|
2903
2903
|
this._credentials = e,
|
|
2904
2904
|
/**
|
|
2905
2905
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
2906
2906
|
*/
|
|
2907
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
2908
|
-
this._settingsFrozen = !1, t instanceof
|
|
2907
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new $e({}),
|
|
2908
|
+
this._settingsFrozen = !1, t instanceof W ? this._databaseId = t : (this._app = t,
|
|
2909
2909
|
this._databaseId = function(t) {
|
|
2910
|
-
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new
|
|
2911
|
-
return new
|
|
2910
|
+
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new x(V, '"projectId" not provided in firebase.initializeApp.');
|
|
2911
|
+
return new W(t.options.projectId);
|
|
2912
2912
|
}(t));
|
|
2913
2913
|
}
|
|
2914
2914
|
return Object.defineProperty(t.prototype, "app", {
|
|
@@ -2917,7 +2917,7 @@ function Ye(t, r) {
|
|
|
2917
2917
|
* instance.
|
|
2918
2918
|
*/
|
|
2919
2919
|
get: function() {
|
|
2920
|
-
if (!this._app) throw new
|
|
2920
|
+
if (!this._app) throw new x(O, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
2921
2921
|
return this._app;
|
|
2922
2922
|
},
|
|
2923
2923
|
enumerable: !1,
|
|
@@ -2935,21 +2935,21 @@ function Ye(t, r) {
|
|
|
2935
2935
|
enumerable: !1,
|
|
2936
2936
|
configurable: !0
|
|
2937
2937
|
}), t.prototype._setSettings = function(t) {
|
|
2938
|
-
if (this._settingsFrozen) throw new
|
|
2939
|
-
this._settings = new
|
|
2940
|
-
if (!t) return new
|
|
2938
|
+
if (this._settingsFrozen) throw new x(O, "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.");
|
|
2939
|
+
this._settings = new $e(t), void 0 !== t.credentials && (this._credentials = function(t) {
|
|
2940
|
+
if (!t) return new M;
|
|
2941
2941
|
switch (t.type) {
|
|
2942
2942
|
case "gapi":
|
|
2943
2943
|
var e = t.client;
|
|
2944
2944
|
// Make sure this really is a Gapi client.
|
|
2945
2945
|
return T(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
|
|
2946
|
-
new
|
|
2946
|
+
new H(e, t.sessionIndex || "0", t.iamToken || null);
|
|
2947
2947
|
|
|
2948
2948
|
case "provider":
|
|
2949
2949
|
return t.client;
|
|
2950
2950
|
|
|
2951
2951
|
default:
|
|
2952
|
-
throw new
|
|
2952
|
+
throw new x(V, "makeCredentialsProvider failed due to invalid credential type");
|
|
2953
2953
|
}
|
|
2954
2954
|
}(t.credentials));
|
|
2955
2955
|
}, t.prototype._getSettings = function() {
|
|
@@ -2974,8 +2974,8 @@ function Ye(t, r) {
|
|
|
2974
2974
|
* Only ever called once.
|
|
2975
2975
|
*/
|
|
2976
2976
|
t.prototype._terminate = function() {
|
|
2977
|
-
return t = this, (e =
|
|
2978
|
-
|
|
2977
|
+
return t = this, (e = Ye.get(t)) && (g("ComponentProvider", "Removing Datastore"),
|
|
2978
|
+
Ye.delete(t), e.terminate()), Promise.resolve();
|
|
2979
2979
|
var t, e;
|
|
2980
2980
|
}, t;
|
|
2981
2981
|
}();
|
|
@@ -3000,9 +3000,9 @@ function Ye(t, r) {
|
|
|
3000
3000
|
* The Cloud Firestore service interface.
|
|
3001
3001
|
*
|
|
3002
3002
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3003
|
-
*/ function
|
|
3003
|
+
*/ function Ze(t, e) {
|
|
3004
3004
|
var n = _getProvider(t, "firestore/lite");
|
|
3005
|
-
if (n.isInitialized()) throw new
|
|
3005
|
+
if (n.isInitialized()) throw new x(O, "Firestore can only be initialized once per app.");
|
|
3006
3006
|
return n.initialize({
|
|
3007
3007
|
options: e
|
|
3008
3008
|
});
|
|
@@ -3016,7 +3016,7 @@ function Ye(t, r) {
|
|
|
3016
3016
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
3017
3017
|
* instance is associated with.
|
|
3018
3018
|
* @returns The `Firestore` instance of the provided app.
|
|
3019
|
-
*/ function
|
|
3019
|
+
*/ function tn(t) {
|
|
3020
3020
|
return void 0 === t && (t = s()), _getProvider(t, "firestore/lite").getImmediate();
|
|
3021
3021
|
}
|
|
3022
3022
|
|
|
@@ -3032,25 +3032,25 @@ function Ye(t, r) {
|
|
|
3032
3032
|
* @param port - the emulator port (ex: 9000).
|
|
3033
3033
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
3034
3034
|
* Security Rules.
|
|
3035
|
-
*/ function
|
|
3035
|
+
*/ function en(t, e, n, r) {
|
|
3036
3036
|
var i;
|
|
3037
3037
|
void 0 === r && (r = {});
|
|
3038
|
-
var o = (t =
|
|
3038
|
+
var o = (t = it(t, Je))._getSettings();
|
|
3039
3039
|
if ("firestore.googleapis.com" !== o.host && o.host !== e && b("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
3040
3040
|
t._setSettings(Object.assign(Object.assign({}, o), {
|
|
3041
3041
|
host: e + ":" + n,
|
|
3042
3042
|
ssl: !1
|
|
3043
3043
|
})), r.mockUserToken) {
|
|
3044
3044
|
var a, s;
|
|
3045
|
-
if ("string" == typeof r.mockUserToken) a = r.mockUserToken, s =
|
|
3045
|
+
if ("string" == typeof r.mockUserToken) a = r.mockUserToken, s = p.MOCK_USER; else {
|
|
3046
3046
|
// Let createMockUserToken validate first (catches common mistakes like
|
|
3047
3047
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
3048
|
-
a =
|
|
3048
|
+
a = d(r.mockUserToken, null === (i = t._app) || void 0 === i ? void 0 : i.options.projectId);
|
|
3049
3049
|
var u = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
3050
|
-
if (!u) throw new
|
|
3051
|
-
s = new
|
|
3050
|
+
if (!u) throw new x(V, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
3051
|
+
s = new p(u);
|
|
3052
3052
|
}
|
|
3053
|
-
t._credentials = new
|
|
3053
|
+
t._credentials = new G(new C(a, s));
|
|
3054
3054
|
}
|
|
3055
3055
|
}
|
|
3056
3056
|
|
|
@@ -3073,8 +3073,8 @@ function Ye(t, r) {
|
|
|
3073
3073
|
* @param firestore - The `Firestore` instance to terminate.
|
|
3074
3074
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
3075
3075
|
* terminated.
|
|
3076
|
-
*/ function
|
|
3077
|
-
return t =
|
|
3076
|
+
*/ function nn(t) {
|
|
3077
|
+
return t = it(t, Je), u(t.app, "firestore/lite"), t._delete()
|
|
3078
3078
|
/**
|
|
3079
3079
|
* @license
|
|
3080
3080
|
* Copyright 2020 Google LLC
|
|
@@ -3114,7 +3114,7 @@ function Ye(t, r) {
|
|
|
3114
3114
|
*/;
|
|
3115
3115
|
}
|
|
3116
3116
|
|
|
3117
|
-
var
|
|
3117
|
+
var rn = /** @class */ function() {
|
|
3118
3118
|
/** @hideconstructor */
|
|
3119
3119
|
function t(t,
|
|
3120
3120
|
/**
|
|
@@ -3155,14 +3155,14 @@ var on = /** @class */ function() {
|
|
|
3155
3155
|
* The collection this `DocumentReference` belongs to.
|
|
3156
3156
|
*/
|
|
3157
3157
|
get: function() {
|
|
3158
|
-
return new
|
|
3158
|
+
return new an(this.firestore, this.converter, this._key.path.popLast());
|
|
3159
3159
|
},
|
|
3160
3160
|
enumerable: !1,
|
|
3161
3161
|
configurable: !0
|
|
3162
3162
|
}), t.prototype.withConverter = function(e) {
|
|
3163
3163
|
return new t(this.firestore, e, this._key);
|
|
3164
3164
|
}, t;
|
|
3165
|
-
}(),
|
|
3165
|
+
}(), on = /** @class */ function() {
|
|
3166
3166
|
// This is the lite version of the Query class in the main SDK.
|
|
3167
3167
|
/** @hideconstructor protected */
|
|
3168
3168
|
function t(t,
|
|
@@ -3177,11 +3177,11 @@ var on = /** @class */ function() {
|
|
|
3177
3177
|
return t.prototype.withConverter = function(e) {
|
|
3178
3178
|
return new t(this.firestore, e, this._query);
|
|
3179
3179
|
}, t;
|
|
3180
|
-
}(),
|
|
3180
|
+
}(), an = /** @class */ function(e) {
|
|
3181
3181
|
/** @hideconstructor */
|
|
3182
3182
|
function n(t, n, r) {
|
|
3183
3183
|
var i = this;
|
|
3184
|
-
return (i = e.call(this, t, n, new
|
|
3184
|
+
return (i = e.call(this, t, n, new ie(r)) || this)._path = r,
|
|
3185
3185
|
/** The type of this Firestore reference. */
|
|
3186
3186
|
i.type = "collection", i;
|
|
3187
3187
|
}
|
|
@@ -3208,28 +3208,28 @@ var on = /** @class */ function() {
|
|
|
3208
3208
|
*/
|
|
3209
3209
|
get: function() {
|
|
3210
3210
|
var t = this._path.popLast();
|
|
3211
|
-
return t.isEmpty() ? null : new
|
|
3212
|
-
/* converter= */ null, new
|
|
3211
|
+
return t.isEmpty() ? null : new rn(this.firestore,
|
|
3212
|
+
/* converter= */ null, new Z(t));
|
|
3213
3213
|
},
|
|
3214
3214
|
enumerable: !1,
|
|
3215
3215
|
configurable: !0
|
|
3216
3216
|
}), n.prototype.withConverter = function(t) {
|
|
3217
3217
|
return new n(this.firestore, t, this._path);
|
|
3218
3218
|
}, n;
|
|
3219
|
-
}(
|
|
3219
|
+
}(on);
|
|
3220
3220
|
|
|
3221
3221
|
/**
|
|
3222
3222
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
3223
3223
|
* construct refined `Query` objects by adding filters and ordering.
|
|
3224
|
-
*/ function
|
|
3224
|
+
*/ function sn(t, e) {
|
|
3225
3225
|
for (var n = [], i = 2; i < arguments.length; i++) n[i - 2] = arguments[i];
|
|
3226
|
-
if (t = h(t),
|
|
3227
|
-
var o =
|
|
3228
|
-
return
|
|
3226
|
+
if (t = h(t), tt("collection", "path", e), t instanceof Je) {
|
|
3227
|
+
var o = X.fromString.apply(X, r([ e ], n));
|
|
3228
|
+
return nt(o), new an(t, /* converter= */ null, o);
|
|
3229
3229
|
}
|
|
3230
|
-
if (!(t instanceof
|
|
3231
|
-
var a = t._path.child(
|
|
3232
|
-
return
|
|
3230
|
+
if (!(t instanceof rn || t instanceof an)) throw new x(V, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3231
|
+
var a = t._path.child(X.fromString.apply(X, r([ e ], n)));
|
|
3232
|
+
return nt(a), new an(t.firestore,
|
|
3233
3233
|
/* converter= */ null, a);
|
|
3234
3234
|
}
|
|
3235
3235
|
|
|
@@ -3245,32 +3245,32 @@ var on = /** @class */ function() {
|
|
|
3245
3245
|
* collection or subcollection with this ID as the last segment of its path
|
|
3246
3246
|
* will be included. Cannot contain a slash.
|
|
3247
3247
|
* @returns The created `Query`.
|
|
3248
|
-
*/ function
|
|
3249
|
-
if (t =
|
|
3250
|
-
return new
|
|
3248
|
+
*/ function un(t, e) {
|
|
3249
|
+
if (t = it(t, Je), tt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new x(V, "Invalid collection ID '" + e + "' passed to function collectionGroup(). Collection IDs must not contain '/'.");
|
|
3250
|
+
return new on(t,
|
|
3251
3251
|
/* converter= */ null,
|
|
3252
3252
|
/**
|
|
3253
3253
|
* Creates a new Query for a collection group query that matches all documents
|
|
3254
3254
|
* within the provided collection group.
|
|
3255
3255
|
*/
|
|
3256
3256
|
function(t) {
|
|
3257
|
-
return new
|
|
3257
|
+
return new ie(X.emptyPath(), t);
|
|
3258
3258
|
}(e));
|
|
3259
3259
|
}
|
|
3260
3260
|
|
|
3261
|
-
function
|
|
3261
|
+
function cn(t, e) {
|
|
3262
3262
|
for (var n = [], i = 2; i < arguments.length; i++) n[i - 2] = arguments[i];
|
|
3263
3263
|
if (t = h(t),
|
|
3264
3264
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3265
3265
|
// 'undefined' and 'null'.
|
|
3266
|
-
1 === arguments.length && (e =
|
|
3267
|
-
var o =
|
|
3268
|
-
return
|
|
3269
|
-
/* converter= */ null, new
|
|
3266
|
+
1 === arguments.length && (e = pt.A()), tt("doc", "path", e), t instanceof Je) {
|
|
3267
|
+
var o = X.fromString.apply(X, r([ e ], n));
|
|
3268
|
+
return et(o), new rn(t,
|
|
3269
|
+
/* converter= */ null, new Z(o));
|
|
3270
3270
|
}
|
|
3271
|
-
if (!(t instanceof
|
|
3272
|
-
var a = t._path.child(
|
|
3273
|
-
return
|
|
3271
|
+
if (!(t instanceof rn || t instanceof an)) throw new x(V, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3272
|
+
var a = t._path.child(X.fromString.apply(X, r([ e ], n)));
|
|
3273
|
+
return et(a), new rn(t.firestore, t instanceof an ? t.converter : null, new Z(a));
|
|
3274
3274
|
}
|
|
3275
3275
|
|
|
3276
3276
|
/**
|
|
@@ -3280,8 +3280,8 @@ function fn(t, e) {
|
|
|
3280
3280
|
* @param right - A reference to compare.
|
|
3281
3281
|
* @returns true if the references point to the same location in the same
|
|
3282
3282
|
* Firestore database.
|
|
3283
|
-
*/ function
|
|
3284
|
-
return t = h(t), e = h(e), (t instanceof
|
|
3283
|
+
*/ function fn(t, e) {
|
|
3284
|
+
return t = h(t), e = h(e), (t instanceof rn || t instanceof an) && (e instanceof rn || e instanceof an) && t.firestore === e.firestore && t.path === e.path && t.converter === e.converter
|
|
3285
3285
|
/**
|
|
3286
3286
|
* Returns true if the provided queries point to the same collection and apply
|
|
3287
3287
|
* the same constraints.
|
|
@@ -3293,18 +3293,18 @@ function fn(t, e) {
|
|
|
3293
3293
|
*/;
|
|
3294
3294
|
}
|
|
3295
3295
|
|
|
3296
|
-
function
|
|
3297
|
-
return t = h(t), e = h(e), t instanceof
|
|
3296
|
+
function ln(t, e) {
|
|
3297
|
+
return t = h(t), e = h(e), t instanceof on && e instanceof on && t.firestore === e.firestore && function(t, e) {
|
|
3298
3298
|
return function(t, e) {
|
|
3299
3299
|
if (t.limit !== e.limit) return !1;
|
|
3300
3300
|
if (t.orderBy.length !== e.orderBy.length) return !1;
|
|
3301
|
-
for (var n = 0; n < t.orderBy.length; n++) if (!
|
|
3301
|
+
for (var n = 0; n < t.orderBy.length; n++) if (!ne(t.orderBy[n], e.orderBy[n])) return !1;
|
|
3302
3302
|
if (t.filters.length !== e.filters.length) return !1;
|
|
3303
3303
|
for (var r = 0; r < t.filters.length; r++) if (i = t.filters[r], o = e.filters[r],
|
|
3304
|
-
i.op !== o.op || !i.field.isEqual(o.field) || !
|
|
3304
|
+
i.op !== o.op || !i.field.isEqual(o.field) || !Nt(i.value, o.value)) return !1;
|
|
3305
3305
|
var i, o;
|
|
3306
|
-
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!
|
|
3307
|
-
}(
|
|
3306
|
+
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!re(t.startAt, e.startAt) && re(t.endAt, e.endAt);
|
|
3307
|
+
}(fe(t), fe(e)) && t.limitType === e.limitType;
|
|
3308
3308
|
}(t._query, e._query) && t.converter === e.converter
|
|
3309
3309
|
/**
|
|
3310
3310
|
* @license
|
|
@@ -3332,7 +3332,7 @@ function hn(t, e) {
|
|
|
3332
3332
|
*/;
|
|
3333
3333
|
}
|
|
3334
3334
|
|
|
3335
|
-
var
|
|
3335
|
+
var hn = /** @class */ function() {
|
|
3336
3336
|
/**
|
|
3337
3337
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
3338
3338
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -3341,8 +3341,8 @@ var pn = /** @class */ function() {
|
|
|
3341
3341
|
*/
|
|
3342
3342
|
function t() {
|
|
3343
3343
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
3344
|
-
for (var n = 0; n < t.length; ++n) if (0 === t[n].length) throw new
|
|
3345
|
-
this._internalPath = new
|
|
3344
|
+
for (var n = 0; n < t.length; ++n) if (0 === t[n].length) throw new x(V, "Invalid field name at argument $(i + 1). Field names must not be empty.");
|
|
3345
|
+
this._internalPath = new J(t);
|
|
3346
3346
|
}
|
|
3347
3347
|
/**
|
|
3348
3348
|
* Returns true if this `FieldPath` is equal to the provided one.
|
|
@@ -3358,7 +3358,7 @@ var pn = /** @class */ function() {
|
|
|
3358
3358
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
3359
3359
|
* It can be used in queries to sort or filter by the document ID.
|
|
3360
3360
|
*/ function dn() {
|
|
3361
|
-
return new
|
|
3361
|
+
return new hn("__name__");
|
|
3362
3362
|
}
|
|
3363
3363
|
|
|
3364
3364
|
/**
|
|
@@ -3379,7 +3379,7 @@ var pn = /** @class */ function() {
|
|
|
3379
3379
|
*/
|
|
3380
3380
|
/**
|
|
3381
3381
|
* An immutable object representing an array of bytes.
|
|
3382
|
-
*/ var
|
|
3382
|
+
*/ var pn = /** @class */ function() {
|
|
3383
3383
|
/** @hideconstructor */
|
|
3384
3384
|
function t(t) {
|
|
3385
3385
|
this._byteString = t;
|
|
@@ -3391,9 +3391,9 @@ var pn = /** @class */ function() {
|
|
|
3391
3391
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3392
3392
|
*/ return t.fromBase64String = function(e) {
|
|
3393
3393
|
try {
|
|
3394
|
-
return new t(
|
|
3394
|
+
return new t(St.fromBase64String(e));
|
|
3395
3395
|
} catch (e) {
|
|
3396
|
-
throw new
|
|
3396
|
+
throw new x(V, "Failed to construct data from Base64 string: " + e);
|
|
3397
3397
|
}
|
|
3398
3398
|
},
|
|
3399
3399
|
/**
|
|
@@ -3402,7 +3402,7 @@ var pn = /** @class */ function() {
|
|
|
3402
3402
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3403
3403
|
*/
|
|
3404
3404
|
t.fromUint8Array = function(e) {
|
|
3405
|
-
return new t(
|
|
3405
|
+
return new t(St.fromUint8Array(e));
|
|
3406
3406
|
},
|
|
3407
3407
|
/**
|
|
3408
3408
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3437,14 +3437,14 @@ var pn = /** @class */ function() {
|
|
|
3437
3437
|
t.prototype.isEqual = function(t) {
|
|
3438
3438
|
return this._byteString.isEqual(t._byteString);
|
|
3439
3439
|
}, t;
|
|
3440
|
-
}(),
|
|
3440
|
+
}(), mn =
|
|
3441
3441
|
/**
|
|
3442
3442
|
* @param _methodName - The public API endpoint that returns this class.
|
|
3443
3443
|
* @hideconstructor
|
|
3444
3444
|
*/
|
|
3445
3445
|
function(t) {
|
|
3446
3446
|
this._methodName = t;
|
|
3447
|
-
},
|
|
3447
|
+
}, yn = /** @class */ function() {
|
|
3448
3448
|
/**
|
|
3449
3449
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
3450
3450
|
* longitude values.
|
|
@@ -3452,8 +3452,8 @@ function(t) {
|
|
|
3452
3452
|
* @param longitude - The longitude as number between -180 and 180.
|
|
3453
3453
|
*/
|
|
3454
3454
|
function t(t, e) {
|
|
3455
|
-
if (!isFinite(t) || t < -90 || t > 90) throw new
|
|
3456
|
-
if (!isFinite(e) || e < -180 || e > 180) throw new
|
|
3455
|
+
if (!isFinite(t) || t < -90 || t > 90) throw new x(V, "Latitude must be a number between -90 and 90, but was: " + t);
|
|
3456
|
+
if (!isFinite(e) || e < -180 || e > 180) throw new x(V, "Longitude must be a number between -180 and 180, but was: " + e);
|
|
3457
3457
|
this._lat = t, this._long = e;
|
|
3458
3458
|
}
|
|
3459
3459
|
return Object.defineProperty(t.prototype, "latitude", {
|
|
@@ -3495,23 +3495,23 @@ function(t) {
|
|
|
3495
3495
|
* with an underscore.
|
|
3496
3496
|
*/
|
|
3497
3497
|
t.prototype._compareTo = function(t) {
|
|
3498
|
-
return
|
|
3498
|
+
return mt(this._lat, t._lat) || mt(this._long, t._long);
|
|
3499
3499
|
}, t;
|
|
3500
|
-
}(),
|
|
3500
|
+
}(), vn = /^__.*__$/, gn = /** @class */ function() {
|
|
3501
3501
|
function t(t, e, n) {
|
|
3502
3502
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3503
3503
|
}
|
|
3504
3504
|
return t.prototype.toMutation = function(t, e) {
|
|
3505
|
-
return null !== this.fieldMask ? new
|
|
3505
|
+
return null !== this.fieldMask ? new _e(t, this.data, this.fieldMask, e, this.fieldTransforms) : new be(t, this.data, e, this.fieldTransforms);
|
|
3506
3506
|
}, t;
|
|
3507
|
-
}(),
|
|
3507
|
+
}(), wn = /** @class */ function() {
|
|
3508
3508
|
function t(t,
|
|
3509
3509
|
// The fieldMask does not include document transforms.
|
|
3510
3510
|
e, n) {
|
|
3511
3511
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3512
3512
|
}
|
|
3513
3513
|
return t.prototype.toMutation = function(t, e) {
|
|
3514
|
-
return new
|
|
3514
|
+
return new _e(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
3515
3515
|
}, t;
|
|
3516
3516
|
}();
|
|
3517
3517
|
|
|
@@ -3534,7 +3534,7 @@ function(t) {
|
|
|
3534
3534
|
/**
|
|
3535
3535
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
3536
3536
|
* or `update()`.
|
|
3537
|
-
*/ function
|
|
3537
|
+
*/ function bn(t) {
|
|
3538
3538
|
switch (t) {
|
|
3539
3539
|
case 0 /* Set */ :
|
|
3540
3540
|
// fall through
|
|
@@ -3552,7 +3552,7 @@ function(t) {
|
|
|
3552
3552
|
}
|
|
3553
3553
|
}
|
|
3554
3554
|
|
|
3555
|
-
/** A "context" object passed around while parsing user data. */ var
|
|
3555
|
+
/** A "context" object passed around while parsing user data. */ var _n = /** @class */ function() {
|
|
3556
3556
|
/**
|
|
3557
3557
|
* Initializes a ParseContext with the given source and path.
|
|
3558
3558
|
*
|
|
@@ -3592,16 +3592,16 @@ function(t) {
|
|
|
3592
3592
|
}),
|
|
3593
3593
|
/** Returns a new context with the specified settings overwritten. */ t.prototype.tt = function(e) {
|
|
3594
3594
|
return new t(Object.assign(Object.assign({}, this.settings), e), this.databaseId, this.S, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
3595
|
-
}, t.prototype.
|
|
3595
|
+
}, t.prototype.nt = function(t) {
|
|
3596
3596
|
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.tt({
|
|
3597
3597
|
path: n,
|
|
3598
|
-
|
|
3598
|
+
et: !1
|
|
3599
3599
|
});
|
|
3600
3600
|
return r.rt(t), r;
|
|
3601
3601
|
}, t.prototype.st = function(t) {
|
|
3602
3602
|
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.tt({
|
|
3603
3603
|
path: n,
|
|
3604
|
-
|
|
3604
|
+
et: !1
|
|
3605
3605
|
});
|
|
3606
3606
|
return r.Z(), r;
|
|
3607
3607
|
}, t.prototype.it = function(t) {
|
|
@@ -3609,10 +3609,10 @@ function(t) {
|
|
|
3609
3609
|
// undefined.
|
|
3610
3610
|
return this.tt({
|
|
3611
3611
|
path: void 0,
|
|
3612
|
-
|
|
3612
|
+
et: !0
|
|
3613
3613
|
});
|
|
3614
3614
|
}, t.prototype.ot = function(t) {
|
|
3615
|
-
return
|
|
3615
|
+
return Cn(t, this.settings.methodName, this.settings.ut || !1, this.path, this.settings.ct);
|
|
3616
3616
|
},
|
|
3617
3617
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ t.prototype.contains = function(t) {
|
|
3618
3618
|
return void 0 !== this.fieldMask.find((function(e) {
|
|
@@ -3626,20 +3626,20 @@ function(t) {
|
|
|
3626
3626
|
if (this.path) for (var t = 0; t < this.path.length; t++) this.rt(this.path.get(t));
|
|
3627
3627
|
}, t.prototype.rt = function(t) {
|
|
3628
3628
|
if (0 === t.length) throw this.ot("Document fields must not be empty");
|
|
3629
|
-
if (
|
|
3629
|
+
if (bn(this.X) && vn.test(t)) throw this.ot('Document fields cannot begin and end with "__"');
|
|
3630
3630
|
}, t;
|
|
3631
|
-
}(),
|
|
3631
|
+
}(), Sn = /** @class */ function() {
|
|
3632
3632
|
function t(t, e, n) {
|
|
3633
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.S = n ||
|
|
3633
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.S = n || Ge(t)
|
|
3634
3634
|
/** Creates a new top-level parse context. */;
|
|
3635
3635
|
}
|
|
3636
3636
|
return t.prototype.at = function(t, e, n, r) {
|
|
3637
|
-
return void 0 === r && (r = !1), new
|
|
3637
|
+
return void 0 === r && (r = !1), new _n({
|
|
3638
3638
|
X: t,
|
|
3639
3639
|
methodName: e,
|
|
3640
3640
|
ct: n,
|
|
3641
|
-
path:
|
|
3642
|
-
|
|
3641
|
+
path: J.emptyPath(),
|
|
3642
|
+
et: !1,
|
|
3643
3643
|
ut: r
|
|
3644
3644
|
}, this.databaseId, this.S, this.ignoreUndefinedProperties);
|
|
3645
3645
|
}, t;
|
|
@@ -3648,30 +3648,30 @@ function(t) {
|
|
|
3648
3648
|
/**
|
|
3649
3649
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
3650
3650
|
* classes.
|
|
3651
|
-
*/ function
|
|
3652
|
-
var e = t._freezeSettings(), n =
|
|
3653
|
-
return new
|
|
3651
|
+
*/ function Tn(t) {
|
|
3652
|
+
var e = t._freezeSettings(), n = Ge(t._databaseId);
|
|
3653
|
+
return new Sn(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
3654
3654
|
}
|
|
3655
3655
|
|
|
3656
|
-
/** Parse document data from a set() call. */ function
|
|
3656
|
+
/** Parse document data from a set() call. */ function En(t, e, n, r, i, o) {
|
|
3657
3657
|
void 0 === o && (o = {});
|
|
3658
3658
|
var a = t.at(o.merge || o.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
|
|
3659
|
-
|
|
3660
|
-
var s, u, c =
|
|
3661
|
-
if (o.merge) s = new
|
|
3659
|
+
Rn("Data must be an object, but it was:", a, r);
|
|
3660
|
+
var s, u, c = jn(r, a);
|
|
3661
|
+
if (o.merge) s = new _t(a.fieldMask), u = a.fieldTransforms; else if (o.mergeFields) {
|
|
3662
3662
|
for (var f = [], l = 0, h = o.mergeFields; l < h.length; l++) {
|
|
3663
|
-
var
|
|
3664
|
-
if (!a.contains(
|
|
3665
|
-
|
|
3663
|
+
var d = Un(e, h[l], n);
|
|
3664
|
+
if (!a.contains(d)) throw new x(V, "Field '" + d + "' is specified in your field mask but missing from your input data.");
|
|
3665
|
+
Mn(f, d) || f.push(d);
|
|
3666
3666
|
}
|
|
3667
|
-
s = new
|
|
3667
|
+
s = new _t(f), u = a.fieldTransforms.filter((function(t) {
|
|
3668
3668
|
return s.covers(t.field);
|
|
3669
3669
|
}));
|
|
3670
3670
|
} else s = null, u = a.fieldTransforms;
|
|
3671
|
-
return new
|
|
3671
|
+
return new gn(new Ct(c), s, u);
|
|
3672
3672
|
}
|
|
3673
3673
|
|
|
3674
|
-
var
|
|
3674
|
+
var In = /** @class */ function(e) {
|
|
3675
3675
|
function n() {
|
|
3676
3676
|
return null !== e && e.apply(this, arguments) || this;
|
|
3677
3677
|
}
|
|
@@ -3683,7 +3683,7 @@ var An = /** @class */ function(e) {
|
|
|
3683
3683
|
}, n.prototype.isEqual = function(t) {
|
|
3684
3684
|
return t instanceof n;
|
|
3685
3685
|
}, n;
|
|
3686
|
-
}(
|
|
3686
|
+
}(mn);
|
|
3687
3687
|
|
|
3688
3688
|
/**
|
|
3689
3689
|
* Creates a child context for parsing SerializableFieldValues.
|
|
@@ -3700,110 +3700,110 @@ var An = /** @class */ function(e) {
|
|
|
3700
3700
|
* context.
|
|
3701
3701
|
* @param context - The parent context.
|
|
3702
3702
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
3703
|
-
*/ function
|
|
3704
|
-
return new
|
|
3703
|
+
*/ function An(t, e, n) {
|
|
3704
|
+
return new _n({
|
|
3705
3705
|
X: 3 /* Argument */ ,
|
|
3706
3706
|
ct: e.settings.ct,
|
|
3707
3707
|
methodName: t._methodName,
|
|
3708
|
-
|
|
3708
|
+
et: n
|
|
3709
3709
|
}, e.databaseId, e.S, e.ignoreUndefinedProperties);
|
|
3710
3710
|
}
|
|
3711
3711
|
|
|
3712
|
-
var
|
|
3712
|
+
var Vn = /** @class */ function(e) {
|
|
3713
3713
|
function n() {
|
|
3714
3714
|
return null !== e && e.apply(this, arguments) || this;
|
|
3715
3715
|
}
|
|
3716
3716
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
3717
|
-
return new
|
|
3717
|
+
return new ve(t.path, new de);
|
|
3718
3718
|
}, n.prototype.isEqual = function(t) {
|
|
3719
3719
|
return t instanceof n;
|
|
3720
3720
|
}, n;
|
|
3721
|
-
}(
|
|
3721
|
+
}(mn), Dn = /** @class */ function(e) {
|
|
3722
3722
|
function n(t, n) {
|
|
3723
3723
|
var r = this;
|
|
3724
3724
|
return (r = e.call(this, t) || this).ht = n, r;
|
|
3725
3725
|
}
|
|
3726
3726
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
3727
|
-
var e =
|
|
3727
|
+
var e = An(this, t,
|
|
3728
3728
|
/*array=*/ !0), n = this.ht.map((function(t) {
|
|
3729
|
-
return
|
|
3730
|
-
})), r = new
|
|
3731
|
-
return new
|
|
3729
|
+
return qn(t, e);
|
|
3730
|
+
})), r = new pe(n);
|
|
3731
|
+
return new ve(t.path, r);
|
|
3732
3732
|
}, n.prototype.isEqual = function(t) {
|
|
3733
3733
|
// TODO(mrschmidt): Implement isEquals
|
|
3734
3734
|
return this === t;
|
|
3735
3735
|
}, n;
|
|
3736
|
-
}(
|
|
3736
|
+
}(mn), kn = /** @class */ function(e) {
|
|
3737
3737
|
function n(t, n) {
|
|
3738
3738
|
var r = this;
|
|
3739
3739
|
return (r = e.call(this, t) || this).ht = n, r;
|
|
3740
3740
|
}
|
|
3741
3741
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
3742
|
-
var e =
|
|
3742
|
+
var e = An(this, t,
|
|
3743
3743
|
/*array=*/ !0), n = this.ht.map((function(t) {
|
|
3744
|
-
return
|
|
3745
|
-
})), r = new
|
|
3746
|
-
return new
|
|
3744
|
+
return qn(t, e);
|
|
3745
|
+
})), r = new me(n);
|
|
3746
|
+
return new ve(t.path, r);
|
|
3747
3747
|
}, n.prototype.isEqual = function(t) {
|
|
3748
3748
|
// TODO(mrschmidt): Implement isEquals
|
|
3749
3749
|
return this === t;
|
|
3750
3750
|
}, n;
|
|
3751
|
-
}(
|
|
3751
|
+
}(mn), Pn = /** @class */ function(e) {
|
|
3752
3752
|
function n(t, n) {
|
|
3753
3753
|
var r = this;
|
|
3754
3754
|
return (r = e.call(this, t) || this).lt = n, r;
|
|
3755
3755
|
}
|
|
3756
3756
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
3757
|
-
var e = new
|
|
3758
|
-
return new
|
|
3757
|
+
var e = new ye(t.S, le(t.S, this.lt));
|
|
3758
|
+
return new ve(t.path, e);
|
|
3759
3759
|
}, n.prototype.isEqual = function(t) {
|
|
3760
3760
|
// TODO(mrschmidt): Implement isEquals
|
|
3761
3761
|
return this === t;
|
|
3762
3762
|
}, n;
|
|
3763
|
-
}(
|
|
3763
|
+
}(mn);
|
|
3764
3764
|
|
|
3765
|
-
/** Parse update data from an update() call. */ function
|
|
3765
|
+
/** Parse update data from an update() call. */ function Nn(t, e, n, r) {
|
|
3766
3766
|
var i = t.at(1 /* Update */ , e, n);
|
|
3767
|
-
|
|
3768
|
-
var o = [], a =
|
|
3769
|
-
|
|
3770
|
-
var s =
|
|
3767
|
+
Rn("Data must be an object, but it was:", i, r);
|
|
3768
|
+
var o = [], a = Ct.empty();
|
|
3769
|
+
bt(r, (function(t, r) {
|
|
3770
|
+
var s = Bn(e, t, n);
|
|
3771
3771
|
// For Compat types, we have to "extract" the underlying types before
|
|
3772
3772
|
// performing validation.
|
|
3773
3773
|
r = h(r);
|
|
3774
3774
|
var u = i.st(s);
|
|
3775
|
-
if (r instanceof
|
|
3775
|
+
if (r instanceof In)
|
|
3776
3776
|
// Add it to the field mask, but don't add anything to updateData.
|
|
3777
3777
|
o.push(s); else {
|
|
3778
|
-
var c =
|
|
3778
|
+
var c = qn(r, u);
|
|
3779
3779
|
null != c && (o.push(s), a.set(s, c));
|
|
3780
3780
|
}
|
|
3781
3781
|
}));
|
|
3782
|
-
var s = new
|
|
3783
|
-
return new
|
|
3782
|
+
var s = new _t(o);
|
|
3783
|
+
return new wn(a, s, i.fieldTransforms);
|
|
3784
3784
|
}
|
|
3785
3785
|
|
|
3786
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
3787
|
-
var a = t.at(1 /* Update */ , e, n), s = [
|
|
3788
|
-
if (o.length % 2 != 0) throw new
|
|
3789
|
-
for (var c = 0; c < o.length; c += 2) s.push(
|
|
3786
|
+
/** Parse update data from a list of field/value arguments. */ function Fn(t, e, n, r, i, o) {
|
|
3787
|
+
var a = t.at(1 /* Update */ , e, n), s = [ Un(e, r, n) ], u = [ i ];
|
|
3788
|
+
if (o.length % 2 != 0) throw new x(V, "Function " + e + "() needs to be called with an even number of arguments that alternate between field names and values.");
|
|
3789
|
+
for (var c = 0; c < o.length; c += 2) s.push(Un(e, o[c])), u.push(o[c + 1]);
|
|
3790
3790
|
// We iterate in reverse order to pick the last value for a field if the
|
|
3791
3791
|
// user specified the field multiple times.
|
|
3792
|
-
for (var f = [], l =
|
|
3793
|
-
var
|
|
3792
|
+
for (var f = [], l = Ct.empty(), d = s.length - 1; d >= 0; --d) if (!Mn(f, s[d])) {
|
|
3793
|
+
var p = s[d], m = u[d];
|
|
3794
3794
|
// For Compat types, we have to "extract" the underlying types before
|
|
3795
3795
|
// performing validation.
|
|
3796
3796
|
m = h(m);
|
|
3797
|
-
var y = a.st(
|
|
3798
|
-
if (m instanceof
|
|
3797
|
+
var y = a.st(p);
|
|
3798
|
+
if (m instanceof In)
|
|
3799
3799
|
// Add it to the field mask, but don't add anything to updateData.
|
|
3800
|
-
f.push(
|
|
3801
|
-
var v =
|
|
3802
|
-
null != v && (f.push(
|
|
3800
|
+
f.push(p); else {
|
|
3801
|
+
var v = qn(m, y);
|
|
3802
|
+
null != v && (f.push(p), l.set(p, v));
|
|
3803
3803
|
}
|
|
3804
3804
|
}
|
|
3805
|
-
var g = new
|
|
3806
|
-
return new
|
|
3805
|
+
var g = new _t(f);
|
|
3806
|
+
return new wn(l, g, a.fieldTransforms);
|
|
3807
3807
|
}
|
|
3808
3808
|
|
|
3809
3809
|
/**
|
|
@@ -3812,8 +3812,8 @@ var Dn = /** @class */ function(e) {
|
|
|
3812
3812
|
*
|
|
3813
3813
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
3814
3814
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
3815
|
-
*/ function
|
|
3816
|
-
return void 0 === r && (r = !1),
|
|
3815
|
+
*/ function On(t, e, n, r) {
|
|
3816
|
+
return void 0 === r && (r = !1), qn(n, t.at(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
3817
3817
|
}
|
|
3818
3818
|
|
|
3819
3819
|
/**
|
|
@@ -3824,12 +3824,12 @@ var Dn = /** @class */ function(e) {
|
|
|
3824
3824
|
* the source of the data being parsed, etc.
|
|
3825
3825
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
3826
3826
|
* that should not be included in the resulting parsed data.
|
|
3827
|
-
*/ function
|
|
3828
|
-
if (
|
|
3827
|
+
*/ function qn(t, e) {
|
|
3828
|
+
if (Ln(
|
|
3829
3829
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
3830
3830
|
// from firestore-exp.
|
|
3831
|
-
t = h(t))) return
|
|
3832
|
-
if (t instanceof
|
|
3831
|
+
t = h(t))) return Rn("Unsupported field value:", e, t), jn(t, e);
|
|
3832
|
+
if (t instanceof mn)
|
|
3833
3833
|
// FieldValues usually parse into transforms (except FieldValue.delete())
|
|
3834
3834
|
// in which case we do not want to include this field in our parsed data
|
|
3835
3835
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -3841,7 +3841,7 @@ var Dn = /** @class */ function(e) {
|
|
|
3841
3841
|
*/
|
|
3842
3842
|
return function(t, e) {
|
|
3843
3843
|
// Sentinels are only supported with writes, and not within arrays.
|
|
3844
|
-
if (!
|
|
3844
|
+
if (!bn(e.X)) throw e.ot(t._methodName + "() can only be used with update() and set()");
|
|
3845
3845
|
if (!e.path) throw e.ot(t._methodName + "() is not currently supported inside arrays");
|
|
3846
3846
|
var n = t._toFieldTransform(e);
|
|
3847
3847
|
n && e.fieldTransforms.push(n);
|
|
@@ -3861,10 +3861,10 @@ var Dn = /** @class */ function(e) {
|
|
|
3861
3861
|
// the set of values to be included for the IN query) that may directly
|
|
3862
3862
|
// contain additional arrays (each representing an individual field
|
|
3863
3863
|
// value), so we disable this validation.
|
|
3864
|
-
if (e.settings.
|
|
3864
|
+
if (e.settings.et && 4 /* ArrayArgument */ !== e.X) throw e.ot("Nested arrays are not supported");
|
|
3865
3865
|
return function(t, e) {
|
|
3866
3866
|
for (var n = [], r = 0, i = 0, o = t; i < o.length; i++) {
|
|
3867
|
-
var a =
|
|
3867
|
+
var a = qn(o[i], e.it(r));
|
|
3868
3868
|
null == a && (
|
|
3869
3869
|
// Just include nulls in the array for fields being replaced with a
|
|
3870
3870
|
// sentinel.
|
|
@@ -3883,7 +3883,7 @@ var Dn = /** @class */ function(e) {
|
|
|
3883
3883
|
if (null === (t = h(t))) return {
|
|
3884
3884
|
nullValue: "NULL_VALUE"
|
|
3885
3885
|
};
|
|
3886
|
-
if ("number" == typeof t) return
|
|
3886
|
+
if ("number" == typeof t) return le(e.S, t);
|
|
3887
3887
|
if ("boolean" == typeof t) return {
|
|
3888
3888
|
booleanValue: t
|
|
3889
3889
|
};
|
|
@@ -3891,41 +3891,41 @@ var Dn = /** @class */ function(e) {
|
|
|
3891
3891
|
stringValue: t
|
|
3892
3892
|
};
|
|
3893
3893
|
if (t instanceof Date) {
|
|
3894
|
-
var n =
|
|
3894
|
+
var n = vt.fromDate(t);
|
|
3895
3895
|
return {
|
|
3896
|
-
timestampValue:
|
|
3896
|
+
timestampValue: Ve(e.S, n)
|
|
3897
3897
|
};
|
|
3898
3898
|
}
|
|
3899
|
-
if (t instanceof
|
|
3899
|
+
if (t instanceof vt) {
|
|
3900
3900
|
// Firestore backend truncates precision down to microseconds. To ensure
|
|
3901
3901
|
// offline mode works the same with regards to truncation, perform the
|
|
3902
3902
|
// truncation immediately without waiting for the backend to do that.
|
|
3903
|
-
var r = new
|
|
3903
|
+
var r = new vt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
3904
3904
|
return {
|
|
3905
|
-
timestampValue:
|
|
3905
|
+
timestampValue: Ve(e.S, r)
|
|
3906
3906
|
};
|
|
3907
3907
|
}
|
|
3908
|
-
if (t instanceof
|
|
3908
|
+
if (t instanceof yn) return {
|
|
3909
3909
|
geoPointValue: {
|
|
3910
3910
|
latitude: t.latitude,
|
|
3911
3911
|
longitude: t.longitude
|
|
3912
3912
|
}
|
|
3913
3913
|
};
|
|
3914
|
-
if (t instanceof
|
|
3915
|
-
bytesValue:
|
|
3914
|
+
if (t instanceof pn) return {
|
|
3915
|
+
bytesValue: De(e.S, t._byteString)
|
|
3916
3916
|
};
|
|
3917
|
-
if (t instanceof
|
|
3917
|
+
if (t instanceof rn) {
|
|
3918
3918
|
var i = e.databaseId, o = t.firestore._databaseId;
|
|
3919
3919
|
if (!o.isEqual(i)) throw e.ot("Document reference is for database " + o.projectId + "/" + o.database + " but should be for database " + i.projectId + "/" + i.database);
|
|
3920
3920
|
return {
|
|
3921
|
-
referenceValue:
|
|
3921
|
+
referenceValue: Ne(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
3922
3922
|
};
|
|
3923
3923
|
}
|
|
3924
|
-
throw e.ot("Unsupported field value: " +
|
|
3924
|
+
throw e.ot("Unsupported field value: " + rt(t));
|
|
3925
3925
|
}(t, e);
|
|
3926
3926
|
}
|
|
3927
3927
|
|
|
3928
|
-
function
|
|
3928
|
+
function jn(t, e) {
|
|
3929
3929
|
var n = {};
|
|
3930
3930
|
return function(t) {
|
|
3931
3931
|
for (var e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
@@ -3933,8 +3933,8 @@ function Ln(t, e) {
|
|
|
3933
3933
|
}(t) ?
|
|
3934
3934
|
// If we encounter an empty object, we explicitly add it to the update
|
|
3935
3935
|
// mask to ensure that the server creates a map entry.
|
|
3936
|
-
e.path && e.path.length > 0 && e.fieldMask.push(e.path) :
|
|
3937
|
-
var i =
|
|
3936
|
+
e.path && e.path.length > 0 && e.fieldMask.push(e.path) : bt(t, (function(t, r) {
|
|
3937
|
+
var i = qn(r, e.nt(t));
|
|
3938
3938
|
null != i && (n[t] = i);
|
|
3939
3939
|
})), {
|
|
3940
3940
|
mapValue: {
|
|
@@ -3943,35 +3943,35 @@ function Ln(t, e) {
|
|
|
3943
3943
|
};
|
|
3944
3944
|
}
|
|
3945
3945
|
|
|
3946
|
-
function
|
|
3947
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof
|
|
3946
|
+
function Ln(t) {
|
|
3947
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof vt || t instanceof yn || t instanceof pn || t instanceof rn || t instanceof mn);
|
|
3948
3948
|
}
|
|
3949
3949
|
|
|
3950
|
-
function
|
|
3951
|
-
if (!
|
|
3950
|
+
function Rn(t, e, n) {
|
|
3951
|
+
if (!Ln(n) || !function(t) {
|
|
3952
3952
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
3953
3953
|
}(n)) {
|
|
3954
|
-
var r =
|
|
3954
|
+
var r = rt(n);
|
|
3955
3955
|
throw "an object" === r ? e.ot(t + " a custom object") : e.ot(t + " " + r);
|
|
3956
3956
|
}
|
|
3957
3957
|
}
|
|
3958
3958
|
|
|
3959
3959
|
/**
|
|
3960
3960
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
3961
|
-
*/ function
|
|
3961
|
+
*/ function Un(t, e, n) {
|
|
3962
3962
|
if (
|
|
3963
3963
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
3964
3964
|
// FieldPath.
|
|
3965
|
-
(e = h(e)) instanceof
|
|
3966
|
-
if ("string" == typeof e) return
|
|
3967
|
-
throw
|
|
3965
|
+
(e = h(e)) instanceof hn) return e._internalPath;
|
|
3966
|
+
if ("string" == typeof e) return Bn(t, e);
|
|
3967
|
+
throw Cn("Field path arguments must be of type string or FieldPath.", t,
|
|
3968
3968
|
/* hasConverter= */ !1,
|
|
3969
3969
|
/* path= */ void 0, n);
|
|
3970
3970
|
}
|
|
3971
3971
|
|
|
3972
3972
|
/**
|
|
3973
3973
|
* Matches any characters in a field path string that are reserved.
|
|
3974
|
-
*/ var
|
|
3974
|
+
*/ var xn = new RegExp("[~\\*/\\[\\]]");
|
|
3975
3975
|
|
|
3976
3976
|
/**
|
|
3977
3977
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -3981,29 +3981,29 @@ function Un(t, e, n) {
|
|
|
3981
3981
|
* split on dots.
|
|
3982
3982
|
* @param targetDoc - The document against which the field path will be
|
|
3983
3983
|
* evaluated.
|
|
3984
|
-
*/ function
|
|
3985
|
-
if (e.search(
|
|
3984
|
+
*/ function Bn(t, e, n) {
|
|
3985
|
+
if (e.search(xn) >= 0) throw Cn("Invalid field path (" + e + "). Paths must not contain '~', '*', '/', '[', or ']'", t,
|
|
3986
3986
|
/* hasConverter= */ !1,
|
|
3987
3987
|
/* path= */ void 0, n);
|
|
3988
3988
|
try {
|
|
3989
|
-
return (new (
|
|
3989
|
+
return (new (hn.bind.apply(hn, r([ void 0 ], e.split(".")))))._internalPath;
|
|
3990
3990
|
} catch (r) {
|
|
3991
|
-
throw
|
|
3991
|
+
throw Cn("Invalid field path (" + e + "). Paths must not be empty, begin with '.', end with '.', or contain '..'", t,
|
|
3992
3992
|
/* hasConverter= */ !1,
|
|
3993
3993
|
/* path= */ void 0, n);
|
|
3994
3994
|
}
|
|
3995
3995
|
}
|
|
3996
3996
|
|
|
3997
|
-
function
|
|
3997
|
+
function Cn(t, e, n, r, i) {
|
|
3998
3998
|
var o = r && !r.isEmpty(), a = void 0 !== i, s = "Function " + e + "() called with invalid data";
|
|
3999
3999
|
n && (s += " (via `toFirestore()`)");
|
|
4000
4000
|
var u = "";
|
|
4001
4001
|
return (o || a) && (u += " (found", o && (u += " in field " + r), a && (u += " in document " + i),
|
|
4002
|
-
u += ")"), new
|
|
4002
|
+
u += ")"), new x(V, (s += ". ") + t + u)
|
|
4003
4003
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */;
|
|
4004
4004
|
}
|
|
4005
4005
|
|
|
4006
|
-
function
|
|
4006
|
+
function Mn(t, e) {
|
|
4007
4007
|
return t.some((function(t) {
|
|
4008
4008
|
return t.isEqual(e);
|
|
4009
4009
|
}));
|
|
@@ -4033,7 +4033,7 @@ function Gn(t, e) {
|
|
|
4033
4033
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
4034
4034
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
4035
4035
|
* explicitly verify a document's existence.
|
|
4036
|
-
*/ var
|
|
4036
|
+
*/ var Gn = /** @class */ function() {
|
|
4037
4037
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
4038
4038
|
// the legacy SDK. The changes are:
|
|
4039
4039
|
// - No support for SnapshotMetadata.
|
|
@@ -4054,7 +4054,7 @@ function Gn(t, e) {
|
|
|
4054
4054
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
4055
4055
|
*/
|
|
4056
4056
|
get: function() {
|
|
4057
|
-
return new
|
|
4057
|
+
return new rn(this._firestore, this._converter, this._key);
|
|
4058
4058
|
},
|
|
4059
4059
|
enumerable: !1,
|
|
4060
4060
|
configurable: !0
|
|
@@ -4079,7 +4079,7 @@ function Gn(t, e) {
|
|
|
4079
4079
|
if (this._converter) {
|
|
4080
4080
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
4081
4081
|
// if a converter has been provided.
|
|
4082
|
-
var t = new
|
|
4082
|
+
var t = new Qn(this._firestore, this._userDataWriter, this._key, this._document,
|
|
4083
4083
|
/* converter= */ null);
|
|
4084
4084
|
return this._converter.fromFirestore(t);
|
|
4085
4085
|
}
|
|
@@ -4099,11 +4099,11 @@ function Gn(t, e) {
|
|
|
4099
4099
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4100
4100
|
t.prototype.get = function(t) {
|
|
4101
4101
|
if (this._document) {
|
|
4102
|
-
var e = this._document.data.field(
|
|
4102
|
+
var e = this._document.data.field(Kn("DocumentSnapshot.get", t));
|
|
4103
4103
|
if (null !== e) return this._userDataWriter.convertValue(e);
|
|
4104
4104
|
}
|
|
4105
4105
|
}, t;
|
|
4106
|
-
}(),
|
|
4106
|
+
}(), Qn = /** @class */ function(e) {
|
|
4107
4107
|
function n() {
|
|
4108
4108
|
return null !== e && e.apply(this, arguments) || this;
|
|
4109
4109
|
}
|
|
@@ -4115,7 +4115,7 @@ function Gn(t, e) {
|
|
|
4115
4115
|
*/ return t(n, e), n.prototype.data = function() {
|
|
4116
4116
|
return e.prototype.data.call(this);
|
|
4117
4117
|
}, n;
|
|
4118
|
-
}(
|
|
4118
|
+
}(Gn), zn = /** @class */ function() {
|
|
4119
4119
|
/** @hideconstructor */
|
|
4120
4120
|
function t(t, e) {
|
|
4121
4121
|
this._docs = e, this.query = t;
|
|
@@ -4169,15 +4169,15 @@ function Gn(t, e) {
|
|
|
4169
4169
|
* @param right - A snapshot to compare.
|
|
4170
4170
|
* @returns true if the snapshots are equal.
|
|
4171
4171
|
*/
|
|
4172
|
-
function
|
|
4173
|
-
return t = h(t), e = h(e), t instanceof
|
|
4172
|
+
function Hn(t, e) {
|
|
4173
|
+
return t = h(t), e = h(e), t instanceof Gn && e instanceof Gn ? 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 zn && e instanceof zn && ln(t.query, e.query) && yt(t.docs, e.docs, Hn)
|
|
4174
4174
|
/**
|
|
4175
4175
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
4176
4176
|
*/;
|
|
4177
4177
|
}
|
|
4178
4178
|
|
|
4179
|
-
function
|
|
4180
|
-
return "string" == typeof e ?
|
|
4179
|
+
function Kn(t, e) {
|
|
4180
|
+
return "string" == typeof e ? Bn(t, e) : e instanceof hn ? e._internalPath : e._delegate._internalPath;
|
|
4181
4181
|
}
|
|
4182
4182
|
|
|
4183
4183
|
/**
|
|
@@ -4203,7 +4203,7 @@ function Wn(t, e) {
|
|
|
4203
4203
|
* endBefore:1}, {@link (endAt:1)}, {@link limit} or {@link limitToLast} and
|
|
4204
4204
|
* can then be passed to {@link query} to create a new query instance that
|
|
4205
4205
|
* also contains this `QueryConstraint`.
|
|
4206
|
-
*/ var
|
|
4206
|
+
*/ var Wn = function() {};
|
|
4207
4207
|
|
|
4208
4208
|
/**
|
|
4209
4209
|
* Creates a new immutable instance of {@link Query} that is extended to also include
|
|
@@ -4213,7 +4213,7 @@ function Wn(t, e) {
|
|
|
4213
4213
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
4214
4214
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
4215
4215
|
* existing or new constraints.
|
|
4216
|
-
*/ function
|
|
4216
|
+
*/ function Yn(t) {
|
|
4217
4217
|
for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
|
|
4218
4218
|
for (var r = 0, i = e; r < i.length; r++) {
|
|
4219
4219
|
var o = i[r];
|
|
@@ -4222,39 +4222,39 @@ function Wn(t, e) {
|
|
|
4222
4222
|
return t;
|
|
4223
4223
|
}
|
|
4224
4224
|
|
|
4225
|
-
var
|
|
4225
|
+
var Xn = /** @class */ function(e) {
|
|
4226
4226
|
function n(t, n, r) {
|
|
4227
4227
|
var i = this;
|
|
4228
4228
|
return (i = e.call(this) || this).ft = t, i.dt = n, i.wt = r, i.type = "where",
|
|
4229
4229
|
i;
|
|
4230
4230
|
}
|
|
4231
4231
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4232
|
-
var e =
|
|
4232
|
+
var e = Tn(t.firestore), n = function(t, e, n, r, i, o, a) {
|
|
4233
4233
|
var s;
|
|
4234
4234
|
if (i.isKeyField()) {
|
|
4235
|
-
if ("array-contains" /* ARRAY_CONTAINS */ === o || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === o) throw new
|
|
4235
|
+
if ("array-contains" /* ARRAY_CONTAINS */ === o || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === o) throw new x(V, "Invalid Query. You can't perform '" + o + "' queries on FieldPath.documentId().");
|
|
4236
4236
|
if ("in" /* IN */ === o || "not-in" /* NOT_IN */ === o) {
|
|
4237
|
-
|
|
4237
|
+
lr(a, o);
|
|
4238
4238
|
for (var u = [], c = 0, f = a; c < f.length; c++) {
|
|
4239
4239
|
var l = f[c];
|
|
4240
|
-
u.push(
|
|
4240
|
+
u.push(fr(r, t, l));
|
|
4241
4241
|
}
|
|
4242
4242
|
s = {
|
|
4243
4243
|
arrayValue: {
|
|
4244
4244
|
values: u
|
|
4245
4245
|
}
|
|
4246
4246
|
};
|
|
4247
|
-
} else s =
|
|
4248
|
-
} else "in" /* IN */ !== o && "not-in" /* NOT_IN */ !== o && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== o ||
|
|
4249
|
-
s =
|
|
4247
|
+
} else s = fr(r, t, a);
|
|
4248
|
+
} else "in" /* IN */ !== o && "not-in" /* NOT_IN */ !== o && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== o || lr(a, o),
|
|
4249
|
+
s = On(n, "where", a,
|
|
4250
4250
|
/* allowArrays= */ "in" /* IN */ === o || "not-in" /* NOT_IN */ === o);
|
|
4251
|
-
var h =
|
|
4251
|
+
var h = zt.create(i, o, s);
|
|
4252
4252
|
return function(t, e) {
|
|
4253
|
-
if (e.
|
|
4254
|
-
var n =
|
|
4255
|
-
if (null !== n && !n.isEqual(e.field)) throw new
|
|
4256
|
-
var r =
|
|
4257
|
-
null !== r &&
|
|
4253
|
+
if (e.D()) {
|
|
4254
|
+
var n = se(t);
|
|
4255
|
+
if (null !== n && !n.isEqual(e.field)) throw new x(V, "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() + "'");
|
|
4256
|
+
var r = ae(t);
|
|
4257
|
+
null !== r && hr(t, e.field, r);
|
|
4258
4258
|
}
|
|
4259
4259
|
var i = function(t, e) {
|
|
4260
4260
|
for (var n = 0, r = t.filters; n < r.length; n++) {
|
|
@@ -4298,15 +4298,15 @@ var $n = /** @class */ function(e) {
|
|
|
4298
4298
|
}(e.op));
|
|
4299
4299
|
if (null !== i)
|
|
4300
4300
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
4301
|
-
throw i === e.op ? new
|
|
4301
|
+
throw i === e.op ? new x(V, "Invalid query. You cannot use more than one '" + e.op.toString() + "' filter.") : new x(V, "Invalid query. You cannot use '" + e.op.toString() + "' filters with '" + i.toString() + "' filters.");
|
|
4302
4302
|
}(t, h), h;
|
|
4303
4303
|
}(t._query, 0, e, t.firestore._databaseId, this.ft, this.dt, this.wt);
|
|
4304
|
-
return new
|
|
4304
|
+
return new on(t.firestore, t.converter, function(t, e) {
|
|
4305
4305
|
var n = t.filters.concat([ e ]);
|
|
4306
|
-
return new
|
|
4306
|
+
return new ie(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
4307
4307
|
}(t._query, n));
|
|
4308
4308
|
}, n;
|
|
4309
|
-
}(
|
|
4309
|
+
}(Wn);
|
|
4310
4310
|
|
|
4311
4311
|
/**
|
|
4312
4312
|
* Creates a {@link QueryConstraint} that enforces that documents must contain the
|
|
@@ -4318,36 +4318,36 @@ var $n = /** @class */ function(e) {
|
|
|
4318
4318
|
* "<=", "!=").
|
|
4319
4319
|
* @param value - The value for comparison
|
|
4320
4320
|
* @returns The created {@link Query}.
|
|
4321
|
-
*/ function
|
|
4322
|
-
var r = e, i =
|
|
4323
|
-
return new
|
|
4321
|
+
*/ function $n(t, e, n) {
|
|
4322
|
+
var r = e, i = Kn("where", t);
|
|
4323
|
+
return new Xn(i, r, n);
|
|
4324
4324
|
}
|
|
4325
4325
|
|
|
4326
|
-
var
|
|
4326
|
+
var Jn = /** @class */ function(e) {
|
|
4327
4327
|
function n(t, n) {
|
|
4328
4328
|
var r = this;
|
|
4329
4329
|
return (r = e.call(this) || this).ft = t, r.yt = n, r.type = "orderBy", r;
|
|
4330
4330
|
}
|
|
4331
4331
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4332
4332
|
var e = function(t, e, n) {
|
|
4333
|
-
if (null !== t.startAt) throw new
|
|
4334
|
-
if (null !== t.endAt) throw new
|
|
4335
|
-
var r = new
|
|
4333
|
+
if (null !== t.startAt) throw new x(V, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
4334
|
+
if (null !== t.endAt) throw new x(V, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
4335
|
+
var r = new ee(e, n);
|
|
4336
4336
|
return function(t, e) {
|
|
4337
|
-
if (null ===
|
|
4337
|
+
if (null === ae(t)) {
|
|
4338
4338
|
// This is the first order by. It must match any inequality.
|
|
4339
|
-
var n =
|
|
4340
|
-
null !== n &&
|
|
4339
|
+
var n = se(t);
|
|
4340
|
+
null !== n && hr(t, n, e.field);
|
|
4341
4341
|
}
|
|
4342
4342
|
}(t, r), r;
|
|
4343
4343
|
}(t._query, this.ft, this.yt);
|
|
4344
|
-
return new
|
|
4344
|
+
return new on(t.firestore, t.converter, function(t, e) {
|
|
4345
4345
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4346
4346
|
var n = t.explicitOrderBy.concat([ e ]);
|
|
4347
|
-
return new
|
|
4347
|
+
return new ie(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
4348
4348
|
}(t._query, e));
|
|
4349
4349
|
}, n;
|
|
4350
|
-
}(
|
|
4350
|
+
}(Wn);
|
|
4351
4351
|
|
|
4352
4352
|
/**
|
|
4353
4353
|
* Creates a {@link QueryConstraint} that sorts the query result by the
|
|
@@ -4357,31 +4357,31 @@ var Zn = /** @class */ function(e) {
|
|
|
4357
4357
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
4358
4358
|
* not specified, order will be ascending.
|
|
4359
4359
|
* @returns The created {@link Query}.
|
|
4360
|
-
*/ function
|
|
4360
|
+
*/ function Zn(t, e) {
|
|
4361
4361
|
void 0 === e && (e = "asc");
|
|
4362
|
-
var n = e, r =
|
|
4363
|
-
return new
|
|
4362
|
+
var n = e, r = Kn("orderBy", t);
|
|
4363
|
+
return new Jn(r, n);
|
|
4364
4364
|
}
|
|
4365
4365
|
|
|
4366
|
-
var
|
|
4366
|
+
var tr = /** @class */ function(e) {
|
|
4367
4367
|
function n(t, n, r) {
|
|
4368
4368
|
var i = this;
|
|
4369
4369
|
return (i = e.call(this) || this).type = t, i._t = n, i.gt = r, i;
|
|
4370
4370
|
}
|
|
4371
4371
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4372
|
-
return new
|
|
4373
|
-
return new
|
|
4372
|
+
return new on(t.firestore, t.converter, function(t, e, n) {
|
|
4373
|
+
return new ie(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
4374
4374
|
}(t._query, this._t, this.gt));
|
|
4375
4375
|
}, n;
|
|
4376
|
-
}(
|
|
4376
|
+
}(Wn);
|
|
4377
4377
|
|
|
4378
4378
|
/**
|
|
4379
4379
|
* Creates a {@link QueryConstraint} that only returns the first matching documents.
|
|
4380
4380
|
*
|
|
4381
4381
|
* @param limit - The maximum number of items to return.
|
|
4382
4382
|
* @returns The created {@link Query}.
|
|
4383
|
-
*/ function
|
|
4384
|
-
return
|
|
4383
|
+
*/ function er(t) {
|
|
4384
|
+
return ot("limit", t), new tr("limit", t, "F" /* First */)
|
|
4385
4385
|
/**
|
|
4386
4386
|
* Creates a {@link QueryConstraint} that only returns the last matching documents.
|
|
4387
4387
|
*
|
|
@@ -4393,60 +4393,60 @@ var er = /** @class */ function(e) {
|
|
|
4393
4393
|
*/;
|
|
4394
4394
|
}
|
|
4395
4395
|
|
|
4396
|
-
function
|
|
4397
|
-
return
|
|
4396
|
+
function nr(t) {
|
|
4397
|
+
return ot("limitToLast", t), new tr("limitToLast", t, "L" /* Last */);
|
|
4398
4398
|
}
|
|
4399
4399
|
|
|
4400
|
-
var
|
|
4400
|
+
var rr = /** @class */ function(e) {
|
|
4401
4401
|
function n(t, n, r) {
|
|
4402
4402
|
var i = this;
|
|
4403
4403
|
return (i = e.call(this) || this).type = t, i.bt = n, i.vt = r, i;
|
|
4404
4404
|
}
|
|
4405
4405
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4406
|
-
var e =
|
|
4407
|
-
return new
|
|
4408
|
-
return new
|
|
4406
|
+
var e = cr(t, this.type, this.bt, this.vt);
|
|
4407
|
+
return new on(t.firestore, t.converter, function(t, e) {
|
|
4408
|
+
return new ie(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
4409
4409
|
}(t._query, e));
|
|
4410
4410
|
}, n;
|
|
4411
|
-
}(
|
|
4411
|
+
}(Wn);
|
|
4412
4412
|
|
|
4413
|
-
function
|
|
4413
|
+
function ir() {
|
|
4414
4414
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4415
|
-
return new
|
|
4415
|
+
return new rr("startAt", t, /*before=*/ !0);
|
|
4416
4416
|
}
|
|
4417
4417
|
|
|
4418
|
-
function
|
|
4418
|
+
function or() {
|
|
4419
4419
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4420
|
-
return new
|
|
4420
|
+
return new rr("startAfter", t,
|
|
4421
4421
|
/*before=*/ !1);
|
|
4422
4422
|
}
|
|
4423
4423
|
|
|
4424
|
-
var
|
|
4424
|
+
var ar = /** @class */ function(e) {
|
|
4425
4425
|
function n(t, n, r) {
|
|
4426
4426
|
var i = this;
|
|
4427
4427
|
return (i = e.call(this) || this).type = t, i.bt = n, i.vt = r, i;
|
|
4428
4428
|
}
|
|
4429
4429
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4430
|
-
var e =
|
|
4431
|
-
return new
|
|
4432
|
-
return new
|
|
4430
|
+
var e = cr(t, this.type, this.bt, this.vt);
|
|
4431
|
+
return new on(t.firestore, t.converter, function(t, e) {
|
|
4432
|
+
return new ie(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
4433
4433
|
}(t._query, e));
|
|
4434
4434
|
}, n;
|
|
4435
|
-
}(
|
|
4435
|
+
}(Wn);
|
|
4436
4436
|
|
|
4437
|
-
function
|
|
4437
|
+
function sr() {
|
|
4438
4438
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4439
|
-
return new
|
|
4439
|
+
return new ar("endBefore", t, /*before=*/ !0);
|
|
4440
4440
|
}
|
|
4441
4441
|
|
|
4442
|
-
function
|
|
4442
|
+
function ur() {
|
|
4443
4443
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4444
|
-
return new
|
|
4444
|
+
return new ar("endAt", t, /*before=*/ !1);
|
|
4445
4445
|
}
|
|
4446
4446
|
|
|
4447
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
4448
|
-
if (n[0] = h(n[0]), n[0] instanceof
|
|
4449
|
-
if (!r) throw new
|
|
4447
|
+
/** Helper function to create a bound from a document or fields */ function cr(t, e, n, r) {
|
|
4448
|
+
if (n[0] = h(n[0]), n[0] instanceof Gn) return function(t, e, n, r, i) {
|
|
4449
|
+
if (!r) throw new x(k, "Can't use a DocumentSnapshot that doesn't exist for " + n + "().");
|
|
4450
4450
|
// Because people expect to continue/end a query at the exact document
|
|
4451
4451
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
4452
4452
|
// sort order, because it's guaranteed to contain the document key. That way
|
|
@@ -4454,65 +4454,65 @@ function cr() {
|
|
|
4454
4454
|
// the provided document. Without the key (by using the explicit sort
|
|
4455
4455
|
// orders), multiple documents could match the position, yielding duplicate
|
|
4456
4456
|
// results.
|
|
4457
|
-
for (var o = [], a = 0, s =
|
|
4457
|
+
for (var o = [], a = 0, s = ce(t); a < s.length; a++) {
|
|
4458
4458
|
var u = s[a];
|
|
4459
|
-
if (u.field.isKeyField()) o.push(
|
|
4459
|
+
if (u.field.isKeyField()) o.push(jt(e, r.key)); else {
|
|
4460
4460
|
var c = r.data.field(u.field);
|
|
4461
|
-
if (
|
|
4461
|
+
if (Vt(c)) throw new x(V, 'Invalid query. You are trying to start or end a query using a document for which the field "' + u.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
4462
4462
|
if (null === c) {
|
|
4463
4463
|
var f = u.field.canonicalString();
|
|
4464
|
-
throw new
|
|
4464
|
+
throw new x(V, "Invalid query. You are trying to start or end a query using a document for which the field '" + f + "' (used as the orderBy) does not exist.");
|
|
4465
4465
|
}
|
|
4466
4466
|
o.push(c);
|
|
4467
4467
|
}
|
|
4468
4468
|
}
|
|
4469
|
-
return new
|
|
4469
|
+
return new te(o, i);
|
|
4470
4470
|
}(t._query, t.firestore._databaseId, e, n[0]._document, r);
|
|
4471
|
-
var i =
|
|
4471
|
+
var i = Tn(t.firestore);
|
|
4472
4472
|
return function(t, e, n, r, i, o) {
|
|
4473
4473
|
// Use explicit order by's because it has to match the query the user made
|
|
4474
4474
|
var a = t.explicitOrderBy;
|
|
4475
|
-
if (i.length > a.length) throw new
|
|
4475
|
+
if (i.length > a.length) throw new x(V, "Too many arguments provided to " + r + "(). The number of arguments must be less than or equal to the number of orderBy() clauses");
|
|
4476
4476
|
for (var s = [], u = 0; u < i.length; u++) {
|
|
4477
4477
|
var c = i[u];
|
|
4478
4478
|
if (a[u].field.isKeyField()) {
|
|
4479
|
-
if ("string" != typeof c) throw new
|
|
4480
|
-
if (!
|
|
4481
|
-
var f = t.path.child(
|
|
4482
|
-
if (!
|
|
4483
|
-
var l = new
|
|
4484
|
-
s.push(
|
|
4479
|
+
if ("string" != typeof c) throw new x(V, "Invalid query. Expected a string for document ID in " + r + "(), but got a " + typeof c);
|
|
4480
|
+
if (!ue(t) && -1 !== c.indexOf("/")) throw new x(V, "Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to " + r + "() must be a plain document ID, but '" + c + "' contains a slash.");
|
|
4481
|
+
var f = t.path.child(X.fromString(c));
|
|
4482
|
+
if (!Z.isDocumentKey(f)) throw new x(V, "Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to " + r + "() must result in a valid document path, but '" + f + "' is not because it contains an odd number of segments.");
|
|
4483
|
+
var l = new Z(f);
|
|
4484
|
+
s.push(jt(e, l));
|
|
4485
4485
|
} else {
|
|
4486
|
-
var h =
|
|
4486
|
+
var h = On(n, r, c);
|
|
4487
4487
|
s.push(h);
|
|
4488
4488
|
}
|
|
4489
4489
|
}
|
|
4490
|
-
return new
|
|
4490
|
+
return new te(s, o);
|
|
4491
4491
|
}(t._query, t.firestore._databaseId, i, e, n, r);
|
|
4492
4492
|
}
|
|
4493
4493
|
|
|
4494
|
-
function
|
|
4494
|
+
function fr(t, e, n) {
|
|
4495
4495
|
if ("string" == typeof (n = h(n))) {
|
|
4496
|
-
if ("" === n) throw new
|
|
4497
|
-
if (!
|
|
4498
|
-
var r = e.path.child(
|
|
4499
|
-
if (!
|
|
4500
|
-
return
|
|
4496
|
+
if ("" === n) throw new x(V, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
4497
|
+
if (!ue(e) && -1 !== n.indexOf("/")) throw new x(V, "Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '" + n + "' contains a '/' character.");
|
|
4498
|
+
var r = e.path.child(X.fromString(n));
|
|
4499
|
+
if (!Z.isDocumentKey(r)) throw new x(V, "Invalid query. When querying a collection group by FieldPath.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 + ").");
|
|
4500
|
+
return jt(t, new Z(r));
|
|
4501
4501
|
}
|
|
4502
|
-
if (n instanceof
|
|
4503
|
-
throw new
|
|
4502
|
+
if (n instanceof rn) return jt(t, n._key);
|
|
4503
|
+
throw new x(V, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: " + rt(n) + ".");
|
|
4504
4504
|
}
|
|
4505
4505
|
|
|
4506
4506
|
/**
|
|
4507
4507
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
4508
4508
|
* array requirements.
|
|
4509
|
-
*/ function
|
|
4510
|
-
if (!Array.isArray(t) || 0 === t.length) throw new
|
|
4511
|
-
if (t.length > 10) throw new
|
|
4509
|
+
*/ function lr(t, e) {
|
|
4510
|
+
if (!Array.isArray(t) || 0 === t.length) throw new x(V, "Invalid Query. A non-empty array is required for '" + e.toString() + "' filters.");
|
|
4511
|
+
if (t.length > 10) throw new x(V, "Invalid Query. '" + e.toString() + "' filters support a maximum of 10 elements in the value array.");
|
|
4512
4512
|
}
|
|
4513
4513
|
|
|
4514
|
-
function
|
|
4515
|
-
if (!n.isEqual(e)) throw new
|
|
4514
|
+
function hr(t, e, n) {
|
|
4515
|
+
if (!n.isEqual(e)) throw new x(V, "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.");
|
|
4516
4516
|
}
|
|
4517
4517
|
|
|
4518
4518
|
/**
|
|
@@ -4568,21 +4568,21 @@ function pr(t, e, n) {
|
|
|
4568
4568
|
return t ? n && (n.merge || n.mergeFields) ? t.toFirestore(e, n) : t.toFirestore(e) : e;
|
|
4569
4569
|
}
|
|
4570
4570
|
|
|
4571
|
-
var
|
|
4571
|
+
var pr = /** @class */ function(e) {
|
|
4572
4572
|
function n(t) {
|
|
4573
4573
|
var n = this;
|
|
4574
4574
|
return (n = e.call(this) || this).firestore = t, n;
|
|
4575
4575
|
}
|
|
4576
4576
|
return t(n, e), n.prototype.convertBytes = function(t) {
|
|
4577
|
-
return new
|
|
4577
|
+
return new pn(t);
|
|
4578
4578
|
}, n.prototype.convertReference = function(t) {
|
|
4579
4579
|
var e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
4580
|
-
return new
|
|
4580
|
+
return new rn(this.firestore, /* converter= */ null, e);
|
|
4581
4581
|
}, n;
|
|
4582
4582
|
}(/** @class */ function() {
|
|
4583
4583
|
function t() {}
|
|
4584
4584
|
return t.prototype.convertValue = function(t, e) {
|
|
4585
|
-
switch (void 0 === e && (e = "none"),
|
|
4585
|
+
switch (void 0 === e && (e = "none"), Pt(t)) {
|
|
4586
4586
|
case 0 /* NullValue */ :
|
|
4587
4587
|
return null;
|
|
4588
4588
|
|
|
@@ -4590,7 +4590,7 @@ var mr = /** @class */ function(e) {
|
|
|
4590
4590
|
return t.booleanValue;
|
|
4591
4591
|
|
|
4592
4592
|
case 2 /* NumberValue */ :
|
|
4593
|
-
return
|
|
4593
|
+
return It(t.integerValue || t.doubleValue);
|
|
4594
4594
|
|
|
4595
4595
|
case 3 /* TimestampValue */ :
|
|
4596
4596
|
return this.convertTimestamp(t.timestampValue);
|
|
@@ -4602,7 +4602,7 @@ var mr = /** @class */ function(e) {
|
|
|
4602
4602
|
return t.stringValue;
|
|
4603
4603
|
|
|
4604
4604
|
case 6 /* BlobValue */ :
|
|
4605
|
-
return this.convertBytes(
|
|
4605
|
+
return this.convertBytes(At(t.bytesValue));
|
|
4606
4606
|
|
|
4607
4607
|
case 7 /* RefValue */ :
|
|
4608
4608
|
return this.convertReference(t.referenceValue);
|
|
@@ -4621,11 +4621,11 @@ var mr = /** @class */ function(e) {
|
|
|
4621
4621
|
}
|
|
4622
4622
|
}, t.prototype.convertObject = function(t, e) {
|
|
4623
4623
|
var n = this, r = {};
|
|
4624
|
-
return
|
|
4624
|
+
return bt(t.fields, (function(t, i) {
|
|
4625
4625
|
r[t] = n.convertValue(i, e);
|
|
4626
4626
|
})), r;
|
|
4627
4627
|
}, t.prototype.convertGeoPoint = function(t) {
|
|
4628
|
-
return new
|
|
4628
|
+
return new yn(It(t.latitude), It(t.longitude));
|
|
4629
4629
|
}, t.prototype.convertArray = function(t, e) {
|
|
4630
4630
|
var n = this;
|
|
4631
4631
|
return (t.values || []).map((function(t) {
|
|
@@ -4634,22 +4634,22 @@ var mr = /** @class */ function(e) {
|
|
|
4634
4634
|
}, t.prototype.convertServerTimestamp = function(t, e) {
|
|
4635
4635
|
switch (e) {
|
|
4636
4636
|
case "previous":
|
|
4637
|
-
var n =
|
|
4637
|
+
var n = Dt(t);
|
|
4638
4638
|
return null == n ? null : this.convertValue(n, e);
|
|
4639
4639
|
|
|
4640
4640
|
case "estimate":
|
|
4641
|
-
return this.convertTimestamp(
|
|
4641
|
+
return this.convertTimestamp(kt(t));
|
|
4642
4642
|
|
|
4643
4643
|
default:
|
|
4644
4644
|
return null;
|
|
4645
4645
|
}
|
|
4646
4646
|
}, t.prototype.convertTimestamp = function(t) {
|
|
4647
|
-
var e =
|
|
4648
|
-
return new
|
|
4647
|
+
var e = Et(t);
|
|
4648
|
+
return new vt(e.seconds, e.nanos);
|
|
4649
4649
|
}, t.prototype.convertDocumentKey = function(t, e) {
|
|
4650
|
-
var n =
|
|
4651
|
-
T(
|
|
4652
|
-
var r = new
|
|
4650
|
+
var n = X.fromString(t);
|
|
4651
|
+
T(Me(n));
|
|
4652
|
+
var r = new W(n.get(1), n.get(3)), i = new Z(n.popFirst(5));
|
|
4653
4653
|
return r.isEqual(e) ||
|
|
4654
4654
|
// TODO(b/64130202): Somehow support foreign references.
|
|
4655
4655
|
w("Document " + i + " contains a document reference within a different database (" + r.projectId + "/" + r.database + ") which is not supported. It will be treated as a reference in the current database (" + e.projectId + "/" + e.database + ") instead."),
|
|
@@ -4669,12 +4669,12 @@ var mr = /** @class */ function(e) {
|
|
|
4669
4669
|
* @param reference - The reference of the document to fetch.
|
|
4670
4670
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
4671
4671
|
* document contents.
|
|
4672
|
-
*/ function
|
|
4673
|
-
var e =
|
|
4674
|
-
return
|
|
4672
|
+
*/ function mr(t) {
|
|
4673
|
+
var e = Xe((t = it(t, rn)).firestore), n = new pr(t.firestore);
|
|
4674
|
+
return Ke(e, [ t._key ]).then((function(e) {
|
|
4675
4675
|
T(1 === e.length);
|
|
4676
4676
|
var r = e[0];
|
|
4677
|
-
return new
|
|
4677
|
+
return new Gn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
4678
4678
|
}));
|
|
4679
4679
|
}
|
|
4680
4680
|
|
|
@@ -4689,35 +4689,35 @@ var mr = /** @class */ function(e) {
|
|
|
4689
4689
|
*
|
|
4690
4690
|
* @param query - The `Query` to execute.
|
|
4691
4691
|
* @returns A Promise that will be resolved with the results of the query.
|
|
4692
|
-
*/ function
|
|
4692
|
+
*/ function yr(t) {
|
|
4693
4693
|
!function(t) {
|
|
4694
|
-
if (
|
|
4695
|
-
}((t =
|
|
4696
|
-
var e =
|
|
4697
|
-
return
|
|
4694
|
+
if (oe(t) && 0 === t.explicitOrderBy.length) throw new x(L, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
4695
|
+
}((t = it(t, on))._query);
|
|
4696
|
+
var e = Xe(t.firestore), n = new pr(t.firestore);
|
|
4697
|
+
return We(e, t._query).then((function(e) {
|
|
4698
4698
|
var r = e.map((function(e) {
|
|
4699
|
-
return new
|
|
4699
|
+
return new Qn(t.firestore, n, e.key, e, t.converter);
|
|
4700
4700
|
}));
|
|
4701
|
-
return
|
|
4701
|
+
return oe(t._query) &&
|
|
4702
4702
|
// Limit to last queries reverse the orderBy constraint that was
|
|
4703
4703
|
// specified by the user. As such, we need to reverse the order of the
|
|
4704
4704
|
// results to return the documents in the expected order.
|
|
4705
|
-
r.reverse(), new
|
|
4705
|
+
r.reverse(), new zn(t, r);
|
|
4706
4706
|
}));
|
|
4707
4707
|
}
|
|
4708
4708
|
|
|
4709
|
-
function
|
|
4710
|
-
var r = dr((t =
|
|
4711
|
-
return
|
|
4709
|
+
function vr(t, e, n) {
|
|
4710
|
+
var r = dr((t = it(t, rn)).converter, e, n), i = En(Tn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
4711
|
+
return He(Xe(t.firestore), [ i.toMutation(t._key, ge.none()) ]);
|
|
4712
4712
|
}
|
|
4713
4713
|
|
|
4714
|
-
function
|
|
4714
|
+
function gr(t, e, n) {
|
|
4715
4715
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
4716
|
-
var o, a =
|
|
4716
|
+
var o, a = Tn((t = it(t, rn)).firestore);
|
|
4717
4717
|
// For Compat types, we have to "extract" the underlying types before
|
|
4718
4718
|
// performing validation.
|
|
4719
|
-
return o = "string" == typeof (e = h(e)) || e instanceof
|
|
4720
|
-
|
|
4719
|
+
return o = "string" == typeof (e = h(e)) || e instanceof hn ? Fn(a, "updateDoc", t._key, e, n, r) : Nn(a, "updateDoc", t._key, e),
|
|
4720
|
+
He(Xe(t.firestore), [ o.toMutation(t._key, ge.exists(!0)) ]);
|
|
4721
4721
|
}
|
|
4722
4722
|
|
|
4723
4723
|
/**
|
|
@@ -4731,8 +4731,8 @@ function wr(t, e, n) {
|
|
|
4731
4731
|
* @param reference - A reference to the document to delete.
|
|
4732
4732
|
* @returns A `Promise` resolved once the document has been successfully
|
|
4733
4733
|
* deleted from the backend.
|
|
4734
|
-
*/ function
|
|
4735
|
-
return
|
|
4734
|
+
*/ function wr(t) {
|
|
4735
|
+
return He(Xe((t = it(t, rn)).firestore), [ new Se(t._key, ge.none()) ]);
|
|
4736
4736
|
}
|
|
4737
4737
|
|
|
4738
4738
|
/**
|
|
@@ -4748,9 +4748,9 @@ function wr(t, e, n) {
|
|
|
4748
4748
|
* @param data - An Object containing the data for the new document.
|
|
4749
4749
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
4750
4750
|
* newly created document after it has been written to the backend.
|
|
4751
|
-
*/ function
|
|
4752
|
-
var n =
|
|
4753
|
-
return
|
|
4751
|
+
*/ function br(t, e) {
|
|
4752
|
+
var n = cn(t = it(t, an)), r = dr(t.converter, e), i = En(Tn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
4753
|
+
return He(Xe(t.firestore), [ i.toMutation(n._key, ge.exists(!1)) ]).then((function() {
|
|
4754
4754
|
return n;
|
|
4755
4755
|
}));
|
|
4756
4756
|
}
|
|
@@ -4774,15 +4774,15 @@ function wr(t, e, n) {
|
|
|
4774
4774
|
/**
|
|
4775
4775
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
4776
4776
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
4777
|
-
*/ function
|
|
4778
|
-
return new
|
|
4777
|
+
*/ function _r() {
|
|
4778
|
+
return new In("deleteField");
|
|
4779
4779
|
}
|
|
4780
4780
|
|
|
4781
4781
|
/**
|
|
4782
4782
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
4783
4783
|
* include a server-generated timestamp in the written data.
|
|
4784
|
-
*/ function
|
|
4785
|
-
return new
|
|
4784
|
+
*/ function Sr() {
|
|
4785
|
+
return new Vn("serverTimestamp");
|
|
4786
4786
|
}
|
|
4787
4787
|
|
|
4788
4788
|
/**
|
|
@@ -4796,11 +4796,11 @@ function wr(t, e, n) {
|
|
|
4796
4796
|
* @param elements - The elements to union into the array.
|
|
4797
4797
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
4798
4798
|
* `updateDoc()`.
|
|
4799
|
-
*/ function
|
|
4799
|
+
*/ function Tr() {
|
|
4800
4800
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4801
4801
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
4802
4802
|
// update() since we'd need the Firestore instance to do this.
|
|
4803
|
-
return new
|
|
4803
|
+
return new Dn("arrayUnion", t);
|
|
4804
4804
|
}
|
|
4805
4805
|
|
|
4806
4806
|
/**
|
|
@@ -4813,11 +4813,11 @@ function wr(t, e, n) {
|
|
|
4813
4813
|
* @param elements - The elements to remove from the array.
|
|
4814
4814
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
4815
4815
|
* `updateDoc()`
|
|
4816
|
-
*/ function
|
|
4816
|
+
*/ function Er() {
|
|
4817
4817
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4818
4818
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
4819
4819
|
// update() since we'd need the Firestore instance to do this.
|
|
4820
|
-
return new
|
|
4820
|
+
return new kn("arrayRemove", t);
|
|
4821
4821
|
}
|
|
4822
4822
|
|
|
4823
4823
|
/**
|
|
@@ -4838,8 +4838,8 @@ function wr(t, e, n) {
|
|
|
4838
4838
|
* @param n - The value to increment by.
|
|
4839
4839
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
4840
4840
|
* `updateDoc()`
|
|
4841
|
-
*/ function
|
|
4842
|
-
return new
|
|
4841
|
+
*/ function Ir(t) {
|
|
4842
|
+
return new Pn("increment", t);
|
|
4843
4843
|
}
|
|
4844
4844
|
|
|
4845
4845
|
/**
|
|
@@ -4865,24 +4865,24 @@ function wr(t, e, n) {
|
|
|
4865
4865
|
* provides methods for adding writes to the write batch. None of the writes
|
|
4866
4866
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
4867
4867
|
* called.
|
|
4868
|
-
*/ var
|
|
4868
|
+
*/ var Ar = /** @class */ function() {
|
|
4869
4869
|
/** @hideconstructor */
|
|
4870
4870
|
function t(t, e) {
|
|
4871
4871
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
4872
|
-
this._dataReader =
|
|
4872
|
+
this._dataReader = Tn(t);
|
|
4873
4873
|
}
|
|
4874
4874
|
return t.prototype.set = function(t, e, n) {
|
|
4875
4875
|
this._verifyNotCommitted();
|
|
4876
|
-
var r =
|
|
4877
|
-
return this._mutations.push(o.toMutation(r._key,
|
|
4876
|
+
var r = Vr(t, this._firestore), i = dr(r.converter, e, n), o = En(this._dataReader, "WriteBatch.set", r._key, i, null !== r.converter, n);
|
|
4877
|
+
return this._mutations.push(o.toMutation(r._key, ge.none())), this;
|
|
4878
4878
|
}, t.prototype.update = function(t, e, n) {
|
|
4879
4879
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
4880
4880
|
this._verifyNotCommitted();
|
|
4881
|
-
var o, a =
|
|
4881
|
+
var o, a = Vr(t, this._firestore);
|
|
4882
4882
|
// For Compat types, we have to "extract" the underlying types before
|
|
4883
4883
|
// performing validation.
|
|
4884
|
-
return o = "string" == typeof (e = h(e)) || e instanceof
|
|
4885
|
-
this._mutations.push(o.toMutation(a._key,
|
|
4884
|
+
return o = "string" == typeof (e = h(e)) || e instanceof hn ? Fn(this._dataReader, "WriteBatch.update", a._key, e, n, r) : Nn(this._dataReader, "WriteBatch.update", a._key, e),
|
|
4885
|
+
this._mutations.push(o.toMutation(a._key, ge.exists(!0))), this;
|
|
4886
4886
|
},
|
|
4887
4887
|
/**
|
|
4888
4888
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -4892,8 +4892,8 @@ function wr(t, e, n) {
|
|
|
4892
4892
|
*/
|
|
4893
4893
|
t.prototype.delete = function(t) {
|
|
4894
4894
|
this._verifyNotCommitted();
|
|
4895
|
-
var e =
|
|
4896
|
-
return this._mutations = this._mutations.concat(new
|
|
4895
|
+
var e = Vr(t, this._firestore);
|
|
4896
|
+
return this._mutations = this._mutations.concat(new Se(e._key, ge.none())), this;
|
|
4897
4897
|
},
|
|
4898
4898
|
/**
|
|
4899
4899
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -4910,12 +4910,12 @@ function wr(t, e, n) {
|
|
|
4910
4910
|
t.prototype.commit = function() {
|
|
4911
4911
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
4912
4912
|
}, t.prototype._verifyNotCommitted = function() {
|
|
4913
|
-
if (this._committed) throw new
|
|
4913
|
+
if (this._committed) throw new x(O, "A write batch can no longer be used after commit() has been called.");
|
|
4914
4914
|
}, t;
|
|
4915
4915
|
}();
|
|
4916
4916
|
|
|
4917
|
-
function
|
|
4918
|
-
if ((t = h(t)).firestore !== e) throw new
|
|
4917
|
+
function Vr(t, e) {
|
|
4918
|
+
if ((t = h(t)).firestore !== e) throw new x(V, "Provided document reference is from a different Firestore instance.");
|
|
4919
4919
|
return t;
|
|
4920
4920
|
}
|
|
4921
4921
|
|
|
@@ -4931,10 +4931,10 @@ function Dr(t, e) {
|
|
|
4931
4931
|
*
|
|
4932
4932
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
4933
4933
|
* writes.
|
|
4934
|
-
*/ function
|
|
4935
|
-
var e =
|
|
4936
|
-
return new
|
|
4937
|
-
return
|
|
4934
|
+
*/ function Dr(t) {
|
|
4935
|
+
var e = Xe(t = it(t, Je));
|
|
4936
|
+
return new Ar(t, (function(t) {
|
|
4937
|
+
return He(e, t);
|
|
4938
4938
|
}));
|
|
4939
4939
|
}
|
|
4940
4940
|
|
|
@@ -4957,7 +4957,7 @@ function Dr(t, e) {
|
|
|
4957
4957
|
/**
|
|
4958
4958
|
* Internal transaction object responsible for accumulating the mutations to
|
|
4959
4959
|
* perform and the base versions for any documents read.
|
|
4960
|
-
*/ var
|
|
4960
|
+
*/ var kr = /** @class */ function() {
|
|
4961
4961
|
function t(t) {
|
|
4962
4962
|
this.datastore = t,
|
|
4963
4963
|
// The version of each document that was read during this transaction.
|
|
@@ -4981,8 +4981,8 @@ function Dr(t, e) {
|
|
|
4981
4981
|
return n(this, (function(n) {
|
|
4982
4982
|
switch (n.label) {
|
|
4983
4983
|
case 0:
|
|
4984
|
-
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new
|
|
4985
|
-
return [ 4 /*yield*/ ,
|
|
4984
|
+
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new x(V, "Firestore transactions require all reads to be executed before all writes.");
|
|
4985
|
+
return [ 4 /*yield*/ , Ke(this.datastore, t) ];
|
|
4986
4986
|
|
|
4987
4987
|
case 1:
|
|
4988
4988
|
return [ 2 /*return*/ , ((e = n.sent()).forEach((function(t) {
|
|
@@ -5001,7 +5001,7 @@ function Dr(t, e) {
|
|
|
5001
5001
|
}
|
|
5002
5002
|
this.writtenDocs.add(t.toString());
|
|
5003
5003
|
}, t.prototype.delete = function(t) {
|
|
5004
|
-
this.write(new
|
|
5004
|
+
this.write(new Se(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
5005
5005
|
}, t.prototype.commit = function() {
|
|
5006
5006
|
return e(this, void 0, void 0, (function() {
|
|
5007
5007
|
var t, e = this;
|
|
@@ -5017,9 +5017,9 @@ function Dr(t, e) {
|
|
|
5017
5017
|
// For each document that was read but not written to, we want to perform
|
|
5018
5018
|
// a `verify` operation.
|
|
5019
5019
|
t.forEach((function(t, n) {
|
|
5020
|
-
var r =
|
|
5021
|
-
e.mutations.push(new
|
|
5022
|
-
})), [ 4 /*yield*/ ,
|
|
5020
|
+
var r = Z.fromPath(n);
|
|
5021
|
+
e.mutations.push(new Te(r, e.precondition(r)));
|
|
5022
|
+
})), [ 4 /*yield*/ , He(this.datastore, this.mutations) ];
|
|
5023
5023
|
|
|
5024
5024
|
case 1:
|
|
5025
5025
|
// For each mutation, note that the doc was written.
|
|
@@ -5032,13 +5032,13 @@ function Dr(t, e) {
|
|
|
5032
5032
|
if (t.isFoundDocument()) e = t.version; else {
|
|
5033
5033
|
if (!t.isNoDocument()) throw S();
|
|
5034
5034
|
// For deleted docs, we must use baseVersion 0 when we overwrite them.
|
|
5035
|
-
e =
|
|
5035
|
+
e = gt.min();
|
|
5036
5036
|
}
|
|
5037
5037
|
var n = this.readVersions.get(t.key.toString());
|
|
5038
5038
|
if (n) {
|
|
5039
5039
|
if (!e.isEqual(n))
|
|
5040
5040
|
// This transaction will fail no matter what.
|
|
5041
|
-
throw new
|
|
5041
|
+
throw new x(q, "Document version changed between two reads.");
|
|
5042
5042
|
} else this.readVersions.set(t.key.toString(), e);
|
|
5043
5043
|
},
|
|
5044
5044
|
/**
|
|
@@ -5047,7 +5047,7 @@ function Dr(t, e) {
|
|
|
5047
5047
|
*/
|
|
5048
5048
|
t.prototype.precondition = function(t) {
|
|
5049
5049
|
var e = this.readVersions.get(t.toString());
|
|
5050
|
-
return !this.writtenDocs.has(t.toString()) && e ?
|
|
5050
|
+
return !this.writtenDocs.has(t.toString()) && e ? ge.updateTime(e) : ge.none();
|
|
5051
5051
|
},
|
|
5052
5052
|
/**
|
|
5053
5053
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -5057,7 +5057,7 @@ function Dr(t, e) {
|
|
|
5057
5057
|
// The first time a document is written, we want to take into account the
|
|
5058
5058
|
// read time and existence
|
|
5059
5059
|
if (!this.writtenDocs.has(t.toString()) && e) {
|
|
5060
|
-
if (e.isEqual(
|
|
5060
|
+
if (e.isEqual(gt.min()))
|
|
5061
5061
|
// The document doesn't exist, so fail the transaction.
|
|
5062
5062
|
// This has to be validated locally because you can't send a
|
|
5063
5063
|
// precondition that a document does not exist without changing the
|
|
@@ -5067,31 +5067,31 @@ function Dr(t, e) {
|
|
|
5067
5067
|
// express that to the backend, we have to validate locally.
|
|
5068
5068
|
// Note: this can change once we can send separate verify writes in the
|
|
5069
5069
|
// transaction.
|
|
5070
|
-
throw new
|
|
5070
|
+
throw new x(V, "Can't update a document that doesn't exist.");
|
|
5071
5071
|
// Document exists, base precondition on document update time.
|
|
5072
|
-
return
|
|
5072
|
+
return ge.updateTime(e);
|
|
5073
5073
|
}
|
|
5074
5074
|
// Document was not read, so we just use the preconditions for a blind
|
|
5075
5075
|
// update.
|
|
5076
|
-
return
|
|
5076
|
+
return ge.exists(!0);
|
|
5077
5077
|
}, t.prototype.write = function(t) {
|
|
5078
5078
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
5079
5079
|
}, t.prototype.ensureCommitNotCalled = function() {}, t;
|
|
5080
|
-
}(),
|
|
5080
|
+
}(), Pr = /** @class */ function() {
|
|
5081
5081
|
function t(t, e, n, r) {
|
|
5082
5082
|
this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = r,
|
|
5083
|
-
this.Et = 5, this.
|
|
5083
|
+
this.Et = 5, this.Tt = new Qe(this.asyncQueue, "transaction_retry" /* TransactionRetry */)
|
|
5084
5084
|
/** Runs the transaction and sets the result on deferred. */;
|
|
5085
5085
|
}
|
|
5086
5086
|
return t.prototype.run = function() {
|
|
5087
|
-
this.Et -= 1, this.
|
|
5088
|
-
}, t.prototype.
|
|
5087
|
+
this.Et -= 1, this.It();
|
|
5088
|
+
}, t.prototype.It = function() {
|
|
5089
5089
|
var t = this;
|
|
5090
|
-
this.
|
|
5090
|
+
this.Tt.G((function() {
|
|
5091
5091
|
return e(t, void 0, void 0, (function() {
|
|
5092
5092
|
var t, e, r = this;
|
|
5093
5093
|
return n(this, (function(n) {
|
|
5094
|
-
return t = new
|
|
5094
|
+
return t = new kr(this.datastore), (e = this.At(t)) && e.then((function(e) {
|
|
5095
5095
|
r.asyncQueue.enqueueAndForget((function() {
|
|
5096
5096
|
return t.commit().then((function() {
|
|
5097
5097
|
r.deferred.resolve(e);
|
|
@@ -5108,7 +5108,7 @@ function Dr(t, e) {
|
|
|
5108
5108
|
}, t.prototype.At = function(t) {
|
|
5109
5109
|
try {
|
|
5110
5110
|
var e = this.updateFunction(t);
|
|
5111
|
-
return !
|
|
5111
|
+
return !at(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
5112
5112
|
null);
|
|
5113
5113
|
} catch (t) {
|
|
5114
5114
|
// Do not retry errors thrown by user provided updateFunction.
|
|
@@ -5117,7 +5117,7 @@ function Dr(t, e) {
|
|
|
5117
5117
|
}, t.prototype.Pt = function(t) {
|
|
5118
5118
|
var e = this;
|
|
5119
5119
|
this.Et > 0 && this.Rt(t) ? (this.Et -= 1, this.asyncQueue.enqueueAndForget((function() {
|
|
5120
|
-
return e.
|
|
5120
|
+
return e.It(), Promise.resolve();
|
|
5121
5121
|
}))) : this.deferred.reject(t);
|
|
5122
5122
|
}, t.prototype.Rt = function(t) {
|
|
5123
5123
|
if ("FirebaseError" === t.name) {
|
|
@@ -5133,36 +5133,33 @@ function Dr(t, e) {
|
|
|
5133
5133
|
*/
|
|
5134
5134
|
function(t) {
|
|
5135
5135
|
switch (t) {
|
|
5136
|
-
|
|
5136
|
+
default:
|
|
5137
5137
|
return S();
|
|
5138
5138
|
|
|
5139
|
+
case I:
|
|
5139
5140
|
case A:
|
|
5140
|
-
case
|
|
5141
|
-
case
|
|
5142
|
-
case
|
|
5141
|
+
case D:
|
|
5142
|
+
case F:
|
|
5143
|
+
case R:
|
|
5143
5144
|
case U:
|
|
5144
|
-
case x:
|
|
5145
5145
|
// Unauthenticated means something went wrong with our token and we need
|
|
5146
5146
|
// to retry with new credentials which will happen automatically.
|
|
5147
|
-
case
|
|
5147
|
+
case N:
|
|
5148
5148
|
return !1;
|
|
5149
5149
|
|
|
5150
|
-
case
|
|
5151
|
-
case
|
|
5150
|
+
case V:
|
|
5151
|
+
case k:
|
|
5152
5152
|
case "already-exists":
|
|
5153
|
-
case
|
|
5154
|
-
case
|
|
5153
|
+
case P:
|
|
5154
|
+
case O:
|
|
5155
5155
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
5156
5156
|
// the context and should handled individually by the calling code.
|
|
5157
5157
|
// See https://cloud.google.com/apis/design/errors.
|
|
5158
|
-
case
|
|
5158
|
+
case q:
|
|
5159
|
+
case j:
|
|
5159
5160
|
case L:
|
|
5160
|
-
case R:
|
|
5161
5161
|
case "data-loss":
|
|
5162
5162
|
return !0;
|
|
5163
|
-
|
|
5164
|
-
default:
|
|
5165
|
-
return S();
|
|
5166
5163
|
}
|
|
5167
5164
|
}(e);
|
|
5168
5165
|
}
|
|
@@ -5206,7 +5203,7 @@ function Dr(t, e) {
|
|
|
5206
5203
|
* See the License for the specific language governing permissions and
|
|
5207
5204
|
* limitations under the License.
|
|
5208
5205
|
*/
|
|
5209
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
5206
|
+
/** The Platform's 'document' implementation or null if not available. */ function Nr() {
|
|
5210
5207
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
5211
5208
|
// eslint-disable-next-line no-restricted-globals
|
|
5212
5209
|
return "undefined" != typeof document ? document : null;
|
|
@@ -5238,10 +5235,10 @@ function Dr(t, e) {
|
|
|
5238
5235
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
5239
5236
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
5240
5237
|
* IE.
|
|
5241
|
-
*/ var
|
|
5238
|
+
*/ var Fr = /** @class */ function() {
|
|
5242
5239
|
function t(t, e, n, r, i) {
|
|
5243
5240
|
this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = i,
|
|
5244
|
-
this.deferred = new
|
|
5241
|
+
this.deferred = new B, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
5245
5242
|
// It's normal for the deferred promise to be canceled (due to cancellation)
|
|
5246
5243
|
// and so we attach a dummy catch callback to avoid
|
|
5247
5244
|
// 'UnhandledPromiseRejectionWarning' log spam.
|
|
@@ -5290,7 +5287,7 @@ function Dr(t, e) {
|
|
|
5290
5287
|
* guarantee that the operation will not be run.
|
|
5291
5288
|
*/
|
|
5292
5289
|
t.prototype.cancel = function(t) {
|
|
5293
|
-
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new
|
|
5290
|
+
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new x(I, "Operation cancelled" + (t ? ": " + t : ""))));
|
|
5294
5291
|
}, t.prototype.handleDelayElapsed = function() {
|
|
5295
5292
|
var t = this;
|
|
5296
5293
|
this.asyncQueue.enqueueAndForget((function() {
|
|
@@ -5302,17 +5299,17 @@ function Dr(t, e) {
|
|
|
5302
5299
|
null !== this.timerHandle && (this.removalCallback(this), clearTimeout(this.timerHandle),
|
|
5303
5300
|
this.timerHandle = null);
|
|
5304
5301
|
}, t;
|
|
5305
|
-
}(),
|
|
5302
|
+
}(), Or = /** @class */ function() {
|
|
5306
5303
|
function t() {
|
|
5307
5304
|
var t = this;
|
|
5308
5305
|
// The last promise in the queue.
|
|
5309
5306
|
this.Vt = Promise.resolve(),
|
|
5310
5307
|
// A list of retryable operations. Retryable operations are run in order and
|
|
5311
5308
|
// retried with backoff.
|
|
5312
|
-
this.
|
|
5309
|
+
this.Dt = [],
|
|
5313
5310
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
5314
5311
|
// be changed again.
|
|
5315
|
-
this.
|
|
5312
|
+
this.Nt = !1,
|
|
5316
5313
|
// Operations scheduled to be queued in the future. Operations are
|
|
5317
5314
|
// automatically removed after they are run or canceled.
|
|
5318
5315
|
this.$t = [],
|
|
@@ -5326,20 +5323,20 @@ function Dr(t, e) {
|
|
|
5326
5323
|
// List of TimerIds to fast-forward delays for.
|
|
5327
5324
|
this.xt = [],
|
|
5328
5325
|
// Backoff timer used to schedule retries for retryable operations
|
|
5329
|
-
this.
|
|
5326
|
+
this.Tt = new Qe(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5330
5327
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5331
5328
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5332
5329
|
// after page comes into foreground.
|
|
5333
5330
|
this.Ot = function() {
|
|
5334
|
-
var e =
|
|
5335
|
-
e && g("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.
|
|
5331
|
+
var e = Nr();
|
|
5332
|
+
e && g("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.Tt.H();
|
|
5336
5333
|
};
|
|
5337
|
-
var e =
|
|
5334
|
+
var e = Nr();
|
|
5338
5335
|
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.Ot);
|
|
5339
5336
|
}
|
|
5340
5337
|
return Object.defineProperty(t.prototype, "isShuttingDown", {
|
|
5341
5338
|
get: function() {
|
|
5342
|
-
return this.
|
|
5339
|
+
return this.Nt;
|
|
5343
5340
|
},
|
|
5344
5341
|
enumerable: !1,
|
|
5345
5342
|
configurable: !0
|
|
@@ -5356,29 +5353,29 @@ function Dr(t, e) {
|
|
|
5356
5353
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
5357
5354
|
this.Lt(t);
|
|
5358
5355
|
}, t.prototype.enterRestrictedMode = function(t) {
|
|
5359
|
-
if (!this.
|
|
5360
|
-
this.
|
|
5361
|
-
var e =
|
|
5356
|
+
if (!this.Nt) {
|
|
5357
|
+
this.Nt = !0, this.qt = t || !1;
|
|
5358
|
+
var e = Nr();
|
|
5362
5359
|
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ot);
|
|
5363
5360
|
}
|
|
5364
5361
|
}, t.prototype.enqueue = function(t) {
|
|
5365
5362
|
var e = this;
|
|
5366
|
-
if (this.Ct(), this.
|
|
5363
|
+
if (this.Ct(), this.Nt)
|
|
5367
5364
|
// Return a Promise which never resolves.
|
|
5368
5365
|
return new Promise((function() {}));
|
|
5369
5366
|
// Create a deferred Promise that we can return to the callee. This
|
|
5370
5367
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
5371
5368
|
// advance the queue even when the operation is not run.
|
|
5372
|
-
var n = new
|
|
5369
|
+
var n = new B;
|
|
5373
5370
|
return this.Lt((function() {
|
|
5374
|
-
return e.
|
|
5371
|
+
return e.Nt && e.qt ? Promise.resolve() : (t().then(n.resolve, n.reject), n.promise);
|
|
5375
5372
|
})).then((function() {
|
|
5376
5373
|
return n.promise;
|
|
5377
5374
|
}));
|
|
5378
5375
|
}, t.prototype.enqueueRetryable = function(t) {
|
|
5379
5376
|
var e = this;
|
|
5380
5377
|
this.enqueueAndForget((function() {
|
|
5381
|
-
return e.
|
|
5378
|
+
return e.Dt.push(t), e.Ut();
|
|
5382
5379
|
}));
|
|
5383
5380
|
},
|
|
5384
5381
|
/**
|
|
@@ -5391,14 +5388,14 @@ function Dr(t, e) {
|
|
|
5391
5388
|
return n(this, (function(n) {
|
|
5392
5389
|
switch (n.label) {
|
|
5393
5390
|
case 0:
|
|
5394
|
-
if (0 === this.
|
|
5391
|
+
if (0 === this.Dt.length) return [ 3 /*break*/ , 5 ];
|
|
5395
5392
|
n.label = 1;
|
|
5396
5393
|
|
|
5397
5394
|
case 1:
|
|
5398
|
-
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.
|
|
5395
|
+
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.Dt[0]() ];
|
|
5399
5396
|
|
|
5400
5397
|
case 2:
|
|
5401
|
-
return n.sent(), this.
|
|
5398
|
+
return n.sent(), this.Dt.shift(), this.Tt.reset(), [ 3 /*break*/ , 4 ];
|
|
5402
5399
|
|
|
5403
5400
|
case 3:
|
|
5404
5401
|
if (t = n.sent(), "IndexedDbTransactionError" !== t.name) throw t;
|
|
@@ -5407,7 +5404,7 @@ function Dr(t, e) {
|
|
|
5407
5404
|
[ 3 /*break*/ , 4 ];
|
|
5408
5405
|
|
|
5409
5406
|
case 4:
|
|
5410
|
-
this.
|
|
5407
|
+
this.Dt.length > 0 &&
|
|
5411
5408
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
5412
5409
|
// This is necessary to run retryable operations that failed during
|
|
5413
5410
|
// their initial attempt since we don't know whether they are already
|
|
@@ -5418,7 +5415,7 @@ function Dr(t, e) {
|
|
|
5418
5415
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
5419
5416
|
// new backoff on every call, there is only ever a single additional
|
|
5420
5417
|
// operation in the queue.
|
|
5421
|
-
this.
|
|
5418
|
+
this.Tt.G((function() {
|
|
5422
5419
|
return e.Ut();
|
|
5423
5420
|
})), n.label = 5;
|
|
5424
5421
|
|
|
@@ -5430,10 +5427,8 @@ function Dr(t, e) {
|
|
|
5430
5427
|
}, t.prototype.Lt = function(t) {
|
|
5431
5428
|
var e = this, n = this.Vt.then((function() {
|
|
5432
5429
|
return e.St = !0, t().catch((function(t) {
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
// and return the rejected Promise.
|
|
5436
|
-
throw e.Ft = t, e.St = !1, w("INTERNAL UNHANDLED ERROR: ",
|
|
5430
|
+
e.Ft = t, e.St = !1;
|
|
5431
|
+
var n =
|
|
5437
5432
|
/**
|
|
5438
5433
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
5439
5434
|
* This returns expected output of message + stack when available.
|
|
@@ -5443,7 +5438,11 @@ function Dr(t, e) {
|
|
|
5443
5438
|
var e = t.message || "";
|
|
5444
5439
|
return t.stack && (e = t.stack.includes(t.message) ? t.stack : t.message + "\n" + t.stack),
|
|
5445
5440
|
e;
|
|
5446
|
-
}(t)
|
|
5441
|
+
}(t);
|
|
5442
|
+
// Re-throw the error so that this.tail becomes a rejected Promise and
|
|
5443
|
+
// all further attempts to chain (via .then) will just short-circuit
|
|
5444
|
+
// and return the rejected Promise.
|
|
5445
|
+
throw w("INTERNAL UNHANDLED ERROR: ", n), t;
|
|
5447
5446
|
})).then((function(t) {
|
|
5448
5447
|
return e.St = !1, t;
|
|
5449
5448
|
}));
|
|
@@ -5454,7 +5453,7 @@ function Dr(t, e) {
|
|
|
5454
5453
|
this.Ct(),
|
|
5455
5454
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5456
5455
|
this.xt.indexOf(t) > -1 && (e = 0);
|
|
5457
|
-
var i =
|
|
5456
|
+
var i = Fr.createAndSchedule(this, t, e, n, (function(t) {
|
|
5458
5457
|
return r.jt(t);
|
|
5459
5458
|
}));
|
|
5460
5459
|
return this.$t.push(i), i;
|
|
@@ -5490,7 +5489,7 @@ function Dr(t, e) {
|
|
|
5490
5489
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
5491
5490
|
* exists.
|
|
5492
5491
|
*/
|
|
5493
|
-
t.prototype.
|
|
5492
|
+
t.prototype.Bt = function(t) {
|
|
5494
5493
|
for (var e = 0, n = this.$t; e < n.length; e++) {
|
|
5495
5494
|
if (n[e].timerId === t) return !0;
|
|
5496
5495
|
}
|
|
@@ -5503,7 +5502,7 @@ function Dr(t, e) {
|
|
|
5503
5502
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
5504
5503
|
* @returns a Promise that resolves once all operations have been run.
|
|
5505
5504
|
*/
|
|
5506
|
-
t.prototype.
|
|
5505
|
+
t.prototype.Mt = function(t) {
|
|
5507
5506
|
var e = this;
|
|
5508
5507
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
5509
5508
|
return this.kt().then((function() {
|
|
@@ -5529,10 +5528,10 @@ function Dr(t, e) {
|
|
|
5529
5528
|
var e = this.$t.indexOf(t);
|
|
5530
5529
|
this.$t.splice(e, 1);
|
|
5531
5530
|
}, t;
|
|
5532
|
-
}(),
|
|
5531
|
+
}(), qr = /** @class */ function() {
|
|
5533
5532
|
/** @hideconstructor */
|
|
5534
5533
|
function t(t, e) {
|
|
5535
|
-
this._firestore = t, this._transaction = e, this._dataReader =
|
|
5534
|
+
this._firestore = t, this._transaction = e, this._dataReader = Tn(t)
|
|
5536
5535
|
/**
|
|
5537
5536
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
5538
5537
|
*
|
|
@@ -5541,23 +5540,23 @@ function Dr(t, e) {
|
|
|
5541
5540
|
*/;
|
|
5542
5541
|
}
|
|
5543
5542
|
return t.prototype.get = function(t) {
|
|
5544
|
-
var e = this, n =
|
|
5543
|
+
var e = this, n = Vr(t, this._firestore), r = new pr(this._firestore);
|
|
5545
5544
|
return this._transaction.lookup([ n._key ]).then((function(t) {
|
|
5546
5545
|
if (!t || 1 !== t.length) return S();
|
|
5547
5546
|
var i = t[0];
|
|
5548
|
-
if (i.isFoundDocument()) return new
|
|
5549
|
-
if (i.isNoDocument()) return new
|
|
5547
|
+
if (i.isFoundDocument()) return new Gn(e._firestore, r, i.key, i, n.converter);
|
|
5548
|
+
if (i.isNoDocument()) return new Gn(e._firestore, r, n._key, null, n.converter);
|
|
5550
5549
|
throw S();
|
|
5551
5550
|
}));
|
|
5552
5551
|
}, t.prototype.set = function(t, e, n) {
|
|
5553
|
-
var r =
|
|
5552
|
+
var r = Vr(t, this._firestore), i = dr(r.converter, e, n), o = En(this._dataReader, "Transaction.set", r._key, i, null !== r.converter, n);
|
|
5554
5553
|
return this._transaction.set(r._key, o), this;
|
|
5555
5554
|
}, t.prototype.update = function(t, e, n) {
|
|
5556
5555
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
5557
|
-
var o, a =
|
|
5556
|
+
var o, a = Vr(t, this._firestore);
|
|
5558
5557
|
// For Compat types, we have to "extract" the underlying types before
|
|
5559
5558
|
// performing validation.
|
|
5560
|
-
return o = "string" == typeof (e = h(e)) || e instanceof
|
|
5559
|
+
return o = "string" == typeof (e = h(e)) || e instanceof hn ? Fn(this._dataReader, "Transaction.update", a._key, e, n, r) : Nn(this._dataReader, "Transaction.update", a._key, e),
|
|
5561
5560
|
this._transaction.update(a._key, o), this;
|
|
5562
5561
|
},
|
|
5563
5562
|
/**
|
|
@@ -5567,7 +5566,7 @@ function Dr(t, e) {
|
|
|
5567
5566
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
5568
5567
|
*/
|
|
5569
5568
|
t.prototype.delete = function(t) {
|
|
5570
|
-
var e =
|
|
5569
|
+
var e = Vr(t, this._firestore);
|
|
5571
5570
|
return this._transaction.delete(e._key), this;
|
|
5572
5571
|
}, t;
|
|
5573
5572
|
}();
|
|
@@ -5605,10 +5604,10 @@ function Dr(t, e) {
|
|
|
5605
5604
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
5606
5605
|
* rejected promise with the corresponding failure error is returned.
|
|
5607
5606
|
*/
|
|
5608
|
-
function
|
|
5609
|
-
var n =
|
|
5610
|
-
return new
|
|
5611
|
-
return e(new
|
|
5607
|
+
function jr(t, e) {
|
|
5608
|
+
var n = Xe(t = it(t, Je)), r = new B;
|
|
5609
|
+
return new Pr(new Or, n, (function(n) {
|
|
5610
|
+
return e(new qr(t, n));
|
|
5612
5611
|
}), r).run(), r.promise
|
|
5613
5612
|
/**
|
|
5614
5613
|
* Firestore Lite
|
|
@@ -5621,9 +5620,11 @@ function Lr(t, e) {
|
|
|
5621
5620
|
}
|
|
5622
5621
|
|
|
5623
5622
|
m = i + "_lite", o(new c("firestore/lite", (function(t, e) {
|
|
5624
|
-
var n = e.options, r = t.getProvider("app").getImmediate(), i = new
|
|
5623
|
+
var n = e.options, r = t.getProvider("app").getImmediate(), i = new Je(r, new Q(t.getProvider("auth-internal")));
|
|
5625
5624
|
return n && i._setSettings(n), i;
|
|
5626
|
-
}), "PUBLIC" /* PUBLIC */)),
|
|
5625
|
+
}), "PUBLIC" /* PUBLIC */)),
|
|
5626
|
+
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5627
|
+
a("firestore-lite", "3.1.1-canary.4594d3fd6", ""), a("firestore-lite", "3.1.1-canary.4594d3fd6", "esm5");
|
|
5627
5628
|
|
|
5628
|
-
export {
|
|
5629
|
+
export { pn as Bytes, an as CollectionReference, rn as DocumentReference, Gn as DocumentSnapshot, hn as FieldPath, mn as FieldValue, Je as Firestore, x as FirestoreError, yn as GeoPoint, on as Query, Wn as QueryConstraint, Qn as QueryDocumentSnapshot, zn as QuerySnapshot, vt as Timestamp, qr as Transaction, Ar as WriteBatch, br as addDoc, Er as arrayRemove, Tr as arrayUnion, sn as collection, un as collectionGroup, en as connectFirestoreEmulator, wr as deleteDoc, _r as deleteField, cn as doc, dn as documentId, ur as endAt, sr as endBefore, mr as getDoc, yr as getDocs, tn as getFirestore, Ir as increment, Ze as initializeFirestore, er as limit, nr as limitToLast, Zn as orderBy, Yn as query, ln as queryEqual, fn as refEqual, jr as runTransaction, Sr as serverTimestamp, vr as setDoc, v as setLogLevel, Hn as snapshotEqual, or as startAfter, ir as startAt, nn as terminate, gr as updateDoc, $n as where, Dr as writeBatch };
|
|
5629
5630
|
//# sourceMappingURL=index.browser.esm5.js.map
|