backend-manager 3.2.156 → 3.2.158

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backend-manager",
3
- "version": "3.2.156",
3
+ "version": "3.2.158",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -211,12 +211,14 @@ Manager.prototype.init = function (exporter, options) {
211
211
  // Initialize Firebase
212
212
  if (process.env.GOOGLE_APPLICATION_CREDENTIALS) {
213
213
  self.libraries.initializedAdmin = self.libraries.admin.initializeApp();
214
+ // self.app = self.libraries.initializedAdmin;
214
215
  } else {
215
216
  const serviceAccount = require(self.project.serviceAccountPath);
216
217
  self.libraries.initializedAdmin = self.libraries.admin.initializeApp({
217
218
  credential: self.libraries.admin.credential.cert(serviceAccount),
218
219
  databaseURL: self.project.databaseURL || `https://${self.project.projectId}.firebaseio.com`,
219
220
  }, options.uniqueAppName);
221
+ // self.app = self.libraries.initializedAdmin;
220
222
 
221
223
  const loadedProjectId = serviceAccount.project_id;
222
224
  if (!loadedProjectId || !loadedProjectId.includes(appId)) {
@@ -1004,6 +1006,37 @@ Manager.prototype.setupCustomServer = function (_library, options) {
1004
1006
  });
1005
1007
  }
1006
1008
 
1009
+ // Setup Custom Server
1010
+ Manager.prototype.getApp = function (id) {
1011
+ const self = this;
1012
+
1013
+ // Get the app
1014
+ return new Promise(function(resolve, reject) {
1015
+ const fetch = require('wonderful-fetch');
1016
+
1017
+ // Set ID
1018
+ id = id || self.config.app.id;
1019
+
1020
+ // If no ID, reject
1021
+ if (!id) {
1022
+ return reject(new Error('No ID provided'));
1023
+ }
1024
+
1025
+ // Fetch the app
1026
+ fetch(`https://us-central1-itw-creative-works.cloudfunctions.net/getApp`, {
1027
+ method: 'post',
1028
+ response: 'json',
1029
+ timeout: 30000,
1030
+ tries: 3,
1031
+ body: {
1032
+ id: id,
1033
+ }
1034
+ })
1035
+ .then((r) => resolve(r))
1036
+ .catch((e) => reject(e));
1037
+ });
1038
+ }
1039
+
1007
1040
  function resolveProjectPackage(dir) {
1008
1041
  try {
1009
1042
  return require(path.resolve(dir, 'functions', 'package.json'));