@forzalabs/remora 0.0.18 → 0.0.19
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/Constants.js +1 -1
- package/actions/compile.js +1 -1
- package/actions/run.js +16 -8
- package/engines/Environment.js +10 -0
- package/engines/Validator.js +0 -1
- package/package.json +1 -1
package/Constants.js
CHANGED
package/actions/compile.js
CHANGED
|
@@ -39,7 +39,7 @@ const compile = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
39
39
|
errors = [...errors, ...envErrors];
|
|
40
40
|
if (errors.length === 0) {
|
|
41
41
|
spinner.succeed(chalk_1.default.green('Project structure validated successfully'));
|
|
42
|
-
console.log(chalk_1.default.
|
|
42
|
+
console.log(chalk_1.default.blueBright.bold('✅ Compilation complete!'));
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
45
|
spinner.fail(chalk_1.default.red('Validation failed with errors:'));
|
package/actions/run.js
CHANGED
|
@@ -19,9 +19,11 @@ const Environment_1 = __importDefault(require("../engines/Environment"));
|
|
|
19
19
|
const UserManager_1 = __importDefault(require("../engines/UserManager"));
|
|
20
20
|
const ConsumerEngine_1 = __importDefault(require("../engines/consumer/ConsumerEngine"));
|
|
21
21
|
const compile_1 = require("./compile");
|
|
22
|
+
const Helper_1 = __importDefault(require("../helper/Helper"));
|
|
22
23
|
const run = (consumerName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
24
|
try {
|
|
24
25
|
(0, compile_1.compile)();
|
|
26
|
+
console.log();
|
|
25
27
|
const spinner = (0, ora_1.default)(chalk_1.default.blue('Running consumer(s)...\n')).start();
|
|
26
28
|
const user = UserManager_1.default.getUser();
|
|
27
29
|
const consumersToExecute = (consumerName && consumerName.length > 0)
|
|
@@ -32,22 +34,28 @@ const run = (consumerName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
32
34
|
const consumer = consumersToExecute[i];
|
|
33
35
|
try {
|
|
34
36
|
const response = yield ConsumerEngine_1.default.execute(consumer, {}, user);
|
|
35
|
-
results.push({ consumer, response });
|
|
37
|
+
results.push({ success: true, consumer, response });
|
|
36
38
|
}
|
|
37
39
|
catch (error) {
|
|
38
|
-
|
|
40
|
+
results.push({ success: false, consumer, error: Helper_1.default.asError(error).message });
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
|
-
spinner.succeed('All consumers have been
|
|
42
|
-
results.forEach(
|
|
43
|
-
if (
|
|
44
|
-
|
|
43
|
+
spinner.succeed('All consumers have been executed:');
|
|
44
|
+
results.forEach(({ response, consumer, success, error }) => {
|
|
45
|
+
if (success) {
|
|
46
|
+
if (response.fileUri)
|
|
47
|
+
console.log(chalk_1.default.green(`• Consumer ${consumer.name} -> ${response.fileUri}`));
|
|
48
|
+
else
|
|
49
|
+
console.log(chalk_1.default.green(`• Consumer ${consumer.name} -> ${response.data.slice(0, 5).join('\n')}`));
|
|
45
50
|
}
|
|
46
51
|
else {
|
|
47
|
-
console.log(chalk_1.default.
|
|
52
|
+
console.log(chalk_1.default.red(`• Consumer ${consumer.name} -> Failed: ${error}`));
|
|
48
53
|
}
|
|
49
54
|
});
|
|
50
|
-
|
|
55
|
+
if (results.some(x => !x.success))
|
|
56
|
+
console.log(chalk_1.default.blueBright('\nℹ️ Run completed with errors'));
|
|
57
|
+
else
|
|
58
|
+
console.log(chalk_1.default.green('\n✅ Run complete!'));
|
|
51
59
|
process.exit(1);
|
|
52
60
|
}
|
|
53
61
|
catch (err) {
|
package/engines/Environment.js
CHANGED
|
@@ -123,7 +123,17 @@ class EnvironmentClass {
|
|
|
123
123
|
try {
|
|
124
124
|
errors = [...errors, ...Validator_1.default.validateSources(this._env.sources)];
|
|
125
125
|
errors = [...errors, ...Validator_1.default.validateProducers(this._env.producers)];
|
|
126
|
+
this._env.producers.forEach(prod => {
|
|
127
|
+
const ce = Validator_1.default.validateProducer(prod);
|
|
128
|
+
if (ce.length > 0)
|
|
129
|
+
errors.push(`Producer "${prod.name}" errors:\n${ce.map(x => `\t-${x}\n`)}`);
|
|
130
|
+
});
|
|
126
131
|
errors = [...errors, ...Validator_1.default.validateConsumers(this._env.consumers)];
|
|
132
|
+
this._env.consumers.forEach(cons => {
|
|
133
|
+
const ce = Validator_1.default.validateConsumer(cons);
|
|
134
|
+
if (ce.length > 0)
|
|
135
|
+
errors.push(`Consumer "${cons.name}" errors:\n${ce.map(x => `\t-${x}\n`)}`);
|
|
136
|
+
});
|
|
127
137
|
}
|
|
128
138
|
catch (e) {
|
|
129
139
|
if (errors.length === 0)
|
package/engines/Validator.js
CHANGED
|
@@ -65,7 +65,6 @@ class ValidatorClass {
|
|
|
65
65
|
const dupes = Algo_1.default.duplicatesObject(consumers, 'name');
|
|
66
66
|
if (dupes.length > 0)
|
|
67
67
|
errors.push(`Duplicate name(s) found in consumers: "${dupes.map(x => x.name).join(', ')}"`);
|
|
68
|
-
errors.push(...consumers.flatMap(x => this.validateConsumer(x)));
|
|
69
68
|
}
|
|
70
69
|
catch (e) {
|
|
71
70
|
if (errors.length === 0)
|