@firebase/firestore 4.1.0-canary.89fb9fd17 → 4.1.0-canary.9f90a07ac
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/dist/firestore/src/api.d.ts +2 -1
- package/dist/firestore/src/global_index.d.ts +50 -69
- package/dist/firestore/src/util/testing_hooks.d.ts +11 -78
- package/dist/firestore/src/util/testing_hooks_spi.d.ts +93 -0
- package/dist/firestore/test/integration/util/testing_hooks_util.d.ts +2 -2
- package/dist/index.cjs.js +1444 -1423
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm2017.js +1444 -1423
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3038 -3031
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +88 -66
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +88 -66
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +1444 -1423
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +61 -98
- package/dist/lite/firestore/src/api.d.ts +2 -1
- package/dist/lite/firestore/src/util/testing_hooks.d.ts +11 -78
- package/dist/lite/firestore/src/util/testing_hooks_spi.d.ts +93 -0
- package/dist/lite/firestore/test/integration/util/testing_hooks_util.d.ts +2 -2
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm5.js +2 -2
- package/dist/lite/index.cjs.js +2 -2
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.rn.esm2017.js +2 -2
- package/dist/lite/packages/firestore/src/api.d.ts +2 -1
- package/dist/lite/packages/firestore/src/util/testing_hooks.d.ts +11 -78
- package/dist/lite/packages/firestore/src/util/testing_hooks_spi.d.ts +93 -0
- package/dist/lite/packages/firestore/test/integration/util/testing_hooks_util.d.ts +2 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +258 -281
- package/dist/packages/firestore/src/api.d.ts +2 -1
- package/dist/packages/firestore/src/util/testing_hooks.d.ts +11 -78
- package/dist/packages/firestore/src/util/testing_hooks_spi.d.ts +93 -0
- package/dist/packages/firestore/test/integration/util/testing_hooks_util.d.ts +2 -2
- package/dist/private.d.ts +4 -55
- package/package.json +9 -9
|
@@ -57,4 +57,5 @@ export { logWarn as _logWarn } from './util/log';
|
|
|
57
57
|
export type { AuthTokenFactory, FirstPartyCredentialsSettings } from './api/credentials';
|
|
58
58
|
export { EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider } from './api/credentials';
|
|
59
59
|
export { EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider } from './api/credentials';
|
|
60
|
-
export { TestingHooks as _TestingHooks } from './util/testing_hooks';
|
|
60
|
+
export { ExistenceFilterMismatchCallback as _TestingHooksExistenceFilterMismatchCallback, TestingHooks as _TestingHooks } from './util/testing_hooks';
|
|
61
|
+
export { ExistenceFilterMismatchInfo as _TestingHooksExistenceFilterMismatchInfo } from './util/testing_hooks_spi';
|
|
@@ -9084,75 +9084,9 @@ declare function cast<T>(obj: object, constructor: {
|
|
|
9084
9084
|
declare function debugAssert(assertion: boolean, message: string): asserts assertion;
|
|
9085
9085
|
|
|
9086
9086
|
/**
|
|
9087
|
-
*
|
|
9088
|
-
* Copyright 2023 Google LLC
|
|
9089
|
-
*
|
|
9090
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9091
|
-
* you may not use this file except in compliance with the License.
|
|
9092
|
-
* You may obtain a copy of the License at
|
|
9093
|
-
*
|
|
9094
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9095
|
-
*
|
|
9096
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
9097
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9098
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9099
|
-
* See the License for the specific language governing permissions and
|
|
9100
|
-
* limitations under the License.
|
|
9101
|
-
*/
|
|
9102
|
-
/**
|
|
9103
|
-
* Manages "testing hooks", hooks into the internals of the SDK to verify
|
|
9104
|
-
* internal state and events during integration tests. Do not use this class
|
|
9105
|
-
* except for testing purposes.
|
|
9106
|
-
*
|
|
9107
|
-
* There are two ways to retrieve the global singleton instance of this class:
|
|
9108
|
-
* 1. The `instance` property, which returns null if the global singleton
|
|
9109
|
-
* instance has not been created. Use this property if the caller should
|
|
9110
|
-
* "do nothing" if there are no testing hooks registered, such as when
|
|
9111
|
-
* delivering an event to notify registered callbacks.
|
|
9112
|
-
* 2. The `getOrCreateInstance()` method, which creates the global singleton
|
|
9113
|
-
* instance if it has not been created. Use this method if the instance is
|
|
9114
|
-
* needed to, for example, register a callback.
|
|
9115
|
-
*
|
|
9087
|
+
* Information about an existence filter mismatch.
|
|
9116
9088
|
* @internal
|
|
9117
9089
|
*/
|
|
9118
|
-
declare class TestingHooks {
|
|
9119
|
-
private readonly onExistenceFilterMismatchCallbacks;
|
|
9120
|
-
private constructor();
|
|
9121
|
-
/**
|
|
9122
|
-
* Returns the singleton instance of this class, or null if it has not been
|
|
9123
|
-
* initialized.
|
|
9124
|
-
*/
|
|
9125
|
-
static get instance(): TestingHooks | null;
|
|
9126
|
-
/**
|
|
9127
|
-
* Returns the singleton instance of this class, creating it if is has never
|
|
9128
|
-
* been created before.
|
|
9129
|
-
*/
|
|
9130
|
-
static getOrCreateInstance(): TestingHooks;
|
|
9131
|
-
/**
|
|
9132
|
-
* Registers a callback to be notified when an existence filter mismatch
|
|
9133
|
-
* occurs in the Watch listen stream.
|
|
9134
|
-
*
|
|
9135
|
-
* The relative order in which callbacks are notified is unspecified; do not
|
|
9136
|
-
* rely on any particular ordering. If a given callback is registered multiple
|
|
9137
|
-
* times then it will be notified multiple times, once per registration.
|
|
9138
|
-
*
|
|
9139
|
-
* @param callback the callback to invoke upon existence filter mismatch.
|
|
9140
|
-
*
|
|
9141
|
-
* @return a function that, when called, unregisters the given callback; only
|
|
9142
|
-
* the first invocation of the returned function does anything; all subsequent
|
|
9143
|
-
* invocations do nothing.
|
|
9144
|
-
*/
|
|
9145
|
-
onExistenceFilterMismatch(callback: ExistenceFilterMismatchCallback): () => void;
|
|
9146
|
-
/**
|
|
9147
|
-
* Invokes all currently-registered `onExistenceFilterMismatch` callbacks.
|
|
9148
|
-
* @param info Information about the existence filter mismatch.
|
|
9149
|
-
*/
|
|
9150
|
-
notifyOnExistenceFilterMismatch(info: ExistenceFilterMismatchInfo): void;
|
|
9151
|
-
}
|
|
9152
|
-
/**
|
|
9153
|
-
* Information about an existence filter mismatch, as specified to callbacks
|
|
9154
|
-
* registered with `TestingUtils.onExistenceFilterMismatch()`.
|
|
9155
|
-
*/
|
|
9156
9090
|
interface ExistenceFilterMismatchInfo {
|
|
9157
9091
|
/** The number of documents that matched the query in the local cache. */
|
|
9158
9092
|
localCacheCount: number;
|
|
@@ -9196,12 +9130,59 @@ interface ExistenceFilterMismatchInfo {
|
|
|
9196
9130
|
*/
|
|
9197
9131
|
mightContain?: (value: string) => boolean;
|
|
9198
9132
|
};
|
|
9133
|
+
}
|
|
9134
|
+
|
|
9135
|
+
/**
|
|
9136
|
+
* @license
|
|
9137
|
+
* Copyright 2023 Google LLC
|
|
9138
|
+
*
|
|
9139
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9140
|
+
* you may not use this file except in compliance with the License.
|
|
9141
|
+
* You may obtain a copy of the License at
|
|
9142
|
+
*
|
|
9143
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9144
|
+
*
|
|
9145
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9146
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9147
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9148
|
+
* See the License for the specific language governing permissions and
|
|
9149
|
+
* limitations under the License.
|
|
9150
|
+
*/
|
|
9151
|
+
|
|
9152
|
+
/**
|
|
9153
|
+
* Testing hooks for use by Firestore's integration test suite to reach into the
|
|
9154
|
+
* SDK internals to validate logic and behavior that is not visible from the
|
|
9155
|
+
* public API surface.
|
|
9156
|
+
*
|
|
9157
|
+
* @internal
|
|
9158
|
+
*/
|
|
9159
|
+
declare class TestingHooks {
|
|
9160
|
+
private constructor();
|
|
9161
|
+
/**
|
|
9162
|
+
* Registers a callback to be notified when an existence filter mismatch
|
|
9163
|
+
* occurs in the Watch listen stream.
|
|
9164
|
+
*
|
|
9165
|
+
* The relative order in which callbacks are notified is unspecified; do not
|
|
9166
|
+
* rely on any particular ordering. If a given callback is registered multiple
|
|
9167
|
+
* times then it will be notified multiple times, once per registration.
|
|
9168
|
+
*
|
|
9169
|
+
* @param callback the callback to invoke upon existence filter mismatch.
|
|
9170
|
+
*
|
|
9171
|
+
* @return a function that, when called, unregisters the given callback; only
|
|
9172
|
+
* the first invocation of the returned function does anything; all subsequent
|
|
9173
|
+
* invocations do nothing.
|
|
9174
|
+
*/
|
|
9175
|
+
static onExistenceFilterMismatch(callback: ExistenceFilterMismatchCallback): Unsubscribe;
|
|
9199
9176
|
}
|
|
9200
9177
|
/**
|
|
9201
9178
|
* The signature of callbacks registered with
|
|
9202
9179
|
* `TestingUtils.onExistenceFilterMismatch()`.
|
|
9180
|
+
*
|
|
9181
|
+
* The return value, if any, is ignored.
|
|
9182
|
+
*
|
|
9183
|
+
* @internal
|
|
9203
9184
|
*/
|
|
9204
|
-
declare type ExistenceFilterMismatchCallback = (info: ExistenceFilterMismatchInfo) =>
|
|
9185
|
+
declare type ExistenceFilterMismatchCallback = (info: ExistenceFilterMismatchInfo) => unknown;
|
|
9205
9186
|
|
|
9206
9187
|
/**
|
|
9207
9188
|
* Cloud Firestore
|
|
@@ -9215,4 +9196,4 @@ declare module '@firebase/component' {
|
|
|
9215
9196
|
}
|
|
9216
9197
|
}
|
|
9217
9198
|
|
|
9218
|
-
export { AbstractUserDataWriter, AddPrefixToKeys, AggregateField, AggregateFieldType, AggregateQuerySnapshot, AggregateSpec, AggregateSpecData, AggregateType, AuthTokenFactory, Bytes, CACHE_SIZE_UNLIMITED, ChildUpdateFields, CollectionReference, DocumentChange, DocumentChangeType, DocumentData, DocumentReference, DocumentSnapshot, EmulatorMockTokenOptions, ExperimentalLongPollingOptions, FieldPath, FieldValue, Firestore, FirestoreDataConverter, FirestoreError, FirestoreErrorCode, FirestoreLocalCache, FirestoreSettings, FirstPartyCredentialsSettings, GeoPoint, Index, IndexConfiguration, IndexField, LoadBundleTask, LoadBundleTaskProgress, LogLevelString as LogLevel, MemoryCacheSettings, MemoryEagerGarbageCollector, MemoryGarbageCollector, MemoryLocalCache, MemoryLruGarbageCollector, NestedUpdateFields, OrderByDirection, PartialWithFieldValue, PersistenceSettings, PersistentCacheSettings, PersistentLocalCache, PersistentMultipleTabManager, PersistentSingleTabManager, PersistentSingleTabManagerSettings, PersistentTabManager, Primitive, PrivateSettings, Query, QueryCompositeFilterConstraint, QueryConstraint, QueryConstraintType, QueryDocumentSnapshot, QueryEndAtConstraint, QueryFieldFilterConstraint, QueryFilterConstraint, QueryLimitConstraint, QueryNonFilterConstraint, QueryOrderByConstraint, QuerySnapshot, QueryStartAtConstraint, SetOptions, SnapshotListenOptions, SnapshotMetadata, SnapshotOptions, TaskState, Timestamp$1 as Timestamp, Transaction, TransactionOptions, UnionToIntersection, Unsubscribe, UpdateData, WhereFilterOp, WithFieldValue, WriteBatch, ByteString as _ByteString, DatabaseId as _DatabaseId, DocumentKey as _DocumentKey, EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider, EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider, FieldPath$1 as _FieldPath, ResourcePath as _ResourcePath, TestingHooks as _TestingHooks, cast as _cast, debugAssert as _debugAssert, isBase64Available as _isBase64Available, logWarn as _logWarn, validateIsNotUsedTogether as _validateIsNotUsedTogether, addDoc, aggregateFieldEqual, aggregateQuerySnapshotEqual, and, arrayRemove, arrayUnion, average, clearIndexedDbPersistence, collection, collectionGroup, connectFirestoreEmulator, count, deleteDoc, deleteField, disableNetwork, doc, documentId, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, endAt, endBefore, ensureFirestoreConfigured, executeWrite, getAggregateFromServer, getCountFromServer, getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, getFirestore, increment, initializeFirestore, limit, limitToLast, loadBundle, memoryEagerGarbageCollector, memoryLocalCache, memoryLruGarbageCollector, namedQuery, onSnapshot, onSnapshotsInSync, or, orderBy, persistentLocalCache, persistentMultipleTabManager, persistentSingleTabManager, query, queryEqual, refEqual, runTransaction, serverTimestamp, setDoc, setIndexConfiguration, setLogLevel, snapshotEqual, startAfter, startAt, sum, terminate, updateDoc, waitForPendingWrites, where, writeBatch };
|
|
9199
|
+
export { AbstractUserDataWriter, AddPrefixToKeys, AggregateField, AggregateFieldType, AggregateQuerySnapshot, AggregateSpec, AggregateSpecData, AggregateType, AuthTokenFactory, Bytes, CACHE_SIZE_UNLIMITED, ChildUpdateFields, CollectionReference, DocumentChange, DocumentChangeType, DocumentData, DocumentReference, DocumentSnapshot, EmulatorMockTokenOptions, ExperimentalLongPollingOptions, FieldPath, FieldValue, Firestore, FirestoreDataConverter, FirestoreError, FirestoreErrorCode, FirestoreLocalCache, FirestoreSettings, FirstPartyCredentialsSettings, GeoPoint, Index, IndexConfiguration, IndexField, LoadBundleTask, LoadBundleTaskProgress, LogLevelString as LogLevel, MemoryCacheSettings, MemoryEagerGarbageCollector, MemoryGarbageCollector, MemoryLocalCache, MemoryLruGarbageCollector, NestedUpdateFields, OrderByDirection, PartialWithFieldValue, PersistenceSettings, PersistentCacheSettings, PersistentLocalCache, PersistentMultipleTabManager, PersistentSingleTabManager, PersistentSingleTabManagerSettings, PersistentTabManager, Primitive, PrivateSettings, Query, QueryCompositeFilterConstraint, QueryConstraint, QueryConstraintType, QueryDocumentSnapshot, QueryEndAtConstraint, QueryFieldFilterConstraint, QueryFilterConstraint, QueryLimitConstraint, QueryNonFilterConstraint, QueryOrderByConstraint, QuerySnapshot, QueryStartAtConstraint, SetOptions, SnapshotListenOptions, SnapshotMetadata, SnapshotOptions, TaskState, Timestamp$1 as Timestamp, Transaction, TransactionOptions, UnionToIntersection, Unsubscribe, UpdateData, WhereFilterOp, WithFieldValue, WriteBatch, ByteString as _ByteString, DatabaseId as _DatabaseId, DocumentKey as _DocumentKey, EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider, EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider, FieldPath$1 as _FieldPath, ResourcePath as _ResourcePath, TestingHooks as _TestingHooks, ExistenceFilterMismatchCallback as _TestingHooksExistenceFilterMismatchCallback, ExistenceFilterMismatchInfo as _TestingHooksExistenceFilterMismatchInfo, cast as _cast, debugAssert as _debugAssert, isBase64Available as _isBase64Available, logWarn as _logWarn, validateIsNotUsedTogether as _validateIsNotUsedTogether, addDoc, aggregateFieldEqual, aggregateQuerySnapshotEqual, and, arrayRemove, arrayUnion, average, clearIndexedDbPersistence, collection, collectionGroup, connectFirestoreEmulator, count, deleteDoc, deleteField, disableNetwork, doc, documentId, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, endAt, endBefore, ensureFirestoreConfigured, executeWrite, getAggregateFromServer, getCountFromServer, getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, getFirestore, increment, initializeFirestore, limit, limitToLast, loadBundle, memoryEagerGarbageCollector, memoryLocalCache, memoryLruGarbageCollector, namedQuery, onSnapshot, onSnapshotsInSync, or, orderBy, persistentLocalCache, persistentMultipleTabManager, persistentSingleTabManager, query, queryEqual, refEqual, runTransaction, serverTimestamp, setDoc, setIndexConfiguration, setLogLevel, snapshotEqual, startAfter, startAt, sum, terminate, updateDoc, waitForPendingWrites, where, writeBatch };
|
|
@@ -14,35 +14,17 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
import { Unsubscribe } from '../api/reference_impl';
|
|
18
|
+
import { ExistenceFilterMismatchInfo } from './testing_hooks_spi';
|
|
17
19
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* There are two ways to retrieve the global singleton instance of this class:
|
|
23
|
-
* 1. The `instance` property, which returns null if the global singleton
|
|
24
|
-
* instance has not been created. Use this property if the caller should
|
|
25
|
-
* "do nothing" if there are no testing hooks registered, such as when
|
|
26
|
-
* delivering an event to notify registered callbacks.
|
|
27
|
-
* 2. The `getOrCreateInstance()` method, which creates the global singleton
|
|
28
|
-
* instance if it has not been created. Use this method if the instance is
|
|
29
|
-
* needed to, for example, register a callback.
|
|
20
|
+
* Testing hooks for use by Firestore's integration test suite to reach into the
|
|
21
|
+
* SDK internals to validate logic and behavior that is not visible from the
|
|
22
|
+
* public API surface.
|
|
30
23
|
*
|
|
31
24
|
* @internal
|
|
32
25
|
*/
|
|
33
26
|
export declare class TestingHooks {
|
|
34
|
-
private readonly onExistenceFilterMismatchCallbacks;
|
|
35
27
|
private constructor();
|
|
36
|
-
/**
|
|
37
|
-
* Returns the singleton instance of this class, or null if it has not been
|
|
38
|
-
* initialized.
|
|
39
|
-
*/
|
|
40
|
-
static get instance(): TestingHooks | null;
|
|
41
|
-
/**
|
|
42
|
-
* Returns the singleton instance of this class, creating it if is has never
|
|
43
|
-
* been created before.
|
|
44
|
-
*/
|
|
45
|
-
static getOrCreateInstance(): TestingHooks;
|
|
46
28
|
/**
|
|
47
29
|
* Registers a callback to be notified when an existence filter mismatch
|
|
48
30
|
* occurs in the Watch listen stream.
|
|
@@ -57,63 +39,14 @@ export declare class TestingHooks {
|
|
|
57
39
|
* the first invocation of the returned function does anything; all subsequent
|
|
58
40
|
* invocations do nothing.
|
|
59
41
|
*/
|
|
60
|
-
onExistenceFilterMismatch(callback: ExistenceFilterMismatchCallback):
|
|
61
|
-
/**
|
|
62
|
-
* Invokes all currently-registered `onExistenceFilterMismatch` callbacks.
|
|
63
|
-
* @param info Information about the existence filter mismatch.
|
|
64
|
-
*/
|
|
65
|
-
notifyOnExistenceFilterMismatch(info: ExistenceFilterMismatchInfo): void;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Information about an existence filter mismatch, as specified to callbacks
|
|
69
|
-
* registered with `TestingUtils.onExistenceFilterMismatch()`.
|
|
70
|
-
*/
|
|
71
|
-
export interface ExistenceFilterMismatchInfo {
|
|
72
|
-
/** The number of documents that matched the query in the local cache. */
|
|
73
|
-
localCacheCount: number;
|
|
74
|
-
/**
|
|
75
|
-
* The number of documents that matched the query on the server, as specified
|
|
76
|
-
* in the ExistenceFilter message's `count` field.
|
|
77
|
-
*/
|
|
78
|
-
existenceFilterCount: number;
|
|
79
|
-
/**
|
|
80
|
-
* The projectId used when checking documents for membership in the bloom
|
|
81
|
-
* filter.
|
|
82
|
-
*/
|
|
83
|
-
projectId: string;
|
|
84
|
-
/**
|
|
85
|
-
* The databaseId used when checking documents for membership in the bloom
|
|
86
|
-
* filter.
|
|
87
|
-
*/
|
|
88
|
-
databaseId: string;
|
|
89
|
-
/**
|
|
90
|
-
* Information about the bloom filter provided by Watch in the ExistenceFilter
|
|
91
|
-
* message's `unchangedNames` field. If this property is omitted or undefined
|
|
92
|
-
* then that means that Watch did _not_ provide a bloom filter.
|
|
93
|
-
*/
|
|
94
|
-
bloomFilter?: {
|
|
95
|
-
/**
|
|
96
|
-
* Whether a full requery was averted by using the bloom filter. If false,
|
|
97
|
-
* then something happened, such as a false positive, to prevent using the
|
|
98
|
-
* bloom filter to avoid a full requery.
|
|
99
|
-
*/
|
|
100
|
-
applied: boolean;
|
|
101
|
-
/** The number of hash functions used in the bloom filter. */
|
|
102
|
-
hashCount: number;
|
|
103
|
-
/** The number of bytes in the bloom filter's bitmask. */
|
|
104
|
-
bitmapLength: number;
|
|
105
|
-
/** The number of bits of padding in the last byte of the bloom filter. */
|
|
106
|
-
padding: number;
|
|
107
|
-
/**
|
|
108
|
-
* Tests the given string for membership in the bloom filter created from
|
|
109
|
-
* the existence filter; will be undefined if creating the bloom filter
|
|
110
|
-
* failed.
|
|
111
|
-
*/
|
|
112
|
-
mightContain?: (value: string) => boolean;
|
|
113
|
-
};
|
|
42
|
+
static onExistenceFilterMismatch(callback: ExistenceFilterMismatchCallback): Unsubscribe;
|
|
114
43
|
}
|
|
115
44
|
/**
|
|
116
45
|
* The signature of callbacks registered with
|
|
117
46
|
* `TestingUtils.onExistenceFilterMismatch()`.
|
|
47
|
+
*
|
|
48
|
+
* The return value, if any, is ignored.
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
118
51
|
*/
|
|
119
|
-
export declare type ExistenceFilterMismatchCallback = (info: ExistenceFilterMismatchInfo) =>
|
|
52
|
+
export declare type ExistenceFilterMismatchCallback = (info: ExistenceFilterMismatchInfo) => unknown;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 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
|
+
/**
|
|
18
|
+
* The global, singleton instance of TestingHooksSpi.
|
|
19
|
+
*
|
|
20
|
+
* This variable will be `null` in all cases _except_ when running from
|
|
21
|
+
* integration tests that have registered callbacks to be notified of events
|
|
22
|
+
* that happen during the test execution.
|
|
23
|
+
*/
|
|
24
|
+
export declare let testingHooksSpi: TestingHooksSpi | null;
|
|
25
|
+
/**
|
|
26
|
+
* Sets the value of the `testingHooksSpi` object.
|
|
27
|
+
* @param instance the instance to set.
|
|
28
|
+
*/
|
|
29
|
+
export declare function setTestingHooksSpi(instance: TestingHooksSpi): void;
|
|
30
|
+
/**
|
|
31
|
+
* The "service provider interface" for the testing hooks.
|
|
32
|
+
*
|
|
33
|
+
* The implementation of this object will handle the callbacks made by the SDK
|
|
34
|
+
* to be handled by the integration tests.
|
|
35
|
+
*
|
|
36
|
+
* This "SPI" is separated from the implementation to avoid import cycles and
|
|
37
|
+
* to enable production builds to fully tree-shake away the testing hooks logic.
|
|
38
|
+
*/
|
|
39
|
+
export interface TestingHooksSpi {
|
|
40
|
+
/**
|
|
41
|
+
* Invokes all callbacks registered with
|
|
42
|
+
* `TestingHooks.onExistenceFilterMismatch()` with the given info.
|
|
43
|
+
*/
|
|
44
|
+
notifyOnExistenceFilterMismatch(info: ExistenceFilterMismatchInfo): void;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Information about an existence filter mismatch.
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export interface ExistenceFilterMismatchInfo {
|
|
51
|
+
/** The number of documents that matched the query in the local cache. */
|
|
52
|
+
localCacheCount: number;
|
|
53
|
+
/**
|
|
54
|
+
* The number of documents that matched the query on the server, as specified
|
|
55
|
+
* in the ExistenceFilter message's `count` field.
|
|
56
|
+
*/
|
|
57
|
+
existenceFilterCount: number;
|
|
58
|
+
/**
|
|
59
|
+
* The projectId used when checking documents for membership in the bloom
|
|
60
|
+
* filter.
|
|
61
|
+
*/
|
|
62
|
+
projectId: string;
|
|
63
|
+
/**
|
|
64
|
+
* The databaseId used when checking documents for membership in the bloom
|
|
65
|
+
* filter.
|
|
66
|
+
*/
|
|
67
|
+
databaseId: string;
|
|
68
|
+
/**
|
|
69
|
+
* Information about the bloom filter provided by Watch in the ExistenceFilter
|
|
70
|
+
* message's `unchangedNames` field. If this property is omitted or undefined
|
|
71
|
+
* then that means that Watch did _not_ provide a bloom filter.
|
|
72
|
+
*/
|
|
73
|
+
bloomFilter?: {
|
|
74
|
+
/**
|
|
75
|
+
* Whether a full requery was averted by using the bloom filter. If false,
|
|
76
|
+
* then something happened, such as a false positive, to prevent using the
|
|
77
|
+
* bloom filter to avoid a full requery.
|
|
78
|
+
*/
|
|
79
|
+
applied: boolean;
|
|
80
|
+
/** The number of hash functions used in the bloom filter. */
|
|
81
|
+
hashCount: number;
|
|
82
|
+
/** The number of bytes in the bloom filter's bitmask. */
|
|
83
|
+
bitmapLength: number;
|
|
84
|
+
/** The number of bits of padding in the last byte of the bloom filter. */
|
|
85
|
+
padding: number;
|
|
86
|
+
/**
|
|
87
|
+
* Tests the given string for membership in the bloom filter created from
|
|
88
|
+
* the existence filter; will be undefined if creating the bloom filter
|
|
89
|
+
* failed.
|
|
90
|
+
*/
|
|
91
|
+
mightContain?: (value: string) => boolean;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
@@ -28,8 +28,8 @@ export declare function captureExistenceFilterMismatches<T>(callback: () => Prom
|
|
|
28
28
|
* Information about an existence filter mismatch, captured during an invocation
|
|
29
29
|
* of `captureExistenceFilterMismatches()`.
|
|
30
30
|
*
|
|
31
|
-
* See the documentation of `
|
|
32
|
-
* for the meaning of these values.
|
|
31
|
+
* See the documentation of `ExistenceFilterMismatchInfo` in
|
|
32
|
+
* `testing_hooks_spi.ts` for the meaning of these values.
|
|
33
33
|
*/
|
|
34
34
|
export interface ExistenceFilterMismatchInfo {
|
|
35
35
|
localCacheCount: number;
|