@firebase/firestore 4.4.3-canary.6d487d7de → 4.4.3-canary.ce88e71e7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/firestore/src/api/reference_impl.d.ts +12 -0
  2. package/dist/firestore/src/api.d.ts +1 -1
  3. package/dist/firestore/src/core/event_manager.d.ts +26 -4
  4. package/dist/firestore/src/core/sync_engine_impl.d.ts +6 -2
  5. package/dist/firestore/src/global_index.d.ts +17 -3
  6. package/dist/firestore/src/local/shared_client_state.d.ts +1 -1
  7. package/dist/firestore/test/integration/api/query.test.d.ts +2 -1
  8. package/dist/firestore/test/integration/api/snasphot_listener_source.test.d.ts +17 -0
  9. package/dist/firestore/test/unit/specs/bundle_spec.test.d.ts +19 -0
  10. package/dist/firestore/test/unit/specs/listen_source_spec.test.d.ts +17 -0
  11. package/dist/firestore/test/unit/specs/spec_builder.d.ts +10 -1
  12. package/dist/firestore/test/unit/specs/spec_test_runner.d.ts +2 -0
  13. package/dist/index.cjs.js +587 -514
  14. package/dist/index.cjs.js.map +1 -1
  15. package/dist/index.d.ts +12 -0
  16. package/dist/index.esm2017.js +587 -514
  17. package/dist/index.esm2017.js.map +1 -1
  18. package/dist/index.esm5.js +1635 -1520
  19. package/dist/index.esm5.js.map +1 -1
  20. package/dist/index.node.cjs.js +131 -35
  21. package/dist/index.node.cjs.js.map +1 -1
  22. package/dist/index.node.mjs +131 -35
  23. package/dist/index.node.mjs.map +1 -1
  24. package/dist/index.rn.js +589 -516
  25. package/dist/index.rn.js.map +1 -1
  26. package/dist/internal.d.ts +17 -2
  27. package/dist/lite/firestore/src/api/reference_impl.d.ts +12 -0
  28. package/dist/lite/firestore/src/api.d.ts +1 -1
  29. package/dist/lite/firestore/src/core/event_manager.d.ts +26 -4
  30. package/dist/lite/firestore/src/core/sync_engine_impl.d.ts +6 -2
  31. package/dist/lite/firestore/src/local/shared_client_state.d.ts +1 -1
  32. package/dist/lite/firestore/test/integration/api/query.test.d.ts +2 -1
  33. package/dist/lite/firestore/test/integration/api/snasphot_listener_source.test.d.ts +17 -0
  34. package/dist/lite/firestore/test/unit/specs/bundle_spec.test.d.ts +19 -0
  35. package/dist/lite/firestore/test/unit/specs/listen_source_spec.test.d.ts +17 -0
  36. package/dist/lite/firestore/test/unit/specs/spec_builder.d.ts +10 -1
  37. package/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts +2 -0
  38. package/dist/lite/index.browser.esm2017.js +2 -2
  39. package/dist/lite/index.browser.esm5.js +2 -2
  40. package/dist/lite/index.cjs.js +2 -2
  41. package/dist/lite/index.node.cjs.js +2 -2
  42. package/dist/lite/index.node.mjs +2 -2
  43. package/dist/lite/index.rn.esm2017.js +2 -2
  44. package/dist/lite/internal.d.ts +4 -2
  45. package/dist/lite/packages/firestore/src/api/reference_impl.d.ts +12 -0
  46. package/dist/lite/packages/firestore/src/api.d.ts +1 -1
  47. package/dist/lite/packages/firestore/src/core/event_manager.d.ts +26 -4
  48. package/dist/lite/packages/firestore/src/core/sync_engine_impl.d.ts +6 -2
  49. package/dist/lite/packages/firestore/src/local/shared_client_state.d.ts +1 -1
  50. package/dist/lite/packages/firestore/test/integration/api/query.test.d.ts +2 -1
  51. package/dist/lite/packages/firestore/test/integration/api/snasphot_listener_source.test.d.ts +17 -0
  52. package/dist/lite/packages/firestore/test/unit/specs/bundle_spec.test.d.ts +19 -0
  53. package/dist/lite/packages/firestore/test/unit/specs/listen_source_spec.test.d.ts +17 -0
  54. package/dist/lite/packages/firestore/test/unit/specs/spec_builder.d.ts +10 -1
  55. package/dist/lite/packages/firestore/test/unit/specs/spec_test_runner.d.ts +2 -0
  56. package/dist/lite/private.d.ts +4 -2
  57. package/dist/packages/firestore/dist/index.esm2017.d.ts +69 -69
  58. package/dist/packages/firestore/src/api/reference_impl.d.ts +12 -0
  59. package/dist/packages/firestore/src/api.d.ts +1 -1
  60. package/dist/packages/firestore/src/core/event_manager.d.ts +26 -4
  61. package/dist/packages/firestore/src/core/sync_engine_impl.d.ts +6 -2
  62. package/dist/packages/firestore/src/local/shared_client_state.d.ts +1 -1
  63. package/dist/packages/firestore/test/integration/api/query.test.d.ts +2 -1
  64. package/dist/packages/firestore/test/integration/api/snasphot_listener_source.test.d.ts +17 -0
  65. package/dist/packages/firestore/test/unit/specs/bundle_spec.test.d.ts +19 -0
  66. package/dist/packages/firestore/test/unit/specs/listen_source_spec.test.d.ts +17 -0
  67. package/dist/packages/firestore/test/unit/specs/spec_builder.d.ts +10 -1
  68. package/dist/packages/firestore/test/unit/specs/spec_test_runner.d.ts +2 -0
  69. package/dist/private.d.ts +17 -2
  70. package/package.json +9 -9
@@ -34,7 +34,19 @@ export interface SnapshotListenOptions {
34
34
  * changed. Default is false.
35
35
  */
36
36
  readonly includeMetadataChanges?: boolean;
37
+ /**
38
+ * Set the source the query listens to. Default to "default", which
39
+ * listens to both cache and server.
40
+ */
41
+ readonly source?: ListenSource;
37
42
  }
43
+ /**
44
+ * Describe the source a query listens to.
45
+ *
46
+ * Set to `default` to listen to both cache and server changes. Set to `cache`
47
+ * to listen to changes in cache only.
48
+ */
49
+ export declare type ListenSource = 'default' | 'cache';
38
50
  /**
39
51
  * Reads the document referred to by this `DocumentReference`.
40
52
  *
@@ -26,7 +26,7 @@ export { ExperimentalLongPollingOptions } from './api/long_polling_options';
26
26
  export { DocumentChange, DocumentChangeType, DocumentSnapshot, FirestoreDataConverter, QueryDocumentSnapshot, QuerySnapshot, snapshotEqual, SnapshotMetadata, SnapshotOptions } from './api/snapshot';
27
27
  export { collection, collectionGroup, CollectionReference, doc, DocumentData, DocumentReference, PartialWithFieldValue, Query, queryEqual, refEqual, SetOptions, UpdateData, WithFieldValue } from './api/reference';
28
28
  export { and, endAt, endBefore, limit, limitToLast, or, orderBy, OrderByDirection, query, QueryCompositeFilterConstraint, QueryConstraint, QueryConstraintType, QueryEndAtConstraint, QueryFieldFilterConstraint, QueryFilterConstraint, QueryLimitConstraint, QueryNonFilterConstraint, QueryOrderByConstraint, QueryStartAtConstraint, startAfter, startAt, where, WhereFilterOp } from './api/filter';
29
- export { SnapshotListenOptions, Unsubscribe } from './api/reference_impl';
29
+ export { ListenSource, SnapshotListenOptions, Unsubscribe } from './api/reference_impl';
30
30
  export { TransactionOptions } from './api/transaction_options';
31
31
  export { runTransaction, Transaction } from './api/transaction';
32
32
  export { addDoc, deleteDoc, executeWrite, getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, onSnapshot, onSnapshotsInSync, setDoc, updateDoc } from './api/reference_impl';
@@ -27,6 +27,7 @@ import { ViewSnapshot } from './view_snapshot';
27
27
  declare class QueryListenersInfo {
28
28
  viewSnap: ViewSnapshot | undefined;
29
29
  listeners: QueryListener[];
30
+ hasRemoteListeners(): boolean;
30
31
  }
31
32
  /**
32
33
  * Interface for handling events from the EventManager.
@@ -45,8 +46,10 @@ export interface Observer<T> {
45
46
  * allows users to tree-shake the Watch logic.
46
47
  */
47
48
  export interface EventManager {
48
- onListen?: (query: Query) => Promise<ViewSnapshot>;
49
- onUnlisten?: (query: Query) => Promise<void>;
49
+ onListen?: (query: Query, enableRemoteListen: boolean) => Promise<ViewSnapshot>;
50
+ onUnlisten?: (query: Query, disableRemoteListen: boolean) => Promise<void>;
51
+ onFirstRemoteStoreListen?: (query: Query) => Promise<void>;
52
+ onLastRemoteStoreUnlisten?: (query: Query) => Promise<void>;
50
53
  }
51
54
  export declare function newEventManager(): EventManager;
52
55
  export declare class EventManagerImpl implements EventManager {
@@ -54,9 +57,19 @@ export declare class EventManagerImpl implements EventManager {
54
57
  onlineState: OnlineState;
55
58
  snapshotsInSyncListeners: Set<Observer<void>>;
56
59
  /** Callback invoked when a Query is first listen to. */
57
- onListen?: (query: Query) => Promise<ViewSnapshot>;
60
+ onListen?: (query: Query, enableRemoteListen: boolean) => Promise<ViewSnapshot>;
58
61
  /** Callback invoked once all listeners to a Query are removed. */
59
- onUnlisten?: (query: Query) => Promise<void>;
62
+ onUnlisten?: (query: Query, disableRemoteListen: boolean) => Promise<void>;
63
+ /**
64
+ * Callback invoked when a Query starts listening to the remote store, while
65
+ * already listening to the cache.
66
+ */
67
+ onFirstRemoteStoreListen?: (query: Query) => Promise<void>;
68
+ /**
69
+ * Callback invoked when a Query stops listening to the remote store, while
70
+ * still listening to the cache.
71
+ */
72
+ onLastRemoteStoreUnlisten?: (query: Query) => Promise<void>;
60
73
  }
61
74
  export declare function eventManagerListen(eventManager: EventManager, listener: QueryListener): Promise<void>;
62
75
  export declare function eventManagerUnlisten(eventManager: EventManager, listener: QueryListener): Promise<void>;
@@ -65,6 +78,12 @@ export declare function eventManagerOnWatchError(eventManager: EventManager, que
65
78
  export declare function eventManagerOnOnlineStateChange(eventManager: EventManager, onlineState: OnlineState): void;
66
79
  export declare function addSnapshotsInSyncListener(eventManager: EventManager, observer: Observer<void>): void;
67
80
  export declare function removeSnapshotsInSyncListener(eventManager: EventManager, observer: Observer<void>): void;
81
+ export declare enum ListenerDataSource {
82
+ /** Listen to both cache and server changes */
83
+ Default = "default",
84
+ /** Listen to changes in cache only */
85
+ Cache = "cache"
86
+ }
68
87
  export interface ListenOptions {
69
88
  /** Raise events even when only the metadata changes */
70
89
  readonly includeMetadataChanges?: boolean;
@@ -73,6 +92,8 @@ export interface ListenOptions {
73
92
  * offline.
74
93
  */
75
94
  readonly waitForSyncWhenOnline?: boolean;
95
+ /** Set the source events raised from. */
96
+ readonly source?: ListenerDataSource;
76
97
  }
77
98
  /**
78
99
  * QueryListener takes a series of internal view snapshots and determines
@@ -105,5 +126,6 @@ export declare class QueryListener {
105
126
  private shouldRaiseInitialEvent;
106
127
  private shouldRaiseEvent;
107
128
  private raiseInitialEvent;
129
+ listensToRemoteStore(): boolean;
108
130
  }
109
131
  export {};
@@ -174,9 +174,13 @@ export declare function newSyncEngine(localStore: LocalStore, remoteStore: Remot
174
174
  * server. All the subsequent view snapshots or errors are sent to the
175
175
  * subscribed handlers. Returns the initial snapshot.
176
176
  */
177
- export declare function syncEngineListen(syncEngine: SyncEngine, query: Query): Promise<ViewSnapshot>;
177
+ export declare function syncEngineListen(syncEngine: SyncEngine, query: Query, shouldListenToRemote?: boolean): Promise<ViewSnapshot>;
178
+ /** Query has been listening to the cache, and tries to initiate the remote store listen */
179
+ export declare function triggerRemoteStoreListen(syncEngine: SyncEngine, query: Query): Promise<void>;
178
180
  /** Stops listening to the query. */
179
- export declare function syncEngineUnlisten(syncEngine: SyncEngine, query: Query): Promise<void>;
181
+ export declare function syncEngineUnlisten(syncEngine: SyncEngine, query: Query, shouldUnlistenToRemote: boolean): Promise<void>;
182
+ /** Unlistens to the remote store while still listening to the cache. */
183
+ export declare function triggerRemoteStoreUnlisten(syncEngine: SyncEngine, query: Query): Promise<void>;
180
184
  /**
181
185
  * Initiates the write of local mutation batch which involves adding the
182
186
  * writes to the mutation queue, notifying the remote store about new
@@ -5380,8 +5380,10 @@ declare class AutoId {
5380
5380
  * allows users to tree-shake the Watch logic.
5381
5381
  */
5382
5382
  interface EventManager {
5383
- onListen?: (query: Query$1) => Promise<ViewSnapshot>;
5384
- onUnlisten?: (query: Query$1) => Promise<void>;
5383
+ onListen?: (query: Query$1, enableRemoteListen: boolean) => Promise<ViewSnapshot>;
5384
+ onUnlisten?: (query: Query$1, disableRemoteListen: boolean) => Promise<void>;
5385
+ onFirstRemoteStoreListen?: (query: Query$1) => Promise<void>;
5386
+ onLastRemoteStoreUnlisten?: (query: Query$1) => Promise<void>;
5385
5387
  }
5386
5388
 
5387
5389
  /**
@@ -7594,7 +7596,19 @@ interface SnapshotListenOptions {
7594
7596
  * changed. Default is false.
7595
7597
  */
7596
7598
  readonly includeMetadataChanges?: boolean;
7599
+ /**
7600
+ * Set the source the query listens to. Default to "default", which
7601
+ * listens to both cache and server.
7602
+ */
7603
+ readonly source?: ListenSource;
7597
7604
  }
7605
+ /**
7606
+ * Describe the source a query listens to.
7607
+ *
7608
+ * Set to `default` to listen to both cache and server changes. Set to `cache`
7609
+ * to listen to changes in cache only.
7610
+ */
7611
+ declare type ListenSource = 'default' | 'cache';
7598
7612
  /**
7599
7613
  * Reads the document referred to by this `DocumentReference`.
7600
7614
  *
@@ -9616,4 +9630,4 @@ declare module '@firebase/component' {
9616
9630
  }
9617
9631
  }
9618
9632
 
9619
- 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, PersistentCacheIndexManager, 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, AutoId as _AutoId, 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, deleteAllPersistentCacheIndexes, deleteDoc, deleteField, disableNetwork, disablePersistentCacheIndexAutoCreation, doc, documentId, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, enablePersistentCacheIndexAutoCreation, endAt, endBefore, ensureFirestoreConfigured, executeWrite, getAggregateFromServer, getCountFromServer, getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, getFirestore, getPersistentCacheIndexManager, 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 };
9633
+ 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, ListenSource, LoadBundleTask, LoadBundleTaskProgress, LogLevelString as LogLevel, MemoryCacheSettings, MemoryEagerGarbageCollector, MemoryGarbageCollector, MemoryLocalCache, MemoryLruGarbageCollector, NestedUpdateFields, OrderByDirection, PartialWithFieldValue, PersistenceSettings, PersistentCacheIndexManager, 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, AutoId as _AutoId, 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, deleteAllPersistentCacheIndexes, deleteDoc, deleteField, disableNetwork, disablePersistentCacheIndexAutoCreation, doc, documentId, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, enablePersistentCacheIndexAutoCreation, endAt, endBefore, ensureFirestoreConfigured, executeWrite, getAggregateFromServer, getCountFromServer, getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, getFirestore, getPersistentCacheIndexManager, 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 };
@@ -153,7 +153,7 @@ export declare class QueryTargetMetadata {
153
153
  }
154
154
  /**
155
155
  * Metadata state of a single client denoting the query targets it is actively
156
- * listening to.
156
+ * listening to the watch.
157
157
  */
158
158
  export interface ClientState {
159
159
  readonly activeTargetIds: TargetIdSet;
@@ -14,4 +14,5 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- export {};
17
+ import { DocumentChange, DocumentChangeType } from '../util/firebase_export';
18
+ export declare function verifyDocumentChange<T>(change: DocumentChange<T>, id: string, oldIndex: number, newIndex: number, type: DocumentChangeType): void;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 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
+ export {};
@@ -14,4 +14,23 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ import { Query } from '../../../src/core/query';
18
+ import { DocumentKey } from '../../../src/model/document_key';
19
+ import { JsonObject } from '../../../src/model/object_value';
20
+ import { LimitType } from '../../../src/protos/firestore_bundle_proto';
21
+ import { TestSnapshotVersion } from '../../util/helpers';
22
+ interface TestBundleDocument {
23
+ key: DocumentKey;
24
+ readTime: TestSnapshotVersion;
25
+ createTime?: TestSnapshotVersion;
26
+ updateTime?: TestSnapshotVersion;
27
+ content?: JsonObject<unknown>;
28
+ }
29
+ interface TestBundledQuery {
30
+ name: string;
31
+ readTime: TestSnapshotVersion;
32
+ query: Query;
33
+ limitType?: LimitType;
34
+ }
35
+ export declare function bundleWithDocumentAndQuery(testDoc: TestBundleDocument, testQuery?: TestBundledQuery): string;
17
36
  export {};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 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
+ export {};
@@ -108,13 +108,16 @@ export declare class SpecBuilder {
108
108
  runAsTest(name: string, tags: string[], usePersistence: boolean): Promise<void>;
109
109
  ensureManualLruGC(): this;
110
110
  withMaxConcurrentLimboResolutions(value?: number): this;
111
+ private addUserListenStep;
111
112
  userListens(query: Query, resume?: ResumeSpec): this;
113
+ userListensToCache(query: Query, resume?: ResumeSpec): this;
112
114
  /**
113
115
  * Registers a previously active target with the test expectations after a
114
116
  * stream disconnect.
115
117
  */
116
118
  restoreListen(query: Query, resumeToken: string, expectedCount?: number): this;
117
- userUnlistens(query: Query): this;
119
+ userUnlistens(query: Query, shouldRemoveWatchTarget?: boolean): this;
120
+ userUnlistensToCache(query: Query): this;
118
121
  userSets(key: string, value: JsonObject<unknown>): this;
119
122
  userPatches(key: string, value: JsonObject<unknown>): this;
120
123
  userDeletes(key: string): this;
@@ -218,10 +221,16 @@ export declare class SpecBuilder {
218
221
  metadata?: Document[];
219
222
  errorCode?: Code;
220
223
  }): this;
224
+ private registerQuery;
221
225
  /** Registers a query that is active in another tab. */
222
226
  expectListen(query: Query, resume?: ResumeSpec): this;
227
+ /** Registers a query that is listening to cache and active in another tab. */
228
+ expectListenToCache(query: Query, resume?: ResumeSpec): this;
229
+ removeQuery(query: Query, shouldRemoveWatchTarget?: boolean): this;
223
230
  /** Removes a query that is no longer active in any tab. */
224
231
  expectUnlisten(query: Query): this;
232
+ /** Removes a query that is listening to cache and no longer active in any tab. */
233
+ expectUnlistenToCache(query: Query): this;
225
234
  /**
226
235
  * Verifies the total number of requests sent to the write backend since test
227
236
  * initialization.
@@ -15,6 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { IndexConfiguration } from '../../../src/api/index_configuration';
18
+ import { ListenOptions } from '../../../src/core/event_manager';
18
19
  import { Query } from '../../../src/core/query';
19
20
  import { TargetId } from '../../../src/core/types';
20
21
  import { FieldIndex } from '../../../src/model/field_index';
@@ -152,6 +153,7 @@ export interface SpecStep {
152
153
  export interface SpecUserListen {
153
154
  targetId: TargetId;
154
155
  query: string | SpecQuery;
156
+ options?: ListenOptions;
155
157
  }
156
158
  /** [<target-id>, <query-path>] */
157
159
  export declare type SpecUserUnlisten = [TargetId, string | SpecQuery];