@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.
Files changed (36) hide show
  1. package/dist/firestore/src/global_index.d.ts +9 -2
  2. package/dist/firestore/src/lite-api/database.d.ts +4 -0
  3. package/dist/firestore/src/lite-api/settings.d.ts +4 -0
  4. package/dist/firestore/src/lite-api/vector_value.d.ts +2 -2
  5. package/dist/firestore/test/integration/util/settings.d.ts +1 -0
  6. package/dist/index.cjs.js +108 -98
  7. package/dist/index.cjs.js.map +1 -1
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.esm2017.js +109 -99
  10. package/dist/index.esm2017.js.map +1 -1
  11. package/dist/index.node.cjs.js +17 -5
  12. package/dist/index.node.cjs.js.map +1 -1
  13. package/dist/index.node.mjs +18 -6
  14. package/dist/index.node.mjs.map +1 -1
  15. package/dist/index.rn.js +44 -34
  16. package/dist/index.rn.js.map +1 -1
  17. package/dist/internal.d.ts +9 -2
  18. package/dist/lite/firestore/src/lite-api/database.d.ts +4 -0
  19. package/dist/lite/firestore/src/lite-api/settings.d.ts +4 -0
  20. package/dist/lite/firestore/src/lite-api/vector_value.d.ts +2 -2
  21. package/dist/lite/firestore/test/integration/util/settings.d.ts +1 -0
  22. package/dist/lite/index.browser.esm2017.js +23 -13
  23. package/dist/lite/index.browser.esm2017.js.map +1 -1
  24. package/dist/lite/index.cjs.js +23 -13
  25. package/dist/lite/index.cjs.js.map +1 -1
  26. package/dist/lite/index.d.ts +2 -2
  27. package/dist/lite/index.node.cjs.js +17 -5
  28. package/dist/lite/index.node.cjs.js.map +1 -1
  29. package/dist/lite/index.node.mjs +18 -6
  30. package/dist/lite/index.node.mjs.map +1 -1
  31. package/dist/lite/index.rn.esm2017.js +43 -33
  32. package/dist/lite/index.rn.esm2017.js.map +1 -1
  33. package/dist/lite/internal.d.ts +9 -2
  34. package/dist/lite/private.d.ts +6 -2
  35. package/dist/private.d.ts +6 -2
  36. package/package.json +6 -6
@@ -4,11 +4,11 @@ import { Component as o } from "@firebase/component";
4
4
 
5
5
  import { Logger as a, LogLevel as u } from "@firebase/logger";
6
6
 
7
- import { FirebaseError as _, base64 as c, DecodeBase64StringError as l, getDefaultEmulatorHostnameAndPort as h, createMockUserToken as d, getModularInstance as f, deepEqual as E } from "@firebase/util";
7
+ import { FirebaseError as _, base64 as c, DecodeBase64StringError as l, getDefaultEmulatorHostnameAndPort as h, deepEqual as d, createMockUserToken as f, getModularInstance as E } from "@firebase/util";
8
8
 
9
9
  import { Integer as m } from "@firebase/webchannel-wrapper/bloom-blob";
10
10
 
11
- const A = "4.7.8";
11
+ const A = "4.7.9";
12
12
 
13
13
  /**
14
14
  * @license
@@ -69,7 +69,7 @@ User.MOCK_USER = new User("mock-user");
69
69
  * See the License for the specific language governing permissions and
70
70
  * limitations under the License.
71
71
  */
72
- let T = "11.3.1";
72
+ let T = "11.4.0";
73
73
 
74
74
  /**
75
75
  * @license
@@ -4290,7 +4290,7 @@ class Firestore {
4290
4290
  * Whether it's a Firestore or Firestore Lite instance.
4291
4291
  */
4292
4292
  this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new FirestoreSettingsImpl({}),
4293
- this._settingsFrozen = !1,
4293
+ this._settingsFrozen = !1, this._emulatorOptions = {},
4294
4294
  // A task that is assigned when the terminate() is invoked and resolved when
4295
4295
  // all components have shut down. Otherwise, Firestore is not terminated,
4296
4296
  // which can mean either the FirestoreClient is in the process of starting,
@@ -4312,7 +4312,8 @@ class Firestore {
4312
4312
  }
4313
4313
  _setSettings(t) {
4314
4314
  if (this._settingsFrozen) throw new FirestoreError(b, "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.");
4315
- this._settings = new FirestoreSettingsImpl(t), void 0 !== t.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(t) {
4315
+ this._settings = new FirestoreSettingsImpl(t), this._emulatorOptions = t.emulatorOptions || {},
4316
+ void 0 !== t.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(t) {
4316
4317
  if (!t) return new __PRIVATE_EmptyAuthCredentialsProvider;
4317
4318
  switch (t.type) {
4318
4319
  case "firstParty":
@@ -4329,6 +4330,9 @@ class Firestore {
4329
4330
  _getSettings() {
4330
4331
  return this._settings;
4331
4332
  }
4333
+ _getEmulatorOptions() {
4334
+ return this._emulatorOptions;
4335
+ }
4332
4336
  _freezeSettings() {
4333
4337
  return this._settingsFrozen = !0, this._settings;
4334
4338
  }
@@ -4400,17 +4404,23 @@ function getFirestore(t, r) {
4400
4404
  * Security Rules.
4401
4405
  */ function connectFirestoreEmulator(t, e, r, n = {}) {
4402
4406
  var i;
4403
- const s = (t = __PRIVATE_cast(t, Firestore))._getSettings(), o = `${e}:${r}`;
4404
- if (s.host !== ot && s.host !== o && __PRIVATE_logWarn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),
4405
- t._setSettings(Object.assign(Object.assign({}, s), {
4406
- host: o,
4407
- ssl: !1
4408
- })), n.mockUserToken) {
4407
+ const s = (t = __PRIVATE_cast(t, Firestore))._getSettings(), o = Object.assign(Object.assign({}, s), {
4408
+ emulatorOptions: t._getEmulatorOptions()
4409
+ }), a = `${e}:${r}`;
4410
+ s.host !== ot && s.host !== a && __PRIVATE_logWarn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");
4411
+ const u = Object.assign(Object.assign({}, s), {
4412
+ host: a,
4413
+ ssl: !1,
4414
+ emulatorOptions: n
4415
+ });
4416
+ // No-op if the new configuration matches the current configuration. This supports SSR
4417
+ // enviornments which might call `connectFirestoreEmulator` multiple times as a standard practice.
4418
+ if (!d(u, o) && (t._setSettings(u), n.mockUserToken)) {
4409
4419
  let e, r;
4410
4420
  if ("string" == typeof n.mockUserToken) e = n.mockUserToken, r = User.MOCK_USER; else {
4411
4421
  // Let createMockUserToken validate first (catches common mistakes like
4412
4422
  // invalid field "uid" and missing field "sub" / "user_id".)
4413
- e = d(n.mockUserToken, null === (i = t._app) || void 0 === i ? void 0 : i.options.projectId);
4423
+ e = f(n.mockUserToken, null === (i = t._app) || void 0 === i ? void 0 : i.options.projectId);
4414
4424
  const s = n.mockUserToken.sub || n.mockUserToken.user_id;
4415
4425
  if (!s) throw new FirestoreError(p, "mockUserToken must contain 'sub' or 'user_id' field!");
4416
4426
  r = new User(s);
@@ -4626,7 +4636,7 @@ class AggregateField {
4626
4636
  }
4627
4637
 
4628
4638
  function collection(t, e, ...r) {
4629
- if (t = f(t), __PRIVATE_validateNonEmptyArgument("collection", "path", e), t instanceof Firestore) {
4639
+ if (t = E(t), __PRIVATE_validateNonEmptyArgument("collection", "path", e), t instanceof Firestore) {
4630
4640
  const n = ResourcePath.fromString(e, ...r);
4631
4641
  return __PRIVATE_validateCollectionPath(n), new CollectionReference(t, /* converter= */ null, n);
4632
4642
  }
@@ -4660,7 +4670,7 @@ function collection(t, e, ...r) {
4660
4670
  }
4661
4671
 
4662
4672
  function doc(t, e, ...r) {
4663
- if (t = f(t),
4673
+ if (t = E(t),
4664
4674
  // We allow omission of 'pathString' but explicitly prohibit passing in both
4665
4675
  // 'undefined' and 'null'.
4666
4676
  1 === arguments.length && (e = __PRIVATE_AutoId.newId()), __PRIVATE_validateNonEmptyArgument("doc", "path", e),
@@ -4684,7 +4694,7 @@ function doc(t, e, ...r) {
4684
4694
  * @returns true if the references point to the same location in the same
4685
4695
  * Firestore database.
4686
4696
  */ function refEqual(t, e) {
4687
- return t = f(t), e = f(e), (t instanceof DocumentReference || t instanceof CollectionReference) && (e instanceof DocumentReference || e instanceof CollectionReference) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
4697
+ return t = E(t), e = E(e), (t instanceof DocumentReference || t instanceof CollectionReference) && (e instanceof DocumentReference || e instanceof CollectionReference) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
4688
4698
  }
4689
4699
 
4690
4700
  /**
@@ -4696,7 +4706,7 @@ function doc(t, e, ...r) {
4696
4706
  * @returns true if the references point to the same location in the same
4697
4707
  * Firestore database.
4698
4708
  */ function queryEqual(t, e) {
4699
- return t = f(t), e = f(e), t instanceof Query && e instanceof Query && (t.firestore === e.firestore && __PRIVATE_queryEquals(t._query, e._query) && t.converter === e.converter);
4709
+ return t = E(t), e = E(e), t instanceof Query && e instanceof Query && (t.firestore === e.firestore && __PRIVATE_queryEquals(t._query, e._query) && t.converter === e.converter);
4700
4710
  }
4701
4711
 
4702
4712
  /**
@@ -4961,7 +4971,7 @@ function doc(t, e, ...r) {
4961
4971
  */
4962
4972
  /**
4963
4973
  * Represents a vector type in Firestore documents.
4964
- * Create an instance with {@link FieldValue.vector}.
4974
+ * Create an instance with <code>{@link vector}</code>.
4965
4975
  *
4966
4976
  * @class VectorValue
4967
4977
  */
@@ -4980,7 +4990,7 @@ class VectorValue {
4980
4990
  return this._values.map((t => t));
4981
4991
  }
4982
4992
  /**
4983
- * Returns `true` if the two VectorValue has the same raw number arrays, returns `false` otherwise.
4993
+ * Returns `true` if the two `VectorValue` values have the same raw number arrays, returns `false` otherwise.
4984
4994
  */ isEqual(t) {
4985
4995
  return function __PRIVATE_isPrimitiveArrayEqual(t, e) {
4986
4996
  if (t.length !== e.length) return !1;
@@ -5216,7 +5226,7 @@ class __PRIVATE_ArrayUnionFieldValueImpl extends FieldValue {
5216
5226
  return new FieldTransform(t.path, n);
5217
5227
  }
5218
5228
  isEqual(t) {
5219
- return t instanceof __PRIVATE_ArrayUnionFieldValueImpl && E(this.ft, t.ft);
5229
+ return t instanceof __PRIVATE_ArrayUnionFieldValueImpl && d(this.ft, t.ft);
5220
5230
  }
5221
5231
  }
5222
5232
 
@@ -5230,7 +5240,7 @@ class __PRIVATE_ArrayRemoveFieldValueImpl extends FieldValue {
5230
5240
  return new FieldTransform(t.path, n);
5231
5241
  }
5232
5242
  isEqual(t) {
5233
- return t instanceof __PRIVATE_ArrayRemoveFieldValueImpl && E(this.ft, t.ft);
5243
+ return t instanceof __PRIVATE_ArrayRemoveFieldValueImpl && d(this.ft, t.ft);
5234
5244
  }
5235
5245
  }
5236
5246
 
@@ -5255,7 +5265,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
5255
5265
  const a = __PRIVATE_fieldPathFromDotSeparatedString(e, t, r);
5256
5266
  // For Compat types, we have to "extract" the underlying types before
5257
5267
  // performing validation.
5258
- n = f(n);
5268
+ n = E(n);
5259
5269
  const u = i.ut(a);
5260
5270
  if (n instanceof __PRIVATE_DeleteFieldValueImpl)
5261
5271
  // Add it to the field mask, but don't add anything to updateData.
@@ -5281,7 +5291,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
5281
5291
  let r = u[t];
5282
5292
  // For Compat types, we have to "extract" the underlying types before
5283
5293
  // performing validation.
5284
- r = f(r);
5294
+ r = E(r);
5285
5295
  const n = o.ut(e);
5286
5296
  if (r instanceof __PRIVATE_DeleteFieldValueImpl)
5287
5297
  // Add it to the field mask, but don't add anything to updateData.
@@ -5316,7 +5326,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
5316
5326
  if (__PRIVATE_looksLikeJsonObject(
5317
5327
  // Unwrap the API type from the Compat SDK. This will return the API type
5318
5328
  // from firestore-exp.
5319
- t = f(t))) return __PRIVATE_validatePlainObject("Unsupported field value:", e, t),
5329
+ t = E(t))) return __PRIVATE_validatePlainObject("Unsupported field value:", e, t),
5320
5330
  __PRIVATE_parseObject(t, e);
5321
5331
  if (t instanceof FieldValue)
5322
5332
  // FieldValues usually parse into transforms (except deleteField())
@@ -5376,7 +5386,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
5376
5386
  }(t, e);
5377
5387
  }
5378
5388
  return function __PRIVATE_parseScalarValue(t, e) {
5379
- if (null === (t = f(t))) return {
5389
+ if (null === (t = E(t))) return {
5380
5390
  nullValue: "NULL_VALUE"
5381
5391
  };
5382
5392
  if ("number" == typeof t) return toNumber(e.serializer, t);
@@ -5489,7 +5499,7 @@ function __PRIVATE_validatePlainObject(t, e, r) {
5489
5499
  if ((
5490
5500
  // If required, replace the FieldPath Compat class with the firestore-exp
5491
5501
  // FieldPath.
5492
- e = f(e)) instanceof FieldPath) return e._internalPath;
5502
+ e = E(e)) instanceof FieldPath) return e._internalPath;
5493
5503
  if ("string" == typeof e) return __PRIVATE_fieldPathFromDotSeparatedString(t, e);
5494
5504
  throw __PRIVATE_createError("Field path arguments must be of type string or ", t,
5495
5505
  /* hasConverter= */ !1,
@@ -5680,7 +5690,7 @@ function __PRIVATE_createError(t, e, r, n, i) {
5680
5690
  * @param right - A snapshot to compare.
5681
5691
  * @returns true if the snapshots are equal.
5682
5692
  */ function snapshotEqual(t, e) {
5683
- return t = f(t), e = f(e), t instanceof DocumentSnapshot && e instanceof DocumentSnapshot ? 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 QuerySnapshot && e instanceof QuerySnapshot && (queryEqual(t.query, e.query) && __PRIVATE_arrayEquals(t.docs, e.docs, snapshotEqual));
5693
+ return t = E(t), e = E(e), t instanceof DocumentSnapshot && e instanceof DocumentSnapshot ? 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 QuerySnapshot && e instanceof QuerySnapshot && (queryEqual(t.query, e.query) && __PRIVATE_arrayEquals(t.docs, e.docs, snapshotEqual));
5684
5694
  }
5685
5695
 
5686
5696
  /**
@@ -6067,7 +6077,7 @@ function endAt(...t) {
6067
6077
  }
6068
6078
 
6069
6079
  /** Helper function to create a bound from a document or fields */ function __PRIVATE_newQueryBoundFromDocOrFields(t, e, r, n) {
6070
- if (r[0] = f(r[0]), r[0] instanceof DocumentSnapshot) return function __PRIVATE_newQueryBoundFromDocument(t, e, r, n, i) {
6080
+ if (r[0] = E(r[0]), r[0] instanceof DocumentSnapshot) return function __PRIVATE_newQueryBoundFromDocument(t, e, r, n, i) {
6071
6081
  if (!n) throw new FirestoreError(w, `Can't use a DocumentSnapshot that doesn't exist for ${r}().`);
6072
6082
  const s = [];
6073
6083
  // Because people expect to continue/end a query at the exact document
@@ -6123,7 +6133,7 @@ function endAt(...t) {
6123
6133
  }
6124
6134
 
6125
6135
  function __PRIVATE_parseDocumentIdValue(t, e, r) {
6126
- if ("string" == typeof (r = f(r))) {
6136
+ if ("string" == typeof (r = E(r))) {
6127
6137
  if ("" === r) throw new FirestoreError(p, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
6128
6138
  if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== r.indexOf("/")) throw new FirestoreError(p, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${r}' contains a '/' character.`);
6129
6139
  const n = e.path.child(ResourcePath.fromString(r));
@@ -6377,7 +6387,7 @@ function updateDoc(t, e, r, ...n) {
6377
6387
  // For Compat types, we have to "extract" the underlying types before
6378
6388
  // performing validation.
6379
6389
  let s;
6380
- s = "string" == typeof (e = f(e)) || e instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(i, "updateDoc", t._key, e, r, n) : __PRIVATE_parseUpdateData(i, "updateDoc", t._key, e);
6390
+ s = "string" == typeof (e = E(e)) || e instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(i, "updateDoc", t._key, e, r, n) : __PRIVATE_parseUpdateData(i, "updateDoc", t._key, e);
6381
6391
  return __PRIVATE_invokeCommitRpc(__PRIVATE_getDatastore(t.firestore), [ s.toMutation(t._key, Precondition.exists(!0)) ]);
6382
6392
  }
6383
6393
 
@@ -6534,7 +6544,7 @@ function sum(t) {
6534
6544
  * @returns `true` if the objects are "equal", as defined above, or `false`
6535
6545
  * otherwise.
6536
6546
  */ function aggregateQuerySnapshotEqual(t, e) {
6537
- return queryEqual(t.query, e.query) && E(t.data(), e.data());
6547
+ return queryEqual(t.query, e.query) && d(t.data(), e.data());
6538
6548
  }
6539
6549
 
6540
6550
  /**
@@ -6672,7 +6682,7 @@ function sum(t) {
6672
6682
  // For Compat types, we have to "extract" the underlying types before
6673
6683
  // performing validation.
6674
6684
  let s;
6675
- return s = "string" == typeof (e = f(e)) || e instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(this._dataReader, "WriteBatch.update", i._key, e, r, n) : __PRIVATE_parseUpdateData(this._dataReader, "WriteBatch.update", i._key, e),
6685
+ return s = "string" == typeof (e = E(e)) || e instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(this._dataReader, "WriteBatch.update", i._key, e, r, n) : __PRIVATE_parseUpdateData(this._dataReader, "WriteBatch.update", i._key, e),
6676
6686
  this._mutations.push(s.toMutation(i._key, Precondition.exists(!0))), this;
6677
6687
  }
6678
6688
  /**
@@ -6706,7 +6716,7 @@ function sum(t) {
6706
6716
  }
6707
6717
 
6708
6718
  function __PRIVATE_validateReference(t, e) {
6709
- if ((t = f(t)).firestore !== e) throw new FirestoreError(p, "Provided document reference is from a different Firestore instance.");
6719
+ if ((t = E(t)).firestore !== e) throw new FirestoreError(p, "Provided document reference is from a different Firestore instance.");
6710
6720
  return t;
6711
6721
  }
6712
6722
 
@@ -7352,7 +7362,7 @@ class Transaction {
7352
7362
  // For Compat types, we have to "extract" the underlying types before
7353
7363
  // performing validation.
7354
7364
  let s;
7355
- return s = "string" == typeof (e = f(e)) || e instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(this._dataReader, "Transaction.update", i._key, e, r, n) : __PRIVATE_parseUpdateData(this._dataReader, "Transaction.update", i._key, e),
7365
+ return s = "string" == typeof (e = E(e)) || e instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(this._dataReader, "Transaction.update", i._key, e, r, n) : __PRIVATE_parseUpdateData(this._dataReader, "Transaction.update", i._key, e),
7356
7366
  this._transaction.update(i._key, s), this;
7357
7367
  }
7358
7368
  /**