@firebase/firestore 3.4.13 → 3.4.14-canary.04dcdbb0f

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 (102) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/firestore/src/api/credentials.d.ts +13 -3
  3. package/dist/firestore/src/api/database.d.ts +34 -3
  4. package/dist/firestore/src/api/index_configuration.d.ts +7 -8
  5. package/dist/firestore/src/api.d.ts +1 -1
  6. package/dist/firestore/src/core/database_info.d.ts +4 -0
  7. package/dist/firestore/src/lite-api/database.d.ts +51 -7
  8. package/dist/firestore/src/local/indexeddb_schema.d.ts +1 -3
  9. package/dist/firestore/src/local/local_store_impl.d.ts +2 -0
  10. package/dist/firestore/src/util/array.d.ts +18 -0
  11. package/dist/firestore/test/integration/api/provider.test.d.ts +17 -0
  12. package/dist/firestore/test/integration/util/firebase_export.d.ts +2 -1
  13. package/dist/firestore/test/integration/util/helpers.d.ts +1 -0
  14. package/dist/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
  15. package/dist/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
  16. package/dist/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
  17. package/dist/firestore/test/unit/specs/spec_builder.d.ts +5 -0
  18. package/dist/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
  19. package/dist/firestore/test/unit/util/array.test.d.ts +17 -0
  20. package/dist/index.d.ts +15 -4
  21. package/dist/index.esm2017.js +3793 -3646
  22. package/dist/index.esm2017.js.map +1 -1
  23. package/dist/index.esm5.js +3762 -3648
  24. package/dist/index.esm5.js.map +1 -1
  25. package/dist/index.node.cjs.js +295 -93
  26. package/dist/index.node.cjs.js.map +1 -1
  27. package/dist/index.node.mjs +295 -93
  28. package/dist/index.node.mjs.map +1 -1
  29. package/dist/index.rn.js +3732 -3586
  30. package/dist/index.rn.js.map +1 -1
  31. package/dist/internal.d.ts +53 -19
  32. package/dist/lite/firestore/src/api/credentials.d.ts +13 -3
  33. package/dist/lite/firestore/src/api/database.d.ts +34 -3
  34. package/dist/lite/firestore/src/api/index_configuration.d.ts +7 -8
  35. package/dist/lite/firestore/src/api.d.ts +1 -1
  36. package/dist/lite/firestore/src/core/database_info.d.ts +4 -0
  37. package/dist/lite/firestore/src/lite-api/database.d.ts +51 -7
  38. package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +1 -3
  39. package/dist/lite/firestore/src/local/local_store_impl.d.ts +2 -0
  40. package/dist/lite/firestore/src/util/array.d.ts +18 -0
  41. package/dist/lite/firestore/test/integration/api/provider.test.d.ts +17 -0
  42. package/dist/lite/firestore/test/integration/util/firebase_export.d.ts +2 -1
  43. package/dist/lite/firestore/test/integration/util/helpers.d.ts +1 -0
  44. package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
  45. package/dist/lite/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
  46. package/dist/lite/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
  47. package/dist/lite/firestore/test/unit/specs/spec_builder.d.ts +5 -0
  48. package/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
  49. package/dist/lite/firestore/test/unit/util/array.test.d.ts +17 -0
  50. package/dist/lite/index.browser.esm2017.js +273 -277
  51. package/dist/lite/index.browser.esm2017.js.map +1 -1
  52. package/dist/lite/index.browser.esm5.js +506 -493
  53. package/dist/lite/index.browser.esm5.js.map +1 -1
  54. package/dist/lite/index.d.ts +15 -4
  55. package/dist/lite/index.node.cjs.js +71 -61
  56. package/dist/lite/index.node.cjs.js.map +1 -1
  57. package/dist/lite/index.node.mjs +71 -61
  58. package/dist/lite/index.node.mjs.map +1 -1
  59. package/dist/lite/index.rn.esm2017.js +273 -277
  60. package/dist/lite/index.rn.esm2017.js.map +1 -1
  61. package/dist/lite/internal.d.ts +58 -7
  62. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +29 -66
  63. package/dist/lite/packages/firestore/src/api/credentials.d.ts +13 -3
  64. package/dist/lite/packages/firestore/src/api/database.d.ts +34 -3
  65. package/dist/lite/packages/firestore/src/api/index_configuration.d.ts +7 -8
  66. package/dist/lite/packages/firestore/src/api.d.ts +1 -1
  67. package/dist/lite/packages/firestore/src/core/database_info.d.ts +4 -0
  68. package/dist/lite/packages/firestore/src/lite-api/database.d.ts +51 -7
  69. package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +1 -3
  70. package/dist/lite/packages/firestore/src/local/local_store_impl.d.ts +2 -0
  71. package/dist/lite/packages/firestore/src/util/array.d.ts +18 -0
  72. package/dist/lite/packages/firestore/test/integration/api/provider.test.d.ts +17 -0
  73. package/dist/lite/packages/firestore/test/integration/util/firebase_export.d.ts +2 -1
  74. package/dist/lite/packages/firestore/test/integration/util/helpers.d.ts +1 -0
  75. package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
  76. package/dist/lite/packages/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
  77. package/dist/lite/packages/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
  78. package/dist/lite/packages/firestore/test/unit/specs/spec_builder.d.ts +5 -0
  79. package/dist/lite/packages/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
  80. package/dist/lite/packages/firestore/test/unit/util/array.test.d.ts +17 -0
  81. package/dist/lite/private.d.ts +25 -7
  82. package/dist/packages/firestore/dist/index.esm2017.d.ts +208 -203
  83. package/dist/packages/firestore/src/api/credentials.d.ts +13 -3
  84. package/dist/packages/firestore/src/api/database.d.ts +34 -3
  85. package/dist/packages/firestore/src/api/index_configuration.d.ts +7 -8
  86. package/dist/packages/firestore/src/api.d.ts +1 -1
  87. package/dist/packages/firestore/src/core/database_info.d.ts +4 -0
  88. package/dist/packages/firestore/src/lite-api/database.d.ts +51 -7
  89. package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +1 -3
  90. package/dist/packages/firestore/src/local/local_store_impl.d.ts +2 -0
  91. package/dist/packages/firestore/src/util/array.d.ts +18 -0
  92. package/dist/packages/firestore/test/integration/api/provider.test.d.ts +17 -0
  93. package/dist/packages/firestore/test/integration/util/firebase_export.d.ts +2 -1
  94. package/dist/packages/firestore/test/integration/util/helpers.d.ts +1 -0
  95. package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
  96. package/dist/packages/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
  97. package/dist/packages/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
  98. package/dist/packages/firestore/test/unit/specs/spec_builder.d.ts +5 -0
  99. package/dist/packages/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
  100. package/dist/packages/firestore/test/unit/util/array.test.d.ts +17 -0
  101. package/dist/private.d.ts +25 -8
  102. package/package.json +11 -9
@@ -17,6 +17,7 @@
17
17
  import { FirebaseApp } from '@firebase/app';
18
18
  import { Firestore } from '../../../src';
19
19
  import { PrivateSettings } from '../../../src/lite-api/settings';
20
- export declare function newTestFirestore(projectId: string, nameOrApp?: string | FirebaseApp, settings?: PrivateSettings): Firestore;
20
+ export declare function newTestApp(projectId: string, appName?: string): FirebaseApp;
21
+ export declare function newTestFirestore(app: FirebaseApp, settings?: PrivateSettings, dbName?: string): Firestore;
21
22
  export * from '../../../src';
22
23
  export { PrivateSettings };
@@ -37,6 +37,7 @@ export declare function withTestDb(persistence: boolean, fn: (db: Firestore) =>
37
37
  export declare function withAlternateTestDb(persistence: boolean, fn: (db: Firestore) => Promise<void>): Promise<void>;
38
38
  export declare function withTestDbs(persistence: boolean, numDbs: number, fn: (db: Firestore[]) => Promise<void>): Promise<void>;
39
39
  export declare function withTestDbsSettings(persistence: boolean, projectId: string, settings: PrivateSettings, numDbs: number, fn: (db: Firestore[]) => Promise<void>): Promise<void>;
40
+ export declare function withNamedTestDbsOrSkipUnlessUsingEmulator(persistence: boolean, dbNames: string[], fn: (db: Firestore[]) => Promise<void>): Promise<void>;
40
41
  export declare function withTestDoc(persistence: boolean, fn: (doc: DocumentReference, db: Firestore) => Promise<void>): Promise<void>;
41
42
  export declare function withTestDocAndSettings(persistence: boolean, settings: PrivateSettings, fn: (doc: DocumentReference) => Promise<void>): Promise<void>;
42
43
  export declare function withTestDocAndInitialData(persistence: boolean, initialData: DocumentData | null, fn: (doc: DocumentReference, db: Firestore) => Promise<void>): Promise<void>;
@@ -50,9 +50,20 @@ export declare class CountingQueryEngine extends QueryEngine {
50
50
  * and `getEntries()` APIs (since the last call to `resetCounts()`)
51
51
  */
52
52
  documentsReadByKey: number;
53
+ /**
54
+ * The number of documents returned by the OverlayCache's `getOverlays()`
55
+ * API (since the last call to `resetCounts()`)
56
+ */
57
+ overlaysReadByCollection: number;
58
+ /**
59
+ * The number of documents returned by the OverlayCache's `getOverlay()`
60
+ * APIs (since the last call to `resetCounts()`)
61
+ */
62
+ overlaysReadByKey: number;
53
63
  resetCounts(): void;
54
64
  getDocumentsMatchingQuery(transaction: PersistenceTransaction, query: Query, lastLimboFreeSnapshotVersion: SnapshotVersion, remoteKeys: DocumentKeySet): PersistencePromise<DocumentMap>;
55
65
  initialize(localDocuments: LocalDocumentsView, indexManager: IndexManager): void;
56
66
  private wrapRemoteDocumentCache;
57
67
  private wrapMutationQueue;
68
+ private wrapDocumentOverlayCache;
58
69
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 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 {};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 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,12 +14,14 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ import { IndexConfiguration } from '../../../src/api/index_configuration';
17
18
  import { Query } from '../../../src/core/query';
18
19
  import { Target } from '../../../src/core/target';
19
20
  import { TargetIdGenerator } from '../../../src/core/target_id_generator';
20
21
  import { TargetId } from '../../../src/core/types';
21
22
  import { Document } from '../../../src/model/document';
22
23
  import { DocumentKey } from '../../../src/model/document_key';
24
+ import { FieldIndex } from '../../../src/model/field_index';
23
25
  import { JsonObject } from '../../../src/model/object_value';
24
26
  import { TimerId } from '../../../src/util/async_queue';
25
27
  import { Code } from '../../../src/util/error';
@@ -113,6 +115,7 @@ export declare class SpecBuilder {
113
115
  userAddsSnapshotsInSyncListener(): this;
114
116
  userRemovesSnapshotsInSyncListener(): this;
115
117
  loadBundle(bundleContent: string): this;
118
+ setIndexConfiguration(jsonOrConfiguration: string | IndexConfiguration): this;
116
119
  becomeHidden(): this;
117
120
  becomeVisible(): this;
118
121
  runTimer(timerId: TimerId): this;
@@ -130,6 +133,8 @@ export declare class SpecBuilder {
130
133
  /** Stops failing database operations. */
131
134
  recoverDatabase(): this;
132
135
  expectIsShutdown(): this;
136
+ /** Expects indexes to exist (in any order) */
137
+ expectIndexes(indexes: FieldIndex[]): this;
133
138
  /** Overrides the currently expected set of active targets. */
134
139
  expectActiveTargets(...targets: Array<{
135
140
  query: Query;
@@ -14,8 +14,10 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ import { IndexConfiguration } from '../../../src/api/index_configuration';
17
18
  import { Query } from '../../../src/core/query';
18
19
  import { TargetId } from '../../../src/core/types';
20
+ import { FieldIndex } from '../../../src/model/field_index';
19
21
  import { JsonObject } from '../../../src/model/object_value';
20
22
  import { TestSnapshotVersion } from '../../util/helpers';
21
23
  import { ActiveTargetMap } from './spec_builder';
@@ -95,6 +97,10 @@ export interface SpecStep {
95
97
  waitForPendingWrites?: true;
96
98
  /** Fails the listed database actions. */
97
99
  failDatabase?: false | PersistenceAction[];
100
+ /**
101
+ * Set Index Configuration
102
+ */
103
+ setIndexConfiguration?: string | IndexConfiguration;
98
104
  /**
99
105
  * Run a queued timer task (without waiting for the delay to expire). See
100
106
  * TimerId enum definition for possible values).
@@ -306,5 +312,7 @@ export interface StateExpectation {
306
312
  acknowledgedDocs: string[];
307
313
  rejectedDocs: string[];
308
314
  };
315
+ /** Indexes */
316
+ indexes?: FieldIndex[];
309
317
  }
310
318
  export {};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 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 {};
@@ -123,6 +123,8 @@ declare interface AsyncQueue {
123
123
  verifyOperationInProgress(): void;
124
124
  }
125
125
 
126
+ declare type AuthTokenFactory = () => string;
127
+
126
128
  /**
127
129
  * Path represents an ordered sequence of string segments.
128
130
  */
@@ -854,18 +856,18 @@ declare abstract class Filter {
854
856
  export declare class Firestore implements FirestoreService {
855
857
  _authCredentials: CredentialsProvider<User>;
856
858
  _appCheckCredentials: CredentialsProvider<string>;
859
+ readonly _databaseId: DatabaseId;
860
+ readonly _app?: FirebaseApp | undefined;
857
861
  /**
858
862
  * Whether it's a Firestore or Firestore Lite instance.
859
863
  */
860
864
  type: 'firestore-lite' | 'firestore';
861
- readonly _databaseId: DatabaseId;
862
865
  readonly _persistenceKey: string;
863
866
  private _settings;
864
867
  private _settingsFrozen;
865
868
  private _terminateTask?;
866
- _app?: FirebaseApp;
867
869
  /** @hideconstructor */
868
- constructor(databaseIdOrApp: DatabaseId | FirebaseApp, _authCredentials: CredentialsProvider<User>, _appCheckCredentials: CredentialsProvider<string>);
870
+ constructor(_authCredentials: CredentialsProvider<User>, _appCheckCredentials: CredentialsProvider<string>, _databaseId: DatabaseId, _app?: FirebaseApp | undefined);
869
871
  /**
870
872
  * The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
871
873
  * instance.
@@ -1337,6 +1339,7 @@ declare interface FirstPartyCredentialsSettings {
1337
1339
  ['client']: unknown;
1338
1340
  ['sessionIndex']: string;
1339
1341
  ['iamToken']: string | null;
1342
+ ['authTokenFactory']: AuthTokenFactory | null;
1340
1343
  }
1341
1344
 
1342
1345
  /**
@@ -1429,15 +1432,28 @@ export declare function getDoc<T>(reference: DocumentReference<T>): Promise<Docu
1429
1432
  export declare function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
1430
1433
 
1431
1434
  /**
1432
- * Returns the existing `Firestore` instance that is associated with the
1435
+ * Returns the existing default {@link Firestore} instance that is associated with the
1436
+ * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
1437
+ * instance with default settings.
1438
+ *
1439
+ * @returns The {@link Firestore} instance of the provided app.
1440
+ */
1441
+ export declare function getFirestore(): Firestore;
1442
+
1443
+ /**
1444
+ * Returns the existing default {@link Firestore} instance that is associated with the
1433
1445
  * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
1434
1446
  * instance with default settings.
1435
1447
  *
1436
- * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
1448
+ * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
1437
1449
  * instance is associated with.
1438
- * @returns The `Firestore` instance of the provided app.
1450
+ * @returns The {@link Firestore} instance of the provided app.
1439
1451
  */
1440
- export declare function getFirestore(app?: FirebaseApp): Firestore;
1452
+ export declare function getFirestore(app: FirebaseApp): Firestore;
1453
+
1454
+ /* Excluded declaration from this release type: getFirestore */
1455
+
1456
+ /* Excluded declaration from this release type: getFirestore */
1441
1457
 
1442
1458
  /**
1443
1459
  * Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link
@@ -1477,6 +1493,8 @@ declare type IndexState = 'STATE_UNSPECIFIED' | 'CREATING' | 'READY' | 'ERROR';
1477
1493
  */
1478
1494
  export declare function initializeFirestore(app: FirebaseApp, settings: Settings): Firestore;
1479
1495
 
1496
+ /* Excluded declaration from this release type: initializeFirestore */
1497
+
1480
1498
  /**
1481
1499
  * Creates a {@link QueryConstraint} that only returns the first matching documents.
1482
1500
  *