UNPKG

firebase-functions

Version:
34 lines (32 loc) 862 B
//#region src/common/api.ts let globalRequiredAPIs = []; /** * Declare that this project requires a specific Google Cloud API to be enabled. * @param api The API name, e.g. "secretmanager.googleapis.com" * @param reason Optional reason why the API is needed. */ function requiresAPI(api, reason = "") { if (!api || typeof api !== "string" || !api.endsWith(".googleapis.com")) { throw new Error("requiresAPI: 'api' must be a non-empty string ending with '.googleapis.com'."); } globalRequiredAPIs.push({ api, reason }); } /** * @internal */ function getGlobalRequiredAPIs() { return globalRequiredAPIs; } /** * @internal */ function clearGlobalRequiredAPIs() { globalRequiredAPIs = []; } //#endregion exports.clearGlobalRequiredAPIs = clearGlobalRequiredAPIs; exports.getGlobalRequiredAPIs = getGlobalRequiredAPIs; exports.requiresAPI = requiresAPI;