@firebase/firestore 4.7.7-canary.4d2fc6e82 → 4.7.7-canary.554c7bdc1
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/dist/firestore/src/global_index.d.ts +7 -0
- package/dist/firestore/src/lite-api/database.d.ts +4 -0
- package/dist/firestore/src/lite-api/settings.d.ts +4 -0
- package/dist/firestore/src/util/misc.d.ts +0 -2
- package/dist/firestore/test/integration/util/settings.d.ts +1 -0
- package/dist/index.cjs.js +243 -241
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +244 -242
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +54 -53
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +55 -54
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +196 -194
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +7 -0
- package/dist/lite/firestore/src/lite-api/database.d.ts +4 -0
- package/dist/lite/firestore/src/lite-api/settings.d.ts +4 -0
- package/dist/lite/firestore/src/util/misc.d.ts +0 -2
- package/dist/lite/firestore/test/integration/util/settings.d.ts +1 -0
- package/dist/lite/index.browser.esm2017.js +146 -166
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.cjs.js +146 -166
- package/dist/lite/index.cjs.js.map +1 -1
- package/dist/lite/index.node.cjs.js +110 -128
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +111 -129
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +159 -179
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +7 -0
- package/dist/lite/private.d.ts +4 -0
- package/dist/private.d.ts +4 -0
- package/package.json +9 -9
|
@@ -4,11 +4,11 @@ import { Component as o } from "@firebase/component";
|
|
|
4
4
|
|
|
5
5
|
import { Logger as a, LogLevel as u } from "@firebase/logger";
|
|
6
6
|
|
|
7
|
-
import { FirebaseError as _, base64 as c, DecodeBase64StringError as l, getDefaultEmulatorHostnameAndPort as h,
|
|
7
|
+
import { FirebaseError as _, base64 as c, DecodeBase64StringError as l, getDefaultEmulatorHostnameAndPort as h, deepEqual as d, createMockUserToken as f, getModularInstance as E } from "@firebase/util";
|
|
8
8
|
|
|
9
9
|
import { Integer as m } from "@firebase/webchannel-wrapper/bloom-blob";
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const A = "4.7.7-canary.554c7bdc1";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -69,7 +69,7 @@ User.MOCK_USER = new User("mock-user");
|
|
|
69
69
|
* See the License for the specific language governing permissions and
|
|
70
70
|
* limitations under the License.
|
|
71
71
|
*/
|
|
72
|
-
let
|
|
72
|
+
let T = "11.3.0-canary.554c7bdc1";
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* @license
|
|
@@ -108,14 +108,14 @@ const P = new a("@firebase/firestore");
|
|
|
108
108
|
function __PRIVATE_logDebug(t, ...e) {
|
|
109
109
|
if (P.logLevel <= u.DEBUG) {
|
|
110
110
|
const r = e.map(__PRIVATE_argToString);
|
|
111
|
-
P.debug(`Firestore (${
|
|
111
|
+
P.debug(`Firestore (${T}): ${t}`, ...r);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
function __PRIVATE_logError(t, ...e) {
|
|
116
116
|
if (P.logLevel <= u.ERROR) {
|
|
117
117
|
const r = e.map(__PRIVATE_argToString);
|
|
118
|
-
P.error(`Firestore (${
|
|
118
|
+
P.error(`Firestore (${T}): ${t}`, ...r);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -124,7 +124,7 @@ function __PRIVATE_logError(t, ...e) {
|
|
|
124
124
|
*/ function __PRIVATE_logWarn(t, ...e) {
|
|
125
125
|
if (P.logLevel <= u.WARN) {
|
|
126
126
|
const r = e.map(__PRIVATE_argToString);
|
|
127
|
-
P.warn(`Firestore (${
|
|
127
|
+
P.warn(`Firestore (${T}): ${t}`, ...r);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -185,7 +185,7 @@ function __PRIVATE_logError(t, ...e) {
|
|
|
185
185
|
*/ function fail(t = "Unexpected state") {
|
|
186
186
|
// Log the failure in addition to throw an exception, just in case the
|
|
187
187
|
// exception is swallowed.
|
|
188
|
-
const e = `FIRESTORE (${
|
|
188
|
+
const e = `FIRESTORE (${T}) INTERNAL ASSERTION FAILED: ` + t;
|
|
189
189
|
// NOTE: We don't use FirestoreError here because these are internal failures
|
|
190
190
|
// that cannot be handled by the user. (Also it would create a circular
|
|
191
191
|
// dependency between the error and assert modules which doesn't work.)
|
|
@@ -480,60 +480,6 @@ class DatabaseInfo {
|
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
|
|
483
|
-
/**
|
|
484
|
-
* @license
|
|
485
|
-
* Copyright 2020 Google LLC
|
|
486
|
-
*
|
|
487
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
488
|
-
* you may not use this file except in compliance with the License.
|
|
489
|
-
* You may obtain a copy of the License at
|
|
490
|
-
*
|
|
491
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
492
|
-
*
|
|
493
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
494
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
495
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
496
|
-
* See the License for the specific language governing permissions and
|
|
497
|
-
* limitations under the License.
|
|
498
|
-
*/
|
|
499
|
-
/**
|
|
500
|
-
* Generates `nBytes` of random bytes.
|
|
501
|
-
*
|
|
502
|
-
* If `nBytes < 0` , an error will be thrown.
|
|
503
|
-
*/
|
|
504
|
-
function __PRIVATE_randomBytes(t) {
|
|
505
|
-
// Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
|
|
506
|
-
const e =
|
|
507
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
508
|
-
"undefined" != typeof self && (self.crypto || self.msCrypto), r = new Uint8Array(t);
|
|
509
|
-
if (e && "function" == typeof e.getRandomValues) e.getRandomValues(r); else
|
|
510
|
-
// Falls back to Math.random
|
|
511
|
-
for (let e = 0; e < t; e++) r[e] = Math.floor(256 * Math.random());
|
|
512
|
-
return r;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* @license
|
|
517
|
-
* Copyright 2023 Google LLC
|
|
518
|
-
*
|
|
519
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
520
|
-
* you may not use this file except in compliance with the License.
|
|
521
|
-
* You may obtain a copy of the License at
|
|
522
|
-
*
|
|
523
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
524
|
-
*
|
|
525
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
526
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
527
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
528
|
-
* See the License for the specific language governing permissions and
|
|
529
|
-
* limitations under the License.
|
|
530
|
-
*/
|
|
531
|
-
/**
|
|
532
|
-
* An instance of the Platform's 'TextEncoder' implementation.
|
|
533
|
-
*/ function __PRIVATE_newTextEncoder() {
|
|
534
|
-
return new TextEncoder;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
483
|
/**
|
|
538
484
|
* @license
|
|
539
485
|
* Copyright 2017 Google LLC
|
|
@@ -550,62 +496,7 @@ function __PRIVATE_randomBytes(t) {
|
|
|
550
496
|
* See the License for the specific language governing permissions and
|
|
551
497
|
* limitations under the License.
|
|
552
498
|
*/
|
|
553
|
-
|
|
554
|
-
* A utility class for generating unique alphanumeric IDs of a specified length.
|
|
555
|
-
*
|
|
556
|
-
* @internal
|
|
557
|
-
* Exported internally for testing purposes.
|
|
558
|
-
*/ class __PRIVATE_AutoId {
|
|
559
|
-
static newId() {
|
|
560
|
-
// Alphanumeric characters
|
|
561
|
-
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = 62 * Math.floor(256 / 62);
|
|
562
|
-
// The largest byte value that is a multiple of `char.length`.
|
|
563
|
-
let r = "";
|
|
564
|
-
for (;r.length < 20; ) {
|
|
565
|
-
const n = __PRIVATE_randomBytes(40);
|
|
566
|
-
for (let i = 0; i < n.length; ++i)
|
|
567
|
-
// Only accept values that are [0, maxMultiple), this ensures they can
|
|
568
|
-
// be evenly mapped to indices of `chars` via a modulo operation.
|
|
569
|
-
r.length < 20 && n[i] < e && (r += t.charAt(n[i] % 62));
|
|
570
|
-
}
|
|
571
|
-
return r;
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
function __PRIVATE_primitiveComparator(t, e) {
|
|
576
|
-
return t < e ? -1 : t > e ? 1 : 0;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
/** Compare strings in UTF-8 encoded byte order */ function __PRIVATE_compareUtf8Strings(t, e) {
|
|
580
|
-
// Convert the string to UTF-8 encoded bytes
|
|
581
|
-
const r = __PRIVATE_newTextEncoder().encode(t), n = __PRIVATE_newTextEncoder().encode(e);
|
|
582
|
-
for (let t = 0; t < Math.min(r.length, n.length); t++) {
|
|
583
|
-
const e = __PRIVATE_primitiveComparator(r[t], n[t]);
|
|
584
|
-
if (0 !== e) return e;
|
|
585
|
-
}
|
|
586
|
-
return __PRIVATE_primitiveComparator(r.length, n.length);
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
/** Helper to compare arrays using isEqual(). */ function __PRIVATE_arrayEquals(t, e, r) {
|
|
590
|
-
return t.length === e.length && t.every(((t, n) => r(t, e[n])));
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
/**
|
|
594
|
-
* @license
|
|
595
|
-
* Copyright 2017 Google LLC
|
|
596
|
-
*
|
|
597
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
598
|
-
* you may not use this file except in compliance with the License.
|
|
599
|
-
* You may obtain a copy of the License at
|
|
600
|
-
*
|
|
601
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
602
|
-
*
|
|
603
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
604
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
605
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
606
|
-
* See the License for the specific language governing permissions and
|
|
607
|
-
* limitations under the License.
|
|
608
|
-
*/ const Q = "__name__";
|
|
499
|
+
const Q = "__name__";
|
|
609
500
|
|
|
610
501
|
/**
|
|
611
502
|
* Path represents an ordered sequence of string segments.
|
|
@@ -673,11 +564,13 @@ function __PRIVATE_primitiveComparator(t, e) {
|
|
|
673
564
|
const r = BasePath.compareSegments(t.get(n), e.get(n));
|
|
674
565
|
if (0 !== r) return r;
|
|
675
566
|
}
|
|
676
|
-
return
|
|
567
|
+
return Math.sign(t.length - e.length);
|
|
677
568
|
}
|
|
678
569
|
static compareSegments(t, e) {
|
|
679
570
|
const r = BasePath.isNumericId(t), n = BasePath.isNumericId(e);
|
|
680
|
-
return r && !n ? -1 : !r && n ? 1 : r && n ? BasePath.extractNumericId(t).compare(BasePath.extractNumericId(e)) :
|
|
571
|
+
return r && !n ? -1 : !r && n ? 1 : r && n ? BasePath.extractNumericId(t).compare(BasePath.extractNumericId(e)) :
|
|
572
|
+
// both non-numeric
|
|
573
|
+
t < e ? -1 : t > e ? 1 : 0;
|
|
681
574
|
}
|
|
682
575
|
// Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
|
|
683
576
|
static isNumericId(t) {
|
|
@@ -1005,7 +898,7 @@ function __PRIVATE_cloneLongPollingOptions(t) {
|
|
|
1005
898
|
/**
|
|
1006
899
|
* The value returned from the most recent invocation of
|
|
1007
900
|
* `generateUniqueDebugId()`, or null if it has never been invoked.
|
|
1008
|
-
*/ let
|
|
901
|
+
*/ let M = null;
|
|
1009
902
|
|
|
1010
903
|
/**
|
|
1011
904
|
* Generates and returns an initial value for `lastUniqueDebugId`.
|
|
@@ -1030,9 +923,9 @@ function __PRIVATE_cloneLongPollingOptions(t) {
|
|
|
1030
923
|
* @return the 10-character generated ID (e.g. "0xa1b2c3d4").
|
|
1031
924
|
*/
|
|
1032
925
|
function __PRIVATE_generateUniqueDebugId() {
|
|
1033
|
-
return null ===
|
|
926
|
+
return null === M ? M = function __PRIVATE_generateInitialUniqueDebugId() {
|
|
1034
927
|
return 268435456 + Math.round(2147483648 * Math.random());
|
|
1035
|
-
}() :
|
|
928
|
+
}() : M++, "0x" + M.toString(16);
|
|
1036
929
|
}
|
|
1037
930
|
|
|
1038
931
|
/**
|
|
@@ -1083,7 +976,7 @@ function __PRIVATE_generateUniqueDebugId() {
|
|
|
1083
976
|
* See the License for the specific language governing permissions and
|
|
1084
977
|
* limitations under the License.
|
|
1085
978
|
*/
|
|
1086
|
-
const
|
|
979
|
+
const x = "RestConnection", k = {
|
|
1087
980
|
BatchGetDocuments: "batchGet",
|
|
1088
981
|
Commit: "commit",
|
|
1089
982
|
RunQuery: "runQuery",
|
|
@@ -1100,7 +993,7 @@ const M = "RestConnection", U = {
|
|
|
1100
993
|
* HTTP).
|
|
1101
994
|
*/
|
|
1102
995
|
class __PRIVATE_RestConnection {
|
|
1103
|
-
get
|
|
996
|
+
get A() {
|
|
1104
997
|
// Both `invokeRPC()` and `invokeStreamingRPC()` use their `path` arguments to determine
|
|
1105
998
|
// where to run the query, and expect the `request` to NOT specify the "path".
|
|
1106
999
|
return !1;
|
|
@@ -1108,18 +1001,18 @@ class __PRIVATE_RestConnection {
|
|
|
1108
1001
|
constructor(t) {
|
|
1109
1002
|
this.databaseInfo = t, this.databaseId = t.databaseId;
|
|
1110
1003
|
const e = t.ssl ? "https" : "http", r = encodeURIComponent(this.databaseId.projectId), n = encodeURIComponent(this.databaseId.database);
|
|
1111
|
-
this.
|
|
1004
|
+
this.T = e + "://" + t.host, this.P = `projects/${r}/databases/${n}`, this.R = this.databaseId.database === $ ? `project_id=${r}` : `project_id=${r}&database_id=${n}`;
|
|
1112
1005
|
}
|
|
1113
1006
|
V(t, e, r, n, i) {
|
|
1114
1007
|
const s = __PRIVATE_generateUniqueDebugId(), o = this.I(t, e.toUriEncodedString());
|
|
1115
|
-
__PRIVATE_logDebug(
|
|
1008
|
+
__PRIVATE_logDebug(x, `Sending RPC '${t}' ${s}:`, o, r);
|
|
1116
1009
|
const a = {
|
|
1117
1010
|
"google-cloud-resource-prefix": this.P,
|
|
1118
1011
|
"x-goog-request-params": this.R
|
|
1119
1012
|
};
|
|
1120
|
-
return this.p(a, n, i), this.F(t, o, a, r).then((e => (__PRIVATE_logDebug(
|
|
1013
|
+
return this.p(a, n, i), this.F(t, o, a, r).then((e => (__PRIVATE_logDebug(x, `Received RPC '${t}' ${s}: `, e),
|
|
1121
1014
|
e)), (e => {
|
|
1122
|
-
throw __PRIVATE_logWarn(
|
|
1015
|
+
throw __PRIVATE_logWarn(x, `RPC '${t}' ${s} failed with error: `, e, "url: ", o, "request:", r),
|
|
1123
1016
|
e;
|
|
1124
1017
|
}));
|
|
1125
1018
|
}
|
|
@@ -1136,7 +1029,7 @@ class __PRIVATE_RestConnection {
|
|
|
1136
1029
|
// SDK_VERSION is updated to different value at runtime depending on the entry point,
|
|
1137
1030
|
// so we need to get its value when we need it in a function.
|
|
1138
1031
|
function __PRIVATE_getGoogApiClientValue() {
|
|
1139
|
-
return "gl-js/ fire/" +
|
|
1032
|
+
return "gl-js/ fire/" + T;
|
|
1140
1033
|
}(),
|
|
1141
1034
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
1142
1035
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
@@ -1146,8 +1039,8 @@ class __PRIVATE_RestConnection {
|
|
|
1146
1039
|
e && e.headers.forEach(((e, r) => t[r] = e)), r && r.headers.forEach(((e, r) => t[r] = e));
|
|
1147
1040
|
}
|
|
1148
1041
|
I(t, e) {
|
|
1149
|
-
const r =
|
|
1150
|
-
return `${this.
|
|
1042
|
+
const r = k[t];
|
|
1043
|
+
return `${this.T}/v1/${e}:${r}`;
|
|
1151
1044
|
}
|
|
1152
1045
|
/**
|
|
1153
1046
|
* Closes and cleans up any resources associated with the connection. This
|
|
@@ -1183,7 +1076,7 @@ class __PRIVATE_RestConnection {
|
|
|
1183
1076
|
* Important! The names of these identifiers matter because the string forms
|
|
1184
1077
|
* are used for reverse lookups from the webchannel stream. Do NOT change the
|
|
1185
1078
|
* names of these identifiers or change this into a const enum.
|
|
1186
|
-
*/ var
|
|
1079
|
+
*/ var U, j;
|
|
1187
1080
|
|
|
1188
1081
|
/**
|
|
1189
1082
|
* Converts an HTTP Status Code to the equivalent error code.
|
|
@@ -1286,7 +1179,7 @@ function __PRIVATE_mapCodeFromHttpStatus(t) {
|
|
|
1286
1179
|
/**
|
|
1287
1180
|
* A Rest-based connection that relies on the native HTTP stack
|
|
1288
1181
|
* (e.g. `fetch` or a polyfill).
|
|
1289
|
-
*/ (j =
|
|
1182
|
+
*/ (j = U || (U = {}))[j.OK = 0] = "OK", j[j.CANCELLED = 1] = "CANCELLED", j[j.UNKNOWN = 2] = "UNKNOWN",
|
|
1290
1183
|
j[j.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT", j[j.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED",
|
|
1291
1184
|
j[j.NOT_FOUND = 5] = "NOT_FOUND", j[j.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", j[j.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
1292
1185
|
j[j.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", j[j.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
@@ -1364,6 +1257,83 @@ class __PRIVATE_AggregateImpl {
|
|
|
1364
1257
|
}
|
|
1365
1258
|
}
|
|
1366
1259
|
|
|
1260
|
+
/**
|
|
1261
|
+
* @license
|
|
1262
|
+
* Copyright 2020 Google LLC
|
|
1263
|
+
*
|
|
1264
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1265
|
+
* you may not use this file except in compliance with the License.
|
|
1266
|
+
* You may obtain a copy of the License at
|
|
1267
|
+
*
|
|
1268
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1269
|
+
*
|
|
1270
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1271
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1272
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1273
|
+
* See the License for the specific language governing permissions and
|
|
1274
|
+
* limitations under the License.
|
|
1275
|
+
*/
|
|
1276
|
+
/**
|
|
1277
|
+
* Generates `nBytes` of random bytes.
|
|
1278
|
+
*
|
|
1279
|
+
* If `nBytes < 0` , an error will be thrown.
|
|
1280
|
+
*/ function __PRIVATE_randomBytes(t) {
|
|
1281
|
+
// Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
|
|
1282
|
+
const e =
|
|
1283
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1284
|
+
"undefined" != typeof self && (self.crypto || self.msCrypto), r = new Uint8Array(t);
|
|
1285
|
+
if (e && "function" == typeof e.getRandomValues) e.getRandomValues(r); else
|
|
1286
|
+
// Falls back to Math.random
|
|
1287
|
+
for (let e = 0; e < t; e++) r[e] = Math.floor(256 * Math.random());
|
|
1288
|
+
return r;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
/**
|
|
1292
|
+
* @license
|
|
1293
|
+
* Copyright 2017 Google LLC
|
|
1294
|
+
*
|
|
1295
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1296
|
+
* you may not use this file except in compliance with the License.
|
|
1297
|
+
* You may obtain a copy of the License at
|
|
1298
|
+
*
|
|
1299
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1300
|
+
*
|
|
1301
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1302
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1303
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1304
|
+
* See the License for the specific language governing permissions and
|
|
1305
|
+
* limitations under the License.
|
|
1306
|
+
*/
|
|
1307
|
+
/**
|
|
1308
|
+
* A utility class for generating unique alphanumeric IDs of a specified length.
|
|
1309
|
+
*
|
|
1310
|
+
* @internal
|
|
1311
|
+
* Exported internally for testing purposes.
|
|
1312
|
+
*/ class __PRIVATE_AutoId {
|
|
1313
|
+
static newId() {
|
|
1314
|
+
// Alphanumeric characters
|
|
1315
|
+
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = 62 * Math.floor(256 / 62);
|
|
1316
|
+
// The largest byte value that is a multiple of `char.length`.
|
|
1317
|
+
let r = "";
|
|
1318
|
+
for (;r.length < 20; ) {
|
|
1319
|
+
const n = __PRIVATE_randomBytes(40);
|
|
1320
|
+
for (let i = 0; i < n.length; ++i)
|
|
1321
|
+
// Only accept values that are [0, maxMultiple), this ensures they can
|
|
1322
|
+
// be evenly mapped to indices of `chars` via a modulo operation.
|
|
1323
|
+
r.length < 20 && n[i] < e && (r += t.charAt(n[i] % 62));
|
|
1324
|
+
}
|
|
1325
|
+
return r;
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
function __PRIVATE_primitiveComparator(t, e) {
|
|
1330
|
+
return t < e ? -1 : t > e ? 1 : 0;
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
/** Helper to compare arrays using isEqual(). */ function __PRIVATE_arrayEquals(t, e, r) {
|
|
1334
|
+
return t.length === e.length && t.every(((t, n) => r(t, e[n])));
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1367
1337
|
/**
|
|
1368
1338
|
* @license
|
|
1369
1339
|
* Copyright 2017 Google LLC
|
|
@@ -1967,7 +1937,7 @@ function __PRIVATE_valueCompare(t, e) {
|
|
|
1967
1937
|
return __PRIVATE_compareTimestamps(__PRIVATE_getLocalWriteTime(t), __PRIVATE_getLocalWriteTime(e));
|
|
1968
1938
|
|
|
1969
1939
|
case 5 /* TypeOrder.StringValue */ :
|
|
1970
|
-
return
|
|
1940
|
+
return __PRIVATE_primitiveComparator(t.stringValue, e.stringValue);
|
|
1971
1941
|
|
|
1972
1942
|
case 6 /* TypeOrder.BlobValue */ :
|
|
1973
1943
|
return function __PRIVATE_compareBlobs(t, e) {
|
|
@@ -2015,7 +1985,7 @@ function __PRIVATE_valueCompare(t, e) {
|
|
|
2015
1985
|
// canonical IDs are independent of insertion order.
|
|
2016
1986
|
n.sort(), s.sort();
|
|
2017
1987
|
for (let t = 0; t < n.length && t < s.length; ++t) {
|
|
2018
|
-
const e =
|
|
1988
|
+
const e = __PRIVATE_primitiveComparator(n[t], s[t]);
|
|
2019
1989
|
if (0 !== e) return e;
|
|
2020
1990
|
const o = __PRIVATE_valueCompare(r[n[t]], i[s[t]]);
|
|
2021
1991
|
if (0 !== o) return o;
|
|
@@ -3963,7 +3933,7 @@ class __PRIVATE_ExponentialBackoff {
|
|
|
3963
3933
|
* Note that jitter will still be applied, so the actual delay could be as
|
|
3964
3934
|
* much as 1.5*maxDelayMs.
|
|
3965
3935
|
*/ , i = 6e4) {
|
|
3966
|
-
this.L = t, this.timerId = e, this.M = r, this.
|
|
3936
|
+
this.L = t, this.timerId = e, this.M = r, this.k = n, this.U = i, this.j = 0, this.W = null,
|
|
3967
3937
|
/** The last backoff attempt, as epoch milliseconds. */
|
|
3968
3938
|
this.K = Date.now(), this.reset();
|
|
3969
3939
|
}
|
|
@@ -3980,7 +3950,7 @@ class __PRIVATE_ExponentialBackoff {
|
|
|
3980
3950
|
* Resets the backoff delay to the maximum delay (e.g. for use after a
|
|
3981
3951
|
* RESOURCE_EXHAUSTED error).
|
|
3982
3952
|
*/ G() {
|
|
3983
|
-
this.j = this.
|
|
3953
|
+
this.j = this.U;
|
|
3984
3954
|
}
|
|
3985
3955
|
/**
|
|
3986
3956
|
* Returns a promise that resolves after currentDelayMs, and increases the
|
|
@@ -3998,7 +3968,7 @@ class __PRIVATE_ExponentialBackoff {
|
|
|
3998
3968
|
t()))),
|
|
3999
3969
|
// Apply backoff factor to determine next delay and ensure it is within
|
|
4000
3970
|
// bounds.
|
|
4001
|
-
this.j *= this.
|
|
3971
|
+
this.j *= this.k, this.j < this.M && (this.j = this.M), this.j > this.U && (this.j = this.U);
|
|
4002
3972
|
}
|
|
4003
3973
|
Y() {
|
|
4004
3974
|
null !== this.W && (this.W.skipDelay(), this.W = null);
|
|
@@ -4140,7 +4110,7 @@ async function __PRIVATE_invokeRunAggregationQueryRpc(t, e, r) {
|
|
|
4140
4110
|
// Do not include implicit order-bys for aggregate queries.
|
|
4141
4111
|
e.q = __PRIVATE__queryToTarget(e, t.explicitOrderBy)), e.q;
|
|
4142
4112
|
}(e), r);
|
|
4143
|
-
i.connection.
|
|
4113
|
+
i.connection.A || delete s.parent;
|
|
4144
4114
|
const u = (await i.v("RunAggregationQuery", i.serializer.databaseId, a, s,
|
|
4145
4115
|
/*expectedResponseCount=*/ 1)).filter((t => !!t.result));
|
|
4146
4116
|
// Omit RunAggregationQueryResponse that only contain readTimes.
|
|
@@ -4320,7 +4290,7 @@ class Firestore {
|
|
|
4320
4290
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
4321
4291
|
*/
|
|
4322
4292
|
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new FirestoreSettingsImpl({}),
|
|
4323
|
-
this._settingsFrozen = !1,
|
|
4293
|
+
this._settingsFrozen = !1, this._emulatorOptions = {},
|
|
4324
4294
|
// A task that is assigned when the terminate() is invoked and resolved when
|
|
4325
4295
|
// all components have shut down. Otherwise, Firestore is not terminated,
|
|
4326
4296
|
// which can mean either the FirestoreClient is in the process of starting,
|
|
@@ -4342,7 +4312,8 @@ class Firestore {
|
|
|
4342
4312
|
}
|
|
4343
4313
|
_setSettings(t) {
|
|
4344
4314
|
if (this._settingsFrozen) throw new FirestoreError(b, "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.");
|
|
4345
|
-
this._settings = new FirestoreSettingsImpl(t),
|
|
4315
|
+
this._settings = new FirestoreSettingsImpl(t), this._emulatorOptions = t.emulatorOptions || {},
|
|
4316
|
+
void 0 !== t.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(t) {
|
|
4346
4317
|
if (!t) return new __PRIVATE_EmptyAuthCredentialsProvider;
|
|
4347
4318
|
switch (t.type) {
|
|
4348
4319
|
case "firstParty":
|
|
@@ -4359,6 +4330,9 @@ class Firestore {
|
|
|
4359
4330
|
_getSettings() {
|
|
4360
4331
|
return this._settings;
|
|
4361
4332
|
}
|
|
4333
|
+
_getEmulatorOptions() {
|
|
4334
|
+
return this._emulatorOptions;
|
|
4335
|
+
}
|
|
4362
4336
|
_freezeSettings() {
|
|
4363
4337
|
return this._settingsFrozen = !0, this._settings;
|
|
4364
4338
|
}
|
|
@@ -4430,17 +4404,23 @@ function getFirestore(t, r) {
|
|
|
4430
4404
|
* Security Rules.
|
|
4431
4405
|
*/ function connectFirestoreEmulator(t, e, r, n = {}) {
|
|
4432
4406
|
var i;
|
|
4433
|
-
const s = (t = __PRIVATE_cast(t, Firestore))._getSettings(), o =
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4407
|
+
const s = (t = __PRIVATE_cast(t, Firestore))._getSettings(), o = Object.assign(Object.assign({}, s), {
|
|
4408
|
+
emulatorOptions: t._getEmulatorOptions()
|
|
4409
|
+
}), a = `${e}:${r}`;
|
|
4410
|
+
s.host !== ot && s.host !== a && __PRIVATE_logWarn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");
|
|
4411
|
+
const u = Object.assign(Object.assign({}, s), {
|
|
4412
|
+
host: a,
|
|
4413
|
+
ssl: !1,
|
|
4414
|
+
emulatorOptions: n
|
|
4415
|
+
});
|
|
4416
|
+
// No-op if the new configuration matches the current configuration. This supports SSR
|
|
4417
|
+
// enviornments which might call `connectFirestoreEmulator` multiple times as a standard practice.
|
|
4418
|
+
if (!d(u, o) && (t._setSettings(u), n.mockUserToken)) {
|
|
4439
4419
|
let e, r;
|
|
4440
4420
|
if ("string" == typeof n.mockUserToken) e = n.mockUserToken, r = User.MOCK_USER; else {
|
|
4441
4421
|
// Let createMockUserToken validate first (catches common mistakes like
|
|
4442
4422
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
4443
|
-
e =
|
|
4423
|
+
e = f(n.mockUserToken, null === (i = t._app) || void 0 === i ? void 0 : i.options.projectId);
|
|
4444
4424
|
const s = n.mockUserToken.sub || n.mockUserToken.user_id;
|
|
4445
4425
|
if (!s) throw new FirestoreError(p, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
4446
4426
|
r = new User(s);
|
|
@@ -4656,7 +4636,7 @@ class AggregateField {
|
|
|
4656
4636
|
}
|
|
4657
4637
|
|
|
4658
4638
|
function collection(t, e, ...r) {
|
|
4659
|
-
if (t =
|
|
4639
|
+
if (t = E(t), __PRIVATE_validateNonEmptyArgument("collection", "path", e), t instanceof Firestore) {
|
|
4660
4640
|
const n = ResourcePath.fromString(e, ...r);
|
|
4661
4641
|
return __PRIVATE_validateCollectionPath(n), new CollectionReference(t, /* converter= */ null, n);
|
|
4662
4642
|
}
|
|
@@ -4690,7 +4670,7 @@ function collection(t, e, ...r) {
|
|
|
4690
4670
|
}
|
|
4691
4671
|
|
|
4692
4672
|
function doc(t, e, ...r) {
|
|
4693
|
-
if (t =
|
|
4673
|
+
if (t = E(t),
|
|
4694
4674
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
4695
4675
|
// 'undefined' and 'null'.
|
|
4696
4676
|
1 === arguments.length && (e = __PRIVATE_AutoId.newId()), __PRIVATE_validateNonEmptyArgument("doc", "path", e),
|
|
@@ -4714,7 +4694,7 @@ function doc(t, e, ...r) {
|
|
|
4714
4694
|
* @returns true if the references point to the same location in the same
|
|
4715
4695
|
* Firestore database.
|
|
4716
4696
|
*/ function refEqual(t, e) {
|
|
4717
|
-
return t =
|
|
4697
|
+
return t = E(t), e = E(e), (t instanceof DocumentReference || t instanceof CollectionReference) && (e instanceof DocumentReference || e instanceof CollectionReference) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
|
|
4718
4698
|
}
|
|
4719
4699
|
|
|
4720
4700
|
/**
|
|
@@ -4726,7 +4706,7 @@ function doc(t, e, ...r) {
|
|
|
4726
4706
|
* @returns true if the references point to the same location in the same
|
|
4727
4707
|
* Firestore database.
|
|
4728
4708
|
*/ function queryEqual(t, e) {
|
|
4729
|
-
return t =
|
|
4709
|
+
return t = E(t), e = E(e), t instanceof Query && e instanceof Query && (t.firestore === e.firestore && __PRIVATE_queryEquals(t._query, e._query) && t.converter === e.converter);
|
|
4730
4710
|
}
|
|
4731
4711
|
|
|
4732
4712
|
/**
|
|
@@ -5246,7 +5226,7 @@ class __PRIVATE_ArrayUnionFieldValueImpl extends FieldValue {
|
|
|
5246
5226
|
return new FieldTransform(t.path, n);
|
|
5247
5227
|
}
|
|
5248
5228
|
isEqual(t) {
|
|
5249
|
-
return t instanceof __PRIVATE_ArrayUnionFieldValueImpl &&
|
|
5229
|
+
return t instanceof __PRIVATE_ArrayUnionFieldValueImpl && d(this.ft, t.ft);
|
|
5250
5230
|
}
|
|
5251
5231
|
}
|
|
5252
5232
|
|
|
@@ -5260,7 +5240,7 @@ class __PRIVATE_ArrayRemoveFieldValueImpl extends FieldValue {
|
|
|
5260
5240
|
return new FieldTransform(t.path, n);
|
|
5261
5241
|
}
|
|
5262
5242
|
isEqual(t) {
|
|
5263
|
-
return t instanceof __PRIVATE_ArrayRemoveFieldValueImpl &&
|
|
5243
|
+
return t instanceof __PRIVATE_ArrayRemoveFieldValueImpl && d(this.ft, t.ft);
|
|
5264
5244
|
}
|
|
5265
5245
|
}
|
|
5266
5246
|
|
|
@@ -5285,7 +5265,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
|
|
|
5285
5265
|
const a = __PRIVATE_fieldPathFromDotSeparatedString(e, t, r);
|
|
5286
5266
|
// For Compat types, we have to "extract" the underlying types before
|
|
5287
5267
|
// performing validation.
|
|
5288
|
-
n =
|
|
5268
|
+
n = E(n);
|
|
5289
5269
|
const u = i.ut(a);
|
|
5290
5270
|
if (n instanceof __PRIVATE_DeleteFieldValueImpl)
|
|
5291
5271
|
// Add it to the field mask, but don't add anything to updateData.
|
|
@@ -5311,7 +5291,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
|
|
|
5311
5291
|
let r = u[t];
|
|
5312
5292
|
// For Compat types, we have to "extract" the underlying types before
|
|
5313
5293
|
// performing validation.
|
|
5314
|
-
r =
|
|
5294
|
+
r = E(r);
|
|
5315
5295
|
const n = o.ut(e);
|
|
5316
5296
|
if (r instanceof __PRIVATE_DeleteFieldValueImpl)
|
|
5317
5297
|
// Add it to the field mask, but don't add anything to updateData.
|
|
@@ -5346,7 +5326,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
|
|
|
5346
5326
|
if (__PRIVATE_looksLikeJsonObject(
|
|
5347
5327
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
5348
5328
|
// from firestore-exp.
|
|
5349
|
-
t =
|
|
5329
|
+
t = E(t))) return __PRIVATE_validatePlainObject("Unsupported field value:", e, t),
|
|
5350
5330
|
__PRIVATE_parseObject(t, e);
|
|
5351
5331
|
if (t instanceof FieldValue)
|
|
5352
5332
|
// FieldValues usually parse into transforms (except deleteField())
|
|
@@ -5406,7 +5386,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
|
|
|
5406
5386
|
}(t, e);
|
|
5407
5387
|
}
|
|
5408
5388
|
return function __PRIVATE_parseScalarValue(t, e) {
|
|
5409
|
-
if (null === (t =
|
|
5389
|
+
if (null === (t = E(t))) return {
|
|
5410
5390
|
nullValue: "NULL_VALUE"
|
|
5411
5391
|
};
|
|
5412
5392
|
if ("number" == typeof t) return toNumber(e.serializer, t);
|
|
@@ -5519,7 +5499,7 @@ function __PRIVATE_validatePlainObject(t, e, r) {
|
|
|
5519
5499
|
if ((
|
|
5520
5500
|
// If required, replace the FieldPath Compat class with the firestore-exp
|
|
5521
5501
|
// FieldPath.
|
|
5522
|
-
e =
|
|
5502
|
+
e = E(e)) instanceof FieldPath) return e._internalPath;
|
|
5523
5503
|
if ("string" == typeof e) return __PRIVATE_fieldPathFromDotSeparatedString(t, e);
|
|
5524
5504
|
throw __PRIVATE_createError("Field path arguments must be of type string or ", t,
|
|
5525
5505
|
/* hasConverter= */ !1,
|
|
@@ -5710,7 +5690,7 @@ function __PRIVATE_createError(t, e, r, n, i) {
|
|
|
5710
5690
|
* @param right - A snapshot to compare.
|
|
5711
5691
|
* @returns true if the snapshots are equal.
|
|
5712
5692
|
*/ function snapshotEqual(t, e) {
|
|
5713
|
-
return t =
|
|
5693
|
+
return t = E(t), e = E(e), t instanceof DocumentSnapshot && e instanceof DocumentSnapshot ? 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 QuerySnapshot && e instanceof QuerySnapshot && (queryEqual(t.query, e.query) && __PRIVATE_arrayEquals(t.docs, e.docs, snapshotEqual));
|
|
5714
5694
|
}
|
|
5715
5695
|
|
|
5716
5696
|
/**
|
|
@@ -6097,7 +6077,7 @@ function endAt(...t) {
|
|
|
6097
6077
|
}
|
|
6098
6078
|
|
|
6099
6079
|
/** Helper function to create a bound from a document or fields */ function __PRIVATE_newQueryBoundFromDocOrFields(t, e, r, n) {
|
|
6100
|
-
if (r[0] =
|
|
6080
|
+
if (r[0] = E(r[0]), r[0] instanceof DocumentSnapshot) return function __PRIVATE_newQueryBoundFromDocument(t, e, r, n, i) {
|
|
6101
6081
|
if (!n) throw new FirestoreError(w, `Can't use a DocumentSnapshot that doesn't exist for ${r}().`);
|
|
6102
6082
|
const s = [];
|
|
6103
6083
|
// Because people expect to continue/end a query at the exact document
|
|
@@ -6153,7 +6133,7 @@ function endAt(...t) {
|
|
|
6153
6133
|
}
|
|
6154
6134
|
|
|
6155
6135
|
function __PRIVATE_parseDocumentIdValue(t, e, r) {
|
|
6156
|
-
if ("string" == typeof (r =
|
|
6136
|
+
if ("string" == typeof (r = E(r))) {
|
|
6157
6137
|
if ("" === r) throw new FirestoreError(p, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
6158
6138
|
if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== r.indexOf("/")) throw new FirestoreError(p, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${r}' contains a '/' character.`);
|
|
6159
6139
|
const n = e.path.child(ResourcePath.fromString(r));
|
|
@@ -6407,7 +6387,7 @@ function updateDoc(t, e, r, ...n) {
|
|
|
6407
6387
|
// For Compat types, we have to "extract" the underlying types before
|
|
6408
6388
|
// performing validation.
|
|
6409
6389
|
let s;
|
|
6410
|
-
s = "string" == typeof (e =
|
|
6390
|
+
s = "string" == typeof (e = E(e)) || e instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(i, "updateDoc", t._key, e, r, n) : __PRIVATE_parseUpdateData(i, "updateDoc", t._key, e);
|
|
6411
6391
|
return __PRIVATE_invokeCommitRpc(__PRIVATE_getDatastore(t.firestore), [ s.toMutation(t._key, Precondition.exists(!0)) ]);
|
|
6412
6392
|
}
|
|
6413
6393
|
|
|
@@ -6564,7 +6544,7 @@ function sum(t) {
|
|
|
6564
6544
|
* @returns `true` if the objects are "equal", as defined above, or `false`
|
|
6565
6545
|
* otherwise.
|
|
6566
6546
|
*/ function aggregateQuerySnapshotEqual(t, e) {
|
|
6567
|
-
return queryEqual(t.query, e.query) &&
|
|
6547
|
+
return queryEqual(t.query, e.query) && d(t.data(), e.data());
|
|
6568
6548
|
}
|
|
6569
6549
|
|
|
6570
6550
|
/**
|
|
@@ -6702,7 +6682,7 @@ function sum(t) {
|
|
|
6702
6682
|
// For Compat types, we have to "extract" the underlying types before
|
|
6703
6683
|
// performing validation.
|
|
6704
6684
|
let s;
|
|
6705
|
-
return s = "string" == typeof (e =
|
|
6685
|
+
return s = "string" == typeof (e = E(e)) || e instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(this._dataReader, "WriteBatch.update", i._key, e, r, n) : __PRIVATE_parseUpdateData(this._dataReader, "WriteBatch.update", i._key, e),
|
|
6706
6686
|
this._mutations.push(s.toMutation(i._key, Precondition.exists(!0))), this;
|
|
6707
6687
|
}
|
|
6708
6688
|
/**
|
|
@@ -6736,7 +6716,7 @@ function sum(t) {
|
|
|
6736
6716
|
}
|
|
6737
6717
|
|
|
6738
6718
|
function __PRIVATE_validateReference(t, e) {
|
|
6739
|
-
if ((t =
|
|
6719
|
+
if ((t = E(t)).firestore !== e) throw new FirestoreError(p, "Provided document reference is from a different Firestore instance.");
|
|
6740
6720
|
return t;
|
|
6741
6721
|
}
|
|
6742
6722
|
|
|
@@ -6922,13 +6902,13 @@ function __PRIVATE_validateReference(t, e) {
|
|
|
6922
6902
|
class __PRIVATE_TransactionRunner {
|
|
6923
6903
|
constructor(t, e, r, n, i) {
|
|
6924
6904
|
this.asyncQueue = t, this.datastore = e, this.options = r, this.updateFunction = n,
|
|
6925
|
-
this.deferred = i, this.
|
|
6905
|
+
this.deferred = i, this.At = r.maxAttempts, this.Tt = new __PRIVATE_ExponentialBackoff(this.asyncQueue, "transaction_retry" /* TimerId.TransactionRetry */);
|
|
6926
6906
|
}
|
|
6927
6907
|
/** Runs the transaction and sets the result on deferred. */ Pt() {
|
|
6928
|
-
this.
|
|
6908
|
+
this.At -= 1, this.Rt();
|
|
6929
6909
|
}
|
|
6930
6910
|
Rt() {
|
|
6931
|
-
this.
|
|
6911
|
+
this.Tt.H((async () => {
|
|
6932
6912
|
const t = new Transaction$1(this.datastore), e = this.Vt(t);
|
|
6933
6913
|
e && e.then((e => {
|
|
6934
6914
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
@@ -6952,7 +6932,7 @@ class __PRIVATE_TransactionRunner {
|
|
|
6952
6932
|
}
|
|
6953
6933
|
}
|
|
6954
6934
|
It(t) {
|
|
6955
|
-
this.
|
|
6935
|
+
this.At > 0 && this.yt(t) ? (this.At -= 1, this.asyncQueue.enqueueAndForget((() => (this.Rt(),
|
|
6956
6936
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
6957
6937
|
}
|
|
6958
6938
|
yt(t) {
|
|
@@ -7152,14 +7132,14 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7152
7132
|
// List of TimerIds to fast-forward delays for.
|
|
7153
7133
|
this.Ct = [],
|
|
7154
7134
|
// Backoff timer used to schedule retries for retryable operations
|
|
7155
|
-
this.
|
|
7135
|
+
this.Tt = new __PRIVATE_ExponentialBackoff(this, "async_queue_retry" /* TimerId.AsyncQueueRetry */),
|
|
7156
7136
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
7157
7137
|
// operations. Meant to speed up recovery when we regain file system access
|
|
7158
7138
|
// after page comes into foreground.
|
|
7159
7139
|
this.St = () => {
|
|
7160
7140
|
const t = getDocument();
|
|
7161
7141
|
t && __PRIVATE_logDebug(lt, "Visibility state changed to " + t.visibilityState),
|
|
7162
|
-
this.
|
|
7142
|
+
this.Tt.Y();
|
|
7163
7143
|
}, this.Nt = t;
|
|
7164
7144
|
const e = getDocument();
|
|
7165
7145
|
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.St);
|
|
@@ -7206,7 +7186,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7206
7186
|
*/ async Bt() {
|
|
7207
7187
|
if (0 !== this.wt.length) {
|
|
7208
7188
|
try {
|
|
7209
|
-
await this.wt[0](), this.wt.shift(), this.
|
|
7189
|
+
await this.wt[0](), this.wt.shift(), this.Tt.reset();
|
|
7210
7190
|
} catch (t) {
|
|
7211
7191
|
if (!
|
|
7212
7192
|
/**
|
|
@@ -7245,7 +7225,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7245
7225
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
7246
7226
|
// new backoff on every call, there is only ever a single additional
|
|
7247
7227
|
// operation in the queue.
|
|
7248
|
-
this.
|
|
7228
|
+
this.Tt.H((() => this.Bt()));
|
|
7249
7229
|
}
|
|
7250
7230
|
}
|
|
7251
7231
|
qt(t) {
|
|
@@ -7331,7 +7311,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7331
7311
|
* @param lastTimerId - Delayed operations up to and including this TimerId
|
|
7332
7312
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
7333
7313
|
* @returns a Promise that resolves once all operations have been run.
|
|
7334
|
-
*/
|
|
7314
|
+
*/ Mt(t) {
|
|
7335
7315
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
7336
7316
|
return this.Qt().then((() => {
|
|
7337
7317
|
// Run ops in the same order they'd run if they ran naturally.
|
|
@@ -7343,7 +7323,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7343
7323
|
}
|
|
7344
7324
|
/**
|
|
7345
7325
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
7346
|
-
*/
|
|
7326
|
+
*/ xt(t) {
|
|
7347
7327
|
this.Ct.push(t);
|
|
7348
7328
|
}
|
|
7349
7329
|
/** Called once a DelayedOperation is run or canceled. */ $t(t) {
|
|
@@ -7382,7 +7362,7 @@ class Transaction {
|
|
|
7382
7362
|
// For Compat types, we have to "extract" the underlying types before
|
|
7383
7363
|
// performing validation.
|
|
7384
7364
|
let s;
|
|
7385
|
-
return s = "string" == typeof (e =
|
|
7365
|
+
return s = "string" == typeof (e = E(e)) || e instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(this._dataReader, "Transaction.update", i._key, e, r, n) : __PRIVATE_parseUpdateData(this._dataReader, "Transaction.update", i._key, e),
|
|
7386
7366
|
this._transaction.update(i._key, s), this;
|
|
7387
7367
|
}
|
|
7388
7368
|
/**
|
|
@@ -7434,7 +7414,7 @@ class Transaction {
|
|
|
7434
7414
|
* @packageDocumentation
|
|
7435
7415
|
*/ !function __PRIVATE_registerFirestore() {
|
|
7436
7416
|
!function __PRIVATE_setSDKVersion(t) {
|
|
7437
|
-
|
|
7417
|
+
T = t;
|
|
7438
7418
|
}(`${s}_lite`), n(new o("firestore/lite", ((t, {instanceIdentifier: e, options: r}) => {
|
|
7439
7419
|
const n = t.getProvider("app").getImmediate(), i = new Firestore(new __PRIVATE_LiteAuthCredentialsProvider(t.getProvider("auth-internal")), new __PRIVATE_LiteAppCheckTokenProvider(n, t.getProvider("app-check-internal")), function __PRIVATE_databaseIdFromApp(t, e) {
|
|
7440
7420
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new FirestoreError(p, '"projectId" not provided in firebase.initializeApp.');
|
|
@@ -7443,7 +7423,7 @@ class Transaction {
|
|
|
7443
7423
|
return r && i._setSettings(r), i;
|
|
7444
7424
|
}), "PUBLIC").setMultipleInstances(!0)),
|
|
7445
7425
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
7446
|
-
i("firestore-lite",
|
|
7426
|
+
i("firestore-lite", A, "rn"), i("firestore-lite", A, "esm2017");
|
|
7447
7427
|
}();
|
|
7448
7428
|
|
|
7449
7429
|
export { AggregateField, AggregateQuerySnapshot, Bytes, CollectionReference, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Firestore, FirestoreError, GeoPoint, Query, QueryCompositeFilterConstraint, QueryConstraint, QueryDocumentSnapshot, QueryEndAtConstraint, QueryFieldFilterConstraint, QueryLimitConstraint, QueryOrderByConstraint, QuerySnapshot, QueryStartAtConstraint, Timestamp, Transaction, VectorValue, WriteBatch, addDoc, aggregateFieldEqual, aggregateQuerySnapshotEqual, and, arrayRemove, arrayUnion, average, collection, collectionGroup, connectFirestoreEmulator, count, deleteDoc, deleteField, doc, documentId, endAt, endBefore, getAggregate, getCount, getDoc, getDocs, getFirestore, increment, initializeFirestore, limit, limitToLast, or, orderBy, query, queryEqual, refEqual, runTransaction, serverTimestamp, setDoc, setLogLevel, snapshotEqual, startAfter, startAt, sum, terminate, updateDoc, vector, where, writeBatch };
|