@firebase/firestore 3.7.1 → 3.7.2
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 +12 -0
- package/dist/index.esm2017.js +234 -231
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +622 -621
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +36 -35
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +3 -2
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +234 -231
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/index.browser.esm2017.js +134 -134
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +257 -257
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +134 -134
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +17 -17
- package/dist/packages/firestore/dist/index.esm2017.d.ts +1 -1
- package/package.json +10 -10
- package/dist/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
- package/dist/lite/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
- package/dist/lite/packages/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
- package/dist/packages/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
package/dist/index.node.cjs.js
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var app = require('@firebase/app');
|
|
6
6
|
var component = require('@firebase/component');
|
|
7
7
|
var logger = require('@firebase/logger');
|
|
8
|
-
var util = require('util');
|
|
9
|
-
var util
|
|
8
|
+
var util$1 = require('util');
|
|
9
|
+
var util = require('@firebase/util');
|
|
10
10
|
var crypto = require('crypto');
|
|
11
11
|
var grpc = require('@grpc/grpc-js');
|
|
12
12
|
var protoLoader = require('@grpc/proto-loader');
|
|
@@ -33,7 +33,7 @@ var grpc__namespace = /*#__PURE__*/_interopNamespace(grpc);
|
|
|
33
33
|
var protoLoader__namespace = /*#__PURE__*/_interopNamespace(protoLoader);
|
|
34
34
|
|
|
35
35
|
const name = "@firebase/firestore";
|
|
36
|
-
const version$1 = "3.7.
|
|
36
|
+
const version$1 = "3.7.2";
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* @license
|
|
@@ -86,7 +86,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
86
86
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
87
87
|
User.MOCK_USER = new User('mock-user');
|
|
88
88
|
|
|
89
|
-
const version = "9.
|
|
89
|
+
const version = "9.13.0";
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* @license
|
|
@@ -128,7 +128,7 @@ function setSDKVersion(version) {
|
|
|
128
128
|
/** Formats an object as a JSON string, suitable for logging. */
|
|
129
129
|
function formatJSON(value) {
|
|
130
130
|
// util.inspect() results in much more readable output than JSON.stringify()
|
|
131
|
-
return util.inspect(value, { depth: 100 });
|
|
131
|
+
return util$1.inspect(value, { depth: 100 });
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
/**
|
|
@@ -406,7 +406,7 @@ const Code = {
|
|
|
406
406
|
DATA_LOSS: 'data-loss'
|
|
407
407
|
};
|
|
408
408
|
/** An error returned by a Firestore operation. */
|
|
409
|
-
class FirestoreError extends util
|
|
409
|
+
class FirestoreError extends util.FirebaseError {
|
|
410
410
|
/** @hideconstructor */
|
|
411
411
|
constructor(
|
|
412
412
|
/**
|
|
@@ -2083,7 +2083,7 @@ class SimpleDb {
|
|
|
2083
2083
|
this.name = name;
|
|
2084
2084
|
this.version = version;
|
|
2085
2085
|
this.schemaConverter = schemaConverter;
|
|
2086
|
-
const iOSVersion = SimpleDb.getIOSVersion(util
|
|
2086
|
+
const iOSVersion = SimpleDb.getIOSVersion(util.getUA());
|
|
2087
2087
|
// NOTE: According to https://bugs.webkit.org/show_bug.cgi?id=197050, the
|
|
2088
2088
|
// bug we're checking for should exist in iOS >= 12.2 and < 13, but for
|
|
2089
2089
|
// whatever reason it's much harder to hit after 12.2 so we only proactively
|
|
@@ -2102,7 +2102,7 @@ class SimpleDb {
|
|
|
2102
2102
|
}
|
|
2103
2103
|
/** Returns true if IndexedDB is available in the current environment. */
|
|
2104
2104
|
static isAvailable() {
|
|
2105
|
-
if (!util
|
|
2105
|
+
if (!util.isIndexedDBAvailable()) {
|
|
2106
2106
|
return false;
|
|
2107
2107
|
}
|
|
2108
2108
|
if (SimpleDb.isMockPersistence()) {
|
|
@@ -2115,7 +2115,7 @@ class SimpleDb {
|
|
|
2115
2115
|
// For tracking support of this feature, see here:
|
|
2116
2116
|
// https://developer.microsoft.com/en-us/microsoft-edge/platform/status/indexeddbarraysandmultientrysupport/
|
|
2117
2117
|
// Check the UA string to find out the browser.
|
|
2118
|
-
const ua = util
|
|
2118
|
+
const ua = util.getUA();
|
|
2119
2119
|
// IE 10
|
|
2120
2120
|
// ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)';
|
|
2121
2121
|
// IE 11
|
|
@@ -2602,7 +2602,7 @@ function wrapRequest(request) {
|
|
|
2602
2602
|
// Guard so we only report the error once.
|
|
2603
2603
|
let reportedIOSError = false;
|
|
2604
2604
|
function checkForAndReportiOSError(error) {
|
|
2605
|
-
const iOSVersion = SimpleDb.getIOSVersion(util
|
|
2605
|
+
const iOSVersion = SimpleDb.getIOSVersion(util.getUA());
|
|
2606
2606
|
if (iOSVersion >= 12.2 && iOSVersion < 13) {
|
|
2607
2607
|
const IOS_ERROR = 'An internal error was encountered in the Indexed Database server';
|
|
2608
2608
|
if (error.message.indexOf(IOS_ERROR) >= 0) {
|
|
@@ -15246,7 +15246,7 @@ class IndexedDbPersistence {
|
|
|
15246
15246
|
// accesses internal state. We execute this code directly during shutdown
|
|
15247
15247
|
// to make sure it gets a chance to run.
|
|
15248
15248
|
this.markClientZombied();
|
|
15249
|
-
if (util
|
|
15249
|
+
if (util.isSafari() && navigator.appVersion.match(/Version\/1[45]/)) {
|
|
15250
15250
|
// On Safari 14 and 15, we do not run any cleanup actions as it might
|
|
15251
15251
|
// trigger a bug that prevents Safari from re-opening IndexedDB during
|
|
15252
15252
|
// the next page load.
|
|
@@ -20519,13 +20519,13 @@ function newSerializer(databaseId) {
|
|
|
20519
20519
|
* An instance of the Platform's 'TextEncoder' implementation.
|
|
20520
20520
|
*/
|
|
20521
20521
|
function newTextEncoder() {
|
|
20522
|
-
return new util.TextEncoder();
|
|
20522
|
+
return new util$1.TextEncoder();
|
|
20523
20523
|
}
|
|
20524
20524
|
/**
|
|
20525
20525
|
* An instance of the Platform's 'TextDecoder' implementation.
|
|
20526
20526
|
*/
|
|
20527
20527
|
function newTextDecoder() {
|
|
20528
|
-
return new util.TextDecoder('utf-8');
|
|
20528
|
+
return new util$1.TextDecoder('utf-8');
|
|
20529
20529
|
}
|
|
20530
20530
|
|
|
20531
20531
|
/**
|
|
@@ -25920,7 +25920,7 @@ function connectFirestoreEmulator(firestore, host, port, options = {}) {
|
|
|
25920
25920
|
else {
|
|
25921
25921
|
// Let createMockUserToken validate first (catches common mistakes like
|
|
25922
25922
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
25923
|
-
token = util
|
|
25923
|
+
token = util.createMockUserToken(options.mockUserToken, (_a = firestore._app) === null || _a === void 0 ? void 0 : _a.options.projectId);
|
|
25924
25924
|
const uid = options.mockUserToken.sub || options.mockUserToken.user_id;
|
|
25925
25925
|
if (!uid) {
|
|
25926
25926
|
throw new FirestoreError(Code.INVALID_ARGUMENT, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
@@ -26055,7 +26055,7 @@ class CollectionReference extends Query {
|
|
|
26055
26055
|
}
|
|
26056
26056
|
}
|
|
26057
26057
|
function collection(parent, path, ...pathSegments) {
|
|
26058
|
-
parent = util
|
|
26058
|
+
parent = util.getModularInstance(parent);
|
|
26059
26059
|
validateNonEmptyArgument('collection', 'path', path);
|
|
26060
26060
|
if (parent instanceof Firestore$1) {
|
|
26061
26061
|
const absolutePath = ResourcePath.fromString(path, ...pathSegments);
|
|
@@ -26098,7 +26098,7 @@ function collectionGroup(firestore, collectionId) {
|
|
|
26098
26098
|
/* converter= */ null, newQueryForCollectionGroup(collectionId));
|
|
26099
26099
|
}
|
|
26100
26100
|
function doc(parent, path, ...pathSegments) {
|
|
26101
|
-
parent = util
|
|
26101
|
+
parent = util.getModularInstance(parent);
|
|
26102
26102
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
26103
26103
|
// 'undefined' and 'null'.
|
|
26104
26104
|
if (arguments.length === 1) {
|
|
@@ -26131,8 +26131,8 @@ function doc(parent, path, ...pathSegments) {
|
|
|
26131
26131
|
* Firestore database.
|
|
26132
26132
|
*/
|
|
26133
26133
|
function refEqual(left, right) {
|
|
26134
|
-
left = util
|
|
26135
|
-
right = util
|
|
26134
|
+
left = util.getModularInstance(left);
|
|
26135
|
+
right = util.getModularInstance(right);
|
|
26136
26136
|
if ((left instanceof DocumentReference ||
|
|
26137
26137
|
left instanceof CollectionReference) &&
|
|
26138
26138
|
(right instanceof DocumentReference || right instanceof CollectionReference)) {
|
|
@@ -26152,8 +26152,8 @@ function refEqual(left, right) {
|
|
|
26152
26152
|
* Firestore database.
|
|
26153
26153
|
*/
|
|
26154
26154
|
function queryEqual(left, right) {
|
|
26155
|
-
left = util
|
|
26156
|
-
right = util
|
|
26155
|
+
left = util.getModularInstance(left);
|
|
26156
|
+
right = util.getModularInstance(right);
|
|
26157
26157
|
if (left instanceof Query && right instanceof Query) {
|
|
26158
26158
|
return (left.firestore === right.firestore &&
|
|
26159
26159
|
queryEquals(left._query, right._query) &&
|
|
@@ -26596,7 +26596,7 @@ function initializeFirestore(app$1, settings, databaseId) {
|
|
|
26596
26596
|
identifier: databaseId
|
|
26597
26597
|
});
|
|
26598
26598
|
const initialSettings = provider.getOptions(databaseId);
|
|
26599
|
-
if (util
|
|
26599
|
+
if (util.deepEqual(initialSettings, settings)) {
|
|
26600
26600
|
return existingInstance;
|
|
26601
26601
|
}
|
|
26602
26602
|
else {
|
|
@@ -26625,7 +26625,7 @@ function getFirestore(appOrDatabaseId, optionalDatabaseId) {
|
|
|
26625
26625
|
identifier: databaseId
|
|
26626
26626
|
});
|
|
26627
26627
|
if (!db._initialized) {
|
|
26628
|
-
const emulator = util
|
|
26628
|
+
const emulator = util.getDefaultEmulatorHostnameAndPort('firestore');
|
|
26629
26629
|
if (emulator) {
|
|
26630
26630
|
connectFirestoreEmulator(db, ...emulator);
|
|
26631
26631
|
}
|
|
@@ -27557,7 +27557,7 @@ function parseUpdateData(userDataReader, methodName, targetDoc, input) {
|
|
|
27557
27557
|
const path = fieldPathFromDotSeparatedString(methodName, key, targetDoc);
|
|
27558
27558
|
// For Compat types, we have to "extract" the underlying types before
|
|
27559
27559
|
// performing validation.
|
|
27560
|
-
value = util
|
|
27560
|
+
value = util.getModularInstance(value);
|
|
27561
27561
|
const childContext = context.childContextForFieldPath(path);
|
|
27562
27562
|
if (value instanceof DeleteFieldValueImpl) {
|
|
27563
27563
|
// Add it to the field mask, but don't add anything to updateData.
|
|
@@ -27597,7 +27597,7 @@ function parseUpdateVarargs(userDataReader, methodName, targetDoc, field, value,
|
|
|
27597
27597
|
let value = values[i];
|
|
27598
27598
|
// For Compat types, we have to "extract" the underlying types before
|
|
27599
27599
|
// performing validation.
|
|
27600
|
-
value = util
|
|
27600
|
+
value = util.getModularInstance(value);
|
|
27601
27601
|
const childContext = context.childContextForFieldPath(path);
|
|
27602
27602
|
if (value instanceof DeleteFieldValueImpl) {
|
|
27603
27603
|
// Add it to the field mask, but don't add anything to updateData.
|
|
@@ -27639,7 +27639,7 @@ function parseQueryValue(userDataReader, methodName, input, allowArrays = false)
|
|
|
27639
27639
|
function parseData(input, context) {
|
|
27640
27640
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
27641
27641
|
// from firestore-exp.
|
|
27642
|
-
input = util
|
|
27642
|
+
input = util.getModularInstance(input);
|
|
27643
27643
|
if (looksLikeJsonObject(input)) {
|
|
27644
27644
|
validatePlainObject('Unsupported field value:', context, input);
|
|
27645
27645
|
return parseObject(input, context);
|
|
@@ -27740,7 +27740,7 @@ function parseSentinelFieldValue(value, context) {
|
|
|
27740
27740
|
* @returns The parsed value
|
|
27741
27741
|
*/
|
|
27742
27742
|
function parseScalarValue(value, context) {
|
|
27743
|
-
value = util
|
|
27743
|
+
value = util.getModularInstance(value);
|
|
27744
27744
|
if (value === null) {
|
|
27745
27745
|
return { nullValue: 'NULL_VALUE' };
|
|
27746
27746
|
}
|
|
@@ -27831,7 +27831,7 @@ function validatePlainObject(message, context, input) {
|
|
|
27831
27831
|
function fieldPathFromArgument$1(methodName, path, targetDoc) {
|
|
27832
27832
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
27833
27833
|
// FieldPath.
|
|
27834
|
-
path = util
|
|
27834
|
+
path = util.getModularInstance(path);
|
|
27835
27835
|
if (path instanceof FieldPath) {
|
|
27836
27836
|
return path._internalPath;
|
|
27837
27837
|
}
|
|
@@ -28216,7 +28216,7 @@ function endAt(...docOrFields) {
|
|
|
28216
28216
|
}
|
|
28217
28217
|
/** Helper function to create a bound from a document or fields */
|
|
28218
28218
|
function newQueryBoundFromDocOrFields(query, methodName, docOrFields, inclusive) {
|
|
28219
|
-
docOrFields[0] = util
|
|
28219
|
+
docOrFields[0] = util.getModularInstance(docOrFields[0]);
|
|
28220
28220
|
if (docOrFields[0] instanceof DocumentSnapshot$1) {
|
|
28221
28221
|
return newQueryBoundFromDocument(query._query, query.firestore._databaseId, methodName, docOrFields[0]._document, inclusive);
|
|
28222
28222
|
}
|
|
@@ -28367,7 +28367,7 @@ function newQueryBoundFromFields(query, databaseId, dataReader, methodName, valu
|
|
|
28367
28367
|
* or `string`, or if the string is malformed.
|
|
28368
28368
|
*/
|
|
28369
28369
|
function parseDocumentIdValue(databaseId, query, documentIdValue) {
|
|
28370
|
-
documentIdValue = util
|
|
28370
|
+
documentIdValue = util.getModularInstance(documentIdValue);
|
|
28371
28371
|
if (typeof documentIdValue === 'string') {
|
|
28372
28372
|
if (documentIdValue === '') {
|
|
28373
28373
|
throw new FirestoreError(Code.INVALID_ARGUMENT, 'Invalid query. When querying with documentId(), you ' +
|
|
@@ -28871,6 +28871,7 @@ function changesFromSnapshot(querySnapshot, includeMetadataChanges) {
|
|
|
28871
28871
|
let index = 0;
|
|
28872
28872
|
return querySnapshot._snapshot.docChanges.map(change => {
|
|
28873
28873
|
const doc = new QueryDocumentSnapshot(querySnapshot._firestore, querySnapshot._userDataWriter, change.doc.key, change.doc, new SnapshotMetadata(querySnapshot._snapshot.mutatedKeys.has(change.doc.key), querySnapshot._snapshot.fromCache), querySnapshot.query.converter);
|
|
28874
|
+
change.doc;
|
|
28874
28875
|
return {
|
|
28875
28876
|
type: 'added',
|
|
28876
28877
|
doc,
|
|
@@ -29084,7 +29085,7 @@ function updateDoc(reference, fieldOrUpdateData, value, ...moreFieldsAndValues)
|
|
|
29084
29085
|
const dataReader = newUserDataReader(firestore);
|
|
29085
29086
|
// For Compat types, we have to "extract" the underlying types before
|
|
29086
29087
|
// performing validation.
|
|
29087
|
-
fieldOrUpdateData = util
|
|
29088
|
+
fieldOrUpdateData = util.getModularInstance(fieldOrUpdateData);
|
|
29088
29089
|
let parsed;
|
|
29089
29090
|
if (typeof fieldOrUpdateData === 'string' ||
|
|
29090
29091
|
fieldOrUpdateData instanceof FieldPath) {
|
|
@@ -29129,7 +29130,7 @@ function addDoc(reference, data) {
|
|
|
29129
29130
|
}
|
|
29130
29131
|
function onSnapshot(reference, ...args) {
|
|
29131
29132
|
var _a, _b, _c;
|
|
29132
|
-
reference = util
|
|
29133
|
+
reference = util.getModularInstance(reference);
|
|
29133
29134
|
let options = {
|
|
29134
29135
|
includeMetadataChanges: false
|
|
29135
29136
|
};
|
|
@@ -29239,7 +29240,7 @@ function convertToDocSnapshot(firestore, ref, snapshot) {
|
|
|
29239
29240
|
* otherwise.
|
|
29240
29241
|
*/
|
|
29241
29242
|
function aggregateQuerySnapshotEqual(left, right) {
|
|
29242
|
-
return (queryEqual(left.query, right.query) && util
|
|
29243
|
+
return (queryEqual(left.query, right.query) && util.deepEqual(left.data(), right.data()));
|
|
29243
29244
|
}
|
|
29244
29245
|
|
|
29245
29246
|
/**
|
|
@@ -29357,7 +29358,7 @@ class WriteBatch {
|
|
|
29357
29358
|
const ref = validateReference(documentRef, this._firestore);
|
|
29358
29359
|
// For Compat types, we have to "extract" the underlying types before
|
|
29359
29360
|
// performing validation.
|
|
29360
|
-
fieldOrUpdateData = util
|
|
29361
|
+
fieldOrUpdateData = util.getModularInstance(fieldOrUpdateData);
|
|
29361
29362
|
let parsed;
|
|
29362
29363
|
if (typeof fieldOrUpdateData === 'string' ||
|
|
29363
29364
|
fieldOrUpdateData instanceof FieldPath) {
|
|
@@ -29409,7 +29410,7 @@ class WriteBatch {
|
|
|
29409
29410
|
}
|
|
29410
29411
|
}
|
|
29411
29412
|
function validateReference(documentRef, firestore) {
|
|
29412
|
-
documentRef = util
|
|
29413
|
+
documentRef = util.getModularInstance(documentRef);
|
|
29413
29414
|
if (documentRef.firestore !== firestore) {
|
|
29414
29415
|
throw new FirestoreError(Code.INVALID_ARGUMENT, 'Provided document reference is from a different Firestore instance.');
|
|
29415
29416
|
}
|
|
@@ -29486,7 +29487,7 @@ class Transaction$1 {
|
|
|
29486
29487
|
const ref = validateReference(documentRef, this._firestore);
|
|
29487
29488
|
// For Compat types, we have to "extract" the underlying types before
|
|
29488
29489
|
// performing validation.
|
|
29489
|
-
fieldOrUpdateData = util
|
|
29490
|
+
fieldOrUpdateData = util.getModularInstance(fieldOrUpdateData);
|
|
29490
29491
|
let parsed;
|
|
29491
29492
|
if (typeof fieldOrUpdateData === 'string' ||
|
|
29492
29493
|
fieldOrUpdateData instanceof FieldPath) {
|