backend-manager 2.5.2 → 2.5.3

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": "2.5.2",
3
+ "version": "2.5.3",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -66,4 +66,4 @@
66
66
  "src/",
67
67
  "templates/"
68
68
  ]
69
- }
69
+ }
@@ -112,7 +112,7 @@ Manager.prototype.init = function (exporter, options) {
112
112
 
113
113
  // Reject if package.json does not exist
114
114
  if (semverUsing !== semverRequired) {
115
- console.error(new Error(`Node.js version mismatch: using ${semverUsing} but asked for ${semverRequired}`));
115
+ self.assistant.error(new Error(`Node.js version mismatch: using ${semverUsing} but asked for ${semverRequired}`), {environment: 'production'});
116
116
  return process.exit(1);
117
117
  }
118
118
  }
@@ -133,7 +133,7 @@ Manager.prototype.init = function (exporter, options) {
133
133
  release: sentryRelease,
134
134
  beforeSend(event, hint) {
135
135
  if (self.assistant.meta.environment === 'development' && !self.options.reportErrorsInDev) {
136
- self.assistant.error('Skipping Sentry because DEV')
136
+ self.assistant.error(new Error('Skipping Sentry because DEV'), {environment: 'production'})
137
137
  return null;
138
138
  }
139
139
  event.tags = event.tags || {};
@@ -162,7 +162,7 @@ Manager.prototype.init = function (exporter, options) {
162
162
  }, options.uniqueAppName);
163
163
  }
164
164
  } catch (e) {
165
- console.error('Failed to call .initializeApp()', e);
165
+ self.assistant.error('Failed to call .initializeApp()', e, {environment: 'production'});
166
166
  }
167
167
  // admin.firestore().settings({/* your settings... */ timestampsInSnapshots: true})
168
168
  }
@@ -372,12 +372,12 @@ Manager.prototype.init = function (exporter, options) {
372
372
  });
373
373
 
374
374
  // Cron
375
- exporter.bm_backup =
375
+ exporter.bm_cronDaily =
376
376
  self.libraries.functions
377
377
  .runWith({ memory: '256MB', timeoutSeconds: 60 })
378
- .pubsub.schedule(get(self.config, 'backup.schedule', 'every 24 hours'))
378
+ .pubsub.schedule('every 24 hours')
379
379
  .onRun(async (context) => {
380
- return self._process((new (require(`${core}/cron/backup.js`))()).init(self, { context: context, }))
380
+ return self._process((new (require(`${core}/cron/daily.js`))()).init(self, { context: context, }))
381
381
  });
382
382
  }
383
383
 
@@ -385,7 +385,7 @@ Manager.prototype.init = function (exporter, options) {
385
385
  try {
386
386
  require('dotenv').config();
387
387
  } catch (e) {
388
- console.error('Failed to set up environment variables from .env file');
388
+ self.assistant.error(new Error('Failed to set up environment variables from .env file'), {environment: 'production'});
389
389
  }
390
390
 
391
391
  // Setup LocalDatabase
@@ -566,16 +566,16 @@ Manager.prototype.storage = function (options) {
566
566
  try {
567
567
  _setup()
568
568
  } catch (e) {
569
- console.error(`Could not storage: ${dbPath}`, e);
569
+ self.assistant.error(`Could not setup storage: ${dbPath}`, e, {environment: 'production'});
570
570
 
571
571
  try {
572
572
  if (options.clearInvalid) {
573
- console.log(`Clearing invalud storage: ${dbPath}`);
573
+ self.assistant.log(`Clearing invalid storage: ${dbPath}`, {environment: 'production'});
574
574
  jetpack.write(dbPath, {});
575
575
  }
576
576
  _setup()
577
577
  } catch (e) {
578
- console.error(`Failed to clear invalid storage: ${dbPath}`, e);
578
+ self.assistant.error(`Failed to clear invalid storage: ${dbPath}`, e, {environment: 'production'});
579
579
  }
580
580
  }
581
581
  }