Skip to content

Commit bd06146

Browse files
Merge main into release
2 parents a058309 + 86155b3 commit bd06146

File tree

75 files changed

+4505
-258
lines changed

Some content is hidden

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

75 files changed

+4505
-258
lines changed

.changeset/brave-boats-arrive.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@firebase/remote-config': patch
3+
'@firebase/analytics': patch
4+
'firebase': patch
5+
---
6+
7+
Add rollup config to generate modular typings for google3

.changeset/brown-pens-confess.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@firebase/storage": patch
3+
"@firebase/util": patch
4+
---
5+
6+
Fixed issue where Storage on Firebase Studio throws CORS errors.

.changeset/giant-lamps-live.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/app': patch
3+
---
4+
5+
Add "react-native" entry point to @firebase/app

.changeset/long-pets-sell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/firestore': patch
3+
---
4+
5+
Internal listener registration change for IndexedDB "versionchange" events.

.changeset/moody-comics-speak.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@firebase/firestore': minor
3+
'firebase': minor
4+
---
5+
6+
Added support for Firestore result types to be serialized with `toJSON` and then deserialized with `fromJSON` methods on the objects.
7+
8+
Addeed support to resume `onSnapshot` listeners in the CSR phase based on serialized `DataSnapshot`s and `QuerySnapshot`s built in the SSR phase.

.changeset/old-candles-confess.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/ai': patch
3+
---
4+
5+
Add deprecation label to `totalBillableCharacters`. `totalTokens` should be used instead.

common/api-review/ai.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ export interface CountTokensRequest {
164164
// @public
165165
export interface CountTokensResponse {
166166
promptTokensDetails?: ModalityTokenCount[];
167+
// @deprecated (undocumented)
167168
totalBillableCharacters?: number;
168169
totalTokens: number;
169170
}

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ export function average(field: string | FieldPath): AggregateField<number | null
6868
// @public
6969
export class Bytes {
7070
static fromBase64String(base64: string): Bytes;
71+
static fromJSON(json: object): Bytes;
7172
static fromUint8Array(array: Uint8Array): Bytes;
7273
isEqual(other: Bytes): boolean;
7374
toBase64(): string;
75+
toJSON(): object;
7476
toString(): string;
7577
toUint8Array(): Uint8Array;
7678
}
@@ -135,9 +137,12 @@ export function documentId(): FieldPath;
135137
export class DocumentReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> {
136138
readonly converter: FirestoreDataConverter<AppModelType, DbModelType> | null;
137139
readonly firestore: Firestore;
140+
static fromJSON(firestore: Firestore, json: object): DocumentReference;
141+
static fromJSON<NewAppModelType = DocumentData, NewDbModelType extends DocumentData = DocumentData>(firestore: Firestore, json: object, converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
138142
get id(): string;
139143
get parent(): CollectionReference<AppModelType, DbModelType>;
140144
get path(): string;
145+
toJSON(): object;
141146
readonly type = "document";
142147
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
143148
withConverter(converter: null): DocumentReference<DocumentData, DocumentData>;
@@ -205,12 +210,14 @@ export type FirestoreErrorCode = 'cancelled' | 'unknown' | 'invalid-argument' |
205210
// @public
206211
export class GeoPoint {
207212
constructor(latitude: number, longitude: number);
213+
static fromJSON(json: object): GeoPoint;
208214
isEqual(other: GeoPoint): boolean;
209215
get latitude(): number;
210216
get longitude(): number;
211217
toJSON(): {
212218
latitude: number;
213219
longitude: number;
220+
type: string;
214221
};
215222
}
216223

@@ -416,6 +423,7 @@ export class Timestamp {
416423
seconds: number,
417424
nanoseconds: number);
418425
static fromDate(date: Date): Timestamp;
426+
static fromJSON(json: object): Timestamp;
419427
static fromMillis(milliseconds: number): Timestamp;
420428
isEqual(other: Timestamp): boolean;
421429
readonly nanoseconds: number;
@@ -425,6 +433,7 @@ export class Timestamp {
425433
toJSON(): {
426434
seconds: number;
427435
nanoseconds: number;
436+
type: string;
428437
};
429438
toMillis(): number;
430439
toString(): string;
@@ -466,8 +475,10 @@ export function vector(values?: number[]): VectorValue;
466475
// @public
467476
export class VectorValue {
468477
/* Excluded from this release type: __constructor */
478+
static fromJSON(json: object): VectorValue;
469479
isEqual(other: VectorValue): boolean;
470480
toArray(): number[];
481+
toJSON(): object;
471482
}
472483

473484
// @public

common/api-review/firestore.api.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ export function average(field: string | FieldPath): AggregateField<number | null
6868
// @public
6969
export class Bytes {
7070
static fromBase64String(base64: string): Bytes;
71+
static fromJSON(json: object): Bytes;
7172
static fromUint8Array(array: Uint8Array): Bytes;
7273
isEqual(other: Bytes): boolean;
7374
toBase64(): string;
75+
toJSON(): object;
7476
toString(): string;
7577
toUint8Array(): Uint8Array;
7678
}
@@ -161,9 +163,12 @@ export function documentId(): FieldPath;
161163
export class DocumentReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> {
162164
readonly converter: FirestoreDataConverter<AppModelType, DbModelType> | null;
163165
readonly firestore: Firestore;
166+
static fromJSON(firestore: Firestore, json: object): DocumentReference;
167+
static fromJSON<NewAppModelType = DocumentData, NewDbModelType extends DocumentData = DocumentData>(firestore: Firestore, json: object, converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
164168
get id(): string;
165169
get parent(): CollectionReference<AppModelType, DbModelType>;
166170
get path(): string;
171+
toJSON(): object;
167172
readonly type = "document";
168173
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
169174
withConverter(converter: null): DocumentReference<DocumentData, DocumentData>;
@@ -178,8 +183,15 @@ export class DocumentSnapshot<AppModelType = DocumentData, DbModelType extends D
178183
get id(): string;
179184
readonly metadata: SnapshotMetadata;
180185
get ref(): DocumentReference<AppModelType, DbModelType>;
186+
toJSON(): object;
181187
}
182188

189+
// @public
190+
export function documentSnapshotFromJSON(db: Firestore, json: object): DocumentSnapshot;
191+
192+
// @public
193+
export function documentSnapshotFromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: Firestore, json: object, converter: FirestoreDataConverter<AppModelType, DbModelType>): DocumentSnapshot<AppModelType, DbModelType>;
194+
183195
export { EmulatorMockTokenOptions }
184196

185197
// @public @deprecated
@@ -264,12 +276,14 @@ export interface FirestoreSettings {
264276
// @public
265277
export class GeoPoint {
266278
constructor(latitude: number, longitude: number);
279+
static fromJSON(json: object): GeoPoint;
267280
isEqual(other: GeoPoint): boolean;
268281
get latitude(): number;
269282
get longitude(): number;
270283
toJSON(): {
271284
latitude: number;
272285
longitude: number;
286+
type: string;
273287
};
274288
}
275289

@@ -459,6 +473,46 @@ export function onSnapshot<AppModelType, DbModelType extends DocumentData>(query
459473
// @public
460474
export function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, options: SnapshotListenOptions, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe;
461475

476+
// @public
477+
export function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;
478+
479+
// @public
480+
export function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;
481+
482+
// @public
483+
export function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, options: SnapshotListenOptions, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;
484+
485+
// @public
486+
export function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, options: SnapshotListenOptions, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;
487+
488+
// @public
489+
export function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, observer: {
490+
next: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
491+
error?: (error: FirestoreError) => void;
492+
complete?: () => void;
493+
}, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;
494+
495+
// @public
496+
export function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, observer: {
497+
next: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
498+
error?: (error: FirestoreError) => void;
499+
complete?: () => void;
500+
}, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;
501+
502+
// @public
503+
export function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, options: SnapshotListenOptions, observer: {
504+
next: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
505+
error?: (error: FirestoreError) => void;
506+
complete?: () => void;
507+
}, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;
508+
509+
// @public
510+
export function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, options: SnapshotListenOptions, observer: {
511+
next: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
512+
error?: (error: FirestoreError) => void;
513+
complete?: () => void;
514+
}, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;
515+
462516
// @public
463517
export function onSnapshotsInSync(firestore: Firestore, observer: {
464518
next?: (value: void) => void;
@@ -610,8 +664,15 @@ export class QuerySnapshot<AppModelType = DocumentData, DbModelType extends Docu
610664
readonly metadata: SnapshotMetadata;
611665
readonly query: Query<AppModelType, DbModelType>;
612666
get size(): number;
667+
toJSON(): object;
613668
}
614669

670+
// @public
671+
export function querySnapshotFromJSON(db: Firestore, json: object): QuerySnapshot;
672+
673+
// @public
674+
export function querySnapshotFromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: Firestore, json: object, converter: FirestoreDataConverter<AppModelType, DbModelType>): QuerySnapshot<AppModelType, DbModelType>;
675+
615676
// @public
616677
export class QueryStartAtConstraint extends QueryConstraint {
617678
readonly type: 'startAt' | 'startAfter';
@@ -696,6 +757,7 @@ export class Timestamp {
696757
seconds: number,
697758
nanoseconds: number);
698759
static fromDate(date: Date): Timestamp;
760+
static fromJSON(json: object): Timestamp;
699761
static fromMillis(milliseconds: number): Timestamp;
700762
isEqual(other: Timestamp): boolean;
701763
readonly nanoseconds: number;
@@ -705,6 +767,7 @@ export class Timestamp {
705767
toJSON(): {
706768
seconds: number;
707769
nanoseconds: number;
770+
type: string;
708771
};
709772
toMillis(): number;
710773
toString(): string;
@@ -751,8 +814,10 @@ export function vector(values?: number[]): VectorValue;
751814
// @public
752815
export class VectorValue {
753816
/* Excluded from this release type: __constructor */
817+
static fromJSON(json: object): VectorValue;
754818
isEqual(other: VectorValue): boolean;
755819
toArray(): number[];
820+
toJSON(): object;
756821
}
757822

758823
// @public

common/api-review/util.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export function isBrowserExtension(): boolean;
270270
export function isCloudflareWorker(): boolean;
271271

272272
// @public
273-
export function isCloudWorkstation(host: string): boolean;
273+
export function isCloudWorkstation(url: string): boolean;
274274

275275
// Warning: (ae-missing-release-tag) "isElectron" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
276276
//

docs-devsite/ai.counttokensresponse.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface CountTokensResponse
2323
| Property | Type | Description |
2424
| --- | --- | --- |
2525
| [promptTokensDetails](./ai.counttokensresponse.md#counttokensresponseprompttokensdetails) | [ModalityTokenCount](./ai.modalitytokencount.md#modalitytokencount_interface)<!-- -->\[\] | The breakdown, by modality, of how many tokens are consumed by the prompt. |
26-
| [totalBillableCharacters](./ai.counttokensresponse.md#counttokensresponsetotalbillablecharacters) | number | The total number of billable characters counted across all instances from the request.<!-- -->This property is only supported when using the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)<!-- -->). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)<!-- -->), this property is not supported and will default to 0. |
26+
| [totalBillableCharacters](./ai.counttokensresponse.md#counttokensresponsetotalbillablecharacters) | number | |
2727
| [totalTokens](./ai.counttokensresponse.md#counttokensresponsetotaltokens) | number | The total number of tokens counted across all instances from the request. |
2828

2929
## CountTokensResponse.promptTokensDetails
@@ -38,9 +38,12 @@ promptTokensDetails?: ModalityTokenCount[];
3838

3939
## CountTokensResponse.totalBillableCharacters
4040

41-
The total number of billable characters counted across all instances from the request.
42-
43-
This property is only supported when using the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)<!-- -->). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)<!-- -->), this property is not supported and will default to 0.
41+
> Warning: This API is now obsolete.
42+
>
43+
> Use `totalTokens` instead. This property is undefined when using models greater than `gemini-1.5-*`<!-- -->.
44+
>
45+
> The total number of billable characters counted across all instances from the request.
46+
>
4447

4548
<b>Signature:</b>
4649

docs-devsite/firestore_.bytes.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ export declare class Bytes
2323
| Method | Modifiers | Description |
2424
| --- | --- | --- |
2525
| [fromBase64String(base64)](./firestore_.bytes.md#bytesfrombase64string) | <code>static</code> | Creates a new <code>Bytes</code> object from the given Base64 string, converting it to bytes. |
26+
| [fromJSON(json)](./firestore_.bytes.md#bytesfromjson) | <code>static</code> | Builds a <code>Bytes</code> instance from a JSON object created by [Bytes.toJSON()](./firestore_.bytes.md#bytestojson)<!-- -->. |
2627
| [fromUint8Array(array)](./firestore_.bytes.md#bytesfromuint8array) | <code>static</code> | Creates a new <code>Bytes</code> object from the given Uint8Array. |
2728
| [isEqual(other)](./firestore_.bytes.md#bytesisequal) | | Returns true if this <code>Bytes</code> object is equal to the provided one. |
2829
| [toBase64()](./firestore_.bytes.md#bytestobase64) | | Returns the underlying bytes as a Base64-encoded string. |
30+
| [toJSON()](./firestore_.bytes.md#bytestojson) | | Returns a JSON-serializable representation of this <code>Bytes</code> instance. |
2931
| [toString()](./firestore_.bytes.md#bytestostring) | | Returns a string representation of the <code>Bytes</code> object. |
3032
| [toUint8Array()](./firestore_.bytes.md#bytestouint8array) | | Returns the underlying bytes in a new <code>Uint8Array</code>. |
3133

@@ -49,6 +51,28 @@ static fromBase64String(base64: string): Bytes;
4951

5052
[Bytes](./firestore_.bytes.md#bytes_class)
5153

54+
## Bytes.fromJSON()
55+
56+
Builds a `Bytes` instance from a JSON object created by [Bytes.toJSON()](./firestore_.bytes.md#bytestojson)<!-- -->.
57+
58+
<b>Signature:</b>
59+
60+
```typescript
61+
static fromJSON(json: object): Bytes;
62+
```
63+
64+
#### Parameters
65+
66+
| Parameter | Type | Description |
67+
| --- | --- | --- |
68+
| json | object | a JSON object represention of a <code>Bytes</code> instance |
69+
70+
<b>Returns:</b>
71+
72+
[Bytes](./firestore_.bytes.md#bytes_class)
73+
74+
an instance of [Bytes](./firestore_.bytes.md#bytes_class) if the JSON object could be parsed. Throws a [FirestoreError](./firestore_.firestoreerror.md#firestoreerror_class) if an error occurs.
75+
5276
## Bytes.fromUint8Array()
5377

5478
Creates a new `Bytes` object from the given Uint8Array.
@@ -106,6 +130,21 @@ string
106130

107131
The Base64-encoded string created from the `Bytes` object.
108132

133+
## Bytes.toJSON()
134+
135+
Returns a JSON-serializable representation of this `Bytes` instance.
136+
137+
<b>Signature:</b>
138+
139+
```typescript
140+
toJSON(): object;
141+
```
142+
<b>Returns:</b>
143+
144+
object
145+
146+
a JSON representation of this object.
147+
109148
## Bytes.toString()
110149

111150
Returns a string representation of the `Bytes` object.

0 commit comments

Comments
 (0)