backend-manager 2.4.12 → 2.4.15
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.4.
|
|
3
|
+
"version": "2.4.15",
|
|
4
4
|
"description": "Quick tools for developing Firebase functions",
|
|
5
5
|
"main": "src/manager/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"mocha": "^9.2.2",
|
|
50
50
|
"moment": "^2.29.4",
|
|
51
51
|
"node-fetch": "^2.6.7",
|
|
52
|
-
"node-powertools": "^0.0.
|
|
52
|
+
"node-powertools": "^0.0.20",
|
|
53
53
|
"npm-api": "^1.0.1",
|
|
54
54
|
"paypal-server-api": "^0.0.7",
|
|
55
55
|
"pushid": "^1.0.0",
|
|
@@ -67,4 +67,4 @@
|
|
|
67
67
|
"src/",
|
|
68
68
|
"templates/"
|
|
69
69
|
]
|
|
70
|
-
}
|
|
70
|
+
}
|
|
@@ -45,13 +45,16 @@ Module.prototype.main = function () {
|
|
|
45
45
|
// or set to a list of collection IDs to export,
|
|
46
46
|
collectionIds: []
|
|
47
47
|
})
|
|
48
|
-
.then(responses => {
|
|
48
|
+
.then(async (responses) => {
|
|
49
|
+
|
|
50
|
+
await self._setMetaStats();
|
|
51
|
+
|
|
49
52
|
const response = responses[0];
|
|
50
|
-
// assistant.log('Saved backup successfully', response['name'], {environment: 'development'})
|
|
51
53
|
assistant.log('Saved backup successfully:', response.metadata.outputUriPrefix, {environment: 'development'})
|
|
52
54
|
return resolve(response['name']);
|
|
53
55
|
})
|
|
54
|
-
.catch(e => {
|
|
56
|
+
.catch(async (e) => {
|
|
57
|
+
await self._setMetaStats(e);
|
|
55
58
|
return reject(assistant.errorManager(e, {code: 500, sentry: false, send: false, log: true}).error)
|
|
56
59
|
});
|
|
57
60
|
|
|
@@ -60,6 +63,40 @@ Module.prototype.main = function () {
|
|
|
60
63
|
|
|
61
64
|
};
|
|
62
65
|
|
|
66
|
+
Module.prototype._setMetaStats = function (error) {
|
|
67
|
+
const self = this;
|
|
68
|
+
const Manager = self.Manager;
|
|
69
|
+
const Api = self.Api;
|
|
70
|
+
const assistant = self.assistant;
|
|
71
|
+
const payload = self.payload;
|
|
72
|
+
|
|
73
|
+
return new Promise(async function(resolve, reject) {
|
|
74
|
+
error = error || null;
|
|
75
|
+
const isError = error instanceof Error;
|
|
76
|
+
|
|
77
|
+
await self.libraries.admin.firestore().doc('meta/stats')
|
|
78
|
+
.set({
|
|
79
|
+
backups: {
|
|
80
|
+
lastBackup: {
|
|
81
|
+
date: {
|
|
82
|
+
timestamp: assistant.meta.startTime.timestamp,
|
|
83
|
+
timestampUNIX: assistant.meta.startTime.timestampUNIX,
|
|
84
|
+
},
|
|
85
|
+
status: {
|
|
86
|
+
success: !isError,
|
|
87
|
+
error: error,
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}, {merge: true})
|
|
92
|
+
.catch(e => {
|
|
93
|
+
assistant.errorManager(e, {code: 500, sentry: false, send: false, log: true});
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
return resolve();
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
|
|
63
100
|
Module.prototype.createBucket = function (bucketName, resourceZone) {
|
|
64
101
|
const self = this;
|
|
65
102
|
const Manager = self.Manager;
|
|
@@ -57,13 +57,13 @@ service cloud.firestore {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
function isWritingProtectedUserField() {
|
|
60
|
-
return isWritingField('
|
|
60
|
+
return isWritingField('auth')
|
|
61
61
|
|| isWritingField('roles')
|
|
62
62
|
|| isWritingField('plan')
|
|
63
63
|
|| isWritingField('affiliate')
|
|
64
64
|
|| isWritingField('api')
|
|
65
65
|
|| isWritingField('link')
|
|
66
|
-
|| isWritingField('
|
|
66
|
+
|| isWritingField('usage')
|
|
67
67
|
|| isWritingField('view');
|
|
68
68
|
}
|
|
69
69
|
|