@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.
- package/CHANGELOG.md +9 -0
- package/dist/firestore/src/index/index_entry.d.ts +6 -0
- package/dist/firestore/src/local/document_overlay_cache.d.ts +4 -5
- package/dist/firestore/src/local/index_manager.d.ts +2 -2
- package/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts +4 -5
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +48 -1
- package/dist/firestore/src/local/indexeddb_schema.d.ts +34 -553
- package/dist/firestore/src/local/indexeddb_sentinels.d.ts +238 -0
- package/dist/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
- package/dist/firestore/src/local/local_serializer.d.ts +2 -1
- package/dist/firestore/src/local/memory_document_overlay_cache.d.ts +4 -5
- package/dist/firestore/src/local/memory_index_manager.d.ts +1 -1
- package/dist/firestore/src/local/simple_db.d.ts +11 -0
- package/dist/firestore/src/model/collections.d.ts +7 -0
- package/dist/firestore/src/model/field_index.d.ts +2 -0
- package/dist/firestore/src/model/type_order.d.ts +2 -1
- package/dist/firestore/src/platform/node/base64.d.ts +1 -0
- package/dist/firestore/src/util/obj_map.d.ts +3 -0
- package/dist/firestore/test/unit/local/test_document_overlay_cache.d.ts +4 -4
- package/dist/firestore/test/unit/local/test_index_manager.d.ts +1 -1
- package/dist/index.esm2017.js +4160 -4201
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +4332 -4311
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +1223 -956
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +1223 -956
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +4157 -4198
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +12 -5
- package/dist/lite/firestore/src/index/index_entry.d.ts +6 -0
- package/dist/lite/firestore/src/local/document_overlay_cache.d.ts +4 -5
- package/dist/lite/firestore/src/local/index_manager.d.ts +2 -2
- package/dist/lite/firestore/src/local/indexeddb_document_overlay_cache.d.ts +4 -5
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +48 -1
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +34 -553
- package/dist/lite/firestore/src/local/indexeddb_sentinels.d.ts +238 -0
- package/dist/lite/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
- package/dist/lite/firestore/src/local/local_serializer.d.ts +2 -1
- package/dist/lite/firestore/src/local/memory_document_overlay_cache.d.ts +4 -5
- package/dist/lite/firestore/src/local/memory_index_manager.d.ts +1 -1
- package/dist/lite/firestore/src/local/simple_db.d.ts +11 -0
- package/dist/lite/firestore/src/model/collections.d.ts +7 -0
- package/dist/lite/firestore/src/model/field_index.d.ts +2 -0
- package/dist/lite/firestore/src/model/type_order.d.ts +2 -1
- package/dist/lite/firestore/src/platform/node/base64.d.ts +1 -0
- package/dist/lite/firestore/src/util/obj_map.d.ts +3 -0
- package/dist/lite/firestore/test/unit/local/test_document_overlay_cache.d.ts +4 -4
- package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +1 -1
- package/dist/lite/index.browser.esm2017.js +34 -24
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +12 -23
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +21 -9
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +21 -9
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +34 -24
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/src/index/index_entry.d.ts +6 -0
- package/dist/lite/packages/firestore/src/local/document_overlay_cache.d.ts +4 -5
- package/dist/lite/packages/firestore/src/local/index_manager.d.ts +2 -2
- package/dist/lite/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +4 -5
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +48 -1
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +34 -553
- package/dist/lite/packages/firestore/src/local/indexeddb_sentinels.d.ts +238 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
- package/dist/lite/packages/firestore/src/local/local_serializer.d.ts +2 -1
- package/dist/lite/packages/firestore/src/local/memory_document_overlay_cache.d.ts +4 -5
- package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +1 -1
- package/dist/lite/packages/firestore/src/local/simple_db.d.ts +11 -0
- package/dist/lite/packages/firestore/src/model/collections.d.ts +7 -0
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +2 -0
- package/dist/lite/packages/firestore/src/model/type_order.d.ts +2 -1
- package/dist/lite/packages/firestore/src/platform/node/base64.d.ts +1 -0
- package/dist/lite/packages/firestore/src/util/obj_map.d.ts +3 -0
- package/dist/lite/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +4 -4
- package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +1 -1
- package/dist/packages/firestore/dist/index.esm2017.d.ts +191 -191
- package/dist/packages/firestore/src/index/index_entry.d.ts +6 -0
- package/dist/packages/firestore/src/local/document_overlay_cache.d.ts +4 -5
- package/dist/packages/firestore/src/local/index_manager.d.ts +2 -2
- package/dist/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +4 -5
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +48 -1
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +34 -553
- package/dist/packages/firestore/src/local/indexeddb_sentinels.d.ts +238 -0
- package/dist/packages/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
- package/dist/packages/firestore/src/local/local_serializer.d.ts +2 -1
- package/dist/packages/firestore/src/local/memory_document_overlay_cache.d.ts +4 -5
- package/dist/packages/firestore/src/local/memory_index_manager.d.ts +1 -1
- package/dist/packages/firestore/src/local/simple_db.d.ts +11 -0
- package/dist/packages/firestore/src/model/collections.d.ts +7 -0
- package/dist/packages/firestore/src/model/field_index.d.ts +2 -0
- package/dist/packages/firestore/src/model/type_order.d.ts +2 -1
- package/dist/packages/firestore/src/platform/node/base64.d.ts +1 -0
- package/dist/packages/firestore/src/util/obj_map.d.ts +3 -0
- package/dist/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +4 -4
- package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +1 -1
- package/dist/private.d.ts +12 -5
- 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
|
|
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,
|
|
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:
|
|
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<
|
|
35
|
-
getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<
|
|
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,
|
|
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
|
/**
|
|
@@ -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:
|
|
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<
|
|
36
|
-
getOverlaysForCollectionGroup(collectionGroup: string, sinceBatchId: number, count: number): Promise<
|
|
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(
|
|
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>;
|
package/dist/private.d.ts
CHANGED
|
@@ -870,7 +870,7 @@ declare interface DocumentOverlayCache {
|
|
|
870
870
|
* Saves the given document mutation map to persistence as overlays.
|
|
871
871
|
* All overlays will have their largest batch id set to `largestBatchId`.
|
|
872
872
|
*/
|
|
873
|
-
saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays:
|
|
873
|
+
saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: MutationMap): PersistencePromise<void>;
|
|
874
874
|
/** Removes overlays for the given document keys and batch ID. */
|
|
875
875
|
removeOverlaysForBatchId(transaction: PersistenceTransaction, documentKeys: DocumentKeySet, batchId: number): PersistencePromise<void>;
|
|
876
876
|
/**
|
|
@@ -882,7 +882,7 @@ declare interface DocumentOverlayCache {
|
|
|
882
882
|
* Only overlays that contain a change past `sinceBatchId` are returned.
|
|
883
883
|
* @returns Mapping of each document key in the collection to its overlay.
|
|
884
884
|
*/
|
|
885
|
-
getOverlaysForCollection(transaction: PersistenceTransaction, collection: _ResourcePath, sinceBatchId: number): PersistencePromise<
|
|
885
|
+
getOverlaysForCollection(transaction: PersistenceTransaction, collection: _ResourcePath, sinceBatchId: number): PersistencePromise<OverlayMap>;
|
|
886
886
|
/**
|
|
887
887
|
* Returns `count` overlays with a batch ID higher than `sinceBatchId` for the
|
|
888
888
|
* provided collection group, processed by ascending batch ID. The method
|
|
@@ -897,7 +897,7 @@ declare interface DocumentOverlayCache {
|
|
|
897
897
|
* batch contains more entries.
|
|
898
898
|
* @return Mapping of each document key in the collection group to its overlay.
|
|
899
899
|
*/
|
|
900
|
-
getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<
|
|
900
|
+
getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<OverlayMap>;
|
|
901
901
|
}
|
|
902
902
|
|
|
903
903
|
/**
|
|
@@ -2309,9 +2309,9 @@ declare interface IndexManager {
|
|
|
2309
2309
|
getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
|
|
2310
2310
|
/**
|
|
2311
2311
|
* Returns the documents that match the given target based on the provided
|
|
2312
|
-
* index.
|
|
2312
|
+
* index or `null` if the target does not have a matching index.
|
|
2313
2313
|
*/
|
|
2314
|
-
getDocumentsMatchingTarget(transaction: PersistenceTransaction,
|
|
2314
|
+
getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKeySet | null>;
|
|
2315
2315
|
/**
|
|
2316
2316
|
* Returns the next collection group to update. Returns `null` if no group
|
|
2317
2317
|
* exists.
|
|
@@ -2818,6 +2818,8 @@ declare class MutationBatchResult {
|
|
|
2818
2818
|
static from(batch: MutationBatch, commitVersion: SnapshotVersion, results: MutationResult[]): MutationBatchResult;
|
|
2819
2819
|
}
|
|
2820
2820
|
|
|
2821
|
+
declare type MutationMap = ObjectMap<_DocumentKey, Mutation>;
|
|
2822
|
+
|
|
2821
2823
|
/** A queue of mutations to apply to the remote store. */
|
|
2822
2824
|
declare interface MutationQueue {
|
|
2823
2825
|
/** Returns true if this queue contains no mutation batches. */
|
|
@@ -3044,6 +3046,8 @@ declare class ObjectMap<KeyType, ValueType> {
|
|
|
3044
3046
|
* constant time lookups in practice.
|
|
3045
3047
|
*/
|
|
3046
3048
|
private inner;
|
|
3049
|
+
/** The number of entries stored in the map */
|
|
3050
|
+
private innerSize;
|
|
3047
3051
|
constructor(mapKeyFn: (key: KeyType) => string, equalsFn: (l: KeyType, r: KeyType) => boolean);
|
|
3048
3052
|
/** Get a value for this key, or undefined if it does not exist. */
|
|
3049
3053
|
get(key: KeyType): ValueType | undefined;
|
|
@@ -3056,6 +3060,7 @@ declare class ObjectMap<KeyType, ValueType> {
|
|
|
3056
3060
|
delete(key: KeyType): boolean;
|
|
3057
3061
|
forEach(fn: (key: KeyType, val: ValueType) => void): void;
|
|
3058
3062
|
isEmpty(): boolean;
|
|
3063
|
+
size(): number;
|
|
3059
3064
|
}
|
|
3060
3065
|
|
|
3061
3066
|
/**
|
|
@@ -3422,6 +3427,8 @@ declare class Overlay {
|
|
|
3422
3427
|
toString(): string;
|
|
3423
3428
|
}
|
|
3424
3429
|
|
|
3430
|
+
declare type OverlayMap = ObjectMap<_DocumentKey, Overlay>;
|
|
3431
|
+
|
|
3425
3432
|
declare interface ParseContext {
|
|
3426
3433
|
readonly databaseId: _DatabaseId;
|
|
3427
3434
|
readonly ignoreUndefinedProperties: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firebase/firestore",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.6-2022216223411",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=10.10.0"
|
|
6
6
|
},
|
|
@@ -77,9 +77,9 @@
|
|
|
77
77
|
"lite/package.json"
|
|
78
78
|
],
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@firebase/component": "0.5.
|
|
80
|
+
"@firebase/component": "0.5.11-2022216223411",
|
|
81
81
|
"@firebase/logger": "0.3.2",
|
|
82
|
-
"@firebase/util": "1.
|
|
82
|
+
"@firebase/util": "1.5.0-2022216223411",
|
|
83
83
|
"@firebase/webchannel-wrapper": "0.6.1",
|
|
84
84
|
"@grpc/grpc-js": "^1.3.2",
|
|
85
85
|
"@grpc/proto-loader": "^0.6.0",
|
|
@@ -87,12 +87,12 @@
|
|
|
87
87
|
"tslib": "^2.1.0"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
|
-
"@firebase/app": "0.
|
|
90
|
+
"@firebase/app": "0.7.19-2022216223411"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
|
-
"@firebase/app": "0.7.
|
|
94
|
-
"@firebase/app-compat": "0.1.
|
|
95
|
-
"@firebase/auth": "0.19.
|
|
93
|
+
"@firebase/app": "0.7.19-2022216223411",
|
|
94
|
+
"@firebase/app-compat": "0.1.20-2022216223411",
|
|
95
|
+
"@firebase/auth": "0.19.10-2022216223411",
|
|
96
96
|
"@rollup/plugin-alias": "3.1.5",
|
|
97
97
|
"@rollup/plugin-json": "4.1.0",
|
|
98
98
|
"@types/eslint": "7.28.0",
|