@steedos/service-package-loader 2.7.9 → 2.7.10-beta.10
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/index.js +43 -2
- package/package.json +6 -6
package/index.js
CHANGED
|
@@ -14,6 +14,9 @@ const metaDataCore = require('@steedos/metadata-core');
|
|
|
14
14
|
const { registerMetadataConfigs, loadStandardMetadata, loadRouters } = require('@steedos/metadata-registrar');
|
|
15
15
|
const moment = require('moment');
|
|
16
16
|
const objectMixin = require('@steedos/service-object-mixin')
|
|
17
|
+
const {
|
|
18
|
+
compressFiles, deleteFolderRecursive, mkTempFolder
|
|
19
|
+
} = require('@steedos/metadata-core');
|
|
17
20
|
|
|
18
21
|
const loadFlowFile = new metaDataCore.LoadFlowFile();
|
|
19
22
|
|
|
@@ -83,6 +86,16 @@ module.exports = {
|
|
|
83
86
|
// 扫描main/default/data文件夹
|
|
84
87
|
await this.importData(path.join(this.settings.packageInfo.path, 'main', 'default', 'data'), false, spaceId);
|
|
85
88
|
await this.loadDataOnServiceStarted(spaceId);
|
|
89
|
+
|
|
90
|
+
let packageInfo = this.settings.packageInfo;
|
|
91
|
+
if (!packageInfo) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const { path: packagePath, isUnmanaged } = packageInfo;
|
|
95
|
+
if (isUnmanaged && packagePath) {
|
|
96
|
+
const userSession = { spaceId: spaceId, userId: spaceDoc.owner };
|
|
97
|
+
await this.deployPackage(packagePath, userSession);
|
|
98
|
+
}
|
|
86
99
|
}
|
|
87
100
|
}
|
|
88
101
|
},
|
|
@@ -267,7 +280,7 @@ module.exports = {
|
|
|
267
280
|
if (!packageInfo) {
|
|
268
281
|
return;
|
|
269
282
|
}
|
|
270
|
-
const { path : _path, datasource, isPackage } = packageInfo;
|
|
283
|
+
const { path : _path, datasource, isPackage, isUnmanaged } = packageInfo;
|
|
271
284
|
if (!_path) {
|
|
272
285
|
this.logger.error(`Please config packageInfo in your settings.`);
|
|
273
286
|
console.log(`service ${this.name} started`);
|
|
@@ -277,7 +290,10 @@ module.exports = {
|
|
|
277
290
|
await this.loadDataOnServiceStarted()
|
|
278
291
|
});
|
|
279
292
|
|
|
280
|
-
|
|
293
|
+
if (true != isUnmanaged) {
|
|
294
|
+
// 受管软件包加载元数据文件,非受管软件包不加载
|
|
295
|
+
await this.loadPackageMetadataFiles(_path, this.name, datasource);
|
|
296
|
+
}
|
|
281
297
|
if(isPackage !== false){
|
|
282
298
|
try {
|
|
283
299
|
let _packageInfo = {};
|
|
@@ -335,7 +351,32 @@ module.exports = {
|
|
|
335
351
|
if(datasource){
|
|
336
352
|
await datasource.init();
|
|
337
353
|
}
|
|
354
|
+
},
|
|
355
|
+
async deployPackage(sourcePath, userSession){
|
|
356
|
+
try {
|
|
357
|
+
var tempDir = mkTempFolder('deploy-');
|
|
358
|
+
var option = { includeJs: false, tableTitle: 'Steedos Deploy', showLog: true, inDeploy: true };
|
|
359
|
+
|
|
360
|
+
compressFiles(sourcePath, sourcePath, tempDir, option, async (base64, zipDir) => {
|
|
361
|
+
const result = await this.broker.call('~packages-@steedos/metadata-api.deploy', {
|
|
362
|
+
fileBase64: base64,
|
|
363
|
+
}, {
|
|
364
|
+
timeout: 0,
|
|
365
|
+
meta: {
|
|
366
|
+
user: userSession
|
|
367
|
+
}
|
|
368
|
+
})
|
|
369
|
+
console.log(sourcePath, JSON.stringify(result))
|
|
370
|
+
deleteFolderRecursive(tempDir);
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
} catch (err) {
|
|
374
|
+
console.log(err);
|
|
375
|
+
throw err;
|
|
376
|
+
}
|
|
377
|
+
|
|
338
378
|
}
|
|
379
|
+
|
|
339
380
|
},
|
|
340
381
|
|
|
341
382
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-package-loader",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.10-beta.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@steedos/metadata-core": "2.7.
|
|
14
|
-
"@steedos/metadata-registrar": "2.7.
|
|
15
|
-
"@steedos/router": "2.7.
|
|
16
|
-
"@steedos/service-object-mixin": "2.7.
|
|
13
|
+
"@steedos/metadata-core": "2.7.10-beta.10",
|
|
14
|
+
"@steedos/metadata-registrar": "2.7.10-beta.10",
|
|
15
|
+
"@steedos/router": "2.7.10-beta.10",
|
|
16
|
+
"@steedos/service-object-mixin": "2.7.10-beta.10",
|
|
17
17
|
"clone": "^2.1.2",
|
|
18
18
|
"csvtojson": "~2.0.10",
|
|
19
19
|
"moleculer": "^0.14.25",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "cffd1ba851c6e18adcdd8b92f2c20d4d9d76247e"
|
|
32
32
|
}
|