Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
10 changes: 10 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,11 @@ export function documentId(): FieldPath;
export class DocumentReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> {
readonly converter: FirestoreDataConverter<AppModelType, DbModelType> | null;
readonly firestore: Firestore;
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 +209,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 +422,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 +432,7 @@ export class Timestamp {
toJSON(): {
seconds: number;
nanoseconds: number;
type: string;
};
toMillis(): number;
toString(): string;
Expand Down Expand Up @@ -466,8 +474,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
10 changes: 10 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,11 @@ export function documentId(): FieldPath;
export class DocumentReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> {
readonly converter: FirestoreDataConverter<AppModelType, DbModelType> | null;
readonly firestore: Firestore;
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 @@ -266,12 +270,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 @@ -740,6 +746,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 @@ -749,6 +756,7 @@ export class Timestamp {
toJSON(): {
seconds: number;
nanoseconds: number;
type: string;
};
toMillis(): number;
toString(): string;
Expand Down Expand Up @@ -795,8 +803,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
35 changes: 35 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 serialized version of <code>Bytes</code>. |
| [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,26 @@ static fromBase64String(base64: string): Bytes;

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

## Bytes.fromJSON()

Builds a `Bytes` instance from a JSON serialized version of `Bytes`<!-- -->.

<b>Signature:</b>

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

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| json | object | |

<b>Returns:</b>

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

## Bytes.fromUint8Array()

Creates a new `Bytes` object from the given Uint8Array.
Expand Down Expand Up @@ -106,6 +128,19 @@ 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

## Bytes.toString()

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

| Method | Modifiers | Description |
| --- | --- | --- |
| [fromJSON(firestore, json, converter)](./firestore_.documentreference.md#documentreferencefromjson) | <code>static</code> | Builds a <code>DocumentReference</code> instance from a JSON serialized version of <code>DocumentReference</code>. |
| [toJSON()](./firestore_.documentreference.md#documentreferencetojson) | | Returns a JSON-serializable representation of this DocumentReference. |
| [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 +98,41 @@ The type of this Firestore reference.
readonly type = "document";
```

## DocumentReference.fromJSON()

Builds a `DocumentReference` instance from a JSON serialized version of `DocumentReference`<!-- -->.

<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) | |
| json | object | |
| converter | [FirestoreDataConverter](./firestore_.firestoredataconverter.md#firestoredataconverter_interface)<!-- -->&lt;NewAppModelType, NewDbModelType&gt; | |

<b>Returns:</b>

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

## DocumentReference.toJSON()

Returns a JSON-serializable representation of this DocumentReference.

<b>Signature:</b>

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

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
24 changes: 23 additions & 1 deletion docs-devsite/firestore_.geopoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export declare class GeoPoint

| Method | Modifiers | Description |
| --- | --- | --- |
| [fromJSON(json)](./firestore_.geopoint.md#geopointfromjson) | <code>static</code> | Builds a <code>Timestamp</code> instance from a JSON serialized version of <code>Bytes</code>. |
| [isEqual(other)](./firestore_.geopoint.md#geopointisequal) | | Returns true if this <code>GeoPoint</code> is equal to the provided one. |
| [toJSON()](./firestore_.geopoint.md#geopointtojson) | | Returns a JSON-serializable representation of this GeoPoint. |

Expand Down Expand Up @@ -77,6 +78,26 @@ The longitude of this `GeoPoint` instance.
get longitude(): number;
```

## GeoPoint.fromJSON()

Builds a `Timestamp` instance from a JSON serialized version of `Bytes`<!-- -->.

<b>Signature:</b>

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

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| json | object | |

<b>Returns:</b>

[GeoPoint](./firestore_.geopoint.md#geopoint_class)

## GeoPoint.isEqual()

Returns true if this `GeoPoint` is equal to the provided one.
Expand Down Expand Up @@ -109,9 +130,10 @@ Returns a JSON-serializable representation of this GeoPoint.
toJSON(): {
latitude: number;
longitude: number;
type: string;
};
```
<b>Returns:</b>

{ latitude: number; longitude: number; }
{ latitude: number; longitude: number; type: string; }

24 changes: 23 additions & 1 deletion docs-devsite/firestore_.timestamp.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export declare class Timestamp
| Method | Modifiers | Description |
| --- | --- | --- |
| [fromDate(date)](./firestore_.timestamp.md#timestampfromdate) | <code>static</code> | Creates a new timestamp from the given date. |
| [fromJSON(json)](./firestore_.timestamp.md#timestampfromjson) | <code>static</code> | Builds a <code>Timestamp</code> instance from a JSON serialized version of <code>Bytes</code>. |
| [fromMillis(milliseconds)](./firestore_.timestamp.md#timestampfrommillis) | <code>static</code> | Creates a new timestamp from the given number of milliseconds. |
| [isEqual(other)](./firestore_.timestamp.md#timestampisequal) | | Returns true if this <code>Timestamp</code> is equal to the provided one. |
| [now()](./firestore_.timestamp.md#timestampnow) | <code>static</code> | Creates a new timestamp with the current date, with millisecond precision. |
Expand Down Expand Up @@ -110,6 +111,26 @@ static fromDate(date: Date): Timestamp;

A new `Timestamp` representing the same point in time as the given date.

## Timestamp.fromJSON()

Builds a `Timestamp` instance from a JSON serialized version of `Bytes`<!-- -->.

<b>Signature:</b>

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

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| json | object | |

<b>Returns:</b>

[Timestamp](./firestore_.timestamp.md#timestamp_class)

## Timestamp.fromMillis()

Creates a new timestamp from the given number of milliseconds.
Expand Down Expand Up @@ -194,11 +215,12 @@ Returns a JSON-serializable representation of this `Timestamp`<!-- -->.
toJSON(): {
seconds: number;
nanoseconds: number;
type: string;
};
```
<b>Returns:</b>

{ seconds: number; nanoseconds: number; }
{ seconds: number; nanoseconds: number; type: string; }

## Timestamp.toMillis()

Expand Down
35 changes: 35 additions & 0 deletions docs-devsite/firestore_.vectorvalue.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,30 @@ export declare class VectorValue

| Method | Modifiers | Description |
| --- | --- | --- |
| [fromJSON(json)](./firestore_.vectorvalue.md#vectorvaluefromjson) | <code>static</code> | Builds a <code>Bytes</code> instance from a JSON serialized version of <code>Bytes</code>. |
| [isEqual(other)](./firestore_.vectorvalue.md#vectorvalueisequal) | | Returns <code>true</code> if the two <code>VectorValue</code> values have the same raw number arrays, returns <code>false</code> otherwise. |
| [toArray()](./firestore_.vectorvalue.md#vectorvaluetoarray) | | Returns a copy of the raw number array form of the vector. |
| [toJSON()](./firestore_.vectorvalue.md#vectorvaluetojson) | | Returns a JSON-serializable representation of this <code>VectorValue</code> instance. |

## VectorValue.fromJSON()

Builds a `Bytes` instance from a JSON serialized version of `Bytes`<!-- -->.

<b>Signature:</b>

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

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| json | object | |

<b>Returns:</b>

[VectorValue](./firestore_.vectorvalue.md#vectorvalue_class)

## VectorValue.isEqual()

Expand Down Expand Up @@ -60,3 +82,16 @@ toArray(): number[];

number\[\]

## VectorValue.toJSON()

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

<b>Signature:</b>

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

object

Loading
Loading