Skip to content

Commit 922295d

Browse files
authored
Minor fixes for v1/database docs. (#1202)
1 parent 637b191 commit 922295d

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

src/v1/providers/database.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ import { DeploymentOptions } from "../function-configuration";
3232

3333
export { DataSnapshot };
3434

35-
/** @hidden */
35+
/** @internal */
3636
export const provider = "google.firebase.database";
37-
/** @hidden */
37+
/** @internal */
3838
export const service = "firebaseio.com";
3939

4040
const databaseURLRegex = new RegExp("^https://([^.]+).");
@@ -44,6 +44,7 @@ const emulatorDatabaseURLRegex = new RegExp("^http://.*ns=([^&]+)");
4444
* Registers a function that triggers on events from a specific
4545
* Firebase Realtime Database instance.
4646
*
47+
* @remarks
4748
* Use this method together with `ref` to specify the instance on which to
4849
* watch for database events. For example: `firebase.database.instance('my-app-db-2').ref('/foo/bar')`
4950
*
@@ -52,7 +53,7 @@ const emulatorDatabaseURLRegex = new RegExp("^http://.*ns=([^&]+)");
5253
*
5354
* @param instance The instance name of the database instance
5455
* to watch for write events.
55-
* @return Firebase Realtime Database instance builder interface.
56+
* @returns Firebase Realtime Database instance builder interface.
5657
*/
5758
export function instance(instance: string) {
5859
return _instanceWithOptions(instance, {});
@@ -62,13 +63,15 @@ export function instance(instance: string) {
6263
* Registers a function that triggers on Firebase Realtime Database write
6364
* events.
6465
*
66+
* @remarks
6567
* This method behaves very similarly to the method of the same name in the
6668
* client and Admin Firebase SDKs. Any change to the Database that affects the
6769
* data at or below the provided `path` will fire an event in Cloud Functions.
6870
*
6971
* There are three important differences between listening to a Realtime
7072
* Database event in Cloud Functions and using the Realtime Database in the
7173
* client and Admin SDKs:
74+
*
7275
* 1. Cloud Functions allows wildcards in the `path` name. Any `path` component
7376
* in curly brackets (`{}`) is a wildcard that matches all strings. The value
7477
* that matched a certain invocation of a Cloud Function is returned as part
@@ -77,20 +80,22 @@ export function instance(instance: string) {
7780
* `/messages/message1` or `/messages/message2`, resulting in
7881
* `event.params.messageId` being set to `"message1"` or `"message2"`,
7982
* respectively.
83+
*
8084
* 2. Cloud Functions do not fire an event for data that already existed before
8185
* the Cloud Function was deployed.
86+
*
8287
* 3. Cloud Function events have access to more information, including a
8388
* snapshot of the previous event data and information about the user who
8489
* triggered the Cloud Function.
8590
*
8691
* @param path The path within the Database to watch for write events.
87-
* @return Firebase Realtime Database builder interface.
92+
* @returns Firebase Realtime Database builder interface.
8893
*/
8994
export function ref<Ref extends string>(path: Ref) {
9095
return _refWithOptions(path, {});
9196
}
9297

93-
/** @hidden */
98+
/** @internal */
9499
export function _instanceWithOptions(
95100
instance: string,
96101
options: DeploymentOptions
@@ -104,11 +109,10 @@ export function _instanceWithOptions(
104109
* Access via [`database.instance()`](providers_database_.html#instance).
105110
*/
106111
export class InstanceBuilder {
107-
/** @hidden */
108112
constructor(private instance: string, private options: DeploymentOptions) {}
109113

110114
/**
111-
* @return Firebase Realtime Database reference builder interface.
115+
* @returns Firebase Realtime Database reference builder interface.
112116
*/
113117
ref<Ref extends string>(path: Ref): RefBuilder<Ref> {
114118
const normalized = normalizePath(path);
@@ -119,7 +123,7 @@ export class InstanceBuilder {
119123
}
120124
}
121125

122-
/** @hidden */
126+
/** @internal */
123127
export function _refWithOptions<Ref extends string>(
124128
path: Ref,
125129
options: DeploymentOptions
@@ -163,7 +167,6 @@ export function _refWithOptions<Ref extends string>(
163167
* Access via [`functions.database.ref()`](functions.database#.ref).
164168
*/
165169
export class RefBuilder<Ref extends string> {
166-
/** @hidden */
167170
constructor(private triggerResource: () => string, private options: DeploymentOptions) {}
168171

169172
/**
@@ -172,7 +175,7 @@ export class RefBuilder<Ref extends string> {
172175
*
173176
* @param handler Event handler that runs every time a Firebase Realtime Database
174177
* write occurs.
175-
* @return A Cloud Function that you can export and deploy.
178+
* @returns A Cloud Function that you can export and deploy.
176179
*/
177180
onWrite(
178181
handler: (
@@ -189,7 +192,7 @@ export class RefBuilder<Ref extends string> {
189192
*
190193
* @param handler Event handler which is run every time a Firebase Realtime Database
191194
* write occurs.
192-
* @return A Cloud
195+
* @returns A Cloud
193196
* Function which you can export and deploy.
194197
*/
195198
onUpdate(
@@ -207,7 +210,7 @@ export class RefBuilder<Ref extends string> {
207210
*
208211
* @param handler Event handler that runs every time new data is created in
209212
* Firebase Realtime Database.
210-
* @return A Cloud Function that you can export and deploy.
213+
* @returns A Cloud Function that you can export and deploy.
211214
*/
212215
onCreate(
213216
handler: (
@@ -231,7 +234,7 @@ export class RefBuilder<Ref extends string> {
231234
*
232235
* @param handler Event handler that runs every time data is deleted from
233236
* Firebase Realtime Database.
234-
* @return A Cloud Function that you can export and deploy.
237+
* @returns A Cloud Function that you can export and deploy.
235238
*/
236239
onDelete(
237240
handler: (
@@ -294,8 +297,9 @@ const resourceRegex = /^projects\/([^/]+)\/instances\/([a-zA-Z0-9-]+)\/refs(\/.+
294297
* It defaults to `firebaseio.com`.
295298
* Multi-region RTDB will be served from different domains.
296299
* Since region is not part of the resource name, it is provided through context.
300+
*
301+
* @internal
297302
*/
298-
/** @hidden */
299303
export function extractInstanceAndPath(resource: string, domain = "firebaseio.com") {
300304
const match = resource.match(new RegExp(resourceRegex));
301305
if (!match) {

0 commit comments

Comments
 (0)