@firebase/firestore 3.4.14-canary.fcd4b8ac3 → 3.4.15
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/CHANGELOG.md +6 -0
- package/dist/firestore/src/api/database.d.ts +34 -3
- package/dist/firestore/src/core/database_info.d.ts +4 -0
- package/dist/firestore/src/lite-api/database.d.ts +51 -7
- package/dist/firestore/test/integration/api/provider.test.d.ts +17 -0
- package/dist/firestore/test/integration/util/firebase_export.d.ts +2 -1
- package/dist/firestore/test/integration/util/helpers.d.ts +1 -0
- package/dist/index.d.ts +14 -3
- package/dist/index.esm2017.js +67 -68
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +52 -55
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +47 -42
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +47 -42
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +67 -68
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +40 -6
- package/dist/lite/firestore/src/api/database.d.ts +34 -3
- package/dist/lite/firestore/src/core/database_info.d.ts +4 -0
- package/dist/lite/firestore/src/lite-api/database.d.ts +51 -7
- package/dist/lite/firestore/test/integration/api/provider.test.d.ts +17 -0
- package/dist/lite/firestore/test/integration/util/firebase_export.d.ts +2 -1
- package/dist/lite/firestore/test/integration/util/helpers.d.ts +1 -0
- package/dist/lite/index.browser.esm2017.js +43 -57
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +181 -184
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.d.ts +15 -4
- package/dist/lite/index.node.cjs.js +37 -45
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +37 -45
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +43 -57
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +55 -7
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +6 -43
- package/dist/lite/packages/firestore/src/api/database.d.ts +34 -3
- package/dist/lite/packages/firestore/src/core/database_info.d.ts +4 -0
- package/dist/lite/packages/firestore/src/lite-api/database.d.ts +51 -7
- package/dist/lite/packages/firestore/test/integration/api/provider.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/integration/util/firebase_export.d.ts +2 -1
- package/dist/lite/packages/firestore/test/integration/util/helpers.d.ts +1 -0
- package/dist/lite/private.d.ts +22 -7
- package/dist/packages/firestore/dist/index.esm2017.d.ts +20 -15
- package/dist/packages/firestore/src/api/database.d.ts +34 -3
- package/dist/packages/firestore/src/core/database_info.d.ts +4 -0
- package/dist/packages/firestore/src/lite-api/database.d.ts +51 -7
- package/dist/packages/firestore/test/integration/api/provider.test.d.ts +17 -0
- package/dist/packages/firestore/test/integration/util/firebase_export.d.ts +2 -1
- package/dist/packages/firestore/test/integration/util/helpers.d.ts +1 -0
- package/dist/private.d.ts +21 -7
- package/package.json +10 -9
package/dist/index.node.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import * as grpc from '@grpc/grpc-js';
|
|
|
8
8
|
import * as protoLoader from '@grpc/proto-loader';
|
|
9
9
|
|
|
10
10
|
const name = "@firebase/firestore";
|
|
11
|
-
const version$1 = "3.4.
|
|
11
|
+
const version$1 = "3.4.15";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -61,7 +61,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
61
61
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
62
62
|
User.MOCK_USER = new User('mock-user');
|
|
63
63
|
|
|
64
|
-
const version = "9.9.
|
|
64
|
+
const version = "9.9.4";
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* @license
|
|
@@ -4343,6 +4343,12 @@ class DatabaseId {
|
|
|
4343
4343
|
other.projectId === this.projectId &&
|
|
4344
4344
|
other.database === this.database);
|
|
4345
4345
|
}
|
|
4346
|
+
}
|
|
4347
|
+
function databaseIdFromApp(app, database) {
|
|
4348
|
+
if (!Object.prototype.hasOwnProperty.apply(app.options, ['projectId'])) {
|
|
4349
|
+
throw new FirestoreError(Code.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
4350
|
+
}
|
|
4351
|
+
return new DatabaseId(app.options.projectId, database);
|
|
4346
4352
|
}
|
|
4347
4353
|
|
|
4348
4354
|
/**
|
|
@@ -24758,7 +24764,7 @@ class Transaction$2 {
|
|
|
24758
24764
|
docVersion = doc.version;
|
|
24759
24765
|
}
|
|
24760
24766
|
else if (doc.isNoDocument()) {
|
|
24761
|
-
//
|
|
24767
|
+
// Represent a deleted doc using SnapshotVersion.min().
|
|
24762
24768
|
docVersion = SnapshotVersion.min();
|
|
24763
24769
|
}
|
|
24764
24770
|
else {
|
|
@@ -24782,7 +24788,12 @@ class Transaction$2 {
|
|
|
24782
24788
|
precondition(key) {
|
|
24783
24789
|
const version = this.readVersions.get(key.toString());
|
|
24784
24790
|
if (!this.writtenDocs.has(key.toString()) && version) {
|
|
24785
|
-
|
|
24791
|
+
if (version.isEqual(SnapshotVersion.min())) {
|
|
24792
|
+
return Precondition.exists(false);
|
|
24793
|
+
}
|
|
24794
|
+
else {
|
|
24795
|
+
return Precondition.updateTime(version);
|
|
24796
|
+
}
|
|
24786
24797
|
}
|
|
24787
24798
|
else {
|
|
24788
24799
|
return Precondition.none();
|
|
@@ -25477,9 +25488,11 @@ class FirestoreSettingsImpl {
|
|
|
25477
25488
|
*/
|
|
25478
25489
|
class Firestore$1 {
|
|
25479
25490
|
/** @hideconstructor */
|
|
25480
|
-
constructor(
|
|
25491
|
+
constructor(_authCredentials, _appCheckCredentials, _databaseId, _app) {
|
|
25481
25492
|
this._authCredentials = _authCredentials;
|
|
25482
25493
|
this._appCheckCredentials = _appCheckCredentials;
|
|
25494
|
+
this._databaseId = _databaseId;
|
|
25495
|
+
this._app = _app;
|
|
25483
25496
|
/**
|
|
25484
25497
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
25485
25498
|
*/
|
|
@@ -25487,13 +25500,6 @@ class Firestore$1 {
|
|
|
25487
25500
|
this._persistenceKey = '(lite)';
|
|
25488
25501
|
this._settings = new FirestoreSettingsImpl({});
|
|
25489
25502
|
this._settingsFrozen = false;
|
|
25490
|
-
if (databaseIdOrApp instanceof DatabaseId) {
|
|
25491
|
-
this._databaseId = databaseIdOrApp;
|
|
25492
|
-
}
|
|
25493
|
-
else {
|
|
25494
|
-
this._app = databaseIdOrApp;
|
|
25495
|
-
this._databaseId = databaseIdFromApp(databaseIdOrApp);
|
|
25496
|
-
}
|
|
25497
25503
|
}
|
|
25498
25504
|
/**
|
|
25499
25505
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
@@ -25556,12 +25562,6 @@ class Firestore$1 {
|
|
|
25556
25562
|
return Promise.resolve();
|
|
25557
25563
|
}
|
|
25558
25564
|
}
|
|
25559
|
-
function databaseIdFromApp(app) {
|
|
25560
|
-
if (!Object.prototype.hasOwnProperty.apply(app.options, ['projectId'])) {
|
|
25561
|
-
throw new FirestoreError(Code.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
25562
|
-
}
|
|
25563
|
-
return new DatabaseId(app.options.projectId);
|
|
25564
|
-
}
|
|
25565
25565
|
/**
|
|
25566
25566
|
* Modify this instance to communicate with the Cloud Firestore emulator.
|
|
25567
25567
|
*
|
|
@@ -26230,15 +26230,14 @@ const CACHE_SIZE_UNLIMITED = LRU_COLLECTION_DISABLED;
|
|
|
26230
26230
|
*/
|
|
26231
26231
|
class Firestore extends Firestore$1 {
|
|
26232
26232
|
/** @hideconstructor */
|
|
26233
|
-
constructor(
|
|
26234
|
-
super(
|
|
26233
|
+
constructor(authCredentialsProvider, appCheckCredentialsProvider, databaseId, app) {
|
|
26234
|
+
super(authCredentialsProvider, appCheckCredentialsProvider, databaseId, app);
|
|
26235
26235
|
/**
|
|
26236
26236
|
* Whether it's a {@link Firestore} or Firestore Lite instance.
|
|
26237
26237
|
*/
|
|
26238
26238
|
this.type = 'firestore';
|
|
26239
26239
|
this._queue = newAsyncQueue();
|
|
26240
|
-
this._persistenceKey =
|
|
26241
|
-
'name' in databaseIdOrApp ? databaseIdOrApp.name : '[DEFAULT]';
|
|
26240
|
+
this._persistenceKey = (app === null || app === void 0 ? void 0 : app.name) || '[DEFAULT]';
|
|
26242
26241
|
}
|
|
26243
26242
|
_terminate() {
|
|
26244
26243
|
if (!this._firestoreClient) {
|
|
@@ -26258,13 +26257,19 @@ class Firestore extends Firestore$1 {
|
|
|
26258
26257
|
* @param app - The {@link @firebase/app#FirebaseApp} with which the {@link Firestore} instance will
|
|
26259
26258
|
* be associated.
|
|
26260
26259
|
* @param settings - A settings object to configure the {@link Firestore} instance.
|
|
26260
|
+
* @param databaseId - The name of database.
|
|
26261
26261
|
* @returns A newly initialized {@link Firestore} instance.
|
|
26262
26262
|
*/
|
|
26263
|
-
function initializeFirestore(app, settings) {
|
|
26263
|
+
function initializeFirestore(app, settings, databaseId) {
|
|
26264
|
+
if (!databaseId) {
|
|
26265
|
+
databaseId = DEFAULT_DATABASE_NAME;
|
|
26266
|
+
}
|
|
26264
26267
|
const provider = _getProvider(app, 'firestore');
|
|
26265
|
-
if (provider.isInitialized()) {
|
|
26266
|
-
const existingInstance = provider.getImmediate(
|
|
26267
|
-
|
|
26268
|
+
if (provider.isInitialized(databaseId)) {
|
|
26269
|
+
const existingInstance = provider.getImmediate({
|
|
26270
|
+
identifier: databaseId
|
|
26271
|
+
});
|
|
26272
|
+
const initialSettings = provider.getOptions(databaseId);
|
|
26268
26273
|
if (deepEqual(initialSettings, settings)) {
|
|
26269
26274
|
return existingInstance;
|
|
26270
26275
|
}
|
|
@@ -26280,19 +26285,19 @@ function initializeFirestore(app, settings) {
|
|
|
26280
26285
|
settings.cacheSizeBytes < LRU_MINIMUM_CACHE_SIZE_BYTES) {
|
|
26281
26286
|
throw new FirestoreError(Code.INVALID_ARGUMENT, `cacheSizeBytes must be at least ${LRU_MINIMUM_CACHE_SIZE_BYTES}`);
|
|
26282
26287
|
}
|
|
26283
|
-
return provider.initialize({
|
|
26288
|
+
return provider.initialize({
|
|
26289
|
+
options: settings,
|
|
26290
|
+
instanceIdentifier: databaseId
|
|
26291
|
+
});
|
|
26284
26292
|
}
|
|
26285
|
-
|
|
26286
|
-
|
|
26287
|
-
|
|
26288
|
-
|
|
26289
|
-
|
|
26290
|
-
|
|
26291
|
-
|
|
26292
|
-
|
|
26293
|
-
*/
|
|
26294
|
-
function getFirestore(app = getApp()) {
|
|
26295
|
-
return _getProvider(app, 'firestore').getImmediate();
|
|
26293
|
+
function getFirestore(appOrDatabaseId, optionalDatabaseId) {
|
|
26294
|
+
const app = typeof appOrDatabaseId === 'object' ? appOrDatabaseId : getApp();
|
|
26295
|
+
const databaseId = typeof appOrDatabaseId === 'string'
|
|
26296
|
+
? appOrDatabaseId
|
|
26297
|
+
: optionalDatabaseId || DEFAULT_DATABASE_NAME;
|
|
26298
|
+
return _getProvider(app, 'firestore').getImmediate({
|
|
26299
|
+
identifier: databaseId
|
|
26300
|
+
});
|
|
26296
26301
|
}
|
|
26297
26302
|
/**
|
|
26298
26303
|
* @internal
|
|
@@ -26538,7 +26543,7 @@ function disableNetwork(firestore) {
|
|
|
26538
26543
|
* terminated.
|
|
26539
26544
|
*/
|
|
26540
26545
|
function terminate(firestore) {
|
|
26541
|
-
_removeServiceInstance(firestore.app, 'firestore');
|
|
26546
|
+
_removeServiceInstance(firestore.app, 'firestore', firestore._databaseId.database);
|
|
26542
26547
|
return firestore._delete();
|
|
26543
26548
|
}
|
|
26544
26549
|
/**
|
|
@@ -26607,13 +26612,13 @@ function verifyNotInitialized(firestore) {
|
|
|
26607
26612
|
*/
|
|
26608
26613
|
function registerFirestore(variant, useFetchStreams = true) {
|
|
26609
26614
|
setSDKVersion(SDK_VERSION$1);
|
|
26610
|
-
_registerComponent(new Component('firestore', (container, { options: settings }) => {
|
|
26615
|
+
_registerComponent(new Component('firestore', (container, { instanceIdentifier: databaseId, options: settings }) => {
|
|
26611
26616
|
const app = container.getProvider('app').getImmediate();
|
|
26612
|
-
const firestoreInstance = new Firestore(
|
|
26617
|
+
const firestoreInstance = new Firestore(new FirebaseAuthCredentialsProvider(container.getProvider('auth-internal')), new FirebaseAppCheckTokenProvider(container.getProvider('app-check-internal')), databaseIdFromApp(app, databaseId), app);
|
|
26613
26618
|
settings = Object.assign({ useFetchStreams }, settings);
|
|
26614
26619
|
firestoreInstance._setSettings(settings);
|
|
26615
26620
|
return firestoreInstance;
|
|
26616
|
-
}, 'PUBLIC'));
|
|
26621
|
+
}, 'PUBLIC').setMultipleInstances(true));
|
|
26617
26622
|
registerVersion(name, version$1, variant);
|
|
26618
26623
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
26619
26624
|
registerVersion(name, version$1, 'esm2017');
|