@steedos/service-package-registry 2.5.3-beta.15 → 2.5.3-beta.16
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.
|
@@ -5,6 +5,9 @@ const registry = require('../manager/registry');
|
|
|
5
5
|
const loader = require('../manager/loader');
|
|
6
6
|
const objectql = require('@steedos/objectql');
|
|
7
7
|
let schema = objectql.getSteedosSchema();
|
|
8
|
+
|
|
9
|
+
const packageInstallationNodeID = process.env.STEEDOS_PACKAGE_INSTALLATION_NODEID || null;
|
|
10
|
+
console.log(`load nodes.router.js.....`, packageInstallationNodeID)
|
|
8
11
|
router.get('/api/nodes/install', core.requireAuthentication, async function (req, res) {
|
|
9
12
|
const userSession = req.user;
|
|
10
13
|
const isSpaceAdmin = userSession.is_space_admin;
|
|
@@ -13,12 +16,12 @@ router.get('/api/nodes/install', core.requireAuthentication, async function (req
|
|
|
13
16
|
return res.status(401).send({ message: 'No permission' });
|
|
14
17
|
}
|
|
15
18
|
try {
|
|
16
|
-
const { module, version, label, description
|
|
19
|
+
const { module, version, label, description} = body || {};
|
|
17
20
|
let broker = schema.broker;
|
|
18
21
|
const result = await broker.call(`~packages-project-server.installPackage`, {
|
|
19
22
|
module, version, label, description
|
|
20
23
|
},{
|
|
21
|
-
nodeID:
|
|
24
|
+
nodeID: packageInstallationNodeID
|
|
22
25
|
})
|
|
23
26
|
res.redirect(302, `/app/admin/steedos_packages/grid/all`);
|
|
24
27
|
// res.status(200).send(result); //TODO 完善返回信息
|
|
@@ -43,7 +46,7 @@ router.post('/api/nodes/uninstall', core.requireAuthentication, async function (
|
|
|
43
46
|
const result = await broker.call(`~packages-project-server.uninstallPackage`, {
|
|
44
47
|
module
|
|
45
48
|
},{
|
|
46
|
-
nodeID:
|
|
49
|
+
nodeID: packageInstallationNodeID
|
|
47
50
|
})
|
|
48
51
|
res.status(200).send(result); //TODO 完善返回信息
|
|
49
52
|
} catch (error) {
|
|
@@ -65,7 +68,7 @@ router.post('/api/nodes/reload', core.requireAuthentication, async function (req
|
|
|
65
68
|
const result = await broker.call(`~packages-project-server.reloadPackage`, {
|
|
66
69
|
module
|
|
67
70
|
},{
|
|
68
|
-
nodeID:
|
|
71
|
+
nodeID: packageInstallationNodeID
|
|
69
72
|
})
|
|
70
73
|
res.status(200).send(result);
|
|
71
74
|
} catch (error) {
|
|
@@ -84,10 +87,11 @@ router.post('/api/nodes/disable', core.requireAuthentication, async function (re
|
|
|
84
87
|
try {
|
|
85
88
|
const { module, nodeID} = body || {};
|
|
86
89
|
let broker = schema.broker;
|
|
90
|
+
console.log(`disablePackage ${module}, node id is`, packageInstallationNodeID)
|
|
87
91
|
const result = await broker.call(`~packages-project-server.disablePackage`, {
|
|
88
92
|
module
|
|
89
93
|
},{
|
|
90
|
-
nodeID:
|
|
94
|
+
nodeID: packageInstallationNodeID
|
|
91
95
|
})
|
|
92
96
|
res.status(200).send(result);
|
|
93
97
|
} catch (error) {
|
|
@@ -109,7 +113,7 @@ router.post('/api/nodes/enable', core.requireAuthentication, async function (req
|
|
|
109
113
|
const result = await broker.call(`~packages-project-server.enablePackage`, {
|
|
110
114
|
module
|
|
111
115
|
},{
|
|
112
|
-
nodeID:
|
|
116
|
+
nodeID: packageInstallationNodeID
|
|
113
117
|
})
|
|
114
118
|
res.status(200).send(result);
|
|
115
119
|
} catch (error) {
|
|
@@ -134,6 +138,8 @@ router.get('/api/nodes/versions', core.requireAuthentication, async function (re
|
|
|
134
138
|
let broker = schema.broker;
|
|
135
139
|
const result = await broker.call(`~packages-project-server.getPackageVersions`, {
|
|
136
140
|
module
|
|
141
|
+
},{
|
|
142
|
+
nodeID: packageInstallationNodeID
|
|
137
143
|
})
|
|
138
144
|
res.status(200).send(result); //TODO 完善返回信息
|
|
139
145
|
} catch (error) {
|
|
@@ -154,6 +160,8 @@ router.post('/api/nodes/upgrade', core.requireAuthentication, async function (re
|
|
|
154
160
|
let broker = schema.broker;
|
|
155
161
|
const result = await broker.call(`~packages-project-server.upgradePackage`, {
|
|
156
162
|
module, version
|
|
163
|
+
},{
|
|
164
|
+
nodeID: packageInstallationNodeID
|
|
157
165
|
})
|
|
158
166
|
res.status(200).send(result);
|
|
159
167
|
} catch (error) {
|
|
@@ -162,5 +170,58 @@ router.post('/api/nodes/upgrade', core.requireAuthentication, async function (re
|
|
|
162
170
|
}
|
|
163
171
|
});
|
|
164
172
|
|
|
173
|
+
router.get('/api/nodes/cloud/saas/packages/purchased', core.requireAuthentication, async function (req, res) {
|
|
174
|
+
const userSession = req.user;
|
|
175
|
+
try {
|
|
176
|
+
let broker = schema.broker;
|
|
177
|
+
const result = await broker.call(`~packages-project-server.getCloudSaasPurchasedPackages`, {
|
|
178
|
+
}, {
|
|
179
|
+
nodeID: packageInstallationNodeID,
|
|
180
|
+
meta: {
|
|
181
|
+
user: userSession
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
res.status(200).send(result);
|
|
185
|
+
} catch (error) {
|
|
186
|
+
console.error(error);
|
|
187
|
+
res.status(500).send(error.message);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
router.post('/api/nodes/cloud/saas/packages/purchased', core.requireAuthentication, async function(req, res){
|
|
192
|
+
const userSession = req.user;
|
|
193
|
+
try {
|
|
194
|
+
let broker = schema.broker;
|
|
195
|
+
const result = await broker.call(`~packages-project-server.installPurchasedPackages`, {}, {
|
|
196
|
+
nodeID: packageInstallationNodeID,
|
|
197
|
+
meta: {
|
|
198
|
+
user: userSession
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
res.status(200).send(result);
|
|
202
|
+
} catch (error) {
|
|
203
|
+
console.error(error);
|
|
204
|
+
res.status(500).send(error.message);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
router.post('/api/nodes/cloud/saas/packages/url', core.requireAuthentication, async function(req, res){
|
|
209
|
+
const userSession = req.user;
|
|
210
|
+
try {
|
|
211
|
+
let broker = schema.broker;
|
|
212
|
+
const { module, version, url, auth, registry_url } = req.body;
|
|
213
|
+
const result = await broker.call(`~packages-project-server.installPackageFromUrl`, {module, version, url, auth, registry_url}, {
|
|
214
|
+
nodeID: packageInstallationNodeID,
|
|
215
|
+
meta: {
|
|
216
|
+
user: userSession
|
|
217
|
+
}
|
|
218
|
+
})
|
|
219
|
+
res.status(200).send(result);
|
|
220
|
+
} catch (error) {
|
|
221
|
+
console.error(error);
|
|
222
|
+
res.status(500).send(error.message);
|
|
223
|
+
}
|
|
224
|
+
})
|
|
225
|
+
|
|
165
226
|
|
|
166
227
|
exports.default = router;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-package-registry",
|
|
3
|
-
"version": "2.5.3-beta.
|
|
3
|
+
"version": "2.5.3-beta.16",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "package.service.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"author": "",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@steedos/auth": "2.5.3-beta.
|
|
13
|
-
"@steedos/core": "2.5.3-beta.
|
|
14
|
-
"@steedos/metadata-core": "2.5.3-beta.
|
|
15
|
-
"@steedos/objectql": "2.5.3-beta.
|
|
16
|
-
"@steedos/service-package-loader": "2.5.3-beta.
|
|
12
|
+
"@steedos/auth": "2.5.3-beta.16",
|
|
13
|
+
"@steedos/core": "2.5.3-beta.16",
|
|
14
|
+
"@steedos/metadata-core": "2.5.3-beta.16",
|
|
15
|
+
"@steedos/objectql": "2.5.3-beta.16",
|
|
16
|
+
"@steedos/service-package-loader": "2.5.3-beta.16",
|
|
17
17
|
"fs-extra": "8.1.0",
|
|
18
18
|
"i18next": "20.3.2",
|
|
19
19
|
"json-stringify-safe": "5.0.1",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "ef2a20e8380004854e0428016d3468c4b5ea7c0b"
|
|
35
35
|
}
|
|
@@ -16,6 +16,7 @@ const { MoleculerError } = require("moleculer").Errors;
|
|
|
16
16
|
const validator = require('validator');
|
|
17
17
|
const npa = require("npm-package-arg");
|
|
18
18
|
const login = require('./main/default/manager/login');
|
|
19
|
+
// const objectql = require('@steedos/objectql');
|
|
19
20
|
|
|
20
21
|
const HEADER_AUTH = 'Authorization';
|
|
21
22
|
const AUTH_TYPE = 'Bearer';
|
|
@@ -558,6 +559,7 @@ module.exports = {
|
|
|
558
559
|
* Service started lifecycle event handler
|
|
559
560
|
*/
|
|
560
561
|
async started() {
|
|
562
|
+
// objectql.getSteedosSchema(this.broker);
|
|
561
563
|
try {
|
|
562
564
|
await this.loginSteedosRegistry();
|
|
563
565
|
console.info(`login steedos registry success`);
|