@firebase/database 0.8.3-canary.fb90580e5 → 0.8.3

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.
Files changed (134) hide show
  1. package/dist/index.d.ts +0 -16
  2. package/dist/index.esm.js +34 -163
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.esm2017.js +34 -161
  5. package/dist/index.esm2017.js.map +1 -1
  6. package/dist/index.node.cjs.js +34 -163
  7. package/dist/index.node.cjs.js.map +1 -1
  8. package/dist/src/api/Query.d.ts +0 -2
  9. package/dist/src/core/AuthTokenProvider.d.ts +2 -2
  10. package/dist/src/core/Repo.d.ts +21 -10
  11. package/dist/src/core/RepoManager.d.ts +2 -8
  12. package/dist/src/core/util/NextPushId.d.ts +0 -2
  13. package/dist/src/core/util/util.d.ts +0 -8
  14. package/dist/src/core/view/QueryParams.d.ts +0 -6
  15. package/package.json +13 -16
  16. package/dist/exp/exp/index.d.ts +0 -29
  17. package/dist/exp/index.d.ts +0 -49
  18. package/dist/exp/index.esm.js +0 -15735
  19. package/dist/exp/index.esm.js.map +0 -1
  20. package/dist/exp/index.esm2017.js +0 -15139
  21. package/dist/exp/index.esm2017.js.map +0 -1
  22. package/dist/exp/index.node.cjs.js +0 -15746
  23. package/dist/exp/index.node.cjs.js.map +0 -1
  24. package/dist/exp/index.node.d.ts +0 -83
  25. package/dist/exp/src/api/DataSnapshot.d.ts +0 -99
  26. package/dist/exp/src/api/Database.d.ts +0 -87
  27. package/dist/exp/src/api/Query.d.ts +0 -193
  28. package/dist/exp/src/api/Reference.d.ts +0 -106
  29. package/dist/exp/src/api/TransactionResult.d.ts +0 -30
  30. package/dist/exp/src/api/internal.d.ts +0 -55
  31. package/dist/exp/src/api/onDisconnect.d.ts +0 -60
  32. package/dist/exp/src/api/test_access.d.ts +0 -42
  33. package/dist/exp/src/core/AuthTokenProvider.d.ts +0 -50
  34. package/dist/exp/src/core/CompoundWrite.d.ts +0 -77
  35. package/dist/exp/src/core/PersistentConnection.d.ts +0 -148
  36. package/dist/exp/src/core/ReadonlyRestClient.d.ts +0 -73
  37. package/dist/exp/src/core/Repo.d.ts +0 -121
  38. package/dist/exp/src/core/RepoInfo.d.ts +0 -59
  39. package/dist/exp/src/core/RepoManager.d.ts +0 -78
  40. package/dist/exp/src/core/Repo_transaction.d.ts +0 -33
  41. package/dist/exp/src/core/ServerActions.d.ts +0 -85
  42. package/dist/exp/src/core/SnapshotHolder.d.ts +0 -28
  43. package/dist/exp/src/core/SparseSnapshotTree.d.ts +0 -61
  44. package/dist/exp/src/core/SyncPoint.d.ts +0 -84
  45. package/dist/exp/src/core/SyncTree.d.ts +0 -236
  46. package/dist/exp/src/core/WriteTree.d.ts +0 -295
  47. package/dist/exp/src/core/operation/AckUserWrite.d.ts +0 -42
  48. package/dist/exp/src/core/operation/ListenComplete.d.ts +0 -32
  49. package/dist/exp/src/core/operation/Merge.d.ts +0 -46
  50. package/dist/exp/src/core/operation/Operation.d.ts +0 -78
  51. package/dist/exp/src/core/operation/Overwrite.d.ts +0 -35
  52. package/dist/exp/src/core/snap/ChildrenNode.d.ts +0 -180
  53. package/dist/exp/src/core/snap/IndexMap.d.ts +0 -43
  54. package/dist/exp/src/core/snap/LeafNode.d.ts +0 -107
  55. package/dist/exp/src/core/snap/Node.d.ts +0 -148
  56. package/dist/exp/src/core/snap/childSet.d.ts +0 -34
  57. package/dist/exp/src/core/snap/comparators.d.ts +0 -19
  58. package/dist/exp/src/core/snap/indexes/Index.d.ts +0 -69
  59. package/dist/exp/src/core/snap/indexes/KeyIndex.d.ts +0 -54
  60. package/dist/exp/src/core/snap/indexes/PathIndex.d.ts +0 -54
  61. package/dist/exp/src/core/snap/indexes/PriorityIndex.d.ts +0 -58
  62. package/dist/exp/src/core/snap/indexes/ValueIndex.d.ts +0 -56
  63. package/dist/exp/src/core/snap/nodeFromJSON.d.ts +0 -25
  64. package/dist/exp/src/core/snap/snap.d.ts +0 -29
  65. package/dist/exp/src/core/stats/StatsCollection.d.ts +0 -28
  66. package/dist/exp/src/core/stats/StatsListener.d.ts +0 -31
  67. package/dist/exp/src/core/stats/StatsManager.d.ts +0 -24
  68. package/dist/exp/src/core/stats/StatsReporter.d.ts +0 -33
  69. package/dist/exp/src/core/storage/DOMStorageWrapper.d.ts +0 -55
  70. package/dist/exp/src/core/storage/MemoryStorage.d.ts +0 -29
  71. package/dist/exp/src/core/storage/storage.d.ts +0 -22
  72. package/dist/exp/src/core/util/EventEmitter.d.ts +0 -45
  73. package/dist/exp/src/core/util/ImmutableTree.d.ts +0 -157
  74. package/dist/exp/src/core/util/NextPushId.d.ts +0 -33
  75. package/dist/exp/src/core/util/OnlineMonitor.d.ts +0 -40
  76. package/dist/exp/src/core/util/Path.d.ts +0 -132
  77. package/dist/exp/src/core/util/ServerValues.d.ts +0 -66
  78. package/dist/exp/src/core/util/SortedMap.d.ts +0 -362
  79. package/dist/exp/src/core/util/Tree.d.ts +0 -134
  80. package/dist/exp/src/core/util/VisibilityMonitor.d.ts +0 -30
  81. package/dist/exp/src/core/util/libs/parser.d.ts +0 -37
  82. package/dist/exp/src/core/util/misc.d.ts +0 -19
  83. package/dist/exp/src/core/util/util.d.ts +0 -232
  84. package/dist/exp/src/core/util/validation.d.ts +0 -108
  85. package/dist/exp/src/core/version.d.ts +0 -19
  86. package/dist/exp/src/core/view/CacheNode.d.ts +0 -59
  87. package/dist/exp/src/core/view/Change.d.ts +0 -74
  88. package/dist/exp/src/core/view/ChildChangeAccumulator.d.ts +0 -22
  89. package/dist/exp/src/core/view/CompleteChildSource.d.ts +0 -91
  90. package/dist/exp/src/core/view/Event.d.ts +0 -102
  91. package/dist/exp/src/core/view/EventGenerator.d.ts +0 -77
  92. package/dist/exp/src/core/view/EventQueue.d.ts +0 -99
  93. package/dist/exp/src/core/view/EventRegistration.d.ts +0 -154
  94. package/dist/exp/src/core/view/QueryParams.d.ts +0 -176
  95. package/dist/exp/src/core/view/View.d.ts +0 -97
  96. package/dist/exp/src/core/view/ViewCache.d.ts +0 -70
  97. package/dist/exp/src/core/view/ViewProcessor.d.ts +0 -166
  98. package/dist/exp/src/core/view/filter/IndexedFilter.d.ts +0 -54
  99. package/dist/exp/src/core/view/filter/LimitedFilter.d.ts +0 -94
  100. package/dist/exp/src/core/view/filter/NodeFilter.d.ts +0 -75
  101. package/dist/exp/src/core/view/filter/RangedFilter.d.ts +0 -109
  102. package/dist/exp/src/exp/Database.d.ts +0 -95
  103. package/dist/exp/src/realtime/BrowserPollConnection.d.ts +0 -208
  104. package/dist/exp/src/realtime/Connection.d.ts +0 -119
  105. package/dist/exp/src/realtime/Constants.d.ts +0 -26
  106. package/dist/exp/src/realtime/Transport.d.ts +0 -62
  107. package/dist/exp/src/realtime/TransportManager.d.ts +0 -55
  108. package/dist/exp/src/realtime/WebSocketConnection.d.ts +0 -133
  109. package/dist/exp/src/realtime/polling/PacketReceiver.d.ts +0 -41
  110. package/dist/exp/test/browser/crawler_support.test.d.ts +0 -17
  111. package/dist/exp/test/compound_write.test.d.ts +0 -17
  112. package/dist/exp/test/connection.test.d.ts +0 -17
  113. package/dist/exp/test/database.test.d.ts +0 -17
  114. package/dist/exp/test/datasnapshot.test.d.ts +0 -17
  115. package/dist/exp/test/exp/integration.test.d.ts +0 -17
  116. package/dist/exp/test/helpers/EventAccumulator.d.ts +0 -34
  117. package/dist/exp/test/helpers/events.d.ts +0 -37
  118. package/dist/exp/test/helpers/util.d.ts +0 -50
  119. package/dist/exp/test/info.test.d.ts +0 -17
  120. package/dist/exp/test/node.test.d.ts +0 -17
  121. package/dist/exp/test/order.test.d.ts +0 -17
  122. package/dist/exp/test/order_by.test.d.ts +0 -17
  123. package/dist/exp/test/path.test.d.ts +0 -17
  124. package/dist/exp/test/promise.test.d.ts +0 -17
  125. package/dist/exp/test/pushid.test.d.ts +0 -17
  126. package/dist/exp/test/query.test.d.ts +0 -17
  127. package/dist/exp/test/repoinfo.test.d.ts +0 -17
  128. package/dist/exp/test/servervalues.test.d.ts +0 -17
  129. package/dist/exp/test/sortedmap.test.d.ts +0 -17
  130. package/dist/exp/test/sparsesnapshottree.test.d.ts +0 -17
  131. package/dist/exp/test/transaction.test.d.ts +0 -17
  132. package/dist/src/exp/Database.d.ts +0 -95
  133. package/dist/test/exp/integration.test.d.ts +0 -17
  134. package/dist/test/pushid.test.d.ts +0 -17
@@ -1,74 +0,0 @@
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
- /**
19
- * @constructor
20
- * @struct
21
- * @param {!string} type The event type
22
- * @param {!Node} snapshotNode The data
23
- * @param {string=} childName The name for this child, if it's a child event
24
- * @param {Node=} oldSnap Used for intermediate processing of child changed events
25
- * @param {string=} prevName The name for the previous child, if applicable
26
- */
27
- export declare class Change {
28
- type: string;
29
- snapshotNode: Node;
30
- childName?: string;
31
- oldSnap?: Node;
32
- prevName?: string | null;
33
- constructor(type: string, snapshotNode: Node, childName?: string, oldSnap?: Node, prevName?: string | null);
34
- /**
35
- * @param {!Node} snapshot
36
- * @return {!Change}
37
- */
38
- static valueChange(snapshot: Node): Change;
39
- /**
40
- * @param {string} childKey
41
- * @param {!Node} snapshot
42
- * @return {!Change}
43
- */
44
- static childAddedChange(childKey: string, snapshot: Node): Change;
45
- /**
46
- * @param {string} childKey
47
- * @param {!Node} snapshot
48
- * @return {!Change}
49
- */
50
- static childRemovedChange(childKey: string, snapshot: Node): Change;
51
- /**
52
- * @param {string} childKey
53
- * @param {!Node} newSnapshot
54
- * @param {!Node} oldSnapshot
55
- * @return {!Change}
56
- */
57
- static childChangedChange(childKey: string, newSnapshot: Node, oldSnapshot: Node): Change;
58
- /**
59
- * @param {string} childKey
60
- * @param {!Node} snapshot
61
- * @return {!Change}
62
- */
63
- static childMovedChange(childKey: string, snapshot: Node): Change;
64
- /** Event type for a child added */
65
- static CHILD_ADDED: string;
66
- /** Event type for a child removed */
67
- static CHILD_REMOVED: string;
68
- /** Event type for a child changed */
69
- static CHILD_CHANGED: string;
70
- /** Event type for a child moved */
71
- static CHILD_MOVED: string;
72
- /** Event type for a value change */
73
- static VALUE: string;
74
- }
@@ -1,22 +0,0 @@
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 { Change } from './Change';
18
- export declare class ChildChangeAccumulator {
19
- private readonly changeMap;
20
- trackChildChange(change: Change): void;
21
- getChanges(): Change[];
22
- }
@@ -1,91 +0,0 @@
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 '../snap/Node';
18
- import { Index } from '../snap/indexes/Index';
19
- import { WriteTreeRef } from '../WriteTree';
20
- import { ViewCache } from './ViewCache';
21
- /**
22
- * Since updates to filtered nodes might require nodes to be pulled in from "outside" the node, this interface
23
- * can help to get complete children that can be pulled in.
24
- * A class implementing this interface takes potentially multiple sources (e.g. user writes, server data from
25
- * other views etc.) to try it's best to get a complete child that might be useful in pulling into the view.
26
- *
27
- * @interface
28
- */
29
- export interface CompleteChildSource {
30
- /**
31
- * @param {!string} childKey
32
- * @return {?Node}
33
- */
34
- getCompleteChild(childKey: string): Node | null;
35
- /**
36
- * @param {!Index} index
37
- * @param {!NamedNode} child
38
- * @param {boolean} reverse
39
- * @return {?NamedNode}
40
- */
41
- getChildAfterChild(index: Index, child: NamedNode, reverse: boolean): NamedNode | null;
42
- }
43
- /**
44
- * An implementation of CompleteChildSource that never returns any additional children
45
- *
46
- * @private
47
- * @constructor
48
- * @implements CompleteChildSource
49
- */
50
- export declare class NoCompleteChildSource_ implements CompleteChildSource {
51
- /**
52
- * @inheritDoc
53
- */
54
- getCompleteChild(childKey?: string): Node | null;
55
- /**
56
- * @inheritDoc
57
- */
58
- getChildAfterChild(index?: Index, child?: NamedNode, reverse?: boolean): NamedNode | null;
59
- }
60
- /**
61
- * Singleton instance.
62
- * @const
63
- * @type {!CompleteChildSource}
64
- */
65
- export declare const NO_COMPLETE_CHILD_SOURCE: NoCompleteChildSource_;
66
- /**
67
- * An implementation of CompleteChildSource that uses a WriteTree in addition to any other server data or
68
- * old event caches available to calculate complete children.
69
- *
70
- *
71
- * @implements CompleteChildSource
72
- */
73
- export declare class WriteTreeCompleteChildSource implements CompleteChildSource {
74
- private writes_;
75
- private viewCache_;
76
- private optCompleteServerCache_;
77
- /**
78
- * @param {!WriteTreeRef} writes_
79
- * @param {!ViewCache} viewCache_
80
- * @param {?Node} optCompleteServerCache_
81
- */
82
- constructor(writes_: WriteTreeRef, viewCache_: ViewCache, optCompleteServerCache_?: Node | null);
83
- /**
84
- * @inheritDoc
85
- */
86
- getCompleteChild(childKey: string): Node | null;
87
- /**
88
- * @inheritDoc
89
- */
90
- getChildAfterChild(index: Index, child: NamedNode, reverse: boolean): NamedNode | null;
91
- }
@@ -1,102 +0,0 @@
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 { EventRegistration } from './EventRegistration';
19
- import { DataSnapshot } from '../../api/DataSnapshot';
20
- /**
21
- * Encapsulates the data needed to raise an event
22
- * @interface
23
- */
24
- export interface Event {
25
- /**
26
- * @return {!Path}
27
- */
28
- getPath(): Path;
29
- /**
30
- * @return {!string}
31
- */
32
- getEventType(): string;
33
- /**
34
- * @return {!function()}
35
- */
36
- getEventRunner(): () => void;
37
- /**
38
- * @return {!string}
39
- */
40
- toString(): string;
41
- }
42
- export declare type EventType = 'value' | ' child_added' | ' child_changed' | ' child_moved' | ' child_removed';
43
- /**
44
- * Encapsulates the data needed to raise an event
45
- * @implements {Event}
46
- */
47
- export declare class DataEvent implements Event {
48
- eventType: EventType;
49
- eventRegistration: EventRegistration;
50
- snapshot: DataSnapshot;
51
- prevName?: string | null;
52
- /**
53
- * @param {!string} eventType One of: value, child_added, child_changed, child_moved, child_removed
54
- * @param {!EventRegistration} eventRegistration The function to call to with the event data. User provided
55
- * @param {!DataSnapshot} snapshot The data backing the event
56
- * @param {?string=} prevName Optional, the name of the previous child for child_* events.
57
- */
58
- constructor(eventType: EventType, eventRegistration: EventRegistration, snapshot: DataSnapshot, prevName?: string | null);
59
- /**
60
- * @inheritDoc
61
- */
62
- getPath(): Path;
63
- /**
64
- * @inheritDoc
65
- */
66
- getEventType(): string;
67
- /**
68
- * @inheritDoc
69
- */
70
- getEventRunner(): () => void;
71
- /**
72
- * @inheritDoc
73
- */
74
- toString(): string;
75
- }
76
- export declare class CancelEvent implements Event {
77
- eventRegistration: EventRegistration;
78
- error: Error;
79
- path: Path;
80
- /**
81
- * @param {EventRegistration} eventRegistration
82
- * @param {Error} error
83
- * @param {!Path} path
84
- */
85
- constructor(eventRegistration: EventRegistration, error: Error, path: Path);
86
- /**
87
- * @inheritDoc
88
- */
89
- getPath(): Path;
90
- /**
91
- * @inheritDoc
92
- */
93
- getEventType(): string;
94
- /**
95
- * @inheritDoc
96
- */
97
- getEventRunner(): () => void;
98
- /**
99
- * @inheritDoc
100
- */
101
- toString(): string;
102
- }
@@ -1,77 +0,0 @@
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 { Change } from './Change';
19
- import { Query } from '../../api/Query';
20
- import { EventRegistration } from './EventRegistration';
21
- import { Event } from './Event';
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
- * @constructor
28
- */
29
- export declare class EventGenerator {
30
- private query_;
31
- private index_;
32
- /**
33
- *
34
- * @param {!Query} query_
35
- */
36
- constructor(query_: Query);
37
- /**
38
- * Given a set of raw changes (no moved events and prevName not specified yet), and a set of
39
- * EventRegistrations that should be notified of these changes, generate the actual events to be raised.
40
- *
41
- * Notes:
42
- * - child_moved events will be synthesized at this time for any child_changed events that affect
43
- * our index.
44
- * - prevName will be calculated based on the index ordering.
45
- *
46
- * @param {!Array.<!Change>} changes
47
- * @param {!Node} eventCache
48
- * @param {!Array.<!EventRegistration>} eventRegistrations
49
- * @return {!Array.<!Event>}
50
- */
51
- generateEventsForChanges(changes: Change[], eventCache: Node, eventRegistrations: EventRegistration[]): Event[];
52
- /**
53
- * Given changes of a single change type, generate the corresponding events.
54
- *
55
- * @param {!Array.<!Event>} events
56
- * @param {!string} eventType
57
- * @param {!Array.<!Change>} changes
58
- * @param {!Array.<!EventRegistration>} registrations
59
- * @param {!Node} eventCache
60
- * @private
61
- */
62
- private generateEventsForType_;
63
- /**
64
- * @param {!Change} change
65
- * @param {!Node} eventCache
66
- * @return {!Change}
67
- * @private
68
- */
69
- private materializeSingleChange_;
70
- /**
71
- * @param {!Change} a
72
- * @param {!Change} b
73
- * @return {number}
74
- * @private
75
- */
76
- private compareChanges_;
77
- }
@@ -1,99 +0,0 @@
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
- * @constructor
32
- */
33
- export declare class EventQueue {
34
- /**
35
- * @private
36
- * @type {!Array.<EventList>}
37
- */
38
- private eventLists_;
39
- /**
40
- * Tracks recursion depth of raiseQueuedEvents_, for debugging purposes.
41
- * @private
42
- * @type {!number}
43
- */
44
- private recursionDepth_;
45
- /**
46
- * @param {!Array.<Event>} eventDataList The new events to queue.
47
- */
48
- queueEvents(eventDataList: Event[]): void;
49
- /**
50
- * Queues the specified events and synchronously raises all events (including previously queued ones)
51
- * for the specified path.
52
- *
53
- * It is assumed that the new events are all for the specified path.
54
- *
55
- * @param {!Path} path The path to raise events for.
56
- * @param {!Array.<Event>} eventDataList The new events to raise.
57
- */
58
- raiseEventsAtPath(path: Path, eventDataList: Event[]): void;
59
- /**
60
- * Queues the specified events and synchronously raises all events (including previously queued ones) for
61
- * locations related to the specified change path (i.e. all ancestors and descendants).
62
- *
63
- * It is assumed that the new events are all related (ancestor or descendant) to the specified path.
64
- *
65
- * @param {!Path} changedPath The path to raise events for.
66
- * @param {!Array.<!Event>} eventDataList The events to raise
67
- */
68
- raiseEventsForChangedPath(changedPath: Path, eventDataList: Event[]): void;
69
- /**
70
- * @param {!function(!Path):boolean} predicate
71
- * @private
72
- */
73
- private raiseQueuedEventsMatchingPredicate_;
74
- }
75
- /**
76
- * @param {!Path} path
77
- * @constructor
78
- */
79
- export declare class EventList {
80
- private readonly path_;
81
- /**
82
- * @type {!Array.<Event>}
83
- * @private
84
- */
85
- private events_;
86
- constructor(path_: Path);
87
- /**
88
- * @param {!Event} eventData
89
- */
90
- add(eventData: Event): void;
91
- /**
92
- * Iterates through the list and raises each event
93
- */
94
- raise(): void;
95
- /**
96
- * @return {!Path}
97
- */
98
- getPath(): Path;
99
- }
@@ -1,154 +0,0 @@
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/DataSnapshot';
18
- import { DataEvent, CancelEvent, Event } from './Event';
19
- import { Path } from '../util/Path';
20
- import { Change } from './Change';
21
- import { Query } from '../../api/Query';
22
- /**
23
- * An EventRegistration is basically an event type ('value', 'child_added', etc.) and a callback
24
- * to be notified of that type of event.
25
- *
26
- * That said, it can also contain a cancel callback to be notified if the event is canceled. And
27
- * currently, this code is organized around the idea that you would register multiple child_ callbacks
28
- * together, as a single EventRegistration. Though currently we don't do that.
29
- */
30
- export interface EventRegistration {
31
- /**
32
- * True if this container has a callback to trigger for this event type
33
- * @param {!string} eventType
34
- * @return {boolean}
35
- */
36
- respondsTo(eventType: string): boolean;
37
- /**
38
- * @param {!Change} change
39
- * @param {!Query} query
40
- * @return {!Event}
41
- */
42
- createEvent(change: Change, query: Query): Event;
43
- /**
44
- * Given event data, return a function to trigger the user's callback
45
- * @param {!Event} eventData
46
- * @return {function()}
47
- */
48
- getEventRunner(eventData: Event): () => void;
49
- /**
50
- * @param {!Error} error
51
- * @param {!Path} path
52
- * @return {?CancelEvent}
53
- */
54
- createCancelEvent(error: Error, path: Path): CancelEvent | null;
55
- /**
56
- * @param {!EventRegistration} other
57
- * @return {boolean}
58
- */
59
- matches(other: EventRegistration): boolean;
60
- /**
61
- * False basically means this is a "dummy" callback container being used as a sentinel
62
- * to remove all callback containers of a particular type. (e.g. if the user does
63
- * ref.off('value') without specifying a specific callback).
64
- *
65
- * (TODO: Rework this, since it's hacky)
66
- *
67
- * @return {boolean}
68
- */
69
- hasAnyCallback(): boolean;
70
- }
71
- /**
72
- * Represents registration for 'value' events.
73
- */
74
- export declare class ValueEventRegistration implements EventRegistration {
75
- private callback_;
76
- private cancelCallback_;
77
- private context_;
78
- /**
79
- * @param {?function(!DataSnapshot)} callback_
80
- * @param {?function(Error)} cancelCallback_
81
- * @param {?Object} context_
82
- */
83
- constructor(callback_: ((d: DataSnapshot) => void) | null, cancelCallback_: ((e: Error) => void) | null, context_: {} | null);
84
- /**
85
- * @inheritDoc
86
- */
87
- respondsTo(eventType: string): boolean;
88
- /**
89
- * @inheritDoc
90
- */
91
- createEvent(change: Change, query: Query): DataEvent;
92
- /**
93
- * @inheritDoc
94
- */
95
- getEventRunner(eventData: CancelEvent | DataEvent): () => void;
96
- /**
97
- * @inheritDoc
98
- */
99
- createCancelEvent(error: Error, path: Path): CancelEvent | null;
100
- /**
101
- * @inheritDoc
102
- */
103
- matches(other: EventRegistration): boolean;
104
- /**
105
- * @inheritDoc
106
- */
107
- hasAnyCallback(): boolean;
108
- }
109
- /**
110
- * Represents the registration of 1 or more child_xxx events.
111
- *
112
- * Currently, it is always exactly 1 child_xxx event, but the idea is we might let you
113
- * register a group of callbacks together in the future.
114
- *
115
- * @constructor
116
- * @implements {EventRegistration}
117
- */
118
- export declare class ChildEventRegistration implements EventRegistration {
119
- private callbacks_;
120
- private cancelCallback_;
121
- private context_?;
122
- /**
123
- * @param {?Object.<string, function(!DataSnapshot, ?string=)>} callbacks_
124
- * @param {?function(Error)} cancelCallback_
125
- * @param {Object=} context_
126
- */
127
- constructor(callbacks_: {
128
- [k: string]: (d: DataSnapshot, s?: string | null) => void;
129
- } | null, cancelCallback_: ((e: Error) => void) | null, context_?: {});
130
- /**
131
- * @inheritDoc
132
- */
133
- respondsTo(eventType: string): boolean;
134
- /**
135
- * @inheritDoc
136
- */
137
- createCancelEvent(error: Error, path: Path): CancelEvent | null;
138
- /**
139
- * @inheritDoc
140
- */
141
- createEvent(change: Change, query: Query): DataEvent;
142
- /**
143
- * @inheritDoc
144
- */
145
- getEventRunner(eventData: CancelEvent | DataEvent): () => void;
146
- /**
147
- * @inheritDoc
148
- */
149
- matches(other: EventRegistration): boolean;
150
- /**
151
- * @inheritDoc
152
- */
153
- hasAnyCallback(): boolean;
154
- }