@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.
@@ -11257,9 +11257,6 @@ var MemoryPersistence = /** @class */ (function () {
11257
11257
  this.indexManager = new MemoryIndexManager();
11258
11258
  this.remoteDocumentCache = new MemoryRemoteDocumentCache(this.indexManager, sizer);
11259
11259
  }
11260
- MemoryPersistence.prototype.start = function () {
11261
- return Promise.resolve();
11262
- };
11263
11260
  MemoryPersistence.prototype.shutdown = function () {
11264
11261
  // No durable state to ensure is closed on shutdown.
11265
11262
  this._started = false;
@@ -11452,92 +11449,44 @@ var MEMORY_ONLY_PERSISTENCE_ERROR_MESSAGE = 'You are using the memory-only build
11452
11449
  'firebase-firestore.js build.';
11453
11450
  /**
11454
11451
  * Provides all components needed for Firestore with in-memory persistence.
11455
- * Uses EagerGC garbage collection.
11456
11452
  */
11457
11453
  var MemoryComponentProvider = /** @class */ (function () {
11458
- function MemoryComponentProvider() {
11454
+ function MemoryComponentProvider(referenceDelegateFactory) {
11455
+ if (referenceDelegateFactory === void 0) { referenceDelegateFactory = MemoryEagerDelegate.factory; }
11456
+ this.referenceDelegateFactory = referenceDelegateFactory;
11459
11457
  }
11460
- MemoryComponentProvider.prototype.initialize = function (cfg) {
11458
+ MemoryComponentProvider.prototype.initialize = function (asyncQueue, databaseInfo, platform, datastore, clientId, initialUser, maxConcurrentLimboResolutions, persistenceSettings) {
11461
11459
  return tslib.__awaiter(this, void 0, void 0, function () {
11462
11460
  var _this = this;
11463
11461
  return tslib.__generator(this, function (_c) {
11464
11462
  switch (_c.label) {
11465
11463
  case 0:
11466
- this.sharedClientState = this.createSharedClientState(cfg);
11467
- this.persistence = this.createPersistence(cfg);
11468
- return [4 /*yield*/, this.persistence.start()];
11464
+ if (persistenceSettings.durable) {
11465
+ throw new FirestoreError(Code.FAILED_PRECONDITION, MEMORY_ONLY_PERSISTENCE_ERROR_MESSAGE);
11466
+ }
11467
+ this.persistence = new MemoryPersistence(clientId, this.referenceDelegateFactory);
11468
+ this.gcScheduler = null;
11469
+ this.sharedClientState = new MemorySharedClientState();
11470
+ this.localStore = new LocalStore(this.persistence, new IndexFreeQueryEngine(), initialUser);
11471
+ this.remoteStore = new RemoteStore(this.localStore, datastore, asyncQueue, function (onlineState) { return _this.syncEngine.applyOnlineStateChange(onlineState, 0 /* RemoteStore */); }, platform.newConnectivityMonitor());
11472
+ this.syncEngine = new SyncEngine(this.localStore, this.remoteStore, this.sharedClientState, initialUser, maxConcurrentLimboResolutions);
11473
+ this.eventManager = new EventManager(this.syncEngine);
11474
+ this.remoteStore.syncEngine = this.syncEngine;
11475
+ return [4 /*yield*/, this.remoteStore.start()];
11469
11476
  case 1:
11470
11477
  _c.sent();
11471
- this.gcScheduler = this.createGarbageCollectionScheduler(cfg);
11472
- this.localStore = this.createLocalStore(cfg);
11473
- this.remoteStore = this.createRemoteStore(cfg);
11474
- this.syncEngine = this.createSyncEngine(cfg);
11475
- this.eventManager = this.createEventManager(cfg);
11476
- this.sharedClientState.onlineStateHandler = function (onlineState) { return _this.syncEngine.applyOnlineStateChange(onlineState, 1 /* SharedClientState */); };
11477
- this.remoteStore.syncEngine = this.syncEngine;
11478
- this.sharedClientState.syncEngine = this.syncEngine;
11479
- return [4 /*yield*/, this.sharedClientState.start()];
11478
+ return [4 /*yield*/, this.remoteStore.applyPrimaryState(true)];
11480
11479
  case 2:
11481
11480
  _c.sent();
11482
- return [4 /*yield*/, this.remoteStore.start()];
11481
+ return [4 /*yield*/, this.syncEngine.applyPrimaryState(true)];
11483
11482
  case 3:
11484
- _c.sent();
11485
- return [4 /*yield*/, this.localStore.start()];
11486
- case 4:
11487
- _c.sent();
11488
- // NOTE: This will immediately call the listener, so we make sure to
11489
- // set it after localStore / remoteStore are started.
11490
- return [4 /*yield*/, this.persistence.setPrimaryStateListener(function (isPrimary) { return tslib.__awaiter(_this, void 0, void 0, function () {
11491
- return tslib.__generator(this, function (_c) {
11492
- switch (_c.label) {
11493
- case 0: return [4 /*yield*/, this.syncEngine.applyPrimaryState(isPrimary)];
11494
- case 1:
11495
- _c.sent();
11496
- if (this.gcScheduler) {
11497
- if (isPrimary && !this.gcScheduler.started) {
11498
- this.gcScheduler.start(this.localStore);
11499
- }
11500
- else if (!isPrimary) {
11501
- this.gcScheduler.stop();
11502
- }
11503
- }
11504
- return [2 /*return*/];
11505
- }
11506
- });
11507
- }); })];
11508
- case 5:
11509
- // NOTE: This will immediately call the listener, so we make sure to
11510
- // set it after localStore / remoteStore are started.
11511
11483
  _c.sent();
11512
11484
  return [2 /*return*/];
11513
11485
  }
11514
11486
  });
11515
11487
  });
11516
11488
  };
11517
- MemoryComponentProvider.prototype.createEventManager = function (cfg) {
11518
- return new EventManager(this.syncEngine);
11519
- };
11520
- MemoryComponentProvider.prototype.createGarbageCollectionScheduler = function (cfg) {
11521
- return null;
11522
- };
11523
- MemoryComponentProvider.prototype.createLocalStore = function (cfg) {
11524
- return new LocalStore(this.persistence, new IndexFreeQueryEngine(), cfg.initialUser);
11525
- };
11526
- MemoryComponentProvider.prototype.createPersistence = function (cfg) {
11527
- debugAssert(!cfg.persistenceSettings.durable, 'Can only start memory persistence');
11528
- return new MemoryPersistence(cfg.clientId, MemoryEagerDelegate.factory);
11529
- };
11530
- MemoryComponentProvider.prototype.createRemoteStore = function (cfg) {
11531
- var _this = this;
11532
- return new RemoteStore(this.localStore, cfg.datastore, cfg.asyncQueue, function (onlineState) { return _this.syncEngine.applyOnlineStateChange(onlineState, 0 /* RemoteStore */); }, cfg.platform.newConnectivityMonitor());
11533
- };
11534
- MemoryComponentProvider.prototype.createSharedClientState = function (cfg) {
11535
- return new MemorySharedClientState();
11536
- };
11537
- MemoryComponentProvider.prototype.createSyncEngine = function (cfg) {
11538
- return new SyncEngine(this.localStore, this.remoteStore, this.sharedClientState, cfg.initialUser, cfg.maxConcurrentLimboResolutions);
11539
- };
11540
- MemoryComponentProvider.prototype.clearPersistence = function (databaseInfo) {
11489
+ MemoryComponentProvider.prototype.clearPersistence = function () {
11541
11490
  throw new FirestoreError(Code.FAILED_PRECONDITION, MEMORY_ONLY_PERSISTENCE_ERROR_MESSAGE);
11542
11491
  };
11543
11492
  return MemoryComponentProvider;
@@ -12298,16 +12247,7 @@ var FirestoreClient = /** @class */ (function () {
12298
12247
  connection = _c.sent();
12299
12248
  serializer = this.platform.newSerializer(this.databaseInfo.databaseId);
12300
12249
  datastore = new Datastore(this.asyncQueue, connection, this.credentials, serializer);
12301
- return [4 /*yield*/, componentProvider.initialize({
12302
- asyncQueue: this.asyncQueue,
12303
- databaseInfo: this.databaseInfo,
12304
- platform: this.platform,
12305
- datastore: datastore,
12306
- clientId: this.clientId,
12307
- initialUser: user,
12308
- maxConcurrentLimboResolutions: MAX_CONCURRENT_LIMBO_RESOLUTIONS,
12309
- persistenceSettings: persistenceSettings
12310
- })];
12250
+ return [4 /*yield*/, componentProvider.initialize(this.asyncQueue, this.databaseInfo, this.platform, datastore, this.clientId, user, MAX_CONCURRENT_LIMBO_RESOLUTIONS, persistenceSettings)];
12311
12251
  case 2:
12312
12252
  _c.sent();
12313
12253
  this.persistence = componentProvider.persistence;
@@ -17767,7 +17707,7 @@ var NodePlatform = /** @class */ (function () {
17767
17707
  */
17768
17708
  PlatformSupport.setPlatform(new NodePlatform());
17769
17709
  var name = "@firebase/firestore";
17770
- var version = "1.14.0-canary.daf63c2c";
17710
+ var version = "1.14.0";
17771
17711
  /**
17772
17712
  * @license
17773
17713
  * Copyright 2020 Google LLC