backend-manager 3.0.28 → 3.0.30

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.
Files changed (40) hide show
  1. package/package.json +1 -1
  2. package/src/manager/functions/core/actions/api/admin/backup.js +11 -11
  3. package/src/manager/functions/core/actions/api/admin/create-post.js +2 -2
  4. package/src/manager/functions/core/actions/api/admin/database-write.js +1 -1
  5. package/src/manager/functions/core/actions/api/admin/firestore-query.js +2 -2
  6. package/src/manager/functions/core/actions/api/admin/firestore-read.js +2 -2
  7. package/src/manager/functions/core/actions/api/admin/firestore-write.js +1 -1
  8. package/src/manager/functions/core/actions/api/admin/payment-processor.js +2 -2
  9. package/src/manager/functions/core/actions/api/admin/send-notification.js +4 -4
  10. package/src/manager/functions/core/actions/api/admin/sync-users.js +4 -4
  11. package/src/manager/functions/core/actions/api/firebase/get-providers.js +2 -2
  12. package/src/manager/functions/core/actions/api/general/generate-uuid.js +1 -1
  13. package/src/manager/functions/core/actions/api/general/send-email.js +3 -3
  14. package/src/manager/functions/core/actions/api/special/setup-electron-manager-client.js +1 -1
  15. package/src/manager/functions/core/actions/api/user/get-active-sessions.js +1 -1
  16. package/src/manager/functions/core/actions/api/user/get-subscription-info.js +2 -2
  17. package/src/manager/functions/core/actions/api/user/oauth2/discord.js +1 -1
  18. package/src/manager/functions/core/actions/api/user/oauth2.js +13 -13
  19. package/src/manager/functions/core/actions/api/user/regenerate-api-keys.js +1 -1
  20. package/src/manager/functions/core/actions/api/user/sign-out-all-sessions.js +9 -9
  21. package/src/manager/functions/core/actions/api/user/sign-up.js +4 -4
  22. package/src/manager/functions/core/actions/api/user/submit-feedback.js +3 -3
  23. package/src/manager/functions/core/actions/api/user/validate-settings.js +3 -3
  24. package/src/manager/functions/core/actions/api.js +6 -6
  25. package/src/manager/functions/core/actions/create-post-handler.js +2 -2
  26. package/src/manager/functions/core/actions/generate-uuid.js +2 -2
  27. package/src/manager/functions/core/actions/old/api-2.js +6 -6
  28. package/src/manager/functions/core/actions/sign-up-handler.js +3 -3
  29. package/src/manager/functions/core/admin/create-post.js +3 -3
  30. package/src/manager/functions/core/admin/firestore-write.js +2 -2
  31. package/src/manager/functions/core/admin/get-stats.js +9 -9
  32. package/src/manager/functions/core/admin/query.js +5 -5
  33. package/src/manager/functions/core/admin/send-notification.js +5 -5
  34. package/src/manager/functions/core/cron/daily.js +3 -3
  35. package/src/manager/functions/core/events/auth/before-signin.js +2 -2
  36. package/src/manager/functions/core/events/auth/on-create.js +4 -4
  37. package/src/manager/functions/core/events/auth/on-delete.js +3 -3
  38. package/src/manager/functions/core/events/firestore/on-subscription.js +8 -8
  39. package/src/manager/helpers/assistant.js +18 -10
  40. package/src/manager/index.js +22 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backend-manager",
3
- "version": "3.0.28",
3
+ "version": "3.0.30",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -53,7 +53,7 @@ Module.prototype.main = function () {
53
53
 
54
54
  }
55
55
 
56
- assistant.log('Saved backup successfully:', response.metadata.outputUriPrefix, meta, {environment: 'development'})
56
+ assistant.log('Saved backup successfully:', response.metadata.outputUriPrefix, meta)
57
57
 
58
58
  await self._setMetaStats(null, meta);
59
59
 
@@ -62,7 +62,7 @@ Module.prototype.main = function () {
62
62
  .catch(async (e) => {
63
63
  await self._setMetaStats(e);
64
64
  return reject(assistant.errorManager(e, {code: 500, sentry: false, send: false, log: true}).error)
65
- });
65
+ });
66
66
 
67
67
  });
68
68
 
@@ -113,7 +113,7 @@ Module.prototype.createBucket = function (bucketName, resourceZone) {
113
113
  return new Promise(function(resolve, reject) {
114
114
  storage.bucket(bucketName).getMetadata()
115
115
  .then(async (meta) => {
116
- assistant.log(`${bucketName} metadata`, meta[0], {environment: 'development'})
116
+ assistant.log(`${bucketName} metadata`, meta[0])
117
117
  return resolve();
118
118
  })
119
119
  .catch(async (e) => {
@@ -125,7 +125,7 @@ Module.prototype.createBucket = function (bucketName, resourceZone) {
125
125
  .then(r => r)
126
126
  .catch(e => e)
127
127
 
128
- assistant.log('storageCreation', storageCreation, {environment: 'development'})
128
+ assistant.log('storageCreation', storageCreation)
129
129
 
130
130
  return resolve();
131
131
  })
@@ -168,8 +168,8 @@ Module.prototype.__RETRY_deleteOldFiles = function (bucketName, resourceZone) {
168
168
  const date = moment(fileName.split('T')[0]);
169
169
  const day = date.date();
170
170
  const month = date.month();
171
- const age = now.diff(date, 'days', false);
172
-
171
+ const age = now.diff(date, 'days', false);
172
+
173
173
  if (age >= 30) {
174
174
  if (day === 1) { return }
175
175
  deletePromises.push(deleteFileFromBucket(bucketName, backup.fileName))
@@ -289,7 +289,7 @@ Module.prototype._deleteOldFiles = function (bucketName, resourceZone) {
289
289
  // get the file names as an array
290
290
  let [allFiles] = await storage.bucket(bucketName).getFiles();
291
291
  allFiles = allFiles.map(file => file.name);
292
-
292
+
293
293
  assistant.log(`All files: ${allFiles.join(', ')}`);
294
294
 
295
295
  // transform to array of objects with creation timestamp { fileName: xyz, created: }
@@ -302,9 +302,9 @@ Module.prototype._deleteOldFiles = function (bucketName, resourceZone) {
302
302
  allFiles.forEach(backup => {
303
303
  const createdDate = new Date(backup.created);
304
304
  createdDate.setHours( createdDate.getHours() + numHoursToKeepRecentBackups );
305
-
306
- if (createdDate > new Date()) {
307
- filesToKeep.add(backup.fileName)
305
+
306
+ if (createdDate > new Date()) {
307
+ filesToKeep.add(backup.fileName)
308
308
  };
309
309
  })
310
310
 
@@ -324,7 +324,7 @@ Module.prototype._deleteOldFiles = function (bucketName, resourceZone) {
324
324
  // filesToKeep.forEach(item => console.log(item));
325
325
 
326
326
  const filesToDelete = allFiles.filter(backup => !filesToKeep.has(backup.fileName));
327
-
327
+
328
328
  assistant.log(`Deleting ${filesToDelete.length} files: ${filesToDelete.map(backup => backup.fileName).join(', ')}`);
329
329
 
330
330
  const deletePromises = filesToDelete.map(backup => deleteFileFromBucket(bucketName, backup.fileName));
@@ -52,7 +52,7 @@ Module.prototype.main = function () {
52
52
  try {
53
53
  const url = get(self.Manager.config, 'brand.url');
54
54
  const encoded = encodeURIComponent(`${url}/sitemap.xml`);
55
-
55
+
56
56
  wonderfulFetch(`https://www.google.com/ping?sitemap=${encoded}`)
57
57
 
58
58
  // TODO
@@ -154,7 +154,7 @@ function makeRequest(options) {
154
154
  return new Promise(function(resolve, reject) {
155
155
  options.headers = options.headers || {};
156
156
  options.headers['Content-Type'] = 'application/json';
157
-
157
+
158
158
  let hasBody = Object.keys(options.body || {}).length > 0
159
159
 
160
160
  fetch(options.url, {
@@ -30,7 +30,7 @@ Module.prototype.main = function () {
30
30
  })
31
31
  .catch((e) => {
32
32
  return reject(assistant.errorManager(e, {code: 500, sentry: false, send: false, log: false}).error)
33
- });
33
+ });
34
34
  });
35
35
 
36
36
  };
@@ -13,7 +13,7 @@ Module.prototype.main = function () {
13
13
  const payload = self.payload;
14
14
 
15
15
  return new Promise(async function(resolve, reject) {
16
- // Perform checks
16
+ // Perform checks
17
17
  if (!payload.user.roles.admin) {
18
18
  return reject(assistant.errorManager(`Admin required.`, {code: 401, sentry: false, send: false, log: false}).error)
19
19
  }
@@ -116,7 +116,7 @@ Module.prototype.runQuery = function (query) {
116
116
  return resolve(self.docs);
117
117
  })
118
118
  .catch(function (error) {
119
- self.assistant.error(error, {environment: 'production'})
119
+ self.assistant.error(error)
120
120
  return reject(error);
121
121
  });
122
122
  });
@@ -12,7 +12,7 @@ Module.prototype.main = function () {
12
12
  return new Promise(async function(resolve, reject) {
13
13
  // Set defaults
14
14
  payload.data.payload.path = `${payload.data.payload.path || ''}`;
15
- payload.data.payload.options = payload.data.payload.options || {};
15
+ payload.data.payload.options = payload.data.payload.options || {};
16
16
 
17
17
  // Perform checks
18
18
  if (!payload.user.roles.admin) {
@@ -29,7 +29,7 @@ Module.prototype.main = function () {
29
29
  })
30
30
  .catch(e => {
31
31
  return reject(assistant.errorManager(e, {code: 500, sentry: false, send: false, log: false}).error)
32
- })
32
+ })
33
33
  });
34
34
 
35
35
  };
@@ -38,7 +38,7 @@ Module.prototype.main = function () {
38
38
  })
39
39
  .catch(e => {
40
40
  return reject(assistant.errorManager(e, {code: 500, sentry: false, send: false, log: false}).error)
41
- })
41
+ })
42
42
  });
43
43
 
44
44
  };
@@ -28,14 +28,14 @@ Module.prototype.main = function () {
28
28
 
29
29
  try {
30
30
  if (!jetpack.exists(processorPath)) {
31
- self.assistant.warn('Subprocessor does not exist:', processorPath, {environment: 'production'})
31
+ self.assistant.warn('Subprocessor does not exist:', processorPath)
32
32
 
33
33
  return resolve({data: {}})
34
34
  }
35
35
  processor = new (require(processorPath));
36
36
  processor.Manager = self.Manager;
37
37
  } catch (e) {
38
- self.assistant.error('Subprocessor failed to load:', processorPath, e, {environment: 'production'})
38
+ self.assistant.error('Subprocessor failed to load:', processorPath, e)
39
39
 
40
40
  return resolve({data: {}})
41
41
  }
@@ -40,7 +40,7 @@ Module.prototype.main = function () {
40
40
  assistant.errorManager(`Failed to add cb to URL: ${e}`, {code: 500, sentry: false, send: false, log: true})
41
41
  }
42
42
 
43
- assistant.log('Resolved notification payload', self._notificationPayload, {environment: 'production'})
43
+ assistant.log('Resolved notification payload', self._notificationPayload)
44
44
 
45
45
  if (!payload.user.roles.admin) {
46
46
  return reject(assistant.errorManager(`Admin required.`, {code: 401, sentry: false, send: false, log: false}).error)
@@ -105,7 +105,7 @@ Module.prototype.getTokens = function (options) {
105
105
  });
106
106
  })
107
107
  .catch(function(e) {
108
- self.assistant.error('Error querying tokens: ', e, {environment: 'production'})
108
+ self.assistant.error('Error querying tokens: ', e)
109
109
  reject(error);
110
110
  });
111
111
 
@@ -114,7 +114,7 @@ Module.prototype.getTokens = function (options) {
114
114
  self.assistant.log('Finished all batches.');
115
115
  })
116
116
  .catch(function(e) {
117
- self.assistant.error('Error sending batches: ', e, {environment: 'production'})
117
+ self.assistant.error('Error sending batches: ', e)
118
118
  });
119
119
  resolve();
120
120
 
@@ -143,7 +143,7 @@ Module.prototype.sendBatch = function (batch, id) {
143
143
  resolve();
144
144
  })
145
145
  .catch(function (e) {
146
- self.assistant.error('Error sending batch #' + id, e, {environment: 'production'});
146
+ self.assistant.error('Error sending batch #' + id, e);
147
147
  // self.result.status = 'fail';
148
148
  reject(e);
149
149
  })
@@ -12,7 +12,7 @@ Module.prototype.main = function () {
12
12
  const payload = self.payload;
13
13
 
14
14
  return new Promise(async function(resolve, reject) {
15
-
15
+
16
16
  // If the user is not an admin, reject
17
17
  if (!payload.user.roles.admin && assistant.meta.environment === 'production') {
18
18
  return reject(assistant.errorManager(`Admin required.`, {code: 401, sentry: false, send: false, log: false}).error)
@@ -41,7 +41,7 @@ Module.prototype.main = function () {
41
41
  const created = new Date(account.metadata.creationTime);
42
42
  const activity = new Date(account.metadata.lastSignInTime);
43
43
  const isAnonymous = account.providerData.length === 0;
44
-
44
+
45
45
  // Skip anonymous users
46
46
  if (isAnonymous) {
47
47
  return
@@ -66,7 +66,7 @@ Module.prototype.main = function () {
66
66
  lastActivity: {
67
67
  timestamp: activity.toISOString(),
68
68
  timestampUNIX: Math.floor(activity.getTime() / 1000),
69
- },
69
+ },
70
70
  }
71
71
  });
72
72
 
@@ -104,7 +104,7 @@ Module.prototype.main = function () {
104
104
  .catch(e => {
105
105
  assistant.error('Failed to update lastPageToken', e);
106
106
  })
107
- }
107
+ }
108
108
 
109
109
  return resolve();
110
110
  })
@@ -107,7 +107,7 @@ Module.prototype.main = function () {
107
107
  promises.push(request(provider))
108
108
  });
109
109
 
110
- assistant.log('Checking providers...', {environment: 'production'});
110
+ assistant.log('Checking providers...');
111
111
 
112
112
  await Promise.all(promises)
113
113
  .then(response => {
@@ -130,7 +130,7 @@ Module.prototype.main = function () {
130
130
 
131
131
  if (typeof response.authentication[provider].enabled !== 'undefined') {
132
132
  payload.response.data[provider] = response.authentication[provider].enabled;
133
- assistant.log(`Overwriting ${provider} to ${payload.response.data[provider]}...`, {environment: 'development'});
133
+ assistant.log(`Overwriting ${provider} to ${payload.response.data[provider]}...`);
134
134
  }
135
135
  });
136
136
 
@@ -30,7 +30,7 @@ Module.prototype.main = function () {
30
30
  return reject(assistant.errorManager(`v${payload.data.payload.version} is not a valid version.`, {code: 400, sentry: false, send: false, log: false}).error)
31
31
  }
32
32
 
33
- assistant.log('UUID Generated', payload.data.payload, result, {environment: 'production'});
33
+ assistant.log('UUID Generated', payload.data.payload, result);
34
34
 
35
35
  return resolve({data: {uuid: result}});
36
36
 
@@ -67,7 +67,7 @@ Module.prototype.main = function () {
67
67
  storage.set(ipPath, ipData).write();
68
68
  storage.set(emailPath, emailData).write();
69
69
 
70
- assistant.log('Storage:', storage.getState()['api:general:send-email'], {environment: 'production'});
70
+ assistant.log('Storage:', storage.getState()['api:general:send-email']);
71
71
 
72
72
  if (ipData.count >= emailPayload.spamFilter.ip || emailData.count >= emailPayload.spamFilter.email) {
73
73
  self.assistant.errorManager(`Spam filter triggered ip=${ipData.count}, email=${emailData.count}`, {code: 429, sentry: false, send: false, log: true})
@@ -80,7 +80,7 @@ Module.prototype.main = function () {
80
80
  }
81
81
 
82
82
  // Log the email payload
83
- assistant.log('Email payload:', emailPayload, {environment: 'production'});
83
+ assistant.log('Email payload:', emailPayload);
84
84
 
85
85
  // Send the email
86
86
  await fetch(`https://us-central1-itw-creative-works.cloudfunctions.net/sendEmail`, {
@@ -90,7 +90,7 @@ Module.prototype.main = function () {
90
90
  body: emailPayload.payload,
91
91
  })
92
92
  .then(async (json) => {
93
- assistant.log('Response:', json, {environment: 'production'});
93
+ assistant.log('Response:', json);
94
94
 
95
95
  return resolve({
96
96
  data: {
@@ -64,7 +64,7 @@ Module.prototype.main = function () {
64
64
  }
65
65
 
66
66
  if (config.backendManagerKey === Manager.config.backend_manager.key && Manager.config.backend_manager.key) {
67
- assistant.log('Validated config', config, {environment: 'production'})
67
+ assistant.log('Validated config', config)
68
68
  } else {
69
69
  config = {};
70
70
  }
@@ -19,7 +19,7 @@ Module.prototype.main = function () {
19
19
  const id = _.get(payload.data.payload, 'id', 'app');
20
20
  const session = `sessions/${id}`;
21
21
 
22
- assistant.log(`Getting active sessions for ${uid} @ ${session}`, {environment: 'production'})
22
+ assistant.log(`Getting active sessions for ${uid} @ ${session}`)
23
23
 
24
24
  await self.libraries.admin.database().ref(session)
25
25
  .orderByChild('uid')
@@ -29,9 +29,9 @@ Module.prototype.main = function () {
29
29
  activated: _.get(user, 'plan.trial.activated', false),
30
30
  date: {
31
31
  timestamp: _.get(user, 'plan.trial.date.timestamp', oldDate),
32
- timestampUNIX: _.get(user, 'plan.trial.date.timestampUNIX', oldDateUNIX),
32
+ timestampUNIX: _.get(user, 'plan.trial.date.timestampUNIX', oldDateUNIX),
33
33
  }
34
- },
34
+ },
35
35
  payment: {
36
36
  active: _.get(user, 'plan.payment.active', false),
37
37
  },
@@ -52,7 +52,7 @@ OAuth2.prototype.verifyIdentity = function (tokenizeResult) {
52
52
  .then(json => json)
53
53
  .catch(e => e)
54
54
 
55
- assistant.log('identityResponse', identityResponse, {environment: 'development'});
55
+ assistant.log('identityResponse', identityResponse);
56
56
 
57
57
  if (identityResponse instanceof Error) {
58
58
  return reject(identityResponse);
@@ -69,7 +69,7 @@ Module.prototype.main = function () {
69
69
  redirectUrl: payload.data.payload.redirect_uri,
70
70
  }
71
71
 
72
- assistant.log('OAuth2 payload', payload.data.payload, {environment: 'production'});
72
+ assistant.log('OAuth2 payload', payload.data.payload);
73
73
 
74
74
  if (!payload.data.payload.provider) {
75
75
  return reject(new Error(`The provider parameter is required.`));
@@ -102,7 +102,7 @@ Module.prototype.main = function () {
102
102
  newUrl.searchParams.set('response_type', typeof payload.data.payload.response_type === 'undefined' ? 'code' : payload.data.payload.response_type)
103
103
  }
104
104
 
105
- assistant.log('OAuth2 newUrl', newUrl, {environment: 'production'});
105
+ assistant.log('OAuth2 newUrl', newUrl);
106
106
 
107
107
  await self.oauth2.buildUrl(payload.data.payload.state, newUrl)
108
108
  .then(url => {
@@ -129,7 +129,7 @@ Module.prototype.main = function () {
129
129
  } else if (payload.data.payload.state === 'refresh') {
130
130
  self.processState_refresh(newUrl, user)
131
131
  .then(r => {resolve(r)})
132
- .catch(e => {reject(e)})
132
+ .catch(e => {reject(e)})
133
133
  } else if (payload.data.payload.state === 'deauthorize') {
134
134
  self.processState_deauthorize(newUrl, user)
135
135
  .then(r => {resolve(r)})
@@ -176,7 +176,7 @@ Module.prototype.processState_tokenize = function (newUrl, user) {
176
176
  return new Promise(async function(resolve, reject) {
177
177
  const finalUrl = newUrl.toString();
178
178
 
179
- assistant.log('Running processState_tokenize()', {environment: 'production'});
179
+ assistant.log('Running processState_tokenize()');
180
180
 
181
181
  const body = {
182
182
  client_id: _.get(Manager.config, `oauth2.${payload.data.payload.provider}.client_id`),
@@ -187,7 +187,7 @@ Module.prototype.processState_tokenize = function (newUrl, user) {
187
187
  // scope: '',
188
188
  };
189
189
 
190
- assistant.log('body', body, {environment: 'production'});
190
+ assistant.log('body', body);
191
191
 
192
192
  const tokenizeResponse = await fetch(finalUrl, {
193
193
  method: 'POST',
@@ -204,7 +204,7 @@ Module.prototype.processState_tokenize = function (newUrl, user) {
204
204
  .then(json => json)
205
205
  .catch(e => e)
206
206
 
207
- assistant.log('tokenizeResponse', tokenizeResponse, {environment: 'production'});
207
+ assistant.log('tokenizeResponse', tokenizeResponse);
208
208
 
209
209
  if (tokenizeResponse instanceof Error) {
210
210
  return reject(tokenizeResponse);
@@ -215,7 +215,7 @@ Module.prototype.processState_tokenize = function (newUrl, user) {
215
215
  .then(identity => identity)
216
216
  .catch(e => e);
217
217
 
218
- assistant.log('verifiedIdentity', verifiedIdentity, {environment: 'production'});
218
+ assistant.log('verifiedIdentity', verifiedIdentity);
219
219
 
220
220
  if (verifiedIdentity instanceof Error) {
221
221
  return reject(verifiedIdentity);
@@ -244,7 +244,7 @@ Module.prototype.processState_tokenize = function (newUrl, user) {
244
244
  .then(r => r)
245
245
  .catch(e => e)
246
246
 
247
- assistant.log('storeResponse', user.auth.uid, storeResponse, {environment: 'production'});
247
+ assistant.log('storeResponse', user.auth.uid, storeResponse);
248
248
 
249
249
  if (storeResponse instanceof Error) {
250
250
  return reject(storeResponse);
@@ -267,7 +267,7 @@ Module.prototype.processState_refresh = function (newUrl, user) {
267
267
  return new Promise(async function(resolve, reject) {
268
268
  const finalUrl = newUrl.toString();
269
269
 
270
- assistant.log('Running processState_refresh()', {environment: 'production'});
270
+ assistant.log('Running processState_refresh()');
271
271
 
272
272
  const body = {
273
273
  client_id: _.get(Manager.config, `oauth2.${payload.data.payload.provider}.client_id`),
@@ -276,7 +276,7 @@ Module.prototype.processState_refresh = function (newUrl, user) {
276
276
  refresh_token: _.get(user, `oauth2.${payload.data.payload.provider}.token.refresh_token`),
277
277
  };
278
278
 
279
- assistant.log('body', body, {environment: 'production'});
279
+ assistant.log('body', body);
280
280
 
281
281
  const refreshResponse = await fetch(finalUrl, {
282
282
  method: 'POST',
@@ -293,7 +293,7 @@ Module.prototype.processState_refresh = function (newUrl, user) {
293
293
  .then(json => json)
294
294
  .catch(e => e)
295
295
 
296
- assistant.log('refreshResponse', refreshResponse, {environment: 'production'});
296
+ assistant.log('refreshResponse', refreshResponse);
297
297
 
298
298
  if (refreshResponse instanceof Error) {
299
299
  return reject(refreshResponse);
@@ -305,7 +305,7 @@ Module.prototype.processState_refresh = function (newUrl, user) {
305
305
  // .then(identity => identity)
306
306
  // .catch(e => e);
307
307
 
308
- // assistant.log('verifiedIdentity', verifiedIdentity, {environment: 'production'});
308
+ // assistant.log('verifiedIdentity', verifiedIdentity);
309
309
 
310
310
  // if (verifiedIdentity instanceof Error) {
311
311
  // return reject(verifiedIdentity);
@@ -330,7 +330,7 @@ Module.prototype.processState_refresh = function (newUrl, user) {
330
330
  .then(r => r)
331
331
  .catch(e => e)
332
332
 
333
- assistant.log('storeResponse', user.auth.uid, storeResponse, {environment: 'production'});
333
+ assistant.log('storeResponse', user.auth.uid, storeResponse);
334
334
 
335
335
  if (storeResponse instanceof Error) {
336
336
  return reject(storeResponse);
@@ -40,7 +40,7 @@ Module.prototype.main = function () {
40
40
  })
41
41
  .catch(e => {
42
42
  return reject(assistant.errorManager(`Failed to generate keys: ${e}`, {code: 500, sentry: true, send: false, log: false}).error)
43
- })
43
+ })
44
44
 
45
45
  })
46
46
  .catch(e => {
@@ -38,7 +38,7 @@ Module.prototype.main = function () {
38
38
  })
39
39
  .catch(e => {
40
40
  return reject(assistant.errorManager(`Failed to sign out of all sessions: ${e}`, {code: 500, sentry: false, send: false, log: false}).error)
41
- })
41
+ })
42
42
  } catch (e) {
43
43
  return reject(assistant.errorManager(`Failed to sign out of all sessions: ${e}`, {code: 500, sentry: false, send: false, log: false}).error)
44
44
  }
@@ -70,18 +70,18 @@ Module.prototype.signOutOfSession = function (uid, session) {
70
70
 
71
71
  const promises = [];
72
72
 
73
- assistant.log(`Signing out of ${keys.length} active sessions for ${uid} @ ${session}`, {environment: 'production'})
73
+ assistant.log(`Signing out of ${keys.length} active sessions for ${uid} @ ${session}`)
74
74
 
75
75
  for (var i = 0; i < keys.length; i++) {
76
76
  promises.push((async () => {
77
77
  const key = keys[i];
78
78
 
79
- assistant.log(`Signing out ${session}/${key}...`, {environment: 'production'});
80
-
79
+ assistant.log(`Signing out ${session}/${key}...`);
80
+
81
81
  // Send signout command
82
82
  await self.libraries.admin.database().ref(`${session}/${key}/command`)
83
83
  .set('signout')
84
- .catch(e => assistant.error(`Failed to signout of session ${key}`, e, {environment: 'production'}))
84
+ .catch(e => assistant.error(`Failed to signout of session ${key}`, e))
85
85
 
86
86
  // Delay so the client has time to react to the command
87
87
  await powertools.wait(5000);
@@ -89,9 +89,9 @@ Module.prototype.signOutOfSession = function (uid, session) {
89
89
  // Delete session
90
90
  await self.libraries.admin.database().ref(`${session}/${key}`)
91
91
  .remove()
92
- .catch(e => assistant.error(`Failed to delete session ${key}`, e, {environment: 'production'}))
92
+ .catch(e => assistant.error(`Failed to delete session ${key}`, e))
93
93
 
94
- assistant.log(`Signed out successfully: ${key}`, {environment: 'production'});
94
+ assistant.log(`Signed out successfully: ${key}`);
95
95
 
96
96
  count++;
97
97
  })())
@@ -101,7 +101,7 @@ Module.prototype.signOutOfSession = function (uid, session) {
101
101
  await Promise.all(promises)
102
102
  .then(() => {
103
103
  return resolve(count);
104
- })
104
+ })
105
105
  .catch((e) => {
106
106
  return reject(e);
107
107
  })
@@ -109,7 +109,7 @@ Module.prototype.signOutOfSession = function (uid, session) {
109
109
  })
110
110
  .catch(e => {
111
111
  assistant.errorManager(`Session query error for session ${session}: ${e}`, {code: 500, sentry: true, send: false, log: true})
112
-
112
+
113
113
  return reject(e);
114
114
  })
115
115
  });
@@ -82,7 +82,7 @@ Module.prototype.signUp = function (payload) {
82
82
 
83
83
  payload = payload || {};
84
84
 
85
- assistant.log(`signUp(): payload`, payload, {environment: 'production'})
85
+ assistant.log(`signUp(): payload`, payload)
86
86
 
87
87
  // Check if the user has a UID and email
88
88
  if (!_.get(payload, 'auth.uid', null) || !_.get(payload, 'auth.email', null)) {
@@ -116,7 +116,7 @@ Module.prototype.signUp = function (payload) {
116
116
  metadata: Manager.Metadata().set({tag: 'user:sign-up'}),
117
117
  }
118
118
 
119
- assistant.log(`signUp(): user`, user, {environment: 'production'})
119
+ assistant.log(`signUp(): user`, user)
120
120
 
121
121
  // Set the user
122
122
  self.libraries.admin.firestore().doc(`users/${payload.auth.uid}`)
@@ -144,7 +144,7 @@ Module.prototype.updateReferral = function (payload) {
144
144
  }
145
145
  payload = payload || {};
146
146
 
147
- assistant.log(`updateReferral(): payload`, payload, {environment: 'production'})
147
+ assistant.log(`updateReferral(): payload`, payload)
148
148
 
149
149
  self.libraries.admin.firestore().collection('users')
150
150
  .where('affiliate.code', '==', payload.affiliateCode)
@@ -170,7 +170,7 @@ Module.prototype.updateReferral = function (payload) {
170
170
  timestamp: self.assistant.meta.startTime.timestamp,
171
171
  })
172
172
 
173
- assistant.log(`updateReferral(): appending referrals...`, doc.ref.id, referrals, {environment: 'production'})
173
+ assistant.log(`updateReferral(): appending referrals...`, doc.ref.id, referrals)
174
174
 
175
175
  await self.libraries.admin.firestore().doc(`users/${doc.ref.id}`)
176
176
  .set({
@@ -55,7 +55,7 @@ Module.prototype.main = function () {
55
55
  decision.promptReview = false;
56
56
  }
57
57
 
58
- assistant.log('Feedback submitted', docId, {appReviewData: response.reviews, request: request, decision: decision}, {environment: 'production'});
58
+ assistant.log('Feedback submitted', docId, {appReviewData: response.reviews, request: request, decision: decision});
59
59
 
60
60
  // Save feedback to firestore
61
61
  self.libraries.admin.firestore().doc(`feedback/${docId}`)
@@ -72,13 +72,13 @@ Module.prototype.main = function () {
72
72
  return resolve({
73
73
  data: {
74
74
  review: decision,
75
- originalRequest: request,
75
+ originalRequest: request,
76
76
  }
77
77
  });
78
78
  })
79
79
  .catch((e) => {
80
80
  return reject(assistant.errorManager(`Failed to save feedback: ${e.message}`, {code: 500, sentry: true, send: false, log: true}).error)
81
- })
81
+ })
82
82
  })
83
83
  .catch((e) => {
84
84
  return reject(assistant.errorManager(`Failed to get app: ${e.message}`, {code: 500, sentry: true, send: false, log: true}).error)
@@ -25,7 +25,7 @@ Module.prototype.main = function () {
25
25
  const settings = _.merge({}, payload.data.payload.existingSettings, payload.data.payload.newSettings);
26
26
 
27
27
  const resolvedPath = path.join(process.cwd(), `defaults.js`);
28
-
28
+
29
29
  // Check if the file exists
30
30
  if (!jetpack.exists(resolvedPath)) {
31
31
  return reject(assistant.errorManager(`Defaults file at ${resolvedPath} does not exist, please add it manually.`, {code: 500, sentry: true, send: false, log: true}).error);
@@ -36,7 +36,7 @@ Module.prototype.main = function () {
36
36
  const defaults = _.get(require(resolvedPath)(), payload.data.payload.defaultsPath);
37
37
  const combined = combine(defaults.all, defaults[user.plan.id] || {})
38
38
 
39
- assistant.log('Combined settings', combined, {environment: 'development'})
39
+ assistant.log('Combined settings', combined)
40
40
 
41
41
  return resolve({data: powertools.defaults(settings, combined)});
42
42
  } catch (e) {
@@ -74,7 +74,7 @@ function combine(one, two) {
74
74
 
75
75
  // If the path is an object, merge the two object using lodash
76
76
  _.set(one, pathMinusLast, valueAtParent)
77
-
77
+
78
78
  done.push(pathMinusLast);
79
79
  })
80
80
  return one;