backend-manager 1.1.98 → 1.1.102

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": "1.1.98",
3
+ "version": "1.1.102",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -31,7 +31,7 @@
31
31
  "@google-cloud/storage": "^5.15.3",
32
32
  "@sendgrid/mail": "^7.5.0",
33
33
  "@sentry/node": "^6.13.3",
34
- "backend-assistant": "^0.0.53",
34
+ "backend-assistant": "^0.0.54",
35
35
  "busboy": "^0.3.1",
36
36
  "chalk": "^4.1.2",
37
37
  "cors": "^2.8.5",
@@ -65,4 +65,4 @@
65
65
  "src/",
66
66
  "templates/"
67
67
  ]
68
- }
68
+ }
@@ -35,10 +35,11 @@ let Module = {
35
35
  action: 'firestore-write',
36
36
  // label: '',
37
37
  });
38
-
38
+
39
39
  options.path = `${options.path || ''}`;
40
40
  options.document = options.document || {};
41
- options.options = options.options || { merge: true };
41
+ options.options = options.options || {};
42
+ options.options.merge = typeof options.options.merge === 'undefined' ? true : options.options.merge;
42
43
 
43
44
  if (!user.roles.admin) {
44
45
  response.status = 401;
@@ -29,8 +29,11 @@ Manager.prototype.init = function (exporter, options) {
29
29
  options.initialize = typeof options.initialize === 'undefined' ? true : options.initialize;
30
30
  options.setupFunctions = typeof options.setupFunctions === 'undefined' ? true : options.setupFunctions;
31
31
  options.sentry = typeof options.sentry === 'undefined' ? true : options.sentry;
32
+ options.reportErrorsInDev = typeof options.reportErrorsInDev === 'undefined' ? false : options.reportErrorsInDev;
32
33
  options.firebaseConfig = options.firebaseConfig;
33
34
  options.useFirebaseLogger = typeof options.useFirebaseLogger === 'undefined' ? true : options.useFirebaseLogger;
35
+ options.serviceAccountPath = typeof options.serviceAccountPath === 'undefined' ? 'service-account.json' : options.serviceAccountPath;
36
+ options.uniqueAppName = options.uniqueAppName || undefined;
34
37
 
35
38
  // Load libraries
36
39
  self.libraries = {
@@ -74,12 +77,13 @@ Manager.prototype.init = function (exporter, options) {
74
77
  if (self.options.initialize) {
75
78
  // console.log('Initializing:', self.project);
76
79
  try {
77
- self.libraries.admin.initializeApp({
80
+ // console.log('----self.project.databaseURL', self.project.databaseURL);
81
+ self.libraries.initializedAdmin = self.libraries.admin.initializeApp({
78
82
  credential: self.libraries.admin.credential.cert(
79
- require(path.resolve(self.cwd, 'service-account.json'))
83
+ require(path.resolve(self.cwd, options.serviceAccountPath))
80
84
  ),
81
85
  databaseURL: self.project.databaseURL,
82
- });
86
+ }, options.uniqueAppName);
83
87
  } catch (e) {
84
88
  console.error('Failed to call .initializeApp()', e);
85
89
  }
@@ -95,7 +99,7 @@ Manager.prototype.init = function (exporter, options) {
95
99
  dsn: sentryDSN,
96
100
  release: `${self.project.projectId}@${self.package.version}`,
97
101
  beforeSend(event, hint) {
98
- if (self.assistant.meta.environment === 'development') {
102
+ if (self.assistant.meta.environment === 'development' && !self.options.reportErrorsInDev) {
99
103
  self.assistant.error('Skipping Sentry because DEV')
100
104
  return null;
101
105
  }