@firebase/firestore 3.4.8 → 3.4.9-canary.0197076b8
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/CHANGELOG.md +10 -0
- package/dist/firestore/lite/index.d.ts +1 -0
- package/dist/firestore/src/api/transaction.d.ts +4 -1
- package/dist/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/firestore/src/api.d.ts +1 -0
- package/dist/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/firestore/src/core/query.d.ts +2 -4
- package/dist/firestore/src/core/target.d.ts +6 -4
- package/dist/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/firestore/src/lite-api/transaction.d.ts +4 -1
- package/dist/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/firestore/src/local/document_overlay_cache.d.ts +5 -0
- package/dist/firestore/src/local/index_manager.d.ts +24 -3
- package/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +4 -7
- package/dist/firestore/src/local/indexeddb_schema.d.ts +4 -2
- package/dist/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
- package/dist/firestore/src/local/indexeddb_sentinels.d.ts +1 -0
- package/dist/firestore/src/local/local_documents_view.d.ts +47 -8
- package/dist/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
- package/dist/firestore/src/local/memory_index_manager.d.ts +3 -2
- package/dist/firestore/src/local/overlayed_document.d.ts +36 -0
- package/dist/firestore/src/local/query_engine.d.ts +44 -5
- package/dist/firestore/src/model/collections.d.ts +3 -1
- package/dist/firestore/src/model/field_mask.d.ts +6 -0
- package/dist/firestore/src/model/mutation.d.ts +19 -1
- package/dist/firestore/src/model/mutation_batch.d.ts +9 -4
- package/dist/firestore/src/model/values.d.ts +14 -2
- package/dist/firestore/src/tsdoc-metadata.json +11 -11
- package/dist/firestore/src/util/misc.d.ts +3 -0
- package/dist/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
- package/dist/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
- package/dist/firestore/test/unit/local/test_index_manager.d.ts +2 -2
- package/dist/firestore/test/util/helpers.d.ts +12 -0
- package/dist/index.d.ts +28 -3
- package/dist/index.esm2017.js +9384 -9023
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +7406 -7016
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +5607 -5089
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +5607 -5089
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +7162 -6801
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +6007 -5918
- package/dist/lite/firestore/lite/index.d.ts +1 -0
- package/dist/lite/firestore/src/api/transaction.d.ts +4 -1
- package/dist/lite/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/lite/firestore/src/api.d.ts +1 -0
- package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/lite/firestore/src/core/query.d.ts +2 -4
- package/dist/lite/firestore/src/core/target.d.ts +6 -4
- package/dist/lite/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/lite/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/lite/firestore/src/lite-api/transaction.d.ts +4 -1
- package/dist/lite/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/lite/firestore/src/local/document_overlay_cache.d.ts +5 -0
- package/dist/lite/firestore/src/local/index_manager.d.ts +24 -3
- package/dist/lite/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +4 -7
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +4 -2
- package/dist/lite/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
- package/dist/lite/firestore/src/local/indexeddb_sentinels.d.ts +1 -0
- package/dist/lite/firestore/src/local/local_documents_view.d.ts +47 -8
- package/dist/lite/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
- package/dist/lite/firestore/src/local/memory_index_manager.d.ts +3 -2
- package/dist/lite/firestore/src/local/overlayed_document.d.ts +36 -0
- package/dist/lite/firestore/src/local/query_engine.d.ts +44 -5
- package/dist/lite/firestore/src/model/collections.d.ts +3 -1
- package/dist/lite/firestore/src/model/field_mask.d.ts +6 -0
- package/dist/lite/firestore/src/model/mutation.d.ts +19 -1
- package/dist/lite/firestore/src/model/mutation_batch.d.ts +9 -4
- package/dist/lite/firestore/src/model/values.d.ts +14 -2
- package/dist/lite/firestore/src/util/misc.d.ts +3 -0
- package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
- package/dist/lite/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
- package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +2 -2
- package/dist/lite/firestore/test/util/helpers.d.ts +12 -0
- package/dist/lite/index.browser.esm2017.js +1209 -698
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +1213 -813
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.d.ts +26 -1
- package/dist/lite/index.node.cjs.js +709 -15
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +709 -15
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +1828 -1317
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +2912 -2874
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +103 -101
- package/dist/lite/packages/firestore/lite/index.d.ts +1 -0
- package/dist/lite/packages/firestore/src/api/transaction.d.ts +4 -1
- package/dist/lite/packages/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/lite/packages/firestore/src/api.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/lite/packages/firestore/src/core/query.d.ts +2 -4
- package/dist/lite/packages/firestore/src/core/target.d.ts +6 -4
- package/dist/lite/packages/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/lite/packages/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/lite/packages/firestore/src/lite-api/transaction.d.ts +4 -1
- package/dist/lite/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/lite/packages/firestore/src/local/document_overlay_cache.d.ts +5 -0
- package/dist/lite/packages/firestore/src/local/index_manager.d.ts +24 -3
- package/dist/lite/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +4 -7
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +4 -2
- package/dist/lite/packages/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_sentinels.d.ts +1 -0
- package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +47 -8
- package/dist/lite/packages/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
- package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +3 -2
- package/dist/lite/packages/firestore/src/local/overlayed_document.d.ts +36 -0
- package/dist/lite/packages/firestore/src/local/query_engine.d.ts +44 -5
- package/dist/lite/packages/firestore/src/model/collections.d.ts +3 -1
- package/dist/lite/packages/firestore/src/model/field_mask.d.ts +6 -0
- package/dist/lite/packages/firestore/src/model/mutation.d.ts +19 -1
- package/dist/lite/packages/firestore/src/model/mutation_batch.d.ts +9 -4
- package/dist/lite/packages/firestore/src/model/values.d.ts +14 -2
- package/dist/lite/packages/firestore/src/util/misc.d.ts +3 -0
- package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
- package/dist/lite/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
- package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +2 -2
- package/dist/lite/packages/firestore/test/util/helpers.d.ts +12 -0
- package/dist/lite/private.d.ts +2772 -2734
- package/dist/packages/firestore/dist/index.esm2017.d.ts +197 -194
- package/dist/packages/firestore/lite/index.d.ts +1 -0
- package/dist/packages/firestore/src/api/transaction.d.ts +4 -1
- package/dist/packages/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/packages/firestore/src/api.d.ts +1 -0
- package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/packages/firestore/src/core/query.d.ts +2 -4
- package/dist/packages/firestore/src/core/target.d.ts +6 -4
- package/dist/packages/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/packages/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/packages/firestore/src/lite-api/transaction.d.ts +4 -1
- package/dist/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/packages/firestore/src/local/document_overlay_cache.d.ts +5 -0
- package/dist/packages/firestore/src/local/index_manager.d.ts +24 -3
- package/dist/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +4 -7
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +4 -2
- package/dist/packages/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
- package/dist/packages/firestore/src/local/indexeddb_sentinels.d.ts +1 -0
- package/dist/packages/firestore/src/local/local_documents_view.d.ts +47 -8
- package/dist/packages/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
- package/dist/packages/firestore/src/local/memory_index_manager.d.ts +3 -2
- package/dist/packages/firestore/src/local/overlayed_document.d.ts +36 -0
- package/dist/packages/firestore/src/local/query_engine.d.ts +44 -5
- package/dist/packages/firestore/src/model/collections.d.ts +3 -1
- package/dist/packages/firestore/src/model/field_mask.d.ts +6 -0
- package/dist/packages/firestore/src/model/mutation.d.ts +19 -1
- package/dist/packages/firestore/src/model/mutation_batch.d.ts +9 -4
- package/dist/packages/firestore/src/model/values.d.ts +14 -2
- package/dist/packages/firestore/src/util/misc.d.ts +3 -0
- package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
- package/dist/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
- package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +2 -2
- package/dist/packages/firestore/test/util/helpers.d.ts +12 -0
- package/dist/private.d.ts +5715 -5626
- package/package.json +20 -18
|
@@ -63,7 +63,7 @@ l.MOCK_USER = new l("mock-user");
|
|
|
63
63
|
* See the License for the specific language governing permissions and
|
|
64
64
|
* limitations under the License.
|
|
65
65
|
*/
|
|
66
|
-
let f = "9.
|
|
66
|
+
let f = "9.8.2-canary.0197076b8";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -218,9 +218,9 @@ e) {
|
|
|
218
218
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
219
219
|
* See the License for the specific language governing permissions and
|
|
220
220
|
* limitations under the License.
|
|
221
|
-
*/ const E = "ok", T = "cancelled", I = "unknown", A = "invalid-argument", R = "deadline-exceeded", P = "not-found", V = "already-exists",
|
|
221
|
+
*/ const E = "ok", T = "cancelled", I = "unknown", A = "invalid-argument", R = "deadline-exceeded", P = "not-found", V = "already-exists", N = "permission-denied", D = "unauthenticated", $ = "resource-exhausted", x = "failed-precondition", F = "aborted", S = "out-of-range", q = "unimplemented", O = "internal", k = "unavailable", C = "data-loss";
|
|
222
222
|
|
|
223
|
-
/** An error returned by a Firestore operation. */ class
|
|
223
|
+
/** An error returned by a Firestore operation. */ class L extends FirebaseError {
|
|
224
224
|
/** @hideconstructor */
|
|
225
225
|
constructor(
|
|
226
226
|
/**
|
|
@@ -254,7 +254,7 @@ e) {
|
|
|
254
254
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
255
255
|
* See the License for the specific language governing permissions and
|
|
256
256
|
* limitations under the License.
|
|
257
|
-
*/ class
|
|
257
|
+
*/ class M {
|
|
258
258
|
constructor() {
|
|
259
259
|
this.promise = new Promise(((t, e) => {
|
|
260
260
|
this.resolve = t, this.reject = e;
|
|
@@ -277,7 +277,7 @@ e) {
|
|
|
277
277
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
278
278
|
* See the License for the specific language governing permissions and
|
|
279
279
|
* limitations under the License.
|
|
280
|
-
*/ class
|
|
280
|
+
*/ class U {
|
|
281
281
|
constructor(t, e) {
|
|
282
282
|
this.user = e, this.type = "OAuth", this.headers = new Map, this.headers.set("Authorization", `Bearer ${t}`);
|
|
283
283
|
}
|
|
@@ -286,7 +286,7 @@ e) {
|
|
|
286
286
|
/**
|
|
287
287
|
* A CredentialsProvider that always yields an empty token.
|
|
288
288
|
* @internal
|
|
289
|
-
*/ class
|
|
289
|
+
*/ class j {
|
|
290
290
|
getToken() {
|
|
291
291
|
return Promise.resolve(null);
|
|
292
292
|
}
|
|
@@ -333,7 +333,7 @@ e) {
|
|
|
333
333
|
}
|
|
334
334
|
getToken() {
|
|
335
335
|
return this.auth ? this.auth.getToken().then((t => t ? (v("string" == typeof t.accessToken),
|
|
336
|
-
new
|
|
336
|
+
new U(t.accessToken, new l(this.auth.getUid()))) : null)) : Promise.resolve(null);
|
|
337
337
|
}
|
|
338
338
|
invalidateToken() {}
|
|
339
339
|
start(t, e) {}
|
|
@@ -358,7 +358,7 @@ e) {
|
|
|
358
358
|
* Provides user credentials required for the Firestore JavaScript SDK
|
|
359
359
|
* to authenticate the user, using technique that is only available
|
|
360
360
|
* to applications hosted by Google.
|
|
361
|
-
*/ class
|
|
361
|
+
*/ class W {
|
|
362
362
|
constructor(t, e, n) {
|
|
363
363
|
this.t = t, this.i = e, this.o = n;
|
|
364
364
|
}
|
|
@@ -373,13 +373,13 @@ e) {
|
|
|
373
373
|
invalidateToken() {}
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
-
class
|
|
376
|
+
class K {
|
|
377
377
|
constructor(t) {
|
|
378
378
|
this.value = t, this.type = "AppCheck", this.headers = new Map, t && t.length > 0 && this.headers.set("x-firebase-appcheck", this.value);
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
-
/** AppCheck token provider for the Lite SDK. */ class
|
|
382
|
+
/** AppCheck token provider for the Lite SDK. */ class Q {
|
|
383
383
|
constructor(t) {
|
|
384
384
|
this.u = t, this.appCheck = null, t.onInit((t => {
|
|
385
385
|
this.appCheck = t;
|
|
@@ -387,7 +387,7 @@ class W {
|
|
|
387
387
|
}
|
|
388
388
|
getToken() {
|
|
389
389
|
return this.appCheck ? this.appCheck.getToken().then((t => t ? (v("string" == typeof t.token),
|
|
390
|
-
new
|
|
390
|
+
new K(t.token)) : null)) : Promise.resolve(null);
|
|
391
391
|
}
|
|
392
392
|
invalidateToken() {}
|
|
393
393
|
start(t, e) {}
|
|
@@ -414,7 +414,7 @@ class W {
|
|
|
414
414
|
* See the License for the specific language governing permissions and
|
|
415
415
|
* limitations under the License.
|
|
416
416
|
*/
|
|
417
|
-
class
|
|
417
|
+
class Y {
|
|
418
418
|
/**
|
|
419
419
|
* Constructs a DatabaseInfo using the provided host, databaseId and
|
|
420
420
|
* persistenceKey.
|
|
@@ -443,18 +443,18 @@ class H {
|
|
|
443
443
|
* Represents the database ID a Firestore client is associated with.
|
|
444
444
|
* @internal
|
|
445
445
|
*/
|
|
446
|
-
class
|
|
446
|
+
class H {
|
|
447
447
|
constructor(t, e) {
|
|
448
448
|
this.projectId = t, this.database = e || "(default)";
|
|
449
449
|
}
|
|
450
450
|
static empty() {
|
|
451
|
-
return new
|
|
451
|
+
return new H("", "");
|
|
452
452
|
}
|
|
453
453
|
get isDefaultDatabase() {
|
|
454
454
|
return "(default)" === this.database;
|
|
455
455
|
}
|
|
456
456
|
isEqual(t) {
|
|
457
|
-
return t instanceof
|
|
457
|
+
return t instanceof H && t.projectId === this.projectId && t.database === this.database;
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
460
|
|
|
@@ -570,7 +570,7 @@ class J {
|
|
|
570
570
|
// for legacy reasons and should not be used frequently).
|
|
571
571
|
const e = [];
|
|
572
572
|
for (const n of t) {
|
|
573
|
-
if (n.indexOf("//") >= 0) throw new
|
|
573
|
+
if (n.indexOf("//") >= 0) throw new L(A, `Invalid segment (${n}). Paths must not contain // in them.`);
|
|
574
574
|
// Strip leading and traling slashed.
|
|
575
575
|
e.push(...n.split("/").filter((t => t.length > 0)));
|
|
576
576
|
}
|
|
@@ -626,20 +626,20 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
626
626
|
const e = [];
|
|
627
627
|
let n = "", r = 0;
|
|
628
628
|
const s = () => {
|
|
629
|
-
if (0 === n.length) throw new
|
|
629
|
+
if (0 === n.length) throw new L(A, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
|
|
630
630
|
e.push(n), n = "";
|
|
631
631
|
};
|
|
632
632
|
let i = !1;
|
|
633
633
|
for (;r < t.length; ) {
|
|
634
634
|
const e = t[r];
|
|
635
635
|
if ("\\" === e) {
|
|
636
|
-
if (r + 1 === t.length) throw new
|
|
636
|
+
if (r + 1 === t.length) throw new L(A, "Path has trailing escape character: " + t);
|
|
637
637
|
const e = t[r + 1];
|
|
638
|
-
if ("\\" !== e && "." !== e && "`" !== e) throw new
|
|
638
|
+
if ("\\" !== e && "." !== e && "`" !== e) throw new L(A, "Path has invalid escape sequence: " + t);
|
|
639
639
|
n += e, r += 2;
|
|
640
640
|
} else "`" === e ? (i = !i, r++) : "." !== e || i ? (n += e, r++) : (s(), r++);
|
|
641
641
|
}
|
|
642
|
-
if (s(), i) throw new
|
|
642
|
+
if (s(), i) throw new L(A, "Unterminated ` in path: " + t);
|
|
643
643
|
return new tt(e);
|
|
644
644
|
}
|
|
645
645
|
static emptyPath() {
|
|
@@ -728,7 +728,7 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
728
728
|
* See the License for the specific language governing permissions and
|
|
729
729
|
* limitations under the License.
|
|
730
730
|
*/ function nt(t, e, n) {
|
|
731
|
-
if (!n) throw new
|
|
731
|
+
if (!n) throw new L(A, `Function ${t}() cannot be called with an empty ${e}.`);
|
|
732
732
|
}
|
|
733
733
|
|
|
734
734
|
/**
|
|
@@ -740,14 +740,14 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
740
740
|
* an even numbers of segments).
|
|
741
741
|
*/
|
|
742
742
|
function rt(t) {
|
|
743
|
-
if (!et.isDocumentKey(t)) throw new
|
|
743
|
+
if (!et.isDocumentKey(t)) throw new L(A, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
|
|
744
744
|
}
|
|
745
745
|
|
|
746
746
|
/**
|
|
747
747
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
748
748
|
* contains an odd numbers of segments).
|
|
749
749
|
*/ function st(t) {
|
|
750
|
-
if (et.isDocumentKey(t)) throw new
|
|
750
|
+
if (et.isDocumentKey(t)) throw new L(A, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
|
|
751
751
|
}
|
|
752
752
|
|
|
753
753
|
/**
|
|
@@ -791,17 +791,17 @@ e) {
|
|
|
791
791
|
// Unwrap Compat types
|
|
792
792
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
793
793
|
t = t._delegate), !(t instanceof e)) {
|
|
794
|
-
if (e.name === t.constructor.name) throw new
|
|
794
|
+
if (e.name === t.constructor.name) throw new L(A, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
795
795
|
{
|
|
796
796
|
const n = it(t);
|
|
797
|
-
throw new
|
|
797
|
+
throw new L(A, `Expected type '${e.name}', but it was: ${n}`);
|
|
798
798
|
}
|
|
799
799
|
}
|
|
800
800
|
return t;
|
|
801
801
|
}
|
|
802
802
|
|
|
803
803
|
function ut(t, e) {
|
|
804
|
-
if (e <= 0) throw new
|
|
804
|
+
if (e <= 0) throw new L(A, `Function ${t}() requires a positive number, but it was: ${e}.`);
|
|
805
805
|
}
|
|
806
806
|
|
|
807
807
|
/**
|
|
@@ -913,18 +913,18 @@ function dt(t) {
|
|
|
913
913
|
|
|
914
914
|
case 400:
|
|
915
915
|
// Bad Request
|
|
916
|
-
return
|
|
916
|
+
return x;
|
|
917
917
|
|
|
918
918
|
// Other possibilities based on the forward mapping
|
|
919
919
|
// return Code.INVALID_ARGUMENT;
|
|
920
920
|
// return Code.OUT_OF_RANGE;
|
|
921
921
|
case 401:
|
|
922
922
|
// Unauthorized
|
|
923
|
-
return
|
|
923
|
+
return D;
|
|
924
924
|
|
|
925
925
|
case 403:
|
|
926
926
|
// Forbidden
|
|
927
|
-
return
|
|
927
|
+
return N;
|
|
928
928
|
|
|
929
929
|
case 404:
|
|
930
930
|
// Not Found
|
|
@@ -938,7 +938,7 @@ function dt(t) {
|
|
|
938
938
|
// return Code.ALREADY_EXISTS;
|
|
939
939
|
case 416:
|
|
940
940
|
// Range Not Satisfiable
|
|
941
|
-
return
|
|
941
|
+
return S;
|
|
942
942
|
|
|
943
943
|
case 429:
|
|
944
944
|
// Too Many Requests
|
|
@@ -961,14 +961,14 @@ function dt(t) {
|
|
|
961
961
|
|
|
962
962
|
case 503:
|
|
963
963
|
// Service Unavailable
|
|
964
|
-
return
|
|
964
|
+
return k;
|
|
965
965
|
|
|
966
966
|
case 504:
|
|
967
967
|
// Gateway Timeout
|
|
968
968
|
return R;
|
|
969
969
|
|
|
970
970
|
default:
|
|
971
|
-
return t >= 200 && t < 300 ? E : t >= 400 && t < 500 ?
|
|
971
|
+
return t >= 200 && t < 300 ? E : t >= 400 && t < 500 ? x : t >= 500 && t < 600 ? O : I;
|
|
972
972
|
}
|
|
973
973
|
}
|
|
974
974
|
|
|
@@ -1063,9 +1063,9 @@ class {
|
|
|
1063
1063
|
body: s
|
|
1064
1064
|
});
|
|
1065
1065
|
} catch (t) {
|
|
1066
|
-
throw new
|
|
1066
|
+
throw new L(dt(t.status), "Request failed with error: " + t.statusText);
|
|
1067
1067
|
}
|
|
1068
|
-
if (!i.ok) throw new
|
|
1068
|
+
if (!i.ok) throw new L(dt(i.status), "Request failed with error: " + i.statusText);
|
|
1069
1069
|
return i.json();
|
|
1070
1070
|
}
|
|
1071
1071
|
}
|
|
@@ -1211,11 +1211,11 @@ class gt {
|
|
|
1211
1211
|
* The fractions of a second at nanosecond resolution.*
|
|
1212
1212
|
*/
|
|
1213
1213
|
e) {
|
|
1214
|
-
if (this.seconds = t, this.nanoseconds = e, e < 0) throw new
|
|
1215
|
-
if (e >= 1e9) throw new
|
|
1216
|
-
if (t < -62135596800) throw new
|
|
1214
|
+
if (this.seconds = t, this.nanoseconds = e, e < 0) throw new L(A, "Timestamp nanoseconds out of range: " + e);
|
|
1215
|
+
if (e >= 1e9) throw new L(A, "Timestamp nanoseconds out of range: " + e);
|
|
1216
|
+
if (t < -62135596800) throw new L(A, "Timestamp seconds out of range: " + t);
|
|
1217
1217
|
// This will break in the year 10,000.
|
|
1218
|
-
if (t >= 253402300800) throw new
|
|
1218
|
+
if (t >= 253402300800) throw new L(A, "Timestamp seconds out of range: " + t);
|
|
1219
1219
|
}
|
|
1220
1220
|
/**
|
|
1221
1221
|
* Creates a new timestamp with the current date, with millisecond precision.
|
|
@@ -1376,6 +1376,462 @@ function Et(t, e) {
|
|
|
1376
1376
|
for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
|
|
1377
1377
|
}
|
|
1378
1378
|
|
|
1379
|
+
/**
|
|
1380
|
+
* @license
|
|
1381
|
+
* Copyright 2017 Google LLC
|
|
1382
|
+
*
|
|
1383
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1384
|
+
* you may not use this file except in compliance with the License.
|
|
1385
|
+
* You may obtain a copy of the License at
|
|
1386
|
+
*
|
|
1387
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1388
|
+
*
|
|
1389
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1390
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1391
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1392
|
+
* See the License for the specific language governing permissions and
|
|
1393
|
+
* limitations under the License.
|
|
1394
|
+
*/
|
|
1395
|
+
// An immutable sorted map implementation, based on a Left-leaning Red-Black
|
|
1396
|
+
// tree.
|
|
1397
|
+
class Tt {
|
|
1398
|
+
constructor(t, e) {
|
|
1399
|
+
this.comparator = t, this.root = e || At.EMPTY;
|
|
1400
|
+
}
|
|
1401
|
+
// Returns a copy of the map, with the specified key/value added or replaced.
|
|
1402
|
+
insert(t, e) {
|
|
1403
|
+
return new Tt(this.comparator, this.root.insert(t, e, this.comparator).copy(null, null, At.BLACK, null, null));
|
|
1404
|
+
}
|
|
1405
|
+
// Returns a copy of the map, with the specified key removed.
|
|
1406
|
+
remove(t) {
|
|
1407
|
+
return new Tt(this.comparator, this.root.remove(t, this.comparator).copy(null, null, At.BLACK, null, null));
|
|
1408
|
+
}
|
|
1409
|
+
// Returns the value of the node with the given key, or null.
|
|
1410
|
+
get(t) {
|
|
1411
|
+
let e = this.root;
|
|
1412
|
+
for (;!e.isEmpty(); ) {
|
|
1413
|
+
const n = this.comparator(t, e.key);
|
|
1414
|
+
if (0 === n) return e.value;
|
|
1415
|
+
n < 0 ? e = e.left : n > 0 && (e = e.right);
|
|
1416
|
+
}
|
|
1417
|
+
return null;
|
|
1418
|
+
}
|
|
1419
|
+
// Returns the index of the element in this sorted map, or -1 if it doesn't
|
|
1420
|
+
// exist.
|
|
1421
|
+
indexOf(t) {
|
|
1422
|
+
// Number of nodes that were pruned when descending right
|
|
1423
|
+
let e = 0, n = this.root;
|
|
1424
|
+
for (;!n.isEmpty(); ) {
|
|
1425
|
+
const r = this.comparator(t, n.key);
|
|
1426
|
+
if (0 === r) return e + n.left.size;
|
|
1427
|
+
r < 0 ? n = n.left : (
|
|
1428
|
+
// Count all nodes left of the node plus the node itself
|
|
1429
|
+
e += n.left.size + 1, n = n.right);
|
|
1430
|
+
}
|
|
1431
|
+
// Node not found
|
|
1432
|
+
return -1;
|
|
1433
|
+
}
|
|
1434
|
+
isEmpty() {
|
|
1435
|
+
return this.root.isEmpty();
|
|
1436
|
+
}
|
|
1437
|
+
// Returns the total number of nodes in the map.
|
|
1438
|
+
get size() {
|
|
1439
|
+
return this.root.size;
|
|
1440
|
+
}
|
|
1441
|
+
// Returns the minimum key in the map.
|
|
1442
|
+
minKey() {
|
|
1443
|
+
return this.root.minKey();
|
|
1444
|
+
}
|
|
1445
|
+
// Returns the maximum key in the map.
|
|
1446
|
+
maxKey() {
|
|
1447
|
+
return this.root.maxKey();
|
|
1448
|
+
}
|
|
1449
|
+
// Traverses the map in key order and calls the specified action function
|
|
1450
|
+
// for each key/value pair. If action returns true, traversal is aborted.
|
|
1451
|
+
// Returns the first truthy value returned by action, or the last falsey
|
|
1452
|
+
// value returned by action.
|
|
1453
|
+
inorderTraversal(t) {
|
|
1454
|
+
return this.root.inorderTraversal(t);
|
|
1455
|
+
}
|
|
1456
|
+
forEach(t) {
|
|
1457
|
+
this.inorderTraversal(((e, n) => (t(e, n), !1)));
|
|
1458
|
+
}
|
|
1459
|
+
toString() {
|
|
1460
|
+
const t = [];
|
|
1461
|
+
return this.inorderTraversal(((e, n) => (t.push(`${e}:${n}`), !1))), `{${t.join(", ")}}`;
|
|
1462
|
+
}
|
|
1463
|
+
// Traverses the map in reverse key order and calls the specified action
|
|
1464
|
+
// function for each key/value pair. If action returns true, traversal is
|
|
1465
|
+
// aborted.
|
|
1466
|
+
// Returns the first truthy value returned by action, or the last falsey
|
|
1467
|
+
// value returned by action.
|
|
1468
|
+
reverseTraversal(t) {
|
|
1469
|
+
return this.root.reverseTraversal(t);
|
|
1470
|
+
}
|
|
1471
|
+
// Returns an iterator over the SortedMap.
|
|
1472
|
+
getIterator() {
|
|
1473
|
+
return new It(this.root, null, this.comparator, !1);
|
|
1474
|
+
}
|
|
1475
|
+
getIteratorFrom(t) {
|
|
1476
|
+
return new It(this.root, t, this.comparator, !1);
|
|
1477
|
+
}
|
|
1478
|
+
getReverseIterator() {
|
|
1479
|
+
return new It(this.root, null, this.comparator, !0);
|
|
1480
|
+
}
|
|
1481
|
+
getReverseIteratorFrom(t) {
|
|
1482
|
+
return new It(this.root, t, this.comparator, !0);
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
// end SortedMap
|
|
1487
|
+
// An iterator over an LLRBNode.
|
|
1488
|
+
class It {
|
|
1489
|
+
constructor(t, e, n, r) {
|
|
1490
|
+
this.isReverse = r, this.nodeStack = [];
|
|
1491
|
+
let s = 1;
|
|
1492
|
+
for (;!t.isEmpty(); ) if (s = e ? n(t.key, e) : 1,
|
|
1493
|
+
// flip the comparison if we're going in reverse
|
|
1494
|
+
e && r && (s *= -1), s < 0)
|
|
1495
|
+
// This node is less than our start key. ignore it
|
|
1496
|
+
t = this.isReverse ? t.left : t.right; else {
|
|
1497
|
+
if (0 === s) {
|
|
1498
|
+
// This node is exactly equal to our start key. Push it on the stack,
|
|
1499
|
+
// but stop iterating;
|
|
1500
|
+
this.nodeStack.push(t);
|
|
1501
|
+
break;
|
|
1502
|
+
}
|
|
1503
|
+
// This node is greater than our start key, add it to the stack and move
|
|
1504
|
+
// to the next one
|
|
1505
|
+
this.nodeStack.push(t), t = this.isReverse ? t.right : t.left;
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
getNext() {
|
|
1509
|
+
let t = this.nodeStack.pop();
|
|
1510
|
+
const e = {
|
|
1511
|
+
key: t.key,
|
|
1512
|
+
value: t.value
|
|
1513
|
+
};
|
|
1514
|
+
if (this.isReverse) for (t = t.left; !t.isEmpty(); ) this.nodeStack.push(t), t = t.right; else for (t = t.right; !t.isEmpty(); ) this.nodeStack.push(t),
|
|
1515
|
+
t = t.left;
|
|
1516
|
+
return e;
|
|
1517
|
+
}
|
|
1518
|
+
hasNext() {
|
|
1519
|
+
return this.nodeStack.length > 0;
|
|
1520
|
+
}
|
|
1521
|
+
peek() {
|
|
1522
|
+
if (0 === this.nodeStack.length) return null;
|
|
1523
|
+
const t = this.nodeStack[this.nodeStack.length - 1];
|
|
1524
|
+
return {
|
|
1525
|
+
key: t.key,
|
|
1526
|
+
value: t.value
|
|
1527
|
+
};
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
// end SortedMapIterator
|
|
1532
|
+
// Represents a node in a Left-leaning Red-Black tree.
|
|
1533
|
+
class At {
|
|
1534
|
+
constructor(t, e, n, r, s) {
|
|
1535
|
+
this.key = t, this.value = e, this.color = null != n ? n : At.RED, this.left = null != r ? r : At.EMPTY,
|
|
1536
|
+
this.right = null != s ? s : At.EMPTY, this.size = this.left.size + 1 + this.right.size;
|
|
1537
|
+
}
|
|
1538
|
+
// Returns a copy of the current node, optionally replacing pieces of it.
|
|
1539
|
+
copy(t, e, n, r, s) {
|
|
1540
|
+
return new At(null != t ? t : this.key, null != e ? e : this.value, null != n ? n : this.color, null != r ? r : this.left, null != s ? s : this.right);
|
|
1541
|
+
}
|
|
1542
|
+
isEmpty() {
|
|
1543
|
+
return !1;
|
|
1544
|
+
}
|
|
1545
|
+
// Traverses the tree in key order and calls the specified action function
|
|
1546
|
+
// for each node. If action returns true, traversal is aborted.
|
|
1547
|
+
// Returns the first truthy value returned by action, or the last falsey
|
|
1548
|
+
// value returned by action.
|
|
1549
|
+
inorderTraversal(t) {
|
|
1550
|
+
return this.left.inorderTraversal(t) || t(this.key, this.value) || this.right.inorderTraversal(t);
|
|
1551
|
+
}
|
|
1552
|
+
// Traverses the tree in reverse key order and calls the specified action
|
|
1553
|
+
// function for each node. If action returns true, traversal is aborted.
|
|
1554
|
+
// Returns the first truthy value returned by action, or the last falsey
|
|
1555
|
+
// value returned by action.
|
|
1556
|
+
reverseTraversal(t) {
|
|
1557
|
+
return this.right.reverseTraversal(t) || t(this.key, this.value) || this.left.reverseTraversal(t);
|
|
1558
|
+
}
|
|
1559
|
+
// Returns the minimum node in the tree.
|
|
1560
|
+
min() {
|
|
1561
|
+
return this.left.isEmpty() ? this : this.left.min();
|
|
1562
|
+
}
|
|
1563
|
+
// Returns the maximum key in the tree.
|
|
1564
|
+
minKey() {
|
|
1565
|
+
return this.min().key;
|
|
1566
|
+
}
|
|
1567
|
+
// Returns the maximum key in the tree.
|
|
1568
|
+
maxKey() {
|
|
1569
|
+
return this.right.isEmpty() ? this.key : this.right.maxKey();
|
|
1570
|
+
}
|
|
1571
|
+
// Returns new tree, with the key/value added.
|
|
1572
|
+
insert(t, e, n) {
|
|
1573
|
+
let r = this;
|
|
1574
|
+
const s = n(t, r.key);
|
|
1575
|
+
return r = s < 0 ? r.copy(null, null, null, r.left.insert(t, e, n), null) : 0 === s ? r.copy(null, e, null, null, null) : r.copy(null, null, null, null, r.right.insert(t, e, n)),
|
|
1576
|
+
r.fixUp();
|
|
1577
|
+
}
|
|
1578
|
+
removeMin() {
|
|
1579
|
+
if (this.left.isEmpty()) return At.EMPTY;
|
|
1580
|
+
let t = this;
|
|
1581
|
+
return t.left.isRed() || t.left.left.isRed() || (t = t.moveRedLeft()), t = t.copy(null, null, null, t.left.removeMin(), null),
|
|
1582
|
+
t.fixUp();
|
|
1583
|
+
}
|
|
1584
|
+
// Returns new tree, with the specified item removed.
|
|
1585
|
+
remove(t, e) {
|
|
1586
|
+
let n, r = this;
|
|
1587
|
+
if (e(t, r.key) < 0) r.left.isEmpty() || r.left.isRed() || r.left.left.isRed() || (r = r.moveRedLeft()),
|
|
1588
|
+
r = r.copy(null, null, null, r.left.remove(t, e), null); else {
|
|
1589
|
+
if (r.left.isRed() && (r = r.rotateRight()), r.right.isEmpty() || r.right.isRed() || r.right.left.isRed() || (r = r.moveRedRight()),
|
|
1590
|
+
0 === e(t, r.key)) {
|
|
1591
|
+
if (r.right.isEmpty()) return At.EMPTY;
|
|
1592
|
+
n = r.right.min(), r = r.copy(n.key, n.value, null, null, r.right.removeMin());
|
|
1593
|
+
}
|
|
1594
|
+
r = r.copy(null, null, null, null, r.right.remove(t, e));
|
|
1595
|
+
}
|
|
1596
|
+
return r.fixUp();
|
|
1597
|
+
}
|
|
1598
|
+
isRed() {
|
|
1599
|
+
return this.color;
|
|
1600
|
+
}
|
|
1601
|
+
// Returns new tree after performing any needed rotations.
|
|
1602
|
+
fixUp() {
|
|
1603
|
+
let t = this;
|
|
1604
|
+
return t.right.isRed() && !t.left.isRed() && (t = t.rotateLeft()), t.left.isRed() && t.left.left.isRed() && (t = t.rotateRight()),
|
|
1605
|
+
t.left.isRed() && t.right.isRed() && (t = t.colorFlip()), t;
|
|
1606
|
+
}
|
|
1607
|
+
moveRedLeft() {
|
|
1608
|
+
let t = this.colorFlip();
|
|
1609
|
+
return t.right.left.isRed() && (t = t.copy(null, null, null, null, t.right.rotateRight()),
|
|
1610
|
+
t = t.rotateLeft(), t = t.colorFlip()), t;
|
|
1611
|
+
}
|
|
1612
|
+
moveRedRight() {
|
|
1613
|
+
let t = this.colorFlip();
|
|
1614
|
+
return t.left.left.isRed() && (t = t.rotateRight(), t = t.colorFlip()), t;
|
|
1615
|
+
}
|
|
1616
|
+
rotateLeft() {
|
|
1617
|
+
const t = this.copy(null, null, At.RED, null, this.right.left);
|
|
1618
|
+
return this.right.copy(null, null, this.color, t, null);
|
|
1619
|
+
}
|
|
1620
|
+
rotateRight() {
|
|
1621
|
+
const t = this.copy(null, null, At.RED, this.left.right, null);
|
|
1622
|
+
return this.left.copy(null, null, this.color, null, t);
|
|
1623
|
+
}
|
|
1624
|
+
colorFlip() {
|
|
1625
|
+
const t = this.left.copy(null, null, !this.left.color, null, null), e = this.right.copy(null, null, !this.right.color, null, null);
|
|
1626
|
+
return this.copy(null, null, !this.color, t, e);
|
|
1627
|
+
}
|
|
1628
|
+
// For testing.
|
|
1629
|
+
checkMaxDepth() {
|
|
1630
|
+
const t = this.check();
|
|
1631
|
+
return Math.pow(2, t) <= this.size + 1;
|
|
1632
|
+
}
|
|
1633
|
+
// In a balanced RB tree, the black-depth (number of black nodes) from root to
|
|
1634
|
+
// leaves is equal on both sides. This function verifies that or asserts.
|
|
1635
|
+
check() {
|
|
1636
|
+
if (this.isRed() && this.left.isRed()) throw g();
|
|
1637
|
+
if (this.right.isRed()) throw g();
|
|
1638
|
+
const t = this.left.check();
|
|
1639
|
+
if (t !== this.right.check()) throw g();
|
|
1640
|
+
return t + (this.isRed() ? 0 : 1);
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
// end LLRBNode
|
|
1645
|
+
// Empty node is shared between all LLRB trees.
|
|
1646
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1647
|
+
At.EMPTY = null, At.RED = !0, At.BLACK = !1;
|
|
1648
|
+
|
|
1649
|
+
// end LLRBEmptyNode
|
|
1650
|
+
At.EMPTY = new
|
|
1651
|
+
// Represents an empty node (a leaf node in the Red-Black Tree).
|
|
1652
|
+
class {
|
|
1653
|
+
constructor() {
|
|
1654
|
+
this.size = 0;
|
|
1655
|
+
}
|
|
1656
|
+
get key() {
|
|
1657
|
+
throw g();
|
|
1658
|
+
}
|
|
1659
|
+
get value() {
|
|
1660
|
+
throw g();
|
|
1661
|
+
}
|
|
1662
|
+
get color() {
|
|
1663
|
+
throw g();
|
|
1664
|
+
}
|
|
1665
|
+
get left() {
|
|
1666
|
+
throw g();
|
|
1667
|
+
}
|
|
1668
|
+
get right() {
|
|
1669
|
+
throw g();
|
|
1670
|
+
}
|
|
1671
|
+
// Returns a copy of the current node.
|
|
1672
|
+
copy(t, e, n, r, s) {
|
|
1673
|
+
return this;
|
|
1674
|
+
}
|
|
1675
|
+
// Returns a copy of the tree, with the specified key/value added.
|
|
1676
|
+
insert(t, e, n) {
|
|
1677
|
+
return new At(t, e);
|
|
1678
|
+
}
|
|
1679
|
+
// Returns a copy of the tree, with the specified key removed.
|
|
1680
|
+
remove(t, e) {
|
|
1681
|
+
return this;
|
|
1682
|
+
}
|
|
1683
|
+
isEmpty() {
|
|
1684
|
+
return !0;
|
|
1685
|
+
}
|
|
1686
|
+
inorderTraversal(t) {
|
|
1687
|
+
return !1;
|
|
1688
|
+
}
|
|
1689
|
+
reverseTraversal(t) {
|
|
1690
|
+
return !1;
|
|
1691
|
+
}
|
|
1692
|
+
minKey() {
|
|
1693
|
+
return null;
|
|
1694
|
+
}
|
|
1695
|
+
maxKey() {
|
|
1696
|
+
return null;
|
|
1697
|
+
}
|
|
1698
|
+
isRed() {
|
|
1699
|
+
return !1;
|
|
1700
|
+
}
|
|
1701
|
+
// For testing.
|
|
1702
|
+
checkMaxDepth() {
|
|
1703
|
+
return !0;
|
|
1704
|
+
}
|
|
1705
|
+
check() {
|
|
1706
|
+
return 0;
|
|
1707
|
+
}
|
|
1708
|
+
};
|
|
1709
|
+
|
|
1710
|
+
/**
|
|
1711
|
+
* @license
|
|
1712
|
+
* Copyright 2017 Google LLC
|
|
1713
|
+
*
|
|
1714
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1715
|
+
* you may not use this file except in compliance with the License.
|
|
1716
|
+
* You may obtain a copy of the License at
|
|
1717
|
+
*
|
|
1718
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1719
|
+
*
|
|
1720
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1721
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1722
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1723
|
+
* See the License for the specific language governing permissions and
|
|
1724
|
+
* limitations under the License.
|
|
1725
|
+
*/
|
|
1726
|
+
/**
|
|
1727
|
+
* SortedSet is an immutable (copy-on-write) collection that holds elements
|
|
1728
|
+
* in order specified by the provided comparator.
|
|
1729
|
+
*
|
|
1730
|
+
* NOTE: if provided comparator returns 0 for two elements, we consider them to
|
|
1731
|
+
* be equal!
|
|
1732
|
+
*/
|
|
1733
|
+
class Rt {
|
|
1734
|
+
constructor(t) {
|
|
1735
|
+
this.comparator = t, this.data = new Tt(this.comparator);
|
|
1736
|
+
}
|
|
1737
|
+
has(t) {
|
|
1738
|
+
return null !== this.data.get(t);
|
|
1739
|
+
}
|
|
1740
|
+
first() {
|
|
1741
|
+
return this.data.minKey();
|
|
1742
|
+
}
|
|
1743
|
+
last() {
|
|
1744
|
+
return this.data.maxKey();
|
|
1745
|
+
}
|
|
1746
|
+
get size() {
|
|
1747
|
+
return this.data.size;
|
|
1748
|
+
}
|
|
1749
|
+
indexOf(t) {
|
|
1750
|
+
return this.data.indexOf(t);
|
|
1751
|
+
}
|
|
1752
|
+
/** Iterates elements in order defined by "comparator" */ forEach(t) {
|
|
1753
|
+
this.data.inorderTraversal(((e, n) => (t(e), !1)));
|
|
1754
|
+
}
|
|
1755
|
+
/** Iterates over `elem`s such that: range[0] <= elem < range[1]. */ forEachInRange(t, e) {
|
|
1756
|
+
const n = this.data.getIteratorFrom(t[0]);
|
|
1757
|
+
for (;n.hasNext(); ) {
|
|
1758
|
+
const r = n.getNext();
|
|
1759
|
+
if (this.comparator(r.key, t[1]) >= 0) return;
|
|
1760
|
+
e(r.key);
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
/**
|
|
1764
|
+
* Iterates over `elem`s such that: start <= elem until false is returned.
|
|
1765
|
+
*/ forEachWhile(t, e) {
|
|
1766
|
+
let n;
|
|
1767
|
+
for (n = void 0 !== e ? this.data.getIteratorFrom(e) : this.data.getIterator(); n.hasNext(); ) {
|
|
1768
|
+
if (!t(n.getNext().key)) return;
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
/** Finds the least element greater than or equal to `elem`. */ firstAfterOrEqual(t) {
|
|
1772
|
+
const e = this.data.getIteratorFrom(t);
|
|
1773
|
+
return e.hasNext() ? e.getNext().key : null;
|
|
1774
|
+
}
|
|
1775
|
+
getIterator() {
|
|
1776
|
+
return new Pt(this.data.getIterator());
|
|
1777
|
+
}
|
|
1778
|
+
getIteratorFrom(t) {
|
|
1779
|
+
return new Pt(this.data.getIteratorFrom(t));
|
|
1780
|
+
}
|
|
1781
|
+
/** Inserts or updates an element */ add(t) {
|
|
1782
|
+
return this.copy(this.data.remove(t).insert(t, !0));
|
|
1783
|
+
}
|
|
1784
|
+
/** Deletes an element */ delete(t) {
|
|
1785
|
+
return this.has(t) ? this.copy(this.data.remove(t)) : this;
|
|
1786
|
+
}
|
|
1787
|
+
isEmpty() {
|
|
1788
|
+
return this.data.isEmpty();
|
|
1789
|
+
}
|
|
1790
|
+
unionWith(t) {
|
|
1791
|
+
let e = this;
|
|
1792
|
+
// Make sure `result` always refers to the larger one of the two sets.
|
|
1793
|
+
return e.size < t.size && (e = t, t = this), t.forEach((t => {
|
|
1794
|
+
e = e.add(t);
|
|
1795
|
+
})), e;
|
|
1796
|
+
}
|
|
1797
|
+
isEqual(t) {
|
|
1798
|
+
if (!(t instanceof Rt)) return !1;
|
|
1799
|
+
if (this.size !== t.size) return !1;
|
|
1800
|
+
const e = this.data.getIterator(), n = t.data.getIterator();
|
|
1801
|
+
for (;e.hasNext(); ) {
|
|
1802
|
+
const t = e.getNext().key, r = n.getNext().key;
|
|
1803
|
+
if (0 !== this.comparator(t, r)) return !1;
|
|
1804
|
+
}
|
|
1805
|
+
return !0;
|
|
1806
|
+
}
|
|
1807
|
+
toArray() {
|
|
1808
|
+
const t = [];
|
|
1809
|
+
return this.forEach((e => {
|
|
1810
|
+
t.push(e);
|
|
1811
|
+
})), t;
|
|
1812
|
+
}
|
|
1813
|
+
toString() {
|
|
1814
|
+
const t = [];
|
|
1815
|
+
return this.forEach((e => t.push(e))), "SortedSet(" + t.toString() + ")";
|
|
1816
|
+
}
|
|
1817
|
+
copy(t) {
|
|
1818
|
+
const e = new Rt(this.comparator);
|
|
1819
|
+
return e.data = t, e;
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
class Pt {
|
|
1824
|
+
constructor(t) {
|
|
1825
|
+
this.iter = t;
|
|
1826
|
+
}
|
|
1827
|
+
getNext() {
|
|
1828
|
+
return this.iter.getNext().key;
|
|
1829
|
+
}
|
|
1830
|
+
hasNext() {
|
|
1831
|
+
return this.iter.hasNext();
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1379
1835
|
/**
|
|
1380
1836
|
* @license
|
|
1381
1837
|
* Copyright 2020 Google LLC
|
|
@@ -1401,14 +1857,25 @@ function Et(t, e) {
|
|
|
1401
1857
|
* foo.bar - Overwrites only the field bar of the object foo.
|
|
1402
1858
|
* If foo is not an object, foo is replaced with an object
|
|
1403
1859
|
* containing foo
|
|
1404
|
-
*/
|
|
1405
|
-
class Tt {
|
|
1860
|
+
*/ class Vt {
|
|
1406
1861
|
constructor(t) {
|
|
1407
1862
|
this.fields = t,
|
|
1408
1863
|
// TODO(dimond): validation of FieldMask
|
|
1409
1864
|
// Sort the field mask to support `FieldMask.isEqual()` and assert below.
|
|
1410
1865
|
t.sort(tt.comparator);
|
|
1411
1866
|
}
|
|
1867
|
+
static empty() {
|
|
1868
|
+
return new Vt([]);
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Returns a new FieldMask object that is the result of adding all the given
|
|
1872
|
+
* fields paths to this field mask.
|
|
1873
|
+
*/ unionWith(t) {
|
|
1874
|
+
let e = new Rt(tt.comparator);
|
|
1875
|
+
for (const t of this.fields) e = e.add(t);
|
|
1876
|
+
for (const n of t) e = e.add(n);
|
|
1877
|
+
return new Vt(e.toArray());
|
|
1878
|
+
}
|
|
1412
1879
|
/**
|
|
1413
1880
|
* Verifies that `fieldPath` is included by at least one field in this field
|
|
1414
1881
|
* mask.
|
|
@@ -1465,13 +1932,13 @@ class Tt {
|
|
|
1465
1932
|
* before being sent as a proto.
|
|
1466
1933
|
* @internal
|
|
1467
1934
|
*/
|
|
1468
|
-
class
|
|
1935
|
+
class Nt {
|
|
1469
1936
|
constructor(t) {
|
|
1470
1937
|
this.binaryString = t;
|
|
1471
1938
|
}
|
|
1472
1939
|
static fromBase64String(t) {
|
|
1473
1940
|
const e = atob(t);
|
|
1474
|
-
return new
|
|
1941
|
+
return new Nt(e);
|
|
1475
1942
|
}
|
|
1476
1943
|
static fromUint8Array(t) {
|
|
1477
1944
|
// TODO(indexing); Remove the copy of the byte string here as this method
|
|
@@ -1488,7 +1955,7 @@ class It {
|
|
|
1488
1955
|
/**
|
|
1489
1956
|
* Helper function to convert a binary string to an Uint8Array.
|
|
1490
1957
|
*/ (t);
|
|
1491
|
-
return new
|
|
1958
|
+
return new Nt(e);
|
|
1492
1959
|
}
|
|
1493
1960
|
[Symbol.iterator]() {
|
|
1494
1961
|
let t = 0;
|
|
@@ -1543,14 +2010,14 @@ class It {
|
|
|
1543
2010
|
}
|
|
1544
2011
|
}
|
|
1545
2012
|
|
|
1546
|
-
|
|
2013
|
+
Nt.EMPTY_BYTE_STRING = new Nt("");
|
|
1547
2014
|
|
|
1548
|
-
const
|
|
2015
|
+
const Dt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
1549
2016
|
|
|
1550
2017
|
/**
|
|
1551
2018
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
1552
2019
|
* nanos" representation.
|
|
1553
|
-
*/ function
|
|
2020
|
+
*/ function $t(t) {
|
|
1554
2021
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1555
2022
|
// while the proto js library (for node) will return a
|
|
1556
2023
|
// google.protobuf.Timestamp instance.
|
|
@@ -1559,7 +2026,7 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1559
2026
|
// (millis), so we do some custom parsing here.
|
|
1560
2027
|
// Parse the nanos right out of the string.
|
|
1561
2028
|
let e = 0;
|
|
1562
|
-
const n =
|
|
2029
|
+
const n = Dt.exec(t);
|
|
1563
2030
|
if (v(!!n), n[1]) {
|
|
1564
2031
|
// Pad the fraction out to 9 digits (nanos).
|
|
1565
2032
|
let t = n[1];
|
|
@@ -1573,21 +2040,21 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1573
2040
|
};
|
|
1574
2041
|
}
|
|
1575
2042
|
return {
|
|
1576
|
-
seconds:
|
|
1577
|
-
nanos:
|
|
2043
|
+
seconds: xt(t.seconds),
|
|
2044
|
+
nanos: xt(t.nanos)
|
|
1578
2045
|
};
|
|
1579
2046
|
}
|
|
1580
2047
|
|
|
1581
2048
|
/**
|
|
1582
2049
|
* Converts the possible Proto types for numbers into a JavaScript number.
|
|
1583
2050
|
* Returns 0 if the value is not numeric.
|
|
1584
|
-
*/ function
|
|
2051
|
+
*/ function xt(t) {
|
|
1585
2052
|
// TODO(bjornick): Handle int64 greater than 53 bits.
|
|
1586
2053
|
return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0;
|
|
1587
2054
|
}
|
|
1588
2055
|
|
|
1589
|
-
/** Converts the possible Proto types for Blobs into a ByteString. */ function
|
|
1590
|
-
return "string" == typeof t ?
|
|
2056
|
+
/** Converts the possible Proto types for Blobs into a ByteString. */ function Ft(t) {
|
|
2057
|
+
return "string" == typeof t ? Nt.fromBase64String(t) : Nt.fromUint8Array(t);
|
|
1591
2058
|
}
|
|
1592
2059
|
|
|
1593
2060
|
/**
|
|
@@ -1623,7 +2090,7 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1623
2090
|
* FieldValueOptions to value().
|
|
1624
2091
|
* - With respect to other ServerTimestampValues, they sort by their
|
|
1625
2092
|
* localWriteTime.
|
|
1626
|
-
*/ function
|
|
2093
|
+
*/ function St(t) {
|
|
1627
2094
|
var e, n;
|
|
1628
2095
|
return "server_timestamp" === (null === (n = ((null === (e = null == t ? void 0 : t.mapValue) || void 0 === e ? void 0 : e.fields) || {}).__type__) || void 0 === n ? void 0 : n.stringValue);
|
|
1629
2096
|
}
|
|
@@ -1633,15 +2100,15 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1633
2100
|
*
|
|
1634
2101
|
* Preserving the previous values allows the user to display the last resoled
|
|
1635
2102
|
* value until the backend responds with the timestamp.
|
|
1636
|
-
*/ function
|
|
2103
|
+
*/ function qt(t) {
|
|
1637
2104
|
const e = t.mapValue.fields.__previous_value__;
|
|
1638
|
-
return
|
|
2105
|
+
return St(e) ? qt(e) : e;
|
|
1639
2106
|
}
|
|
1640
2107
|
|
|
1641
2108
|
/**
|
|
1642
2109
|
* Returns the local time at which this timestamp was first set.
|
|
1643
|
-
*/ function
|
|
1644
|
-
const e =
|
|
2110
|
+
*/ function Ot(t) {
|
|
2111
|
+
const e = $t(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1645
2112
|
return new gt(e.seconds, e.nanos);
|
|
1646
2113
|
}
|
|
1647
2114
|
|
|
@@ -1660,10 +2127,17 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1660
2127
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1661
2128
|
* See the License for the specific language governing permissions and
|
|
1662
2129
|
* limitations under the License.
|
|
1663
|
-
*/
|
|
2130
|
+
*/ const kt = {
|
|
2131
|
+
fields: {
|
|
2132
|
+
__type__: {
|
|
2133
|
+
stringValue: "__max__"
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
};
|
|
2137
|
+
|
|
1664
2138
|
/** Extracts the backend's type order for the provided value. */
|
|
1665
|
-
function
|
|
1666
|
-
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ?
|
|
2139
|
+
function Ct(t) {
|
|
2140
|
+
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? St(t) ? 4 /* ServerTimestampValue */ :
|
|
1667
2141
|
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
|
|
1668
2142
|
function(t) {
|
|
1669
2143
|
return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue;
|
|
@@ -1687,13 +2161,13 @@ function St(t) {
|
|
|
1687
2161
|
/**
|
|
1688
2162
|
* An ObjectValue represents a MapValue in the Firestore Proto and offers the
|
|
1689
2163
|
* ability to add and remove fields (via the ObjectValueBuilder).
|
|
1690
|
-
*/ (t) ?
|
|
2164
|
+
*/ (t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : g();
|
|
1691
2165
|
}
|
|
1692
2166
|
|
|
1693
|
-
/** Tests `left` and `right` for equality based on the backend semantics. */ function
|
|
2167
|
+
/** Tests `left` and `right` for equality based on the backend semantics. */ function Lt(t, e) {
|
|
1694
2168
|
if (t === e) return !0;
|
|
1695
|
-
const n =
|
|
1696
|
-
if (n !==
|
|
2169
|
+
const n = Ct(t);
|
|
2170
|
+
if (n !== Ct(e)) return !1;
|
|
1697
2171
|
switch (n) {
|
|
1698
2172
|
case 0 /* NullValue */ :
|
|
1699
2173
|
case 9007199254740991 /* MaxValue */ :
|
|
@@ -1703,14 +2177,14 @@ function St(t) {
|
|
|
1703
2177
|
return t.booleanValue === e.booleanValue;
|
|
1704
2178
|
|
|
1705
2179
|
case 4 /* ServerTimestampValue */ :
|
|
1706
|
-
return
|
|
2180
|
+
return Ot(t).isEqual(Ot(e));
|
|
1707
2181
|
|
|
1708
2182
|
case 3 /* TimestampValue */ :
|
|
1709
2183
|
return function(t, e) {
|
|
1710
2184
|
if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
|
|
1711
2185
|
// Use string equality for ISO 8601 timestamps
|
|
1712
2186
|
return t.timestampValue === e.timestampValue;
|
|
1713
|
-
const n =
|
|
2187
|
+
const n = $t(t.timestampValue), r = $t(e.timestampValue);
|
|
1714
2188
|
return n.seconds === r.seconds && n.nanos === r.nanos;
|
|
1715
2189
|
}(t, e);
|
|
1716
2190
|
|
|
@@ -1719,7 +2193,7 @@ function St(t) {
|
|
|
1719
2193
|
|
|
1720
2194
|
case 6 /* BlobValue */ :
|
|
1721
2195
|
return function(t, e) {
|
|
1722
|
-
return
|
|
2196
|
+
return Ft(t.bytesValue).isEqual(Ft(e.bytesValue));
|
|
1723
2197
|
}(t, e);
|
|
1724
2198
|
|
|
1725
2199
|
case 7 /* RefValue */ :
|
|
@@ -1727,27 +2201,27 @@ function St(t) {
|
|
|
1727
2201
|
|
|
1728
2202
|
case 8 /* GeoPointValue */ :
|
|
1729
2203
|
return function(t, e) {
|
|
1730
|
-
return
|
|
2204
|
+
return xt(t.geoPointValue.latitude) === xt(e.geoPointValue.latitude) && xt(t.geoPointValue.longitude) === xt(e.geoPointValue.longitude);
|
|
1731
2205
|
}(t, e);
|
|
1732
2206
|
|
|
1733
2207
|
case 2 /* NumberValue */ :
|
|
1734
2208
|
return function(t, e) {
|
|
1735
|
-
if ("integerValue" in t && "integerValue" in e) return
|
|
2209
|
+
if ("integerValue" in t && "integerValue" in e) return xt(t.integerValue) === xt(e.integerValue);
|
|
1736
2210
|
if ("doubleValue" in t && "doubleValue" in e) {
|
|
1737
|
-
const n =
|
|
2211
|
+
const n = xt(t.doubleValue), r = xt(e.doubleValue);
|
|
1738
2212
|
return n === r ? at(n) === at(r) : isNaN(n) && isNaN(r);
|
|
1739
2213
|
}
|
|
1740
2214
|
return !1;
|
|
1741
2215
|
}(t, e);
|
|
1742
2216
|
|
|
1743
2217
|
case 9 /* ArrayValue */ :
|
|
1744
|
-
return _t(t.arrayValue.values || [], e.arrayValue.values || [],
|
|
2218
|
+
return _t(t.arrayValue.values || [], e.arrayValue.values || [], Lt);
|
|
1745
2219
|
|
|
1746
2220
|
case 10 /* ObjectValue */ :
|
|
1747
2221
|
return function(t, e) {
|
|
1748
2222
|
const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
|
|
1749
2223
|
if (bt(n) !== bt(r)) return !1;
|
|
1750
|
-
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !
|
|
2224
|
+
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !Lt(n[t], r[t]))) return !1;
|
|
1751
2225
|
return !0;
|
|
1752
2226
|
}
|
|
1753
2227
|
/** Returns true if the ArrayValue contains the specified element. */ (t, e);
|
|
@@ -1757,13 +2231,13 @@ function St(t) {
|
|
|
1757
2231
|
}
|
|
1758
2232
|
}
|
|
1759
2233
|
|
|
1760
|
-
function
|
|
1761
|
-
return void 0 !== (t.values || []).find((t =>
|
|
2234
|
+
function Mt(t, e) {
|
|
2235
|
+
return void 0 !== (t.values || []).find((t => Lt(t, e)));
|
|
1762
2236
|
}
|
|
1763
2237
|
|
|
1764
|
-
function
|
|
2238
|
+
function Ut(t, e) {
|
|
1765
2239
|
if (t === e) return 0;
|
|
1766
|
-
const n =
|
|
2240
|
+
const n = Ct(t), r = Ct(e);
|
|
1767
2241
|
if (n !== r) return yt(n, r);
|
|
1768
2242
|
switch (n) {
|
|
1769
2243
|
case 0 /* NullValue */ :
|
|
@@ -1775,24 +2249,24 @@ function qt(t, e) {
|
|
|
1775
2249
|
|
|
1776
2250
|
case 2 /* NumberValue */ :
|
|
1777
2251
|
return function(t, e) {
|
|
1778
|
-
const n =
|
|
2252
|
+
const n = xt(t.integerValue || t.doubleValue), r = xt(e.integerValue || e.doubleValue);
|
|
1779
2253
|
return n < r ? -1 : n > r ? 1 : n === r ? 0 :
|
|
1780
2254
|
// one or both are NaN.
|
|
1781
2255
|
isNaN(n) ? isNaN(r) ? 0 : -1 : 1;
|
|
1782
2256
|
}(t, e);
|
|
1783
2257
|
|
|
1784
2258
|
case 3 /* TimestampValue */ :
|
|
1785
|
-
return
|
|
2259
|
+
return jt(t.timestampValue, e.timestampValue);
|
|
1786
2260
|
|
|
1787
2261
|
case 4 /* ServerTimestampValue */ :
|
|
1788
|
-
return Ot(
|
|
2262
|
+
return jt(Ot(t), Ot(e));
|
|
1789
2263
|
|
|
1790
2264
|
case 5 /* StringValue */ :
|
|
1791
2265
|
return yt(t.stringValue, e.stringValue);
|
|
1792
2266
|
|
|
1793
2267
|
case 6 /* BlobValue */ :
|
|
1794
2268
|
return function(t, e) {
|
|
1795
|
-
const n =
|
|
2269
|
+
const n = Ft(t), r = Ft(e);
|
|
1796
2270
|
return n.compareTo(r);
|
|
1797
2271
|
}(t.bytesValue, e.bytesValue);
|
|
1798
2272
|
|
|
@@ -1808,16 +2282,16 @@ function qt(t, e) {
|
|
|
1808
2282
|
|
|
1809
2283
|
case 8 /* GeoPointValue */ :
|
|
1810
2284
|
return function(t, e) {
|
|
1811
|
-
const n = yt(
|
|
2285
|
+
const n = yt(xt(t.latitude), xt(e.latitude));
|
|
1812
2286
|
if (0 !== n) return n;
|
|
1813
|
-
return yt(
|
|
2287
|
+
return yt(xt(t.longitude), xt(e.longitude));
|
|
1814
2288
|
}(t.geoPointValue, e.geoPointValue);
|
|
1815
2289
|
|
|
1816
2290
|
case 9 /* ArrayValue */ :
|
|
1817
2291
|
return function(t, e) {
|
|
1818
2292
|
const n = t.values || [], r = e.values || [];
|
|
1819
2293
|
for (let t = 0; t < n.length && t < r.length; ++t) {
|
|
1820
|
-
const e =
|
|
2294
|
+
const e = Ut(n[t], r[t]);
|
|
1821
2295
|
if (e) return e;
|
|
1822
2296
|
}
|
|
1823
2297
|
return yt(n.length, r.length);
|
|
@@ -1825,6 +2299,9 @@ function qt(t, e) {
|
|
|
1825
2299
|
|
|
1826
2300
|
case 10 /* ObjectValue */ :
|
|
1827
2301
|
return function(t, e) {
|
|
2302
|
+
if (t === kt && e === kt) return 0;
|
|
2303
|
+
if (t === kt) return 1;
|
|
2304
|
+
if (e === kt) return -1;
|
|
1828
2305
|
const n = t.fields || {}, r = Object.keys(n), s = e.fields || {}, i = Object.keys(s);
|
|
1829
2306
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
1830
2307
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -1834,7 +2311,7 @@ function qt(t, e) {
|
|
|
1834
2311
|
for (let t = 0; t < r.length && t < i.length; ++t) {
|
|
1835
2312
|
const e = yt(r[t], i[t]);
|
|
1836
2313
|
if (0 !== e) return e;
|
|
1837
|
-
const o =
|
|
2314
|
+
const o = Ut(n[r[t]], s[i[t]]);
|
|
1838
2315
|
if (0 !== o) return o;
|
|
1839
2316
|
}
|
|
1840
2317
|
return yt(r.length, i.length);
|
|
@@ -1846,35 +2323,35 @@ function qt(t, e) {
|
|
|
1846
2323
|
}
|
|
1847
2324
|
}
|
|
1848
2325
|
|
|
1849
|
-
function
|
|
2326
|
+
function jt(t, e) {
|
|
1850
2327
|
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return yt(t, e);
|
|
1851
|
-
const n =
|
|
2328
|
+
const n = $t(t), r = $t(e), s = yt(n.seconds, r.seconds);
|
|
1852
2329
|
return 0 !== s ? s : yt(n.nanos, r.nanos);
|
|
1853
2330
|
}
|
|
1854
2331
|
|
|
1855
|
-
function
|
|
2332
|
+
function Bt(t, e) {
|
|
1856
2333
|
return {
|
|
1857
2334
|
referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`
|
|
1858
2335
|
};
|
|
1859
2336
|
}
|
|
1860
2337
|
|
|
1861
|
-
/** Returns true if `value` is an ArrayValue. */ function
|
|
2338
|
+
/** Returns true if `value` is an ArrayValue. */ function zt(t) {
|
|
1862
2339
|
return !!t && "arrayValue" in t;
|
|
1863
2340
|
}
|
|
1864
2341
|
|
|
1865
|
-
/** Returns true if `value` is a NullValue. */ function
|
|
2342
|
+
/** Returns true if `value` is a NullValue. */ function Gt(t) {
|
|
1866
2343
|
return !!t && "nullValue" in t;
|
|
1867
2344
|
}
|
|
1868
2345
|
|
|
1869
|
-
/** Returns true if `value` is NaN. */ function
|
|
2346
|
+
/** Returns true if `value` is NaN. */ function Wt(t) {
|
|
1870
2347
|
return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
|
|
1871
2348
|
}
|
|
1872
2349
|
|
|
1873
|
-
/** Returns true if `value` is a MapValue. */ function
|
|
2350
|
+
/** Returns true if `value` is a MapValue. */ function Kt(t) {
|
|
1874
2351
|
return !!t && "mapValue" in t;
|
|
1875
2352
|
}
|
|
1876
2353
|
|
|
1877
|
-
/** Creates a deep copy of `source`. */ function
|
|
2354
|
+
/** Creates a deep copy of `source`. */ function Qt(t) {
|
|
1878
2355
|
if (t.geoPointValue) return {
|
|
1879
2356
|
geoPointValue: Object.assign({}, t.geoPointValue)
|
|
1880
2357
|
};
|
|
@@ -1887,7 +2364,7 @@ function Ct(t, e) {
|
|
|
1887
2364
|
fields: {}
|
|
1888
2365
|
}
|
|
1889
2366
|
};
|
|
1890
|
-
return Et(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] =
|
|
2367
|
+
return Et(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Qt(n))), e;
|
|
1891
2368
|
}
|
|
1892
2369
|
if (t.arrayValue) {
|
|
1893
2370
|
const e = {
|
|
@@ -1895,18 +2372,18 @@ function Ct(t, e) {
|
|
|
1895
2372
|
values: []
|
|
1896
2373
|
}
|
|
1897
2374
|
};
|
|
1898
|
-
for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] =
|
|
2375
|
+
for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Qt(t.arrayValue.values[n]);
|
|
1899
2376
|
return e;
|
|
1900
2377
|
}
|
|
1901
2378
|
return Object.assign({}, t);
|
|
1902
2379
|
}
|
|
1903
2380
|
|
|
1904
|
-
class
|
|
2381
|
+
class Yt {
|
|
1905
2382
|
constructor(t) {
|
|
1906
2383
|
this.value = t;
|
|
1907
2384
|
}
|
|
1908
2385
|
static empty() {
|
|
1909
|
-
return new
|
|
2386
|
+
return new Yt({
|
|
1910
2387
|
mapValue: {}
|
|
1911
2388
|
});
|
|
1912
2389
|
}
|
|
@@ -1920,7 +2397,7 @@ class Bt {
|
|
|
1920
2397
|
{
|
|
1921
2398
|
let e = this.value;
|
|
1922
2399
|
for (let n = 0; n < t.length - 1; ++n) if (e = (e.mapValue.fields || {})[t.get(n)],
|
|
1923
|
-
!
|
|
2400
|
+
!Kt(e)) return null;
|
|
1924
2401
|
return e = (e.mapValue.fields || {})[t.lastSegment()], e || null;
|
|
1925
2402
|
}
|
|
1926
2403
|
}
|
|
@@ -1930,7 +2407,7 @@ class Bt {
|
|
|
1930
2407
|
* @param path - The field path to set.
|
|
1931
2408
|
* @param value - The value to set.
|
|
1932
2409
|
*/ set(t, e) {
|
|
1933
|
-
this.getFieldsMap(t.popLast())[t.lastSegment()] =
|
|
2410
|
+
this.getFieldsMap(t.popLast())[t.lastSegment()] = Qt(e);
|
|
1934
2411
|
}
|
|
1935
2412
|
/**
|
|
1936
2413
|
* Sets the provided fields to the provided values.
|
|
@@ -1944,7 +2421,7 @@ class Bt {
|
|
|
1944
2421
|
const t = this.getFieldsMap(e);
|
|
1945
2422
|
this.applyChanges(t, n, r), n = {}, r = [], e = s.popLast();
|
|
1946
2423
|
}
|
|
1947
|
-
t ? n[s.lastSegment()] =
|
|
2424
|
+
t ? n[s.lastSegment()] = Qt(t) : r.push(s.lastSegment());
|
|
1948
2425
|
}));
|
|
1949
2426
|
const s = this.getFieldsMap(e);
|
|
1950
2427
|
this.applyChanges(s, n, r);
|
|
@@ -1956,10 +2433,10 @@ class Bt {
|
|
|
1956
2433
|
* @param path - The field path to remove.
|
|
1957
2434
|
*/ delete(t) {
|
|
1958
2435
|
const e = this.field(t.popLast());
|
|
1959
|
-
|
|
2436
|
+
Kt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
|
|
1960
2437
|
}
|
|
1961
2438
|
isEqual(t) {
|
|
1962
|
-
return
|
|
2439
|
+
return Lt(this.value, t.value);
|
|
1963
2440
|
}
|
|
1964
2441
|
/**
|
|
1965
2442
|
* Returns the map that contains the leaf element of `path`. If the parent
|
|
@@ -1971,7 +2448,7 @@ class Bt {
|
|
|
1971
2448
|
});
|
|
1972
2449
|
for (let n = 0; n < t.length; ++n) {
|
|
1973
2450
|
let r = e.mapValue.fields[t.get(n)];
|
|
1974
|
-
|
|
2451
|
+
Kt(r) && r.mapValue.fields || (r = {
|
|
1975
2452
|
mapValue: {
|
|
1976
2453
|
fields: {}
|
|
1977
2454
|
}
|
|
@@ -1987,7 +2464,7 @@ class Bt {
|
|
|
1987
2464
|
for (const e of n) delete t[e];
|
|
1988
2465
|
}
|
|
1989
2466
|
clone() {
|
|
1990
|
-
return new
|
|
2467
|
+
return new Yt(Qt(this.value));
|
|
1991
2468
|
}
|
|
1992
2469
|
}
|
|
1993
2470
|
|
|
@@ -2016,7 +2493,7 @@ class Bt {
|
|
|
2016
2493
|
* not transition to one of these states even after all mutations have been
|
|
2017
2494
|
* applied, `isValidDocument()` returns false and the document should be removed
|
|
2018
2495
|
* from all views.
|
|
2019
|
-
*/ class
|
|
2496
|
+
*/ class Ht {
|
|
2020
2497
|
constructor(t, e, n, r, s, i) {
|
|
2021
2498
|
this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.data = s,
|
|
2022
2499
|
this.documentState = i;
|
|
@@ -2025,23 +2502,23 @@ class Bt {
|
|
|
2025
2502
|
* Creates a document with no known version or data, but which can serve as
|
|
2026
2503
|
* base document for mutations.
|
|
2027
2504
|
*/ static newInvalidDocument(t) {
|
|
2028
|
-
return new
|
|
2505
|
+
return new Ht(t, 0 /* INVALID */ , vt.min(), vt.min(), Yt.empty(), 0 /* SYNCED */);
|
|
2029
2506
|
}
|
|
2030
2507
|
/**
|
|
2031
2508
|
* Creates a new document that is known to exist with the given data at the
|
|
2032
2509
|
* given version.
|
|
2033
2510
|
*/ static newFoundDocument(t, e, n) {
|
|
2034
|
-
return new
|
|
2511
|
+
return new Ht(t, 1 /* FOUND_DOCUMENT */ , e, vt.min(), n, 0 /* SYNCED */);
|
|
2035
2512
|
}
|
|
2036
2513
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
|
|
2037
|
-
return new
|
|
2514
|
+
return new Ht(t, 2 /* NO_DOCUMENT */ , e, vt.min(), Yt.empty(), 0 /* SYNCED */);
|
|
2038
2515
|
}
|
|
2039
2516
|
/**
|
|
2040
2517
|
* Creates a new document that is known to exist at the given version but
|
|
2041
2518
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2042
2519
|
* base document).
|
|
2043
2520
|
*/ static newUnknownDocument(t, e) {
|
|
2044
|
-
return new
|
|
2521
|
+
return new Ht(t, 3 /* UNKNOWN_DOCUMENT */ , e, vt.min(), Yt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2045
2522
|
}
|
|
2046
2523
|
/**
|
|
2047
2524
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2054,7 +2531,7 @@ class Bt {
|
|
|
2054
2531
|
* Changes the document type to indicate that it doesn't exist at the given
|
|
2055
2532
|
* version.
|
|
2056
2533
|
*/ convertToNoDocument(t) {
|
|
2057
|
-
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data =
|
|
2534
|
+
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Yt.empty(),
|
|
2058
2535
|
this.documentState = 0 /* SYNCED */ , this;
|
|
2059
2536
|
}
|
|
2060
2537
|
/**
|
|
@@ -2062,14 +2539,15 @@ class Bt {
|
|
|
2062
2539
|
* that its data is not known (e.g. a document that was updated without a known
|
|
2063
2540
|
* base document).
|
|
2064
2541
|
*/ convertToUnknownDocument(t) {
|
|
2065
|
-
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data =
|
|
2542
|
+
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Yt.empty(),
|
|
2066
2543
|
this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
2067
2544
|
}
|
|
2068
2545
|
setHasCommittedMutations() {
|
|
2069
2546
|
return this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
2070
2547
|
}
|
|
2071
2548
|
setHasLocalMutations() {
|
|
2072
|
-
return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this
|
|
2549
|
+
return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this.version = vt.min(),
|
|
2550
|
+
this;
|
|
2073
2551
|
}
|
|
2074
2552
|
setReadTime(t) {
|
|
2075
2553
|
return this.readTime = t, this;
|
|
@@ -2096,10 +2574,10 @@ class Bt {
|
|
|
2096
2574
|
return 3 /* UNKNOWN_DOCUMENT */ === this.documentType;
|
|
2097
2575
|
}
|
|
2098
2576
|
isEqual(t) {
|
|
2099
|
-
return t instanceof
|
|
2577
|
+
return t instanceof Ht && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
|
|
2100
2578
|
}
|
|
2101
2579
|
mutableCopy() {
|
|
2102
|
-
return new
|
|
2580
|
+
return new Ht(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
|
|
2103
2581
|
}
|
|
2104
2582
|
toString() {
|
|
2105
2583
|
return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
|
|
@@ -2123,7 +2601,7 @@ class Bt {
|
|
|
2123
2601
|
* limitations under the License.
|
|
2124
2602
|
*/
|
|
2125
2603
|
// Visible for testing
|
|
2126
|
-
class
|
|
2604
|
+
class Jt {
|
|
2127
2605
|
constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
2128
2606
|
this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
|
|
2129
2607
|
this.startAt = i, this.endAt = o, this.P = null;
|
|
@@ -2137,29 +2615,29 @@ class Gt {
|
|
|
2137
2615
|
* NOTE: you should always construct `Target` from `Query.toTarget` instead of
|
|
2138
2616
|
* using this factory method, because `Query` provides an implicit `orderBy`
|
|
2139
2617
|
* property.
|
|
2140
|
-
*/ function
|
|
2141
|
-
return new
|
|
2618
|
+
*/ function Xt(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
2619
|
+
return new Jt(t, e, n, r, s, i, o);
|
|
2142
2620
|
}
|
|
2143
2621
|
|
|
2144
|
-
class
|
|
2622
|
+
class Zt extends class {} {
|
|
2145
2623
|
constructor(t, e, n) {
|
|
2146
2624
|
super(), this.field = t, this.op = e, this.value = n;
|
|
2147
2625
|
}
|
|
2148
2626
|
/**
|
|
2149
2627
|
* Creates a filter based on the provided arguments.
|
|
2150
2628
|
*/ static create(t, e, n) {
|
|
2151
|
-
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, n) : new
|
|
2629
|
+
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, n) : new te(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new se(t, n) : "in" /* IN */ === e ? new ie(t, n) : "not-in" /* NOT_IN */ === e ? new oe(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ue(t, n) : new Zt(t, e, n);
|
|
2152
2630
|
}
|
|
2153
2631
|
static V(t, e, n) {
|
|
2154
|
-
return "in" /* IN */ === e ? new
|
|
2632
|
+
return "in" /* IN */ === e ? new ee(t, n) : new ne(t, n);
|
|
2155
2633
|
}
|
|
2156
2634
|
matches(t) {
|
|
2157
2635
|
const e = t.data.field(this.field);
|
|
2158
2636
|
// Types do not have to match in NOT_EQUAL filters.
|
|
2159
|
-
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.
|
|
2637
|
+
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.N(Ut(e, this.value)) : null !== e && Ct(this.value) === Ct(e) && this.N(Ut(e, this.value));
|
|
2160
2638
|
// Only compare types with matching backend order (such as double and int).
|
|
2161
2639
|
}
|
|
2162
|
-
|
|
2640
|
+
N(t) {
|
|
2163
2641
|
switch (this.op) {
|
|
2164
2642
|
case "<" /* LESS_THAN */ :
|
|
2165
2643
|
return t < 0;
|
|
@@ -2183,85 +2661,85 @@ class Wt extends class {} {
|
|
|
2183
2661
|
return g();
|
|
2184
2662
|
}
|
|
2185
2663
|
}
|
|
2186
|
-
|
|
2664
|
+
D() {
|
|
2187
2665
|
return [ "<" /* LESS_THAN */ , "<=" /* LESS_THAN_OR_EQUAL */ , ">" /* GREATER_THAN */ , ">=" /* GREATER_THAN_OR_EQUAL */ , "!=" /* NOT_EQUAL */ , "not-in" /* NOT_IN */ ].indexOf(this.op) >= 0;
|
|
2188
2666
|
}
|
|
2189
2667
|
}
|
|
2190
2668
|
|
|
2191
2669
|
/** Filter that matches on key fields (i.e. '__name__'). */
|
|
2192
|
-
class
|
|
2670
|
+
class te extends Zt {
|
|
2193
2671
|
constructor(t, e, n) {
|
|
2194
2672
|
super(t, e, n), this.key = et.fromName(n.referenceValue);
|
|
2195
2673
|
}
|
|
2196
2674
|
matches(t) {
|
|
2197
2675
|
const e = et.comparator(t.key, this.key);
|
|
2198
|
-
return this.
|
|
2676
|
+
return this.N(e);
|
|
2199
2677
|
}
|
|
2200
2678
|
}
|
|
2201
2679
|
|
|
2202
|
-
/** Filter that matches on key fields within an array. */ class
|
|
2680
|
+
/** Filter that matches on key fields within an array. */ class ee extends Zt {
|
|
2203
2681
|
constructor(t, e) {
|
|
2204
|
-
super(t, "in" /* IN */ , e), this.keys =
|
|
2682
|
+
super(t, "in" /* IN */ , e), this.keys = re("in" /* IN */ , e);
|
|
2205
2683
|
}
|
|
2206
2684
|
matches(t) {
|
|
2207
2685
|
return this.keys.some((e => e.isEqual(t.key)));
|
|
2208
2686
|
}
|
|
2209
2687
|
}
|
|
2210
2688
|
|
|
2211
|
-
/** Filter that matches on key fields not present within an array. */ class
|
|
2689
|
+
/** Filter that matches on key fields not present within an array. */ class ne extends Zt {
|
|
2212
2690
|
constructor(t, e) {
|
|
2213
|
-
super(t, "not-in" /* NOT_IN */ , e), this.keys =
|
|
2691
|
+
super(t, "not-in" /* NOT_IN */ , e), this.keys = re("not-in" /* NOT_IN */ , e);
|
|
2214
2692
|
}
|
|
2215
2693
|
matches(t) {
|
|
2216
2694
|
return !this.keys.some((e => e.isEqual(t.key)));
|
|
2217
2695
|
}
|
|
2218
2696
|
}
|
|
2219
2697
|
|
|
2220
|
-
function
|
|
2698
|
+
function re(t, e) {
|
|
2221
2699
|
var n;
|
|
2222
2700
|
return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => et.fromName(t.referenceValue)));
|
|
2223
2701
|
}
|
|
2224
2702
|
|
|
2225
|
-
/** A Filter that implements the array-contains operator. */ class
|
|
2703
|
+
/** A Filter that implements the array-contains operator. */ class se extends Zt {
|
|
2226
2704
|
constructor(t, e) {
|
|
2227
2705
|
super(t, "array-contains" /* ARRAY_CONTAINS */ , e);
|
|
2228
2706
|
}
|
|
2229
2707
|
matches(t) {
|
|
2230
2708
|
const e = t.data.field(this.field);
|
|
2231
|
-
return
|
|
2709
|
+
return zt(e) && Mt(e.arrayValue, this.value);
|
|
2232
2710
|
}
|
|
2233
2711
|
}
|
|
2234
2712
|
|
|
2235
|
-
/** A Filter that implements the IN operator. */ class
|
|
2713
|
+
/** A Filter that implements the IN operator. */ class ie extends Zt {
|
|
2236
2714
|
constructor(t, e) {
|
|
2237
2715
|
super(t, "in" /* IN */ , e);
|
|
2238
2716
|
}
|
|
2239
2717
|
matches(t) {
|
|
2240
2718
|
const e = t.data.field(this.field);
|
|
2241
|
-
return null !== e &&
|
|
2719
|
+
return null !== e && Mt(this.value.arrayValue, e);
|
|
2242
2720
|
}
|
|
2243
2721
|
}
|
|
2244
2722
|
|
|
2245
|
-
/** A Filter that implements the not-in operator. */ class
|
|
2723
|
+
/** A Filter that implements the not-in operator. */ class oe extends Zt {
|
|
2246
2724
|
constructor(t, e) {
|
|
2247
2725
|
super(t, "not-in" /* NOT_IN */ , e);
|
|
2248
2726
|
}
|
|
2249
2727
|
matches(t) {
|
|
2250
|
-
if (
|
|
2728
|
+
if (Mt(this.value.arrayValue, {
|
|
2251
2729
|
nullValue: "NULL_VALUE"
|
|
2252
2730
|
})) return !1;
|
|
2253
2731
|
const e = t.data.field(this.field);
|
|
2254
|
-
return null !== e && !
|
|
2732
|
+
return null !== e && !Mt(this.value.arrayValue, e);
|
|
2255
2733
|
}
|
|
2256
2734
|
}
|
|
2257
2735
|
|
|
2258
|
-
/** A Filter that implements the array-contains-any operator. */ class
|
|
2736
|
+
/** A Filter that implements the array-contains-any operator. */ class ue extends Zt {
|
|
2259
2737
|
constructor(t, e) {
|
|
2260
2738
|
super(t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , e);
|
|
2261
2739
|
}
|
|
2262
2740
|
matches(t) {
|
|
2263
2741
|
const e = t.data.field(this.field);
|
|
2264
|
-
return !(!
|
|
2742
|
+
return !(!zt(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => Mt(this.value.arrayValue, t)));
|
|
2265
2743
|
}
|
|
2266
2744
|
}
|
|
2267
2745
|
|
|
@@ -2278,7 +2756,7 @@ function Jt(t, e) {
|
|
|
2278
2756
|
* Bound provides a function to determine whether a document comes before or
|
|
2279
2757
|
* after a bound. This is influenced by whether the position is just before or
|
|
2280
2758
|
* just after the provided values.
|
|
2281
|
-
*/ class
|
|
2759
|
+
*/ class ce {
|
|
2282
2760
|
constructor(t, e) {
|
|
2283
2761
|
this.position = t, this.inclusive = e;
|
|
2284
2762
|
}
|
|
@@ -2286,22 +2764,22 @@ function Jt(t, e) {
|
|
|
2286
2764
|
|
|
2287
2765
|
/**
|
|
2288
2766
|
* An ordering on a field, in some Direction. Direction defaults to ASCENDING.
|
|
2289
|
-
*/ class
|
|
2767
|
+
*/ class ae {
|
|
2290
2768
|
constructor(t, e = "asc" /* ASCENDING */) {
|
|
2291
2769
|
this.field = t, this.dir = e;
|
|
2292
2770
|
}
|
|
2293
2771
|
}
|
|
2294
2772
|
|
|
2295
|
-
function
|
|
2773
|
+
function he(t, e) {
|
|
2296
2774
|
return t.dir === e.dir && t.field.isEqual(e.field);
|
|
2297
2775
|
}
|
|
2298
2776
|
|
|
2299
|
-
function
|
|
2777
|
+
function le(t, e) {
|
|
2300
2778
|
if (null === t) return null === e;
|
|
2301
2779
|
if (null === e) return !1;
|
|
2302
2780
|
if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
|
|
2303
2781
|
for (let n = 0; n < t.position.length; n++) {
|
|
2304
|
-
if (!
|
|
2782
|
+
if (!Lt(t.position[n], e.position[n])) return !1;
|
|
2305
2783
|
}
|
|
2306
2784
|
return !0;
|
|
2307
2785
|
}
|
|
@@ -2328,7 +2806,7 @@ function ie(t, e) {
|
|
|
2328
2806
|
* query the RemoteStore results.
|
|
2329
2807
|
*
|
|
2330
2808
|
* Visible for testing.
|
|
2331
|
-
*/ class
|
|
2809
|
+
*/ class fe {
|
|
2332
2810
|
/**
|
|
2333
2811
|
* Initializes a Query with a path and optional additional query constraints.
|
|
2334
2812
|
* Path must currently be empty if this is a collection group query.
|
|
@@ -2337,20 +2815,16 @@ function ie(t, e) {
|
|
|
2337
2815
|
this.path = t, this.collectionGroup = e, this.explicitOrderBy = n, this.filters = r,
|
|
2338
2816
|
this.limit = s, this.limitType = i, this.startAt = o, this.endAt = u, this.$ = null,
|
|
2339
2817
|
// The corresponding `Target` of this `Query` instance.
|
|
2340
|
-
this.
|
|
2818
|
+
this.F = null, this.startAt, this.endAt;
|
|
2341
2819
|
}
|
|
2342
2820
|
}
|
|
2343
2821
|
|
|
2344
|
-
/** Creates a new Query for a query that matches all documents at `path` */ function
|
|
2345
|
-
return !ct(t.limit) && "L" /* Last */ === t.limitType;
|
|
2346
|
-
}
|
|
2347
|
-
|
|
2348
|
-
function ce(t) {
|
|
2822
|
+
/** Creates a new Query for a query that matches all documents at `path` */ function de(t) {
|
|
2349
2823
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
2350
2824
|
}
|
|
2351
2825
|
|
|
2352
|
-
function
|
|
2353
|
-
for (const e of t.filters) if (e.
|
|
2826
|
+
function we(t) {
|
|
2827
|
+
for (const e of t.filters) if (e.D()) return e.field;
|
|
2354
2828
|
return null;
|
|
2355
2829
|
}
|
|
2356
2830
|
|
|
@@ -2362,7 +2836,7 @@ function ae(t) {
|
|
|
2362
2836
|
* Returns whether the query matches a collection group rather than a specific
|
|
2363
2837
|
* collection.
|
|
2364
2838
|
*/
|
|
2365
|
-
function
|
|
2839
|
+
function me(t) {
|
|
2366
2840
|
return null !== t.collectionGroup;
|
|
2367
2841
|
}
|
|
2368
2842
|
|
|
@@ -2370,23 +2844,23 @@ function he(t) {
|
|
|
2370
2844
|
* Returns the implicit order by constraint that is used to execute the Query,
|
|
2371
2845
|
* which can be different from the order by constraints the user provided (e.g.
|
|
2372
2846
|
* the SDK and backend always orders by `__name__`).
|
|
2373
|
-
*/ function
|
|
2847
|
+
*/ function pe(t) {
|
|
2374
2848
|
const e = b(t);
|
|
2375
2849
|
if (null === e.$) {
|
|
2376
2850
|
e.$ = [];
|
|
2377
|
-
const t =
|
|
2851
|
+
const t = we(e), n = de(e);
|
|
2378
2852
|
if (null !== t && null === n)
|
|
2379
2853
|
// In order to implicitly add key ordering, we must also add the
|
|
2380
2854
|
// inequality filter field for it to be a valid query.
|
|
2381
2855
|
// Note that the default inequality field and key ordering is ascending.
|
|
2382
|
-
t.isKeyField() || e.$.push(new
|
|
2856
|
+
t.isKeyField() || e.$.push(new ae(t)), e.$.push(new ae(tt.keyField(), "asc" /* ASCENDING */)); else {
|
|
2383
2857
|
let t = !1;
|
|
2384
2858
|
for (const n of e.explicitOrderBy) e.$.push(n), n.field.isKeyField() && (t = !0);
|
|
2385
2859
|
if (!t) {
|
|
2386
2860
|
// The order of the implicit key ordering always matches the last
|
|
2387
2861
|
// explicit order by
|
|
2388
2862
|
const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
|
|
2389
|
-
e.$.push(new
|
|
2863
|
+
e.$.push(new ae(tt.keyField(), t));
|
|
2390
2864
|
}
|
|
2391
2865
|
}
|
|
2392
2866
|
}
|
|
@@ -2395,34 +2869,34 @@ function he(t) {
|
|
|
2395
2869
|
|
|
2396
2870
|
/**
|
|
2397
2871
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2398
|
-
*/ function
|
|
2872
|
+
*/ function ye(t) {
|
|
2399
2873
|
const e = b(t);
|
|
2400
|
-
if (!e.
|
|
2874
|
+
if (!e.F) if ("F" /* First */ === e.limitType) e.F = Xt(e.path, e.collectionGroup, pe(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
2401
2875
|
// Flip the orderBy directions since we want the last results
|
|
2402
2876
|
const t = [];
|
|
2403
|
-
for (const n of
|
|
2877
|
+
for (const n of pe(e)) {
|
|
2404
2878
|
const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
|
|
2405
|
-
t.push(new
|
|
2879
|
+
t.push(new ae(n.field, e));
|
|
2406
2880
|
}
|
|
2407
2881
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2408
|
-
const n = e.endAt ? new
|
|
2882
|
+
const n = e.endAt ? new ce(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new ce(e.startAt.position, e.startAt.inclusive) : null;
|
|
2409
2883
|
// Now return as a LimitType.First query.
|
|
2410
|
-
e.
|
|
2884
|
+
e.F = Xt(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
|
|
2411
2885
|
}
|
|
2412
|
-
return e.
|
|
2886
|
+
return e.F;
|
|
2413
2887
|
}
|
|
2414
2888
|
|
|
2415
|
-
function
|
|
2889
|
+
function _e(t, e) {
|
|
2416
2890
|
return function(t, e) {
|
|
2417
2891
|
if (t.limit !== e.limit) return !1;
|
|
2418
2892
|
if (t.orderBy.length !== e.orderBy.length) return !1;
|
|
2419
|
-
for (let n = 0; n < t.orderBy.length; n++) if (!
|
|
2893
|
+
for (let n = 0; n < t.orderBy.length; n++) if (!he(t.orderBy[n], e.orderBy[n])) return !1;
|
|
2420
2894
|
if (t.filters.length !== e.filters.length) return !1;
|
|
2421
2895
|
for (let s = 0; s < t.filters.length; s++) if (n = t.filters[s], r = e.filters[s],
|
|
2422
|
-
n.op !== r.op || !n.field.isEqual(r.field) || !
|
|
2896
|
+
n.op !== r.op || !n.field.isEqual(r.field) || !Lt(n.value, r.value)) return !1;
|
|
2423
2897
|
var n, r;
|
|
2424
|
-
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!
|
|
2425
|
-
}(
|
|
2898
|
+
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!le(t.startAt, e.startAt) && le(t.endAt, e.endAt);
|
|
2899
|
+
}(ye(t), ye(e)) && t.limitType === e.limitType;
|
|
2426
2900
|
}
|
|
2427
2901
|
|
|
2428
2902
|
/**
|
|
@@ -2450,7 +2924,7 @@ function de(t, e) {
|
|
|
2450
2924
|
* The return value is an IntegerValue if it can safely represent the value,
|
|
2451
2925
|
* otherwise a DoubleValue is returned.
|
|
2452
2926
|
*/
|
|
2453
|
-
function
|
|
2927
|
+
function ge(t, e) {
|
|
2454
2928
|
return function(t) {
|
|
2455
2929
|
return "number" == typeof t && Number.isInteger(t) && !at(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
|
|
2456
2930
|
}(e) ?
|
|
@@ -2462,7 +2936,7 @@ function we(t, e) {
|
|
|
2462
2936
|
integerValue: "" + t
|
|
2463
2937
|
};
|
|
2464
2938
|
}(e) : function(t, e) {
|
|
2465
|
-
if (t.
|
|
2939
|
+
if (t.S) {
|
|
2466
2940
|
if (isNaN(e)) return {
|
|
2467
2941
|
doubleValue: "NaN"
|
|
2468
2942
|
};
|
|
@@ -2495,7 +2969,7 @@ function we(t, e) {
|
|
|
2495
2969
|
* See the License for the specific language governing permissions and
|
|
2496
2970
|
* limitations under the License.
|
|
2497
2971
|
*/
|
|
2498
|
-
/** Used to represent a field transform on a mutation. */ class
|
|
2972
|
+
/** Used to represent a field transform on a mutation. */ class ve {
|
|
2499
2973
|
constructor() {
|
|
2500
2974
|
// Make sure that the structural type of `TransformOperation` is unique.
|
|
2501
2975
|
// See https://github.com/microsoft/TypeScript/issues/5451
|
|
@@ -2503,15 +2977,15 @@ function we(t, e) {
|
|
|
2503
2977
|
}
|
|
2504
2978
|
}
|
|
2505
2979
|
|
|
2506
|
-
/** Transforms a value into a server-generated timestamp. */ class
|
|
2980
|
+
/** Transforms a value into a server-generated timestamp. */ class be extends ve {}
|
|
2507
2981
|
|
|
2508
|
-
/** Transforms an array value via a union operation. */ class
|
|
2982
|
+
/** Transforms an array value via a union operation. */ class Ee extends ve {
|
|
2509
2983
|
constructor(t) {
|
|
2510
2984
|
super(), this.elements = t;
|
|
2511
2985
|
}
|
|
2512
2986
|
}
|
|
2513
2987
|
|
|
2514
|
-
/** Transforms an array value via a remove operation. */ class
|
|
2988
|
+
/** Transforms an array value via a remove operation. */ class Te extends ve {
|
|
2515
2989
|
constructor(t) {
|
|
2516
2990
|
super(), this.elements = t;
|
|
2517
2991
|
}
|
|
@@ -2522,7 +2996,7 @@ function we(t, e) {
|
|
|
2522
2996
|
* transforms. Converts all field values to integers or doubles, but unlike the
|
|
2523
2997
|
* backend does not cap integer values at 2^63. Instead, JavaScript number
|
|
2524
2998
|
* arithmetic is used and precision loss can occur for values greater than 2^53.
|
|
2525
|
-
*/ class
|
|
2999
|
+
*/ class Ie extends ve {
|
|
2526
3000
|
constructor(t, e) {
|
|
2527
3001
|
super(), this.q = t, this.O = e;
|
|
2528
3002
|
}
|
|
@@ -2544,7 +3018,7 @@ function we(t, e) {
|
|
|
2544
3018
|
* See the License for the specific language governing permissions and
|
|
2545
3019
|
* limitations under the License.
|
|
2546
3020
|
*/
|
|
2547
|
-
/** A field path and the TransformOperation to perform upon it. */ class
|
|
3021
|
+
/** A field path and the TransformOperation to perform upon it. */ class Ae {
|
|
2548
3022
|
constructor(t, e) {
|
|
2549
3023
|
this.field = t, this.transform = e;
|
|
2550
3024
|
}
|
|
@@ -2554,18 +3028,18 @@ function we(t, e) {
|
|
|
2554
3028
|
* Encodes a precondition for a mutation. This follows the model that the
|
|
2555
3029
|
* backend accepts with the special case of an explicit "empty" precondition
|
|
2556
3030
|
* (meaning no precondition).
|
|
2557
|
-
*/ class
|
|
3031
|
+
*/ class Re {
|
|
2558
3032
|
constructor(t, e) {
|
|
2559
3033
|
this.updateTime = t, this.exists = e;
|
|
2560
3034
|
}
|
|
2561
3035
|
/** Creates a new empty Precondition. */ static none() {
|
|
2562
|
-
return new
|
|
3036
|
+
return new Re;
|
|
2563
3037
|
}
|
|
2564
3038
|
/** Creates a new Precondition with an exists flag. */ static exists(t) {
|
|
2565
|
-
return new
|
|
3039
|
+
return new Re(void 0, t);
|
|
2566
3040
|
}
|
|
2567
3041
|
/** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
|
|
2568
|
-
return new
|
|
3042
|
+
return new Re(t);
|
|
2569
3043
|
}
|
|
2570
3044
|
/** Returns whether this Precondition is empty. */ get isNone() {
|
|
2571
3045
|
return void 0 === this.updateTime && void 0 === this.exists;
|
|
@@ -2618,16 +3092,19 @@ function we(t, e) {
|
|
|
2618
3092
|
* applyToLocalView() to implement the actual behavior of applying the mutation
|
|
2619
3093
|
* to some source document (see `setMutationApplyToRemoteDocument()` for an
|
|
2620
3094
|
* example).
|
|
2621
|
-
*/ class
|
|
3095
|
+
*/ class Pe {}
|
|
2622
3096
|
|
|
2623
3097
|
/**
|
|
2624
3098
|
* A mutation that creates or replaces the document at the given key with the
|
|
2625
3099
|
* object value contents.
|
|
2626
|
-
*/ class
|
|
3100
|
+
*/ class Ve extends Pe {
|
|
2627
3101
|
constructor(t, e, n, r = []) {
|
|
2628
3102
|
super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = r,
|
|
2629
3103
|
this.type = 0 /* Set */;
|
|
2630
3104
|
}
|
|
3105
|
+
getFieldMask() {
|
|
3106
|
+
return null;
|
|
3107
|
+
}
|
|
2631
3108
|
}
|
|
2632
3109
|
|
|
2633
3110
|
/**
|
|
@@ -2642,17 +3119,23 @@ function we(t, e) {
|
|
|
2642
3119
|
* is deleted.
|
|
2643
3120
|
* * When a field is not in the mask but is in the values, the values map is
|
|
2644
3121
|
* ignored.
|
|
2645
|
-
*/ class
|
|
3122
|
+
*/ class Ne extends Pe {
|
|
2646
3123
|
constructor(t, e, n, r, s = []) {
|
|
2647
3124
|
super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
|
|
2648
3125
|
this.fieldTransforms = s, this.type = 1 /* Patch */;
|
|
2649
3126
|
}
|
|
3127
|
+
getFieldMask() {
|
|
3128
|
+
return this.fieldMask;
|
|
3129
|
+
}
|
|
2650
3130
|
}
|
|
2651
3131
|
|
|
2652
|
-
/** A mutation that deletes the document at the given key. */ class
|
|
3132
|
+
/** A mutation that deletes the document at the given key. */ class De extends Pe {
|
|
2653
3133
|
constructor(t, e) {
|
|
2654
3134
|
super(), this.key = t, this.precondition = e, this.type = 2 /* Delete */ , this.fieldTransforms = [];
|
|
2655
3135
|
}
|
|
3136
|
+
getFieldMask() {
|
|
3137
|
+
return null;
|
|
3138
|
+
}
|
|
2656
3139
|
}
|
|
2657
3140
|
|
|
2658
3141
|
/**
|
|
@@ -2661,10 +3144,13 @@ function we(t, e) {
|
|
|
2661
3144
|
*
|
|
2662
3145
|
* The `verify` operation is only used in Transactions, and this class serves
|
|
2663
3146
|
* primarily to facilitate serialization into protos.
|
|
2664
|
-
*/ class
|
|
3147
|
+
*/ class $e extends Pe {
|
|
2665
3148
|
constructor(t, e) {
|
|
2666
3149
|
super(), this.key = t, this.precondition = e, this.type = 3 /* Verify */ , this.fieldTransforms = [];
|
|
2667
3150
|
}
|
|
3151
|
+
getFieldMask() {
|
|
3152
|
+
return null;
|
|
3153
|
+
}
|
|
2668
3154
|
}
|
|
2669
3155
|
|
|
2670
3156
|
/**
|
|
@@ -2682,13 +3168,13 @@ function we(t, e) {
|
|
|
2682
3168
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2683
3169
|
* See the License for the specific language governing permissions and
|
|
2684
3170
|
* limitations under the License.
|
|
2685
|
-
*/ const
|
|
3171
|
+
*/ const xe = (() => {
|
|
2686
3172
|
const t = {
|
|
2687
3173
|
asc: "ASCENDING",
|
|
2688
3174
|
desc: "DESCENDING"
|
|
2689
3175
|
};
|
|
2690
3176
|
return t;
|
|
2691
|
-
})(),
|
|
3177
|
+
})(), Fe = (() => {
|
|
2692
3178
|
const t = {
|
|
2693
3179
|
"<": "LESS_THAN",
|
|
2694
3180
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -2718,9 +3204,9 @@ function we(t, e) {
|
|
|
2718
3204
|
* TODO(klimt): We can remove the databaseId argument if we keep the full
|
|
2719
3205
|
* resource name in documents.
|
|
2720
3206
|
*/
|
|
2721
|
-
class
|
|
3207
|
+
class Se {
|
|
2722
3208
|
constructor(t, e) {
|
|
2723
|
-
this.databaseId = t, this.
|
|
3209
|
+
this.databaseId = t, this.S = e;
|
|
2724
3210
|
}
|
|
2725
3211
|
}
|
|
2726
3212
|
|
|
@@ -2735,8 +3221,8 @@ class De {
|
|
|
2735
3221
|
/**
|
|
2736
3222
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
2737
3223
|
*/
|
|
2738
|
-
function
|
|
2739
|
-
if (t.
|
|
3224
|
+
function qe(t, e) {
|
|
3225
|
+
if (t.S) {
|
|
2740
3226
|
return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
|
|
2741
3227
|
}
|
|
2742
3228
|
return {
|
|
@@ -2750,129 +3236,129 @@ function Ne(t, e) {
|
|
|
2750
3236
|
*
|
|
2751
3237
|
* Visible for testing.
|
|
2752
3238
|
*/
|
|
2753
|
-
function
|
|
2754
|
-
return t.
|
|
3239
|
+
function Oe(t, e) {
|
|
3240
|
+
return t.S ? e.toBase64() : e.toUint8Array();
|
|
2755
3241
|
}
|
|
2756
3242
|
|
|
2757
|
-
function
|
|
2758
|
-
return
|
|
3243
|
+
function ke(t, e) {
|
|
3244
|
+
return qe(t, e.toTimestamp());
|
|
2759
3245
|
}
|
|
2760
3246
|
|
|
2761
|
-
function
|
|
3247
|
+
function Ce(t) {
|
|
2762
3248
|
return v(!!t), vt.fromTimestamp(function(t) {
|
|
2763
|
-
const e =
|
|
3249
|
+
const e = $t(t);
|
|
2764
3250
|
return new gt(e.seconds, e.nanos);
|
|
2765
3251
|
}(t));
|
|
2766
3252
|
}
|
|
2767
3253
|
|
|
2768
|
-
function
|
|
3254
|
+
function Le(t, e) {
|
|
2769
3255
|
return function(t) {
|
|
2770
3256
|
return new X([ "projects", t.projectId, "databases", t.database ]);
|
|
2771
3257
|
}(t).child("documents").child(e).canonicalString();
|
|
2772
3258
|
}
|
|
2773
3259
|
|
|
2774
|
-
function
|
|
2775
|
-
return
|
|
3260
|
+
function Me(t, e) {
|
|
3261
|
+
return Le(t.databaseId, e.path);
|
|
2776
3262
|
}
|
|
2777
3263
|
|
|
2778
|
-
function
|
|
3264
|
+
function Ue(t, e) {
|
|
2779
3265
|
const n = function(t) {
|
|
2780
3266
|
const e = X.fromString(t);
|
|
2781
|
-
return v(
|
|
3267
|
+
return v(Xe(e)), e;
|
|
2782
3268
|
}(e);
|
|
2783
|
-
if (n.get(1) !== t.databaseId.projectId) throw new
|
|
2784
|
-
if (n.get(3) !== t.databaseId.database) throw new
|
|
3269
|
+
if (n.get(1) !== t.databaseId.projectId) throw new L(A, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
|
|
3270
|
+
if (n.get(3) !== t.databaseId.database) throw new L(A, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
|
|
2785
3271
|
return new et((v((r = n).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
|
|
2786
3272
|
var r;
|
|
2787
3273
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
2788
3274
|
|
|
2789
|
-
function
|
|
2790
|
-
return
|
|
3275
|
+
function je(t, e) {
|
|
3276
|
+
return Le(t.databaseId, e);
|
|
2791
3277
|
}
|
|
2792
3278
|
|
|
2793
|
-
function
|
|
3279
|
+
function Be(t) {
|
|
2794
3280
|
return new X([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
2795
3281
|
}
|
|
2796
3282
|
|
|
2797
|
-
function
|
|
3283
|
+
function ze(t, e, n) {
|
|
2798
3284
|
return {
|
|
2799
|
-
name:
|
|
3285
|
+
name: Me(t, e),
|
|
2800
3286
|
fields: n.value.mapValue.fields
|
|
2801
3287
|
};
|
|
2802
3288
|
}
|
|
2803
3289
|
|
|
2804
|
-
function
|
|
3290
|
+
function Ge(t, e) {
|
|
2805
3291
|
return "found" in e ? function(t, e) {
|
|
2806
3292
|
v(!!e.found), e.found.name, e.found.updateTime;
|
|
2807
|
-
const n =
|
|
3293
|
+
const n = Ue(t, e.found.name), r = Ce(e.found.updateTime), s = new Yt({
|
|
2808
3294
|
mapValue: {
|
|
2809
3295
|
fields: e.found.fields
|
|
2810
3296
|
}
|
|
2811
3297
|
});
|
|
2812
|
-
return
|
|
3298
|
+
return Ht.newFoundDocument(n, r, s);
|
|
2813
3299
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
2814
3300
|
v(!!e.missing), v(!!e.readTime);
|
|
2815
|
-
const n =
|
|
2816
|
-
return
|
|
3301
|
+
const n = Ue(t, e.missing), r = Ce(e.readTime);
|
|
3302
|
+
return Ht.newNoDocument(n, r);
|
|
2817
3303
|
}(t, e) : g();
|
|
2818
3304
|
}
|
|
2819
3305
|
|
|
2820
|
-
function
|
|
3306
|
+
function We(t, e) {
|
|
2821
3307
|
let n;
|
|
2822
|
-
if (e instanceof
|
|
2823
|
-
update:
|
|
2824
|
-
}; else if (e instanceof
|
|
2825
|
-
delete:
|
|
2826
|
-
}; else if (e instanceof
|
|
2827
|
-
update:
|
|
2828
|
-
updateMask:
|
|
3308
|
+
if (e instanceof Ve) n = {
|
|
3309
|
+
update: ze(t, e.key, e.value)
|
|
3310
|
+
}; else if (e instanceof De) n = {
|
|
3311
|
+
delete: Me(t, e.key)
|
|
3312
|
+
}; else if (e instanceof Ne) n = {
|
|
3313
|
+
update: ze(t, e.key, e.data),
|
|
3314
|
+
updateMask: Je(e.fieldMask)
|
|
2829
3315
|
}; else {
|
|
2830
|
-
if (!(e instanceof
|
|
3316
|
+
if (!(e instanceof $e)) return g();
|
|
2831
3317
|
n = {
|
|
2832
|
-
verify:
|
|
3318
|
+
verify: Me(t, e.key)
|
|
2833
3319
|
};
|
|
2834
3320
|
}
|
|
2835
3321
|
return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((t => function(t, e) {
|
|
2836
3322
|
const n = e.transform;
|
|
2837
|
-
if (n instanceof
|
|
3323
|
+
if (n instanceof be) return {
|
|
2838
3324
|
fieldPath: e.field.canonicalString(),
|
|
2839
3325
|
setToServerValue: "REQUEST_TIME"
|
|
2840
3326
|
};
|
|
2841
|
-
if (n instanceof
|
|
3327
|
+
if (n instanceof Ee) return {
|
|
2842
3328
|
fieldPath: e.field.canonicalString(),
|
|
2843
3329
|
appendMissingElements: {
|
|
2844
3330
|
values: n.elements
|
|
2845
3331
|
}
|
|
2846
3332
|
};
|
|
2847
|
-
if (n instanceof
|
|
3333
|
+
if (n instanceof Te) return {
|
|
2848
3334
|
fieldPath: e.field.canonicalString(),
|
|
2849
3335
|
removeAllFromArray: {
|
|
2850
3336
|
values: n.elements
|
|
2851
3337
|
}
|
|
2852
3338
|
};
|
|
2853
|
-
if (n instanceof
|
|
3339
|
+
if (n instanceof Ie) return {
|
|
2854
3340
|
fieldPath: e.field.canonicalString(),
|
|
2855
3341
|
increment: n.O
|
|
2856
3342
|
};
|
|
2857
3343
|
throw g();
|
|
2858
3344
|
}(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
2859
3345
|
return void 0 !== e.updateTime ? {
|
|
2860
|
-
updateTime:
|
|
3346
|
+
updateTime: ke(t, e.updateTime)
|
|
2861
3347
|
} : void 0 !== e.exists ? {
|
|
2862
3348
|
exists: e.exists
|
|
2863
3349
|
} : g();
|
|
2864
3350
|
}(t, e.precondition)), n;
|
|
2865
3351
|
}
|
|
2866
3352
|
|
|
2867
|
-
function
|
|
3353
|
+
function Ke(t, e) {
|
|
2868
3354
|
// Dissect the path into parent, collectionId, and optional key filter.
|
|
2869
3355
|
const n = {
|
|
2870
3356
|
structuredQuery: {}
|
|
2871
3357
|
}, r = e.path;
|
|
2872
|
-
null !== e.collectionGroup ? (n.parent =
|
|
3358
|
+
null !== e.collectionGroup ? (n.parent = je(t, r), n.structuredQuery.from = [ {
|
|
2873
3359
|
collectionId: e.collectionGroup,
|
|
2874
3360
|
allDescendants: !0
|
|
2875
|
-
} ]) : (n.parent =
|
|
3361
|
+
} ]) : (n.parent = je(t, r.popLast()), n.structuredQuery.from = [ {
|
|
2876
3362
|
collectionId: r.lastSegment()
|
|
2877
3363
|
} ]);
|
|
2878
3364
|
const s = function(t) {
|
|
@@ -2881,36 +3367,36 @@ function Me(t, e) {
|
|
|
2881
3367
|
// visible for testing
|
|
2882
3368
|
function(t) {
|
|
2883
3369
|
if ("==" /* EQUAL */ === t.op) {
|
|
2884
|
-
if (
|
|
3370
|
+
if (Wt(t.value)) return {
|
|
2885
3371
|
unaryFilter: {
|
|
2886
|
-
field:
|
|
3372
|
+
field: He(t.field),
|
|
2887
3373
|
op: "IS_NAN"
|
|
2888
3374
|
}
|
|
2889
3375
|
};
|
|
2890
|
-
if (
|
|
3376
|
+
if (Gt(t.value)) return {
|
|
2891
3377
|
unaryFilter: {
|
|
2892
|
-
field:
|
|
3378
|
+
field: He(t.field),
|
|
2893
3379
|
op: "IS_NULL"
|
|
2894
3380
|
}
|
|
2895
3381
|
};
|
|
2896
3382
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
2897
|
-
if (
|
|
3383
|
+
if (Wt(t.value)) return {
|
|
2898
3384
|
unaryFilter: {
|
|
2899
|
-
field:
|
|
3385
|
+
field: He(t.field),
|
|
2900
3386
|
op: "IS_NOT_NAN"
|
|
2901
3387
|
}
|
|
2902
3388
|
};
|
|
2903
|
-
if (
|
|
3389
|
+
if (Gt(t.value)) return {
|
|
2904
3390
|
unaryFilter: {
|
|
2905
|
-
field:
|
|
3391
|
+
field: He(t.field),
|
|
2906
3392
|
op: "IS_NOT_NULL"
|
|
2907
3393
|
}
|
|
2908
3394
|
};
|
|
2909
3395
|
}
|
|
2910
3396
|
return {
|
|
2911
3397
|
fieldFilter: {
|
|
2912
|
-
field:
|
|
2913
|
-
op:
|
|
3398
|
+
field: He(t.field),
|
|
3399
|
+
op: Ye(t.op),
|
|
2914
3400
|
value: t.value
|
|
2915
3401
|
}
|
|
2916
3402
|
};
|
|
@@ -2930,14 +3416,14 @@ function Me(t, e) {
|
|
|
2930
3416
|
// visible for testing
|
|
2931
3417
|
function(t) {
|
|
2932
3418
|
return {
|
|
2933
|
-
field:
|
|
2934
|
-
direction:
|
|
3419
|
+
field: He(t.field),
|
|
3420
|
+
direction: Qe(t.dir)
|
|
2935
3421
|
};
|
|
2936
3422
|
}(t)));
|
|
2937
3423
|
}(e.orderBy);
|
|
2938
3424
|
i && (n.structuredQuery.orderBy = i);
|
|
2939
3425
|
const o = function(t, e) {
|
|
2940
|
-
return t.
|
|
3426
|
+
return t.S || ct(e) ? e : {
|
|
2941
3427
|
value: e
|
|
2942
3428
|
};
|
|
2943
3429
|
}(t, e.limit);
|
|
@@ -2955,29 +3441,29 @@ function Me(t, e) {
|
|
|
2955
3441
|
(e.endAt)), n;
|
|
2956
3442
|
}
|
|
2957
3443
|
|
|
2958
|
-
function
|
|
2959
|
-
return
|
|
3444
|
+
function Qe(t) {
|
|
3445
|
+
return xe[t];
|
|
2960
3446
|
}
|
|
2961
3447
|
|
|
2962
3448
|
// visible for testing
|
|
2963
|
-
function
|
|
2964
|
-
return
|
|
3449
|
+
function Ye(t) {
|
|
3450
|
+
return Fe[t];
|
|
2965
3451
|
}
|
|
2966
3452
|
|
|
2967
|
-
function
|
|
3453
|
+
function He(t) {
|
|
2968
3454
|
return {
|
|
2969
3455
|
fieldPath: t.canonicalString()
|
|
2970
3456
|
};
|
|
2971
3457
|
}
|
|
2972
3458
|
|
|
2973
|
-
function
|
|
3459
|
+
function Je(t) {
|
|
2974
3460
|
const e = [];
|
|
2975
3461
|
return t.fields.forEach((t => e.push(t.canonicalString()))), {
|
|
2976
3462
|
fieldPaths: e
|
|
2977
3463
|
};
|
|
2978
3464
|
}
|
|
2979
3465
|
|
|
2980
|
-
function
|
|
3466
|
+
function Xe(t) {
|
|
2981
3467
|
// Resource names have at least 4 components (project ID, database ID)
|
|
2982
3468
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
2983
3469
|
}
|
|
@@ -2997,8 +3483,8 @@ function We(t) {
|
|
|
2997
3483
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2998
3484
|
* See the License for the specific language governing permissions and
|
|
2999
3485
|
* limitations under the License.
|
|
3000
|
-
*/ function
|
|
3001
|
-
return new
|
|
3486
|
+
*/ function Ze(t) {
|
|
3487
|
+
return new Se(t, /* useProto3Json= */ !0);
|
|
3002
3488
|
}
|
|
3003
3489
|
|
|
3004
3490
|
/**
|
|
@@ -3026,7 +3512,7 @@ function We(t) {
|
|
|
3026
3512
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
3027
3513
|
* delays causing spikes of load to the backend.
|
|
3028
3514
|
*/
|
|
3029
|
-
class
|
|
3515
|
+
class tn {
|
|
3030
3516
|
constructor(
|
|
3031
3517
|
/**
|
|
3032
3518
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -3051,7 +3537,7 @@ class He {
|
|
|
3051
3537
|
* Note that jitter will still be applied, so the actual delay could be as
|
|
3052
3538
|
* much as 1.5*maxDelayMs.
|
|
3053
3539
|
*/ , s = 6e4) {
|
|
3054
|
-
this.
|
|
3540
|
+
this.k = t, this.timerId = e, this.C = n, this.L = r, this.M = s, this.U = 0, this.j = null,
|
|
3055
3541
|
/** The last backoff attempt, as epoch milliseconds. */
|
|
3056
3542
|
this.B = Date.now(), this.reset();
|
|
3057
3543
|
}
|
|
@@ -3062,13 +3548,13 @@ class He {
|
|
|
3062
3548
|
* (i.e. due to an error), initialDelayMs (plus jitter) will be used, and
|
|
3063
3549
|
* subsequent ones will increase according to the backoffFactor.
|
|
3064
3550
|
*/ reset() {
|
|
3065
|
-
this.
|
|
3551
|
+
this.U = 0;
|
|
3066
3552
|
}
|
|
3067
3553
|
/**
|
|
3068
3554
|
* Resets the backoff delay to the maximum delay (e.g. for use after a
|
|
3069
3555
|
* RESOURCE_EXHAUSTED error).
|
|
3070
3556
|
*/ G() {
|
|
3071
|
-
this.
|
|
3557
|
+
this.U = this.M;
|
|
3072
3558
|
}
|
|
3073
3559
|
/**
|
|
3074
3560
|
* Returns a promise that resolves after currentDelayMs, and increases the
|
|
@@ -3079,23 +3565,23 @@ class He {
|
|
|
3079
3565
|
this.cancel();
|
|
3080
3566
|
// First schedule using the current base (which may be 0 and should be
|
|
3081
3567
|
// honored as such).
|
|
3082
|
-
const e = Math.floor(this.
|
|
3568
|
+
const e = Math.floor(this.U + this.K()), n = Math.max(0, Date.now() - this.B), r = Math.max(0, e - n);
|
|
3083
3569
|
// Guard against lastAttemptTime being in the future due to a clock change.
|
|
3084
|
-
r > 0 && m("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.
|
|
3085
|
-
this.
|
|
3570
|
+
r > 0 && m("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.U} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),
|
|
3571
|
+
this.j = this.k.enqueueAfterDelay(this.timerId, r, (() => (this.B = Date.now(),
|
|
3086
3572
|
t()))),
|
|
3087
3573
|
// Apply backoff factor to determine next delay and ensure it is within
|
|
3088
3574
|
// bounds.
|
|
3089
|
-
this.
|
|
3575
|
+
this.U *= this.L, this.U < this.C && (this.U = this.C), this.U > this.M && (this.U = this.M);
|
|
3090
3576
|
}
|
|
3091
|
-
|
|
3092
|
-
null !== this.
|
|
3577
|
+
Y() {
|
|
3578
|
+
null !== this.j && (this.j.skipDelay(), this.j = null);
|
|
3093
3579
|
}
|
|
3094
3580
|
cancel() {
|
|
3095
|
-
null !== this.
|
|
3581
|
+
null !== this.j && (this.j.cancel(), this.j = null);
|
|
3096
3582
|
}
|
|
3097
|
-
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */
|
|
3098
|
-
return (Math.random() - .5) * this.
|
|
3583
|
+
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ K() {
|
|
3584
|
+
return (Math.random() - .5) * this.U;
|
|
3099
3585
|
}
|
|
3100
3586
|
}
|
|
3101
3587
|
|
|
@@ -3124,24 +3610,24 @@ class He {
|
|
|
3124
3610
|
* An implementation of Datastore that exposes additional state for internal
|
|
3125
3611
|
* consumption.
|
|
3126
3612
|
*/
|
|
3127
|
-
class
|
|
3613
|
+
class en extends class {} {
|
|
3128
3614
|
constructor(t, e, n, r) {
|
|
3129
|
-
super(), this.authCredentials = t, this.appCheckCredentials = e, this.
|
|
3615
|
+
super(), this.authCredentials = t, this.appCheckCredentials = e, this.H = n, this.q = r,
|
|
3130
3616
|
this.J = !1;
|
|
3131
3617
|
}
|
|
3132
3618
|
X() {
|
|
3133
|
-
if (this.J) throw new
|
|
3619
|
+
if (this.J) throw new L(x, "The client has already been terminated.");
|
|
3134
3620
|
}
|
|
3135
3621
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ m(t, e, n) {
|
|
3136
|
-
return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.
|
|
3137
|
-
throw "FirebaseError" === t.name ? (t.code ===
|
|
3138
|
-
this.appCheckCredentials.invalidateToken()), t) : new
|
|
3622
|
+
return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.H.m(t, e, n, r, s))).catch((t => {
|
|
3623
|
+
throw "FirebaseError" === t.name ? (t.code === D && (this.authCredentials.invalidateToken(),
|
|
3624
|
+
this.appCheckCredentials.invalidateToken()), t) : new L(I, t.toString());
|
|
3139
3625
|
}));
|
|
3140
3626
|
}
|
|
3141
3627
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ T(t, e, n) {
|
|
3142
|
-
return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.
|
|
3143
|
-
throw "FirebaseError" === t.name ? (t.code ===
|
|
3144
|
-
this.appCheckCredentials.invalidateToken()), t) : new
|
|
3628
|
+
return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.H.T(t, e, n, r, s))).catch((t => {
|
|
3629
|
+
throw "FirebaseError" === t.name ? (t.code === D && (this.authCredentials.invalidateToken(),
|
|
3630
|
+
this.appCheckCredentials.invalidateToken()), t) : new L(I, t.toString());
|
|
3145
3631
|
}));
|
|
3146
3632
|
}
|
|
3147
3633
|
terminate() {
|
|
@@ -3151,19 +3637,19 @@ class Ke extends class {} {
|
|
|
3151
3637
|
|
|
3152
3638
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3153
3639
|
// firestore-exp client.
|
|
3154
|
-
async function
|
|
3155
|
-
const n = b(t), r =
|
|
3156
|
-
writes: e.map((t =>
|
|
3640
|
+
async function nn(t, e) {
|
|
3641
|
+
const n = b(t), r = Be(n.q) + "/documents", s = {
|
|
3642
|
+
writes: e.map((t => We(n.q, t)))
|
|
3157
3643
|
};
|
|
3158
3644
|
await n.m("Commit", r, s);
|
|
3159
3645
|
}
|
|
3160
3646
|
|
|
3161
|
-
async function
|
|
3162
|
-
const n = b(t), r =
|
|
3163
|
-
documents: e.map((t =>
|
|
3647
|
+
async function rn(t, e) {
|
|
3648
|
+
const n = b(t), r = Be(n.q) + "/documents", s = {
|
|
3649
|
+
documents: e.map((t => Me(n.q, t)))
|
|
3164
3650
|
}, i = await n.T("BatchGetDocuments", r, s), o = new Map;
|
|
3165
3651
|
i.forEach((t => {
|
|
3166
|
-
const e =
|
|
3652
|
+
const e = Ge(n.q, t);
|
|
3167
3653
|
o.set(e.key.toString(), e);
|
|
3168
3654
|
}));
|
|
3169
3655
|
const u = [];
|
|
@@ -3173,16 +3659,16 @@ async function Xe(t, e) {
|
|
|
3173
3659
|
})), u;
|
|
3174
3660
|
}
|
|
3175
3661
|
|
|
3176
|
-
async function
|
|
3177
|
-
const n = b(t), r =
|
|
3662
|
+
async function sn(t, e) {
|
|
3663
|
+
const n = b(t), r = Ke(n.q, ye(e));
|
|
3178
3664
|
return (await n.T("RunQuery", r.parent, {
|
|
3179
3665
|
structuredQuery: r.structuredQuery
|
|
3180
3666
|
})).filter((t => !!t.document)).map((t => function(t, e, n) {
|
|
3181
|
-
const r =
|
|
3667
|
+
const r = Ue(t, e.name), s = Ce(e.updateTime), i = new Yt({
|
|
3182
3668
|
mapValue: {
|
|
3183
3669
|
fields: e.fields
|
|
3184
3670
|
}
|
|
3185
|
-
}), o =
|
|
3671
|
+
}), o = Ht.newFoundDocument(r, s, i);
|
|
3186
3672
|
return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o;
|
|
3187
3673
|
}(n.q, t.document, void 0)));
|
|
3188
3674
|
}
|
|
@@ -3202,7 +3688,7 @@ async function Ze(t, e) {
|
|
|
3202
3688
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3203
3689
|
* See the License for the specific language governing permissions and
|
|
3204
3690
|
* limitations under the License.
|
|
3205
|
-
*/ const
|
|
3691
|
+
*/ const on = new Map;
|
|
3206
3692
|
|
|
3207
3693
|
/**
|
|
3208
3694
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -3213,17 +3699,17 @@ async function Ze(t, e) {
|
|
|
3213
3699
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
3214
3700
|
* instance is terminated.
|
|
3215
3701
|
*/
|
|
3216
|
-
function
|
|
3217
|
-
if (t._terminated) throw new
|
|
3218
|
-
if (!
|
|
3702
|
+
function un(t) {
|
|
3703
|
+
if (t._terminated) throw new L(x, "The client has already been terminated.");
|
|
3704
|
+
if (!on.has(t)) {
|
|
3219
3705
|
m("ComponentProvider", "Initializing Datastore");
|
|
3220
3706
|
const i = function(t) {
|
|
3221
3707
|
return new wt(t, fetch.bind(null));
|
|
3222
3708
|
}((e = t._databaseId, n = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
|
|
3223
|
-
new
|
|
3224
|
-
return new
|
|
3709
|
+
new Y(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = Ze(t._databaseId), u = function(t, e, n, r) {
|
|
3710
|
+
return new en(t, e, n, r);
|
|
3225
3711
|
}(t._authCredentials, t._appCheckCredentials, i, o);
|
|
3226
|
-
|
|
3712
|
+
on.set(t, u);
|
|
3227
3713
|
}
|
|
3228
3714
|
var e, n, r, s;
|
|
3229
3715
|
/**
|
|
@@ -3241,7 +3727,7 @@ function en(t) {
|
|
|
3241
3727
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3242
3728
|
* See the License for the specific language governing permissions and
|
|
3243
3729
|
* limitations under the License.
|
|
3244
|
-
*/ return
|
|
3730
|
+
*/ return on.get(t);
|
|
3245
3731
|
}
|
|
3246
3732
|
|
|
3247
3733
|
/**
|
|
@@ -3253,21 +3739,21 @@ function en(t) {
|
|
|
3253
3739
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
3254
3740
|
* defaults can be supplied and the value can be checked for equality.
|
|
3255
3741
|
*/
|
|
3256
|
-
class
|
|
3742
|
+
class cn {
|
|
3257
3743
|
constructor(t) {
|
|
3258
3744
|
var e;
|
|
3259
3745
|
if (void 0 === t.host) {
|
|
3260
|
-
if (void 0 !== t.ssl) throw new
|
|
3746
|
+
if (void 0 !== t.ssl) throw new L(A, "Can't provide ssl option if host option is not set");
|
|
3261
3747
|
this.host = "firestore.googleapis.com", this.ssl = true;
|
|
3262
3748
|
} else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;
|
|
3263
3749
|
if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
|
|
3264
3750
|
void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
|
|
3265
|
-
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new
|
|
3751
|
+
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new L(A, "cacheSizeBytes must be at least 1048576");
|
|
3266
3752
|
this.cacheSizeBytes = t.cacheSizeBytes;
|
|
3267
3753
|
}
|
|
3268
3754
|
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
|
|
3269
3755
|
this.useFetchStreams = !!t.useFetchStreams, function(t, e, n, r) {
|
|
3270
|
-
if (!0 === e && !0 === r) throw new
|
|
3756
|
+
if (!0 === e && !0 === r) throw new L(A, `${t} and ${n} cannot be used together.`);
|
|
3271
3757
|
}("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
|
|
3272
3758
|
}
|
|
3273
3759
|
isEqual(t) {
|
|
@@ -3295,18 +3781,18 @@ class nn {
|
|
|
3295
3781
|
* The Cloud Firestore service interface.
|
|
3296
3782
|
*
|
|
3297
3783
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3298
|
-
*/ class
|
|
3784
|
+
*/ class an {
|
|
3299
3785
|
/** @hideconstructor */
|
|
3300
3786
|
constructor(t, e, n) {
|
|
3301
3787
|
this._authCredentials = e, this._appCheckCredentials = n,
|
|
3302
3788
|
/**
|
|
3303
3789
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
3304
3790
|
*/
|
|
3305
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
3306
|
-
this._settingsFrozen = !1, t instanceof
|
|
3791
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new cn({}),
|
|
3792
|
+
this._settingsFrozen = !1, t instanceof H ? this._databaseId = t : (this._app = t,
|
|
3307
3793
|
this._databaseId = function(t) {
|
|
3308
|
-
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new
|
|
3309
|
-
return new
|
|
3794
|
+
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new L(A, '"projectId" not provided in firebase.initializeApp.');
|
|
3795
|
+
return new H(t.options.projectId);
|
|
3310
3796
|
}
|
|
3311
3797
|
/**
|
|
3312
3798
|
* Initializes a new instance of Cloud Firestore with the provided settings.
|
|
@@ -3324,7 +3810,7 @@ class nn {
|
|
|
3324
3810
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
3325
3811
|
* instance.
|
|
3326
3812
|
*/ get app() {
|
|
3327
|
-
if (!this._app) throw new
|
|
3813
|
+
if (!this._app) throw new L(x, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
3328
3814
|
return this._app;
|
|
3329
3815
|
}
|
|
3330
3816
|
get _initialized() {
|
|
@@ -3334,21 +3820,21 @@ class nn {
|
|
|
3334
3820
|
return void 0 !== this._terminateTask;
|
|
3335
3821
|
}
|
|
3336
3822
|
_setSettings(t) {
|
|
3337
|
-
if (this._settingsFrozen) throw new
|
|
3338
|
-
this._settings = new
|
|
3339
|
-
if (!t) return new
|
|
3823
|
+
if (this._settingsFrozen) throw new L(x, "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.");
|
|
3824
|
+
this._settings = new cn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
3825
|
+
if (!t) return new j;
|
|
3340
3826
|
switch (t.type) {
|
|
3341
3827
|
case "gapi":
|
|
3342
3828
|
const e = t.client;
|
|
3343
3829
|
// Make sure this really is a Gapi client.
|
|
3344
3830
|
return v(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
|
|
3345
|
-
new
|
|
3831
|
+
new W(e, t.sessionIndex || "0", t.iamToken || null);
|
|
3346
3832
|
|
|
3347
3833
|
case "provider":
|
|
3348
3834
|
return t.client;
|
|
3349
3835
|
|
|
3350
3836
|
default:
|
|
3351
|
-
throw new
|
|
3837
|
+
throw new L(A, "makeAuthCredentialsProvider failed due to invalid credential type");
|
|
3352
3838
|
}
|
|
3353
3839
|
}(t.credentials));
|
|
3354
3840
|
}
|
|
@@ -3376,15 +3862,15 @@ class nn {
|
|
|
3376
3862
|
* Only ever called once.
|
|
3377
3863
|
*/ _terminate() {
|
|
3378
3864
|
return function(t) {
|
|
3379
|
-
const e =
|
|
3380
|
-
e && (m("ComponentProvider", "Removing Datastore"),
|
|
3865
|
+
const e = on.get(t);
|
|
3866
|
+
e && (m("ComponentProvider", "Removing Datastore"), on.delete(t), e.terminate());
|
|
3381
3867
|
}(this), Promise.resolve();
|
|
3382
3868
|
}
|
|
3383
3869
|
}
|
|
3384
3870
|
|
|
3385
|
-
function
|
|
3871
|
+
function hn(t, e) {
|
|
3386
3872
|
const n = _getProvider(t, "firestore/lite");
|
|
3387
|
-
if (n.isInitialized()) throw new
|
|
3873
|
+
if (n.isInitialized()) throw new L(x, "Firestore can only be initialized once per app.");
|
|
3388
3874
|
return n.initialize({
|
|
3389
3875
|
options: e
|
|
3390
3876
|
});
|
|
@@ -3398,7 +3884,7 @@ function sn(t, e) {
|
|
|
3398
3884
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
3399
3885
|
* instance is associated with.
|
|
3400
3886
|
* @returns The `Firestore` instance of the provided app.
|
|
3401
|
-
*/ function
|
|
3887
|
+
*/ function ln(e = getApp()) {
|
|
3402
3888
|
return _getProvider(e, "firestore/lite").getImmediate();
|
|
3403
3889
|
}
|
|
3404
3890
|
|
|
@@ -3414,9 +3900,9 @@ function sn(t, e) {
|
|
|
3414
3900
|
* @param port - the emulator port (ex: 9000).
|
|
3415
3901
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
3416
3902
|
* Security Rules.
|
|
3417
|
-
*/ function
|
|
3903
|
+
*/ function fn(t, e, n, r = {}) {
|
|
3418
3904
|
var s;
|
|
3419
|
-
const i = (t = ot(t,
|
|
3905
|
+
const i = (t = ot(t, an))._getSettings();
|
|
3420
3906
|
if ("firestore.googleapis.com" !== i.host && i.host !== e && y("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
3421
3907
|
t._setSettings(Object.assign(Object.assign({}, i), {
|
|
3422
3908
|
host: `${e}:${n}`,
|
|
@@ -3428,10 +3914,10 @@ function sn(t, e) {
|
|
|
3428
3914
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
3429
3915
|
e = createMockUserToken(r.mockUserToken, null === (s = t._app) || void 0 === s ? void 0 : s.options.projectId);
|
|
3430
3916
|
const i = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
3431
|
-
if (!i) throw new
|
|
3917
|
+
if (!i) throw new L(A, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
3432
3918
|
n = new l(i);
|
|
3433
3919
|
}
|
|
3434
|
-
t._authCredentials = new B(new
|
|
3920
|
+
t._authCredentials = new B(new U(e, n));
|
|
3435
3921
|
}
|
|
3436
3922
|
}
|
|
3437
3923
|
|
|
@@ -3454,8 +3940,8 @@ function sn(t, e) {
|
|
|
3454
3940
|
* @param firestore - The `Firestore` instance to terminate.
|
|
3455
3941
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
3456
3942
|
* terminated.
|
|
3457
|
-
*/ function
|
|
3458
|
-
return t = ot(t,
|
|
3943
|
+
*/ function dn(t) {
|
|
3944
|
+
return t = ot(t, an), _removeServiceInstance(t.app, "firestore/lite"), t._delete();
|
|
3459
3945
|
}
|
|
3460
3946
|
|
|
3461
3947
|
/**
|
|
@@ -3495,7 +3981,7 @@ function sn(t, e) {
|
|
|
3495
3981
|
* and can be used to write, read, or listen to the location. The document at
|
|
3496
3982
|
* the referenced location may or may not exist.
|
|
3497
3983
|
*/
|
|
3498
|
-
class
|
|
3984
|
+
class wn {
|
|
3499
3985
|
/** @hideconstructor */
|
|
3500
3986
|
constructor(t,
|
|
3501
3987
|
/**
|
|
@@ -3523,17 +4009,17 @@ class an {
|
|
|
3523
4009
|
/**
|
|
3524
4010
|
* The collection this `DocumentReference` belongs to.
|
|
3525
4011
|
*/ get parent() {
|
|
3526
|
-
return new
|
|
4012
|
+
return new pn(this.firestore, this.converter, this._key.path.popLast());
|
|
3527
4013
|
}
|
|
3528
4014
|
withConverter(t) {
|
|
3529
|
-
return new
|
|
4015
|
+
return new wn(this.firestore, t, this._key);
|
|
3530
4016
|
}
|
|
3531
4017
|
}
|
|
3532
4018
|
|
|
3533
4019
|
/**
|
|
3534
4020
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
3535
4021
|
* construct refined `Query` objects by adding filters and ordering.
|
|
3536
|
-
*/ class
|
|
4022
|
+
*/ class mn {
|
|
3537
4023
|
// This is the lite version of the Query class in the main SDK.
|
|
3538
4024
|
/** @hideconstructor protected */
|
|
3539
4025
|
constructor(t,
|
|
@@ -3546,17 +4032,17 @@ class an {
|
|
|
3546
4032
|
this.type = "query", this.firestore = t;
|
|
3547
4033
|
}
|
|
3548
4034
|
withConverter(t) {
|
|
3549
|
-
return new
|
|
4035
|
+
return new mn(this.firestore, t, this._query);
|
|
3550
4036
|
}
|
|
3551
4037
|
}
|
|
3552
4038
|
|
|
3553
4039
|
/**
|
|
3554
4040
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
3555
4041
|
* document references, and querying for documents (using {@link query}).
|
|
3556
|
-
*/ class
|
|
4042
|
+
*/ class pn extends mn {
|
|
3557
4043
|
/** @hideconstructor */
|
|
3558
4044
|
constructor(t, e, n) {
|
|
3559
|
-
super(t, e, new
|
|
4045
|
+
super(t, e, new fe(n)), this._path = n,
|
|
3560
4046
|
/** The type of this Firestore reference. */
|
|
3561
4047
|
this.type = "collection";
|
|
3562
4048
|
}
|
|
@@ -3574,23 +4060,23 @@ class an {
|
|
|
3574
4060
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
3575
4061
|
*/ get parent() {
|
|
3576
4062
|
const t = this._path.popLast();
|
|
3577
|
-
return t.isEmpty() ? null : new
|
|
4063
|
+
return t.isEmpty() ? null : new wn(this.firestore,
|
|
3578
4064
|
/* converter= */ null, new et(t));
|
|
3579
4065
|
}
|
|
3580
4066
|
withConverter(t) {
|
|
3581
|
-
return new
|
|
4067
|
+
return new pn(this.firestore, t, this._path);
|
|
3582
4068
|
}
|
|
3583
4069
|
}
|
|
3584
4070
|
|
|
3585
|
-
function
|
|
3586
|
-
if (t = getModularInstance(t), nt("collection", "path", e), t instanceof
|
|
4071
|
+
function yn(t, e, ...n) {
|
|
4072
|
+
if (t = getModularInstance(t), nt("collection", "path", e), t instanceof an) {
|
|
3587
4073
|
const r = X.fromString(e, ...n);
|
|
3588
|
-
return st(r), new
|
|
4074
|
+
return st(r), new pn(t, /* converter= */ null, r);
|
|
3589
4075
|
}
|
|
3590
4076
|
{
|
|
3591
|
-
if (!(t instanceof
|
|
4077
|
+
if (!(t instanceof wn || t instanceof pn)) throw new L(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3592
4078
|
const r = t._path.child(X.fromString(e, ...n));
|
|
3593
|
-
return st(r), new
|
|
4079
|
+
return st(r), new pn(t.firestore,
|
|
3594
4080
|
/* converter= */ null, r);
|
|
3595
4081
|
}
|
|
3596
4082
|
}
|
|
@@ -3607,32 +4093,32 @@ function fn(t, e, ...n) {
|
|
|
3607
4093
|
* collection or subcollection with this ID as the last segment of its path
|
|
3608
4094
|
* will be included. Cannot contain a slash.
|
|
3609
4095
|
* @returns The created `Query`.
|
|
3610
|
-
*/ function
|
|
3611
|
-
if (t = ot(t,
|
|
3612
|
-
return new
|
|
4096
|
+
*/ function _n(t, e) {
|
|
4097
|
+
if (t = ot(t, an), nt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new L(A, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
4098
|
+
return new mn(t,
|
|
3613
4099
|
/* converter= */ null,
|
|
3614
4100
|
/**
|
|
3615
4101
|
* Creates a new Query for a collection group query that matches all documents
|
|
3616
4102
|
* within the provided collection group.
|
|
3617
4103
|
*/
|
|
3618
4104
|
function(t) {
|
|
3619
|
-
return new
|
|
4105
|
+
return new fe(X.emptyPath(), t);
|
|
3620
4106
|
}(e));
|
|
3621
4107
|
}
|
|
3622
4108
|
|
|
3623
|
-
function
|
|
4109
|
+
function gn(t, e, ...n) {
|
|
3624
4110
|
if (t = getModularInstance(t),
|
|
3625
4111
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3626
4112
|
// 'undefined' and 'null'.
|
|
3627
|
-
1 === arguments.length && (e = pt.R()), nt("doc", "path", e), t instanceof
|
|
4113
|
+
1 === arguments.length && (e = pt.R()), nt("doc", "path", e), t instanceof an) {
|
|
3628
4114
|
const r = X.fromString(e, ...n);
|
|
3629
|
-
return rt(r), new
|
|
4115
|
+
return rt(r), new wn(t,
|
|
3630
4116
|
/* converter= */ null, new et(r));
|
|
3631
4117
|
}
|
|
3632
4118
|
{
|
|
3633
|
-
if (!(t instanceof
|
|
4119
|
+
if (!(t instanceof wn || t instanceof pn)) throw new L(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3634
4120
|
const r = t._path.child(X.fromString(e, ...n));
|
|
3635
|
-
return rt(r), new
|
|
4121
|
+
return rt(r), new wn(t.firestore, t instanceof pn ? t.converter : null, new et(r));
|
|
3636
4122
|
}
|
|
3637
4123
|
}
|
|
3638
4124
|
|
|
@@ -3643,8 +4129,8 @@ function wn(t, e, ...n) {
|
|
|
3643
4129
|
* @param right - A reference to compare.
|
|
3644
4130
|
* @returns true if the references point to the same location in the same
|
|
3645
4131
|
* Firestore database.
|
|
3646
|
-
*/ function
|
|
3647
|
-
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof
|
|
4132
|
+
*/ function vn(t, e) {
|
|
4133
|
+
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof wn || t instanceof pn) && (e instanceof wn || e instanceof pn) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
|
|
3648
4134
|
}
|
|
3649
4135
|
|
|
3650
4136
|
/**
|
|
@@ -3655,8 +4141,8 @@ function wn(t, e, ...n) {
|
|
|
3655
4141
|
* @param right - A `Query` to compare.
|
|
3656
4142
|
* @returns true if the references point to the same location in the same
|
|
3657
4143
|
* Firestore database.
|
|
3658
|
-
*/ function
|
|
3659
|
-
return t = getModularInstance(t), e = getModularInstance(e), t instanceof
|
|
4144
|
+
*/ function bn(t, e) {
|
|
4145
|
+
return t = getModularInstance(t), e = getModularInstance(e), t instanceof mn && e instanceof mn && (t.firestore === e.firestore && _e(t._query, e._query) && t.converter === e.converter);
|
|
3660
4146
|
}
|
|
3661
4147
|
|
|
3662
4148
|
/**
|
|
@@ -3682,7 +4168,7 @@ function wn(t, e, ...n) {
|
|
|
3682
4168
|
*
|
|
3683
4169
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
3684
4170
|
* name is provided, the path will point to a nested field in a document.
|
|
3685
|
-
*/ class
|
|
4171
|
+
*/ class En {
|
|
3686
4172
|
/**
|
|
3687
4173
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
3688
4174
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -3690,7 +4176,7 @@ function wn(t, e, ...n) {
|
|
|
3690
4176
|
* @param fieldNames - A list of field names.
|
|
3691
4177
|
*/
|
|
3692
4178
|
constructor(...t) {
|
|
3693
|
-
for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new
|
|
4179
|
+
for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new L(A, "Invalid field name at argument $(i + 1). Field names must not be empty.");
|
|
3694
4180
|
this._internalPath = new tt(t);
|
|
3695
4181
|
}
|
|
3696
4182
|
/**
|
|
@@ -3706,8 +4192,8 @@ function wn(t, e, ...n) {
|
|
|
3706
4192
|
/**
|
|
3707
4193
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
3708
4194
|
* It can be used in queries to sort or filter by the document ID.
|
|
3709
|
-
*/ function
|
|
3710
|
-
return new
|
|
4195
|
+
*/ function Tn() {
|
|
4196
|
+
return new En("__name__");
|
|
3711
4197
|
}
|
|
3712
4198
|
|
|
3713
4199
|
/**
|
|
@@ -3728,7 +4214,7 @@ function wn(t, e, ...n) {
|
|
|
3728
4214
|
*/
|
|
3729
4215
|
/**
|
|
3730
4216
|
* An immutable object representing an array of bytes.
|
|
3731
|
-
*/ class
|
|
4217
|
+
*/ class In {
|
|
3732
4218
|
/** @hideconstructor */
|
|
3733
4219
|
constructor(t) {
|
|
3734
4220
|
this._byteString = t;
|
|
@@ -3740,9 +4226,9 @@ function wn(t, e, ...n) {
|
|
|
3740
4226
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3741
4227
|
*/ static fromBase64String(t) {
|
|
3742
4228
|
try {
|
|
3743
|
-
return new
|
|
4229
|
+
return new In(Nt.fromBase64String(t));
|
|
3744
4230
|
} catch (t) {
|
|
3745
|
-
throw new
|
|
4231
|
+
throw new L(A, "Failed to construct data from Base64 string: " + t);
|
|
3746
4232
|
}
|
|
3747
4233
|
}
|
|
3748
4234
|
/**
|
|
@@ -3750,7 +4236,7 @@ function wn(t, e, ...n) {
|
|
|
3750
4236
|
*
|
|
3751
4237
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3752
4238
|
*/ static fromUint8Array(t) {
|
|
3753
|
-
return new
|
|
4239
|
+
return new In(Nt.fromUint8Array(t));
|
|
3754
4240
|
}
|
|
3755
4241
|
/**
|
|
3756
4242
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3802,7 +4288,7 @@ function wn(t, e, ...n) {
|
|
|
3802
4288
|
/**
|
|
3803
4289
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
3804
4290
|
* or `update()`.
|
|
3805
|
-
*/ class
|
|
4291
|
+
*/ class An {
|
|
3806
4292
|
/**
|
|
3807
4293
|
* @param _methodName - The public API endpoint that returns this class.
|
|
3808
4294
|
* @hideconstructor
|
|
@@ -3834,7 +4320,7 @@ function wn(t, e, ...n) {
|
|
|
3834
4320
|
*
|
|
3835
4321
|
* Latitude values are in the range of [-90, 90].
|
|
3836
4322
|
* Longitude values are in the range of [-180, 180].
|
|
3837
|
-
*/ class
|
|
4323
|
+
*/ class Rn {
|
|
3838
4324
|
/**
|
|
3839
4325
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
3840
4326
|
* longitude values.
|
|
@@ -3842,8 +4328,8 @@ function wn(t, e, ...n) {
|
|
|
3842
4328
|
* @param longitude - The longitude as number between -180 and 180.
|
|
3843
4329
|
*/
|
|
3844
4330
|
constructor(t, e) {
|
|
3845
|
-
if (!isFinite(t) || t < -90 || t > 90) throw new
|
|
3846
|
-
if (!isFinite(e) || e < -180 || e > 180) throw new
|
|
4331
|
+
if (!isFinite(t) || t < -90 || t > 90) throw new L(A, "Latitude must be a number between -90 and 90, but was: " + t);
|
|
4332
|
+
if (!isFinite(e) || e < -180 || e > 180) throw new L(A, "Longitude must be a number between -180 and 180, but was: " + e);
|
|
3847
4333
|
this._lat = t, this._long = e;
|
|
3848
4334
|
}
|
|
3849
4335
|
/**
|
|
@@ -3893,29 +4379,29 @@ function wn(t, e, ...n) {
|
|
|
3893
4379
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3894
4380
|
* See the License for the specific language governing permissions and
|
|
3895
4381
|
* limitations under the License.
|
|
3896
|
-
*/ const
|
|
4382
|
+
*/ const Pn = /^__.*__$/;
|
|
3897
4383
|
|
|
3898
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
4384
|
+
/** The result of parsing document data (e.g. for a setData call). */ class Vn {
|
|
3899
4385
|
constructor(t, e, n) {
|
|
3900
4386
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3901
4387
|
}
|
|
3902
4388
|
toMutation(t, e) {
|
|
3903
|
-
return null !== this.fieldMask ? new
|
|
4389
|
+
return null !== this.fieldMask ? new Ne(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Ve(t, this.data, e, this.fieldTransforms);
|
|
3904
4390
|
}
|
|
3905
4391
|
}
|
|
3906
4392
|
|
|
3907
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
4393
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class Nn {
|
|
3908
4394
|
constructor(t,
|
|
3909
4395
|
// The fieldMask does not include document transforms.
|
|
3910
4396
|
e, n) {
|
|
3911
4397
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3912
4398
|
}
|
|
3913
4399
|
toMutation(t, e) {
|
|
3914
|
-
return new
|
|
4400
|
+
return new Ne(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
3915
4401
|
}
|
|
3916
4402
|
}
|
|
3917
4403
|
|
|
3918
|
-
function
|
|
4404
|
+
function Dn(t) {
|
|
3919
4405
|
switch (t) {
|
|
3920
4406
|
case 0 /* Set */ :
|
|
3921
4407
|
// fall through
|
|
@@ -3933,7 +4419,7 @@ function An(t) {
|
|
|
3933
4419
|
}
|
|
3934
4420
|
}
|
|
3935
4421
|
|
|
3936
|
-
/** A "context" object passed around while parsing user data. */ class
|
|
4422
|
+
/** A "context" object passed around while parsing user data. */ class $n {
|
|
3937
4423
|
/**
|
|
3938
4424
|
* Initializes a ParseContext with the given source and path.
|
|
3939
4425
|
*
|
|
@@ -3965,7 +4451,7 @@ function An(t) {
|
|
|
3965
4451
|
return this.settings.tt;
|
|
3966
4452
|
}
|
|
3967
4453
|
/** Returns a new context with the specified settings overwritten. */ et(t) {
|
|
3968
|
-
return new
|
|
4454
|
+
return new $n(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
3969
4455
|
}
|
|
3970
4456
|
nt(t) {
|
|
3971
4457
|
var e;
|
|
@@ -3992,7 +4478,7 @@ function An(t) {
|
|
|
3992
4478
|
});
|
|
3993
4479
|
}
|
|
3994
4480
|
ut(t) {
|
|
3995
|
-
return
|
|
4481
|
+
return Jn(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
|
|
3996
4482
|
}
|
|
3997
4483
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
3998
4484
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
@@ -4004,19 +4490,19 @@ function An(t) {
|
|
|
4004
4490
|
}
|
|
4005
4491
|
st(t) {
|
|
4006
4492
|
if (0 === t.length) throw this.ut("Document fields must not be empty");
|
|
4007
|
-
if (
|
|
4493
|
+
if (Dn(this.tt) && Pn.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
|
|
4008
4494
|
}
|
|
4009
4495
|
}
|
|
4010
4496
|
|
|
4011
4497
|
/**
|
|
4012
4498
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
4013
4499
|
* classes.
|
|
4014
|
-
*/ class
|
|
4500
|
+
*/ class xn {
|
|
4015
4501
|
constructor(t, e, n) {
|
|
4016
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n ||
|
|
4502
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n || Ze(t);
|
|
4017
4503
|
}
|
|
4018
4504
|
/** Creates a new top-level parse context. */ ht(t, e, n, r = !1) {
|
|
4019
|
-
return new
|
|
4505
|
+
return new $n({
|
|
4020
4506
|
tt: t,
|
|
4021
4507
|
methodName: e,
|
|
4022
4508
|
at: n,
|
|
@@ -4027,29 +4513,29 @@ function An(t) {
|
|
|
4027
4513
|
}
|
|
4028
4514
|
}
|
|
4029
4515
|
|
|
4030
|
-
function
|
|
4031
|
-
const e = t._freezeSettings(), n =
|
|
4032
|
-
return new
|
|
4516
|
+
function Fn(t) {
|
|
4517
|
+
const e = t._freezeSettings(), n = Ze(t._databaseId);
|
|
4518
|
+
return new xn(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
4033
4519
|
}
|
|
4034
4520
|
|
|
4035
|
-
/** Parse document data from a set() call. */ function
|
|
4521
|
+
/** Parse document data from a set() call. */ function Sn(t, e, n, r, s, i = {}) {
|
|
4036
4522
|
const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, s);
|
|
4037
|
-
|
|
4038
|
-
const u =
|
|
4523
|
+
Kn("Data must be an object, but it was:", o, r);
|
|
4524
|
+
const u = Gn(r, o);
|
|
4039
4525
|
let c, a;
|
|
4040
|
-
if (i.merge) c = new
|
|
4526
|
+
if (i.merge) c = new Vt(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
|
|
4041
4527
|
const t = [];
|
|
4042
4528
|
for (const r of i.mergeFields) {
|
|
4043
|
-
const s =
|
|
4044
|
-
if (!o.contains(s)) throw new
|
|
4045
|
-
|
|
4529
|
+
const s = Qn(e, r, n);
|
|
4530
|
+
if (!o.contains(s)) throw new L(A, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4531
|
+
Xn(t, s) || t.push(s);
|
|
4046
4532
|
}
|
|
4047
|
-
c = new
|
|
4533
|
+
c = new Vt(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4048
4534
|
} else c = null, a = o.fieldTransforms;
|
|
4049
|
-
return new
|
|
4535
|
+
return new Vn(new Yt(u), c, a);
|
|
4050
4536
|
}
|
|
4051
4537
|
|
|
4052
|
-
class
|
|
4538
|
+
class qn extends An {
|
|
4053
4539
|
_toFieldTransform(t) {
|
|
4054
4540
|
if (2 /* MergeSet */ !== t.tt) throw 1 /* Update */ === t.tt ? t.ut(`${this._methodName}() can only appear at the top level of your update data`) : t.ut(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
4055
4541
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4057,7 +4543,7 @@ class Nn extends vn {
|
|
|
4057
4543
|
return t.fieldMask.push(t.path), null;
|
|
4058
4544
|
}
|
|
4059
4545
|
isEqual(t) {
|
|
4060
|
-
return t instanceof
|
|
4546
|
+
return t instanceof qn;
|
|
4061
4547
|
}
|
|
4062
4548
|
}
|
|
4063
4549
|
|
|
@@ -4076,8 +4562,8 @@ class Nn extends vn {
|
|
|
4076
4562
|
* context.
|
|
4077
4563
|
* @param context - The parent context.
|
|
4078
4564
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4079
|
-
*/ function
|
|
4080
|
-
return new
|
|
4565
|
+
*/ function On(t, e, n) {
|
|
4566
|
+
return new $n({
|
|
4081
4567
|
tt: 3 /* Argument */ ,
|
|
4082
4568
|
at: e.settings.at,
|
|
4083
4569
|
methodName: t._methodName,
|
|
@@ -4085,23 +4571,23 @@ class Nn extends vn {
|
|
|
4085
4571
|
}, e.databaseId, e.q, e.ignoreUndefinedProperties);
|
|
4086
4572
|
}
|
|
4087
4573
|
|
|
4088
|
-
class
|
|
4574
|
+
class kn extends An {
|
|
4089
4575
|
_toFieldTransform(t) {
|
|
4090
|
-
return new
|
|
4576
|
+
return new Ae(t.path, new be);
|
|
4091
4577
|
}
|
|
4092
4578
|
isEqual(t) {
|
|
4093
|
-
return t instanceof
|
|
4579
|
+
return t instanceof kn;
|
|
4094
4580
|
}
|
|
4095
4581
|
}
|
|
4096
4582
|
|
|
4097
|
-
class
|
|
4583
|
+
class Cn extends An {
|
|
4098
4584
|
constructor(t, e) {
|
|
4099
4585
|
super(t), this.lt = e;
|
|
4100
4586
|
}
|
|
4101
4587
|
_toFieldTransform(t) {
|
|
4102
|
-
const e =
|
|
4103
|
-
/*array=*/ !0), n = this.lt.map((t =>
|
|
4104
|
-
return new
|
|
4588
|
+
const e = On(this, t,
|
|
4589
|
+
/*array=*/ !0), n = this.lt.map((t => zn(t, e))), r = new Ee(n);
|
|
4590
|
+
return new Ae(t.path, r);
|
|
4105
4591
|
}
|
|
4106
4592
|
isEqual(t) {
|
|
4107
4593
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4109,14 +4595,14 @@ class Fn extends vn {
|
|
|
4109
4595
|
}
|
|
4110
4596
|
}
|
|
4111
4597
|
|
|
4112
|
-
class
|
|
4598
|
+
class Ln extends An {
|
|
4113
4599
|
constructor(t, e) {
|
|
4114
4600
|
super(t), this.lt = e;
|
|
4115
4601
|
}
|
|
4116
4602
|
_toFieldTransform(t) {
|
|
4117
|
-
const e =
|
|
4118
|
-
/*array=*/ !0), n = this.lt.map((t =>
|
|
4119
|
-
return new
|
|
4603
|
+
const e = On(this, t,
|
|
4604
|
+
/*array=*/ !0), n = this.lt.map((t => zn(t, e))), r = new Te(n);
|
|
4605
|
+
return new Ae(t.path, r);
|
|
4120
4606
|
}
|
|
4121
4607
|
isEqual(t) {
|
|
4122
4608
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4124,13 +4610,13 @@ class xn extends vn {
|
|
|
4124
4610
|
}
|
|
4125
4611
|
}
|
|
4126
4612
|
|
|
4127
|
-
class
|
|
4613
|
+
class Mn extends An {
|
|
4128
4614
|
constructor(t, e) {
|
|
4129
4615
|
super(t), this.ft = e;
|
|
4130
4616
|
}
|
|
4131
4617
|
_toFieldTransform(t) {
|
|
4132
|
-
const e = new
|
|
4133
|
-
return new
|
|
4618
|
+
const e = new Ie(t.q, ge(t.q, this.ft));
|
|
4619
|
+
return new Ae(t.path, e);
|
|
4134
4620
|
}
|
|
4135
4621
|
isEqual(t) {
|
|
4136
4622
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4138,50 +4624,50 @@ class qn extends vn {
|
|
|
4138
4624
|
}
|
|
4139
4625
|
}
|
|
4140
4626
|
|
|
4141
|
-
/** Parse update data from an update() call. */ function
|
|
4627
|
+
/** Parse update data from an update() call. */ function Un(t, e, n, r) {
|
|
4142
4628
|
const s = t.ht(1 /* Update */ , e, n);
|
|
4143
|
-
|
|
4144
|
-
const i = [], o =
|
|
4629
|
+
Kn("Data must be an object, but it was:", s, r);
|
|
4630
|
+
const i = [], o = Yt.empty();
|
|
4145
4631
|
Et(r, ((t, r) => {
|
|
4146
|
-
const u =
|
|
4632
|
+
const u = Hn(e, t, n);
|
|
4147
4633
|
// For Compat types, we have to "extract" the underlying types before
|
|
4148
4634
|
// performing validation.
|
|
4149
4635
|
r = getModularInstance(r);
|
|
4150
4636
|
const c = s.it(u);
|
|
4151
|
-
if (r instanceof
|
|
4637
|
+
if (r instanceof qn)
|
|
4152
4638
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4153
4639
|
i.push(u); else {
|
|
4154
|
-
const t =
|
|
4640
|
+
const t = zn(r, c);
|
|
4155
4641
|
null != t && (i.push(u), o.set(u, t));
|
|
4156
4642
|
}
|
|
4157
4643
|
}));
|
|
4158
|
-
const u = new
|
|
4159
|
-
return new
|
|
4644
|
+
const u = new Vt(i);
|
|
4645
|
+
return new Nn(o, u, s.fieldTransforms);
|
|
4160
4646
|
}
|
|
4161
4647
|
|
|
4162
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
4163
|
-
const o = t.ht(1 /* Update */ , e, n), u = [
|
|
4164
|
-
if (i.length % 2 != 0) throw new
|
|
4165
|
-
for (let t = 0; t < i.length; t += 2) u.push(
|
|
4166
|
-
const a = [], l =
|
|
4648
|
+
/** Parse update data from a list of field/value arguments. */ function jn(t, e, n, r, s, i) {
|
|
4649
|
+
const o = t.ht(1 /* Update */ , e, n), u = [ Qn(e, r, n) ], c = [ s ];
|
|
4650
|
+
if (i.length % 2 != 0) throw new L(A, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4651
|
+
for (let t = 0; t < i.length; t += 2) u.push(Qn(e, i[t])), c.push(i[t + 1]);
|
|
4652
|
+
const a = [], l = Yt.empty();
|
|
4167
4653
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4168
4654
|
// user specified the field multiple times.
|
|
4169
|
-
for (let t = u.length - 1; t >= 0; --t) if (!
|
|
4655
|
+
for (let t = u.length - 1; t >= 0; --t) if (!Xn(a, u[t])) {
|
|
4170
4656
|
const e = u[t];
|
|
4171
4657
|
let n = c[t];
|
|
4172
4658
|
// For Compat types, we have to "extract" the underlying types before
|
|
4173
4659
|
// performing validation.
|
|
4174
4660
|
n = getModularInstance(n);
|
|
4175
4661
|
const r = o.it(e);
|
|
4176
|
-
if (n instanceof
|
|
4662
|
+
if (n instanceof qn)
|
|
4177
4663
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4178
4664
|
a.push(e); else {
|
|
4179
|
-
const t =
|
|
4665
|
+
const t = zn(n, r);
|
|
4180
4666
|
null != t && (a.push(e), l.set(e, t));
|
|
4181
4667
|
}
|
|
4182
4668
|
}
|
|
4183
|
-
const f = new
|
|
4184
|
-
return new
|
|
4669
|
+
const f = new Vt(a);
|
|
4670
|
+
return new Nn(l, f, o.fieldTransforms);
|
|
4185
4671
|
}
|
|
4186
4672
|
|
|
4187
4673
|
/**
|
|
@@ -4190,8 +4676,8 @@ class qn extends vn {
|
|
|
4190
4676
|
*
|
|
4191
4677
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4192
4678
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4193
|
-
*/ function
|
|
4194
|
-
return
|
|
4679
|
+
*/ function Bn(t, e, n, r = !1) {
|
|
4680
|
+
return zn(n, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
4195
4681
|
}
|
|
4196
4682
|
|
|
4197
4683
|
/**
|
|
@@ -4202,12 +4688,12 @@ class qn extends vn {
|
|
|
4202
4688
|
* the source of the data being parsed, etc.
|
|
4203
4689
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
4204
4690
|
* that should not be included in the resulting parsed data.
|
|
4205
|
-
*/ function
|
|
4206
|
-
if (
|
|
4691
|
+
*/ function zn(t, e) {
|
|
4692
|
+
if (Wn(
|
|
4207
4693
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4208
4694
|
// from firestore-exp.
|
|
4209
|
-
t = getModularInstance(t))) return
|
|
4210
|
-
if (t instanceof
|
|
4695
|
+
t = getModularInstance(t))) return Kn("Unsupported field value:", e, t), Gn(t, e);
|
|
4696
|
+
if (t instanceof An)
|
|
4211
4697
|
// FieldValues usually parse into transforms (except deleteField())
|
|
4212
4698
|
// in which case we do not want to include this field in our parsed data
|
|
4213
4699
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -4219,7 +4705,7 @@ class qn extends vn {
|
|
|
4219
4705
|
*/
|
|
4220
4706
|
return function(t, e) {
|
|
4221
4707
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4222
|
-
if (!
|
|
4708
|
+
if (!Dn(e.tt)) throw e.ut(`${t._methodName}() can only be used with update() and set()`);
|
|
4223
4709
|
if (!e.path) throw e.ut(`${t._methodName}() is not currently supported inside arrays`);
|
|
4224
4710
|
const n = t._toFieldTransform(e);
|
|
4225
4711
|
n && e.fieldTransforms.push(n);
|
|
@@ -4249,7 +4735,7 @@ class qn extends vn {
|
|
|
4249
4735
|
const n = [];
|
|
4250
4736
|
let r = 0;
|
|
4251
4737
|
for (const s of t) {
|
|
4252
|
-
let t =
|
|
4738
|
+
let t = zn(s, e.ot(r));
|
|
4253
4739
|
null == t && (
|
|
4254
4740
|
// Just include nulls in the array for fields being replaced with a
|
|
4255
4741
|
// sentinel.
|
|
@@ -4268,7 +4754,7 @@ class qn extends vn {
|
|
|
4268
4754
|
if (null === (t = getModularInstance(t))) return {
|
|
4269
4755
|
nullValue: "NULL_VALUE"
|
|
4270
4756
|
};
|
|
4271
|
-
if ("number" == typeof t) return
|
|
4757
|
+
if ("number" == typeof t) return ge(e.q, t);
|
|
4272
4758
|
if ("boolean" == typeof t) return {
|
|
4273
4759
|
booleanValue: t
|
|
4274
4760
|
};
|
|
@@ -4278,7 +4764,7 @@ class qn extends vn {
|
|
|
4278
4764
|
if (t instanceof Date) {
|
|
4279
4765
|
const n = gt.fromDate(t);
|
|
4280
4766
|
return {
|
|
4281
|
-
timestampValue:
|
|
4767
|
+
timestampValue: qe(e.q, n)
|
|
4282
4768
|
};
|
|
4283
4769
|
}
|
|
4284
4770
|
if (t instanceof gt) {
|
|
@@ -4287,23 +4773,23 @@ class qn extends vn {
|
|
|
4287
4773
|
// truncation immediately without waiting for the backend to do that.
|
|
4288
4774
|
const n = new gt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
4289
4775
|
return {
|
|
4290
|
-
timestampValue:
|
|
4776
|
+
timestampValue: qe(e.q, n)
|
|
4291
4777
|
};
|
|
4292
4778
|
}
|
|
4293
|
-
if (t instanceof
|
|
4779
|
+
if (t instanceof Rn) return {
|
|
4294
4780
|
geoPointValue: {
|
|
4295
4781
|
latitude: t.latitude,
|
|
4296
4782
|
longitude: t.longitude
|
|
4297
4783
|
}
|
|
4298
4784
|
};
|
|
4299
|
-
if (t instanceof
|
|
4300
|
-
bytesValue:
|
|
4785
|
+
if (t instanceof In) return {
|
|
4786
|
+
bytesValue: Oe(e.q, t._byteString)
|
|
4301
4787
|
};
|
|
4302
|
-
if (t instanceof
|
|
4788
|
+
if (t instanceof wn) {
|
|
4303
4789
|
const n = e.databaseId, r = t.firestore._databaseId;
|
|
4304
4790
|
if (!r.isEqual(n)) throw e.ut(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);
|
|
4305
4791
|
return {
|
|
4306
|
-
referenceValue:
|
|
4792
|
+
referenceValue: Le(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
4307
4793
|
};
|
|
4308
4794
|
}
|
|
4309
4795
|
throw e.ut(`Unsupported field value: ${it(t)}`);
|
|
@@ -4317,13 +4803,13 @@ class qn extends vn {
|
|
|
4317
4803
|
*/ (t, e);
|
|
4318
4804
|
}
|
|
4319
4805
|
|
|
4320
|
-
function
|
|
4806
|
+
function Gn(t, e) {
|
|
4321
4807
|
const n = {};
|
|
4322
4808
|
return !function(t) {
|
|
4323
4809
|
for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
4324
4810
|
return !0;
|
|
4325
4811
|
}(t) ? Et(t, ((t, r) => {
|
|
4326
|
-
const s =
|
|
4812
|
+
const s = zn(r, e.nt(t));
|
|
4327
4813
|
null != s && (n[t] = s);
|
|
4328
4814
|
})) :
|
|
4329
4815
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -4335,12 +4821,12 @@ function kn(t, e) {
|
|
|
4335
4821
|
};
|
|
4336
4822
|
}
|
|
4337
4823
|
|
|
4338
|
-
function
|
|
4339
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof
|
|
4824
|
+
function Wn(t) {
|
|
4825
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof Rn || t instanceof In || t instanceof wn || t instanceof An);
|
|
4340
4826
|
}
|
|
4341
4827
|
|
|
4342
|
-
function
|
|
4343
|
-
if (!
|
|
4828
|
+
function Kn(t, e, n) {
|
|
4829
|
+
if (!Wn(n) || !function(t) {
|
|
4344
4830
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4345
4831
|
}(n)) {
|
|
4346
4832
|
const r = it(n);
|
|
@@ -4350,20 +4836,20 @@ function Mn(t, e, n) {
|
|
|
4350
4836
|
|
|
4351
4837
|
/**
|
|
4352
4838
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
4353
|
-
*/ function
|
|
4839
|
+
*/ function Qn(t, e, n) {
|
|
4354
4840
|
if ((
|
|
4355
4841
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
4356
4842
|
// FieldPath.
|
|
4357
|
-
e = getModularInstance(e)) instanceof
|
|
4358
|
-
if ("string" == typeof e) return
|
|
4359
|
-
throw
|
|
4843
|
+
e = getModularInstance(e)) instanceof En) return e._internalPath;
|
|
4844
|
+
if ("string" == typeof e) return Hn(t, e);
|
|
4845
|
+
throw Jn("Field path arguments must be of type string or ", t,
|
|
4360
4846
|
/* hasConverter= */ !1,
|
|
4361
4847
|
/* path= */ void 0, n);
|
|
4362
4848
|
}
|
|
4363
4849
|
|
|
4364
4850
|
/**
|
|
4365
4851
|
* Matches any characters in a field path string that are reserved.
|
|
4366
|
-
*/ const
|
|
4852
|
+
*/ const Yn = new RegExp("[~\\*/\\[\\]]");
|
|
4367
4853
|
|
|
4368
4854
|
/**
|
|
4369
4855
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -4373,29 +4859,29 @@ function Mn(t, e, n) {
|
|
|
4373
4859
|
* split on dots.
|
|
4374
4860
|
* @param targetDoc - The document against which the field path will be
|
|
4375
4861
|
* evaluated.
|
|
4376
|
-
*/ function
|
|
4377
|
-
if (e.search(
|
|
4862
|
+
*/ function Hn(t, e, n) {
|
|
4863
|
+
if (e.search(Yn) >= 0) throw Jn(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
4378
4864
|
/* hasConverter= */ !1,
|
|
4379
4865
|
/* path= */ void 0, n);
|
|
4380
4866
|
try {
|
|
4381
|
-
return new
|
|
4867
|
+
return new En(...e.split("."))._internalPath;
|
|
4382
4868
|
} catch (r) {
|
|
4383
|
-
throw
|
|
4869
|
+
throw Jn(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
4384
4870
|
/* hasConverter= */ !1,
|
|
4385
4871
|
/* path= */ void 0, n);
|
|
4386
4872
|
}
|
|
4387
4873
|
}
|
|
4388
4874
|
|
|
4389
|
-
function
|
|
4875
|
+
function Jn(t, e, n, r, s) {
|
|
4390
4876
|
const i = r && !r.isEmpty(), o = void 0 !== s;
|
|
4391
4877
|
let u = `Function ${e}() called with invalid data`;
|
|
4392
4878
|
n && (u += " (via `toFirestore()`)"), u += ". ";
|
|
4393
4879
|
let c = "";
|
|
4394
4880
|
return (i || o) && (c += " (found", i && (c += ` in field ${r}`), o && (c += ` in document ${s}`),
|
|
4395
|
-
c += ")"), new
|
|
4881
|
+
c += ")"), new L(A, u + t + c);
|
|
4396
4882
|
}
|
|
4397
4883
|
|
|
4398
|
-
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function
|
|
4884
|
+
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Xn(t, e) {
|
|
4399
4885
|
return t.some((t => t.isEqual(e)));
|
|
4400
4886
|
}
|
|
4401
4887
|
|
|
@@ -4423,7 +4909,7 @@ function Qn(t, e, n, r, s) {
|
|
|
4423
4909
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
4424
4910
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
4425
4911
|
* explicitly verify a document's existence.
|
|
4426
|
-
*/ class
|
|
4912
|
+
*/ class Zn {
|
|
4427
4913
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
4428
4914
|
// the legacy SDK. The changes are:
|
|
4429
4915
|
// - No support for SnapshotMetadata.
|
|
@@ -4439,7 +4925,7 @@ function Qn(t, e, n, r, s) {
|
|
|
4439
4925
|
/**
|
|
4440
4926
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
4441
4927
|
*/ get ref() {
|
|
4442
|
-
return new
|
|
4928
|
+
return new wn(this._firestore, this._converter, this._key);
|
|
4443
4929
|
}
|
|
4444
4930
|
/**
|
|
4445
4931
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -4459,7 +4945,7 @@ function Qn(t, e, n, r, s) {
|
|
|
4459
4945
|
if (this._converter) {
|
|
4460
4946
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
4461
4947
|
// if a converter has been provided.
|
|
4462
|
-
const t = new
|
|
4948
|
+
const t = new tr(this._firestore, this._userDataWriter, this._key, this._document,
|
|
4463
4949
|
/* converter= */ null);
|
|
4464
4950
|
return this._converter.fromFirestore(t);
|
|
4465
4951
|
}
|
|
@@ -4479,7 +4965,7 @@ function Qn(t, e, n, r, s) {
|
|
|
4479
4965
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4480
4966
|
get(t) {
|
|
4481
4967
|
if (this._document) {
|
|
4482
|
-
const e = this._document.data.field(
|
|
4968
|
+
const e = this._document.data.field(rr("DocumentSnapshot.get", t));
|
|
4483
4969
|
if (null !== e) return this._userDataWriter.convertValue(e);
|
|
4484
4970
|
}
|
|
4485
4971
|
}
|
|
@@ -4495,7 +4981,7 @@ function Qn(t, e, n, r, s) {
|
|
|
4495
4981
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
4496
4982
|
* `exists` property will always be true and `data()` will never return
|
|
4497
4983
|
* 'undefined'.
|
|
4498
|
-
*/ class
|
|
4984
|
+
*/ class tr extends Zn {
|
|
4499
4985
|
/**
|
|
4500
4986
|
* Retrieves all fields in the document as an `Object`.
|
|
4501
4987
|
*
|
|
@@ -4513,7 +4999,7 @@ function Qn(t, e, n, r, s) {
|
|
|
4513
4999
|
* array via the `docs` property or enumerated using the `forEach` method. The
|
|
4514
5000
|
* number of documents can be determined via the `empty` and `size`
|
|
4515
5001
|
* properties.
|
|
4516
|
-
*/ class
|
|
5002
|
+
*/ class er {
|
|
4517
5003
|
/** @hideconstructor */
|
|
4518
5004
|
constructor(t, e) {
|
|
4519
5005
|
this._docs = e, this.query = t;
|
|
@@ -4544,14 +5030,14 @@ function Qn(t, e, n, r, s) {
|
|
|
4544
5030
|
* @param left - A snapshot to compare.
|
|
4545
5031
|
* @param right - A snapshot to compare.
|
|
4546
5032
|
* @returns true if the snapshots are equal.
|
|
4547
|
-
*/ function
|
|
4548
|
-
return t = getModularInstance(t), e = getModularInstance(e), t instanceof
|
|
5033
|
+
*/ function nr(t, e) {
|
|
5034
|
+
return t = getModularInstance(t), e = getModularInstance(e), t instanceof Zn && e instanceof Zn ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof er && e instanceof er && (bn(t.query, e.query) && _t(t.docs, e.docs, nr));
|
|
4549
5035
|
}
|
|
4550
5036
|
|
|
4551
5037
|
/**
|
|
4552
5038
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
4553
|
-
*/ function
|
|
4554
|
-
return "string" == typeof e ?
|
|
5039
|
+
*/ function rr(t, e) {
|
|
5040
|
+
return "string" == typeof e ? Hn(t, e) : e instanceof En ? e._internalPath : e._delegate._internalPath;
|
|
4555
5041
|
}
|
|
4556
5042
|
|
|
4557
5043
|
/**
|
|
@@ -4578,7 +5064,7 @@ function Qn(t, e, n, r, s) {
|
|
|
4578
5064
|
* can then be passed to {@link query} to create a new query instance that
|
|
4579
5065
|
* also contains this `QueryConstraint`.
|
|
4580
5066
|
*/
|
|
4581
|
-
class
|
|
5067
|
+
class sr {}
|
|
4582
5068
|
|
|
4583
5069
|
/**
|
|
4584
5070
|
* Creates a new immutable instance of {@link Query} that is extended to also include
|
|
@@ -4588,40 +5074,40 @@ class Zn {}
|
|
|
4588
5074
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
4589
5075
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
4590
5076
|
* existing or new constraints.
|
|
4591
|
-
*/ function
|
|
5077
|
+
*/ function ir(t, ...e) {
|
|
4592
5078
|
for (const n of e) t = n._apply(t);
|
|
4593
5079
|
return t;
|
|
4594
5080
|
}
|
|
4595
5081
|
|
|
4596
|
-
class
|
|
5082
|
+
class or extends sr {
|
|
4597
5083
|
constructor(t, e, n) {
|
|
4598
5084
|
super(), this.dt = t, this.wt = e, this.yt = n, this.type = "where";
|
|
4599
5085
|
}
|
|
4600
5086
|
_apply(t) {
|
|
4601
|
-
const e =
|
|
5087
|
+
const e = Fn(t.firestore), n = function(t, e, n, r, s, i, o) {
|
|
4602
5088
|
let u;
|
|
4603
5089
|
if (s.isKeyField()) {
|
|
4604
|
-
if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new
|
|
5090
|
+
if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new L(A, `Invalid Query. You can't perform '${i}' queries on documentId().`);
|
|
4605
5091
|
if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
|
|
4606
|
-
|
|
5092
|
+
br(o, i);
|
|
4607
5093
|
const e = [];
|
|
4608
|
-
for (const n of o) e.push(
|
|
5094
|
+
for (const n of o) e.push(vr(r, t, n));
|
|
4609
5095
|
u = {
|
|
4610
5096
|
arrayValue: {
|
|
4611
5097
|
values: e
|
|
4612
5098
|
}
|
|
4613
5099
|
};
|
|
4614
|
-
} else u =
|
|
4615
|
-
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i ||
|
|
4616
|
-
u =
|
|
5100
|
+
} else u = vr(r, t, o);
|
|
5101
|
+
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || br(o, i),
|
|
5102
|
+
u = Bn(n, e, o,
|
|
4617
5103
|
/* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
|
|
4618
|
-
const c =
|
|
5104
|
+
const c = Zt.create(s, i, u);
|
|
4619
5105
|
return function(t, e) {
|
|
4620
|
-
if (e.
|
|
4621
|
-
const n =
|
|
4622
|
-
if (null !== n && !n.isEqual(e.field)) throw new
|
|
4623
|
-
const r =
|
|
4624
|
-
null !== r &&
|
|
5106
|
+
if (e.D()) {
|
|
5107
|
+
const n = we(t);
|
|
5108
|
+
if (null !== n && !n.isEqual(e.field)) throw new L(A, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${e.field.toString()}'`);
|
|
5109
|
+
const r = de(t);
|
|
5110
|
+
null !== r && Er(t, e.field, r);
|
|
4625
5111
|
}
|
|
4626
5112
|
const n = function(t, e) {
|
|
4627
5113
|
for (const n of t.filters) if (e.indexOf(n.op) >= 0) return n.op;
|
|
@@ -4662,12 +5148,12 @@ class er extends Zn {
|
|
|
4662
5148
|
}(e.op));
|
|
4663
5149
|
if (null !== n)
|
|
4664
5150
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
4665
|
-
throw n === e.op ? new
|
|
5151
|
+
throw n === e.op ? new L(A, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new L(A, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
4666
5152
|
}(t, c), c;
|
|
4667
5153
|
}(t._query, "where", e, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
4668
|
-
return new
|
|
5154
|
+
return new mn(t.firestore, t.converter, function(t, e) {
|
|
4669
5155
|
const n = t.filters.concat([ e ]);
|
|
4670
|
-
return new
|
|
5156
|
+
return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
4671
5157
|
}(t._query, n));
|
|
4672
5158
|
}
|
|
4673
5159
|
}
|
|
@@ -4682,25 +5168,25 @@ class er extends Zn {
|
|
|
4682
5168
|
* "<=", "!=").
|
|
4683
5169
|
* @param value - The value for comparison
|
|
4684
5170
|
* @returns The created {@link Query}.
|
|
4685
|
-
*/ function
|
|
4686
|
-
const r = e, s =
|
|
4687
|
-
return new
|
|
5171
|
+
*/ function ur(t, e, n) {
|
|
5172
|
+
const r = e, s = rr("where", t);
|
|
5173
|
+
return new or(s, r, n);
|
|
4688
5174
|
}
|
|
4689
5175
|
|
|
4690
|
-
class
|
|
5176
|
+
class cr extends sr {
|
|
4691
5177
|
constructor(t, e) {
|
|
4692
5178
|
super(), this.dt = t, this._t = e, this.type = "orderBy";
|
|
4693
5179
|
}
|
|
4694
5180
|
_apply(t) {
|
|
4695
5181
|
const e = function(t, e, n) {
|
|
4696
|
-
if (null !== t.startAt) throw new
|
|
4697
|
-
if (null !== t.endAt) throw new
|
|
4698
|
-
const r = new
|
|
5182
|
+
if (null !== t.startAt) throw new L(A, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
5183
|
+
if (null !== t.endAt) throw new L(A, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
5184
|
+
const r = new ae(e, n);
|
|
4699
5185
|
return function(t, e) {
|
|
4700
|
-
if (null ===
|
|
5186
|
+
if (null === de(t)) {
|
|
4701
5187
|
// This is the first order by. It must match any inequality.
|
|
4702
|
-
const n =
|
|
4703
|
-
null !== n &&
|
|
5188
|
+
const n = we(t);
|
|
5189
|
+
null !== n && Er(t, n, e.field);
|
|
4704
5190
|
}
|
|
4705
5191
|
}(t, r), r;
|
|
4706
5192
|
}
|
|
@@ -4715,10 +5201,10 @@ class rr extends Zn {
|
|
|
4715
5201
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
4716
5202
|
* server timestamp.
|
|
4717
5203
|
*/ (t._query, this.dt, this._t);
|
|
4718
|
-
return new
|
|
5204
|
+
return new mn(t.firestore, t.converter, function(t, e) {
|
|
4719
5205
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4720
5206
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
4721
|
-
return new
|
|
5207
|
+
return new fe(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
4722
5208
|
}(t._query, e));
|
|
4723
5209
|
}
|
|
4724
5210
|
}
|
|
@@ -4731,18 +5217,18 @@ class rr extends Zn {
|
|
|
4731
5217
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
4732
5218
|
* not specified, order will be ascending.
|
|
4733
5219
|
* @returns The created {@link Query}.
|
|
4734
|
-
*/ function
|
|
4735
|
-
const n = e, r =
|
|
4736
|
-
return new
|
|
5220
|
+
*/ function ar(t, e = "asc") {
|
|
5221
|
+
const n = e, r = rr("orderBy", t);
|
|
5222
|
+
return new cr(r, n);
|
|
4737
5223
|
}
|
|
4738
5224
|
|
|
4739
|
-
class
|
|
5225
|
+
class hr extends sr {
|
|
4740
5226
|
constructor(t, e, n) {
|
|
4741
5227
|
super(), this.type = t, this.gt = e, this.vt = n;
|
|
4742
5228
|
}
|
|
4743
5229
|
_apply(t) {
|
|
4744
|
-
return new
|
|
4745
|
-
return new
|
|
5230
|
+
return new mn(t.firestore, t.converter, function(t, e, n) {
|
|
5231
|
+
return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
4746
5232
|
}(t._query, this.gt, this.vt));
|
|
4747
5233
|
}
|
|
4748
5234
|
}
|
|
@@ -4752,8 +5238,8 @@ class ir extends Zn {
|
|
|
4752
5238
|
*
|
|
4753
5239
|
* @param limit - The maximum number of items to return.
|
|
4754
5240
|
* @returns The created {@link Query}.
|
|
4755
|
-
*/ function
|
|
4756
|
-
return ut("limit", t), new
|
|
5241
|
+
*/ function lr(t) {
|
|
5242
|
+
return ut("limit", t), new hr("limit", t, "F" /* First */);
|
|
4757
5243
|
}
|
|
4758
5244
|
|
|
4759
5245
|
/**
|
|
@@ -4764,56 +5250,56 @@ class ir extends Zn {
|
|
|
4764
5250
|
*
|
|
4765
5251
|
* @param limit - The maximum number of items to return.
|
|
4766
5252
|
* @returns The created {@link Query}.
|
|
4767
|
-
*/ function
|
|
4768
|
-
return ut("limitToLast", t), new
|
|
5253
|
+
*/ function fr(t) {
|
|
5254
|
+
return ut("limitToLast", t), new hr("limitToLast", t, "L" /* Last */);
|
|
4769
5255
|
}
|
|
4770
5256
|
|
|
4771
|
-
class
|
|
5257
|
+
class dr extends sr {
|
|
4772
5258
|
constructor(t, e, n) {
|
|
4773
5259
|
super(), this.type = t, this.bt = e, this.Et = n;
|
|
4774
5260
|
}
|
|
4775
5261
|
_apply(t) {
|
|
4776
|
-
const e =
|
|
4777
|
-
return new
|
|
4778
|
-
return new
|
|
5262
|
+
const e = gr(t, this.type, this.bt, this.Et);
|
|
5263
|
+
return new mn(t.firestore, t.converter, function(t, e) {
|
|
5264
|
+
return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
4779
5265
|
}(t._query, e));
|
|
4780
5266
|
}
|
|
4781
5267
|
}
|
|
4782
5268
|
|
|
4783
|
-
function
|
|
4784
|
-
return new
|
|
5269
|
+
function wr(...t) {
|
|
5270
|
+
return new dr("startAt", t,
|
|
4785
5271
|
/*inclusive=*/ !0);
|
|
4786
5272
|
}
|
|
4787
5273
|
|
|
4788
|
-
function
|
|
4789
|
-
return new
|
|
5274
|
+
function mr(...t) {
|
|
5275
|
+
return new dr("startAfter", t,
|
|
4790
5276
|
/*inclusive=*/ !1);
|
|
4791
5277
|
}
|
|
4792
5278
|
|
|
4793
|
-
class
|
|
5279
|
+
class pr extends sr {
|
|
4794
5280
|
constructor(t, e, n) {
|
|
4795
5281
|
super(), this.type = t, this.bt = e, this.Et = n;
|
|
4796
5282
|
}
|
|
4797
5283
|
_apply(t) {
|
|
4798
|
-
const e =
|
|
4799
|
-
return new
|
|
4800
|
-
return new
|
|
5284
|
+
const e = gr(t, this.type, this.bt, this.Et);
|
|
5285
|
+
return new mn(t.firestore, t.converter, function(t, e) {
|
|
5286
|
+
return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
4801
5287
|
}(t._query, e));
|
|
4802
5288
|
}
|
|
4803
5289
|
}
|
|
4804
5290
|
|
|
4805
|
-
function
|
|
4806
|
-
return new
|
|
5291
|
+
function yr(...t) {
|
|
5292
|
+
return new pr("endBefore", t,
|
|
4807
5293
|
/*inclusive=*/ !1);
|
|
4808
5294
|
}
|
|
4809
5295
|
|
|
4810
|
-
function
|
|
4811
|
-
return new
|
|
5296
|
+
function _r(...t) {
|
|
5297
|
+
return new pr("endAt", t, /*inclusive=*/ !0);
|
|
4812
5298
|
}
|
|
4813
5299
|
|
|
4814
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
4815
|
-
if (n[0] = getModularInstance(n[0]), n[0] instanceof
|
|
4816
|
-
if (!r) throw new
|
|
5300
|
+
/** Helper function to create a bound from a document or fields */ function gr(t, e, n, r) {
|
|
5301
|
+
if (n[0] = getModularInstance(n[0]), n[0] instanceof Zn) return function(t, e, n, r, s) {
|
|
5302
|
+
if (!r) throw new L(P, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
|
|
4817
5303
|
const i = [];
|
|
4818
5304
|
// Because people expect to continue/end a query at the exact document
|
|
4819
5305
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
@@ -4822,42 +5308,42 @@ function dr(...t) {
|
|
|
4822
5308
|
// the provided document. Without the key (by using the explicit sort
|
|
4823
5309
|
// orders), multiple documents could match the position, yielding duplicate
|
|
4824
5310
|
// results.
|
|
4825
|
-
for (const n of
|
|
5311
|
+
for (const n of pe(t)) if (n.field.isKeyField()) i.push(Bt(e, r.key)); else {
|
|
4826
5312
|
const t = r.data.field(n.field);
|
|
4827
|
-
if (
|
|
5313
|
+
if (St(t)) throw new L(A, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
4828
5314
|
if (null === t) {
|
|
4829
5315
|
const t = n.field.canonicalString();
|
|
4830
|
-
throw new
|
|
5316
|
+
throw new L(A, `Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`);
|
|
4831
5317
|
}
|
|
4832
5318
|
i.push(t);
|
|
4833
5319
|
}
|
|
4834
|
-
return new
|
|
5320
|
+
return new ce(i, s);
|
|
4835
5321
|
}
|
|
4836
5322
|
/**
|
|
4837
5323
|
* Converts a list of field values to a `Bound` for the given query.
|
|
4838
5324
|
*/ (t._query, t.firestore._databaseId, e, n[0]._document, r);
|
|
4839
5325
|
{
|
|
4840
|
-
const s =
|
|
5326
|
+
const s = Fn(t.firestore);
|
|
4841
5327
|
return function(t, e, n, r, s, i) {
|
|
4842
5328
|
// Use explicit order by's because it has to match the query the user made
|
|
4843
5329
|
const o = t.explicitOrderBy;
|
|
4844
|
-
if (s.length > o.length) throw new
|
|
5330
|
+
if (s.length > o.length) throw new L(A, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
|
|
4845
5331
|
const u = [];
|
|
4846
5332
|
for (let i = 0; i < s.length; i++) {
|
|
4847
5333
|
const c = s[i];
|
|
4848
5334
|
if (o[i].field.isKeyField()) {
|
|
4849
|
-
if ("string" != typeof c) throw new
|
|
4850
|
-
if (!
|
|
5335
|
+
if ("string" != typeof c) throw new L(A, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
|
|
5336
|
+
if (!me(t) && -1 !== c.indexOf("/")) throw new L(A, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${c}' contains a slash.`);
|
|
4851
5337
|
const n = t.path.child(X.fromString(c));
|
|
4852
|
-
if (!et.isDocumentKey(n)) throw new
|
|
5338
|
+
if (!et.isDocumentKey(n)) throw new L(A, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
|
|
4853
5339
|
const s = new et(n);
|
|
4854
|
-
u.push(
|
|
5340
|
+
u.push(Bt(e, s));
|
|
4855
5341
|
} else {
|
|
4856
|
-
const t =
|
|
5342
|
+
const t = Bn(n, r, c);
|
|
4857
5343
|
u.push(t);
|
|
4858
5344
|
}
|
|
4859
5345
|
}
|
|
4860
|
-
return new
|
|
5346
|
+
return new ce(u, i);
|
|
4861
5347
|
}
|
|
4862
5348
|
/**
|
|
4863
5349
|
* Parses the given `documentIdValue` into a `ReferenceValue`, throwing
|
|
@@ -4867,28 +5353,28 @@ function dr(...t) {
|
|
|
4867
5353
|
}
|
|
4868
5354
|
}
|
|
4869
5355
|
|
|
4870
|
-
function
|
|
5356
|
+
function vr(t, e, n) {
|
|
4871
5357
|
if ("string" == typeof (n = getModularInstance(n))) {
|
|
4872
|
-
if ("" === n) throw new
|
|
4873
|
-
if (!
|
|
5358
|
+
if ("" === n) throw new L(A, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
5359
|
+
if (!me(e) && -1 !== n.indexOf("/")) throw new L(A, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
4874
5360
|
const r = e.path.child(X.fromString(n));
|
|
4875
|
-
if (!et.isDocumentKey(r)) throw new
|
|
4876
|
-
return
|
|
5361
|
+
if (!et.isDocumentKey(r)) throw new L(A, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
|
|
5362
|
+
return Bt(t, new et(r));
|
|
4877
5363
|
}
|
|
4878
|
-
if (n instanceof
|
|
4879
|
-
throw new
|
|
5364
|
+
if (n instanceof wn) return Bt(t, n._key);
|
|
5365
|
+
throw new L(A, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${it(n)}.`);
|
|
4880
5366
|
}
|
|
4881
5367
|
|
|
4882
5368
|
/**
|
|
4883
5369
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
4884
5370
|
* array requirements.
|
|
4885
|
-
*/ function
|
|
4886
|
-
if (!Array.isArray(t) || 0 === t.length) throw new
|
|
4887
|
-
if (t.length > 10) throw new
|
|
5371
|
+
*/ function br(t, e) {
|
|
5372
|
+
if (!Array.isArray(t) || 0 === t.length) throw new L(A, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
|
|
5373
|
+
if (t.length > 10) throw new L(A, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
|
|
4888
5374
|
}
|
|
4889
5375
|
|
|
4890
|
-
function
|
|
4891
|
-
if (!n.isEqual(e)) throw new
|
|
5376
|
+
function Er(t, e, n) {
|
|
5377
|
+
if (!n.isEqual(e)) throw new L(A, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`);
|
|
4892
5378
|
}
|
|
4893
5379
|
|
|
4894
5380
|
/**
|
|
@@ -4938,7 +5424,7 @@ function yr(t, e, n) {
|
|
|
4938
5424
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
4939
5425
|
* call.
|
|
4940
5426
|
*/
|
|
4941
|
-
function
|
|
5427
|
+
function Tr(t, e, n) {
|
|
4942
5428
|
let r;
|
|
4943
5429
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
4944
5430
|
// toFirestore().
|
|
@@ -4947,9 +5433,9 @@ function _r(t, e, n) {
|
|
|
4947
5433
|
r;
|
|
4948
5434
|
}
|
|
4949
5435
|
|
|
4950
|
-
class
|
|
5436
|
+
class Ir extends class {
|
|
4951
5437
|
convertValue(t, e = "none") {
|
|
4952
|
-
switch (
|
|
5438
|
+
switch (Ct(t)) {
|
|
4953
5439
|
case 0 /* NullValue */ :
|
|
4954
5440
|
return null;
|
|
4955
5441
|
|
|
@@ -4957,7 +5443,7 @@ class gr extends class {
|
|
|
4957
5443
|
return t.booleanValue;
|
|
4958
5444
|
|
|
4959
5445
|
case 2 /* NumberValue */ :
|
|
4960
|
-
return
|
|
5446
|
+
return xt(t.integerValue || t.doubleValue);
|
|
4961
5447
|
|
|
4962
5448
|
case 3 /* TimestampValue */ :
|
|
4963
5449
|
return this.convertTimestamp(t.timestampValue);
|
|
@@ -4969,7 +5455,7 @@ class gr extends class {
|
|
|
4969
5455
|
return t.stringValue;
|
|
4970
5456
|
|
|
4971
5457
|
case 6 /* BlobValue */ :
|
|
4972
|
-
return this.convertBytes(
|
|
5458
|
+
return this.convertBytes(Ft(t.bytesValue));
|
|
4973
5459
|
|
|
4974
5460
|
case 7 /* RefValue */ :
|
|
4975
5461
|
return this.convertReference(t.referenceValue);
|
|
@@ -4994,7 +5480,7 @@ class gr extends class {
|
|
|
4994
5480
|
})), n;
|
|
4995
5481
|
}
|
|
4996
5482
|
convertGeoPoint(t) {
|
|
4997
|
-
return new
|
|
5483
|
+
return new Rn(xt(t.latitude), xt(t.longitude));
|
|
4998
5484
|
}
|
|
4999
5485
|
convertArray(t, e) {
|
|
5000
5486
|
return (t.values || []).map((t => this.convertValue(t, e)));
|
|
@@ -5002,24 +5488,24 @@ class gr extends class {
|
|
|
5002
5488
|
convertServerTimestamp(t, e) {
|
|
5003
5489
|
switch (e) {
|
|
5004
5490
|
case "previous":
|
|
5005
|
-
const n =
|
|
5491
|
+
const n = qt(t);
|
|
5006
5492
|
return null == n ? null : this.convertValue(n, e);
|
|
5007
5493
|
|
|
5008
5494
|
case "estimate":
|
|
5009
|
-
return this.convertTimestamp(
|
|
5495
|
+
return this.convertTimestamp(Ot(t));
|
|
5010
5496
|
|
|
5011
5497
|
default:
|
|
5012
5498
|
return null;
|
|
5013
5499
|
}
|
|
5014
5500
|
}
|
|
5015
5501
|
convertTimestamp(t) {
|
|
5016
|
-
const e =
|
|
5502
|
+
const e = $t(t);
|
|
5017
5503
|
return new gt(e.seconds, e.nanos);
|
|
5018
5504
|
}
|
|
5019
5505
|
convertDocumentKey(t, e) {
|
|
5020
5506
|
const n = X.fromString(t);
|
|
5021
|
-
v(
|
|
5022
|
-
const r = new
|
|
5507
|
+
v(Xe(n));
|
|
5508
|
+
const r = new H(n.get(1), n.get(3)), s = new et(n.popFirst(5));
|
|
5023
5509
|
return r.isEqual(e) ||
|
|
5024
5510
|
// TODO(b/64130202): Somehow support foreign references.
|
|
5025
5511
|
p(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),
|
|
@@ -5030,11 +5516,11 @@ class gr extends class {
|
|
|
5030
5516
|
super(), this.firestore = t;
|
|
5031
5517
|
}
|
|
5032
5518
|
convertBytes(t) {
|
|
5033
|
-
return new
|
|
5519
|
+
return new In(t);
|
|
5034
5520
|
}
|
|
5035
5521
|
convertReference(t) {
|
|
5036
5522
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
5037
|
-
return new
|
|
5523
|
+
return new wn(this.firestore, /* converter= */ null, e);
|
|
5038
5524
|
}
|
|
5039
5525
|
}
|
|
5040
5526
|
|
|
@@ -5050,12 +5536,12 @@ class gr extends class {
|
|
|
5050
5536
|
* @param reference - The reference of the document to fetch.
|
|
5051
5537
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
5052
5538
|
* document contents.
|
|
5053
|
-
*/ function
|
|
5054
|
-
const e =
|
|
5055
|
-
return
|
|
5539
|
+
*/ function Ar(t) {
|
|
5540
|
+
const e = un((t = ot(t, wn)).firestore), n = new Ir(t.firestore);
|
|
5541
|
+
return rn(e, [ t._key ]).then((e => {
|
|
5056
5542
|
v(1 === e.length);
|
|
5057
5543
|
const r = e[0];
|
|
5058
|
-
return new
|
|
5544
|
+
return new Zn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5059
5545
|
}));
|
|
5060
5546
|
}
|
|
5061
5547
|
|
|
@@ -5070,33 +5556,33 @@ class gr extends class {
|
|
|
5070
5556
|
*
|
|
5071
5557
|
* @param query - The `Query` to execute.
|
|
5072
5558
|
* @returns A Promise that will be resolved with the results of the query.
|
|
5073
|
-
*/ function
|
|
5559
|
+
*/ function Rr(t) {
|
|
5074
5560
|
!function(t) {
|
|
5075
|
-
if (
|
|
5076
|
-
}((t = ot(t,
|
|
5077
|
-
const e =
|
|
5078
|
-
return
|
|
5079
|
-
const r = e.map((e => new
|
|
5080
|
-
return
|
|
5561
|
+
if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new L(q, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5562
|
+
}((t = ot(t, mn))._query);
|
|
5563
|
+
const e = un(t.firestore), n = new Ir(t.firestore);
|
|
5564
|
+
return sn(e, t._query).then((e => {
|
|
5565
|
+
const r = e.map((e => new tr(t.firestore, n, e.key, e, t.converter)));
|
|
5566
|
+
return "L" /* Last */ === t._query.limitType &&
|
|
5081
5567
|
// Limit to last queries reverse the orderBy constraint that was
|
|
5082
5568
|
// specified by the user. As such, we need to reverse the order of the
|
|
5083
5569
|
// results to return the documents in the expected order.
|
|
5084
|
-
r.reverse(), new
|
|
5570
|
+
r.reverse(), new er(t, r);
|
|
5085
5571
|
}));
|
|
5086
5572
|
}
|
|
5087
5573
|
|
|
5088
|
-
function
|
|
5089
|
-
const r =
|
|
5090
|
-
return
|
|
5574
|
+
function Pr(t, e, n) {
|
|
5575
|
+
const r = Tr((t = ot(t, wn)).converter, e, n), s = Sn(Fn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
5576
|
+
return nn(un(t.firestore), [ s.toMutation(t._key, Re.none()) ]);
|
|
5091
5577
|
}
|
|
5092
5578
|
|
|
5093
|
-
function
|
|
5094
|
-
const s =
|
|
5579
|
+
function Vr(t, e, n, ...r) {
|
|
5580
|
+
const s = Fn((t = ot(t, wn)).firestore);
|
|
5095
5581
|
// For Compat types, we have to "extract" the underlying types before
|
|
5096
5582
|
// performing validation.
|
|
5097
5583
|
let i;
|
|
5098
|
-
i = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
5099
|
-
return
|
|
5584
|
+
i = "string" == typeof (e = getModularInstance(e)) || e instanceof En ? jn(s, "updateDoc", t._key, e, n, r) : Un(s, "updateDoc", t._key, e);
|
|
5585
|
+
return nn(un(t.firestore), [ i.toMutation(t._key, Re.exists(!0)) ]);
|
|
5100
5586
|
}
|
|
5101
5587
|
|
|
5102
5588
|
/**
|
|
@@ -5110,8 +5596,8 @@ function Tr(t, e, n, ...r) {
|
|
|
5110
5596
|
* @param reference - A reference to the document to delete.
|
|
5111
5597
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5112
5598
|
* deleted from the backend.
|
|
5113
|
-
*/ function
|
|
5114
|
-
return
|
|
5599
|
+
*/ function Nr(t) {
|
|
5600
|
+
return nn(un((t = ot(t, wn)).firestore), [ new De(t._key, Re.none()) ]);
|
|
5115
5601
|
}
|
|
5116
5602
|
|
|
5117
5603
|
/**
|
|
@@ -5128,9 +5614,9 @@ function Tr(t, e, n, ...r) {
|
|
|
5128
5614
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
5129
5615
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
5130
5616
|
* newly created document after it has been written to the backend.
|
|
5131
|
-
*/ function
|
|
5132
|
-
const n =
|
|
5133
|
-
return
|
|
5617
|
+
*/ function Dr(t, e) {
|
|
5618
|
+
const n = gn(t = ot(t, pn)), r = Tr(t.converter, e), s = Sn(Fn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
5619
|
+
return nn(un(t.firestore), [ s.toMutation(n._key, Re.exists(!1)) ]).then((() => n));
|
|
5134
5620
|
}
|
|
5135
5621
|
|
|
5136
5622
|
/**
|
|
@@ -5152,15 +5638,15 @@ function Tr(t, e, n, ...r) {
|
|
|
5152
5638
|
/**
|
|
5153
5639
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
5154
5640
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
5155
|
-
*/ function
|
|
5156
|
-
return new
|
|
5641
|
+
*/ function $r() {
|
|
5642
|
+
return new qn("deleteField");
|
|
5157
5643
|
}
|
|
5158
5644
|
|
|
5159
5645
|
/**
|
|
5160
5646
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
5161
5647
|
* include a server-generated timestamp in the written data.
|
|
5162
|
-
*/ function
|
|
5163
|
-
return new
|
|
5648
|
+
*/ function xr() {
|
|
5649
|
+
return new kn("serverTimestamp");
|
|
5164
5650
|
}
|
|
5165
5651
|
|
|
5166
5652
|
/**
|
|
@@ -5174,10 +5660,10 @@ function Tr(t, e, n, ...r) {
|
|
|
5174
5660
|
* @param elements - The elements to union into the array.
|
|
5175
5661
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5176
5662
|
* `updateDoc()`.
|
|
5177
|
-
*/ function
|
|
5663
|
+
*/ function Fr(...t) {
|
|
5178
5664
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5179
5665
|
// update() since we'd need the Firestore instance to do this.
|
|
5180
|
-
return new
|
|
5666
|
+
return new Cn("arrayUnion", t);
|
|
5181
5667
|
}
|
|
5182
5668
|
|
|
5183
5669
|
/**
|
|
@@ -5190,10 +5676,10 @@ function Tr(t, e, n, ...r) {
|
|
|
5190
5676
|
* @param elements - The elements to remove from the array.
|
|
5191
5677
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5192
5678
|
* `updateDoc()`
|
|
5193
|
-
*/ function
|
|
5679
|
+
*/ function Sr(...t) {
|
|
5194
5680
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5195
5681
|
// update() since we'd need the Firestore instance to do this.
|
|
5196
|
-
return new
|
|
5682
|
+
return new Ln("arrayRemove", t);
|
|
5197
5683
|
}
|
|
5198
5684
|
|
|
5199
5685
|
/**
|
|
@@ -5214,8 +5700,8 @@ function Tr(t, e, n, ...r) {
|
|
|
5214
5700
|
* @param n - The value to increment by.
|
|
5215
5701
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5216
5702
|
* `updateDoc()`
|
|
5217
|
-
*/ function
|
|
5218
|
-
return new
|
|
5703
|
+
*/ function qr(t) {
|
|
5704
|
+
return new Mn("increment", t);
|
|
5219
5705
|
}
|
|
5220
5706
|
|
|
5221
5707
|
/**
|
|
@@ -5241,25 +5727,25 @@ function Tr(t, e, n, ...r) {
|
|
|
5241
5727
|
* provides methods for adding writes to the write batch. None of the writes
|
|
5242
5728
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
5243
5729
|
* called.
|
|
5244
|
-
*/ class
|
|
5730
|
+
*/ class Or {
|
|
5245
5731
|
/** @hideconstructor */
|
|
5246
5732
|
constructor(t, e) {
|
|
5247
5733
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
5248
|
-
this._dataReader =
|
|
5734
|
+
this._dataReader = Fn(t);
|
|
5249
5735
|
}
|
|
5250
5736
|
set(t, e, n) {
|
|
5251
5737
|
this._verifyNotCommitted();
|
|
5252
|
-
const r =
|
|
5253
|
-
return this._mutations.push(i.toMutation(r._key,
|
|
5738
|
+
const r = kr(t, this._firestore), s = Tr(r.converter, e, n), i = Sn(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
|
|
5739
|
+
return this._mutations.push(i.toMutation(r._key, Re.none())), this;
|
|
5254
5740
|
}
|
|
5255
5741
|
update(t, e, n, ...r) {
|
|
5256
5742
|
this._verifyNotCommitted();
|
|
5257
|
-
const s =
|
|
5743
|
+
const s = kr(t, this._firestore);
|
|
5258
5744
|
// For Compat types, we have to "extract" the underlying types before
|
|
5259
5745
|
// performing validation.
|
|
5260
5746
|
let i;
|
|
5261
|
-
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
5262
|
-
this._mutations.push(i.toMutation(s._key,
|
|
5747
|
+
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof En ? jn(this._dataReader, "WriteBatch.update", s._key, e, n, r) : Un(this._dataReader, "WriteBatch.update", s._key, e),
|
|
5748
|
+
this._mutations.push(i.toMutation(s._key, Re.exists(!0))), this;
|
|
5263
5749
|
}
|
|
5264
5750
|
/**
|
|
5265
5751
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -5268,8 +5754,8 @@ function Tr(t, e, n, ...r) {
|
|
|
5268
5754
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
5269
5755
|
*/ delete(t) {
|
|
5270
5756
|
this._verifyNotCommitted();
|
|
5271
|
-
const e =
|
|
5272
|
-
return this._mutations = this._mutations.concat(new
|
|
5757
|
+
const e = kr(t, this._firestore);
|
|
5758
|
+
return this._mutations = this._mutations.concat(new De(e._key, Re.none())), this;
|
|
5273
5759
|
}
|
|
5274
5760
|
/**
|
|
5275
5761
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -5286,12 +5772,12 @@ function Tr(t, e, n, ...r) {
|
|
|
5286
5772
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
5287
5773
|
}
|
|
5288
5774
|
_verifyNotCommitted() {
|
|
5289
|
-
if (this._committed) throw new
|
|
5775
|
+
if (this._committed) throw new L(x, "A write batch can no longer be used after commit() has been called.");
|
|
5290
5776
|
}
|
|
5291
5777
|
}
|
|
5292
5778
|
|
|
5293
|
-
function
|
|
5294
|
-
if ((t = getModularInstance(t)).firestore !== e) throw new
|
|
5779
|
+
function kr(t, e) {
|
|
5780
|
+
if ((t = getModularInstance(t)).firestore !== e) throw new L(A, "Provided document reference is from a different Firestore instance.");
|
|
5295
5781
|
return t;
|
|
5296
5782
|
}
|
|
5297
5783
|
|
|
@@ -5307,9 +5793,9 @@ function Sr(t, e) {
|
|
|
5307
5793
|
*
|
|
5308
5794
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
5309
5795
|
* writes.
|
|
5310
|
-
*/ function
|
|
5311
|
-
const e =
|
|
5312
|
-
return new
|
|
5796
|
+
*/ function Cr(t) {
|
|
5797
|
+
const e = un(t = ot(t, an));
|
|
5798
|
+
return new Or(t, (t => nn(e, t)));
|
|
5313
5799
|
}
|
|
5314
5800
|
|
|
5315
5801
|
/**
|
|
@@ -5331,7 +5817,7 @@ function Sr(t, e) {
|
|
|
5331
5817
|
/**
|
|
5332
5818
|
* Internal transaction object responsible for accumulating the mutations to
|
|
5333
5819
|
* perform and the base versions for any documents read.
|
|
5334
|
-
*/ class
|
|
5820
|
+
*/ class Lr {
|
|
5335
5821
|
constructor(t) {
|
|
5336
5822
|
this.datastore = t,
|
|
5337
5823
|
// The version of each document that was read during this transaction.
|
|
@@ -5350,8 +5836,8 @@ function Sr(t, e) {
|
|
|
5350
5836
|
this.writtenDocs = new Set;
|
|
5351
5837
|
}
|
|
5352
5838
|
async lookup(t) {
|
|
5353
|
-
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new
|
|
5354
|
-
const e = await
|
|
5839
|
+
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new L(A, "Firestore transactions require all reads to be executed before all writes.");
|
|
5840
|
+
const e = await rn(this.datastore, t);
|
|
5355
5841
|
return e.forEach((t => this.recordVersion(t))), e;
|
|
5356
5842
|
}
|
|
5357
5843
|
set(t, e) {
|
|
@@ -5366,7 +5852,7 @@ function Sr(t, e) {
|
|
|
5366
5852
|
this.writtenDocs.add(t.toString());
|
|
5367
5853
|
}
|
|
5368
5854
|
delete(t) {
|
|
5369
|
-
this.write(new
|
|
5855
|
+
this.write(new De(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
5370
5856
|
}
|
|
5371
5857
|
async commit() {
|
|
5372
5858
|
if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
|
|
@@ -5379,8 +5865,8 @@ function Sr(t, e) {
|
|
|
5379
5865
|
// a `verify` operation.
|
|
5380
5866
|
t.forEach(((t, e) => {
|
|
5381
5867
|
const n = et.fromPath(e);
|
|
5382
|
-
this.mutations.push(new
|
|
5383
|
-
})), await
|
|
5868
|
+
this.mutations.push(new $e(n, this.precondition(n)));
|
|
5869
|
+
})), await nn(this.datastore, this.mutations), this.committed = !0;
|
|
5384
5870
|
}
|
|
5385
5871
|
recordVersion(t) {
|
|
5386
5872
|
let e;
|
|
@@ -5393,7 +5879,7 @@ function Sr(t, e) {
|
|
|
5393
5879
|
if (n) {
|
|
5394
5880
|
if (!e.isEqual(n))
|
|
5395
5881
|
// This transaction will fail no matter what.
|
|
5396
|
-
throw new
|
|
5882
|
+
throw new L(F, "Document version changed between two reads.");
|
|
5397
5883
|
} else this.readVersions.set(t.key.toString(), e);
|
|
5398
5884
|
}
|
|
5399
5885
|
/**
|
|
@@ -5401,7 +5887,7 @@ function Sr(t, e) {
|
|
|
5401
5887
|
* as a precondition, or no precondition if it was not read.
|
|
5402
5888
|
*/ precondition(t) {
|
|
5403
5889
|
const e = this.readVersions.get(t.toString());
|
|
5404
|
-
return !this.writtenDocs.has(t.toString()) && e ?
|
|
5890
|
+
return !this.writtenDocs.has(t.toString()) && e ? Re.updateTime(e) : Re.none();
|
|
5405
5891
|
}
|
|
5406
5892
|
/**
|
|
5407
5893
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -5420,13 +5906,13 @@ function Sr(t, e) {
|
|
|
5420
5906
|
// express that to the backend, we have to validate locally.
|
|
5421
5907
|
// Note: this can change once we can send separate verify writes in the
|
|
5422
5908
|
// transaction.
|
|
5423
|
-
throw new
|
|
5909
|
+
throw new L(A, "Can't update a document that doesn't exist.");
|
|
5424
5910
|
// Document exists, base precondition on document update time.
|
|
5425
|
-
return
|
|
5911
|
+
return Re.updateTime(e);
|
|
5426
5912
|
}
|
|
5427
5913
|
// Document was not read, so we just use the preconditions for a blind
|
|
5428
5914
|
// update.
|
|
5429
|
-
return
|
|
5915
|
+
return Re.exists(!0);
|
|
5430
5916
|
}
|
|
5431
5917
|
write(t) {
|
|
5432
5918
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
@@ -5434,6 +5920,25 @@ function Sr(t, e) {
|
|
|
5434
5920
|
ensureCommitNotCalled() {}
|
|
5435
5921
|
}
|
|
5436
5922
|
|
|
5923
|
+
/**
|
|
5924
|
+
* @license
|
|
5925
|
+
* Copyright 2022 Google LLC
|
|
5926
|
+
*
|
|
5927
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5928
|
+
* you may not use this file except in compliance with the License.
|
|
5929
|
+
* You may obtain a copy of the License at
|
|
5930
|
+
*
|
|
5931
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5932
|
+
*
|
|
5933
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5934
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5935
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5936
|
+
* See the License for the specific language governing permissions and
|
|
5937
|
+
* limitations under the License.
|
|
5938
|
+
*/ const Mr = {
|
|
5939
|
+
maxAttempts: 5
|
|
5940
|
+
};
|
|
5941
|
+
|
|
5437
5942
|
/**
|
|
5438
5943
|
* @license
|
|
5439
5944
|
* Copyright 2019 Google LLC
|
|
@@ -5454,17 +5959,17 @@ function Sr(t, e) {
|
|
|
5454
5959
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
5455
5960
|
* with backoff.
|
|
5456
5961
|
*/
|
|
5457
|
-
class
|
|
5458
|
-
constructor(t, e, n, r) {
|
|
5459
|
-
this.asyncQueue = t, this.datastore = e, this.
|
|
5460
|
-
this.Tt =
|
|
5962
|
+
class Ur {
|
|
5963
|
+
constructor(t, e, n, r, s) {
|
|
5964
|
+
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
5965
|
+
this.deferred = s, this.Tt = n.maxAttempts, this.It = new tn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
5461
5966
|
}
|
|
5462
5967
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
5463
5968
|
this.Tt -= 1, this.At();
|
|
5464
5969
|
}
|
|
5465
5970
|
At() {
|
|
5466
5971
|
this.It.W((async () => {
|
|
5467
|
-
const t = new
|
|
5972
|
+
const t = new Lr(this.datastore), e = this.Rt(t);
|
|
5468
5973
|
e && e.then((e => {
|
|
5469
5974
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
5470
5975
|
this.deferred.resolve(e);
|
|
@@ -5512,24 +6017,24 @@ class qr {
|
|
|
5512
6017
|
case R:
|
|
5513
6018
|
case $:
|
|
5514
6019
|
case O:
|
|
5515
|
-
case
|
|
6020
|
+
case k:
|
|
5516
6021
|
// Unauthenticated means something went wrong with our token and we need
|
|
5517
6022
|
// to retry with new credentials which will happen automatically.
|
|
5518
|
-
case
|
|
6023
|
+
case D:
|
|
5519
6024
|
return !1;
|
|
5520
6025
|
|
|
5521
6026
|
case A:
|
|
5522
6027
|
case P:
|
|
5523
6028
|
case V:
|
|
5524
|
-
case
|
|
5525
|
-
case
|
|
6029
|
+
case N:
|
|
6030
|
+
case x:
|
|
5526
6031
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
5527
6032
|
// the context and should handled individually by the calling code.
|
|
5528
6033
|
// See https://cloud.google.com/apis/design/errors.
|
|
5529
6034
|
case F:
|
|
5530
|
-
case
|
|
6035
|
+
case S:
|
|
5531
6036
|
case q:
|
|
5532
|
-
case
|
|
6037
|
+
case C:
|
|
5533
6038
|
return !0;
|
|
5534
6039
|
}
|
|
5535
6040
|
}(e);
|
|
@@ -5554,7 +6059,7 @@ class qr {
|
|
|
5554
6059
|
* See the License for the specific language governing permissions and
|
|
5555
6060
|
* limitations under the License.
|
|
5556
6061
|
*/
|
|
5557
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
6062
|
+
/** The Platform's 'document' implementation or null if not available. */ function jr() {
|
|
5558
6063
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
5559
6064
|
// eslint-disable-next-line no-restricted-globals
|
|
5560
6065
|
return "undefined" != typeof document ? document : null;
|
|
@@ -5586,10 +6091,10 @@ class qr {
|
|
|
5586
6091
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
5587
6092
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
5588
6093
|
* IE.
|
|
5589
|
-
*/ class
|
|
6094
|
+
*/ class Br {
|
|
5590
6095
|
constructor(t, e, n, r, s) {
|
|
5591
6096
|
this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = s,
|
|
5592
|
-
this.deferred = new
|
|
6097
|
+
this.deferred = new M, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
5593
6098
|
// It's normal for the deferred promise to be canceled (due to cancellation)
|
|
5594
6099
|
// and so we attach a dummy catch callback to avoid
|
|
5595
6100
|
// 'UnhandledPromiseRejectionWarning' log spam.
|
|
@@ -5609,7 +6114,7 @@ class qr {
|
|
|
5609
6114
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
5610
6115
|
* the DelayedOperation class public.
|
|
5611
6116
|
*/ static createAndSchedule(t, e, n, r, s) {
|
|
5612
|
-
const i = Date.now() + n, o = new
|
|
6117
|
+
const i = Date.now() + n, o = new Br(t, e, i, r, s);
|
|
5613
6118
|
return o.start(n), o;
|
|
5614
6119
|
}
|
|
5615
6120
|
/**
|
|
@@ -5631,7 +6136,7 @@ class qr {
|
|
|
5631
6136
|
* As long as the operation has not yet been run, calling cancel() provides a
|
|
5632
6137
|
* guarantee that the operation will not be run.
|
|
5633
6138
|
*/ cancel(t) {
|
|
5634
|
-
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new
|
|
6139
|
+
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new L(T, "Operation cancelled" + (t ? ": " + t : ""))));
|
|
5635
6140
|
}
|
|
5636
6141
|
handleDelayElapsed() {
|
|
5637
6142
|
this.asyncQueue.enqueueAndForget((() => null !== this.timerHandle ? (this.clearTimeout(),
|
|
@@ -5658,39 +6163,39 @@ class qr {
|
|
|
5658
6163
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5659
6164
|
* See the License for the specific language governing permissions and
|
|
5660
6165
|
* limitations under the License.
|
|
5661
|
-
*/ class
|
|
6166
|
+
*/ class zr {
|
|
5662
6167
|
constructor() {
|
|
5663
6168
|
// The last promise in the queue.
|
|
5664
|
-
this.
|
|
6169
|
+
this.Nt = Promise.resolve(),
|
|
5665
6170
|
// A list of retryable operations. Retryable operations are run in order and
|
|
5666
6171
|
// retried with backoff.
|
|
5667
|
-
this.
|
|
6172
|
+
this.Dt = [],
|
|
5668
6173
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
5669
6174
|
// be changed again.
|
|
5670
6175
|
this.$t = !1,
|
|
5671
6176
|
// Operations scheduled to be queued in the future. Operations are
|
|
5672
6177
|
// automatically removed after they are run or canceled.
|
|
5673
|
-
this.
|
|
6178
|
+
this.xt = [],
|
|
5674
6179
|
// visible for testing
|
|
5675
6180
|
this.Ft = null,
|
|
5676
6181
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
5677
6182
|
// assertion sanity-checks.
|
|
5678
|
-
this.
|
|
6183
|
+
this.St = !1,
|
|
5679
6184
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
5680
6185
|
this.qt = !1,
|
|
5681
6186
|
// List of TimerIds to fast-forward delays for.
|
|
5682
6187
|
this.Ot = [],
|
|
5683
6188
|
// Backoff timer used to schedule retries for retryable operations
|
|
5684
|
-
this.It = new
|
|
6189
|
+
this.It = new tn(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5685
6190
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5686
6191
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5687
6192
|
// after page comes into foreground.
|
|
5688
|
-
this.
|
|
5689
|
-
const t =
|
|
5690
|
-
t && m("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.It.
|
|
6193
|
+
this.kt = () => {
|
|
6194
|
+
const t = jr();
|
|
6195
|
+
t && m("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.It.Y();
|
|
5691
6196
|
};
|
|
5692
|
-
const t =
|
|
5693
|
-
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.
|
|
6197
|
+
const t = jr();
|
|
6198
|
+
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.kt);
|
|
5694
6199
|
}
|
|
5695
6200
|
get isShuttingDown() {
|
|
5696
6201
|
return this.$t;
|
|
@@ -5703,38 +6208,38 @@ class qr {
|
|
|
5703
6208
|
this.enqueue(t);
|
|
5704
6209
|
}
|
|
5705
6210
|
enqueueAndForgetEvenWhileRestricted(t) {
|
|
5706
|
-
this.
|
|
6211
|
+
this.Ct(),
|
|
5707
6212
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
5708
|
-
this.
|
|
6213
|
+
this.Lt(t);
|
|
5709
6214
|
}
|
|
5710
6215
|
enterRestrictedMode(t) {
|
|
5711
6216
|
if (!this.$t) {
|
|
5712
6217
|
this.$t = !0, this.qt = t || !1;
|
|
5713
|
-
const e =
|
|
5714
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
6218
|
+
const e = jr();
|
|
6219
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.kt);
|
|
5715
6220
|
}
|
|
5716
6221
|
}
|
|
5717
6222
|
enqueue(t) {
|
|
5718
|
-
if (this.
|
|
6223
|
+
if (this.Ct(), this.$t)
|
|
5719
6224
|
// Return a Promise which never resolves.
|
|
5720
6225
|
return new Promise((() => {}));
|
|
5721
6226
|
// Create a deferred Promise that we can return to the callee. This
|
|
5722
6227
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
5723
6228
|
// advance the queue even when the operation is not run.
|
|
5724
|
-
const e = new
|
|
5725
|
-
return this.
|
|
6229
|
+
const e = new M;
|
|
6230
|
+
return this.Lt((() => this.$t && this.qt ? Promise.resolve() : (t().then(e.resolve, e.reject),
|
|
5726
6231
|
e.promise))).then((() => e.promise));
|
|
5727
6232
|
}
|
|
5728
6233
|
enqueueRetryable(t) {
|
|
5729
|
-
this.enqueueAndForget((() => (this.
|
|
6234
|
+
this.enqueueAndForget((() => (this.Dt.push(t), this.Mt())));
|
|
5730
6235
|
}
|
|
5731
6236
|
/**
|
|
5732
6237
|
* Runs the next operation from the retryable queue. If the operation fails,
|
|
5733
6238
|
* reschedules with backoff.
|
|
5734
|
-
*/ async
|
|
5735
|
-
if (0 !== this.
|
|
6239
|
+
*/ async Mt() {
|
|
6240
|
+
if (0 !== this.Dt.length) {
|
|
5736
6241
|
try {
|
|
5737
|
-
await this.
|
|
6242
|
+
await this.Dt[0](), this.Dt.shift(), this.It.reset();
|
|
5738
6243
|
} catch (t) {
|
|
5739
6244
|
if (!
|
|
5740
6245
|
/**
|
|
@@ -5778,7 +6283,7 @@ class qr {
|
|
|
5778
6283
|
// Failure will be handled by AsyncQueue
|
|
5779
6284
|
m("AsyncQueue", "Operation failed with retryable error: " + t);
|
|
5780
6285
|
}
|
|
5781
|
-
this.
|
|
6286
|
+
this.Dt.length > 0 &&
|
|
5782
6287
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
5783
6288
|
// This is necessary to run retryable operations that failed during
|
|
5784
6289
|
// their initial attempt since we don't know whether they are already
|
|
@@ -5789,12 +6294,12 @@ class qr {
|
|
|
5789
6294
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
5790
6295
|
// new backoff on every call, there is only ever a single additional
|
|
5791
6296
|
// operation in the queue.
|
|
5792
|
-
this.It.W((() => this.
|
|
6297
|
+
this.It.W((() => this.Mt()));
|
|
5793
6298
|
}
|
|
5794
6299
|
}
|
|
5795
|
-
|
|
5796
|
-
const e = this.
|
|
5797
|
-
this.Ft = t, this.
|
|
6300
|
+
Lt(t) {
|
|
6301
|
+
const e = this.Nt.then((() => (this.St = !0, t().catch((t => {
|
|
6302
|
+
this.Ft = t, this.St = !1;
|
|
5798
6303
|
const e =
|
|
5799
6304
|
/**
|
|
5800
6305
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -5835,38 +6340,38 @@ class qr {
|
|
|
5835
6340
|
// all further attempts to chain (via .then) will just short-circuit
|
|
5836
6341
|
// and return the rejected Promise.
|
|
5837
6342
|
throw p("INTERNAL UNHANDLED ERROR: ", e), t;
|
|
5838
|
-
})).then((t => (this.
|
|
5839
|
-
return this.
|
|
6343
|
+
})).then((t => (this.St = !1, t))))));
|
|
6344
|
+
return this.Nt = e, e;
|
|
5840
6345
|
}
|
|
5841
6346
|
enqueueAfterDelay(t, e, n) {
|
|
5842
|
-
this.
|
|
6347
|
+
this.Ct(),
|
|
5843
6348
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5844
6349
|
this.Ot.indexOf(t) > -1 && (e = 0);
|
|
5845
|
-
const r =
|
|
5846
|
-
return this.
|
|
6350
|
+
const r = Br.createAndSchedule(this, t, e, n, (t => this.Ut(t)));
|
|
6351
|
+
return this.xt.push(r), r;
|
|
5847
6352
|
}
|
|
5848
|
-
|
|
6353
|
+
Ct() {
|
|
5849
6354
|
this.Ft && g();
|
|
5850
6355
|
}
|
|
5851
6356
|
verifyOperationInProgress() {}
|
|
5852
6357
|
/**
|
|
5853
6358
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
5854
6359
|
* operations are not run.
|
|
5855
|
-
*/ async
|
|
6360
|
+
*/ async jt() {
|
|
5856
6361
|
// Operations in the queue prior to draining may have enqueued additional
|
|
5857
6362
|
// operations. Keep draining the queue until the tail is no longer advanced,
|
|
5858
6363
|
// which indicates that no more new operations were enqueued and that all
|
|
5859
6364
|
// operations were executed.
|
|
5860
6365
|
let t;
|
|
5861
6366
|
do {
|
|
5862
|
-
t = this.
|
|
5863
|
-
} while (t !== this.
|
|
6367
|
+
t = this.Nt, await t;
|
|
6368
|
+
} while (t !== this.Nt);
|
|
5864
6369
|
}
|
|
5865
6370
|
/**
|
|
5866
6371
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
5867
6372
|
* exists.
|
|
5868
6373
|
*/ Bt(t) {
|
|
5869
|
-
for (const e of this.
|
|
6374
|
+
for (const e of this.xt) if (e.timerId === t) return !0;
|
|
5870
6375
|
return !1;
|
|
5871
6376
|
}
|
|
5872
6377
|
/**
|
|
@@ -5877,11 +6382,11 @@ class qr {
|
|
|
5877
6382
|
* @returns a Promise that resolves once all operations have been run.
|
|
5878
6383
|
*/ zt(t) {
|
|
5879
6384
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
5880
|
-
return this.
|
|
6385
|
+
return this.jt().then((() => {
|
|
5881
6386
|
// Run ops in the same order they'd run if they ran naturally.
|
|
5882
|
-
this.
|
|
5883
|
-
for (const e of this.
|
|
5884
|
-
return this.
|
|
6387
|
+
this.xt.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
|
|
6388
|
+
for (const e of this.xt) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
|
|
6389
|
+
return this.jt();
|
|
5885
6390
|
}));
|
|
5886
6391
|
}
|
|
5887
6392
|
/**
|
|
@@ -5889,17 +6394,17 @@ class qr {
|
|
|
5889
6394
|
*/ Gt(t) {
|
|
5890
6395
|
this.Ot.push(t);
|
|
5891
6396
|
}
|
|
5892
|
-
/** Called once a DelayedOperation is run or canceled. */
|
|
6397
|
+
/** Called once a DelayedOperation is run or canceled. */ Ut(t) {
|
|
5893
6398
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
5894
|
-
const e = this.
|
|
5895
|
-
this.
|
|
6399
|
+
const e = this.xt.indexOf(t);
|
|
6400
|
+
this.xt.splice(e, 1);
|
|
5896
6401
|
}
|
|
5897
6402
|
}
|
|
5898
6403
|
|
|
5899
|
-
class
|
|
6404
|
+
class Gr {
|
|
5900
6405
|
/** @hideconstructor */
|
|
5901
6406
|
constructor(t, e) {
|
|
5902
|
-
this._firestore = t, this._transaction = e, this._dataReader =
|
|
6407
|
+
this._firestore = t, this._transaction = e, this._dataReader = Fn(t);
|
|
5903
6408
|
}
|
|
5904
6409
|
/**
|
|
5905
6410
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
@@ -5907,25 +6412,25 @@ class Ur {
|
|
|
5907
6412
|
* @param documentRef - A reference to the document to be read.
|
|
5908
6413
|
* @returns A `DocumentSnapshot` with the read data.
|
|
5909
6414
|
*/ get(t) {
|
|
5910
|
-
const e =
|
|
6415
|
+
const e = kr(t, this._firestore), n = new Ir(this._firestore);
|
|
5911
6416
|
return this._transaction.lookup([ e._key ]).then((t => {
|
|
5912
6417
|
if (!t || 1 !== t.length) return g();
|
|
5913
6418
|
const r = t[0];
|
|
5914
|
-
if (r.isFoundDocument()) return new
|
|
5915
|
-
if (r.isNoDocument()) return new
|
|
6419
|
+
if (r.isFoundDocument()) return new Zn(this._firestore, n, r.key, r, e.converter);
|
|
6420
|
+
if (r.isNoDocument()) return new Zn(this._firestore, n, e._key, null, e.converter);
|
|
5916
6421
|
throw g();
|
|
5917
6422
|
}));
|
|
5918
6423
|
}
|
|
5919
6424
|
set(t, e, n) {
|
|
5920
|
-
const r =
|
|
6425
|
+
const r = kr(t, this._firestore), s = Tr(r.converter, e, n), i = Sn(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
|
|
5921
6426
|
return this._transaction.set(r._key, i), this;
|
|
5922
6427
|
}
|
|
5923
6428
|
update(t, e, n, ...r) {
|
|
5924
|
-
const s =
|
|
6429
|
+
const s = kr(t, this._firestore);
|
|
5925
6430
|
// For Compat types, we have to "extract" the underlying types before
|
|
5926
6431
|
// performing validation.
|
|
5927
6432
|
let i;
|
|
5928
|
-
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
6433
|
+
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof En ? jn(this._dataReader, "Transaction.update", s._key, e, n, r) : Un(this._dataReader, "Transaction.update", s._key, e),
|
|
5929
6434
|
this._transaction.update(s._key, i), this;
|
|
5930
6435
|
}
|
|
5931
6436
|
/**
|
|
@@ -5934,7 +6439,7 @@ class Ur {
|
|
|
5934
6439
|
* @param documentRef - A reference to the document to be deleted.
|
|
5935
6440
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
5936
6441
|
*/ delete(t) {
|
|
5937
|
-
const e =
|
|
6442
|
+
const e = kr(t, this._firestore);
|
|
5938
6443
|
return this._transaction.delete(e._key), this;
|
|
5939
6444
|
}
|
|
5940
6445
|
}
|
|
@@ -5951,13 +6456,19 @@ class Ur {
|
|
|
5951
6456
|
* transaction against.
|
|
5952
6457
|
* @param updateFunction - The function to execute within the transaction
|
|
5953
6458
|
* context.
|
|
6459
|
+
* @param options - An options object to configure maximum number of attempts to
|
|
6460
|
+
* commit.
|
|
5954
6461
|
* @returns If the transaction completed successfully or was explicitly aborted
|
|
5955
6462
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
5956
6463
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
5957
6464
|
* rejected promise with the corresponding failure error is returned.
|
|
5958
|
-
*/ function
|
|
5959
|
-
const
|
|
5960
|
-
|
|
6465
|
+
*/ function Wr(t, e, n) {
|
|
6466
|
+
const r = un(t = ot(t, an)), s = Object.assign(Object.assign({}, Mr), n);
|
|
6467
|
+
!function(t) {
|
|
6468
|
+
if (t.maxAttempts < 1) throw new L(A, "Max attempts must be at least 1");
|
|
6469
|
+
}(s);
|
|
6470
|
+
const i = new M;
|
|
6471
|
+
return new Ur(new zr, r, s, (n => e(new Gr(t, n))), i).run(), i.promise;
|
|
5961
6472
|
}
|
|
5962
6473
|
|
|
5963
6474
|
/**
|
|
@@ -5970,11 +6481,11 @@ class Ur {
|
|
|
5970
6481
|
*/ !function(t) {
|
|
5971
6482
|
f = t;
|
|
5972
6483
|
}(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {options: e}) => {
|
|
5973
|
-
const n = t.getProvider("app").getImmediate(), r = new
|
|
6484
|
+
const n = t.getProvider("app").getImmediate(), r = new an(n, new z(t.getProvider("auth-internal")), new Q(t.getProvider("app-check-internal")));
|
|
5974
6485
|
return e && r._setSettings(e), r;
|
|
5975
6486
|
}), "PUBLIC")),
|
|
5976
6487
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5977
|
-
registerVersion("firestore-lite", "3.4.
|
|
6488
|
+
registerVersion("firestore-lite", "3.4.9-canary.0197076b8", ""), registerVersion("firestore-lite", "3.4.9-canary.0197076b8", "esm2017");
|
|
5978
6489
|
|
|
5979
|
-
export {
|
|
6490
|
+
export { In as Bytes, pn as CollectionReference, wn as DocumentReference, Zn as DocumentSnapshot, En as FieldPath, An as FieldValue, an as Firestore, L as FirestoreError, Rn as GeoPoint, mn as Query, sr as QueryConstraint, tr as QueryDocumentSnapshot, er as QuerySnapshot, gt as Timestamp, Gr as Transaction, Or as WriteBatch, Dr as addDoc, Sr as arrayRemove, Fr as arrayUnion, yn as collection, _n as collectionGroup, fn as connectFirestoreEmulator, Nr as deleteDoc, $r as deleteField, gn as doc, Tn as documentId, _r as endAt, yr as endBefore, Ar as getDoc, Rr as getDocs, ln as getFirestore, qr as increment, hn as initializeFirestore, lr as limit, fr as limitToLast, ar as orderBy, ir as query, bn as queryEqual, vn as refEqual, Wr as runTransaction, xr as serverTimestamp, Pr as setDoc, w as setLogLevel, nr as snapshotEqual, mr as startAfter, wr as startAt, dn as terminate, Vr as updateDoc, ur as where, Cr as writeBatch };
|
|
5980
6491
|
//# sourceMappingURL=index.browser.esm2017.js.map
|