@steedos/service-package-loader 2.5.5 → 2.6.1-beta.2
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 +29 -12
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const path = require('path');
|
|
|
8
8
|
const _ = require('lodash');
|
|
9
9
|
const fs = require("fs");
|
|
10
10
|
const metaDataCore = require('@steedos/metadata-core');
|
|
11
|
-
const { registerMetadataConfigs, loadStandardMetadata, loadRouters } = require('@steedos/metadata-registrar');
|
|
11
|
+
const { registerMetadataConfigs, loadStandardMetadata, loadRouters, canLoadMetadata } = require('@steedos/metadata-registrar');
|
|
12
12
|
const loadFlowFile = new metaDataCore.LoadFlowFile();
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -106,6 +106,9 @@ module.exports = {
|
|
|
106
106
|
}
|
|
107
107
|
},
|
|
108
108
|
sendPackageFlowToDb: async function(packagePath, name) {
|
|
109
|
+
if(!canLoadMetadata('Flow')){
|
|
110
|
+
return ;
|
|
111
|
+
}
|
|
109
112
|
const flows = loadFlowFile.load(path.join(packagePath, '**'));
|
|
110
113
|
for (const apiName in flows) {
|
|
111
114
|
const flow = flows[apiName];
|
|
@@ -128,11 +131,12 @@ module.exports = {
|
|
|
128
131
|
return;
|
|
129
132
|
}
|
|
130
133
|
const { path : _path } = packageInfo;
|
|
131
|
-
|
|
132
134
|
this.loadPackagePublicFiles(_path);
|
|
133
135
|
if(_path){
|
|
134
136
|
this.sendPackageFlowToDb(_path)
|
|
135
|
-
|
|
137
|
+
if(canLoadMetadata('Process')){
|
|
138
|
+
processLoader.sendPackageProcessToDb(_path);
|
|
139
|
+
}
|
|
136
140
|
}
|
|
137
141
|
},
|
|
138
142
|
loadPackageMetadataFiles: async function (packagePath, name, datasourceName) {
|
|
@@ -142,17 +146,27 @@ module.exports = {
|
|
|
142
146
|
datasourceName = 'default';
|
|
143
147
|
}
|
|
144
148
|
if(this.objectql){
|
|
145
|
-
await this.initDataSource(packagePath, datasourceName);
|
|
146
149
|
await loadStandardMetadata(name, datasourceName);
|
|
150
|
+
await this.initDataSource(packagePath, datasourceName);
|
|
147
151
|
}
|
|
148
152
|
await registerMetadataConfigs(packagePath, datasourceName, name);
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
153
|
+
if(canLoadMetadata('Trigger')){
|
|
154
|
+
await triggerLoader.load(this.broker, packagePath, name);
|
|
155
|
+
}
|
|
156
|
+
if(canLoadMetadata('ProcessTrigger')){
|
|
157
|
+
await processTriggerLoader.load(this.broker, packagePath, name);
|
|
158
|
+
}
|
|
159
|
+
if(canLoadMetadata('TriggerYml')){
|
|
160
|
+
await triggerYmlLoader.load(this.broker, packagePath, name);
|
|
161
|
+
}
|
|
152
162
|
if(this.core){
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
163
|
+
if(canLoadMetadata('ClientJS')){
|
|
164
|
+
this.core.loadClientScripts();
|
|
165
|
+
}
|
|
166
|
+
if(canLoadMetadata('Router')){
|
|
167
|
+
const routersInfo = await this.loadPackageRouters(packagePath, name);
|
|
168
|
+
await this.broker.call(`@steedos/service-packages.setPackageRoutersInfo`, {packageName: name, data: routersInfo});
|
|
169
|
+
}
|
|
156
170
|
}
|
|
157
171
|
await this.broker.emit(`translations.object.change`, {});
|
|
158
172
|
return;
|
|
@@ -178,6 +192,9 @@ module.exports = {
|
|
|
178
192
|
},
|
|
179
193
|
loadPackagePublicFiles: {
|
|
180
194
|
handler(packagePath) {
|
|
195
|
+
if(!canLoadMetadata('PublicFolder')){
|
|
196
|
+
return ;
|
|
197
|
+
}
|
|
181
198
|
if (!this.settings.packageInfo.loadPublicFolder) {
|
|
182
199
|
return;
|
|
183
200
|
}
|
|
@@ -189,7 +206,6 @@ module.exports = {
|
|
|
189
206
|
} catch (error) {
|
|
190
207
|
return
|
|
191
208
|
}
|
|
192
|
-
|
|
193
209
|
try {
|
|
194
210
|
const express = require('express');
|
|
195
211
|
this.settings.loadedPackagePublicFiles = true;
|
|
@@ -200,6 +216,7 @@ module.exports = {
|
|
|
200
216
|
routerPath = __meteor_runtime_config__.ROOT_URL_PATH_PREFIX;
|
|
201
217
|
}
|
|
202
218
|
const cacheTime = 86400000 * 1; // one day
|
|
219
|
+
// console.log(`static router`, routerPath, publicPath)
|
|
203
220
|
router.use(routerPath, express.static(publicPath, { maxAge: cacheTime }));
|
|
204
221
|
// WebApp.connectHandlers.use(router);
|
|
205
222
|
} catch (error) {
|
|
@@ -254,7 +271,7 @@ module.exports = {
|
|
|
254
271
|
|
|
255
272
|
}
|
|
256
273
|
}
|
|
257
|
-
|
|
274
|
+
|
|
258
275
|
await this.loadPackageMetadataServices(_path);
|
|
259
276
|
|
|
260
277
|
// await this.loadPackagePublicFiles(_path);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-package-loader",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1-beta.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@steedos/metadata-core": "2.
|
|
14
|
-
"@steedos/metadata-registrar": "2.
|
|
15
|
-
"@steedos/router": "2.
|
|
13
|
+
"@steedos/metadata-core": "2.6.1-beta.2",
|
|
14
|
+
"@steedos/metadata-registrar": "2.6.1-beta.2",
|
|
15
|
+
"@steedos/router": "2.6.1-beta.2",
|
|
16
16
|
"clone": "^2.1.2",
|
|
17
17
|
"moleculer": "^0.14.25",
|
|
18
18
|
"underscore": "^1.12.0"
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "9051772a001ba99aeaf026680ef171d508e92b8f"
|
|
28
28
|
}
|