@firebase/firestore 3.4.13 → 3.4.14-canary.6f4ba2525
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 +8 -0
- package/dist/firestore/src/api/credentials.d.ts +13 -3
- package/dist/firestore/src/api/index_configuration.d.ts +7 -8
- package/dist/firestore/src/api.d.ts +1 -1
- package/dist/firestore/src/local/indexeddb_schema.d.ts +1 -3
- package/dist/firestore/src/local/local_store_impl.d.ts +2 -0
- package/dist/firestore/src/util/array.d.ts +18 -0
- package/dist/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
- package/dist/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
- package/dist/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
- package/dist/firestore/test/unit/specs/spec_builder.d.ts +5 -0
- package/dist/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
- package/dist/firestore/test/unit/util/array.test.d.ts +17 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.esm2017.js +3737 -3589
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3721 -3604
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +250 -53
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +250 -53
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +3676 -3529
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +13 -13
- package/dist/lite/firestore/src/api/credentials.d.ts +13 -3
- package/dist/lite/firestore/src/api/index_configuration.d.ts +7 -8
- package/dist/lite/firestore/src/api.d.ts +1 -1
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +1 -3
- package/dist/lite/firestore/src/local/local_store_impl.d.ts +2 -0
- package/dist/lite/firestore/src/util/array.d.ts +18 -0
- package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
- package/dist/lite/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
- package/dist/lite/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
- package/dist/lite/firestore/test/unit/specs/spec_builder.d.ts +5 -0
- package/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
- package/dist/lite/firestore/test/unit/util/array.test.d.ts +17 -0
- package/dist/lite/index.browser.esm2017.js +232 -222
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +485 -469
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +36 -18
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +36 -18
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +232 -222
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +3 -0
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +23 -23
- package/dist/lite/packages/firestore/src/api/credentials.d.ts +13 -3
- package/dist/lite/packages/firestore/src/api/index_configuration.d.ts +7 -8
- package/dist/lite/packages/firestore/src/api.d.ts +1 -1
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +1 -3
- package/dist/lite/packages/firestore/src/local/local_store_impl.d.ts +2 -0
- package/dist/lite/packages/firestore/src/util/array.d.ts +18 -0
- package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
- package/dist/lite/packages/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/unit/specs/spec_builder.d.ts +5 -0
- package/dist/lite/packages/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
- package/dist/lite/packages/firestore/test/unit/util/array.test.d.ts +17 -0
- package/dist/lite/private.d.ts +3 -0
- package/dist/packages/firestore/dist/index.esm2017.d.ts +193 -193
- package/dist/packages/firestore/src/api/credentials.d.ts +13 -3
- package/dist/packages/firestore/src/api/index_configuration.d.ts +7 -8
- package/dist/packages/firestore/src/api.d.ts +1 -1
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +1 -3
- package/dist/packages/firestore/src/local/local_store_impl.d.ts +2 -0
- package/dist/packages/firestore/src/util/array.d.ts +18 -0
- package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
- package/dist/packages/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
- package/dist/packages/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
- package/dist/packages/firestore/test/unit/specs/spec_builder.d.ts +5 -0
- package/dist/packages/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
- package/dist/packages/firestore/test/unit/util/array.test.d.ts +17 -0
- package/dist/private.d.ts +4 -1
- package/package.json +10 -9
|
@@ -67,7 +67,7 @@ y.MOCK_USER = new y("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.9.
|
|
70
|
+
var m = "9.9.2-canary.6f4ba2525", v = new l("@firebase/firestore");
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* @license
|
|
@@ -197,14 +197,14 @@ function b(t) {
|
|
|
197
197
|
*/;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
function
|
|
200
|
+
function k(t, e) {
|
|
201
201
|
t || E();
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
205
|
* Casts `obj` to `T`. In non-production builds, verifies that `obj` is an
|
|
206
206
|
* instance of `T` before casting.
|
|
207
|
-
*/ function
|
|
207
|
+
*/ function S(t,
|
|
208
208
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
209
209
|
e) {
|
|
210
210
|
return t;
|
|
@@ -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 = "cancelled", A = "unknown", V = "invalid-argument",
|
|
228
|
+
*/ var I = "cancelled", A = "unknown", V = "invalid-argument", P = "deadline-exceeded", D = "not-found", N = "permission-denied", F = "unauthenticated", O = "resource-exhausted", R = "failed-precondition", q = "aborted", C = "out-of-range", x = "unimplemented", L = "internal", j = "unavailable", M = /** @class */ function(e) {
|
|
229
229
|
/** @hideconstructor */
|
|
230
230
|
function n(
|
|
231
231
|
/**
|
|
@@ -253,7 +253,7 @@ e) {
|
|
|
253
253
|
}));
|
|
254
254
|
}, B = function(t, e) {
|
|
255
255
|
this.user = e, this.type = "OAuth", this.headers = new Map, this.headers.set("Authorization", "Bearer " + t);
|
|
256
|
-
},
|
|
256
|
+
}, G = /** @class */ function() {
|
|
257
257
|
function t() {}
|
|
258
258
|
return t.prototype.getToken = function() {
|
|
259
259
|
return Promise.resolve(null);
|
|
@@ -263,7 +263,7 @@ e) {
|
|
|
263
263
|
return e(y.UNAUTHENTICATED);
|
|
264
264
|
}));
|
|
265
265
|
}, t.prototype.shutdown = function() {}, t;
|
|
266
|
-
}(),
|
|
266
|
+
}(), z = /** @class */ function() {
|
|
267
267
|
function t(t) {
|
|
268
268
|
this.token = t,
|
|
269
269
|
/**
|
|
@@ -295,20 +295,38 @@ e) {
|
|
|
295
295
|
return t.prototype.getToken = function() {
|
|
296
296
|
var t = this;
|
|
297
297
|
return this.auth ? this.auth.getToken().then((function(e) {
|
|
298
|
-
return e ? (
|
|
298
|
+
return e ? (k("string" == typeof e.accessToken), new B(e.accessToken, new y(t.auth.getUid()))) : null;
|
|
299
299
|
})) : Promise.resolve(null);
|
|
300
300
|
}, t.prototype.invalidateToken = function() {}, t.prototype.start = function(t, e) {},
|
|
301
301
|
t.prototype.shutdown = function() {}, t;
|
|
302
|
-
}(),
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
302
|
+
}(), W = /** @class */ function() {
|
|
303
|
+
function t(t, e, n, r) {
|
|
304
|
+
this.t = t, this.i = e, this.o = n, this.u = r, this.type = "FirstParty", this.user = y.FIRST_PARTY,
|
|
305
|
+
this.h = new Map
|
|
306
|
+
/** Gets an authorization token, using a provided factory function, or falling back to First Party GAPI. */;
|
|
307
|
+
}
|
|
308
|
+
return t.prototype.l = function() {
|
|
309
|
+
return this.u ? this.u() : (
|
|
310
|
+
// Make sure this really is a Gapi client.
|
|
311
|
+
k(!("object" != typeof this.t || null === this.t || !this.t.auth || !this.t.auth.getAuthHeaderValueForFirstParty)),
|
|
312
|
+
this.t.auth.getAuthHeaderValueForFirstParty([]));
|
|
313
|
+
}, Object.defineProperty(t.prototype, "headers", {
|
|
314
|
+
get: function() {
|
|
315
|
+
this.h.set("X-Goog-AuthUser", this.i);
|
|
316
|
+
// Use array notation to prevent minification
|
|
317
|
+
var t = this.l();
|
|
318
|
+
return t && this.h.set("Authorization", t), this.o && this.h.set("X-Goog-Iam-Authorization-Token", this.o),
|
|
319
|
+
this.h;
|
|
320
|
+
},
|
|
321
|
+
enumerable: !1,
|
|
322
|
+
configurable: !0
|
|
323
|
+
}), t;
|
|
324
|
+
}(), Q = /** @class */ function() {
|
|
325
|
+
function t(t, e, n, r) {
|
|
326
|
+
this.t = t, this.i = e, this.o = n, this.u = r;
|
|
309
327
|
}
|
|
310
328
|
return t.prototype.getToken = function() {
|
|
311
|
-
return Promise.resolve(new
|
|
329
|
+
return Promise.resolve(new W(this.t, this.i, this.o, this.u));
|
|
312
330
|
}, t.prototype.start = function(t, e) {
|
|
313
331
|
// Fire with initial uid.
|
|
314
332
|
t.enqueueRetryable((function() {
|
|
@@ -321,17 +339,17 @@ e) {
|
|
|
321
339
|
}, Y = /** @class */ function() {
|
|
322
340
|
function t(t) {
|
|
323
341
|
var e = this;
|
|
324
|
-
this.
|
|
342
|
+
this.m = t, this.appCheck = null, t.onInit((function(t) {
|
|
325
343
|
e.appCheck = t;
|
|
326
344
|
}));
|
|
327
345
|
}
|
|
328
346
|
return t.prototype.getToken = function() {
|
|
329
347
|
return this.appCheck ? this.appCheck.getToken().then((function(t) {
|
|
330
|
-
return t ? (
|
|
348
|
+
return t ? (k("string" == typeof t.token), new H(t.token)) : null;
|
|
331
349
|
})) : Promise.resolve(null);
|
|
332
350
|
}, t.prototype.invalidateToken = function() {}, t.prototype.start = function(t, e) {},
|
|
333
351
|
t.prototype.shutdown = function() {}, t;
|
|
334
|
-
}(),
|
|
352
|
+
}(), X =
|
|
335
353
|
/**
|
|
336
354
|
* Constructs a DatabaseInfo using the provided host, databaseId and
|
|
337
355
|
* persistenceKey.
|
|
@@ -352,7 +370,7 @@ e) {
|
|
|
352
370
|
function(t, e, n, r, i, o, a, s) {
|
|
353
371
|
this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = r, this.ssl = i,
|
|
354
372
|
this.forceLongPolling = o, this.autoDetectLongPolling = a, this.useFetchStreams = s;
|
|
355
|
-
},
|
|
373
|
+
}, J = /** @class */ function() {
|
|
356
374
|
function t(t, e) {
|
|
357
375
|
this.projectId = t, this.database = e || "(default)";
|
|
358
376
|
}
|
|
@@ -367,7 +385,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
367
385
|
}), t.prototype.isEqual = function(e) {
|
|
368
386
|
return e instanceof t && e.projectId === this.projectId && e.database === this.database;
|
|
369
387
|
}, t;
|
|
370
|
-
}(),
|
|
388
|
+
}(), Z = /** @class */ function() {
|
|
371
389
|
function t(t, e, n) {
|
|
372
390
|
void 0 === e ? e = 0 : e > t.length && E(), void 0 === n ? n = t.length - e : n > t.length - e && E(),
|
|
373
391
|
this.segments = t, this.offset = e, this.len = n;
|
|
@@ -420,7 +438,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
420
438
|
}
|
|
421
439
|
return t.length < e.length ? -1 : t.length > e.length ? 1 : 0;
|
|
422
440
|
}, t;
|
|
423
|
-
}(),
|
|
441
|
+
}(), $ = /** @class */ function(e) {
|
|
424
442
|
function n() {
|
|
425
443
|
return null !== e && e.apply(this, arguments) || this;
|
|
426
444
|
}
|
|
@@ -456,7 +474,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
456
474
|
}, n.emptyPath = function() {
|
|
457
475
|
return new n([]);
|
|
458
476
|
}, n;
|
|
459
|
-
}(
|
|
477
|
+
}(Z), tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/, et = /** @class */ function(e) {
|
|
460
478
|
function n() {
|
|
461
479
|
return null !== e && e.apply(this, arguments) || this;
|
|
462
480
|
}
|
|
@@ -517,16 +535,16 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
517
535
|
}, n.emptyPath = function() {
|
|
518
536
|
return new n([]);
|
|
519
537
|
}, n;
|
|
520
|
-
}(
|
|
538
|
+
}(Z), nt = /** @class */ function() {
|
|
521
539
|
function t(t) {
|
|
522
540
|
this.path = t;
|
|
523
541
|
}
|
|
524
542
|
return t.fromPath = function(e) {
|
|
525
|
-
return new t(
|
|
543
|
+
return new t($.fromString(e));
|
|
526
544
|
}, t.fromName = function(e) {
|
|
527
|
-
return new t(
|
|
545
|
+
return new t($.fromString(e).popFirst(5));
|
|
528
546
|
}, t.empty = function() {
|
|
529
|
-
return new t(
|
|
547
|
+
return new t($.emptyPath());
|
|
530
548
|
}, Object.defineProperty(t.prototype, "collectionGroup", {
|
|
531
549
|
get: function() {
|
|
532
550
|
return this.path.popLast().lastSegment();
|
|
@@ -543,11 +561,11 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
543
561
|
/** Returns the fully qualified path to the parent collection. */ t.prototype.getCollectionPath = function() {
|
|
544
562
|
return this.path.popLast();
|
|
545
563
|
}, t.prototype.isEqual = function(t) {
|
|
546
|
-
return null !== t && 0 ===
|
|
564
|
+
return null !== t && 0 === $.comparator(this.path, t.path);
|
|
547
565
|
}, t.prototype.toString = function() {
|
|
548
566
|
return this.path.toString();
|
|
549
567
|
}, t.comparator = function(t, e) {
|
|
550
|
-
return
|
|
568
|
+
return $.comparator(t.path, e.path);
|
|
551
569
|
}, t.isDocumentKey = function(t) {
|
|
552
570
|
return t.length % 2 == 0;
|
|
553
571
|
},
|
|
@@ -558,7 +576,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
558
576
|
* @returns A new instance of DocumentKey
|
|
559
577
|
*/
|
|
560
578
|
t.fromSegments = function(e) {
|
|
561
|
-
return new t(new
|
|
579
|
+
return new t(new $(e.slice()));
|
|
562
580
|
}, t;
|
|
563
581
|
}();
|
|
564
582
|
|
|
@@ -746,7 +764,7 @@ function dt(t) {
|
|
|
746
764
|
|
|
747
765
|
case 400:
|
|
748
766
|
// Bad Request
|
|
749
|
-
return
|
|
767
|
+
return R;
|
|
750
768
|
|
|
751
769
|
// Other possibilities based on the forward mapping
|
|
752
770
|
// return Code.INVALID_ARGUMENT;
|
|
@@ -761,17 +779,17 @@ function dt(t) {
|
|
|
761
779
|
|
|
762
780
|
case 404:
|
|
763
781
|
// Not Found
|
|
764
|
-
return
|
|
782
|
+
return D;
|
|
765
783
|
|
|
766
784
|
case 409:
|
|
767
785
|
// Conflict
|
|
768
|
-
return
|
|
786
|
+
return q;
|
|
769
787
|
|
|
770
788
|
// Other possibilities:
|
|
771
789
|
// return Code.ALREADY_EXISTS;
|
|
772
790
|
case 416:
|
|
773
791
|
// Range Not Satisfiable
|
|
774
|
-
return
|
|
792
|
+
return C;
|
|
775
793
|
|
|
776
794
|
case 429:
|
|
777
795
|
// Too Many Requests
|
|
@@ -790,7 +808,7 @@ function dt(t) {
|
|
|
790
808
|
// return Code.DATA_LOSS;
|
|
791
809
|
case 501:
|
|
792
810
|
// Unimplemented
|
|
793
|
-
return
|
|
811
|
+
return x;
|
|
794
812
|
|
|
795
813
|
case 503:
|
|
796
814
|
// Service Unavailable
|
|
@@ -798,10 +816,10 @@ function dt(t) {
|
|
|
798
816
|
|
|
799
817
|
case 504:
|
|
800
818
|
// Gateway Timeout
|
|
801
|
-
return
|
|
819
|
+
return P;
|
|
802
820
|
|
|
803
821
|
default:
|
|
804
|
-
return t >= 200 && t < 300 ? "ok" : t >= 400 && t < 500 ?
|
|
822
|
+
return t >= 200 && t < 300 ? "ok" : t >= 400 && t < 500 ? R : t >= 500 && t < 600 ? L : A;
|
|
805
823
|
}
|
|
806
824
|
}
|
|
807
825
|
|
|
@@ -840,15 +858,15 @@ var yt = /** @class */ function(r) {
|
|
|
840
858
|
*/
|
|
841
859
|
function i(t, e) {
|
|
842
860
|
var n = this;
|
|
843
|
-
return (n = r.call(this, t) || this).
|
|
861
|
+
return (n = r.call(this, t) || this).P = e, n;
|
|
844
862
|
}
|
|
845
863
|
/**
|
|
846
864
|
* Base class for all Rest-based connections to the backend (WebChannel and
|
|
847
865
|
* HTTP).
|
|
848
866
|
*/
|
|
849
|
-
return t(i, r), i.prototype.
|
|
867
|
+
return t(i, r), i.prototype.V = function(t, e) {
|
|
850
868
|
throw new Error("Not supported by FetchConnection");
|
|
851
|
-
}, i.prototype.
|
|
869
|
+
}, i.prototype.A = function(t, r, i, o) {
|
|
852
870
|
return e(this, void 0, void 0, (function() {
|
|
853
871
|
var t, e, a;
|
|
854
872
|
return n(this, (function(n) {
|
|
@@ -857,7 +875,7 @@ var yt = /** @class */ function(r) {
|
|
|
857
875
|
t = JSON.stringify(o), n.label = 1;
|
|
858
876
|
|
|
859
877
|
case 1:
|
|
860
|
-
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.
|
|
878
|
+
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.P(r, {
|
|
861
879
|
method: "POST",
|
|
862
880
|
headers: i,
|
|
863
881
|
body: t
|
|
@@ -880,28 +898,28 @@ var yt = /** @class */ function(r) {
|
|
|
880
898
|
function t(t) {
|
|
881
899
|
this.databaseInfo = t, this.databaseId = t.databaseId;
|
|
882
900
|
var e = t.ssl ? "https" : "http";
|
|
883
|
-
this.
|
|
901
|
+
this.p = e + "://" + t.host, this.g = "projects/" + this.databaseId.projectId + "/databases/" + this.databaseId.database + "/documents";
|
|
884
902
|
}
|
|
885
|
-
return t.prototype.
|
|
886
|
-
var o = this.
|
|
903
|
+
return t.prototype.v = function(t, e, n, r, i) {
|
|
904
|
+
var o = this.T(t, e);
|
|
887
905
|
w("RestConnection", "Sending: ", o, n);
|
|
888
906
|
var a = {};
|
|
889
|
-
return this.
|
|
907
|
+
return this.I(a, r, i), this.A(t, o, a, n).then((function(t) {
|
|
890
908
|
return w("RestConnection", "Received: ", t), t;
|
|
891
909
|
}), (function(e) {
|
|
892
910
|
throw _("RestConnection", t + " failed with error: ", e, "url: ", o, "request:", n),
|
|
893
911
|
e;
|
|
894
912
|
}));
|
|
895
|
-
}, t.prototype.
|
|
913
|
+
}, t.prototype.R = function(t, e, n, r, i, o) {
|
|
896
914
|
// The REST API automatically aggregates all of the streamed results, so we
|
|
897
915
|
// can just use the normal invoke() method.
|
|
898
|
-
return this.
|
|
916
|
+
return this.v(t, e, n, r, i);
|
|
899
917
|
},
|
|
900
918
|
/**
|
|
901
919
|
* Modifies the headers for a request, adding any authorization token if
|
|
902
920
|
* present and any additional headers for the request.
|
|
903
921
|
*/
|
|
904
|
-
t.prototype.
|
|
922
|
+
t.prototype.I = function(t, e, n) {
|
|
905
923
|
t["X-Goog-Api-Client"] = "gl-js/ fire/" + m,
|
|
906
924
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
907
925
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
@@ -913,9 +931,9 @@ var yt = /** @class */ function(r) {
|
|
|
913
931
|
})), n && n.headers.forEach((function(e, n) {
|
|
914
932
|
return t[n] = e;
|
|
915
933
|
}));
|
|
916
|
-
}, t.prototype.
|
|
934
|
+
}, t.prototype.T = function(t, e) {
|
|
917
935
|
var n = pt[t];
|
|
918
|
-
return this.
|
|
936
|
+
return this.p + "/v1/" + e + ":" + n;
|
|
919
937
|
}, t;
|
|
920
938
|
}());
|
|
921
939
|
|
|
@@ -984,7 +1002,7 @@ var yt = /** @class */ function(r) {
|
|
|
984
1002
|
* limitations under the License.
|
|
985
1003
|
*/ var vt = /** @class */ function() {
|
|
986
1004
|
function t() {}
|
|
987
|
-
return t.
|
|
1005
|
+
return t.N = function() {
|
|
988
1006
|
for (
|
|
989
1007
|
// Alphanumeric characters
|
|
990
1008
|
var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length, n = ""
|
|
@@ -1240,7 +1258,7 @@ function Et(t, e) {
|
|
|
1240
1258
|
*/
|
|
1241
1259
|
// An immutable sorted map implementation, based on a Left-leaning Red-Black
|
|
1242
1260
|
// tree.
|
|
1243
|
-
var
|
|
1261
|
+
var kt = /** @class */ function() {
|
|
1244
1262
|
function t(t, e) {
|
|
1245
1263
|
this.comparator = t, this.root = e || It.EMPTY;
|
|
1246
1264
|
}
|
|
@@ -1319,15 +1337,15 @@ var St = /** @class */ function() {
|
|
|
1319
1337
|
},
|
|
1320
1338
|
// Returns an iterator over the SortedMap.
|
|
1321
1339
|
t.prototype.getIterator = function() {
|
|
1322
|
-
return new
|
|
1340
|
+
return new St(this.root, null, this.comparator, !1);
|
|
1323
1341
|
}, t.prototype.getIteratorFrom = function(t) {
|
|
1324
|
-
return new
|
|
1342
|
+
return new St(this.root, t, this.comparator, !1);
|
|
1325
1343
|
}, t.prototype.getReverseIterator = function() {
|
|
1326
|
-
return new
|
|
1344
|
+
return new St(this.root, null, this.comparator, !0);
|
|
1327
1345
|
}, t.prototype.getReverseIteratorFrom = function(t) {
|
|
1328
|
-
return new
|
|
1346
|
+
return new St(this.root, t, this.comparator, !0);
|
|
1329
1347
|
}, t;
|
|
1330
|
-
}(),
|
|
1348
|
+
}(), St = /** @class */ function() {
|
|
1331
1349
|
function t(t, e, n, r) {
|
|
1332
1350
|
this.isReverse = r, this.nodeStack = [];
|
|
1333
1351
|
for (var i = 1; !t.isEmpty(); ) if (i = e ? n(t.key, e) : 1,
|
|
@@ -1563,7 +1581,7 @@ It.EMPTY = new (/** @class */ function() {
|
|
|
1563
1581
|
*/
|
|
1564
1582
|
var At = /** @class */ function() {
|
|
1565
1583
|
function t(t) {
|
|
1566
|
-
this.comparator = t, this.data = new
|
|
1584
|
+
this.comparator = t, this.data = new kt(this.comparator);
|
|
1567
1585
|
}
|
|
1568
1586
|
return t.prototype.has = function(t) {
|
|
1569
1587
|
return null !== this.data.get(t);
|
|
@@ -1651,7 +1669,7 @@ var At = /** @class */ function() {
|
|
|
1651
1669
|
}, t.prototype.hasNext = function() {
|
|
1652
1670
|
return this.iter.hasNext();
|
|
1653
1671
|
}, t;
|
|
1654
|
-
}(),
|
|
1672
|
+
}(), Pt = /** @class */ function() {
|
|
1655
1673
|
function t(t) {
|
|
1656
1674
|
this.fields = t,
|
|
1657
1675
|
// TODO(dimond): validation of FieldMask
|
|
@@ -1692,7 +1710,7 @@ var At = /** @class */ function() {
|
|
|
1692
1710
|
return t.isEqual(e);
|
|
1693
1711
|
}));
|
|
1694
1712
|
}, t;
|
|
1695
|
-
}(),
|
|
1713
|
+
}(), Dt = /** @class */ function() {
|
|
1696
1714
|
function t(t) {
|
|
1697
1715
|
this.binaryString = t;
|
|
1698
1716
|
}
|
|
@@ -1740,7 +1758,7 @@ var At = /** @class */ function() {
|
|
|
1740
1758
|
}, t;
|
|
1741
1759
|
}();
|
|
1742
1760
|
|
|
1743
|
-
|
|
1761
|
+
Dt.EMPTY_BYTE_STRING = new Dt("");
|
|
1744
1762
|
|
|
1745
1763
|
var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
1746
1764
|
|
|
@@ -1751,12 +1769,12 @@ var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1751
1769
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1752
1770
|
// while the proto js library (for node) will return a
|
|
1753
1771
|
// google.protobuf.Timestamp instance.
|
|
1754
|
-
if (
|
|
1772
|
+
if (k(!!t), "string" == typeof t) {
|
|
1755
1773
|
// The date string can have higher precision (nanos) than the Date class
|
|
1756
1774
|
// (millis), so we do some custom parsing here.
|
|
1757
1775
|
// Parse the nanos right out of the string.
|
|
1758
1776
|
var e = 0, n = Nt.exec(t);
|
|
1759
|
-
if (
|
|
1777
|
+
if (k(!!n), n[1]) {
|
|
1760
1778
|
// Pad the fraction out to 9 digits (nanos).
|
|
1761
1779
|
var r = n[1];
|
|
1762
1780
|
r = (r + "000000000").substr(0, 9), e = Number(r);
|
|
@@ -1782,8 +1800,8 @@ var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1782
1800
|
return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0;
|
|
1783
1801
|
}
|
|
1784
1802
|
|
|
1785
|
-
/** Converts the possible Proto types for Blobs into a ByteString. */ function
|
|
1786
|
-
return "string" == typeof t ?
|
|
1803
|
+
/** Converts the possible Proto types for Blobs into a ByteString. */ function Rt(t) {
|
|
1804
|
+
return "string" == typeof t ? Dt.fromBase64String(t) : Dt.fromUint8Array(t);
|
|
1787
1805
|
}
|
|
1788
1806
|
|
|
1789
1807
|
/**
|
|
@@ -1819,7 +1837,7 @@ var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1819
1837
|
* FieldValueOptions to value().
|
|
1820
1838
|
* - With respect to other ServerTimestampValues, they sort by their
|
|
1821
1839
|
* localWriteTime.
|
|
1822
|
-
*/ function
|
|
1840
|
+
*/ function qt(t) {
|
|
1823
1841
|
var e, n;
|
|
1824
1842
|
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);
|
|
1825
1843
|
}
|
|
@@ -1829,14 +1847,14 @@ var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1829
1847
|
*
|
|
1830
1848
|
* Preserving the previous values allows the user to display the last resoled
|
|
1831
1849
|
* value until the backend responds with the timestamp.
|
|
1832
|
-
*/ function
|
|
1850
|
+
*/ function Ct(t) {
|
|
1833
1851
|
var e = t.mapValue.fields.__previous_value__;
|
|
1834
|
-
return
|
|
1852
|
+
return qt(e) ? Ct(e) : e;
|
|
1835
1853
|
}
|
|
1836
1854
|
|
|
1837
1855
|
/**
|
|
1838
1856
|
* Returns the local time at which this timestamp was first set.
|
|
1839
|
-
*/ function
|
|
1857
|
+
*/ function xt(t) {
|
|
1840
1858
|
var e = Ft(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1841
1859
|
return new bt(e.seconds, e.nanos);
|
|
1842
1860
|
}
|
|
@@ -1865,7 +1883,7 @@ var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1865
1883
|
};
|
|
1866
1884
|
|
|
1867
1885
|
/** Extracts the backend's type order for the provided value. */ function jt(t) {
|
|
1868
|
-
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 ?
|
|
1886
|
+
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 ? qt(t) ? 4 /* ServerTimestampValue */ :
|
|
1869
1887
|
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
|
|
1870
1888
|
function(t) {
|
|
1871
1889
|
return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue;
|
|
@@ -1885,7 +1903,7 @@ var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1885
1903
|
return t.booleanValue === e.booleanValue;
|
|
1886
1904
|
|
|
1887
1905
|
case 4 /* ServerTimestampValue */ :
|
|
1888
|
-
return
|
|
1906
|
+
return xt(t).isEqual(xt(e));
|
|
1889
1907
|
|
|
1890
1908
|
case 3 /* TimestampValue */ :
|
|
1891
1909
|
return function(t, e) {
|
|
@@ -1901,7 +1919,7 @@ var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1901
1919
|
|
|
1902
1920
|
case 6 /* BlobValue */ :
|
|
1903
1921
|
return function(t, e) {
|
|
1904
|
-
return
|
|
1922
|
+
return Rt(t.bytesValue).isEqual(Rt(e.bytesValue));
|
|
1905
1923
|
}(t, e);
|
|
1906
1924
|
|
|
1907
1925
|
case 7 /* RefValue */ :
|
|
@@ -1965,17 +1983,17 @@ function Bt(t, e) {
|
|
|
1965
1983
|
}(t, e);
|
|
1966
1984
|
|
|
1967
1985
|
case 3 /* TimestampValue */ :
|
|
1968
|
-
return
|
|
1986
|
+
return Gt(t.timestampValue, e.timestampValue);
|
|
1969
1987
|
|
|
1970
1988
|
case 4 /* ServerTimestampValue */ :
|
|
1971
|
-
return
|
|
1989
|
+
return Gt(xt(t), xt(e));
|
|
1972
1990
|
|
|
1973
1991
|
case 5 /* StringValue */ :
|
|
1974
1992
|
return gt(t.stringValue, e.stringValue);
|
|
1975
1993
|
|
|
1976
1994
|
case 6 /* BlobValue */ :
|
|
1977
1995
|
return function(t, e) {
|
|
1978
|
-
var n =
|
|
1996
|
+
var n = Rt(t), r = Rt(e);
|
|
1979
1997
|
return n.compareTo(r);
|
|
1980
1998
|
}(t.bytesValue, e.bytesValue);
|
|
1981
1999
|
|
|
@@ -2028,13 +2046,13 @@ function Bt(t, e) {
|
|
|
2028
2046
|
}
|
|
2029
2047
|
}
|
|
2030
2048
|
|
|
2031
|
-
function
|
|
2049
|
+
function Gt(t, e) {
|
|
2032
2050
|
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return gt(t, e);
|
|
2033
2051
|
var n = Ft(t), r = Ft(e), i = gt(n.seconds, r.seconds);
|
|
2034
2052
|
return 0 !== i ? i : gt(n.nanos, r.nanos);
|
|
2035
2053
|
}
|
|
2036
2054
|
|
|
2037
|
-
function
|
|
2055
|
+
function zt(t, e) {
|
|
2038
2056
|
return {
|
|
2039
2057
|
referenceValue: "projects/" + t.projectId + "/databases/" + t.database + "/documents/" + e.path.canonicalString()
|
|
2040
2058
|
};
|
|
@@ -2044,11 +2062,11 @@ function Gt(t, e) {
|
|
|
2044
2062
|
return !!t && "arrayValue" in t;
|
|
2045
2063
|
}
|
|
2046
2064
|
|
|
2047
|
-
/** Returns true if `value` is a NullValue. */ function
|
|
2065
|
+
/** Returns true if `value` is a NullValue. */ function Wt(t) {
|
|
2048
2066
|
return !!t && "nullValue" in t;
|
|
2049
2067
|
}
|
|
2050
2068
|
|
|
2051
|
-
/** Returns true if `value` is NaN. */ function
|
|
2069
|
+
/** Returns true if `value` is NaN. */ function Qt(t) {
|
|
2052
2070
|
return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
|
|
2053
2071
|
}
|
|
2054
2072
|
|
|
@@ -2084,7 +2102,7 @@ function Gt(t, e) {
|
|
|
2084
2102
|
return Object.assign({}, t);
|
|
2085
2103
|
}
|
|
2086
2104
|
|
|
2087
|
-
var
|
|
2105
|
+
var Xt = /** @class */ function() {
|
|
2088
2106
|
function t(t) {
|
|
2089
2107
|
this.value = t;
|
|
2090
2108
|
}
|
|
@@ -2177,7 +2195,7 @@ var $t = /** @class */ function() {
|
|
|
2177
2195
|
}, t.prototype.clone = function() {
|
|
2178
2196
|
return new t(Yt(this.value));
|
|
2179
2197
|
}, t;
|
|
2180
|
-
}(),
|
|
2198
|
+
}(), Jt = /** @class */ function() {
|
|
2181
2199
|
function t(t, e, n, r, i, o) {
|
|
2182
2200
|
this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.data = i,
|
|
2183
2201
|
this.documentState = o
|
|
@@ -2187,7 +2205,7 @@ var $t = /** @class */ function() {
|
|
|
2187
2205
|
*/;
|
|
2188
2206
|
}
|
|
2189
2207
|
return t.newInvalidDocument = function(e) {
|
|
2190
|
-
return new t(e, 0 /* INVALID */ , _t.min(), _t.min(),
|
|
2208
|
+
return new t(e, 0 /* INVALID */ , _t.min(), _t.min(), Xt.empty(), 0 /* SYNCED */);
|
|
2191
2209
|
},
|
|
2192
2210
|
/**
|
|
2193
2211
|
* Creates a new document that is known to exist with the given data at the
|
|
@@ -2197,7 +2215,7 @@ var $t = /** @class */ function() {
|
|
|
2197
2215
|
return new t(e, 1 /* FOUND_DOCUMENT */ , n, _t.min(), r, 0 /* SYNCED */);
|
|
2198
2216
|
},
|
|
2199
2217
|
/** Creates a new document that is known to not exist at the given version. */ t.newNoDocument = function(e, n) {
|
|
2200
|
-
return new t(e, 2 /* NO_DOCUMENT */ , n, _t.min(),
|
|
2218
|
+
return new t(e, 2 /* NO_DOCUMENT */ , n, _t.min(), Xt.empty(), 0 /* SYNCED */);
|
|
2201
2219
|
},
|
|
2202
2220
|
/**
|
|
2203
2221
|
* Creates a new document that is known to exist at the given version but
|
|
@@ -2205,7 +2223,7 @@ var $t = /** @class */ function() {
|
|
|
2205
2223
|
* base document).
|
|
2206
2224
|
*/
|
|
2207
2225
|
t.newUnknownDocument = function(e, n) {
|
|
2208
|
-
return new t(e, 3 /* UNKNOWN_DOCUMENT */ , n, _t.min(),
|
|
2226
|
+
return new t(e, 3 /* UNKNOWN_DOCUMENT */ , n, _t.min(), Xt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2209
2227
|
},
|
|
2210
2228
|
/**
|
|
2211
2229
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2220,7 +2238,7 @@ var $t = /** @class */ function() {
|
|
|
2220
2238
|
* version.
|
|
2221
2239
|
*/
|
|
2222
2240
|
t.prototype.convertToNoDocument = function(t) {
|
|
2223
|
-
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data =
|
|
2241
|
+
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Xt.empty(),
|
|
2224
2242
|
this.documentState = 0 /* SYNCED */ , this;
|
|
2225
2243
|
},
|
|
2226
2244
|
/**
|
|
@@ -2229,7 +2247,7 @@ var $t = /** @class */ function() {
|
|
|
2229
2247
|
* base document).
|
|
2230
2248
|
*/
|
|
2231
2249
|
t.prototype.convertToUnknownDocument = function(t) {
|
|
2232
|
-
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data =
|
|
2250
|
+
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Xt.empty(),
|
|
2233
2251
|
this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
2234
2252
|
}, t.prototype.setHasCommittedMutations = function() {
|
|
2235
2253
|
return this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
@@ -2271,11 +2289,11 @@ var $t = /** @class */ function() {
|
|
|
2271
2289
|
}, t.prototype.toString = function() {
|
|
2272
2290
|
return "Document(" + this.key + ", " + this.version + ", " + JSON.stringify(this.data.value) + ", {documentType: " + this.documentType + "}), {documentState: " + this.documentState + "})";
|
|
2273
2291
|
}, t;
|
|
2274
|
-
}(),
|
|
2292
|
+
}(), Zt = function(t, e, n, r, i, o, a) {
|
|
2275
2293
|
void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
|
|
2276
2294
|
void 0 === i && (i = null), void 0 === o && (o = null), void 0 === a && (a = null),
|
|
2277
2295
|
this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = i,
|
|
2278
|
-
this.startAt = o, this.endAt = a, this.
|
|
2296
|
+
this.startAt = o, this.endAt = a, this.D = null;
|
|
2279
2297
|
};
|
|
2280
2298
|
|
|
2281
2299
|
/**
|
|
@@ -2312,10 +2330,10 @@ var $t = /** @class */ function() {
|
|
|
2312
2330
|
* using this factory method, because `Query` provides an implicit `orderBy`
|
|
2313
2331
|
* property.
|
|
2314
2332
|
*/
|
|
2315
|
-
function
|
|
2333
|
+
function $t(t, e, n, r, i, o, a) {
|
|
2316
2334
|
return void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
|
|
2317
2335
|
void 0 === i && (i = null), void 0 === o && (o = null), void 0 === a && (a = null),
|
|
2318
|
-
new
|
|
2336
|
+
new Zt(t, e, n, r, i, o, a);
|
|
2319
2337
|
}
|
|
2320
2338
|
|
|
2321
2339
|
var te = /** @class */ function(e) {
|
|
@@ -2326,15 +2344,15 @@ var te = /** @class */ function(e) {
|
|
|
2326
2344
|
/**
|
|
2327
2345
|
* Creates a filter based on the provided arguments.
|
|
2328
2346
|
*/ return t(n, e), n.create = function(t, e, r) {
|
|
2329
|
-
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this
|
|
2330
|
-
}, n
|
|
2347
|
+
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.$(t, e, r) : new ee(t, e, r) : "array-contains" /* ARRAY_CONTAINS */ === e ? new oe(t, r) : "in" /* IN */ === e ? new ae(t, r) : "not-in" /* NOT_IN */ === e ? new se(t, r) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ue(t, r) : new n(t, e, r);
|
|
2348
|
+
}, n.$ = function(t, e, n) {
|
|
2331
2349
|
return "in" /* IN */ === e ? new ne(t, n) : new re(t, n);
|
|
2332
2350
|
}, n.prototype.matches = function(t) {
|
|
2333
2351
|
var e = t.data.field(this.field);
|
|
2334
2352
|
// Types do not have to match in NOT_EQUAL filters.
|
|
2335
|
-
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.
|
|
2353
|
+
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.F(Bt(e, this.value)) : null !== e && jt(this.value) === jt(e) && this.F(Bt(e, this.value));
|
|
2336
2354
|
// Only compare types with matching backend order (such as double and int).
|
|
2337
|
-
}, n.prototype.
|
|
2355
|
+
}, n.prototype.F = function(t) {
|
|
2338
2356
|
switch (this.op) {
|
|
2339
2357
|
case "<" /* LESS_THAN */ :
|
|
2340
2358
|
return t < 0;
|
|
@@ -2357,7 +2375,7 @@ var te = /** @class */ function(e) {
|
|
|
2357
2375
|
default:
|
|
2358
2376
|
return E();
|
|
2359
2377
|
}
|
|
2360
|
-
}, n.prototype.
|
|
2378
|
+
}, n.prototype.S = function() {
|
|
2361
2379
|
return [ "<" /* LESS_THAN */ , "<=" /* LESS_THAN_OR_EQUAL */ , ">" /* GREATER_THAN */ , ">=" /* GREATER_THAN_OR_EQUAL */ , "!=" /* NOT_EQUAL */ , "not-in" /* NOT_IN */ ].indexOf(this.op) >= 0;
|
|
2362
2380
|
}, n;
|
|
2363
2381
|
}((function() {})), ee = /** @class */ function(e) {
|
|
@@ -2368,7 +2386,7 @@ var te = /** @class */ function(e) {
|
|
|
2368
2386
|
}
|
|
2369
2387
|
return t(n, e), n.prototype.matches = function(t) {
|
|
2370
2388
|
var e = nt.comparator(t.key, this.key);
|
|
2371
|
-
return this.
|
|
2389
|
+
return this.F(e);
|
|
2372
2390
|
}, n;
|
|
2373
2391
|
}(te), ne = /** @class */ function(e) {
|
|
2374
2392
|
function n(t, n) {
|
|
@@ -2488,9 +2506,9 @@ function(t, e, n, r, i, o /* First */ , a, s) {
|
|
|
2488
2506
|
void 0 === i && (i = null), void 0 === o && (o = "F"), void 0 === a && (a = null),
|
|
2489
2507
|
void 0 === s && (s = null), this.path = t, this.collectionGroup = e, this.explicitOrderBy = n,
|
|
2490
2508
|
this.filters = r, this.limit = i, this.limitType = o, this.startAt = a, this.endAt = s,
|
|
2491
|
-
this
|
|
2509
|
+
this.q = null,
|
|
2492
2510
|
// The corresponding `Target` of this `Query` instance.
|
|
2493
|
-
this.
|
|
2511
|
+
this.O = null, this.startAt, this.endAt;
|
|
2494
2512
|
};
|
|
2495
2513
|
|
|
2496
2514
|
/** Creates a new Query for a query that matches all documents at `path` */ function de(t) {
|
|
@@ -2500,7 +2518,7 @@ function(t, e, n, r, i, o /* First */ , a, s) {
|
|
|
2500
2518
|
function ye(t) {
|
|
2501
2519
|
for (var e = 0, n = t.filters; e < n.length; e++) {
|
|
2502
2520
|
var r = n[e];
|
|
2503
|
-
if (r.
|
|
2521
|
+
if (r.S()) return r.field;
|
|
2504
2522
|
}
|
|
2505
2523
|
return null;
|
|
2506
2524
|
}
|
|
@@ -2521,35 +2539,35 @@ function ye(t) {
|
|
|
2521
2539
|
* which can be different from the order by constraints the user provided (e.g.
|
|
2522
2540
|
* the SDK and backend always orders by `__name__`).
|
|
2523
2541
|
*/ function ve(t) {
|
|
2524
|
-
var e =
|
|
2525
|
-
if (null === e
|
|
2526
|
-
e
|
|
2542
|
+
var e = S(t);
|
|
2543
|
+
if (null === e.q) {
|
|
2544
|
+
e.q = [];
|
|
2527
2545
|
var n = ye(e), r = de(e);
|
|
2528
2546
|
if (null !== n && null === r)
|
|
2529
2547
|
// In order to implicitly add key ordering, we must also add the
|
|
2530
2548
|
// inequality filter field for it to be a valid query.
|
|
2531
2549
|
// Note that the default inequality field and key ordering is ascending.
|
|
2532
|
-
n.isKeyField() || e
|
|
2550
|
+
n.isKeyField() || e.q.push(new le(n)), e.q.push(new le(et.keyField(), "asc" /* ASCENDING */)); else {
|
|
2533
2551
|
for (var i = !1, o = 0, a = e.explicitOrderBy; o < a.length; o++) {
|
|
2534
2552
|
var s = a[o];
|
|
2535
|
-
e
|
|
2553
|
+
e.q.push(s), s.field.isKeyField() && (i = !0);
|
|
2536
2554
|
}
|
|
2537
2555
|
if (!i) {
|
|
2538
2556
|
// The order of the implicit key ordering always matches the last
|
|
2539
2557
|
// explicit order by
|
|
2540
2558
|
var u = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
|
|
2541
|
-
e
|
|
2559
|
+
e.q.push(new le(et.keyField(), u));
|
|
2542
2560
|
}
|
|
2543
2561
|
}
|
|
2544
2562
|
}
|
|
2545
|
-
return e
|
|
2563
|
+
return e.q;
|
|
2546
2564
|
}
|
|
2547
2565
|
|
|
2548
2566
|
/**
|
|
2549
2567
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2550
2568
|
*/ function ge(t) {
|
|
2551
|
-
var e =
|
|
2552
|
-
if (!e.
|
|
2569
|
+
var e = S(t);
|
|
2570
|
+
if (!e.O) if ("F" /* First */ === e.limitType) e.O = $t(e.path, e.collectionGroup, ve(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
2553
2571
|
for (
|
|
2554
2572
|
// Flip the orderBy directions since we want the last results
|
|
2555
2573
|
var n = [], r = 0, i = ve(e); r < i.length; r++) {
|
|
@@ -2559,9 +2577,9 @@ function ye(t) {
|
|
|
2559
2577
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2560
2578
|
var s = e.endAt ? new ce(e.endAt.position, e.endAt.inclusive) : null, u = e.startAt ? new ce(e.startAt.position, e.startAt.inclusive) : null;
|
|
2561
2579
|
// Now return as a LimitType.First query.
|
|
2562
|
-
e.
|
|
2580
|
+
e.O = $t(e.path, e.collectionGroup, n, e.filters, e.limit, s, u);
|
|
2563
2581
|
}
|
|
2564
|
-
return e.
|
|
2582
|
+
return e.O;
|
|
2565
2583
|
}
|
|
2566
2584
|
|
|
2567
2585
|
/**
|
|
@@ -2601,7 +2619,7 @@ function we(t, e) {
|
|
|
2601
2619
|
integerValue: "" + t
|
|
2602
2620
|
};
|
|
2603
2621
|
}(e) : function(t, e) {
|
|
2604
|
-
if (t.
|
|
2622
|
+
if (t.k) {
|
|
2605
2623
|
if (isNaN(e)) return {
|
|
2606
2624
|
doubleValue: "NaN"
|
|
2607
2625
|
};
|
|
@@ -2655,13 +2673,13 @@ function we(t, e) {
|
|
|
2655
2673
|
return (n = e.call(this) || this).elements = t, n;
|
|
2656
2674
|
}
|
|
2657
2675
|
return t(n, e), n;
|
|
2658
|
-
}(be),
|
|
2676
|
+
}(be), ke = /** @class */ function(e) {
|
|
2659
2677
|
function n(t, n) {
|
|
2660
2678
|
var r = this;
|
|
2661
|
-
return (r = e.call(this) || this).
|
|
2679
|
+
return (r = e.call(this) || this).C = t, r.L = n, r;
|
|
2662
2680
|
}
|
|
2663
2681
|
return t(n, e), n;
|
|
2664
|
-
}(be),
|
|
2682
|
+
}(be), Se = function(t, e) {
|
|
2665
2683
|
this.field = t, this.transform = e;
|
|
2666
2684
|
}, Ie = /** @class */ function() {
|
|
2667
2685
|
function t(t, e) {
|
|
@@ -2695,7 +2713,7 @@ function we(t, e) {
|
|
|
2695
2713
|
return t(n, e), n.prototype.getFieldMask = function() {
|
|
2696
2714
|
return null;
|
|
2697
2715
|
}, n;
|
|
2698
|
-
}(Ae),
|
|
2716
|
+
}(Ae), Pe = /** @class */ function(e) {
|
|
2699
2717
|
function n(t, n, r, i, o) {
|
|
2700
2718
|
void 0 === o && (o = []);
|
|
2701
2719
|
var a = this;
|
|
@@ -2705,7 +2723,7 @@ function we(t, e) {
|
|
|
2705
2723
|
return t(n, e), n.prototype.getFieldMask = function() {
|
|
2706
2724
|
return this.fieldMask;
|
|
2707
2725
|
}, n;
|
|
2708
|
-
}(Ae),
|
|
2726
|
+
}(Ae), De = /** @class */ function(e) {
|
|
2709
2727
|
function n(t, n) {
|
|
2710
2728
|
var r = this;
|
|
2711
2729
|
return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 2 /* Delete */ ,
|
|
@@ -2737,8 +2755,8 @@ function we(t, e) {
|
|
|
2737
2755
|
in: "IN",
|
|
2738
2756
|
"not-in": "NOT_IN",
|
|
2739
2757
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
2740
|
-
},
|
|
2741
|
-
this.databaseId = t, this.
|
|
2758
|
+
}, Re = function(t, e) {
|
|
2759
|
+
this.databaseId = t, this.k = e;
|
|
2742
2760
|
};
|
|
2743
2761
|
|
|
2744
2762
|
/** Transforms a value into a server-generated timestamp. */
|
|
@@ -2753,8 +2771,8 @@ function we(t, e) {
|
|
|
2753
2771
|
/**
|
|
2754
2772
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
2755
2773
|
*/
|
|
2756
|
-
function
|
|
2757
|
-
return t.
|
|
2774
|
+
function qe(t, e) {
|
|
2775
|
+
return t.k ? new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "") + "." + ("000000000" + e.nanoseconds).slice(-9) + "Z" : {
|
|
2758
2776
|
seconds: "" + e.seconds,
|
|
2759
2777
|
nanos: e.nanoseconds
|
|
2760
2778
|
};
|
|
@@ -2764,16 +2782,16 @@ function Re(t, e) {
|
|
|
2764
2782
|
* Returns a value for bytes that's appropriate to put in a proto.
|
|
2765
2783
|
*
|
|
2766
2784
|
* Visible for testing.
|
|
2767
|
-
*/ function
|
|
2768
|
-
return t.
|
|
2785
|
+
*/ function Ce(t, e) {
|
|
2786
|
+
return t.k ? e.toBase64() : e.toUint8Array();
|
|
2769
2787
|
}
|
|
2770
2788
|
|
|
2771
|
-
function
|
|
2772
|
-
return
|
|
2789
|
+
function xe(t, e) {
|
|
2790
|
+
return qe(t, e.toTimestamp());
|
|
2773
2791
|
}
|
|
2774
2792
|
|
|
2775
2793
|
function Le(t) {
|
|
2776
|
-
return
|
|
2794
|
+
return k(!!t), _t.fromTimestamp(function(t) {
|
|
2777
2795
|
var e = Ft(t);
|
|
2778
2796
|
return new bt(e.seconds, e.nanos);
|
|
2779
2797
|
}(t));
|
|
@@ -2781,7 +2799,7 @@ function Le(t) {
|
|
|
2781
2799
|
|
|
2782
2800
|
function je(t, e) {
|
|
2783
2801
|
return function(t) {
|
|
2784
|
-
return new
|
|
2802
|
+
return new $([ "projects", t.projectId, "databases", t.database ]);
|
|
2785
2803
|
}(t).child("documents").child(e).canonicalString();
|
|
2786
2804
|
}
|
|
2787
2805
|
|
|
@@ -2791,23 +2809,23 @@ function Me(t, e) {
|
|
|
2791
2809
|
|
|
2792
2810
|
function Ue(t, e) {
|
|
2793
2811
|
var n, r = function(t) {
|
|
2794
|
-
var e =
|
|
2795
|
-
return
|
|
2812
|
+
var e = $.fromString(t);
|
|
2813
|
+
return k(Ye(e)), e;
|
|
2796
2814
|
}(e);
|
|
2797
2815
|
if (r.get(1) !== t.databaseId.projectId) throw new M(V, "Tried to deserialize key from different project: " + r.get(1) + " vs " + t.databaseId.projectId);
|
|
2798
2816
|
if (r.get(3) !== t.databaseId.database) throw new M(V, "Tried to deserialize key from different database: " + r.get(3) + " vs " + t.databaseId.database);
|
|
2799
|
-
return new nt((
|
|
2817
|
+
return new nt((k((n = r).length > 4 && "documents" === n.get(4)), n.popFirst(5)));
|
|
2800
2818
|
}
|
|
2801
2819
|
|
|
2802
2820
|
function Be(t, e) {
|
|
2803
2821
|
return je(t.databaseId, e);
|
|
2804
2822
|
}
|
|
2805
2823
|
|
|
2806
|
-
function
|
|
2807
|
-
return new
|
|
2824
|
+
function Ge(t) {
|
|
2825
|
+
return new $([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
2808
2826
|
}
|
|
2809
2827
|
|
|
2810
|
-
function
|
|
2828
|
+
function ze(t, e, n) {
|
|
2811
2829
|
return {
|
|
2812
2830
|
name: Me(t, e),
|
|
2813
2831
|
fields: n.value.mapValue.fields
|
|
@@ -2819,11 +2837,11 @@ function Ke(t) {
|
|
|
2819
2837
|
}
|
|
2820
2838
|
|
|
2821
2839
|
// visible for testing
|
|
2822
|
-
function
|
|
2840
|
+
function We(t) {
|
|
2823
2841
|
return Oe[t];
|
|
2824
2842
|
}
|
|
2825
2843
|
|
|
2826
|
-
function
|
|
2844
|
+
function Qe(t) {
|
|
2827
2845
|
return {
|
|
2828
2846
|
fieldPath: t.canonicalString()
|
|
2829
2847
|
};
|
|
@@ -2858,8 +2876,8 @@ function Ye(t) {
|
|
|
2858
2876
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2859
2877
|
* See the License for the specific language governing permissions and
|
|
2860
2878
|
* limitations under the License.
|
|
2861
|
-
*/ function
|
|
2862
|
-
return new
|
|
2879
|
+
*/ function Xe(t) {
|
|
2880
|
+
return new Re(t, /* useProto3Json= */ !0);
|
|
2863
2881
|
}
|
|
2864
2882
|
|
|
2865
2883
|
/**
|
|
@@ -2886,7 +2904,7 @@ function Ye(t) {
|
|
|
2886
2904
|
* backoff curve, and a +/- 50% "jitter" that is calculated and added to the
|
|
2887
2905
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
2888
2906
|
* delays causing spikes of load to the backend.
|
|
2889
|
-
*/ var
|
|
2907
|
+
*/ var Je = /** @class */ function() {
|
|
2890
2908
|
function t(
|
|
2891
2909
|
/**
|
|
2892
2910
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -2912,9 +2930,9 @@ function Ye(t) {
|
|
|
2912
2930
|
* much as 1.5*maxDelayMs.
|
|
2913
2931
|
*/ , i) {
|
|
2914
2932
|
void 0 === n && (n = 1e3), void 0 === r && (r = 1.5), void 0 === i && (i = 6e4),
|
|
2915
|
-
this.
|
|
2933
|
+
this.M = t, this.timerId = e, this.U = n, this.j = r, this.B = i, this.G = 0, this.W = null,
|
|
2916
2934
|
/** The last backoff attempt, as epoch milliseconds. */
|
|
2917
|
-
this.
|
|
2935
|
+
this.K = Date.now(), this.reset();
|
|
2918
2936
|
}
|
|
2919
2937
|
/**
|
|
2920
2938
|
* Resets the backoff delay.
|
|
@@ -2923,73 +2941,73 @@ function Ye(t) {
|
|
|
2923
2941
|
* (i.e. due to an error), initialDelayMs (plus jitter) will be used, and
|
|
2924
2942
|
* subsequent ones will increase according to the backoffFactor.
|
|
2925
2943
|
*/ return t.prototype.reset = function() {
|
|
2926
|
-
this.
|
|
2944
|
+
this.G = 0;
|
|
2927
2945
|
},
|
|
2928
2946
|
/**
|
|
2929
2947
|
* Resets the backoff delay to the maximum delay (e.g. for use after a
|
|
2930
2948
|
* RESOURCE_EXHAUSTED error).
|
|
2931
2949
|
*/
|
|
2932
|
-
t.prototype.
|
|
2933
|
-
this.
|
|
2950
|
+
t.prototype.Y = function() {
|
|
2951
|
+
this.G = this.B;
|
|
2934
2952
|
},
|
|
2935
2953
|
/**
|
|
2936
2954
|
* Returns a promise that resolves after currentDelayMs, and increases the
|
|
2937
2955
|
* delay for any subsequent attempts. If there was a pending backoff operation
|
|
2938
2956
|
* already, it will be canceled.
|
|
2939
2957
|
*/
|
|
2940
|
-
t.prototype.
|
|
2958
|
+
t.prototype.H = function(t) {
|
|
2941
2959
|
var e = this;
|
|
2942
2960
|
// Cancel any pending backoff operation.
|
|
2943
2961
|
this.cancel();
|
|
2944
2962
|
// First schedule using the current base (which may be 0 and should be
|
|
2945
2963
|
// honored as such).
|
|
2946
|
-
var n = Math.floor(this.
|
|
2964
|
+
var n = Math.floor(this.G + this.J()), r = Math.max(0, Date.now() - this.K), i = Math.max(0, n - r);
|
|
2947
2965
|
// Guard against lastAttemptTime being in the future due to a clock change.
|
|
2948
|
-
i > 0 && w("ExponentialBackoff", "Backing off for " + i + " ms (base delay: " + this.
|
|
2949
|
-
this.
|
|
2950
|
-
return e.
|
|
2966
|
+
i > 0 && w("ExponentialBackoff", "Backing off for " + i + " ms (base delay: " + this.G + " ms, delay with jitter: " + n + " ms, last attempt: " + r + " ms ago)"),
|
|
2967
|
+
this.W = this.M.enqueueAfterDelay(this.timerId, i, (function() {
|
|
2968
|
+
return e.K = Date.now(), t();
|
|
2951
2969
|
})),
|
|
2952
2970
|
// Apply backoff factor to determine next delay and ensure it is within
|
|
2953
2971
|
// bounds.
|
|
2954
|
-
this.
|
|
2955
|
-
}, t.prototype.
|
|
2956
|
-
null !== this.
|
|
2972
|
+
this.G *= this.j, this.G < this.U && (this.G = this.U), this.G > this.B && (this.G = this.B);
|
|
2973
|
+
}, t.prototype.X = function() {
|
|
2974
|
+
null !== this.W && (this.W.skipDelay(), this.W = null);
|
|
2957
2975
|
}, t.prototype.cancel = function() {
|
|
2958
|
-
null !== this.
|
|
2976
|
+
null !== this.W && (this.W.cancel(), this.W = null);
|
|
2959
2977
|
},
|
|
2960
|
-
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ t.prototype.
|
|
2961
|
-
return (Math.random() - .5) * this.
|
|
2978
|
+
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ t.prototype.J = function() {
|
|
2979
|
+
return (Math.random() - .5) * this.G;
|
|
2962
2980
|
}, t;
|
|
2963
|
-
}(),
|
|
2981
|
+
}(), Ze = /** @class */ function(e) {
|
|
2964
2982
|
function n(t, n, r, i) {
|
|
2965
2983
|
var o = this;
|
|
2966
2984
|
return (o = e.call(this) || this).authCredentials = t, o.appCheckCredentials = n,
|
|
2967
|
-
o.
|
|
2985
|
+
o.Z = r, o.C = i, o.tt = !1, o;
|
|
2968
2986
|
}
|
|
2969
|
-
return t(n, e), n.prototype.
|
|
2970
|
-
if (this.
|
|
2987
|
+
return t(n, e), n.prototype.et = function() {
|
|
2988
|
+
if (this.tt) throw new M(R, "The client has already been terminated.");
|
|
2971
2989
|
},
|
|
2972
|
-
/** Invokes the provided RPC with auth and AppCheck tokens. */ n.prototype.
|
|
2990
|
+
/** Invokes the provided RPC with auth and AppCheck tokens. */ n.prototype.v = function(t, e, n) {
|
|
2973
2991
|
var r = this;
|
|
2974
|
-
return this.
|
|
2992
|
+
return this.et(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((function(i) {
|
|
2975
2993
|
var o = i[0], a = i[1];
|
|
2976
|
-
return r.
|
|
2994
|
+
return r.Z.v(t, e, n, o, a);
|
|
2977
2995
|
})).catch((function(t) {
|
|
2978
2996
|
throw "FirebaseError" === t.name ? (t.code === F && (r.authCredentials.invalidateToken(),
|
|
2979
2997
|
r.appCheckCredentials.invalidateToken()), t) : new M(A, t.toString());
|
|
2980
2998
|
}));
|
|
2981
2999
|
},
|
|
2982
|
-
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ n.prototype.
|
|
3000
|
+
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ n.prototype.R = function(t, e, n, r) {
|
|
2983
3001
|
var i = this;
|
|
2984
|
-
return this.
|
|
3002
|
+
return this.et(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((function(o) {
|
|
2985
3003
|
var a = o[0], s = o[1];
|
|
2986
|
-
return i.
|
|
3004
|
+
return i.Z.R(t, e, n, a, s, r);
|
|
2987
3005
|
})).catch((function(t) {
|
|
2988
3006
|
throw "FirebaseError" === t.name ? (t.code === F && (i.authCredentials.invalidateToken(),
|
|
2989
3007
|
i.appCheckCredentials.invalidateToken()), t) : new M(A, t.toString());
|
|
2990
3008
|
}));
|
|
2991
3009
|
}, n.prototype.terminate = function() {
|
|
2992
|
-
this.
|
|
3010
|
+
this.tt = !0;
|
|
2993
3011
|
}, n;
|
|
2994
3012
|
}((function() {}));
|
|
2995
3013
|
|
|
@@ -3020,22 +3038,22 @@ function Ye(t) {
|
|
|
3020
3038
|
*/
|
|
3021
3039
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3022
3040
|
// firestore-exp client.
|
|
3023
|
-
function
|
|
3041
|
+
function $e(t, r) {
|
|
3024
3042
|
return e(this, void 0, void 0, (function() {
|
|
3025
3043
|
var e, i, o;
|
|
3026
3044
|
return n(this, (function(n) {
|
|
3027
3045
|
switch (n.label) {
|
|
3028
3046
|
case 0:
|
|
3029
|
-
return e =
|
|
3047
|
+
return e = S(t), i = Ge(e.C) + "/documents", o = {
|
|
3030
3048
|
writes: r.map((function(t) {
|
|
3031
3049
|
return function(t, e) {
|
|
3032
3050
|
var n;
|
|
3033
3051
|
if (e instanceof Ve) n = {
|
|
3034
|
-
update:
|
|
3035
|
-
}; else if (e instanceof Pe) n = {
|
|
3036
|
-
delete: Me(t, e.key)
|
|
3052
|
+
update: ze(t, e.key, e.value)
|
|
3037
3053
|
}; else if (e instanceof De) n = {
|
|
3038
|
-
|
|
3054
|
+
delete: Me(t, e.key)
|
|
3055
|
+
}; else if (e instanceof Pe) n = {
|
|
3056
|
+
update: ze(t, e.key, e.data),
|
|
3039
3057
|
updateMask: He(e.fieldMask)
|
|
3040
3058
|
}; else {
|
|
3041
3059
|
if (!(e instanceof Ne)) return E();
|
|
@@ -3062,22 +3080,22 @@ function Ze(t, r) {
|
|
|
3062
3080
|
values: n.elements
|
|
3063
3081
|
}
|
|
3064
3082
|
};
|
|
3065
|
-
if (n instanceof
|
|
3083
|
+
if (n instanceof ke) return {
|
|
3066
3084
|
fieldPath: e.field.canonicalString(),
|
|
3067
|
-
increment: n.
|
|
3085
|
+
increment: n.L
|
|
3068
3086
|
};
|
|
3069
3087
|
throw E();
|
|
3070
3088
|
}(0, t);
|
|
3071
3089
|
}))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
3072
3090
|
return void 0 !== e.updateTime ? {
|
|
3073
|
-
updateTime:
|
|
3091
|
+
updateTime: xe(t, e.updateTime)
|
|
3074
3092
|
} : void 0 !== e.exists ? {
|
|
3075
3093
|
exists: e.exists
|
|
3076
3094
|
} : E();
|
|
3077
3095
|
}(t, e.precondition)), n;
|
|
3078
|
-
}(e.
|
|
3096
|
+
}(e.C, t);
|
|
3079
3097
|
}))
|
|
3080
|
-
}, [ 4 /*yield*/ , e.
|
|
3098
|
+
}, [ 4 /*yield*/ , e.v("Commit", i, o) ];
|
|
3081
3099
|
|
|
3082
3100
|
case 1:
|
|
3083
3101
|
return n.sent(), [ 2 /*return*/ ];
|
|
@@ -3092,33 +3110,33 @@ function tn(t, r) {
|
|
|
3092
3110
|
return n(this, (function(n) {
|
|
3093
3111
|
switch (n.label) {
|
|
3094
3112
|
case 0:
|
|
3095
|
-
return e =
|
|
3113
|
+
return e = S(t), i = Ge(e.C) + "/documents", o = {
|
|
3096
3114
|
documents: r.map((function(t) {
|
|
3097
|
-
return Me(e.
|
|
3115
|
+
return Me(e.C, t);
|
|
3098
3116
|
}))
|
|
3099
|
-
}, [ 4 /*yield*/ , e.
|
|
3117
|
+
}, [ 4 /*yield*/ , e.R("BatchGetDocuments", i, o, r.length) ];
|
|
3100
3118
|
|
|
3101
3119
|
case 1:
|
|
3102
3120
|
return a = n.sent(), s = new Map, a.forEach((function(t) {
|
|
3103
3121
|
var n = function(t, e) {
|
|
3104
3122
|
return "found" in e ? function(t, e) {
|
|
3105
|
-
|
|
3106
|
-
var n = Ue(t, e.found.name), r = Le(e.found.updateTime), i = new
|
|
3123
|
+
k(!!e.found), e.found.name, e.found.updateTime;
|
|
3124
|
+
var n = Ue(t, e.found.name), r = Le(e.found.updateTime), i = new Xt({
|
|
3107
3125
|
mapValue: {
|
|
3108
3126
|
fields: e.found.fields
|
|
3109
3127
|
}
|
|
3110
3128
|
});
|
|
3111
|
-
return
|
|
3129
|
+
return Jt.newFoundDocument(n, r, i);
|
|
3112
3130
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
3113
|
-
|
|
3131
|
+
k(!!e.missing), k(!!e.readTime);
|
|
3114
3132
|
var n = Ue(t, e.missing), r = Le(e.readTime);
|
|
3115
|
-
return
|
|
3133
|
+
return Jt.newNoDocument(n, r);
|
|
3116
3134
|
}(t, e) : E();
|
|
3117
|
-
}(e.
|
|
3135
|
+
}(e.C, t);
|
|
3118
3136
|
s.set(n.key.toString(), n);
|
|
3119
3137
|
})), u = [], [ 2 /*return*/ , (r.forEach((function(t) {
|
|
3120
3138
|
var e = s.get(t.toString());
|
|
3121
|
-
|
|
3139
|
+
k(!!e), u.push(e);
|
|
3122
3140
|
})), u) ];
|
|
3123
3141
|
}
|
|
3124
3142
|
}));
|
|
@@ -3131,7 +3149,7 @@ function en(t, r) {
|
|
|
3131
3149
|
return n(this, (function(n) {
|
|
3132
3150
|
switch (n.label) {
|
|
3133
3151
|
case 0:
|
|
3134
|
-
return e =
|
|
3152
|
+
return e = S(t), i = function(t, e) {
|
|
3135
3153
|
// Dissect the path into parent, collectionId, and optional key filter.
|
|
3136
3154
|
var n = {
|
|
3137
3155
|
structuredQuery: {}
|
|
@@ -3148,36 +3166,36 @@ function en(t, r) {
|
|
|
3148
3166
|
// visible for testing
|
|
3149
3167
|
return function(t) {
|
|
3150
3168
|
if ("==" /* EQUAL */ === t.op) {
|
|
3151
|
-
if (
|
|
3169
|
+
if (Qt(t.value)) return {
|
|
3152
3170
|
unaryFilter: {
|
|
3153
|
-
field:
|
|
3171
|
+
field: Qe(t.field),
|
|
3154
3172
|
op: "IS_NAN"
|
|
3155
3173
|
}
|
|
3156
3174
|
};
|
|
3157
|
-
if (
|
|
3175
|
+
if (Wt(t.value)) return {
|
|
3158
3176
|
unaryFilter: {
|
|
3159
|
-
field:
|
|
3177
|
+
field: Qe(t.field),
|
|
3160
3178
|
op: "IS_NULL"
|
|
3161
3179
|
}
|
|
3162
3180
|
};
|
|
3163
3181
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
3164
|
-
if (
|
|
3182
|
+
if (Qt(t.value)) return {
|
|
3165
3183
|
unaryFilter: {
|
|
3166
|
-
field:
|
|
3184
|
+
field: Qe(t.field),
|
|
3167
3185
|
op: "IS_NOT_NAN"
|
|
3168
3186
|
}
|
|
3169
3187
|
};
|
|
3170
|
-
if (
|
|
3188
|
+
if (Wt(t.value)) return {
|
|
3171
3189
|
unaryFilter: {
|
|
3172
|
-
field:
|
|
3190
|
+
field: Qe(t.field),
|
|
3173
3191
|
op: "IS_NOT_NULL"
|
|
3174
3192
|
}
|
|
3175
3193
|
};
|
|
3176
3194
|
}
|
|
3177
3195
|
return {
|
|
3178
3196
|
fieldFilter: {
|
|
3179
|
-
field:
|
|
3180
|
-
op:
|
|
3197
|
+
field: Qe(t.field),
|
|
3198
|
+
op: We(t.op),
|
|
3181
3199
|
value: t.value
|
|
3182
3200
|
}
|
|
3183
3201
|
};
|
|
@@ -3197,7 +3215,7 @@ function en(t, r) {
|
|
|
3197
3215
|
// visible for testing
|
|
3198
3216
|
return function(t) {
|
|
3199
3217
|
return {
|
|
3200
|
-
field:
|
|
3218
|
+
field: Qe(t.field),
|
|
3201
3219
|
direction: Ke(t.dir)
|
|
3202
3220
|
};
|
|
3203
3221
|
}(t);
|
|
@@ -3205,7 +3223,7 @@ function en(t, r) {
|
|
|
3205
3223
|
}(e.orderBy);
|
|
3206
3224
|
o && (n.structuredQuery.orderBy = o);
|
|
3207
3225
|
var a, s = function(t, e) {
|
|
3208
|
-
return t.
|
|
3226
|
+
return t.k || ct(e) ? e : {
|
|
3209
3227
|
value: e
|
|
3210
3228
|
};
|
|
3211
3229
|
}(t, e.limit);
|
|
@@ -3218,7 +3236,7 @@ function en(t, r) {
|
|
|
3218
3236
|
values: t.position
|
|
3219
3237
|
};
|
|
3220
3238
|
}(e.endAt)), n;
|
|
3221
|
-
}(e.
|
|
3239
|
+
}(e.C, ge(r)), [ 4 /*yield*/ , e.R("RunQuery", i.parent, {
|
|
3222
3240
|
structuredQuery: i.structuredQuery
|
|
3223
3241
|
}) ];
|
|
3224
3242
|
|
|
@@ -3227,13 +3245,13 @@ function en(t, r) {
|
|
|
3227
3245
|
return !!t.document;
|
|
3228
3246
|
})).map((function(t) {
|
|
3229
3247
|
return function(t, e, n) {
|
|
3230
|
-
var r = Ue(t, e.name), i = Le(e.updateTime), o = new
|
|
3248
|
+
var r = Ue(t, e.name), i = Le(e.updateTime), o = new Xt({
|
|
3231
3249
|
mapValue: {
|
|
3232
3250
|
fields: e.fields
|
|
3233
3251
|
}
|
|
3234
|
-
}), a =
|
|
3252
|
+
}), a = Jt.newFoundDocument(r, i, o);
|
|
3235
3253
|
return a;
|
|
3236
|
-
}(e.
|
|
3254
|
+
}(e.C, t.document);
|
|
3237
3255
|
})) ];
|
|
3238
3256
|
}
|
|
3239
3257
|
}));
|
|
@@ -3266,14 +3284,14 @@ function en(t, r) {
|
|
|
3266
3284
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
3267
3285
|
* instance is terminated.
|
|
3268
3286
|
*/ function rn(t) {
|
|
3269
|
-
if (t._terminated) throw new M(
|
|
3287
|
+
if (t._terminated) throw new M(R, "The client has already been terminated.");
|
|
3270
3288
|
if (!nn.has(t)) {
|
|
3271
3289
|
w("ComponentProvider", "Initializing Datastore");
|
|
3272
3290
|
var e = function(t) {
|
|
3273
3291
|
return new yt(t, fetch.bind(null));
|
|
3274
3292
|
}((i = t._databaseId, o = t.app.options.appId || "", a = t._persistenceKey, s = t._freezeSettings(),
|
|
3275
|
-
new
|
|
3276
|
-
return new
|
|
3293
|
+
new X(i, o, a, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), n = Xe(t._databaseId), r = function(t, e, n, r) {
|
|
3294
|
+
return new Ze(t, e, n, r);
|
|
3277
3295
|
}(t._authCredentials, t._appCheckCredentials, e, n);
|
|
3278
3296
|
nn.set(t, r);
|
|
3279
3297
|
}
|
|
@@ -3332,10 +3350,10 @@ function en(t, r) {
|
|
|
3332
3350
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
3333
3351
|
*/
|
|
3334
3352
|
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new on({}),
|
|
3335
|
-
this._settingsFrozen = !1, t instanceof
|
|
3353
|
+
this._settingsFrozen = !1, t instanceof J ? this._databaseId = t : (this._app = t,
|
|
3336
3354
|
this._databaseId = function(t) {
|
|
3337
3355
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new M(V, '"projectId" not provided in firebase.initializeApp.');
|
|
3338
|
-
return new
|
|
3356
|
+
return new J(t.options.projectId);
|
|
3339
3357
|
}(t));
|
|
3340
3358
|
}
|
|
3341
3359
|
return Object.defineProperty(t.prototype, "app", {
|
|
@@ -3344,7 +3362,7 @@ function en(t, r) {
|
|
|
3344
3362
|
* instance.
|
|
3345
3363
|
*/
|
|
3346
3364
|
get: function() {
|
|
3347
|
-
if (!this._app) throw new M(
|
|
3365
|
+
if (!this._app) throw new M(R, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
3348
3366
|
return this._app;
|
|
3349
3367
|
},
|
|
3350
3368
|
enumerable: !1,
|
|
@@ -3362,15 +3380,13 @@ function en(t, r) {
|
|
|
3362
3380
|
enumerable: !1,
|
|
3363
3381
|
configurable: !0
|
|
3364
3382
|
}), t.prototype._setSettings = function(t) {
|
|
3365
|
-
if (this._settingsFrozen) throw new M(
|
|
3383
|
+
if (this._settingsFrozen) throw new M(R, "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.");
|
|
3366
3384
|
this._settings = new on(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
3367
|
-
if (!t) return new
|
|
3385
|
+
if (!t) return new G;
|
|
3368
3386
|
switch (t.type) {
|
|
3369
3387
|
case "gapi":
|
|
3370
3388
|
var e = t.client;
|
|
3371
|
-
|
|
3372
|
-
return S(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
|
|
3373
|
-
new W(e, t.sessionIndex || "0", t.iamToken || null);
|
|
3389
|
+
return new Q(e, t.sessionIndex || "0", t.iamToken || null, t.authTokenFactory || null);
|
|
3374
3390
|
|
|
3375
3391
|
case "provider":
|
|
3376
3392
|
return t.client;
|
|
@@ -3429,7 +3445,7 @@ function en(t, r) {
|
|
|
3429
3445
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3430
3446
|
*/ function sn(t, e) {
|
|
3431
3447
|
var n = _getProvider(t, "firestore/lite");
|
|
3432
|
-
if (n.isInitialized()) throw new M(
|
|
3448
|
+
if (n.isInitialized()) throw new M(R, "Firestore can only be initialized once per app.");
|
|
3433
3449
|
return n.initialize({
|
|
3434
3450
|
options: e
|
|
3435
3451
|
});
|
|
@@ -3477,7 +3493,7 @@ function en(t, r) {
|
|
|
3477
3493
|
if (!u) throw new M(V, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
3478
3494
|
s = new y(u);
|
|
3479
3495
|
}
|
|
3480
|
-
t._authCredentials = new
|
|
3496
|
+
t._authCredentials = new z(new B(a, s));
|
|
3481
3497
|
}
|
|
3482
3498
|
}
|
|
3483
3499
|
|
|
@@ -3651,11 +3667,11 @@ var fn = /** @class */ function() {
|
|
|
3651
3667
|
*/ function dn(t, e) {
|
|
3652
3668
|
for (var n = [], i = 2; i < arguments.length; i++) n[i - 2] = arguments[i];
|
|
3653
3669
|
if (t = p(t), rt("collection", "path", e), t instanceof an) {
|
|
3654
|
-
var o =
|
|
3670
|
+
var o = $.fromString.apply($, r([ e ], n));
|
|
3655
3671
|
return ot(o), new pn(t, /* converter= */ null, o);
|
|
3656
3672
|
}
|
|
3657
3673
|
if (!(t instanceof fn || t instanceof pn)) throw new M(V, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3658
|
-
var a = t._path.child(
|
|
3674
|
+
var a = t._path.child($.fromString.apply($, r([ e ], n)));
|
|
3659
3675
|
return ot(a), new pn(t.firestore,
|
|
3660
3676
|
/* converter= */ null, a);
|
|
3661
3677
|
}
|
|
@@ -3681,7 +3697,7 @@ var fn = /** @class */ function() {
|
|
|
3681
3697
|
* within the provided collection group.
|
|
3682
3698
|
*/
|
|
3683
3699
|
function(t) {
|
|
3684
|
-
return new pe(
|
|
3700
|
+
return new pe($.emptyPath(), t);
|
|
3685
3701
|
}(e));
|
|
3686
3702
|
}
|
|
3687
3703
|
|
|
@@ -3690,13 +3706,13 @@ function mn(t, e) {
|
|
|
3690
3706
|
if (t = p(t),
|
|
3691
3707
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3692
3708
|
// 'undefined' and 'null'.
|
|
3693
|
-
1 === arguments.length && (e = vt.
|
|
3694
|
-
var o =
|
|
3709
|
+
1 === arguments.length && (e = vt.N()), rt("doc", "path", e), t instanceof an) {
|
|
3710
|
+
var o = $.fromString.apply($, r([ e ], n));
|
|
3695
3711
|
return it(o), new fn(t,
|
|
3696
3712
|
/* converter= */ null, new nt(o));
|
|
3697
3713
|
}
|
|
3698
3714
|
if (!(t instanceof fn || t instanceof pn)) throw new M(V, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3699
|
-
var a = t._path.child(
|
|
3715
|
+
var a = t._path.child($.fromString.apply($, r([ e ], n)));
|
|
3700
3716
|
return it(a), new fn(t.firestore, t instanceof pn ? t.converter : null, new nt(a));
|
|
3701
3717
|
}
|
|
3702
3718
|
|
|
@@ -3818,7 +3834,7 @@ var wn = /** @class */ function() {
|
|
|
3818
3834
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3819
3835
|
*/ return t.fromBase64String = function(e) {
|
|
3820
3836
|
try {
|
|
3821
|
-
return new t(
|
|
3837
|
+
return new t(Dt.fromBase64String(e));
|
|
3822
3838
|
} catch (e) {
|
|
3823
3839
|
throw new M(V, "Failed to construct data from Base64 string: " + e);
|
|
3824
3840
|
}
|
|
@@ -3829,7 +3845,7 @@ var wn = /** @class */ function() {
|
|
|
3829
3845
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3830
3846
|
*/
|
|
3831
3847
|
t.fromUint8Array = function(e) {
|
|
3832
|
-
return new t(
|
|
3848
|
+
return new t(Dt.fromUint8Array(e));
|
|
3833
3849
|
},
|
|
3834
3850
|
/**
|
|
3835
3851
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3924,12 +3940,12 @@ function(t) {
|
|
|
3924
3940
|
t.prototype._compareTo = function(t) {
|
|
3925
3941
|
return gt(this._lat, t._lat) || gt(this._long, t._long);
|
|
3926
3942
|
}, t;
|
|
3927
|
-
}(),
|
|
3943
|
+
}(), kn = /^__.*__$/, Sn = /** @class */ function() {
|
|
3928
3944
|
function t(t, e, n) {
|
|
3929
3945
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3930
3946
|
}
|
|
3931
3947
|
return t.prototype.toMutation = function(t, e) {
|
|
3932
|
-
return null !== this.fieldMask ? new
|
|
3948
|
+
return null !== this.fieldMask ? new Pe(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Ve(t, this.data, e, this.fieldTransforms);
|
|
3933
3949
|
}, t;
|
|
3934
3950
|
}(), In = /** @class */ function() {
|
|
3935
3951
|
function t(t,
|
|
@@ -3938,7 +3954,7 @@ function(t) {
|
|
|
3938
3954
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3939
3955
|
}
|
|
3940
3956
|
return t.prototype.toMutation = function(t, e) {
|
|
3941
|
-
return new
|
|
3957
|
+
return new Pe(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
3942
3958
|
}, t;
|
|
3943
3959
|
}();
|
|
3944
3960
|
|
|
@@ -3999,10 +4015,10 @@ function(t) {
|
|
|
3999
4015
|
* compromised).
|
|
4000
4016
|
*/
|
|
4001
4017
|
function t(t, e, n, r, i, o) {
|
|
4002
|
-
this.settings = t, this.databaseId = e, this.
|
|
4018
|
+
this.settings = t, this.databaseId = e, this.C = n, this.ignoreUndefinedProperties = r,
|
|
4003
4019
|
// Minor hack: If fieldTransforms is undefined, we assume this is an
|
|
4004
4020
|
// external call and we need to validate the entire path.
|
|
4005
|
-
void 0 === i && this.
|
|
4021
|
+
void 0 === i && this.nt(), this.fieldTransforms = i || [], this.fieldMask = o || [];
|
|
4006
4022
|
}
|
|
4007
4023
|
return Object.defineProperty(t.prototype, "path", {
|
|
4008
4024
|
get: function() {
|
|
@@ -4010,36 +4026,36 @@ function(t) {
|
|
|
4010
4026
|
},
|
|
4011
4027
|
enumerable: !1,
|
|
4012
4028
|
configurable: !0
|
|
4013
|
-
}), Object.defineProperty(t.prototype, "
|
|
4029
|
+
}), Object.defineProperty(t.prototype, "rt", {
|
|
4014
4030
|
get: function() {
|
|
4015
|
-
return this.settings.
|
|
4031
|
+
return this.settings.rt;
|
|
4016
4032
|
},
|
|
4017
4033
|
enumerable: !1,
|
|
4018
4034
|
configurable: !0
|
|
4019
4035
|
}),
|
|
4020
|
-
/** Returns a new context with the specified settings overwritten. */ t.prototype.
|
|
4021
|
-
return new t(Object.assign(Object.assign({}, this.settings), e), this.databaseId, this.
|
|
4022
|
-
}, t.prototype.
|
|
4023
|
-
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
4036
|
+
/** Returns a new context with the specified settings overwritten. */ t.prototype.st = function(e) {
|
|
4037
|
+
return new t(Object.assign(Object.assign({}, this.settings), e), this.databaseId, this.C, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
4038
|
+
}, t.prototype.it = function(t) {
|
|
4039
|
+
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.st({
|
|
4024
4040
|
path: n,
|
|
4025
|
-
|
|
4041
|
+
ot: !1
|
|
4026
4042
|
});
|
|
4027
|
-
return r.
|
|
4028
|
-
}, t.prototype.
|
|
4029
|
-
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
4043
|
+
return r.ut(t), r;
|
|
4044
|
+
}, t.prototype.ct = function(t) {
|
|
4045
|
+
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.st({
|
|
4030
4046
|
path: n,
|
|
4031
|
-
|
|
4047
|
+
ot: !1
|
|
4032
4048
|
});
|
|
4033
|
-
return r.
|
|
4034
|
-
}, t.prototype.
|
|
4049
|
+
return r.nt(), r;
|
|
4050
|
+
}, t.prototype.at = function(t) {
|
|
4035
4051
|
// TODO(b/34871131): We don't support array paths right now; so make path
|
|
4036
4052
|
// undefined.
|
|
4037
|
-
return this.
|
|
4053
|
+
return this.st({
|
|
4038
4054
|
path: void 0,
|
|
4039
|
-
|
|
4055
|
+
ot: !0
|
|
4040
4056
|
});
|
|
4041
|
-
}, t.prototype.
|
|
4042
|
-
return Hn(t, this.settings.methodName, this.settings.
|
|
4057
|
+
}, t.prototype.ht = function(t) {
|
|
4058
|
+
return Hn(t, this.settings.methodName, this.settings.lt || !1, this.path, this.settings.ft);
|
|
4043
4059
|
},
|
|
4044
4060
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ t.prototype.contains = function(t) {
|
|
4045
4061
|
return void 0 !== this.fieldMask.find((function(e) {
|
|
@@ -4047,55 +4063,55 @@ function(t) {
|
|
|
4047
4063
|
})) || void 0 !== this.fieldTransforms.find((function(e) {
|
|
4048
4064
|
return t.isPrefixOf(e.field);
|
|
4049
4065
|
}));
|
|
4050
|
-
}, t.prototype.
|
|
4066
|
+
}, t.prototype.nt = function() {
|
|
4051
4067
|
// TODO(b/34871131): Remove null check once we have proper paths for fields
|
|
4052
4068
|
// within arrays.
|
|
4053
|
-
if (this.path) for (var t = 0; t < this.path.length; t++) this.
|
|
4054
|
-
}, t.prototype.
|
|
4055
|
-
if (0 === t.length) throw this.
|
|
4056
|
-
if (An(this.
|
|
4069
|
+
if (this.path) for (var t = 0; t < this.path.length; t++) this.ut(this.path.get(t));
|
|
4070
|
+
}, t.prototype.ut = function(t) {
|
|
4071
|
+
if (0 === t.length) throw this.ht("Document fields must not be empty");
|
|
4072
|
+
if (An(this.rt) && kn.test(t)) throw this.ht('Document fields cannot begin and end with "__"');
|
|
4057
4073
|
}, t;
|
|
4058
|
-
}(),
|
|
4074
|
+
}(), Pn = /** @class */ function() {
|
|
4059
4075
|
function t(t, e, n) {
|
|
4060
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.
|
|
4076
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.C = n || Xe(t)
|
|
4061
4077
|
/** Creates a new top-level parse context. */;
|
|
4062
4078
|
}
|
|
4063
|
-
return t.prototype.
|
|
4079
|
+
return t.prototype.dt = function(t, e, n, r) {
|
|
4064
4080
|
return void 0 === r && (r = !1), new Vn({
|
|
4065
|
-
|
|
4081
|
+
rt: t,
|
|
4066
4082
|
methodName: e,
|
|
4067
|
-
|
|
4083
|
+
ft: n,
|
|
4068
4084
|
path: et.emptyPath(),
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
}, this.databaseId, this.
|
|
4085
|
+
ot: !1,
|
|
4086
|
+
lt: r
|
|
4087
|
+
}, this.databaseId, this.C, this.ignoreUndefinedProperties);
|
|
4072
4088
|
}, t;
|
|
4073
4089
|
}();
|
|
4074
4090
|
|
|
4075
4091
|
/**
|
|
4076
4092
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
4077
4093
|
* classes.
|
|
4078
|
-
*/ function
|
|
4079
|
-
var e = t._freezeSettings(), n =
|
|
4080
|
-
return new
|
|
4094
|
+
*/ function Dn(t) {
|
|
4095
|
+
var e = t._freezeSettings(), n = Xe(t._databaseId);
|
|
4096
|
+
return new Pn(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
4081
4097
|
}
|
|
4082
4098
|
|
|
4083
4099
|
/** Parse document data from a set() call. */ function Nn(t, e, n, r, i, o) {
|
|
4084
4100
|
void 0 === o && (o = {});
|
|
4085
|
-
var a = t.
|
|
4086
|
-
|
|
4101
|
+
var a = t.dt(o.merge || o.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
|
|
4102
|
+
zn("Data must be an object, but it was:", a, r);
|
|
4087
4103
|
var s, u, c = Bn(r, a);
|
|
4088
|
-
if (o.merge) s = new
|
|
4104
|
+
if (o.merge) s = new Pt(a.fieldMask), u = a.fieldTransforms; else if (o.mergeFields) {
|
|
4089
4105
|
for (var l = [], f = 0, h = o.mergeFields; f < h.length; f++) {
|
|
4090
4106
|
var p = Kn(e, h[f], n);
|
|
4091
4107
|
if (!a.contains(p)) throw new M(V, "Field '" + p + "' is specified in your field mask but missing from your input data.");
|
|
4092
4108
|
Yn(l, p) || l.push(p);
|
|
4093
4109
|
}
|
|
4094
|
-
s = new
|
|
4110
|
+
s = new Pt(l), u = a.fieldTransforms.filter((function(t) {
|
|
4095
4111
|
return s.covers(t.field);
|
|
4096
4112
|
}));
|
|
4097
4113
|
} else s = null, u = a.fieldTransforms;
|
|
4098
|
-
return new
|
|
4114
|
+
return new Sn(new Xt(c), s, u);
|
|
4099
4115
|
}
|
|
4100
4116
|
|
|
4101
4117
|
var Fn = /** @class */ function(e) {
|
|
@@ -4103,7 +4119,7 @@ var Fn = /** @class */ function(e) {
|
|
|
4103
4119
|
return null !== e && e.apply(this, arguments) || this;
|
|
4104
4120
|
}
|
|
4105
4121
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
4106
|
-
if (2 /* MergeSet */ !== t.
|
|
4122
|
+
if (2 /* MergeSet */ !== t.rt) throw 1 /* Update */ === t.rt ? t.ht(this._methodName + "() can only appear at the top level of your update data") : t.ht(this._methodName + "() cannot be used with set() unless you pass {merge:true}");
|
|
4107
4123
|
// No transform to add for a delete, but we need to add it to our
|
|
4108
4124
|
// fieldMask so it gets deleted.
|
|
4109
4125
|
return t.fieldMask.push(t.path), null;
|
|
@@ -4129,60 +4145,60 @@ var Fn = /** @class */ function(e) {
|
|
|
4129
4145
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4130
4146
|
*/ function On(t, e, n) {
|
|
4131
4147
|
return new Vn({
|
|
4132
|
-
|
|
4133
|
-
|
|
4148
|
+
rt: 3 /* Argument */ ,
|
|
4149
|
+
ft: e.settings.ft,
|
|
4134
4150
|
methodName: t._methodName,
|
|
4135
|
-
|
|
4136
|
-
}, e.databaseId, e.
|
|
4151
|
+
ot: n
|
|
4152
|
+
}, e.databaseId, e.C, e.ignoreUndefinedProperties);
|
|
4137
4153
|
}
|
|
4138
4154
|
|
|
4139
|
-
var
|
|
4155
|
+
var Rn = /** @class */ function(e) {
|
|
4140
4156
|
function n() {
|
|
4141
4157
|
return null !== e && e.apply(this, arguments) || this;
|
|
4142
4158
|
}
|
|
4143
4159
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
4144
|
-
return new
|
|
4160
|
+
return new Se(t.path, new _e);
|
|
4145
4161
|
}, n.prototype.isEqual = function(t) {
|
|
4146
4162
|
return t instanceof n;
|
|
4147
4163
|
}, n;
|
|
4148
|
-
}(Tn),
|
|
4164
|
+
}(Tn), qn = /** @class */ function(e) {
|
|
4149
4165
|
function n(t, n) {
|
|
4150
4166
|
var r = this;
|
|
4151
|
-
return (r = e.call(this, t) || this).
|
|
4167
|
+
return (r = e.call(this, t) || this).wt = n, r;
|
|
4152
4168
|
}
|
|
4153
4169
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
4154
4170
|
var e = On(this, t,
|
|
4155
|
-
/*array=*/ !0), n = this.
|
|
4171
|
+
/*array=*/ !0), n = this.wt.map((function(t) {
|
|
4156
4172
|
return Un(t, e);
|
|
4157
4173
|
})), r = new Te(n);
|
|
4158
|
-
return new
|
|
4174
|
+
return new Se(t.path, r);
|
|
4159
4175
|
}, n.prototype.isEqual = function(t) {
|
|
4160
4176
|
// TODO(mrschmidt): Implement isEquals
|
|
4161
4177
|
return this === t;
|
|
4162
4178
|
}, n;
|
|
4163
|
-
}(Tn),
|
|
4179
|
+
}(Tn), Cn = /** @class */ function(e) {
|
|
4164
4180
|
function n(t, n) {
|
|
4165
4181
|
var r = this;
|
|
4166
|
-
return (r = e.call(this, t) || this).
|
|
4182
|
+
return (r = e.call(this, t) || this).wt = n, r;
|
|
4167
4183
|
}
|
|
4168
4184
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
4169
4185
|
var e = On(this, t,
|
|
4170
|
-
/*array=*/ !0), n = this.
|
|
4186
|
+
/*array=*/ !0), n = this.wt.map((function(t) {
|
|
4171
4187
|
return Un(t, e);
|
|
4172
4188
|
})), r = new Ee(n);
|
|
4173
|
-
return new
|
|
4189
|
+
return new Se(t.path, r);
|
|
4174
4190
|
}, n.prototype.isEqual = function(t) {
|
|
4175
4191
|
// TODO(mrschmidt): Implement isEquals
|
|
4176
4192
|
return this === t;
|
|
4177
4193
|
}, n;
|
|
4178
|
-
}(Tn),
|
|
4194
|
+
}(Tn), xn = /** @class */ function(e) {
|
|
4179
4195
|
function n(t, n) {
|
|
4180
4196
|
var r = this;
|
|
4181
|
-
return (r = e.call(this, t) || this).
|
|
4197
|
+
return (r = e.call(this, t) || this).yt = n, r;
|
|
4182
4198
|
}
|
|
4183
4199
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
4184
|
-
var e = new
|
|
4185
|
-
return new
|
|
4200
|
+
var e = new ke(t.C, we(t.C, this.yt));
|
|
4201
|
+
return new Se(t.path, e);
|
|
4186
4202
|
}, n.prototype.isEqual = function(t) {
|
|
4187
4203
|
// TODO(mrschmidt): Implement isEquals
|
|
4188
4204
|
return this === t;
|
|
@@ -4190,15 +4206,15 @@ var qn = /** @class */ function(e) {
|
|
|
4190
4206
|
}(Tn);
|
|
4191
4207
|
|
|
4192
4208
|
/** Parse update data from an update() call. */ function Ln(t, e, n, r) {
|
|
4193
|
-
var i = t.
|
|
4194
|
-
|
|
4195
|
-
var o = [], a =
|
|
4209
|
+
var i = t.dt(1 /* Update */ , e, n);
|
|
4210
|
+
zn("Data must be an object, but it was:", i, r);
|
|
4211
|
+
var o = [], a = Xt.empty();
|
|
4196
4212
|
Et(r, (function(t, r) {
|
|
4197
|
-
var s =
|
|
4213
|
+
var s = Qn(e, t, n);
|
|
4198
4214
|
// For Compat types, we have to "extract" the underlying types before
|
|
4199
4215
|
// performing validation.
|
|
4200
4216
|
r = p(r);
|
|
4201
|
-
var u = i.
|
|
4217
|
+
var u = i.ct(s);
|
|
4202
4218
|
if (r instanceof Fn)
|
|
4203
4219
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4204
4220
|
o.push(s); else {
|
|
@@ -4206,22 +4222,22 @@ var qn = /** @class */ function(e) {
|
|
|
4206
4222
|
null != c && (o.push(s), a.set(s, c));
|
|
4207
4223
|
}
|
|
4208
4224
|
}));
|
|
4209
|
-
var s = new
|
|
4225
|
+
var s = new Pt(o);
|
|
4210
4226
|
return new In(a, s, i.fieldTransforms);
|
|
4211
4227
|
}
|
|
4212
4228
|
|
|
4213
4229
|
/** Parse update data from a list of field/value arguments. */ function jn(t, e, n, r, i, o) {
|
|
4214
|
-
var a = t.
|
|
4230
|
+
var a = t.dt(1 /* Update */ , e, n), s = [ Kn(e, r, n) ], u = [ i ];
|
|
4215
4231
|
if (o.length % 2 != 0) throw new M(V, "Function " + e + "() needs to be called with an even number of arguments that alternate between field names and values.");
|
|
4216
4232
|
for (var c = 0; c < o.length; c += 2) s.push(Kn(e, o[c])), u.push(o[c + 1]);
|
|
4217
4233
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4218
4234
|
// user specified the field multiple times.
|
|
4219
|
-
for (var l = [], f =
|
|
4235
|
+
for (var l = [], f = Xt.empty(), h = s.length - 1; h >= 0; --h) if (!Yn(l, s[h])) {
|
|
4220
4236
|
var d = s[h], y = u[h];
|
|
4221
4237
|
// For Compat types, we have to "extract" the underlying types before
|
|
4222
4238
|
// performing validation.
|
|
4223
4239
|
y = p(y);
|
|
4224
|
-
var m = a.
|
|
4240
|
+
var m = a.ct(d);
|
|
4225
4241
|
if (y instanceof Fn)
|
|
4226
4242
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4227
4243
|
l.push(d); else {
|
|
@@ -4229,7 +4245,7 @@ var qn = /** @class */ function(e) {
|
|
|
4229
4245
|
null != v && (l.push(d), f.set(d, v));
|
|
4230
4246
|
}
|
|
4231
4247
|
}
|
|
4232
|
-
var g = new
|
|
4248
|
+
var g = new Pt(l);
|
|
4233
4249
|
return new In(f, g, a.fieldTransforms);
|
|
4234
4250
|
}
|
|
4235
4251
|
|
|
@@ -4240,7 +4256,7 @@ var qn = /** @class */ function(e) {
|
|
|
4240
4256
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4241
4257
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4242
4258
|
*/ function Mn(t, e, n, r) {
|
|
4243
|
-
return void 0 === r && (r = !1), Un(n, t.
|
|
4259
|
+
return void 0 === r && (r = !1), Un(n, t.dt(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
4244
4260
|
}
|
|
4245
4261
|
|
|
4246
4262
|
/**
|
|
@@ -4252,10 +4268,10 @@ var qn = /** @class */ function(e) {
|
|
|
4252
4268
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
4253
4269
|
* that should not be included in the resulting parsed data.
|
|
4254
4270
|
*/ function Un(t, e) {
|
|
4255
|
-
if (
|
|
4271
|
+
if (Gn(
|
|
4256
4272
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4257
4273
|
// from firestore-exp.
|
|
4258
|
-
t = p(t))) return
|
|
4274
|
+
t = p(t))) return zn("Unsupported field value:", e, t), Bn(t, e);
|
|
4259
4275
|
if (t instanceof Tn)
|
|
4260
4276
|
// FieldValues usually parse into transforms (except deleteField())
|
|
4261
4277
|
// in which case we do not want to include this field in our parsed data
|
|
@@ -4268,8 +4284,8 @@ var qn = /** @class */ function(e) {
|
|
|
4268
4284
|
*/
|
|
4269
4285
|
return function(t, e) {
|
|
4270
4286
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4271
|
-
if (!An(e.
|
|
4272
|
-
if (!e.path) throw e.
|
|
4287
|
+
if (!An(e.rt)) throw e.ht(t._methodName + "() can only be used with update() and set()");
|
|
4288
|
+
if (!e.path) throw e.ht(t._methodName + "() is not currently supported inside arrays");
|
|
4273
4289
|
var n = t._toFieldTransform(e);
|
|
4274
4290
|
n && e.fieldTransforms.push(n);
|
|
4275
4291
|
}(t, e), null;
|
|
@@ -4288,10 +4304,10 @@ var qn = /** @class */ function(e) {
|
|
|
4288
4304
|
// the set of values to be included for the IN query) that may directly
|
|
4289
4305
|
// contain additional arrays (each representing an individual field
|
|
4290
4306
|
// value), so we disable this validation.
|
|
4291
|
-
if (e.settings.
|
|
4307
|
+
if (e.settings.ot && 4 /* ArrayArgument */ !== e.rt) throw e.ht("Nested arrays are not supported");
|
|
4292
4308
|
return function(t, e) {
|
|
4293
4309
|
for (var n = [], r = 0, i = 0, o = t; i < o.length; i++) {
|
|
4294
|
-
var a = Un(o[i], e.
|
|
4310
|
+
var a = Un(o[i], e.at(r));
|
|
4295
4311
|
null == a && (
|
|
4296
4312
|
// Just include nulls in the array for fields being replaced with a
|
|
4297
4313
|
// sentinel.
|
|
@@ -4310,7 +4326,7 @@ var qn = /** @class */ function(e) {
|
|
|
4310
4326
|
if (null === (t = p(t))) return {
|
|
4311
4327
|
nullValue: "NULL_VALUE"
|
|
4312
4328
|
};
|
|
4313
|
-
if ("number" == typeof t) return we(e.
|
|
4329
|
+
if ("number" == typeof t) return we(e.C, t);
|
|
4314
4330
|
if ("boolean" == typeof t) return {
|
|
4315
4331
|
booleanValue: t
|
|
4316
4332
|
};
|
|
@@ -4320,7 +4336,7 @@ var qn = /** @class */ function(e) {
|
|
|
4320
4336
|
if (t instanceof Date) {
|
|
4321
4337
|
var n = bt.fromDate(t);
|
|
4322
4338
|
return {
|
|
4323
|
-
timestampValue:
|
|
4339
|
+
timestampValue: qe(e.C, n)
|
|
4324
4340
|
};
|
|
4325
4341
|
}
|
|
4326
4342
|
if (t instanceof bt) {
|
|
@@ -4329,7 +4345,7 @@ var qn = /** @class */ function(e) {
|
|
|
4329
4345
|
// truncation immediately without waiting for the backend to do that.
|
|
4330
4346
|
var r = new bt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
4331
4347
|
return {
|
|
4332
|
-
timestampValue:
|
|
4348
|
+
timestampValue: qe(e.C, r)
|
|
4333
4349
|
};
|
|
4334
4350
|
}
|
|
4335
4351
|
if (t instanceof En) return {
|
|
@@ -4339,16 +4355,16 @@ var qn = /** @class */ function(e) {
|
|
|
4339
4355
|
}
|
|
4340
4356
|
};
|
|
4341
4357
|
if (t instanceof _n) return {
|
|
4342
|
-
bytesValue:
|
|
4358
|
+
bytesValue: Ce(e.C, t._byteString)
|
|
4343
4359
|
};
|
|
4344
4360
|
if (t instanceof fn) {
|
|
4345
4361
|
var i = e.databaseId, o = t.firestore._databaseId;
|
|
4346
|
-
if (!o.isEqual(i)) throw e.
|
|
4362
|
+
if (!o.isEqual(i)) throw e.ht("Document reference is for database " + o.projectId + "/" + o.database + " but should be for database " + i.projectId + "/" + i.database);
|
|
4347
4363
|
return {
|
|
4348
4364
|
referenceValue: je(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
4349
4365
|
};
|
|
4350
4366
|
}
|
|
4351
|
-
throw e.
|
|
4367
|
+
throw e.ht("Unsupported field value: " + at(t));
|
|
4352
4368
|
}(t, e);
|
|
4353
4369
|
}
|
|
4354
4370
|
|
|
@@ -4361,7 +4377,7 @@ function Bn(t, e) {
|
|
|
4361
4377
|
// If we encounter an empty object, we explicitly add it to the update
|
|
4362
4378
|
// mask to ensure that the server creates a map entry.
|
|
4363
4379
|
e.path && e.path.length > 0 && e.fieldMask.push(e.path) : Et(t, (function(t, r) {
|
|
4364
|
-
var i = Un(r, e.
|
|
4380
|
+
var i = Un(r, e.it(t));
|
|
4365
4381
|
null != i && (n[t] = i);
|
|
4366
4382
|
})), {
|
|
4367
4383
|
mapValue: {
|
|
@@ -4370,16 +4386,16 @@ function Bn(t, e) {
|
|
|
4370
4386
|
};
|
|
4371
4387
|
}
|
|
4372
4388
|
|
|
4373
|
-
function
|
|
4389
|
+
function Gn(t) {
|
|
4374
4390
|
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof bt || t instanceof En || t instanceof _n || t instanceof fn || t instanceof Tn);
|
|
4375
4391
|
}
|
|
4376
4392
|
|
|
4377
|
-
function
|
|
4378
|
-
if (!
|
|
4393
|
+
function zn(t, e, n) {
|
|
4394
|
+
if (!Gn(n) || !function(t) {
|
|
4379
4395
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4380
4396
|
}(n)) {
|
|
4381
4397
|
var r = at(n);
|
|
4382
|
-
throw "an object" === r ? e.
|
|
4398
|
+
throw "an object" === r ? e.ht(t + " a custom object") : e.ht(t + " " + r);
|
|
4383
4399
|
}
|
|
4384
4400
|
}
|
|
4385
4401
|
|
|
@@ -4390,7 +4406,7 @@ function Gn(t, e, n) {
|
|
|
4390
4406
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
4391
4407
|
// FieldPath.
|
|
4392
4408
|
(e = p(e)) instanceof wn) return e._internalPath;
|
|
4393
|
-
if ("string" == typeof e) return
|
|
4409
|
+
if ("string" == typeof e) return Qn(t, e);
|
|
4394
4410
|
throw Hn("Field path arguments must be of type string or ", t,
|
|
4395
4411
|
/* hasConverter= */ !1,
|
|
4396
4412
|
/* path= */ void 0, n);
|
|
@@ -4398,7 +4414,7 @@ function Gn(t, e, n) {
|
|
|
4398
4414
|
|
|
4399
4415
|
/**
|
|
4400
4416
|
* Matches any characters in a field path string that are reserved.
|
|
4401
|
-
*/ var
|
|
4417
|
+
*/ var Wn = new RegExp("[~\\*/\\[\\]]");
|
|
4402
4418
|
|
|
4403
4419
|
/**
|
|
4404
4420
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -4408,8 +4424,8 @@ function Gn(t, e, n) {
|
|
|
4408
4424
|
* split on dots.
|
|
4409
4425
|
* @param targetDoc - The document against which the field path will be
|
|
4410
4426
|
* evaluated.
|
|
4411
|
-
*/ function
|
|
4412
|
-
if (e.search(
|
|
4427
|
+
*/ function Qn(t, e, n) {
|
|
4428
|
+
if (e.search(Wn) >= 0) throw Hn("Invalid field path (" + e + "). Paths must not contain '~', '*', '/', '[', or ']'", t,
|
|
4413
4429
|
/* hasConverter= */ !1,
|
|
4414
4430
|
/* path= */ void 0, n);
|
|
4415
4431
|
try {
|
|
@@ -4460,7 +4476,7 @@ function Yn(t, e) {
|
|
|
4460
4476
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
4461
4477
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
4462
4478
|
* explicitly verify a document's existence.
|
|
4463
|
-
*/ var
|
|
4479
|
+
*/ var Xn = /** @class */ function() {
|
|
4464
4480
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
4465
4481
|
// the legacy SDK. The changes are:
|
|
4466
4482
|
// - No support for SnapshotMetadata.
|
|
@@ -4506,7 +4522,7 @@ function Yn(t, e) {
|
|
|
4506
4522
|
if (this._converter) {
|
|
4507
4523
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
4508
4524
|
// if a converter has been provided.
|
|
4509
|
-
var t = new
|
|
4525
|
+
var t = new Jn(this._firestore, this._userDataWriter, this._key, this._document,
|
|
4510
4526
|
/* converter= */ null);
|
|
4511
4527
|
return this._converter.fromFirestore(t);
|
|
4512
4528
|
}
|
|
@@ -4530,7 +4546,7 @@ function Yn(t, e) {
|
|
|
4530
4546
|
if (null !== e) return this._userDataWriter.convertValue(e);
|
|
4531
4547
|
}
|
|
4532
4548
|
}, t;
|
|
4533
|
-
}(),
|
|
4549
|
+
}(), Jn = /** @class */ function(e) {
|
|
4534
4550
|
function n() {
|
|
4535
4551
|
return null !== e && e.apply(this, arguments) || this;
|
|
4536
4552
|
}
|
|
@@ -4542,7 +4558,7 @@ function Yn(t, e) {
|
|
|
4542
4558
|
*/ return t(n, e), n.prototype.data = function() {
|
|
4543
4559
|
return e.prototype.data.call(this);
|
|
4544
4560
|
}, n;
|
|
4545
|
-
}(
|
|
4561
|
+
}(Xn), Zn = /** @class */ function() {
|
|
4546
4562
|
/** @hideconstructor */
|
|
4547
4563
|
function t(t, e) {
|
|
4548
4564
|
this._docs = e, this.query = t;
|
|
@@ -4596,15 +4612,15 @@ function Yn(t, e) {
|
|
|
4596
4612
|
* @param right - A snapshot to compare.
|
|
4597
4613
|
* @returns true if the snapshots are equal.
|
|
4598
4614
|
*/
|
|
4599
|
-
function
|
|
4600
|
-
return t = p(t), e = p(e), t instanceof
|
|
4615
|
+
function $n(t, e) {
|
|
4616
|
+
return t = p(t), e = p(e), t instanceof Xn && e instanceof Xn ? 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 && gn(t.query, e.query) && wt(t.docs, e.docs, $n)
|
|
4601
4617
|
/**
|
|
4602
4618
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
4603
4619
|
*/;
|
|
4604
4620
|
}
|
|
4605
4621
|
|
|
4606
4622
|
function tr(t, e) {
|
|
4607
|
-
return "string" == typeof e ?
|
|
4623
|
+
return "string" == typeof e ? Qn(t, e) : e instanceof wn ? e._internalPath : e._delegate._internalPath;
|
|
4608
4624
|
}
|
|
4609
4625
|
|
|
4610
4626
|
/**
|
|
@@ -4652,11 +4668,11 @@ function tr(t, e) {
|
|
|
4652
4668
|
var rr = /** @class */ function(e) {
|
|
4653
4669
|
function n(t, n, r) {
|
|
4654
4670
|
var i = this;
|
|
4655
|
-
return (i = e.call(this) || this).
|
|
4671
|
+
return (i = e.call(this) || this)._t = t, i.gt = n, i.vt = r, i.type = "where",
|
|
4656
4672
|
i;
|
|
4657
4673
|
}
|
|
4658
4674
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4659
|
-
var e =
|
|
4675
|
+
var e = Dn(t.firestore), n = function(t, e, n, r, i, o, a) {
|
|
4660
4676
|
var s;
|
|
4661
4677
|
if (i.isKeyField()) {
|
|
4662
4678
|
if ("array-contains" /* ARRAY_CONTAINS */ === o || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === o) throw new M(V, "Invalid Query. You can't perform '" + o + "' queries on documentId().");
|
|
@@ -4677,7 +4693,7 @@ var rr = /** @class */ function(e) {
|
|
|
4677
4693
|
/* allowArrays= */ "in" /* IN */ === o || "not-in" /* NOT_IN */ === o);
|
|
4678
4694
|
var h = te.create(i, o, s);
|
|
4679
4695
|
return function(t, e) {
|
|
4680
|
-
if (e.
|
|
4696
|
+
if (e.S()) {
|
|
4681
4697
|
var n = ye(t);
|
|
4682
4698
|
if (null !== n && !n.isEqual(e.field)) throw new M(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() + "'");
|
|
4683
4699
|
var r = de(t);
|
|
@@ -4727,7 +4743,7 @@ var rr = /** @class */ function(e) {
|
|
|
4727
4743
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
4728
4744
|
throw i === e.op ? new M(V, "Invalid query. You cannot use more than one '" + e.op.toString() + "' filter.") : new M(V, "Invalid query. You cannot use '" + e.op.toString() + "' filters with '" + i.toString() + "' filters.");
|
|
4729
4745
|
}(t, h), h;
|
|
4730
|
-
}(t._query, 0, e, t.firestore._databaseId, this.
|
|
4746
|
+
}(t._query, 0, e, t.firestore._databaseId, this._t, this.gt, this.vt);
|
|
4731
4747
|
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4732
4748
|
var n = t.filters.concat([ e ]);
|
|
4733
4749
|
return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -4753,7 +4769,7 @@ var rr = /** @class */ function(e) {
|
|
|
4753
4769
|
var or = /** @class */ function(e) {
|
|
4754
4770
|
function n(t, n) {
|
|
4755
4771
|
var r = this;
|
|
4756
|
-
return (r = e.call(this) || this).
|
|
4772
|
+
return (r = e.call(this) || this)._t = t, r.bt = n, r.type = "orderBy", r;
|
|
4757
4773
|
}
|
|
4758
4774
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4759
4775
|
var e = function(t, e, n) {
|
|
@@ -4767,7 +4783,7 @@ var or = /** @class */ function(e) {
|
|
|
4767
4783
|
null !== n && wr(t, n, e.field);
|
|
4768
4784
|
}
|
|
4769
4785
|
}(t, r), r;
|
|
4770
|
-
}(t._query, this.
|
|
4786
|
+
}(t._query, this._t, this.bt);
|
|
4771
4787
|
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4772
4788
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4773
4789
|
var n = t.explicitOrderBy.concat([ e ]);
|
|
@@ -4793,12 +4809,12 @@ var or = /** @class */ function(e) {
|
|
|
4793
4809
|
var sr = /** @class */ function(e) {
|
|
4794
4810
|
function n(t, n, r) {
|
|
4795
4811
|
var i = this;
|
|
4796
|
-
return (i = e.call(this) || this).type = t, i.
|
|
4812
|
+
return (i = e.call(this) || this).type = t, i.Et = n, i.Tt = r, i;
|
|
4797
4813
|
}
|
|
4798
4814
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4799
4815
|
return new hn(t.firestore, t.converter, function(t, e, n) {
|
|
4800
4816
|
return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
4801
|
-
}(t._query, this.
|
|
4817
|
+
}(t._query, this.Et, this.Tt));
|
|
4802
4818
|
}, n;
|
|
4803
4819
|
}(er);
|
|
4804
4820
|
|
|
@@ -4827,10 +4843,10 @@ function cr(t) {
|
|
|
4827
4843
|
var lr = /** @class */ function(e) {
|
|
4828
4844
|
function n(t, n, r) {
|
|
4829
4845
|
var i = this;
|
|
4830
|
-
return (i = e.call(this) || this).type = t, i.
|
|
4846
|
+
return (i = e.call(this) || this).type = t, i.It = n, i.At = r, i;
|
|
4831
4847
|
}
|
|
4832
4848
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4833
|
-
var e = mr(t, this.type, this.
|
|
4849
|
+
var e = mr(t, this.type, this.It, this.At);
|
|
4834
4850
|
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4835
4851
|
return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
4836
4852
|
}(t._query, e));
|
|
@@ -4852,10 +4868,10 @@ function hr() {
|
|
|
4852
4868
|
var pr = /** @class */ function(e) {
|
|
4853
4869
|
function n(t, n, r) {
|
|
4854
4870
|
var i = this;
|
|
4855
|
-
return (i = e.call(this) || this).type = t, i.
|
|
4871
|
+
return (i = e.call(this) || this).type = t, i.It = n, i.At = r, i;
|
|
4856
4872
|
}
|
|
4857
4873
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4858
|
-
var e = mr(t, this.type, this.
|
|
4874
|
+
var e = mr(t, this.type, this.It, this.At);
|
|
4859
4875
|
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4860
4876
|
return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
4861
4877
|
}(t._query, e));
|
|
@@ -4874,8 +4890,8 @@ function yr() {
|
|
|
4874
4890
|
}
|
|
4875
4891
|
|
|
4876
4892
|
/** Helper function to create a bound from a document or fields */ function mr(t, e, n, r) {
|
|
4877
|
-
if (n[0] = p(n[0]), n[0] instanceof
|
|
4878
|
-
if (!r) throw new M(
|
|
4893
|
+
if (n[0] = p(n[0]), n[0] instanceof Xn) return function(t, e, n, r, i) {
|
|
4894
|
+
if (!r) throw new M(D, "Can't use a DocumentSnapshot that doesn't exist for " + n + "().");
|
|
4879
4895
|
// Because people expect to continue/end a query at the exact document
|
|
4880
4896
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
4881
4897
|
// sort order, because it's guaranteed to contain the document key. That way
|
|
@@ -4885,9 +4901,9 @@ function yr() {
|
|
|
4885
4901
|
// results.
|
|
4886
4902
|
for (var o = [], a = 0, s = ve(t); a < s.length; a++) {
|
|
4887
4903
|
var u = s[a];
|
|
4888
|
-
if (u.field.isKeyField()) o.push(
|
|
4904
|
+
if (u.field.isKeyField()) o.push(zt(e, r.key)); else {
|
|
4889
4905
|
var c = r.data.field(u.field);
|
|
4890
|
-
if (
|
|
4906
|
+
if (qt(c)) throw new M(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.)');
|
|
4891
4907
|
if (null === c) {
|
|
4892
4908
|
var l = u.field.canonicalString();
|
|
4893
4909
|
throw new M(V, "Invalid query. You are trying to start or end a query using a document for which the field '" + l + "' (used as the orderBy) does not exist.");
|
|
@@ -4897,7 +4913,7 @@ function yr() {
|
|
|
4897
4913
|
}
|
|
4898
4914
|
return new ce(o, i);
|
|
4899
4915
|
}(t._query, t.firestore._databaseId, e, n[0]._document, r);
|
|
4900
|
-
var i =
|
|
4916
|
+
var i = Dn(t.firestore);
|
|
4901
4917
|
return function(t, e, n, r, i, o) {
|
|
4902
4918
|
// Use explicit order by's because it has to match the query the user made
|
|
4903
4919
|
var a = t.explicitOrderBy;
|
|
@@ -4907,10 +4923,10 @@ function yr() {
|
|
|
4907
4923
|
if (a[u].field.isKeyField()) {
|
|
4908
4924
|
if ("string" != typeof c) throw new M(V, "Invalid query. Expected a string for document ID in " + r + "(), but got a " + typeof c);
|
|
4909
4925
|
if (!me(t) && -1 !== c.indexOf("/")) throw new M(V, "Invalid query. When querying a collection and ordering by documentId(), the value passed to " + r + "() must be a plain document ID, but '" + c + "' contains a slash.");
|
|
4910
|
-
var l = t.path.child(
|
|
4926
|
+
var l = t.path.child($.fromString(c));
|
|
4911
4927
|
if (!nt.isDocumentKey(l)) throw new M(V, "Invalid query. When querying a collection group and ordering by documentId(), the value passed to " + r + "() must result in a valid document path, but '" + l + "' is not because it contains an odd number of segments.");
|
|
4912
4928
|
var f = new nt(l);
|
|
4913
|
-
s.push(
|
|
4929
|
+
s.push(zt(e, f));
|
|
4914
4930
|
} else {
|
|
4915
4931
|
var h = Mn(n, r, c);
|
|
4916
4932
|
s.push(h);
|
|
@@ -4924,11 +4940,11 @@ function vr(t, e, n) {
|
|
|
4924
4940
|
if ("string" == typeof (n = p(n))) {
|
|
4925
4941
|
if ("" === n) throw new M(V, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
4926
4942
|
if (!me(e) && -1 !== n.indexOf("/")) throw new M(V, "Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '" + n + "' contains a '/' character.");
|
|
4927
|
-
var r = e.path.child(
|
|
4943
|
+
var r = e.path.child($.fromString(n));
|
|
4928
4944
|
if (!nt.isDocumentKey(r)) throw new M(V, "Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '" + r + "' is not because it has an odd number of segments (" + r.length + ").");
|
|
4929
|
-
return
|
|
4945
|
+
return zt(t, new nt(r));
|
|
4930
4946
|
}
|
|
4931
|
-
if (n instanceof fn) return
|
|
4947
|
+
if (n instanceof fn) return zt(t, n._key);
|
|
4932
4948
|
throw new M(V, "Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: " + at(n) + ".");
|
|
4933
4949
|
}
|
|
4934
4950
|
|
|
@@ -5031,7 +5047,7 @@ var _r = /** @class */ function(e) {
|
|
|
5031
5047
|
return t.stringValue;
|
|
5032
5048
|
|
|
5033
5049
|
case 6 /* BlobValue */ :
|
|
5034
|
-
return this.convertBytes(
|
|
5050
|
+
return this.convertBytes(Rt(t.bytesValue));
|
|
5035
5051
|
|
|
5036
5052
|
case 7 /* RefValue */ :
|
|
5037
5053
|
return this.convertReference(t.referenceValue);
|
|
@@ -5063,11 +5079,11 @@ var _r = /** @class */ function(e) {
|
|
|
5063
5079
|
}, t.prototype.convertServerTimestamp = function(t, e) {
|
|
5064
5080
|
switch (e) {
|
|
5065
5081
|
case "previous":
|
|
5066
|
-
var n =
|
|
5082
|
+
var n = Ct(t);
|
|
5067
5083
|
return null == n ? null : this.convertValue(n, e);
|
|
5068
5084
|
|
|
5069
5085
|
case "estimate":
|
|
5070
|
-
return this.convertTimestamp(
|
|
5086
|
+
return this.convertTimestamp(xt(t));
|
|
5071
5087
|
|
|
5072
5088
|
default:
|
|
5073
5089
|
return null;
|
|
@@ -5076,9 +5092,9 @@ var _r = /** @class */ function(e) {
|
|
|
5076
5092
|
var e = Ft(t);
|
|
5077
5093
|
return new bt(e.seconds, e.nanos);
|
|
5078
5094
|
}, t.prototype.convertDocumentKey = function(t, e) {
|
|
5079
|
-
var n =
|
|
5080
|
-
|
|
5081
|
-
var r = new
|
|
5095
|
+
var n = $.fromString(t);
|
|
5096
|
+
k(Ye(n));
|
|
5097
|
+
var r = new J(n.get(1), n.get(3)), i = new nt(n.popFirst(5));
|
|
5082
5098
|
return r.isEqual(e) ||
|
|
5083
5099
|
// TODO(b/64130202): Somehow support foreign references.
|
|
5084
5100
|
b("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."),
|
|
@@ -5101,9 +5117,9 @@ var _r = /** @class */ function(e) {
|
|
|
5101
5117
|
*/ function Tr(t) {
|
|
5102
5118
|
var e = rn((t = st(t, fn)).firestore), n = new _r(t.firestore);
|
|
5103
5119
|
return tn(e, [ t._key ]).then((function(e) {
|
|
5104
|
-
|
|
5120
|
+
k(1 === e.length);
|
|
5105
5121
|
var r = e[0];
|
|
5106
|
-
return new
|
|
5122
|
+
return new Xn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5107
5123
|
}));
|
|
5108
5124
|
}
|
|
5109
5125
|
|
|
@@ -5120,33 +5136,33 @@ var _r = /** @class */ function(e) {
|
|
|
5120
5136
|
* @returns A Promise that will be resolved with the results of the query.
|
|
5121
5137
|
*/ function Er(t) {
|
|
5122
5138
|
!function(t) {
|
|
5123
|
-
if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new M(
|
|
5139
|
+
if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new M(x, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5124
5140
|
}((t = st(t, hn))._query);
|
|
5125
5141
|
var e = rn(t.firestore), n = new _r(t.firestore);
|
|
5126
5142
|
return en(e, t._query).then((function(e) {
|
|
5127
5143
|
var r = e.map((function(e) {
|
|
5128
|
-
return new
|
|
5144
|
+
return new Jn(t.firestore, n, e.key, e, t.converter);
|
|
5129
5145
|
}));
|
|
5130
5146
|
return "L" /* Last */ === t._query.limitType &&
|
|
5131
5147
|
// Limit to last queries reverse the orderBy constraint that was
|
|
5132
5148
|
// specified by the user. As such, we need to reverse the order of the
|
|
5133
5149
|
// results to return the documents in the expected order.
|
|
5134
|
-
r.reverse(), new
|
|
5150
|
+
r.reverse(), new Zn(t, r);
|
|
5135
5151
|
}));
|
|
5136
5152
|
}
|
|
5137
5153
|
|
|
5138
|
-
function
|
|
5139
|
-
var r = br((t = st(t, fn)).converter, e, n), i = Nn(
|
|
5140
|
-
return
|
|
5154
|
+
function kr(t, e, n) {
|
|
5155
|
+
var r = br((t = st(t, fn)).converter, e, n), i = Nn(Dn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
5156
|
+
return $e(rn(t.firestore), [ i.toMutation(t._key, Ie.none()) ]);
|
|
5141
5157
|
}
|
|
5142
5158
|
|
|
5143
|
-
function
|
|
5159
|
+
function Sr(t, e, n) {
|
|
5144
5160
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
5145
|
-
var o, a =
|
|
5161
|
+
var o, a = Dn((t = st(t, fn)).firestore);
|
|
5146
5162
|
// For Compat types, we have to "extract" the underlying types before
|
|
5147
5163
|
// performing validation.
|
|
5148
5164
|
return o = "string" == typeof (e = p(e)) || e instanceof wn ? jn(a, "updateDoc", t._key, e, n, r) : Ln(a, "updateDoc", t._key, e),
|
|
5149
|
-
|
|
5165
|
+
$e(rn(t.firestore), [ o.toMutation(t._key, Ie.exists(!0)) ]);
|
|
5150
5166
|
}
|
|
5151
5167
|
|
|
5152
5168
|
/**
|
|
@@ -5161,7 +5177,7 @@ function kr(t, e, n) {
|
|
|
5161
5177
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5162
5178
|
* deleted from the backend.
|
|
5163
5179
|
*/ function Ir(t) {
|
|
5164
|
-
return
|
|
5180
|
+
return $e(rn((t = st(t, fn)).firestore), [ new De(t._key, Ie.none()) ]);
|
|
5165
5181
|
}
|
|
5166
5182
|
|
|
5167
5183
|
/**
|
|
@@ -5179,8 +5195,8 @@ function kr(t, e, n) {
|
|
|
5179
5195
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
5180
5196
|
* newly created document after it has been written to the backend.
|
|
5181
5197
|
*/ function Ar(t, e) {
|
|
5182
|
-
var n = mn(t = st(t, pn)), r = br(t.converter, e), i = Nn(
|
|
5183
|
-
return
|
|
5198
|
+
var n = mn(t = st(t, pn)), r = br(t.converter, e), i = Nn(Dn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
5199
|
+
return $e(rn(t.firestore), [ i.toMutation(n._key, Ie.exists(!1)) ]).then((function() {
|
|
5184
5200
|
return n;
|
|
5185
5201
|
}));
|
|
5186
5202
|
}
|
|
@@ -5211,8 +5227,8 @@ function kr(t, e, n) {
|
|
|
5211
5227
|
/**
|
|
5212
5228
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
5213
5229
|
* include a server-generated timestamp in the written data.
|
|
5214
|
-
*/ function
|
|
5215
|
-
return new
|
|
5230
|
+
*/ function Pr() {
|
|
5231
|
+
return new Rn("serverTimestamp");
|
|
5216
5232
|
}
|
|
5217
5233
|
|
|
5218
5234
|
/**
|
|
@@ -5226,11 +5242,11 @@ function kr(t, e, n) {
|
|
|
5226
5242
|
* @param elements - The elements to union into the array.
|
|
5227
5243
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5228
5244
|
* `updateDoc()`.
|
|
5229
|
-
*/ function
|
|
5245
|
+
*/ function Dr() {
|
|
5230
5246
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
5231
5247
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5232
5248
|
// update() since we'd need the Firestore instance to do this.
|
|
5233
|
-
return new
|
|
5249
|
+
return new qn("arrayUnion", t);
|
|
5234
5250
|
}
|
|
5235
5251
|
|
|
5236
5252
|
/**
|
|
@@ -5247,7 +5263,7 @@ function kr(t, e, n) {
|
|
|
5247
5263
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
5248
5264
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5249
5265
|
// update() since we'd need the Firestore instance to do this.
|
|
5250
|
-
return new
|
|
5266
|
+
return new Cn("arrayRemove", t);
|
|
5251
5267
|
}
|
|
5252
5268
|
|
|
5253
5269
|
/**
|
|
@@ -5269,7 +5285,7 @@ function kr(t, e, n) {
|
|
|
5269
5285
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5270
5286
|
* `updateDoc()`
|
|
5271
5287
|
*/ function Fr(t) {
|
|
5272
|
-
return new
|
|
5288
|
+
return new xn("increment", t);
|
|
5273
5289
|
}
|
|
5274
5290
|
|
|
5275
5291
|
/**
|
|
@@ -5299,16 +5315,16 @@ function kr(t, e, n) {
|
|
|
5299
5315
|
/** @hideconstructor */
|
|
5300
5316
|
function t(t, e) {
|
|
5301
5317
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
5302
|
-
this._dataReader =
|
|
5318
|
+
this._dataReader = Dn(t);
|
|
5303
5319
|
}
|
|
5304
5320
|
return t.prototype.set = function(t, e, n) {
|
|
5305
5321
|
this._verifyNotCommitted();
|
|
5306
|
-
var r =
|
|
5322
|
+
var r = Rr(t, this._firestore), i = br(r.converter, e, n), o = Nn(this._dataReader, "WriteBatch.set", r._key, i, null !== r.converter, n);
|
|
5307
5323
|
return this._mutations.push(o.toMutation(r._key, Ie.none())), this;
|
|
5308
5324
|
}, t.prototype.update = function(t, e, n) {
|
|
5309
5325
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
5310
5326
|
this._verifyNotCommitted();
|
|
5311
|
-
var o, a =
|
|
5327
|
+
var o, a = Rr(t, this._firestore);
|
|
5312
5328
|
// For Compat types, we have to "extract" the underlying types before
|
|
5313
5329
|
// performing validation.
|
|
5314
5330
|
return o = "string" == typeof (e = p(e)) || e instanceof wn ? jn(this._dataReader, "WriteBatch.update", a._key, e, n, r) : Ln(this._dataReader, "WriteBatch.update", a._key, e),
|
|
@@ -5322,8 +5338,8 @@ function kr(t, e, n) {
|
|
|
5322
5338
|
*/
|
|
5323
5339
|
t.prototype.delete = function(t) {
|
|
5324
5340
|
this._verifyNotCommitted();
|
|
5325
|
-
var e =
|
|
5326
|
-
return this._mutations = this._mutations.concat(new
|
|
5341
|
+
var e = Rr(t, this._firestore);
|
|
5342
|
+
return this._mutations = this._mutations.concat(new De(e._key, Ie.none())), this;
|
|
5327
5343
|
},
|
|
5328
5344
|
/**
|
|
5329
5345
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -5340,11 +5356,11 @@ function kr(t, e, n) {
|
|
|
5340
5356
|
t.prototype.commit = function() {
|
|
5341
5357
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
5342
5358
|
}, t.prototype._verifyNotCommitted = function() {
|
|
5343
|
-
if (this._committed) throw new M(
|
|
5359
|
+
if (this._committed) throw new M(R, "A write batch can no longer be used after commit() has been called.");
|
|
5344
5360
|
}, t;
|
|
5345
5361
|
}();
|
|
5346
5362
|
|
|
5347
|
-
function
|
|
5363
|
+
function Rr(t, e) {
|
|
5348
5364
|
if ((t = p(t)).firestore !== e) throw new M(V, "Provided document reference is from a different Firestore instance.");
|
|
5349
5365
|
return t;
|
|
5350
5366
|
}
|
|
@@ -5361,10 +5377,10 @@ function qr(t, e) {
|
|
|
5361
5377
|
*
|
|
5362
5378
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
5363
5379
|
* writes.
|
|
5364
|
-
*/ function
|
|
5380
|
+
*/ function qr(t) {
|
|
5365
5381
|
var e = rn(t = st(t, an));
|
|
5366
5382
|
return new Or(t, (function(t) {
|
|
5367
|
-
return
|
|
5383
|
+
return $e(e, t);
|
|
5368
5384
|
}));
|
|
5369
5385
|
}
|
|
5370
5386
|
|
|
@@ -5387,7 +5403,7 @@ function qr(t, e) {
|
|
|
5387
5403
|
/**
|
|
5388
5404
|
* Internal transaction object responsible for accumulating the mutations to
|
|
5389
5405
|
* perform and the base versions for any documents read.
|
|
5390
|
-
*/ var
|
|
5406
|
+
*/ var Cr = /** @class */ function() {
|
|
5391
5407
|
function t(t) {
|
|
5392
5408
|
this.datastore = t,
|
|
5393
5409
|
// The version of each document that was read during this transaction.
|
|
@@ -5431,7 +5447,7 @@ function qr(t, e) {
|
|
|
5431
5447
|
}
|
|
5432
5448
|
this.writtenDocs.add(t.toString());
|
|
5433
5449
|
}, t.prototype.delete = function(t) {
|
|
5434
|
-
this.write(new
|
|
5450
|
+
this.write(new De(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
5435
5451
|
}, t.prototype.commit = function() {
|
|
5436
5452
|
return e(this, void 0, void 0, (function() {
|
|
5437
5453
|
var t, e = this;
|
|
@@ -5449,7 +5465,7 @@ function qr(t, e) {
|
|
|
5449
5465
|
t.forEach((function(t, n) {
|
|
5450
5466
|
var r = nt.fromPath(n);
|
|
5451
5467
|
e.mutations.push(new Ne(r, e.precondition(r)));
|
|
5452
|
-
})), [ 4 /*yield*/ ,
|
|
5468
|
+
})), [ 4 /*yield*/ , $e(this.datastore, this.mutations) ];
|
|
5453
5469
|
|
|
5454
5470
|
case 1:
|
|
5455
5471
|
// For each mutation, note that the doc was written.
|
|
@@ -5468,7 +5484,7 @@ function qr(t, e) {
|
|
|
5468
5484
|
if (n) {
|
|
5469
5485
|
if (!e.isEqual(n))
|
|
5470
5486
|
// This transaction will fail no matter what.
|
|
5471
|
-
throw new M(
|
|
5487
|
+
throw new M(q, "Document version changed between two reads.");
|
|
5472
5488
|
} else this.readVersions.set(t.key.toString(), e);
|
|
5473
5489
|
},
|
|
5474
5490
|
/**
|
|
@@ -5507,37 +5523,37 @@ function qr(t, e) {
|
|
|
5507
5523
|
}, t.prototype.write = function(t) {
|
|
5508
5524
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
5509
5525
|
}, t.prototype.ensureCommitNotCalled = function() {}, t;
|
|
5510
|
-
}(),
|
|
5526
|
+
}(), xr = {
|
|
5511
5527
|
maxAttempts: 5
|
|
5512
5528
|
}, Lr = /** @class */ function() {
|
|
5513
5529
|
function t(t, e, n, r, i) {
|
|
5514
5530
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
5515
|
-
this.deferred = i, this.
|
|
5531
|
+
this.deferred = i, this.Rt = n.maxAttempts, this.Pt = new Je(this.asyncQueue, "transaction_retry" /* TransactionRetry */)
|
|
5516
5532
|
/** Runs the transaction and sets the result on deferred. */;
|
|
5517
5533
|
}
|
|
5518
5534
|
return t.prototype.run = function() {
|
|
5519
|
-
this.
|
|
5520
|
-
}, t.prototype.
|
|
5535
|
+
this.Rt -= 1, this.Vt();
|
|
5536
|
+
}, t.prototype.Vt = function() {
|
|
5521
5537
|
var t = this;
|
|
5522
|
-
this.
|
|
5538
|
+
this.Pt.H((function() {
|
|
5523
5539
|
return e(t, void 0, void 0, (function() {
|
|
5524
5540
|
var t, e, r = this;
|
|
5525
5541
|
return n(this, (function(n) {
|
|
5526
|
-
return t = new
|
|
5542
|
+
return t = new Cr(this.datastore), (e = this.Nt(t)) && e.then((function(e) {
|
|
5527
5543
|
r.asyncQueue.enqueueAndForget((function() {
|
|
5528
5544
|
return t.commit().then((function() {
|
|
5529
5545
|
r.deferred.resolve(e);
|
|
5530
5546
|
})).catch((function(t) {
|
|
5531
|
-
r.
|
|
5547
|
+
r.Dt(t);
|
|
5532
5548
|
}));
|
|
5533
5549
|
}));
|
|
5534
5550
|
})).catch((function(t) {
|
|
5535
|
-
r.
|
|
5551
|
+
r.Dt(t);
|
|
5536
5552
|
})), [ 2 /*return*/ ];
|
|
5537
5553
|
}));
|
|
5538
5554
|
}));
|
|
5539
5555
|
}));
|
|
5540
|
-
}, t.prototype.
|
|
5556
|
+
}, t.prototype.Nt = function(t) {
|
|
5541
5557
|
try {
|
|
5542
5558
|
var e = this.updateFunction(t);
|
|
5543
5559
|
return !ct(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
@@ -5546,12 +5562,12 @@ function qr(t, e) {
|
|
|
5546
5562
|
// Do not retry errors thrown by user provided updateFunction.
|
|
5547
5563
|
return this.deferred.reject(t), null;
|
|
5548
5564
|
}
|
|
5549
|
-
}, t.prototype.
|
|
5565
|
+
}, t.prototype.Dt = function(t) {
|
|
5550
5566
|
var e = this;
|
|
5551
|
-
this.
|
|
5552
|
-
return e.
|
|
5567
|
+
this.Rt > 0 && this.$t(t) ? (this.Rt -= 1, this.asyncQueue.enqueueAndForget((function() {
|
|
5568
|
+
return e.Vt(), Promise.resolve();
|
|
5553
5569
|
}))) : this.deferred.reject(t);
|
|
5554
|
-
}, t.prototype
|
|
5570
|
+
}, t.prototype.$t = function(t) {
|
|
5555
5571
|
if ("FirebaseError" === t.name) {
|
|
5556
5572
|
// In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
|
|
5557
5573
|
// non-matching document versions with ABORTED. These errors should be retried.
|
|
@@ -5570,7 +5586,7 @@ function qr(t, e) {
|
|
|
5570
5586
|
|
|
5571
5587
|
case I:
|
|
5572
5588
|
case A:
|
|
5573
|
-
case
|
|
5589
|
+
case P:
|
|
5574
5590
|
case O:
|
|
5575
5591
|
case L:
|
|
5576
5592
|
case j:
|
|
@@ -5580,16 +5596,16 @@ function qr(t, e) {
|
|
|
5580
5596
|
return !1;
|
|
5581
5597
|
|
|
5582
5598
|
case V:
|
|
5583
|
-
case
|
|
5599
|
+
case D:
|
|
5584
5600
|
case "already-exists":
|
|
5585
5601
|
case N:
|
|
5586
|
-
case
|
|
5602
|
+
case R:
|
|
5587
5603
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
5588
5604
|
// the context and should handled individually by the calling code.
|
|
5589
5605
|
// See https://cloud.google.com/apis/design/errors.
|
|
5590
|
-
case
|
|
5591
|
-
case x:
|
|
5606
|
+
case q:
|
|
5592
5607
|
case C:
|
|
5608
|
+
case x:
|
|
5593
5609
|
case "data-loss":
|
|
5594
5610
|
return !0;
|
|
5595
5611
|
}
|
|
@@ -5731,40 +5747,40 @@ function qr(t, e) {
|
|
|
5731
5747
|
function t() {
|
|
5732
5748
|
var t = this;
|
|
5733
5749
|
// The last promise in the queue.
|
|
5734
|
-
this.
|
|
5750
|
+
this.xt = Promise.resolve(),
|
|
5735
5751
|
// A list of retryable operations. Retryable operations are run in order and
|
|
5736
5752
|
// retried with backoff.
|
|
5737
|
-
this.
|
|
5753
|
+
this.Ft = [],
|
|
5738
5754
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
5739
5755
|
// be changed again.
|
|
5740
|
-
this
|
|
5756
|
+
this.St = !1,
|
|
5741
5757
|
// Operations scheduled to be queued in the future. Operations are
|
|
5742
5758
|
// automatically removed after they are run or canceled.
|
|
5743
|
-
this.
|
|
5759
|
+
this.qt = [],
|
|
5744
5760
|
// visible for testing
|
|
5745
|
-
this.
|
|
5761
|
+
this.Ot = null,
|
|
5746
5762
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
5747
5763
|
// assertion sanity-checks.
|
|
5748
|
-
this.
|
|
5764
|
+
this.kt = !1,
|
|
5749
5765
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
5750
|
-
this.
|
|
5766
|
+
this.Ct = !1,
|
|
5751
5767
|
// List of TimerIds to fast-forward delays for.
|
|
5752
|
-
this.
|
|
5768
|
+
this.Lt = [],
|
|
5753
5769
|
// Backoff timer used to schedule retries for retryable operations
|
|
5754
|
-
this.
|
|
5770
|
+
this.Pt = new Je(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5755
5771
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5756
5772
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5757
5773
|
// after page comes into foreground.
|
|
5758
|
-
this.
|
|
5774
|
+
this.Mt = function() {
|
|
5759
5775
|
var e = jr();
|
|
5760
|
-
e && w("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.
|
|
5776
|
+
e && w("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.Pt.X();
|
|
5761
5777
|
};
|
|
5762
5778
|
var e = jr();
|
|
5763
|
-
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.
|
|
5779
|
+
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.Mt);
|
|
5764
5780
|
}
|
|
5765
5781
|
return Object.defineProperty(t.prototype, "isShuttingDown", {
|
|
5766
5782
|
get: function() {
|
|
5767
|
-
return this
|
|
5783
|
+
return this.St;
|
|
5768
5784
|
},
|
|
5769
5785
|
enumerable: !1,
|
|
5770
5786
|
configurable: !0
|
|
@@ -5777,53 +5793,53 @@ function qr(t, e) {
|
|
|
5777
5793
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
5778
5794
|
this.enqueue(t);
|
|
5779
5795
|
}, t.prototype.enqueueAndForgetEvenWhileRestricted = function(t) {
|
|
5780
|
-
this.
|
|
5796
|
+
this.Ut(),
|
|
5781
5797
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
5782
|
-
this.
|
|
5798
|
+
this.jt(t);
|
|
5783
5799
|
}, t.prototype.enterRestrictedMode = function(t) {
|
|
5784
|
-
if (!this
|
|
5785
|
-
this
|
|
5800
|
+
if (!this.St) {
|
|
5801
|
+
this.St = !0, this.Ct = t || !1;
|
|
5786
5802
|
var e = jr();
|
|
5787
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
5803
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Mt);
|
|
5788
5804
|
}
|
|
5789
5805
|
}, t.prototype.enqueue = function(t) {
|
|
5790
5806
|
var e = this;
|
|
5791
|
-
if (this.
|
|
5807
|
+
if (this.Ut(), this.St)
|
|
5792
5808
|
// Return a Promise which never resolves.
|
|
5793
5809
|
return new Promise((function() {}));
|
|
5794
5810
|
// Create a deferred Promise that we can return to the callee. This
|
|
5795
5811
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
5796
5812
|
// advance the queue even when the operation is not run.
|
|
5797
5813
|
var n = new U;
|
|
5798
|
-
return this.
|
|
5799
|
-
return e
|
|
5814
|
+
return this.jt((function() {
|
|
5815
|
+
return e.St && e.Ct ? Promise.resolve() : (t().then(n.resolve, n.reject), n.promise);
|
|
5800
5816
|
})).then((function() {
|
|
5801
5817
|
return n.promise;
|
|
5802
5818
|
}));
|
|
5803
5819
|
}, t.prototype.enqueueRetryable = function(t) {
|
|
5804
5820
|
var e = this;
|
|
5805
5821
|
this.enqueueAndForget((function() {
|
|
5806
|
-
return e.
|
|
5822
|
+
return e.Ft.push(t), e.Bt();
|
|
5807
5823
|
}));
|
|
5808
5824
|
},
|
|
5809
5825
|
/**
|
|
5810
5826
|
* Runs the next operation from the retryable queue. If the operation fails,
|
|
5811
5827
|
* reschedules with backoff.
|
|
5812
5828
|
*/
|
|
5813
|
-
t.prototype.
|
|
5829
|
+
t.prototype.Bt = function() {
|
|
5814
5830
|
return e(this, void 0, void 0, (function() {
|
|
5815
5831
|
var t, e = this;
|
|
5816
5832
|
return n(this, (function(n) {
|
|
5817
5833
|
switch (n.label) {
|
|
5818
5834
|
case 0:
|
|
5819
|
-
if (0 === this.
|
|
5835
|
+
if (0 === this.Ft.length) return [ 3 /*break*/ , 5 ];
|
|
5820
5836
|
n.label = 1;
|
|
5821
5837
|
|
|
5822
5838
|
case 1:
|
|
5823
|
-
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.
|
|
5839
|
+
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.Ft[0]() ];
|
|
5824
5840
|
|
|
5825
5841
|
case 2:
|
|
5826
|
-
return n.sent(), this.
|
|
5842
|
+
return n.sent(), this.Ft.shift(), this.Pt.reset(), [ 3 /*break*/ , 4 ];
|
|
5827
5843
|
|
|
5828
5844
|
case 3:
|
|
5829
5845
|
if (t = n.sent(), "IndexedDbTransactionError" !== t.name) throw t;
|
|
@@ -5832,7 +5848,7 @@ function qr(t, e) {
|
|
|
5832
5848
|
[ 3 /*break*/ , 4 ];
|
|
5833
5849
|
|
|
5834
5850
|
case 4:
|
|
5835
|
-
this.
|
|
5851
|
+
this.Ft.length > 0 &&
|
|
5836
5852
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
5837
5853
|
// This is necessary to run retryable operations that failed during
|
|
5838
5854
|
// their initial attempt since we don't know whether they are already
|
|
@@ -5843,8 +5859,8 @@ function qr(t, e) {
|
|
|
5843
5859
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
5844
5860
|
// new backoff on every call, there is only ever a single additional
|
|
5845
5861
|
// operation in the queue.
|
|
5846
|
-
this.
|
|
5847
|
-
return e.
|
|
5862
|
+
this.Pt.H((function() {
|
|
5863
|
+
return e.Bt();
|
|
5848
5864
|
})), n.label = 5;
|
|
5849
5865
|
|
|
5850
5866
|
case 5:
|
|
@@ -5852,10 +5868,10 @@ function qr(t, e) {
|
|
|
5852
5868
|
}
|
|
5853
5869
|
}));
|
|
5854
5870
|
}));
|
|
5855
|
-
}, t.prototype.
|
|
5856
|
-
var e = this, n = this.
|
|
5857
|
-
return e.
|
|
5858
|
-
e.
|
|
5871
|
+
}, t.prototype.jt = function(t) {
|
|
5872
|
+
var e = this, n = this.xt.then((function() {
|
|
5873
|
+
return e.kt = !0, t().catch((function(t) {
|
|
5874
|
+
e.Ot = t, e.kt = !1;
|
|
5859
5875
|
var n =
|
|
5860
5876
|
/**
|
|
5861
5877
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -5872,39 +5888,39 @@ function qr(t, e) {
|
|
|
5872
5888
|
// and return the rejected Promise.
|
|
5873
5889
|
throw b("INTERNAL UNHANDLED ERROR: ", n), t;
|
|
5874
5890
|
})).then((function(t) {
|
|
5875
|
-
return e.
|
|
5891
|
+
return e.kt = !1, t;
|
|
5876
5892
|
}));
|
|
5877
5893
|
}));
|
|
5878
|
-
return this.
|
|
5894
|
+
return this.xt = n, n;
|
|
5879
5895
|
}, t.prototype.enqueueAfterDelay = function(t, e, n) {
|
|
5880
5896
|
var r = this;
|
|
5881
|
-
this.
|
|
5897
|
+
this.Ut(),
|
|
5882
5898
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5883
|
-
this.
|
|
5899
|
+
this.Lt.indexOf(t) > -1 && (e = 0);
|
|
5884
5900
|
var i = Mr.createAndSchedule(this, t, e, n, (function(t) {
|
|
5885
|
-
return r.
|
|
5901
|
+
return r.zt(t);
|
|
5886
5902
|
}));
|
|
5887
|
-
return this.
|
|
5888
|
-
}, t.prototype.
|
|
5889
|
-
this.
|
|
5903
|
+
return this.qt.push(i), i;
|
|
5904
|
+
}, t.prototype.Ut = function() {
|
|
5905
|
+
this.Ot && E();
|
|
5890
5906
|
}, t.prototype.verifyOperationInProgress = function() {},
|
|
5891
5907
|
/**
|
|
5892
5908
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
5893
5909
|
* operations are not run.
|
|
5894
5910
|
*/
|
|
5895
|
-
t.prototype.
|
|
5911
|
+
t.prototype.Gt = function() {
|
|
5896
5912
|
return e(this, void 0, void 0, (function() {
|
|
5897
5913
|
var t;
|
|
5898
5914
|
return n(this, (function(e) {
|
|
5899
5915
|
switch (e.label) {
|
|
5900
5916
|
case 0:
|
|
5901
|
-
return [ 4 /*yield*/ , t = this.
|
|
5917
|
+
return [ 4 /*yield*/ , t = this.xt ];
|
|
5902
5918
|
|
|
5903
5919
|
case 1:
|
|
5904
5920
|
e.sent(), e.label = 2;
|
|
5905
5921
|
|
|
5906
5922
|
case 2:
|
|
5907
|
-
if (t !== this.
|
|
5923
|
+
if (t !== this.xt) return [ 3 /*break*/ , 0 ];
|
|
5908
5924
|
e.label = 3;
|
|
5909
5925
|
|
|
5910
5926
|
case 3:
|
|
@@ -5917,8 +5933,8 @@ function qr(t, e) {
|
|
|
5917
5933
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
5918
5934
|
* exists.
|
|
5919
5935
|
*/
|
|
5920
|
-
t.prototype.
|
|
5921
|
-
for (var e = 0, n = this.
|
|
5936
|
+
t.prototype.Wt = function(t) {
|
|
5937
|
+
for (var e = 0, n = this.qt; e < n.length; e++) {
|
|
5922
5938
|
if (n[e].timerId === t) return !0;
|
|
5923
5939
|
}
|
|
5924
5940
|
return !1;
|
|
@@ -5930,36 +5946,36 @@ function qr(t, e) {
|
|
|
5930
5946
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
5931
5947
|
* @returns a Promise that resolves once all operations have been run.
|
|
5932
5948
|
*/
|
|
5933
|
-
t.prototype.
|
|
5949
|
+
t.prototype.Kt = function(t) {
|
|
5934
5950
|
var e = this;
|
|
5935
5951
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
5936
|
-
return this.
|
|
5952
|
+
return this.Gt().then((function() {
|
|
5937
5953
|
// Run ops in the same order they'd run if they ran naturally.
|
|
5938
|
-
e.
|
|
5954
|
+
e.qt.sort((function(t, e) {
|
|
5939
5955
|
return t.targetTimeMs - e.targetTimeMs;
|
|
5940
5956
|
}));
|
|
5941
|
-
for (var n = 0, r = e.
|
|
5957
|
+
for (var n = 0, r = e.qt; n < r.length; n++) {
|
|
5942
5958
|
var i = r[n];
|
|
5943
5959
|
if (i.skipDelay(), "all" /* All */ !== t && i.timerId === t) break;
|
|
5944
5960
|
}
|
|
5945
|
-
return e.
|
|
5961
|
+
return e.Gt();
|
|
5946
5962
|
}));
|
|
5947
5963
|
},
|
|
5948
5964
|
/**
|
|
5949
5965
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
5950
5966
|
*/
|
|
5951
|
-
t.prototype.
|
|
5952
|
-
this.
|
|
5967
|
+
t.prototype.Qt = function(t) {
|
|
5968
|
+
this.Lt.push(t);
|
|
5953
5969
|
},
|
|
5954
|
-
/** Called once a DelayedOperation is run or canceled. */ t.prototype.
|
|
5970
|
+
/** Called once a DelayedOperation is run or canceled. */ t.prototype.zt = function(t) {
|
|
5955
5971
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
5956
|
-
var e = this.
|
|
5957
|
-
this.
|
|
5972
|
+
var e = this.qt.indexOf(t);
|
|
5973
|
+
this.qt.splice(e, 1);
|
|
5958
5974
|
}, t;
|
|
5959
5975
|
}(), Br = /** @class */ function() {
|
|
5960
5976
|
/** @hideconstructor */
|
|
5961
5977
|
function t(t, e) {
|
|
5962
|
-
this._firestore = t, this._transaction = e, this._dataReader =
|
|
5978
|
+
this._firestore = t, this._transaction = e, this._dataReader = Dn(t)
|
|
5963
5979
|
/**
|
|
5964
5980
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
5965
5981
|
*
|
|
@@ -5968,20 +5984,20 @@ function qr(t, e) {
|
|
|
5968
5984
|
*/;
|
|
5969
5985
|
}
|
|
5970
5986
|
return t.prototype.get = function(t) {
|
|
5971
|
-
var e = this, n =
|
|
5987
|
+
var e = this, n = Rr(t, this._firestore), r = new _r(this._firestore);
|
|
5972
5988
|
return this._transaction.lookup([ n._key ]).then((function(t) {
|
|
5973
5989
|
if (!t || 1 !== t.length) return E();
|
|
5974
5990
|
var i = t[0];
|
|
5975
|
-
if (i.isFoundDocument()) return new
|
|
5976
|
-
if (i.isNoDocument()) return new
|
|
5991
|
+
if (i.isFoundDocument()) return new Xn(e._firestore, r, i.key, i, n.converter);
|
|
5992
|
+
if (i.isNoDocument()) return new Xn(e._firestore, r, n._key, null, n.converter);
|
|
5977
5993
|
throw E();
|
|
5978
5994
|
}));
|
|
5979
5995
|
}, t.prototype.set = function(t, e, n) {
|
|
5980
|
-
var r =
|
|
5996
|
+
var r = Rr(t, this._firestore), i = br(r.converter, e, n), o = Nn(this._dataReader, "Transaction.set", r._key, i, null !== r.converter, n);
|
|
5981
5997
|
return this._transaction.set(r._key, o), this;
|
|
5982
5998
|
}, t.prototype.update = function(t, e, n) {
|
|
5983
5999
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
5984
|
-
var o, a =
|
|
6000
|
+
var o, a = Rr(t, this._firestore);
|
|
5985
6001
|
// For Compat types, we have to "extract" the underlying types before
|
|
5986
6002
|
// performing validation.
|
|
5987
6003
|
return o = "string" == typeof (e = p(e)) || e instanceof wn ? jn(this._dataReader, "Transaction.update", a._key, e, n, r) : Ln(this._dataReader, "Transaction.update", a._key, e),
|
|
@@ -5994,7 +6010,7 @@ function qr(t, e) {
|
|
|
5994
6010
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
5995
6011
|
*/
|
|
5996
6012
|
t.prototype.delete = function(t) {
|
|
5997
|
-
var e =
|
|
6013
|
+
var e = Rr(t, this._firestore);
|
|
5998
6014
|
return this._transaction.delete(e._key), this;
|
|
5999
6015
|
}, t;
|
|
6000
6016
|
}();
|
|
@@ -6034,8 +6050,8 @@ function qr(t, e) {
|
|
|
6034
6050
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
6035
6051
|
* rejected promise with the corresponding failure error is returned.
|
|
6036
6052
|
*/
|
|
6037
|
-
function
|
|
6038
|
-
var r = rn(t = st(t, an)), i = Object.assign(Object.assign({},
|
|
6053
|
+
function Gr(t, e, n) {
|
|
6054
|
+
var r = rn(t = st(t, an)), i = Object.assign(Object.assign({}, xr), n);
|
|
6039
6055
|
!function(t) {
|
|
6040
6056
|
if (t.maxAttempts < 1) throw new M(V, "Max attempts must be at least 1");
|
|
6041
6057
|
}(i);
|
|
@@ -6058,7 +6074,7 @@ m = i + "_lite", o(new c("firestore/lite", (function(t, e) {
|
|
|
6058
6074
|
return n && i._setSettings(n), i;
|
|
6059
6075
|
}), "PUBLIC")),
|
|
6060
6076
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
6061
|
-
a("firestore-lite", "3.4.
|
|
6077
|
+
a("firestore-lite", "3.4.14-canary.6f4ba2525", ""), a("firestore-lite", "3.4.14-canary.6f4ba2525", "esm5");
|
|
6062
6078
|
|
|
6063
|
-
export { _n as Bytes, pn as CollectionReference, fn as DocumentReference,
|
|
6079
|
+
export { _n as Bytes, pn as CollectionReference, fn as DocumentReference, Xn as DocumentSnapshot, wn as FieldPath, Tn as FieldValue, an as Firestore, M as FirestoreError, En as GeoPoint, hn as Query, er as QueryConstraint, Jn as QueryDocumentSnapshot, Zn as QuerySnapshot, bt as Timestamp, Br as Transaction, Or as WriteBatch, Ar as addDoc, Nr as arrayRemove, Dr as arrayUnion, dn as collection, yn as collectionGroup, cn as connectFirestoreEmulator, Ir as deleteDoc, Vr as deleteField, mn as doc, bn as documentId, yr as endAt, dr as endBefore, Tr as getDoc, Er as getDocs, un as getFirestore, Fr as increment, sn as initializeFirestore, ur as limit, cr as limitToLast, ar as orderBy, nr as query, gn as queryEqual, vn as refEqual, Gr as runTransaction, Pr as serverTimestamp, kr as setDoc, g as setLogLevel, $n as snapshotEqual, hr as startAfter, fr as startAt, ln as terminate, Sr as updateDoc, ir as where, qr as writeBatch };
|
|
6064
6080
|
//# sourceMappingURL=index.browser.esm5.js.map
|