tra-analysis/website/functions/node_modules/firebase-functions/lib/index.js

71 lines
3.0 KiB
JavaScript
Raw Normal View History

2019-01-06 19:14:45 +00:00
"use strict";
// The MIT License (MIT)
//
// Copyright (c) 2017 Firebase
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
// Providers:
const analytics = require("./providers/analytics");
exports.analytics = analytics;
const auth = require("./providers/auth");
exports.auth = auth;
const crashlytics = require("./providers/crashlytics");
exports.crashlytics = crashlytics;
const database = require("./providers/database");
exports.database = database;
const firestore = require("./providers/firestore");
exports.firestore = firestore;
const https = require("./providers/https");
exports.https = https;
const pubsub = require("./providers/pubsub");
exports.pubsub = pubsub;
const remoteConfig = require("./providers/remoteConfig");
exports.remoteConfig = remoteConfig;
const storage = require("./providers/storage");
exports.storage = storage;
const config_1 = require("./config");
// // Exported root types:
__export(require("./config"));
__export(require("./cloud-functions"));
__export(require("./function-builder"));
// TEMPORARY WORKAROUND (BUG 63586213):
// Until the Cloud Functions builder can publish FIREBASE_CONFIG, automatically provide it on import based on what
// we can deduce.
if (!process.env.FIREBASE_CONFIG) {
const cfg = config_1.firebaseConfig();
if (cfg) {
process.env.FIREBASE_CONFIG = JSON.stringify(cfg);
}
else if (process.env.GCLOUD_PROJECT) {
console.warn('Warning, estimating Firebase Config based on GCLOUD_PROJECT. Initializing firebase-admin may fail');
process.env.FIREBASE_CONFIG = JSON.stringify({
databaseURL: `https://${process.env.GCLOUD_PROJECT}.firebaseio.com`,
storageBucket: `${process.env.GCLOUD_PROJECT}.appspot.com`,
projectId: process.env.GCLOUD_PROJECT,
});
}
else {
console.warn('Warning, FIREBASE_CONFIG environment variable is missing. Initializing firebase-admin will fail');
}
}