@@ -32,9 +32,9 @@ import { DeploymentOptions } from "../function-configuration";
32
32
33
33
export { DataSnapshot } ;
34
34
35
- /** @hidden */
35
+ /** @internal */
36
36
export const provider = "google.firebase.database" ;
37
- /** @hidden */
37
+ /** @internal */
38
38
export const service = "firebaseio.com" ;
39
39
40
40
const databaseURLRegex = new RegExp ( "^https://([^.]+)." ) ;
@@ -44,6 +44,7 @@ const emulatorDatabaseURLRegex = new RegExp("^http://.*ns=([^&]+)");
44
44
* Registers a function that triggers on events from a specific
45
45
* Firebase Realtime Database instance.
46
46
*
47
+ * @remarks
47
48
* Use this method together with `ref` to specify the instance on which to
48
49
* watch for database events. For example: `firebase.database.instance('my-app-db-2').ref('/foo/bar')`
49
50
*
@@ -52,7 +53,7 @@ const emulatorDatabaseURLRegex = new RegExp("^http://.*ns=([^&]+)");
52
53
*
53
54
* @param instance The instance name of the database instance
54
55
* to watch for write events.
55
- * @return Firebase Realtime Database instance builder interface.
56
+ * @returns Firebase Realtime Database instance builder interface.
56
57
*/
57
58
export function instance ( instance : string ) {
58
59
return _instanceWithOptions ( instance , { } ) ;
@@ -62,13 +63,15 @@ export function instance(instance: string) {
62
63
* Registers a function that triggers on Firebase Realtime Database write
63
64
* events.
64
65
*
66
+ * @remarks
65
67
* This method behaves very similarly to the method of the same name in the
66
68
* client and Admin Firebase SDKs. Any change to the Database that affects the
67
69
* data at or below the provided `path` will fire an event in Cloud Functions.
68
70
*
69
71
* There are three important differences between listening to a Realtime
70
72
* Database event in Cloud Functions and using the Realtime Database in the
71
73
* client and Admin SDKs:
74
+ *
72
75
* 1. Cloud Functions allows wildcards in the `path` name. Any `path` component
73
76
* in curly brackets (`{}`) is a wildcard that matches all strings. The value
74
77
* that matched a certain invocation of a Cloud Function is returned as part
@@ -77,20 +80,22 @@ export function instance(instance: string) {
77
80
* `/messages/message1` or `/messages/message2`, resulting in
78
81
* `event.params.messageId` being set to `"message1"` or `"message2"`,
79
82
* respectively.
83
+ *
80
84
* 2. Cloud Functions do not fire an event for data that already existed before
81
85
* the Cloud Function was deployed.
86
+ *
82
87
* 3. Cloud Function events have access to more information, including a
83
88
* snapshot of the previous event data and information about the user who
84
89
* triggered the Cloud Function.
85
90
*
86
91
* @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.
88
93
*/
89
94
export function ref < Ref extends string > ( path : Ref ) {
90
95
return _refWithOptions ( path , { } ) ;
91
96
}
92
97
93
- /** @hidden */
98
+ /** @internal */
94
99
export function _instanceWithOptions (
95
100
instance : string ,
96
101
options : DeploymentOptions
@@ -104,11 +109,10 @@ export function _instanceWithOptions(
104
109
* Access via [`database.instance()`](providers_database_.html#instance).
105
110
*/
106
111
export class InstanceBuilder {
107
- /** @hidden */
108
112
constructor ( private instance : string , private options : DeploymentOptions ) { }
109
113
110
114
/**
111
- * @return Firebase Realtime Database reference builder interface.
115
+ * @returns Firebase Realtime Database reference builder interface.
112
116
*/
113
117
ref < Ref extends string > ( path : Ref ) : RefBuilder < Ref > {
114
118
const normalized = normalizePath ( path ) ;
@@ -119,7 +123,7 @@ export class InstanceBuilder {
119
123
}
120
124
}
121
125
122
- /** @hidden */
126
+ /** @internal */
123
127
export function _refWithOptions < Ref extends string > (
124
128
path : Ref ,
125
129
options : DeploymentOptions
@@ -163,7 +167,6 @@ export function _refWithOptions<Ref extends string>(
163
167
* Access via [`functions.database.ref()`](functions.database#.ref).
164
168
*/
165
169
export class RefBuilder < Ref extends string > {
166
- /** @hidden */
167
170
constructor ( private triggerResource : ( ) => string , private options : DeploymentOptions ) { }
168
171
169
172
/**
@@ -172,7 +175,7 @@ export class RefBuilder<Ref extends string> {
172
175
*
173
176
* @param handler Event handler that runs every time a Firebase Realtime Database
174
177
* write occurs.
175
- * @return A Cloud Function that you can export and deploy.
178
+ * @returns A Cloud Function that you can export and deploy.
176
179
*/
177
180
onWrite (
178
181
handler : (
@@ -189,7 +192,7 @@ export class RefBuilder<Ref extends string> {
189
192
*
190
193
* @param handler Event handler which is run every time a Firebase Realtime Database
191
194
* write occurs.
192
- * @return A Cloud
195
+ * @returns A Cloud
193
196
* Function which you can export and deploy.
194
197
*/
195
198
onUpdate (
@@ -207,7 +210,7 @@ export class RefBuilder<Ref extends string> {
207
210
*
208
211
* @param handler Event handler that runs every time new data is created in
209
212
* 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.
211
214
*/
212
215
onCreate (
213
216
handler : (
@@ -231,7 +234,7 @@ export class RefBuilder<Ref extends string> {
231
234
*
232
235
* @param handler Event handler that runs every time data is deleted from
233
236
* 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.
235
238
*/
236
239
onDelete (
237
240
handler : (
@@ -294,8 +297,9 @@ const resourceRegex = /^projects\/([^/]+)\/instances\/([a-zA-Z0-9-]+)\/refs(\/.+
294
297
* It defaults to `firebaseio.com`.
295
298
* Multi-region RTDB will be served from different domains.
296
299
* Since region is not part of the resource name, it is provided through context.
300
+ *
301
+ * @internal
297
302
*/
298
- /** @hidden */
299
303
export function extractInstanceAndPath ( resource : string , domain = "firebaseio.com" ) {
300
304
const match = resource . match ( new RegExp ( resourceRegex ) ) ;
301
305
if ( ! match ) {
0 commit comments