@firebase/firestore 1.14.0-canary.daf63c2c → 1.14.0

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.
@@ -10424,9 +10424,6 @@ class MemoryPersistence {
10424
10424
  this.indexManager = new MemoryIndexManager();
10425
10425
  this.remoteDocumentCache = new MemoryRemoteDocumentCache(this.indexManager, sizer);
10426
10426
  }
10427
- start() {
10428
- return Promise.resolve();
10429
- }
10430
10427
  shutdown() {
10431
10428
  // No durable state to ensure is closed on shutdown.
10432
10429
  this._started = false;
@@ -10598,61 +10595,28 @@ const MEMORY_ONLY_PERSISTENCE_ERROR_MESSAGE = 'You are using the memory-only bui
10598
10595
  'firebase-firestore.js build.';
10599
10596
  /**
10600
10597
  * Provides all components needed for Firestore with in-memory persistence.
10601
- * Uses EagerGC garbage collection.
10602
10598
  */
10603
10599
  class MemoryComponentProvider {
10604
- async initialize(cfg) {
10605
- this.sharedClientState = this.createSharedClientState(cfg);
10606
- this.persistence = this.createPersistence(cfg);
10607
- await this.persistence.start();
10608
- this.gcScheduler = this.createGarbageCollectionScheduler(cfg);
10609
- this.localStore = this.createLocalStore(cfg);
10610
- this.remoteStore = this.createRemoteStore(cfg);
10611
- this.syncEngine = this.createSyncEngine(cfg);
10612
- this.eventManager = this.createEventManager(cfg);
10613
- this.sharedClientState.onlineStateHandler = onlineState => this.syncEngine.applyOnlineStateChange(onlineState, 1 /* SharedClientState */);
10600
+ constructor(referenceDelegateFactory = MemoryEagerDelegate.factory) {
10601
+ this.referenceDelegateFactory = referenceDelegateFactory;
10602
+ }
10603
+ async initialize(asyncQueue, databaseInfo, platform, datastore, clientId, initialUser, maxConcurrentLimboResolutions, persistenceSettings) {
10604
+ if (persistenceSettings.durable) {
10605
+ throw new FirestoreError(Code.FAILED_PRECONDITION, MEMORY_ONLY_PERSISTENCE_ERROR_MESSAGE);
10606
+ }
10607
+ this.persistence = new MemoryPersistence(clientId, this.referenceDelegateFactory);
10608
+ this.gcScheduler = null;
10609
+ this.sharedClientState = new MemorySharedClientState();
10610
+ this.localStore = new LocalStore(this.persistence, new IndexFreeQueryEngine(), initialUser);
10611
+ this.remoteStore = new RemoteStore(this.localStore, datastore, asyncQueue, onlineState => this.syncEngine.applyOnlineStateChange(onlineState, 0 /* RemoteStore */), platform.newConnectivityMonitor());
10612
+ this.syncEngine = new SyncEngine(this.localStore, this.remoteStore, this.sharedClientState, initialUser, maxConcurrentLimboResolutions);
10613
+ this.eventManager = new EventManager(this.syncEngine);
10614
10614
  this.remoteStore.syncEngine = this.syncEngine;
10615
- this.sharedClientState.syncEngine = this.syncEngine;
10616
- await this.sharedClientState.start();
10617
10615
  await this.remoteStore.start();
10618
- await this.localStore.start();
10619
- // NOTE: This will immediately call the listener, so we make sure to
10620
- // set it after localStore / remoteStore are started.
10621
- await this.persistence.setPrimaryStateListener(async (isPrimary) => {
10622
- await this.syncEngine.applyPrimaryState(isPrimary);
10623
- if (this.gcScheduler) {
10624
- if (isPrimary && !this.gcScheduler.started) {
10625
- this.gcScheduler.start(this.localStore);
10626
- }
10627
- else if (!isPrimary) {
10628
- this.gcScheduler.stop();
10629
- }
10630
- }
10631
- });
10632
- }
10633
- createEventManager(cfg) {
10634
- return new EventManager(this.syncEngine);
10616
+ await this.remoteStore.applyPrimaryState(true);
10617
+ await this.syncEngine.applyPrimaryState(true);
10635
10618
  }
10636
- createGarbageCollectionScheduler(cfg) {
10637
- return null;
10638
- }
10639
- createLocalStore(cfg) {
10640
- return new LocalStore(this.persistence, new IndexFreeQueryEngine(), cfg.initialUser);
10641
- }
10642
- createPersistence(cfg) {
10643
- debugAssert(!cfg.persistenceSettings.durable, 'Can only start memory persistence');
10644
- return new MemoryPersistence(cfg.clientId, MemoryEagerDelegate.factory);
10645
- }
10646
- createRemoteStore(cfg) {
10647
- return new RemoteStore(this.localStore, cfg.datastore, cfg.asyncQueue, onlineState => this.syncEngine.applyOnlineStateChange(onlineState, 0 /* RemoteStore */), cfg.platform.newConnectivityMonitor());
10648
- }
10649
- createSharedClientState(cfg) {
10650
- return new MemorySharedClientState();
10651
- }
10652
- createSyncEngine(cfg) {
10653
- return new SyncEngine(this.localStore, this.remoteStore, this.sharedClientState, cfg.initialUser, cfg.maxConcurrentLimboResolutions);
10654
- }
10655
- clearPersistence(databaseInfo) {
10619
+ clearPersistence() {
10656
10620
  throw new FirestoreError(Code.FAILED_PRECONDITION, MEMORY_ONLY_PERSISTENCE_ERROR_MESSAGE);
10657
10621
  }
10658
10622
  }
@@ -11357,16 +11321,7 @@ class FirestoreClient {
11357
11321
  const connection = await this.platform.loadConnection(this.databaseInfo);
11358
11322
  const serializer = this.platform.newSerializer(this.databaseInfo.databaseId);
11359
11323
  const datastore = new Datastore(this.asyncQueue, connection, this.credentials, serializer);
11360
- await componentProvider.initialize({
11361
- asyncQueue: this.asyncQueue,
11362
- databaseInfo: this.databaseInfo,
11363
- platform: this.platform,
11364
- datastore,
11365
- clientId: this.clientId,
11366
- initialUser: user,
11367
- maxConcurrentLimboResolutions: MAX_CONCURRENT_LIMBO_RESOLUTIONS,
11368
- persistenceSettings
11369
- });
11324
+ await componentProvider.initialize(this.asyncQueue, this.databaseInfo, this.platform, datastore, this.clientId, user, MAX_CONCURRENT_LIMBO_RESOLUTIONS, persistenceSettings);
11370
11325
  this.persistence = componentProvider.persistence;
11371
11326
  this.sharedClientState = componentProvider.sharedClientState;
11372
11327
  this.localStore = componentProvider.localStore;
@@ -16514,7 +16469,7 @@ class NodePlatform {
16514
16469
  PlatformSupport.setPlatform(new NodePlatform());
16515
16470
 
16516
16471
  var name = "@firebase/firestore";
16517
- var version = "1.14.0-canary.daf63c2c";
16472
+ var version = "1.14.0";
16518
16473
 
16519
16474
  /**
16520
16475
  * @license