@depup/firebase__database 1.1.1-depup.0
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/README.md +31 -0
- package/changes.json +10 -0
- package/dist/index.cjs.js +14089 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.esm.js +14032 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.node.cjs.js +14109 -0
- package/dist/index.node.cjs.js.map +1 -0
- package/dist/index.standalone.js +14052 -0
- package/dist/index.standalone.js.map +1 -0
- package/dist/internal.d.ts +2991 -0
- package/dist/node-esm/index.node.esm.js +14048 -0
- package/dist/node-esm/index.node.esm.js.map +1 -0
- package/dist/node-esm/package.json +1 -0
- package/dist/node-esm/src/api/Database.d.ts +137 -0
- package/dist/node-esm/src/api/OnDisconnect.d.ts +110 -0
- package/dist/node-esm/src/api/Reference.d.ts +124 -0
- package/dist/node-esm/src/api/Reference_impl.d.ts +1100 -0
- package/dist/node-esm/src/api/ServerValue.d.ts +30 -0
- package/dist/node-esm/src/api/Transaction.d.ts +83 -0
- package/dist/node-esm/src/api/test_access.d.ts +31 -0
- package/dist/node-esm/src/api.d.ts +18 -0
- package/dist/node-esm/src/api.standalone.d.ts +30 -0
- package/dist/node-esm/src/core/AppCheckTokenProvider.d.ts +32 -0
- package/dist/node-esm/src/core/AuthTokenProvider.d.ts +49 -0
- package/dist/node-esm/src/core/CompoundWrite.d.ts +81 -0
- package/dist/node-esm/src/core/PersistentConnection.d.ts +135 -0
- package/dist/node-esm/src/core/ReadonlyRestClient.d.ts +60 -0
- package/dist/node-esm/src/core/Repo.d.ts +144 -0
- package/dist/node-esm/src/core/RepoInfo.d.ts +61 -0
- package/dist/node-esm/src/core/ServerActions.d.ts +52 -0
- package/dist/node-esm/src/core/SnapshotHolder.d.ts +26 -0
- package/dist/node-esm/src/core/SparseSnapshotTree.d.ts +64 -0
- package/dist/node-esm/src/core/SyncPoint.d.ts +91 -0
- package/dist/node-esm/src/core/SyncTree.d.ts +166 -0
- package/dist/node-esm/src/core/WriteTree.d.ts +205 -0
- package/dist/node-esm/src/core/operation/AckUserWrite.d.ts +36 -0
- package/dist/node-esm/src/core/operation/ListenComplete.d.ts +26 -0
- package/dist/node-esm/src/core/operation/Merge.d.ts +33 -0
- package/dist/node-esm/src/core/operation/Operation.d.ts +45 -0
- package/dist/node-esm/src/core/operation/Overwrite.d.ts +28 -0
- package/dist/node-esm/src/core/snap/ChildrenNode.d.ts +112 -0
- package/dist/node-esm/src/core/snap/IndexMap.d.ts +43 -0
- package/dist/node-esm/src/core/snap/LeafNode.d.ts +83 -0
- package/dist/node-esm/src/core/snap/Node.d.ts +126 -0
- package/dist/node-esm/src/core/snap/childSet.d.ts +32 -0
- package/dist/node-esm/src/core/snap/comparators.d.ts +19 -0
- package/dist/node-esm/src/core/snap/indexes/Index.d.ts +50 -0
- package/dist/node-esm/src/core/snap/indexes/KeyIndex.d.ts +34 -0
- package/dist/node-esm/src/core/snap/indexes/PathIndex.d.ts +29 -0
- package/dist/node-esm/src/core/snap/indexes/PriorityIndex.d.ts +33 -0
- package/dist/node-esm/src/core/snap/indexes/ValueIndex.d.ts +31 -0
- package/dist/node-esm/src/core/snap/nodeFromJSON.d.ts +24 -0
- package/dist/node-esm/src/core/snap/snap.d.ts +23 -0
- package/dist/node-esm/src/core/stats/StatsCollection.d.ts +26 -0
- package/dist/node-esm/src/core/stats/StatsListener.d.ts +30 -0
- package/dist/node-esm/src/core/stats/StatsManager.d.ts +20 -0
- package/dist/node-esm/src/core/stats/StatsReporter.d.ts +28 -0
- package/dist/node-esm/src/core/storage/DOMStorageWrapper.d.ts +46 -0
- package/dist/node-esm/src/core/storage/MemoryStorage.d.ts +27 -0
- package/dist/node-esm/src/core/storage/storage.d.ts +22 -0
- package/dist/node-esm/src/core/util/EventEmitter.d.ts +39 -0
- package/dist/node-esm/src/core/util/ImmutableTree.d.ts +117 -0
- package/dist/node-esm/src/core/util/NextPushId.d.ts +33 -0
- package/dist/node-esm/src/core/util/OnlineMonitor.d.ts +31 -0
- package/dist/node-esm/src/core/util/Path.d.ts +94 -0
- package/dist/node-esm/src/core/util/ServerValues.d.ts +56 -0
- package/dist/node-esm/src/core/util/SortedMap.d.ts +324 -0
- package/dist/node-esm/src/core/util/Tree.d.ts +105 -0
- package/dist/node-esm/src/core/util/VisibilityMonitor.d.ts +23 -0
- package/dist/node-esm/src/core/util/libs/parser.d.ts +32 -0
- package/dist/node-esm/src/core/util/misc.d.ts +19 -0
- package/dist/node-esm/src/core/util/util.d.ts +176 -0
- package/dist/node-esm/src/core/util/validation.d.ts +70 -0
- package/dist/node-esm/src/core/version.d.ts +23 -0
- package/dist/node-esm/src/core/view/CacheNode.d.ts +41 -0
- package/dist/node-esm/src/core/view/Change.d.ts +46 -0
- package/dist/node-esm/src/core/view/ChildChangeAccumulator.d.ts +22 -0
- package/dist/node-esm/src/core/view/CompleteChildSource.d.ts +55 -0
- package/dist/node-esm/src/core/view/Event.d.ts +64 -0
- package/dist/node-esm/src/core/view/EventGenerator.d.ts +42 -0
- package/dist/node-esm/src/core/view/EventQueue.d.ts +67 -0
- package/dist/node-esm/src/core/view/EventRegistration.d.ts +87 -0
- package/dist/node-esm/src/core/view/QueryParams.d.ts +95 -0
- package/dist/node-esm/src/core/view/View.d.ts +59 -0
- package/dist/node-esm/src/core/view/ViewCache.d.ts +32 -0
- package/dist/node-esm/src/core/view/ViewProcessor.d.ts +32 -0
- package/dist/node-esm/src/core/view/filter/IndexedFilter.d.ts +35 -0
- package/dist/node-esm/src/core/view/filter/LimitedFilter.d.ts +47 -0
- package/dist/node-esm/src/core/view/filter/NodeFilter.d.ts +54 -0
- package/dist/node-esm/src/core/view/filter/RangedFilter.d.ts +47 -0
- package/dist/node-esm/src/index.d.ts +28 -0
- package/dist/node-esm/src/index.node.d.ts +17 -0
- package/dist/node-esm/src/index.standalone.d.ts +17 -0
- package/dist/node-esm/src/internal/index.d.ts +38 -0
- package/dist/node-esm/src/realtime/BrowserPollConnection.d.ts +198 -0
- package/dist/node-esm/src/realtime/Connection.d.ts +102 -0
- package/dist/node-esm/src/realtime/Constants.d.ts +27 -0
- package/dist/node-esm/src/realtime/Transport.d.ts +58 -0
- package/dist/node-esm/src/realtime/TransportManager.d.ts +50 -0
- package/dist/node-esm/src/realtime/WebSocketConnection.d.ts +127 -0
- package/dist/node-esm/src/realtime/polling/PacketReceiver.d.ts +38 -0
- package/dist/node-esm/src/register.d.ts +1 -0
- package/dist/node-esm/test/helpers/EventAccumulator.d.ts +35 -0
- package/dist/node-esm/test/helpers/syncpoint-util.d.ts +29 -0
- package/dist/node-esm/test/helpers/util.d.ts +36 -0
- package/dist/private.d.ts +2853 -0
- package/dist/public.d.ts +1405 -0
- package/dist/src/api/Database.d.ts +137 -0
- package/dist/src/api/OnDisconnect.d.ts +110 -0
- package/dist/src/api/Reference.d.ts +124 -0
- package/dist/src/api/Reference_impl.d.ts +1100 -0
- package/dist/src/api/ServerValue.d.ts +30 -0
- package/dist/src/api/Transaction.d.ts +83 -0
- package/dist/src/api/test_access.d.ts +31 -0
- package/dist/src/api.d.ts +18 -0
- package/dist/src/api.standalone.d.ts +30 -0
- package/dist/src/core/AppCheckTokenProvider.d.ts +32 -0
- package/dist/src/core/AuthTokenProvider.d.ts +49 -0
- package/dist/src/core/CompoundWrite.d.ts +81 -0
- package/dist/src/core/PersistentConnection.d.ts +135 -0
- package/dist/src/core/ReadonlyRestClient.d.ts +60 -0
- package/dist/src/core/Repo.d.ts +144 -0
- package/dist/src/core/RepoInfo.d.ts +61 -0
- package/dist/src/core/ServerActions.d.ts +52 -0
- package/dist/src/core/SnapshotHolder.d.ts +26 -0
- package/dist/src/core/SparseSnapshotTree.d.ts +64 -0
- package/dist/src/core/SyncPoint.d.ts +91 -0
- package/dist/src/core/SyncTree.d.ts +166 -0
- package/dist/src/core/WriteTree.d.ts +205 -0
- package/dist/src/core/operation/AckUserWrite.d.ts +36 -0
- package/dist/src/core/operation/ListenComplete.d.ts +26 -0
- package/dist/src/core/operation/Merge.d.ts +33 -0
- package/dist/src/core/operation/Operation.d.ts +45 -0
- package/dist/src/core/operation/Overwrite.d.ts +28 -0
- package/dist/src/core/snap/ChildrenNode.d.ts +112 -0
- package/dist/src/core/snap/IndexMap.d.ts +43 -0
- package/dist/src/core/snap/LeafNode.d.ts +83 -0
- package/dist/src/core/snap/Node.d.ts +126 -0
- package/dist/src/core/snap/childSet.d.ts +32 -0
- package/dist/src/core/snap/comparators.d.ts +19 -0
- package/dist/src/core/snap/indexes/Index.d.ts +50 -0
- package/dist/src/core/snap/indexes/KeyIndex.d.ts +34 -0
- package/dist/src/core/snap/indexes/PathIndex.d.ts +29 -0
- package/dist/src/core/snap/indexes/PriorityIndex.d.ts +33 -0
- package/dist/src/core/snap/indexes/ValueIndex.d.ts +31 -0
- package/dist/src/core/snap/nodeFromJSON.d.ts +24 -0
- package/dist/src/core/snap/snap.d.ts +23 -0
- package/dist/src/core/stats/StatsCollection.d.ts +26 -0
- package/dist/src/core/stats/StatsListener.d.ts +30 -0
- package/dist/src/core/stats/StatsManager.d.ts +20 -0
- package/dist/src/core/stats/StatsReporter.d.ts +28 -0
- package/dist/src/core/storage/DOMStorageWrapper.d.ts +46 -0
- package/dist/src/core/storage/MemoryStorage.d.ts +27 -0
- package/dist/src/core/storage/storage.d.ts +22 -0
- package/dist/src/core/util/EventEmitter.d.ts +39 -0
- package/dist/src/core/util/ImmutableTree.d.ts +117 -0
- package/dist/src/core/util/NextPushId.d.ts +33 -0
- package/dist/src/core/util/OnlineMonitor.d.ts +31 -0
- package/dist/src/core/util/Path.d.ts +94 -0
- package/dist/src/core/util/ServerValues.d.ts +56 -0
- package/dist/src/core/util/SortedMap.d.ts +324 -0
- package/dist/src/core/util/Tree.d.ts +105 -0
- package/dist/src/core/util/VisibilityMonitor.d.ts +23 -0
- package/dist/src/core/util/libs/parser.d.ts +32 -0
- package/dist/src/core/util/misc.d.ts +19 -0
- package/dist/src/core/util/util.d.ts +176 -0
- package/dist/src/core/util/validation.d.ts +70 -0
- package/dist/src/core/version.d.ts +23 -0
- package/dist/src/core/view/CacheNode.d.ts +41 -0
- package/dist/src/core/view/Change.d.ts +46 -0
- package/dist/src/core/view/ChildChangeAccumulator.d.ts +22 -0
- package/dist/src/core/view/CompleteChildSource.d.ts +55 -0
- package/dist/src/core/view/Event.d.ts +64 -0
- package/dist/src/core/view/EventGenerator.d.ts +42 -0
- package/dist/src/core/view/EventQueue.d.ts +67 -0
- package/dist/src/core/view/EventRegistration.d.ts +87 -0
- package/dist/src/core/view/QueryParams.d.ts +95 -0
- package/dist/src/core/view/View.d.ts +59 -0
- package/dist/src/core/view/ViewCache.d.ts +32 -0
- package/dist/src/core/view/ViewProcessor.d.ts +32 -0
- package/dist/src/core/view/filter/IndexedFilter.d.ts +35 -0
- package/dist/src/core/view/filter/LimitedFilter.d.ts +47 -0
- package/dist/src/core/view/filter/NodeFilter.d.ts +54 -0
- package/dist/src/core/view/filter/RangedFilter.d.ts +47 -0
- package/dist/src/index.d.ts +28 -0
- package/dist/src/index.node.d.ts +17 -0
- package/dist/src/index.standalone.d.ts +17 -0
- package/dist/src/internal/index.d.ts +38 -0
- package/dist/src/realtime/BrowserPollConnection.d.ts +198 -0
- package/dist/src/realtime/Connection.d.ts +102 -0
- package/dist/src/realtime/Constants.d.ts +27 -0
- package/dist/src/realtime/Transport.d.ts +58 -0
- package/dist/src/realtime/TransportManager.d.ts +50 -0
- package/dist/src/realtime/WebSocketConnection.d.ts +127 -0
- package/dist/src/realtime/polling/PacketReceiver.d.ts +38 -0
- package/dist/src/register.d.ts +1 -0
- package/dist/src/tsdoc-metadata.json +11 -0
- package/dist/test/helpers/EventAccumulator.d.ts +35 -0
- package/dist/test/helpers/syncpoint-util.d.ts +29 -0
- package/dist/test/helpers/util.d.ts +36 -0
- package/package.json +104 -0
|
@@ -0,0 +1,64 @@
|
|
|
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 { DataSnapshot as ExpDataSnapshot } from '../../api/Reference_impl';
|
|
18
|
+
import { Path } from '../util/Path';
|
|
19
|
+
import { EventRegistration } from './EventRegistration';
|
|
20
|
+
/**
|
|
21
|
+
* Encapsulates the data needed to raise an event
|
|
22
|
+
* @interface
|
|
23
|
+
*/
|
|
24
|
+
export interface Event {
|
|
25
|
+
getPath(): Path;
|
|
26
|
+
getEventType(): string;
|
|
27
|
+
getEventRunner(): () => void;
|
|
28
|
+
toString(): string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* One of the following strings: "value", "child_added", "child_changed",
|
|
32
|
+
* "child_removed", or "child_moved."
|
|
33
|
+
*/
|
|
34
|
+
export type EventType = 'value' | 'child_added' | 'child_changed' | 'child_moved' | 'child_removed';
|
|
35
|
+
/**
|
|
36
|
+
* Encapsulates the data needed to raise an event
|
|
37
|
+
*/
|
|
38
|
+
export declare class DataEvent implements Event {
|
|
39
|
+
eventType: EventType;
|
|
40
|
+
eventRegistration: EventRegistration;
|
|
41
|
+
snapshot: ExpDataSnapshot;
|
|
42
|
+
prevName?: string | null;
|
|
43
|
+
/**
|
|
44
|
+
* @param eventType - One of: value, child_added, child_changed, child_moved, child_removed
|
|
45
|
+
* @param eventRegistration - The function to call to with the event data. User provided
|
|
46
|
+
* @param snapshot - The data backing the event
|
|
47
|
+
* @param prevName - Optional, the name of the previous child for child_* events.
|
|
48
|
+
*/
|
|
49
|
+
constructor(eventType: EventType, eventRegistration: EventRegistration, snapshot: ExpDataSnapshot, prevName?: string | null);
|
|
50
|
+
getPath(): Path;
|
|
51
|
+
getEventType(): string;
|
|
52
|
+
getEventRunner(): () => void;
|
|
53
|
+
toString(): string;
|
|
54
|
+
}
|
|
55
|
+
export declare class CancelEvent implements Event {
|
|
56
|
+
eventRegistration: EventRegistration;
|
|
57
|
+
error: Error;
|
|
58
|
+
path: Path;
|
|
59
|
+
constructor(eventRegistration: EventRegistration, error: Error, path: Path);
|
|
60
|
+
getPath(): Path;
|
|
61
|
+
getEventType(): string;
|
|
62
|
+
getEventRunner(): () => void;
|
|
63
|
+
toString(): string;
|
|
64
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 { Index } from '../snap/indexes/Index';
|
|
18
|
+
import { Node } from '../snap/Node';
|
|
19
|
+
import { Change } from './Change';
|
|
20
|
+
import { Event } from './Event';
|
|
21
|
+
import { EventRegistration, QueryContext } from './EventRegistration';
|
|
22
|
+
/**
|
|
23
|
+
* An EventGenerator is used to convert "raw" changes (Change) as computed by the
|
|
24
|
+
* CacheDiffer into actual events (Event) that can be raised. See generateEventsForChanges()
|
|
25
|
+
* for details.
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
export declare class EventGenerator {
|
|
29
|
+
query_: QueryContext;
|
|
30
|
+
index_: Index;
|
|
31
|
+
constructor(query_: QueryContext);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Given a set of raw changes (no moved events and prevName not specified yet), and a set of
|
|
35
|
+
* EventRegistrations that should be notified of these changes, generate the actual events to be raised.
|
|
36
|
+
*
|
|
37
|
+
* Notes:
|
|
38
|
+
* - child_moved events will be synthesized at this time for any child_changed events that affect
|
|
39
|
+
* our index.
|
|
40
|
+
* - prevName will be calculated based on the index ordering.
|
|
41
|
+
*/
|
|
42
|
+
export declare function eventGeneratorGenerateEventsForChanges(eventGenerator: EventGenerator, changes: Change[], eventCache: Node, eventRegistrations: EventRegistration[]): Event[];
|
|
@@ -0,0 +1,67 @@
|
|
|
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 '../util/Path';
|
|
18
|
+
import { Event } from './Event';
|
|
19
|
+
/**
|
|
20
|
+
* The event queue serves a few purposes:
|
|
21
|
+
* 1. It ensures we maintain event order in the face of event callbacks doing operations that result in more
|
|
22
|
+
* events being queued.
|
|
23
|
+
* 2. raiseQueuedEvents() handles being called reentrantly nicely. That is, if in the course of raising events,
|
|
24
|
+
* raiseQueuedEvents() is called again, the "inner" call will pick up raising events where the "outer" call
|
|
25
|
+
* left off, ensuring that the events are still raised synchronously and in order.
|
|
26
|
+
* 3. You can use raiseEventsAtPath and raiseEventsForChangedPath to ensure only relevant previously-queued
|
|
27
|
+
* events are raised synchronously.
|
|
28
|
+
*
|
|
29
|
+
* NOTE: This can all go away if/when we move to async events.
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
export declare class EventQueue {
|
|
33
|
+
eventLists_: EventList[];
|
|
34
|
+
/**
|
|
35
|
+
* Tracks recursion depth of raiseQueuedEvents_, for debugging purposes.
|
|
36
|
+
*/
|
|
37
|
+
recursionDepth_: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @param eventDataList - The new events to queue.
|
|
41
|
+
*/
|
|
42
|
+
export declare function eventQueueQueueEvents(eventQueue: EventQueue, eventDataList: Event[]): void;
|
|
43
|
+
/**
|
|
44
|
+
* Queues the specified events and synchronously raises all events (including previously queued ones)
|
|
45
|
+
* for the specified path.
|
|
46
|
+
*
|
|
47
|
+
* It is assumed that the new events are all for the specified path.
|
|
48
|
+
*
|
|
49
|
+
* @param path - The path to raise events for.
|
|
50
|
+
* @param eventDataList - The new events to raise.
|
|
51
|
+
*/
|
|
52
|
+
export declare function eventQueueRaiseEventsAtPath(eventQueue: EventQueue, path: Path, eventDataList: Event[]): void;
|
|
53
|
+
/**
|
|
54
|
+
* Queues the specified events and synchronously raises all events (including previously queued ones) for
|
|
55
|
+
* locations related to the specified change path (i.e. all ancestors and descendants).
|
|
56
|
+
*
|
|
57
|
+
* It is assumed that the new events are all related (ancestor or descendant) to the specified path.
|
|
58
|
+
*
|
|
59
|
+
* @param changedPath - The path to raise events for.
|
|
60
|
+
* @param eventDataList - The events to raise
|
|
61
|
+
*/
|
|
62
|
+
export declare function eventQueueRaiseEventsForChangedPath(eventQueue: EventQueue, changedPath: Path, eventDataList: Event[]): void;
|
|
63
|
+
interface EventList {
|
|
64
|
+
events: Event[];
|
|
65
|
+
path: Path;
|
|
66
|
+
}
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
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 { DataSnapshot } from '../../api/Reference_impl';
|
|
18
|
+
import { Repo } from '../Repo';
|
|
19
|
+
import { Path } from '../util/Path';
|
|
20
|
+
import { Change } from './Change';
|
|
21
|
+
import { CancelEvent, Event } from './Event';
|
|
22
|
+
import { QueryParams } from './QueryParams';
|
|
23
|
+
/**
|
|
24
|
+
* A user callback. Callbacks issues from the Legacy SDK maintain references
|
|
25
|
+
* to the original user-issued callbacks, which allows equality
|
|
26
|
+
* comparison by reference even though this callbacks are wrapped before
|
|
27
|
+
* they can be passed to the firebase@exp SDK.
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export interface UserCallback {
|
|
32
|
+
(dataSnapshot: DataSnapshot, previousChildName?: string | null): unknown;
|
|
33
|
+
userCallback?: unknown;
|
|
34
|
+
context?: object | null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A wrapper class that converts events from the database@exp SDK to the legacy
|
|
38
|
+
* Database SDK. Events are not converted directly as event registration relies
|
|
39
|
+
* on reference comparison of the original user callback (see `matches()`) and
|
|
40
|
+
* relies on equality of the legacy SDK's `context` object.
|
|
41
|
+
*/
|
|
42
|
+
export declare class CallbackContext {
|
|
43
|
+
private readonly snapshotCallback;
|
|
44
|
+
private readonly cancelCallback?;
|
|
45
|
+
constructor(snapshotCallback: UserCallback, cancelCallback?: (error: Error) => unknown);
|
|
46
|
+
onValue(expDataSnapshot: DataSnapshot, previousChildName?: string | null): void;
|
|
47
|
+
onCancel(error: Error): void;
|
|
48
|
+
get hasCancelCallback(): boolean;
|
|
49
|
+
matches(other: CallbackContext): boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface QueryContext {
|
|
52
|
+
readonly _queryIdentifier: string;
|
|
53
|
+
readonly _queryObject: object;
|
|
54
|
+
readonly _repo: Repo;
|
|
55
|
+
readonly _path: Path;
|
|
56
|
+
readonly _queryParams: QueryParams;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* An EventRegistration is basically an event type ('value', 'child_added', etc.) and a callback
|
|
60
|
+
* to be notified of that type of event.
|
|
61
|
+
*
|
|
62
|
+
* That said, it can also contain a cancel callback to be notified if the event is canceled. And
|
|
63
|
+
* currently, this code is organized around the idea that you would register multiple child_ callbacks
|
|
64
|
+
* together, as a single EventRegistration. Though currently we don't do that.
|
|
65
|
+
*/
|
|
66
|
+
export interface EventRegistration {
|
|
67
|
+
/**
|
|
68
|
+
* True if this container has a callback to trigger for this event type
|
|
69
|
+
*/
|
|
70
|
+
respondsTo(eventType: string): boolean;
|
|
71
|
+
createEvent(change: Change, query: QueryContext): Event;
|
|
72
|
+
/**
|
|
73
|
+
* Given event data, return a function to trigger the user's callback
|
|
74
|
+
*/
|
|
75
|
+
getEventRunner(eventData: Event): () => void;
|
|
76
|
+
createCancelEvent(error: Error, path: Path): CancelEvent | null;
|
|
77
|
+
matches(other: EventRegistration): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* False basically means this is a "dummy" callback container being used as a sentinel
|
|
80
|
+
* to remove all callback containers of a particular type. (e.g. if the user does
|
|
81
|
+
* ref.off('value') without specifying a specific callback).
|
|
82
|
+
*
|
|
83
|
+
* (TODO: Rework this, since it's hacky)
|
|
84
|
+
*
|
|
85
|
+
*/
|
|
86
|
+
hasAnyCallback(): boolean;
|
|
87
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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 { Index } from '../snap/indexes/Index';
|
|
18
|
+
import { PriorityIndex } from '../snap/indexes/PriorityIndex';
|
|
19
|
+
import { NodeFilter } from './filter/NodeFilter';
|
|
20
|
+
/**
|
|
21
|
+
* This class is an immutable-from-the-public-api struct containing a set of query parameters defining a
|
|
22
|
+
* range to be returned for a particular location. It is assumed that validation of parameters is done at the
|
|
23
|
+
* user-facing API level, so it is not done here.
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare class QueryParams {
|
|
28
|
+
limitSet_: boolean;
|
|
29
|
+
startSet_: boolean;
|
|
30
|
+
startNameSet_: boolean;
|
|
31
|
+
startAfterSet_: boolean;
|
|
32
|
+
endSet_: boolean;
|
|
33
|
+
endNameSet_: boolean;
|
|
34
|
+
endBeforeSet_: boolean;
|
|
35
|
+
limit_: number;
|
|
36
|
+
viewFrom_: string;
|
|
37
|
+
indexStartValue_: unknown | null;
|
|
38
|
+
indexStartName_: string;
|
|
39
|
+
indexEndValue_: unknown | null;
|
|
40
|
+
indexEndName_: string;
|
|
41
|
+
index_: PriorityIndex;
|
|
42
|
+
hasStart(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* @returns True if it would return from left.
|
|
45
|
+
*/
|
|
46
|
+
isViewFromLeft(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Only valid to call if hasStart() returns true
|
|
49
|
+
*/
|
|
50
|
+
getIndexStartValue(): unknown;
|
|
51
|
+
/**
|
|
52
|
+
* Only valid to call if hasStart() returns true.
|
|
53
|
+
* Returns the starting key name for the range defined by these query parameters
|
|
54
|
+
*/
|
|
55
|
+
getIndexStartName(): string;
|
|
56
|
+
hasEnd(): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Only valid to call if hasEnd() returns true.
|
|
59
|
+
*/
|
|
60
|
+
getIndexEndValue(): unknown;
|
|
61
|
+
/**
|
|
62
|
+
* Only valid to call if hasEnd() returns true.
|
|
63
|
+
* Returns the end key name for the range defined by these query parameters
|
|
64
|
+
*/
|
|
65
|
+
getIndexEndName(): string;
|
|
66
|
+
hasLimit(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* @returns True if a limit has been set and it has been explicitly anchored
|
|
69
|
+
*/
|
|
70
|
+
hasAnchoredLimit(): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Only valid to call if hasLimit() returns true
|
|
73
|
+
*/
|
|
74
|
+
getLimit(): number;
|
|
75
|
+
getIndex(): Index;
|
|
76
|
+
loadsAllData(): boolean;
|
|
77
|
+
isDefault(): boolean;
|
|
78
|
+
copy(): QueryParams;
|
|
79
|
+
}
|
|
80
|
+
export declare function queryParamsGetNodeFilter(queryParams: QueryParams): NodeFilter;
|
|
81
|
+
export declare function queryParamsLimit(queryParams: QueryParams, newLimit: number): QueryParams;
|
|
82
|
+
export declare function queryParamsLimitToFirst(queryParams: QueryParams, newLimit: number): QueryParams;
|
|
83
|
+
export declare function queryParamsLimitToLast(queryParams: QueryParams, newLimit: number): QueryParams;
|
|
84
|
+
export declare function queryParamsStartAt(queryParams: QueryParams, indexValue: unknown, key?: string | null): QueryParams;
|
|
85
|
+
export declare function queryParamsStartAfter(queryParams: QueryParams, indexValue: unknown, key?: string | null): QueryParams;
|
|
86
|
+
export declare function queryParamsEndAt(queryParams: QueryParams, indexValue: unknown, key?: string | null): QueryParams;
|
|
87
|
+
export declare function queryParamsEndBefore(queryParams: QueryParams, indexValue: unknown, key?: string | null): QueryParams;
|
|
88
|
+
export declare function queryParamsOrderBy(queryParams: QueryParams, index: Index): QueryParams;
|
|
89
|
+
/**
|
|
90
|
+
* Returns a set of REST query string parameters representing this query.
|
|
91
|
+
*
|
|
92
|
+
* @returns query string parameters
|
|
93
|
+
*/
|
|
94
|
+
export declare function queryParamsToRestQueryStringParameters(queryParams: QueryParams): Record<string, string | number>;
|
|
95
|
+
export declare function queryParamsGetQueryObject(queryParams: QueryParams): Record<string, unknown>;
|
|
@@ -0,0 +1,59 @@
|
|
|
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 { Operation } from '../operation/Operation';
|
|
18
|
+
import { Node } from '../snap/Node';
|
|
19
|
+
import { Path } from '../util/Path';
|
|
20
|
+
import { WriteTreeRef } from '../WriteTree';
|
|
21
|
+
import { Event } from './Event';
|
|
22
|
+
import { EventGenerator } from './EventGenerator';
|
|
23
|
+
import { EventRegistration, QueryContext } from './EventRegistration';
|
|
24
|
+
import { ViewCache } from './ViewCache';
|
|
25
|
+
import { ViewProcessor } from './ViewProcessor';
|
|
26
|
+
/**
|
|
27
|
+
* A view represents a specific location and query that has 1 or more event registrations.
|
|
28
|
+
*
|
|
29
|
+
* It does several things:
|
|
30
|
+
* - Maintains the list of event registrations for this location/query.
|
|
31
|
+
* - Maintains a cache of the data visible for this location/query.
|
|
32
|
+
* - Applies new operations (via applyOperation), updates the cache, and based on the event
|
|
33
|
+
* registrations returns the set of events to be raised.
|
|
34
|
+
*/
|
|
35
|
+
export declare class View {
|
|
36
|
+
private query_;
|
|
37
|
+
processor_: ViewProcessor;
|
|
38
|
+
viewCache_: ViewCache;
|
|
39
|
+
eventRegistrations_: EventRegistration[];
|
|
40
|
+
eventGenerator_: EventGenerator;
|
|
41
|
+
constructor(query_: QueryContext, initialViewCache: ViewCache);
|
|
42
|
+
get query(): QueryContext;
|
|
43
|
+
}
|
|
44
|
+
export declare function viewGetServerCache(view: View): Node | null;
|
|
45
|
+
export declare function viewGetCompleteNode(view: View): Node | null;
|
|
46
|
+
export declare function viewGetCompleteServerCache(view: View, path: Path): Node | null;
|
|
47
|
+
export declare function viewIsEmpty(view: View): boolean;
|
|
48
|
+
export declare function viewAddEventRegistration(view: View, eventRegistration: EventRegistration): void;
|
|
49
|
+
/**
|
|
50
|
+
* @param eventRegistration - If null, remove all callbacks.
|
|
51
|
+
* @param cancelError - If a cancelError is provided, appropriate cancel events will be returned.
|
|
52
|
+
* @returns Cancel events, if cancelError was provided.
|
|
53
|
+
*/
|
|
54
|
+
export declare function viewRemoveEventRegistration(view: View, eventRegistration: EventRegistration | null, cancelError?: Error): Event[];
|
|
55
|
+
/**
|
|
56
|
+
* Applies the given Operation, updates our cache, and returns the appropriate events.
|
|
57
|
+
*/
|
|
58
|
+
export declare function viewApplyOperation(view: View, operation: Operation, writesCache: WriteTreeRef, completeServerCache: Node | null): Event[];
|
|
59
|
+
export declare function viewGetInitialEvents(view: View, registration: EventRegistration): Event[];
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { Node } from '../snap/Node';
|
|
18
|
+
import { CacheNode } from './CacheNode';
|
|
19
|
+
/**
|
|
20
|
+
* Stores the data we have cached for a view.
|
|
21
|
+
*
|
|
22
|
+
* serverSnap is the cached server data, eventSnap is the cached event data (server data plus any local writes).
|
|
23
|
+
*/
|
|
24
|
+
export interface ViewCache {
|
|
25
|
+
readonly eventCache: CacheNode;
|
|
26
|
+
readonly serverCache: CacheNode;
|
|
27
|
+
}
|
|
28
|
+
export declare function newViewCache(eventCache: CacheNode, serverCache: CacheNode): ViewCache;
|
|
29
|
+
export declare function viewCacheUpdateEventSnap(viewCache: ViewCache, eventSnap: Node, complete: boolean, filtered: boolean): ViewCache;
|
|
30
|
+
export declare function viewCacheUpdateServerSnap(viewCache: ViewCache, serverSnap: Node, complete: boolean, filtered: boolean): ViewCache;
|
|
31
|
+
export declare function viewCacheGetCompleteEventSnap(viewCache: ViewCache): Node | null;
|
|
32
|
+
export declare function viewCacheGetCompleteServerSnap(viewCache: ViewCache): Node | null;
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { Operation } from '../operation/Operation';
|
|
18
|
+
import { Node } from '../snap/Node';
|
|
19
|
+
import { WriteTreeRef } from '../WriteTree';
|
|
20
|
+
import { Change } from './Change';
|
|
21
|
+
import { NodeFilter } from './filter/NodeFilter';
|
|
22
|
+
import { ViewCache } from './ViewCache';
|
|
23
|
+
export interface ProcessorResult {
|
|
24
|
+
readonly viewCache: ViewCache;
|
|
25
|
+
readonly changes: Change[];
|
|
26
|
+
}
|
|
27
|
+
export interface ViewProcessor {
|
|
28
|
+
readonly filter: NodeFilter;
|
|
29
|
+
}
|
|
30
|
+
export declare function newViewProcessor(filter: NodeFilter): ViewProcessor;
|
|
31
|
+
export declare function viewProcessorAssertIndexed(viewProcessor: ViewProcessor, viewCache: ViewCache): void;
|
|
32
|
+
export declare function viewProcessorApplyOperation(viewProcessor: ViewProcessor, oldViewCache: ViewCache, operation: Operation, writesCache: WriteTreeRef, completeCache: Node | null): ProcessorResult;
|
|
@@ -0,0 +1,35 @@
|
|
|
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 { Index } from '../../snap/indexes/Index';
|
|
18
|
+
import { Node } from '../../snap/Node';
|
|
19
|
+
import { Path } from '../../util/Path';
|
|
20
|
+
import { ChildChangeAccumulator } from '../ChildChangeAccumulator';
|
|
21
|
+
import { CompleteChildSource } from '../CompleteChildSource';
|
|
22
|
+
import { NodeFilter } from './NodeFilter';
|
|
23
|
+
/**
|
|
24
|
+
* Doesn't really filter nodes but applies an index to the node and keeps track of any changes
|
|
25
|
+
*/
|
|
26
|
+
export declare class IndexedFilter implements NodeFilter {
|
|
27
|
+
private readonly index_;
|
|
28
|
+
constructor(index_: Index);
|
|
29
|
+
updateChild(snap: Node, key: string, newChild: Node, affectedPath: Path, source: CompleteChildSource, optChangeAccumulator: ChildChangeAccumulator | null): Node;
|
|
30
|
+
updateFullNode(oldSnap: Node, newSnap: Node, optChangeAccumulator: ChildChangeAccumulator | null): Node;
|
|
31
|
+
updatePriority(oldSnap: Node, newPriority: Node): Node;
|
|
32
|
+
filtersNodes(): boolean;
|
|
33
|
+
getIndexedFilter(): IndexedFilter;
|
|
34
|
+
getIndex(): Index;
|
|
35
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 { Index } from '../../snap/indexes/Index';
|
|
18
|
+
import { Node } from '../../snap/Node';
|
|
19
|
+
import { Path } from '../../util/Path';
|
|
20
|
+
import { ChildChangeAccumulator } from '../ChildChangeAccumulator';
|
|
21
|
+
import { CompleteChildSource } from '../CompleteChildSource';
|
|
22
|
+
import { QueryParams } from '../QueryParams';
|
|
23
|
+
import { IndexedFilter } from './IndexedFilter';
|
|
24
|
+
import { NodeFilter } from './NodeFilter';
|
|
25
|
+
/**
|
|
26
|
+
* Applies a limit and a range to a node and uses RangedFilter to do the heavy lifting where possible
|
|
27
|
+
*/
|
|
28
|
+
export declare class LimitedFilter implements NodeFilter {
|
|
29
|
+
private readonly rangedFilter_;
|
|
30
|
+
private readonly index_;
|
|
31
|
+
private readonly limit_;
|
|
32
|
+
private readonly reverse_;
|
|
33
|
+
private readonly startIsInclusive_;
|
|
34
|
+
private readonly endIsInclusive_;
|
|
35
|
+
constructor(params: QueryParams);
|
|
36
|
+
updateChild(snap: Node, key: string, newChild: Node, affectedPath: Path, source: CompleteChildSource, optChangeAccumulator: ChildChangeAccumulator | null): Node;
|
|
37
|
+
updateFullNode(oldSnap: Node, newSnap: Node, optChangeAccumulator: ChildChangeAccumulator | null): Node;
|
|
38
|
+
updatePriority(oldSnap: Node, newPriority: Node): Node;
|
|
39
|
+
filtersNodes(): boolean;
|
|
40
|
+
getIndexedFilter(): IndexedFilter;
|
|
41
|
+
getIndex(): Index;
|
|
42
|
+
private fullLimitUpdateChild_;
|
|
43
|
+
private withinDirectionalStart;
|
|
44
|
+
private withinDirectionalEnd;
|
|
45
|
+
private withinStartPost;
|
|
46
|
+
private withinEndPost;
|
|
47
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 { Index } from '../../snap/indexes/Index';
|
|
18
|
+
import { Node } from '../../snap/Node';
|
|
19
|
+
import { Path } from '../../util/Path';
|
|
20
|
+
import { ChildChangeAccumulator } from '../ChildChangeAccumulator';
|
|
21
|
+
import { CompleteChildSource } from '../CompleteChildSource';
|
|
22
|
+
/**
|
|
23
|
+
* NodeFilter is used to update nodes and complete children of nodes while applying queries on the fly and keeping
|
|
24
|
+
* track of any child changes. This class does not track value changes as value changes depend on more
|
|
25
|
+
* than just the node itself. Different kind of queries require different kind of implementations of this interface.
|
|
26
|
+
* @interface
|
|
27
|
+
*/
|
|
28
|
+
export interface NodeFilter {
|
|
29
|
+
/**
|
|
30
|
+
* Update a single complete child in the snap. If the child equals the old child in the snap, this is a no-op.
|
|
31
|
+
* The method expects an indexed snap.
|
|
32
|
+
*/
|
|
33
|
+
updateChild(snap: Node, key: string, newChild: Node, affectedPath: Path, source: CompleteChildSource, optChangeAccumulator: ChildChangeAccumulator | null): Node;
|
|
34
|
+
/**
|
|
35
|
+
* Update a node in full and output any resulting change from this complete update.
|
|
36
|
+
*/
|
|
37
|
+
updateFullNode(oldSnap: Node, newSnap: Node, optChangeAccumulator: ChildChangeAccumulator | null): Node;
|
|
38
|
+
/**
|
|
39
|
+
* Update the priority of the root node
|
|
40
|
+
*/
|
|
41
|
+
updatePriority(oldSnap: Node, newPriority: Node): Node;
|
|
42
|
+
/**
|
|
43
|
+
* Returns true if children might be filtered due to query criteria
|
|
44
|
+
*/
|
|
45
|
+
filtersNodes(): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the index filter that this filter uses to get a NodeFilter that doesn't filter any children.
|
|
48
|
+
*/
|
|
49
|
+
getIndexedFilter(): NodeFilter;
|
|
50
|
+
/**
|
|
51
|
+
* Returns the index that this filter uses
|
|
52
|
+
*/
|
|
53
|
+
getIndex(): Index;
|
|
54
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 { NamedNode, Node } from '../../../core/snap/Node';
|
|
18
|
+
import { Index } from '../../snap/indexes/Index';
|
|
19
|
+
import { Path } from '../../util/Path';
|
|
20
|
+
import { ChildChangeAccumulator } from '../ChildChangeAccumulator';
|
|
21
|
+
import { CompleteChildSource } from '../CompleteChildSource';
|
|
22
|
+
import { QueryParams } from '../QueryParams';
|
|
23
|
+
import { IndexedFilter } from './IndexedFilter';
|
|
24
|
+
import { NodeFilter } from './NodeFilter';
|
|
25
|
+
/**
|
|
26
|
+
* Filters nodes by range and uses an IndexFilter to track any changes after filtering the node
|
|
27
|
+
*/
|
|
28
|
+
export declare class RangedFilter implements NodeFilter {
|
|
29
|
+
private indexedFilter_;
|
|
30
|
+
private index_;
|
|
31
|
+
private startPost_;
|
|
32
|
+
private endPost_;
|
|
33
|
+
private startIsInclusive_;
|
|
34
|
+
private endIsInclusive_;
|
|
35
|
+
constructor(params: QueryParams);
|
|
36
|
+
getStartPost(): NamedNode;
|
|
37
|
+
getEndPost(): NamedNode;
|
|
38
|
+
matches(node: NamedNode): boolean;
|
|
39
|
+
updateChild(snap: Node, key: string, newChild: Node, affectedPath: Path, source: CompleteChildSource, optChangeAccumulator: ChildChangeAccumulator | null): Node;
|
|
40
|
+
updateFullNode(oldSnap: Node, newSnap: Node, optChangeAccumulator: ChildChangeAccumulator | null): Node;
|
|
41
|
+
updatePriority(oldSnap: Node, newPriority: Node): Node;
|
|
42
|
+
filtersNodes(): boolean;
|
|
43
|
+
getIndexedFilter(): IndexedFilter;
|
|
44
|
+
getIndex(): Index;
|
|
45
|
+
private static getStartPost_;
|
|
46
|
+
private static getEndPost_;
|
|
47
|
+
}
|