@firebase/firestore-compat 0.4.0-20230301000120 → 0.4.0-20250715195345

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 (85) hide show
  1. package/dist/index.cjs.js +980 -972
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/{index.esm2017.js → index.esm.js} +981 -973
  4. package/dist/index.esm.js.map +1 -0
  5. package/dist/index.node.cjs.js +980 -972
  6. package/dist/index.node.cjs.js.map +1 -1
  7. package/dist/index.rn.js +980 -972
  8. package/dist/index.rn.js.map +1 -1
  9. package/dist/node-esm/index.node.esm.js +980 -972
  10. package/dist/node-esm/index.node.esm.js.map +1 -1
  11. package/dist/node-esm/src/api/blob.d.ts +29 -29
  12. package/dist/node-esm/src/api/database.d.ts +228 -228
  13. package/dist/node-esm/src/api/field_path.d.ts +36 -36
  14. package/dist/node-esm/src/api/field_value.d.ts +29 -29
  15. package/dist/node-esm/src/api/geo_point.d.ts +17 -17
  16. package/dist/node-esm/src/api/observer.d.ts +29 -29
  17. package/dist/node-esm/src/api/timestamp.d.ts +17 -17
  18. package/dist/node-esm/src/config.d.ts +28 -28
  19. package/dist/node-esm/src/index.console.d.ts +48 -48
  20. package/dist/node-esm/src/index.d.ts +49 -49
  21. package/dist/node-esm/src/index.node.d.ts +22 -22
  22. package/dist/node-esm/src/index.rn.d.ts +22 -22
  23. package/dist/node-esm/src/register-module.d.ts +42 -42
  24. package/dist/node-esm/src/util/input_validation.d.ts +18 -18
  25. package/dist/node-esm/test/array_transforms.test.d.ts +17 -17
  26. package/dist/node-esm/test/batch_writes.test.d.ts +17 -17
  27. package/dist/node-esm/test/bootstrap.d.ts +17 -17
  28. package/dist/node-esm/test/bundle.test.d.ts +17 -17
  29. package/dist/node-esm/test/cursor.test.d.ts +17 -17
  30. package/dist/node-esm/test/database.test.d.ts +17 -17
  31. package/dist/node-esm/test/fields.test.d.ts +17 -17
  32. package/dist/node-esm/test/get_options.test.d.ts +17 -17
  33. package/dist/node-esm/test/numeric_transforms.test.d.ts +17 -17
  34. package/dist/node-esm/test/query.test.d.ts +17 -17
  35. package/dist/node-esm/test/server_timestamp.test.d.ts +17 -17
  36. package/dist/node-esm/test/smoke.test.d.ts +17 -17
  37. package/dist/node-esm/test/transactions.test.d.ts +17 -17
  38. package/dist/node-esm/test/type.test.d.ts +17 -17
  39. package/dist/node-esm/test/util/equality_matcher.d.ts +33 -33
  40. package/dist/node-esm/test/util/events_accumulator.d.ts +39 -39
  41. package/dist/node-esm/test/util/firebase_export.d.ts +29 -29
  42. package/dist/node-esm/test/util/helpers.d.ts +49 -49
  43. package/dist/node-esm/test/util/promise.d.ts +28 -28
  44. package/dist/node-esm/test/util/settings.d.ts +23 -23
  45. package/dist/node-esm/test/validation.test.d.ts +17 -17
  46. package/dist/src/api/blob.d.ts +29 -29
  47. package/dist/src/api/database.d.ts +228 -228
  48. package/dist/src/api/field_path.d.ts +36 -36
  49. package/dist/src/api/field_value.d.ts +29 -29
  50. package/dist/src/api/geo_point.d.ts +17 -17
  51. package/dist/src/api/observer.d.ts +29 -29
  52. package/dist/src/api/timestamp.d.ts +17 -17
  53. package/dist/src/config.d.ts +28 -28
  54. package/dist/src/index.console.d.ts +48 -48
  55. package/dist/src/index.d.ts +117 -85
  56. package/dist/src/index.node.d.ts +22 -22
  57. package/dist/src/index.rn.d.ts +22 -22
  58. package/dist/src/register-module.d.ts +42 -42
  59. package/dist/src/util/input_validation.d.ts +18 -18
  60. package/dist/test/array_transforms.test.d.ts +17 -17
  61. package/dist/test/batch_writes.test.d.ts +17 -17
  62. package/dist/test/bootstrap.d.ts +17 -17
  63. package/dist/test/bundle.test.d.ts +17 -17
  64. package/dist/test/cursor.test.d.ts +17 -17
  65. package/dist/test/database.test.d.ts +17 -17
  66. package/dist/test/fields.test.d.ts +17 -17
  67. package/dist/test/get_options.test.d.ts +17 -17
  68. package/dist/test/numeric_transforms.test.d.ts +17 -17
  69. package/dist/test/query.test.d.ts +17 -17
  70. package/dist/test/server_timestamp.test.d.ts +17 -17
  71. package/dist/test/smoke.test.d.ts +17 -17
  72. package/dist/test/transactions.test.d.ts +17 -17
  73. package/dist/test/type.test.d.ts +17 -17
  74. package/dist/test/util/equality_matcher.d.ts +33 -33
  75. package/dist/test/util/events_accumulator.d.ts +39 -39
  76. package/dist/test/util/firebase_export.d.ts +29 -29
  77. package/dist/test/util/helpers.d.ts +49 -49
  78. package/dist/test/util/promise.d.ts +28 -28
  79. package/dist/test/util/settings.d.ts +23 -23
  80. package/dist/test/validation.test.d.ts +17 -17
  81. package/package.json +25 -23
  82. package/CHANGELOG.md +0 -330
  83. package/dist/index.esm2017.js.map +0 -1
  84. package/dist/index.esm5.js +0 -1196
  85. package/dist/index.esm5.js.map +0 -1
@@ -1,29 +1,29 @@
1
- /**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- import { FirestoreError } from '@firebase/firestore';
18
- /**
19
- * Observer/Subscribe interfaces.
20
- */
21
- export declare type NextFn<T> = (value: T) => void;
22
- export declare type ErrorFn = (error: FirestoreError) => void;
23
- export declare type CompleteFn = () => void;
24
- export interface PartialObserver<T> {
25
- next?: NextFn<T>;
26
- error?: ErrorFn;
27
- complete?: CompleteFn;
28
- }
29
- export declare function isPartialObserver<T>(obj: unknown): obj is PartialObserver<T>;
1
+ /**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { FirestoreError } from '@firebase/firestore';
18
+ /**
19
+ * Observer/Subscribe interfaces.
20
+ */
21
+ export type NextFn<T> = (value: T) => void;
22
+ export type ErrorFn = (error: FirestoreError) => void;
23
+ export type CompleteFn = () => void;
24
+ export interface PartialObserver<T> {
25
+ next?: NextFn<T>;
26
+ error?: ErrorFn;
27
+ complete?: CompleteFn;
28
+ }
29
+ export declare function isPartialObserver<T>(obj: unknown): obj is PartialObserver<T>;
@@ -1,17 +1,17 @@
1
- /**
2
- * @license
3
- * Copyright 2017 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 { Timestamp } from '@firebase/firestore';
1
+ /**
2
+ * @license
3
+ * Copyright 2017 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 { Timestamp } from '@firebase/firestore';
@@ -1,28 +1,28 @@
1
- /**
2
- * @license
3
- * Copyright 2021 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- import { FirebaseApp } from '@firebase/app-compat';
18
- import { FirebaseNamespace } from '@firebase/app-types';
19
- import { Firestore as ModularFirestore } from '@firebase/firestore';
20
- import { Firestore } from './api/database';
21
- /**
22
- * Configures Firestore as part of the Firebase SDK by calling registerComponent.
23
- *
24
- * @param firebase - The FirebaseNamespace to register Firestore with
25
- * @param firestoreFactory - A factory function that returns a new Firestore
26
- * instance.
27
- */
28
- export declare function configureForFirebase(firebase: FirebaseNamespace, firestoreFactory: (app: FirebaseApp, firestoreExp: ModularFirestore) => Firestore): void;
1
+ /**
2
+ * @license
3
+ * Copyright 2021 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { FirebaseApp } from '@firebase/app-compat';
18
+ import { FirebaseNamespace } from '@firebase/app-types';
19
+ import { Firestore as ModularFirestore } from '@firebase/firestore';
20
+ import { Firestore } from './api/database';
21
+ /**
22
+ * Configures Firestore as part of the Firebase SDK by calling registerComponent.
23
+ *
24
+ * @param firebase - The FirebaseNamespace to register Firestore with
25
+ * @param firestoreFactory - A factory function that returns a new Firestore
26
+ * instance.
27
+ */
28
+ export declare function configureForFirebase(firebase: FirebaseNamespace, firestoreFactory: (app: FirebaseApp, firestoreExp: ModularFirestore) => Firestore): void;
@@ -1,48 +1,48 @@
1
- /**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
18
- import { Provider } from '@firebase/component';
19
- import { Query as ExpQuery } from '@firebase/firestore';
20
- import { Compat } from '@firebase/util';
21
- import { Firestore as FirestoreCompat, PersistenceProvider } from './api/database';
22
- export { CollectionReference, DocumentReference, DocumentSnapshot, QuerySnapshot } from './api/database';
23
- export { Blob } from './api/blob';
24
- export { GeoPoint } from './api/geo_point';
25
- export { FieldPath } from './api/field_path';
26
- export { FieldValue } from './api/field_value';
27
- export { Timestamp } from './api/timestamp';
28
- export interface FirestoreDatabase {
29
- projectId: string;
30
- database?: string;
31
- }
32
- /**
33
- * The persistence provider included with the memory-only SDK. This provider
34
- * errors for all attempts to access persistence.
35
- */
36
- export declare class MemoryPersistenceProvider implements PersistenceProvider {
37
- enableIndexedDbPersistence(firestore: FirestoreCompat, forceOwnership: boolean): Promise<void>;
38
- enableMultiTabIndexedDbPersistence(firestore: Firestore): Promise<void>;
39
- clearIndexedDbPersistence(firestore: Firestore): Promise<void>;
40
- }
41
- /** Firestore class that exposes the constructor expected by the Console. */
42
- export declare class Firestore extends FirestoreCompat {
43
- constructor(firestoreDatabase: FirestoreDatabase, authProvider: Provider<FirebaseAuthInternalName>);
44
- INTERNAL: {
45
- delete: () => Promise<void>;
46
- count: (query: Compat<ExpQuery<unknown>>) => Promise<number>;
47
- };
48
- }
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
18
+ import { Provider } from '@firebase/component';
19
+ import { Query as ExpQuery } from '@firebase/firestore';
20
+ import { Compat } from '@firebase/util';
21
+ import { Firestore as FirestoreCompat, PersistenceProvider } from './api/database';
22
+ export { CollectionReference, DocumentReference, DocumentSnapshot, QuerySnapshot } from './api/database';
23
+ export { Blob } from './api/blob';
24
+ export { GeoPoint } from './api/geo_point';
25
+ export { FieldPath } from './api/field_path';
26
+ export { FieldValue } from './api/field_value';
27
+ export { Timestamp } from './api/timestamp';
28
+ export interface FirestoreDatabase {
29
+ projectId: string;
30
+ database?: string;
31
+ }
32
+ /**
33
+ * The persistence provider included with the memory-only SDK. This provider
34
+ * errors for all attempts to access persistence.
35
+ */
36
+ export declare class MemoryPersistenceProvider implements PersistenceProvider {
37
+ enableIndexedDbPersistence(firestore: FirestoreCompat, forceOwnership: boolean): Promise<void>;
38
+ enableMultiTabIndexedDbPersistence(firestore: Firestore): Promise<void>;
39
+ clearIndexedDbPersistence(firestore: Firestore): Promise<void>;
40
+ }
41
+ /** Firestore class that exposes the constructor expected by the Console. */
42
+ export declare class Firestore extends FirestoreCompat {
43
+ constructor(firestoreDatabase: FirestoreDatabase, authProvider: Provider<FirebaseAuthInternalName>);
44
+ INTERNAL: {
45
+ delete: () => Promise<void>;
46
+ count: (query: Compat<ExpQuery<unknown>>) => Promise<number>;
47
+ };
48
+ }
@@ -1,126 +1,158 @@
1
- /**
2
- * @license
3
- * Copyright 2020 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- import type { FirebaseNamespace } from '@firebase/app-types';
18
- import * as types from '@firebase/firestore-types';
19
- import './register-module';
20
- /**
21
- * Registers the main Firestore build with the components framework.
22
- * Persistence can be enabled via `firebase.firestore().enablePersistence()`.
23
- */
24
- export declare function registerFirestore(instance: FirebaseNamespace): void;
25
- declare module '@firebase/app-compat' {
26
- interface FirebaseNamespace {
27
- firestore: {
28
- (app?: FirebaseApp): types.FirebaseFirestore;
29
- Blob: typeof types.Blob;
30
- CollectionReference: typeof types.CollectionReference;
31
- DocumentReference: typeof types.DocumentReference;
32
- DocumentSnapshot: typeof types.DocumentSnapshot;
33
- FieldPath: typeof types.FieldPath;
34
- FieldValue: typeof types.FieldValue;
35
- Firestore: typeof types.FirebaseFirestore;
36
- GeoPoint: typeof types.GeoPoint;
37
- Query: typeof types.Query;
38
- QueryDocumentSnapshot: typeof types.QueryDocumentSnapshot;
39
- QuerySnapshot: typeof types.QuerySnapshot;
40
- Timestamp: typeof types.Timestamp;
41
- Transaction: typeof types.Transaction;
42
- WriteBatch: typeof types.WriteBatch;
43
- setLogLevel: typeof types.setLogLevel;
44
- };
45
- }
46
- interface FirebaseApp {
47
- firestore?(): types.FirebaseFirestore;
48
- }
49
- }
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import type { FirebaseNamespace } from '@firebase/app-types';
18
+ import * as types from '@firebase/firestore-types';
19
+ import './register-module';
20
+ /**
21
+ * Registers the main Firestore build with the components framework.
22
+ * Persistence can be enabled via `firebase.firestore().enablePersistence()`.
23
+ */
24
+ export declare function registerFirestore(instance: FirebaseNamespace): void;
25
+ declare module '@firebase/app-compat' {
26
+ interface FirebaseNamespace {
27
+ firestore: {
28
+ (app?: FirebaseApp): types.FirebaseFirestore;
29
+ Blob: typeof types.Blob;
30
+ CollectionReference: typeof types.CollectionReference;
31
+ DocumentReference: typeof types.DocumentReference;
32
+ DocumentSnapshot: typeof types.DocumentSnapshot;
33
+ FieldPath: typeof types.FieldPath;
34
+ FieldValue: typeof types.FieldValue;
35
+ Firestore: typeof types.FirebaseFirestore;
36
+ GeoPoint: typeof types.GeoPoint;
37
+ Query: typeof types.Query;
38
+ QueryDocumentSnapshot: typeof types.QueryDocumentSnapshot;
39
+ QuerySnapshot: typeof types.QuerySnapshot;
40
+ Timestamp: typeof types.Timestamp;
41
+ Transaction: typeof types.Transaction;
42
+ WriteBatch: typeof types.WriteBatch;
43
+ setLogLevel: typeof types.setLogLevel;
44
+ };
45
+ }
46
+ interface FirebaseApp {
47
+ firestore?(): types.FirebaseFirestore;
48
+ }
49
+ }
50
50
 
51
51
  import { FirebaseApp as FirebaseAppCompat } from "@firebase/app-compat";
52
- import { type WithFieldValue, type DocumentReference, type CollectionReference, type DocumentData, type Query, type EmulatorMockTokenOptions, type PersistenceSettings, type AggregateQuerySnapshot, type AggregateField, type DocumentSnapshot, type QuerySnapshot, type Firestore, type FirestoreSettings, type LoadBundleTask, type FirestoreError, type Unsubscribe, type SnapshotListenOptions, type QueryConstraint, type Transaction, type TransactionOptions, type PartialWithFieldValue, type SetOptions, type IndexConfiguration, type UpdateData, type FieldPath, type WriteBatch } from "@firebase/firestore";
52
+ import { type DocumentData, type WithFieldValue, type DocumentReference, type CollectionReference, type Query, type EmulatorMockTokenOptions, type DocumentSnapshot, type FirestoreDataConverter, type PersistenceSettings, type AggregateSpec, type AggregateQuerySnapshot, type AggregateField, type QuerySnapshot, type Firestore, type PersistentCacheIndexManager, type FirestoreSettings, type LoadBundleTask, type FirestoreError, type Unsubscribe, type SnapshotListenOptions, type QueryCompositeFilterConstraint, type QueryNonFilterConstraint, type QueryConstraint, type Transaction, type TransactionOptions, type PartialWithFieldValue, type SetOptions, type IndexConfiguration, type UpdateData, type FieldPath, type WriteBatch } from "@firebase/firestore";
53
53
  declare module "@firebase/firestore" {
54
- function addDoc<T>(reference: types.CollectionReference<T>, data: WithFieldValue<T>): Promise<DocumentReference<T>>;
54
+ function addDoc<AppModelType, DbModelType extends DocumentData>(reference: types.CollectionReference<AppModelType, DbModelType>, data: WithFieldValue<AppModelType>): Promise<DocumentReference<AppModelType, DbModelType>>;
55
55
  function clearIndexedDbPersistence(firestore: types.FirebaseFirestore): Promise<void>;
56
- function collection(firestore: types.FirebaseFirestore, path: string, ...pathSegments: string[]): CollectionReference<DocumentData>;
57
- function collection(reference: types.CollectionReference<unknown>, path: string, ...pathSegments: string[]): CollectionReference<DocumentData>;
58
- function collection(reference: types.DocumentReference, path: string, ...pathSegments: string[]): CollectionReference<DocumentData>;
59
- function collectionGroup(firestore: types.FirebaseFirestore, collectionId: string): Query<DocumentData>;
56
+ function collection(firestore: types.FirebaseFirestore, path: string, ...pathSegments: string[]): CollectionReference<DocumentData, DocumentData>;
57
+ function collection<AppModelType, DbModelType extends DocumentData>(reference: types.CollectionReference<AppModelType, DbModelType>, path: string, ...pathSegments: string[]): CollectionReference<DocumentData, DocumentData>;
58
+ function collection<AppModelType, DbModelType extends DocumentData>(reference: types.DocumentReference<AppModelType, DbModelType>, path: string, ...pathSegments: string[]): CollectionReference<DocumentData, DocumentData>;
59
+ function collectionGroup(firestore: types.FirebaseFirestore, collectionId: string): Query<DocumentData, DocumentData>;
60
60
  function connectFirestoreEmulator(firestore: types.FirebaseFirestore, host: string, port: number, options?: {
61
61
  mockUserToken?: EmulatorMockTokenOptions | string;
62
62
  }): void;
63
- function deleteDoc(reference: types.DocumentReference<unknown>): Promise<void>;
63
+ function deleteDoc<AppModelType, DbModelType extends DocumentData>(reference: types.DocumentReference<AppModelType, DbModelType>): Promise<void>;
64
64
  function disableNetwork(firestore: types.FirebaseFirestore): Promise<void>;
65
- function doc(firestore: types.FirebaseFirestore, path: string, ...pathSegments: string[]): DocumentReference<DocumentData>;
66
- function doc<T>(reference: types.CollectionReference<T>, path?: string, ...pathSegments: string[]): DocumentReference<T>;
67
- function doc(reference: types.DocumentReference<unknown>, path: string, ...pathSegments: string[]): DocumentReference<DocumentData>;
65
+ function doc(firestore: types.FirebaseFirestore, path: string, ...pathSegments: string[]): DocumentReference<DocumentData, DocumentData>;
66
+ function doc<AppModelType, DbModelType extends DocumentData>(reference: types.CollectionReference<AppModelType, DbModelType>, path?: string, ...pathSegments: string[]): DocumentReference<AppModelType, DbModelType>;
67
+ function doc<AppModelType, DbModelType extends DocumentData>(reference: types.DocumentReference<AppModelType, DbModelType>, path: string, ...pathSegments: string[]): DocumentReference<DocumentData, DocumentData>;
68
+ function documentSnapshotFromJSON(db: types.FirebaseFirestore, json: object): DocumentSnapshot;
69
+ function documentSnapshotFromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: types.FirebaseFirestore, json: object, converter: FirestoreDataConverter<AppModelType, DbModelType>): DocumentSnapshot<AppModelType, DbModelType>;
68
70
  function enableIndexedDbPersistence(firestore: types.FirebaseFirestore, persistenceSettings?: PersistenceSettings): Promise<void>;
69
71
  function enableMultiTabIndexedDbPersistence(firestore: types.FirebaseFirestore): Promise<void>;
70
72
  function enableNetwork(firestore: types.FirebaseFirestore): Promise<void>;
71
- function getCountFromServer(query: types.Query<unknown>): Promise<AggregateQuerySnapshot<{
73
+ function getAggregateFromServer<AggregateSpecType extends AggregateSpec, AppModelType, DbModelType extends DocumentData>(query: types.Query<AppModelType, DbModelType>, aggregateSpec: AggregateSpecType): Promise<AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>>;
74
+ function getCountFromServer<AppModelType, DbModelType extends DocumentData>(query: types.Query<AppModelType, DbModelType>): Promise<AggregateQuerySnapshot<{
72
75
  count: AggregateField<number>;
73
- }>>;
74
- function getDoc<T>(reference: types.DocumentReference<T>): Promise<DocumentSnapshot<T>>;
75
- function getDocFromCache<T>(reference: types.DocumentReference<T>): Promise<DocumentSnapshot<T>>;
76
- function getDocFromServer<T>(reference: types.DocumentReference<T>): Promise<DocumentSnapshot<T>>;
77
- function getDocs<T>(query: types.Query<T>): Promise<QuerySnapshot<T>>;
78
- function getDocsFromCache<T>(query: types.Query<T>): Promise<QuerySnapshot<T>>;
79
- function getDocsFromServer<T>(query: types.Query<T>): Promise<QuerySnapshot<T>>;
76
+ }, AppModelType, DbModelType>>;
77
+ function getDoc<AppModelType, DbModelType extends DocumentData>(reference: types.DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>;
78
+ function getDocFromCache<AppModelType, DbModelType extends DocumentData>(reference: types.DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>;
79
+ function getDocFromServer<AppModelType, DbModelType extends DocumentData>(reference: types.DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>;
80
+ function getDocs<AppModelType, DbModelType extends DocumentData>(query: types.Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>>;
81
+ function getDocsFromCache<AppModelType, DbModelType extends DocumentData>(query: types.Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>>;
82
+ function getDocsFromServer<AppModelType, DbModelType extends DocumentData>(query: types.Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>>;
80
83
  function getFirestore(app: FirebaseAppCompat): Firestore;
84
+ function getFirestore(app: FirebaseAppCompat, databaseId: string): Firestore;
85
+ function getPersistentCacheIndexManager(firestore: types.FirebaseFirestore): PersistentCacheIndexManager | null;
81
86
  function initializeFirestore(app: FirebaseAppCompat, settings: FirestoreSettings, databaseId?: string): Firestore;
82
87
  function loadBundle(firestore: types.FirebaseFirestore, bundleData: ReadableStream<Uint8Array> | ArrayBuffer | string): LoadBundleTask;
83
88
  function namedQuery(firestore: types.FirebaseFirestore, name: string): Promise<Query | null>;
84
- function onSnapshot<T>(reference: types.DocumentReference<T>, observer: {
85
- next?: (snapshot: DocumentSnapshot<T>) => void;
89
+ function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: types.DocumentReference<AppModelType, DbModelType>, observer: {
90
+ next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
86
91
  error?: (error: FirestoreError) => void;
87
92
  complete?: () => void;
88
93
  }): Unsubscribe;
89
- function onSnapshot<T>(reference: types.DocumentReference<T>, options: SnapshotListenOptions, observer: {
90
- next?: (snapshot: DocumentSnapshot<T>) => void;
94
+ function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: types.DocumentReference<AppModelType, DbModelType>, options: SnapshotListenOptions, observer: {
95
+ next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
91
96
  error?: (error: FirestoreError) => void;
92
97
  complete?: () => void;
93
98
  }): Unsubscribe;
94
- function onSnapshot<T>(reference: types.DocumentReference<T>, onNext: (snapshot: DocumentSnapshot<T>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe;
95
- function onSnapshot<T>(reference: types.DocumentReference<T>, options: SnapshotListenOptions, onNext: (snapshot: DocumentSnapshot<T>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe;
96
- function onSnapshot<T>(query: types.Query<T>, observer: {
97
- next?: (snapshot: QuerySnapshot<T>) => void;
99
+ function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: types.DocumentReference<AppModelType, DbModelType>, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe;
100
+ function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: types.DocumentReference<AppModelType, DbModelType>, options: SnapshotListenOptions, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe;
101
+ function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: types.Query<AppModelType, DbModelType>, observer: {
102
+ next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
98
103
  error?: (error: FirestoreError) => void;
99
104
  complete?: () => void;
100
105
  }): Unsubscribe;
101
- function onSnapshot<T>(query: types.Query<T>, options: SnapshotListenOptions, observer: {
102
- next?: (snapshot: QuerySnapshot<T>) => void;
106
+ function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: types.Query<AppModelType, DbModelType>, options: SnapshotListenOptions, observer: {
107
+ next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
103
108
  error?: (error: FirestoreError) => void;
104
109
  complete?: () => void;
105
110
  }): Unsubscribe;
106
- function onSnapshot<T>(query: types.Query<T>, onNext: (snapshot: QuerySnapshot<T>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe;
107
- function onSnapshot<T>(query: types.Query<T>, options: SnapshotListenOptions, onNext: (snapshot: QuerySnapshot<T>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe;
111
+ function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: types.Query<AppModelType, DbModelType>, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe;
112
+ function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: types.Query<AppModelType, DbModelType>, options: SnapshotListenOptions, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe;
113
+ function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: types.FirebaseFirestore, snapshotJson: object, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;
114
+ function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: types.FirebaseFirestore, snapshotJson: object, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;
115
+ function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: types.FirebaseFirestore, snapshotJson: object, options: SnapshotListenOptions, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;
116
+ function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: types.FirebaseFirestore, snapshotJson: object, options: SnapshotListenOptions, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;
117
+ function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: types.FirebaseFirestore, snapshotJson: object, observer: {
118
+ next: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
119
+ error?: (error: FirestoreError) => void;
120
+ complete?: () => void;
121
+ }, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;
122
+ function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: types.FirebaseFirestore, snapshotJson: object, observer: {
123
+ next: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
124
+ error?: (error: FirestoreError) => void;
125
+ complete?: () => void;
126
+ }, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;
127
+ function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: types.FirebaseFirestore, snapshotJson: object, options: SnapshotListenOptions, observer: {
128
+ next: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
129
+ error?: (error: FirestoreError) => void;
130
+ complete?: () => void;
131
+ }, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;
132
+ function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: types.FirebaseFirestore, snapshotJson: object, options: SnapshotListenOptions, observer: {
133
+ next: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
134
+ error?: (error: FirestoreError) => void;
135
+ complete?: () => void;
136
+ }, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;
108
137
  function onSnapshotsInSync(firestore: types.FirebaseFirestore, observer: {
109
138
  next?: (value: void) => void;
110
139
  error?: (error: FirestoreError) => void;
111
140
  complete?: () => void;
112
141
  }): Unsubscribe;
113
142
  function onSnapshotsInSync(firestore: types.FirebaseFirestore, onSync: () => void): Unsubscribe;
114
- function query<T>(query: types.Query<T>, ...queryConstraints: QueryConstraint[]): Query<T>;
115
- function queryEqual<T>(left: types.Query<T>, right: types.Query<T>): boolean;
143
+ function query<AppModelType, DbModelType extends DocumentData>(query: types.Query<AppModelType, DbModelType>, compositeFilter: QueryCompositeFilterConstraint, ...queryConstraints: QueryNonFilterConstraint[]): Query<AppModelType, DbModelType>;
144
+ function query<AppModelType, DbModelType extends DocumentData>(query: types.Query<AppModelType, DbModelType>, ...queryConstraints: QueryConstraint[]): Query<AppModelType, DbModelType>;
145
+ function queryEqual<AppModelType, DbModelType extends DocumentData>(left: types.Query<AppModelType, DbModelType>, right: types.Query<AppModelType, DbModelType>): boolean;
146
+ function querySnapshotFromJSON(db: types.FirebaseFirestore, json: object): QuerySnapshot;
147
+ function querySnapshotFromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: types.FirebaseFirestore, json: object, converter: FirestoreDataConverter<AppModelType, DbModelType>): QuerySnapshot<AppModelType, DbModelType>;
116
148
  function runTransaction<T>(firestore: types.FirebaseFirestore, updateFunction: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
117
- function setDoc<T>(reference: types.DocumentReference<T>, data: WithFieldValue<T>): Promise<void>;
118
- function setDoc<T>(reference: types.DocumentReference<T>, data: PartialWithFieldValue<T>, options: SetOptions): Promise<void>;
149
+ function setDoc<AppModelType, DbModelType extends DocumentData>(reference: types.DocumentReference<AppModelType, DbModelType>, data: WithFieldValue<AppModelType>): Promise<void>;
150
+ function setDoc<AppModelType, DbModelType extends DocumentData>(reference: types.DocumentReference<AppModelType, DbModelType>, data: PartialWithFieldValue<AppModelType>, options: SetOptions): Promise<void>;
119
151
  function setIndexConfiguration(firestore: types.FirebaseFirestore, configuration: IndexConfiguration): Promise<void>;
120
152
  function setIndexConfiguration(firestore: types.FirebaseFirestore, json: string): Promise<void>;
121
153
  function terminate(firestore: types.FirebaseFirestore): Promise<void>;
122
- function updateDoc<T>(reference: types.DocumentReference<T>, data: UpdateData<T>): Promise<void>;
123
- function updateDoc(reference: types.DocumentReference<unknown>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): Promise<void>;
154
+ function updateDoc<AppModelType, DbModelType extends DocumentData>(reference: types.DocumentReference<AppModelType, DbModelType>, data: UpdateData<DbModelType>): Promise<void>;
155
+ function updateDoc<AppModelType, DbModelType extends DocumentData>(reference: types.DocumentReference<AppModelType, DbModelType>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): Promise<void>;
124
156
  function waitForPendingWrites(firestore: types.FirebaseFirestore): Promise<void>;
125
157
  function writeBatch(firestore: types.FirebaseFirestore): WriteBatch;
126
158
  }
@@ -1,22 +1,22 @@
1
- /**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- import { FirebaseNamespace } from '@firebase/app-types';
18
- /**
19
- * Registers the main Firestore Node build with the components framework.
20
- * Persistence can be enabled via `firebase.firestore().enablePersistence()`.
21
- */
22
- export declare function registerFirestore(instance: FirebaseNamespace): void;
1
+ /**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { FirebaseNamespace } from '@firebase/app-types';
18
+ /**
19
+ * Registers the main Firestore Node build with the components framework.
20
+ * Persistence can be enabled via `firebase.firestore().enablePersistence()`.
21
+ */
22
+ export declare function registerFirestore(instance: FirebaseNamespace): void;
@@ -1,22 +1,22 @@
1
- /**
2
- * @license
3
- * Copyright 2020 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- import { FirebaseNamespace } from '@firebase/app-types';
18
- /**
19
- * Registers the main Firestore ReactNative build with the components framework.
20
- * Persistence can be enabled via `firebase.firestore().enablePersistence()`.
21
- */
22
- export declare function registerFirestore(instance: FirebaseNamespace): void;
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { FirebaseNamespace } from '@firebase/app-types';
18
+ /**
19
+ * Registers the main Firestore ReactNative build with the components framework.
20
+ * Persistence can be enabled via `firebase.firestore().enablePersistence()`.
21
+ */
22
+ export declare function registerFirestore(instance: FirebaseNamespace): void;