@forzalabs/remora 0.0.17 → 0.0.18
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/run.js +7 -2
- package/engines/UserManager.js +11 -0
- package/engines/Validator.js +8 -5
- package/engines/consumer/PostProcessor.js +0 -1
- package/package.json +1 -1
package/Constants.js
CHANGED
package/actions/run.js
CHANGED
|
@@ -30,8 +30,13 @@ const run = (consumerName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
30
30
|
const results = [];
|
|
31
31
|
for (let i = 0; i < consumersToExecute.length; i++) {
|
|
32
32
|
const consumer = consumersToExecute[i];
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
try {
|
|
34
|
+
const response = yield ConsumerEngine_1.default.execute(consumer, {}, user);
|
|
35
|
+
results.push({ consumer, response });
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error(chalk_1.default.red(`Failed to execute consumer ${consumer.name}:`, error instanceof Error ? error.message : String(error)));
|
|
39
|
+
}
|
|
35
40
|
}
|
|
36
41
|
spinner.succeed('All consumers have been successfully executed');
|
|
37
42
|
results.forEach(result => {
|
package/engines/UserManager.js
CHANGED
|
@@ -20,6 +20,8 @@ class UserManagerClass {
|
|
|
20
20
|
this.getUser = () => {
|
|
21
21
|
if (Helper_1.default.isDev())
|
|
22
22
|
return DEV_USER;
|
|
23
|
+
else
|
|
24
|
+
return MOCK_USER;
|
|
23
25
|
// TODO: figure out how to handle users
|
|
24
26
|
};
|
|
25
27
|
this.findOIDC = (oid) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41,3 +43,12 @@ const DEV_USER = {
|
|
|
41
43
|
_signature: '',
|
|
42
44
|
lastLogin: new Date().toJSON()
|
|
43
45
|
};
|
|
46
|
+
const MOCK_USER = {
|
|
47
|
+
_id: '__mock__',
|
|
48
|
+
auth: { oid: '', provider: 'azure' },
|
|
49
|
+
email: '',
|
|
50
|
+
name: 'mock',
|
|
51
|
+
roles: ['user'],
|
|
52
|
+
_signature: '',
|
|
53
|
+
lastLogin: new Date().toJSON()
|
|
54
|
+
};
|
package/engines/Validator.js
CHANGED
|
@@ -121,7 +121,7 @@ class ValidatorClass {
|
|
|
121
121
|
const groupingFields = fields.filter(x => x.grouping);
|
|
122
122
|
if (groupingFields.length > 1)
|
|
123
123
|
errors.push(`There can't be 2 fields with grouping defined at the same level (${groupingFields.map(x => x.key).join(', ')}). Level: ${level}`);
|
|
124
|
-
groupingFields.forEach(
|
|
124
|
+
groupingFields.forEach(field => {
|
|
125
125
|
if (field.grouping)
|
|
126
126
|
errors = [...errors, ...validateGroupingLevels(field.grouping.subFields, level + 1)];
|
|
127
127
|
});
|
|
@@ -134,13 +134,16 @@ class ValidatorClass {
|
|
|
134
134
|
const duplicatesTypes = Algo_1.default.uniq(duplicatesOutputs.map(x => x.format));
|
|
135
135
|
errors.push(`There are outputs with the same type. (duplicates type: ${duplicatesTypes.join(' and ')})`);
|
|
136
136
|
}
|
|
137
|
-
for (
|
|
138
|
-
const output = consumer.outputs[i];
|
|
137
|
+
for (const output of consumer.outputs) {
|
|
139
138
|
const format = output.format.toUpperCase();
|
|
140
139
|
if (format === 'SQL' && output.accellerated && output.direct)
|
|
141
140
|
errors.push(`An output SQL cannot be both direct and accelerated (output: ${format})`);
|
|
142
|
-
if ((format === 'CSV' || format === 'JSON' || format === 'PARQUET')
|
|
143
|
-
|
|
141
|
+
if ((format === 'CSV' || format === 'JSON' || format === 'PARQUET')) {
|
|
142
|
+
if (!output.exportDestination)
|
|
143
|
+
errors.push(`A static file output must have an export destination set (${format})`);
|
|
144
|
+
else if (!Environment_1.default.getSource(output.exportDestination))
|
|
145
|
+
errors.push(`The export destination "${output.exportDestination}" was not found in the sources.`);
|
|
146
|
+
}
|
|
144
147
|
}
|
|
145
148
|
}
|
|
146
149
|
catch (e) {
|
|
@@ -74,7 +74,6 @@ class PostProcessorClass {
|
|
|
74
74
|
(0, Affirm_1.default)(data, 'Invalid data');
|
|
75
75
|
(0, Affirm_1.default)(Array.isArray(data), 'Invalid data type, must be an array');
|
|
76
76
|
(0, Affirm_1.default)(producer, 'Invalid producer');
|
|
77
|
-
console.log('BBBBBBBBB');
|
|
78
77
|
const source = Environment_1.default.getSource(producer.source);
|
|
79
78
|
(0, Affirm_1.default)(source, `No source found for producer "${producer.name}" with name "${producer.source}"`);
|
|
80
79
|
const columns = FileCompiler_1.default.compileProducer(producer, source);
|