Skip to content

Mila/new types #9133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 93 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
0716bd7
Add new BSON types to public API (#330)
milaGGL Mar 10, 2025
3c743b2
Implement indexing for bson types (#331)
milaGGL Mar 11, 2025
82f32ca
rename BsonTimestampValue class to BsonTimestamp (#333)
milaGGL Mar 14, 2025
1df3d26
Fix Data Connect Types (#8898)
maneesht Apr 4, 2025
66a09f2
test(vertexai): update mock responses to v8 (#8904)
dlarocque Apr 8, 2025
b332825
Fix: display WebChannel error message (#8907)
milaGGL Apr 9, 2025
4e0f630
test(vertexai): add `backendName` param to mock response getters (#8906)
dlarocque Apr 9, 2025
ed0803a
fix: remove `null` value inclusion from `!=` and `not-in` filter resu…
milaGGL Apr 11, 2025
e055e90
Add assertion IDs that will be included in production log statements …
MarkDuckworth Apr 14, 2025
8bb66c2
docs(vertexai): remove HTML `<code>` tags (#8900)
dlarocque Apr 15, 2025
0cbff6b
test(vertexai): update developerapi mock response dir to googleai (#8…
dlarocque Apr 15, 2025
1363ecc
Fix languageCode parameter in action_code_url (#8912)
pashanka Apr 16, 2025
a0bcc9a
Merge main into release
google-oss-bot Apr 22, 2025
20b45d3
test(vertexai): update mock responses to v10 (#8959)
dlarocque Apr 23, 2025
b204e71
Version Packages (#8956)
google-oss-bot Apr 24, 2025
9952dbc
Merge branch 'release'
dlarocque Apr 24, 2025
fbf7222
Port BSON code updates from other sdks (#341)
milaGGL Apr 25, 2025
0e2558a
Improve the integration test coverage for online vs offline compariso…
ehsannas Apr 28, 2025
dd6a8f0
fix(vertexai): add missing quote to chat role error message (#8979)
dlarocque Apr 29, 2025
ea1f913
Auto Enable SSL for Firebase Studio (#8980)
maneesht Apr 29, 2025
0e12766
Add support for running the emulators in Cloud Workstation (#8968)
maneesht Apr 30, 2025
080a90d
Add Cookie Support For Firebase Studio (#8986)
maneesht May 1, 2025
ac59a1c
Remove FieldValue factory methods (#342)
milaGGL May 1, 2025
8cfdc53
Merge remote-tracking branch 'origin/main' into bson-feature
ehsannas May 2, 2025
4600a34
Create seven-actors-kneel.md
ehsannas May 2, 2025
136bb73
Merge main into release
google-oss-bot May 5, 2025
cbba951
resolve TODOs
milaGGL May 5, 2025
6a02778
Fix Auth Port for Firebase Studio (#8998)
maneesht May 5, 2025
3789b5a
Change automaticDataCollectionEnabled to default to true. (#8999)
hsubox76 May 7, 2025
f7ec278
Merge main into release
google-oss-bot May 7, 2025
d5428f3
Version Packages (#8997)
google-oss-bot May 7, 2025
51e7b48
Roll back #8999 (#9007)
hsubox76 May 7, 2025
9900a6a
Merge main into release
google-oss-bot May 7, 2025
f8334ea
Version Packages (#9008)
google-oss-bot May 7, 2025
050c1b6
fix(vertexai): pass `GenerativeModel`'s `BaseParams` to `ChatSession`…
dlarocque May 8, 2025
e99683b
feat(vertexai): Gemini multimodal output (#8922)
dlarocque May 8, 2025
88584fd
test: Clean up vscode launch file and add vertexai debug config (#9000)
dlarocque May 8, 2025
8a03143
Fix encoding of CSI keys in Safari (#8993)
MarkDuckworth May 9, 2025
6be75f7
Restore #8999 (#9010)
hsubox76 May 12, 2025
d5082f9
feat(ai): Migrate to `AI` and add GoogleAI support (#8931)
dlarocque May 12, 2025
72852e1
Add Emulator Overlay (#8977)
maneesht May 12, 2025
39505cc
Rename `@firebase/vertexai` package to `@firebase/ai` (#9011)
dlarocque May 12, 2025
8593fa0
Add Emulator Overlay (#8977) (#9031)
hsubox76 May 13, 2025
bf8c3d1
add temporary release branch (#9032)
hsubox76 May 13, 2025
f92069a
Allow custom branch for release (#9033)
hsubox76 May 13, 2025
3a203e6
Merge at-11-7-1 into release
google-oss-bot May 13, 2025
799de59
restore Vertex token for temp publish (#9036)
hsubox76 May 13, 2025
9338d9d
Version Packages (manual PR) (#9034)
hsubox76 May 14, 2025
9bcd1ea
Fixed scroll behavior (#9043)
maneesht May 14, 2025
1e91c24
Merge at-11-7-1 into release
google-oss-bot May 14, 2025
8601ecb
Version Packages (manual PR) (#9044)
hsubox76 May 14, 2025
a5bacaf
Merge branch 'release' into ch-release-merge
hsubox76 May 15, 2025
5b53905
Remove redundant changeset
hsubox76 May 15, 2025
3d9291f
Merge pull request #9049 from firebase/ch-release-merge
hsubox76 May 15, 2025
880110b
Update e2e tests to reflect AI package and new API (#9017)
hsubox76 May 15, 2025
e4297f7
Merge main into release
google-oss-bot May 15, 2025
2fe7547
Version Packages (#9016)
google-oss-bot May 20, 2025
35ad526
Revert "Fixed scroll behavior (#8977)" (#9053)
maneesht May 20, 2025
e96410a
Merge main into release
google-oss-bot May 20, 2025
b5df4ae
Updated to only show banner when calling connect*Emulator (#9055)
maneesht May 21, 2025
4ead831
Merge main into release
google-oss-bot May 21, 2025
770e455
Version Packages (#9054)
google-oss-bot May 22, 2025
9964849
Close webchannel instances on terminate (#9041)
MarkDuckworth May 22, 2025
d5e5795
Reorder reporters to prevent log message duplication in CI (#9040)
MarkDuckworth May 22, 2025
ec91a86
docs(ai): Fix 'occured' typo in error codes (#9021)
dlarocque May 27, 2025
8cb21ff
feat(ai): Add `HarmBlockThreshold.OFF` (#9050)
dlarocque May 27, 2025
40be2db
feat(ai): Schema `title`, `maximum`, `minimum`, and `propertyOrdering…
dlarocque May 27, 2025
1933324
feat(ai): Add support for `minItems` and `maxItems` to `Schema` (#9026)
dlarocque May 28, 2025
af9f8b5
Build out e2e subdirectories (#9065)
hsubox76 May 30, 2025
30de503
Added test project to fdc (#8924)
maneesht May 30, 2025
9be10d9
Merge main into release
google-oss-bot Jun 3, 2025
89051ca
Version Packages (#9073)
google-oss-bot Jun 5, 2025
d590889
test(ai): add integration tests (#8853)
dlarocque Jun 5, 2025
5871fd6
Update issue template to rename VertexAI > AI (#9074)
hsubox76 Jun 5, 2025
6cc9a07
ci: Fix Firefox error and streamline cross-browser tests (#9015)
hsubox76 Jun 5, 2025
c0617a3
Fixed issue where requestSts wasn't including the Studio cookie in it…
maneesht Jun 5, 2025
0f891d8
Fix issue where we ping an endpoint that hasn't been implemented (#9059)
maneesht Jun 6, 2025
2306920
Updated firebase auth changeset (#9088)
maneesht Jun 9, 2025
db2c5a5
Merge main into release
google-oss-bot Jun 10, 2025
a058309
build(all): Version Packages v11.9.1 (#9089)
google-oss-bot Jun 10, 2025
7fb64dd
test(ai): Upgrade mock responses to v14 (#9091)
dlarocque Jun 13, 2025
13e6cce
Feat/google3 typings support (#9085)
eranc-google Jun 17, 2025
b97eab3
fix(ai): Add deprecation tag to `totalBillableCharacters` (#9090)
dlarocque Jun 18, 2025
41e3c4c
test(ai): Add `gemini-2.5-flash` to integration tests (#9110)
dlarocque Jun 20, 2025
f73e08b
firestore: minor refactor of listener registration of "versionchange"…
dconeybe Jun 20, 2025
42ac401
Fixed issue where storage wasn't passing cookies when using firebase …
maneesht Jun 23, 2025
bb57947
fix: Add "react-native" entry point to @firebase/app (#9112)
hsubox76 Jun 23, 2025
7ae5b12
Feat(Firestore) JSON serialization of types to improve SSR support. (…
DellaBitta Jun 23, 2025
86155b3
chore(Firestore) add changeset for PR #8926 (#9115)
DellaBitta Jun 23, 2025
3d44792
Update Fireperf logging to use sendBeacon only if the payload is unde…
raymondlam Jun 26, 2025
b640454
Add decimal128 to new types (#344)
milaGGL Jun 27, 2025
38faba5
Merge remote-tracking branch 'origin-public/main' into mila/new-types
ehsannas Jun 27, 2025
60fd076
Fix merge conflicts.
ehsannas Jun 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Feat(Firestore) JSON serialization of types to improve SSR support. (#…
…8926)

Support the ability to resume `onSnapshot` listeners in the CSR phase based on serialized `DataSnapshot`s and `QuerySnapshot`s built in the SSR phase. Allow Firestore result types to be serialized with `toJSON` and then deserialized with `fromJSON` methods on the objects.

`DocumentSnapshot` and `QuerySnapshot` deserialization methods will be standalone, tree-shakable functions `dataSnapshotFromJSON` and `querySnapshotFromJSON`.
  • Loading branch information
DellaBitta authored Jun 23, 2025
commit 7ae5b12b901620aa101b5caed94064271fb76fb6
11 changes: 11 additions & 0 deletions common/api-review/firestore-lite.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ export function average(field: string | FieldPath): AggregateField<number | null
// @public
export class Bytes {
static fromBase64String(base64: string): Bytes;
static fromJSON(json: object): Bytes;
static fromUint8Array(array: Uint8Array): Bytes;
isEqual(other: Bytes): boolean;
toBase64(): string;
toJSON(): object;
toString(): string;
toUint8Array(): Uint8Array;
}
Expand Down Expand Up @@ -135,9 +137,12 @@ export function documentId(): FieldPath;
export class DocumentReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> {
readonly converter: FirestoreDataConverter<AppModelType, DbModelType> | null;
readonly firestore: Firestore;
static fromJSON(firestore: Firestore, json: object): DocumentReference;
static fromJSON<NewAppModelType = DocumentData, NewDbModelType extends DocumentData = DocumentData>(firestore: Firestore, json: object, converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
get id(): string;
get parent(): CollectionReference<AppModelType, DbModelType>;
get path(): string;
toJSON(): object;
readonly type = "document";
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
withConverter(converter: null): DocumentReference<DocumentData, DocumentData>;
Expand Down Expand Up @@ -205,12 +210,14 @@ export type FirestoreErrorCode = 'cancelled' | 'unknown' | 'invalid-argument' |
// @public
export class GeoPoint {
constructor(latitude: number, longitude: number);
static fromJSON(json: object): GeoPoint;
isEqual(other: GeoPoint): boolean;
get latitude(): number;
get longitude(): number;
toJSON(): {
latitude: number;
longitude: number;
type: string;
};
}

Expand Down Expand Up @@ -416,6 +423,7 @@ export class Timestamp {
seconds: number,
nanoseconds: number);
static fromDate(date: Date): Timestamp;
static fromJSON(json: object): Timestamp;
static fromMillis(milliseconds: number): Timestamp;
isEqual(other: Timestamp): boolean;
readonly nanoseconds: number;
Expand All @@ -425,6 +433,7 @@ export class Timestamp {
toJSON(): {
seconds: number;
nanoseconds: number;
type: string;
};
toMillis(): number;
toString(): string;
Expand Down Expand Up @@ -466,8 +475,10 @@ export function vector(values?: number[]): VectorValue;
// @public
export class VectorValue {
/* Excluded from this release type: __constructor */
static fromJSON(json: object): VectorValue;
isEqual(other: VectorValue): boolean;
toArray(): number[];
toJSON(): object;
}

// @public
Expand Down
65 changes: 65 additions & 0 deletions common/api-review/firestore.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ export function average(field: string | FieldPath): AggregateField<number | null
// @public
export class Bytes {
static fromBase64String(base64: string): Bytes;
static fromJSON(json: object): Bytes;
static fromUint8Array(array: Uint8Array): Bytes;
isEqual(other: Bytes): boolean;
toBase64(): string;
toJSON(): object;
toString(): string;
toUint8Array(): Uint8Array;
}
Expand Down Expand Up @@ -161,9 +163,12 @@ export function documentId(): FieldPath;
export class DocumentReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> {
readonly converter: FirestoreDataConverter<AppModelType, DbModelType> | null;
readonly firestore: Firestore;
static fromJSON(firestore: Firestore, json: object): DocumentReference;
static fromJSON<NewAppModelType = DocumentData, NewDbModelType extends DocumentData = DocumentData>(firestore: Firestore, json: object, converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
get id(): string;
get parent(): CollectionReference<AppModelType, DbModelType>;
get path(): string;
toJSON(): object;
readonly type = "document";
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
withConverter(converter: null): DocumentReference<DocumentData, DocumentData>;
Expand All @@ -178,8 +183,15 @@ export class DocumentSnapshot<AppModelType = DocumentData, DbModelType extends D
get id(): string;
readonly metadata: SnapshotMetadata;
get ref(): DocumentReference<AppModelType, DbModelType>;
toJSON(): object;
}

// @public
export function documentSnapshotFromJSON(db: Firestore, json: object): DocumentSnapshot;

// @public
export function documentSnapshotFromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: Firestore, json: object, converter: FirestoreDataConverter<AppModelType, DbModelType>): DocumentSnapshot<AppModelType, DbModelType>;

export { EmulatorMockTokenOptions }

// @public @deprecated
Expand Down Expand Up @@ -264,12 +276,14 @@ export interface FirestoreSettings {
// @public
export class GeoPoint {
constructor(latitude: number, longitude: number);
static fromJSON(json: object): GeoPoint;
isEqual(other: GeoPoint): boolean;
get latitude(): number;
get longitude(): number;
toJSON(): {
latitude: number;
longitude: number;
type: string;
};
}

Expand Down Expand Up @@ -459,6 +473,46 @@ export function onSnapshot<AppModelType, DbModelType extends DocumentData>(query
// @public
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;

// @public
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;

// @public
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;

// @public
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;

// @public
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;

// @public
export function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, observer: {
next: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;

// @public
export function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, observer: {
next: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;

// @public
export function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, options: SnapshotListenOptions, observer: {
next: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;

// @public
export function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, options: SnapshotListenOptions, observer: {
next: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
error?: (error: FirestoreError) => void;
complete?: () => void;
}, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe;

// @public
export function onSnapshotsInSync(firestore: Firestore, observer: {
next?: (value: void) => void;
Expand Down Expand Up @@ -610,8 +664,15 @@ export class QuerySnapshot<AppModelType = DocumentData, DbModelType extends Docu
readonly metadata: SnapshotMetadata;
readonly query: Query<AppModelType, DbModelType>;
get size(): number;
toJSON(): object;
}

// @public
export function querySnapshotFromJSON(db: Firestore, json: object): QuerySnapshot;

// @public
export function querySnapshotFromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: Firestore, json: object, converter: FirestoreDataConverter<AppModelType, DbModelType>): QuerySnapshot<AppModelType, DbModelType>;

// @public
export class QueryStartAtConstraint extends QueryConstraint {
readonly type: 'startAt' | 'startAfter';
Expand Down Expand Up @@ -696,6 +757,7 @@ export class Timestamp {
seconds: number,
nanoseconds: number);
static fromDate(date: Date): Timestamp;
static fromJSON(json: object): Timestamp;
static fromMillis(milliseconds: number): Timestamp;
isEqual(other: Timestamp): boolean;
readonly nanoseconds: number;
Expand All @@ -705,6 +767,7 @@ export class Timestamp {
toJSON(): {
seconds: number;
nanoseconds: number;
type: string;
};
toMillis(): number;
toString(): string;
Expand Down Expand Up @@ -751,8 +814,10 @@ export function vector(values?: number[]): VectorValue;
// @public
export class VectorValue {
/* Excluded from this release type: __constructor */
static fromJSON(json: object): VectorValue;
isEqual(other: VectorValue): boolean;
toArray(): number[];
toJSON(): object;
}

// @public
Expand Down
39 changes: 39 additions & 0 deletions docs-devsite/firestore_.bytes.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ export declare class Bytes
| Method | Modifiers | Description |
| --- | --- | --- |
| [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. |
| [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)<!-- -->. |
| [fromUint8Array(array)](./firestore_.bytes.md#bytesfromuint8array) | <code>static</code> | Creates a new <code>Bytes</code> object from the given Uint8Array. |
| [isEqual(other)](./firestore_.bytes.md#bytesisequal) | | Returns true if this <code>Bytes</code> object is equal to the provided one. |
| [toBase64()](./firestore_.bytes.md#bytestobase64) | | Returns the underlying bytes as a Base64-encoded string. |
| [toJSON()](./firestore_.bytes.md#bytestojson) | | Returns a JSON-serializable representation of this <code>Bytes</code> instance. |
| [toString()](./firestore_.bytes.md#bytestostring) | | Returns a string representation of the <code>Bytes</code> object. |
| [toUint8Array()](./firestore_.bytes.md#bytestouint8array) | | Returns the underlying bytes in a new <code>Uint8Array</code>. |

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

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

## Bytes.fromJSON()

Builds a `Bytes` instance from a JSON object created by [Bytes.toJSON()](./firestore_.bytes.md#bytestojson)<!-- -->.

<b>Signature:</b>

```typescript
static fromJSON(json: object): Bytes;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| json | object | a JSON object represention of a <code>Bytes</code> instance |

<b>Returns:</b>

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

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.

## Bytes.fromUint8Array()

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

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

## Bytes.toJSON()

Returns a JSON-serializable representation of this `Bytes` instance.

<b>Signature:</b>

```typescript
toJSON(): object;
```
<b>Returns:</b>

object

a JSON representation of this object.

## Bytes.toString()

Returns a string representation of the `Bytes` object.
Expand Down
65 changes: 65 additions & 0 deletions docs-devsite/firestore_.documentreference.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export declare class DocumentReference<AppModelType = DocumentData, DbModelType

| Method | Modifiers | Description |
| --- | --- | --- |
| [fromJSON(firestore, json)](./firestore_.documentreference.md#documentreferencefromjson) | <code>static</code> | Builds a <code>DocumentReference</code> instance from a JSON object created by [DocumentReference.toJSON()](./firestore_.documentreference.md#documentreferencetojson)<!-- -->. |
| [fromJSON(firestore, json, converter)](./firestore_.documentreference.md#documentreferencefromjson) | <code>static</code> | Builds a <code>DocumentReference</code> instance from a JSON object created by [DocumentReference.toJSON()](./firestore_.documentreference.md#documentreferencetojson)<!-- -->. |
| [toJSON()](./firestore_.documentreference.md#documentreferencetojson) | | Returns a JSON-serializable representation of this <code>DocumentReference</code> instance. |
| [withConverter(converter)](./firestore_.documentreference.md#documentreferencewithconverter) | | Applies a custom data converter to this <code>DocumentReference</code>, allowing you to use your own custom model objects with Firestore. When you call [setDoc()](./firestore_lite.md#setdoc_ee215ad)<!-- -->, [getDoc()](./firestore_lite.md#getdoc_4569087)<!-- -->, etc. with the returned <code>DocumentReference</code> instance, the provided converter will convert between Firestore data of type <code>NewDbModelType</code> and your custom type <code>NewAppModelType</code>. |
| [withConverter(converter)](./firestore_.documentreference.md#documentreferencewithconverter) | | Removes the current converter. |

Expand Down Expand Up @@ -96,6 +99,68 @@ The type of this Firestore reference.
readonly type = "document";
```

## DocumentReference.fromJSON()

Builds a `DocumentReference` instance from a JSON object created by [DocumentReference.toJSON()](./firestore_.documentreference.md#documentreferencetojson)<!-- -->.

<b>Signature:</b>

```typescript
static fromJSON(firestore: Firestore, json: object): DocumentReference;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| firestore | [Firestore](./firestore_.firestore.md#firestore_class) | The [Firestore](./firestore_.firestore.md#firestore_class) instance the snapshot should be loaded for. |
| json | object | a JSON object represention of a <code>DocumentReference</code> instance |

<b>Returns:</b>

[DocumentReference](./firestore_.documentreference.md#documentreference_class)

an instance of [DocumentReference](./firestore_.documentreference.md#documentreference_class) if the JSON object could be parsed. Throws a [FirestoreError](./firestore_.firestoreerror.md#firestoreerror_class) if an error occurs.

## DocumentReference.fromJSON()

Builds a `DocumentReference` instance from a JSON object created by [DocumentReference.toJSON()](./firestore_.documentreference.md#documentreferencetojson)<!-- -->.

<b>Signature:</b>

```typescript
static fromJSON<NewAppModelType = DocumentData, NewDbModelType extends DocumentData = DocumentData>(firestore: Firestore, json: object, converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| firestore | [Firestore](./firestore_.firestore.md#firestore_class) | The [Firestore](./firestore_.firestore.md#firestore_class) instance the snapshot should be loaded for. |
| json | object | a JSON object represention of a <code>DocumentReference</code> instance |
| converter | [FirestoreDataConverter](./firestore_.firestoredataconverter.md#firestoredataconverter_interface)<!-- -->&lt;NewAppModelType, NewDbModelType&gt; | Converts objects to and from Firestore. |

<b>Returns:</b>

[DocumentReference](./firestore_.documentreference.md#documentreference_class)<!-- -->&lt;NewAppModelType, NewDbModelType&gt;

an instance of [DocumentReference](./firestore_.documentreference.md#documentreference_class) if the JSON object could be parsed. Throws a [FirestoreError](./firestore_.firestoreerror.md#firestoreerror_class) if an error occurs.

## DocumentReference.toJSON()

Returns a JSON-serializable representation of this `DocumentReference` instance.

<b>Signature:</b>

```typescript
toJSON(): object;
```
<b>Returns:</b>

object

a JSON representation of this object.

## DocumentReference.withConverter()

Applies a custom data converter to this `DocumentReference`<!-- -->, allowing you to use your own custom model objects with Firestore. When you call [setDoc()](./firestore_lite.md#setdoc_ee215ad)<!-- -->, [getDoc()](./firestore_lite.md#getdoc_4569087)<!-- -->, etc. with the returned `DocumentReference` instance, the provided converter will convert between Firestore data of type `NewDbModelType` and your custom type `NewAppModelType`<!-- -->.
Expand Down
16 changes: 16 additions & 0 deletions docs-devsite/firestore_.documentsnapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export declare class DocumentSnapshot<AppModelType = DocumentData, DbModelType e
| [data(options)](./firestore_.documentsnapshot.md#documentsnapshotdata) | | Retrieves all fields in the document as an <code>Object</code>. Returns <code>undefined</code> if the document doesn't exist.<!-- -->By default, <code>serverTimestamp()</code> values that have not yet been set to their final value will be returned as <code>null</code>. You can override this by passing an options object. |
| [exists()](./firestore_.documentsnapshot.md#documentsnapshotexists) | | Returns whether or not the data exists. True if the document exists. |
| [get(fieldPath, options)](./firestore_.documentsnapshot.md#documentsnapshotget) | | Retrieves the field specified by <code>fieldPath</code>. Returns <code>undefined</code> if the document or field doesn't exist.<!-- -->By default, a <code>serverTimestamp()</code> that has not yet been set to its final value will be returned as <code>null</code>. You can override this by passing an options object. |
| [toJSON()](./firestore_.documentsnapshot.md#documentsnapshottojson) | | Returns a JSON-serializable representation of this <code>DocumentSnapshot</code> instance. |

## DocumentSnapshot.(constructor)

Expand Down Expand Up @@ -144,3 +145,18 @@ any

The data at the specified field location or undefined if no such field exists in the document.

## DocumentSnapshot.toJSON()

Returns a JSON-serializable representation of this `DocumentSnapshot` instance.

<b>Signature:</b>

```typescript
toJSON(): object;
```
<b>Returns:</b>

object

a JSON representation of this object. Throws a [FirestoreError](./firestore_.firestoreerror.md#firestoreerror_class) if this `DocumentSnapshot` has pending writes.

Loading