Skip to content

Commit 9d918e6

Browse files
Merge master into release
2 parents 5b696de + de32c24 commit 9d918e6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2242
-67
lines changed

.changeset/hot-insects-wink.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/firestore': minor
3+
---
4+
5+
Implement count query for internal use.

.changeset/mighty-insects-judge.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@firebase/app': minor
3+
'@firebase/app-types': minor
4+
'@firebase/util': minor
5+
'@firebase/auth': patch
6+
'@firebase/database': patch
7+
'@firebase/firestore': patch
8+
'@firebase/functions': patch
9+
'@firebase/storage': patch
10+
'firebase': minor
11+
---
12+
13+
Add functionality to auto-initialize project config and emulator settings from global defaults provided by framework tooling.

.changeset/nine-cherries-swim.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/firestore': patch
3+
---
4+
5+
Fix a time travel issue across multiple tabs

.changeset/selfish-worms-glow.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/app-check': patch
3+
---
4+
5+
Fix timer issues in App Check that caused the token to fail to refresh after the token expired, or caused rapid repeated requests attempting to do so.

.changeset/wicked-tomatoes-grow.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/firestore': minor
3+
'firebase': minor
4+
---
5+
6+
Added `getCountFromServer()` (`getCount()` in the Lite SDK), which fetches the number of documents in the result set without actually downloading the documents.

common/api-review/app.api.md

+3
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ export function initializeApp(options: FirebaseOptions, name?: string): Firebase
9393
// @public
9494
export function initializeApp(options: FirebaseOptions, config?: FirebaseAppSettings): FirebaseApp;
9595

96+
// @public
97+
export function initializeApp(): FirebaseApp;
98+
9699
// @public
97100
export function onLog(logCallback: LogCallback | null, options?: LogOptions): void;
98101

common/api-review/firestore-lite.api.md

+34
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,35 @@ export type AddPrefixToKeys<Prefix extends string, T extends Record<string, unkn
1717
[K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
1818
};
1919

20+
// @public
21+
export class AggregateField<T> {
22+
type: string;
23+
}
24+
25+
// @public
26+
export type AggregateFieldType = AggregateField<number>;
27+
28+
// @public
29+
export class AggregateQuerySnapshot<T extends AggregateSpec> {
30+
data(): AggregateSpecData<T>;
31+
readonly query: Query<unknown>;
32+
readonly type = "AggregateQuerySnapshot";
33+
}
34+
35+
// @public
36+
export function aggregateQuerySnapshotEqual<T extends AggregateSpec>(left: AggregateQuerySnapshot<T>, right: AggregateQuerySnapshot<T>): boolean;
37+
38+
// @public
39+
export interface AggregateSpec {
40+
// (undocumented)
41+
[field: string]: AggregateFieldType;
42+
}
43+
44+
// @public
45+
export type AggregateSpecData<T extends AggregateSpec> = {
46+
[P in keyof T]: T[P] extends AggregateField<infer U> ? U : never;
47+
};
48+
2049
// @public
2150
export function arrayRemove(...elements: unknown[]): FieldValue;
2251

@@ -169,6 +198,11 @@ export class GeoPoint {
169198
};
170199
}
171200

201+
// @public
202+
export function getCount(query: Query<unknown>): Promise<AggregateQuerySnapshot<{
203+
count: AggregateField<number>;
204+
}>>;
205+
172206
// @public
173207
export function getDoc<T>(reference: DocumentReference<T>): Promise<DocumentSnapshot<T>>;
174208

common/api-review/firestore.api.md

+66-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,35 @@ export type AddPrefixToKeys<Prefix extends string, T extends Record<string, unkn
1717
[K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
1818
};
1919

20+
// @public
21+
export class AggregateField<T> {
22+
type: string;
23+
}
24+
25+
// @public
26+
export type AggregateFieldType = AggregateField<number>;
27+
28+
// @public
29+
export class AggregateQuerySnapshot<T extends AggregateSpec> {
30+
data(): AggregateSpecData<T>;
31+
readonly query: Query<unknown>;
32+
readonly type = "AggregateQuerySnapshot";
33+
}
34+
35+
// @public
36+
export function aggregateQuerySnapshotEqual<T extends AggregateSpec>(left: AggregateQuerySnapshot<T>, right: AggregateQuerySnapshot<T>): boolean;
37+
38+
// @public
39+
export interface AggregateSpec {
40+
// (undocumented)
41+
[field: string]: AggregateFieldType;
42+
}
43+
44+
// @public
45+
export type AggregateSpecData<T extends AggregateSpec> = {
46+
[P in keyof T]: T[P] extends AggregateField<infer U> ? U : never;
47+
};
48+
2049
// @public
2150
export function arrayRemove(...elements: unknown[]): FieldValue;
2251

@@ -209,6 +238,11 @@ export class GeoPoint {
209238
};
210239
}
211240

241+
// @public
242+
export function getCountFromServer(query: Query<unknown>): Promise<AggregateQuerySnapshot<{
243+
count: AggregateField<number>;
244+
}>>;
245+
212246
// @public
213247
export function getDoc<T>(reference: DocumentReference<T>): Promise<DocumentSnapshot<T>>;
214248

@@ -228,14 +262,38 @@ export function getDocsFromCache<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
228262
export function getDocsFromServer<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
229263

230264
// @public
231-
export function getFirestore(): Firestore;
265+
export function getFirestore(app: FirebaseApp): Firestore;
232266

233267
// @public
234-
export function getFirestore(app: FirebaseApp): Firestore;
268+
export function getFirestore(): Firestore;
235269

236270
// @public
237271
export function increment(n: number): FieldValue;
238272

273+
// @beta
274+
export interface Index {
275+
// (undocumented)
276+
[key: string]: unknown;
277+
readonly collectionGroup: string;
278+
readonly fields?: IndexField[];
279+
}
280+
281+
// @beta
282+
export interface IndexConfiguration {
283+
// (undocumented)
284+
[key: string]: unknown;
285+
readonly indexes?: Index[];
286+
}
287+
288+
// @beta
289+
export interface IndexField {
290+
// (undocumented)
291+
[key: string]: unknown;
292+
readonly arrayConfig?: 'CONTAINS';
293+
readonly fieldPath: string;
294+
readonly order?: 'ASCENDING' | 'DESCENDING';
295+
}
296+
239297
// @public
240298
export function initializeFirestore(app: FirebaseApp, settings: FirestoreSettings, databaseId?: string): Firestore;
241299

@@ -399,6 +457,12 @@ export function setDoc<T>(reference: DocumentReference<T>, data: WithFieldValue<
399457
// @public
400458
export function setDoc<T>(reference: DocumentReference<T>, data: PartialWithFieldValue<T>, options: SetOptions): Promise<void>;
401459

460+
// @beta
461+
export function setIndexConfiguration(firestore: Firestore, configuration: IndexConfiguration): Promise<void>;
462+
463+
// @beta
464+
export function setIndexConfiguration(firestore: Firestore, json: string): Promise<void>;
465+
402466
// @public
403467
export function setLogLevel(logLevel: LogLevel): void;
404468

common/api-review/util.api.md

+26
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,28 @@ export function errorPrefix(fnName: string, argName: string): string;
173173
// @public (undocumented)
174174
export type Executor<T> = (observer: Observer<T>) => void;
175175

176+
// @public
177+
export type ExperimentalKey = 'authTokenSyncURL' | 'authIdTokenMaxAge';
178+
176179
// Warning: (ae-missing-release-tag) "extractQuerystring" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
177180
//
178181
// @public
179182
export function extractQuerystring(url: string): string;
180183

184+
// @public
185+
export interface FirebaseDefaults {
186+
// (undocumented)
187+
[key: string]: unknown;
188+
// (undocumented)
189+
_authIdTokenMaxAge?: number;
190+
// (undocumented)
191+
_authTokenSyncURL?: string;
192+
// (undocumented)
193+
config?: Record<string, string>;
194+
// (undocumented)
195+
emulatorHosts?: Record<string, string>;
196+
}
197+
181198
// Warning: (ae-missing-release-tag) "FirebaseError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
182199
//
183200
// @public (undocumented)
@@ -195,6 +212,15 @@ export class FirebaseError extends Error {
195212
// @public
196213
export type FirebaseSignInProvider = 'custom' | 'email' | 'password' | 'phone' | 'anonymous' | 'google.com' | 'facebook.com' | 'github.com' | 'twitter.com' | 'microsoft.com' | 'apple.com';
197214

215+
// @public
216+
export const getDefaultAppConfig: () => Record<string, string> | undefined;
217+
218+
// @public
219+
export const getDefaultEmulatorHost: (productName: string) => string | undefined;
220+
221+
// @public
222+
export const getExperimentalSetting: <T extends ExperimentalKey>(name: T) => FirebaseDefaults[`_${T}`];
223+
198224
// Warning: (ae-missing-release-tag) "getGlobal" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
199225
//
200226
// @public

packages/app-check/src/indexeddb.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export function readTokenFromIndexedDB(
8080

8181
export function writeTokenToIndexedDB(
8282
app: FirebaseApp,
83-
token: AppCheckTokenInternal
83+
token?: AppCheckTokenInternal
8484
): Promise<void> {
8585
return write(computeKey(app), token);
8686
}

0 commit comments

Comments
 (0)