@steedos/service-package-loader 2.3.1-beta.2 → 2.3.1-beta.3
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 +32 -36
- package/package.json +6 -6
package/index.js
CHANGED
|
@@ -7,9 +7,7 @@ const processLoader = require('./lib').processLoader;
|
|
|
7
7
|
const processTriggerLoader = require('./lib').processTriggerLoader;
|
|
8
8
|
const sendPackageFlowToDb = require('./lib/loadPackageFlow').sendPackageFlowToDb;
|
|
9
9
|
const path = require('path');
|
|
10
|
-
const Future = require('fibers/future');
|
|
11
10
|
const _ = require('lodash');
|
|
12
|
-
const globby = require("globby");
|
|
13
11
|
const express = require('express');
|
|
14
12
|
const fs = require("fs");
|
|
15
13
|
const metaDataCore = require('@steedos/metadata-core');
|
|
@@ -79,41 +77,39 @@ module.exports = {
|
|
|
79
77
|
},
|
|
80
78
|
loadPackageMetadataFiles: async function (packagePath, name, datasourceName) {
|
|
81
79
|
this.broker.logger.debug(`Loading package from ${packagePath}`)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
_.
|
|
100
|
-
|
|
101
|
-
return item.path == info.path && JSON.stringify(item.methods) == JSON.stringify(info.methods) && item.md5 == info.md5
|
|
102
|
-
})
|
|
103
|
-
if(!_info){
|
|
104
|
-
core.removeRouter(info.path, info.methods)
|
|
105
|
-
}
|
|
80
|
+
if (!datasourceName) {
|
|
81
|
+
datasourceName = 'default';
|
|
82
|
+
}
|
|
83
|
+
objectql.getSteedosSchema(this.broker);
|
|
84
|
+
packagePath = path.join(packagePath, '**');
|
|
85
|
+
const datasource = objectql.getDataSource(datasourceName);
|
|
86
|
+
await datasource.init();
|
|
87
|
+
await objectql.loadStandardMetadata(name, datasourceName);
|
|
88
|
+
await objectql.addAllConfigFiles(packagePath, datasourceName, name);
|
|
89
|
+
await triggerLoader.load(this.broker, packagePath, name);
|
|
90
|
+
await processTriggerLoader.load(this.broker, packagePath, name);
|
|
91
|
+
core.loadClientScripts();
|
|
92
|
+
let routersData = objectql.loadRouters(packagePath);
|
|
93
|
+
let oldRoutersInfo = await this.broker.call(`@steedos/service-packages.getPackageRoutersInfo`, {packageName: name})
|
|
94
|
+
let routersInfo = _.flattenDeep(_.map(routersData, 'infoList'));
|
|
95
|
+
if(oldRoutersInfo){
|
|
96
|
+
_.each(oldRoutersInfo.metadata, (info)=>{
|
|
97
|
+
const _info = _.find(routersInfo, (item)=>{
|
|
98
|
+
return item.path == info.path && JSON.stringify(item.methods) == JSON.stringify(info.methods) && item.md5 == info.md5
|
|
106
99
|
})
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
100
|
+
if(!_info){
|
|
101
|
+
core.removeRouter(info.path, info.methods)
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
const _routers = [];
|
|
106
|
+
routersData.forEach(element => {
|
|
107
|
+
_routers.push(element)
|
|
108
|
+
});
|
|
109
|
+
core.loadRouters(_routers);
|
|
110
|
+
await this.broker.call(`@steedos/service-packages.setPackageRoutersInfo`, {packageName: name, data: routersInfo});
|
|
111
|
+
await this.broker.emit(`translations.object.change`, {});
|
|
112
|
+
return;
|
|
117
113
|
},
|
|
118
114
|
loadPackageMetadataServices: async function (packagePath) {
|
|
119
115
|
const filePatten = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-package-loader",
|
|
3
|
-
"version": "2.3.1-beta.
|
|
3
|
+
"version": "2.3.1-beta.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@steedos/core": "2.3.1-beta.
|
|
14
|
-
"@steedos/metadata-core": "2.3.1-beta.
|
|
15
|
-
"@steedos/objectql": "2.3.1-beta.
|
|
13
|
+
"@steedos/core": "2.3.1-beta.3",
|
|
14
|
+
"@steedos/metadata-core": "2.3.1-beta.3",
|
|
15
|
+
"@steedos/objectql": "2.3.1-beta.3",
|
|
16
16
|
"clone": "^2.1.2",
|
|
17
|
-
"moleculer": "^0.14.
|
|
17
|
+
"moleculer": "^0.14.25",
|
|
18
18
|
"underscore": "^1.12.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "295037dcb3bd046c5c65a06e02b74e76c0ee7ac2"
|
|
28
28
|
}
|