backend-manager 3.0.3 → 3.0.5

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.0.3",
3
+ "version": "3.0.5",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -69,4 +69,4 @@
69
69
  "wonderful-log": "^1.0.5",
70
70
  "yargs": "^17.7.2"
71
71
  }
72
- }
72
+ }
@@ -36,7 +36,7 @@ Module.prototype.main = function () {
36
36
  const oneHour = 60 * 60 * 1000; // One hour in milliseconds
37
37
 
38
38
  // Get current rate-limiting data
39
- const rateLimitingData = storage.get(`ipRateLimits.${ipAddress}`);
39
+ const rateLimitingData = storage.get(`ipRateLimits.${ipAddress}`).value();
40
40
  const count = get(rateLimitingData, 'count', 0);
41
41
  const lastTime = get(rateLimitingData, 'lastTime', 0);
42
42
 
@@ -49,7 +49,7 @@ Module.prototype.main = function () {
49
49
  }
50
50
 
51
51
  // Update rate-limiting data
52
- storage.set(`ipRateLimits.${ipAddress}`, { count: count + 1, lastTime: currentTime });
52
+ storage.set(`ipRateLimits.${ipAddress}`, { count: count + 1, lastTime: currentTime }).write();
53
53
 
54
54
  const existingAccount = await admin.firestore().doc(`users/${user.uid}`)
55
55
  .get()
@@ -23,6 +23,8 @@ Module.prototype.main = function () {
23
23
  const context = self.context;
24
24
 
25
25
  return new Promise(async function(resolve, reject) {
26
+ const functions = self.libraries.functions;
27
+ const admin = self.libraries.admin;
26
28
 
27
29
  assistant.log(`Request: ${user.uid}`, user, context, {environment: 'production'});
28
30