|
| 1 | +## API Report File for "@firebase/firestore" |
| 2 | + |
| 3 | +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). |
| 4 | +
|
| 5 | +```ts |
| 6 | + |
| 7 | +import { EmulatorMockTokenOptions } from '@firebase/util'; |
| 8 | +import { FirebaseApp } from '@firebase/app-exp'; |
| 9 | +import { LogLevelString as LogLevel } from '@firebase/logger'; |
| 10 | + |
| 11 | +// @public |
| 12 | +export function addDoc<T>(reference: CollectionReference<T>, data: T): Promise<DocumentReference<T>>; |
| 13 | + |
| 14 | +// @public |
| 15 | +export function arrayRemove(...elements: unknown[]): FieldValue; |
| 16 | + |
| 17 | +// @public |
| 18 | +export function arrayUnion(...elements: unknown[]): FieldValue; |
| 19 | + |
| 20 | +// @public |
| 21 | +export class Bytes { |
| 22 | + static fromBase64String(base64: string): Bytes; |
| 23 | + static fromUint8Array(array: Uint8Array): Bytes; |
| 24 | + isEqual(other: Bytes): boolean; |
| 25 | + toBase64(): string; |
| 26 | + toString(): string; |
| 27 | + toUint8Array(): Uint8Array; |
| 28 | +} |
| 29 | + |
| 30 | +// @public |
| 31 | +export function collection(firestore: FirebaseFirestore, path: string, ...pathSegments: string[]): CollectionReference<DocumentData>; |
| 32 | + |
| 33 | +// @public |
| 34 | +export function collection(reference: CollectionReference<unknown>, path: string, ...pathSegments: string[]): CollectionReference<DocumentData>; |
| 35 | + |
| 36 | +// @public |
| 37 | +export function collection(reference: DocumentReference, path: string, ...pathSegments: string[]): CollectionReference<DocumentData>; |
| 38 | + |
| 39 | +// @public |
| 40 | +export function collectionGroup(firestore: FirebaseFirestore, collectionId: string): Query<DocumentData>; |
| 41 | + |
| 42 | +// @public |
| 43 | +export class CollectionReference<T = DocumentData> extends Query<T> { |
| 44 | + get id(): string; |
| 45 | + get parent(): DocumentReference<DocumentData> | null; |
| 46 | + get path(): string; |
| 47 | + readonly type = "collection"; |
| 48 | + withConverter<U>(converter: FirestoreDataConverter<U>): CollectionReference<U>; |
| 49 | + withConverter(converter: null): CollectionReference<DocumentData>; |
| 50 | +} |
| 51 | + |
| 52 | +// @public |
| 53 | +export function connectFirestoreEmulator(firestore: FirebaseFirestore, host: string, port: number, options?: { |
| 54 | + mockUserToken?: EmulatorMockTokenOptions; |
| 55 | +}): void; |
| 56 | + |
| 57 | +// @public |
| 58 | +export function deleteDoc(reference: DocumentReference<unknown>): Promise<void>; |
| 59 | + |
| 60 | +// @public |
| 61 | +export function deleteField(): FieldValue; |
| 62 | + |
| 63 | +// @public |
| 64 | +export function doc(firestore: FirebaseFirestore, path: string, ...pathSegments: string[]): DocumentReference<DocumentData>; |
| 65 | + |
| 66 | +// @public |
| 67 | +export function doc<T>(reference: CollectionReference<T>, path?: string, ...pathSegments: string[]): DocumentReference<T>; |
| 68 | + |
| 69 | +// @public |
| 70 | +export function doc(reference: DocumentReference<unknown>, path: string, ...pathSegments: string[]): DocumentReference<DocumentData>; |
| 71 | + |
| 72 | +// @public |
| 73 | +export interface DocumentData { |
| 74 | + [field: string]: any; |
| 75 | +} |
| 76 | + |
| 77 | +// @public |
| 78 | +export function documentId(): FieldPath; |
| 79 | + |
| 80 | +// @public |
| 81 | +export class DocumentReference<T = DocumentData> { |
| 82 | + readonly converter: FirestoreDataConverter<T> | null; |
| 83 | + readonly firestore: FirebaseFirestore; |
| 84 | + get id(): string; |
| 85 | + get parent(): CollectionReference<T>; |
| 86 | + get path(): string; |
| 87 | + readonly type = "document"; |
| 88 | + withConverter<U>(converter: FirestoreDataConverter<U>): DocumentReference<U>; |
| 89 | + withConverter(converter: null): DocumentReference<DocumentData>; |
| 90 | +} |
| 91 | + |
| 92 | +// @public |
| 93 | +export class DocumentSnapshot<T = DocumentData> { |
| 94 | + protected constructor(); |
| 95 | + data(): T | undefined; |
| 96 | + exists(): this is QueryDocumentSnapshot<T>; |
| 97 | + get(fieldPath: string | FieldPath): any; |
| 98 | + get id(): string; |
| 99 | + get ref(): DocumentReference<T>; |
| 100 | +} |
| 101 | + |
| 102 | +// @public |
| 103 | +export function endAt(snapshot: DocumentSnapshot<unknown>): QueryConstraint; |
| 104 | + |
| 105 | +// @public |
| 106 | +export function endAt(...fieldValues: unknown[]): QueryConstraint; |
| 107 | + |
| 108 | +// @public |
| 109 | +export function endBefore(snapshot: DocumentSnapshot<unknown>): QueryConstraint; |
| 110 | + |
| 111 | +// @public |
| 112 | +export function endBefore(...fieldValues: unknown[]): QueryConstraint; |
| 113 | + |
| 114 | +// @public |
| 115 | +export class FieldPath { |
| 116 | + constructor(...fieldNames: string[]); |
| 117 | + isEqual(other: FieldPath): boolean; |
| 118 | +} |
| 119 | + |
| 120 | +// @public |
| 121 | +export abstract class FieldValue { |
| 122 | + abstract isEqual(other: FieldValue): boolean; |
| 123 | +} |
| 124 | + |
| 125 | +// @public |
| 126 | +export class FirebaseFirestore { |
| 127 | + get app(): FirebaseApp; |
| 128 | + toJSON(): object; |
| 129 | + // (undocumented) |
| 130 | + type: 'firestore-lite' | 'firestore'; |
| 131 | +} |
| 132 | + |
| 133 | +// @public |
| 134 | +export interface FirestoreDataConverter<T> { |
| 135 | + fromFirestore(snapshot: QueryDocumentSnapshot<DocumentData>): T; |
| 136 | + toFirestore(modelObject: T): DocumentData; |
| 137 | + toFirestore(modelObject: Partial<T>, options: SetOptions): DocumentData; |
| 138 | +} |
| 139 | + |
| 140 | +// @public |
| 141 | +export class FirestoreError extends Error { |
| 142 | + readonly code: FirestoreErrorCode; |
| 143 | + readonly message: string; |
| 144 | + readonly name: string; |
| 145 | + readonly stack?: string; |
| 146 | +} |
| 147 | + |
| 148 | +// @public |
| 149 | +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'; |
| 150 | + |
| 151 | +// @public |
| 152 | +export class GeoPoint { |
| 153 | + constructor(latitude: number, longitude: number); |
| 154 | + isEqual(other: GeoPoint): boolean; |
| 155 | + get latitude(): number; |
| 156 | + get longitude(): number; |
| 157 | + toJSON(): { |
| 158 | + latitude: number; |
| 159 | + longitude: number; |
| 160 | + }; |
| 161 | +} |
| 162 | + |
| 163 | +// @public |
| 164 | +export function getDoc<T>(reference: DocumentReference<T>): Promise<DocumentSnapshot<T>>; |
| 165 | + |
| 166 | +// @public |
| 167 | +export function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>>; |
| 168 | + |
| 169 | +// @public |
| 170 | +export function getFirestore(app?: FirebaseApp): FirebaseFirestore; |
| 171 | + |
| 172 | +// @public |
| 173 | +export function increment(n: number): FieldValue; |
| 174 | + |
| 175 | +// @public |
| 176 | +export function initializeFirestore(app: FirebaseApp, settings: Settings): FirebaseFirestore; |
| 177 | + |
| 178 | +// @public |
| 179 | +export function limit(limit: number): QueryConstraint; |
| 180 | + |
| 181 | +// @public |
| 182 | +export function limitToLast(limit: number): QueryConstraint; |
| 183 | + |
| 184 | +export { LogLevel } |
| 185 | + |
| 186 | +// @public |
| 187 | +export function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryConstraint; |
| 188 | + |
| 189 | +// @public |
| 190 | +export type OrderByDirection = 'desc' | 'asc'; |
| 191 | + |
| 192 | +// @public |
| 193 | +export class Query<T = DocumentData> { |
| 194 | + protected constructor(); |
| 195 | + readonly converter: FirestoreDataConverter<T> | null; |
| 196 | + readonly firestore: FirebaseFirestore; |
| 197 | + readonly type: 'query' | 'collection'; |
| 198 | + withConverter(converter: null): Query<DocumentData>; |
| 199 | + withConverter<U>(converter: FirestoreDataConverter<U>): Query<U>; |
| 200 | +} |
| 201 | + |
| 202 | +// @public |
| 203 | +export function query<T>(query: Query<T>, ...queryConstraints: QueryConstraint[]): Query<T>; |
| 204 | + |
| 205 | +// @public |
| 206 | +export abstract class QueryConstraint { |
| 207 | + abstract readonly type: QueryConstraintType; |
| 208 | +} |
| 209 | + |
| 210 | +// @public |
| 211 | +export type QueryConstraintType = 'where' | 'orderBy' | 'limit' | 'limitToLast' | 'startAt' | 'startAfter' | 'endAt' | 'endBefore'; |
| 212 | + |
| 213 | +// @public |
| 214 | +export class QueryDocumentSnapshot<T = DocumentData> extends DocumentSnapshot<T> { |
| 215 | + // @override |
| 216 | + data(): T; |
| 217 | +} |
| 218 | + |
| 219 | +// @public |
| 220 | +export function queryEqual<T>(left: Query<T>, right: Query<T>): boolean; |
| 221 | + |
| 222 | +// @public |
| 223 | +export class QuerySnapshot<T = DocumentData> { |
| 224 | + get docs(): Array<QueryDocumentSnapshot<T>>; |
| 225 | + get empty(): boolean; |
| 226 | + forEach(callback: (result: QueryDocumentSnapshot<T>) => void, thisArg?: unknown): void; |
| 227 | + readonly query: Query<T>; |
| 228 | + get size(): number; |
| 229 | +} |
| 230 | + |
| 231 | +// @public |
| 232 | +export function refEqual<T>(left: DocumentReference<T> | CollectionReference<T>, right: DocumentReference<T> | CollectionReference<T>): boolean; |
| 233 | + |
| 234 | +// @public |
| 235 | +export function runTransaction<T>(firestore: FirebaseFirestore, updateFunction: (transaction: Transaction) => Promise<T>): Promise<T>; |
| 236 | + |
| 237 | +// @public |
| 238 | +export function serverTimestamp(): FieldValue; |
| 239 | + |
| 240 | +// @public |
| 241 | +export function setDoc<T>(reference: DocumentReference<T>, data: T): Promise<void>; |
| 242 | + |
| 243 | +// @public |
| 244 | +export function setDoc<T>(reference: DocumentReference<T>, data: Partial<T>, options: SetOptions): Promise<void>; |
| 245 | + |
| 246 | +// @public |
| 247 | +export function setLogLevel(logLevel: LogLevel): void; |
| 248 | + |
| 249 | +// @public |
| 250 | +export type SetOptions = { |
| 251 | + readonly merge?: boolean; |
| 252 | +} | { |
| 253 | + readonly mergeFields?: Array<string | FieldPath>; |
| 254 | +}; |
| 255 | + |
| 256 | +// @public |
| 257 | +export interface Settings { |
| 258 | + host?: string; |
| 259 | + ignoreUndefinedProperties?: boolean; |
| 260 | + ssl?: boolean; |
| 261 | +} |
| 262 | + |
| 263 | +// @public |
| 264 | +export function snapshotEqual<T>(left: DocumentSnapshot<T> | QuerySnapshot<T>, right: DocumentSnapshot<T> | QuerySnapshot<T>): boolean; |
| 265 | + |
| 266 | +// @public |
| 267 | +export function startAfter(snapshot: DocumentSnapshot<unknown>): QueryConstraint; |
| 268 | + |
| 269 | +// @public |
| 270 | +export function startAfter(...fieldValues: unknown[]): QueryConstraint; |
| 271 | + |
| 272 | +// @public |
| 273 | +export function startAt(snapshot: DocumentSnapshot<unknown>): QueryConstraint; |
| 274 | + |
| 275 | +// @public |
| 276 | +export function startAt(...fieldValues: unknown[]): QueryConstraint; |
| 277 | + |
| 278 | +// @public |
| 279 | +export function terminate(firestore: FirebaseFirestore): Promise<void>; |
| 280 | + |
| 281 | +// @public |
| 282 | +export class Timestamp { |
| 283 | + constructor( |
| 284 | + seconds: number, |
| 285 | + nanoseconds: number); |
| 286 | + static fromDate(date: Date): Timestamp; |
| 287 | + static fromMillis(milliseconds: number): Timestamp; |
| 288 | + isEqual(other: Timestamp): boolean; |
| 289 | + readonly nanoseconds: number; |
| 290 | + static now(): Timestamp; |
| 291 | + readonly seconds: number; |
| 292 | + toDate(): Date; |
| 293 | + toJSON(): { |
| 294 | + seconds: number; |
| 295 | + nanoseconds: number; |
| 296 | + }; |
| 297 | + toMillis(): number; |
| 298 | + toString(): string; |
| 299 | + valueOf(): string; |
| 300 | +} |
| 301 | + |
| 302 | +// @public |
| 303 | +export class Transaction { |
| 304 | + delete(documentRef: DocumentReference<unknown>): this; |
| 305 | + get<T>(documentRef: DocumentReference<T>): Promise<DocumentSnapshot<T>>; |
| 306 | + set<T>(documentRef: DocumentReference<T>, data: T): this; |
| 307 | + set<T>(documentRef: DocumentReference<T>, data: Partial<T>, options: SetOptions): this; |
| 308 | + update(documentRef: DocumentReference<unknown>, data: UpdateData): this; |
| 309 | + update(documentRef: DocumentReference<unknown>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): this; |
| 310 | +} |
| 311 | + |
| 312 | +// @public |
| 313 | +export interface UpdateData { |
| 314 | + [fieldPath: string]: any; |
| 315 | +} |
| 316 | + |
| 317 | +// @public |
| 318 | +export function updateDoc(reference: DocumentReference<unknown>, data: UpdateData): Promise<void>; |
| 319 | + |
| 320 | +// @public |
| 321 | +export function updateDoc(reference: DocumentReference<unknown>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): Promise<void>; |
| 322 | + |
| 323 | +// @public |
| 324 | +export function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryConstraint; |
| 325 | + |
| 326 | +// @public |
| 327 | +export type WhereFilterOp = '<' | '<=' | '==' | '!=' | '>=' | '>' | 'array-contains' | 'in' | 'array-contains-any' | 'not-in'; |
| 328 | + |
| 329 | +// @public |
| 330 | +export class WriteBatch { |
| 331 | + commit(): Promise<void>; |
| 332 | + delete(documentRef: DocumentReference<unknown>): WriteBatch; |
| 333 | + set<T>(documentRef: DocumentReference<T>, data: T): WriteBatch; |
| 334 | + set<T>(documentRef: DocumentReference<T>, data: Partial<T>, options: SetOptions): WriteBatch; |
| 335 | + update(documentRef: DocumentReference<unknown>, data: UpdateData): WriteBatch; |
| 336 | + update(documentRef: DocumentReference<unknown>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): WriteBatch; |
| 337 | +} |
| 338 | + |
| 339 | +// @public |
| 340 | +export function writeBatch(firestore: FirebaseFirestore): WriteBatch; |
| 341 | + |
| 342 | + |
| 343 | +``` |
0 commit comments