@firebase/firestore 3.4.8 → 3.4.9-canary.0197076b8

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 (163) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/firestore/lite/index.d.ts +1 -0
  3. package/dist/firestore/src/api/transaction.d.ts +4 -1
  4. package/dist/firestore/src/api/transaction_options.d.ts +17 -0
  5. package/dist/firestore/src/api.d.ts +1 -0
  6. package/dist/firestore/src/core/firestore_client.d.ts +2 -1
  7. package/dist/firestore/src/core/query.d.ts +2 -4
  8. package/dist/firestore/src/core/target.d.ts +6 -4
  9. package/dist/firestore/src/core/transaction_options.d.ts +25 -0
  10. package/dist/firestore/src/core/transaction_runner.d.ts +3 -2
  11. package/dist/firestore/src/lite-api/transaction.d.ts +4 -1
  12. package/dist/firestore/src/lite-api/transaction_options.d.ts +23 -0
  13. package/dist/firestore/src/local/document_overlay_cache.d.ts +5 -0
  14. package/dist/firestore/src/local/index_manager.d.ts +24 -3
  15. package/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
  16. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +4 -7
  17. package/dist/firestore/src/local/indexeddb_schema.d.ts +4 -2
  18. package/dist/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
  19. package/dist/firestore/src/local/indexeddb_sentinels.d.ts +1 -0
  20. package/dist/firestore/src/local/local_documents_view.d.ts +47 -8
  21. package/dist/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
  22. package/dist/firestore/src/local/memory_index_manager.d.ts +3 -2
  23. package/dist/firestore/src/local/overlayed_document.d.ts +36 -0
  24. package/dist/firestore/src/local/query_engine.d.ts +44 -5
  25. package/dist/firestore/src/model/collections.d.ts +3 -1
  26. package/dist/firestore/src/model/field_mask.d.ts +6 -0
  27. package/dist/firestore/src/model/mutation.d.ts +19 -1
  28. package/dist/firestore/src/model/mutation_batch.d.ts +9 -4
  29. package/dist/firestore/src/model/values.d.ts +14 -2
  30. package/dist/firestore/src/tsdoc-metadata.json +11 -11
  31. package/dist/firestore/src/util/misc.d.ts +3 -0
  32. package/dist/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
  33. package/dist/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
  34. package/dist/firestore/test/unit/local/test_index_manager.d.ts +2 -2
  35. package/dist/firestore/test/util/helpers.d.ts +12 -0
  36. package/dist/index.d.ts +28 -3
  37. package/dist/index.esm2017.js +9384 -9023
  38. package/dist/index.esm2017.js.map +1 -1
  39. package/dist/index.esm5.js +7406 -7016
  40. package/dist/index.esm5.js.map +1 -1
  41. package/dist/index.node.cjs.js +5607 -5089
  42. package/dist/index.node.cjs.js.map +1 -1
  43. package/dist/index.node.mjs +5607 -5089
  44. package/dist/index.node.mjs.map +1 -1
  45. package/dist/index.rn.js +7162 -6801
  46. package/dist/index.rn.js.map +1 -1
  47. package/dist/internal.d.ts +6007 -5918
  48. package/dist/lite/firestore/lite/index.d.ts +1 -0
  49. package/dist/lite/firestore/src/api/transaction.d.ts +4 -1
  50. package/dist/lite/firestore/src/api/transaction_options.d.ts +17 -0
  51. package/dist/lite/firestore/src/api.d.ts +1 -0
  52. package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -1
  53. package/dist/lite/firestore/src/core/query.d.ts +2 -4
  54. package/dist/lite/firestore/src/core/target.d.ts +6 -4
  55. package/dist/lite/firestore/src/core/transaction_options.d.ts +25 -0
  56. package/dist/lite/firestore/src/core/transaction_runner.d.ts +3 -2
  57. package/dist/lite/firestore/src/lite-api/transaction.d.ts +4 -1
  58. package/dist/lite/firestore/src/lite-api/transaction_options.d.ts +23 -0
  59. package/dist/lite/firestore/src/local/document_overlay_cache.d.ts +5 -0
  60. package/dist/lite/firestore/src/local/index_manager.d.ts +24 -3
  61. package/dist/lite/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
  62. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +4 -7
  63. package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +4 -2
  64. package/dist/lite/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
  65. package/dist/lite/firestore/src/local/indexeddb_sentinels.d.ts +1 -0
  66. package/dist/lite/firestore/src/local/local_documents_view.d.ts +47 -8
  67. package/dist/lite/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
  68. package/dist/lite/firestore/src/local/memory_index_manager.d.ts +3 -2
  69. package/dist/lite/firestore/src/local/overlayed_document.d.ts +36 -0
  70. package/dist/lite/firestore/src/local/query_engine.d.ts +44 -5
  71. package/dist/lite/firestore/src/model/collections.d.ts +3 -1
  72. package/dist/lite/firestore/src/model/field_mask.d.ts +6 -0
  73. package/dist/lite/firestore/src/model/mutation.d.ts +19 -1
  74. package/dist/lite/firestore/src/model/mutation_batch.d.ts +9 -4
  75. package/dist/lite/firestore/src/model/values.d.ts +14 -2
  76. package/dist/lite/firestore/src/util/misc.d.ts +3 -0
  77. package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
  78. package/dist/lite/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
  79. package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +2 -2
  80. package/dist/lite/firestore/test/util/helpers.d.ts +12 -0
  81. package/dist/lite/index.browser.esm2017.js +1209 -698
  82. package/dist/lite/index.browser.esm2017.js.map +1 -1
  83. package/dist/lite/index.browser.esm5.js +1213 -813
  84. package/dist/lite/index.browser.esm5.js.map +1 -1
  85. package/dist/lite/index.d.ts +26 -1
  86. package/dist/lite/index.node.cjs.js +709 -15
  87. package/dist/lite/index.node.cjs.js.map +1 -1
  88. package/dist/lite/index.node.mjs +709 -15
  89. package/dist/lite/index.node.mjs.map +1 -1
  90. package/dist/lite/index.rn.esm2017.js +1828 -1317
  91. package/dist/lite/index.rn.esm2017.js.map +1 -1
  92. package/dist/lite/internal.d.ts +2912 -2874
  93. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +103 -101
  94. package/dist/lite/packages/firestore/lite/index.d.ts +1 -0
  95. package/dist/lite/packages/firestore/src/api/transaction.d.ts +4 -1
  96. package/dist/lite/packages/firestore/src/api/transaction_options.d.ts +17 -0
  97. package/dist/lite/packages/firestore/src/api.d.ts +1 -0
  98. package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -1
  99. package/dist/lite/packages/firestore/src/core/query.d.ts +2 -4
  100. package/dist/lite/packages/firestore/src/core/target.d.ts +6 -4
  101. package/dist/lite/packages/firestore/src/core/transaction_options.d.ts +25 -0
  102. package/dist/lite/packages/firestore/src/core/transaction_runner.d.ts +3 -2
  103. package/dist/lite/packages/firestore/src/lite-api/transaction.d.ts +4 -1
  104. package/dist/lite/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
  105. package/dist/lite/packages/firestore/src/local/document_overlay_cache.d.ts +5 -0
  106. package/dist/lite/packages/firestore/src/local/index_manager.d.ts +24 -3
  107. package/dist/lite/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
  108. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +4 -7
  109. package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +4 -2
  110. package/dist/lite/packages/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
  111. package/dist/lite/packages/firestore/src/local/indexeddb_sentinels.d.ts +1 -0
  112. package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +47 -8
  113. package/dist/lite/packages/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
  114. package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +3 -2
  115. package/dist/lite/packages/firestore/src/local/overlayed_document.d.ts +36 -0
  116. package/dist/lite/packages/firestore/src/local/query_engine.d.ts +44 -5
  117. package/dist/lite/packages/firestore/src/model/collections.d.ts +3 -1
  118. package/dist/lite/packages/firestore/src/model/field_mask.d.ts +6 -0
  119. package/dist/lite/packages/firestore/src/model/mutation.d.ts +19 -1
  120. package/dist/lite/packages/firestore/src/model/mutation_batch.d.ts +9 -4
  121. package/dist/lite/packages/firestore/src/model/values.d.ts +14 -2
  122. package/dist/lite/packages/firestore/src/util/misc.d.ts +3 -0
  123. package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
  124. package/dist/lite/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
  125. package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +2 -2
  126. package/dist/lite/packages/firestore/test/util/helpers.d.ts +12 -0
  127. package/dist/lite/private.d.ts +2772 -2734
  128. package/dist/packages/firestore/dist/index.esm2017.d.ts +197 -194
  129. package/dist/packages/firestore/lite/index.d.ts +1 -0
  130. package/dist/packages/firestore/src/api/transaction.d.ts +4 -1
  131. package/dist/packages/firestore/src/api/transaction_options.d.ts +17 -0
  132. package/dist/packages/firestore/src/api.d.ts +1 -0
  133. package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -1
  134. package/dist/packages/firestore/src/core/query.d.ts +2 -4
  135. package/dist/packages/firestore/src/core/target.d.ts +6 -4
  136. package/dist/packages/firestore/src/core/transaction_options.d.ts +25 -0
  137. package/dist/packages/firestore/src/core/transaction_runner.d.ts +3 -2
  138. package/dist/packages/firestore/src/lite-api/transaction.d.ts +4 -1
  139. package/dist/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
  140. package/dist/packages/firestore/src/local/document_overlay_cache.d.ts +5 -0
  141. package/dist/packages/firestore/src/local/index_manager.d.ts +24 -3
  142. package/dist/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
  143. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +4 -7
  144. package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +4 -2
  145. package/dist/packages/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
  146. package/dist/packages/firestore/src/local/indexeddb_sentinels.d.ts +1 -0
  147. package/dist/packages/firestore/src/local/local_documents_view.d.ts +47 -8
  148. package/dist/packages/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
  149. package/dist/packages/firestore/src/local/memory_index_manager.d.ts +3 -2
  150. package/dist/packages/firestore/src/local/overlayed_document.d.ts +36 -0
  151. package/dist/packages/firestore/src/local/query_engine.d.ts +44 -5
  152. package/dist/packages/firestore/src/model/collections.d.ts +3 -1
  153. package/dist/packages/firestore/src/model/field_mask.d.ts +6 -0
  154. package/dist/packages/firestore/src/model/mutation.d.ts +19 -1
  155. package/dist/packages/firestore/src/model/mutation_batch.d.ts +9 -4
  156. package/dist/packages/firestore/src/model/values.d.ts +14 -2
  157. package/dist/packages/firestore/src/util/misc.d.ts +3 -0
  158. package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
  159. package/dist/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
  160. package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +2 -2
  161. package/dist/packages/firestore/test/util/helpers.d.ts +12 -0
  162. package/dist/private.d.ts +5715 -5626
  163. package/package.json +20 -18
@@ -28,6 +28,12 @@ import { FieldPath } from './path';
28
28
  export declare class FieldMask {
29
29
  readonly fields: FieldPath[];
30
30
  constructor(fields: FieldPath[]);
31
+ static empty(): FieldMask;
32
+ /**
33
+ * Returns a new FieldMask object that is the result of adding all the given
34
+ * fields paths to this field mask.
35
+ */
36
+ unionWith(extraFields: FieldPath[]): FieldMask;
31
37
  /**
32
38
  * Verifies that `fieldPath` is included by at least one field in this field
33
39
  * mask.
@@ -149,7 +149,19 @@ export declare abstract class Mutation {
149
149
  abstract readonly key: DocumentKey;
150
150
  abstract readonly precondition: Precondition;
151
151
  abstract readonly fieldTransforms: FieldTransform[];
152
+ /**
153
+ * Returns a `FieldMask` representing the fields that will be changed by
154
+ * applying this mutation. Returns `null` if the mutation will overwrite the
155
+ * entire document.
156
+ */
157
+ abstract getFieldMask(): FieldMask | null;
152
158
  }
159
+ /**
160
+ * A utility method to calculate a `Mutation` representing the overlay from the
161
+ * final state of the document, and a `FieldMask` representing the fields that
162
+ * are mutated by the local mutations.
163
+ */
164
+ export declare function calculateOverlayMutation(doc: MutableDocument, mask: FieldMask | null): Mutation | null;
153
165
  /**
154
166
  * Applies this mutation to the given document for the purposes of computing a
155
167
  * new remote document. If the input document doesn't match the expected state
@@ -172,10 +184,12 @@ export declare function mutationApplyToRemoteDocument(mutation: Mutation, docume
172
184
  * @param document - The document to mutate. The input document can be an
173
185
  * invalid document if the client has no knowledge of the pre-mutation state
174
186
  * of the document.
187
+ * @param previousMask - The fields that have been updated before applying this mutation.
175
188
  * @param localWriteTime - A timestamp indicating the local write time of the
176
189
  * batch this mutation is a part of.
190
+ * @returns A `FieldMask` representing the fields that are changed by applying this mutation.
177
191
  */
178
- export declare function mutationApplyToLocalView(mutation: Mutation, document: MutableDocument, localWriteTime: Timestamp): void;
192
+ export declare function mutationApplyToLocalView(mutation: Mutation, document: MutableDocument, previousMask: FieldMask | null, localWriteTime: Timestamp): FieldMask | null;
179
193
  /**
180
194
  * If this mutation is not idempotent, returns the base value to persist with
181
195
  * this mutation. If a base value is returned, the mutation is always applied
@@ -205,6 +219,7 @@ export declare class SetMutation extends Mutation {
205
219
  readonly fieldTransforms: FieldTransform[];
206
220
  constructor(key: DocumentKey, value: ObjectValue, precondition: Precondition, fieldTransforms?: FieldTransform[]);
207
221
  readonly type: MutationType;
222
+ getFieldMask(): FieldMask | null;
208
223
  }
209
224
  /**
210
225
  * A mutation that modifies fields of the document at the given key with the
@@ -227,6 +242,7 @@ export declare class PatchMutation extends Mutation {
227
242
  readonly fieldTransforms: FieldTransform[];
228
243
  constructor(key: DocumentKey, data: ObjectValue, fieldMask: FieldMask, precondition: Precondition, fieldTransforms?: FieldTransform[]);
229
244
  readonly type: MutationType;
245
+ getFieldMask(): FieldMask | null;
230
246
  }
231
247
  /** A mutation that deletes the document at the given key. */
232
248
  export declare class DeleteMutation extends Mutation {
@@ -235,6 +251,7 @@ export declare class DeleteMutation extends Mutation {
235
251
  constructor(key: DocumentKey, precondition: Precondition);
236
252
  readonly type: MutationType;
237
253
  readonly fieldTransforms: FieldTransform[];
254
+ getFieldMask(): FieldMask | null;
238
255
  }
239
256
  /**
240
257
  * A mutation that verifies the existence of the document at the given key with
@@ -249,4 +266,5 @@ export declare class VerifyMutation extends Mutation {
249
266
  constructor(key: DocumentKey, precondition: Precondition);
250
267
  readonly type: MutationType;
251
268
  readonly fieldTransforms: FieldTransform[];
269
+ getFieldMask(): FieldMask | null;
252
270
  }
@@ -17,8 +17,10 @@
17
17
  import { SnapshotVersion } from '../core/snapshot_version';
18
18
  import { BatchId } from '../core/types';
19
19
  import { Timestamp } from '../lite-api/timestamp';
20
- import { DocumentKeySet, DocumentMap, DocumentVersionMap } from './collections';
20
+ import { OverlayedDocument } from '../local/overlayed_document';
21
+ import { DocumentKeySet, MutationMap, DocumentVersionMap, DocumentKeyMap } from './collections';
21
22
  import { MutableDocument } from './document';
23
+ import { FieldMask } from './field_mask';
22
24
  import { Mutation, MutationResult } from './mutation';
23
25
  /**
24
26
  * A batch of mutations that will be sent as one unit to the backend.
@@ -54,13 +56,16 @@ export declare class MutationBatch {
54
56
  * batch.
55
57
  *
56
58
  * @param document - The document to apply mutations to.
59
+ * @param mutatedFields - Fields that have been updated before applying this mutation batch.
60
+ * @returns A `FieldMask` representing all the fields that are mutated.
57
61
  */
58
- applyToLocalView(document: MutableDocument): void;
62
+ applyToLocalView(document: MutableDocument, mutatedFields: FieldMask | null): FieldMask | null;
59
63
  /**
60
64
  * Computes the local view for all provided documents given the mutations in
61
- * this batch.
65
+ * this batch. Returns a `DocumentKey` to `Mutation` map which can be used to
66
+ * replace all the mutation applications.
62
67
  */
63
- applyToLocalDocumentSet(documentMap: DocumentMap): void;
68
+ applyToLocalDocumentSet(documentMap: DocumentKeyMap<OverlayedDocument>, documentsWithoutRemoteVersion: DocumentKeySet): MutationMap;
64
69
  keys(): DocumentKeySet;
65
70
  isEqual(other: MutationBatch): boolean;
66
71
  }
@@ -81,5 +81,17 @@ export declare function isMaxValue(value: Value): boolean;
81
81
  export declare function valuesGetLowerBound(value: Value): Value;
82
82
  /** Returns the largest value for the given value type (exclusive). */
83
83
  export declare function valuesGetUpperBound(value: Value): Value;
84
- export declare function valuesMax(left: Value | undefined, right: Value | undefined): Value | undefined;
85
- export declare function valuesMin(left: Value | undefined, right: Value | undefined): Value | undefined;
84
+ export declare function lowerBoundCompare(left: {
85
+ value: Value;
86
+ inclusive: boolean;
87
+ }, right: {
88
+ value: Value;
89
+ inclusive: boolean;
90
+ }): number;
91
+ export declare function upperBoundCompare(left: {
92
+ value: Value;
93
+ inclusive: boolean;
94
+ }, right: {
95
+ value: Value;
96
+ inclusive: boolean;
97
+ }): number;
@@ -1,11 +1,11 @@
1
- // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
- // It should be published with your NPM package. It should not be tracked by Git.
3
- {
4
- "tsdocVersion": "0.12",
5
- "toolPackages": [
6
- {
7
- "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "0.1.2"
9
- }
10
- ]
11
- }
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "0.1.2"
9
+ }
10
+ ]
11
+ }
@@ -25,6 +25,9 @@ export declare function primitiveComparator<T>(left: T, right: T): number;
25
25
  export interface Equatable<T> {
26
26
  isEqual(other: T): boolean;
27
27
  }
28
+ export interface Iterable<V> {
29
+ forEach: (cb: (v: V) => void) => void;
30
+ }
28
31
  /** Helper to compare arrays using isEqual(). */
29
32
  export declare function arrayEquals<T>(left: T[], right: T[], comparator: (l: T, r: T) => boolean): boolean;
30
33
  /**
@@ -16,6 +16,7 @@
16
16
  */
17
17
  import { Query } from '../../../src/core/query';
18
18
  import { SnapshotVersion } from '../../../src/core/snapshot_version';
19
+ import { IndexManager } from '../../../src/local/index_manager';
19
20
  import { LocalDocumentsView } from '../../../src/local/local_documents_view';
20
21
  import { PersistencePromise } from '../../../src/local/persistence_promise';
21
22
  import { PersistenceTransaction } from '../../../src/local/persistence_transaction';
@@ -51,7 +52,7 @@ export declare class CountingQueryEngine extends QueryEngine {
51
52
  documentsReadByKey: number;
52
53
  resetCounts(): void;
53
54
  getDocumentsMatchingQuery(transaction: PersistenceTransaction, query: Query, lastLimboFreeSnapshotVersion: SnapshotVersion, remoteKeys: DocumentKeySet): PersistencePromise<DocumentMap>;
54
- setLocalDocumentsView(localDocuments: LocalDocumentsView): void;
55
+ initialize(localDocuments: LocalDocumentsView, indexManager: IndexManager): void;
55
56
  private wrapRemoteDocumentCache;
56
57
  private wrapMutationQueue;
57
58
  }
@@ -31,6 +31,7 @@ export declare class TestDocumentOverlayCache {
31
31
  constructor(persistence: Persistence, cache: DocumentOverlayCache);
32
32
  saveOverlays(largestBatch: number, data: MutationMap): Promise<void>;
33
33
  getOverlay(key: DocumentKey): Promise<Overlay | null>;
34
+ getOverlays(keys: DocumentKeySet): Promise<OverlayMap>;
34
35
  getOverlayMutation(docKey: string): Promise<Mutation | null>;
35
36
  getOverlaysForCollection(path: ResourcePath, sinceBatchId: number): Promise<OverlayMap>;
36
37
  getOverlaysForCollectionGroup(collectionGroup: string, sinceBatchId: number, count: number): Promise<OverlayMap>;
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { Target } from '../../../src/core/target';
18
- import { IndexManager } from '../../../src/local/index_manager';
18
+ import { IndexManager, IndexType } from '../../../src/local/index_manager';
19
19
  import { Persistence } from '../../../src/local/persistence';
20
20
  import { DocumentMap } from '../../../src/model/collections';
21
21
  import { DocumentKey } from '../../../src/model/document_key';
@@ -34,7 +34,7 @@ export declare class TestIndexManager {
34
34
  addFieldIndex(index: FieldIndex): Promise<void>;
35
35
  deleteFieldIndex(index: FieldIndex): Promise<void>;
36
36
  getFieldIndexes(collectionGroup?: string): Promise<FieldIndex[]>;
37
- getFieldIndex(target: Target): Promise<FieldIndex | null>;
37
+ getIndexType(target: Target): Promise<IndexType>;
38
38
  getDocumentsMatchingTarget(target: Target): Promise<DocumentKey[] | null>;
39
39
  getNextCollectionGroupToUpdate(): Promise<string | null>;
40
40
  updateCollectionGroup(collectionGroup: string, offset: IndexOffset): Promise<void>;
@@ -69,6 +69,7 @@ export declare function blob(...bytes: number[]): Bytes;
69
69
  export declare function filter(path: string, op: string, value: unknown): FieldFilter;
70
70
  export declare function setMutation(keyStr: string, json: JsonObject<unknown>): SetMutation;
71
71
  export declare function patchMutation(keyStr: string, json: JsonObject<unknown>, precondition?: Precondition): PatchMutation;
72
+ export declare function mergeMutation(keyStr: string, json: JsonObject<unknown>, updateMask: FieldPath[]): PatchMutation;
72
73
  export declare function deleteMutation(keyStr: string): DeleteMutation;
73
74
  export declare function mutationResult(testVersion: TestSnapshotVersion): MutationResult;
74
75
  export declare function bound(values: unknown[], inclusive: boolean): Bound;
@@ -177,3 +178,14 @@ export declare function expectSetToEqual<T>(set: SortedSet<T>, arr: T[]): void;
177
178
  export declare function expectEqualitySets<T>(elems: T[][], equalityFn: (v1: T, v2: T) => boolean, stringifyFn?: (v: T) => string): void;
178
179
  export declare function validateFirestoreError(expectedCode: Code, actualError: Error): void;
179
180
  export declare function forEachNumber<V>(obj: Dict<V>, fn: (key: number, val: V) => void): void;
181
+ /**
182
+ * Returns all possible permutations of the given array.
183
+ * For `[a, b]`, this method returns `[[a, b], [b, a]]`.
184
+ */
185
+ export declare function computePermutations<T>(input: T[]): T[][];
186
+ /**
187
+ * Returns all possible combinations of the given array, including an empty
188
+ * array. For `[a, b, c]` this method returns
189
+ * `[[], [a], [a, b], [a, c], [b, c], [a, b, c]`.
190
+ */
191
+ export declare function computeCombinations<T>(input: T[]): T[][];
package/dist/index.d.ts CHANGED
@@ -1436,12 +1436,14 @@ export declare function refEqual<T>(left: DocumentReference<T> | CollectionRefer
1436
1436
  * transaction against.
1437
1437
  * @param updateFunction - The function to execute within the transaction
1438
1438
  * context.
1439
+ * @param options - An options object to configure maximum number of attempts to
1440
+ * commit.
1439
1441
  * @returns If the transaction completed successfully or was explicitly aborted
1440
1442
  * (the `updateFunction` returned a failed promise), the promise returned by the
1441
1443
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
1442
1444
  * rejected promise with the corresponding failure error is returned.
1443
1445
  */
1444
- export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>): Promise<T>;
1446
+ export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
1445
1447
  /**
1446
1448
  * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
1447
1449
  * include a server-generated timestamp in the written data.
@@ -1810,8 +1812,8 @@ export declare class Transaction {
1810
1812
  * not exist.
1811
1813
  *
1812
1814
  * @param documentRef - A reference to the document to be updated.
1813
- * @param data - An object containing the fields and values with which to
1814
- update the document. Fields can contain dots to reference nested fields
1815
+ * @param data - An object containing the fields and values with which to
1816
+ update the document. Fields can contain dots to reference nested fields
1815
1817
  within the document.
1816
1818
  * @throws Error - If the provided input is not valid Firestore data.
1817
1819
  * @returns This `Transaction` instance. Used for chaining method calls.
@@ -1841,6 +1843,29 @@ within the document.
1841
1843
  */
1842
1844
  delete(documentRef: DocumentReference<unknown>): this;
1843
1845
  }
1846
+ /**
1847
+ * @license
1848
+ * Copyright 2022 Google LLC
1849
+ *
1850
+ * Licensed under the Apache License, Version 2.0 (the "License");
1851
+ * you may not use this file except in compliance with the License.
1852
+ * You may obtain a copy of the License at
1853
+ *
1854
+ * http://www.apache.org/licenses/LICENSE-2.0
1855
+ *
1856
+ * Unless required by applicable law or agreed to in writing, software
1857
+ * distributed under the License is distributed on an "AS IS" BASIS,
1858
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1859
+ * See the License for the specific language governing permissions and
1860
+ * limitations under the License.
1861
+ */
1862
+ /**
1863
+ * Options to customize transaction behavior.
1864
+ */
1865
+ export declare interface TransactionOptions {
1866
+ /** Maximum number of attempts to commit, after which transaction fails. Default is 5. */
1867
+ readonly maxAttempts?: number;
1868
+ }
1844
1869
  /**
1845
1870
  * Given a union type `U = T1 | T2 | ...`, returns an intersected type
1846
1871
  * `(T1 & T2 & ...)`.