diff options
| author | altaf-creator <dev@altafcreator.com> | 2025-11-09 11:15:19 +0800 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2025-11-09 11:15:19 +0800 |
| commit | 8eff962cab608341a6f2fedc640a0e32d96f26e2 (patch) | |
| tree | 05534d1a720ddc3691d346c69b4972555820a061 /frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core | |
pain
Diffstat (limited to 'frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core')
24 files changed, 1955 insertions, 0 deletions
diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/aggregate.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/aggregate.d.ts new file mode 100644 index 0000000..16da2bb --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/bound.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/bound.d.ts new file mode 100644 index 0000000..8289126 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/bundle.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/bundle.d.ts new file mode 100644 index 0000000..6a81fcf --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/bundle_impl.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/bundle_impl.d.ts new file mode 100644 index 0000000..55395f2 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/component_provider.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/component_provider.d.ts new file mode 100644 index 0000000..97b6814 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/database_info.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/database_info.d.ts new file mode 100644 index 0000000..5429403 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/event_manager.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/event_manager.d.ts new file mode 100644 index 0000000..38b980f --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/filter.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/filter.d.ts new file mode 100644 index 0000000..ccb871f --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/firestore_client.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/firestore_client.d.ts new file mode 100644 index 0000000..a3a2b24 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/listen_sequence.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/listen_sequence.d.ts new file mode 100644 index 0000000..c824db1 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/order_by.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/order_by.d.ts new file mode 100644 index 0000000..1d7aa86 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/query.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/query.d.ts new file mode 100644 index 0000000..d23e0f1 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/snapshot_version.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/snapshot_version.d.ts new file mode 100644 index 0000000..10c508b --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/sync_engine.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/sync_engine.d.ts new file mode 100644 index 0000000..2c28d31 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/sync_engine_impl.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/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/lite/firestore/src/core/target.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/target.d.ts new file mode 100644 index 0000000..fcfed20 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/target_id_generator.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/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/lite/firestore/src/core/transaction.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/transaction.d.ts new file mode 100644 index 0000000..4a982e9 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/transaction_options.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/transaction_options.d.ts new file mode 100644 index 0000000..bf52930 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/transaction_runner.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/transaction_runner.d.ts new file mode 100644 index 0000000..794c7d3 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/types.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/types.d.ts new file mode 100644 index 0000000..6c3b8ca --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/version.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/version.d.ts new file mode 100644 index 0000000..9edc565 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/view.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/view.d.ts new file mode 100644 index 0000000..57680a5 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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/lite/firestore/src/core/view_snapshot.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/src/core/view_snapshot.d.ts new file mode 100644 index 0000000..8b284df --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/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; +} |
