@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
|
@@ -8,7 +8,7 @@ import { FirebaseError as _, base64 as c, DecodeBase64StringError as l, getDefau
|
|
|
8
8
|
|
|
9
9
|
import { Integer as m } from "@firebase/webchannel-wrapper/bloom-blob";
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const T = "4.7.7-canary.4d2fc6e82";
|
|
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 A = "11.3.0-canary.4d2fc6e82";
|
|
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 (${A}): ${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 (${A}): ${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 (${A}): ${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 (${A}) 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,6 +480,60 @@ 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
|
+
|
|
483
537
|
/**
|
|
484
538
|
* @license
|
|
485
539
|
* Copyright 2017 Google LLC
|
|
@@ -496,7 +550,62 @@ class DatabaseInfo {
|
|
|
496
550
|
* See the License for the specific language governing permissions and
|
|
497
551
|
* limitations under the License.
|
|
498
552
|
*/
|
|
499
|
-
|
|
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__";
|
|
500
609
|
|
|
501
610
|
/**
|
|
502
611
|
* Path represents an ordered sequence of string segments.
|
|
@@ -564,13 +673,11 @@ const Q = "__name__";
|
|
|
564
673
|
const r = BasePath.compareSegments(t.get(n), e.get(n));
|
|
565
674
|
if (0 !== r) return r;
|
|
566
675
|
}
|
|
567
|
-
return
|
|
676
|
+
return __PRIVATE_primitiveComparator(t.length, e.length);
|
|
568
677
|
}
|
|
569
678
|
static compareSegments(t, e) {
|
|
570
679
|
const r = BasePath.isNumericId(t), n = BasePath.isNumericId(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;
|
|
680
|
+
return r && !n ? -1 : !r && n ? 1 : r && n ? BasePath.extractNumericId(t).compare(BasePath.extractNumericId(e)) : __PRIVATE_compareUtf8Strings(t, e);
|
|
574
681
|
}
|
|
575
682
|
// Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
|
|
576
683
|
static isNumericId(t) {
|
|
@@ -898,7 +1005,7 @@ function __PRIVATE_cloneLongPollingOptions(t) {
|
|
|
898
1005
|
/**
|
|
899
1006
|
* The value returned from the most recent invocation of
|
|
900
1007
|
* `generateUniqueDebugId()`, or null if it has never been invoked.
|
|
901
|
-
*/ let
|
|
1008
|
+
*/ let x = null;
|
|
902
1009
|
|
|
903
1010
|
/**
|
|
904
1011
|
* Generates and returns an initial value for `lastUniqueDebugId`.
|
|
@@ -923,9 +1030,9 @@ function __PRIVATE_cloneLongPollingOptions(t) {
|
|
|
923
1030
|
* @return the 10-character generated ID (e.g. "0xa1b2c3d4").
|
|
924
1031
|
*/
|
|
925
1032
|
function __PRIVATE_generateUniqueDebugId() {
|
|
926
|
-
return null ===
|
|
1033
|
+
return null === x ? x = function __PRIVATE_generateInitialUniqueDebugId() {
|
|
927
1034
|
return 268435456 + Math.round(2147483648 * Math.random());
|
|
928
|
-
}() :
|
|
1035
|
+
}() : x++, "0x" + x.toString(16);
|
|
929
1036
|
}
|
|
930
1037
|
|
|
931
1038
|
/**
|
|
@@ -976,7 +1083,7 @@ function __PRIVATE_generateUniqueDebugId() {
|
|
|
976
1083
|
* See the License for the specific language governing permissions and
|
|
977
1084
|
* limitations under the License.
|
|
978
1085
|
*/
|
|
979
|
-
const
|
|
1086
|
+
const M = "RestConnection", U = {
|
|
980
1087
|
BatchGetDocuments: "batchGet",
|
|
981
1088
|
Commit: "commit",
|
|
982
1089
|
RunQuery: "runQuery",
|
|
@@ -993,7 +1100,7 @@ const x = "RestConnection", k = {
|
|
|
993
1100
|
* HTTP).
|
|
994
1101
|
*/
|
|
995
1102
|
class __PRIVATE_RestConnection {
|
|
996
|
-
get
|
|
1103
|
+
get T() {
|
|
997
1104
|
// Both `invokeRPC()` and `invokeStreamingRPC()` use their `path` arguments to determine
|
|
998
1105
|
// where to run the query, and expect the `request` to NOT specify the "path".
|
|
999
1106
|
return !1;
|
|
@@ -1001,18 +1108,18 @@ class __PRIVATE_RestConnection {
|
|
|
1001
1108
|
constructor(t) {
|
|
1002
1109
|
this.databaseInfo = t, this.databaseId = t.databaseId;
|
|
1003
1110
|
const e = t.ssl ? "https" : "http", r = encodeURIComponent(this.databaseId.projectId), n = encodeURIComponent(this.databaseId.database);
|
|
1004
|
-
this.
|
|
1111
|
+
this.A = e + "://" + t.host, this.P = `projects/${r}/databases/${n}`, this.R = this.databaseId.database === $ ? `project_id=${r}` : `project_id=${r}&database_id=${n}`;
|
|
1005
1112
|
}
|
|
1006
1113
|
V(t, e, r, n, i) {
|
|
1007
1114
|
const s = __PRIVATE_generateUniqueDebugId(), o = this.I(t, e.toUriEncodedString());
|
|
1008
|
-
__PRIVATE_logDebug(
|
|
1115
|
+
__PRIVATE_logDebug(M, `Sending RPC '${t}' ${s}:`, o, r);
|
|
1009
1116
|
const a = {
|
|
1010
1117
|
"google-cloud-resource-prefix": this.P,
|
|
1011
1118
|
"x-goog-request-params": this.R
|
|
1012
1119
|
};
|
|
1013
|
-
return this.p(a, n, i), this.F(t, o, a, r).then((e => (__PRIVATE_logDebug(
|
|
1120
|
+
return this.p(a, n, i), this.F(t, o, a, r).then((e => (__PRIVATE_logDebug(M, `Received RPC '${t}' ${s}: `, e),
|
|
1014
1121
|
e)), (e => {
|
|
1015
|
-
throw __PRIVATE_logWarn(
|
|
1122
|
+
throw __PRIVATE_logWarn(M, `RPC '${t}' ${s} failed with error: `, e, "url: ", o, "request:", r),
|
|
1016
1123
|
e;
|
|
1017
1124
|
}));
|
|
1018
1125
|
}
|
|
@@ -1029,7 +1136,7 @@ class __PRIVATE_RestConnection {
|
|
|
1029
1136
|
// SDK_VERSION is updated to different value at runtime depending on the entry point,
|
|
1030
1137
|
// so we need to get its value when we need it in a function.
|
|
1031
1138
|
function __PRIVATE_getGoogApiClientValue() {
|
|
1032
|
-
return "gl-js/ fire/" +
|
|
1139
|
+
return "gl-js/ fire/" + A;
|
|
1033
1140
|
}(),
|
|
1034
1141
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
1035
1142
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
@@ -1039,8 +1146,8 @@ class __PRIVATE_RestConnection {
|
|
|
1039
1146
|
e && e.headers.forEach(((e, r) => t[r] = e)), r && r.headers.forEach(((e, r) => t[r] = e));
|
|
1040
1147
|
}
|
|
1041
1148
|
I(t, e) {
|
|
1042
|
-
const r =
|
|
1043
|
-
return `${this.
|
|
1149
|
+
const r = U[t];
|
|
1150
|
+
return `${this.A}/v1/${e}:${r}`;
|
|
1044
1151
|
}
|
|
1045
1152
|
/**
|
|
1046
1153
|
* Closes and cleans up any resources associated with the connection. This
|
|
@@ -1076,7 +1183,7 @@ class __PRIVATE_RestConnection {
|
|
|
1076
1183
|
* Important! The names of these identifiers matter because the string forms
|
|
1077
1184
|
* are used for reverse lookups from the webchannel stream. Do NOT change the
|
|
1078
1185
|
* names of these identifiers or change this into a const enum.
|
|
1079
|
-
*/ var
|
|
1186
|
+
*/ var k, j;
|
|
1080
1187
|
|
|
1081
1188
|
/**
|
|
1082
1189
|
* Converts an HTTP Status Code to the equivalent error code.
|
|
@@ -1179,7 +1286,7 @@ function __PRIVATE_mapCodeFromHttpStatus(t) {
|
|
|
1179
1286
|
/**
|
|
1180
1287
|
* A Rest-based connection that relies on the native HTTP stack
|
|
1181
1288
|
* (e.g. `fetch` or a polyfill).
|
|
1182
|
-
*/ (j =
|
|
1289
|
+
*/ (j = k || (k = {}))[j.OK = 0] = "OK", j[j.CANCELLED = 1] = "CANCELLED", j[j.UNKNOWN = 2] = "UNKNOWN",
|
|
1183
1290
|
j[j.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT", j[j.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED",
|
|
1184
1291
|
j[j.NOT_FOUND = 5] = "NOT_FOUND", j[j.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", j[j.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
1185
1292
|
j[j.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", j[j.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
@@ -1257,83 +1364,6 @@ class __PRIVATE_AggregateImpl {
|
|
|
1257
1364
|
}
|
|
1258
1365
|
}
|
|
1259
1366
|
|
|
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
|
-
|
|
1337
1367
|
/**
|
|
1338
1368
|
* @license
|
|
1339
1369
|
* Copyright 2017 Google LLC
|
|
@@ -1937,7 +1967,7 @@ function __PRIVATE_valueCompare(t, e) {
|
|
|
1937
1967
|
return __PRIVATE_compareTimestamps(__PRIVATE_getLocalWriteTime(t), __PRIVATE_getLocalWriteTime(e));
|
|
1938
1968
|
|
|
1939
1969
|
case 5 /* TypeOrder.StringValue */ :
|
|
1940
|
-
return
|
|
1970
|
+
return __PRIVATE_compareUtf8Strings(t.stringValue, e.stringValue);
|
|
1941
1971
|
|
|
1942
1972
|
case 6 /* TypeOrder.BlobValue */ :
|
|
1943
1973
|
return function __PRIVATE_compareBlobs(t, e) {
|
|
@@ -1985,7 +2015,7 @@ function __PRIVATE_valueCompare(t, e) {
|
|
|
1985
2015
|
// canonical IDs are independent of insertion order.
|
|
1986
2016
|
n.sort(), s.sort();
|
|
1987
2017
|
for (let t = 0; t < n.length && t < s.length; ++t) {
|
|
1988
|
-
const e =
|
|
2018
|
+
const e = __PRIVATE_compareUtf8Strings(n[t], s[t]);
|
|
1989
2019
|
if (0 !== e) return e;
|
|
1990
2020
|
const o = __PRIVATE_valueCompare(r[n[t]], i[s[t]]);
|
|
1991
2021
|
if (0 !== o) return o;
|
|
@@ -3933,7 +3963,7 @@ class __PRIVATE_ExponentialBackoff {
|
|
|
3933
3963
|
* Note that jitter will still be applied, so the actual delay could be as
|
|
3934
3964
|
* much as 1.5*maxDelayMs.
|
|
3935
3965
|
*/ , i = 6e4) {
|
|
3936
|
-
this.L = t, this.timerId = e, this.M = r, this.
|
|
3966
|
+
this.L = t, this.timerId = e, this.M = r, this.U = n, this.k = i, this.j = 0, this.W = null,
|
|
3937
3967
|
/** The last backoff attempt, as epoch milliseconds. */
|
|
3938
3968
|
this.K = Date.now(), this.reset();
|
|
3939
3969
|
}
|
|
@@ -3950,7 +3980,7 @@ class __PRIVATE_ExponentialBackoff {
|
|
|
3950
3980
|
* Resets the backoff delay to the maximum delay (e.g. for use after a
|
|
3951
3981
|
* RESOURCE_EXHAUSTED error).
|
|
3952
3982
|
*/ G() {
|
|
3953
|
-
this.j = this.
|
|
3983
|
+
this.j = this.k;
|
|
3954
3984
|
}
|
|
3955
3985
|
/**
|
|
3956
3986
|
* Returns a promise that resolves after currentDelayMs, and increases the
|
|
@@ -3968,7 +3998,7 @@ class __PRIVATE_ExponentialBackoff {
|
|
|
3968
3998
|
t()))),
|
|
3969
3999
|
// Apply backoff factor to determine next delay and ensure it is within
|
|
3970
4000
|
// bounds.
|
|
3971
|
-
this.j *= this.
|
|
4001
|
+
this.j *= this.U, this.j < this.M && (this.j = this.M), this.j > this.k && (this.j = this.k);
|
|
3972
4002
|
}
|
|
3973
4003
|
Y() {
|
|
3974
4004
|
null !== this.W && (this.W.skipDelay(), this.W = null);
|
|
@@ -4110,7 +4140,7 @@ async function __PRIVATE_invokeRunAggregationQueryRpc(t, e, r) {
|
|
|
4110
4140
|
// Do not include implicit order-bys for aggregate queries.
|
|
4111
4141
|
e.q = __PRIVATE__queryToTarget(e, t.explicitOrderBy)), e.q;
|
|
4112
4142
|
}(e), r);
|
|
4113
|
-
i.connection.
|
|
4143
|
+
i.connection.T || delete s.parent;
|
|
4114
4144
|
const u = (await i.v("RunAggregationQuery", i.serializer.databaseId, a, s,
|
|
4115
4145
|
/*expectedResponseCount=*/ 1)).filter((t => !!t.result));
|
|
4116
4146
|
// Omit RunAggregationQueryResponse that only contain readTimes.
|
|
@@ -6892,13 +6922,13 @@ function __PRIVATE_validateReference(t, e) {
|
|
|
6892
6922
|
class __PRIVATE_TransactionRunner {
|
|
6893
6923
|
constructor(t, e, r, n, i) {
|
|
6894
6924
|
this.asyncQueue = t, this.datastore = e, this.options = r, this.updateFunction = n,
|
|
6895
|
-
this.deferred = i, this.
|
|
6925
|
+
this.deferred = i, this.Tt = r.maxAttempts, this.At = new __PRIVATE_ExponentialBackoff(this.asyncQueue, "transaction_retry" /* TimerId.TransactionRetry */);
|
|
6896
6926
|
}
|
|
6897
6927
|
/** Runs the transaction and sets the result on deferred. */ Pt() {
|
|
6898
|
-
this.
|
|
6928
|
+
this.Tt -= 1, this.Rt();
|
|
6899
6929
|
}
|
|
6900
6930
|
Rt() {
|
|
6901
|
-
this.
|
|
6931
|
+
this.At.H((async () => {
|
|
6902
6932
|
const t = new Transaction$1(this.datastore), e = this.Vt(t);
|
|
6903
6933
|
e && e.then((e => {
|
|
6904
6934
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
@@ -6922,7 +6952,7 @@ class __PRIVATE_TransactionRunner {
|
|
|
6922
6952
|
}
|
|
6923
6953
|
}
|
|
6924
6954
|
It(t) {
|
|
6925
|
-
this.
|
|
6955
|
+
this.Tt > 0 && this.yt(t) ? (this.Tt -= 1, this.asyncQueue.enqueueAndForget((() => (this.Rt(),
|
|
6926
6956
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
6927
6957
|
}
|
|
6928
6958
|
yt(t) {
|
|
@@ -7122,14 +7152,14 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7122
7152
|
// List of TimerIds to fast-forward delays for.
|
|
7123
7153
|
this.Ct = [],
|
|
7124
7154
|
// Backoff timer used to schedule retries for retryable operations
|
|
7125
|
-
this.
|
|
7155
|
+
this.At = new __PRIVATE_ExponentialBackoff(this, "async_queue_retry" /* TimerId.AsyncQueueRetry */),
|
|
7126
7156
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
7127
7157
|
// operations. Meant to speed up recovery when we regain file system access
|
|
7128
7158
|
// after page comes into foreground.
|
|
7129
7159
|
this.St = () => {
|
|
7130
7160
|
const t = getDocument();
|
|
7131
7161
|
t && __PRIVATE_logDebug(lt, "Visibility state changed to " + t.visibilityState),
|
|
7132
|
-
this.
|
|
7162
|
+
this.At.Y();
|
|
7133
7163
|
}, this.Nt = t;
|
|
7134
7164
|
const e = getDocument();
|
|
7135
7165
|
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.St);
|
|
@@ -7176,7 +7206,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7176
7206
|
*/ async Bt() {
|
|
7177
7207
|
if (0 !== this.wt.length) {
|
|
7178
7208
|
try {
|
|
7179
|
-
await this.wt[0](), this.wt.shift(), this.
|
|
7209
|
+
await this.wt[0](), this.wt.shift(), this.At.reset();
|
|
7180
7210
|
} catch (t) {
|
|
7181
7211
|
if (!
|
|
7182
7212
|
/**
|
|
@@ -7215,7 +7245,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7215
7245
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
7216
7246
|
// new backoff on every call, there is only ever a single additional
|
|
7217
7247
|
// operation in the queue.
|
|
7218
|
-
this.
|
|
7248
|
+
this.At.H((() => this.Bt()));
|
|
7219
7249
|
}
|
|
7220
7250
|
}
|
|
7221
7251
|
qt(t) {
|
|
@@ -7301,7 +7331,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7301
7331
|
* @param lastTimerId - Delayed operations up to and including this TimerId
|
|
7302
7332
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
7303
7333
|
* @returns a Promise that resolves once all operations have been run.
|
|
7304
|
-
*/
|
|
7334
|
+
*/ xt(t) {
|
|
7305
7335
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
7306
7336
|
return this.Qt().then((() => {
|
|
7307
7337
|
// Run ops in the same order they'd run if they ran naturally.
|
|
@@ -7313,7 +7343,7 @@ class __PRIVATE_AsyncQueueImpl {
|
|
|
7313
7343
|
}
|
|
7314
7344
|
/**
|
|
7315
7345
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
7316
|
-
*/
|
|
7346
|
+
*/ Mt(t) {
|
|
7317
7347
|
this.Ct.push(t);
|
|
7318
7348
|
}
|
|
7319
7349
|
/** Called once a DelayedOperation is run or canceled. */ $t(t) {
|
|
@@ -7404,7 +7434,7 @@ class Transaction {
|
|
|
7404
7434
|
* @packageDocumentation
|
|
7405
7435
|
*/ !function __PRIVATE_registerFirestore() {
|
|
7406
7436
|
!function __PRIVATE_setSDKVersion(t) {
|
|
7407
|
-
|
|
7437
|
+
A = t;
|
|
7408
7438
|
}(`${s}_lite`), n(new o("firestore/lite", ((t, {instanceIdentifier: e, options: r}) => {
|
|
7409
7439
|
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) {
|
|
7410
7440
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new FirestoreError(p, '"projectId" not provided in firebase.initializeApp.');
|
|
@@ -7413,7 +7443,7 @@ class Transaction {
|
|
|
7413
7443
|
return r && i._setSettings(r), i;
|
|
7414
7444
|
}), "PUBLIC").setMultipleInstances(!0)),
|
|
7415
7445
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
7416
|
-
i("firestore-lite",
|
|
7446
|
+
i("firestore-lite", T, "rn"), i("firestore-lite", T, "esm2017");
|
|
7417
7447
|
}();
|
|
7418
7448
|
|
|
7419
7449
|
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 };
|