@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.d.ts
CHANGED
|
@@ -687,15 +687,25 @@ export declare function getDoc<T>(reference: DocumentReference<T>): Promise<Docu
|
|
|
687
687
|
*/
|
|
688
688
|
export declare function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
|
|
689
689
|
/**
|
|
690
|
-
* Returns the existing
|
|
690
|
+
* Returns the existing default {@link Firestore} instance that is associated with the
|
|
691
|
+
* default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
|
|
692
|
+
* instance with default settings.
|
|
693
|
+
*
|
|
694
|
+
* @returns The {@link Firestore} instance of the provided app.
|
|
695
|
+
*/
|
|
696
|
+
export declare function getFirestore(): Firestore;
|
|
697
|
+
/**
|
|
698
|
+
* Returns the existing default {@link Firestore} instance that is associated with the
|
|
691
699
|
* provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
|
|
692
700
|
* instance with default settings.
|
|
693
701
|
*
|
|
694
|
-
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned
|
|
702
|
+
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
|
|
695
703
|
* instance is associated with.
|
|
696
|
-
* @returns The
|
|
704
|
+
* @returns The {@link Firestore} instance of the provided app.
|
|
697
705
|
*/
|
|
698
|
-
export declare function getFirestore(app
|
|
706
|
+
export declare function getFirestore(app: FirebaseApp): Firestore;
|
|
707
|
+
/* Excluded declaration from this release type: getFirestore */
|
|
708
|
+
/* Excluded declaration from this release type: getFirestore */
|
|
699
709
|
/**
|
|
700
710
|
* Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link
|
|
701
711
|
* @firebase/firestore/lite#(updateDoc:1)} that tells the server to increment the field's current value by
|
|
@@ -728,6 +738,7 @@ export declare function increment(n: number): FieldValue;
|
|
|
728
738
|
* @returns A newly initialized `Firestore` instance.
|
|
729
739
|
*/
|
|
730
740
|
export declare function initializeFirestore(app: FirebaseApp, settings: Settings): Firestore;
|
|
741
|
+
/* Excluded declaration from this release type: initializeFirestore */
|
|
731
742
|
/**
|
|
732
743
|
* Creates a {@link QueryConstraint} that only returns the first matching documents.
|
|
733
744
|
*
|
|
@@ -14,7 +14,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
14
14
|
|
|
15
15
|
var nodeFetch__default = /*#__PURE__*/_interopDefaultLegacy(nodeFetch);
|
|
16
16
|
|
|
17
|
-
const version$1 = "3.4.
|
|
17
|
+
const version$1 = "3.4.15";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* @license
|
|
@@ -67,7 +67,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
67
67
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
68
68
|
User.MOCK_USER = new User('mock-user');
|
|
69
69
|
|
|
70
|
-
const version = "9.9.
|
|
70
|
+
const version = "9.9.4";
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* @license
|
|
@@ -695,6 +695,12 @@ class DatabaseId {
|
|
|
695
695
|
other.projectId === this.projectId &&
|
|
696
696
|
other.database === this.database);
|
|
697
697
|
}
|
|
698
|
+
}
|
|
699
|
+
function databaseIdFromApp(app, database) {
|
|
700
|
+
if (!Object.prototype.hasOwnProperty.apply(app.options, ['projectId'])) {
|
|
701
|
+
throw new FirestoreError(Code.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
702
|
+
}
|
|
703
|
+
return new DatabaseId(app.options.projectId, database);
|
|
698
704
|
}
|
|
699
705
|
|
|
700
706
|
/**
|
|
@@ -5179,9 +5185,11 @@ class FirestoreSettingsImpl {
|
|
|
5179
5185
|
*/
|
|
5180
5186
|
class Firestore {
|
|
5181
5187
|
/** @hideconstructor */
|
|
5182
|
-
constructor(
|
|
5188
|
+
constructor(_authCredentials, _appCheckCredentials, _databaseId, _app) {
|
|
5183
5189
|
this._authCredentials = _authCredentials;
|
|
5184
5190
|
this._appCheckCredentials = _appCheckCredentials;
|
|
5191
|
+
this._databaseId = _databaseId;
|
|
5192
|
+
this._app = _app;
|
|
5185
5193
|
/**
|
|
5186
5194
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
5187
5195
|
*/
|
|
@@ -5189,13 +5197,6 @@ class Firestore {
|
|
|
5189
5197
|
this._persistenceKey = '(lite)';
|
|
5190
5198
|
this._settings = new FirestoreSettingsImpl({});
|
|
5191
5199
|
this._settingsFrozen = false;
|
|
5192
|
-
if (databaseIdOrApp instanceof DatabaseId) {
|
|
5193
|
-
this._databaseId = databaseIdOrApp;
|
|
5194
|
-
}
|
|
5195
|
-
else {
|
|
5196
|
-
this._app = databaseIdOrApp;
|
|
5197
|
-
this._databaseId = databaseIdFromApp(databaseIdOrApp);
|
|
5198
|
-
}
|
|
5199
5200
|
}
|
|
5200
5201
|
/**
|
|
5201
5202
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
@@ -5258,41 +5259,27 @@ class Firestore {
|
|
|
5258
5259
|
return Promise.resolve();
|
|
5259
5260
|
}
|
|
5260
5261
|
}
|
|
5261
|
-
function
|
|
5262
|
-
if (!
|
|
5263
|
-
|
|
5262
|
+
function initializeFirestore(app$1, settings, databaseId) {
|
|
5263
|
+
if (!databaseId) {
|
|
5264
|
+
databaseId = DEFAULT_DATABASE_NAME;
|
|
5264
5265
|
}
|
|
5265
|
-
return new DatabaseId(app.options.projectId);
|
|
5266
|
-
}
|
|
5267
|
-
/**
|
|
5268
|
-
* Initializes a new instance of Cloud Firestore with the provided settings.
|
|
5269
|
-
* Can only be called before any other functions, including
|
|
5270
|
-
* {@link getFirestore}. If the custom settings are empty, this function is
|
|
5271
|
-
* equivalent to calling {@link getFirestore}.
|
|
5272
|
-
*
|
|
5273
|
-
* @param app - The {@link @firebase/app#FirebaseApp} with which the `Firestore` instance will
|
|
5274
|
-
* be associated.
|
|
5275
|
-
* @param settings - A settings object to configure the `Firestore` instance.
|
|
5276
|
-
* @returns A newly initialized `Firestore` instance.
|
|
5277
|
-
*/
|
|
5278
|
-
function initializeFirestore(app$1, settings) {
|
|
5279
5266
|
const provider = app._getProvider(app$1, 'firestore/lite');
|
|
5280
|
-
if (provider.isInitialized()) {
|
|
5267
|
+
if (provider.isInitialized(databaseId)) {
|
|
5281
5268
|
throw new FirestoreError(Code.FAILED_PRECONDITION, 'Firestore can only be initialized once per app.');
|
|
5282
5269
|
}
|
|
5283
|
-
return provider.initialize({
|
|
5270
|
+
return provider.initialize({
|
|
5271
|
+
options: settings,
|
|
5272
|
+
instanceIdentifier: databaseId
|
|
5273
|
+
});
|
|
5284
5274
|
}
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
*/
|
|
5294
|
-
function getFirestore(app$1 = app.getApp()) {
|
|
5295
|
-
return app._getProvider(app$1, 'firestore/lite').getImmediate();
|
|
5275
|
+
function getFirestore(appOrDatabaseId, optionalDatabaseId) {
|
|
5276
|
+
const app$1 = typeof appOrDatabaseId === 'object' ? appOrDatabaseId : app.getApp();
|
|
5277
|
+
const databaseId = typeof appOrDatabaseId === 'string'
|
|
5278
|
+
? appOrDatabaseId
|
|
5279
|
+
: optionalDatabaseId || '(default)';
|
|
5280
|
+
return app._getProvider(app$1, 'firestore/lite').getImmediate({
|
|
5281
|
+
identifier: databaseId
|
|
5282
|
+
});
|
|
5296
5283
|
}
|
|
5297
5284
|
/**
|
|
5298
5285
|
* Modify this instance to communicate with the Cloud Firestore emulator.
|
|
@@ -5380,14 +5367,14 @@ function terminate(firestore) {
|
|
|
5380
5367
|
*/
|
|
5381
5368
|
function registerFirestore() {
|
|
5382
5369
|
setSDKVersion(`${app.SDK_VERSION}_lite`);
|
|
5383
|
-
app._registerComponent(new component.Component('firestore/lite', (container, { options: settings }) => {
|
|
5370
|
+
app._registerComponent(new component.Component('firestore/lite', (container, { instanceIdentifier: databaseId, options: settings }) => {
|
|
5384
5371
|
const app = container.getProvider('app').getImmediate();
|
|
5385
|
-
const firestoreInstance = new Firestore(
|
|
5372
|
+
const firestoreInstance = new Firestore(new LiteAuthCredentialsProvider(container.getProvider('auth-internal')), new LiteAppCheckTokenProvider(container.getProvider('app-check-internal')), databaseIdFromApp(app, databaseId), app);
|
|
5386
5373
|
if (settings) {
|
|
5387
5374
|
firestoreInstance._setSettings(settings);
|
|
5388
5375
|
}
|
|
5389
5376
|
return firestoreInstance;
|
|
5390
|
-
}, 'PUBLIC'));
|
|
5377
|
+
}, 'PUBLIC').setMultipleInstances(true));
|
|
5391
5378
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5392
5379
|
app.registerVersion('firestore-lite', version$1, 'node');
|
|
5393
5380
|
app.registerVersion('firestore-lite', version$1, 'cjs5');
|
|
@@ -7798,7 +7785,7 @@ class Transaction$1 {
|
|
|
7798
7785
|
docVersion = doc.version;
|
|
7799
7786
|
}
|
|
7800
7787
|
else if (doc.isNoDocument()) {
|
|
7801
|
-
//
|
|
7788
|
+
// Represent a deleted doc using SnapshotVersion.min().
|
|
7802
7789
|
docVersion = SnapshotVersion.min();
|
|
7803
7790
|
}
|
|
7804
7791
|
else {
|
|
@@ -7822,7 +7809,12 @@ class Transaction$1 {
|
|
|
7822
7809
|
precondition(key) {
|
|
7823
7810
|
const version = this.readVersions.get(key.toString());
|
|
7824
7811
|
if (!this.writtenDocs.has(key.toString()) && version) {
|
|
7825
|
-
|
|
7812
|
+
if (version.isEqual(SnapshotVersion.min())) {
|
|
7813
|
+
return Precondition.exists(false);
|
|
7814
|
+
}
|
|
7815
|
+
else {
|
|
7816
|
+
return Precondition.updateTime(version);
|
|
7817
|
+
}
|
|
7826
7818
|
}
|
|
7827
7819
|
else {
|
|
7828
7820
|
return Precondition.none();
|