@firebase/firestore 4.7.7-canary.4e6a5c670 → 4.7.7-canary.604133f8d

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.
Files changed (38) hide show
  1. package/dist/firestore/src/global_index.d.ts +9 -2
  2. package/dist/firestore/src/lite-api/database.d.ts +4 -0
  3. package/dist/firestore/src/lite-api/settings.d.ts +4 -0
  4. package/dist/firestore/src/lite-api/vector_value.d.ts +2 -2
  5. package/dist/firestore/src/util/misc.d.ts +0 -2
  6. package/dist/firestore/test/integration/util/settings.d.ts +1 -0
  7. package/dist/index.cjs.js +245 -243
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.esm2017.js +246 -244
  11. package/dist/index.esm2017.js.map +1 -1
  12. package/dist/index.node.cjs.js +56 -55
  13. package/dist/index.node.cjs.js.map +1 -1
  14. package/dist/index.node.mjs +57 -56
  15. package/dist/index.node.mjs.map +1 -1
  16. package/dist/index.rn.js +198 -196
  17. package/dist/index.rn.js.map +1 -1
  18. package/dist/internal.d.ts +9 -2
  19. package/dist/lite/firestore/src/lite-api/database.d.ts +4 -0
  20. package/dist/lite/firestore/src/lite-api/settings.d.ts +4 -0
  21. package/dist/lite/firestore/src/lite-api/vector_value.d.ts +2 -2
  22. package/dist/lite/firestore/src/util/misc.d.ts +0 -2
  23. package/dist/lite/firestore/test/integration/util/settings.d.ts +1 -0
  24. package/dist/lite/index.browser.esm2017.js +148 -168
  25. package/dist/lite/index.browser.esm2017.js.map +1 -1
  26. package/dist/lite/index.cjs.js +148 -168
  27. package/dist/lite/index.cjs.js.map +1 -1
  28. package/dist/lite/index.d.ts +2 -2
  29. package/dist/lite/index.node.cjs.js +112 -130
  30. package/dist/lite/index.node.cjs.js.map +1 -1
  31. package/dist/lite/index.node.mjs +113 -131
  32. package/dist/lite/index.node.mjs.map +1 -1
  33. package/dist/lite/index.rn.esm2017.js +161 -181
  34. package/dist/lite/index.rn.esm2017.js.map +1 -1
  35. package/dist/lite/internal.d.ts +9 -2
  36. package/dist/lite/private.d.ts +6 -2
  37. package/dist/private.d.ts +6 -2
  38. package/package.json +9 -9
@@ -1,10 +1,10 @@
1
1
  import { _registerComponent, registerVersion, _isFirebaseServerApp, _getProvider, getApp, _removeServiceInstance, SDK_VERSION } from '@firebase/app';
2
2
  import { Component } from '@firebase/component';
3
3
  import { Logger, LogLevel } from '@firebase/logger';
4
- import { FirebaseError, getDefaultEmulatorHostnameAndPort, createMockUserToken, getModularInstance, deepEqual } from '@firebase/util';
4
+ import { FirebaseError, getDefaultEmulatorHostnameAndPort, deepEqual, createMockUserToken, getModularInstance } from '@firebase/util';
5
5
  import { Integer } from '@firebase/webchannel-wrapper/bloom-blob';
6
6
 
7
- const E = "4.7.7-canary.4e6a5c670";
7
+ const E = "4.7.7-canary.604133f8d";
8
8
 
9
9
  /**
10
10
  * @license
@@ -65,7 +65,7 @@ User.MOCK_USER = new User("mock-user");
65
65
  * See the License for the specific language governing permissions and
66
66
  * limitations under the License.
67
67
  */
68
- let m = "11.3.0-canary.4e6a5c670";
68
+ let m = "11.3.0-canary.604133f8d";
69
69
 
70
70
  /**
71
71
  * @license
@@ -83,7 +83,7 @@ let m = "11.3.0-canary.4e6a5c670";
83
83
  * See the License for the specific language governing permissions and
84
84
  * limitations under the License.
85
85
  */
86
- const T = new Logger("@firebase/firestore");
86
+ const A = new Logger("@firebase/firestore");
87
87
 
88
88
  /**
89
89
  * Sets the verbosity of Cloud Firestore logs (debug, error, or silent).
@@ -98,29 +98,29 @@ const T = new Logger("@firebase/firestore");
98
98
  * <li><code>`silent` to turn off logging.</li>
99
99
  * </ul>
100
100
  */ function setLogLevel(t) {
101
- T.setLogLevel(t);
101
+ A.setLogLevel(t);
102
102
  }
103
103
 
104
104
  function __PRIVATE_logDebug(t, ...e) {
105
- if (T.logLevel <= LogLevel.DEBUG) {
105
+ if (A.logLevel <= LogLevel.DEBUG) {
106
106
  const r = e.map(__PRIVATE_argToString);
107
- T.debug(`Firestore (${m}): ${t}`, ...r);
107
+ A.debug(`Firestore (${m}): ${t}`, ...r);
108
108
  }
109
109
  }
110
110
 
111
111
  function __PRIVATE_logError(t, ...e) {
112
- if (T.logLevel <= LogLevel.ERROR) {
112
+ if (A.logLevel <= LogLevel.ERROR) {
113
113
  const r = e.map(__PRIVATE_argToString);
114
- T.error(`Firestore (${m}): ${t}`, ...r);
114
+ A.error(`Firestore (${m}): ${t}`, ...r);
115
115
  }
116
116
  }
117
117
 
118
118
  /**
119
119
  * @internal
120
120
  */ function __PRIVATE_logWarn(t, ...e) {
121
- if (T.logLevel <= LogLevel.WARN) {
121
+ if (A.logLevel <= LogLevel.WARN) {
122
122
  const r = e.map(__PRIVATE_argToString);
123
- T.warn(`Firestore (${m}): ${t}`, ...r);
123
+ A.warn(`Firestore (${m}): ${t}`, ...r);
124
124
  }
125
125
  }
126
126
 
@@ -221,7 +221,7 @@ e) {
221
221
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
222
222
  * See the License for the specific language governing permissions and
223
223
  * limitations under the License.
224
- */ const A = "ok", P = "cancelled", R = "unknown", I = "invalid-argument", V = "deadline-exceeded", p = "not-found", y = "already-exists", w = "permission-denied", g = "unauthenticated", F = "resource-exhausted", v = "failed-precondition", D = "aborted", b = "out-of-range", C = "unimplemented", S = "internal", N = "unavailable", O = "data-loss";
224
+ */ const T = "ok", P = "cancelled", R = "unknown", I = "invalid-argument", V = "deadline-exceeded", p = "not-found", y = "already-exists", w = "permission-denied", g = "unauthenticated", F = "resource-exhausted", v = "failed-precondition", D = "aborted", b = "out-of-range", C = "unimplemented", S = "internal", N = "unavailable", O = "data-loss";
225
225
 
226
226
  /** An error returned by a Firestore operation. */ class FirestoreError extends FirebaseError {
227
227
  /** @hideconstructor */
@@ -476,60 +476,6 @@ class DatabaseInfo {
476
476
  }
477
477
  }
478
478
 
479
- /**
480
- * @license
481
- * Copyright 2020 Google LLC
482
- *
483
- * Licensed under the Apache License, Version 2.0 (the "License");
484
- * you may not use this file except in compliance with the License.
485
- * You may obtain a copy of the License at
486
- *
487
- * http://www.apache.org/licenses/LICENSE-2.0
488
- *
489
- * Unless required by applicable law or agreed to in writing, software
490
- * distributed under the License is distributed on an "AS IS" BASIS,
491
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
492
- * See the License for the specific language governing permissions and
493
- * limitations under the License.
494
- */
495
- /**
496
- * Generates `nBytes` of random bytes.
497
- *
498
- * If `nBytes < 0` , an error will be thrown.
499
- */
500
- function __PRIVATE_randomBytes(t) {
501
- // Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
502
- const e =
503
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
504
- "undefined" != typeof self && (self.crypto || self.msCrypto), r = new Uint8Array(t);
505
- if (e && "function" == typeof e.getRandomValues) e.getRandomValues(r); else
506
- // Falls back to Math.random
507
- for (let e = 0; e < t; e++) r[e] = Math.floor(256 * Math.random());
508
- return r;
509
- }
510
-
511
- /**
512
- * @license
513
- * Copyright 2023 Google LLC
514
- *
515
- * Licensed under the Apache License, Version 2.0 (the "License");
516
- * you may not use this file except in compliance with the License.
517
- * You may obtain a copy of the License at
518
- *
519
- * http://www.apache.org/licenses/LICENSE-2.0
520
- *
521
- * Unless required by applicable law or agreed to in writing, software
522
- * distributed under the License is distributed on an "AS IS" BASIS,
523
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
524
- * See the License for the specific language governing permissions and
525
- * limitations under the License.
526
- */
527
- /**
528
- * An instance of the Platform's 'TextEncoder' implementation.
529
- */ function __PRIVATE_newTextEncoder() {
530
- return new TextEncoder;
531
- }
532
-
533
479
  /**
534
480
  * @license
535
481
  * Copyright 2017 Google LLC
@@ -546,62 +492,7 @@ function __PRIVATE_randomBytes(t) {
546
492
  * See the License for the specific language governing permissions and
547
493
  * limitations under the License.
548
494
  */
549
- /**
550
- * A utility class for generating unique alphanumeric IDs of a specified length.
551
- *
552
- * @internal
553
- * Exported internally for testing purposes.
554
- */ class __PRIVATE_AutoId {
555
- static newId() {
556
- // Alphanumeric characters
557
- const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = 62 * Math.floor(256 / 62);
558
- // The largest byte value that is a multiple of `char.length`.
559
- let r = "";
560
- for (;r.length < 20; ) {
561
- const n = __PRIVATE_randomBytes(40);
562
- for (let i = 0; i < n.length; ++i)
563
- // Only accept values that are [0, maxMultiple), this ensures they can
564
- // be evenly mapped to indices of `chars` via a modulo operation.
565
- r.length < 20 && n[i] < e && (r += t.charAt(n[i] % 62));
566
- }
567
- return r;
568
- }
569
- }
570
-
571
- function __PRIVATE_primitiveComparator(t, e) {
572
- return t < e ? -1 : t > e ? 1 : 0;
573
- }
574
-
575
- /** Compare strings in UTF-8 encoded byte order */ function __PRIVATE_compareUtf8Strings(t, e) {
576
- // Convert the string to UTF-8 encoded bytes
577
- const r = __PRIVATE_newTextEncoder().encode(t), n = __PRIVATE_newTextEncoder().encode(e);
578
- for (let t = 0; t < Math.min(r.length, n.length); t++) {
579
- const e = __PRIVATE_primitiveComparator(r[t], n[t]);
580
- if (0 !== e) return e;
581
- }
582
- return __PRIVATE_primitiveComparator(r.length, n.length);
583
- }
584
-
585
- /** Helper to compare arrays using isEqual(). */ function __PRIVATE_arrayEquals(t, e, r) {
586
- return t.length === e.length && t.every(((t, n) => r(t, e[n])));
587
- }
588
-
589
- /**
590
- * @license
591
- * Copyright 2017 Google LLC
592
- *
593
- * Licensed under the Apache License, Version 2.0 (the "License");
594
- * you may not use this file except in compliance with the License.
595
- * You may obtain a copy of the License at
596
- *
597
- * http://www.apache.org/licenses/LICENSE-2.0
598
- *
599
- * Unless required by applicable law or agreed to in writing, software
600
- * distributed under the License is distributed on an "AS IS" BASIS,
601
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
602
- * See the License for the specific language governing permissions and
603
- * limitations under the License.
604
- */ const B = "__name__";
495
+ const B = "__name__";
605
496
 
606
497
  /**
607
498
  * Path represents an ordered sequence of string segments.
@@ -669,11 +560,13 @@ function __PRIVATE_primitiveComparator(t, e) {
669
560
  const r = BasePath.compareSegments(t.get(n), e.get(n));
670
561
  if (0 !== r) return r;
671
562
  }
672
- return __PRIVATE_primitiveComparator(t.length, e.length);
563
+ return Math.sign(t.length - e.length);
673
564
  }
674
565
  static compareSegments(t, e) {
675
566
  const r = BasePath.isNumericId(t), n = BasePath.isNumericId(e);
676
- return r && !n ? -1 : !r && n ? 1 : r && n ? BasePath.extractNumericId(t).compare(BasePath.extractNumericId(e)) : __PRIVATE_compareUtf8Strings(t, e);
567
+ return r && !n ? -1 : !r && n ? 1 : r && n ? BasePath.extractNumericId(t).compare(BasePath.extractNumericId(e)) :
568
+ // both non-numeric
569
+ t < e ? -1 : t > e ? 1 : 0;
677
570
  }
678
571
  // Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
679
572
  static isNumericId(t) {
@@ -1079,7 +972,7 @@ function __PRIVATE_generateUniqueDebugId() {
1079
972
  * See the License for the specific language governing permissions and
1080
973
  * limitations under the License.
1081
974
  */
1082
- const L = "RestConnection", x = {
975
+ const L = "RestConnection", M = {
1083
976
  BatchGetDocuments: "batchGet",
1084
977
  Commit: "commit",
1085
978
  RunQuery: "runQuery",
@@ -1096,7 +989,7 @@ const L = "RestConnection", x = {
1096
989
  * HTTP).
1097
990
  */
1098
991
  class __PRIVATE_RestConnection {
1099
- get T() {
992
+ get A() {
1100
993
  // Both `invokeRPC()` and `invokeStreamingRPC()` use their `path` arguments to determine
1101
994
  // where to run the query, and expect the `request` to NOT specify the "path".
1102
995
  return !1;
@@ -1104,7 +997,7 @@ class __PRIVATE_RestConnection {
1104
997
  constructor(t) {
1105
998
  this.databaseInfo = t, this.databaseId = t.databaseId;
1106
999
  const e = t.ssl ? "https" : "http", r = encodeURIComponent(this.databaseId.projectId), n = encodeURIComponent(this.databaseId.database);
1107
- this.A = e + "://" + t.host, this.P = `projects/${r}/databases/${n}`, this.R = this.databaseId.database === q ? `project_id=${r}` : `project_id=${r}&database_id=${n}`;
1000
+ this.T = e + "://" + t.host, this.P = `projects/${r}/databases/${n}`, this.R = this.databaseId.database === q ? `project_id=${r}` : `project_id=${r}&database_id=${n}`;
1108
1001
  }
1109
1002
  I(t, e, r, n, i) {
1110
1003
  const s = __PRIVATE_generateUniqueDebugId(), o = this.V(t, e.toUriEncodedString());
@@ -1142,8 +1035,8 @@ class __PRIVATE_RestConnection {
1142
1035
  e && e.headers.forEach(((e, r) => t[r] = e)), r && r.headers.forEach(((e, r) => t[r] = e));
1143
1036
  }
1144
1037
  V(t, e) {
1145
- const r = x[t];
1146
- return `${this.A}/v1/${e}:${r}`;
1038
+ const r = M[t];
1039
+ return `${this.T}/v1/${e}:${r}`;
1147
1040
  }
1148
1041
  /**
1149
1042
  * Closes and cleans up any resources associated with the connection. This
@@ -1179,7 +1072,7 @@ class __PRIVATE_RestConnection {
1179
1072
  * Important! The names of these identifiers matter because the string forms
1180
1073
  * are used for reverse lookups from the webchannel stream. Do NOT change the
1181
1074
  * names of these identifiers or change this into a const enum.
1182
- */ var M, U;
1075
+ */ var x, k;
1183
1076
 
1184
1077
  /**
1185
1078
  * Converts an HTTP Status Code to the equivalent error code.
@@ -1200,7 +1093,7 @@ function __PRIVATE_mapCodeFromHttpStatus(t) {
1200
1093
  switch (t) {
1201
1094
  case 200:
1202
1095
  // OK
1203
- return A;
1096
+ return T;
1204
1097
 
1205
1098
  case 400:
1206
1099
  // Bad Request
@@ -1259,7 +1152,7 @@ function __PRIVATE_mapCodeFromHttpStatus(t) {
1259
1152
  return V;
1260
1153
 
1261
1154
  default:
1262
- return t >= 200 && t < 300 ? A : t >= 400 && t < 500 ? v : t >= 500 && t < 600 ? S : R;
1155
+ return t >= 200 && t < 300 ? T : t >= 400 && t < 500 ? v : t >= 500 && t < 600 ? S : R;
1263
1156
  }
1264
1157
  }
1265
1158
 
@@ -1282,13 +1175,13 @@ function __PRIVATE_mapCodeFromHttpStatus(t) {
1282
1175
  /**
1283
1176
  * A Rest-based connection that relies on the native HTTP stack
1284
1177
  * (e.g. `fetch` or a polyfill).
1285
- */ (U = M || (M = {}))[U.OK = 0] = "OK", U[U.CANCELLED = 1] = "CANCELLED", U[U.UNKNOWN = 2] = "UNKNOWN",
1286
- U[U.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT", U[U.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED",
1287
- U[U.NOT_FOUND = 5] = "NOT_FOUND", U[U.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", U[U.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
1288
- U[U.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", U[U.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
1289
- U[U.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", U[U.ABORTED = 10] = "ABORTED",
1290
- U[U.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", U[U.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
1291
- U[U.INTERNAL = 13] = "INTERNAL", U[U.UNAVAILABLE = 14] = "UNAVAILABLE", U[U.DATA_LOSS = 15] = "DATA_LOSS";
1178
+ */ (k = x || (x = {}))[k.OK = 0] = "OK", k[k.CANCELLED = 1] = "CANCELLED", k[k.UNKNOWN = 2] = "UNKNOWN",
1179
+ k[k.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT", k[k.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED",
1180
+ k[k.NOT_FOUND = 5] = "NOT_FOUND", k[k.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", k[k.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
1181
+ k[k.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", k[k.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
1182
+ k[k.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", k[k.ABORTED = 10] = "ABORTED",
1183
+ k[k.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", k[k.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
1184
+ k[k.INTERNAL = 13] = "INTERNAL", k[k.UNAVAILABLE = 14] = "UNAVAILABLE", k[k.DATA_LOSS = 15] = "DATA_LOSS";
1292
1185
 
1293
1186
  class __PRIVATE_FetchConnection extends __PRIVATE_RestConnection {
1294
1187
  D(t, e) {
@@ -1360,6 +1253,83 @@ class __PRIVATE_AggregateImpl {
1360
1253
  }
1361
1254
  }
1362
1255
 
1256
+ /**
1257
+ * @license
1258
+ * Copyright 2020 Google LLC
1259
+ *
1260
+ * Licensed under the Apache License, Version 2.0 (the "License");
1261
+ * you may not use this file except in compliance with the License.
1262
+ * You may obtain a copy of the License at
1263
+ *
1264
+ * http://www.apache.org/licenses/LICENSE-2.0
1265
+ *
1266
+ * Unless required by applicable law or agreed to in writing, software
1267
+ * distributed under the License is distributed on an "AS IS" BASIS,
1268
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1269
+ * See the License for the specific language governing permissions and
1270
+ * limitations under the License.
1271
+ */
1272
+ /**
1273
+ * Generates `nBytes` of random bytes.
1274
+ *
1275
+ * If `nBytes < 0` , an error will be thrown.
1276
+ */ function __PRIVATE_randomBytes(t) {
1277
+ // Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
1278
+ const e =
1279
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1280
+ "undefined" != typeof self && (self.crypto || self.msCrypto), r = new Uint8Array(t);
1281
+ if (e && "function" == typeof e.getRandomValues) e.getRandomValues(r); else
1282
+ // Falls back to Math.random
1283
+ for (let e = 0; e < t; e++) r[e] = Math.floor(256 * Math.random());
1284
+ return r;
1285
+ }
1286
+
1287
+ /**
1288
+ * @license
1289
+ * Copyright 2017 Google LLC
1290
+ *
1291
+ * Licensed under the Apache License, Version 2.0 (the "License");
1292
+ * you may not use this file except in compliance with the License.
1293
+ * You may obtain a copy of the License at
1294
+ *
1295
+ * http://www.apache.org/licenses/LICENSE-2.0
1296
+ *
1297
+ * Unless required by applicable law or agreed to in writing, software
1298
+ * distributed under the License is distributed on an "AS IS" BASIS,
1299
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1300
+ * See the License for the specific language governing permissions and
1301
+ * limitations under the License.
1302
+ */
1303
+ /**
1304
+ * A utility class for generating unique alphanumeric IDs of a specified length.
1305
+ *
1306
+ * @internal
1307
+ * Exported internally for testing purposes.
1308
+ */ class __PRIVATE_AutoId {
1309
+ static newId() {
1310
+ // Alphanumeric characters
1311
+ const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = 62 * Math.floor(256 / 62);
1312
+ // The largest byte value that is a multiple of `char.length`.
1313
+ let r = "";
1314
+ for (;r.length < 20; ) {
1315
+ const n = __PRIVATE_randomBytes(40);
1316
+ for (let i = 0; i < n.length; ++i)
1317
+ // Only accept values that are [0, maxMultiple), this ensures they can
1318
+ // be evenly mapped to indices of `chars` via a modulo operation.
1319
+ r.length < 20 && n[i] < e && (r += t.charAt(n[i] % 62));
1320
+ }
1321
+ return r;
1322
+ }
1323
+ }
1324
+
1325
+ function __PRIVATE_primitiveComparator(t, e) {
1326
+ return t < e ? -1 : t > e ? 1 : 0;
1327
+ }
1328
+
1329
+ /** Helper to compare arrays using isEqual(). */ function __PRIVATE_arrayEquals(t, e, r) {
1330
+ return t.length === e.length && t.every(((t, n) => r(t, e[n])));
1331
+ }
1332
+
1363
1333
  /**
1364
1334
  * @license
1365
1335
  * Copyright 2017 Google LLC
@@ -1542,7 +1512,7 @@ class ByteString {
1542
1512
 
1543
1513
  ByteString.EMPTY_BYTE_STRING = new ByteString("");
1544
1514
 
1545
- const k = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1515
+ const U = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1546
1516
 
1547
1517
  /**
1548
1518
  * Converts the possible Proto values for a timestamp value into a "seconds and
@@ -1556,7 +1526,7 @@ const k = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1556
1526
  // (millis), so we do some custom parsing here.
1557
1527
  // Parse the nanos right out of the string.
1558
1528
  let e = 0;
1559
- const r = k.exec(t);
1529
+ const r = U.exec(t);
1560
1530
  if (__PRIVATE_hardAssert(!!r), r[1]) {
1561
1531
  // Pad the fraction out to 9 digits (nanos).
1562
1532
  let t = r[1];
@@ -1955,7 +1925,7 @@ function __PRIVATE_valueCompare(t, e) {
1955
1925
  return __PRIVATE_compareTimestamps(__PRIVATE_getLocalWriteTime(t), __PRIVATE_getLocalWriteTime(e));
1956
1926
 
1957
1927
  case 5 /* TypeOrder.StringValue */ :
1958
- return __PRIVATE_compareUtf8Strings(t.stringValue, e.stringValue);
1928
+ return __PRIVATE_primitiveComparator(t.stringValue, e.stringValue);
1959
1929
 
1960
1930
  case 6 /* TypeOrder.BlobValue */ :
1961
1931
  return function __PRIVATE_compareBlobs(t, e) {
@@ -2003,7 +1973,7 @@ function __PRIVATE_valueCompare(t, e) {
2003
1973
  // canonical IDs are independent of insertion order.
2004
1974
  n.sort(), s.sort();
2005
1975
  for (let t = 0; t < n.length && t < s.length; ++t) {
2006
- const e = __PRIVATE_compareUtf8Strings(n[t], s[t]);
1976
+ const e = __PRIVATE_primitiveComparator(n[t], s[t]);
2007
1977
  if (0 !== e) return e;
2008
1978
  const o = __PRIVATE_valueCompare(r[n[t]], i[s[t]]);
2009
1979
  if (0 !== o) return o;
@@ -3951,7 +3921,7 @@ class __PRIVATE_ExponentialBackoff {
3951
3921
  * Note that jitter will still be applied, so the actual delay could be as
3952
3922
  * much as 1.5*maxDelayMs.
3953
3923
  */ , i = 6e4) {
3954
- this.L = t, this.timerId = e, this.M = r, this.U = n, this.k = i, this.j = 0, this.W = null,
3924
+ this.L = t, this.timerId = e, this.M = r, this.k = n, this.U = i, this.j = 0, this.W = null,
3955
3925
  /** The last backoff attempt, as epoch milliseconds. */
3956
3926
  this.K = Date.now(), this.reset();
3957
3927
  }
@@ -3968,7 +3938,7 @@ class __PRIVATE_ExponentialBackoff {
3968
3938
  * Resets the backoff delay to the maximum delay (e.g. for use after a
3969
3939
  * RESOURCE_EXHAUSTED error).
3970
3940
  */ G() {
3971
- this.j = this.k;
3941
+ this.j = this.U;
3972
3942
  }
3973
3943
  /**
3974
3944
  * Returns a promise that resolves after currentDelayMs, and increases the
@@ -3986,7 +3956,7 @@ class __PRIVATE_ExponentialBackoff {
3986
3956
  t()))),
3987
3957
  // Apply backoff factor to determine next delay and ensure it is within
3988
3958
  // bounds.
3989
- this.j *= this.U, this.j < this.M && (this.j = this.M), this.j > this.k && (this.j = this.k);
3959
+ this.j *= this.k, this.j < this.M && (this.j = this.M), this.j > this.U && (this.j = this.U);
3990
3960
  }
3991
3961
  Y() {
3992
3962
  null !== this.W && (this.W.skipDelay(), this.W = null);
@@ -4128,7 +4098,7 @@ async function __PRIVATE_invokeRunAggregationQueryRpc(t, e, r) {
4128
4098
  // Do not include implicit order-bys for aggregate queries.
4129
4099
  e.q = __PRIVATE__queryToTarget(e, t.explicitOrderBy)), e.q;
4130
4100
  }(e), r);
4131
- i.connection.T || delete s.parent;
4101
+ i.connection.A || delete s.parent;
4132
4102
  const u = (await i.v("RunAggregationQuery", i.serializer.databaseId, a, s,
4133
4103
  /*expectedResponseCount=*/ 1)).filter((t => !!t.result));
4134
4104
  // Omit RunAggregationQueryResponse that only contain readTimes.
@@ -4308,7 +4278,7 @@ class Firestore {
4308
4278
  * Whether it's a Firestore or Firestore Lite instance.
4309
4279
  */
4310
4280
  this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new FirestoreSettingsImpl({}),
4311
- this._settingsFrozen = !1,
4281
+ this._settingsFrozen = !1, this._emulatorOptions = {},
4312
4282
  // A task that is assigned when the terminate() is invoked and resolved when
4313
4283
  // all components have shut down. Otherwise, Firestore is not terminated,
4314
4284
  // which can mean either the FirestoreClient is in the process of starting,
@@ -4330,7 +4300,8 @@ class Firestore {
4330
4300
  }
4331
4301
  _setSettings(t) {
4332
4302
  if (this._settingsFrozen) throw new FirestoreError(v, "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.");
4333
- this._settings = new FirestoreSettingsImpl(t), void 0 !== t.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(t) {
4303
+ this._settings = new FirestoreSettingsImpl(t), this._emulatorOptions = t.emulatorOptions || {},
4304
+ void 0 !== t.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(t) {
4334
4305
  if (!t) return new __PRIVATE_EmptyAuthCredentialsProvider;
4335
4306
  switch (t.type) {
4336
4307
  case "firstParty":
@@ -4347,6 +4318,9 @@ class Firestore {
4347
4318
  _getSettings() {
4348
4319
  return this._settings;
4349
4320
  }
4321
+ _getEmulatorOptions() {
4322
+ return this._emulatorOptions;
4323
+ }
4350
4324
  _freezeSettings() {
4351
4325
  return this._settingsFrozen = !0, this._settings;
4352
4326
  }
@@ -4418,12 +4392,18 @@ function getFirestore(t, r) {
4418
4392
  * Security Rules.
4419
4393
  */ function connectFirestoreEmulator(t, e, r, n = {}) {
4420
4394
  var i;
4421
- const s = (t = __PRIVATE_cast(t, Firestore))._getSettings(), o = `${e}:${r}`;
4422
- if (s.host !== nt && s.host !== o && __PRIVATE_logWarn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),
4423
- t._setSettings(Object.assign(Object.assign({}, s), {
4424
- host: o,
4425
- ssl: !1
4426
- })), n.mockUserToken) {
4395
+ const s = (t = __PRIVATE_cast(t, Firestore))._getSettings(), o = Object.assign(Object.assign({}, s), {
4396
+ emulatorOptions: t._getEmulatorOptions()
4397
+ }), a = `${e}:${r}`;
4398
+ s.host !== nt && s.host !== a && __PRIVATE_logWarn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");
4399
+ const u = Object.assign(Object.assign({}, s), {
4400
+ host: a,
4401
+ ssl: !1,
4402
+ emulatorOptions: n
4403
+ });
4404
+ // No-op if the new configuration matches the current configuration. This supports SSR
4405
+ // enviornments which might call `connectFirestoreEmulator` multiple times as a standard practice.
4406
+ if (!deepEqual(u, o) && (t._setSettings(u), n.mockUserToken)) {
4427
4407
  let e, r;
4428
4408
  if ("string" == typeof n.mockUserToken) e = n.mockUserToken, r = User.MOCK_USER; else {
4429
4409
  // Let createMockUserToken validate first (catches common mistakes like
@@ -4979,7 +4959,7 @@ function doc(t, e, ...r) {
4979
4959
  */
4980
4960
  /**
4981
4961
  * Represents a vector type in Firestore documents.
4982
- * Create an instance with {@link FieldValue.vector}.
4962
+ * Create an instance with <code>{@link vector}</code>.
4983
4963
  *
4984
4964
  * @class VectorValue
4985
4965
  */
@@ -4998,7 +4978,7 @@ class VectorValue {
4998
4978
  return this._values.map((t => t));
4999
4979
  }
5000
4980
  /**
5001
- * Returns `true` if the two VectorValue has the same raw number arrays, returns `false` otherwise.
4981
+ * Returns `true` if the two `VectorValue` values have the same raw number arrays, returns `false` otherwise.
5002
4982
  */ isEqual(t) {
5003
4983
  return function __PRIVATE_isPrimitiveArrayEqual(t, e) {
5004
4984
  if (t.length !== e.length) return !1;
@@ -6910,13 +6890,13 @@ function __PRIVATE_validateReference(t, e) {
6910
6890
  class __PRIVATE_TransactionRunner {
6911
6891
  constructor(t, e, r, n, i) {
6912
6892
  this.asyncQueue = t, this.datastore = e, this.options = r, this.updateFunction = n,
6913
- this.deferred = i, this.Tt = r.maxAttempts, this.At = new __PRIVATE_ExponentialBackoff(this.asyncQueue, "transaction_retry" /* TimerId.TransactionRetry */);
6893
+ this.deferred = i, this.At = r.maxAttempts, this.Tt = new __PRIVATE_ExponentialBackoff(this.asyncQueue, "transaction_retry" /* TimerId.TransactionRetry */);
6914
6894
  }
6915
6895
  /** Runs the transaction and sets the result on deferred. */ Pt() {
6916
- this.Tt -= 1, this.Rt();
6896
+ this.At -= 1, this.Rt();
6917
6897
  }
6918
6898
  Rt() {
6919
- this.At.H((async () => {
6899
+ this.Tt.H((async () => {
6920
6900
  const t = new Transaction$1(this.datastore), e = this.It(t);
6921
6901
  e && e.then((e => {
6922
6902
  this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
@@ -6940,7 +6920,7 @@ class __PRIVATE_TransactionRunner {
6940
6920
  }
6941
6921
  }
6942
6922
  Vt(t) {
6943
- this.Tt > 0 && this.yt(t) ? (this.Tt -= 1, this.asyncQueue.enqueueAndForget((() => (this.Rt(),
6923
+ this.At > 0 && this.yt(t) ? (this.At -= 1, this.asyncQueue.enqueueAndForget((() => (this.Rt(),
6944
6924
  Promise.resolve())))) : this.deferred.reject(t);
6945
6925
  }
6946
6926
  yt(t) {
@@ -6957,7 +6937,7 @@ class __PRIVATE_TransactionRunner {
6957
6937
  */
6958
6938
  function __PRIVATE_isPermanentError(t) {
6959
6939
  switch (t) {
6960
- case A:
6940
+ case T:
6961
6941
  return fail();
6962
6942
 
6963
6943
  case P:
@@ -7140,14 +7120,14 @@ class __PRIVATE_AsyncQueueImpl {
7140
7120
  // List of TimerIds to fast-forward delays for.
7141
7121
  this.Ct = [],
7142
7122
  // Backoff timer used to schedule retries for retryable operations
7143
- this.At = new __PRIVATE_ExponentialBackoff(this, "async_queue_retry" /* TimerId.AsyncQueueRetry */),
7123
+ this.Tt = new __PRIVATE_ExponentialBackoff(this, "async_queue_retry" /* TimerId.AsyncQueueRetry */),
7144
7124
  // Visibility handler that triggers an immediate retry of all retryable
7145
7125
  // operations. Meant to speed up recovery when we regain file system access
7146
7126
  // after page comes into foreground.
7147
7127
  this.St = () => {
7148
7128
  const t = getDocument();
7149
7129
  t && __PRIVATE_logDebug(ut, "Visibility state changed to " + t.visibilityState),
7150
- this.At.Y();
7130
+ this.Tt.Y();
7151
7131
  }, this.Nt = t;
7152
7132
  const e = getDocument();
7153
7133
  e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.St);
@@ -7194,7 +7174,7 @@ class __PRIVATE_AsyncQueueImpl {
7194
7174
  */ async Bt() {
7195
7175
  if (0 !== this.wt.length) {
7196
7176
  try {
7197
- await this.wt[0](), this.wt.shift(), this.At.reset();
7177
+ await this.wt[0](), this.wt.shift(), this.Tt.reset();
7198
7178
  } catch (t) {
7199
7179
  if (!
7200
7180
  /**
@@ -7233,7 +7213,7 @@ class __PRIVATE_AsyncQueueImpl {
7233
7213
  // Since `backoffAndRun()` cancels an existing backoff and schedules a
7234
7214
  // new backoff on every call, there is only ever a single additional
7235
7215
  // operation in the queue.
7236
- this.At.H((() => this.Bt()));
7216
+ this.Tt.H((() => this.Bt()));
7237
7217
  }
7238
7218
  }
7239
7219
  qt(t) {
@@ -7319,7 +7299,7 @@ class __PRIVATE_AsyncQueueImpl {
7319
7299
  * @param lastTimerId - Delayed operations up to and including this TimerId
7320
7300
  * will be drained. Pass TimerId.All to run all delayed operations.
7321
7301
  * @returns a Promise that resolves once all operations have been run.
7322
- */ xt(t) {
7302
+ */ Mt(t) {
7323
7303
  // Note that draining may generate more delayed ops, so we do that first.
7324
7304
  return this.Qt().then((() => {
7325
7305
  // Run ops in the same order they'd run if they ran naturally.
@@ -7331,7 +7311,7 @@ class __PRIVATE_AsyncQueueImpl {
7331
7311
  }
7332
7312
  /**
7333
7313
  * For Tests: Skip all subsequent delays for a timer id.
7334
- */ Mt(t) {
7314
+ */ xt(t) {
7335
7315
  this.Ct.push(t);
7336
7316
  }
7337
7317
  /** Called once a DelayedOperation is run or canceled. */ $t(t) {