backend-manager 2.5.95 → 2.5.97
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.
|
|
3
|
+
"version": "2.5.97",
|
|
4
4
|
"description": "Quick tools for developing Firebase functions",
|
|
5
5
|
"main": "src/manager/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"pushid": "^1.0.0",
|
|
58
58
|
"semver": "^7.5.0",
|
|
59
59
|
"shortid": "^2.2.16",
|
|
60
|
-
"sizeitup": "^1.0.
|
|
60
|
+
"sizeitup": "^1.0.3",
|
|
61
61
|
"uid-generator": "^2.0.0",
|
|
62
62
|
"ultimate-jekyll-poster": "^0.0.15",
|
|
63
63
|
"universal-analytics": "^0.5.3",
|
|
@@ -39,7 +39,8 @@ Module.prototype.main = function () {
|
|
|
39
39
|
return reject(assistant.errorManager(`Failed to sign out of all sessions: ${e}`, {code: 500, sentry: false, send: false, log: false}).error)
|
|
40
40
|
})
|
|
41
41
|
} catch (e) {
|
|
42
|
-
assistant.
|
|
42
|
+
assistant.error(`@temp sign-out-all-sessions error: ${e}`);
|
|
43
|
+
|
|
43
44
|
return reject(assistant.errorManager(`Failed to sign out of all sessions: ${e}`, {code: 500, sentry: false, send: false, log: false}).error)
|
|
44
45
|
}
|
|
45
46
|
})
|
|
@@ -73,15 +74,17 @@ Module.prototype.signOutOfSession = function (uid, session) {
|
|
|
73
74
|
for (var i = 0; i < keys.length; i++) {
|
|
74
75
|
const key = keys[i];
|
|
75
76
|
|
|
76
|
-
assistant.log(`Signing out ${key}...`, {environment: 'production'});
|
|
77
|
+
assistant.log(`Signing out ${session}/${key}...`, {environment: 'production'});
|
|
77
78
|
|
|
78
79
|
// Send signout command
|
|
79
80
|
await self.libraries.admin.database().ref(`${session}/${key}/command`)
|
|
80
81
|
.set('signout')
|
|
81
82
|
.catch(e => assistant.error(`Failed to signout of session ${key}`, e, {environment: 'production'}))
|
|
83
|
+
assistant.log(`@temp 1`, {environment: 'production'});
|
|
82
84
|
|
|
83
85
|
// Delay so the client has time to react to the command
|
|
84
86
|
await powertools.wait(5000);
|
|
87
|
+
assistant.log(`@temp 2`, {environment: 'production'});
|
|
85
88
|
|
|
86
89
|
// Delete session
|
|
87
90
|
await self.libraries.admin.database().ref(`${session}/${key}`)
|
|
@@ -98,7 +101,7 @@ Module.prototype.signOutOfSession = function (uid, session) {
|
|
|
98
101
|
.catch(e => {
|
|
99
102
|
assistant.errorManager(`Session query error for session ${session}: ${e}`, {code: 500, sentry: true, send: false, log: true})
|
|
100
103
|
|
|
101
|
-
return reject(
|
|
104
|
+
return reject(e)
|
|
102
105
|
})
|
|
103
106
|
});
|
|
104
107
|
}
|
|
@@ -67,8 +67,6 @@ Module.prototype.main = function () {
|
|
|
67
67
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
70
|
Module.prototype.signUp = function (payload) {
|
|
73
71
|
const self = this;
|
|
74
72
|
const Manager = self.Manager;
|
|
@@ -82,7 +80,9 @@ Module.prototype.signUp = function (payload) {
|
|
|
82
80
|
// updatedReferral: true,
|
|
83
81
|
};
|
|
84
82
|
|
|
85
|
-
payload = payload || {};
|
|
83
|
+
payload = payload || {};
|
|
84
|
+
|
|
85
|
+
assistant.log(`SignUp(): payload`, payload, {environment: 'production'})
|
|
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)) {
|
|
@@ -128,6 +128,8 @@ Module.prototype.signUp = function (payload) {
|
|
|
128
128
|
metadata: Manager.Metadata().set({tag: 'user:sign-up'}),
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
assistant.log(`updateReferral(): appending referrals...`, referrals, {environment: 'production'})
|
|
132
|
+
|
|
131
133
|
// Set the user
|
|
132
134
|
self.libraries.admin.firestore().doc(`users/${payload.auth.uid}`)
|
|
133
135
|
.set(user, { merge: true })
|
|
@@ -153,6 +155,8 @@ Module.prototype.updateReferral = function (payload) {
|
|
|
153
155
|
referrerUid: undefined,
|
|
154
156
|
}
|
|
155
157
|
payload = payload || {};
|
|
158
|
+
|
|
159
|
+
assistant.log(`updateReferral(): payload`, payload, {environment: 'production'})
|
|
156
160
|
|
|
157
161
|
self.libraries.admin.firestore().collection('users')
|
|
158
162
|
.where('affiliate.code', '==', payload.affiliateCode)
|
|
@@ -178,7 +182,9 @@ Module.prototype.updateReferral = function (payload) {
|
|
|
178
182
|
timestamp: self.assistant.meta.startTime.timestamp,
|
|
179
183
|
})
|
|
180
184
|
|
|
181
|
-
|
|
185
|
+
assistant.log(`updateReferral(): appending referrals...`, doc.ref.id, referrals, {environment: 'production'})
|
|
186
|
+
|
|
187
|
+
await self.libraries.admin.firestore().doc(`users/${doc.ref.id}`)
|
|
182
188
|
.set({
|
|
183
189
|
affiliate: {
|
|
184
190
|
referrals: referrals
|
|
@@ -192,7 +198,7 @@ Module.prototype.updateReferral = function (payload) {
|
|
|
192
198
|
|
|
193
199
|
result.count = count;
|
|
194
200
|
result.updatedReferral = true;
|
|
195
|
-
result.referrerUid = doc.id
|
|
201
|
+
result.referrerUid = doc.ref.id
|
|
196
202
|
found = true
|
|
197
203
|
}
|
|
198
204
|
}
|