Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions common/api-review/app.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export const _DEFAULT_ENTRY_NAME = "[DEFAULT]";
// @public
export function deleteApp(app: FirebaseApp): Promise<void>;

// @public (undocumented)
export function enableContextualErrors(enabled: boolean): void;

// @public
export interface FirebaseApp {
automaticDataCollectionEnabled: boolean;
Expand Down
24 changes: 23 additions & 1 deletion common/api-review/firestore-lite.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ DbModelType extends DocumentData = DocumentData
}

// @public
export class FirestoreError extends FirebaseError {
export class FirestoreError extends FirebaseError<FirestoreErrorContext> {
readonly code: FirestoreErrorCode;
readonly message: string;
readonly stack?: string;
Expand All @@ -384,6 +384,28 @@ export type FirestoreErrorCode =
| 'data-loss'
| 'unauthenticated';

// @public
export interface FirestoreErrorContext {
// (undocumented)
operation?: FirestoreOperation;
// (undocumented)
path?: string;
}

// @public
export enum FirestoreOperation {
// (undocumented)
DELETE = 'delete',
// (undocumented)
LIST = 'list',
// (undocumented)
READ = 'read',
// (undocumented)
UPDATE = 'update',
// (undocumented)
WRITE = 'write'
}

// @public
export class GeoPoint {
constructor(latitude: number, longitude: number);
Expand Down
24 changes: 23 additions & 1 deletion common/api-review/firestore.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ DbModelType extends DocumentData = DocumentData
}

// @public
export class FirestoreError extends FirebaseError {
export class FirestoreError extends FirebaseError<FirestoreErrorContext> {
readonly code: FirestoreErrorCode;
readonly message: string;
readonly stack?: string;
Expand All @@ -462,11 +462,33 @@ export type FirestoreErrorCode =
| 'data-loss'
| 'unauthenticated';

// @public
export interface FirestoreErrorContext {
// (undocumented)
operation?: FirestoreOperation;
// (undocumented)
path?: string;
}

// @public
export type FirestoreLocalCache =
| MemoryLocalCache
| PersistentLocalCache;

// @public
export enum FirestoreOperation {
// (undocumented)
DELETE = 'delete',
// (undocumented)
LIST = 'list',
// (undocumented)
READ = 'read',
// (undocumented)
UPDATE = 'update',
// (undocumented)
WRITE = 'write'
}

// @public
export interface FirestoreSettings {
cacheSizeBytes?: number;
Expand Down
16 changes: 14 additions & 2 deletions common/api-review/util.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ export type EmulatorMockTokenOptions = ({
sub: string;
}) & Partial<FirebaseIdToken>;

// Warning: (ae-missing-release-tag) "enableContextualErrors" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export function enableContextualErrors(enableFlag: boolean): void;

// Warning: (ae-missing-release-tag) "ErrorData" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Expand Down Expand Up @@ -207,11 +212,13 @@ export interface FirebaseDefaults {
// Warning: (ae-missing-release-tag) "FirebaseError" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export class FirebaseError extends Error {
export class FirebaseError<T = object> extends Error {
constructor(
code: string, message: string,
customData?: Record<string, unknown> | undefined);
customData?: Record<string, unknown> | undefined, _context?: T);
readonly code: string;
// (undocumented)
readonly context?: T;
customData?: Record<string, unknown> | undefined;
readonly name: string;
}
Expand Down Expand Up @@ -275,6 +282,11 @@ export function isCloudflareWorker(): boolean;
// @public
export function isCloudWorkstation(url: string): boolean;

// Warning: (ae-missing-release-tag) "isContextualErrorsEnabled" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export function isContextualErrorsEnabled(): boolean;

// Warning: (ae-missing-release-tag) "isElectron" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
Expand Down
4 changes: 4 additions & 0 deletions docs-devsite/_toc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,8 @@ toc:
path: /docs/reference/js/firestore.firestoredataconverter.md
- title: FirestoreError
path: /docs/reference/js/firestore.firestoreerror.md
- title: FirestoreErrorContext
path: /docs/reference/js/firestore.firestoreerrorcontext.md
- title: FirestoreSettings
path: /docs/reference/js/firestore.firestoresettings.md
- title: GeoPoint
Expand Down Expand Up @@ -658,6 +660,8 @@ toc:
path: /docs/reference/js/firestore_lite.firestoredataconverter.md
- title: FirestoreError
path: /docs/reference/js/firestore_lite.firestoreerror.md
- title: FirestoreErrorContext
path: /docs/reference/js/firestore_lite.firestoreerrorcontext.md
- title: GeoPoint
path: /docs/reference/js/firestore_lite.geopoint.md
- title: Int32Value
Expand Down
22 changes: 22 additions & 0 deletions docs-devsite/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ This package coordinates the communication between the different Firebase compon
| [initializeApp()](./app.md#initializeapp) | Creates and initializes a FirebaseApp instance. |
| <b>function(config, ...)</b> |
| [initializeServerApp(config)](./app.md#initializeserverapp_e7d0728) | Creates and initializes a [FirebaseServerApp](./app.firebaseserverapp.md#firebaseserverapp_interface) instance. |
| <b>function(enabled, ...)</b> |
| [enableContextualErrors(enabled)](./app.md#enablecontextualerrors_25adbe2) | |
| <b>function(libraryKeyOrName, ...)</b> |
| [registerVersion(libraryKeyOrName, version, variant)](./app.md#registerversion_f673248) | Registers a library's name and version for platform logging purposes. |
| <b>function(logCallback, ...)</b> |
Expand Down Expand Up @@ -150,6 +152,26 @@ If [FirebaseServerAppSettings.releaseOnDeref](./app.firebaseserverappsettings.md

If the `FIREBASE_OPTIONS` environment variable does not contain a valid project configuration required for auto-initialization.

## function(enabled, ...)

### enableContextualErrors(enabled) {:#enablecontextualerrors_25adbe2}

<b>Signature:</b>

```typescript
export declare function enableContextualErrors(enabled: boolean): void;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| enabled | boolean | |

<b>Returns:</b>

void

## function(libraryKeyOrName, ...)

### registerVersion(libraryKeyOrName, version, variant) {:#registerversion_f673248}
Expand Down
4 changes: 2 additions & 2 deletions docs-devsite/firestore.firestoreerror.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ An error returned by a Firestore operation.
<b>Signature:</b>

```typescript
export declare class FirestoreError extends FirebaseError
export declare class FirestoreError extends FirebaseError<FirestoreErrorContext>
```
<b>Extends:</b> [FirebaseError](./util.firebaseerror.md#firebaseerror_class)
<b>Extends:</b> [FirebaseError](./util.firebaseerror.md#firebaseerror_class)<!-- -->&lt;[FirestoreErrorContext](./firestore.firestoreerrorcontext.md#firestoreerrorcontext_interface)<!-- -->&gt;

## Properties

Expand Down
42 changes: 42 additions & 0 deletions docs-devsite/firestore.firestoreerrorcontext.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference

{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}

# FirestoreErrorContext interface
Contextual information attached to a [FirestoreError](./firestore.firestoreerror.md#firestoreerror_class) when contextual errors are enabled.

<b>Signature:</b>

```typescript
export declare interface FirestoreErrorContext
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [operation](./firestore.firestoreerrorcontext.md#firestoreerrorcontextoperation) | [FirestoreOperation](./firestore.md#firestoreoperation) | |
| [path](./firestore.firestoreerrorcontext.md#firestoreerrorcontextpath) | string | |

## FirestoreErrorContext.operation

<b>Signature:</b>

```typescript
operation?: FirestoreOperation;
```

## FirestoreErrorContext.path

<b>Signature:</b>

```typescript
path?: string;
```
28 changes: 28 additions & 0 deletions docs-devsite/firestore.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ Cloud Firestore
| [VectorValue](./firestore.vectorvalue.md#vectorvalue_class) | Represents a vector type in Firestore documents. Create an instance with <code>[vector()](./firestore.md#vector_0dbdaf2)</code>. |
| [WriteBatch](./firestore.writebatch.md#writebatch_class) | A write batch, used to perform multiple writes as a single atomic unit.<!-- -->A <code>WriteBatch</code> object can be acquired by calling [writeBatch()](./firestore.md#writebatch_231a8e0)<!-- -->. It provides methods for adding writes to the write batch. None of the writes will be committed (or visible locally) until [WriteBatch.commit()](./firestore.writebatch.md#writebatchcommit) is called. |

## Enumerations

| Enumeration | Description |
| --- | --- |
| [FirestoreOperation](./firestore.md#firestoreoperation) | The Firestore operation associated with a [FirestoreErrorContext](./firestore.firestoreerrorcontext.md#firestoreerrorcontext_interface)<!-- -->. |

## Interfaces

| Interface | Description |
Expand All @@ -192,6 +198,7 @@ Cloud Firestore
| [DocumentData](./firestore.documentdata.md#documentdata_interface) | Document data (for use with [setDoc()](./firestore_lite.md#setdoc_ee215ad)<!-- -->) consists of fields mapped to values. |
| [ExperimentalLongPollingOptions](./firestore.experimentallongpollingoptions.md#experimentallongpollingoptions_interface) | Options that configure the SDK’s underlying network transport (WebChannel) when long-polling is used.<!-- -->Note: This interface is "experimental" and is subject to change.<!-- -->See <code>FirestoreSettings.experimentalAutoDetectLongPolling</code>, <code>FirestoreSettings.experimentalForceLongPolling</code>, and <code>FirestoreSettings.experimentalLongPollingOptions</code>. |
| [FirestoreDataConverter](./firestore.firestoredataconverter.md#firestoredataconverter_interface) | Converter used by <code>withConverter()</code> to transform user objects of type <code>AppModelType</code> into Firestore data of type <code>DbModelType</code>.<!-- -->Using the converter allows you to specify generic type arguments when storing and retrieving objects from Firestore.<!-- -->In this context, an "AppModel" is a class that is used in an application to package together related information and functionality. Such a class could, for example, have properties with complex, nested data types, properties used for memoization, properties of types not supported by Firestore (such as <code>symbol</code> and <code>bigint</code>), and helper functions that perform compound operations. Such classes are not suitable and/or possible to store into a Firestore database. Instead, instances of such classes need to be converted to "plain old JavaScript objects" (POJOs) with exclusively primitive properties, potentially nested inside other POJOs or arrays of POJOs. In this context, this type is referred to as the "DbModel" and would be an object suitable for persisting into Firestore. For convenience, applications can implement <code>FirestoreDataConverter</code> and register the converter with Firestore objects, such as <code>DocumentReference</code> or <code>Query</code>, to automatically convert <code>AppModel</code> to <code>DbModel</code> when storing into Firestore, and convert <code>DbModel</code> to <code>AppModel</code> when retrieving from Firestore. |
| [FirestoreErrorContext](./firestore.firestoreerrorcontext.md#firestoreerrorcontext_interface) | Contextual information attached to a [FirestoreError](./firestore.firestoreerror.md#firestoreerror_class) when contextual errors are enabled. |
| [FirestoreSettings](./firestore.firestoresettings.md#firestoresettings_interface) | Specifies custom configurations for your Cloud Firestore instance. You must set these before invoking any other methods. |
| [Index](./firestore.index.md#index_interface) | <b><i>(Public Preview)</i></b> The SDK definition of a Firestore index. |
| [IndexConfiguration](./firestore.indexconfiguration.md#indexconfiguration_interface) | <b><i>(Public Preview)</i></b> A list of Firestore indexes to speed up local query execution.<!-- -->See [JSON Format](https://firebase.google.com/docs/reference/firestore/indexes/#json_format) for a description of the format of the index definition. |
Expand Down Expand Up @@ -3671,3 +3678,24 @@ export declare type WithFieldValue<T> =
}
: never);
```

## FirestoreOperation

The Firestore operation associated with a [FirestoreErrorContext](./firestore.firestoreerrorcontext.md#firestoreerrorcontext_interface)<!-- -->.

<b>Signature:</b>

```typescript
export declare enum FirestoreOperation
```

## Enumeration Members

| Member | Value | Description |
| --- | --- | --- |
| DELETE | <code>'delete'</code> | |
| LIST | <code>'list'</code> | |
| READ | <code>'read'</code> | |
| UPDATE | <code>'update'</code> | |
| WRITE | <code>'write'</code> | |

4 changes: 2 additions & 2 deletions docs-devsite/firestore_lite.firestoreerror.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ An error returned by a Firestore operation.
<b>Signature:</b>

```typescript
export declare class FirestoreError extends FirebaseError
export declare class FirestoreError extends FirebaseError<FirestoreErrorContext>
```
<b>Extends:</b> [FirebaseError](./util.firebaseerror.md#firebaseerror_class)
<b>Extends:</b> [FirebaseError](./util.firebaseerror.md#firebaseerror_class)<!-- -->&lt;[FirestoreErrorContext](./firestore_lite.firestoreerrorcontext.md#firestoreerrorcontext_interface)<!-- -->&gt;

## Properties

Expand Down
42 changes: 42 additions & 0 deletions docs-devsite/firestore_lite.firestoreerrorcontext.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference

{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}

# FirestoreErrorContext interface
Contextual information attached to a [FirestoreError](./firestore_lite.firestoreerror.md#firestoreerror_class) when contextual errors are enabled.

<b>Signature:</b>

```typescript
export declare interface FirestoreErrorContext
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [operation](./firestore_lite.firestoreerrorcontext.md#firestoreerrorcontextoperation) | [FirestoreOperation](./firestore_lite.md#firestoreoperation) | |
| [path](./firestore_lite.firestoreerrorcontext.md#firestoreerrorcontextpath) | string | |

## FirestoreErrorContext.operation

<b>Signature:</b>

```typescript
operation?: FirestoreOperation;
```

## FirestoreErrorContext.path

<b>Signature:</b>

```typescript
path?: string;
```
28 changes: 28 additions & 0 deletions docs-devsite/firestore_lite.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,20 @@ Firestore Lite is a small online-only SDK that allows read and write access to y
| [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | Represents a vector type in Firestore documents. Create an instance with <code>[vector()](./firestore_lite.md#vector_0dbdaf2)</code>. |
| [WriteBatch](./firestore_lite.writebatch.md#writebatch_class) | A write batch, used to perform multiple writes as a single atomic unit.<!-- -->A <code>WriteBatch</code> object can be acquired by calling [writeBatch()](./firestore_lite.md#writebatch_231a8e0)<!-- -->. It provides methods for adding writes to the write batch. None of the writes will be committed (or visible locally) until [WriteBatch.commit()](./firestore_lite.writebatch.md#writebatchcommit) is called. |

## Enumerations

| Enumeration | Description |
| --- | --- |
| [FirestoreOperation](./firestore_lite.md#firestoreoperation) | The Firestore operation associated with a [FirestoreErrorContext](./firestore_lite.firestoreerrorcontext.md#firestoreerrorcontext_interface)<!-- -->. |

## Interfaces

| Interface | Description |
| --- | --- |
| [AggregateSpec](./firestore_lite.aggregatespec.md#aggregatespec_interface) | Specifies a set of aggregations and their aliases. |
| [DocumentData](./firestore_lite.documentdata.md#documentdata_interface) | Document data (for use with [setDoc()](./firestore.md#setdoc_ee215ad)<!-- -->) consists of fields mapped to values. |
| [FirestoreDataConverter](./firestore_lite.firestoredataconverter.md#firestoredataconverter_interface) | Converter used by <code>withConverter()</code> to transform user objects of type <code>AppModelType</code> into Firestore data of type <code>DbModelType</code>.<!-- -->Using the converter allows you to specify generic type arguments when storing and retrieving objects from Firestore.<!-- -->In this context, an "AppModel" is a class that is used in an application to package together related information and functionality. Such a class could, for example, have properties with complex, nested data types, properties used for memoization, properties of types not supported by Firestore (such as <code>symbol</code> and <code>bigint</code>), and helper functions that perform compound operations. Such classes are not suitable and/or possible to store into a Firestore database. Instead, instances of such classes need to be converted to "plain old JavaScript objects" (POJOs) with exclusively primitive properties, potentially nested inside other POJOs or arrays of POJOs. In this context, this type is referred to as the "DbModel" and would be an object suitable for persisting into Firestore. For convenience, applications can implement <code>FirestoreDataConverter</code> and register the converter with Firestore objects, such as <code>DocumentReference</code> or <code>Query</code>, to automatically convert <code>AppModel</code> to <code>DbModel</code> when storing into Firestore, and convert <code>DbModel</code> to <code>AppModel</code> when retrieving from Firestore. |
| [FirestoreErrorContext](./firestore_lite.firestoreerrorcontext.md#firestoreerrorcontext_interface) | Contextual information attached to a [FirestoreError](./firestore_lite.firestoreerror.md#firestoreerror_class) when contextual errors are enabled. |
| [Settings](./firestore_lite.settings.md#settings_interface) | Specifies custom configurations for your Cloud Firestore instance. You must set these before invoking any other methods. |
| [TransactionOptions](./firestore_lite.transactionoptions.md#transactionoptions_interface) | Options to customize transaction behavior. |

Expand Down Expand Up @@ -2130,3 +2137,24 @@ export declare type WithFieldValue<T> =
}
: never);
```

## FirestoreOperation

The Firestore operation associated with a [FirestoreErrorContext](./firestore_lite.firestoreerrorcontext.md#firestoreerrorcontext_interface)<!-- -->.

<b>Signature:</b>

```typescript
export declare enum FirestoreOperation
```

## Enumeration Members

| Member | Value | Description |
| --- | --- | --- |
| DELETE | <code>'delete'</code> | |
| LIST | <code>'list'</code> | |
| READ | <code>'read'</code> | |
| UPDATE | <code>'update'</code> | |
| WRITE | <code>'write'</code> | |

Loading
Loading