@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/lite/index.node.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { FirebaseError, createMockUserToken, getModularInstance } from '@firebas
|
|
|
6
6
|
import nodeFetch from 'node-fetch';
|
|
7
7
|
import { randomBytes as randomBytes$1 } from 'crypto';
|
|
8
8
|
|
|
9
|
-
const version$1 = "3.4.
|
|
9
|
+
const version$1 = "3.4.15";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @license
|
|
@@ -59,7 +59,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
59
59
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
60
60
|
User.MOCK_USER = new User('mock-user');
|
|
61
61
|
|
|
62
|
-
const version = "9.9.
|
|
62
|
+
const version = "9.9.4";
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* @license
|
|
@@ -687,6 +687,12 @@ class DatabaseId {
|
|
|
687
687
|
other.projectId === this.projectId &&
|
|
688
688
|
other.database === this.database);
|
|
689
689
|
}
|
|
690
|
+
}
|
|
691
|
+
function databaseIdFromApp(app, database) {
|
|
692
|
+
if (!Object.prototype.hasOwnProperty.apply(app.options, ['projectId'])) {
|
|
693
|
+
throw new FirestoreError(Code.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
694
|
+
}
|
|
695
|
+
return new DatabaseId(app.options.projectId, database);
|
|
690
696
|
}
|
|
691
697
|
|
|
692
698
|
/**
|
|
@@ -5171,9 +5177,11 @@ class FirestoreSettingsImpl {
|
|
|
5171
5177
|
*/
|
|
5172
5178
|
class Firestore {
|
|
5173
5179
|
/** @hideconstructor */
|
|
5174
|
-
constructor(
|
|
5180
|
+
constructor(_authCredentials, _appCheckCredentials, _databaseId, _app) {
|
|
5175
5181
|
this._authCredentials = _authCredentials;
|
|
5176
5182
|
this._appCheckCredentials = _appCheckCredentials;
|
|
5183
|
+
this._databaseId = _databaseId;
|
|
5184
|
+
this._app = _app;
|
|
5177
5185
|
/**
|
|
5178
5186
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
5179
5187
|
*/
|
|
@@ -5181,13 +5189,6 @@ class Firestore {
|
|
|
5181
5189
|
this._persistenceKey = '(lite)';
|
|
5182
5190
|
this._settings = new FirestoreSettingsImpl({});
|
|
5183
5191
|
this._settingsFrozen = false;
|
|
5184
|
-
if (databaseIdOrApp instanceof DatabaseId) {
|
|
5185
|
-
this._databaseId = databaseIdOrApp;
|
|
5186
|
-
}
|
|
5187
|
-
else {
|
|
5188
|
-
this._app = databaseIdOrApp;
|
|
5189
|
-
this._databaseId = databaseIdFromApp(databaseIdOrApp);
|
|
5190
|
-
}
|
|
5191
5192
|
}
|
|
5192
5193
|
/**
|
|
5193
5194
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
@@ -5250,41 +5251,27 @@ class Firestore {
|
|
|
5250
5251
|
return Promise.resolve();
|
|
5251
5252
|
}
|
|
5252
5253
|
}
|
|
5253
|
-
function
|
|
5254
|
-
if (!
|
|
5255
|
-
|
|
5254
|
+
function initializeFirestore(app, settings, databaseId) {
|
|
5255
|
+
if (!databaseId) {
|
|
5256
|
+
databaseId = DEFAULT_DATABASE_NAME;
|
|
5256
5257
|
}
|
|
5257
|
-
return new DatabaseId(app.options.projectId);
|
|
5258
|
-
}
|
|
5259
|
-
/**
|
|
5260
|
-
* Initializes a new instance of Cloud Firestore with the provided settings.
|
|
5261
|
-
* Can only be called before any other functions, including
|
|
5262
|
-
* {@link getFirestore}. If the custom settings are empty, this function is
|
|
5263
|
-
* equivalent to calling {@link getFirestore}.
|
|
5264
|
-
*
|
|
5265
|
-
* @param app - The {@link @firebase/app#FirebaseApp} with which the `Firestore` instance will
|
|
5266
|
-
* be associated.
|
|
5267
|
-
* @param settings - A settings object to configure the `Firestore` instance.
|
|
5268
|
-
* @returns A newly initialized `Firestore` instance.
|
|
5269
|
-
*/
|
|
5270
|
-
function initializeFirestore(app, settings) {
|
|
5271
5258
|
const provider = _getProvider(app, 'firestore/lite');
|
|
5272
|
-
if (provider.isInitialized()) {
|
|
5259
|
+
if (provider.isInitialized(databaseId)) {
|
|
5273
5260
|
throw new FirestoreError(Code.FAILED_PRECONDITION, 'Firestore can only be initialized once per app.');
|
|
5274
5261
|
}
|
|
5275
|
-
return provider.initialize({
|
|
5262
|
+
return provider.initialize({
|
|
5263
|
+
options: settings,
|
|
5264
|
+
instanceIdentifier: databaseId
|
|
5265
|
+
});
|
|
5276
5266
|
}
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
*/
|
|
5286
|
-
function getFirestore(app = getApp()) {
|
|
5287
|
-
return _getProvider(app, 'firestore/lite').getImmediate();
|
|
5267
|
+
function getFirestore(appOrDatabaseId, optionalDatabaseId) {
|
|
5268
|
+
const app = typeof appOrDatabaseId === 'object' ? appOrDatabaseId : getApp();
|
|
5269
|
+
const databaseId = typeof appOrDatabaseId === 'string'
|
|
5270
|
+
? appOrDatabaseId
|
|
5271
|
+
: optionalDatabaseId || '(default)';
|
|
5272
|
+
return _getProvider(app, 'firestore/lite').getImmediate({
|
|
5273
|
+
identifier: databaseId
|
|
5274
|
+
});
|
|
5288
5275
|
}
|
|
5289
5276
|
/**
|
|
5290
5277
|
* Modify this instance to communicate with the Cloud Firestore emulator.
|
|
@@ -5372,14 +5359,14 @@ function terminate(firestore) {
|
|
|
5372
5359
|
*/
|
|
5373
5360
|
function registerFirestore() {
|
|
5374
5361
|
setSDKVersion(`${SDK_VERSION$1}_lite`);
|
|
5375
|
-
_registerComponent(new Component('firestore/lite', (container, { options: settings }) => {
|
|
5362
|
+
_registerComponent(new Component('firestore/lite', (container, { instanceIdentifier: databaseId, options: settings }) => {
|
|
5376
5363
|
const app = container.getProvider('app').getImmediate();
|
|
5377
|
-
const firestoreInstance = new Firestore(
|
|
5364
|
+
const firestoreInstance = new Firestore(new LiteAuthCredentialsProvider(container.getProvider('auth-internal')), new LiteAppCheckTokenProvider(container.getProvider('app-check-internal')), databaseIdFromApp(app, databaseId), app);
|
|
5378
5365
|
if (settings) {
|
|
5379
5366
|
firestoreInstance._setSettings(settings);
|
|
5380
5367
|
}
|
|
5381
5368
|
return firestoreInstance;
|
|
5382
|
-
}, 'PUBLIC'));
|
|
5369
|
+
}, 'PUBLIC').setMultipleInstances(true));
|
|
5383
5370
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5384
5371
|
registerVersion('firestore-lite', version$1, 'node');
|
|
5385
5372
|
registerVersion('firestore-lite', version$1, 'esm2017');
|
|
@@ -7790,7 +7777,7 @@ class Transaction$1 {
|
|
|
7790
7777
|
docVersion = doc.version;
|
|
7791
7778
|
}
|
|
7792
7779
|
else if (doc.isNoDocument()) {
|
|
7793
|
-
//
|
|
7780
|
+
// Represent a deleted doc using SnapshotVersion.min().
|
|
7794
7781
|
docVersion = SnapshotVersion.min();
|
|
7795
7782
|
}
|
|
7796
7783
|
else {
|
|
@@ -7814,7 +7801,12 @@ class Transaction$1 {
|
|
|
7814
7801
|
precondition(key) {
|
|
7815
7802
|
const version = this.readVersions.get(key.toString());
|
|
7816
7803
|
if (!this.writtenDocs.has(key.toString()) && version) {
|
|
7817
|
-
|
|
7804
|
+
if (version.isEqual(SnapshotVersion.min())) {
|
|
7805
|
+
return Precondition.exists(false);
|
|
7806
|
+
}
|
|
7807
|
+
else {
|
|
7808
|
+
return Precondition.updateTime(version);
|
|
7809
|
+
}
|
|
7818
7810
|
}
|
|
7819
7811
|
else {
|
|
7820
7812
|
return Precondition.none();
|