diff options
| author | altaf-creator <dev@altafcreator.com> | 2025-11-09 11:15:19 +0800 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2025-11-09 11:15:19 +0800 |
| commit | 8eff962cab608341a6f2fedc640a0e32d96f26e2 (patch) | |
| tree | 05534d1a720ddc3691d346c69b4972555820a061 /frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model | |
pain
Diffstat (limited to 'frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model')
18 files changed, 1496 insertions, 0 deletions
diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/collections.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/collections.d.ts new file mode 100644 index 0000000..999c4ea --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/collections.d.ts @@ -0,0 +1,50 @@ +/** + * @license + * Copyright 2017 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 { SnapshotVersion } from '../core/snapshot_version'; +import { TargetId } from '../core/types'; +import { OverlayedDocument } from '../local/overlayed_document'; +import { ObjectMap } from '../util/obj_map'; +import { SortedMap } from '../util/sorted_map'; +import { SortedSet } from '../util/sorted_set'; +import { Document, MutableDocument } from './document'; +import { DocumentKey } from './document_key'; +import { Mutation } from './mutation'; +import { Overlay } from './overlay'; +/** Miscellaneous collection types / constants. */ +export type MutableDocumentMap = SortedMap<DocumentKey, MutableDocument>; +export declare function mutableDocumentMap(): MutableDocumentMap; +export interface DocumentSizeEntries { + documents: MutableDocumentMap; + sizeMap: SortedMap<DocumentKey, number>; +} +export type DocumentMap = SortedMap<DocumentKey, Document>; +export declare function documentMap(...docs: Document[]): DocumentMap; +export type OverlayedDocumentMap = DocumentKeyMap<OverlayedDocument>; +export declare function newOverlayedDocumentMap(): OverlayedDocumentMap; +export declare function convertOverlayedDocumentMapToDocumentMap(collection: OverlayedDocumentMap): DocumentMap; +export type OverlayMap = DocumentKeyMap<Overlay>; +export declare function newOverlayMap(): OverlayMap; +export type MutationMap = DocumentKeyMap<Mutation>; +export declare function newMutationMap(): MutationMap; +export type DocumentKeyMap<T> = ObjectMap<DocumentKey, T>; +export declare function newDocumentKeyMap<T>(): DocumentKeyMap<T>; +export type DocumentVersionMap = SortedMap<DocumentKey, SnapshotVersion>; +export declare function documentVersionMap(): DocumentVersionMap; +export type DocumentKeySet = SortedSet<DocumentKey>; +export declare function documentKeySet(...keys: DocumentKey[]): DocumentKeySet; +export type TargetIdSet = SortedSet<TargetId>; +export declare function targetIdSet(): SortedSet<TargetId>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/document.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/document.d.ts new file mode 100644 index 0000000..66ba3f3 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/document.d.ts @@ -0,0 +1,150 @@ +/** + * @license + * Copyright 2017 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 { SnapshotVersion } from '../core/snapshot_version'; +import { DocumentKey } from './document_key'; +import { ObjectValue } from './object_value'; +import { FieldPath } from './path'; +/** + * Represents a document in Firestore with a key, version, data and whether the + * data has local mutations applied to it. + */ +export interface Document { + /** The key for this document */ + readonly key: DocumentKey; + /** + * The version of this document if it exists or a version at which this + * document was guaranteed to not exist. + */ + readonly version: SnapshotVersion; + /** + * The timestamp at which this document was read from the remote server. Uses + * `SnapshotVersion.min()` for documents created by the user. + */ + readonly readTime: SnapshotVersion; + /** + * The timestamp at which the document was created. This value increases + * monotonically when a document is deleted then recreated. It can also be + * compared to `createTime` of other documents and the `readTime` of a query. + */ + readonly createTime: SnapshotVersion; + /** The underlying data of this document or an empty value if no data exists. */ + readonly data: ObjectValue; + /** Returns whether local mutations were applied via the mutation queue. */ + readonly hasLocalMutations: boolean; + /** Returns whether mutations were applied based on a write acknowledgment. */ + readonly hasCommittedMutations: boolean; + /** + * Whether this document had a local mutation applied that has not yet been + * acknowledged by Watch. + */ + readonly hasPendingWrites: boolean; + /** + * Returns whether this document is valid (i.e. it is an entry in the + * RemoteDocumentCache, was created by a mutation or read from the backend). + */ + isValidDocument(): boolean; + /** + * Returns whether the document exists and its data is known at the current + * version. + */ + isFoundDocument(): boolean; + /** + * Returns whether the document is known to not exist at the current version. + */ + isNoDocument(): boolean; + /** + * Returns whether the document exists and its data is unknown at the current + * version. + */ + isUnknownDocument(): boolean; + isEqual(other: Document | null | undefined): boolean; + /** Creates a mutable copy of this document. */ + mutableCopy(): MutableDocument; + toString(): string; +} +/** + * Represents a document in Firestore with a key, version, data and whether it + * has local mutations applied to it. + * + * Documents can transition between states via `convertToFoundDocument()`, + * `convertToNoDocument()` and `convertToUnknownDocument()`. If a document does + * not transition to one of these states even after all mutations have been + * applied, `isValidDocument()` returns false and the document should be removed + * from all views. + */ +export declare class MutableDocument implements Document { + readonly key: DocumentKey; + private documentType; + version: SnapshotVersion; + readTime: SnapshotVersion; + createTime: SnapshotVersion; + data: ObjectValue; + private documentState; + private constructor(); + /** + * Creates a document with no known version or data, but which can serve as + * base document for mutations. + */ + static newInvalidDocument(documentKey: DocumentKey): MutableDocument; + /** + * Creates a new document that is known to exist with the given data at the + * given version. + */ + static newFoundDocument(documentKey: DocumentKey, version: SnapshotVersion, createTime: SnapshotVersion, value: ObjectValue): MutableDocument; + /** Creates a new document that is known to not exist at the given version. */ + static newNoDocument(documentKey: DocumentKey, version: SnapshotVersion): MutableDocument; + /** + * Creates a new document that is known to exist at the given version but + * whose data is not known (e.g. a document that was updated without a known + * base document). + */ + static newUnknownDocument(documentKey: DocumentKey, version: SnapshotVersion): MutableDocument; + /** + * Changes the document type to indicate that it exists and that its version + * and data are known. + */ + convertToFoundDocument(version: SnapshotVersion, value: ObjectValue): MutableDocument; + /** + * Changes the document type to indicate that it doesn't exist at the given + * version. + */ + convertToNoDocument(version: SnapshotVersion): MutableDocument; + /** + * Changes the document type to indicate that it exists at a given version but + * that its data is not known (e.g. a document that was updated without a known + * base document). + */ + convertToUnknownDocument(version: SnapshotVersion): MutableDocument; + setHasCommittedMutations(): MutableDocument; + setHasLocalMutations(): MutableDocument; + setReadTime(readTime: SnapshotVersion): MutableDocument; + get hasLocalMutations(): boolean; + get hasCommittedMutations(): boolean; + get hasPendingWrites(): boolean; + isValidDocument(): boolean; + isFoundDocument(): boolean; + isNoDocument(): boolean; + isUnknownDocument(): boolean; + isEqual(other: Document | null | undefined): boolean; + mutableCopy(): MutableDocument; + toString(): string; +} +/** + * Compares the value for field `field` in the provided documents. Throws if + * the field does not exist in both documents. + */ +export declare function compareDocumentsByField(field: FieldPath, d1: Document, d2: Document): number; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/document_comparator.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/document_comparator.d.ts new file mode 100644 index 0000000..100ed19 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/document_comparator.d.ts @@ -0,0 +1,19 @@ +/** + * @license + * Copyright 2017 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 { Document } from './document'; +export type DocumentComparator = (doc1: Document, doc2: Document) => number; +export declare function compareByKey(doc1: Document, doc2: Document): number; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/document_key.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/document_key.d.ts new file mode 100644 index 0000000..4c95b57 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/document_key.d.ts @@ -0,0 +1,45 @@ +/** + * @license + * Copyright 2017 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 { ResourcePath } from './path'; +/** + * @internal + */ +export declare class DocumentKey { + readonly path: ResourcePath; + constructor(path: ResourcePath); + static fromPath(path: string): DocumentKey; + static fromName(name: string): DocumentKey; + static empty(): DocumentKey; + get collectionGroup(): string; + /** Returns true if the document is in the specified collectionId. */ + hasCollectionId(collectionId: string): boolean; + /** Returns the collection group (i.e. the name of the parent collection) for this key. */ + getCollectionGroup(): string; + /** Returns the fully qualified path to the parent collection. */ + getCollectionPath(): ResourcePath; + isEqual(other: DocumentKey | null): boolean; + toString(): string; + static comparator(k1: DocumentKey, k2: DocumentKey): number; + static isDocumentKey(path: ResourcePath): boolean; + /** + * Creates and returns a new document key with the given segments. + * + * @param segments - The segments of the path to the document + * @returns A new instance of DocumentKey + */ + static fromSegments(segments: string[]): DocumentKey; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/document_set.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/document_set.d.ts new file mode 100644 index 0000000..5dc7ebd --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/document_set.d.ts @@ -0,0 +1,57 @@ +/** + * @license + * Copyright 2017 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 { Document } from './document'; +import { DocumentComparator } from './document_comparator'; +import { DocumentKey } from './document_key'; +/** + * DocumentSet is an immutable (copy-on-write) collection that holds documents + * in order specified by the provided comparator. We always add a document key + * comparator on top of what is provided to guarantee document equality based on + * the key. + */ +export declare class DocumentSet { + /** + * Returns an empty copy of the existing DocumentSet, using the same + * comparator. + */ + static emptySet(oldSet: DocumentSet): DocumentSet; + private comparator; + private keyedMap; + private sortedSet; + /** The default ordering is by key if the comparator is omitted */ + constructor(comp?: DocumentComparator); + has(key: DocumentKey): boolean; + get(key: DocumentKey): Document | null; + first(): Document | null; + last(): Document | null; + isEmpty(): boolean; + /** + * Returns the index of the provided key in the document set, or -1 if the + * document key is not present in the set; + */ + indexOf(key: DocumentKey): number; + get size(): number; + /** Iterates documents in order defined by "comparator" */ + forEach(cb: (doc: Document) => void): void; + /** Inserts or updates a document with the same key */ + add(doc: Document): DocumentSet; + /** Deletes a document with a given key */ + delete(key: DocumentKey): DocumentSet; + isEqual(other: DocumentSet | null | undefined): boolean; + toString(): string; + private copy; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/field_index.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/field_index.d.ts new file mode 100644 index 0000000..1f4ccb0 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/field_index.d.ts @@ -0,0 +1,171 @@ +/** + * @license + * Copyright 2021 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 { SnapshotVersion } from '../core/snapshot_version'; +import { Document } from './document'; +import { DocumentKey } from './document_key'; +import { FieldPath } from './path'; +/** + * The initial mutation batch id for each index. Gets updated during index + * backfill. + */ +export declare const INITIAL_LARGEST_BATCH_ID = -1; +/** + * The initial sequence number for each index. Gets updated during index + * backfill. + */ +export declare const INITIAL_SEQUENCE_NUMBER = 0; +/** + * An index definition for field indexes in Firestore. + * + * Every index is associated with a collection. The definition contains a list + * of fields and their index kind (which can be `ASCENDING`, `DESCENDING` or + * `CONTAINS` for ArrayContains/ArrayContainsAny queries). + * + * Unlike the backend, the SDK does not differentiate between collection or + * collection group-scoped indices. Every index can be used for both single + * collection and collection group queries. + */ +export declare class FieldIndex { + /** + * The index ID. Returns -1 if the index ID is not available (e.g. the index + * has not yet been persisted). + */ + readonly indexId: number; + /** The collection ID this index applies to. */ + readonly collectionGroup: string; + /** The field segments for this index. */ + readonly fields: IndexSegment[]; + /** Shows how up-to-date the index is for the current user. */ + readonly indexState: IndexState; + /** An ID for an index that has not yet been added to persistence. */ + static UNKNOWN_ID: number; + constructor( + /** + * The index ID. Returns -1 if the index ID is not available (e.g. the index + * has not yet been persisted). + */ + indexId: number, + /** The collection ID this index applies to. */ + collectionGroup: string, + /** The field segments for this index. */ + fields: IndexSegment[], + /** Shows how up-to-date the index is for the current user. */ + indexState: IndexState); +} +/** Returns the ArrayContains/ArrayContainsAny segment for this index. */ +export declare function fieldIndexGetArraySegment(fieldIndex: FieldIndex): IndexSegment | undefined; +/** Returns all directional (ascending/descending) segments for this index. */ +export declare function fieldIndexGetDirectionalSegments(fieldIndex: FieldIndex): IndexSegment[]; +/** + * Returns the order of the document key component for the given index. + * + * PORTING NOTE: This is only used in the Web IndexedDb implementation. + */ +export declare function fieldIndexGetKeyOrder(fieldIndex: FieldIndex): IndexKind; +/** + * Compares indexes by collection group and segments. Ignores update time and + * index ID. + */ +export declare function fieldIndexSemanticComparator(left: FieldIndex, right: FieldIndex): number; +/** Returns a debug representation of the field index */ +export declare function fieldIndexToString(fieldIndex: FieldIndex): string; +/** The type of the index, e.g. for which type of query it can be used. */ +export declare const enum IndexKind { + /** + * Ordered index. Can be used for <, <=, ==, >=, >, !=, IN and NOT IN queries. + */ + ASCENDING = 0, + /** + * Ordered index. Can be used for <, <=, ==, >=, >, !=, IN and NOT IN queries. + */ + DESCENDING = 1, + /** Contains index. Can be used for ArrayContains and ArrayContainsAny. */ + CONTAINS = 2 +} +/** An index component consisting of field path and index type. */ +export declare class IndexSegment { + /** The field path of the component. */ + readonly fieldPath: FieldPath; + /** The fields sorting order. */ + readonly kind: IndexKind; + constructor( + /** The field path of the component. */ + fieldPath: FieldPath, + /** The fields sorting order. */ + kind: IndexKind); +} +/** + * Stores the "high water mark" that indicates how updated the Index is for the + * current user. + */ +export declare class IndexState { + /** + * Indicates when the index was last updated (relative to other indexes). + */ + readonly sequenceNumber: number; + /** The the latest indexed read time, document and batch id. */ + readonly offset: IndexOffset; + constructor( + /** + * Indicates when the index was last updated (relative to other indexes). + */ + sequenceNumber: number, + /** The the latest indexed read time, document and batch id. */ + offset: IndexOffset); + /** The state of an index that has not yet been backfilled. */ + static empty(): IndexState; +} +/** + * Creates an offset that matches all documents with a read time higher than + * `readTime`. + */ +export declare function newIndexOffsetSuccessorFromReadTime(readTime: SnapshotVersion, largestBatchId: number): IndexOffset; +/** Creates a new offset based on the provided document. */ +export declare function newIndexOffsetFromDocument(document: Document): IndexOffset; +/** + * Stores the latest read time, document and batch ID that were processed for an + * index. + */ +export declare class IndexOffset { + /** + * The latest read time version that has been indexed by Firestore for this + * field index. + */ + readonly readTime: SnapshotVersion; + /** + * The key of the last document that was indexed for this query. Use + * `DocumentKey.empty()` if no document has been indexed. + */ + readonly documentKey: DocumentKey; + readonly largestBatchId: number; + constructor( + /** + * The latest read time version that has been indexed by Firestore for this + * field index. + */ + readTime: SnapshotVersion, + /** + * The key of the last document that was indexed for this query. Use + * `DocumentKey.empty()` if no document has been indexed. + */ + documentKey: DocumentKey, largestBatchId: number); + /** Returns an offset that sorts before all regular offsets. */ + static min(): IndexOffset; + /** Returns an offset that sorts after all regular offsets. */ + static max(): IndexOffset; +} +export declare function indexOffsetComparator(left: IndexOffset, right: IndexOffset): number; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/field_mask.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/field_mask.d.ts new file mode 100644 index 0000000..555ea0d --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/field_mask.d.ts @@ -0,0 +1,45 @@ +/** + * @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 { FieldPath } from './path'; +/** + * Provides a set of fields that can be used to partially patch a document. + * FieldMask is used in conjunction with ObjectValue. + * Examples: + * foo - Overwrites foo entirely with the provided value. If foo is not + * present in the companion ObjectValue, the field is deleted. + * foo.bar - Overwrites only the field bar of the object foo. + * If foo is not an object, foo is replaced with an object + * containing foo + */ +export declare class FieldMask { + readonly fields: FieldPath[]; + constructor(fields: FieldPath[]); + static empty(): FieldMask; + /** + * Returns a new FieldMask object that is the result of adding all the given + * fields paths to this field mask. + */ + unionWith(extraFields: FieldPath[]): FieldMask; + /** + * Verifies that `fieldPath` is included by at least one field in this field + * mask. + * + * This is an O(n) operation, where `n` is the size of the field mask. + */ + covers(fieldPath: FieldPath): boolean; + isEqual(other: FieldMask): boolean; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/mutation.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/mutation.d.ts new file mode 100644 index 0000000..9dd68b9 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/mutation.d.ts @@ -0,0 +1,270 @@ +/** + * @license + * Copyright 2017 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 { SnapshotVersion } from '../core/snapshot_version'; +import { Timestamp } from '../lite-api/timestamp'; +import { Value as ProtoValue } from '../protos/firestore_proto_api'; +import { Document, MutableDocument } from './document'; +import { DocumentKey } from './document_key'; +import { FieldMask } from './field_mask'; +import { ObjectValue } from './object_value'; +import { FieldPath } from './path'; +import { TransformOperation } from './transform_operation'; +/** A field path and the TransformOperation to perform upon it. */ +export declare class FieldTransform { + readonly field: FieldPath; + readonly transform: TransformOperation; + constructor(field: FieldPath, transform: TransformOperation); +} +export declare function fieldTransformEquals(left: FieldTransform, right: FieldTransform): boolean; +export declare function fieldTransformsAreEqual(left?: FieldTransform[], right?: FieldTransform[]): boolean; +/** The result of successfully applying a mutation to the backend. */ +export declare class MutationResult { + /** + * The version at which the mutation was committed: + * + * - For most operations, this is the updateTime in the WriteResult. + * - For deletes, the commitTime of the WriteResponse (because deletes are + * not stored and have no updateTime). + * + * Note that these versions can be different: No-op writes will not change + * the updateTime even though the commitTime advances. + */ + readonly version: SnapshotVersion; + /** + * The resulting fields returned from the backend after a mutation + * containing field transforms has been committed. Contains one FieldValue + * for each FieldTransform that was in the mutation. + * + * Will be empty if the mutation did not contain any field transforms. + */ + readonly transformResults: Array<ProtoValue | null>; + constructor( + /** + * The version at which the mutation was committed: + * + * - For most operations, this is the updateTime in the WriteResult. + * - For deletes, the commitTime of the WriteResponse (because deletes are + * not stored and have no updateTime). + * + * Note that these versions can be different: No-op writes will not change + * the updateTime even though the commitTime advances. + */ + version: SnapshotVersion, + /** + * The resulting fields returned from the backend after a mutation + * containing field transforms has been committed. Contains one FieldValue + * for each FieldTransform that was in the mutation. + * + * Will be empty if the mutation did not contain any field transforms. + */ + transformResults: Array<ProtoValue | null>); +} +export declare const enum MutationType { + Set = 0, + Patch = 1, + Delete = 2, + Verify = 3 +} +/** + * Encodes a precondition for a mutation. This follows the model that the + * backend accepts with the special case of an explicit "empty" precondition + * (meaning no precondition). + */ +export declare class Precondition { + readonly updateTime?: SnapshotVersion | undefined; + readonly exists?: boolean | undefined; + private constructor(); + /** Creates a new empty Precondition. */ + static none(): Precondition; + /** Creates a new Precondition with an exists flag. */ + static exists(exists: boolean): Precondition; + /** Creates a new Precondition based on a version a document exists at. */ + static updateTime(version: SnapshotVersion): Precondition; + /** Returns whether this Precondition is empty. */ + get isNone(): boolean; + isEqual(other: Precondition): boolean; +} +/** Returns true if the preconditions is valid for the given document. */ +export declare function preconditionIsValidForDocument(precondition: Precondition, document: MutableDocument): boolean; +/** + * A mutation describes a self-contained change to a document. Mutations can + * create, replace, delete, and update subsets of documents. + * + * Mutations not only act on the value of the document but also its version. + * + * For local mutations (mutations that haven't been committed yet), we preserve + * the existing version for Set and Patch mutations. For Delete mutations, we + * reset the version to 0. + * + * Here's the expected transition table. + * + * MUTATION APPLIED TO RESULTS IN + * + * SetMutation Document(v3) Document(v3) + * SetMutation NoDocument(v3) Document(v0) + * SetMutation InvalidDocument(v0) Document(v0) + * PatchMutation Document(v3) Document(v3) + * PatchMutation NoDocument(v3) NoDocument(v3) + * PatchMutation InvalidDocument(v0) UnknownDocument(v3) + * DeleteMutation Document(v3) NoDocument(v0) + * DeleteMutation NoDocument(v3) NoDocument(v0) + * DeleteMutation InvalidDocument(v0) NoDocument(v0) + * + * For acknowledged mutations, we use the updateTime of the WriteResponse as + * the resulting version for Set and Patch mutations. As deletes have no + * explicit update time, we use the commitTime of the WriteResponse for + * Delete mutations. + * + * If a mutation is acknowledged by the backend but fails the precondition check + * locally, we transition to an `UnknownDocument` and rely on Watch to send us + * the updated version. + * + * Field transforms are used only with Patch and Set Mutations. We use the + * `updateTransforms` message to store transforms, rather than the `transforms`s + * messages. + * + * ## Subclassing Notes + * + * Every type of mutation needs to implement its own applyToRemoteDocument() and + * applyToLocalView() to implement the actual behavior of applying the mutation + * to some source document (see `setMutationApplyToRemoteDocument()` for an + * example). + */ +export declare abstract class Mutation { + abstract readonly type: MutationType; + abstract readonly key: DocumentKey; + abstract readonly precondition: Precondition; + abstract readonly fieldTransforms: FieldTransform[]; + /** + * Returns a `FieldMask` representing the fields that will be changed by + * applying this mutation. Returns `null` if the mutation will overwrite the + * entire document. + */ + abstract getFieldMask(): FieldMask | null; +} +/** + * A utility method to calculate a `Mutation` representing the overlay from the + * final state of the document, and a `FieldMask` representing the fields that + * are mutated by the local mutations. + */ +export declare function calculateOverlayMutation(doc: MutableDocument, mask: FieldMask | null): Mutation | null; +/** + * Applies this mutation to the given document for the purposes of computing a + * new remote document. If the input document doesn't match the expected state + * (e.g. it is invalid or outdated), the document type may transition to + * unknown. + * + * @param mutation - The mutation to apply. + * @param document - The document to mutate. The input document can be an + * invalid document if the client has no knowledge of the pre-mutation state + * of the document. + * @param mutationResult - The result of applying the mutation from the backend. + */ +export declare function mutationApplyToRemoteDocument(mutation: Mutation, document: MutableDocument, mutationResult: MutationResult): void; +/** + * Applies this mutation to the given document for the purposes of computing + * the new local view of a document. If the input document doesn't match the + * expected state, the document is not modified. + * + * @param mutation - The mutation to apply. + * @param document - The document to mutate. The input document can be an + * invalid document if the client has no knowledge of the pre-mutation state + * of the document. + * @param previousMask - The fields that have been updated before applying this mutation. + * @param localWriteTime - A timestamp indicating the local write time of the + * batch this mutation is a part of. + * @returns A `FieldMask` representing the fields that are changed by applying this mutation. + */ +export declare function mutationApplyToLocalView(mutation: Mutation, document: MutableDocument, previousMask: FieldMask | null, localWriteTime: Timestamp): FieldMask | null; +/** + * If this mutation is not idempotent, returns the base value to persist with + * this mutation. If a base value is returned, the mutation is always applied + * to this base value, even if document has already been updated. + * + * The base value is a sparse object that consists of only the document + * fields for which this mutation contains a non-idempotent transformation + * (e.g. a numeric increment). The provided value guarantees consistent + * behavior for non-idempotent transforms and allow us to return the same + * latency-compensated value even if the backend has already applied the + * mutation. The base value is null for idempotent mutations, as they can be + * re-played even if the backend has already applied them. + * + * @returns a base value to store along with the mutation, or null for + * idempotent mutations. + */ +export declare function mutationExtractBaseValue(mutation: Mutation, document: Document): ObjectValue | null; +export declare function mutationEquals(left: Mutation, right: Mutation): boolean; +/** + * A mutation that creates or replaces the document at the given key with the + * object value contents. + */ +export declare class SetMutation extends Mutation { + readonly key: DocumentKey; + readonly value: ObjectValue; + readonly precondition: Precondition; + readonly fieldTransforms: FieldTransform[]; + constructor(key: DocumentKey, value: ObjectValue, precondition: Precondition, fieldTransforms?: FieldTransform[]); + readonly type: MutationType; + getFieldMask(): FieldMask | null; +} +/** + * A mutation that modifies fields of the document at the given key with the + * given values. The values are applied through a field mask: + * + * * When a field is in both the mask and the values, the corresponding field + * is updated. + * * When a field is in neither the mask nor the values, the corresponding + * field is unmodified. + * * When a field is in the mask but not in the values, the corresponding field + * is deleted. + * * When a field is not in the mask but is in the values, the values map is + * ignored. + */ +export declare class PatchMutation extends Mutation { + readonly key: DocumentKey; + readonly data: ObjectValue; + readonly fieldMask: FieldMask; + readonly precondition: Precondition; + readonly fieldTransforms: FieldTransform[]; + constructor(key: DocumentKey, data: ObjectValue, fieldMask: FieldMask, precondition: Precondition, fieldTransforms?: FieldTransform[]); + readonly type: MutationType; + getFieldMask(): FieldMask | null; +} +/** A mutation that deletes the document at the given key. */ +export declare class DeleteMutation extends Mutation { + readonly key: DocumentKey; + readonly precondition: Precondition; + constructor(key: DocumentKey, precondition: Precondition); + readonly type: MutationType; + readonly fieldTransforms: FieldTransform[]; + getFieldMask(): FieldMask | null; +} +/** + * A mutation that verifies the existence of the document at the given key with + * the provided precondition. + * + * The `verify` operation is only used in Transactions, and this class serves + * primarily to facilitate serialization into protos. + */ +export declare class VerifyMutation extends Mutation { + readonly key: DocumentKey; + readonly precondition: Precondition; + constructor(key: DocumentKey, precondition: Precondition); + readonly type: MutationType; + readonly fieldTransforms: FieldTransform[]; + getFieldMask(): FieldMask | null; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/mutation_batch.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/mutation_batch.d.ts new file mode 100644 index 0000000..c05b01e --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/mutation_batch.d.ts @@ -0,0 +1,88 @@ +/** + * @license + * Copyright 2017 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 { SnapshotVersion } from '../core/snapshot_version'; +import { BatchId } from '../core/types'; +import { Timestamp } from '../lite-api/timestamp'; +import { DocumentKeySet, MutationMap, DocumentVersionMap, OverlayedDocumentMap } from './collections'; +import { MutableDocument } from './document'; +import { FieldMask } from './field_mask'; +import { Mutation, MutationResult } from './mutation'; +/** + * A batch of mutations that will be sent as one unit to the backend. + */ +export declare class MutationBatch { + batchId: BatchId; + localWriteTime: Timestamp; + baseMutations: Mutation[]; + mutations: Mutation[]; + /** + * @param batchId - The unique ID of this mutation batch. + * @param localWriteTime - The original write time of this mutation. + * @param baseMutations - Mutations that are used to populate the base + * values when this mutation is applied locally. This can be used to locally + * overwrite values that are persisted in the remote document cache. Base + * mutations are never sent to the backend. + * @param mutations - The user-provided mutations in this mutation batch. + * User-provided mutations are applied both locally and remotely on the + * backend. + */ + constructor(batchId: BatchId, localWriteTime: Timestamp, baseMutations: Mutation[], mutations: Mutation[]); + /** + * Applies all the mutations in this MutationBatch to the specified document + * to compute the state of the remote document + * + * @param document - The document to apply mutations to. + * @param batchResult - The result of applying the MutationBatch to the + * backend. + */ + applyToRemoteDocument(document: MutableDocument, batchResult: MutationBatchResult): void; + /** + * Computes the local view of a document given all the mutations in this + * batch. + * + * @param document - The document to apply mutations to. + * @param mutatedFields - Fields that have been updated before applying this mutation batch. + * @returns A `FieldMask` representing all the fields that are mutated. + */ + applyToLocalView(document: MutableDocument, mutatedFields: FieldMask | null): FieldMask | null; + /** + * Computes the local view for all provided documents given the mutations in + * this batch. Returns a `DocumentKey` to `Mutation` map which can be used to + * replace all the mutation applications. + */ + applyToLocalDocumentSet(documentMap: OverlayedDocumentMap, documentsWithoutRemoteVersion: DocumentKeySet): MutationMap; + keys(): DocumentKeySet; + isEqual(other: MutationBatch): boolean; +} +/** The result of applying a mutation batch to the backend. */ +export declare class MutationBatchResult { + readonly batch: MutationBatch; + readonly commitVersion: SnapshotVersion; + readonly mutationResults: MutationResult[]; + /** + * A pre-computed mapping from each mutated document to the resulting + * version. + */ + readonly docVersions: DocumentVersionMap; + private constructor(); + /** + * Creates a new MutationBatchResult for the given batch and results. There + * must be one result for each mutation in the batch. This static factory + * caches a document=>version mapping (docVersions). + */ + static from(batch: MutationBatch, commitVersion: SnapshotVersion, results: MutationResult[]): MutationBatchResult; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/normalize.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/normalize.d.ts new file mode 100644 index 0000000..c279ba7 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/normalize.d.ts @@ -0,0 +1,33 @@ +/** + * @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 { Timestamp } from '../protos/firestore_proto_api'; +import { ByteString } from '../util/byte_string'; +/** + * Converts the possible Proto values for a timestamp value into a "seconds and + * nanos" representation. + */ +export declare function normalizeTimestamp(date: Timestamp): { + seconds: number; + nanos: number; +}; +/** + * Converts the possible Proto types for numbers into a JavaScript number. + * Returns 0 if the value is not numeric. + */ +export declare function normalizeNumber(value: number | string | undefined): number; +/** Converts the possible Proto types for Blobs into a ByteString. */ +export declare function normalizeByteString(blob: string | Uint8Array): ByteString; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/object_value.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/object_value.d.ts new file mode 100644 index 0000000..d299e86 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/object_value.d.ts @@ -0,0 +1,78 @@ +/** + * @license + * Copyright 2017 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 { MapValue as ProtoMapValue, Value as ProtoValue } from '../protos/firestore_proto_api'; +import { FieldMask } from './field_mask'; +import { FieldPath } from './path'; +export interface JsonObject<T> { + [name: string]: T; +} +/** + * An ObjectValue represents a MapValue in the Firestore Proto and offers the + * ability to add and remove fields (via the ObjectValueBuilder). + */ +export declare class ObjectValue { + readonly value: { + mapValue: ProtoMapValue; + }; + constructor(value: { + mapValue: ProtoMapValue; + }); + static empty(): ObjectValue; + /** + * Returns the value at the given path or null. + * + * @param path - the path to search + * @returns The value at the path or null if the path is not set. + */ + field(path: FieldPath): ProtoValue | null; + /** + * Sets the field to the provided value. + * + * @param path - The field path to set. + * @param value - The value to set. + */ + set(path: FieldPath, value: ProtoValue): void; + /** + * Sets the provided fields to the provided values. + * + * @param data - A map of fields to values (or null for deletes). + */ + setAll(data: Map<FieldPath, ProtoValue | null>): void; + /** + * Removes the field at the specified path. If there is no field at the + * specified path, nothing is changed. + * + * @param path - The field path to remove. + */ + delete(path: FieldPath): void; + isEqual(other: ObjectValue): boolean; + /** + * Returns the map that contains the leaf element of `path`. If the parent + * entry does not yet exist, or if it is not a map, a new map will be created. + */ + private getFieldsMap; + /** + * Modifies `fieldsMap` by adding, replacing or deleting the specified + * entries. + */ + private applyChanges; + clone(): ObjectValue; +} +/** + * Returns a FieldMask built from all fields in a MapValue. + */ +export declare function extractFieldMask(value: ProtoMapValue): FieldMask; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/overlay.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/overlay.d.ts new file mode 100644 index 0000000..ef90621 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/overlay.d.ts @@ -0,0 +1,32 @@ +/** + * @license + * Copyright 2022 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 { DocumentKey } from './document_key'; +import { Mutation } from './mutation'; +/** + * Representation of an overlay computed by Firestore. + * + * Holds information about a mutation and the largest batch id in Firestore when + * the mutation was created. + */ +export declare class Overlay { + readonly largestBatchId: number; + readonly mutation: Mutation; + constructor(largestBatchId: number, mutation: Mutation); + getKey(): DocumentKey; + isEqual(other: Overlay | null): boolean; + toString(): string; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/path.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/path.d.ts new file mode 100644 index 0000000..a33f0e8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/path.d.ts @@ -0,0 +1,121 @@ +/** + * @license + * Copyright 2017 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. + */ +export declare const DOCUMENT_KEY_NAME = "__name__"; +/** + * Path represents an ordered sequence of string segments. + */ +declare abstract class BasePath<B extends BasePath<B>> { + private segments; + private offset; + private len; + constructor(segments: string[], offset?: number, length?: number); + /** + * Abstract constructor method to construct an instance of B with the given + * parameters. + */ + protected abstract construct(segments: string[], offset?: number, length?: number): B; + /** + * Returns a String representation. + * + * Implementing classes are required to provide deterministic implementations as + * the String representation is used to obtain canonical Query IDs. + */ + abstract toString(): string; + get length(): number; + isEqual(other: B): boolean; + child(nameOrPath: string | B): B; + /** The index of one past the last segment of the path. */ + private limit; + popFirst(size?: number): B; + popLast(): B; + firstSegment(): string; + lastSegment(): string; + get(index: number): string; + isEmpty(): boolean; + isPrefixOf(other: this): boolean; + isImmediateParentOf(potentialChild: this): boolean; + forEach(fn: (segment: string) => void): void; + toArray(): string[]; + /** + * Compare 2 paths segment by segment, prioritizing numeric IDs + * (e.g., "__id123__") in numeric ascending order, followed by string + * segments in lexicographical order. + */ + static comparator<T extends BasePath<T>>(p1: BasePath<T>, p2: BasePath<T>): number; + private static compareSegments; + private static isNumericId; + private static extractNumericId; +} +/** + * A slash-separated path for navigating resources (documents and collections) + * within Firestore. + * + * @internal + */ +export declare class ResourcePath extends BasePath<ResourcePath> { + protected construct(segments: string[], offset?: number, length?: number): ResourcePath; + canonicalString(): string; + toString(): string; + /** + * Returns a string representation of this path + * where each path segment has been encoded with + * `encodeURIComponent`. + */ + toUriEncodedString(): string; + /** + * Creates a resource path from the given slash-delimited string. If multiple + * arguments are provided, all components are combined. Leading and trailing + * slashes from all components are ignored. + */ + static fromString(...pathComponents: string[]): ResourcePath; + static emptyPath(): ResourcePath; +} +/** + * A dot-separated path for navigating sub-objects within a document. + * @internal + */ +export declare class FieldPath extends BasePath<FieldPath> { + protected construct(segments: string[], offset?: number, length?: number): FieldPath; + /** + * Returns true if the string could be used as a segment in a field path + * without escaping. + */ + private static isValidIdentifier; + canonicalString(): string; + toString(): string; + /** + * Returns true if this field references the key of a document. + */ + isKeyField(): boolean; + /** + * The field designating the key of a document. + */ + static keyField(): FieldPath; + /** + * Parses a field string from the given server-formatted string. + * + * - Splitting the empty string is not allowed (for now at least). + * - Empty segments within the string (e.g. if there are two consecutive + * separators) are not allowed. + * + * TODO(b/37244157): we should make this more strict. Right now, it allows + * non-identifier path components, even if they aren't escaped. + */ + static fromServerFormat(path: string): FieldPath; + static emptyPath(): FieldPath; +} +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/server_timestamps.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/server_timestamps.d.ts new file mode 100644 index 0000000..d4e8c4a --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/server_timestamps.d.ts @@ -0,0 +1,34 @@ +/** + * @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 { Timestamp } from '../lite-api/timestamp'; +import { Value as ProtoValue } from '../protos/firestore_proto_api'; +export declare function isServerTimestamp(value: ProtoValue | null): boolean; +/** + * Creates a new ServerTimestamp proto value (using the internal format). + */ +export declare function serverTimestamp(localWriteTime: Timestamp, previousValue: ProtoValue | null): ProtoValue; +/** + * Returns the value of the field before this ServerTimestamp was set. + * + * Preserving the previous values allows the user to display the last resoled + * value until the backend responds with the timestamp. + */ +export declare function getPreviousValue(value: ProtoValue): ProtoValue | null; +/** + * Returns the local time at which this timestamp was first set. + */ +export declare function getLocalWriteTime(value: ProtoValue): Timestamp; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/target_index_matcher.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/target_index_matcher.d.ts new file mode 100644 index 0000000..d313f1e --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/target_index_matcher.d.ts @@ -0,0 +1,76 @@ +/** + * @license + * Copyright 2022 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 { Target } from '../core/target'; +import { FieldIndex } from './field_index'; +/** + * A light query planner for Firestore. + * + * This class matches a `FieldIndex` against a Firestore Query `Target`. It + * determines whether a given index can be used to serve the specified target. + * + * The following table showcases some possible index configurations: + * + * Query | Index + * ----------------------------------------------------------------------------- + * where('a', '==', 'a').where('b', '==', 'b') | a ASC, b DESC + * where('a', '==', 'a').where('b', '==', 'b') | a ASC + * where('a', '==', 'a').where('b', '==', 'b') | b DESC + * where('a', '>=', 'a').orderBy('a') | a ASC + * where('a', '>=', 'a').orderBy('a', 'desc') | a DESC + * where('a', '>=', 'a').orderBy('a').orderBy('b') | a ASC, b ASC + * where('a', '>=', 'a').orderBy('a').orderBy('b') | a ASC + * where('a', 'array-contains', 'a').orderBy('b') | a CONTAINS, b ASCENDING + * where('a', 'array-contains', 'a').orderBy('b') | a CONTAINS + */ +export declare class TargetIndexMatcher { + private readonly collectionId; + private inequalityFilters; + private readonly equalityFilters; + private readonly orderBys; + constructor(target: Target); + get hasMultipleInequality(): boolean; + /** + * Returns whether the index can be used to serve the TargetIndexMatcher's + * target. + * + * An index is considered capable of serving the target when: + * - The target uses all index segments for its filters and orderBy clauses. + * The target can have additional filter and orderBy clauses, but not + * fewer. + * - If an ArrayContains/ArrayContainsAnyfilter is used, the index must also + * have a corresponding `CONTAINS` segment. + * - All directional index segments can be mapped to the target as a series of + * equality filters, a single inequality filter and a series of orderBy + * clauses. + * - The segments that represent the equality filters may appear out of order. + * - The optional segment for the inequality filter must appear after all + * equality segments. + * - The segments that represent that orderBy clause of the target must appear + * in order after all equality and inequality segments. Single orderBy + * clauses cannot be skipped, but a continuous orderBy suffix may be + * omitted. + */ + servedByIndex(index: FieldIndex): boolean; + /** + * Returns a full matched field index for this target. Currently multiple + * inequality query is not supported so function returns null. + */ + buildTargetIndex(): FieldIndex | null; + private hasMatchingEqualityFilter; + private matchesFilter; + private matchesOrderBy; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/transform_operation.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/transform_operation.d.ts new file mode 100644 index 0000000..be1e0f3 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/transform_operation.d.ts @@ -0,0 +1,75 @@ +/** + * @license + * Copyright 2018 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 { Timestamp } from '../lite-api/timestamp'; +import { Value as ProtoValue } from '../protos/firestore_proto_api'; +import { Serializer } from '../remote/number_serializer'; +/** Used to represent a field transform on a mutation. */ +export declare class TransformOperation { + private _; +} +/** + * Computes the local transform result against the provided `previousValue`, + * optionally using the provided localWriteTime. + */ +export declare function applyTransformOperationToLocalView(transform: TransformOperation, previousValue: ProtoValue | null, localWriteTime: Timestamp): ProtoValue; +/** + * Computes a final transform result after the transform has been acknowledged + * by the server, potentially using the server-provided transformResult. + */ +export declare function applyTransformOperationToRemoteDocument(transform: TransformOperation, previousValue: ProtoValue | null, transformResult: ProtoValue | null): ProtoValue; +/** + * If this transform operation is not idempotent, returns the base value to + * persist for this transform. If a base value is returned, the transform + * operation is always applied to this base value, even if document has + * already been updated. + * + * Base values provide consistent behavior for non-idempotent transforms and + * allow us to return the same latency-compensated value even if the backend + * has already applied the transform operation. The base value is null for + * idempotent transforms, as they can be re-played even if the backend has + * already applied them. + * + * @returns a base value to store along with the mutation, or null for + * idempotent transforms. + */ +export declare function computeTransformOperationBaseValue(transform: TransformOperation, previousValue: ProtoValue | null): ProtoValue | null; +export declare function transformOperationEquals(left: TransformOperation, right: TransformOperation): boolean; +/** Transforms a value into a server-generated timestamp. */ +export declare class ServerTimestampTransform extends TransformOperation { +} +/** Transforms an array value via a union operation. */ +export declare class ArrayUnionTransformOperation extends TransformOperation { + readonly elements: ProtoValue[]; + constructor(elements: ProtoValue[]); +} +/** Transforms an array value via a remove operation. */ +export declare class ArrayRemoveTransformOperation extends TransformOperation { + readonly elements: ProtoValue[]; + constructor(elements: ProtoValue[]); +} +/** + * Implements the backend semantics for locally computed NUMERIC_ADD (increment) + * transforms. Converts all field values to integers or doubles, but unlike the + * backend does not cap integer values at 2^63. Instead, JavaScript number + * arithmetic is used and precision loss can occur for values greater than 2^53. + */ +export declare class NumericIncrementTransformOperation extends TransformOperation { + readonly serializer: Serializer; + readonly operand: ProtoValue; + constructor(serializer: Serializer, operand: ProtoValue); +} +export declare function applyNumericIncrementTransformOperationToLocalView(transform: NumericIncrementTransformOperation, previousValue: ProtoValue | null): ProtoValue; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/type_order.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/type_order.d.ts new file mode 100644 index 0000000..bb09c39 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/type_order.d.ts @@ -0,0 +1,38 @@ +/** + * @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. + */ +/** + * All the different kinds of values that can be stored in fields in + * a document. The types of the same comparison order should be defined + * together as a group. The order of each group is defined by the Firestore + * backend and is available at: + * https://firebase.google.com/docs/firestore/manage-data/data-types + */ +export declare const enum TypeOrder { + NullValue = 0, + BooleanValue = 1, + NumberValue = 2, + TimestampValue = 3, + ServerTimestampValue = 4, + StringValue = 5, + BlobValue = 6, + RefValue = 7, + GeoPointValue = 8, + ArrayValue = 9, + VectorValue = 10, + ObjectValue = 11, + MaxValue = 9007199254740991 +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/values.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/values.d.ts new file mode 100644 index 0000000..94b377f --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/model/values.d.ts @@ -0,0 +1,114 @@ +/** + * @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 { DatabaseId } from '../core/database_info'; +import { ArrayValue, MapValue, Value as ProtoValue, Value } from '../protos/firestore_proto_api'; +import { DocumentKey } from './document_key'; +import { TypeOrder } from './type_order'; +export declare const TYPE_KEY = "__type__"; +export declare const MAX_VALUE: Value; +export declare const VECTOR_VALUE_SENTINEL = "__vector__"; +export declare const VECTOR_MAP_VECTORS_KEY = "value"; +export declare const MIN_VALUE: Value; +/** Extracts the backend's type order for the provided value. */ +export declare function typeOrder(value: Value): TypeOrder; +/** Tests `left` and `right` for equality based on the backend semantics. */ +export declare function valueEquals(left: Value, right: Value): boolean; +export declare function numberEquals(left: Value, right: Value): boolean; +/** Returns true if the ArrayValue contains the specified element. */ +export declare function arrayValueContains(haystack: ArrayValue, needle: Value): boolean; +export declare function valueCompare(left: Value, right: Value): number; +/** + * Generates the canonical ID for the provided field value (as used in Target + * serialization). + */ +export declare function canonicalId(value: Value): string; +/** + * Returns an approximate (and wildly inaccurate) in-memory size for the field + * value. + * + * The memory size takes into account only the actual user data as it resides + * in memory and ignores object overhead. + */ +export declare function estimateByteSize(value: Value): number; +/** Returns a reference value for the provided database and key. */ +export declare function refValue(databaseId: DatabaseId, key: DocumentKey): Value; +/** Returns true if `value` is an IntegerValue . */ +export declare function isInteger(value?: Value | null): value is { + integerValue: string | number; +}; +/** Returns true if `value` is a DoubleValue. */ +export declare function isDouble(value?: Value | null): value is { + doubleValue: string | number; +}; +/** Returns true if `value` is either an IntegerValue or a DoubleValue. */ +export declare function isNumber(value?: Value | null): boolean; +/** Returns true if `value` is an ArrayValue. */ +export declare function isArray(value?: Value | null): value is { + arrayValue: ArrayValue; +}; +/** Returns true if `value` is a ReferenceValue. */ +export declare function isReferenceValue(value?: Value | null): value is { + referenceValue: string; +}; +/** Returns true if `value` is a NullValue. */ +export declare function isNullValue(value?: Value | null): value is { + nullValue: 'NULL_VALUE'; +}; +/** Returns true if `value` is NaN. */ +export declare function isNanValue(value?: Value | null): value is { + doubleValue: 'NaN' | number; +}; +/** Returns true if `value` is a MapValue. */ +export declare function isMapValue(value?: Value | null): value is { + mapValue: MapValue; +}; +/** Returns true if `value` is a VetorValue. */ +export declare function isVectorValue(value: ProtoValue | null): boolean; +/** Creates a deep copy of `source`. */ +export declare function deepClone(source: Value): Value; +/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */ +export declare function isMaxValue(value: Value): boolean; +export declare const MIN_VECTOR_VALUE: { + mapValue: { + fields: { + __type__: { + stringValue: string; + }; + value: { + arrayValue: {}; + }; + }; + }; +}; +/** Returns the lowest value for the given value type (inclusive). */ +export declare function valuesGetLowerBound(value: Value): Value; +/** Returns the largest value for the given value type (exclusive). */ +export declare function valuesGetUpperBound(value: Value): Value; +export declare function lowerBoundCompare(left: { + value: Value; + inclusive: boolean; +}, right: { + value: Value; + inclusive: boolean; +}): number; +export declare function upperBoundCompare(left: { + value: Value; + inclusive: boolean; +}, right: { + value: Value; + inclusive: boolean; +}): number; |
