@firebase/firestore 3.4.3 → 3.4.4-202202622812
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 +10 -0
- package/dist/firestore/src/api/database.d.ts +14 -9
- package/dist/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/firestore/src/api.d.ts +1 -0
- package/dist/firestore/src/core/firestore_client.d.ts +2 -0
- package/dist/firestore/src/model/field_index.d.ts +76 -0
- package/dist/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/index.d.ts +15 -9
- package/dist/index.esm2017.js +663 -602
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +680 -617
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +100 -13
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +100 -14
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +705 -602
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +120 -9
- package/dist/lite/firestore/src/api/database.d.ts +14 -9
- package/dist/lite/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/lite/firestore/src/api.d.ts +1 -0
- package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -0
- package/dist/lite/firestore/src/model/field_index.d.ts +76 -0
- package/dist/lite/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +2 -2
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +2 -2
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/src/api/database.d.ts +14 -9
- package/dist/lite/packages/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/lite/packages/firestore/src/api.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -0
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +76 -0
- package/dist/lite/packages/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/packages/firestore/dist/index.esm2017.d.ts +152 -131
- package/dist/packages/firestore/src/api/database.d.ts +14 -9
- package/dist/packages/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/packages/firestore/src/api.d.ts +1 -0
- package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -0
- package/dist/packages/firestore/src/model/field_index.d.ts +76 -0
- package/dist/packages/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/private.d.ts +24 -9
- package/package.json +5 -5
package/dist/index.node.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { credentials, loadPackageDefinition, Metadata } from '@grpc/grpc-js';
|
|
|
8
8
|
import { fromJSON } from '@grpc/proto-loader';
|
|
9
9
|
|
|
10
10
|
const name = "@firebase/firestore";
|
|
11
|
-
const version$1 = "3.4.
|
|
11
|
+
const version$1 = "3.4.4-202202622812";
|
|
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.6.
|
|
64
|
+
const version = "9.6.5-202202622812";
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* @license
|
|
@@ -21878,13 +21878,16 @@ class FirestoreClient {
|
|
|
21878
21878
|
this.user = User.UNAUTHENTICATED;
|
|
21879
21879
|
this.clientId = AutoId.newId();
|
|
21880
21880
|
this.authCredentialListener = () => Promise.resolve();
|
|
21881
|
+
this.appCheckCredentialListener = () => Promise.resolve();
|
|
21881
21882
|
this.authCredentials.start(asyncQueue, async (user) => {
|
|
21882
21883
|
logDebug(LOG_TAG$2, 'Received user=', user.uid);
|
|
21883
21884
|
await this.authCredentialListener(user);
|
|
21884
21885
|
this.user = user;
|
|
21885
21886
|
});
|
|
21886
|
-
|
|
21887
|
-
|
|
21887
|
+
this.appCheckCredentials.start(asyncQueue, newAppCheckToken => {
|
|
21888
|
+
logDebug(LOG_TAG$2, 'Received new app check token=', newAppCheckToken);
|
|
21889
|
+
return this.appCheckCredentialListener(newAppCheckToken, this.user);
|
|
21890
|
+
});
|
|
21888
21891
|
}
|
|
21889
21892
|
async getConfiguration() {
|
|
21890
21893
|
return {
|
|
@@ -21900,6 +21903,9 @@ class FirestoreClient {
|
|
|
21900
21903
|
setCredentialChangeListener(listener) {
|
|
21901
21904
|
this.authCredentialListener = listener;
|
|
21902
21905
|
}
|
|
21906
|
+
setAppCheckTokenChangeListener(listener) {
|
|
21907
|
+
this.appCheckCredentialListener = listener;
|
|
21908
|
+
}
|
|
21903
21909
|
/**
|
|
21904
21910
|
* Checks that the client has not been terminated. Ensures that other methods on
|
|
21905
21911
|
* this class cannot be called after the client is terminated.
|
|
@@ -21961,6 +21967,7 @@ async function setOnlineComponentProvider(client, onlineComponentProvider) {
|
|
|
21961
21967
|
// The CredentialChangeListener of the online component provider takes
|
|
21962
21968
|
// precedence over the offline component provider.
|
|
21963
21969
|
client.setCredentialChangeListener(user => remoteStoreHandleCredentialChange(onlineComponentProvider.remoteStore, user));
|
|
21970
|
+
client.setAppCheckTokenChangeListener((_, user) => remoteStoreHandleCredentialChange(onlineComponentProvider.remoteStore, user));
|
|
21964
21971
|
client.onlineComponents = onlineComponentProvider;
|
|
21965
21972
|
}
|
|
21966
21973
|
async function ensureOfflineComponents(client) {
|
|
@@ -23513,13 +23520,13 @@ function terminate(firestore) {
|
|
|
23513
23520
|
/**
|
|
23514
23521
|
* Loads a Firestore bundle into the local cache.
|
|
23515
23522
|
*
|
|
23516
|
-
* @param firestore - The {@link Firestore} instance to load bundles for
|
|
23517
|
-
* @param bundleData - An object representing the bundle to be loaded. Valid
|
|
23518
|
-
*
|
|
23523
|
+
* @param firestore - The {@link Firestore} instance to load bundles for.
|
|
23524
|
+
* @param bundleData - An object representing the bundle to be loaded. Valid
|
|
23525
|
+
* objects are `ArrayBuffer`, `ReadableStream<Uint8Array>` or `string`.
|
|
23519
23526
|
*
|
|
23520
|
-
* @returns
|
|
23521
|
-
*
|
|
23522
|
-
*
|
|
23527
|
+
* @returns A `LoadBundleTask` object, which notifies callers with progress
|
|
23528
|
+
* updates, and completion or error events. It can be used as a
|
|
23529
|
+
* `Promise<LoadBundleTaskProgress>`.
|
|
23523
23530
|
*/
|
|
23524
23531
|
function loadBundle(firestore, bundleData) {
|
|
23525
23532
|
firestore = cast(firestore, Firestore);
|
|
@@ -23529,11 +23536,16 @@ function loadBundle(firestore, bundleData) {
|
|
|
23529
23536
|
return resultTask;
|
|
23530
23537
|
}
|
|
23531
23538
|
/**
|
|
23532
|
-
* Reads a Firestore {@link Query} from local cache, identified by the given
|
|
23539
|
+
* Reads a Firestore {@link Query} from local cache, identified by the given
|
|
23540
|
+
* name.
|
|
23533
23541
|
*
|
|
23534
23542
|
* The named queries are packaged into bundles on the server side (along
|
|
23535
|
-
* with resulting documents), and loaded to local cache using `loadBundle`. Once
|
|
23536
|
-
* cache, use this method to extract a {@link Query} by name.
|
|
23543
|
+
* with resulting documents), and loaded to local cache using `loadBundle`. Once
|
|
23544
|
+
* in local cache, use this method to extract a {@link Query} by name.
|
|
23545
|
+
*
|
|
23546
|
+
* @param firestore - The {@link Firestore} instance to read the query from.
|
|
23547
|
+
* @param name - The name of the query.
|
|
23548
|
+
* @returns A `Promise` that is resolved with the Query or `null`.
|
|
23537
23549
|
*/
|
|
23538
23550
|
function namedQuery(firestore, name) {
|
|
23539
23551
|
firestore = cast(firestore, Firestore);
|
|
@@ -26222,6 +26234,80 @@ function writeBatch(firestore) {
|
|
|
26222
26234
|
ensureFirestoreConfigured(firestore);
|
|
26223
26235
|
return new WriteBatch(firestore, mutations => executeWrite(firestore, mutations));
|
|
26224
26236
|
}
|
|
26237
|
+
/** An index component consisting of field path and index type. */
|
|
26238
|
+
class Segment {
|
|
26239
|
+
constructor(
|
|
26240
|
+
/** The field path of the component. */
|
|
26241
|
+
fieldPath,
|
|
26242
|
+
/** The fields sorting order. */
|
|
26243
|
+
kind) {
|
|
26244
|
+
this.fieldPath = fieldPath;
|
|
26245
|
+
this.kind = kind;
|
|
26246
|
+
}
|
|
26247
|
+
}
|
|
26248
|
+
|
|
26249
|
+
/**
|
|
26250
|
+
* @license
|
|
26251
|
+
* Copyright 2021 Google LLC
|
|
26252
|
+
*
|
|
26253
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
26254
|
+
* you may not use this file except in compliance with the License.
|
|
26255
|
+
* You may obtain a copy of the License at
|
|
26256
|
+
*
|
|
26257
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
26258
|
+
*
|
|
26259
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
26260
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
26261
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26262
|
+
* See the License for the specific language governing permissions and
|
|
26263
|
+
* limitations under the License.
|
|
26264
|
+
*/
|
|
26265
|
+
function setIndexConfiguration(firestore, jsonOrConfiguration) {
|
|
26266
|
+
firestore = cast(firestore, Firestore);
|
|
26267
|
+
ensureFirestoreConfigured(firestore);
|
|
26268
|
+
const indexConfiguration = typeof jsonOrConfiguration === 'string'
|
|
26269
|
+
? tryParseJson(jsonOrConfiguration)
|
|
26270
|
+
: jsonOrConfiguration;
|
|
26271
|
+
// PORTING NOTE: We don't return an error if the user has not enabled
|
|
26272
|
+
// persistence since `enableIndexeddbPersistence()` can fail on the Web.
|
|
26273
|
+
if (Array.isArray(indexConfiguration.indexes)) {
|
|
26274
|
+
for (const index of indexConfiguration.indexes) {
|
|
26275
|
+
tryGetString(index, 'collectionGroup');
|
|
26276
|
+
const segments = [];
|
|
26277
|
+
if (Array.isArray(index.fields)) {
|
|
26278
|
+
for (const field of index.fields) {
|
|
26279
|
+
const fieldPathString = tryGetString(field, 'fieldPath');
|
|
26280
|
+
const fieldPath = fieldPathFromDotSeparatedString('setIndexConfiguration', fieldPathString);
|
|
26281
|
+
if (field.arrayConfig === 'CONTAINS') {
|
|
26282
|
+
segments.push(new Segment(fieldPath, 2 /* CONTAINS */));
|
|
26283
|
+
}
|
|
26284
|
+
else if (field.order === 'ASCENDING') {
|
|
26285
|
+
segments.push(new Segment(fieldPath, 0 /* ASCENDING */));
|
|
26286
|
+
}
|
|
26287
|
+
else if (field.order === 'DESCENDING') {
|
|
26288
|
+
segments.push(new Segment(fieldPath, 1 /* DESCENDING */));
|
|
26289
|
+
}
|
|
26290
|
+
}
|
|
26291
|
+
}
|
|
26292
|
+
}
|
|
26293
|
+
}
|
|
26294
|
+
// TODO(indexing): Configure indexes
|
|
26295
|
+
return Promise.resolve();
|
|
26296
|
+
}
|
|
26297
|
+
function tryParseJson(json) {
|
|
26298
|
+
try {
|
|
26299
|
+
return JSON.parse(json);
|
|
26300
|
+
}
|
|
26301
|
+
catch (e) {
|
|
26302
|
+
throw new FirestoreError(Code.INVALID_ARGUMENT, 'Failed to parse JSON:' + e.message);
|
|
26303
|
+
}
|
|
26304
|
+
}
|
|
26305
|
+
function tryGetString(data, property) {
|
|
26306
|
+
if (typeof data[property] !== 'string') {
|
|
26307
|
+
throw new FirestoreError(Code.INVALID_ARGUMENT, 'Missing string value for: ' + property);
|
|
26308
|
+
}
|
|
26309
|
+
return data[property];
|
|
26310
|
+
}
|
|
26225
26311
|
|
|
26226
26312
|
/**
|
|
26227
26313
|
* @license
|
|
@@ -26241,5 +26327,5 @@ function writeBatch(firestore) {
|
|
|
26241
26327
|
*/
|
|
26242
26328
|
registerFirestore('node');
|
|
26243
26329
|
|
|
26244
|
-
export { AbstractUserDataWriter, Bytes, CACHE_SIZE_UNLIMITED, CollectionReference, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Firestore, FirestoreError, GeoPoint, LoadBundleTask, Query, QueryConstraint, QueryDocumentSnapshot, QuerySnapshot, SnapshotMetadata, Timestamp, Transaction, WriteBatch, DatabaseId as _DatabaseId, DocumentKey as _DocumentKey, EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider, EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider, FieldPath$1 as _FieldPath, cast as _cast, debugAssert as _debugAssert, isBase64Available as _isBase64Available, logWarn as _logWarn, validateIsNotUsedTogether as _validateIsNotUsedTogether, addDoc, arrayRemove, arrayUnion, clearIndexedDbPersistence, collection, collectionGroup, connectFirestoreEmulator, deleteDoc, deleteField, disableNetwork, doc, documentId, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, endAt, endBefore, ensureFirestoreConfigured, executeWrite, getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, getFirestore, increment, initializeFirestore, limit, limitToLast, loadBundle, namedQuery, onSnapshot, onSnapshotsInSync, orderBy, query, queryEqual, refEqual, runTransaction, serverTimestamp, setDoc, setLogLevel, snapshotEqual, startAfter, startAt, terminate, updateDoc, waitForPendingWrites, where, writeBatch };
|
|
26330
|
+
export { AbstractUserDataWriter, Bytes, CACHE_SIZE_UNLIMITED, CollectionReference, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Firestore, FirestoreError, GeoPoint, LoadBundleTask, Query, QueryConstraint, QueryDocumentSnapshot, QuerySnapshot, SnapshotMetadata, Timestamp, Transaction, WriteBatch, DatabaseId as _DatabaseId, DocumentKey as _DocumentKey, EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider, EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider, FieldPath$1 as _FieldPath, cast as _cast, debugAssert as _debugAssert, isBase64Available as _isBase64Available, logWarn as _logWarn, setIndexConfiguration as _setIndexConfiguration, validateIsNotUsedTogether as _validateIsNotUsedTogether, addDoc, arrayRemove, arrayUnion, clearIndexedDbPersistence, collection, collectionGroup, connectFirestoreEmulator, deleteDoc, deleteField, disableNetwork, doc, documentId, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, endAt, endBefore, ensureFirestoreConfigured, executeWrite, getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, getFirestore, increment, initializeFirestore, limit, limitToLast, loadBundle, namedQuery, onSnapshot, onSnapshotsInSync, orderBy, query, queryEqual, refEqual, runTransaction, serverTimestamp, setDoc, setLogLevel, snapshotEqual, startAfter, startAt, terminate, updateDoc, waitForPendingWrites, where, writeBatch };
|
|
26245
26331
|
//# sourceMappingURL=index.node.mjs.map
|