Socket
Socket
Sign inDemoInstall

@google-cloud/firestore

Package Overview
Dependencies
Maintainers
1
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/firestore - npm Package Compare versions

Comparing version 6.8.0 to 7.0.0

16

build/src/bulk-writer.d.ts

@@ -114,3 +114,3 @@ /*!

/** The document reference the operation was performed on. */
readonly documentRef: firestore.DocumentReference<unknown>;
readonly documentRef: firestore.DocumentReference<any, any>;
/** The type of operation performed. */

@@ -127,3 +127,3 @@ readonly operationType: 'create' | 'set' | 'update' | 'delete';

/** The document reference the operation was performed on. */
documentRef: firestore.DocumentReference<unknown>,
documentRef: firestore.DocumentReference<any, any>,
/** The type of operation performed. */

@@ -269,3 +269,3 @@ operationType: 'create' | 'set' | 'update' | 'delete',

*/
create<T>(documentRef: firestore.DocumentReference<T>, data: firestore.WithFieldValue<T>): Promise<WriteResult>;
create<AppModelType, DbModelType extends firestore.DocumentData>(documentRef: firestore.DocumentReference<AppModelType, DbModelType>, data: firestore.WithFieldValue<AppModelType>): Promise<WriteResult>;
/**

@@ -301,5 +301,5 @@ * Delete a document from the database.

*/
delete<T>(documentRef: firestore.DocumentReference<T>, precondition?: firestore.Precondition): Promise<WriteResult>;
set<T>(documentRef: firestore.DocumentReference<T>, data: Partial<T>, options: firestore.SetOptions): Promise<WriteResult>;
set<T>(documentRef: firestore.DocumentReference<T>, data: T): Promise<WriteResult>;
delete<AppModelType, DbModelType extends firestore.DocumentData>(documentRef: firestore.DocumentReference<AppModelType, DbModelType>, precondition?: firestore.Precondition): Promise<WriteResult>;
set<AppModelType, DbModelType extends firestore.DocumentData>(documentRef: firestore.DocumentReference<AppModelType, DbModelType>, data: Partial<AppModelType>, options: firestore.SetOptions): Promise<WriteResult>;
set<AppModelType, DbModelType extends firestore.DocumentData>(documentRef: firestore.DocumentReference<AppModelType, DbModelType>, data: AppModelType): Promise<WriteResult>;
/**

@@ -349,3 +349,3 @@ * Update fields of the document referred to by the provided

*/
update<T>(documentRef: firestore.DocumentReference<T>, dataOrField: firestore.UpdateData<T> | string | FieldPath, ...preconditionOrValues: Array<{
update<AppModelType, DbModelType extends firestore.DocumentData>(documentRef: firestore.DocumentReference<AppModelType, DbModelType>, dataOrField: firestore.UpdateData<DbModelType> | string | FieldPath, ...preconditionOrValues: Array<{
lastUpdateTime?: Timestamp;

@@ -383,3 +383,3 @@ } | unknown | string | FieldPath>): Promise<WriteResult>;

*/
onWriteResult(successCallback: (documentRef: firestore.DocumentReference<unknown>, result: WriteResult) => void): void;
onWriteResult(successCallback: (documentRef: firestore.DocumentReference<any, any>, result: WriteResult) => void): void;
/**

@@ -386,0 +386,0 @@ * Callback function set by {@link BulkWriter#onWriteError} that is run when

@@ -232,2 +232,3 @@ "use strict";

/** The document reference the operation was performed on. */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
documentRef,

@@ -254,2 +255,28 @@ /** The type of operation performed. */

class BulkWriter {
// Visible for testing.
/**
* @private
* @internal
*/
_getBufferedOperationsCount() {
return this._bufferedOperations.length;
}
// Visible for testing.
/**
* @private
* @internal
*/
_setMaxBatchSize(size) {
assert(this._bulkCommitBatch.pendingOps.length === 0, 'BulkCommitBatch should be empty');
this._maxBatchSize = size;
this._bulkCommitBatch = new BulkCommitBatch(this.firestore, size);
}
// Visible for testing.
/**
* @private
* @internal
*/
_setMaxPendingOpCount(newMax) {
this._maxPendingOpCount = newMax;
}
/** @private */

@@ -371,29 +398,3 @@ constructor(firestore, options) {

}
// Visible for testing.
/**
* @private
* @internal
*/
_getBufferedOperationsCount() {
return this._bufferedOperations.length;
}
// Visible for testing.
/**
* @private
* @internal
*/
_setMaxBatchSize(size) {
assert(this._bulkCommitBatch.pendingOps.length === 0, 'BulkCommitBatch should be empty');
this._maxBatchSize = size;
this._bulkCommitBatch = new BulkCommitBatch(this.firestore, size);
}
// Visible for testing.
/**
* @private
* @internal
*/
_setMaxPendingOpCount(newMax) {
this._maxPendingOpCount = newMax;
}
/**
* Create a document with the provided data. This single operation will fail

@@ -735,3 +736,3 @@ * if a document exists at its location.

// Use the write with the longest backoff duration when determining backoff.
const highestBackoffDuration = pendingBatch.pendingOps.reduce((prev, cur) => prev.backoffDuration > cur.backoffDuration ? prev : cur).backoffDuration;
const highestBackoffDuration = pendingBatch.pendingOps.reduce((prev, cur) => (prev.backoffDuration > cur.backoffDuration ? prev : cur)).backoffDuration;
const backoffMsWithJitter = BulkWriter._applyJitter(highestBackoffDuration);

@@ -738,0 +739,0 @@ const delayedExecution = new util_1.Deferred();

@@ -11,5 +11,5 @@ import * as firestore from '@google-cloud/firestore';

*/
export declare class CollectionGroup<T = firestore.DocumentData> extends Query<T> implements firestore.CollectionGroup<T> {
export declare class CollectionGroup<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> extends Query<AppModelType, DbModelType> implements firestore.CollectionGroup<AppModelType, DbModelType> {
/** @private */
constructor(firestore: Firestore, collectionId: string, converter: firestore.FirestoreDataConverter<T> | undefined);
constructor(firestore: Firestore, collectionId: string, converter: firestore.FirestoreDataConverter<AppModelType, DbModelType> | undefined);
/**

@@ -36,3 +36,3 @@ * Partitions a query by returning partition cursors that can be used to run

*/
getPartitions(desiredPartitionCount: number): AsyncIterable<QueryPartition<T>>;
getPartitions(desiredPartitionCount: number): AsyncIterable<QueryPartition<AppModelType, DbModelType>>;
/**

@@ -42,3 +42,4 @@ * Applies a custom data converter to this `CollectionGroup`, allowing you

* on the returned `CollectionGroup`, the provided converter will convert
* between Firestore data and your custom type U.
* between Firestore data of type `NewDbModelType` and your custom type
* `NewAppModelType`.
*

@@ -87,7 +88,7 @@ * Using the converter allows you to specify generic type arguments when

* from Firestore. Passing in `null` removes the current converter.
* @return {CollectionGroup} A `CollectionGroup<U>` that uses the provided
* @return {CollectionGroup} A `CollectionGroup` that uses the provided
* converter.
*/
withConverter(converter: null): CollectionGroup<firestore.DocumentData>;
withConverter<U>(converter: firestore.FirestoreDataConverter<U>): CollectionGroup<U>;
withConverter(converter: null): CollectionGroup;
withConverter<NewAppModelType, NewDbModelType extends firestore.DocumentData = firestore.DocumentData>(converter: firestore.FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionGroup<NewAppModelType, NewDbModelType>;
}

@@ -18,3 +18,3 @@ /*!

import { QueryDocumentSnapshot } from './document';
export declare type DocumentChangeType = 'added' | 'removed' | 'modified';
export type DocumentChangeType = 'added' | 'removed' | 'modified';
/**

@@ -26,3 +26,3 @@ * A DocumentChange represents a change to the documents matching a query.

*/
export declare class DocumentChange<T = firestore.DocumentData> implements firestore.DocumentChange<T> {
export declare class DocumentChange<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> implements firestore.DocumentChange<AppModelType, DbModelType> {
private readonly _type;

@@ -42,3 +42,3 @@ private readonly _document;

*/
constructor(type: DocumentChangeType, document: QueryDocumentSnapshot<T>, oldIndex: number, newIndex: number);
constructor(type: DocumentChangeType, document: QueryDocumentSnapshot<AppModelType, DbModelType>, oldIndex: number, newIndex: number);
/**

@@ -88,3 +88,3 @@ * The type of change ('added', 'modified', or 'removed').

*/
get doc(): QueryDocumentSnapshot<T>;
get doc(): QueryDocumentSnapshot<AppModelType, DbModelType>;
/**

@@ -158,3 +158,3 @@ * The index of the changed document in the result set immediately prior to

*/
isEqual(other: firestore.DocumentChange<T>): boolean;
isEqual(other: firestore.DocumentChange<AppModelType, DbModelType>): boolean;
}

@@ -20,2 +20,3 @@ /*!

import { Firestore } from './index';
import { DocumentData } from '@google-cloud/firestore';
/**

@@ -28,3 +29,3 @@ * A wrapper around BatchGetDocumentsRequest that retries request upon stream

*/
export declare class DocumentReader<T> {
export declare class DocumentReader<AppModelType, DbModelType extends DocumentData> {
private firestore;

@@ -45,3 +46,3 @@ private allDocuments;

*/
constructor(firestore: Firestore, allDocuments: Array<DocumentReference<T>>);
constructor(firestore: Firestore, allDocuments: Array<DocumentReference<AppModelType, DbModelType>>);
/**

@@ -52,4 +53,4 @@ * Invokes the BatchGetDocuments RPC and returns the results.

*/
get(requestTag: string): Promise<Array<DocumentSnapshot<T>>>;
get(requestTag: string): Promise<Array<DocumentSnapshot<AppModelType, DbModelType>>>;
private fetchDocuments;
}

@@ -32,4 +32,4 @@ /*!

*/
export declare class DocumentSnapshotBuilder<T = firestore.DocumentData> {
readonly ref: DocumentReference<T>;
export declare class DocumentSnapshotBuilder<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> {
readonly ref: DocumentReference<AppModelType, DbModelType>;
/** The fields of the Firestore `Document` Protobuf backing this document. */

@@ -43,3 +43,3 @@ fieldsProto?: ApiMapValue;

updateTime?: Timestamp;
constructor(ref: DocumentReference<T>);
constructor(ref: DocumentReference<AppModelType, DbModelType>);
/**

@@ -53,3 +53,3 @@ * Builds the DocumentSnapshot.

*/
build(): QueryDocumentSnapshot<T> | DocumentSnapshot<T>;
build(): QueryDocumentSnapshot<AppModelType, DbModelType> | DocumentSnapshot<AppModelType, DbModelType>;
}

@@ -70,3 +70,3 @@ /**

*/
export declare class DocumentSnapshot<T = firestore.DocumentData> implements firestore.DocumentSnapshot<T> {
export declare class DocumentSnapshot<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> implements firestore.DocumentSnapshot<AppModelType, DbModelType> {
/** @private */

@@ -92,3 +92,3 @@ readonly _fieldsProto?: ApiMapValue | undefined;

*/
constructor(ref: DocumentReference<T>,
constructor(ref: DocumentReference<AppModelType, DbModelType>,
/** @private */

@@ -105,3 +105,3 @@ _fieldsProto?: ApiMapValue | undefined, readTime?: Timestamp, createTime?: Timestamp, updateTime?: Timestamp);

*/
static fromObject<U>(ref: firestore.DocumentReference<U>, obj: firestore.DocumentData): DocumentSnapshot<U>;
static fromObject<AppModelType, DbModelType extends firestore.DocumentData>(ref: DocumentReference<AppModelType, DbModelType>, obj: firestore.DocumentData): DocumentSnapshot<AppModelType, DbModelType>;
/**

@@ -119,3 +119,3 @@ * Creates a DocumentSnapshot from an UpdateMap.

*/
static fromUpdateMap<U>(ref: firestore.DocumentReference<U>, data: UpdateMap): DocumentSnapshot<U>;
static fromUpdateMap<AppModelType, DbModelType extends firestore.DocumentData>(ref: firestore.DocumentReference<AppModelType, DbModelType>, data: UpdateMap): DocumentSnapshot<AppModelType, DbModelType>;
/**

@@ -159,3 +159,3 @@ * True if the document exists.

*/
get ref(): DocumentReference<T>;
get ref(): DocumentReference<AppModelType, DbModelType>;
/**

@@ -257,3 +257,3 @@ * The ID of the document for which this DocumentSnapshot contains data.

*/
data(): T | undefined;
data(): AppModelType | undefined;
/**

@@ -313,3 +313,3 @@ * Retrieves the field specified by `field`.

*/
isEqual(other: firestore.DocumentSnapshot<T>): boolean;
isEqual(other: firestore.DocumentSnapshot<AppModelType, DbModelType>): boolean;
}

@@ -331,3 +331,3 @@ /**

*/
export declare class QueryDocumentSnapshot<T = firestore.DocumentData> extends DocumentSnapshot<T> implements firestore.QueryDocumentSnapshot<T> {
export declare class QueryDocumentSnapshot<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> extends DocumentSnapshot<AppModelType, DbModelType> implements firestore.QueryDocumentSnapshot<AppModelType, DbModelType> {
/**

@@ -387,3 +387,3 @@ * The time the document was created.

*/
data(): T;
data(): AppModelType;
}

@@ -496,3 +496,3 @@ /**

*/
export declare class DocumentTransform<T = firestore.DocumentData> {
export declare class DocumentTransform<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> {
private readonly ref;

@@ -508,3 +508,3 @@ private readonly transforms;

*/
constructor(ref: DocumentReference<T>, transforms: Map<FieldPath, FieldTransform>);
constructor(ref: DocumentReference<AppModelType, DbModelType>, transforms: Map<FieldPath, FieldTransform>);
/**

@@ -519,3 +519,3 @@ * Generates a DocumentTransform from a JavaScript object.

*/
static fromObject<T>(ref: firestore.DocumentReference<T>, obj: firestore.DocumentData): DocumentTransform<T>;
static fromObject<AppModelType, DbModelType extends firestore.DocumentData>(ref: firestore.DocumentReference<AppModelType, DbModelType>, obj: firestore.DocumentData): DocumentTransform<AppModelType, DbModelType>;
/**

@@ -530,3 +530,3 @@ * Generates a DocumentTransform from an Update Map.

*/
static fromUpdateMap<T>(ref: firestore.DocumentReference<T>, data: UpdateMap): DocumentTransform<T>;
static fromUpdateMap<AppModelType, DbModelType extends firestore.DocumentData>(ref: firestore.DocumentReference<AppModelType, DbModelType>, data: UpdateMap): DocumentTransform<AppModelType, DbModelType>;
/**

@@ -533,0 +533,0 @@ * Whether this DocumentTransform contains any actionable transformations.

@@ -35,3 +35,4 @@ "use strict";

// We include the DocumentReference in the constructor in order to allow the
// DocumentSnapshotBuilder to be typed with <T> when it is constructed.
// DocumentSnapshotBuilder to be typed with <AppModelType, DbModelType> when
// it is constructed.
constructor(ref) {

@@ -121,3 +122,4 @@ this.ref = ref;

static fromUpdateMap(ref, data) {
const serializer = ref.firestore._serializer;
const serializer = ref
.firestore._serializer;
/**

@@ -124,0 +126,0 @@ * Merges 'value' at the field path specified by the path array into

@@ -184,2 +184,2 @@ /*!

*/
export declare type CompositeOperator = 'AND' | 'OR';
export type CompositeOperator = 'AND' | 'OR';

@@ -63,3 +63,4 @@ /*!

* Converter used by [withConverter()]{@link Query#withConverter} to transform
* user objects of type T into Firestore data.
* user objects of type `AppModelType` into Firestore data of type
* `DbModelType`.
*

@@ -104,6 +105,6 @@ * Using the converter allows you to specify generic type arguments when storing

* @property {Function} toFirestore Called by the Firestore SDK to convert a
* custom model object of type T into a plain Javascript object (suitable for
* writing directly to the Firestore database).
* custom model object of type `AppModelType` into a plain Javascript object
* (suitable for writing directly to the Firestore database).
* @property {Function} fromFirestore Called by the Firestore SDK to convert
* Firestore data into an object of type T.
* Firestore data into an object of type `AppModelType`.
* @typedef {Object} FirestoreDataConverter

@@ -738,3 +739,3 @@ */

*/
getAll<T>(...documentRefsOrReadOptions: Array<firestore.DocumentReference<T> | firestore.ReadOptions>): Promise<Array<DocumentSnapshot<T>>>;
getAll<AppModelType, DbModelType extends firestore.DocumentData>(...documentRefsOrReadOptions: Array<firestore.DocumentReference<AppModelType, DbModelType> | firestore.ReadOptions>): Promise<Array<DocumentSnapshot<AppModelType, DbModelType>>>;
/**

@@ -811,3 +812,3 @@ * Registers a listener on this client, incrementing the listener count. This

*/
recursiveDelete(ref: firestore.CollectionReference<unknown> | firestore.DocumentReference<unknown>, bulkWriter?: BulkWriter): Promise<void>;
recursiveDelete(ref: firestore.CollectionReference<any, any> | firestore.DocumentReference<any, any>, bulkWriter?: BulkWriter): Promise<void>;
/**

@@ -814,0 +815,0 @@ * This overload is not private in order to test the query resumption with

@@ -14,3 +14,3 @@ import * as firestore from '@google-cloud/firestore';

*/
export declare class QueryPartition<T = firestore.DocumentData> implements firestore.QueryPartition<T> {
export declare class QueryPartition<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> implements firestore.QueryPartition<AppModelType, DbModelType> {
private readonly _firestore;

@@ -25,3 +25,3 @@ private readonly _collectionId;

/** @private */
constructor(_firestore: Firestore, _collectionId: string, _converter: firestore.FirestoreDataConverter<T>, _startAt: api.IValue[] | undefined, _endBefore: api.IValue[] | undefined);
constructor(_firestore: Firestore, _collectionId: string, _converter: firestore.FirestoreDataConverter<AppModelType, DbModelType>, _startAt: api.IValue[] | undefined, _endBefore: api.IValue[] | undefined);
/**

@@ -97,3 +97,3 @@ * The cursor that defines the first result for this partition or `undefined`

*/
toQuery(): Query<T>;
toQuery(): Query<AppModelType, DbModelType>;
}

@@ -59,3 +59,3 @@ /*!

*/
export declare class DocumentReference<T = firestore.DocumentData> implements Serializable, firestore.DocumentReference<T> {
export declare class DocumentReference<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> implements Serializable, firestore.DocumentReference<AppModelType, DbModelType> {
private readonly _firestore;

@@ -65,3 +65,3 @@ /** @private */

/** @private */
readonly _converter: firestore.FirestoreDataConverter<T>;
readonly _converter: firestore.FirestoreDataConverter<AppModelType, DbModelType>;
/**

@@ -79,3 +79,3 @@ * @private

/** @private */
_converter?: firestore.FirestoreDataConverter<T>);
_converter?: firestore.FirestoreDataConverter<AppModelType, DbModelType>);
/**

@@ -166,3 +166,3 @@ * The string representation of the DocumentReference's location.

*/
get parent(): CollectionReference<T>;
get parent(): CollectionReference<AppModelType, DbModelType>;
/**

@@ -187,3 +187,3 @@ * Reads the document referred to by this DocumentReference.

*/
get(): Promise<DocumentSnapshot<T>>;
get(): Promise<DocumentSnapshot<AppModelType, DbModelType>>;
/**

@@ -222,3 +222,3 @@ * Gets a [CollectionReference]{@link CollectionReference} instance

*/
listCollections(): Promise<Array<CollectionReference<firestore.DocumentData>>>;
listCollections(): Promise<Array<CollectionReference>>;
/**

@@ -245,3 +245,3 @@ * Create a document with the provided object values. This will fail the write

*/
create(data: firestore.WithFieldValue<T>): Promise<WriteResult>;
create(data: firestore.WithFieldValue<AppModelType>): Promise<WriteResult>;
/**

@@ -273,4 +273,4 @@ * Deletes the document referred to by this `DocumentReference`.

delete(precondition?: firestore.Precondition): Promise<WriteResult>;
set(data: firestore.PartialWithFieldValue<T>, options: firestore.SetOptions): Promise<WriteResult>;
set(data: firestore.WithFieldValue<T>): Promise<WriteResult>;
set(data: firestore.PartialWithFieldValue<AppModelType>, options: firestore.SetOptions): Promise<WriteResult>;
set(data: firestore.WithFieldValue<AppModelType>): Promise<WriteResult>;
/**

@@ -308,3 +308,3 @@ * Updates fields in the document referred to by this DocumentReference.

*/
update(dataOrField: firestore.UpdateData<T> | string | firestore.FieldPath, ...preconditionOrValues: Array<unknown | string | firestore.FieldPath | firestore.Precondition>): Promise<WriteResult>;
update(dataOrField: firestore.UpdateData<DbModelType> | string | firestore.FieldPath, ...preconditionOrValues: Array<unknown | string | firestore.FieldPath | firestore.Precondition>): Promise<WriteResult>;
/**

@@ -338,3 +338,3 @@ * Attaches a listener for DocumentSnapshot events.

*/
onSnapshot(onNext: (snapshot: firestore.DocumentSnapshot<T>) => void, onError?: (error: Error) => void): () => void;
onSnapshot(onNext: (snapshot: firestore.DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: Error) => void): () => void;
/**

@@ -347,3 +347,3 @@ * Returns true if this `DocumentReference` is equal to the provided value.

*/
isEqual(other: firestore.DocumentReference<T>): boolean;
isEqual(other: firestore.DocumentReference<AppModelType, DbModelType>): boolean;
/**

@@ -356,4 +356,4 @@ * Converts this DocumentReference to the Firestore Proto representation.

toProto(): api.IValue;
withConverter(converter: null): DocumentReference<firestore.DocumentData>;
withConverter<U>(converter: firestore.FirestoreDataConverter<U>): DocumentReference<U>;
withConverter(converter: null): DocumentReference;
withConverter<NewAppModelType, NewDbModelType extends firestore.DocumentData = firestore.DocumentData>(converter: firestore.FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
}

@@ -443,3 +443,3 @@ /**

*/
export declare class QuerySnapshot<T = firestore.DocumentData> implements firestore.QuerySnapshot<T> {
export declare class QuerySnapshot<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> implements firestore.QuerySnapshot<AppModelType, DbModelType> {
private readonly _query;

@@ -463,3 +463,3 @@ private readonly _readTime;

*/
constructor(_query: Query<T>, _readTime: Timestamp, _size: number, docs: () => Array<QueryDocumentSnapshot<T>>, changes: () => Array<DocumentChange<T>>);
constructor(_query: Query<AppModelType, DbModelType>, _readTime: Timestamp, _size: number, docs: () => Array<QueryDocumentSnapshot<AppModelType, DbModelType>>, changes: () => Array<DocumentChange<AppModelType, DbModelType>>);
/**

@@ -486,3 +486,3 @@ * The query on which you called get() or onSnapshot() in order to get this

*/
get query(): Query<T>;
get query(): Query<AppModelType, DbModelType>;
/**

@@ -507,3 +507,3 @@ * An array of all the documents in this QuerySnapshot.

*/
get docs(): Array<QueryDocumentSnapshot<T>>;
get docs(): Array<QueryDocumentSnapshot<AppModelType, DbModelType>>;
/**

@@ -581,3 +581,3 @@ * True if there are no documents in the QuerySnapshot.

*/
docChanges(): Array<DocumentChange<T>>;
docChanges(): Array<DocumentChange<AppModelType, DbModelType>>;
/**

@@ -604,3 +604,3 @@ * Enumerates all of the documents in the QuerySnapshot. This is a convenience

*/
forEach(callback: (result: firestore.QueryDocumentSnapshot<T>) => void, thisArg?: unknown): void;
forEach(callback: (result: firestore.QueryDocumentSnapshot<AppModelType, DbModelType>) => void, thisArg?: unknown): void;
/**

@@ -614,3 +614,3 @@ * Returns true if the document data in this `QuerySnapshot` is equal to the

*/
isEqual(other: firestore.QuerySnapshot<T>): boolean;
isEqual(other: firestore.QuerySnapshot<AppModelType, DbModelType>): boolean;
}

@@ -637,6 +637,6 @@ /** Internal representation of a query cursor before serialization. */

*/
export declare class QueryOptions<T> {
export declare class QueryOptions<AppModelType, DbModelType extends firestore.DocumentData> {
readonly parentPath: ResourcePath;
readonly collectionId: string;
readonly converter: firestore.FirestoreDataConverter<T>;
readonly converter: firestore.FirestoreDataConverter<AppModelType, DbModelType>;
readonly allDescendants: boolean;

@@ -653,3 +653,3 @@ readonly filters: FilterInternal[];

readonly requireConsistency: boolean;
constructor(parentPath: ResourcePath, collectionId: string, converter: firestore.FirestoreDataConverter<T>, allDescendants: boolean, filters: FilterInternal[], fieldOrders: FieldOrder[], startAt?: QueryCursor | undefined, endAt?: QueryCursor | undefined, limit?: number | undefined, limitType?: LimitType | undefined, offset?: number | undefined, projection?: api.StructuredQuery.IProjection | undefined, kindless?: boolean, requireConsistency?: boolean);
constructor(parentPath: ResourcePath, collectionId: string, converter: firestore.FirestoreDataConverter<AppModelType, DbModelType>, allDescendants: boolean, filters: FilterInternal[], fieldOrders: FieldOrder[], startAt?: QueryCursor | undefined, endAt?: QueryCursor | undefined, limit?: number | undefined, limitType?: LimitType | undefined, offset?: number | undefined, projection?: api.StructuredQuery.IProjection | undefined, kindless?: boolean, requireConsistency?: boolean);
/**

@@ -660,3 +660,3 @@ * Returns query options for a collection group query.

*/
static forCollectionGroupQuery<T = firestore.DocumentData>(collectionId: string, converter?: firestore.FirestoreDataConverter<T>): QueryOptions<T>;
static forCollectionGroupQuery<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData>(collectionId: string, converter?: firestore.FirestoreDataConverter<AppModelType, DbModelType>): QueryOptions<AppModelType, DbModelType>;
/**

@@ -667,3 +667,3 @@ * Returns query options for a single-collection query.

*/
static forCollectionQuery<T = firestore.DocumentData>(collectionRef: ResourcePath, converter?: firestore.FirestoreDataConverter<T>): QueryOptions<T>;
static forCollectionQuery<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData>(collectionRef: ResourcePath, converter?: firestore.FirestoreDataConverter<AppModelType, DbModelType>): QueryOptions<AppModelType, DbModelType>;
/**

@@ -676,3 +676,3 @@ * Returns query options for a query that fetches all descendants under the

*/
static forKindlessAllDescendants<T = firestore.DocumentData>(parent: ResourcePath, id: string, requireConsistency?: boolean): QueryOptions<T>;
static forKindlessAllDescendants(parent: ResourcePath, id: string, requireConsistency?: boolean): QueryOptions<firestore.DocumentData, firestore.DocumentData>;
/**

@@ -683,6 +683,6 @@ * Returns the union of the current and the provided options.

*/
with(settings: Partial<Omit<QueryOptions<T>, 'converter'>>): QueryOptions<T>;
withConverter<U>(converter: firestore.FirestoreDataConverter<U>): QueryOptions<U>;
with(settings: Partial<Omit<QueryOptions<AppModelType, DbModelType>, 'converter'>>): QueryOptions<AppModelType, DbModelType>;
withConverter<NewAppModelType, NewDbModelType extends firestore.DocumentData = firestore.DocumentData>(converter: firestore.FirestoreDataConverter<NewAppModelType, NewDbModelType>): QueryOptions<NewAppModelType, NewDbModelType>;
hasFieldOrders(): boolean;
isEqual(other: QueryOptions<T>): boolean;
isEqual(other: QueryOptions<AppModelType, DbModelType>): boolean;
private filtersEqual;

@@ -696,7 +696,7 @@ }

*/
export declare class Query<T = firestore.DocumentData> implements firestore.Query<T> {
export declare class Query<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> implements firestore.Query<AppModelType, DbModelType> {
/** @private */
readonly _firestore: Firestore;
/** @private */
protected readonly _queryOptions: QueryOptions<T>;
protected readonly _queryOptions: QueryOptions<AppModelType, DbModelType>;
private readonly _serializer;

@@ -715,3 +715,3 @@ /** @private */

/** @private */
_queryOptions: QueryOptions<T>);
_queryOptions: QueryOptions<AppModelType, DbModelType>);
/**

@@ -777,3 +777,3 @@ * Extracts field values from the DocumentSnapshot based on the provided

*/
where(fieldPath: string | firestore.FieldPath, opStr: firestore.WhereFilterOp, value: unknown): Query<T>;
where(fieldPath: string | FieldPath, opStr: firestore.WhereFilterOp, value: unknown): Query<AppModelType, DbModelType>;
/**

@@ -801,3 +801,3 @@ * Creates and returns a new [Query]{@link Query} with the additional filter

*/
where(filter: Filter): Query<T>;
where(filter: Filter): Query<AppModelType, DbModelType>;
_parseFilter(filter: Filter): FilterInternal;

@@ -833,3 +833,3 @@ _parseFieldFilter(fieldFilterData: UnaryFilter): FieldFilterInternal;

*/
select(...fieldPaths: Array<string | FieldPath>): Query<firestore.DocumentData>;
select(...fieldPaths: Array<string | FieldPath>): Query;
/**

@@ -859,3 +859,3 @@ * Creates and returns a new [Query]{@link Query} that's additionally sorted

*/
orderBy(fieldPath: string | firestore.FieldPath, directionStr?: firestore.OrderByDirection): Query<T>;
orderBy(fieldPath: string | firestore.FieldPath, directionStr?: firestore.OrderByDirection): Query<AppModelType, DbModelType>;
/**

@@ -882,3 +882,3 @@ * Creates and returns a new [Query]{@link Query} that only returns the

*/
limit(limit: number): Query<T>;
limit(limit: number): Query<AppModelType, DbModelType>;
/**

@@ -907,3 +907,3 @@ * Creates and returns a new [Query]{@link Query} that only returns the

*/
limitToLast(limit: number): Query<T>;
limitToLast(limit: number): Query<AppModelType, DbModelType>;
/**

@@ -930,3 +930,3 @@ * Specifies the offset of the returned results.

*/
offset(offset: number): Query<T>;
offset(offset: number): Query<AppModelType, DbModelType>;
/**

@@ -951,3 +951,3 @@ * Returns a query that counts the documents in the result set of this

count: firestore.AggregateField<number>;
}>;
}, AppModelType, DbModelType>;
/**

@@ -959,3 +959,3 @@ * Returns true if this `Query` is equal to the provided value.

*/
isEqual(other: firestore.Query<T>): boolean;
isEqual(other: firestore.Query<AppModelType, DbModelType>): boolean;
/**

@@ -1026,3 +1026,3 @@ * Returns the sorted array of inequality filter fields used in this query.

*/
startAt(...fieldValuesOrDocumentSnapshot: Array<firestore.DocumentSnapshot<unknown> | unknown>): Query<T>;
startAt(...fieldValuesOrDocumentSnapshot: Array<unknown>): Query<AppModelType, DbModelType>;
/**

@@ -1050,3 +1050,3 @@ * Creates and returns a new [Query]{@link Query} that starts after the

*/
startAfter(...fieldValuesOrDocumentSnapshot: Array<firestore.DocumentSnapshot<unknown> | unknown>): Query<T>;
startAfter(...fieldValuesOrDocumentSnapshot: Array<unknown>): Query<AppModelType, DbModelType>;
/**

@@ -1073,3 +1073,3 @@ * Creates and returns a new [Query]{@link Query} that ends before the set of

*/
endBefore(...fieldValuesOrDocumentSnapshot: Array<firestore.DocumentSnapshot<unknown> | unknown>): Query<T>;
endBefore(...fieldValuesOrDocumentSnapshot: Array<unknown>): Query<AppModelType, DbModelType>;
/**

@@ -1096,3 +1096,3 @@ * Creates and returns a new [Query]{@link Query} that ends at the provided

*/
endAt(...fieldValuesOrDocumentSnapshot: Array<firestore.DocumentSnapshot<unknown> | unknown>): Query<T>;
endAt(...fieldValuesOrDocumentSnapshot: Array<unknown>): Query<AppModelType, DbModelType>;
/**

@@ -1116,3 +1116,3 @@ * Executes the query and returns the results as a

*/
get(): Promise<QuerySnapshot<T>>;
get(): Promise<QuerySnapshot<AppModelType, DbModelType>>;
/**

@@ -1125,3 +1125,3 @@ * Internal get() method that accepts an optional transaction id.

*/
_get(transactionId?: Uint8Array): Promise<QuerySnapshot<T>>;
_get(transactionId?: Uint8Array): Promise<QuerySnapshot<AppModelType, DbModelType>>;
/**

@@ -1211,3 +1211,3 @@ * Executes the query and streams the results as

*/
onSnapshot(onNext: (snapshot: firestore.QuerySnapshot<T>) => void, onError?: (error: Error) => void): () => void;
onSnapshot(onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: Error) => void): () => void;
/**

@@ -1220,5 +1220,5 @@ * Returns a function that can be used to sort QueryDocumentSnapshots

*/
comparator(): (s1: QueryDocumentSnapshot<T>, s2: QueryDocumentSnapshot<T>) => number;
withConverter(converter: null): Query<firestore.DocumentData>;
withConverter<U>(converter: firestore.FirestoreDataConverter<U>): Query<U>;
comparator(): (s1: QueryDocumentSnapshot<AppModelType, DbModelType>, s2: QueryDocumentSnapshot<AppModelType, DbModelType>) => number;
withConverter(converter: null): Query;
withConverter<NewAppModelType, NewDbModelType extends firestore.DocumentData = firestore.DocumentData>(converter: firestore.FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>;
}

@@ -1233,3 +1233,3 @@ /**

*/
export declare class CollectionReference<T = firestore.DocumentData> extends Query<T> implements firestore.CollectionReference<T> {
export declare class CollectionReference<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> extends Query<AppModelType, DbModelType> implements firestore.CollectionReference<AppModelType, DbModelType> {
/**

@@ -1241,3 +1241,3 @@ * @private

*/
constructor(firestore: Firestore, path: ResourcePath, converter?: firestore.FirestoreDataConverter<T>);
constructor(firestore: Firestore, path: ResourcePath, converter?: firestore.FirestoreDataConverter<AppModelType, DbModelType>);
/**

@@ -1278,3 +1278,3 @@ * Returns a resource path for this collection.

*/
get parent(): DocumentReference<firestore.DocumentData> | null;
get parent(): DocumentReference | null;
/**

@@ -1324,5 +1324,5 @@ * A string representing the path of the referenced collection (relative

*/
listDocuments(): Promise<Array<DocumentReference<T>>>;
doc(): DocumentReference<T>;
doc(documentPath: string): DocumentReference<T>;
listDocuments(): Promise<Array<DocumentReference<AppModelType, DbModelType>>>;
doc(): DocumentReference<AppModelType, DbModelType>;
doc(documentPath: string): DocumentReference<AppModelType, DbModelType>;
/**

@@ -1347,3 +1347,3 @@ * Add a new document to this collection with the specified data, assigning

*/
add(data: firestore.WithFieldValue<T>): Promise<DocumentReference<T>>;
add(data: firestore.WithFieldValue<AppModelType>): Promise<DocumentReference<AppModelType, DbModelType>>;
/**

@@ -1356,5 +1356,5 @@ * Returns true if this `CollectionReference` is equal to the provided value.

*/
isEqual(other: firestore.CollectionReference<T>): boolean;
withConverter(converter: null): CollectionReference<firestore.DocumentData>;
withConverter<U>(converter: firestore.FirestoreDataConverter<U>): CollectionReference<U>;
isEqual(other: firestore.CollectionReference<AppModelType, DbModelType>): boolean;
withConverter(converter: null): CollectionReference;
withConverter<NewAppModelType, NewDbModelType extends firestore.DocumentData = firestore.DocumentData>(converter: firestore.FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>;
}

@@ -1364,3 +1364,3 @@ /**

*/
export declare class AggregateQuery<T extends firestore.AggregateSpec> implements firestore.AggregateQuery<T> {
export declare class AggregateQuery<AggregateSpecType extends firestore.AggregateSpec, AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> implements firestore.AggregateQuery<AggregateSpecType, AppModelType, DbModelType> {
private readonly _query;

@@ -1376,5 +1376,5 @@ private readonly _aggregates;

*/
constructor(_query: Query<any>, _aggregates: T);
constructor(_query: Query<AppModelType, DbModelType>, _aggregates: AggregateSpecType);
/** The query whose aggregations will be calculated by this object. */
get query(): firestore.Query<unknown>;
get query(): Query<AppModelType, DbModelType>;
/**

@@ -1385,3 +1385,3 @@ * Executes this query.

*/
get(): Promise<AggregateQuerySnapshot<T>>;
get(): Promise<AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>>;
/**

@@ -1394,3 +1394,3 @@ * Internal get() method that accepts an optional transaction id.

*/
_get(transactionId?: Uint8Array): Promise<AggregateQuerySnapshot<T>>;
_get(transactionId?: Uint8Array): Promise<AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>>;
/**

@@ -1431,3 +1431,3 @@ * Internal streaming method that accepts an optional transaction ID.

*/
isEqual(other: firestore.AggregateQuery<T>): boolean;
isEqual(other: firestore.AggregateQuery<AggregateSpecType, AppModelType, DbModelType>): boolean;
}

@@ -1437,3 +1437,3 @@ /**

*/
export declare class AggregateQuerySnapshot<T extends firestore.AggregateSpec> implements firestore.AggregateQuerySnapshot<T> {
export declare class AggregateQuerySnapshot<AggregateSpecType extends firestore.AggregateSpec, AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> implements firestore.AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType> {
private readonly _query;

@@ -1451,7 +1451,7 @@ private readonly _readTime;

*/
constructor(_query: AggregateQuery<T>, _readTime: Timestamp, _data: firestore.AggregateSpecData<T>);
constructor(_query: AggregateQuery<AggregateSpecType, AppModelType, DbModelType>, _readTime: Timestamp, _data: firestore.AggregateSpecData<AggregateSpecType>);
/** The query that was executed to produce this result. */
get query(): firestore.AggregateQuery<T>;
get query(): AggregateQuery<AggregateSpecType, AppModelType, DbModelType>;
/** The time this snapshot was read. */
get readTime(): firestore.Timestamp;
get readTime(): Timestamp;
/**

@@ -1468,3 +1468,3 @@ * Returns the results of the aggregations performed over the underlying

*/
data(): firestore.AggregateSpecData<T>;
data(): firestore.AggregateSpecData<AggregateSpecType>;
/**

@@ -1481,3 +1481,3 @@ * Compares this object with the given object for equality.

*/
isEqual(other: firestore.AggregateQuerySnapshot<T>): boolean;
isEqual(other: firestore.AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>): boolean;
}

@@ -1518,3 +1518,3 @@ /**

*/
export declare function validateDocumentReference(arg: string | number, value: unknown): DocumentReference;
export declare function validateDocumentReference<AppModelType, DbModelType extends firestore.DocumentData>(arg: string | number, value: firestore.DocumentReference<AppModelType, DbModelType>): DocumentReference<AppModelType, DbModelType>;
export {};

@@ -55,32 +55,2 @@ "use strict";

/**
* Creates a new timestamp.
*
* @example
* ```
* let documentRef = firestore.doc('col/doc');
*
* documentRef.set({ startTime:new Firestore.Timestamp(42, 0) });
*
* ```
* @param {number} seconds The number of seconds of UTC time since Unix epoch
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
* 9999-12-31T23:59:59Z inclusive.
* @param {number} nanoseconds The non-negative fractions of a second at
* nanosecond resolution. Negative second values with fractions must still
* have non-negative nanoseconds values that count forward in time. Must be
* from 0 to 999,999,999 inclusive.
*/
constructor(seconds, nanoseconds) {
(0, validate_1.validateInteger)('seconds', seconds, {
minValue: MIN_SECONDS,
maxValue: MAX_SECONDS,
});
(0, validate_1.validateInteger)('nanoseconds', nanoseconds, {
minValue: 0,
maxValue: 999999999,
});
this._seconds = seconds;
this._nanoseconds = nanoseconds;
}
/**
* Creates a new timestamp with the current date, with millisecond precision.

@@ -149,2 +119,32 @@ *

/**
* Creates a new timestamp.
*
* @example
* ```
* let documentRef = firestore.doc('col/doc');
*
* documentRef.set({ startTime:new Firestore.Timestamp(42, 0) });
*
* ```
* @param {number} seconds The number of seconds of UTC time since Unix epoch
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
* 9999-12-31T23:59:59Z inclusive.
* @param {number} nanoseconds The non-negative fractions of a second at
* nanosecond resolution. Negative second values with fractions must still
* have non-negative nanoseconds values that count forward in time. Must be
* from 0 to 999,999,999 inclusive.
*/
constructor(seconds, nanoseconds) {
(0, validate_1.validateInteger)('seconds', seconds, {
minValue: MIN_SECONDS,
maxValue: MAX_SECONDS,
});
(0, validate_1.validateInteger)('nanoseconds', nanoseconds, {
minValue: 0,
maxValue: 999999999,
});
this._seconds = seconds;
this._nanoseconds = nanoseconds;
}
/**
* The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.

@@ -151,0 +151,0 @@ *

@@ -21,3 +21,3 @@ /*!

import { FieldPath } from './path';
import { AggregateQuerySnapshot, DocumentReference, Query, QuerySnapshot } from './reference';
import { AggregateQuerySnapshot, DocumentReference, QuerySnapshot } from './reference';
/**

@@ -53,3 +53,3 @@ * A reference to a transaction.

*/
get<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
get<AppModelType, DbModelType extends firestore.DocumentData>(query: firestore.Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>>;
/**

@@ -62,3 +62,3 @@ * Reads the document referenced by the provided `DocumentReference.`

*/
get<T>(documentRef: DocumentReference<T>): Promise<DocumentSnapshot<T>>;
get<AppModelType, DbModelType extends firestore.DocumentData>(documentRef: firestore.DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>;
/**

@@ -71,3 +71,3 @@ * Retrieves an aggregate query result. Holds a pessimistic lock on all

*/
get<T extends firestore.AggregateSpec>(aggregateQuery: firestore.AggregateQuery<T>): Promise<AggregateQuerySnapshot<T>>;
get<AppModelType, DbModelType extends firestore.DocumentData, AggregateSpecType extends firestore.AggregateSpec>(aggregateQuery: firestore.AggregateQuery<AggregateSpecType, AppModelType, DbModelType>): Promise<AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>>;
/**

@@ -101,3 +101,3 @@ * Retrieves multiple documents from Firestore. Holds a pessimistic lock on

*/
getAll<T>(...documentRefsOrReadOptions: Array<firestore.DocumentReference<T> | firestore.ReadOptions>): Promise<Array<DocumentSnapshot<T>>>;
getAll<AppModelType, DbModelType extends firestore.DocumentData>(...documentRefsOrReadOptions: Array<firestore.DocumentReference<AppModelType, DbModelType> | firestore.ReadOptions>): Promise<Array<DocumentSnapshot<AppModelType, DbModelType>>>;
/**

@@ -126,5 +126,5 @@ * Create the document referred to by the provided

*/
create<T>(documentRef: firestore.DocumentReference<T>, data: firestore.WithFieldValue<T>): Transaction;
set<T>(documentRef: firestore.DocumentReference<T>, data: firestore.PartialWithFieldValue<T>, options: firestore.SetOptions): Transaction;
set<T>(documentRef: firestore.DocumentReference<T>, data: firestore.WithFieldValue<T>): Transaction;
create<AppModelType, DbModelType extends firestore.DocumentData>(documentRef: firestore.DocumentReference<AppModelType, DbModelType>, data: firestore.WithFieldValue<AppModelType>): Transaction;
set<AppModelType, DbModelType extends firestore.DocumentData>(documentRef: firestore.DocumentReference<AppModelType, DbModelType>, data: firestore.PartialWithFieldValue<AppModelType>, options: firestore.SetOptions): Transaction;
set<AppModelType, DbModelType extends firestore.DocumentData>(documentRef: firestore.DocumentReference<AppModelType, DbModelType>, data: firestore.WithFieldValue<AppModelType>): Transaction;
/**

@@ -171,3 +171,3 @@ * Updates fields in the document referred to by the provided

*/
update<T>(documentRef: firestore.DocumentReference<T>, dataOrField: firestore.UpdateData<T> | string | firestore.FieldPath, ...preconditionOrValues: Array<firestore.Precondition | unknown | string | firestore.FieldPath>): Transaction;
update<AppModelType, DbModelType extends firestore.DocumentData>(documentRef: firestore.DocumentReference<AppModelType, DbModelType>, dataOrField: firestore.UpdateData<DbModelType> | string | firestore.FieldPath, ...preconditionOrValues: Array<firestore.Precondition | unknown | string | firestore.FieldPath>): Transaction;
/**

@@ -198,3 +198,3 @@ * Deletes the document referred to by the provided [DocumentReference]

*/
delete<T>(documentRef: DocumentReference<T>, precondition?: firestore.Precondition): this;
delete(documentRef: DocumentReference<any, any>, precondition?: firestore.Precondition): this;
/**

@@ -255,5 +255,5 @@ * Starts a transaction and obtains the transaction id from the server.

*/
export declare function parseGetAllArguments<T>(documentRefsOrReadOptions: Array<firestore.DocumentReference<T> | firestore.ReadOptions>): {
documents: Array<DocumentReference<T>>;
export declare function parseGetAllArguments<AppModelType, DbModelType extends firestore.DocumentData>(documentRefsOrReadOptions: Array<firestore.DocumentReference<AppModelType, DbModelType> | firestore.ReadOptions>): {
documents: Array<DocumentReference<AppModelType, DbModelType>>;
fieldMask: FieldPath[] | null;
};

@@ -89,3 +89,3 @@ "use strict";

}
if (refOrQuery instanceof (reference_1.AggregateQuery)) {
if (refOrQuery instanceof reference_1.AggregateQuery) {
return refOrQuery._get(this._transactionId);

@@ -274,3 +274,5 @@ }

*/
delete(documentRef, precondition) {
delete(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
documentRef, precondition) {
this._writeBatch.delete(documentRef, precondition);

@@ -277,0 +279,0 @@ return this;

@@ -17,3 +17,3 @@ /*!

/// <reference types="node" />
import { FirestoreDataConverter } from '@google-cloud/firestore';
import { FirestoreDataConverter, DocumentData } from '@google-cloud/firestore';
import { CallOptions } from 'google-gax';

@@ -52,8 +52,8 @@ import { Duplex } from 'stream';

/** Request/response methods used in the Firestore SDK. */
export declare type FirestoreUnaryMethod = 'listDocuments' | 'listCollectionIds' | 'rollback' | 'beginTransaction' | 'commit' | 'batchWrite';
export type FirestoreUnaryMethod = 'listDocuments' | 'listCollectionIds' | 'rollback' | 'beginTransaction' | 'commit' | 'batchWrite';
/** Streaming methods used in the Firestore SDK. */
export declare type FirestoreStreamingMethod = 'listen' | 'partitionQueryStream' | 'runQuery' | 'runAggregationQuery' | 'batchGetDocuments';
export type FirestoreStreamingMethod = 'listen' | 'partitionQueryStream' | 'runQuery' | 'runAggregationQuery' | 'batchGetDocuments';
/** Type signature for the unary methods in the GAPIC layer. */
export declare type UnaryMethod<Req, Resp> = (request: Req, callOptions: CallOptions) => Promise<[Resp, unknown, unknown]>;
export declare type RBTree = any;
export type UnaryMethod<Req, Resp> = (request: Req, callOptions: CallOptions) => Promise<[Resp, unknown, unknown]>;
export type RBTree = any;
/**

@@ -64,7 +64,7 @@ * A default converter to use when none is provided.

*/
export declare function defaultConverter<T>(): FirestoreDataConverter<T>;
export declare function defaultConverter<AppModelType, DbModelType extends DocumentData>(): FirestoreDataConverter<AppModelType, DbModelType>;
/**
* Update data that has been resolved to a mapping of FieldPaths to values.
*/
export declare type UpdateMap = Map<FieldPath, unknown>;
export type UpdateMap = Map<FieldPath, unknown>;
/**

@@ -71,0 +71,0 @@ * Internal user data validation options.

@@ -58,3 +58,3 @@ /*!

*/
declare type DocumentComparator<T> = (l: QueryDocumentSnapshot<T>, r: QueryDocumentSnapshot<T>) => number;
type DocumentComparator<AppModelType, DbModelType extends firestore.DocumentData> = (l: QueryDocumentSnapshot<AppModelType, DbModelType>, r: QueryDocumentSnapshot<AppModelType, DbModelType>) => number;
/**

@@ -68,4 +68,4 @@ * Watch provides listen functionality and exposes the 'onSnapshot' observer. It

*/
declare abstract class Watch<T = firestore.DocumentData> {
readonly _converter: firestore.FirestoreDataConverter<T>;
declare abstract class Watch<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> {
readonly _converter: firestore.FirestoreDataConverter<AppModelType, DbModelType>;
protected readonly firestore: Firestore;

@@ -140,3 +140,3 @@ private readonly backoff;

*/
constructor(firestore: Firestore, _converter?: firestore.FirestoreDataConverter<T>);
constructor(firestore: Firestore, _converter?: firestore.FirestoreDataConverter<AppModelType, DbModelType>);
/** Returns a 'Target' proto denoting the target to listen on. */

@@ -148,3 +148,3 @@ protected abstract getTarget(resumeToken?: Uint8Array): api.ITarget;

*/
protected abstract getComparator(): DocumentComparator<T>;
protected abstract getComparator(): DocumentComparator<AppModelType, DbModelType>;
/**

@@ -163,3 +163,3 @@ * Starts a watch and attaches a listener for document change events.

*/
onSnapshot(onNext: (readTime: Timestamp, size: number, docs: () => Array<QueryDocumentSnapshot<T>>, changes: () => Array<DocumentChange<T>>) => void, onError: (error: Error) => void): () => void;
onSnapshot(onNext: (readTime: Timestamp, size: number, docs: () => Array<QueryDocumentSnapshot<AppModelType, DbModelType>>, changes: () => Array<DocumentChange<AppModelType, DbModelType>>) => void, onError: (error: Error) => void): () => void;
/**

@@ -296,6 +296,6 @@ * Returns the current count of all documents, including the changes from

*/
export declare class DocumentWatch<T = firestore.DocumentData> extends Watch<T> {
export declare class DocumentWatch<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> extends Watch<AppModelType, DbModelType> {
private readonly ref;
constructor(firestore: Firestore, ref: DocumentReference<T>);
getComparator(): DocumentComparator<T>;
constructor(firestore: Firestore, ref: DocumentReference<AppModelType, DbModelType>);
getComparator(): DocumentComparator<AppModelType, DbModelType>;
getTarget(resumeToken?: Uint8Array): google.firestore.v1.ITarget;

@@ -309,9 +309,9 @@ }

*/
export declare class QueryWatch<T = firestore.DocumentData> extends Watch<T> {
export declare class QueryWatch<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> extends Watch<AppModelType, DbModelType> {
private readonly query;
private comparator;
constructor(firestore: Firestore, query: Query<T>, converter?: firestore.FirestoreDataConverter<T>);
getComparator(): DocumentComparator<T>;
constructor(firestore: Firestore, query: Query<AppModelType, DbModelType>, converter?: firestore.FirestoreDataConverter<AppModelType, DbModelType>);
getComparator(): DocumentComparator<AppModelType, DbModelType>;
getTarget(resumeToken?: Uint8Array): google.firestore.v1.ITarget;
}
export {};

@@ -47,2 +47,3 @@ "use strict";

*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const REMOVED = {};

@@ -49,0 +50,0 @@ /*!

@@ -69,3 +69,3 @@ /*!

*/
export declare type PendingWriteOp = () => api.IWrite;
export type PendingWriteOp = () => api.IWrite;
/**

@@ -135,3 +135,3 @@ * A Firestore WriteBatch that can be used to atomically commit multiple write

*/
create<T>(documentRef: firestore.DocumentReference<T>, data: firestore.WithFieldValue<T>): WriteBatch;
create<AppModelType, DbModelType extends firestore.DocumentData>(documentRef: firestore.DocumentReference<AppModelType, DbModelType>, data: firestore.WithFieldValue<AppModelType>): WriteBatch;
/**

@@ -164,5 +164,5 @@ * Deletes a document from the database.

*/
delete<T>(documentRef: firestore.DocumentReference<T>, precondition?: firestore.Precondition): WriteBatch;
set<T>(documentRef: firestore.DocumentReference<T>, data: firestore.PartialWithFieldValue<T>, options: firestore.SetOptions): WriteBatch;
set<T>(documentRef: firestore.DocumentReference<T>, data: firestore.WithFieldValue<T>): WriteBatch;
delete(documentRef: firestore.DocumentReference<any, any>, precondition?: firestore.Precondition): WriteBatch;
set<AppModelType, DbModelType extends firestore.DocumentData>(documentRef: firestore.DocumentReference<AppModelType, DbModelType>, data: firestore.PartialWithFieldValue<AppModelType>, options: firestore.SetOptions): WriteBatch;
set<AppModelType, DbModelType extends firestore.DocumentData>(documentRef: firestore.DocumentReference<AppModelType, DbModelType>, data: firestore.WithFieldValue<AppModelType>): WriteBatch;
/**

@@ -207,3 +207,3 @@ * Update fields of the document referred to by the provided

*/
update<T = firestore.DocumentData>(documentRef: firestore.DocumentReference<T>, dataOrField: firestore.UpdateData<T> | string | firestore.FieldPath, ...preconditionOrValues: Array<{
update<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData>(documentRef: firestore.DocumentReference<AppModelType, DbModelType>, dataOrField: firestore.UpdateData<DbModelType> | string | firestore.FieldPath, ...preconditionOrValues: Array<{
lastUpdateTime?: firestore.Timestamp;

@@ -210,0 +210,0 @@ } | unknown | string | firestore.FieldPath>): WriteBatch;

@@ -81,2 +81,9 @@ "use strict";

class WriteBatch {
/**
* The number of writes in this batch.
* @private
*/
get _opCount() {
return this._ops.length;
}
/** @private */

@@ -99,9 +106,2 @@ constructor(firestore) {

/**
* The number of writes in this batch.
* @private
*/
get _opCount() {
return this._ops.length;
}
/**
* Checks if this write batch has any pending operations.

@@ -197,3 +197,5 @@ *

*/
delete(documentRef, precondition) {
delete(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
documentRef, precondition) {
const ref = (0, reference_1.validateDocumentReference)('documentRef', documentRef);

@@ -254,5 +256,2 @@ validateDeletePrecondition('precondition', precondition, { optional: true });

if (mergeLeaves || mergePaths) {
// Cast to any in order to satisfy the union type constraint on
// toFirestore().
// eslint-disable-next-line @typescript-eslint/no-explicit-any
firestoreData = ref._converter.toFirestore(data, options);

@@ -271,6 +270,6 @@ }

}
const transform = document_1.DocumentTransform.fromObject(documentRef, firestoreData);
const transform = document_1.DocumentTransform.fromObject(ref, firestoreData);
transform.validate();
const op = () => {
const document = document_1.DocumentSnapshot.fromObject(documentRef, firestoreData);
const document = document_1.DocumentSnapshot.fromObject(ref, firestoreData);
if (mergePaths) {

@@ -277,0 +276,0 @@ documentMask.removeFields(transform.fields);

{
"name": "@google-cloud/firestore",
"description": "Firestore Client Library for Node.js",
"version": "6.8.0",
"version": "7.0.0",
"license": "Apache-2.0",
"author": "Google Inc.",
"engines": {
"node": ">=12.0.0"
"node": ">=14.0.0"
},

@@ -64,3 +64,3 @@ "repository": "googleapis/nodejs-firestore",

"functional-red-black-tree": "^1.0.1",
"google-gax": "^3.5.7",
"google-gax": "^4.0.4",
"protobufjs": "^7.2.5"

@@ -84,3 +84,4 @@ },

"extend": "^3.0.2",
"gts": "^3.1.0",
"gapic-tools": "^0.2.0",
"gts": "^5.0.1",
"jsdoc": "^4.0.0",

@@ -97,4 +98,4 @@ "jsdoc-fresh": "^3.0.0",

"ts-node": "^10.0.0",
"typescript": "~4.7.4"
"typescript": "^5.2.2"
}
}

@@ -120,3 +120,3 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost."

Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule).
Libraries are compatible with all current _active_ and _maintenance_ versions of

@@ -123,0 +123,0 @@ Node.js.

@@ -180,3 +180,3 @@ /*!

protos.google.firestore.admin.v1.IGetIndexRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -226,3 +226,3 @@ >;

protos.google.firestore.admin.v1.IDeleteIndexRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -272,3 +272,3 @@ >;

protos.google.firestore.admin.v1.IGetFieldRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -318,3 +318,3 @@ >;

protos.google.firestore.admin.v1.IGetDatabaseRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -364,3 +364,3 @@ >;

protos.google.firestore.admin.v1.IListDatabasesRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -419,3 +419,3 @@ >;

protos.google.longrunning.IOperation | undefined,
{} | undefined
{} | undefined,
]

@@ -510,3 +510,3 @@ >;

protos.google.longrunning.IOperation | undefined,
{} | undefined
{} | undefined,
]

@@ -608,3 +608,3 @@ >;

protos.google.longrunning.IOperation | undefined,
{} | undefined
{} | undefined,
]

@@ -698,3 +698,3 @@ >;

protos.google.longrunning.IOperation | undefined,
{} | undefined
{} | undefined,
]

@@ -776,3 +776,3 @@ >;

protos.google.longrunning.IOperation | undefined,
{} | undefined
{} | undefined,
]

@@ -859,3 +859,3 @@ >;

protos.google.firestore.admin.v1.IListIndexesRequest | null,
protos.google.firestore.admin.v1.IListIndexesResponse
protos.google.firestore.admin.v1.IListIndexesResponse,
]

@@ -990,3 +990,3 @@ >;

protos.google.firestore.admin.v1.IListFieldsRequest | null,
protos.google.firestore.admin.v1.IListFieldsResponse
protos.google.firestore.admin.v1.IListFieldsResponse,
]

@@ -993,0 +993,0 @@ >;

@@ -165,3 +165,3 @@ /*!

protos.google.firestore.v1.IGetDocumentRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -227,3 +227,3 @@ >;

protos.google.firestore.v1.IUpdateDocumentRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -276,3 +276,3 @@ >;

protos.google.firestore.v1.IDeleteDocumentRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -325,3 +325,3 @@ >;

protos.google.firestore.v1.IBeginTransactionRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -377,3 +377,3 @@ >;

protos.google.firestore.v1.ICommitRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -425,3 +425,3 @@ >;

protos.google.firestore.v1.IRollbackRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -487,3 +487,3 @@ >;

protos.google.firestore.v1.IBatchWriteRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -547,3 +547,3 @@ >;

protos.google.firestore.v1.ICreateDocumentRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -742,3 +742,3 @@ >;

protos.google.firestore.v1.IListDocumentsRequest | null,
protos.google.firestore.v1.IListDocumentsResponse
protos.google.firestore.v1.IListDocumentsResponse,
]

@@ -942,3 +942,3 @@ >;

protos.google.firestore.v1.IPartitionQueryRequest | null,
protos.google.firestore.v1.IPartitionQueryResponse
protos.google.firestore.v1.IPartitionQueryResponse,
]

@@ -1123,3 +1123,3 @@ >;

protos.google.firestore.v1.IListCollectionIdsRequest | null,
protos.google.firestore.v1.IListCollectionIdsResponse
protos.google.firestore.v1.IListCollectionIdsResponse,
]

@@ -1126,0 +1126,0 @@ >;

@@ -166,3 +166,3 @@ /*!

protos.google.firestore.v1beta1.IGetDocumentRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -228,3 +228,3 @@ >;

protos.google.firestore.v1beta1.IUpdateDocumentRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -277,3 +277,3 @@ >;

protos.google.firestore.v1beta1.IDeleteDocumentRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -326,3 +326,3 @@ >;

protos.google.firestore.v1beta1.IBeginTransactionRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -382,3 +382,3 @@ >;

protos.google.firestore.v1beta1.ICommitRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -430,3 +430,3 @@ >;

protos.google.firestore.v1beta1.IRollbackRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -492,3 +492,3 @@ >;

protos.google.firestore.v1beta1.IBatchWriteRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -552,3 +552,3 @@ >;

protos.google.firestore.v1beta1.ICreateDocumentRequest | undefined,
{} | undefined
{} | undefined,
]

@@ -747,3 +747,3 @@ >;

protos.google.firestore.v1beta1.IListDocumentsRequest | null,
protos.google.firestore.v1beta1.IListDocumentsResponse
protos.google.firestore.v1beta1.IListDocumentsResponse,
]

@@ -947,3 +947,3 @@ >;

protos.google.firestore.v1beta1.IPartitionQueryRequest | null,
protos.google.firestore.v1beta1.IPartitionQueryResponse
protos.google.firestore.v1beta1.IPartitionQueryResponse,
]

@@ -1132,3 +1132,3 @@ >;

protos.google.firestore.v1beta1.IListCollectionIdsRequest | null,
protos.google.firestore.v1beta1.IListCollectionIdsResponse
protos.google.firestore.v1beta1.IListCollectionIdsResponse,
]

@@ -1135,0 +1135,0 @@ >;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc