@firebase/firestore 3.13.0-canary.f2fb56fc0 → 3.13.0-canary.f3067f72d

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 (46) hide show
  1. package/dist/firestore/src/global_index.d.ts +15 -1
  2. package/dist/firestore/src/lite-api/types.d.ts +1 -1
  3. package/dist/firestore/src/util/testing_hooks.d.ts +14 -0
  4. package/dist/firestore/test/integration/util/helpers.d.ts +63 -16
  5. package/dist/firestore/test/integration/util/internal_helpers.d.ts +2 -1
  6. package/dist/firestore/test/integration/util/testing_hooks_util.d.ts +1 -0
  7. package/dist/index.cjs.js +150 -136
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.esm2017.js +150 -136
  11. package/dist/index.esm2017.js.map +1 -1
  12. package/dist/index.esm5.js +147 -133
  13. package/dist/index.esm5.js.map +1 -1
  14. package/dist/index.node.cjs.js +27 -21
  15. package/dist/index.node.cjs.js.map +1 -1
  16. package/dist/index.node.mjs +27 -21
  17. package/dist/index.node.mjs.map +1 -1
  18. package/dist/index.rn.js +150 -136
  19. package/dist/index.rn.js.map +1 -1
  20. package/dist/internal.d.ts +15 -1
  21. package/dist/lite/firestore/src/lite-api/types.d.ts +1 -1
  22. package/dist/lite/firestore/src/util/testing_hooks.d.ts +14 -0
  23. package/dist/lite/firestore/test/integration/util/helpers.d.ts +63 -16
  24. package/dist/lite/firestore/test/integration/util/internal_helpers.d.ts +2 -1
  25. package/dist/lite/firestore/test/integration/util/testing_hooks_util.d.ts +1 -0
  26. package/dist/lite/index.browser.esm2017.js +2 -2
  27. package/dist/lite/index.browser.esm5.js +2 -2
  28. package/dist/lite/index.cjs.js +2 -2
  29. package/dist/lite/index.d.ts +1 -1
  30. package/dist/lite/index.node.cjs.js +2 -2
  31. package/dist/lite/index.node.mjs +2 -2
  32. package/dist/lite/index.rn.esm2017.js +2 -2
  33. package/dist/lite/internal.d.ts +1 -1
  34. package/dist/lite/packages/firestore/src/lite-api/types.d.ts +1 -1
  35. package/dist/lite/packages/firestore/src/util/testing_hooks.d.ts +14 -0
  36. package/dist/lite/packages/firestore/test/integration/util/helpers.d.ts +63 -16
  37. package/dist/lite/packages/firestore/test/integration/util/internal_helpers.d.ts +2 -1
  38. package/dist/lite/packages/firestore/test/integration/util/testing_hooks_util.d.ts +1 -0
  39. package/dist/lite/private.d.ts +1 -1
  40. package/dist/packages/firestore/src/lite-api/types.d.ts +1 -1
  41. package/dist/packages/firestore/src/util/testing_hooks.d.ts +14 -0
  42. package/dist/packages/firestore/test/integration/util/helpers.d.ts +63 -16
  43. package/dist/packages/firestore/test/integration/util/internal_helpers.d.ts +2 -1
  44. package/dist/packages/firestore/test/integration/util/testing_hooks_util.d.ts +1 -0
  45. package/dist/private.d.ts +15 -1
  46. package/package.json +9 -9
@@ -6194,7 +6194,7 @@ declare type ChildUpdateFields<K extends string, V> = V extends Record<string, u
6194
6194
  * to a dot.
6195
6195
  */
6196
6196
  declare type AddPrefixToKeys<Prefix extends string, T extends Record<string, unknown>> = {
6197
- [K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
6197
+ [K in keyof T & string as `${Prefix}.${K}`]+?: string extends K ? any : T[K];
6198
6198
  };
6199
6199
  /**
6200
6200
  * Given a union type `U = T1 | T2 | ...`, returns an intersected type
@@ -9154,6 +9154,20 @@ interface ExistenceFilterMismatchInfo {
9154
9154
  bitmapLength: number;
9155
9155
  /** The number of bits of padding in the last byte of the bloom filter. */
9156
9156
  padding: number;
9157
+ /**
9158
+ * Check if the given document path is contained in the bloom filter.
9159
+ *
9160
+ * The "path" of a document can be retrieved from the
9161
+ * `DocumentReference.path` property.
9162
+ *
9163
+ * Note that due to the probabilistic nature of a bloom filter, it is
9164
+ * possible that false positives may occur; that is, this function may
9165
+ * return `true` even though the given string is not in the bloom filter.
9166
+ *
9167
+ * This property is "optional"; if it is undefined then parsing the bloom
9168
+ * filter failed.
9169
+ */
9170
+ mightContain?(documentPath: string): boolean;
9157
9171
  };
9158
9172
  }
9159
9173
  /**
@@ -46,7 +46,7 @@ export declare type ChildUpdateFields<K extends string, V> = V extends Record<st
46
46
  * to a dot.
47
47
  */
48
48
  export declare type AddPrefixToKeys<Prefix extends string, T extends Record<string, unknown>> = {
49
- [K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
49
+ [K in keyof T & string as `${Prefix}.${K}`]+?: string extends K ? any : T[K];
50
50
  };
51
51
  /**
52
52
  * Given a union type `U = T1 | T2 | ...`, returns an intersected type
@@ -94,6 +94,20 @@ export interface ExistenceFilterMismatchInfo {
94
94
  bitmapLength: number;
95
95
  /** The number of bits of padding in the last byte of the bloom filter. */
96
96
  padding: number;
97
+ /**
98
+ * Check if the given document path is contained in the bloom filter.
99
+ *
100
+ * The "path" of a document can be retrieved from the
101
+ * `DocumentReference.path` property.
102
+ *
103
+ * Note that due to the probabilistic nature of a bloom filter, it is
104
+ * possible that false positives may occur; that is, this function may
105
+ * return `true` even though the given string is not in the bloom filter.
106
+ *
107
+ * This property is "optional"; if it is undefined then parsing the bloom
108
+ * filter failed.
109
+ */
110
+ mightContain?(documentPath: string): boolean;
97
111
  };
98
112
  }
99
113
  /**
@@ -14,11 +14,56 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { CollectionReference, DocumentData, DocumentReference, Firestore, PrivateSettings, QuerySnapshot, SnapshotListenOptions } from './firebase_export';
17
+ import { CollectionReference, DocumentData, DocumentReference, Firestore, MemoryLocalCache, PersistentLocalCache, PrivateSettings, QuerySnapshot, SnapshotListenOptions } from './firebase_export';
18
+ export interface PersistenceMode {
19
+ readonly name: string;
20
+ readonly storage: 'memory' | 'indexeddb';
21
+ readonly gc: 'eager' | 'lru';
22
+ /**
23
+ * Creates and returns a new `PersistenceMode` object that is the nearest
24
+ * equivalent to this persistence mode but uses eager garbage collection.
25
+ */
26
+ toEagerGc(): PersistenceMode;
27
+ /**
28
+ * Creates and returns a new `PersistenceMode` object that is the nearest
29
+ * equivalent to this persistence mode but uses LRU garbage collection.
30
+ */
31
+ toLruGc(): PersistenceMode;
32
+ /**
33
+ * Creates and returns a new "local cache" object corresponding to this
34
+ * persistence type.
35
+ */
36
+ asLocalCacheFirestoreSettings(): MemoryLocalCache | PersistentLocalCache;
37
+ }
38
+ export declare class MemoryEagerPersistenceMode implements PersistenceMode {
39
+ readonly name = "memory";
40
+ readonly storage = "memory";
41
+ readonly gc = "eager";
42
+ toEagerGc(): MemoryEagerPersistenceMode;
43
+ toLruGc(): MemoryLruPersistenceMode;
44
+ asLocalCacheFirestoreSettings(): MemoryLocalCache;
45
+ }
46
+ export declare class MemoryLruPersistenceMode implements PersistenceMode {
47
+ readonly name = "memory_lru_gc";
48
+ readonly storage = "memory";
49
+ readonly gc = "lru";
50
+ toEagerGc(): MemoryEagerPersistenceMode;
51
+ toLruGc(): MemoryLruPersistenceMode;
52
+ asLocalCacheFirestoreSettings(): MemoryLocalCache;
53
+ }
54
+ export declare class IndexedDbPersistenceMode implements PersistenceMode {
55
+ readonly name = "indexeddb";
56
+ readonly storage = "indexeddb";
57
+ readonly gc = "lru";
58
+ toEagerGc(): MemoryEagerPersistenceMode;
59
+ toLruGc(): IndexedDbPersistenceMode;
60
+ asLocalCacheFirestoreSettings(): PersistentLocalCache;
61
+ }
62
+ export declare const PERSISTENCE_MODE_UNSPECIFIED: unique symbol;
18
63
  export declare function isPersistenceAvailable(): boolean;
19
- declare type ApiSuiteFunction = (message: string, testSuite: (persistence: boolean) => void) => void;
64
+ declare type ApiSuiteFunction = (message: string, testSuite: (persistence: PersistenceMode) => void) => void;
20
65
  interface ApiDescribe {
21
- (message: string, testSuite: (persistence: boolean) => void): void;
66
+ (message: string, testSuite: (persistence: PersistenceMode) => void): void;
22
67
  skip: ApiSuiteFunction;
23
68
  only: ApiSuiteFunction;
24
69
  }
@@ -32,22 +77,24 @@ export declare function toDataMap(docSet: QuerySnapshot): {
32
77
  };
33
78
  /** Converts a DocumentSet to an array with the id of each document */
34
79
  export declare function toIds(docSet: QuerySnapshot): string[];
35
- export declare function withTestDb(persistence: boolean, fn: (db: Firestore) => Promise<void>): Promise<void>;
36
- export declare function withEnsuredEagerGcTestDb(fn: (db: Firestore) => Promise<void>): Promise<void>;
37
- export declare function withEnsuredLruGcTestDb(persistence: boolean, fn: (db: Firestore) => Promise<void>): Promise<void>;
80
+ export declare function withTestDb(persistence: PersistenceMode | typeof PERSISTENCE_MODE_UNSPECIFIED, fn: (db: Firestore) => Promise<void>): Promise<void>;
38
81
  /** Runs provided fn with a db for an alternate project id. */
39
- export declare function withAlternateTestDb(persistence: boolean, fn: (db: Firestore) => Promise<void>): Promise<void>;
40
- export declare function withTestDbs(persistence: boolean, numDbs: number, fn: (db: Firestore[]) => Promise<void>): Promise<void>;
41
- export declare function withTestDbsSettings<T>(persistence: boolean, projectId: string, settings: PrivateSettings, numDbs: number, fn: (db: Firestore[]) => Promise<T>): Promise<T>;
42
- export declare function withNamedTestDbsOrSkipUnlessUsingEmulator(persistence: boolean, dbNames: string[], fn: (db: Firestore[]) => Promise<void>): Promise<void>;
43
- export declare function withTestDoc(persistence: boolean, fn: (doc: DocumentReference, db: Firestore) => Promise<void>): Promise<void>;
44
- export declare function withTestDocAndSettings(persistence: boolean, settings: PrivateSettings, fn: (doc: DocumentReference) => Promise<void>): Promise<void>;
45
- export declare function withTestDocAndInitialData(persistence: boolean, initialData: DocumentData | null, fn: (doc: DocumentReference, db: Firestore) => Promise<void>): Promise<void>;
46
- export declare function withTestCollection<T>(persistence: boolean, docs: {
82
+ export declare function withAlternateTestDb(persistence: PersistenceMode | typeof PERSISTENCE_MODE_UNSPECIFIED, fn: (db: Firestore) => Promise<void>): Promise<void>;
83
+ export declare function withTestDbs(persistence: PersistenceMode | typeof PERSISTENCE_MODE_UNSPECIFIED, numDbs: number, fn: (db: Firestore[]) => Promise<void>): Promise<void>;
84
+ export declare function withTestDbsSettings<T>(persistence: PersistenceMode | typeof PERSISTENCE_MODE_UNSPECIFIED, projectId: string, settings: PrivateSettings, numDbs: number, fn: (db: Firestore[]) => Promise<T>): Promise<T>;
85
+ export declare function withNamedTestDbsOrSkipUnlessUsingEmulator(persistence: PersistenceMode, dbNames: string[], fn: (db: Firestore[]) => Promise<void>): Promise<void>;
86
+ export declare function withTestDoc(persistence: PersistenceMode | typeof PERSISTENCE_MODE_UNSPECIFIED, fn: (doc: DocumentReference, db: Firestore) => Promise<void>): Promise<void>;
87
+ export declare function withTestDocAndSettings(persistence: PersistenceMode | typeof PERSISTENCE_MODE_UNSPECIFIED, settings: PrivateSettings, fn: (doc: DocumentReference) => Promise<void>): Promise<void>;
88
+ export declare function withTestDocAndInitialData(persistence: PersistenceMode | typeof PERSISTENCE_MODE_UNSPECIFIED, initialData: DocumentData | null, fn: (doc: DocumentReference, db: Firestore) => Promise<void>): Promise<void>;
89
+ export declare class RetryError extends Error {
90
+ readonly name = "FirestoreIntegrationTestRetryError";
91
+ }
92
+ export declare function withRetry<T>(fn: (attemptNumber: number) => Promise<T>): Promise<T>;
93
+ export declare function withTestCollection<T>(persistence: PersistenceMode | typeof PERSISTENCE_MODE_UNSPECIFIED, docs: {
47
94
  [key: string]: DocumentData;
48
95
  }, fn: (collection: CollectionReference, db: Firestore) => Promise<T>): Promise<T>;
49
- export declare function withEmptyTestCollection(persistence: boolean, fn: (collection: CollectionReference, db: Firestore) => Promise<void>): Promise<void>;
50
- export declare function withTestCollectionSettings<T>(persistence: boolean, settings: PrivateSettings, docs: {
96
+ export declare function withEmptyTestCollection(persistence: PersistenceMode | typeof PERSISTENCE_MODE_UNSPECIFIED, fn: (collection: CollectionReference, db: Firestore) => Promise<void>): Promise<void>;
97
+ export declare function withTestCollectionSettings<T>(persistence: PersistenceMode | typeof PERSISTENCE_MODE_UNSPECIFIED, settings: PrivateSettings, docs: {
51
98
  [key: string]: DocumentData;
52
99
  }, fn: (collection: CollectionReference, db: Firestore) => Promise<T>): Promise<T>;
53
100
  export {};
@@ -21,6 +21,7 @@ import { Datastore } from '../../../src/remote/datastore';
21
21
  import { AsyncQueue } from '../../../src/util/async_queue';
22
22
  import { AsyncQueueImpl } from '../../../src/util/async_queue_impl';
23
23
  import { Firestore } from './firebase_export';
24
+ import { PersistenceMode } from './helpers';
24
25
  export declare function asyncQueue(db: Firestore): AsyncQueueImpl;
25
26
  export declare function getDefaultDatabaseInfo(): DatabaseInfo;
26
27
  export declare function withTestDatastore(fn: (datastore: Datastore) => Promise<void>, authCredentialsProvider?: CredentialsProvider<User>, appCheckTokenProvider?: CredentialsProvider<string>): Promise<void>;
@@ -30,4 +31,4 @@ export declare class MockAuthCredentialsProvider extends EmptyAuthCredentialsPro
30
31
  triggerUserChange(newUser: User): void;
31
32
  start(asyncQueue: AsyncQueue, listener: CredentialChangeListener<User>): void;
32
33
  }
33
- export declare function withMockCredentialProviderTestDb(persistence: boolean, fn: (db: Firestore, mockCredential: MockAuthCredentialsProvider) => Promise<void>): Promise<void>;
34
+ export declare function withMockCredentialProviderTestDb(persistence: PersistenceMode, fn: (db: Firestore, mockCredential: MockAuthCredentialsProvider) => Promise<void>): Promise<void>;
@@ -42,5 +42,6 @@ export interface ExistenceFilterMismatchInfo {
42
42
  hashCount: number;
43
43
  bitmapLength: number;
44
44
  padding: number;
45
+ mightContain?(documentPath: string): boolean;
45
46
  };
46
47
  }