diff options
Diffstat (limited to 'frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view')
16 files changed, 825 insertions, 0 deletions
diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/CacheNode.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/CacheNode.d.ts new file mode 100644 index 0000000..da38015 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/CacheNode.d.ts @@ -0,0 +1,41 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Node } from '../snap/Node'; +import { Path } from '../util/Path'; +/** + * A cache node only stores complete children. Additionally it holds a flag whether the node can be considered fully + * initialized in the sense that we know at one point in time this represented a valid state of the world, e.g. + * initialized with data from the server, or a complete overwrite by the client. The filtered flag also tracks + * whether a node potentially had children removed due to a filter. + */ +export declare class CacheNode { + private node_; + private fullyInitialized_; + private filtered_; + constructor(node_: Node, fullyInitialized_: boolean, filtered_: boolean); + /** + * Returns whether this node was fully initialized with either server data or a complete overwrite by the client + */ + isFullyInitialized(): boolean; + /** + * Returns whether this node is potentially missing children due to a filter applied to the node + */ + isFiltered(): boolean; + isCompleteForPath(path: Path): boolean; + isCompleteForChild(key: string): boolean; + getNode(): Node; +} diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/Change.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/Change.d.ts new file mode 100644 index 0000000..985eee0 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/Change.d.ts @@ -0,0 +1,46 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Node } from '../snap/Node'; +export declare const enum ChangeType { + /** Event type for a child added */ + CHILD_ADDED = "child_added", + /** Event type for a child removed */ + CHILD_REMOVED = "child_removed", + /** Event type for a child changed */ + CHILD_CHANGED = "child_changed", + /** Event type for a child moved */ + CHILD_MOVED = "child_moved", + /** Event type for a value change */ + VALUE = "value" +} +export interface Change { + /** @param type - The event type */ + type: ChangeType; + /** @param snapshotNode - The data */ + snapshotNode: Node; + /** @param childName - The name for this child, if it's a child even */ + childName?: string; + /** @param oldSnap - Used for intermediate processing of child changed events */ + oldSnap?: Node; + /** * @param prevName - The name for the previous child, if applicable */ + prevName?: string | null; +} +export declare function changeValue(snapshotNode: Node): Change; +export declare function changeChildAdded(childName: string, snapshotNode: Node): Change; +export declare function changeChildRemoved(childName: string, snapshotNode: Node): Change; +export declare function changeChildChanged(childName: string, snapshotNode: Node, oldSnap: Node): Change; +export declare function changeChildMoved(childName: string, snapshotNode: Node): Change; diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/ChildChangeAccumulator.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/ChildChangeAccumulator.d.ts new file mode 100644 index 0000000..473ab16 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/ChildChangeAccumulator.d.ts @@ -0,0 +1,22 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Change } from './Change'; +export declare class ChildChangeAccumulator { + private readonly changeMap; + trackChildChange(change: Change): void; + getChanges(): Change[]; +} diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/CompleteChildSource.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/CompleteChildSource.d.ts new file mode 100644 index 0000000..fcc774c --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/CompleteChildSource.d.ts @@ -0,0 +1,55 @@ +/** + * @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 { Index } from '../snap/indexes/Index'; +import { NamedNode, Node } from '../snap/Node'; +import { WriteTreeRef } from '../WriteTree'; +import { ViewCache } from './ViewCache'; +/** + * Since updates to filtered nodes might require nodes to be pulled in from "outside" the node, this interface + * can help to get complete children that can be pulled in. + * A class implementing this interface takes potentially multiple sources (e.g. user writes, server data from + * other views etc.) to try it's best to get a complete child that might be useful in pulling into the view. + * + * @interface + */ +export interface CompleteChildSource { + getCompleteChild(childKey: string): Node | null; + getChildAfterChild(index: Index, child: NamedNode, reverse: boolean): NamedNode | null; +} +/** + * An implementation of CompleteChildSource that never returns any additional children + */ +export declare class NoCompleteChildSource_ implements CompleteChildSource { + getCompleteChild(childKey?: string): Node | null; + getChildAfterChild(index?: Index, child?: NamedNode, reverse?: boolean): NamedNode | null; +} +/** + * Singleton instance. + */ +export declare const NO_COMPLETE_CHILD_SOURCE: NoCompleteChildSource_; +/** + * An implementation of CompleteChildSource that uses a WriteTree in addition to any other server data or + * old event caches available to calculate complete children. + */ +export declare class WriteTreeCompleteChildSource implements CompleteChildSource { + private writes_; + private viewCache_; + private optCompleteServerCache_; + constructor(writes_: WriteTreeRef, viewCache_: ViewCache, optCompleteServerCache_?: Node | null); + getCompleteChild(childKey: string): Node | null; + getChildAfterChild(index: Index, child: NamedNode, reverse: boolean): NamedNode | null; +} diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/Event.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/Event.d.ts new file mode 100644 index 0000000..69e326a --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/Event.d.ts @@ -0,0 +1,64 @@ +/** + * @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 { DataSnapshot as ExpDataSnapshot } from '../../api/Reference_impl'; +import { Path } from '../util/Path'; +import { EventRegistration } from './EventRegistration'; +/** + * Encapsulates the data needed to raise an event + * @interface + */ +export interface Event { + getPath(): Path; + getEventType(): string; + getEventRunner(): () => void; + toString(): string; +} +/** + * One of the following strings: "value", "child_added", "child_changed", + * "child_removed", or "child_moved." + */ +export type EventType = 'value' | 'child_added' | 'child_changed' | 'child_moved' | 'child_removed'; +/** + * Encapsulates the data needed to raise an event + */ +export declare class DataEvent implements Event { + eventType: EventType; + eventRegistration: EventRegistration; + snapshot: ExpDataSnapshot; + prevName?: string | null; + /** + * @param eventType - One of: value, child_added, child_changed, child_moved, child_removed + * @param eventRegistration - The function to call to with the event data. User provided + * @param snapshot - The data backing the event + * @param prevName - Optional, the name of the previous child for child_* events. + */ + constructor(eventType: EventType, eventRegistration: EventRegistration, snapshot: ExpDataSnapshot, prevName?: string | null); + getPath(): Path; + getEventType(): string; + getEventRunner(): () => void; + toString(): string; +} +export declare class CancelEvent implements Event { + eventRegistration: EventRegistration; + error: Error; + path: Path; + constructor(eventRegistration: EventRegistration, error: Error, path: Path); + getPath(): Path; + getEventType(): string; + getEventRunner(): () => void; + toString(): string; +} diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/EventGenerator.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/EventGenerator.d.ts new file mode 100644 index 0000000..bc916b8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/EventGenerator.d.ts @@ -0,0 +1,42 @@ +/** + * @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 { Index } from '../snap/indexes/Index'; +import { Node } from '../snap/Node'; +import { Change } from './Change'; +import { Event } from './Event'; +import { EventRegistration, QueryContext } from './EventRegistration'; +/** + * An EventGenerator is used to convert "raw" changes (Change) as computed by the + * CacheDiffer into actual events (Event) that can be raised. See generateEventsForChanges() + * for details. + * + */ +export declare class EventGenerator { + query_: QueryContext; + index_: Index; + constructor(query_: QueryContext); +} +/** + * Given a set of raw changes (no moved events and prevName not specified yet), and a set of + * EventRegistrations that should be notified of these changes, generate the actual events to be raised. + * + * Notes: + * - child_moved events will be synthesized at this time for any child_changed events that affect + * our index. + * - prevName will be calculated based on the index ordering. + */ +export declare function eventGeneratorGenerateEventsForChanges(eventGenerator: EventGenerator, changes: Change[], eventCache: Node, eventRegistrations: EventRegistration[]): Event[]; diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/EventQueue.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/EventQueue.d.ts new file mode 100644 index 0000000..63ea6f4 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/EventQueue.d.ts @@ -0,0 +1,67 @@ +/** + * @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 { Path } from '../util/Path'; +import { Event } from './Event'; +/** + * The event queue serves a few purposes: + * 1. It ensures we maintain event order in the face of event callbacks doing operations that result in more + * events being queued. + * 2. raiseQueuedEvents() handles being called reentrantly nicely. That is, if in the course of raising events, + * raiseQueuedEvents() is called again, the "inner" call will pick up raising events where the "outer" call + * left off, ensuring that the events are still raised synchronously and in order. + * 3. You can use raiseEventsAtPath and raiseEventsForChangedPath to ensure only relevant previously-queued + * events are raised synchronously. + * + * NOTE: This can all go away if/when we move to async events. + * + */ +export declare class EventQueue { + eventLists_: EventList[]; + /** + * Tracks recursion depth of raiseQueuedEvents_, for debugging purposes. + */ + recursionDepth_: number; +} +/** + * @param eventDataList - The new events to queue. + */ +export declare function eventQueueQueueEvents(eventQueue: EventQueue, eventDataList: Event[]): void; +/** + * Queues the specified events and synchronously raises all events (including previously queued ones) + * for the specified path. + * + * It is assumed that the new events are all for the specified path. + * + * @param path - The path to raise events for. + * @param eventDataList - The new events to raise. + */ +export declare function eventQueueRaiseEventsAtPath(eventQueue: EventQueue, path: Path, eventDataList: Event[]): void; +/** + * Queues the specified events and synchronously raises all events (including previously queued ones) for + * locations related to the specified change path (i.e. all ancestors and descendants). + * + * It is assumed that the new events are all related (ancestor or descendant) to the specified path. + * + * @param changedPath - The path to raise events for. + * @param eventDataList - The events to raise + */ +export declare function eventQueueRaiseEventsForChangedPath(eventQueue: EventQueue, changedPath: Path, eventDataList: Event[]): void; +interface EventList { + events: Event[]; + path: Path; +} +export {}; diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/EventRegistration.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/EventRegistration.d.ts new file mode 100644 index 0000000..4425097 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/EventRegistration.d.ts @@ -0,0 +1,87 @@ +/** + * @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 { DataSnapshot } from '../../api/Reference_impl'; +import { Repo } from '../Repo'; +import { Path } from '../util/Path'; +import { Change } from './Change'; +import { CancelEvent, Event } from './Event'; +import { QueryParams } from './QueryParams'; +/** + * A user callback. Callbacks issues from the Legacy SDK maintain references + * to the original user-issued callbacks, which allows equality + * comparison by reference even though this callbacks are wrapped before + * they can be passed to the firebase@exp SDK. + * + * @internal + */ +export interface UserCallback { + (dataSnapshot: DataSnapshot, previousChildName?: string | null): unknown; + userCallback?: unknown; + context?: object | null; +} +/** + * A wrapper class that converts events from the database@exp SDK to the legacy + * Database SDK. Events are not converted directly as event registration relies + * on reference comparison of the original user callback (see `matches()`) and + * relies on equality of the legacy SDK's `context` object. + */ +export declare class CallbackContext { + private readonly snapshotCallback; + private readonly cancelCallback?; + constructor(snapshotCallback: UserCallback, cancelCallback?: (error: Error) => unknown); + onValue(expDataSnapshot: DataSnapshot, previousChildName?: string | null): void; + onCancel(error: Error): void; + get hasCancelCallback(): boolean; + matches(other: CallbackContext): boolean; +} +export interface QueryContext { + readonly _queryIdentifier: string; + readonly _queryObject: object; + readonly _repo: Repo; + readonly _path: Path; + readonly _queryParams: QueryParams; +} +/** + * An EventRegistration is basically an event type ('value', 'child_added', etc.) and a callback + * to be notified of that type of event. + * + * That said, it can also contain a cancel callback to be notified if the event is canceled. And + * currently, this code is organized around the idea that you would register multiple child_ callbacks + * together, as a single EventRegistration. Though currently we don't do that. + */ +export interface EventRegistration { + /** + * True if this container has a callback to trigger for this event type + */ + respondsTo(eventType: string): boolean; + createEvent(change: Change, query: QueryContext): Event; + /** + * Given event data, return a function to trigger the user's callback + */ + getEventRunner(eventData: Event): () => void; + createCancelEvent(error: Error, path: Path): CancelEvent | null; + matches(other: EventRegistration): boolean; + /** + * False basically means this is a "dummy" callback container being used as a sentinel + * to remove all callback containers of a particular type. (e.g. if the user does + * ref.off('value') without specifying a specific callback). + * + * (TODO: Rework this, since it's hacky) + * + */ + hasAnyCallback(): boolean; +} diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/QueryParams.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/QueryParams.d.ts new file mode 100644 index 0000000..47870f7 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/QueryParams.d.ts @@ -0,0 +1,95 @@ +/** + * @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 { Index } from '../snap/indexes/Index'; +import { PriorityIndex } from '../snap/indexes/PriorityIndex'; +import { NodeFilter } from './filter/NodeFilter'; +/** + * This class is an immutable-from-the-public-api struct containing a set of query parameters defining a + * range to be returned for a particular location. It is assumed that validation of parameters is done at the + * user-facing API level, so it is not done here. + * + * @internal + */ +export declare class QueryParams { + limitSet_: boolean; + startSet_: boolean; + startNameSet_: boolean; + startAfterSet_: boolean; + endSet_: boolean; + endNameSet_: boolean; + endBeforeSet_: boolean; + limit_: number; + viewFrom_: string; + indexStartValue_: unknown | null; + indexStartName_: string; + indexEndValue_: unknown | null; + indexEndName_: string; + index_: PriorityIndex; + hasStart(): boolean; + /** + * @returns True if it would return from left. + */ + isViewFromLeft(): boolean; + /** + * Only valid to call if hasStart() returns true + */ + getIndexStartValue(): unknown; + /** + * Only valid to call if hasStart() returns true. + * Returns the starting key name for the range defined by these query parameters + */ + getIndexStartName(): string; + hasEnd(): boolean; + /** + * Only valid to call if hasEnd() returns true. + */ + getIndexEndValue(): unknown; + /** + * Only valid to call if hasEnd() returns true. + * Returns the end key name for the range defined by these query parameters + */ + getIndexEndName(): string; + hasLimit(): boolean; + /** + * @returns True if a limit has been set and it has been explicitly anchored + */ + hasAnchoredLimit(): boolean; + /** + * Only valid to call if hasLimit() returns true + */ + getLimit(): number; + getIndex(): Index; + loadsAllData(): boolean; + isDefault(): boolean; + copy(): QueryParams; +} +export declare function queryParamsGetNodeFilter(queryParams: QueryParams): NodeFilter; +export declare function queryParamsLimit(queryParams: QueryParams, newLimit: number): QueryParams; +export declare function queryParamsLimitToFirst(queryParams: QueryParams, newLimit: number): QueryParams; +export declare function queryParamsLimitToLast(queryParams: QueryParams, newLimit: number): QueryParams; +export declare function queryParamsStartAt(queryParams: QueryParams, indexValue: unknown, key?: string | null): QueryParams; +export declare function queryParamsStartAfter(queryParams: QueryParams, indexValue: unknown, key?: string | null): QueryParams; +export declare function queryParamsEndAt(queryParams: QueryParams, indexValue: unknown, key?: string | null): QueryParams; +export declare function queryParamsEndBefore(queryParams: QueryParams, indexValue: unknown, key?: string | null): QueryParams; +export declare function queryParamsOrderBy(queryParams: QueryParams, index: Index): QueryParams; +/** + * Returns a set of REST query string parameters representing this query. + * + * @returns query string parameters + */ +export declare function queryParamsToRestQueryStringParameters(queryParams: QueryParams): Record<string, string | number>; +export declare function queryParamsGetQueryObject(queryParams: QueryParams): Record<string, unknown>; diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/View.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/View.d.ts new file mode 100644 index 0000000..a872658 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/View.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 { Operation } from '../operation/Operation'; +import { Node } from '../snap/Node'; +import { Path } from '../util/Path'; +import { WriteTreeRef } from '../WriteTree'; +import { Event } from './Event'; +import { EventGenerator } from './EventGenerator'; +import { EventRegistration, QueryContext } from './EventRegistration'; +import { ViewCache } from './ViewCache'; +import { ViewProcessor } from './ViewProcessor'; +/** + * A view represents a specific location and query that has 1 or more event registrations. + * + * It does several things: + * - Maintains the list of event registrations for this location/query. + * - Maintains a cache of the data visible for this location/query. + * - Applies new operations (via applyOperation), updates the cache, and based on the event + * registrations returns the set of events to be raised. + */ +export declare class View { + private query_; + processor_: ViewProcessor; + viewCache_: ViewCache; + eventRegistrations_: EventRegistration[]; + eventGenerator_: EventGenerator; + constructor(query_: QueryContext, initialViewCache: ViewCache); + get query(): QueryContext; +} +export declare function viewGetServerCache(view: View): Node | null; +export declare function viewGetCompleteNode(view: View): Node | null; +export declare function viewGetCompleteServerCache(view: View, path: Path): Node | null; +export declare function viewIsEmpty(view: View): boolean; +export declare function viewAddEventRegistration(view: View, eventRegistration: EventRegistration): void; +/** + * @param eventRegistration - If null, remove all callbacks. + * @param cancelError - If a cancelError is provided, appropriate cancel events will be returned. + * @returns Cancel events, if cancelError was provided. + */ +export declare function viewRemoveEventRegistration(view: View, eventRegistration: EventRegistration | null, cancelError?: Error): Event[]; +/** + * Applies the given Operation, updates our cache, and returns the appropriate events. + */ +export declare function viewApplyOperation(view: View, operation: Operation, writesCache: WriteTreeRef, completeServerCache: Node | null): Event[]; +export declare function viewGetInitialEvents(view: View, registration: EventRegistration): Event[]; diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/ViewCache.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/ViewCache.d.ts new file mode 100644 index 0000000..089749d --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/ViewCache.d.ts @@ -0,0 +1,32 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Node } from '../snap/Node'; +import { CacheNode } from './CacheNode'; +/** + * Stores the data we have cached for a view. + * + * serverSnap is the cached server data, eventSnap is the cached event data (server data plus any local writes). + */ +export interface ViewCache { + readonly eventCache: CacheNode; + readonly serverCache: CacheNode; +} +export declare function newViewCache(eventCache: CacheNode, serverCache: CacheNode): ViewCache; +export declare function viewCacheUpdateEventSnap(viewCache: ViewCache, eventSnap: Node, complete: boolean, filtered: boolean): ViewCache; +export declare function viewCacheUpdateServerSnap(viewCache: ViewCache, serverSnap: Node, complete: boolean, filtered: boolean): ViewCache; +export declare function viewCacheGetCompleteEventSnap(viewCache: ViewCache): Node | null; +export declare function viewCacheGetCompleteServerSnap(viewCache: ViewCache): Node | null; diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/ViewProcessor.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/ViewProcessor.d.ts new file mode 100644 index 0000000..9baa237 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/ViewProcessor.d.ts @@ -0,0 +1,32 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Operation } from '../operation/Operation'; +import { Node } from '../snap/Node'; +import { WriteTreeRef } from '../WriteTree'; +import { Change } from './Change'; +import { NodeFilter } from './filter/NodeFilter'; +import { ViewCache } from './ViewCache'; +export interface ProcessorResult { + readonly viewCache: ViewCache; + readonly changes: Change[]; +} +export interface ViewProcessor { + readonly filter: NodeFilter; +} +export declare function newViewProcessor(filter: NodeFilter): ViewProcessor; +export declare function viewProcessorAssertIndexed(viewProcessor: ViewProcessor, viewCache: ViewCache): void; +export declare function viewProcessorApplyOperation(viewProcessor: ViewProcessor, oldViewCache: ViewCache, operation: Operation, writesCache: WriteTreeRef, completeCache: Node | null): ProcessorResult; diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/filter/IndexedFilter.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/filter/IndexedFilter.d.ts new file mode 100644 index 0000000..07584dd --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/filter/IndexedFilter.d.ts @@ -0,0 +1,35 @@ +/** + * @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 { Index } from '../../snap/indexes/Index'; +import { Node } from '../../snap/Node'; +import { Path } from '../../util/Path'; +import { ChildChangeAccumulator } from '../ChildChangeAccumulator'; +import { CompleteChildSource } from '../CompleteChildSource'; +import { NodeFilter } from './NodeFilter'; +/** + * Doesn't really filter nodes but applies an index to the node and keeps track of any changes + */ +export declare class IndexedFilter implements NodeFilter { + private readonly index_; + constructor(index_: Index); + updateChild(snap: Node, key: string, newChild: Node, affectedPath: Path, source: CompleteChildSource, optChangeAccumulator: ChildChangeAccumulator | null): Node; + updateFullNode(oldSnap: Node, newSnap: Node, optChangeAccumulator: ChildChangeAccumulator | null): Node; + updatePriority(oldSnap: Node, newPriority: Node): Node; + filtersNodes(): boolean; + getIndexedFilter(): IndexedFilter; + getIndex(): Index; +} diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/filter/LimitedFilter.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/filter/LimitedFilter.d.ts new file mode 100644 index 0000000..cb2da45 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/filter/LimitedFilter.d.ts @@ -0,0 +1,47 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Index } from '../../snap/indexes/Index'; +import { Node } from '../../snap/Node'; +import { Path } from '../../util/Path'; +import { ChildChangeAccumulator } from '../ChildChangeAccumulator'; +import { CompleteChildSource } from '../CompleteChildSource'; +import { QueryParams } from '../QueryParams'; +import { IndexedFilter } from './IndexedFilter'; +import { NodeFilter } from './NodeFilter'; +/** + * Applies a limit and a range to a node and uses RangedFilter to do the heavy lifting where possible + */ +export declare class LimitedFilter implements NodeFilter { + private readonly rangedFilter_; + private readonly index_; + private readonly limit_; + private readonly reverse_; + private readonly startIsInclusive_; + private readonly endIsInclusive_; + constructor(params: QueryParams); + updateChild(snap: Node, key: string, newChild: Node, affectedPath: Path, source: CompleteChildSource, optChangeAccumulator: ChildChangeAccumulator | null): Node; + updateFullNode(oldSnap: Node, newSnap: Node, optChangeAccumulator: ChildChangeAccumulator | null): Node; + updatePriority(oldSnap: Node, newPriority: Node): Node; + filtersNodes(): boolean; + getIndexedFilter(): IndexedFilter; + getIndex(): Index; + private fullLimitUpdateChild_; + private withinDirectionalStart; + private withinDirectionalEnd; + private withinStartPost; + private withinEndPost; +} diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/filter/NodeFilter.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/filter/NodeFilter.d.ts new file mode 100644 index 0000000..b1fafb2 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/filter/NodeFilter.d.ts @@ -0,0 +1,54 @@ +/** + * @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 { Index } from '../../snap/indexes/Index'; +import { Node } from '../../snap/Node'; +import { Path } from '../../util/Path'; +import { ChildChangeAccumulator } from '../ChildChangeAccumulator'; +import { CompleteChildSource } from '../CompleteChildSource'; +/** + * NodeFilter is used to update nodes and complete children of nodes while applying queries on the fly and keeping + * track of any child changes. This class does not track value changes as value changes depend on more + * than just the node itself. Different kind of queries require different kind of implementations of this interface. + * @interface + */ +export interface NodeFilter { + /** + * Update a single complete child in the snap. If the child equals the old child in the snap, this is a no-op. + * The method expects an indexed snap. + */ + updateChild(snap: Node, key: string, newChild: Node, affectedPath: Path, source: CompleteChildSource, optChangeAccumulator: ChildChangeAccumulator | null): Node; + /** + * Update a node in full and output any resulting change from this complete update. + */ + updateFullNode(oldSnap: Node, newSnap: Node, optChangeAccumulator: ChildChangeAccumulator | null): Node; + /** + * Update the priority of the root node + */ + updatePriority(oldSnap: Node, newPriority: Node): Node; + /** + * Returns true if children might be filtered due to query criteria + */ + filtersNodes(): boolean; + /** + * Returns the index filter that this filter uses to get a NodeFilter that doesn't filter any children. + */ + getIndexedFilter(): NodeFilter; + /** + * Returns the index that this filter uses + */ + getIndex(): Index; +} diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/filter/RangedFilter.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/filter/RangedFilter.d.ts new file mode 100644 index 0000000..bef847a --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/view/filter/RangedFilter.d.ts @@ -0,0 +1,47 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { NamedNode, Node } from '../../../core/snap/Node'; +import { Index } from '../../snap/indexes/Index'; +import { Path } from '../../util/Path'; +import { ChildChangeAccumulator } from '../ChildChangeAccumulator'; +import { CompleteChildSource } from '../CompleteChildSource'; +import { QueryParams } from '../QueryParams'; +import { IndexedFilter } from './IndexedFilter'; +import { NodeFilter } from './NodeFilter'; +/** + * Filters nodes by range and uses an IndexFilter to track any changes after filtering the node + */ +export declare class RangedFilter implements NodeFilter { + private indexedFilter_; + private index_; + private startPost_; + private endPost_; + private startIsInclusive_; + private endIsInclusive_; + constructor(params: QueryParams); + getStartPost(): NamedNode; + getEndPost(): NamedNode; + matches(node: NamedNode): boolean; + updateChild(snap: Node, key: string, newChild: Node, affectedPath: Path, source: CompleteChildSource, optChangeAccumulator: ChildChangeAccumulator | null): Node; + updateFullNode(oldSnap: Node, newSnap: Node, optChangeAccumulator: ChildChangeAccumulator | null): Node; + updatePriority(oldSnap: Node, newPriority: Node): Node; + filtersNodes(): boolean; + getIndexedFilter(): IndexedFilter; + getIndex(): Index; + private static getStartPost_; + private static getEndPost_; +} |
