@firebase/firestore 4.7.7-canary.3418ef807 → 4.7.7-canary.4d2fc6e82
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 +2 -0
- package/dist/index.cjs.js +153 -145
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +153 -145
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +52 -41
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +52 -41
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +164 -156
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/firestore/src/util/misc.d.ts +2 -0
- package/dist/lite/index.browser.esm2017.js +157 -127
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.cjs.js +157 -127
- package/dist/lite/index.cjs.js.map +1 -1
- package/dist/lite/index.node.cjs.js +127 -97
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +127 -97
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +150 -120
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/package.json +9 -9
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-canary.
|
|
7
|
+
const E = "4.7.7-canary.4d2fc6e82";
|
|
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.
|
|
68
|
+
let m = "11.3.0-canary.4d2fc6e82";
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* @license
|
|
@@ -83,7 +83,7 @@ let m = "11.3.0-canary.3418ef807";
|
|
|
83
83
|
* See the License for the specific language governing permissions and
|
|
84
84
|
* limitations under the License.
|
|
85
85
|
*/
|
|
86
|
-
const
|
|
86
|
+
const T = 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 A = new Logger("@firebase/firestore");
|
|
|
98
98
|
* <li><code>`silent` to turn off logging.</li>
|
|
99
99
|
* </ul>
|
|
100
100
|
*/ function setLogLevel(t) {
|
|
101
|
-
|
|
101
|
+
T.setLogLevel(t);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
function __PRIVATE_logDebug(t, ...e) {
|
|
105
|
-
if (
|
|
105
|
+
if (T.logLevel <= LogLevel.DEBUG) {
|
|
106
106
|
const r = e.map(__PRIVATE_argToString);
|
|
107
|
-
|
|
107
|
+
T.debug(`Firestore (${m}): ${t}`, ...r);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
function __PRIVATE_logError(t, ...e) {
|
|
112
|
-
if (
|
|
112
|
+
if (T.logLevel <= LogLevel.ERROR) {
|
|
113
113
|
const r = e.map(__PRIVATE_argToString);
|
|
114
|
-
|
|
114
|
+
T.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 (T.logLevel <= LogLevel.WARN) {
|
|
122
122
|
const r = e.map(__PRIVATE_argToString);
|
|
123
|
-
|
|
123
|
+
T.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 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";
|
|
225
225
|
|
|
226
226
|
/** An error returned by a Firestore operation. */ class FirestoreError extends FirebaseError {
|
|
227
227
|
/** @hideconstructor */
|
|
@@ -476,6 +476,60 @@ 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
|
+
|
|
479
533
|
/**
|
|
480
534
|
* @license
|
|
481
535
|
* Copyright 2017 Google LLC
|
|
@@ -492,7 +546,62 @@ class DatabaseInfo {
|
|
|
492
546
|
* See the License for the specific language governing permissions and
|
|
493
547
|
* limitations under the License.
|
|
494
548
|
*/
|
|
495
|
-
|
|
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__";
|
|
496
605
|
|
|
497
606
|
/**
|
|
498
607
|
* Path represents an ordered sequence of string segments.
|
|
@@ -560,13 +669,11 @@ const B = "__name__";
|
|
|
560
669
|
const r = BasePath.compareSegments(t.get(n), e.get(n));
|
|
561
670
|
if (0 !== r) return r;
|
|
562
671
|
}
|
|
563
|
-
return
|
|
672
|
+
return __PRIVATE_primitiveComparator(t.length, e.length);
|
|
564
673
|
}
|
|
565
674
|
static compareSegments(t, e) {
|
|
566
675
|
const r = BasePath.isNumericId(t), n = BasePath.isNumericId(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;
|
|
676
|
+
return r && !n ? -1 : !r && n ? 1 : r && n ? BasePath.extractNumericId(t).compare(BasePath.extractNumericId(e)) : __PRIVATE_compareUtf8Strings(t, e);
|
|
570
677
|
}
|
|
571
678
|
// Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
|
|
572
679
|
static isNumericId(t) {
|
|
@@ -972,7 +1079,7 @@ function __PRIVATE_generateUniqueDebugId() {
|
|
|
972
1079
|
* See the License for the specific language governing permissions and
|
|
973
1080
|
* limitations under the License.
|
|
974
1081
|
*/
|
|
975
|
-
const L = "RestConnection",
|
|
1082
|
+
const L = "RestConnection", x = {
|
|
976
1083
|
BatchGetDocuments: "batchGet",
|
|
977
1084
|
Commit: "commit",
|
|
978
1085
|
RunQuery: "runQuery",
|
|
@@ -989,7 +1096,7 @@ const L = "RestConnection", M = {
|
|
|
989
1096
|
* HTTP).
|
|
990
1097
|
*/
|
|
991
1098
|
class __PRIVATE_RestConnection {
|
|
992
|
-
get
|
|
1099
|
+
get T() {
|
|
993
1100
|
// Both `invokeRPC()` and `invokeStreamingRPC()` use their `path` arguments to determine
|
|
994
1101
|
// where to run the query, and expect the `request` to NOT specify the "path".
|
|
995
1102
|
return !1;
|
|
@@ -997,7 +1104,7 @@ class __PRIVATE_RestConnection {
|
|
|
997
1104
|
constructor(t) {
|
|
998
1105
|
this.databaseInfo = t, this.databaseId = t.databaseId;
|
|
999
1106
|
const e = t.ssl ? "https" : "http", r = encodeURIComponent(this.databaseId.projectId), n = encodeURIComponent(this.databaseId.database);
|
|
1000
|
-
this.
|
|
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}`;
|
|
1001
1108
|
}
|
|
1002
1109
|
I(t, e, r, n, i) {
|
|
1003
1110
|
const s = __PRIVATE_generateUniqueDebugId(), o = this.V(t, e.toUriEncodedString());
|
|
@@ -1035,8 +1142,8 @@ class __PRIVATE_RestConnection {
|
|
|
1035
1142
|
e && e.headers.forEach(((e, r) => t[r] = e)), r && r.headers.forEach(((e, r) => t[r] = e));
|
|
1036
1143
|
}
|
|
1037
1144
|
V(t, e) {
|
|
1038
|
-
const r =
|
|
1039
|
-
return `${this.
|
|
1145
|
+
const r = x[t];
|
|
1146
|
+
return `${this.A}/v1/${e}:${r}`;
|
|
1040
1147
|
}
|
|
1041
1148
|
/**
|
|
1042
1149
|
* Closes and cleans up any resources associated with the connection. This
|
|
@@ -1072,7 +1179,7 @@ class __PRIVATE_RestConnection {
|
|
|
1072
1179
|
* Important! The names of these identifiers matter because the string forms
|
|
1073
1180
|
* are used for reverse lookups from the webchannel stream. Do NOT change the
|
|
1074
1181
|
* names of these identifiers or change this into a const enum.
|
|
1075
|
-
*/ var
|
|
1182
|
+
*/ var M, U;
|
|
1076
1183
|
|
|
1077
1184
|
/**
|
|
1078
1185
|
* Converts an HTTP Status Code to the equivalent error code.
|
|
@@ -1093,7 +1200,7 @@ function __PRIVATE_mapCodeFromHttpStatus(t) {
|
|
|
1093
1200
|
switch (t) {
|
|
1094
1201
|
case 200:
|
|
1095
1202
|
// OK
|
|
1096
|
-
return
|
|
1203
|
+
return A;
|
|
1097
1204
|
|
|
1098
1205
|
case 400:
|
|
1099
1206
|
// Bad Request
|
|
@@ -1152,7 +1259,7 @@ function __PRIVATE_mapCodeFromHttpStatus(t) {
|
|
|
1152
1259
|
return V;
|
|
1153
1260
|
|
|
1154
1261
|
default:
|
|
1155
|
-
return t >= 200 && t < 300 ?
|
|
1262
|
+
return t >= 200 && t < 300 ? A : t >= 400 && t < 500 ? v : t >= 500 && t < 600 ? S : R;
|
|
1156
1263
|
}
|
|
1157
1264
|
}
|
|
1158
1265
|
|
|
@@ -1175,13 +1282,13 @@ function __PRIVATE_mapCodeFromHttpStatus(t) {
|
|
|
1175
1282
|
/**
|
|
1176
1283
|
* A Rest-based connection that relies on the native HTTP stack
|
|
1177
1284
|
* (e.g. `fetch` or a polyfill).
|
|
1178
|
-
*/ (
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
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";
|
|
1185
1292
|
|
|
1186
1293
|
class __PRIVATE_FetchConnection extends __PRIVATE_RestConnection {
|
|
1187
1294
|
D(t, e) {
|
|
@@ -1253,83 +1360,6 @@ class __PRIVATE_AggregateImpl {
|
|
|
1253
1360
|
}
|
|
1254
1361
|
}
|
|
1255
1362
|
|
|
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
|
-
|
|
1333
1363
|
/**
|
|
1334
1364
|
* @license
|
|
1335
1365
|
* Copyright 2017 Google LLC
|
|
@@ -1512,7 +1542,7 @@ class ByteString {
|
|
|
1512
1542
|
|
|
1513
1543
|
ByteString.EMPTY_BYTE_STRING = new ByteString("");
|
|
1514
1544
|
|
|
1515
|
-
const
|
|
1545
|
+
const k = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
1516
1546
|
|
|
1517
1547
|
/**
|
|
1518
1548
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
@@ -1526,7 +1556,7 @@ const U = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1526
1556
|
// (millis), so we do some custom parsing here.
|
|
1527
1557
|
// Parse the nanos right out of the string.
|
|
1528
1558
|
let e = 0;
|
|
1529
|
-
const r =
|
|
1559
|
+
const r = k.exec(t);
|
|
1530
1560
|
if (__PRIVATE_hardAssert(!!r), r[1]) {
|
|
1531
1561
|
// Pad the fraction out to 9 digits (nanos).
|
|
1532
1562
|
let t = r[1];
|
|
@@ -1925,7 +1955,7 @@ function __PRIVATE_valueCompare(t, e) {
|
|
|
1925
1955
|
return __PRIVATE_compareTimestamps(__PRIVATE_getLocalWriteTime(t), __PRIVATE_getLocalWriteTime(e));
|
|
1926
1956
|
|
|
1927
1957
|
case 5 /* TypeOrder.StringValue */ :
|
|
1928
|
-
return
|
|
1958
|
+
return __PRIVATE_compareUtf8Strings(t.stringValue, e.stringValue);
|
|
1929
1959
|
|
|
1930
1960
|
case 6 /* TypeOrder.BlobValue */ :
|
|
1931
1961
|
return function __PRIVATE_compareBlobs(t, e) {
|
|
@@ -1973,7 +2003,7 @@ function __PRIVATE_valueCompare(t, e) {
|
|
|
1973
2003
|
// canonical IDs are independent of insertion order.
|
|
1974
2004
|
n.sort(), s.sort();
|
|
1975
2005
|
for (let t = 0; t < n.length && t < s.length; ++t) {
|
|
1976
|
-
const e =
|
|
2006
|
+
const e = __PRIVATE_compareUtf8Strings(n[t], s[t]);
|
|
1977
2007
|
if (0 !== e) return e;
|
|
1978
2008
|
const o = __PRIVATE_valueCompare(r[n[t]], i[s[t]]);
|
|
1979
2009
|
if (0 !== o) return o;
|
|
@@ -3921,7 +3951,7 @@ class __PRIVATE_ExponentialBackoff {
|
|
|
3921
3951
|
* Note that jitter will still be applied, so the actual delay could be as
|
|
3922
3952
|
* much as 1.5*maxDelayMs.
|
|
3923
3953
|
*/ , i = 6e4) {
|
|
3924
|
-
this.L = t, this.timerId = e, this.M = r, this.
|
|
3954
|
+
this.L = t, this.timerId = e, this.M = r, this.U = n, this.k = i, this.j = 0, this.W = null,
|
|
3925
3955
|
/** The last backoff attempt, as epoch milliseconds. */
|
|
3926
3956
|
this.K = Date.now(), this.reset();
|
|
3927
3957
|
}
|
|
@@ -3938,7 +3968,7 @@ class __PRIVATE_ExponentialBackoff {
|
|
|
3938
3968
|
* Resets the backoff delay to the maximum delay (e.g. for use after a
|
|
3939
3969
|
* RESOURCE_EXHAUSTED error).
|
|
3940
3970
|
*/ G() {
|
|
3941
|
-
this.j = this.
|
|
3971
|
+
this.j = this.k;
|
|
3942
3972
|
}
|
|
3943
3973
|
/**
|
|
3944
3974
|
* Returns a promise that resolves after currentDelayMs, and increases the
|
|
@@ -3956,7 +3986,7 @@ class __PRIVATE_ExponentialBackoff {
|
|
|
3956
3986
|
t()))),
|
|
3957
3987
|
// Apply backoff factor to determine next delay and ensure it is within
|
|
3958
3988
|
// bounds.
|
|
3959
|
-
this.j *= this.
|
|
3989
|
+
this.j *= this.U, this.j < this.M && (this.j = this.M), this.j > this.k && (this.j = this.k);
|
|
3960
3990
|
}
|
|
3961
3991
|
Y() {
|
|
3962
3992
|
null !== this.W && (this.W.skipDelay(), this.W = null);
|
|
@@ -4098,7 +4128,7 @@ async function __PRIVATE_invokeRunAggregationQueryRpc(t, e, r) {
|
|
|
4098
4128
|
// Do not include implicit order-bys for aggregate queries.
|
|
4099
4129
|
e.q = __PRIVATE__queryToTarget(e, t.explicitOrderBy)), e.q;
|
|
4100
4130
|
}(e), r);
|
|
4101
|
-
i.connection.
|
|
4131
|
+
i.connection.T || delete s.parent;
|
|
4102
4132
|
const u = (await i.v("RunAggregationQuery", i.serializer.databaseId, a, s,
|
|
4103
4133
|
/*expectedResponseCount=*/ 1)).filter((t => !!t.result));
|
|
4104
4134
|
// Omit RunAggregationQueryResponse that only contain readTimes.
|
|
@@ -6880,13 +6910,13 @@ function __PRIVATE_validateReference(t, e) {
|
|
|
6880
6910
|
class __PRIVATE_TransactionRunner {
|
|
6881
6911
|
constructor(t, e, r, n, i) {
|
|
6882
6912
|
this.asyncQueue = t, this.datastore = e, this.options = r, this.updateFunction = n,
|
|
6883
|
-
this.deferred = i, this.
|
|
6913
|
+
this.deferred = i, this.Tt = r.maxAttempts, this.At = new __PRIVATE_ExponentialBackoff(this.asyncQueue, "transaction_retry" /* TimerId.TransactionRetry */);
|
|
6884
6914
|
}
|
|
6885
6915
|
/** Runs the transaction and sets the result on deferred. */ Pt() {
|
|
6886
|
-
this.
|
|
6916
|
+
this.Tt -= 1, this.Rt();
|
|
6887
6917
|
}
|
|
6888
6918
|
Rt() {
|
|
6889
|
-
this.
|
|
6919
|
+
this.At.H((async () => {
|
|
6890
6920
|
const t = new Transaction$1(this.datastore), e = this.It(t);
|
|
6891
6921
|
e && e.then((e => {
|
|
6892
6922
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
@@ -6910,7 +6940,7 @@ class __PRIVATE_TransactionRunner {
|
|
|
6910
6940
|
}
|
|
6911
6941
|
}
|
|
6912
6942
|
Vt(t) {
|
|
6913
|
-
this.
|
|
6943
|
+
this.Tt > 0 && this.yt(t) ? (this.Tt -= 1, this.asyncQueue.enqueueAndForget((() => (this.Rt(),
|
|
6914
6944
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
6915
6945
|
}
|
|
6916
6946
|
yt(t) {
|
|
@@ -6927,7 +6957,7 @@ class __PRIVATE_TransactionRunner {
|
|
|
6927
6957
|
*/
|
|
6928
6958
|
function __PRIVATE_isPermanentError(t) {
|
|
6929
6959
|
switch (t) {
|
|
6930
|
-
case
|
|
6960
|
+
case A:
|
|
6931
6961
|
return fail();
|
|
6932
6962
|
|
|
6933
6963
|
case P:
|
|
@@ -7110,14 +7140,14 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7110
7140
|
// List of TimerIds to fast-forward delays for.
|
|
7111
7141
|
this.Ct = [],
|
|
7112
7142
|
// Backoff timer used to schedule retries for retryable operations
|
|
7113
|
-
this.
|
|
7143
|
+
this.At = new __PRIVATE_ExponentialBackoff(this, "async_queue_retry" /* TimerId.AsyncQueueRetry */),
|
|
7114
7144
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
7115
7145
|
// operations. Meant to speed up recovery when we regain file system access
|
|
7116
7146
|
// after page comes into foreground.
|
|
7117
7147
|
this.St = () => {
|
|
7118
7148
|
const t = getDocument();
|
|
7119
7149
|
t && __PRIVATE_logDebug(ut, "Visibility state changed to " + t.visibilityState),
|
|
7120
|
-
this.
|
|
7150
|
+
this.At.Y();
|
|
7121
7151
|
}, this.Nt = t;
|
|
7122
7152
|
const e = getDocument();
|
|
7123
7153
|
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.St);
|
|
@@ -7164,7 +7194,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7164
7194
|
*/ async Bt() {
|
|
7165
7195
|
if (0 !== this.wt.length) {
|
|
7166
7196
|
try {
|
|
7167
|
-
await this.wt[0](), this.wt.shift(), this.
|
|
7197
|
+
await this.wt[0](), this.wt.shift(), this.At.reset();
|
|
7168
7198
|
} catch (t) {
|
|
7169
7199
|
if (!
|
|
7170
7200
|
/**
|
|
@@ -7203,7 +7233,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7203
7233
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
7204
7234
|
// new backoff on every call, there is only ever a single additional
|
|
7205
7235
|
// operation in the queue.
|
|
7206
|
-
this.
|
|
7236
|
+
this.At.H((() => this.Bt()));
|
|
7207
7237
|
}
|
|
7208
7238
|
}
|
|
7209
7239
|
qt(t) {
|
|
@@ -7289,7 +7319,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7289
7319
|
* @param lastTimerId - Delayed operations up to and including this TimerId
|
|
7290
7320
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
7291
7321
|
* @returns a Promise that resolves once all operations have been run.
|
|
7292
|
-
*/
|
|
7322
|
+
*/ xt(t) {
|
|
7293
7323
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
7294
7324
|
return this.Qt().then((() => {
|
|
7295
7325
|
// Run ops in the same order they'd run if they ran naturally.
|
|
@@ -7301,7 +7331,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7301
7331
|
}
|
|
7302
7332
|
/**
|
|
7303
7333
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
7304
|
-
*/
|
|
7334
|
+
*/ Mt(t) {
|
|
7305
7335
|
this.Ct.push(t);
|
|
7306
7336
|
}
|
|
7307
7337
|
/** Called once a DelayedOperation is run or canceled. */ $t(t) {
|