@steedos/service-package-loader 3.0.0-beta.98 → 3.0.0
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
CHANGED
|
@@ -19,6 +19,8 @@ const {
|
|
|
19
19
|
} = require('@steedos/metadata-core');
|
|
20
20
|
const sRouter = require('@steedos/router');
|
|
21
21
|
|
|
22
|
+
const chalk = require("chalk");
|
|
23
|
+
|
|
22
24
|
const getPackageYmlData = (packagePath)=>{
|
|
23
25
|
let packageYmlData = {};
|
|
24
26
|
if(fs.existsSync(path.join(packagePath, 'package.service.yml'))){
|
|
@@ -201,7 +203,7 @@ module.exports = {
|
|
|
201
203
|
}
|
|
202
204
|
},
|
|
203
205
|
async errorHandler(error) {
|
|
204
|
-
|
|
206
|
+
console.error(chalk.red(`[${this.name}] 启动失败: ${error.message}`));
|
|
205
207
|
await await this.broker.call(`@steedos/service-project.disablePackage`, {
|
|
206
208
|
module: this.schema.packageName
|
|
207
209
|
})
|
|
@@ -268,12 +270,12 @@ module.exports = {
|
|
|
268
270
|
this.started = true;
|
|
269
271
|
const endTime = moment();
|
|
270
272
|
const serviceName = this.name.length < 50 ? `${_.padEnd(this.name, 50, ' ')}` : this.name
|
|
271
|
-
|
|
273
|
+
console.log(chalk.green(`service ${serviceName} started: ${endTime.diff(startTime, 'seconds', true)}s`));
|
|
272
274
|
if(this.afterStart){
|
|
273
275
|
try {
|
|
274
276
|
await this.afterStart();
|
|
275
277
|
} catch (error) {
|
|
276
|
-
|
|
278
|
+
console.error(chalk.error(`[${this.name}]: ${error.message}`));
|
|
277
279
|
}
|
|
278
280
|
}
|
|
279
281
|
},
|
|
@@ -315,7 +317,7 @@ module.exports = {
|
|
|
315
317
|
return ;
|
|
316
318
|
}
|
|
317
319
|
compressFiles(sourcePath, sourcePath, tempDir, option, async (base64, zipDir) => {
|
|
318
|
-
const result = await this.broker.call('
|
|
320
|
+
const result = await this.broker.call('@steedos/metadata-api.deploy', {
|
|
319
321
|
fileBase64: base64,
|
|
320
322
|
packageInfo
|
|
321
323
|
}, {
|
|
@@ -356,7 +358,7 @@ module.exports = {
|
|
|
356
358
|
merged(schema) {
|
|
357
359
|
schema.packageName = schema.name;
|
|
358
360
|
if(!schema.metadata || !schema.metadata.$package){
|
|
359
|
-
schema.name =
|
|
361
|
+
schema.name = `${schema.name}`;
|
|
360
362
|
}
|
|
361
363
|
|
|
362
364
|
schema.settings.packageInfo = {
|
|
@@ -5,20 +5,31 @@ const lodash_1 = require("lodash");
|
|
|
5
5
|
const metadata_core_1 = require("@steedos/metadata-core");
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const fs = require("fs");
|
|
8
|
+
const yaml = require("js-yaml");
|
|
8
9
|
class ImportJson {
|
|
9
10
|
readFile(filePath) {
|
|
10
11
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
12
|
let results = [];
|
|
12
13
|
const filePatten = [
|
|
13
14
|
path.join(filePath, "**", "*.data.json"),
|
|
15
|
+
path.join(filePath, "**", "*.data.yml"),
|
|
14
16
|
"!" + path.join(filePath, "**", "*.flow.data.json"),
|
|
15
|
-
"!" + path.join(filePath, "node_modules")
|
|
17
|
+
"!" + path.join(filePath, "node_modules"),
|
|
16
18
|
];
|
|
17
19
|
const matchedPaths = (0, metadata_core_1.syncMatchFiles)(filePatten);
|
|
18
20
|
(0, lodash_1.each)(matchedPaths, (matchedPath) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
if (matchedPath.endsWith(".yml")) {
|
|
22
|
+
let ymlRecords = yaml.load(fs.readFileSync(matchedPath, "utf8"));
|
|
23
|
+
let records = (0, lodash_1.isArray)(ymlRecords) ? ymlRecords : [];
|
|
24
|
+
let objectName = path.basename(matchedPath).split(".")[0];
|
|
25
|
+
results.push({ objectName: objectName, records: records });
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
else if (matchedPath.endsWith(".data.json")) {
|
|
29
|
+
let records = JSON.parse(fs.readFileSync(matchedPath, "utf8").normalize("NFC"));
|
|
30
|
+
let objectName = path.basename(matchedPath).split(".")[0];
|
|
31
|
+
results.push({ objectName: objectName, records: records });
|
|
32
|
+
}
|
|
22
33
|
});
|
|
23
34
|
return results;
|
|
24
35
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImportJson.js","sourceRoot":"","sources":["../../src/imports/ImportJson.ts"],"names":[],"mappings":";;;AAQA,
|
|
1
|
+
{"version":3,"file":"ImportJson.js","sourceRoot":"","sources":["../../src/imports/ImportJson.ts"],"names":[],"mappings":";;;AAQA,mCAAuC;AAEvC,0DAAwD;AACxD,6BAA8B;AAC9B,yBAA0B;AAC1B,gCAAiC;AAEjC,MAAqB,UAAU;IACvB,QAAQ,CACZ,QAAgB;;YAEhB,IAAI,OAAO,GAAQ,EAAE,CAAC;YACtB,MAAM,UAAU,GAAG;gBACjB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,aAAa,CAAC;gBACxC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC;gBACvC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,kBAAkB,CAAC;gBACnD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC;aAC1C,CAAC;YAEF,MAAM,YAAY,GAAa,IAAA,8BAAc,EAAC,UAAU,CAAC,CAAC;YAC1D,IAAA,aAAI,EAAC,YAAY,EAAE,CAAC,WAAmB,EAAE,EAAE;gBACzC,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;oBACjC,IAAI,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;oBACjE,IAAI,OAAO,GAAG,IAAA,gBAAO,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;oBACpD,IAAI,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC1D,OAAO,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;oBAC3D,OAAO;gBACT,CAAC;qBAAM,IAAI,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;oBAC9C,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,CACtB,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CACtD,CAAC;oBACF,IAAI,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC1D,OAAO,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;gBAC7D,CAAC;YACH,CAAC,CAAC,CAAC;YACH,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;CACF;AA9BD,6BA8BC"}
|
|
@@ -13,8 +13,8 @@ function load(broker, packagePath, packageServiceName) {
|
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
for (const trigger of objTriggers) {
|
|
16
|
-
broker.emit(
|
|
17
|
-
objectName: trigger[
|
|
16
|
+
broker.emit("trigger.loaded", {
|
|
17
|
+
objectName: trigger["listenTo"],
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/triggerLoader/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/triggerLoader/index.ts"],"names":[],"mappings":";;AAuBA,oBAuDC;;AAvED,gCAAgC;AAChC,6BAA6B;AAE7B,oEAAiE;AAajE,SAAsB,IAAI,CACxB,MAAW,EACX,WAAmB,EACnB,kBAA0B;;QAI1B,IAAI,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAC5C,IAAI,WAAW,GAAG,IAAA,uCAAkB,EAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;QACnE,IAAI,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;YAC3B,OAAO;QACT,CAAC;QAeD,KAAK,MAAM,OAAO,IAAI,WAAW,EAAE,CAAC;YAgBlC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE;gBAC5B,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC;aAChC,CAAC,CAAC;QACL,CAAC;IAUH,CAAC;CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-package-loader",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@steedos/metadata-core": "3.0.0
|
|
14
|
-
"@steedos/metadata-registrar": "3.0.0
|
|
15
|
-
"@steedos/router": "3.0.0
|
|
16
|
-
"@steedos/service-object-mixin": "3.0.0
|
|
13
|
+
"@steedos/metadata-core": "3.0.0",
|
|
14
|
+
"@steedos/metadata-registrar": "3.0.0",
|
|
15
|
+
"@steedos/router": "3.0.0",
|
|
16
|
+
"@steedos/service-object-mixin": "3.0.0",
|
|
17
17
|
"clone": "^2.1.2",
|
|
18
18
|
"csvtojson": "~2.0.10",
|
|
19
|
-
"moleculer": "^0.14.
|
|
19
|
+
"moleculer": "^0.14.35",
|
|
20
20
|
"moment": "^2.24.0",
|
|
21
21
|
"node-xlsx": "^0.16.1",
|
|
22
22
|
"underscore": "^1.12.0"
|
|
@@ -24,9 +24,8 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"typescript": "5.7.3"
|
|
26
26
|
},
|
|
27
|
-
"private": false,
|
|
28
27
|
"publishConfig": {
|
|
29
28
|
"access": "public"
|
|
30
29
|
},
|
|
31
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "20ea485d800dd4ad0a99c82b26000879c2f85741"
|
|
32
31
|
}
|