@firebase/database 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +13834 -13834
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +13834 -13834
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +13849 -13849
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.standalone.js +13797 -13797
- package/dist/index.standalone.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +13849 -13849
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/api/Database.d.ts +137 -137
- package/dist/node-esm/src/api/OnDisconnect.d.ts +110 -110
- package/dist/node-esm/src/api/Reference.d.ts +122 -122
- package/dist/node-esm/src/api/Reference_impl.d.ts +1098 -1098
- package/dist/node-esm/src/api/ServerValue.d.ts +30 -30
- package/dist/node-esm/src/api/Transaction.d.ts +83 -83
- package/dist/node-esm/src/api/test_access.d.ts +31 -31
- package/dist/node-esm/src/api.d.ts +18 -18
- package/dist/node-esm/src/api.standalone.d.ts +30 -30
- package/dist/node-esm/src/core/AppCheckTokenProvider.d.ts +30 -30
- package/dist/node-esm/src/core/AuthTokenProvider.d.ts +49 -49
- package/dist/node-esm/src/core/CompoundWrite.d.ts +81 -81
- package/dist/node-esm/src/core/PersistentConnection.d.ts +135 -135
- package/dist/node-esm/src/core/ReadonlyRestClient.d.ts +60 -60
- package/dist/node-esm/src/core/Repo.d.ts +144 -144
- package/dist/node-esm/src/core/RepoInfo.d.ts +56 -56
- package/dist/node-esm/src/core/ServerActions.d.ts +52 -52
- package/dist/node-esm/src/core/SnapshotHolder.d.ts +26 -26
- package/dist/node-esm/src/core/SparseSnapshotTree.d.ts +64 -64
- package/dist/node-esm/src/core/SyncPoint.d.ts +91 -91
- package/dist/node-esm/src/core/SyncTree.d.ts +166 -166
- package/dist/node-esm/src/core/WriteTree.d.ts +205 -205
- package/dist/node-esm/src/core/operation/AckUserWrite.d.ts +36 -36
- package/dist/node-esm/src/core/operation/ListenComplete.d.ts +26 -26
- package/dist/node-esm/src/core/operation/Merge.d.ts +33 -33
- package/dist/node-esm/src/core/operation/Operation.d.ts +45 -45
- package/dist/node-esm/src/core/operation/Overwrite.d.ts +28 -28
- package/dist/node-esm/src/core/snap/ChildrenNode.d.ts +112 -112
- package/dist/node-esm/src/core/snap/IndexMap.d.ts +43 -43
- package/dist/node-esm/src/core/snap/LeafNode.d.ts +83 -83
- package/dist/node-esm/src/core/snap/Node.d.ts +126 -126
- package/dist/node-esm/src/core/snap/childSet.d.ts +32 -32
- package/dist/node-esm/src/core/snap/comparators.d.ts +19 -19
- package/dist/node-esm/src/core/snap/indexes/Index.d.ts +50 -50
- package/dist/node-esm/src/core/snap/indexes/KeyIndex.d.ts +34 -34
- package/dist/node-esm/src/core/snap/indexes/PathIndex.d.ts +29 -29
- package/dist/node-esm/src/core/snap/indexes/PriorityIndex.d.ts +33 -33
- package/dist/node-esm/src/core/snap/indexes/ValueIndex.d.ts +31 -31
- package/dist/node-esm/src/core/snap/nodeFromJSON.d.ts +24 -24
- package/dist/node-esm/src/core/snap/snap.d.ts +23 -23
- package/dist/node-esm/src/core/stats/StatsCollection.d.ts +26 -26
- package/dist/node-esm/src/core/stats/StatsListener.d.ts +30 -30
- package/dist/node-esm/src/core/stats/StatsManager.d.ts +20 -20
- package/dist/node-esm/src/core/stats/StatsReporter.d.ts +28 -28
- package/dist/node-esm/src/core/storage/DOMStorageWrapper.d.ts +46 -46
- package/dist/node-esm/src/core/storage/MemoryStorage.d.ts +27 -27
- package/dist/node-esm/src/core/storage/storage.d.ts +22 -22
- package/dist/node-esm/src/core/util/EventEmitter.d.ts +39 -39
- package/dist/node-esm/src/core/util/ImmutableTree.d.ts +117 -117
- package/dist/node-esm/src/core/util/NextPushId.d.ts +33 -33
- package/dist/node-esm/src/core/util/OnlineMonitor.d.ts +31 -31
- package/dist/node-esm/src/core/util/Path.d.ts +94 -94
- package/dist/node-esm/src/core/util/ServerValues.d.ts +56 -56
- package/dist/node-esm/src/core/util/SortedMap.d.ts +324 -324
- package/dist/node-esm/src/core/util/Tree.d.ts +105 -105
- package/dist/node-esm/src/core/util/VisibilityMonitor.d.ts +23 -23
- package/dist/node-esm/src/core/util/libs/parser.d.ts +32 -32
- package/dist/node-esm/src/core/util/misc.d.ts +19 -19
- package/dist/node-esm/src/core/util/util.d.ts +176 -176
- package/dist/node-esm/src/core/util/validation.d.ts +70 -70
- package/dist/node-esm/src/core/version.d.ts +23 -23
- package/dist/node-esm/src/core/view/CacheNode.d.ts +41 -41
- package/dist/node-esm/src/core/view/Change.d.ts +46 -46
- package/dist/node-esm/src/core/view/ChildChangeAccumulator.d.ts +22 -22
- package/dist/node-esm/src/core/view/CompleteChildSource.d.ts +55 -55
- package/dist/node-esm/src/core/view/Event.d.ts +64 -64
- package/dist/node-esm/src/core/view/EventGenerator.d.ts +42 -42
- package/dist/node-esm/src/core/view/EventQueue.d.ts +67 -67
- package/dist/node-esm/src/core/view/EventRegistration.d.ts +87 -87
- package/dist/node-esm/src/core/view/QueryParams.d.ts +95 -95
- package/dist/node-esm/src/core/view/View.d.ts +59 -59
- package/dist/node-esm/src/core/view/ViewCache.d.ts +32 -32
- package/dist/node-esm/src/core/view/ViewProcessor.d.ts +32 -32
- package/dist/node-esm/src/core/view/filter/IndexedFilter.d.ts +35 -35
- package/dist/node-esm/src/core/view/filter/LimitedFilter.d.ts +47 -47
- package/dist/node-esm/src/core/view/filter/NodeFilter.d.ts +54 -54
- package/dist/node-esm/src/core/view/filter/RangedFilter.d.ts +47 -47
- package/dist/node-esm/src/index.d.ts +28 -28
- package/dist/node-esm/src/index.node.d.ts +17 -17
- package/dist/node-esm/src/index.standalone.d.ts +17 -17
- package/dist/node-esm/src/internal/index.d.ts +38 -38
- package/dist/node-esm/src/realtime/BrowserPollConnection.d.ts +198 -198
- package/dist/node-esm/src/realtime/Connection.d.ts +102 -102
- package/dist/node-esm/src/realtime/Constants.d.ts +27 -27
- package/dist/node-esm/src/realtime/Transport.d.ts +58 -58
- package/dist/node-esm/src/realtime/TransportManager.d.ts +50 -50
- package/dist/node-esm/src/realtime/WebSocketConnection.d.ts +127 -127
- package/dist/node-esm/src/realtime/polling/PacketReceiver.d.ts +38 -38
- package/dist/node-esm/src/register.d.ts +1 -1
- package/dist/node-esm/test/compound_write.test.d.ts +17 -17
- package/dist/node-esm/test/connection.test.d.ts +17 -17
- package/dist/node-esm/test/deno.test.d.ts +17 -17
- package/dist/node-esm/test/exp/integration.test.d.ts +17 -17
- package/dist/node-esm/test/helpers/EventAccumulator.d.ts +35 -35
- package/dist/node-esm/test/helpers/syncpoint-util.d.ts +29 -29
- package/dist/node-esm/test/helpers/util.d.ts +34 -34
- package/dist/node-esm/test/node.test.d.ts +17 -17
- package/dist/node-esm/test/parser.test.d.ts +17 -17
- package/dist/node-esm/test/path.test.d.ts +17 -17
- package/dist/node-esm/test/pushid.test.d.ts +17 -17
- package/dist/node-esm/test/queryconstraint.test.d.ts +17 -17
- package/dist/node-esm/test/repoinfo.test.d.ts +17 -17
- package/dist/node-esm/test/sortedmap.test.d.ts +17 -17
- package/dist/node-esm/test/sparsesnapshottree.test.d.ts +17 -17
- package/dist/node-esm/test/syncpoint.test.d.ts +17 -17
- package/dist/node-esm/test/transport.test.d.ts +17 -17
- package/dist/node-esm/test/websocketconnection.test.d.ts +17 -17
- package/dist/src/api/Database.d.ts +137 -137
- package/dist/src/api/OnDisconnect.d.ts +110 -110
- package/dist/src/api/Reference.d.ts +122 -122
- package/dist/src/api/Reference_impl.d.ts +1098 -1098
- package/dist/src/api/ServerValue.d.ts +30 -30
- package/dist/src/api/Transaction.d.ts +83 -83
- package/dist/src/api/test_access.d.ts +31 -31
- package/dist/src/api.d.ts +18 -18
- package/dist/src/api.standalone.d.ts +30 -30
- package/dist/src/core/AppCheckTokenProvider.d.ts +30 -30
- package/dist/src/core/AuthTokenProvider.d.ts +49 -49
- package/dist/src/core/CompoundWrite.d.ts +81 -81
- package/dist/src/core/PersistentConnection.d.ts +135 -135
- package/dist/src/core/ReadonlyRestClient.d.ts +60 -60
- package/dist/src/core/Repo.d.ts +144 -144
- package/dist/src/core/RepoInfo.d.ts +56 -56
- package/dist/src/core/ServerActions.d.ts +52 -52
- package/dist/src/core/SnapshotHolder.d.ts +26 -26
- package/dist/src/core/SparseSnapshotTree.d.ts +64 -64
- package/dist/src/core/SyncPoint.d.ts +91 -91
- package/dist/src/core/SyncTree.d.ts +166 -166
- package/dist/src/core/WriteTree.d.ts +205 -205
- package/dist/src/core/operation/AckUserWrite.d.ts +36 -36
- package/dist/src/core/operation/ListenComplete.d.ts +26 -26
- package/dist/src/core/operation/Merge.d.ts +33 -33
- package/dist/src/core/operation/Operation.d.ts +45 -45
- package/dist/src/core/operation/Overwrite.d.ts +28 -28
- package/dist/src/core/snap/ChildrenNode.d.ts +112 -112
- package/dist/src/core/snap/IndexMap.d.ts +43 -43
- package/dist/src/core/snap/LeafNode.d.ts +83 -83
- package/dist/src/core/snap/Node.d.ts +126 -126
- package/dist/src/core/snap/childSet.d.ts +32 -32
- package/dist/src/core/snap/comparators.d.ts +19 -19
- package/dist/src/core/snap/indexes/Index.d.ts +50 -50
- package/dist/src/core/snap/indexes/KeyIndex.d.ts +34 -34
- package/dist/src/core/snap/indexes/PathIndex.d.ts +29 -29
- package/dist/src/core/snap/indexes/PriorityIndex.d.ts +33 -33
- package/dist/src/core/snap/indexes/ValueIndex.d.ts +31 -31
- package/dist/src/core/snap/nodeFromJSON.d.ts +24 -24
- package/dist/src/core/snap/snap.d.ts +23 -23
- package/dist/src/core/stats/StatsCollection.d.ts +26 -26
- package/dist/src/core/stats/StatsListener.d.ts +30 -30
- package/dist/src/core/stats/StatsManager.d.ts +20 -20
- package/dist/src/core/stats/StatsReporter.d.ts +28 -28
- package/dist/src/core/storage/DOMStorageWrapper.d.ts +46 -46
- package/dist/src/core/storage/MemoryStorage.d.ts +27 -27
- package/dist/src/core/storage/storage.d.ts +22 -22
- package/dist/src/core/util/EventEmitter.d.ts +39 -39
- package/dist/src/core/util/ImmutableTree.d.ts +117 -117
- package/dist/src/core/util/NextPushId.d.ts +33 -33
- package/dist/src/core/util/OnlineMonitor.d.ts +31 -31
- package/dist/src/core/util/Path.d.ts +94 -94
- package/dist/src/core/util/ServerValues.d.ts +56 -56
- package/dist/src/core/util/SortedMap.d.ts +324 -324
- package/dist/src/core/util/Tree.d.ts +105 -105
- package/dist/src/core/util/VisibilityMonitor.d.ts +23 -23
- package/dist/src/core/util/libs/parser.d.ts +32 -32
- package/dist/src/core/util/misc.d.ts +19 -19
- package/dist/src/core/util/util.d.ts +176 -176
- package/dist/src/core/util/validation.d.ts +70 -70
- package/dist/src/core/version.d.ts +23 -23
- package/dist/src/core/view/CacheNode.d.ts +41 -41
- package/dist/src/core/view/Change.d.ts +46 -46
- package/dist/src/core/view/ChildChangeAccumulator.d.ts +22 -22
- package/dist/src/core/view/CompleteChildSource.d.ts +55 -55
- package/dist/src/core/view/Event.d.ts +64 -64
- package/dist/src/core/view/EventGenerator.d.ts +42 -42
- package/dist/src/core/view/EventQueue.d.ts +67 -67
- package/dist/src/core/view/EventRegistration.d.ts +87 -87
- package/dist/src/core/view/QueryParams.d.ts +95 -95
- package/dist/src/core/view/View.d.ts +59 -59
- package/dist/src/core/view/ViewCache.d.ts +32 -32
- package/dist/src/core/view/ViewProcessor.d.ts +32 -32
- package/dist/src/core/view/filter/IndexedFilter.d.ts +35 -35
- package/dist/src/core/view/filter/LimitedFilter.d.ts +47 -47
- package/dist/src/core/view/filter/NodeFilter.d.ts +54 -54
- package/dist/src/core/view/filter/RangedFilter.d.ts +47 -47
- package/dist/src/index.d.ts +28 -28
- package/dist/src/index.node.d.ts +17 -17
- package/dist/src/index.standalone.d.ts +17 -17
- package/dist/src/internal/index.d.ts +38 -38
- package/dist/src/realtime/BrowserPollConnection.d.ts +198 -198
- package/dist/src/realtime/Connection.d.ts +102 -102
- package/dist/src/realtime/Constants.d.ts +27 -27
- package/dist/src/realtime/Transport.d.ts +58 -58
- package/dist/src/realtime/TransportManager.d.ts +50 -50
- package/dist/src/realtime/WebSocketConnection.d.ts +127 -127
- package/dist/src/realtime/polling/PacketReceiver.d.ts +38 -38
- package/dist/src/register.d.ts +1 -1
- package/dist/test/compound_write.test.d.ts +17 -17
- package/dist/test/connection.test.d.ts +17 -17
- package/dist/test/deno.test.d.ts +17 -17
- package/dist/test/exp/integration.test.d.ts +17 -17
- package/dist/test/helpers/EventAccumulator.d.ts +35 -35
- package/dist/test/helpers/syncpoint-util.d.ts +29 -29
- package/dist/test/helpers/util.d.ts +34 -34
- package/dist/test/node.test.d.ts +17 -17
- package/dist/test/parser.test.d.ts +17 -17
- package/dist/test/path.test.d.ts +17 -17
- package/dist/test/pushid.test.d.ts +17 -17
- package/dist/test/queryconstraint.test.d.ts +17 -17
- package/dist/test/repoinfo.test.d.ts +17 -17
- package/dist/test/sortedmap.test.d.ts +17 -17
- package/dist/test/sparsesnapshottree.test.d.ts +17 -17
- package/dist/test/syncpoint.test.d.ts +17 -17
- package/dist/test/transport.test.d.ts +17 -17
- package/dist/test/websocketconnection.test.d.ts +17 -17
- package/package.json +8 -8
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { Path } from './Path';
|
|
18
|
-
import { SortedMap } from './SortedMap';
|
|
19
|
-
/**
|
|
20
|
-
* A tree with immutable elements.
|
|
21
|
-
*/
|
|
22
|
-
export declare class ImmutableTree<T> {
|
|
23
|
-
readonly value: T | null;
|
|
24
|
-
readonly children: SortedMap<string, ImmutableTree<T>>;
|
|
25
|
-
static fromObject<T>(obj: {
|
|
26
|
-
[k: string]: T;
|
|
27
|
-
}): ImmutableTree<T>;
|
|
28
|
-
constructor(value: T | null, children?: SortedMap<string, ImmutableTree<T>>);
|
|
29
|
-
/**
|
|
30
|
-
* True if the value is empty and there are no children
|
|
31
|
-
*/
|
|
32
|
-
isEmpty(): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Given a path and predicate, return the first node and the path to that node
|
|
35
|
-
* where the predicate returns true.
|
|
36
|
-
*
|
|
37
|
-
* TODO Do a perf test -- If we're creating a bunch of `{path: value:}`
|
|
38
|
-
* objects on the way back out, it may be better to pass down a pathSoFar obj.
|
|
39
|
-
*
|
|
40
|
-
* @param relativePath - The remainder of the path
|
|
41
|
-
* @param predicate - The predicate to satisfy to return a node
|
|
42
|
-
*/
|
|
43
|
-
findRootMostMatchingPathAndValue(relativePath: Path, predicate: (a: T) => boolean): {
|
|
44
|
-
path: Path;
|
|
45
|
-
value: T;
|
|
46
|
-
} | null;
|
|
47
|
-
/**
|
|
48
|
-
* Find, if it exists, the shortest subpath of the given path that points a defined
|
|
49
|
-
* value in the tree
|
|
50
|
-
*/
|
|
51
|
-
findRootMostValueAndPath(relativePath: Path): {
|
|
52
|
-
path: Path;
|
|
53
|
-
value: T;
|
|
54
|
-
} | null;
|
|
55
|
-
/**
|
|
56
|
-
* @returns The subtree at the given path
|
|
57
|
-
*/
|
|
58
|
-
subtree(relativePath: Path): ImmutableTree<T>;
|
|
59
|
-
/**
|
|
60
|
-
* Sets a value at the specified path.
|
|
61
|
-
*
|
|
62
|
-
* @param relativePath - Path to set value at.
|
|
63
|
-
* @param toSet - Value to set.
|
|
64
|
-
* @returns Resulting tree.
|
|
65
|
-
*/
|
|
66
|
-
set(relativePath: Path, toSet: T | null): ImmutableTree<T>;
|
|
67
|
-
/**
|
|
68
|
-
* Removes the value at the specified path.
|
|
69
|
-
*
|
|
70
|
-
* @param relativePath - Path to value to remove.
|
|
71
|
-
* @returns Resulting tree.
|
|
72
|
-
*/
|
|
73
|
-
remove(relativePath: Path): ImmutableTree<T>;
|
|
74
|
-
/**
|
|
75
|
-
* Gets a value from the tree.
|
|
76
|
-
*
|
|
77
|
-
* @param relativePath - Path to get value for.
|
|
78
|
-
* @returns Value at path, or null.
|
|
79
|
-
*/
|
|
80
|
-
get(relativePath: Path): T | null;
|
|
81
|
-
/**
|
|
82
|
-
* Replace the subtree at the specified path with the given new tree.
|
|
83
|
-
*
|
|
84
|
-
* @param relativePath - Path to replace subtree for.
|
|
85
|
-
* @param newTree - New tree.
|
|
86
|
-
* @returns Resulting tree.
|
|
87
|
-
*/
|
|
88
|
-
setTree(relativePath: Path, newTree: ImmutableTree<T>): ImmutableTree<T>;
|
|
89
|
-
/**
|
|
90
|
-
* Performs a depth first fold on this tree. Transforms a tree into a single
|
|
91
|
-
* value, given a function that operates on the path to a node, an optional
|
|
92
|
-
* current value, and a map of child names to folded subtrees
|
|
93
|
-
*/
|
|
94
|
-
fold<V>(fn: (path: Path, value: T, children: {
|
|
95
|
-
[k: string]: V;
|
|
96
|
-
}) => V): V;
|
|
97
|
-
/**
|
|
98
|
-
* Recursive helper for public-facing fold() method
|
|
99
|
-
*/
|
|
100
|
-
private fold_;
|
|
101
|
-
/**
|
|
102
|
-
* Find the first matching value on the given path. Return the result of applying f to it.
|
|
103
|
-
*/
|
|
104
|
-
findOnPath<V>(path: Path, f: (path: Path, value: T) => V | null): V | null;
|
|
105
|
-
private findOnPath_;
|
|
106
|
-
foreachOnPath(path: Path, f: (path: Path, value: T) => void): ImmutableTree<T>;
|
|
107
|
-
private foreachOnPath_;
|
|
108
|
-
/**
|
|
109
|
-
* Calls the given function for each node in the tree that has a value.
|
|
110
|
-
*
|
|
111
|
-
* @param f - A function to be called with the path from the root of the tree to
|
|
112
|
-
* a node, and the value at that node. Called in depth-first order.
|
|
113
|
-
*/
|
|
114
|
-
foreach(f: (path: Path, value: T) => void): void;
|
|
115
|
-
private foreach_;
|
|
116
|
-
foreachChild(f: (name: string, value: T) => void): void;
|
|
117
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { Path } from './Path';
|
|
18
|
+
import { SortedMap } from './SortedMap';
|
|
19
|
+
/**
|
|
20
|
+
* A tree with immutable elements.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ImmutableTree<T> {
|
|
23
|
+
readonly value: T | null;
|
|
24
|
+
readonly children: SortedMap<string, ImmutableTree<T>>;
|
|
25
|
+
static fromObject<T>(obj: {
|
|
26
|
+
[k: string]: T;
|
|
27
|
+
}): ImmutableTree<T>;
|
|
28
|
+
constructor(value: T | null, children?: SortedMap<string, ImmutableTree<T>>);
|
|
29
|
+
/**
|
|
30
|
+
* True if the value is empty and there are no children
|
|
31
|
+
*/
|
|
32
|
+
isEmpty(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Given a path and predicate, return the first node and the path to that node
|
|
35
|
+
* where the predicate returns true.
|
|
36
|
+
*
|
|
37
|
+
* TODO Do a perf test -- If we're creating a bunch of `{path: value:}`
|
|
38
|
+
* objects on the way back out, it may be better to pass down a pathSoFar obj.
|
|
39
|
+
*
|
|
40
|
+
* @param relativePath - The remainder of the path
|
|
41
|
+
* @param predicate - The predicate to satisfy to return a node
|
|
42
|
+
*/
|
|
43
|
+
findRootMostMatchingPathAndValue(relativePath: Path, predicate: (a: T) => boolean): {
|
|
44
|
+
path: Path;
|
|
45
|
+
value: T;
|
|
46
|
+
} | null;
|
|
47
|
+
/**
|
|
48
|
+
* Find, if it exists, the shortest subpath of the given path that points a defined
|
|
49
|
+
* value in the tree
|
|
50
|
+
*/
|
|
51
|
+
findRootMostValueAndPath(relativePath: Path): {
|
|
52
|
+
path: Path;
|
|
53
|
+
value: T;
|
|
54
|
+
} | null;
|
|
55
|
+
/**
|
|
56
|
+
* @returns The subtree at the given path
|
|
57
|
+
*/
|
|
58
|
+
subtree(relativePath: Path): ImmutableTree<T>;
|
|
59
|
+
/**
|
|
60
|
+
* Sets a value at the specified path.
|
|
61
|
+
*
|
|
62
|
+
* @param relativePath - Path to set value at.
|
|
63
|
+
* @param toSet - Value to set.
|
|
64
|
+
* @returns Resulting tree.
|
|
65
|
+
*/
|
|
66
|
+
set(relativePath: Path, toSet: T | null): ImmutableTree<T>;
|
|
67
|
+
/**
|
|
68
|
+
* Removes the value at the specified path.
|
|
69
|
+
*
|
|
70
|
+
* @param relativePath - Path to value to remove.
|
|
71
|
+
* @returns Resulting tree.
|
|
72
|
+
*/
|
|
73
|
+
remove(relativePath: Path): ImmutableTree<T>;
|
|
74
|
+
/**
|
|
75
|
+
* Gets a value from the tree.
|
|
76
|
+
*
|
|
77
|
+
* @param relativePath - Path to get value for.
|
|
78
|
+
* @returns Value at path, or null.
|
|
79
|
+
*/
|
|
80
|
+
get(relativePath: Path): T | null;
|
|
81
|
+
/**
|
|
82
|
+
* Replace the subtree at the specified path with the given new tree.
|
|
83
|
+
*
|
|
84
|
+
* @param relativePath - Path to replace subtree for.
|
|
85
|
+
* @param newTree - New tree.
|
|
86
|
+
* @returns Resulting tree.
|
|
87
|
+
*/
|
|
88
|
+
setTree(relativePath: Path, newTree: ImmutableTree<T>): ImmutableTree<T>;
|
|
89
|
+
/**
|
|
90
|
+
* Performs a depth first fold on this tree. Transforms a tree into a single
|
|
91
|
+
* value, given a function that operates on the path to a node, an optional
|
|
92
|
+
* current value, and a map of child names to folded subtrees
|
|
93
|
+
*/
|
|
94
|
+
fold<V>(fn: (path: Path, value: T, children: {
|
|
95
|
+
[k: string]: V;
|
|
96
|
+
}) => V): V;
|
|
97
|
+
/**
|
|
98
|
+
* Recursive helper for public-facing fold() method
|
|
99
|
+
*/
|
|
100
|
+
private fold_;
|
|
101
|
+
/**
|
|
102
|
+
* Find the first matching value on the given path. Return the result of applying f to it.
|
|
103
|
+
*/
|
|
104
|
+
findOnPath<V>(path: Path, f: (path: Path, value: T) => V | null): V | null;
|
|
105
|
+
private findOnPath_;
|
|
106
|
+
foreachOnPath(path: Path, f: (path: Path, value: T) => void): ImmutableTree<T>;
|
|
107
|
+
private foreachOnPath_;
|
|
108
|
+
/**
|
|
109
|
+
* Calls the given function for each node in the tree that has a value.
|
|
110
|
+
*
|
|
111
|
+
* @param f - A function to be called with the path from the root of the tree to
|
|
112
|
+
* a node, and the value at that node. Called in depth-first order.
|
|
113
|
+
*/
|
|
114
|
+
foreach(f: (path: Path, value: T) => void): void;
|
|
115
|
+
private foreach_;
|
|
116
|
+
foreachChild(f: (name: string, value: T) => void): void;
|
|
117
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Fancy ID generator that creates 20-character string identifiers with the
|
|
19
|
-
* following properties:
|
|
20
|
-
*
|
|
21
|
-
* 1. They're based on timestamp so that they sort *after* any existing ids.
|
|
22
|
-
* 2. They contain 72-bits of random data after the timestamp so that IDs won't
|
|
23
|
-
* collide with other clients' IDs.
|
|
24
|
-
* 3. They sort *lexicographically* (so the timestamp is converted to characters
|
|
25
|
-
* that will sort properly).
|
|
26
|
-
* 4. They're monotonically increasing. Even if you generate more than one in
|
|
27
|
-
* the same timestamp, the latter ones will sort after the former ones. We do
|
|
28
|
-
* this by using the previous random bits but "incrementing" them by 1 (only
|
|
29
|
-
* in the case of a timestamp collision).
|
|
30
|
-
*/
|
|
31
|
-
export declare const nextPushId: (now: number) => string;
|
|
32
|
-
export declare const successor: (key: string) => string;
|
|
33
|
-
export declare const predecessor: (key: string) => string;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Fancy ID generator that creates 20-character string identifiers with the
|
|
19
|
+
* following properties:
|
|
20
|
+
*
|
|
21
|
+
* 1. They're based on timestamp so that they sort *after* any existing ids.
|
|
22
|
+
* 2. They contain 72-bits of random data after the timestamp so that IDs won't
|
|
23
|
+
* collide with other clients' IDs.
|
|
24
|
+
* 3. They sort *lexicographically* (so the timestamp is converted to characters
|
|
25
|
+
* that will sort properly).
|
|
26
|
+
* 4. They're monotonically increasing. Even if you generate more than one in
|
|
27
|
+
* the same timestamp, the latter ones will sort after the former ones. We do
|
|
28
|
+
* this by using the previous random bits but "incrementing" them by 1 (only
|
|
29
|
+
* in the case of a timestamp collision).
|
|
30
|
+
*/
|
|
31
|
+
export declare const nextPushId: (now: number) => string;
|
|
32
|
+
export declare const successor: (key: string) => string;
|
|
33
|
+
export declare const predecessor: (key: string) => string;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { EventEmitter } from './EventEmitter';
|
|
18
|
-
/**
|
|
19
|
-
* Monitors online state (as reported by window.online/offline events).
|
|
20
|
-
*
|
|
21
|
-
* The expectation is that this could have many false positives (thinks we are online
|
|
22
|
-
* when we're not), but no false negatives. So we can safely use it to determine when
|
|
23
|
-
* we definitely cannot reach the internet.
|
|
24
|
-
*/
|
|
25
|
-
export declare class OnlineMonitor extends EventEmitter {
|
|
26
|
-
private online_;
|
|
27
|
-
static getInstance(): OnlineMonitor;
|
|
28
|
-
constructor();
|
|
29
|
-
getInitialEvent(eventType: string): boolean[];
|
|
30
|
-
currentlyOnline(): boolean;
|
|
31
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { EventEmitter } from './EventEmitter';
|
|
18
|
+
/**
|
|
19
|
+
* Monitors online state (as reported by window.online/offline events).
|
|
20
|
+
*
|
|
21
|
+
* The expectation is that this could have many false positives (thinks we are online
|
|
22
|
+
* when we're not), but no false negatives. So we can safely use it to determine when
|
|
23
|
+
* we definitely cannot reach the internet.
|
|
24
|
+
*/
|
|
25
|
+
export declare class OnlineMonitor extends EventEmitter {
|
|
26
|
+
private online_;
|
|
27
|
+
static getInstance(): OnlineMonitor;
|
|
28
|
+
constructor();
|
|
29
|
+
getInitialEvent(eventType: string): boolean[];
|
|
30
|
+
currentlyOnline(): boolean;
|
|
31
|
+
}
|
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* An immutable object representing a parsed path. It's immutable so that you
|
|
19
|
-
* can pass them around to other functions without worrying about them changing
|
|
20
|
-
* it.
|
|
21
|
-
*/
|
|
22
|
-
export declare class Path {
|
|
23
|
-
pieces_: string[];
|
|
24
|
-
pieceNum_: number;
|
|
25
|
-
/**
|
|
26
|
-
* @param pathOrString - Path string to parse, or another path, or the raw
|
|
27
|
-
* tokens array
|
|
28
|
-
*/
|
|
29
|
-
constructor(pathOrString: string | string[], pieceNum?: number);
|
|
30
|
-
toString(): string;
|
|
31
|
-
}
|
|
32
|
-
export declare function newEmptyPath(): Path;
|
|
33
|
-
export declare function pathGetFront(path: Path): string | null;
|
|
34
|
-
/**
|
|
35
|
-
* @returns The number of segments in this path
|
|
36
|
-
*/
|
|
37
|
-
export declare function pathGetLength(path: Path): number;
|
|
38
|
-
export declare function pathPopFront(path: Path): Path;
|
|
39
|
-
export declare function pathGetBack(path: Path): string | null;
|
|
40
|
-
export declare function pathToUrlEncodedString(path: Path): string;
|
|
41
|
-
/**
|
|
42
|
-
* Shallow copy of the parts of the path.
|
|
43
|
-
*
|
|
44
|
-
*/
|
|
45
|
-
export declare function pathSlice(path: Path, begin?: number): string[];
|
|
46
|
-
export declare function pathParent(path: Path): Path | null;
|
|
47
|
-
export declare function pathChild(path: Path, childPathObj: string | Path): Path;
|
|
48
|
-
/**
|
|
49
|
-
* @returns True if there are no segments in this path
|
|
50
|
-
*/
|
|
51
|
-
export declare function pathIsEmpty(path: Path): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* @returns The path from outerPath to innerPath
|
|
54
|
-
*/
|
|
55
|
-
export declare function newRelativePath(outerPath: Path, innerPath: Path): Path;
|
|
56
|
-
/**
|
|
57
|
-
* @returns -1, 0, 1 if left is less, equal, or greater than the right.
|
|
58
|
-
*/
|
|
59
|
-
export declare function pathCompare(left: Path, right: Path): number;
|
|
60
|
-
/**
|
|
61
|
-
* @returns true if paths are the same.
|
|
62
|
-
*/
|
|
63
|
-
export declare function pathEquals(path: Path, other: Path): boolean;
|
|
64
|
-
/**
|
|
65
|
-
* @returns True if this path is a parent of (or the same as) other
|
|
66
|
-
*/
|
|
67
|
-
export declare function pathContains(path: Path, other: Path): boolean;
|
|
68
|
-
/**
|
|
69
|
-
* Dynamic (mutable) path used to count path lengths.
|
|
70
|
-
*
|
|
71
|
-
* This class is used to efficiently check paths for valid
|
|
72
|
-
* length (in UTF8 bytes) and depth (used in path validation).
|
|
73
|
-
*
|
|
74
|
-
* Throws Error exception if path is ever invalid.
|
|
75
|
-
*
|
|
76
|
-
* The definition of a path always begins with '/'.
|
|
77
|
-
*/
|
|
78
|
-
export declare class ValidationPath {
|
|
79
|
-
errorPrefix_: string;
|
|
80
|
-
parts_: string[];
|
|
81
|
-
/** Initialize to number of '/' chars needed in path. */
|
|
82
|
-
byteLength_: number;
|
|
83
|
-
/**
|
|
84
|
-
* @param path - Initial Path.
|
|
85
|
-
* @param errorPrefix_ - Prefix for any error messages.
|
|
86
|
-
*/
|
|
87
|
-
constructor(path: Path, errorPrefix_: string);
|
|
88
|
-
}
|
|
89
|
-
export declare function validationPathPush(validationPath: ValidationPath, child: string): void;
|
|
90
|
-
export declare function validationPathPop(validationPath: ValidationPath): void;
|
|
91
|
-
/**
|
|
92
|
-
* String for use in error messages - uses '.' notation for path.
|
|
93
|
-
*/
|
|
94
|
-
export declare function validationPathToErrorString(validationPath: ValidationPath): string;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* An immutable object representing a parsed path. It's immutable so that you
|
|
19
|
+
* can pass them around to other functions without worrying about them changing
|
|
20
|
+
* it.
|
|
21
|
+
*/
|
|
22
|
+
export declare class Path {
|
|
23
|
+
pieces_: string[];
|
|
24
|
+
pieceNum_: number;
|
|
25
|
+
/**
|
|
26
|
+
* @param pathOrString - Path string to parse, or another path, or the raw
|
|
27
|
+
* tokens array
|
|
28
|
+
*/
|
|
29
|
+
constructor(pathOrString: string | string[], pieceNum?: number);
|
|
30
|
+
toString(): string;
|
|
31
|
+
}
|
|
32
|
+
export declare function newEmptyPath(): Path;
|
|
33
|
+
export declare function pathGetFront(path: Path): string | null;
|
|
34
|
+
/**
|
|
35
|
+
* @returns The number of segments in this path
|
|
36
|
+
*/
|
|
37
|
+
export declare function pathGetLength(path: Path): number;
|
|
38
|
+
export declare function pathPopFront(path: Path): Path;
|
|
39
|
+
export declare function pathGetBack(path: Path): string | null;
|
|
40
|
+
export declare function pathToUrlEncodedString(path: Path): string;
|
|
41
|
+
/**
|
|
42
|
+
* Shallow copy of the parts of the path.
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
export declare function pathSlice(path: Path, begin?: number): string[];
|
|
46
|
+
export declare function pathParent(path: Path): Path | null;
|
|
47
|
+
export declare function pathChild(path: Path, childPathObj: string | Path): Path;
|
|
48
|
+
/**
|
|
49
|
+
* @returns True if there are no segments in this path
|
|
50
|
+
*/
|
|
51
|
+
export declare function pathIsEmpty(path: Path): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* @returns The path from outerPath to innerPath
|
|
54
|
+
*/
|
|
55
|
+
export declare function newRelativePath(outerPath: Path, innerPath: Path): Path;
|
|
56
|
+
/**
|
|
57
|
+
* @returns -1, 0, 1 if left is less, equal, or greater than the right.
|
|
58
|
+
*/
|
|
59
|
+
export declare function pathCompare(left: Path, right: Path): number;
|
|
60
|
+
/**
|
|
61
|
+
* @returns true if paths are the same.
|
|
62
|
+
*/
|
|
63
|
+
export declare function pathEquals(path: Path, other: Path): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* @returns True if this path is a parent of (or the same as) other
|
|
66
|
+
*/
|
|
67
|
+
export declare function pathContains(path: Path, other: Path): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Dynamic (mutable) path used to count path lengths.
|
|
70
|
+
*
|
|
71
|
+
* This class is used to efficiently check paths for valid
|
|
72
|
+
* length (in UTF8 bytes) and depth (used in path validation).
|
|
73
|
+
*
|
|
74
|
+
* Throws Error exception if path is ever invalid.
|
|
75
|
+
*
|
|
76
|
+
* The definition of a path always begins with '/'.
|
|
77
|
+
*/
|
|
78
|
+
export declare class ValidationPath {
|
|
79
|
+
errorPrefix_: string;
|
|
80
|
+
parts_: string[];
|
|
81
|
+
/** Initialize to number of '/' chars needed in path. */
|
|
82
|
+
byteLength_: number;
|
|
83
|
+
/**
|
|
84
|
+
* @param path - Initial Path.
|
|
85
|
+
* @param errorPrefix_ - Prefix for any error messages.
|
|
86
|
+
*/
|
|
87
|
+
constructor(path: Path, errorPrefix_: string);
|
|
88
|
+
}
|
|
89
|
+
export declare function validationPathPush(validationPath: ValidationPath, child: string): void;
|
|
90
|
+
export declare function validationPathPop(validationPath: ValidationPath): void;
|
|
91
|
+
/**
|
|
92
|
+
* String for use in error messages - uses '.' notation for path.
|
|
93
|
+
*/
|
|
94
|
+
export declare function validationPathToErrorString(validationPath: ValidationPath): string;
|