@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.
- package/dist/dist/index.esm2017.d.ts +2 -2
- package/dist/dist/index.memory.esm2017.d.ts +2 -2
- package/dist/index.cjs.js +872 -874
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +933 -935
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm2017.js +746 -780
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.memory.cjs.js +604 -651
- package/dist/index.memory.cjs.js.map +1 -1
- package/dist/index.memory.esm.js +882 -929
- package/dist/index.memory.esm.js.map +1 -1
- package/dist/index.memory.esm2017.js +387 -422
- package/dist/index.memory.esm2017.js.map +1 -1
- package/dist/index.memory.node.cjs.js +21 -81
- package/dist/index.memory.node.cjs.js.map +1 -1
- package/dist/index.memory.node.esm2017.js +19 -64
- package/dist/index.memory.node.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +110 -117
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.esm2017.js +66 -96
- package/dist/index.node.esm2017.js.map +1 -1
- package/dist/lib/src/core/component_provider.d.ts +19 -35
- package/dist/lib/src/local/indexeddb_persistence.d.ts +2 -2
- package/dist/lib/src/local/memory_persistence.d.ts +0 -1
- package/dist/lib/src/local/persistence.d.ts +0 -2
- package/dist/src/core/component_provider.d.ts +19 -35
- package/dist/src/local/indexeddb_persistence.d.ts +2 -2
- package/dist/src/local/memory_persistence.d.ts +0 -1
- package/dist/src/local/persistence.d.ts +0 -2
- package/package.json +12 -12
package/dist/index.node.cjs.js
CHANGED
|
@@ -14670,11 +14670,22 @@ var IndexedDbPersistence = /** @class */ (function () {
|
|
|
14670
14670
|
}
|
|
14671
14671
|
};
|
|
14672
14672
|
IndexedDbPersistence.createIndexedDbPersistence = function (options) {
|
|
14673
|
-
|
|
14674
|
-
|
|
14675
|
-
|
|
14676
|
-
|
|
14677
|
-
|
|
14673
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
14674
|
+
var persistence;
|
|
14675
|
+
return tslib.__generator(this, function (_c) {
|
|
14676
|
+
switch (_c.label) {
|
|
14677
|
+
case 0:
|
|
14678
|
+
if (!IndexedDbPersistence.isAvailable()) {
|
|
14679
|
+
throw new FirestoreError(Code.UNIMPLEMENTED, UNSUPPORTED_PLATFORM_ERROR_MSG);
|
|
14680
|
+
}
|
|
14681
|
+
persistence = new IndexedDbPersistence(options.allowTabSynchronization, options.persistenceKey, options.clientId, options.platform, options.lruParams, options.queue, options.serializer, options.sequenceNumberSyncer);
|
|
14682
|
+
return [4 /*yield*/, persistence.start()];
|
|
14683
|
+
case 1:
|
|
14684
|
+
_c.sent();
|
|
14685
|
+
return [2 /*return*/, persistence];
|
|
14686
|
+
}
|
|
14687
|
+
});
|
|
14688
|
+
});
|
|
14678
14689
|
};
|
|
14679
14690
|
/**
|
|
14680
14691
|
* Attempt to start IndexedDb persistence.
|
|
@@ -16031,9 +16042,6 @@ var MemoryPersistence = /** @class */ (function () {
|
|
|
16031
16042
|
this.indexManager = new MemoryIndexManager();
|
|
16032
16043
|
this.remoteDocumentCache = new MemoryRemoteDocumentCache(this.indexManager, sizer);
|
|
16033
16044
|
}
|
|
16034
|
-
MemoryPersistence.prototype.start = function () {
|
|
16035
|
-
return Promise.resolve();
|
|
16036
|
-
};
|
|
16037
16045
|
MemoryPersistence.prototype.shutdown = function () {
|
|
16038
16046
|
// No durable state to ensure is closed on shutdown.
|
|
16039
16047
|
this._started = false;
|
|
@@ -16221,44 +16229,61 @@ var MemoryEagerDelegate = /** @class */ (function () {
|
|
|
16221
16229
|
* See the License for the specific language governing permissions and
|
|
16222
16230
|
* limitations under the License.
|
|
16223
16231
|
*/
|
|
16224
|
-
var MEMORY_ONLY_PERSISTENCE_ERROR_MESSAGE = 'You are using the memory-only build of Firestore. Persistence support is ' +
|
|
16225
|
-
'only available via the @firebase/firestore bundle or the ' +
|
|
16226
|
-
'firebase-firestore.js build.';
|
|
16227
16232
|
/**
|
|
16228
|
-
* Provides all components needed for Firestore with
|
|
16229
|
-
* Uses EagerGC garbage collection.
|
|
16233
|
+
* Provides all components needed for Firestore with IndexedDB persistence.
|
|
16230
16234
|
*/
|
|
16231
|
-
var
|
|
16232
|
-
function
|
|
16235
|
+
var IndexedDbComponentProvider = /** @class */ (function () {
|
|
16236
|
+
function IndexedDbComponentProvider() {
|
|
16233
16237
|
}
|
|
16234
|
-
|
|
16238
|
+
IndexedDbComponentProvider.prototype.initialize = function (asyncQueue, databaseInfo, platform, datastore, clientId, initialUser, maxConcurrentLimboResolutions, persistenceSettings) {
|
|
16235
16239
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
16240
|
+
var persistenceKey, serializer, _c, garbageCollector;
|
|
16236
16241
|
var _this = this;
|
|
16237
|
-
return tslib.__generator(this, function (
|
|
16238
|
-
switch (
|
|
16242
|
+
return tslib.__generator(this, function (_d) {
|
|
16243
|
+
switch (_d.label) {
|
|
16239
16244
|
case 0:
|
|
16240
|
-
|
|
16241
|
-
this.
|
|
16242
|
-
|
|
16243
|
-
|
|
16244
|
-
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
this.
|
|
16248
|
-
|
|
16249
|
-
|
|
16245
|
+
debugAssert(persistenceSettings.durable, 'IndexedDbComponentProvider can only provide durable persistence');
|
|
16246
|
+
debugAssert(!this.sharedClientState, 'initialize() already called');
|
|
16247
|
+
persistenceKey = IndexedDbPersistence.buildStoragePrefix(databaseInfo);
|
|
16248
|
+
serializer = platform.newSerializer(databaseInfo.databaseId);
|
|
16249
|
+
if (!WebStorageSharedClientState.isAvailable(platform)) {
|
|
16250
|
+
throw new FirestoreError(Code.UNIMPLEMENTED, 'IndexedDB persistence is only available on platforms that support LocalStorage.');
|
|
16251
|
+
}
|
|
16252
|
+
this.sharedClientState = persistenceSettings.synchronizeTabs
|
|
16253
|
+
? new WebStorageSharedClientState(asyncQueue, platform, persistenceKey, clientId, initialUser)
|
|
16254
|
+
: new MemorySharedClientState();
|
|
16250
16255
|
this.sharedClientState.onlineStateHandler = function (onlineState) { return _this.syncEngine.applyOnlineStateChange(onlineState, 1 /* SharedClientState */); };
|
|
16256
|
+
_c = this;
|
|
16257
|
+
return [4 /*yield*/, IndexedDbPersistence.createIndexedDbPersistence({
|
|
16258
|
+
allowTabSynchronization: persistenceSettings.synchronizeTabs,
|
|
16259
|
+
persistenceKey: persistenceKey,
|
|
16260
|
+
clientId: clientId,
|
|
16261
|
+
platform: platform,
|
|
16262
|
+
queue: asyncQueue,
|
|
16263
|
+
serializer: serializer,
|
|
16264
|
+
lruParams: LruParams.withCacheSize(persistenceSettings.cacheSizeBytes),
|
|
16265
|
+
sequenceNumberSyncer: this.sharedClientState
|
|
16266
|
+
})];
|
|
16267
|
+
case 1:
|
|
16268
|
+
_c.persistence = _d.sent();
|
|
16269
|
+
garbageCollector = this.persistence.referenceDelegate
|
|
16270
|
+
.garbageCollector;
|
|
16271
|
+
this.gcScheduler = new LruScheduler(garbageCollector, asyncQueue);
|
|
16272
|
+
this.localStore = new LocalStore(this.persistence, new IndexFreeQueryEngine(), initialUser);
|
|
16273
|
+
this.remoteStore = new RemoteStore(this.localStore, datastore, asyncQueue, function (onlineState) { return _this.syncEngine.applyOnlineStateChange(onlineState, 0 /* RemoteStore */); }, platform.newConnectivityMonitor());
|
|
16274
|
+
this.syncEngine = new SyncEngine(this.localStore, this.remoteStore, this.sharedClientState, initialUser, maxConcurrentLimboResolutions);
|
|
16275
|
+
this.eventManager = new EventManager(this.syncEngine);
|
|
16251
16276
|
this.remoteStore.syncEngine = this.syncEngine;
|
|
16252
16277
|
this.sharedClientState.syncEngine = this.syncEngine;
|
|
16253
16278
|
return [4 /*yield*/, this.sharedClientState.start()];
|
|
16254
16279
|
case 2:
|
|
16255
|
-
|
|
16280
|
+
_d.sent();
|
|
16256
16281
|
return [4 /*yield*/, this.remoteStore.start()];
|
|
16257
16282
|
case 3:
|
|
16258
|
-
|
|
16283
|
+
_d.sent();
|
|
16259
16284
|
return [4 /*yield*/, this.localStore.start()];
|
|
16260
16285
|
case 4:
|
|
16261
|
-
|
|
16286
|
+
_d.sent();
|
|
16262
16287
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
16263
16288
|
// set it after localStore / remoteStore are started.
|
|
16264
16289
|
return [4 /*yield*/, this.persistence.setPrimaryStateListener(function (isPrimary) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
@@ -16267,13 +16292,11 @@ var MemoryComponentProvider = /** @class */ (function () {
|
|
|
16267
16292
|
case 0: return [4 /*yield*/, this.syncEngine.applyPrimaryState(isPrimary)];
|
|
16268
16293
|
case 1:
|
|
16269
16294
|
_c.sent();
|
|
16270
|
-
if (this.gcScheduler) {
|
|
16271
|
-
|
|
16272
|
-
|
|
16273
|
-
|
|
16274
|
-
|
|
16275
|
-
this.gcScheduler.stop();
|
|
16276
|
-
}
|
|
16295
|
+
if (isPrimary && !this.gcScheduler.started) {
|
|
16296
|
+
this.gcScheduler.start(this.localStore);
|
|
16297
|
+
}
|
|
16298
|
+
else if (!isPrimary) {
|
|
16299
|
+
this.gcScheduler.stop();
|
|
16277
16300
|
}
|
|
16278
16301
|
return [2 /*return*/];
|
|
16279
16302
|
}
|
|
@@ -16282,86 +16305,65 @@ var MemoryComponentProvider = /** @class */ (function () {
|
|
|
16282
16305
|
case 5:
|
|
16283
16306
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
16284
16307
|
// set it after localStore / remoteStore are started.
|
|
16285
|
-
|
|
16308
|
+
_d.sent();
|
|
16286
16309
|
return [2 /*return*/];
|
|
16287
16310
|
}
|
|
16288
16311
|
});
|
|
16289
16312
|
});
|
|
16290
16313
|
};
|
|
16291
|
-
|
|
16292
|
-
|
|
16293
|
-
|
|
16294
|
-
MemoryComponentProvider.prototype.createGarbageCollectionScheduler = function (cfg) {
|
|
16295
|
-
return null;
|
|
16296
|
-
};
|
|
16297
|
-
MemoryComponentProvider.prototype.createLocalStore = function (cfg) {
|
|
16298
|
-
return new LocalStore(this.persistence, new IndexFreeQueryEngine(), cfg.initialUser);
|
|
16299
|
-
};
|
|
16300
|
-
MemoryComponentProvider.prototype.createPersistence = function (cfg) {
|
|
16301
|
-
debugAssert(!cfg.persistenceSettings.durable, 'Can only start memory persistence');
|
|
16302
|
-
return new MemoryPersistence(cfg.clientId, MemoryEagerDelegate.factory);
|
|
16303
|
-
};
|
|
16304
|
-
MemoryComponentProvider.prototype.createRemoteStore = function (cfg) {
|
|
16305
|
-
var _this = this;
|
|
16306
|
-
return new RemoteStore(this.localStore, cfg.datastore, cfg.asyncQueue, function (onlineState) { return _this.syncEngine.applyOnlineStateChange(onlineState, 0 /* RemoteStore */); }, cfg.platform.newConnectivityMonitor());
|
|
16307
|
-
};
|
|
16308
|
-
MemoryComponentProvider.prototype.createSharedClientState = function (cfg) {
|
|
16309
|
-
return new MemorySharedClientState();
|
|
16310
|
-
};
|
|
16311
|
-
MemoryComponentProvider.prototype.createSyncEngine = function (cfg) {
|
|
16312
|
-
return new SyncEngine(this.localStore, this.remoteStore, this.sharedClientState, cfg.initialUser, cfg.maxConcurrentLimboResolutions);
|
|
16313
|
-
};
|
|
16314
|
-
MemoryComponentProvider.prototype.clearPersistence = function (databaseInfo) {
|
|
16315
|
-
throw new FirestoreError(Code.FAILED_PRECONDITION, MEMORY_ONLY_PERSISTENCE_ERROR_MESSAGE);
|
|
16314
|
+
IndexedDbComponentProvider.prototype.clearPersistence = function (databaseInfo) {
|
|
16315
|
+
var persistenceKey = IndexedDbPersistence.buildStoragePrefix(databaseInfo);
|
|
16316
|
+
return IndexedDbPersistence.clearPersistence(persistenceKey);
|
|
16316
16317
|
};
|
|
16317
|
-
return
|
|
16318
|
+
return IndexedDbComponentProvider;
|
|
16318
16319
|
}());
|
|
16320
|
+
var MEMORY_ONLY_PERSISTENCE_ERROR_MESSAGE = 'You are using the memory-only build of Firestore. Persistence support is ' +
|
|
16321
|
+
'only available via the @firebase/firestore bundle or the ' +
|
|
16322
|
+
'firebase-firestore.js build.';
|
|
16319
16323
|
/**
|
|
16320
|
-
* Provides all components needed for Firestore with
|
|
16324
|
+
* Provides all components needed for Firestore with in-memory persistence.
|
|
16321
16325
|
*/
|
|
16322
|
-
var
|
|
16323
|
-
|
|
16324
|
-
|
|
16325
|
-
|
|
16326
|
+
var MemoryComponentProvider = /** @class */ (function () {
|
|
16327
|
+
function MemoryComponentProvider(referenceDelegateFactory) {
|
|
16328
|
+
if (referenceDelegateFactory === void 0) { referenceDelegateFactory = MemoryEagerDelegate.factory; }
|
|
16329
|
+
this.referenceDelegateFactory = referenceDelegateFactory;
|
|
16326
16330
|
}
|
|
16327
|
-
|
|
16328
|
-
|
|
16329
|
-
|
|
16330
|
-
.
|
|
16331
|
-
|
|
16332
|
-
|
|
16333
|
-
|
|
16334
|
-
|
|
16335
|
-
|
|
16336
|
-
|
|
16337
|
-
|
|
16338
|
-
|
|
16339
|
-
|
|
16340
|
-
|
|
16341
|
-
|
|
16342
|
-
|
|
16343
|
-
|
|
16344
|
-
|
|
16345
|
-
|
|
16346
|
-
|
|
16347
|
-
|
|
16348
|
-
|
|
16349
|
-
|
|
16350
|
-
|
|
16351
|
-
|
|
16352
|
-
|
|
16353
|
-
|
|
16354
|
-
|
|
16355
|
-
|
|
16356
|
-
}
|
|
16357
|
-
return new MemorySharedClientState();
|
|
16331
|
+
MemoryComponentProvider.prototype.initialize = function (asyncQueue, databaseInfo, platform, datastore, clientId, initialUser, maxConcurrentLimboResolutions, persistenceSettings) {
|
|
16332
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
16333
|
+
var _this = this;
|
|
16334
|
+
return tslib.__generator(this, function (_c) {
|
|
16335
|
+
switch (_c.label) {
|
|
16336
|
+
case 0:
|
|
16337
|
+
if (persistenceSettings.durable) {
|
|
16338
|
+
throw new FirestoreError(Code.FAILED_PRECONDITION, MEMORY_ONLY_PERSISTENCE_ERROR_MESSAGE);
|
|
16339
|
+
}
|
|
16340
|
+
this.persistence = new MemoryPersistence(clientId, this.referenceDelegateFactory);
|
|
16341
|
+
this.gcScheduler = null;
|
|
16342
|
+
this.sharedClientState = new MemorySharedClientState();
|
|
16343
|
+
this.localStore = new LocalStore(this.persistence, new IndexFreeQueryEngine(), initialUser);
|
|
16344
|
+
this.remoteStore = new RemoteStore(this.localStore, datastore, asyncQueue, function (onlineState) { return _this.syncEngine.applyOnlineStateChange(onlineState, 0 /* RemoteStore */); }, platform.newConnectivityMonitor());
|
|
16345
|
+
this.syncEngine = new SyncEngine(this.localStore, this.remoteStore, this.sharedClientState, initialUser, maxConcurrentLimboResolutions);
|
|
16346
|
+
this.eventManager = new EventManager(this.syncEngine);
|
|
16347
|
+
this.remoteStore.syncEngine = this.syncEngine;
|
|
16348
|
+
return [4 /*yield*/, this.remoteStore.start()];
|
|
16349
|
+
case 1:
|
|
16350
|
+
_c.sent();
|
|
16351
|
+
return [4 /*yield*/, this.remoteStore.applyPrimaryState(true)];
|
|
16352
|
+
case 2:
|
|
16353
|
+
_c.sent();
|
|
16354
|
+
return [4 /*yield*/, this.syncEngine.applyPrimaryState(true)];
|
|
16355
|
+
case 3:
|
|
16356
|
+
_c.sent();
|
|
16357
|
+
return [2 /*return*/];
|
|
16358
|
+
}
|
|
16359
|
+
});
|
|
16360
|
+
});
|
|
16358
16361
|
};
|
|
16359
|
-
|
|
16360
|
-
|
|
16361
|
-
return IndexedDbPersistence.clearPersistence(persistenceKey);
|
|
16362
|
+
MemoryComponentProvider.prototype.clearPersistence = function () {
|
|
16363
|
+
throw new FirestoreError(Code.FAILED_PRECONDITION, MEMORY_ONLY_PERSISTENCE_ERROR_MESSAGE);
|
|
16362
16364
|
};
|
|
16363
|
-
return
|
|
16364
|
-
}(
|
|
16365
|
+
return MemoryComponentProvider;
|
|
16366
|
+
}());
|
|
16365
16367
|
/**
|
|
16366
16368
|
* @license
|
|
16367
16369
|
* Copyright 2017 Google LLC
|
|
@@ -17118,16 +17120,7 @@ var FirestoreClient = /** @class */ (function () {
|
|
|
17118
17120
|
connection = _c.sent();
|
|
17119
17121
|
serializer = this.platform.newSerializer(this.databaseInfo.databaseId);
|
|
17120
17122
|
datastore = new Datastore(this.asyncQueue, connection, this.credentials, serializer);
|
|
17121
|
-
return [4 /*yield*/, componentProvider.initialize(
|
|
17122
|
-
asyncQueue: this.asyncQueue,
|
|
17123
|
-
databaseInfo: this.databaseInfo,
|
|
17124
|
-
platform: this.platform,
|
|
17125
|
-
datastore: datastore,
|
|
17126
|
-
clientId: this.clientId,
|
|
17127
|
-
initialUser: user,
|
|
17128
|
-
maxConcurrentLimboResolutions: MAX_CONCURRENT_LIMBO_RESOLUTIONS,
|
|
17129
|
-
persistenceSettings: persistenceSettings
|
|
17130
|
-
})];
|
|
17123
|
+
return [4 /*yield*/, componentProvider.initialize(this.asyncQueue, this.databaseInfo, this.platform, datastore, this.clientId, user, MAX_CONCURRENT_LIMBO_RESOLUTIONS, persistenceSettings)];
|
|
17131
17124
|
case 2:
|
|
17132
17125
|
_c.sent();
|
|
17133
17126
|
this.persistence = componentProvider.persistence;
|
|
@@ -22587,7 +22580,7 @@ var NodePlatform = /** @class */ (function () {
|
|
|
22587
22580
|
*/
|
|
22588
22581
|
PlatformSupport.setPlatform(new NodePlatform());
|
|
22589
22582
|
var name = "@firebase/firestore";
|
|
22590
|
-
var version = "1.14.0
|
|
22583
|
+
var version = "1.14.0";
|
|
22591
22584
|
/**
|
|
22592
22585
|
* @license
|
|
22593
22586
|
* Copyright 2017 Google LLC
|