File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -85,8 +85,13 @@ export class RefBuilder {
8585 eventType : 'ref.write' ,
8686 resource : this . resource ,
8787 dataConstructor,
88- before : ( payload ) => this . apps . retain ( payload ) ,
89- after : ( payload ) => this . apps . release ( payload ) ,
88+ before : ( event ) => {
89+ _ . forEach ( event . params , ( val , key ) => {
90+ event . resource = _ . replace ( event . resource , `{${ key } }` , val ) ;
91+ } ) ;
92+ this . apps . retain ( event ) ;
93+ } ,
94+ after : ( event ) => this . apps . release ( event ) ,
9095 } ) ;
9196 }
9297}
@@ -105,9 +110,6 @@ export class DeltaSnapshot implements firebase.database.DataSnapshot {
105110 constructor ( private app : firebase . app . App , private adminApp : firebase . app . App , event : Event < any > ) {
106111 if ( event ) {
107112 let resourceRegex = `projects/([^/]+)/instances/([^/]+)/refs(/.+)?` ;
108- _ . forEach ( event . params , ( val , key ) => {
109- event . resource = _ . replace ( event . resource , `{${ key } }` , val ) ;
110- } ) ;
111113 let match = event . resource . match ( new RegExp ( resourceRegex ) ) ;
112114 if ( ! match ) {
113115 throw new Error ( `Unexpected resource string for Firebase Realtime Database event: ${ event . resource } . ` +
You can’t perform that action at this time.
0 commit comments