@firebase/firestore 3.4.3-202202014332 → 3.4.3-canary.2d04af91d

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.
Files changed (44) hide show
  1. package/dist/firestore/src/api/database.d.ts +14 -9
  2. package/dist/firestore/src/api/index_configuration.d.ts +117 -0
  3. package/dist/firestore/src/api.d.ts +1 -0
  4. package/dist/firestore/src/model/field_index.d.ts +76 -0
  5. package/dist/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
  6. package/dist/index.d.ts +15 -9
  7. package/dist/index.esm2017.js +70 -13
  8. package/dist/index.esm2017.js.map +1 -1
  9. package/dist/index.esm5.js +85 -28
  10. package/dist/index.esm5.js.map +1 -1
  11. package/dist/index.node.cjs.js +91 -11
  12. package/dist/index.node.cjs.js.map +1 -1
  13. package/dist/index.node.mjs +91 -12
  14. package/dist/index.node.mjs.map +1 -1
  15. package/dist/index.rn.js +112 -13
  16. package/dist/index.rn.js.map +1 -1
  17. package/dist/internal.d.ts +118 -9
  18. package/dist/lite/firestore/src/api/database.d.ts +14 -9
  19. package/dist/lite/firestore/src/api/index_configuration.d.ts +117 -0
  20. package/dist/lite/firestore/src/api.d.ts +1 -0
  21. package/dist/lite/firestore/src/model/field_index.d.ts +76 -0
  22. package/dist/lite/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
  23. package/dist/lite/index.browser.esm2017.js +2 -2
  24. package/dist/lite/index.browser.esm2017.js.map +1 -1
  25. package/dist/lite/index.browser.esm5.js +42 -42
  26. package/dist/lite/index.browser.esm5.js.map +1 -1
  27. package/dist/lite/index.node.cjs.js +2 -2
  28. package/dist/lite/index.node.mjs +2 -2
  29. package/dist/lite/index.node.mjs.map +1 -1
  30. package/dist/lite/index.rn.esm2017.js +2 -2
  31. package/dist/lite/index.rn.esm2017.js.map +1 -1
  32. package/dist/lite/packages/firestore/src/api/database.d.ts +14 -9
  33. package/dist/lite/packages/firestore/src/api/index_configuration.d.ts +117 -0
  34. package/dist/lite/packages/firestore/src/api.d.ts +1 -0
  35. package/dist/lite/packages/firestore/src/model/field_index.d.ts +76 -0
  36. package/dist/lite/packages/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
  37. package/dist/packages/firestore/dist/index.esm2017.d.ts +31 -10
  38. package/dist/packages/firestore/src/api/database.d.ts +14 -9
  39. package/dist/packages/firestore/src/api/index_configuration.d.ts +117 -0
  40. package/dist/packages/firestore/src/api.d.ts +1 -0
  41. package/dist/packages/firestore/src/model/field_index.d.ts +76 -0
  42. package/dist/packages/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
  43. package/dist/private.d.ts +22 -9
  44. package/package.json +9 -9
@@ -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.3-202202014332";
11
+ const version$1 = "3.4.3-canary.2d04af91d";
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.4-202202014332";
64
+ const version = "9.6.4-canary.2d04af91d";
65
65
 
66
66
  /**
67
67
  * @license
@@ -23513,13 +23513,13 @@ function terminate(firestore) {
23513
23513
  /**
23514
23514
  * Loads a Firestore bundle into the local cache.
23515
23515
  *
23516
- * @param firestore - The {@link Firestore} instance to load bundles for for.
23517
- * @param bundleData - An object representing the bundle to be loaded. Valid objects are
23518
- * `ArrayBuffer`, `ReadableStream<Uint8Array>` or `string`.
23516
+ * @param firestore - The {@link Firestore} instance to load bundles for.
23517
+ * @param bundleData - An object representing the bundle to be loaded. Valid
23518
+ * objects are `ArrayBuffer`, `ReadableStream<Uint8Array>` or `string`.
23519
23519
  *
23520
- * @returns
23521
- * A `LoadBundleTask` object, which notifies callers with progress updates, and completion
23522
- * or error events. It can be used as a `Promise<LoadBundleTaskProgress>`.
23520
+ * @returns A `LoadBundleTask` object, which notifies callers with progress
23521
+ * updates, and completion or error events. It can be used as a
23522
+ * `Promise<LoadBundleTaskProgress>`.
23523
23523
  */
23524
23524
  function loadBundle(firestore, bundleData) {
23525
23525
  firestore = cast(firestore, Firestore);
@@ -23529,11 +23529,16 @@ function loadBundle(firestore, bundleData) {
23529
23529
  return resultTask;
23530
23530
  }
23531
23531
  /**
23532
- * Reads a Firestore {@link Query} from local cache, identified by the given name.
23532
+ * Reads a Firestore {@link Query} from local cache, identified by the given
23533
+ * name.
23533
23534
  *
23534
23535
  * The named queries are packaged into bundles on the server side (along
23535
- * with resulting documents), and loaded to local cache using `loadBundle`. Once in local
23536
- * cache, use this method to extract a {@link Query} by name.
23536
+ * with resulting documents), and loaded to local cache using `loadBundle`. Once
23537
+ * in local cache, use this method to extract a {@link Query} by name.
23538
+ *
23539
+ * @param firestore - The {@link Firestore} instance to read the query from.
23540
+ * @param name - The name of the query.
23541
+ * @returns A `Promise` that is resolved with the Query or `null`.
23537
23542
  */
23538
23543
  function namedQuery(firestore, name) {
23539
23544
  firestore = cast(firestore, Firestore);
@@ -26222,6 +26227,80 @@ function writeBatch(firestore) {
26222
26227
  ensureFirestoreConfigured(firestore);
26223
26228
  return new WriteBatch(firestore, mutations => executeWrite(firestore, mutations));
26224
26229
  }
26230
+ /** An index component consisting of field path and index type. */
26231
+ class Segment {
26232
+ constructor(
26233
+ /** The field path of the component. */
26234
+ fieldPath,
26235
+ /** The fields sorting order. */
26236
+ kind) {
26237
+ this.fieldPath = fieldPath;
26238
+ this.kind = kind;
26239
+ }
26240
+ }
26241
+
26242
+ /**
26243
+ * @license
26244
+ * Copyright 2021 Google LLC
26245
+ *
26246
+ * Licensed under the Apache License, Version 2.0 (the "License");
26247
+ * you may not use this file except in compliance with the License.
26248
+ * You may obtain a copy of the License at
26249
+ *
26250
+ * http://www.apache.org/licenses/LICENSE-2.0
26251
+ *
26252
+ * Unless required by applicable law or agreed to in writing, software
26253
+ * distributed under the License is distributed on an "AS IS" BASIS,
26254
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26255
+ * See the License for the specific language governing permissions and
26256
+ * limitations under the License.
26257
+ */
26258
+ function setIndexConfiguration(firestore, jsonOrConfiguration) {
26259
+ firestore = cast(firestore, Firestore);
26260
+ ensureFirestoreConfigured(firestore);
26261
+ const indexConfiguration = typeof jsonOrConfiguration === 'string'
26262
+ ? tryParseJson(jsonOrConfiguration)
26263
+ : jsonOrConfiguration;
26264
+ // PORTING NOTE: We don't return an error if the user has not enabled
26265
+ // persistence since `enableIndexeddbPersistence()` can fail on the Web.
26266
+ if (Array.isArray(indexConfiguration.indexes)) {
26267
+ for (const index of indexConfiguration.indexes) {
26268
+ tryGetString(index, 'collectionGroup');
26269
+ const segments = [];
26270
+ if (Array.isArray(index.fields)) {
26271
+ for (const field of index.fields) {
26272
+ const fieldPathString = tryGetString(field, 'fieldPath');
26273
+ const fieldPath = fieldPathFromDotSeparatedString('setIndexConfiguration', fieldPathString);
26274
+ if (field.arrayConfig === 'CONTAINS') {
26275
+ segments.push(new Segment(fieldPath, 2 /* CONTAINS */));
26276
+ }
26277
+ else if (field.order === 'ASCENDING') {
26278
+ segments.push(new Segment(fieldPath, 0 /* ASCENDING */));
26279
+ }
26280
+ else if (field.order === 'DESCENDING') {
26281
+ segments.push(new Segment(fieldPath, 1 /* DESCENDING */));
26282
+ }
26283
+ }
26284
+ }
26285
+ }
26286
+ }
26287
+ // TODO(indexing): Configure indexes
26288
+ return Promise.resolve();
26289
+ }
26290
+ function tryParseJson(json) {
26291
+ try {
26292
+ return JSON.parse(json);
26293
+ }
26294
+ catch (e) {
26295
+ throw new FirestoreError(Code.INVALID_ARGUMENT, 'Failed to parse JSON:' + e.message);
26296
+ }
26297
+ }
26298
+ function tryGetString(data, property) {
26299
+ if (typeof data[property] !== 'string') {
26300
+ throw new FirestoreError(Code.INVALID_ARGUMENT, 'Missing string value for: ' + property);
26301
+ }
26302
+ return data[property];
26303
+ }
26225
26304
 
26226
26305
  /**
26227
26306
  * @license
@@ -26241,5 +26320,5 @@ function writeBatch(firestore) {
26241
26320
  */
26242
26321
  registerFirestore('node');
26243
26322
 
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 };
26323
+ 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
26324
  //# sourceMappingURL=index.node.mjs.map