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/database/dist/node-esm/src/core/util | |
pain
Diffstat (limited to 'frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util')
13 files changed, 1119 insertions, 0 deletions
diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/EventEmitter.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/EventEmitter.d.ts new file mode 100644 index 0000000..0fd09f9 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/EventEmitter.d.ts @@ -0,0 +1,39 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Base class to be used if you want to emit events. Call the constructor with + * the set of allowed event names. + */ +export declare abstract class EventEmitter { + private allowedEvents_; + private listeners_; + constructor(allowedEvents_: string[]); + /** + * To be overridden by derived classes in order to fire an initial event when + * somebody subscribes for data. + * + * @returns {Array.<*>} Array of parameters to trigger initial event with. + */ + abstract getInitialEvent(eventType: string): unknown[]; + /** + * To be called by derived classes to trigger events. + */ + protected trigger(eventType: string, ...varArgs: unknown[]): void; + on(eventType: string, callback: (a: unknown) => void, context: unknown): void; + off(eventType: string, callback: (a: unknown) => void, context: unknown): void; + private validateEventType_; +} diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/ImmutableTree.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/ImmutableTree.d.ts new file mode 100644 index 0000000..8a85ce6 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/ImmutableTree.d.ts @@ -0,0 +1,117 @@ +/** + * @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 './Path'; +import { SortedMap } from './SortedMap'; +/** + * A tree with immutable elements. + */ +export declare class ImmutableTree<T> { + readonly value: T | null; + readonly children: SortedMap<string, ImmutableTree<T>>; + static fromObject<T>(obj: { + [k: string]: T; + }): ImmutableTree<T>; + constructor(value: T | null, children?: SortedMap<string, ImmutableTree<T>>); + /** + * True if the value is empty and there are no children + */ + isEmpty(): boolean; + /** + * Given a path and predicate, return the first node and the path to that node + * where the predicate returns true. + * + * TODO Do a perf test -- If we're creating a bunch of `{path: value:}` + * objects on the way back out, it may be better to pass down a pathSoFar obj. + * + * @param relativePath - The remainder of the path + * @param predicate - The predicate to satisfy to return a node + */ + findRootMostMatchingPathAndValue(relativePath: Path, predicate: (a: T) => boolean): { + path: Path; + value: T; + } | null; + /** + * Find, if it exists, the shortest subpath of the given path that points a defined + * value in the tree + */ + findRootMostValueAndPath(relativePath: Path): { + path: Path; + value: T; + } | null; + /** + * @returns The subtree at the given path + */ + subtree(relativePath: Path): ImmutableTree<T>; + /** + * Sets a value at the specified path. + * + * @param relativePath - Path to set value at. + * @param toSet - Value to set. + * @returns Resulting tree. + */ + set(relativePath: Path, toSet: T | null): ImmutableTree<T>; + /** + * Removes the value at the specified path. + * + * @param relativePath - Path to value to remove. + * @returns Resulting tree. + */ + remove(relativePath: Path): ImmutableTree<T>; + /** + * Gets a value from the tree. + * + * @param relativePath - Path to get value for. + * @returns Value at path, or null. + */ + get(relativePath: Path): T | null; + /** + * Replace the subtree at the specified path with the given new tree. + * + * @param relativePath - Path to replace subtree for. + * @param newTree - New tree. + * @returns Resulting tree. + */ + setTree(relativePath: Path, newTree: ImmutableTree<T>): ImmutableTree<T>; + /** + * Performs a depth first fold on this tree. Transforms a tree into a single + * value, given a function that operates on the path to a node, an optional + * current value, and a map of child names to folded subtrees + */ + fold<V>(fn: (path: Path, value: T, children: { + [k: string]: V; + }) => V): V; + /** + * Recursive helper for public-facing fold() method + */ + private fold_; + /** + * Find the first matching value on the given path. Return the result of applying f to it. + */ + findOnPath<V>(path: Path, f: (path: Path, value: T) => V | null): V | null; + private findOnPath_; + foreachOnPath(path: Path, f: (path: Path, value: T) => void): ImmutableTree<T>; + private foreachOnPath_; + /** + * Calls the given function for each node in the tree that has a value. + * + * @param f - A function to be called with the path from the root of the tree to + * a node, and the value at that node. Called in depth-first order. + */ + foreach(f: (path: Path, value: T) => void): void; + private foreach_; + foreachChild(f: (name: string, value: T) => void): void; +} diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/NextPushId.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/NextPushId.d.ts new file mode 100644 index 0000000..9ad8425 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/NextPushId.d.ts @@ -0,0 +1,33 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Fancy ID generator that creates 20-character string identifiers with the + * following properties: + * + * 1. They're based on timestamp so that they sort *after* any existing ids. + * 2. They contain 72-bits of random data after the timestamp so that IDs won't + * collide with other clients' IDs. + * 3. They sort *lexicographically* (so the timestamp is converted to characters + * that will sort properly). + * 4. They're monotonically increasing. Even if you generate more than one in + * the same timestamp, the latter ones will sort after the former ones. We do + * this by using the previous random bits but "incrementing" them by 1 (only + * in the case of a timestamp collision). + */ +export declare const nextPushId: (now: number) => string; +export declare const successor: (key: string) => string; +export declare const predecessor: (key: string) => string; diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/OnlineMonitor.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/OnlineMonitor.d.ts new file mode 100644 index 0000000..bed347b --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/OnlineMonitor.d.ts @@ -0,0 +1,31 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { EventEmitter } from './EventEmitter'; +/** + * Monitors online state (as reported by window.online/offline events). + * + * The expectation is that this could have many false positives (thinks we are online + * when we're not), but no false negatives. So we can safely use it to determine when + * we definitely cannot reach the internet. + */ +export declare class OnlineMonitor extends EventEmitter { + private online_; + static getInstance(): OnlineMonitor; + constructor(); + getInitialEvent(eventType: string): boolean[]; + currentlyOnline(): boolean; +} diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/Path.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/Path.d.ts new file mode 100644 index 0000000..2f73b36 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/Path.d.ts @@ -0,0 +1,94 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * An immutable object representing a parsed path. It's immutable so that you + * can pass them around to other functions without worrying about them changing + * it. + */ +export declare class Path { + pieces_: string[]; + pieceNum_: number; + /** + * @param pathOrString - Path string to parse, or another path, or the raw + * tokens array + */ + constructor(pathOrString: string | string[], pieceNum?: number); + toString(): string; +} +export declare function newEmptyPath(): Path; +export declare function pathGetFront(path: Path): string | null; +/** + * @returns The number of segments in this path + */ +export declare function pathGetLength(path: Path): number; +export declare function pathPopFront(path: Path): Path; +export declare function pathGetBack(path: Path): string | null; +export declare function pathToUrlEncodedString(path: Path): string; +/** + * Shallow copy of the parts of the path. + * + */ +export declare function pathSlice(path: Path, begin?: number): string[]; +export declare function pathParent(path: Path): Path | null; +export declare function pathChild(path: Path, childPathObj: string | Path): Path; +/** + * @returns True if there are no segments in this path + */ +export declare function pathIsEmpty(path: Path): boolean; +/** + * @returns The path from outerPath to innerPath + */ +export declare function newRelativePath(outerPath: Path, innerPath: Path): Path; +/** + * @returns -1, 0, 1 if left is less, equal, or greater than the right. + */ +export declare function pathCompare(left: Path, right: Path): number; +/** + * @returns true if paths are the same. + */ +export declare function pathEquals(path: Path, other: Path): boolean; +/** + * @returns True if this path is a parent of (or the same as) other + */ +export declare function pathContains(path: Path, other: Path): boolean; +/** + * Dynamic (mutable) path used to count path lengths. + * + * This class is used to efficiently check paths for valid + * length (in UTF8 bytes) and depth (used in path validation). + * + * Throws Error exception if path is ever invalid. + * + * The definition of a path always begins with '/'. + */ +export declare class ValidationPath { + errorPrefix_: string; + parts_: string[]; + /** Initialize to number of '/' chars needed in path. */ + byteLength_: number; + /** + * @param path - Initial Path. + * @param errorPrefix_ - Prefix for any error messages. + */ + constructor(path: Path, errorPrefix_: string); +} +export declare function validationPathPush(validationPath: ValidationPath, child: string): void; +export declare function validationPathPop(validationPath: ValidationPath): void; +/** + * String for use in error messages - uses '.' notation for path. + */ +export declare function validationPathToErrorString(validationPath: ValidationPath): string; diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/ServerValues.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/ServerValues.d.ts new file mode 100644 index 0000000..916cf14 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/ServerValues.d.ts @@ -0,0 +1,56 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Node } from '../snap/Node'; +import { SyncTree } from '../SyncTree'; +import { Indexable } from './misc'; +import { Path } from './Path'; +interface ValueProvider { + getImmediateChild(childName: string): ValueProvider; + node(): Node; +} +/** + * Generate placeholders for deferred values. + */ +export declare const generateWithValues: (values: { + [k: string]: unknown; +} | null) => { + [k: string]: unknown; +}; +/** + * Value to use when firing local events. When writing server values, fire + * local events with an approximate value, otherwise return value as-is. + */ +export declare const resolveDeferredLeafValue: (value: { + [k: string]: unknown; +} | string | number | boolean, existingVal: ValueProvider, serverValues: { + [k: string]: unknown; +}) => string | number | boolean; +/** + * Recursively replace all deferred values and priorities in the tree with the + * specified generated replacement values. + * @param path - path to which write is relative + * @param node - new data written at path + * @param syncTree - current data + */ +export declare const resolveDeferredValueTree: (path: Path, node: Node, syncTree: SyncTree, serverValues: Indexable) => Node; +/** + * Recursively replace all deferred values and priorities in the node with the + * specified generated replacement values. If there are no server values in the node, + * it'll be returned as-is. + */ +export declare const resolveDeferredValueSnapshot: (node: Node, existing: Node, serverValues: Indexable) => Node; +export {}; diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/SortedMap.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/SortedMap.d.ts new file mode 100644 index 0000000..09d3aa6 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/SortedMap.d.ts @@ -0,0 +1,324 @@ +/** + * @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. + */ +/** + * @fileoverview Implementation of an immutable SortedMap using a Left-leaning + * Red-Black Tree, adapted from the implementation in Mugs + * (http://mads379.github.com/mugs/) by Mads Hartmann Jensen + * (mads379\@gmail.com). + * + * Original paper on Left-leaning Red-Black Trees: + * http://www.cs.princeton.edu/~rs/talks/LLRB/LLRB.pdf + * + * Invariant 1: No red node has a red child + * Invariant 2: Every leaf path has the same number of black nodes + * Invariant 3: Only the left child can be red (left leaning) + */ +export type Comparator<K> = (key1: K, key2: K) => number; +/** + * An iterator over an LLRBNode. + */ +export declare class SortedMapIterator<K, V, T> { + private isReverse_; + private resultGenerator_; + private nodeStack_; + /** + * @param node - Node to iterate. + * @param isReverse_ - Whether or not to iterate in reverse + */ + constructor(node: LLRBNode<K, V> | LLRBEmptyNode<K, V>, startKey: K | null, comparator: Comparator<K>, isReverse_: boolean, resultGenerator_?: ((k: K, v: V) => T) | null); + getNext(): T; + hasNext(): boolean; + peek(): T; +} +/** + * Represents a node in a Left-leaning Red-Black tree. + */ +export declare class LLRBNode<K, V> { + key: K; + value: V; + color: boolean; + left: LLRBNode<K, V> | LLRBEmptyNode<K, V>; + right: LLRBNode<K, V> | LLRBEmptyNode<K, V>; + /** + * @param key - Key associated with this node. + * @param value - Value associated with this node. + * @param color - Whether this node is red. + * @param left - Left child. + * @param right - Right child. + */ + constructor(key: K, value: V, color: boolean | null, left?: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null, right?: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null); + static RED: boolean; + static BLACK: boolean; + /** + * Returns a copy of the current node, optionally replacing pieces of it. + * + * @param key - New key for the node, or null. + * @param value - New value for the node, or null. + * @param color - New color for the node, or null. + * @param left - New left child for the node, or null. + * @param right - New right child for the node, or null. + * @returns The node copy. + */ + copy(key: K | null, value: V | null, color: boolean | null, left: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null, right: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null): LLRBNode<K, V>; + /** + * @returns The total number of nodes in the tree. + */ + count(): number; + /** + * @returns True if the tree is empty. + */ + isEmpty(): boolean; + /** + * Traverses the tree in key order and calls the specified action function + * for each node. + * + * @param action - Callback function to be called for each + * node. If it returns true, traversal is aborted. + * @returns The first truthy value returned by action, or the last falsey + * value returned by action + */ + inorderTraversal(action: (k: K, v: V) => unknown): boolean; + /** + * Traverses the tree in reverse key order and calls the specified action function + * for each node. + * + * @param action - Callback function to be called for each + * node. If it returns true, traversal is aborted. + * @returns True if traversal was aborted. + */ + reverseTraversal(action: (k: K, v: V) => void): boolean; + /** + * @returns The minimum node in the tree. + */ + private min_; + /** + * @returns The maximum key in the tree. + */ + minKey(): K; + /** + * @returns The maximum key in the tree. + */ + maxKey(): K; + /** + * @param key - Key to insert. + * @param value - Value to insert. + * @param comparator - Comparator. + * @returns New tree, with the key/value added. + */ + insert(key: K, value: V, comparator: Comparator<K>): LLRBNode<K, V>; + /** + * @returns New tree, with the minimum key removed. + */ + private removeMin_; + /** + * @param key - The key of the item to remove. + * @param comparator - Comparator. + * @returns New tree, with the specified item removed. + */ + remove(key: K, comparator: Comparator<K>): LLRBNode<K, V> | LLRBEmptyNode<K, V>; + /** + * @returns Whether this is a RED node. + */ + isRed_(): boolean; + /** + * @returns New tree after performing any needed rotations. + */ + private fixUp_; + /** + * @returns New tree, after moveRedLeft. + */ + private moveRedLeft_; + /** + * @returns New tree, after moveRedRight. + */ + private moveRedRight_; + /** + * @returns New tree, after rotateLeft. + */ + private rotateLeft_; + /** + * @returns New tree, after rotateRight. + */ + private rotateRight_; + /** + * @returns Newt ree, after colorFlip. + */ + private colorFlip_; + /** + * For testing. + * + * @returns True if all is well. + */ + private checkMaxDepth_; + check_(): number; +} +/** + * Represents an empty node (a leaf node in the Red-Black Tree). + */ +export declare class LLRBEmptyNode<K, V> { + key: K; + value: V; + left: LLRBNode<K, V> | LLRBEmptyNode<K, V>; + right: LLRBNode<K, V> | LLRBEmptyNode<K, V>; + color: boolean; + /** + * Returns a copy of the current node. + * + * @returns The node copy. + */ + copy(key: K | null, value: V | null, color: boolean | null, left: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null, right: LLRBNode<K, V> | LLRBEmptyNode<K, V> | null): LLRBEmptyNode<K, V>; + /** + * Returns a copy of the tree, with the specified key/value added. + * + * @param key - Key to be added. + * @param value - Value to be added. + * @param comparator - Comparator. + * @returns New tree, with item added. + */ + insert(key: K, value: V, comparator: Comparator<K>): LLRBNode<K, V>; + /** + * Returns a copy of the tree, with the specified key removed. + * + * @param key - The key to remove. + * @param comparator - Comparator. + * @returns New tree, with item removed. + */ + remove(key: K, comparator: Comparator<K>): LLRBEmptyNode<K, V>; + /** + * @returns The total number of nodes in the tree. + */ + count(): number; + /** + * @returns True if the tree is empty. + */ + isEmpty(): boolean; + /** + * Traverses the tree in key order and calls the specified action function + * for each node. + * + * @param action - Callback function to be called for each + * node. If it returns true, traversal is aborted. + * @returns True if traversal was aborted. + */ + inorderTraversal(action: (k: K, v: V) => unknown): boolean; + /** + * Traverses the tree in reverse key order and calls the specified action function + * for each node. + * + * @param action - Callback function to be called for each + * node. If it returns true, traversal is aborted. + * @returns True if traversal was aborted. + */ + reverseTraversal(action: (k: K, v: V) => void): boolean; + minKey(): null; + maxKey(): null; + check_(): number; + /** + * @returns Whether this node is red. + */ + isRed_(): boolean; +} +/** + * An immutable sorted map implementation, based on a Left-leaning Red-Black + * tree. + */ +export declare class SortedMap<K, V> { + private comparator_; + private root_; + /** + * Always use the same empty node, to reduce memory. + */ + static EMPTY_NODE: LLRBEmptyNode<unknown, unknown>; + /** + * @param comparator_ - Key comparator. + * @param root_ - Optional root node for the map. + */ + constructor(comparator_: Comparator<K>, root_?: LLRBNode<K, V> | LLRBEmptyNode<K, V>); + /** + * Returns a copy of the map, with the specified key/value added or replaced. + * (TODO: We should perhaps rename this method to 'put') + * + * @param key - Key to be added. + * @param value - Value to be added. + * @returns New map, with item added. + */ + insert(key: K, value: V): SortedMap<K, V>; + /** + * Returns a copy of the map, with the specified key removed. + * + * @param key - The key to remove. + * @returns New map, with item removed. + */ + remove(key: K): SortedMap<K, V>; + /** + * Returns the value of the node with the given key, or null. + * + * @param key - The key to look up. + * @returns The value of the node with the given key, or null if the + * key doesn't exist. + */ + get(key: K): V | null; + /** + * Returns the key of the item *before* the specified key, or null if key is the first item. + * @param key - The key to find the predecessor of + * @returns The predecessor key. + */ + getPredecessorKey(key: K): K | null; + /** + * @returns True if the map is empty. + */ + isEmpty(): boolean; + /** + * @returns The total number of nodes in the map. + */ + count(): number; + /** + * @returns The minimum key in the map. + */ + minKey(): K | null; + /** + * @returns The maximum key in the map. + */ + maxKey(): K | null; + /** + * Traverses the map in key order and calls the specified action function + * for each key/value pair. + * + * @param action - Callback function to be called + * for each key/value pair. If action returns true, traversal is aborted. + * @returns The first truthy value returned by action, or the last falsey + * value returned by action + */ + inorderTraversal(action: (k: K, v: V) => unknown): boolean; + /** + * Traverses the map in reverse key order and calls the specified action function + * for each key/value pair. + * + * @param action - Callback function to be called + * for each key/value pair. If action returns true, traversal is aborted. + * @returns True if the traversal was aborted. + */ + reverseTraversal(action: (k: K, v: V) => void): boolean; + /** + * Returns an iterator over the SortedMap. + * @returns The iterator. + */ + getIterator<T>(resultGenerator?: (k: K, v: V) => T): SortedMapIterator<K, V, T>; + getIteratorFrom<T>(key: K, resultGenerator?: (k: K, v: V) => T): SortedMapIterator<K, V, T>; + getReverseIteratorFrom<T>(key: K, resultGenerator?: (k: K, v: V) => T): SortedMapIterator<K, V, T>; + getReverseIterator<T>(resultGenerator?: (k: K, v: V) => T): SortedMapIterator<K, V, T>; +} diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/Tree.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/Tree.d.ts new file mode 100644 index 0000000..3bcdc27 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/Tree.d.ts @@ -0,0 +1,105 @@ +/** + * @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 './Path'; +/** + * Node in a Tree. + */ +export interface TreeNode<T> { + children: Record<string, TreeNode<T>>; + childCount: number; + value?: T; +} +/** + * A light-weight tree, traversable by path. Nodes can have both values and children. + * Nodes are not enumerated (by forEachChild) unless they have a value or non-empty + * children. + */ +export declare class Tree<T> { + readonly name: string; + readonly parent: Tree<T> | null; + node: TreeNode<T>; + /** + * @param name - Optional name of the node. + * @param parent - Optional parent node. + * @param node - Optional node to wrap. + */ + constructor(name?: string, parent?: Tree<T> | null, node?: TreeNode<T>); +} +/** + * Returns a sub-Tree for the given path. + * + * @param pathObj - Path to look up. + * @returns Tree for path. + */ +export declare function treeSubTree<T>(tree: Tree<T>, pathObj: string | Path): Tree<T>; +/** + * Returns the data associated with this tree node. + * + * @returns The data or null if no data exists. + */ +export declare function treeGetValue<T>(tree: Tree<T>): T | undefined; +/** + * Sets data to this tree node. + * + * @param value - Value to set. + */ +export declare function treeSetValue<T>(tree: Tree<T>, value: T | undefined): void; +/** + * @returns Whether the tree has any children. + */ +export declare function treeHasChildren<T>(tree: Tree<T>): boolean; +/** + * @returns Whether the tree is empty (no value or children). + */ +export declare function treeIsEmpty<T>(tree: Tree<T>): boolean; +/** + * Calls action for each child of this tree node. + * + * @param action - Action to be called for each child. + */ +export declare function treeForEachChild<T>(tree: Tree<T>, action: (tree: Tree<T>) => void): void; +/** + * Does a depth-first traversal of this node's descendants, calling action for each one. + * + * @param action - Action to be called for each child. + * @param includeSelf - Whether to call action on this node as well. Defaults to + * false. + * @param childrenFirst - Whether to call action on children before calling it on + * parent. + */ +export declare function treeForEachDescendant<T>(tree: Tree<T>, action: (tree: Tree<T>) => void, includeSelf?: boolean, childrenFirst?: boolean): void; +/** + * Calls action on each ancestor node. + * + * @param action - Action to be called on each parent; return + * true to abort. + * @param includeSelf - Whether to call action on this node as well. + * @returns true if the action callback returned true. + */ +export declare function treeForEachAncestor<T>(tree: Tree<T>, action: (tree: Tree<T>) => unknown, includeSelf?: boolean): boolean; +/** + * Does a depth-first traversal of this node's descendants. When a descendant with a value + * is found, action is called on it and traversal does not continue inside the node. + * Action is *not* called on this node. + * + * @param action - Action to be called for each child. + */ +export declare function treeForEachImmediateDescendantWithValue<T>(tree: Tree<T>, action: (tree: Tree<T>) => void): void; +/** + * @returns The path of this tree node, as a Path. + */ +export declare function treeGetPath<T>(tree: Tree<T>): any; diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/VisibilityMonitor.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/VisibilityMonitor.d.ts new file mode 100644 index 0000000..e9e306f --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/VisibilityMonitor.d.ts @@ -0,0 +1,23 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { EventEmitter } from './EventEmitter'; +export declare class VisibilityMonitor extends EventEmitter { + private visible_; + static getInstance(): VisibilityMonitor; + constructor(); + getInitialEvent(eventType: string): boolean[]; +} diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/libs/parser.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/libs/parser.d.ts new file mode 100644 index 0000000..9f1d58c --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/libs/parser.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 { RepoInfo } from '../../RepoInfo'; +import { Path } from '../Path'; +export declare const parseRepoInfo: (dataURL: string, nodeAdmin: boolean) => { + repoInfo: RepoInfo; + path: Path; +}; +export declare const parseDatabaseURL: (dataURL: string) => { + host: string; + port: number; + domain: string; + subdomain: string; + secure: boolean; + scheme: string; + pathString: string; + namespace: string; +}; diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/misc.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/misc.d.ts new file mode 100644 index 0000000..abfa94c --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/misc.d.ts @@ -0,0 +1,19 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export interface Indexable { + [key: string]: unknown; +} diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/util.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/util.d.ts new file mode 100644 index 0000000..35c32d8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/util.d.ts @@ -0,0 +1,176 @@ +/** + * @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 { QueryContext } from '../view/EventRegistration'; +/** + * Returns a locally-unique ID (generated by just incrementing up from 0 each time its called). + */ +export declare const LUIDGenerator: () => number; +/** + * Sha1 hash of the input string + * @param str - The string to hash + * @returns {!string} The resulting hash + */ +export declare const sha1: (str: string) => string; +/** + * Use this for all debug messages in Firebase. + */ +export declare let logger: ((a: string) => void) | null; +/** + * The implementation of Firebase.enableLogging (defined here to break dependencies) + * @param logger_ - A flag to turn on logging, or a custom logger + * @param persistent - Whether or not to persist logging settings across refreshes + */ +export declare const enableLogging: (logger_?: boolean | ((a: string) => void) | null, persistent?: boolean) => void; +export declare const log: (...varArgs: unknown[]) => void; +export declare const logWrapper: (prefix: string) => (...varArgs: unknown[]) => void; +export declare const error: (...varArgs: string[]) => void; +export declare const fatal: (...varArgs: string[]) => never; +export declare const warn: (...varArgs: unknown[]) => void; +/** + * Logs a warning if the containing page uses https. Called when a call to new Firebase + * does not use https. + */ +export declare const warnIfPageIsSecure: () => void; +export declare const warnAboutUnsupportedMethod: (methodName: string) => void; +/** + * Returns true if data is NaN, or +/- Infinity. + */ +export declare const isInvalidJSONNumber: (data: unknown) => boolean; +export declare const executeWhenDOMReady: (fn: () => void) => void; +/** + * Minimum key name. Invalid for actual data, used as a marker to sort before any valid names + */ +export declare const MIN_NAME = "[MIN_NAME]"; +/** + * Maximum key name. Invalid for actual data, used as a marker to sort above any valid names + */ +export declare const MAX_NAME = "[MAX_NAME]"; +/** + * Compares valid Firebase key names, plus min and max name + */ +export declare const nameCompare: (a: string, b: string) => number; +/** + * @returns {!number} comparison result. + */ +export declare const stringCompare: (a: string, b: string) => number; +export declare const requireKey: (key: string, obj: { + [k: string]: unknown; +}) => unknown; +export declare const ObjectToUniqueKey: (obj: unknown) => string; +/** + * Splits a string into a number of smaller segments of maximum size + * @param str - The string + * @param segsize - The maximum number of chars in the string. + * @returns The string, split into appropriately-sized chunks + */ +export declare const splitStringBySize: (str: string, segsize: number) => string[]; +/** + * Apply a function to each (key, value) pair in an object or + * apply a function to each (index, value) pair in an array + * @param obj - The object or array to iterate over + * @param fn - The function to apply + */ +export declare function each(obj: object, fn: (k: string, v: unknown) => void): void; +/** + * Like goog.bind, but doesn't bother to create a closure if opt_context is null/undefined. + * @param callback - Callback function. + * @param context - Optional context to bind to. + * + */ +export declare const bindCallback: (callback: (a: unknown) => void, context?: object | null) => (a: unknown) => void; +/** + * Borrowed from http://hg.secondlife.com/llsd/src/tip/js/typedarray.js (MIT License) + * I made one modification at the end and removed the NaN / Infinity + * handling (since it seemed broken [caused an overflow] and we don't need it). See MJL comments. + * @param v - A double + * + */ +export declare const doubleToIEEE754String: (v: number) => string; +/** + * Used to detect if we're in a Chrome content script (which executes in an + * isolated environment where long-polling doesn't work). + */ +export declare const isChromeExtensionContentScript: () => boolean; +/** + * Used to detect if we're in a Windows 8 Store app. + */ +export declare const isWindowsStoreApp: () => boolean; +/** + * Converts a server error code to a JavaScript Error + */ +export declare function errorForServerCode(code: string, query: QueryContext): Error; +/** + * Used to test for integer-looking strings + */ +export declare const INTEGER_REGEXP_: RegExp; +/** + * For use in keys, the minimum possible 32-bit integer. + */ +export declare const INTEGER_32_MIN = -2147483648; +/** + * For use in keys, the maximum possible 32-bit integer. + */ +export declare const INTEGER_32_MAX = 2147483647; +/** + * If the string contains a 32-bit integer, return it. Else return null. + */ +export declare const tryParseInt: (str: string) => number | null; +/** + * Helper to run some code but catch any exceptions and re-throw them later. + * Useful for preventing user callbacks from breaking internal code. + * + * Re-throwing the exception from a setTimeout is a little evil, but it's very + * convenient (we don't have to try to figure out when is a safe point to + * re-throw it), and the behavior seems reasonable: + * + * * If you aren't pausing on exceptions, you get an error in the console with + * the correct stack trace. + * * If you're pausing on all exceptions, the debugger will pause on your + * exception and then again when we rethrow it. + * * If you're only pausing on uncaught exceptions, the debugger will only pause + * on us re-throwing it. + * + * @param fn - The code to guard. + */ +export declare const exceptionGuard: (fn: () => void) => void; +/** + * Helper function to safely call opt_callback with the specified arguments. It: + * 1. Turns into a no-op if opt_callback is null or undefined. + * 2. Wraps the call inside exceptionGuard to prevent exceptions from breaking our state. + * + * @param callback - Optional onComplete callback. + * @param varArgs - Arbitrary args to be passed to opt_onComplete + */ +export declare const callUserCallback: (callback?: Function | null, ...varArgs: unknown[]) => void; +/** + * @returns {boolean} true if we think we're currently being crawled. + */ +export declare const beingCrawled: () => boolean; +/** + * Export a property of an object using a getter function. + */ +export declare const exportPropGetter: (object: object, name: string, fnGet: () => unknown) => void; +/** + * Same as setTimeout() except on Node.JS it will /not/ prevent the process from exiting. + * + * It is removed with clearTimeout() as normal. + * + * @param fn - Function to run. + * @param time - Milliseconds to wait before running. + * @returns The setTimeout() return value. + */ +export declare const setTimeoutNonBlocking: (fn: () => void, time: number) => number | object; diff --git a/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/validation.d.ts b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/validation.d.ts new file mode 100644 index 0000000..dc216b8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/database/dist/node-esm/src/core/util/validation.d.ts @@ -0,0 +1,70 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { RepoInfo } from '../RepoInfo'; +import { Path, ValidationPath } from './Path'; +/** + * True for invalid Firebase keys + */ +export declare const INVALID_KEY_REGEX_: RegExp; +/** + * True for invalid Firebase paths. + * Allows '/' in paths. + */ +export declare const INVALID_PATH_REGEX_: RegExp; +/** + * Maximum number of characters to allow in leaf value + */ +export declare const MAX_LEAF_SIZE_: number; +export declare const isValidKey: (key: unknown) => boolean; +export declare const isValidPathString: (pathString: string) => boolean; +export declare const isValidRootPathString: (pathString: string) => boolean; +export declare const isValidPriority: (priority: unknown) => boolean; +/** + * Pre-validate a datum passed as an argument to Firebase function. + */ +export declare const validateFirebaseDataArg: (fnName: string, value: unknown, path: Path, optional: boolean) => void; +/** + * Validate a data object client-side before sending to server. + */ +export declare const validateFirebaseData: (errorPrefix: string, data: unknown, path_: Path | ValidationPath) => void; +/** + * Pre-validate paths passed in the firebase function. + */ +export declare const validateFirebaseMergePaths: (errorPrefix: string, mergePaths: Path[]) => void; +/** + * pre-validate an object passed as an argument to firebase function ( + * must be an object - e.g. for firebase.update()). + */ +export declare const validateFirebaseMergeDataArg: (fnName: string, data: unknown, path: Path, optional: boolean) => void; +export declare const validatePriority: (fnName: string, priority: unknown, optional: boolean) => void; +export declare const validateKey: (fnName: string, argumentName: string, key: string, optional: boolean) => void; +/** + * @internal + */ +export declare const validatePathString: (fnName: string, argumentName: string, pathString: string, optional: boolean) => void; +export declare const validateRootPathString: (fnName: string, argumentName: string, pathString: string, optional: boolean) => void; +/** + * @internal + */ +export declare const validateWritablePath: (fnName: string, path: Path) => void; +export declare const validateUrl: (fnName: string, parsedUrl: { + repoInfo: RepoInfo; + path: Path; +}) => void; +export declare const validateString: (fnName: string, argumentName: string, string: unknown, optional: boolean) => void; +export declare const validateObject: (fnName: string, argumentName: string, obj: unknown, optional: boolean) => void; +export declare const validateObjectContainsKey: (fnName: string, argumentName: string, obj: unknown, key: string, optional: boolean, optType?: string) => void; |
