@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
package/dist/index.rn.js CHANGED
@@ -70,7 +70,7 @@ N.MOCK_USER = new N("mock-user");
70
70
  * See the License for the specific language governing permissions and
71
71
  * limitations under the License.
72
72
  */
73
- let k = "9.6.4-202202014332";
73
+ let k = "9.6.4-canary.2d04af91d";
74
74
 
75
75
  /**
76
76
  * @license
@@ -15693,24 +15693,29 @@ function za(t) {
15693
15693
  /**
15694
15694
  * Loads a Firestore bundle into the local cache.
15695
15695
  *
15696
- * @param firestore - The {@link Firestore} instance to load bundles for for.
15697
- * @param bundleData - An object representing the bundle to be loaded. Valid objects are
15698
- * `ArrayBuffer`, `ReadableStream<Uint8Array>` or `string`.
15696
+ * @param firestore - The {@link Firestore} instance to load bundles for.
15697
+ * @param bundleData - An object representing the bundle to be loaded. Valid
15698
+ * objects are `ArrayBuffer`, `ReadableStream<Uint8Array>` or `string`.
15699
15699
  *
15700
- * @returns
15701
- * A `LoadBundleTask` object, which notifies callers with progress updates, and completion
15702
- * or error events. It can be used as a `Promise<LoadBundleTaskProgress>`.
15700
+ * @returns A `LoadBundleTask` object, which notifies callers with progress
15701
+ * updates, and completion or error events. It can be used as a
15702
+ * `Promise<LoadBundleTaskProgress>`.
15703
15703
  */ function Za(t, e) {
15704
15704
  const n = Ka(t = Aa(t, Ba)), s = new Fa;
15705
15705
  return da(n, t._databaseId, e, s), s;
15706
15706
  }
15707
15707
 
15708
15708
  /**
15709
- * Reads a Firestore {@link Query} from local cache, identified by the given name.
15709
+ * Reads a Firestore {@link Query} from local cache, identified by the given
15710
+ * name.
15710
15711
  *
15711
15712
  * The named queries are packaged into bundles on the server side (along
15712
- * with resulting documents), and loaded to local cache using `loadBundle`. Once in local
15713
- * cache, use this method to extract a {@link Query} by name.
15713
+ * with resulting documents), and loaded to local cache using `loadBundle`. Once
15714
+ * in local cache, use this method to extract a {@link Query} by name.
15715
+ *
15716
+ * @param firestore - The {@link Firestore} instance to read the query from.
15717
+ * @param name - The name of the query.
15718
+ * @returns A `Promise` that is resolved with the Query or `null`.
15714
15719
  */ function tu(t, e) {
15715
15720
  return wa(Ka(t = Aa(t, Ba)), e).then((e => e ? new Sa(t, null, e.query) : null));
15716
15721
  }
@@ -17846,6 +17851,100 @@ function bh(t, e) {
17846
17851
  return Ka(t = Aa(t, Ba)), new lh(t, (e => Ph(t, e)));
17847
17852
  }
17848
17853
 
17854
+ /**
17855
+ * @license
17856
+ * Copyright 2021 Google LLC
17857
+ *
17858
+ * Licensed under the Apache License, Version 2.0 (the "License");
17859
+ * you may not use this file except in compliance with the License.
17860
+ * You may obtain a copy of the License at
17861
+ *
17862
+ * http://www.apache.org/licenses/LICENSE-2.0
17863
+ *
17864
+ * Unless required by applicable law or agreed to in writing, software
17865
+ * distributed under the License is distributed on an "AS IS" BASIS,
17866
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17867
+ * See the License for the specific language governing permissions and
17868
+ * limitations under the License.
17869
+ */
17870
+ /**
17871
+ * An index definition for field indexes in Firestore.
17872
+ *
17873
+ * Every index is associated with a collection. The definition contains a list
17874
+ * of fields and their index kind (which can be `ASCENDING`, `DESCENDING` or
17875
+ * `CONTAINS` for ArrayContains/ArrayContainsAny queries).
17876
+ *
17877
+ * Unlike the backend, the SDK does not differentiate between collection or
17878
+ * collection group-scoped indices. Every index can be used for both single
17879
+ * collection and collection group queries.
17880
+ */ class Oh {
17881
+ constructor(
17882
+ /**
17883
+ * The index ID. Returns -1 if the index ID is not available (e.g. the index
17884
+ * has not yet been persisted).
17885
+ */
17886
+ t,
17887
+ /** The collection ID this index applies to. */
17888
+ e,
17889
+ /** The field segments for this index. */
17890
+ n) {
17891
+ this.na = t, this.collectionGroup = e, this.segments = n;
17892
+ }
17893
+ }
17894
+
17895
+ /** An index component consisting of field path and index type. */ class Mh {
17896
+ constructor(
17897
+ /** The field path of the component. */
17898
+ t,
17899
+ /** The fields sorting order. */
17900
+ e) {
17901
+ this.fieldPath = t, this.kind = e;
17902
+ }
17903
+ }
17904
+
17905
+ /**
17906
+ * @license
17907
+ * Copyright 2021 Google LLC
17908
+ *
17909
+ * Licensed under the Apache License, Version 2.0 (the "License");
17910
+ * you may not use this file except in compliance with the License.
17911
+ * You may obtain a copy of the License at
17912
+ *
17913
+ * http://www.apache.org/licenses/LICENSE-2.0
17914
+ *
17915
+ * Unless required by applicable law or agreed to in writing, software
17916
+ * distributed under the License is distributed on an "AS IS" BASIS,
17917
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17918
+ * See the License for the specific language governing permissions and
17919
+ * limitations under the License.
17920
+ */ function Fh(t, e) {
17921
+ Ka(t = Aa(t, Ba));
17922
+ const n = "string" == typeof e ? function(t) {
17923
+ try {
17924
+ return JSON.parse(t);
17925
+ } catch (t) {
17926
+ throw new W(Q.INVALID_ARGUMENT, "Failed to parse JSON:" + t.message);
17927
+ }
17928
+ }(e) : e, s = [];
17929
+ // PORTING NOTE: We don't return an error if the user has not enabled
17930
+ // persistence since `enableIndexeddbPersistence()` can fail on the Web.
17931
+ if (Array.isArray(n.indexes)) for (const t of n.indexes) {
17932
+ const e = Lh(t, "collectionGroup"), n = [];
17933
+ if (Array.isArray(t.fields)) for (const e of t.fields) {
17934
+ const t = Du("setIndexConfiguration", Lh(e, "fieldPath"));
17935
+ "CONTAINS" === e.arrayConfig ? n.push(new Mh(t, 2 /* CONTAINS */)) : "ASCENDING" === e.order ? n.push(new Mh(t, 0 /* ASCENDING */)) : "DESCENDING" === e.order && n.push(new Mh(t, 1 /* DESCENDING */));
17936
+ }
17937
+ s.push(new Oh(Oh.sa, e, n));
17938
+ }
17939
+ // TODO(indexing): Configure indexes
17940
+ return Promise.resolve();
17941
+ }
17942
+
17943
+ function Lh(t, e) {
17944
+ if ("string" != typeof t[e]) throw new W(Q.INVALID_ARGUMENT, "Missing string value for: " + e);
17945
+ return t[e];
17946
+ }
17947
+
17849
17948
  /**
17850
17949
  * @license
17851
17950
  * Copyright 2021 Google LLC
@@ -17869,10 +17968,10 @@ function bh(t, e) {
17869
17968
  return n = Object.assign({
17870
17969
  useFetchStreams: e
17871
17970
  }, n), i._setSettings(n), i;
17872
- }), "PUBLIC")), s(C, "3.4.3-202202014332", t),
17971
+ }), "PUBLIC")), s(C, "3.4.3-canary.2d04af91d", t),
17873
17972
  // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
17874
- s(C, "3.4.3-202202014332", "esm2017");
17973
+ s(C, "3.4.3-canary.2d04af91d", "esm2017");
17875
17974
  }("rn", /* useFetchStreams= */ !1);
17876
17975
 
17877
- export { ah as AbstractUserDataWriter, iu as Bytes, La as CACHE_SIZE_UNLIMITED, Da as CollectionReference, Va as DocumentReference, Mu as DocumentSnapshot, nu as FieldPath, ru as FieldValue, Ba as Firestore, W as FirestoreError, ou as GeoPoint, Fa as LoadBundleTask, Sa as Query, Ku as QueryConstraint, Fu as QueryDocumentSnapshot, Lu as QuerySnapshot, Ou as SnapshotMetadata, ut as Timestamp, Vh as Transaction, lh as WriteBatch, ma as _DatabaseId, Nt as _DocumentKey, nt as _EmptyAppCheckTokenProvider, H as _EmptyAuthCredentialsProvider, gt as _FieldPath, Aa as _cast, K as _debugAssert, Tt as _isBase64Available, L as _logWarn, pa as _validateIsNotUsedTogether, Ah as addDoc, kh as arrayRemove, Nh as arrayUnion, za as clearIndexedDbPersistence, Ca as collection, Na as collectionGroup, va as connectFirestoreEmulator, Ih as deleteDoc, Dh as deleteField, Ya as disableNetwork, ka as doc, su as documentId, Qa as enableIndexedDbPersistence, Wa as enableMultiTabIndexedDbPersistence, Ja as enableNetwork, sh as endAt, nh as endBefore, Ka as ensureFirestoreConfigured, Ph as executeWrite, dh as getDoc, _h as getDocFromCache, mh as getDocFromServer, gh as getDocs, yh as getDocsFromCache, ph as getDocsFromServer, qa as getFirestore, xh as increment, Ua as initializeFirestore, Ju as limit, Yu as limitToLast, Za as loadBundle, tu as namedQuery, Rh as onSnapshot, bh as onSnapshotsInSync, zu as orderBy, ju as query, $a as queryEqual, xa as refEqual, Sh as runTransaction, Ch as serverTimestamp, Th as setDoc, O as setLogLevel, Uu as snapshotEqual, th as startAfter, Zu as startAt, Xa as terminate, Eh as updateDoc, Ha as waitForPendingWrites, Wu as where, $h as writeBatch };
17976
+ export { ah as AbstractUserDataWriter, iu as Bytes, La as CACHE_SIZE_UNLIMITED, Da as CollectionReference, Va as DocumentReference, Mu as DocumentSnapshot, nu as FieldPath, ru as FieldValue, Ba as Firestore, W as FirestoreError, ou as GeoPoint, Fa as LoadBundleTask, Sa as Query, Ku as QueryConstraint, Fu as QueryDocumentSnapshot, Lu as QuerySnapshot, Ou as SnapshotMetadata, ut as Timestamp, Vh as Transaction, lh as WriteBatch, ma as _DatabaseId, Nt as _DocumentKey, nt as _EmptyAppCheckTokenProvider, H as _EmptyAuthCredentialsProvider, gt as _FieldPath, Aa as _cast, K as _debugAssert, Tt as _isBase64Available, L as _logWarn, Fh as _setIndexConfiguration, pa as _validateIsNotUsedTogether, Ah as addDoc, kh as arrayRemove, Nh as arrayUnion, za as clearIndexedDbPersistence, Ca as collection, Na as collectionGroup, va as connectFirestoreEmulator, Ih as deleteDoc, Dh as deleteField, Ya as disableNetwork, ka as doc, su as documentId, Qa as enableIndexedDbPersistence, Wa as enableMultiTabIndexedDbPersistence, Ja as enableNetwork, sh as endAt, nh as endBefore, Ka as ensureFirestoreConfigured, Ph as executeWrite, dh as getDoc, _h as getDocFromCache, mh as getDocFromServer, gh as getDocs, yh as getDocsFromCache, ph as getDocsFromServer, qa as getFirestore, xh as increment, Ua as initializeFirestore, Ju as limit, Yu as limitToLast, Za as loadBundle, tu as namedQuery, Rh as onSnapshot, bh as onSnapshotsInSync, zu as orderBy, ju as query, $a as queryEqual, xa as refEqual, Sh as runTransaction, Ch as serverTimestamp, Th as setDoc, O as setLogLevel, Uu as snapshotEqual, th as startAfter, Zu as startAt, Xa as terminate, Eh as updateDoc, Ha as waitForPendingWrites, Wu as where, $h as writeBatch };
17878
17977
  //# sourceMappingURL=index.rn.js.map