@firebase/firestore 3.4.5 → 3.4.6-canary.3198d58dc
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 +8 -0
- package/dist/firestore/src/core/bundle.d.ts +2 -2
- package/dist/firestore/src/core/bundle_impl.d.ts +2 -0
- package/dist/firestore/src/core/query.d.ts +7 -0
- package/dist/firestore/src/core/snapshot_version.d.ts +1 -0
- package/dist/firestore/src/core/sync_engine_impl.d.ts +1 -1
- 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_mutation_batch_impl.d.ts +2 -1
- package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +0 -17
- package/dist/firestore/src/local/indexeddb_schema.d.ts +47 -563
- package/dist/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
- package/dist/firestore/src/local/indexeddb_schema_legacy.d.ts +29 -0
- package/dist/firestore/src/local/indexeddb_sentinels.d.ts +243 -0
- package/dist/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
- package/dist/firestore/src/local/local_documents_view.d.ts +3 -4
- package/dist/firestore/src/local/local_serializer.d.ts +3 -1
- package/dist/firestore/src/local/local_store_impl.d.ts +1 -7
- 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/remote_document_cache.d.ts +13 -4
- package/dist/firestore/src/local/shared_client_state.d.ts +6 -3
- package/dist/firestore/src/local/shared_client_state_schema.d.ts +1 -1
- package/dist/firestore/src/local/shared_client_state_syncer.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 +10 -1
- 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/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -1
- package/dist/index.esm2017.js +4533 -4502
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +4455 -4308
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +1606 -1180
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +1606 -1180
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +4425 -4394
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +31 -10
- package/dist/lite/firestore/src/core/bundle.d.ts +2 -2
- package/dist/lite/firestore/src/core/bundle_impl.d.ts +2 -0
- package/dist/lite/firestore/src/core/query.d.ts +7 -0
- package/dist/lite/firestore/src/core/snapshot_version.d.ts +1 -0
- package/dist/lite/firestore/src/core/sync_engine_impl.d.ts +1 -1
- 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_mutation_batch_impl.d.ts +2 -1
- package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +0 -17
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +47 -563
- package/dist/lite/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
- package/dist/lite/firestore/src/local/indexeddb_schema_legacy.d.ts +29 -0
- package/dist/lite/firestore/src/local/indexeddb_sentinels.d.ts +243 -0
- package/dist/lite/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
- package/dist/lite/firestore/src/local/local_documents_view.d.ts +3 -4
- package/dist/lite/firestore/src/local/local_serializer.d.ts +3 -1
- package/dist/lite/firestore/src/local/local_store_impl.d.ts +1 -7
- 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/remote_document_cache.d.ts +13 -4
- package/dist/lite/firestore/src/local/shared_client_state.d.ts +6 -3
- package/dist/lite/firestore/src/local/shared_client_state_schema.d.ts +1 -1
- package/dist/lite/firestore/src/local/shared_client_state_syncer.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 +10 -1
- 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/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -1
- package/dist/lite/index.browser.esm2017.js +37 -24
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +104 -113
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +24 -9
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +24 -9
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +37 -24
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/bundle.d.ts +2 -2
- package/dist/lite/packages/firestore/src/core/bundle_impl.d.ts +2 -0
- package/dist/lite/packages/firestore/src/core/query.d.ts +7 -0
- package/dist/lite/packages/firestore/src/core/snapshot_version.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/sync_engine_impl.d.ts +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_mutation_batch_impl.d.ts +2 -1
- package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +0 -17
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +47 -563
- package/dist/lite/packages/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_schema_legacy.d.ts +29 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_sentinels.d.ts +243 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
- package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +3 -4
- package/dist/lite/packages/firestore/src/local/local_serializer.d.ts +3 -1
- package/dist/lite/packages/firestore/src/local/local_store_impl.d.ts +1 -7
- 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/remote_document_cache.d.ts +13 -4
- package/dist/lite/packages/firestore/src/local/shared_client_state.d.ts +6 -3
- package/dist/lite/packages/firestore/src/local/shared_client_state_schema.d.ts +1 -1
- package/dist/lite/packages/firestore/src/local/shared_client_state_syncer.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 +10 -1
- 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/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -1
- package/dist/lite/private.d.ts +1 -0
- package/dist/packages/firestore/dist/index.esm2017.d.ts +197 -197
- package/dist/packages/firestore/src/core/bundle.d.ts +2 -2
- package/dist/packages/firestore/src/core/bundle_impl.d.ts +2 -0
- package/dist/packages/firestore/src/core/query.d.ts +7 -0
- package/dist/packages/firestore/src/core/snapshot_version.d.ts +1 -0
- package/dist/packages/firestore/src/core/sync_engine_impl.d.ts +1 -1
- 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_mutation_batch_impl.d.ts +2 -1
- package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +0 -17
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +47 -563
- package/dist/packages/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
- package/dist/packages/firestore/src/local/indexeddb_schema_legacy.d.ts +29 -0
- package/dist/packages/firestore/src/local/indexeddb_sentinels.d.ts +243 -0
- package/dist/packages/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
- package/dist/packages/firestore/src/local/local_documents_view.d.ts +3 -4
- package/dist/packages/firestore/src/local/local_serializer.d.ts +3 -1
- package/dist/packages/firestore/src/local/local_store_impl.d.ts +1 -7
- 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/remote_document_cache.d.ts +13 -4
- package/dist/packages/firestore/src/local/shared_client_state.d.ts +6 -3
- package/dist/packages/firestore/src/local/shared_client_state_schema.d.ts +1 -1
- package/dist/packages/firestore/src/local/shared_client_state_syncer.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 +10 -1
- 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/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -1
- package/dist/private.d.ts +31 -10
- package/package.json +9 -9
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import { BatchId, TargetId } from '../core/types';
|
|
17
|
+
import { BatchId, ListenSequenceNumber, TargetId } from '../core/types';
|
|
18
18
|
import { IndexKind } from '../model/field_index';
|
|
19
|
-
import { ResourcePath } from '../model/path';
|
|
20
19
|
import { BundledQuery } from '../protos/firestore_bundle_proto';
|
|
21
20
|
import { Document as ProtoDocument, DocumentsTarget as ProtoDocumentsTarget, QueryTarget as ProtoQueryTarget, Write as ProtoWrite } from '../protos/firestore_proto_api';
|
|
22
21
|
import { EncodedResourcePath } from './encoded_resource_path';
|
|
23
|
-
|
|
22
|
+
import { DbTimestampKey } from './indexeddb_sentinels';
|
|
23
|
+
export declare const INDEXING_SCHEMA_VERSION = 14;
|
|
24
24
|
/**
|
|
25
25
|
* Schema Version for the Web client:
|
|
26
26
|
* 1. Initial version including Mutation Queue, Query Cache, and Remote
|
|
@@ -40,20 +40,18 @@ export declare const INDEXING_SCHEMA_VERSION = 13;
|
|
|
40
40
|
* 10. Rewrite the canonical IDs to the explicit Protobuf-based format.
|
|
41
41
|
* 11. Add bundles and named_queries for bundle support.
|
|
42
42
|
* 12. Add document overlays.
|
|
43
|
-
* 13.
|
|
43
|
+
* 13. Rewrite the keys of the remote document cache to allow for efficient
|
|
44
|
+
* document lookup via `getAll()`.
|
|
45
|
+
* 14. Add indexing support.
|
|
44
46
|
*/
|
|
45
47
|
export declare const SCHEMA_VERSION: number;
|
|
46
48
|
/**
|
|
47
49
|
* Wrapper class to store timestamps (seconds and nanos) in IndexedDb objects.
|
|
48
50
|
*/
|
|
49
|
-
export
|
|
51
|
+
export interface DbTimestamp {
|
|
50
52
|
seconds: number;
|
|
51
53
|
nanoseconds: number;
|
|
52
|
-
constructor(seconds: number, nanoseconds: number);
|
|
53
54
|
}
|
|
54
|
-
/** A timestamp type that can be used in IndexedDb keys. */
|
|
55
|
-
export declare type DbTimestampKey = [/* seconds */ number, /* nanos */ number];
|
|
56
|
-
export declare type DbPrimaryClientKey = typeof DbPrimaryClient.key;
|
|
57
55
|
/**
|
|
58
56
|
* A singleton object to be stored in the 'owner' store in IndexedDb.
|
|
59
57
|
*
|
|
@@ -63,37 +61,19 @@ export declare type DbPrimaryClientKey = typeof DbPrimaryClient.key;
|
|
|
63
61
|
* write an updated timestamp to this lease to prevent other tabs from
|
|
64
62
|
* "stealing" the primary lease
|
|
65
63
|
*/
|
|
66
|
-
export
|
|
64
|
+
export interface DbPrimaryClient {
|
|
67
65
|
ownerId: string;
|
|
68
66
|
/** Whether to allow shared access from multiple tabs. */
|
|
69
67
|
allowTabSynchronization: boolean;
|
|
70
68
|
leaseTimestampMs: number;
|
|
71
|
-
/**
|
|
72
|
-
* Name of the IndexedDb object store.
|
|
73
|
-
*
|
|
74
|
-
* Note that the name 'owner' is chosen to ensure backwards compatibility with
|
|
75
|
-
* older clients that only supported single locked access to the persistence
|
|
76
|
-
* layer.
|
|
77
|
-
*/
|
|
78
|
-
static store: string;
|
|
79
|
-
/**
|
|
80
|
-
* The key string used for the single object that exists in the
|
|
81
|
-
* DbPrimaryClient store.
|
|
82
|
-
*/
|
|
83
|
-
static key: string;
|
|
84
|
-
constructor(ownerId: string,
|
|
85
|
-
/** Whether to allow shared access from multiple tabs. */
|
|
86
|
-
allowTabSynchronization: boolean, leaseTimestampMs: number);
|
|
87
69
|
}
|
|
88
|
-
/** Object keys in the 'mutationQueues' store are userId strings. */
|
|
89
|
-
export declare type DbMutationQueueKey = string;
|
|
90
70
|
/**
|
|
91
71
|
* An object to be stored in the 'mutationQueues' store in IndexedDb.
|
|
92
72
|
*
|
|
93
73
|
* Each user gets a single queue of MutationBatches to apply to the server.
|
|
94
74
|
* DbMutationQueue tracks the metadata about the queue.
|
|
95
75
|
*/
|
|
96
|
-
export
|
|
76
|
+
export interface DbMutationQueue {
|
|
97
77
|
/**
|
|
98
78
|
* The normalized user ID to which this queue belongs.
|
|
99
79
|
*/
|
|
@@ -119,39 +99,7 @@ export declare class DbMutationQueue {
|
|
|
119
99
|
* NOTE: this is deprecated and no longer used by the code.
|
|
120
100
|
*/
|
|
121
101
|
lastStreamToken: string;
|
|
122
|
-
/** Name of the IndexedDb object store. */
|
|
123
|
-
static store: string;
|
|
124
|
-
/** Keys are automatically assigned via the userId property. */
|
|
125
|
-
static keyPath: string;
|
|
126
|
-
constructor(
|
|
127
|
-
/**
|
|
128
|
-
* The normalized user ID to which this queue belongs.
|
|
129
|
-
*/
|
|
130
|
-
userId: string,
|
|
131
|
-
/**
|
|
132
|
-
* An identifier for the highest numbered batch that has been acknowledged
|
|
133
|
-
* by the server. All MutationBatches in this queue with batchIds less
|
|
134
|
-
* than or equal to this value are considered to have been acknowledged by
|
|
135
|
-
* the server.
|
|
136
|
-
*
|
|
137
|
-
* NOTE: this is deprecated and no longer used by the code.
|
|
138
|
-
*/
|
|
139
|
-
lastAcknowledgedBatchId: number,
|
|
140
|
-
/**
|
|
141
|
-
* A stream token that was previously sent by the server.
|
|
142
|
-
*
|
|
143
|
-
* See StreamingWriteRequest in datastore.proto for more details about
|
|
144
|
-
* usage.
|
|
145
|
-
*
|
|
146
|
-
* After sending this token, earlier tokens may not be used anymore so
|
|
147
|
-
* only a single stream token is retained.
|
|
148
|
-
*
|
|
149
|
-
* NOTE: this is deprecated and no longer used by the code.
|
|
150
|
-
*/
|
|
151
|
-
lastStreamToken: string);
|
|
152
102
|
}
|
|
153
|
-
/** The 'mutations' store is keyed by batch ID. */
|
|
154
|
-
export declare type DbMutationBatchKey = BatchId;
|
|
155
103
|
/**
|
|
156
104
|
* An object to be stored in the 'mutations' store in IndexedDb.
|
|
157
105
|
*
|
|
@@ -159,7 +107,7 @@ export declare type DbMutationBatchKey = BatchId;
|
|
|
159
107
|
* in a single write. Each user-level batch gets a separate DbMutationBatch
|
|
160
108
|
* with a new batchId.
|
|
161
109
|
*/
|
|
162
|
-
export
|
|
110
|
+
export interface DbMutationBatch {
|
|
163
111
|
/**
|
|
164
112
|
* The normalized user ID to which this batch belongs.
|
|
165
113
|
*/
|
|
@@ -185,61 +133,14 @@ export declare class DbMutationBatch {
|
|
|
185
133
|
*
|
|
186
134
|
* These mutations are never sent to the backend.
|
|
187
135
|
*/
|
|
188
|
-
baseMutations
|
|
136
|
+
baseMutations?: ProtoWrite[];
|
|
189
137
|
/**
|
|
190
138
|
* A list of mutations to apply. All mutations will be applied atomically.
|
|
191
139
|
*
|
|
192
140
|
* Mutations are serialized via toMutation().
|
|
193
141
|
*/
|
|
194
142
|
mutations: ProtoWrite[];
|
|
195
|
-
/** Name of the IndexedDb object store. */
|
|
196
|
-
static store: string;
|
|
197
|
-
/** Keys are automatically assigned via the userId, batchId properties. */
|
|
198
|
-
static keyPath: string;
|
|
199
|
-
/** The index name for lookup of mutations by user. */
|
|
200
|
-
static userMutationsIndex: string;
|
|
201
|
-
/** The user mutations index is keyed by [userId, batchId] pairs. */
|
|
202
|
-
static userMutationsKeyPath: string[];
|
|
203
|
-
constructor(
|
|
204
|
-
/**
|
|
205
|
-
* The normalized user ID to which this batch belongs.
|
|
206
|
-
*/
|
|
207
|
-
userId: string,
|
|
208
|
-
/**
|
|
209
|
-
* An identifier for this batch, allocated using an auto-generated key.
|
|
210
|
-
*/
|
|
211
|
-
batchId: BatchId,
|
|
212
|
-
/**
|
|
213
|
-
* The local write time of the batch, stored as milliseconds since the
|
|
214
|
-
* epoch.
|
|
215
|
-
*/
|
|
216
|
-
localWriteTimeMs: number,
|
|
217
|
-
/**
|
|
218
|
-
* A list of "mutations" that represent a partial base state from when this
|
|
219
|
-
* write batch was initially created. During local application of the write
|
|
220
|
-
* batch, these baseMutations are applied prior to the real writes in order
|
|
221
|
-
* to override certain document fields from the remote document cache. This
|
|
222
|
-
* is necessary in the case of non-idempotent writes (e.g. `increment()`
|
|
223
|
-
* transforms) to make sure that the local view of the modified documents
|
|
224
|
-
* doesn't flicker if the remote document cache receives the result of the
|
|
225
|
-
* non-idempotent write before the write is removed from the queue.
|
|
226
|
-
*
|
|
227
|
-
* These mutations are never sent to the backend.
|
|
228
|
-
*/
|
|
229
|
-
baseMutations: ProtoWrite[] | undefined,
|
|
230
|
-
/**
|
|
231
|
-
* A list of mutations to apply. All mutations will be applied atomically.
|
|
232
|
-
*
|
|
233
|
-
* Mutations are serialized via toMutation().
|
|
234
|
-
*/
|
|
235
|
-
mutations: ProtoWrite[]);
|
|
236
143
|
}
|
|
237
|
-
/**
|
|
238
|
-
* The key for a db document mutation, which is made up of a userID, path, and
|
|
239
|
-
* batchId. Note that the path must be serialized into a form that indexedDB can
|
|
240
|
-
* sort.
|
|
241
|
-
*/
|
|
242
|
-
export declare type DbDocumentMutationKey = [string, EncodedResourcePath, BatchId];
|
|
243
144
|
/**
|
|
244
145
|
* An object to be stored in the 'documentMutations' store in IndexedDb.
|
|
245
146
|
*
|
|
@@ -247,54 +148,23 @@ export declare type DbDocumentMutationKey = [string, EncodedResourcePath, BatchI
|
|
|
247
148
|
* document key. The rows in this table are references based on the contents of
|
|
248
149
|
* DbMutationBatch.mutations.
|
|
249
150
|
*/
|
|
250
|
-
export
|
|
251
|
-
static store: string;
|
|
252
|
-
/**
|
|
253
|
-
* Creates a [userId] key for use in the DbDocumentMutations index to iterate
|
|
254
|
-
* over all of a user's document mutations.
|
|
255
|
-
*/
|
|
256
|
-
static prefixForUser(userId: string): [string];
|
|
257
|
-
/**
|
|
258
|
-
* Creates a [userId, encodedPath] key for use in the DbDocumentMutations
|
|
259
|
-
* index to iterate over all at document mutations for a given path or lower.
|
|
260
|
-
*/
|
|
261
|
-
static prefixForPath(userId: string, path: ResourcePath): [string, EncodedResourcePath];
|
|
262
|
-
/**
|
|
263
|
-
* Creates a full index key of [userId, encodedPath, batchId] for inserting
|
|
264
|
-
* and deleting into the DbDocumentMutations index.
|
|
265
|
-
*/
|
|
266
|
-
static key(userId: string, path: ResourcePath, batchId: BatchId): DbDocumentMutationKey;
|
|
267
|
-
/**
|
|
268
|
-
* Because we store all the useful information for this store in the key,
|
|
269
|
-
* there is no useful information to store as the value. The raw (unencoded)
|
|
270
|
-
* path cannot be stored because IndexedDb doesn't store prototype
|
|
271
|
-
* information.
|
|
272
|
-
*/
|
|
273
|
-
static PLACEHOLDER: DbDocumentMutation;
|
|
274
|
-
private constructor();
|
|
151
|
+
export interface DbDocumentMutation {
|
|
275
152
|
}
|
|
276
|
-
/**
|
|
277
|
-
* A key in the 'remoteDocuments' object store is a string array containing the
|
|
278
|
-
* segments that make up the path.
|
|
279
|
-
*/
|
|
280
|
-
export declare type DbRemoteDocumentKey = string[];
|
|
281
153
|
/**
|
|
282
154
|
* Represents the known absence of a document at a particular version.
|
|
283
155
|
* Stored in IndexedDb as part of a DbRemoteDocument object.
|
|
284
156
|
*/
|
|
285
|
-
export
|
|
157
|
+
export interface DbNoDocument {
|
|
286
158
|
path: string[];
|
|
287
159
|
readTime: DbTimestamp;
|
|
288
|
-
constructor(path: string[], readTime: DbTimestamp);
|
|
289
160
|
}
|
|
290
161
|
/**
|
|
291
162
|
* Represents a document that is known to exist but whose data is unknown.
|
|
292
163
|
* Stored in IndexedDb as part of a DbRemoteDocument object.
|
|
293
164
|
*/
|
|
294
|
-
export
|
|
165
|
+
export interface DbUnknownDocument {
|
|
295
166
|
path: string[];
|
|
296
167
|
version: DbTimestamp;
|
|
297
|
-
constructor(path: string[], version: DbTimestamp);
|
|
298
168
|
}
|
|
299
169
|
/**
|
|
300
170
|
* An object to be stored in the 'remoteDocuments' store in IndexedDb.
|
|
@@ -306,114 +176,55 @@ export declare class DbUnknownDocument {
|
|
|
306
176
|
* - An "unknown document" representing a document that is known to exist (at
|
|
307
177
|
* some version) but whose contents are unknown.
|
|
308
178
|
*
|
|
179
|
+
* The document key is split up across `prefixPath`, `collectionGroup` and
|
|
180
|
+
* `documentId`.
|
|
181
|
+
*
|
|
309
182
|
* Note: This is the persisted equivalent of a MaybeDocument and could perhaps
|
|
310
183
|
* be made more general if necessary.
|
|
311
184
|
*/
|
|
312
|
-
export
|
|
313
|
-
/**
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
|
|
321
|
-
* exists.
|
|
322
|
-
*/
|
|
323
|
-
noDocument: DbNoDocument | null;
|
|
324
|
-
/**
|
|
325
|
-
* Set to an instance of a Document if there's a cached version of the
|
|
326
|
-
* document.
|
|
327
|
-
*/
|
|
328
|
-
document: ProtoDocument | null;
|
|
329
|
-
/**
|
|
330
|
-
* Documents that were written to the remote document store based on
|
|
331
|
-
* a write acknowledgment are marked with `hasCommittedMutations`. These
|
|
332
|
-
* documents are potentially inconsistent with the backend's copy and use
|
|
333
|
-
* the write's commit version as their document version.
|
|
334
|
-
*/
|
|
335
|
-
hasCommittedMutations: boolean | undefined;
|
|
336
|
-
/**
|
|
337
|
-
* When the document was read from the backend. Undefined for data written
|
|
338
|
-
* prior to schema version 9.
|
|
339
|
-
*/
|
|
340
|
-
readTime: DbTimestampKey | undefined;
|
|
341
|
-
/**
|
|
342
|
-
* The path of the collection this document is part of. Undefined for data
|
|
343
|
-
* written prior to schema version 9.
|
|
344
|
-
*/
|
|
345
|
-
parentPath: string[] | undefined;
|
|
346
|
-
static store: string;
|
|
347
|
-
/**
|
|
348
|
-
* An index that provides access to all entries sorted by read time (which
|
|
349
|
-
* corresponds to the last modification time of each row).
|
|
350
|
-
*
|
|
351
|
-
* This index is used to provide a changelog for Multi-Tab.
|
|
352
|
-
*/
|
|
353
|
-
static readTimeIndex: string;
|
|
354
|
-
static readTimeIndexPath: string;
|
|
355
|
-
/**
|
|
356
|
-
* An index that provides access to documents in a collection sorted by read
|
|
357
|
-
* time.
|
|
358
|
-
*
|
|
359
|
-
* This index is used to allow the RemoteDocumentCache to fetch newly changed
|
|
360
|
-
* documents in a collection.
|
|
361
|
-
*/
|
|
362
|
-
static collectionReadTimeIndex: string;
|
|
363
|
-
static collectionReadTimeIndexPath: string[];
|
|
364
|
-
constructor(
|
|
185
|
+
export interface DbRemoteDocument {
|
|
186
|
+
/** The path to the document's collection (excluding). */
|
|
187
|
+
prefixPath: string[];
|
|
188
|
+
/** The collection ID the document is direclty nested under. */
|
|
189
|
+
collectionGroup: string;
|
|
190
|
+
/** The document ID. */
|
|
191
|
+
documentId: string;
|
|
192
|
+
/** When the document was read from the backend. */
|
|
193
|
+
readTime: DbTimestampKey;
|
|
365
194
|
/**
|
|
366
195
|
* Set to an instance of DbUnknownDocument if the data for a document is
|
|
367
196
|
* not known, but it is known that a document exists at the specified
|
|
368
197
|
* version (e.g. it had a successful update applied to it)
|
|
369
198
|
*/
|
|
370
|
-
unknownDocument
|
|
199
|
+
unknownDocument?: DbUnknownDocument;
|
|
371
200
|
/**
|
|
372
201
|
* Set to an instance of a DbNoDocument if it is known that no document
|
|
373
202
|
* exists.
|
|
374
203
|
*/
|
|
375
|
-
noDocument
|
|
204
|
+
noDocument?: DbNoDocument;
|
|
376
205
|
/**
|
|
377
206
|
* Set to an instance of a Document if there's a cached version of the
|
|
378
207
|
* document.
|
|
379
208
|
*/
|
|
380
|
-
document
|
|
209
|
+
document?: ProtoDocument;
|
|
381
210
|
/**
|
|
382
211
|
* Documents that were written to the remote document store based on
|
|
383
212
|
* a write acknowledgment are marked with `hasCommittedMutations`. These
|
|
384
213
|
* documents are potentially inconsistent with the backend's copy and use
|
|
385
214
|
* the write's commit version as their document version.
|
|
386
215
|
*/
|
|
387
|
-
hasCommittedMutations: boolean
|
|
388
|
-
/**
|
|
389
|
-
* When the document was read from the backend. Undefined for data written
|
|
390
|
-
* prior to schema version 9.
|
|
391
|
-
*/
|
|
392
|
-
readTime: DbTimestampKey | undefined,
|
|
393
|
-
/**
|
|
394
|
-
* The path of the collection this document is part of. Undefined for data
|
|
395
|
-
* written prior to schema version 9.
|
|
396
|
-
*/
|
|
397
|
-
parentPath: string[] | undefined);
|
|
216
|
+
hasCommittedMutations: boolean;
|
|
398
217
|
}
|
|
399
218
|
/**
|
|
400
219
|
* Contains a single entry that has metadata about the remote document cache.
|
|
401
220
|
*/
|
|
402
|
-
export
|
|
403
|
-
byteSize: number;
|
|
404
|
-
static store: string;
|
|
405
|
-
static key: string;
|
|
221
|
+
export interface DbRemoteDocumentGlobal {
|
|
406
222
|
/**
|
|
407
|
-
*
|
|
223
|
+
* Approximately the total size in bytes of all the
|
|
408
224
|
* documents in the document cache.
|
|
409
225
|
*/
|
|
410
|
-
|
|
226
|
+
byteSize: number;
|
|
411
227
|
}
|
|
412
|
-
export declare type DbRemoteDocumentGlobalKey = typeof DbRemoteDocumentGlobal.key;
|
|
413
|
-
/**
|
|
414
|
-
* A key in the 'targets' object store is a targetId of the query.
|
|
415
|
-
*/
|
|
416
|
-
export declare type DbTargetKey = TargetId;
|
|
417
228
|
/**
|
|
418
229
|
* The persisted type for a query nested with in the 'targets' store in
|
|
419
230
|
* IndexedDb. We use the proto definitions for these two kinds of queries in
|
|
@@ -429,7 +240,7 @@ export declare type DbQuery = ProtoQueryTarget | ProtoDocumentsTarget;
|
|
|
429
240
|
* Each query the client listens to against the server is tracked on disk so
|
|
430
241
|
* that the query can be efficiently resumed on restart.
|
|
431
242
|
*/
|
|
432
|
-
export
|
|
243
|
+
export interface DbTarget {
|
|
433
244
|
/**
|
|
434
245
|
* An auto-generated sequential numeric identifier for the query.
|
|
435
246
|
*
|
|
@@ -487,7 +298,7 @@ export declare class DbTarget {
|
|
|
487
298
|
* contained no limbo documents. Undefined for data written prior to
|
|
488
299
|
* schema version 9.
|
|
489
300
|
*/
|
|
490
|
-
lastLimboFreeSnapshotVersion
|
|
301
|
+
lastLimboFreeSnapshotVersion?: DbTimestamp;
|
|
491
302
|
/**
|
|
492
303
|
* The query for this target.
|
|
493
304
|
*
|
|
@@ -496,90 +307,7 @@ export declare class DbTarget {
|
|
|
496
307
|
* duplicate translation logic to and from a `Query` object.
|
|
497
308
|
*/
|
|
498
309
|
query: DbQuery;
|
|
499
|
-
static store: string;
|
|
500
|
-
/** Keys are automatically assigned via the targetId property. */
|
|
501
|
-
static keyPath: string;
|
|
502
|
-
/** The name of the queryTargets index. */
|
|
503
|
-
static queryTargetsIndexName: string;
|
|
504
|
-
/**
|
|
505
|
-
* The index of all canonicalIds to the targets that they match. This is not
|
|
506
|
-
* a unique mapping because canonicalId does not promise a unique name for all
|
|
507
|
-
* possible queries, so we append the targetId to make the mapping unique.
|
|
508
|
-
*/
|
|
509
|
-
static queryTargetsKeyPath: string[];
|
|
510
|
-
constructor(
|
|
511
|
-
/**
|
|
512
|
-
* An auto-generated sequential numeric identifier for the query.
|
|
513
|
-
*
|
|
514
|
-
* Queries are stored using their canonicalId as the key, but these
|
|
515
|
-
* canonicalIds can be quite long so we additionally assign a unique
|
|
516
|
-
* queryId which can be used by referenced data structures (e.g.
|
|
517
|
-
* indexes) to minimize the on-disk cost.
|
|
518
|
-
*/
|
|
519
|
-
targetId: TargetId,
|
|
520
|
-
/**
|
|
521
|
-
* The canonical string representing this query. This is not unique.
|
|
522
|
-
*/
|
|
523
|
-
canonicalId: string,
|
|
524
|
-
/**
|
|
525
|
-
* The last readTime received from the Watch Service for this query.
|
|
526
|
-
*
|
|
527
|
-
* This is the same value as TargetChange.read_time in the protos.
|
|
528
|
-
*/
|
|
529
|
-
readTime: DbTimestamp,
|
|
530
|
-
/**
|
|
531
|
-
* An opaque, server-assigned token that allows watching a query to be
|
|
532
|
-
* resumed after disconnecting without retransmitting all the data
|
|
533
|
-
* that matches the query. The resume token essentially identifies a
|
|
534
|
-
* point in time from which the server should resume sending results.
|
|
535
|
-
*
|
|
536
|
-
* This is related to the snapshotVersion in that the resumeToken
|
|
537
|
-
* effectively also encodes that value, but the resumeToken is opaque
|
|
538
|
-
* and sometimes encodes additional information.
|
|
539
|
-
*
|
|
540
|
-
* A consequence of this is that the resumeToken should be used when
|
|
541
|
-
* asking the server to reason about where this client is in the watch
|
|
542
|
-
* stream, but the client should use the snapshotVersion for its own
|
|
543
|
-
* purposes.
|
|
544
|
-
*
|
|
545
|
-
* This is the same value as TargetChange.resume_token in the protos.
|
|
546
|
-
*/
|
|
547
|
-
resumeToken: string,
|
|
548
|
-
/**
|
|
549
|
-
* A sequence number representing the last time this query was
|
|
550
|
-
* listened to, used for garbage collection purposes.
|
|
551
|
-
*
|
|
552
|
-
* Conventionally this would be a timestamp value, but device-local
|
|
553
|
-
* clocks are unreliable and they must be able to create new listens
|
|
554
|
-
* even while disconnected. Instead this should be a monotonically
|
|
555
|
-
* increasing number that's incremented on each listen call.
|
|
556
|
-
*
|
|
557
|
-
* This is different from the queryId since the queryId is an
|
|
558
|
-
* immutable identifier assigned to the Query on first use while
|
|
559
|
-
* lastListenSequenceNumber is updated every time the query is
|
|
560
|
-
* listened to.
|
|
561
|
-
*/
|
|
562
|
-
lastListenSequenceNumber: number,
|
|
563
|
-
/**
|
|
564
|
-
* Denotes the maximum snapshot version at which the associated query view
|
|
565
|
-
* contained no limbo documents. Undefined for data written prior to
|
|
566
|
-
* schema version 9.
|
|
567
|
-
*/
|
|
568
|
-
lastLimboFreeSnapshotVersion: DbTimestamp | undefined,
|
|
569
|
-
/**
|
|
570
|
-
* The query for this target.
|
|
571
|
-
*
|
|
572
|
-
* Because canonical ids are not unique we must store the actual query. We
|
|
573
|
-
* use the proto to have an object we can persist without having to
|
|
574
|
-
* duplicate translation logic to and from a `Query` object.
|
|
575
|
-
*/
|
|
576
|
-
query: DbQuery);
|
|
577
310
|
}
|
|
578
|
-
/**
|
|
579
|
-
* The key for a DbTargetDocument, containing a targetId and an encoded resource
|
|
580
|
-
* path.
|
|
581
|
-
*/
|
|
582
|
-
export declare type DbTargetDocumentKey = [TargetId, EncodedResourcePath];
|
|
583
311
|
/**
|
|
584
312
|
* An object representing an association between a target and a document, or a
|
|
585
313
|
* sentinel row marking the last sequence number at which a document was used.
|
|
@@ -590,7 +318,7 @@ export declare type DbTargetDocumentKey = [TargetId, EncodedResourcePath];
|
|
|
590
318
|
* documents and their sequence numbers can be identified efficiently via a scan
|
|
591
319
|
* of this store.
|
|
592
320
|
*/
|
|
593
|
-
export
|
|
321
|
+
export interface DbTargetDocument {
|
|
594
322
|
/**
|
|
595
323
|
* The targetId identifying a target or 0 for a sentinel row.
|
|
596
324
|
*/
|
|
@@ -604,42 +332,15 @@ export declare class DbTargetDocument {
|
|
|
604
332
|
* time the document specified by `path` was used. Otherwise, it should be
|
|
605
333
|
* `undefined`.
|
|
606
334
|
*/
|
|
607
|
-
sequenceNumber?:
|
|
608
|
-
/** Name of the IndexedDb object store. */
|
|
609
|
-
static store: string;
|
|
610
|
-
/** Keys are automatically assigned via the targetId, path properties. */
|
|
611
|
-
static keyPath: string[];
|
|
612
|
-
/** The index name for the reverse index. */
|
|
613
|
-
static documentTargetsIndex: string;
|
|
614
|
-
/** We also need to create the reverse index for these properties. */
|
|
615
|
-
static documentTargetsKeyPath: string[];
|
|
616
|
-
constructor(
|
|
617
|
-
/**
|
|
618
|
-
* The targetId identifying a target or 0 for a sentinel row.
|
|
619
|
-
*/
|
|
620
|
-
targetId: TargetId,
|
|
621
|
-
/**
|
|
622
|
-
* The path to the document, as encoded in the key.
|
|
623
|
-
*/
|
|
624
|
-
path: EncodedResourcePath,
|
|
625
|
-
/**
|
|
626
|
-
* If this is a sentinel row, this should be the sequence number of the last
|
|
627
|
-
* time the document specified by `path` was used. Otherwise, it should be
|
|
628
|
-
* `undefined`.
|
|
629
|
-
*/
|
|
630
|
-
sequenceNumber?: number | undefined);
|
|
335
|
+
sequenceNumber?: ListenSequenceNumber;
|
|
631
336
|
}
|
|
632
|
-
/**
|
|
633
|
-
* The type to represent the single allowed key for the DbTargetGlobal store.
|
|
634
|
-
*/
|
|
635
|
-
export declare type DbTargetGlobalKey = typeof DbTargetGlobal.key;
|
|
636
337
|
/**
|
|
637
338
|
* A record of global state tracked across all Targets, tracked separately
|
|
638
339
|
* to avoid the need for extra indexes.
|
|
639
340
|
*
|
|
640
341
|
* This should be kept in-sync with the proto used in the iOS client.
|
|
641
342
|
*/
|
|
642
|
-
export
|
|
343
|
+
export interface DbTargetGlobal {
|
|
643
344
|
/**
|
|
644
345
|
* The highest numbered target id across all targets.
|
|
645
346
|
*
|
|
@@ -665,52 +366,14 @@ export declare class DbTargetGlobal {
|
|
|
665
366
|
* The number of targets persisted.
|
|
666
367
|
*/
|
|
667
368
|
targetCount: number;
|
|
668
|
-
/**
|
|
669
|
-
* The key string used for the single object that exists in the
|
|
670
|
-
* DbTargetGlobal store.
|
|
671
|
-
*/
|
|
672
|
-
static key: string;
|
|
673
|
-
static store: string;
|
|
674
|
-
constructor(
|
|
675
|
-
/**
|
|
676
|
-
* The highest numbered target id across all targets.
|
|
677
|
-
*
|
|
678
|
-
* See DbTarget.targetId.
|
|
679
|
-
*/
|
|
680
|
-
highestTargetId: TargetId,
|
|
681
|
-
/**
|
|
682
|
-
* The highest numbered lastListenSequenceNumber across all targets.
|
|
683
|
-
*
|
|
684
|
-
* See DbTarget.lastListenSequenceNumber.
|
|
685
|
-
*/
|
|
686
|
-
highestListenSequenceNumber: number,
|
|
687
|
-
/**
|
|
688
|
-
* A global snapshot version representing the last consistent snapshot we
|
|
689
|
-
* received from the backend. This is monotonically increasing and any
|
|
690
|
-
* snapshots received from the backend prior to this version (e.g. for
|
|
691
|
-
* targets resumed with a resumeToken) should be suppressed (buffered)
|
|
692
|
-
* until the backend has caught up to this snapshot version again. This
|
|
693
|
-
* prevents our cache from ever going backwards in time.
|
|
694
|
-
*/
|
|
695
|
-
lastRemoteSnapshotVersion: DbTimestamp,
|
|
696
|
-
/**
|
|
697
|
-
* The number of targets persisted.
|
|
698
|
-
*/
|
|
699
|
-
targetCount: number);
|
|
700
369
|
}
|
|
701
|
-
/**
|
|
702
|
-
* The key for a DbCollectionParent entry, containing the collection ID
|
|
703
|
-
* and the parent path that contains it. Note that the parent path will be an
|
|
704
|
-
* empty path in the case of root-level collections.
|
|
705
|
-
*/
|
|
706
|
-
export declare type DbCollectionParentKey = [string, EncodedResourcePath];
|
|
707
370
|
/**
|
|
708
371
|
* An object representing an association between a Collection id (e.g. 'messages')
|
|
709
372
|
* to a parent path (e.g. '/chats/123') that contains it as a (sub)collection.
|
|
710
373
|
* This is used to efficiently find all collections to query when performing
|
|
711
374
|
* a Collection Group query.
|
|
712
375
|
*/
|
|
713
|
-
export
|
|
376
|
+
export interface DbCollectionParent {
|
|
714
377
|
/**
|
|
715
378
|
* The collectionId (e.g. 'messages')
|
|
716
379
|
*/
|
|
@@ -720,20 +383,6 @@ export declare class DbCollectionParent {
|
|
|
720
383
|
* a root-level collection).
|
|
721
384
|
*/
|
|
722
385
|
parent: EncodedResourcePath;
|
|
723
|
-
/** Name of the IndexedDb object store. */
|
|
724
|
-
static store: string;
|
|
725
|
-
/** Keys are automatically assigned via the collectionId, parent properties. */
|
|
726
|
-
static keyPath: string[];
|
|
727
|
-
constructor(
|
|
728
|
-
/**
|
|
729
|
-
* The collectionId (e.g. 'messages')
|
|
730
|
-
*/
|
|
731
|
-
collectionId: string,
|
|
732
|
-
/**
|
|
733
|
-
* The path to the parent (either a document location or an empty path for
|
|
734
|
-
* a root-level collection).
|
|
735
|
-
*/
|
|
736
|
-
parent: EncodedResourcePath);
|
|
737
386
|
}
|
|
738
387
|
/**
|
|
739
388
|
* A record of the metadata state of each client.
|
|
@@ -741,7 +390,7 @@ export declare class DbCollectionParent {
|
|
|
741
390
|
* PORTING NOTE: This is used to synchronize multi-tab state and does not need
|
|
742
391
|
* to be ported to iOS or Android.
|
|
743
392
|
*/
|
|
744
|
-
export
|
|
393
|
+
export interface DbClientMetadata {
|
|
745
394
|
/** The auto-generated client id assigned at client startup. */
|
|
746
395
|
clientId: string;
|
|
747
396
|
/** The last time this state was updated. */
|
|
@@ -750,106 +399,42 @@ export declare class DbClientMetadata {
|
|
|
750
399
|
networkEnabled: boolean;
|
|
751
400
|
/** Whether this client is running in a foreground tab. */
|
|
752
401
|
inForeground: boolean;
|
|
753
|
-
/** Name of the IndexedDb object store. */
|
|
754
|
-
static store: string;
|
|
755
|
-
/** Keys are automatically assigned via the clientId properties. */
|
|
756
|
-
static keyPath: string;
|
|
757
|
-
constructor(
|
|
758
|
-
/** The auto-generated client id assigned at client startup. */
|
|
759
|
-
clientId: string,
|
|
760
|
-
/** The last time this state was updated. */
|
|
761
|
-
updateTimeMs: number,
|
|
762
|
-
/** Whether the client's network connection is enabled. */
|
|
763
|
-
networkEnabled: boolean,
|
|
764
|
-
/** Whether this client is running in a foreground tab. */
|
|
765
|
-
inForeground: boolean);
|
|
766
402
|
}
|
|
767
|
-
/** Object keys in the 'clientMetadata' store are clientId strings. */
|
|
768
|
-
export declare type DbClientMetadataKey = string;
|
|
769
|
-
export declare type DbBundlesKey = string;
|
|
770
403
|
/** An object representing a bundle loaded by the SDK. */
|
|
771
|
-
export
|
|
404
|
+
export interface DbBundle {
|
|
772
405
|
/** The ID of the loaded bundle. */
|
|
773
406
|
bundleId: string;
|
|
774
407
|
/** The create time of the loaded bundle. */
|
|
775
408
|
createTime: DbTimestamp;
|
|
776
409
|
/** The schema version of the loaded bundle. */
|
|
777
410
|
version: number;
|
|
778
|
-
/** Name of the IndexedDb object store. */
|
|
779
|
-
static store: string;
|
|
780
|
-
static keyPath: string;
|
|
781
|
-
constructor(
|
|
782
|
-
/** The ID of the loaded bundle. */
|
|
783
|
-
bundleId: string,
|
|
784
|
-
/** The create time of the loaded bundle. */
|
|
785
|
-
createTime: DbTimestamp,
|
|
786
|
-
/** The schema version of the loaded bundle. */
|
|
787
|
-
version: number);
|
|
788
411
|
}
|
|
789
|
-
export declare type DbNamedQueriesKey = string;
|
|
790
412
|
/** An object representing a named query loaded by the SDK via a bundle. */
|
|
791
|
-
export
|
|
413
|
+
export interface DbNamedQuery {
|
|
792
414
|
/** The name of the query. */
|
|
793
415
|
name: string;
|
|
794
416
|
/** The read time of the results saved in the bundle from the named query. */
|
|
795
417
|
readTime: DbTimestamp;
|
|
796
418
|
/** The query saved in the bundle. */
|
|
797
419
|
bundledQuery: BundledQuery;
|
|
798
|
-
/** Name of the IndexedDb object store. */
|
|
799
|
-
static store: string;
|
|
800
|
-
static keyPath: string;
|
|
801
|
-
constructor(
|
|
802
|
-
/** The name of the query. */
|
|
803
|
-
name: string,
|
|
804
|
-
/** The read time of the results saved in the bundle from the named query. */
|
|
805
|
-
readTime: DbTimestamp,
|
|
806
|
-
/** The query saved in the bundle. */
|
|
807
|
-
bundledQuery: BundledQuery);
|
|
808
420
|
}
|
|
809
|
-
/** The key for each index consisting of just the index id. */
|
|
810
|
-
export declare type DbIndexConfigurationKey = number;
|
|
811
421
|
/** An object representing the global configuration for a field index. */
|
|
812
|
-
export
|
|
422
|
+
export interface DbIndexConfiguration {
|
|
813
423
|
/**
|
|
814
424
|
* The index id for this entry. Undefined for indexes that are not yet
|
|
815
425
|
* persisted.
|
|
816
426
|
*/
|
|
817
|
-
indexId
|
|
427
|
+
indexId?: number;
|
|
818
428
|
/** The collection group this index belongs to. */
|
|
819
429
|
collectionGroup: string;
|
|
820
430
|
/** The fields to index for this index. */
|
|
821
431
|
fields: Array<[name: string, kind: IndexKind]>;
|
|
822
|
-
/** Name of the IndexedDb object store. */
|
|
823
|
-
static store: string;
|
|
824
|
-
static keyPath: string;
|
|
825
|
-
/**
|
|
826
|
-
* An index that provides access to the index configurations by collection
|
|
827
|
-
* group.
|
|
828
|
-
*
|
|
829
|
-
* PORTING NOTE: iOS and Android maintain this index in-memory, but this is
|
|
830
|
-
* not possible here as the Web client supports concurrent access to
|
|
831
|
-
* persistence via multi-tab.
|
|
832
|
-
*/
|
|
833
|
-
static collectionGroupIndex: string;
|
|
834
|
-
static collectionGroupIndexPath: string;
|
|
835
|
-
constructor(
|
|
836
|
-
/**
|
|
837
|
-
* The index id for this entry. Undefined for indexes that are not yet
|
|
838
|
-
* persisted.
|
|
839
|
-
*/
|
|
840
|
-
indexId: number | undefined,
|
|
841
|
-
/** The collection group this index belongs to. */
|
|
842
|
-
collectionGroup: string,
|
|
843
|
-
/** The fields to index for this index. */
|
|
844
|
-
fields: Array<[name: string, kind: IndexKind]>);
|
|
845
432
|
}
|
|
846
|
-
/** The key for each index state consisting of the index id and its user id. */
|
|
847
|
-
export declare type DbIndexStateKey = [number, string];
|
|
848
433
|
/**
|
|
849
434
|
* An object describing how up-to-date the index backfill is for each user and
|
|
850
435
|
* index.
|
|
851
436
|
*/
|
|
852
|
-
export
|
|
437
|
+
export interface DbIndexState {
|
|
853
438
|
/** The index id for this entry. */
|
|
854
439
|
indexId: number;
|
|
855
440
|
/** The user id for this entry. */
|
|
@@ -874,53 +459,9 @@ export declare class DbIndexState {
|
|
|
874
459
|
* if no mutations have been indexed.
|
|
875
460
|
*/
|
|
876
461
|
largestBatchId: number;
|
|
877
|
-
/** Name of the IndexedDb object store. */
|
|
878
|
-
static store: string;
|
|
879
|
-
static keyPath: string[];
|
|
880
|
-
/**
|
|
881
|
-
* An index that provides access to documents in a collection sorted by last
|
|
882
|
-
* update time. Used by the backfiller.
|
|
883
|
-
*
|
|
884
|
-
* PORTING NOTE: iOS and Android maintain this index in-memory, but this is
|
|
885
|
-
* not possible here as the Web client supports concurrent access to
|
|
886
|
-
* persistence via multi-tab.
|
|
887
|
-
*/
|
|
888
|
-
static sequenceNumberIndex: string;
|
|
889
|
-
static sequenceNumberIndexPath: string[];
|
|
890
|
-
constructor(
|
|
891
|
-
/** The index id for this entry. */
|
|
892
|
-
indexId: number,
|
|
893
|
-
/** The user id for this entry. */
|
|
894
|
-
uid: string,
|
|
895
|
-
/**
|
|
896
|
-
* A number that indicates when the index was last updated (relative to
|
|
897
|
-
* other indexes).
|
|
898
|
-
*/
|
|
899
|
-
sequenceNumber: number,
|
|
900
|
-
/**
|
|
901
|
-
* The latest read time that has been indexed by Firestore for this field
|
|
902
|
-
* index. Set to `{seconds: 0, nanos: 0}` if no documents have been indexed.
|
|
903
|
-
*/
|
|
904
|
-
readTime: DbTimestamp,
|
|
905
|
-
/**
|
|
906
|
-
* The last document that has been indexed for this field index. Empty if
|
|
907
|
-
* no documents have been indexed.
|
|
908
|
-
*/
|
|
909
|
-
documentKey: EncodedResourcePath,
|
|
910
|
-
/**
|
|
911
|
-
* The largest mutation batch id that has been processed for this index. -1
|
|
912
|
-
* if no mutations have been indexed.
|
|
913
|
-
*/
|
|
914
|
-
largestBatchId: number);
|
|
915
462
|
}
|
|
916
|
-
/**
|
|
917
|
-
* The key for each index entry consists of the index id and its user id,
|
|
918
|
-
* the encoded array and directional value for the indexed fields as well as
|
|
919
|
-
* the encoded document path for the indexed document.
|
|
920
|
-
*/
|
|
921
|
-
export declare type DbIndexEntryKey = [number, string, Uint8Array, Uint8Array, string];
|
|
922
463
|
/** An object that stores the encoded entries for all documents and fields. */
|
|
923
|
-
export
|
|
464
|
+
export interface DbIndexEntry {
|
|
924
465
|
/** The index id for this entry. */
|
|
925
466
|
indexId: number;
|
|
926
467
|
/** The user id for this entry. */
|
|
@@ -931,32 +472,11 @@ export declare class DbIndexEntry {
|
|
|
931
472
|
directionalValue: Uint8Array;
|
|
932
473
|
/** The document key this entry points to. */
|
|
933
474
|
documentKey: EncodedResourcePath;
|
|
934
|
-
/** Name of the IndexedDb object store. */
|
|
935
|
-
static store: string;
|
|
936
|
-
static keyPath: string[];
|
|
937
|
-
static documentKeyIndex: string;
|
|
938
|
-
static documentKeyIndexPath: string[];
|
|
939
|
-
constructor(
|
|
940
|
-
/** The index id for this entry. */
|
|
941
|
-
indexId: number,
|
|
942
|
-
/** The user id for this entry. */
|
|
943
|
-
uid: string,
|
|
944
|
-
/** The encoded array index value for this entry. */
|
|
945
|
-
arrayValue: Uint8Array,
|
|
946
|
-
/** The encoded directional value for equality and inequality filters. */
|
|
947
|
-
directionalValue: Uint8Array,
|
|
948
|
-
/** The document key this entry points to. */
|
|
949
|
-
documentKey: EncodedResourcePath);
|
|
950
475
|
}
|
|
951
|
-
export declare type DbDocumentOverlayKey = [
|
|
952
|
-
string,
|
|
953
|
-
string,
|
|
954
|
-
string
|
|
955
|
-
];
|
|
956
476
|
/**
|
|
957
477
|
* An object representing a document overlay.
|
|
958
478
|
*/
|
|
959
|
-
export
|
|
479
|
+
export interface DbDocumentOverlay {
|
|
960
480
|
/** The user ID to whom this overlay belongs. */
|
|
961
481
|
userId: string;
|
|
962
482
|
/** The path to the collection that contains the document. */
|
|
@@ -969,40 +489,4 @@ export declare class DbDocumentOverlay {
|
|
|
969
489
|
largestBatchId: number;
|
|
970
490
|
/** The overlay mutation. */
|
|
971
491
|
overlayMutation: ProtoWrite;
|
|
972
|
-
/** Name of the IndexedDb object store. */
|
|
973
|
-
static store: string;
|
|
974
|
-
static keyPath: string[];
|
|
975
|
-
static collectionPathOverlayIndex: string;
|
|
976
|
-
static collectionPathOverlayIndexPath: string[];
|
|
977
|
-
static collectionGroupOverlayIndex: string;
|
|
978
|
-
static collectionGroupOverlayIndexPath: string[];
|
|
979
|
-
constructor(
|
|
980
|
-
/** The user ID to whom this overlay belongs. */
|
|
981
|
-
userId: string,
|
|
982
|
-
/** The path to the collection that contains the document. */
|
|
983
|
-
collectionPath: string,
|
|
984
|
-
/** The ID (key) of the document within the collection. */
|
|
985
|
-
documentId: string,
|
|
986
|
-
/** The collection group to which the document belongs. */
|
|
987
|
-
collectionGroup: string,
|
|
988
|
-
/** The largest batch ID that's been applied for this overlay. */
|
|
989
|
-
largestBatchId: number,
|
|
990
|
-
/** The overlay mutation. */
|
|
991
|
-
overlayMutation: ProtoWrite);
|
|
992
492
|
}
|
|
993
|
-
export declare const V1_STORES: string[];
|
|
994
|
-
export declare const V3_STORES: string[];
|
|
995
|
-
export declare const V4_STORES: string[];
|
|
996
|
-
export declare const V6_STORES: string[];
|
|
997
|
-
export declare const V8_STORES: string[];
|
|
998
|
-
export declare const V11_STORES: string[];
|
|
999
|
-
export declare const V12_STORES: string[];
|
|
1000
|
-
export declare const V13_STORES: string[];
|
|
1001
|
-
/**
|
|
1002
|
-
* The list of all default IndexedDB stores used throughout the SDK. This is
|
|
1003
|
-
* used when creating transactions so that access across all stores is done
|
|
1004
|
-
* atomically.
|
|
1005
|
-
*/
|
|
1006
|
-
export declare const ALL_STORES: string[];
|
|
1007
|
-
/** Returns the object stores for the provided schema. */
|
|
1008
|
-
export declare function getObjectStores(schemaVersion: number): string[];
|