@firebase/database 0.8.3-canary.f7e30543a → 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 -29
  18. package/dist/exp/index.esm.js +0 -14942
  19. package/dist/exp/index.esm.js.map +0 -1
  20. package/dist/exp/index.esm2017.js +0 -14358
  21. package/dist/exp/index.esm2017.js.map +0 -1
  22. package/dist/exp/index.node.cjs.js +0 -14953
  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,60 +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 { Repo } from '../core/Repo';
18
- import { Path } from '../core/util/Path';
19
- import { Indexable } from '../core/util/misc';
20
- /**
21
- * @constructor
22
- */
23
- export declare class OnDisconnect {
24
- private repo_;
25
- private path_;
26
- /**
27
- * @param {!Repo} repo_
28
- * @param {!Path} path_
29
- */
30
- constructor(repo_: Repo, path_: Path);
31
- /**
32
- * @param {function(?Error)=} onComplete
33
- * @return {!firebase.Promise}
34
- */
35
- cancel(onComplete?: (a: Error | null) => void): Promise<void>;
36
- /**
37
- * @param {function(?Error)=} onComplete
38
- * @return {!firebase.Promise}
39
- */
40
- remove(onComplete?: (a: Error | null) => void): Promise<void>;
41
- /**
42
- * @param {*} value
43
- * @param {function(?Error)=} onComplete
44
- * @return {!firebase.Promise}
45
- */
46
- set(value: unknown, onComplete?: (a: Error | null) => void): Promise<void>;
47
- /**
48
- * @param {*} value
49
- * @param {number|string|null} priority
50
- * @param {function(?Error)=} onComplete
51
- * @return {!firebase.Promise}
52
- */
53
- setWithPriority(value: unknown, priority: number | string | null, onComplete?: (a: Error | null) => void): Promise<void>;
54
- /**
55
- * @param {!Object} objectToMerge
56
- * @param {function(?Error)=} onComplete
57
- * @return {!firebase.Promise}
58
- */
59
- update(objectToMerge: Indexable, onComplete?: (a: Error | null) => void): Promise<void>;
60
- }
@@ -1,42 +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 { RepoInfo } from '../core/RepoInfo';
18
- import { PersistentConnection } from '../core/PersistentConnection';
19
- import { Connection } from '../realtime/Connection';
20
- import { Query } from './Query';
21
- export declare const DataConnection: typeof PersistentConnection;
22
- export declare const RealTimeConnection: typeof Connection;
23
- /**
24
- * @param {function(): string} newHash
25
- * @return {function()}
26
- */
27
- export declare const hijackHash: (newHash: () => string) => () => void;
28
- /**
29
- * @type {function(new:RepoInfo, !string, boolean, !string, boolean): undefined}
30
- */
31
- export declare const ConnectionTarget: typeof RepoInfo;
32
- /**
33
- * @param {!Query} query
34
- * @return {!string}
35
- */
36
- export declare const queryIdentifier: (query: Query) => string;
37
- /**
38
- * Forces the RepoManager to create Repos that use ReadonlyRestClient instead of PersistentConnection.
39
- *
40
- * @param {boolean} forceRestClient
41
- */
42
- export declare const forceRestClient: (forceRestClient: boolean) => void;
@@ -1,50 +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 { FirebaseAuthTokenData } from '@firebase/app-types/private';
18
- import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
19
- import { Provider } from '@firebase/component';
20
- import { FirebaseAppLike } from './RepoManager';
21
- export interface AuthTokenProvider {
22
- getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData>;
23
- addTokenChangeListener(listener: (token: string | null) => void): void;
24
- removeTokenChangeListener(listener: (token: string | null) => void): void;
25
- notifyForInvalidToken(): void;
26
- }
27
- /**
28
- * Abstraction around FirebaseApp's token fetching capabilities.
29
- */
30
- export declare class FirebaseAuthTokenProvider implements AuthTokenProvider {
31
- private app_;
32
- private authProvider_;
33
- private auth_;
34
- constructor(app_: FirebaseAppLike, authProvider_: Provider<FirebaseAuthInternalName>);
35
- /**
36
- * @param {boolean} forceRefresh
37
- * @return {!Promise<FirebaseAuthTokenData>}
38
- */
39
- getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData>;
40
- addTokenChangeListener(listener: (token: string | null) => void): void;
41
- removeTokenChangeListener(listener: (token: string | null) => void): void;
42
- notifyForInvalidToken(): void;
43
- }
44
- export declare class EmulatorAdminTokenProvider implements AuthTokenProvider {
45
- private static EMULATOR_AUTH_TOKEN;
46
- getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData>;
47
- addTokenChangeListener(listener: (token: string | null) => void): void;
48
- removeTokenChangeListener(listener: (token: string | null) => void): void;
49
- notifyForInvalidToken(): void;
50
- }
@@ -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 { ImmutableTree } from './util/ImmutableTree';
18
- import { Path } from './util/Path';
19
- import { Node, NamedNode } from './snap/Node';
20
- /**
21
- * This class holds a collection of writes that can be applied to nodes in unison. It abstracts away the logic with
22
- * dealing with priority writes and multiple nested writes. At any given path there is only allowed to be one write
23
- * modifying that path. Any write to an existing path or shadowing an existing path will modify that existing write
24
- * to reflect the write added.
25
- */
26
- export declare class CompoundWrite {
27
- private writeTree_;
28
- constructor(writeTree_: ImmutableTree<Node>);
29
- static Empty: CompoundWrite;
30
- addWrite(path: Path, node: Node): CompoundWrite;
31
- addWrites(path: Path, updates: {
32
- [name: string]: Node;
33
- }): CompoundWrite;
34
- /**
35
- * Will remove a write at the given path and deeper paths. This will <em>not</em> modify a write at a higher
36
- * location, which must be removed by calling this method with that path.
37
- *
38
- * @param path The path at which a write and all deeper writes should be removed
39
- * @return {!CompoundWrite} The new CompoundWrite with the removed path
40
- */
41
- removeWrite(path: Path): CompoundWrite;
42
- /**
43
- * Returns whether this CompoundWrite will fully overwrite a node at a given location and can therefore be
44
- * considered "complete".
45
- *
46
- * @param path The path to check for
47
- * @return Whether there is a complete write at that path
48
- */
49
- hasCompleteWrite(path: Path): boolean;
50
- /**
51
- * Returns a node for a path if and only if the node is a "complete" overwrite at that path. This will not aggregate
52
- * writes from deeper paths, but will return child nodes from a more shallow path.
53
- *
54
- * @param path The path to get a complete write
55
- * @return The node if complete at that path, or null otherwise.
56
- */
57
- getCompleteNode(path: Path): Node | null;
58
- /**
59
- * Returns all children that are guaranteed to be a complete overwrite.
60
- *
61
- * @return A list of all complete children.
62
- */
63
- getCompleteChildren(): NamedNode[];
64
- childCompoundWrite(path: Path): CompoundWrite;
65
- /**
66
- * Returns true if this CompoundWrite is empty and therefore does not modify any nodes.
67
- * @return Whether this CompoundWrite is empty
68
- */
69
- isEmpty(): boolean;
70
- /**
71
- * Applies this CompoundWrite to a node. The node is returned with all writes from this CompoundWrite applied to the
72
- * node
73
- * @param node The node to apply this CompoundWrite to
74
- * @return The node with all writes applied
75
- */
76
- apply(node: Node): Node;
77
- }
@@ -1,148 +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 { ServerActions } from './ServerActions';
18
- import { AuthTokenProvider } from './AuthTokenProvider';
19
- import { RepoInfo } from './RepoInfo';
20
- import { Query } from '../api/Query';
21
- /**
22
- * Firebase connection. Abstracts wire protocol and handles reconnecting.
23
- *
24
- * NOTE: All JSON objects sent to the realtime connection must have property names enclosed
25
- * in quotes to make sure the closure compiler does not minify them.
26
- */
27
- export declare class PersistentConnection extends ServerActions {
28
- private repoInfo_;
29
- private applicationId_;
30
- private onDataUpdate_;
31
- private onConnectStatus_;
32
- private onServerInfoUpdate_;
33
- private authTokenProvider_;
34
- private authOverride_?;
35
- id: number;
36
- private log_;
37
- private interruptReasons_;
38
- /** Map<path, Map<queryId, ListenSpec>> */
39
- private readonly listens;
40
- private outstandingPuts_;
41
- private outstandingGets_;
42
- private outstandingPutCount_;
43
- private outstandingGetCount_;
44
- private onDisconnectRequestQueue_;
45
- private connected_;
46
- private reconnectDelay_;
47
- private maxReconnectDelay_;
48
- private securityDebugCallback_;
49
- lastSessionId: string | null;
50
- private establishConnectionTimer_;
51
- private visible_;
52
- private requestCBHash_;
53
- private requestNumber_;
54
- private realtime_;
55
- private authToken_;
56
- private forceTokenRefresh_;
57
- private invalidAuthTokenCount_;
58
- private firstConnection_;
59
- private lastConnectionAttemptTime_;
60
- private lastConnectionEstablishedTime_;
61
- private static nextPersistentConnectionId_;
62
- /**
63
- * Counter for number of connections created. Mainly used for tagging in the logs
64
- */
65
- private static nextConnectionId_;
66
- /**
67
- * @implements {ServerActions}
68
- * @param repoInfo_ Data about the namespace we are connecting to
69
- * @param applicationId_ The Firebase App ID for this project
70
- * @param onDataUpdate_ A callback for new data from the server
71
- */
72
- constructor(repoInfo_: RepoInfo, applicationId_: string, onDataUpdate_: (a: string, b: unknown, c: boolean, d: number | null) => void, onConnectStatus_: (a: boolean) => void, onServerInfoUpdate_: (a: unknown) => void, authTokenProvider_: AuthTokenProvider, authOverride_?: object | null);
73
- protected sendRequest(action: string, body: unknown, onResponse?: (a: unknown) => void): void;
74
- get(query: Query): Promise<string>;
75
- /**
76
- * @inheritDoc
77
- */
78
- listen(query: Query, currentHashFn: () => string, tag: number | null, onComplete: (a: string, b: unknown) => void): void;
79
- private sendGet_;
80
- private sendListen_;
81
- private static warnOnListenWarnings_;
82
- /**
83
- * @inheritDoc
84
- */
85
- refreshAuthToken(token: string): void;
86
- private reduceReconnectDelayIfAdminCredential_;
87
- /**
88
- * Attempts to authenticate with the given credentials. If the authentication attempt fails, it's triggered like
89
- * a auth revoked (the connection is closed).
90
- */
91
- tryAuth(): void;
92
- /**
93
- * @inheritDoc
94
- */
95
- unlisten(query: Query, tag: number | null): void;
96
- private sendUnlisten_;
97
- /**
98
- * @inheritDoc
99
- */
100
- onDisconnectPut(pathString: string, data: unknown, onComplete?: (a: string, b: string) => void): void;
101
- /**
102
- * @inheritDoc
103
- */
104
- onDisconnectMerge(pathString: string, data: unknown, onComplete?: (a: string, b: string) => void): void;
105
- /**
106
- * @inheritDoc
107
- */
108
- onDisconnectCancel(pathString: string, onComplete?: (a: string, b: string) => void): void;
109
- private sendOnDisconnect_;
110
- /**
111
- * @inheritDoc
112
- */
113
- put(pathString: string, data: unknown, onComplete?: (a: string, b: string) => void, hash?: string): void;
114
- /**
115
- * @inheritDoc
116
- */
117
- merge(pathString: string, data: unknown, onComplete: (a: string, b: string | null) => void, hash?: string): void;
118
- putInternal(action: string, pathString: string, data: unknown, onComplete: (a: string, b: string | null) => void, hash?: string): void;
119
- private sendPut_;
120
- /**
121
- * @inheritDoc
122
- */
123
- reportStats(stats: {
124
- [k: string]: unknown;
125
- }): void;
126
- private onDataMessage_;
127
- private onDataPush_;
128
- private onReady_;
129
- private scheduleConnect_;
130
- private onVisible_;
131
- private onOnline_;
132
- private onRealtimeDisconnect_;
133
- private establishConnection_;
134
- interrupt(reason: string): void;
135
- resume(reason: string): void;
136
- private handleTimestamp_;
137
- private cancelSentTransactions_;
138
- private onListenRevoked_;
139
- private removeListen_;
140
- private onAuthRevoked_;
141
- private onSecurityDebugPacket_;
142
- private restoreState_;
143
- /**
144
- * Sends client stats for first connection
145
- */
146
- private sendConnectStats_;
147
- private shouldReconnect_;
148
- }
@@ -1,73 +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 { ServerActions } from './ServerActions';
18
- import { RepoInfo } from './RepoInfo';
19
- import { AuthTokenProvider } from './AuthTokenProvider';
20
- import { Query } from '../api/Query';
21
- /**
22
- * An implementation of ServerActions that communicates with the server via REST requests.
23
- * This is mostly useful for compatibility with crawlers, where we don't want to spin up a full
24
- * persistent connection (using WebSockets or long-polling)
25
- */
26
- export declare class ReadonlyRestClient extends ServerActions {
27
- private repoInfo_;
28
- private onDataUpdate_;
29
- private authTokenProvider_;
30
- reportStats(stats: {
31
- [k: string]: unknown;
32
- }): void;
33
- /** @private {function(...[*])} */
34
- private log_;
35
- /**
36
- * We don't actually need to track listens, except to prevent us calling an onComplete for a listen
37
- * that's been removed. :-/
38
- *
39
- * @private {!Object.<string, !Object>}
40
- */
41
- private listens_;
42
- /**
43
- * @param {!Query} query
44
- * @param {?number=} tag
45
- * @return {string}
46
- * @private
47
- */
48
- static getListenId_(query: Query, tag?: number | null): string;
49
- /**
50
- * @param {!RepoInfo} repoInfo_ Data about the namespace we are connecting to
51
- * @param {function(string, *, boolean, ?number)} onDataUpdate_ A callback for new data from the server
52
- * @param {AuthTokenProvider} authTokenProvider_
53
- * @implements {ServerActions}
54
- */
55
- constructor(repoInfo_: RepoInfo, onDataUpdate_: (a: string, b: unknown, c: boolean, d: number | null) => void, authTokenProvider_: AuthTokenProvider);
56
- /** @inheritDoc */
57
- listen(query: Query, currentHashFn: () => string, tag: number | null, onComplete: (a: string, b: unknown) => void): void;
58
- /** @inheritDoc */
59
- unlisten(query: Query, tag: number | null): void;
60
- get(query: Query): Promise<string>;
61
- /** @inheritDoc */
62
- refreshAuthToken(token: string): void;
63
- /**
64
- * Performs a REST request to the given path, with the provided query string parameters,
65
- * and any auth credentials we have.
66
- *
67
- * @param {!string} pathString
68
- * @param {!Object.<string, *>} queryStringParameters
69
- * @param {?function(?number, *=)} callback
70
- * @private
71
- */
72
- private restRequest_;
73
- }
@@ -1,121 +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 { AuthTokenProvider } from './AuthTokenProvider';
19
- import { PersistentConnection } from './PersistentConnection';
20
- import { RepoInfo } from './RepoInfo';
21
- import { Database } from '../api/Database';
22
- import { DataSnapshot } from '../api/DataSnapshot';
23
- import { Query } from '../api/Query';
24
- import { EventRegistration } from './view/EventRegistration';
25
- import { Indexable } from './util/misc';
26
- import { FirebaseAppLike } from './RepoManager';
27
- /**
28
- * A connection to a single data repository.
29
- */
30
- export declare class Repo {
31
- repoInfo_: RepoInfo;
32
- private forceRestClient_;
33
- app: FirebaseAppLike;
34
- authTokenProvider_: AuthTokenProvider;
35
- /** Key for uniquely identifying this repo, used in RepoManager */
36
- readonly key: string;
37
- dataUpdateCount: number;
38
- private infoSyncTree_;
39
- private serverSyncTree_;
40
- private stats_;
41
- private statsListener_;
42
- private eventQueue_;
43
- private nextWriteId_;
44
- private server_;
45
- private statsReporter_;
46
- private transactionsInit_;
47
- private infoData_;
48
- private abortTransactions_;
49
- private rerunTransactions_;
50
- private interceptServerDataCallback_;
51
- private __database;
52
- /** A list of data pieces and paths to be set when this client disconnects. */
53
- private onDisconnect_;
54
- persistentConnection_: PersistentConnection | null;
55
- constructor(repoInfo_: RepoInfo, forceRestClient_: boolean, app: FirebaseAppLike, authTokenProvider_: AuthTokenProvider);
56
- start(): void;
57
- /**
58
- * @return The URL corresponding to the root of this Firebase.
59
- */
60
- toString(): string;
61
- /**
62
- * @return The namespace represented by the repo.
63
- */
64
- name(): string;
65
- /**
66
- * @return The time in milliseconds, taking the server offset into account if we have one.
67
- */
68
- serverTime(): number;
69
- /**
70
- * Generate ServerValues using some variables from the repo object.
71
- */
72
- generateServerValues(): Indexable;
73
- /**
74
- * Called by realtime when we get new messages from the server.
75
- */
76
- private onDataUpdate_;
77
- interceptServerData_(callback: ((a: string, b: unknown) => unknown) | null): void;
78
- private onConnectStatus_;
79
- private onServerInfoUpdate_;
80
- private updateInfo_;
81
- private getNextWriteId_;
82
- /**
83
- * The purpose of `getValue` is to return the latest known value
84
- * satisfying `query`.
85
- *
86
- * This method will first check for in-memory cached values
87
- * belonging to active listeners. If they are found, such values
88
- * are considered to be the most up-to-date.
89
- *
90
- * If the client is not connected, this method will try to
91
- * establish a connection and request the value for `query`. If
92
- * the client is not able to retrieve the query result, it reports
93
- * an error.
94
- *
95
- * @param query - The query to surface a value for.
96
- */
97
- getValue(query: Query): Promise<DataSnapshot>;
98
- setWithPriority(path: Path, newVal: unknown, newPriority: number | string | null, onComplete: ((status: Error | null, errorReason?: string) => void) | null): void;
99
- update(path: Path, childrenToMerge: {
100
- [k: string]: unknown;
101
- }, onComplete: ((status: Error | null, errorReason?: string) => void) | null): void;
102
- /**
103
- * Applies all of the changes stored up in the onDisconnect_ tree.
104
- */
105
- private runOnDisconnectEvents_;
106
- onDisconnectCancel(path: Path, onComplete: ((status: Error | null, errorReason?: string) => void) | null): void;
107
- onDisconnectSet(path: Path, value: unknown, onComplete: ((status: Error | null, errorReason?: string) => void) | null): void;
108
- onDisconnectSetWithPriority(path: Path, value: unknown, priority: unknown, onComplete: ((status: Error | null, errorReason?: string) => void) | null): void;
109
- onDisconnectUpdate(path: Path, childrenToMerge: {
110
- [k: string]: unknown;
111
- }, onComplete: ((status: Error | null, errorReason?: string) => void) | null): void;
112
- addEventCallbackForQuery(query: Query, eventRegistration: EventRegistration): void;
113
- removeEventCallbackForQuery(query: Query, eventRegistration: EventRegistration): void;
114
- interrupt(): void;
115
- resume(): void;
116
- stats(showDelta?: boolean): void;
117
- statsIncrementCounter(metric: string): void;
118
- private log_;
119
- callOnCompleteCallback(callback: ((status: Error | null, errorReason?: string) => void) | null, status: string, errorReason?: string | null): void;
120
- get database(): Database;
121
- }
@@ -1,59 +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
- /**
18
- * A class that holds metadata about a Repo object
19
- *
20
- * @constructor
21
- */
22
- export declare class RepoInfo {
23
- readonly secure: boolean;
24
- readonly namespace: string;
25
- readonly webSocketOnly: boolean;
26
- readonly nodeAdmin: boolean;
27
- readonly persistenceKey: string;
28
- readonly includeNamespaceInQueryParams: boolean;
29
- host: string;
30
- domain: string;
31
- internalHost: string;
32
- /**
33
- * @param host Hostname portion of the url for the repo
34
- * @param secure Whether or not this repo is accessed over ssl
35
- * @param namespace The namespace represented by the repo
36
- * @param webSocketOnly Whether to prefer websockets over all other transports (used by Nest).
37
- * @param nodeAdmin Whether this instance uses Admin SDK credentials
38
- * @param persistenceKey Override the default session persistence storage key
39
- */
40
- constructor(host: string, secure: boolean, namespace: string, webSocketOnly: boolean, nodeAdmin?: boolean, persistenceKey?: string, includeNamespaceInQueryParams?: boolean);
41
- needsQueryParam(): boolean;
42
- isCacheableHost(): boolean;
43
- isDemoHost(): boolean;
44
- isCustomHost(): boolean;
45
- updateHost(newHost: string): void;
46
- /**
47
- * Returns the websocket URL for this repo
48
- * @param {string} type of connection
49
- * @param {Object} params list
50
- * @return {string} The URL for this repo
51
- */
52
- connectionURL(type: string, params: {
53
- [k: string]: string;
54
- }): string;
55
- /** @return {string} */
56
- toString(): string;
57
- /** @return {string} */
58
- toURLString(): string;
59
- }