@firebase/firestore 3.4.5 → 3.4.6-2022216223411

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 (101) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/firestore/src/index/index_entry.d.ts +6 -0
  3. package/dist/firestore/src/local/document_overlay_cache.d.ts +4 -5
  4. package/dist/firestore/src/local/index_manager.d.ts +2 -2
  5. package/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts +4 -5
  6. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +48 -1
  7. package/dist/firestore/src/local/indexeddb_schema.d.ts +34 -553
  8. package/dist/firestore/src/local/indexeddb_sentinels.d.ts +238 -0
  9. package/dist/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
  10. package/dist/firestore/src/local/local_serializer.d.ts +2 -1
  11. package/dist/firestore/src/local/memory_document_overlay_cache.d.ts +4 -5
  12. package/dist/firestore/src/local/memory_index_manager.d.ts +1 -1
  13. package/dist/firestore/src/local/simple_db.d.ts +11 -0
  14. package/dist/firestore/src/model/collections.d.ts +7 -0
  15. package/dist/firestore/src/model/field_index.d.ts +2 -0
  16. package/dist/firestore/src/model/type_order.d.ts +2 -1
  17. package/dist/firestore/src/platform/node/base64.d.ts +1 -0
  18. package/dist/firestore/src/util/obj_map.d.ts +3 -0
  19. package/dist/firestore/test/unit/local/test_document_overlay_cache.d.ts +4 -4
  20. package/dist/firestore/test/unit/local/test_index_manager.d.ts +1 -1
  21. package/dist/index.esm2017.js +4160 -4201
  22. package/dist/index.esm2017.js.map +1 -1
  23. package/dist/index.esm5.js +4332 -4311
  24. package/dist/index.esm5.js.map +1 -1
  25. package/dist/index.node.cjs.js +1223 -956
  26. package/dist/index.node.cjs.js.map +1 -1
  27. package/dist/index.node.mjs +1223 -956
  28. package/dist/index.node.mjs.map +1 -1
  29. package/dist/index.rn.js +4157 -4198
  30. package/dist/index.rn.js.map +1 -1
  31. package/dist/internal.d.ts +12 -5
  32. package/dist/lite/firestore/src/index/index_entry.d.ts +6 -0
  33. package/dist/lite/firestore/src/local/document_overlay_cache.d.ts +4 -5
  34. package/dist/lite/firestore/src/local/index_manager.d.ts +2 -2
  35. package/dist/lite/firestore/src/local/indexeddb_document_overlay_cache.d.ts +4 -5
  36. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +48 -1
  37. package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +34 -553
  38. package/dist/lite/firestore/src/local/indexeddb_sentinels.d.ts +238 -0
  39. package/dist/lite/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
  40. package/dist/lite/firestore/src/local/local_serializer.d.ts +2 -1
  41. package/dist/lite/firestore/src/local/memory_document_overlay_cache.d.ts +4 -5
  42. package/dist/lite/firestore/src/local/memory_index_manager.d.ts +1 -1
  43. package/dist/lite/firestore/src/local/simple_db.d.ts +11 -0
  44. package/dist/lite/firestore/src/model/collections.d.ts +7 -0
  45. package/dist/lite/firestore/src/model/field_index.d.ts +2 -0
  46. package/dist/lite/firestore/src/model/type_order.d.ts +2 -1
  47. package/dist/lite/firestore/src/platform/node/base64.d.ts +1 -0
  48. package/dist/lite/firestore/src/util/obj_map.d.ts +3 -0
  49. package/dist/lite/firestore/test/unit/local/test_document_overlay_cache.d.ts +4 -4
  50. package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +1 -1
  51. package/dist/lite/index.browser.esm2017.js +34 -24
  52. package/dist/lite/index.browser.esm2017.js.map +1 -1
  53. package/dist/lite/index.browser.esm5.js +12 -23
  54. package/dist/lite/index.browser.esm5.js.map +1 -1
  55. package/dist/lite/index.node.cjs.js +21 -9
  56. package/dist/lite/index.node.cjs.js.map +1 -1
  57. package/dist/lite/index.node.mjs +21 -9
  58. package/dist/lite/index.node.mjs.map +1 -1
  59. package/dist/lite/index.rn.esm2017.js +34 -24
  60. package/dist/lite/index.rn.esm2017.js.map +1 -1
  61. package/dist/lite/packages/firestore/src/index/index_entry.d.ts +6 -0
  62. package/dist/lite/packages/firestore/src/local/document_overlay_cache.d.ts +4 -5
  63. package/dist/lite/packages/firestore/src/local/index_manager.d.ts +2 -2
  64. package/dist/lite/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +4 -5
  65. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +48 -1
  66. package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +34 -553
  67. package/dist/lite/packages/firestore/src/local/indexeddb_sentinels.d.ts +238 -0
  68. package/dist/lite/packages/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
  69. package/dist/lite/packages/firestore/src/local/local_serializer.d.ts +2 -1
  70. package/dist/lite/packages/firestore/src/local/memory_document_overlay_cache.d.ts +4 -5
  71. package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +1 -1
  72. package/dist/lite/packages/firestore/src/local/simple_db.d.ts +11 -0
  73. package/dist/lite/packages/firestore/src/model/collections.d.ts +7 -0
  74. package/dist/lite/packages/firestore/src/model/field_index.d.ts +2 -0
  75. package/dist/lite/packages/firestore/src/model/type_order.d.ts +2 -1
  76. package/dist/lite/packages/firestore/src/platform/node/base64.d.ts +1 -0
  77. package/dist/lite/packages/firestore/src/util/obj_map.d.ts +3 -0
  78. package/dist/lite/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +4 -4
  79. package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +1 -1
  80. package/dist/packages/firestore/dist/index.esm2017.d.ts +191 -191
  81. package/dist/packages/firestore/src/index/index_entry.d.ts +6 -0
  82. package/dist/packages/firestore/src/local/document_overlay_cache.d.ts +4 -5
  83. package/dist/packages/firestore/src/local/index_manager.d.ts +2 -2
  84. package/dist/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +4 -5
  85. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +48 -1
  86. package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +34 -553
  87. package/dist/packages/firestore/src/local/indexeddb_sentinels.d.ts +238 -0
  88. package/dist/packages/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
  89. package/dist/packages/firestore/src/local/local_serializer.d.ts +2 -1
  90. package/dist/packages/firestore/src/local/memory_document_overlay_cache.d.ts +4 -5
  91. package/dist/packages/firestore/src/local/memory_index_manager.d.ts +1 -1
  92. package/dist/packages/firestore/src/local/simple_db.d.ts +11 -0
  93. package/dist/packages/firestore/src/model/collections.d.ts +7 -0
  94. package/dist/packages/firestore/src/model/field_index.d.ts +2 -0
  95. package/dist/packages/firestore/src/model/type_order.d.ts +2 -1
  96. package/dist/packages/firestore/src/platform/node/base64.d.ts +1 -0
  97. package/dist/packages/firestore/src/util/obj_map.d.ts +3 -0
  98. package/dist/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +4 -4
  99. package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +1 -1
  100. package/dist/private.d.ts +12 -5
  101. package/package.json +7 -7
@@ -0,0 +1,238 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { BatchId, TargetId } from '../core/types';
18
+ import { ResourcePath } from '../model/path';
19
+ import { EncodedResourcePath } from './encoded_resource_path';
20
+ import { DbDocumentMutation } from './indexeddb_schema';
21
+ /** A timestamp type that can be used in IndexedDb keys. */
22
+ export declare type DbTimestampKey = [/* seconds */ number, /* nanos */ number];
23
+ export declare type DbPrimaryClientKey = typeof DbPrimaryClientKey;
24
+ /**
25
+ * Name of the IndexedDb object store.
26
+ *
27
+ * Note that the name 'owner' is chosen to ensure backwards compatibility with
28
+ * older clients that only supported single locked access to the persistence
29
+ * layer.
30
+ */
31
+ export declare const DbPrimaryClientStore = "owner";
32
+ /**
33
+ * The key string used for the single object that exists in the
34
+ * DbPrimaryClient store.
35
+ */
36
+ export declare const DbPrimaryClientKey = "owner";
37
+ /** Object keys in the 'mutationQueues' store are userId strings. */
38
+ export declare type DbMutationQueueKey = string;
39
+ /** Name of the IndexedDb object store. */
40
+ export declare const DbMutationQueueStore = "mutationQueues";
41
+ /** Keys are automatically assigned via the userId property. */
42
+ export declare const DbMutationQueueKeyPath = "userId";
43
+ /** The 'mutations' store is keyed by batch ID. */
44
+ export declare type DbMutationBatchKey = BatchId;
45
+ /** Name of the IndexedDb object store. */
46
+ export declare const DbMutationBatchStore = "mutations";
47
+ /** Keys are automatically assigned via the userId, batchId properties. */
48
+ export declare const DbMutationBatchKeyPath = "batchId";
49
+ /** The index name for lookup of mutations by user. */
50
+ export declare const DbMutationBatchUserMutationsIndex = "userMutationsIndex";
51
+ /** The user mutations index is keyed by [userId, batchId] pairs. */
52
+ export declare const DbMutationBatchUserMutationsKeyPath: string[];
53
+ /**
54
+ * The key for a db document mutation, which is made up of a userID, path, and
55
+ * batchId. Note that the path must be serialized into a form that indexedDB can
56
+ * sort.
57
+ */
58
+ export declare type DbDocumentMutationKey = [string, EncodedResourcePath, BatchId];
59
+ /**
60
+ * Creates a [userId] key for use in the DbDocumentMutations index to iterate
61
+ * over all of a user's document mutations.
62
+ */
63
+ export declare function newDbDocumentMutationPrefixForUser(userId: string): [string];
64
+ /**
65
+ * Creates a [userId, encodedPath] key for use in the DbDocumentMutations
66
+ * index to iterate over all at document mutations for a given path or lower.
67
+ */
68
+ export declare function newDbDocumentMutationPrefixForPath(userId: string, path: ResourcePath): [string, EncodedResourcePath];
69
+ /**
70
+ * Creates a full index key of [userId, encodedPath, batchId] for inserting
71
+ * and deleting into the DbDocumentMutations index.
72
+ */
73
+ export declare function newDbDocumentMutationKey(userId: string, path: ResourcePath, batchId: BatchId): DbDocumentMutationKey;
74
+ /**
75
+ * Because we store all the useful information for this store in the key,
76
+ * there is no useful information to store as the value. The raw (unencoded)
77
+ * path cannot be stored because IndexedDb doesn't store prototype
78
+ * information.
79
+ */
80
+ export declare const DbDocumentMutationPlaceholder: DbDocumentMutation;
81
+ export declare const DbDocumentMutationStore = "documentMutations";
82
+ export declare const DbRemoteDocumentStore = "remoteDocuments";
83
+ /**
84
+ * An index that provides access to all entries sorted by read time (which
85
+ * corresponds to the last modification time of each row).
86
+ *
87
+ * This index is used to provide a changelog for Multi-Tab.
88
+ */
89
+ export declare const DbRemoteDocumentReadTimeIndex = "readTimeIndex";
90
+ export declare const DbRemoteDocumentReadTimeIndexPath = "readTime";
91
+ /**
92
+ * An index that provides access to documents in a collection sorted by read
93
+ * time.
94
+ *
95
+ * This index is used to allow the RemoteDocumentCache to fetch newly changed
96
+ * documents in a collection.
97
+ */
98
+ export declare const DbRemoteDocumentCollectionReadTimeIndex = "collectionReadTimeIndex";
99
+ export declare const DbRemoteDocumentCollectionReadTimeIndexPath: string[];
100
+ export declare const DbRemoteDocumentGlobalStore = "remoteDocumentGlobal";
101
+ export declare const DbRemoteDocumentGlobalKey = "remoteDocumentGlobalKey";
102
+ export declare type DbRemoteDocumentGlobalKey = typeof DbRemoteDocumentGlobalKey;
103
+ /**
104
+ * A key in the 'targets' object store is a targetId of the query.
105
+ */
106
+ export declare type DbTargetKey = TargetId;
107
+ export declare const DbTargetStore = "targets";
108
+ /** Keys are automatically assigned via the targetId property. */
109
+ export declare const DbTargetKeyPath = "targetId";
110
+ /** The name of the queryTargets index. */
111
+ export declare const DbTargetQueryTargetsIndexName = "queryTargetsIndex";
112
+ /**
113
+ * The index of all canonicalIds to the targets that they match. This is not
114
+ * a unique mapping because canonicalId does not promise a unique name for all
115
+ * possible queries, so we append the targetId to make the mapping unique.
116
+ */
117
+ export declare const DbTargetQueryTargetsKeyPath: string[];
118
+ /**
119
+ * The key for a DbTargetDocument, containing a targetId and an encoded resource
120
+ * path.
121
+ */
122
+ export declare type DbTargetDocumentKey = [TargetId, EncodedResourcePath];
123
+ /** Name of the IndexedDb object store. */
124
+ export declare const DbTargetDocumentStore = "targetDocuments";
125
+ /** Keys are automatically assigned via the targetId, path properties. */
126
+ export declare const DbTargetDocumentKeyPath: string[];
127
+ /** The index name for the reverse index. */
128
+ export declare const DbTargetDocumentDocumentTargetsIndex = "documentTargetsIndex";
129
+ /** We also need to create the reverse index for these properties. */
130
+ export declare const DbTargetDocumentDocumentTargetsKeyPath: string[];
131
+ /**
132
+ * The type to represent the single allowed key for the DbTargetGlobal store.
133
+ */
134
+ export declare type DbTargetGlobalKey = typeof DbTargetGlobalKey;
135
+ /**
136
+ * The key string used for the single object that exists in the
137
+ * DbTargetGlobal store.
138
+ */
139
+ export declare const DbTargetGlobalKey = "targetGlobalKey";
140
+ export declare const DbTargetGlobalStore = "targetGlobal";
141
+ /**
142
+ * The key for a DbCollectionParent entry, containing the collection ID
143
+ * and the parent path that contains it. Note that the parent path will be an
144
+ * empty path in the case of root-level collections.
145
+ */
146
+ export declare type DbCollectionParentKey = [string, EncodedResourcePath];
147
+ /** Name of the IndexedDb object store. */
148
+ export declare const DbCollectionParentStore = "collectionParents";
149
+ /** Keys are automatically assigned via the collectionId, parent properties. */
150
+ export declare const DbCollectionParentKeyPath: string[];
151
+ /** Name of the IndexedDb object store. */
152
+ export declare const DbClientMetadataStore = "clientMetadata";
153
+ /** Keys are automatically assigned via the clientId properties. */
154
+ export declare const DbClientMetadataKeyPath = "clientId";
155
+ /** Object keys in the 'clientMetadata' store are clientId strings. */
156
+ export declare type DbClientMetadataKey = string;
157
+ export declare type DbBundlesKey = string;
158
+ /** Name of the IndexedDb object store. */
159
+ export declare const DbBundleStore = "bundles";
160
+ export declare const DbBundleKeyPath = "bundleId";
161
+ export declare type DbNamedQueriesKey = string;
162
+ /** Name of the IndexedDb object store. */
163
+ export declare const DbNamedQueryStore = "namedQueries";
164
+ export declare const DbNamedQueryKeyPath = "name";
165
+ /** The key for each index consisting of just the index id. */
166
+ export declare type DbIndexConfigurationKey = number;
167
+ /** Name of the IndexedDb object store. */
168
+ export declare const DbIndexConfigurationStore = "indexConfiguration";
169
+ export declare const DbIndexConfigurationKeyPath = "indexId";
170
+ /**
171
+ * An index that provides access to the index configurations by collection
172
+ * group.
173
+ *
174
+ * PORTING NOTE: iOS and Android maintain this index in-memory, but this is
175
+ * not possible here as the Web client supports concurrent access to
176
+ * persistence via multi-tab.
177
+ */
178
+ export declare const DbIndexConfigurationCollectionGroupIndex = "collectionGroupIndex";
179
+ export declare const DbIndexConfigurationCollectionGroupIndexPath = "collectionGroup";
180
+ /** The key for each index state consisting of the index id and its user id. */
181
+ export declare type DbIndexStateKey = [number, string];
182
+ /** Name of the IndexedDb object store. */
183
+ export declare const DbIndexStateStore = "indexState";
184
+ export declare const DbIndexStateKeyPath: string[];
185
+ /**
186
+ * An index that provides access to documents in a collection sorted by last
187
+ * update time. Used by the backfiller.
188
+ *
189
+ * PORTING NOTE: iOS and Android maintain this index in-memory, but this is
190
+ * not possible here as the Web client supports concurrent access to
191
+ * persistence via multi-tab.
192
+ */
193
+ export declare const DbIndexStateSequenceNumberIndex = "sequenceNumberIndex";
194
+ export declare const DbIndexStateSequenceNumberIndexPath: string[];
195
+ /**
196
+ * The key for each index entry consists of the index id and its user id,
197
+ * the encoded array and directional value for the indexed fields as well as
198
+ * the encoded document path for the indexed document.
199
+ */
200
+ export declare type DbIndexEntryKey = [number, string, Uint8Array, Uint8Array, string];
201
+ /** Name of the IndexedDb object store. */
202
+ export declare const DbIndexEntryStore = "indexEntries";
203
+ export declare const DbIndexEntryKeyPath: string[];
204
+ export declare const DbIndexEntryDocumentKeyIndex = "documentKeyIndex";
205
+ export declare const DbIndexEntryDocumentKeyIndexPath: string[];
206
+ export declare type DbDocumentOverlayKey = [
207
+ string,
208
+ string,
209
+ string
210
+ ];
211
+ /** Name of the IndexedDb object store. */
212
+ export declare const DbDocumentOverlayStore = "documentOverlays";
213
+ export declare const DbDocumentOverlayKeyPath: string[];
214
+ export declare const DbDocumentOverlayCollectionPathOverlayIndex = "collectionPathOverlayIndex";
215
+ export declare const DbDocumentOverlayCollectionPathOverlayIndexPath: string[];
216
+ export declare const DbDocumentOverlayCollectionGroupOverlayIndex = "collectionGroupOverlayIndex";
217
+ export declare const DbDocumentOverlayCollectionGroupOverlayIndexPath: string[];
218
+ export declare const V1_STORES: string[];
219
+ export declare const V3_STORES: string[];
220
+ export declare const V4_STORES: string[];
221
+ export declare const V6_STORES: string[];
222
+ export declare const V8_STORES: string[];
223
+ export declare const V11_STORES: string[];
224
+ export declare const V12_STORES: string[];
225
+ export declare const V13_STORES: string[];
226
+ /**
227
+ * The list of all default IndexedDB stores used throughout the SDK. This is
228
+ * used when creating transactions so that access across all stores is done
229
+ * atomically.
230
+ */
231
+ export declare const ALL_STORES: string[];
232
+ /** Returns the object stores for the provided schema. */
233
+ export declare function getObjectStores(schemaVersion: number): string[];
234
+ /**
235
+ * A key in the 'remoteDocuments' object store is a string array containing the
236
+ * segments that make up the path.
237
+ */
238
+ export declare type DbRemoteDocumentKey = string[];
@@ -20,7 +20,8 @@ import { ListenSequenceNumber, TargetId } from '../core/types';
20
20
  import { DocumentKeySet } from '../model/collections';
21
21
  import { DocumentKey } from '../model/document_key';
22
22
  import { IndexedDbLruDelegate } from './indexeddb_lru_delegate';
23
- import { DbTargetDocument, DbTargetDocumentKey } from './indexeddb_schema';
23
+ import { DbTargetDocument } from './indexeddb_schema';
24
+ import { DbTargetDocumentKey } from './indexeddb_sentinels';
24
25
  import { LocalSerializer } from './local_serializer';
25
26
  import { ActiveTargets } from './lru_garbage_collector';
26
27
  import { PersistencePromise } from './persistence_promise';
@@ -25,7 +25,8 @@ import { MutationBatch } from '../model/mutation_batch';
25
25
  import { Overlay } from '../model/overlay';
26
26
  import { BundledQuery as ProtoBundledQuery, BundleMetadata as ProtoBundleMetadata, NamedQuery as ProtoNamedQuery } from '../protos/firestore_bundle_proto';
27
27
  import { JsonProtoSerializer } from '../remote/serializer';
28
- import { DbBundle, DbDocumentOverlay, DbDocumentOverlayKey, DbIndexConfiguration, DbIndexState, DbMutationBatch, DbNamedQuery, DbRemoteDocument, DbTarget, DbTimestampKey } from './indexeddb_schema';
28
+ import { DbBundle, DbDocumentOverlay, DbIndexConfiguration, DbIndexState, DbMutationBatch, DbNamedQuery, DbRemoteDocument, DbTarget } from './indexeddb_schema';
29
+ import { DbDocumentOverlayKey, DbTimestampKey } from './indexeddb_sentinels';
29
30
  import { TargetData } from './target_data';
30
31
  /** Serializer for values stored in the LocalStore. */
31
32
  export declare class LocalSerializer {
@@ -14,9 +14,8 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { DocumentKeySet } from '../model/collections';
17
+ import { DocumentKeySet, MutationMap, OverlayMap } from '../model/collections';
18
18
  import { DocumentKey } from '../model/document_key';
19
- import { Mutation } from '../model/mutation';
20
19
  import { Overlay } from '../model/overlay';
21
20
  import { ResourcePath } from '../model/path';
22
21
  import { DocumentOverlayCache } from './document_overlay_cache';
@@ -29,9 +28,9 @@ export declare class MemoryDocumentOverlayCache implements DocumentOverlayCache
29
28
  private overlays;
30
29
  private overlayByBatchId;
31
30
  getOverlay(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<Overlay | null>;
32
- saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: Map<DocumentKey, Mutation>): PersistencePromise<void>;
31
+ saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: MutationMap): PersistencePromise<void>;
33
32
  removeOverlaysForBatchId(transaction: PersistenceTransaction, documentKeys: DocumentKeySet, batchId: number): PersistencePromise<void>;
34
- getOverlaysForCollection(transaction: PersistenceTransaction, collection: ResourcePath, sinceBatchId: number): PersistencePromise<Map<DocumentKey, Overlay>>;
35
- getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<Map<DocumentKey, Overlay>>;
33
+ getOverlaysForCollection(transaction: PersistenceTransaction, collection: ResourcePath, sinceBatchId: number): PersistencePromise<OverlayMap>;
34
+ getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<OverlayMap>;
36
35
  private saveOverlay;
37
36
  }
@@ -30,7 +30,7 @@ export declare class MemoryIndexManager implements IndexManager {
30
30
  getCollectionParents(transaction: PersistenceTransaction, collectionId: string): PersistencePromise<ResourcePath[]>;
31
31
  addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
32
32
  deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
33
- getDocumentsMatchingTarget(transaction: PersistenceTransaction, fieldIndex: FieldIndex, target: Target): PersistencePromise<DocumentKeySet>;
33
+ getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKeySet | null>;
34
34
  getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
35
35
  getFieldIndexes(transaction: PersistenceTransaction, collectionGroup?: string): PersistencePromise<FieldIndex[]>;
36
36
  getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>;
@@ -182,9 +182,20 @@ export declare class SimpleDbStore<KeyType extends IDBValidKey, ValueType extend
182
182
  * Returns the number of rows in the store.
183
183
  */
184
184
  count(): PersistencePromise<number>;
185
+ /** Loads all elements from the object store. */
185
186
  loadAll(): PersistencePromise<ValueType[]>;
187
+ /** Loads all elements for the index range from the object store. */
186
188
  loadAll(range: IDBKeyRange): PersistencePromise<ValueType[]>;
189
+ /**
190
+ * Loads all elements from the object store that fall into the provided in the
191
+ * index range for the given index.
192
+ */
187
193
  loadAll(index: string, range: IDBKeyRange): PersistencePromise<ValueType[]>;
194
+ /**
195
+ * Loads the first `count` elements from the provided index range. Loads all
196
+ * elements if no limit is provided.
197
+ */
198
+ loadFirst(range: IDBKeyRange, count: number | null): PersistencePromise<ValueType[]>;
188
199
  deleteAll(): PersistencePromise<void>;
189
200
  deleteAll(range: IDBKeyRange): PersistencePromise<void>;
190
201
  deleteAll(index: string, range: IDBKeyRange): PersistencePromise<void>;
@@ -16,10 +16,13 @@
16
16
  */
17
17
  import { SnapshotVersion } from '../core/snapshot_version';
18
18
  import { TargetId } from '../core/types';
19
+ import { ObjectMap } from '../util/obj_map';
19
20
  import { SortedMap } from '../util/sorted_map';
20
21
  import { SortedSet } from '../util/sorted_set';
21
22
  import { Document, MutableDocument } from './document';
22
23
  import { DocumentKey } from './document_key';
24
+ import { Mutation } from './mutation';
25
+ import { Overlay } from './overlay';
23
26
  /** Miscellaneous collection types / constants. */
24
27
  export declare type MutableDocumentMap = SortedMap<DocumentKey, MutableDocument>;
25
28
  export declare function mutableDocumentMap(): MutableDocumentMap;
@@ -29,6 +32,10 @@ export interface DocumentSizeEntries {
29
32
  }
30
33
  export declare type DocumentMap = SortedMap<DocumentKey, Document>;
31
34
  export declare function documentMap(): DocumentMap;
35
+ export declare type OverlayMap = ObjectMap<DocumentKey, Overlay>;
36
+ export declare function newOverlayMap(): OverlayMap;
37
+ export declare type MutationMap = ObjectMap<DocumentKey, Mutation>;
38
+ export declare function newMutationMap(): MutationMap;
32
39
  export declare type DocumentVersionMap = SortedMap<DocumentKey, SnapshotVersion>;
33
40
  export declare function documentVersionMap(): DocumentVersionMap;
34
41
  export declare type DocumentKeySet = SortedSet<DocumentKey>;
@@ -70,6 +70,8 @@ export declare function fieldIndexGetDirectionalSegments(fieldIndex: FieldIndex)
70
70
  * index ID.
71
71
  */
72
72
  export declare function fieldIndexSemanticComparator(left: FieldIndex, right: FieldIndex): number;
73
+ /** Returns a debug representation of the field index */
74
+ export declare function fieldIndexToString(fieldIndex: FieldIndex): string;
73
75
  /** The type of the index, e.g. for which type of query it can be used. */
74
76
  export declare const enum IndexKind {
75
77
  /**
@@ -32,5 +32,6 @@ export declare const enum TypeOrder {
32
32
  RefValue = 7,
33
33
  GeoPointValue = 8,
34
34
  ArrayValue = 9,
35
- ObjectValue = 10
35
+ ObjectValue = 10,
36
+ MaxValue = 9007199254740991
36
37
  }
@@ -14,6 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ /** Converts a Base64 encoded string to a binary string. */
17
18
  export declare function decodeBase64(encoded: string): string;
18
19
  /** Converts a binary string to a Base64 encoded string. */
19
20
  export declare function encodeBase64(raw: string): string;
@@ -30,6 +30,8 @@ export declare class ObjectMap<KeyType, ValueType> {
30
30
  * constant time lookups in practice.
31
31
  */
32
32
  private inner;
33
+ /** The number of entries stored in the map */
34
+ private innerSize;
33
35
  constructor(mapKeyFn: (key: KeyType) => string, equalsFn: (l: KeyType, r: KeyType) => boolean);
34
36
  /** Get a value for this key, or undefined if it does not exist. */
35
37
  get(key: KeyType): ValueType | undefined;
@@ -42,4 +44,5 @@ export declare class ObjectMap<KeyType, ValueType> {
42
44
  delete(key: KeyType): boolean;
43
45
  forEach(fn: (key: KeyType, val: ValueType) => void): void;
44
46
  isEmpty(): boolean;
47
+ size(): number;
45
48
  }
@@ -16,7 +16,7 @@
16
16
  */
17
17
  import { DocumentOverlayCache } from '../../../src/local/document_overlay_cache';
18
18
  import { Persistence } from '../../../src/local/persistence';
19
- import { DocumentKeySet } from '../../../src/model/collections';
19
+ import { DocumentKeySet, MutationMap, OverlayMap } from '../../../src/model/collections';
20
20
  import { DocumentKey } from '../../../src/model/document_key';
21
21
  import { Mutation } from '../../../src/model/mutation';
22
22
  import { Overlay } from '../../../src/model/overlay';
@@ -29,10 +29,10 @@ export declare class TestDocumentOverlayCache {
29
29
  private persistence;
30
30
  private cache;
31
31
  constructor(persistence: Persistence, cache: DocumentOverlayCache);
32
- saveOverlays(largestBatch: number, data: Map<DocumentKey, Mutation>): Promise<void>;
32
+ saveOverlays(largestBatch: number, data: MutationMap): Promise<void>;
33
33
  getOverlay(key: DocumentKey): Promise<Overlay | null>;
34
34
  getOverlayMutation(docKey: string): Promise<Mutation | null>;
35
- getOverlaysForCollection(path: ResourcePath, sinceBatchId: number): Promise<Map<DocumentKey, Overlay>>;
36
- getOverlaysForCollectionGroup(collectionGroup: string, sinceBatchId: number, count: number): Promise<Map<DocumentKey, Overlay>>;
35
+ getOverlaysForCollection(path: ResourcePath, sinceBatchId: number): Promise<OverlayMap>;
36
+ getOverlaysForCollectionGroup(collectionGroup: string, sinceBatchId: number, count: number): Promise<OverlayMap>;
37
37
  removeOverlaysForBatchId(documentKeys: DocumentKeySet, batchId: number): Promise<void>;
38
38
  }
@@ -34,7 +34,7 @@ export declare class TestIndexManager {
34
34
  deleteFieldIndex(index: FieldIndex): Promise<void>;
35
35
  getFieldIndexes(collectionGroup?: string): Promise<FieldIndex[]>;
36
36
  getFieldIndex(target: Target): Promise<FieldIndex | null>;
37
- getDocumentsMatchingTarget(fieldIndex: FieldIndex, target: Target): Promise<DocumentKeySet>;
37
+ getDocumentsMatchingTarget(target: Target): Promise<DocumentKeySet | null>;
38
38
  getNextCollectionGroupToUpdate(): Promise<string | null>;
39
39
  updateCollectionGroup(collectionGroup: string, offset: IndexOffset): Promise<void>;
40
40
  updateIndexEntries(documents: DocumentMap): Promise<void>;
@@ -63,7 +63,7 @@ l.MOCK_USER = new l("mock-user");
63
63
  * See the License for the specific language governing permissions and
64
64
  * limitations under the License.
65
65
  */
66
- let f = "9.6.7";
66
+ let f = "9.6.9-2022216223411";
67
67
 
68
68
  /**
69
69
  * @license
@@ -1471,6 +1471,8 @@ class It {
1471
1471
  return new It(e);
1472
1472
  }
1473
1473
  static fromUint8Array(t) {
1474
+ // TODO(indexing); Remove the copy of the byte string here as this method
1475
+ // is frequently called during indexing.
1474
1476
  const e =
1475
1477
  /**
1476
1478
  * Helper function to convert an Uint8array to a binary string.
@@ -1656,8 +1658,33 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1656
1658
  * See the License for the specific language governing permissions and
1657
1659
  * limitations under the License.
1658
1660
  */
1659
- /** Extracts the backend's type order for the provided value. */ function St(t) {
1660
- return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Dt(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ : g();
1661
+ /** Extracts the backend's type order for the provided value. */
1662
+ function St(t) {
1663
+ return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Dt(t) ? 4 /* ServerTimestampValue */ :
1664
+ /** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
1665
+ function(t) {
1666
+ return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue;
1667
+ }
1668
+ /**
1669
+ * @license
1670
+ * Copyright 2017 Google LLC
1671
+ *
1672
+ * Licensed under the Apache License, Version 2.0 (the "License");
1673
+ * you may not use this file except in compliance with the License.
1674
+ * You may obtain a copy of the License at
1675
+ *
1676
+ * http://www.apache.org/licenses/LICENSE-2.0
1677
+ *
1678
+ * Unless required by applicable law or agreed to in writing, software
1679
+ * distributed under the License is distributed on an "AS IS" BASIS,
1680
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1681
+ * See the License for the specific language governing permissions and
1682
+ * limitations under the License.
1683
+ */
1684
+ /**
1685
+ * An ObjectValue represents a MapValue in the Firestore Proto and offers the
1686
+ * ability to add and remove fields (via the ObjectValueBuilder).
1687
+ */ (t) ? 9 /* ArrayValue */ : 10 /* ObjectValue */ : g();
1661
1688
  }
1662
1689
 
1663
1690
  /** Tests `left` and `right` for equality based on the backend semantics. */ function Ft(t, e) {
@@ -1666,6 +1693,7 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1666
1693
  if (n !== St(e)) return !1;
1667
1694
  switch (n) {
1668
1695
  case 0 /* NullValue */ :
1696
+ case 9007199254740991 /* MaxValue */ :
1669
1697
  return !0;
1670
1698
 
1671
1699
  case 1 /* BooleanValue */ :
@@ -1736,6 +1764,7 @@ function qt(t, e) {
1736
1764
  if (n !== r) return yt(n, r);
1737
1765
  switch (n) {
1738
1766
  case 0 /* NullValue */ :
1767
+ case 9007199254740991 /* MaxValue */ :
1739
1768
  return 0;
1740
1769
 
1741
1770
  case 1 /* BooleanValue */ :
@@ -1869,26 +1898,7 @@ function Ct(t, e) {
1869
1898
  return Object.assign({}, t);
1870
1899
  }
1871
1900
 
1872
- /**
1873
- * @license
1874
- * Copyright 2017 Google LLC
1875
- *
1876
- * Licensed under the Apache License, Version 2.0 (the "License");
1877
- * you may not use this file except in compliance with the License.
1878
- * You may obtain a copy of the License at
1879
- *
1880
- * http://www.apache.org/licenses/LICENSE-2.0
1881
- *
1882
- * Unless required by applicable law or agreed to in writing, software
1883
- * distributed under the License is distributed on an "AS IS" BASIS,
1884
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1885
- * See the License for the specific language governing permissions and
1886
- * limitations under the License.
1887
- */
1888
- /**
1889
- * An ObjectValue represents a MapValue in the Firestore Proto and offers the
1890
- * ability to add and remove fields (via the ObjectValueBuilder).
1891
- */ class Bt {
1901
+ class Bt {
1892
1902
  constructor(t) {
1893
1903
  this.value = t;
1894
1904
  }
@@ -5961,7 +5971,7 @@ class Ur {
5961
5971
  return e && r._setSettings(e), r;
5962
5972
  }), "PUBLIC")),
5963
5973
  // RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
5964
- registerVersion("firestore-lite", "3.4.5", ""), registerVersion("firestore-lite", "3.4.5", "esm2017");
5974
+ registerVersion("firestore-lite", "3.4.6-2022216223411", ""), registerVersion("firestore-lite", "3.4.6-2022216223411", "esm2017");
5965
5975
 
5966
5976
  export { gn as Bytes, ln as CollectionReference, an as DocumentReference, Yn as DocumentSnapshot, yn as FieldPath, vn as FieldValue, rn as Firestore, U as FirestoreError, bn as GeoPoint, hn as Query, Zn as QueryConstraint, Hn as QueryDocumentSnapshot, Kn as QuerySnapshot, gt as Timestamp, Ur as Transaction, $r as WriteBatch, Ar as addDoc, Dr as arrayRemove, Vr as arrayUnion, fn as collection, dn as collectionGroup, un as connectFirestoreEmulator, Ir as deleteDoc, Rr as deleteField, wn as doc, _n as documentId, dr as endAt, fr as endBefore, vr as getDoc, br as getDocs, on as getFirestore, Nr as increment, sn as initializeFirestore, or as limit, ur as limitToLast, sr as orderBy, tr as query, pn as queryEqual, mn as refEqual, kr as runTransaction, Pr as serverTimestamp, Er as setDoc, w as setLogLevel, Jn as snapshotEqual, hr as startAfter, ar as startAt, cn as terminate, Tr as updateDoc, nr as where, Fr as writeBatch };
5967
5977
  //# sourceMappingURL=index.browser.esm2017.js.map