///
import { Response } from 'firebase-functions';
import { Request } from 'firebase-functions/lib/providers/https';
import { AdminBroOptions, CurrentAdmin } from 'admin-bro';
/**
* @alias BuildHandlerReturn
*
* @memberof module:admin-bro-firebase-functions
*/
export declare type BuildHandlerReturn = (req: Request, resp: Response) => Promise;
/**
* @alias BuildHandlerOptions
*
* @memberof module:admin-bro-firebase-functions
*/
export declare type BuildHandlerOptions = {
/** Region where function is deployed */
region: string;
/**
* Optional before `async` hook which can be used to initialize database.
* if it returns something it will be used as AdminBroOptions.
*/
before?: () => Promise | AdminBroOptions | undefined | null;
/**
* custom authentication option. If given AdminBro will render login page
*/
auth?: {
/**
* secret which is used to encrypt the session cookie
*/
secret: string;
/**
* authenticate function
*/
authenticate: (email: string, password: string) => Promise | CurrentAdmin | null;
/**
* For how long cookie session will be stored.
* Default to 900000 (15 minutes).
* In milliseconds.
*/
maxAge?: number;
};
};
/**
* Builds the handler which can be passed to firebase functions
*
* usage:
*
* ```javascript
* const functions = require('firebase-functions')
* const { buildHandler } = require('admin-bro')
*
* const adminOptions = {...}
* const region = '...'
*
* exports.app = functions.https.onRequest(buildHandler(adminOptions, { region }));
*
* ```
*
* @alias buildHandler
* @param {AdminBroOptions} adminOptions options which are used to initialize
* AdminBro instance
* @param {BuildHandlerOptions} options custom options for admin-bro-firebase-functions
* adapter
* @return {BuildHandlerReturn} function which can be passed to firebase
* @function
* @memberof module:admin-bro-firebase-functions
*/
export declare const buildHandler: (adminOptions: AdminBroOptions, options: BuildHandlerOptions) => BuildHandlerReturn;