voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
339 lines (262 loc) • 11 kB
Markdown
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { FirebaseApp } from '@firebase/app-exp';
import { LogLevelString as LogLevel } from '@firebase/logger';
// @public
export function addDoc<T>(reference: CollectionReference<T>, data: T): Promise<DocumentReference<T>>;
// @public
export function arrayRemove(...elements: unknown[]): FieldValue;
// @public
export function arrayUnion(...elements: unknown[]): FieldValue;
// @public
export class Bytes {
static fromBase64String(base64: string): Bytes;
static fromUint8Array(array: Uint8Array): Bytes;
isEqual(other: Bytes): boolean;
toBase64(): string;
toString(): string;
toUint8Array(): Uint8Array;
}
// @public
export function collection(firestore: FirebaseFirestore, path: string, ...pathSegments: string[]): CollectionReference<DocumentData>;
// @public
export function collection(reference: CollectionReference<unknown>, path: string, ...pathSegments: string[]): CollectionReference<DocumentData>;
// @public
export function collection(reference: DocumentReference, path: string, ...pathSegments: string[]): CollectionReference<DocumentData>;
// @public
export function collectionGroup(firestore: FirebaseFirestore, collectionId: string): Query<DocumentData>;
// @public
export class CollectionReference<T = DocumentData> extends Query<T> {
get id(): string;
get parent(): DocumentReference<DocumentData> | null;
get path(): string;
readonly type = "collection";
withConverter<U>(converter: FirestoreDataConverter<U>): CollectionReference<U>;
withConverter(converter: null): CollectionReference<DocumentData>;
}
// @public
export function deleteDoc(reference: DocumentReference<unknown>): Promise<void>;
// @public
export function deleteField(): FieldValue;
// @public
export function doc(firestore: FirebaseFirestore, path: string, ...pathSegments: string[]): DocumentReference<DocumentData>;
// @public
export function doc<T>(reference: CollectionReference<T>, path?: string, ...pathSegments: string[]): DocumentReference<T>;
// @public
export function doc(reference: DocumentReference<unknown>, path: string, ...pathSegments: string[]): DocumentReference<DocumentData>;
// @public
export interface DocumentData {
[]: any;
}
// @public
export function documentId(): FieldPath;
// @public
export class DocumentReference<T = DocumentData> {
readonly firestore: FirebaseFirestore;
get id(): string;
get parent(): CollectionReference<T>;
get path(): string;
readonly type = "document";
withConverter<U>(converter: FirestoreDataConverter<U>): DocumentReference<U>;
withConverter(converter: null): DocumentReference<DocumentData>;
}
// @public
export class DocumentSnapshot<T = DocumentData> {
protected constructor();
data(): T | undefined;
exists(): this is QueryDocumentSnapshot<T>;
get(fieldPath: string | FieldPath): any;
get id(): string;
get ref(): DocumentReference<T>;
}
// @public
export function endAt(snapshot: DocumentSnapshot<unknown>): QueryConstraint;
// @public
export function endAt(...fieldValues: unknown[]): QueryConstraint;
// @public
export function endBefore(snapshot: DocumentSnapshot<unknown>): QueryConstraint;
// @public
export function endBefore(...fieldValues: unknown[]): QueryConstraint;
// @public
export class FieldPath {
constructor(...fieldNames: string[]);
isEqual(other: FieldPath): boolean;
}
// @public
export abstract class FieldValue {
abstract isEqual(other: FieldValue): boolean;
}
// @public
export class FirebaseFirestore {
get app(): FirebaseApp;
toJSON(): object;
}
// @public
export interface FirestoreDataConverter<T> {
fromFirestore(snapshot: QueryDocumentSnapshot<DocumentData>): T;
toFirestore(modelObject: T): DocumentData;
toFirestore(modelObject: Partial<T>, options: SetOptions): DocumentData;
}
// @public
export class FirestoreError extends Error {
readonly code: FirestoreErrorCode;
readonly message: string;
readonly name: string;
readonly stack?: string;
}
// @public
export type FirestoreErrorCode = 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated';
// @public
export class GeoPoint {
constructor(latitude: number, longitude: number);
isEqual(other: GeoPoint): boolean;
get latitude(): number;
get longitude(): number;
toJSON(): {
latitude: number;
longitude: number;
};
}
// @public
export function getDoc<T>(reference: DocumentReference<T>): Promise<DocumentSnapshot<T>>;
// @public
export function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
// @public
export function getFirestore(app?: FirebaseApp): FirebaseFirestore;
// @public
export function increment(n: number): FieldValue;
// @public
export function initializeFirestore(app: FirebaseApp, settings: Settings): FirebaseFirestore;
// @public
export function limit(limit: number): QueryConstraint;
// @public
export function limitToLast(limit: number): QueryConstraint;
export { LogLevel }
// @public
export function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryConstraint;
// @public
export type OrderByDirection = 'desc' | 'asc';
// @public
export class Query<T = DocumentData> {
protected constructor();
readonly firestore: FirebaseFirestore;
readonly type: 'query' | 'collection';
withConverter(converter: null): Query<DocumentData>;
withConverter<U>(converter: FirestoreDataConverter<U>): Query<U>;
}
// @public
export function query<T>(query: Query<T>, ...queryConstraints: QueryConstraint[]): Query<T>;
// @public
export abstract class QueryConstraint {
abstract readonly type: QueryConstraintType;
}
// @public
export type QueryConstraintType = 'where' | 'orderBy' | 'limit' | 'limitToLast' | 'startAt' | 'startAfter' | 'endAt' | 'endBefore';
// @public
export class QueryDocumentSnapshot<T = DocumentData> extends DocumentSnapshot<T> {
// @override
data(): T;
}
// @public
export function queryEqual<T>(left: Query<T>, right: Query<T>): boolean;
// @public
export class QuerySnapshot<T = DocumentData> {
get docs(): Array<QueryDocumentSnapshot<T>>;
get empty(): boolean;
forEach(callback: (result: QueryDocumentSnapshot<T>) => void, thisArg?: unknown): void;
readonly query: Query<T>;
get size(): number;
}
// @public
export function refEqual<T>(left: DocumentReference<T> | CollectionReference<T>, right: DocumentReference<T> | CollectionReference<T>): boolean;
// @public
export function runTransaction<T>(firestore: FirebaseFirestore, updateFunction: (transaction: Transaction) => Promise<T>): Promise<T>;
// @public
export function serverTimestamp(): FieldValue;
// @public
export function setDoc<T>(reference: DocumentReference<T>, data: T): Promise<void>;
// @public
export function setDoc<T>(reference: DocumentReference<T>, data: Partial<T>, options: SetOptions): Promise<void>;
// @public
export function setLogLevel(logLevel: LogLevel): void;
// @public
export type SetOptions = {
readonly merge?: boolean;
} | {
readonly mergeFields?: Array<string | FieldPath>;
};
// @public
export interface Settings {
host?: string;
ignoreUndefinedProperties?: boolean;
ssl?: boolean;
}
// @public
export function snapshotEqual<T>(left: DocumentSnapshot<T> | QuerySnapshot<T>, right: DocumentSnapshot<T> | QuerySnapshot<T>): boolean;
// @public
export function startAfter(snapshot: DocumentSnapshot<unknown>): QueryConstraint;
// @public
export function startAfter(...fieldValues: unknown[]): QueryConstraint;
// @public
export function startAt(snapshot: DocumentSnapshot<unknown>): QueryConstraint;
// @public
export function startAt(...fieldValues: unknown[]): QueryConstraint;
// @public
export function terminate(firestore: FirebaseFirestore): Promise<void>;
// @public
export class Timestamp {
constructor(
seconds: number,
nanoseconds: number);
static fromDate(date: Date): Timestamp;
static fromMillis(milliseconds: number): Timestamp;
isEqual(other: Timestamp): boolean;
readonly nanoseconds: number;
static now(): Timestamp;
readonly seconds: number;
toDate(): Date;
toJSON(): {
seconds: number;
nanoseconds: number;
};
toMillis(): number;
toString(): string;
valueOf(): string;
}
// @public
export class Transaction {
delete(documentRef: DocumentReference<unknown>): this;
get<T>(documentRef: DocumentReference<T>): Promise<DocumentSnapshot<T>>;
set<T>(documentRef: DocumentReference<T>, data: T): this;
set<T>(documentRef: DocumentReference<T>, data: Partial<T>, options: SetOptions): this;
update(documentRef: DocumentReference<unknown>, data: UpdateData): this;
update(documentRef: DocumentReference<unknown>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): this;
}
// @public
export interface UpdateData {
[]: any;
}
// @public
export function updateDoc(reference: DocumentReference<unknown>, data: UpdateData): Promise<void>;
// @public
export function updateDoc(reference: DocumentReference<unknown>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): Promise<void>;
// @public
export function useFirestoreEmulator(firestore: FirebaseFirestore, host: string, port: number): void;
// @public
export function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryConstraint;
// @public
export type WhereFilterOp = '<' | '<=' | '==' | '!=' | '>=' | '>' | 'array-contains' | 'in' | 'array-contains-any' | 'not-in';
// @public
export class WriteBatch {
commit(): Promise<void>;
delete(documentRef: DocumentReference<unknown>): WriteBatch;
set<T>(documentRef: DocumentReference<T>, data: T): WriteBatch;
set<T>(documentRef: DocumentReference<T>, data: Partial<T>, options: SetOptions): WriteBatch;
update(documentRef: DocumentReference<unknown>, data: UpdateData): WriteBatch;
update(documentRef: DocumentReference<unknown>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): WriteBatch;
}
// @public
export function writeBatch(firestore: FirebaseFirestore): WriteBatch;
// (No @packageDocumentation comment for this package)
```