@firebase/firestore 3.7.1 → 3.7.2-canary.457fc2eeb
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 +249 -243
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +637 -633
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +38 -36
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +5 -3
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +249 -243
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/index.browser.esm2017.js +186 -180
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +350 -344
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +10 -3
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +10 -3
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +192 -186
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +26 -26
- package/dist/packages/firestore/dist/index.esm2017.d.ts +1 -1
- package/package.json +11 -11
- 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-canary.457fc2eeb";
|
|
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-canary.457fc2eeb";
|
|
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
|
/**
|
|
@@ -24680,7 +24680,7 @@ class AsyncObserver {
|
|
|
24680
24680
|
this.scheduleEvent(this.observer.error, error);
|
|
24681
24681
|
}
|
|
24682
24682
|
else {
|
|
24683
|
-
logError('Uncaught Error in snapshot listener:', error);
|
|
24683
|
+
logError('Uncaught Error in snapshot listener:', error.toString());
|
|
24684
24684
|
}
|
|
24685
24685
|
}
|
|
24686
24686
|
mute() {
|
|
@@ -25237,6 +25237,7 @@ class TransactionRunner {
|
|
|
25237
25237
|
const code = error.code;
|
|
25238
25238
|
return (code === 'aborted' ||
|
|
25239
25239
|
code === 'failed-precondition' ||
|
|
25240
|
+
code === 'already-exists' ||
|
|
25240
25241
|
!isPermanentError(code));
|
|
25241
25242
|
}
|
|
25242
25243
|
return false;
|
|
@@ -25920,7 +25921,7 @@ function connectFirestoreEmulator(firestore, host, port, options = {}) {
|
|
|
25920
25921
|
else {
|
|
25921
25922
|
// Let createMockUserToken validate first (catches common mistakes like
|
|
25922
25923
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
25923
|
-
token = util
|
|
25924
|
+
token = util.createMockUserToken(options.mockUserToken, (_a = firestore._app) === null || _a === void 0 ? void 0 : _a.options.projectId);
|
|
25924
25925
|
const uid = options.mockUserToken.sub || options.mockUserToken.user_id;
|
|
25925
25926
|
if (!uid) {
|
|
25926
25927
|
throw new FirestoreError(Code.INVALID_ARGUMENT, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
@@ -26055,7 +26056,7 @@ class CollectionReference extends Query {
|
|
|
26055
26056
|
}
|
|
26056
26057
|
}
|
|
26057
26058
|
function collection(parent, path, ...pathSegments) {
|
|
26058
|
-
parent = util
|
|
26059
|
+
parent = util.getModularInstance(parent);
|
|
26059
26060
|
validateNonEmptyArgument('collection', 'path', path);
|
|
26060
26061
|
if (parent instanceof Firestore$1) {
|
|
26061
26062
|
const absolutePath = ResourcePath.fromString(path, ...pathSegments);
|
|
@@ -26098,7 +26099,7 @@ function collectionGroup(firestore, collectionId) {
|
|
|
26098
26099
|
/* converter= */ null, newQueryForCollectionGroup(collectionId));
|
|
26099
26100
|
}
|
|
26100
26101
|
function doc(parent, path, ...pathSegments) {
|
|
26101
|
-
parent = util
|
|
26102
|
+
parent = util.getModularInstance(parent);
|
|
26102
26103
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
26103
26104
|
// 'undefined' and 'null'.
|
|
26104
26105
|
if (arguments.length === 1) {
|
|
@@ -26131,8 +26132,8 @@ function doc(parent, path, ...pathSegments) {
|
|
|
26131
26132
|
* Firestore database.
|
|
26132
26133
|
*/
|
|
26133
26134
|
function refEqual(left, right) {
|
|
26134
|
-
left = util
|
|
26135
|
-
right = util
|
|
26135
|
+
left = util.getModularInstance(left);
|
|
26136
|
+
right = util.getModularInstance(right);
|
|
26136
26137
|
if ((left instanceof DocumentReference ||
|
|
26137
26138
|
left instanceof CollectionReference) &&
|
|
26138
26139
|
(right instanceof DocumentReference || right instanceof CollectionReference)) {
|
|
@@ -26152,8 +26153,8 @@ function refEqual(left, right) {
|
|
|
26152
26153
|
* Firestore database.
|
|
26153
26154
|
*/
|
|
26154
26155
|
function queryEqual(left, right) {
|
|
26155
|
-
left = util
|
|
26156
|
-
right = util
|
|
26156
|
+
left = util.getModularInstance(left);
|
|
26157
|
+
right = util.getModularInstance(right);
|
|
26157
26158
|
if (left instanceof Query && right instanceof Query) {
|
|
26158
26159
|
return (left.firestore === right.firestore &&
|
|
26159
26160
|
queryEquals(left._query, right._query) &&
|
|
@@ -26596,7 +26597,7 @@ function initializeFirestore(app$1, settings, databaseId) {
|
|
|
26596
26597
|
identifier: databaseId
|
|
26597
26598
|
});
|
|
26598
26599
|
const initialSettings = provider.getOptions(databaseId);
|
|
26599
|
-
if (util
|
|
26600
|
+
if (util.deepEqual(initialSettings, settings)) {
|
|
26600
26601
|
return existingInstance;
|
|
26601
26602
|
}
|
|
26602
26603
|
else {
|
|
@@ -26625,7 +26626,7 @@ function getFirestore(appOrDatabaseId, optionalDatabaseId) {
|
|
|
26625
26626
|
identifier: databaseId
|
|
26626
26627
|
});
|
|
26627
26628
|
if (!db._initialized) {
|
|
26628
|
-
const emulator = util
|
|
26629
|
+
const emulator = util.getDefaultEmulatorHostnameAndPort('firestore');
|
|
26629
26630
|
if (emulator) {
|
|
26630
26631
|
connectFirestoreEmulator(db, ...emulator);
|
|
26631
26632
|
}
|
|
@@ -27557,7 +27558,7 @@ function parseUpdateData(userDataReader, methodName, targetDoc, input) {
|
|
|
27557
27558
|
const path = fieldPathFromDotSeparatedString(methodName, key, targetDoc);
|
|
27558
27559
|
// For Compat types, we have to "extract" the underlying types before
|
|
27559
27560
|
// performing validation.
|
|
27560
|
-
value = util
|
|
27561
|
+
value = util.getModularInstance(value);
|
|
27561
27562
|
const childContext = context.childContextForFieldPath(path);
|
|
27562
27563
|
if (value instanceof DeleteFieldValueImpl) {
|
|
27563
27564
|
// Add it to the field mask, but don't add anything to updateData.
|
|
@@ -27597,7 +27598,7 @@ function parseUpdateVarargs(userDataReader, methodName, targetDoc, field, value,
|
|
|
27597
27598
|
let value = values[i];
|
|
27598
27599
|
// For Compat types, we have to "extract" the underlying types before
|
|
27599
27600
|
// performing validation.
|
|
27600
|
-
value = util
|
|
27601
|
+
value = util.getModularInstance(value);
|
|
27601
27602
|
const childContext = context.childContextForFieldPath(path);
|
|
27602
27603
|
if (value instanceof DeleteFieldValueImpl) {
|
|
27603
27604
|
// Add it to the field mask, but don't add anything to updateData.
|
|
@@ -27639,7 +27640,7 @@ function parseQueryValue(userDataReader, methodName, input, allowArrays = false)
|
|
|
27639
27640
|
function parseData(input, context) {
|
|
27640
27641
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
27641
27642
|
// from firestore-exp.
|
|
27642
|
-
input = util
|
|
27643
|
+
input = util.getModularInstance(input);
|
|
27643
27644
|
if (looksLikeJsonObject(input)) {
|
|
27644
27645
|
validatePlainObject('Unsupported field value:', context, input);
|
|
27645
27646
|
return parseObject(input, context);
|
|
@@ -27740,7 +27741,7 @@ function parseSentinelFieldValue(value, context) {
|
|
|
27740
27741
|
* @returns The parsed value
|
|
27741
27742
|
*/
|
|
27742
27743
|
function parseScalarValue(value, context) {
|
|
27743
|
-
value = util
|
|
27744
|
+
value = util.getModularInstance(value);
|
|
27744
27745
|
if (value === null) {
|
|
27745
27746
|
return { nullValue: 'NULL_VALUE' };
|
|
27746
27747
|
}
|
|
@@ -27831,7 +27832,7 @@ function validatePlainObject(message, context, input) {
|
|
|
27831
27832
|
function fieldPathFromArgument$1(methodName, path, targetDoc) {
|
|
27832
27833
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
27833
27834
|
// FieldPath.
|
|
27834
|
-
path = util
|
|
27835
|
+
path = util.getModularInstance(path);
|
|
27835
27836
|
if (path instanceof FieldPath) {
|
|
27836
27837
|
return path._internalPath;
|
|
27837
27838
|
}
|
|
@@ -28216,7 +28217,7 @@ function endAt(...docOrFields) {
|
|
|
28216
28217
|
}
|
|
28217
28218
|
/** Helper function to create a bound from a document or fields */
|
|
28218
28219
|
function newQueryBoundFromDocOrFields(query, methodName, docOrFields, inclusive) {
|
|
28219
|
-
docOrFields[0] = util
|
|
28220
|
+
docOrFields[0] = util.getModularInstance(docOrFields[0]);
|
|
28220
28221
|
if (docOrFields[0] instanceof DocumentSnapshot$1) {
|
|
28221
28222
|
return newQueryBoundFromDocument(query._query, query.firestore._databaseId, methodName, docOrFields[0]._document, inclusive);
|
|
28222
28223
|
}
|
|
@@ -28367,7 +28368,7 @@ function newQueryBoundFromFields(query, databaseId, dataReader, methodName, valu
|
|
|
28367
28368
|
* or `string`, or if the string is malformed.
|
|
28368
28369
|
*/
|
|
28369
28370
|
function parseDocumentIdValue(databaseId, query, documentIdValue) {
|
|
28370
|
-
documentIdValue = util
|
|
28371
|
+
documentIdValue = util.getModularInstance(documentIdValue);
|
|
28371
28372
|
if (typeof documentIdValue === 'string') {
|
|
28372
28373
|
if (documentIdValue === '') {
|
|
28373
28374
|
throw new FirestoreError(Code.INVALID_ARGUMENT, 'Invalid query. When querying with documentId(), you ' +
|
|
@@ -28871,6 +28872,7 @@ function changesFromSnapshot(querySnapshot, includeMetadataChanges) {
|
|
|
28871
28872
|
let index = 0;
|
|
28872
28873
|
return querySnapshot._snapshot.docChanges.map(change => {
|
|
28873
28874
|
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);
|
|
28875
|
+
change.doc;
|
|
28874
28876
|
return {
|
|
28875
28877
|
type: 'added',
|
|
28876
28878
|
doc,
|
|
@@ -29084,7 +29086,7 @@ function updateDoc(reference, fieldOrUpdateData, value, ...moreFieldsAndValues)
|
|
|
29084
29086
|
const dataReader = newUserDataReader(firestore);
|
|
29085
29087
|
// For Compat types, we have to "extract" the underlying types before
|
|
29086
29088
|
// performing validation.
|
|
29087
|
-
fieldOrUpdateData = util
|
|
29089
|
+
fieldOrUpdateData = util.getModularInstance(fieldOrUpdateData);
|
|
29088
29090
|
let parsed;
|
|
29089
29091
|
if (typeof fieldOrUpdateData === 'string' ||
|
|
29090
29092
|
fieldOrUpdateData instanceof FieldPath) {
|
|
@@ -29129,7 +29131,7 @@ function addDoc(reference, data) {
|
|
|
29129
29131
|
}
|
|
29130
29132
|
function onSnapshot(reference, ...args) {
|
|
29131
29133
|
var _a, _b, _c;
|
|
29132
|
-
reference = util
|
|
29134
|
+
reference = util.getModularInstance(reference);
|
|
29133
29135
|
let options = {
|
|
29134
29136
|
includeMetadataChanges: false
|
|
29135
29137
|
};
|
|
@@ -29239,7 +29241,7 @@ function convertToDocSnapshot(firestore, ref, snapshot) {
|
|
|
29239
29241
|
* otherwise.
|
|
29240
29242
|
*/
|
|
29241
29243
|
function aggregateQuerySnapshotEqual(left, right) {
|
|
29242
|
-
return (queryEqual(left.query, right.query) && util
|
|
29244
|
+
return (queryEqual(left.query, right.query) && util.deepEqual(left.data(), right.data()));
|
|
29243
29245
|
}
|
|
29244
29246
|
|
|
29245
29247
|
/**
|
|
@@ -29357,7 +29359,7 @@ class WriteBatch {
|
|
|
29357
29359
|
const ref = validateReference(documentRef, this._firestore);
|
|
29358
29360
|
// For Compat types, we have to "extract" the underlying types before
|
|
29359
29361
|
// performing validation.
|
|
29360
|
-
fieldOrUpdateData = util
|
|
29362
|
+
fieldOrUpdateData = util.getModularInstance(fieldOrUpdateData);
|
|
29361
29363
|
let parsed;
|
|
29362
29364
|
if (typeof fieldOrUpdateData === 'string' ||
|
|
29363
29365
|
fieldOrUpdateData instanceof FieldPath) {
|
|
@@ -29409,7 +29411,7 @@ class WriteBatch {
|
|
|
29409
29411
|
}
|
|
29410
29412
|
}
|
|
29411
29413
|
function validateReference(documentRef, firestore) {
|
|
29412
|
-
documentRef = util
|
|
29414
|
+
documentRef = util.getModularInstance(documentRef);
|
|
29413
29415
|
if (documentRef.firestore !== firestore) {
|
|
29414
29416
|
throw new FirestoreError(Code.INVALID_ARGUMENT, 'Provided document reference is from a different Firestore instance.');
|
|
29415
29417
|
}
|
|
@@ -29486,7 +29488,7 @@ class Transaction$1 {
|
|
|
29486
29488
|
const ref = validateReference(documentRef, this._firestore);
|
|
29487
29489
|
// For Compat types, we have to "extract" the underlying types before
|
|
29488
29490
|
// performing validation.
|
|
29489
|
-
fieldOrUpdateData = util
|
|
29491
|
+
fieldOrUpdateData = util.getModularInstance(fieldOrUpdateData);
|
|
29490
29492
|
let parsed;
|
|
29491
29493
|
if (typeof fieldOrUpdateData === 'string' ||
|
|
29492
29494
|
fieldOrUpdateData instanceof FieldPath) {
|