@firebase/firestore 3.4.13 → 3.4.14-canary.04dcdbb0f
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/database.d.ts +34 -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/core/database_info.d.ts +4 -0
- package/dist/firestore/src/lite-api/database.d.ts +51 -7
- 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/integration/api/provider.test.d.ts +17 -0
- package/dist/firestore/test/integration/util/firebase_export.d.ts +2 -1
- package/dist/firestore/test/integration/util/helpers.d.ts +1 -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 +15 -4
- package/dist/index.esm2017.js +3793 -3646
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3762 -3648
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +295 -93
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +295 -93
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +3732 -3586
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +53 -19
- package/dist/lite/firestore/src/api/credentials.d.ts +13 -3
- package/dist/lite/firestore/src/api/database.d.ts +34 -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/core/database_info.d.ts +4 -0
- package/dist/lite/firestore/src/lite-api/database.d.ts +51 -7
- 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/integration/api/provider.test.d.ts +17 -0
- package/dist/lite/firestore/test/integration/util/firebase_export.d.ts +2 -1
- package/dist/lite/firestore/test/integration/util/helpers.d.ts +1 -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 +273 -277
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +506 -493
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.d.ts +15 -4
- package/dist/lite/index.node.cjs.js +71 -61
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +71 -61
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +273 -277
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +58 -7
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +29 -66
- package/dist/lite/packages/firestore/src/api/credentials.d.ts +13 -3
- package/dist/lite/packages/firestore/src/api/database.d.ts +34 -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/core/database_info.d.ts +4 -0
- package/dist/lite/packages/firestore/src/lite-api/database.d.ts +51 -7
- 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/integration/api/provider.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/integration/util/firebase_export.d.ts +2 -1
- package/dist/lite/packages/firestore/test/integration/util/helpers.d.ts +1 -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 +25 -7
- package/dist/packages/firestore/dist/index.esm2017.d.ts +208 -203
- package/dist/packages/firestore/src/api/credentials.d.ts +13 -3
- package/dist/packages/firestore/src/api/database.d.ts +34 -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/core/database_info.d.ts +4 -0
- package/dist/packages/firestore/src/lite-api/database.d.ts +51 -7
- 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/integration/api/provider.test.d.ts +17 -0
- package/dist/packages/firestore/test/integration/util/firebase_export.d.ts +2 -1
- package/dist/packages/firestore/test/integration/util/helpers.d.ts +1 -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 +25 -8
- package/package.json +11 -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.3-canary.04dcdbb0f", 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
|
}
|
|
@@ -3326,17 +3344,14 @@ function en(t, r) {
|
|
|
3326
3344
|
}, t;
|
|
3327
3345
|
}(), an = /** @class */ function() {
|
|
3328
3346
|
/** @hideconstructor */
|
|
3329
|
-
function t(t, e, n) {
|
|
3330
|
-
this._authCredentials =
|
|
3347
|
+
function t(t, e, n, r) {
|
|
3348
|
+
this._authCredentials = t, this._appCheckCredentials = e, this._databaseId = n,
|
|
3349
|
+
this._app = r,
|
|
3331
3350
|
/**
|
|
3332
3351
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
3333
3352
|
*/
|
|
3334
3353
|
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new on({}),
|
|
3335
|
-
this._settingsFrozen = !1
|
|
3336
|
-
this._databaseId = function(t) {
|
|
3337
|
-
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new M(V, '"projectId" not provided in firebase.initializeApp.');
|
|
3338
|
-
return new X(t.options.projectId);
|
|
3339
|
-
}(t));
|
|
3354
|
+
this._settingsFrozen = !1;
|
|
3340
3355
|
}
|
|
3341
3356
|
return Object.defineProperty(t.prototype, "app", {
|
|
3342
3357
|
/**
|
|
@@ -3344,7 +3359,7 @@ function en(t, r) {
|
|
|
3344
3359
|
* instance.
|
|
3345
3360
|
*/
|
|
3346
3361
|
get: function() {
|
|
3347
|
-
if (!this._app) throw new M(
|
|
3362
|
+
if (!this._app) throw new M(R, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
3348
3363
|
return this._app;
|
|
3349
3364
|
},
|
|
3350
3365
|
enumerable: !1,
|
|
@@ -3362,15 +3377,13 @@ function en(t, r) {
|
|
|
3362
3377
|
enumerable: !1,
|
|
3363
3378
|
configurable: !0
|
|
3364
3379
|
}), t.prototype._setSettings = function(t) {
|
|
3365
|
-
if (this._settingsFrozen) throw new M(
|
|
3380
|
+
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
3381
|
this._settings = new on(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
3367
|
-
if (!t) return new
|
|
3382
|
+
if (!t) return new G;
|
|
3368
3383
|
switch (t.type) {
|
|
3369
3384
|
case "gapi":
|
|
3370
3385
|
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);
|
|
3386
|
+
return new Q(e, t.sessionIndex || "0", t.iamToken || null, t.authTokenFactory || null);
|
|
3374
3387
|
|
|
3375
3388
|
case "provider":
|
|
3376
3389
|
return t.client;
|
|
@@ -3427,24 +3440,21 @@ function en(t, r) {
|
|
|
3427
3440
|
* The Cloud Firestore service interface.
|
|
3428
3441
|
*
|
|
3429
3442
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3430
|
-
*/ function sn(t, e) {
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3443
|
+
*/ function sn(t, e, n) {
|
|
3444
|
+
n || (n = "(default)");
|
|
3445
|
+
var r = _getProvider(t, "firestore/lite");
|
|
3446
|
+
if (r.isInitialized(n)) throw new M(R, "Firestore can only be initialized once per app.");
|
|
3447
|
+
return r.initialize({
|
|
3448
|
+
options: e,
|
|
3449
|
+
instanceIdentifier: n
|
|
3435
3450
|
});
|
|
3436
3451
|
}
|
|
3437
3452
|
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
3444
|
-
* instance is associated with.
|
|
3445
|
-
* @returns The `Firestore` instance of the provided app.
|
|
3446
|
-
*/ function un(t) {
|
|
3447
|
-
return void 0 === t && (t = s()), _getProvider(t, "firestore/lite").getImmediate();
|
|
3453
|
+
function un(t, e) {
|
|
3454
|
+
var n = "object" == typeof t ? t : s(), r = "string" == typeof t ? t : e || "(default)";
|
|
3455
|
+
return _getProvider(n, "firestore/lite").getImmediate({
|
|
3456
|
+
identifier: r
|
|
3457
|
+
});
|
|
3448
3458
|
}
|
|
3449
3459
|
|
|
3450
3460
|
/**
|
|
@@ -3477,7 +3487,7 @@ function en(t, r) {
|
|
|
3477
3487
|
if (!u) throw new M(V, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
3478
3488
|
s = new y(u);
|
|
3479
3489
|
}
|
|
3480
|
-
t._authCredentials = new
|
|
3490
|
+
t._authCredentials = new z(new B(a, s));
|
|
3481
3491
|
}
|
|
3482
3492
|
}
|
|
3483
3493
|
|
|
@@ -3651,11 +3661,11 @@ var fn = /** @class */ function() {
|
|
|
3651
3661
|
*/ function dn(t, e) {
|
|
3652
3662
|
for (var n = [], i = 2; i < arguments.length; i++) n[i - 2] = arguments[i];
|
|
3653
3663
|
if (t = p(t), rt("collection", "path", e), t instanceof an) {
|
|
3654
|
-
var o =
|
|
3664
|
+
var o = $.fromString.apply($, r([ e ], n));
|
|
3655
3665
|
return ot(o), new pn(t, /* converter= */ null, o);
|
|
3656
3666
|
}
|
|
3657
3667
|
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(
|
|
3668
|
+
var a = t._path.child($.fromString.apply($, r([ e ], n)));
|
|
3659
3669
|
return ot(a), new pn(t.firestore,
|
|
3660
3670
|
/* converter= */ null, a);
|
|
3661
3671
|
}
|
|
@@ -3681,7 +3691,7 @@ var fn = /** @class */ function() {
|
|
|
3681
3691
|
* within the provided collection group.
|
|
3682
3692
|
*/
|
|
3683
3693
|
function(t) {
|
|
3684
|
-
return new pe(
|
|
3694
|
+
return new pe($.emptyPath(), t);
|
|
3685
3695
|
}(e));
|
|
3686
3696
|
}
|
|
3687
3697
|
|
|
@@ -3690,13 +3700,13 @@ function mn(t, e) {
|
|
|
3690
3700
|
if (t = p(t),
|
|
3691
3701
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3692
3702
|
// 'undefined' and 'null'.
|
|
3693
|
-
1 === arguments.length && (e = vt.
|
|
3694
|
-
var o =
|
|
3703
|
+
1 === arguments.length && (e = vt.N()), rt("doc", "path", e), t instanceof an) {
|
|
3704
|
+
var o = $.fromString.apply($, r([ e ], n));
|
|
3695
3705
|
return it(o), new fn(t,
|
|
3696
3706
|
/* converter= */ null, new nt(o));
|
|
3697
3707
|
}
|
|
3698
3708
|
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(
|
|
3709
|
+
var a = t._path.child($.fromString.apply($, r([ e ], n)));
|
|
3700
3710
|
return it(a), new fn(t.firestore, t instanceof pn ? t.converter : null, new nt(a));
|
|
3701
3711
|
}
|
|
3702
3712
|
|
|
@@ -3818,7 +3828,7 @@ var wn = /** @class */ function() {
|
|
|
3818
3828
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3819
3829
|
*/ return t.fromBase64String = function(e) {
|
|
3820
3830
|
try {
|
|
3821
|
-
return new t(
|
|
3831
|
+
return new t(Dt.fromBase64String(e));
|
|
3822
3832
|
} catch (e) {
|
|
3823
3833
|
throw new M(V, "Failed to construct data from Base64 string: " + e);
|
|
3824
3834
|
}
|
|
@@ -3829,7 +3839,7 @@ var wn = /** @class */ function() {
|
|
|
3829
3839
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3830
3840
|
*/
|
|
3831
3841
|
t.fromUint8Array = function(e) {
|
|
3832
|
-
return new t(
|
|
3842
|
+
return new t(Dt.fromUint8Array(e));
|
|
3833
3843
|
},
|
|
3834
3844
|
/**
|
|
3835
3845
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3924,12 +3934,12 @@ function(t) {
|
|
|
3924
3934
|
t.prototype._compareTo = function(t) {
|
|
3925
3935
|
return gt(this._lat, t._lat) || gt(this._long, t._long);
|
|
3926
3936
|
}, t;
|
|
3927
|
-
}(),
|
|
3937
|
+
}(), kn = /^__.*__$/, Sn = /** @class */ function() {
|
|
3928
3938
|
function t(t, e, n) {
|
|
3929
3939
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3930
3940
|
}
|
|
3931
3941
|
return t.prototype.toMutation = function(t, e) {
|
|
3932
|
-
return null !== this.fieldMask ? new
|
|
3942
|
+
return null !== this.fieldMask ? new Pe(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Ve(t, this.data, e, this.fieldTransforms);
|
|
3933
3943
|
}, t;
|
|
3934
3944
|
}(), In = /** @class */ function() {
|
|
3935
3945
|
function t(t,
|
|
@@ -3938,7 +3948,7 @@ function(t) {
|
|
|
3938
3948
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3939
3949
|
}
|
|
3940
3950
|
return t.prototype.toMutation = function(t, e) {
|
|
3941
|
-
return new
|
|
3951
|
+
return new Pe(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
3942
3952
|
}, t;
|
|
3943
3953
|
}();
|
|
3944
3954
|
|
|
@@ -3999,10 +4009,10 @@ function(t) {
|
|
|
3999
4009
|
* compromised).
|
|
4000
4010
|
*/
|
|
4001
4011
|
function t(t, e, n, r, i, o) {
|
|
4002
|
-
this.settings = t, this.databaseId = e, this.
|
|
4012
|
+
this.settings = t, this.databaseId = e, this.C = n, this.ignoreUndefinedProperties = r,
|
|
4003
4013
|
// Minor hack: If fieldTransforms is undefined, we assume this is an
|
|
4004
4014
|
// external call and we need to validate the entire path.
|
|
4005
|
-
void 0 === i && this.
|
|
4015
|
+
void 0 === i && this.nt(), this.fieldTransforms = i || [], this.fieldMask = o || [];
|
|
4006
4016
|
}
|
|
4007
4017
|
return Object.defineProperty(t.prototype, "path", {
|
|
4008
4018
|
get: function() {
|
|
@@ -4010,36 +4020,36 @@ function(t) {
|
|
|
4010
4020
|
},
|
|
4011
4021
|
enumerable: !1,
|
|
4012
4022
|
configurable: !0
|
|
4013
|
-
}), Object.defineProperty(t.prototype, "
|
|
4023
|
+
}), Object.defineProperty(t.prototype, "rt", {
|
|
4014
4024
|
get: function() {
|
|
4015
|
-
return this.settings.
|
|
4025
|
+
return this.settings.rt;
|
|
4016
4026
|
},
|
|
4017
4027
|
enumerable: !1,
|
|
4018
4028
|
configurable: !0
|
|
4019
4029
|
}),
|
|
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.
|
|
4030
|
+
/** Returns a new context with the specified settings overwritten. */ t.prototype.st = function(e) {
|
|
4031
|
+
return new t(Object.assign(Object.assign({}, this.settings), e), this.databaseId, this.C, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
4032
|
+
}, t.prototype.it = function(t) {
|
|
4033
|
+
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.st({
|
|
4024
4034
|
path: n,
|
|
4025
|
-
|
|
4035
|
+
ot: !1
|
|
4026
4036
|
});
|
|
4027
|
-
return r.
|
|
4028
|
-
}, t.prototype.
|
|
4029
|
-
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
4037
|
+
return r.ut(t), r;
|
|
4038
|
+
}, t.prototype.ct = function(t) {
|
|
4039
|
+
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.st({
|
|
4030
4040
|
path: n,
|
|
4031
|
-
|
|
4041
|
+
ot: !1
|
|
4032
4042
|
});
|
|
4033
|
-
return r.
|
|
4034
|
-
}, t.prototype.
|
|
4043
|
+
return r.nt(), r;
|
|
4044
|
+
}, t.prototype.at = function(t) {
|
|
4035
4045
|
// TODO(b/34871131): We don't support array paths right now; so make path
|
|
4036
4046
|
// undefined.
|
|
4037
|
-
return this.
|
|
4047
|
+
return this.st({
|
|
4038
4048
|
path: void 0,
|
|
4039
|
-
|
|
4049
|
+
ot: !0
|
|
4040
4050
|
});
|
|
4041
|
-
}, t.prototype.
|
|
4042
|
-
return Hn(t, this.settings.methodName, this.settings.
|
|
4051
|
+
}, t.prototype.ht = function(t) {
|
|
4052
|
+
return Hn(t, this.settings.methodName, this.settings.lt || !1, this.path, this.settings.ft);
|
|
4043
4053
|
},
|
|
4044
4054
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ t.prototype.contains = function(t) {
|
|
4045
4055
|
return void 0 !== this.fieldMask.find((function(e) {
|
|
@@ -4047,55 +4057,55 @@ function(t) {
|
|
|
4047
4057
|
})) || void 0 !== this.fieldTransforms.find((function(e) {
|
|
4048
4058
|
return t.isPrefixOf(e.field);
|
|
4049
4059
|
}));
|
|
4050
|
-
}, t.prototype.
|
|
4060
|
+
}, t.prototype.nt = function() {
|
|
4051
4061
|
// TODO(b/34871131): Remove null check once we have proper paths for fields
|
|
4052
4062
|
// 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.
|
|
4063
|
+
if (this.path) for (var t = 0; t < this.path.length; t++) this.ut(this.path.get(t));
|
|
4064
|
+
}, t.prototype.ut = function(t) {
|
|
4065
|
+
if (0 === t.length) throw this.ht("Document fields must not be empty");
|
|
4066
|
+
if (An(this.rt) && kn.test(t)) throw this.ht('Document fields cannot begin and end with "__"');
|
|
4057
4067
|
}, t;
|
|
4058
|
-
}(),
|
|
4068
|
+
}(), Pn = /** @class */ function() {
|
|
4059
4069
|
function t(t, e, n) {
|
|
4060
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.
|
|
4070
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.C = n || Xe(t)
|
|
4061
4071
|
/** Creates a new top-level parse context. */;
|
|
4062
4072
|
}
|
|
4063
|
-
return t.prototype.
|
|
4073
|
+
return t.prototype.dt = function(t, e, n, r) {
|
|
4064
4074
|
return void 0 === r && (r = !1), new Vn({
|
|
4065
|
-
|
|
4075
|
+
rt: t,
|
|
4066
4076
|
methodName: e,
|
|
4067
|
-
|
|
4077
|
+
ft: n,
|
|
4068
4078
|
path: et.emptyPath(),
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
}, this.databaseId, this.
|
|
4079
|
+
ot: !1,
|
|
4080
|
+
lt: r
|
|
4081
|
+
}, this.databaseId, this.C, this.ignoreUndefinedProperties);
|
|
4072
4082
|
}, t;
|
|
4073
4083
|
}();
|
|
4074
4084
|
|
|
4075
4085
|
/**
|
|
4076
4086
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
4077
4087
|
* classes.
|
|
4078
|
-
*/ function
|
|
4079
|
-
var e = t._freezeSettings(), n =
|
|
4080
|
-
return new
|
|
4088
|
+
*/ function Dn(t) {
|
|
4089
|
+
var e = t._freezeSettings(), n = Xe(t._databaseId);
|
|
4090
|
+
return new Pn(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
4081
4091
|
}
|
|
4082
4092
|
|
|
4083
4093
|
/** Parse document data from a set() call. */ function Nn(t, e, n, r, i, o) {
|
|
4084
4094
|
void 0 === o && (o = {});
|
|
4085
|
-
var a = t.
|
|
4086
|
-
|
|
4095
|
+
var a = t.dt(o.merge || o.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
|
|
4096
|
+
zn("Data must be an object, but it was:", a, r);
|
|
4087
4097
|
var s, u, c = Bn(r, a);
|
|
4088
|
-
if (o.merge) s = new
|
|
4098
|
+
if (o.merge) s = new Pt(a.fieldMask), u = a.fieldTransforms; else if (o.mergeFields) {
|
|
4089
4099
|
for (var l = [], f = 0, h = o.mergeFields; f < h.length; f++) {
|
|
4090
4100
|
var p = Kn(e, h[f], n);
|
|
4091
4101
|
if (!a.contains(p)) throw new M(V, "Field '" + p + "' is specified in your field mask but missing from your input data.");
|
|
4092
4102
|
Yn(l, p) || l.push(p);
|
|
4093
4103
|
}
|
|
4094
|
-
s = new
|
|
4104
|
+
s = new Pt(l), u = a.fieldTransforms.filter((function(t) {
|
|
4095
4105
|
return s.covers(t.field);
|
|
4096
4106
|
}));
|
|
4097
4107
|
} else s = null, u = a.fieldTransforms;
|
|
4098
|
-
return new
|
|
4108
|
+
return new Sn(new Xt(c), s, u);
|
|
4099
4109
|
}
|
|
4100
4110
|
|
|
4101
4111
|
var Fn = /** @class */ function(e) {
|
|
@@ -4103,7 +4113,7 @@ var Fn = /** @class */ function(e) {
|
|
|
4103
4113
|
return null !== e && e.apply(this, arguments) || this;
|
|
4104
4114
|
}
|
|
4105
4115
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
4106
|
-
if (2 /* MergeSet */ !== t.
|
|
4116
|
+
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
4117
|
// No transform to add for a delete, but we need to add it to our
|
|
4108
4118
|
// fieldMask so it gets deleted.
|
|
4109
4119
|
return t.fieldMask.push(t.path), null;
|
|
@@ -4129,60 +4139,60 @@ var Fn = /** @class */ function(e) {
|
|
|
4129
4139
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4130
4140
|
*/ function On(t, e, n) {
|
|
4131
4141
|
return new Vn({
|
|
4132
|
-
|
|
4133
|
-
|
|
4142
|
+
rt: 3 /* Argument */ ,
|
|
4143
|
+
ft: e.settings.ft,
|
|
4134
4144
|
methodName: t._methodName,
|
|
4135
|
-
|
|
4136
|
-
}, e.databaseId, e.
|
|
4145
|
+
ot: n
|
|
4146
|
+
}, e.databaseId, e.C, e.ignoreUndefinedProperties);
|
|
4137
4147
|
}
|
|
4138
4148
|
|
|
4139
|
-
var
|
|
4149
|
+
var Rn = /** @class */ function(e) {
|
|
4140
4150
|
function n() {
|
|
4141
4151
|
return null !== e && e.apply(this, arguments) || this;
|
|
4142
4152
|
}
|
|
4143
4153
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
4144
|
-
return new
|
|
4154
|
+
return new Se(t.path, new _e);
|
|
4145
4155
|
}, n.prototype.isEqual = function(t) {
|
|
4146
4156
|
return t instanceof n;
|
|
4147
4157
|
}, n;
|
|
4148
|
-
}(Tn),
|
|
4158
|
+
}(Tn), qn = /** @class */ function(e) {
|
|
4149
4159
|
function n(t, n) {
|
|
4150
4160
|
var r = this;
|
|
4151
|
-
return (r = e.call(this, t) || this).
|
|
4161
|
+
return (r = e.call(this, t) || this).wt = n, r;
|
|
4152
4162
|
}
|
|
4153
4163
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
4154
4164
|
var e = On(this, t,
|
|
4155
|
-
/*array=*/ !0), n = this.
|
|
4165
|
+
/*array=*/ !0), n = this.wt.map((function(t) {
|
|
4156
4166
|
return Un(t, e);
|
|
4157
4167
|
})), r = new Te(n);
|
|
4158
|
-
return new
|
|
4168
|
+
return new Se(t.path, r);
|
|
4159
4169
|
}, n.prototype.isEqual = function(t) {
|
|
4160
4170
|
// TODO(mrschmidt): Implement isEquals
|
|
4161
4171
|
return this === t;
|
|
4162
4172
|
}, n;
|
|
4163
|
-
}(Tn),
|
|
4173
|
+
}(Tn), Cn = /** @class */ function(e) {
|
|
4164
4174
|
function n(t, n) {
|
|
4165
4175
|
var r = this;
|
|
4166
|
-
return (r = e.call(this, t) || this).
|
|
4176
|
+
return (r = e.call(this, t) || this).wt = n, r;
|
|
4167
4177
|
}
|
|
4168
4178
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
4169
4179
|
var e = On(this, t,
|
|
4170
|
-
/*array=*/ !0), n = this.
|
|
4180
|
+
/*array=*/ !0), n = this.wt.map((function(t) {
|
|
4171
4181
|
return Un(t, e);
|
|
4172
4182
|
})), r = new Ee(n);
|
|
4173
|
-
return new
|
|
4183
|
+
return new Se(t.path, r);
|
|
4174
4184
|
}, n.prototype.isEqual = function(t) {
|
|
4175
4185
|
// TODO(mrschmidt): Implement isEquals
|
|
4176
4186
|
return this === t;
|
|
4177
4187
|
}, n;
|
|
4178
|
-
}(Tn),
|
|
4188
|
+
}(Tn), xn = /** @class */ function(e) {
|
|
4179
4189
|
function n(t, n) {
|
|
4180
4190
|
var r = this;
|
|
4181
|
-
return (r = e.call(this, t) || this).
|
|
4191
|
+
return (r = e.call(this, t) || this).yt = n, r;
|
|
4182
4192
|
}
|
|
4183
4193
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
4184
|
-
var e = new
|
|
4185
|
-
return new
|
|
4194
|
+
var e = new ke(t.C, we(t.C, this.yt));
|
|
4195
|
+
return new Se(t.path, e);
|
|
4186
4196
|
}, n.prototype.isEqual = function(t) {
|
|
4187
4197
|
// TODO(mrschmidt): Implement isEquals
|
|
4188
4198
|
return this === t;
|
|
@@ -4190,15 +4200,15 @@ var qn = /** @class */ function(e) {
|
|
|
4190
4200
|
}(Tn);
|
|
4191
4201
|
|
|
4192
4202
|
/** Parse update data from an update() call. */ function Ln(t, e, n, r) {
|
|
4193
|
-
var i = t.
|
|
4194
|
-
|
|
4195
|
-
var o = [], a =
|
|
4203
|
+
var i = t.dt(1 /* Update */ , e, n);
|
|
4204
|
+
zn("Data must be an object, but it was:", i, r);
|
|
4205
|
+
var o = [], a = Xt.empty();
|
|
4196
4206
|
Et(r, (function(t, r) {
|
|
4197
|
-
var s =
|
|
4207
|
+
var s = Qn(e, t, n);
|
|
4198
4208
|
// For Compat types, we have to "extract" the underlying types before
|
|
4199
4209
|
// performing validation.
|
|
4200
4210
|
r = p(r);
|
|
4201
|
-
var u = i.
|
|
4211
|
+
var u = i.ct(s);
|
|
4202
4212
|
if (r instanceof Fn)
|
|
4203
4213
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4204
4214
|
o.push(s); else {
|
|
@@ -4206,22 +4216,22 @@ var qn = /** @class */ function(e) {
|
|
|
4206
4216
|
null != c && (o.push(s), a.set(s, c));
|
|
4207
4217
|
}
|
|
4208
4218
|
}));
|
|
4209
|
-
var s = new
|
|
4219
|
+
var s = new Pt(o);
|
|
4210
4220
|
return new In(a, s, i.fieldTransforms);
|
|
4211
4221
|
}
|
|
4212
4222
|
|
|
4213
4223
|
/** Parse update data from a list of field/value arguments. */ function jn(t, e, n, r, i, o) {
|
|
4214
|
-
var a = t.
|
|
4224
|
+
var a = t.dt(1 /* Update */ , e, n), s = [ Kn(e, r, n) ], u = [ i ];
|
|
4215
4225
|
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
4226
|
for (var c = 0; c < o.length; c += 2) s.push(Kn(e, o[c])), u.push(o[c + 1]);
|
|
4217
4227
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4218
4228
|
// user specified the field multiple times.
|
|
4219
|
-
for (var l = [], f =
|
|
4229
|
+
for (var l = [], f = Xt.empty(), h = s.length - 1; h >= 0; --h) if (!Yn(l, s[h])) {
|
|
4220
4230
|
var d = s[h], y = u[h];
|
|
4221
4231
|
// For Compat types, we have to "extract" the underlying types before
|
|
4222
4232
|
// performing validation.
|
|
4223
4233
|
y = p(y);
|
|
4224
|
-
var m = a.
|
|
4234
|
+
var m = a.ct(d);
|
|
4225
4235
|
if (y instanceof Fn)
|
|
4226
4236
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4227
4237
|
l.push(d); else {
|
|
@@ -4229,7 +4239,7 @@ var qn = /** @class */ function(e) {
|
|
|
4229
4239
|
null != v && (l.push(d), f.set(d, v));
|
|
4230
4240
|
}
|
|
4231
4241
|
}
|
|
4232
|
-
var g = new
|
|
4242
|
+
var g = new Pt(l);
|
|
4233
4243
|
return new In(f, g, a.fieldTransforms);
|
|
4234
4244
|
}
|
|
4235
4245
|
|
|
@@ -4240,7 +4250,7 @@ var qn = /** @class */ function(e) {
|
|
|
4240
4250
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4241
4251
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4242
4252
|
*/ function Mn(t, e, n, r) {
|
|
4243
|
-
return void 0 === r && (r = !1), Un(n, t.
|
|
4253
|
+
return void 0 === r && (r = !1), Un(n, t.dt(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
4244
4254
|
}
|
|
4245
4255
|
|
|
4246
4256
|
/**
|
|
@@ -4252,10 +4262,10 @@ var qn = /** @class */ function(e) {
|
|
|
4252
4262
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
4253
4263
|
* that should not be included in the resulting parsed data.
|
|
4254
4264
|
*/ function Un(t, e) {
|
|
4255
|
-
if (
|
|
4265
|
+
if (Gn(
|
|
4256
4266
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4257
4267
|
// from firestore-exp.
|
|
4258
|
-
t = p(t))) return
|
|
4268
|
+
t = p(t))) return zn("Unsupported field value:", e, t), Bn(t, e);
|
|
4259
4269
|
if (t instanceof Tn)
|
|
4260
4270
|
// FieldValues usually parse into transforms (except deleteField())
|
|
4261
4271
|
// in which case we do not want to include this field in our parsed data
|
|
@@ -4268,8 +4278,8 @@ var qn = /** @class */ function(e) {
|
|
|
4268
4278
|
*/
|
|
4269
4279
|
return function(t, e) {
|
|
4270
4280
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4271
|
-
if (!An(e.
|
|
4272
|
-
if (!e.path) throw e.
|
|
4281
|
+
if (!An(e.rt)) throw e.ht(t._methodName + "() can only be used with update() and set()");
|
|
4282
|
+
if (!e.path) throw e.ht(t._methodName + "() is not currently supported inside arrays");
|
|
4273
4283
|
var n = t._toFieldTransform(e);
|
|
4274
4284
|
n && e.fieldTransforms.push(n);
|
|
4275
4285
|
}(t, e), null;
|
|
@@ -4288,10 +4298,10 @@ var qn = /** @class */ function(e) {
|
|
|
4288
4298
|
// the set of values to be included for the IN query) that may directly
|
|
4289
4299
|
// contain additional arrays (each representing an individual field
|
|
4290
4300
|
// value), so we disable this validation.
|
|
4291
|
-
if (e.settings.
|
|
4301
|
+
if (e.settings.ot && 4 /* ArrayArgument */ !== e.rt) throw e.ht("Nested arrays are not supported");
|
|
4292
4302
|
return function(t, e) {
|
|
4293
4303
|
for (var n = [], r = 0, i = 0, o = t; i < o.length; i++) {
|
|
4294
|
-
var a = Un(o[i], e.
|
|
4304
|
+
var a = Un(o[i], e.at(r));
|
|
4295
4305
|
null == a && (
|
|
4296
4306
|
// Just include nulls in the array for fields being replaced with a
|
|
4297
4307
|
// sentinel.
|
|
@@ -4310,7 +4320,7 @@ var qn = /** @class */ function(e) {
|
|
|
4310
4320
|
if (null === (t = p(t))) return {
|
|
4311
4321
|
nullValue: "NULL_VALUE"
|
|
4312
4322
|
};
|
|
4313
|
-
if ("number" == typeof t) return we(e.
|
|
4323
|
+
if ("number" == typeof t) return we(e.C, t);
|
|
4314
4324
|
if ("boolean" == typeof t) return {
|
|
4315
4325
|
booleanValue: t
|
|
4316
4326
|
};
|
|
@@ -4320,7 +4330,7 @@ var qn = /** @class */ function(e) {
|
|
|
4320
4330
|
if (t instanceof Date) {
|
|
4321
4331
|
var n = bt.fromDate(t);
|
|
4322
4332
|
return {
|
|
4323
|
-
timestampValue:
|
|
4333
|
+
timestampValue: qe(e.C, n)
|
|
4324
4334
|
};
|
|
4325
4335
|
}
|
|
4326
4336
|
if (t instanceof bt) {
|
|
@@ -4329,7 +4339,7 @@ var qn = /** @class */ function(e) {
|
|
|
4329
4339
|
// truncation immediately without waiting for the backend to do that.
|
|
4330
4340
|
var r = new bt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
4331
4341
|
return {
|
|
4332
|
-
timestampValue:
|
|
4342
|
+
timestampValue: qe(e.C, r)
|
|
4333
4343
|
};
|
|
4334
4344
|
}
|
|
4335
4345
|
if (t instanceof En) return {
|
|
@@ -4339,16 +4349,16 @@ var qn = /** @class */ function(e) {
|
|
|
4339
4349
|
}
|
|
4340
4350
|
};
|
|
4341
4351
|
if (t instanceof _n) return {
|
|
4342
|
-
bytesValue:
|
|
4352
|
+
bytesValue: Ce(e.C, t._byteString)
|
|
4343
4353
|
};
|
|
4344
4354
|
if (t instanceof fn) {
|
|
4345
4355
|
var i = e.databaseId, o = t.firestore._databaseId;
|
|
4346
|
-
if (!o.isEqual(i)) throw e.
|
|
4356
|
+
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
4357
|
return {
|
|
4348
4358
|
referenceValue: je(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
4349
4359
|
};
|
|
4350
4360
|
}
|
|
4351
|
-
throw e.
|
|
4361
|
+
throw e.ht("Unsupported field value: " + at(t));
|
|
4352
4362
|
}(t, e);
|
|
4353
4363
|
}
|
|
4354
4364
|
|
|
@@ -4361,7 +4371,7 @@ function Bn(t, e) {
|
|
|
4361
4371
|
// If we encounter an empty object, we explicitly add it to the update
|
|
4362
4372
|
// mask to ensure that the server creates a map entry.
|
|
4363
4373
|
e.path && e.path.length > 0 && e.fieldMask.push(e.path) : Et(t, (function(t, r) {
|
|
4364
|
-
var i = Un(r, e.
|
|
4374
|
+
var i = Un(r, e.it(t));
|
|
4365
4375
|
null != i && (n[t] = i);
|
|
4366
4376
|
})), {
|
|
4367
4377
|
mapValue: {
|
|
@@ -4370,16 +4380,16 @@ function Bn(t, e) {
|
|
|
4370
4380
|
};
|
|
4371
4381
|
}
|
|
4372
4382
|
|
|
4373
|
-
function
|
|
4383
|
+
function Gn(t) {
|
|
4374
4384
|
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
4385
|
}
|
|
4376
4386
|
|
|
4377
|
-
function
|
|
4378
|
-
if (!
|
|
4387
|
+
function zn(t, e, n) {
|
|
4388
|
+
if (!Gn(n) || !function(t) {
|
|
4379
4389
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4380
4390
|
}(n)) {
|
|
4381
4391
|
var r = at(n);
|
|
4382
|
-
throw "an object" === r ? e.
|
|
4392
|
+
throw "an object" === r ? e.ht(t + " a custom object") : e.ht(t + " " + r);
|
|
4383
4393
|
}
|
|
4384
4394
|
}
|
|
4385
4395
|
|
|
@@ -4390,7 +4400,7 @@ function Gn(t, e, n) {
|
|
|
4390
4400
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
4391
4401
|
// FieldPath.
|
|
4392
4402
|
(e = p(e)) instanceof wn) return e._internalPath;
|
|
4393
|
-
if ("string" == typeof e) return
|
|
4403
|
+
if ("string" == typeof e) return Qn(t, e);
|
|
4394
4404
|
throw Hn("Field path arguments must be of type string or ", t,
|
|
4395
4405
|
/* hasConverter= */ !1,
|
|
4396
4406
|
/* path= */ void 0, n);
|
|
@@ -4398,7 +4408,7 @@ function Gn(t, e, n) {
|
|
|
4398
4408
|
|
|
4399
4409
|
/**
|
|
4400
4410
|
* Matches any characters in a field path string that are reserved.
|
|
4401
|
-
*/ var
|
|
4411
|
+
*/ var Wn = new RegExp("[~\\*/\\[\\]]");
|
|
4402
4412
|
|
|
4403
4413
|
/**
|
|
4404
4414
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -4408,8 +4418,8 @@ function Gn(t, e, n) {
|
|
|
4408
4418
|
* split on dots.
|
|
4409
4419
|
* @param targetDoc - The document against which the field path will be
|
|
4410
4420
|
* evaluated.
|
|
4411
|
-
*/ function
|
|
4412
|
-
if (e.search(
|
|
4421
|
+
*/ function Qn(t, e, n) {
|
|
4422
|
+
if (e.search(Wn) >= 0) throw Hn("Invalid field path (" + e + "). Paths must not contain '~', '*', '/', '[', or ']'", t,
|
|
4413
4423
|
/* hasConverter= */ !1,
|
|
4414
4424
|
/* path= */ void 0, n);
|
|
4415
4425
|
try {
|
|
@@ -4460,7 +4470,7 @@ function Yn(t, e) {
|
|
|
4460
4470
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
4461
4471
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
4462
4472
|
* explicitly verify a document's existence.
|
|
4463
|
-
*/ var
|
|
4473
|
+
*/ var Xn = /** @class */ function() {
|
|
4464
4474
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
4465
4475
|
// the legacy SDK. The changes are:
|
|
4466
4476
|
// - No support for SnapshotMetadata.
|
|
@@ -4506,7 +4516,7 @@ function Yn(t, e) {
|
|
|
4506
4516
|
if (this._converter) {
|
|
4507
4517
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
4508
4518
|
// if a converter has been provided.
|
|
4509
|
-
var t = new
|
|
4519
|
+
var t = new Jn(this._firestore, this._userDataWriter, this._key, this._document,
|
|
4510
4520
|
/* converter= */ null);
|
|
4511
4521
|
return this._converter.fromFirestore(t);
|
|
4512
4522
|
}
|
|
@@ -4530,7 +4540,7 @@ function Yn(t, e) {
|
|
|
4530
4540
|
if (null !== e) return this._userDataWriter.convertValue(e);
|
|
4531
4541
|
}
|
|
4532
4542
|
}, t;
|
|
4533
|
-
}(),
|
|
4543
|
+
}(), Jn = /** @class */ function(e) {
|
|
4534
4544
|
function n() {
|
|
4535
4545
|
return null !== e && e.apply(this, arguments) || this;
|
|
4536
4546
|
}
|
|
@@ -4542,7 +4552,7 @@ function Yn(t, e) {
|
|
|
4542
4552
|
*/ return t(n, e), n.prototype.data = function() {
|
|
4543
4553
|
return e.prototype.data.call(this);
|
|
4544
4554
|
}, n;
|
|
4545
|
-
}(
|
|
4555
|
+
}(Xn), Zn = /** @class */ function() {
|
|
4546
4556
|
/** @hideconstructor */
|
|
4547
4557
|
function t(t, e) {
|
|
4548
4558
|
this._docs = e, this.query = t;
|
|
@@ -4596,15 +4606,15 @@ function Yn(t, e) {
|
|
|
4596
4606
|
* @param right - A snapshot to compare.
|
|
4597
4607
|
* @returns true if the snapshots are equal.
|
|
4598
4608
|
*/
|
|
4599
|
-
function
|
|
4600
|
-
return t = p(t), e = p(e), t instanceof
|
|
4609
|
+
function $n(t, e) {
|
|
4610
|
+
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
4611
|
/**
|
|
4602
4612
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
4603
4613
|
*/;
|
|
4604
4614
|
}
|
|
4605
4615
|
|
|
4606
4616
|
function tr(t, e) {
|
|
4607
|
-
return "string" == typeof e ?
|
|
4617
|
+
return "string" == typeof e ? Qn(t, e) : e instanceof wn ? e._internalPath : e._delegate._internalPath;
|
|
4608
4618
|
}
|
|
4609
4619
|
|
|
4610
4620
|
/**
|
|
@@ -4652,11 +4662,11 @@ function tr(t, e) {
|
|
|
4652
4662
|
var rr = /** @class */ function(e) {
|
|
4653
4663
|
function n(t, n, r) {
|
|
4654
4664
|
var i = this;
|
|
4655
|
-
return (i = e.call(this) || this).
|
|
4665
|
+
return (i = e.call(this) || this)._t = t, i.gt = n, i.vt = r, i.type = "where",
|
|
4656
4666
|
i;
|
|
4657
4667
|
}
|
|
4658
4668
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4659
|
-
var e =
|
|
4669
|
+
var e = Dn(t.firestore), n = function(t, e, n, r, i, o, a) {
|
|
4660
4670
|
var s;
|
|
4661
4671
|
if (i.isKeyField()) {
|
|
4662
4672
|
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 +4687,7 @@ var rr = /** @class */ function(e) {
|
|
|
4677
4687
|
/* allowArrays= */ "in" /* IN */ === o || "not-in" /* NOT_IN */ === o);
|
|
4678
4688
|
var h = te.create(i, o, s);
|
|
4679
4689
|
return function(t, e) {
|
|
4680
|
-
if (e.
|
|
4690
|
+
if (e.S()) {
|
|
4681
4691
|
var n = ye(t);
|
|
4682
4692
|
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
4693
|
var r = de(t);
|
|
@@ -4727,7 +4737,7 @@ var rr = /** @class */ function(e) {
|
|
|
4727
4737
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
4728
4738
|
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
4739
|
}(t, h), h;
|
|
4730
|
-
}(t._query, 0, e, t.firestore._databaseId, this.
|
|
4740
|
+
}(t._query, 0, e, t.firestore._databaseId, this._t, this.gt, this.vt);
|
|
4731
4741
|
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4732
4742
|
var n = t.filters.concat([ e ]);
|
|
4733
4743
|
return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -4753,7 +4763,7 @@ var rr = /** @class */ function(e) {
|
|
|
4753
4763
|
var or = /** @class */ function(e) {
|
|
4754
4764
|
function n(t, n) {
|
|
4755
4765
|
var r = this;
|
|
4756
|
-
return (r = e.call(this) || this).
|
|
4766
|
+
return (r = e.call(this) || this)._t = t, r.bt = n, r.type = "orderBy", r;
|
|
4757
4767
|
}
|
|
4758
4768
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4759
4769
|
var e = function(t, e, n) {
|
|
@@ -4767,7 +4777,7 @@ var or = /** @class */ function(e) {
|
|
|
4767
4777
|
null !== n && wr(t, n, e.field);
|
|
4768
4778
|
}
|
|
4769
4779
|
}(t, r), r;
|
|
4770
|
-
}(t._query, this.
|
|
4780
|
+
}(t._query, this._t, this.bt);
|
|
4771
4781
|
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4772
4782
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4773
4783
|
var n = t.explicitOrderBy.concat([ e ]);
|
|
@@ -4793,12 +4803,12 @@ var or = /** @class */ function(e) {
|
|
|
4793
4803
|
var sr = /** @class */ function(e) {
|
|
4794
4804
|
function n(t, n, r) {
|
|
4795
4805
|
var i = this;
|
|
4796
|
-
return (i = e.call(this) || this).type = t, i.
|
|
4806
|
+
return (i = e.call(this) || this).type = t, i.Et = n, i.Tt = r, i;
|
|
4797
4807
|
}
|
|
4798
4808
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4799
4809
|
return new hn(t.firestore, t.converter, function(t, e, n) {
|
|
4800
4810
|
return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
4801
|
-
}(t._query, this.
|
|
4811
|
+
}(t._query, this.Et, this.Tt));
|
|
4802
4812
|
}, n;
|
|
4803
4813
|
}(er);
|
|
4804
4814
|
|
|
@@ -4827,10 +4837,10 @@ function cr(t) {
|
|
|
4827
4837
|
var lr = /** @class */ function(e) {
|
|
4828
4838
|
function n(t, n, r) {
|
|
4829
4839
|
var i = this;
|
|
4830
|
-
return (i = e.call(this) || this).type = t, i.
|
|
4840
|
+
return (i = e.call(this) || this).type = t, i.It = n, i.At = r, i;
|
|
4831
4841
|
}
|
|
4832
4842
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4833
|
-
var e = mr(t, this.type, this.
|
|
4843
|
+
var e = mr(t, this.type, this.It, this.At);
|
|
4834
4844
|
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4835
4845
|
return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
4836
4846
|
}(t._query, e));
|
|
@@ -4852,10 +4862,10 @@ function hr() {
|
|
|
4852
4862
|
var pr = /** @class */ function(e) {
|
|
4853
4863
|
function n(t, n, r) {
|
|
4854
4864
|
var i = this;
|
|
4855
|
-
return (i = e.call(this) || this).type = t, i.
|
|
4865
|
+
return (i = e.call(this) || this).type = t, i.It = n, i.At = r, i;
|
|
4856
4866
|
}
|
|
4857
4867
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4858
|
-
var e = mr(t, this.type, this.
|
|
4868
|
+
var e = mr(t, this.type, this.It, this.At);
|
|
4859
4869
|
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4860
4870
|
return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
4861
4871
|
}(t._query, e));
|
|
@@ -4874,8 +4884,8 @@ function yr() {
|
|
|
4874
4884
|
}
|
|
4875
4885
|
|
|
4876
4886
|
/** 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(
|
|
4887
|
+
if (n[0] = p(n[0]), n[0] instanceof Xn) return function(t, e, n, r, i) {
|
|
4888
|
+
if (!r) throw new M(D, "Can't use a DocumentSnapshot that doesn't exist for " + n + "().");
|
|
4879
4889
|
// Because people expect to continue/end a query at the exact document
|
|
4880
4890
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
4881
4891
|
// sort order, because it's guaranteed to contain the document key. That way
|
|
@@ -4885,9 +4895,9 @@ function yr() {
|
|
|
4885
4895
|
// results.
|
|
4886
4896
|
for (var o = [], a = 0, s = ve(t); a < s.length; a++) {
|
|
4887
4897
|
var u = s[a];
|
|
4888
|
-
if (u.field.isKeyField()) o.push(
|
|
4898
|
+
if (u.field.isKeyField()) o.push(zt(e, r.key)); else {
|
|
4889
4899
|
var c = r.data.field(u.field);
|
|
4890
|
-
if (
|
|
4900
|
+
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
4901
|
if (null === c) {
|
|
4892
4902
|
var l = u.field.canonicalString();
|
|
4893
4903
|
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 +4907,7 @@ function yr() {
|
|
|
4897
4907
|
}
|
|
4898
4908
|
return new ce(o, i);
|
|
4899
4909
|
}(t._query, t.firestore._databaseId, e, n[0]._document, r);
|
|
4900
|
-
var i =
|
|
4910
|
+
var i = Dn(t.firestore);
|
|
4901
4911
|
return function(t, e, n, r, i, o) {
|
|
4902
4912
|
// Use explicit order by's because it has to match the query the user made
|
|
4903
4913
|
var a = t.explicitOrderBy;
|
|
@@ -4907,10 +4917,10 @@ function yr() {
|
|
|
4907
4917
|
if (a[u].field.isKeyField()) {
|
|
4908
4918
|
if ("string" != typeof c) throw new M(V, "Invalid query. Expected a string for document ID in " + r + "(), but got a " + typeof c);
|
|
4909
4919
|
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(
|
|
4920
|
+
var l = t.path.child($.fromString(c));
|
|
4911
4921
|
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
4922
|
var f = new nt(l);
|
|
4913
|
-
s.push(
|
|
4923
|
+
s.push(zt(e, f));
|
|
4914
4924
|
} else {
|
|
4915
4925
|
var h = Mn(n, r, c);
|
|
4916
4926
|
s.push(h);
|
|
@@ -4924,11 +4934,11 @@ function vr(t, e, n) {
|
|
|
4924
4934
|
if ("string" == typeof (n = p(n))) {
|
|
4925
4935
|
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
4936
|
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(
|
|
4937
|
+
var r = e.path.child($.fromString(n));
|
|
4928
4938
|
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
|
|
4939
|
+
return zt(t, new nt(r));
|
|
4930
4940
|
}
|
|
4931
|
-
if (n instanceof fn) return
|
|
4941
|
+
if (n instanceof fn) return zt(t, n._key);
|
|
4932
4942
|
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
4943
|
}
|
|
4934
4944
|
|
|
@@ -5031,7 +5041,7 @@ var _r = /** @class */ function(e) {
|
|
|
5031
5041
|
return t.stringValue;
|
|
5032
5042
|
|
|
5033
5043
|
case 6 /* BlobValue */ :
|
|
5034
|
-
return this.convertBytes(
|
|
5044
|
+
return this.convertBytes(Rt(t.bytesValue));
|
|
5035
5045
|
|
|
5036
5046
|
case 7 /* RefValue */ :
|
|
5037
5047
|
return this.convertReference(t.referenceValue);
|
|
@@ -5063,11 +5073,11 @@ var _r = /** @class */ function(e) {
|
|
|
5063
5073
|
}, t.prototype.convertServerTimestamp = function(t, e) {
|
|
5064
5074
|
switch (e) {
|
|
5065
5075
|
case "previous":
|
|
5066
|
-
var n =
|
|
5076
|
+
var n = Ct(t);
|
|
5067
5077
|
return null == n ? null : this.convertValue(n, e);
|
|
5068
5078
|
|
|
5069
5079
|
case "estimate":
|
|
5070
|
-
return this.convertTimestamp(
|
|
5080
|
+
return this.convertTimestamp(xt(t));
|
|
5071
5081
|
|
|
5072
5082
|
default:
|
|
5073
5083
|
return null;
|
|
@@ -5076,9 +5086,9 @@ var _r = /** @class */ function(e) {
|
|
|
5076
5086
|
var e = Ft(t);
|
|
5077
5087
|
return new bt(e.seconds, e.nanos);
|
|
5078
5088
|
}, t.prototype.convertDocumentKey = function(t, e) {
|
|
5079
|
-
var n =
|
|
5080
|
-
|
|
5081
|
-
var r = new
|
|
5089
|
+
var n = $.fromString(t);
|
|
5090
|
+
k(Ye(n));
|
|
5091
|
+
var r = new J(n.get(1), n.get(3)), i = new nt(n.popFirst(5));
|
|
5082
5092
|
return r.isEqual(e) ||
|
|
5083
5093
|
// TODO(b/64130202): Somehow support foreign references.
|
|
5084
5094
|
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 +5111,9 @@ var _r = /** @class */ function(e) {
|
|
|
5101
5111
|
*/ function Tr(t) {
|
|
5102
5112
|
var e = rn((t = st(t, fn)).firestore), n = new _r(t.firestore);
|
|
5103
5113
|
return tn(e, [ t._key ]).then((function(e) {
|
|
5104
|
-
|
|
5114
|
+
k(1 === e.length);
|
|
5105
5115
|
var r = e[0];
|
|
5106
|
-
return new
|
|
5116
|
+
return new Xn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5107
5117
|
}));
|
|
5108
5118
|
}
|
|
5109
5119
|
|
|
@@ -5120,33 +5130,33 @@ var _r = /** @class */ function(e) {
|
|
|
5120
5130
|
* @returns A Promise that will be resolved with the results of the query.
|
|
5121
5131
|
*/ function Er(t) {
|
|
5122
5132
|
!function(t) {
|
|
5123
|
-
if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new M(
|
|
5133
|
+
if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new M(x, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5124
5134
|
}((t = st(t, hn))._query);
|
|
5125
5135
|
var e = rn(t.firestore), n = new _r(t.firestore);
|
|
5126
5136
|
return en(e, t._query).then((function(e) {
|
|
5127
5137
|
var r = e.map((function(e) {
|
|
5128
|
-
return new
|
|
5138
|
+
return new Jn(t.firestore, n, e.key, e, t.converter);
|
|
5129
5139
|
}));
|
|
5130
5140
|
return "L" /* Last */ === t._query.limitType &&
|
|
5131
5141
|
// Limit to last queries reverse the orderBy constraint that was
|
|
5132
5142
|
// specified by the user. As such, we need to reverse the order of the
|
|
5133
5143
|
// results to return the documents in the expected order.
|
|
5134
|
-
r.reverse(), new
|
|
5144
|
+
r.reverse(), new Zn(t, r);
|
|
5135
5145
|
}));
|
|
5136
5146
|
}
|
|
5137
5147
|
|
|
5138
|
-
function
|
|
5139
|
-
var r = br((t = st(t, fn)).converter, e, n), i = Nn(
|
|
5140
|
-
return
|
|
5148
|
+
function kr(t, e, n) {
|
|
5149
|
+
var r = br((t = st(t, fn)).converter, e, n), i = Nn(Dn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
5150
|
+
return $e(rn(t.firestore), [ i.toMutation(t._key, Ie.none()) ]);
|
|
5141
5151
|
}
|
|
5142
5152
|
|
|
5143
|
-
function
|
|
5153
|
+
function Sr(t, e, n) {
|
|
5144
5154
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
5145
|
-
var o, a =
|
|
5155
|
+
var o, a = Dn((t = st(t, fn)).firestore);
|
|
5146
5156
|
// For Compat types, we have to "extract" the underlying types before
|
|
5147
5157
|
// performing validation.
|
|
5148
5158
|
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
|
-
|
|
5159
|
+
$e(rn(t.firestore), [ o.toMutation(t._key, Ie.exists(!0)) ]);
|
|
5150
5160
|
}
|
|
5151
5161
|
|
|
5152
5162
|
/**
|
|
@@ -5161,7 +5171,7 @@ function kr(t, e, n) {
|
|
|
5161
5171
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5162
5172
|
* deleted from the backend.
|
|
5163
5173
|
*/ function Ir(t) {
|
|
5164
|
-
return
|
|
5174
|
+
return $e(rn((t = st(t, fn)).firestore), [ new De(t._key, Ie.none()) ]);
|
|
5165
5175
|
}
|
|
5166
5176
|
|
|
5167
5177
|
/**
|
|
@@ -5179,8 +5189,8 @@ function kr(t, e, n) {
|
|
|
5179
5189
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
5180
5190
|
* newly created document after it has been written to the backend.
|
|
5181
5191
|
*/ function Ar(t, e) {
|
|
5182
|
-
var n = mn(t = st(t, pn)), r = br(t.converter, e), i = Nn(
|
|
5183
|
-
return
|
|
5192
|
+
var n = mn(t = st(t, pn)), r = br(t.converter, e), i = Nn(Dn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
5193
|
+
return $e(rn(t.firestore), [ i.toMutation(n._key, Ie.exists(!1)) ]).then((function() {
|
|
5184
5194
|
return n;
|
|
5185
5195
|
}));
|
|
5186
5196
|
}
|
|
@@ -5211,8 +5221,8 @@ function kr(t, e, n) {
|
|
|
5211
5221
|
/**
|
|
5212
5222
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
5213
5223
|
* include a server-generated timestamp in the written data.
|
|
5214
|
-
*/ function
|
|
5215
|
-
return new
|
|
5224
|
+
*/ function Pr() {
|
|
5225
|
+
return new Rn("serverTimestamp");
|
|
5216
5226
|
}
|
|
5217
5227
|
|
|
5218
5228
|
/**
|
|
@@ -5226,11 +5236,11 @@ function kr(t, e, n) {
|
|
|
5226
5236
|
* @param elements - The elements to union into the array.
|
|
5227
5237
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5228
5238
|
* `updateDoc()`.
|
|
5229
|
-
*/ function
|
|
5239
|
+
*/ function Dr() {
|
|
5230
5240
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
5231
5241
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5232
5242
|
// update() since we'd need the Firestore instance to do this.
|
|
5233
|
-
return new
|
|
5243
|
+
return new qn("arrayUnion", t);
|
|
5234
5244
|
}
|
|
5235
5245
|
|
|
5236
5246
|
/**
|
|
@@ -5247,7 +5257,7 @@ function kr(t, e, n) {
|
|
|
5247
5257
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
5248
5258
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5249
5259
|
// update() since we'd need the Firestore instance to do this.
|
|
5250
|
-
return new
|
|
5260
|
+
return new Cn("arrayRemove", t);
|
|
5251
5261
|
}
|
|
5252
5262
|
|
|
5253
5263
|
/**
|
|
@@ -5269,7 +5279,7 @@ function kr(t, e, n) {
|
|
|
5269
5279
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5270
5280
|
* `updateDoc()`
|
|
5271
5281
|
*/ function Fr(t) {
|
|
5272
|
-
return new
|
|
5282
|
+
return new xn("increment", t);
|
|
5273
5283
|
}
|
|
5274
5284
|
|
|
5275
5285
|
/**
|
|
@@ -5299,16 +5309,16 @@ function kr(t, e, n) {
|
|
|
5299
5309
|
/** @hideconstructor */
|
|
5300
5310
|
function t(t, e) {
|
|
5301
5311
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
5302
|
-
this._dataReader =
|
|
5312
|
+
this._dataReader = Dn(t);
|
|
5303
5313
|
}
|
|
5304
5314
|
return t.prototype.set = function(t, e, n) {
|
|
5305
5315
|
this._verifyNotCommitted();
|
|
5306
|
-
var r =
|
|
5316
|
+
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
5317
|
return this._mutations.push(o.toMutation(r._key, Ie.none())), this;
|
|
5308
5318
|
}, t.prototype.update = function(t, e, n) {
|
|
5309
5319
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
5310
5320
|
this._verifyNotCommitted();
|
|
5311
|
-
var o, a =
|
|
5321
|
+
var o, a = Rr(t, this._firestore);
|
|
5312
5322
|
// For Compat types, we have to "extract" the underlying types before
|
|
5313
5323
|
// performing validation.
|
|
5314
5324
|
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 +5332,8 @@ function kr(t, e, n) {
|
|
|
5322
5332
|
*/
|
|
5323
5333
|
t.prototype.delete = function(t) {
|
|
5324
5334
|
this._verifyNotCommitted();
|
|
5325
|
-
var e =
|
|
5326
|
-
return this._mutations = this._mutations.concat(new
|
|
5335
|
+
var e = Rr(t, this._firestore);
|
|
5336
|
+
return this._mutations = this._mutations.concat(new De(e._key, Ie.none())), this;
|
|
5327
5337
|
},
|
|
5328
5338
|
/**
|
|
5329
5339
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -5340,11 +5350,11 @@ function kr(t, e, n) {
|
|
|
5340
5350
|
t.prototype.commit = function() {
|
|
5341
5351
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
5342
5352
|
}, t.prototype._verifyNotCommitted = function() {
|
|
5343
|
-
if (this._committed) throw new M(
|
|
5353
|
+
if (this._committed) throw new M(R, "A write batch can no longer be used after commit() has been called.");
|
|
5344
5354
|
}, t;
|
|
5345
5355
|
}();
|
|
5346
5356
|
|
|
5347
|
-
function
|
|
5357
|
+
function Rr(t, e) {
|
|
5348
5358
|
if ((t = p(t)).firestore !== e) throw new M(V, "Provided document reference is from a different Firestore instance.");
|
|
5349
5359
|
return t;
|
|
5350
5360
|
}
|
|
@@ -5361,10 +5371,10 @@ function qr(t, e) {
|
|
|
5361
5371
|
*
|
|
5362
5372
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
5363
5373
|
* writes.
|
|
5364
|
-
*/ function
|
|
5374
|
+
*/ function qr(t) {
|
|
5365
5375
|
var e = rn(t = st(t, an));
|
|
5366
5376
|
return new Or(t, (function(t) {
|
|
5367
|
-
return
|
|
5377
|
+
return $e(e, t);
|
|
5368
5378
|
}));
|
|
5369
5379
|
}
|
|
5370
5380
|
|
|
@@ -5387,7 +5397,7 @@ function qr(t, e) {
|
|
|
5387
5397
|
/**
|
|
5388
5398
|
* Internal transaction object responsible for accumulating the mutations to
|
|
5389
5399
|
* perform and the base versions for any documents read.
|
|
5390
|
-
*/ var
|
|
5400
|
+
*/ var Cr = /** @class */ function() {
|
|
5391
5401
|
function t(t) {
|
|
5392
5402
|
this.datastore = t,
|
|
5393
5403
|
// The version of each document that was read during this transaction.
|
|
@@ -5431,7 +5441,7 @@ function qr(t, e) {
|
|
|
5431
5441
|
}
|
|
5432
5442
|
this.writtenDocs.add(t.toString());
|
|
5433
5443
|
}, t.prototype.delete = function(t) {
|
|
5434
|
-
this.write(new
|
|
5444
|
+
this.write(new De(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
5435
5445
|
}, t.prototype.commit = function() {
|
|
5436
5446
|
return e(this, void 0, void 0, (function() {
|
|
5437
5447
|
var t, e = this;
|
|
@@ -5449,7 +5459,7 @@ function qr(t, e) {
|
|
|
5449
5459
|
t.forEach((function(t, n) {
|
|
5450
5460
|
var r = nt.fromPath(n);
|
|
5451
5461
|
e.mutations.push(new Ne(r, e.precondition(r)));
|
|
5452
|
-
})), [ 4 /*yield*/ ,
|
|
5462
|
+
})), [ 4 /*yield*/ , $e(this.datastore, this.mutations) ];
|
|
5453
5463
|
|
|
5454
5464
|
case 1:
|
|
5455
5465
|
// For each mutation, note that the doc was written.
|
|
@@ -5461,14 +5471,14 @@ function qr(t, e) {
|
|
|
5461
5471
|
var e;
|
|
5462
5472
|
if (t.isFoundDocument()) e = t.version; else {
|
|
5463
5473
|
if (!t.isNoDocument()) throw E();
|
|
5464
|
-
//
|
|
5474
|
+
// Represent a deleted doc using SnapshotVersion.min().
|
|
5465
5475
|
e = _t.min();
|
|
5466
5476
|
}
|
|
5467
5477
|
var n = this.readVersions.get(t.key.toString());
|
|
5468
5478
|
if (n) {
|
|
5469
5479
|
if (!e.isEqual(n))
|
|
5470
5480
|
// This transaction will fail no matter what.
|
|
5471
|
-
throw new M(
|
|
5481
|
+
throw new M(q, "Document version changed between two reads.");
|
|
5472
5482
|
} else this.readVersions.set(t.key.toString(), e);
|
|
5473
5483
|
},
|
|
5474
5484
|
/**
|
|
@@ -5477,7 +5487,7 @@ function qr(t, e) {
|
|
|
5477
5487
|
*/
|
|
5478
5488
|
t.prototype.precondition = function(t) {
|
|
5479
5489
|
var e = this.readVersions.get(t.toString());
|
|
5480
|
-
return !this.writtenDocs.has(t.toString()) && e ? Ie.updateTime(e) : Ie.none();
|
|
5490
|
+
return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(_t.min()) ? Ie.exists(!1) : Ie.updateTime(e) : Ie.none();
|
|
5481
5491
|
},
|
|
5482
5492
|
/**
|
|
5483
5493
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -5507,37 +5517,37 @@ function qr(t, e) {
|
|
|
5507
5517
|
}, t.prototype.write = function(t) {
|
|
5508
5518
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
5509
5519
|
}, t.prototype.ensureCommitNotCalled = function() {}, t;
|
|
5510
|
-
}(),
|
|
5520
|
+
}(), xr = {
|
|
5511
5521
|
maxAttempts: 5
|
|
5512
5522
|
}, Lr = /** @class */ function() {
|
|
5513
5523
|
function t(t, e, n, r, i) {
|
|
5514
5524
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
5515
|
-
this.deferred = i, this.
|
|
5525
|
+
this.deferred = i, this.Rt = n.maxAttempts, this.Pt = new Je(this.asyncQueue, "transaction_retry" /* TransactionRetry */)
|
|
5516
5526
|
/** Runs the transaction and sets the result on deferred. */;
|
|
5517
5527
|
}
|
|
5518
5528
|
return t.prototype.run = function() {
|
|
5519
|
-
this.
|
|
5520
|
-
}, t.prototype.
|
|
5529
|
+
this.Rt -= 1, this.Vt();
|
|
5530
|
+
}, t.prototype.Vt = function() {
|
|
5521
5531
|
var t = this;
|
|
5522
|
-
this.
|
|
5532
|
+
this.Pt.H((function() {
|
|
5523
5533
|
return e(t, void 0, void 0, (function() {
|
|
5524
5534
|
var t, e, r = this;
|
|
5525
5535
|
return n(this, (function(n) {
|
|
5526
|
-
return t = new
|
|
5536
|
+
return t = new Cr(this.datastore), (e = this.Nt(t)) && e.then((function(e) {
|
|
5527
5537
|
r.asyncQueue.enqueueAndForget((function() {
|
|
5528
5538
|
return t.commit().then((function() {
|
|
5529
5539
|
r.deferred.resolve(e);
|
|
5530
5540
|
})).catch((function(t) {
|
|
5531
|
-
r.
|
|
5541
|
+
r.Dt(t);
|
|
5532
5542
|
}));
|
|
5533
5543
|
}));
|
|
5534
5544
|
})).catch((function(t) {
|
|
5535
|
-
r.
|
|
5545
|
+
r.Dt(t);
|
|
5536
5546
|
})), [ 2 /*return*/ ];
|
|
5537
5547
|
}));
|
|
5538
5548
|
}));
|
|
5539
5549
|
}));
|
|
5540
|
-
}, t.prototype.
|
|
5550
|
+
}, t.prototype.Nt = function(t) {
|
|
5541
5551
|
try {
|
|
5542
5552
|
var e = this.updateFunction(t);
|
|
5543
5553
|
return !ct(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
@@ -5546,12 +5556,12 @@ function qr(t, e) {
|
|
|
5546
5556
|
// Do not retry errors thrown by user provided updateFunction.
|
|
5547
5557
|
return this.deferred.reject(t), null;
|
|
5548
5558
|
}
|
|
5549
|
-
}, t.prototype.
|
|
5559
|
+
}, t.prototype.Dt = function(t) {
|
|
5550
5560
|
var e = this;
|
|
5551
|
-
this.
|
|
5552
|
-
return e.
|
|
5561
|
+
this.Rt > 0 && this.$t(t) ? (this.Rt -= 1, this.asyncQueue.enqueueAndForget((function() {
|
|
5562
|
+
return e.Vt(), Promise.resolve();
|
|
5553
5563
|
}))) : this.deferred.reject(t);
|
|
5554
|
-
}, t.prototype
|
|
5564
|
+
}, t.prototype.$t = function(t) {
|
|
5555
5565
|
if ("FirebaseError" === t.name) {
|
|
5556
5566
|
// In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
|
|
5557
5567
|
// non-matching document versions with ABORTED. These errors should be retried.
|
|
@@ -5570,7 +5580,7 @@ function qr(t, e) {
|
|
|
5570
5580
|
|
|
5571
5581
|
case I:
|
|
5572
5582
|
case A:
|
|
5573
|
-
case
|
|
5583
|
+
case P:
|
|
5574
5584
|
case O:
|
|
5575
5585
|
case L:
|
|
5576
5586
|
case j:
|
|
@@ -5580,16 +5590,16 @@ function qr(t, e) {
|
|
|
5580
5590
|
return !1;
|
|
5581
5591
|
|
|
5582
5592
|
case V:
|
|
5583
|
-
case
|
|
5593
|
+
case D:
|
|
5584
5594
|
case "already-exists":
|
|
5585
5595
|
case N:
|
|
5586
|
-
case
|
|
5596
|
+
case R:
|
|
5587
5597
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
5588
5598
|
// the context and should handled individually by the calling code.
|
|
5589
5599
|
// See https://cloud.google.com/apis/design/errors.
|
|
5590
|
-
case
|
|
5591
|
-
case x:
|
|
5600
|
+
case q:
|
|
5592
5601
|
case C:
|
|
5602
|
+
case x:
|
|
5593
5603
|
case "data-loss":
|
|
5594
5604
|
return !0;
|
|
5595
5605
|
}
|
|
@@ -5731,40 +5741,40 @@ function qr(t, e) {
|
|
|
5731
5741
|
function t() {
|
|
5732
5742
|
var t = this;
|
|
5733
5743
|
// The last promise in the queue.
|
|
5734
|
-
this.
|
|
5744
|
+
this.xt = Promise.resolve(),
|
|
5735
5745
|
// A list of retryable operations. Retryable operations are run in order and
|
|
5736
5746
|
// retried with backoff.
|
|
5737
|
-
this.
|
|
5747
|
+
this.Ft = [],
|
|
5738
5748
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
5739
5749
|
// be changed again.
|
|
5740
|
-
this
|
|
5750
|
+
this.St = !1,
|
|
5741
5751
|
// Operations scheduled to be queued in the future. Operations are
|
|
5742
5752
|
// automatically removed after they are run or canceled.
|
|
5743
|
-
this.
|
|
5753
|
+
this.qt = [],
|
|
5744
5754
|
// visible for testing
|
|
5745
|
-
this.
|
|
5755
|
+
this.Ot = null,
|
|
5746
5756
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
5747
5757
|
// assertion sanity-checks.
|
|
5748
|
-
this.
|
|
5758
|
+
this.kt = !1,
|
|
5749
5759
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
5750
|
-
this.
|
|
5760
|
+
this.Ct = !1,
|
|
5751
5761
|
// List of TimerIds to fast-forward delays for.
|
|
5752
|
-
this.
|
|
5762
|
+
this.Lt = [],
|
|
5753
5763
|
// Backoff timer used to schedule retries for retryable operations
|
|
5754
|
-
this.
|
|
5764
|
+
this.Pt = new Je(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5755
5765
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5756
5766
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5757
5767
|
// after page comes into foreground.
|
|
5758
|
-
this.
|
|
5768
|
+
this.Mt = function() {
|
|
5759
5769
|
var e = jr();
|
|
5760
|
-
e && w("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.
|
|
5770
|
+
e && w("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.Pt.X();
|
|
5761
5771
|
};
|
|
5762
5772
|
var e = jr();
|
|
5763
|
-
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.
|
|
5773
|
+
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.Mt);
|
|
5764
5774
|
}
|
|
5765
5775
|
return Object.defineProperty(t.prototype, "isShuttingDown", {
|
|
5766
5776
|
get: function() {
|
|
5767
|
-
return this
|
|
5777
|
+
return this.St;
|
|
5768
5778
|
},
|
|
5769
5779
|
enumerable: !1,
|
|
5770
5780
|
configurable: !0
|
|
@@ -5777,53 +5787,53 @@ function qr(t, e) {
|
|
|
5777
5787
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
5778
5788
|
this.enqueue(t);
|
|
5779
5789
|
}, t.prototype.enqueueAndForgetEvenWhileRestricted = function(t) {
|
|
5780
|
-
this.
|
|
5790
|
+
this.Ut(),
|
|
5781
5791
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
5782
|
-
this.
|
|
5792
|
+
this.jt(t);
|
|
5783
5793
|
}, t.prototype.enterRestrictedMode = function(t) {
|
|
5784
|
-
if (!this
|
|
5785
|
-
this
|
|
5794
|
+
if (!this.St) {
|
|
5795
|
+
this.St = !0, this.Ct = t || !1;
|
|
5786
5796
|
var e = jr();
|
|
5787
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
5797
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Mt);
|
|
5788
5798
|
}
|
|
5789
5799
|
}, t.prototype.enqueue = function(t) {
|
|
5790
5800
|
var e = this;
|
|
5791
|
-
if (this.
|
|
5801
|
+
if (this.Ut(), this.St)
|
|
5792
5802
|
// Return a Promise which never resolves.
|
|
5793
5803
|
return new Promise((function() {}));
|
|
5794
5804
|
// Create a deferred Promise that we can return to the callee. This
|
|
5795
5805
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
5796
5806
|
// advance the queue even when the operation is not run.
|
|
5797
5807
|
var n = new U;
|
|
5798
|
-
return this.
|
|
5799
|
-
return e
|
|
5808
|
+
return this.jt((function() {
|
|
5809
|
+
return e.St && e.Ct ? Promise.resolve() : (t().then(n.resolve, n.reject), n.promise);
|
|
5800
5810
|
})).then((function() {
|
|
5801
5811
|
return n.promise;
|
|
5802
5812
|
}));
|
|
5803
5813
|
}, t.prototype.enqueueRetryable = function(t) {
|
|
5804
5814
|
var e = this;
|
|
5805
5815
|
this.enqueueAndForget((function() {
|
|
5806
|
-
return e.
|
|
5816
|
+
return e.Ft.push(t), e.Bt();
|
|
5807
5817
|
}));
|
|
5808
5818
|
},
|
|
5809
5819
|
/**
|
|
5810
5820
|
* Runs the next operation from the retryable queue. If the operation fails,
|
|
5811
5821
|
* reschedules with backoff.
|
|
5812
5822
|
*/
|
|
5813
|
-
t.prototype.
|
|
5823
|
+
t.prototype.Bt = function() {
|
|
5814
5824
|
return e(this, void 0, void 0, (function() {
|
|
5815
5825
|
var t, e = this;
|
|
5816
5826
|
return n(this, (function(n) {
|
|
5817
5827
|
switch (n.label) {
|
|
5818
5828
|
case 0:
|
|
5819
|
-
if (0 === this.
|
|
5829
|
+
if (0 === this.Ft.length) return [ 3 /*break*/ , 5 ];
|
|
5820
5830
|
n.label = 1;
|
|
5821
5831
|
|
|
5822
5832
|
case 1:
|
|
5823
|
-
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.
|
|
5833
|
+
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.Ft[0]() ];
|
|
5824
5834
|
|
|
5825
5835
|
case 2:
|
|
5826
|
-
return n.sent(), this.
|
|
5836
|
+
return n.sent(), this.Ft.shift(), this.Pt.reset(), [ 3 /*break*/ , 4 ];
|
|
5827
5837
|
|
|
5828
5838
|
case 3:
|
|
5829
5839
|
if (t = n.sent(), "IndexedDbTransactionError" !== t.name) throw t;
|
|
@@ -5832,7 +5842,7 @@ function qr(t, e) {
|
|
|
5832
5842
|
[ 3 /*break*/ , 4 ];
|
|
5833
5843
|
|
|
5834
5844
|
case 4:
|
|
5835
|
-
this.
|
|
5845
|
+
this.Ft.length > 0 &&
|
|
5836
5846
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
5837
5847
|
// This is necessary to run retryable operations that failed during
|
|
5838
5848
|
// their initial attempt since we don't know whether they are already
|
|
@@ -5843,8 +5853,8 @@ function qr(t, e) {
|
|
|
5843
5853
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
5844
5854
|
// new backoff on every call, there is only ever a single additional
|
|
5845
5855
|
// operation in the queue.
|
|
5846
|
-
this.
|
|
5847
|
-
return e.
|
|
5856
|
+
this.Pt.H((function() {
|
|
5857
|
+
return e.Bt();
|
|
5848
5858
|
})), n.label = 5;
|
|
5849
5859
|
|
|
5850
5860
|
case 5:
|
|
@@ -5852,10 +5862,10 @@ function qr(t, e) {
|
|
|
5852
5862
|
}
|
|
5853
5863
|
}));
|
|
5854
5864
|
}));
|
|
5855
|
-
}, t.prototype.
|
|
5856
|
-
var e = this, n = this.
|
|
5857
|
-
return e.
|
|
5858
|
-
e.
|
|
5865
|
+
}, t.prototype.jt = function(t) {
|
|
5866
|
+
var e = this, n = this.xt.then((function() {
|
|
5867
|
+
return e.kt = !0, t().catch((function(t) {
|
|
5868
|
+
e.Ot = t, e.kt = !1;
|
|
5859
5869
|
var n =
|
|
5860
5870
|
/**
|
|
5861
5871
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -5872,39 +5882,39 @@ function qr(t, e) {
|
|
|
5872
5882
|
// and return the rejected Promise.
|
|
5873
5883
|
throw b("INTERNAL UNHANDLED ERROR: ", n), t;
|
|
5874
5884
|
})).then((function(t) {
|
|
5875
|
-
return e.
|
|
5885
|
+
return e.kt = !1, t;
|
|
5876
5886
|
}));
|
|
5877
5887
|
}));
|
|
5878
|
-
return this.
|
|
5888
|
+
return this.xt = n, n;
|
|
5879
5889
|
}, t.prototype.enqueueAfterDelay = function(t, e, n) {
|
|
5880
5890
|
var r = this;
|
|
5881
|
-
this.
|
|
5891
|
+
this.Ut(),
|
|
5882
5892
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5883
|
-
this.
|
|
5893
|
+
this.Lt.indexOf(t) > -1 && (e = 0);
|
|
5884
5894
|
var i = Mr.createAndSchedule(this, t, e, n, (function(t) {
|
|
5885
|
-
return r.
|
|
5895
|
+
return r.zt(t);
|
|
5886
5896
|
}));
|
|
5887
|
-
return this.
|
|
5888
|
-
}, t.prototype.
|
|
5889
|
-
this.
|
|
5897
|
+
return this.qt.push(i), i;
|
|
5898
|
+
}, t.prototype.Ut = function() {
|
|
5899
|
+
this.Ot && E();
|
|
5890
5900
|
}, t.prototype.verifyOperationInProgress = function() {},
|
|
5891
5901
|
/**
|
|
5892
5902
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
5893
5903
|
* operations are not run.
|
|
5894
5904
|
*/
|
|
5895
|
-
t.prototype.
|
|
5905
|
+
t.prototype.Gt = function() {
|
|
5896
5906
|
return e(this, void 0, void 0, (function() {
|
|
5897
5907
|
var t;
|
|
5898
5908
|
return n(this, (function(e) {
|
|
5899
5909
|
switch (e.label) {
|
|
5900
5910
|
case 0:
|
|
5901
|
-
return [ 4 /*yield*/ , t = this.
|
|
5911
|
+
return [ 4 /*yield*/ , t = this.xt ];
|
|
5902
5912
|
|
|
5903
5913
|
case 1:
|
|
5904
5914
|
e.sent(), e.label = 2;
|
|
5905
5915
|
|
|
5906
5916
|
case 2:
|
|
5907
|
-
if (t !== this.
|
|
5917
|
+
if (t !== this.xt) return [ 3 /*break*/ , 0 ];
|
|
5908
5918
|
e.label = 3;
|
|
5909
5919
|
|
|
5910
5920
|
case 3:
|
|
@@ -5917,8 +5927,8 @@ function qr(t, e) {
|
|
|
5917
5927
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
5918
5928
|
* exists.
|
|
5919
5929
|
*/
|
|
5920
|
-
t.prototype.
|
|
5921
|
-
for (var e = 0, n = this.
|
|
5930
|
+
t.prototype.Wt = function(t) {
|
|
5931
|
+
for (var e = 0, n = this.qt; e < n.length; e++) {
|
|
5922
5932
|
if (n[e].timerId === t) return !0;
|
|
5923
5933
|
}
|
|
5924
5934
|
return !1;
|
|
@@ -5930,36 +5940,36 @@ function qr(t, e) {
|
|
|
5930
5940
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
5931
5941
|
* @returns a Promise that resolves once all operations have been run.
|
|
5932
5942
|
*/
|
|
5933
|
-
t.prototype.
|
|
5943
|
+
t.prototype.Kt = function(t) {
|
|
5934
5944
|
var e = this;
|
|
5935
5945
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
5936
|
-
return this.
|
|
5946
|
+
return this.Gt().then((function() {
|
|
5937
5947
|
// Run ops in the same order they'd run if they ran naturally.
|
|
5938
|
-
e.
|
|
5948
|
+
e.qt.sort((function(t, e) {
|
|
5939
5949
|
return t.targetTimeMs - e.targetTimeMs;
|
|
5940
5950
|
}));
|
|
5941
|
-
for (var n = 0, r = e.
|
|
5951
|
+
for (var n = 0, r = e.qt; n < r.length; n++) {
|
|
5942
5952
|
var i = r[n];
|
|
5943
5953
|
if (i.skipDelay(), "all" /* All */ !== t && i.timerId === t) break;
|
|
5944
5954
|
}
|
|
5945
|
-
return e.
|
|
5955
|
+
return e.Gt();
|
|
5946
5956
|
}));
|
|
5947
5957
|
},
|
|
5948
5958
|
/**
|
|
5949
5959
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
5950
5960
|
*/
|
|
5951
|
-
t.prototype.
|
|
5952
|
-
this.
|
|
5961
|
+
t.prototype.Qt = function(t) {
|
|
5962
|
+
this.Lt.push(t);
|
|
5953
5963
|
},
|
|
5954
|
-
/** Called once a DelayedOperation is run or canceled. */ t.prototype.
|
|
5964
|
+
/** Called once a DelayedOperation is run or canceled. */ t.prototype.zt = function(t) {
|
|
5955
5965
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
5956
|
-
var e = this.
|
|
5957
|
-
this.
|
|
5966
|
+
var e = this.qt.indexOf(t);
|
|
5967
|
+
this.qt.splice(e, 1);
|
|
5958
5968
|
}, t;
|
|
5959
5969
|
}(), Br = /** @class */ function() {
|
|
5960
5970
|
/** @hideconstructor */
|
|
5961
5971
|
function t(t, e) {
|
|
5962
|
-
this._firestore = t, this._transaction = e, this._dataReader =
|
|
5972
|
+
this._firestore = t, this._transaction = e, this._dataReader = Dn(t)
|
|
5963
5973
|
/**
|
|
5964
5974
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
5965
5975
|
*
|
|
@@ -5968,20 +5978,20 @@ function qr(t, e) {
|
|
|
5968
5978
|
*/;
|
|
5969
5979
|
}
|
|
5970
5980
|
return t.prototype.get = function(t) {
|
|
5971
|
-
var e = this, n =
|
|
5981
|
+
var e = this, n = Rr(t, this._firestore), r = new _r(this._firestore);
|
|
5972
5982
|
return this._transaction.lookup([ n._key ]).then((function(t) {
|
|
5973
5983
|
if (!t || 1 !== t.length) return E();
|
|
5974
5984
|
var i = t[0];
|
|
5975
|
-
if (i.isFoundDocument()) return new
|
|
5976
|
-
if (i.isNoDocument()) return new
|
|
5985
|
+
if (i.isFoundDocument()) return new Xn(e._firestore, r, i.key, i, n.converter);
|
|
5986
|
+
if (i.isNoDocument()) return new Xn(e._firestore, r, n._key, null, n.converter);
|
|
5977
5987
|
throw E();
|
|
5978
5988
|
}));
|
|
5979
5989
|
}, t.prototype.set = function(t, e, n) {
|
|
5980
|
-
var r =
|
|
5990
|
+
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
5991
|
return this._transaction.set(r._key, o), this;
|
|
5982
5992
|
}, t.prototype.update = function(t, e, n) {
|
|
5983
5993
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
5984
|
-
var o, a =
|
|
5994
|
+
var o, a = Rr(t, this._firestore);
|
|
5985
5995
|
// For Compat types, we have to "extract" the underlying types before
|
|
5986
5996
|
// performing validation.
|
|
5987
5997
|
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 +6004,7 @@ function qr(t, e) {
|
|
|
5994
6004
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
5995
6005
|
*/
|
|
5996
6006
|
t.prototype.delete = function(t) {
|
|
5997
|
-
var e =
|
|
6007
|
+
var e = Rr(t, this._firestore);
|
|
5998
6008
|
return this._transaction.delete(e._key), this;
|
|
5999
6009
|
}, t;
|
|
6000
6010
|
}();
|
|
@@ -6034,8 +6044,8 @@ function qr(t, e) {
|
|
|
6034
6044
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
6035
6045
|
* rejected promise with the corresponding failure error is returned.
|
|
6036
6046
|
*/
|
|
6037
|
-
function
|
|
6038
|
-
var r = rn(t = st(t, an)), i = Object.assign(Object.assign({},
|
|
6047
|
+
function Gr(t, e, n) {
|
|
6048
|
+
var r = rn(t = st(t, an)), i = Object.assign(Object.assign({}, xr), n);
|
|
6039
6049
|
!function(t) {
|
|
6040
6050
|
if (t.maxAttempts < 1) throw new M(V, "Max attempts must be at least 1");
|
|
6041
6051
|
}(i);
|
|
@@ -6054,11 +6064,14 @@ function zr(t, e, n) {
|
|
|
6054
6064
|
}
|
|
6055
6065
|
|
|
6056
6066
|
m = i + "_lite", o(new c("firestore/lite", (function(t, e) {
|
|
6057
|
-
var n = e.
|
|
6058
|
-
|
|
6059
|
-
|
|
6067
|
+
var n = e.instanceIdentifier, r = e.options, i = t.getProvider("app").getImmediate(), o = new an(new K(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")), function(t, e) {
|
|
6068
|
+
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new M(V, '"projectId" not provided in firebase.initializeApp.');
|
|
6069
|
+
return new J(t.options.projectId, e);
|
|
6070
|
+
}(i, n), i);
|
|
6071
|
+
return r && o._setSettings(r), o;
|
|
6072
|
+
}), "PUBLIC").setMultipleInstances(!0)),
|
|
6060
6073
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
6061
|
-
a("firestore-lite", "3.4.
|
|
6074
|
+
a("firestore-lite", "3.4.14-canary.04dcdbb0f", ""), a("firestore-lite", "3.4.14-canary.04dcdbb0f", "esm5");
|
|
6062
6075
|
|
|
6063
|
-
export { _n as Bytes, pn as CollectionReference, fn as DocumentReference,
|
|
6076
|
+
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
6077
|
//# sourceMappingURL=index.browser.esm5.js.map
|