@firebase/firestore 4.7.8 → 4.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/firestore/src/global_index.d.ts +9 -2
- package/dist/firestore/src/lite-api/database.d.ts +4 -0
- package/dist/firestore/src/lite-api/settings.d.ts +4 -0
- package/dist/firestore/src/lite-api/vector_value.d.ts +2 -2
- package/dist/firestore/test/integration/util/settings.d.ts +1 -0
- package/dist/index.cjs.js +108 -98
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.esm2017.js +109 -99
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +17 -5
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +18 -6
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +44 -34
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +9 -2
- package/dist/lite/firestore/src/lite-api/database.d.ts +4 -0
- package/dist/lite/firestore/src/lite-api/settings.d.ts +4 -0
- package/dist/lite/firestore/src/lite-api/vector_value.d.ts +2 -2
- package/dist/lite/firestore/test/integration/util/settings.d.ts +1 -0
- package/dist/lite/index.browser.esm2017.js +23 -13
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.cjs.js +23 -13
- package/dist/lite/index.cjs.js.map +1 -1
- package/dist/lite/index.d.ts +2 -2
- package/dist/lite/index.node.cjs.js +17 -5
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +18 -6
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +43 -33
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +9 -2
- package/dist/lite/private.d.ts +6 -2
- package/dist/private.d.ts +6 -2
- package/package.json +6 -6
package/dist/index.rn.js
CHANGED
|
@@ -4,13 +4,13 @@ import { Component as o } from "@firebase/component";
|
|
|
4
4
|
|
|
5
5
|
import { Logger as _, LogLevel as a } from "@firebase/logger";
|
|
6
6
|
|
|
7
|
-
import { FirebaseError as u, isIndexedDBAvailable as c, getUA as l, base64 as h, DecodeBase64StringError as P, isSafari as T,
|
|
7
|
+
import { FirebaseError as u, isIndexedDBAvailable as c, getUA as l, base64 as h, DecodeBase64StringError as P, isSafari as T, deepEqual as I, createMockUserToken as E, getModularInstance as d, getDefaultEmulatorHostnameAndPort as A } from "@firebase/util";
|
|
8
8
|
|
|
9
9
|
import { Integer as R, Md5 as V } from "@firebase/webchannel-wrapper/bloom-blob";
|
|
10
10
|
|
|
11
11
|
import { XhrIo as m, EventType as f, ErrorCode as g, createWebChannelTransport as p, getStatEventTarget as y, WebChannel as w, Event as S, Stat as b } from "@firebase/webchannel-wrapper/webchannel-blob";
|
|
12
12
|
|
|
13
|
-
const D = "@firebase/firestore", v = "4.7.
|
|
13
|
+
const D = "@firebase/firestore", v = "4.7.9";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @license
|
|
@@ -72,7 +72,7 @@ User.MOCK_USER = new User("mock-user");
|
|
|
72
72
|
* See the License for the specific language governing permissions and
|
|
73
73
|
* limitations under the License.
|
|
74
74
|
*/
|
|
75
|
-
let C = "11.
|
|
75
|
+
let C = "11.4.0";
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
78
|
* @license
|
|
@@ -18388,7 +18388,7 @@ class Firestore$1 {
|
|
|
18388
18388
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
18389
18389
|
*/
|
|
18390
18390
|
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new FirestoreSettingsImpl({}),
|
|
18391
|
-
this._settingsFrozen = !1,
|
|
18391
|
+
this._settingsFrozen = !1, this._emulatorOptions = {},
|
|
18392
18392
|
// A task that is assigned when the terminate() is invoked and resolved when
|
|
18393
18393
|
// all components have shut down. Otherwise, Firestore is not terminated,
|
|
18394
18394
|
// which can mean either the FirestoreClient is in the process of starting,
|
|
@@ -18410,7 +18410,8 @@ class Firestore$1 {
|
|
|
18410
18410
|
}
|
|
18411
18411
|
_setSettings(e) {
|
|
18412
18412
|
if (this._settingsFrozen) throw new FirestoreError(M.FAILED_PRECONDITION, "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.");
|
|
18413
|
-
this._settings = new FirestoreSettingsImpl(e),
|
|
18413
|
+
this._settings = new FirestoreSettingsImpl(e), this._emulatorOptions = e.emulatorOptions || {},
|
|
18414
|
+
void 0 !== e.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(e) {
|
|
18414
18415
|
if (!e) return new __PRIVATE_EmptyAuthCredentialsProvider;
|
|
18415
18416
|
switch (e.type) {
|
|
18416
18417
|
case "firstParty":
|
|
@@ -18427,6 +18428,9 @@ class Firestore$1 {
|
|
|
18427
18428
|
_getSettings() {
|
|
18428
18429
|
return this._settings;
|
|
18429
18430
|
}
|
|
18431
|
+
_getEmulatorOptions() {
|
|
18432
|
+
return this._emulatorOptions;
|
|
18433
|
+
}
|
|
18430
18434
|
_freezeSettings() {
|
|
18431
18435
|
return this._settingsFrozen = !0, this._settings;
|
|
18432
18436
|
}
|
|
@@ -18482,17 +18486,23 @@ class Firestore$1 {
|
|
|
18482
18486
|
* Security Rules.
|
|
18483
18487
|
*/ function connectFirestoreEmulator(e, t, n, r = {}) {
|
|
18484
18488
|
var i;
|
|
18485
|
-
const s = (e = __PRIVATE_cast(e, Firestore$1))._getSettings(), o =
|
|
18486
|
-
|
|
18487
|
-
|
|
18488
|
-
|
|
18489
|
-
|
|
18490
|
-
|
|
18489
|
+
const s = (e = __PRIVATE_cast(e, Firestore$1))._getSettings(), o = Object.assign(Object.assign({}, s), {
|
|
18490
|
+
emulatorOptions: e._getEmulatorOptions()
|
|
18491
|
+
}), _ = `${t}:${n}`;
|
|
18492
|
+
s.host !== nn && s.host !== _ && __PRIVATE_logWarn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");
|
|
18493
|
+
const a = Object.assign(Object.assign({}, s), {
|
|
18494
|
+
host: _,
|
|
18495
|
+
ssl: !1,
|
|
18496
|
+
emulatorOptions: r
|
|
18497
|
+
});
|
|
18498
|
+
// No-op if the new configuration matches the current configuration. This supports SSR
|
|
18499
|
+
// enviornments which might call `connectFirestoreEmulator` multiple times as a standard practice.
|
|
18500
|
+
if (!I(a, o) && (e._setSettings(a), r.mockUserToken)) {
|
|
18491
18501
|
let t, n;
|
|
18492
18502
|
if ("string" == typeof r.mockUserToken) t = r.mockUserToken, n = User.MOCK_USER; else {
|
|
18493
18503
|
// Let createMockUserToken validate first (catches common mistakes like
|
|
18494
18504
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
18495
|
-
t =
|
|
18505
|
+
t = E(r.mockUserToken, null === (i = e._app) || void 0 === i ? void 0 : i.options.projectId);
|
|
18496
18506
|
const s = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
18497
18507
|
if (!s) throw new FirestoreError(M.INVALID_ARGUMENT, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
18498
18508
|
n = new User(s);
|
|
@@ -18609,7 +18619,7 @@ class Firestore$1 {
|
|
|
18609
18619
|
}
|
|
18610
18620
|
|
|
18611
18621
|
function collection(e, t, ...n) {
|
|
18612
|
-
if (e =
|
|
18622
|
+
if (e = d(e), __PRIVATE_validateNonEmptyArgument("collection", "path", t), e instanceof Firestore$1) {
|
|
18613
18623
|
const r = ResourcePath.fromString(t, ...n);
|
|
18614
18624
|
return __PRIVATE_validateCollectionPath(r), new CollectionReference(e, /* converter= */ null, r);
|
|
18615
18625
|
}
|
|
@@ -18643,7 +18653,7 @@ function collection(e, t, ...n) {
|
|
|
18643
18653
|
}
|
|
18644
18654
|
|
|
18645
18655
|
function doc(e, t, ...n) {
|
|
18646
|
-
if (e =
|
|
18656
|
+
if (e = d(e),
|
|
18647
18657
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
18648
18658
|
// 'undefined' and 'null'.
|
|
18649
18659
|
1 === arguments.length && (t = __PRIVATE_AutoId.newId()), __PRIVATE_validateNonEmptyArgument("doc", "path", t),
|
|
@@ -18667,7 +18677,7 @@ function doc(e, t, ...n) {
|
|
|
18667
18677
|
* @returns true if the references point to the same location in the same
|
|
18668
18678
|
* Firestore database.
|
|
18669
18679
|
*/ function refEqual(e, t) {
|
|
18670
|
-
return e =
|
|
18680
|
+
return e = d(e), t = d(t), (e instanceof DocumentReference || e instanceof CollectionReference) && (t instanceof DocumentReference || t instanceof CollectionReference) && (e.firestore === t.firestore && e.path === t.path && e.converter === t.converter);
|
|
18671
18681
|
}
|
|
18672
18682
|
|
|
18673
18683
|
/**
|
|
@@ -18679,7 +18689,7 @@ function doc(e, t, ...n) {
|
|
|
18679
18689
|
* @returns true if the references point to the same location in the same
|
|
18680
18690
|
* Firestore database.
|
|
18681
18691
|
*/ function queryEqual(e, t) {
|
|
18682
|
-
return e =
|
|
18692
|
+
return e = d(e), t = d(t), e instanceof Query && t instanceof Query && (e.firestore === t.firestore && __PRIVATE_queryEquals(e._query, t._query) && e.converter === t.converter);
|
|
18683
18693
|
}
|
|
18684
18694
|
|
|
18685
18695
|
/**
|
|
@@ -19055,7 +19065,7 @@ class LoadBundleTask {
|
|
|
19055
19065
|
const e = r.getImmediate({
|
|
19056
19066
|
identifier: n
|
|
19057
19067
|
}), i = r.getOptions(n);
|
|
19058
|
-
if (
|
|
19068
|
+
if (I(i, t)) return e;
|
|
19059
19069
|
throw new FirestoreError(M.FAILED_PRECONDITION, "initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.");
|
|
19060
19070
|
}
|
|
19061
19071
|
if (void 0 !== t.cacheSizeBytes && void 0 !== t.localCache) throw new FirestoreError(M.INVALID_ARGUMENT, "cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");
|
|
@@ -19631,7 +19641,7 @@ class AggregateField {
|
|
|
19631
19641
|
*/
|
|
19632
19642
|
/**
|
|
19633
19643
|
* Represents a vector type in Firestore documents.
|
|
19634
|
-
* Create an instance with {@link
|
|
19644
|
+
* Create an instance with <code>{@link vector}</code>.
|
|
19635
19645
|
*
|
|
19636
19646
|
* @class VectorValue
|
|
19637
19647
|
*/ class VectorValue {
|
|
@@ -19649,7 +19659,7 @@ class AggregateField {
|
|
|
19649
19659
|
return this._values.map((e => e));
|
|
19650
19660
|
}
|
|
19651
19661
|
/**
|
|
19652
|
-
* Returns `true` if the two VectorValue
|
|
19662
|
+
* Returns `true` if the two `VectorValue` values have the same raw number arrays, returns `false` otherwise.
|
|
19653
19663
|
*/ isEqual(e) {
|
|
19654
19664
|
return function __PRIVATE_isPrimitiveArrayEqual(e, t) {
|
|
19655
19665
|
if (e.length !== t.length) return !1;
|
|
@@ -19885,7 +19895,7 @@ class __PRIVATE_ArrayUnionFieldValueImpl extends FieldValue {
|
|
|
19885
19895
|
return new FieldTransform(e.path, r);
|
|
19886
19896
|
}
|
|
19887
19897
|
isEqual(e) {
|
|
19888
|
-
return e instanceof __PRIVATE_ArrayUnionFieldValueImpl &&
|
|
19898
|
+
return e instanceof __PRIVATE_ArrayUnionFieldValueImpl && I(this.Hu, e.Hu);
|
|
19889
19899
|
}
|
|
19890
19900
|
}
|
|
19891
19901
|
|
|
@@ -19899,7 +19909,7 @@ class __PRIVATE_ArrayRemoveFieldValueImpl extends FieldValue {
|
|
|
19899
19909
|
return new FieldTransform(e.path, r);
|
|
19900
19910
|
}
|
|
19901
19911
|
isEqual(e) {
|
|
19902
|
-
return e instanceof __PRIVATE_ArrayRemoveFieldValueImpl &&
|
|
19912
|
+
return e instanceof __PRIVATE_ArrayRemoveFieldValueImpl && I(this.Hu, e.Hu);
|
|
19903
19913
|
}
|
|
19904
19914
|
}
|
|
19905
19915
|
|
|
@@ -19924,7 +19934,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
|
|
|
19924
19934
|
const _ = __PRIVATE_fieldPathFromDotSeparatedString(t, e, n);
|
|
19925
19935
|
// For Compat types, we have to "extract" the underlying types before
|
|
19926
19936
|
// performing validation.
|
|
19927
|
-
r =
|
|
19937
|
+
r = d(r);
|
|
19928
19938
|
const a = i.Ku(_);
|
|
19929
19939
|
if (r instanceof __PRIVATE_DeleteFieldValueImpl)
|
|
19930
19940
|
// Add it to the field mask, but don't add anything to updateData.
|
|
@@ -19950,7 +19960,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
|
|
|
19950
19960
|
let n = a[e];
|
|
19951
19961
|
// For Compat types, we have to "extract" the underlying types before
|
|
19952
19962
|
// performing validation.
|
|
19953
|
-
n =
|
|
19963
|
+
n = d(n);
|
|
19954
19964
|
const r = o.Ku(t);
|
|
19955
19965
|
if (n instanceof __PRIVATE_DeleteFieldValueImpl)
|
|
19956
19966
|
// Add it to the field mask, but don't add anything to updateData.
|
|
@@ -19985,7 +19995,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
|
|
|
19985
19995
|
if (__PRIVATE_looksLikeJsonObject(
|
|
19986
19996
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
19987
19997
|
// from firestore-exp.
|
|
19988
|
-
e =
|
|
19998
|
+
e = d(e))) return __PRIVATE_validatePlainObject("Unsupported field value:", t, e),
|
|
19989
19999
|
__PRIVATE_parseObject(e, t);
|
|
19990
20000
|
if (e instanceof FieldValue)
|
|
19991
20001
|
// FieldValues usually parse into transforms (except deleteField())
|
|
@@ -20045,7 +20055,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
|
|
|
20045
20055
|
}(e, t);
|
|
20046
20056
|
}
|
|
20047
20057
|
return function __PRIVATE_parseScalarValue(e, t) {
|
|
20048
|
-
if (null === (e =
|
|
20058
|
+
if (null === (e = d(e))) return {
|
|
20049
20059
|
nullValue: "NULL_VALUE"
|
|
20050
20060
|
};
|
|
20051
20061
|
if ("number" == typeof e) return toNumber(t.serializer, e);
|
|
@@ -20155,7 +20165,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
|
|
|
20155
20165
|
if ((
|
|
20156
20166
|
// If required, replace the FieldPath Compat class with the firestore-exp
|
|
20157
20167
|
// FieldPath.
|
|
20158
|
-
t =
|
|
20168
|
+
t = d(t)) instanceof FieldPath) return t._internalPath;
|
|
20159
20169
|
if ("string" == typeof t) return __PRIVATE_fieldPathFromDotSeparatedString(e, t);
|
|
20160
20170
|
throw __PRIVATE_createError("Field path arguments must be of type string or ", e,
|
|
20161
20171
|
/* hasConverter= */ !1,
|
|
@@ -20692,7 +20702,7 @@ function endAt(...e) {
|
|
|
20692
20702
|
}
|
|
20693
20703
|
|
|
20694
20704
|
/** Helper function to create a bound from a document or fields */ function __PRIVATE_newQueryBoundFromDocOrFields(e, t, n, r) {
|
|
20695
|
-
if (n[0] =
|
|
20705
|
+
if (n[0] = d(n[0]), n[0] instanceof DocumentSnapshot$1) return function __PRIVATE_newQueryBoundFromDocument(e, t, n, r, i) {
|
|
20696
20706
|
if (!r) throw new FirestoreError(M.NOT_FOUND, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
|
|
20697
20707
|
const s = [];
|
|
20698
20708
|
// Because people expect to continue/end a query at the exact document
|
|
@@ -20748,7 +20758,7 @@ function endAt(...e) {
|
|
|
20748
20758
|
}
|
|
20749
20759
|
|
|
20750
20760
|
function __PRIVATE_parseDocumentIdValue(e, t, n) {
|
|
20751
|
-
if ("string" == typeof (n =
|
|
20761
|
+
if ("string" == typeof (n = d(n))) {
|
|
20752
20762
|
if ("" === n) throw new FirestoreError(M.INVALID_ARGUMENT, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
20753
20763
|
if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== n.indexOf("/")) throw new FirestoreError(M.INVALID_ARGUMENT, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
20754
20764
|
const r = t.path.child(ResourcePath.fromString(n));
|
|
@@ -21006,7 +21016,7 @@ class __PRIVATE_LiteUserDataWriter extends AbstractUserDataWriter {
|
|
|
21006
21016
|
* @returns `true` if the objects are "equal", as defined above, or `false`
|
|
21007
21017
|
* otherwise.
|
|
21008
21018
|
*/ function aggregateQuerySnapshotEqual(e, t) {
|
|
21009
|
-
return queryEqual(e.query, t.query) &&
|
|
21019
|
+
return queryEqual(e.query, t.query) && I(e.data(), t.data());
|
|
21010
21020
|
}
|
|
21011
21021
|
|
|
21012
21022
|
/**
|
|
@@ -21375,7 +21385,7 @@ function updateDoc(e, t, n, ...r) {
|
|
|
21375
21385
|
o = "string" == typeof (
|
|
21376
21386
|
// For Compat types, we have to "extract" the underlying types before
|
|
21377
21387
|
// performing validation.
|
|
21378
|
-
t =
|
|
21388
|
+
t = d(t)) || t instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(s, "updateDoc", e._key, t, n, r) : __PRIVATE_parseUpdateData(s, "updateDoc", e._key, t);
|
|
21379
21389
|
return executeWrite(i, [ o.toMutation(e._key, Precondition.exists(!0)) ]);
|
|
21380
21390
|
}
|
|
21381
21391
|
|
|
@@ -21405,7 +21415,7 @@ function updateDoc(e, t, n, ...r) {
|
|
|
21405
21415
|
|
|
21406
21416
|
function onSnapshot(e, ...t) {
|
|
21407
21417
|
var n, r, i;
|
|
21408
|
-
e =
|
|
21418
|
+
e = d(e);
|
|
21409
21419
|
let s = {
|
|
21410
21420
|
includeMetadataChanges: !1,
|
|
21411
21421
|
source: "default"
|
|
@@ -21776,7 +21786,7 @@ class WriteBatch {
|
|
|
21776
21786
|
// For Compat types, we have to "extract" the underlying types before
|
|
21777
21787
|
// performing validation.
|
|
21778
21788
|
let s;
|
|
21779
|
-
return s = "string" == typeof (t =
|
|
21789
|
+
return s = "string" == typeof (t = d(t)) || t instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(this._dataReader, "WriteBatch.update", i._key, t, n, r) : __PRIVATE_parseUpdateData(this._dataReader, "WriteBatch.update", i._key, t),
|
|
21780
21790
|
this._mutations.push(s.toMutation(i._key, Precondition.exists(!0))), this;
|
|
21781
21791
|
}
|
|
21782
21792
|
/**
|
|
@@ -21810,7 +21820,7 @@ class WriteBatch {
|
|
|
21810
21820
|
}
|
|
21811
21821
|
|
|
21812
21822
|
function __PRIVATE_validateReference(e, t) {
|
|
21813
|
-
if ((e =
|
|
21823
|
+
if ((e = d(e)).firestore !== t) throw new FirestoreError(M.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance.");
|
|
21814
21824
|
return e;
|
|
21815
21825
|
}
|
|
21816
21826
|
|
|
@@ -21867,7 +21877,7 @@ function __PRIVATE_validateReference(e, t) {
|
|
|
21867
21877
|
// For Compat types, we have to "extract" the underlying types before
|
|
21868
21878
|
// performing validation.
|
|
21869
21879
|
let s;
|
|
21870
|
-
return s = "string" == typeof (t =
|
|
21880
|
+
return s = "string" == typeof (t = d(t)) || t instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(this._dataReader, "Transaction.update", i._key, t, n, r) : __PRIVATE_parseUpdateData(this._dataReader, "Transaction.update", i._key, t),
|
|
21871
21881
|
this._transaction.update(i._key, s), this;
|
|
21872
21882
|
}
|
|
21873
21883
|
/**
|