@firebase/database-compat 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/database-compat/src/api/Database.d.ts +74 -74
- package/dist/database-compat/src/api/Reference.d.ts +207 -207
- package/dist/database-compat/src/api/TransactionResult.d.ts +26 -26
- package/dist/database-compat/src/api/internal.d.ts +41 -41
- package/dist/database-compat/src/api/onDisconnect.d.ts +27 -27
- package/dist/database-compat/src/index.d.ts +32 -32
- package/dist/database-compat/src/index.node.d.ts +30 -30
- package/dist/database-compat/src/index.standalone.d.ts +52 -52
- package/dist/database-compat/src/util/util.d.ts +17 -17
- package/dist/database-compat/src/util/validation.d.ts +18 -18
- package/dist/database-compat/test/browser/crawler_support.test.d.ts +17 -17
- package/dist/database-compat/test/database.test.d.ts +17 -17
- package/dist/database-compat/test/datasnapshot.test.d.ts +17 -17
- package/dist/database-compat/test/helpers/events.d.ts +34 -34
- package/dist/database-compat/test/helpers/util.d.ts +42 -42
- package/dist/database-compat/test/info.test.d.ts +17 -17
- package/dist/database-compat/test/order.test.d.ts +17 -17
- package/dist/database-compat/test/order_by.test.d.ts +17 -17
- package/dist/database-compat/test/promise.test.d.ts +17 -17
- package/dist/database-compat/test/query.test.d.ts +17 -17
- package/dist/database-compat/test/servervalues.test.d.ts +17 -17
- package/dist/database-compat/test/transaction.test.d.ts +17 -17
- package/dist/index.esm2017.js +830 -830
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.js +830 -830
- package/dist/index.js.map +1 -1
- package/dist/index.standalone.js +14762 -14762
- package/dist/index.standalone.js.map +1 -1
- package/dist/node-esm/database-compat/src/api/Database.d.ts +74 -74
- package/dist/node-esm/database-compat/src/api/Reference.d.ts +207 -207
- package/dist/node-esm/database-compat/src/api/TransactionResult.d.ts +26 -26
- package/dist/node-esm/database-compat/src/api/internal.d.ts +41 -41
- package/dist/node-esm/database-compat/src/api/onDisconnect.d.ts +27 -27
- package/dist/node-esm/database-compat/src/index.d.ts +32 -32
- package/dist/node-esm/database-compat/src/index.node.d.ts +30 -30
- package/dist/node-esm/database-compat/src/index.standalone.d.ts +52 -52
- package/dist/node-esm/database-compat/src/util/util.d.ts +17 -17
- package/dist/node-esm/database-compat/src/util/validation.d.ts +18 -18
- package/dist/node-esm/database-compat/test/browser/crawler_support.test.d.ts +17 -17
- package/dist/node-esm/database-compat/test/database.test.d.ts +17 -17
- package/dist/node-esm/database-compat/test/datasnapshot.test.d.ts +17 -17
- package/dist/node-esm/database-compat/test/helpers/events.d.ts +34 -34
- package/dist/node-esm/database-compat/test/helpers/util.d.ts +42 -42
- package/dist/node-esm/database-compat/test/info.test.d.ts +17 -17
- package/dist/node-esm/database-compat/test/order.test.d.ts +17 -17
- package/dist/node-esm/database-compat/test/order_by.test.d.ts +17 -17
- package/dist/node-esm/database-compat/test/promise.test.d.ts +17 -17
- package/dist/node-esm/database-compat/test/query.test.d.ts +17 -17
- package/dist/node-esm/database-compat/test/servervalues.test.d.ts +17 -17
- package/dist/node-esm/database-compat/test/transaction.test.d.ts +17 -17
- package/dist/node-esm/index.js +830 -830
- package/dist/node-esm/index.js.map +1 -1
- package/package.json +8 -8
@@ -1,74 +1,74 @@
|
|
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 { FirebaseApp } from '@firebase/app-types';
|
18
|
-
import { FirebaseService } from '@firebase/app-types/private';
|
19
|
-
import { forceLongPolling, forceWebSockets, Database as ModularDatabase } from '@firebase/database';
|
20
|
-
import { Compat, EmulatorMockTokenOptions } from '@firebase/util';
|
21
|
-
import { Reference } from './Reference';
|
22
|
-
/**
|
23
|
-
* Class representing a firebase database.
|
24
|
-
*/
|
25
|
-
export declare class Database implements FirebaseService, Compat<ModularDatabase> {
|
26
|
-
readonly _delegate: ModularDatabase;
|
27
|
-
readonly app: FirebaseApp;
|
28
|
-
static readonly ServerValue: {
|
29
|
-
TIMESTAMP: object;
|
30
|
-
increment: (delta: number) => object;
|
31
|
-
};
|
32
|
-
/**
|
33
|
-
* The constructor should not be called by users of our public API.
|
34
|
-
*/
|
35
|
-
constructor(_delegate: ModularDatabase, app: FirebaseApp);
|
36
|
-
INTERNAL: {
|
37
|
-
delete: () => Promise<void>;
|
38
|
-
forceWebSockets: typeof forceWebSockets;
|
39
|
-
forceLongPolling: typeof forceLongPolling;
|
40
|
-
};
|
41
|
-
/**
|
42
|
-
* Modify this instance to communicate with the Realtime Database emulator.
|
43
|
-
*
|
44
|
-
* <p>Note: This method must be called before performing any other operation.
|
45
|
-
*
|
46
|
-
* @param host - the emulator host (ex: localhost)
|
47
|
-
* @param port - the emulator port (ex: 8080)
|
48
|
-
* @param options.mockUserToken - the mock auth token to use for unit testing Security Rules
|
49
|
-
*/
|
50
|
-
useEmulator(host: string, port: number, options?: {
|
51
|
-
mockUserToken?: EmulatorMockTokenOptions;
|
52
|
-
}): void;
|
53
|
-
/**
|
54
|
-
* Returns a reference to the root or to the path specified in the provided
|
55
|
-
* argument.
|
56
|
-
*
|
57
|
-
* @param path - The relative string path or an existing Reference to a database
|
58
|
-
* location.
|
59
|
-
* @throws If a Reference is provided, throws if it does not belong to the
|
60
|
-
* same project.
|
61
|
-
* @returns Firebase reference.
|
62
|
-
*/
|
63
|
-
ref(path?: string): Reference;
|
64
|
-
ref(path?: Reference): Reference;
|
65
|
-
/**
|
66
|
-
* Returns a reference to the root or the path specified in url.
|
67
|
-
* We throw a exception if the url is not in the same domain as the
|
68
|
-
* current repo.
|
69
|
-
* @returns Firebase reference.
|
70
|
-
*/
|
71
|
-
refFromURL(url: string): Reference;
|
72
|
-
goOffline(): void;
|
73
|
-
goOnline(): void;
|
74
|
-
}
|
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 { FirebaseApp } from '@firebase/app-types';
|
18
|
+
import { FirebaseService } from '@firebase/app-types/private';
|
19
|
+
import { forceLongPolling, forceWebSockets, Database as ModularDatabase } from '@firebase/database';
|
20
|
+
import { Compat, EmulatorMockTokenOptions } from '@firebase/util';
|
21
|
+
import { Reference } from './Reference';
|
22
|
+
/**
|
23
|
+
* Class representing a firebase database.
|
24
|
+
*/
|
25
|
+
export declare class Database implements FirebaseService, Compat<ModularDatabase> {
|
26
|
+
readonly _delegate: ModularDatabase;
|
27
|
+
readonly app: FirebaseApp;
|
28
|
+
static readonly ServerValue: {
|
29
|
+
TIMESTAMP: object;
|
30
|
+
increment: (delta: number) => object;
|
31
|
+
};
|
32
|
+
/**
|
33
|
+
* The constructor should not be called by users of our public API.
|
34
|
+
*/
|
35
|
+
constructor(_delegate: ModularDatabase, app: FirebaseApp);
|
36
|
+
INTERNAL: {
|
37
|
+
delete: () => Promise<void>;
|
38
|
+
forceWebSockets: typeof forceWebSockets;
|
39
|
+
forceLongPolling: typeof forceLongPolling;
|
40
|
+
};
|
41
|
+
/**
|
42
|
+
* Modify this instance to communicate with the Realtime Database emulator.
|
43
|
+
*
|
44
|
+
* <p>Note: This method must be called before performing any other operation.
|
45
|
+
*
|
46
|
+
* @param host - the emulator host (ex: localhost)
|
47
|
+
* @param port - the emulator port (ex: 8080)
|
48
|
+
* @param options.mockUserToken - the mock auth token to use for unit testing Security Rules
|
49
|
+
*/
|
50
|
+
useEmulator(host: string, port: number, options?: {
|
51
|
+
mockUserToken?: EmulatorMockTokenOptions;
|
52
|
+
}): void;
|
53
|
+
/**
|
54
|
+
* Returns a reference to the root or to the path specified in the provided
|
55
|
+
* argument.
|
56
|
+
*
|
57
|
+
* @param path - The relative string path or an existing Reference to a database
|
58
|
+
* location.
|
59
|
+
* @throws If a Reference is provided, throws if it does not belong to the
|
60
|
+
* same project.
|
61
|
+
* @returns Firebase reference.
|
62
|
+
*/
|
63
|
+
ref(path?: string): Reference;
|
64
|
+
ref(path?: Reference): Reference;
|
65
|
+
/**
|
66
|
+
* Returns a reference to the root or the path specified in url.
|
67
|
+
* We throw a exception if the url is not in the same domain as the
|
68
|
+
* current repo.
|
69
|
+
* @returns Firebase reference.
|
70
|
+
*/
|
71
|
+
refFromURL(url: string): Reference;
|
72
|
+
goOffline(): void;
|
73
|
+
goOnline(): void;
|
74
|
+
}
|
@@ -1,207 +1,207 @@
|
|
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 ModularDataSnapshot, Query as ExpQuery, DatabaseReference as ModularReference } from '@firebase/database';
|
18
|
-
import { Compat } from '@firebase/util';
|
19
|
-
import { Database } from './Database';
|
20
|
-
import { OnDisconnect } from './onDisconnect';
|
21
|
-
import { TransactionResult } from './TransactionResult';
|
22
|
-
/**
|
23
|
-
* Class representing a firebase data snapshot. It wraps a SnapshotNode and
|
24
|
-
* surfaces the public methods (val, forEach, etc.) we want to expose.
|
25
|
-
*/
|
26
|
-
export declare class DataSnapshot implements Compat<ModularDataSnapshot> {
|
27
|
-
readonly _database: Database;
|
28
|
-
readonly _delegate: ModularDataSnapshot;
|
29
|
-
constructor(_database: Database, _delegate: ModularDataSnapshot);
|
30
|
-
/**
|
31
|
-
* Retrieves the snapshot contents as JSON. Returns null if the snapshot is
|
32
|
-
* empty.
|
33
|
-
*
|
34
|
-
* @returns JSON representation of the DataSnapshot contents, or null if empty.
|
35
|
-
*/
|
36
|
-
val(): unknown;
|
37
|
-
/**
|
38
|
-
* Returns the snapshot contents as JSON, including priorities of node. Suitable for exporting
|
39
|
-
* the entire node contents.
|
40
|
-
* @returns JSON representation of the DataSnapshot contents, or null if empty.
|
41
|
-
*/
|
42
|
-
exportVal(): unknown;
|
43
|
-
toJSON(): unknown;
|
44
|
-
/**
|
45
|
-
* Returns whether the snapshot contains a non-null value.
|
46
|
-
*
|
47
|
-
* @returns Whether the snapshot contains a non-null value, or is empty.
|
48
|
-
*/
|
49
|
-
exists(): boolean;
|
50
|
-
/**
|
51
|
-
* Returns a DataSnapshot of the specified child node's contents.
|
52
|
-
*
|
53
|
-
* @param path - Path to a child.
|
54
|
-
* @returns DataSnapshot for child node.
|
55
|
-
*/
|
56
|
-
child(path: string): DataSnapshot;
|
57
|
-
/**
|
58
|
-
* Returns whether the snapshot contains a child at the specified path.
|
59
|
-
*
|
60
|
-
* @param path - Path to a child.
|
61
|
-
* @returns Whether the child exists.
|
62
|
-
*/
|
63
|
-
hasChild(path: string): boolean;
|
64
|
-
/**
|
65
|
-
* Returns the priority of the object, or null if no priority was set.
|
66
|
-
*
|
67
|
-
* @returns The priority.
|
68
|
-
*/
|
69
|
-
getPriority(): string | number | null;
|
70
|
-
/**
|
71
|
-
* Iterates through child nodes and calls the specified action for each one.
|
72
|
-
*
|
73
|
-
* @param action - Callback function to be called
|
74
|
-
* for each child.
|
75
|
-
* @returns True if forEach was canceled by action returning true for
|
76
|
-
* one of the child nodes.
|
77
|
-
*/
|
78
|
-
forEach(action: (snapshot: IteratedDataSnapshot) => boolean | void): boolean;
|
79
|
-
/**
|
80
|
-
* Returns whether this DataSnapshot has children.
|
81
|
-
* @returns True if the DataSnapshot contains 1 or more child nodes.
|
82
|
-
*/
|
83
|
-
hasChildren(): boolean;
|
84
|
-
get key(): string;
|
85
|
-
/**
|
86
|
-
* Returns the number of children for this DataSnapshot.
|
87
|
-
* @returns The number of children that this DataSnapshot contains.
|
88
|
-
*/
|
89
|
-
numChildren(): number;
|
90
|
-
/**
|
91
|
-
* @returns The Firebase reference for the location this snapshot's data came
|
92
|
-
* from.
|
93
|
-
*/
|
94
|
-
getRef(): Reference;
|
95
|
-
get ref(): Reference;
|
96
|
-
}
|
97
|
-
/**
|
98
|
-
* Represents a child snapshot of a `Reference` that is being iterated over. The key will never be undefined.
|
99
|
-
*/
|
100
|
-
export interface IteratedDataSnapshot extends DataSnapshot {
|
101
|
-
key: string;
|
102
|
-
}
|
103
|
-
export interface SnapshotCallback {
|
104
|
-
(dataSnapshot: DataSnapshot, previousChildName?: string | null): unknown;
|
105
|
-
}
|
106
|
-
/**
|
107
|
-
* A Query represents a filter to be applied to a firebase location. This object purely represents the
|
108
|
-
* query expression (and exposes our public API to build the query). The actual query logic is in ViewBase.js.
|
109
|
-
*
|
110
|
-
* Since every Firebase reference is a query, Firebase inherits from this object.
|
111
|
-
*/
|
112
|
-
export declare class Query implements Compat<ExpQuery> {
|
113
|
-
readonly database: Database;
|
114
|
-
readonly _delegate: ExpQuery;
|
115
|
-
constructor(database: Database, _delegate: ExpQuery);
|
116
|
-
on(eventType: string, callback: SnapshotCallback, cancelCallbackOrContext?: ((a: Error) => unknown) | object | null, context?: object | null): SnapshotCallback;
|
117
|
-
off(eventType?: string, callback?: SnapshotCallback, context?: object | null): void;
|
118
|
-
/**
|
119
|
-
* Get the server-value for this query, or return a cached value if not connected.
|
120
|
-
*/
|
121
|
-
get(): Promise<DataSnapshot>;
|
122
|
-
/**
|
123
|
-
* Attaches a listener, waits for the first event, and then removes the listener
|
124
|
-
*/
|
125
|
-
once(eventType: string, callback?: SnapshotCallback, failureCallbackOrContext?: ((a: Error) => void) | object | null, context?: object | null): Promise<DataSnapshot>;
|
126
|
-
/**
|
127
|
-
* Set a limit and anchor it to the start of the window.
|
128
|
-
*/
|
129
|
-
limitToFirst(limit: number): Query;
|
130
|
-
/**
|
131
|
-
* Set a limit and anchor it to the end of the window.
|
132
|
-
*/
|
133
|
-
limitToLast(limit: number): Query;
|
134
|
-
/**
|
135
|
-
* Given a child path, return a new query ordered by the specified grandchild path.
|
136
|
-
*/
|
137
|
-
orderByChild(path: string): Query;
|
138
|
-
/**
|
139
|
-
* Return a new query ordered by the KeyIndex
|
140
|
-
*/
|
141
|
-
orderByKey(): Query;
|
142
|
-
/**
|
143
|
-
* Return a new query ordered by the PriorityIndex
|
144
|
-
*/
|
145
|
-
orderByPriority(): Query;
|
146
|
-
/**
|
147
|
-
* Return a new query ordered by the ValueIndex
|
148
|
-
*/
|
149
|
-
orderByValue(): Query;
|
150
|
-
startAt(value?: number | string | boolean | null, name?: string | null): Query;
|
151
|
-
startAfter(value?: number | string | boolean | null, name?: string | null): Query;
|
152
|
-
endAt(value?: number | string | boolean | null, name?: string | null): Query;
|
153
|
-
endBefore(value?: number | string | boolean | null, name?: string | null): Query;
|
154
|
-
/**
|
155
|
-
* Load the selection of children with exactly the specified value, and, optionally,
|
156
|
-
* the specified name.
|
157
|
-
*/
|
158
|
-
equalTo(value: number | string | boolean | null, name?: string): Query;
|
159
|
-
/**
|
160
|
-
* @returns URL for this location.
|
161
|
-
*/
|
162
|
-
toString(): string;
|
163
|
-
toJSON(): string;
|
164
|
-
/**
|
165
|
-
* Return true if this query and the provided query are equivalent; otherwise, return false.
|
166
|
-
*/
|
167
|
-
isEqual(other: Query): boolean;
|
168
|
-
/**
|
169
|
-
* Helper used by .on and .once to extract the context and or cancel arguments.
|
170
|
-
* @param fnName - The function name (on or once)
|
171
|
-
*
|
172
|
-
*/
|
173
|
-
private static getCancelAndContextArgs_;
|
174
|
-
get ref(): Reference;
|
175
|
-
}
|
176
|
-
export declare class Reference extends Query implements Compat<ModularReference> {
|
177
|
-
readonly database: Database;
|
178
|
-
readonly _delegate: ModularReference;
|
179
|
-
then: Promise<Reference>['then'];
|
180
|
-
catch: Promise<Reference>['catch'];
|
181
|
-
/**
|
182
|
-
* Call options:
|
183
|
-
* new Reference(Repo, Path) or
|
184
|
-
* new Reference(url: string, string|RepoManager)
|
185
|
-
*
|
186
|
-
* Externally - this is the firebase.database.Reference type.
|
187
|
-
*/
|
188
|
-
constructor(database: Database, _delegate: ModularReference);
|
189
|
-
/** @returns {?string} */
|
190
|
-
getKey(): string | null;
|
191
|
-
child(pathString: string): Reference;
|
192
|
-
/** @returns {?Reference} */
|
193
|
-
getParent(): Reference | null;
|
194
|
-
/** @returns {!Reference} */
|
195
|
-
getRoot(): Reference;
|
196
|
-
set(newVal: unknown, onComplete?: (error: Error | null) => void): Promise<void>;
|
197
|
-
update(values: object, onComplete?: (a: Error | null) => void): Promise<void>;
|
198
|
-
setWithPriority(newVal: unknown, newPriority: string | number | null, onComplete?: (a: Error | null) => void): Promise<void>;
|
199
|
-
remove(onComplete?: (a: Error | null) => void): Promise<void>;
|
200
|
-
transaction(transactionUpdate: (currentData: unknown) => unknown, onComplete?: (error: Error | null, committed: boolean, dataSnapshot: DataSnapshot | null) => void, applyLocally?: boolean): Promise<TransactionResult>;
|
201
|
-
setPriority(priority: string | number | null, onComplete?: (a: Error | null) => void): Promise<void>;
|
202
|
-
push(value?: unknown, onComplete?: (a: Error | null) => void): Reference;
|
203
|
-
onDisconnect(): OnDisconnect;
|
204
|
-
get key(): string | null;
|
205
|
-
get parent(): Reference | null;
|
206
|
-
get root(): Reference;
|
207
|
-
}
|
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 ModularDataSnapshot, Query as ExpQuery, DatabaseReference as ModularReference } from '@firebase/database';
|
18
|
+
import { Compat } from '@firebase/util';
|
19
|
+
import { Database } from './Database';
|
20
|
+
import { OnDisconnect } from './onDisconnect';
|
21
|
+
import { TransactionResult } from './TransactionResult';
|
22
|
+
/**
|
23
|
+
* Class representing a firebase data snapshot. It wraps a SnapshotNode and
|
24
|
+
* surfaces the public methods (val, forEach, etc.) we want to expose.
|
25
|
+
*/
|
26
|
+
export declare class DataSnapshot implements Compat<ModularDataSnapshot> {
|
27
|
+
readonly _database: Database;
|
28
|
+
readonly _delegate: ModularDataSnapshot;
|
29
|
+
constructor(_database: Database, _delegate: ModularDataSnapshot);
|
30
|
+
/**
|
31
|
+
* Retrieves the snapshot contents as JSON. Returns null if the snapshot is
|
32
|
+
* empty.
|
33
|
+
*
|
34
|
+
* @returns JSON representation of the DataSnapshot contents, or null if empty.
|
35
|
+
*/
|
36
|
+
val(): unknown;
|
37
|
+
/**
|
38
|
+
* Returns the snapshot contents as JSON, including priorities of node. Suitable for exporting
|
39
|
+
* the entire node contents.
|
40
|
+
* @returns JSON representation of the DataSnapshot contents, or null if empty.
|
41
|
+
*/
|
42
|
+
exportVal(): unknown;
|
43
|
+
toJSON(): unknown;
|
44
|
+
/**
|
45
|
+
* Returns whether the snapshot contains a non-null value.
|
46
|
+
*
|
47
|
+
* @returns Whether the snapshot contains a non-null value, or is empty.
|
48
|
+
*/
|
49
|
+
exists(): boolean;
|
50
|
+
/**
|
51
|
+
* Returns a DataSnapshot of the specified child node's contents.
|
52
|
+
*
|
53
|
+
* @param path - Path to a child.
|
54
|
+
* @returns DataSnapshot for child node.
|
55
|
+
*/
|
56
|
+
child(path: string): DataSnapshot;
|
57
|
+
/**
|
58
|
+
* Returns whether the snapshot contains a child at the specified path.
|
59
|
+
*
|
60
|
+
* @param path - Path to a child.
|
61
|
+
* @returns Whether the child exists.
|
62
|
+
*/
|
63
|
+
hasChild(path: string): boolean;
|
64
|
+
/**
|
65
|
+
* Returns the priority of the object, or null if no priority was set.
|
66
|
+
*
|
67
|
+
* @returns The priority.
|
68
|
+
*/
|
69
|
+
getPriority(): string | number | null;
|
70
|
+
/**
|
71
|
+
* Iterates through child nodes and calls the specified action for each one.
|
72
|
+
*
|
73
|
+
* @param action - Callback function to be called
|
74
|
+
* for each child.
|
75
|
+
* @returns True if forEach was canceled by action returning true for
|
76
|
+
* one of the child nodes.
|
77
|
+
*/
|
78
|
+
forEach(action: (snapshot: IteratedDataSnapshot) => boolean | void): boolean;
|
79
|
+
/**
|
80
|
+
* Returns whether this DataSnapshot has children.
|
81
|
+
* @returns True if the DataSnapshot contains 1 or more child nodes.
|
82
|
+
*/
|
83
|
+
hasChildren(): boolean;
|
84
|
+
get key(): string;
|
85
|
+
/**
|
86
|
+
* Returns the number of children for this DataSnapshot.
|
87
|
+
* @returns The number of children that this DataSnapshot contains.
|
88
|
+
*/
|
89
|
+
numChildren(): number;
|
90
|
+
/**
|
91
|
+
* @returns The Firebase reference for the location this snapshot's data came
|
92
|
+
* from.
|
93
|
+
*/
|
94
|
+
getRef(): Reference;
|
95
|
+
get ref(): Reference;
|
96
|
+
}
|
97
|
+
/**
|
98
|
+
* Represents a child snapshot of a `Reference` that is being iterated over. The key will never be undefined.
|
99
|
+
*/
|
100
|
+
export interface IteratedDataSnapshot extends DataSnapshot {
|
101
|
+
key: string;
|
102
|
+
}
|
103
|
+
export interface SnapshotCallback {
|
104
|
+
(dataSnapshot: DataSnapshot, previousChildName?: string | null): unknown;
|
105
|
+
}
|
106
|
+
/**
|
107
|
+
* A Query represents a filter to be applied to a firebase location. This object purely represents the
|
108
|
+
* query expression (and exposes our public API to build the query). The actual query logic is in ViewBase.js.
|
109
|
+
*
|
110
|
+
* Since every Firebase reference is a query, Firebase inherits from this object.
|
111
|
+
*/
|
112
|
+
export declare class Query implements Compat<ExpQuery> {
|
113
|
+
readonly database: Database;
|
114
|
+
readonly _delegate: ExpQuery;
|
115
|
+
constructor(database: Database, _delegate: ExpQuery);
|
116
|
+
on(eventType: string, callback: SnapshotCallback, cancelCallbackOrContext?: ((a: Error) => unknown) | object | null, context?: object | null): SnapshotCallback;
|
117
|
+
off(eventType?: string, callback?: SnapshotCallback, context?: object | null): void;
|
118
|
+
/**
|
119
|
+
* Get the server-value for this query, or return a cached value if not connected.
|
120
|
+
*/
|
121
|
+
get(): Promise<DataSnapshot>;
|
122
|
+
/**
|
123
|
+
* Attaches a listener, waits for the first event, and then removes the listener
|
124
|
+
*/
|
125
|
+
once(eventType: string, callback?: SnapshotCallback, failureCallbackOrContext?: ((a: Error) => void) | object | null, context?: object | null): Promise<DataSnapshot>;
|
126
|
+
/**
|
127
|
+
* Set a limit and anchor it to the start of the window.
|
128
|
+
*/
|
129
|
+
limitToFirst(limit: number): Query;
|
130
|
+
/**
|
131
|
+
* Set a limit and anchor it to the end of the window.
|
132
|
+
*/
|
133
|
+
limitToLast(limit: number): Query;
|
134
|
+
/**
|
135
|
+
* Given a child path, return a new query ordered by the specified grandchild path.
|
136
|
+
*/
|
137
|
+
orderByChild(path: string): Query;
|
138
|
+
/**
|
139
|
+
* Return a new query ordered by the KeyIndex
|
140
|
+
*/
|
141
|
+
orderByKey(): Query;
|
142
|
+
/**
|
143
|
+
* Return a new query ordered by the PriorityIndex
|
144
|
+
*/
|
145
|
+
orderByPriority(): Query;
|
146
|
+
/**
|
147
|
+
* Return a new query ordered by the ValueIndex
|
148
|
+
*/
|
149
|
+
orderByValue(): Query;
|
150
|
+
startAt(value?: number | string | boolean | null, name?: string | null): Query;
|
151
|
+
startAfter(value?: number | string | boolean | null, name?: string | null): Query;
|
152
|
+
endAt(value?: number | string | boolean | null, name?: string | null): Query;
|
153
|
+
endBefore(value?: number | string | boolean | null, name?: string | null): Query;
|
154
|
+
/**
|
155
|
+
* Load the selection of children with exactly the specified value, and, optionally,
|
156
|
+
* the specified name.
|
157
|
+
*/
|
158
|
+
equalTo(value: number | string | boolean | null, name?: string): Query;
|
159
|
+
/**
|
160
|
+
* @returns URL for this location.
|
161
|
+
*/
|
162
|
+
toString(): string;
|
163
|
+
toJSON(): string;
|
164
|
+
/**
|
165
|
+
* Return true if this query and the provided query are equivalent; otherwise, return false.
|
166
|
+
*/
|
167
|
+
isEqual(other: Query): boolean;
|
168
|
+
/**
|
169
|
+
* Helper used by .on and .once to extract the context and or cancel arguments.
|
170
|
+
* @param fnName - The function name (on or once)
|
171
|
+
*
|
172
|
+
*/
|
173
|
+
private static getCancelAndContextArgs_;
|
174
|
+
get ref(): Reference;
|
175
|
+
}
|
176
|
+
export declare class Reference extends Query implements Compat<ModularReference> {
|
177
|
+
readonly database: Database;
|
178
|
+
readonly _delegate: ModularReference;
|
179
|
+
then: Promise<Reference>['then'];
|
180
|
+
catch: Promise<Reference>['catch'];
|
181
|
+
/**
|
182
|
+
* Call options:
|
183
|
+
* new Reference(Repo, Path) or
|
184
|
+
* new Reference(url: string, string|RepoManager)
|
185
|
+
*
|
186
|
+
* Externally - this is the firebase.database.Reference type.
|
187
|
+
*/
|
188
|
+
constructor(database: Database, _delegate: ModularReference);
|
189
|
+
/** @returns {?string} */
|
190
|
+
getKey(): string | null;
|
191
|
+
child(pathString: string): Reference;
|
192
|
+
/** @returns {?Reference} */
|
193
|
+
getParent(): Reference | null;
|
194
|
+
/** @returns {!Reference} */
|
195
|
+
getRoot(): Reference;
|
196
|
+
set(newVal: unknown, onComplete?: (error: Error | null) => void): Promise<void>;
|
197
|
+
update(values: object, onComplete?: (a: Error | null) => void): Promise<void>;
|
198
|
+
setWithPriority(newVal: unknown, newPriority: string | number | null, onComplete?: (a: Error | null) => void): Promise<void>;
|
199
|
+
remove(onComplete?: (a: Error | null) => void): Promise<void>;
|
200
|
+
transaction(transactionUpdate: (currentData: unknown) => unknown, onComplete?: (error: Error | null, committed: boolean, dataSnapshot: DataSnapshot | null) => void, applyLocally?: boolean): Promise<TransactionResult>;
|
201
|
+
setPriority(priority: string | number | null, onComplete?: (a: Error | null) => void): Promise<void>;
|
202
|
+
push(value?: unknown, onComplete?: (a: Error | null) => void): Reference;
|
203
|
+
onDisconnect(): OnDisconnect;
|
204
|
+
get key(): string | null;
|
205
|
+
get parent(): Reference | null;
|
206
|
+
get root(): Reference;
|
207
|
+
}
|
@@ -1,26 +1,26 @@
|
|
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 './Reference';
|
18
|
-
export declare class TransactionResult {
|
19
|
-
committed: boolean;
|
20
|
-
snapshot: DataSnapshot;
|
21
|
-
/**
|
22
|
-
* A type for the resolve value of Firebase.transaction.
|
23
|
-
*/
|
24
|
-
constructor(committed: boolean, snapshot: DataSnapshot);
|
25
|
-
toJSON(): object;
|
26
|
-
}
|
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 './Reference';
|
18
|
+
export declare class TransactionResult {
|
19
|
+
committed: boolean;
|
20
|
+
snapshot: DataSnapshot;
|
21
|
+
/**
|
22
|
+
* A type for the resolve value of Firebase.transaction.
|
23
|
+
*/
|
24
|
+
constructor(committed: boolean, snapshot: DataSnapshot);
|
25
|
+
toJSON(): object;
|
26
|
+
}
|