@firebase/firestore 4.7.7 → 4.7.8
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/util/misc.d.ts +0 -2
- package/dist/index.cjs.js +145 -153
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +145 -153
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +41 -52
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +41 -52
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +156 -164
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/firestore/src/util/misc.d.ts +0 -2
- package/dist/lite/index.browser.esm2017.js +127 -157
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.cjs.js +127 -157
- package/dist/lite/index.cjs.js.map +1 -1
- package/dist/lite/index.node.cjs.js +97 -127
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +97 -127
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +120 -150
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/package.json +3 -3
package/dist/lite/index.cjs.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Logger, LogLevel } from '@firebase/logger';
|
|
|
4
4
|
import { FirebaseError, getDefaultEmulatorHostnameAndPort, createMockUserToken, getModularInstance, deepEqual } from '@firebase/util';
|
|
5
5
|
import { Integer } from '@firebase/webchannel-wrapper/bloom-blob';
|
|
6
6
|
|
|
7
|
-
const E = "4.7.
|
|
7
|
+
const E = "4.7.8";
|
|
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.
|
|
68
|
+
let m = "11.3.1";
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* @license
|
|
@@ -83,7 +83,7 @@ let m = "11.3.0";
|
|
|
83
83
|
* See the License for the specific language governing permissions and
|
|
84
84
|
* limitations under the License.
|
|
85
85
|
*/
|
|
86
|
-
const
|
|
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
|
-
|
|
101
|
+
A.setLogLevel(t);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
function __PRIVATE_logDebug(t, ...e) {
|
|
105
|
-
if (
|
|
105
|
+
if (A.logLevel <= LogLevel.DEBUG) {
|
|
106
106
|
const r = e.map(__PRIVATE_argToString);
|
|
107
|
-
|
|
107
|
+
A.debug(`Firestore (${m}): ${t}`, ...r);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
function __PRIVATE_logError(t, ...e) {
|
|
112
|
-
if (
|
|
112
|
+
if (A.logLevel <= LogLevel.ERROR) {
|
|
113
113
|
const r = e.map(__PRIVATE_argToString);
|
|
114
|
-
|
|
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 (
|
|
121
|
+
if (A.logLevel <= LogLevel.WARN) {
|
|
122
122
|
const r = e.map(__PRIVATE_argToString);
|
|
123
|
-
|
|
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
|
|
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
|
|
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)) :
|
|
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",
|
|
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
|
|
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.
|
|
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 =
|
|
1146
|
-
return `${this.
|
|
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
|
|
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
|
|
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 ?
|
|
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
|
-
*/ (
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
@@ -6910,13 +6880,13 @@ function __PRIVATE_validateReference(t, e) {
|
|
|
6910
6880
|
class __PRIVATE_TransactionRunner {
|
|
6911
6881
|
constructor(t, e, r, n, i) {
|
|
6912
6882
|
this.asyncQueue = t, this.datastore = e, this.options = r, this.updateFunction = n,
|
|
6913
|
-
this.deferred = i, this.
|
|
6883
|
+
this.deferred = i, this.At = r.maxAttempts, this.Tt = new __PRIVATE_ExponentialBackoff(this.asyncQueue, "transaction_retry" /* TimerId.TransactionRetry */);
|
|
6914
6884
|
}
|
|
6915
6885
|
/** Runs the transaction and sets the result on deferred. */ Pt() {
|
|
6916
|
-
this.
|
|
6886
|
+
this.At -= 1, this.Rt();
|
|
6917
6887
|
}
|
|
6918
6888
|
Rt() {
|
|
6919
|
-
this.
|
|
6889
|
+
this.Tt.H((async () => {
|
|
6920
6890
|
const t = new Transaction$1(this.datastore), e = this.It(t);
|
|
6921
6891
|
e && e.then((e => {
|
|
6922
6892
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
@@ -6940,7 +6910,7 @@ class __PRIVATE_TransactionRunner {
|
|
|
6940
6910
|
}
|
|
6941
6911
|
}
|
|
6942
6912
|
Vt(t) {
|
|
6943
|
-
this.
|
|
6913
|
+
this.At > 0 && this.yt(t) ? (this.At -= 1, this.asyncQueue.enqueueAndForget((() => (this.Rt(),
|
|
6944
6914
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
6945
6915
|
}
|
|
6946
6916
|
yt(t) {
|
|
@@ -6957,7 +6927,7 @@ class __PRIVATE_TransactionRunner {
|
|
|
6957
6927
|
*/
|
|
6958
6928
|
function __PRIVATE_isPermanentError(t) {
|
|
6959
6929
|
switch (t) {
|
|
6960
|
-
case
|
|
6930
|
+
case T:
|
|
6961
6931
|
return fail();
|
|
6962
6932
|
|
|
6963
6933
|
case P:
|
|
@@ -7140,14 +7110,14 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7140
7110
|
// List of TimerIds to fast-forward delays for.
|
|
7141
7111
|
this.Ct = [],
|
|
7142
7112
|
// Backoff timer used to schedule retries for retryable operations
|
|
7143
|
-
this.
|
|
7113
|
+
this.Tt = new __PRIVATE_ExponentialBackoff(this, "async_queue_retry" /* TimerId.AsyncQueueRetry */),
|
|
7144
7114
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
7145
7115
|
// operations. Meant to speed up recovery when we regain file system access
|
|
7146
7116
|
// after page comes into foreground.
|
|
7147
7117
|
this.St = () => {
|
|
7148
7118
|
const t = getDocument();
|
|
7149
7119
|
t && __PRIVATE_logDebug(ut, "Visibility state changed to " + t.visibilityState),
|
|
7150
|
-
this.
|
|
7120
|
+
this.Tt.Y();
|
|
7151
7121
|
}, this.Nt = t;
|
|
7152
7122
|
const e = getDocument();
|
|
7153
7123
|
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.St);
|
|
@@ -7194,7 +7164,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7194
7164
|
*/ async Bt() {
|
|
7195
7165
|
if (0 !== this.wt.length) {
|
|
7196
7166
|
try {
|
|
7197
|
-
await this.wt[0](), this.wt.shift(), this.
|
|
7167
|
+
await this.wt[0](), this.wt.shift(), this.Tt.reset();
|
|
7198
7168
|
} catch (t) {
|
|
7199
7169
|
if (!
|
|
7200
7170
|
/**
|
|
@@ -7233,7 +7203,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7233
7203
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
7234
7204
|
// new backoff on every call, there is only ever a single additional
|
|
7235
7205
|
// operation in the queue.
|
|
7236
|
-
this.
|
|
7206
|
+
this.Tt.H((() => this.Bt()));
|
|
7237
7207
|
}
|
|
7238
7208
|
}
|
|
7239
7209
|
qt(t) {
|
|
@@ -7319,7 +7289,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7319
7289
|
* @param lastTimerId - Delayed operations up to and including this TimerId
|
|
7320
7290
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
7321
7291
|
* @returns a Promise that resolves once all operations have been run.
|
|
7322
|
-
*/
|
|
7292
|
+
*/ Mt(t) {
|
|
7323
7293
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
7324
7294
|
return this.Qt().then((() => {
|
|
7325
7295
|
// Run ops in the same order they'd run if they ran naturally.
|
|
@@ -7331,7 +7301,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7331
7301
|
}
|
|
7332
7302
|
/**
|
|
7333
7303
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
7334
|
-
*/
|
|
7304
|
+
*/ xt(t) {
|
|
7335
7305
|
this.Ct.push(t);
|
|
7336
7306
|
}
|
|
7337
7307
|
/** Called once a DelayedOperation is run or canceled. */ $t(t) {
|