Skip to content

Commit b1d42b9

Browse files
Add database@exp API docs (#4738)
1 parent dd562b0 commit b1d42b9

35 files changed

+1393
-198
lines changed

packages/database/src/api/Database.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class Database implements FirebaseService, Compat<ExpDatabase> {
6969
* location.
7070
* @throws If a Reference is provided, throws if it does not belong to the
7171
* same project.
72-
* @return Firebase reference.
72+
* @returns Firebase reference.
7373
*/
7474
ref(path?: string): Reference;
7575
ref(path?: Reference): Reference;
@@ -88,7 +88,7 @@ export class Database implements FirebaseService, Compat<ExpDatabase> {
8888
* Returns a reference to the root or the path specified in url.
8989
* We throw a exception if the url is not in the same domain as the
9090
* current repo.
91-
* @return Firebase reference.
91+
* @returns Firebase reference.
9292
*/
9393
refFromURL(url: string): Reference {
9494
const apiName = 'database.refFromURL';

packages/database/src/api/Reference.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class DataSnapshot implements Compat<ExpDataSnapshot> {
8585
* Retrieves the snapshot contents as JSON. Returns null if the snapshot is
8686
* empty.
8787
*
88-
* @return JSON representation of the DataSnapshot contents, or null if empty.
88+
* @returns JSON representation of the DataSnapshot contents, or null if empty.
8989
*/
9090
val(): unknown {
9191
validateArgCount('DataSnapshot.val', 0, 0, arguments.length);
@@ -95,7 +95,7 @@ export class DataSnapshot implements Compat<ExpDataSnapshot> {
9595
/**
9696
* Returns the snapshot contents as JSON, including priorities of node. Suitable for exporting
9797
* the entire node contents.
98-
* @return JSON representation of the DataSnapshot contents, or null if empty.
98+
* @returns JSON representation of the DataSnapshot contents, or null if empty.
9999
*/
100100
exportVal(): unknown {
101101
validateArgCount('DataSnapshot.exportVal', 0, 0, arguments.length);
@@ -113,7 +113,7 @@ export class DataSnapshot implements Compat<ExpDataSnapshot> {
113113
/**
114114
* Returns whether the snapshot contains a non-null value.
115115
*
116-
* @return Whether the snapshot contains a non-null value, or is empty.
116+
* @returns Whether the snapshot contains a non-null value, or is empty.
117117
*/
118118
exists(): boolean {
119119
validateArgCount('DataSnapshot.exists', 0, 0, arguments.length);
@@ -124,7 +124,7 @@ export class DataSnapshot implements Compat<ExpDataSnapshot> {
124124
* Returns a DataSnapshot of the specified child node's contents.
125125
*
126126
* @param path Path to a child.
127-
* @return DataSnapshot for child node.
127+
* @returns DataSnapshot for child node.
128128
*/
129129
child(path: string): DataSnapshot {
130130
validateArgCount('DataSnapshot.child', 0, 1, arguments.length);
@@ -138,7 +138,7 @@ export class DataSnapshot implements Compat<ExpDataSnapshot> {
138138
* Returns whether the snapshot contains a child at the specified path.
139139
*
140140
* @param path Path to a child.
141-
* @return Whether the child exists.
141+
* @returns Whether the child exists.
142142
*/
143143
hasChild(path: string): boolean {
144144
validateArgCount('DataSnapshot.hasChild', 1, 1, arguments.length);
@@ -149,7 +149,7 @@ export class DataSnapshot implements Compat<ExpDataSnapshot> {
149149
/**
150150
* Returns the priority of the object, or null if no priority was set.
151151
*
152-
* @return The priority.
152+
* @returns The priority.
153153
*/
154154
getPriority(): string | number | null {
155155
validateArgCount('DataSnapshot.getPriority', 0, 0, arguments.length);
@@ -161,7 +161,7 @@ export class DataSnapshot implements Compat<ExpDataSnapshot> {
161161
*
162162
* @param action Callback function to be called
163163
* for each child.
164-
* @return True if forEach was canceled by action returning true for
164+
* @returns True if forEach was canceled by action returning true for
165165
* one of the child nodes.
166166
*/
167167
forEach(action: (snapshot: DataSnapshot) => boolean | void): boolean {
@@ -174,7 +174,7 @@ export class DataSnapshot implements Compat<ExpDataSnapshot> {
174174

175175
/**
176176
* Returns whether this DataSnapshot has children.
177-
* @return True if the DataSnapshot contains 1 or more child nodes.
177+
* @returns True if the DataSnapshot contains 1 or more child nodes.
178178
*/
179179
hasChildren(): boolean {
180180
validateArgCount('DataSnapshot.hasChildren', 0, 0, arguments.length);
@@ -187,15 +187,15 @@ export class DataSnapshot implements Compat<ExpDataSnapshot> {
187187

188188
/**
189189
* Returns the number of children for this DataSnapshot.
190-
* @return The number of children that this DataSnapshot contains.
190+
* @returns The number of children that this DataSnapshot contains.
191191
*/
192192
numChildren(): number {
193193
validateArgCount('DataSnapshot.numChildren', 0, 0, arguments.length);
194194
return this._delegate.size;
195195
}
196196

197197
/**
198-
* @return The Firebase reference for the location this snapshot's data came
198+
* @returns The Firebase reference for the location this snapshot's data came
199199
* from.
200200
*/
201201
getRef(): Reference {
@@ -472,7 +472,7 @@ export class Query implements Compat<QueryImpl> {
472472
}
473473

474474
/**
475-
* @return URL for this location.
475+
* @returns URL for this location.
476476
*/
477477
toString(): string {
478478
validateArgCount('Query.toString', 0, 0, arguments.length);
@@ -563,7 +563,7 @@ export class Reference extends Query implements Compat<ReferenceImpl> {
563563
);
564564
}
565565

566-
/** @return {?string} */
566+
/** @returns {?string} */
567567
getKey(): string | null {
568568
validateArgCount('Reference.key', 0, 0, arguments.length);
569569
return this._delegate.key;
@@ -577,14 +577,14 @@ export class Reference extends Query implements Compat<ReferenceImpl> {
577577
return new Reference(this.database, child(this._delegate, pathString));
578578
}
579579

580-
/** @return {?Reference} */
580+
/** @returns {?Reference} */
581581
getParent(): Reference | null {
582582
validateArgCount('Reference.parent', 0, 0, arguments.length);
583583
const parent = this._delegate.parent;
584584
return parent ? new Reference(this.database, parent) : null;
585585
}
586586

587-
/** @return {!Reference} */
587+
/** @returns {!Reference} */
588588
getRoot(): Reference {
589589
validateArgCount('Reference.root', 0, 0, arguments.length);
590590
return new Reference(this.database, this._delegate.root);

packages/database/src/core/CompoundWrite.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function compoundWriteAddWrites(
8787
*
8888
* @param compoundWrite The CompoundWrite to remove.
8989
* @param path The path at which a write and all deeper writes should be removed
90-
* @return The new CompoundWrite with the removed path
90+
* @returns The new CompoundWrite with the removed path
9191
*/
9292
export function compoundWriteRemoveWrite(
9393
compoundWrite: CompoundWrite,
@@ -110,7 +110,7 @@ export function compoundWriteRemoveWrite(
110110
*
111111
* @param compoundWrite The CompoundWrite to check.
112112
* @param path The path to check for
113-
* @return Whether there is a complete write at that path
113+
* @returns Whether there is a complete write at that path
114114
*/
115115
export function compoundWriteHasCompleteWrite(
116116
compoundWrite: CompoundWrite,
@@ -125,7 +125,7 @@ export function compoundWriteHasCompleteWrite(
125125
*
126126
* @param compoundWrite The CompoundWrite to get the node from.
127127
* @param path The path to get a complete write
128-
* @return The node if complete at that path, or null otherwise.
128+
* @returns The node if complete at that path, or null otherwise.
129129
*/
130130
export function compoundWriteGetCompleteNode(
131131
compoundWrite: CompoundWrite,
@@ -145,7 +145,7 @@ export function compoundWriteGetCompleteNode(
145145
* Returns all children that are guaranteed to be a complete overwrite.
146146
*
147147
* @param compoundWrite The CompoundWrite to get children from.
148-
* @return A list of all complete children.
148+
* @returns A list of all complete children.
149149
*/
150150
export function compoundWriteGetCompleteChildren(
151151
compoundWrite: CompoundWrite
@@ -192,7 +192,7 @@ export function compoundWriteChildCompoundWrite(
192192

193193
/**
194194
* Returns true if this CompoundWrite is empty and therefore does not modify any nodes.
195-
* @return Whether this CompoundWrite is empty
195+
* @returns Whether this CompoundWrite is empty
196196
*/
197197
export function compoundWriteIsEmpty(compoundWrite: CompoundWrite): boolean {
198198
return compoundWrite.writeTree_.isEmpty();
@@ -202,7 +202,7 @@ export function compoundWriteIsEmpty(compoundWrite: CompoundWrite): boolean {
202202
* Applies this CompoundWrite to a node. The node is returned with all writes from this CompoundWrite applied to the
203203
* node
204204
* @param node The node to apply this CompoundWrite to
205-
* @return The node with all writes applied
205+
* @returns The node with all writes applied
206206
*/
207207
export function compoundWriteApply(
208208
compoundWrite: CompoundWrite,

packages/database/src/core/Repo.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export class Repo {
193193
}
194194

195195
/**
196-
* @return The URL corresponding to the root of this Firebase.
196+
* @returns The URL corresponding to the root of this Firebase.
197197
*/
198198
toString(): string {
199199
return (
@@ -319,7 +319,7 @@ export function repoStart(
319319
}
320320

321321
/**
322-
* @return The time in milliseconds, taking the server offset into account if we have one.
322+
* @returns The time in milliseconds, taking the server offset into account if we have one.
323323
*/
324324
export function repoServerTime(repo: Repo): number {
325325
const offsetNode = repo.infoData_.getNode(new Path('.info/serverTimeOffset'));
@@ -1147,7 +1147,7 @@ function repoSendTransactionQueue(
11471147
* is the path at which events need to be raised for.
11481148
*
11491149
* @param changedPath The path in mergedData that changed.
1150-
* @return The rootmost path that was affected by rerunning transactions.
1150+
* @returns The rootmost path that was affected by rerunning transactions.
11511151
*/
11521152
function repoRerunTransactions(repo: Repo, changedPath: Path): Path {
11531153
const rootMostTransactionNode = repoGetAncestorTransactionNode(
@@ -1329,7 +1329,7 @@ function repoRerunTransactionQueue(
13291329
* no pending transactions on any ancestor.
13301330
*
13311331
* @param path The location to start at.
1332-
* @return The rootmost node with a transaction.
1332+
* @returns The rootmost node with a transaction.
13331333
*/
13341334
function repoGetAncestorTransactionNode(
13351335
repo: Repo,
@@ -1355,7 +1355,7 @@ function repoGetAncestorTransactionNode(
13551355
* transactionNode.
13561356
*
13571357
* @param transactionNode
1358-
* @return The generated queue.
1358+
* @returns The generated queue.
13591359
*/
13601360
function repoBuildTransactionQueue(
13611361
repo: Repo,

packages/database/src/core/SparseSnapshotTree.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function newSparseSnapshotTree(): SparseSnapshotTree {
3939
* Only seems to be used in tests.
4040
*
4141
* @param path Path to look up snapshot for.
42-
* @return The retrieved node, or null.
42+
* @returns The retrieved node, or null.
4343
*/
4444
export function sparseSnapshotTreeFind(
4545
sparseSnapshotTree: SparseSnapshotTree,
@@ -94,7 +94,7 @@ export function sparseSnapshotTreeRemember(
9494
* Purge the data at path from the cache.
9595
*
9696
* @param path Path to look up snapshot for.
97-
* @return True if this node should now be removed.
97+
* @returns True if this node should now be removed.
9898
*/
9999
export function sparseSnapshotTreeForget(
100100
sparseSnapshotTree: SparseSnapshotTree,

packages/database/src/core/SyncPoint.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export function syncPointApplyOperation(
119119
* @param writesCache
120120
* @param serverCache
121121
* @param serverCacheComplete
122-
* @return Events to raise.
122+
* @returns Events to raise.
123123
*/
124124
export function syncPointGetView(
125125
syncPoint: SyncPoint,
@@ -166,7 +166,7 @@ export function syncPointGetView(
166166
* @param writesCache
167167
* @param serverCache Complete server cache, if we have it.
168168
* @param serverCacheComplete
169-
* @return Events to raise.
169+
* @returns Events to raise.
170170
*/
171171
export function syncPointAddEventRegistration(
172172
syncPoint: SyncPoint,
@@ -199,7 +199,7 @@ export function syncPointAddEventRegistration(
199199
*
200200
* @param eventRegistration If null, remove all callbacks.
201201
* @param cancelError If a cancelError is provided, appropriate cancel events will be returned.
202-
* @return removed queries and any cancel events
202+
* @returns removed queries and any cancel events
203203
*/
204204
export function syncPointRemoveEventRegistration(
205205
syncPoint: SyncPoint,
@@ -266,7 +266,7 @@ export function syncPointGetQueryViews(syncPoint: SyncPoint): View[] {
266266

267267
/**
268268
* @param path The path to the desired complete snapshot
269-
* @return A complete cache, if it exists
269+
* @returns A complete cache, if it exists
270270
*/
271271
export function syncPointGetCompleteServerCache(
272272
syncPoint: SyncPoint,

0 commit comments

Comments
 (0)