@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
@@ -1866,6 +1866,7 @@ declare class Firestore_2 implements FirestoreService {
1866
1866
  readonly _persistenceKey: string;
1867
1867
  private _settings;
1868
1868
  private _settingsFrozen;
1869
+ private _emulatorOptions;
1869
1870
  private _terminateTask;
1870
1871
  /** @hideconstructor */
1871
1872
  constructor(_authCredentials: CredentialsProvider<User>, _appCheckCredentials: CredentialsProvider<string>, _databaseId: _DatabaseId, _app?: FirebaseApp | undefined);
@@ -1878,6 +1879,9 @@ declare class Firestore_2 implements FirestoreService {
1878
1879
  get _terminated(): boolean;
1879
1880
  _setSettings(settings: PrivateSettings): void;
1880
1881
  _getSettings(): FirestoreSettingsImpl;
1882
+ _getEmulatorOptions(): {
1883
+ mockUserToken?: EmulatorMockTokenOptions | string;
1884
+ };
1881
1885
  _freezeSettings(): FirestoreSettingsImpl;
1882
1886
  _delete(): Promise<void>;
1883
1887
  _restart(): Promise<void>;
@@ -5299,6 +5303,9 @@ export declare interface PrivateSettings extends FirestoreSettings_2 {
5299
5303
  experimentalAutoDetectLongPolling?: boolean;
5300
5304
  experimentalLongPollingOptions?: ExperimentalLongPollingOptions;
5301
5305
  useFetchStreams?: boolean;
5306
+ emulatorOptions?: {
5307
+ mockUserToken?: EmulatorMockTokenOptions | string;
5308
+ };
5302
5309
  localCache?: FirestoreLocalCache;
5303
5310
  }
5304
5311
 
@@ -7519,7 +7526,7 @@ export declare function vector(values?: number[]): VectorValue;
7519
7526
  */
7520
7527
  /**
7521
7528
  * Represents a vector type in Firestore documents.
7522
- * Create an instance with {@link FieldValue.vector}.
7529
+ * Create an instance with <code>{@link vector}</code>.
7523
7530
  *
7524
7531
  * @class VectorValue
7525
7532
  */
@@ -7535,7 +7542,7 @@ export declare class VectorValue {
7535
7542
  */
7536
7543
  toArray(): number[];
7537
7544
  /**
7538
- * Returns `true` if the two VectorValue has the same raw number arrays, returns `false` otherwise.
7545
+ * Returns `true` if the two `VectorValue` values have the same raw number arrays, returns `false` otherwise.
7539
7546
  */
7540
7547
  isEqual(other: VectorValue): boolean;
7541
7548
  }
@@ -44,6 +44,7 @@ export declare class Firestore implements FirestoreService {
44
44
  readonly _persistenceKey: string;
45
45
  private _settings;
46
46
  private _settingsFrozen;
47
+ private _emulatorOptions;
47
48
  private _terminateTask;
48
49
  /** @hideconstructor */
49
50
  constructor(_authCredentials: CredentialsProvider<User>, _appCheckCredentials: CredentialsProvider<string>, _databaseId: DatabaseId, _app?: FirebaseApp | undefined);
@@ -56,6 +57,9 @@ export declare class Firestore implements FirestoreService {
56
57
  get _terminated(): boolean;
57
58
  _setSettings(settings: PrivateSettings): void;
58
59
  _getSettings(): FirestoreSettingsImpl;
60
+ _getEmulatorOptions(): {
61
+ mockUserToken?: EmulatorMockTokenOptions | string;
62
+ };
59
63
  _freezeSettings(): FirestoreSettingsImpl;
60
64
  _delete(): Promise<void>;
61
65
  _restart(): Promise<void>;
@@ -14,6 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ import { EmulatorMockTokenOptions } from '@firebase/util';
17
18
  import { FirestoreLocalCache } from '../api/cache_config';
18
19
  import { CredentialsSettings } from '../api/credentials';
19
20
  import { ExperimentalLongPollingOptions } from '../api/long_polling_options';
@@ -47,6 +48,9 @@ export interface PrivateSettings extends FirestoreSettings {
47
48
  experimentalAutoDetectLongPolling?: boolean;
48
49
  experimentalLongPollingOptions?: ExperimentalLongPollingOptions;
49
50
  useFetchStreams?: boolean;
51
+ emulatorOptions?: {
52
+ mockUserToken?: EmulatorMockTokenOptions | string;
53
+ };
50
54
  localCache?: FirestoreLocalCache;
51
55
  }
52
56
  /**
@@ -16,7 +16,7 @@
16
16
  */
17
17
  /**
18
18
  * Represents a vector type in Firestore documents.
19
- * Create an instance with {@link FieldValue.vector}.
19
+ * Create an instance with <code>{@link vector}</code>.
20
20
  *
21
21
  * @class VectorValue
22
22
  */
@@ -32,7 +32,7 @@ export declare class VectorValue {
32
32
  */
33
33
  toArray(): number[];
34
34
  /**
35
- * Returns `true` if the two VectorValue has the same raw number arrays, returns `false` otherwise.
35
+ * Returns `true` if the two `VectorValue` values have the same raw number arrays, returns `false` otherwise.
36
36
  */
37
37
  isEqual(other: VectorValue): boolean;
38
38
  }
@@ -18,6 +18,7 @@ import { PrivateSettings } from './firebase_export';
18
18
  export declare const TARGET_DB_ID: string | '(default)';
19
19
  export declare const USE_EMULATOR: boolean;
20
20
  export declare const DEFAULT_SETTINGS: PrivateSettings;
21
+ export declare function getEmulatorPort(): number;
21
22
  export declare const DEFAULT_PROJECT_ID: any;
22
23
  export declare const ALT_PROJECT_ID = "test-db2";
23
24
  export declare const COMPOSITE_INDEX_TEST_COLLECTION = "composite-index-test-collection";
@@ -1,10 +1,10 @@
1
1
  import { _registerComponent, registerVersion, _isFirebaseServerApp, _getProvider, getApp, _removeServiceInstance, SDK_VERSION } from '@firebase/app';
2
2
  import { Component } from '@firebase/component';
3
3
  import { Logger, LogLevel } from '@firebase/logger';
4
- import { FirebaseError, getDefaultEmulatorHostnameAndPort, createMockUserToken, getModularInstance, deepEqual } from '@firebase/util';
4
+ import { FirebaseError, getDefaultEmulatorHostnameAndPort, deepEqual, createMockUserToken, getModularInstance } from '@firebase/util';
5
5
  import { Integer } from '@firebase/webchannel-wrapper/bloom-blob';
6
6
 
7
- const E = "4.7.8";
7
+ const E = "4.7.9";
8
8
 
9
9
  /**
10
10
  * @license
@@ -65,7 +65,7 @@ User.MOCK_USER = new User("mock-user");
65
65
  * See the License for the specific language governing permissions and
66
66
  * limitations under the License.
67
67
  */
68
- let m = "11.3.1";
68
+ let m = "11.4.0";
69
69
 
70
70
  /**
71
71
  * @license
@@ -4278,7 +4278,7 @@ class Firestore {
4278
4278
  * Whether it's a Firestore or Firestore Lite instance.
4279
4279
  */
4280
4280
  this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new FirestoreSettingsImpl({}),
4281
- this._settingsFrozen = !1,
4281
+ this._settingsFrozen = !1, this._emulatorOptions = {},
4282
4282
  // A task that is assigned when the terminate() is invoked and resolved when
4283
4283
  // all components have shut down. Otherwise, Firestore is not terminated,
4284
4284
  // which can mean either the FirestoreClient is in the process of starting,
@@ -4300,7 +4300,8 @@ class Firestore {
4300
4300
  }
4301
4301
  _setSettings(t) {
4302
4302
  if (this._settingsFrozen) throw new FirestoreError(v, "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.");
4303
- this._settings = new FirestoreSettingsImpl(t), void 0 !== t.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(t) {
4303
+ this._settings = new FirestoreSettingsImpl(t), this._emulatorOptions = t.emulatorOptions || {},
4304
+ void 0 !== t.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(t) {
4304
4305
  if (!t) return new __PRIVATE_EmptyAuthCredentialsProvider;
4305
4306
  switch (t.type) {
4306
4307
  case "firstParty":
@@ -4317,6 +4318,9 @@ class Firestore {
4317
4318
  _getSettings() {
4318
4319
  return this._settings;
4319
4320
  }
4321
+ _getEmulatorOptions() {
4322
+ return this._emulatorOptions;
4323
+ }
4320
4324
  _freezeSettings() {
4321
4325
  return this._settingsFrozen = !0, this._settings;
4322
4326
  }
@@ -4388,12 +4392,18 @@ function getFirestore(t, r) {
4388
4392
  * Security Rules.
4389
4393
  */ function connectFirestoreEmulator(t, e, r, n = {}) {
4390
4394
  var i;
4391
- const s = (t = __PRIVATE_cast(t, Firestore))._getSettings(), o = `${e}:${r}`;
4392
- if (s.host !== nt && s.host !== o && __PRIVATE_logWarn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),
4393
- t._setSettings(Object.assign(Object.assign({}, s), {
4394
- host: o,
4395
- ssl: !1
4396
- })), n.mockUserToken) {
4395
+ const s = (t = __PRIVATE_cast(t, Firestore))._getSettings(), o = Object.assign(Object.assign({}, s), {
4396
+ emulatorOptions: t._getEmulatorOptions()
4397
+ }), a = `${e}:${r}`;
4398
+ s.host !== nt && s.host !== a && __PRIVATE_logWarn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");
4399
+ const u = Object.assign(Object.assign({}, s), {
4400
+ host: a,
4401
+ ssl: !1,
4402
+ emulatorOptions: n
4403
+ });
4404
+ // No-op if the new configuration matches the current configuration. This supports SSR
4405
+ // enviornments which might call `connectFirestoreEmulator` multiple times as a standard practice.
4406
+ if (!deepEqual(u, o) && (t._setSettings(u), n.mockUserToken)) {
4397
4407
  let e, r;
4398
4408
  if ("string" == typeof n.mockUserToken) e = n.mockUserToken, r = User.MOCK_USER; else {
4399
4409
  // Let createMockUserToken validate first (catches common mistakes like
@@ -4949,7 +4959,7 @@ function doc(t, e, ...r) {
4949
4959
  */
4950
4960
  /**
4951
4961
  * Represents a vector type in Firestore documents.
4952
- * Create an instance with {@link FieldValue.vector}.
4962
+ * Create an instance with <code>{@link vector}</code>.
4953
4963
  *
4954
4964
  * @class VectorValue
4955
4965
  */
@@ -4968,7 +4978,7 @@ class VectorValue {
4968
4978
  return this._values.map((t => t));
4969
4979
  }
4970
4980
  /**
4971
- * Returns `true` if the two VectorValue has the same raw number arrays, returns `false` otherwise.
4981
+ * Returns `true` if the two `VectorValue` values have the same raw number arrays, returns `false` otherwise.
4972
4982
  */ isEqual(t) {
4973
4983
  return function __PRIVATE_isPrimitiveArrayEqual(t, e) {
4974
4984
  if (t.length !== e.length) return !1;