backend-manager 2.4.19 → 2.4.21
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 +1 -1
- package/src/cli/cli.js +24 -1
- package/src/manager/functions/core/actions/api.js +4 -0
- package/src/manager/functions/core/events/auth/on-create.js +26 -19
- package/src/manager/functions/core/events/auth/on-delete.js +27 -19
- package/src/manager/functions/core/events/firestore/on-subscription.js +39 -24
package/package.json
CHANGED
package/src/cli/cli.js
CHANGED
|
@@ -477,7 +477,7 @@ Main.prototype.setup = async function () {
|
|
|
477
477
|
jetpack.remove(`${self.firebaseProjectPath}/${tempPath}`)
|
|
478
478
|
|
|
479
479
|
return !localIndexes_exists || equal
|
|
480
|
-
},
|
|
480
|
+
}, fix_indexesSync);
|
|
481
481
|
|
|
482
482
|
await self.test('add roles/datastore.importExportAdmin', async function () {
|
|
483
483
|
const result = await cmd_iamImportExport(self).catch(e => e);
|
|
@@ -895,6 +895,29 @@ function fix_remoteconfigTemplate(self) {
|
|
|
895
895
|
});
|
|
896
896
|
};
|
|
897
897
|
|
|
898
|
+
function fix_indexesSync(self) {
|
|
899
|
+
return new Promise(function(resolve, reject) {
|
|
900
|
+
inquirer.prompt([
|
|
901
|
+
{
|
|
902
|
+
type: 'confirm',
|
|
903
|
+
name: 'replace',
|
|
904
|
+
message: 'Would you like to replace the local indexes?',
|
|
905
|
+
default: true,
|
|
906
|
+
}
|
|
907
|
+
])
|
|
908
|
+
.then(async (answer) => {
|
|
909
|
+
if (answer.replace) {
|
|
910
|
+
cmd_indexesGet(self, undefined, true)
|
|
911
|
+
.then(r => {
|
|
912
|
+
return resolve();
|
|
913
|
+
})
|
|
914
|
+
} else {
|
|
915
|
+
return reject();
|
|
916
|
+
}
|
|
917
|
+
})
|
|
918
|
+
});
|
|
919
|
+
};
|
|
920
|
+
|
|
898
921
|
function fix_firestoreRulesFile(self) {
|
|
899
922
|
return new Promise(function(resolve, reject) {
|
|
900
923
|
const name = 'firestore.rules'
|
|
@@ -28,6 +28,10 @@ Module.prototype.init = function (Manager, data) {
|
|
|
28
28
|
self.assistant.request.data.command = resolved.command;
|
|
29
29
|
self.assistant.request.data.payload = self.assistant.request.data.payload || {};
|
|
30
30
|
|
|
31
|
+
if (Manager.options.log) {
|
|
32
|
+
self.assistant.log(`Executing (log): ${resolved.command}`, self.assistant.request.data.payload, JSON.stringify(self.assistant.request.data.payload), {environment: 'production'})
|
|
33
|
+
}
|
|
34
|
+
|
|
31
35
|
return self;
|
|
32
36
|
}
|
|
33
37
|
|
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
function Module() {
|
|
2
|
+
const self = this;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
Module.prototype.init = function (Manager, payload) {
|
|
6
|
+
const self = this;
|
|
7
|
+
self.Manager = Manager;
|
|
8
|
+
self.libraries = Manager.libraries;
|
|
9
|
+
self.assistant = Manager.Assistant();
|
|
10
|
+
self.user = payload.user
|
|
11
|
+
|
|
12
|
+
return self;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
Module.prototype.main = function () {
|
|
16
|
+
const self = this;
|
|
17
|
+
const libraries = self.libraries;
|
|
18
|
+
const assistant = self.assistant;
|
|
19
|
+
const user = self.user;
|
|
20
|
+
|
|
21
|
+
return new Promise(async function(resolve, reject) {
|
|
22
|
+
const newUser = self.Manager.User({
|
|
17
23
|
auth: {
|
|
18
24
|
uid: user.uid,
|
|
19
25
|
email: user.email,
|
|
20
26
|
}
|
|
21
27
|
});
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
const analytics = self.Manager.Analytics({
|
|
24
30
|
assistant: assistant,
|
|
25
31
|
uuid: user.uid,
|
|
26
32
|
})
|
|
@@ -56,7 +62,8 @@ let Module = {
|
|
|
56
62
|
})
|
|
57
63
|
|
|
58
64
|
assistant.log('User created:', user, {environment: 'production'});
|
|
59
|
-
|
|
60
|
-
}
|
|
65
|
+
return resolve(self);
|
|
66
|
+
});
|
|
67
|
+
};
|
|
61
68
|
|
|
62
69
|
module.exports = Module;
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
function Module() {
|
|
2
|
+
const self = this;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
Module.prototype.init = function (Manager, payload) {
|
|
6
|
+
const self = this;
|
|
7
|
+
self.Manager = Manager;
|
|
8
|
+
self.libraries = Manager.libraries;
|
|
9
|
+
self.assistant = Manager.Assistant();
|
|
10
|
+
self.user = payload.user
|
|
11
|
+
|
|
12
|
+
return self;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
Module.prototype.main = function () {
|
|
16
|
+
return new Promise(async function(resolve, reject) {
|
|
17
|
+
const self = this;
|
|
18
|
+
const libraries = self.libraries;
|
|
19
|
+
const assistant = self.assistant;
|
|
20
|
+
const user = self.user;
|
|
21
|
+
|
|
22
|
+
const analytics = self.Manager.Analytics({
|
|
17
23
|
assistant: assistant,
|
|
18
24
|
uuid: user.uid,
|
|
19
25
|
})
|
|
@@ -39,8 +45,10 @@ let Module = {
|
|
|
39
45
|
assistant.error(e, {environment: 'production'});
|
|
40
46
|
})
|
|
41
47
|
|
|
42
|
-
assistant.log('User deleted:', user, {environment: 'production'});
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
assistant.log('User deleted:', user, {environment: 'production'});
|
|
49
|
+
|
|
50
|
+
return resolve(self);
|
|
51
|
+
});
|
|
52
|
+
};
|
|
45
53
|
|
|
46
54
|
module.exports = Module;
|
|
@@ -1,27 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
this.libraries = Manager.libraries;
|
|
5
|
-
this.assistant = Manager.Assistant();
|
|
6
|
-
this.change = data.change
|
|
7
|
-
this.context = data.context
|
|
8
|
-
|
|
9
|
-
return this;
|
|
10
|
-
},
|
|
11
|
-
main: async function() {
|
|
12
|
-
let self = this;
|
|
13
|
-
let libraries = self.libraries;
|
|
14
|
-
let assistant = self.assistant;
|
|
15
|
-
let change = self.change;
|
|
16
|
-
let context = self.context;
|
|
17
|
-
|
|
18
|
-
let _ = self.Manager.require('lodash');
|
|
1
|
+
function Module() {
|
|
2
|
+
const self = this;
|
|
3
|
+
}
|
|
19
4
|
|
|
20
|
-
|
|
5
|
+
Module.prototype.init = function (Manager, payload) {
|
|
6
|
+
const self = this;
|
|
7
|
+
self.Manager = Manager;
|
|
8
|
+
self.libraries = Manager.libraries;
|
|
9
|
+
self.assistant = Manager.Assistant();
|
|
10
|
+
self.change = payload.change
|
|
11
|
+
self.context = payload.context
|
|
12
|
+
|
|
13
|
+
return self;
|
|
14
|
+
};
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
Module.prototype.main = function () {
|
|
17
|
+
const self = this;
|
|
18
|
+
const libraries = self.libraries;
|
|
19
|
+
const assistant = self.assistant;
|
|
20
|
+
const change = self.change;
|
|
21
|
+
const context = self.context;
|
|
22
|
+
|
|
23
|
+
return new Promise(async function(resolve, reject) {
|
|
24
|
+
const _ = self.Manager.require('lodash');
|
|
25
|
+
|
|
26
|
+
const dataBefore = change.before.data();
|
|
27
|
+
const dataAfter = change.after.data();
|
|
28
|
+
|
|
29
|
+
let analytics;
|
|
24
30
|
let eventType;
|
|
31
|
+
|
|
25
32
|
if (dataAfter == undefined) {
|
|
26
33
|
eventType = 'delete';
|
|
27
34
|
} else if (dataBefore && dataAfter) {
|
|
@@ -54,15 +61,19 @@ let Module = {
|
|
|
54
61
|
action: 'notification-unsubscribe',
|
|
55
62
|
// label: 'regular',
|
|
56
63
|
});
|
|
64
|
+
|
|
57
65
|
assistant.log('Notification subscription deleted:', dataBefore, {environment: 'production'});
|
|
66
|
+
|
|
67
|
+
return resolve(dataBefore);
|
|
58
68
|
})
|
|
59
69
|
.catch(e => {
|
|
60
70
|
assistant.error(e, {environment: 'production'});
|
|
71
|
+
return reject(e);
|
|
61
72
|
})
|
|
62
73
|
|
|
63
74
|
// Update event
|
|
64
75
|
} else if (eventType === 'update') {
|
|
65
|
-
|
|
76
|
+
return resolve();
|
|
66
77
|
|
|
67
78
|
// Create event
|
|
68
79
|
} else if (eventType === 'create') {
|
|
@@ -82,13 +93,17 @@ let Module = {
|
|
|
82
93
|
});
|
|
83
94
|
|
|
84
95
|
assistant.log('Notification subscription created:', dataAfter, {environment: 'production'});
|
|
96
|
+
|
|
97
|
+
return resolve(dataAfter);
|
|
85
98
|
})
|
|
86
99
|
.catch(e => {
|
|
87
100
|
assistant.error(e, {environment: 'production'});
|
|
101
|
+
return reject(e);
|
|
88
102
|
})
|
|
89
103
|
}
|
|
90
104
|
|
|
91
|
-
}
|
|
92
|
-
}
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
|
|
93
108
|
|
|
94
109
|
module.exports = Module;
|