diff options
Diffstat (limited to 'frontend-old/node_modules/@firebase/firestore/dist/firestore/src')
271 files changed, 30303 insertions, 0 deletions
diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api.d.ts new file mode 100644 index 0000000..f5d6e02 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api.d.ts @@ -0,0 +1,65 @@ +/** + * @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. + */ +export { aggregateFieldEqual, aggregateQuerySnapshotEqual, average, count, getAggregateFromServer, getCountFromServer, sum } from './api/aggregate'; +export { AggregateField, AggregateFieldType, AggregateQuerySnapshot, AggregateSpec, AggregateSpecData, AggregateType } from './lite-api/aggregate_types'; +export { FirestoreLocalCache, MemoryCacheSettings, MemoryEagerGarbageCollector, memoryEagerGarbageCollector, MemoryGarbageCollector, MemoryLocalCache, memoryLocalCache, MemoryLruGarbageCollector, memoryLruGarbageCollector, PersistentCacheSettings, PersistentLocalCache, persistentLocalCache, PersistentMultipleTabManager, persistentMultipleTabManager, PersistentSingleTabManager, persistentSingleTabManager, PersistentSingleTabManagerSettings, PersistentTabManager } from './api/cache_config'; +export { documentId, FieldPath } from './api/field_path'; +export { clearIndexedDbPersistence, connectFirestoreEmulator, disableNetwork, EmulatorMockTokenOptions, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, ensureFirestoreConfigured, Firestore, getFirestore, initializeFirestore, loadBundle, namedQuery, terminate, waitForPendingWrites } from './api/database'; +export { LoadBundleTask, LoadBundleTaskProgress, TaskState } from './api/bundle'; +export { FirestoreSettings, PersistenceSettings } from './api/settings'; +export type { PrivateSettings } from './lite-api/settings'; +export { ExperimentalLongPollingOptions } from './api/long_polling_options'; +export { DocumentChange, DocumentChangeType, DocumentSnapshot, documentSnapshotFromJSON, FirestoreDataConverter, QueryDocumentSnapshot, QuerySnapshot, querySnapshotFromJSON, snapshotEqual, SnapshotMetadata, SnapshotOptions } from './api/snapshot'; +export { collection, collectionGroup, CollectionReference, doc, DocumentData, DocumentReference, PartialWithFieldValue, Query, queryEqual, refEqual, SetOptions, UpdateData, WithFieldValue } from './api/reference'; +export { and, endAt, endBefore, limit, limitToLast, or, orderBy, OrderByDirection, query, QueryCompositeFilterConstraint, QueryConstraint, QueryConstraintType, QueryEndAtConstraint, QueryFieldFilterConstraint, QueryFilterConstraint, QueryLimitConstraint, QueryNonFilterConstraint, QueryOrderByConstraint, QueryStartAtConstraint, startAfter, startAt, where, WhereFilterOp } from './api/filter'; +export { ListenSource, SnapshotListenOptions, Unsubscribe } from './api/reference_impl'; +export { TransactionOptions } from './api/transaction_options'; +export { runTransaction, Transaction } from './api/transaction'; +export { addDoc, deleteDoc, executeWrite, getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, onSnapshot, onSnapshotsInSync, onSnapshotResume, setDoc, updateDoc } from './api/reference_impl'; +export { FieldValue } from './api/field_value'; +export { arrayRemove, arrayUnion, deleteField, increment, serverTimestamp, vector } from './api/field_value_impl'; +export { VectorValue } from './lite-api/vector_value'; +export { LogLevelString as LogLevel, setLogLevel } from './util/log'; +export { Bytes } from './api/bytes'; +export { WriteBatch, writeBatch } from './api/write_batch'; +export { GeoPoint } from './api/geo_point'; +export { Timestamp } from './api/timestamp'; +export { CACHE_SIZE_UNLIMITED } from './api/database'; +export { FirestoreError, FirestoreErrorCode } from './util/error'; +export { AbstractUserDataWriter } from './lite-api/user_data_writer'; +export { AddPrefixToKeys, ChildUpdateFields, NestedUpdateFields, Primitive, UnionToIntersection } from '../src/lite-api/types'; +export { Index, IndexConfiguration, IndexField, setIndexConfiguration } from './api/index_configuration'; +export { PersistentCacheIndexManager, getPersistentCacheIndexManager, deleteAllPersistentCacheIndexes, enablePersistentCacheIndexAutoCreation, disablePersistentCacheIndexAutoCreation } from './api/persistent_cache_index_manager'; +/** + * Internal exports + */ +export { isBase64Available as _isBase64Available } from './platform/base64'; +export { DatabaseId as _DatabaseId } from './core/database_info'; +export { _internalQueryToProtoQueryTarget, _internalAggregationQueryToProtoRunAggregationQueryRequest } from './remote/internal_serializer'; +export { cast as _cast, validateIsNotUsedTogether as _validateIsNotUsedTogether } from './util/input_validation'; +export { DocumentKey as _DocumentKey } from './model/document_key'; +export { debugAssert as _debugAssert } from './util/assert'; +export { FieldPath as _FieldPath } from './model/path'; +export type { ResourcePath as _ResourcePath } from './model/path'; +export { ByteString as _ByteString } from './util/byte_string'; +export { logWarn as _logWarn } from './util/log'; +export { AutoId as _AutoId } from './util/misc'; +export type { AuthTokenFactory, FirstPartyCredentialsSettings } from './api/credentials'; +export { EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider } from './api/credentials'; +export { EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider } from './api/credentials'; +export { ExistenceFilterMismatchCallback as _TestingHooksExistenceFilterMismatchCallback, TestingHooks as _TestingHooks } from './util/testing_hooks'; +export { ExistenceFilterMismatchInfo as _TestingHooksExistenceFilterMismatchInfo } from './util/testing_hooks_spi'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/aggregate.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/aggregate.d.ts new file mode 100644 index 0000000..39bd4b4 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/aggregate.d.ts @@ -0,0 +1,77 @@ +/** + * @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 { AggregateField, AggregateSpec, DocumentData, Query } from '../api'; +import { AggregateQuerySnapshot } from '../lite-api/aggregate_types'; +export { aggregateQuerySnapshotEqual, count, sum, average, aggregateFieldEqual } from '../lite-api/aggregate'; +/** + * Calculates the number of documents in the result set of the given query + * without actually downloading the documents. + * + * Using this function to count the documents is efficient because only the + * final count, not the documents' data, is downloaded. This function can + * count the documents in cases where the result set is prohibitively large to + * download entirely (thousands of documents). + * + * The result received from the server is presented, unaltered, without + * considering any local state. That is, documents in the local cache are not + * taken into consideration, neither are local modifications not yet + * synchronized with the server. Previously-downloaded results, if any, are not + * used. Every invocation of this function necessarily involves a round trip to + * the server. + * + * @param query The query whose result set size is calculated. + * @returns A Promise that will be resolved with the count; the count can be + * retrieved from `snapshot.data().count`, where `snapshot` is the + * `AggregateQuerySnapshot` to which the returned Promise resolves. + */ +export declare function getCountFromServer<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<AggregateQuerySnapshot<{ + count: AggregateField<number>; +}, AppModelType, DbModelType>>; +/** + * Calculates the specified aggregations over the documents in the result + * set of the given query without actually downloading the documents. + * + * Using this function to perform aggregations is efficient because only the + * final aggregation values, not the documents' data, are downloaded. This + * function can perform aggregations of the documents in cases where the result + * set is prohibitively large to download entirely (thousands of documents). + * + * The result received from the server is presented, unaltered, without + * considering any local state. That is, documents in the local cache are not + * taken into consideration, neither are local modifications not yet + * synchronized with the server. Previously-downloaded results, if any, are not + * used. Every invocation of this function necessarily involves a round trip to + * the server. + * + * @param query The query whose result set is aggregated over. + * @param aggregateSpec An `AggregateSpec` object that specifies the aggregates + * to perform over the result set. The AggregateSpec specifies aliases for each + * aggregate, which can be used to retrieve the aggregate result. + * @example + * ```typescript + * const aggregateSnapshot = await getAggregateFromServer(query, { + * countOfDocs: count(), + * totalHours: sum('hours'), + * averageScore: average('score') + * }); + * + * const countOfDocs: number = aggregateSnapshot.data().countOfDocs; + * const totalHours: number = aggregateSnapshot.data().totalHours; + * const averageScore: number | null = aggregateSnapshot.data().averageScore; + * ``` + */ +export declare function getAggregateFromServer<AggregateSpecType extends AggregateSpec, AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, aggregateSpec: AggregateSpecType): Promise<AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/bundle.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/bundle.d.ts new file mode 100644 index 0000000..15c33af --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/bundle.d.ts @@ -0,0 +1,94 @@ +/** + * @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 { FirestoreError } from '../util/error'; +/** + * Represents the state of bundle loading tasks. + * + * Both 'Error' and 'Success' are sinking state: task will abort or complete and there will + * be no more updates after they are reported. + */ +export type TaskState = 'Error' | 'Running' | 'Success'; +/** + * Represents a progress update or a final state from loading bundles. + */ +export interface LoadBundleTaskProgress { + /** How many documents have been loaded. */ + documentsLoaded: number; + /** How many documents are in the bundle being loaded. */ + totalDocuments: number; + /** How many bytes have been loaded. */ + bytesLoaded: number; + /** How many bytes are in the bundle being loaded. */ + totalBytes: number; + /** Current task state. */ + taskState: TaskState; +} +/** + * Represents the task of loading a Firestore bundle. It provides progress of bundle + * loading, as well as task completion and error events. + * + * The API is compatible with `Promise<LoadBundleTaskProgress>`. + */ +export declare class LoadBundleTask implements PromiseLike<LoadBundleTaskProgress> { + private _progressObserver; + private _taskCompletionResolver; + private _lastProgress; + /** + * Registers functions to listen to bundle loading progress events. + * @param next - Called when there is a progress update from bundle loading. Typically `next` calls occur + * each time a Firestore document is loaded from the bundle. + * @param error - Called when an error occurs during bundle loading. The task aborts after reporting the + * error, and there should be no more updates after this. + * @param complete - Called when the loading task is complete. + */ + onProgress(next?: (progress: LoadBundleTaskProgress) => unknown, error?: (err: Error) => unknown, complete?: () => void): void; + /** + * Implements the `Promise<LoadBundleTaskProgress>.catch` interface. + * + * @param onRejected - Called when an error occurs during bundle loading. + */ + catch<R>(onRejected: (a: Error) => R | PromiseLike<R>): Promise<R | LoadBundleTaskProgress>; + /** + * Implements the `Promise<LoadBundleTaskProgress>.then` interface. + * + * @param onFulfilled - Called on the completion of the loading task with a final `LoadBundleTaskProgress` update. + * The update will always have its `taskState` set to `"Success"`. + * @param onRejected - Called when an error occurs during bundle loading. + */ + then<T, R>(onFulfilled?: (a: LoadBundleTaskProgress) => T | PromiseLike<T>, onRejected?: (a: Error) => R | PromiseLike<R>): Promise<T | R>; + /** + * Notifies all observers that bundle loading has completed, with a provided + * `LoadBundleTaskProgress` object. + * + * @private + */ + _completeWith(progress: LoadBundleTaskProgress): void; + /** + * Notifies all observers that bundle loading has failed, with a provided + * `Error` as the reason. + * + * @private + */ + _failWith(error: FirestoreError): void; + /** + * Notifies a progress update of loading a bundle. + * @param progress - The new progress. + * + * @private + */ + _updateProgress(progress: LoadBundleTaskProgress): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/bytes.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/bytes.d.ts new file mode 100644 index 0000000..0c9f5fd --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/bytes.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export { Bytes } from '../lite-api/bytes'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/cache_config.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/cache_config.d.ts new file mode 100644 index 0000000..936f21e --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/cache_config.d.ts @@ -0,0 +1,222 @@ +/** + * @license + * Copyright 2023 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 { OfflineComponentProviderFactory, OnlineComponentProviderFactory } from '../core/component_provider'; +/** + * Provides an in-memory cache to the SDK. This is the default cache unless explicitly + * configured otherwise. + * + * To use, create an instance using the factory function {@link memoryLocalCache()}, then + * set the instance to `FirestoreSettings.cache` and call `initializeFirestore` using + * the settings object. + */ +export type MemoryLocalCache = { + kind: 'memory'; + /** + * @internal + */ + _onlineComponentProvider: OnlineComponentProviderFactory; + /** + * @internal + */ + _offlineComponentProvider: OfflineComponentProviderFactory; +}; +/** + * Provides a persistent cache backed by IndexedDb to the SDK. + * + * To use, create an instance using the factory function {@link persistentLocalCache()}, then + * set the instance to `FirestoreSettings.cache` and call `initializeFirestore` using + * the settings object. + */ +export type PersistentLocalCache = { + kind: 'persistent'; + /** + * @internal + */ + _onlineComponentProvider: OnlineComponentProviderFactory; + /** + * @internal + */ + _offlineComponentProvider: OfflineComponentProviderFactory; +}; +/** + * Union type from all supported SDK cache layer. + */ +export type FirestoreLocalCache = MemoryLocalCache | PersistentLocalCache; +/** + * Union type from all support garbage collectors for memory local cache. + */ +export type MemoryGarbageCollector = MemoryEagerGarbageCollector | MemoryLruGarbageCollector; +/** + * A garbage collector deletes documents whenever they are not part of any + * active queries, and have no local mutations attached to them. + * + * This collector tries to ensure lowest memory footprints from the SDK, + * at the risk of documents not being cached for offline queries or for + * direct queries to the cache. + * + * Use factory function {@link memoryEagerGarbageCollector()} to create an + * instance of this collector. + */ +export type MemoryEagerGarbageCollector = { + kind: 'memoryEager'; + /** + * @internal + */ + _offlineComponentProvider: OfflineComponentProviderFactory; +}; +/** + * A garbage collector deletes Least-Recently-Used documents in multiple + * batches. + * + * This collector is configured with a target size, and will only perform + * collection when the cached documents exceed the target size. It avoids + * querying backend repeated for the same query or document, at the risk + * of having a larger memory footprint. + * + * Use factory function {@link memoryLruGarbageCollector()} to create a + * instance of this collector. + */ +export type MemoryLruGarbageCollector = { + kind: 'memoryLru'; + /** + * @internal + */ + _offlineComponentProvider: OfflineComponentProviderFactory; +}; +/** + * Creates an instance of `MemoryEagerGarbageCollector`. This is also the + * default garbage collector unless it is explicitly specified otherwise. + */ +export declare function memoryEagerGarbageCollector(): MemoryEagerGarbageCollector; +/** + * Creates an instance of `MemoryLruGarbageCollector`. + * + * A target size can be specified as part of the setting parameter. The + * collector will start deleting documents once the cache size exceeds + * the given size. The default cache size is 40MB (40 * 1024 * 1024 bytes). + */ +export declare function memoryLruGarbageCollector(settings?: { + cacheSizeBytes?: number; +}): MemoryLruGarbageCollector; +/** + * An settings object to configure an `MemoryLocalCache` instance. + */ +export type MemoryCacheSettings = { + /** + * The garbage collector to use, for the memory cache layer. + * A `MemoryEagerGarbageCollector` is used when this is undefined. + */ + garbageCollector?: MemoryGarbageCollector; +}; +/** + * Creates an instance of `MemoryLocalCache`. The instance can be set to + * `FirestoreSettings.cache` to tell the SDK which cache layer to use. + */ +export declare function memoryLocalCache(settings?: MemoryCacheSettings): MemoryLocalCache; +/** + * An settings object to configure an `PersistentLocalCache` instance. + * + * Persistent cache cannot be used in a Node.js environment. + */ +export type PersistentCacheSettings = { + /** + * An approximate cache size threshold for the on-disk data. If the cache + * grows beyond this size, Firestore will start removing data that hasn't been + * recently used. The SDK does not guarantee that the cache will stay below + * that size, only that if the cache exceeds the given size, cleanup will be + * attempted. + * + * The default value is 40 MB. The threshold must be set to at least 1 MB, and + * can be set to `CACHE_SIZE_UNLIMITED` to disable garbage collection. + */ + cacheSizeBytes?: number; + /** + * Specifies how multiple tabs/windows will be managed by the SDK. + */ + tabManager?: PersistentTabManager; +}; +/** + * Creates an instance of `PersistentLocalCache`. The instance can be set to + * `FirestoreSettings.cache` to tell the SDK which cache layer to use. + * + * Persistent cache cannot be used in a Node.js environment. + */ +export declare function persistentLocalCache(settings?: PersistentCacheSettings): PersistentLocalCache; +/** + * A tab manager supporting only one tab, no synchronization will be + * performed across tabs. + */ +export type PersistentSingleTabManager = { + kind: 'persistentSingleTab'; + /** + * @internal + */ + _initialize: (settings: Omit<PersistentCacheSettings, 'tabManager'> | undefined) => void; + /** + * @internal + */ + _onlineComponentProvider?: OnlineComponentProviderFactory; + /** + * @internal + */ + _offlineComponentProvider?: OfflineComponentProviderFactory; +}; +/** + * A tab manager supporting multiple tabs. SDK will synchronize queries and + * mutations done across all tabs using the SDK. + */ +export type PersistentMultipleTabManager = { + kind: 'PersistentMultipleTab'; + /** + * @internal + */ + _initialize: (settings: Omit<PersistentCacheSettings, 'tabManager'>) => void; + /** + * @internal + */ + _onlineComponentProvider?: OnlineComponentProviderFactory; + /** + * @internal + */ + _offlineComponentProvider?: OfflineComponentProviderFactory; +}; +/** + * A union of all available tab managers. + */ +export type PersistentTabManager = PersistentSingleTabManager | PersistentMultipleTabManager; +/** + * Type to configure an `PersistentSingleTabManager` instance. + */ +export type PersistentSingleTabManagerSettings = { + /** + * Whether to force-enable persistent (IndexedDB) cache for the client. This + * cannot be used with multi-tab synchronization and is primarily intended for + * use with Web Workers. Setting this to `true` will enable IndexedDB, but cause + * other tabs using IndexedDB cache to fail. + */ + forceOwnership?: boolean; +}; +/** + * Creates an instance of `PersistentSingleTabManager`. + * + * @param settings Configures the created tab manager. + */ +export declare function persistentSingleTabManager(settings: PersistentSingleTabManagerSettings | undefined): PersistentSingleTabManager; +/** + * Creates an instance of `PersistentMultipleTabManager`. + */ +export declare function persistentMultipleTabManager(): PersistentMultipleTabManager; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/credentials.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/credentials.d.ts new file mode 100644 index 0000000..98ed3c2 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/credentials.d.ts @@ -0,0 +1,222 @@ +/** + * @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 { FirebaseApp } from '@firebase/app'; +import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types'; +import { FirebaseAuthInternalName } from '@firebase/auth-interop-types'; +import { Provider } from '@firebase/component'; +import { User } from '../auth/user'; +import { AsyncQueue } from '../util/async_queue'; +/** + * @internal + */ +export type AuthTokenFactory = () => string; +/** + * @internal + */ +export interface FirstPartyCredentialsSettings { + ['type']: 'firstParty'; + ['sessionIndex']: string; + ['iamToken']: string | null; + ['authTokenFactory']: AuthTokenFactory | null; +} +export interface ProviderCredentialsSettings { + ['type']: 'provider'; + ['client']: CredentialsProvider<User>; +} +/** Settings for private credentials */ +export type CredentialsSettings = FirstPartyCredentialsSettings | ProviderCredentialsSettings; +export type TokenType = 'OAuth' | 'FirstParty' | 'AppCheck'; +export interface Token { + /** Type of token. */ + type: TokenType; + /** + * The user with which the token is associated (used for persisting user + * state on disk, etc.). + * This will be null for Tokens of the type 'AppCheck'. + */ + user?: User; + /** Header values to set for this token */ + headers: Map<string, string>; +} +export declare class OAuthToken implements Token { + user: User; + type: TokenType; + headers: Map<any, any>; + constructor(value: string, user: User); +} +/** + * A Listener for credential change events. The listener should fetch a new + * token and may need to invalidate other state if the current user has also + * changed. + */ +export type CredentialChangeListener<T> = (credential: T) => Promise<void>; +/** + * Provides methods for getting the uid and token for the current user and + * listening for changes. + */ +export interface CredentialsProvider<T> { + /** + * Starts the credentials provider and specifies a listener to be notified of + * credential changes (sign-in / sign-out, token changes). It is immediately + * called once with the initial user. + * + * The change listener is invoked on the provided AsyncQueue. + */ + start(asyncQueue: AsyncQueue, changeListener: CredentialChangeListener<T>): void; + /** Requests a token for the current user. */ + getToken(): Promise<Token | null>; + /** + * Marks the last retrieved token as invalid, making the next GetToken request + * force-refresh the token. + */ + invalidateToken(): void; + shutdown(): void; +} +/** + * A CredentialsProvider that always yields an empty token. + * @internal + */ +export declare class EmptyAuthCredentialsProvider implements CredentialsProvider<User> { + getToken(): Promise<Token | null>; + invalidateToken(): void; + start(asyncQueue: AsyncQueue, changeListener: CredentialChangeListener<User>): void; + shutdown(): void; +} +/** + * A CredentialsProvider that always returns a constant token. Used for + * emulator token mocking. + */ +export declare class EmulatorAuthCredentialsProvider implements CredentialsProvider<User> { + private token; + constructor(token: Token); + /** + * Stores the listener registered with setChangeListener() + * This isn't actually necessary since the UID never changes, but we use this + * to verify the listen contract is adhered to in tests. + */ + private changeListener; + getToken(): Promise<Token | null>; + invalidateToken(): void; + start(asyncQueue: AsyncQueue, changeListener: CredentialChangeListener<User>): void; + shutdown(): void; +} +/** Credential provider for the Lite SDK. */ +export declare class LiteAuthCredentialsProvider implements CredentialsProvider<User> { + private auth; + constructor(authProvider: Provider<FirebaseAuthInternalName>); + getToken(): Promise<Token | null>; + invalidateToken(): void; + start(asyncQueue: AsyncQueue, changeListener: CredentialChangeListener<User>): void; + shutdown(): void; +} +export declare class FirebaseAuthCredentialsProvider implements CredentialsProvider<User> { + private authProvider; + /** + * The auth token listener registered with FirebaseApp, retained here so we + * can unregister it. + */ + private tokenListener; + /** Tracks the current User. */ + private currentUser; + /** + * Counter used to detect if the token changed while a getToken request was + * outstanding. + */ + private tokenCounter; + private forceRefresh; + private auth; + constructor(authProvider: Provider<FirebaseAuthInternalName>); + start(asyncQueue: AsyncQueue, changeListener: CredentialChangeListener<User>): void; + getToken(): Promise<Token | null>; + invalidateToken(): void; + shutdown(): void; + private getUser; +} +export declare class FirstPartyToken implements Token { + private readonly sessionIndex; + private readonly iamToken; + private readonly authTokenFactory; + type: TokenType; + user: User; + private _headers; + constructor(sessionIndex: string, iamToken: string | null, authTokenFactory: AuthTokenFactory | null); + /** + * Gets an authorization token, using a provided factory function, or return + * null. + */ + private getAuthToken; + get headers(): Map<string, string>; +} +export declare class FirstPartyAuthCredentialsProvider implements CredentialsProvider<User> { + private sessionIndex; + private iamToken; + private authTokenFactory; + constructor(sessionIndex: string, iamToken: string | null, authTokenFactory: AuthTokenFactory | null); + getToken(): Promise<Token | null>; + start(asyncQueue: AsyncQueue, changeListener: CredentialChangeListener<User>): void; + shutdown(): void; + invalidateToken(): void; +} +export declare class AppCheckToken implements Token { + private value; + type: TokenType; + headers: Map<any, any>; + constructor(value: string); +} +export declare class FirebaseAppCheckTokenProvider implements CredentialsProvider<string> { + private appCheckProvider; + /** + * The AppCheck token listener registered with FirebaseApp, retained here so + * we can unregister it. + */ + private tokenListener; + private forceRefresh; + private appCheck; + private latestAppCheckToken; + private serverAppAppCheckToken; + constructor(app: FirebaseApp, appCheckProvider: Provider<AppCheckInternalComponentName>); + start(asyncQueue: AsyncQueue, changeListener: CredentialChangeListener<string>): void; + getToken(): Promise<Token | null>; + invalidateToken(): void; + shutdown(): void; +} +/** + * An AppCheck token provider that always yields an empty token. + * @internal + */ +export declare class EmptyAppCheckTokenProvider implements CredentialsProvider<string> { + getToken(): Promise<Token | null>; + invalidateToken(): void; + start(asyncQueue: AsyncQueue, changeListener: CredentialChangeListener<string>): void; + shutdown(): void; +} +/** AppCheck token provider for the Lite SDK. */ +export declare class LiteAppCheckTokenProvider implements CredentialsProvider<string> { + private appCheckProvider; + private appCheck; + private serverAppAppCheckToken; + constructor(app: FirebaseApp, appCheckProvider: Provider<AppCheckInternalComponentName>); + getToken(): Promise<Token | null>; + invalidateToken(): void; + start(asyncQueue: AsyncQueue, changeListener: CredentialChangeListener<string>): void; + shutdown(): void; +} +/** + * Builds a CredentialsProvider depending on the type of + * the credentials passed in. + */ +export declare function makeAuthCredentialsProvider(credentials?: CredentialsSettings): CredentialsProvider<User>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/database.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/database.d.ts new file mode 100644 index 0000000..8004dae --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/database.d.ts @@ -0,0 +1,279 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FirebaseApp } from '@firebase/app'; +import { User } from '../auth/user'; +import { OfflineComponentProviderFactory, OnlineComponentProviderFactory } from '../core/component_provider'; +import { DatabaseId } from '../core/database_info'; +import { FirestoreClient } from '../core/firestore_client'; +import { Firestore as LiteFirestore } from '../lite-api/database'; +import { Query } from '../lite-api/reference'; +import { AsyncQueue } from '../util/async_queue'; +import { LoadBundleTask } from './bundle'; +import { CredentialsProvider } from './credentials'; +import { FirestoreSettings, PersistenceSettings } from './settings'; +export { connectFirestoreEmulator, EmulatorMockTokenOptions } from '../lite-api/database'; +declare module '@firebase/component' { + interface NameServiceMapping { + 'firestore': Firestore; + } +} +/** + * Constant used to indicate the LRU garbage collection should be disabled. + * Set this value as the `cacheSizeBytes` on the settings passed to the + * {@link Firestore} instance. + */ +export declare const CACHE_SIZE_UNLIMITED = -1; +/** + * The Cloud Firestore service interface. + * + * Do not call this constructor directly. Instead, use {@link (getFirestore:1)}. + */ +export declare class Firestore extends LiteFirestore { + /** + * Whether it's a {@link Firestore} or Firestore Lite instance. + */ + type: 'firestore-lite' | 'firestore'; + _queue: AsyncQueue; + readonly _persistenceKey: string; + _firestoreClient: FirestoreClient | undefined; + _componentsProvider?: { + _offline: OfflineComponentProviderFactory; + _online: OnlineComponentProviderFactory; + }; + /** @hideconstructor */ + constructor(authCredentialsProvider: CredentialsProvider<User>, appCheckCredentialsProvider: CredentialsProvider<string>, databaseId: DatabaseId, app?: FirebaseApp); + protected _terminate(): Promise<void>; +} +/** + * Initializes a new instance of {@link Firestore} with the provided settings. + * Can only be called before any other function, including + * {@link (getFirestore:1)}. If the custom settings are empty, this function is + * equivalent to calling {@link (getFirestore:1)}. + * + * @param app - The {@link @firebase/app#FirebaseApp} with which the {@link Firestore} instance will + * be associated. + * @param settings - A settings object to configure the {@link Firestore} instance. + * @param databaseId - The name of the database. + * @returns A newly initialized {@link Firestore} instance. + */ +export declare function initializeFirestore(app: FirebaseApp, settings: FirestoreSettings, databaseId?: string): Firestore; +/** + * Returns the existing default {@link Firestore} instance that is associated with the + * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new + * instance with default settings. + * + * @returns The default {@link Firestore} instance of the default app. + */ +export declare function getFirestore(): Firestore; +/** + * Returns the existing default {@link Firestore} instance that is associated with the + * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new + * instance with default settings. + * + * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore} + * instance is associated with. + * @returns The default {@link Firestore} instance of the provided app. + */ +export declare function getFirestore(app: FirebaseApp): Firestore; +/** + * Returns the existing named {@link Firestore} instance that is associated with the + * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new + * instance with default settings. + * + * @param databaseId - The name of the database. + * @returns The named {@link Firestore} instance of the default app. + * @beta + */ +export declare function getFirestore(databaseId: string): Firestore; +/** + * Returns the existing named {@link Firestore} instance that is associated with the + * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new + * instance with default settings. + * + * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore} + * instance is associated with. + * @param databaseId - The name of the database. + * @returns The named {@link Firestore} instance of the provided app. + * @beta + */ +export declare function getFirestore(app: FirebaseApp, databaseId: string): Firestore; +/** + * @internal + */ +export declare function ensureFirestoreConfigured(firestore: Firestore): FirestoreClient; +export declare function configureFirestore(firestore: Firestore): void; +/** + * Attempts to enable persistent storage, if possible. + * + * On failure, `enableIndexedDbPersistence()` will reject the promise or + * throw an exception. There are several reasons why this can fail, which can be + * identified by the `code` on the error. + * + * * failed-precondition: The app is already open in another browser tab. + * * unimplemented: The browser is incompatible with the offline persistence + * implementation. + * + * Note that even after a failure, the {@link Firestore} instance will remain + * usable, however offline persistence will be disabled. + * + * Note: `enableIndexedDbPersistence()` must be called before any other functions + * (other than {@link initializeFirestore}, {@link (getFirestore:1)} or + * {@link clearIndexedDbPersistence}. + * + * Persistence cannot be used in a Node.js environment. + * + * @param firestore - The {@link Firestore} instance to enable persistence for. + * @param persistenceSettings - Optional settings object to configure + * persistence. + * @returns A `Promise` that represents successfully enabling persistent storage. + * @deprecated This function will be removed in a future major release. Instead, set + * `FirestoreSettings.localCache` to an instance of `PersistentLocalCache` to + * turn on IndexedDb cache. Calling this function when `FirestoreSettings.localCache` + * is already specified will throw an exception. + */ +export declare function enableIndexedDbPersistence(firestore: Firestore, persistenceSettings?: PersistenceSettings): Promise<void>; +/** + * Attempts to enable multi-tab persistent storage, if possible. If enabled + * across all tabs, all operations share access to local persistence, including + * shared execution of queries and latency-compensated local document updates + * across all connected instances. + * + * On failure, `enableMultiTabIndexedDbPersistence()` will reject the promise or + * throw an exception. There are several reasons why this can fail, which can be + * identified by the `code` on the error. + * + * * failed-precondition: The app is already open in another browser tab and + * multi-tab is not enabled. + * * unimplemented: The browser is incompatible with the offline persistence + * implementation. + * + * Note that even after a failure, the {@link Firestore} instance will remain + * usable, however offline persistence will be disabled. + * + * @param firestore - The {@link Firestore} instance to enable persistence for. + * @returns A `Promise` that represents successfully enabling persistent + * storage. + * @deprecated This function will be removed in a future major release. Instead, set + * `FirestoreSettings.localCache` to an instance of `PersistentLocalCache` to + * turn on indexeddb cache. Calling this function when `FirestoreSettings.localCache` + * is already specified will throw an exception. + */ +export declare function enableMultiTabIndexedDbPersistence(firestore: Firestore): Promise<void>; +/** + * Clears the persistent storage. This includes pending writes and cached + * documents. + * + * Must be called while the {@link Firestore} instance is not started (after the app is + * terminated or when the app is first initialized). On startup, this function + * must be called before other functions (other than {@link + * initializeFirestore} or {@link (getFirestore:1)})). If the {@link Firestore} + * instance is still running, the promise will be rejected with the error code + * of `failed-precondition`. + * + * Note: `clearIndexedDbPersistence()` is primarily intended to help write + * reliable tests that use Cloud Firestore. It uses an efficient mechanism for + * dropping existing data but does not attempt to securely overwrite or + * otherwise make cached data unrecoverable. For applications that are sensitive + * to the disclosure of cached data in between user sessions, we strongly + * recommend not enabling persistence at all. + * + * @param firestore - The {@link Firestore} instance to clear persistence for. + * @returns A `Promise` that is resolved when the persistent storage is + * cleared. Otherwise, the promise is rejected with an error. + */ +export declare function clearIndexedDbPersistence(firestore: Firestore): Promise<void>; +/** + * Waits until all currently pending writes for the active user have been + * acknowledged by the backend. + * + * The returned promise resolves immediately if there are no outstanding writes. + * Otherwise, the promise waits for all previously issued writes (including + * those written in a previous app session), but it does not wait for writes + * that were added after the function is called. If you want to wait for + * additional writes, call `waitForPendingWrites()` again. + * + * Any outstanding `waitForPendingWrites()` promises are rejected during user + * changes. + * + * @returns A `Promise` which resolves when all currently pending writes have been + * acknowledged by the backend. + */ +export declare function waitForPendingWrites(firestore: Firestore): Promise<void>; +/** + * Re-enables use of the network for this {@link Firestore} instance after a prior + * call to {@link disableNetwork}. + * + * @returns A `Promise` that is resolved once the network has been enabled. + */ +export declare function enableNetwork(firestore: Firestore): Promise<void>; +/** + * Disables network usage for this instance. It can be re-enabled via {@link + * enableNetwork}. While the network is disabled, any snapshot listeners, + * `getDoc()` or `getDocs()` calls will return results from cache, and any write + * operations will be queued until the network is restored. + * + * @returns A `Promise` that is resolved once the network has been disabled. + */ +export declare function disableNetwork(firestore: Firestore): Promise<void>; +/** + * Terminates the provided {@link Firestore} instance. + * + * After calling `terminate()` only the `clearIndexedDbPersistence()` function + * may be used. Any other function will throw a `FirestoreError`. + * + * To restart after termination, create a new instance of FirebaseFirestore with + * {@link (getFirestore:1)}. + * + * Termination does not cancel any pending writes, and any promises that are + * awaiting a response from the server will not be resolved. If you have + * persistence enabled, the next time you start this instance, it will resume + * sending these writes to the server. + * + * Note: Under normal circumstances, calling `terminate()` is not required. This + * function is useful only when you want to force this instance to release all + * of its resources or in combination with `clearIndexedDbPersistence()` to + * ensure that all local state is destroyed between test runs. + * + * @returns A `Promise` that is resolved when the instance has been successfully + * terminated. + */ +export declare function terminate(firestore: Firestore): Promise<void>; +/** + * Loads a Firestore bundle into the local cache. + * + * @param firestore - The {@link Firestore} instance to load bundles for. + * @param bundleData - An object representing the bundle to be loaded. Valid + * objects are `ArrayBuffer`, `ReadableStream<Uint8Array>` or `string`. + * + * @returns A `LoadBundleTask` object, which notifies callers with progress + * updates, and completion or error events. It can be used as a + * `Promise<LoadBundleTaskProgress>`. + */ +export declare function loadBundle(firestore: Firestore, bundleData: ReadableStream<Uint8Array> | ArrayBuffer | string): LoadBundleTask; +/** + * Reads a Firestore {@link Query} from local cache, identified by the given + * name. + * + * The named queries are packaged into bundles on the server side (along + * with resulting documents), and loaded to local cache using `loadBundle`. Once + * in local cache, use this method to extract a {@link Query} by name. + * + * @param firestore - The {@link Firestore} instance to read the query from. + * @param name - The name of the query. + * @returns A `Promise` that is resolved with the Query or `null`. + */ +export declare function namedQuery(firestore: Firestore, name: string): Promise<Query | null>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/field_path.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/field_path.d.ts new file mode 100644 index 0000000..7e463e5 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/field_path.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export { FieldPath, documentId } from '../lite-api/field_path'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/field_value.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/field_value.d.ts new file mode 100644 index 0000000..eded0bc --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/field_value.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export { FieldValue } from '../lite-api/field_value'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/field_value_impl.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/field_value_impl.d.ts new file mode 100644 index 0000000..aac67c3 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/field_value_impl.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export { increment, arrayRemove, arrayUnion, serverTimestamp, deleteField, vector } from '../lite-api/field_value_impl'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/filter.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/filter.d.ts new file mode 100644 index 0000000..1dee60b --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/filter.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export { and, endAt, endBefore, startAfter, startAt, limitToLast, limit, or, orderBy, OrderByDirection, where, WhereFilterOp, query, QueryCompositeFilterConstraint, QueryConstraint, QueryConstraintType, QueryFilterConstraint, QueryFieldFilterConstraint, QueryOrderByConstraint, QueryLimitConstraint, QueryStartAtConstraint, QueryEndAtConstraint, QueryNonFilterConstraint } from '../lite-api/query'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/geo_point.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/geo_point.d.ts new file mode 100644 index 0000000..b14def6 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/geo_point.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export { GeoPoint } from '../lite-api/geo_point'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/index_configuration.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/index_configuration.d.ts new file mode 100644 index 0000000..8b10775 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/index_configuration.d.ts @@ -0,0 +1,139 @@ +/** + * @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 { FieldIndex } from '../model/field_index'; +import { Firestore } from './database'; +export { connectFirestoreEmulator, EmulatorMockTokenOptions } from '../lite-api/database'; +/** + * A single field element in an index configuration. + * + * @deprecated Instead of creating cache indexes manually, consider using + * `enablePersistentCacheIndexAutoCreation()` to let the SDK decide whether to + * create cache indexes for queries running locally. + * + * @beta + */ +export interface IndexField { + /** The field path to index. */ + readonly fieldPath: string; + /** + * What type of array index to create. Set to `CONTAINS` for `array-contains` + * and `array-contains-any` indexes. + * + * Only one of `arrayConfig` or `order` should be set; + */ + readonly arrayConfig?: 'CONTAINS'; + /** + * What type of array index to create. Set to `ASCENDING` or 'DESCENDING` for + * `==`, `!=`, `<=`, `<=`, `in` and `not-in` filters. + * + * Only one of `arrayConfig` or `order` should be set. + */ + readonly order?: 'ASCENDING' | 'DESCENDING'; + [key: string]: unknown; +} +/** + * The SDK definition of a Firestore index. + * + * @deprecated Instead of creating cache indexes manually, consider using + * `enablePersistentCacheIndexAutoCreation()` to let the SDK decide whether to + * create cache indexes for queries running locally. + * + * @beta + */ +export interface Index { + /** The ID of the collection to index. */ + readonly collectionGroup: string; + /** A list of fields to index. */ + readonly fields?: IndexField[]; + [key: string]: unknown; +} +/** + * A list of Firestore indexes to speed up local query execution. + * + * See {@link https://firebase.google.com/docs/reference/firestore/indexes/#json_format | JSON Format} + * for a description of the format of the index definition. + * + * @deprecated Instead of creating cache indexes manually, consider using + * `enablePersistentCacheIndexAutoCreation()` to let the SDK decide whether to + * create cache indexes for queries running locally. + * + * @beta + */ +export interface IndexConfiguration { + /** A list of all Firestore indexes. */ + readonly indexes?: Index[]; + [key: string]: unknown; +} +/** + * Configures indexing for local query execution. Any previous index + * configuration is overridden. The `Promise` resolves once the index + * configuration has been persisted. + * + * The index entries themselves are created asynchronously. You can continue to + * use queries that require indexing even if the indices are not yet available. + * Query execution will automatically start using the index once the index + * entries have been written. + * + * Indexes are only supported with IndexedDb persistence. If IndexedDb is not + * enabled, any index configuration is ignored. + * + * @param firestore - The {@link Firestore} instance to configure indexes for. + * @param configuration -The index definition. + * @throws FirestoreError if the JSON format is invalid. + * @returns A `Promise` that resolves once all indices are successfully + * configured. + * + * @deprecated Instead of creating cache indexes manually, consider using + * `enablePersistentCacheIndexAutoCreation()` to let the SDK decide whether to + * create cache indexes for queries running locally. + * + * @beta + */ +export declare function setIndexConfiguration(firestore: Firestore, configuration: IndexConfiguration): Promise<void>; +/** + * Configures indexing for local query execution. Any previous index + * configuration is overridden. The `Promise` resolves once the index + * configuration has been persisted. + * + * The index entries themselves are created asynchronously. You can continue to + * use queries that require indexing even if the indices are not yet available. + * Query execution will automatically start using the index once the index + * entries have been written. + * + * Indexes are only supported with IndexedDb persistence. Invoke either + * `enableIndexedDbPersistence()` or `enableMultiTabIndexedDbPersistence()` + * before setting an index configuration. If IndexedDb is not enabled, any + * index configuration is ignored. + * + * The method accepts the JSON format exported by the Firebase CLI (`firebase + * firestore:indexes`). If the JSON format is invalid, this method throws an + * error. + * + * @param firestore - The {@link Firestore} instance to configure indexes for. + * @param json -The JSON format exported by the Firebase CLI. + * @throws FirestoreError if the JSON format is invalid. + * @returns A `Promise` that resolves once all indices are successfully + * configured. + * + * @deprecated Instead of creating cache indexes manually, consider using + * `enablePersistentCacheIndexAutoCreation()` to let the SDK decide whether to + * create cache indexes for queries running locally. + * + * @beta + */ +export declare function setIndexConfiguration(firestore: Firestore, json: string): Promise<void>; +export declare function parseIndexes(jsonOrConfiguration: string | IndexConfiguration): FieldIndex[]; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/long_polling_options.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/long_polling_options.d.ts new file mode 100644 index 0000000..0088194 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/long_polling_options.d.ts @@ -0,0 +1,55 @@ +/** + * @license + * Copyright 2023 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. + */ +/** + * Options that configure the SDK’s underlying network transport (WebChannel) + * when long-polling is used. + * + * Note: This interface is "experimental" and is subject to change. + * + * See `FirestoreSettings.experimentalAutoDetectLongPolling`, + * `FirestoreSettings.experimentalForceLongPolling`, and + * `FirestoreSettings.experimentalLongPollingOptions`. + */ +export interface ExperimentalLongPollingOptions { + /** + * The desired maximum timeout interval, in seconds, to complete a + * long-polling GET response. Valid values are between 5 and 30, inclusive. + * Floating point values are allowed and will be rounded to the nearest + * millisecond. + * + * By default, when long-polling is used the "hanging GET" request sent by + * the client times out after 30 seconds. To request a different timeout + * from the server, set this setting with the desired timeout. + * + * Changing the default timeout may be useful, for example, if the buffering + * proxy that necessitated enabling long-polling in the first place has a + * shorter timeout for hanging GET requests, in which case setting the + * long-polling timeout to a shorter value, such as 25 seconds, may fix + * prematurely-closed hanging GET requests. + * For example, see https://github.com/firebase/firebase-js-sdk/issues/6987. + */ + timeoutSeconds?: number; +} +/** + * Compares two `ExperimentalLongPollingOptions` objects for equality. + */ +export declare function longPollingOptionsEqual(options1: ExperimentalLongPollingOptions, options2: ExperimentalLongPollingOptions): boolean; +/** + * Creates and returns a new `ExperimentalLongPollingOptions` with the same + * option values as the given instance. + */ +export declare function cloneLongPollingOptions(options: ExperimentalLongPollingOptions): ExperimentalLongPollingOptions; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/observer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/observer.d.ts new file mode 100644 index 0000000..1aa4b85 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/observer.d.ts @@ -0,0 +1,29 @@ +/** + * @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 { FirestoreError } from '../util/error'; +/** + * Observer/Subscribe interfaces. + */ +export type NextFn<T> = (value: T) => void; +export type ErrorFn = (error: FirestoreError) => void; +export type CompleteFn = () => void; +export interface PartialObserver<T> { + next?: NextFn<T>; + error?: ErrorFn; + complete?: CompleteFn; +} +export declare function isPartialObserver<T>(obj: unknown): obj is PartialObserver<T>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/parse_context.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/parse_context.d.ts new file mode 100644 index 0000000..d2b0beb --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/parse_context.d.ts @@ -0,0 +1,21 @@ +/** + * @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'; +export interface ParseContext { + readonly databaseId: DatabaseId; + readonly ignoreUndefinedProperties: boolean; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/persistent_cache_index_manager.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/persistent_cache_index_manager.d.ts new file mode 100644 index 0000000..c6e4b46 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/persistent_cache_index_manager.d.ts @@ -0,0 +1,59 @@ +/** + * @license + * Copyright 2023 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 { Firestore } from './database'; +/** + * A `PersistentCacheIndexManager` for configuring persistent cache indexes used + * for local query execution. + * + * To use, call `getPersistentCacheIndexManager()` to get an instance. + */ +export declare class PersistentCacheIndexManager { + readonly _firestore: Firestore; + /** A type string to uniquely identify instances of this class. */ + readonly type: 'PersistentCacheIndexManager'; + /** @hideconstructor */ + constructor(_firestore: Firestore); +} +/** + * Returns the PersistentCache Index Manager used by the given `Firestore` + * object. + * + * @return The `PersistentCacheIndexManager` instance, or `null` if local + * persistent storage is not in use. + */ +export declare function getPersistentCacheIndexManager(firestore: Firestore): PersistentCacheIndexManager | null; +/** + * Enables the SDK to create persistent cache indexes automatically for local + * query execution when the SDK believes cache indexes can help improve + * performance. + * + * This feature is disabled by default. + */ +export declare function enablePersistentCacheIndexAutoCreation(indexManager: PersistentCacheIndexManager): void; +/** + * Stops creating persistent cache indexes automatically for local query + * execution. The indexes which have been created by calling + * `enablePersistentCacheIndexAutoCreation()` still take effect. + */ +export declare function disablePersistentCacheIndexAutoCreation(indexManager: PersistentCacheIndexManager): void; +/** + * Removes all persistent cache indexes. + * + * Please note this function will also deletes indexes generated by + * `setIndexConfiguration()`, which is deprecated. + */ +export declare function deleteAllPersistentCacheIndexes(indexManager: PersistentCacheIndexManager): void; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/reference.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/reference.d.ts new file mode 100644 index 0000000..0e38648 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/reference.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export { DocumentReference, CollectionReference, Query, collection, collectionGroup, doc, queryEqual, SetOptions, DocumentData, UpdateData, WithFieldValue, PartialWithFieldValue, refEqual } from '../lite-api/reference'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/reference_impl.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/reference_impl.d.ts new file mode 100644 index 0000000..5dd95e6 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/reference_impl.d.ts @@ -0,0 +1,536 @@ +/** + * @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 { Bytes } from '../lite-api/bytes'; +import { FieldPath } from '../lite-api/field_path'; +import { CollectionReference, DocumentData, DocumentReference, PartialWithFieldValue, Query, SetOptions, UpdateData, WithFieldValue } from '../lite-api/reference'; +import { AbstractUserDataWriter } from '../lite-api/user_data_writer'; +import { Mutation } from '../model/mutation'; +import { ByteString } from '../util/byte_string'; +import { FirestoreError } from '../util/error'; +import { Firestore } from './database'; +import { DocumentSnapshot, FirestoreDataConverter, QuerySnapshot } from './snapshot'; +/** + * An options object that can be passed to {@link (onSnapshot:1)} and {@link + * QuerySnapshot.docChanges} to control which types of changes to include in the + * result set. + */ +export interface SnapshotListenOptions { + /** + * Include a change even if only the metadata of the query or of a document + * changed. Default is false. + */ + readonly includeMetadataChanges?: boolean; + /** + * Set the source the query listens to. Default to "default", which + * listens to both cache and server. + */ + readonly source?: ListenSource; +} +/** + * Describe the source a query listens to. + * + * Set to `default` to listen to both cache and server changes. Set to `cache` + * to listen to changes in cache only. + */ +export type ListenSource = 'default' | 'cache'; +/** + * Reads the document referred to by this `DocumentReference`. + * + * Note: `getDoc()` attempts to provide up-to-date data when possible by waiting + * for data from the server, but it may return cached data or fail if you are + * offline and the server cannot be reached. To specify this behavior, invoke + * {@link getDocFromCache} or {@link getDocFromServer}. + * + * @param reference - The reference of the document to fetch. + * @returns A Promise resolved with a `DocumentSnapshot` containing the + * current document contents. + */ +export declare function getDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>; +export declare class ExpUserDataWriter extends AbstractUserDataWriter { + protected firestore: Firestore; + constructor(firestore: Firestore); + protected convertBytes(bytes: ByteString): Bytes; + protected convertReference(name: string): DocumentReference; +} +/** + * Reads the document referred to by this `DocumentReference` from cache. + * Returns an error if the document is not currently cached. + * + * @returns A `Promise` resolved with a `DocumentSnapshot` containing the + * current document contents. + */ +export declare function getDocFromCache<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>; +/** + * Reads the document referred to by this `DocumentReference` from the server. + * Returns an error if the network is not available. + * + * @returns A `Promise` resolved with a `DocumentSnapshot` containing the + * current document contents. + */ +export declare function getDocFromServer<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>; +/** + * Executes the query and returns the results as a `QuerySnapshot`. + * + * Note: `getDocs()` attempts to provide up-to-date data when possible by + * waiting for data from the server, but it may return cached data or fail if + * you are offline and the server cannot be reached. To specify this behavior, + * invoke {@link getDocsFromCache} or {@link getDocsFromServer}. + * + * @returns A `Promise` that will be resolved with the results of the query. + */ +export declare function getDocs<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>>; +/** + * Executes the query and returns the results as a `QuerySnapshot` from cache. + * Returns an empty result set if no documents matching the query are currently + * cached. + * + * @returns A `Promise` that will be resolved with the results of the query. + */ +export declare function getDocsFromCache<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>>; +/** + * Executes the query and returns the results as a `QuerySnapshot` from the + * server. Returns an error if the network is not available. + * + * @returns A `Promise` that will be resolved with the results of the query. + */ +export declare function getDocsFromServer<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>>; +/** + * Writes to the document referred to by this `DocumentReference`. If the + * document does not yet exist, it will be created. + * + * @param reference - A reference to the document to write. + * @param data - A map of the fields and values for the document. + * @returns A `Promise` resolved once the data has been successfully written + * to the backend (note that it won't resolve while you're offline). + */ +export declare function setDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, data: WithFieldValue<AppModelType>): Promise<void>; +/** + * Writes to the document referred to by the specified `DocumentReference`. If + * the document does not yet exist, it will be created. If you provide `merge` + * or `mergeFields`, the provided data can be merged into an existing document. + * + * @param reference - A reference to the document to write. + * @param data - A map of the fields and values for the document. + * @param options - An object to configure the set behavior. + * @returns A Promise resolved once the data has been successfully written + * to the backend (note that it won't resolve while you're offline). + */ +export declare function setDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, data: PartialWithFieldValue<AppModelType>, options: SetOptions): Promise<void>; +/** + * Updates fields in the document referred to by the specified + * `DocumentReference`. The update will fail if applied to a document that does + * not exist. + * + * @param reference - A reference to the document to update. + * @param data - An object containing the fields and values with which to + * update the document. Fields can contain dots to reference nested fields + * within the document. + * @returns A `Promise` resolved once the data has been successfully written + * to the backend (note that it won't resolve while you're offline). + */ +export declare function updateDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, data: UpdateData<DbModelType>): Promise<void>; +/** + * Updates fields in the document referred to by the specified + * `DocumentReference` The update will fail if applied to a document that does + * not exist. + * + * Nested fields can be updated by providing dot-separated field path + * strings or by providing `FieldPath` objects. + * + * @param reference - A reference to the document to update. + * @param field - The first field to update. + * @param value - The first value. + * @param moreFieldsAndValues - Additional key value pairs. + * @returns A `Promise` resolved once the data has been successfully written + * to the backend (note that it won't resolve while you're offline). + */ +export declare function updateDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): Promise<void>; +/** + * Deletes the document referred to by the specified `DocumentReference`. + * + * @param reference - A reference to the document to delete. + * @returns A Promise resolved once the document has been successfully + * deleted from the backend (note that it won't resolve while you're offline). + */ +export declare function deleteDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>): Promise<void>; +/** + * Add a new document to specified `CollectionReference` with the given data, + * assigning it a document ID automatically. + * + * @param reference - A reference to the collection to add this document to. + * @param data - An Object containing the data for the new document. + * @returns A `Promise` resolved with a `DocumentReference` pointing to the + * newly created document after it has been written to the backend (Note that it + * won't resolve while you're offline). + */ +export declare function addDoc<AppModelType, DbModelType extends DocumentData>(reference: CollectionReference<AppModelType, DbModelType>, data: WithFieldValue<AppModelType>): Promise<DocumentReference<AppModelType, DbModelType>>; +/** + * A function returned by `onSnapshot()` that removes the listener when invoked. + */ +export interface Unsubscribe { + /** Removes the listener when invoked. */ + (): void; +} +/** + * Attaches a listener for `DocumentSnapshot` events. You may either pass individual `onNext` and + * `onError` callbacks or pass a single observer object with `next` and `error` callbacks. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param reference - A reference to the document to listen to. + * @param observer - A single object containing `next` and `error` callbacks. + * @returns An unsubscribe function that can be called to cancel + * the snapshot listener. + */ +export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, observer: { + next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; +}): Unsubscribe; +/** + * Attaches a listener for `DocumentSnapshot` events. You may either pass individual `onNext` and + * `onError` callbacks or pass a single observer object with `next` and `error` callbacks. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param reference - A reference to the document to listen to. + * @param options - Options controlling the listen behavior. + * @param observer - A single object containing `next` and `error` callbacks. + * @returns An unsubscribe function that can be called to cancel + * the snapshot listener. + */ +export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, options: SnapshotListenOptions, observer: { + next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; +}): Unsubscribe; +/** + * Attaches a listener for `DocumentSnapshot` events. You may either pass individual `onNext` and + * `onError` callbacks or pass a single observer object with `next` and `error` callbacks. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param reference - A reference to the document to listen to. + * @param onNext - A callback to be called every time a new `DocumentSnapshot` is available. + * @param onError - A callback to be called if the listen fails or is cancelled. No further + * callbacks will occur. + * @param onCompletion - Can be provided, but will not be called since streams are never ending. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe; +/** + * Attaches a listener for `DocumentSnapshot` events. You may either pass individual `onNext` and + * `onError` callbacks or pass a single observer object with `next` and `error` callbacks. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param reference - A reference to the document to listen to. + * @param options - Options controlling the listen behavior. + * @param onNext - A callback to be called every time a new `DocumentSnapshot` is available. + * @param onError - A callback to be called if the listen fails or is cancelled. No further + * callbacks will occur. + * @param onCompletion - Can be provided, but will not be called since streams are never ending. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, options: SnapshotListenOptions, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe; +/** + * Attaches a listener for `QuerySnapshot` events. You may either pass individual `onNext` and + * `onError` callbacks or pass a single observer object with `next` and `error` callbacks. The + * listener can be cancelled by calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param query - The query to listen to. + * @param observer - A single object containing `next` and `error` callbacks. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, observer: { + next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; +}): Unsubscribe; +/** + * Attaches a listener for `QuerySnapshot` events. You may either pass individual `onNext` and + * `onError` callbacks or pass a single observer object with `next` and `error` callbacks. The + * listener can be cancelled by calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param query - The query to listen to. + * @param options - Options controlling the listen behavior. + * @param observer - A single object containing `next` and `error` callbacks. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, options: SnapshotListenOptions, observer: { + next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; +}): Unsubscribe; +/** + * Attaches a listener for `QuerySnapshot` events. You may either pass individual `onNext` and + * `onError` callbacks or pass a single observer object with `next` and `error` callbacks. The + * listener can be cancelled by calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param query - The query to listen to. + * @param onNext - A callback to be called every time a new `QuerySnapshot` is available. + * @param onCompletion - Can be provided, but will not be called since streams are never ending. + * @param onError - A callback to be called if the listen fails or is cancelled. No further + * callbacks will occur. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe; +/** + * Attaches a listener for `QuerySnapshot` events. You may either pass individual `onNext` and + * `onError` callbacks or pass a single observer object with `next` and `error` callbacks. The + * listener can be cancelled by calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param query - The query to listen to. + * @param options - Options controlling the listen behavior. + * @param onNext - A callback to be called every time a new `QuerySnapshot` is available. + * @param onCompletion - Can be provided, but will not be called since streams are never ending. + * @param onError - A callback to be called if the listen fails or is cancelled. No further + * callbacks will occur. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, options: SnapshotListenOptions, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe; +/** + * Attaches a listener for `QuerySnapshot` events based on data generated by invoking + * {@link QuerySnapshot.toJSON} You may either pass individual `onNext` and `onError` callbacks or + * pass a single observer object with `next` and `error` callbacks. The listener can be cancelled by + * calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param firestore - The {@link Firestore} instance to enable the listener for. + * @param snapshotJson - A JSON object generated by invoking {@link QuerySnapshot.toJSON}. + * @param onNext - A callback to be called every time a new `QuerySnapshot` is available. + * @param onError - A callback to be called if the listen fails or is cancelled. No further + * callbacks will occur. + * @param onCompletion - Can be provided, but will not be called since streams are never ending. + * @param converter - An optional object that converts objects from Firestore before the onNext + * listener is invoked. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +export declare function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe; +/** + * Attaches a listener for `DocumentSnapshot` events based on data generated by invoking + * {@link DocumentSnapshot.toJSON}. You may either pass individual `onNext` and `onError` callbacks or + * pass a single observer object with `next` and `error` callbacks. The listener can be cancelled by + * calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param firestore - The {@link Firestore} instance to enable the listener for. + * @param snapshotJson - A JSON object generated by invoking {@link DocumentSnapshot.toJSON}. + * @param onNext - A callback to be called every time a new `DocumentSnapshot` is available. + * @param onError - A callback to be called if the listen fails or is cancelled. No further + * callbacks will occur. + * @param onCompletion - Can be provided, but will not be called since streams are + * never ending. + * @param converter - An optional object that converts objects from Firestore before the onNext + * listener is invoked. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +export declare function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe; +/** + * Attaches a listener for `QuerySnapshot` events based on data generated by invoking + * {@link QuerySnapshot.toJSON}. You may either pass individual `onNext` and `onError` callbacks or + * pass a single observer object with `next` and `error` callbacks. The listener can be cancelled by + * calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param firestore - The {@link Firestore} instance to enable the listener for. + * @param snapshotJson - A JSON object generated by invoking {@link QuerySnapshot.toJSON}. + * @param options - Options controlling the listen behavior. + * @param onNext - A callback to be called every time a new `QuerySnapshot` is available. + * @param onError - A callback to be called if the listen fails or is cancelled. No further + * callbacks will occur. + * @param onCompletion - Can be provided, but will not be called since streams are never ending. + * @param converter - An optional object that converts objects from Firestore before the onNext + * listener is invoked. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +export declare function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, options: SnapshotListenOptions, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe; +/** + * Attaches a listener for `DocumentSnapshot` events based on data generated by invoking + * {@link DocumentSnapshot.toJSON}. You may either pass individual `onNext` and `onError` callbacks + * or pass a single observer object with `next` and `error` callbacks. The listener can be cancelled + * by calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param firestore - The {@link Firestore} instance to enable the listener for. + * @param snapshotJson - A JSON object generated by invoking {@link DocumentSnapshot.toJSON}. + * @param options - Options controlling the listen behavior. + * @param onNext - A callback to be called every time a new `DocumentSnapshot` is available. + * @param onError - A callback to be called if the listen fails or is cancelled. No further + * callbacks will occur. + * @param onCompletion - Can be provided, but will not be called since streams are never ending. + * @param converter - An optional object that converts objects from Firestore before the onNext + * listener is invoked. + * @returns An unsubscribe function that can be called to cancel + * the snapshot listener. + */ +export declare function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, options: SnapshotListenOptions, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe; +/** + * Attaches a listener for `QuerySnapshot` events based on QuerySnapshot data generated by invoking + * {@link QuerySnapshot.toJSON}. You may either pass individual `onNext` and `onError` callbacks or + * pass a single observer object with `next` and `error` callbacks. The listener can be cancelled by + * calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param firestore - The {@link Firestore} instance to enable the listener for. + * @param snapshotJson - A JSON object generated by invoking {@link QuerySnapshot.toJSON}. + * @param observer - A single object containing `next` and `error` callbacks. + * @param converter - An optional object that converts objects from Firestore before the onNext + * listener is invoked. + * @returns An unsubscribe function that can be called to cancel + * the snapshot listener. + */ +export declare function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, observer: { + next: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; +}, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe; +/** + * Attaches a listener for `DocumentSnapshot` events based on data generated by invoking + * {@link DocumentSnapshot.toJSON} You may either pass individual `onNext` and `onError` callbacks + * or pass a single observer object with `next` and `error` callbacks. The listener can be cancelled + * by calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param firestore - The {@link Firestore} instance to enable the listener for. + * @param snapshotJson - A JSON object generated by invoking {@link DocumentSnapshot.toJSON}. + * @param observer - A single object containing `next` and `error` callbacks. + * @param converter - An optional object that converts objects from Firestore before the onNext + * listener is invoked. + * @returns An unsubscribe function that can be called to cancel + * the snapshot listener. + */ +export declare function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, observer: { + next: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; +}, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe; +/** + * Attaches a listener for `QuerySnapshot` events based on QuerySnapshot data generated by invoking + * {@link QuerySnapshot.toJSON} You may either pass individual `onNext` and `onError` callbacks or + * pass a single observer object with `next` and `error` callbacks. The listener can be cancelled by + * calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param firestore - The {@link Firestore} instance to enable the listener for. + * @param snapshotJson - A JSON object generated by invoking {@link QuerySnapshot.toJSON}. + * @param options - Options controlling the listen behavior. + * @param observer - A single object containing `next` and `error` callbacks. + * @param converter - An optional object that converts objects from Firestore before the onNext + * listener is invoked. + * @returns An unsubscribe function that can be called to cancel + * the snapshot listener. + */ +export declare function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, options: SnapshotListenOptions, observer: { + next: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; +}, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe; +/** + * Attaches a listener for `DocumentSnapshot` events based on QuerySnapshot data generated by + * invoking {@link DocumentSnapshot.toJSON} You may either pass individual `onNext` and `onError` + * callbacks or pass a single observer object with `next` and `error` callbacks. The listener can be + * cancelled by calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param firestore - The {@link Firestore} instance to enable the listener for. + * @param snapshotJson - A JSON object generated by invoking {@link DocumentSnapshot.toJSON}. + * @param options - Options controlling the listen behavior. + * @param observer - A single object containing `next` and `error` callbacks. + * @param converter - An optional object that converts objects from Firestore before the onNext + * listener is invoked. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +export declare function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, options: SnapshotListenOptions, observer: { + next: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; +}, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe; +/** + * Attaches a listener for a snapshots-in-sync event. The snapshots-in-sync + * event indicates that all listeners affected by a given change have fired, + * even if a single server-generated change affects multiple listeners. + * + * NOTE: The snapshots-in-sync event only indicates that listeners are in sync + * with each other, but does not relate to whether those snapshots are in sync + * with the server. Use SnapshotMetadata in the individual listeners to + * determine if a snapshot is from the cache or the server. + * + * @param firestore - The instance of Firestore for synchronizing snapshots. + * @param observer - A single object containing `next` and `error` callbacks. + * @returns An unsubscribe function that can be called to cancel the snapshot + * listener. + */ +export declare function onSnapshotsInSync(firestore: Firestore, observer: { + next?: (value: void) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; +}): Unsubscribe; +/** + * Attaches a listener for a snapshots-in-sync event. The snapshots-in-sync + * event indicates that all listeners affected by a given change have fired, + * even if a single server-generated change affects multiple listeners. + * + * NOTE: The snapshots-in-sync event only indicates that listeners are in sync + * with each other, but does not relate to whether those snapshots are in sync + * with the server. Use `SnapshotMetadata` in the individual listeners to + * determine if a snapshot is from the cache or the server. + * + * @param firestore - The `Firestore` instance for synchronizing snapshots. + * @param onSync - A callback to be called every time all snapshot listeners are + * in sync with each other. + * @returns An unsubscribe function that can be called to cancel the snapshot + * listener. + */ +export declare function onSnapshotsInSync(firestore: Firestore, onSync: () => void): Unsubscribe; +/** + * Locally writes `mutations` on the async queue. + * @internal + */ +export declare function executeWrite(firestore: Firestore, mutations: Mutation[]): Promise<void>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/settings.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/settings.d.ts new file mode 100644 index 0000000..8565811 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/settings.d.ts @@ -0,0 +1,108 @@ +/** + * @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 { FirestoreSettings as LiteSettings } from '../lite-api/settings'; +import { FirestoreLocalCache } from './cache_config'; +import { ExperimentalLongPollingOptions } from './long_polling_options'; +export { DEFAULT_HOST } from '../lite-api/settings'; +/** + * Settings that can be passed to `enableIndexedDbPersistence()` to configure + * Firestore persistence. + * + * Persistence cannot be used in a Node.js environment. + */ +export interface PersistenceSettings { + /** + * Whether to force enable persistence for the client. This cannot be used + * with multi-tab synchronization and is primarily intended for use with Web + * Workers. Setting this to `true` will enable persistence, but cause other + * tabs using persistence to fail. + */ + forceOwnership?: boolean; +} +/** + * Specifies custom configurations for your Cloud Firestore instance. + * You must set these before invoking any other methods. + */ +export interface FirestoreSettings extends LiteSettings { + /** + * NOTE: This field will be deprecated in a future major release. Use `cache` field + * instead to specify cache size, and other cache configurations. + * + * An approximate cache size threshold for the on-disk data. If the cache + * grows beyond this size, Firestore will start removing data that hasn't been + * recently used. The size is not a guarantee that the cache will stay below + * that size, only that if the cache exceeds the given size, cleanup will be + * attempted. + * + * The default value is 40 MB. The threshold must be set to at least 1 MB, and + * can be set to `CACHE_SIZE_UNLIMITED` to disable garbage collection. + */ + cacheSizeBytes?: number; + /** + * Specifies the cache used by the SDK. Available options are `MemoryLocalCache` + * and `PersistentLocalCache`, each with different configuration options. + * + * When unspecified, `MemoryLocalCache` will be used by default. + * + * NOTE: setting this field and `cacheSizeBytes` at the same time will throw + * exception during SDK initialization. Instead, using the configuration in + * the `FirestoreLocalCache` object to specify the cache size. + */ + localCache?: FirestoreLocalCache; + /** + * Forces the SDK’s underlying network transport (WebChannel) to use + * long-polling. Each response from the backend will be closed immediately + * after the backend sends data (by default responses are kept open in + * case the backend has more data to send). This avoids incompatibility + * issues with certain proxies, antivirus software, etc. that incorrectly + * buffer traffic indefinitely. Use of this option will cause some + * performance degradation though. + * + * This setting cannot be used with `experimentalAutoDetectLongPolling` and + * may be removed in a future release. If you find yourself using it to + * work around a specific network reliability issue, please tell us about + * it in https://github.com/firebase/firebase-js-sdk/issues/1674. + * + * This setting cannot be used in a Node.js environment. + */ + experimentalForceLongPolling?: boolean; + /** + * Configures the SDK's underlying transport (WebChannel) to automatically + * detect if long-polling should be used. This is very similar to + * `experimentalForceLongPolling`, but only uses long-polling if required. + * + * After having had a default value of `false` since its inception in 2019, + * the default value of this setting was changed in May 2023 to `true` in + * v9.22.0 of the Firebase JavaScript SDK. That is, auto-detection of long + * polling is now enabled by default. To disable it, set this setting to + * `false`, and please open a GitHub issue to share the problems that + * motivated you disabling long-polling auto-detection. + * + * This setting cannot be used in a Node.js environment. + */ + experimentalAutoDetectLongPolling?: boolean; + /** + * Options that configure the SDK’s underlying network transport (WebChannel) + * when long-polling is used. + * + * These options are only used if `experimentalForceLongPolling` is true or if + * `experimentalAutoDetectLongPolling` is true and the auto-detection + * determined that long-polling was needed. Otherwise, these options have no + * effect. + */ + experimentalLongPollingOptions?: ExperimentalLongPollingOptions; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/snapshot.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/snapshot.d.ts new file mode 100644 index 0000000..24d863e --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/snapshot.d.ts @@ -0,0 +1,550 @@ +/** + * @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 { ChangeType, ViewSnapshot } from '../core/view_snapshot'; +import { FieldPath } from '../lite-api/field_path'; +import { DocumentData, PartialWithFieldValue, Query, SetOptions, WithFieldValue } from '../lite-api/reference'; +import { DocumentSnapshot as LiteDocumentSnapshot, FirestoreDataConverter as LiteFirestoreDataConverter } from '../lite-api/snapshot'; +import { UntypedFirestoreDataConverter } from '../lite-api/user_data_reader'; +import { AbstractUserDataWriter } from '../lite-api/user_data_writer'; +import { Document } from '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { Property } from '../util/json_validation'; +import { Firestore } from './database'; +import { SnapshotListenOptions } from './reference_impl'; +/** + * Converter used by `withConverter()` to transform user objects of type + * `AppModelType` into Firestore data of type `DbModelType`. + * + * Using the converter allows you to specify generic type arguments when + * storing and retrieving objects from Firestore. + * + * In this context, an "AppModel" is a class that is used in an application to + * package together related information and functionality. Such a class could, + * for example, have properties with complex, nested data types, properties used + * for memoization, properties of types not supported by Firestore (such as + * `symbol` and `bigint`), and helper functions that perform compound + * operations. Such classes are not suitable and/or possible to store into a + * Firestore database. Instead, instances of such classes need to be converted + * to "plain old JavaScript objects" (POJOs) with exclusively primitive + * properties, potentially nested inside other POJOs or arrays of POJOs. In this + * context, this type is referred to as the "DbModel" and would be an object + * suitable for persisting into Firestore. For convenience, applications can + * implement `FirestoreDataConverter` and register the converter with Firestore + * objects, such as `DocumentReference` or `Query`, to automatically convert + * `AppModel` to `DbModel` when storing into Firestore, and convert `DbModel` + * to `AppModel` when retrieving from Firestore. + * + * @example + * + * Simple Example + * + * ```typescript + * const numberConverter = { + * toFirestore(value: WithFieldValue<number>) { + * return { value }; + * }, + * fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions) { + * return snapshot.data(options).value as number; + * } + * }; + * + * async function simpleDemo(db: Firestore): Promise<void> { + * const documentRef = doc(db, 'values/value123').withConverter(numberConverter); + * + * // converters are used with `setDoc`, `addDoc`, and `getDoc` + * await setDoc(documentRef, 42); + * const snapshot1 = await getDoc(documentRef); + * assertEqual(snapshot1.data(), 42); + * + * // converters are not used when writing data with `updateDoc` + * await updateDoc(documentRef, { value: 999 }); + * const snapshot2 = await getDoc(documentRef); + * assertEqual(snapshot2.data(), 999); + * } + * ``` + * + * Advanced Example + * + * ```typescript + * // The Post class is a model that is used by our application. + * // This class may have properties and methods that are specific + * // to our application execution, which do not need to be persisted + * // to Firestore. + * class Post { + * constructor( + * readonly title: string, + * readonly author: string, + * readonly lastUpdatedMillis: number + * ) {} + * toString(): string { + * return `${this.title} by ${this.author}`; + * } + * } + * + * // The PostDbModel represents how we want our posts to be stored + * // in Firestore. This DbModel has different properties (`ttl`, + * // `aut`, and `lut`) from the Post class we use in our application. + * interface PostDbModel { + * ttl: string; + * aut: { firstName: string; lastName: string }; + * lut: Timestamp; + * } + * + * // The `PostConverter` implements `FirestoreDataConverter` and specifies + * // how the Firestore SDK can convert `Post` objects to `PostDbModel` + * // objects and vice versa. + * class PostConverter implements FirestoreDataConverter<Post, PostDbModel> { + * toFirestore(post: WithFieldValue<Post>): WithFieldValue<PostDbModel> { + * return { + * ttl: post.title, + * aut: this._autFromAuthor(post.author), + * lut: this._lutFromLastUpdatedMillis(post.lastUpdatedMillis) + * }; + * } + * + * fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions): Post { + * const data = snapshot.data(options) as PostDbModel; + * const author = `${data.aut.firstName} ${data.aut.lastName}`; + * return new Post(data.ttl, author, data.lut.toMillis()); + * } + * + * _autFromAuthor( + * author: string | FieldValue + * ): { firstName: string; lastName: string } | FieldValue { + * if (typeof author !== 'string') { + * // `author` is a FieldValue, so just return it. + * return author; + * } + * const [firstName, lastName] = author.split(' '); + * return {firstName, lastName}; + * } + * + * _lutFromLastUpdatedMillis( + * lastUpdatedMillis: number | FieldValue + * ): Timestamp | FieldValue { + * if (typeof lastUpdatedMillis !== 'number') { + * // `lastUpdatedMillis` must be a FieldValue, so just return it. + * return lastUpdatedMillis; + * } + * return Timestamp.fromMillis(lastUpdatedMillis); + * } + * } + * + * async function advancedDemo(db: Firestore): Promise<void> { + * // Create a `DocumentReference` with a `FirestoreDataConverter`. + * const documentRef = doc(db, 'posts/post123').withConverter(new PostConverter()); + * + * // The `data` argument specified to `setDoc()` is type checked by the + * // TypeScript compiler to be compatible with `Post`. Since the `data` + * // argument is typed as `WithFieldValue<Post>` rather than just `Post`, + * // this allows properties of the `data` argument to also be special + * // Firestore values that perform server-side mutations, such as + * // `arrayRemove()`, `deleteField()`, and `serverTimestamp()`. + * await setDoc(documentRef, { + * title: 'My Life', + * author: 'Foo Bar', + * lastUpdatedMillis: serverTimestamp() + * }); + * + * // The TypeScript compiler will fail to compile if the `data` argument to + * // `setDoc()` is _not_ compatible with `WithFieldValue<Post>`. This + * // type checking prevents the caller from specifying objects with incorrect + * // properties or property values. + * // @ts-expect-error "Argument of type { ttl: string; } is not assignable + * // to parameter of type WithFieldValue<Post>" + * await setDoc(documentRef, { ttl: 'The Title' }); + * + * // When retrieving a document with `getDoc()` the `DocumentSnapshot` + * // object's `data()` method returns a `Post`, rather than a generic object, + * // which would have been returned if the `DocumentReference` did _not_ have a + * // `FirestoreDataConverter` attached to it. + * const snapshot1: DocumentSnapshot<Post> = await getDoc(documentRef); + * const post1: Post = snapshot1.data()!; + * if (post1) { + * assertEqual(post1.title, 'My Life'); + * assertEqual(post1.author, 'Foo Bar'); + * } + * + * // The `data` argument specified to `updateDoc()` is type checked by the + * // TypeScript compiler to be compatible with `PostDbModel`. Note that + * // unlike `setDoc()`, whose `data` argument must be compatible with `Post`, + * // the `data` argument to `updateDoc()` must be compatible with + * // `PostDbModel`. Similar to `setDoc()`, since the `data` argument is typed + * // as `WithFieldValue<PostDbModel>` rather than just `PostDbModel`, this + * // allows properties of the `data` argument to also be those special + * // Firestore values, like `arrayRemove()`, `deleteField()`, and + * // `serverTimestamp()`. + * await updateDoc(documentRef, { + * 'aut.firstName': 'NewFirstName', + * lut: serverTimestamp() + * }); + * + * // The TypeScript compiler will fail to compile if the `data` argument to + * // `updateDoc()` is _not_ compatible with `WithFieldValue<PostDbModel>`. + * // This type checking prevents the caller from specifying objects with + * // incorrect properties or property values. + * // @ts-expect-error "Argument of type { title: string; } is not assignable + * // to parameter of type WithFieldValue<PostDbModel>" + * await updateDoc(documentRef, { title: 'New Title' }); + * const snapshot2: DocumentSnapshot<Post> = await getDoc(documentRef); + * const post2: Post = snapshot2.data()!; + * if (post2) { + * assertEqual(post2.title, 'My Life'); + * assertEqual(post2.author, 'NewFirstName Bar'); + * } + * } + * ``` + */ +export interface FirestoreDataConverter<AppModelType, DbModelType extends DocumentData = DocumentData> extends LiteFirestoreDataConverter<AppModelType, DbModelType> { + /** + * Called by the Firestore SDK to convert a custom model object of type + * `AppModelType` into a plain JavaScript object (suitable for writing + * directly to the Firestore database) of type `DbModelType`. To use `set()` + * with `merge` and `mergeFields`, `toFirestore()` must be defined with + * `PartialWithFieldValue<AppModelType>`. + * + * The `WithFieldValue<T>` type extends `T` to also allow FieldValues such as + * {@link (deleteField:1)} to be used as property values. + */ + toFirestore(modelObject: WithFieldValue<AppModelType>): WithFieldValue<DbModelType>; + /** + * Called by the Firestore SDK to convert a custom model object of type + * `AppModelType` into a plain JavaScript object (suitable for writing + * directly to the Firestore database) of type `DbModelType`. Used with + * {@link (setDoc:1)}, {@link (WriteBatch.set:1)} and + * {@link (Transaction.set:1)} with `merge:true` or `mergeFields`. + * + * The `PartialWithFieldValue<T>` type extends `Partial<T>` to allow + * FieldValues such as {@link (arrayUnion:1)} to be used as property values. + * It also supports nested `Partial` by allowing nested fields to be + * omitted. + */ + toFirestore(modelObject: PartialWithFieldValue<AppModelType>, options: SetOptions): PartialWithFieldValue<DbModelType>; + /** + * Called by the Firestore SDK to convert Firestore data into an object of + * type `AppModelType`. You can access your data by calling: + * `snapshot.data(options)`. + * + * Generally, the data returned from `snapshot.data()` can be cast to + * `DbModelType`; however, this is not guaranteed because Firestore does not + * enforce a schema on the database. For example, writes from a previous + * version of the application or writes from another client that did not use a + * type converter could have written data with different properties and/or + * property types. The implementation will need to choose whether to + * gracefully recover from non-conforming data or throw an error. + * + * To override this method, see {@link (FirestoreDataConverter.fromFirestore:1)}. + * + * @param snapshot - A `QueryDocumentSnapshot` containing your data and metadata. + * @param options - The `SnapshotOptions` from the initial call to `data()`. + */ + fromFirestore(snapshot: QueryDocumentSnapshot<DocumentData, DocumentData>, options?: SnapshotOptions): AppModelType; +} +/** + * Options that configure how data is retrieved from a `DocumentSnapshot` (for + * example the desired behavior for server timestamps that have not yet been set + * to their final value). + */ +export interface SnapshotOptions { + /** + * If set, controls the return value for server timestamps that have not yet + * been set to their final value. + * + * By specifying 'estimate', pending server timestamps return an estimate + * based on the local clock. This estimate will differ from the final value + * and cause these values to change once the server result becomes available. + * + * By specifying 'previous', pending timestamps will be ignored and return + * their previous value instead. + * + * If omitted or set to 'none', `null` will be returned by default until the + * server value becomes available. + */ + readonly serverTimestamps?: 'estimate' | 'previous' | 'none'; +} +/** + * Metadata about a snapshot, describing the state of the snapshot. + */ +export declare class SnapshotMetadata { + /** + * True if the snapshot contains the result of local writes (for example + * `set()` or `update()` calls) that have not yet been committed to the + * backend. If your listener has opted into metadata updates (via + * `SnapshotListenOptions`) you will receive another snapshot with + * `hasPendingWrites` equal to false once the writes have been committed to + * the backend. + */ + readonly hasPendingWrites: boolean; + /** + * True if the snapshot was created from cached data rather than guaranteed + * up-to-date server data. If your listener has opted into metadata updates + * (via `SnapshotListenOptions`) you will receive another snapshot with + * `fromCache` set to false once the client has received up-to-date data from + * the backend. + */ + readonly fromCache: boolean; + /** @hideconstructor */ + constructor(hasPendingWrites: boolean, fromCache: boolean); + /** + * Returns true if this `SnapshotMetadata` is equal to the provided one. + * + * @param other - The `SnapshotMetadata` to compare against. + * @returns true if this `SnapshotMetadata` is equal to the provided one. + */ + isEqual(other: SnapshotMetadata): boolean; +} +/** + * The type of a `DocumentChange` may be 'added', 'removed', or 'modified'. + */ +export type DocumentChangeType = 'added' | 'removed' | 'modified'; +/** + * A `DocumentChange` represents a change to the documents matching a query. + * It contains the document affected and the type of change that occurred. + */ +export interface DocumentChange<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> { + /** The type of change ('added', 'modified', or 'removed'). */ + readonly type: DocumentChangeType; + /** The document affected by this change. */ + readonly doc: QueryDocumentSnapshot<AppModelType, DbModelType>; + /** + * The index of the changed document in the result set immediately prior to + * this `DocumentChange` (i.e. supposing that all prior `DocumentChange` objects + * have been applied). Is `-1` for 'added' events. + */ + readonly oldIndex: number; + /** + * The index of the changed document in the result set immediately after + * this `DocumentChange` (i.e. supposing that all prior `DocumentChange` + * objects and the current `DocumentChange` object have been applied). + * Is -1 for 'removed' events. + */ + readonly newIndex: number; +} +/** + * A `DocumentSnapshot` contains data read from a document in your Firestore + * database. The data can be extracted with `.data()` or `.get(<field>)` to + * get a specific field. + * + * For a `DocumentSnapshot` that points to a non-existing document, any data + * access will return 'undefined'. You can use the `exists()` method to + * explicitly verify a document's existence. + */ +export declare class DocumentSnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> extends LiteDocumentSnapshot<AppModelType, DbModelType> { + readonly _firestore: Firestore; + private readonly _firestoreImpl; + /** + * Metadata about the `DocumentSnapshot`, including information about its + * source and local modifications. + */ + readonly metadata: SnapshotMetadata; + /** @hideconstructor protected */ + constructor(_firestore: Firestore, userDataWriter: AbstractUserDataWriter, key: DocumentKey, document: Document | null, metadata: SnapshotMetadata, converter: UntypedFirestoreDataConverter<AppModelType, DbModelType> | null); + /** + * Returns whether or not the data exists. True if the document exists. + */ + exists(): this is QueryDocumentSnapshot<AppModelType, DbModelType>; + /** + * Retrieves all fields in the document as an `Object`. Returns `undefined` if + * the document doesn't exist. + * + * By default, `serverTimestamp()` values that have not yet been + * set to their final value will be returned as `null`. You can override + * this by passing an options object. + * + * @param options - An options object to configure how data is retrieved from + * the snapshot (for example the desired behavior for server timestamps that + * have not yet been set to their final value). + * @returns An `Object` containing all fields in the document or `undefined` if + * the document doesn't exist. + */ + data(options?: SnapshotOptions): AppModelType | undefined; + /** + * Retrieves the field specified by `fieldPath`. Returns `undefined` if the + * document or field doesn't exist. + * + * By default, a `serverTimestamp()` that has not yet been set to + * its final value will be returned as `null`. You can override this by + * passing an options object. + * + * @param fieldPath - The path (for example 'foo' or 'foo.bar') to a specific + * field. + * @param options - An options object to configure how the field is retrieved + * from the snapshot (for example the desired behavior for server timestamps + * that have not yet been set to their final value). + * @returns The data at the specified field location or undefined if no such + * field exists in the document. + */ + get(fieldPath: string | FieldPath, options?: SnapshotOptions): any; + static _jsonSchemaVersion: string; + static _jsonSchema: { + type: Property<"string">; + bundleSource: Property<"string">; + bundleName: Property<"string">; + bundle: Property<"string">; + }; + /** + * Returns a JSON-serializable representation of this `DocumentSnapshot` instance. + * + * @returns a JSON representation of this object. Throws a {@link FirestoreError} if this + * `DocumentSnapshot` has pending writes. + */ + toJSON(): object; +} +/** + * Builds a `DocumentSnapshot` instance from a JSON object created by + * {@link DocumentSnapshot.toJSON}. + * + * @param firestore - The {@link Firestore} instance the snapshot should be loaded for. + * @param json - a JSON object represention of a `DocumentSnapshot` instance. + * @returns an instance of {@link DocumentSnapshot} if the JSON object could be + * parsed. Throws a {@link FirestoreError} if an error occurs. + */ +export declare function documentSnapshotFromJSON(db: Firestore, json: object): DocumentSnapshot; +/** + * Builds a `DocumentSnapshot` instance from a JSON object created by + * {@link DocumentSnapshot.toJSON}. + * + * @param firestore - The {@link Firestore} instance the snapshot should be loaded for. + * @param json - a JSON object represention of a `DocumentSnapshot` instance. + * @param converter - Converts objects to and from Firestore. + * @returns an instance of {@link DocumentSnapshot} if the JSON object could be + * parsed. Throws a {@link FirestoreError} if an error occurs. + */ +export declare function documentSnapshotFromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: Firestore, json: object, converter: FirestoreDataConverter<AppModelType, DbModelType>): DocumentSnapshot<AppModelType, DbModelType>; +/** + * A `QueryDocumentSnapshot` contains data read from a document in your + * Firestore database as part of a query. The document is guaranteed to exist + * and its data can be extracted with `.data()` or `.get(<field>)` to get a + * specific field. + * + * A `QueryDocumentSnapshot` offers the same API surface as a + * `DocumentSnapshot`. Since query results contain only existing documents, the + * `exists` property will always be true and `data()` will never return + * 'undefined'. + */ +export declare class QueryDocumentSnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> extends DocumentSnapshot<AppModelType, DbModelType> { + /** + * Retrieves all fields in the document as an `Object`. + * + * By default, `serverTimestamp()` values that have not yet been + * set to their final value will be returned as `null`. You can override + * this by passing an options object. + * + * @override + * @param options - An options object to configure how data is retrieved from + * the snapshot (for example the desired behavior for server timestamps that + * have not yet been set to their final value). + * @returns An `Object` containing all fields in the document. + */ + data(options?: SnapshotOptions): AppModelType; +} +/** + * A `QuerySnapshot` contains zero or more `DocumentSnapshot` objects + * representing the results of a query. The documents can be accessed as an + * array via the `docs` property or enumerated using the `forEach` method. The + * number of documents can be determined via the `empty` and `size` + * properties. + */ +export declare class QuerySnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> { + readonly _firestore: Firestore; + readonly _userDataWriter: AbstractUserDataWriter; + readonly _snapshot: ViewSnapshot; + /** + * Metadata about this snapshot, concerning its source and if it has local + * modifications. + */ + readonly metadata: SnapshotMetadata; + /** + * The query on which you called `get` or `onSnapshot` in order to get this + * `QuerySnapshot`. + */ + readonly query: Query<AppModelType, DbModelType>; + private _cachedChanges?; + private _cachedChangesIncludeMetadataChanges?; + /** @hideconstructor */ + constructor(_firestore: Firestore, _userDataWriter: AbstractUserDataWriter, query: Query<AppModelType, DbModelType>, _snapshot: ViewSnapshot); + /** An array of all the documents in the `QuerySnapshot`. */ + get docs(): Array<QueryDocumentSnapshot<AppModelType, DbModelType>>; + /** The number of documents in the `QuerySnapshot`. */ + get size(): number; + /** True if there are no documents in the `QuerySnapshot`. */ + get empty(): boolean; + /** + * Enumerates all of the documents in the `QuerySnapshot`. + * + * @param callback - A callback to be called with a `QueryDocumentSnapshot` for + * each document in the snapshot. + * @param thisArg - The `this` binding for the callback. + */ + forEach(callback: (result: QueryDocumentSnapshot<AppModelType, DbModelType>) => void, thisArg?: unknown): void; + /** + * Returns an array of the documents changes since the last snapshot. If this + * is the first snapshot, all documents will be in the list as 'added' + * changes. + * + * @param options - `SnapshotListenOptions` that control whether metadata-only + * changes (i.e. only `DocumentSnapshot.metadata` changed) should trigger + * snapshot events. + */ + docChanges(options?: SnapshotListenOptions): Array<DocumentChange<AppModelType, DbModelType>>; + static _jsonSchemaVersion: string; + static _jsonSchema: { + type: Property<"string">; + bundleSource: Property<"string">; + bundleName: Property<"string">; + bundle: Property<"string">; + }; + /** + * Returns a JSON-serializable representation of this `QuerySnapshot` instance. + * + * @returns a JSON representation of this object. Throws a {@link FirestoreError} if this + * `QuerySnapshot` has pending writes. + */ + toJSON(): object; +} +/** + * Builds a `QuerySnapshot` instance from a JSON object created by + * {@link QuerySnapshot.toJSON}. + * + * @param firestore - The {@link Firestore} instance the snapshot should be loaded for. + * @param json - a JSON object represention of a `QuerySnapshot` instance. + * @returns an instance of {@link QuerySnapshot} if the JSON object could be + * parsed. Throws a {@link FirestoreError} if an error occurs. + */ +export declare function querySnapshotFromJSON(db: Firestore, json: object): QuerySnapshot; +/** + * Builds a `QuerySnapshot` instance from a JSON object created by + * {@link QuerySnapshot.toJSON}. + * + * @param firestore - The {@link Firestore} instance the snapshot should be loaded for. + * @param json - a JSON object represention of a `QuerySnapshot` instance. + * @param converter - Converts objects to and from Firestore. + * @returns an instance of {@link QuerySnapshot} if the JSON object could be + * parsed. Throws a {@link FirestoreError} if an error occurs. + */ +export declare function querySnapshotFromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: Firestore, json: object, converter: FirestoreDataConverter<AppModelType, DbModelType>): QuerySnapshot<AppModelType, DbModelType>; +/** Calculates the array of `DocumentChange`s for a given `ViewSnapshot`. */ +export declare function changesFromSnapshot<AppModelType, DbModelType extends DocumentData>(querySnapshot: QuerySnapshot<AppModelType, DbModelType>, includeMetadataChanges: boolean): Array<DocumentChange<AppModelType, DbModelType>>; +export declare function resultChangeType(type: ChangeType): DocumentChangeType; +/** + * Returns true if the provided snapshots are equal. + * + * @param left - A snapshot to compare. + * @param right - A snapshot to compare. + * @returns true if the snapshots are equal. + */ +export declare function snapshotEqual<AppModelType, DbModelType extends DocumentData>(left: DocumentSnapshot<AppModelType, DbModelType> | QuerySnapshot<AppModelType, DbModelType>, right: DocumentSnapshot<AppModelType, DbModelType> | QuerySnapshot<AppModelType, DbModelType>): boolean; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/timestamp.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/timestamp.d.ts new file mode 100644 index 0000000..35969cd --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/timestamp.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export { Timestamp } from '../lite-api/timestamp'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/transaction.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/transaction.d.ts new file mode 100644 index 0000000..eccd1fb --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/transaction.d.ts @@ -0,0 +1,61 @@ +/** + * @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 { Transaction as InternalTransaction } from '../core/transaction'; +import { DocumentData, DocumentReference } from '../lite-api/reference'; +import { Transaction as LiteTransaction } from '../lite-api/transaction'; +import { Firestore } from './database'; +import { DocumentSnapshot } from './snapshot'; +import { TransactionOptions } from './transaction_options'; +/** + * A reference to a transaction. + * + * The `Transaction` object passed to a transaction's `updateFunction` provides + * the methods to read and write data within the transaction context. See + * {@link runTransaction}. + */ +export declare class Transaction extends LiteTransaction { + protected readonly _firestore: Firestore; + /** @hideconstructor */ + constructor(_firestore: Firestore, _transaction: InternalTransaction); + /** + * Reads the document referenced by the provided {@link DocumentReference}. + * + * @param documentRef - A reference to the document to be read. + * @returns A `DocumentSnapshot` with the read data. + */ + get<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>; +} +/** + * Executes the given `updateFunction` and then attempts to commit the changes + * applied within the transaction. If any document read within the transaction + * has changed, Cloud Firestore retries the `updateFunction`. If it fails to + * commit after 5 attempts, the transaction fails. + * + * The maximum number of writes allowed in a single transaction is 500. + * + * @param firestore - A reference to the Firestore database to run this + * transaction against. + * @param updateFunction - The function to execute within the transaction + * context. + * @param options - An options object to configure maximum number of attempts to + * commit. + * @returns If the transaction completed successfully or was explicitly aborted + * (the `updateFunction` returned a failed promise), the promise returned by the + * `updateFunction `is returned here. Otherwise, if the transaction failed, a + * rejected promise with the corresponding failure error is returned. + */ +export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/transaction_options.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/transaction_options.d.ts new file mode 100644 index 0000000..578e4f4 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/transaction_options.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export { TransactionOptions } from '../lite-api/transaction_options'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/write_batch.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/write_batch.d.ts new file mode 100644 index 0000000..13b31d8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/api/write_batch.d.ts @@ -0,0 +1,31 @@ +/** + * @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 { WriteBatch } from '../lite-api/write_batch'; +import { Firestore } from './database'; +export { WriteBatch }; +/** + * Creates a write batch, used for performing multiple writes as a single + * atomic operation. The maximum number of writes allowed in a single {@link WriteBatch} + * is 500. + * + * Unlike transactions, write batches are persisted offline and therefore are + * preferable when you don't need to condition your writes on read data. + * + * @returns A {@link WriteBatch} that can be used to atomically execute multiple + * writes. + */ +export declare function writeBatch(firestore: Firestore): WriteBatch; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/auth/user.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/auth/user.d.ts new file mode 100644 index 0000000..920a290 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/auth/user.d.ts @@ -0,0 +1,36 @@ +/** + * @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. + */ +/** + * Simple wrapper around a nullable UID. Mostly exists to make code more + * readable. + */ +export declare class User { + readonly uid: string | null; + /** A user with a null UID. */ + static readonly UNAUTHENTICATED: User; + static readonly GOOGLE_CREDENTIALS: User; + static readonly FIRST_PARTY: User; + static readonly MOCK_USER: User; + constructor(uid: string | null); + isAuthenticated(): boolean; + /** + * Returns a key representing this user, suitable for inclusion in a + * dictionary. + */ + toKey(): string; + isEqual(otherUser: User): boolean; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/aggregate.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/aggregate.d.ts new file mode 100644 index 0000000..16da2bb --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/aggregate.d.ts @@ -0,0 +1,38 @@ +/** + * @license + * Copyright 2023 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 '../model/path'; +/** + * Union type representing the aggregate type to be performed. + */ +export type AggregateType = 'count' | 'avg' | 'sum'; +/** + * Represents an Aggregate to be performed over a query result set. + */ +export interface Aggregate { + readonly fieldPath?: FieldPath; + readonly alias: string; + readonly aggregateType: AggregateType; +} +/** + * Concrete implementation of the Aggregate type. + */ +export declare class AggregateImpl implements Aggregate { + readonly alias: string; + readonly aggregateType: AggregateType; + readonly fieldPath?: FieldPath | undefined; + constructor(alias: string, aggregateType: AggregateType, fieldPath?: FieldPath | undefined); +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/bound.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/bound.d.ts new file mode 100644 index 0000000..8289126 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/bound.d.ts @@ -0,0 +1,49 @@ +/** + * @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 { Document } from '../model/document'; +import { Value as ProtoValue } from '../protos/firestore_proto_api'; +import { OrderBy } from './order_by'; +/** + * Represents a bound of a query. + * + * The bound is specified with the given components representing a position and + * whether it's just before or just after the position (relative to whatever the + * query order is). + * + * The position represents a logical index position for a query. It's a prefix + * of values for the (potentially implicit) order by clauses of a query. + * + * Bound provides a function to determine whether a document comes before or + * after a bound. This is influenced by whether the position is just before or + * just after the provided values. + */ +export declare class Bound { + readonly position: ProtoValue[]; + readonly inclusive: boolean; + constructor(position: ProtoValue[], inclusive: boolean); +} +/** + * Returns true if a document sorts after a bound using the provided sort + * order. + */ +export declare function boundSortsAfterDocument(bound: Bound, orderBy: OrderBy[], doc: Document): boolean; +/** + * Returns true if a document sorts before a bound using the provided sort + * order. + */ +export declare function boundSortsBeforeDocument(bound: Bound, orderBy: OrderBy[], doc: Document): boolean; +export declare function boundEquals(left: Bound | null, right: Bound | null): boolean; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/bundle.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/bundle.d.ts new file mode 100644 index 0000000..6a81fcf --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/bundle.d.ts @@ -0,0 +1,80 @@ +/** + * @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 { LoadBundleTaskProgress } from '@firebase/firestore-types'; +import { DocumentMap } from '../model/collections'; +import { MutableDocument } from '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { BundledDocumentMetadata as ProtoBundledDocumentMetadata } from '../protos/firestore_bundle_proto'; +import { Document as ApiDocument, Timestamp as ApiTimestamp } from '../protos/firestore_proto_api'; +import { Query } from './query'; +import { SnapshotVersion } from './snapshot_version'; +/** + * Represents a bundled document, including the metadata and the document + * itself, if it exists. + */ +export interface BundledDocument { + metadata: ProtoBundledDocumentMetadata; + document?: ApiDocument; +} +/** + * An array of `BundledDocument`. + */ +export type BundledDocuments = BundledDocument[]; +export interface BundleLoadResult { + readonly progress: LoadBundleTaskProgress; + readonly changedCollectionGroups: Set<string>; + readonly changedDocs: DocumentMap; +} +/** + * Represents a Firestore bundle saved by the SDK in its local storage. + */ +export interface BundleMetadata { + /** + * Id of the bundle. It is used together with `createTime` to determine if a + * bundle has been loaded by the SDK. + */ + readonly id: string; + /** Schema version of the bundle. */ + readonly version: number; + /** + * Set to the snapshot version of the bundle if created by the Server SDKs. + * Otherwise set to SnapshotVersion.MIN. + */ + readonly createTime: SnapshotVersion; +} +/** + * Represents a Query saved by the SDK in its local storage. + */ +export interface NamedQuery { + /** The name of the query. */ + readonly name: string; + /** The underlying query associated with `name`. */ + readonly query: Query; + /** The time at which the results for this query were read. */ + readonly readTime: SnapshotVersion; +} +/** + * Helper to convert objects from bundles to model objects in the SDK. + */ +export interface BundleConverter { + toDocumentKey(name: string): DocumentKey; + /** + * Converts a BundleDocument to a MutableDocument. + */ + toMutableDocument(bundledDoc: BundledDocument): MutableDocument; + toSnapshotVersion(time: ApiTimestamp): SnapshotVersion; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/bundle_impl.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/bundle_impl.d.ts new file mode 100644 index 0000000..55395f2 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/bundle_impl.d.ts @@ -0,0 +1,88 @@ +/** + * @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 { LoadBundleTaskProgress } from '@firebase/firestore-types'; +import { LocalStore } from '../local/local_store'; +import { MutableDocument } from '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { BundleMetadata as ProtoBundleMetadata, NamedQuery as ProtoNamedQuery } from '../protos/firestore_bundle_proto'; +import { Timestamp as ApiTimestamp } from '../protos/firestore_proto_api'; +import { JsonProtoSerializer } from '../remote/serializer'; +import { SizedBundleElement } from '../util/bundle_reader'; +import { BundleConverter, BundledDocument, BundledDocuments, BundleLoadResult } from './bundle'; +import { SnapshotVersion } from './snapshot_version'; +/** + * Helper to convert objects from bundles to model objects in the SDK. + */ +export declare class BundleConverterImpl implements BundleConverter { + private readonly serializer; + constructor(serializer: JsonProtoSerializer); + toDocumentKey(name: string): DocumentKey; + /** + * Converts a BundleDocument to a MutableDocument. + */ + toMutableDocument(bundledDoc: BundledDocument): MutableDocument; + toSnapshotVersion(time: ApiTimestamp): SnapshotVersion; +} +/** + * A class to process the elements from a bundle, and optionally load them into local + * storage and provide progress update while loading. + */ +export declare class BundleLoader { + private bundleMetadata; + private serializer; + /** The current progress of loading */ + private progress; + /** Batched queries to be saved into storage */ + private _queries; + /** Batched documents to be saved into storage */ + private _documents; + /** The collection groups affected by this bundle. */ + private collectionGroups; + constructor(bundleMetadata: ProtoBundleMetadata, serializer: JsonProtoSerializer); + /** + * Returns the named queries that have been parsed from the SizeBundleElements added by + * calling {@link adSizedElement}. + */ + get queries(): ProtoNamedQuery[]; + /** + * Returns the BundledDocuments that have been parsed from the SizeBundleElements added by + * calling {@link addSizedElement}. + */ + get documents(): BundledDocuments; + /** + * Adds an element from the bundle to the loader. + * + * Returns a new progress if adding the element leads to a new progress, + * otherwise returns null. + */ + addSizedElement(element: SizedBundleElement): LoadBundleTaskProgress | null; + private getQueryDocumentMapping; + /** + * Update the progress to 'Success' and return the updated progress. + */ + completeAndStoreAsync(localStore: LocalStore): Promise<BundleLoadResult>; +} +/** + * Returns a `LoadBundleTaskProgress` representing the initial progress of + * loading a bundle. + */ +export declare function bundleInitialProgress(metadata: ProtoBundleMetadata): LoadBundleTaskProgress; +/** + * Returns a `LoadBundleTaskProgress` representing the progress that the loading + * has succeeded. + */ +export declare function bundleSuccessProgress(metadata: ProtoBundleMetadata): LoadBundleTaskProgress; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/component_provider.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/component_provider.d.ts new file mode 100644 index 0000000..97b6814 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/component_provider.d.ts @@ -0,0 +1,146 @@ +/** + * @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 { CredentialsProvider } from '../api/credentials'; +import { User } from '../auth/user'; +import { IndexedDbPersistence } from '../local/indexeddb_persistence'; +import { LocalStore } from '../local/local_store'; +import { Scheduler, Persistence } from '../local/persistence'; +import { ClientId, SharedClientState } from '../local/shared_client_state'; +import { Datastore } from '../remote/datastore'; +import { RemoteStore } from '../remote/remote_store'; +import { JsonProtoSerializer } from '../remote/serializer'; +import { AsyncQueue } from '../util/async_queue'; +import { DatabaseInfo } from './database_info'; +import { EventManager } from './event_manager'; +import { SyncEngine } from './sync_engine'; +type Kind = 'memory' | 'persistent'; +export interface ComponentConfiguration { + asyncQueue: AsyncQueue; + databaseInfo: DatabaseInfo; + authCredentials: CredentialsProvider<User>; + appCheckCredentials: CredentialsProvider<string>; + clientId: ClientId; + initialUser: User; + maxConcurrentLimboResolutions: number; +} +export interface OfflineComponentProviderFactory { + build(onlineComponents: OnlineComponentProvider): OfflineComponentProvider; +} +/** + * Initializes and wires components that are needed to interface with the local + * cache. Implementations override `initialize()` to provide all components. + */ +export interface OfflineComponentProvider { + readonly kind: Kind; + persistence: Persistence; + sharedClientState: SharedClientState; + localStore: LocalStore; + gcScheduler: Scheduler | null; + indexBackfillerScheduler: Scheduler | null; + synchronizeTabs: boolean; + initialize(cfg: ComponentConfiguration): Promise<void>; + terminate(): Promise<void>; +} +/** + * Provides all components needed for Firestore with in-memory persistence. + * Uses EagerGC garbage collection. + */ +export declare class MemoryOfflineComponentProvider implements OfflineComponentProvider { + kind: Kind; + static readonly provider: OfflineComponentProviderFactory; + persistence: Persistence; + sharedClientState: SharedClientState; + localStore: LocalStore; + gcScheduler: Scheduler | null; + indexBackfillerScheduler: Scheduler | null; + synchronizeTabs: boolean; + serializer: JsonProtoSerializer; + initialize(cfg: ComponentConfiguration): Promise<void>; + createGarbageCollectionScheduler(cfg: ComponentConfiguration, localStore: LocalStore): Scheduler | null; + createIndexBackfillerScheduler(cfg: ComponentConfiguration, localStore: LocalStore): Scheduler | null; + createLocalStore(cfg: ComponentConfiguration): LocalStore; + createPersistence(cfg: ComponentConfiguration): Persistence; + createSharedClientState(cfg: ComponentConfiguration): SharedClientState; + terminate(): Promise<void>; +} +export declare class LruGcMemoryOfflineComponentProvider extends MemoryOfflineComponentProvider { + protected readonly cacheSizeBytes: number | undefined; + constructor(cacheSizeBytes: number | undefined); + createGarbageCollectionScheduler(cfg: ComponentConfiguration, localStore: LocalStore): Scheduler | null; + createPersistence(cfg: ComponentConfiguration): Persistence; +} +/** + * Provides all components needed for Firestore with IndexedDB persistence. + */ +export declare class IndexedDbOfflineComponentProvider extends MemoryOfflineComponentProvider { + protected readonly onlineComponentProvider: OnlineComponentProvider; + protected readonly cacheSizeBytes: number | undefined; + protected readonly forceOwnership: boolean | undefined; + kind: Kind; + persistence: IndexedDbPersistence; + sharedClientState: SharedClientState; + localStore: LocalStore; + gcScheduler: Scheduler | null; + indexBackfillerScheduler: Scheduler | null; + synchronizeTabs: boolean; + constructor(onlineComponentProvider: OnlineComponentProvider, cacheSizeBytes: number | undefined, forceOwnership: boolean | undefined); + initialize(cfg: ComponentConfiguration): Promise<void>; + createLocalStore(cfg: ComponentConfiguration): LocalStore; + createGarbageCollectionScheduler(cfg: ComponentConfiguration, localStore: LocalStore): Scheduler | null; + createIndexBackfillerScheduler(cfg: ComponentConfiguration, localStore: LocalStore): Scheduler | null; + createPersistence(cfg: ComponentConfiguration): IndexedDbPersistence; + createSharedClientState(cfg: ComponentConfiguration): SharedClientState; +} +/** + * Provides all components needed for Firestore with multi-tab IndexedDB + * persistence. + * + * In the legacy client, this provider is used to provide both multi-tab and + * non-multi-tab persistence since we cannot tell at build time whether + * `synchronizeTabs` will be enabled. + */ +export declare class MultiTabOfflineComponentProvider extends IndexedDbOfflineComponentProvider { + protected readonly onlineComponentProvider: OnlineComponentProvider; + protected readonly cacheSizeBytes: number | undefined; + synchronizeTabs: boolean; + constructor(onlineComponentProvider: OnlineComponentProvider, cacheSizeBytes: number | undefined); + initialize(cfg: ComponentConfiguration): Promise<void>; + createSharedClientState(cfg: ComponentConfiguration): SharedClientState; +} +export interface OnlineComponentProviderFactory { + build(): OnlineComponentProvider; +} +/** + * Initializes and wires the components that are needed to interface with the + * network. + */ +export declare class OnlineComponentProvider { + static readonly provider: OnlineComponentProviderFactory; + protected localStore: LocalStore; + protected sharedClientState: SharedClientState; + datastore: Datastore; + eventManager: EventManager; + remoteStore: RemoteStore; + syncEngine: SyncEngine; + initialize(offlineComponentProvider: OfflineComponentProvider, cfg: ComponentConfiguration): Promise<void>; + createEventManager(cfg: ComponentConfiguration): EventManager; + createDatastore(cfg: ComponentConfiguration): Datastore; + createRemoteStore(cfg: ComponentConfiguration): RemoteStore; + createSyncEngine(cfg: ComponentConfiguration, startAsPrimary: boolean): SyncEngine; + terminate(): Promise<void>; +} +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/database_info.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/database_info.d.ts new file mode 100644 index 0000000..5429403 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/database_info.d.ts @@ -0,0 +1,64 @@ +import { FirebaseApp } from '@firebase/app'; +import { ExperimentalLongPollingOptions } from '../api/long_polling_options'; +/** + * @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 class DatabaseInfo { + readonly databaseId: DatabaseId; + readonly appId: string; + readonly persistenceKey: string; + readonly host: string; + readonly ssl: boolean; + readonly forceLongPolling: boolean; + readonly autoDetectLongPolling: boolean; + readonly longPollingOptions: ExperimentalLongPollingOptions; + readonly useFetchStreams: boolean; + readonly isUsingEmulator: boolean; + /** + * Constructs a DatabaseInfo using the provided host, databaseId and + * persistenceKey. + * + * @param databaseId - The database to use. + * @param appId - The Firebase App Id. + * @param persistenceKey - A unique identifier for this Firestore's local + * storage (used in conjunction with the databaseId). + * @param host - The Firestore backend host to connect to. + * @param ssl - Whether to use SSL when connecting. + * @param forceLongPolling - Whether to use the forceLongPolling option + * when using WebChannel as the network transport. + * @param autoDetectLongPolling - Whether to use the detectBufferingProxy + * option when using WebChannel as the network transport. + * @param longPollingOptions Options that configure long-polling. + * @param useFetchStreams Whether to use the Fetch API instead of + * XMLHTTPRequest + */ + constructor(databaseId: DatabaseId, appId: string, persistenceKey: string, host: string, ssl: boolean, forceLongPolling: boolean, autoDetectLongPolling: boolean, longPollingOptions: ExperimentalLongPollingOptions, useFetchStreams: boolean, isUsingEmulator: boolean); +} +/** The default database name for a project. */ +export declare const DEFAULT_DATABASE_NAME = "(default)"; +/** + * Represents the database ID a Firestore client is associated with. + * @internal + */ +export declare class DatabaseId { + readonly projectId: string; + readonly database: string; + constructor(projectId: string, database?: string); + static empty(): DatabaseId; + get isDefaultDatabase(): boolean; + isEqual(other: {}): boolean; +} +export declare function databaseIdFromApp(app: FirebaseApp, database?: string): DatabaseId; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/event_manager.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/event_manager.d.ts new file mode 100644 index 0000000..38b980f --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/event_manager.d.ts @@ -0,0 +1,133 @@ +/** + * @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 { FirestoreError } from '../util/error'; +import { EventHandler } from '../util/misc'; +import { ObjectMap } from '../util/obj_map'; +import { Query } from './query'; +import { OnlineState } from './types'; +import { ViewSnapshot } from './view_snapshot'; +/** + * Holds the listeners and the last received ViewSnapshot for a query being + * tracked by EventManager. + */ +declare class QueryListenersInfo { + viewSnap: ViewSnapshot | undefined; + listeners: QueryListener[]; + hasRemoteListeners(): boolean; +} +/** + * Interface for handling events from the EventManager. + */ +export interface Observer<T> { + next: EventHandler<T>; + error: EventHandler<FirestoreError>; +} +/** + * EventManager is responsible for mapping queries to query event emitters. + * It handles "fan-out". -- Identical queries will re-use the same watch on the + * backend. + * + * PORTING NOTE: On Web, EventManager `onListen` and `onUnlisten` need to be + * assigned to SyncEngine's `listen()` and `unlisten()` API before usage. This + * allows users to tree-shake the Watch logic. + */ +export interface EventManager { + onListen?: (query: Query, enableRemoteListen: boolean) => Promise<ViewSnapshot>; + onUnlisten?: (query: Query, disableRemoteListen: boolean) => Promise<void>; + onFirstRemoteStoreListen?: (query: Query) => Promise<void>; + onLastRemoteStoreUnlisten?: (query: Query) => Promise<void>; + terminate(): void; +} +export declare function newEventManager(): EventManager; +export declare class EventManagerImpl implements EventManager { + queries: ObjectMap<Query, QueryListenersInfo>; + onlineState: OnlineState; + snapshotsInSyncListeners: Set<Observer<void>>; + /** Callback invoked when a Query is first listen to. */ + onListen?: (query: Query, enableRemoteListen: boolean) => Promise<ViewSnapshot>; + /** Callback invoked once all listeners to a Query are removed. */ + onUnlisten?: (query: Query, disableRemoteListen: boolean) => Promise<void>; + /** + * Callback invoked when a Query starts listening to the remote store, while + * already listening to the cache. + */ + onFirstRemoteStoreListen?: (query: Query) => Promise<void>; + /** + * Callback invoked when a Query stops listening to the remote store, while + * still listening to the cache. + */ + onLastRemoteStoreUnlisten?: (query: Query) => Promise<void>; + terminate(): void; +} +export declare function eventManagerListen(eventManager: EventManager, listener: QueryListener): Promise<void>; +export declare function eventManagerUnlisten(eventManager: EventManager, listener: QueryListener): Promise<void>; +export declare function eventManagerOnWatchChange(eventManager: EventManager, viewSnaps: ViewSnapshot[]): void; +export declare function eventManagerOnWatchError(eventManager: EventManager, query: Query, error: FirestoreError): void; +export declare function eventManagerOnOnlineStateChange(eventManager: EventManager, onlineState: OnlineState): void; +export declare function addSnapshotsInSyncListener(eventManager: EventManager, observer: Observer<void>): void; +export declare function removeSnapshotsInSyncListener(eventManager: EventManager, observer: Observer<void>): void; +export declare enum ListenerDataSource { + /** Listen to both cache and server changes */ + Default = "default", + /** Listen to changes in cache only */ + Cache = "cache" +} +export interface ListenOptions { + /** Raise events even when only the metadata changes */ + readonly includeMetadataChanges?: boolean; + /** + * Wait for a sync with the server when online, but still raise events while + * offline. + */ + readonly waitForSyncWhenOnline?: boolean; + /** Set the source events raised from. */ + readonly source?: ListenerDataSource; +} +/** + * QueryListener takes a series of internal view snapshots and determines + * when to raise the event. + * + * It uses an Observer to dispatch events. + */ +export declare class QueryListener { + readonly query: Query; + private queryObserver; + /** + * Initial snapshots (e.g. from cache) may not be propagated to the wrapped + * observer. This flag is set to true once we've actually raised an event. + */ + private raisedInitialEvent; + private options; + private snap; + private onlineState; + constructor(query: Query, queryObserver: Observer<ViewSnapshot>, options?: ListenOptions); + /** + * Applies the new ViewSnapshot to this listener, raising a user-facing event + * if applicable (depending on what changed, whether the user has opted into + * metadata-only changes, etc.). Returns true if a user-facing event was + * indeed raised. + */ + onViewSnapshot(snap: ViewSnapshot): boolean; + onError(error: FirestoreError): void; + /** Returns whether a snapshot was raised. */ + applyOnlineStateChange(onlineState: OnlineState): boolean; + private shouldRaiseInitialEvent; + private shouldRaiseEvent; + private raiseInitialEvent; + listensToRemoteStore(): boolean; +} +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/filter.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/filter.d.ts new file mode 100644 index 0000000..ccb871f --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/filter.d.ts @@ -0,0 +1,130 @@ +/** + * @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 { Document } from '../model/document'; +import { FieldPath } from '../model/path'; +import { Value as ProtoValue } from '../protos/firestore_proto_api'; +export declare const enum Operator { + LESS_THAN = "<", + LESS_THAN_OR_EQUAL = "<=", + EQUAL = "==", + NOT_EQUAL = "!=", + GREATER_THAN = ">", + GREATER_THAN_OR_EQUAL = ">=", + ARRAY_CONTAINS = "array-contains", + IN = "in", + NOT_IN = "not-in", + ARRAY_CONTAINS_ANY = "array-contains-any" +} +export declare const enum CompositeOperator { + OR = "or", + AND = "and" +} +export declare abstract class Filter { + abstract matches(doc: Document): boolean; + abstract getFlattenedFilters(): readonly FieldFilter[]; + abstract getFilters(): Filter[]; +} +export declare class FieldFilter extends Filter { + readonly field: FieldPath; + readonly op: Operator; + readonly value: ProtoValue; + protected constructor(field: FieldPath, op: Operator, value: ProtoValue); + /** + * Creates a filter based on the provided arguments. + */ + static create(field: FieldPath, op: Operator, value: ProtoValue): FieldFilter; + private static createKeyFieldInFilter; + matches(doc: Document): boolean; + protected matchesComparison(comparison: number): boolean; + isInequality(): boolean; + getFlattenedFilters(): readonly FieldFilter[]; + getFilters(): Filter[]; +} +export declare class CompositeFilter extends Filter { + readonly filters: readonly Filter[]; + readonly op: CompositeOperator; + private memoizedFlattenedFilters; + protected constructor(filters: readonly Filter[], op: CompositeOperator); + /** + * Creates a filter based on the provided arguments. + */ + static create(filters: Filter[], op: CompositeOperator): CompositeFilter; + matches(doc: Document): boolean; + getFlattenedFilters(): readonly FieldFilter[]; + getFilters(): Filter[]; +} +export declare function compositeFilterIsConjunction(compositeFilter: CompositeFilter): boolean; +export declare function compositeFilterIsDisjunction(compositeFilter: CompositeFilter): boolean; +/** + * Returns true if this filter is a conjunction of field filters only. Returns false otherwise. + */ +export declare function compositeFilterIsFlatConjunction(compositeFilter: CompositeFilter): boolean; +/** + * Returns true if this filter does not contain any composite filters. Returns false otherwise. + */ +export declare function compositeFilterIsFlat(compositeFilter: CompositeFilter): boolean; +export declare function canonifyFilter(filter: Filter): string; +export declare function filterEquals(f1: Filter, f2: Filter): boolean; +export declare function fieldFilterEquals(f1: FieldFilter, f2: Filter): boolean; +export declare function compositeFilterEquals(f1: CompositeFilter, f2: Filter): boolean; +/** + * Returns a new composite filter that contains all filter from + * `compositeFilter` plus all the given filters in `otherFilters`. + */ +export declare function compositeFilterWithAddedFilters(compositeFilter: CompositeFilter, otherFilters: Filter[]): CompositeFilter; +/** Returns a debug description for `filter`. */ +export declare function stringifyFilter(filter: Filter): string; +export declare function stringifyCompositeFilter(filter: CompositeFilter): string; +export declare function stringifyFieldFilter(filter: FieldFilter): string; +/** Filter that matches on key fields (i.e. '__name__'). */ +export declare class KeyFieldFilter extends FieldFilter { + private readonly key; + constructor(field: FieldPath, op: Operator, value: ProtoValue); + matches(doc: Document): boolean; +} +/** Filter that matches on key fields within an array. */ +export declare class KeyFieldInFilter extends FieldFilter { + private readonly keys; + constructor(field: FieldPath, value: ProtoValue); + matches(doc: Document): boolean; +} +/** Filter that matches on key fields not present within an array. */ +export declare class KeyFieldNotInFilter extends FieldFilter { + private readonly keys; + constructor(field: FieldPath, value: ProtoValue); + matches(doc: Document): boolean; +} +/** A Filter that implements the array-contains operator. */ +export declare class ArrayContainsFilter extends FieldFilter { + constructor(field: FieldPath, value: ProtoValue); + matches(doc: Document): boolean; +} +/** A Filter that implements the IN operator. */ +export declare class InFilter extends FieldFilter { + constructor(field: FieldPath, value: ProtoValue); + matches(doc: Document): boolean; +} +/** A Filter that implements the not-in operator. */ +export declare class NotInFilter extends FieldFilter { + constructor(field: FieldPath, value: ProtoValue); + matches(doc: Document): boolean; +} +/** A Filter that implements the array-contains-any operator. */ +export declare class ArrayContainsAnyFilter extends FieldFilter { + constructor(field: FieldPath, value: ProtoValue); + matches(doc: Document): boolean; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/firestore_client.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/firestore_client.d.ts new file mode 100644 index 0000000..a3a2b24 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/firestore_client.d.ts @@ -0,0 +1,138 @@ +/** + * @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 { GetOptions } from '@firebase/firestore-types'; +import { LoadBundleTask } from '../api/bundle'; +import { CredentialsProvider } from '../api/credentials'; +import { User } from '../auth/user'; +import { LocalStore } from '../local/local_store'; +import { Document } from '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { FieldIndex } from '../model/field_index'; +import { Mutation } from '../model/mutation'; +import { ApiClientObjectMap, Value } from '../protos/firestore_proto_api'; +import { JsonProtoSerializer } from '../remote/serializer'; +import { AsyncQueue } from '../util/async_queue'; +import { BundleReaderSync } from '../util/bundle_reader'; +import { FirestoreError } from '../util/error'; +import { Aggregate } from './aggregate'; +import { NamedQuery } from './bundle'; +import { ComponentConfiguration, OfflineComponentProvider, OnlineComponentProvider } from './component_provider'; +import { DatabaseId, DatabaseInfo } from './database_info'; +import { EventManager, ListenOptions, Observer } from './event_manager'; +import { Query } from './query'; +import { SyncEngine } from './sync_engine'; +import { Transaction } from './transaction'; +import { TransactionOptions } from './transaction_options'; +import { ViewSnapshot } from './view_snapshot'; +export declare const MAX_CONCURRENT_LIMBO_RESOLUTIONS = 100; +/** + * FirestoreClient is a top-level class that constructs and owns all of the // + * pieces of the client SDK architecture. It is responsible for creating the // + * async queue that is shared by all of the other components in the system. // + */ +export declare class FirestoreClient { + private authCredentials; + private appCheckCredentials; + /** + * Asynchronous queue responsible for all of our internal processing. When + * we get incoming work from the user (via public API) or the network + * (incoming GRPC messages), we should always schedule onto this queue. + * This ensures all of our work is properly serialized (e.g. we don't + * start processing a new operation while the previous one is waiting for + * an async I/O to complete). + */ + asyncQueue: AsyncQueue; + private databaseInfo; + private user; + private readonly clientId; + private authCredentialListener; + private appCheckCredentialListener; + _uninitializedComponentsProvider?: { + _offline: OfflineComponentProvider; + _online: OnlineComponentProvider; + }; + _offlineComponents?: OfflineComponentProvider; + _onlineComponents?: OnlineComponentProvider; + constructor(authCredentials: CredentialsProvider<User>, appCheckCredentials: CredentialsProvider<string>, + /** + * Asynchronous queue responsible for all of our internal processing. When + * we get incoming work from the user (via public API) or the network + * (incoming GRPC messages), we should always schedule onto this queue. + * This ensures all of our work is properly serialized (e.g. we don't + * start processing a new operation while the previous one is waiting for + * an async I/O to complete). + */ + asyncQueue: AsyncQueue, databaseInfo: DatabaseInfo, componentProvider?: { + _offline: OfflineComponentProvider; + _online: OnlineComponentProvider; + }); + get configuration(): ComponentConfiguration; + setCredentialChangeListener(listener: (user: User) => Promise<void>): void; + setAppCheckTokenChangeListener(listener: (appCheckToken: string, user: User) => Promise<void>): void; + terminate(): Promise<void>; +} +export declare function setOfflineComponentProvider(client: FirestoreClient, offlineComponentProvider: OfflineComponentProvider): Promise<void>; +export declare function setOnlineComponentProvider(client: FirestoreClient, onlineComponentProvider: OnlineComponentProvider): Promise<void>; +/** + * Decides whether the provided error allows us to gracefully disable + * persistence (as opposed to crashing the client). + */ +export declare function canFallbackFromIndexedDbError(error: FirestoreError | DOMException): boolean; +export declare function ensureOnlineComponents(client: FirestoreClient): Promise<OnlineComponentProvider>; +export declare function getLocalStore(client: FirestoreClient): Promise<LocalStore>; +export declare function getSyncEngine(client: FirestoreClient): Promise<SyncEngine>; +export declare function getEventManager(client: FirestoreClient): Promise<EventManager>; +/** Enables the network connection and re-enqueues all pending operations. */ +export declare function firestoreClientEnableNetwork(client: FirestoreClient): Promise<void>; +/** Disables the network connection. Pending operations will not complete. */ +export declare function firestoreClientDisableNetwork(client: FirestoreClient): Promise<void>; +/** + * Returns a Promise that resolves when all writes that were pending at the time + * this method was called received server acknowledgement. An acknowledgement + * can be either acceptance or rejection. + */ +export declare function firestoreClientWaitForPendingWrites(client: FirestoreClient): Promise<void>; +export declare function firestoreClientListen(client: FirestoreClient, query: Query, options: ListenOptions, observer: Partial<Observer<ViewSnapshot>>): () => void; +export declare function firestoreClientGetDocumentFromLocalCache(client: FirestoreClient, docKey: DocumentKey): Promise<Document | null>; +export declare function firestoreClientGetDocumentViaSnapshotListener(client: FirestoreClient, key: DocumentKey, options?: GetOptions): Promise<ViewSnapshot>; +export declare function firestoreClientGetDocumentsFromLocalCache(client: FirestoreClient, query: Query): Promise<ViewSnapshot>; +export declare function firestoreClientGetDocumentsViaSnapshotListener(client: FirestoreClient, query: Query, options?: GetOptions): Promise<ViewSnapshot>; +export declare function firestoreClientRunAggregateQuery(client: FirestoreClient, query: Query, aggregates: Aggregate[]): Promise<ApiClientObjectMap<Value>>; +export declare function firestoreClientWrite(client: FirestoreClient, mutations: Mutation[]): Promise<void>; +export declare function firestoreClientAddSnapshotsInSyncListener(client: FirestoreClient, observer: Partial<Observer<void>>): () => void; +/** + * Takes an updateFunction in which a set of reads and writes can be performed + * atomically. In the updateFunction, the client can read and write values + * using the supplied transaction object. After the updateFunction, all + * changes will be committed. If a retryable error occurs (ex: some other + * client has changed any of the data referenced), then the updateFunction + * will be called again after a backoff. If the updateFunction still fails + * after all retries, then the transaction will be rejected. + * + * The transaction object passed to the updateFunction contains methods for + * accessing documents and collections. Unlike other datastore access, data + * accessed with the transaction will not reflect local changes that have not + * been committed. For this reason, it is required that all reads are + * performed before any writes. Transactions must be performed while online. + */ +export declare function firestoreClientTransaction<T>(client: FirestoreClient, updateFunction: (transaction: Transaction) => Promise<T>, options: TransactionOptions): Promise<T>; +export declare function firestoreClientLoadBundle(client: FirestoreClient, databaseId: DatabaseId, data: ReadableStream<Uint8Array> | ArrayBuffer | string, resultTask: LoadBundleTask): void; +export declare function firestoreClientGetNamedQuery(client: FirestoreClient, queryName: string): Promise<NamedQuery | undefined>; +export declare function createBundleReaderSync(bundleData: string, serializer: JsonProtoSerializer): BundleReaderSync; +export declare function firestoreClientSetIndexConfiguration(client: FirestoreClient, indexes: FieldIndex[]): Promise<void>; +export declare function firestoreClientSetPersistentCacheIndexAutoCreationEnabled(client: FirestoreClient, isEnabled: boolean): Promise<void>; +export declare function firestoreClientDeleteAllFieldIndexes(client: FirestoreClient): Promise<void>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/listen_sequence.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/listen_sequence.d.ts new file mode 100644 index 0000000..c824db1 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/listen_sequence.d.ts @@ -0,0 +1,39 @@ +/** + * @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 { ListenSequenceNumber } from './types'; +/** + * `SequenceNumberSyncer` defines the methods required to keep multiple instances of a + * `ListenSequence` in sync. + */ +export interface SequenceNumberSyncer { + writeSequenceNumber(sequenceNumber: ListenSequenceNumber): void; + sequenceNumberHandler: ((sequenceNumber: ListenSequenceNumber) => void) | null; +} +/** + * `ListenSequence` is a monotonic sequence. It is initialized with a minimum value to + * exceed. All subsequent calls to next will return increasing values. If provided with a + * `SequenceNumberSyncer`, it will additionally bump its next value when told of a new value, as + * well as write out sequence numbers that it produces via `next()`. + */ +export declare class ListenSequence { + private previousValue; + static readonly INVALID: ListenSequenceNumber; + private writeNewSequenceNumber?; + constructor(previousValue: ListenSequenceNumber, sequenceNumberSyncer?: SequenceNumberSyncer); + private setPreviousValue; + next(): ListenSequenceNumber; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/order_by.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/order_by.d.ts new file mode 100644 index 0000000..1d7aa86 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/order_by.d.ts @@ -0,0 +1,35 @@ +/** + * @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 { FieldPath } from '../model/path'; +/** + * The direction of sorting in an order by. + */ +export declare const enum Direction { + ASCENDING = "asc", + DESCENDING = "desc" +} +/** + * An ordering on a field, in some Direction. Direction defaults to ASCENDING. + */ +export declare class OrderBy { + readonly field: FieldPath; + readonly dir: Direction; + constructor(field: FieldPath, dir?: Direction); +} +export declare function canonifyOrderBy(orderBy: OrderBy): string; +export declare function stringifyOrderBy(orderBy: OrderBy): string; +export declare function orderByEquals(left: OrderBy, right: OrderBy): boolean; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/query.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/query.d.ts new file mode 100644 index 0000000..d23e0f1 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/query.d.ts @@ -0,0 +1,142 @@ +/** + * @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 '../model/document'; +import { FieldPath, ResourcePath } from '../model/path'; +import { SortedSet } from '../util/sorted_set'; +import { Bound } from './bound'; +import { Filter } from './filter'; +import { OrderBy } from './order_by'; +import { Target } from './target'; +export declare const enum LimitType { + First = "F", + Last = "L" +} +/** + * The Query interface defines all external properties of a query. + * + * QueryImpl implements this interface to provide memoization for `queryNormalizedOrderBy` + * and `queryToTarget`. + */ +export interface Query { + readonly path: ResourcePath; + readonly collectionGroup: string | null; + readonly explicitOrderBy: OrderBy[]; + readonly filters: Filter[]; + readonly limit: number | null; + readonly limitType: LimitType; + readonly startAt: Bound | null; + readonly endAt: Bound | null; +} +/** + * Query encapsulates all the query attributes we support in the SDK. It can + * be run against the LocalStore, as well as be converted to a `Target` to + * query the RemoteStore results. + * + * Visible for testing. + */ +export declare class QueryImpl implements Query { + readonly path: ResourcePath; + readonly collectionGroup: string | null; + readonly explicitOrderBy: OrderBy[]; + readonly filters: Filter[]; + readonly limit: number | null; + readonly limitType: LimitType; + readonly startAt: Bound | null; + readonly endAt: Bound | null; + memoizedNormalizedOrderBy: OrderBy[] | null; + memoizedTarget: Target | null; + memoizedAggregateTarget: Target | null; + /** + * Initializes a Query with a path and optional additional query constraints. + * Path must currently be empty if this is a collection group query. + */ + constructor(path: ResourcePath, collectionGroup?: string | null, explicitOrderBy?: OrderBy[], filters?: Filter[], limit?: number | null, limitType?: LimitType, startAt?: Bound | null, endAt?: Bound | null); +} +/** Creates a new Query instance with the options provided. */ +export declare function newQuery(path: ResourcePath, collectionGroup: string | null, explicitOrderBy: OrderBy[], filters: Filter[], limit: number | null, limitType: LimitType, startAt: Bound | null, endAt: Bound | null): Query; +/** Creates a new Query for a query that matches all documents at `path` */ +export declare function newQueryForPath(path: ResourcePath): Query; +/** + * Helper to convert a collection group query into a collection query at a + * specific path. This is used when executing collection group queries, since + * we have to split the query into a set of collection queries at multiple + * paths. + */ +export declare function asCollectionQueryAtPath(query: Query, path: ResourcePath): Query; +/** + * Returns true if this query does not specify any query constraints that + * could remove results. + */ +export declare function queryMatchesAllDocuments(query: Query): boolean; +export declare function getInequalityFilterFields(query: Query): SortedSet<FieldPath>; +/** + * Creates a new Query for a collection group query that matches all documents + * within the provided collection group. + */ +export declare function newQueryForCollectionGroup(collectionId: string): Query; +/** + * Returns whether the query matches a single document by path (rather than a + * collection). + */ +export declare function isDocumentQuery(query: Query): boolean; +/** + * Returns whether the query matches a collection group rather than a specific + * collection. + */ +export declare function isCollectionGroupQuery(query: Query): boolean; +/** + * Returns the normalized order-by constraint that is used to execute the Query, + * which can be different from the order-by constraints the user provided (e.g. + * the SDK and backend always orders by `__name__`). The normalized order-by + * includes implicit order-bys in addition to the explicit user provided + * order-bys. + */ +export declare function queryNormalizedOrderBy(query: Query): OrderBy[]; +/** + * Converts this `Query` instance to its corresponding `Target` representation. + */ +export declare function queryToTarget(query: Query): Target; +/** + * Converts this `Query` instance to its corresponding `Target` representation, + * for use within an aggregate query. Unlike targets for non-aggregate queries, + * aggregate query targets do not contain normalized order-bys, they only + * contain explicit order-bys. + */ +export declare function queryToAggregateTarget(query: Query): Target; +export declare function queryWithAddedFilter(query: Query, filter: Filter): Query; +export declare function queryWithAddedOrderBy(query: Query, orderBy: OrderBy): Query; +export declare function queryWithLimit(query: Query, limit: number | null, limitType: LimitType): Query; +export declare function queryWithStartAt(query: Query, bound: Bound): Query; +export declare function queryWithEndAt(query: Query, bound: Bound): Query; +export declare function queryEquals(left: Query, right: Query): boolean; +export declare function canonifyQuery(query: Query): string; +export declare function stringifyQuery(query: Query): string; +/** Returns whether `doc` matches the constraints of `query`. */ +export declare function queryMatches(query: Query, doc: Document): boolean; +/** + * Returns the collection group that this query targets. + * + * PORTING NOTE: This is only used in the Web SDK to facilitate multi-tab + * synchronization for query results. + */ +export declare function queryCollectionGroup(query: Query): string; +/** + * Returns a new comparator function that can be used to compare two documents + * based on the Query's ordering constraint. + */ +export declare function newQueryComparator(query: Query): (d1: Document, d2: Document) => number; +export declare function compareDocs(orderBy: OrderBy, d1: Document, d2: Document): number; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/snapshot_version.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/snapshot_version.d.ts new file mode 100644 index 0000000..10c508b --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/snapshot_version.d.ts @@ -0,0 +1,34 @@ +/** + * @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 { Timestamp } from '../lite-api/timestamp'; +/** + * A version of a document in Firestore. This corresponds to the version + * timestamp, such as update_time or read_time. + */ +export declare class SnapshotVersion { + private timestamp; + static fromTimestamp(value: Timestamp): SnapshotVersion; + static min(): SnapshotVersion; + static max(): SnapshotVersion; + private constructor(); + compareTo(other: SnapshotVersion): number; + isEqual(other: SnapshotVersion): boolean; + /** Returns a number representation of the version for use in spec tests. */ + toMicroseconds(): number; + toString(): string; + toTimestamp(): Timestamp; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/sync_engine.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/sync_engine.d.ts new file mode 100644 index 0000000..2c28d31 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/sync_engine.d.ts @@ -0,0 +1,37 @@ +/** + * @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. + */ +/** + * SyncEngine is the central controller in the client SDK architecture. It is + * the glue code between the EventManager, LocalStore, and RemoteStore. Some of + * SyncEngine's responsibilities include: + * 1. Coordinating client requests and remote events between the EventManager + * and the local and remote data stores. + * 2. Managing a View object for each query, providing the unified view between + * the local and remote data stores. + * 3. Notifying the RemoteStore when the LocalStore has new mutations in its + * queue that need sending to the backend. + * + * The SyncEngine’s methods should only ever be called by methods running in the + * global async queue. + * + * PORTING NOTE: On Web, SyncEngine does not have an explicit subscribe() + * function. Instead, it directly depends on EventManager's tree-shakeable API + * (via `ensureWatchStream()`). + */ +export interface SyncEngine { + isPrimaryClient: boolean; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/sync_engine_impl.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/sync_engine_impl.d.ts new file mode 100644 index 0000000..0d2aef9 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/sync_engine_impl.d.ts @@ -0,0 +1,255 @@ +/** + * @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 { LoadBundleTask } from '../api/bundle'; +import { User } from '../auth/user'; +import { LocalStore } from '../local/local_store'; +import { ReferenceSet } from '../local/reference_set'; +import { ClientId, SharedClientState } from '../local/shared_client_state'; +import { QueryTargetState } from '../local/shared_client_state_syncer'; +import { DocumentKeySet, DocumentMap } from '../model/collections'; +import { DocumentKey } from '../model/document_key'; +import { Mutation } from '../model/mutation'; +import { MutationBatchResult } from '../model/mutation_batch'; +import { RemoteEvent } from '../remote/remote_event'; +import { RemoteStore } from '../remote/remote_store'; +import { BundleReader } from '../util/bundle_reader'; +import { FirestoreError } from '../util/error'; +import { ObjectMap } from '../util/obj_map'; +import { Deferred } from '../util/promise'; +import { SortedMap } from '../util/sorted_map'; +import { EventManager } from './event_manager'; +import { Query } from './query'; +import { SyncEngine } from './sync_engine'; +import { TargetIdGenerator } from './target_id_generator'; +import { BatchId, MutationBatchState, OnlineState, OnlineStateSource, TargetId } from './types'; +import { View } from './view'; +import { ViewSnapshot } from './view_snapshot'; +/** + * QueryView contains all of the data that SyncEngine needs to keep track of for + * a particular query. + */ +declare class QueryView { + /** + * The query itself. + */ + query: Query; + /** + * The target number created by the client that is used in the watch + * stream to identify this query. + */ + targetId: TargetId; + /** + * The view is responsible for computing the final merged truth of what + * docs are in the query. It gets notified of local and remote changes, + * and applies the query filters and limits to determine the most correct + * possible results. + */ + view: View; + constructor( + /** + * The query itself. + */ + query: Query, + /** + * The target number created by the client that is used in the watch + * stream to identify this query. + */ + targetId: TargetId, + /** + * The view is responsible for computing the final merged truth of what + * docs are in the query. It gets notified of local and remote changes, + * and applies the query filters and limits to determine the most correct + * possible results. + */ + view: View); +} +/** Tracks a limbo resolution. */ +declare class LimboResolution { + key: DocumentKey; + constructor(key: DocumentKey); + /** + * Set to true once we've received a document. This is used in + * getRemoteKeysForTarget() and ultimately used by WatchChangeAggregator to + * decide whether it needs to manufacture a delete event for the target once + * the target is CURRENT. + */ + receivedDocument: boolean; +} +/** + * A function that updates a QueryView with a set of document changes (and a + * remote event if applicable). + */ +type ApplyDocChangesHandler = (queryView: QueryView, changes: DocumentMap, remoteEvent?: RemoteEvent) => Promise<ViewSnapshot | undefined>; +/** + * Callbacks implemented by EventManager to handle notifications from + * SyncEngine. + */ +interface SyncEngineListener { + /** Handles new view snapshots. */ + onWatchChange?(snapshots: ViewSnapshot[]): void; + /** Handles the failure of a query. */ + onWatchError?(query: Query, error: FirestoreError): void; +} +/** + * An implementation of `SyncEngine` coordinating with other parts of SDK. + * + * The parts of SyncEngine that act as a callback to RemoteStore need to be + * registered individually. This is done in `syncEngineWrite()` and + * `syncEngineListen()` (as well as `applyPrimaryState()`) as these methods + * serve as entry points to RemoteStore's functionality. + * + * Note: some field defined in this class might have public access level, but + * the class is not exported so they are only accessible from this module. + * This is useful to implement optional features (like bundles) in free + * functions, such that they are tree-shakeable. + */ +declare class SyncEngineImpl implements SyncEngine { + readonly localStore: LocalStore; + readonly remoteStore: RemoteStore; + readonly eventManager: EventManager; + readonly sharedClientState: SharedClientState; + currentUser: User; + readonly maxConcurrentLimboResolutions: number; + syncEngineListener: SyncEngineListener; + /** + * A callback that updates the QueryView based on the provided change. + * + * PORTING NOTE: On other platforms, this logic lives in + * `emitNewSnapshotsAndNotifyLocalStore()`, but on Web it is extracted to + * ensure that all view logic only exists in bundles that include views. + */ + applyDocChanges?: ApplyDocChangesHandler; + queryViewsByQuery: ObjectMap<Query, QueryView>; + queriesByTarget: Map<number, Query[]>; + /** + * The keys of documents that are in limbo for which we haven't yet started a + * limbo resolution query. The strings in this set are the result of calling + * `key.path.canonicalString()` where `key` is a `DocumentKey` object. + * + * The `Set` type was chosen because it provides efficient lookup and removal + * of arbitrary elements and it also maintains insertion order, providing the + * desired queue-like FIFO semantics. + */ + enqueuedLimboResolutions: Set<string>; + /** + * Keeps track of the target ID for each document that is in limbo with an + * active target. + */ + activeLimboTargetsByKey: SortedMap<DocumentKey, number>; + /** + * Keeps track of the information about an active limbo resolution for each + * active target ID that was started for the purpose of limbo resolution. + */ + activeLimboResolutionsByTarget: Map<number, LimboResolution>; + limboDocumentRefs: ReferenceSet; + /** Stores user completion handlers, indexed by User and BatchId. */ + mutationUserCallbacks: { + [uidKey: string]: SortedMap<BatchId, Deferred<void>>; + }; + /** Stores user callbacks waiting for all pending writes to be acknowledged. */ + pendingWritesCallbacks: Map<number, Deferred<void>[]>; + limboTargetIdGenerator: TargetIdGenerator; + onlineState: OnlineState; + _isPrimaryClient: undefined | boolean; + constructor(localStore: LocalStore, remoteStore: RemoteStore, eventManager: EventManager, sharedClientState: SharedClientState, currentUser: User, maxConcurrentLimboResolutions: number); + get isPrimaryClient(): boolean; +} +export declare function newSyncEngine(localStore: LocalStore, remoteStore: RemoteStore, eventManager: EventManager, sharedClientState: SharedClientState, currentUser: User, maxConcurrentLimboResolutions: number, isPrimary: boolean): SyncEngine; +/** + * Initiates the new listen, resolves promise when listen enqueued to the + * server. All the subsequent view snapshots or errors are sent to the + * subscribed handlers. Returns the initial snapshot. + */ +export declare function syncEngineListen(syncEngine: SyncEngine, query: Query, shouldListenToRemote?: boolean): Promise<ViewSnapshot>; +/** Query has been listening to the cache, and tries to initiate the remote store listen */ +export declare function triggerRemoteStoreListen(syncEngine: SyncEngine, query: Query): Promise<void>; +/** Stops listening to the query. */ +export declare function syncEngineUnlisten(syncEngine: SyncEngine, query: Query, shouldUnlistenToRemote: boolean): Promise<void>; +/** Unlistens to the remote store while still listening to the cache. */ +export declare function triggerRemoteStoreUnlisten(syncEngine: SyncEngine, query: Query): Promise<void>; +/** + * Initiates the write of local mutation batch which involves adding the + * writes to the mutation queue, notifying the remote store about new + * mutations and raising events for any changes this write caused. + * + * The promise returned by this call is resolved when the above steps + * have completed, *not* when the write was acked by the backend. The + * userCallback is resolved once the write was acked/rejected by the + * backend (or failed locally for any other reason). + */ +export declare function syncEngineWrite(syncEngine: SyncEngine, batch: Mutation[], userCallback: Deferred<void>): Promise<void>; +/** + * Applies one remote event to the sync engine, notifying any views of the + * changes, and releasing any pending mutation batches that would become + * visible because of the snapshot version the remote event contains. + */ +export declare function syncEngineApplyRemoteEvent(syncEngine: SyncEngine, remoteEvent: RemoteEvent): Promise<void>; +/** + * Applies an OnlineState change to the sync engine and notifies any views of + * the change. + */ +export declare function syncEngineApplyOnlineStateChange(syncEngine: SyncEngine, onlineState: OnlineState, source: OnlineStateSource): void; +/** + * Rejects the listen for the given targetID. This can be triggered by the + * backend for any active target. + * + * @param syncEngine - The sync engine implementation. + * @param targetId - The targetID corresponds to one previously initiated by the + * user as part of TargetData passed to listen() on RemoteStore. + * @param err - A description of the condition that has forced the rejection. + * Nearly always this will be an indication that the user is no longer + * authorized to see the data matching the target. + */ +export declare function syncEngineRejectListen(syncEngine: SyncEngine, targetId: TargetId, err: FirestoreError): Promise<void>; +export declare function syncEngineApplySuccessfulWrite(syncEngine: SyncEngine, mutationBatchResult: MutationBatchResult): Promise<void>; +export declare function syncEngineRejectFailedWrite(syncEngine: SyncEngine, batchId: BatchId, error: FirestoreError): Promise<void>; +/** + * Registers a user callback that resolves when all pending mutations at the moment of calling + * are acknowledged . + */ +export declare function syncEngineRegisterPendingWritesCallback(syncEngine: SyncEngine, callback: Deferred<void>): Promise<void>; +export declare function syncEngineGetActiveLimboDocumentResolutions(syncEngine: SyncEngine): SortedMap<DocumentKey, TargetId>; +export declare function syncEngineGetEnqueuedLimboDocumentResolutions(syncEngine: SyncEngine): Set<string>; +export declare function syncEngineEmitNewSnapsAndNotifyLocalStore(syncEngine: SyncEngine, changes: DocumentMap, remoteEvent?: RemoteEvent): Promise<void>; +export declare function syncEngineHandleCredentialChange(syncEngine: SyncEngine, user: User): Promise<void>; +export declare function syncEngineGetRemoteKeysForTarget(syncEngine: SyncEngine, targetId: TargetId): DocumentKeySet; +/** + * Retrieves newly changed documents from remote document cache and raises + * snapshots if needed. + */ +export declare function syncEngineSynchronizeWithChangedDocuments(syncEngine: SyncEngine, collectionGroup: string): Promise<void>; +/** Applies a mutation state to an existing batch. */ +export declare function syncEngineApplyBatchState(syncEngine: SyncEngine, batchId: BatchId, batchState: MutationBatchState, error?: FirestoreError): Promise<void>; +/** Applies a query target change from a different tab. */ +export declare function syncEngineApplyPrimaryState(syncEngine: SyncEngine, isPrimary: boolean): Promise<void>; +/** Returns the IDs of the clients that are currently active. */ +export declare function syncEngineGetActiveClients(syncEngine: SyncEngine): Promise<ClientId[]>; +/** Applies a query target change from a different tab. */ +export declare function syncEngineApplyTargetState(syncEngine: SyncEngine, targetId: TargetId, state: QueryTargetState, error?: FirestoreError): Promise<void>; +/** Adds or removes Watch targets for queries from different tabs. */ +export declare function syncEngineApplyActiveTargetsChange(syncEngine: SyncEngine, added: TargetId[], removed: TargetId[]): Promise<void>; +export declare function syncEngineEnsureWriteCallbacks(syncEngine: SyncEngine): SyncEngineImpl; +/** + * Loads a Firestore bundle into the SDK. The returned promise resolves when + * the bundle finished loading. + * + * @param syncEngine - SyncEngine to use. + * @param bundleReader - Bundle to load into the SDK. + * @param task - LoadBundleTask used to update the loading progress to public API. + */ +export declare function syncEngineLoadBundle(syncEngine: SyncEngine, bundleReader: BundleReader, task: LoadBundleTask): void; +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/target.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/target.d.ts new file mode 100644 index 0000000..fcfed20 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/target.d.ts @@ -0,0 +1,89 @@ +/** + * @license + * Copyright 2019 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 { FieldIndex } from '../model/field_index'; +import { FieldPath, ResourcePath } from '../model/path'; +import { Value as ProtoValue } from '../protos/firestore_proto_api'; +import { Bound } from './bound'; +import { Filter, FieldFilter } from './filter'; +import { OrderBy } from './order_by'; +/** + * A Target represents the WatchTarget representation of a Query, which is used + * by the LocalStore and the RemoteStore to keep track of and to execute + * backend queries. While a Query can represent multiple Targets, each Targets + * maps to a single WatchTarget in RemoteStore and a single TargetData entry + * in persistence. + */ +export interface Target { + readonly path: ResourcePath; + readonly collectionGroup: string | null; + readonly orderBy: OrderBy[]; + readonly filters: Filter[]; + readonly limit: number | null; + readonly startAt: Bound | null; + readonly endAt: Bound | null; +} +export declare class TargetImpl implements Target { + readonly path: ResourcePath; + readonly collectionGroup: string | null; + readonly orderBy: OrderBy[]; + readonly filters: Filter[]; + readonly limit: number | null; + readonly startAt: Bound | null; + readonly endAt: Bound | null; + memoizedCanonicalId: string | null; + constructor(path: ResourcePath, collectionGroup?: string | null, orderBy?: OrderBy[], filters?: Filter[], limit?: number | null, startAt?: Bound | null, endAt?: Bound | null); +} +/** + * Initializes a Target with a path and optional additional query constraints. + * Path must currently be empty if this is a collection group query. + * + * NOTE: you should always construct `Target` from `Query.toTarget` instead of + * using this factory method, because `Query` provides an implicit `orderBy` + * property. + */ +export declare function newTarget(path: ResourcePath, collectionGroup?: string | null, orderBy?: OrderBy[], filters?: Filter[], limit?: number | null, startAt?: Bound | null, endAt?: Bound | null): Target; +export declare function canonifyTarget(target: Target): string; +export declare function stringifyTarget(target: Target): string; +export declare function targetEquals(left: Target, right: Target): boolean; +export declare function targetIsDocumentTarget(target: Target): boolean; +/** Returns the field filters that target the given field path. */ +export declare function targetGetFieldFiltersForPath(target: Target, path: FieldPath): FieldFilter[]; +/** + * Returns the values that are used in ARRAY_CONTAINS or ARRAY_CONTAINS_ANY + * filters. Returns `null` if there are no such filters. + */ +export declare function targetGetArrayValues(target: Target, fieldIndex: FieldIndex): ProtoValue[] | null; +/** + * Returns the list of values that are used in != or NOT_IN filters. Returns + * `null` if there are no such filters. + */ +export declare function targetGetNotInValues(target: Target, fieldIndex: FieldIndex): ProtoValue[] | null; +/** + * Returns a lower bound of field values that can be used as a starting point to + * scan the index defined by `fieldIndex`. Returns `MIN_VALUE` if no lower bound + * exists. + */ +export declare function targetGetLowerBound(target: Target, fieldIndex: FieldIndex): Bound; +/** + * Returns an upper bound of field values that can be used as an ending point + * when scanning the index defined by `fieldIndex`. Returns `MAX_VALUE` if no + * upper bound exists. + */ +export declare function targetGetUpperBound(target: Target, fieldIndex: FieldIndex): Bound; +/** Returns the number of segments of a perfect index for this target. */ +export declare function targetGetSegmentCount(target: Target): number; +export declare function targetHasLimit(target: Target): boolean; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/target_id_generator.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/target_id_generator.d.ts new file mode 100644 index 0000000..7a00fcd --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/target_id_generator.d.ts @@ -0,0 +1,38 @@ +/** + * @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 { TargetId } from './types'; +/** + * Generates monotonically increasing target IDs for sending targets to the + * watch stream. + * + * The client constructs two generators, one for the target cache, and one for + * for the sync engine (to generate limbo documents targets). These + * generators produce non-overlapping IDs (by using even and odd IDs + * respectively). + * + * By separating the target ID space, the query cache can generate target IDs + * that persist across client restarts, while sync engine can independently + * generate in-memory target IDs that are transient and can be reused after a + * restart. + */ +export declare class TargetIdGenerator { + private lastId; + constructor(lastId: number); + next(): TargetId; + static forTargetCache(): TargetIdGenerator; + static forSyncEngine(): TargetIdGenerator; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/transaction.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/transaction.d.ts new file mode 100644 index 0000000..4a982e9 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/transaction.d.ts @@ -0,0 +1,60 @@ +/** + * @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 { ParsedSetData, ParsedUpdateData } from '../lite-api/user_data_reader'; +import { Document } from '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { Datastore } from '../remote/datastore'; +/** + * Internal transaction object responsible for accumulating the mutations to + * perform and the base versions for any documents read. + */ +export declare class Transaction { + private datastore; + private readVersions; + private mutations; + private committed; + /** + * A deferred usage error that occurred previously in this transaction that + * will cause the transaction to fail once it actually commits. + */ + private lastTransactionError; + /** + * Set of documents that have been written in the transaction. + * + * When there's more than one write to the same key in a transaction, any + * writes after the first are handled differently. + */ + private writtenDocs; + constructor(datastore: Datastore); + lookup(keys: DocumentKey[]): Promise<Document[]>; + set(key: DocumentKey, data: ParsedSetData): void; + update(key: DocumentKey, data: ParsedUpdateData): void; + delete(key: DocumentKey): void; + commit(): Promise<void>; + private recordVersion; + /** + * Returns the version of this document when it was read in this transaction, + * as a precondition, or no precondition if it was not read. + */ + private precondition; + /** + * Returns the precondition for a document if the operation is an update. + */ + private preconditionForUpdate; + private write; + private ensureCommitNotCalled; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/transaction_options.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/transaction_options.d.ts new file mode 100644 index 0000000..bf52930 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/transaction_options.d.ts @@ -0,0 +1,25 @@ +/** + * @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. + */ +export declare const DEFAULT_TRANSACTION_OPTIONS: TransactionOptions; +/** + * Options to customize transaction behavior. + */ +export declare interface TransactionOptions { + /** Maximum number of attempts to commit, after which transaction fails. Default is 5. */ + readonly maxAttempts: number; +} +export declare function validateTransactionOptions(options: TransactionOptions): void; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/transaction_runner.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/transaction_runner.d.ts new file mode 100644 index 0000000..794c7d3 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/transaction_runner.d.ts @@ -0,0 +1,41 @@ +/** + * @license + * Copyright 2019 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 { Datastore } from '../remote/datastore'; +import { AsyncQueue } from '../util/async_queue'; +import { Deferred } from '../util/promise'; +import { Transaction } from './transaction'; +import { TransactionOptions } from './transaction_options'; +/** + * TransactionRunner encapsulates the logic needed to run and retry transactions + * with backoff. + */ +export declare class TransactionRunner<T> { + private readonly asyncQueue; + private readonly datastore; + private readonly options; + private readonly updateFunction; + private readonly deferred; + private attemptsRemaining; + private backoff; + constructor(asyncQueue: AsyncQueue, datastore: Datastore, options: TransactionOptions, updateFunction: (transaction: Transaction) => Promise<T>, deferred: Deferred<T>); + /** Runs the transaction and sets the result on deferred. */ + run(): void; + private runWithBackOff; + private tryRunUpdateFunction; + private handleTransactionError; + private isRetryableTransactionError; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/types.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/types.d.ts new file mode 100644 index 0000000..6c3b8ca --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/types.d.ts @@ -0,0 +1,65 @@ +/** + * @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. + */ +/** + * BatchID is a locally assigned ID for a batch of mutations that have been + * applied. + */ +export type BatchId = number; +/** + * A locally-assigned ID used to refer to a target being watched via the + * Watch service. + */ +export type TargetId = number; +export type ListenSequenceNumber = number; +/** The different states of a mutation batch. */ +export type MutationBatchState = 'pending' | 'acknowledged' | 'rejected'; +/** + * Describes the online state of the Firestore client. Note that this does not + * indicate whether or not the remote store is trying to connect or not. This is + * primarily used by the View / EventManager code to change their behavior while + * offline (e.g. get() calls shouldn't wait for data from the server and + * snapshot events should set metadata.isFromCache=true). + * + * The string values should not be changed since they are persisted in + * WebStorage. + */ +export declare const enum OnlineState { + /** + * The Firestore client is in an unknown online state. This means the client + * is either not actively trying to establish a connection or it is currently + * trying to establish a connection, but it has not succeeded or failed yet. + * Higher-level components should not operate in offline mode. + */ + Unknown = "Unknown", + /** + * The client is connected and the connections are healthy. This state is + * reached after a successful connection and there has been at least one + * successful message received from the backends. + */ + Online = "Online", + /** + * The client is either trying to establish a connection but failing, or it + * has been explicitly marked offline via a call to disableNetwork(). + * Higher-level components should operate in offline mode. + */ + Offline = "Offline" +} +/** The source of an online state event. */ +export declare const enum OnlineStateSource { + RemoteStore = 0, + SharedClientState = 1 +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/version.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/version.d.ts new file mode 100644 index 0000000..9edc565 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/version.d.ts @@ -0,0 +1,18 @@ +/** + * @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 let SDK_VERSION: string; +export declare function setSDKVersion(version: string): void; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/view.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/view.d.ts new file mode 100644 index 0000000..57680a5 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/view.d.ts @@ -0,0 +1,152 @@ +/** + * @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 { QueryResult } from '../local/local_store_impl'; +import { DocumentKeySet, DocumentMap } from '../model/collections'; +import { DocumentKey } from '../model/document_key'; +import { DocumentSet } from '../model/document_set'; +import { TargetChange } from '../remote/remote_event'; +import { Query } from './query'; +import { OnlineState } from './types'; +import { DocumentChangeSet, ViewSnapshot } from './view_snapshot'; +export type LimboDocumentChange = AddedLimboDocument | RemovedLimboDocument; +export declare class AddedLimboDocument { + key: DocumentKey; + constructor(key: DocumentKey); +} +export declare class RemovedLimboDocument { + key: DocumentKey; + constructor(key: DocumentKey); +} +/** The result of applying a set of doc changes to a view. */ +export interface ViewDocumentChanges { + /** The new set of docs that should be in the view. */ + documentSet: DocumentSet; + /** The diff of these docs with the previous set of docs. */ + changeSet: DocumentChangeSet; + /** + * Whether the set of documents passed in was not sufficient to calculate the + * new state of the view and there needs to be another pass based on the + * local cache. + */ + needsRefill: boolean; + mutatedKeys: DocumentKeySet; +} +export interface ViewChange { + snapshot?: ViewSnapshot; + limboChanges: LimboDocumentChange[]; +} +/** + * View is responsible for computing the final merged truth of what docs are in + * a query. It gets notified of local and remote changes to docs, and applies + * the query filters and limits to determine the most correct possible results. + */ +export declare class View { + private query; + /** Documents included in the remote target */ + private _syncedDocuments; + private syncState; + private hasCachedResults; + /** + * A flag whether the view is current with the backend. A view is considered + * current after it has seen the current flag from the backend and did not + * lose consistency within the watch stream (e.g. because of an existence + * filter mismatch). + */ + private current; + private documentSet; + /** Documents in the view but not in the remote target */ + private limboDocuments; + /** Document Keys that have local changes */ + private mutatedKeys; + /** Query comparator that defines the document order in this view. */ + private docComparator; + constructor(query: Query, + /** Documents included in the remote target */ + _syncedDocuments: DocumentKeySet); + /** + * The set of remote documents that the server has told us belongs to the target associated with + * this view. + */ + get syncedDocuments(): DocumentKeySet; + /** + * Iterates over a set of doc changes, applies the query limit, and computes + * what the new results should be, what the changes were, and whether we may + * need to go back to the local cache for more results. Does not make any + * changes to the view. + * @param docChanges - The doc changes to apply to this view. + * @param previousChanges - If this is being called with a refill, then start + * with this set of docs and changes instead of the current view. + * @returns a new set of docs, changes, and refill flag. + */ + computeDocChanges(docChanges: DocumentMap, previousChanges?: ViewDocumentChanges): ViewDocumentChanges; + private shouldWaitForSyncedDocument; + /** + * Updates the view with the given ViewDocumentChanges and optionally updates + * limbo docs and sync state from the provided target change. + * @param docChanges - The set of changes to make to the view's docs. + * @param limboResolutionEnabled - Whether to update limbo documents based on + * this change. + * @param targetChange - A target change to apply for computing limbo docs and + * sync state. + * @param targetIsPendingReset - Whether the target is pending to reset due to + * existence filter mismatch. If not explicitly specified, it is treated + * equivalently to `false`. + * @returns A new ViewChange with the given docs, changes, and sync state. + */ + applyChanges(docChanges: ViewDocumentChanges, limboResolutionEnabled: boolean, targetChange?: TargetChange, targetIsPendingReset?: boolean): ViewChange; + /** + * Applies an OnlineState change to the view, potentially generating a + * ViewChange if the view's syncState changes as a result. + */ + applyOnlineStateChange(onlineState: OnlineState): ViewChange; + /** + * Returns whether the doc for the given key should be in limbo. + */ + private shouldBeInLimbo; + /** + * Updates syncedDocuments, current, and limbo docs based on the given change. + * Returns the list of changes to which docs are in limbo. + */ + private applyTargetChange; + private updateLimboDocuments; + /** + * Update the in-memory state of the current view with the state read from + * persistence. + * + * We update the query view whenever a client's primary status changes: + * - When a client transitions from primary to secondary, it can miss + * LocalStorage updates and its query views may temporarily not be + * synchronized with the state on disk. + * - For secondary to primary transitions, the client needs to update the list + * of `syncedDocuments` since secondary clients update their query views + * based purely on synthesized RemoteEvents. + * + * @param queryResult.documents - The documents that match the query according + * to the LocalStore. + * @param queryResult.remoteKeys - The keys of the documents that match the + * query according to the backend. + * + * @returns The ViewChange that resulted from this synchronization. + */ + synchronizeWithPersistedState(queryResult: QueryResult): ViewChange; + /** + * Returns a view snapshot as if this query was just listened to. Contains + * a document add for every existing document and the `fromCache` and + * `hasPendingWrites` status of the already established view. + */ + computeInitialSnapshot(): ViewSnapshot; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/view_snapshot.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/view_snapshot.d.ts new file mode 100644 index 0000000..8b284df --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/core/view_snapshot.d.ts @@ -0,0 +1,59 @@ +/** + * @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 { DocumentKeySet } from '../model/collections'; +import { Document } from '../model/document'; +import { DocumentSet } from '../model/document_set'; +import { Query } from './query'; +export declare const enum ChangeType { + Added = 0, + Removed = 1, + Modified = 2, + Metadata = 3 +} +export interface DocumentViewChange { + type: ChangeType; + doc: Document; +} +export declare const enum SyncState { + Local = 0, + Synced = 1 +} +/** + * DocumentChangeSet keeps track of a set of changes to docs in a query, merging + * duplicate events for the same doc. + */ +export declare class DocumentChangeSet { + private changeMap; + track(change: DocumentViewChange): void; + getChanges(): DocumentViewChange[]; +} +export declare class ViewSnapshot { + readonly query: Query; + readonly docs: DocumentSet; + readonly oldDocs: DocumentSet; + readonly docChanges: DocumentViewChange[]; + readonly mutatedKeys: DocumentKeySet; + readonly fromCache: boolean; + readonly syncStateChanged: boolean; + readonly excludesMetadataChanges: boolean; + readonly hasCachedResults: boolean; + constructor(query: Query, docs: DocumentSet, oldDocs: DocumentSet, docChanges: DocumentViewChange[], mutatedKeys: DocumentKeySet, fromCache: boolean, syncStateChanged: boolean, excludesMetadataChanges: boolean, hasCachedResults: boolean); + /** Returns a view snapshot as if all documents in the snapshot were added. */ + static fromInitialDocuments(query: Query, documents: DocumentSet, mutatedKeys: DocumentKeySet, fromCache: boolean, hasCachedResults: boolean): ViewSnapshot; + get hasPendingWrites(): boolean; + isEqual(other: ViewSnapshot): boolean; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/global_index.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/global_index.d.ts new file mode 100644 index 0000000..0cecbff --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/global_index.d.ts @@ -0,0 +1,10145 @@ +/** + * @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. + */ +interface VersionService { + library: string; + version: string; +} +interface PlatformLoggerService { + getPlatformInfoString(): string; +} +interface HeartbeatService { + /** + * Called to report a heartbeat. The function will generate + * a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it + * to IndexedDB. + * Note that we only store one heartbeat per day. So if a heartbeat for today is + * already logged, subsequent calls to this function in the same day will be ignored. + */ + triggerHeartbeat(): Promise<void>; + /** + * Returns a base64 encoded string which can be attached to the heartbeat-specific header directly. + * It also clears all heartbeats from memory as well as in IndexedDB. + */ + getHeartbeatsHeader(): Promise<string>; +} + +/** + * @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. + */ + +/** + * A {@link @firebase/app#FirebaseApp} holds the initialization information for a collection of + * services. + * + * Do not call this constructor directly. Instead, use + * {@link (initializeApp:1) | initializeApp()} to create an app. + * + * @public + */ +interface FirebaseApp { + /** + * The (read-only) name for this app. + * + * The default app's name is `"[DEFAULT]"`. + * + * @example + * ```javascript + * // The default app's name is "[DEFAULT]" + * const app = initializeApp(defaultAppConfig); + * console.log(app.name); // "[DEFAULT]" + * ``` + * + * @example + * ```javascript + * // A named app's name is what you provide to initializeApp() + * const otherApp = initializeApp(otherAppConfig, "other"); + * console.log(otherApp.name); // "other" + * ``` + */ + readonly name: string; + /** + * The (read-only) configuration options for this app. These are the original + * parameters given in {@link (initializeApp:1) | initializeApp()}. + * + * @example + * ```javascript + * const app = initializeApp(config); + * console.log(app.options.databaseURL === config.databaseURL); // true + * ``` + */ + readonly options: FirebaseOptions; + /** + * The settable config flag for GDPR opt-in/opt-out + */ + automaticDataCollectionEnabled: boolean; +} +/** + * @public + * + * Firebase configuration object. Contains a set of parameters required by + * services in order to successfully communicate with Firebase server APIs + * and to associate client data with your Firebase project and + * Firebase application. Typically this object is populated by the Firebase + * console at project setup. See also: + * {@link https://firebase.google.com/docs/web/setup#config-object | Learn about the Firebase config object}. + */ +interface FirebaseOptions { + /** + * An encrypted string used when calling certain APIs that don't need to + * access private user data + * (example value: `AIzaSyDOCAbC123dEf456GhI789jKl012-MnO`). + */ + apiKey?: string; + /** + * Auth domain for the project ID. + */ + authDomain?: string; + /** + * Default Realtime Database URL. + */ + databaseURL?: string; + /** + * The unique identifier for the project across all of Firebase and + * Google Cloud. + */ + projectId?: string; + /** + * The default Cloud Storage bucket name. + */ + storageBucket?: string; + /** + * Unique numerical value used to identify each sender that can send + * Firebase Cloud Messaging messages to client apps. + */ + messagingSenderId?: string; + /** + * Unique identifier for the app. + */ + appId?: string; + /** + * An ID automatically created when you enable Analytics in your + * Firebase project and register a web app. In versions 7.20.0 + * and higher, this parameter is optional. + */ + measurementId?: string; +} +/** + * @internal + */ +interface _FirebaseService { + app: FirebaseApp; + /** + * Delete the service and free it's resources - called from + * {@link @firebase/app#deleteApp | deleteApp()} + */ + _delete(): Promise<void>; +} +declare module '@firebase/component' { + interface NameServiceMapping { + 'app': FirebaseApp; + 'app-version': VersionService; + 'heartbeat': HeartbeatService; + 'platform-logger': PlatformLoggerService; + } +} + +/** + * @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. + */ +type LogLevelString = 'debug' | 'verbose' | 'info' | 'warn' | 'error' | 'silent'; + +/** + * An object that can be injected into the environment as __FIREBASE_DEFAULTS__, + * either as a property of globalThis, a shell environment variable, or a + * cookie. + * + * This object can be used to automatically configure and initialize + * a Firebase app as well as any emulators. + * + * @public + */ +interface FirebaseDefaults { + config?: Record<string, string>; + emulatorHosts?: Record<string, string>; + _authTokenSyncURL?: string; + _authIdTokenMaxAge?: number; + /** + * Override Firebase's runtime environment detection and + * force the SDK to act as if it were in the specified environment. + */ + forceEnvironment?: 'browser' | 'node'; + [key: string]: unknown; +} +declare global { + var __FIREBASE_DEFAULTS__: FirebaseDefaults | undefined; +} + +/** + * @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. + */ +type FirebaseSignInProvider = 'custom' | 'email' | 'password' | 'phone' | 'anonymous' | 'google.com' | 'facebook.com' | 'github.com' | 'twitter.com' | 'microsoft.com' | 'apple.com'; +interface FirebaseIdToken { + iss: string; + aud: string; + sub: string; + iat: number; + exp: number; + user_id: string; + auth_time: number; + provider_id?: 'anonymous'; + email?: string; + email_verified?: boolean; + phone_number?: string; + name?: string; + picture?: string; + firebase: { + sign_in_provider: FirebaseSignInProvider; + identities?: { + [provider in FirebaseSignInProvider]?: string[]; + }; + }; + [claim: string]: unknown; + uid?: never; +} +type EmulatorMockTokenOptions = ({ + user_id: string; +} | { + sub: string; +}) & Partial<FirebaseIdToken>; + +declare class FirebaseError extends Error { + /** The error code for this error. */ + readonly code: string; + /** Custom data for this error. */ + customData?: Record<string, unknown> | undefined; + /** The custom name for all FirebaseErrors. */ + readonly name: string; + constructor( + /** The error code for this error. */ + code: string, message: string, + /** Custom data for this error. */ + customData?: Record<string, unknown> | undefined); +} + +/** + * @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. + */ +/** + * Simple wrapper around a nullable UID. Mostly exists to make code more + * readable. + */ +declare class User { + readonly uid: string | null; + /** A user with a null UID. */ + static readonly UNAUTHENTICATED: User; + static readonly GOOGLE_CREDENTIALS: User; + static readonly FIRST_PARTY: User; + static readonly MOCK_USER: User; + constructor(uid: string | null); + isAuthenticated(): boolean; + /** + * Returns a key representing this user, suitable for inclusion in a + * dictionary. + */ + toKey(): string; + isEqual(otherUser: User): boolean; +} + +/** + * @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. + */ + +interface FirebaseAppCheckInternal { + // Get the current AttestationToken. Attaches to the most recent in-flight request if one + // is present. Returns null if no token is present and no token requests are in-flight. + getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult>; + + // Always returns a fresh limited-use token suitable for Replay Protection. + // The returned token must be used and consumed as soon as possible. + getLimitedUseToken(): Promise<AppCheckTokenResult>; + + // Registers a listener to changes in the token state. There can be more than one listener + // registered at the same time for one or more FirebaseAppAttestation instances. The + // listeners call back on the UI thread whenever the current token associated with this + // FirebaseAppAttestation changes. + addTokenListener(listener: AppCheckTokenListener): void; + + // Unregisters a listener to changes in the token state. + removeTokenListener(listener: AppCheckTokenListener): void; +} + +type AppCheckTokenListener = (token: AppCheckTokenResult) => void; + +// If the error field is defined, the token field will be populated with a dummy token +interface AppCheckTokenResult { + readonly token: string; + readonly error?: Error; +} + +declare module '@firebase/component' { + interface NameServiceMapping { + 'app-check-internal': FirebaseAppCheckInternal; + } +} + +/** + * @license + * Copyright 2019 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. + */ + +interface FirebaseAuthTokenData { + accessToken: string; +} + +interface FirebaseAuthInternal { + getToken(refreshToken?: boolean): Promise<FirebaseAuthTokenData | null>; + getUid(): string | null; + addAuthTokenListener(fn: (token: string | null) => void): void; + removeAuthTokenListener(fn: (token: string | null) => void): void; +} + +declare module '@firebase/component' { + interface NameServiceMapping { + 'auth-internal': FirebaseAuthInternal; + } +} + +/** + * @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. + */ + +/** + * The set of Firestore status codes. The codes are the same at the ones + * exposed by gRPC here: + * https://github.com/grpc/grpc/blob/master/doc/statuscodes.md + * + * Possible values: + * - 'cancelled': The operation was cancelled (typically by the caller). + * - 'unknown': Unknown error or an error from a different error domain. + * - 'invalid-argument': Client specified an invalid argument. Note that this + * differs from 'failed-precondition'. 'invalid-argument' indicates + * arguments that are problematic regardless of the state of the system + * (e.g. an invalid field name). + * - 'deadline-exceeded': Deadline expired before operation could complete. + * For operations that change the state of the system, this error may be + * returned even if the operation has completed successfully. For example, + * a successful response from a server could have been delayed long enough + * for the deadline to expire. + * - 'not-found': Some requested document was not found. + * - 'already-exists': Some document that we attempted to create already + * exists. + * - 'permission-denied': The caller does not have permission to execute the + * specified operation. + * - 'resource-exhausted': Some resource has been exhausted, perhaps a + * per-user quota, or perhaps the entire file system is out of space. + * - 'failed-precondition': Operation was rejected because the system is not + * in a state required for the operation's execution. + * - 'aborted': The operation was aborted, typically due to a concurrency + * issue like transaction aborts, etc. + * - 'out-of-range': Operation was attempted past the valid range. + * - 'unimplemented': Operation is not implemented or not supported/enabled. + * - 'internal': Internal errors. Means some invariants expected by + * underlying system has been broken. If you see one of these errors, + * something is very broken. + * - 'unavailable': The service is currently unavailable. This is most likely + * a transient condition and may be corrected by retrying with a backoff. + * - 'data-loss': Unrecoverable data loss or corruption. + * - 'unauthenticated': The request does not have valid authentication + * credentials for the operation. + */ +type FirestoreErrorCode$1 = 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated'; +/** An error returned by a Firestore operation. */ +declare class FirestoreError$1 extends FirebaseError { + /** + * The backend error code associated with this error. + */ + readonly code: FirestoreErrorCode$1; + /** + * A custom error description. + */ + readonly message: string; + /** The stack of the error. */ + readonly stack?: string; + /** @hideconstructor */ + constructor( + /** + * The backend error code associated with this error. + */ + code: FirestoreErrorCode$1, + /** + * A custom error description. + */ + message: string); +} + +/** + * @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. + */ + +/** + * Wellknown "timer" IDs used when scheduling delayed operations on the + * AsyncQueue. These IDs can then be used from tests to check for the presence + * of operations or to run them early. + * + * The string values are used when encoding these timer IDs in JSON spec tests. + */ +declare const enum TimerId { + /** All can be used with runDelayedOperationsEarly() to run all timers. */ + All = "all", + /** + * The following 5 timers are used in persistent_stream.ts for the listen and + * write streams. The "Idle" timer is used to close the stream due to + * inactivity. The "ConnectionBackoff" timer is used to restart a stream once + * the appropriate backoff delay has elapsed. The health check is used to mark + * a stream healthy if it has not received an error during its initial setup. + */ + ListenStreamIdle = "listen_stream_idle", + ListenStreamConnectionBackoff = "listen_stream_connection_backoff", + WriteStreamIdle = "write_stream_idle", + WriteStreamConnectionBackoff = "write_stream_connection_backoff", + HealthCheckTimeout = "health_check_timeout", + /** + * A timer used in online_state_tracker.ts to transition from + * OnlineState.Unknown to Offline after a set timeout, rather than waiting + * indefinitely for success or failure. + */ + OnlineStateTimeout = "online_state_timeout", + /** + * A timer used to update the client metadata in IndexedDb, which is used + * to determine the primary leaseholder. + */ + ClientMetadataRefresh = "client_metadata_refresh", + /** A timer used to periodically attempt LRU Garbage collection */ + LruGarbageCollection = "lru_garbage_collection", + /** + * A timer used to retry transactions. Since there can be multiple concurrent + * transactions, multiple of these may be in the queue at a given time. + */ + TransactionRetry = "transaction_retry", + /** + * A timer used to retry operations scheduled via retryable AsyncQueue + * operations. + */ + AsyncQueueRetry = "async_queue_retry", + /** + * A timer used to periodically attempt index backfill. + */ + IndexBackfill = "index_backfill" +} +/** + * Represents an operation scheduled to be run in the future on an AsyncQueue. + * + * It is created via DelayedOperation.createAndSchedule(). + * + * Supports cancellation (via cancel()) and early execution (via skipDelay()). + * + * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type + * in newer versions of TypeScript defines `finally`, which is not available in + * IE. + */ +declare class DelayedOperation<T extends unknown> implements PromiseLike<T> { + private readonly asyncQueue; + readonly timerId: TimerId; + readonly targetTimeMs: number; + private readonly op; + private readonly removalCallback; + private timerHandle; + private readonly deferred; + private constructor(); + get promise(): Promise<T>; + /** + * Creates and returns a DelayedOperation that has been scheduled to be + * executed on the provided asyncQueue after the provided delayMs. + * + * @param asyncQueue - The queue to schedule the operation on. + * @param id - A Timer ID identifying the type of operation this is. + * @param delayMs - The delay (ms) before the operation should be scheduled. + * @param op - The operation to run. + * @param removalCallback - A callback to be called synchronously once the + * operation is executed or canceled, notifying the AsyncQueue to remove it + * from its delayedOperations list. + * PORTING NOTE: This exists to prevent making removeDelayedOperation() and + * the DelayedOperation class public. + */ + static createAndSchedule<R extends unknown>(asyncQueue: AsyncQueue, timerId: TimerId, delayMs: number, op: () => Promise<R>, removalCallback: (op: DelayedOperation<R>) => void): DelayedOperation<R>; + /** + * Starts the timer. This is called immediately after construction by + * createAndSchedule(). + */ + private start; + /** + * Queues the operation to run immediately (if it hasn't already been run or + * canceled). + */ + skipDelay(): void; + /** + * Cancels the operation if it hasn't already been executed or canceled. The + * promise will be rejected. + * + * As long as the operation has not yet been run, calling cancel() provides a + * guarantee that the operation will not be run. + */ + cancel(reason?: string): void; + then: <TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>; + private handleDelayElapsed; + private clearTimeout; +} +interface AsyncQueue { + readonly isShuttingDown: boolean; + /** + * Adds a new operation to the queue without waiting for it to complete (i.e. + * we ignore the Promise result). + */ + enqueueAndForget<T extends unknown>(op: () => Promise<T>): void; + /** + * Regardless if the queue has initialized shutdown, adds a new operation to the + * queue without waiting for it to complete (i.e. we ignore the Promise result). + */ + enqueueAndForgetEvenWhileRestricted<T extends unknown>(op: () => Promise<T>): void; + /** + * Initialize the shutdown of this queue. Once this method is called, the + * only possible way to request running an operation is through + * `enqueueEvenWhileRestricted()`. + * + * @param purgeExistingTasks Whether already enqueued tasked should be + * rejected (unless enqueued with `enqueueEvenWhileRestricted()`). Defaults + * to false. + */ + enterRestrictedMode(purgeExistingTasks?: boolean): void; + /** + * Adds a new operation to the queue. Returns a promise that will be resolved + * when the promise returned by the new operation is (with its value). + */ + enqueue<T extends unknown>(op: () => Promise<T>): Promise<T>; + /** + * Enqueue a retryable operation. + * + * A retryable operation is rescheduled with backoff if it fails with a + * IndexedDbTransactionError (the error type used by SimpleDb). All + * retryable operations are executed in order and only run if all prior + * operations were retried successfully. + */ + enqueueRetryable(op: () => Promise<void>): void; + /** + * Schedules an operation to be queued on the AsyncQueue once the specified + * `delayMs` has elapsed. The returned DelayedOperation can be used to cancel + * or fast-forward the operation prior to its running. + */ + enqueueAfterDelay<T extends unknown>(timerId: TimerId, delayMs: number, op: () => Promise<T>): DelayedOperation<T>; + /** + * Verifies there's an operation currently in-progress on the AsyncQueue. + * Unfortunately we can't verify that the running code is in the promise chain + * of that operation, so this isn't a foolproof check, but it should be enough + * to catch some bugs. + */ + verifyOperationInProgress(): void; +} + +/** + * @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. + */ + +/** + * @internal + */ +type AuthTokenFactory = () => string; +/** + * @internal + */ +interface FirstPartyCredentialsSettings { + ['type']: 'firstParty'; + ['sessionIndex']: string; + ['iamToken']: string | null; + ['authTokenFactory']: AuthTokenFactory | null; +} +interface ProviderCredentialsSettings { + ['type']: 'provider'; + ['client']: CredentialsProvider<User>; +} +/** Settings for private credentials */ +type CredentialsSettings = FirstPartyCredentialsSettings | ProviderCredentialsSettings; +type TokenType = 'OAuth' | 'FirstParty' | 'AppCheck'; +interface Token { + /** Type of token. */ + type: TokenType; + /** + * The user with which the token is associated (used for persisting user + * state on disk, etc.). + * This will be null for Tokens of the type 'AppCheck'. + */ + user?: User; + /** Header values to set for this token */ + headers: Map<string, string>; +} +/** + * A Listener for credential change events. The listener should fetch a new + * token and may need to invalidate other state if the current user has also + * changed. + */ +type CredentialChangeListener<T> = (credential: T) => Promise<void>; +/** + * Provides methods for getting the uid and token for the current user and + * listening for changes. + */ +interface CredentialsProvider<T> { + /** + * Starts the credentials provider and specifies a listener to be notified of + * credential changes (sign-in / sign-out, token changes). It is immediately + * called once with the initial user. + * + * The change listener is invoked on the provided AsyncQueue. + */ + start(asyncQueue: AsyncQueue, changeListener: CredentialChangeListener<T>): void; + /** Requests a token for the current user. */ + getToken(): Promise<Token | null>; + /** + * Marks the last retrieved token as invalid, making the next GetToken request + * force-refresh the token. + */ + invalidateToken(): void; + shutdown(): void; +} +/** + * A CredentialsProvider that always yields an empty token. + * @internal + */ +declare class EmptyAuthCredentialsProvider implements CredentialsProvider<User> { + getToken(): Promise<Token | null>; + invalidateToken(): void; + start(asyncQueue: AsyncQueue, changeListener: CredentialChangeListener<User>): void; + shutdown(): void; +} +/** + * An AppCheck token provider that always yields an empty token. + * @internal + */ +declare class EmptyAppCheckTokenProvider implements CredentialsProvider<string> { + getToken(): Promise<Token | null>; + invalidateToken(): void; + start(asyncQueue: AsyncQueue, changeListener: CredentialChangeListener<string>): void; + shutdown(): void; +} + +/** + * @license + * Copyright 2023 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. + */ +/** + * Options that configure the SDK’s underlying network transport (WebChannel) + * when long-polling is used. + * + * Note: This interface is "experimental" and is subject to change. + * + * See `FirestoreSettings.experimentalAutoDetectLongPolling`, + * `FirestoreSettings.experimentalForceLongPolling`, and + * `FirestoreSettings.experimentalLongPollingOptions`. + */ +interface ExperimentalLongPollingOptions { + /** + * The desired maximum timeout interval, in seconds, to complete a + * long-polling GET response. Valid values are between 5 and 30, inclusive. + * Floating point values are allowed and will be rounded to the nearest + * millisecond. + * + * By default, when long-polling is used the "hanging GET" request sent by + * the client times out after 30 seconds. To request a different timeout + * from the server, set this setting with the desired timeout. + * + * Changing the default timeout may be useful, for example, if the buffering + * proxy that necessitated enabling long-polling in the first place has a + * shorter timeout for hanging GET requests, in which case setting the + * long-polling timeout to a shorter value, such as 25 seconds, may fix + * prematurely-closed hanging GET requests. + * For example, see https://github.com/firebase/firebase-js-sdk/issues/6987. + */ + timeoutSeconds?: number; +} + +/** + * @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. + */ +declare class DatabaseInfo { + readonly databaseId: DatabaseId; + readonly appId: string; + readonly persistenceKey: string; + readonly host: string; + readonly ssl: boolean; + readonly forceLongPolling: boolean; + readonly autoDetectLongPolling: boolean; + readonly longPollingOptions: ExperimentalLongPollingOptions; + readonly useFetchStreams: boolean; + readonly isUsingEmulator: boolean; + /** + * Constructs a DatabaseInfo using the provided host, databaseId and + * persistenceKey. + * + * @param databaseId - The database to use. + * @param appId - The Firebase App Id. + * @param persistenceKey - A unique identifier for this Firestore's local + * storage (used in conjunction with the databaseId). + * @param host - The Firestore backend host to connect to. + * @param ssl - Whether to use SSL when connecting. + * @param forceLongPolling - Whether to use the forceLongPolling option + * when using WebChannel as the network transport. + * @param autoDetectLongPolling - Whether to use the detectBufferingProxy + * option when using WebChannel as the network transport. + * @param longPollingOptions Options that configure long-polling. + * @param useFetchStreams Whether to use the Fetch API instead of + * XMLHTTPRequest + */ + constructor(databaseId: DatabaseId, appId: string, persistenceKey: string, host: string, ssl: boolean, forceLongPolling: boolean, autoDetectLongPolling: boolean, longPollingOptions: ExperimentalLongPollingOptions, useFetchStreams: boolean, isUsingEmulator: boolean); +} +/** + * Represents the database ID a Firestore client is associated with. + * @internal + */ +declare class DatabaseId { + readonly projectId: string; + readonly database: string; + constructor(projectId: string, database?: string); + static empty(): DatabaseId; + get isDefaultDatabase(): boolean; + isEqual(other: {}): boolean; +} + +/** + * @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. + */ +/** + * BatchID is a locally assigned ID for a batch of mutations that have been + * applied. + */ +type BatchId = number; +/** + * A locally-assigned ID used to refer to a target being watched via the + * Watch service. + */ +type TargetId = number; +type ListenSequenceNumber = number; +/** + * Describes the online state of the Firestore client. Note that this does not + * indicate whether or not the remote store is trying to connect or not. This is + * primarily used by the View / EventManager code to change their behavior while + * offline (e.g. get() calls shouldn't wait for data from the server and + * snapshot events should set metadata.isFromCache=true). + * + * The string values should not be changed since they are persisted in + * WebStorage. + */ +declare const enum OnlineState { + /** + * The Firestore client is in an unknown online state. This means the client + * is either not actively trying to establish a connection or it is currently + * trying to establish a connection, but it has not succeeded or failed yet. + * Higher-level components should not operate in offline mode. + */ + Unknown = "Unknown", + /** + * The client is connected and the connections are healthy. This state is + * reached after a successful connection and there has been at least one + * successful message received from the backends. + */ + Online = "Online", + /** + * The client is either trying to establish a connection but failing, or it + * has been explicitly marked offline via a call to disableNetwork(). + * Higher-level components should operate in offline mode. + */ + Offline = "Offline" +} + +/** + * 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 + */ +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 + */ +declare class FieldPath$2 extends BasePath<FieldPath$2> { + protected construct(segments: string[], offset?: number, length?: number): FieldPath$2; + /** + * 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$2; + /** + * 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$2; + static emptyPath(): FieldPath$2; +} + +/** + * @license + * Copyright 2023 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. + */ + +/** + * Union type representing the aggregate type to be performed. + */ +type AggregateType = 'count' | 'avg' | 'sum'; + +/** + * @license + * Copyright 2025 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. + */ +/** + * A list of data types Firestore objects may serialize in their toJSON implemenetations. + * @private + * @internal + */ +type JsonTypeDesc = 'object' | 'string' | 'number' | 'boolean' | 'null' | 'undefined'; +/** + * An association of JsonTypeDesc values to their native types. + * @private + * @internal + */ +type TSType<T extends JsonTypeDesc> = T extends 'object' ? object : T extends 'string' ? string : T extends 'number' ? number : T extends 'boolean' ? boolean : T extends 'null' ? null : T extends 'undefined' ? undefined : never; +/** + * The representation of a JSON object property name and its type value. + * @private + * @internal + */ +interface Property<T extends JsonTypeDesc> { + value?: TSType<T>; + typeString: JsonTypeDesc; +} + +/** + * @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. + */ + +/** + * A `Timestamp` represents a point in time independent of any time zone or + * calendar, represented as seconds and fractions of seconds at nanosecond + * resolution in UTC Epoch time. + * + * It is encoded using the Proleptic Gregorian Calendar which extends the + * Gregorian calendar backwards to year one. It is encoded assuming all minutes + * are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second + * table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59.999999999Z. + * + * For examples and further specifications, refer to the + * {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}. + */ +declare class Timestamp$1 { + /** + * The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. + */ + readonly seconds: number; + /** + * The fractions of a second at nanosecond resolution.* + */ + readonly nanoseconds: number; + /** + * Creates a new timestamp with the current date, with millisecond precision. + * + * @returns a new timestamp representing the current date. + */ + static now(): Timestamp$1; + /** + * Creates a new timestamp from the given date. + * + * @param date - The date to initialize the `Timestamp` from. + * @returns A new `Timestamp` representing the same point in time as the given + * date. + */ + static fromDate(date: Date): Timestamp$1; + /** + * Creates a new timestamp from the given number of milliseconds. + * + * @param milliseconds - Number of milliseconds since Unix epoch + * 1970-01-01T00:00:00Z. + * @returns A new `Timestamp` representing the same point in time as the given + * number of milliseconds. + */ + static fromMillis(milliseconds: number): Timestamp$1; + /** + * Creates a new timestamp. + * + * @param 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 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( + /** + * The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. + */ + seconds: number, + /** + * The fractions of a second at nanosecond resolution.* + */ + nanoseconds: number); + /** + * Converts a `Timestamp` to a JavaScript `Date` object. This conversion + * causes a loss of precision since `Date` objects only support millisecond + * precision. + * + * @returns JavaScript `Date` object representing the same point in time as + * this `Timestamp`, with millisecond precision. + */ + toDate(): Date; + /** + * Converts a `Timestamp` to a numeric timestamp (in milliseconds since + * epoch). This operation causes a loss of precision. + * + * @returns The point in time corresponding to this timestamp, represented as + * the number of milliseconds since Unix epoch 1970-01-01T00:00:00Z. + */ + toMillis(): number; + _compareTo(other: Timestamp$1): number; + /** + * Returns true if this `Timestamp` is equal to the provided one. + * + * @param other - The `Timestamp` to compare against. + * @returns true if this `Timestamp` is equal to the provided one. + */ + isEqual(other: Timestamp$1): boolean; + /** Returns a textual representation of this `Timestamp`. */ + toString(): string; + static _jsonSchemaVersion: string; + static _jsonSchema: { + type: Property<"string">; + seconds: Property<"number">; + nanoseconds: Property<"number">; + }; + /** + * Returns a JSON-serializable representation of this `Timestamp`. + */ + toJSON(): { + seconds: number; + nanoseconds: number; + type: string; + }; + /** + * Builds a `Timestamp` instance from a JSON object created by {@link Timestamp.toJSON}. + */ + static fromJSON(json: object): Timestamp$1; + /** + * Converts this object to a primitive string, which allows `Timestamp` objects + * to be compared using the `>`, `<=`, `>=` and `>` operators. + */ + valueOf(): string; +} + +/** + * @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. + */ + +/** + * A version of a document in Firestore. This corresponds to the version + * timestamp, such as update_time or read_time. + */ +declare class SnapshotVersion { + private timestamp; + static fromTimestamp(value: Timestamp$1): SnapshotVersion; + static min(): SnapshotVersion; + static max(): SnapshotVersion; + private constructor(); + compareTo(other: SnapshotVersion): number; + isEqual(other: SnapshotVersion): boolean; + /** Returns a number representation of the version for use in spec tests. */ + toMicroseconds(): number; + toString(): string; + toTimestamp(): Timestamp$1; +} + +/** + * @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. + */ + +/** + * @internal + */ +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; +} + +interface ApiClientObjectMap<T> { + [k: string]: T; +} +declare type Timestamp = string | { + seconds?: string | number; + nanos?: number; +}; +declare type CompositeFilterOp = 'OPERATOR_UNSPECIFIED' | 'AND' | 'OR'; +declare type FieldFilterOp = 'OPERATOR_UNSPECIFIED' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'EQUAL' | 'NOT_EQUAL' | 'ARRAY_CONTAINS' | 'IN' | 'ARRAY_CONTAINS_ANY' | 'NOT_IN'; +declare type FieldTransformSetToServerValue = 'SERVER_VALUE_UNSPECIFIED' | 'REQUEST_TIME'; +declare type IndexFieldMode = 'MODE_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING'; +declare type IndexState$1 = 'STATE_UNSPECIFIED' | 'CREATING' | 'READY' | 'ERROR'; +declare type OrderDirection = 'DIRECTION_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING'; +declare type TargetChangeTargetChangeType = 'NO_CHANGE' | 'ADD' | 'REMOVE' | 'CURRENT' | 'RESET'; +declare type UnaryFilterOp = 'OPERATOR_UNSPECIFIED' | 'IS_NAN' | 'IS_NULL' | 'IS_NOT_NAN' | 'IS_NOT_NULL'; +declare type ValueNullValue = 'NULL_VALUE'; +declare namespace firestoreV1ApiClientInterfaces { + interface ArrayValue { + values?: Value[]; + } + interface BatchGetDocumentsRequest { + database?: string; + documents?: string[]; + mask?: DocumentMask; + transaction?: string; + newTransaction?: TransactionOptions; + readTime?: string; + } + interface BatchGetDocumentsResponse { + found?: Document; + missing?: string; + transaction?: string; + readTime?: string; + } + interface BeginTransactionRequest { + options?: TransactionOptions; + } + interface BeginTransactionResponse { + transaction?: string; + } + interface CollectionSelector { + collectionId?: string; + allDescendants?: boolean; + } + interface CommitRequest { + database?: string; + writes?: Write[]; + transaction?: string; + } + interface CommitResponse { + writeResults?: WriteResult[]; + commitTime?: string; + } + interface CompositeFilter { + op?: CompositeFilterOp; + filters?: Filter[]; + } + interface Cursor { + values?: Value[]; + before?: boolean; + } + interface Document { + name?: string; + fields?: ApiClientObjectMap<Value>; + createTime?: Timestamp; + updateTime?: Timestamp; + } + interface DocumentChange { + document?: Document; + targetIds?: number[]; + removedTargetIds?: number[]; + } + interface DocumentDelete { + document?: string; + removedTargetIds?: number[]; + readTime?: Timestamp; + } + interface DocumentMask { + fieldPaths?: string[]; + } + interface DocumentRemove { + document?: string; + removedTargetIds?: number[]; + readTime?: string; + } + interface DocumentTransform { + document?: string; + fieldTransforms?: FieldTransform[]; + } + interface DocumentsTarget { + documents?: string[]; + } + interface Empty { + } + interface ExistenceFilter { + targetId?: number; + count?: number; + unchangedNames?: BloomFilter; + } + interface BloomFilter { + bits?: BitSequence; + hashCount?: number; + } + interface BitSequence { + bitmap?: string | Uint8Array; + padding?: number; + } + interface FieldFilter { + field?: FieldReference; + op?: FieldFilterOp; + value?: Value; + } + interface FieldReference { + fieldPath?: string; + } + interface FieldTransform { + fieldPath?: string; + setToServerValue?: FieldTransformSetToServerValue; + appendMissingElements?: ArrayValue; + removeAllFromArray?: ArrayValue; + increment?: Value; + } + interface Filter { + compositeFilter?: CompositeFilter; + fieldFilter?: FieldFilter; + unaryFilter?: UnaryFilter; + } + interface Index { + name?: string; + collectionId?: string; + fields?: IndexField[]; + state?: IndexState$1; + } + interface IndexField { + fieldPath?: string; + mode?: IndexFieldMode; + } + interface LatLng { + latitude?: number; + longitude?: number; + } + interface ListCollectionIdsRequest { + pageSize?: number; + pageToken?: string; + } + interface ListCollectionIdsResponse { + collectionIds?: string[]; + nextPageToken?: string; + } + interface ListDocumentsResponse { + documents?: Document[]; + nextPageToken?: string; + } + interface ListIndexesResponse { + indexes?: Index[]; + nextPageToken?: string; + } + interface ListenRequest { + addTarget?: Target; + removeTarget?: number; + labels?: ApiClientObjectMap<string>; + } + interface ListenResponse { + targetChange?: TargetChange; + documentChange?: DocumentChange; + documentDelete?: DocumentDelete; + documentRemove?: DocumentRemove; + filter?: ExistenceFilter; + } + interface MapValue { + fields?: ApiClientObjectMap<Value>; + } + interface Operation { + name?: string; + metadata?: ApiClientObjectMap<any>; + done?: boolean; + error?: Status; + response?: ApiClientObjectMap<any>; + } + interface Order { + field?: FieldReference; + direction?: OrderDirection; + } + interface Precondition { + exists?: boolean; + updateTime?: Timestamp; + } + interface Projection { + fields?: FieldReference[]; + } + interface QueryTarget { + parent?: string; + structuredQuery?: StructuredQuery; + } + interface ReadOnly { + readTime?: string; + } + interface ReadWrite { + retryTransaction?: string; + } + interface RollbackRequest { + transaction?: string; + } + interface RunQueryRequest { + parent?: string; + structuredQuery?: StructuredQuery; + transaction?: string; + newTransaction?: TransactionOptions; + readTime?: string; + } + interface RunQueryResponse { + transaction?: string; + document?: Document; + readTime?: string; + skippedResults?: number; + } + interface RunAggregationQueryRequest { + parent?: string; + structuredAggregationQuery?: StructuredAggregationQuery; + transaction?: string; + newTransaction?: TransactionOptions; + readTime?: string; + } + interface RunAggregationQueryResponse { + result?: AggregationResult; + transaction?: string; + readTime?: string; + } + interface AggregationResult { + aggregateFields?: ApiClientObjectMap<Value>; + } + interface StructuredAggregationQuery { + structuredQuery?: StructuredQuery; + aggregations?: Aggregation[]; + } + interface Aggregation { + count?: Count; + sum?: Sum; + avg?: Avg; + alias?: string; + } + interface Count { + upTo?: number; + } + interface Sum { + field?: FieldReference; + } + interface Avg { + field?: FieldReference; + } + interface Status { + code?: number; + message?: string; + details?: Array<ApiClientObjectMap<any>>; + } + interface StructuredQuery { + select?: Projection; + from?: CollectionSelector[]; + where?: Filter; + orderBy?: Order[]; + startAt?: Cursor; + endAt?: Cursor; + offset?: number; + limit?: number | { + value: number; + }; + } + interface Target { + query?: QueryTarget; + documents?: DocumentsTarget; + resumeToken?: string | Uint8Array; + readTime?: Timestamp; + targetId?: number; + once?: boolean; + expectedCount?: number | { + value: number; + }; + } + interface TargetChange { + targetChangeType?: TargetChangeTargetChangeType; + targetIds?: number[]; + cause?: Status; + resumeToken?: string | Uint8Array; + readTime?: Timestamp; + } + interface TransactionOptions { + readOnly?: ReadOnly; + readWrite?: ReadWrite; + } + interface UnaryFilter { + op?: UnaryFilterOp; + field?: FieldReference; + } + interface Value { + nullValue?: ValueNullValue; + booleanValue?: boolean; + integerValue?: string | number; + doubleValue?: string | number; + timestampValue?: Timestamp; + stringValue?: string; + bytesValue?: string | Uint8Array; + referenceValue?: string; + geoPointValue?: LatLng; + arrayValue?: ArrayValue; + mapValue?: MapValue; + } + interface Write { + update?: Document; + delete?: string; + verify?: string; + transform?: DocumentTransform; + updateMask?: DocumentMask; + updateTransforms?: FieldTransform[]; + currentDocument?: Precondition; + } + interface WriteRequest { + streamId?: string; + writes?: Write[]; + streamToken?: string | Uint8Array; + labels?: ApiClientObjectMap<string>; + } + interface WriteResponse { + streamId?: string; + streamToken?: string | Uint8Array; + writeResults?: WriteResult[]; + commitTime?: Timestamp; + } + interface WriteResult { + updateTime?: Timestamp; + transformResults?: Value[]; + } +} +declare type MapValue = firestoreV1ApiClientInterfaces.MapValue; +declare type StructuredQuery = firestoreV1ApiClientInterfaces.StructuredQuery; +declare type Value = firestoreV1ApiClientInterfaces.Value; + +/** + * @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. + */ + +/** + * 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 + */ +declare class FieldMask { + readonly fields: FieldPath$2[]; + constructor(fields: FieldPath$2[]); + 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$2[]): 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$2): boolean; + isEqual(other: FieldMask): boolean; +} + +/** + * @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. + */ + +/** + * An ObjectValue represents a MapValue in the Firestore Proto and offers the + * ability to add and remove fields (via the ObjectValueBuilder). + */ +declare class ObjectValue { + readonly value: { + mapValue: MapValue; + }; + constructor(value: { + mapValue: MapValue; + }); + 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$2): Value | null; + /** + * Sets the field to the provided value. + * + * @param path - The field path to set. + * @param value - The value to set. + */ + set(path: FieldPath$2, value: Value): 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$2, Value | 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$2): 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; +} + +/** + * @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. + */ + +/** + * Represents a document in Firestore with a key, version, data and whether the + * data has local mutations applied to it. + */ +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. + */ +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; +} + +/** + * @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. + */ + +declare const enum Operator { + LESS_THAN = "<", + LESS_THAN_OR_EQUAL = "<=", + EQUAL = "==", + NOT_EQUAL = "!=", + GREATER_THAN = ">", + GREATER_THAN_OR_EQUAL = ">=", + ARRAY_CONTAINS = "array-contains", + IN = "in", + NOT_IN = "not-in", + ARRAY_CONTAINS_ANY = "array-contains-any" +} +declare const enum CompositeOperator { + OR = "or", + AND = "and" +} +declare abstract class Filter { + abstract matches(doc: Document): boolean; + abstract getFlattenedFilters(): readonly FieldFilter[]; + abstract getFilters(): Filter[]; +} +declare class FieldFilter extends Filter { + readonly field: FieldPath$2; + readonly op: Operator; + readonly value: Value; + protected constructor(field: FieldPath$2, op: Operator, value: Value); + /** + * Creates a filter based on the provided arguments. + */ + static create(field: FieldPath$2, op: Operator, value: Value): FieldFilter; + private static createKeyFieldInFilter; + matches(doc: Document): boolean; + protected matchesComparison(comparison: number): boolean; + isInequality(): boolean; + getFlattenedFilters(): readonly FieldFilter[]; + getFilters(): Filter[]; +} + +/** + * @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. + */ + +/** + * The direction of sorting in an order by. + */ +declare const enum Direction { + ASCENDING = "asc", + DESCENDING = "desc" +} +/** + * An ordering on a field, in some Direction. Direction defaults to ASCENDING. + */ +declare class OrderBy { + readonly field: FieldPath$2; + readonly dir: Direction; + constructor(field: FieldPath$2, dir?: Direction); +} + +/** + * @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. + */ +type Comparator<K> = (key1: K, key2: K) => number; +interface Entry<K, V> { + key: K; + value: V; +} +declare class SortedMap<K, V> { + comparator: Comparator<K>; + root: LLRBNode<K, V> | LLRBEmptyNode<K, V>; + constructor(comparator: Comparator<K>, root?: LLRBNode<K, V> | LLRBEmptyNode<K, V>); + insert(key: K, value: V): SortedMap<K, V>; + remove(key: K): SortedMap<K, V>; + get(key: K): V | null; + indexOf(key: K): number; + isEmpty(): boolean; + get size(): number; + minKey(): K | null; + maxKey(): K | null; + inorderTraversal<T>(action: (k: K, v: V) => T): T; + forEach(fn: (k: K, v: V) => void): void; + toString(): string; + reverseTraversal<T>(action: (k: K, v: V) => T): T; + getIterator(): SortedMapIterator<K, V>; + getIteratorFrom(key: K): SortedMapIterator<K, V>; + getReverseIterator(): SortedMapIterator<K, V>; + getReverseIteratorFrom(key: K): SortedMapIterator<K, V>; +} +declare class SortedMapIterator<K, V> { + private isReverse; + private nodeStack; + constructor(node: LLRBNode<K, V> | LLRBEmptyNode<K, V>, startKey: K | null, comparator: Comparator<K>, isReverse: boolean); + getNext(): Entry<K, V>; + hasNext(): boolean; + peek(): Entry<K, V> | null; +} +declare class LLRBNode<K, V> { + key: K; + value: V; + readonly color: boolean; + readonly left: LLRBNode<K, V> | LLRBEmptyNode<K, V>; + readonly right: LLRBNode<K, V> | LLRBEmptyNode<K, V>; + readonly size: number; + static EMPTY: LLRBEmptyNode<any, any>; + static RED: boolean; + static BLACK: boolean; + constructor(key: K, value: V, color?: boolean, left?: LLRBNode<K, V> | LLRBEmptyNode<K, V>, right?: LLRBNode<K, V> | LLRBEmptyNode<K, V>); + copy(key: K | null, value: V | null, color: boolean | null, left: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null, right: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null): LLRBNode<K, V>; + isEmpty(): boolean; + inorderTraversal<T>(action: (k: K, v: V) => T): T; + reverseTraversal<T>(action: (k: K, v: V) => T): T; + private min; + minKey(): K | null; + maxKey(): K | null; + insert(key: K, value: V, comparator: Comparator<K>): LLRBNode<K, V>; + private removeMin; + remove(key: K, comparator: Comparator<K>): LLRBNode<K, V> | LLRBEmptyNode<K, V>; + isRed(): boolean; + private fixUp; + private moveRedLeft; + private moveRedRight; + private rotateLeft; + private rotateRight; + private colorFlip; + checkMaxDepth(): boolean; + protected check(): number; +} +declare class LLRBEmptyNode<K, V> { + get key(): never; + get value(): never; + get color(): never; + get left(): never; + get right(): never; + size: number; + copy(key: K | null, value: V | null, color: boolean | null, left: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null, right: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null): LLRBEmptyNode<K, V>; + insert(key: K, value: V, comparator: Comparator<K>): LLRBNode<K, V>; + remove(key: K, comparator: Comparator<K>): LLRBEmptyNode<K, V>; + isEmpty(): boolean; + inorderTraversal(action: (k: K, v: V) => boolean): boolean; + reverseTraversal(action: (k: K, v: V) => boolean): boolean; + minKey(): K | null; + maxKey(): K | null; + isRed(): boolean; + checkMaxDepth(): boolean; + protected check(): 0; +} + +/** + * @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. + */ + +/** + * SortedSet is an immutable (copy-on-write) collection that holds elements + * in order specified by the provided comparator. + * + * NOTE: if provided comparator returns 0 for two elements, we consider them to + * be equal! + */ +declare class SortedSet<T> { + private comparator; + private data; + constructor(comparator: (left: T, right: T) => number); + has(elem: T): boolean; + first(): T | null; + last(): T | null; + get size(): number; + indexOf(elem: T): number; + /** Iterates elements in order defined by "comparator" */ + forEach(cb: (elem: T) => void): void; + /** Iterates over `elem`s such that: range[0] <= elem < range[1]. */ + forEachInRange(range: [T, T], cb: (elem: T) => void): void; + /** + * Iterates over `elem`s such that: start <= elem until false is returned. + */ + forEachWhile(cb: (elem: T) => boolean, start?: T): void; + /** Finds the least element greater than or equal to `elem`. */ + firstAfterOrEqual(elem: T): T | null; + getIterator(): SortedSetIterator<T>; + getIteratorFrom(key: T): SortedSetIterator<T>; + /** Inserts or updates an element */ + add(elem: T): SortedSet<T>; + /** Deletes an element */ + delete(elem: T): SortedSet<T>; + isEmpty(): boolean; + unionWith(other: SortedSet<T>): SortedSet<T>; + isEqual(other: SortedSet<T>): boolean; + toArray(): T[]; + toString(): string; + private copy; +} +declare class SortedSetIterator<T> { + private iter; + constructor(iter: SortedMapIterator<T, boolean>); + getNext(): T; + hasNext(): boolean; +} + +/** + * @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. + */ + +/** + * Represents a bound of a query. + * + * The bound is specified with the given components representing a position and + * whether it's just before or just after the position (relative to whatever the + * query order is). + * + * The position represents a logical index position for a query. It's a prefix + * of values for the (potentially implicit) order by clauses of a query. + * + * Bound provides a function to determine whether a document comes before or + * after a bound. This is influenced by whether the position is just before or + * just after the provided values. + */ +declare class Bound { + readonly position: Value[]; + readonly inclusive: boolean; + constructor(position: Value[], inclusive: boolean); +} + +/** + * @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. + */ + +/** + * 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. + */ +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); +} +/** The type of the index, e.g. for which type of query it can be used. */ +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. */ +declare class IndexSegment { + /** The field path of the component. */ + readonly fieldPath: FieldPath$2; + /** The fields sorting order. */ + readonly kind: IndexKind; + constructor( + /** The field path of the component. */ + fieldPath: FieldPath$2, + /** The fields sorting order. */ + kind: IndexKind); +} +/** + * Stores the "high water mark" that indicates how updated the Index is for the + * current user. + */ +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; +} +/** + * Stores the latest read time, document and batch ID that were processed for an + * index. + */ +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; +} + +/** + * @license + * Copyright 2019 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. + */ + +/** + * A Target represents the WatchTarget representation of a Query, which is used + * by the LocalStore and the RemoteStore to keep track of and to execute + * backend queries. While a Query can represent multiple Targets, each Targets + * maps to a single WatchTarget in RemoteStore and a single TargetData entry + * in persistence. + */ +interface Target { + readonly path: ResourcePath; + readonly collectionGroup: string | null; + readonly orderBy: OrderBy[]; + readonly filters: Filter[]; + readonly limit: number | null; + readonly startAt: Bound | null; + readonly endAt: Bound | null; +} + +/** + * @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. + */ + +declare const enum LimitType$1 { + First = "F", + Last = "L" +} +/** + * The Query interface defines all external properties of a query. + * + * QueryImpl implements this interface to provide memoization for `queryNormalizedOrderBy` + * and `queryToTarget`. + */ +interface Query$2 { + readonly path: ResourcePath; + readonly collectionGroup: string | null; + readonly explicitOrderBy: OrderBy[]; + readonly filters: Filter[]; + readonly limit: number | null; + readonly limitType: LimitType$1; + readonly startAt: Bound | null; + readonly endAt: Bound | null; +} + +/** + * @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. + */ +/** + * Immutable class that represents a "proto" byte string. + * + * Proto byte strings can either be Base64-encoded strings or Uint8Arrays when + * sent on the wire. This class abstracts away this differentiation by holding + * the proto byte string in a common class that must be converted into a string + * before being sent as a proto. + * @internal + */ +declare class ByteString { + private readonly binaryString; + static readonly EMPTY_BYTE_STRING: ByteString; + private constructor(); + static fromBase64String(base64: string): ByteString; + static fromUint8Array(array: Uint8Array): ByteString; + [Symbol.iterator](): Iterator<number>; + toBase64(): string; + toUint8Array(): Uint8Array; + approximateByteSize(): number; + compareTo(other: ByteString): number; + isEqual(other: ByteString): boolean; +} + +/** + * @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. + */ + +/** An enumeration of the different purposes we have for targets. */ +declare const enum TargetPurpose { + /** A regular, normal query target. */ + Listen = "TargetPurposeListen", + /** + * The query target was used to refill a query after an existence filter + * mismatch. + */ + ExistenceFilterMismatch = "TargetPurposeExistenceFilterMismatch", + /** + * The query target was used if the query is the result of a false positive in + * the bloom filter. + */ + ExistenceFilterMismatchBloom = "TargetPurposeExistenceFilterMismatchBloom", + /** The query target was used to resolve a limbo document. */ + LimboResolution = "TargetPurposeLimboResolution" +} +/** + * An immutable set of metadata that the local store tracks for each target. + */ +declare class TargetData { + /** The target being listened to. */ + readonly target: Target; + /** + * The target ID to which the target corresponds; Assigned by the + * LocalStore for user listens and by the SyncEngine for limbo watches. + */ + readonly targetId: TargetId; + /** The purpose of the target. */ + readonly purpose: TargetPurpose; + /** + * The sequence number of the last transaction during which this target data + * was modified. + */ + readonly sequenceNumber: ListenSequenceNumber; + /** The latest snapshot version seen for this target. */ + readonly snapshotVersion: SnapshotVersion; + /** + * The maximum snapshot version at which the associated view + * contained no limbo documents. + */ + readonly lastLimboFreeSnapshotVersion: SnapshotVersion; + /** + * An opaque, server-assigned token that allows watching a target to be + * resumed after disconnecting without retransmitting all the data that + * matches the target. The resume token essentially identifies a point in + * time from which the server should resume sending results. + */ + readonly resumeToken: ByteString; + /** + * The number of documents that last matched the query at the resume token or + * read time. Documents are counted only when making a listen request with + * resume token or read time, otherwise, keep it null. + */ + readonly expectedCount: number | null; + constructor( + /** The target being listened to. */ + target: Target, + /** + * The target ID to which the target corresponds; Assigned by the + * LocalStore for user listens and by the SyncEngine for limbo watches. + */ + targetId: TargetId, + /** The purpose of the target. */ + purpose: TargetPurpose, + /** + * The sequence number of the last transaction during which this target data + * was modified. + */ + sequenceNumber: ListenSequenceNumber, + /** The latest snapshot version seen for this target. */ + snapshotVersion?: SnapshotVersion, + /** + * The maximum snapshot version at which the associated view + * contained no limbo documents. + */ + lastLimboFreeSnapshotVersion?: SnapshotVersion, + /** + * An opaque, server-assigned token that allows watching a target to be + * resumed after disconnecting without retransmitting all the data that + * matches the target. The resume token essentially identifies a point in + * time from which the server should resume sending results. + */ + resumeToken?: ByteString, + /** + * The number of documents that last matched the query at the resume token or + * read time. Documents are counted only when making a listen request with + * resume token or read time, otherwise, keep it null. + */ + expectedCount?: number | null); + /** Creates a new target data instance with an updated sequence number. */ + withSequenceNumber(sequenceNumber: number): TargetData; + /** + * Creates a new target data instance with an updated resume token and + * snapshot version. + */ + withResumeToken(resumeToken: ByteString, snapshotVersion: SnapshotVersion): TargetData; + /** + * Creates a new target data instance with an updated expected count. + */ + withExpectedCount(expectedCount: number): TargetData; + /** + * Creates a new target data instance with an updated last limbo free + * snapshot version number. + */ + withLastLimboFreeSnapshotVersion(lastLimboFreeSnapshotVersion: SnapshotVersion): TargetData; +} + +/** + * @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. + */ + +/** Base interface for the Serializer implementation. */ +interface Serializer { + readonly useProto3Json: boolean; +} + +/** + * @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. + */ + +/** Used to represent a field transform on a mutation. */ +declare class TransformOperation { + private _; +} + +/** + * @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. + */ + +/** A field path and the TransformOperation to perform upon it. */ +declare class FieldTransform { + readonly field: FieldPath$2; + readonly transform: TransformOperation; + constructor(field: FieldPath$2, transform: TransformOperation); +} +/** The result of successfully applying a mutation to the backend. */ +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<Value | 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<Value | null>); +} +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). + */ +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; +} +/** + * 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). + */ +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; +} + +/** + * @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. + */ + +/** + * Represents a local view (overlay) of a document, and the fields that are + * locally mutated. + */ +declare class OverlayedDocument { + readonly overlayedDocument: Document; + /** + * The fields that are locally mutated by patch mutations. + * + * If the overlayed document is from set or delete mutations, this is `null`. + * If there is no overlay (mutation) for the document, this is an empty `FieldMask`. + */ + readonly mutatedFields: FieldMask | null; + constructor(overlayedDocument: Document, + /** + * The fields that are locally mutated by patch mutations. + * + * If the overlayed document is from set or delete mutations, this is `null`. + * If there is no overlay (mutation) for the document, this is an empty `FieldMask`. + */ + mutatedFields: FieldMask | null); +} + +/** + * @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. + */ +/** + * A map implementation that uses objects as keys. Objects must have an + * associated equals function and must be immutable. Entries in the map are + * stored together with the key being produced from the mapKeyFn. This map + * automatically handles collisions of keys. + */ +declare class ObjectMap<KeyType, ValueType> { + private mapKeyFn; + private equalsFn; + /** + * The inner map for a key/value pair. Due to the possibility of collisions we + * keep a list of entries that we do a linear search through to find an actual + * match. Note that collisions should be rare, so we still expect near + * constant time lookups in practice. + */ + private inner; + /** The number of entries stored in the map */ + private innerSize; + constructor(mapKeyFn: (key: KeyType) => string, equalsFn: (l: KeyType, r: KeyType) => boolean); + /** Get a value for this key, or undefined if it does not exist. */ + get(key: KeyType): ValueType | undefined; + has(key: KeyType): boolean; + /** Put this key and value in the map. */ + set(key: KeyType, value: ValueType): void; + /** + * Remove this key from the map. Returns a boolean if anything was deleted. + */ + delete(key: KeyType): boolean; + forEach(fn: (key: KeyType, val: ValueType) => void): void; + isEmpty(): boolean; + size(): number; +} + +/** + * @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. + */ + +/** + * Representation of an overlay computed by Firestore. + * + * Holds information about a mutation and the largest batch id in Firestore when + * the mutation was created. + */ +declare class Overlay { + readonly largestBatchId: number; + readonly mutation: Mutation; + constructor(largestBatchId: number, mutation: Mutation); + getKey(): DocumentKey; + isEqual(other: Overlay | null): boolean; + toString(): string; +} + +/** + * @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. + */ + +/** Miscellaneous collection types / constants. */ +type MutableDocumentMap = SortedMap<DocumentKey, MutableDocument>; +type DocumentMap = SortedMap<DocumentKey, Document>; +type OverlayedDocumentMap = DocumentKeyMap<OverlayedDocument>; +type OverlayMap = DocumentKeyMap<Overlay>; +type MutationMap = DocumentKeyMap<Mutation>; +type DocumentKeyMap<T> = ObjectMap<DocumentKey, T>; +type DocumentVersionMap = SortedMap<DocumentKey, SnapshotVersion>; +type DocumentKeySet = SortedSet<DocumentKey>; + +/** + * @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. + */ + +/** + * An event from the RemoteStore. It is split into targetChanges (changes to the + * state or the set of documents in our watched targets) and documentUpdates + * (changes to the actual documents). + */ +declare class RemoteEvent { + /** + * The snapshot version this event brings us up to, or MIN if not set. + */ + readonly snapshotVersion: SnapshotVersion; + /** + * A map from target to changes to the target. See TargetChange. + */ + readonly targetChanges: Map<TargetId, TargetChange>; + /** + * A map of targets that is known to be inconsistent, and the purpose for + * re-listening. Listens for these targets should be re-established without + * resume tokens. + */ + readonly targetMismatches: SortedMap<TargetId, TargetPurpose>; + /** + * A set of which documents have changed or been deleted, along with the + * doc's new values (if not deleted). + */ + readonly documentUpdates: MutableDocumentMap; + /** + * A set of which document updates are due only to limbo resolution targets. + */ + readonly resolvedLimboDocuments: DocumentKeySet; + constructor( + /** + * The snapshot version this event brings us up to, or MIN if not set. + */ + snapshotVersion: SnapshotVersion, + /** + * A map from target to changes to the target. See TargetChange. + */ + targetChanges: Map<TargetId, TargetChange>, + /** + * A map of targets that is known to be inconsistent, and the purpose for + * re-listening. Listens for these targets should be re-established without + * resume tokens. + */ + targetMismatches: SortedMap<TargetId, TargetPurpose>, + /** + * A set of which documents have changed or been deleted, along with the + * doc's new values (if not deleted). + */ + documentUpdates: MutableDocumentMap, + /** + * A set of which document updates are due only to limbo resolution targets. + */ + resolvedLimboDocuments: DocumentKeySet); + /** + * HACK: Views require RemoteEvents in order to determine whether the view is + * CURRENT, but secondary tabs don't receive remote events. So this method is + * used to create a synthesized RemoteEvent that can be used to apply a + * CURRENT status change to a View, for queries executed in a different tab. + */ + static createSynthesizedRemoteEventForCurrentChange(targetId: TargetId, current: boolean, resumeToken: ByteString): RemoteEvent; +} +/** + * A TargetChange specifies the set of changes for a specific target as part of + * a RemoteEvent. These changes track which documents are added, modified or + * removed, as well as the target's resume token and whether the target is + * marked CURRENT. + * The actual changes *to* documents are not part of the TargetChange since + * documents may be part of multiple targets. + */ +declare class TargetChange { + /** + * An opaque, server-assigned token that allows watching a query to be resumed + * after disconnecting without retransmitting all the data that matches the + * query. The resume token essentially identifies a point in time from which + * the server should resume sending results. + */ + readonly resumeToken: ByteString; + /** + * The "current" (synced) status of this target. Note that "current" + * has special meaning in the RPC protocol that implies that a target is + * both up-to-date and consistent with the rest of the watch stream. + */ + readonly current: boolean; + /** + * The set of documents that were newly assigned to this target as part of + * this remote event. + */ + readonly addedDocuments: DocumentKeySet; + /** + * The set of documents that were already assigned to this target but received + * an update during this remote event. + */ + readonly modifiedDocuments: DocumentKeySet; + /** + * The set of documents that were removed from this target as part of this + * remote event. + */ + readonly removedDocuments: DocumentKeySet; + constructor( + /** + * An opaque, server-assigned token that allows watching a query to be resumed + * after disconnecting without retransmitting all the data that matches the + * query. The resume token essentially identifies a point in time from which + * the server should resume sending results. + */ + resumeToken: ByteString, + /** + * The "current" (synced) status of this target. Note that "current" + * has special meaning in the RPC protocol that implies that a target is + * both up-to-date and consistent with the rest of the watch stream. + */ + current: boolean, + /** + * The set of documents that were newly assigned to this target as part of + * this remote event. + */ + addedDocuments: DocumentKeySet, + /** + * The set of documents that were already assigned to this target but received + * an update during this remote event. + */ + modifiedDocuments: DocumentKeySet, + /** + * The set of documents that were removed from this target as part of this + * remote event. + */ + removedDocuments: DocumentKeySet); + /** + * This method is used to create a synthesized TargetChanges that can be used to + * apply a CURRENT status change to a View (for queries executed in a different + * tab) or for new queries (to raise snapshots with correct CURRENT status). + */ + static createSynthesizedTargetChangeForCurrentChange(targetId: TargetId, current: boolean, resumeToken: ByteString): TargetChange; +} + +/** + * @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. + */ + +/** + * This class generates JsonObject values for the Datastore API suitable for + * sending to either GRPC stub methods or via the JSON/HTTP REST API. + * + * The serializer supports both Protobuf.js and Proto3 JSON formats. By + * setting `useProto3Json` to true, the serializer will use the Proto3 JSON + * format. + * + * For a description of the Proto3 JSON format check + * https://developers.google.com/protocol-buffers/docs/proto3#json + * + * TODO(klimt): We can remove the databaseId argument if we keep the full + * resource name in documents. + */ +declare class JsonProtoSerializer implements Serializer { + readonly databaseId: DatabaseId; + readonly useProto3Json: boolean; + constructor(databaseId: DatabaseId, useProto3Json: boolean); +} + +/** + * @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. + */ + + +type DocumentData$1 = { [field: string]: any }; + +type UpdateData$1 = { [fieldPath: string]: any }; + +interface Settings { + host?: string; + ssl?: boolean; + cacheSizeBytes?: number; + experimentalForceLongPolling?: boolean; + experimentalAutoDetectLongPolling?: boolean; + ignoreUndefinedProperties?: boolean; + merge?: boolean; +} + +interface PersistenceSettings$1 { + synchronizeTabs?: boolean; + experimentalTabSynchronization?: boolean; + experimentalForceOwningTab?: boolean; +} + +interface FirestoreDataConverter$2<T> { + toFirestore(modelObject: T): DocumentData$1; + toFirestore(modelObject: Partial<T>, options: SetOptions$1): DocumentData$1; + + fromFirestore(snapshot: QueryDocumentSnapshot$2, options: SnapshotOptions$1): T; +} + +declare class FirebaseFirestore { + private constructor(); + + settings(settings: Settings): void; + + useEmulator( + host: string, + port: number, + options?: { + mockUserToken?: EmulatorMockTokenOptions | string; + } + ): void; + + enablePersistence(settings?: PersistenceSettings$1): Promise<void>; + + collection(collectionPath: string): CollectionReference$1<DocumentData$1>; + + doc(documentPath: string): DocumentReference$1<DocumentData$1>; + + collectionGroup(collectionId: string): Query$1<DocumentData$1>; + + runTransaction<T>( + updateFunction: (transaction: Transaction$3) => Promise<T> + ): Promise<T>; + + batch(): WriteBatch$1; + + app: any; + + clearPersistence(): Promise<void>; + + enableNetwork(): Promise<void>; + + disableNetwork(): Promise<void>; + + waitForPendingWrites(): Promise<void>; + + onSnapshotsInSync(observer: { + next?: (value: void) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; + }): () => void; + onSnapshotsInSync(onSync: () => void): () => void; + + terminate(): Promise<void>; + + loadBundle( + bundleData: ArrayBuffer | ReadableStream<Uint8Array> | string + ): LoadBundleTask$1; + + namedQuery(name: string): Promise<Query$1<DocumentData$1> | null>; + + INTERNAL: { delete: () => Promise<void> }; +} + +interface LoadBundleTask$1 extends PromiseLike<LoadBundleTaskProgress$1> { + onProgress( + next?: (progress: LoadBundleTaskProgress$1) => any, + error?: (error: Error) => any, + complete?: () => void + ): void; + + then<T, R>( + onFulfilled?: (a: LoadBundleTaskProgress$1) => T | PromiseLike<T>, + onRejected?: (a: Error) => R | PromiseLike<R> + ): Promise<T | R>; + + catch<R>( + onRejected: (a: Error) => R | PromiseLike<R> + ): Promise<R | LoadBundleTaskProgress$1>; +} + +interface LoadBundleTaskProgress$1 { + documentsLoaded: number; + totalDocuments: number; + bytesLoaded: number; + totalBytes: number; + taskState: TaskState$1; +} + +type TaskState$1 = 'Error' | 'Running' | 'Success'; + +declare class Transaction$3 { + private constructor(); + + get<T>(documentRef: DocumentReference$1<T>): Promise<DocumentSnapshot$2<T>>; + + set<T>( + documentRef: DocumentReference$1<T>, + data: Partial<T>, + options: SetOptions$1 + ): Transaction$3; + set<T>(documentRef: DocumentReference$1<T>, data: T): Transaction$3; + + update(documentRef: DocumentReference$1<any>, data: UpdateData$1): Transaction$3; + update( + documentRef: DocumentReference$1<any>, + field: string | FieldPath$1, + value: any, + ...moreFieldsAndValues: any[] + ): Transaction$3; + + delete(documentRef: DocumentReference$1<any>): Transaction$3; +} + +declare class WriteBatch$1 { + private constructor(); + + set<T>( + documentRef: DocumentReference$1<T>, + data: Partial<T>, + options: SetOptions$1 + ): WriteBatch$1; + set<T>(documentRef: DocumentReference$1<T>, data: T): WriteBatch$1; + + update(documentRef: DocumentReference$1<any>, data: UpdateData$1): WriteBatch$1; + update( + documentRef: DocumentReference$1<any>, + field: string | FieldPath$1, + value: any, + ...moreFieldsAndValues: any[] + ): WriteBatch$1; + + delete(documentRef: DocumentReference$1<any>): WriteBatch$1; + + commit(): Promise<void>; +} + +interface SnapshotListenOptions$1 { + readonly includeMetadataChanges?: boolean; +} + +interface SetOptions$1 { + readonly merge?: boolean; + readonly mergeFields?: (string | FieldPath$1)[]; +} + +interface GetOptions { + readonly source?: 'default' | 'server' | 'cache'; +} + +declare class DocumentReference$1< + T = DocumentData$1, + T2 extends DocumentData$1 = DocumentData$1 +> { + private constructor(); + + readonly id: string; + readonly firestore: FirebaseFirestore; + readonly parent: CollectionReference$1<T>; + readonly path: string; + + collection(collectionPath: string): CollectionReference$1<DocumentData$1>; + + isEqual(other: DocumentReference$1<T>): boolean; + + set(data: Partial<T>, options: SetOptions$1): Promise<void>; + set(data: T): Promise<void>; + + update(data: UpdateData$1): Promise<void>; + update( + field: string | FieldPath$1, + value: any, + ...moreFieldsAndValues: any[] + ): Promise<void>; + + delete(): Promise<void>; + + get(options?: GetOptions): Promise<DocumentSnapshot$2<T>>; + + onSnapshot(observer: { + next?: (snapshot: DocumentSnapshot$2<T>) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; + }): () => void; + onSnapshot( + options: SnapshotListenOptions$1, + observer: { + next?: (snapshot: DocumentSnapshot$2<T>) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; + } + ): () => void; + onSnapshot( + onNext: (snapshot: DocumentSnapshot$2<T>) => void, + onError?: (error: FirestoreError) => void, + onCompletion?: () => void + ): () => void; + onSnapshot( + options: SnapshotListenOptions$1, + onNext: (snapshot: DocumentSnapshot$2<T>) => void, + onError?: (error: FirestoreError) => void, + onCompletion?: () => void + ): () => void; + + withConverter(converter: null): DocumentReference$1<DocumentData$1>; + withConverter<U>(converter: FirestoreDataConverter$2<U>): DocumentReference$1<U>; +} + +interface SnapshotOptions$1 { + readonly serverTimestamps?: 'estimate' | 'previous' | 'none'; +} + +interface SnapshotMetadata$1 { + readonly hasPendingWrites: boolean; + readonly fromCache: boolean; + + isEqual(other: SnapshotMetadata$1): boolean; +} + +declare class DocumentSnapshot$2< + T = DocumentData$1, + T2 extends DocumentData$1 = DocumentData$1 +> { + protected constructor(); + + readonly exists: boolean; + readonly ref: DocumentReference$1<T>; + readonly id: string; + readonly metadata: SnapshotMetadata$1; + + data(options?: SnapshotOptions$1): T | undefined; + + get(fieldPath: string | FieldPath$1, options?: SnapshotOptions$1): any; + + isEqual(other: DocumentSnapshot$2<T>): boolean; +} + +declare class QueryDocumentSnapshot$2< + T = DocumentData$1, + T2 extends DocumentData$1 = DocumentData$1 +> extends DocumentSnapshot$2<T, T2> { + private constructor(); + + data(options?: SnapshotOptions$1): T; +} + +type OrderByDirection$1 = 'desc' | 'asc'; + +type WhereFilterOp$1 = + | '<' + | '<=' + | '==' + | '!=' + | '>=' + | '>' + | 'array-contains' + | 'in' + | 'array-contains-any' + | 'not-in'; + +declare class Query$1<T = DocumentData$1, T2 extends DocumentData$1 = DocumentData$1> { + protected constructor(); + + readonly firestore: FirebaseFirestore; + + where( + fieldPath: string | FieldPath$1, + opStr: WhereFilterOp$1, + value: any + ): Query$1<T>; + + orderBy( + fieldPath: string | FieldPath$1, + directionStr?: OrderByDirection$1 + ): Query$1<T>; + + limit(limit: number): Query$1<T>; + + limitToLast(limit: number): Query$1<T>; + + startAt(snapshot: DocumentSnapshot$2<any>): Query$1<T>; + startAt(...fieldValues: any[]): Query$1<T>; + + startAfter(snapshot: DocumentSnapshot$2<any>): Query$1<T>; + startAfter(...fieldValues: any[]): Query$1<T>; + + endBefore(snapshot: DocumentSnapshot$2<any>): Query$1<T>; + endBefore(...fieldValues: any[]): Query$1<T>; + + endAt(snapshot: DocumentSnapshot$2<any>): Query$1<T>; + endAt(...fieldValues: any[]): Query$1<T>; + + isEqual(other: Query$1<T>): boolean; + + get(options?: GetOptions): Promise<QuerySnapshot$1<T>>; + + onSnapshot(observer: { + next?: (snapshot: QuerySnapshot$1<T>) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; + }): () => void; + onSnapshot( + options: SnapshotListenOptions$1, + observer: { + next?: (snapshot: QuerySnapshot$1<T>) => void; + error?: (error: FirestoreError) => void; + complete?: () => void; + } + ): () => void; + onSnapshot( + onNext: (snapshot: QuerySnapshot$1<T>) => void, + onError?: (error: FirestoreError) => void, + onCompletion?: () => void + ): () => void; + onSnapshot( + options: SnapshotListenOptions$1, + onNext: (snapshot: QuerySnapshot$1<T>) => void, + onError?: (error: FirestoreError) => void, + onCompletion?: () => void + ): () => void; + + withConverter(converter: null): Query$1<DocumentData$1>; + withConverter<U>(converter: FirestoreDataConverter$2<U>): Query$1<U>; +} + +declare class QuerySnapshot$1< + T = DocumentData$1, + T2 extends DocumentData$1 = DocumentData$1 +> { + private constructor(); + + readonly query: Query$1<T>; + readonly metadata: SnapshotMetadata$1; + readonly docs: Array<QueryDocumentSnapshot$2<T>>; + readonly size: number; + readonly empty: boolean; + + docChanges(options?: SnapshotListenOptions$1): Array<DocumentChange$1<T>>; + + forEach( + callback: (result: QueryDocumentSnapshot$2<T>) => void, + thisArg?: any + ): void; + + isEqual(other: QuerySnapshot$1<T>): boolean; +} + +type DocumentChangeType$1 = 'added' | 'removed' | 'modified'; + +interface DocumentChange$1< + T = DocumentData$1, + T2 extends DocumentData$1 = DocumentData$1 +> { + readonly type: DocumentChangeType$1; + readonly doc: QueryDocumentSnapshot$2<T>; + readonly oldIndex: number; + readonly newIndex: number; +} + +declare class CollectionReference$1< + T = DocumentData$1, + T2 extends DocumentData$1 = DocumentData$1 +> extends Query$1<T, T2> { + private constructor(); + + readonly id: string; + readonly parent: DocumentReference$1<DocumentData$1> | null; + readonly path: string; + + doc(documentPath?: string): DocumentReference$1<T>; + + add(data: T): Promise<DocumentReference$1<T>>; + + isEqual(other: CollectionReference$1<T>): boolean; + + withConverter(converter: null): CollectionReference$1<DocumentData$1>; + withConverter<U>( + converter: FirestoreDataConverter$2<U> + ): CollectionReference$1<U>; +} + +declare class FieldPath$1 { + constructor(...fieldNames: string[]); + + static documentId(): FieldPath$1; + + isEqual(other: FieldPath$1): boolean; +} + +type FirestoreErrorCode = + | 'cancelled' + | 'unknown' + | 'invalid-argument' + | 'deadline-exceeded' + | 'not-found' + | 'already-exists' + | 'permission-denied' + | 'resource-exhausted' + | 'failed-precondition' + | 'aborted' + | 'out-of-range' + | 'unimplemented' + | 'internal' + | 'unavailable' + | 'data-loss' + | 'unauthenticated'; + +interface FirestoreError { + code: FirestoreErrorCode; + message: string; + name: string; + stack?: string; +} + +declare module '@firebase/component' { + interface NameServiceMapping { + 'firestore-compat': FirebaseFirestore; + } +} + +/** + * @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. + */ + +/** Properties of a BundledQuery. */ +interface BundledQuery { + /** BundledQuery parent */ + parent?: string | null; + /** BundledQuery structuredQuery */ + structuredQuery?: StructuredQuery | null; + /** BundledQuery limitType */ + limitType?: LimitType | null; +} +/** LimitType enum. */ +type LimitType = 'FIRST' | 'LAST'; +/** Properties of a NamedQuery. */ +interface NamedQuery$1 { + /** NamedQuery name */ + name?: string | null; + /** NamedQuery bundledQuery */ + bundledQuery?: BundledQuery | null; + /** NamedQuery readTime */ + readTime?: Timestamp | null; +} +/** Properties of a BundleMetadata. */ +interface BundleMetadata$1 { + /** BundleMetadata id */ + id?: string | null; + /** BundleMetadata createTime */ + createTime?: Timestamp | null; + /** BundleMetadata version */ + version?: number | null; + /** BundleMetadata totalDocuments */ + totalDocuments?: number | null; + /** BundleMetadata totalBytes */ + totalBytes?: number | null; +} + +/** + * @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. + */ + +/** + * Represents a Firestore bundle saved by the SDK in its local storage. + */ +interface BundleMetadata { + /** + * Id of the bundle. It is used together with `createTime` to determine if a + * bundle has been loaded by the SDK. + */ + readonly id: string; + /** Schema version of the bundle. */ + readonly version: number; + /** + * Set to the snapshot version of the bundle if created by the Server SDKs. + * Otherwise set to SnapshotVersion.MIN. + */ + readonly createTime: SnapshotVersion; +} +/** + * Represents a Query saved by the SDK in its local storage. + */ +interface NamedQuery { + /** The name of the query. */ + readonly name: string; + /** The underlying query associated with `name`. */ + readonly query: Query$2; + /** The time at which the results for this query were read. */ + readonly readTime: SnapshotVersion; +} + +/** + * @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. + */ +type FulfilledHandler<T, R> = ((result: T) => R | PersistencePromise<R>) | null; +type RejectedHandler<R> = ((reason: Error) => R | PersistencePromise<R>) | null; +type Resolver<T> = (value?: T) => void; +type Rejector = (error: Error) => void; +/** + * PersistencePromise is essentially a re-implementation of Promise except + * it has a .next() method instead of .then() and .next() and .catch() callbacks + * are executed synchronously when a PersistencePromise resolves rather than + * asynchronously (Promise implementations use setImmediate() or similar). + * + * This is necessary to interoperate with IndexedDB which will automatically + * commit transactions if control is returned to the event loop without + * synchronously initiating another operation on the transaction. + * + * NOTE: .then() and .catch() only allow a single consumer, unlike normal + * Promises. + */ +declare class PersistencePromise<T> { + private nextCallback; + private catchCallback; + private result; + private error; + private isDone; + private callbackAttached; + constructor(callback: (resolve: Resolver<T>, reject: Rejector) => void); + catch<R>(fn: (error: Error) => R | PersistencePromise<R>): PersistencePromise<R>; + next<R>(nextFn?: FulfilledHandler<T, R>, catchFn?: RejectedHandler<R>): PersistencePromise<R>; + toPromise(): Promise<T>; + private wrapUserFunction; + private wrapSuccess; + private wrapFailure; + static resolve(): PersistencePromise<void>; + static resolve<R>(result: R): PersistencePromise<R>; + static reject<R>(error: Error): PersistencePromise<R>; + static waitFor(all: { + forEach: (cb: (el: PersistencePromise<any>) => void) => void; + }): PersistencePromise<void>; + /** + * Given an array of predicate functions that asynchronously evaluate to a + * boolean, implements a short-circuiting `or` between the results. Predicates + * will be evaluated until one of them returns `true`, then stop. The final + * result will be whether any of them returned `true`. + */ + static or(predicates: Array<() => PersistencePromise<boolean>>): PersistencePromise<boolean>; + /** + * Given an iterable, call the given function on each element in the + * collection and wait for all of the resulting concurrent PersistencePromises + * to resolve. + */ + static forEach<R, S>(collection: { + forEach: (cb: (r: R, s: S) => void) => void; + }, f: ((r: R, s: S) => PersistencePromise<void>) | ((r: R) => PersistencePromise<void>)): PersistencePromise<void>; + static forEach<R>(collection: { + forEach: (cb: (r: R) => void) => void; + }, f: (r: R) => PersistencePromise<void>): PersistencePromise<void>; + /** + * Concurrently map all array elements through asynchronous function. + */ + static mapArray<T, U>(array: T[], f: (t: T) => PersistencePromise<U>): PersistencePromise<U[]>; + /** + * An alternative to recursive PersistencePromise calls, that avoids + * potential memory problems from unbounded chains of promises. + * + * The `action` will be called repeatedly while `condition` is true. + */ + static doWhile(condition: () => boolean, action: () => PersistencePromise<void>): PersistencePromise<void>; +} + +/** + * @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. + */ + +/** The different modes supported by `Persistence.runTransaction()`. */ +type PersistenceTransactionMode = 'readonly' | 'readwrite' | 'readwrite-primary'; +/** + * A base class representing a persistence transaction, encapsulating both the + * transaction's sequence numbers as well as a list of onCommitted listeners. + * + * When you call Persistence.runTransaction(), it will create a transaction and + * pass it to your callback. You then pass it to any method that operates + * on persistence. + */ +declare abstract class PersistenceTransaction { + private readonly onCommittedListeners; + abstract readonly currentSequenceNumber: ListenSequenceNumber; + addOnCommittedListener(listener: () => void): void; + raiseOnCommittedEvent(): void; +} + +/** + * @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. + */ + +/** + * Provides interfaces to save and read Firestore bundles. + */ +interface BundleCache { + /** + * Gets the saved `BundleMetadata` for a given `bundleId`, returns undefined + * if no bundle metadata is found under the given id. + */ + getBundleMetadata(transaction: PersistenceTransaction, bundleId: string): PersistencePromise<BundleMetadata | undefined>; + /** + * Saves a `BundleMetadata` from a bundle into local storage, using its id as + * the persistent key. + */ + saveBundleMetadata(transaction: PersistenceTransaction, metadata: BundleMetadata$1): PersistencePromise<void>; + /** + * Gets a saved `NamedQuery` for the given query name. Returns undefined if + * no queries are found under the given name. + */ + getNamedQuery(transaction: PersistenceTransaction, queryName: string): PersistencePromise<NamedQuery | undefined>; + /** + * Saves a `NamedQuery` from a bundle, using its name as the persistent key. + */ + saveNamedQuery(transaction: PersistenceTransaction, query: NamedQuery$1): PersistencePromise<void>; +} + +/** + * @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. + */ + +/** + * Provides methods to read and write document overlays. + * + * An overlay is a saved mutation, that gives a local view of a document when + * applied to the remote version of the document. + * + * Each overlay stores the largest batch ID that is included in the overlay, + * which allows us to remove the overlay once all batches leading up to it have + * been acknowledged. + */ +interface DocumentOverlayCache { + /** + * Gets the saved overlay mutation for the given document key. + * Returns null if there is no overlay for that key. + */ + getOverlay(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<Overlay | null>; + /** + * Gets the saved overlay mutation for the given document keys. Skips keys for + * which there are no overlays. + */ + getOverlays(transaction: PersistenceTransaction, keys: DocumentKey[]): PersistencePromise<OverlayMap>; + /** + * Saves the given document mutation map to persistence as overlays. + * All overlays will have their largest batch id set to `largestBatchId`. + */ + saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: MutationMap): PersistencePromise<void>; + /** Removes overlays for the given document keys and batch ID. */ + removeOverlaysForBatchId(transaction: PersistenceTransaction, documentKeys: DocumentKeySet, batchId: number): PersistencePromise<void>; + /** + * Returns all saved overlays for the given collection. + * + * @param transaction - The persistence transaction to use for this operation. + * @param collection - The collection path to get the overlays for. + * @param sinceBatchId - The minimum batch ID to filter by (exclusive). + * Only overlays that contain a change past `sinceBatchId` are returned. + * @returns Mapping of each document key in the collection to its overlay. + */ + getOverlaysForCollection(transaction: PersistenceTransaction, collection: ResourcePath, sinceBatchId: number): PersistencePromise<OverlayMap>; + /** + * Returns `count` overlays with a batch ID higher than `sinceBatchId` for the + * provided collection group, processed by ascending batch ID. The method + * always returns all overlays for a batch even if the last batch contains + * more documents than the remaining limit. + * + * @param transaction - The persistence transaction used for this operation. + * @param collectionGroup - The collection group to get the overlays for. + * @param sinceBatchId - The minimum batch ID to filter by (exclusive). + * Only overlays that contain a change past `sinceBatchId` are returned. + * @param count - The number of overlays to return. Can be exceeded if the last + * batch contains more entries. + * @return Mapping of each document key in the collection group to its overlay. + */ + getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<OverlayMap>; +} + +/** + * @license + * Copyright 2024 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. + */ + +/** + * General purpose cache for global values. + * + * Global state that cuts across components should be saved here. Following are contained herein: + * + * `sessionToken` tracks server interaction across Listen and Write streams. This facilitates cache + * synchronization and invalidation. + */ +interface GlobalsCache { + /** + * Gets session token. + */ + getSessionToken(transaction: PersistenceTransaction): PersistencePromise<ByteString>; + /** + * Sets session token. + * + * @param sessionToken - The new session token. + */ + setSessionToken(transaction: PersistenceTransaction, sessionToken: ByteString): PersistencePromise<void>; +} + +/** + * @license + * Copyright 2019 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. + */ + +/** Represents the index state as it relates to a particular target. */ +declare const enum IndexType { + /** Indicates that no index could be found for serving the target. */ + NONE = 0, + /** + * Indicates that only a "partial index" could be found for serving the + * target. A partial index is one which does not have a segment for every + * filter/orderBy in the target. + */ + PARTIAL = 1, + /** + * Indicates that a "full index" could be found for serving the target. A full + * index is one which has a segment for every filter/orderBy in the target. + */ + FULL = 2 +} +/** + * Represents a set of indexes that are used to execute queries efficiently. + * + * Currently the only index is a [collection id] => [parent path] index, used + * to execute Collection Group queries. + */ +interface IndexManager { + /** + * Creates an index entry mapping the collectionId (last segment of the path) + * to the parent path (either the containing document location or the empty + * path for root-level collections). Index entries can be retrieved via + * getCollectionParents(). + * + * NOTE: Currently we don't remove index entries. If this ends up being an + * issue we can devise some sort of GC strategy. + */ + addToCollectionParentIndex(transaction: PersistenceTransaction, collectionPath: ResourcePath): PersistencePromise<void>; + /** + * Retrieves all parent locations containing the given collectionId, as a + * list of paths (each path being either a document location or the empty + * path for a root-level collection). + */ + getCollectionParents(transaction: PersistenceTransaction, collectionId: string): PersistencePromise<ResourcePath[]>; + /** + * Adds a field path index. + * + * Values for this index are persisted via the index backfill, which runs + * asynchronously in the background. Once the first values are written, + * an index can be used to serve partial results for any matching queries. + * Any unindexed portion of the database will continue to be served via + * collection scons. + */ + addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>; + /** Removes the given field index and deletes all index values. */ + deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>; + /** Removes all field indexes and deletes all index values. */ + deleteAllFieldIndexes(transaction: PersistenceTransaction): PersistencePromise<void>; + /** Creates a full matched field index which serves the given target. */ + createTargetIndexes(transaction: PersistenceTransaction, target: Target): PersistencePromise<void>; + /** + * Returns a list of field indexes that correspond to the specified collection + * group. + * + * @param collectionGroup The collection group to get matching field indexes + * for. + * @return A collection of field indexes for the specified collection group. + */ + getFieldIndexes(transaction: PersistenceTransaction, collectionGroup: string): PersistencePromise<FieldIndex[]>; + /** Returns all configured field indexes. */ + getFieldIndexes(transaction: PersistenceTransaction): PersistencePromise<FieldIndex[]>; + /** + * Returns the type of index (if any) that can be used to serve the given + * target. + */ + getIndexType(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexType>; + /** + * Returns the documents that match the given target based on the provided + * index or `null` if the target does not have a matching index. + */ + getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKey[] | null>; + /** + * Returns the next collection group to update. Returns `null` if no group + * exists. + */ + getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>; + /** + * Sets the collection group's latest read time. + * + * This method updates the index offset for all field indices for the + * collection group and increments their sequence number. Subsequent calls to + * `getNextCollectionGroupToUpdate()` will return a different collection group + * (unless only one collection group is configured). + */ + updateCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset): PersistencePromise<void>; + /** Updates the index entries for the provided documents. */ + updateIndexEntries(transaction: PersistenceTransaction, documents: DocumentMap): PersistencePromise<void>; + /** + * Iterates over all field indexes that are used to serve the given target, + * and returns the minimum offset of them all. + */ + getMinOffset(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexOffset>; + /** Returns the minimum offset for the given collection group. */ + getMinOffsetFromCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string): PersistencePromise<IndexOffset>; +} + +/** + * @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. + */ + +/** + * Describes a map whose keys are active target ids. We do not care about the type of the + * values. + */ +type ActiveTargets = SortedMap<TargetId, unknown>; +declare class LruParams { + readonly cacheSizeCollectionThreshold: number; + readonly percentileToCollect: number; + readonly maximumSequenceNumbersToCollect: number; + private static readonly DEFAULT_COLLECTION_PERCENTILE; + private static readonly DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT; + static withCacheSize(cacheSize: number): LruParams; + static readonly DEFAULT: LruParams; + static readonly DISABLED: LruParams; + constructor(cacheSizeCollectionThreshold: number, percentileToCollect: number, maximumSequenceNumbersToCollect: number); +} +interface LruGarbageCollector { + readonly params: LruParams; + collect(txn: PersistenceTransaction, activeTargetIds: ActiveTargets): PersistencePromise<LruResults>; + /** Given a percentile of target to collect, returns the number of targets to collect. */ + calculateTargetCount(txn: PersistenceTransaction, percentile: number): PersistencePromise<number>; + /** Returns the nth sequence number, counting in order from the smallest. */ + nthSequenceNumber(txn: PersistenceTransaction, n: number): PersistencePromise<number>; + /** + * Removes documents that have a sequence number equal to or less than the + * upper bound and are not otherwise pinned. + */ + removeOrphanedDocuments(txn: PersistenceTransaction, upperBound: ListenSequenceNumber): PersistencePromise<number>; + getCacheSize(txn: PersistenceTransaction): PersistencePromise<number>; + /** + * Removes targets with a sequence number equal to or less than the given + * upper bound, and removes document associations with those targets. + */ + removeTargets(txn: PersistenceTransaction, upperBound: ListenSequenceNumber, activeTargetIds: ActiveTargets): PersistencePromise<number>; +} +/** + * Describes the results of a garbage collection run. `didRun` will be set to + * `false` if collection was skipped (either it is disabled or the cache size + * has not hit the threshold). If collection ran, the other fields will be + * filled in with the details of the results. + */ +interface LruResults { + readonly didRun: boolean; + readonly sequenceNumbersCollected: number; + readonly targetsRemoved: number; + readonly documentsRemoved: number; +} + +/** + * @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. + */ + +/** + * A batch of mutations that will be sent as one unit to the backend. + */ +declare class MutationBatch { + batchId: BatchId; + localWriteTime: Timestamp$1; + 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$1, 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. */ +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; +} + +/** + * @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. + */ + +/** A queue of mutations to apply to the remote store. */ +interface MutationQueue { + /** Returns true if this queue contains no mutation batches. */ + checkEmpty(transaction: PersistenceTransaction): PersistencePromise<boolean>; + /** + * Creates a new mutation batch and adds it to this mutation queue. + * + * @param transaction - The transaction this operation is scoped to. + * @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. These mutations are used to locally + * overwrite values that are persisted in the remote document cache. + * @param mutations - The user-provided mutations in this mutation batch. + */ + addMutationBatch(transaction: PersistenceTransaction, localWriteTime: Timestamp$1, baseMutations: Mutation[], mutations: Mutation[]): PersistencePromise<MutationBatch>; + /** + * Loads the mutation batch with the given batchId. + */ + lookupMutationBatch(transaction: PersistenceTransaction, batchId: BatchId): PersistencePromise<MutationBatch | null>; + /** + * Gets the first unacknowledged mutation batch after the passed in batchId + * in the mutation queue or null if empty. + * + * @param batchId - The batch to search after, or BATCHID_UNKNOWN for the + * first mutation in the queue. + * + * @returns the next mutation or null if there wasn't one. + */ + getNextMutationBatchAfterBatchId(transaction: PersistenceTransaction, batchId: BatchId): PersistencePromise<MutationBatch | null>; + /** + * Gets the largest (latest) batch id in mutation queue for the current user + * that is pending server response, returns `BATCHID_UNKNOWN` if the queue is + * empty. + * + * @returns the largest batch id in the mutation queue that is not + * acknowledged. + */ + getHighestUnacknowledgedBatchId(transaction: PersistenceTransaction): PersistencePromise<BatchId>; + /** Gets all mutation batches in the mutation queue. */ + getAllMutationBatches(transaction: PersistenceTransaction): PersistencePromise<MutationBatch[]>; + /** + * Finds all mutation batches that could possibly affect the given + * document key. Not all mutations in a batch will necessarily affect the + * document key, so when looping through the batch you'll need to check that + * the mutation itself matches the key. + * + * Batches are guaranteed to be in sorted order. + * + * Note that because of this requirement implementations are free to return + * mutation batches that don't contain the document key at all if it's + * convenient. + */ + getAllMutationBatchesAffectingDocumentKey(transaction: PersistenceTransaction, documentKey: DocumentKey): PersistencePromise<MutationBatch[]>; + /** + * Finds all mutation batches that could possibly affect the given set of + * document keys. Not all mutations in a batch will necessarily affect each + * key, so when looping through the batch you'll need to check that the + * mutation itself matches the key. + * + * Batches are guaranteed to be in sorted order. + * + * Note that because of this requirement implementations are free to return + * mutation batches that don't contain any of the document keys at all if it's + * convenient. + */ + getAllMutationBatchesAffectingDocumentKeys(transaction: PersistenceTransaction, documentKeys: SortedMap<DocumentKey, unknown>): PersistencePromise<MutationBatch[]>; + /** + * Finds all mutation batches that could affect the results for the given + * query. Not all mutations in a batch will necessarily affect the query, so + * when looping through the batch you'll need to check that the mutation + * itself matches the query. + * + * Batches are guaranteed to be in sorted order. + * + * Note that because of this requirement implementations are free to return + * mutation batches that don't match the query at all if it's convenient. + * + * NOTE: A PatchMutation does not need to include all fields in the query + * filter criteria in order to be a match (but any fields it does contain do + * need to match). + */ + getAllMutationBatchesAffectingQuery(transaction: PersistenceTransaction, query: Query$2): PersistencePromise<MutationBatch[]>; + /** + * Removes the given mutation batch from the queue. This is useful in two + * circumstances: + * + * + Removing an applied mutation from the head of the queue + * + Removing a rejected mutation from anywhere in the queue + * + * Multi-Tab Note: This operation should only be called by the primary client. + */ + removeMutationBatch(transaction: PersistenceTransaction, batch: MutationBatch): PersistencePromise<void>; + /** + * Performs a consistency check, examining the mutation queue for any + * leaks, if possible. + */ + performConsistencyCheck(transaction: PersistenceTransaction): PersistencePromise<void>; +} + +/** + * @license + * Copyright 2023 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. + */ +/** + * A tracker to keep a record of important details during database local query + * execution. + */ +declare class QueryContext { + /** + * Counts the number of documents passed through during local query execution. + */ + private _documentReadCount; + get documentReadCount(): number; + incrementDocumentReadCount(amount: number): void; +} + +/** + * @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. + */ + +/** + * An in-memory buffer of entries to be written to a RemoteDocumentCache. + * It can be used to batch up a set of changes to be written to the cache, but + * additionally supports reading entries back with the `getEntry()` method, + * falling back to the underlying RemoteDocumentCache if no entry is + * buffered. + * + * Entries added to the cache *must* be read first. This is to facilitate + * calculating the size delta of the pending changes. + * + * PORTING NOTE: This class was implemented then removed from other platforms. + * If byte-counting ends up being needed on the other platforms, consider + * porting this class as part of that implementation work. + */ +declare abstract class RemoteDocumentChangeBuffer { + protected changes: ObjectMap<DocumentKey, MutableDocument>; + private changesApplied; + protected abstract getFromCache(transaction: PersistenceTransaction, documentKey: DocumentKey): PersistencePromise<MutableDocument>; + protected abstract getAllFromCache(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>; + protected abstract applyChanges(transaction: PersistenceTransaction): PersistencePromise<void>; + /** + * Buffers a `RemoteDocumentCache.addEntry()` call. + * + * You can only modify documents that have already been retrieved via + * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`). + */ + addEntry(document: MutableDocument): void; + /** + * Buffers a `RemoteDocumentCache.removeEntry()` call. + * + * You can only remove documents that have already been retrieved via + * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`). + */ + removeEntry(key: DocumentKey, readTime: SnapshotVersion): void; + /** + * Looks up an entry in the cache. The buffered changes will first be checked, + * and if no buffered change applies, this will forward to + * `RemoteDocumentCache.getEntry()`. + * + * @param transaction - The transaction in which to perform any persistence + * operations. + * @param documentKey - The key of the entry to look up. + * @returns The cached document or an invalid document if we have nothing + * cached. + */ + getEntry(transaction: PersistenceTransaction, documentKey: DocumentKey): PersistencePromise<MutableDocument>; + /** + * Looks up several entries in the cache, forwarding to + * `RemoteDocumentCache.getEntry()`. + * + * @param transaction - The transaction in which to perform any persistence + * operations. + * @param documentKeys - The keys of the entries to look up. + * @returns A map of cached documents, indexed by key. If an entry cannot be + * found, the corresponding key will be mapped to an invalid document. + */ + getEntries(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>; + /** + * Applies buffered changes to the underlying RemoteDocumentCache, using + * the provided transaction. + */ + apply(transaction: PersistenceTransaction): PersistencePromise<void>; + /** Helper to assert this.changes is not null */ + protected assertNotApplied(): void; +} + +/** + * @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. + */ + +/** + * Represents cached documents received from the remote backend. + * + * The cache is keyed by DocumentKey and entries in the cache are + * MutableDocuments, meaning we can cache both actual documents as well as + * documents that are known to not exist. + */ +interface RemoteDocumentCache { + /** Sets the index manager to use for managing the collectionGroup index. */ + setIndexManager(indexManager: IndexManager): void; + /** + * Looks up an entry in the cache. + * + * @param documentKey - The key of the entry to look up.* + * @returns The cached document entry. Returns an invalid document if the + * document is not cached. + */ + getEntry(transaction: PersistenceTransaction, documentKey: DocumentKey): PersistencePromise<MutableDocument>; + /** + * Looks up a set of entries in the cache. + * + * @param documentKeys - The keys of the entries to look up. + * @returns The cached document entries indexed by key. If an entry is not + * cached, the corresponding key will be mapped to an invalid document. + */ + getEntries(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>; + /** + * Returns the documents matching the given query + * + * @param query - The query to match documents against. + * @param offset - The offset to start the scan at (exclusive). + * @param context - A optional tracker to keep a record of important details + * during database local query execution. + * @returns The set of matching documents. + */ + getDocumentsMatchingQuery(transaction: PersistenceTransaction, query: Query$2, offset: IndexOffset, mutatedDocs: OverlayMap, context?: QueryContext): PersistencePromise<MutableDocumentMap>; + /** + * Looks up the next `limit` documents for a collection group based on the + * provided offset. The ordering is based on the document's read time and key. + * + * @param collectionGroup - The collection group to scan. + * @param offset - The offset to start the scan at (exclusive). + * @param limit - The maximum number of results to return. + * @returns The set of matching documents. + */ + getAllFromCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset, limit: number): PersistencePromise<MutableDocumentMap>; + /** + * Provides access to add or update the contents of the cache. The buffer + * handles proper size accounting for the change. + * + * Multi-Tab Note: This should only be called by the primary client. + * + * @param options - Specify `trackRemovals` to create sentinel entries for + * removed documents, which allows removals to be tracked by + * `getNewDocumentChanges()`. + */ + newChangeBuffer(options?: { + trackRemovals: boolean; + }): RemoteDocumentChangeBuffer; + /** + * Get an estimate of the size of the document cache. Note that for eager + * garbage collection, we don't track sizes so this will return 0. + */ + getSize(transaction: PersistenceTransaction): PersistencePromise<number>; +} + +/** + * @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. + */ + +/** + * Represents cached targets received from the remote backend. + * + * The cache is keyed by `Target` and entries in the cache are `TargetData` + * instances. + */ +interface TargetCache { + /** + * A global snapshot version representing the last consistent snapshot we + * received from the backend. This is monotonically increasing and any + * snapshots received from the backend prior to this version (e.g. for targets + * resumed with a resume_token) should be suppressed (buffered) until the + * backend has caught up to this snapshot version again. This prevents our + * cache from ever going backwards in time. + * + * This is updated whenever our we get a TargetChange with a read_time and + * empty target_ids. + */ + getLastRemoteSnapshotVersion(transaction: PersistenceTransaction): PersistencePromise<SnapshotVersion>; + /** + * @returns The highest sequence number observed, including any that might be + * persisted on-disk. + */ + getHighestSequenceNumber(transaction: PersistenceTransaction): PersistencePromise<ListenSequenceNumber>; + /** + * Call provided function with each `TargetData` that we have cached. + */ + forEachTarget(txn: PersistenceTransaction, f: (q: TargetData) => void): PersistencePromise<void>; + /** + * Set the highest listen sequence number and optionally updates the + * snapshot version of the last consistent snapshot received from the backend + * (see getLastRemoteSnapshotVersion() for more details). + * + * @param highestListenSequenceNumber - The new maximum listen sequence number. + * @param lastRemoteSnapshotVersion - The new snapshot version. Optional. + */ + setTargetsMetadata(transaction: PersistenceTransaction, highestListenSequenceNumber: number, lastRemoteSnapshotVersion?: SnapshotVersion): PersistencePromise<void>; + /** + * Adds an entry in the cache. + * + * The cache key is extracted from `targetData.target`. The key must not already + * exist in the cache. + * + * @param targetData - A TargetData instance to put in the cache. + */ + addTargetData(transaction: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + /** + * Updates an entry in the cache. + * + * The cache key is extracted from `targetData.target`. The entry must already + * exist in the cache, and it will be replaced. + * @param targetData - The TargetData to be replaced into the cache. + */ + updateTargetData(transaction: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + /** + * Removes the cached entry for the given target data. It is an error to remove + * a target data that does not exist. + * + * Multi-Tab Note: This operation should only be called by the primary client. + */ + removeTargetData(transaction: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + /** + * The number of targets currently in the cache. + */ + getTargetCount(transaction: PersistenceTransaction): PersistencePromise<number>; + /** + * Looks up a TargetData entry by target. + * + * @param target - The query target corresponding to the entry to look up. + * @returns The cached TargetData entry, or null if the cache has no entry for + * the target. + */ + getTargetData(transaction: PersistenceTransaction, target: Target): PersistencePromise<TargetData | null>; + /** + * Adds the given document keys to cached query results of the given target + * ID. + * + * Multi-Tab Note: This operation should only be called by the primary client. + */ + addMatchingKeys(transaction: PersistenceTransaction, keys: DocumentKeySet, targetId: TargetId): PersistencePromise<void>; + /** + * Removes the given document keys from the cached query results of the + * given target ID. + * + * Multi-Tab Note: This operation should only be called by the primary client. + */ + removeMatchingKeys(transaction: PersistenceTransaction, keys: DocumentKeySet, targetId: TargetId): PersistencePromise<void>; + /** + * Removes all the keys in the query results of the given target ID. + * + * Multi-Tab Note: This operation should only be called by the primary client. + */ + removeMatchingKeysForTargetId(transaction: PersistenceTransaction, targetId: TargetId): PersistencePromise<void>; + /** + * Returns the document keys that match the provided target ID. + */ + getMatchingKeysForTargetId(transaction: PersistenceTransaction, targetId: TargetId): PersistencePromise<DocumentKeySet>; + /** + * Returns a new target ID that is higher than any query in the cache. If + * there are no queries in the cache, returns the first valid target ID. + * Allocated target IDs are persisted and `allocateTargetId()` will never + * return the same ID twice. + */ + allocateTargetId(transaction: PersistenceTransaction): PersistencePromise<TargetId>; + containsKey(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<boolean>; +} + +/** + * @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. + */ + +/** + * A ReferenceDelegate instance handles all of the hooks into the document-reference lifecycle. This + * includes being added to a target, being removed from a target, being subject to mutation, and + * being mutated by the user. + * + * Different implementations may do different things with each of these events. Not every + * implementation needs to do something with every lifecycle hook. + * + * PORTING NOTE: since sequence numbers are attached to transactions in this + * client, the ReferenceDelegate does not need to deal in transactional + * semantics (onTransactionStarted/Committed()), nor does it need to track and + * generate sequence numbers (getCurrentSequenceNumber()). + */ +interface ReferenceDelegate { + /** Notify the delegate that the given document was added to a target. */ + addReference(txn: PersistenceTransaction, targetId: TargetId, doc: DocumentKey): PersistencePromise<void>; + /** Notify the delegate that the given document was removed from a target. */ + removeReference(txn: PersistenceTransaction, targetId: TargetId, doc: DocumentKey): PersistencePromise<void>; + /** + * Notify the delegate that a target was removed. The delegate may, but is not obligated to, + * actually delete the target and associated data. + */ + removeTarget(txn: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + /** + * Notify the delegate that a document may no longer be part of any views or + * have any mutations associated. + */ + markPotentiallyOrphaned(txn: PersistenceTransaction, doc: DocumentKey): PersistencePromise<void>; + /** Notify the delegate that a limbo document was updated. */ + updateLimboDocument(txn: PersistenceTransaction, doc: DocumentKey): PersistencePromise<void>; +} +/** + * Persistence is the lowest-level shared interface to persistent storage in + * Firestore. + * + * Persistence is used to create MutationQueue and RemoteDocumentCache + * instances backed by persistence (which might be in-memory or LevelDB). + * + * Persistence also exposes an API to create and run PersistenceTransactions + * against persistence. All read / write operations must be wrapped in a + * transaction. Implementations of PersistenceTransaction / Persistence only + * need to guarantee that writes made against the transaction are not made to + * durable storage until the transaction resolves its PersistencePromise. + * Since memory-only storage components do not alter durable storage, they are + * free to ignore the transaction. + * + * This contract is enough to allow the LocalStore be be written + * independently of whether or not the stored state actually is durably + * persisted. If persistent storage is enabled, writes are grouped together to + * avoid inconsistent state that could cause crashes. + * + * Concretely, when persistent storage is enabled, the persistent versions of + * MutationQueue, RemoteDocumentCache, and others (the mutators) will + * defer their writes into a transaction. Once the local store has completed + * one logical operation, it commits the transaction. + * + * When persistent storage is disabled, the non-persistent versions of the + * mutators ignore the transaction. This short-cut is allowed because + * memory-only storage leaves no state so it cannot be inconsistent. + * + * This simplifies the implementations of the mutators and allows memory-only + * implementations to supplement the persistent ones without requiring any + * special dual-store implementation of Persistence. The cost is that the + * LocalStore needs to be slightly careful about the order of its reads and + * writes in order to avoid relying on being able to read back uncommitted + * writes. + */ +interface Persistence { + /** + * Whether or not this persistence instance has been started. + */ + readonly started: boolean; + readonly referenceDelegate: ReferenceDelegate; + /** Starts persistence. */ + start(): Promise<void>; + /** + * Releases any resources held during eager shutdown. + */ + shutdown(): Promise<void>; + /** + * Registers a listener that gets called when the database receives a + * version change event indicating that it has deleted. + * + * PORTING NOTE: This is only used for Web multi-tab. + */ + setDatabaseDeletedListener(databaseDeletedListener: () => Promise<void>): void; + /** + * Adjusts the current network state in the client's metadata, potentially + * affecting the primary lease. + * + * PORTING NOTE: This is only used for Web multi-tab. + */ + setNetworkEnabled(networkEnabled: boolean): void; + /** + * Returns GlobalCache representing a general purpose cache for global values. + */ + getGlobalsCache(): GlobalsCache; + /** + * Returns a MutationQueue representing the persisted mutations for the + * given user. + * + * Note: The implementation is free to return the same instance every time + * this is called for a given user. In particular, the memory-backed + * implementation does this to emulate the persisted implementation to the + * extent possible (e.g. in the case of uid switching from + * sally=>jack=>sally, sally's mutation queue will be preserved). + */ + getMutationQueue(user: User, indexManager: IndexManager): MutationQueue; + /** + * Returns a TargetCache representing the persisted cache of targets. + * + * Note: The implementation is free to return the same instance every time + * this is called. In particular, the memory-backed implementation does this + * to emulate the persisted implementation to the extent possible. + */ + getTargetCache(): TargetCache; + /** + * Returns a RemoteDocumentCache representing the persisted cache of remote + * documents. + * + * Note: The implementation is free to return the same instance every time + * this is called. In particular, the memory-backed implementation does this + * to emulate the persisted implementation to the extent possible. + */ + getRemoteDocumentCache(): RemoteDocumentCache; + /** + * Returns a BundleCache representing the persisted cache of loaded bundles. + * + * Note: The implementation is free to return the same instance every time + * this is called. In particular, the memory-backed implementation does this + * to emulate the persisted implementation to the extent possible. + */ + getBundleCache(): BundleCache; + /** + * Returns an IndexManager instance that manages our persisted query indexes. + * + * Note: The implementation is free to return the same instance every time + * this is called. In particular, the memory-backed implementation does this + * to emulate the persisted implementation to the extent possible. + */ + getIndexManager(user: User): IndexManager; + /** + * Returns a DocumentOverlayCache representing the documents that are mutated + * locally. + */ + getDocumentOverlayCache(user: User): DocumentOverlayCache; + /** + * Performs an operation inside a persistence transaction. Any reads or writes + * against persistence must be performed within a transaction. Writes will be + * committed atomically once the transaction completes. + * + * Persistence operations are asynchronous and therefore the provided + * transactionOperation must return a PersistencePromise. When it is resolved, + * the transaction will be committed and the Promise returned by this method + * will resolve. + * + * @param action - A description of the action performed by this transaction, + * used for logging. + * @param mode - The underlying mode of the IndexedDb transaction. Can be + * 'readonly', 'readwrite' or 'readwrite-primary'. Transactions marked + * 'readwrite-primary' can only be executed by the primary client. In this + * mode, the transactionOperation will not be run if the primary lease cannot + * be acquired and the returned promise will be rejected with a + * FAILED_PRECONDITION error. + * @param transactionOperation - The operation to run inside a transaction. + * @returns A `Promise` that is resolved once the transaction completes. + */ + runTransaction<T>(action: string, mode: PersistenceTransactionMode, transactionOperation: (transaction: PersistenceTransaction) => PersistencePromise<T>): Promise<T>; +} +/** + * Interface to schedule periodic tasks within SDK. + */ +interface Scheduler { + readonly started: boolean; + start(): void; + stop(): void; +} + +/** + * @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. + */ + +/** The different states of a watch target. */ +type QueryTargetState = 'not-current' | 'current' | 'rejected'; + +/** + * @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. + */ + +/** + * A randomly-generated key assigned to each Firestore instance at startup. + */ +type ClientId = string; +/** + * A `SharedClientState` keeps track of the global state of the mutations + * and query targets for all active clients with the same persistence key (i.e. + * project ID and FirebaseApp name). It relays local changes to other clients + * and updates its local state as new state is observed. + * + * `SharedClientState` is primarily used for synchronization in Multi-Tab + * environments. Each tab is responsible for registering its active query + * targets and mutations. `SharedClientState` will then notify the listener + * assigned to `.syncEngine` for updates to mutations and queries that + * originated in other clients. + * + * To receive notifications, `.syncEngine` and `.onlineStateHandler` has to be + * assigned before calling `start()`. + */ +interface SharedClientState { + onlineStateHandler: ((onlineState: OnlineState) => void) | null; + sequenceNumberHandler: ((sequenceNumber: ListenSequenceNumber) => void) | null; + /** Registers the Mutation Batch ID of a newly pending mutation. */ + addPendingMutation(batchId: BatchId): void; + /** + * Records that a pending mutation has been acknowledged or rejected. + * Called by the primary client to notify secondary clients of mutation + * results as they come back from the backend. + */ + updateMutationState(batchId: BatchId, state: 'acknowledged' | 'rejected', error?: FirestoreError$1): void; + /** + * Associates a new Query Target ID with the local Firestore client. Returns + * the new query state for the query (which can be 'current' if the query is + * already associated with another tab). + * + * If the target id is already associated with local client, the method simply + * returns its `QueryTargetState`. + */ + addLocalQueryTarget(targetId: TargetId, addToActiveTargetIds?: boolean): QueryTargetState; + /** Removes the Query Target ID association from the local client. */ + removeLocalQueryTarget(targetId: TargetId): void; + /** Checks whether the target is associated with the local client. */ + isLocalQueryTarget(targetId: TargetId): boolean; + /** + * Processes an update to a query target. + * + * Called by the primary client to notify secondary clients of document + * changes or state transitions that affect the provided query target. + */ + updateQueryState(targetId: TargetId, state: QueryTargetState, error?: FirestoreError$1): void; + /** + * Removes the target's metadata entry. + * + * Called by the primary client when all clients stopped listening to a query + * target. + */ + clearQueryState(targetId: TargetId): void; + /** + * Gets the active Query Targets IDs for all active clients. + * + * The implementation for this may require O(n) runtime, where 'n' is the size + * of the result set. + */ + getAllActiveQueryTargets(): SortedSet<TargetId>; + /** + * Checks whether the provided target ID is currently being listened to by + * any of the active clients. + * + * The implementation may require O(n*log m) runtime, where 'n' is the number + * of clients and 'm' the number of targets. + */ + isActiveQueryTarget(targetId: TargetId): boolean; + /** + * Starts the SharedClientState, reads existing client data and registers + * listeners for updates to new and existing clients. + */ + start(): Promise<void>; + /** Shuts down the `SharedClientState` and its listeners. */ + shutdown(): void; + /** + * Changes the active user and removes all existing user-specific data. The + * user change does not call back into SyncEngine (for example, no mutations + * will be marked as removed). + */ + handleUserChange(user: User, removedBatchIds: BatchId[], addedBatchIds: BatchId[]): void; + /** Changes the shared online state of all clients. */ + setOnlineState(onlineState: OnlineState): void; + writeSequenceNumber(sequenceNumber: ListenSequenceNumber): void; + /** + * Notifies other clients when remote documents have changed due to loading + * a bundle. + * + * @param collectionGroups The collection groups affected by this bundle. + */ + notifyBundleLoaded(collectionGroups: Set<string>): void; +} + +/** + * @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. + */ + +type DocumentComparator = (doc1: Document, doc2: Document) => number; + +/** + * @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. + */ + +/** + * 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. + */ +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; +} + +/** + * @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. + */ + +declare const enum ChangeType { + Added = 0, + Removed = 1, + Modified = 2, + Metadata = 3 +} +interface DocumentViewChange { + type: ChangeType; + doc: Document; +} +declare class ViewSnapshot { + readonly query: Query$2; + readonly docs: DocumentSet; + readonly oldDocs: DocumentSet; + readonly docChanges: DocumentViewChange[]; + readonly mutatedKeys: DocumentKeySet; + readonly fromCache: boolean; + readonly syncStateChanged: boolean; + readonly excludesMetadataChanges: boolean; + readonly hasCachedResults: boolean; + constructor(query: Query$2, docs: DocumentSet, oldDocs: DocumentSet, docChanges: DocumentViewChange[], mutatedKeys: DocumentKeySet, fromCache: boolean, syncStateChanged: boolean, excludesMetadataChanges: boolean, hasCachedResults: boolean); + /** Returns a view snapshot as if all documents in the snapshot were added. */ + static fromInitialDocuments(query: Query$2, documents: DocumentSet, mutatedKeys: DocumentKeySet, fromCache: boolean, hasCachedResults: boolean): ViewSnapshot; + get hasPendingWrites(): boolean; + isEqual(other: ViewSnapshot): boolean; +} + +/** + * @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. + */ + +/** The result of a write to the local store. */ +interface LocalWriteResult { + batchId: BatchId; + changes: DocumentMap; +} + +/** + * @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. + */ + +/** + * A readonly view of the local state of all documents we're tracking (i.e. we + * have a cached version in remoteDocumentCache or local mutations for the + * document). The view is computed by applying the mutations in the + * MutationQueue to the RemoteDocumentCache. + */ +declare class LocalDocumentsView { + readonly remoteDocumentCache: RemoteDocumentCache; + readonly mutationQueue: MutationQueue; + readonly documentOverlayCache: DocumentOverlayCache; + readonly indexManager: IndexManager; + constructor(remoteDocumentCache: RemoteDocumentCache, mutationQueue: MutationQueue, documentOverlayCache: DocumentOverlayCache, indexManager: IndexManager); + /** + * Get the local view of the document identified by `key`. + * + * @returns Local view of the document or null if we don't have any cached + * state for it. + */ + getDocument(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<Document>; + /** + * Gets the local view of the documents identified by `keys`. + * + * If we don't have cached state for a document in `keys`, a NoDocument will + * be stored for that key in the resulting set. + */ + getDocuments(transaction: PersistenceTransaction, keys: DocumentKeySet): PersistencePromise<DocumentMap>; + /** + * Similar to `getDocuments`, but creates the local view from the given + * `baseDocs` without retrieving documents from the local store. + * + * @param transaction - The transaction this operation is scoped to. + * @param docs - The documents to apply local mutations to get the local views. + * @param existenceStateChanged - The set of document keys whose existence state + * is changed. This is useful to determine if some documents overlay needs + * to be recalculated. + */ + getLocalViewOfDocuments(transaction: PersistenceTransaction, docs: MutableDocumentMap, existenceStateChanged?: DocumentKeySet): PersistencePromise<DocumentMap>; + /** + * Gets the overlayed documents for the given document map, which will include + * the local view of those documents and a `FieldMask` indicating which fields + * are mutated locally, `null` if overlay is a Set or Delete mutation. + */ + getOverlayedDocuments(transaction: PersistenceTransaction, docs: MutableDocumentMap): PersistencePromise<OverlayedDocumentMap>; + /** + * Fetches the overlays for {@code docs} and adds them to provided overlay map + * if the map does not already contain an entry for the given document key. + */ + private populateOverlays; + /** + * Computes the local view for the given documents. + * + * @param docs - The documents to compute views for. It also has the base + * version of the documents. + * @param overlays - The overlays that need to be applied to the given base + * version of the documents. + * @param existenceStateChanged - A set of documents whose existence states + * might have changed. This is used to determine if we need to re-calculate + * overlays from mutation queues. + * @return A map represents the local documents view. + */ + computeViews(transaction: PersistenceTransaction, docs: MutableDocumentMap, overlays: OverlayMap, existenceStateChanged: DocumentKeySet): PersistencePromise<OverlayedDocumentMap>; + private recalculateAndSaveOverlays; + /** + * Recalculates overlays by reading the documents from remote document cache + * first, and saves them after they are calculated. + */ + recalculateAndSaveOverlaysForDocumentKeys(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<DocumentKeyMap<FieldMask | null>>; + /** + * Performs a query against the local view of all documents. + * + * @param transaction - The persistence transaction. + * @param query - The query to match documents against. + * @param offset - Read time and key to start scanning by (exclusive). + * @param context - A optional tracker to keep a record of important details + * during database local query execution. + */ + getDocumentsMatchingQuery(transaction: PersistenceTransaction, query: Query$2, offset: IndexOffset, context?: QueryContext): PersistencePromise<DocumentMap>; + /** + * Given a collection group, returns the next documents that follow the provided offset, along + * with an updated batch ID. + * + * <p>The documents returned by this method are ordered by remote version from the provided + * offset. If there are no more remote documents after the provided offset, documents with + * mutations in order of batch id from the offset are returned. Since all documents in a batch are + * returned together, the total number of documents returned can exceed {@code count}. + * + * @param transaction + * @param collectionGroup The collection group for the documents. + * @param offset The offset to index into. + * @param count The number of documents to return + * @return A LocalWriteResult with the documents that follow the provided offset and the last processed batch id. + */ + getNextDocuments(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset, count: number): PersistencePromise<LocalWriteResult>; + private getDocumentsMatchingDocumentQuery; + private getDocumentsMatchingCollectionGroupQuery; + private getDocumentsMatchingCollectionQuery; +} + +/** + * @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. + */ + +interface LocalStore { + collectGarbage(garbageCollector: LruGarbageCollector): Promise<LruResults>; + /** Manages the list of active field and collection indices. */ + indexManager: IndexManager; + /** + * The "local" view of all documents (layering mutationQueue on top of + * remoteDocumentCache). + */ + localDocuments: LocalDocumentsView; +} + +/** + * @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. + */ + +/** + * Datastore and its related methods are a wrapper around the external Google + * Cloud Datastore grpc API, which provides an interface that is more convenient + * for the rest of the client SDK architecture to consume. + */ +declare abstract class Datastore { + abstract terminate(): void; + abstract serializer: JsonProtoSerializer; +} + +/** + * @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. + */ + +/** + * An interface that describes the actions the RemoteStore needs to perform on + * a cooperating synchronization engine. + */ +interface RemoteSyncer { + /** + * Applies one remote event to the sync engine, notifying any views of the + * changes, and releasing any pending mutation batches that would become + * visible because of the snapshot version the remote event contains. + */ + applyRemoteEvent?(remoteEvent: RemoteEvent): Promise<void>; + /** + * Rejects the listen for the given targetID. This can be triggered by the + * backend for any active target. + * + * @param targetId - The targetID corresponds to one previously initiated by + * the user as part of TargetData passed to listen() on RemoteStore. + * @param error - A description of the condition that has forced the rejection. + * Nearly always this will be an indication that the user is no longer + * authorized to see the data matching the target. + */ + rejectListen?(targetId: TargetId, error: FirestoreError$1): Promise<void>; + /** + * Applies the result of a successful write of a mutation batch to the sync + * engine, emitting snapshots in any views that the mutation applies to, and + * removing the batch from the mutation queue. + */ + applySuccessfulWrite?(result: MutationBatchResult): Promise<void>; + /** + * Rejects the batch, removing the batch from the mutation queue, recomputing + * the local view of any documents affected by the batch and then, emitting + * snapshots with the reverted value. + */ + rejectFailedWrite?(batchId: BatchId, error: FirestoreError$1): Promise<void>; + /** + * Returns the set of remote document keys for the given target ID. This list + * includes the documents that were assigned to the target when we received + * the last snapshot. + */ + getRemoteKeysForTarget?(targetId: TargetId): DocumentKeySet; + /** + * Updates all local state to match the pending mutations for the given user. + * May be called repeatedly for the same user. + */ + handleCredentialChange?(user: User): Promise<void>; +} + +/** + * @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. + */ + +/** + * RemoteStore - An interface to remotely stored data, basically providing a + * wrapper around the Datastore that is more reliable for the rest of the + * system. + * + * RemoteStore is responsible for maintaining the connection to the server. + * - maintaining a list of active listens. + * - reconnecting when the connection is dropped. + * - resuming all the active listens on reconnect. + * + * RemoteStore handles all incoming events from the Datastore. + * - listening to the watch stream and repackaging the events as RemoteEvents + * - notifying SyncEngine of any changes to the active listens. + * + * RemoteStore takes writes from other components and handles them reliably. + * - pulling pending mutations from LocalStore and sending them to Datastore. + * - retrying mutations that failed because of network problems. + * - acking mutations to the SyncEngine once they are accepted or rejected. + */ +interface RemoteStore { + /** + * SyncEngine to notify of watch and write events. This must be set + * immediately after construction. + */ + remoteSyncer: RemoteSyncer; +} + +/** + * A utility class for generating unique alphanumeric IDs of a specified length. + * + * @internal + * Exported internally for testing purposes. + */ +declare class AutoId { + static newId(): string; +} + +/** + * @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. + */ + +/** + * EventManager is responsible for mapping queries to query event emitters. + * It handles "fan-out". -- Identical queries will re-use the same watch on the + * backend. + * + * PORTING NOTE: On Web, EventManager `onListen` and `onUnlisten` need to be + * assigned to SyncEngine's `listen()` and `unlisten()` API before usage. This + * allows users to tree-shake the Watch logic. + */ +interface EventManager { + onListen?: (query: Query$2, enableRemoteListen: boolean) => Promise<ViewSnapshot>; + onUnlisten?: (query: Query$2, disableRemoteListen: boolean) => Promise<void>; + onFirstRemoteStoreListen?: (query: Query$2) => Promise<void>; + onLastRemoteStoreUnlisten?: (query: Query$2) => Promise<void>; + terminate(): void; +} + +/** + * @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. + */ +/** + * SyncEngine is the central controller in the client SDK architecture. It is + * the glue code between the EventManager, LocalStore, and RemoteStore. Some of + * SyncEngine's responsibilities include: + * 1. Coordinating client requests and remote events between the EventManager + * and the local and remote data stores. + * 2. Managing a View object for each query, providing the unified view between + * the local and remote data stores. + * 3. Notifying the RemoteStore when the LocalStore has new mutations in its + * queue that need sending to the backend. + * + * The SyncEngine’s methods should only ever be called by methods running in the + * global async queue. + * + * PORTING NOTE: On Web, SyncEngine does not have an explicit subscribe() + * function. Instead, it directly depends on EventManager's tree-shakeable API + * (via `ensureWatchStream()`). + */ +interface SyncEngine { + isPrimaryClient: boolean; +} + +/** + * @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. + */ + +type Kind = 'memory' | 'persistent'; +interface ComponentConfiguration { + asyncQueue: AsyncQueue; + databaseInfo: DatabaseInfo; + authCredentials: CredentialsProvider<User>; + appCheckCredentials: CredentialsProvider<string>; + clientId: ClientId; + initialUser: User; + maxConcurrentLimboResolutions: number; +} +interface OfflineComponentProviderFactory { + build(onlineComponents: OnlineComponentProvider): OfflineComponentProvider; +} +/** + * Initializes and wires components that are needed to interface with the local + * cache. Implementations override `initialize()` to provide all components. + */ +interface OfflineComponentProvider { + readonly kind: Kind; + persistence: Persistence; + sharedClientState: SharedClientState; + localStore: LocalStore; + gcScheduler: Scheduler | null; + indexBackfillerScheduler: Scheduler | null; + synchronizeTabs: boolean; + initialize(cfg: ComponentConfiguration): Promise<void>; + terminate(): Promise<void>; +} +interface OnlineComponentProviderFactory { + build(): OnlineComponentProvider; +} +/** + * Initializes and wires the components that are needed to interface with the + * network. + */ +declare class OnlineComponentProvider { + static readonly provider: OnlineComponentProviderFactory; + protected localStore: LocalStore; + protected sharedClientState: SharedClientState; + datastore: Datastore; + eventManager: EventManager; + remoteStore: RemoteStore; + syncEngine: SyncEngine; + initialize(offlineComponentProvider: OfflineComponentProvider, cfg: ComponentConfiguration): Promise<void>; + createEventManager(cfg: ComponentConfiguration): EventManager; + createDatastore(cfg: ComponentConfiguration): Datastore; + createRemoteStore(cfg: ComponentConfiguration): RemoteStore; + createSyncEngine(cfg: ComponentConfiguration, startAsPrimary: boolean): SyncEngine; + terminate(): Promise<void>; +} + +/** + * @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. + */ + +/** + * Represents the state of bundle loading tasks. + * + * Both 'Error' and 'Success' are sinking state: task will abort or complete and there will + * be no more updates after they are reported. + */ +type TaskState = 'Error' | 'Running' | 'Success'; +/** + * Represents a progress update or a final state from loading bundles. + */ +interface LoadBundleTaskProgress { + /** How many documents have been loaded. */ + documentsLoaded: number; + /** How many documents are in the bundle being loaded. */ + totalDocuments: number; + /** How many bytes have been loaded. */ + bytesLoaded: number; + /** How many bytes are in the bundle being loaded. */ + totalBytes: number; + /** Current task state. */ + taskState: TaskState; +} +/** + * Represents the task of loading a Firestore bundle. It provides progress of bundle + * loading, as well as task completion and error events. + * + * The API is compatible with `Promise<LoadBundleTaskProgress>`. + */ +declare class LoadBundleTask implements PromiseLike<LoadBundleTaskProgress> { + private _progressObserver; + private _taskCompletionResolver; + private _lastProgress; + /** + * Registers functions to listen to bundle loading progress events. + * @param next - Called when there is a progress update from bundle loading. Typically `next` calls occur + * each time a Firestore document is loaded from the bundle. + * @param error - Called when an error occurs during bundle loading. The task aborts after reporting the + * error, and there should be no more updates after this. + * @param complete - Called when the loading task is complete. + */ + onProgress(next?: (progress: LoadBundleTaskProgress) => unknown, error?: (err: Error) => unknown, complete?: () => void): void; + /** + * Implements the `Promise<LoadBundleTaskProgress>.catch` interface. + * + * @param onRejected - Called when an error occurs during bundle loading. + */ + catch<R>(onRejected: (a: Error) => R | PromiseLike<R>): Promise<R | LoadBundleTaskProgress>; + /** + * Implements the `Promise<LoadBundleTaskProgress>.then` interface. + * + * @param onFulfilled - Called on the completion of the loading task with a final `LoadBundleTaskProgress` update. + * The update will always have its `taskState` set to `"Success"`. + * @param onRejected - Called when an error occurs during bundle loading. + */ + then<T, R>(onFulfilled?: (a: LoadBundleTaskProgress) => T | PromiseLike<T>, onRejected?: (a: Error) => R | PromiseLike<R>): Promise<T | R>; + /** + * Notifies all observers that bundle loading has completed, with a provided + * `LoadBundleTaskProgress` object. + * + * @private + */ + _completeWith(progress: LoadBundleTaskProgress): void; + /** + * Notifies all observers that bundle loading has failed, with a provided + * `Error` as the reason. + * + * @private + */ + _failWith(error: FirestoreError$1): void; + /** + * Notifies a progress update of loading a bundle. + * @param progress - The new progress. + * + * @private + */ + _updateProgress(progress: LoadBundleTaskProgress): void; +} + +/** + * @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. + */ + +interface ParseContext { + readonly databaseId: DatabaseId; + readonly ignoreUndefinedProperties: boolean; +} + +/** + * @license + * Copyright 2023 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. + */ + +/** + * Provides an in-memory cache to the SDK. This is the default cache unless explicitly + * configured otherwise. + * + * To use, create an instance using the factory function {@link memoryLocalCache()}, then + * set the instance to `FirestoreSettings.cache` and call `initializeFirestore` using + * the settings object. + */ +type MemoryLocalCache = { + kind: 'memory'; + /** + * @internal + */ + _onlineComponentProvider: OnlineComponentProviderFactory; + /** + * @internal + */ + _offlineComponentProvider: OfflineComponentProviderFactory; +}; +/** + * Provides a persistent cache backed by IndexedDb to the SDK. + * + * To use, create an instance using the factory function {@link persistentLocalCache()}, then + * set the instance to `FirestoreSettings.cache` and call `initializeFirestore` using + * the settings object. + */ +type PersistentLocalCache = { + kind: 'persistent'; + /** + * @internal + */ + _onlineComponentProvider: OnlineComponentProviderFactory; + /** + * @internal + */ + _offlineComponentProvider: OfflineComponentProviderFactory; +}; +/** + * Union type from all supported SDK cache layer. + */ +type FirestoreLocalCache = MemoryLocalCache | PersistentLocalCache; +/** + * Union type from all support garbage collectors for memory local cache. + */ +type MemoryGarbageCollector = MemoryEagerGarbageCollector | MemoryLruGarbageCollector; +/** + * A garbage collector deletes documents whenever they are not part of any + * active queries, and have no local mutations attached to them. + * + * This collector tries to ensure lowest memory footprints from the SDK, + * at the risk of documents not being cached for offline queries or for + * direct queries to the cache. + * + * Use factory function {@link memoryEagerGarbageCollector()} to create an + * instance of this collector. + */ +type MemoryEagerGarbageCollector = { + kind: 'memoryEager'; + /** + * @internal + */ + _offlineComponentProvider: OfflineComponentProviderFactory; +}; +/** + * A garbage collector deletes Least-Recently-Used documents in multiple + * batches. + * + * This collector is configured with a target size, and will only perform + * collection when the cached documents exceed the target size. It avoids + * querying backend repeated for the same query or document, at the risk + * of having a larger memory footprint. + * + * Use factory function {@link memoryLruGarbageCollector()} to create a + * instance of this collector. + */ +type MemoryLruGarbageCollector = { + kind: 'memoryLru'; + /** + * @internal + */ + _offlineComponentProvider: OfflineComponentProviderFactory; +}; +/** + * Creates an instance of `MemoryEagerGarbageCollector`. This is also the + * default garbage collector unless it is explicitly specified otherwise. + */ +declare function memoryEagerGarbageCollector(): MemoryEagerGarbageCollector; +/** + * Creates an instance of `MemoryLruGarbageCollector`. + * + * A target size can be specified as part of the setting parameter. The + * collector will start deleting documents once the cache size exceeds + * the given size. The default cache size is 40MB (40 * 1024 * 1024 bytes). + */ +declare function memoryLruGarbageCollector(settings?: { + cacheSizeBytes?: number; +}): MemoryLruGarbageCollector; +/** + * An settings object to configure an `MemoryLocalCache` instance. + */ +type MemoryCacheSettings = { + /** + * The garbage collector to use, for the memory cache layer. + * A `MemoryEagerGarbageCollector` is used when this is undefined. + */ + garbageCollector?: MemoryGarbageCollector; +}; +/** + * Creates an instance of `MemoryLocalCache`. The instance can be set to + * `FirestoreSettings.cache` to tell the SDK which cache layer to use. + */ +declare function memoryLocalCache(settings?: MemoryCacheSettings): MemoryLocalCache; +/** + * An settings object to configure an `PersistentLocalCache` instance. + * + * Persistent cache cannot be used in a Node.js environment. + */ +type PersistentCacheSettings = { + /** + * An approximate cache size threshold for the on-disk data. If the cache + * grows beyond this size, Firestore will start removing data that hasn't been + * recently used. The SDK does not guarantee that the cache will stay below + * that size, only that if the cache exceeds the given size, cleanup will be + * attempted. + * + * The default value is 40 MB. The threshold must be set to at least 1 MB, and + * can be set to `CACHE_SIZE_UNLIMITED` to disable garbage collection. + */ + cacheSizeBytes?: number; + /** + * Specifies how multiple tabs/windows will be managed by the SDK. + */ + tabManager?: PersistentTabManager; +}; +/** + * Creates an instance of `PersistentLocalCache`. The instance can be set to + * `FirestoreSettings.cache` to tell the SDK which cache layer to use. + * + * Persistent cache cannot be used in a Node.js environment. + */ +declare function persistentLocalCache(settings?: PersistentCacheSettings): PersistentLocalCache; +/** + * A tab manager supporting only one tab, no synchronization will be + * performed across tabs. + */ +type PersistentSingleTabManager = { + kind: 'persistentSingleTab'; + /** + * @internal + */ + _initialize: (settings: Omit<PersistentCacheSettings, 'tabManager'> | undefined) => void; + /** + * @internal + */ + _onlineComponentProvider?: OnlineComponentProviderFactory; + /** + * @internal + */ + _offlineComponentProvider?: OfflineComponentProviderFactory; +}; +/** + * A tab manager supporting multiple tabs. SDK will synchronize queries and + * mutations done across all tabs using the SDK. + */ +type PersistentMultipleTabManager = { + kind: 'PersistentMultipleTab'; + /** + * @internal + */ + _initialize: (settings: Omit<PersistentCacheSettings, 'tabManager'>) => void; + /** + * @internal + */ + _onlineComponentProvider?: OnlineComponentProviderFactory; + /** + * @internal + */ + _offlineComponentProvider?: OfflineComponentProviderFactory; +}; +/** + * A union of all available tab managers. + */ +type PersistentTabManager = PersistentSingleTabManager | PersistentMultipleTabManager; +/** + * Type to configure an `PersistentSingleTabManager` instance. + */ +type PersistentSingleTabManagerSettings = { + /** + * Whether to force-enable persistent (IndexedDB) cache for the client. This + * cannot be used with multi-tab synchronization and is primarily intended for + * use with Web Workers. Setting this to `true` will enable IndexedDB, but cause + * other tabs using IndexedDB cache to fail. + */ + forceOwnership?: boolean; +}; +/** + * Creates an instance of `PersistentSingleTabManager`. + * + * @param settings Configures the created tab manager. + */ +declare function persistentSingleTabManager(settings: PersistentSingleTabManagerSettings | undefined): PersistentSingleTabManager; +/** + * Creates an instance of `PersistentMultipleTabManager`. + */ +declare function persistentMultipleTabManager(): PersistentMultipleTabManager; + +/** + * @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. + */ + +/** + * Specifies custom configurations for your Cloud Firestore instance. + * You must set these before invoking any other methods. + */ +interface FirestoreSettings$1 { + /** The hostname to connect to. */ + host?: string; + /** Whether to use SSL when connecting. */ + ssl?: boolean; + /** + * Whether to skip nested properties that are set to `undefined` during + * object serialization. If set to `true`, these properties are skipped + * and not written to Firestore. If set to `false` or omitted, the SDK + * throws an exception when it encounters properties of type `undefined`. + */ + ignoreUndefinedProperties?: boolean; +} +/** + * @internal + * Undocumented, private additional settings not exposed in our public API. + */ +interface PrivateSettings extends FirestoreSettings$1 { + credentials?: CredentialsSettings; + cacheSizeBytes?: number; + experimentalForceLongPolling?: boolean; + experimentalAutoDetectLongPolling?: boolean; + experimentalLongPollingOptions?: ExperimentalLongPollingOptions; + useFetchStreams?: boolean; + emulatorOptions?: { + mockUserToken?: EmulatorMockTokenOptions | string; + }; + localCache?: FirestoreLocalCache; +} +/** + * A concrete type describing all the values that can be applied via a + * user-supplied `FirestoreSettings` object. This is a separate type so that + * defaults can be supplied and the value can be checked for equality. + */ +declare class FirestoreSettingsImpl { + /** The hostname to connect to. */ + readonly host: string; + /** Whether to use SSL when connecting. */ + readonly ssl: boolean; + readonly cacheSizeBytes: number; + readonly experimentalForceLongPolling: boolean; + readonly experimentalAutoDetectLongPolling: boolean; + readonly experimentalLongPollingOptions: ExperimentalLongPollingOptions; + readonly ignoreUndefinedProperties: boolean; + readonly useFetchStreams: boolean; + readonly localCache?: FirestoreLocalCache; + readonly isUsingEmulator: boolean; + credentials?: any; + constructor(settings: PrivateSettings); + isEqual(other: FirestoreSettingsImpl): boolean; +} + +/** + * @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. + */ + +/** + * An interface implemented by FirebaseFirestore that provides compatibility + * with the usage in this file. + * + * This interface mainly exists to remove a cyclic dependency. + */ +interface FirestoreService extends _FirebaseService { + _authCredentials: CredentialsProvider<User>; + _appCheckCredentials: CredentialsProvider<string>; + _persistenceKey: string; + _databaseId: DatabaseId; + _terminated: boolean; + _freezeSettings(): FirestoreSettingsImpl; +} + +/** + * @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. + */ + +declare module '@firebase/component' { + interface NameServiceMapping { + 'firestore/lite': Firestore$1; + } +} +/** + * The Cloud Firestore service interface. + * + * Do not call this constructor directly. Instead, use {@link (getFirestore:1)}. + */ +declare class Firestore$1 implements FirestoreService { + _authCredentials: CredentialsProvider<User>; + _appCheckCredentials: CredentialsProvider<string>; + readonly _databaseId: DatabaseId; + readonly _app?: FirebaseApp | undefined; + /** + * Whether it's a Firestore or Firestore Lite instance. + */ + type: 'firestore-lite' | 'firestore'; + readonly _persistenceKey: string; + private _settings; + private _settingsFrozen; + private _emulatorOptions; + private _terminateTask; + /** @hideconstructor */ + constructor(_authCredentials: CredentialsProvider<User>, _appCheckCredentials: CredentialsProvider<string>, _databaseId: DatabaseId, _app?: FirebaseApp | undefined); + /** + * The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service + * instance. + */ + get app(): FirebaseApp; + get _initialized(): boolean; + get _terminated(): boolean; + _setSettings(settings: PrivateSettings): void; + _getSettings(): FirestoreSettingsImpl; + _getEmulatorOptions(): { + mockUserToken?: EmulatorMockTokenOptions | string; + }; + _freezeSettings(): FirestoreSettingsImpl; + _delete(): Promise<void>; + _restart(): Promise<void>; + /** Returns a JSON-serializable representation of this `Firestore` instance. */ + toJSON(): object; + /** + * Terminates all components used by this client. Subclasses can override + * this method to clean up their own dependencies, but must also call this + * method. + * + * Only ever called once. + */ + protected _terminate(): Promise<void>; +} +/** + * Modify this instance to communicate with the Cloud Firestore emulator. + * + * Note: This must be called before this instance has been used to do any + * operations. + * + * @param firestore - The `Firestore` instance to configure to connect to the + * emulator. + * @param host - the emulator host (ex: localhost). + * @param port - the emulator port (ex: 9000). + * @param options.mockUserToken - the mock auth token to use for unit testing + * Security Rules. + */ +declare function connectFirestoreEmulator(firestore: Firestore$1, host: string, port: number, options?: { + mockUserToken?: EmulatorMockTokenOptions | string; +}): void; + +/** + * @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. + */ + +/** + * Sentinel values that can be used when writing document fields with `set()` + * or `update()`. + */ +declare abstract class FieldValue { + _methodName: string; + /** + * @param _methodName - The public API endpoint that returns this class. + * @hideconstructor + */ + constructor(_methodName: string); + /** Compares `FieldValue`s for equality. */ + abstract isEqual(other: FieldValue): boolean; + abstract _toFieldTransform(context: ParseContext): FieldTransform | null; +} + +/** + * @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. + */ + +/** + * A `FieldPath` refers to a field in a document. The path may consist of a + * single field name (referring to a top-level field in the document), or a + * list of field names (referring to a nested field in the document). + * + * Create a `FieldPath` by providing field names. If more than one field + * name is provided, the path will point to a nested field in a document. + */ +declare class FieldPath { + /** Internal representation of a Firestore field path. */ + readonly _internalPath: FieldPath$2; + /** + * Creates a `FieldPath` from the provided field names. If more than one field + * name is provided, the path will point to a nested field in a document. + * + * @param fieldNames - A list of field names. + */ + constructor(...fieldNames: string[]); + /** + * Returns true if this `FieldPath` is equal to the provided one. + * + * @param other - The `FieldPath` to compare against. + * @returns true if this `FieldPath` is equal to the provided one. + */ + isEqual(other: FieldPath): boolean; +} +/** + * Returns a special sentinel `FieldPath` to refer to the ID of a document. + * It can be used in queries to sort or filter by the document ID. + */ +declare function documentId(): FieldPath; + +/** + * @license + * Copyright 2024 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. + */ + +/** + * Represents a vector type in Firestore documents. + * Create an instance with <code>{@link vector}</code>. + * + * @class VectorValue + */ +declare class VectorValue { + private readonly _values; + /** + * @private + * @internal + */ + constructor(values: number[] | undefined); + /** + * Returns a copy of the raw number array form of the vector. + */ + toArray(): number[]; + /** + * Returns `true` if the two `VectorValue` values have the same raw number arrays, returns `false` otherwise. + */ + isEqual(other: VectorValue): boolean; + static _jsonSchemaVersion: string; + static _jsonSchema: { + type: Property<"string">; + vectorValues: Property<"object">; + }; + /** + * Returns a JSON-serializable representation of this `VectorValue` instance. + * + * @returns a JSON representation of this object. + */ + toJSON(): object; + /** + * Builds a `VectorValue` instance from a JSON object created by {@link VectorValue.toJSON}. + * + * @param json a JSON object represention of a `VectorValue` instance. + * @returns an instance of {@link VectorValue} if the JSON object could be parsed. Throws a + * {@link FirestoreError} if an error occurs. + */ + static fromJSON(json: object): VectorValue; +} + +/** + * @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. + */ + +type ServerTimestampBehavior = 'estimate' | 'previous' | 'none'; +/** + * Converts Firestore's internal types to the JavaScript types that we expose + * to the user. + * + * @internal + */ +declare abstract class AbstractUserDataWriter { + convertValue(value: Value, serverTimestampBehavior?: ServerTimestampBehavior): unknown; + private convertObject; + /** + * @internal + */ + convertObjectMap(fields: ApiClientObjectMap<Value> | undefined, serverTimestampBehavior?: ServerTimestampBehavior): DocumentData$1; + /** + * @internal + */ + convertVectorValue(mapValue: MapValue): VectorValue; + private convertGeoPoint; + private convertArray; + private convertServerTimestamp; + private convertTimestamp; + protected convertDocumentKey(name: string, expectedDatabaseId: DatabaseId): DocumentKey; + protected abstract convertReference(name: string): unknown; + protected abstract convertBytes(bytes: ByteString): unknown; +} + +/** + * @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. + */ + +/** + * Converter used by `withConverter()` to transform user objects of type + * `AppModelType` into Firestore data of type `DbModelType`. + * + * Using the converter allows you to specify generic type arguments when + * storing and retrieving objects from Firestore. + * + * In this context, an "AppModel" is a class that is used in an application to + * package together related information and functionality. Such a class could, + * for example, have properties with complex, nested data types, properties used + * for memoization, properties of types not supported by Firestore (such as + * `symbol` and `bigint`), and helper functions that perform compound + * operations. Such classes are not suitable and/or possible to store into a + * Firestore database. Instead, instances of such classes need to be converted + * to "plain old JavaScript objects" (POJOs) with exclusively primitive + * properties, potentially nested inside other POJOs or arrays of POJOs. In this + * context, this type is referred to as the "DbModel" and would be an object + * suitable for persisting into Firestore. For convenience, applications can + * implement `FirestoreDataConverter` and register the converter with Firestore + * objects, such as `DocumentReference` or `Query`, to automatically convert + * `AppModel` to `DbModel` when storing into Firestore, and convert `DbModel` + * to `AppModel` when retrieving from Firestore. + * + * @example + * + * Simple Example + * + * ```typescript + * const numberConverter = { + * toFirestore(value: WithFieldValue<number>) { + * return { value }; + * }, + * fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions) { + * return snapshot.data(options).value as number; + * } + * }; + * + * async function simpleDemo(db: Firestore): Promise<void> { + * const documentRef = doc(db, 'values/value123').withConverter(numberConverter); + * + * // converters are used with `setDoc`, `addDoc`, and `getDoc` + * await setDoc(documentRef, 42); + * const snapshot1 = await getDoc(documentRef); + * assertEqual(snapshot1.data(), 42); + * + * // converters are not used when writing data with `updateDoc` + * await updateDoc(documentRef, { value: 999 }); + * const snapshot2 = await getDoc(documentRef); + * assertEqual(snapshot2.data(), 999); + * } + * ``` + * + * Advanced Example + * + * ```typescript + * // The Post class is a model that is used by our application. + * // This class may have properties and methods that are specific + * // to our application execution, which do not need to be persisted + * // to Firestore. + * class Post { + * constructor( + * readonly title: string, + * readonly author: string, + * readonly lastUpdatedMillis: number + * ) {} + * toString(): string { + * return `${this.title} by ${this.author}`; + * } + * } + * + * // The PostDbModel represents how we want our posts to be stored + * // in Firestore. This DbModel has different properties (`ttl`, + * // `aut`, and `lut`) from the Post class we use in our application. + * interface PostDbModel { + * ttl: string; + * aut: { firstName: string; lastName: string }; + * lut: Timestamp; + * } + * + * // The `PostConverter` implements `FirestoreDataConverter` and specifies + * // how the Firestore SDK can convert `Post` objects to `PostDbModel` + * // objects and vice versa. + * class PostConverter implements FirestoreDataConverter<Post, PostDbModel> { + * toFirestore(post: WithFieldValue<Post>): WithFieldValue<PostDbModel> { + * return { + * ttl: post.title, + * aut: this._autFromAuthor(post.author), + * lut: this._lutFromLastUpdatedMillis(post.lastUpdatedMillis) + * }; + * } + * + * fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions): Post { + * const data = snapshot.data(options) as PostDbModel; + * const author = `${data.aut.firstName} ${data.aut.lastName}`; + * return new Post(data.ttl, author, data.lut.toMillis()); + * } + * + * _autFromAuthor( + * author: string | FieldValue + * ): { firstName: string; lastName: string } | FieldValue { + * if (typeof author !== 'string') { + * // `author` is a FieldValue, so just return it. + * return author; + * } + * const [firstName, lastName] = author.split(' '); + * return {firstName, lastName}; + * } + * + * _lutFromLastUpdatedMillis( + * lastUpdatedMillis: number | FieldValue + * ): Timestamp | FieldValue { + * if (typeof lastUpdatedMillis !== 'number') { + * // `lastUpdatedMillis` must be a FieldValue, so just return it. + * return lastUpdatedMillis; + * } + * return Timestamp.fromMillis(lastUpdatedMillis); + * } + * } + * + * async function advancedDemo(db: Firestore): Promise<void> { + * // Create a `DocumentReference` with a `FirestoreDataConverter`. + * const documentRef = doc(db, 'posts/post123').withConverter(new PostConverter()); + * + * // The `data` argument specified to `setDoc()` is type checked by the + * // TypeScript compiler to be compatible with `Post`. Since the `data` + * // argument is typed as `WithFieldValue<Post>` rather than just `Post`, + * // this allows properties of the `data` argument to also be special + * // Firestore values that perform server-side mutations, such as + * // `arrayRemove()`, `deleteField()`, and `serverTimestamp()`. + * await setDoc(documentRef, { + * title: 'My Life', + * author: 'Foo Bar', + * lastUpdatedMillis: serverTimestamp() + * }); + * + * // The TypeScript compiler will fail to compile if the `data` argument to + * // `setDoc()` is _not_ compatible with `WithFieldValue<Post>`. This + * // type checking prevents the caller from specifying objects with incorrect + * // properties or property values. + * // @ts-expect-error "Argument of type { ttl: string; } is not assignable + * // to parameter of type WithFieldValue<Post>" + * await setDoc(documentRef, { ttl: 'The Title' }); + * + * // When retrieving a document with `getDoc()` the `DocumentSnapshot` + * // object's `data()` method returns a `Post`, rather than a generic object, + * // which would have been returned if the `DocumentReference` did _not_ have a + * // `FirestoreDataConverter` attached to it. + * const snapshot1: DocumentSnapshot<Post> = await getDoc(documentRef); + * const post1: Post = snapshot1.data()!; + * if (post1) { + * assertEqual(post1.title, 'My Life'); + * assertEqual(post1.author, 'Foo Bar'); + * } + * + * // The `data` argument specified to `updateDoc()` is type checked by the + * // TypeScript compiler to be compatible with `PostDbModel`. Note that + * // unlike `setDoc()`, whose `data` argument must be compatible with `Post`, + * // the `data` argument to `updateDoc()` must be compatible with + * // `PostDbModel`. Similar to `setDoc()`, since the `data` argument is typed + * // as `WithFieldValue<PostDbModel>` rather than just `PostDbModel`, this + * // allows properties of the `data` argument to also be those special + * // Firestore values, like `arrayRemove()`, `deleteField()`, and + * // `serverTimestamp()`. + * await updateDoc(documentRef, { + * 'aut.firstName': 'NewFirstName', + * lut: serverTimestamp() + * }); + * + * // The TypeScript compiler will fail to compile if the `data` argument to + * // `updateDoc()` is _not_ compatible with `WithFieldValue<PostDbModel>`. + * // This type checking prevents the caller from specifying objects with + * // incorrect properties or property values. + * // @ts-expect-error "Argument of type { title: string; } is not assignable + * // to parameter of type WithFieldValue<PostDbModel>" + * await updateDoc(documentRef, { title: 'New Title' }); + * const snapshot2: DocumentSnapshot<Post> = await getDoc(documentRef); + * const post2: Post = snapshot2.data()!; + * if (post2) { + * assertEqual(post2.title, 'My Life'); + * assertEqual(post2.author, 'NewFirstName Bar'); + * } + * } + * ``` + */ +interface FirestoreDataConverter$1<AppModelType, DbModelType extends DocumentData = DocumentData> { + /** + * Called by the Firestore SDK to convert a custom model object of type + * `AppModelType` into a plain JavaScript object (suitable for writing + * directly to the Firestore database) of type `DbModelType`. Used with + * {@link @firebase/firestore/lite#(setDoc:1)}, + * {@link @firebase/firestore/lite#(WriteBatch.set:1)} and + * {@link @firebase/firestore/lite#(Transaction.set:1)}. + * + * The `WithFieldValue<T>` type extends `T` to also allow FieldValues such as + * {@link (deleteField:1)} to be used as property values. + */ + toFirestore(modelObject: WithFieldValue<AppModelType>): WithFieldValue<DbModelType>; + /** + * Called by the Firestore SDK to convert a custom model object of type + * `AppModelType` into a plain JavaScript object (suitable for writing + * directly to the Firestore database) of type `DbModelType`. Used with + * {@link @firebase/firestore/lite#(setDoc:1)}, + * {@link @firebase/firestore/lite#(WriteBatch.set:1)} and + * {@link @firebase/firestore/lite#(Transaction.set:1)} with `merge:true` + * or `mergeFields`. + * + * The `PartialWithFieldValue<T>` type extends `Partial<T>` to allow + * FieldValues such as {@link (arrayUnion:1)} to be used as property values. + * It also supports nested `Partial` by allowing nested fields to be + * omitted. + */ + toFirestore(modelObject: PartialWithFieldValue<AppModelType>, options: SetOptions): PartialWithFieldValue<DbModelType>; + /** + * Called by the Firestore SDK to convert Firestore data into an object of + * type `AppModelType`. You can access your data by calling: + * `snapshot.data()`. + * + * + * Generally, the data returned from `snapshot.data()` can be cast to + * `DbModelType`; however, this is not guaranteed because Firestore does not + * enforce a schema on the database. For example, writes from a previous + * version of the application or writes from another client that did not use a + * type converter could have written data with different properties and/or + * property types. The implementation will need to choose whether to + * gracefully recover from non-conforming data or throw an error. + * + * @param snapshot - A `QueryDocumentSnapshot` containing your data and + * metadata. + */ + fromFirestore(snapshot: QueryDocumentSnapshot$1<DocumentData, DocumentData>): AppModelType; +} +/** + * A `DocumentSnapshot` contains data read from a document in your Firestore + * database. The data can be extracted with `.data()` or `.get(<field>)` to + * get a specific field. + * + * For a `DocumentSnapshot` that points to a non-existing document, any data + * access will return 'undefined'. You can use the `exists()` method to + * explicitly verify a document's existence. + */ +declare class DocumentSnapshot$1<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> { + _firestore: Firestore$1; + _userDataWriter: AbstractUserDataWriter; + _key: DocumentKey; + _document: Document | null; + _converter: UntypedFirestoreDataConverter<AppModelType, DbModelType> | null; + /** @hideconstructor protected */ + constructor(_firestore: Firestore$1, _userDataWriter: AbstractUserDataWriter, _key: DocumentKey, _document: Document | null, _converter: UntypedFirestoreDataConverter<AppModelType, DbModelType> | null); + /** Property of the `DocumentSnapshot` that provides the document's ID. */ + get id(): string; + /** + * The `DocumentReference` for the document included in the `DocumentSnapshot`. + */ + get ref(): DocumentReference<AppModelType, DbModelType>; + /** + * Signals whether or not the document at the snapshot's location exists. + * + * @returns true if the document exists. + */ + exists(): this is QueryDocumentSnapshot$1<AppModelType, DbModelType>; + /** + * Retrieves all fields in the document as an `Object`. Returns `undefined` if + * the document doesn't exist. + * + * @returns An `Object` containing all fields in the document or `undefined` + * if the document doesn't exist. + */ + data(): AppModelType | undefined; + /** + * Retrieves the field specified by `fieldPath`. Returns `undefined` if the + * document or field doesn't exist. + * + * @param fieldPath - The path (for example 'foo' or 'foo.bar') to a specific + * field. + * @returns The data at the specified field location or undefined if no such + * field exists in the document. + */ + get(fieldPath: string | FieldPath): any; +} +/** + * A `QueryDocumentSnapshot` contains data read from a document in your + * Firestore database as part of a query. The document is guaranteed to exist + * and its data can be extracted with `.data()` or `.get(<field>)` to get a + * specific field. + * + * A `QueryDocumentSnapshot` offers the same API surface as a + * `DocumentSnapshot`. Since query results contain only existing documents, the + * `exists` property will always be true and `data()` will never return + * 'undefined'. + */ +declare class QueryDocumentSnapshot$1<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> extends DocumentSnapshot$1<AppModelType, DbModelType> { + /** + * Retrieves all fields in the document as an `Object`. + * + * @override + * @returns An `Object` containing all fields in the document. + */ + data(): AppModelType; +} + +/** + * @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. + */ + +/** + * These types primarily exist to support the `UpdateData`, + * `WithFieldValue`, and `PartialWithFieldValue` types and are not consumed + * directly by the end developer. + */ +/** Primitive types. */ +type Primitive = string | number | boolean | undefined | null; +/** + * For each field (e.g. 'bar'), find all nested keys (e.g. {'bar.baz': T1, + * 'bar.qux': T2}). Intersect them together to make a single map containing + * all possible keys that are all marked as optional + */ +type NestedUpdateFields<T extends Record<string, unknown>> = UnionToIntersection<{ + [K in keyof T & string]: ChildUpdateFields<K, T[K]>; +}[keyof T & string]>; +/** + * Helper for calculating the nested fields for a given type T1. This is needed + * to distribute union types such as `undefined | {...}` (happens for optional + * props) or `{a: A} | {b: B}`. + * + * In this use case, `V` is used to distribute the union types of `T[K]` on + * `Record`, since `T[K]` is evaluated as an expression and not distributed. + * + * See https://www.typescriptlang.org/docs/handbook/advanced-types.html#distributive-conditional-types + */ +type ChildUpdateFields<K extends string, V> = V extends Record<string, unknown> ? AddPrefixToKeys<K, UpdateData<V>> : never; +/** + * Returns a new map where every key is prefixed with the outer key appended + * to a dot. + */ +type AddPrefixToKeys<Prefix extends string, T extends Record<string, unknown>> = { + [K in keyof T & string as `${Prefix}.${K}`]+?: string extends K ? any : T[K]; +}; +/** + * Given a union type `U = T1 | T2 | ...`, returns an intersected type + * `(T1 & T2 & ...)`. + * + * Uses distributive conditional types and inference from conditional types. + * This works because multiple candidates for the same type variable in + * contra-variant positions causes an intersection type to be inferred. + * https://www.typescriptlang.org/docs/handbook/advanced-types.html#type-inference-in-conditional-types + * https://stackoverflow.com/questions/50374908/transform-union-type-to-intersection-type + */ +type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never; + +/** + * @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. + */ + +/** + * Document data (for use with {@link @firebase/firestore/lite#(setDoc:1)}) consists of fields mapped to + * values. + */ +interface DocumentData { + /** A mapping between a field and its value. */ + [field: string]: any; +} +/** + * Similar to TypeScript's `Partial<T>`, but allows nested fields to be + * omitted and FieldValues to be passed in as property values. + */ +type PartialWithFieldValue<T> = Partial<T> | (T extends Primitive ? T : T extends {} ? { + [K in keyof T]?: PartialWithFieldValue<T[K]> | FieldValue; +} : never); +/** + * Allows FieldValues to be passed in as a property value while maintaining + * type safety. + */ +type WithFieldValue<T> = T | (T extends Primitive ? T : T extends {} ? { + [K in keyof T]: WithFieldValue<T[K]> | FieldValue; +} : never); +/** + * Update data (for use with {@link (updateDoc:1)}) that consists of field paths + * (e.g. 'foo' or 'foo.baz') mapped to values. Fields that contain dots + * reference nested fields within the document. FieldValues can be passed in + * as property values. + */ +type UpdateData<T> = T extends Primitive ? T : T extends {} ? { + [K in keyof T]?: UpdateData<T[K]> | FieldValue; +} & NestedUpdateFields<T> : Partial<T>; +/** + * An options object that configures the behavior of {@link @firebase/firestore/lite#(setDoc:1)}, {@link + * @firebase/firestore/lite#(WriteBatch.set:1)} and {@link @firebase/firestore/lite#(Transaction.set:1)} calls. These calls can be + * configured to perform granular merges instead of overwriting the target + * documents in their entirety by providing a `SetOptions` with `merge: true`. + * + * @param merge - Changes the behavior of a `setDoc()` call to only replace the + * values specified in its data argument. Fields omitted from the `setDoc()` + * call remain untouched. If your input sets any field to an empty map, all + * nested fields are overwritten. + * @param mergeFields - Changes the behavior of `setDoc()` calls to only replace + * the specified field paths. Any field path that is not specified is ignored + * and remains untouched. If your input sets any field to an empty map, all + * nested fields are overwritten. + */ +type SetOptions = { + readonly merge?: boolean; +} | { + readonly mergeFields?: Array<string | FieldPath>; +}; +/** + * A `Query` refers to a query which you can read or listen to. You can also + * construct refined `Query` objects by adding filters and ordering. + */ +declare class Query<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> { + /** + * If provided, the `FirestoreDataConverter` associated with this instance. + */ + readonly converter: FirestoreDataConverter$1<AppModelType, DbModelType> | null; + readonly _query: Query$2; + /** The type of this Firestore reference. */ + readonly type: 'query' | 'collection'; + /** + * The `Firestore` instance for the Firestore database (useful for performing + * transactions, etc.). + */ + readonly firestore: Firestore$1; + /** @hideconstructor protected */ + constructor(firestore: Firestore$1, + /** + * If provided, the `FirestoreDataConverter` associated with this instance. + */ + converter: FirestoreDataConverter$1<AppModelType, DbModelType> | null, _query: Query$2); + /** + * Removes the current converter. + * + * @param converter - `null` removes the current converter. + * @returns A `Query<DocumentData, DocumentData>` that does not use a + * converter. + */ + withConverter(converter: null): Query<DocumentData, DocumentData>; + /** + * Applies a custom data converter to this query, allowing you to use your own + * custom model objects with Firestore. When you call {@link getDocs} with + * the returned query, the provided converter will convert between Firestore + * data of type `NewDbModelType` and your custom type `NewAppModelType`. + * + * @param converter - Converts objects to and from Firestore. + * @returns A `Query` that uses the provided converter. + */ + withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter$1<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>; +} +/** + * A `DocumentReference` refers to a document location in a Firestore database + * and can be used to write, read, or listen to the location. The document at + * the referenced location may or may not exist. + */ +declare class DocumentReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> { + /** + * If provided, the `FirestoreDataConverter` associated with this instance. + */ + readonly converter: FirestoreDataConverter$1<AppModelType, DbModelType> | null; + readonly _key: DocumentKey; + /** The type of this Firestore reference. */ + readonly type = "document"; + /** + * The {@link Firestore} instance the document is in. + * This is useful for performing transactions, for example. + */ + readonly firestore: Firestore$1; + /** @hideconstructor */ + constructor(firestore: Firestore$1, + /** + * If provided, the `FirestoreDataConverter` associated with this instance. + */ + converter: FirestoreDataConverter$1<AppModelType, DbModelType> | null, _key: DocumentKey); + get _path(): ResourcePath; + /** + * The document's identifier within its collection. + */ + get id(): string; + /** + * A string representing the path of the referenced document (relative + * to the root of the database). + */ + get path(): string; + /** + * The collection this `DocumentReference` belongs to. + */ + get parent(): CollectionReference<AppModelType, DbModelType>; + /** + * Applies a custom data converter to this `DocumentReference`, allowing you + * to use your own custom model objects with Firestore. When you call {@link + * @firebase/firestore/lite#(setDoc:1)}, {@link @firebase/firestore/lite#getDoc}, etc. with the returned `DocumentReference` + * instance, the provided converter will convert between Firestore data of + * type `NewDbModelType` and your custom type `NewAppModelType`. + * + * @param converter - Converts objects to and from Firestore. + * @returns A `DocumentReference` that uses the provided converter. + */ + withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter$1<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>; + /** + * Removes the current converter. + * + * @param converter - `null` removes the current converter. + * @returns A `DocumentReference<DocumentData, DocumentData>` that does not + * use a converter. + */ + withConverter(converter: null): DocumentReference<DocumentData, DocumentData>; + static _jsonSchemaVersion: string; + static _jsonSchema: { + type: Property<"string">; + referencePath: Property<"string">; + }; + /** + * Returns a JSON-serializable representation of this `DocumentReference` instance. + * + * @returns a JSON representation of this object. + */ + toJSON(): object; + /** + * Builds a `DocumentReference` instance from a JSON object created by + * {@link DocumentReference.toJSON}. + * + * @param firestore - The {@link Firestore} instance the snapshot should be loaded for. + * @param json a JSON object represention of a `DocumentReference` instance + * @returns an instance of {@link DocumentReference} if the JSON object could be parsed. Throws a + * {@link FirestoreError} if an error occurs. + */ + static fromJSON(firestore: Firestore$1, json: object): DocumentReference; + /** + * Builds a `DocumentReference` instance from a JSON object created by + * {@link DocumentReference.toJSON}. + * + * @param firestore - The {@link Firestore} instance the snapshot should be loaded for. + * @param json a JSON object represention of a `DocumentReference` instance + * @param converter - Converts objects to and from Firestore. + * @returns an instance of {@link DocumentReference} if the JSON object could be parsed. Throws a + * {@link FirestoreError} if an error occurs. + */ + static fromJSON<NewAppModelType = DocumentData, NewDbModelType extends DocumentData = DocumentData>(firestore: Firestore$1, json: object, converter: FirestoreDataConverter$1<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>; +} +/** + * A `CollectionReference` object can be used for adding documents, getting + * document references, and querying for documents (using {@link (query:1)}). + */ +declare class CollectionReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> extends Query<AppModelType, DbModelType> { + readonly _path: ResourcePath; + /** The type of this Firestore reference. */ + readonly type = "collection"; + /** @hideconstructor */ + constructor(firestore: Firestore$1, converter: FirestoreDataConverter$1<AppModelType, DbModelType> | null, _path: ResourcePath); + /** The collection's identifier. */ + get id(): string; + /** + * A string representing the path of the referenced collection (relative + * to the root of the database). + */ + get path(): string; + /** + * A reference to the containing `DocumentReference` if this is a + * subcollection. If this isn't a subcollection, the reference is null. + */ + get parent(): DocumentReference<DocumentData, DocumentData> | null; + /** + * Applies a custom data converter to this `CollectionReference`, allowing you + * to use your own custom model objects with Firestore. When you call {@link + * addDoc} with the returned `CollectionReference` instance, the provided + * converter will convert between Firestore data of type `NewDbModelType` and + * your custom type `NewAppModelType`. + * + * @param converter - Converts objects to and from Firestore. + * @returns A `CollectionReference` that uses the provided converter. + */ + withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter$1<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>; + /** + * Removes the current converter. + * + * @param converter - `null` removes the current converter. + * @returns A `CollectionReference<DocumentData, DocumentData>` that does not + * use a converter. + */ + withConverter(converter: null): CollectionReference<DocumentData, DocumentData>; +} +/** + * Gets a `CollectionReference` instance that refers to the collection at + * the specified absolute path. + * + * @param firestore - A reference to the root `Firestore` instance. + * @param path - A slash-separated path to a collection. + * @param pathSegments - Additional path segments to apply relative to the first + * argument. + * @throws If the final path has an even number of segments and does not point + * to a collection. + * @returns The `CollectionReference` instance. + */ +declare function collection(firestore: Firestore$1, path: string, ...pathSegments: string[]): CollectionReference<DocumentData, DocumentData>; +/** + * Gets a `CollectionReference` instance that refers to a subcollection of + * `reference` at the specified relative path. + * + * @param reference - A reference to a collection. + * @param path - A slash-separated path to a collection. + * @param pathSegments - Additional path segments to apply relative to the first + * argument. + * @throws If the final path has an even number of segments and does not point + * to a collection. + * @returns The `CollectionReference` instance. + */ +declare function collection<AppModelType, DbModelType extends DocumentData>(reference: CollectionReference<AppModelType, DbModelType>, path: string, ...pathSegments: string[]): CollectionReference<DocumentData, DocumentData>; +/** + * Gets a `CollectionReference` instance that refers to a subcollection of + * `reference` at the specified relative path. + * + * @param reference - A reference to a Firestore document. + * @param path - A slash-separated path to a collection. + * @param pathSegments - Additional path segments that will be applied relative + * to the first argument. + * @throws If the final path has an even number of segments and does not point + * to a collection. + * @returns The `CollectionReference` instance. + */ +declare function collection<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, path: string, ...pathSegments: string[]): CollectionReference<DocumentData, DocumentData>; +/** + * Creates and returns a new `Query` instance that includes all documents in the + * database that are contained in a collection or subcollection with the + * given `collectionId`. + * + * @param firestore - A reference to the root `Firestore` instance. + * @param collectionId - Identifies the collections to query over. Every + * collection or subcollection with this ID as the last segment of its path + * will be included. Cannot contain a slash. + * @returns The created `Query`. + */ +declare function collectionGroup(firestore: Firestore$1, collectionId: string): Query<DocumentData, DocumentData>; +/** + * Gets a `DocumentReference` instance that refers to the document at the + * specified absolute path. + * + * @param firestore - A reference to the root `Firestore` instance. + * @param path - A slash-separated path to a document. + * @param pathSegments - Additional path segments that will be applied relative + * to the first argument. + * @throws If the final path has an odd number of segments and does not point to + * a document. + * @returns The `DocumentReference` instance. + */ +declare function doc(firestore: Firestore$1, path: string, ...pathSegments: string[]): DocumentReference<DocumentData, DocumentData>; +/** + * Gets a `DocumentReference` instance that refers to a document within + * `reference` at the specified relative path. If no path is specified, an + * automatically-generated unique ID will be used for the returned + * `DocumentReference`. + * + * @param reference - A reference to a collection. + * @param path - A slash-separated path to a document. Has to be omitted to use + * auto-generated IDs. + * @param pathSegments - Additional path segments that will be applied relative + * to the first argument. + * @throws If the final path has an odd number of segments and does not point to + * a document. + * @returns The `DocumentReference` instance. + */ +declare function doc<AppModelType, DbModelType extends DocumentData>(reference: CollectionReference<AppModelType, DbModelType>, path?: string, ...pathSegments: string[]): DocumentReference<AppModelType, DbModelType>; +/** + * Gets a `DocumentReference` instance that refers to a document within + * `reference` at the specified relative path. + * + * @param reference - A reference to a Firestore document. + * @param path - A slash-separated path to a document. + * @param pathSegments - Additional path segments that will be applied relative + * to the first argument. + * @throws If the final path has an odd number of segments and does not point to + * a document. + * @returns The `DocumentReference` instance. + */ +declare function doc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, path: string, ...pathSegments: string[]): DocumentReference<DocumentData, DocumentData>; +/** + * Returns true if the provided references are equal. + * + * @param left - A reference to compare. + * @param right - A reference to compare. + * @returns true if the references point to the same location in the same + * Firestore database. + */ +declare function refEqual<AppModelType, DbModelType extends DocumentData>(left: DocumentReference<AppModelType, DbModelType> | CollectionReference<AppModelType, DbModelType>, right: DocumentReference<AppModelType, DbModelType> | CollectionReference<AppModelType, DbModelType>): boolean; +/** + * Returns true if the provided queries point to the same collection and apply + * the same constraints. + * + * @param left - A `Query` to compare. + * @param right - A `Query` to compare. + * @returns true if the references point to the same location in the same + * Firestore database. + */ +declare function queryEqual<AppModelType, DbModelType extends DocumentData>(left: Query<AppModelType, DbModelType>, right: Query<AppModelType, DbModelType>): boolean; + +/** + * @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. + */ + +/** + * An untyped Firestore Data Converter interface that is shared between the + * lite, firestore-exp and classic SDK. + */ +interface UntypedFirestoreDataConverter<AppModelType, DbModelType extends DocumentData$1 = DocumentData$1> { + toFirestore(modelObject: WithFieldValue<AppModelType>): WithFieldValue<DbModelType>; + toFirestore(modelObject: PartialWithFieldValue<AppModelType>, options: SetOptions$1): PartialWithFieldValue<DbModelType>; + fromFirestore(snapshot: unknown, options?: unknown): AppModelType; +} +/** The result of parsing document data (e.g. for a setData call). */ +declare class ParsedSetData { + readonly data: ObjectValue; + readonly fieldMask: FieldMask | null; + readonly fieldTransforms: FieldTransform[]; + constructor(data: ObjectValue, fieldMask: FieldMask | null, fieldTransforms: FieldTransform[]); + toMutation(key: DocumentKey, precondition: Precondition): Mutation; +} +/** The result of parsing "update" data (i.e. for an updateData call). */ +declare class ParsedUpdateData { + readonly data: ObjectValue; + readonly fieldMask: FieldMask; + readonly fieldTransforms: FieldTransform[]; + constructor(data: ObjectValue, fieldMask: FieldMask, fieldTransforms: FieldTransform[]); + toMutation(key: DocumentKey, precondition: Precondition): Mutation; +} + +/** + * @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. + */ + +/** + * Internal transaction object responsible for accumulating the mutations to + * perform and the base versions for any documents read. + */ +declare class Transaction$2 { + private datastore; + private readVersions; + private mutations; + private committed; + /** + * A deferred usage error that occurred previously in this transaction that + * will cause the transaction to fail once it actually commits. + */ + private lastTransactionError; + /** + * Set of documents that have been written in the transaction. + * + * When there's more than one write to the same key in a transaction, any + * writes after the first are handled differently. + */ + private writtenDocs; + constructor(datastore: Datastore); + lookup(keys: DocumentKey[]): Promise<Document[]>; + set(key: DocumentKey, data: ParsedSetData): void; + update(key: DocumentKey, data: ParsedUpdateData): void; + delete(key: DocumentKey): void; + commit(): Promise<void>; + private recordVersion; + /** + * Returns the version of this document when it was read in this transaction, + * as a precondition, or no precondition if it was not read. + */ + private precondition; + /** + * Returns the precondition for a document if the operation is an update. + */ + private preconditionForUpdate; + private write; + private ensureCommitNotCalled; +} + +/** + * @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. + */ + +/** + * FirestoreClient is a top-level class that constructs and owns all of the // + * pieces of the client SDK architecture. It is responsible for creating the // + * async queue that is shared by all of the other components in the system. // + */ +declare class FirestoreClient { + private authCredentials; + private appCheckCredentials; + /** + * Asynchronous queue responsible for all of our internal processing. When + * we get incoming work from the user (via public API) or the network + * (incoming GRPC messages), we should always schedule onto this queue. + * This ensures all of our work is properly serialized (e.g. we don't + * start processing a new operation while the previous one is waiting for + * an async I/O to complete). + */ + asyncQueue: AsyncQueue; + private databaseInfo; + private user; + private readonly clientId; + private authCredentialListener; + private appCheckCredentialListener; + _uninitializedComponentsProvider?: { + _offline: OfflineComponentProvider; + _online: OnlineComponentProvider; + }; + _offlineComponents?: OfflineComponentProvider; + _onlineComponents?: OnlineComponentProvider; + constructor(authCredentials: CredentialsProvider<User>, appCheckCredentials: CredentialsProvider<string>, + /** + * Asynchronous queue responsible for all of our internal processing. When + * we get incoming work from the user (via public API) or the network + * (incoming GRPC messages), we should always schedule onto this queue. + * This ensures all of our work is properly serialized (e.g. we don't + * start processing a new operation while the previous one is waiting for + * an async I/O to complete). + */ + asyncQueue: AsyncQueue, databaseInfo: DatabaseInfo, componentProvider?: { + _offline: OfflineComponentProvider; + _online: OnlineComponentProvider; + }); + get configuration(): ComponentConfiguration; + setCredentialChangeListener(listener: (user: User) => Promise<void>): void; + setAppCheckTokenChangeListener(listener: (appCheckToken: string, user: User) => Promise<void>): void; + terminate(): Promise<void>; +} + +/** + * @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. + */ + +/** + * Settings that can be passed to `enableIndexedDbPersistence()` to configure + * Firestore persistence. + * + * Persistence cannot be used in a Node.js environment. + */ +interface PersistenceSettings { + /** + * Whether to force enable persistence for the client. This cannot be used + * with multi-tab synchronization and is primarily intended for use with Web + * Workers. Setting this to `true` will enable persistence, but cause other + * tabs using persistence to fail. + */ + forceOwnership?: boolean; +} +/** + * Specifies custom configurations for your Cloud Firestore instance. + * You must set these before invoking any other methods. + */ +interface FirestoreSettings extends FirestoreSettings$1 { + /** + * NOTE: This field will be deprecated in a future major release. Use `cache` field + * instead to specify cache size, and other cache configurations. + * + * An approximate cache size threshold for the on-disk data. If the cache + * grows beyond this size, Firestore will start removing data that hasn't been + * recently used. The size is not a guarantee that the cache will stay below + * that size, only that if the cache exceeds the given size, cleanup will be + * attempted. + * + * The default value is 40 MB. The threshold must be set to at least 1 MB, and + * can be set to `CACHE_SIZE_UNLIMITED` to disable garbage collection. + */ + cacheSizeBytes?: number; + /** + * Specifies the cache used by the SDK. Available options are `MemoryLocalCache` + * and `PersistentLocalCache`, each with different configuration options. + * + * When unspecified, `MemoryLocalCache` will be used by default. + * + * NOTE: setting this field and `cacheSizeBytes` at the same time will throw + * exception during SDK initialization. Instead, using the configuration in + * the `FirestoreLocalCache` object to specify the cache size. + */ + localCache?: FirestoreLocalCache; + /** + * Forces the SDK’s underlying network transport (WebChannel) to use + * long-polling. Each response from the backend will be closed immediately + * after the backend sends data (by default responses are kept open in + * case the backend has more data to send). This avoids incompatibility + * issues with certain proxies, antivirus software, etc. that incorrectly + * buffer traffic indefinitely. Use of this option will cause some + * performance degradation though. + * + * This setting cannot be used with `experimentalAutoDetectLongPolling` and + * may be removed in a future release. If you find yourself using it to + * work around a specific network reliability issue, please tell us about + * it in https://github.com/firebase/firebase-js-sdk/issues/1674. + * + * This setting cannot be used in a Node.js environment. + */ + experimentalForceLongPolling?: boolean; + /** + * Configures the SDK's underlying transport (WebChannel) to automatically + * detect if long-polling should be used. This is very similar to + * `experimentalForceLongPolling`, but only uses long-polling if required. + * + * After having had a default value of `false` since its inception in 2019, + * the default value of this setting was changed in May 2023 to `true` in + * v9.22.0 of the Firebase JavaScript SDK. That is, auto-detection of long + * polling is now enabled by default. To disable it, set this setting to + * `false`, and please open a GitHub issue to share the problems that + * motivated you disabling long-polling auto-detection. + * + * This setting cannot be used in a Node.js environment. + */ + experimentalAutoDetectLongPolling?: boolean; + /** + * Options that configure the SDK’s underlying network transport (WebChannel) + * when long-polling is used. + * + * These options are only used if `experimentalForceLongPolling` is true or if + * `experimentalAutoDetectLongPolling` is true and the auto-detection + * determined that long-polling was needed. Otherwise, these options have no + * effect. + */ + experimentalLongPollingOptions?: ExperimentalLongPollingOptions; +} + +/** + * @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. + */ + +declare module '@firebase/component' { + interface NameServiceMapping { + 'firestore': Firestore; + } +} +/** + * Constant used to indicate the LRU garbage collection should be disabled. + * Set this value as the `cacheSizeBytes` on the settings passed to the + * {@link Firestore} instance. + */ +declare const CACHE_SIZE_UNLIMITED = -1; +/** + * The Cloud Firestore service interface. + * + * Do not call this constructor directly. Instead, use {@link (getFirestore:1)}. + */ +declare class Firestore extends Firestore$1 { + /** + * Whether it's a {@link Firestore} or Firestore Lite instance. + */ + type: 'firestore-lite' | 'firestore'; + _queue: AsyncQueue; + readonly _persistenceKey: string; + _firestoreClient: FirestoreClient | undefined; + _componentsProvider?: { + _offline: OfflineComponentProviderFactory; + _online: OnlineComponentProviderFactory; + }; + /** @hideconstructor */ + constructor(authCredentialsProvider: CredentialsProvider<User>, appCheckCredentialsProvider: CredentialsProvider<string>, databaseId: DatabaseId, app?: FirebaseApp); + protected _terminate(): Promise<void>; +} +/** + * Initializes a new instance of {@link Firestore} with the provided settings. + * Can only be called before any other function, including + * {@link (getFirestore:1)}. If the custom settings are empty, this function is + * equivalent to calling {@link (getFirestore:1)}. + * + * @param app - The {@link @firebase/app#FirebaseApp} with which the {@link Firestore} instance will + * be associated. + * @param settings - A settings object to configure the {@link Firestore} instance. + * @param databaseId - The name of the database. + * @returns A newly initialized {@link Firestore} instance. + */ +declare function initializeFirestore(app: FirebaseApp, settings: FirestoreSettings, databaseId?: string): Firestore; +/** + * Returns the existing default {@link Firestore} instance that is associated with the + * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new + * instance with default settings. + * + * @returns The default {@link Firestore} instance of the default app. + */ +declare function getFirestore(): Firestore; +/** + * Returns the existing default {@link Firestore} instance that is associated with the + * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new + * instance with default settings. + * + * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore} + * instance is associated with. + * @returns The default {@link Firestore} instance of the provided app. + */ +declare function getFirestore(app: FirebaseApp): Firestore; +/** + * Returns the existing named {@link Firestore} instance that is associated with the + * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new + * instance with default settings. + * + * @param databaseId - The name of the database. + * @returns The named {@link Firestore} instance of the default app. + * @beta + */ +declare function getFirestore(databaseId: string): Firestore; +/** + * Returns the existing named {@link Firestore} instance that is associated with the + * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new + * instance with default settings. + * + * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore} + * instance is associated with. + * @param databaseId - The name of the database. + * @returns The named {@link Firestore} instance of the provided app. + * @beta + */ +declare function getFirestore(app: FirebaseApp, databaseId: string): Firestore; +/** + * @internal + */ +declare function ensureFirestoreConfigured(firestore: Firestore): FirestoreClient; +/** + * Attempts to enable persistent storage, if possible. + * + * On failure, `enableIndexedDbPersistence()` will reject the promise or + * throw an exception. There are several reasons why this can fail, which can be + * identified by the `code` on the error. + * + * * failed-precondition: The app is already open in another browser tab. + * * unimplemented: The browser is incompatible with the offline persistence + * implementation. + * + * Note that even after a failure, the {@link Firestore} instance will remain + * usable, however offline persistence will be disabled. + * + * Note: `enableIndexedDbPersistence()` must be called before any other functions + * (other than {@link initializeFirestore}, {@link (getFirestore:1)} or + * {@link clearIndexedDbPersistence}. + * + * Persistence cannot be used in a Node.js environment. + * + * @param firestore - The {@link Firestore} instance to enable persistence for. + * @param persistenceSettings - Optional settings object to configure + * persistence. + * @returns A `Promise` that represents successfully enabling persistent storage. + * @deprecated This function will be removed in a future major release. Instead, set + * `FirestoreSettings.localCache` to an instance of `PersistentLocalCache` to + * turn on IndexedDb cache. Calling this function when `FirestoreSettings.localCache` + * is already specified will throw an exception. + */ +declare function enableIndexedDbPersistence(firestore: Firestore, persistenceSettings?: PersistenceSettings): Promise<void>; +/** + * Attempts to enable multi-tab persistent storage, if possible. If enabled + * across all tabs, all operations share access to local persistence, including + * shared execution of queries and latency-compensated local document updates + * across all connected instances. + * + * On failure, `enableMultiTabIndexedDbPersistence()` will reject the promise or + * throw an exception. There are several reasons why this can fail, which can be + * identified by the `code` on the error. + * + * * failed-precondition: The app is already open in another browser tab and + * multi-tab is not enabled. + * * unimplemented: The browser is incompatible with the offline persistence + * implementation. + * + * Note that even after a failure, the {@link Firestore} instance will remain + * usable, however offline persistence will be disabled. + * + * @param firestore - The {@link Firestore} instance to enable persistence for. + * @returns A `Promise` that represents successfully enabling persistent + * storage. + * @deprecated This function will be removed in a future major release. Instead, set + * `FirestoreSettings.localCache` to an instance of `PersistentLocalCache` to + * turn on indexeddb cache. Calling this function when `FirestoreSettings.localCache` + * is already specified will throw an exception. + */ +declare function enableMultiTabIndexedDbPersistence(firestore: Firestore): Promise<void>; +/** + * Clears the persistent storage. This includes pending writes and cached + * documents. + * + * Must be called while the {@link Firestore} instance is not started (after the app is + * terminated or when the app is first initialized). On startup, this function + * must be called before other functions (other than {@link + * initializeFirestore} or {@link (getFirestore:1)})). If the {@link Firestore} + * instance is still running, the promise will be rejected with the error code + * of `failed-precondition`. + * + * Note: `clearIndexedDbPersistence()` is primarily intended to help write + * reliable tests that use Cloud Firestore. It uses an efficient mechanism for + * dropping existing data but does not attempt to securely overwrite or + * otherwise make cached data unrecoverable. For applications that are sensitive + * to the disclosure of cached data in between user sessions, we strongly + * recommend not enabling persistence at all. + * + * @param firestore - The {@link Firestore} instance to clear persistence for. + * @returns A `Promise` that is resolved when the persistent storage is + * cleared. Otherwise, the promise is rejected with an error. + */ +declare function clearIndexedDbPersistence(firestore: Firestore): Promise<void>; +/** + * Waits until all currently pending writes for the active user have been + * acknowledged by the backend. + * + * The returned promise resolves immediately if there are no outstanding writes. + * Otherwise, the promise waits for all previously issued writes (including + * those written in a previous app session), but it does not wait for writes + * that were added after the function is called. If you want to wait for + * additional writes, call `waitForPendingWrites()` again. + * + * Any outstanding `waitForPendingWrites()` promises are rejected during user + * changes. + * + * @returns A `Promise` which resolves when all currently pending writes have been + * acknowledged by the backend. + */ +declare function waitForPendingWrites(firestore: Firestore): Promise<void>; +/** + * Re-enables use of the network for this {@link Firestore} instance after a prior + * call to {@link disableNetwork}. + * + * @returns A `Promise` that is resolved once the network has been enabled. + */ +declare function enableNetwork(firestore: Firestore): Promise<void>; +/** + * Disables network usage for this instance. It can be re-enabled via {@link + * enableNetwork}. While the network is disabled, any snapshot listeners, + * `getDoc()` or `getDocs()` calls will return results from cache, and any write + * operations will be queued until the network is restored. + * + * @returns A `Promise` that is resolved once the network has been disabled. + */ +declare function disableNetwork(firestore: Firestore): Promise<void>; +/** + * Terminates the provided {@link Firestore} instance. + * + * After calling `terminate()` only the `clearIndexedDbPersistence()` function + * may be used. Any other function will throw a `FirestoreError`. + * + * To restart after termination, create a new instance of FirebaseFirestore with + * {@link (getFirestore:1)}. + * + * Termination does not cancel any pending writes, and any promises that are + * awaiting a response from the server will not be resolved. If you have + * persistence enabled, the next time you start this instance, it will resume + * sending these writes to the server. + * + * Note: Under normal circumstances, calling `terminate()` is not required. This + * function is useful only when you want to force this instance to release all + * of its resources or in combination with `clearIndexedDbPersistence()` to + * ensure that all local state is destroyed between test runs. + * + * @returns A `Promise` that is resolved when the instance has been successfully + * terminated. + */ +declare function terminate(firestore: Firestore): Promise<void>; +/** + * Loads a Firestore bundle into the local cache. + * + * @param firestore - The {@link Firestore} instance to load bundles for. + * @param bundleData - An object representing the bundle to be loaded. Valid + * objects are `ArrayBuffer`, `ReadableStream<Uint8Array>` or `string`. + * + * @returns A `LoadBundleTask` object, which notifies callers with progress + * updates, and completion or error events. It can be used as a + * `Promise<LoadBundleTaskProgress>`. + */ +declare function loadBundle(firestore: Firestore, bundleData: ReadableStream<Uint8Array> | ArrayBuffer | string): LoadBundleTask; +/** + * Reads a Firestore {@link Query} from local cache, identified by the given + * name. + * + * The named queries are packaged into bundles on the server side (along + * with resulting documents), and loaded to local cache using `loadBundle`. Once + * in local cache, use this method to extract a {@link Query} by name. + * + * @param firestore - The {@link Firestore} instance to read the query from. + * @param name - The name of the query. + * @returns A `Promise` that is resolved with the Query or `null`. + */ +declare function namedQuery(firestore: Firestore, name: string): Promise<Query | null>; + +/** + * @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. + */ + +/** + * Create an AggregateField object that can be used to compute the sum of + * a specified field over a range of documents in the result set of a query. + * @param field Specifies the field to sum across the result set. + */ +declare function sum(field: string | FieldPath): AggregateField<number>; +/** + * Create an AggregateField object that can be used to compute the average of + * a specified field over a range of documents in the result set of a query. + * @param field Specifies the field to average across the result set. + */ +declare function average(field: string | FieldPath): AggregateField<number | null>; +/** + * Create an AggregateField object that can be used to compute the count of + * documents in the result set of a query. + */ +declare function count(): AggregateField<number>; +/** + * Compares two 'AggregateField` instances for equality. + * + * @param left Compare this AggregateField to the `right`. + * @param right Compare this AggregateField to the `left`. + */ +declare function aggregateFieldEqual(left: AggregateField<unknown>, right: AggregateField<unknown>): boolean; +/** + * Compares two `AggregateQuerySnapshot` instances for equality. + * + * Two `AggregateQuerySnapshot` instances are considered "equal" if they have + * underlying queries that compare equal, and the same data. + * + * @param left - The first `AggregateQuerySnapshot` to compare. + * @param right - The second `AggregateQuerySnapshot` to compare. + * + * @returns `true` if the objects are "equal", as defined above, or `false` + * otherwise. + */ +declare function aggregateQuerySnapshotEqual<AggregateSpecType extends AggregateSpec, AppModelType, DbModelType extends DocumentData>(left: AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>, right: AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>): boolean; + +/** + * @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. + */ + +/** + * Represents an aggregation that can be performed by Firestore. + */ +declare class AggregateField<T> { + readonly _internalFieldPath?: FieldPath$2 | undefined; + /** A type string to uniquely identify instances of this class. */ + readonly type = "AggregateField"; + /** Indicates the aggregation operation of this AggregateField. */ + readonly aggregateType: AggregateType; + /** + * Create a new AggregateField<T> + * @param aggregateType Specifies the type of aggregation operation to perform. + * @param _internalFieldPath Optionally specifies the field that is aggregated. + * @internal + */ + constructor(aggregateType?: AggregateType, _internalFieldPath?: FieldPath$2 | undefined); +} +/** + * The union of all `AggregateField` types that are supported by Firestore. + */ +type AggregateFieldType = ReturnType<typeof sum> | ReturnType<typeof average> | ReturnType<typeof count>; +/** + * Specifies a set of aggregations and their aliases. + */ +interface AggregateSpec { + [field: string]: AggregateFieldType; +} +/** + * A type whose keys are taken from an `AggregateSpec`, and whose values are the + * result of the aggregation performed by the corresponding `AggregateField` + * from the input `AggregateSpec`. + */ +type AggregateSpecData<T extends AggregateSpec> = { + [P in keyof T]: T[P] extends AggregateField<infer U> ? U : never; +}; +/** + * The results of executing an aggregation query. + */ +declare class AggregateQuerySnapshot<AggregateSpecType extends AggregateSpec, AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> { + private readonly _userDataWriter; + private readonly _data; + /** A type string to uniquely identify instances of this class. */ + readonly type = "AggregateQuerySnapshot"; + /** + * The underlying query over which the aggregations recorded in this + * `AggregateQuerySnapshot` were performed. + */ + readonly query: Query<AppModelType, DbModelType>; + /** @hideconstructor */ + constructor(query: Query<AppModelType, DbModelType>, _userDataWriter: AbstractUserDataWriter, _data: ApiClientObjectMap<Value>); + /** + * Returns the results of the aggregations performed over the underlying + * query. + * + * The keys of the returned object will be the same as those of the + * `AggregateSpec` object specified to the aggregation method, and the values + * will be the corresponding aggregation result. + * + * @returns The results of the aggregations performed over the underlying + * query. + */ + data(): AggregateSpecData<AggregateSpecType>; +} + +/** + * @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. + */ + +/** + * Calculates the number of documents in the result set of the given query + * without actually downloading the documents. + * + * Using this function to count the documents is efficient because only the + * final count, not the documents' data, is downloaded. This function can + * count the documents in cases where the result set is prohibitively large to + * download entirely (thousands of documents). + * + * The result received from the server is presented, unaltered, without + * considering any local state. That is, documents in the local cache are not + * taken into consideration, neither are local modifications not yet + * synchronized with the server. Previously-downloaded results, if any, are not + * used. Every invocation of this function necessarily involves a round trip to + * the server. + * + * @param query The query whose result set size is calculated. + * @returns A Promise that will be resolved with the count; the count can be + * retrieved from `snapshot.data().count`, where `snapshot` is the + * `AggregateQuerySnapshot` to which the returned Promise resolves. + */ +declare function getCountFromServer<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<AggregateQuerySnapshot<{ + count: AggregateField<number>; +}, AppModelType, DbModelType>>; +/** + * Calculates the specified aggregations over the documents in the result + * set of the given query without actually downloading the documents. + * + * Using this function to perform aggregations is efficient because only the + * final aggregation values, not the documents' data, are downloaded. This + * function can perform aggregations of the documents in cases where the result + * set is prohibitively large to download entirely (thousands of documents). + * + * The result received from the server is presented, unaltered, without + * considering any local state. That is, documents in the local cache are not + * taken into consideration, neither are local modifications not yet + * synchronized with the server. Previously-downloaded results, if any, are not + * used. Every invocation of this function necessarily involves a round trip to + * the server. + * + * @param query The query whose result set is aggregated over. + * @param aggregateSpec An `AggregateSpec` object that specifies the aggregates + * to perform over the result set. The AggregateSpec specifies aliases for each + * aggregate, which can be used to retrieve the aggregate result. + * @example + * ```typescript + * const aggregateSnapshot = await getAggregateFromServer(query, { + * countOfDocs: count(), + * totalHours: sum('hours'), + * averageScore: average('score') + * }); + * + * const countOfDocs: number = aggregateSnapshot.data().countOfDocs; + * const totalHours: number = aggregateSnapshot.data().totalHours; + * const averageScore: number | null = aggregateSnapshot.data().averageScore; + * ``` + */ +declare function getAggregateFromServer<AggregateSpecType extends AggregateSpec, AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, aggregateSpec: AggregateSpecType): Promise<AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>>; + +/** + * @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. + */ + +/** + * An immutable object representing an array of bytes. + */ +declare class Bytes { + _byteString: ByteString; + /** @hideconstructor */ + constructor(byteString: ByteString); + /** + * Creates a new `Bytes` object from the given Base64 string, converting it to + * bytes. + * + * @param base64 - The Base64 string used to create the `Bytes` object. + */ + static fromBase64String(base64: string): Bytes; + /** + * Creates a new `Bytes` object from the given Uint8Array. + * + * @param array - The Uint8Array used to create the `Bytes` object. + */ + static fromUint8Array(array: Uint8Array): Bytes; + /** + * Returns the underlying bytes as a Base64-encoded string. + * + * @returns The Base64-encoded string created from the `Bytes` object. + */ + toBase64(): string; + /** + * Returns the underlying bytes in a new `Uint8Array`. + * + * @returns The Uint8Array created from the `Bytes` object. + */ + toUint8Array(): Uint8Array; + /** + * Returns a string representation of the `Bytes` object. + * + * @returns A string representation of the `Bytes` object. + */ + toString(): string; + /** + * Returns true if this `Bytes` object is equal to the provided one. + * + * @param other - The `Bytes` object to compare against. + * @returns true if this `Bytes` object is equal to the provided one. + */ + isEqual(other: Bytes): boolean; + static _jsonSchemaVersion: string; + static _jsonSchema: { + type: Property<"string">; + bytes: Property<"string">; + }; + /** + * Returns a JSON-serializable representation of this `Bytes` instance. + * + * @returns a JSON representation of this object. + */ + toJSON(): object; + /** + * Builds a `Bytes` instance from a JSON object created by {@link Bytes.toJSON}. + * + * @param json a JSON object represention of a `Bytes` instance + * @returns an instance of {@link Bytes} if the JSON object could be parsed. Throws a + * {@link FirestoreError} if an error occurs. + */ + static fromJSON(json: object): Bytes; +} + +/** + * @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. + */ + +/** + * An options object that can be passed to {@link (onSnapshot:1)} and {@link + * QuerySnapshot.docChanges} to control which types of changes to include in the + * result set. + */ +interface SnapshotListenOptions { + /** + * Include a change even if only the metadata of the query or of a document + * changed. Default is false. + */ + readonly includeMetadataChanges?: boolean; + /** + * Set the source the query listens to. Default to "default", which + * listens to both cache and server. + */ + readonly source?: ListenSource; +} +/** + * Describe the source a query listens to. + * + * Set to `default` to listen to both cache and server changes. Set to `cache` + * to listen to changes in cache only. + */ +type ListenSource = 'default' | 'cache'; +/** + * Reads the document referred to by this `DocumentReference`. + * + * Note: `getDoc()` attempts to provide up-to-date data when possible by waiting + * for data from the server, but it may return cached data or fail if you are + * offline and the server cannot be reached. To specify this behavior, invoke + * {@link getDocFromCache} or {@link getDocFromServer}. + * + * @param reference - The reference of the document to fetch. + * @returns A Promise resolved with a `DocumentSnapshot` containing the + * current document contents. + */ +declare function getDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>; +/** + * Reads the document referred to by this `DocumentReference` from cache. + * Returns an error if the document is not currently cached. + * + * @returns A `Promise` resolved with a `DocumentSnapshot` containing the + * current document contents. + */ +declare function getDocFromCache<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>; +/** + * Reads the document referred to by this `DocumentReference` from the server. + * Returns an error if the network is not available. + * + * @returns A `Promise` resolved with a `DocumentSnapshot` containing the + * current document contents. + */ +declare function getDocFromServer<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>; +/** + * Executes the query and returns the results as a `QuerySnapshot`. + * + * Note: `getDocs()` attempts to provide up-to-date data when possible by + * waiting for data from the server, but it may return cached data or fail if + * you are offline and the server cannot be reached. To specify this behavior, + * invoke {@link getDocsFromCache} or {@link getDocsFromServer}. + * + * @returns A `Promise` that will be resolved with the results of the query. + */ +declare function getDocs<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>>; +/** + * Executes the query and returns the results as a `QuerySnapshot` from cache. + * Returns an empty result set if no documents matching the query are currently + * cached. + * + * @returns A `Promise` that will be resolved with the results of the query. + */ +declare function getDocsFromCache<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>>; +/** + * Executes the query and returns the results as a `QuerySnapshot` from the + * server. Returns an error if the network is not available. + * + * @returns A `Promise` that will be resolved with the results of the query. + */ +declare function getDocsFromServer<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>>; +/** + * Writes to the document referred to by this `DocumentReference`. If the + * document does not yet exist, it will be created. + * + * @param reference - A reference to the document to write. + * @param data - A map of the fields and values for the document. + * @returns A `Promise` resolved once the data has been successfully written + * to the backend (note that it won't resolve while you're offline). + */ +declare function setDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, data: WithFieldValue<AppModelType>): Promise<void>; +/** + * Writes to the document referred to by the specified `DocumentReference`. If + * the document does not yet exist, it will be created. If you provide `merge` + * or `mergeFields`, the provided data can be merged into an existing document. + * + * @param reference - A reference to the document to write. + * @param data - A map of the fields and values for the document. + * @param options - An object to configure the set behavior. + * @returns A Promise resolved once the data has been successfully written + * to the backend (note that it won't resolve while you're offline). + */ +declare function setDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, data: PartialWithFieldValue<AppModelType>, options: SetOptions): Promise<void>; +/** + * Updates fields in the document referred to by the specified + * `DocumentReference`. The update will fail if applied to a document that does + * not exist. + * + * @param reference - A reference to the document to update. + * @param data - An object containing the fields and values with which to + * update the document. Fields can contain dots to reference nested fields + * within the document. + * @returns A `Promise` resolved once the data has been successfully written + * to the backend (note that it won't resolve while you're offline). + */ +declare function updateDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, data: UpdateData<DbModelType>): Promise<void>; +/** + * Updates fields in the document referred to by the specified + * `DocumentReference` The update will fail if applied to a document that does + * not exist. + * + * Nested fields can be updated by providing dot-separated field path + * strings or by providing `FieldPath` objects. + * + * @param reference - A reference to the document to update. + * @param field - The first field to update. + * @param value - The first value. + * @param moreFieldsAndValues - Additional key value pairs. + * @returns A `Promise` resolved once the data has been successfully written + * to the backend (note that it won't resolve while you're offline). + */ +declare function updateDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): Promise<void>; +/** + * Deletes the document referred to by the specified `DocumentReference`. + * + * @param reference - A reference to the document to delete. + * @returns A Promise resolved once the document has been successfully + * deleted from the backend (note that it won't resolve while you're offline). + */ +declare function deleteDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>): Promise<void>; +/** + * Add a new document to specified `CollectionReference` with the given data, + * assigning it a document ID automatically. + * + * @param reference - A reference to the collection to add this document to. + * @param data - An Object containing the data for the new document. + * @returns A `Promise` resolved with a `DocumentReference` pointing to the + * newly created document after it has been written to the backend (Note that it + * won't resolve while you're offline). + */ +declare function addDoc<AppModelType, DbModelType extends DocumentData>(reference: CollectionReference<AppModelType, DbModelType>, data: WithFieldValue<AppModelType>): Promise<DocumentReference<AppModelType, DbModelType>>; +/** + * A function returned by `onSnapshot()` that removes the listener when invoked. + */ +interface Unsubscribe { + /** Removes the listener when invoked. */ + (): void; +} +/** + * Attaches a listener for `DocumentSnapshot` events. You may either pass individual `onNext` and + * `onError` callbacks or pass a single observer object with `next` and `error` callbacks. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param reference - A reference to the document to listen to. + * @param observer - A single object containing `next` and `error` callbacks. + * @returns An unsubscribe function that can be called to cancel + * the snapshot listener. + */ +declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, observer: { + next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void; + error?: (error: FirestoreError$1) => void; + complete?: () => void; +}): Unsubscribe; +/** + * Attaches a listener for `DocumentSnapshot` events. You may either pass individual `onNext` and + * `onError` callbacks or pass a single observer object with `next` and `error` callbacks. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param reference - A reference to the document to listen to. + * @param options - Options controlling the listen behavior. + * @param observer - A single object containing `next` and `error` callbacks. + * @returns An unsubscribe function that can be called to cancel + * the snapshot listener. + */ +declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, options: SnapshotListenOptions, observer: { + next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void; + error?: (error: FirestoreError$1) => void; + complete?: () => void; +}): Unsubscribe; +/** + * Attaches a listener for `DocumentSnapshot` events. You may either pass individual `onNext` and + * `onError` callbacks or pass a single observer object with `next` and `error` callbacks. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param reference - A reference to the document to listen to. + * @param onNext - A callback to be called every time a new `DocumentSnapshot` is available. + * @param onError - A callback to be called if the listen fails or is cancelled. No further + * callbacks will occur. + * @param onCompletion - Can be provided, but will not be called since streams are never ending. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError$1) => void, onCompletion?: () => void): Unsubscribe; +/** + * Attaches a listener for `DocumentSnapshot` events. You may either pass individual `onNext` and + * `onError` callbacks or pass a single observer object with `next` and `error` callbacks. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param reference - A reference to the document to listen to. + * @param options - Options controlling the listen behavior. + * @param onNext - A callback to be called every time a new `DocumentSnapshot` is available. + * @param onError - A callback to be called if the listen fails or is cancelled. No further + * callbacks will occur. + * @param onCompletion - Can be provided, but will not be called since streams are never ending. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, options: SnapshotListenOptions, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError$1) => void, onCompletion?: () => void): Unsubscribe; +/** + * Attaches a listener for `QuerySnapshot` events. You may either pass individual `onNext` and + * `onError` callbacks or pass a single observer object with `next` and `error` callbacks. The + * listener can be cancelled by calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param query - The query to listen to. + * @param observer - A single object containing `next` and `error` callbacks. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, observer: { + next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void; + error?: (error: FirestoreError$1) => void; + complete?: () => void; +}): Unsubscribe; +/** + * Attaches a listener for `QuerySnapshot` events. You may either pass individual `onNext` and + * `onError` callbacks or pass a single observer object with `next` and `error` callbacks. The + * listener can be cancelled by calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param query - The query to listen to. + * @param options - Options controlling the listen behavior. + * @param observer - A single object containing `next` and `error` callbacks. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, options: SnapshotListenOptions, observer: { + next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void; + error?: (error: FirestoreError$1) => void; + complete?: () => void; +}): Unsubscribe; +/** + * Attaches a listener for `QuerySnapshot` events. You may either pass individual `onNext` and + * `onError` callbacks or pass a single observer object with `next` and `error` callbacks. The + * listener can be cancelled by calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param query - The query to listen to. + * @param onNext - A callback to be called every time a new `QuerySnapshot` is available. + * @param onCompletion - Can be provided, but will not be called since streams are never ending. + * @param onError - A callback to be called if the listen fails or is cancelled. No further + * callbacks will occur. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError$1) => void, onCompletion?: () => void): Unsubscribe; +/** + * Attaches a listener for `QuerySnapshot` events. You may either pass individual `onNext` and + * `onError` callbacks or pass a single observer object with `next` and `error` callbacks. The + * listener can be cancelled by calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param query - The query to listen to. + * @param options - Options controlling the listen behavior. + * @param onNext - A callback to be called every time a new `QuerySnapshot` is available. + * @param onCompletion - Can be provided, but will not be called since streams are never ending. + * @param onError - A callback to be called if the listen fails or is cancelled. No further + * callbacks will occur. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, options: SnapshotListenOptions, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError$1) => void, onCompletion?: () => void): Unsubscribe; +/** + * Attaches a listener for `QuerySnapshot` events based on data generated by invoking + * {@link QuerySnapshot.toJSON} You may either pass individual `onNext` and `onError` callbacks or + * pass a single observer object with `next` and `error` callbacks. The listener can be cancelled by + * calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param firestore - The {@link Firestore} instance to enable the listener for. + * @param snapshotJson - A JSON object generated by invoking {@link QuerySnapshot.toJSON}. + * @param onNext - A callback to be called every time a new `QuerySnapshot` is available. + * @param onError - A callback to be called if the listen fails or is cancelled. No further + * callbacks will occur. + * @param onCompletion - Can be provided, but will not be called since streams are never ending. + * @param converter - An optional object that converts objects from Firestore before the onNext + * listener is invoked. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +declare function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError$1) => void, onCompletion?: () => void, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe; +/** + * Attaches a listener for `DocumentSnapshot` events based on data generated by invoking + * {@link DocumentSnapshot.toJSON}. You may either pass individual `onNext` and `onError` callbacks or + * pass a single observer object with `next` and `error` callbacks. The listener can be cancelled by + * calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param firestore - The {@link Firestore} instance to enable the listener for. + * @param snapshotJson - A JSON object generated by invoking {@link DocumentSnapshot.toJSON}. + * @param onNext - A callback to be called every time a new `DocumentSnapshot` is available. + * @param onError - A callback to be called if the listen fails or is cancelled. No further + * callbacks will occur. + * @param onCompletion - Can be provided, but will not be called since streams are + * never ending. + * @param converter - An optional object that converts objects from Firestore before the onNext + * listener is invoked. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +declare function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError$1) => void, onCompletion?: () => void, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe; +/** + * Attaches a listener for `QuerySnapshot` events based on data generated by invoking + * {@link QuerySnapshot.toJSON}. You may either pass individual `onNext` and `onError` callbacks or + * pass a single observer object with `next` and `error` callbacks. The listener can be cancelled by + * calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param firestore - The {@link Firestore} instance to enable the listener for. + * @param snapshotJson - A JSON object generated by invoking {@link QuerySnapshot.toJSON}. + * @param options - Options controlling the listen behavior. + * @param onNext - A callback to be called every time a new `QuerySnapshot` is available. + * @param onError - A callback to be called if the listen fails or is cancelled. No further + * callbacks will occur. + * @param onCompletion - Can be provided, but will not be called since streams are never ending. + * @param converter - An optional object that converts objects from Firestore before the onNext + * listener is invoked. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +declare function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, options: SnapshotListenOptions, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError$1) => void, onCompletion?: () => void, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe; +/** + * Attaches a listener for `DocumentSnapshot` events based on data generated by invoking + * {@link DocumentSnapshot.toJSON}. You may either pass individual `onNext` and `onError` callbacks + * or pass a single observer object with `next` and `error` callbacks. The listener can be cancelled + * by calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param firestore - The {@link Firestore} instance to enable the listener for. + * @param snapshotJson - A JSON object generated by invoking {@link DocumentSnapshot.toJSON}. + * @param options - Options controlling the listen behavior. + * @param onNext - A callback to be called every time a new `DocumentSnapshot` is available. + * @param onError - A callback to be called if the listen fails or is cancelled. No further + * callbacks will occur. + * @param onCompletion - Can be provided, but will not be called since streams are never ending. + * @param converter - An optional object that converts objects from Firestore before the onNext + * listener is invoked. + * @returns An unsubscribe function that can be called to cancel + * the snapshot listener. + */ +declare function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, options: SnapshotListenOptions, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError$1) => void, onCompletion?: () => void, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe; +/** + * Attaches a listener for `QuerySnapshot` events based on QuerySnapshot data generated by invoking + * {@link QuerySnapshot.toJSON}. You may either pass individual `onNext` and `onError` callbacks or + * pass a single observer object with `next` and `error` callbacks. The listener can be cancelled by + * calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param firestore - The {@link Firestore} instance to enable the listener for. + * @param snapshotJson - A JSON object generated by invoking {@link QuerySnapshot.toJSON}. + * @param observer - A single object containing `next` and `error` callbacks. + * @param converter - An optional object that converts objects from Firestore before the onNext + * listener is invoked. + * @returns An unsubscribe function that can be called to cancel + * the snapshot listener. + */ +declare function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, observer: { + next: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void; + error?: (error: FirestoreError$1) => void; + complete?: () => void; +}, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe; +/** + * Attaches a listener for `DocumentSnapshot` events based on data generated by invoking + * {@link DocumentSnapshot.toJSON} You may either pass individual `onNext` and `onError` callbacks + * or pass a single observer object with `next` and `error` callbacks. The listener can be cancelled + * by calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param firestore - The {@link Firestore} instance to enable the listener for. + * @param snapshotJson - A JSON object generated by invoking {@link DocumentSnapshot.toJSON}. + * @param observer - A single object containing `next` and `error` callbacks. + * @param converter - An optional object that converts objects from Firestore before the onNext + * listener is invoked. + * @returns An unsubscribe function that can be called to cancel + * the snapshot listener. + */ +declare function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, observer: { + next: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void; + error?: (error: FirestoreError$1) => void; + complete?: () => void; +}, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe; +/** + * Attaches a listener for `QuerySnapshot` events based on QuerySnapshot data generated by invoking + * {@link QuerySnapshot.toJSON} You may either pass individual `onNext` and `onError` callbacks or + * pass a single observer object with `next` and `error` callbacks. The listener can be cancelled by + * calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param firestore - The {@link Firestore} instance to enable the listener for. + * @param snapshotJson - A JSON object generated by invoking {@link QuerySnapshot.toJSON}. + * @param options - Options controlling the listen behavior. + * @param observer - A single object containing `next` and `error` callbacks. + * @param converter - An optional object that converts objects from Firestore before the onNext + * listener is invoked. + * @returns An unsubscribe function that can be called to cancel + * the snapshot listener. + */ +declare function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, options: SnapshotListenOptions, observer: { + next: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void; + error?: (error: FirestoreError$1) => void; + complete?: () => void; +}, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe; +/** + * Attaches a listener for `DocumentSnapshot` events based on QuerySnapshot data generated by + * invoking {@link DocumentSnapshot.toJSON} You may either pass individual `onNext` and `onError` + * callbacks or pass a single observer object with `next` and `error` callbacks. The listener can be + * cancelled by calling the function that is returned when `onSnapshot` is called. + * + * NOTE: Although an `onCompletion` callback can be provided, it will never be called because the + * snapshot stream is never-ending. + * + * @param firestore - The {@link Firestore} instance to enable the listener for. + * @param snapshotJson - A JSON object generated by invoking {@link DocumentSnapshot.toJSON}. + * @param options - Options controlling the listen behavior. + * @param observer - A single object containing `next` and `error` callbacks. + * @param converter - An optional object that converts objects from Firestore before the onNext + * listener is invoked. + * @returns An unsubscribe function that can be called to cancel the snapshot listener. + */ +declare function onSnapshotResume<AppModelType, DbModelType extends DocumentData>(firestore: Firestore, snapshotJson: object, options: SnapshotListenOptions, observer: { + next: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void; + error?: (error: FirestoreError$1) => void; + complete?: () => void; +}, converter?: FirestoreDataConverter<DbModelType>): Unsubscribe; +/** + * Attaches a listener for a snapshots-in-sync event. The snapshots-in-sync + * event indicates that all listeners affected by a given change have fired, + * even if a single server-generated change affects multiple listeners. + * + * NOTE: The snapshots-in-sync event only indicates that listeners are in sync + * with each other, but does not relate to whether those snapshots are in sync + * with the server. Use SnapshotMetadata in the individual listeners to + * determine if a snapshot is from the cache or the server. + * + * @param firestore - The instance of Firestore for synchronizing snapshots. + * @param observer - A single object containing `next` and `error` callbacks. + * @returns An unsubscribe function that can be called to cancel the snapshot + * listener. + */ +declare function onSnapshotsInSync(firestore: Firestore, observer: { + next?: (value: void) => void; + error?: (error: FirestoreError$1) => void; + complete?: () => void; +}): Unsubscribe; +/** + * Attaches a listener for a snapshots-in-sync event. The snapshots-in-sync + * event indicates that all listeners affected by a given change have fired, + * even if a single server-generated change affects multiple listeners. + * + * NOTE: The snapshots-in-sync event only indicates that listeners are in sync + * with each other, but does not relate to whether those snapshots are in sync + * with the server. Use `SnapshotMetadata` in the individual listeners to + * determine if a snapshot is from the cache or the server. + * + * @param firestore - The `Firestore` instance for synchronizing snapshots. + * @param onSync - A callback to be called every time all snapshot listeners are + * in sync with each other. + * @returns An unsubscribe function that can be called to cancel the snapshot + * listener. + */ +declare function onSnapshotsInSync(firestore: Firestore, onSync: () => void): Unsubscribe; +/** + * Locally writes `mutations` on the async queue. + * @internal + */ +declare function executeWrite(firestore: Firestore, mutations: Mutation[]): Promise<void>; + +/** + * @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. + */ + +/** + * Converter used by `withConverter()` to transform user objects of type + * `AppModelType` into Firestore data of type `DbModelType`. + * + * Using the converter allows you to specify generic type arguments when + * storing and retrieving objects from Firestore. + * + * In this context, an "AppModel" is a class that is used in an application to + * package together related information and functionality. Such a class could, + * for example, have properties with complex, nested data types, properties used + * for memoization, properties of types not supported by Firestore (such as + * `symbol` and `bigint`), and helper functions that perform compound + * operations. Such classes are not suitable and/or possible to store into a + * Firestore database. Instead, instances of such classes need to be converted + * to "plain old JavaScript objects" (POJOs) with exclusively primitive + * properties, potentially nested inside other POJOs or arrays of POJOs. In this + * context, this type is referred to as the "DbModel" and would be an object + * suitable for persisting into Firestore. For convenience, applications can + * implement `FirestoreDataConverter` and register the converter with Firestore + * objects, such as `DocumentReference` or `Query`, to automatically convert + * `AppModel` to `DbModel` when storing into Firestore, and convert `DbModel` + * to `AppModel` when retrieving from Firestore. + * + * @example + * + * Simple Example + * + * ```typescript + * const numberConverter = { + * toFirestore(value: WithFieldValue<number>) { + * return { value }; + * }, + * fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions) { + * return snapshot.data(options).value as number; + * } + * }; + * + * async function simpleDemo(db: Firestore): Promise<void> { + * const documentRef = doc(db, 'values/value123').withConverter(numberConverter); + * + * // converters are used with `setDoc`, `addDoc`, and `getDoc` + * await setDoc(documentRef, 42); + * const snapshot1 = await getDoc(documentRef); + * assertEqual(snapshot1.data(), 42); + * + * // converters are not used when writing data with `updateDoc` + * await updateDoc(documentRef, { value: 999 }); + * const snapshot2 = await getDoc(documentRef); + * assertEqual(snapshot2.data(), 999); + * } + * ``` + * + * Advanced Example + * + * ```typescript + * // The Post class is a model that is used by our application. + * // This class may have properties and methods that are specific + * // to our application execution, which do not need to be persisted + * // to Firestore. + * class Post { + * constructor( + * readonly title: string, + * readonly author: string, + * readonly lastUpdatedMillis: number + * ) {} + * toString(): string { + * return `${this.title} by ${this.author}`; + * } + * } + * + * // The PostDbModel represents how we want our posts to be stored + * // in Firestore. This DbModel has different properties (`ttl`, + * // `aut`, and `lut`) from the Post class we use in our application. + * interface PostDbModel { + * ttl: string; + * aut: { firstName: string; lastName: string }; + * lut: Timestamp; + * } + * + * // The `PostConverter` implements `FirestoreDataConverter` and specifies + * // how the Firestore SDK can convert `Post` objects to `PostDbModel` + * // objects and vice versa. + * class PostConverter implements FirestoreDataConverter<Post, PostDbModel> { + * toFirestore(post: WithFieldValue<Post>): WithFieldValue<PostDbModel> { + * return { + * ttl: post.title, + * aut: this._autFromAuthor(post.author), + * lut: this._lutFromLastUpdatedMillis(post.lastUpdatedMillis) + * }; + * } + * + * fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions): Post { + * const data = snapshot.data(options) as PostDbModel; + * const author = `${data.aut.firstName} ${data.aut.lastName}`; + * return new Post(data.ttl, author, data.lut.toMillis()); + * } + * + * _autFromAuthor( + * author: string | FieldValue + * ): { firstName: string; lastName: string } | FieldValue { + * if (typeof author !== 'string') { + * // `author` is a FieldValue, so just return it. + * return author; + * } + * const [firstName, lastName] = author.split(' '); + * return {firstName, lastName}; + * } + * + * _lutFromLastUpdatedMillis( + * lastUpdatedMillis: number | FieldValue + * ): Timestamp | FieldValue { + * if (typeof lastUpdatedMillis !== 'number') { + * // `lastUpdatedMillis` must be a FieldValue, so just return it. + * return lastUpdatedMillis; + * } + * return Timestamp.fromMillis(lastUpdatedMillis); + * } + * } + * + * async function advancedDemo(db: Firestore): Promise<void> { + * // Create a `DocumentReference` with a `FirestoreDataConverter`. + * const documentRef = doc(db, 'posts/post123').withConverter(new PostConverter()); + * + * // The `data` argument specified to `setDoc()` is type checked by the + * // TypeScript compiler to be compatible with `Post`. Since the `data` + * // argument is typed as `WithFieldValue<Post>` rather than just `Post`, + * // this allows properties of the `data` argument to also be special + * // Firestore values that perform server-side mutations, such as + * // `arrayRemove()`, `deleteField()`, and `serverTimestamp()`. + * await setDoc(documentRef, { + * title: 'My Life', + * author: 'Foo Bar', + * lastUpdatedMillis: serverTimestamp() + * }); + * + * // The TypeScript compiler will fail to compile if the `data` argument to + * // `setDoc()` is _not_ compatible with `WithFieldValue<Post>`. This + * // type checking prevents the caller from specifying objects with incorrect + * // properties or property values. + * // @ts-expect-error "Argument of type { ttl: string; } is not assignable + * // to parameter of type WithFieldValue<Post>" + * await setDoc(documentRef, { ttl: 'The Title' }); + * + * // When retrieving a document with `getDoc()` the `DocumentSnapshot` + * // object's `data()` method returns a `Post`, rather than a generic object, + * // which would have been returned if the `DocumentReference` did _not_ have a + * // `FirestoreDataConverter` attached to it. + * const snapshot1: DocumentSnapshot<Post> = await getDoc(documentRef); + * const post1: Post = snapshot1.data()!; + * if (post1) { + * assertEqual(post1.title, 'My Life'); + * assertEqual(post1.author, 'Foo Bar'); + * } + * + * // The `data` argument specified to `updateDoc()` is type checked by the + * // TypeScript compiler to be compatible with `PostDbModel`. Note that + * // unlike `setDoc()`, whose `data` argument must be compatible with `Post`, + * // the `data` argument to `updateDoc()` must be compatible with + * // `PostDbModel`. Similar to `setDoc()`, since the `data` argument is typed + * // as `WithFieldValue<PostDbModel>` rather than just `PostDbModel`, this + * // allows properties of the `data` argument to also be those special + * // Firestore values, like `arrayRemove()`, `deleteField()`, and + * // `serverTimestamp()`. + * await updateDoc(documentRef, { + * 'aut.firstName': 'NewFirstName', + * lut: serverTimestamp() + * }); + * + * // The TypeScript compiler will fail to compile if the `data` argument to + * // `updateDoc()` is _not_ compatible with `WithFieldValue<PostDbModel>`. + * // This type checking prevents the caller from specifying objects with + * // incorrect properties or property values. + * // @ts-expect-error "Argument of type { title: string; } is not assignable + * // to parameter of type WithFieldValue<PostDbModel>" + * await updateDoc(documentRef, { title: 'New Title' }); + * const snapshot2: DocumentSnapshot<Post> = await getDoc(documentRef); + * const post2: Post = snapshot2.data()!; + * if (post2) { + * assertEqual(post2.title, 'My Life'); + * assertEqual(post2.author, 'NewFirstName Bar'); + * } + * } + * ``` + */ +interface FirestoreDataConverter<AppModelType, DbModelType extends DocumentData = DocumentData> extends FirestoreDataConverter$1<AppModelType, DbModelType> { + /** + * Called by the Firestore SDK to convert a custom model object of type + * `AppModelType` into a plain JavaScript object (suitable for writing + * directly to the Firestore database) of type `DbModelType`. To use `set()` + * with `merge` and `mergeFields`, `toFirestore()` must be defined with + * `PartialWithFieldValue<AppModelType>`. + * + * The `WithFieldValue<T>` type extends `T` to also allow FieldValues such as + * {@link (deleteField:1)} to be used as property values. + */ + toFirestore(modelObject: WithFieldValue<AppModelType>): WithFieldValue<DbModelType>; + /** + * Called by the Firestore SDK to convert a custom model object of type + * `AppModelType` into a plain JavaScript object (suitable for writing + * directly to the Firestore database) of type `DbModelType`. Used with + * {@link (setDoc:1)}, {@link (WriteBatch.set:1)} and + * {@link (Transaction.set:1)} with `merge:true` or `mergeFields`. + * + * The `PartialWithFieldValue<T>` type extends `Partial<T>` to allow + * FieldValues such as {@link (arrayUnion:1)} to be used as property values. + * It also supports nested `Partial` by allowing nested fields to be + * omitted. + */ + toFirestore(modelObject: PartialWithFieldValue<AppModelType>, options: SetOptions): PartialWithFieldValue<DbModelType>; + /** + * Called by the Firestore SDK to convert Firestore data into an object of + * type `AppModelType`. You can access your data by calling: + * `snapshot.data(options)`. + * + * Generally, the data returned from `snapshot.data()` can be cast to + * `DbModelType`; however, this is not guaranteed because Firestore does not + * enforce a schema on the database. For example, writes from a previous + * version of the application or writes from another client that did not use a + * type converter could have written data with different properties and/or + * property types. The implementation will need to choose whether to + * gracefully recover from non-conforming data or throw an error. + * + * To override this method, see {@link (FirestoreDataConverter.fromFirestore:1)}. + * + * @param snapshot - A `QueryDocumentSnapshot` containing your data and metadata. + * @param options - The `SnapshotOptions` from the initial call to `data()`. + */ + fromFirestore(snapshot: QueryDocumentSnapshot<DocumentData, DocumentData>, options?: SnapshotOptions): AppModelType; +} +/** + * Options that configure how data is retrieved from a `DocumentSnapshot` (for + * example the desired behavior for server timestamps that have not yet been set + * to their final value). + */ +interface SnapshotOptions { + /** + * If set, controls the return value for server timestamps that have not yet + * been set to their final value. + * + * By specifying 'estimate', pending server timestamps return an estimate + * based on the local clock. This estimate will differ from the final value + * and cause these values to change once the server result becomes available. + * + * By specifying 'previous', pending timestamps will be ignored and return + * their previous value instead. + * + * If omitted or set to 'none', `null` will be returned by default until the + * server value becomes available. + */ + readonly serverTimestamps?: 'estimate' | 'previous' | 'none'; +} +/** + * Metadata about a snapshot, describing the state of the snapshot. + */ +declare class SnapshotMetadata { + /** + * True if the snapshot contains the result of local writes (for example + * `set()` or `update()` calls) that have not yet been committed to the + * backend. If your listener has opted into metadata updates (via + * `SnapshotListenOptions`) you will receive another snapshot with + * `hasPendingWrites` equal to false once the writes have been committed to + * the backend. + */ + readonly hasPendingWrites: boolean; + /** + * True if the snapshot was created from cached data rather than guaranteed + * up-to-date server data. If your listener has opted into metadata updates + * (via `SnapshotListenOptions`) you will receive another snapshot with + * `fromCache` set to false once the client has received up-to-date data from + * the backend. + */ + readonly fromCache: boolean; + /** @hideconstructor */ + constructor(hasPendingWrites: boolean, fromCache: boolean); + /** + * Returns true if this `SnapshotMetadata` is equal to the provided one. + * + * @param other - The `SnapshotMetadata` to compare against. + * @returns true if this `SnapshotMetadata` is equal to the provided one. + */ + isEqual(other: SnapshotMetadata): boolean; +} +/** + * The type of a `DocumentChange` may be 'added', 'removed', or 'modified'. + */ +type DocumentChangeType = 'added' | 'removed' | 'modified'; +/** + * A `DocumentChange` represents a change to the documents matching a query. + * It contains the document affected and the type of change that occurred. + */ +interface DocumentChange<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> { + /** The type of change ('added', 'modified', or 'removed'). */ + readonly type: DocumentChangeType; + /** The document affected by this change. */ + readonly doc: QueryDocumentSnapshot<AppModelType, DbModelType>; + /** + * The index of the changed document in the result set immediately prior to + * this `DocumentChange` (i.e. supposing that all prior `DocumentChange` objects + * have been applied). Is `-1` for 'added' events. + */ + readonly oldIndex: number; + /** + * The index of the changed document in the result set immediately after + * this `DocumentChange` (i.e. supposing that all prior `DocumentChange` + * objects and the current `DocumentChange` object have been applied). + * Is -1 for 'removed' events. + */ + readonly newIndex: number; +} +/** + * A `DocumentSnapshot` contains data read from a document in your Firestore + * database. The data can be extracted with `.data()` or `.get(<field>)` to + * get a specific field. + * + * For a `DocumentSnapshot` that points to a non-existing document, any data + * access will return 'undefined'. You can use the `exists()` method to + * explicitly verify a document's existence. + */ +declare class DocumentSnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> extends DocumentSnapshot$1<AppModelType, DbModelType> { + readonly _firestore: Firestore; + private readonly _firestoreImpl; + /** + * Metadata about the `DocumentSnapshot`, including information about its + * source and local modifications. + */ + readonly metadata: SnapshotMetadata; + /** @hideconstructor protected */ + constructor(_firestore: Firestore, userDataWriter: AbstractUserDataWriter, key: DocumentKey, document: Document | null, metadata: SnapshotMetadata, converter: UntypedFirestoreDataConverter<AppModelType, DbModelType> | null); + /** + * Returns whether or not the data exists. True if the document exists. + */ + exists(): this is QueryDocumentSnapshot<AppModelType, DbModelType>; + /** + * Retrieves all fields in the document as an `Object`. Returns `undefined` if + * the document doesn't exist. + * + * By default, `serverTimestamp()` values that have not yet been + * set to their final value will be returned as `null`. You can override + * this by passing an options object. + * + * @param options - An options object to configure how data is retrieved from + * the snapshot (for example the desired behavior for server timestamps that + * have not yet been set to their final value). + * @returns An `Object` containing all fields in the document or `undefined` if + * the document doesn't exist. + */ + data(options?: SnapshotOptions): AppModelType | undefined; + /** + * Retrieves the field specified by `fieldPath`. Returns `undefined` if the + * document or field doesn't exist. + * + * By default, a `serverTimestamp()` that has not yet been set to + * its final value will be returned as `null`. You can override this by + * passing an options object. + * + * @param fieldPath - The path (for example 'foo' or 'foo.bar') to a specific + * field. + * @param options - An options object to configure how the field is retrieved + * from the snapshot (for example the desired behavior for server timestamps + * that have not yet been set to their final value). + * @returns The data at the specified field location or undefined if no such + * field exists in the document. + */ + get(fieldPath: string | FieldPath, options?: SnapshotOptions): any; + static _jsonSchemaVersion: string; + static _jsonSchema: { + type: Property<"string">; + bundleSource: Property<"string">; + bundleName: Property<"string">; + bundle: Property<"string">; + }; + /** + * Returns a JSON-serializable representation of this `DocumentSnapshot` instance. + * + * @returns a JSON representation of this object. Throws a {@link FirestoreError} if this + * `DocumentSnapshot` has pending writes. + */ + toJSON(): object; +} +/** + * Builds a `DocumentSnapshot` instance from a JSON object created by + * {@link DocumentSnapshot.toJSON}. + * + * @param firestore - The {@link Firestore} instance the snapshot should be loaded for. + * @param json - a JSON object represention of a `DocumentSnapshot` instance. + * @returns an instance of {@link DocumentSnapshot} if the JSON object could be + * parsed. Throws a {@link FirestoreError} if an error occurs. + */ +declare function documentSnapshotFromJSON(db: Firestore, json: object): DocumentSnapshot; +/** + * Builds a `DocumentSnapshot` instance from a JSON object created by + * {@link DocumentSnapshot.toJSON}. + * + * @param firestore - The {@link Firestore} instance the snapshot should be loaded for. + * @param json - a JSON object represention of a `DocumentSnapshot` instance. + * @param converter - Converts objects to and from Firestore. + * @returns an instance of {@link DocumentSnapshot} if the JSON object could be + * parsed. Throws a {@link FirestoreError} if an error occurs. + */ +declare function documentSnapshotFromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: Firestore, json: object, converter: FirestoreDataConverter<AppModelType, DbModelType>): DocumentSnapshot<AppModelType, DbModelType>; +/** + * A `QueryDocumentSnapshot` contains data read from a document in your + * Firestore database as part of a query. The document is guaranteed to exist + * and its data can be extracted with `.data()` or `.get(<field>)` to get a + * specific field. + * + * A `QueryDocumentSnapshot` offers the same API surface as a + * `DocumentSnapshot`. Since query results contain only existing documents, the + * `exists` property will always be true and `data()` will never return + * 'undefined'. + */ +declare class QueryDocumentSnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> extends DocumentSnapshot<AppModelType, DbModelType> { + /** + * Retrieves all fields in the document as an `Object`. + * + * By default, `serverTimestamp()` values that have not yet been + * set to their final value will be returned as `null`. You can override + * this by passing an options object. + * + * @override + * @param options - An options object to configure how data is retrieved from + * the snapshot (for example the desired behavior for server timestamps that + * have not yet been set to their final value). + * @returns An `Object` containing all fields in the document. + */ + data(options?: SnapshotOptions): AppModelType; +} +/** + * A `QuerySnapshot` contains zero or more `DocumentSnapshot` objects + * representing the results of a query. The documents can be accessed as an + * array via the `docs` property or enumerated using the `forEach` method. The + * number of documents can be determined via the `empty` and `size` + * properties. + */ +declare class QuerySnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> { + readonly _firestore: Firestore; + readonly _userDataWriter: AbstractUserDataWriter; + readonly _snapshot: ViewSnapshot; + /** + * Metadata about this snapshot, concerning its source and if it has local + * modifications. + */ + readonly metadata: SnapshotMetadata; + /** + * The query on which you called `get` or `onSnapshot` in order to get this + * `QuerySnapshot`. + */ + readonly query: Query<AppModelType, DbModelType>; + private _cachedChanges?; + private _cachedChangesIncludeMetadataChanges?; + /** @hideconstructor */ + constructor(_firestore: Firestore, _userDataWriter: AbstractUserDataWriter, query: Query<AppModelType, DbModelType>, _snapshot: ViewSnapshot); + /** An array of all the documents in the `QuerySnapshot`. */ + get docs(): Array<QueryDocumentSnapshot<AppModelType, DbModelType>>; + /** The number of documents in the `QuerySnapshot`. */ + get size(): number; + /** True if there are no documents in the `QuerySnapshot`. */ + get empty(): boolean; + /** + * Enumerates all of the documents in the `QuerySnapshot`. + * + * @param callback - A callback to be called with a `QueryDocumentSnapshot` for + * each document in the snapshot. + * @param thisArg - The `this` binding for the callback. + */ + forEach(callback: (result: QueryDocumentSnapshot<AppModelType, DbModelType>) => void, thisArg?: unknown): void; + /** + * Returns an array of the documents changes since the last snapshot. If this + * is the first snapshot, all documents will be in the list as 'added' + * changes. + * + * @param options - `SnapshotListenOptions` that control whether metadata-only + * changes (i.e. only `DocumentSnapshot.metadata` changed) should trigger + * snapshot events. + */ + docChanges(options?: SnapshotListenOptions): Array<DocumentChange<AppModelType, DbModelType>>; + static _jsonSchemaVersion: string; + static _jsonSchema: { + type: Property<"string">; + bundleSource: Property<"string">; + bundleName: Property<"string">; + bundle: Property<"string">; + }; + /** + * Returns a JSON-serializable representation of this `QuerySnapshot` instance. + * + * @returns a JSON representation of this object. Throws a {@link FirestoreError} if this + * `QuerySnapshot` has pending writes. + */ + toJSON(): object; +} +/** + * Builds a `QuerySnapshot` instance from a JSON object created by + * {@link QuerySnapshot.toJSON}. + * + * @param firestore - The {@link Firestore} instance the snapshot should be loaded for. + * @param json - a JSON object represention of a `QuerySnapshot` instance. + * @returns an instance of {@link QuerySnapshot} if the JSON object could be + * parsed. Throws a {@link FirestoreError} if an error occurs. + */ +declare function querySnapshotFromJSON(db: Firestore, json: object): QuerySnapshot; +/** + * Builds a `QuerySnapshot` instance from a JSON object created by + * {@link QuerySnapshot.toJSON}. + * + * @param firestore - The {@link Firestore} instance the snapshot should be loaded for. + * @param json - a JSON object represention of a `QuerySnapshot` instance. + * @param converter - Converts objects to and from Firestore. + * @returns an instance of {@link QuerySnapshot} if the JSON object could be + * parsed. Throws a {@link FirestoreError} if an error occurs. + */ +declare function querySnapshotFromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: Firestore, json: object, converter: FirestoreDataConverter<AppModelType, DbModelType>): QuerySnapshot<AppModelType, DbModelType>; +/** + * Returns true if the provided snapshots are equal. + * + * @param left - A snapshot to compare. + * @param right - A snapshot to compare. + * @returns true if the snapshots are equal. + */ +declare function snapshotEqual<AppModelType, DbModelType extends DocumentData>(left: DocumentSnapshot<AppModelType, DbModelType> | QuerySnapshot<AppModelType, DbModelType>, right: DocumentSnapshot<AppModelType, DbModelType> | QuerySnapshot<AppModelType, DbModelType>): boolean; + +/** + * @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. + */ + +/** Describes the different query constraints available in this SDK. */ +type QueryConstraintType = 'where' | 'orderBy' | 'limit' | 'limitToLast' | 'startAt' | 'startAfter' | 'endAt' | 'endBefore'; +/** + * An `AppliableConstraint` is an abstraction of a constraint that can be applied + * to a Firestore query. + */ +declare abstract class AppliableConstraint { + /** + * Takes the provided {@link Query} and returns a copy of the {@link Query} with this + * {@link AppliableConstraint} applied. + */ + abstract _apply<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>; +} +/** + * A `QueryConstraint` is used to narrow the set of documents returned by a + * Firestore query. `QueryConstraint`s are created by invoking {@link where}, + * {@link orderBy}, {@link (startAt:1)}, {@link (startAfter:1)}, {@link + * (endBefore:1)}, {@link (endAt:1)}, {@link limit}, {@link limitToLast} and + * can then be passed to {@link (query:1)} to create a new query instance that + * also contains this `QueryConstraint`. + */ +declare abstract class QueryConstraint extends AppliableConstraint { + /** The type of this query constraint */ + abstract readonly type: QueryConstraintType; + /** + * Takes the provided {@link Query} and returns a copy of the {@link Query} with this + * {@link AppliableConstraint} applied. + */ + abstract _apply<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>; +} +/** + * Creates a new immutable instance of {@link Query} that is extended to also + * include additional query constraints. + * + * @param query - The {@link Query} instance to use as a base for the new + * constraints. + * @param compositeFilter - The {@link QueryCompositeFilterConstraint} to + * apply. Create {@link QueryCompositeFilterConstraint} using {@link and} or + * {@link or}. + * @param queryConstraints - Additional {@link QueryNonFilterConstraint}s to + * apply (e.g. {@link orderBy}, {@link limit}). + * @throws if any of the provided query constraints cannot be combined with the + * existing or new constraints. + */ +declare function query<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, compositeFilter: QueryCompositeFilterConstraint, ...queryConstraints: QueryNonFilterConstraint[]): Query<AppModelType, DbModelType>; +/** + * Creates a new immutable instance of {@link Query} that is extended to also + * include additional query constraints. + * + * @param query - The {@link Query} instance to use as a base for the new + * constraints. + * @param queryConstraints - The list of {@link QueryConstraint}s to apply. + * @throws if any of the provided query constraints cannot be combined with the + * existing or new constraints. + */ +declare function query<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, ...queryConstraints: QueryConstraint[]): Query<AppModelType, DbModelType>; +/** + * A `QueryFieldFilterConstraint` is used to narrow the set of documents returned by + * a Firestore query by filtering on one or more document fields. + * `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then + * be passed to {@link (query:1)} to create a new query instance that also contains + * this `QueryFieldFilterConstraint`. + */ +declare class QueryFieldFilterConstraint extends QueryConstraint { + private readonly _field; + private _op; + private _value; + /** The type of this query constraint */ + readonly type = "where"; + /** + * @internal + */ + protected constructor(_field: FieldPath$2, _op: Operator, _value: unknown); + static _create(_field: FieldPath$2, _op: Operator, _value: unknown): QueryFieldFilterConstraint; + _apply<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>; + _parse<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): FieldFilter; +} +/** + * Filter conditions in a {@link where} clause are specified using the + * strings '<', '<=', '==', '!=', '>=', '>', 'array-contains', 'in', + * 'array-contains-any', and 'not-in'. + */ +type WhereFilterOp = '<' | '<=' | '==' | '!=' | '>=' | '>' | 'array-contains' | 'in' | 'array-contains-any' | 'not-in'; +/** + * Creates a {@link QueryFieldFilterConstraint} that enforces that documents + * must contain the specified field and that the value should satisfy the + * relation constraint provided. + * + * @param fieldPath - The path to compare + * @param opStr - The operation string (e.g "<", "<=", "==", "<", + * "<=", "!="). + * @param value - The value for comparison + * @returns The created {@link QueryFieldFilterConstraint}. + */ +declare function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryFieldFilterConstraint; +/** + * A `QueryCompositeFilterConstraint` is used to narrow the set of documents + * returned by a Firestore query by performing the logical OR or AND of multiple + * {@link QueryFieldFilterConstraint}s or {@link QueryCompositeFilterConstraint}s. + * `QueryCompositeFilterConstraint`s are created by invoking {@link or} or + * {@link and} and can then be passed to {@link (query:1)} to create a new query + * instance that also contains the `QueryCompositeFilterConstraint`. + */ +declare class QueryCompositeFilterConstraint extends AppliableConstraint { + /** The type of this query constraint */ + readonly type: 'or' | 'and'; + private readonly _queryConstraints; + /** + * @internal + */ + protected constructor( + /** The type of this query constraint */ + type: 'or' | 'and', _queryConstraints: QueryFilterConstraint[]); + static _create(type: 'or' | 'and', _queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint; + _parse<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Filter; + _apply<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>; + _getQueryConstraints(): readonly AppliableConstraint[]; + _getOperator(): CompositeOperator; +} +/** + * `QueryNonFilterConstraint` is a helper union type that represents + * QueryConstraints which are used to narrow or order the set of documents, + * but that do not explicitly filter on a document field. + * `QueryNonFilterConstraint`s are created by invoking {@link orderBy}, + * {@link (startAt:1)}, {@link (startAfter:1)}, {@link (endBefore:1)}, {@link (endAt:1)}, + * {@link limit} or {@link limitToLast} and can then be passed to {@link (query:1)} + * to create a new query instance that also contains the `QueryConstraint`. + */ +type QueryNonFilterConstraint = QueryOrderByConstraint | QueryLimitConstraint | QueryStartAtConstraint | QueryEndAtConstraint; +/** + * `QueryFilterConstraint` is a helper union type that represents + * {@link QueryFieldFilterConstraint} and {@link QueryCompositeFilterConstraint}. + */ +type QueryFilterConstraint = QueryFieldFilterConstraint | QueryCompositeFilterConstraint; +/** + * Creates a new {@link QueryCompositeFilterConstraint} that is a disjunction of + * the given filter constraints. A disjunction filter includes a document if it + * satisfies any of the given filters. + * + * @param queryConstraints - Optional. The list of + * {@link QueryFilterConstraint}s to perform a disjunction for. These must be + * created with calls to {@link where}, {@link or}, or {@link and}. + * @returns The newly created {@link QueryCompositeFilterConstraint}. + */ +declare function or(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint; +/** + * Creates a new {@link QueryCompositeFilterConstraint} that is a conjunction of + * the given filter constraints. A conjunction filter includes a document if it + * satisfies all of the given filters. + * + * @param queryConstraints - Optional. The list of + * {@link QueryFilterConstraint}s to perform a conjunction for. These must be + * created with calls to {@link where}, {@link or}, or {@link and}. + * @returns The newly created {@link QueryCompositeFilterConstraint}. + */ +declare function and(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint; +/** + * A `QueryOrderByConstraint` is used to sort the set of documents returned by a + * Firestore query. `QueryOrderByConstraint`s are created by invoking + * {@link orderBy} and can then be passed to {@link (query:1)} to create a new query + * instance that also contains this `QueryOrderByConstraint`. + * + * Note: Documents that do not contain the orderBy field will not be present in + * the query result. + */ +declare class QueryOrderByConstraint extends QueryConstraint { + private readonly _field; + private _direction; + /** The type of this query constraint */ + readonly type = "orderBy"; + /** + * @internal + */ + protected constructor(_field: FieldPath$2, _direction: Direction); + static _create(_field: FieldPath$2, _direction: Direction): QueryOrderByConstraint; + _apply<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>; +} +/** + * The direction of a {@link orderBy} clause is specified as 'desc' or 'asc' + * (descending or ascending). + */ +type OrderByDirection = 'desc' | 'asc'; +/** + * Creates a {@link QueryOrderByConstraint} that sorts the query result by the + * specified field, optionally in descending order instead of ascending. + * + * Note: Documents that do not contain the specified field will not be present + * in the query result. + * + * @param fieldPath - The field to sort by. + * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If + * not specified, order will be ascending. + * @returns The created {@link QueryOrderByConstraint}. + */ +declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryOrderByConstraint; +/** + * A `QueryLimitConstraint` is used to limit the number of documents returned by + * a Firestore query. + * `QueryLimitConstraint`s are created by invoking {@link limit} or + * {@link limitToLast} and can then be passed to {@link (query:1)} to create a new + * query instance that also contains this `QueryLimitConstraint`. + */ +declare class QueryLimitConstraint extends QueryConstraint { + /** The type of this query constraint */ + readonly type: 'limit' | 'limitToLast'; + private readonly _limit; + private readonly _limitType; + /** + * @internal + */ + protected constructor( + /** The type of this query constraint */ + type: 'limit' | 'limitToLast', _limit: number, _limitType: LimitType$1); + static _create(type: 'limit' | 'limitToLast', _limit: number, _limitType: LimitType$1): QueryLimitConstraint; + _apply<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>; +} +/** + * Creates a {@link QueryLimitConstraint} that only returns the first matching + * documents. + * + * @param limit - The maximum number of items to return. + * @returns The created {@link QueryLimitConstraint}. + */ +declare function limit(limit: number): QueryLimitConstraint; +/** + * Creates a {@link QueryLimitConstraint} that only returns the last matching + * documents. + * + * You must specify at least one `orderBy` clause for `limitToLast` queries, + * otherwise an exception will be thrown during execution. + * + * @param limit - The maximum number of items to return. + * @returns The created {@link QueryLimitConstraint}. + */ +declare function limitToLast(limit: number): QueryLimitConstraint; +/** + * A `QueryStartAtConstraint` is used to exclude documents from the start of a + * result set returned by a Firestore query. + * `QueryStartAtConstraint`s are created by invoking {@link (startAt:1)} or + * {@link (startAfter:1)} and can then be passed to {@link (query:1)} to create a + * new query instance that also contains this `QueryStartAtConstraint`. + */ +declare class QueryStartAtConstraint extends QueryConstraint { + /** The type of this query constraint */ + readonly type: 'startAt' | 'startAfter'; + private readonly _docOrFields; + private readonly _inclusive; + /** + * @internal + */ + protected constructor( + /** The type of this query constraint */ + type: 'startAt' | 'startAfter', _docOrFields: Array<unknown | DocumentSnapshot$1<unknown>>, _inclusive: boolean); + static _create(type: 'startAt' | 'startAfter', _docOrFields: Array<unknown | DocumentSnapshot$1<unknown>>, _inclusive: boolean): QueryStartAtConstraint; + _apply<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>; +} +/** + * Creates a {@link QueryStartAtConstraint} that modifies the result set to + * start at the provided document (inclusive). The starting position is relative + * to the order of the query. The document must contain all of the fields + * provided in the `orderBy` of this query. + * + * @param snapshot - The snapshot of the document to start at. + * @returns A {@link QueryStartAtConstraint} to pass to `query()`. + */ +declare function startAt<AppModelType, DbModelType extends DocumentData>(snapshot: DocumentSnapshot$1<AppModelType, DbModelType>): QueryStartAtConstraint; +/** + * Creates a {@link QueryStartAtConstraint} that modifies the result set to + * start at the provided fields relative to the order of the query. The order of + * the field values must match the order of the order by clauses of the query. + * + * @param fieldValues - The field values to start this query at, in order + * of the query's order by. + * @returns A {@link QueryStartAtConstraint} to pass to `query()`. + */ +declare function startAt(...fieldValues: unknown[]): QueryStartAtConstraint; +/** + * Creates a {@link QueryStartAtConstraint} that modifies the result set to + * start after the provided document (exclusive). The starting position is + * relative to the order of the query. The document must contain all of the + * fields provided in the orderBy of the query. + * + * @param snapshot - The snapshot of the document to start after. + * @returns A {@link QueryStartAtConstraint} to pass to `query()` + */ +declare function startAfter<AppModelType, DbModelType extends DocumentData>(snapshot: DocumentSnapshot$1<AppModelType, DbModelType>): QueryStartAtConstraint; +/** + * Creates a {@link QueryStartAtConstraint} that modifies the result set to + * start after the provided fields relative to the order of the query. The order + * of the field values must match the order of the order by clauses of the query. + * + * @param fieldValues - The field values to start this query after, in order + * of the query's order by. + * @returns A {@link QueryStartAtConstraint} to pass to `query()` + */ +declare function startAfter(...fieldValues: unknown[]): QueryStartAtConstraint; +/** + * A `QueryEndAtConstraint` is used to exclude documents from the end of a + * result set returned by a Firestore query. + * `QueryEndAtConstraint`s are created by invoking {@link (endAt:1)} or + * {@link (endBefore:1)} and can then be passed to {@link (query:1)} to create a new + * query instance that also contains this `QueryEndAtConstraint`. + */ +declare class QueryEndAtConstraint extends QueryConstraint { + /** The type of this query constraint */ + readonly type: 'endBefore' | 'endAt'; + private readonly _docOrFields; + private readonly _inclusive; + /** + * @internal + */ + protected constructor( + /** The type of this query constraint */ + type: 'endBefore' | 'endAt', _docOrFields: Array<unknown | DocumentSnapshot$1<unknown>>, _inclusive: boolean); + static _create(type: 'endBefore' | 'endAt', _docOrFields: Array<unknown | DocumentSnapshot$1<unknown>>, _inclusive: boolean): QueryEndAtConstraint; + _apply<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>; +} +/** + * Creates a {@link QueryEndAtConstraint} that modifies the result set to end + * before the provided document (exclusive). The end position is relative to the + * order of the query. The document must contain all of the fields provided in + * the orderBy of the query. + * + * @param snapshot - The snapshot of the document to end before. + * @returns A {@link QueryEndAtConstraint} to pass to `query()` + */ +declare function endBefore<AppModelType, DbModelType extends DocumentData>(snapshot: DocumentSnapshot$1<AppModelType, DbModelType>): QueryEndAtConstraint; +/** + * Creates a {@link QueryEndAtConstraint} that modifies the result set to end + * before the provided fields relative to the order of the query. The order of + * the field values must match the order of the order by clauses of the query. + * + * @param fieldValues - The field values to end this query before, in order + * of the query's order by. + * @returns A {@link QueryEndAtConstraint} to pass to `query()` + */ +declare function endBefore(...fieldValues: unknown[]): QueryEndAtConstraint; +/** + * Creates a {@link QueryEndAtConstraint} that modifies the result set to end at + * the provided document (inclusive). The end position is relative to the order + * of the query. The document must contain all of the fields provided in the + * orderBy of the query. + * + * @param snapshot - The snapshot of the document to end at. + * @returns A {@link QueryEndAtConstraint} to pass to `query()` + */ +declare function endAt<AppModelType, DbModelType extends DocumentData>(snapshot: DocumentSnapshot$1<AppModelType, DbModelType>): QueryEndAtConstraint; +/** + * Creates a {@link QueryEndAtConstraint} that modifies the result set to end at + * the provided fields relative to the order of the query. The order of the field + * values must match the order of the order by clauses of the query. + * + * @param fieldValues - The field values to end this query at, in order + * of the query's order by. + * @returns A {@link QueryEndAtConstraint} to pass to `query()` + */ +declare function endAt(...fieldValues: unknown[]): QueryEndAtConstraint; + +/** + * @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. + */ +/** + * Options to customize transaction behavior. + */ +declare interface TransactionOptions { + /** Maximum number of attempts to commit, after which transaction fails. Default is 5. */ + readonly maxAttempts?: number; +} + +/** + * @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. + */ + +/** + * A reference to a transaction. + * + * The `Transaction` object passed to a transaction's `updateFunction` provides + * the methods to read and write data within the transaction context. See + * {@link runTransaction}. + */ +declare class Transaction$1 { + protected readonly _firestore: Firestore$1; + private readonly _transaction; + private readonly _dataReader; + /** @hideconstructor */ + constructor(_firestore: Firestore$1, _transaction: Transaction$2); + /** + * Reads the document referenced by the provided {@link DocumentReference}. + * + * @param documentRef - A reference to the document to be read. + * @returns A `DocumentSnapshot` with the read data. + */ + get<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot$1<AppModelType, DbModelType>>; + /** + * Writes to the document referred to by the provided {@link + * DocumentReference}. If the document does not exist yet, it will be created. + * + * @param documentRef - A reference to the document to be set. + * @param data - An object of the fields and values for the document. + * @throws Error - If the provided input is not a valid Firestore document. + * @returns This `Transaction` instance. Used for chaining method calls. + */ + set<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>, data: WithFieldValue<AppModelType>): this; + /** + * Writes to the document referred to by the provided {@link + * DocumentReference}. If the document does not exist yet, it will be created. + * If you provide `merge` or `mergeFields`, the provided data can be merged + * into an existing document. + * + * @param documentRef - A reference to the document to be set. + * @param data - An object of the fields and values for the document. + * @param options - An object to configure the set behavior. + * @throws Error - If the provided input is not a valid Firestore document. + * @returns This `Transaction` instance. Used for chaining method calls. + */ + set<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>, data: PartialWithFieldValue<AppModelType>, options: SetOptions): this; + /** + * Updates fields in the document referred to by the provided {@link + * DocumentReference}. The update will fail if applied to a document that does + * not exist. + * + * @param documentRef - A reference to the document to be updated. + * @param data - An object containing the fields and values with which to + * update the document. Fields can contain dots to reference nested fields + * within the document. + * @throws Error - If the provided input is not valid Firestore data. + * @returns This `Transaction` instance. Used for chaining method calls. + */ + update<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>, data: UpdateData<DbModelType>): this; + /** + * Updates fields in the document referred to by the provided {@link + * DocumentReference}. The update will fail if applied to a document that does + * not exist. + * + * Nested fields can be updated by providing dot-separated field path + * strings or by providing `FieldPath` objects. + * + * @param documentRef - A reference to the document to be updated. + * @param field - The first field to update. + * @param value - The first value. + * @param moreFieldsAndValues - Additional key/value pairs. + * @throws Error - If the provided input is not valid Firestore data. + * @returns This `Transaction` instance. Used for chaining method calls. + */ + update<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): this; + /** + * Deletes the document referred to by the provided {@link DocumentReference}. + * + * @param documentRef - A reference to the document to be deleted. + * @returns This `Transaction` instance. Used for chaining method calls. + */ + delete<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>): this; +} + +/** + * @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. + */ + +/** + * A reference to a transaction. + * + * The `Transaction` object passed to a transaction's `updateFunction` provides + * the methods to read and write data within the transaction context. See + * {@link runTransaction}. + */ +declare class Transaction extends Transaction$1 { + protected readonly _firestore: Firestore; + /** @hideconstructor */ + constructor(_firestore: Firestore, _transaction: Transaction$2); + /** + * Reads the document referenced by the provided {@link DocumentReference}. + * + * @param documentRef - A reference to the document to be read. + * @returns A `DocumentSnapshot` with the read data. + */ + get<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>; +} +/** + * Executes the given `updateFunction` and then attempts to commit the changes + * applied within the transaction. If any document read within the transaction + * has changed, Cloud Firestore retries the `updateFunction`. If it fails to + * commit after 5 attempts, the transaction fails. + * + * The maximum number of writes allowed in a single transaction is 500. + * + * @param firestore - A reference to the Firestore database to run this + * transaction against. + * @param updateFunction - The function to execute within the transaction + * context. + * @param options - An options object to configure maximum number of attempts to + * commit. + * @returns If the transaction completed successfully or was explicitly aborted + * (the `updateFunction` returned a failed promise), the promise returned by the + * `updateFunction `is returned here. Otherwise, if the transaction failed, a + * rejected promise with the corresponding failure error is returned. + */ +declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>; + +/** + * @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. + */ + +/** + * Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or + * {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion. + */ +declare function deleteField(): FieldValue; +/** + * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to + * include a server-generated timestamp in the written data. + */ +declare function serverTimestamp(): FieldValue; +/** + * Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link + * @firebase/firestore/lite#(updateDoc:1)} that tells the server to union the given elements with any array + * value that already exists on the server. Each specified element that doesn't + * already exist in the array will be added to the end. If the field being + * modified is not already an array it will be overwritten with an array + * containing exactly the specified elements. + * + * @param elements - The elements to union into the array. + * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or + * `updateDoc()`. + */ +declare function arrayUnion(...elements: unknown[]): FieldValue; +/** + * Returns a special value that can be used with {@link (setDoc:1)} or {@link + * updateDoc:1} that tells the server to remove the given elements from any + * array value that already exists on the server. All instances of each element + * specified will be removed from the array. If the field being modified is not + * already an array it will be overwritten with an empty array. + * + * @param elements - The elements to remove from the array. + * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or + * `updateDoc()` + */ +declare function arrayRemove(...elements: unknown[]): FieldValue; +/** + * Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link + * @firebase/firestore/lite#(updateDoc:1)} that tells the server to increment the field's current value by + * the given value. + * + * If either the operand or the current field value uses floating point + * precision, all arithmetic follows IEEE 754 semantics. If both values are + * integers, values outside of JavaScript's safe number range + * (`Number.MIN_SAFE_INTEGER` to `Number.MAX_SAFE_INTEGER`) are also subject to + * precision loss. Furthermore, once processed by the Firestore backend, all + * integer operations are capped between -2^63 and 2^63-1. + * + * If the current field value is not of type `number`, or if the field does not + * yet exist, the transformation sets the field to the given value. + * + * @param n - The value to increment by. + * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or + * `updateDoc()` + */ +declare function increment(n: number): FieldValue; +/** + * Creates a new `VectorValue` constructed with a copy of the given array of numbers. + * + * @param values - Create a `VectorValue` instance with a copy of this array of numbers. + * + * @returns A new `VectorValue` constructed with a copy of the given array of numbers. + */ +declare function vector(values?: number[]): VectorValue; + +/** + * @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. + */ + +/** + * Sets the verbosity of Cloud Firestore logs (debug, error, or silent). + * + * @param logLevel - The verbosity you set for activity and error logging. Can + * be any of the following values: + * + * <ul> + * <li>`debug` for the most verbose logging level, primarily for + * debugging.</li> + * <li>`error` to log errors only.</li> + * <li><code>`silent` to turn off logging.</li> + * </ul> + */ +declare function setLogLevel(logLevel: LogLevelString): void; +/** + * @internal + */ +declare function logWarn(msg: string, ...obj: unknown[]): void; + +/** + * @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. + */ + +/** + * A write batch, used to perform multiple writes as a single atomic unit. + * + * A `WriteBatch` object can be acquired by calling {@link writeBatch}. It + * provides methods for adding writes to the write batch. None of the writes + * will be committed (or visible locally) until {@link WriteBatch.commit} is + * called. + */ +declare class WriteBatch { + private readonly _firestore; + private readonly _commitHandler; + private readonly _dataReader; + private _mutations; + private _committed; + /** @hideconstructor */ + constructor(_firestore: Firestore$1, _commitHandler: (m: Mutation[]) => Promise<void>); + /** + * Writes to the document referred to by the provided {@link + * DocumentReference}. If the document does not exist yet, it will be created. + * + * @param documentRef - A reference to the document to be set. + * @param data - An object of the fields and values for the document. + * @returns This `WriteBatch` instance. Used for chaining method calls. + */ + set<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>, data: WithFieldValue<AppModelType>): WriteBatch; + /** + * Writes to the document referred to by the provided {@link + * DocumentReference}. If the document does not exist yet, it will be created. + * If you provide `merge` or `mergeFields`, the provided data can be merged + * into an existing document. + * + * @param documentRef - A reference to the document to be set. + * @param data - An object of the fields and values for the document. + * @param options - An object to configure the set behavior. + * @throws Error - If the provided input is not a valid Firestore document. + * @returns This `WriteBatch` instance. Used for chaining method calls. + */ + set<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>, data: PartialWithFieldValue<AppModelType>, options: SetOptions): WriteBatch; + /** + * Updates fields in the document referred to by the provided {@link + * DocumentReference}. The update will fail if applied to a document that does + * not exist. + * + * @param documentRef - A reference to the document to be updated. + * @param data - An object containing the fields and values with which to + * update the document. Fields can contain dots to reference nested fields + * within the document. + * @throws Error - If the provided input is not valid Firestore data. + * @returns This `WriteBatch` instance. Used for chaining method calls. + */ + update<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>, data: UpdateData<DbModelType>): WriteBatch; + /** + * Updates fields in the document referred to by this {@link + * DocumentReference}. The update will fail if applied to a document that does + * not exist. + * + * Nested fields can be update by providing dot-separated field path strings + * or by providing `FieldPath` objects. + * + * @param documentRef - A reference to the document to be updated. + * @param field - The first field to update. + * @param value - The first value. + * @param moreFieldsAndValues - Additional key value pairs. + * @throws Error - If the provided input is not valid Firestore data. + * @returns This `WriteBatch` instance. Used for chaining method calls. + */ + update<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): WriteBatch; + /** + * Deletes the document referred to by the provided {@link DocumentReference}. + * + * @param documentRef - A reference to the document to be deleted. + * @returns This `WriteBatch` instance. Used for chaining method calls. + */ + delete<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>): WriteBatch; + /** + * Commits all of the writes in this write batch as a single atomic unit. + * + * The result of these writes will only be reflected in document reads that + * occur after the returned promise resolves. If the client is offline, the + * write fails. If you would like to see local modifications or buffer writes + * until the client is online, use the full Firestore SDK. + * + * @returns A `Promise` resolved once all of the writes in the batch have been + * successfully written to the backend as an atomic unit (note that it won't + * resolve while you're offline). + */ + commit(): Promise<void>; + private _verifyNotCommitted; +} + +/** + * @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. + */ + +/** + * Creates a write batch, used for performing multiple writes as a single + * atomic operation. The maximum number of writes allowed in a single {@link WriteBatch} + * is 500. + * + * Unlike transactions, write batches are persisted offline and therefore are + * preferable when you don't need to condition your writes on read data. + * + * @returns A {@link WriteBatch} that can be used to atomically execute multiple + * writes. + */ +declare function writeBatch(firestore: Firestore): WriteBatch; + +/** + * @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. + */ + +/** + * An immutable object representing a geographic location in Firestore. The + * location is represented as latitude/longitude pair. + * + * Latitude values are in the range of [-90, 90]. + * Longitude values are in the range of [-180, 180]. + */ +declare class GeoPoint { + private _lat; + private _long; + /** + * Creates a new immutable `GeoPoint` object with the provided latitude and + * longitude values. + * @param latitude - The latitude as number between -90 and 90. + * @param longitude - The longitude as number between -180 and 180. + */ + constructor(latitude: number, longitude: number); + /** + * The latitude of this `GeoPoint` instance. + */ + get latitude(): number; + /** + * The longitude of this `GeoPoint` instance. + */ + get longitude(): number; + /** + * Returns true if this `GeoPoint` is equal to the provided one. + * + * @param other - The `GeoPoint` to compare against. + * @returns true if this `GeoPoint` is equal to the provided one. + */ + isEqual(other: GeoPoint): boolean; + /** + * Actually private to JS consumers of our API, so this function is prefixed + * with an underscore. + */ + _compareTo(other: GeoPoint): number; + static _jsonSchemaVersion: string; + static _jsonSchema: { + type: Property<"string">; + latitude: Property<"number">; + longitude: Property<"number">; + }; + /** + * Returns a JSON-serializable representation of this `GeoPoint` instance. + * + * @returns a JSON representation of this object. + */ + toJSON(): { + latitude: number; + longitude: number; + type: string; + }; + /** + * Builds a `GeoPoint` instance from a JSON object created by {@link GeoPoint.toJSON}. + * + * @param json a JSON object represention of a `GeoPoint` instance + * @returns an instance of {@link GeoPoint} if the JSON object could be parsed. Throws a + * {@link FirestoreError} if an error occurs. + */ + static fromJSON(json: object): GeoPoint; +} + +/** + * @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. + */ + +/** + * A single field element in an index configuration. + * + * @deprecated Instead of creating cache indexes manually, consider using + * `enablePersistentCacheIndexAutoCreation()` to let the SDK decide whether to + * create cache indexes for queries running locally. + * + * @beta + */ +interface IndexField { + /** The field path to index. */ + readonly fieldPath: string; + /** + * What type of array index to create. Set to `CONTAINS` for `array-contains` + * and `array-contains-any` indexes. + * + * Only one of `arrayConfig` or `order` should be set; + */ + readonly arrayConfig?: 'CONTAINS'; + /** + * What type of array index to create. Set to `ASCENDING` or 'DESCENDING` for + * `==`, `!=`, `<=`, `<=`, `in` and `not-in` filters. + * + * Only one of `arrayConfig` or `order` should be set. + */ + readonly order?: 'ASCENDING' | 'DESCENDING'; + [key: string]: unknown; +} +/** + * The SDK definition of a Firestore index. + * + * @deprecated Instead of creating cache indexes manually, consider using + * `enablePersistentCacheIndexAutoCreation()` to let the SDK decide whether to + * create cache indexes for queries running locally. + * + * @beta + */ +interface Index { + /** The ID of the collection to index. */ + readonly collectionGroup: string; + /** A list of fields to index. */ + readonly fields?: IndexField[]; + [key: string]: unknown; +} +/** + * A list of Firestore indexes to speed up local query execution. + * + * See {@link https://firebase.google.com/docs/reference/firestore/indexes/#json_format | JSON Format} + * for a description of the format of the index definition. + * + * @deprecated Instead of creating cache indexes manually, consider using + * `enablePersistentCacheIndexAutoCreation()` to let the SDK decide whether to + * create cache indexes for queries running locally. + * + * @beta + */ +interface IndexConfiguration { + /** A list of all Firestore indexes. */ + readonly indexes?: Index[]; + [key: string]: unknown; +} +/** + * Configures indexing for local query execution. Any previous index + * configuration is overridden. The `Promise` resolves once the index + * configuration has been persisted. + * + * The index entries themselves are created asynchronously. You can continue to + * use queries that require indexing even if the indices are not yet available. + * Query execution will automatically start using the index once the index + * entries have been written. + * + * Indexes are only supported with IndexedDb persistence. If IndexedDb is not + * enabled, any index configuration is ignored. + * + * @param firestore - The {@link Firestore} instance to configure indexes for. + * @param configuration -The index definition. + * @throws FirestoreError if the JSON format is invalid. + * @returns A `Promise` that resolves once all indices are successfully + * configured. + * + * @deprecated Instead of creating cache indexes manually, consider using + * `enablePersistentCacheIndexAutoCreation()` to let the SDK decide whether to + * create cache indexes for queries running locally. + * + * @beta + */ +declare function setIndexConfiguration(firestore: Firestore, configuration: IndexConfiguration): Promise<void>; +/** + * Configures indexing for local query execution. Any previous index + * configuration is overridden. The `Promise` resolves once the index + * configuration has been persisted. + * + * The index entries themselves are created asynchronously. You can continue to + * use queries that require indexing even if the indices are not yet available. + * Query execution will automatically start using the index once the index + * entries have been written. + * + * Indexes are only supported with IndexedDb persistence. Invoke either + * `enableIndexedDbPersistence()` or `enableMultiTabIndexedDbPersistence()` + * before setting an index configuration. If IndexedDb is not enabled, any + * index configuration is ignored. + * + * The method accepts the JSON format exported by the Firebase CLI (`firebase + * firestore:indexes`). If the JSON format is invalid, this method throws an + * error. + * + * @param firestore - The {@link Firestore} instance to configure indexes for. + * @param json -The JSON format exported by the Firebase CLI. + * @throws FirestoreError if the JSON format is invalid. + * @returns A `Promise` that resolves once all indices are successfully + * configured. + * + * @deprecated Instead of creating cache indexes manually, consider using + * `enablePersistentCacheIndexAutoCreation()` to let the SDK decide whether to + * create cache indexes for queries running locally. + * + * @beta + */ +declare function setIndexConfiguration(firestore: Firestore, json: string): Promise<void>; + +/** + * @license + * Copyright 2023 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. + */ + +/** + * A `PersistentCacheIndexManager` for configuring persistent cache indexes used + * for local query execution. + * + * To use, call `getPersistentCacheIndexManager()` to get an instance. + */ +declare class PersistentCacheIndexManager { + readonly _firestore: Firestore; + /** A type string to uniquely identify instances of this class. */ + readonly type: 'PersistentCacheIndexManager'; + /** @hideconstructor */ + constructor(_firestore: Firestore); +} +/** + * Returns the PersistentCache Index Manager used by the given `Firestore` + * object. + * + * @return The `PersistentCacheIndexManager` instance, or `null` if local + * persistent storage is not in use. + */ +declare function getPersistentCacheIndexManager(firestore: Firestore): PersistentCacheIndexManager | null; +/** + * Enables the SDK to create persistent cache indexes automatically for local + * query execution when the SDK believes cache indexes can help improve + * performance. + * + * This feature is disabled by default. + */ +declare function enablePersistentCacheIndexAutoCreation(indexManager: PersistentCacheIndexManager): void; +/** + * Stops creating persistent cache indexes automatically for local query + * execution. The indexes which have been created by calling + * `enablePersistentCacheIndexAutoCreation()` still take effect. + */ +declare function disablePersistentCacheIndexAutoCreation(indexManager: PersistentCacheIndexManager): void; +/** + * Removes all persistent cache indexes. + * + * Please note this function will also deletes indexes generated by + * `setIndexConfiguration()`, which is deprecated. + */ +declare function deleteAllPersistentCacheIndexes(indexManager: PersistentCacheIndexManager): void; + +/** + * True if and only if the Base64 conversion functions are available. + * @internal + */ +declare function isBase64Available(): boolean; + +/** + * @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. + */ + +/** + * @internal + * @private + * + * This function is for internal use only. + * + * Returns the `QueryTarget` representation of the given query. Returns `null` + * if the Firestore client associated with the given query has not been + * initialized or has been terminated. + * + * @param query - The Query to convert to proto representation. + */ +declare function _internalQueryToProtoQueryTarget(query: Query): any; +/** + * @internal + * @private + * + * This function is for internal use only. + * + * Returns `RunAggregationQueryRequest` which contains the proto representation + * of the given aggregation query request. Returns null if the Firestore client + * associated with the given query has not been initialized or has been + * terminated. + * + * @param query - The Query to convert to proto representation. + * @param aggregateSpec - The set of aggregations and their aliases. + */ +declare function _internalAggregationQueryToProtoRunAggregationQueryRequest<AggregateSpecType extends AggregateSpec>(query: Query, aggregateSpec: AggregateSpecType): any; + +/** + * @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. + */ + +/** + * Validates that two boolean options are not set at the same time. + * @internal + */ +declare function validateIsNotUsedTogether(optionName1: string, argument1: boolean | undefined, optionName2: string, argument2: boolean | undefined): void; +/** + * Casts `obj` to `T`, optionally unwrapping Compat types to expose the + * underlying instance. Throws if `obj` is not an instance of `T`. + * + * This cast is used in the Lite and Full SDK to verify instance types for + * arguments passed to the public API. + * @internal + */ +declare function cast<T>(obj: object, constructor: { + new (...args: any[]): T; +}): T | never; + +/** + * Fails if the given assertion condition is false, throwing an Error with the + * given message if it did. + * + * The code of callsites invoking this function are stripped out in production + * builds. Any side-effects of code within the debugAssert() invocation will not + * happen in this case. + * + * @internal + */ +declare function debugAssert(assertion: boolean, message: string): asserts assertion; + +/** + * Information about an existence filter mismatch. + * @internal + */ +interface ExistenceFilterMismatchInfo { + /** The number of documents that matched the query in the local cache. */ + localCacheCount: number; + /** + * The number of documents that matched the query on the server, as specified + * in the ExistenceFilter message's `count` field. + */ + existenceFilterCount: number; + /** + * The projectId used when checking documents for membership in the bloom + * filter. + */ + projectId: string; + /** + * The databaseId used when checking documents for membership in the bloom + * filter. + */ + databaseId: string; + /** + * Information about the bloom filter provided by Watch in the ExistenceFilter + * message's `unchangedNames` field. If this property is omitted or undefined + * then that means that Watch did _not_ provide a bloom filter. + */ + bloomFilter?: { + /** + * Whether a full requery was averted by using the bloom filter. If false, + * then something happened, such as a false positive, to prevent using the + * bloom filter to avoid a full requery. + */ + applied: boolean; + /** The number of hash functions used in the bloom filter. */ + hashCount: number; + /** The number of bytes in the bloom filter's bitmask. */ + bitmapLength: number; + /** The number of bits of padding in the last byte of the bloom filter. */ + padding: number; + /** + * Tests the given string for membership in the bloom filter created from + * the existence filter; will be undefined if creating the bloom filter + * failed. + */ + mightContain?: (value: string) => boolean; + }; +} + +/** + * @license + * Copyright 2023 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. + */ + +/** + * Testing hooks for use by Firestore's integration test suite to reach into the + * SDK internals to validate logic and behavior that is not visible from the + * public API surface. + * + * @internal + */ +declare class TestingHooks { + private constructor(); + /** + * Registers a callback to be notified when an existence filter mismatch + * occurs in the Watch listen stream. + * + * The relative order in which callbacks are notified is unspecified; do not + * rely on any particular ordering. If a given callback is registered multiple + * times then it will be notified multiple times, once per registration. + * + * @param callback the callback to invoke upon existence filter mismatch. + * + * @return a function that, when called, unregisters the given callback; only + * the first invocation of the returned function does anything; all subsequent + * invocations do nothing. + */ + static onExistenceFilterMismatch(callback: ExistenceFilterMismatchCallback): Unsubscribe; +} +/** + * The signature of callbacks registered with + * `TestingUtils.onExistenceFilterMismatch()`. + * + * The return value, if any, is ignored. + * + * @internal + */ +type ExistenceFilterMismatchCallback = (info: ExistenceFilterMismatchInfo) => unknown; + +/** + * Cloud Firestore + * + * @packageDocumentation + */ + +declare module '@firebase/component' { + interface NameServiceMapping { + 'firestore': Firestore; + } +} + +export { AbstractUserDataWriter, AddPrefixToKeys, AggregateField, AggregateFieldType, AggregateQuerySnapshot, AggregateSpec, AggregateSpecData, AggregateType, AuthTokenFactory, Bytes, CACHE_SIZE_UNLIMITED, ChildUpdateFields, CollectionReference, DocumentChange, DocumentChangeType, DocumentData, DocumentReference, DocumentSnapshot, EmulatorMockTokenOptions, ExperimentalLongPollingOptions, FieldPath, FieldValue, Firestore, FirestoreDataConverter, FirestoreError$1 as FirestoreError, FirestoreErrorCode$1 as FirestoreErrorCode, FirestoreLocalCache, FirestoreSettings, FirstPartyCredentialsSettings, GeoPoint, Index, IndexConfiguration, IndexField, ListenSource, LoadBundleTask, LoadBundleTaskProgress, LogLevelString as LogLevel, MemoryCacheSettings, MemoryEagerGarbageCollector, MemoryGarbageCollector, MemoryLocalCache, MemoryLruGarbageCollector, NestedUpdateFields, OrderByDirection, PartialWithFieldValue, PersistenceSettings, PersistentCacheIndexManager, PersistentCacheSettings, PersistentLocalCache, PersistentMultipleTabManager, PersistentSingleTabManager, PersistentSingleTabManagerSettings, PersistentTabManager, Primitive, PrivateSettings, Query, QueryCompositeFilterConstraint, QueryConstraint, QueryConstraintType, QueryDocumentSnapshot, QueryEndAtConstraint, QueryFieldFilterConstraint, QueryFilterConstraint, QueryLimitConstraint, QueryNonFilterConstraint, QueryOrderByConstraint, QuerySnapshot, QueryStartAtConstraint, SetOptions, SnapshotListenOptions, SnapshotMetadata, SnapshotOptions, TaskState, Timestamp$1 as Timestamp, Transaction, TransactionOptions, UnionToIntersection, Unsubscribe, UpdateData, VectorValue, WhereFilterOp, WithFieldValue, WriteBatch, AutoId as _AutoId, ByteString as _ByteString, DatabaseId as _DatabaseId, DocumentKey as _DocumentKey, EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider, EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider, FieldPath$2 as _FieldPath, ResourcePath as _ResourcePath, TestingHooks as _TestingHooks, ExistenceFilterMismatchCallback as _TestingHooksExistenceFilterMismatchCallback, ExistenceFilterMismatchInfo as _TestingHooksExistenceFilterMismatchInfo, cast as _cast, debugAssert as _debugAssert, _internalAggregationQueryToProtoRunAggregationQueryRequest, _internalQueryToProtoQueryTarget, isBase64Available as _isBase64Available, logWarn as _logWarn, validateIsNotUsedTogether as _validateIsNotUsedTogether, addDoc, aggregateFieldEqual, aggregateQuerySnapshotEqual, and, arrayRemove, arrayUnion, average, clearIndexedDbPersistence, collection, collectionGroup, connectFirestoreEmulator, count, deleteAllPersistentCacheIndexes, deleteDoc, deleteField, disableNetwork, disablePersistentCacheIndexAutoCreation, doc, documentId, documentSnapshotFromJSON, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, enablePersistentCacheIndexAutoCreation, endAt, endBefore, ensureFirestoreConfigured, executeWrite, getAggregateFromServer, getCountFromServer, getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, getFirestore, getPersistentCacheIndexManager, increment, initializeFirestore, limit, limitToLast, loadBundle, memoryEagerGarbageCollector, memoryLocalCache, memoryLruGarbageCollector, namedQuery, onSnapshot, onSnapshotResume, onSnapshotsInSync, or, orderBy, persistentLocalCache, persistentMultipleTabManager, persistentSingleTabManager, query, queryEqual, querySnapshotFromJSON, refEqual, runTransaction, serverTimestamp, setDoc, setIndexConfiguration, setLogLevel, snapshotEqual, startAfter, startAt, sum, terminate, updateDoc, vector, waitForPendingWrites, where, writeBatch }; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index.d.ts new file mode 100644 index 0000000..0541f3f --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index.d.ts @@ -0,0 +1,28 @@ +/** + * Cloud Firestore + * + * @packageDocumentation + */ +/** + * @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 { Firestore } from './api/database'; +export * from './api'; +declare module '@firebase/component' { + interface NameServiceMapping { + 'firestore': Firestore; + } +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index.node.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index.node.d.ts new file mode 100644 index 0000000..952da59 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index.node.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from './api'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index.rn.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index.rn.d.ts new file mode 100644 index 0000000..952da59 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index.rn.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from './api'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index/directional_index_byte_encoder.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index/directional_index_byte_encoder.d.ts new file mode 100644 index 0000000..0038f37 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index/directional_index_byte_encoder.d.ts @@ -0,0 +1,24 @@ +/** + * @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 { ByteString } from '../util/byte_string'; +/** An index value encoder. */ +export interface DirectionalIndexByteEncoder { + writeBytes(value: ByteString): void; + writeString(value: string): void; + writeNumber(value: number): void; + writeInfinity(): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index/firestore_index_value_writer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index/firestore_index_value_writer.d.ts new file mode 100644 index 0000000..01298c6 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index/firestore_index_value_writer.d.ts @@ -0,0 +1,34 @@ +/** + * @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 { Value } from '../protos/firestore_proto_api'; +import { DirectionalIndexByteEncoder } from './directional_index_byte_encoder'; +/** Firestore index value writer. */ +export declare class FirestoreIndexValueWriter { + static INSTANCE: FirestoreIndexValueWriter; + private constructor(); + /** Writes an index value. */ + writeIndexValue(value: Value, encoder: DirectionalIndexByteEncoder): void; + private writeIndexValueAux; + private writeIndexString; + private writeUnlabeledIndexString; + private writeIndexMap; + private writeIndexVector; + private writeIndexArray; + private writeIndexEntityRef; + private writeValueTypeLabel; + private writeTruncationMarker; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index/index_byte_encoder.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index/index_byte_encoder.d.ts new file mode 100644 index 0000000..dce4631 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index/index_byte_encoder.d.ts @@ -0,0 +1,31 @@ +/** + * @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 { IndexKind } from '../model/field_index'; +import { DirectionalIndexByteEncoder } from './directional_index_byte_encoder'; +/** + * Implements `DirectionalIndexByteEncoder` using `OrderedCodeWriter` for the + * actual encoding. + */ +export declare class IndexByteEncoder { + private orderedCode; + private ascending; + private descending; + seed(encodedBytes: Uint8Array): void; + forKind(kind: IndexKind): DirectionalIndexByteEncoder; + encodedBytes(): Uint8Array; + reset(): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index/index_entry.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index/index_entry.d.ts new file mode 100644 index 0000000..fe89202 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index/index_entry.d.ts @@ -0,0 +1,49 @@ +/** + * @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 { DbIndexEntry } from '../local/indexeddb_schema'; +import { DbIndexEntryKey, KeySafeBytes } from '../local/indexeddb_sentinels'; +import { DocumentKey } from '../model/document_key'; +/** Represents an index entry saved by the SDK in persisted storage. */ +export declare class IndexEntry { + readonly _indexId: number; + readonly _documentKey: DocumentKey; + readonly _arrayValue: Uint8Array; + readonly _directionalValue: Uint8Array; + constructor(_indexId: number, _documentKey: DocumentKey, _arrayValue: Uint8Array, _directionalValue: Uint8Array); + /** + * Returns an IndexEntry entry that sorts immediately after the current + * directional value. + */ + successor(): IndexEntry; + dbIndexEntry(uid: string, orderedDocumentKey: Uint8Array, documentKey: DocumentKey): DbIndexEntry; + dbIndexEntryKey(uid: string, orderedDocumentKey: Uint8Array, documentKey: DocumentKey): DbIndexEntryKey; +} +export declare function indexEntryComparator(left: IndexEntry, right: IndexEntry): number; +export declare function compareByteArrays(left: Uint8Array, right: Uint8Array): number; +/** + * Workaround for WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=292721 + * Create a key safe representation of Uint8Array values. + * If the browser is detected as Safari or WebKit, then + * the input array will be converted to "sortable byte string". + * Otherwise, the input array will be returned in its original type. + */ +export declare function encodeKeySafeBytes(array: Uint8Array): KeySafeBytes; +/** + * Reverts the key safe representation of Uint8Array (created by + * encodeKeySafeBytes) to a normal Uint8Array. + */ +export declare function decodeKeySafeBytes(input: KeySafeBytes): Uint8Array; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index/ordered_code_writer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index/ordered_code_writer.d.ts new file mode 100644 index 0000000..be345f7 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/index/ordered_code_writer.d.ts @@ -0,0 +1,60 @@ +import { ByteString } from '../util/byte_string'; +/** + * Counts the number of zeros in a byte. + * + * Visible for testing. + */ +export declare function numberOfLeadingZerosInByte(x: number): number; +/** + * OrderedCodeWriter is a minimal-allocation implementation of the writing + * behavior defined by the backend. + * + * The code is ported from its Java counterpart. + */ +export declare class OrderedCodeWriter { + buffer: Uint8Array; + position: number; + writeBytesAscending(value: ByteString): void; + writeBytesDescending(value: ByteString): void; + /** Writes utf8 bytes into this byte sequence, ascending. */ + writeUtf8Ascending(sequence: string): void; + /** Writes utf8 bytes into this byte sequence, descending */ + writeUtf8Descending(sequence: string): void; + writeNumberAscending(val: number): void; + writeNumberDescending(val: number): void; + /** + * Writes the "infinity" byte sequence that sorts after all other byte + * sequences written in ascending order. + */ + writeInfinityAscending(): void; + /** + * Writes the "infinity" byte sequence that sorts before all other byte + * sequences written in descending order. + */ + writeInfinityDescending(): void; + /** + * Resets the buffer such that it is the same as when it was newly + * constructed. + */ + reset(): void; + seed(encodedBytes: Uint8Array): void; + /** Makes a copy of the encoded bytes in this buffer. */ + encodedBytes(): Uint8Array; + /** + * Encodes `val` into an encoding so that the order matches the IEEE 754 + * floating-point comparison results with the following exceptions: + * -0.0 < 0.0 + * all non-NaN < NaN + * NaN = NaN + */ + private toOrderedBits; + /** Writes a single byte ascending to the buffer. */ + private writeByteAscending; + /** Writes a single byte descending to the buffer. */ + private writeByteDescending; + private writeSeparatorAscending; + private writeSeparatorDescending; + private writeEscapedByteAscending; + private writeEscapedByteDescending; + private ensureAvailable; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/aggregate.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/aggregate.d.ts new file mode 100644 index 0000000..3927021 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/aggregate.d.ts @@ -0,0 +1,100 @@ +/** + * @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 { AggregateField, AggregateQuerySnapshot, AggregateSpec } from './aggregate_types'; +import { FieldPath } from './field_path'; +import { DocumentData, Query } from './reference'; +/** + * Calculates the number of documents in the result set of the given query + * without actually downloading the documents. + * + * Using this function to count the documents is efficient because only the + * final count, not the documents' data, is downloaded. This function can + * count the documents in cases where the result set is prohibitively large to + * download entirely (thousands of documents). + * + * @param query The query whose result set size is calculated. + * @returns A Promise that will be resolved with the count; the count can be + * retrieved from `snapshot.data().count`, where `snapshot` is the + * `AggregateQuerySnapshot` to which the returned Promise resolves. + */ +export declare function getCount<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<AggregateQuerySnapshot<{ + count: AggregateField<number>; +}, AppModelType, DbModelType>>; +/** + * Calculates the specified aggregations over the documents in the result + * set of the given query without actually downloading the documents. + * + * Using this function to perform aggregations is efficient because only the + * final aggregation values, not the documents' data, are downloaded. This + * function can perform aggregations of the documents in cases where the result + * set is prohibitively large to download entirely (thousands of documents). + * + * @param query The query whose result set is aggregated over. + * @param aggregateSpec An `AggregateSpec` object that specifies the aggregates + * to perform over the result set. The AggregateSpec specifies aliases for each + * aggregate, which can be used to retrieve the aggregate result. + * @example + * ```typescript + * const aggregateSnapshot = await getAggregate(query, { + * countOfDocs: count(), + * totalHours: sum('hours'), + * averageScore: average('score') + * }); + * + * const countOfDocs: number = aggregateSnapshot.data().countOfDocs; + * const totalHours: number = aggregateSnapshot.data().totalHours; + * const averageScore: number | null = aggregateSnapshot.data().averageScore; + * ``` + */ +export declare function getAggregate<AggregateSpecType extends AggregateSpec, AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, aggregateSpec: AggregateSpecType): Promise<AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>>; +/** + * Create an AggregateField object that can be used to compute the sum of + * a specified field over a range of documents in the result set of a query. + * @param field Specifies the field to sum across the result set. + */ +export declare function sum(field: string | FieldPath): AggregateField<number>; +/** + * Create an AggregateField object that can be used to compute the average of + * a specified field over a range of documents in the result set of a query. + * @param field Specifies the field to average across the result set. + */ +export declare function average(field: string | FieldPath): AggregateField<number | null>; +/** + * Create an AggregateField object that can be used to compute the count of + * documents in the result set of a query. + */ +export declare function count(): AggregateField<number>; +/** + * Compares two 'AggregateField` instances for equality. + * + * @param left Compare this AggregateField to the `right`. + * @param right Compare this AggregateField to the `left`. + */ +export declare function aggregateFieldEqual(left: AggregateField<unknown>, right: AggregateField<unknown>): boolean; +/** + * Compares two `AggregateQuerySnapshot` instances for equality. + * + * Two `AggregateQuerySnapshot` instances are considered "equal" if they have + * underlying queries that compare equal, and the same data. + * + * @param left - The first `AggregateQuerySnapshot` to compare. + * @param right - The second `AggregateQuerySnapshot` to compare. + * + * @returns `true` if the objects are "equal", as defined above, or `false` + * otherwise. + */ +export declare function aggregateQuerySnapshotEqual<AggregateSpecType extends AggregateSpec, AppModelType, DbModelType extends DocumentData>(left: AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>, right: AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>): boolean; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/aggregate_types.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/aggregate_types.d.ts new file mode 100644 index 0000000..453dff1 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/aggregate_types.d.ts @@ -0,0 +1,86 @@ +/** + * @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 { AggregateType } from '../core/aggregate'; +import { FieldPath as InternalFieldPath } from '../model/path'; +import { ApiClientObjectMap, Value } from '../protos/firestore_proto_api'; +import { average, count, sum } from './aggregate'; +import { DocumentData, Query } from './reference'; +import { AbstractUserDataWriter } from './user_data_writer'; +export { AggregateType }; +/** + * Represents an aggregation that can be performed by Firestore. + */ +export declare class AggregateField<T> { + readonly _internalFieldPath?: InternalFieldPath | undefined; + /** A type string to uniquely identify instances of this class. */ + readonly type = "AggregateField"; + /** Indicates the aggregation operation of this AggregateField. */ + readonly aggregateType: AggregateType; + /** + * Create a new AggregateField<T> + * @param aggregateType Specifies the type of aggregation operation to perform. + * @param _internalFieldPath Optionally specifies the field that is aggregated. + * @internal + */ + constructor(aggregateType?: AggregateType, _internalFieldPath?: InternalFieldPath | undefined); +} +/** + * The union of all `AggregateField` types that are supported by Firestore. + */ +export type AggregateFieldType = ReturnType<typeof sum> | ReturnType<typeof average> | ReturnType<typeof count>; +/** + * Specifies a set of aggregations and their aliases. + */ +export interface AggregateSpec { + [field: string]: AggregateFieldType; +} +/** + * A type whose keys are taken from an `AggregateSpec`, and whose values are the + * result of the aggregation performed by the corresponding `AggregateField` + * from the input `AggregateSpec`. + */ +export type AggregateSpecData<T extends AggregateSpec> = { + [P in keyof T]: T[P] extends AggregateField<infer U> ? U : never; +}; +/** + * The results of executing an aggregation query. + */ +export declare class AggregateQuerySnapshot<AggregateSpecType extends AggregateSpec, AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> { + private readonly _userDataWriter; + private readonly _data; + /** A type string to uniquely identify instances of this class. */ + readonly type = "AggregateQuerySnapshot"; + /** + * The underlying query over which the aggregations recorded in this + * `AggregateQuerySnapshot` were performed. + */ + readonly query: Query<AppModelType, DbModelType>; + /** @hideconstructor */ + constructor(query: Query<AppModelType, DbModelType>, _userDataWriter: AbstractUserDataWriter, _data: ApiClientObjectMap<Value>); + /** + * Returns the results of the aggregations performed over the underlying + * query. + * + * The keys of the returned object will be the same as those of the + * `AggregateSpec` object specified to the aggregation method, and the values + * will be the corresponding aggregation result. + * + * @returns The results of the aggregations performed over the underlying + * query. + */ + data(): AggregateSpecData<AggregateSpecType>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/bytes.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/bytes.d.ts new file mode 100644 index 0000000..e4b8e09 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/bytes.d.ts @@ -0,0 +1,83 @@ +/** + * @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 { ByteString } from '../util/byte_string'; +import { Property } from '../util/json_validation'; +/** + * An immutable object representing an array of bytes. + */ +export declare class Bytes { + _byteString: ByteString; + /** @hideconstructor */ + constructor(byteString: ByteString); + /** + * Creates a new `Bytes` object from the given Base64 string, converting it to + * bytes. + * + * @param base64 - The Base64 string used to create the `Bytes` object. + */ + static fromBase64String(base64: string): Bytes; + /** + * Creates a new `Bytes` object from the given Uint8Array. + * + * @param array - The Uint8Array used to create the `Bytes` object. + */ + static fromUint8Array(array: Uint8Array): Bytes; + /** + * Returns the underlying bytes as a Base64-encoded string. + * + * @returns The Base64-encoded string created from the `Bytes` object. + */ + toBase64(): string; + /** + * Returns the underlying bytes in a new `Uint8Array`. + * + * @returns The Uint8Array created from the `Bytes` object. + */ + toUint8Array(): Uint8Array; + /** + * Returns a string representation of the `Bytes` object. + * + * @returns A string representation of the `Bytes` object. + */ + toString(): string; + /** + * Returns true if this `Bytes` object is equal to the provided one. + * + * @param other - The `Bytes` object to compare against. + * @returns true if this `Bytes` object is equal to the provided one. + */ + isEqual(other: Bytes): boolean; + static _jsonSchemaVersion: string; + static _jsonSchema: { + type: Property<"string">; + bytes: Property<"string">; + }; + /** + * Returns a JSON-serializable representation of this `Bytes` instance. + * + * @returns a JSON representation of this object. + */ + toJSON(): object; + /** + * Builds a `Bytes` instance from a JSON object created by {@link Bytes.toJSON}. + * + * @param json a JSON object represention of a `Bytes` instance + * @returns an instance of {@link Bytes} if the JSON object could be parsed. Throws a + * {@link FirestoreError} if an error occurs. + */ + static fromJSON(json: object): Bytes; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/components.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/components.d.ts new file mode 100644 index 0000000..a710e68 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/components.d.ts @@ -0,0 +1,49 @@ +/** + * @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 { _FirebaseService } from '@firebase/app'; +import { CredentialsProvider } from '../api/credentials'; +import { User } from '../auth/user'; +import { DatabaseId, DatabaseInfo } from '../core/database_info'; +import { Datastore } from '../remote/datastore'; +import { FirestoreSettingsImpl } from './settings'; +export declare const LOG_TAG = "ComponentProvider"; +/** + * An interface implemented by FirebaseFirestore that provides compatibility + * with the usage in this file. + * + * This interface mainly exists to remove a cyclic dependency. + */ +export interface FirestoreService extends _FirebaseService { + _authCredentials: CredentialsProvider<User>; + _appCheckCredentials: CredentialsProvider<string>; + _persistenceKey: string; + _databaseId: DatabaseId; + _terminated: boolean; + _freezeSettings(): FirestoreSettingsImpl; +} +/** + * Returns an initialized and started Datastore for the given Firestore + * instance. Callers must invoke removeComponents() when the Firestore + * instance is terminated. + */ +export declare function getDatastore(firestore: FirestoreService): Datastore; +/** + * Removes all components associated with the provided instance. Must be called + * when the `Firestore` instance is terminated. + */ +export declare function removeComponents(firestore: FirestoreService): void; +export declare function makeDatabaseInfo(databaseId: DatabaseId, appId: string, persistenceKey: string, settings: FirestoreSettingsImpl): DatabaseInfo; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/database.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/database.d.ts new file mode 100644 index 0000000..988a791 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/database.d.ts @@ -0,0 +1,179 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FirebaseApp } from '@firebase/app'; +import { EmulatorMockTokenOptions } from '@firebase/util'; +import { CredentialsProvider } from '../api/credentials'; +import { User } from '../auth/user'; +import { DatabaseId } from '../core/database_info'; +import { FirestoreService } from './components'; +import { FirestoreSettingsImpl, PrivateSettings, FirestoreSettings } from './settings'; +export { EmulatorMockTokenOptions } from '@firebase/util'; +declare module '@firebase/component' { + interface NameServiceMapping { + 'firestore/lite': Firestore; + } +} +/** + * The Cloud Firestore service interface. + * + * Do not call this constructor directly. Instead, use {@link (getFirestore:1)}. + */ +export declare class Firestore implements FirestoreService { + _authCredentials: CredentialsProvider<User>; + _appCheckCredentials: CredentialsProvider<string>; + readonly _databaseId: DatabaseId; + readonly _app?: FirebaseApp | undefined; + /** + * Whether it's a Firestore or Firestore Lite instance. + */ + type: 'firestore-lite' | 'firestore'; + readonly _persistenceKey: string; + private _settings; + private _settingsFrozen; + private _emulatorOptions; + private _terminateTask; + /** @hideconstructor */ + constructor(_authCredentials: CredentialsProvider<User>, _appCheckCredentials: CredentialsProvider<string>, _databaseId: DatabaseId, _app?: FirebaseApp | undefined); + /** + * The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service + * instance. + */ + get app(): FirebaseApp; + get _initialized(): boolean; + get _terminated(): boolean; + _setSettings(settings: PrivateSettings): void; + _getSettings(): FirestoreSettingsImpl; + _getEmulatorOptions(): { + mockUserToken?: EmulatorMockTokenOptions | string; + }; + _freezeSettings(): FirestoreSettingsImpl; + _delete(): Promise<void>; + _restart(): Promise<void>; + /** Returns a JSON-serializable representation of this `Firestore` instance. */ + toJSON(): object; + /** + * Terminates all components used by this client. Subclasses can override + * this method to clean up their own dependencies, but must also call this + * method. + * + * Only ever called once. + */ + protected _terminate(): Promise<void>; +} +/** + * Initializes a new instance of Cloud Firestore with the provided settings. + * Can only be called before any other functions, including + * {@link (getFirestore:1)}. If the custom settings are empty, this function is + * equivalent to calling {@link (getFirestore:1)}. + * + * @param app - The {@link @firebase/app#FirebaseApp} with which the `Firestore` instance will + * be associated. + * @param settings - A settings object to configure the `Firestore` instance. + * @returns A newly initialized `Firestore` instance. + */ +export declare function initializeFirestore(app: FirebaseApp, settings: FirestoreSettings): Firestore; +/** + * Initializes a new instance of Cloud Firestore with the provided settings. + * Can only be called before any other functions, including + * {@link (getFirestore:1)}. If the custom settings are empty, this function is + * equivalent to calling {@link (getFirestore:1)}. + * + * @param app - The {@link @firebase/app#FirebaseApp} with which the `Firestore` instance will + * be associated. + * @param settings - A settings object to configure the `Firestore` instance. + * @param databaseId - The name of the database. + * @returns A newly initialized `Firestore` instance. + * @beta + */ +export declare function initializeFirestore(app: FirebaseApp, settings: FirestoreSettings, databaseId?: string): Firestore; +/** + * Returns the existing default {@link Firestore} instance that is associated with the + * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new + * instance with default settings. + * + * @returns The {@link Firestore} instance of the provided app. + */ +export declare function getFirestore(): Firestore; +/** + * Returns the existing default {@link Firestore} instance that is associated with the + * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new + * instance with default settings. + * + * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore} + * instance is associated with. + * @returns The {@link Firestore} instance of the provided app. + */ +export declare function getFirestore(app: FirebaseApp): Firestore; +/** + * Returns the existing {@link Firestore} instance that is associated with the + * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new + * instance with default settings. + * + * @param databaseId - The name of the database. + * @returns The {@link Firestore} instance of the provided app. + * @beta + */ +export declare function getFirestore(databaseId: string): Firestore; +/** + * Returns the existing {@link Firestore} instance that is associated with the + * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new + * instance with default settings. + * + * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore} + * instance is associated with. + * @param databaseId - The name of the database. + * @returns The {@link Firestore} instance of the provided app. + * @beta + */ +export declare function getFirestore(app: FirebaseApp, databaseId: string): Firestore; +/** + * Modify this instance to communicate with the Cloud Firestore emulator. + * + * Note: This must be called before this instance has been used to do any + * operations. + * + * @param firestore - The `Firestore` instance to configure to connect to the + * emulator. + * @param host - the emulator host (ex: localhost). + * @param port - the emulator port (ex: 9000). + * @param options.mockUserToken - the mock auth token to use for unit testing + * Security Rules. + */ +export declare function connectFirestoreEmulator(firestore: Firestore, host: string, port: number, options?: { + mockUserToken?: EmulatorMockTokenOptions | string; +}): void; +/** + * Terminates the provided `Firestore` instance. + * + * After calling `terminate()` only the `clearIndexedDbPersistence()` functions + * may be used. Any other function will throw a `FirestoreError`. Termination + * does not cancel any pending writes, and any promises that are awaiting a + * response from the server will not be resolved. + * + * To restart after termination, create a new instance of `Firestore` with + * {@link (getFirestore:1)}. + * + * Note: Under normal circumstances, calling `terminate()` is not required. This + * function is useful only when you want to force this instance to release all of + * its resources or in combination with {@link clearIndexedDbPersistence} to + * ensure that all local state is destroyed between test runs. + * + * @param firestore - The `Firestore` instance to terminate. + * @returns A `Promise` that is resolved when the instance has been successfully + * terminated. + */ +export declare function terminate(firestore: Firestore): Promise<void>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/field_path.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/field_path.d.ts new file mode 100644 index 0000000..38faa8f --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/field_path.d.ts @@ -0,0 +1,48 @@ +/** + * @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 as InternalFieldPath } from '../model/path'; +/** + * A `FieldPath` refers to a field in a document. The path may consist of a + * single field name (referring to a top-level field in the document), or a + * list of field names (referring to a nested field in the document). + * + * Create a `FieldPath` by providing field names. If more than one field + * name is provided, the path will point to a nested field in a document. + */ +export declare class FieldPath { + /** Internal representation of a Firestore field path. */ + readonly _internalPath: InternalFieldPath; + /** + * Creates a `FieldPath` from the provided field names. If more than one field + * name is provided, the path will point to a nested field in a document. + * + * @param fieldNames - A list of field names. + */ + constructor(...fieldNames: string[]); + /** + * Returns true if this `FieldPath` is equal to the provided one. + * + * @param other - The `FieldPath` to compare against. + * @returns true if this `FieldPath` is equal to the provided one. + */ + isEqual(other: FieldPath): boolean; +} +/** + * Returns a special sentinel `FieldPath` to refer to the ID of a document. + * It can be used in queries to sort or filter by the document ID. + */ +export declare function documentId(): FieldPath; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/field_value.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/field_value.d.ts new file mode 100644 index 0000000..5e44c8e --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/field_value.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 { ParseContext } from '../api/parse_context'; +import { FieldTransform } from '../model/mutation'; +/** + * Sentinel values that can be used when writing document fields with `set()` + * or `update()`. + */ +export declare abstract class FieldValue { + _methodName: string; + /** + * @param _methodName - The public API endpoint that returns this class. + * @hideconstructor + */ + constructor(_methodName: string); + /** Compares `FieldValue`s for equality. */ + abstract isEqual(other: FieldValue): boolean; + abstract _toFieldTransform(context: ParseContext): FieldTransform | null; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/field_value_impl.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/field_value_impl.d.ts new file mode 100644 index 0000000..019e460 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/field_value_impl.d.ts @@ -0,0 +1,81 @@ +/** + * @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 { FieldValue } from './field_value'; +import { VectorValue } from './vector_value'; +/** + * Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or + * {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion. + */ +export declare function deleteField(): FieldValue; +/** + * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to + * include a server-generated timestamp in the written data. + */ +export declare function serverTimestamp(): FieldValue; +/** + * Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link + * @firebase/firestore/lite#(updateDoc:1)} that tells the server to union the given elements with any array + * value that already exists on the server. Each specified element that doesn't + * already exist in the array will be added to the end. If the field being + * modified is not already an array it will be overwritten with an array + * containing exactly the specified elements. + * + * @param elements - The elements to union into the array. + * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or + * `updateDoc()`. + */ +export declare function arrayUnion(...elements: unknown[]): FieldValue; +/** + * Returns a special value that can be used with {@link (setDoc:1)} or {@link + * updateDoc:1} that tells the server to remove the given elements from any + * array value that already exists on the server. All instances of each element + * specified will be removed from the array. If the field being modified is not + * already an array it will be overwritten with an empty array. + * + * @param elements - The elements to remove from the array. + * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or + * `updateDoc()` + */ +export declare function arrayRemove(...elements: unknown[]): FieldValue; +/** + * Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link + * @firebase/firestore/lite#(updateDoc:1)} that tells the server to increment the field's current value by + * the given value. + * + * If either the operand or the current field value uses floating point + * precision, all arithmetic follows IEEE 754 semantics. If both values are + * integers, values outside of JavaScript's safe number range + * (`Number.MIN_SAFE_INTEGER` to `Number.MAX_SAFE_INTEGER`) are also subject to + * precision loss. Furthermore, once processed by the Firestore backend, all + * integer operations are capped between -2^63 and 2^63-1. + * + * If the current field value is not of type `number`, or if the field does not + * yet exist, the transformation sets the field to the given value. + * + * @param n - The value to increment by. + * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or + * `updateDoc()` + */ +export declare function increment(n: number): FieldValue; +/** + * Creates a new `VectorValue` constructed with a copy of the given array of numbers. + * + * @param values - Create a `VectorValue` instance with a copy of this array of numbers. + * + * @returns A new `VectorValue` constructed with a copy of the given array of numbers. + */ +export declare function vector(values?: number[]): VectorValue; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/geo_point.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/geo_point.d.ts new file mode 100644 index 0000000..bfe8cd5 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/geo_point.d.ts @@ -0,0 +1,79 @@ +/** + * @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 { Property } from '../util/json_validation'; +/** + * An immutable object representing a geographic location in Firestore. The + * location is represented as latitude/longitude pair. + * + * Latitude values are in the range of [-90, 90]. + * Longitude values are in the range of [-180, 180]. + */ +export declare class GeoPoint { + private _lat; + private _long; + /** + * Creates a new immutable `GeoPoint` object with the provided latitude and + * longitude values. + * @param latitude - The latitude as number between -90 and 90. + * @param longitude - The longitude as number between -180 and 180. + */ + constructor(latitude: number, longitude: number); + /** + * The latitude of this `GeoPoint` instance. + */ + get latitude(): number; + /** + * The longitude of this `GeoPoint` instance. + */ + get longitude(): number; + /** + * Returns true if this `GeoPoint` is equal to the provided one. + * + * @param other - The `GeoPoint` to compare against. + * @returns true if this `GeoPoint` is equal to the provided one. + */ + isEqual(other: GeoPoint): boolean; + /** + * Actually private to JS consumers of our API, so this function is prefixed + * with an underscore. + */ + _compareTo(other: GeoPoint): number; + static _jsonSchemaVersion: string; + static _jsonSchema: { + type: Property<"string">; + latitude: Property<"number">; + longitude: Property<"number">; + }; + /** + * Returns a JSON-serializable representation of this `GeoPoint` instance. + * + * @returns a JSON representation of this object. + */ + toJSON(): { + latitude: number; + longitude: number; + type: string; + }; + /** + * Builds a `GeoPoint` instance from a JSON object created by {@link GeoPoint.toJSON}. + * + * @param json a JSON object represention of a `GeoPoint` instance + * @returns an instance of {@link GeoPoint} if the JSON object could be parsed. Throws a + * {@link FirestoreError} if an error occurs. + */ + static fromJSON(json: object): GeoPoint; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/query.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/query.d.ts new file mode 100644 index 0000000..9053d9d --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/query.d.ts @@ -0,0 +1,404 @@ +/** + * @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 { Bound } from '../core/bound'; +import { DatabaseId } from '../core/database_info'; +import { CompositeOperator, FieldFilter, Filter, Operator } from '../core/filter'; +import { Direction, OrderBy } from '../core/order_by'; +import { LimitType, Query as InternalQuery } from '../core/query'; +import { Document } from '../model/document'; +import { FieldPath as InternalFieldPath } from '../model/path'; +import { FieldPath } from './field_path'; +import { DocumentData, Query } from './reference'; +import { DocumentSnapshot } from './snapshot'; +import { UserDataReader } from './user_data_reader'; +export declare function validateHasExplicitOrderByForLimitToLast(query: InternalQuery): void; +/** Describes the different query constraints available in this SDK. */ +export type QueryConstraintType = 'where' | 'orderBy' | 'limit' | 'limitToLast' | 'startAt' | 'startAfter' | 'endAt' | 'endBefore'; +/** + * An `AppliableConstraint` is an abstraction of a constraint that can be applied + * to a Firestore query. + */ +export declare abstract class AppliableConstraint { + /** + * Takes the provided {@link Query} and returns a copy of the {@link Query} with this + * {@link AppliableConstraint} applied. + */ + abstract _apply<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>; +} +/** + * A `QueryConstraint` is used to narrow the set of documents returned by a + * Firestore query. `QueryConstraint`s are created by invoking {@link where}, + * {@link orderBy}, {@link (startAt:1)}, {@link (startAfter:1)}, {@link + * (endBefore:1)}, {@link (endAt:1)}, {@link limit}, {@link limitToLast} and + * can then be passed to {@link (query:1)} to create a new query instance that + * also contains this `QueryConstraint`. + */ +export declare abstract class QueryConstraint extends AppliableConstraint { + /** The type of this query constraint */ + abstract readonly type: QueryConstraintType; + /** + * Takes the provided {@link Query} and returns a copy of the {@link Query} with this + * {@link AppliableConstraint} applied. + */ + abstract _apply<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>; +} +/** + * Creates a new immutable instance of {@link Query} that is extended to also + * include additional query constraints. + * + * @param query - The {@link Query} instance to use as a base for the new + * constraints. + * @param compositeFilter - The {@link QueryCompositeFilterConstraint} to + * apply. Create {@link QueryCompositeFilterConstraint} using {@link and} or + * {@link or}. + * @param queryConstraints - Additional {@link QueryNonFilterConstraint}s to + * apply (e.g. {@link orderBy}, {@link limit}). + * @throws if any of the provided query constraints cannot be combined with the + * existing or new constraints. + */ +export declare function query<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, compositeFilter: QueryCompositeFilterConstraint, ...queryConstraints: QueryNonFilterConstraint[]): Query<AppModelType, DbModelType>; +/** + * Creates a new immutable instance of {@link Query} that is extended to also + * include additional query constraints. + * + * @param query - The {@link Query} instance to use as a base for the new + * constraints. + * @param queryConstraints - The list of {@link QueryConstraint}s to apply. + * @throws if any of the provided query constraints cannot be combined with the + * existing or new constraints. + */ +export declare function query<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, ...queryConstraints: QueryConstraint[]): Query<AppModelType, DbModelType>; +/** + * A `QueryFieldFilterConstraint` is used to narrow the set of documents returned by + * a Firestore query by filtering on one or more document fields. + * `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then + * be passed to {@link (query:1)} to create a new query instance that also contains + * this `QueryFieldFilterConstraint`. + */ +export declare class QueryFieldFilterConstraint extends QueryConstraint { + private readonly _field; + private _op; + private _value; + /** The type of this query constraint */ + readonly type = "where"; + /** + * @internal + */ + protected constructor(_field: InternalFieldPath, _op: Operator, _value: unknown); + static _create(_field: InternalFieldPath, _op: Operator, _value: unknown): QueryFieldFilterConstraint; + _apply<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>; + _parse<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): FieldFilter; +} +/** + * Filter conditions in a {@link where} clause are specified using the + * strings '<', '<=', '==', '!=', '>=', '>', 'array-contains', 'in', + * 'array-contains-any', and 'not-in'. + */ +export type WhereFilterOp = '<' | '<=' | '==' | '!=' | '>=' | '>' | 'array-contains' | 'in' | 'array-contains-any' | 'not-in'; +/** + * Creates a {@link QueryFieldFilterConstraint} that enforces that documents + * must contain the specified field and that the value should satisfy the + * relation constraint provided. + * + * @param fieldPath - The path to compare + * @param opStr - The operation string (e.g "<", "<=", "==", "<", + * "<=", "!="). + * @param value - The value for comparison + * @returns The created {@link QueryFieldFilterConstraint}. + */ +export declare function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryFieldFilterConstraint; +/** + * A `QueryCompositeFilterConstraint` is used to narrow the set of documents + * returned by a Firestore query by performing the logical OR or AND of multiple + * {@link QueryFieldFilterConstraint}s or {@link QueryCompositeFilterConstraint}s. + * `QueryCompositeFilterConstraint`s are created by invoking {@link or} or + * {@link and} and can then be passed to {@link (query:1)} to create a new query + * instance that also contains the `QueryCompositeFilterConstraint`. + */ +export declare class QueryCompositeFilterConstraint extends AppliableConstraint { + /** The type of this query constraint */ + readonly type: 'or' | 'and'; + private readonly _queryConstraints; + /** + * @internal + */ + protected constructor( + /** The type of this query constraint */ + type: 'or' | 'and', _queryConstraints: QueryFilterConstraint[]); + static _create(type: 'or' | 'and', _queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint; + _parse<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Filter; + _apply<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>; + _getQueryConstraints(): readonly AppliableConstraint[]; + _getOperator(): CompositeOperator; +} +/** + * `QueryNonFilterConstraint` is a helper union type that represents + * QueryConstraints which are used to narrow or order the set of documents, + * but that do not explicitly filter on a document field. + * `QueryNonFilterConstraint`s are created by invoking {@link orderBy}, + * {@link (startAt:1)}, {@link (startAfter:1)}, {@link (endBefore:1)}, {@link (endAt:1)}, + * {@link limit} or {@link limitToLast} and can then be passed to {@link (query:1)} + * to create a new query instance that also contains the `QueryConstraint`. + */ +export type QueryNonFilterConstraint = QueryOrderByConstraint | QueryLimitConstraint | QueryStartAtConstraint | QueryEndAtConstraint; +/** + * `QueryFilterConstraint` is a helper union type that represents + * {@link QueryFieldFilterConstraint} and {@link QueryCompositeFilterConstraint}. + */ +export type QueryFilterConstraint = QueryFieldFilterConstraint | QueryCompositeFilterConstraint; +/** + * Creates a new {@link QueryCompositeFilterConstraint} that is a disjunction of + * the given filter constraints. A disjunction filter includes a document if it + * satisfies any of the given filters. + * + * @param queryConstraints - Optional. The list of + * {@link QueryFilterConstraint}s to perform a disjunction for. These must be + * created with calls to {@link where}, {@link or}, or {@link and}. + * @returns The newly created {@link QueryCompositeFilterConstraint}. + */ +export declare function or(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint; +/** + * Creates a new {@link QueryCompositeFilterConstraint} that is a conjunction of + * the given filter constraints. A conjunction filter includes a document if it + * satisfies all of the given filters. + * + * @param queryConstraints - Optional. The list of + * {@link QueryFilterConstraint}s to perform a conjunction for. These must be + * created with calls to {@link where}, {@link or}, or {@link and}. + * @returns The newly created {@link QueryCompositeFilterConstraint}. + */ +export declare function and(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint; +/** + * A `QueryOrderByConstraint` is used to sort the set of documents returned by a + * Firestore query. `QueryOrderByConstraint`s are created by invoking + * {@link orderBy} and can then be passed to {@link (query:1)} to create a new query + * instance that also contains this `QueryOrderByConstraint`. + * + * Note: Documents that do not contain the orderBy field will not be present in + * the query result. + */ +export declare class QueryOrderByConstraint extends QueryConstraint { + private readonly _field; + private _direction; + /** The type of this query constraint */ + readonly type = "orderBy"; + /** + * @internal + */ + protected constructor(_field: InternalFieldPath, _direction: Direction); + static _create(_field: InternalFieldPath, _direction: Direction): QueryOrderByConstraint; + _apply<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>; +} +/** + * The direction of a {@link orderBy} clause is specified as 'desc' or 'asc' + * (descending or ascending). + */ +export type OrderByDirection = 'desc' | 'asc'; +/** + * Creates a {@link QueryOrderByConstraint} that sorts the query result by the + * specified field, optionally in descending order instead of ascending. + * + * Note: Documents that do not contain the specified field will not be present + * in the query result. + * + * @param fieldPath - The field to sort by. + * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If + * not specified, order will be ascending. + * @returns The created {@link QueryOrderByConstraint}. + */ +export declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryOrderByConstraint; +/** + * A `QueryLimitConstraint` is used to limit the number of documents returned by + * a Firestore query. + * `QueryLimitConstraint`s are created by invoking {@link limit} or + * {@link limitToLast} and can then be passed to {@link (query:1)} to create a new + * query instance that also contains this `QueryLimitConstraint`. + */ +export declare class QueryLimitConstraint extends QueryConstraint { + /** The type of this query constraint */ + readonly type: 'limit' | 'limitToLast'; + private readonly _limit; + private readonly _limitType; + /** + * @internal + */ + protected constructor( + /** The type of this query constraint */ + type: 'limit' | 'limitToLast', _limit: number, _limitType: LimitType); + static _create(type: 'limit' | 'limitToLast', _limit: number, _limitType: LimitType): QueryLimitConstraint; + _apply<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>; +} +/** + * Creates a {@link QueryLimitConstraint} that only returns the first matching + * documents. + * + * @param limit - The maximum number of items to return. + * @returns The created {@link QueryLimitConstraint}. + */ +export declare function limit(limit: number): QueryLimitConstraint; +/** + * Creates a {@link QueryLimitConstraint} that only returns the last matching + * documents. + * + * You must specify at least one `orderBy` clause for `limitToLast` queries, + * otherwise an exception will be thrown during execution. + * + * @param limit - The maximum number of items to return. + * @returns The created {@link QueryLimitConstraint}. + */ +export declare function limitToLast(limit: number): QueryLimitConstraint; +/** + * A `QueryStartAtConstraint` is used to exclude documents from the start of a + * result set returned by a Firestore query. + * `QueryStartAtConstraint`s are created by invoking {@link (startAt:1)} or + * {@link (startAfter:1)} and can then be passed to {@link (query:1)} to create a + * new query instance that also contains this `QueryStartAtConstraint`. + */ +export declare class QueryStartAtConstraint extends QueryConstraint { + /** The type of this query constraint */ + readonly type: 'startAt' | 'startAfter'; + private readonly _docOrFields; + private readonly _inclusive; + /** + * @internal + */ + protected constructor( + /** The type of this query constraint */ + type: 'startAt' | 'startAfter', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean); + static _create(type: 'startAt' | 'startAfter', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean): QueryStartAtConstraint; + _apply<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>; +} +/** + * Creates a {@link QueryStartAtConstraint} that modifies the result set to + * start at the provided document (inclusive). The starting position is relative + * to the order of the query. The document must contain all of the fields + * provided in the `orderBy` of this query. + * + * @param snapshot - The snapshot of the document to start at. + * @returns A {@link QueryStartAtConstraint} to pass to `query()`. + */ +export declare function startAt<AppModelType, DbModelType extends DocumentData>(snapshot: DocumentSnapshot<AppModelType, DbModelType>): QueryStartAtConstraint; +/** + * Creates a {@link QueryStartAtConstraint} that modifies the result set to + * start at the provided fields relative to the order of the query. The order of + * the field values must match the order of the order by clauses of the query. + * + * @param fieldValues - The field values to start this query at, in order + * of the query's order by. + * @returns A {@link QueryStartAtConstraint} to pass to `query()`. + */ +export declare function startAt(...fieldValues: unknown[]): QueryStartAtConstraint; +/** + * Creates a {@link QueryStartAtConstraint} that modifies the result set to + * start after the provided document (exclusive). The starting position is + * relative to the order of the query. The document must contain all of the + * fields provided in the orderBy of the query. + * + * @param snapshot - The snapshot of the document to start after. + * @returns A {@link QueryStartAtConstraint} to pass to `query()` + */ +export declare function startAfter<AppModelType, DbModelType extends DocumentData>(snapshot: DocumentSnapshot<AppModelType, DbModelType>): QueryStartAtConstraint; +/** + * Creates a {@link QueryStartAtConstraint} that modifies the result set to + * start after the provided fields relative to the order of the query. The order + * of the field values must match the order of the order by clauses of the query. + * + * @param fieldValues - The field values to start this query after, in order + * of the query's order by. + * @returns A {@link QueryStartAtConstraint} to pass to `query()` + */ +export declare function startAfter(...fieldValues: unknown[]): QueryStartAtConstraint; +/** + * A `QueryEndAtConstraint` is used to exclude documents from the end of a + * result set returned by a Firestore query. + * `QueryEndAtConstraint`s are created by invoking {@link (endAt:1)} or + * {@link (endBefore:1)} and can then be passed to {@link (query:1)} to create a new + * query instance that also contains this `QueryEndAtConstraint`. + */ +export declare class QueryEndAtConstraint extends QueryConstraint { + /** The type of this query constraint */ + readonly type: 'endBefore' | 'endAt'; + private readonly _docOrFields; + private readonly _inclusive; + /** + * @internal + */ + protected constructor( + /** The type of this query constraint */ + type: 'endBefore' | 'endAt', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean); + static _create(type: 'endBefore' | 'endAt', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean): QueryEndAtConstraint; + _apply<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Query<AppModelType, DbModelType>; +} +/** + * Creates a {@link QueryEndAtConstraint} that modifies the result set to end + * before the provided document (exclusive). The end position is relative to the + * order of the query. The document must contain all of the fields provided in + * the orderBy of the query. + * + * @param snapshot - The snapshot of the document to end before. + * @returns A {@link QueryEndAtConstraint} to pass to `query()` + */ +export declare function endBefore<AppModelType, DbModelType extends DocumentData>(snapshot: DocumentSnapshot<AppModelType, DbModelType>): QueryEndAtConstraint; +/** + * Creates a {@link QueryEndAtConstraint} that modifies the result set to end + * before the provided fields relative to the order of the query. The order of + * the field values must match the order of the order by clauses of the query. + * + * @param fieldValues - The field values to end this query before, in order + * of the query's order by. + * @returns A {@link QueryEndAtConstraint} to pass to `query()` + */ +export declare function endBefore(...fieldValues: unknown[]): QueryEndAtConstraint; +/** + * Creates a {@link QueryEndAtConstraint} that modifies the result set to end at + * the provided document (inclusive). The end position is relative to the order + * of the query. The document must contain all of the fields provided in the + * orderBy of the query. + * + * @param snapshot - The snapshot of the document to end at. + * @returns A {@link QueryEndAtConstraint} to pass to `query()` + */ +export declare function endAt<AppModelType, DbModelType extends DocumentData>(snapshot: DocumentSnapshot<AppModelType, DbModelType>): QueryEndAtConstraint; +/** + * Creates a {@link QueryEndAtConstraint} that modifies the result set to end at + * the provided fields relative to the order of the query. The order of the field + * values must match the order of the order by clauses of the query. + * + * @param fieldValues - The field values to end this query at, in order + * of the query's order by. + * @returns A {@link QueryEndAtConstraint} to pass to `query()` + */ +export declare function endAt(...fieldValues: unknown[]): QueryEndAtConstraint; +export declare function newQueryFilter(query: InternalQuery, methodName: string, dataReader: UserDataReader, databaseId: DatabaseId, fieldPath: InternalFieldPath, op: Operator, value: unknown): FieldFilter; +export declare function newQueryOrderBy(query: InternalQuery, fieldPath: InternalFieldPath, direction: Direction): OrderBy; +/** + * Create a `Bound` from a query and a document. + * + * Note that the `Bound` will always include the key of the document + * and so only the provided document will compare equal to the returned + * position. + * + * Will throw if the document does not contain all fields of the order by + * of the query or if any of the fields in the order by are an uncommitted + * server timestamp. + */ +export declare function newQueryBoundFromDocument(query: InternalQuery, databaseId: DatabaseId, methodName: string, doc: Document | null, inclusive: boolean): Bound; +/** + * Converts a list of field values to a `Bound` for the given query. + */ +export declare function newQueryBoundFromFields(query: InternalQuery, databaseId: DatabaseId, dataReader: UserDataReader, methodName: string, values: unknown[], inclusive: boolean): Bound; +export declare function validateQueryFilterConstraint(functionName: string, queryConstraint: AppliableConstraint): void; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/reference.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/reference.d.ts new file mode 100644 index 0000000..fd89e5a --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/reference.d.ts @@ -0,0 +1,362 @@ +/** + * @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 { Query as InternalQuery } from '../core/query'; +import { DocumentKey } from '../model/document_key'; +import { ResourcePath } from '../model/path'; +import { Property } from '../util/json_validation'; +import { Firestore } from './database'; +import { FieldPath } from './field_path'; +import { FieldValue } from './field_value'; +import { FirestoreDataConverter } from './snapshot'; +import { NestedUpdateFields, Primitive } from './types'; +/** + * Document data (for use with {@link @firebase/firestore/lite#(setDoc:1)}) consists of fields mapped to + * values. + */ +export interface DocumentData { + /** A mapping between a field and its value. */ + [field: string]: any; +} +/** + * Similar to TypeScript's `Partial<T>`, but allows nested fields to be + * omitted and FieldValues to be passed in as property values. + */ +export type PartialWithFieldValue<T> = Partial<T> | (T extends Primitive ? T : T extends {} ? { + [K in keyof T]?: PartialWithFieldValue<T[K]> | FieldValue; +} : never); +/** + * Allows FieldValues to be passed in as a property value while maintaining + * type safety. + */ +export type WithFieldValue<T> = T | (T extends Primitive ? T : T extends {} ? { + [K in keyof T]: WithFieldValue<T[K]> | FieldValue; +} : never); +/** + * Update data (for use with {@link (updateDoc:1)}) that consists of field paths + * (e.g. 'foo' or 'foo.baz') mapped to values. Fields that contain dots + * reference nested fields within the document. FieldValues can be passed in + * as property values. + */ +export type UpdateData<T> = T extends Primitive ? T : T extends {} ? { + [K in keyof T]?: UpdateData<T[K]> | FieldValue; +} & NestedUpdateFields<T> : Partial<T>; +/** + * An options object that configures the behavior of {@link @firebase/firestore/lite#(setDoc:1)}, {@link + * @firebase/firestore/lite#(WriteBatch.set:1)} and {@link @firebase/firestore/lite#(Transaction.set:1)} calls. These calls can be + * configured to perform granular merges instead of overwriting the target + * documents in their entirety by providing a `SetOptions` with `merge: true`. + * + * @param merge - Changes the behavior of a `setDoc()` call to only replace the + * values specified in its data argument. Fields omitted from the `setDoc()` + * call remain untouched. If your input sets any field to an empty map, all + * nested fields are overwritten. + * @param mergeFields - Changes the behavior of `setDoc()` calls to only replace + * the specified field paths. Any field path that is not specified is ignored + * and remains untouched. If your input sets any field to an empty map, all + * nested fields are overwritten. + */ +export type SetOptions = { + readonly merge?: boolean; +} | { + readonly mergeFields?: Array<string | FieldPath>; +}; +/** + * A `Query` refers to a query which you can read or listen to. You can also + * construct refined `Query` objects by adding filters and ordering. + */ +export declare class Query<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> { + /** + * If provided, the `FirestoreDataConverter` associated with this instance. + */ + readonly converter: FirestoreDataConverter<AppModelType, DbModelType> | null; + readonly _query: InternalQuery; + /** The type of this Firestore reference. */ + readonly type: 'query' | 'collection'; + /** + * The `Firestore` instance for the Firestore database (useful for performing + * transactions, etc.). + */ + readonly firestore: Firestore; + /** @hideconstructor protected */ + constructor(firestore: Firestore, + /** + * If provided, the `FirestoreDataConverter` associated with this instance. + */ + converter: FirestoreDataConverter<AppModelType, DbModelType> | null, _query: InternalQuery); + /** + * Removes the current converter. + * + * @param converter - `null` removes the current converter. + * @returns A `Query<DocumentData, DocumentData>` that does not use a + * converter. + */ + withConverter(converter: null): Query<DocumentData, DocumentData>; + /** + * Applies a custom data converter to this query, allowing you to use your own + * custom model objects with Firestore. When you call {@link getDocs} with + * the returned query, the provided converter will convert between Firestore + * data of type `NewDbModelType` and your custom type `NewAppModelType`. + * + * @param converter - Converts objects to and from Firestore. + * @returns A `Query` that uses the provided converter. + */ + withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>; +} +/** + * A `DocumentReference` refers to a document location in a Firestore database + * and can be used to write, read, or listen to the location. The document at + * the referenced location may or may not exist. + */ +export declare class DocumentReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> { + /** + * If provided, the `FirestoreDataConverter` associated with this instance. + */ + readonly converter: FirestoreDataConverter<AppModelType, DbModelType> | null; + readonly _key: DocumentKey; + /** The type of this Firestore reference. */ + readonly type = "document"; + /** + * The {@link Firestore} instance the document is in. + * This is useful for performing transactions, for example. + */ + readonly firestore: Firestore; + /** @hideconstructor */ + constructor(firestore: Firestore, + /** + * If provided, the `FirestoreDataConverter` associated with this instance. + */ + converter: FirestoreDataConverter<AppModelType, DbModelType> | null, _key: DocumentKey); + get _path(): ResourcePath; + /** + * The document's identifier within its collection. + */ + get id(): string; + /** + * A string representing the path of the referenced document (relative + * to the root of the database). + */ + get path(): string; + /** + * The collection this `DocumentReference` belongs to. + */ + get parent(): CollectionReference<AppModelType, DbModelType>; + /** + * Applies a custom data converter to this `DocumentReference`, allowing you + * to use your own custom model objects with Firestore. When you call {@link + * @firebase/firestore/lite#(setDoc:1)}, {@link @firebase/firestore/lite#getDoc}, etc. with the returned `DocumentReference` + * instance, the provided converter will convert between Firestore data of + * type `NewDbModelType` and your custom type `NewAppModelType`. + * + * @param converter - Converts objects to and from Firestore. + * @returns A `DocumentReference` that uses the provided converter. + */ + withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>; + /** + * Removes the current converter. + * + * @param converter - `null` removes the current converter. + * @returns A `DocumentReference<DocumentData, DocumentData>` that does not + * use a converter. + */ + withConverter(converter: null): DocumentReference<DocumentData, DocumentData>; + static _jsonSchemaVersion: string; + static _jsonSchema: { + type: Property<"string">; + referencePath: Property<"string">; + }; + /** + * Returns a JSON-serializable representation of this `DocumentReference` instance. + * + * @returns a JSON representation of this object. + */ + toJSON(): object; + /** + * Builds a `DocumentReference` instance from a JSON object created by + * {@link DocumentReference.toJSON}. + * + * @param firestore - The {@link Firestore} instance the snapshot should be loaded for. + * @param json a JSON object represention of a `DocumentReference` instance + * @returns an instance of {@link DocumentReference} if the JSON object could be parsed. Throws a + * {@link FirestoreError} if an error occurs. + */ + static fromJSON(firestore: Firestore, json: object): DocumentReference; + /** + * Builds a `DocumentReference` instance from a JSON object created by + * {@link DocumentReference.toJSON}. + * + * @param firestore - The {@link Firestore} instance the snapshot should be loaded for. + * @param json a JSON object represention of a `DocumentReference` instance + * @param converter - Converts objects to and from Firestore. + * @returns an instance of {@link DocumentReference} if the JSON object could be parsed. Throws a + * {@link FirestoreError} if an error occurs. + */ + static fromJSON<NewAppModelType = DocumentData, NewDbModelType extends DocumentData = DocumentData>(firestore: Firestore, json: object, converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>; +} +/** + * A `CollectionReference` object can be used for adding documents, getting + * document references, and querying for documents (using {@link (query:1)}). + */ +export declare class CollectionReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> extends Query<AppModelType, DbModelType> { + readonly _path: ResourcePath; + /** The type of this Firestore reference. */ + readonly type = "collection"; + /** @hideconstructor */ + constructor(firestore: Firestore, converter: FirestoreDataConverter<AppModelType, DbModelType> | null, _path: ResourcePath); + /** The collection's identifier. */ + get id(): string; + /** + * A string representing the path of the referenced collection (relative + * to the root of the database). + */ + get path(): string; + /** + * A reference to the containing `DocumentReference` if this is a + * subcollection. If this isn't a subcollection, the reference is null. + */ + get parent(): DocumentReference<DocumentData, DocumentData> | null; + /** + * Applies a custom data converter to this `CollectionReference`, allowing you + * to use your own custom model objects with Firestore. When you call {@link + * addDoc} with the returned `CollectionReference` instance, the provided + * converter will convert between Firestore data of type `NewDbModelType` and + * your custom type `NewAppModelType`. + * + * @param converter - Converts objects to and from Firestore. + * @returns A `CollectionReference` that uses the provided converter. + */ + withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>; + /** + * Removes the current converter. + * + * @param converter - `null` removes the current converter. + * @returns A `CollectionReference<DocumentData, DocumentData>` that does not + * use a converter. + */ + withConverter(converter: null): CollectionReference<DocumentData, DocumentData>; +} +/** + * Gets a `CollectionReference` instance that refers to the collection at + * the specified absolute path. + * + * @param firestore - A reference to the root `Firestore` instance. + * @param path - A slash-separated path to a collection. + * @param pathSegments - Additional path segments to apply relative to the first + * argument. + * @throws If the final path has an even number of segments and does not point + * to a collection. + * @returns The `CollectionReference` instance. + */ +export declare function collection(firestore: Firestore, path: string, ...pathSegments: string[]): CollectionReference<DocumentData, DocumentData>; +/** + * Gets a `CollectionReference` instance that refers to a subcollection of + * `reference` at the specified relative path. + * + * @param reference - A reference to a collection. + * @param path - A slash-separated path to a collection. + * @param pathSegments - Additional path segments to apply relative to the first + * argument. + * @throws If the final path has an even number of segments and does not point + * to a collection. + * @returns The `CollectionReference` instance. + */ +export declare function collection<AppModelType, DbModelType extends DocumentData>(reference: CollectionReference<AppModelType, DbModelType>, path: string, ...pathSegments: string[]): CollectionReference<DocumentData, DocumentData>; +/** + * Gets a `CollectionReference` instance that refers to a subcollection of + * `reference` at the specified relative path. + * + * @param reference - A reference to a Firestore document. + * @param path - A slash-separated path to a collection. + * @param pathSegments - Additional path segments that will be applied relative + * to the first argument. + * @throws If the final path has an even number of segments and does not point + * to a collection. + * @returns The `CollectionReference` instance. + */ +export declare function collection<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, path: string, ...pathSegments: string[]): CollectionReference<DocumentData, DocumentData>; +/** + * Creates and returns a new `Query` instance that includes all documents in the + * database that are contained in a collection or subcollection with the + * given `collectionId`. + * + * @param firestore - A reference to the root `Firestore` instance. + * @param collectionId - Identifies the collections to query over. Every + * collection or subcollection with this ID as the last segment of its path + * will be included. Cannot contain a slash. + * @returns The created `Query`. + */ +export declare function collectionGroup(firestore: Firestore, collectionId: string): Query<DocumentData, DocumentData>; +/** + * Gets a `DocumentReference` instance that refers to the document at the + * specified absolute path. + * + * @param firestore - A reference to the root `Firestore` instance. + * @param path - A slash-separated path to a document. + * @param pathSegments - Additional path segments that will be applied relative + * to the first argument. + * @throws If the final path has an odd number of segments and does not point to + * a document. + * @returns The `DocumentReference` instance. + */ +export declare function doc(firestore: Firestore, path: string, ...pathSegments: string[]): DocumentReference<DocumentData, DocumentData>; +/** + * Gets a `DocumentReference` instance that refers to a document within + * `reference` at the specified relative path. If no path is specified, an + * automatically-generated unique ID will be used for the returned + * `DocumentReference`. + * + * @param reference - A reference to a collection. + * @param path - A slash-separated path to a document. Has to be omitted to use + * auto-generated IDs. + * @param pathSegments - Additional path segments that will be applied relative + * to the first argument. + * @throws If the final path has an odd number of segments and does not point to + * a document. + * @returns The `DocumentReference` instance. + */ +export declare function doc<AppModelType, DbModelType extends DocumentData>(reference: CollectionReference<AppModelType, DbModelType>, path?: string, ...pathSegments: string[]): DocumentReference<AppModelType, DbModelType>; +/** + * Gets a `DocumentReference` instance that refers to a document within + * `reference` at the specified relative path. + * + * @param reference - A reference to a Firestore document. + * @param path - A slash-separated path to a document. + * @param pathSegments - Additional path segments that will be applied relative + * to the first argument. + * @throws If the final path has an odd number of segments and does not point to + * a document. + * @returns The `DocumentReference` instance. + */ +export declare function doc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, path: string, ...pathSegments: string[]): DocumentReference<DocumentData, DocumentData>; +/** + * Returns true if the provided references are equal. + * + * @param left - A reference to compare. + * @param right - A reference to compare. + * @returns true if the references point to the same location in the same + * Firestore database. + */ +export declare function refEqual<AppModelType, DbModelType extends DocumentData>(left: DocumentReference<AppModelType, DbModelType> | CollectionReference<AppModelType, DbModelType>, right: DocumentReference<AppModelType, DbModelType> | CollectionReference<AppModelType, DbModelType>): boolean; +/** + * Returns true if the provided queries point to the same collection and apply + * the same constraints. + * + * @param left - A `Query` to compare. + * @param right - A `Query` to compare. + * @returns true if the references point to the same location in the same + * Firestore database. + */ +export declare function queryEqual<AppModelType, DbModelType extends DocumentData>(left: Query<AppModelType, DbModelType>, right: Query<AppModelType, DbModelType>): boolean; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/reference_impl.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/reference_impl.d.ts new file mode 100644 index 0000000..724ae99 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/reference_impl.d.ts @@ -0,0 +1,172 @@ +/** + * @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 { DocumentData as PublicDocumentData, SetOptions as PublicSetOptions } from '@firebase/firestore-types'; +import { ByteString } from '../util/byte_string'; +import { Bytes } from './bytes'; +import { Firestore } from './database'; +import { FieldPath } from './field_path'; +import { CollectionReference, DocumentData, DocumentReference, PartialWithFieldValue, Query, SetOptions, UpdateData, WithFieldValue } from './reference'; +import { DocumentSnapshot, QuerySnapshot } from './snapshot'; +import { UntypedFirestoreDataConverter } from './user_data_reader'; +import { AbstractUserDataWriter } from './user_data_writer'; +/** + * Converts custom model object of type T into `DocumentData` by applying the + * converter if it exists. + * + * This function is used when converting user objects to `DocumentData` + * because we want to provide the user with a more specific error message if + * their `set()` or fails due to invalid data originating from a `toFirestore()` + * call. + */ +export declare function applyFirestoreDataConverter<T>(converter: UntypedFirestoreDataConverter<T> | null, value: WithFieldValue<T> | PartialWithFieldValue<T>, options?: PublicSetOptions): PublicDocumentData; +export declare class LiteUserDataWriter extends AbstractUserDataWriter { + protected firestore: Firestore; + constructor(firestore: Firestore); + protected convertBytes(bytes: ByteString): Bytes; + protected convertReference(name: string): DocumentReference; +} +/** + * Reads the document referred to by the specified document reference. + * + * All documents are directly fetched from the server, even if the document was + * previously read or modified. Recent modifications are only reflected in the + * retrieved `DocumentSnapshot` if they have already been applied by the + * backend. If the client is offline, the read fails. If you like to use + * caching or see local modifications, please use the full Firestore SDK. + * + * @param reference - The reference of the document to fetch. + * @returns A Promise resolved with a `DocumentSnapshot` containing the current + * document contents. + */ +export declare function getDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>; +/** + * Executes the query and returns the results as a {@link QuerySnapshot}. + * + * All queries are executed directly by the server, even if the query was + * previously executed. Recent modifications are only reflected in the retrieved + * results if they have already been applied by the backend. If the client is + * offline, the operation fails. To see previously cached result and local + * modifications, use the full Firestore SDK. + * + * @param query - The `Query` to execute. + * @returns A Promise that will be resolved with the results of the query. + */ +export declare function getDocs<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>>; +/** + * Writes to the document referred to by the specified `DocumentReference`. If + * the document does not yet exist, it will be created. + * + * The result of this write will only be reflected in document reads that occur + * after the returned promise resolves. If the client is offline, the + * write fails. If you would like to see local modifications or buffer writes + * until the client is online, use the full Firestore SDK. + * + * @param reference - A reference to the document to write. + * @param data - A map of the fields and values for the document. + * @throws Error - If the provided input is not a valid Firestore document. + * @returns A `Promise` resolved once the data has been successfully written + * to the backend. + */ +export declare function setDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, data: WithFieldValue<AppModelType>): Promise<void>; +/** + * Writes to the document referred to by the specified `DocumentReference`. If + * the document does not yet exist, it will be created. If you provide `merge` + * or `mergeFields`, the provided data can be merged into an existing document. + * + * The result of this write will only be reflected in document reads that occur + * after the returned promise resolves. If the client is offline, the + * write fails. If you would like to see local modifications or buffer writes + * until the client is online, use the full Firestore SDK. + * + * @param reference - A reference to the document to write. + * @param data - A map of the fields and values for the document. + * @param options - An object to configure the set behavior. + * @throws Error - If the provided input is not a valid Firestore document. + * @returns A `Promise` resolved once the data has been successfully written + * to the backend. + */ +export declare function setDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, data: PartialWithFieldValue<AppModelType>, options: SetOptions): Promise<void>; +/** + * Updates fields in the document referred to by the specified + * `DocumentReference`. The update will fail if applied to a document that does + * not exist. + * + * The result of this update will only be reflected in document reads that occur + * after the returned promise resolves. If the client is offline, the + * update fails. If you would like to see local modifications or buffer writes + * until the client is online, use the full Firestore SDK. + * + * @param reference - A reference to the document to update. + * @param data - An object containing the fields and values with which to + * update the document. Fields can contain dots to reference nested fields + * within the document. + * @throws Error - If the provided input is not valid Firestore data. + * @returns A `Promise` resolved once the data has been successfully written + * to the backend. + */ +export declare function updateDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, data: UpdateData<DbModelType>): Promise<void>; +/** + * Updates fields in the document referred to by the specified + * `DocumentReference` The update will fail if applied to a document that does + * not exist. + * + * Nested fields can be updated by providing dot-separated field path + * strings or by providing `FieldPath` objects. + * + * The result of this update will only be reflected in document reads that occur + * after the returned promise resolves. If the client is offline, the + * update fails. If you would like to see local modifications or buffer writes + * until the client is online, use the full Firestore SDK. + * + * @param reference - A reference to the document to update. + * @param field - The first field to update. + * @param value - The first value. + * @param moreFieldsAndValues - Additional key value pairs. + * @throws Error - If the provided input is not valid Firestore data. + * @returns A `Promise` resolved once the data has been successfully written + * to the backend. + */ +export declare function updateDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): Promise<void>; +/** + * Deletes the document referred to by the specified `DocumentReference`. + * + * The deletion will only be reflected in document reads that occur after the + * returned promise resolves. If the client is offline, the + * delete fails. If you would like to see local modifications or buffer writes + * until the client is online, use the full Firestore SDK. + * + * @param reference - A reference to the document to delete. + * @returns A `Promise` resolved once the document has been successfully + * deleted from the backend. + */ +export declare function deleteDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>): Promise<void>; +/** + * Add a new document to specified `CollectionReference` with the given data, + * assigning it a document ID automatically. + * + * The result of this write will only be reflected in document reads that occur + * after the returned promise resolves. If the client is offline, the + * write fails. If you would like to see local modifications or buffer writes + * until the client is online, use the full Firestore SDK. + * + * @param reference - A reference to the collection to add this document to. + * @param data - An Object containing the data for the new document. + * @throws Error - If the provided input is not a valid Firestore document. + * @returns A `Promise` resolved with a `DocumentReference` pointing to the + * newly created document after it has been written to the backend. + */ +export declare function addDoc<AppModelType, DbModelType extends DocumentData>(reference: CollectionReference<AppModelType, DbModelType>, data: WithFieldValue<AppModelType>): Promise<DocumentReference<AppModelType, DbModelType>>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/settings.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/settings.d.ts new file mode 100644 index 0000000..e86bdbe --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/settings.d.ts @@ -0,0 +1,77 @@ +/** + * @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 { EmulatorMockTokenOptions } from '@firebase/util'; +import { FirestoreLocalCache } from '../api/cache_config'; +import { CredentialsSettings } from '../api/credentials'; +import { ExperimentalLongPollingOptions } from '../api/long_polling_options'; +export declare const DEFAULT_HOST = "firestore.googleapis.com"; +export declare const DEFAULT_SSL = true; +/** + * Specifies custom configurations for your Cloud Firestore instance. + * You must set these before invoking any other methods. + */ +export interface FirestoreSettings { + /** The hostname to connect to. */ + host?: string; + /** Whether to use SSL when connecting. */ + ssl?: boolean; + /** + * Whether to skip nested properties that are set to `undefined` during + * object serialization. If set to `true`, these properties are skipped + * and not written to Firestore. If set to `false` or omitted, the SDK + * throws an exception when it encounters properties of type `undefined`. + */ + ignoreUndefinedProperties?: boolean; +} +/** + * @internal + * Undocumented, private additional settings not exposed in our public API. + */ +export interface PrivateSettings extends FirestoreSettings { + credentials?: CredentialsSettings; + cacheSizeBytes?: number; + experimentalForceLongPolling?: boolean; + experimentalAutoDetectLongPolling?: boolean; + experimentalLongPollingOptions?: ExperimentalLongPollingOptions; + useFetchStreams?: boolean; + emulatorOptions?: { + mockUserToken?: EmulatorMockTokenOptions | string; + }; + localCache?: FirestoreLocalCache; +} +/** + * A concrete type describing all the values that can be applied via a + * user-supplied `FirestoreSettings` object. This is a separate type so that + * defaults can be supplied and the value can be checked for equality. + */ +export declare class FirestoreSettingsImpl { + /** The hostname to connect to. */ + readonly host: string; + /** Whether to use SSL when connecting. */ + readonly ssl: boolean; + readonly cacheSizeBytes: number; + readonly experimentalForceLongPolling: boolean; + readonly experimentalAutoDetectLongPolling: boolean; + readonly experimentalLongPollingOptions: ExperimentalLongPollingOptions; + readonly ignoreUndefinedProperties: boolean; + readonly useFetchStreams: boolean; + readonly localCache?: FirestoreLocalCache; + readonly isUsingEmulator: boolean; + credentials?: any; + constructor(settings: PrivateSettings); + isEqual(other: FirestoreSettingsImpl): boolean; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/snapshot.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/snapshot.d.ts new file mode 100644 index 0000000..312e3f3 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/snapshot.d.ts @@ -0,0 +1,367 @@ +/** + * @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 { Compat } from '@firebase/util'; +import { Document } from '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { FieldPath as InternalFieldPath } from '../model/path'; +import { Firestore } from './database'; +import { FieldPath } from './field_path'; +import { DocumentData, DocumentReference, PartialWithFieldValue, Query, SetOptions, WithFieldValue } from './reference'; +import { UntypedFirestoreDataConverter } from './user_data_reader'; +import { AbstractUserDataWriter } from './user_data_writer'; +/** + * Converter used by `withConverter()` to transform user objects of type + * `AppModelType` into Firestore data of type `DbModelType`. + * + * Using the converter allows you to specify generic type arguments when + * storing and retrieving objects from Firestore. + * + * In this context, an "AppModel" is a class that is used in an application to + * package together related information and functionality. Such a class could, + * for example, have properties with complex, nested data types, properties used + * for memoization, properties of types not supported by Firestore (such as + * `symbol` and `bigint`), and helper functions that perform compound + * operations. Such classes are not suitable and/or possible to store into a + * Firestore database. Instead, instances of such classes need to be converted + * to "plain old JavaScript objects" (POJOs) with exclusively primitive + * properties, potentially nested inside other POJOs or arrays of POJOs. In this + * context, this type is referred to as the "DbModel" and would be an object + * suitable for persisting into Firestore. For convenience, applications can + * implement `FirestoreDataConverter` and register the converter with Firestore + * objects, such as `DocumentReference` or `Query`, to automatically convert + * `AppModel` to `DbModel` when storing into Firestore, and convert `DbModel` + * to `AppModel` when retrieving from Firestore. + * + * @example + * + * Simple Example + * + * ```typescript + * const numberConverter = { + * toFirestore(value: WithFieldValue<number>) { + * return { value }; + * }, + * fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions) { + * return snapshot.data(options).value as number; + * } + * }; + * + * async function simpleDemo(db: Firestore): Promise<void> { + * const documentRef = doc(db, 'values/value123').withConverter(numberConverter); + * + * // converters are used with `setDoc`, `addDoc`, and `getDoc` + * await setDoc(documentRef, 42); + * const snapshot1 = await getDoc(documentRef); + * assertEqual(snapshot1.data(), 42); + * + * // converters are not used when writing data with `updateDoc` + * await updateDoc(documentRef, { value: 999 }); + * const snapshot2 = await getDoc(documentRef); + * assertEqual(snapshot2.data(), 999); + * } + * ``` + * + * Advanced Example + * + * ```typescript + * // The Post class is a model that is used by our application. + * // This class may have properties and methods that are specific + * // to our application execution, which do not need to be persisted + * // to Firestore. + * class Post { + * constructor( + * readonly title: string, + * readonly author: string, + * readonly lastUpdatedMillis: number + * ) {} + * toString(): string { + * return `${this.title} by ${this.author}`; + * } + * } + * + * // The PostDbModel represents how we want our posts to be stored + * // in Firestore. This DbModel has different properties (`ttl`, + * // `aut`, and `lut`) from the Post class we use in our application. + * interface PostDbModel { + * ttl: string; + * aut: { firstName: string; lastName: string }; + * lut: Timestamp; + * } + * + * // The `PostConverter` implements `FirestoreDataConverter` and specifies + * // how the Firestore SDK can convert `Post` objects to `PostDbModel` + * // objects and vice versa. + * class PostConverter implements FirestoreDataConverter<Post, PostDbModel> { + * toFirestore(post: WithFieldValue<Post>): WithFieldValue<PostDbModel> { + * return { + * ttl: post.title, + * aut: this._autFromAuthor(post.author), + * lut: this._lutFromLastUpdatedMillis(post.lastUpdatedMillis) + * }; + * } + * + * fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions): Post { + * const data = snapshot.data(options) as PostDbModel; + * const author = `${data.aut.firstName} ${data.aut.lastName}`; + * return new Post(data.ttl, author, data.lut.toMillis()); + * } + * + * _autFromAuthor( + * author: string | FieldValue + * ): { firstName: string; lastName: string } | FieldValue { + * if (typeof author !== 'string') { + * // `author` is a FieldValue, so just return it. + * return author; + * } + * const [firstName, lastName] = author.split(' '); + * return {firstName, lastName}; + * } + * + * _lutFromLastUpdatedMillis( + * lastUpdatedMillis: number | FieldValue + * ): Timestamp | FieldValue { + * if (typeof lastUpdatedMillis !== 'number') { + * // `lastUpdatedMillis` must be a FieldValue, so just return it. + * return lastUpdatedMillis; + * } + * return Timestamp.fromMillis(lastUpdatedMillis); + * } + * } + * + * async function advancedDemo(db: Firestore): Promise<void> { + * // Create a `DocumentReference` with a `FirestoreDataConverter`. + * const documentRef = doc(db, 'posts/post123').withConverter(new PostConverter()); + * + * // The `data` argument specified to `setDoc()` is type checked by the + * // TypeScript compiler to be compatible with `Post`. Since the `data` + * // argument is typed as `WithFieldValue<Post>` rather than just `Post`, + * // this allows properties of the `data` argument to also be special + * // Firestore values that perform server-side mutations, such as + * // `arrayRemove()`, `deleteField()`, and `serverTimestamp()`. + * await setDoc(documentRef, { + * title: 'My Life', + * author: 'Foo Bar', + * lastUpdatedMillis: serverTimestamp() + * }); + * + * // The TypeScript compiler will fail to compile if the `data` argument to + * // `setDoc()` is _not_ compatible with `WithFieldValue<Post>`. This + * // type checking prevents the caller from specifying objects with incorrect + * // properties or property values. + * // @ts-expect-error "Argument of type { ttl: string; } is not assignable + * // to parameter of type WithFieldValue<Post>" + * await setDoc(documentRef, { ttl: 'The Title' }); + * + * // When retrieving a document with `getDoc()` the `DocumentSnapshot` + * // object's `data()` method returns a `Post`, rather than a generic object, + * // which would have been returned if the `DocumentReference` did _not_ have a + * // `FirestoreDataConverter` attached to it. + * const snapshot1: DocumentSnapshot<Post> = await getDoc(documentRef); + * const post1: Post = snapshot1.data()!; + * if (post1) { + * assertEqual(post1.title, 'My Life'); + * assertEqual(post1.author, 'Foo Bar'); + * } + * + * // The `data` argument specified to `updateDoc()` is type checked by the + * // TypeScript compiler to be compatible with `PostDbModel`. Note that + * // unlike `setDoc()`, whose `data` argument must be compatible with `Post`, + * // the `data` argument to `updateDoc()` must be compatible with + * // `PostDbModel`. Similar to `setDoc()`, since the `data` argument is typed + * // as `WithFieldValue<PostDbModel>` rather than just `PostDbModel`, this + * // allows properties of the `data` argument to also be those special + * // Firestore values, like `arrayRemove()`, `deleteField()`, and + * // `serverTimestamp()`. + * await updateDoc(documentRef, { + * 'aut.firstName': 'NewFirstName', + * lut: serverTimestamp() + * }); + * + * // The TypeScript compiler will fail to compile if the `data` argument to + * // `updateDoc()` is _not_ compatible with `WithFieldValue<PostDbModel>`. + * // This type checking prevents the caller from specifying objects with + * // incorrect properties or property values. + * // @ts-expect-error "Argument of type { title: string; } is not assignable + * // to parameter of type WithFieldValue<PostDbModel>" + * await updateDoc(documentRef, { title: 'New Title' }); + * const snapshot2: DocumentSnapshot<Post> = await getDoc(documentRef); + * const post2: Post = snapshot2.data()!; + * if (post2) { + * assertEqual(post2.title, 'My Life'); + * assertEqual(post2.author, 'NewFirstName Bar'); + * } + * } + * ``` + */ +export interface FirestoreDataConverter<AppModelType, DbModelType extends DocumentData = DocumentData> { + /** + * Called by the Firestore SDK to convert a custom model object of type + * `AppModelType` into a plain JavaScript object (suitable for writing + * directly to the Firestore database) of type `DbModelType`. Used with + * {@link @firebase/firestore/lite#(setDoc:1)}, + * {@link @firebase/firestore/lite#(WriteBatch.set:1)} and + * {@link @firebase/firestore/lite#(Transaction.set:1)}. + * + * The `WithFieldValue<T>` type extends `T` to also allow FieldValues such as + * {@link (deleteField:1)} to be used as property values. + */ + toFirestore(modelObject: WithFieldValue<AppModelType>): WithFieldValue<DbModelType>; + /** + * Called by the Firestore SDK to convert a custom model object of type + * `AppModelType` into a plain JavaScript object (suitable for writing + * directly to the Firestore database) of type `DbModelType`. Used with + * {@link @firebase/firestore/lite#(setDoc:1)}, + * {@link @firebase/firestore/lite#(WriteBatch.set:1)} and + * {@link @firebase/firestore/lite#(Transaction.set:1)} with `merge:true` + * or `mergeFields`. + * + * The `PartialWithFieldValue<T>` type extends `Partial<T>` to allow + * FieldValues such as {@link (arrayUnion:1)} to be used as property values. + * It also supports nested `Partial` by allowing nested fields to be + * omitted. + */ + toFirestore(modelObject: PartialWithFieldValue<AppModelType>, options: SetOptions): PartialWithFieldValue<DbModelType>; + /** + * Called by the Firestore SDK to convert Firestore data into an object of + * type `AppModelType`. You can access your data by calling: + * `snapshot.data()`. + * + * + * Generally, the data returned from `snapshot.data()` can be cast to + * `DbModelType`; however, this is not guaranteed because Firestore does not + * enforce a schema on the database. For example, writes from a previous + * version of the application or writes from another client that did not use a + * type converter could have written data with different properties and/or + * property types. The implementation will need to choose whether to + * gracefully recover from non-conforming data or throw an error. + * + * @param snapshot - A `QueryDocumentSnapshot` containing your data and + * metadata. + */ + fromFirestore(snapshot: QueryDocumentSnapshot<DocumentData, DocumentData>): AppModelType; +} +/** + * A `DocumentSnapshot` contains data read from a document in your Firestore + * database. The data can be extracted with `.data()` or `.get(<field>)` to + * get a specific field. + * + * For a `DocumentSnapshot` that points to a non-existing document, any data + * access will return 'undefined'. You can use the `exists()` method to + * explicitly verify a document's existence. + */ +export declare class DocumentSnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> { + _firestore: Firestore; + _userDataWriter: AbstractUserDataWriter; + _key: DocumentKey; + _document: Document | null; + _converter: UntypedFirestoreDataConverter<AppModelType, DbModelType> | null; + /** @hideconstructor protected */ + constructor(_firestore: Firestore, _userDataWriter: AbstractUserDataWriter, _key: DocumentKey, _document: Document | null, _converter: UntypedFirestoreDataConverter<AppModelType, DbModelType> | null); + /** Property of the `DocumentSnapshot` that provides the document's ID. */ + get id(): string; + /** + * The `DocumentReference` for the document included in the `DocumentSnapshot`. + */ + get ref(): DocumentReference<AppModelType, DbModelType>; + /** + * Signals whether or not the document at the snapshot's location exists. + * + * @returns true if the document exists. + */ + exists(): this is QueryDocumentSnapshot<AppModelType, DbModelType>; + /** + * Retrieves all fields in the document as an `Object`. Returns `undefined` if + * the document doesn't exist. + * + * @returns An `Object` containing all fields in the document or `undefined` + * if the document doesn't exist. + */ + data(): AppModelType | undefined; + /** + * Retrieves the field specified by `fieldPath`. Returns `undefined` if the + * document or field doesn't exist. + * + * @param fieldPath - The path (for example 'foo' or 'foo.bar') to a specific + * field. + * @returns The data at the specified field location or undefined if no such + * field exists in the document. + */ + get(fieldPath: string | FieldPath): any; +} +/** + * A `QueryDocumentSnapshot` contains data read from a document in your + * Firestore database as part of a query. The document is guaranteed to exist + * and its data can be extracted with `.data()` or `.get(<field>)` to get a + * specific field. + * + * A `QueryDocumentSnapshot` offers the same API surface as a + * `DocumentSnapshot`. Since query results contain only existing documents, the + * `exists` property will always be true and `data()` will never return + * 'undefined'. + */ +export declare class QueryDocumentSnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> extends DocumentSnapshot<AppModelType, DbModelType> { + /** + * Retrieves all fields in the document as an `Object`. + * + * @override + * @returns An `Object` containing all fields in the document. + */ + data(): AppModelType; +} +/** + * A `QuerySnapshot` contains zero or more `DocumentSnapshot` objects + * representing the results of a query. The documents can be accessed as an + * array via the `docs` property or enumerated using the `forEach` method. The + * number of documents can be determined via the `empty` and `size` + * properties. + */ +export declare class QuerySnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> { + readonly _docs: Array<QueryDocumentSnapshot<AppModelType, DbModelType>>; + /** + * The query on which you called {@link getDocs} in order to get this + * `QuerySnapshot`. + */ + readonly query: Query<AppModelType, DbModelType>; + /** @hideconstructor */ + constructor(_query: Query<AppModelType, DbModelType>, _docs: Array<QueryDocumentSnapshot<AppModelType, DbModelType>>); + /** An array of all the documents in the `QuerySnapshot`. */ + get docs(): Array<QueryDocumentSnapshot<AppModelType, DbModelType>>; + /** The number of documents in the `QuerySnapshot`. */ + get size(): number; + /** True if there are no documents in the `QuerySnapshot`. */ + get empty(): boolean; + /** + * Enumerates all of the documents in the `QuerySnapshot`. + * + * @param callback - A callback to be called with a `QueryDocumentSnapshot` for + * each document in the snapshot. + * @param thisArg - The `this` binding for the callback. + */ + forEach(callback: (result: QueryDocumentSnapshot<AppModelType, DbModelType>) => void, thisArg?: unknown): void; +} +/** + * Returns true if the provided snapshots are equal. + * + * @param left - A snapshot to compare. + * @param right - A snapshot to compare. + * @returns true if the snapshots are equal. + */ +export declare function snapshotEqual<AppModelType, DbModelType extends DocumentData>(left: DocumentSnapshot<AppModelType, DbModelType> | QuerySnapshot<AppModelType, DbModelType>, right: DocumentSnapshot<AppModelType, DbModelType> | QuerySnapshot<AppModelType, DbModelType>): boolean; +/** + * Helper that calls `fromDotSeparatedString()` but wraps any error thrown. + */ +export declare function fieldPathFromArgument(methodName: string, arg: string | FieldPath | Compat<FieldPath>): InternalFieldPath; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/timestamp.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/timestamp.d.ts new file mode 100644 index 0000000..6d14f82 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/timestamp.d.ts @@ -0,0 +1,134 @@ +/** + * @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 { Property } from '../util/json_validation'; +/** + * A `Timestamp` represents a point in time independent of any time zone or + * calendar, represented as seconds and fractions of seconds at nanosecond + * resolution in UTC Epoch time. + * + * It is encoded using the Proleptic Gregorian Calendar which extends the + * Gregorian calendar backwards to year one. It is encoded assuming all minutes + * are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second + * table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59.999999999Z. + * + * For examples and further specifications, refer to the + * {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}. + */ +export declare class Timestamp { + /** + * The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. + */ + readonly seconds: number; + /** + * The fractions of a second at nanosecond resolution.* + */ + readonly nanoseconds: number; + /** + * Creates a new timestamp with the current date, with millisecond precision. + * + * @returns a new timestamp representing the current date. + */ + static now(): Timestamp; + /** + * Creates a new timestamp from the given date. + * + * @param date - The date to initialize the `Timestamp` from. + * @returns A new `Timestamp` representing the same point in time as the given + * date. + */ + static fromDate(date: Date): Timestamp; + /** + * Creates a new timestamp from the given number of milliseconds. + * + * @param milliseconds - Number of milliseconds since Unix epoch + * 1970-01-01T00:00:00Z. + * @returns A new `Timestamp` representing the same point in time as the given + * number of milliseconds. + */ + static fromMillis(milliseconds: number): Timestamp; + /** + * Creates a new timestamp. + * + * @param 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 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( + /** + * The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. + */ + seconds: number, + /** + * The fractions of a second at nanosecond resolution.* + */ + nanoseconds: number); + /** + * Converts a `Timestamp` to a JavaScript `Date` object. This conversion + * causes a loss of precision since `Date` objects only support millisecond + * precision. + * + * @returns JavaScript `Date` object representing the same point in time as + * this `Timestamp`, with millisecond precision. + */ + toDate(): Date; + /** + * Converts a `Timestamp` to a numeric timestamp (in milliseconds since + * epoch). This operation causes a loss of precision. + * + * @returns The point in time corresponding to this timestamp, represented as + * the number of milliseconds since Unix epoch 1970-01-01T00:00:00Z. + */ + toMillis(): number; + _compareTo(other: Timestamp): number; + /** + * Returns true if this `Timestamp` is equal to the provided one. + * + * @param other - The `Timestamp` to compare against. + * @returns true if this `Timestamp` is equal to the provided one. + */ + isEqual(other: Timestamp): boolean; + /** Returns a textual representation of this `Timestamp`. */ + toString(): string; + static _jsonSchemaVersion: string; + static _jsonSchema: { + type: Property<"string">; + seconds: Property<"number">; + nanoseconds: Property<"number">; + }; + /** + * Returns a JSON-serializable representation of this `Timestamp`. + */ + toJSON(): { + seconds: number; + nanoseconds: number; + type: string; + }; + /** + * Builds a `Timestamp` instance from a JSON object created by {@link Timestamp.toJSON}. + */ + static fromJSON(json: object): Timestamp; + /** + * Converts this object to a primitive string, which allows `Timestamp` objects + * to be compared using the `>`, `<=`, `>=` and `>` operators. + */ + valueOf(): string; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/transaction.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/transaction.d.ts new file mode 100644 index 0000000..eee3374 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/transaction.d.ts @@ -0,0 +1,122 @@ +/** + * @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 { Transaction as InternalTransaction } from '../core/transaction'; +import { Firestore } from './database'; +import { FieldPath } from './field_path'; +import { DocumentData, DocumentReference, PartialWithFieldValue, SetOptions, UpdateData, WithFieldValue } from './reference'; +import { DocumentSnapshot } from './snapshot'; +import { TransactionOptions } from './transaction_options'; +/** + * A reference to a transaction. + * + * The `Transaction` object passed to a transaction's `updateFunction` provides + * the methods to read and write data within the transaction context. See + * {@link runTransaction}. + */ +export declare class Transaction { + protected readonly _firestore: Firestore; + private readonly _transaction; + private readonly _dataReader; + /** @hideconstructor */ + constructor(_firestore: Firestore, _transaction: InternalTransaction); + /** + * Reads the document referenced by the provided {@link DocumentReference}. + * + * @param documentRef - A reference to the document to be read. + * @returns A `DocumentSnapshot` with the read data. + */ + get<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>; + /** + * Writes to the document referred to by the provided {@link + * DocumentReference}. If the document does not exist yet, it will be created. + * + * @param documentRef - A reference to the document to be set. + * @param data - An object of the fields and values for the document. + * @throws Error - If the provided input is not a valid Firestore document. + * @returns This `Transaction` instance. Used for chaining method calls. + */ + set<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>, data: WithFieldValue<AppModelType>): this; + /** + * Writes to the document referred to by the provided {@link + * DocumentReference}. If the document does not exist yet, it will be created. + * If you provide `merge` or `mergeFields`, the provided data can be merged + * into an existing document. + * + * @param documentRef - A reference to the document to be set. + * @param data - An object of the fields and values for the document. + * @param options - An object to configure the set behavior. + * @throws Error - If the provided input is not a valid Firestore document. + * @returns This `Transaction` instance. Used for chaining method calls. + */ + set<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>, data: PartialWithFieldValue<AppModelType>, options: SetOptions): this; + /** + * Updates fields in the document referred to by the provided {@link + * DocumentReference}. The update will fail if applied to a document that does + * not exist. + * + * @param documentRef - A reference to the document to be updated. + * @param data - An object containing the fields and values with which to + * update the document. Fields can contain dots to reference nested fields + * within the document. + * @throws Error - If the provided input is not valid Firestore data. + * @returns This `Transaction` instance. Used for chaining method calls. + */ + update<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>, data: UpdateData<DbModelType>): this; + /** + * Updates fields in the document referred to by the provided {@link + * DocumentReference}. The update will fail if applied to a document that does + * not exist. + * + * Nested fields can be updated by providing dot-separated field path + * strings or by providing `FieldPath` objects. + * + * @param documentRef - A reference to the document to be updated. + * @param field - The first field to update. + * @param value - The first value. + * @param moreFieldsAndValues - Additional key/value pairs. + * @throws Error - If the provided input is not valid Firestore data. + * @returns This `Transaction` instance. Used for chaining method calls. + */ + update<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): this; + /** + * Deletes the document referred to by the provided {@link DocumentReference}. + * + * @param documentRef - A reference to the document to be deleted. + * @returns This `Transaction` instance. Used for chaining method calls. + */ + delete<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>): this; +} +/** + * Executes the given `updateFunction` and then attempts to commit the changes + * applied within the transaction. If any document read within the transaction + * has changed, Cloud Firestore retries the `updateFunction`. If it fails to + * commit after 5 attempts, the transaction fails. + * + * The maximum number of writes allowed in a single transaction is 500. + * + * @param firestore - A reference to the Firestore database to run this + * transaction against. + * @param updateFunction - The function to execute within the transaction + * context. + * @param options - An options object to configure maximum number of attempts to + * commit. + * @returns If the transaction completed successfully or was explicitly aborted + * (the `updateFunction` returned a failed promise), the promise returned by the + * `updateFunction `is returned here. Otherwise, if the transaction failed, a + * rejected promise with the corresponding failure error is returned. + */ +export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/transaction_options.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/transaction_options.d.ts new file mode 100644 index 0000000..113fb49 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/transaction_options.d.ts @@ -0,0 +1,23 @@ +/** + * @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. + */ +/** + * Options to customize transaction behavior. + */ +export declare interface TransactionOptions { + /** Maximum number of attempts to commit, after which transaction fails. Default is 5. */ + readonly maxAttempts?: number; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/types.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/types.d.ts new file mode 100644 index 0000000..5c56c2d --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/types.d.ts @@ -0,0 +1,61 @@ +/** + * @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 { UpdateData } from './reference'; +/** + * These types primarily exist to support the `UpdateData`, + * `WithFieldValue`, and `PartialWithFieldValue` types and are not consumed + * directly by the end developer. + */ +/** Primitive types. */ +export type Primitive = string | number | boolean | undefined | null; +/** + * For each field (e.g. 'bar'), find all nested keys (e.g. {'bar.baz': T1, + * 'bar.qux': T2}). Intersect them together to make a single map containing + * all possible keys that are all marked as optional + */ +export type NestedUpdateFields<T extends Record<string, unknown>> = UnionToIntersection<{ + [K in keyof T & string]: ChildUpdateFields<K, T[K]>; +}[keyof T & string]>; +/** + * Helper for calculating the nested fields for a given type T1. This is needed + * to distribute union types such as `undefined | {...}` (happens for optional + * props) or `{a: A} | {b: B}`. + * + * In this use case, `V` is used to distribute the union types of `T[K]` on + * `Record`, since `T[K]` is evaluated as an expression and not distributed. + * + * See https://www.typescriptlang.org/docs/handbook/advanced-types.html#distributive-conditional-types + */ +export type ChildUpdateFields<K extends string, V> = V extends Record<string, unknown> ? AddPrefixToKeys<K, UpdateData<V>> : never; +/** + * Returns a new map where every key is prefixed with the outer key appended + * to a dot. + */ +export type AddPrefixToKeys<Prefix extends string, T extends Record<string, unknown>> = { + [K in keyof T & string as `${Prefix}.${K}`]+?: string extends K ? any : T[K]; +}; +/** + * Given a union type `U = T1 | T2 | ...`, returns an intersected type + * `(T1 & T2 & ...)`. + * + * Uses distributive conditional types and inference from conditional types. + * This works because multiple candidates for the same type variable in + * contra-variant positions causes an intersection type to be inferred. + * https://www.typescriptlang.org/docs/handbook/advanced-types.html#type-inference-in-conditional-types + * https://stackoverflow.com/questions/50374908/transform-union-type-to-intersection-type + */ +export type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/user_data_reader.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/user_data_reader.d.ts new file mode 100644 index 0000000..821bb46 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/user_data_reader.d.ts @@ -0,0 +1,224 @@ +/** + * @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 { DocumentData, FieldPath as PublicFieldPath, SetOptions } from '@firebase/firestore-types'; +import { Compat } from '@firebase/util'; +import { ParseContext } from '../api/parse_context'; +import { DatabaseId } from '../core/database_info'; +import { DocumentKey } from '../model/document_key'; +import { FieldMask } from '../model/field_mask'; +import { FieldTransform, Mutation, Precondition } from '../model/mutation'; +import { ObjectValue } from '../model/object_value'; +import { FieldPath as InternalFieldPath } from '../model/path'; +import { MapValue as ProtoMapValue, Value as ProtoValue } from '../protos/firestore_proto_api'; +import { JsonProtoSerializer } from '../remote/serializer'; +import { FirestoreError } from '../util/error'; +import { Dict } from '../util/obj'; +import { Firestore } from './database'; +import { FieldValue } from './field_value'; +import { PartialWithFieldValue, WithFieldValue } from './reference'; +import { VectorValue } from './vector_value'; +/** + * An untyped Firestore Data Converter interface that is shared between the + * lite, firestore-exp and classic SDK. + */ +export interface UntypedFirestoreDataConverter<AppModelType, DbModelType extends DocumentData = DocumentData> { + toFirestore(modelObject: WithFieldValue<AppModelType>): WithFieldValue<DbModelType>; + toFirestore(modelObject: PartialWithFieldValue<AppModelType>, options: SetOptions): PartialWithFieldValue<DbModelType>; + fromFirestore(snapshot: unknown, options?: unknown): AppModelType; +} +/** The result of parsing document data (e.g. for a setData call). */ +export declare class ParsedSetData { + readonly data: ObjectValue; + readonly fieldMask: FieldMask | null; + readonly fieldTransforms: FieldTransform[]; + constructor(data: ObjectValue, fieldMask: FieldMask | null, fieldTransforms: FieldTransform[]); + toMutation(key: DocumentKey, precondition: Precondition): Mutation; +} +/** The result of parsing "update" data (i.e. for an updateData call). */ +export declare class ParsedUpdateData { + readonly data: ObjectValue; + readonly fieldMask: FieldMask; + readonly fieldTransforms: FieldTransform[]; + constructor(data: ObjectValue, fieldMask: FieldMask, fieldTransforms: FieldTransform[]); + toMutation(key: DocumentKey, precondition: Precondition): Mutation; +} +export declare const enum UserDataSource { + Set = 0, + Update = 1, + MergeSet = 2, + /** + * Indicates the source is a where clause, cursor bound, arrayUnion() + * element, etc. Of note, isWrite(source) will return false. + */ + Argument = 3, + /** + * Indicates that the source is an Argument that may directly contain nested + * arrays (e.g. the operand of an `in` query). + */ + ArrayArgument = 4 +} +/** Contains the settings that are mutated as we parse user data. */ +interface ContextSettings { + /** Indicates what kind of API method this data came from. */ + readonly dataSource: UserDataSource; + /** The name of the method the user called to create the ParseContext. */ + readonly methodName: string; + /** The document the user is attempting to modify, if that applies. */ + readonly targetDoc?: DocumentKey; + /** + * A path within the object being parsed. This could be an empty path (in + * which case the context represents the root of the data being parsed), or a + * nonempty path (indicating the context represents a nested location within + * the data). + */ + readonly path?: InternalFieldPath; + /** + * Whether or not this context corresponds to an element of an array. + * If not set, elements are treated as if they were outside of arrays. + */ + readonly arrayElement?: boolean; + /** + * Whether or not a converter was specified in this context. If true, error + * messages will reference the converter when invalid data is provided. + */ + readonly hasConverter?: boolean; +} +/** A "context" object passed around while parsing user data. */ +declare class ParseContextImpl implements ParseContext { + readonly settings: ContextSettings; + readonly databaseId: DatabaseId; + readonly serializer: JsonProtoSerializer; + readonly ignoreUndefinedProperties: boolean; + readonly fieldTransforms: FieldTransform[]; + readonly fieldMask: InternalFieldPath[]; + /** + * Initializes a ParseContext with the given source and path. + * + * @param settings - The settings for the parser. + * @param databaseId - The database ID of the Firestore instance. + * @param serializer - The serializer to use to generate the Value proto. + * @param ignoreUndefinedProperties - Whether to ignore undefined properties + * rather than throw. + * @param fieldTransforms - A mutable list of field transforms encountered + * while parsing the data. + * @param fieldMask - A mutable list of field paths encountered while parsing + * the data. + * + * TODO(b/34871131): We don't support array paths right now, so path can be + * null to indicate the context represents any location within an array (in + * which case certain features will not work and errors will be somewhat + * compromised). + */ + constructor(settings: ContextSettings, databaseId: DatabaseId, serializer: JsonProtoSerializer, ignoreUndefinedProperties: boolean, fieldTransforms?: FieldTransform[], fieldMask?: InternalFieldPath[]); + get path(): InternalFieldPath | undefined; + get dataSource(): UserDataSource; + /** Returns a new context with the specified settings overwritten. */ + contextWith(configuration: Partial<ContextSettings>): ParseContextImpl; + childContextForField(field: string): ParseContextImpl; + childContextForFieldPath(field: InternalFieldPath): ParseContextImpl; + childContextForArray(index: number): ParseContextImpl; + createError(reason: string): FirestoreError; + /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ + contains(fieldPath: InternalFieldPath): boolean; + private validatePath; + private validatePathSegment; +} +/** + * Helper for parsing raw user input (provided via the API) into internal model + * classes. + */ +export declare class UserDataReader { + private readonly databaseId; + private readonly ignoreUndefinedProperties; + private readonly serializer; + constructor(databaseId: DatabaseId, ignoreUndefinedProperties: boolean, serializer?: JsonProtoSerializer); + /** Creates a new top-level parse context. */ + createContext(dataSource: UserDataSource, methodName: string, targetDoc?: DocumentKey, hasConverter?: boolean): ParseContextImpl; +} +export declare function newUserDataReader(firestore: Firestore): UserDataReader; +/** Parse document data from a set() call. */ +export declare function parseSetData(userDataReader: UserDataReader, methodName: string, targetDoc: DocumentKey, input: unknown, hasConverter: boolean, options?: SetOptions): ParsedSetData; +export declare class DeleteFieldValueImpl extends FieldValue { + _toFieldTransform(context: ParseContextImpl): null; + isEqual(other: FieldValue): boolean; +} +export declare class ServerTimestampFieldValueImpl extends FieldValue { + _toFieldTransform(context: ParseContextImpl): FieldTransform; + isEqual(other: FieldValue): boolean; +} +export declare class ArrayUnionFieldValueImpl extends FieldValue { + private readonly _elements; + constructor(methodName: string, _elements: unknown[]); + _toFieldTransform(context: ParseContextImpl): FieldTransform; + isEqual(other: FieldValue): boolean; +} +export declare class ArrayRemoveFieldValueImpl extends FieldValue { + private readonly _elements; + constructor(methodName: string, _elements: unknown[]); + _toFieldTransform(context: ParseContextImpl): FieldTransform; + isEqual(other: FieldValue): boolean; +} +export declare class NumericIncrementFieldValueImpl extends FieldValue { + private readonly _operand; + constructor(methodName: string, _operand: number); + _toFieldTransform(context: ParseContextImpl): FieldTransform; + isEqual(other: FieldValue): boolean; +} +/** Parse update data from an update() call. */ +export declare function parseUpdateData(userDataReader: UserDataReader, methodName: string, targetDoc: DocumentKey, input: unknown): ParsedUpdateData; +/** Parse update data from a list of field/value arguments. */ +export declare function parseUpdateVarargs(userDataReader: UserDataReader, methodName: string, targetDoc: DocumentKey, field: string | PublicFieldPath | Compat<PublicFieldPath>, value: unknown, moreFieldsAndValues: unknown[]): ParsedUpdateData; +/** + * Parse a "query value" (e.g. value in a where filter or a value in a cursor + * bound). + * + * @param allowArrays - Whether the query value is an array that may directly + * contain additional arrays (e.g. the operand of an `in` query). + */ +export declare function parseQueryValue(userDataReader: UserDataReader, methodName: string, input: unknown, allowArrays?: boolean): ProtoValue; +/** + * Parses user data to Protobuf Values. + * + * @param input - Data to be parsed. + * @param context - A context object representing the current path being parsed, + * the source of the data being parsed, etc. + * @returns The parsed value, or null if the value was a FieldValue sentinel + * that should not be included in the resulting parsed data. + */ +export declare function parseData(input: unknown, context: ParseContextImpl): ProtoValue | null; +export declare function parseObject(obj: Dict<unknown>, context: ParseContextImpl): { + mapValue: ProtoMapValue; +}; +/** + * Creates a new VectorValue proto value (using the internal format). + */ +export declare function parseVectorValue(value: VectorValue, context: ParseContextImpl): ProtoValue; +/** + * Helper that calls fromDotSeparatedString() but wraps any error thrown. + */ +export declare function fieldPathFromArgument(methodName: string, path: string | PublicFieldPath | Compat<PublicFieldPath>, targetDoc?: DocumentKey): InternalFieldPath; +/** + * Wraps fromDotSeparatedString with an error message about the method that + * was thrown. + * @param methodName - The publicly visible method name + * @param path - The dot-separated string form of a field path which will be + * split on dots. + * @param targetDoc - The document against which the field path will be + * evaluated. + */ +export declare function fieldPathFromDotSeparatedString(methodName: string, path: string, targetDoc?: DocumentKey): InternalFieldPath; +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/user_data_writer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/user_data_writer.d.ts new file mode 100644 index 0000000..391593a --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/user_data_writer.d.ts @@ -0,0 +1,48 @@ +/** + * @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 { DocumentData } from '@firebase/firestore-types'; +import { DatabaseId } from '../core/database_info'; +import { DocumentKey } from '../model/document_key'; +import { ApiClientObjectMap, MapValue as ProtoMapValue, Value, Value as ProtoValue } from '../protos/firestore_proto_api'; +import { ByteString } from '../util/byte_string'; +import { VectorValue } from './vector_value'; +export type ServerTimestampBehavior = 'estimate' | 'previous' | 'none'; +/** + * Converts Firestore's internal types to the JavaScript types that we expose + * to the user. + * + * @internal + */ +export declare abstract class AbstractUserDataWriter { + convertValue(value: ProtoValue, serverTimestampBehavior?: ServerTimestampBehavior): unknown; + private convertObject; + /** + * @internal + */ + convertObjectMap(fields: ApiClientObjectMap<Value> | undefined, serverTimestampBehavior?: ServerTimestampBehavior): DocumentData; + /** + * @internal + */ + convertVectorValue(mapValue: ProtoMapValue): VectorValue; + private convertGeoPoint; + private convertArray; + private convertServerTimestamp; + private convertTimestamp; + protected convertDocumentKey(name: string, expectedDatabaseId: DatabaseId): DocumentKey; + protected abstract convertReference(name: string): unknown; + protected abstract convertBytes(bytes: ByteString): unknown; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/vector_value.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/vector_value.d.ts new file mode 100644 index 0000000..b4808e0 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/vector_value.d.ts @@ -0,0 +1,58 @@ +/** + * @license + * Copyright 2024 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 { Property } from '../util/json_validation'; +/** + * Represents a vector type in Firestore documents. + * Create an instance with <code>{@link vector}</code>. + * + * @class VectorValue + */ +export declare class VectorValue { + private readonly _values; + /** + * @private + * @internal + */ + constructor(values: number[] | undefined); + /** + * Returns a copy of the raw number array form of the vector. + */ + toArray(): number[]; + /** + * Returns `true` if the two `VectorValue` values have the same raw number arrays, returns `false` otherwise. + */ + isEqual(other: VectorValue): boolean; + static _jsonSchemaVersion: string; + static _jsonSchema: { + type: Property<"string">; + vectorValues: Property<"object">; + }; + /** + * Returns a JSON-serializable representation of this `VectorValue` instance. + * + * @returns a JSON representation of this object. + */ + toJSON(): object; + /** + * Builds a `VectorValue` instance from a JSON object created by {@link VectorValue.toJSON}. + * + * @param json a JSON object represention of a `VectorValue` instance. + * @returns an instance of {@link VectorValue} if the JSON object could be parsed. Throws a + * {@link FirestoreError} if an error occurs. + */ + static fromJSON(json: object): VectorValue; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/write_batch.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/write_batch.d.ts new file mode 100644 index 0000000..4835feb --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/lite-api/write_batch.d.ts @@ -0,0 +1,125 @@ +/** + * @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 { Compat } from '@firebase/util'; +import { Mutation } from '../model/mutation'; +import { Firestore } from './database'; +import { FieldPath } from './field_path'; +import { DocumentData, DocumentReference, PartialWithFieldValue, SetOptions, UpdateData, WithFieldValue } from './reference'; +/** + * A write batch, used to perform multiple writes as a single atomic unit. + * + * A `WriteBatch` object can be acquired by calling {@link writeBatch}. It + * provides methods for adding writes to the write batch. None of the writes + * will be committed (or visible locally) until {@link WriteBatch.commit} is + * called. + */ +export declare class WriteBatch { + private readonly _firestore; + private readonly _commitHandler; + private readonly _dataReader; + private _mutations; + private _committed; + /** @hideconstructor */ + constructor(_firestore: Firestore, _commitHandler: (m: Mutation[]) => Promise<void>); + /** + * Writes to the document referred to by the provided {@link + * DocumentReference}. If the document does not exist yet, it will be created. + * + * @param documentRef - A reference to the document to be set. + * @param data - An object of the fields and values for the document. + * @returns This `WriteBatch` instance. Used for chaining method calls. + */ + set<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>, data: WithFieldValue<AppModelType>): WriteBatch; + /** + * Writes to the document referred to by the provided {@link + * DocumentReference}. If the document does not exist yet, it will be created. + * If you provide `merge` or `mergeFields`, the provided data can be merged + * into an existing document. + * + * @param documentRef - A reference to the document to be set. + * @param data - An object of the fields and values for the document. + * @param options - An object to configure the set behavior. + * @throws Error - If the provided input is not a valid Firestore document. + * @returns This `WriteBatch` instance. Used for chaining method calls. + */ + set<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>, data: PartialWithFieldValue<AppModelType>, options: SetOptions): WriteBatch; + /** + * Updates fields in the document referred to by the provided {@link + * DocumentReference}. The update will fail if applied to a document that does + * not exist. + * + * @param documentRef - A reference to the document to be updated. + * @param data - An object containing the fields and values with which to + * update the document. Fields can contain dots to reference nested fields + * within the document. + * @throws Error - If the provided input is not valid Firestore data. + * @returns This `WriteBatch` instance. Used for chaining method calls. + */ + update<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>, data: UpdateData<DbModelType>): WriteBatch; + /** + * Updates fields in the document referred to by this {@link + * DocumentReference}. The update will fail if applied to a document that does + * not exist. + * + * Nested fields can be update by providing dot-separated field path strings + * or by providing `FieldPath` objects. + * + * @param documentRef - A reference to the document to be updated. + * @param field - The first field to update. + * @param value - The first value. + * @param moreFieldsAndValues - Additional key value pairs. + * @throws Error - If the provided input is not valid Firestore data. + * @returns This `WriteBatch` instance. Used for chaining method calls. + */ + update<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): WriteBatch; + /** + * Deletes the document referred to by the provided {@link DocumentReference}. + * + * @param documentRef - A reference to the document to be deleted. + * @returns This `WriteBatch` instance. Used for chaining method calls. + */ + delete<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType>): WriteBatch; + /** + * Commits all of the writes in this write batch as a single atomic unit. + * + * The result of these writes will only be reflected in document reads that + * occur after the returned promise resolves. If the client is offline, the + * write fails. If you would like to see local modifications or buffer writes + * until the client is online, use the full Firestore SDK. + * + * @returns A `Promise` resolved once all of the writes in the batch have been + * successfully written to the backend as an atomic unit (note that it won't + * resolve while you're offline). + */ + commit(): Promise<void>; + private _verifyNotCommitted; +} +export declare function validateReference<AppModelType, DbModelType extends DocumentData>(documentRef: DocumentReference<AppModelType, DbModelType> | Compat<DocumentReference<AppModelType, DbModelType>>, firestore: Firestore): DocumentReference<AppModelType, DbModelType>; +/** + * Creates a write batch, used for performing multiple writes as a single + * atomic operation. The maximum number of writes allowed in a single WriteBatch + * is 500. + * + * The result of these writes will only be reflected in document reads that + * occur after the returned promise resolves. If the client is offline, the + * write fails. If you would like to see local modifications or buffer writes + * until the client is online, use the full Firestore SDK. + * + * @returns A `WriteBatch` that can be used to atomically execute multiple + * writes. + */ +export declare function writeBatch(firestore: Firestore): WriteBatch; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/bundle_cache.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/bundle_cache.d.ts new file mode 100644 index 0000000..2949e55 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/bundle_cache.d.ts @@ -0,0 +1,44 @@ +/** + * @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 { BundleMetadata, NamedQuery } from '../core/bundle'; +import { NamedQuery as ProtoNamedQuery, BundleMetadata as ProtoBundleMetadata } from '../protos/firestore_bundle_proto'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +/** + * Provides interfaces to save and read Firestore bundles. + */ +export interface BundleCache { + /** + * Gets the saved `BundleMetadata` for a given `bundleId`, returns undefined + * if no bundle metadata is found under the given id. + */ + getBundleMetadata(transaction: PersistenceTransaction, bundleId: string): PersistencePromise<BundleMetadata | undefined>; + /** + * Saves a `BundleMetadata` from a bundle into local storage, using its id as + * the persistent key. + */ + saveBundleMetadata(transaction: PersistenceTransaction, metadata: ProtoBundleMetadata): PersistencePromise<void>; + /** + * Gets a saved `NamedQuery` for the given query name. Returns undefined if + * no queries are found under the given name. + */ + getNamedQuery(transaction: PersistenceTransaction, queryName: string): PersistencePromise<NamedQuery | undefined>; + /** + * Saves a `NamedQuery` from a bundle, using its name as the persistent key. + */ + saveNamedQuery(transaction: PersistenceTransaction, query: ProtoNamedQuery): PersistencePromise<void>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/document_overlay_cache.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/document_overlay_cache.d.ts new file mode 100644 index 0000000..e1f1f2a --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/document_overlay_cache.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 { DocumentKeySet, MutationMap, OverlayMap } from '../model/collections'; +import { DocumentKey } from '../model/document_key'; +import { Overlay } from '../model/overlay'; +import { ResourcePath } from '../model/path'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +/** + * Provides methods to read and write document overlays. + * + * An overlay is a saved mutation, that gives a local view of a document when + * applied to the remote version of the document. + * + * Each overlay stores the largest batch ID that is included in the overlay, + * which allows us to remove the overlay once all batches leading up to it have + * been acknowledged. + */ +export interface DocumentOverlayCache { + /** + * Gets the saved overlay mutation for the given document key. + * Returns null if there is no overlay for that key. + */ + getOverlay(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<Overlay | null>; + /** + * Gets the saved overlay mutation for the given document keys. Skips keys for + * which there are no overlays. + */ + getOverlays(transaction: PersistenceTransaction, keys: DocumentKey[]): PersistencePromise<OverlayMap>; + /** + * Saves the given document mutation map to persistence as overlays. + * All overlays will have their largest batch id set to `largestBatchId`. + */ + saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: MutationMap): PersistencePromise<void>; + /** Removes overlays for the given document keys and batch ID. */ + removeOverlaysForBatchId(transaction: PersistenceTransaction, documentKeys: DocumentKeySet, batchId: number): PersistencePromise<void>; + /** + * Returns all saved overlays for the given collection. + * + * @param transaction - The persistence transaction to use for this operation. + * @param collection - The collection path to get the overlays for. + * @param sinceBatchId - The minimum batch ID to filter by (exclusive). + * Only overlays that contain a change past `sinceBatchId` are returned. + * @returns Mapping of each document key in the collection to its overlay. + */ + getOverlaysForCollection(transaction: PersistenceTransaction, collection: ResourcePath, sinceBatchId: number): PersistencePromise<OverlayMap>; + /** + * Returns `count` overlays with a batch ID higher than `sinceBatchId` for the + * provided collection group, processed by ascending batch ID. The method + * always returns all overlays for a batch even if the last batch contains + * more documents than the remaining limit. + * + * @param transaction - The persistence transaction used for this operation. + * @param collectionGroup - The collection group to get the overlays for. + * @param sinceBatchId - The minimum batch ID to filter by (exclusive). + * Only overlays that contain a change past `sinceBatchId` are returned. + * @param count - The number of overlays to return. Can be exceeded if the last + * batch contains more entries. + * @return Mapping of each document key in the collection group to its overlay. + */ + getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<OverlayMap>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/encoded_resource_path.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/encoded_resource_path.d.ts new file mode 100644 index 0000000..73353db --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/encoded_resource_path.d.ts @@ -0,0 +1,73 @@ +/** + * @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 '../model/path'; +/** + * Helpers for dealing with resource paths stored in IndexedDB. + * + * Resource paths in their canonical string form do not sort as the server + * sorts them. Specifically the server splits paths into segments first and then + * sorts, putting end-of-segment before any character. In a UTF-8 string + * encoding the slash ('/') that denotes the end-of-segment naturally comes + * after other characters so the intent here is to encode the path delimiters in + * such a way that the resulting strings sort naturally. + * + * Resource paths are also used for prefix scans so it's important to + * distinguish whole segments from any longer segments of which they might be a + * prefix. For example, it's important to make it possible to scan documents in + * a collection "foo" without encountering documents in a collection "foobar". + * + * Separate from the concerns about resource path ordering and separation, + * On Android, SQLite imposes additional restrictions since it does not handle + * keys with embedded NUL bytes particularly well. Rather than change the + * implementation we keep the encoding identical to keep the ports similar. + * + * Taken together this means resource paths when encoded for storage in + * IndexedDB have the following characteristics: + * + * * Segment separators ("/") sort before everything else. + * * All paths have a trailing separator. + * * NUL bytes do not exist in the output, since IndexedDB doesn't treat them + * well. + * + * Therefore resource paths are encoded into string form using the following + * rules: + * + * * '\x01' is used as an escape character. + * * Path separators are encoded as "\x01\x01" + * * NUL bytes are encoded as "\x01\x10" + * * '\x01' is encoded as "\x01\x11" + * + * This encoding leaves some room between path separators and the NUL byte + * just in case we decide to support integer document ids after all. + * + * Note that characters treated specially by the backend ('.', '/', and '~') + * are not treated specially here. This class assumes that any unescaping of + * resource path strings into actual ResourcePath objects will handle these + * characters there. + */ +export type EncodedResourcePath = string; +/** + * Encodes a resource path into a IndexedDb-compatible string form. + */ +export declare function encodeResourcePath(path: ResourcePath): EncodedResourcePath; +/** + * Decodes the given IndexedDb-compatible string form of a resource path into + * a ResourcePath instance. Note that this method is not suitable for use with + * decoding resource names from the server; those are One Platform format + * strings. + */ +export declare function decodeResourcePath(path: EncodedResourcePath): ResourcePath; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/globals_cache.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/globals_cache.d.ts new file mode 100644 index 0000000..a2a7ff6 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/globals_cache.d.ts @@ -0,0 +1,39 @@ +/** + * @license + * Copyright 2024 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 { ByteString } from '../util/byte_string'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +/** + * General purpose cache for global values. + * + * Global state that cuts across components should be saved here. Following are contained herein: + * + * `sessionToken` tracks server interaction across Listen and Write streams. This facilitates cache + * synchronization and invalidation. + */ +export interface GlobalsCache { + /** + * Gets session token. + */ + getSessionToken(transaction: PersistenceTransaction): PersistencePromise<ByteString>; + /** + * Sets session token. + * + * @param sessionToken - The new session token. + */ + setSessionToken(transaction: PersistenceTransaction, sessionToken: ByteString): PersistencePromise<void>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/index_backfiller.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/index_backfiller.d.ts new file mode 100644 index 0000000..2abeb5f --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/index_backfiller.d.ts @@ -0,0 +1,44 @@ +import { AsyncQueue } from '../util/async_queue'; +import { LocalStore } from './local_store'; +import { Persistence, Scheduler } from './persistence'; +/** This class is responsible for the scheduling of Index Backfiller. */ +export declare class IndexBackfillerScheduler implements Scheduler { + private readonly asyncQueue; + private readonly backfiller; + private task; + constructor(asyncQueue: AsyncQueue, backfiller: IndexBackfiller); + start(): void; + stop(): void; + get started(): boolean; + private schedule; +} +/** Implements the steps for backfilling indexes. */ +export declare class IndexBackfiller { + /** + * LocalStore provides access to IndexManager and LocalDocumentView. + * These properties will update when the user changes. Consequently, + * making a local copy of IndexManager and LocalDocumentView will require + * updates over time. The simpler solution is to rely on LocalStore to have + * an up-to-date references to IndexManager and LocalDocumentStore. + */ + private readonly localStore; + private readonly persistence; + constructor( + /** + * LocalStore provides access to IndexManager and LocalDocumentView. + * These properties will update when the user changes. Consequently, + * making a local copy of IndexManager and LocalDocumentView will require + * updates over time. The simpler solution is to rely on LocalStore to have + * an up-to-date references to IndexManager and LocalDocumentStore. + */ + localStore: LocalStore, persistence: Persistence); + backfill(maxDocumentsToProcess?: number): Promise<number>; + /** Writes index entries until the cap is reached. Returns the number of documents processed. */ + private writeIndexEntries; + /** + * Writes entries for the provided collection group. Returns the number of documents processed. + */ + private writeEntriesForCollectionGroup; + /** Returns the next offset based on the provided documents. */ + private getNewOffset; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/index_manager.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/index_manager.d.ts new file mode 100644 index 0000000..6a02ffc --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/index_manager.d.ts @@ -0,0 +1,124 @@ +/** + * @license + * Copyright 2019 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 { DocumentMap } from '../model/collections'; +import { DocumentKey } from '../model/document_key'; +import { FieldIndex, IndexOffset } from '../model/field_index'; +import { ResourcePath } from '../model/path'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +/** Represents the index state as it relates to a particular target. */ +export declare const enum IndexType { + /** Indicates that no index could be found for serving the target. */ + NONE = 0, + /** + * Indicates that only a "partial index" could be found for serving the + * target. A partial index is one which does not have a segment for every + * filter/orderBy in the target. + */ + PARTIAL = 1, + /** + * Indicates that a "full index" could be found for serving the target. A full + * index is one which has a segment for every filter/orderBy in the target. + */ + FULL = 2 +} +export declare function displayNameForIndexType(indexType: IndexType): string; +/** + * Represents a set of indexes that are used to execute queries efficiently. + * + * Currently the only index is a [collection id] => [parent path] index, used + * to execute Collection Group queries. + */ +export interface IndexManager { + /** + * Creates an index entry mapping the collectionId (last segment of the path) + * to the parent path (either the containing document location or the empty + * path for root-level collections). Index entries can be retrieved via + * getCollectionParents(). + * + * NOTE: Currently we don't remove index entries. If this ends up being an + * issue we can devise some sort of GC strategy. + */ + addToCollectionParentIndex(transaction: PersistenceTransaction, collectionPath: ResourcePath): PersistencePromise<void>; + /** + * Retrieves all parent locations containing the given collectionId, as a + * list of paths (each path being either a document location or the empty + * path for a root-level collection). + */ + getCollectionParents(transaction: PersistenceTransaction, collectionId: string): PersistencePromise<ResourcePath[]>; + /** + * Adds a field path index. + * + * Values for this index are persisted via the index backfill, which runs + * asynchronously in the background. Once the first values are written, + * an index can be used to serve partial results for any matching queries. + * Any unindexed portion of the database will continue to be served via + * collection scons. + */ + addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>; + /** Removes the given field index and deletes all index values. */ + deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>; + /** Removes all field indexes and deletes all index values. */ + deleteAllFieldIndexes(transaction: PersistenceTransaction): PersistencePromise<void>; + /** Creates a full matched field index which serves the given target. */ + createTargetIndexes(transaction: PersistenceTransaction, target: Target): PersistencePromise<void>; + /** + * Returns a list of field indexes that correspond to the specified collection + * group. + * + * @param collectionGroup The collection group to get matching field indexes + * for. + * @return A collection of field indexes for the specified collection group. + */ + getFieldIndexes(transaction: PersistenceTransaction, collectionGroup: string): PersistencePromise<FieldIndex[]>; + /** Returns all configured field indexes. */ + getFieldIndexes(transaction: PersistenceTransaction): PersistencePromise<FieldIndex[]>; + /** + * Returns the type of index (if any) that can be used to serve the given + * target. + */ + getIndexType(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexType>; + /** + * Returns the documents that match the given target based on the provided + * index or `null` if the target does not have a matching index. + */ + getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKey[] | null>; + /** + * Returns the next collection group to update. Returns `null` if no group + * exists. + */ + getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>; + /** + * Sets the collection group's latest read time. + * + * This method updates the index offset for all field indices for the + * collection group and increments their sequence number. Subsequent calls to + * `getNextCollectionGroupToUpdate()` will return a different collection group + * (unless only one collection group is configured). + */ + updateCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset): PersistencePromise<void>; + /** Updates the index entries for the provided documents. */ + updateIndexEntries(transaction: PersistenceTransaction, documents: DocumentMap): PersistencePromise<void>; + /** + * Iterates over all field indexes that are used to serve the given target, + * and returns the minimum offset of them all. + */ + getMinOffset(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexOffset>; + /** Returns the minimum offset for the given collection group. */ + getMinOffsetFromCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string): PersistencePromise<IndexOffset>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_bundle_cache.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_bundle_cache.d.ts new file mode 100644 index 0000000..60f49fc --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_bundle_cache.d.ts @@ -0,0 +1,27 @@ +/** + * @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 { BundleMetadata, NamedQuery } from '../core/bundle'; +import { BundleMetadata as ProtoBundleMetadata, NamedQuery as ProtoNamedQuery } from '../protos/firestore_bundle_proto'; +import { BundleCache } from './bundle_cache'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +export declare class IndexedDbBundleCache implements BundleCache { + getBundleMetadata(transaction: PersistenceTransaction, bundleId: string): PersistencePromise<BundleMetadata | undefined>; + saveBundleMetadata(transaction: PersistenceTransaction, bundleMetadata: ProtoBundleMetadata): PersistencePromise<void>; + getNamedQuery(transaction: PersistenceTransaction, queryName: string): PersistencePromise<NamedQuery | undefined>; + saveNamedQuery(transaction: PersistenceTransaction, query: ProtoNamedQuery): PersistencePromise<void>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts new file mode 100644 index 0000000..eda11b2 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts @@ -0,0 +1,45 @@ +/** + * @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 { User } from '../auth/user'; +import { DocumentKeySet, MutationMap, OverlayMap } from '../model/collections'; +import { DocumentKey } from '../model/document_key'; +import { Overlay } from '../model/overlay'; +import { ResourcePath } from '../model/path'; +import { DocumentOverlayCache } from './document_overlay_cache'; +import { LocalSerializer } from './local_serializer'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +/** + * Implementation of DocumentOverlayCache using IndexedDb. + */ +export declare class IndexedDbDocumentOverlayCache implements DocumentOverlayCache { + private readonly serializer; + private readonly userId; + /** + * @param serializer - The document serializer. + * @param userId - The userId for which we are accessing overlays. + */ + constructor(serializer: LocalSerializer, userId: string); + static forUser(serializer: LocalSerializer, user: User): IndexedDbDocumentOverlayCache; + getOverlay(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<Overlay | null>; + getOverlays(transaction: PersistenceTransaction, keys: DocumentKey[]): PersistencePromise<OverlayMap>; + saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: MutationMap): PersistencePromise<void>; + removeOverlaysForBatchId(transaction: PersistenceTransaction, documentKeys: DocumentKeySet, batchId: number): PersistencePromise<void>; + getOverlaysForCollection(transaction: PersistenceTransaction, collection: ResourcePath, sinceBatchId: number): PersistencePromise<OverlayMap>; + getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<OverlayMap>; + private saveOverlay; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_globals_cache.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_globals_cache.d.ts new file mode 100644 index 0000000..2f550f5 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_globals_cache.d.ts @@ -0,0 +1,25 @@ +/** + * @license + * Copyright 2024 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 { ByteString } from '../util/byte_string'; +import { GlobalsCache } from './globals_cache'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +export declare class IndexedDbGlobalsCache implements GlobalsCache { + private globalsStore; + getSessionToken(txn: PersistenceTransaction): PersistencePromise<ByteString>; + setSessionToken(txn: PersistenceTransaction, sessionToken: ByteString): PersistencePromise<void>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_index_manager.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_index_manager.d.ts new file mode 100644 index 0000000..8078d1c --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_index_manager.d.ts @@ -0,0 +1,136 @@ +/** + * @license + * Copyright 2019 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 { User } from '../auth/user'; +import { DatabaseId } from '../core/database_info'; +import { Target } from '../core/target'; +import { IndexEntry } from '../index/index_entry'; +import { DocumentMap } from '../model/collections'; +import { DocumentKey } from '../model/document_key'; +import { FieldIndex, IndexOffset } from '../model/field_index'; +import { ResourcePath } from '../model/path'; +import { IndexManager, IndexType } from './index_manager'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +/** + * A persisted implementation of IndexManager. + * + * PORTING NOTE: Unlike iOS and Android, the Web SDK does not memoize index + * data as it supports multi-tab access. + */ +export declare class IndexedDbIndexManager implements IndexManager { + private readonly databaseId; + /** + * An in-memory copy of the index entries we've already written since the SDK + * launched. Used to avoid re-writing the same entry repeatedly. + * + * This is *NOT* a complete cache of what's in persistence and so can never be + * used to satisfy reads. + */ + private collectionParentsCache; + private readonly uid; + /** + * Maps from a target to its equivalent list of sub-targets. Each sub-target + * contains only one term from the target's disjunctive normal form (DNF). + */ + private targetToDnfSubTargets; + constructor(user: User, databaseId: DatabaseId); + /** + * Adds a new entry to the collection parent index. + * + * Repeated calls for the same collectionPath should be avoided within a + * transaction as IndexedDbIndexManager only caches writes once a transaction + * has been committed. + */ + addToCollectionParentIndex(transaction: PersistenceTransaction, collectionPath: ResourcePath): PersistencePromise<void>; + getCollectionParents(transaction: PersistenceTransaction, collectionId: string): PersistencePromise<ResourcePath[]>; + addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>; + deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>; + deleteAllFieldIndexes(transaction: PersistenceTransaction): PersistencePromise<void>; + createTargetIndexes(transaction: PersistenceTransaction, target: Target): PersistencePromise<void>; + getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKey[] | null>; + private getSubTargets; + /** + * Constructs a key range query on `DbIndexEntryStore` that unions all + * bounds. + */ + private generateIndexRanges; + /** Generates the lower bound for `arrayValue` and `directionalValue`. */ + private generateLowerBound; + /** Generates the upper bound for `arrayValue` and `directionalValue`. */ + private generateUpperBound; + private getFieldIndex; + getIndexType(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexType>; + /** + * Returns the byte encoded form of the directional values in the field index. + * Returns `null` if the document does not have all fields specified in the + * index. + */ + private encodeDirectionalElements; + /** Encodes a single value to the ascending index format. */ + private encodeSingleElement; + /** + * Returns an encoded form of the document key that sorts based on the key + * ordering of the field index. + */ + private encodeDirectionalKey; + /** + * Encodes the given field values according to the specification in `target`. + * For IN queries, a list of possible values is returned. + */ + private encodeValues; + /** + * Encodes the given bounds according to the specification in `target`. For IN + * queries, a list of possible values is returned. + */ + private encodeBound; + /** Returns the byte representation for the provided encoders. */ + private getEncodedBytes; + /** + * Creates a separate encoder for each element of an array. + * + * The method appends each value to all existing encoders (e.g. filter("a", + * "==", "a1").filter("b", "in", ["b1", "b2"]) becomes ["a1,b1", "a1,b2"]). A + * list of new encoders is returned. + */ + private expandIndexValues; + private isInFilter; + getFieldIndexes(transaction: PersistenceTransaction, collectionGroup?: string): PersistencePromise<FieldIndex[]>; + getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>; + updateCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset): PersistencePromise<void>; + updateIndexEntries(transaction: PersistenceTransaction, documents: DocumentMap): PersistencePromise<void>; + private addIndexEntry; + private deleteIndexEntry; + private getExistingIndexEntries; + /** Creates the index entries for the given document. */ + private computeIndexEntries; + /** + * Updates the index entries for the provided document by deleting entries + * that are no longer referenced in `newEntries` and adding all newly added + * entries. + */ + private updateEntries; + private getNextSequenceNumber; + /** + * Returns a new set of IDB ranges that splits the existing range and excludes + * any values that match the `notInValue` from these ranges. As an example, + * '[foo > 2 && foo != 3]` becomes `[foo > 2 && < 3, foo > 3]`. + */ + private createRange; + isRangeMatchable(lowerBound: IndexEntry, upperBound: IndexEntry): boolean; + getMinOffsetFromCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string): PersistencePromise<IndexOffset>; + getMinOffset(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexOffset>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_lru_delegate.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_lru_delegate.d.ts new file mode 100644 index 0000000..fea8087 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_lru_delegate.d.ts @@ -0,0 +1,22 @@ +/** + * @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 { LruDelegate, LruGarbageCollector } from './lru_garbage_collector'; +import { ReferenceDelegate } from './persistence'; +/** Provides LRU functionality for IndexedDB persistence. */ +export interface IndexedDbLruDelegate extends ReferenceDelegate, LruDelegate { + readonly garbageCollector: LruGarbageCollector; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_lru_delegate_impl.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_lru_delegate_impl.d.ts new file mode 100644 index 0000000..56e5e6b --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_lru_delegate_impl.d.ts @@ -0,0 +1,56 @@ +/** + * @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 { ListenSequenceNumber, TargetId } from '../core/types'; +import { DocumentKey } from '../model/document_key'; +import { IndexedDbLruDelegate } from './indexeddb_lru_delegate'; +import { ActiveTargets, LruGarbageCollector, LruParams } from './lru_garbage_collector'; +import { Persistence } from './persistence'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +import { TargetData } from './target_data'; +/** Provides LRU functionality for IndexedDB persistence. */ +export declare class IndexedDbLruDelegateImpl implements IndexedDbLruDelegate { + private readonly db; + readonly garbageCollector: LruGarbageCollector; + constructor(db: Persistence, params: LruParams); + getSequenceNumberCount(txn: PersistenceTransaction): PersistencePromise<number>; + private orphanedDocumentCount; + forEachTarget(txn: PersistenceTransaction, f: (q: TargetData) => void): PersistencePromise<void>; + forEachOrphanedDocumentSequenceNumber(txn: PersistenceTransaction, f: (sequenceNumber: ListenSequenceNumber) => void): PersistencePromise<void>; + addReference(txn: PersistenceTransaction, targetId: TargetId, key: DocumentKey): PersistencePromise<void>; + removeReference(txn: PersistenceTransaction, targetId: TargetId, key: DocumentKey): PersistencePromise<void>; + removeTargets(txn: PersistenceTransaction, upperBound: ListenSequenceNumber, activeTargetIds: ActiveTargets): PersistencePromise<number>; + markPotentiallyOrphaned(txn: PersistenceTransaction, key: DocumentKey): PersistencePromise<void>; + /** + * Returns true if anything would prevent this document from being garbage + * collected, given that the document in question is not present in any + * targets and has a sequence number less than or equal to the upper bound for + * the collection run. + */ + private isPinned; + removeOrphanedDocuments(txn: PersistenceTransaction, upperBound: ListenSequenceNumber): PersistencePromise<number>; + removeTarget(txn: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + updateLimboDocument(txn: PersistenceTransaction, key: DocumentKey): PersistencePromise<void>; + /** + * Call provided function for each document in the cache that is 'orphaned'. Orphaned + * means not a part of any target, so the only entry in the target-document index for + * that document will be the sentinel row (targetId 0), which will also have the sequence + * number for the last time the document was accessed. + */ + private forEachOrphanedDocument; + getCacheSize(txn: PersistenceTransaction): PersistencePromise<number>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_mutation_batch_impl.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_mutation_batch_impl.d.ts new file mode 100644 index 0000000..b4f0ac4 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_mutation_batch_impl.d.ts @@ -0,0 +1,35 @@ +/** + * @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 { DocumentKey } from '../model/document_key'; +import { DbRemoteDocument } from './indexeddb_schema'; +import { DbRemoteDocument as DbRemoteDocumentLegacy } from './indexeddb_schema_legacy'; +import { PersistencePromise } from './persistence_promise'; +import { SimpleDbTransaction } from './simple_db'; +/** + * Delete a mutation batch and the associated document mutations. + * @returns A PersistencePromise of the document mutations that were removed. + */ +export declare function removeMutationBatch(txn: SimpleDbTransaction, userId: string, batch: { + batchId: number; + mutations: Array<{ + key: DocumentKey; + }>; +}): PersistencePromise<DocumentKey[]>; +/** + * Returns an approximate size for the given document. + */ +export declare function dbDocumentSize(doc: DbRemoteDocument | DbRemoteDocumentLegacy | null): number; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_mutation_queue.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_mutation_queue.d.ts new file mode 100644 index 0000000..ad62a1d --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_mutation_queue.d.ts @@ -0,0 +1,99 @@ +/** + * @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 { User } from '../auth/user'; +import { Query } from '../core/query'; +import { BatchId } from '../core/types'; +import { Timestamp } from '../lite-api/timestamp'; +import { DocumentKeySet } from '../model/collections'; +import { DocumentKey } from '../model/document_key'; +import { Mutation } from '../model/mutation'; +import { MutationBatch } from '../model/mutation_batch'; +import { SortedMap } from '../util/sorted_map'; +import { IndexManager } from './index_manager'; +import { LocalSerializer } from './local_serializer'; +import { MutationQueue } from './mutation_queue'; +import { ReferenceDelegate } from './persistence'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +/** A mutation queue for a specific user, backed by IndexedDB. */ +export declare class IndexedDbMutationQueue implements MutationQueue { + /** + * The normalized userId (e.g. null UID => "" userId) used to store / + * retrieve mutations. + */ + private userId; + private readonly serializer; + private readonly indexManager; + private readonly referenceDelegate; + /** + * Caches the document keys for pending mutation batches. If the mutation + * has been removed from IndexedDb, the cached value may continue to + * be used to retrieve the batch's document keys. To remove a cached value + * locally, `removeCachedMutationKeys()` should be invoked either directly + * or through `removeMutationBatches()`. + * + * With multi-tab, when the primary client acknowledges or rejects a mutation, + * this cache is used by secondary clients to invalidate the local + * view of the documents that were previously affected by the mutation. + */ + private documentKeysByBatchId; + constructor( + /** + * The normalized userId (e.g. null UID => "" userId) used to store / + * retrieve mutations. + */ + userId: string, serializer: LocalSerializer, indexManager: IndexManager, referenceDelegate: ReferenceDelegate); + /** + * Creates a new mutation queue for the given user. + * @param user - The user for which to create a mutation queue. + * @param serializer - The serializer to use when persisting to IndexedDb. + */ + static forUser(user: User, serializer: LocalSerializer, indexManager: IndexManager, referenceDelegate: ReferenceDelegate): IndexedDbMutationQueue; + checkEmpty(transaction: PersistenceTransaction): PersistencePromise<boolean>; + addMutationBatch(transaction: PersistenceTransaction, localWriteTime: Timestamp, baseMutations: Mutation[], mutations: Mutation[]): PersistencePromise<MutationBatch>; + lookupMutationBatch(transaction: PersistenceTransaction, batchId: BatchId): PersistencePromise<MutationBatch | null>; + /** + * Returns the document keys for the mutation batch with the given batchId. + * For primary clients, this method returns `null` after + * `removeMutationBatches()` has been called. Secondary clients return a + * cached result until `removeCachedMutationKeys()` is invoked. + */ + lookupMutationKeys(transaction: PersistenceTransaction, batchId: BatchId): PersistencePromise<DocumentKeySet | null>; + getNextMutationBatchAfterBatchId(transaction: PersistenceTransaction, batchId: BatchId): PersistencePromise<MutationBatch | null>; + getHighestUnacknowledgedBatchId(transaction: PersistenceTransaction): PersistencePromise<BatchId>; + getAllMutationBatches(transaction: PersistenceTransaction): PersistencePromise<MutationBatch[]>; + getAllMutationBatchesAffectingDocumentKey(transaction: PersistenceTransaction, documentKey: DocumentKey): PersistencePromise<MutationBatch[]>; + getAllMutationBatchesAffectingDocumentKeys(transaction: PersistenceTransaction, documentKeys: SortedMap<DocumentKey, unknown>): PersistencePromise<MutationBatch[]>; + getAllMutationBatchesAffectingQuery(transaction: PersistenceTransaction, query: Query): PersistencePromise<MutationBatch[]>; + private lookupMutationBatches; + removeMutationBatch(transaction: PersistenceTransaction, batch: MutationBatch): PersistencePromise<void>; + /** + * Clears the cached keys for a mutation batch. This method should be + * called by secondary clients after they process mutation updates. + * + * Note that this method does not have to be called from primary clients as + * the corresponding cache entries are cleared when an acknowledged or + * rejected batch is removed from the mutation queue. + */ + removeCachedMutationKeys(batchId: BatchId): void; + performConsistencyCheck(txn: PersistenceTransaction): PersistencePromise<void>; + containsKey(txn: PersistenceTransaction, key: DocumentKey): PersistencePromise<boolean>; + /** Returns the mutation queue's metadata from IndexedDb. */ + private getMutationQueueMetadata; +} +/** Returns true if any mutation queue contains the given document. */ +export declare function mutationQueuesContainKey(txn: PersistenceTransaction, docKey: DocumentKey): PersistencePromise<boolean>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_persistence.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_persistence.d.ts new file mode 100644 index 0000000..f4cf7d8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_persistence.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 { User } from '../auth/user'; +import { DatabaseId } from '../core/database_info'; +import { SequenceNumberSyncer } from '../core/listen_sequence'; +import { JsonProtoSerializer } from '../remote/serializer'; +import { AsyncQueue } from '../util/async_queue'; +import { DocumentLike, WindowLike } from '../util/types'; +import { BundleCache } from './bundle_cache'; +import { DocumentOverlayCache } from './document_overlay_cache'; +import { GlobalsCache } from './globals_cache'; +import { IndexManager } from './index_manager'; +import { IndexedDbLruDelegateImpl } from './indexeddb_lru_delegate_impl'; +import { IndexedDbMutationQueue } from './indexeddb_mutation_queue'; +import { IndexedDbRemoteDocumentCache } from './indexeddb_remote_document_cache'; +import { IndexedDbTargetCache } from './indexeddb_target_cache'; +import { LruParams } from './lru_garbage_collector'; +import { Persistence, PrimaryStateListener } from './persistence'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction, PersistenceTransactionMode } from './persistence_transaction'; +import { ClientId } from './shared_client_state'; +/** + * The name of the main (and currently only) IndexedDB database. This name is + * appended to the prefix provided to the IndexedDbPersistence constructor. + */ +export declare const MAIN_DATABASE = "main"; +/** + * An IndexedDB-backed instance of Persistence. Data is stored persistently + * across sessions. + * + * On Web only, the Firestore SDKs support shared access to its persistence + * layer. This allows multiple browser tabs to read and write to IndexedDb and + * to synchronize state even without network connectivity. Shared access is + * currently optional and not enabled unless all clients invoke + * `enablePersistence()` with `{synchronizeTabs:true}`. + * + * In multi-tab mode, if multiple clients are active at the same time, the SDK + * will designate one client as the "primary client". An effort is made to pick + * a visible, network-connected and active client, and this client is + * responsible for letting other clients know about its presence. The primary + * client writes a unique client-generated identifier (the client ID) to + * IndexedDb’s "owner" store every 4 seconds. If the primary client fails to + * update this entry, another client can acquire the lease and take over as + * primary. + * + * Some persistence operations in the SDK are designated as primary-client only + * operations. This includes the acknowledgment of mutations and all updates of + * remote documents. The effects of these operations are written to persistence + * and then broadcast to other tabs via LocalStorage (see + * `WebStorageSharedClientState`), which then refresh their state from + * persistence. + * + * Similarly, the primary client listens to notifications sent by secondary + * clients to discover persistence changes written by secondary clients, such as + * the addition of new mutations and query targets. + * + * If multi-tab is not enabled and another tab already obtained the primary + * lease, IndexedDbPersistence enters a failed state and all subsequent + * operations will automatically fail. + * + * Additionally, there is an optimization so that when a tab is closed, the + * primary lease is released immediately (this is especially important to make + * sure that a refreshed tab is able to immediately re-acquire the primary + * lease). Unfortunately, IndexedDB cannot be reliably used in window.unload + * since it is an asynchronous API. So in addition to attempting to give up the + * lease, the leaseholder writes its client ID to a "zombiedClient" entry in + * LocalStorage which acts as an indicator that another tab should go ahead and + * take the primary lease immediately regardless of the current lease timestamp. + * + * TODO(b/114226234): Remove `synchronizeTabs` section when multi-tab is no + * longer optional. + */ +export declare class IndexedDbPersistence implements Persistence { + /** + * Whether to synchronize the in-memory state of multiple tabs and share + * access to local persistence. + */ + private readonly allowTabSynchronization; + private readonly persistenceKey; + private readonly clientId; + private readonly queue; + private readonly window; + private readonly document; + private readonly sequenceNumberSyncer; + /** + * If set to true, forcefully obtains database access. Existing tabs will + * no longer be able to access IndexedDB. + */ + private readonly forceOwningTab; + private readonly schemaVersion; + private simpleDb; + private listenSequence; + private _started; + private isPrimary; + private networkEnabled; + private dbName; + /** Our window.unload handler, if registered. */ + private windowUnloadHandler; + private inForeground; + private serializer; + /** Our 'visibilitychange' listener if registered. */ + private documentVisibilityHandler; + /** The client metadata refresh task. */ + private clientMetadataRefresher; + /** The last time we garbage collected the client metadata object store. */ + private lastGarbageCollectionTime; + /** A listener to notify on primary state changes. */ + private primaryStateListener; + private readonly globalsCache; + private readonly targetCache; + private readonly remoteDocumentCache; + private readonly bundleCache; + private readonly webStorage; + readonly referenceDelegate: IndexedDbLruDelegateImpl; + constructor( + /** + * Whether to synchronize the in-memory state of multiple tabs and share + * access to local persistence. + */ + allowTabSynchronization: boolean, persistenceKey: string, clientId: ClientId, lruParams: LruParams, queue: AsyncQueue, window: WindowLike | null, document: DocumentLike | null, serializer: JsonProtoSerializer, sequenceNumberSyncer: SequenceNumberSyncer, + /** + * If set to true, forcefully obtains database access. Existing tabs will + * no longer be able to access IndexedDB. + */ + forceOwningTab: boolean, schemaVersion?: number); + /** + * Attempt to start IndexedDb persistence. + * + * @returns Whether persistence was enabled. + */ + start(): Promise<void>; + /** + * Registers a listener that gets called when the primary state of the + * instance changes. Upon registering, this listener is invoked immediately + * with the current primary state. + * + * PORTING NOTE: This is only used for Web multi-tab. + */ + setPrimaryStateListener(primaryStateListener: PrimaryStateListener): Promise<void>; + /** + * Registers a listener that gets called when the database receives a + * version change event indicating that it has deleted. + * + * PORTING NOTE: This is only used for Web multi-tab. + */ + setDatabaseDeletedListener(databaseDeletedListener: () => Promise<void>): void; + /** + * Adjusts the current network state in the client's metadata, potentially + * affecting the primary lease. + * + * PORTING NOTE: This is only used for Web multi-tab. + */ + setNetworkEnabled(networkEnabled: boolean): void; + /** + * Updates the client metadata in IndexedDb and attempts to either obtain or + * extend the primary lease for the local client. Asynchronously notifies the + * primary state listener if the client either newly obtained or released its + * primary lease. + */ + private updateClientMetadataAndTryBecomePrimary; + private verifyPrimaryLease; + private removeClientMetadata; + /** + * If the garbage collection threshold has passed, prunes the + * RemoteDocumentChanges and the ClientMetadata store based on the last update + * time of all clients. + */ + private maybeGarbageCollectMultiClientState; + /** + * Schedules a recurring timer to update the client metadata and to either + * extend or acquire the primary lease if the client is eligible. + */ + private scheduleClientMetadataAndPrimaryLeaseRefreshes; + /** Checks whether `client` is the local client. */ + private isLocalClient; + /** + * Evaluate the state of all active clients and determine whether the local + * client is or can act as the holder of the primary lease. Returns whether + * the client is eligible for the lease, but does not actually acquire it. + * May return 'false' even if there is no active leaseholder and another + * (foreground) client should become leaseholder instead. + */ + private canActAsPrimary; + shutdown(): Promise<void>; + /** + * Returns clients that are not zombied and have an updateTime within the + * provided threshold. + */ + private filterActiveClients; + /** + * Returns the IDs of the clients that are currently active. If multi-tab + * is not supported, returns an array that only contains the local client's + * ID. + * + * PORTING NOTE: This is only used for Web multi-tab. + */ + getActiveClients(): Promise<ClientId[]>; + get started(): boolean; + getGlobalsCache(): GlobalsCache; + getMutationQueue(user: User, indexManager: IndexManager): IndexedDbMutationQueue; + getTargetCache(): IndexedDbTargetCache; + getRemoteDocumentCache(): IndexedDbRemoteDocumentCache; + getIndexManager(user: User): IndexManager; + getDocumentOverlayCache(user: User): DocumentOverlayCache; + getBundleCache(): BundleCache; + runTransaction<T>(action: string, mode: PersistenceTransactionMode, transactionOperation: (transaction: PersistenceTransaction) => PersistencePromise<T>): Promise<T>; + /** + * Verifies that the current tab is the primary leaseholder or alternatively + * that the leaseholder has opted into multi-tab synchronization. + */ + private verifyAllowTabSynchronization; + /** + * Obtains or extends the new primary lease for the local client. This + * method does not verify that the client is eligible for this lease. + */ + private acquireOrExtendPrimaryLease; + static isAvailable(): boolean; + /** Checks the primary lease and removes it if we are the current primary. */ + private releasePrimaryLeaseIfHeld; + /** Verifies that `updateTimeMs` is within `maxAgeMs`. */ + private isWithinAge; + private attachVisibilityHandler; + private detachVisibilityHandler; + /** + * Attaches a window.unload handler that will synchronously write our + * clientId to a "zombie client id" location in LocalStorage. This can be used + * by tabs trying to acquire the primary lease to determine that the lease + * is no longer valid even if the timestamp is recent. This is particularly + * important for the refresh case (so the tab correctly re-acquires the + * primary lease). LocalStorage is used for this rather than IndexedDb because + * it is a synchronous API and so can be used reliably from an unload + * handler. + */ + private attachWindowUnloadHook; + private detachWindowUnloadHook; + /** + * Returns whether a client is "zombied" based on its LocalStorage entry. + * Clients become zombied when their tab closes without running all of the + * cleanup logic in `shutdown()`. + */ + private isClientZombied; + /** + * Record client as zombied (a client that had its tab closed). Zombied + * clients are ignored during primary tab selection. + */ + private markClientZombied; + /** Removes the zombied client entry if it exists. */ + private removeClientZombiedEntry; + private zombiedClientLocalStorageKey; +} +/** + * Generates a string used as a prefix when storing data in IndexedDB and + * LocalStorage. + */ +export declare function indexedDbStoragePrefix(databaseId: DatabaseId, persistenceKey: string): string; +export declare function indexedDbClearPersistence(persistenceKey: string): Promise<void>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts new file mode 100644 index 0000000..14532c1 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts @@ -0,0 +1,36 @@ +/** + * @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 { MutableDocument } from '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { LocalSerializer } from './local_serializer'; +import { RemoteDocumentCache } from './remote_document_cache'; +export interface DocumentSizeEntry { + document: MutableDocument; + size: number; +} +export interface IndexedDbRemoteDocumentCache extends RemoteDocumentCache { +} +/** Creates a new IndexedDbRemoteDocumentCache. */ +export declare function newIndexedDbRemoteDocumentCache(serializer: LocalSerializer): IndexedDbRemoteDocumentCache; +/** + * Comparator that compares document keys according to the primary key sorting + * used by the `DbRemoteDocumentDocument` store (by prefix path, collection id + * and then document ID). + * + * Visible for testing. + */ +export declare function dbKeyComparator(l: DocumentKey, r: DocumentKey): number; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_schema.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_schema.d.ts new file mode 100644 index 0000000..a88f237 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_schema.d.ts @@ -0,0 +1,509 @@ +/** + * @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 { BatchId, ListenSequenceNumber, TargetId } from '../core/types'; +import { IndexKind } from '../model/field_index'; +import { BundledQuery } from '../protos/firestore_bundle_proto'; +import { Document as ProtoDocument, DocumentsTarget as ProtoDocumentsTarget, QueryTarget as ProtoQueryTarget, Write as ProtoWrite } from '../protos/firestore_proto_api'; +import { EncodedResourcePath } from './encoded_resource_path'; +import { DbTimestampKey, KeySafeBytes } from './indexeddb_sentinels'; +/** + * Schema Version for the Web client: + * 1. Initial version including Mutation Queue, Query Cache, and Remote + * Document Cache + * 2. Used to ensure a targetGlobal object exists and add targetCount to it. No + * longer required because migration 3 unconditionally clears it. + * 3. Dropped and re-created Query Cache to deal with cache corruption related + * to limbo resolution. Addresses + * https://github.com/firebase/firebase-ios-sdk/issues/1548 + * 4. Multi-Tab Support. + * 5. Removal of held write acks. + * 6. Create document global for tracking document cache size. + * 7. Ensure every cached document has a sentinel row with a sequence number. + * 8. Add collection-parent index for Collection Group queries. + * 9. Change RemoteDocumentChanges store to be keyed by readTime rather than + * an auto-incrementing ID. This is required for Index-Free queries. + * 10. Rewrite the canonical IDs to the explicit Protobuf-based format. + * 11. Add bundles and named_queries for bundle support. + * 12. Add document overlays. + * 13. Rewrite the keys of the remote document cache to allow for efficient + * document lookup via `getAll()`. + * 14. Add overlays. + * 15. Add indexing support. + * 16. Parse timestamp strings before creating index entries. + * 17. TODO(tomandersen) + * 18. Encode key safe representations of IndexEntry in DbIndexEntryStore. + */ +export declare const SCHEMA_VERSION = 18; +/** + * Wrapper class to store timestamps (seconds and nanos) in IndexedDb objects. + */ +export interface DbTimestamp { + seconds: number; + nanoseconds: number; +} +/** + * A singleton object to be stored in the 'owner' store in IndexedDb. + * + * A given database can have a single primary tab assigned at a given time. That + * tab must validate that it is still holding the primary lease before every + * operation that requires locked access. The primary tab should regularly + * write an updated timestamp to this lease to prevent other tabs from + * "stealing" the primary lease + */ +export interface DbPrimaryClient { + ownerId: string; + /** Whether to allow shared access from multiple tabs. */ + allowTabSynchronization: boolean; + leaseTimestampMs: number; +} +/** + * An object to be stored in the 'mutationQueues' store in IndexedDb. + * + * Each user gets a single queue of MutationBatches to apply to the server. + * DbMutationQueue tracks the metadata about the queue. + */ +export interface DbMutationQueue { + /** + * The normalized user ID to which this queue belongs. + */ + userId: string; + /** + * An identifier for the highest numbered batch that has been acknowledged + * by the server. All MutationBatches in this queue with batchIds less + * than or equal to this value are considered to have been acknowledged by + * the server. + * + * NOTE: this is deprecated and no longer used by the code. + */ + lastAcknowledgedBatchId: number; + /** + * A stream token that was previously sent by the server. + * + * See StreamingWriteRequest in datastore.proto for more details about + * usage. + * + * After sending this token, earlier tokens may not be used anymore so + * only a single stream token is retained. + * + * NOTE: this is deprecated and no longer used by the code. + */ + lastStreamToken: string; +} +/** + * An object to be stored in the 'mutations' store in IndexedDb. + * + * Represents a batch of user-level mutations intended to be sent to the server + * in a single write. Each user-level batch gets a separate DbMutationBatch + * with a new batchId. + */ +export interface DbMutationBatch { + /** + * The normalized user ID to which this batch belongs. + */ + userId: string; + /** + * An identifier for this batch, allocated using an auto-generated key. + */ + batchId: BatchId; + /** + * The local write time of the batch, stored as milliseconds since the + * epoch. + */ + localWriteTimeMs: number; + /** + * A list of "mutations" that represent a partial base state from when this + * write batch was initially created. During local application of the write + * batch, these baseMutations are applied prior to the real writes in order + * to override certain document fields from the remote document cache. This + * is necessary in the case of non-idempotent writes (e.g. `increment()` + * transforms) to make sure that the local view of the modified documents + * doesn't flicker if the remote document cache receives the result of the + * non-idempotent write before the write is removed from the queue. + * + * These mutations are never sent to the backend. + */ + baseMutations?: ProtoWrite[]; + /** + * A list of mutations to apply. All mutations will be applied atomically. + * + * Mutations are serialized via toMutation(). + */ + mutations: ProtoWrite[]; +} +/** + * An object to be stored in the 'documentMutations' store in IndexedDb. + * + * A manually maintained index of all the mutation batches that affect a given + * document key. The rows in this table are references based on the contents of + * DbMutationBatch.mutations. + */ +export interface DbDocumentMutation { +} +/** + * Represents the known absence of a document at a particular version. + * Stored in IndexedDb as part of a DbRemoteDocument object. + */ +export interface DbNoDocument { + path: string[]; + readTime: DbTimestamp; +} +/** + * Represents a document that is known to exist but whose data is unknown. + * Stored in IndexedDb as part of a DbRemoteDocument object. + */ +export interface DbUnknownDocument { + path: string[]; + version: DbTimestamp; +} +/** + * An object to be stored in the 'remoteDocuments' store in IndexedDb. + * It represents either: + * + * - A complete document. + * - A "no document" representing a document that is known not to exist (at + * some version). + * - An "unknown document" representing a document that is known to exist (at + * some version) but whose contents are unknown. + * + * The document key is split up across `prefixPath`, `collectionGroup` and + * `documentId`. + * + * Note: This is the persisted equivalent of a MaybeDocument and could perhaps + * be made more general if necessary. + */ +export interface DbRemoteDocument { + /** The path to the document's collection (excluding). */ + prefixPath: string[]; + /** The collection ID the document is directly nested under. */ + collectionGroup: string; + /** The document ID. */ + documentId: string; + /** When the document was read from the backend. */ + readTime: DbTimestampKey; + /** + * Set to an instance of DbUnknownDocument if the data for a document is + * not known, but it is known that a document exists at the specified + * version (e.g. it had a successful update applied to it) + */ + unknownDocument?: DbUnknownDocument; + /** + * Set to an instance of a DbNoDocument if it is known that no document + * exists. + */ + noDocument?: DbNoDocument; + /** + * Set to an instance of a Document if there's a cached version of the + * document. + */ + document?: ProtoDocument; + /** + * Documents that were written to the remote document store based on + * a write acknowledgment are marked with `hasCommittedMutations`. These + * documents are potentially inconsistent with the backend's copy and use + * the write's commit version as their document version. + */ + hasCommittedMutations: boolean; +} +/** + * Contains a single entry that has metadata about the remote document cache. + */ +export interface DbRemoteDocumentGlobal { + /** + * Approximately the total size in bytes of all the + * documents in the document cache. + */ + byteSize: number; +} +/** + * The persisted type for a query nested with in the 'targets' store in + * IndexedDb. We use the proto definitions for these two kinds of queries in + * order to avoid writing extra serialization logic. + */ +export type DbQuery = ProtoQueryTarget | ProtoDocumentsTarget; +/** + * An object to be stored in the 'targets' store in IndexedDb. + * + * This is based on and should be kept in sync with the proto used in the iOS + * client. + * + * Each query the client listens to against the server is tracked on disk so + * that the query can be efficiently resumed on restart. + */ +export interface DbTarget { + /** + * An auto-generated sequential numeric identifier for the query. + * + * Queries are stored using their canonicalId as the key, but these + * canonicalIds can be quite long so we additionally assign a unique + * queryId which can be used by referenced data structures (e.g. + * indexes) to minimize the on-disk cost. + */ + targetId: TargetId; + /** + * The canonical string representing this query. This is not unique. + */ + canonicalId: string; + /** + * The last readTime received from the Watch Service for this query. + * + * This is the same value as TargetChange.read_time in the protos. + */ + readTime: DbTimestamp; + /** + * An opaque, server-assigned token that allows watching a query to be + * resumed after disconnecting without retransmitting all the data + * that matches the query. The resume token essentially identifies a + * point in time from which the server should resume sending results. + * + * This is related to the snapshotVersion in that the resumeToken + * effectively also encodes that value, but the resumeToken is opaque + * and sometimes encodes additional information. + * + * A consequence of this is that the resumeToken should be used when + * asking the server to reason about where this client is in the watch + * stream, but the client should use the snapshotVersion for its own + * purposes. + * + * This is the same value as TargetChange.resume_token in the protos. + */ + resumeToken: string; + /** + * A sequence number representing the last time this query was + * listened to, used for garbage collection purposes. + * + * Conventionally this would be a timestamp value, but device-local + * clocks are unreliable and they must be able to create new listens + * even while disconnected. Instead this should be a monotonically + * increasing number that's incremented on each listen call. + * + * This is different from the queryId since the queryId is an + * immutable identifier assigned to the Query on first use while + * lastListenSequenceNumber is updated every time the query is + * listened to. + */ + lastListenSequenceNumber: number; + /** + * Denotes the maximum snapshot version at which the associated query view + * contained no limbo documents. Undefined for data written prior to + * schema version 9. + */ + lastLimboFreeSnapshotVersion?: DbTimestamp; + /** + * The query for this target. + * + * Because canonical ids are not unique we must store the actual query. We + * use the proto to have an object we can persist without having to + * duplicate translation logic to and from a `Query` object. + */ + query: DbQuery; +} +/** + * An object representing an association between a target and a document, or a + * sentinel row marking the last sequence number at which a document was used. + * Each document cached must have a corresponding sentinel row before lru + * garbage collection is enabled. + * + * The target associations and sentinel rows are co-located so that orphaned + * documents and their sequence numbers can be identified efficiently via a scan + * of this store. + */ +export interface DbTargetDocument { + /** + * The targetId identifying a target or 0 for a sentinel row. + */ + targetId: TargetId; + /** + * The path to the document, as encoded in the key. + */ + path: EncodedResourcePath; + /** + * If this is a sentinel row, this should be the sequence number of the last + * time the document specified by `path` was used. Otherwise, it should be + * `undefined`. + */ + sequenceNumber?: ListenSequenceNumber; +} +/** + * A record of global state tracked across all Targets, tracked separately + * to avoid the need for extra indexes. + * + * This should be kept in-sync with the proto used in the iOS client. + */ +export interface DbTargetGlobal { + /** + * The highest numbered target id across all targets. + * + * See DbTarget.targetId. + */ + highestTargetId: TargetId; + /** + * The highest numbered lastListenSequenceNumber across all targets. + * + * See DbTarget.lastListenSequenceNumber. + */ + highestListenSequenceNumber: number; + /** + * A global snapshot version representing the last consistent snapshot we + * received from the backend. This is monotonically increasing and any + * snapshots received from the backend prior to this version (e.g. for + * targets resumed with a resumeToken) should be suppressed (buffered) + * until the backend has caught up to this snapshot version again. This + * prevents our cache from ever going backwards in time. + */ + lastRemoteSnapshotVersion: DbTimestamp; + /** + * The number of targets persisted. + */ + targetCount: number; +} +/** + * An object representing an association between a Collection id (e.g. 'messages') + * to a parent path (e.g. '/chats/123') that contains it as a (sub)collection. + * This is used to efficiently find all collections to query when performing + * a Collection Group query. + */ +export interface DbCollectionParent { + /** + * The collectionId (e.g. 'messages') + */ + collectionId: string; + /** + * The path to the parent (either a document location or an empty path for + * a root-level collection). + */ + parent: EncodedResourcePath; +} +/** + * A record of the metadata state of each client. + * + * PORTING NOTE: This is used to synchronize multi-tab state and does not need + * to be ported to iOS or Android. + */ +export interface DbClientMetadata { + /** The auto-generated client id assigned at client startup. */ + clientId: string; + /** The last time this state was updated. */ + updateTimeMs: number; + /** Whether the client's network connection is enabled. */ + networkEnabled: boolean; + /** Whether this client is running in a foreground tab. */ + inForeground: boolean; +} +/** An object representing a bundle loaded by the SDK. */ +export interface DbBundle { + /** The ID of the loaded bundle. */ + bundleId: string; + /** The create time of the loaded bundle. */ + createTime: DbTimestamp; + /** The schema version of the loaded bundle. */ + version: number; +} +/** An object representing a named query loaded by the SDK via a bundle. */ +export interface DbNamedQuery { + /** The name of the query. */ + name: string; + /** The read time of the results saved in the bundle from the named query. */ + readTime: DbTimestamp; + /** The query saved in the bundle. */ + bundledQuery: BundledQuery; +} +/** An object representing the global configuration for a field index. */ +export interface DbIndexConfiguration { + /** + * The index id for this entry. Undefined for indexes that are not yet + * persisted. + */ + indexId?: number; + /** The collection group this index belongs to. */ + collectionGroup: string; + /** The fields to index for this index. */ + fields: Array<[name: string, kind: IndexKind]>; +} +/** + * An object describing how up-to-date the index backfill is for each user and + * index. + */ +export interface DbIndexState { + /** The index id for this entry. */ + indexId: number; + /** The user id for this entry. */ + uid: string; + /** + * A number that indicates when the index was last updated (relative to + * other indexes). + */ + sequenceNumber: number; + /** + * The latest read time that has been indexed by Firestore for this field + * index. Set to `{seconds: 0, nanos: 0}` if no documents have been indexed. + */ + readTime: DbTimestamp; + /** + * The last document that has been indexed for this field index. Empty if + * no documents have been indexed. + */ + documentKey: EncodedResourcePath; + /** + * The largest mutation batch id that has been processed for this index. -1 + * if no mutations have been indexed. + */ + largestBatchId: number; +} +/** An object that stores the encoded entries for all documents and fields. */ +export interface DbIndexEntry { + /** The index id for this entry. */ + indexId: number; + /** The user id for this entry. */ + uid: string; + /** The encoded array index value for this entry. */ + arrayValue: KeySafeBytes; + /** The encoded directional value for equality and inequality filters. */ + directionalValue: KeySafeBytes; + /** + * The document key this entry points to. This entry is encoded by an ordered + * encoder to match the key order of the index. + */ + orderedDocumentKey: KeySafeBytes; + /** The segments of the document key this entry points to. */ + documentKey: string[]; +} +/** + * An object representing a document overlay. + */ +export interface DbDocumentOverlay { + /** The user ID to whom this overlay belongs. */ + userId: string; + /** The path to the collection that contains the document. */ + collectionPath: string; + /** The ID (key) of the document within the collection. */ + documentId: string; + /** The collection group to which the document belongs. */ + collectionGroup: string; + /** The largest batch ID that's been applied for this overlay. */ + largestBatchId: number; + /** The overlay mutation. */ + overlayMutation: ProtoWrite; +} +/** + * An object containing global name/value pair. + */ +export interface DbGlobals { + /** Name is a globally unique identifier for a value. */ + name: string; + /** Value is a general purpose storage for global data. */ + value: Uint8Array; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_schema_converter.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_schema_converter.d.ts new file mode 100644 index 0000000..0daedc5 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_schema_converter.d.ts @@ -0,0 +1,43 @@ +/** + * @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 { LocalSerializer } from './local_serializer'; +import { PersistencePromise } from './persistence_promise'; +import { SimpleDbSchemaConverter } from './simple_db'; +/** Performs database creation and schema upgrades. */ +export declare class SchemaConverter implements SimpleDbSchemaConverter { + private readonly serializer; + constructor(serializer: LocalSerializer); + /** + * Performs database creation and schema upgrades. + * + * Note that in production, this method is only ever used to upgrade the schema + * to SCHEMA_VERSION. Different values of toVersion are only used for testing + * and local feature development. + */ + createOrUpgrade(db: IDBDatabase, txn: IDBTransaction, fromVersion: number, toVersion: number): PersistencePromise<void>; + private addDocumentGlobal; + private removeAcknowledgedMutations; + /** + * Ensures that every document in the remote document cache has a corresponding sentinel row + * with a sequence number. Missing rows are given the most recently used sequence number. + */ + private ensureSequenceNumbers; + private createCollectionParentIndex; + private rewriteCanonicalIds; + private rewriteRemoteDocumentCache; + private runOverlayMigration; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_schema_legacy.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_schema_legacy.d.ts new file mode 100644 index 0000000..51716a6 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_schema_legacy.d.ts @@ -0,0 +1,29 @@ +/** + * @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 { Document as ProtoDocument } from '../protos/firestore_proto_api'; +import { DbNoDocument, DbUnknownDocument } from './indexeddb_schema'; +import { DbTimestampKey } from './indexeddb_sentinels'; +export interface DbRemoteDocument { + unknownDocument?: DbUnknownDocument; + noDocument?: DbNoDocument; + document?: ProtoDocument; + hasCommittedMutations?: boolean; + readTime?: DbTimestampKey; + parentPath?: string[]; +} +export type DbRemoteDocumentKey = string[]; +export declare const DbRemoteDocumentStore = "remoteDocuments"; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_sentinels.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_sentinels.d.ts new file mode 100644 index 0000000..acd9785 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_sentinels.d.ts @@ -0,0 +1,267 @@ +/** + * @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 { BatchId, TargetId } from '../core/types'; +import { ResourcePath } from '../model/path'; +import { EncodedResourcePath } from './encoded_resource_path'; +import { DbDocumentMutation } from './indexeddb_schema'; +/** A timestamp type that can be used in IndexedDb keys. */ +export type DbTimestampKey = [/* seconds */ number, /* nanos */ number]; +export type DbPrimaryClientKey = typeof DbPrimaryClientKey; +/** + * Name of the IndexedDb object store. + * + * Note that the name 'owner' is chosen to ensure backwards compatibility with + * older clients that only supported single locked access to the persistence + * layer. + */ +export declare const DbPrimaryClientStore = "owner"; +/** + * The key string used for the single object that exists in the + * DbPrimaryClient store. + */ +export declare const DbPrimaryClientKey = "owner"; +/** Object keys in the 'mutationQueues' store are userId strings. */ +export type DbMutationQueueKey = string; +/** Name of the IndexedDb object store. */ +export declare const DbMutationQueueStore = "mutationQueues"; +/** Keys are automatically assigned via the userId property. */ +export declare const DbMutationQueueKeyPath = "userId"; +/** The 'mutations' store is keyed by batch ID. */ +export type DbMutationBatchKey = BatchId; +/** Name of the IndexedDb object store. */ +export declare const DbMutationBatchStore = "mutations"; +/** Keys are automatically assigned via the userId, batchId properties. */ +export declare const DbMutationBatchKeyPath = "batchId"; +/** The index name for lookup of mutations by user. */ +export declare const DbMutationBatchUserMutationsIndex = "userMutationsIndex"; +/** The user mutations index is keyed by [userId, batchId] pairs. */ +export declare const DbMutationBatchUserMutationsKeyPath: string[]; +/** + * The key for a db document mutation, which is made up of a userID, path, and + * batchId. Note that the path must be serialized into a form that indexedDB can + * sort. + */ +export type DbDocumentMutationKey = [string, EncodedResourcePath, BatchId]; +/** + * Creates a [userId] key for use in the DbDocumentMutations index to iterate + * over all of a user's document mutations. + */ +export declare function newDbDocumentMutationPrefixForUser(userId: string): [string]; +/** + * Creates a [userId, encodedPath] key for use in the DbDocumentMutations + * index to iterate over all at document mutations for a given path or lower. + */ +export declare function newDbDocumentMutationPrefixForPath(userId: string, path: ResourcePath): [string, EncodedResourcePath]; +/** + * Creates a full index key of [userId, encodedPath, batchId] for inserting + * and deleting into the DbDocumentMutations index. + */ +export declare function newDbDocumentMutationKey(userId: string, path: ResourcePath, batchId: BatchId): DbDocumentMutationKey; +/** + * Because we store all the useful information for this store in the key, + * there is no useful information to store as the value. The raw (unencoded) + * path cannot be stored because IndexedDb doesn't store prototype + * information. + */ +export declare const DbDocumentMutationPlaceholder: DbDocumentMutation; +export declare const DbDocumentMutationStore = "documentMutations"; +export declare const DbRemoteDocumentStore = "remoteDocumentsV14"; +/** + * A key in the 'remoteDocumentsV14' object store is an array containing the + * collection path, the collection group, the read time and the document id. + */ +export type DbRemoteDocumentKey = [ + /** path to collection */ string[], + /** collection group */ string, + /** read time */ DbTimestampKey, + /** document ID */ string +]; +/** + * The primary key of the remote documents store, which allows for efficient + * access by collection path and read time. + */ +export declare const DbRemoteDocumentKeyPath: string[]; +/** An index that provides access to documents by key. */ +export declare const DbRemoteDocumentDocumentKeyIndex = "documentKeyIndex"; +export declare const DbRemoteDocumentDocumentKeyIndexPath: string[]; +/** + * An index that provides access to documents by collection group and read + * time. + * + * This index is used by the index backfiller. + */ +export declare const DbRemoteDocumentCollectionGroupIndex = "collectionGroupIndex"; +export declare const DbRemoteDocumentCollectionGroupIndexPath: string[]; +export declare const DbRemoteDocumentGlobalStore = "remoteDocumentGlobal"; +export declare const DbRemoteDocumentGlobalKey = "remoteDocumentGlobalKey"; +export type DbRemoteDocumentGlobalKey = typeof DbRemoteDocumentGlobalKey; +/** + * A key in the 'targets' object store is a targetId of the query. + */ +export type DbTargetKey = TargetId; +export declare const DbTargetStore = "targets"; +/** Keys are automatically assigned via the targetId property. */ +export declare const DbTargetKeyPath = "targetId"; +/** The name of the queryTargets index. */ +export declare const DbTargetQueryTargetsIndexName = "queryTargetsIndex"; +/** + * The index of all canonicalIds to the targets that they match. This is not + * a unique mapping because canonicalId does not promise a unique name for all + * possible queries, so we append the targetId to make the mapping unique. + */ +export declare const DbTargetQueryTargetsKeyPath: string[]; +/** + * The key for a DbTargetDocument, containing a targetId and an encoded resource + * path. + */ +export type DbTargetDocumentKey = [TargetId, EncodedResourcePath]; +/** Name of the IndexedDb object store. */ +export declare const DbTargetDocumentStore = "targetDocuments"; +/** Keys are automatically assigned via the targetId, path properties. */ +export declare const DbTargetDocumentKeyPath: string[]; +/** The index name for the reverse index. */ +export declare const DbTargetDocumentDocumentTargetsIndex = "documentTargetsIndex"; +/** We also need to create the reverse index for these properties. */ +export declare const DbTargetDocumentDocumentTargetsKeyPath: string[]; +/** + * The type to represent the single allowed key for the DbTargetGlobal store. + */ +export type DbTargetGlobalKey = typeof DbTargetGlobalKey; +/** + * The key string used for the single object that exists in the + * DbTargetGlobal store. + */ +export declare const DbTargetGlobalKey = "targetGlobalKey"; +export declare const DbTargetGlobalStore = "targetGlobal"; +/** + * The key for a DbCollectionParent entry, containing the collection ID + * and the parent path that contains it. Note that the parent path will be an + * empty path in the case of root-level collections. + */ +export type DbCollectionParentKey = [string, EncodedResourcePath]; +/** Name of the IndexedDb object store. */ +export declare const DbCollectionParentStore = "collectionParents"; +/** Keys are automatically assigned via the collectionId, parent properties. */ +export declare const DbCollectionParentKeyPath: string[]; +/** Name of the IndexedDb object store. */ +export declare const DbClientMetadataStore = "clientMetadata"; +/** Keys are automatically assigned via the clientId properties. */ +export declare const DbClientMetadataKeyPath = "clientId"; +/** Object keys in the 'clientMetadata' store are clientId strings. */ +export type DbClientMetadataKey = string; +export type DbBundlesKey = string; +/** Name of the IndexedDb object store. */ +export declare const DbBundleStore = "bundles"; +export declare const DbBundleKeyPath = "bundleId"; +export type DbNamedQueriesKey = string; +/** Name of the IndexedDb object store. */ +export declare const DbNamedQueryStore = "namedQueries"; +export declare const DbNamedQueryKeyPath = "name"; +/** The key for each index consisting of just the index id. */ +export type DbIndexConfigurationKey = number; +/** Name of the IndexedDb object store. */ +export declare const DbIndexConfigurationStore = "indexConfiguration"; +export declare const DbIndexConfigurationKeyPath = "indexId"; +/** + * An index that provides access to the index configurations by collection + * group. + * + * PORTING NOTE: iOS and Android maintain this index in-memory, but this is + * not possible here as the Web client supports concurrent access to + * persistence via multi-tab. + */ +export declare const DbIndexConfigurationCollectionGroupIndex = "collectionGroupIndex"; +export declare const DbIndexConfigurationCollectionGroupIndexPath = "collectionGroup"; +/** The key for each index state consisting of the index id and its user id. */ +export type DbIndexStateKey = [number, string]; +/** Name of the IndexedDb object store. */ +export declare const DbIndexStateStore = "indexState"; +export declare const DbIndexStateKeyPath: string[]; +/** + * An index that provides access to documents in a collection sorted by last + * update time. Used by the backfiller. + * + * PORTING NOTE: iOS and Android maintain this index in-memory, but this is + * not possible here as the Web client supports concurrent access to + * persistence via multi-tab. + */ +export declare const DbIndexStateSequenceNumberIndex = "sequenceNumberIndex"; +export declare const DbIndexStateSequenceNumberIndexPath: string[]; +/** + * Representation of a byte array that is safe for + * use in an IndexedDb key. The value is either + * a "sortable byte string", which is key safe in + * Safari/WebKit, or the value is a Uint8Array, + * which is key safe in other browsers. + */ +export type KeySafeBytes = Uint8Array | string; +/** + * The key for each index entry consists of the index id and its user id, + * the encoded array and directional value for the indexed fields as well as + * an ordered and an encoded document path for the indexed document. + */ +export type DbIndexEntryKey = [ + number, + string, + KeySafeBytes, + KeySafeBytes, + KeySafeBytes, + string[] +]; +/** Name of the IndexedDb object store. */ +export declare const DbIndexEntryStore = "indexEntries"; +export declare const DbIndexEntryKeyPath: string[]; +export declare const DbIndexEntryDocumentKeyIndex = "documentKeyIndex"; +export declare const DbIndexEntryDocumentKeyIndexPath: string[]; +export type DbDocumentOverlayKey = [ + string, + string, + string +]; +/** Name of the IndexedDb object store. */ +export declare const DbDocumentOverlayStore = "documentOverlays"; +export declare const DbDocumentOverlayKeyPath: string[]; +export declare const DbDocumentOverlayCollectionPathOverlayIndex = "collectionPathOverlayIndex"; +export declare const DbDocumentOverlayCollectionPathOverlayIndexPath: string[]; +export declare const DbDocumentOverlayCollectionGroupOverlayIndex = "collectionGroupOverlayIndex"; +export declare const DbDocumentOverlayCollectionGroupOverlayIndexPath: string[]; +/** Name of the IndexedDb object store. */ +export declare const DbGlobalsStore = "globals"; +export declare const DbGlobalsKeyPath = "name"; +/** Names of global values */ +export type DbGlobalsKey = 'sessionToken'; +export declare const V1_STORES: string[]; +export declare const V3_STORES: string[]; +export declare const V4_STORES: string[]; +export declare const V6_STORES: string[]; +export declare const V8_STORES: string[]; +export declare const V11_STORES: string[]; +export declare const V12_STORES: string[]; +export declare const V13_STORES: string[]; +export declare const V14_STORES: string[]; +export declare const V15_STORES: string[]; +export declare const V16_STORES: string[]; +export declare const V17_STORES: string[]; +export declare const V18_STORES: string[]; +/** + * The list of all default IndexedDB stores used throughout the SDK. This is + * used when creating transactions so that access across all stores is done + * atomically. + */ +export declare const ALL_STORES: string[]; +/** Returns the object stores for the provided schema. */ +export declare function getObjectStores(schemaVersion: number): string[]; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_target_cache.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_target_cache.d.ts new file mode 100644 index 0000000..74654fe --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_target_cache.d.ts @@ -0,0 +1,81 @@ +/** + * @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 { Target } from '../core/target'; +import { ListenSequenceNumber, TargetId } from '../core/types'; +import { DocumentKeySet } from '../model/collections'; +import { DocumentKey } from '../model/document_key'; +import { IndexedDbLruDelegate } from './indexeddb_lru_delegate'; +import { DbTargetDocument } from './indexeddb_schema'; +import { DbTargetDocumentKey } from './indexeddb_sentinels'; +import { LocalSerializer } from './local_serializer'; +import { ActiveTargets } from './lru_garbage_collector'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +import { SimpleDbStore } from './simple_db'; +import { TargetCache } from './target_cache'; +import { TargetData } from './target_data'; +export declare class IndexedDbTargetCache implements TargetCache { + private readonly referenceDelegate; + private serializer; + constructor(referenceDelegate: IndexedDbLruDelegate, serializer: LocalSerializer); + allocateTargetId(transaction: PersistenceTransaction): PersistencePromise<TargetId>; + getLastRemoteSnapshotVersion(transaction: PersistenceTransaction): PersistencePromise<SnapshotVersion>; + getHighestSequenceNumber(transaction: PersistenceTransaction): PersistencePromise<ListenSequenceNumber>; + setTargetsMetadata(transaction: PersistenceTransaction, highestListenSequenceNumber: number, lastRemoteSnapshotVersion?: SnapshotVersion): PersistencePromise<void>; + addTargetData(transaction: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + updateTargetData(transaction: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + removeTargetData(transaction: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + /** + * Drops any targets with sequence number less than or equal to the upper bound, excepting those + * present in `activeTargetIds`. Document associations for the removed targets are also removed. + * Returns the number of targets removed. + */ + removeTargets(txn: PersistenceTransaction, upperBound: ListenSequenceNumber, activeTargetIds: ActiveTargets): PersistencePromise<number>; + /** + * Call provided function with each `TargetData` that we have cached. + */ + forEachTarget(txn: PersistenceTransaction, f: (q: TargetData) => void): PersistencePromise<void>; + private retrieveMetadata; + private saveMetadata; + private saveTargetData; + /** + * In-place updates the provided metadata to account for values in the given + * TargetData. Saving is done separately. Returns true if there were any + * changes to the metadata. + */ + private updateMetadataFromTargetData; + getTargetCount(transaction: PersistenceTransaction): PersistencePromise<number>; + getTargetData(transaction: PersistenceTransaction, target: Target): PersistencePromise<TargetData | null>; + addMatchingKeys(txn: PersistenceTransaction, keys: DocumentKeySet, targetId: TargetId): PersistencePromise<void>; + removeMatchingKeys(txn: PersistenceTransaction, keys: DocumentKeySet, targetId: TargetId): PersistencePromise<void>; + removeMatchingKeysForTargetId(txn: PersistenceTransaction, targetId: TargetId): PersistencePromise<void>; + getMatchingKeysForTargetId(txn: PersistenceTransaction, targetId: TargetId): PersistencePromise<DocumentKeySet>; + containsKey(txn: PersistenceTransaction, key: DocumentKey): PersistencePromise<boolean>; + /** + * Looks up a TargetData entry by target ID. + * + * @param targetId - The target ID of the TargetData entry to look up. + * @returns The cached TargetData entry, or null if the cache has no entry for + * the target. + */ + getTargetDataForTarget(transaction: PersistenceTransaction, targetId: TargetId): PersistencePromise<TargetData | null>; +} +/** + * Helper to get a typed SimpleDbStore for the document target object store. + */ +export declare function documentTargetStore(txn: PersistenceTransaction): SimpleDbStore<DbTargetDocumentKey, DbTargetDocument>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_transaction.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_transaction.d.ts new file mode 100644 index 0000000..4d1fc92 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/indexeddb_transaction.d.ts @@ -0,0 +1,25 @@ +/** + * @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 { ListenSequenceNumber } from '../core/types'; +import { PersistenceTransaction } from './persistence_transaction'; +import { SimpleDbStore, SimpleDbTransaction } from './simple_db'; +export declare class IndexedDbTransaction extends PersistenceTransaction { + readonly simpleDbTransaction: SimpleDbTransaction; + readonly currentSequenceNumber: ListenSequenceNumber; + constructor(simpleDbTransaction: SimpleDbTransaction, currentSequenceNumber: ListenSequenceNumber); +} +export declare function getStore<Key extends IDBValidKey, Value>(txn: PersistenceTransaction, store: string): SimpleDbStore<Key, Value>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/local_documents_view.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/local_documents_view.d.ts new file mode 100644 index 0000000..8d276c3 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/local_documents_view.d.ts @@ -0,0 +1,127 @@ +/** + * @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 { Query } from '../core/query'; +import { DocumentKeySet, OverlayMap, DocumentMap, MutableDocumentMap, DocumentKeyMap, OverlayedDocumentMap } from '../model/collections'; +import { Document } from '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { IndexOffset } from '../model/field_index'; +import { FieldMask } from '../model/field_mask'; +import { DocumentOverlayCache } from './document_overlay_cache'; +import { IndexManager } from './index_manager'; +import { LocalWriteResult } from './local_store_impl'; +import { MutationQueue } from './mutation_queue'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +import { QueryContext } from './query_context'; +import { RemoteDocumentCache } from './remote_document_cache'; +/** + * A readonly view of the local state of all documents we're tracking (i.e. we + * have a cached version in remoteDocumentCache or local mutations for the + * document). The view is computed by applying the mutations in the + * MutationQueue to the RemoteDocumentCache. + */ +export declare class LocalDocumentsView { + readonly remoteDocumentCache: RemoteDocumentCache; + readonly mutationQueue: MutationQueue; + readonly documentOverlayCache: DocumentOverlayCache; + readonly indexManager: IndexManager; + constructor(remoteDocumentCache: RemoteDocumentCache, mutationQueue: MutationQueue, documentOverlayCache: DocumentOverlayCache, indexManager: IndexManager); + /** + * Get the local view of the document identified by `key`. + * + * @returns Local view of the document or null if we don't have any cached + * state for it. + */ + getDocument(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<Document>; + /** + * Gets the local view of the documents identified by `keys`. + * + * If we don't have cached state for a document in `keys`, a NoDocument will + * be stored for that key in the resulting set. + */ + getDocuments(transaction: PersistenceTransaction, keys: DocumentKeySet): PersistencePromise<DocumentMap>; + /** + * Similar to `getDocuments`, but creates the local view from the given + * `baseDocs` without retrieving documents from the local store. + * + * @param transaction - The transaction this operation is scoped to. + * @param docs - The documents to apply local mutations to get the local views. + * @param existenceStateChanged - The set of document keys whose existence state + * is changed. This is useful to determine if some documents overlay needs + * to be recalculated. + */ + getLocalViewOfDocuments(transaction: PersistenceTransaction, docs: MutableDocumentMap, existenceStateChanged?: DocumentKeySet): PersistencePromise<DocumentMap>; + /** + * Gets the overlayed documents for the given document map, which will include + * the local view of those documents and a `FieldMask` indicating which fields + * are mutated locally, `null` if overlay is a Set or Delete mutation. + */ + getOverlayedDocuments(transaction: PersistenceTransaction, docs: MutableDocumentMap): PersistencePromise<OverlayedDocumentMap>; + /** + * Fetches the overlays for {@code docs} and adds them to provided overlay map + * if the map does not already contain an entry for the given document key. + */ + private populateOverlays; + /** + * Computes the local view for the given documents. + * + * @param docs - The documents to compute views for. It also has the base + * version of the documents. + * @param overlays - The overlays that need to be applied to the given base + * version of the documents. + * @param existenceStateChanged - A set of documents whose existence states + * might have changed. This is used to determine if we need to re-calculate + * overlays from mutation queues. + * @return A map represents the local documents view. + */ + computeViews(transaction: PersistenceTransaction, docs: MutableDocumentMap, overlays: OverlayMap, existenceStateChanged: DocumentKeySet): PersistencePromise<OverlayedDocumentMap>; + private recalculateAndSaveOverlays; + /** + * Recalculates overlays by reading the documents from remote document cache + * first, and saves them after they are calculated. + */ + recalculateAndSaveOverlaysForDocumentKeys(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<DocumentKeyMap<FieldMask | null>>; + /** + * Performs a query against the local view of all documents. + * + * @param transaction - The persistence transaction. + * @param query - The query to match documents against. + * @param offset - Read time and key to start scanning by (exclusive). + * @param context - A optional tracker to keep a record of important details + * during database local query execution. + */ + getDocumentsMatchingQuery(transaction: PersistenceTransaction, query: Query, offset: IndexOffset, context?: QueryContext): PersistencePromise<DocumentMap>; + /** + * Given a collection group, returns the next documents that follow the provided offset, along + * with an updated batch ID. + * + * <p>The documents returned by this method are ordered by remote version from the provided + * offset. If there are no more remote documents after the provided offset, documents with + * mutations in order of batch id from the offset are returned. Since all documents in a batch are + * returned together, the total number of documents returned can exceed {@code count}. + * + * @param transaction + * @param collectionGroup The collection group for the documents. + * @param offset The offset to index into. + * @param count The number of documents to return + * @return A LocalWriteResult with the documents that follow the provided offset and the last processed batch id. + */ + getNextDocuments(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset, count: number): PersistencePromise<LocalWriteResult>; + private getDocumentsMatchingDocumentQuery; + private getDocumentsMatchingCollectionGroupQuery; + private getDocumentsMatchingCollectionQuery; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/local_serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/local_serializer.d.ts new file mode 100644 index 0000000..88599b4 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/local_serializer.d.ts @@ -0,0 +1,80 @@ +/** + * @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 { BundleMetadata, NamedQuery } from '../core/bundle'; +import { Query } from '../core/query'; +import { SnapshotVersion } from '../core/snapshot_version'; +import { MutableDocument } from '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { FieldIndex, IndexOffset } from '../model/field_index'; +import { MutationBatch } from '../model/mutation_batch'; +import { Overlay } from '../model/overlay'; +import { BundledQuery as ProtoBundledQuery, BundleMetadata as ProtoBundleMetadata, NamedQuery as ProtoNamedQuery } from '../protos/firestore_bundle_proto'; +import { JsonProtoSerializer } from '../remote/serializer'; +import { DbBundle, DbDocumentOverlay, DbIndexConfiguration, DbIndexState, DbMutationBatch, DbNamedQuery, DbRemoteDocument, DbTarget, DbTimestamp } from './indexeddb_schema'; +import { DbDocumentOverlayKey, DbTimestampKey } from './indexeddb_sentinels'; +import { TargetData } from './target_data'; +/** Serializer for values stored in the LocalStore. */ +export declare class LocalSerializer { + readonly remoteSerializer: JsonProtoSerializer; + constructor(remoteSerializer: JsonProtoSerializer); +} +/** Decodes a remote document from storage locally to a Document. */ +export declare function fromDbRemoteDocument(localSerializer: LocalSerializer, remoteDoc: DbRemoteDocument): MutableDocument; +/** Encodes a document for storage locally. */ +export declare function toDbRemoteDocument(localSerializer: LocalSerializer, document: MutableDocument): DbRemoteDocument; +export declare function toDbTimestampKey(snapshotVersion: SnapshotVersion): DbTimestampKey; +export declare function fromDbTimestampKey(dbTimestampKey: DbTimestampKey): SnapshotVersion; +export declare function toDbTimestamp(snapshotVersion: SnapshotVersion): DbTimestamp; +/** Encodes a batch of mutations into a DbMutationBatch for local storage. */ +export declare function toDbMutationBatch(localSerializer: LocalSerializer, userId: string, batch: MutationBatch): DbMutationBatch; +/** Decodes a DbMutationBatch into a MutationBatch */ +export declare function fromDbMutationBatch(localSerializer: LocalSerializer, dbBatch: DbMutationBatch): MutationBatch; +/** Decodes a DbTarget into TargetData */ +export declare function fromDbTarget(dbTarget: DbTarget): TargetData; +/** Encodes TargetData into a DbTarget for storage locally. */ +export declare function toDbTarget(localSerializer: LocalSerializer, targetData: TargetData): DbTarget; +/** Encodes a DbBundle to a BundleMetadata object. */ +export declare function fromDbBundle(dbBundle: DbBundle): BundleMetadata; +/** Encodes a BundleMetadata to a DbBundle. */ +export declare function toDbBundle(metadata: ProtoBundleMetadata): DbBundle; +/** Encodes a DbNamedQuery to a NamedQuery. */ +export declare function fromDbNamedQuery(dbNamedQuery: DbNamedQuery): NamedQuery; +/** Encodes a NamedQuery from a bundle proto to a DbNamedQuery. */ +export declare function toDbNamedQuery(query: ProtoNamedQuery): DbNamedQuery; +/** + * Encodes a `BundledQuery` from bundle proto to a Query object. + * + * This reconstructs the original query used to build the bundle being loaded, + * including features exists only in SDKs (for example: limit-to-last). + */ +export declare function fromBundledQuery(bundledQuery: ProtoBundledQuery): Query; +/** Encodes a NamedQuery proto object to a NamedQuery model object. */ +export declare function fromProtoNamedQuery(namedQuery: ProtoNamedQuery): NamedQuery; +/** Decodes a BundleMetadata proto into a BundleMetadata object. */ +export declare function fromBundleMetadata(metadata: ProtoBundleMetadata): BundleMetadata; +/** Encodes a DbDocumentOverlay object to an Overlay model object. */ +export declare function fromDbDocumentOverlay(localSerializer: LocalSerializer, dbDocumentOverlay: DbDocumentOverlay): Overlay; +/** Decodes an Overlay model object into a DbDocumentOverlay object. */ +export declare function toDbDocumentOverlay(localSerializer: LocalSerializer, userId: string, overlay: Overlay): DbDocumentOverlay; +/** + * Returns the DbDocumentOverlayKey corresponding to the given user and + * document key. + */ +export declare function toDbDocumentOverlayKey(userId: string, docKey: DocumentKey): DbDocumentOverlayKey; +export declare function toDbIndexConfiguration(index: FieldIndex): DbIndexConfiguration; +export declare function fromDbIndexConfiguration(index: DbIndexConfiguration, state: DbIndexState | null): FieldIndex; +export declare function toDbIndexState(indexId: number, uid: string, sequenceNumber: number, offset: IndexOffset): DbIndexState; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/local_store.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/local_store.d.ts new file mode 100644 index 0000000..2284d7d --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/local_store.d.ts @@ -0,0 +1,41 @@ +/** + * @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 { FirestoreError } from '../util/error'; +import { IndexManager } from './index_manager'; +import { LocalDocumentsView } from './local_documents_view'; +import { LruGarbageCollector, LruResults } from './lru_garbage_collector'; +export interface LocalStore { + collectGarbage(garbageCollector: LruGarbageCollector): Promise<LruResults>; + /** Manages the list of active field and collection indices. */ + indexManager: IndexManager; + /** + * The "local" view of all documents (layering mutationQueue on top of + * remoteDocumentCache). + */ + localDocuments: LocalDocumentsView; +} +/** + * Verifies the error thrown by a LocalStore operation. If a LocalStore + * operation fails because the primary lease has been taken by another client, + * we ignore the error (the persistence layer will immediately call + * `applyPrimaryLease` to propagate the primary state change). All other errors + * are re-thrown. + * + * @param err - An error returned by a LocalStore operation. + * @returns A Promise that resolves after we recovered, or the original error. + */ +export declare function ignoreIfPrimaryLeaseLoss(err: FirestoreError): Promise<void>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/local_store_impl.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/local_store_impl.d.ts new file mode 100644 index 0000000..1b86e0d --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/local_store_impl.d.ts @@ -0,0 +1,208 @@ +/** + * @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 { User } from '../auth/user'; +import { BundleConverter, BundledDocuments, NamedQuery } from '../core/bundle'; +import { Query } from '../core/query'; +import { SnapshotVersion } from '../core/snapshot_version'; +import { Target } from '../core/target'; +import { BatchId, TargetId } from '../core/types'; +import { DocumentKeySet, DocumentMap } from '../model/collections'; +import { Document } from '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { FieldIndex } from '../model/field_index'; +import { Mutation } from '../model/mutation'; +import { MutationBatch, MutationBatchResult } from '../model/mutation_batch'; +import { BundleMetadata, NamedQuery as ProtoNamedQuery } from '../protos/firestore_bundle_proto'; +import { RemoteEvent } from '../remote/remote_event'; +import { JsonProtoSerializer } from '../remote/serializer'; +import { LocalStore } from './local_store'; +import { LocalViewChanges } from './local_view_changes'; +import { Persistence } from './persistence'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +import { QueryEngine } from './query_engine'; +import { ClientId } from './shared_client_state'; +import { TargetData } from './target_data'; +export declare const LOG_TAG = "LocalStore"; +/** The result of a write to the local store. */ +export interface LocalWriteResult { + batchId: BatchId; + changes: DocumentMap; +} +/** The result of a user-change operation in the local store. */ +export interface UserChangeResult { + readonly affectedDocuments: DocumentMap; + readonly removedBatchIds: BatchId[]; + readonly addedBatchIds: BatchId[]; +} +/** The result of executing a query against the local store. */ +export interface QueryResult { + readonly documents: DocumentMap; + readonly remoteKeys: DocumentKeySet; +} +export declare function newLocalStore( +/** Manages our in-memory or durable persistence. */ +persistence: Persistence, queryEngine: QueryEngine, initialUser: User, serializer: JsonProtoSerializer): LocalStore; +/** + * Tells the LocalStore that the currently authenticated user has changed. + * + * In response the local store switches the mutation queue to the new user and + * returns any resulting document changes. + */ +export declare function localStoreHandleUserChange(localStore: LocalStore, user: User): Promise<UserChangeResult>; +export declare function localStoreWriteLocally(localStore: LocalStore, mutations: Mutation[]): Promise<LocalWriteResult>; +/** + * Acknowledges the given batch. + * + * On the happy path when a batch is acknowledged, the local store will + * + * + remove the batch from the mutation queue; + * + apply the changes to the remote document cache; + * + recalculate the latency compensated view implied by those changes (there + * may be mutations in the queue that affect the documents but haven't been + * acknowledged yet); and + * + give the changed documents back the sync engine + * + * @returns The resulting (modified) documents. + */ +export declare function localStoreAcknowledgeBatch(localStore: LocalStore, batchResult: MutationBatchResult): Promise<DocumentMap>; +/** + * Removes mutations from the MutationQueue for the specified batch; + * LocalDocuments will be recalculated. + * + * @returns The resulting modified documents. + */ +export declare function localStoreRejectBatch(localStore: LocalStore, batchId: BatchId): Promise<DocumentMap>; +/** + * Returns the largest (latest) batch id in mutation queue that is pending + * server response. + * + * Returns `BATCHID_UNKNOWN` if the queue is empty. + */ +export declare function localStoreGetHighestUnacknowledgedBatchId(localStore: LocalStore): Promise<BatchId>; +/** + * Returns the last consistent snapshot processed (used by the RemoteStore to + * determine whether to buffer incoming snapshots from the backend). + */ +export declare function localStoreGetLastRemoteSnapshotVersion(localStore: LocalStore): Promise<SnapshotVersion>; +/** + * Updates the "ground-state" (remote) documents. We assume that the remote + * event reflects any write batches that have been acknowledged or rejected + * (i.e. we do not re-apply local mutations to updates from this event). + * + * LocalDocuments are re-calculated if there are remaining mutations in the + * queue. + */ +export declare function localStoreApplyRemoteEventToLocalCache(localStore: LocalStore, remoteEvent: RemoteEvent): Promise<DocumentMap>; +/** + * Notifies local store of the changed views to locally pin documents. + */ +export declare function localStoreNotifyLocalViewChanges(localStore: LocalStore, viewChanges: LocalViewChanges[]): Promise<void>; +/** + * Gets the mutation batch after the passed in batchId in the mutation queue + * or null if empty. + * @param afterBatchId - If provided, the batch to search after. + * @returns The next mutation or null if there wasn't one. + */ +export declare function localStoreGetNextMutationBatch(localStore: LocalStore, afterBatchId?: BatchId): Promise<MutationBatch | null>; +/** + * Reads the current value of a Document with a given key or null if not + * found - used for testing. + */ +export declare function localStoreReadDocument(localStore: LocalStore, key: DocumentKey): Promise<Document>; +/** + * Assigns the given target an internal ID so that its results can be pinned so + * they don't get GC'd. A target must be allocated in the local store before + * the store can be used to manage its view. + * + * Allocating an already allocated `Target` will return the existing `TargetData` + * for that `Target`. + */ +export declare function localStoreAllocateTarget(localStore: LocalStore, target: Target): Promise<TargetData>; +/** + * Returns the TargetData as seen by the LocalStore, including updates that may + * have not yet been persisted to the TargetCache. + */ +export declare function localStoreGetTargetData(localStore: LocalStore, transaction: PersistenceTransaction, target: Target): PersistencePromise<TargetData | null>; +/** + * Unpins all the documents associated with the given target. If + * `keepPersistedTargetData` is set to false and Eager GC enabled, the method + * directly removes the associated target data from the target cache. + * + * Releasing a non-existing `Target` is a no-op. + */ +export declare function localStoreReleaseTarget(localStore: LocalStore, targetId: number, keepPersistedTargetData: boolean): Promise<void>; +/** + * Runs the specified query against the local store and returns the results, + * potentially taking advantage of query data from previous executions (such + * as the set of remote keys). + * + * @param usePreviousResults - Whether results from previous executions can + * be used to optimize this query execution. + */ +export declare function localStoreExecuteQuery(localStore: LocalStore, query: Query, usePreviousResults: boolean): Promise<QueryResult>; +/** Returns the local view of the documents affected by a mutation batch. */ +export declare function localStoreLookupMutationDocuments(localStore: LocalStore, batchId: BatchId): Promise<DocumentMap | null>; +export declare function localStoreRemoveCachedMutationBatchMetadata(localStore: LocalStore, batchId: BatchId): void; +export declare function localStoreGetActiveClients(localStore: LocalStore): Promise<ClientId[]>; +export declare function localStoreGetCachedTarget(localStore: LocalStore, targetId: TargetId): Promise<Target | null>; +/** + * Returns the set of documents that have been updated since the last call. + * If this is the first call, returns the set of changes since client + * initialization. Further invocations will return document that have changed + * since the prior call. + */ +export declare function localStoreGetNewDocumentChanges(localStore: LocalStore, collectionGroup: string): Promise<DocumentMap>; +/** + * Applies the documents from a bundle to the "ground-state" (remote) + * documents. + * + * LocalDocuments are re-calculated if there are remaining mutations in the + * queue. + */ +export declare function localStoreApplyBundledDocuments(localStore: LocalStore, bundleConverter: BundleConverter, documents: BundledDocuments, bundleName: string): Promise<DocumentMap>; +/** + * Returns a promise of a boolean to indicate if the given bundle has already + * been loaded and the create time is newer than the current loading bundle. + */ +export declare function localStoreHasNewerBundle(localStore: LocalStore, bundleMetadata: BundleMetadata): Promise<boolean>; +/** + * Saves the given `BundleMetadata` to local persistence. + */ +export declare function localStoreSaveBundle(localStore: LocalStore, bundleMetadata: BundleMetadata): Promise<void>; +/** + * Returns a promise of a `NamedQuery` associated with given query name. Promise + * resolves to undefined if no persisted data can be found. + */ +export declare function localStoreGetNamedQuery(localStore: LocalStore, queryName: string): Promise<NamedQuery | undefined>; +/** + * Saves the given `NamedQuery` to local persistence. + */ +export declare function localStoreSaveNamedQuery(localStore: LocalStore, query: ProtoNamedQuery, documents?: DocumentKeySet): Promise<void>; +export declare function localStoreConfigureFieldIndexes(localStore: LocalStore, newFieldIndexes: FieldIndex[]): Promise<void>; +export declare function localStoreSetIndexAutoCreationEnabled(localStore: LocalStore, isEnabled: boolean): void; +export declare function localStoreDeleteAllFieldIndexes(localStore: LocalStore): Promise<void>; +/** + * Test-only hooks into the SDK for use exclusively by tests. + */ +export declare class TestingHooks { + private constructor(); + static setIndexAutoCreationSettings(localStore: LocalStore, settings: { + indexAutoCreationMinCollectionSize?: number; + relativeIndexReadCostPerDocument?: number; + }): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/local_view_changes.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/local_view_changes.d.ts new file mode 100644 index 0000000..0448fb1 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/local_view_changes.d.ts @@ -0,0 +1,32 @@ +/** + * @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 { TargetId } from '../core/types'; +import { ViewSnapshot } from '../core/view_snapshot'; +import { DocumentKeySet } from '../model/collections'; +/** + * A set of changes to what documents are currently in view and out of view for + * a given query. These changes are sent to the LocalStore by the View (via + * the SyncEngine) and are used to pin / unpin documents as appropriate. + */ +export declare class LocalViewChanges { + readonly targetId: TargetId; + readonly fromCache: boolean; + readonly addedKeys: DocumentKeySet; + readonly removedKeys: DocumentKeySet; + constructor(targetId: TargetId, fromCache: boolean, addedKeys: DocumentKeySet, removedKeys: DocumentKeySet); + static fromSnapshot(targetId: TargetId, viewSnapshot: ViewSnapshot): LocalViewChanges; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/lru_garbage_collector.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/lru_garbage_collector.d.ts new file mode 100644 index 0000000..9ba755c --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/lru_garbage_collector.d.ts @@ -0,0 +1,102 @@ +/** + * @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 { ListenSequenceNumber, TargetId } from '../core/types'; +import { SortedMap } from '../util/sorted_map'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +import { TargetData } from './target_data'; +/** + * Describes a map whose keys are active target ids. We do not care about the type of the + * values. + */ +export type ActiveTargets = SortedMap<TargetId, unknown>; +export declare const GC_DID_NOT_RUN: LruResults; +export declare const LRU_COLLECTION_DISABLED = -1; +export declare const LRU_DEFAULT_CACHE_SIZE_BYTES: number; +export declare class LruParams { + readonly cacheSizeCollectionThreshold: number; + readonly percentileToCollect: number; + readonly maximumSequenceNumbersToCollect: number; + private static readonly DEFAULT_COLLECTION_PERCENTILE; + private static readonly DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT; + static withCacheSize(cacheSize: number): LruParams; + static readonly DEFAULT: LruParams; + static readonly DISABLED: LruParams; + constructor(cacheSizeCollectionThreshold: number, percentileToCollect: number, maximumSequenceNumbersToCollect: number); +} +export interface LruGarbageCollector { + readonly params: LruParams; + collect(txn: PersistenceTransaction, activeTargetIds: ActiveTargets): PersistencePromise<LruResults>; + /** Given a percentile of target to collect, returns the number of targets to collect. */ + calculateTargetCount(txn: PersistenceTransaction, percentile: number): PersistencePromise<number>; + /** Returns the nth sequence number, counting in order from the smallest. */ + nthSequenceNumber(txn: PersistenceTransaction, n: number): PersistencePromise<number>; + /** + * Removes documents that have a sequence number equal to or less than the + * upper bound and are not otherwise pinned. + */ + removeOrphanedDocuments(txn: PersistenceTransaction, upperBound: ListenSequenceNumber): PersistencePromise<number>; + getCacheSize(txn: PersistenceTransaction): PersistencePromise<number>; + /** + * Removes targets with a sequence number equal to or less than the given + * upper bound, and removes document associations with those targets. + */ + removeTargets(txn: PersistenceTransaction, upperBound: ListenSequenceNumber, activeTargetIds: ActiveTargets): PersistencePromise<number>; +} +/** + * Describes the results of a garbage collection run. `didRun` will be set to + * `false` if collection was skipped (either it is disabled or the cache size + * has not hit the threshold). If collection ran, the other fields will be + * filled in with the details of the results. + */ +export interface LruResults { + readonly didRun: boolean; + readonly sequenceNumbersCollected: number; + readonly targetsRemoved: number; + readonly documentsRemoved: number; +} +/** + * Persistence layers intending to use LRU Garbage collection should have + * reference delegates that implement this interface. This interface defines the + * operations that the LRU garbage collector needs from the persistence layer. + */ +export interface LruDelegate { + readonly garbageCollector: LruGarbageCollector; + /** Enumerates all the targets in the TargetCache. */ + forEachTarget(txn: PersistenceTransaction, f: (target: TargetData) => void): PersistencePromise<void>; + getSequenceNumberCount(txn: PersistenceTransaction): PersistencePromise<number>; + /** + * Enumerates sequence numbers for documents not associated with a target. + * Note that this may include duplicate sequence numbers. + */ + forEachOrphanedDocumentSequenceNumber(txn: PersistenceTransaction, f: (sequenceNumber: ListenSequenceNumber) => void): PersistencePromise<void>; + /** + * Removes all targets that have a sequence number less than or equal to + * `upperBound`, and are not present in the `activeTargetIds` set. + * + * @returns the number of targets removed. + */ + removeTargets(txn: PersistenceTransaction, upperBound: ListenSequenceNumber, activeTargetIds: ActiveTargets): PersistencePromise<number>; + /** + * Removes all unreferenced documents from the cache that have a sequence + * number less than or equal to the given `upperBound`. + * + * @returns the number of documents removed. + */ + removeOrphanedDocuments(txn: PersistenceTransaction, upperBound: ListenSequenceNumber): PersistencePromise<number>; + getCacheSize(txn: PersistenceTransaction): PersistencePromise<number>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/lru_garbage_collector_impl.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/lru_garbage_collector_impl.d.ts new file mode 100644 index 0000000..f4ab1a5 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/lru_garbage_collector_impl.d.ts @@ -0,0 +1,37 @@ +/** + * @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 { AsyncQueue } from '../util/async_queue'; +import { LocalStore } from './local_store'; +import { LruDelegate, LruGarbageCollector, LruParams } from './lru_garbage_collector'; +import { Scheduler } from './persistence'; +export declare const LRU_MINIMUM_CACHE_SIZE_BYTES: number; +/** + * This class is responsible for the scheduling of LRU garbage collection. It handles checking + * whether or not GC is enabled, as well as which delay to use before the next run. + */ +export declare class LruScheduler implements Scheduler { + private readonly garbageCollector; + private readonly asyncQueue; + private readonly localStore; + private gcTask; + constructor(garbageCollector: LruGarbageCollector, asyncQueue: AsyncQueue, localStore: LocalStore); + start(): void; + stop(): void; + get started(): boolean; + private scheduleGC; +} +export declare function newLruGarbageCollector(delegate: LruDelegate, params: LruParams): LruGarbageCollector; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_bundle_cache.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_bundle_cache.d.ts new file mode 100644 index 0000000..972d4fc --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_bundle_cache.d.ts @@ -0,0 +1,32 @@ +/** + * @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 { BundleMetadata, NamedQuery } from '../core/bundle'; +import { NamedQuery as ProtoNamedQuery, BundleMetadata as ProtoBundleMetadata } from '../protos/firestore_bundle_proto'; +import { BundleCache } from './bundle_cache'; +import { LocalSerializer } from './local_serializer'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +export declare class MemoryBundleCache implements BundleCache { + private serializer; + private bundles; + private namedQueries; + constructor(serializer: LocalSerializer); + getBundleMetadata(transaction: PersistenceTransaction, bundleId: string): PersistencePromise<BundleMetadata | undefined>; + saveBundleMetadata(transaction: PersistenceTransaction, bundleMetadata: ProtoBundleMetadata): PersistencePromise<void>; + getNamedQuery(transaction: PersistenceTransaction, queryName: string): PersistencePromise<NamedQuery | undefined>; + saveNamedQuery(transaction: PersistenceTransaction, query: ProtoNamedQuery): PersistencePromise<void>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_document_overlay_cache.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_document_overlay_cache.d.ts new file mode 100644 index 0000000..b6ee945 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_document_overlay_cache.d.ts @@ -0,0 +1,37 @@ +/** + * @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 { DocumentKeySet, MutationMap, OverlayMap } from '../model/collections'; +import { DocumentKey } from '../model/document_key'; +import { Overlay } from '../model/overlay'; +import { ResourcePath } from '../model/path'; +import { DocumentOverlayCache } from './document_overlay_cache'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +/** + * An in-memory implementation of DocumentOverlayCache. + */ +export declare class MemoryDocumentOverlayCache implements DocumentOverlayCache { + private overlays; + private overlayByBatchId; + getOverlay(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<Overlay | null>; + getOverlays(transaction: PersistenceTransaction, keys: DocumentKey[]): PersistencePromise<OverlayMap>; + saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: MutationMap): PersistencePromise<void>; + removeOverlaysForBatchId(transaction: PersistenceTransaction, documentKeys: DocumentKeySet, batchId: number): PersistencePromise<void>; + getOverlaysForCollection(transaction: PersistenceTransaction, collection: ResourcePath, sinceBatchId: number): PersistencePromise<OverlayMap>; + getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<OverlayMap>; + private saveOverlay; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_globals_cache.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_globals_cache.d.ts new file mode 100644 index 0000000..9877c67 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_globals_cache.d.ts @@ -0,0 +1,25 @@ +/** + * @license + * Copyright 2024 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 { ByteString } from '../util/byte_string'; +import { GlobalsCache } from './globals_cache'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +export declare class MemoryGlobalsCache implements GlobalsCache { + private sessionToken; + getSessionToken(transaction: PersistenceTransaction): PersistencePromise<ByteString>; + setSessionToken(transaction: PersistenceTransaction, sessionToken: ByteString): PersistencePromise<void>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_index_manager.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_index_manager.d.ts new file mode 100644 index 0000000..14ffd3d --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_index_manager.d.ts @@ -0,0 +1,55 @@ +/** + * @license + * Copyright 2019 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 { DocumentMap } from '../model/collections'; +import { DocumentKey } from '../model/document_key'; +import { FieldIndex, IndexOffset } from '../model/field_index'; +import { ResourcePath } from '../model/path'; +import { IndexManager, IndexType } from './index_manager'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +/** + * An in-memory implementation of IndexManager. + */ +export declare class MemoryIndexManager implements IndexManager { + private collectionParentIndex; + addToCollectionParentIndex(transaction: PersistenceTransaction, collectionPath: ResourcePath): PersistencePromise<void>; + getCollectionParents(transaction: PersistenceTransaction, collectionId: string): PersistencePromise<ResourcePath[]>; + addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>; + deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>; + deleteAllFieldIndexes(transaction: PersistenceTransaction): PersistencePromise<void>; + createTargetIndexes(transaction: PersistenceTransaction, target: Target): PersistencePromise<void>; + getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKey[] | null>; + getIndexType(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexType>; + getFieldIndexes(transaction: PersistenceTransaction, collectionGroup?: string): PersistencePromise<FieldIndex[]>; + getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>; + getMinOffset(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexOffset>; + getMinOffsetFromCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string): PersistencePromise<IndexOffset>; + updateCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset): PersistencePromise<void>; + updateIndexEntries(transaction: PersistenceTransaction, documents: DocumentMap): PersistencePromise<void>; +} +/** + * Internal implementation of the collection-parent index exposed by MemoryIndexManager. + * Also used for in-memory caching by IndexedDbIndexManager and initial index population + * in indexeddb_schema.ts + */ +export declare class MemoryCollectionParentIndex { + private index; + add(collectionPath: ResourcePath): boolean; + has(collectionPath: ResourcePath): boolean; + getEntries(collectionId: string): ResourcePath[]; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_mutation_queue.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_mutation_queue.d.ts new file mode 100644 index 0000000..ad685f9 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_mutation_queue.d.ts @@ -0,0 +1,80 @@ +/** + * @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 { Query } from '../core/query'; +import { BatchId } from '../core/types'; +import { Timestamp } from '../lite-api/timestamp'; +import { DocumentKey } from '../model/document_key'; +import { Mutation } from '../model/mutation'; +import { MutationBatch } from '../model/mutation_batch'; +import { SortedMap } from '../util/sorted_map'; +import { IndexManager } from './index_manager'; +import { MutationQueue } from './mutation_queue'; +import { ReferenceDelegate } from './persistence'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +export declare class MemoryMutationQueue implements MutationQueue { + private readonly indexManager; + private readonly referenceDelegate; + /** + * The set of all mutations that have been sent but not yet been applied to + * the backend. + */ + private mutationQueue; + /** Next value to use when assigning sequential IDs to each mutation batch. */ + private nextBatchId; + /** An ordered mapping between documents and the mutations batch IDs. */ + private batchesByDocumentKey; + constructor(indexManager: IndexManager, referenceDelegate: ReferenceDelegate); + checkEmpty(transaction: PersistenceTransaction): PersistencePromise<boolean>; + addMutationBatch(transaction: PersistenceTransaction, localWriteTime: Timestamp, baseMutations: Mutation[], mutations: Mutation[]): PersistencePromise<MutationBatch>; + lookupMutationBatch(transaction: PersistenceTransaction, batchId: BatchId): PersistencePromise<MutationBatch | null>; + getNextMutationBatchAfterBatchId(transaction: PersistenceTransaction, batchId: BatchId): PersistencePromise<MutationBatch | null>; + getHighestUnacknowledgedBatchId(): PersistencePromise<BatchId>; + getAllMutationBatches(transaction: PersistenceTransaction): PersistencePromise<MutationBatch[]>; + getAllMutationBatchesAffectingDocumentKey(transaction: PersistenceTransaction, documentKey: DocumentKey): PersistencePromise<MutationBatch[]>; + getAllMutationBatchesAffectingDocumentKeys(transaction: PersistenceTransaction, documentKeys: SortedMap<DocumentKey, unknown>): PersistencePromise<MutationBatch[]>; + getAllMutationBatchesAffectingQuery(transaction: PersistenceTransaction, query: Query): PersistencePromise<MutationBatch[]>; + private findMutationBatches; + removeMutationBatch(transaction: PersistenceTransaction, batch: MutationBatch): PersistencePromise<void>; + removeCachedMutationKeys(batchId: BatchId): void; + containsKey(txn: PersistenceTransaction, key: DocumentKey): PersistencePromise<boolean>; + performConsistencyCheck(txn: PersistenceTransaction): PersistencePromise<void>; + /** + * Finds the index of the given batchId in the mutation queue and asserts that + * the resulting index is within the bounds of the queue. + * + * @param batchId - The batchId to search for + * @param action - A description of what the caller is doing, phrased in passive + * form (e.g. "acknowledged" in a routine that acknowledges batches). + */ + private indexOfExistingBatchId; + /** + * Finds the index of the given batchId in the mutation queue. This operation + * is O(1). + * + * @returns The computed index of the batch with the given batchId, based on + * the state of the queue. Note this index can be negative if the requested + * batchId has already been removed from the queue or past the end of the + * queue if the batchId is larger than the last added batch. + */ + private indexOfBatchId; + /** + * A version of lookupMutationBatch that doesn't return a promise, this makes + * other functions that uses this code easier to read and more efficient. + */ + private findMutationBatch; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_persistence.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_persistence.d.ts new file mode 100644 index 0000000..051c94b --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_persistence.d.ts @@ -0,0 +1,134 @@ +/** + * @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 { User } from '../auth/user'; +import { ListenSequenceNumber, TargetId } from '../core/types'; +import { Document } from '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { JsonProtoSerializer } from '../remote/serializer'; +import { DocumentOverlayCache } from './document_overlay_cache'; +import { GlobalsCache } from './globals_cache'; +import { IndexManager } from './index_manager'; +import { ActiveTargets, LruDelegate, LruGarbageCollector, LruParams } from './lru_garbage_collector'; +import { MemoryBundleCache } from './memory_bundle_cache'; +import { MemoryIndexManager } from './memory_index_manager'; +import { MemoryRemoteDocumentCache } from './memory_remote_document_cache'; +import { MemoryTargetCache } from './memory_target_cache'; +import { MutationQueue } from './mutation_queue'; +import { Persistence, ReferenceDelegate } from './persistence'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction, PersistenceTransactionMode } from './persistence_transaction'; +import { TargetData } from './target_data'; +/** + * A memory-backed instance of Persistence. Data is stored only in RAM and + * not persisted across sessions. + */ +export declare class MemoryPersistence implements Persistence { + /** + * Note that these are retained here to make it easier to write tests + * affecting both the in-memory and IndexedDB-backed persistence layers. Tests + * can create a new LocalStore wrapping this Persistence instance and this + * will make the in-memory persistence layer behave as if it were actually + * persisting values. + */ + private readonly indexManager; + private readonly globalsCache; + private mutationQueues; + private overlays; + private readonly remoteDocumentCache; + private readonly targetCache; + private readonly bundleCache; + private readonly listenSequence; + private serializer; + private _started; + readonly referenceDelegate: MemoryReferenceDelegate; + /** + * The constructor accepts a factory for creating a reference delegate. This + * allows both the delegate and this instance to have strong references to + * each other without having nullable fields that would then need to be + * checked or asserted on every access. + */ + constructor(referenceDelegateFactory: (p: MemoryPersistence) => MemoryReferenceDelegate, serializer: JsonProtoSerializer); + start(): Promise<void>; + shutdown(): Promise<void>; + get started(): boolean; + setDatabaseDeletedListener(): void; + setNetworkEnabled(): void; + getIndexManager(user: User): MemoryIndexManager; + getDocumentOverlayCache(user: User): DocumentOverlayCache; + getMutationQueue(user: User, indexManager: IndexManager): MutationQueue; + getGlobalsCache(): GlobalsCache; + getTargetCache(): MemoryTargetCache; + getRemoteDocumentCache(): MemoryRemoteDocumentCache; + getBundleCache(): MemoryBundleCache; + runTransaction<T>(action: string, mode: PersistenceTransactionMode, transactionOperation: (transaction: PersistenceTransaction) => PersistencePromise<T>): Promise<T>; + mutationQueuesContainKey(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<boolean>; +} +/** + * Memory persistence is not actually transactional, but future implementations + * may have transaction-scoped state. + */ +export declare class MemoryTransaction extends PersistenceTransaction { + readonly currentSequenceNumber: ListenSequenceNumber; + constructor(currentSequenceNumber: ListenSequenceNumber); +} +export interface MemoryReferenceDelegate extends ReferenceDelegate { + documentSize(doc: Document): number; + onTransactionStarted(): void; + onTransactionCommitted(txn: PersistenceTransaction): PersistencePromise<void>; +} +export declare class MemoryEagerDelegate implements MemoryReferenceDelegate { + private readonly persistence; + /** Tracks all documents that are active in Query views. */ + private localViewReferences; + /** The list of documents that are potentially GCed after each transaction. */ + private _orphanedDocuments; + private constructor(); + static factory(persistence: MemoryPersistence): MemoryEagerDelegate; + private get orphanedDocuments(); + addReference(txn: PersistenceTransaction, targetId: TargetId, key: DocumentKey): PersistencePromise<void>; + removeReference(txn: PersistenceTransaction, targetId: TargetId, key: DocumentKey): PersistencePromise<void>; + markPotentiallyOrphaned(txn: PersistenceTransaction, key: DocumentKey): PersistencePromise<void>; + removeTarget(txn: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + onTransactionStarted(): void; + onTransactionCommitted(txn: PersistenceTransaction): PersistencePromise<void>; + updateLimboDocument(txn: PersistenceTransaction, key: DocumentKey): PersistencePromise<void>; + documentSize(doc: Document): number; + private isReferenced; +} +export declare class MemoryLruDelegate implements ReferenceDelegate, LruDelegate { + private readonly persistence; + private orphanedSequenceNumbers; + readonly garbageCollector: LruGarbageCollector; + constructor(persistence: MemoryPersistence, lruParams: LruParams); + static factory(persistence: MemoryPersistence, lruParams: LruParams): MemoryLruDelegate; + onTransactionStarted(): void; + onTransactionCommitted(txn: PersistenceTransaction): PersistencePromise<void>; + forEachTarget(txn: PersistenceTransaction, f: (q: TargetData) => void): PersistencePromise<void>; + getSequenceNumberCount(txn: PersistenceTransaction): PersistencePromise<number>; + private orphanedDocumentCount; + forEachOrphanedDocumentSequenceNumber(txn: PersistenceTransaction, f: (sequenceNumber: ListenSequenceNumber) => void): PersistencePromise<void>; + removeTargets(txn: PersistenceTransaction, upperBound: ListenSequenceNumber, activeTargetIds: ActiveTargets): PersistencePromise<number>; + removeOrphanedDocuments(txn: PersistenceTransaction, upperBound: ListenSequenceNumber): PersistencePromise<number>; + markPotentiallyOrphaned(txn: PersistenceTransaction, key: DocumentKey): PersistencePromise<void>; + removeTarget(txn: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + addReference(txn: PersistenceTransaction, targetId: TargetId, key: DocumentKey): PersistencePromise<void>; + removeReference(txn: PersistenceTransaction, targetId: TargetId, key: DocumentKey): PersistencePromise<void>; + updateLimboDocument(txn: PersistenceTransaction, key: DocumentKey): PersistencePromise<void>; + documentSize(document: Document): number; + private isPinned; + getCacheSize(txn: PersistenceTransaction): PersistencePromise<number>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_remote_document_cache.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_remote_document_cache.d.ts new file mode 100644 index 0000000..7752914 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_remote_document_cache.d.ts @@ -0,0 +1,33 @@ +/** + * @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 '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +import { RemoteDocumentCache } from './remote_document_cache'; +export type DocumentSizer = (doc: Document) => number; +export interface MemoryRemoteDocumentCache extends RemoteDocumentCache { + forEachDocumentKey(transaction: PersistenceTransaction, f: (key: DocumentKey) => PersistencePromise<void>): PersistencePromise<void>; +} +/** + * Creates a new memory-only RemoteDocumentCache. + * + * @param sizer - Used to assess the size of a document. For eager GC, this is + * expected to just return 0 to avoid unnecessarily doing the work of + * calculating the size. + */ +export declare function newMemoryRemoteDocumentCache(sizer: DocumentSizer): MemoryRemoteDocumentCache; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_target_cache.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_target_cache.d.ts new file mode 100644 index 0000000..4539d62 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/memory_target_cache.d.ts @@ -0,0 +1,65 @@ +/** + * @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 { Target } from '../core/target'; +import { ListenSequenceNumber, TargetId } from '../core/types'; +import { DocumentKeySet } from '../model/collections'; +import { DocumentKey } from '../model/document_key'; +import { ActiveTargets } from './lru_garbage_collector'; +import { Persistence } from './persistence'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +import { TargetCache } from './target_cache'; +import { TargetData } from './target_data'; +export declare class MemoryTargetCache implements TargetCache { + private readonly persistence; + /** + * Maps a target to the data about that target + */ + private targets; + /** The last received snapshot version. */ + private lastRemoteSnapshotVersion; + /** The highest numbered target ID encountered. */ + private highestTargetId; + /** The highest sequence number encountered. */ + private highestSequenceNumber; + /** + * A ordered bidirectional mapping between documents and the remote target + * IDs. + */ + private references; + private targetCount; + private targetIdGenerator; + constructor(persistence: Persistence); + forEachTarget(txn: PersistenceTransaction, f: (q: TargetData) => void): PersistencePromise<void>; + getLastRemoteSnapshotVersion(transaction: PersistenceTransaction): PersistencePromise<SnapshotVersion>; + getHighestSequenceNumber(transaction: PersistenceTransaction): PersistencePromise<ListenSequenceNumber>; + allocateTargetId(transaction: PersistenceTransaction): PersistencePromise<TargetId>; + setTargetsMetadata(transaction: PersistenceTransaction, highestListenSequenceNumber: number, lastRemoteSnapshotVersion?: SnapshotVersion): PersistencePromise<void>; + private saveTargetData; + addTargetData(transaction: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + updateTargetData(transaction: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + removeTargetData(transaction: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + removeTargets(transaction: PersistenceTransaction, upperBound: ListenSequenceNumber, activeTargetIds: ActiveTargets): PersistencePromise<number>; + getTargetCount(transaction: PersistenceTransaction): PersistencePromise<number>; + getTargetData(transaction: PersistenceTransaction, target: Target): PersistencePromise<TargetData | null>; + addMatchingKeys(txn: PersistenceTransaction, keys: DocumentKeySet, targetId: TargetId): PersistencePromise<void>; + removeMatchingKeys(txn: PersistenceTransaction, keys: DocumentKeySet, targetId: TargetId): PersistencePromise<void>; + removeMatchingKeysForTargetId(txn: PersistenceTransaction, targetId: TargetId): PersistencePromise<void>; + getMatchingKeysForTargetId(txn: PersistenceTransaction, targetId: TargetId): PersistencePromise<DocumentKeySet>; + containsKey(txn: PersistenceTransaction, key: DocumentKey): PersistencePromise<boolean>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/mutation_queue.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/mutation_queue.d.ts new file mode 100644 index 0000000..2f7b2dd --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/mutation_queue.d.ts @@ -0,0 +1,123 @@ +/** + * @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 { Query } from '../core/query'; +import { BatchId } from '../core/types'; +import { Timestamp } from '../lite-api/timestamp'; +import { DocumentKey } from '../model/document_key'; +import { Mutation } from '../model/mutation'; +import { MutationBatch } from '../model/mutation_batch'; +import { SortedMap } from '../util/sorted_map'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +/** A queue of mutations to apply to the remote store. */ +export interface MutationQueue { + /** Returns true if this queue contains no mutation batches. */ + checkEmpty(transaction: PersistenceTransaction): PersistencePromise<boolean>; + /** + * Creates a new mutation batch and adds it to this mutation queue. + * + * @param transaction - The transaction this operation is scoped to. + * @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. These mutations are used to locally + * overwrite values that are persisted in the remote document cache. + * @param mutations - The user-provided mutations in this mutation batch. + */ + addMutationBatch(transaction: PersistenceTransaction, localWriteTime: Timestamp, baseMutations: Mutation[], mutations: Mutation[]): PersistencePromise<MutationBatch>; + /** + * Loads the mutation batch with the given batchId. + */ + lookupMutationBatch(transaction: PersistenceTransaction, batchId: BatchId): PersistencePromise<MutationBatch | null>; + /** + * Gets the first unacknowledged mutation batch after the passed in batchId + * in the mutation queue or null if empty. + * + * @param batchId - The batch to search after, or BATCHID_UNKNOWN for the + * first mutation in the queue. + * + * @returns the next mutation or null if there wasn't one. + */ + getNextMutationBatchAfterBatchId(transaction: PersistenceTransaction, batchId: BatchId): PersistencePromise<MutationBatch | null>; + /** + * Gets the largest (latest) batch id in mutation queue for the current user + * that is pending server response, returns `BATCHID_UNKNOWN` if the queue is + * empty. + * + * @returns the largest batch id in the mutation queue that is not + * acknowledged. + */ + getHighestUnacknowledgedBatchId(transaction: PersistenceTransaction): PersistencePromise<BatchId>; + /** Gets all mutation batches in the mutation queue. */ + getAllMutationBatches(transaction: PersistenceTransaction): PersistencePromise<MutationBatch[]>; + /** + * Finds all mutation batches that could possibly affect the given + * document key. Not all mutations in a batch will necessarily affect the + * document key, so when looping through the batch you'll need to check that + * the mutation itself matches the key. + * + * Batches are guaranteed to be in sorted order. + * + * Note that because of this requirement implementations are free to return + * mutation batches that don't contain the document key at all if it's + * convenient. + */ + getAllMutationBatchesAffectingDocumentKey(transaction: PersistenceTransaction, documentKey: DocumentKey): PersistencePromise<MutationBatch[]>; + /** + * Finds all mutation batches that could possibly affect the given set of + * document keys. Not all mutations in a batch will necessarily affect each + * key, so when looping through the batch you'll need to check that the + * mutation itself matches the key. + * + * Batches are guaranteed to be in sorted order. + * + * Note that because of this requirement implementations are free to return + * mutation batches that don't contain any of the document keys at all if it's + * convenient. + */ + getAllMutationBatchesAffectingDocumentKeys(transaction: PersistenceTransaction, documentKeys: SortedMap<DocumentKey, unknown>): PersistencePromise<MutationBatch[]>; + /** + * Finds all mutation batches that could affect the results for the given + * query. Not all mutations in a batch will necessarily affect the query, so + * when looping through the batch you'll need to check that the mutation + * itself matches the query. + * + * Batches are guaranteed to be in sorted order. + * + * Note that because of this requirement implementations are free to return + * mutation batches that don't match the query at all if it's convenient. + * + * NOTE: A PatchMutation does not need to include all fields in the query + * filter criteria in order to be a match (but any fields it does contain do + * need to match). + */ + getAllMutationBatchesAffectingQuery(transaction: PersistenceTransaction, query: Query): PersistencePromise<MutationBatch[]>; + /** + * Removes the given mutation batch from the queue. This is useful in two + * circumstances: + * + * + Removing an applied mutation from the head of the queue + * + Removing a rejected mutation from anywhere in the queue + * + * Multi-Tab Note: This operation should only be called by the primary client. + */ + removeMutationBatch(transaction: PersistenceTransaction, batch: MutationBatch): PersistencePromise<void>; + /** + * Performs a consistency check, examining the mutation queue for any + * leaks, if possible. + */ + performConsistencyCheck(transaction: PersistenceTransaction): PersistencePromise<void>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/overlayed_document.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/overlayed_document.d.ts new file mode 100644 index 0000000..56a3286 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/overlayed_document.d.ts @@ -0,0 +1,40 @@ +/** + * @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 { Document } from '../model/document'; +import { FieldMask } from '../model/field_mask'; +/** + * Represents a local view (overlay) of a document, and the fields that are + * locally mutated. + */ +export declare class OverlayedDocument { + readonly overlayedDocument: Document; + /** + * The fields that are locally mutated by patch mutations. + * + * If the overlayed document is from set or delete mutations, this is `null`. + * If there is no overlay (mutation) for the document, this is an empty `FieldMask`. + */ + readonly mutatedFields: FieldMask | null; + constructor(overlayedDocument: Document, + /** + * The fields that are locally mutated by patch mutations. + * + * If the overlayed document is from set or delete mutations, this is `null`. + * If there is no overlay (mutation) for the document, this is an empty `FieldMask`. + */ + mutatedFields: FieldMask | null); +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/persistence.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/persistence.d.ts new file mode 100644 index 0000000..0360173 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/persistence.d.ts @@ -0,0 +1,217 @@ +/** + * @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 { User } from '../auth/user'; +import { TargetId } from '../core/types'; +import { DocumentKey } from '../model/document_key'; +import { BundleCache } from './bundle_cache'; +import { DocumentOverlayCache } from './document_overlay_cache'; +import { GlobalsCache } from './globals_cache'; +import { IndexManager } from './index_manager'; +import { MutationQueue } from './mutation_queue'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction, PersistenceTransactionMode } from './persistence_transaction'; +import { RemoteDocumentCache } from './remote_document_cache'; +import { TargetCache } from './target_cache'; +import { TargetData } from './target_data'; +/** + * Callback type for primary state notifications. This callback can be + * registered with the persistence layer to get notified when we transition from + * primary to secondary state and vice versa. + * + * Note: Instances can only toggle between Primary and Secondary state if + * IndexedDB persistence is enabled and multiple clients are active. If this + * listener is registered with MemoryPersistence, the callback will be called + * exactly once marking the current instance as Primary. + */ +export type PrimaryStateListener = (isPrimary: boolean) => Promise<void>; +/** + * A ReferenceDelegate instance handles all of the hooks into the document-reference lifecycle. This + * includes being added to a target, being removed from a target, being subject to mutation, and + * being mutated by the user. + * + * Different implementations may do different things with each of these events. Not every + * implementation needs to do something with every lifecycle hook. + * + * PORTING NOTE: since sequence numbers are attached to transactions in this + * client, the ReferenceDelegate does not need to deal in transactional + * semantics (onTransactionStarted/Committed()), nor does it need to track and + * generate sequence numbers (getCurrentSequenceNumber()). + */ +export interface ReferenceDelegate { + /** Notify the delegate that the given document was added to a target. */ + addReference(txn: PersistenceTransaction, targetId: TargetId, doc: DocumentKey): PersistencePromise<void>; + /** Notify the delegate that the given document was removed from a target. */ + removeReference(txn: PersistenceTransaction, targetId: TargetId, doc: DocumentKey): PersistencePromise<void>; + /** + * Notify the delegate that a target was removed. The delegate may, but is not obligated to, + * actually delete the target and associated data. + */ + removeTarget(txn: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + /** + * Notify the delegate that a document may no longer be part of any views or + * have any mutations associated. + */ + markPotentiallyOrphaned(txn: PersistenceTransaction, doc: DocumentKey): PersistencePromise<void>; + /** Notify the delegate that a limbo document was updated. */ + updateLimboDocument(txn: PersistenceTransaction, doc: DocumentKey): PersistencePromise<void>; +} +/** + * Persistence is the lowest-level shared interface to persistent storage in + * Firestore. + * + * Persistence is used to create MutationQueue and RemoteDocumentCache + * instances backed by persistence (which might be in-memory or LevelDB). + * + * Persistence also exposes an API to create and run PersistenceTransactions + * against persistence. All read / write operations must be wrapped in a + * transaction. Implementations of PersistenceTransaction / Persistence only + * need to guarantee that writes made against the transaction are not made to + * durable storage until the transaction resolves its PersistencePromise. + * Since memory-only storage components do not alter durable storage, they are + * free to ignore the transaction. + * + * This contract is enough to allow the LocalStore be be written + * independently of whether or not the stored state actually is durably + * persisted. If persistent storage is enabled, writes are grouped together to + * avoid inconsistent state that could cause crashes. + * + * Concretely, when persistent storage is enabled, the persistent versions of + * MutationQueue, RemoteDocumentCache, and others (the mutators) will + * defer their writes into a transaction. Once the local store has completed + * one logical operation, it commits the transaction. + * + * When persistent storage is disabled, the non-persistent versions of the + * mutators ignore the transaction. This short-cut is allowed because + * memory-only storage leaves no state so it cannot be inconsistent. + * + * This simplifies the implementations of the mutators and allows memory-only + * implementations to supplement the persistent ones without requiring any + * special dual-store implementation of Persistence. The cost is that the + * LocalStore needs to be slightly careful about the order of its reads and + * writes in order to avoid relying on being able to read back uncommitted + * writes. + */ +export interface Persistence { + /** + * Whether or not this persistence instance has been started. + */ + readonly started: boolean; + readonly referenceDelegate: ReferenceDelegate; + /** Starts persistence. */ + start(): Promise<void>; + /** + * Releases any resources held during eager shutdown. + */ + shutdown(): Promise<void>; + /** + * Registers a listener that gets called when the database receives a + * version change event indicating that it has deleted. + * + * PORTING NOTE: This is only used for Web multi-tab. + */ + setDatabaseDeletedListener(databaseDeletedListener: () => Promise<void>): void; + /** + * Adjusts the current network state in the client's metadata, potentially + * affecting the primary lease. + * + * PORTING NOTE: This is only used for Web multi-tab. + */ + setNetworkEnabled(networkEnabled: boolean): void; + /** + * Returns GlobalCache representing a general purpose cache for global values. + */ + getGlobalsCache(): GlobalsCache; + /** + * Returns a MutationQueue representing the persisted mutations for the + * given user. + * + * Note: The implementation is free to return the same instance every time + * this is called for a given user. In particular, the memory-backed + * implementation does this to emulate the persisted implementation to the + * extent possible (e.g. in the case of uid switching from + * sally=>jack=>sally, sally's mutation queue will be preserved). + */ + getMutationQueue(user: User, indexManager: IndexManager): MutationQueue; + /** + * Returns a TargetCache representing the persisted cache of targets. + * + * Note: The implementation is free to return the same instance every time + * this is called. In particular, the memory-backed implementation does this + * to emulate the persisted implementation to the extent possible. + */ + getTargetCache(): TargetCache; + /** + * Returns a RemoteDocumentCache representing the persisted cache of remote + * documents. + * + * Note: The implementation is free to return the same instance every time + * this is called. In particular, the memory-backed implementation does this + * to emulate the persisted implementation to the extent possible. + */ + getRemoteDocumentCache(): RemoteDocumentCache; + /** + * Returns a BundleCache representing the persisted cache of loaded bundles. + * + * Note: The implementation is free to return the same instance every time + * this is called. In particular, the memory-backed implementation does this + * to emulate the persisted implementation to the extent possible. + */ + getBundleCache(): BundleCache; + /** + * Returns an IndexManager instance that manages our persisted query indexes. + * + * Note: The implementation is free to return the same instance every time + * this is called. In particular, the memory-backed implementation does this + * to emulate the persisted implementation to the extent possible. + */ + getIndexManager(user: User): IndexManager; + /** + * Returns a DocumentOverlayCache representing the documents that are mutated + * locally. + */ + getDocumentOverlayCache(user: User): DocumentOverlayCache; + /** + * Performs an operation inside a persistence transaction. Any reads or writes + * against persistence must be performed within a transaction. Writes will be + * committed atomically once the transaction completes. + * + * Persistence operations are asynchronous and therefore the provided + * transactionOperation must return a PersistencePromise. When it is resolved, + * the transaction will be committed and the Promise returned by this method + * will resolve. + * + * @param action - A description of the action performed by this transaction, + * used for logging. + * @param mode - The underlying mode of the IndexedDb transaction. Can be + * 'readonly', 'readwrite' or 'readwrite-primary'. Transactions marked + * 'readwrite-primary' can only be executed by the primary client. In this + * mode, the transactionOperation will not be run if the primary lease cannot + * be acquired and the returned promise will be rejected with a + * FAILED_PRECONDITION error. + * @param transactionOperation - The operation to run inside a transaction. + * @returns A `Promise` that is resolved once the transaction completes. + */ + runTransaction<T>(action: string, mode: PersistenceTransactionMode, transactionOperation: (transaction: PersistenceTransaction) => PersistencePromise<T>): Promise<T>; +} +/** + * Interface to schedule periodic tasks within SDK. + */ +export interface Scheduler { + readonly started: boolean; + start(): void; + stop(): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/persistence_promise.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/persistence_promise.d.ts new file mode 100644 index 0000000..3803123 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/persistence_promise.d.ts @@ -0,0 +1,83 @@ +/** + * @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 type FulfilledHandler<T, R> = ((result: T) => R | PersistencePromise<R>) | null; +export type RejectedHandler<R> = ((reason: Error) => R | PersistencePromise<R>) | null; +export type Resolver<T> = (value?: T) => void; +export type Rejector = (error: Error) => void; +/** + * PersistencePromise is essentially a re-implementation of Promise except + * it has a .next() method instead of .then() and .next() and .catch() callbacks + * are executed synchronously when a PersistencePromise resolves rather than + * asynchronously (Promise implementations use setImmediate() or similar). + * + * This is necessary to interoperate with IndexedDB which will automatically + * commit transactions if control is returned to the event loop without + * synchronously initiating another operation on the transaction. + * + * NOTE: .then() and .catch() only allow a single consumer, unlike normal + * Promises. + */ +export declare class PersistencePromise<T> { + private nextCallback; + private catchCallback; + private result; + private error; + private isDone; + private callbackAttached; + constructor(callback: (resolve: Resolver<T>, reject: Rejector) => void); + catch<R>(fn: (error: Error) => R | PersistencePromise<R>): PersistencePromise<R>; + next<R>(nextFn?: FulfilledHandler<T, R>, catchFn?: RejectedHandler<R>): PersistencePromise<R>; + toPromise(): Promise<T>; + private wrapUserFunction; + private wrapSuccess; + private wrapFailure; + static resolve(): PersistencePromise<void>; + static resolve<R>(result: R): PersistencePromise<R>; + static reject<R>(error: Error): PersistencePromise<R>; + static waitFor(all: { + forEach: (cb: (el: PersistencePromise<any>) => void) => void; + }): PersistencePromise<void>; + /** + * Given an array of predicate functions that asynchronously evaluate to a + * boolean, implements a short-circuiting `or` between the results. Predicates + * will be evaluated until one of them returns `true`, then stop. The final + * result will be whether any of them returned `true`. + */ + static or(predicates: Array<() => PersistencePromise<boolean>>): PersistencePromise<boolean>; + /** + * Given an iterable, call the given function on each element in the + * collection and wait for all of the resulting concurrent PersistencePromises + * to resolve. + */ + static forEach<R, S>(collection: { + forEach: (cb: (r: R, s: S) => void) => void; + }, f: ((r: R, s: S) => PersistencePromise<void>) | ((r: R) => PersistencePromise<void>)): PersistencePromise<void>; + static forEach<R>(collection: { + forEach: (cb: (r: R) => void) => void; + }, f: (r: R) => PersistencePromise<void>): PersistencePromise<void>; + /** + * Concurrently map all array elements through asynchronous function. + */ + static mapArray<T, U>(array: T[], f: (t: T) => PersistencePromise<U>): PersistencePromise<U[]>; + /** + * An alternative to recursive PersistencePromise calls, that avoids + * potential memory problems from unbounded chains of promises. + * + * The `action` will be called repeatedly while `condition` is true. + */ + static doWhile(condition: () => boolean, action: () => PersistencePromise<void>): PersistencePromise<void>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/persistence_transaction.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/persistence_transaction.d.ts new file mode 100644 index 0000000..d4da8b6 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/persistence_transaction.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 { ListenSequenceNumber } from '../core/types'; +export declare const PRIMARY_LEASE_LOST_ERROR_MSG: string; +/** The different modes supported by `Persistence.runTransaction()`. */ +export type PersistenceTransactionMode = 'readonly' | 'readwrite' | 'readwrite-primary'; +/** + * A base class representing a persistence transaction, encapsulating both the + * transaction's sequence numbers as well as a list of onCommitted listeners. + * + * When you call Persistence.runTransaction(), it will create a transaction and + * pass it to your callback. You then pass it to any method that operates + * on persistence. + */ +export declare abstract class PersistenceTransaction { + private readonly onCommittedListeners; + abstract readonly currentSequenceNumber: ListenSequenceNumber; + addOnCommittedListener(listener: () => void): void; + raiseOnCommittedEvent(): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/query_context.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/query_context.d.ts new file mode 100644 index 0000000..aeff2fa --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/query_context.d.ts @@ -0,0 +1,28 @@ +/** + * @license + * Copyright 2023 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. + */ +/** + * A tracker to keep a record of important details during database local query + * execution. + */ +export declare class QueryContext { + /** + * Counts the number of documents passed through during local query execution. + */ + private _documentReadCount; + get documentReadCount(): number; + incrementDocumentReadCount(amount: number): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/query_engine.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/query_engine.d.ts new file mode 100644 index 0000000..58148f1 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/query_engine.d.ts @@ -0,0 +1,110 @@ +/** + * @license + * Copyright 2019 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 { Query } from '../core/query'; +import { SnapshotVersion } from '../core/snapshot_version'; +import { DocumentKeySet, DocumentMap } from '../model/collections'; +import { IndexManager } from './index_manager'; +import { LocalDocumentsView } from './local_documents_view'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +import { QueryContext } from './query_context'; +/** + * The Firestore query engine. + * + * Firestore queries can be executed in three modes. The Query Engine determines + * what mode to use based on what data is persisted. The mode only determines + * the runtime complexity of the query - the result set is equivalent across all + * implementations. + * + * The Query engine will use indexed-based execution if a user has configured + * any index that can be used to execute query (via `setIndexConfiguration()`). + * Otherwise, the engine will try to optimize the query by re-using a previously + * persisted query result. If that is not possible, the query will be executed + * via a full collection scan. + * + * Index-based execution is the default when available. The query engine + * supports partial indexed execution and merges the result from the index + * lookup with documents that have not yet been indexed. The index evaluation + * matches the backend's format and as such, the SDK can use indexing for all + * queries that the backend supports. + * + * If no index exists, the query engine tries to take advantage of the target + * document mapping in the TargetCache. These mappings exists for all queries + * that have been synced with the backend at least once and allow the query + * engine to only read documents that previously matched a query plus any + * documents that were edited after the query was last listened to. + * + * There are some cases when this optimization is not guaranteed to produce + * the same results as full collection scans. In these cases, query + * processing falls back to full scans. These cases are: + * + * - Limit queries where a document that matched the query previously no longer + * matches the query. + * + * - Limit queries where a document edit may cause the document to sort below + * another document that is in the local cache. + * + * - Queries that have never been CURRENT or free of limbo documents. + */ +export declare class QueryEngine { + private localDocumentsView; + private indexManager; + private initialized; + indexAutoCreationEnabled: boolean; + /** + * SDK only decides whether it should create index when collection size is + * larger than this. + */ + indexAutoCreationMinCollectionSize: number; + relativeIndexReadCostPerDocument: number; + /** Sets the document view to query against. */ + initialize(localDocuments: LocalDocumentsView, indexManager: IndexManager): void; + /** Returns all local documents matching the specified query. */ + getDocumentsMatchingQuery(transaction: PersistenceTransaction, query: Query, lastLimboFreeSnapshotVersion: SnapshotVersion, remoteKeys: DocumentKeySet): PersistencePromise<DocumentMap>; + createCacheIndexes(transaction: PersistenceTransaction, query: Query, context: QueryContext, resultSize: number): PersistencePromise<void>; + /** + * Performs an indexed query that evaluates the query based on a collection's + * persisted index values. Returns `null` if an index is not available. + */ + private performQueryUsingIndex; + /** + * Performs a query based on the target's persisted query mapping. Returns + * `null` if the mapping is not available or cannot be used. + */ + private performQueryUsingRemoteKeys; + /** Applies the query filter and sorting to the provided documents. */ + private applyQuery; + /** + * Determines if a limit query needs to be refilled from cache, making it + * ineligible for index-free execution. + * + * @param query - The query. + * @param sortedPreviousResults - The documents that matched the query when it + * was last synchronized, sorted by the query's comparator. + * @param remoteKeys - The document keys that matched the query at the last + * snapshot. + * @param limboFreeSnapshotVersion - The version of the snapshot when the + * query was last synchronized. + */ + private needsRefill; + private executeFullCollectionScan; + /** + * Combines the results from an indexed execution with the remaining documents + * that have not yet been indexed. + */ + private appendRemainingResults; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/reference_set.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/reference_set.d.ts new file mode 100644 index 0000000..5ff71dc --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/reference_set.d.ts @@ -0,0 +1,68 @@ +/** + * @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 { BatchId, TargetId } from '../core/types'; +import { DocumentKeySet } from '../model/collections'; +import { DocumentKey } from '../model/document_key'; +/** + * A collection of references to a document from some kind of numbered entity + * (either a target ID or batch ID). As references are added to or removed from + * the set corresponding events are emitted to a registered garbage collector. + * + * Each reference is represented by a DocumentReference object. Each of them + * contains enough information to uniquely identify the reference. They are all + * stored primarily in a set sorted by key. A document is considered garbage if + * there's no references in that set (this can be efficiently checked thanks to + * sorting by key). + * + * ReferenceSet also keeps a secondary set that contains references sorted by + * IDs. This one is used to efficiently implement removal of all references by + * some target ID. + */ +export declare class ReferenceSet { + private refsByKey; + private refsByTarget; + /** Returns true if the reference set contains no references. */ + isEmpty(): boolean; + /** Adds a reference to the given document key for the given ID. */ + addReference(key: DocumentKey, id: TargetId | BatchId): void; + /** Add references to the given document keys for the given ID. */ + addReferences(keys: DocumentKeySet, id: TargetId | BatchId): void; + /** + * Removes a reference to the given document key for the given + * ID. + */ + removeReference(key: DocumentKey, id: TargetId | BatchId): void; + removeReferences(keys: DocumentKeySet, id: TargetId | BatchId): void; + /** + * Clears all references with a given ID. Calls removeRef() for each key + * removed. + */ + removeReferencesForId(id: TargetId | BatchId): DocumentKey[]; + removeAllReferences(): void; + private removeRef; + referencesForId(id: TargetId | BatchId): DocumentKeySet; + containsKey(key: DocumentKey): boolean; +} +export declare class DocReference { + key: DocumentKey; + targetOrBatchId: TargetId | BatchId; + constructor(key: DocumentKey, targetOrBatchId: TargetId | BatchId); + /** Compare by key then by ID */ + static compareByKey(left: DocReference, right: DocReference): number; + /** Compare by ID then by key */ + static compareByTargetId(left: DocReference, right: DocReference): number; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/remote_document_cache.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/remote_document_cache.d.ts new file mode 100644 index 0000000..abb9f3b --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/remote_document_cache.d.ts @@ -0,0 +1,91 @@ +/** + * @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 { Query } from '../core/query'; +import { DocumentKeySet, MutableDocumentMap, OverlayMap } from '../model/collections'; +import { MutableDocument } from '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { IndexOffset } from '../model/field_index'; +import { IndexManager } from './index_manager'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +import { QueryContext } from './query_context'; +import { RemoteDocumentChangeBuffer } from './remote_document_change_buffer'; +/** + * Represents cached documents received from the remote backend. + * + * The cache is keyed by DocumentKey and entries in the cache are + * MutableDocuments, meaning we can cache both actual documents as well as + * documents that are known to not exist. + */ +export interface RemoteDocumentCache { + /** Sets the index manager to use for managing the collectionGroup index. */ + setIndexManager(indexManager: IndexManager): void; + /** + * Looks up an entry in the cache. + * + * @param documentKey - The key of the entry to look up.* + * @returns The cached document entry. Returns an invalid document if the + * document is not cached. + */ + getEntry(transaction: PersistenceTransaction, documentKey: DocumentKey): PersistencePromise<MutableDocument>; + /** + * Looks up a set of entries in the cache. + * + * @param documentKeys - The keys of the entries to look up. + * @returns The cached document entries indexed by key. If an entry is not + * cached, the corresponding key will be mapped to an invalid document. + */ + getEntries(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>; + /** + * Returns the documents matching the given query + * + * @param query - The query to match documents against. + * @param offset - The offset to start the scan at (exclusive). + * @param context - A optional tracker to keep a record of important details + * during database local query execution. + * @returns The set of matching documents. + */ + getDocumentsMatchingQuery(transaction: PersistenceTransaction, query: Query, offset: IndexOffset, mutatedDocs: OverlayMap, context?: QueryContext): PersistencePromise<MutableDocumentMap>; + /** + * Looks up the next `limit` documents for a collection group based on the + * provided offset. The ordering is based on the document's read time and key. + * + * @param collectionGroup - The collection group to scan. + * @param offset - The offset to start the scan at (exclusive). + * @param limit - The maximum number of results to return. + * @returns The set of matching documents. + */ + getAllFromCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset, limit: number): PersistencePromise<MutableDocumentMap>; + /** + * Provides access to add or update the contents of the cache. The buffer + * handles proper size accounting for the change. + * + * Multi-Tab Note: This should only be called by the primary client. + * + * @param options - Specify `trackRemovals` to create sentinel entries for + * removed documents, which allows removals to be tracked by + * `getNewDocumentChanges()`. + */ + newChangeBuffer(options?: { + trackRemovals: boolean; + }): RemoteDocumentChangeBuffer; + /** + * Get an estimate of the size of the document cache. Note that for eager + * garbage collection, we don't track sizes so this will return 0. + */ + getSize(transaction: PersistenceTransaction): PersistencePromise<number>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/remote_document_change_buffer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/remote_document_change_buffer.d.ts new file mode 100644 index 0000000..3b8a1fa --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/remote_document_change_buffer.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 { DocumentKeySet, MutableDocumentMap } from '../model/collections'; +import { MutableDocument } from '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { ObjectMap } from '../util/obj_map'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +/** + * An in-memory buffer of entries to be written to a RemoteDocumentCache. + * It can be used to batch up a set of changes to be written to the cache, but + * additionally supports reading entries back with the `getEntry()` method, + * falling back to the underlying RemoteDocumentCache if no entry is + * buffered. + * + * Entries added to the cache *must* be read first. This is to facilitate + * calculating the size delta of the pending changes. + * + * PORTING NOTE: This class was implemented then removed from other platforms. + * If byte-counting ends up being needed on the other platforms, consider + * porting this class as part of that implementation work. + */ +export declare abstract class RemoteDocumentChangeBuffer { + protected changes: ObjectMap<DocumentKey, MutableDocument>; + private changesApplied; + protected abstract getFromCache(transaction: PersistenceTransaction, documentKey: DocumentKey): PersistencePromise<MutableDocument>; + protected abstract getAllFromCache(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>; + protected abstract applyChanges(transaction: PersistenceTransaction): PersistencePromise<void>; + /** + * Buffers a `RemoteDocumentCache.addEntry()` call. + * + * You can only modify documents that have already been retrieved via + * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`). + */ + addEntry(document: MutableDocument): void; + /** + * Buffers a `RemoteDocumentCache.removeEntry()` call. + * + * You can only remove documents that have already been retrieved via + * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`). + */ + removeEntry(key: DocumentKey, readTime: SnapshotVersion): void; + /** + * Looks up an entry in the cache. The buffered changes will first be checked, + * and if no buffered change applies, this will forward to + * `RemoteDocumentCache.getEntry()`. + * + * @param transaction - The transaction in which to perform any persistence + * operations. + * @param documentKey - The key of the entry to look up. + * @returns The cached document or an invalid document if we have nothing + * cached. + */ + getEntry(transaction: PersistenceTransaction, documentKey: DocumentKey): PersistencePromise<MutableDocument>; + /** + * Looks up several entries in the cache, forwarding to + * `RemoteDocumentCache.getEntry()`. + * + * @param transaction - The transaction in which to perform any persistence + * operations. + * @param documentKeys - The keys of the entries to look up. + * @returns A map of cached documents, indexed by key. If an entry cannot be + * found, the corresponding key will be mapped to an invalid document. + */ + getEntries(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>; + /** + * Applies buffered changes to the underlying RemoteDocumentCache, using + * the provided transaction. + */ + apply(transaction: PersistenceTransaction): PersistencePromise<void>; + /** Helper to assert this.changes is not null */ + protected assertNotApplied(): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/shared_client_state.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/shared_client_state.d.ts new file mode 100644 index 0000000..98efa94 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/shared_client_state.d.ts @@ -0,0 +1,312 @@ +/** + * @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 { User } from '../auth/user'; +import { BatchId, ListenSequenceNumber, MutationBatchState, OnlineState, TargetId } from '../core/types'; +import { TargetIdSet } from '../model/collections'; +import { AsyncQueue } from '../util/async_queue'; +import { FirestoreError } from '../util/error'; +import { SortedSet } from '../util/sorted_set'; +import { WindowLike } from '../util/types'; +import { QueryTargetState, SharedClientStateSyncer } from './shared_client_state_syncer'; +/** + * A randomly-generated key assigned to each Firestore instance at startup. + */ +export type ClientId = string; +/** + * A `SharedClientState` keeps track of the global state of the mutations + * and query targets for all active clients with the same persistence key (i.e. + * project ID and FirebaseApp name). It relays local changes to other clients + * and updates its local state as new state is observed. + * + * `SharedClientState` is primarily used for synchronization in Multi-Tab + * environments. Each tab is responsible for registering its active query + * targets and mutations. `SharedClientState` will then notify the listener + * assigned to `.syncEngine` for updates to mutations and queries that + * originated in other clients. + * + * To receive notifications, `.syncEngine` and `.onlineStateHandler` has to be + * assigned before calling `start()`. + */ +export interface SharedClientState { + onlineStateHandler: ((onlineState: OnlineState) => void) | null; + sequenceNumberHandler: ((sequenceNumber: ListenSequenceNumber) => void) | null; + /** Registers the Mutation Batch ID of a newly pending mutation. */ + addPendingMutation(batchId: BatchId): void; + /** + * Records that a pending mutation has been acknowledged or rejected. + * Called by the primary client to notify secondary clients of mutation + * results as they come back from the backend. + */ + updateMutationState(batchId: BatchId, state: 'acknowledged' | 'rejected', error?: FirestoreError): void; + /** + * Associates a new Query Target ID with the local Firestore client. Returns + * the new query state for the query (which can be 'current' if the query is + * already associated with another tab). + * + * If the target id is already associated with local client, the method simply + * returns its `QueryTargetState`. + */ + addLocalQueryTarget(targetId: TargetId, addToActiveTargetIds?: boolean): QueryTargetState; + /** Removes the Query Target ID association from the local client. */ + removeLocalQueryTarget(targetId: TargetId): void; + /** Checks whether the target is associated with the local client. */ + isLocalQueryTarget(targetId: TargetId): boolean; + /** + * Processes an update to a query target. + * + * Called by the primary client to notify secondary clients of document + * changes or state transitions that affect the provided query target. + */ + updateQueryState(targetId: TargetId, state: QueryTargetState, error?: FirestoreError): void; + /** + * Removes the target's metadata entry. + * + * Called by the primary client when all clients stopped listening to a query + * target. + */ + clearQueryState(targetId: TargetId): void; + /** + * Gets the active Query Targets IDs for all active clients. + * + * The implementation for this may require O(n) runtime, where 'n' is the size + * of the result set. + */ + getAllActiveQueryTargets(): SortedSet<TargetId>; + /** + * Checks whether the provided target ID is currently being listened to by + * any of the active clients. + * + * The implementation may require O(n*log m) runtime, where 'n' is the number + * of clients and 'm' the number of targets. + */ + isActiveQueryTarget(targetId: TargetId): boolean; + /** + * Starts the SharedClientState, reads existing client data and registers + * listeners for updates to new and existing clients. + */ + start(): Promise<void>; + /** Shuts down the `SharedClientState` and its listeners. */ + shutdown(): void; + /** + * Changes the active user and removes all existing user-specific data. The + * user change does not call back into SyncEngine (for example, no mutations + * will be marked as removed). + */ + handleUserChange(user: User, removedBatchIds: BatchId[], addedBatchIds: BatchId[]): void; + /** Changes the shared online state of all clients. */ + setOnlineState(onlineState: OnlineState): void; + writeSequenceNumber(sequenceNumber: ListenSequenceNumber): void; + /** + * Notifies other clients when remote documents have changed due to loading + * a bundle. + * + * @param collectionGroups The collection groups affected by this bundle. + */ + notifyBundleLoaded(collectionGroups: Set<string>): void; +} +/** + * Holds the state of a mutation batch, including its user ID, batch ID and + * whether the batch is 'pending', 'acknowledged' or 'rejected'. + */ +export declare class MutationMetadata { + readonly user: User; + readonly batchId: BatchId; + readonly state: MutationBatchState; + readonly error?: FirestoreError | undefined; + constructor(user: User, batchId: BatchId, state: MutationBatchState, error?: FirestoreError | undefined); + /** + * Parses a MutationMetadata from its JSON representation in WebStorage. + * Logs a warning and returns null if the format of the data is not valid. + */ + static fromWebStorageEntry(user: User, batchId: BatchId, value: string): MutationMetadata | null; + toWebStorageJSON(): string; +} +/** + * Holds the state of a query target, including its target ID and whether the + * target is 'not-current', 'current' or 'rejected'. + */ +export declare class QueryTargetMetadata { + readonly targetId: TargetId; + readonly state: QueryTargetState; + readonly error?: FirestoreError | undefined; + constructor(targetId: TargetId, state: QueryTargetState, error?: FirestoreError | undefined); + /** + * Parses a QueryTargetMetadata from its JSON representation in WebStorage. + * Logs a warning and returns null if the format of the data is not valid. + */ + static fromWebStorageEntry(targetId: TargetId, value: string): QueryTargetMetadata | null; + toWebStorageJSON(): string; +} +/** + * Metadata state of a single client denoting the query targets it is actively + * listening to the watch. + */ +export interface ClientState { + readonly activeTargetIds: TargetIdSet; +} +/** + * This class represents the online state for all clients participating in + * multi-tab. The online state is only written to by the primary client, and + * used in secondary clients to update their query views. + */ +export declare class SharedOnlineState { + readonly clientId: string; + readonly onlineState: OnlineState; + constructor(clientId: string, onlineState: OnlineState); + /** + * Parses a SharedOnlineState from its JSON representation in WebStorage. + * Logs a warning and returns null if the format of the data is not valid. + */ + static fromWebStorageEntry(value: string): SharedOnlineState | null; +} +/** + * Metadata state of the local client. Unlike `RemoteClientState`, this class is + * mutable and keeps track of all pending mutations, which allows us to + * update the range of pending mutation batch IDs as new mutations are added or + * removed. + * + * The data in `LocalClientState` is not read from WebStorage and instead + * updated via its instance methods. The updated state can be serialized via + * `toWebStorageJSON()`. + */ +export declare class LocalClientState implements ClientState { + activeTargetIds: SortedSet<number>; + addQueryTarget(targetId: TargetId): void; + removeQueryTarget(targetId: TargetId): void; + /** + * Converts this entry into a JSON-encoded format we can use for WebStorage. + * Does not encode `clientId` as it is part of the key in WebStorage. + */ + toWebStorageJSON(): string; +} +/** + * `WebStorageSharedClientState` uses WebStorage (window.localStorage) as the + * backing store for the SharedClientState. It keeps track of all active + * clients and supports modifications of the local client's data. + */ +export declare class WebStorageSharedClientState implements SharedClientState { + private readonly window; + private readonly queue; + private readonly persistenceKey; + private readonly localClientId; + syncEngine: SharedClientStateSyncer | null; + onlineStateHandler: ((onlineState: OnlineState) => void) | null; + sequenceNumberHandler: ((sequenceNumber: ListenSequenceNumber) => void) | null; + private readonly storage; + private readonly localClientStorageKey; + private readonly sequenceNumberKey; + private readonly storageListener; + private readonly onlineStateKey; + private readonly bundleLoadedKey; + private readonly clientStateKeyRe; + private readonly mutationBatchKeyRe; + private readonly queryTargetKeyRe; + private activeClients; + private started; + private currentUser; + /** + * Captures WebStorage events that occur before `start()` is called. These + * events are replayed once `WebStorageSharedClientState` is started. + */ + private earlyEvents; + constructor(window: WindowLike, queue: AsyncQueue, persistenceKey: string, localClientId: ClientId, initialUser: User); + /** Returns 'true' if WebStorage is available in the current environment. */ + static isAvailable(window: WindowLike | null): window is WindowLike; + start(): Promise<void>; + writeSequenceNumber(sequenceNumber: ListenSequenceNumber): void; + getAllActiveQueryTargets(): TargetIdSet; + isActiveQueryTarget(targetId: TargetId): boolean; + addPendingMutation(batchId: BatchId): void; + updateMutationState(batchId: BatchId, state: 'acknowledged' | 'rejected', error?: FirestoreError): void; + addLocalQueryTarget(targetId: TargetId, addToActiveTargetIds?: boolean): QueryTargetState; + removeLocalQueryTarget(targetId: TargetId): void; + isLocalQueryTarget(targetId: TargetId): boolean; + clearQueryState(targetId: TargetId): void; + updateQueryState(targetId: TargetId, state: QueryTargetState, error?: FirestoreError): void; + handleUserChange(user: User, removedBatchIds: BatchId[], addedBatchIds: BatchId[]): void; + setOnlineState(onlineState: OnlineState): void; + notifyBundleLoaded(collectionGroups: Set<string>): void; + shutdown(): void; + private getItem; + private setItem; + private removeItem; + private handleWebStorageEvent; + private get localClientState(); + private persistClientState; + private persistMutationState; + private removeMutationState; + private persistOnlineState; + private persistQueryTargetState; + private persistBundleLoadedState; + /** + * Parses a client state key in WebStorage. Returns null if the key does not + * match the expected key format. + */ + private fromWebStorageClientStateKey; + /** + * Parses a client state in WebStorage. Returns 'null' if the value could not + * be parsed. + */ + private fromWebStorageClientState; + /** + * Parses a mutation batch state in WebStorage. Returns 'null' if the value + * could not be parsed. + */ + private fromWebStorageMutationMetadata; + /** + * Parses a query target state from WebStorage. Returns 'null' if the value + * could not be parsed. + */ + private fromWebStorageQueryTargetMetadata; + /** + * Parses an online state from WebStorage. Returns 'null' if the value + * could not be parsed. + */ + private fromWebStorageOnlineState; + private fromWebStoreBundleLoadedState; + private handleMutationBatchEvent; + private handleQueryTargetEvent; + private handleClientStateEvent; + private handleOnlineStateEvent; + private extractActiveQueryTargets; +} +/** + * `MemorySharedClientState` is a simple implementation of SharedClientState for + * clients using memory persistence. The state in this class remains fully + * isolated and no synchronization is performed. + */ +export declare class MemorySharedClientState implements SharedClientState { + private localState; + private queryState; + onlineStateHandler: ((onlineState: OnlineState) => void) | null; + sequenceNumberHandler: ((sequenceNumber: ListenSequenceNumber) => void) | null; + addPendingMutation(batchId: BatchId): void; + updateMutationState(batchId: BatchId, state: 'acknowledged' | 'rejected', error?: FirestoreError): void; + addLocalQueryTarget(targetId: TargetId, addToActiveTargetIds?: boolean): QueryTargetState; + updateQueryState(targetId: TargetId, state: QueryTargetState, error?: FirestoreError): void; + removeLocalQueryTarget(targetId: TargetId): void; + isLocalQueryTarget(targetId: TargetId): boolean; + clearQueryState(targetId: TargetId): void; + getAllActiveQueryTargets(): TargetIdSet; + isActiveQueryTarget(targetId: TargetId): boolean; + start(): Promise<void>; + handleUserChange(user: User, removedBatchIds: BatchId[], addedBatchIds: BatchId[]): void; + setOnlineState(onlineState: OnlineState): void; + shutdown(): void; + writeSequenceNumber(sequenceNumber: ListenSequenceNumber): void; + notifyBundleLoaded(collectionGroups: Set<string>): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/shared_client_state_schema.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/shared_client_state_schema.d.ts new file mode 100644 index 0000000..b856116 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/shared_client_state_schema.d.ts @@ -0,0 +1,84 @@ +/** + * @license + * Copyright 2019 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 { User } from '../auth/user'; +import { BatchId, MutationBatchState, TargetId } from '../core/types'; +import { ClientId } from './shared_client_state'; +import { QueryTargetState } from './shared_client_state_syncer'; +export declare const CLIENT_STATE_KEY_PREFIX = "firestore_clients"; +/** Assembles the key for a client state in WebStorage */ +export declare function createWebStorageClientStateKey(persistenceKey: string, clientId: ClientId): string; +/** + * The JSON representation of a clients's metadata as used during WebStorage + * serialization. The ClientId is omitted here as it is encoded as part of the + * key. + */ +export interface ClientStateSchema { + activeTargetIds: number[]; + updateTimeMs: number; +} +export declare const MUTATION_BATCH_KEY_PREFIX = "firestore_mutations"; +/** Assembles the key for a mutation batch in WebStorage */ +export declare function createWebStorageMutationBatchKey(persistenceKey: string, user: User, batchId: BatchId): string; +/** + * The JSON representation of a mutation batch's metadata as used during + * WebStorage serialization. The UserId and BatchId is omitted as it is + * encoded as part of the key. + */ +export interface MutationMetadataSchema { + state: MutationBatchState; + error?: { + code: string; + message: string; + }; + updateTimeMs: number; +} +export declare const QUERY_TARGET_KEY_PREFIX = "firestore_targets"; +/** Assembles the key for a query state in WebStorage */ +export declare function createWebStorageQueryTargetMetadataKey(persistenceKey: string, targetId: TargetId): string; +/** + * The JSON representation of a query target's state as used during WebStorage + * serialization. The TargetId is omitted as it is encoded as part of the key. + */ +export interface QueryTargetStateSchema { + state: QueryTargetState; + error?: { + code: string; + message: string; + }; + updateTimeMs: number; +} +export declare const ONLINE_STATE_KEY_PREFIX = "firestore_online_state"; +/** Assembles the key for the online state of the primary tab. */ +export declare function createWebStorageOnlineStateKey(persistenceKey: string): string; +export declare const BUNDLE_LOADED_KEY_PREFIX = "firestore_bundle_loaded_v2"; +export declare function createBundleLoadedKey(persistenceKey: string): string; +/** + * The JSON representation of the system's online state, as written by the + * primary client. + */ +export interface SharedOnlineStateSchema { + /** + * The clientId of the client that wrote this onlineState value. Tracked so + * that on startup, clients can check if this client is still active when + * determining whether to apply this value or not. + */ + readonly clientId: string; + readonly onlineState: string; +} +export declare const SEQUENCE_NUMBER_KEY_PREFIX = "firestore_sequence_number"; +/** Assembles the key for the current sequence number. */ +export declare function createWebStorageSequenceNumberKey(persistenceKey: string): string; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/shared_client_state_syncer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/shared_client_state_syncer.d.ts new file mode 100644 index 0000000..edc4a1b --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/shared_client_state_syncer.d.ts @@ -0,0 +1,40 @@ +/** + * @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 { BatchId, MutationBatchState, TargetId } from '../core/types'; +import { FirestoreError } from '../util/error'; +import { ClientId } from './shared_client_state'; +/** The different states of a watch target. */ +export type QueryTargetState = 'not-current' | 'current' | 'rejected'; +/** + * An interface that describes the actions the SharedClientState class needs to + * perform on a cooperating synchronization engine. + */ +export interface SharedClientStateSyncer { + /** Applies a mutation state to an existing batch. */ + applyBatchState(batchId: BatchId, state: MutationBatchState, error?: FirestoreError): Promise<void>; + /** Applies a query target change from a different tab. */ + applyTargetState(targetId: TargetId, state: QueryTargetState, error?: FirestoreError): Promise<void>; + /** Adds or removes Watch targets for queries from different tabs. */ + applyActiveTargetsChange(added: TargetId[], removed: TargetId[]): Promise<void>; + /** Returns the IDs of the clients that are currently active. */ + getActiveClients(): Promise<ClientId[]>; + /** + * Retrieves newly changed documents from remote document cache and raises + * snapshots if needed. + */ + synchronizeWithChangedDocuments(collectionGroup: string): Promise<void>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/simple_db.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/simple_db.d.ts new file mode 100644 index 0000000..edaef3b --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/simple_db.d.ts @@ -0,0 +1,233 @@ +/** + * @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 { FirestoreError } from '../util/error'; +import { PersistencePromise } from './persistence_promise'; +type SimpleDbTransactionMode = 'readonly' | 'readwrite'; +export interface SimpleDbSchemaConverter { + createOrUpgrade(db: IDBDatabase, txn: IDBTransaction, fromVersion: number, toVersion: number): PersistencePromise<void>; +} +/** + * Wraps an IDBTransaction and exposes a store() method to get a handle to a + * specific object store. + */ +export declare class SimpleDbTransaction { + private readonly action; + private readonly transaction; + private aborted; + /** + * A `Promise` that resolves with the result of the IndexedDb transaction. + */ + private readonly completionDeferred; + static open(db: IDBDatabase, action: string, mode: IDBTransactionMode, objectStoreNames: string[]): SimpleDbTransaction; + constructor(action: string, transaction: IDBTransaction); + get completionPromise(): Promise<void>; + abort(error?: Error): void; + maybeCommit(): void; + /** + * Returns a SimpleDbStore<KeyType, ValueType> for the specified store. All + * operations performed on the SimpleDbStore happen within the context of this + * transaction and it cannot be used anymore once the transaction is + * completed. + * + * Note that we can't actually enforce that the KeyType and ValueType are + * correct, but they allow type safety through the rest of the consuming code. + */ + store<KeyType extends IDBValidKey, ValueType extends unknown>(storeName: string): SimpleDbStore<KeyType, ValueType>; +} +/** + * Provides a wrapper around IndexedDb with a simplified interface that uses + * Promise-like return values to chain operations. Real promises cannot be used + * since .then() continuations are executed asynchronously (e.g. via + * .setImmediate), which would cause IndexedDB to end the transaction. + * See PersistencePromise for more details. + */ +export declare class SimpleDb { + private readonly name; + private readonly version; + private readonly schemaConverter; + private db?; + private lastClosedDbVersion; + private versionchangelistener?; + /** Deletes the specified database. */ + static delete(name: string): Promise<void>; + /** Returns true if IndexedDB is available in the current environment. */ + static isAvailable(): boolean; + /** + * Returns true if the backing IndexedDB store is the Node IndexedDBShim + * (see https://github.com/axemclion/IndexedDBShim). + */ + static isMockPersistence(): boolean; + /** Helper to get a typed SimpleDbStore from a transaction. */ + static getStore<KeyType extends IDBValidKey, ValueType extends unknown>(txn: SimpleDbTransaction, store: string): SimpleDbStore<KeyType, ValueType>; + /** Parse User Agent to determine iOS version. Returns -1 if not found. */ + static getIOSVersion(ua: string): number; + constructor(name: string, version: number, schemaConverter: SimpleDbSchemaConverter); + /** + * Opens the specified database, creating or upgrading it if necessary. + */ + ensureDb(action: string): Promise<IDBDatabase>; + setVersionChangeListener(versionChangeListener: (event: IDBVersionChangeEvent) => void): void; + runTransaction<T>(action: string, mode: SimpleDbTransactionMode, objectStores: string[], transactionFn: (transaction: SimpleDbTransaction) => PersistencePromise<T>): Promise<T>; + close(): void; +} +/** Parse User Agent to determine Android version. Returns -1 if not found. */ +export declare function getAndroidVersion(ua: string): number; +/** + * A controller for iterating over a key range or index. It allows an iterate + * callback to delete the currently-referenced object, or jump to a new key + * within the key range or index. + */ +export declare class IterationController { + private dbCursor; + private shouldStop; + private nextKey; + constructor(dbCursor: IDBCursorWithValue); + get isDone(): boolean; + get skipToKey(): IDBValidKey | null; + set cursor(value: IDBCursorWithValue); + /** + * This function can be called to stop iteration at any point. + */ + done(): void; + /** + * This function can be called to skip to that next key, which could be + * an index or a primary key. + */ + skip(key: IDBValidKey): void; + /** + * Delete the current cursor value from the object store. + * + * NOTE: You CANNOT do this with a keysOnly query. + */ + delete(): PersistencePromise<void>; +} +/** + * Callback used with iterate() method. + */ +export type IterateCallback<KeyType, ValueType> = (key: KeyType, value: ValueType, control: IterationController) => void | PersistencePromise<void>; +/** Options available to the iterate() method. */ +export interface IterateOptions { + /** Index to iterate over (else primary keys will be iterated) */ + index?: string; + /** IndexedDB Range to iterate over (else entire store will be iterated) */ + range?: IDBKeyRange; + /** If true, values aren't read while iterating. */ + keysOnly?: boolean; + /** If true, iterate over the store in reverse. */ + reverse?: boolean; +} +/** An error that wraps exceptions that thrown during IndexedDB execution. */ +export declare class IndexedDbTransactionError extends FirestoreError { + name: string; + constructor(actionName: string, cause: Error | string); +} +/** Verifies whether `e` is an IndexedDbTransactionError. */ +export declare function isIndexedDbTransactionError(e: Error): boolean; +/** + * A wrapper around an IDBObjectStore providing an API that: + * + * 1) Has generic KeyType / ValueType parameters to provide strongly-typed + * methods for acting against the object store. + * 2) Deals with IndexedDB's onsuccess / onerror event callbacks, making every + * method return a PersistencePromise instead. + * 3) Provides a higher-level API to avoid needing to do excessive wrapping of + * intermediate IndexedDB types (IDBCursorWithValue, etc.) + */ +export declare class SimpleDbStore<KeyType extends IDBValidKey, ValueType extends unknown> { + private store; + constructor(store: IDBObjectStore); + /** + * Writes a value into the Object Store. + * + * @param key - Optional explicit key to use when writing the object, else the + * key will be auto-assigned (e.g. via the defined keyPath for the store). + * @param value - The object to write. + */ + put(value: ValueType): PersistencePromise<void>; + put(key: KeyType, value: ValueType): PersistencePromise<void>; + /** + * Adds a new value into an Object Store and returns the new key. Similar to + * IndexedDb's `add()`, this method will fail on primary key collisions. + * + * @param value - The object to write. + * @returns The key of the value to add. + */ + add(value: ValueType): PersistencePromise<KeyType>; + /** + * Gets the object with the specified key from the specified store, or null + * if no object exists with the specified key. + * + * @key The key of the object to get. + * @returns The object with the specified key or null if no object exists. + */ + get(key: KeyType): PersistencePromise<ValueType | null>; + delete(key: KeyType | IDBKeyRange): PersistencePromise<void>; + /** + * If we ever need more of the count variants, we can add overloads. For now, + * all we need is to count everything in a store. + * + * Returns the number of rows in the store. + */ + count(): PersistencePromise<number>; + /** Loads all elements from the object store. */ + loadAll(): PersistencePromise<ValueType[]>; + /** Loads all elements for the index range from the object store. */ + loadAll(range: IDBKeyRange): PersistencePromise<ValueType[]>; + /** Loads all elements ordered by the given index. */ + loadAll(index: string): PersistencePromise<ValueType[]>; + /** + * Loads all elements from the object store that fall into the provided in the + * index range for the given index. + */ + loadAll(index: string, range: IDBKeyRange): PersistencePromise<ValueType[]>; + /** + * Loads the first `count` elements from the provided index range. Loads all + * elements if no limit is provided. + */ + loadFirst(range: IDBKeyRange, count: number | null): PersistencePromise<ValueType[]>; + deleteAll(): PersistencePromise<void>; + deleteAll(range: IDBKeyRange): PersistencePromise<void>; + deleteAll(index: string, range: IDBKeyRange): PersistencePromise<void>; + /** + * Iterates over keys and values in an object store. + * + * @param options - Options specifying how to iterate the objects in the + * store. + * @param callback - will be called for each iterated object. Iteration can be + * canceled at any point by calling the doneFn passed to the callback. + * The callback can return a PersistencePromise if it performs async + * operations but note that iteration will continue without waiting for them + * to complete. + * @returns A PersistencePromise that resolves once all PersistencePromises + * returned by callbacks resolve. + */ + iterate(callback: IterateCallback<KeyType, ValueType>): PersistencePromise<void>; + iterate(options: IterateOptions, callback: IterateCallback<KeyType, ValueType>): PersistencePromise<void>; + /** + * Iterates over a store, but waits for the given callback to complete for + * each entry before iterating the next entry. This allows the callback to do + * asynchronous work to determine if this iteration should continue. + * + * The provided callback should return `true` to continue iteration, and + * `false` otherwise. + */ + iterateSerial(callback: (k: KeyType, v: ValueType) => PersistencePromise<boolean>): PersistencePromise<void>; + private iterateCursor; + private options; + private cursor; +} +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/target_cache.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/target_cache.d.ts new file mode 100644 index 0000000..218c805 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/target_cache.d.ts @@ -0,0 +1,130 @@ +/** + * @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 { Target } from '../core/target'; +import { ListenSequenceNumber, TargetId } from '../core/types'; +import { DocumentKeySet } from '../model/collections'; +import { DocumentKey } from '../model/document_key'; +import { PersistencePromise } from './persistence_promise'; +import { PersistenceTransaction } from './persistence_transaction'; +import { TargetData } from './target_data'; +/** + * Represents cached targets received from the remote backend. + * + * The cache is keyed by `Target` and entries in the cache are `TargetData` + * instances. + */ +export interface TargetCache { + /** + * A global snapshot version representing the last consistent snapshot we + * received from the backend. This is monotonically increasing and any + * snapshots received from the backend prior to this version (e.g. for targets + * resumed with a resume_token) should be suppressed (buffered) until the + * backend has caught up to this snapshot version again. This prevents our + * cache from ever going backwards in time. + * + * This is updated whenever our we get a TargetChange with a read_time and + * empty target_ids. + */ + getLastRemoteSnapshotVersion(transaction: PersistenceTransaction): PersistencePromise<SnapshotVersion>; + /** + * @returns The highest sequence number observed, including any that might be + * persisted on-disk. + */ + getHighestSequenceNumber(transaction: PersistenceTransaction): PersistencePromise<ListenSequenceNumber>; + /** + * Call provided function with each `TargetData` that we have cached. + */ + forEachTarget(txn: PersistenceTransaction, f: (q: TargetData) => void): PersistencePromise<void>; + /** + * Set the highest listen sequence number and optionally updates the + * snapshot version of the last consistent snapshot received from the backend + * (see getLastRemoteSnapshotVersion() for more details). + * + * @param highestListenSequenceNumber - The new maximum listen sequence number. + * @param lastRemoteSnapshotVersion - The new snapshot version. Optional. + */ + setTargetsMetadata(transaction: PersistenceTransaction, highestListenSequenceNumber: number, lastRemoteSnapshotVersion?: SnapshotVersion): PersistencePromise<void>; + /** + * Adds an entry in the cache. + * + * The cache key is extracted from `targetData.target`. The key must not already + * exist in the cache. + * + * @param targetData - A TargetData instance to put in the cache. + */ + addTargetData(transaction: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + /** + * Updates an entry in the cache. + * + * The cache key is extracted from `targetData.target`. The entry must already + * exist in the cache, and it will be replaced. + * @param targetData - The TargetData to be replaced into the cache. + */ + updateTargetData(transaction: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + /** + * Removes the cached entry for the given target data. It is an error to remove + * a target data that does not exist. + * + * Multi-Tab Note: This operation should only be called by the primary client. + */ + removeTargetData(transaction: PersistenceTransaction, targetData: TargetData): PersistencePromise<void>; + /** + * The number of targets currently in the cache. + */ + getTargetCount(transaction: PersistenceTransaction): PersistencePromise<number>; + /** + * Looks up a TargetData entry by target. + * + * @param target - The query target corresponding to the entry to look up. + * @returns The cached TargetData entry, or null if the cache has no entry for + * the target. + */ + getTargetData(transaction: PersistenceTransaction, target: Target): PersistencePromise<TargetData | null>; + /** + * Adds the given document keys to cached query results of the given target + * ID. + * + * Multi-Tab Note: This operation should only be called by the primary client. + */ + addMatchingKeys(transaction: PersistenceTransaction, keys: DocumentKeySet, targetId: TargetId): PersistencePromise<void>; + /** + * Removes the given document keys from the cached query results of the + * given target ID. + * + * Multi-Tab Note: This operation should only be called by the primary client. + */ + removeMatchingKeys(transaction: PersistenceTransaction, keys: DocumentKeySet, targetId: TargetId): PersistencePromise<void>; + /** + * Removes all the keys in the query results of the given target ID. + * + * Multi-Tab Note: This operation should only be called by the primary client. + */ + removeMatchingKeysForTargetId(transaction: PersistenceTransaction, targetId: TargetId): PersistencePromise<void>; + /** + * Returns the document keys that match the provided target ID. + */ + getMatchingKeysForTargetId(transaction: PersistenceTransaction, targetId: TargetId): PersistencePromise<DocumentKeySet>; + /** + * Returns a new target ID that is higher than any query in the cache. If + * there are no queries in the cache, returns the first valid target ID. + * Allocated target IDs are persisted and `allocateTargetId()` will never + * return the same ID twice. + */ + allocateTargetId(transaction: PersistenceTransaction): PersistencePromise<TargetId>; + containsKey(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<boolean>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/target_data.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/target_data.d.ts new file mode 100644 index 0000000..595a334 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/local/target_data.d.ts @@ -0,0 +1,127 @@ +/** + * @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 { Target } from '../core/target'; +import { ListenSequenceNumber, TargetId } from '../core/types'; +import { ByteString } from '../util/byte_string'; +/** An enumeration of the different purposes we have for targets. */ +export declare const enum TargetPurpose { + /** A regular, normal query target. */ + Listen = "TargetPurposeListen", + /** + * The query target was used to refill a query after an existence filter + * mismatch. + */ + ExistenceFilterMismatch = "TargetPurposeExistenceFilterMismatch", + /** + * The query target was used if the query is the result of a false positive in + * the bloom filter. + */ + ExistenceFilterMismatchBloom = "TargetPurposeExistenceFilterMismatchBloom", + /** The query target was used to resolve a limbo document. */ + LimboResolution = "TargetPurposeLimboResolution" +} +/** + * An immutable set of metadata that the local store tracks for each target. + */ +export declare class TargetData { + /** The target being listened to. */ + readonly target: Target; + /** + * The target ID to which the target corresponds; Assigned by the + * LocalStore for user listens and by the SyncEngine for limbo watches. + */ + readonly targetId: TargetId; + /** The purpose of the target. */ + readonly purpose: TargetPurpose; + /** + * The sequence number of the last transaction during which this target data + * was modified. + */ + readonly sequenceNumber: ListenSequenceNumber; + /** The latest snapshot version seen for this target. */ + readonly snapshotVersion: SnapshotVersion; + /** + * The maximum snapshot version at which the associated view + * contained no limbo documents. + */ + readonly lastLimboFreeSnapshotVersion: SnapshotVersion; + /** + * An opaque, server-assigned token that allows watching a target to be + * resumed after disconnecting without retransmitting all the data that + * matches the target. The resume token essentially identifies a point in + * time from which the server should resume sending results. + */ + readonly resumeToken: ByteString; + /** + * The number of documents that last matched the query at the resume token or + * read time. Documents are counted only when making a listen request with + * resume token or read time, otherwise, keep it null. + */ + readonly expectedCount: number | null; + constructor( + /** The target being listened to. */ + target: Target, + /** + * The target ID to which the target corresponds; Assigned by the + * LocalStore for user listens and by the SyncEngine for limbo watches. + */ + targetId: TargetId, + /** The purpose of the target. */ + purpose: TargetPurpose, + /** + * The sequence number of the last transaction during which this target data + * was modified. + */ + sequenceNumber: ListenSequenceNumber, + /** The latest snapshot version seen for this target. */ + snapshotVersion?: SnapshotVersion, + /** + * The maximum snapshot version at which the associated view + * contained no limbo documents. + */ + lastLimboFreeSnapshotVersion?: SnapshotVersion, + /** + * An opaque, server-assigned token that allows watching a target to be + * resumed after disconnecting without retransmitting all the data that + * matches the target. The resume token essentially identifies a point in + * time from which the server should resume sending results. + */ + resumeToken?: ByteString, + /** + * The number of documents that last matched the query at the resume token or + * read time. Documents are counted only when making a listen request with + * resume token or read time, otherwise, keep it null. + */ + expectedCount?: number | null); + /** Creates a new target data instance with an updated sequence number. */ + withSequenceNumber(sequenceNumber: number): TargetData; + /** + * Creates a new target data instance with an updated resume token and + * snapshot version. + */ + withResumeToken(resumeToken: ByteString, snapshotVersion: SnapshotVersion): TargetData; + /** + * Creates a new target data instance with an updated expected count. + */ + withExpectedCount(expectedCount: number): TargetData; + /** + * Creates a new target data instance with an updated last limbo free + * snapshot version number. + */ + withLastLimboFreeSnapshotVersion(lastLimboFreeSnapshotVersion: SnapshotVersion): TargetData; +} 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; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/base64.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/base64.d.ts new file mode 100644 index 0000000..999f234 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/base64.d.ts @@ -0,0 +1,25 @@ +/** + * @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. + */ +/** Converts a Base64 encoded string to a binary string. */ +export declare function decodeBase64(encoded: string): string; +/** Converts a binary string to a Base64 encoded string. */ +export declare function encodeBase64(raw: string): string; +/** + * True if and only if the Base64 conversion functions are available. + * @internal + */ +export declare function isBase64Available(): boolean; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/base64.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/base64.d.ts new file mode 100644 index 0000000..9ea2985 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/base64.d.ts @@ -0,0 +1,22 @@ +/** + * @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. + */ +/** Converts a Base64 encoded string to a binary string. */ +export declare function decodeBase64(encoded: string): string; +/** Converts a binary string to a Base64 encoded string. */ +export declare function encodeBase64(raw: string): string; +/** True if and only if the Base64 conversion functions are available. */ +export declare function isBase64Available(): boolean; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/byte_stream_reader.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/byte_stream_reader.d.ts new file mode 100644 index 0000000..2b95861 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/byte_stream_reader.d.ts @@ -0,0 +1,21 @@ +/** + * @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 { BundleSource } from '../../util/bundle_reader'; +/** + * On web, a `ReadableStream` is wrapped around by a `ByteStreamReader`. + */ +export declare function toByteStreamReader(source: BundleSource, bytesPerRead: number): ReadableStreamDefaultReader<Uint8Array>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/connection.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/connection.d.ts new file mode 100644 index 0000000..9e35cd8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/connection.d.ts @@ -0,0 +1,23 @@ +/** + * @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 { DatabaseInfo } from '../../core/database_info'; +import { Connection } from '../../remote/connection'; +import { ConnectivityMonitor } from '../../remote/connectivity_monitor'; +/** Initializes the WebChannelConnection for the browser. */ +export declare function newConnection(databaseInfo: DatabaseInfo): Connection; +/** Return the Platform-specific connectivity monitor. */ +export declare function newConnectivityMonitor(): ConnectivityMonitor; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/connectivity_monitor.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/connectivity_monitor.d.ts new file mode 100644 index 0000000..0f14bb7 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/connectivity_monitor.d.ts @@ -0,0 +1,33 @@ +/** + * @license + * Copyright 2019 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 { ConnectivityMonitor, NetworkStatus } from '../../remote/connectivity_monitor'; +/** + * Browser implementation of ConnectivityMonitor. + */ +export declare class BrowserConnectivityMonitor implements ConnectivityMonitor { + private readonly networkAvailableListener; + private readonly networkUnavailableListener; + private callbacks; + constructor(); + addCallback(callback: (status: NetworkStatus) => void): void; + shutdown(): void; + private configureNetworkMonitoring; + private onNetworkAvailable; + private onNetworkUnavailable; + /** Checks that all used attributes of window are available. */ + static isAvailable(): boolean; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/dom.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/dom.d.ts new file mode 100644 index 0000000..d2a5319 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/dom.d.ts @@ -0,0 +1,20 @@ +/** + * @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. + */ +/** The Platform's 'window' implementation or null if not available. */ +export declare function getWindow(): Window | null; +/** The Platform's 'document' implementation or null if not available. */ +export declare function getDocument(): Document | null; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/format_json.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/format_json.d.ts new file mode 100644 index 0000000..5e5f7ad --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/format_json.d.ts @@ -0,0 +1,18 @@ +/** + * @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. + */ +/** Formats an object as a JSON string, suitable for logging. */ +export declare function formatJSON(value: unknown): string; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/random_bytes.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/random_bytes.d.ts new file mode 100644 index 0000000..672e612 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/random_bytes.d.ts @@ -0,0 +1,22 @@ +/** + * @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. + */ +/** + * Generates `nBytes` of random bytes. + * + * If `nBytes < 0` , an error will be thrown. + */ +export declare function randomBytes(nBytes: number): Uint8Array; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/serializer.d.ts new file mode 100644 index 0000000..839e680 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/serializer.d.ts @@ -0,0 +1,20 @@ +/** + * @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. + */ +/** Return the Platform-specific serializer monitor. */ +import { DatabaseId } from '../../core/database_info'; +import { JsonProtoSerializer } from '../../remote/serializer'; +export declare function newSerializer(databaseId: DatabaseId): JsonProtoSerializer; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/snapshot_to_json.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/snapshot_to_json.d.ts new file mode 100644 index 0000000..6a75f06 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/snapshot_to_json.d.ts @@ -0,0 +1,23 @@ +/** + * @license + * Copyright 2025 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. + */ +/** Return the Platform-specific build JSON bundle implementations. */ +import { Firestore } from '../../api/database'; +import { Query } from '../../core/query'; +import { DocumentData } from '../../lite-api/reference'; +import { Document } from '../../model/document'; +export declare function buildDocumentSnapshotJsonBundle(db: Firestore, document: Document, docData: DocumentData, path: string): string; +export declare function buildQuerySnapshotJsonBundle(db: Firestore, query: Query, bundleName: string, parent: string, paths: string[], docs: Document[], documentData: DocumentData[]): string; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/text_serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/text_serializer.d.ts new file mode 100644 index 0000000..47213fb --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/text_serializer.d.ts @@ -0,0 +1,24 @@ +/** + * @license + * Copyright 2023 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. + */ +/** + * An instance of the Platform's 'TextEncoder' implementation. + */ +export declare function newTextEncoder(): TextEncoder; +/** + * An instance of the Platform's 'TextDecoder' implementation. + */ +export declare function newTextDecoder(): TextDecoder; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/webchannel_connection.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/webchannel_connection.d.ts new file mode 100644 index 0000000..79117f7 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser/webchannel_connection.d.ts @@ -0,0 +1,47 @@ +/** + * @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 { WebChannel } from '@firebase/webchannel-wrapper/webchannel-blob'; +import { Token } from '../../api/credentials'; +import { DatabaseInfo } from '../../core/database_info'; +import { Stream } from '../../remote/connection'; +import { RestConnection } from '../../remote/rest_connection'; +import { StringMap } from '../../util/types'; +export declare class WebChannelConnection extends RestConnection { + private readonly forceLongPolling; + private readonly autoDetectLongPolling; + private readonly useFetchStreams; + private readonly longPollingOptions; + /** A collection of open WebChannel instances */ + private openWebChannels; + constructor(info: DatabaseInfo); + protected performRPCRequest<Req, Resp>(rpcName: string, url: string, headers: StringMap, body: Req, _forwardCredentials: boolean): Promise<Resp>; + openStream<Req, Resp>(rpcName: string, authToken: Token | null, appCheckToken: Token | null): Stream<Req, Resp>; + /** + * Closes and cleans up any resources associated with the connection. + */ + terminate(): void; + /** + * Add a WebChannel instance to the collection of open instances. + * @param webChannel + */ + addOpenWebChannel(webChannel: WebChannel): void; + /** + * Remove a WebChannel instance from the collection of open instances. + * @param webChannel + */ + removeOpenWebChannel(webChannel: WebChannel): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/base64.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/base64.d.ts new file mode 100644 index 0000000..ae35760 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/base64.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../browser/base64'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/byte_stream_reader.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/byte_stream_reader.d.ts new file mode 100644 index 0000000..c91280a --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/byte_stream_reader.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../browser/byte_stream_reader'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/connection.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/connection.d.ts new file mode 100644 index 0000000..b347f61 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/connection.d.ts @@ -0,0 +1,21 @@ +/** + * @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 { DatabaseInfo } from '../../core/database_info'; +import { Connection } from '../../remote/connection'; +export { newConnectivityMonitor } from '../browser/connection'; +/** Initializes the HTTP connection for the REST API. */ +export declare function newConnection(databaseInfo: DatabaseInfo): Connection; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/dom.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/dom.d.ts new file mode 100644 index 0000000..778555d --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/dom.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../browser/dom'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/fetch_connection.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/fetch_connection.d.ts new file mode 100644 index 0000000..88105c0 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/fetch_connection.d.ts @@ -0,0 +1,28 @@ +/** + * @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 { Token } from '../../api/credentials'; +import { Stream } from '../../remote/connection'; +import { RestConnection } from '../../remote/rest_connection'; +import { StringMap } from '../../util/types'; +/** + * A Rest-based connection that relies on the native HTTP stack + * (e.g. `fetch` or a polyfill). + */ +export declare class FetchConnection extends RestConnection { + openStream<Req, Resp>(rpcName: string, token: Token | null): Stream<Req, Resp>; + protected performRPCRequest<Req, Resp>(rpcName: string, url: string, headers: StringMap, body: Req, forwardCredentials: boolean): Promise<Resp>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/format_json.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/format_json.d.ts new file mode 100644 index 0000000..a9a0b71 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/format_json.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../browser/format_json'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/random_bytes.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/random_bytes.d.ts new file mode 100644 index 0000000..52e5798 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/random_bytes.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../browser/random_bytes'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/serializer.d.ts new file mode 100644 index 0000000..609f24f --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/serializer.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../browser/serializer'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/snapshot_to_json.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/snapshot_to_json.d.ts new file mode 100644 index 0000000..2ed408c --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/snapshot_to_json.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2025 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 * from '../browser/snapshot_to_json'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/text_serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/text_serializer.d.ts new file mode 100644 index 0000000..a032af0 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/browser_lite/text_serializer.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2023 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 * from '../browser/text_serializer'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/byte_stream_reader.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/byte_stream_reader.d.ts new file mode 100644 index 0000000..566291c --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/byte_stream_reader.d.ts @@ -0,0 +1,18 @@ +/** + * @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 { BundleSource } from '../util/bundle_reader'; +export declare function toByteStreamReader(source: BundleSource, bytesPerRead?: number): ReadableStreamDefaultReader<Uint8Array>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/connection.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/connection.d.ts new file mode 100644 index 0000000..0fba574 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/connection.d.ts @@ -0,0 +1,21 @@ +/** + * @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 { DatabaseInfo } from '../core/database_info'; +import { Connection } from '../remote/connection'; +import { ConnectivityMonitor } from '../remote/connectivity_monitor'; +export declare function newConnectivityMonitor(): ConnectivityMonitor; +export declare function newConnection(databaseInfo: DatabaseInfo): Connection; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/dom.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/dom.d.ts new file mode 100644 index 0000000..d2a5319 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/dom.d.ts @@ -0,0 +1,20 @@ +/** + * @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. + */ +/** The Platform's 'window' implementation or null if not available. */ +export declare function getWindow(): Window | null; +/** The Platform's 'document' implementation or null if not available. */ +export declare function getDocument(): Document | null; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/format_json.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/format_json.d.ts new file mode 100644 index 0000000..5e5f7ad --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/format_json.d.ts @@ -0,0 +1,18 @@ +/** + * @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. + */ +/** Formats an object as a JSON string, suitable for logging. */ +export declare function formatJSON(value: unknown): string; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/base64.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/base64.d.ts new file mode 100644 index 0000000..9ea2985 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/base64.d.ts @@ -0,0 +1,22 @@ +/** + * @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. + */ +/** Converts a Base64 encoded string to a binary string. */ +export declare function decodeBase64(encoded: string): string; +/** Converts a binary string to a Base64 encoded string. */ +export declare function encodeBase64(raw: string): string; +/** True if and only if the Base64 conversion functions are available. */ +export declare function isBase64Available(): boolean; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/byte_stream_reader.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/byte_stream_reader.d.ts new file mode 100644 index 0000000..efbd79a --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/byte_stream_reader.d.ts @@ -0,0 +1,21 @@ +/** + * @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 { BundleSource } from '../../util/bundle_reader'; +/** + * On Node, only supported data source is a `Uint8Array` for now. + */ +export declare function toByteStreamReader(source: BundleSource, bytesPerRead: number): ReadableStreamDefaultReader<Uint8Array>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/connection.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/connection.d.ts new file mode 100644 index 0000000..3be3c14 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/connection.d.ts @@ -0,0 +1,23 @@ +/** + * @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 { DatabaseInfo } from '../../core/database_info'; +import { Connection } from '../../remote/connection'; +import { ConnectivityMonitor } from '../../remote/connectivity_monitor'; +/** Loads the GRPC stack */ +export declare function newConnection(databaseInfo: DatabaseInfo): Connection; +/** Return the Platform-specific connectivity monitor. */ +export declare function newConnectivityMonitor(): ConnectivityMonitor; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/dom.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/dom.d.ts new file mode 100644 index 0000000..d2a5319 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/dom.d.ts @@ -0,0 +1,20 @@ +/** + * @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. + */ +/** The Platform's 'window' implementation or null if not available. */ +export declare function getWindow(): Window | null; +/** The Platform's 'document' implementation or null if not available. */ +export declare function getDocument(): Document | null; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/format_json.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/format_json.d.ts new file mode 100644 index 0000000..5e5f7ad --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/format_json.d.ts @@ -0,0 +1,18 @@ +/** + * @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. + */ +/** Formats an object as a JSON string, suitable for logging. */ +export declare function formatJSON(value: unknown): string; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/grpc_connection.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/grpc_connection.d.ts new file mode 100644 index 0000000..30cd921 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/grpc_connection.d.ts @@ -0,0 +1,43 @@ +/** + * @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 * as grpc from '@grpc/grpc-js'; +import { Token } from '../../api/credentials'; +import { DatabaseInfo } from '../../core/database_info'; +import { ResourcePath } from '../../model/path'; +import { Connection, Stream } from '../../remote/connection'; +/** + * A Connection implemented by GRPC-Node. + */ +export declare class GrpcConnection implements Connection { + private databaseInfo; + private readonly databasePath; + private readonly firestore; + private cachedStub; + get shouldResourcePathBeIncludedInRequest(): boolean; + constructor(protos: grpc.GrpcObject, databaseInfo: DatabaseInfo); + private ensureActiveStub; + invokeRPC<Req, Resp>(rpcName: string, path: ResourcePath, request: Req, authToken: Token | null, appCheckToken: Token | null): Promise<Resp>; + invokeStreamingRPC<Req, Resp>(rpcName: string, path: ResourcePath, request: Req, authToken: Token | null, appCheckToken: Token | null, expectedResponseCount?: number): Promise<Resp[]>; + openStream<Req, Resp>(rpcName: string, authToken: Token | null, appCheckToken: Token | null): Stream<Req, Resp>; + /** + * Closes and cleans up any resources associated with the GrpcConnection. + * If a gRPC client has been generated for this connection, the gRPC client + * is closed. Failure to call terminate on a GrpcConnection can result + * in leaked resources of the gRPC client. + */ + terminate(): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/load_protos.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/load_protos.d.ts new file mode 100644 index 0000000..f05a0e6 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/load_protos.d.ts @@ -0,0 +1,28 @@ +/** + * @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 * as grpc from '@grpc/grpc-js'; +import { IConversionOptions, Root } from 'protobufjs'; +/** Used by tests so we can match @grpc/proto-loader behavior. */ +export declare const protoLoaderOptions: IConversionOptions; +/** + * Loads the protocol buffer definitions for Firestore. + * + * @returns The GrpcObject representing our protos. + */ +export declare function loadProtos(): grpc.GrpcObject; +/** Used by tests so we can directly create ProtobufJS proto message objects from JSON protos. */ +export declare function loadRawProtos(): Root; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/random_bytes.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/random_bytes.d.ts new file mode 100644 index 0000000..672e612 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/random_bytes.d.ts @@ -0,0 +1,22 @@ +/** + * @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. + */ +/** + * Generates `nBytes` of random bytes. + * + * If `nBytes < 0` , an error will be thrown. + */ +export declare function randomBytes(nBytes: number): Uint8Array; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/serializer.d.ts new file mode 100644 index 0000000..839e680 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/serializer.d.ts @@ -0,0 +1,20 @@ +/** + * @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. + */ +/** Return the Platform-specific serializer monitor. */ +import { DatabaseId } from '../../core/database_info'; +import { JsonProtoSerializer } from '../../remote/serializer'; +export declare function newSerializer(databaseId: DatabaseId): JsonProtoSerializer; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/snapshot_to_json.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/snapshot_to_json.d.ts new file mode 100644 index 0000000..6a75f06 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/snapshot_to_json.d.ts @@ -0,0 +1,23 @@ +/** + * @license + * Copyright 2025 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. + */ +/** Return the Platform-specific build JSON bundle implementations. */ +import { Firestore } from '../../api/database'; +import { Query } from '../../core/query'; +import { DocumentData } from '../../lite-api/reference'; +import { Document } from '../../model/document'; +export declare function buildDocumentSnapshotJsonBundle(db: Firestore, document: Document, docData: DocumentData, path: string): string; +export declare function buildQuerySnapshotJsonBundle(db: Firestore, query: Query, bundleName: string, parent: string, paths: string[], docs: Document[], documentData: DocumentData[]): string; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/text_serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/text_serializer.d.ts new file mode 100644 index 0000000..f88ff0c --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node/text_serializer.d.ts @@ -0,0 +1,25 @@ +/** + * @license + * Copyright 2023 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 { TextDecoder, TextEncoder } from 'util'; +/** + * An instance of the Platform's 'TextEncoder' implementation. + */ +export declare function newTextEncoder(): TextEncoder; +/** + * An instance of the Platform's 'TextDecoder' implementation. + */ +export declare function newTextDecoder(): TextDecoder; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/base64.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/base64.d.ts new file mode 100644 index 0000000..2d95aff --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/base64.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../node/base64'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/byte_stream_reader.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/byte_stream_reader.d.ts new file mode 100644 index 0000000..543020e --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/byte_stream_reader.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../node/byte_stream_reader'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/connection.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/connection.d.ts new file mode 100644 index 0000000..b347f61 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/connection.d.ts @@ -0,0 +1,21 @@ +/** + * @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 { DatabaseInfo } from '../../core/database_info'; +import { Connection } from '../../remote/connection'; +export { newConnectivityMonitor } from '../browser/connection'; +/** Initializes the HTTP connection for the REST API. */ +export declare function newConnection(databaseInfo: DatabaseInfo): Connection; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/dom.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/dom.d.ts new file mode 100644 index 0000000..6c880e0 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/dom.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../node/dom'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/format_json.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/format_json.d.ts new file mode 100644 index 0000000..428b6d9 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/format_json.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../node/format_json'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/random_bytes.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/random_bytes.d.ts new file mode 100644 index 0000000..132614e --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/random_bytes.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../node/random_bytes'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/serializer.d.ts new file mode 100644 index 0000000..dcf50ac --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/serializer.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../browser_lite/serializer'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/snapshot_to_json.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/snapshot_to_json.d.ts new file mode 100644 index 0000000..c85016c --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/snapshot_to_json.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2025 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 * from '../node/snapshot_to_json'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/text_serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/text_serializer.d.ts new file mode 100644 index 0000000..3a5069e --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/node_lite/text_serializer.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2023 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 * from '../browser_lite/text_serializer'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/random_bytes.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/random_bytes.d.ts new file mode 100644 index 0000000..672e612 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/random_bytes.d.ts @@ -0,0 +1,22 @@ +/** + * @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. + */ +/** + * Generates `nBytes` of random bytes. + * + * If `nBytes < 0` , an error will be thrown. + */ +export declare function randomBytes(nBytes: number): Uint8Array; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/base64.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/base64.d.ts new file mode 100644 index 0000000..9ea2985 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/base64.d.ts @@ -0,0 +1,22 @@ +/** + * @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. + */ +/** Converts a Base64 encoded string to a binary string. */ +export declare function decodeBase64(encoded: string): string; +/** Converts a binary string to a Base64 encoded string. */ +export declare function encodeBase64(raw: string): string; +/** True if and only if the Base64 conversion functions are available. */ +export declare function isBase64Available(): boolean; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/byte_stream_reader.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/byte_stream_reader.d.ts new file mode 100644 index 0000000..939290b --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/byte_stream_reader.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export { toByteStreamReader } from '../browser/byte_stream_reader'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/connection.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/connection.d.ts new file mode 100644 index 0000000..da831d6 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/connection.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export { newConnection, newConnectivityMonitor } from '../browser/connection'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/dom.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/dom.d.ts new file mode 100644 index 0000000..4c629fc --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/dom.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export { getWindow, getDocument } from '../browser/dom'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/format_json.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/format_json.d.ts new file mode 100644 index 0000000..d1d3dc7 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/format_json.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export { formatJSON } from '../browser/format_json'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/random_bytes.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/random_bytes.d.ts new file mode 100644 index 0000000..6774017 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/random_bytes.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export { randomBytes } from '../browser/random_bytes'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/serializer.d.ts new file mode 100644 index 0000000..c7a81ae --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/serializer.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export { newSerializer } from '../browser/serializer'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/snapshot_to_json.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/snapshot_to_json.d.ts new file mode 100644 index 0000000..8ab87f6 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/snapshot_to_json.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2025 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 { buildDocumentSnapshotJsonBundle, buildQuerySnapshotJsonBundle } from '../browser/snapshot_to_json'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/text_serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/text_serializer.d.ts new file mode 100644 index 0000000..efcbff3 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn/text_serializer.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2023 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 { newTextEncoder, newTextDecoder } from '../browser/text_serializer'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/base64.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/base64.d.ts new file mode 100644 index 0000000..3d236cd --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/base64.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../rn/base64'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/byte_stream_reader.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/byte_stream_reader.d.ts new file mode 100644 index 0000000..9206b65 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/byte_stream_reader.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../rn/byte_stream_reader'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/connection.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/connection.d.ts new file mode 100644 index 0000000..6509c0c --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/connection.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../browser_lite/connection'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/dom.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/dom.d.ts new file mode 100644 index 0000000..0469362 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/dom.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../rn/dom'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/format_json.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/format_json.d.ts new file mode 100644 index 0000000..0a17cf8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/format_json.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../rn/format_json'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/random_bytes.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/random_bytes.d.ts new file mode 100644 index 0000000..8ca59f3 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/random_bytes.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../rn/random_bytes'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/serializer.d.ts new file mode 100644 index 0000000..dcf50ac --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/serializer.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export * from '../browser_lite/serializer'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/snapshot_to_json.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/snapshot_to_json.d.ts new file mode 100644 index 0000000..939290b --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/snapshot_to_json.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export { toByteStreamReader } from '../browser/byte_stream_reader'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/text_serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/text_serializer.d.ts new file mode 100644 index 0000000..3a5069e --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/rn_lite/text_serializer.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2023 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 * from '../browser_lite/text_serializer'; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/serializer.d.ts new file mode 100644 index 0000000..25f5533 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/serializer.d.ts @@ -0,0 +1,19 @@ +/** + * @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 { JsonProtoSerializer } from '../remote/serializer'; +export declare function newSerializer(databaseId: DatabaseId): JsonProtoSerializer; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/snapshot_to_json.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/snapshot_to_json.d.ts new file mode 100644 index 0000000..83eadf0 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/snapshot_to_json.d.ts @@ -0,0 +1,28 @@ +/** + * @license + * Copyright 2025 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 { Firestore } from '../api/database'; +import { Query } from '../core/query'; +import { DocumentData } from '../lite-api/reference'; +import { Document } from '../model/document'; +/** + * Constructs the bundle data for a DocumentSnapshot used in its toJSON serialization. + */ +export declare function buildDocumentSnapshotJsonBundle(db: Firestore, document: Document, docData: DocumentData, path: string): string; +/** + * Constructs the bundle data for a QuerySnapshot used in its toJSON serialization. + */ +export declare function buildQuerySnapshotJsonBundle(db: Firestore, query: Query, bundleName: string, parent: string, paths: string[], docs: Document[], documentData: DocumentData[]): string; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/text_serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/text_serializer.d.ts new file mode 100644 index 0000000..47213fb --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/platform/text_serializer.d.ts @@ -0,0 +1,24 @@ +/** + * @license + * Copyright 2023 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. + */ +/** + * An instance of the Platform's 'TextEncoder' implementation. + */ +export declare function newTextEncoder(): TextEncoder; +/** + * An instance of the Platform's 'TextDecoder' implementation. + */ +export declare function newTextDecoder(): TextDecoder; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/protos/firestore_bundle_proto.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/protos/firestore_bundle_proto.d.ts new file mode 100644 index 0000000..e3f7740 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/protos/firestore_bundle_proto.d.ts @@ -0,0 +1,72 @@ +/** + * @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 { StructuredQuery, Timestamp, Document } from './firestore_proto_api'; +/** Properties of a BundledQuery. */ +export interface BundledQuery { + /** BundledQuery parent */ + parent?: string | null; + /** BundledQuery structuredQuery */ + structuredQuery?: StructuredQuery | null; + /** BundledQuery limitType */ + limitType?: LimitType | null; +} +/** LimitType enum. */ +export type LimitType = 'FIRST' | 'LAST'; +/** Properties of a NamedQuery. */ +export interface NamedQuery { + /** NamedQuery name */ + name?: string | null; + /** NamedQuery bundledQuery */ + bundledQuery?: BundledQuery | null; + /** NamedQuery readTime */ + readTime?: Timestamp | null; +} +/** Properties of a BundledDocumentMetadata. */ +export interface BundledDocumentMetadata { + /** BundledDocumentMetadata name */ + name?: string | null; + /** BundledDocumentMetadata readTime */ + readTime?: Timestamp | null; + /** BundledDocumentMetadata exists */ + exists?: boolean | null; + /** The names of the queries in this bundle that this document matches to. */ + queries?: string[]; +} +/** Properties of a BundleMetadata. */ +export interface BundleMetadata { + /** BundleMetadata id */ + id?: string | null; + /** BundleMetadata createTime */ + createTime?: Timestamp | null; + /** BundleMetadata version */ + version?: number | null; + /** BundleMetadata totalDocuments */ + totalDocuments?: number | null; + /** BundleMetadata totalBytes */ + totalBytes?: number | null; +} +/** Properties of a BundleElement. */ +export interface BundleElement { + /** BundleElement metadata */ + metadata?: BundleMetadata | null; + /** BundleElement namedQuery */ + namedQuery?: NamedQuery | null; + /** BundleElement documentMetadata */ + documentMetadata?: BundledDocumentMetadata | null; + /** BundleElement document */ + document?: Document | null; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/protos/firestore_proto_api.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/protos/firestore_proto_api.d.ts new file mode 100644 index 0000000..5f37ee6 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/protos/firestore_proto_api.d.ts @@ -0,0 +1,836 @@ +/** + * @license + * Copyright 2019 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 type ApiClientHookFactory = any; +export declare type PromiseRequestService = any; +export interface ApiClientObjectMap<T> { + [k: string]: T; +} +export declare type Timestamp = string | { + seconds?: string | number; + nanos?: number; +}; +export declare type CompositeFilterOp = 'OPERATOR_UNSPECIFIED' | 'AND' | 'OR'; +export interface ICompositeFilterOpEnum { + OPERATOR_UNSPECIFIED: CompositeFilterOp; + AND: CompositeFilterOp; + values(): CompositeFilterOp[]; +} +export declare const CompositeFilterOpEnum: ICompositeFilterOpEnum; +export declare type FieldFilterOp = 'OPERATOR_UNSPECIFIED' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'EQUAL' | 'NOT_EQUAL' | 'ARRAY_CONTAINS' | 'IN' | 'ARRAY_CONTAINS_ANY' | 'NOT_IN'; +export interface IFieldFilterOpEnum { + OPERATOR_UNSPECIFIED: FieldFilterOp; + LESS_THAN: FieldFilterOp; + LESS_THAN_OR_EQUAL: FieldFilterOp; + GREATER_THAN: FieldFilterOp; + GREATER_THAN_OR_EQUAL: FieldFilterOp; + EQUAL: FieldFilterOp; + NOT_EQUAL: FieldFilterOp; + ARRAY_CONTAINS: FieldFilterOp; + IN: FieldFilterOp; + ARRAY_CONTAINS_ANY: FieldFilterOp; + NOT_IN: FieldFilterOp; + values(): FieldFilterOp[]; +} +export declare const FieldFilterOpEnum: IFieldFilterOpEnum; +export declare type FieldTransformSetToServerValue = 'SERVER_VALUE_UNSPECIFIED' | 'REQUEST_TIME'; +export interface IFieldTransformSetToServerValueEnum { + SERVER_VALUE_UNSPECIFIED: FieldTransformSetToServerValue; + REQUEST_TIME: FieldTransformSetToServerValue; + values(): FieldTransformSetToServerValue[]; +} +export declare const FieldTransformSetToServerValueEnum: IFieldTransformSetToServerValueEnum; +export declare type IndexFieldMode = 'MODE_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING'; +export interface IIndexFieldModeEnum { + MODE_UNSPECIFIED: IndexFieldMode; + ASCENDING: IndexFieldMode; + DESCENDING: IndexFieldMode; + values(): IndexFieldMode[]; +} +export declare const IndexFieldModeEnum: IIndexFieldModeEnum; +export declare type IndexState = 'STATE_UNSPECIFIED' | 'CREATING' | 'READY' | 'ERROR'; +export interface IIndexStateEnum { + STATE_UNSPECIFIED: IndexState; + CREATING: IndexState; + READY: IndexState; + ERROR: IndexState; + values(): IndexState[]; +} +export declare const IndexStateEnum: IIndexStateEnum; +export declare type OrderDirection = 'DIRECTION_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING'; +export interface IOrderDirectionEnum { + DIRECTION_UNSPECIFIED: OrderDirection; + ASCENDING: OrderDirection; + DESCENDING: OrderDirection; + values(): OrderDirection[]; +} +export declare const OrderDirectionEnum: IOrderDirectionEnum; +export declare type TargetChangeTargetChangeType = 'NO_CHANGE' | 'ADD' | 'REMOVE' | 'CURRENT' | 'RESET'; +export interface ITargetChangeTargetChangeTypeEnum { + NO_CHANGE: TargetChangeTargetChangeType; + ADD: TargetChangeTargetChangeType; + REMOVE: TargetChangeTargetChangeType; + CURRENT: TargetChangeTargetChangeType; + RESET: TargetChangeTargetChangeType; + values(): TargetChangeTargetChangeType[]; +} +export declare const TargetChangeTargetChangeTypeEnum: ITargetChangeTargetChangeTypeEnum; +export declare type UnaryFilterOp = 'OPERATOR_UNSPECIFIED' | 'IS_NAN' | 'IS_NULL' | 'IS_NOT_NAN' | 'IS_NOT_NULL'; +export interface IUnaryFilterOpEnum { + OPERATOR_UNSPECIFIED: UnaryFilterOp; + IS_NAN: UnaryFilterOp; + IS_NULL: UnaryFilterOp; + IS_NOT_NAN: UnaryFilterOp; + IS_NOT_NULL: UnaryFilterOp; + values(): UnaryFilterOp[]; +} +export declare const UnaryFilterOpEnum: IUnaryFilterOpEnum; +export declare type ValueNullValue = 'NULL_VALUE'; +export interface IValueNullValueEnum { + NULL_VALUE: ValueNullValue; + values(): ValueNullValue[]; +} +export declare const ValueNullValueEnum: IValueNullValueEnum; +export declare namespace firestoreV1ApiClientInterfaces { + interface ArrayValue { + values?: Value[]; + } + interface BatchGetDocumentsRequest { + database?: string; + documents?: string[]; + mask?: DocumentMask; + transaction?: string; + newTransaction?: TransactionOptions; + readTime?: string; + } + interface BatchGetDocumentsResponse { + found?: Document; + missing?: string; + transaction?: string; + readTime?: string; + } + interface BeginTransactionRequest { + options?: TransactionOptions; + } + interface BeginTransactionResponse { + transaction?: string; + } + interface CollectionSelector { + collectionId?: string; + allDescendants?: boolean; + } + interface CommitRequest { + database?: string; + writes?: Write[]; + transaction?: string; + } + interface CommitResponse { + writeResults?: WriteResult[]; + commitTime?: string; + } + interface CompositeFilter { + op?: CompositeFilterOp; + filters?: Filter[]; + } + interface Cursor { + values?: Value[]; + before?: boolean; + } + interface Document { + name?: string; + fields?: ApiClientObjectMap<Value>; + createTime?: Timestamp; + updateTime?: Timestamp; + } + interface DocumentChange { + document?: Document; + targetIds?: number[]; + removedTargetIds?: number[]; + } + interface DocumentDelete { + document?: string; + removedTargetIds?: number[]; + readTime?: Timestamp; + } + interface DocumentMask { + fieldPaths?: string[]; + } + interface DocumentRemove { + document?: string; + removedTargetIds?: number[]; + readTime?: string; + } + interface DocumentTransform { + document?: string; + fieldTransforms?: FieldTransform[]; + } + interface DocumentsTarget { + documents?: string[]; + } + interface Empty { + } + interface ExistenceFilter { + targetId?: number; + count?: number; + unchangedNames?: BloomFilter; + } + interface BloomFilter { + bits?: BitSequence; + hashCount?: number; + } + interface BitSequence { + bitmap?: string | Uint8Array; + padding?: number; + } + interface FieldFilter { + field?: FieldReference; + op?: FieldFilterOp; + value?: Value; + } + interface FieldReference { + fieldPath?: string; + } + interface FieldTransform { + fieldPath?: string; + setToServerValue?: FieldTransformSetToServerValue; + appendMissingElements?: ArrayValue; + removeAllFromArray?: ArrayValue; + increment?: Value; + } + interface Filter { + compositeFilter?: CompositeFilter; + fieldFilter?: FieldFilter; + unaryFilter?: UnaryFilter; + } + interface Index { + name?: string; + collectionId?: string; + fields?: IndexField[]; + state?: IndexState; + } + interface IndexField { + fieldPath?: string; + mode?: IndexFieldMode; + } + interface LatLng { + latitude?: number; + longitude?: number; + } + interface ListCollectionIdsRequest { + pageSize?: number; + pageToken?: string; + } + interface ListCollectionIdsResponse { + collectionIds?: string[]; + nextPageToken?: string; + } + interface ListDocumentsResponse { + documents?: Document[]; + nextPageToken?: string; + } + interface ListIndexesResponse { + indexes?: Index[]; + nextPageToken?: string; + } + interface ListenRequest { + addTarget?: Target; + removeTarget?: number; + labels?: ApiClientObjectMap<string>; + } + interface ListenResponse { + targetChange?: TargetChange; + documentChange?: DocumentChange; + documentDelete?: DocumentDelete; + documentRemove?: DocumentRemove; + filter?: ExistenceFilter; + } + interface MapValue { + fields?: ApiClientObjectMap<Value>; + } + interface Operation { + name?: string; + metadata?: ApiClientObjectMap<any>; + done?: boolean; + error?: Status; + response?: ApiClientObjectMap<any>; + } + interface Order { + field?: FieldReference; + direction?: OrderDirection; + } + interface Precondition { + exists?: boolean; + updateTime?: Timestamp; + } + interface Projection { + fields?: FieldReference[]; + } + interface QueryTarget { + parent?: string; + structuredQuery?: StructuredQuery; + } + interface ReadOnly { + readTime?: string; + } + interface ReadWrite { + retryTransaction?: string; + } + interface RollbackRequest { + transaction?: string; + } + interface RunQueryRequest { + parent?: string; + structuredQuery?: StructuredQuery; + transaction?: string; + newTransaction?: TransactionOptions; + readTime?: string; + } + interface RunQueryResponse { + transaction?: string; + document?: Document; + readTime?: string; + skippedResults?: number; + } + interface RunAggregationQueryRequest { + parent?: string; + structuredAggregationQuery?: StructuredAggregationQuery; + transaction?: string; + newTransaction?: TransactionOptions; + readTime?: string; + } + interface RunAggregationQueryResponse { + result?: AggregationResult; + transaction?: string; + readTime?: string; + } + interface AggregationResult { + aggregateFields?: ApiClientObjectMap<Value>; + } + interface StructuredAggregationQuery { + structuredQuery?: StructuredQuery; + aggregations?: Aggregation[]; + } + interface Aggregation { + count?: Count; + sum?: Sum; + avg?: Avg; + alias?: string; + } + interface Count { + upTo?: number; + } + interface Sum { + field?: FieldReference; + } + interface Avg { + field?: FieldReference; + } + interface Status { + code?: number; + message?: string; + details?: Array<ApiClientObjectMap<any>>; + } + interface StructuredQuery { + select?: Projection; + from?: CollectionSelector[]; + where?: Filter; + orderBy?: Order[]; + startAt?: Cursor; + endAt?: Cursor; + offset?: number; + limit?: number | { + value: number; + }; + } + interface Target { + query?: QueryTarget; + documents?: DocumentsTarget; + resumeToken?: string | Uint8Array; + readTime?: Timestamp; + targetId?: number; + once?: boolean; + expectedCount?: number | { + value: number; + }; + } + interface TargetChange { + targetChangeType?: TargetChangeTargetChangeType; + targetIds?: number[]; + cause?: Status; + resumeToken?: string | Uint8Array; + readTime?: Timestamp; + } + interface TransactionOptions { + readOnly?: ReadOnly; + readWrite?: ReadWrite; + } + interface UnaryFilter { + op?: UnaryFilterOp; + field?: FieldReference; + } + interface Value { + nullValue?: ValueNullValue; + booleanValue?: boolean; + integerValue?: string | number; + doubleValue?: string | number; + timestampValue?: Timestamp; + stringValue?: string; + bytesValue?: string | Uint8Array; + referenceValue?: string; + geoPointValue?: LatLng; + arrayValue?: ArrayValue; + mapValue?: MapValue; + } + interface Write { + update?: Document; + delete?: string; + verify?: string; + transform?: DocumentTransform; + updateMask?: DocumentMask; + updateTransforms?: FieldTransform[]; + currentDocument?: Precondition; + } + interface WriteRequest { + streamId?: string; + writes?: Write[]; + streamToken?: string | Uint8Array; + labels?: ApiClientObjectMap<string>; + } + interface WriteResponse { + streamId?: string; + streamToken?: string | Uint8Array; + writeResults?: WriteResult[]; + commitTime?: Timestamp; + } + interface WriteResult { + updateTime?: Timestamp; + transformResults?: Value[]; + } +} +export declare type ArrayValue = firestoreV1ApiClientInterfaces.ArrayValue; +export declare type BatchGetDocumentsRequest = firestoreV1ApiClientInterfaces.BatchGetDocumentsRequest; +export declare type BatchGetDocumentsResponse = firestoreV1ApiClientInterfaces.BatchGetDocumentsResponse; +export declare type BeginTransactionRequest = firestoreV1ApiClientInterfaces.BeginTransactionRequest; +export declare type BeginTransactionResponse = firestoreV1ApiClientInterfaces.BeginTransactionResponse; +export declare type BloomFilter = firestoreV1ApiClientInterfaces.BloomFilter; +export declare type CollectionSelector = firestoreV1ApiClientInterfaces.CollectionSelector; +export declare type CommitRequest = firestoreV1ApiClientInterfaces.CommitRequest; +export declare type CommitResponse = firestoreV1ApiClientInterfaces.CommitResponse; +export declare type CompositeFilter = firestoreV1ApiClientInterfaces.CompositeFilter; +export declare type Cursor = firestoreV1ApiClientInterfaces.Cursor; +export declare type Document = firestoreV1ApiClientInterfaces.Document; +export declare type DocumentChange = firestoreV1ApiClientInterfaces.DocumentChange; +export declare type DocumentDelete = firestoreV1ApiClientInterfaces.DocumentDelete; +export declare type DocumentMask = firestoreV1ApiClientInterfaces.DocumentMask; +export declare type DocumentRemove = firestoreV1ApiClientInterfaces.DocumentRemove; +export declare type DocumentTransform = firestoreV1ApiClientInterfaces.DocumentTransform; +export declare type DocumentsTarget = firestoreV1ApiClientInterfaces.DocumentsTarget; +export declare type Empty = firestoreV1ApiClientInterfaces.Empty; +export declare type ExistenceFilter = firestoreV1ApiClientInterfaces.ExistenceFilter; +export declare type FieldFilter = firestoreV1ApiClientInterfaces.FieldFilter; +export declare type FieldReference = firestoreV1ApiClientInterfaces.FieldReference; +export declare type FieldTransform = firestoreV1ApiClientInterfaces.FieldTransform; +export declare type Filter = firestoreV1ApiClientInterfaces.Filter; +export declare type Index = firestoreV1ApiClientInterfaces.Index; +export declare type IndexField = firestoreV1ApiClientInterfaces.IndexField; +export declare type LatLng = firestoreV1ApiClientInterfaces.LatLng; +export declare type ListCollectionIdsRequest = firestoreV1ApiClientInterfaces.ListCollectionIdsRequest; +export declare type ListCollectionIdsResponse = firestoreV1ApiClientInterfaces.ListCollectionIdsResponse; +export declare type ListDocumentsResponse = firestoreV1ApiClientInterfaces.ListDocumentsResponse; +export declare type ListIndexesResponse = firestoreV1ApiClientInterfaces.ListIndexesResponse; +export declare type ListenRequest = firestoreV1ApiClientInterfaces.ListenRequest; +export declare type ListenResponse = firestoreV1ApiClientInterfaces.ListenResponse; +export declare type MapValue = firestoreV1ApiClientInterfaces.MapValue; +export declare type Operation = firestoreV1ApiClientInterfaces.Operation; +export declare type Order = firestoreV1ApiClientInterfaces.Order; +export declare type Precondition = firestoreV1ApiClientInterfaces.Precondition; +export declare type Projection = firestoreV1ApiClientInterfaces.Projection; +export declare type QueryTarget = firestoreV1ApiClientInterfaces.QueryTarget; +export declare type ReadOnly = firestoreV1ApiClientInterfaces.ReadOnly; +export declare type ReadWrite = firestoreV1ApiClientInterfaces.ReadWrite; +export declare type RollbackRequest = firestoreV1ApiClientInterfaces.RollbackRequest; +export declare type RunQueryRequest = firestoreV1ApiClientInterfaces.RunQueryRequest; +export declare type RunQueryResponse = firestoreV1ApiClientInterfaces.RunQueryResponse; +export declare type RunAggregationQueryRequest = firestoreV1ApiClientInterfaces.RunAggregationQueryRequest; +export declare type Aggregation = firestoreV1ApiClientInterfaces.Aggregation; +export declare type RunAggregationQueryResponse = firestoreV1ApiClientInterfaces.RunAggregationQueryResponse; +export declare type Status = firestoreV1ApiClientInterfaces.Status; +export declare type StructuredQuery = firestoreV1ApiClientInterfaces.StructuredQuery; +export declare type Target = firestoreV1ApiClientInterfaces.Target; +export declare type TargetChange = firestoreV1ApiClientInterfaces.TargetChange; +export declare type TransactionOptions = firestoreV1ApiClientInterfaces.TransactionOptions; +export declare type UnaryFilter = firestoreV1ApiClientInterfaces.UnaryFilter; +export declare type Value = firestoreV1ApiClientInterfaces.Value; +export declare type Write = firestoreV1ApiClientInterfaces.Write; +export declare type WriteRequest = firestoreV1ApiClientInterfaces.WriteRequest; +export declare type WriteResponse = firestoreV1ApiClientInterfaces.WriteResponse; +export declare type WriteResult = firestoreV1ApiClientInterfaces.WriteResult; +export declare type ProjectsDatabasesDocumentsApiClient$Xgafv = '1' | '2'; +export interface IProjectsDatabasesDocumentsApiClient$XgafvEnum { + 1: ProjectsDatabasesDocumentsApiClient$Xgafv; + 2: ProjectsDatabasesDocumentsApiClient$Xgafv; + values(): ProjectsDatabasesDocumentsApiClient$Xgafv[]; +} +export declare const ProjectsDatabasesDocumentsApiClient$XgafvEnum: IProjectsDatabasesDocumentsApiClient$XgafvEnum; +export declare type ProjectsDatabasesDocumentsApiClientAlt = 'json' | 'media' | 'proto'; +export interface IProjectsDatabasesDocumentsApiClientAltEnum { + JSON: ProjectsDatabasesDocumentsApiClientAlt; + MEDIA: ProjectsDatabasesDocumentsApiClientAlt; + PROTO: ProjectsDatabasesDocumentsApiClientAlt; + values(): ProjectsDatabasesDocumentsApiClientAlt[]; +} +export declare const ProjectsDatabasesDocumentsApiClientAltEnum: IProjectsDatabasesDocumentsApiClientAltEnum; +export interface ProjectsDatabasesDocumentsBatchGetNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesDocumentsApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesDocumentsApiClient$Xgafv; +} +export interface ProjectsDatabasesDocumentsBeginTransactionNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesDocumentsApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesDocumentsApiClient$Xgafv; +} +export interface ProjectsDatabasesDocumentsCommitNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesDocumentsApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesDocumentsApiClient$Xgafv; +} +export interface ProjectsDatabasesDocumentsCreateDocumentNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesDocumentsApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesDocumentsApiClient$Xgafv; + documentId?: string; + maskFieldPaths?: string[]; +} +export interface ProjectsDatabasesDocumentsDeleteNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesDocumentsApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesDocumentsApiClient$Xgafv; + currentDocumentExists?: boolean; + currentDocumentUpdateTime?: string; +} +export interface ProjectsDatabasesDocumentsGetNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesDocumentsApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesDocumentsApiClient$Xgafv; + maskFieldPaths?: string[]; + transaction?: string; + readTime?: string; +} +export interface ProjectsDatabasesDocumentsListCollectionIdsNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesDocumentsApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesDocumentsApiClient$Xgafv; +} +export interface ProjectsDatabasesDocumentsListNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesDocumentsApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesDocumentsApiClient$Xgafv; + pageSize?: number; + pageToken?: string; + orderBy?: string; + maskFieldPaths?: string[]; + transaction?: string; + readTime?: string; + showMissing?: boolean; +} +export interface ProjectsDatabasesDocumentsListenNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesDocumentsApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesDocumentsApiClient$Xgafv; +} +export interface ProjectsDatabasesDocumentsPatchNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesDocumentsApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesDocumentsApiClient$Xgafv; + updateMaskFieldPaths?: string[]; + maskFieldPaths?: string[]; + currentDocumentExists?: boolean; + currentDocumentUpdateTime?: string; +} +export interface ProjectsDatabasesDocumentsRollbackNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesDocumentsApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesDocumentsApiClient$Xgafv; +} +export interface ProjectsDatabasesDocumentsRunQueryNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesDocumentsApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesDocumentsApiClient$Xgafv; +} +export interface ProjectsDatabasesDocumentsWriteNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesDocumentsApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesDocumentsApiClient$Xgafv; +} +export declare abstract class ProjectsDatabasesDocumentsApiClient { + private constructor(); + abstract batchGet(database: string, $requestBody: BatchGetDocumentsRequest, __namedParams__?: ProjectsDatabasesDocumentsBatchGetNamedParameters & object): Promise<BatchGetDocumentsResponse>; + abstract beginTransaction(database: string, $requestBody: BeginTransactionRequest, __namedParams__?: ProjectsDatabasesDocumentsBeginTransactionNamedParameters & object): Promise<BeginTransactionResponse>; + abstract commit(database: string, $requestBody: CommitRequest, __namedParams__?: ProjectsDatabasesDocumentsCommitNamedParameters & object): Promise<CommitResponse>; + abstract createDocument(parent: string, collectionId: string, $requestBody: Document, __namedParams__?: ProjectsDatabasesDocumentsCreateDocumentNamedParameters & object): Promise<Document>; + abstract delete(name: string, __namedParams__?: ProjectsDatabasesDocumentsDeleteNamedParameters & object): Promise<Empty>; + abstract get(name: string, __namedParams__?: ProjectsDatabasesDocumentsGetNamedParameters & object): Promise<Document>; + abstract list(parent: string, collectionId: string, __namedParams__?: ProjectsDatabasesDocumentsListNamedParameters & object): Promise<ListDocumentsResponse>; + abstract listCollectionIds(parent: string, $requestBody: ListCollectionIdsRequest, __namedParams__?: ProjectsDatabasesDocumentsListCollectionIdsNamedParameters & object): Promise<ListCollectionIdsResponse>; + abstract listen(database: string, $requestBody: ListenRequest, __namedParams__?: ProjectsDatabasesDocumentsListenNamedParameters & object): Promise<ListenResponse>; + abstract patch(name: string, $requestBody: Document, __namedParams__?: ProjectsDatabasesDocumentsPatchNamedParameters & object): Promise<Document>; + abstract rollback(database: string, $requestBody: RollbackRequest, __namedParams__?: ProjectsDatabasesDocumentsRollbackNamedParameters & object): Promise<Empty>; + abstract runQuery(parent: string, $requestBody: RunQueryRequest, __namedParams__?: ProjectsDatabasesDocumentsRunQueryNamedParameters & object): Promise<RunQueryResponse>; + abstract write(database: string, $requestBody: WriteRequest, __namedParams__?: ProjectsDatabasesDocumentsWriteNamedParameters & object): Promise<WriteResponse>; +} +export declare class ProjectsDatabasesDocumentsApiClientImpl implements ProjectsDatabasesDocumentsApiClient { + private gapiVersion; + private $apiClient; + constructor(gapiVersion: string, gapiRequestService: PromiseRequestService, apiClientHookFactory?: ApiClientHookFactory | null); + batchGet(database: string, $requestBody: BatchGetDocumentsRequest, { $Xgafv, access_token, alt, bearer_token, callback, fields, key, oauth_token, pp, prettyPrint, quotaUser, uploadType, upload_protocol }?: ProjectsDatabasesDocumentsBatchGetNamedParameters & object): Promise<BatchGetDocumentsResponse>; + beginTransaction(database: string, $requestBody: BeginTransactionRequest, { $Xgafv, access_token, alt, bearer_token, callback, fields, key, oauth_token, pp, prettyPrint, quotaUser, uploadType, upload_protocol }?: ProjectsDatabasesDocumentsBeginTransactionNamedParameters & object): Promise<BeginTransactionResponse>; + commit(database: string, $requestBody: CommitRequest, { $Xgafv, access_token, alt, bearer_token, callback, fields, key, oauth_token, pp, prettyPrint, quotaUser, uploadType, upload_protocol }?: ProjectsDatabasesDocumentsCommitNamedParameters & object): Promise<CommitResponse>; + createDocument(parent: string, collectionId: string, $requestBody: Document, { $Xgafv, access_token, alt, bearer_token, callback, documentId, fields, key, maskFieldPaths, oauth_token, pp, prettyPrint, quotaUser, uploadType, upload_protocol }?: ProjectsDatabasesDocumentsCreateDocumentNamedParameters & object): Promise<Document>; + delete(name: string, { $Xgafv, access_token, alt, bearer_token, callback, currentDocumentExists, currentDocumentUpdateTime, fields, key, oauth_token, pp, prettyPrint, quotaUser, uploadType, upload_protocol }?: ProjectsDatabasesDocumentsDeleteNamedParameters & object): Promise<Empty>; + get(name: string, { $Xgafv, access_token, alt, bearer_token, callback, fields, key, maskFieldPaths, oauth_token, pp, prettyPrint, quotaUser, readTime, transaction, uploadType, upload_protocol }?: ProjectsDatabasesDocumentsGetNamedParameters & object): Promise<Document>; + list(parent: string, collectionId: string, { $Xgafv, access_token, alt, bearer_token, callback, fields, key, maskFieldPaths, oauth_token, orderBy, pageSize, pageToken, pp, prettyPrint, quotaUser, readTime, showMissing, transaction, uploadType, upload_protocol }?: ProjectsDatabasesDocumentsListNamedParameters & object): Promise<ListDocumentsResponse>; + listCollectionIds(parent: string, $requestBody: ListCollectionIdsRequest, { $Xgafv, access_token, alt, bearer_token, callback, fields, key, oauth_token, pp, prettyPrint, quotaUser, uploadType, upload_protocol }?: ProjectsDatabasesDocumentsListCollectionIdsNamedParameters & object): Promise<ListCollectionIdsResponse>; + listen(database: string, $requestBody: ListenRequest, { $Xgafv, access_token, alt, bearer_token, callback, fields, key, oauth_token, pp, prettyPrint, quotaUser, uploadType, upload_protocol }?: ProjectsDatabasesDocumentsListenNamedParameters & object): Promise<ListenResponse>; + patch(name: string, $requestBody: Document, { $Xgafv, access_token, alt, bearer_token, callback, currentDocumentExists, currentDocumentUpdateTime, fields, key, maskFieldPaths, oauth_token, pp, prettyPrint, quotaUser, updateMaskFieldPaths, uploadType, upload_protocol }?: ProjectsDatabasesDocumentsPatchNamedParameters & object): Promise<Document>; + rollback(database: string, $requestBody: RollbackRequest, { $Xgafv, access_token, alt, bearer_token, callback, fields, key, oauth_token, pp, prettyPrint, quotaUser, uploadType, upload_protocol }?: ProjectsDatabasesDocumentsRollbackNamedParameters & object): Promise<Empty>; + runQuery(parent: string, $requestBody: RunQueryRequest, { $Xgafv, access_token, alt, bearer_token, callback, fields, key, oauth_token, pp, prettyPrint, quotaUser, uploadType, upload_protocol }?: ProjectsDatabasesDocumentsRunQueryNamedParameters & object): Promise<RunQueryResponse>; + write(database: string, $requestBody: WriteRequest, { $Xgafv, access_token, alt, bearer_token, callback, fields, key, oauth_token, pp, prettyPrint, quotaUser, uploadType, upload_protocol }?: ProjectsDatabasesDocumentsWriteNamedParameters & object): Promise<WriteResponse>; +} +export declare type ProjectsDatabasesIndexesApiClient$Xgafv = '1' | '2'; +export interface IProjectsDatabasesIndexesApiClient$XgafvEnum { + 1: ProjectsDatabasesIndexesApiClient$Xgafv; + 2: ProjectsDatabasesIndexesApiClient$Xgafv; + values(): ProjectsDatabasesIndexesApiClient$Xgafv[]; +} +export declare const ProjectsDatabasesIndexesApiClient$XgafvEnum: IProjectsDatabasesIndexesApiClient$XgafvEnum; +export declare type ProjectsDatabasesIndexesApiClientAlt = 'json' | 'media' | 'proto'; +export interface IProjectsDatabasesIndexesApiClientAltEnum { + JSON: ProjectsDatabasesIndexesApiClientAlt; + MEDIA: ProjectsDatabasesIndexesApiClientAlt; + PROTO: ProjectsDatabasesIndexesApiClientAlt; + values(): ProjectsDatabasesIndexesApiClientAlt[]; +} +export declare const ProjectsDatabasesIndexesApiClientAltEnum: IProjectsDatabasesIndexesApiClientAltEnum; +export interface ProjectsDatabasesIndexesCreateNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesIndexesApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesIndexesApiClient$Xgafv; +} +export interface ProjectsDatabasesIndexesDeleteNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesIndexesApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesIndexesApiClient$Xgafv; +} +export interface ProjectsDatabasesIndexesGetNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesIndexesApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesIndexesApiClient$Xgafv; +} +export interface ProjectsDatabasesIndexesListNamedParameters { + access_token?: string; + alt?: ProjectsDatabasesIndexesApiClientAlt; + bearer_token?: string; + callback?: string; + fields?: string; + key?: string; + oauth_token?: string; + pp?: boolean; + prettyPrint?: boolean; + quotaUser?: string; + upload_protocol?: string; + uploadType?: string; + $Xgafv?: ProjectsDatabasesIndexesApiClient$Xgafv; + filter?: string; + pageSize?: number; + pageToken?: string; +} +export declare abstract class ProjectsDatabasesIndexesApiClient { + private constructor(); + abstract create(parent: string, $requestBody: Index, __namedParams__?: ProjectsDatabasesIndexesCreateNamedParameters & object): Promise<Operation>; + abstract delete(name: string, __namedParams__?: ProjectsDatabasesIndexesDeleteNamedParameters & object): Promise<Empty>; + abstract get(name: string, __namedParams__?: ProjectsDatabasesIndexesGetNamedParameters & object): Promise<Index>; + abstract list(parent: string, __namedParams__?: ProjectsDatabasesIndexesListNamedParameters & object): Promise<ListIndexesResponse>; +} +export declare class ProjectsDatabasesIndexesApiClientImpl implements ProjectsDatabasesIndexesApiClient { + private gapiVersion; + private $apiClient; + constructor(gapiVersion: string, gapiRequestService: PromiseRequestService, apiClientHookFactory?: ApiClientHookFactory | null); + create(parent: string, $requestBody: Index, { $Xgafv, access_token, alt, bearer_token, callback, fields, key, oauth_token, pp, prettyPrint, quotaUser, uploadType, upload_protocol }?: ProjectsDatabasesIndexesCreateNamedParameters & object): Promise<Operation>; + delete(name: string, { $Xgafv, access_token, alt, bearer_token, callback, fields, key, oauth_token, pp, prettyPrint, quotaUser, uploadType, upload_protocol }?: ProjectsDatabasesIndexesDeleteNamedParameters & object): Promise<Empty>; + get(name: string, { $Xgafv, access_token, alt, bearer_token, callback, fields, key, oauth_token, pp, prettyPrint, quotaUser, uploadType, upload_protocol }?: ProjectsDatabasesIndexesGetNamedParameters & object): Promise<Index>; + list(parent: string, { $Xgafv, access_token, alt, bearer_token, callback, fields, filter, key, oauth_token, pageSize, pageToken, pp, prettyPrint, quotaUser, uploadType, upload_protocol }?: ProjectsDatabasesIndexesListNamedParameters & object): Promise<ListIndexesResponse>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/register.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/register.d.ts new file mode 100644 index 0000000..6f9da17 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/register.d.ts @@ -0,0 +1,17 @@ +/** + * @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. + */ +export declare function registerFirestore(variant?: string, useFetchStreams?: boolean): void; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/backoff.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/backoff.d.ts new file mode 100644 index 0000000..cb0bc76 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/backoff.d.ts @@ -0,0 +1,106 @@ +/** + * @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 { AsyncQueue, TimerId } from '../util/async_queue'; +/** + * A helper for running delayed tasks following an exponential backoff curve + * between attempts. + * + * Each delay is made up of a "base" delay which follows the exponential + * backoff curve, and a +/- 50% "jitter" that is calculated and added to the + * base delay. This prevents clients from accidentally synchronizing their + * delays causing spikes of load to the backend. + */ +export declare class ExponentialBackoff { + /** + * The AsyncQueue to run backoff operations on. + */ + private readonly queue; + /** + * The ID to use when scheduling backoff operations on the AsyncQueue. + */ + private readonly timerId; + /** + * The initial delay (used as the base delay on the first retry attempt). + * Note that jitter will still be applied, so the actual delay could be as + * little as 0.5*initialDelayMs. + */ + private readonly initialDelayMs; + /** + * The multiplier to use to determine the extended base delay after each + * attempt. + */ + private readonly backoffFactor; + /** + * The maximum base delay after which no further backoff is performed. + * Note that jitter will still be applied, so the actual delay could be as + * much as 1.5*maxDelayMs. + */ + private readonly maxDelayMs; + private currentBaseMs; + private timerPromise; + /** The last backoff attempt, as epoch milliseconds. */ + private lastAttemptTime; + constructor( + /** + * The AsyncQueue to run backoff operations on. + */ + queue: AsyncQueue, + /** + * The ID to use when scheduling backoff operations on the AsyncQueue. + */ + timerId: TimerId, + /** + * The initial delay (used as the base delay on the first retry attempt). + * Note that jitter will still be applied, so the actual delay could be as + * little as 0.5*initialDelayMs. + */ + initialDelayMs?: number, + /** + * The multiplier to use to determine the extended base delay after each + * attempt. + */ + backoffFactor?: number, + /** + * The maximum base delay after which no further backoff is performed. + * Note that jitter will still be applied, so the actual delay could be as + * much as 1.5*maxDelayMs. + */ + maxDelayMs?: number); + /** + * Resets the backoff delay. + * + * The very next backoffAndWait() will have no delay. If it is called again + * (i.e. due to an error), initialDelayMs (plus jitter) will be used, and + * subsequent ones will increase according to the backoffFactor. + */ + reset(): void; + /** + * Resets the backoff delay to the maximum delay (e.g. for use after a + * RESOURCE_EXHAUSTED error). + */ + resetToMax(): void; + /** + * Returns a promise that resolves after currentDelayMs, and increases the + * delay for any subsequent attempts. If there was a pending backoff operation + * already, it will be canceled. + */ + backoffAndRun(op: () => Promise<void>): void; + skipBackoff(): void; + cancel(): void; + /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ + private jitterDelayMs; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/bloom_filter.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/bloom_filter.d.ts new file mode 100644 index 0000000..d80eb83 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/bloom_filter.d.ts @@ -0,0 +1,34 @@ +/** + * @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. + */ +export declare class BloomFilter { + readonly bitmap: Uint8Array; + readonly padding: number; + readonly hashCount: number; + readonly bitCount: number; + private readonly bitCountInInteger; + constructor(bitmap: Uint8Array, padding: number, hashCount: number); + private getBitIndex; + private isBitSet; + mightContain(value: string): boolean; + /** Create bloom filter for testing purposes only. */ + static create(bitCount: number, hashCount: number, contains: string[]): BloomFilter; + private insert; + private setBit; +} +export declare class BloomFilterError extends Error { + readonly name = "BloomFilterError"; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/connection.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/connection.d.ts new file mode 100644 index 0000000..87afea6 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/connection.d.ts @@ -0,0 +1,99 @@ +/** + * @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 { Token } from '../api/credentials'; +import { ResourcePath } from '../model/path'; +import { FirestoreError } from '../util/error'; +/** + * A connected RPC interface to a remote Datastore. + * + * Responsible for maintaining a connection to the backend (and informing when + * that connection state changes via onConnectionStateChange) and sending RPCs + * when possible. + * + * The Connection is not responsible for queueing RPCs to the backend when + * the connection is down. + * + * RPC messages are expected to be JavaScript objects representing the JSON that + * would be sent over the REST/JSON API to Datastore or used as input to + * creating the equivalent protocol buffers for GRPC. + */ +export interface Connection { + /** + * Invokes an RPC by name, given a request message as a JavaScript object + * representing the JSON to send. + * + * @param rpcName - the name of the RPC to invoke + * @param path - the path to invoke this RPC on. An array of path segments + * that will be encoded and joined with path separators when required. + * @param request - the Raw JSON object encoding of the request message + * @param token - the Token to use for the RPC. + * @returns a Promise containing the JSON object encoding of the response + */ + invokeRPC<Req, Resp>(rpcName: string, path: ResourcePath, request: Req, authToken: Token | null, appCheckToken: Token | null): Promise<Resp>; + /** + * Invokes a streaming RPC by name, given a request message as a JavaScript + * object representing the JSON to send. The responses will be consumed to + * completion and then returned as an array. + * + * @param rpcName - the name of the RPC to invoke + * @param path - the path to invoke this RPC on. An array of path segments + * that will be encoded and joined with path separators when required. + * @param request - the Raw JSON object encoding of the request message + * @param token - the Token to use for the RPC. + * @returns a Promise containing an array with the JSON object encodings of the + * responses + */ + invokeStreamingRPC<Req, Resp>(rpcName: string, path: ResourcePath, request: Req, authToken: Token | null, appCheckToken: Token | null, expectedResponseCount?: number): Promise<Resp[]>; + /** + * Opens a stream to the given stream RPC endpoint. Returns a stream which + * will try to open itself. + * @param rpcName - the name of the RPC to open the stream on + * @param token - the Token to use for the RPC. + */ + openStream<Req, Resp>(rpcName: string, authToken: Token | null, appCheckToken: Token | null): Stream<Req, Resp>; + /** + * Returns whether or not the implementation requires that the "path" of the resource + * (a document or a collection) be present in the request message. If true, then the + * request message must include the path. If false, then the request message must NOT + * include the path. + */ + readonly shouldResourcePathBeIncludedInRequest: boolean; + /** + * Closes and cleans up any resources associated with the connection. Actual + * resources cleaned are implementation specific. Failure to call `terminate` + * on a connection may result in resource leaks. + */ + terminate(): void; +} +/** + * A bidirectional stream that can be used to send an receive messages. + * + * A stream can be closed locally with close() or can be closed remotely or + * through network errors. onClose is guaranteed to be called. onOpen will be + * called once the stream is ready to send messages (which may or may not be + * before an actual connection to the backend has been established). The + * onConnected event is called when an actual, physical connection with the + * backend has been established, and may occur before or after the onOpen event. + */ +export interface Stream<I, O> { + onConnected(callback: () => void): void; + onOpen(callback: () => void): void; + onClose(callback: (err?: FirestoreError) => void): void; + onMessage(callback: (msg: O) => void): void; + send(msg: I): void; + close(): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/connectivity_monitor.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/connectivity_monitor.d.ts new file mode 100644 index 0000000..e02b7d2 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/connectivity_monitor.d.ts @@ -0,0 +1,47 @@ +/** + * @license + * Copyright 2019 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. + */ +/** + * The set of network states is deliberately simplified -- we only care about + * states such that transition between them should break currently + * established connections. + */ +export declare const enum NetworkStatus { + AVAILABLE = 0, + UNAVAILABLE = 1 +} +export type ConnectivityMonitorCallback = (status: NetworkStatus) => void; +/** + * A base class for monitoring changes in network connectivity; it is expected + * that each platform will have its own system-dependent implementation. + */ +export interface ConnectivityMonitor { + /** + * Adds a callback to be called when connectivity changes. + * + * Callbacks are not made on the initial state of connectivity, since this + * monitor is primarily used for resetting backoff in the remote store when + * connectivity changes. As such, the initial connectivity state is + * irrelevant here. + */ + addCallback(callback: ConnectivityMonitorCallback): void; + /** + * Stops monitoring connectivity. After this call completes, no further + * callbacks will be triggered. After shutdown() is called, no further calls + * are allowed on this instance. + */ + shutdown(): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/connectivity_monitor_noop.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/connectivity_monitor_noop.d.ts new file mode 100644 index 0000000..42bb25c --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/connectivity_monitor_noop.d.ts @@ -0,0 +1,21 @@ +/** + * @license + * Copyright 2019 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 { ConnectivityMonitor, NetworkStatus } from './connectivity_monitor'; +export declare class NoopConnectivityMonitor implements ConnectivityMonitor { + addCallback(callback: (status: NetworkStatus) => void): void; + shutdown(): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/datastore.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/datastore.d.ts new file mode 100644 index 0000000..fe095c0 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/datastore.d.ts @@ -0,0 +1,44 @@ +/** + * @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 { CredentialsProvider } from '../api/credentials'; +import { User } from '../auth/user'; +import { Aggregate } from '../core/aggregate'; +import { Query } from '../core/query'; +import { Document } from '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { Mutation } from '../model/mutation'; +import { ApiClientObjectMap, Value } from '../protos/firestore_proto_api'; +import { AsyncQueue } from '../util/async_queue'; +import { Connection } from './connection'; +import { PersistentListenStream, PersistentWriteStream, WatchStreamListener, WriteStreamListener } from './persistent_stream'; +import { JsonProtoSerializer } from './serializer'; +/** + * Datastore and its related methods are a wrapper around the external Google + * Cloud Datastore grpc API, which provides an interface that is more convenient + * for the rest of the client SDK architecture to consume. + */ +export declare abstract class Datastore { + abstract terminate(): void; + abstract serializer: JsonProtoSerializer; +} +export declare function newDatastore(authCredentials: CredentialsProvider<User>, appCheckCredentials: CredentialsProvider<string>, connection: Connection, serializer: JsonProtoSerializer): Datastore; +export declare function invokeCommitRpc(datastore: Datastore, mutations: Mutation[]): Promise<void>; +export declare function invokeBatchGetDocumentsRpc(datastore: Datastore, keys: DocumentKey[]): Promise<Document[]>; +export declare function invokeRunQueryRpc(datastore: Datastore, query: Query): Promise<Document[]>; +export declare function invokeRunAggregationQueryRpc(datastore: Datastore, query: Query, aggregates: Aggregate[]): Promise<ApiClientObjectMap<Value>>; +export declare function newPersistentWriteStream(datastore: Datastore, queue: AsyncQueue, listener: WriteStreamListener): PersistentWriteStream; +export declare function newPersistentWatchStream(datastore: Datastore, queue: AsyncQueue, listener: WatchStreamListener): PersistentListenStream; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/existence_filter.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/existence_filter.d.ts new file mode 100644 index 0000000..10ed5e5 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/existence_filter.d.ts @@ -0,0 +1,22 @@ +/** + * @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 { BloomFilter as ProtoBloomFilter } from '../protos/firestore_proto_api'; +export declare class ExistenceFilter { + count: number; + unchangedNames?: ProtoBloomFilter | undefined; + constructor(count: number, unchangedNames?: ProtoBloomFilter | undefined); +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/internal_serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/internal_serializer.d.ts new file mode 100644 index 0000000..cd1f08d --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/internal_serializer.d.ts @@ -0,0 +1,46 @@ +/** + * @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 { AggregateSpec } from '../lite-api/aggregate_types'; +import { Query } from '../lite-api/reference'; +/** + * @internal + * @private + * + * This function is for internal use only. + * + * Returns the `QueryTarget` representation of the given query. Returns `null` + * if the Firestore client associated with the given query has not been + * initialized or has been terminated. + * + * @param query - The Query to convert to proto representation. + */ +export declare function _internalQueryToProtoQueryTarget(query: Query): any; +/** + * @internal + * @private + * + * This function is for internal use only. + * + * Returns `RunAggregationQueryRequest` which contains the proto representation + * of the given aggregation query request. Returns null if the Firestore client + * associated with the given query has not been initialized or has been + * terminated. + * + * @param query - The Query to convert to proto representation. + * @param aggregateSpec - The set of aggregations and their aliases. + */ +export declare function _internalAggregationQueryToProtoRunAggregationQueryRequest<AggregateSpecType extends AggregateSpec>(query: Query, aggregateSpec: AggregateSpecType): any; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/number_serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/number_serializer.d.ts new file mode 100644 index 0000000..cec4398 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/number_serializer.d.ts @@ -0,0 +1,36 @@ +/** + * @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 { Value as ProtoValue } from '../protos/firestore_proto_api'; +/** Base interface for the Serializer implementation. */ +export interface Serializer { + readonly useProto3Json: boolean; +} +/** + * Returns an DoubleValue for `value` that is encoded based the serializer's + * `useProto3Json` setting. + */ +export declare function toDouble(serializer: Serializer, value: number): ProtoValue; +/** + * Returns an IntegerValue for `value`. + */ +export declare function toInteger(value: number): ProtoValue; +/** + * Returns a value for a number that's appropriate to put into a proto. + * The return value is an IntegerValue if it can safely represent the value, + * otherwise a DoubleValue is returned. + */ +export declare function toNumber(serializer: Serializer, value: number): ProtoValue; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/online_state_tracker.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/online_state_tracker.d.ts new file mode 100644 index 0000000..8a9bf8d --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/online_state_tracker.d.ts @@ -0,0 +1,81 @@ +/** + * @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 { OnlineState } from '../core/types'; +import { AsyncQueue } from '../util/async_queue'; +import { FirestoreError } from '../util/error'; +/** + * A component used by the RemoteStore to track the OnlineState (that is, + * whether or not the client as a whole should be considered to be online or + * offline), implementing the appropriate heuristics. + * + * In particular, when the client is trying to connect to the backend, we + * allow up to MAX_WATCH_STREAM_FAILURES within ONLINE_STATE_TIMEOUT_MS for + * a connection to succeed. If we have too many failures or the timeout elapses, + * then we set the OnlineState to Offline, and the client will behave as if + * it is offline (get()s will return cached data, etc.). + */ +export declare class OnlineStateTracker { + private asyncQueue; + private onlineStateHandler; + /** The current OnlineState. */ + private state; + /** + * A count of consecutive failures to open the stream. If it reaches the + * maximum defined by MAX_WATCH_STREAM_FAILURES, we'll set the OnlineState to + * Offline. + */ + private watchStreamFailures; + /** + * A timer that elapses after ONLINE_STATE_TIMEOUT_MS, at which point we + * transition from OnlineState.Unknown to OnlineState.Offline without waiting + * for the stream to actually fail (MAX_WATCH_STREAM_FAILURES times). + */ + private onlineStateTimer; + /** + * Whether the client should log a warning message if it fails to connect to + * the backend (initially true, cleared after a successful stream, or if we've + * logged the message already). + */ + private shouldWarnClientIsOffline; + constructor(asyncQueue: AsyncQueue, onlineStateHandler: (onlineState: OnlineState) => void); + /** + * Called by RemoteStore when a watch stream is started (including on each + * backoff attempt). + * + * If this is the first attempt, it sets the OnlineState to Unknown and starts + * the onlineStateTimer. + */ + handleWatchStreamStart(): void; + /** + * Updates our OnlineState as appropriate after the watch stream reports a + * failure. The first failure moves us to the 'Unknown' state. We then may + * allow multiple failures (based on MAX_WATCH_STREAM_FAILURES) before we + * actually transition to the 'Offline' state. + */ + handleWatchStreamFailure(error: FirestoreError): void; + /** + * Explicitly sets the OnlineState to the specified state. + * + * Note that this resets our timers / failure counters, etc. used by our + * Offline heuristics, so must not be used in place of + * handleWatchStreamStart() and handleWatchStreamFailure(). + */ + set(newState: OnlineState): void; + private setAndBroadcast; + private logClientOfflineWarningIfNecessary; + private clearOnlineStateTimer; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/persistent_stream.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/persistent_stream.d.ts new file mode 100644 index 0000000..aacaf2d --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/persistent_stream.d.ts @@ -0,0 +1,308 @@ +/** + * @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 { CredentialsProvider, Token } from '../api/credentials'; +import { User } from '../auth/user'; +import { SnapshotVersion } from '../core/snapshot_version'; +import { TargetId } from '../core/types'; +import { TargetData } from '../local/target_data'; +import { Mutation, MutationResult } from '../model/mutation'; +import { ListenRequest as ProtoListenRequest, ListenResponse as ProtoListenResponse, WriteRequest as ProtoWriteRequest, WriteResponse as ProtoWriteResponse } from '../protos/firestore_proto_api'; +import { AsyncQueue, TimerId } from '../util/async_queue'; +import { FirestoreError } from '../util/error'; +import { ExponentialBackoff } from './backoff'; +import { Connection, Stream } from './connection'; +import { JsonProtoSerializer } from './serializer'; +import { WatchChange } from './watch_change'; +export interface WriteRequest extends ProtoWriteRequest { + database?: string; +} +/** + * Provides a common interface that is shared by the listeners for stream + * events by the concrete implementation classes. + */ +export interface PersistentStreamListener { + /** + * Called after receiving an acknowledgement from the server, confirming that + * we are able to connect to it. + */ + onConnected: () => Promise<void>; + /** + * Called after the stream was established and can accept outgoing + * messages + */ + onOpen: () => Promise<void>; + /** + * Called after the stream has closed. If there was an error, the + * FirestoreError will be set. + */ + onClose: (err?: FirestoreError) => Promise<void>; +} +/** + * A PersistentStream is an abstract base class that represents a streaming RPC + * to the Firestore backend. It's built on top of the connections own support + * for streaming RPCs, and adds several critical features for our clients: + * + * - Exponential backoff on failure + * - Authentication via CredentialsProvider + * - Dispatching all callbacks into the shared worker queue + * - Closing idle streams after 60 seconds of inactivity + * + * Subclasses of PersistentStream implement serialization of models to and + * from the JSON representation of the protocol buffers for a specific + * streaming RPC. + * + * ## Starting and Stopping + * + * Streaming RPCs are stateful and need to be start()ed before messages can + * be sent and received. The PersistentStream will call the onOpen() function + * of the listener once the stream is ready to accept requests. + * + * Should a start() fail, PersistentStream will call the registered onClose() + * listener with a FirestoreError indicating what went wrong. + * + * A PersistentStream can be started and stopped repeatedly. + * + * Generic types: + * SendType: The type of the outgoing message of the underlying + * connection stream + * ReceiveType: The type of the incoming message of the underlying + * connection stream + * ListenerType: The type of the listener that will be used for callbacks + */ +export declare abstract class PersistentStream<SendType, ReceiveType, ListenerType extends PersistentStreamListener> { + private queue; + private idleTimerId; + private healthTimerId; + protected connection: Connection; + private authCredentialsProvider; + private appCheckCredentialsProvider; + protected listener: ListenerType; + private state; + /** + * A close count that's incremented every time the stream is closed; used by + * getCloseGuardedDispatcher() to invalidate callbacks that happen after + * close. + */ + private closeCount; + private idleTimer; + private healthCheck; + private stream; + protected backoff: ExponentialBackoff; + constructor(queue: AsyncQueue, connectionTimerId: TimerId, idleTimerId: TimerId, healthTimerId: TimerId, connection: Connection, authCredentialsProvider: CredentialsProvider<User>, appCheckCredentialsProvider: CredentialsProvider<string>, listener: ListenerType); + /** + * Count of response messages received. + */ + protected responseCount: number; + /** + * Returns true if start() has been called and no error has occurred. True + * indicates the stream is open or in the process of opening (which + * encompasses respecting backoff, getting auth tokens, and starting the + * actual RPC). Use isOpen() to determine if the stream is open and ready for + * outbound requests. + */ + isStarted(): boolean; + /** + * Returns true if the underlying RPC is open (the onOpen() listener has been + * called) and the stream is ready for outbound requests. + */ + isOpen(): boolean; + /** + * Starts the RPC. Only allowed if isStarted() returns false. The stream is + * not immediately ready for use: onOpen() will be invoked when the RPC is + * ready for outbound requests, at which point isOpen() will return true. + * + * When start returns, isStarted() will return true. + */ + start(): void; + /** + * Stops the RPC. This call is idempotent and allowed regardless of the + * current isStarted() state. + * + * When stop returns, isStarted() and isOpen() will both return false. + */ + stop(): Promise<void>; + /** + * After an error the stream will usually back off on the next attempt to + * start it. If the error warrants an immediate restart of the stream, the + * sender can use this to indicate that the receiver should not back off. + * + * Each error will call the onClose() listener. That function can decide to + * inhibit backoff if required. + */ + inhibitBackoff(): void; + /** + * Marks this stream as idle. If no further actions are performed on the + * stream for one minute, the stream will automatically close itself and + * notify the stream's onClose() handler with Status.OK. The stream will then + * be in a !isStarted() state, requiring the caller to start the stream again + * before further use. + * + * Only streams that are in state 'Open' can be marked idle, as all other + * states imply pending network operations. + */ + markIdle(): void; + /** Sends a message to the underlying stream. */ + protected sendRequest(msg: SendType): void; + /** Called by the idle timer when the stream should close due to inactivity. */ + private handleIdleCloseTimer; + /** Marks the stream as active again. */ + private cancelIdleCheck; + /** Cancels the health check delayed operation. */ + private cancelHealthCheck; + /** + * Closes the stream and cleans up as necessary: + * + * * closes the underlying GRPC stream; + * * calls the onClose handler with the given 'error'; + * * sets internal stream state to 'finalState'; + * * adjusts the backoff timer based on the error + * + * A new stream can be opened by calling start(). + * + * @param finalState - the intended state of the stream after closing. + * @param error - the error the connection was closed with. + */ + private close; + /** + * Can be overridden to perform additional cleanup before the stream is closed. + * Calling super.tearDown() is not required. + */ + protected tearDown(): void; + /** + * Used by subclasses to start the concrete RPC and return the underlying + * connection stream. + */ + protected abstract startRpc(authToken: Token | null, appCheckToken: Token | null): Stream<SendType, ReceiveType>; + /** + * Called when the stream receives first message. + * The function will be called on the right queue and must return a Promise. + * @param message - The message received from the stream. + */ + protected abstract onFirst(message: ReceiveType): Promise<void>; + /** + * Called on subsequent messages after the stream has received first message. + * The function will be called on the right queue and must return a Promise. + * @param message - The message received from the stream. + */ + protected abstract onNext(message: ReceiveType): Promise<void>; + private auth; + private startStream; + private performBackoff; + handleStreamClose(error?: FirestoreError): Promise<void>; + /** + * Returns a "dispatcher" function that dispatches operations onto the + * AsyncQueue but only runs them if closeCount remains unchanged. This allows + * us to turn auth / stream callbacks into no-ops if the stream is closed / + * re-opened, etc. + */ + private getCloseGuardedDispatcher; +} +/** Listener for the PersistentWatchStream */ +export interface WatchStreamListener extends PersistentStreamListener { + /** + * Called on a watchChange. The snapshot parameter will be MIN if the watch + * change did not have a snapshot associated with it. + */ + onWatchChange: (watchChange: WatchChange, snapshot: SnapshotVersion) => Promise<void>; +} +/** + * A PersistentStream that implements the Listen RPC. + * + * Once the Listen stream has called the onOpen() listener, any number of + * listen() and unlisten() calls can be made to control what changes will be + * sent from the server for ListenResponses. + */ +export declare class PersistentListenStream extends PersistentStream<ProtoListenRequest, ProtoListenResponse, WatchStreamListener> { + private serializer; + constructor(queue: AsyncQueue, connection: Connection, authCredentials: CredentialsProvider<User>, appCheckCredentials: CredentialsProvider<string>, serializer: JsonProtoSerializer, listener: WatchStreamListener); + protected startRpc(authToken: Token | null, appCheckToken: Token | null): Stream<ProtoListenRequest, ProtoListenResponse>; + protected onFirst(watchChangeProto: ProtoListenResponse): Promise<void>; + protected onNext(watchChangeProto: ProtoListenResponse): Promise<void>; + /** + * Registers interest in the results of the given target. If the target + * includes a resumeToken it will be included in the request. Results that + * affect the target will be streamed back as WatchChange messages that + * reference the targetId. + */ + watch(targetData: TargetData): void; + /** + * Unregisters interest in the results of the target associated with the + * given targetId. + */ + unwatch(targetId: TargetId): void; +} +/** Listener for the PersistentWriteStream */ +export interface WriteStreamListener extends PersistentStreamListener { + /** + * Called by the PersistentWriteStream upon a successful handshake response + * from the server, which is the receiver's cue to send any pending writes. + */ + onHandshakeComplete: () => Promise<void>; + /** + * Called by the PersistentWriteStream upon receiving a StreamingWriteResponse + * from the server that contains a mutation result. + */ + onMutationResult: (commitVersion: SnapshotVersion, results: MutationResult[]) => Promise<void>; +} +/** + * A Stream that implements the Write RPC. + * + * The Write RPC requires the caller to maintain special streamToken + * state in between calls, to help the server understand which responses the + * client has processed by the time the next request is made. Every response + * will contain a streamToken; this value must be passed to the next + * request. + * + * After calling start() on this stream, the next request must be a handshake, + * containing whatever streamToken is on hand. Once a response to this + * request is received, all pending mutations may be submitted. When + * submitting multiple batches of mutations at the same time, it's + * okay to use the same streamToken for the calls to writeMutations. + * + * TODO(b/33271235): Use proto types + */ +export declare class PersistentWriteStream extends PersistentStream<ProtoWriteRequest, ProtoWriteResponse, WriteStreamListener> { + private serializer; + constructor(queue: AsyncQueue, connection: Connection, authCredentials: CredentialsProvider<User>, appCheckCredentials: CredentialsProvider<string>, serializer: JsonProtoSerializer, listener: WriteStreamListener); + /** + * The last received stream token from the server, used to acknowledge which + * responses the client has processed. Stream tokens are opaque checkpoint + * markers whose only real value is their inclusion in the next request. + * + * PersistentWriteStream manages propagating this value from responses to the + * next request. + */ + private lastStreamToken; + /** + * Tracks whether or not a handshake has been successfully exchanged and + * the stream is ready to accept mutations. + */ + get handshakeComplete(): boolean; + start(): void; + protected tearDown(): void; + protected startRpc(authToken: Token | null, appCheckToken: Token | null): Stream<ProtoWriteRequest, ProtoWriteResponse>; + protected onFirst(responseProto: ProtoWriteResponse): Promise<void>; + protected onNext(responseProto: ProtoWriteResponse): Promise<void>; + /** + * Sends an initial streamToken to the server, performing the handshake + * required to make the StreamingWrite RPC work. Subsequent + * calls should wait until onHandshakeComplete was called. + */ + writeHandshake(): void; + /** Sends a group of mutations to the Firestore backend to apply. */ + writeMutations(mutations: Mutation[]): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/remote_event.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/remote_event.d.ts new file mode 100644 index 0000000..9bafaf3 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/remote_event.d.ts @@ -0,0 +1,156 @@ +/** + * @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 { TargetPurpose } from '../local/target_data'; +import { DocumentKeySet, MutableDocumentMap } from '../model/collections'; +import { ByteString } from '../util/byte_string'; +import { SortedMap } from '../util/sorted_map'; +/** + * An event from the RemoteStore. It is split into targetChanges (changes to the + * state or the set of documents in our watched targets) and documentUpdates + * (changes to the actual documents). + */ +export declare class RemoteEvent { + /** + * The snapshot version this event brings us up to, or MIN if not set. + */ + readonly snapshotVersion: SnapshotVersion; + /** + * A map from target to changes to the target. See TargetChange. + */ + readonly targetChanges: Map<TargetId, TargetChange>; + /** + * A map of targets that is known to be inconsistent, and the purpose for + * re-listening. Listens for these targets should be re-established without + * resume tokens. + */ + readonly targetMismatches: SortedMap<TargetId, TargetPurpose>; + /** + * A set of which documents have changed or been deleted, along with the + * doc's new values (if not deleted). + */ + readonly documentUpdates: MutableDocumentMap; + /** + * A set of which document updates are due only to limbo resolution targets. + */ + readonly resolvedLimboDocuments: DocumentKeySet; + constructor( + /** + * The snapshot version this event brings us up to, or MIN if not set. + */ + snapshotVersion: SnapshotVersion, + /** + * A map from target to changes to the target. See TargetChange. + */ + targetChanges: Map<TargetId, TargetChange>, + /** + * A map of targets that is known to be inconsistent, and the purpose for + * re-listening. Listens for these targets should be re-established without + * resume tokens. + */ + targetMismatches: SortedMap<TargetId, TargetPurpose>, + /** + * A set of which documents have changed or been deleted, along with the + * doc's new values (if not deleted). + */ + documentUpdates: MutableDocumentMap, + /** + * A set of which document updates are due only to limbo resolution targets. + */ + resolvedLimboDocuments: DocumentKeySet); + /** + * HACK: Views require RemoteEvents in order to determine whether the view is + * CURRENT, but secondary tabs don't receive remote events. So this method is + * used to create a synthesized RemoteEvent that can be used to apply a + * CURRENT status change to a View, for queries executed in a different tab. + */ + static createSynthesizedRemoteEventForCurrentChange(targetId: TargetId, current: boolean, resumeToken: ByteString): RemoteEvent; +} +/** + * A TargetChange specifies the set of changes for a specific target as part of + * a RemoteEvent. These changes track which documents are added, modified or + * removed, as well as the target's resume token and whether the target is + * marked CURRENT. + * The actual changes *to* documents are not part of the TargetChange since + * documents may be part of multiple targets. + */ +export declare class TargetChange { + /** + * An opaque, server-assigned token that allows watching a query to be resumed + * after disconnecting without retransmitting all the data that matches the + * query. The resume token essentially identifies a point in time from which + * the server should resume sending results. + */ + readonly resumeToken: ByteString; + /** + * The "current" (synced) status of this target. Note that "current" + * has special meaning in the RPC protocol that implies that a target is + * both up-to-date and consistent with the rest of the watch stream. + */ + readonly current: boolean; + /** + * The set of documents that were newly assigned to this target as part of + * this remote event. + */ + readonly addedDocuments: DocumentKeySet; + /** + * The set of documents that were already assigned to this target but received + * an update during this remote event. + */ + readonly modifiedDocuments: DocumentKeySet; + /** + * The set of documents that were removed from this target as part of this + * remote event. + */ + readonly removedDocuments: DocumentKeySet; + constructor( + /** + * An opaque, server-assigned token that allows watching a query to be resumed + * after disconnecting without retransmitting all the data that matches the + * query. The resume token essentially identifies a point in time from which + * the server should resume sending results. + */ + resumeToken: ByteString, + /** + * The "current" (synced) status of this target. Note that "current" + * has special meaning in the RPC protocol that implies that a target is + * both up-to-date and consistent with the rest of the watch stream. + */ + current: boolean, + /** + * The set of documents that were newly assigned to this target as part of + * this remote event. + */ + addedDocuments: DocumentKeySet, + /** + * The set of documents that were already assigned to this target but received + * an update during this remote event. + */ + modifiedDocuments: DocumentKeySet, + /** + * The set of documents that were removed from this target as part of this + * remote event. + */ + removedDocuments: DocumentKeySet); + /** + * This method is used to create a synthesized TargetChanges that can be used to + * apply a CURRENT status change to a View (for queries executed in a different + * tab) or for new queries (to raise snapshots with correct CURRENT status). + */ + static createSynthesizedTargetChangeForCurrentChange(targetId: TargetId, current: boolean, resumeToken: ByteString): TargetChange; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/remote_store.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/remote_store.d.ts new file mode 100644 index 0000000..c6c2416 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/remote_store.d.ts @@ -0,0 +1,85 @@ +/** + * @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 { User } from '../auth/user'; +import { OnlineState, TargetId } from '../core/types'; +import { LocalStore } from '../local/local_store'; +import { TargetData } from '../local/target_data'; +import { AsyncQueue } from '../util/async_queue'; +import { ConnectivityMonitor } from './connectivity_monitor'; +import { Datastore } from './datastore'; +import { RemoteSyncer } from './remote_syncer'; +/** + * RemoteStore - An interface to remotely stored data, basically providing a + * wrapper around the Datastore that is more reliable for the rest of the + * system. + * + * RemoteStore is responsible for maintaining the connection to the server. + * - maintaining a list of active listens. + * - reconnecting when the connection is dropped. + * - resuming all the active listens on reconnect. + * + * RemoteStore handles all incoming events from the Datastore. + * - listening to the watch stream and repackaging the events as RemoteEvents + * - notifying SyncEngine of any changes to the active listens. + * + * RemoteStore takes writes from other components and handles them reliably. + * - pulling pending mutations from LocalStore and sending them to Datastore. + * - retrying mutations that failed because of network problems. + * - acking mutations to the SyncEngine once they are accepted or rejected. + */ +export interface RemoteStore { + /** + * SyncEngine to notify of watch and write events. This must be set + * immediately after construction. + */ + remoteSyncer: RemoteSyncer; +} +export declare function newRemoteStore(localStore: LocalStore, datastore: Datastore, asyncQueue: AsyncQueue, onlineStateHandler: (onlineState: OnlineState) => void, connectivityMonitor: ConnectivityMonitor): RemoteStore; +/** Re-enables the network. Idempotent. */ +export declare function remoteStoreEnableNetwork(remoteStore: RemoteStore): Promise<void>; +/** + * Temporarily disables the network. The network can be re-enabled using + * enableNetwork(). + */ +export declare function remoteStoreDisableNetwork(remoteStore: RemoteStore): Promise<void>; +export declare function remoteStoreShutdown(remoteStore: RemoteStore): Promise<void>; +/** + * Starts new listen for the given target. Uses resume token if provided. It + * is a no-op if the target of given `TargetData` is already being listened to. + */ +export declare function remoteStoreListen(remoteStore: RemoteStore, targetData: TargetData): void; +/** + * Removes the listen from server. It is a no-op if the given target id is + * not being listened to. + */ +export declare function remoteStoreUnlisten(remoteStore: RemoteStore, targetId: TargetId): void; +export declare function canUseNetwork(remoteStore: RemoteStore): boolean; +/** + * Attempts to fill our write pipeline with writes from the LocalStore. + * + * Called internally to bootstrap or refill the write pipeline and by + * SyncEngine whenever there are new mutations to process. + * + * Starts the write stream if necessary. + */ +export declare function fillWritePipeline(remoteStore: RemoteStore): Promise<void>; +export declare function outstandingWrites(remoteStore: RemoteStore): number; +export declare function remoteStoreHandleCredentialChange(remoteStore: RemoteStore, user: User): Promise<void>; +/** + * Toggles the network state when the client gains or loses its primary lease. + */ +export declare function remoteStoreApplyPrimaryState(remoteStore: RemoteStore, isPrimary: boolean): Promise<void>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/remote_syncer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/remote_syncer.d.ts new file mode 100644 index 0000000..949bc21 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/remote_syncer.d.ts @@ -0,0 +1,68 @@ +/** + * @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 { User } from '../auth/user'; +import { BatchId, TargetId } from '../core/types'; +import { DocumentKeySet } from '../model/collections'; +import { MutationBatchResult } from '../model/mutation_batch'; +import { FirestoreError } from '../util/error'; +import { RemoteEvent } from './remote_event'; +/** + * An interface that describes the actions the RemoteStore needs to perform on + * a cooperating synchronization engine. + */ +export interface RemoteSyncer { + /** + * Applies one remote event to the sync engine, notifying any views of the + * changes, and releasing any pending mutation batches that would become + * visible because of the snapshot version the remote event contains. + */ + applyRemoteEvent?(remoteEvent: RemoteEvent): Promise<void>; + /** + * Rejects the listen for the given targetID. This can be triggered by the + * backend for any active target. + * + * @param targetId - The targetID corresponds to one previously initiated by + * the user as part of TargetData passed to listen() on RemoteStore. + * @param error - A description of the condition that has forced the rejection. + * Nearly always this will be an indication that the user is no longer + * authorized to see the data matching the target. + */ + rejectListen?(targetId: TargetId, error: FirestoreError): Promise<void>; + /** + * Applies the result of a successful write of a mutation batch to the sync + * engine, emitting snapshots in any views that the mutation applies to, and + * removing the batch from the mutation queue. + */ + applySuccessfulWrite?(result: MutationBatchResult): Promise<void>; + /** + * Rejects the batch, removing the batch from the mutation queue, recomputing + * the local view of any documents affected by the batch and then, emitting + * snapshots with the reverted value. + */ + rejectFailedWrite?(batchId: BatchId, error: FirestoreError): Promise<void>; + /** + * Returns the set of remote document keys for the given target ID. This list + * includes the documents that were assigned to the target when we received + * the last snapshot. + */ + getRemoteKeysForTarget?(targetId: TargetId): DocumentKeySet; + /** + * Updates all local state to match the pending mutations for the given user. + * May be called repeatedly for the same user. + */ + handleCredentialChange?(user: User): Promise<void>; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/rest_connection.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/rest_connection.d.ts new file mode 100644 index 0000000..1e58386 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/rest_connection.d.ts @@ -0,0 +1,53 @@ +/** + * @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 { Token } from '../api/credentials'; +import { DatabaseId, DatabaseInfo } from '../core/database_info'; +import { ResourcePath } from '../model/path'; +import { StringMap } from '../util/types'; +import { Connection, Stream } from './connection'; +/** + * Base class for all Rest-based connections to the backend (WebChannel and + * HTTP). + */ +export declare abstract class RestConnection implements Connection { + private readonly databaseInfo; + protected readonly databaseId: DatabaseId; + protected readonly baseUrl: string; + private readonly databasePath; + private readonly requestParams; + get shouldResourcePathBeIncludedInRequest(): boolean; + constructor(databaseInfo: DatabaseInfo); + invokeRPC<Req, Resp>(rpcName: string, path: ResourcePath, req: Req, authToken: Token | null, appCheckToken: Token | null): Promise<Resp>; + invokeStreamingRPC<Req, Resp>(rpcName: string, path: ResourcePath, request: Req, authToken: Token | null, appCheckToken: Token | null, expectedResponseCount?: number): Promise<Resp[]>; + abstract openStream<Req, Resp>(rpcName: string, authToken: Token | null, appCheckToken: Token | null): Stream<Req, Resp>; + /** + * Modifies the headers for a request, adding any authorization token if + * present and any additional headers for the request. + */ + protected modifyHeadersForRequest(headers: StringMap, authToken: Token | null, appCheckToken: Token | null): void; + /** + * Performs an RPC request using an implementation specific networking layer. + */ + protected abstract performRPCRequest<Req, Resp>(rpcName: string, url: string, headers: StringMap, body: Req, _forwardCredentials: boolean): Promise<Resp>; + private makeUrl; + /** + * Closes and cleans up any resources associated with the connection. This + * implementation is a no-op because there are no resources associated + * with the RestConnection that need to be cleaned up. + */ + terminate(): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/rpc_error.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/rpc_error.d.ts new file mode 100644 index 0000000..90d075c --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/rpc_error.d.ts @@ -0,0 +1,74 @@ +/** + * @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 { Code } from '../util/error'; +/** + * Determines whether an error code represents a permanent error when received + * in response to a non-write operation. + * + * See isPermanentWriteError for classifying write errors. + */ +export declare function isPermanentError(code: Code): boolean; +/** + * Determines whether an error code represents a permanent error when received + * in response to a write operation. + * + * Write operations must be handled specially because as of b/119437764, ABORTED + * errors on the write stream should be retried too (even though ABORTED errors + * are not generally retryable). + * + * Note that during the initial handshake on the write stream an ABORTED error + * signals that we should discard our stream token (i.e. it is permanent). This + * means a handshake error should be classified with isPermanentError, above. + */ +export declare function isPermanentWriteError(code: Code): boolean; +/** + * Maps an error Code from a GRPC status identifier like 'NOT_FOUND'. + * + * @returns The Code equivalent to the given status string or undefined if + * there is no match. + */ +export declare function mapCodeFromRpcStatus(status: string): Code | undefined; +/** + * Maps an error Code from GRPC status code number, like 0, 1, or 14. These + * are not the same as HTTP status codes. + * + * @returns The Code equivalent to the given GRPC status code. Fails if there + * is no match. + */ +export declare function mapCodeFromRpcCode(code: number | undefined): Code; +/** + * Maps an RPC code from a Code. This is the reverse operation from + * mapCodeFromRpcCode and should really only be used in tests. + */ +export declare function mapRpcCodeFromCode(code: Code | undefined): number; +/** + * Converts an HTTP Status Code to the equivalent error code. + * + * @param status - An HTTP Status Code, like 200, 404, 503, etc. + * @returns The equivalent Code. Unknown status codes are mapped to + * Code.UNKNOWN. + */ +export declare function mapCodeFromHttpStatus(status?: number): Code; +/** + * Converts an HTTP response's error status to the equivalent error code. + * + * @param status - An HTTP error response status ("FAILED_PRECONDITION", + * "UNKNOWN", etc.) + * @returns The equivalent Code. Non-matching responses are mapped to + * Code.UNKNOWN. + */ +export declare function mapCodeFromHttpResponseErrorStatus(status: string): Code; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/serializer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/serializer.d.ts new file mode 100644 index 0000000..bb1aeb9 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/serializer.d.ts @@ -0,0 +1,124 @@ +/** + * @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 { Aggregate } from '../core/aggregate'; +import { DatabaseId } from '../core/database_info'; +import { CompositeFilter, CompositeOperator, FieldFilter, Filter, Operator } from '../core/filter'; +import { Direction, OrderBy } from '../core/order_by'; +import { Query } from '../core/query'; +import { SnapshotVersion } from '../core/snapshot_version'; +import { Target } from '../core/target'; +import { Timestamp } from '../lite-api/timestamp'; +import { TargetData, TargetPurpose } from '../local/target_data'; +import { MutableDocument } from '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { FieldMask } from '../model/field_mask'; +import { Mutation, MutationResult } from '../model/mutation'; +import { ObjectValue } from '../model/object_value'; +import { FieldPath, ResourcePath } from '../model/path'; +import { ApiClientObjectMap as ProtoApiClientObjectMap, BatchGetDocumentsResponse as ProtoBatchGetDocumentsResponse, CompositeFilterOp as ProtoCompositeFilterOp, Document as ProtoDocument, DocumentMask as ProtoDocumentMask, DocumentsTarget as ProtoDocumentsTarget, FieldFilterOp as ProtoFieldFilterOp, FieldReference as ProtoFieldReference, Filter as ProtoFilter, ListenResponse as ProtoListenResponse, Order as ProtoOrder, OrderDirection as ProtoOrderDirection, QueryTarget as ProtoQueryTarget, RunAggregationQueryRequest as ProtoRunAggregationQueryRequest, Target as ProtoTarget, Timestamp as ProtoTimestamp, Write as ProtoWrite, WriteResult as ProtoWriteResult } from '../protos/firestore_proto_api'; +import { ByteString } from '../util/byte_string'; +import { Serializer } from './number_serializer'; +import { WatchChange } from './watch_change'; +/** + * This class generates JsonObject values for the Datastore API suitable for + * sending to either GRPC stub methods or via the JSON/HTTP REST API. + * + * The serializer supports both Protobuf.js and Proto3 JSON formats. By + * setting `useProto3Json` to true, the serializer will use the Proto3 JSON + * format. + * + * For a description of the Proto3 JSON format check + * https://developers.google.com/protocol-buffers/docs/proto3#json + * + * TODO(klimt): We can remove the databaseId argument if we keep the full + * resource name in documents. + */ +export declare class JsonProtoSerializer implements Serializer { + readonly databaseId: DatabaseId; + readonly useProto3Json: boolean; + constructor(databaseId: DatabaseId, useProto3Json: boolean); +} +/** + * Returns a value for a Date that's appropriate to put into a proto. + */ +export declare function toTimestamp(serializer: JsonProtoSerializer, timestamp: Timestamp): ProtoTimestamp; +/** + * Returns a Timestamp typed object given protobuf timestamp value. + */ +export declare function fromTimestamp(date: ProtoTimestamp): Timestamp; +/** + * Returns a value for bytes that's appropriate to put in a proto. + * + * Visible for testing. + */ +export declare function toBytes(serializer: JsonProtoSerializer, bytes: ByteString): string | Uint8Array; +/** + * Returns a ByteString based on the proto string value. + */ +export declare function fromBytes(serializer: JsonProtoSerializer, value: string | Uint8Array | undefined): ByteString; +export declare function toVersion(serializer: JsonProtoSerializer, version: SnapshotVersion): ProtoTimestamp; +export declare function fromVersion(version: ProtoTimestamp): SnapshotVersion; +export declare function toResourceName(databaseId: DatabaseId, path: ResourcePath): string; +export declare function toResourcePath(databaseId: DatabaseId, path?: ResourcePath): ResourcePath; +export declare function toName(serializer: JsonProtoSerializer, key: DocumentKey): string; +export declare function fromName(serializer: JsonProtoSerializer, name: string): DocumentKey; +export declare function getEncodedDatabaseId(serializer: JsonProtoSerializer): string; +/** Creates a Document proto from key and fields (but no create/update time) */ +export declare function toMutationDocument(serializer: JsonProtoSerializer, key: DocumentKey, fields: ObjectValue): ProtoDocument; +export declare function toDocument(serializer: JsonProtoSerializer, document: MutableDocument): ProtoDocument; +export declare function fromDocument(serializer: JsonProtoSerializer, document: ProtoDocument, hasCommittedMutations?: boolean): MutableDocument; +export declare function fromBatchGetDocumentsResponse(serializer: JsonProtoSerializer, result: ProtoBatchGetDocumentsResponse): MutableDocument; +export declare function fromWatchChange(serializer: JsonProtoSerializer, change: ProtoListenResponse): WatchChange; +export declare function versionFromListenResponse(change: ProtoListenResponse): SnapshotVersion; +export declare function toMutation(serializer: JsonProtoSerializer, mutation: Mutation): ProtoWrite; +export declare function fromMutation(serializer: JsonProtoSerializer, proto: ProtoWrite): Mutation; +export declare function fromWriteResults(protos: ProtoWriteResult[] | undefined, commitTime?: ProtoTimestamp): MutationResult[]; +export declare function toDocumentsTarget(serializer: JsonProtoSerializer, target: Target): ProtoDocumentsTarget; +export declare function fromDocumentsTarget(documentsTarget: ProtoDocumentsTarget): Target; +export declare function toQueryTarget(serializer: JsonProtoSerializer, target: Target): { + queryTarget: ProtoQueryTarget; + parent: ResourcePath; +}; +export declare function toRunAggregationQueryRequest(serializer: JsonProtoSerializer, target: Target, aggregates: Aggregate[], skipAliasing?: boolean): { + request: ProtoRunAggregationQueryRequest; + aliasMap: Record<string, string>; + parent: ResourcePath; +}; +export declare function convertQueryTargetToQuery(target: ProtoQueryTarget): Query; +export declare function fromQueryTarget(target: ProtoQueryTarget): Target; +export declare function toListenRequestLabels(serializer: JsonProtoSerializer, targetData: TargetData): ProtoApiClientObjectMap<string> | null; +export declare function toLabel(purpose: TargetPurpose): string | null; +export declare function toTarget(serializer: JsonProtoSerializer, targetData: TargetData): ProtoTarget; +export declare function toDirection(dir: Direction): ProtoOrderDirection; +export declare function fromDirection(dir: ProtoOrderDirection | undefined): Direction | undefined; +export declare function toOperatorName(op: Operator): ProtoFieldFilterOp; +export declare function toCompositeOperatorName(op: CompositeOperator): ProtoCompositeFilterOp; +export declare function fromOperatorName(op: ProtoFieldFilterOp): Operator; +export declare function fromCompositeOperatorName(op: ProtoCompositeFilterOp): CompositeOperator; +export declare function toFieldPathReference(path: FieldPath): ProtoFieldReference; +export declare function fromFieldPathReference(fieldReference: ProtoFieldReference): FieldPath; +export declare function toPropertyOrder(orderBy: OrderBy): ProtoOrder; +export declare function fromPropertyOrder(orderBy: ProtoOrder): OrderBy; +export declare function toFilter(filter: Filter): ProtoFilter; +export declare function toCompositeFilter(filter: CompositeFilter): ProtoFilter; +export declare function toUnaryOrFieldFilter(filter: FieldFilter): ProtoFilter; +export declare function fromUnaryFilter(filter: ProtoFilter): Filter; +export declare function fromFieldFilter(filter: ProtoFilter): FieldFilter; +export declare function fromCompositeFilter(filter: ProtoFilter): CompositeFilter; +export declare function toDocumentMask(fieldMask: FieldMask): ProtoDocumentMask; +export declare function fromDocumentMask(proto: ProtoDocumentMask): FieldMask; +export declare function isValidResourceName(path: ResourcePath): boolean; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/stream_bridge.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/stream_bridge.d.ts new file mode 100644 index 0000000..f17a080 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/stream_bridge.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 { FirestoreError } from '../util/error'; +import { Stream } from './connection'; +/** + * Provides a simple helper class that implements the Stream interface to + * bridge to other implementations that are streams but do not implement the + * interface. The stream callbacks are invoked with the callOn... methods. + */ +export declare class StreamBridge<I, O> implements Stream<I, O> { + private wrappedOnConnected; + private wrappedOnOpen; + private wrappedOnClose; + private wrappedOnMessage; + private sendFn; + private closeFn; + constructor(args: { + sendFn: (msg: I) => void; + closeFn: () => void; + }); + onConnected(callback: () => void): void; + onOpen(callback: () => void): void; + onClose(callback: (err?: FirestoreError) => void): void; + onMessage(callback: (msg: O) => void): void; + close(): void; + send(msg: I): void; + callOnConnected(): void; + callOnOpen(): void; + callOnClose(err?: FirestoreError): void; + callOnMessage(msg: O): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/watch_change.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/watch_change.d.ts new file mode 100644 index 0000000..1510515 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/remote/watch_change.d.ts @@ -0,0 +1,231 @@ +/** + * @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 { DatabaseId } from '../core/database_info'; +import { SnapshotVersion } from '../core/snapshot_version'; +import { TargetId } from '../core/types'; +import { TargetData } from '../local/target_data'; +import { DocumentKeySet } from '../model/collections'; +import { MutableDocument } from '../model/document'; +import { DocumentKey } from '../model/document_key'; +import { ByteString } from '../util/byte_string'; +import { FirestoreError } from '../util/error'; +import { ExistenceFilter } from './existence_filter'; +import { RemoteEvent } from './remote_event'; +/** + * Internal representation of the watcher API protocol buffers. + */ +export type WatchChange = DocumentWatchChange | WatchTargetChange | ExistenceFilterChange; +/** + * Represents a changed document and a list of target ids to which this change + * applies. + * + * If document has been deleted NoDocument will be provided. + */ +export declare class DocumentWatchChange { + /** The new document applies to all of these targets. */ + updatedTargetIds: TargetId[]; + /** The new document is removed from all of these targets. */ + removedTargetIds: TargetId[]; + /** The key of the document for this change. */ + key: DocumentKey; + /** + * The new document or NoDocument if it was deleted. Is null if the + * document went out of view without the server sending a new document. + */ + newDoc: MutableDocument | null; + constructor( + /** The new document applies to all of these targets. */ + updatedTargetIds: TargetId[], + /** The new document is removed from all of these targets. */ + removedTargetIds: TargetId[], + /** The key of the document for this change. */ + key: DocumentKey, + /** + * The new document or NoDocument if it was deleted. Is null if the + * document went out of view without the server sending a new document. + */ + newDoc: MutableDocument | null); +} +export declare class ExistenceFilterChange { + targetId: TargetId; + existenceFilter: ExistenceFilter; + constructor(targetId: TargetId, existenceFilter: ExistenceFilter); +} +export declare const enum WatchTargetChangeState { + NoChange = 0, + Added = 1, + Removed = 2, + Current = 3, + Reset = 4 +} +export declare class WatchTargetChange { + /** What kind of change occurred to the watch target. */ + state: WatchTargetChangeState; + /** The target IDs that were added/removed/set. */ + targetIds: TargetId[]; + /** + * An opaque, server-assigned token that allows watching a target to be + * resumed after disconnecting without retransmitting all the data that + * matches the target. The resume token essentially identifies a point in + * time from which the server should resume sending results. + */ + resumeToken: ByteString; + /** An RPC error indicating why the watch failed. */ + cause: FirestoreError | null; + constructor( + /** What kind of change occurred to the watch target. */ + state: WatchTargetChangeState, + /** The target IDs that were added/removed/set. */ + targetIds: TargetId[], + /** + * An opaque, server-assigned token that allows watching a target to be + * resumed after disconnecting without retransmitting all the data that + * matches the target. The resume token essentially identifies a point in + * time from which the server should resume sending results. + */ + resumeToken?: ByteString, + /** An RPC error indicating why the watch failed. */ + cause?: FirestoreError | null); +} +/** + * Interface implemented by RemoteStore to expose target metadata to the + * WatchChangeAggregator. + */ +export interface TargetMetadataProvider { + /** + * Returns the set of remote document keys for the given target ID as of the + * last raised snapshot. + */ + getRemoteKeysForTarget(targetId: TargetId): DocumentKeySet; + /** + * Returns the TargetData for an active target ID or 'null' if this target + * has become inactive + */ + getTargetDataForTarget(targetId: TargetId): TargetData | null; + /** + * Returns the database ID of the Firestore instance. + */ + getDatabaseId(): DatabaseId; +} +/** + * A helper class to accumulate watch changes into a RemoteEvent. + */ +export declare class WatchChangeAggregator { + private metadataProvider; + constructor(metadataProvider: TargetMetadataProvider); + /** The internal state of all tracked targets. */ + private targetStates; + /** Keeps track of the documents to update since the last raised snapshot. */ + private pendingDocumentUpdates; + private pendingDocumentUpdatesByTarget; + /** A mapping of document keys to their set of target IDs. */ + private pendingDocumentTargetMapping; + /** + * A map of targets with existence filter mismatches. These targets are + * known to be inconsistent and their listens needs to be re-established by + * RemoteStore. + */ + private pendingTargetResets; + /** + * Processes and adds the DocumentWatchChange to the current set of changes. + */ + handleDocumentChange(docChange: DocumentWatchChange): void; + /** Processes and adds the WatchTargetChange to the current set of changes. */ + handleTargetChange(targetChange: WatchTargetChange): void; + /** + * Iterates over all targetIds that the watch change applies to: either the + * targetIds explicitly listed in the change or the targetIds of all currently + * active targets. + */ + forEachTarget(targetChange: WatchTargetChange, fn: (targetId: TargetId) => void): void; + /** + * Handles existence filters and synthesizes deletes for filter mismatches. + * Targets that are invalidated by filter mismatches are added to + * `pendingTargetResets`. + */ + handleExistenceFilter(watchChange: ExistenceFilterChange): void; + /** + * Parse the bloom filter from the "unchanged_names" field of an existence + * filter. + */ + private parseBloomFilter; + /** + * Apply bloom filter to remove the deleted documents, and return the + * application status. + */ + private applyBloomFilter; + /** + * Filter out removed documents based on bloom filter membership result and + * return number of documents removed. + */ + private filterRemovedDocuments; + /** + * Converts the currently accumulated state into a remote event at the + * provided snapshot version. Resets the accumulated changes before returning. + */ + createRemoteEvent(snapshotVersion: SnapshotVersion): RemoteEvent; + /** + * Adds the provided document to the internal list of document updates and + * its document key to the given target's mapping. + */ + addDocumentToTarget(targetId: TargetId, document: MutableDocument): void; + /** + * Removes the provided document from the target mapping. If the + * document no longer matches the target, but the document's state is still + * known (e.g. we know that the document was deleted or we received the change + * that caused the filter mismatch), the new document can be provided + * to update the remote document cache. + */ + removeDocumentFromTarget(targetId: TargetId, key: DocumentKey, updatedDocument: MutableDocument | null): void; + removeTarget(targetId: TargetId): void; + /** + * Returns the current count of documents in the target. This includes both + * the number of documents that the LocalStore considers to be part of the + * target as well as any accumulated changes. + */ + private getCurrentDocumentCountForTarget; + /** + * Increment the number of acks needed from watch before we can consider the + * server to be 'in-sync' with the client's active targets. + */ + recordPendingTargetRequest(targetId: TargetId): void; + private ensureTargetState; + private ensureDocumentTargetMapping; + private ensureDocumentUpdateByTarget; + /** + * Verifies that the user is still interested in this target (by calling + * `getTargetDataForTarget()`) and that we are not waiting for pending ADDs + * from watch. + */ + protected isActiveTarget(targetId: TargetId): boolean; + /** + * Returns the TargetData for an active target (i.e. a target that the user + * is still interested in that has no outstanding target change requests). + */ + protected targetDataForActiveTarget(targetId: TargetId): TargetData | null; + /** + * Resets the state of a Watch target to its initial state (e.g. sets + * 'current' to false, clears the resume token and removes its target mapping + * from all documents). + */ + private resetTarget; + /** + * Returns whether the LocalStore considers the document to be part of the + * specified target. + */ + private targetContainsDocument; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/tsdoc-metadata.json b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/tsdoc-metadata.json new file mode 100644 index 0000000..6af1f6a --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/tsdoc-metadata.json @@ -0,0 +1,11 @@ +// This file is read by tools that parse documentation comments conforming to the TSDoc standard. +// It should be published with your NPM package. It should not be tracked by Git. +{ + "tsdocVersion": "0.12", + "toolPackages": [ + { + "packageName": "@microsoft/api-extractor", + "packageVersion": "0.1.2" + } + ] +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/array.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/array.d.ts new file mode 100644 index 0000000..8be6593 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/array.d.ts @@ -0,0 +1,70 @@ +/** + * @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. + */ +/** + * Returns true iff the array contains the value using strong equality. + */ +export declare function includes<T>(array: T[], value: T): boolean; +/** + * Returns true iff the array contains any value matching the predicate + */ +export declare function some<T>(array: T[], predicate: (t: T) => boolean): boolean; +/** + * Calls predicate function for each item in the array until the predicate + * returns true, at which point the index of that item is returned. If the + * predicate does not return true for any item, null is returned. + */ +export declare function findIndex<A>(array: A[], predicate: (value: A) => boolean): number | null; +/** + * Compares two array for equality using comparator. The method computes the + * intersection and invokes `onAdd` for every element that is in `after` but not + * `before`. `onRemove` is invoked for every element in `before` but missing + * from `after`. + * + * The method creates a copy of both `before` and `after` and runs in O(n log + * n), where n is the size of the two lists. + * + * @param before - The elements that exist in the original array. + * @param after - The elements to diff against the original array. + * @param comparator - The comparator for the elements in before and after. + * @param onAdd - A function to invoke for every element that is part of ` + * after` but not `before`. + * @param onRemove - A function to invoke for every element that is part of + * `before` but not `after`. + */ +export declare function diffArrays<T>(before: T[], after: T[], comparator: (l: T, r: T) => number, onAdd: (entry: T) => void, onRemove: (entry: T) => void): void; +/** + * Verifies equality for an array of objects using the `isEqual` interface. + * + * @private + * @internal + * @param left Array of objects supporting `isEqual`. + * @param right Array of objects supporting `isEqual`. + * @return True if arrays are equal. + */ +export declare function isArrayEqual<T extends { + isEqual: (t: T) => boolean; +}>(left: T[], right: T[]): boolean; +/** + * Verifies equality for an array of primitives. + * + * @private + * @internal + * @param left Array of primitives. + * @param right Array of primitives. + * @return True if arrays are equal. + */ +export declare function isPrimitiveArrayEqual<T extends number | string>(left: T[], right: T[]): boolean; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/assert.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/assert.d.ts new file mode 100644 index 0000000..294b08a --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/assert.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. + */ +/** + * Unconditionally fails, throwing an Error with the given message. + * Messages are stripped in production builds. + * + * Returns `never` and can be used in expressions: + * @example + * let futureVar = fail('not implemented yet'); + * + * @param code generate a new unique value with `yarn assertion-id:generate` + * Search for an existing value using `yarn assertion-id:find X` + */ +export declare function fail(code: number, message: string, context?: Record<string, unknown>): never; +/** + * Unconditionally fails, throwing an Error with the given message. + * Messages are stripped in production builds. + * + * Returns `never` and can be used in expressions: + * @example + * let futureVar = fail('not implemented yet'); + * + * @param id generate a new unique value with `yarn assertion-id:generate` + * Search for an existing value using `yarn assertion-id:find X` + */ +export declare function fail(id: number, context?: Record<string, unknown>): never; +/** + * Fails if the given assertion condition is false, throwing an Error with the + * given message if it did. + * + * Messages are stripped in production builds. + * + * @param id generate a new unique value with `yarn assertion-idgenerate`. + * Search for an existing value using `yarn assertion-id:find X` + */ +export declare function hardAssert(assertion: boolean, id: number, message: string, context?: Record<string, unknown>): asserts assertion; +/** + * Fails if the given assertion condition is false, throwing an Error with the + * given message if it did. + * + * Messages are stripped in production builds. + * + * @param id generate a new unique value with `yarn assertion-id:generate`. + * Search for an existing value using `yarn assertion-id:find X` + */ +export declare function hardAssert(assertion: boolean, id: number, context?: Record<string, unknown>): asserts assertion; +/** + * Fails if the given assertion condition is false, throwing an Error with the + * given message if it did. + * + * The code of callsites invoking this function are stripped out in production + * builds. Any side-effects of code within the debugAssert() invocation will not + * happen in this case. + * + * @internal + */ +export declare function debugAssert(assertion: boolean, message: string): asserts assertion; +/** + * Casts `obj` to `T`. In non-production builds, verifies that `obj` is an + * instance of `T` before casting. + */ +export declare function debugCast<T>(obj: object, constructor: { + new (...args: any[]): T; +}): T | never; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/async_observer.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/async_observer.d.ts new file mode 100644 index 0000000..21a965e --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/async_observer.d.ts @@ -0,0 +1,31 @@ +/** + * @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 { Observer } from '../core/event_manager'; +import { FirestoreError } from './error'; +export declare class AsyncObserver<T> implements Observer<T> { + private observer; + /** + * When set to true, will not raise future events. Necessary to deal with + * async detachment of listener. + */ + private muted; + constructor(observer: Partial<Observer<T>>); + next(value: T): void; + error(error: FirestoreError): void; + mute(): void; + private scheduleEvent; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/async_queue.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/async_queue.d.ts new file mode 100644 index 0000000..098746b --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/async_queue.d.ts @@ -0,0 +1,180 @@ +/** + * @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 { FirestoreError } from './error'; +/** + * Wellknown "timer" IDs used when scheduling delayed operations on the + * AsyncQueue. These IDs can then be used from tests to check for the presence + * of operations or to run them early. + * + * The string values are used when encoding these timer IDs in JSON spec tests. + */ +export declare const enum TimerId { + /** All can be used with runDelayedOperationsEarly() to run all timers. */ + All = "all", + /** + * The following 5 timers are used in persistent_stream.ts for the listen and + * write streams. The "Idle" timer is used to close the stream due to + * inactivity. The "ConnectionBackoff" timer is used to restart a stream once + * the appropriate backoff delay has elapsed. The health check is used to mark + * a stream healthy if it has not received an error during its initial setup. + */ + ListenStreamIdle = "listen_stream_idle", + ListenStreamConnectionBackoff = "listen_stream_connection_backoff", + WriteStreamIdle = "write_stream_idle", + WriteStreamConnectionBackoff = "write_stream_connection_backoff", + HealthCheckTimeout = "health_check_timeout", + /** + * A timer used in online_state_tracker.ts to transition from + * OnlineState.Unknown to Offline after a set timeout, rather than waiting + * indefinitely for success or failure. + */ + OnlineStateTimeout = "online_state_timeout", + /** + * A timer used to update the client metadata in IndexedDb, which is used + * to determine the primary leaseholder. + */ + ClientMetadataRefresh = "client_metadata_refresh", + /** A timer used to periodically attempt LRU Garbage collection */ + LruGarbageCollection = "lru_garbage_collection", + /** + * A timer used to retry transactions. Since there can be multiple concurrent + * transactions, multiple of these may be in the queue at a given time. + */ + TransactionRetry = "transaction_retry", + /** + * A timer used to retry operations scheduled via retryable AsyncQueue + * operations. + */ + AsyncQueueRetry = "async_queue_retry", + /** + * A timer used to periodically attempt index backfill. + */ + IndexBackfill = "index_backfill" +} +/** + * Represents an operation scheduled to be run in the future on an AsyncQueue. + * + * It is created via DelayedOperation.createAndSchedule(). + * + * Supports cancellation (via cancel()) and early execution (via skipDelay()). + * + * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type + * in newer versions of TypeScript defines `finally`, which is not available in + * IE. + */ +export declare class DelayedOperation<T extends unknown> implements PromiseLike<T> { + private readonly asyncQueue; + readonly timerId: TimerId; + readonly targetTimeMs: number; + private readonly op; + private readonly removalCallback; + private timerHandle; + private readonly deferred; + private constructor(); + get promise(): Promise<T>; + /** + * Creates and returns a DelayedOperation that has been scheduled to be + * executed on the provided asyncQueue after the provided delayMs. + * + * @param asyncQueue - The queue to schedule the operation on. + * @param id - A Timer ID identifying the type of operation this is. + * @param delayMs - The delay (ms) before the operation should be scheduled. + * @param op - The operation to run. + * @param removalCallback - A callback to be called synchronously once the + * operation is executed or canceled, notifying the AsyncQueue to remove it + * from its delayedOperations list. + * PORTING NOTE: This exists to prevent making removeDelayedOperation() and + * the DelayedOperation class public. + */ + static createAndSchedule<R extends unknown>(asyncQueue: AsyncQueue, timerId: TimerId, delayMs: number, op: () => Promise<R>, removalCallback: (op: DelayedOperation<R>) => void): DelayedOperation<R>; + /** + * Starts the timer. This is called immediately after construction by + * createAndSchedule(). + */ + private start; + /** + * Queues the operation to run immediately (if it hasn't already been run or + * canceled). + */ + skipDelay(): void; + /** + * Cancels the operation if it hasn't already been executed or canceled. The + * promise will be rejected. + * + * As long as the operation has not yet been run, calling cancel() provides a + * guarantee that the operation will not be run. + */ + cancel(reason?: string): void; + then: <TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>; + private handleDelayElapsed; + private clearTimeout; +} +export interface AsyncQueue { + readonly isShuttingDown: boolean; + /** + * Adds a new operation to the queue without waiting for it to complete (i.e. + * we ignore the Promise result). + */ + enqueueAndForget<T extends unknown>(op: () => Promise<T>): void; + /** + * Regardless if the queue has initialized shutdown, adds a new operation to the + * queue without waiting for it to complete (i.e. we ignore the Promise result). + */ + enqueueAndForgetEvenWhileRestricted<T extends unknown>(op: () => Promise<T>): void; + /** + * Initialize the shutdown of this queue. Once this method is called, the + * only possible way to request running an operation is through + * `enqueueEvenWhileRestricted()`. + * + * @param purgeExistingTasks Whether already enqueued tasked should be + * rejected (unless enqueued with `enqueueEvenWhileRestricted()`). Defaults + * to false. + */ + enterRestrictedMode(purgeExistingTasks?: boolean): void; + /** + * Adds a new operation to the queue. Returns a promise that will be resolved + * when the promise returned by the new operation is (with its value). + */ + enqueue<T extends unknown>(op: () => Promise<T>): Promise<T>; + /** + * Enqueue a retryable operation. + * + * A retryable operation is rescheduled with backoff if it fails with a + * IndexedDbTransactionError (the error type used by SimpleDb). All + * retryable operations are executed in order and only run if all prior + * operations were retried successfully. + */ + enqueueRetryable(op: () => Promise<void>): void; + /** + * Schedules an operation to be queued on the AsyncQueue once the specified + * `delayMs` has elapsed. The returned DelayedOperation can be used to cancel + * or fast-forward the operation prior to its running. + */ + enqueueAfterDelay<T extends unknown>(timerId: TimerId, delayMs: number, op: () => Promise<T>): DelayedOperation<T>; + /** + * Verifies there's an operation currently in-progress on the AsyncQueue. + * Unfortunately we can't verify that the running code is in the promise chain + * of that operation, so this isn't a foolproof check, but it should be enough + * to catch some bugs. + */ + verifyOperationInProgress(): void; +} +/** + * Returns a FirestoreError that can be surfaced to the user if the provided + * error is an IndexedDbTransactionError. Re-throws the error otherwise. + */ +export declare function wrapInUserErrorIfRecoverable(e: Error, msg: string): FirestoreError; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/async_queue_impl.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/async_queue_impl.d.ts new file mode 100644 index 0000000..6dedc85 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/async_queue_impl.d.ts @@ -0,0 +1,75 @@ +/** + * @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 { AsyncQueue, DelayedOperation, TimerId } from './async_queue'; +import { FirestoreError } from './error'; +export declare class AsyncQueueImpl implements AsyncQueue { + private tail; + private retryableOps; + private _isShuttingDown; + private delayedOperations; + failure: FirestoreError | null; + private operationInProgress; + private skipNonRestrictedTasks; + private timerIdsToSkip; + private backoff; + private visibilityHandler; + constructor(tail?: Promise<unknown>); + get isShuttingDown(): boolean; + /** + * Adds a new operation to the queue without waiting for it to complete (i.e. + * we ignore the Promise result). + */ + enqueueAndForget<T extends unknown>(op: () => Promise<T>): void; + enqueueAndForgetEvenWhileRestricted<T extends unknown>(op: () => Promise<T>): void; + enterRestrictedMode(purgeExistingTasks?: boolean): void; + enqueue<T extends unknown>(op: () => Promise<T>): Promise<T>; + enqueueRetryable(op: () => Promise<void>): void; + /** + * Runs the next operation from the retryable queue. If the operation fails, + * reschedules with backoff. + */ + private retryNextOp; + private enqueueInternal; + enqueueAfterDelay<T extends unknown>(timerId: TimerId, delayMs: number, op: () => Promise<T>): DelayedOperation<T>; + private verifyNotFailed; + verifyOperationInProgress(): void; + /** + * Waits until all currently queued tasks are finished executing. Delayed + * operations are not run. + */ + drain(): Promise<void>; + /** + * For Tests: Determine if a delayed operation with a particular TimerId + * exists. + */ + containsDelayedOperation(timerId: TimerId): boolean; + /** + * For Tests: Runs some or all delayed operations early. + * + * @param lastTimerId - Delayed operations up to and including this TimerId + * will be drained. Pass TimerId.All to run all delayed operations. + * @returns a Promise that resolves once all operations have been run. + */ + runAllDelayedOperationsUntil(lastTimerId: TimerId): Promise<void>; + /** + * For Tests: Skip all subsequent delays for a timer id. + */ + skipDelaysForTimerId(timerId: TimerId): void; + /** Called once a DelayedOperation is run or canceled. */ + private removeDelayedOperation; +} +export declare function newAsyncQueue(): AsyncQueue; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/base64_decode_error.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/base64_decode_error.d.ts new file mode 100644 index 0000000..18800ff --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/base64_decode_error.d.ts @@ -0,0 +1,22 @@ +/** + * @license + * Copyright 2023 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. + */ +/** + * An error encountered while decoding base64 string. + */ +export declare class Base64DecodeError extends Error { + readonly name = "Base64DecodeError"; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/bundle_builder_impl.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/bundle_builder_impl.d.ts new file mode 100644 index 0000000..57e978c --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/bundle_builder_impl.d.ts @@ -0,0 +1,97 @@ +/** + * @license + * Copyright 2025 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 { Firestore } from '../api/database'; +import { Query } from '../core/query'; +import { DocumentData } from '../lite-api/reference'; +import { Timestamp } from '../lite-api/timestamp'; +import { DocumentKey } from '../model/document_key'; +/** + * Builds a Firestore data bundle with results from the given document and query snapshots. + */ +export declare class BundleBuilder { + private firestore; + readonly bundleId: string; + private documents; + private namedQueries; + private latestReadTime; + private databaseId; + private readonly serializer; + private readonly userDataReader; + constructor(firestore: Firestore, bundleId: string); + /** + * Adds data from a DocumentSnapshot to the bundle. + * @internal + * @param docBundleData A DocumentSnapshotBundleData containing information from the + * DocumentSnapshot. Note we cannot accept a DocumentSnapshot directly due to a circular + * dependency error. + * @param queryName The name of the QuerySnapshot if this document is part of a Query. + */ + addBundleDocument(docBundleData: DocumentSnapshotBundleData, queryName?: string): void; + /** + * Adds data from a QuerySnapshot to the bundle. + * @internal + * @param docBundleData A QuerySnapshotBundleData containing information from the + * QuerySnapshot. Note we cannot accept a QuerySnapshot directly due to a circular + * dependency error. + */ + addBundleQuery(queryBundleData: QuerySnapshotBundleData): void; + /** + * Convert data from a DocumentSnapshot into the serialized form within a bundle. + * @private + * @internal + * @param docBundleData a DocumentSnapshotBundleData containing the data required to + * serialize a document. + */ + private toBundleDocument; + /** + * Converts a IBundleElement to a Buffer whose content is the length prefixed JSON representation + * of the element. + * @private + * @internal + * @param bundleElement A ProtoBundleElement that is expected to be Proto3 JSON compatible. + */ + private lengthPrefixedString; + /** + * Construct a serialized string containing document and query information that has previously + * been added to the BundleBuilder through the addBundleDocument and addBundleQuery methods. + * @internal + */ + build(): string; +} +/** + * Interface for an object that contains data required to bundle a DocumentSnapshot. + * @internal + */ +export interface DocumentSnapshotBundleData { + documentData: DocumentData; + documentKey: DocumentKey; + documentPath: string; + documentExists: boolean; + createdTime: Timestamp; + readTime?: Timestamp; + versionTime: Timestamp; +} +/** + * Interface for an object that contains data required to bundle a QuerySnapshot. + * @internal + */ +export interface QuerySnapshotBundleData { + name: string; + query: Query; + parent: string; + docBundleDataArray: DocumentSnapshotBundleData[]; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/bundle_reader.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/bundle_reader.d.ts new file mode 100644 index 0000000..cfe6dbd --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/bundle_reader.d.ts @@ -0,0 +1,67 @@ +/** + * @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 { BundleElement, BundleMetadata } from '../protos/firestore_bundle_proto'; +import { JsonProtoSerializer } from '../remote/serializer'; +/** + * A complete element in the bundle stream, together with the byte length it + * occupies in the stream. + */ +export declare class SizedBundleElement { + readonly payload: BundleElement; + readonly byteLength: number; + constructor(payload: BundleElement, byteLength: number); + isBundleMetadata(): boolean; +} +export type BundleSource = ReadableStream<Uint8Array> | ArrayBuffer | Uint8Array; +/** + * A class representing a bundle. + * + * Takes a bundle stream or buffer, and presents abstractions to read bundled + * elements out of the underlying content. + */ +export interface BundleReader { + serializer: JsonProtoSerializer; + close(): Promise<void>; + /** + * Returns the metadata of the bundle. + */ + getMetadata(): Promise<BundleMetadata>; + /** + * Returns the next BundleElement (together with its byte size in the bundle) + * that has not been read from underlying ReadableStream. Returns null if we + * have reached the end of the stream. + */ + nextElement(): Promise<SizedBundleElement | null>; +} +/** + * A class representing a synchronized bundle reader. + * + * Takes a bundle string buffer, parses the data, and provides accessors to the data contained + * within it. + */ +export interface BundleReaderSync { + serializer: JsonProtoSerializer; + /** + * Returns the metadata of the bundle. + */ + getMetadata(): BundleMetadata; + /** + * Returns BundleElements parsed from the bundle. Returns an empty array if no bundle elements + * exist. + */ + getElements(): SizedBundleElement[]; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/bundle_reader_impl.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/bundle_reader_impl.d.ts new file mode 100644 index 0000000..0858a93 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/bundle_reader_impl.d.ts @@ -0,0 +1,19 @@ +/** + * @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 { JsonProtoSerializer } from '../remote/serializer'; +import { BundleReader } from './bundle_reader'; +export declare function newBundleReader(reader: ReadableStreamDefaultReader<Uint8Array>, serializer: JsonProtoSerializer): BundleReader; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/bundle_reader_sync_impl.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/bundle_reader_sync_impl.d.ts new file mode 100644 index 0000000..638497f --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/bundle_reader_sync_impl.d.ts @@ -0,0 +1,59 @@ +/** + * @license + * Copyright 2025 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 { BundleMetadata } from '../protos/firestore_bundle_proto'; +import { JsonProtoSerializer } from '../remote/serializer'; +import { BundleReaderSync, SizedBundleElement } from './bundle_reader'; +/** + * A class that can parse a bundle form the string serialization of a bundle. + */ +export declare class BundleReaderSyncImpl implements BundleReaderSync { + private bundleData; + readonly serializer: JsonProtoSerializer; + private metadata; + private elements; + private cursor; + constructor(bundleData: string, serializer: JsonProtoSerializer); + getMetadata(): BundleMetadata; + getElements(): SizedBundleElement[]; + /** + * Parses the next element of the bundle. + * + * @returns a SizedBundleElement representation of the next element in the bundle, or null if + * no more elements exist. + */ + private nextElement; + /** + * Reads from a specified position from the bundleData string, for a specified + * number of bytes. + * + * @param length how many characters to read. + * @returns a string parsed from the bundle. + */ + private readJsonString; + /** + * Reads from the current cursor until the first '{'. + * + * @returns A string to integer represention of the parsed value. + * @throws An {@link Error} if the cursor has reached the end of the stream, since lengths + * prefix bundle objects. + */ + private readLength; +} +/** + * Creates an instance of BundleReader without exposing the BundleReaderSyncImpl class type. + */ +export declare function newBundleReaderSync(bundleData: string, serializer: JsonProtoSerializer): BundleReaderSync; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/byte_stream.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/byte_stream.d.ts new file mode 100644 index 0000000..72d8ed7 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/byte_stream.d.ts @@ -0,0 +1,29 @@ +/** + * @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. + */ +/** + * How many bytes to read each time when `ReadableStreamReader.read()` is + * called. Only applicable for byte streams that we control (e.g. those backed + * by an UInt8Array). + */ +export declare const DEFAULT_BYTES_PER_READ = 10240; +/** + * Builds a `ByteStreamReader` from a UInt8Array. + * @param source - The data source to use. + * @param bytesPerRead - How many bytes each `read()` from the returned reader + * will read. + */ +export declare function toByteStreamReaderHelper(source: Uint8Array, bytesPerRead?: number): ReadableStreamDefaultReader<Uint8Array>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/byte_string.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/byte_string.d.ts new file mode 100644 index 0000000..9aec389 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/byte_string.d.ts @@ -0,0 +1,46 @@ +/** + * @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. + */ +/** + * Immutable class that represents a "proto" byte string. + * + * Proto byte strings can either be Base64-encoded strings or Uint8Arrays when + * sent on the wire. This class abstracts away this differentiation by holding + * the proto byte string in a common class that must be converted into a string + * before being sent as a proto. + * @internal + */ +export declare class ByteString { + private readonly binaryString; + static readonly EMPTY_BYTE_STRING: ByteString; + private constructor(); + static fromBase64String(base64: string): ByteString; + static fromUint8Array(array: Uint8Array): ByteString; + [Symbol.iterator](): Iterator<number>; + toBase64(): string; + toUint8Array(): Uint8Array; + approximateByteSize(): number; + compareTo(other: ByteString): number; + isEqual(other: ByteString): boolean; +} +/** + * Helper function to convert an Uint8array to a binary string. + */ +export declare function binaryStringFromUint8Array(array: Uint8Array): string; +/** + * Helper function to convert a binary string to an Uint8Array. + */ +export declare function uint8ArrayFromBinaryString(binaryString: string): Uint8Array; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/debug_uid.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/debug_uid.d.ts new file mode 100644 index 0000000..b590233 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/debug_uid.d.ts @@ -0,0 +1,28 @@ +/** + * @license + * Copyright 2023 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. + */ +/** + * Generates and returns a unique ID as a hexadecimal string. + * + * The returned ID is intended to be used in debug logging messages to help + * correlate log messages that may be spatially separated in the logs, but + * logically related. For example, a network connection could include the same + * "debug ID" string in all of its log messages to help trace a specific + * connection over time. + * + * @return the 10-character generated ID (e.g. "0xa1b2c3d4"). + */ +export declare function generateUniqueDebugId(): string; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/error.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/error.d.ts new file mode 100644 index 0000000..e49c172 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/error.d.ts @@ -0,0 +1,195 @@ +/** + * @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 { FirebaseError } from '@firebase/util'; +/** + * The set of Firestore status codes. The codes are the same at the ones + * exposed by gRPC here: + * https://github.com/grpc/grpc/blob/master/doc/statuscodes.md + * + * Possible values: + * - 'cancelled': The operation was cancelled (typically by the caller). + * - 'unknown': Unknown error or an error from a different error domain. + * - 'invalid-argument': Client specified an invalid argument. Note that this + * differs from 'failed-precondition'. 'invalid-argument' indicates + * arguments that are problematic regardless of the state of the system + * (e.g. an invalid field name). + * - 'deadline-exceeded': Deadline expired before operation could complete. + * For operations that change the state of the system, this error may be + * returned even if the operation has completed successfully. For example, + * a successful response from a server could have been delayed long enough + * for the deadline to expire. + * - 'not-found': Some requested document was not found. + * - 'already-exists': Some document that we attempted to create already + * exists. + * - 'permission-denied': The caller does not have permission to execute the + * specified operation. + * - 'resource-exhausted': Some resource has been exhausted, perhaps a + * per-user quota, or perhaps the entire file system is out of space. + * - 'failed-precondition': Operation was rejected because the system is not + * in a state required for the operation's execution. + * - 'aborted': The operation was aborted, typically due to a concurrency + * issue like transaction aborts, etc. + * - 'out-of-range': Operation was attempted past the valid range. + * - 'unimplemented': Operation is not implemented or not supported/enabled. + * - 'internal': Internal errors. Means some invariants expected by + * underlying system has been broken. If you see one of these errors, + * something is very broken. + * - 'unavailable': The service is currently unavailable. This is most likely + * a transient condition and may be corrected by retrying with a backoff. + * - 'data-loss': Unrecoverable data loss or corruption. + * - 'unauthenticated': The request does not have valid authentication + * credentials for the operation. + */ +export type FirestoreErrorCode = 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated'; +/** + * Error Codes describing the different ways Firestore can fail. These come + * directly from GRPC. + */ +export type Code = FirestoreErrorCode; +export declare const Code: { + /** Not an error; returned on success. */ + OK: FirestoreErrorCode; + /** The operation was cancelled (typically by the caller). */ + CANCELLED: FirestoreErrorCode; + /** Unknown error or an error from a different error domain. */ + UNKNOWN: FirestoreErrorCode; + /** + * Client specified an invalid argument. Note that this differs from + * FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are + * problematic regardless of the state of the system (e.g., a malformed file + * name). + */ + INVALID_ARGUMENT: FirestoreErrorCode; + /** + * Deadline expired before operation could complete. For operations that + * change the state of the system, this error may be returned even if the + * operation has completed successfully. For example, a successful response + * from a server could have been delayed long enough for the deadline to + * expire. + */ + DEADLINE_EXCEEDED: FirestoreErrorCode; + /** Some requested entity (e.g., file or directory) was not found. */ + NOT_FOUND: FirestoreErrorCode; + /** + * Some entity that we attempted to create (e.g., file or directory) already + * exists. + */ + ALREADY_EXISTS: FirestoreErrorCode; + /** + * The caller does not have permission to execute the specified operation. + * PERMISSION_DENIED must not be used for rejections caused by exhausting + * some resource (use RESOURCE_EXHAUSTED instead for those errors). + * PERMISSION_DENIED must not be used if the caller cannot be identified + * (use UNAUTHENTICATED instead for those errors). + */ + PERMISSION_DENIED: FirestoreErrorCode; + /** + * The request does not have valid authentication credentials for the + * operation. + */ + UNAUTHENTICATED: FirestoreErrorCode; + /** + * Some resource has been exhausted, perhaps a per-user quota, or perhaps the + * entire file system is out of space. + */ + RESOURCE_EXHAUSTED: FirestoreErrorCode; + /** + * Operation was rejected because the system is not in a state required for + * the operation's execution. For example, directory to be deleted may be + * non-empty, an rmdir operation is applied to a non-directory, etc. + * + * A litmus test that may help a service implementor in deciding + * between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: + * (a) Use UNAVAILABLE if the client can retry just the failing call. + * (b) Use ABORTED if the client should retry at a higher-level + * (e.g., restarting a read-modify-write sequence). + * (c) Use FAILED_PRECONDITION if the client should not retry until + * the system state has been explicitly fixed. E.g., if an "rmdir" + * fails because the directory is non-empty, FAILED_PRECONDITION + * should be returned since the client should not retry unless + * they have first fixed up the directory by deleting files from it. + * (d) Use FAILED_PRECONDITION if the client performs conditional + * REST Get/Update/Delete on a resource and the resource on the + * server does not match the condition. E.g., conflicting + * read-modify-write on the same resource. + */ + FAILED_PRECONDITION: FirestoreErrorCode; + /** + * The operation was aborted, typically due to a concurrency issue like + * sequencer check failures, transaction aborts, etc. + * + * See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, + * and UNAVAILABLE. + */ + ABORTED: FirestoreErrorCode; + /** + * Operation was attempted past the valid range. E.g., seeking or reading + * past end of file. + * + * Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed + * if the system state changes. For example, a 32-bit file system will + * generate INVALID_ARGUMENT if asked to read at an offset that is not in the + * range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from + * an offset past the current file size. + * + * There is a fair bit of overlap between FAILED_PRECONDITION and + * OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error) + * when it applies so that callers who are iterating through a space can + * easily look for an OUT_OF_RANGE error to detect when they are done. + */ + OUT_OF_RANGE: FirestoreErrorCode; + /** Operation is not implemented or not supported/enabled in this service. */ + UNIMPLEMENTED: FirestoreErrorCode; + /** + * Internal errors. Means some invariants expected by underlying System has + * been broken. If you see one of these errors, Something is very broken. + */ + INTERNAL: FirestoreErrorCode; + /** + * The service is currently unavailable. This is a most likely a transient + * condition and may be corrected by retrying with a backoff. + * + * See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, + * and UNAVAILABLE. + */ + UNAVAILABLE: FirestoreErrorCode; + /** Unrecoverable data loss or corruption. */ + DATA_LOSS: FirestoreErrorCode; +}; +/** An error returned by a Firestore operation. */ +export declare class FirestoreError extends FirebaseError { + /** + * The backend error code associated with this error. + */ + readonly code: FirestoreErrorCode; + /** + * A custom error description. + */ + readonly message: string; + /** The stack of the error. */ + readonly stack?: string; + /** @hideconstructor */ + constructor( + /** + * The backend error code associated with this error. + */ + code: FirestoreErrorCode, + /** + * A custom error description. + */ + message: string); +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/input_validation.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/input_validation.d.ts new file mode 100644 index 0000000..c62ae20 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/input_validation.d.ts @@ -0,0 +1,56 @@ +/** + * @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 '../model/path'; +/** Types accepted by validateType() and related methods for validation. */ +export type ValidationType = 'undefined' | 'object' | 'function' | 'boolean' | 'number' | 'string' | 'non-empty string'; +export declare function validateNonEmptyArgument(functionName: string, argumentName: string, argument?: string): asserts argument is string; +/** + * Validates that two boolean options are not set at the same time. + * @internal + */ +export declare function validateIsNotUsedTogether(optionName1: string, argument1: boolean | undefined, optionName2: string, argument2: boolean | undefined): void; +/** + * Validates that `path` refers to a document (indicated by the fact it contains + * an even numbers of segments). + */ +export declare function validateDocumentPath(path: ResourcePath): void; +/** + * Validates that `path` refers to a collection (indicated by the fact it + * contains an odd numbers of segments). + */ +export declare function validateCollectionPath(path: ResourcePath): void; +/** + * Returns true if it's a non-null object without a custom prototype + * (i.e. excludes Array, Date, etc.). + */ +export declare function isPlainObject(input: unknown): boolean; +/** Returns a string describing the type / value of the provided input. */ +export declare function valueDescription(input: unknown): string; +/** try to get the constructor name for an object. */ +export declare function tryGetCustomObjectType(input: object): string | null; +/** + * Casts `obj` to `T`, optionally unwrapping Compat types to expose the + * underlying instance. Throws if `obj` is not an instance of `T`. + * + * This cast is used in the Lite and Full SDK to verify instance types for + * arguments passed to the public API. + * @internal + */ +export declare function cast<T>(obj: object, constructor: { + new (...args: any[]): T; +}): T | never; +export declare function validatePositiveNumber(functionName: string, n: number): void; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/json_validation.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/json_validation.d.ts new file mode 100644 index 0000000..df52006 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/json_validation.d.ts @@ -0,0 +1,70 @@ +/** + * @license + * Copyright 2025 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. + */ +/** + * A list of data types Firestore objects may serialize in their toJSON implemenetations. + * @private + * @internal + */ +export type JsonTypeDesc = 'object' | 'string' | 'number' | 'boolean' | 'null' | 'undefined'; +/** + * An association of JsonTypeDesc values to their native types. + * @private + * @internal + */ +export type TSType<T extends JsonTypeDesc> = T extends 'object' ? object : T extends 'string' ? string : T extends 'number' ? number : T extends 'boolean' ? boolean : T extends 'null' ? null : T extends 'undefined' ? undefined : never; +/** + * The representation of a JSON object property name and its type value. + * @private + * @internal + */ +export interface Property<T extends JsonTypeDesc> { + value?: TSType<T>; + typeString: JsonTypeDesc; +} +/** + * A type Firestore data types may use to define the fields used in their JSON serialization. + * @private + * @internal + */ +export interface JsonSchema { + [key: string]: Property<JsonTypeDesc>; +} +/** + * Associates the JSON property type to the native type and sets them to be Required. + * @private + * @internal + */ +export type Json<T extends JsonSchema> = { + [K in keyof T]: Required<T[K]>['value']; +}; +/** + * Helper function to define a JSON schema {@link Property}. + * @private + * @internal + */ +export declare function property<T extends JsonTypeDesc>(typeString: T, optionalValue?: TSType<T>): Property<T>; +/** + * Validates the JSON object based on the provided schema, and narrows the type to the provided + * JSON schema. + * @private + * @internal + * + * @param json A JSON object to validate. + * @param scheme a {@link JsonSchema} that defines the properties to validate. + * @returns true if the JSON schema exists within the object. Throws a FirestoreError otherwise. + */ +export declare function validateJSON<S extends JsonSchema>(json: object, schema: S): json is Json<S>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/log.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/log.d.ts new file mode 100644 index 0000000..f638baa --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/log.d.ts @@ -0,0 +1,39 @@ +/** + * @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 { LogLevel, LogLevelString } from '@firebase/logger'; +export { LogLevel, LogLevelString }; +export declare function getLogLevel(): LogLevel; +/** + * Sets the verbosity of Cloud Firestore logs (debug, error, or silent). + * + * @param logLevel - The verbosity you set for activity and error logging. Can + * be any of the following values: + * + * <ul> + * <li>`debug` for the most verbose logging level, primarily for + * debugging.</li> + * <li>`error` to log errors only.</li> + * <li><code>`silent` to turn off logging.</li> + * </ul> + */ +export declare function setLogLevel(logLevel: LogLevelString): void; +export declare function logDebug(msg: string, ...obj: unknown[]): void; +export declare function logError(msg: string, ...obj: unknown[]): void; +/** + * @internal + */ +export declare function logWarn(msg: string, ...obj: unknown[]): void; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/logic_utils.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/logic_utils.d.ts new file mode 100644 index 0000000..2333586 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/logic_utils.d.ts @@ -0,0 +1,52 @@ +/** + * @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 { CompositeFilter, Filter } from '../core/filter'; +/** + * Provides utility functions that help with boolean logic transformations needed for handling + * complex filters used in queries. + */ +/** + * The `in` filter is only a syntactic sugar over a disjunction of equalities. For instance: `a in + * [1,2,3]` is in fact `a==1 || a==2 || a==3`. This method expands any `in` filter in the given + * input into a disjunction of equality filters and returns the expanded filter. + */ +export declare function computeInExpansion(filter: Filter): Filter; +/** + * Given a composite filter, returns the list of terms in its disjunctive normal form. + * + * <p>Each element in the return value is one term of the resulting DNF. For instance: For the + * input: (A || B) && C, the DNF form is: (A && C) || (B && C), and the return value is a list + * with two elements: a composite filter that performs (A && C), and a composite filter that + * performs (B && C). + * + * @param filter the composite filter to calculate DNF transform for. + * @return the terms in the DNF transform. + */ +export declare function getDnfTerms(filter: CompositeFilter): Filter[]; +export declare function computeDistributedNormalForm(filter: Filter): Filter; +export declare function applyDistribution(lhs: Filter, rhs: Filter): Filter; +/** + * Applies the associativity property to the given filter and returns the resulting filter. + * + * <ul> + * <li>A | (B | C) == (A | B) | C == (A | B | C) + * <li>A & (B & C) == (A & B) & C == (A & B & C) + * </ul> + * + * <p>For more info, visit: https://en.wikipedia.org/wiki/Associative_property#Propositional_logic + */ +export declare function applyAssociation(filter: Filter): Filter; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/misc.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/misc.d.ts new file mode 100644 index 0000000..95d4d43 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/misc.d.ts @@ -0,0 +1,46 @@ +/** + * @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 type EventHandler<E> = (value: E) => void; +export interface Indexable { + [k: string]: unknown; +} +/** + * A utility class for generating unique alphanumeric IDs of a specified length. + * + * @internal + * Exported internally for testing purposes. + */ +export declare class AutoId { + static newId(): string; +} +export declare function primitiveComparator<T>(left: T, right: T): number; +export interface Equatable<T> { + isEqual(other: T): boolean; +} +/** Compare strings in UTF-8 encoded byte order */ +export declare function compareUtf8Strings(left: string, right: string): number; +export declare function isSurrogate(s: string): boolean; +export interface Iterable<V> { + forEach: (cb: (v: V) => void) => void; +} +/** Helper to compare arrays using isEqual(). */ +export declare function arrayEquals<T>(left: T[], right: T[], comparator: (l: T, r: T) => boolean): boolean; +/** + * Returns the immediate lexicographically-following string. This is useful to + * construct an inclusive range for indexeddb iterators. + */ +export declare function immediateSuccessor(s: string): string; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/node_api.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/node_api.d.ts new file mode 100644 index 0000000..2285e8e --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/node_api.d.ts @@ -0,0 +1,58 @@ +/** + * @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. + */ +/** + * Creates a node-style callback that resolves or rejects a new Promise. The + * callback is passed to the given action which can then use the callback as + * a parameter to a node-style function. + * + * The intent is to directly bridge a node-style function (which takes a + * callback) into a Promise without manually converting between the node-style + * callback and the promise at each call. + * + * In effect it allows you to convert: + * + * @example + * new Promise((resolve: (value?: fs.Stats) => void, + * reject: (error?: any) => void) => { + * fs.stat(path, (error?: any, stat?: fs.Stats) => { + * if (error) { + * reject(error); + * } else { + * resolve(stat); + * } + * }); + * }); + * + * Into + * @example + * nodePromise((callback: NodeCallback<fs.Stats>) => { + * fs.stat(path, callback); + * }); + * + * @param action - a function that takes a node-style callback as an argument + * and then uses that callback to invoke some node-style API. + * @returns a new Promise which will be rejected if the callback is given the + * first Error parameter or will resolve to the value given otherwise. + */ +export declare function nodePromise<R>(action: (callback: NodeCallback<R>) => void): Promise<R>; +/** + * A node-style callback which passes an Error as the first argument if there + * was an error, or passes null and a proper value + */ +export interface NodeCallback<R> { + (error?: unknown, value?: R): void; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/obj.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/obj.d.ts new file mode 100644 index 0000000..90bf468 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/obj.d.ts @@ -0,0 +1,23 @@ +/** + * @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 interface Dict<V> { + [stringKey: string]: V; +} +export declare function objectSize(obj: object): number; +export declare function forEach<V>(obj: Dict<V> | undefined, fn: (key: string, val: V) => void): void; +export declare function mapToArray<V, R>(obj: Dict<V>, fn: (element: V, key: string, obj: Dict<V>) => R): R[]; +export declare function isEmpty<V>(obj: Dict<V>): boolean; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/obj_map.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/obj_map.d.ts new file mode 100644 index 0000000..f858bcf --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/obj_map.d.ts @@ -0,0 +1,48 @@ +/** + * @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. + */ +/** + * A map implementation that uses objects as keys. Objects must have an + * associated equals function and must be immutable. Entries in the map are + * stored together with the key being produced from the mapKeyFn. This map + * automatically handles collisions of keys. + */ +export declare class ObjectMap<KeyType, ValueType> { + private mapKeyFn; + private equalsFn; + /** + * The inner map for a key/value pair. Due to the possibility of collisions we + * keep a list of entries that we do a linear search through to find an actual + * match. Note that collisions should be rare, so we still expect near + * constant time lookups in practice. + */ + private inner; + /** The number of entries stored in the map */ + private innerSize; + constructor(mapKeyFn: (key: KeyType) => string, equalsFn: (l: KeyType, r: KeyType) => boolean); + /** Get a value for this key, or undefined if it does not exist. */ + get(key: KeyType): ValueType | undefined; + has(key: KeyType): boolean; + /** Put this key and value in the map. */ + set(key: KeyType, value: ValueType): void; + /** + * Remove this key from the map. Returns a boolean if anything was deleted. + */ + delete(key: KeyType): boolean; + forEach(fn: (key: KeyType, val: ValueType) => void): void; + isEmpty(): boolean; + size(): number; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/promise.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/promise.d.ts new file mode 100644 index 0000000..f966068 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/promise.d.ts @@ -0,0 +1,34 @@ +/** + * @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 interface Resolver<R> { + (value: R | Promise<R>): void; +} +export interface Rejecter { + (reason?: Error): void; +} +export declare class Deferred<R = void> { + promise: Promise<R>; + resolve: Resolver<R>; + reject: Rejecter; + constructor(); +} +/** + * Takes an array of values and a function from a value to a Promise. The function is run on each + * value sequentially, waiting for the previous promise to resolve before starting the next one. + * The returned promise resolves once the function has been run on all values. + */ +export declare function sequence<T>(values: T[], fn: (value: T) => Promise<void>): Promise<void>; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/sorted_map.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/sorted_map.d.ts new file mode 100644 index 0000000..5060fa5 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/sorted_map.d.ts @@ -0,0 +1,100 @@ +/** + * @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 type Comparator<K> = (key1: K, key2: K) => number; +export interface Entry<K, V> { + key: K; + value: V; +} +export declare class SortedMap<K, V> { + comparator: Comparator<K>; + root: LLRBNode<K, V> | LLRBEmptyNode<K, V>; + constructor(comparator: Comparator<K>, root?: LLRBNode<K, V> | LLRBEmptyNode<K, V>); + insert(key: K, value: V): SortedMap<K, V>; + remove(key: K): SortedMap<K, V>; + get(key: K): V | null; + indexOf(key: K): number; + isEmpty(): boolean; + get size(): number; + minKey(): K | null; + maxKey(): K | null; + inorderTraversal<T>(action: (k: K, v: V) => T): T; + forEach(fn: (k: K, v: V) => void): void; + toString(): string; + reverseTraversal<T>(action: (k: K, v: V) => T): T; + getIterator(): SortedMapIterator<K, V>; + getIteratorFrom(key: K): SortedMapIterator<K, V>; + getReverseIterator(): SortedMapIterator<K, V>; + getReverseIteratorFrom(key: K): SortedMapIterator<K, V>; +} +export declare class SortedMapIterator<K, V> { + private isReverse; + private nodeStack; + constructor(node: LLRBNode<K, V> | LLRBEmptyNode<K, V>, startKey: K | null, comparator: Comparator<K>, isReverse: boolean); + getNext(): Entry<K, V>; + hasNext(): boolean; + peek(): Entry<K, V> | null; +} +export declare class LLRBNode<K, V> { + key: K; + value: V; + readonly color: boolean; + readonly left: LLRBNode<K, V> | LLRBEmptyNode<K, V>; + readonly right: LLRBNode<K, V> | LLRBEmptyNode<K, V>; + readonly size: number; + static EMPTY: LLRBEmptyNode<any, any>; + static RED: boolean; + static BLACK: boolean; + constructor(key: K, value: V, color?: boolean, left?: LLRBNode<K, V> | LLRBEmptyNode<K, V>, right?: LLRBNode<K, V> | LLRBEmptyNode<K, V>); + copy(key: K | null, value: V | null, color: boolean | null, left: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null, right: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null): LLRBNode<K, V>; + isEmpty(): boolean; + inorderTraversal<T>(action: (k: K, v: V) => T): T; + reverseTraversal<T>(action: (k: K, v: V) => T): T; + private min; + minKey(): K | null; + maxKey(): K | null; + insert(key: K, value: V, comparator: Comparator<K>): LLRBNode<K, V>; + private removeMin; + remove(key: K, comparator: Comparator<K>): LLRBNode<K, V> | LLRBEmptyNode<K, V>; + isRed(): boolean; + private fixUp; + private moveRedLeft; + private moveRedRight; + private rotateLeft; + private rotateRight; + private colorFlip; + checkMaxDepth(): boolean; + protected check(): number; +} +export declare class LLRBEmptyNode<K, V> { + get key(): never; + get value(): never; + get color(): never; + get left(): never; + get right(): never; + size: number; + copy(key: K | null, value: V | null, color: boolean | null, left: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null, right: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null): LLRBEmptyNode<K, V>; + insert(key: K, value: V, comparator: Comparator<K>): LLRBNode<K, V>; + remove(key: K, comparator: Comparator<K>): LLRBEmptyNode<K, V>; + isEmpty(): boolean; + inorderTraversal(action: (k: K, v: V) => boolean): boolean; + reverseTraversal(action: (k: K, v: V) => boolean): boolean; + minKey(): K | null; + maxKey(): K | null; + isRed(): boolean; + checkMaxDepth(): boolean; + protected check(): 0; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/sorted_set.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/sorted_set.d.ts new file mode 100644 index 0000000..ff6aedc --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/sorted_set.d.ts @@ -0,0 +1,80 @@ +/** + * @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 { SortedMapIterator } from './sorted_map'; +/** + * SortedSet is an immutable (copy-on-write) collection that holds elements + * in order specified by the provided comparator. + * + * NOTE: if provided comparator returns 0 for two elements, we consider them to + * be equal! + */ +export declare class SortedSet<T> { + private comparator; + private data; + constructor(comparator: (left: T, right: T) => number); + has(elem: T): boolean; + first(): T | null; + last(): T | null; + get size(): number; + indexOf(elem: T): number; + /** Iterates elements in order defined by "comparator" */ + forEach(cb: (elem: T) => void): void; + /** Iterates over `elem`s such that: range[0] <= elem < range[1]. */ + forEachInRange(range: [T, T], cb: (elem: T) => void): void; + /** + * Iterates over `elem`s such that: start <= elem until false is returned. + */ + forEachWhile(cb: (elem: T) => boolean, start?: T): void; + /** Finds the least element greater than or equal to `elem`. */ + firstAfterOrEqual(elem: T): T | null; + getIterator(): SortedSetIterator<T>; + getIteratorFrom(key: T): SortedSetIterator<T>; + /** Inserts or updates an element */ + add(elem: T): SortedSet<T>; + /** Deletes an element */ + delete(elem: T): SortedSet<T>; + isEmpty(): boolean; + unionWith(other: SortedSet<T>): SortedSet<T>; + isEqual(other: SortedSet<T>): boolean; + toArray(): T[]; + toString(): string; + private copy; +} +export declare class SortedSetIterator<T> { + private iter; + constructor(iter: SortedMapIterator<T, boolean>); + getNext(): T; + hasNext(): boolean; +} +/** + * Compares two sorted sets for equality using their natural ordering. The + * method computes the intersection and invokes `onAdd` for every element that + * is in `after` but not `before`. `onRemove` is invoked for every element in + * `before` but missing from `after`. + * + * The method creates a copy of both `before` and `after` and runs in O(n log + * n), where n is the size of the two lists. + * + * @param before - The elements that exist in the original set. + * @param after - The elements to diff against the original set. + * @param comparator - The comparator for the elements in before and after. + * @param onAdd - A function to invoke for every element that is part of ` + * after` but not `before`. + * @param onRemove - A function to invoke for every element that is part of + * `before` but not `after`. + */ +export declare function diffSortedSets<T>(before: SortedSet<T>, after: SortedSet<T>, comparator: (l: T, r: T) => number, onAdd: (entry: T) => void, onRemove: (entry: T) => void): void; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/testing_hooks.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/testing_hooks.d.ts new file mode 100644 index 0000000..90c6a65 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/testing_hooks.d.ts @@ -0,0 +1,52 @@ +/** + * @license + * Copyright 2023 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 { Unsubscribe } from '../api/reference_impl'; +import { ExistenceFilterMismatchInfo } from './testing_hooks_spi'; +/** + * Testing hooks for use by Firestore's integration test suite to reach into the + * SDK internals to validate logic and behavior that is not visible from the + * public API surface. + * + * @internal + */ +export declare class TestingHooks { + private constructor(); + /** + * Registers a callback to be notified when an existence filter mismatch + * occurs in the Watch listen stream. + * + * The relative order in which callbacks are notified is unspecified; do not + * rely on any particular ordering. If a given callback is registered multiple + * times then it will be notified multiple times, once per registration. + * + * @param callback the callback to invoke upon existence filter mismatch. + * + * @return a function that, when called, unregisters the given callback; only + * the first invocation of the returned function does anything; all subsequent + * invocations do nothing. + */ + static onExistenceFilterMismatch(callback: ExistenceFilterMismatchCallback): Unsubscribe; +} +/** + * The signature of callbacks registered with + * `TestingUtils.onExistenceFilterMismatch()`. + * + * The return value, if any, is ignored. + * + * @internal + */ +export type ExistenceFilterMismatchCallback = (info: ExistenceFilterMismatchInfo) => unknown; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/testing_hooks_spi.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/testing_hooks_spi.d.ts new file mode 100644 index 0000000..3d456e9 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/testing_hooks_spi.d.ts @@ -0,0 +1,93 @@ +/** + * @license + * Copyright 2023 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. + */ +/** + * The global, singleton instance of TestingHooksSpi. + * + * This variable will be `null` in all cases _except_ when running from + * integration tests that have registered callbacks to be notified of events + * that happen during the test execution. + */ +export declare let testingHooksSpi: TestingHooksSpi | null; +/** + * Sets the value of the `testingHooksSpi` object. + * @param instance the instance to set. + */ +export declare function setTestingHooksSpi(instance: TestingHooksSpi): void; +/** + * The "service provider interface" for the testing hooks. + * + * The implementation of this object will handle the callbacks made by the SDK + * to be handled by the integration tests. + * + * This "SPI" is separated from the implementation to avoid import cycles and + * to enable production builds to fully tree-shake away the testing hooks logic. + */ +export interface TestingHooksSpi { + /** + * Invokes all callbacks registered with + * `TestingHooks.onExistenceFilterMismatch()` with the given info. + */ + notifyOnExistenceFilterMismatch(info: ExistenceFilterMismatchInfo): void; +} +/** + * Information about an existence filter mismatch. + * @internal + */ +export interface ExistenceFilterMismatchInfo { + /** The number of documents that matched the query in the local cache. */ + localCacheCount: number; + /** + * The number of documents that matched the query on the server, as specified + * in the ExistenceFilter message's `count` field. + */ + existenceFilterCount: number; + /** + * The projectId used when checking documents for membership in the bloom + * filter. + */ + projectId: string; + /** + * The databaseId used when checking documents for membership in the bloom + * filter. + */ + databaseId: string; + /** + * Information about the bloom filter provided by Watch in the ExistenceFilter + * message's `unchangedNames` field. If this property is omitted or undefined + * then that means that Watch did _not_ provide a bloom filter. + */ + bloomFilter?: { + /** + * Whether a full requery was averted by using the bloom filter. If false, + * then something happened, such as a false positive, to prevent using the + * bloom filter to avoid a full requery. + */ + applied: boolean; + /** The number of hash functions used in the bloom filter. */ + hashCount: number; + /** The number of bytes in the bloom filter's bitmask. */ + bitmapLength: number; + /** The number of bits of padding in the last byte of the bloom filter. */ + padding: number; + /** + * Tests the given string for membership in the bloom filter created from + * the existence filter; will be undefined if creating the bloom filter + * failed. + */ + mightContain?: (value: string) => boolean; + }; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/types.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/types.d.ts new file mode 100644 index 0000000..a6842fe --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/firestore/src/util/types.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. + */ +/** Sentinel value that sorts before any Mutation Batch ID. */ +export declare const BATCHID_UNKNOWN = -1; +export interface StringMap { + [key: string]: string; +} +/** + * Returns whether a variable is either undefined or null. + */ +export declare function isNullOrUndefined(value: unknown): value is null | undefined; +/** Returns whether the value represents -0. */ +export declare function isNegativeZero(value: number): boolean; +/** + * Returns whether a value is an integer and in the safe integer range + * @param value - The value to test for being an integer and in the safe range + */ +export declare function isSafeInteger(value: unknown): boolean; +/** The subset of the browser's Window interface used by the SDK. */ +export interface WindowLike { + readonly localStorage: Storage; + readonly indexedDB: IDBFactory | null; + addEventListener(type: string, listener: EventListener): void; + removeEventListener(type: string, listener: EventListener): void; +} +/** The subset of the browser's Document interface used by the SDK. */ +export interface DocumentLike { + readonly visibilityState: DocumentVisibilityState; + addEventListener(type: string, listener: EventListener): void; + removeEventListener(type: string, listener: EventListener): void; +} |
