diff --git a/common/api-review/firestore-exp.api.md b/common/api-review/firestore-exp.api.md new file mode 100644 index 00000000000..397d8732654 --- /dev/null +++ b/common/api-review/firestore-exp.api.md @@ -0,0 +1,551 @@ +## API Report File for "@firebase/firestore-exp" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { DocumentData as DocumentData_2 } from '@firebase/firestore-types'; +import { FirebaseApp } from '@firebase/app-types-exp'; +import { FirebaseAuthInternalName } from '@firebase/auth-interop-types'; +import { _FirebaseService } from '@firebase/app-types-exp'; +import { LogLevelString as LogLevel } from '@firebase/logger'; +import { Provider } from '@firebase/component'; +import { SetOptions as SetOptions_2 } from '@firebase/firestore-types'; +import { SnapshotMetadata as SnapshotMetadata_2 } from '@firebase/firestore-types'; + +// @public +export function addDoc(reference: CollectionReference, data: T): Promise>; + +// @public +export function arrayRemove(...elements: unknown[]): FieldValue; + +// @public +export function arrayUnion(...elements: unknown[]): FieldValue; + +// @public +export class Bytes { + constructor(byteString: ByteString); + // Warning: (ae-forgotten-export) The symbol "ByteString" needs to be exported by the entry point index.d.ts + // + // (undocumented) + _byteString: ByteString; + static fromBase64String(base64: string): Bytes; + static fromUint8Array(array: Uint8Array): Bytes; + isEqual(other: Bytes): boolean; + toBase64(): string; + toString(): string; + toUint8Array(): Uint8Array; +} + +// @public +export const CACHE_SIZE_UNLIMITED = -1; + +// @public +export function clearIndexedDbPersistence(firestore: FirebaseFirestore): Promise; + +// Warning: (ae-forgotten-export) The symbol "FirebaseFirestore" needs to be exported by the entry point index.d.ts +// +// @public +export function collection(firestore: FirebaseFirestore_2, path: string, ...pathSegments: string[]): CollectionReference; + +// @public +export function collection(reference: CollectionReference, path: string, ...pathSegments: string[]): CollectionReference; + +// @public +export function collection(reference: DocumentReference, path: string, ...pathSegments: string[]): CollectionReference; + +// @public +export function collectionGroup(firestore: FirebaseFirestore_2, collectionId: string): Query; + +// @public +export class CollectionReference extends Query { + // Warning: (ae-forgotten-export) The symbol "FirestoreDataConverter" needs to be exported by the entry point index.d.ts + constructor(firestore: FirebaseFirestore_2, converter: FirestoreDataConverter_2 | null, _path: ResourcePath); + // (undocumented) + readonly firestore: FirebaseFirestore_2; + get id(): string; + get parent(): DocumentReference | null; + get path(): string; + // Warning: (ae-forgotten-export) The symbol "ResourcePath" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly _path: ResourcePath; + // (undocumented) + readonly type = "collection"; + withConverter(converter: FirestoreDataConverter_2): CollectionReference; +} + +// @public +export function deleteDoc(reference: DocumentReference): Promise; + +// @public +export function deleteField(): FieldValue; + +// @public +export function disableNetwork(firestore: FirebaseFirestore): Promise; + +// @public +export function doc(firestore: FirebaseFirestore_2, path: string, ...pathSegments: string[]): DocumentReference; + +// @public +export function doc(reference: CollectionReference, path?: string, ...pathSegments: string[]): DocumentReference; + +// @public +export function doc(reference: DocumentReference, path: string, ...pathSegments: string[]): DocumentReference; + +// @public +export interface DocumentChange { + readonly doc: QueryDocumentSnapshot; + readonly newIndex: number; + readonly oldIndex: number; + readonly type: DocumentChangeType; +} + +// @public +export type DocumentChangeType = 'added' | 'removed' | 'modified'; + +// @public +export interface DocumentData { + // (undocumented) + [field: string]: any; +} + +// @public +export function documentId(): FieldPath; + +// @public +export class DocumentReference { + constructor(firestore: FirebaseFirestore_2, _converter: FirestoreDataConverter_2 | null, _key: DocumentKey); + // (undocumented) + readonly _converter: FirestoreDataConverter_2 | null; + readonly firestore: FirebaseFirestore_2; + get id(): string; + // Warning: (ae-forgotten-export) The symbol "DocumentKey" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly _key: DocumentKey; + get parent(): CollectionReference; + get path(): string; + // (undocumented) + get _path(): ResourcePath; + readonly type = "document"; + withConverter(converter: FirestoreDataConverter_2): DocumentReference; +} + +// Warning: (ae-forgotten-export) The symbol "DocumentSnapshot" needs to be exported by the entry point index.d.ts +// +// @public +export class DocumentSnapshot extends DocumentSnapshot_2 { + // Warning: (ae-forgotten-export) The symbol "AbstractUserDataWriter" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "Document" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "UntypedFirestoreDataConverter" needs to be exported by the entry point index.d.ts + constructor(_firestore: FirebaseFirestore, userDataWriter: AbstractUserDataWriter, key: DocumentKey, document: Document_2 | null, metadata: SnapshotMetadata, converter: UntypedFirestoreDataConverter | null); + data(options?: SnapshotOptions): T | undefined; + exists(): this is QueryDocumentSnapshot; + // (undocumented) + readonly _firestore: FirebaseFirestore; + get(fieldPath: string | FieldPath, options?: SnapshotOptions): any; + readonly metadata: SnapshotMetadata; +} + +// @public +export function enableIndexedDbPersistence(firestore: FirebaseFirestore, persistenceSettings?: PersistenceSettings): Promise; + +// @public +export function enableMultiTabIndexedDbPersistence(firestore: FirebaseFirestore): Promise; + +// @public +export function enableNetwork(firestore: FirebaseFirestore): Promise; + +// @public +export function endAt(snapshot: DocumentSnapshot_2): QueryConstraint; + +// @public +export function endAt(...fieldValues: unknown[]): QueryConstraint; + +// @public +export function endBefore(snapshot: DocumentSnapshot_2): QueryConstraint; + +// @public +export function endBefore(...fieldValues: unknown[]): QueryConstraint; + +// @public +export class FieldPath { + constructor(...fieldNames: string[]); + // Warning: (ae-forgotten-export) The symbol "FieldPath" needs to be exported by the entry point index.d.ts + readonly _internalPath: FieldPath_2; + isEqual(other: FieldPath): boolean; +} + +// @public +export abstract class FieldValue { + constructor(_methodName: string); + // (undocumented) + abstract isEqual(other: FieldValue): boolean; + // (undocumented) + _methodName: string; + // Warning: (ae-forgotten-export) The symbol "ParseContext" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "FieldTransform" needs to be exported by the entry point index.d.ts + // + // (undocumented) + abstract _toFieldTransform(context: ParseContext): FieldTransform | null; +} + +// @public +export class FirebaseFirestore extends FirebaseFirestore_2 { + // Warning: (ae-forgotten-export) The symbol "DatabaseId" needs to be exported by the entry point index.d.ts + constructor(databaseIdOrApp: DatabaseId | FirebaseApp, authProvider: Provider); + // Warning: (ae-forgotten-export) The symbol "FirestoreClient" needs to be exported by the entry point index.d.ts + // + // (undocumented) + _firestoreClient: FirestoreClient | undefined; + // (undocumented) + readonly _persistenceKey: string; + // Warning: (ae-forgotten-export) The symbol "AsyncQueue" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly _queue: AsyncQueue; + // (undocumented) + _terminate(): Promise; +} + +// @public +export interface FirestoreDataConverter extends FirestoreDataConverter_2 { + fromFirestore(snapshot: QueryDocumentSnapshot, options?: SnapshotOptions): T; + toFirestore(modelObject: T): DocumentData; + toFirestore(modelObject: Partial, options: SetOptions): DocumentData; +} + +// @public +export class FirestoreError extends Error { + constructor(code: FirestoreErrorCode, message: string); + // (undocumented) + readonly code: FirestoreErrorCode; + // (undocumented) + readonly message: string; + // (undocumented) + readonly name: string; + // (undocumented) + 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); + _compareTo(other: GeoPoint): number; + isEqual(other: GeoPoint): boolean; + get latitude(): number; + get longitude(): number; + // (undocumented) + toJSON(): { + latitude: number; + longitude: number; + }; +} + +// @public +export function getDoc(reference: DocumentReference): Promise>; + +// @public +export function getDocFromCache(reference: DocumentReference): Promise>; + +// @public +export function getDocFromServer(reference: DocumentReference): Promise>; + +// @public +export function getDocs(query: Query): Promise>; + +// @public +export function getDocsFromCache(query: Query): Promise>; + +// @public +export function getDocsFromServer(query: Query): Promise>; + +// @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 onSnapshot(reference: DocumentReference, observer: { + next?: (snapshot: DocumentSnapshot) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; +}): Unsubscribe; + +// @public +export function onSnapshot(reference: DocumentReference, options: SnapshotListenOptions, observer: { + next?: (snapshot: DocumentSnapshot) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; +}): Unsubscribe; + +// @public +export function onSnapshot(reference: DocumentReference, onNext: (snapshot: DocumentSnapshot) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe; + +// @public +export function onSnapshot(reference: DocumentReference, options: SnapshotListenOptions, onNext: (snapshot: DocumentSnapshot) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe; + +// @public +export function onSnapshot(query: Query, observer: { + next?: (snapshot: QuerySnapshot) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; +}): Unsubscribe; + +// @public +export function onSnapshot(query: Query, options: SnapshotListenOptions, observer: { + next?: (snapshot: QuerySnapshot) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; +}): Unsubscribe; + +// @public +export function onSnapshot(query: Query, onNext: (snapshot: QuerySnapshot) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe; + +// @public +export function onSnapshot(query: Query, options: SnapshotListenOptions, onNext: (snapshot: QuerySnapshot) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe; + +// @public +export function onSnapshotsInSync(firestore: FirebaseFirestore, observer: { + next?: (value: void) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; +}): Unsubscribe; + +// @public +export function onSnapshotsInSync(firestore: FirebaseFirestore, onSync: () => void): Unsubscribe; + +// @public +export function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryConstraint; + +// @public +export type OrderByDirection = 'desc' | 'asc'; + +// @public (undocumented) +export interface PersistenceSettings { + // (undocumented) + forceOwnership?: boolean; +} + +// @public +export class Query { + constructor(firestore: FirebaseFirestore_2, _converter: FirestoreDataConverter_2 | null, _query: Query_2); + // (undocumented) + readonly _converter: FirestoreDataConverter_2 | null; + readonly firestore: FirebaseFirestore_2; + // Warning: (ae-forgotten-export) The symbol "Query" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly _query: Query_2; + readonly type: 'query' | 'collection'; + withConverter(converter: FirestoreDataConverter_2): Query; +} + +// @public +export function query(query: Query, ...queryConstraints: QueryConstraint[]): Query; + +// @public +export abstract class QueryConstraint { + abstract _apply(query: Query): Query; + abstract readonly type: QueryConstraintType; +} + +// @public +export type QueryConstraintType = 'where' | 'orderBy' | 'limit' | 'limitToLast' | 'startAt' | 'startAfter' | 'endAt' | 'endBefore'; + +// @public +export class QueryDocumentSnapshot extends DocumentSnapshot { + // @override + data(options?: SnapshotOptions): T; +} + +// @public +export function queryEqual(left: Query, right: Query): boolean; + +// @public +export class QuerySnapshot { + constructor(_firestore: FirebaseFirestore, _userDataWriter: AbstractUserDataWriter, query: Query, _snapshot: ViewSnapshot); + docChanges(options?: SnapshotListenOptions): Array>; + get docs(): Array>; + get empty(): boolean; + // (undocumented) + readonly _firestore: FirebaseFirestore; + forEach(callback: (result: QueryDocumentSnapshot) => void, thisArg?: unknown): void; + readonly metadata: SnapshotMetadata; + readonly query: Query; + get size(): number; + // Warning: (ae-forgotten-export) The symbol "ViewSnapshot" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly _snapshot: ViewSnapshot; + // (undocumented) + readonly _userDataWriter: AbstractUserDataWriter; +} + +// @public +export function refEqual(left: DocumentReference | CollectionReference, right: DocumentReference | CollectionReference): boolean; + +// @public +export function runTransaction(firestore: FirebaseFirestore, updateFunction: (transaction: Transaction) => Promise): Promise; + +// @public +export function serverTimestamp(): FieldValue; + +// @public +export function setDoc(reference: DocumentReference, data: T): Promise; + +// @public +export function setDoc(reference: DocumentReference, data: Partial, options: SetOptions): Promise; + +// @public +export function setLogLevel(logLevel: LogLevel): void; + +// @public +export type SetOptions = { + readonly merge?: boolean; +} | { + readonly mergeFields?: Array; +}; + +// Warning: (ae-forgotten-export) The symbol "Settings" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export interface Settings extends Settings_2 { + // (undocumented) + cacheSizeBytes?: number; +} + +// @public +export function snapshotEqual(left: DocumentSnapshot | QuerySnapshot, right: DocumentSnapshot | QuerySnapshot): boolean; + +// @public +export interface SnapshotListenOptions { + readonly includeMetadataChanges?: boolean; +} + +// @public +export class SnapshotMetadata implements SnapshotMetadata_2 { + constructor(hasPendingWrites: boolean, fromCache: boolean); + readonly fromCache: boolean; + readonly hasPendingWrites: boolean; + isEqual(other: SnapshotMetadata_2): boolean; +} + +// @public +export interface SnapshotOptions { + readonly serverTimestamps?: 'estimate' | 'previous' | 'none'; +} + +// @public +export function startAfter(snapshot: DocumentSnapshot_2): QueryConstraint; + +// @public +export function startAfter(...fieldValues: unknown[]): QueryConstraint; + +// @public +export function startAt(snapshot: DocumentSnapshot_2): QueryConstraint; + +// @public +export function startAt(...fieldValues: unknown[]): QueryConstraint; + +// @public +export function terminate(firestore: FirebaseFirestore): Promise; + +// @public +export class Timestamp { + constructor(seconds: number, nanoseconds: number); + // (undocumented) + _compareTo(other: Timestamp): number; + static fromDate(date: Date): Timestamp; + static fromMillis(milliseconds: number): Timestamp; + isEqual(other: Timestamp): boolean; + // (undocumented) + readonly nanoseconds: number; + static now(): Timestamp; + // (undocumented) + readonly seconds: number; + toDate(): Date; + // (undocumented) + toJSON(): { + seconds: number; + nanoseconds: number; + }; + toMillis(): number; + // (undocumented) + toString(): string; + valueOf(): string; +} + +// Warning: (ae-forgotten-export) The symbol "Transaction" needs to be exported by the entry point index.d.ts +// +// @public +export class Transaction extends Transaction_2 { + // Warning: (ae-forgotten-export) The symbol "Transaction" needs to be exported by the entry point index.d.ts + constructor(_firestore: FirebaseFirestore, _transaction: Transaction_3); + // (undocumented) + protected readonly _firestore: FirebaseFirestore; + get(documentRef: DocumentReference): Promise>; +} + +// @public (undocumented) +export interface Unsubscribe { + // (undocumented) + (): void; +} + +// @public +export interface UpdateData { + // (undocumented) + [fieldPath: string]: any; +} + +// @public +export function updateDoc(reference: DocumentReference, data: UpdateData): Promise; + +// @public +export function updateDoc(reference: DocumentReference, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): Promise; + +// @public +export function waitForPendingWrites(firestore: FirebaseFirestore): Promise; + +// @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 { + // Warning: (ae-forgotten-export) The symbol "Mutation" needs to be exported by the entry point index.d.ts + constructor(_firestore: FirebaseFirestore_2, _commitHandler: (m: Mutation[]) => Promise); + commit(): Promise; + delete(documentRef: DocumentReference): WriteBatch; + set(documentRef: DocumentReference, data: T): WriteBatch; + set(documentRef: DocumentReference, data: Partial, options: SetOptions): WriteBatch; + update(documentRef: DocumentReference, data: UpdateData): WriteBatch; + update(documentRef: DocumentReference, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): WriteBatch; + } + +// @public +export function writeBatch(firestore: FirebaseFirestore): WriteBatch; + + +// (No @packageDocumentation comment for this package) + +``` diff --git a/common/api-review/firestore-lite.api.md b/common/api-review/firestore-lite.api.md new file mode 100644 index 00000000000..7ac55704d52 --- /dev/null +++ b/common/api-review/firestore-lite.api.md @@ -0,0 +1,454 @@ +## API Report File for "@firebase/firestore-lite" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { DocumentData as DocumentData_2 } from '@firebase/firestore-types'; +import { FirebaseApp } from '@firebase/app-types-exp'; +import { FirebaseAuthInternalName } from '@firebase/auth-interop-types'; +import { _FirebaseService } from '@firebase/app-types-exp'; +import { LogLevel } from '@firebase/logger'; +import { LogLevelString } from '@firebase/logger'; +import { Provider } from '@firebase/component'; +import { SetOptions as SetOptions_2 } from '@firebase/firestore-types'; + +// @public +export function addDoc(reference: CollectionReference, data: T): Promise>; + +// @public +export function arrayRemove(...elements: unknown[]): FieldValue; + +// @public +export function arrayUnion(...elements: unknown[]): FieldValue; + +// @public +export class Bytes { + constructor(byteString: ByteString); + // Warning: (ae-forgotten-export) The symbol "ByteString" needs to be exported by the entry point index.d.ts + // + // (undocumented) + _byteString: ByteString; + 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; + +// @public +export function collection(reference: CollectionReference, path: string, ...pathSegments: string[]): CollectionReference; + +// @public +export function collection(reference: DocumentReference, path: string, ...pathSegments: string[]): CollectionReference; + +// @public +export function collectionGroup(firestore: FirebaseFirestore, collectionId: string): Query; + +// @public +export class CollectionReference extends Query { + constructor(firestore: FirebaseFirestore, converter: FirestoreDataConverter | null, _path: ResourcePath); + // (undocumented) + readonly firestore: FirebaseFirestore; + get id(): string; + get parent(): DocumentReference | null; + get path(): string; + // Warning: (ae-forgotten-export) The symbol "ResourcePath" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly _path: ResourcePath; + // (undocumented) + readonly type = "collection"; + withConverter(converter: FirestoreDataConverter): CollectionReference; +} + +// @public +export function deleteDoc(reference: DocumentReference): Promise; + +// @public +export function deleteField(): FieldValue; + +// @public +export function doc(firestore: FirebaseFirestore, path: string, ...pathSegments: string[]): DocumentReference; + +// @public +export function doc(reference: CollectionReference, path?: string, ...pathSegments: string[]): DocumentReference; + +// @public +export function doc(reference: DocumentReference, path: string, ...pathSegments: string[]): DocumentReference; + +// @public +export interface DocumentData { + // (undocumented) + [field: string]: any; +} + +// @public +export function documentId(): FieldPath; + +// @public +export class DocumentReference { + constructor(firestore: FirebaseFirestore, _converter: FirestoreDataConverter | null, _key: DocumentKey); + // (undocumented) + readonly _converter: FirestoreDataConverter | null; + readonly firestore: FirebaseFirestore; + get id(): string; + // Warning: (ae-forgotten-export) The symbol "DocumentKey" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly _key: DocumentKey; + get parent(): CollectionReference; + get path(): string; + // (undocumented) + get _path(): ResourcePath; + readonly type = "document"; + withConverter(converter: FirestoreDataConverter): DocumentReference; +} + +// @public +export class DocumentSnapshot { + constructor(_firestore: FirebaseFirestore, _userDataWriter: AbstractUserDataWriter, _key: DocumentKey, _document: Document_2 | null, _converter: UntypedFirestoreDataConverter | null); + // Warning: (ae-forgotten-export) The symbol "UntypedFirestoreDataConverter" needs to be exported by the entry point index.d.ts + // + // (undocumented) + _converter: UntypedFirestoreDataConverter | null; + data(): T | undefined; + // Warning: (ae-forgotten-export) The symbol "Document" needs to be exported by the entry point index.d.ts + // + // (undocumented) + _document: Document_2 | null; + exists(): this is QueryDocumentSnapshot; + // (undocumented) + _firestore: FirebaseFirestore; + get(fieldPath: string | FieldPath): any; + get id(): string; + // (undocumented) + _key: DocumentKey; + get ref(): DocumentReference; + // Warning: (ae-forgotten-export) The symbol "AbstractUserDataWriter" needs to be exported by the entry point index.d.ts + // + // (undocumented) + _userDataWriter: AbstractUserDataWriter; +} + +// @public +export function endAt(snapshot: DocumentSnapshot): QueryConstraint; + +// @public +export function endAt(...fieldValues: unknown[]): QueryConstraint; + +// @public +export function endBefore(snapshot: DocumentSnapshot): QueryConstraint; + +// @public +export function endBefore(...fieldValues: unknown[]): QueryConstraint; + +// @public +export class FieldPath { + constructor(...fieldNames: string[]); + // Warning: (ae-forgotten-export) The symbol "FieldPath" needs to be exported by the entry point index.d.ts + readonly _internalPath: FieldPath_2; + isEqual(other: FieldPath): boolean; +} + +// @public +export abstract class FieldValue { + constructor(_methodName: string); + // (undocumented) + abstract isEqual(other: FieldValue): boolean; + // (undocumented) + _methodName: string; + // Warning: (ae-forgotten-export) The symbol "ParseContext" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "FieldTransform" needs to be exported by the entry point index.d.ts + // + // (undocumented) + abstract _toFieldTransform(context: ParseContext): FieldTransform | null; +} + +// @public +export class FirebaseFirestore implements _FirebaseService { + constructor(databaseIdOrApp: DatabaseId | FirebaseApp, authProvider: Provider); + get app(): FirebaseApp; + // Warning: (ae-forgotten-export) The symbol "CredentialsProvider" needs to be exported by the entry point index.d.ts + // + // (undocumented) + _credentials: CredentialsProvider; + // Warning: (ae-forgotten-export) The symbol "DatabaseId" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly _databaseId: DatabaseId; + // (undocumented) + _delete(): Promise; + // (undocumented) + _freezeSettings(): FirestoreSettings; + // Warning: (ae-forgotten-export) The symbol "FirestoreSettings" needs to be exported by the entry point index.d.ts + // + // (undocumented) + _getSettings(): FirestoreSettings; + // (undocumented) + get _initialized(): boolean; + // (undocumented) + readonly _persistenceKey: string; + // Warning: (ae-forgotten-export) The symbol "PrivateSettings" needs to be exported by the entry point index.d.ts + // + // (undocumented) + _setSettings(settings: PrivateSettings): void; + protected _terminate(): Promise; + // (undocumented) + get _terminated(): boolean; + } + +// @public +export interface FirestoreDataConverter { + fromFirestore(snapshot: QueryDocumentSnapshot): T; + toFirestore(modelObject: T): DocumentData; + toFirestore(modelObject: Partial, options: SetOptions): DocumentData; +} + +// @public +export class FirestoreError extends Error { + constructor(code: FirestoreErrorCode, message: string); + // (undocumented) + readonly code: FirestoreErrorCode; + // (undocumented) + readonly message: string; + // (undocumented) + readonly name: string; + // (undocumented) + 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); + _compareTo(other: GeoPoint): number; + isEqual(other: GeoPoint): boolean; + get latitude(): number; + get longitude(): number; + // (undocumented) + toJSON(): { + latitude: number; + longitude: number; + }; +} + +// @public +export function getDoc(reference: DocumentReference): Promise>; + +// @public +export function getDocs(query: Query): Promise>; + +// @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 } + +export { LogLevelString } + +// @public +export function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryConstraint; + +// @public +export type OrderByDirection = 'desc' | 'asc'; + +// @public +export class Query { + constructor(firestore: FirebaseFirestore, _converter: FirestoreDataConverter | null, _query: Query_2); + // (undocumented) + readonly _converter: FirestoreDataConverter | null; + readonly firestore: FirebaseFirestore; + // Warning: (ae-forgotten-export) The symbol "Query" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly _query: Query_2; + readonly type: 'query' | 'collection'; + withConverter(converter: FirestoreDataConverter): Query; +} + +// @public +export function query(query: Query, ...queryConstraints: QueryConstraint[]): Query; + +// @public +export abstract class QueryConstraint { + abstract _apply(query: Query): Query; + abstract readonly type: QueryConstraintType; +} + +// @public +export type QueryConstraintType = 'where' | 'orderBy' | 'limit' | 'limitToLast' | 'startAt' | 'startAfter' | 'endAt' | 'endBefore'; + +// @public +export class QueryDocumentSnapshot extends DocumentSnapshot { + // @override + data(): T; +} + +// @public +export function queryEqual(left: Query, right: Query): boolean; + +// @public +export class QuerySnapshot { + constructor(_query: Query, _docs: Array>); + get docs(): Array>; + // (undocumented) + readonly _docs: Array>; + get empty(): boolean; + forEach(callback: (result: QueryDocumentSnapshot) => void, thisArg?: unknown): void; + readonly query: Query; + get size(): number; +} + +// @public +export function refEqual(left: DocumentReference | CollectionReference, right: DocumentReference | CollectionReference): boolean; + +// @public +export function runTransaction(firestore: FirebaseFirestore, updateFunction: (transaction: Transaction) => Promise): Promise; + +// @public +export function serverTimestamp(): FieldValue; + +// @public +export function setDoc(reference: DocumentReference, data: T): Promise; + +// @public +export function setDoc(reference: DocumentReference, data: Partial, options: SetOptions): Promise; + +// @public +export function setLogLevel(logLevel: LogLevelString): void; + +// @public +export type SetOptions = { + readonly merge?: boolean; +} | { + readonly mergeFields?: Array; +}; + +// @public (undocumented) +export interface Settings { + // (undocumented) + cacheSizeBytes?: number; + // (undocumented) + experimentalAutoDetectLongPolling?: boolean; + // (undocumented) + experimentalForceLongPolling?: boolean; + // (undocumented) + host?: string; + // (undocumented) + ignoreUndefinedProperties?: boolean; + // (undocumented) + ssl?: boolean; +} + +// @public +export function snapshotEqual(left: DocumentSnapshot | QuerySnapshot, right: DocumentSnapshot | QuerySnapshot): boolean; + +// @public +export function startAfter(snapshot: DocumentSnapshot): QueryConstraint; + +// @public +export function startAfter(...fieldValues: unknown[]): QueryConstraint; + +// @public +export function startAt(snapshot: DocumentSnapshot): QueryConstraint; + +// @public +export function startAt(...fieldValues: unknown[]): QueryConstraint; + +// @public +export function terminate(firestore: FirebaseFirestore): Promise; + +// @public +export class Timestamp { + constructor(seconds: number, nanoseconds: number); + // (undocumented) + _compareTo(other: Timestamp): number; + static fromDate(date: Date): Timestamp; + static fromMillis(milliseconds: number): Timestamp; + isEqual(other: Timestamp): boolean; + // (undocumented) + readonly nanoseconds: number; + static now(): Timestamp; + // (undocumented) + readonly seconds: number; + toDate(): Date; + // (undocumented) + toJSON(): { + seconds: number; + nanoseconds: number; + }; + toMillis(): number; + // (undocumented) + toString(): string; + valueOf(): string; +} + +// @public +export class Transaction { + // Warning: (ae-forgotten-export) The symbol "Transaction" needs to be exported by the entry point index.d.ts + constructor(_firestore: FirebaseFirestore, _transaction: Transaction_2); + delete(documentRef: DocumentReference): this; + // (undocumented) + protected readonly _firestore: FirebaseFirestore; + get(documentRef: DocumentReference): Promise>; + set(documentRef: DocumentReference, data: T): this; + set(documentRef: DocumentReference, data: Partial, options: SetOptions): this; + update(documentRef: DocumentReference, data: UpdateData): this; + update(documentRef: DocumentReference, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): this; +} + +// @public +export interface UpdateData { + // (undocumented) + [fieldPath: string]: any; +} + +// @public +export function updateDoc(reference: DocumentReference, data: UpdateData): Promise; + +// @public +export function updateDoc(reference: DocumentReference, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): Promise; + +// @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 { + // Warning: (ae-forgotten-export) The symbol "Mutation" needs to be exported by the entry point index.d.ts + constructor(_firestore: FirebaseFirestore, _commitHandler: (m: Mutation[]) => Promise); + commit(): Promise; + delete(documentRef: DocumentReference): WriteBatch; + set(documentRef: DocumentReference, data: T): WriteBatch; + set(documentRef: DocumentReference, data: Partial, options: SetOptions): WriteBatch; + update(documentRef: DocumentReference, data: UpdateData): WriteBatch; + update(documentRef: DocumentReference, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): WriteBatch; + } + +// @public +export function writeBatch(firestore: FirebaseFirestore): WriteBatch; + + +// (No @packageDocumentation comment for this package) + +``` diff --git a/package.json b/package.json index af24014a636..4d47ca4223e 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,7 @@ "@types/chai-as-promised": "7.1.3", "@types/child-process-promise": "2.2.1", "@types/clone": "2.1.0", + "@types/eslint": "7.2.5", "@types/inquirer": "7.3.1", "@types/listr": "0.14.2", "@types/long": "4.0.1", diff --git a/packages/firestore/.eslintrc.js b/packages/firestore/.eslintrc.js index 6ebf8eb3031..22cd4777f9e 100644 --- a/packages/firestore/.eslintrc.js +++ b/packages/firestore/.eslintrc.js @@ -46,6 +46,15 @@ module.exports = { ] }, overrides: [ + { + files: ['**/*.d.ts'], + rules: { + 'camelcase': 'off', + 'import/no-duplicates': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unused-vars': 'off' + } + }, { files: ['**/*.test.ts', '**/test/**/*.ts'], rules: { diff --git a/packages/firestore/exp-types/index.d.ts b/packages/firestore/exp-types/index.d.ts deleted file mode 100644 index 5c1bb7f2b68..00000000000 --- a/packages/firestore/exp-types/index.d.ts +++ /dev/null @@ -1,548 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { FirebaseApp } from '@firebase/app-types-exp'; - -/* eslint-disable @typescript-eslint/no-explicit-any */ - -export interface DocumentData { - [field: string]: any; -} - -export interface UpdateData { - [fieldPath: string]: any; -} - -export const CACHE_SIZE_UNLIMITED: number; - -export interface Settings { - host?: string; - ssl?: boolean; - ignoreUndefinedProperties?: boolean; - cacheSizeBytes?: number; -} - -export interface PersistenceSettings { - forceOwnership?: boolean; -} - -export interface SnapshotListenOptions { - readonly includeMetadataChanges?: boolean; -} - -export interface SnapshotOptions { - readonly serverTimestamps?: 'estimate' | 'previous' | 'none'; -} - -export class SnapshotMetadata { - private constructor(); - - readonly hasPendingWrites: boolean; - readonly fromCache: boolean; - - isEqual(other: SnapshotMetadata): boolean; -} - -export type LogLevel = - | 'debug' - | 'error' - | 'silent' - | 'warn' - | 'info' - | 'verbose'; - -export function setLogLevel(logLevel: LogLevel): void; - -export interface FirestoreDataConverter { - toFirestore(modelObject: T): DocumentData; - toFirestore(modelObject: Partial, options: SetOptions): DocumentData; - fromFirestore( - snapshot: QueryDocumentSnapshot, - options?: SnapshotOptions - ): T; -} - -export class FirebaseFirestore { - private constructor(); - readonly app: FirebaseApp; -} - -export function initializeFirestore( - app: FirebaseApp, - settings: Settings -): FirebaseFirestore; -export function getFirestore(app: FirebaseApp): FirebaseFirestore; - -export function terminate(firestore: FirebaseFirestore): Promise; -export function writeBatch(firestore: FirebaseFirestore): WriteBatch; -export function runTransaction( - firestore: FirebaseFirestore, - updateFunction: (transaction: Transaction) => Promise -): Promise; -export function waitForPendingWrites( - firestore: FirebaseFirestore -): Promise; -export function enableNetwork(firestore: FirebaseFirestore): Promise; -export function disableNetwork(firestore: FirebaseFirestore): Promise; - -export function enableIndexedDbPersistence( - firestore: FirebaseFirestore, - persistenceSettings?: PersistenceSettings -): Promise; -export function enableMultiTabIndexedDbPersistence( - firestore: FirebaseFirestore -): Promise; -export function clearIndexedDbPersistence( - firestore: FirebaseFirestore -): Promise; - -export function collection( - firestore: FirebaseFirestore, - path: string, - ...pathComponents: string[] -): CollectionReference; -export function collection( - reference: CollectionReference, - path: string, - ...pathComponents: string[] -): CollectionReference; -export function collection( - reference: DocumentReference, - path: string, - ...pathComponents: string[] -): CollectionReference; -export function doc( - firestore: FirebaseFirestore, - path: string, - ...pathComponents: string[] -): DocumentReference; -export function doc( - reference: CollectionReference, - path?: string, - ...pathComponents: string[] -): DocumentReference; -export function doc( - reference: DocumentReference, - path: string, - ...pathComponents: string[] -): DocumentReference; -export function collectionGroup( - firestore: FirebaseFirestore, - collectionId: string -): Query; - -export class GeoPoint { - constructor(latitude: number, longitude: number); - - readonly latitude: number; - readonly longitude: number; - - isEqual(other: GeoPoint): boolean; -} - -export class Timestamp { - constructor(seconds: number, nanoseconds: number); - - static now(): Timestamp; - - static fromDate(date: Date): Timestamp; - - static fromMillis(milliseconds: number): Timestamp; - - readonly seconds: number; - readonly nanoseconds: number; - - toDate(): Date; - - toMillis(): number; - - isEqual(other: Timestamp): boolean; - - valueOf(): string; -} - -export class Bytes { - private constructor(); - - static fromBase64String(base64: string): Blob; - - static fromUint8Array(array: Uint8Array): Blob; - - toBase64(): string; - - toUint8Array(): Uint8Array; - - isEqual(other: Blob): boolean; -} - -export class Transaction { - private constructor(); - - get(documentRef: DocumentReference): Promise>; - - set(documentRef: DocumentReference, data: T): Transaction; - set( - documentRef: DocumentReference, - data: Partial, - options: SetOptions - ): Transaction; - - update(documentRef: DocumentReference, data: UpdateData): Transaction; - update( - documentRef: DocumentReference, - field: string | FieldPath, - value: any, - ...moreFieldsAndValues: any[] - ): Transaction; - - delete(documentRef: DocumentReference): Transaction; -} - -export class WriteBatch { - private constructor(); - - set(documentRef: DocumentReference, data: T): WriteBatch; - set( - documentRef: DocumentReference, - data: Partial, - options: SetOptions - ): WriteBatch; - - update(documentRef: DocumentReference, data: UpdateData): WriteBatch; - update( - documentRef: DocumentReference, - field: string | FieldPath, - value: any, - ...moreFieldsAndValues: any[] - ): WriteBatch; - - delete(documentRef: DocumentReference): WriteBatch; - - commit(): Promise; -} - -export type SetOptions = - | { - readonly merge?: boolean; - } - | { - readonly mergeFields?: Array; - }; - -export class DocumentReference { - private constructor(); - readonly type: 'document'; - readonly firestore: FirebaseFirestore; - readonly converter: FirestoreDataConverter | null; - readonly path: string; - readonly id: string; - - get parent(): CollectionReference; - - withConverter(converter: FirestoreDataConverter): DocumentReference; -} - -export class DocumentSnapshot { - protected constructor(); - - readonly ref: DocumentReference; - readonly id: string; - readonly metadata: SnapshotMetadata; - - exists(): this is QueryDocumentSnapshot; - - data(options?: SnapshotOptions): T | undefined; - - get(fieldPath: string | FieldPath, options?: SnapshotOptions): any; -} - -export class QueryDocumentSnapshot extends DocumentSnapshot< - T -> { - data(options?: SnapshotOptions): T; -} - -export type OrderByDirection = 'desc' | 'asc'; - -export type WhereFilterOp = - | '<' - | '<=' - | '==' - | '!=' - | '>=' - | '>' - | 'array-contains' - | 'in' - | 'array-contains-any' - | 'not-in'; - -export class Query { - protected constructor(); - readonly type: 'query' | 'collection'; - readonly firestore: FirebaseFirestore; - readonly converter: FirestoreDataConverter | null; - - withConverter(converter: FirestoreDataConverter): Query; -} - -export type QueryConstraintType = - | 'where' - | 'orderBy' - | 'limit' - | 'limitToLast' - | 'startAt' - | 'startAfter' - | 'endAt' - | 'endBefore'; - -export class QueryConstraint { - private constructor(); - readonly type: QueryConstraintType; -} - -export function query( - query: CollectionReference | Query, - ...constraints: QueryConstraint[] -): Query; - -export function where( - fieldPath: string | FieldPath, - opStr: WhereFilterOp, - value: any -): QueryConstraint; -export function orderBy( - fieldPath: string | FieldPath, - directionStr?: OrderByDirection -): QueryConstraint; -export function limit(limit: number): QueryConstraint; -export function limitToLast(limit: number): QueryConstraint; -export function startAt(snapshot: DocumentSnapshot): QueryConstraint; -export function startAt(...fieldValues: any[]): QueryConstraint; -export function startAfter(snapshot: DocumentSnapshot): QueryConstraint; -export function startAfter(...fieldValues: any[]): QueryConstraint; -export function endBefore(snapshot: DocumentSnapshot): QueryConstraint; -export function endBefore(...fieldValues: any[]): QueryConstraint; -export function endAt(snapshot: DocumentSnapshot): QueryConstraint; -export function endAt(...fieldValues: any[]): QueryConstraint; - -export class QuerySnapshot { - private constructor(); - readonly query: Query; - readonly docs: Array>; - readonly metadata: SnapshotMetadata; - readonly size: number; - readonly empty: boolean; - docChanges(options?: SnapshotListenOptions): Array>; - forEach( - callback: (result: QueryDocumentSnapshot) => void, - thisArg?: any - ): void; -} - -export type DocumentChangeType = 'added' | 'removed' | 'modified'; - -export interface DocumentChange { - readonly type: DocumentChangeType; - readonly doc: QueryDocumentSnapshot; - readonly oldIndex: number; - readonly newIndex: number; -} - -export class CollectionReference extends Query { - private constructor(); - readonly type: 'collection'; - readonly id: string; - readonly path: string; - - get parent(): DocumentReference | null; - - withConverter( - converter: FirestoreDataConverter - ): CollectionReference; -} - -export function getDoc( - reference: DocumentReference -): Promise>; -export function getDocFromCache( - reference: DocumentReference -): Promise>; -export function getDocFromServer( - reference: DocumentReference -): Promise>; -export function getDocs(query: Query): Promise>; -export function getDocsFromCache(query: Query): Promise>; -export function getDocsFromServer( - query: Query -): Promise>; - -export function addDoc( - reference: CollectionReference, - data: T -): Promise>; -export function setDoc( - reference: DocumentReference, - data: T -): Promise; -export function setDoc( - reference: DocumentReference, - data: Partial, - options: SetOptions -): Promise; -export function updateDoc( - reference: DocumentReference, - data: UpdateData -): Promise; -export function updateDoc( - reference: DocumentReference, - field: string | FieldPath, - value: any, - ...moreFieldsAndValues: any[] -): Promise; -export function deleteDoc(reference: DocumentReference): Promise; - -export function onSnapshot( - reference: DocumentReference, - observer: { - next?: (snapshot: DocumentSnapshot) => void; - error?: (error: FirestoreError) => void; - complete?: () => void; - } -): () => void; -export function onSnapshot( - reference: DocumentReference, - options: SnapshotListenOptions, - observer: { - next?: (snapshot: DocumentSnapshot) => void; - error?: (error: FirestoreError) => void; - complete?: () => void; - } -): () => void; -export function onSnapshot( - reference: DocumentReference, - onNext: (snapshot: DocumentSnapshot) => void, - onError?: (error: FirestoreError) => void, - onCompletion?: () => void -): () => void; -export function onSnapshot( - reference: DocumentReference, - options: SnapshotListenOptions, - onNext: (snapshot: DocumentSnapshot) => void, - onError?: (error: FirestoreError) => void, - onCompletion?: () => void -): () => void; -export function onSnapshot( - query: Query, - observer: { - next?: (snapshot: QuerySnapshot) => void; - error?: (error: FirestoreError) => void; - complete?: () => void; - } -): () => void; -export function onSnapshot( - query: Query, - options: SnapshotListenOptions, - observer: { - next?: (snapshot: QuerySnapshot) => void; - error?: (error: FirestoreError) => void; - complete?: () => void; - } -): () => void; -export function onSnapshot( - query: Query, - onNext: (snapshot: QuerySnapshot) => void, - onError?: (error: FirestoreError) => void, - onCompletion?: () => void -): () => void; -export function onSnapshot( - query: Query, - options: SnapshotListenOptions, - onNext: (snapshot: QuerySnapshot) => void, - onError?: (error: FirestoreError) => void, - onCompletion?: () => void -): () => void; -export function onSnapshotsInSync( - firestore: FirebaseFirestore, - observer: { - next?: (value: void) => void; - error?: (error: FirestoreError) => void; - complete?: () => void; - } -): () => void; -export function onSnapshotsInSync( - firestore: FirebaseFirestore, - onSync: () => void -): () => void; - -export class FieldValue { - private constructor(); - isEqual(other: FieldValue): boolean; -} - -export function serverTimestamp(): FieldValue; -export function deleteField(): FieldValue; -export function arrayUnion(...elements: any[]): FieldValue; -export function arrayRemove(...elements: any[]): FieldValue; -export function increment(n: number): FieldValue; - -export class FieldPath { - constructor(...fieldNames: string[]); - isEqual(other: FieldPath): boolean; -} - -export function documentId(): FieldPath; - -export function refEqual( - left: DocumentReference | CollectionReference, - right: DocumentReference | CollectionReference -): boolean; -export function queryEqual(left: Query, right: Query): boolean; -export function snapshotEqual( - left: DocumentSnapshot | QuerySnapshot, - right: DocumentSnapshot | QuerySnapshot -): boolean; - -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'; - -export interface FirestoreError { - code: FirestoreErrorCode; - message: string; - name: string; - stack?: string; -} - -declare module '@firebase/component' { - interface NameServiceMapping { - 'firestore-exp': FirebaseFirestore; - } -} diff --git a/packages/firestore/exp/api-extractor.json b/packages/firestore/exp/api-extractor.json new file mode 100644 index 00000000000..0842449931b --- /dev/null +++ b/packages/firestore/exp/api-extractor.json @@ -0,0 +1,23 @@ +{ + "extends": "../../../config/api-extractor.json", + "mainEntryPointFilePath": "../dist/firestore/exp/index.d.ts", + "dtsRollup": { + "enabled": true, + "publicTrimmedFilePath": "../dist/exp/private.d.ts" + }, + "messages": { + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + }, + "tsdocMessageReporting": { + "tsdoc-undefined-tag": { + "logLevel": "none" + } + } + } +} diff --git a/packages/firestore/exp/package.json b/packages/firestore/exp/package.json index ade9dc962bf..9d28e74e60d 100644 --- a/packages/firestore/exp/package.json +++ b/packages/firestore/exp/package.json @@ -1,11 +1,11 @@ { - "name": "@firebase/firestore/exp", + "name": "@firebase/firestore-exp", "description": "A tree-shakeable version of the Firestore SDK", "main": "../dist/exp/index.node.umd.js", "main-esm": "../dist/exp/index.node.esm2017.js", "module": "../dist/exp/index.browser.esm2017.js", "browser": "../dist/exp/index.browser.esm2017.js", "react-native": "../dist/exp/index.rn.esm2017.js", - "typings": "../exp-types/index.d.ts", + "typings": "../dist/exp/index.d.ts", "private": true } diff --git a/packages/firestore/exp/src/api/database.ts b/packages/firestore/exp/src/api/database.ts index 20b534593dd..2cde77fde64 100644 --- a/packages/firestore/exp/src/api/database.ts +++ b/packages/firestore/exp/src/api/database.ts @@ -70,7 +70,7 @@ export interface Settings extends LiteSettings { /** * The Cloud Firestore service interface. * - * Do not call this constructor directly. Instead, use {@link getFirestore()}. + * Do not call this constructor directly. Instead, use {@link getFirestore}. */ export class FirebaseFirestore extends LiteFirestore { readonly _queue = new AsyncQueue(); diff --git a/packages/firestore/exp/src/api/snapshot.ts b/packages/firestore/exp/src/api/snapshot.ts index db80e1af253..8ad21d17140 100644 --- a/packages/firestore/exp/src/api/snapshot.ts +++ b/packages/firestore/exp/src/api/snapshot.ts @@ -176,9 +176,9 @@ export interface DocumentChange { * access will return 'undefined'. You can use the `exists()` method to * explicitly verify a document's existence. */ -export class DocumentSnapshot extends LiteDocumentSnapshot< - T -> { +export class DocumentSnapshot< + T = DocumentData +> extends LiteDocumentSnapshot { private readonly _firestoreImpl: FirebaseFirestore; /** @@ -291,9 +291,9 @@ export class DocumentSnapshot extends LiteDocumentSnapshot< * `exists` property will always be true and `data()` will never return * 'undefined'. */ -export class QueryDocumentSnapshot extends DocumentSnapshot< - T -> { +export class QueryDocumentSnapshot< + T = DocumentData +> extends DocumentSnapshot { /** * Retrieves all fields in the document as an `Object`. * diff --git a/packages/firestore/externs.json b/packages/firestore/externs.json index 1a7749da1a1..313b3e93430 100644 --- a/packages/firestore/externs.json +++ b/packages/firestore/externs.json @@ -17,8 +17,8 @@ "packages-exp/app-exp/dist/app-exp.d.ts", "packages-exp/app-types-exp/index.d.ts", "packages/auth-interop-types/index.d.ts", - "packages/firestore/exp-types/index.d.ts", - "packages/firestore/lite-types/index.d.ts", + "packages/firestore/dist/lite/index.d.ts", + "packages/firestore/dist/exp/index.d.ts", "packages/firestore-types/index.d.ts", "packages/firebase/index.d.ts", "packages/component/dist/src/component.d.ts", diff --git a/packages/firestore/lite-types/index.d.ts b/packages/firestore/lite-types/index.d.ts deleted file mode 100644 index 40806fa50d5..00000000000 --- a/packages/firestore/lite-types/index.d.ts +++ /dev/null @@ -1,404 +0,0 @@ -/** - * @license - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { FirebaseApp } from '@firebase/app-types-exp'; - -/* eslint-disable @typescript-eslint/no-explicit-any */ - -export interface DocumentData { - [field: string]: any; -} - -export interface UpdateData { - [fieldPath: string]: any; -} - -export interface Settings { - host?: string; - ssl?: boolean; - ignoreUndefinedProperties?: boolean; -} - -export type LogLevel = - | 'debug' - | 'error' - | 'silent' - | 'warn' - | 'info' - | 'verbose'; - -export function setLogLevel(logLevel: LogLevel): void; - -export interface FirestoreDataConverter { - toFirestore(modelObject: T): DocumentData; - toFirestore(modelObject: Partial, options: SetOptions): DocumentData; - fromFirestore(snapshot: QueryDocumentSnapshot): T; -} - -export class FirebaseFirestore { - private constructor(); - readonly app: FirebaseApp; -} - -export function initializeFirestore( - app: FirebaseApp, - settings: Settings -): FirebaseFirestore; -export function getFirestore(app: FirebaseApp): FirebaseFirestore; -export function terminate(firestore: FirebaseFirestore): Promise; -export function writeBatch(firestore: FirebaseFirestore): WriteBatch; -export function runTransaction( - firestore: FirebaseFirestore, - updateFunction: (transaction: Transaction) => Promise -): Promise; - -export function collection( - firestore: FirebaseFirestore, - path: string, - ...pathComponents: string[] -): CollectionReference; -export function collection( - reference: CollectionReference, - path: string, - ...pathComponents: string[] -): CollectionReference; -export function collection( - reference: DocumentReference, - path: string, - ...pathComponents: string[] -): CollectionReference; -export function doc( - firestore: FirebaseFirestore, - path: string, - ...pathComponents: string[] -): DocumentReference; -export function doc( - reference: CollectionReference, - path?: string, - ...pathComponents: string[] -): DocumentReference; -export function doc( - reference: DocumentReference, - path: string, - ...pathComponents: string[] -): DocumentReference; -export function collectionGroup( - firestore: FirebaseFirestore, - collectionId: string -): Query; - -export class GeoPoint { - constructor(latitude: number, longitude: number); - - readonly latitude: number; - readonly longitude: number; - - isEqual(other: GeoPoint): boolean; -} - -export class Timestamp { - constructor(seconds: number, nanoseconds: number); - - static now(): Timestamp; - - static fromDate(date: Date): Timestamp; - - static fromMillis(milliseconds: number): Timestamp; - - readonly seconds: number; - readonly nanoseconds: number; - - toDate(): Date; - - toMillis(): number; - - isEqual(other: Timestamp): boolean; - - valueOf(): string; -} - -export class Bytes { - private constructor(); - - static fromBase64String(base64: string): Blob; - - static fromUint8Array(array: Uint8Array): Blob; - - toBase64(): string; - - toUint8Array(): Uint8Array; - - isEqual(other: Blob): boolean; -} - -export class Transaction { - private constructor(); - - get(documentRef: DocumentReference): Promise>; - - set(documentRef: DocumentReference, data: T): Transaction; - set( - documentRef: DocumentReference, - data: Partial, - options: SetOptions - ): Transaction; - - update(documentRef: DocumentReference, data: UpdateData): Transaction; - update( - documentRef: DocumentReference, - field: string | FieldPath, - value: any, - ...moreFieldsAndValues: any[] - ): Transaction; - - delete(documentRef: DocumentReference): Transaction; -} - -export class WriteBatch { - private constructor(); - - set(documentRef: DocumentReference, data: T): WriteBatch; - set( - documentRef: DocumentReference, - data: Partial, - options: SetOptions - ): WriteBatch; - - update(documentRef: DocumentReference, data: UpdateData): WriteBatch; - update( - documentRef: DocumentReference, - field: string | FieldPath, - value: any, - ...moreFieldsAndValues: any[] - ): WriteBatch; - - delete(documentRef: DocumentReference): WriteBatch; - - commit(): Promise; -} - -export type SetOptions = - | { - readonly merge?: boolean; - } - | { - readonly mergeFields?: Array; - }; - -export class DocumentReference { - private constructor(); - readonly type: 'document'; - readonly firestore: FirebaseFirestore; - readonly converter: FirestoreDataConverter | null; - readonly path: string; - readonly id: string; - - get parent(): CollectionReference; - - withConverter(converter: FirestoreDataConverter): DocumentReference; -} - -export class DocumentSnapshot { - readonly ref: DocumentReference; - readonly id: string; - exists(): this is QueryDocumentSnapshot; - data(): T | undefined; - get(fieldPath: string | FieldPath): any; -} - -export class QueryDocumentSnapshot extends DocumentSnapshot< - T -> { - data(): T; -} - -export type OrderByDirection = 'desc' | 'asc'; - -export type WhereFilterOp = - | '<' - | '<=' - | '==' - | '!=' - | '>=' - | '>' - | 'array-contains' - | 'in' - | 'array-contains-any' - | 'not-in'; - -export class Query { - protected constructor(); - readonly type: 'query' | 'collection'; - readonly firestore: FirebaseFirestore; - readonly converter: FirestoreDataConverter | null; - - withConverter(converter: FirestoreDataConverter): Query; -} - -export type QueryConstraintType = - | 'where' - | 'orderBy' - | 'limit' - | 'limitToLast' - | 'startAt' - | 'startAfter' - | 'endAt' - | 'endBefore'; - -export class QueryConstraint { - private constructor(); - readonly type: QueryConstraintType; -} - -export function query( - query: CollectionReference | Query, - ...constraints: QueryConstraint[] -): Query; - -export function where( - fieldPath: string | FieldPath, - opStr: WhereFilterOp, - value: any -): QueryConstraint; -export function orderBy( - fieldPath: string | FieldPath, - directionStr?: OrderByDirection -): QueryConstraint; -export function limit(limit: number): QueryConstraint; -export function limitToLast(limit: number): QueryConstraint; -export function startAt(snapshot: DocumentSnapshot): QueryConstraint; -export function startAt(...fieldValues: any[]): QueryConstraint; -export function startAfter(snapshot: DocumentSnapshot): QueryConstraint; -export function startAfter(...fieldValues: any[]): QueryConstraint; -export function endBefore(snapshot: DocumentSnapshot): QueryConstraint; -export function endBefore(...fieldValues: any[]): QueryConstraint; -export function endAt(snapshot: DocumentSnapshot): QueryConstraint; -export function endAt(...fieldValues: any[]): QueryConstraint; - -export class QuerySnapshot { - private constructor(); - readonly query: Query; - readonly docs: Array>; - readonly size: number; - readonly empty: boolean; - forEach( - callback: (result: QueryDocumentSnapshot) => void, - thisArg?: any - ): void; -} - -export class CollectionReference extends Query { - private constructor(); - readonly type: 'collection'; - readonly id: string; - readonly path: string; - - get parent(): DocumentReference | null; - - withConverter( - converter: FirestoreDataConverter - ): CollectionReference; -} - -export function getDoc( - reference: DocumentReference -): Promise>; -export function getDocs(query: Query): Promise>; - -export function addDoc( - reference: CollectionReference, - data: T -): Promise>; -export function setDoc( - reference: DocumentReference, - data: T -): Promise; -export function setDoc( - reference: DocumentReference, - data: Partial, - options: SetOptions -): Promise; -export function updateDoc( - reference: DocumentReference, - data: UpdateData -): Promise; -export function updateDoc( - reference: DocumentReference, - field: string | FieldPath, - value: any, - ...moreFieldsAndValues: any[] -): Promise; -export function deleteDoc(reference: DocumentReference): Promise; - -export class FieldValue { - private constructor(); - isEqual(other: FieldValue): boolean; -} - -export function serverTimestamp(): FieldValue; -export function deleteField(): FieldValue; -export function arrayUnion(...elements: any[]): FieldValue; -export function arrayRemove(...elements: any[]): FieldValue; -export function increment(n: number): FieldValue; - -export class FieldPath { - constructor(...fieldNames: string[]); - isEqual(other: FieldPath): boolean; -} - -export function documentId(): FieldPath; - -export function refEqual( - left: DocumentReference | CollectionReference, - right: DocumentReference | CollectionReference -): boolean; -export function queryEqual(left: Query, right: Query): boolean; -export function snapshotEqual( - left: DocumentSnapshot | QuerySnapshot, - right: DocumentSnapshot | QuerySnapshot -): boolean; - -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'; - -export interface FirestoreError { - code: FirestoreErrorCode; - message: string; - name: string; - stack?: string; -} - -declare module '@firebase/component' { - interface NameServiceMapping { - 'firestore/lite': FirebaseFirestore; - } -} diff --git a/packages/firestore/lite/api-extractor.json b/packages/firestore/lite/api-extractor.json new file mode 100644 index 00000000000..aecab273d37 --- /dev/null +++ b/packages/firestore/lite/api-extractor.json @@ -0,0 +1,23 @@ +{ + "extends": "../../../config/api-extractor.json", + "mainEntryPointFilePath": "../dist/firestore/lite/index.d.ts", + "dtsRollup": { + "enabled": true, + "publicTrimmedFilePath": "../dist/lite/private.d.ts" + }, + "messages": { + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + }, + "tsdocMessageReporting": { + "tsdoc-undefined-tag": { + "logLevel": "none" + } + } + } +} diff --git a/packages/firestore/lite/package.json b/packages/firestore/lite/package.json index ad92dc85bcf..d00ccc41f37 100644 --- a/packages/firestore/lite/package.json +++ b/packages/firestore/lite/package.json @@ -1,11 +1,11 @@ { - "name": "@firebase/firestore/lite", + "name": "@firebase/firestore-lite", "description": "A lite version of the Firestore SDK", "main": "../dist/lite/index.node.umd.js", "main-esm": "../dist/lite/index.node.esm2017.js", "module": "../dist/lite/index.browser.esm2017.js", "browser": "../dist/lite/index.browser.esm2017.js", "react-native": "../dist/lite/index.rn.esm2017.js", - "typings": "../lite-types/index.d.ts", + "typings": "../dist/lite/index.d.ts", "private": true } diff --git a/packages/firestore/lite/src/api/snapshot.ts b/packages/firestore/lite/src/api/snapshot.ts index 21a90f818c6..5f6706fd263 100644 --- a/packages/firestore/lite/src/api/snapshot.ts +++ b/packages/firestore/lite/src/api/snapshot.ts @@ -211,9 +211,9 @@ export class DocumentSnapshot { * `exists` property will always be true and `data()` will never return * 'undefined'. */ -export class QueryDocumentSnapshot extends DocumentSnapshot< - T -> { +export class QueryDocumentSnapshot< + T = DocumentData +> extends DocumentSnapshot { /** * Retrieves all fields in the document as an `Object`. * diff --git a/packages/firestore/package.json b/packages/firestore/package.json index b0353aaa949..a9c506bdbd7 100644 --- a/packages/firestore/package.json +++ b/packages/firestore/package.json @@ -7,7 +7,10 @@ "description": "The Cloud Firestore component of the Firebase JS SDK.", "author": "Firebase (https://firebase.google.com/)", "scripts": { + "api-report:exp": "(cd exp; api-extractor run --local --verbose) && TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/prune-dts.ts --input dist/exp/private.d.ts --output dist/exp/index.d.ts", + "api-report:lite": "(cd lite; api-extractor run --local --verbose) && TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/prune-dts.ts --input dist/lite/private.d.ts --output dist/lite/index.d.ts", "bundle": "rollup -c", + "prebuild": "tsc --emitDeclarationOnly --declaration -p tsconfig.json && run-p api-report:exp api-report:lite", "build": "run-p 'bundle rollup.config.browser.js' 'bundle rollup.config.browser.memory.js' 'bundle rollup.config.node.js' 'bundle rollup.config.node.memory.js' 'bundle rollup.config.rn.js' 'bundle rollup.config.rn.memory.js' build:lite build:exp", "build:scripts": "tsc -moduleResolution node --module commonjs scripts/*.ts && ls scripts/*.js | xargs -I % sh -c 'terser % -o %'", "build:release": "run-p 'bundle rollup.config.browser.js' 'bundle rollup.config.browser.memory.js' 'bundle rollup.config.node.js' 'bundle rollup.config.node.memory.js' 'bundle rollup.config.rn.js' 'bundle rollup.config.rn.memory.js'", @@ -21,10 +24,10 @@ "lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", "lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", "prettier": "prettier --write '*.js' '*.ts' '@(lite|exp|src|test)/**/*.ts'", - "pregendeps:exp": "node scripts/build-bundle.js --input ./exp/index.ts --output ./dist/exp/tmp.js", - "gendeps:exp": "../../scripts/exp/extract-deps.sh --types ./exp-types/index.d.ts --bundle ./dist/exp/tmp.js --output ./exp/dependencies.json", - "pregendeps:lite": "node scripts/build-bundle.js --input ./lite/index.ts --output ./dist/lite/tmp.js", - "gendeps:lite": "../../scripts/exp/extract-deps.sh --types ./lite-types/index.d.ts --bundle ./dist/lite/tmp.js --output ./lite/dependencies.json", + "pregendeps:exp": "yarn api-report:exp && node scripts/build-bundle.js --input ./exp/index.ts --output ./dist/exp/tmp.js", + "gendeps:exp": "../../scripts/exp/extract-deps.sh --types ./dist/exp/index.d.ts --bundle ./dist/exp/tmp.js --output ./exp/dependencies.json", + "pregendeps:lite": "yarn api-report:lite && node scripts/build-bundle.js --input ./lite/index.ts --output ./dist/lite/tmp.js", + "gendeps:lite": "../../scripts/exp/extract-deps.sh --types ./dist/lite/index.d.ts --bundle ./dist/lite/tmp.js --output ./lite/dependencies.json", "test:lite": "node ./scripts/run-tests.js --emulator --platform node_lite --main=lite/index.ts 'lite/test/**/*.test.ts'", "test:lite:prod": "node ./scripts/run-tests.js --platform node_lite --main=lite/index.ts 'lite/test/**/*.test.ts'", "test:lite:browser": "karma start --single-run --lite", @@ -76,10 +79,12 @@ "@rollup/plugin-alias": "3.1.1", "@rollup/plugin-json": "4.1.0", "@rollup/plugin-node-resolve": "9.0.0", + "@types/eslint": "7.2.5", "@types/json-stable-stringify": "1.0.32", "json-stable-stringify": "1.0.1", "protobufjs": "6.10.2", "rollup": "2.33.2", + "rollup-plugin-copy": "3.3.0", "rollup-plugin-copy-assets": "1.1.0", "rollup-plugin-replace": "2.2.0", "rollup-plugin-sourcemaps": "0.6.3", diff --git a/packages/firestore/rollup.config.exp.js b/packages/firestore/rollup.config.exp.js index 0765ec38680..a23680e7953 100644 --- a/packages/firestore/rollup.config.exp.js +++ b/packages/firestore/rollup.config.exp.js @@ -22,7 +22,7 @@ import typescriptPlugin from 'rollup-plugin-typescript2'; import typescript from 'typescript'; import path from 'path'; import replace from 'rollup-plugin-replace'; -import copy from 'rollup-plugin-copy-assets'; +import copy from 'rollup-plugin-copy'; import { terser } from 'rollup-plugin-terser'; import { importPathTransformer } from '../../scripts/exp/ts-transform-import-path'; @@ -45,7 +45,12 @@ const nodePlugins = [ json({ preferConst: true }), // Needed as we also use the *.proto files copy({ - assets: ['./src/protos'] + targets: [ + { + src: 'src/protos', + dest: 'dist/exp/src' + } + ] }), replace({ 'process.env.FIRESTORE_PROTO_ROOT': JSON.stringify('../src/protos') diff --git a/packages/firestore/rollup.config.lite.js b/packages/firestore/rollup.config.lite.js index 4ad76e409c8..57a8712437d 100644 --- a/packages/firestore/rollup.config.lite.js +++ b/packages/firestore/rollup.config.lite.js @@ -22,6 +22,8 @@ import alias from '@rollup/plugin-alias'; import typescriptPlugin from 'rollup-plugin-typescript2'; import typescript from 'typescript'; import sourcemaps from 'rollup-plugin-sourcemaps'; +import copy from 'rollup-plugin-copy'; +import replace from 'rollup-plugin-replace'; import { terser } from 'rollup-plugin-terser'; import { importPathTransformer } from '../../scripts/exp/ts-transform-import-path'; @@ -41,7 +43,18 @@ const nodePlugins = [ abortOnError: false, transformers: [util.removeAssertTransformer, importPathTransformer] }), - json({ preferConst: true }) + json({ preferConst: true }), + copy({ + targets: [ + { + src: 'src/protos', + dest: 'dist/lite/src' + } + ] + }), + replace({ + 'process.env.FIRESTORE_PROTO_ROOT': JSON.stringify('src/protos') + }) ]; const browserPlugins = [ diff --git a/packages/firestore/src/protos/firestore_bundle_proto.ts b/packages/firestore/src/protos/firestore_bundle_proto.ts index 304fe3e68c7..d51da22987a 100644 --- a/packages/firestore/src/protos/firestore_bundle_proto.ts +++ b/packages/firestore/src/protos/firestore_bundle_proto.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import * as api from './firestore_proto_api'; +import { StructuredQuery, Timestamp, Document } from './firestore_proto_api'; /** Properties of a BundledQuery. */ export interface BundledQuery { @@ -23,7 +23,7 @@ export interface BundledQuery { parent?: string | null; /** BundledQuery structuredQuery */ - structuredQuery?: api.StructuredQuery | null; + structuredQuery?: StructuredQuery | null; /** BundledQuery limitType */ limitType?: LimitType | null; @@ -41,7 +41,7 @@ export interface NamedQuery { bundledQuery?: BundledQuery | null; /** NamedQuery readTime */ - readTime?: api.Timestamp | null; + readTime?: Timestamp | null; } /** Properties of a BundledDocumentMetadata. */ @@ -50,7 +50,7 @@ export interface BundledDocumentMetadata { name?: string | null; /** BundledDocumentMetadata readTime */ - readTime?: api.Timestamp | null; + readTime?: Timestamp | null; /** BundledDocumentMetadata exists */ exists?: boolean | null; @@ -65,7 +65,7 @@ export interface BundleMetadata { id?: string | null; /** BundleMetadata createTime */ - createTime?: api.Timestamp | null; + createTime?: Timestamp | null; /** BundleMetadata version */ version?: number | null; @@ -89,5 +89,5 @@ export interface BundleElement { documentMetadata?: BundledDocumentMetadata | null; /** BundleElement document */ - document?: api.Document | null; + document?: Document | null; } diff --git a/packages/firestore/src/util/byte_stream.ts b/packages/firestore/src/util/byte_stream.ts index bffa6f5abd2..499dbba7ba1 100644 --- a/packages/firestore/src/util/byte_stream.ts +++ b/packages/firestore/src/util/byte_stream.ts @@ -50,7 +50,10 @@ export function toByteStreamReaderHelper( return result; } - return { value: undefined, done: true }; + // TypesScript's lib.dom.d.ts doesn't have proper typings of + // ReadableStreamReadResult yet. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return { done: true } as any; }, async cancel(): Promise {}, releaseLock() {} diff --git a/packages/firestore/test/integration/api/query.test.ts b/packages/firestore/test/integration/api/query.test.ts index 10bab8cc329..eab9995dd4a 100644 --- a/packages/firestore/test/integration/api/query.test.ts +++ b/packages/firestore/test/integration/api/query.test.ts @@ -155,9 +155,7 @@ apiDescribe('Queries', (persistence: boolean) => { .onSnapshot(storeLimitEvent.storeEvent); // Setup mirroring `limitToLast` query - const storeLimitToLastEvent = new EventsAccumulator< - firestore.QuerySnapshot - >(); + const storeLimitToLastEvent = new EventsAccumulator(); let limitToLastUnlisten = collection .orderBy('sort', 'desc') .limitToLast(2) diff --git a/packages/firestore/test/unit/specs/spec_builder.ts b/packages/firestore/test/unit/specs/spec_builder.ts index d948586bb5b..87eda5c27b3 100644 --- a/packages/firestore/test/unit/specs/spec_builder.ts +++ b/packages/firestore/test/unit/specs/spec_builder.ts @@ -1042,9 +1042,9 @@ export class SpecBuilder { return { key: SpecBuilder.keyToSpec(doc.key), version: doc.version.toMicroseconds(), - value: userDataWriter.convertValue(doc.toProto()) as JsonObject< - unknown - >, + value: userDataWriter.convertValue( + doc.toProto() + ) as JsonObject, options: { hasLocalMutations: doc.hasLocalMutations, hasCommittedMutations: doc.hasCommittedMutations diff --git a/repo-scripts/prune-dts/prune-dts.test.ts b/repo-scripts/prune-dts/prune-dts.test.ts index 8130dc41871..ba770e43cd9 100644 --- a/repo-scripts/prune-dts/prune-dts.test.ts +++ b/repo-scripts/prune-dts/prune-dts.test.ts @@ -21,7 +21,6 @@ import * as path from 'path'; import { format, resolveConfig } from 'prettier'; import { expect } from 'chai'; import { describe, it } from 'mocha'; - import { pruneDts } from './prune-dts'; const testCasesDir = path.resolve(__dirname, 'tests'); diff --git a/scripts/prune-dts/tsconfig.eslint.json b/scripts/prune-dts/tsconfig.eslint.json new file mode 100644 index 00000000000..295364d2ed7 --- /dev/null +++ b/scripts/prune-dts/tsconfig.eslint.json @@ -0,0 +1,4 @@ +{ + "extends": "../../config/tsconfig.base.json", + "include": ["../../**/*.ts"] +} diff --git a/yarn.lock b/yarn.lock index 75078c24d4c..676adb07a43 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5175,6 +5175,11 @@ color@3.0.x: color-convert "^1.9.1" color-string "^1.5.2" +colorette@^1.1.0: + version "1.2.1" + resolved "https://registry.npmjs.org/colorette/-/colorette-1.2.1.tgz#4d0b921325c14faf92633086a536db6e89564b1b" + integrity sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw== + colors@1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b" @@ -6718,7 +6723,7 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== -eslint@7.13.0: +eslint@7.13.0, eslint@^7.11.0: version "7.13.0" resolved "https://registry.npmjs.org/eslint/-/eslint-7.13.0.tgz#7f180126c0dcdef327bfb54b211d7802decc08da" integrity sha512-uCORMuOO8tUzJmsdRtrvcGq5qposf7Rw0LwkTJkoDbOycVQtQjmnhZSuLQnozLE4TmAzlMVV45eCHmQ1OpDKUQ== @@ -8140,6 +8145,20 @@ globals@^9.18.0: resolved "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== +globby@10.0.1: + version "10.0.1" + resolved "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz#4782c34cb75dd683351335c5829cc3420e606b22" + integrity sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A== + dependencies: + "@types/glob" "^7.1.1" + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.0.3" + glob "^7.1.3" + ignore "^5.1.1" + merge2 "^1.2.3" + slash "^3.0.0" + globby@^10.0.1: version "10.0.2" resolved "https://registry.npmjs.org/globby/-/globby-10.0.2.tgz#277593e745acaa4646c3ab411289ec47a0392543" @@ -9478,6 +9497,11 @@ is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: dependencies: isobject "^3.0.1" +is-plain-object@^3.0.0: + version "3.0.1" + resolved "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.1.tgz#662d92d24c0aa4302407b0d45d21f2251c85f85b" + integrity sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g== + is-plain-object@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344" @@ -13831,6 +13855,17 @@ rollup-plugin-copy-assets@1.1.0: dependencies: fs-extra "^5.0.0" +rollup-plugin-copy@3.3.0: + version "3.3.0" + resolved "https://registry.npmjs.org/rollup-plugin-copy/-/rollup-plugin-copy-3.3.0.tgz#5ba230047f86b9f703a29288f242948a5580e7b9" + integrity sha512-euDjCUSBXZa06nqnwCNADbkAcYDfzwowfZQkto9K/TFhiH+QG7I4PUsEMwM9tDgomGWJc//z7KLW8t+tZwxADA== + dependencies: + "@types/fs-extra" "^8.0.1" + colorette "^1.1.0" + fs-extra "^8.1.0" + globby "10.0.1" + is-plain-object "^3.0.0" + rollup-plugin-license@2.2.0: version "2.2.0" resolved "https://registry.npmjs.org/rollup-plugin-license/-/rollup-plugin-license-2.2.0.tgz#0d19139bbe44dda500fbf15530af07c91949e348" @@ -15720,7 +15755,7 @@ typescript@3.7.x: resolved "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae" integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw== -typescript@4.0.5: +typescript@4.0.5, typescript@^4.0.3: version "4.0.5" resolved "https://registry.npmjs.org/typescript/-/typescript-4.0.5.tgz#ae9dddfd1069f1cb5beb3ef3b2170dd7c1332389" integrity sha512-ywmr/VrTVCmNTJ6iV2LwIrfG1P+lv6luD8sUJs+2eI9NLGigaN+nUQc13iHqisq7bra9lnmUSYqbJvegraBOPQ==