@@ -4,6 +4,8 @@ import {statSync} from 'fs';
4
4
import { isTravisBuild , isTravisMasterBuild } from '../util/travis-ci' ;
5
5
import { buildConfig } from '../packaging/build-config' ;
6
6
import { openFirebaseDashboardApp , openFirebaseDashboardAppAsGuest } from '../util/firebase' ;
7
+ import * as firebaseAdmin from 'firebase-admin' ;
8
+
7
9
8
10
// These imports lack of type definitions.
9
11
const request = require ( 'request' ) ;
@@ -66,7 +68,8 @@ function getFilesize(filePath: string) {
66
68
* Calculates the difference between the last and current library payload.
67
69
* The results will be published as a commit status on Github.
68
70
*/
69
- async function calculatePayloadDiff ( database : any , currentSha : string , currentPayload : any ) {
71
+ async function calculatePayloadDiff ( database : firebaseAdmin . database . Database , currentSha : string ,
72
+ currentPayload : any ) {
70
73
const authToken = process . env [ 'FIREBASE_ACCESS_TOKEN' ] ;
71
74
72
75
if ( ! authToken ) {
@@ -121,14 +124,15 @@ async function updateGithubStatus(commitSha: string, payloadDiff: number, authTo
121
124
}
122
125
123
126
/** Uploads the current payload results to the Dashboard database. */
124
- async function uploadPayloadResults ( database : any , currentSha : string , currentPayload : any ) {
127
+ async function uploadPayloadResults ( database : firebaseAdmin . database . Database , currentSha : string ,
128
+ currentPayload : any ) {
125
129
if ( isTravisMasterBuild ( ) ) {
126
130
await database . ref ( 'payloads' ) . child ( currentSha ) . set ( currentPayload ) ;
127
131
}
128
132
}
129
133
130
134
/** Gets the last payload uploaded from previous Travis builds. */
131
- async function getLastPayloadResults ( database : admin . database . Database ) {
135
+ async function getLastPayloadResults ( database : firebaseAdmin . database . Database ) {
132
136
const snapshot = await database . ref ( 'payloads' )
133
137
. orderByChild ( 'timestamp' )
134
138
. limitToLast ( 1 )
0 commit comments